@hellcoder/companion 0.121.0 → 0.122.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.
- package/dist/assets/{AgentsPage-ClW7bWRx.js → AgentsPage-DcOqIP9k.js} +1 -1
- package/dist/assets/{CronManager-CNRhJ7JU.js → CronManager-DNNKDHYb.js} +1 -1
- package/dist/assets/{DashboardPage-Ch_HQGg0.js → DashboardPage-B10_oar4.js} +1 -1
- package/dist/assets/{IntegrationsPage-BHj_BEVr.js → IntegrationsPage-C3o8sLpo.js} +1 -1
- package/dist/assets/{LinearOAuthSettingsPage-B5U70sHB.js → LinearOAuthSettingsPage-C181ckxW.js} +1 -1
- package/dist/assets/{LinearSettingsPage-CVmZKj9l.js → LinearSettingsPage-B-7G76Ns.js} +1 -1
- package/dist/assets/{MagicUIDashboard-5nBMuLS8.js → MagicUIDashboard-CkEZ3BVa.js} +1 -1
- package/dist/assets/{MagicUIView-CdHkHIEh.js → MagicUIView-BmwHDokR.js} +1 -1
- package/dist/assets/{Playground-Dpfq4KMB.js → Playground-DvE5Hx7h.js} +1 -1
- package/dist/assets/{PromptsPage-BHtp_9DW.js → PromptsPage-BFYinvPb.js} +1 -1
- package/dist/assets/{RunsPage-bbhhFNkd.js → RunsPage-C_wKk1gx.js} +1 -1
- package/dist/assets/{SandboxManager-b3xCX8cU.js → SandboxManager-DRRe06TY.js} +1 -1
- package/dist/assets/{SettingsPage-CEOoHbQk.js → SettingsPage-DlqgaG3K.js} +1 -1
- package/dist/assets/{TailscalePage-C1bGGkFU.js → TailscalePage-DHuSFb11.js} +1 -1
- package/dist/assets/index-BnF_YIhB.css +1 -0
- package/dist/assets/index-ZUC5y0cV.js +141 -0
- package/dist/assets/{sw-register-2ITbAS9w.js → sw-register-D2DuNbEG.js} +1 -1
- package/dist/index.html +2 -2
- package/dist/sw.js +1 -1
- package/package.json +1 -1
- package/server/session-orchestrator.test.ts +76 -0
- package/server/session-orchestrator.ts +52 -0
- package/server/settings-manager.ts +1 -1
- package/server/ws-bridge.ts +20 -3
- package/dist/assets/index-CUfPwiv5.css +0 -1
- package/dist/assets/index-_VjPWGkx.js +0 -141
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Playground-DvE5Hx7h.js","assets/MagicUIDashboard-CkEZ3BVa.js","assets/MagicUIView-BmwHDokR.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var NE=Object.defineProperty;var CE=(e,t,n)=>t in e?NE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var l_=(e,t,n)=>CE(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 c of a)if(c.type==="childList")for(const u of c.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&i(u)}).observe(document,{childList:!0,subtree:!0});function n(a){const c={};return a.integrity&&(c.integrity=a.integrity),a.referrerPolicy&&(c.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?c.credentials="include":a.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function i(a){if(a.ep)return;a.ep=!0;const c=n(a);fetch(a.href,c)}})();const EE="modulepreload",TE=function(e){return"/"+e},o_={},Vn=function(t,n,i){let a=Promise.resolve();if(n&&n.length>0){let u=function(m){return Promise.all(m.map(x=>Promise.resolve(x).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(m=>{if(m=TE(m),m in o_)return;o_[m]=!0;const x=m.endsWith(".css"),v=x?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${v}`))return;const b=document.createElement("link");if(b.rel=x?"stylesheet":EE,x||(b.as="script"),b.crossOrigin="",b.href=m,f&&b.setAttribute("nonce",f),document.head.appendChild(b),x)return new Promise((y,_)=>{b.addEventListener("load",y),b.addEventListener("error",()=>_(new Error(`Unable to preload CSS for ${m}`)))})}))}function c(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"&&c(h.reason);return t().catch(c)})};function px(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Wm={exports:{}},Rc={};/**
|
|
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 AE(){if(c_)return Rc;c_=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(i,a,c){var u=null;if(c!==void 0&&(u=""+c),a.key!==void 0&&(u=""+a.key),"key"in a){c={};for(var h in a)h!=="key"&&(c[h]=a[h])}else c=a;return a=c.ref,{$$typeof:e,type:i,key:u,ref:a!==void 0?a:null,props:c}}return Rc.Fragment=t,Rc.jsx=n,Rc.jsxs=n,Rc}var u_;function ME(){return u_||(u_=1,Wm.exports=AE()),Wm.exports}var l=ME(),Km={exports:{}},We={};/**
|
|
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 d_;function RE(){if(d_)return We;d_=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"),c=Symbol.for("react.consumer"),u=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),b=Symbol.for("react.view_transition"),y=Symbol.iterator;function _(P){return P===null||typeof P!="object"?null:(P=y&&P[y]||P["@@iterator"],typeof P=="function"?P:null)}var j={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,S={};function C(P,oe,_e){this.props=P,this.context=oe,this.refs=S,this.updater=_e||j}C.prototype.isReactComponent={},C.prototype.setState=function(P,oe){if(typeof P!="object"&&typeof P!="function"&&P!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,P,oe,"setState")},C.prototype.forceUpdate=function(P){this.updater.enqueueForceUpdate(this,P,"forceUpdate")};function E(){}E.prototype=C.prototype;function R(P,oe,_e){this.props=P,this.context=oe,this.refs=S,this.updater=_e||j}var L=R.prototype=new E;L.constructor=R,N(L,C.prototype),L.isPureReactComponent=!0;var O=Array.isArray;function F(){}var D={H:null,A:null,T:null,S:null},Q=Object.prototype.hasOwnProperty;function I(P,oe,_e){var Ne=_e.ref;return{$$typeof:e,type:P,key:oe,ref:Ne!==void 0?Ne:null,props:_e}}function X(P,oe){return I(P.type,oe,P.props)}function M(P){return typeof P=="object"&&P!==null&&P.$$typeof===e}function de(P){var oe={"=":"=0",":":"=2"};return"$"+P.replace(/[=:]/g,function(_e){return oe[_e]})}var W=/\/+/g;function q(P,oe){return typeof P=="object"&&P!==null&&P.key!=null?de(""+P.key):oe.toString(36)}function H(P){switch(P.status){case"fulfilled":return P.value;case"rejected":throw P.reason;default:switch(typeof P.status=="string"?P.then(F,F):(P.status="pending",P.then(function(oe){P.status==="pending"&&(P.status="fulfilled",P.value=oe)},function(oe){P.status==="pending"&&(P.status="rejected",P.reason=oe)})),P.status){case"fulfilled":return P.value;case"rejected":throw P.reason}}throw P}function U(P,oe,_e,Ne,Ae){var Le=typeof P;(Le==="undefined"||Le==="boolean")&&(P=null);var De=!1;if(P===null)De=!0;else switch(Le){case"bigint":case"string":case"number":De=!0;break;case"object":switch(P.$$typeof){case e:case t:De=!0;break;case x:return De=P._init,U(De(P._payload),oe,_e,Ne,Ae)}}if(De)return Ae=Ae(P),De=Ne===""?"."+q(P,0):Ne,O(Ae)?(_e="",De!=null&&(_e=De.replace(W,"$&/")+"/"),U(Ae,oe,_e,"",function(It){return It})):Ae!=null&&(M(Ae)&&(Ae=X(Ae,_e+(Ae.key==null||P&&P.key===Ae.key?"":(""+Ae.key).replace(W,"$&/")+"/")+De)),oe.push(Ae)),1;De=0;var Ce=Ne===""?".":Ne+":";if(O(P))for(var Re=0;Re<P.length;Re++)Ne=P[Re],Le=Ce+q(Ne,Re),De+=U(Ne,oe,_e,Le,Ae);else if(Re=_(P),typeof Re=="function")for(P=Re.call(P),Re=0;!(Ne=P.next()).done;)Ne=Ne.value,Le=Ce+q(Ne,Re++),De+=U(Ne,oe,_e,Le,Ae);else if(Le==="object"){if(typeof P.then=="function")return U(H(P),oe,_e,Ne,Ae);throw oe=String(P),Error("Objects are not valid as a React child (found: "+(oe==="[object Object]"?"object with keys {"+Object.keys(P).join(", ")+"}":oe)+"). If you meant to render a collection of children, use an array instead.")}return De}function re(P,oe,_e){if(P==null)return P;var Ne=[],Ae=0;return U(P,Ne,"","",function(Le){return oe.call(_e,Le,Ae++)}),Ne}function ve(P){if(P._status===-1){var oe=P._result,_e=oe();_e.then(function(Ne){(P._status===0||P._status===-1)&&(P._status=1,P._result=Ne,_e.status===void 0&&(_e.status="fulfilled",_e.value=Ne))},function(Ne){(P._status===0||P._status===-1)&&(P._status=2,P._result=Ne,_e.status===void 0&&(_e.status="rejected",_e.reason=Ne))}),P._status===-1&&(P._status=0,P._result=_e)}if(P._status===1)return P._result.default;throw P._result}var A=typeof reportError=="function"?reportError:function(P){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var oe=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof P=="object"&&P!==null&&typeof P.message=="string"?String(P.message):String(P),error:P});if(!window.dispatchEvent(oe))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",P);return}console.error(P)};function Ee(P){var oe=D.T,_e={};_e.types=oe!==null?oe.types:null,D.T=_e;try{var Ne=P(),Ae=D.S;Ae!==null&&Ae(_e,Ne),typeof Ne=="object"&&Ne!==null&&typeof Ne.then=="function"&&Ne.then(F,A)}catch(Le){A(Le)}finally{oe!==null&&_e.types!==null&&(oe.types=_e.types),D.T=oe}}function Me(P){var oe=D.T;if(oe!==null){var _e=oe.types;_e===null?oe.types=[P]:_e.indexOf(P)===-1&&_e.push(P)}else Ee(Me.bind(null,P))}var z={map:re,forEach:function(P,oe,_e){re(P,function(){oe.apply(this,arguments)},_e)},count:function(P){var oe=0;return re(P,function(){oe++}),oe},toArray:function(P){return re(P,function(oe){return oe})||[]},only:function(P){if(!M(P))throw Error("React.Children.only expected to receive a single React element child.");return P}};return We.Activity=v,We.Children=z,We.Component=C,We.Fragment=n,We.Profiler=a,We.PureComponent=R,We.StrictMode=i,We.Suspense=f,We.ViewTransition=b,We.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=D,We.__COMPILER_RUNTIME={__proto__:null,c:function(P){return D.H.useMemoCache(P)}},We.addTransitionType=Me,We.cache=function(P){return function(){return P.apply(null,arguments)}},We.cacheSignal=function(){return null},We.cloneElement=function(P,oe,_e){if(P==null)throw Error("The argument must be a React element, but you passed "+P+".");var Ne=N({},P.props),Ae=P.key;if(oe!=null)for(Le in oe.key!==void 0&&(Ae=""+oe.key),oe)!Q.call(oe,Le)||Le==="key"||Le==="__self"||Le==="__source"||Le==="ref"&&oe.ref===void 0||(Ne[Le]=oe[Le]);var Le=arguments.length-2;if(Le===1)Ne.children=_e;else if(1<Le){for(var De=Array(Le),Ce=0;Ce<Le;Ce++)De[Ce]=arguments[Ce+2];Ne.children=De}return I(P.type,Ae,Ne)},We.createContext=function(P){return P={$$typeof:u,_currentValue:P,_currentValue2:P,_threadCount:0,Provider:null,Consumer:null},P.Provider=P,P.Consumer={$$typeof:c,_context:P},P},We.createElement=function(P,oe,_e){var Ne,Ae={},Le=null;if(oe!=null)for(Ne in oe.key!==void 0&&(Le=""+oe.key),oe)Q.call(oe,Ne)&&Ne!=="key"&&Ne!=="__self"&&Ne!=="__source"&&(Ae[Ne]=oe[Ne]);var De=arguments.length-2;if(De===1)Ae.children=_e;else if(1<De){for(var Ce=Array(De),Re=0;Re<De;Re++)Ce[Re]=arguments[Re+2];Ae.children=Ce}if(P&&P.defaultProps)for(Ne in De=P.defaultProps,De)Ae[Ne]===void 0&&(Ae[Ne]=De[Ne]);return I(P,Le,Ae)},We.createRef=function(){return{current:null}},We.forwardRef=function(P){return{$$typeof:h,render:P}},We.isValidElement=M,We.lazy=function(P){return{$$typeof:x,_payload:{_status:-1,_result:P},_init:ve}},We.memo=function(P,oe){return{$$typeof:m,type:P,compare:oe===void 0?null:oe}},We.startTransition=Ee,We.unstable_useCacheRefresh=function(){return D.H.useCacheRefresh()},We.use=function(P){return D.H.use(P)},We.useActionState=function(P,oe,_e){return D.H.useActionState(P,oe,_e)},We.useCallback=function(P,oe){return D.H.useCallback(P,oe)},We.useContext=function(P){return D.H.useContext(P)},We.useDebugValue=function(){},We.useDeferredValue=function(P,oe){return D.H.useDeferredValue(P,oe)},We.useEffect=function(P,oe){return D.H.useEffect(P,oe)},We.useEffectEvent=function(P){return D.H.useEffectEvent(P)},We.useId=function(){return D.H.useId()},We.useImperativeHandle=function(P,oe,_e){return D.H.useImperativeHandle(P,oe,_e)},We.useInsertionEffect=function(P,oe){return D.H.useInsertionEffect(P,oe)},We.useLayoutEffect=function(P,oe){return D.H.useLayoutEffect(P,oe)},We.useMemo=function(P,oe){return D.H.useMemo(P,oe)},We.useOptimistic=function(P,oe){return D.H.useOptimistic(P,oe)},We.useReducer=function(P,oe,_e){return D.H.useReducer(P,oe,_e)},We.useRef=function(P){return D.H.useRef(P)},We.useState=function(P){return D.H.useState(P)},We.useSyncExternalStore=function(P,oe,_e){return D.H.useSyncExternalStore(P,oe,_e)},We.useTransition=function(){return D.H.useTransition()},We.version="19.3.0",We}var h_;function mx(){return h_||(h_=1,Km.exports=RE()),Km.exports}var k=mx();const rh=px(k);var Zm={exports:{}},Oc={},Jm={exports:{}},eg={};/**
|
|
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 f_;function OE(){return f_||(f_=1,(function(e){function t(H,U){var re=H.length;H.push(U);e:for(;0<re;){var ve=re-1>>>1,A=H[ve];if(0<a(A,U))H[ve]=U,H[re]=A,re=ve;else break e}}function n(H){return H.length===0?null:H[0]}function i(H){if(H.length===0)return null;var U=H[0],re=H.pop();if(re!==U){H[0]=re;e:for(var ve=0,A=H.length,Ee=A>>>1;ve<Ee;){var Me=2*(ve+1)-1,z=H[Me],P=Me+1,oe=H[P];if(0>a(z,re))P<A&&0>a(oe,z)?(H[ve]=oe,H[P]=re,ve=P):(H[ve]=z,H[Me]=re,ve=Me);else if(P<A&&0>a(oe,re))H[ve]=oe,H[P]=re,ve=P;else break e}}return U}function a(H,U){var re=H.sortIndex-U.sortIndex;return re!==0?re:H.id-U.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var u=Date,h=u.now();e.unstable_now=function(){return u.now()-h}}var f=[],m=[],x=1,v=null,b=3,y=!1,_=!1,j=!1,N=!1,S=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function R(H){for(var U=n(m);U!==null;){if(U.callback===null)i(m);else if(U.startTime<=H)i(m),U.sortIndex=U.expirationTime,t(f,U);else break;U=n(m)}}function L(H){if(j=!1,R(H),!_)if(n(f)!==null)_=!0,O||(O=!0,M());else{var U=n(m);U!==null&&q(L,U.startTime-H)}}var O=!1,F=-1,D=5,Q=-1;function I(){return N?!0:!(e.unstable_now()-Q<D)}function X(){if(N=!1,O){var H=e.unstable_now();Q=H;var U=!0;try{e:{_=!1,j&&(j=!1,C(F),F=-1),y=!0;var re=b;try{t:{for(R(H),v=n(f);v!==null&&!(v.expirationTime>H&&I());){var ve=v.callback;if(typeof ve=="function"){v.callback=null,b=v.priorityLevel;var A=ve(v.expirationTime<=H);if(H=e.unstable_now(),typeof A=="function"){v.callback=A,R(H),U=!0;break t}v===n(f)&&i(f),R(H)}else i(f);v=n(f)}if(v!==null)U=!0;else{var Ee=n(m);Ee!==null&&q(L,Ee.startTime-H),U=!1}}break e}finally{v=null,b=re,y=!1}U=void 0}}finally{U?M():O=!1}}}var M;if(typeof E=="function")M=function(){E(X)};else if(typeof MessageChannel<"u"){var de=new MessageChannel,W=de.port2;de.port1.onmessage=X,M=function(){W.postMessage(null)}}else M=function(){S(X,0)};function q(H,U){F=S(function(){H(e.unstable_now())},U)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(H){H.callback=null},e.unstable_forceFrameRate=function(H){0>H||125<H?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<H?Math.floor(1e3/H):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(H){switch(b){case 1:case 2:case 3:var U=3;break;default:U=b}var re=b;b=U;try{return H()}finally{b=re}},e.unstable_requestPaint=function(){N=!0},e.unstable_runWithPriority=function(H,U){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var re=b;b=H;try{return U()}finally{b=re}},e.unstable_scheduleCallback=function(H,U,re){var ve=e.unstable_now();switch(typeof re=="object"&&re!==null?(re=re.delay,re=typeof re=="number"&&0<re?ve+re:ve):re=ve,H){case 1:var A=-1;break;case 2:A=250;break;case 5:A=1073741823;break;case 4:A=1e4;break;default:A=5e3}return A=re+A,H={id:x++,callback:U,priorityLevel:H,startTime:re,expirationTime:A,sortIndex:-1},re>ve?(H.sortIndex=re,t(m,H),n(f)===null&&H===n(m)&&(j?(C(F),F=-1):j=!0,q(L,re-ve))):(H.sortIndex=A,t(f,H),_||y||(_=!0,O||(O=!0,M()))),H},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(H){var U=b;return function(){var re=b;b=U;try{return H.apply(this,arguments)}finally{b=re}}}})(eg)),eg}var p_;function LE(){return p_||(p_=1,Jm.exports=OE()),Jm.exports}var tg={exports:{}},Bn={};/**
|
|
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 m_;function DE(){if(m_)return Bn;m_=1;var e=mx();function t(x){var v="https://react.dev/errors/"+x;if(1<arguments.length){v+="?args[]="+encodeURIComponent(arguments[1]);for(var b=2;b<arguments.length;b++)v+="&args[]="+encodeURIComponent(arguments[b])}return"Minified React error #"+x+"; 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"),c=Symbol.for("react.recoverable"),u=Symbol.for("react.optimistic_key");function h(x,v,b){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:y==null?null:y===u?u:""+y,children:x,containerInfo:v,implementation:b}}var f=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function m(x,v){if(x==="font")return"";if(typeof v=="string")return v==="use-credentials"?v:""}return Bn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,Bn.browser=function(x){return{$$typeof:c,_reason:x}},Bn.createPortal=function(x,v){var b=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(x,v,null,b)},Bn.flushSync=function(x){var v=f.T,b=i.p;try{if(f.T=null,i.p=2,x)return x()}finally{f.T=v,i.p=b,i.d.f()}},Bn.preconnect=function(x,v){typeof x=="string"&&(v?(v=v.crossOrigin,v=typeof v=="string"?v==="use-credentials"?v:"":void 0):v=null,i.d.C(x,v))},Bn.prefetchDNS=function(x){typeof x=="string"&&i.d.D(x)},Bn.preinit=function(x,v){if(typeof x=="string"&&v&&typeof v.as=="string"){var b=v.as,y=m(b,v.crossOrigin),_=typeof v.integrity=="string"?v.integrity:void 0,j=typeof v.fetchPriority=="string"?v.fetchPriority:void 0;b==="style"?i.d.S(x,typeof v.precedence=="string"?v.precedence:void 0,{crossOrigin:y,integrity:_,fetchPriority:j}):b==="script"&&i.d.X(x,{crossOrigin:y,integrity:_,fetchPriority:j,nonce:typeof v.nonce=="string"?v.nonce:void 0})}},Bn.preinitModule=function(x,v){if(typeof x=="string")if(typeof v=="object"&&v!==null){if(v.as==null||v.as==="script"){var b=m(v.as,v.crossOrigin);i.d.M(x,{crossOrigin:b,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(x)},Bn.preload=function(x,v){if(typeof x=="string"&&typeof v=="object"&&v!==null&&typeof v.as=="string"){var b=v.as,y=m(b,v.crossOrigin);i.d.L(x,b,{crossOrigin:y,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})}},Bn.preloadModule=function(x,v){if(typeof x=="string")if(v){var b=m(v.as,v.crossOrigin);i.d.m(x,{as:typeof v.as=="string"&&v.as!=="script"?v.as:void 0,crossOrigin:b,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(x)},Bn.requestFormReset=function(x){i.d.r(x)},Bn.unstable_batchedUpdates=function(x,v){return x(v)},Bn.useFormState=function(x,v,b){return f.H.useFormState(x,v,b)},Bn.useFormStatus=function(){return f.H.useHostTransitionStatus()},Bn.version="19.3.0",Bn}var g_;function O2(){if(g_)return tg.exports;g_=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=DE(),tg.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 x_;function zE(){if(x_)return Oc;x_=1;var e=LE(),t=mx(),n=O2();function i(s){var r="https://react.dev/errors/"+s;if(1<arguments.length){r+="?args[]="+encodeURIComponent(arguments[1]);for(var o=2;o<arguments.length;o++)r+="&args[]="+encodeURIComponent(arguments[o])}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 c(s){for(var r=s,o=r;o&&!o.alternate;)r=o,(r.flags&4098)!==0&&(s=r.return),o=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(c(s)!==s)throw Error(i(188))}function m(s){var r=s.alternate;if(!r){if(r=c(s),r===null)throw Error(i(188));return r!==s?null:s}for(var o=s,d=r;;){var p=o.return;if(p===null)break;var g=p.alternate;if(g===null){if(d=p.return,d!==null){o=d;continue}break}if(p.child===g.child){for(g=p.child;g;){if(g===o)return f(p),s;if(g===d)return f(p),r;g=g.sibling}throw Error(i(188))}if(o.return!==d.return)o=p,d=g;else{for(var w=!1,T=p.child;T;){if(T===o){w=!0,o=p,d=g;break}if(T===d){w=!0,d=p,o=g;break}T=T.sibling}if(!w){for(T=g.child;T;){if(T===o){w=!0,o=g,d=p;break}if(T===d){w=!0,d=g,o=p;break}T=T.sibling}if(!w)throw Error(i(189))}}if(o.alternate!==d)throw Error(i(190))}if(o.tag!==3)throw Error(i(188));return o.stateNode.current===o?s:r}function x(s){var r=s.tag;if(r===5||r===26||r===27||r===6)return s;for(s=s.child;s!==null;){if(r=x(s),r!==null)return r;s=s.sibling}return null}function v(s,r,o,d,p,g){for(;s!==null;){if((s.tag===5||s.tag===27||s.tag===6)&&o(s,d,p,g)||(s.tag!==22||s.memoizedState===null)&&(r||s.tag!==5&&s.tag!==27)&&v(s.child,r,o,d,p,g))return!0;s=s.sibling}return!1}function b(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 y(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],o=b(s);return o===null||j(r,s,o.child,{foundSelf:!1}),r}function j(s,r,o,d){for(;o!==null;){if(o===r)d.foundSelf=!0;else if(o.tag===5||o.tag===27||o.tag===6){if(d.foundSelf)return s[1]=o,!0;s[0]=o}else if((o.tag!==22||o.memoizedState===null)&&j(s,r,o.child,d))return!0;o=o.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 E(s,r,o){return s===o?!0:s===r?(S=s,!0):!1}function R(s,r,o){return s===o?(C=s,!1):s===r?(C!==null&&(S=s),!0):!1}function L(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,o){for(var d=0,p=s;p;p=o(p))d++;p=0;for(var g=r;g;g=o(g))p++;for(;0<d-p;)s=o(s),d--;for(;0<p-d;)r=o(r),p--;for(;d--;){if(s===r||r!==null&&s===r.alternate)return s;s=o(s),r=o(r)}return null}var F=Object.assign,D=Symbol.for("react.element"),Q=Symbol.for("react.transitional.element"),I=Symbol.for("react.portal"),X=Symbol.for("react.fragment"),M=Symbol.for("react.strict_mode"),de=Symbol.for("react.profiler"),W=Symbol.for("react.consumer"),q=Symbol.for("react.context"),H=Symbol.for("react.forward_ref"),U=Symbol.for("react.suspense"),re=Symbol.for("react.suspense_list"),ve=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),Ee=Symbol.for("react.activity"),Me=Symbol.for("react.legacy_hidden"),z=Symbol.for("react.memo_cache_sentinel"),P=Symbol.for("react.view_transition"),oe=Symbol.for("react.recoverable"),_e=Symbol.iterator;function Ne(s){return s===null||typeof s!="object"?null:(s=_e&&s[_e]||s["@@iterator"],typeof s=="function"?s:null)}var Ae=Symbol.for("react.client.reference");function Le(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===Ae?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case X:return"Fragment";case de:return"Profiler";case M:return"StrictMode";case U:return"Suspense";case re:return"SuspenseList";case Ee:return"Activity";case P:return"ViewTransition"}if(typeof s=="object")switch(s.$$typeof){case I:return"Portal";case q:return s.displayName||"Context";case W:return(s._context.displayName||"Context")+".Consumer";case H:var r=s.render;return s=s.displayName,s||(s=r.displayName||r.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case ve:return r=s.displayName||null,r!==null?r:Le(s.type)||"Memo";case A:r=s._payload,s=s._init;try{return Le(s(r))}catch{}}return null}var De=Array.isArray,Ce=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},Wt=[],Ft=-1;function Nt(s){return{current:s}}function wt(s){0>Ft||(s.current=Wt[Ft],Wt[Ft]=null,Ft--)}function Qe(s,r){Ft++,Wt[Ft]=s.current,s.current=r}var St=Nt(null),nn=Nt(null),se=Nt(null),je=Nt(null);function Xe(s,r){switch(Qe(se,r),Qe(nn,s),Qe(St,null),r.nodeType){case 9:case 11:s=(s=r.documentElement)&&(s=s.namespaceURI)?gy(s):0;break;default:if(s=r.tagName,r=r.namespaceURI)r=gy(r),s=xy(r,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}wt(St),Qe(St,s)}function et(){wt(St),wt(nn),wt(se)}function un(s){var r=s.memoizedState;r!==null&&(Yl._currentValue=r.memoizedState,Qe(je,s)),r=St.current;var o=xy(r,s.type);r!==o&&(Qe(nn,s),Qe(St,o))}function ce(s){nn.current===s&&(wt(St),wt(nn)),je.current===s&&(wt(je),Yl._currentValue=It)}var be,G;function me(s){if(be===void 0)try{throw Error()}catch(o){var r=o.stack.trim().match(/\n( *(at )?)/);be=r&&r[1]||"",G=-1<o.stack.indexOf(`
|
|
43
|
+
at`)?" (<anonymous>)":-1<o.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
44
|
+
`+be+s+G}var Pe=!1;function Ke(s,r){if(!s||Pe)return"";Pe=!0;var o=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(Te){var Z=Te}Reflect.construct(s,[],pe)}else{try{pe.call()}catch(Te){Z=Te}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(Te){Z=Te}(pe=s())&&typeof pe.catch=="function"&&pe.catch(function(){})}}catch(Te){if(Te&&Z&&typeof Te.stack=="string")return[Te.stack,Z.stack]}return[null,null]}};d.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var p=Object.getOwnPropertyDescriptor(d.DetermineComponentFrameRoot,"name");p&&p.configurable&&Object.defineProperty(d.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var g=d.DetermineComponentFrameRoot(),w=g[0],T=g[1];if(w&&T){var $=w.split(`
|
|
45
|
+
`),ee=T.split(`
|
|
46
|
+
`);for(p=d=0;d<$.length&&!$[d].includes("DetermineComponentFrameRoot");)d++;for(;p<ee.length&&!ee[p].includes("DetermineComponentFrameRoot");)p++;if(d===$.length||p===ee.length)for(d=$.length-1,p=ee.length-1;1<=d&&0<=p&&$[d]!==ee[p];)p--;for(;1<=d&&0<=p;d--,p--)if($[d]!==ee[p]){if(d!==1||p!==1)do if(d--,p--,0>p||$[d]!==ee[p]){var ae=`
|
|
47
|
+
`+$[d].replace(" at new "," at ");return s.displayName&&ae.includes("<anonymous>")&&(ae=ae.replace("<anonymous>",s.displayName)),ae}while(1<=d&&0<=p);break}}}finally{Pe=!1,Error.prepareStackTrace=o}return(o=s?s.displayName||s.name:"")?me(o):""}function at(s,r){switch(s.tag){case 26:case 27:case 5:return me(s.type);case 16:return me("Lazy");case 13:return s.child!==r&&r!==null?me("Suspense Fallback"):me("Suspense");case 19:return me("SuspenseList");case 0:case 15:return Ke(s.type,!1);case 11:return Ke(s.type.render,!1);case 1:return Ke(s.type,!0);case 31:return me("Activity");case 30:return me("ViewTransition");default:return""}}function ht(s){try{var r="",o=null;do r+=at(s,o),o=s,s=s.return;while(s);return r}catch(d){return`
|
|
48
|
+
Error generating stack: `+d.message+`
|
|
49
|
+
`+d.stack}}var fn=Object.prototype.hasOwnProperty,is=e.unstable_scheduleCallback,Ct=e.unstable_cancelCallback,vs=e.unstable_shouldYield,In=e.unstable_requestPaint,sn=e.unstable_now,xr=e.unstable_getCurrentPriorityLevel,Bi=e.unstable_ImmediatePriority,le=e.unstable_UserBlockingPriority,xe=e.unstable_NormalPriority,we=e.unstable_LowPriority,rt=e.unstable_IdlePriority,Ut=e.log,wn=e.unstable_setDisableYieldValue,Nn=null,xt=null;function rn(s){if(typeof Ut=="function"&&wn(s),xt&&typeof xt.setStrictMode=="function")try{xt.setStrictMode(Nn,s)}catch{}}var en=Math.clz32?Math.clz32:bs,Ro=Math.log,$u=Math.LN2;function bs(s){return s>>>=0,s===0?32:31-(Ro(s)/$u|0)|0}var vr=256,ma=262144,ga=4194304;function Qs(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 Ws(s,r,o){var d=s.pendingLanes;if(d===0)return 0;var p=0,g=s.suspendedLanes,w=s.pingedLanes;s=s.warmLanes;var T=d&134217727;return T!==0?(d=T&~g,d!==0?p=Qs(d):(w&=T,w!==0?p=Qs(w):o||(o=T&~s,o!==0&&(p=Qs(o))))):(T=d&~g,T!==0?p=Qs(T):w!==0?p=Qs(w):o||(o=d&~s,o!==0&&(p=Qs(o)))),p===0?0:r!==0&&r!==p&&(r&g)===0&&(g=p&-p,o=r&-r,g>=o||g===32&&(o&4194048)!==0)?r:p}function br(s,r){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&r)===0}function Pi(s,r){(r&8)!==0&&(r|=r&32);var o=s.entangledLanes;if(o!==0)for(s=s.entanglements,o&=r;0<o;){var d=31-en(o),p=1<<d;r|=s[d],o&=~p}return r}function Af(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 Bu(){var s=ga;return ga<<=1,(ga&62914560)===0&&(ga=4194304),s}function Ii(s){for(var r=[],o=0;31>o;o++)r.push(s);return r}function fi(s,r){s.pendingLanes|=r,r!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function ol(s,r,o,d,p,g){var w=s.pendingLanes;s.pendingLanes=o,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=o,s.entangledLanes&=o,s.errorRecoveryDisabledLanes&=o,s.shellSuspendCounter=0;var T=s.entanglements,$=s.expirationTimes,ee=s.hiddenUpdates;for(o=w&~o;0<o;){var ae=31-en(o),pe=1<<ae;T[ae]=0,$[ae]=-1;var Z=ee[ae];if(Z!==null)for(ee[ae]=null,ae=0;ae<Z.length;ae++){var ie=Z[ae];ie!==null&&(ie.lane&=-536870913)}o&=~pe}d!==0&&xa(s,d,0),g!==0&&p===0&&s.tag!==0&&(s.suspendedLanes|=g&~(w&~r))}function xa(s,r,o){s.pendingLanes|=r,s.suspendedLanes&=~r;var d=31-en(r);s.entangledLanes|=r,s.entanglements[d]=s.entanglements[d]|1073741824|o&261930}function Oo(s,r){var o=s.entangledLanes|=r;for(s=s.entanglements;o;){var d=31-en(o),p=1<<d;p&r|s[d]&r&&(s[d]|=r),o&=~p}}function pi(s,r){var o=r&-r;return o=(o&42)!==0?1:Lo(o),(o&(s.suspendedLanes|r))!==0?0:o}function Lo(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 va(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function ba(){var s=Re.p;return s!==0?s:(s=window.event,s===void 0?32:e_(s.type))}function rs(s,r){var o=Re.p;try{return Re.p=s,r()}finally{Re.p=o}}var ys=Math.random().toString(36).slice(2),dn="__reactFiber$"+ys,Cn="__reactProps$"+ys,mi="__reactContainer$"+ys,Do="__reactEvents$"+ys,an="__reactListeners$"+ys,Mf="__reactHandles$"+ys,zo="__reactResources$"+ys,ya="__reactMarker$"+ys,cl="__reactLoad$"+ys;function ul(s){delete s[dn],delete s[Cn],delete s[an],delete s[Mf]}function Fi(s){var r;if(r=s[dn])return r;for(var o=s.parentNode;o;){if(r=o[mi]||o[dn]){if(o=r.alternate,r.child!==null||o!==null&&o.child!==null)for(s=Ly(s);s!==null;){if(o=s[dn])return o;s=Ly(s)}return r}s=o,o=s.parentNode}return null}function gi(s){if(s=s[dn]||s[mi]){var r=s.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return s}return null}function yr(s){var r=s.tag;if(r===5||r===26||r===27||r===6)return s.stateNode;throw Error(i(33))}function as(s){var r=s[zo];return r||(r=s[zo]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function ln(s){s[ya]=!0}function _s(s){s[cl]=void 0}var Ks=new Set,dl={};function Ui(s,r){Hi(s,r),Hi(s+"Capture",r)}function Hi(s,r){for(dl[s]=r,s=0;s<r.length;s++)Ks.add(r[s])}var Rf=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]*$"),hl={},$o={};function Of(s){return fn.call($o,s)?!0:fn.call(hl,s)?!1:Rf.test(s)?$o[s]=!0:(hl[s]=!0,!1)}var vt=!1;function Pu(){var s=vt;return vt=!1,s}function fl(s,r,o){if(Of(r))if(o===null)s.removeAttribute(r);else{switch(typeof o){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,o)}}function _a(s,r,o){if(o===null)s.removeAttribute(r);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(r);return}s.setAttribute(r,o)}}function Ds(s,r,o,d){if(d===null)s.removeAttribute(o);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(o);return}s.setAttributeNS(r,o,d)}}function Yn(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function Iu(s){var r=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function Fu(s,r,o){var d=Object.getOwnPropertyDescriptor(s.constructor.prototype,r);if(!s.hasOwnProperty(r)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var p=d.get,g=d.set;return Object.defineProperty(s,r,{configurable:!0,get:function(){return p.call(this)},set:function(w){o=""+w,g.call(this,w)}}),Object.defineProperty(s,r,{enumerable:d.enumerable}),{getValue:function(){return o},setValue:function(w){o=""+w},stopTracking:function(){s._valueTracker=null,delete s[r]}}}}function _r(s){if(!s._valueTracker){var r=Iu(s)?"checked":"value";s._valueTracker=Fu(s,r,""+s[r])}}function Bo(s){if(!s)return!1;var r=s._valueTracker;if(!r)return!0;var o=r.getValue(),d="";return s&&(d=Iu(s)?s.checked?"true":"false":s.value),s=d,s!==o?(r.setValue(s),!0):!1}var Lf=/[\n"\\]/g;function ls(s){return s.replace(Lf,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function Po(s,r,o,d,p,g,w,T){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=""+Yn(r)):s.value!==""+Yn(r)&&(s.value=""+Yn(r)):w!=="submit"&&w!=="reset"||s.removeAttribute("value"),r!=null?w==="number"&&s.value==r?Io(s,Yn(s.value)):Io(s,Yn(r)):o!=null?Io(s,Yn(o)):d!=null&&s.removeAttribute("value"),p==null&&g!=null&&(s.defaultChecked=!!g),p!=null&&(s.checked=p&&typeof p!="function"&&typeof p!="symbol"),T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"?s.name=""+Yn(T):s.removeAttribute("name")}function Uu(s,r,o,d,p,g,w,T){if(g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"&&(s.type=g),r!=null||o!=null){if(!(g!=="submit"&&g!=="reset"||r!=null)){_r(s);return}o=o!=null?""+Yn(o):"",r=r!=null?""+Yn(r):o,T||r===s.value||(s.value=r),s.defaultValue=r}d=d??p,d=typeof d!="function"&&typeof d!="symbol"&&!!d,s.checked=T?s.checked:!!d,s.defaultChecked=!!d,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(s.name=w),_r(s)}function Io(s,r){s.defaultValue!==""+r&&(s.defaultValue=""+r)}function wr(s,r,o,d){if(s=s.options,r){r={};for(var p=0;p<o.length;p++)r["$"+o[p]]=!0;for(o=0;o<s.length;o++)p=r.hasOwnProperty("$"+s[o].value),s[o].selected!==p&&(s[o].selected=p),p&&d&&(s[o].defaultSelected=!0)}else{for(o=""+Yn(o),r=null,p=0;p<s.length;p++){if(s[p].value===o){s[p].selected=!0,d&&(s[p].defaultSelected=!0);return}r!==null||s[p].disabled||(r=s[p])}r!==null&&(r.selected=!0)}}function Fo(s,r,o){if(r!=null&&(r=""+Yn(r),r!==s.value&&(s.value=r),o==null)){s.defaultValue!==r&&(s.defaultValue=r);return}s.defaultValue=o!=null?""+Yn(o):""}function Uo(s,r,o,d){if(r==null){if(d!=null){if(o!=null)throw Error(i(92));if(De(d)){if(1<d.length)throw Error(i(93));d=d[0]}o=d}o==null&&(o=""),r=o}o=Yn(r),s.defaultValue=o,d=s.textContent,d===o&&d!==""&&d!==null&&(s.value=d),_r(s)}function qi(s,r){if(r){var o=s.firstChild;if(o&&o===s.lastChild&&o.nodeType===3){o.nodeValue=r;return}}s.textContent=r}var Y=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 ge(s,r,o){var d=r.indexOf("--")===0;o==null||typeof o=="boolean"||o===""?d?s.setProperty(r,""):r==="float"?s.cssFloat="":s[r]="":d?s.setProperty(r,o):typeof o!="number"||o===0||Y.has(r)?r==="float"?s.cssFloat=o:s[r]=(""+o).trim():s[r]=o+"px"}function it(s,r,o){if(r!=null&&typeof r!="object")throw Error(i(62));if(s=s.style,o!=null){for(var d in o)!o.hasOwnProperty(d)||r!=null&&r.hasOwnProperty(d)||(d.indexOf("--")===0?s.setProperty(d,""):d==="float"?s.cssFloat="":s[d]="",vt=!0);for(var p in r)d=r[p],r.hasOwnProperty(p)&&o[p]!==d&&(ge(s,p,d),vt=!0)}else for(var g in r)r.hasOwnProperty(g)&&ge(s,g,r[g])}function mt(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 gt=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"]]),Ge=/^[\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 Rn(s){return Ge.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function Xn(){}var Sr=null;function pl(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var ws=null,Zs=null;function Ho(s){var r=gi(s);if(r&&(s=r.stateNode)){var o=s[Cn]||null;e:switch(s=r.stateNode,r.type){case"input":if(Po(s,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name),r=o.name,o.type==="radio"&&r!=null){for(o=s;o.parentNode;)o=o.parentNode;for(o=o.querySelectorAll('input[name="'+ls(""+r)+'"][type="radio"]'),r=0;r<o.length;r++){var d=o[r];if(d!==s&&d.form===s.form){var p=d[Cn]||null;if(!p)throw Error(i(90));Po(d,p.value,p.defaultValue,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name)}}for(r=0;r<o.length;r++)d=o[r],d.form===s.form&&Bo(d)}break e;case"textarea":Fo(s,o.value,o.defaultValue);break e;case"select":r=o.value,r!=null&&wr(s,!!o.multiple,r,!1)}}}var kr=!1;function Ss(s,r,o){if(kr)return s(r,o);kr=!0;try{var d=s(r);return d}finally{if(kr=!1,(ws!==null||Zs!==null)&&(Fd(),ws&&(r=ws,s=Zs,Zs=ws=null,Ho(r),s)))for(r=0;r<s.length;r++)Ho(s[r])}}function jr(s,r){var o=s.stateNode;if(o===null)return null;var d=o[Cn]||null;if(d===null)return null;o=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(o&&typeof o!="function")throw Error(i(231,r,typeof o));return o}var Js=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),qo=!1;if(Js)try{var wa={};Object.defineProperty(wa,"passive",{get:function(){qo=!0}}),window.addEventListener("test",wa,wa),window.removeEventListener("test",wa,wa)}catch{qo=!1}var ei=null,Hu=null,Sa=null;function Vo(){if(Sa)return Sa;var s,r=Hu,o=r.length,d,p="value"in ei?ei.value:ei.textContent,g=p.length;for(s=0;s<o&&r[s]===p[s];s++);var w=o-s;for(d=1;d<=w&&r[o-d]===p[g-d];d++);return Sa=p.slice(s,1<d?1-d:void 0)}function ks(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 fv(){return!1}function Qn(s){function r(o,d,p,g,w){this._reactName=o,this._targetInst=p,this.type=d,this.nativeEvent=g,this.target=w,this.currentTarget=null;for(var T in s)s.hasOwnProperty(T)&&(o=s[T],this[T]=o?o(g):g[T]);return this.isDefaultPrevented=(g.defaultPrevented!=null?g.defaultPrevented:g.returnValue===!1)?qu:fv,this.isPropagationStopped=fv,this}return F(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var o=this.nativeEvent;o&&(o.preventDefault?o.preventDefault():typeof o.returnValue!="unknown"&&(o.returnValue=!1),this.isDefaultPrevented=qu)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=qu)},persist:function(){},isPersistent:qu}),r}var Nr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Vu=Qn(Nr),Go=F({},Nr,{view:0,detail:0}),KN=Qn(Go),Df,zf,Yo,Gu=F({},Go,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Bf,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!==Yo&&(Yo&&s.type==="mousemove"?(Df=s.screenX-Yo.screenX,zf=s.screenY-Yo.screenY):zf=Df=0,Yo=s),Df)},movementY:function(s){return"movementY"in s?s.movementY:zf}}),pv=Qn(Gu),ZN=F({},Gu,{dataTransfer:0}),JN=Qn(ZN),eC=F({},Go,{relatedTarget:0}),$f=Qn(eC),tC=F({},Nr,{animationName:0,elapsedTime:0,pseudoElement:0}),nC=Qn(tC),sC=F({},Nr,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),iC=Qn(sC),rC=F({},Nr,{data:0}),mv=Qn(rC),aC={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},lC={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"},oC={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function cC(s){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(s):(s=oC[s])?!!r[s]:!1}function Bf(){return cC}var uC=F({},Go,{key:function(s){if(s.key){var r=aC[s.key]||s.key;if(r!=="Unidentified")return r}return s.type==="keypress"?(s=ks(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?lC[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Bf,charCode:function(s){return s.type==="keypress"?ks(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?ks(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),dC=Qn(uC),hC=F({},Gu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),gv=Qn(hC),fC=F({},Nr,{submitter:0}),pC=Qn(fC),mC=F({},Go,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Bf}),gC=Qn(mC),xC=F({},Nr,{propertyName:0,elapsedTime:0,pseudoElement:0}),vC=Qn(xC),bC=F({},Gu,{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}),yC=Qn(bC),_C=F({},Nr,{newState:0,oldState:0,source:0}),wC=Qn(_C),SC=[9,13,27,32],Pf=Js&&"CompositionEvent"in window,Xo=null;Js&&"documentMode"in document&&(Xo=document.documentMode);var kC=Js&&"TextEvent"in window&&!Xo,xv=Js&&(!Pf||Xo&&8<Xo&&11>=Xo),vv=" ",bv=!1;function yv(s,r){switch(s){case"keyup":return SC.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function _v(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var ml=!1;function jC(s,r){switch(s){case"compositionend":return _v(r);case"keypress":return r.which!==32?null:(bv=!0,vv);case"textInput":return s=r.data,s===vv&&bv?null:s;default:return null}}function NC(s,r){if(ml)return s==="compositionend"||!Pf&&yv(s,r)?(s=Vo(),Sa=Hu=ei=null,ml=!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 xv&&r.locale!=="ko"?null:r.data;default:return null}}var CC={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 wv(s){var r=s&&s.nodeName&&s.nodeName.toLowerCase();return r==="input"?!!CC[s.type]:r==="textarea"}function Sv(s,r,o,d){ws?Zs?Zs.push(d):Zs=[d]:ws=d,r=Yd(r,"onChange"),0<r.length&&(o=new Vu("onChange","change",null,o,d),s.push({event:o,listeners:r}))}var Qo=null,Wo=null;function EC(s){uy(s,0)}function Yu(s){var r=yr(s);if(Bo(r))return s}function kv(s,r){if(s==="change")return r}var jv=!1;if(Js){var If;if(Js){var Ff="oninput"in document;if(!Ff){var Nv=document.createElement("div");Nv.setAttribute("oninput","return;"),Ff=typeof Nv.oninput=="function"}If=Ff}else If=!1;jv=If&&(!document.documentMode||9<document.documentMode)}function Cv(){Qo&&(Qo.detachEvent("onpropertychange",Ev),Wo=Qo=null)}function Ev(s){if(s.propertyName==="value"&&Yu(Wo)){var r=[];Sv(r,Wo,s,pl(s)),Ss(EC,r)}}function TC(s,r,o){s==="focusin"?(Cv(),Qo=r,Wo=o,Qo.attachEvent("onpropertychange",Ev)):s==="focusout"&&Cv()}function AC(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return Yu(Wo)}function MC(s,r){if(s==="click")return Yu(r)}function RC(s,r){if(s==="input"||s==="change")return Yu(r)}function OC(s,r){return s===r&&(s!==0||1/s===1/r)||s!==s&&r!==r}var js=typeof Object.is=="function"?Object.is:OC;function Ko(s,r){if(js(s,r))return!0;if(typeof s!="object"||s===null||typeof r!="object"||r===null)return!1;var o=Object.keys(s),d=Object.keys(r);if(o.length!==d.length)return!1;for(d=0;d<o.length;d++){var p=o[d];if(!fn.call(r,p)||!js(s[p],r[p]))return!1}return!0}function Uf(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 Tv(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function Av(s,r){var o=Tv(s);s=0;for(var d;o;){if(o.nodeType===3){if(d=s+o.textContent.length,s<=r&&d>=r)return{node:o,offset:r-s};s=d}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=Tv(o)}}function Mv(s,r){return s&&r?s===r?!0:s&&s.nodeType===3?!1:r&&r.nodeType===3?Mv(s,r.parentNode):"contains"in s?s.contains(r):s.compareDocumentPosition?!!(s.compareDocumentPosition(r)&16):!1:!1}function Rv(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var r=Uf(s.document);r instanceof s.HTMLIFrameElement;){try{var o=typeof r.contentWindow.location.href=="string"}catch{o=!1}if(o)s=r.contentWindow;else break;r=Uf(s.document)}return r}function Hf(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 LC=Js&&"documentMode"in document&&11>=document.documentMode,gl=null,qf=null,Zo=null,Vf=!1;function Ov(s,r,o){var d=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;Vf||gl==null||gl!==Uf(d)||(d=gl,"selectionStart"in d&&Hf(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}),Zo&&Ko(Zo,d)||(Zo=d,d=Yd(qf,"onSelect"),0<d.length&&(r=new Vu("onSelect","select",null,r,o),s.push({event:r,listeners:d}),r.target=gl)))}function ka(s,r){var o={};return o[s.toLowerCase()]=r.toLowerCase(),o["Webkit"+s]="webkit"+r,o["Moz"+s]="moz"+r,o}var xl={animationend:ka("Animation","AnimationEnd"),animationiteration:ka("Animation","AnimationIteration"),animationstart:ka("Animation","AnimationStart"),transitionrun:ka("Transition","TransitionRun"),transitionstart:ka("Transition","TransitionStart"),transitioncancel:ka("Transition","TransitionCancel"),transitionend:ka("Transition","TransitionEnd")},Gf={},Lv={};Js&&(Lv=document.createElement("div").style,"AnimationEvent"in window||(delete xl.animationend.animation,delete xl.animationiteration.animation,delete xl.animationstart.animation),"TransitionEvent"in window||delete xl.transitionend.transition);function ja(s){if(Gf[s])return Gf[s];if(!xl[s])return s;var r=xl[s],o;for(o in r)if(r.hasOwnProperty(o)&&o in Lv)return Gf[s]=r[o];return s}var Dv=ja("animationend"),zv=ja("animationiteration"),$v=ja("animationstart"),DC=ja("transitionrun"),zC=ja("transitionstart"),$C=ja("transitioncancel"),Bv=ja("transitionend"),Pv=new Map,Yf="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(" ");Yf.push("scrollEnd");function ti(s,r){Pv.set(s,r),Ui(r,[s])}var BC=0;function Vi(s,r){if(s.name!=null&&s.name!=="auto")return s.name;if(r.autoName!==null)return r.autoName;s=ri.identifierPrefix;var o=BC++;return s="_"+s+"t_"+o.toString(32)+"_",r.autoName=s}function Iv(s){if(s==null||typeof s=="string")return s;var r=null,o=$l;if(o!==null)for(var d=0;d<o.length;d++){var p=s[o[d]];if(p!=null){if(p==="none")return"none";r=r==null?p:r+(" "+p)}}return r??s.default}function Gi(s,r){return s=Iv(s),r=Iv(r),r==null?s==="auto"?null:s:r==="auto"?null:r}var Xu=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)},zs=[],vl=0,Xf=0;function Qu(){for(var s=vl,r=Xf=vl=0;r<s;){var o=zs[r];zs[r++]=null;var d=zs[r];zs[r++]=null;var p=zs[r];zs[r++]=null;var g=zs[r];if(zs[r++]=null,d!==null&&p!==null){var w=d.pending;w===null?p.next=p:(p.next=w.next,w.next=p),d.pending=p}g!==0&&Fv(o,p,g)}}function Wu(s,r,o,d){zs[vl++]=s,zs[vl++]=r,zs[vl++]=o,zs[vl++]=d,Xf|=d,s.lanes|=d,s=s.alternate,s!==null&&(s.lanes|=d)}function Qf(s,r,o,d){return Wu(s,r,o,d),Ku(s)}function Na(s,r){return Wu(s,null,null,r),Ku(s)}function Fv(s,r,o){s.lanes|=o;var d=s.alternate;d!==null&&(d.lanes|=o);for(var p=!1,g=s.return;g!==null;)g.childLanes|=o,d=g.alternate,d!==null&&(d.childLanes|=o),g.tag===22&&(s=g.stateNode,s===null||s._visibility&1||(p=!0)),s=g,g=g.return;return s.tag===3?(g=s.stateNode,p&&r!==null&&(p=31-en(o),s=g.hiddenUpdates,d=s[p],d===null?s[p]=[r]:d.push(r),r.lane=o|536870912),g):null}function Ku(s){if(50<yc)throw yc=0,Id=null,Error(i(185));for(var r=s.return;r!==null;)s=r,r=s.return;return s.tag===3?s.stateNode:null}var bl={};function PC(s,r,o,d){this.tag=s,this.key=o,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=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 os(s,r,o,d){return new PC(s,r,o,d)}function Wf(s){return s=s.prototype,!(!s||!s.isReactComponent)}function Yi(s,r){var o=s.alternate;return o===null?(o=os(s.tag,r,s.key,s.mode),o.elementType=s.elementType,o.type=s.type,o.stateNode=s.stateNode,o.alternate=s,s.alternate=o):(o.pendingProps=r,o.type=s.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=s.flags&1206910976,o.childLanes=s.childLanes,o.lanes=s.lanes,o.child=s.child,o.memoizedProps=s.memoizedProps,o.memoizedState=s.memoizedState,o.updateQueue=s.updateQueue,r=s.dependencies,o.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},o.sibling=s.sibling,o.index=s.index,o.ref=s.ref,o.refCleanup=s.refCleanup,o}function Uv(s,r){s.flags&=1206910978;var o=s.alternate;return o===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=o.childLanes,s.lanes=o.lanes,s.child=o.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=o.memoizedProps,s.memoizedState=o.memoizedState,s.updateQueue=o.updateQueue,s.type=o.type,r=o.dependencies,s.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),s}function Zu(s,r,o,d,p,g){var w=0;if(d=s,typeof d=="function")Wf(d)&&(w=1);else if(typeof d=="string")w=fE(s,o,St.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(d){case Ee:return s=os(31,o,r,p),s.elementType=Ee,s.lanes=g,s;case X:return Ca(o.children,p,g,r);case M:w=8,p|=24;break;case de:return s=os(12,o,r,p|2),s.elementType=de,s.lanes=g,s;case U:return s=os(13,o,r,p),s.elementType=U,s.lanes=g,s;case re:return s=os(19,o,r,p),s.elementType=re,s.lanes=g,s;case Me:case P:return s=p|32,s=os(30,o,r,s),s.elementType=P,s.lanes=g,s.stateNode={autoName:null,paired:null,clones:null,ref:null},s;default:if(typeof d=="object"&&d!==null)switch(d.$$typeof){case q:w=10;break e;case W:w=9;break e;case H:w=11;break e;case ve:w=14;break e;case A:w=16,d=null;break e}w=29,o=Error(i(130,s===null?"null":typeof s,"")),d=null}return r=os(w,o,r,p),r.elementType=s,r.type=d,r.lanes=g,r}function Ca(s,r,o,d){return s=os(7,s,d,r),s.lanes=o,s}function Kf(s,r,o){return s=os(6,s,null,r),s.lanes=o,s}function Hv(s){var r=os(18,null,null,0);return r.stateNode=s,r}function Zf(s,r,o){return r=os(4,s.children!==null?s.children:[],s.key,r),r.lanes=o,r.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},r}var qv=new WeakMap;function $s(s,r){if(typeof s=="object"&&s!==null){var o=qv.get(s);return o!==void 0?o:(r={value:s,source:r,stack:ht(r)},qv.set(s,r),r)}return{value:s,source:r,stack:ht(r)}}var yl=[],_l=0,Ju=null,Jo=0,Bs=[],Ps=0,Cr=null,xi=1,vi="";function Xi(s,r){yl[_l++]=Jo,yl[_l++]=Ju,Ju=s,Jo=r}function Vv(s,r,o){Bs[Ps++]=xi,Bs[Ps++]=vi,Bs[Ps++]=Cr,Cr=s;var d=xi;s=vi;var p=32-en(d)-1;d&=~(1<<p),o+=1;var g=32-en(r)+p;if(30<g){var w=p-p%5;g=(d&(1<<w)-1).toString(32),d>>=w,p-=w,xi=1<<32-en(r)+p|o<<p|d,vi=g+s}else xi=1<<g|o<<p|d,vi=s}function ed(s){s.return!==null&&(Xi(s,1),Vv(s,1,0))}function Jf(s){for(;s===Ju;)Ju=yl[--_l],yl[_l]=null,Jo=yl[--_l],yl[_l]=null;for(;s===Cr;)Cr=Bs[--Ps],Bs[Ps]=null,vi=Bs[--Ps],Bs[Ps]=null,xi=Bs[--Ps],Bs[Ps]=null}function Gv(s,r){Bs[Ps++]=xi,Bs[Ps++]=vi,Bs[Ps++]=Cr,xi=r.id,vi=r.overflow,Cr=s}var En=null,Ht=null,lt=!1,Er=null,Is=!1,ep=Error(i(519));function Tr(s){var r=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ec($s(r,s)),ep}function Yv(s){var r=s.stateNode,o=s.type,d=s.memoizedProps;switch(r[dn]=s,r[Cn]=d,o){case"dialog":ut("cancel",r),ut("close",r);break;case"iframe":case"object":case"embed":ut("load",r);break;case"video":case"audio":for(o=0;o<wc.length;o++)ut(wc[o],r);break;case"source":ut("error",r);break;case"img":case"image":case"link":ut("error",r),ut("load",r);break;case"details":ut("toggle",r);break;case"input":ut("invalid",r),Uu(r,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":ut("invalid",r);break;case"textarea":ut("invalid",r),Uo(r,d.value,d.defaultValue,d.children)}o=d.children,typeof o!="string"&&typeof o!="number"&&typeof o!="bigint"||r.textContent===""+o||d.suppressHydrationWarning===!0||py(r.textContent,o)?(d.popover!=null&&(ut("beforetoggle",r),ut("toggle",r)),d.onScroll!=null&&ut("scroll",r),d.onScrollEnd!=null&&ut("scrollend",r),d.onClick!=null&&(r.onclick=Xn),r=!0):r=!1,r||Tr(s,!0)}function td(s){for(En=s.return;En;)switch(En.tag){case 5:case 31:case 13:Is=!1;return;case 27:case 3:Is=!0;return;default:En=En.return}}function wl(s){if(s!==En)return!1;if(!lt)return td(s),lt=!0,!1;var r=s.tag,o;if((o=r!==3&&r!==27)&&((o=r===5)&&(o=s.type,o=!(o!=="form"&&o!=="button")||Am(s.type,s.memoizedProps)),o=!o),o&&Ht&&Tr(s),td(s),r===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(317));Ht=Oy(s)}else if(r===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(317));Ht=Oy(s)}else r===27?(r=Ht,Vr(s.type)?(s=Pm,Pm=null,Ht=s):Ht=r):Ht=En?Us(s.stateNode.nextSibling):null;return!0}function Ea(){Ht=En=null,lt=!1}function tp(){var s=Er;return s!==null&&(ds===null?ds=s:ds.push.apply(ds,s),Er=null),s}function ec(s){Er===null?Er=[s]:Er.push(s)}var np=Nt(null),Ta=null,Qi=null;function Ar(s,r,o){Qe(np,r._currentValue),r._currentValue=o}function Wi(s){s._currentValue=np.current,wt(np)}function nd(s,r,o){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===o)break;s=s.return}}function sp(s,r,o,d){var p=s.child;for(p!==null&&(p.return=s);p!==null;){var g=p.dependencies;if(g!==null){var w=p.child;g=g.firstContext;e:for(;g!==null;){var T=g;g=p;for(var $=0;$<r.length;$++)if(T.context===r[$]){g.lanes|=o,T=g.alternate,T!==null&&(T.lanes|=o),nd(g.return,o,s),d||(w=null);break e}g=T.next}}else if(p.tag===18){if(w=p.return,w===null)throw Error(i(341));w.lanes|=o,g=w.alternate,g!==null&&(g.lanes|=o),nd(w,o,s),w=null}else p.tag===13&&p.memoizedState!==null&&p.memoizedState.dehydrated===null?(p.lanes|=o,w=p.alternate,w!==null&&(w.lanes|=o),nd(p.return,o,s),w=p.child,w=w!==null?w.sibling:null):w=p.child;if(w!==null)w.return=p;else for(w=p;w!==null;){if(w===s){w=null;break}if(p=w.sibling,p!==null){p.return=w.return,w=p;break}w=w.return}p=w}}function Aa(s,r,o,d){s=null;for(var p=r,g=!1;p!==null;){if(!g){if((p.flags&524288)!==0)g=!0;else if((p.flags&262144)!==0)break}if(p.tag===10){var w=p.alternate;if(w===null)throw Error(i(387));if(w=w.memoizedProps,w!==null){var T=p.type;js(p.pendingProps.value,w.value)||(s!==null?s.push(T):s=[T])}}else if(p===je.current){if(w=p.alternate,w===null)throw Error(i(387));w.memoizedState.memoizedState!==p.memoizedState.memoizedState&&(s!==null?s.push(Yl):s=[Yl])}p=p.return}return s!==null&&sp(r,s,o,d),r.flags|=262144,s!==null}function sd(s){for(s=s.firstContext;s!==null;){if(!js(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function Ma(s){Ta=s,Qi=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function On(s){return Xv(Ta,s)}function id(s,r){return Ta===null&&Ma(s),Xv(s,r)}function Xv(s,r){var o=r._currentValue;if(r={context:r,memoizedValue:o,next:null},Qi===null){if(s===null)throw Error(i(308));Qi=r,s.dependencies={lanes:0,firstContext:r},s.flags|=524288}else Qi=Qi.next=r;return o}var IC=typeof AbortController<"u"?AbortController:function(){var s=[],r=this.signal={aborted:!1,addEventListener:function(o,d){s.push(d)}};this.abort=function(){r.aborted=!0,s.forEach(function(o){return o()})}},FC=e.unstable_scheduleCallback,UC=e.unstable_NormalPriority,pn={$$typeof:q,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ip(){return{controller:new IC,data:new Map,refCount:0}}function tc(s){s.refCount--,s.refCount===0&&FC(UC,function(){s.controller.abort()})}function Qv(s,r){if((s.pendingLanes&4194048)!==0){var o=s.transitionTypes;for(o===null&&(o=s.transitionTypes=[]),s=0;s<r.length;s++){var d=r[s];o.indexOf(d)===-1&&o.push(d)}}}var nc=null;function HC(s){var r=s.transitionTypes;return s.transitionTypes=null,r}var sc=null,rp=0,Ra=0,Sl=null;function qC(s,r){if(sc===null){var o=sc=[];rp=0,Ra=_m(),Sl={status:"pending",value:void 0,then:function(d){o.push(d)}}}return rp++,r.then(Wv,Wv),r}function Wv(){if(--rp===0&&(nc=null,sc!==null)){Sl!==null&&(Sl.status="fulfilled");var s=sc;sc=null,Ra=0,Sl=null;for(var r=0;r<s.length;r++)(0,s[r])()}}function VC(s,r){var o=[],d={status:"pending",value:null,reason:null,then:function(p){o.push(p)}};return s.then(function(){d.status="fulfilled",d.value=r;for(var p=0;p<o.length;p++)(0,o[p])(r)},function(p){for(d.status="rejected",d.reason=p,p=0;p<o.length;p++)(0,o[p])(void 0)}),d}var Kv=Ce.S;Ce.S=function(s,r){if(Hb=sn(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&qC(s,r),nc!==null)for(var o=Fl;o!==null;)Qv(o,nc),o=o.next;if(o=s.types,o!==null){for(var d=Fl;d!==null;)Qv(d,o),d=d.next;if(Ra!==0){d=nc,d===null&&(d=nc=[]);for(var p=0;p<o.length;p++){var g=o[p];d.indexOf(g)===-1&&d.push(g)}}}Kv!==null&&Kv(s,r)};var Oa=Nt(null);function ap(){var s=Oa.current;return s!==null?s:zt.pooledCache}function rd(s,r){r===null?Qe(Oa,Oa.current):Qe(Oa,r.pool)}function Zv(){var s=ap();return s===null?null:{parent:pn._currentValue,pool:s}}var kl=Error(i(460)),lp=Error(i(474)),ad=Error(i(542)),ld={then:function(){}};function Jv(s){return s=s.status,s==="fulfilled"||s==="rejected"}function e1(s,r,o){switch(o=s[o],o===void 0?s.push(r):o!==r&&(r.then(Xn,Xn),r=o),r.status){case"fulfilled":return r.value;case"rejected":throw s=r.reason,n1(s),s===void 0&&!("reason"in r)?Error(i(600)):s;default:if(typeof r.status=="string")r.then(Xn,Xn);else{if(s=zt,s!==null&&100<s.shellSuspendCounter)throw Error(i(482));s=r,s.status="pending",s.then(function(d){if(r.status==="pending"){var p=r;p.status="fulfilled",p.value=d}},function(d){if(r.status==="pending"){var p=r;p.status="rejected",p.reason=d}})}switch(r.status){case"fulfilled":return r.value;case"rejected":throw s=r.reason,n1(s),s}throw Da=r,kl}}function La(s){try{var r=s._init;return r(s._payload)}catch(o){throw o!==null&&typeof o=="object"&&typeof o.then=="function"?(Da=o,kl):o}}var Da=null;function t1(){if(Da===null)throw Error(i(459));var s=Da;return Da=null,s}function n1(s){if(s===kl||s===ad)throw Error(i(483))}var jl=null,ic=0;function od(s){var r=ic;return ic+=1,jl===null&&(jl=[]),e1(jl,s,r)}function Mr(s,r){r=r.props.ref,s.ref=r!==void 0?r:null}function cd(s,r){throw r.$$typeof===D?Error(i(525)):(s=Object.prototype.toString.call(r),Error(i(31,s==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":s)))}function s1(s){function r(J,V){if(s){var ne=J.deletions;ne===null?(J.deletions=[V],J.flags|=16):ne.push(V)}}function o(J,V){if(!s)return null;for(;V!==null;)r(J,V),V=V.sibling;return null}function d(J){for(var V=new Map;J!==null;)J.key===null?V.set(J.index,J):V.set(J.key,J),J=J.sibling;return V}function p(J,V){return J=Yi(J,V),J.index=0,J.sibling=null,J}function g(J,V,ne){return J.index=ne,s?(ne=J.alternate,ne!==null?(ne=ne.index,ne<V?(J.flags|=2,V):ne):(J.flags|=134217730,V)):(J.flags|=1048576,V)}function w(J){return s&&J.alternate===null&&(J.flags|=134217730),J}function T(J,V,ne,fe){return V===null||V.tag!==6?(V=Kf(ne,J.mode,fe),V.return=J,V):(V=p(V,ne),V.return=J,V)}function $(J,V,ne,fe){var Oe=ne.type;return Oe===X?(J=ae(J,V,ne.props.children,fe,ne.key),Mr(J,ne),J):V!==null&&(V.elementType===Oe||typeof Oe=="object"&&Oe!==null&&Oe.$$typeof===A&&La(Oe)===V.type)?(V=p(V,ne.props),Mr(V,ne),V.return=J,V):(V=Zu(ne.type,ne.key,ne.props,null,J.mode,fe),Mr(V,ne),V.return=J,V)}function ee(J,V,ne,fe){return V===null||V.tag!==4||V.stateNode.containerInfo!==ne.containerInfo||V.stateNode.implementation!==ne.implementation?(V=Zf(ne,J.mode,fe),V.return=J,V):(V=p(V,ne.children||[]),V.return=J,V)}function ae(J,V,ne,fe,Oe){return V===null||V.tag!==7?(V=Ca(ne,J.mode,fe,Oe),V.return=J,V):(V=p(V,ne),V.return=J,V)}function pe(J,V,ne){if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return V=Kf(""+V,J.mode,ne),V.return=J,V;if(typeof V=="object"&&V!==null){switch(V.$$typeof){case Q:return ne=Zu(V.type,V.key,V.props,null,J.mode,ne),Mr(ne,V),ne.return=J,ne;case I:return V=Zf(V,J.mode,ne),V.return=J,V;case A:return V=La(V),pe(J,V,ne)}if(De(V)||Ne(V))return V=Ca(V,J.mode,ne,null),V.return=J,V;if(typeof V.then=="function")return pe(J,od(V),ne);if(V.$$typeof===q)return pe(J,id(J,V),ne);cd(J,V)}return null}function Z(J,V,ne,fe){var Oe=V!==null?V.key:null;if(typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint")return Oe!==null?null:T(J,V,""+ne,fe);if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case Q:return ne.key===Oe?$(J,V,ne,fe):null;case I:return ne.key===Oe?ee(J,V,ne,fe):null;case A:return ne=La(ne),Z(J,V,ne,fe)}if(De(ne)||Ne(ne))return Oe!==null?null:ae(J,V,ne,fe,null);if(typeof ne.then=="function")return Z(J,V,od(ne),fe);if(ne.$$typeof===q)return Z(J,V,id(J,ne),fe);cd(J,ne)}return null}function ie(J,V,ne,fe,Oe){if(typeof fe=="string"&&fe!==""||typeof fe=="number"||typeof fe=="bigint")return J=J.get(ne)||null,T(V,J,""+fe,Oe);if(typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case Q:return J=J.get(fe.key===null?ne:fe.key)||null,$(V,J,fe,Oe);case I:return J=J.get(fe.key===null?ne:fe.key)||null,ee(V,J,fe,Oe);case A:return fe=La(fe),ie(J,V,ne,fe,Oe)}if(De(fe)||Ne(fe))return J=J.get(ne)||null,ae(V,J,fe,Oe,null);if(typeof fe.then=="function")return ie(J,V,ne,od(fe),Oe);if(fe.$$typeof===q)return ie(J,V,ne,id(V,fe),Oe);cd(V,fe)}return null}function Te(J,V,ne,fe){for(var Oe=null,pt=null,Fe=V,Ye=V=0,xn=null;Fe!==null&&Ye<ne.length;Ye++){Fe.index>Ye?(xn=Fe,Fe=null):xn=Fe.sibling;var bt=Z(J,Fe,ne[Ye],fe);if(bt===null){Fe===null&&(Fe=xn);break}s&&Fe&&bt.alternate===null&&r(J,Fe),V=g(bt,V,Ye),pt===null?Oe=bt:pt.sibling=bt,pt=bt,Fe=xn}if(Ye===ne.length)return o(J,Fe),lt&&Xi(J,Ye),Oe;if(Fe===null){for(;Ye<ne.length;Ye++)Fe=pe(J,ne[Ye],fe),Fe!==null&&(V=g(Fe,V,Ye),pt===null?Oe=Fe:pt.sibling=Fe,pt=Fe);return lt&&Xi(J,Ye),Oe}for(Fe=d(Fe);Ye<ne.length;Ye++)xn=ie(Fe,J,Ye,ne[Ye],fe),xn!==null&&(s&&(bt=xn.alternate,bt!==null&&Fe.delete(bt.key===null?Ye:bt.key)),V=g(xn,V,Ye),pt===null?Oe=xn:pt.sibling=xn,pt=xn);return s&&Fe.forEach(function(Wr){return r(J,Wr)}),lt&&Xi(J,Ye),Oe}function Be(J,V,ne,fe){if(ne==null)throw Error(i(151));for(var Oe=null,pt=null,Fe=V,Ye=V=0,xn=null,bt=ne.next();Fe!==null&&!bt.done;Ye++,bt=ne.next()){Fe.index>Ye?(xn=Fe,Fe=null):xn=Fe.sibling;var Wr=Z(J,Fe,bt.value,fe);if(Wr===null){Fe===null&&(Fe=xn);break}s&&Fe&&Wr.alternate===null&&r(J,Fe),V=g(Wr,V,Ye),pt===null?Oe=Wr:pt.sibling=Wr,pt=Wr,Fe=xn}if(bt.done)return o(J,Fe),lt&&Xi(J,Ye),Oe;if(Fe===null){for(;!bt.done;Ye++,bt=ne.next())bt=pe(J,bt.value,fe),bt!==null&&(V=g(bt,V,Ye),pt===null?Oe=bt:pt.sibling=bt,pt=bt);return lt&&Xi(J,Ye),Oe}for(Fe=d(Fe);!bt.done;Ye++,bt=ne.next())bt=ie(Fe,J,Ye,bt.value,fe),bt!==null&&(s&&(xn=bt.alternate,xn!==null&&Fe.delete(xn.key===null?Ye:xn.key)),V=g(bt,V,Ye),pt===null?Oe=bt:pt.sibling=bt,pt=bt);return s&&Fe.forEach(function(jE){return r(J,jE)}),lt&&Xi(J,Ye),Oe}function nt(J,V,ne,fe){if(typeof ne=="object"&&ne!==null&&ne.type===X&&ne.key===null&&ne.props.ref===void 0&&(ne=ne.props.children),typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case Q:e:{for(var Oe=ne.key;V!==null;){if(V.key===Oe){if(Oe=ne.type,Oe===X){if(V.tag===7){o(J,V.sibling),fe=p(V,ne.props.children),Mr(fe,ne),fe.return=J,J=fe;break e}}else if(V.elementType===Oe||typeof Oe=="object"&&Oe!==null&&Oe.$$typeof===A&&La(Oe)===V.type){o(J,V.sibling),fe=p(V,ne.props),Mr(fe,ne),fe.return=J,J=fe;break e}o(J,V);break}else r(J,V);V=V.sibling}ne.type===X?(fe=Ca(ne.props.children,J.mode,fe,ne.key),Mr(fe,ne),fe.return=J,J=fe):(fe=Zu(ne.type,ne.key,ne.props,null,J.mode,fe),Mr(fe,ne),fe.return=J,J=fe)}return w(J);case I:e:{for(Oe=ne.key;V!==null;){if(V.key===Oe)if(V.tag===4&&V.stateNode.containerInfo===ne.containerInfo&&V.stateNode.implementation===ne.implementation){o(J,V.sibling),fe=p(V,ne.children||[]),fe.return=J,J=fe;break e}else{o(J,V);break}else r(J,V);V=V.sibling}fe=Zf(ne,J.mode,fe),fe.return=J,J=fe}return w(J);case A:return ne=La(ne),nt(J,V,ne,fe)}if(De(ne))return Te(J,V,ne,fe);if(Ne(ne)){if(Oe=Ne(ne),typeof Oe!="function")throw Error(i(150));return ne=Oe.call(ne),Be(J,V,ne,fe)}if(typeof ne.then=="function")return nt(J,V,od(ne),fe);if(ne.$$typeof===q)return nt(J,V,id(J,ne),fe);cd(J,ne)}return typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint"?(ne=""+ne,V!==null&&V.tag===6?(o(J,V.sibling),fe=p(V,ne),fe.return=J,J=fe):(o(J,V),fe=Kf(ne,J.mode,fe),fe.return=J,J=fe),w(J)):o(J,V)}return function(J,V,ne,fe){try{ic=0;var Oe=nt(J,V,ne,fe);return jl=null,Oe}catch(Fe){if(Fe===kl||Fe===ad)throw Fe;var pt=os(29,Fe,null,J.mode);return pt.lanes=fe,pt.return=J,pt}finally{}}}var za=s1(!0),i1=s1(!1),Rr=!1;function op(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function cp(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 Or(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function Lr(s,r,o){var d=s.updateQueue;if(d===null)return null;if(d=d.shared,(Et&2)!==0){var p=d.pending;return p===null?r.next=r:(r.next=p.next,p.next=r),d.pending=r,r=Ku(s),Fv(s,null,o),r}return Wu(s,d,r,o),Ku(s)}function rc(s,r,o){if(r=r.updateQueue,r!==null&&(r=r.shared,(o&4194048)!==0)){var d=r.lanes;d&=s.pendingLanes,o|=d,r.lanes=o,Oo(s,o)}}function up(s,r){var o=s.updateQueue,d=s.alternate;if(d!==null&&(d=d.updateQueue,o===d)){var p=null,g=null;if(o=o.firstBaseUpdate,o!==null){do{var w={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};g===null?p=g=w:g=g.next=w,o=o.next}while(o!==null);g===null?p=g=r:g=g.next=r}else p=g=r;o={baseState:d.baseState,firstBaseUpdate:p,lastBaseUpdate:g,shared:d.shared,callbacks:d.callbacks},s.updateQueue=o;return}s=o.lastBaseUpdate,s===null?o.firstBaseUpdate=r:s.next=r,o.lastBaseUpdate=r}var dp=!1;function ac(){if(dp){var s=Sl;if(s!==null)throw s}}function lc(s,r,o,d){dp=!1;var p=s.updateQueue;Rr=!1;var g=p.firstBaseUpdate,w=p.lastBaseUpdate,T=p.shared.pending;if(T!==null){p.shared.pending=null;var $=T,ee=$.next;$.next=null,w===null?g=ee:w.next=ee,w=$;var ae=s.alternate;ae!==null&&(ae=ae.updateQueue,T=ae.lastBaseUpdate,T!==w&&(T===null?ae.firstBaseUpdate=ee:T.next=ee,ae.lastBaseUpdate=$))}if(g!==null){var pe=p.baseState;w=0,ae=ee=$=null,T=g;do{var Z=T.lane&-536870913,ie=Z!==T.lane;if(ie?(ft&Z)===Z:(d&Z)===Z){Z!==0&&Z===Ra&&(dp=!0),ae!==null&&(ae=ae.next={lane:0,tag:T.tag,payload:T.payload,callback:null,next:null});e:{var Te=s,Be=T;Z=r;var nt=o;switch(Be.tag){case 1:if(Te=Be.payload,typeof Te=="function"){pe=Te.call(nt,pe,Z);break e}pe=Te;break e;case 3:Te.flags=Te.flags&-65537|128;case 0:if(Te=Be.payload,Z=typeof Te=="function"?Te.call(nt,pe,Z):Te,Z==null)break e;pe=F({},pe,Z);break e;case 2:Rr=!0}}Z=T.callback,Z!==null&&(s.flags|=64,ie&&(s.flags|=8192),ie=p.callbacks,ie===null?p.callbacks=[Z]:ie.push(Z))}else ie={lane:Z,tag:T.tag,payload:T.payload,callback:T.callback,next:null},ae===null?(ee=ae=ie,$=pe):ae=ae.next=ie,w|=Z;if(T=T.next,T===null){if(T=p.shared.pending,T===null)break;ie=T,T=ie.next,ie.next=null,p.lastBaseUpdate=ie,p.shared.pending=null}}while(!0);ae===null&&($=pe),p.baseState=$,p.firstBaseUpdate=ee,p.lastBaseUpdate=ae,g===null&&(p.shared.lanes=0),Fr|=w,s.lanes=w,s.memoizedState=pe}}function r1(s,r){if(typeof s!="function")throw Error(i(191,s));s.call(r)}function a1(s,r){var o=s.callbacks;if(o!==null)for(s.callbacks=null,s=0;s<o.length;s++)r1(o[s],r)}var Dr=Nt(null),ud=Nt(0);function l1(s,r){s=tr,Qe(ud,s),Qe(Dr,r),tr=s|r.baseLanes}function hp(){Qe(ud,tr),Qe(Dr,Dr.current)}function fp(){tr=ud.current,wt(Dr),wt(ud)}var Ln=Nt(null),Fn=null;function zr(s){var r=s.alternate;Qe(Dn,Dn.current&1),Qe(Ln,s),Fn===null&&(r===null||Dr.current!==null||r.memoizedState!==null)&&(Fn=s)}function pp(s){Qe(Dn,Dn.current),Qe(Ln,s),Fn===null&&(Fn=s)}function o1(s){s.tag===22?(Qe(Dn,Dn.current),Qe(Ln,s),Fn===null&&(Fn=s)):$r()}function $r(){Qe(Dn,Dn.current),Qe(Ln,Ln.current)}function Ns(s){wt(Ln),Fn===s&&(Fn=null),wt(Dn)}var Dn=Nt(0);function oc(s,r){Qe(Ln,Ln.current),Qe(Dn,r)}function mp(s){wt(Dn),wt(Ln),Fn===s&&(Fn=null)}function dd(s){for(var r=s;r!==null;){if(r.tag===13){var o=r.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||$m(o)||Bm(o)))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 Ki=0,tt=null,Lt=null,mn=null,hd=!1,Nl=!1,$a=!1,fd=0,cc=0,Cl=null,GC=0;function on(){throw Error(i(321))}function gp(s,r){if(r===null)return!1;for(var o=0;o<r.length&&o<s.length;o++)if(!js(s[o],r[o]))return!1;return!0}function xp(s,r,o,d,p,g){return Ki=g,tt=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,Ce.H=s===null||s.memoizedState===null?V1:G1,$a=!1,g=o(d,p),$a=!1,Nl&&(g=u1(r,o,d,p)),c1(s),g}function c1(s){Ce.H=yd;var r=Lt!==null&&Lt.next!==null;if(Ki=0,mn=Lt=tt=null,hd=!1,cc=0,Cl=null,r)throw Error(i(300));s===null||gn||(s=s.dependencies,s!==null&&sd(s)&&(gn=!0))}function u1(s,r,o,d){tt=s;var p=0;do{if(Nl&&(Cl=null),cc=0,Nl=!1,25<=p)throw Error(i(301));if(p+=1,mn=Lt=null,s.updateQueue!=null){var g=s.updateQueue;g.lastEffect=null,g.events=null,g.stores=null,g.memoCache!=null&&(g.memoCache.index=0)}Ce.H=e3,g=r(o,d)}while(Nl);return g}function YC(){var s=Ce.H,r=s.useState()[0];return r=typeof r.then=="function"?uc(r):r,s=s.useState()[0],(Lt!==null?Lt.memoizedState:null)!==s&&(tt.flags|=1024),r}function vp(){var s=fd!==0;return fd=0,s}function bp(s,r,o){r.updateQueue=s.updateQueue,r.flags&=-2053,s.lanes&=~o}function yp(s){if(hd){for(s=s.memoizedState;s!==null;){var r=s.queue;r!==null&&(r.pending=null),s=s.next}hd=!1}Ki=0,mn=Lt=tt=null,Nl=!1,cc=fd=0,Cl=null}function Wn(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return mn===null?tt.memoizedState=mn=s:mn=mn.next=s,mn}function hn(){if(Lt===null){var s=tt.alternate;s=s!==null?s.memoizedState:null}else s=Lt.next;var r=mn===null?tt.memoizedState:mn.next;if(r!==null)mn=r,Lt=s;else{if(s===null)throw tt.alternate===null?Error(i(467)):Error(i(310));Lt=s,s={memoizedState:Lt.memoizedState,baseState:Lt.baseState,baseQueue:Lt.baseQueue,queue:Lt.queue,next:null},mn===null?tt.memoizedState=mn=s:mn=mn.next=s}return mn}function pd(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function uc(s){var r=cc;return cc+=1,Cl===null&&(Cl=[]),s=e1(Cl,s,r),r=tt,(mn===null?r.memoizedState:mn.next)===null&&(r=r.alternate,Ce.H=r===null||r.memoizedState===null?V1:G1),s}function md(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return uc(s);if(s.$$typeof===oe)return;if(s.$$typeof===q)return On(s)}throw Error(i(438,String(s)))}function _p(s){var r=null,o=tt.updateQueue;if(o!==null&&(r=o.memoCache),r==null){var d=tt.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(r={data:d.data.map(function(p){return p.slice()}),index:0})))}if(r==null&&(r={data:[],index:0}),o===null&&(o=pd(),tt.updateQueue=o),o.memoCache=r,o=r.data[r.index],o===void 0)for(o=r.data[r.index]=Array(s),d=0;d<s;d++)o[d]=z;return r.index++,o}function Zi(s,r){return typeof r=="function"?r(s):r}function gd(s){var r=hn();return wp(r,Lt,s)}function wp(s,r,o){var d=s.queue;if(d===null)throw Error(i(311));d.lastRenderedReducer=o;var p=s.baseQueue,g=d.pending;if(g!==null){if(p!==null){var w=p.next;p.next=g.next,g.next=w}r.baseQueue=p=g,d.pending=null}if(g=s.baseState,p===null)s.memoizedState=g;else{r=p.next;var T=w=null,$=null,ee=r,ae=!1;do{var pe=ee.lane&-536870913;if(pe!==ee.lane?(ft&pe)===pe:(Ki&pe)===pe){var Z=ee.revertLane;if(Z===0)$!==null&&($=$.next={lane:0,revertLane:0,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null}),pe===Ra&&(ae=!0);else if((Ki&Z)===Z){ee=ee.next,Z===Ra&&(ae=!0);continue}else pe={lane:0,revertLane:ee.revertLane,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},$===null?(T=$=pe,w=g):$=$.next=pe,tt.lanes|=Z,Fr|=Z;pe=ee.action,$a&&o(g,pe),g=ee.hasEagerState?ee.eagerState:o(g,pe)}else Z={lane:pe,revertLane:ee.revertLane,gesture:ee.gesture,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},$===null?(T=$=Z,w=g):$=$.next=Z,tt.lanes|=pe,Fr|=pe;ee=ee.next}while(ee!==null&&ee!==r);if($===null?w=g:$.next=T,!js(g,s.memoizedState)&&(gn=!0,ae&&(o=Sl,o!==null)))throw o;s.memoizedState=g,s.baseState=w,s.baseQueue=$,d.lastRenderedState=g}return p===null&&(d.lanes=0),[s.memoizedState,d.dispatch]}function Sp(s){var r=hn(),o=r.queue;if(o===null)throw Error(i(311));o.lastRenderedReducer=s;var d=o.dispatch,p=o.pending,g=r.memoizedState;if(p!==null){o.pending=null;var w=p=p.next;do g=s(g,w.action),w=w.next;while(w!==p);js(g,r.memoizedState)||(gn=!0),r.memoizedState=g,r.baseQueue===null&&(r.baseState=g),o.lastRenderedState=g}return[g,d]}function d1(s,r,o){var d=tt,p=hn(),g=lt;if(g){if(o===void 0)throw Error(i(407));o=o()}else o=r();var w=!js((Lt||p).memoizedState,o);if(w&&(p.memoizedState=o,gn=!0),p=p.queue,Np(p1.bind(null,d,p,s),[s]),s=p.getSnapshot!==r||w||mn!==null&&(mn.memoizedState.tag&1)!==0,El(s?9:8,{destroy:void 0},f1.bind(null,d,p,o,r),null),s){if(d.flags|=2048,zt===null)throw Error(i(349));g||(Ki&127)!==0||h1(d,r,o)}return o}function h1(s,r,o){s.flags|=16384,s={getSnapshot:r,value:o},r=tt.updateQueue,r===null?(r=pd(),tt.updateQueue=r,r.stores=[s]):(o=r.stores,o===null?r.stores=[s]:o.push(s))}function f1(s,r,o,d){r.value=o,r.getSnapshot=d,m1(r)&&g1(s)}function p1(s,r,o){return o(function(){m1(r)&&g1(s)})}function m1(s){var r=s.getSnapshot;s=s.value;try{var o=r();return!js(s,o)}catch{return!0}}function g1(s){var r=Na(s,2);r!==null&&hs(r,s,2)}function kp(s){var r=Wn();if(typeof s=="function"){var o=s;if(s=o(),$a){rn(!0);try{o()}finally{rn(!1)}}}return r.memoizedState=r.baseState=s,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Zi,lastRenderedState:s},r}function x1(s,r,o,d){return s.baseState=o,wp(s,Lt,typeof d=="function"?d:Zi)}function XC(s,r,o,d,p){if(bd(s))throw Error(i(485));if(s=r.action,s!==null){var g={payload:p,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){g.listeners.push(w)}};Ce.T!==null?o(!0):g.isTransition=!1,d(g),o=r.pending,o===null?(g.next=r.pending=g,v1(r,g)):(g.next=o.next,r.pending=o.next=g)}}function v1(s,r){var o=r.action,d=r.payload,p=s.state;if(r.isTransition){var g=Ce.T,w={};w.types=g!==null?g.types:null,Ce.T=w;try{var T=o(p,d),$=Ce.S;$!==null&&$(w,T),b1(s,r,T)}catch(ee){jp(s,r,ee)}finally{g!==null&&w.types!==null&&(g.types=w.types),Ce.T=g}}else try{g=o(p,d),b1(s,r,g)}catch(ee){jp(s,r,ee)}}function b1(s,r,o){o!==null&&typeof o=="object"&&typeof o.then=="function"?o.then(function(d){y1(s,r,d)},function(d){return jp(s,r,d)}):y1(s,r,o)}function y1(s,r,o){r.status="fulfilled",r.value=o,_1(r),s.state=o,r=s.pending,r!==null&&(o=r.next,o===r?s.pending=null:(o=o.next,r.next=o,v1(s,o)))}function jp(s,r,o){var d=s.pending;if(s.pending=null,d!==null){d=d.next;do r.status="rejected",r.reason=o,_1(r),r=r.next;while(r!==d)}s.action=null}function _1(s){s=s.listeners;for(var r=0;r<s.length;r++)(0,s[r])()}function w1(s,r){return r}function S1(s,r){if(lt){var o=zt.formState;if(o!==null){e:{var d=tt;if(lt){if(Ht){t:{for(var p=Ht,g=Is;p.nodeType!==8;){if(!g){p=null;break t}if(p=Us(p.nextSibling),p===null){p=null;break t}}g=p.data,p=g==="F!"||g==="F"?p:null}if(p){Ht=Us(p.nextSibling),d=p.data==="F!";break e}}Tr(d)}d=!1}d&&(r=o[0])}}return o=Wn(),o.memoizedState=o.baseState=r,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:w1,lastRenderedState:r},o.queue=d,o=U1.bind(null,tt,d),d.dispatch=o,d=kp(!1),g=Mp.bind(null,tt,!1,d.queue),d=Wn(),p={state:r,dispatch:null,action:s,pending:null},d.queue=p,o=XC.bind(null,tt,p,g,o),p.dispatch=o,d.memoizedState=s,[r,o,!1]}function k1(s){var r=hn();return j1(r,Lt,s)}function j1(s,r,o){if(r=wp(s,r,w1)[0],s=gd(Zi)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var d=uc(r)}catch(w){throw w===kl?ad:w}else d=r;r=hn();var p=r.queue,g=p.dispatch;return o!==r.memoizedState&&(tt.flags|=2048,El(9,{destroy:void 0},QC.bind(null,p,o),null)),[d,g,s]}function QC(s,r){s.action=r}function N1(s){var r=hn(),o=Lt;if(o!==null)return j1(r,o,s);hn(),r=r.memoizedState,o=hn();var d=o.queue.dispatch;return o.memoizedState=s,[r,d,!1]}function El(s,r,o,d){return s={tag:s,create:o,deps:d,inst:r,next:null},r=tt.updateQueue,r===null&&(r=pd(),tt.updateQueue=r),o=r.lastEffect,o===null?r.lastEffect=s.next=s:(d=o.next,o.next=s,s.next=d,r.lastEffect=s),s}function C1(){return hn().memoizedState}function xd(s,r,o,d){var p=Wn();tt.flags|=s,p.memoizedState=El(1|r,{destroy:void 0},o,d===void 0?null:d)}function vd(s,r,o,d){var p=hn();d=d===void 0?null:d;var g=p.memoizedState.inst;Lt!==null&&d!==null&&gp(d,Lt.memoizedState.deps)?p.memoizedState=El(r,g,o,d):(tt.flags|=s,p.memoizedState=El(1|r,g,o,d))}function E1(s,r){xd(8390656,8,s,r)}function Np(s,r){vd(2048,8,s,r)}function WC(s){tt.flags|=4;var r=tt.updateQueue;if(r===null)r=pd(),tt.updateQueue=r,r.events=[s];else{var o=r.events;o===null?r.events=[s]:o.push(s)}}function T1(s){var r=hn().memoizedState;return WC({ref:r,nextImpl:s}),function(){if((Et&2)!==0)throw Error(i(440));return r.impl.apply(void 0,arguments)}}function A1(s,r){return vd(4,2,s,r)}function M1(s,r){return vd(4,4,s,r)}function R1(s,r){if(typeof r=="function"){s=s();var o=r(s);return function(){typeof o=="function"?o():r(null)}}if(r!=null)return s=s(),r.current=s,function(){r.current=null}}function O1(s,r,o){o=o!=null?o.concat([s]):null,vd(4,4,R1.bind(null,r,s),o)}function Cp(){}function L1(s,r){var o=hn();r=r===void 0?null:r;var d=o.memoizedState;return r!==null&&gp(r,d[1])?d[0]:(o.memoizedState=[s,r],s)}function D1(s,r){var o=hn();r=r===void 0?null:r;var d=o.memoizedState;if(r!==null&&gp(r,d[1]))return d[0];if(d=s(),$a){rn(!0);try{s()}finally{rn(!1)}}return o.memoizedState=[d,r],d}function Ep(s,r,o){return o===void 0||(Ki&1073741824)!==0&&(ft&261930)===0?s.memoizedState=r:(s.memoizedState=o,s=Vb(),tt.lanes|=s,Fr|=s,o)}function z1(s,r,o,d){return js(o,r)?o:Dr.current!==null?(s=Ep(s,o,d),js(s,r)||(gn=!0),s):(Ki&106)===0||(Ki&1073741824)!==0&&(ft&261930)===0?(gn=!0,s.memoizedState=o):(s=Vb(),tt.lanes|=s,Fr|=s,r)}function $1(s,r,o,d,p){var g=Re.p;Re.p=g!==0&&8>g?g:8;var w=Ce.T,T={};T.types=w!==null?w.types:null,Ce.T=T,Mp(s,!1,r,o);try{var $=p(),ee=Ce.S;if(ee!==null&&ee(T,$),$!==null&&typeof $=="object"&&typeof $.then=="function"){var ae=VC($,d);dc(s,r,ae,As(s))}else dc(s,r,d,As(s))}catch(pe){dc(s,r,{then:function(){},status:"rejected",reason:pe},As())}finally{Re.p=g,w!==null&&T.types!==null&&(w.types=T.types),Ce.T=w}}function KC(){}function Tp(s,r,o,d){if(s.tag!==5)throw Error(i(476));var p=B1(s).queue;$1(s,p,r,It,o===null?KC:function(){return P1(s),o(d)})}function B1(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:Zi,lastRenderedState:It},next:null};var o={};return r.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Zi,lastRenderedState:o},next:null},s.memoizedState=r,s=s.alternate,s!==null&&(s.memoizedState=r),r}function P1(s){var r=B1(s);r.next===null&&(r=s.alternate.memoizedState),dc(s,r.next.queue,{},As())}function Ap(){return On(Yl)}function I1(){return hn().memoizedState}function F1(){return hn().memoizedState}function ZC(s){for(var r=s.return;r!==null;){switch(r.tag){case 24:case 3:var o=As();s=Or(o);var d=Lr(r,s,o);d!==null&&(hs(d,r,o),rc(d,r,o)),r={cache:ip()},s.payload=r;return}r=r.return}}function JC(s,r,o){var d=As();o={lane:d,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},bd(s)?H1(r,o):(o=Qf(s,r,o,d),o!==null&&(hs(o,s,d),q1(o,r,d)))}function U1(s,r,o){var d=As();dc(s,r,o,d)}function dc(s,r,o,d){var p={lane:d,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(bd(s))H1(r,p);else{var g=s.alternate;if(s.lanes===0&&(g===null||g.lanes===0)&&(g=r.lastRenderedReducer,g!==null))try{var w=r.lastRenderedState,T=g(w,o);if(p.hasEagerState=!0,p.eagerState=T,js(T,w))return Wu(s,r,p,0),zt===null&&Qu(),!1}catch{}finally{}if(o=Qf(s,r,p,d),o!==null)return hs(o,s,d),q1(o,r,d),!0}return!1}function Mp(s,r,o,d){if(d={lane:2,revertLane:_m(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},bd(s)){if(r)throw Error(i(479))}else r=Qf(s,o,d,2),r!==null&&hs(r,s,2)}function bd(s){var r=s.alternate;return s===tt||r!==null&&r===tt}function H1(s,r){Nl=hd=!0;var o=s.pending;o===null?r.next=r:(r.next=o.next,o.next=r),s.pending=r}function q1(s,r,o){if((o&4194048)!==0){var d=r.lanes;d&=s.pendingLanes,o|=d,r.lanes=o,Oo(s,o)}}var yd={readContext:On,use:md,useCallback:on,useContext:on,useEffect:on,useImperativeHandle:on,useLayoutEffect:on,useInsertionEffect:on,useMemo:on,useReducer:on,useRef:on,useState:on,useDebugValue:on,useDeferredValue:on,useTransition:on,useSyncExternalStore:on,useId:on,useHostTransitionStatus:on,useFormState:on,useActionState:on,useOptimistic:on,useMemoCache:on,useCacheRefresh:on,useEffectEvent:on},V1={readContext:On,use:md,useCallback:function(s,r){return Wn().memoizedState=[s,r===void 0?null:r],s},useContext:On,useEffect:E1,useImperativeHandle:function(s,r,o){o=o!=null?o.concat([s]):null,xd(4194308,4,R1.bind(null,r,s),o)},useLayoutEffect:function(s,r){return xd(4194308,4,s,r)},useInsertionEffect:function(s,r){xd(4,2,s,r)},useMemo:function(s,r){var o=Wn();r=r===void 0?null:r;var d=s();if($a){rn(!0);try{s()}finally{rn(!1)}}return o.memoizedState=[d,r],d},useReducer:function(s,r,o){var d=Wn();if(o!==void 0){var p=o(r);if($a){rn(!0);try{o(r)}finally{rn(!1)}}}else p=r;return d.memoizedState=d.baseState=p,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:p},d.queue=s,s=s.dispatch=JC.bind(null,tt,s),[d.memoizedState,s]},useRef:function(s){var r=Wn();return s={current:s},r.memoizedState=s},useState:function(s){s=kp(s);var r=s.queue,o=U1.bind(null,tt,r);return r.dispatch=o,[s.memoizedState,o]},useDebugValue:Cp,useDeferredValue:function(s,r){var o=Wn();return Ep(o,s,r)},useTransition:function(){var s=kp(!1);return s=$1.bind(null,tt,s.queue,!0,!1),Wn().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,r,o){var d=tt,p=Wn();if(lt){if(o===void 0)throw Error(i(407));o=o()}else{if(o=r(),zt===null)throw Error(i(349));(ft&127)!==0||h1(d,r,o)}p.memoizedState=o;var g={value:o,getSnapshot:r};return p.queue=g,E1(p1.bind(null,d,g,s),[s]),d.flags|=2048,El(9,{destroy:void 0},f1.bind(null,d,g,o,r),null),o},useId:function(){var s=Wn(),r=zt.identifierPrefix;if(lt){var o=vi,d=xi;o=(d&~(1<<32-en(d)-1)).toString(32)+o,r="_"+r+"R_"+o,o=fd++,0<o&&(r+="H"+o.toString(32)),r+="_"}else o=GC++,r="_"+r+"r_"+o.toString(32)+"_";return s.memoizedState=r},useHostTransitionStatus:Ap,useFormState:S1,useActionState:S1,useOptimistic:function(s){var r=Wn();r.memoizedState=r.baseState=s;var o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=o,r=Mp.bind(null,tt,!0,o),o.dispatch=r,[s,r]},useMemoCache:_p,useCacheRefresh:function(){return Wn().memoizedState=ZC.bind(null,tt)},useEffectEvent:function(s){var r=Wn(),o={impl:s};return r.memoizedState=o,function(){if((Et&2)!==0)throw Error(i(440));return o.impl.apply(void 0,arguments)}}},G1={readContext:On,use:md,useCallback:L1,useContext:On,useEffect:Np,useImperativeHandle:O1,useInsertionEffect:A1,useLayoutEffect:M1,useMemo:D1,useReducer:gd,useRef:C1,useState:function(){return gd(Zi)},useDebugValue:Cp,useDeferredValue:function(s,r){var o=hn();return z1(o,Lt.memoizedState,s,r)},useTransition:function(){var s=gd(Zi)[0],r=hn().memoizedState;return[typeof s=="boolean"?s:uc(s),r]},useSyncExternalStore:d1,useId:I1,useHostTransitionStatus:Ap,useFormState:k1,useActionState:k1,useOptimistic:function(s,r){var o=hn();return x1(o,Lt,s,r)},useMemoCache:_p,useCacheRefresh:F1,useEffectEvent:T1},e3={readContext:On,use:md,useCallback:L1,useContext:On,useEffect:Np,useImperativeHandle:O1,useInsertionEffect:A1,useLayoutEffect:M1,useMemo:D1,useReducer:Sp,useRef:C1,useState:function(){return Sp(Zi)},useDebugValue:Cp,useDeferredValue:function(s,r){var o=hn();return Lt===null?Ep(o,s,r):z1(o,Lt.memoizedState,s,r)},useTransition:function(){var s=Sp(Zi)[0],r=hn().memoizedState;return[typeof s=="boolean"?s:uc(s),r]},useSyncExternalStore:d1,useId:I1,useHostTransitionStatus:Ap,useFormState:N1,useActionState:N1,useOptimistic:function(s,r){var o=hn();return Lt!==null?x1(o,Lt,s,r):(o.baseState=s,[s,o.queue.dispatch])},useMemoCache:_p,useCacheRefresh:F1,useEffectEvent:T1};function Rp(s,r,o,d){r=s.memoizedState,o=o(d,r),o=o==null?r:F({},r,o),s.memoizedState=o,s.lanes===0&&(s.updateQueue.baseState=o)}var Op={enqueueSetState:function(s,r,o){s=s._reactInternals;var d=As(),p=Or(d);p.payload=r,o!=null&&(p.callback=o),r=Lr(s,p,d),r!==null&&(hs(r,s,d),rc(r,s,d))},enqueueReplaceState:function(s,r,o){s=s._reactInternals;var d=As(),p=Or(d);p.tag=1,p.payload=r,o!=null&&(p.callback=o),r=Lr(s,p,d),r!==null&&(hs(r,s,d),rc(r,s,d))},enqueueForceUpdate:function(s,r){s=s._reactInternals;var o=As(),d=Or(o);d.tag=2,r!=null&&(d.callback=r),r=Lr(s,d,o),r!==null&&(hs(r,s,o),rc(r,s,o))}};function Y1(s,r,o,d,p,g,w){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(d,g,w):r.prototype&&r.prototype.isPureReactComponent?!Ko(o,d)||!Ko(p,g):!0}function X1(s,r,o,d){s=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(o,d),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(o,d),r.state!==s&&Op.enqueueReplaceState(r,r.state,null)}function Ba(s,r){var o=r;if("ref"in r){o={};for(var d in r)d!=="ref"&&(o[d]=r[d])}if(s=s.defaultProps){o===r&&(o=F({},o));for(var p in s)o[p]===void 0&&(o[p]=s[p])}return o}function Q1(s){Xu(s)}function W1(s){console.error(s)}function K1(s){Xu(s)}function _d(s,r){try{var o=s.onUncaughtError;o(r.value,{componentStack:r.stack})}catch(d){setTimeout(function(){throw d})}}function Z1(s,r,o){try{var d=s.onCaughtError;d(o.value,{componentStack:o.stack,errorBoundary:r.tag===1?r.stateNode:null})}catch(p){setTimeout(function(){throw p})}}function Lp(s,r,o){return o=Or(o),o.tag=3,o.payload={element:null},o.callback=function(){_d(s,r)},o}function J1(s){return s=Or(s),s.tag=3,s}function eb(s,r,o,d){var p=o.type.getDerivedStateFromError;if(typeof p=="function"){var g=d.value;s.payload=function(){return p(g)},s.callback=function(){Z1(r,o,d)}}var w=o.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(s.callback=function(){Z1(r,o,d),typeof p!="function"&&(Ur===null?Ur=new Set([this]):Ur.add(this));var T=d.stack;this.componentDidCatch(d.value,{componentStack:T!==null?T:""})})}function t3(s,r,o,d,p){if(o.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(r=o.alternate,r!==null&&Aa(r,o,p,!0),o=Ln.current,o!==null){switch(o.tag){case 31:case 13:case 19:return Fn===null?Ud():o.alternate===null&&cn===0&&(cn=3),o.flags&=-257,o.flags|=65536,o.lanes=p,d===ld?o.flags|=16384:(r=o.updateQueue,r===null?o.updateQueue=new Set([d]):r.add(d),vm(s,d,p)),!1;case 22:return o.flags|=65536,d===ld?o.flags|=16384:(r=o.updateQueue,r===null?(r={transitions:null,markerInstances:null,retryQueue:new Set([d])},o.updateQueue=r):(o=r.retryQueue,o===null?r.retryQueue=new Set([d]):o.add(d)),vm(s,d,p)),!1}throw Error(i(435,o.tag))}return vm(s,d,p),Ud(),!1}if(lt)return r=Ln.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=p,d!==ep&&(s=Error(i(422),{cause:d}),ec($s(s,o)))):(d!==ep&&(r=Error(i(423),{cause:d}),ec($s(r,o))),s=s.current.alternate,s.flags|=65536,p&=-p,s.lanes|=p,d=$s(d,o),p=Lp(s.stateNode,d,p),up(s,p),cn!==4&&(cn=2)),!1;var g=Error(i(520),{cause:d});if(g=$s(g,o),bc===null?bc=[g]:bc.push(g),cn!==4&&(cn=2),r===null)return!0;d=$s(d,o),o=r;do{switch(o.tag){case 3:return o.flags|=65536,s=p&-p,o.lanes|=s,s=Lp(o.stateNode,d,s),up(o,s),!1;case 1:if(r=o.type,g=o.stateNode,(o.flags&128)===0&&(typeof r.getDerivedStateFromError=="function"||g!==null&&typeof g.componentDidCatch=="function"&&(Ur===null||!Ur.has(g))))return o.flags|=65536,p&=-p,o.lanes|=p,p=J1(p),eb(p,s,o,d),up(o,p),!1;break;case 22:if(o.memoizedState!==null)return o.flags|=65536,!1}o=o.return}while(o!==null);return!1}var Dp=Error(i(461)),gn=!1;function Sn(s,r,o,d){r.child=s===null?i1(r,null,o,d):za(r,s.child,o,d)}function tb(s,r,o,d,p){o=o.render;var g=r.ref;if("ref"in d){var w={};for(var T in d)T!=="ref"&&(w[T]=d[T])}else w=d;return Ma(r),d=xp(s,r,o,w,g,p),T=vp(),s!==null&&!gn?(bp(s,r,p),Ji(s,r,p)):(lt&&T&&ed(r),r.flags|=1,Sn(s,r,d,p),r.child)}function nb(s,r,o,d,p){if(s===null){var g=o.type;return typeof g=="function"&&!Wf(g)&&g.defaultProps===void 0&&o.compare===null?(r.tag=15,r.type=g,sb(s,r,g,d,p)):(s=Zu(o.type,null,d,r,r.mode,p),s.ref=r.ref,s.return=r,r.child=s)}if(g=s.child,!Hp(s,p)){var w=g.memoizedProps;if(o=o.compare,o=o!==null?o:Ko,o(w,d)&&s.ref===r.ref)return Ji(s,r,p)}return r.flags|=1,s=Yi(g,d),s.ref=r.ref,s.return=r,r.child=s}function sb(s,r,o,d,p){if(s!==null){var g=s.memoizedProps;if(Ko(g,d)&&s.ref===r.ref)if(gn=!1,r.pendingProps=d=g,Hp(s,p))(s.flags&131072)!==0&&(gn=!0);else return r.lanes=s.lanes,Ji(s,r,p)}return zp(s,r,o,d,p)}function ib(s,r,o,d){var p=d.children,g=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(g=g!==null?g.baseLanes|o:o,s!==null){for(d=r.child=s.child,p=0;d!==null;)p=p|d.lanes|d.childLanes,d=d.sibling;d=p&~g}else d=0,r.child=null;return rb(s,r,g,o,d)}if((o&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},s!==null&&rd(r,g!==null?g.cachePool:null),g!==null?l1(r,g):hp(),o1(r);else return d=r.lanes=536870912,rb(s,r,g!==null?g.baseLanes|o:o,o,d)}else g!==null?(rd(r,g.cachePool),l1(r,g),$r(),r.memoizedState=null):(s!==null&&rd(r,null),hp(),$r());return Sn(s,r,p,o),r.child}function hc(s,r){return s!==null&&s.tag===22||r.stateNode!==null||(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.sibling}function rb(s,r,o,d,p){var g=ap();return g=g===null?null:{parent:pn._currentValue,pool:g},r.memoizedState={baseLanes:o,cachePool:g},s!==null&&rd(r,null),hp(),o1(r),s!==null&&Aa(s,r,d,!0),r.childLanes=p,null}function wd(s,r){return r=Sd({mode:r.mode,children:r.children},s.mode),r.ref=s.ref,s.child=r,r.return=s,r}function ab(s,r,o){return za(r,s.child,null,o),s=wd(r,r.pendingProps),s.flags|=2,Ns(r),r.memoizedState=null,s}function n3(s,r,o){var d=r.pendingProps,p=(r.flags&128)!==0;if(r.flags&=-129,s===null){if(lt){if(d.mode==="hidden")return s=wd(r,d),r.lanes=536870912,s.memoizedState={baseLanes:0,cachePool:null},hc(null,s);if(pp(r),(s=Ht)?(s=Ry(s,Is),s=s!==null&&s.data==="&"?s:null,s!==null&&(r.memoizedState={dehydrated:s,treeContext:Cr!==null?{id:xi,overflow:vi}:null,retryLane:536870912,hydrationErrors:null},o=Hv(s),o.return=r,r.child=o,En=r,Ht=null)):s=null,s===null)throw Tr(r);return r.lanes=536870912,null}return wd(r,d)}var g=s.memoizedState;if(g!==null){var w=g.dehydrated;if(pp(r),p)if(r.flags&256)r.flags&=-257,r=ab(s,r,o);else if(r.memoizedState!==null)r.child=s.child,r.flags|=128,r=null;else throw Error(i(558));else if(gn||Aa(s,r,o,!1),p=(o&s.childLanes)!==0,gn||p){if(Dr.current===null){if(d=zt,d!==null&&(w=pi(d,o),w!==0&&w!==g.retryLane))throw g.retryLane=w,Na(s,w),hs(d,s,w),Dp;Ud()}r=ab(s,r,o)}else s=g.treeContext,Ht=Us(w.nextSibling),En=r,lt=!0,Er=null,Is=!1,s!==null&&Gv(r,s),r=wd(r,d),r.flags|=134221824;return r}return s=Yi(s.child,{mode:d.mode,children:d.children}),s.ref=r.ref,r.child=s,s.return=r,s}function Tl(s,r){var o=r.ref;if(o===null)s!==null&&s.ref!==null&&(r.flags|=4194816);else{if(typeof o!="function"&&typeof o!="object")throw Error(i(284));(s===null||s.ref!==o)&&(r.flags|=4194816)}}function zp(s,r,o,d,p){return Ma(r),o=xp(s,r,o,d,void 0,p),d=vp(),s!==null&&!gn?(bp(s,r,p),Ji(s,r,p)):(lt&&d&&ed(r),r.flags|=1,Sn(s,r,o,p),r.child)}function lb(s,r,o,d,p,g){return Ma(r),r.updateQueue=null,o=u1(r,d,o,p),c1(s),d=vp(),s!==null&&!gn?(bp(s,r,g),Ji(s,r,g)):(lt&&d&&ed(r),r.flags|=1,Sn(s,r,o,g),r.child)}function ob(s,r,o,d,p){if(Ma(r),r.stateNode===null){var g=bl,w=o.contextType;typeof w=="object"&&w!==null&&(g=On(w)),g=new o(d,g),r.memoizedState=g.state!==null&&g.state!==void 0?g.state:null,g.updater=Op,r.stateNode=g,g._reactInternals=r,g=r.stateNode,g.props=d,g.state=r.memoizedState,g.refs={},op(r),w=o.contextType,g.context=typeof w=="object"&&w!==null?On(w):bl,g.state=r.memoizedState,w=o.getDerivedStateFromProps,typeof w=="function"&&(Rp(r,o,w,d),g.state=r.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof g.getSnapshotBeforeUpdate=="function"||typeof g.UNSAFE_componentWillMount!="function"&&typeof g.componentWillMount!="function"||(w=g.state,typeof g.componentWillMount=="function"&&g.componentWillMount(),typeof g.UNSAFE_componentWillMount=="function"&&g.UNSAFE_componentWillMount(),w!==g.state&&Op.enqueueReplaceState(g,g.state,null),lc(r,d,g,p),ac(),g.state=r.memoizedState),typeof g.componentDidMount=="function"&&(r.flags|=4194308),d=!0}else if(s===null){g=r.stateNode;var T=r.memoizedProps,$=Ba(o,T);g.props=$;var ee=g.context,ae=o.contextType;w=bl,typeof ae=="object"&&ae!==null&&(w=On(ae));var pe=o.getDerivedStateFromProps;ae=typeof pe=="function"||typeof g.getSnapshotBeforeUpdate=="function",T=r.pendingProps!==T,ae||typeof g.UNSAFE_componentWillReceiveProps!="function"&&typeof g.componentWillReceiveProps!="function"||(T||ee!==w)&&X1(r,g,d,w),Rr=!1;var Z=r.memoizedState;g.state=Z,lc(r,d,g,p),ac(),ee=r.memoizedState,T||Z!==ee||Rr?(typeof pe=="function"&&(Rp(r,o,pe,d),ee=r.memoizedState),($=Rr||Y1(r,o,$,d,Z,ee,w))?(ae||typeof g.UNSAFE_componentWillMount!="function"&&typeof g.componentWillMount!="function"||(typeof g.componentWillMount=="function"&&g.componentWillMount(),typeof g.UNSAFE_componentWillMount=="function"&&g.UNSAFE_componentWillMount()),typeof g.componentDidMount=="function"&&(r.flags|=4194308)):(typeof g.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=d,r.memoizedState=ee),g.props=d,g.state=ee,g.context=w,d=$):(typeof g.componentDidMount=="function"&&(r.flags|=4194308),d=!1)}else{g=r.stateNode,cp(s,r),w=r.memoizedProps,ae=Ba(o,w),g.props=ae,pe=r.pendingProps,Z=g.context,ee=o.contextType,$=bl,typeof ee=="object"&&ee!==null&&($=On(ee)),T=o.getDerivedStateFromProps,(ee=typeof T=="function"||typeof g.getSnapshotBeforeUpdate=="function")||typeof g.UNSAFE_componentWillReceiveProps!="function"&&typeof g.componentWillReceiveProps!="function"||(w!==pe||Z!==$)&&X1(r,g,d,$),Rr=!1,Z=r.memoizedState,g.state=Z,lc(r,d,g,p),ac();var ie=r.memoizedState;w!==pe||Z!==ie||Rr||s!==null&&s.dependencies!==null&&sd(s.dependencies)?(typeof T=="function"&&(Rp(r,o,T,d),ie=r.memoizedState),(ae=Rr||Y1(r,o,ae,d,Z,ie,$)||s!==null&&s.dependencies!==null&&sd(s.dependencies))?(ee||typeof g.UNSAFE_componentWillUpdate!="function"&&typeof g.componentWillUpdate!="function"||(typeof g.componentWillUpdate=="function"&&g.componentWillUpdate(d,ie,$),typeof g.UNSAFE_componentWillUpdate=="function"&&g.UNSAFE_componentWillUpdate(d,ie,$)),typeof g.componentDidUpdate=="function"&&(r.flags|=4),typeof g.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof g.componentDidUpdate!="function"||w===s.memoizedProps&&Z===s.memoizedState||(r.flags|=4),typeof g.getSnapshotBeforeUpdate!="function"||w===s.memoizedProps&&Z===s.memoizedState||(r.flags|=1024),r.memoizedProps=d,r.memoizedState=ie),g.props=d,g.state=ie,g.context=$,d=ae):(typeof g.componentDidUpdate!="function"||w===s.memoizedProps&&Z===s.memoizedState||(r.flags|=4),typeof g.getSnapshotBeforeUpdate!="function"||w===s.memoizedProps&&Z===s.memoizedState||(r.flags|=1024),d=!1)}return g=d,Tl(s,r),d=(r.flags&128)!==0,g||d?(g=r.stateNode,o=d&&typeof o.getDerivedStateFromError!="function"?null:g.render(),r.flags|=1,s!==null&&d?(r.child=za(r,s.child,null,p),r.child=za(r,null,o,p)):Sn(s,r,o,p),r.memoizedState=g.state,s=r.child):s=Ji(s,r,p),s}function cb(s,r,o,d){return Ea(),r.flags|=256,Sn(s,r,o,d),r.child}var $p={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Bp(s){return{baseLanes:s,cachePool:Zv()}}function Pp(s,r,o){return s=s!==null?s.childLanes&~o:0,r&&(s|=Ts),s}function ub(s,r,o){var d=r.pendingProps,p=!1,g=(r.flags&128)!==0,w;if((w=g)||(w=s!==null&&s.memoizedState===null?!1:(Dn.current&2)!==0),w&&(p=!0,r.flags&=-129),w=(r.flags&32)!==0,r.flags&=-33,s===null){if(lt){if(p?zr(r):$r(),(s=Ht)?(s=Ry(s,Is),s=s!==null&&s.data!=="&"?s:null,s!==null&&(r.memoizedState={dehydrated:s,treeContext:Cr!==null?{id:xi,overflow:vi}:null,retryLane:536870912,hydrationErrors:null},o=Hv(s),o.return=r,r.child=o,En=r,Ht=null)):s=null,s===null)throw Tr(r);return Bm(s)?r.lanes=32:r.lanes=536870912,null}return g=d.children,d=d.fallback,p?($r(),p=r.mode,g=Sd({mode:"hidden",children:g},p),d=Ca(d,p,o,null),g.return=r,d.return=r,g.sibling=d,r.child=g,d=r.child,d.memoizedState=Bp(o),d.childLanes=Pp(s,w,o),r.memoizedState=$p,hc(null,d)):(zr(r),Ip(r,g))}var T=s.memoizedState;if(T!==null){var $=T.dehydrated;if($!==null)return s3(s,r,g,w,d,$,T,o)}return p?($r(),p=d.fallback,g=r.mode,T=s.child,$=T.sibling,d=Yi(T,{mode:"hidden",children:d.children}),d.subtreeFlags=T.subtreeFlags&1206910976,$!==null?p=Yi($,p):(p=Ca(p,g,o,null),p.flags|=2),p.return=r,d.return=r,d.sibling=p,r.child=d,hc(null,d),d=r.child,p=s.child.memoizedState,p===null?p=Bp(o):(g=p.cachePool,g!==null?(T=pn._currentValue,g=g.parent!==T?{parent:T,pool:T}:g):g=Zv(),p={baseLanes:p.baseLanes|o,cachePool:g}),d.memoizedState=p,d.childLanes=Pp(s,w,o),r.memoizedState=$p,hc(s.child,d)):(zr(r),o=s.child,s=o.sibling,o=Yi(o,{mode:"visible",children:d.children}),o.return=r,o.sibling=null,s!==null&&(w=r.deletions,w===null?(r.deletions=[s],r.flags|=16):w.push(s)),r.child=o,r.memoizedState=null,o)}function Ip(s,r){return r=Sd({mode:"visible",children:r},s.mode),r.return=s,s.child=r}function Sd(s,r){return s=os(22,s,null,r),s.lanes=0,s}function kd(s,r,o){return za(r,s.child,null,o),s=Ip(r,r.pendingProps.children),s.flags|=2,r.memoizedState=null,s}function s3(s,r,o,d,p,g,w,T){if(o)return r.flags&256?(zr(r),r.flags&=-257,kd(s,r,T)):r.memoizedState!==null?($r(),r.child=s.child,r.flags|=128,null):($r(),g=p.fallback,w=r.mode,p=Sd({mode:"visible",children:p.children},w),g=Ca(g,w,T,null),g.flags|=2,p.return=r,g.return=r,p.sibling=g,r.child=p,za(r,s.child,null,T),p=r.child,p.memoizedState=Bp(T),p.childLanes=Pp(s,d,T),r.memoizedState=$p,hc(null,p));if(zr(r),Bm(g)){if(d=g.nextSibling&&g.nextSibling.dataset,d)var $=d.dgst;return d=$,d!==""&&(p=Error(i(419)),p.stack="",p.digest=d,ec({value:p,source:null,stack:null})),kd(s,r,T)}if(gn||Aa(s,r,T,!1),d=(T&s.childLanes)!==0,gn||d){if(Dr.current!==null)return kd(s,r,T);if(d=zt,d!==null&&(p=pi(d,T),p!==0&&p!==w.retryLane))throw w.retryLane=p,Na(s,p),hs(d,s,p),Dp;return $m(g)||Ud(),kd(s,r,T)}return $m(g)?(r.flags|=192,r.child=s.child,null):(s=w.treeContext,Ht=Us(g.nextSibling),En=r,lt=!0,Er=null,Is=!1,s!==null&&Gv(r,s),r=Ip(r,p.children),r.flags|=134221824,r)}function db(s,r,o){s.lanes|=r;var d=s.alternate;d!==null&&(d.lanes|=r),nd(s.return,r,o)}function hb(s){for(var r=null;s!==null;){var o=s.alternate;o!==null&&dd(o)===null&&(r=s),s=s.sibling}return r}function jd(s,r,o,d,p,g){var w=s.memoizedState;w===null?s.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:d,tail:o,tailMode:p,treeForkCount:g}:(w.isBackwards=r,w.rendering=null,w.renderingStartTime=0,w.last=d,w.tail=o,w.tailMode=p,w.treeForkCount=g)}function Fp(s){var r=s.child;for(s.child=null;r!==null;){var o=r.sibling;r.sibling=s.child,s.child=r,r=o}}function Up(s,r,o){var d=r.pendingProps,p=d.revealOrder,g=d.tail;d=d.children;var w=Dn.current;if(r.flags&128)return oc(r,w),null;var T=(w&2)!==0;if(T?(w=w&1|2,r.flags|=128):w&=1,oc(r,w),p==="backwards"&&s!==null?(Fp(s),Sn(s,r,d,o),Fp(s)):Sn(s,r,d,o),d=lt?Jo:0,!T&&s!==null&&(s.flags&128)!==0)e:for(s=r.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&db(s,o,r);else if(s.tag===19)db(s,o,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(p){case"backwards":o=hb(r.child),o===null?(p=r.child,r.child=null):(p=o.sibling,o.sibling=null,Fp(r)),jd(r,!0,p,null,g,d);break;case"unstable_legacy-backwards":for(o=null,p=r.child,r.child=null;p!==null;){if(s=p.alternate,s!==null&&dd(s)===null){r.child=p;break}s=p.sibling,p.sibling=o,o=p,p=s}jd(r,!0,o,null,g,d);break;case"together":jd(r,!1,null,null,void 0,d);break;case"independent":r.memoizedState=null;break;default:o=hb(r.child),o===null?(p=r.child,r.child=null):(p=o.sibling,o.sibling=null),jd(r,!1,p,o,g,d)}return r.child}function fb(s,r,o){var d=r.pendingProps;return Ar(r,r.type,d.value),Sn(s,r,d.children,o),r.child}function Ji(s,r,o){if(s!==null&&(r.dependencies=s.dependencies),Fr|=r.lanes,(o&r.childLanes)===0)if(s!==null){if(Aa(s,r,o,!1),(o&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,o=Yi(s,s.pendingProps),r.child=o,o.return=r;s.sibling!==null;)s=s.sibling,o=o.sibling=Yi(s,s.pendingProps),o.return=r;o.sibling=null}return r.child}function Hp(s,r){return(s.lanes&r)!==0?!0:(s=s.dependencies,!!(s!==null&&sd(s)))}function i3(s,r,o){switch(r.tag){case 3:Xe(r,r.stateNode.containerInfo),Ar(r,pn,s.memoizedState.cache),Ea();break;case 27:case 5:un(r);break;case 4:Xe(r,r.stateNode.containerInfo);break;case 10:Ar(r,r.type,r.memoizedProps.value);break;case 31:if(r.memoizedState!==null)return r.flags|=128,pp(r),null;break;case 13:var d=r.memoizedState;if(d!==null){if(d.dehydrated!==null)return zr(r),r.flags|=128,null;d=Aa(s,r,o,!1);var p=r.child.childLanes;return d||(o&p)!==0?ub(s,r,o):(zr(r),s=Ji(s,r,o),s!==null?s.sibling:null)}zr(r);break;case 19:if(r.flags&128)return Up(s,r,o);if(p=(s.flags&128)!==0,d=(o&r.childLanes)!==0,d||(Aa(s,r,o,!1),d=(o&r.childLanes)!==0),p){if(d)return Up(s,r,o);r.flags|=128}if(p=r.memoizedState,p!==null&&(p.rendering=null,p.tail=null,p.lastEffect=null),oc(r,Dn.current),d)break;return null;case 22:return r.lanes=0,ib(s,r,o,r.pendingProps);case 24:Ar(r,pn,s.memoizedState.cache)}return Ji(s,r,o)}function pb(s,r,o){if(s!==null)if(s.memoizedProps!==r.pendingProps)gn=!0;else{if(!Hp(s,o)&&(r.flags&128)===0)return gn=!1,i3(s,r,o);gn=(s.flags&131072)!==0}else gn=!1,lt&&(r.flags&1048576)!==0&&Vv(r,Jo,r.index);switch(r.lanes=0,r.tag){case 16:e:{var d=r.pendingProps;if(s=La(r.elementType),r.type=s,typeof s=="function")Wf(s)?(d=Ba(s,d),r.tag=1,r=ob(null,r,s,d,o)):(r.tag=0,r=zp(null,r,s,d,o));else{if(s!=null){var p=s.$$typeof;if(p===H){r.tag=11,r=tb(null,r,s,d,o);break e}else if(p===ve){r.tag=14,r=nb(null,r,s,d,o);break e}else if(p===q){r.tag=10,r.type=s,r=fb(null,r,o);break e}}throw r=Le(s)||s,Error(i(306,r,""))}}return r;case 0:return zp(s,r,r.type,r.pendingProps,o);case 1:return d=r.type,p=Ba(d,r.pendingProps),ob(s,r,d,p,o);case 3:e:{if(Xe(r,r.stateNode.containerInfo),s===null)throw Error(i(387));d=r.pendingProps;var g=r.memoizedState;p=g.element,cp(s,r),lc(r,d,null,o);var w=r.memoizedState;if(d=w.cache,Ar(r,pn,d),d!==g.cache&&sp(r,[pn],o,!0),ac(),d=w.element,g.isDehydrated)if(g={element:d,isDehydrated:!1,cache:w.cache},r.updateQueue.baseState=g,r.memoizedState=g,r.flags&256){r=cb(s,r,d,o);break e}else if(d!==p){p=$s(Error(i(424)),r),ec(p),r=cb(s,r,d,o);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=Us(s.firstChild),En=r,lt=!0,Er=null,Is=!0,o=i1(r,null,d,o),r.child=o;o;)o.flags=o.flags&-3|134221824,o=o.sibling}else{if(Ea(),d===p){r=Ji(s,r,o);break e}Sn(s,r,d,o)}r=r.child}return r;case 26:return Tl(s,r),s===null?(o=Py(r.type,null,r.pendingProps,null))?r.memoizedState=o:lt||(r.stateNode=vy(r.type,r.pendingProps,se.current,r)):r.memoizedState=Py(r.type,s.memoizedProps,r.pendingProps,s.memoizedState),null;case 27:return un(r),s===null&<&&(d=r.stateNode=Dy(r.type,r.pendingProps,se.current),En=r,Is=!0,p=Ht,Vr(r.type)?(Pm=p,Ht=Us(d.firstChild)):Ht=p),Sn(s,r,r.pendingProps.children,o),Tl(s,r),s===null&&(r.flags|=4194304),r.child;case 5:return s===null&<&&((p=d=Ht)&&(d=Z3(d,r.type,r.pendingProps,Is),d!==null?(r.stateNode=d,En=r,Ht=Us(d.firstChild),Is=!1,p=!0):p=!1),p||Tr(r)),un(r),p=r.type,g=r.pendingProps,w=s!==null?s.memoizedProps:null,d=g.children,Am(p,g)?d=null:w!==null&&Am(p,w)&&(r.flags|=32),r.memoizedState!==null&&(p=xp(s,r,YC,null,null,o),Yl._currentValue=p),Tl(s,r),Sn(s,r,d,o),r.child;case 6:return s===null&<&&((s=o=Ht)&&(o=J3(o,r.pendingProps,Is),o!==null?(r.stateNode=o,En=r,Ht=null,s=!0):s=!1),s||Tr(r)),null;case 13:return ub(s,r,o);case 4:return Xe(r,r.stateNode.containerInfo),d=r.pendingProps,s===null?r.child=za(r,null,d,o):Sn(s,r,d,o),r.child;case 11:return tb(s,r,r.type,r.pendingProps,o);case 7:return d=r.pendingProps,Tl(s,r),Sn(s,r,d,o),r.child;case 8:return Sn(s,r,r.pendingProps.children,o),r.child;case 12:return Sn(s,r,r.pendingProps.children,o),r.child;case 10:return fb(s,r,o);case 9:return p=r.type._context,d=r.pendingProps.children,Ma(r),p=On(p),d=d(p),r.flags|=1,Sn(s,r,d,o),r.child;case 14:return nb(s,r,r.type,r.pendingProps,o);case 15:return sb(s,r,r.type,r.pendingProps,o);case 19:return Up(s,r,o);case 31:return n3(s,r,o);case 22:return ib(s,r,o,r.pendingProps);case 24:return Ma(r),d=On(pn),s===null?(p=ap(),p===null&&(p=zt,g=ip(),p.pooledCache=g,g.refCount++,g!==null&&(p.pooledCacheLanes|=o),p=g),r.memoizedState={parent:d,cache:p},op(r),Ar(r,pn,p)):((s.lanes&o)!==0&&(cp(s,r),lc(r,null,null,o),ac()),p=s.memoizedState,g=r.memoizedState,p.parent!==d?(p={parent:d,cache:d},r.memoizedState=p,r.lanes===0&&(r.memoizedState=r.updateQueue.baseState=p),Ar(r,pn,d)):(d=g.cache,Ar(r,pn,d),d!==p.cache&&sp(r,[pn],o,!0))),Sn(s,r,r.pendingProps.children,o),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&&ed(r),s!==null&&s.memoizedProps.name!==d.name?r.flags|=4194816:Tl(s,r),Sn(s,r,d.children,o),r.child;case 29:throw r.pendingProps}throw Error(i(156,r.tag))}function er(s){s.flags|=4}function qp(s,r,o,d,p){var g;if((g=(s.mode&32)!==0)&&(g=o===null?Hy(r,d):Hy(r,d)&&(d.src!==o.src||d.srcSet!==o.srcSet)),g){if(s.flags|=16777216,(p&335544128)===p)if(s.stateNode.complete)s.flags|=8192;else if(Qb())s.flags|=8192;else throw Da=ld,lp}else s.flags&=-16777217}function mb(s,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!qy(r))if(Qb())s.flags|=8192;else throw Da=ld,lp}function Nd(s,r){r!==null&&(s.flags|=4),s.flags&16384&&(r=s.tag!==22?Bu():536870912,s.lanes|=r,Ll|=r)}function fc(s,r){if(!lt)switch(s.tailMode){case"visible":break;case"collapsed":for(var o=s.tail,d=null;o!==null;)o.alternate!==null&&(d=o),o=o.sibling;d===null?r||s.tail===null?s.tail=null:s.tail.sibling=null:d.sibling=null;break;default:for(r=s.tail,o=null;r!==null;)r.alternate!==null&&(o=r),r=r.sibling;o===null?s.tail=null:o.sibling=null}}function qt(s){var r=s.alternate!==null&&s.alternate.child===s.child,o=0,d=0;if(r)for(var p=s.child;p!==null;)o|=p.lanes|p.childLanes,d|=p.subtreeFlags&1206910976,d|=p.flags&1206910976,p.return=s,p=p.sibling;else for(p=s.child;p!==null;)o|=p.lanes|p.childLanes,d|=p.subtreeFlags,d|=p.flags,p.return=s,p=p.sibling;return s.subtreeFlags|=d,s.childLanes=o,r}function r3(s,r,o){var d=r.pendingProps;switch(Jf(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 o=r.stateNode,d=null,s!==null&&(d=s.memoizedState.cache),r.memoizedState.cache!==d&&(r.flags|=2048),Wi(pn),et(),o.pendingContext&&(o.context=o.pendingContext,o.pendingContext=null),(s===null||s.child===null)&&(wl(r)?er(r):s===null||s.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,tp())),qt(r),null;case 26:var p=r.type,g=r.memoizedState;return s===null?(er(r),g!==null?(qt(r),mb(r,g)):(qt(r),qp(r,p,null,d,o))):g?g!==s.memoizedState?(er(r),qt(r),mb(r,g)):(qt(r),r.flags&=-16777217):(s=s.memoizedProps,s!==d&&er(r),qt(r),qp(r,p,s,d,o)),null;case 27:if(ce(r),o=se.current,p=r.type,s!==null&&r.stateNode!=null)s.memoizedProps!==d&&er(r);else{if(!d){if(r.stateNode===null)throw Error(i(166));return qt(r),r.subtreeFlags&=-33554433,null}s=St.current,wl(r)?Yv(r):(s=Dy(p,d,o),r.stateNode=s,er(r))}return qt(r),r.subtreeFlags&=-33554433,null;case 5:if(ce(r),p=r.type,s!==null&&r.stateNode!=null)s.memoizedProps!==d&&er(r);else{if(!d){if(r.stateNode===null)throw Error(i(166));return qt(r),r.subtreeFlags&=-33554433,null}if(g=St.current,wl(r))Yv(r);else{var w=kc(se.current);switch(g){case 1:g=w.createElementNS("http://www.w3.org/2000/svg",p);break;case 2:g=w.createElementNS("http://www.w3.org/1998/Math/MathML",p);break;default:switch(p){case"svg":g=w.createElementNS("http://www.w3.org/2000/svg",p);break;case"math":g=w.createElementNS("http://www.w3.org/1998/Math/MathML",p);break;case"script":g=w.createElement("div"),g.innerHTML="<script><\/script>",g=g.removeChild(g.firstChild);break;case"select":g=typeof d.is=="string"?w.createElement("select",{is:d.is}):w.createElement("select"),d.multiple?g.multiple=!0:d.size&&(g.size=d.size);break;default:g=typeof d.is=="string"?w.createElement(p,{is:d.is}):w.createElement(p)}}g[dn]=r,g[Cn]=d;e:for(w=r.child;w!==null;){if(w.tag===5||w.tag===6)g.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=g;e:switch($n(g,p,d),p){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}d&&er(r)}}return qt(r),r.subtreeFlags&=-33554433,qp(r,r.type,s===null?null:s.memoizedProps,r.pendingProps,o),null;case 6:if(s&&r.stateNode!=null)s.memoizedProps!==d&&er(r);else{if(typeof d!="string"&&r.stateNode===null)throw Error(i(166));if(s=se.current,wl(r)){if(s=r.stateNode,o=r.memoizedProps,d=null,p=En,p!==null)switch(p.tag){case 27:case 5:d=p.memoizedProps}s[dn]=r,s=!!(s.nodeValue===o||d!==null&&d.suppressHydrationWarning===!0||py(s.nodeValue,o)),s||Tr(r,!0)}else s=kc(s).createTextNode(d),s[dn]=r,r.stateNode=s}return qt(r),null;case 31:if(o=r.memoizedState,s===null||s.memoizedState!==null){if(d=wl(r),o!==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[dn]=r}else Ea(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;qt(r),s=!1}else o=tp(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=o),s=!0;if(!s)return r.flags&256?(Ns(r),r):(Ns(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(p=wl(r),d!==null&&d.dehydrated!==null){if(s===null){if(!p)throw Error(i(318));if(p=r.memoizedState,p=p!==null?p.dehydrated:null,!p)throw Error(i(317));p[dn]=r}else Ea(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;qt(r),p=!1}else p=tp(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=p),p=!0;if(!p)return r.flags&256?(Ns(r),r):(Ns(r),null)}return Ns(r),(r.flags&128)!==0?(r.lanes=o,r):(o=d!==null,s=s!==null&&s.memoizedState!==null,o&&(d=r.child,p=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(p=d.alternate.memoizedState.cachePool.pool),g=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(g=d.memoizedState.cachePool.pool),g!==p&&(d.flags|=2048)),o!==s&&o&&(r.child.flags|=8192),Nd(r,r.updateQueue),qt(r),null);case 4:return et(),s===null&&jm(r.stateNode.containerInfo),r.flags|=67108864,qt(r),null;case 10:return Wi(r.type),qt(r),null;case 19:if(mp(r),d=r.memoizedState,d===null)return qt(r),null;if(p=(r.flags&128)!==0,g=d.rendering,g===null)if(p)fc(d,!1);else{if(cn!==0||s!==null&&(s.flags&128)!==0)for(s=r.child;s!==null;){if(g=dd(s),g!==null){for(r.flags|=128,fc(d,!1),s=g.updateQueue,r.updateQueue=s,Nd(r,s),r.subtreeFlags=0,s=o,o=r.child;o!==null;)Uv(o,s),o=o.sibling;return oc(r,Dn.current&1|2),lt&&Xi(r,d.treeForkCount),r.child}s=s.sibling}d.tail!==null&&sn()>Bd&&(r.flags|=128,p=!0,fc(d,!1),r.lanes=4194304)}else{if(!p)if(s=dd(g),s!==null){if(r.flags|=128,p=!0,s=s.updateQueue,r.updateQueue=s,Nd(r,s),fc(d,!0),d.tail===null&&d.tailMode!=="collapsed"&&d.tailMode!=="visible"&&!g.alternate&&!lt)return qt(r),null}else 2*sn()-d.renderingStartTime>Bd&&o!==536870912&&(r.flags|=128,p=!0,fc(d,!1),r.lanes=4194304);d.isBackwards?(g.sibling=r.child,r.child=g):(s=d.last,s!==null?s.sibling=g:r.child=g,d.last=g)}if(d.tail!==null){s=d.tail;e:{for(o=s;o!==null;){if(o.alternate!==null){o=!1;break e}o=o.sibling}o=!0}return d.rendering=s,d.tail=s.sibling,d.renderingStartTime=sn(),s.sibling=null,g=Dn.current,g=p?g&1|2:g&1,d.tailMode==="visible"||d.tailMode==="collapsed"||!o||lt?oc(r,g):(o=g,Qe(Ln,r),Qe(Dn,o),Fn===null&&(Fn=r)),lt&&Xi(r,d.treeForkCount),s}return qt(r),null;case 22:case 23:return Ns(r),fp(),d=r.memoizedState!==null,s!==null?s.memoizedState!==null!==d&&(r.flags|=8192):d&&(r.flags|=8192),d?(o&536870912)!==0&&(r.flags&128)===0&&(qt(r),r.subtreeFlags&6&&(r.flags|=8192)):qt(r),o=r.updateQueue,o!==null&&Nd(r,o.retryQueue),o=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(o=s.memoizedState.cachePool.pool),d=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(d=r.memoizedState.cachePool.pool),d!==o&&(r.flags|=2048),s!==null&&wt(Oa),null;case 24:return o=null,s!==null&&(o=s.memoizedState.cache),r.memoizedState.cache!==o&&(r.flags|=2048),Wi(pn),qt(r),null;case 25:return null;case 30:return r.flags|=33554432,qt(r),null}throw Error(i(156,r.tag))}function a3(s,r){switch(Jf(r),r.tag){case 1:return s=r.flags,s&65536?(r.flags=s&-65537|128,r):null;case 3:return Wi(pn),et(),s=r.flags,(s&65536)!==0&&(s&128)===0?(r.flags=s&-65537|128,r):null;case 26:case 27:case 5:return ce(r),null;case 31:if(r.memoizedState!==null){if(Ns(r),r.alternate===null)throw Error(i(340));Ea()}return s=r.flags,s&65536?(r.flags=s&-65537|128,r):null;case 13:if(Ns(r),s=r.memoizedState,s!==null&&s.dehydrated!==null){if(r.alternate===null)throw Error(i(340));Ea()}return s=r.flags,s&65536?(r.flags=s&-65537|128,r):null;case 19:return mp(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 et(),null;case 10:return Wi(r.type),null;case 22:case 23:return Ns(r),fp(),s!==null&&wt(Oa),s=r.flags,s&65536?(r.flags=s&-65537|128,r):null;case 24:return Wi(pn),null;case 25:return null;default:return null}}function gb(s,r){switch(Jf(r),r.tag){case 3:Wi(pn),et();break;case 26:case 27:case 5:ce(r);break;case 4:et();break;case 31:r.memoizedState!==null&&Ns(r);break;case 13:Ns(r);break;case 19:mp(r);break;case 10:Wi(r.type);break;case 22:case 23:Ns(r),fp(),s!==null&&wt(Oa);break;case 24:Wi(pn)}}function pc(s,r){try{var o=r.updateQueue,d=o!==null?o.lastEffect:null;if(d!==null){var p=d.next;o=p;do{if((o.tag&s)===s){d=void 0;var g=o.create,w=o.inst;d=g(),w.destroy=d}o=o.next}while(o!==p)}}catch(T){Mt(r,r.return,T)}}function Br(s,r,o){try{var d=r.updateQueue,p=d!==null?d.lastEffect:null;if(p!==null){var g=p.next;d=g;do{if((d.tag&s)===s){var w=d.inst,T=w.destroy;if(T!==void 0){w.destroy=void 0,p=r;var $=o,ee=T;try{ee()}catch(ae){Mt(p,$,ae)}}}d=d.next}while(d!==g)}}catch(ae){Mt(r,r.return,ae)}}function xb(s){var r=s.updateQueue;if(r!==null){var o=s.stateNode;try{a1(r,o)}catch(d){Mt(s,s.return,d)}}}function vb(s,r,o){o.props=Ba(s.type,s.memoizedProps),o.state=s.memoizedState;try{o.componentWillUnmount()}catch(d){Mt(s,r,d)}}function bi(s,r){try{var o=s.ref;if(o!==null){switch(s.tag){case 26:case 27:case 5:var d=s.stateNode;break;case 30:var p=s.stateNode,g=Vi(s.memoizedProps,p);(p.ref===null||p.ref.name!==g)&&(p.ref=jy(g)),d=p.ref;break;case 7:if(s.stateNode===null){var w=new Ms(s);v(s.child,!1,W3,w,void 0,void 0),s.stateNode=w}d=s.stateNode;break;default:d=s.stateNode}typeof o=="function"?s.refCleanup=o(d):o.current=d}}catch(T){Mt(s,r,T)}}function zn(s,r){var o=s.ref,d=s.refCleanup;if(o!==null)if(typeof d=="function")try{d()}catch(p){Mt(s,r,p)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof o=="function")try{o(null)}catch(p){Mt(s,r,p)}else o.current=null}function Cd(s,r){if((s.tag===5||s.tag===27||s.tag===6)&&s.alternate===null&&r!==null)for(var o=0;o<r.length;o++)My(s.stateNode,r[o])}function bb(s){for(var r=s.return;r!==null&&(Gp(r)&&My(s.stateNode,r.stateNode),!Vp(r));)r=r.return}function mc(s){for(var r=s.return;r!==null&&(Gp(r)&&K3(s.stateNode,r.stateNode),!Vp(r));)r=r.return}function Vp(s){return s.tag===5||s.tag===3||s.tag===27}function Gp(s){return s&&s.tag===7&&s.stateNode!==null}function Yp(s){var r=s.type,o=s.memoizedProps,d=s.stateNode;try{e:switch(r){case"button":case"input":case"select":case"textarea":o.autoFocus&&d.focus();break e;case"img":o.src?d.src=o.src:o.srcSet&&(d.srcset=o.srcSet)}}catch(p){Mt(s,s.return,p)}}function Xp(s,r,o){try{var d=s.stateNode;R3(d,s.type,o,r),d[Cn]=r}catch(p){Mt(s,s.return,p)}}function yb(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&Vr(s.type)||s.tag===4}function Qp(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||yb(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&&Vr(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 Wp(s,r,o,d){var p=s.tag;if(p===5||p===6)p=s.stateNode,r?(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o).insertBefore(p,r):(r=o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,r.appendChild(p),o=o._reactRootContainer,o!=null||r.onclick!==null||(r.onclick=Xn)),Cd(s,d),vt=!0;else if(p!==4&&(p===27&&(Cd(s,d),d=null,Vr(s.type)&&(o=s.stateNode,r=null)),s=s.child,s!==null))for(Wp(s,r,o,d),s=s.sibling;s!==null;)Wp(s,r,o,d),s=s.sibling}function Ed(s,r,o,d){var p=s.tag;if(p===5||p===6)p=s.stateNode,r?o.insertBefore(p,r):o.appendChild(p),Cd(s,d),vt=!0;else if(p!==4&&(p===27&&(Cd(s,d),d=null,Vr(s.type)&&(o=s.stateNode)),s=s.child,s!==null))for(Ed(s,r,o,d),s=s.sibling;s!==null;)Ed(s,r,o,d),s=s.sibling}function _b(s){var r=s.stateNode,o=s.memoizedProps;try{for(var d=s.type,p=r.attributes;p.length;)r.removeAttributeNode(p[0]);$n(r,d,o),r[dn]=s,r[Cn]=o}catch(g){Mt(s,s.return,g)}}var Td=!1,Cs=null;function wb(s){(s.tag===30||(s.subtreeFlags&33554432)!==0)&&(Td=!0)}var yi=null;function Sb(){var s=yi;return yi=null,s}var cs=0;function Al(s,r,o,d,p){return cs=0,kb(s.child,r,o,d,p)}function kb(s,r,o,d,p){for(var g=!1;s!==null;){if(s.tag===5){var w=s.stateNode;if(d!==null){var T=Om(w);d.push(T),T.view&&(g=!0)}else g||Om(w).view&&(g=!0);Td=!0,Sy(w,cs===0?r:r+"_"+cs,o),cs++}else(s.tag!==22||s.memoizedState===null)&&(s.tag===30&&p||kb(s.child,r,o,d,p)&&(g=!0));s=s.sibling}return g}function _i(s,r){for(;s!==null;)s.tag===5?ky(s.stateNode,s.memoizedProps):(s.tag!==22||s.memoizedState===null)&&(s.tag===30&&r||_i(s.child,r)),s=s.sibling}function Ad(s){if((s.subtreeFlags&18874368)!==0)for(s=s.child;s!==null;){if((s.tag!==22||s.memoizedState===null)&&(Ad(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 o=r.name;r=Gi(r.default,r.share),r!=="none"&&(Al(s,o,r,null,!1)||_i(s.child,!1))}s=s.sibling}}function Kp(s,r){if(s.tag===30){var o=s.stateNode,d=s.memoizedProps,p=Vi(d,o),g=Gi(d.default,o.paired?d.share:d.enter);g!=="none"?Al(s,p,g,null,!1)?(Ad(s),o.paired||r||Bl(s,d.onEnter)):_i(s.child,!1):Ad(s)}else if((s.subtreeFlags&33554432)!==0)for(s=s.child;s!==null;)Kp(s,r),s=s.sibling;else Ad(s)}function Zp(s){if(Cs!==null&&Cs.size!==0){var r=Cs;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 o=s.memoizedProps,d=o.name;if(d!=null&&d!=="auto"){var p=r.get(d);if(p!==void 0){var g=Gi(o.default,o.share);if(g!=="none"&&(Al(s,d,g,null,!1)?(g=s.stateNode,p.paired=g,g.paired=p,Bl(s,o.onShare)):_i(s.child,!1)),r.delete(d),r.size===0)break}}}Zp(s)}s=s.sibling}}}function Jp(s){if(s.tag===30){var r=s.memoizedProps,o=Vi(r,s.stateNode),d=Cs!==null?Cs.get(o):void 0,p=Gi(r.default,d!==void 0?r.share:r.exit);p!=="none"&&(Al(s,o,p,null,!1)?d!==void 0?(p=s.stateNode,d.paired=p,p.paired=d,Cs.delete(o),Bl(s,r.onShare)):Bl(s,r.onExit):_i(s.child,!1)),Cs!==null&&Zp(s)}else if((s.subtreeFlags&33554432)!==0)for(s=s.child;s!==null;)Jp(s),s=s.sibling;else Cs!==null&&Zp(s)}function jb(s){for(s=s.child;s!==null;){if(s.tag===30){var r=s.memoizedProps,o=Vi(r,s.stateNode);r=Gi(r.default,r.update),s.flags&=-5,r!=="none"&&Al(s,o,r,s.memoizedState=[],!1)}else(s.subtreeFlags&33554432)!==0&&jb(s);s=s.sibling}}function em(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,_i(s.child,!1))}em(s)}s=s.sibling}}function Md(s){if(s.tag===30)s.stateNode.paired=null,_i(s.child,!1),em(s);else if((s.subtreeFlags&33554432)!==0)for(s=s.child;s!==null;)Md(s),s=s.sibling;else em(s)}function Nb(s){for(s=s.child;s!==null;)s.tag===30?_i(s.child,!1):(s.subtreeFlags&33554432)!==0&&Nb(s),s=s.sibling}function tm(s,r,o,d,p,g,w){for(var T=!1;r!==null;){if(r.tag===5){var $=r.stateNode;if(g!==null&&cs<g.length){var ee=g[cs],ae=Om($);(ee.view||ae.view)&&(T=!0);var pe;if(pe=(s.flags&4)===0)if(ae.clip)pe=!0;else{pe=ee.rect;var Z=ae.rect;pe=pe.y!==Z.y||pe.x!==Z.x||pe.height!==Z.height||pe.width!==Z.width}pe&&(s.flags|=4),ae.abs?ae=!ee.abs:(ee=ee.rect,ae=ae.rect,ae=ee.height!==ae.height||ee.width!==ae.width),ae&&(s.flags|=32)}else s.flags|=32;(s.flags&4)!==0&&Sy($,cs===0?o:o+"_"+cs,p),T&&(s.flags&4)!==0||(yi===null&&(yi=[]),yi.push($,cs===0?d:d+"_"+cs,r.memoizedProps)),cs++}else(r.tag!==22||r.memoizedState===null)&&(r.tag===30&&w?s.flags|=r.flags&32:tm(s,r.child,o,d,p,g,w)&&(T=!0));r=r.sibling}return T}function Cb(s,r){for(s=s.child;s!==null;){if(s.tag===30){var o=s.memoizedProps,d=s.stateNode,p=Vi(o,d),g=Gi(o.default,o.update),w;w=s.memoizedState,s.memoizedState=null,d=s;var T=s.child;cs=0,p=tm(d,T,p,p,g,w,!1),(s.flags&4)!==0&&p&&Bl(s,o.onUpdate)}else(s.subtreeFlags&33554432)!==0&&Cb(s);s=s.sibling}}var Tn=!1,Tt=!1,wi=!1,nm=!1,Eb=typeof WeakSet=="function"?WeakSet:Set,An=null,Si=!1,gc=!1,Rd=!1,sm=!1;function l3(s,r,o){if(s=s.containerInfo,Em=Xl,s=Rv(s),Hf(s)){if("selectionStart"in s)var d={start:s.selectionStart,end:s.selectionEnd};else e:{d=(d=s.ownerDocument)&&d.defaultView||window;var p=d.getSelection&&d.getSelection();if(p&&p.rangeCount!==0){d=p.anchorNode;var g=p.anchorOffset,w=p.focusNode;p=p.focusOffset;try{d.nodeType,w.nodeType}catch{d=null;break e}var T=0,$=-1,ee=-1,ae=0,pe=0,Z=s,ie=null;t:for(;;){for(var Te;Z!==d||g!==0&&Z.nodeType!==3||($=T+g),Z!==w||p!==0&&Z.nodeType!==3||(ee=T+p),Z.nodeType===3&&(T+=Z.nodeValue.length),(Te=Z.firstChild)!==null;)ie=Z,Z=Te;for(;;){if(Z===s)break t;if(ie===d&&++ae===g&&($=T),ie===w&&++pe===p&&(ee=T),(Te=Z.nextSibling)!==null)break;Z=ie,ie=Z.parentNode}Z=Te}d=$===-1||ee===-1?null:{start:$,end:ee}}else d=null}d=d||{start:0,end:0}}else d=null;for(Tm={focusedElem:s,selectionRange:d},Xl=!1,o=(o&335544064)===o,An=r,r=o?9270:1024;An!==null;){if(s=An,o&&(d=s.deletions,d!==null))for(g=0;g<d.length;g++)o&&Jp(d[g]);if(s.alternate===null&&(s.flags&2)!==0)o&&wb(s),Od(o);else{if(s.tag===22){if(d=s.alternate,s.memoizedState!==null){d!==null&&d.memoizedState===null&&o&&Jp(d),Od(o);continue}else if(d!==null&&d.memoizedState!==null){o&&wb(s),Od(o);continue}}d=s.child,(s.subtreeFlags&r)!==0&&d!==null?(d.return=s,An=d):(o&&jb(s),Od(o))}}Cs=null}function Od(s){for(;An!==null;){var r=An,o=s,d=r.alternate,p=r.flags;switch(r.tag){case 0:case 11:case 15:break;case 1:if((p&1024)!==0&&d!==null){o=void 0,p=d.memoizedProps,d=d.memoizedState;var g=r.stateNode;try{var w=Ba(r.type,p);o=g.getSnapshotBeforeUpdate(w,d),g.__reactInternalSnapshotBeforeUpdate=o}catch(T){Mt(r,r.return,T)}}break;case 3:if((p&1024)!==0){if(d=r.stateNode.containerInfo,o=d.nodeType,o===9)zm(d);else if(o===1)switch(d.nodeName){case"HEAD":case"HTML":case"BODY":zm(d);break;default:d.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:o&&d!==null&&(o=Vi(d.memoizedProps,d.stateNode),p=r.memoizedProps,p=Gi(p.default,p.update),p!=="none"&&Al(d,o,p,d.memoizedState=[],!0));break;default:if((p&1024)!==0)throw Error(i(163))}if(d=r.sibling,d!==null){d.return=r.return,An=d;break}An=r.return}}function Tb(s,r,o){var d=o.flags;switch(o.tag){case 0:case 11:case 15:ki(s,o),d&4&&pc(5,o);break;case 1:if(ki(s,o),d&4)if(s=o.stateNode,r===null)try{s.componentDidMount()}catch(w){Mt(o,o.return,w)}else{var p=Ba(o.type,r.memoizedProps);r=r.memoizedState;try{s.componentDidUpdate(p,r,s.__reactInternalSnapshotBeforeUpdate)}catch(w){Mt(o,o.return,w)}}d&64&&xb(o),d&512&&bi(o,o.return);break;case 3:if(ki(s,o),d&64&&(s=o.updateQueue,s!==null)){if(r=null,o.child!==null)switch(o.child.tag){case 27:case 5:r=o.child.stateNode;break;case 1:r=o.child.stateNode}try{a1(s,r)}catch(w){Mt(o,o.return,w)}}break;case 27:r===null&&d&4&&_b(o);case 26:case 5:ki(s,o),r===null&&d&4&&Yp(o),d&512&&bi(o,o.return);break;case 12:ki(s,o);break;case 31:ki(s,o),d&4&&Ob(s,o);break;case 13:ki(s,o),d&4&&Lb(s,o),d&64&&(s=o.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(o=b3.bind(null,o),eE(s,o))));break;case 22:if(d=o.memoizedState!==null||Tn,!d){var g=r!==null&&r.memoizedState!==null||Tt;r=Tn,p=Tt,Tn=d,(Tt=g)&&!p?(d=2,(o.subtreeFlags&8772)!==0&&(d|=1),ii(s,o,d)):ki(s,o),Tn=r,Tt=p}break;case 30:ki(s,o),d&512&&bi(o,o.return);break;case 7:d&512&&bi(o,o.return);default:ki(s,o)}}function im(s,r){for(s=s.child;s!==null;)Ab(s,r),s=s.sibling}function Ab(s,r){switch(s.tag){case 5:case 26:try{var o=s.stateNode;if(r){var d=o.style;typeof d.setProperty=="function"?d.setProperty("display","none","important"):d.display="none"}else{var p=s.stateNode,g=s.memoizedProps.style,w=g!=null&&g.hasOwnProperty("display")?g.display:null;p.style.display=w==null||typeof w=="boolean"?"":(""+w).trim()}}catch($){Mt(s,s.return,$)}rm(s,r);break;case 6:try{s.stateNode.nodeValue=r?"":s.memoizedProps,vt=!0}catch($){Mt(s,s.return,$)}break;case 18:try{var T=s.stateNode;r?wy(T,!0):wy(s.stateNode,!1)}catch($){Mt(s,s.return,$)}break;case 22:case 23:s.memoizedState===null&&im(s,r);break;default:im(s,r)}}function rm(s,r){if(s.subtreeFlags&67108864)for(s=s.child;s!==null;){e:{var o=s,d=r;switch(o.tag){case 4:Ab(o,d);break e;case 22:o.memoizedState===null&&rm(o,d);break e;default:rm(o,d)}}s=s.sibling}}function Mb(s){var r=s.alternate;r!==null&&(s.alternate=null,Mb(r)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(r=s.stateNode,r!==null&&ul(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 Kt=null,us=!1;function ni(s,r,o){for(o=o.child;o!==null;)Rb(s,r,o),o=o.sibling}function Rb(s,r,o){if(xt&&typeof xt.onCommitFiberUnmount=="function")try{xt.onCommitFiberUnmount(Nn,o)}catch{}switch(o.tag){case 26:Tt||zn(o,r),ni(s,r,o),o.memoizedState?o.memoizedState.count--:o.stateNode&&!Tt&&(o=o.stateNode,o.parentNode.removeChild(o));break;case 27:Tt||zn(o,r),mc(o);var d=Kt,p=us;Vr(o.type)&&(Kt=o.stateNode,us=!1),ni(s,r,o),zy(o.stateNode,o.type,o.memoizedProps),Kt=d,us=p;break;case 5:Tt||zn(o,r),mc(o);case 6:if(o.tag===6&&mc(o),d=Kt,p=us,Kt=null,ni(s,r,o),Kt=d,us=p,Kt!==null)if(us)try{(Kt.nodeType===9?Kt.body:Kt.nodeName==="HTML"?Kt.ownerDocument.body:Kt).removeChild(o.stateNode),vt=!0}catch(g){Mt(o,r,g)}else try{Kt.removeChild(o.stateNode),vt=!0}catch(g){Mt(o,r,g)}break;case 18:Kt!==null&&(us?(s=Kt,_y(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,o.stateNode),Ql(s)):_y(Kt,o.stateNode));break;case 4:d=Kt,p=us,Kt=o.stateNode.containerInfo,us=!0,ni(s,r,o),Kt=d,us=p;break;case 0:case 11:case 14:case 15:Br(2,o,r),Tt||Br(4,o,r),ni(s,r,o);break;case 1:Tt||(zn(o,r),d=o.stateNode,typeof d.componentWillUnmount=="function"&&vb(o,r,d)),ni(s,r,o);break;case 21:ni(s,r,o);break;case 22:Tt=(d=Tt)||o.memoizedState!==null,ni(s,r,o),Tt=d;break;case 30:zn(o,r),ni(s,r,o);break;case 7:Tt||zn(o,r),ni(s,r,o);break;default:ni(s,r,o)}}function Ob(s,r){if(r.memoizedState===null&&(s=r.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{Ql(s)}catch(o){Mt(r,r.return,o)}}}function Lb(s,r){if(r.memoizedState===null&&(s=r.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{Ql(s)}catch(o){Mt(r,r.return,o)}}function o3(s){switch(s.tag){case 31:case 13:case 19:var r=s.stateNode;return r===null&&(r=s.stateNode=new Eb),r;case 22:return s=s.stateNode,r=s._retryCache,r===null&&(r=s._retryCache=new Eb),r;default:throw Error(i(435,s.tag))}}function Ld(s,r){var o=o3(s);r.forEach(function(d){if(!o.has(d)){o.add(d);var p=y3.bind(null,s,d);d.then(p,p)}})}function Kn(s,r,o){var d=r.deletions;if(d!==null)for(var p=0;p<d.length;p++){var g=d[p],w=s,T=r,$=T;e:for(;$!==null;){switch($.tag){case 27:if(Vr($.type)){Kt=$.stateNode,us=!1;break e}break;case 5:Kt=$.stateNode,us=!1;break e;case 3:case 4:Kt=$.stateNode.containerInfo,us=!0;break e}$=$.return}if(Kt===null)throw Error(i(160));Rb(w,T,g),Kt=null,us=!1,w=g.alternate,w!==null&&(w.return=null),g.return=null}if(r.subtreeFlags&13886)for(r=r.child;r!==null;)Db(r,s,o),r=r.sibling}var si=null;function Db(s,r,o){var d=s.alternate,p=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:if(p&4&&(d=s.updateQueue,d=d!==null?d.events:null,d!==null))for(var g=0;g<d.length;g++){var w=d[g];w.ref.impl=w.nextImpl}Kn(r,s,o),Zn(s),p&4&&(Br(3,s,s.return),pc(3,s),Br(5,s,s.return));break;case 1:Kn(r,s,o),Zn(s),p&512&&(Tt||d===null||zn(d,d.return)),p&64&&Tn&&(s=s.updateQueue,s!==null&&(r=s.callbacks,r!==null&&(o=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=o===null?r:o.concat(r))));break;case 26:if(g=si,Kn(r,s,o),Zn(s),p&512&&(Tt||d===null||zn(d,d.return)),p&4)if(p=d!==null?d.memoizedState:null,o=s.memoizedState,d===null)if(o===null)if(s.stateNode===null)if(Tn)s.stateNode=vy(s.type,s.memoizedProps,r.containerInfo,s);else{e:{r=s.type,o=s.memoizedProps,p=g.ownerDocument||g;t:switch(r){case"title":d=p.getElementsByTagName("title")[0],(!d||d[ya]||d[dn]||d.namespaceURI==="http://www.w3.org/2000/svg"||d.hasAttribute("itemprop"))&&(d=p.createElement(r),p.head.insertBefore(d,p.querySelector("head > title"))),$n(d,r,o),d[dn]=s,ln(d),r=d;break e;case"link":if(g=Uy("link","href",p).get(r+(o.href||""))){for(w=0;w<g.length;w++)if(d=g[w],d.getAttribute("href")===(o.href==null||o.href===""?null:o.href)&&d.getAttribute("rel")===(o.rel==null?null:o.rel)&&d.getAttribute("title")===(o.title==null?null:o.title)&&d.getAttribute("crossorigin")===(o.crossOrigin==null?null:o.crossOrigin)){g.splice(w,1);break t}}d=p.createElement(r),$n(d,r,o),p.head.appendChild(d);break;case"meta":if(g=Uy("meta","content",p).get(r+(o.content||""))){for(w=0;w<g.length;w++)if(d=g[w],d.getAttribute("content")===(o.content==null?null:""+o.content)&&d.getAttribute("name")===(o.name==null?null:o.name)&&d.getAttribute("property")===(o.property==null?null:o.property)&&d.getAttribute("http-equiv")===(o.httpEquiv==null?null:o.httpEquiv)&&d.getAttribute("charset")===(o.charSet==null?null:o.charSet)){g.splice(w,1);break t}}d=p.createElement(r),$n(d,r,o),p.head.appendChild(d);break;default:throw Error(i(468,r))}d[dn]=s,ln(d),r=d}s.stateNode=r}else Tn||Hm(g,s.type,s.stateNode);else s.stateNode=Fy(g,o,s.memoizedProps);else p!==o?(p===null?(r=d.stateNode,r===null||Tt||r.parentNode.removeChild(r)):p.count--,o===null?Tn||Hm(g,s.type,s.stateNode):Fy(g,o,s.memoizedProps)):o===null&&s.stateNode!==null&&Xp(s,s.memoizedProps,d.memoizedProps);break;case 27:Kn(r,s,o),Zn(s),p&512&&(Tt||d===null||zn(d,d.return)),d!==null&&p&4&&Xp(s,s.memoizedProps,d.memoizedProps);break;case 5:if(g=wi,wi=!1,Kn(r,s,o),wi=g,Zn(s),p&512&&(Tt||d===null||zn(d,d.return)),s.flags&32){r=s.stateNode;try{qi(r,""),vt=!0}catch(ae){Mt(s,s.return,ae)}}p&4&&s.stateNode!=null&&(r=s.memoizedProps,Xp(s,r,d!==null?d.memoizedProps:r)),p&1024&&(nm=!0);break;case 6:if(Kn(r,s,o),Zn(s),p&4){if(s.stateNode===null)throw Error(i(162));r=s.memoizedProps,o=s.stateNode;try{o.nodeValue=r,vt=!0}catch(ae){Mt(s,s.return,ae)}}break;case 3:if(vt=!1,Qd=null,g=si,si=jc(r.containerInfo),Kn(r,s,o),si=g,Zn(s),p&4&&d!==null&&d.memoizedState.isDehydrated)try{Ql(r.containerInfo)}catch(ae){Mt(s,s.return,ae)}nm&&(nm=!1,zb(s)),vt=!1;break;case 4:p=wi,wi=Tn,d=Pu(),g=si,si=jc(s.stateNode.containerInfo),Kn(r,s,o),Zn(s),si=g,vt&&gc&&(Rd=!0),vt=d,wi=p;break;case 12:Kn(r,s,o),Zn(s);break;case 31:Kn(r,s,o),Zn(s),p&4&&(r=s.updateQueue,r!==null&&(s.updateQueue=null,Ld(s,r)));break;case 13:Kn(r,s,o),Zn(s),s.child.flags&8192&&s.memoizedState!==null!=(d!==null&&d.memoizedState!==null)&&($d=sn()),p&4&&(r=s.updateQueue,r!==null&&(s.updateQueue=null,Ld(s,r)));break;case 22:g=s.memoizedState!==null,w=d!==null&&d.memoizedState!==null;var T=Tn,$=Tt,ee=wi;Tn=T||g,wi=ee||g,Tt=$||w,Kn(r,s,o),Tt=$,wi=ee,Tn=T,Zn(s),p&8192&&(r=s.stateNode,r._visibility=g?r._visibility&-2:r._visibility|1,!g||d===null||w||Tn||Tt||(r=w||Tt,o=Tn,d=Tt,Tn=g||Tn,Tt=r,Pr(s,2),Tn=o,Tt=d),!g&&wi||im(s,g)),p&4&&(r=s.updateQueue,r!==null&&(o=r.retryQueue,o!==null&&(r.retryQueue=null,Ld(s,o))));break;case 19:Kn(r,s,o),Zn(s),p&4&&(r=s.updateQueue,r!==null&&(s.updateQueue=null,Ld(s,r)));break;case 30:p&512&&(Tt||d===null||zn(d,d.return)),p=Pu(),g=gc,w=(o&335544064)===o,T=s.memoizedProps,gc=w&&Gi(T.default,T.update)!=="none",Kn(r,s,o),Zn(s),w&&d!==null&&vt&&(s.flags|=4),gc=g,vt=p;break;case 21:break;case 7:p&512&&(Tt||d===null||zn(d,d.return)),d&&d.stateNode!==null&&(d.stateNode._fragmentFiber=s);default:Kn(r,s,o),Zn(s)}}function Zn(s){var r=s.flags;if(r&2){try{for(var o,d=s.return;d!==null;){if(yb(d)){o=d;break}d=d.return}d=null;for(var p=s.return;p!==null;){if(Gp(p)){var g=p.stateNode;d===null?d=[g]:d.push(g)}if(Vp(p))break;p=p.return}var w=d;if(o==null)throw Error(i(160));switch(o.tag){case 27:var T=o.stateNode,$=Qp(s);Ed(s,$,T,w);break;case 5:var ee=o.stateNode;o.flags&32&&(qi(ee,""),o.flags&=-33);var ae=Qp(s);Ed(s,ae,ee,w);break;case 3:case 4:var pe=o.stateNode.containerInfo,Z=Qp(s);Wp(s,Z,pe,w);break;default:throw Error(i(161))}}catch(ie){Mt(s,s.return,ie)}s.flags&=-3}r&4096&&(s.flags&=-4097)}function zb(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var r=s;zb(r),r.tag===5&&r.flags&1024&&(r=r.stateNode,Xl=!0,r.reset(),Xl=!1),s=s.sibling}}function Ml(s,r){if(r.subtreeFlags&9270)for(r=r.child;r!==null;)$b(r,s),r=r.sibling;else Cb(r)}function $b(s,r){var o=s.alternate;if(o===null)Kp(s,!1);else switch(s.tag){case 3:if(sm=Si=!1,Sb(),Ml(r,s),!Si&&!Rd){if(s=yi,s!==null)for(var d=0;d<s.length;d+=3){o=s[d];var p=s[d+1];ky(o,s[d+2]),o=o.ownerDocument.documentElement,o!==null&&o.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group("+p+")"})}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"})),sm=!0}yi=null;break;case 5:Ml(r,s);break;case 4:d=Si,Si=!1,Ml(r,s),Si&&(Rd=!0),Si=d;break;case 22:s.memoizedState===null&&(o.memoizedState!==null?Kp(s,!1):Ml(r,s));break;case 30:d=Si,p=Sb(),Si=!1,Ml(r,s),Si&&(s.flags|=4);var g=s.memoizedProps,w=s.stateNode;r=Vi(g,w),w=Vi(o.memoizedProps,w);var T=Gi(g.default,g.update);T==="none"?r=!1:(g=o.memoizedState,o.memoizedState=null,o=s.child,cs=0,r=tm(s,o,r,w,T,g,!0),cs!==(g===null?0:g.length)&&(s.flags|=32)),(s.flags&4)!==0&&r?(Bl(s,s.memoizedProps.onUpdate),yi=p):p!==null&&(p.push.apply(p,yi),yi=p),Si=(s.flags&32)!==0?!0:d;break;default:Ml(r,s)}}function ki(s,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)Tb(s,r.alternate,r),r=r.sibling}function Pr(s,r){for(s=s.child;s!==null;){var o=s,d=r;switch(o.tag){case 0:case 11:case 14:case 15:Br(4,o,o.return),Pr(o,d);break;case 1:zn(o,o.return);var p=o.stateNode;typeof p.componentWillUnmount=="function"&&vb(o,o.return,p),Pr(o,d);break;case 27:(d&2)!==0&&zy(o.stateNode,o.type,o.memoizedProps);case 5:zn(o,o.return),o.tag!==5&&o.tag!==27||mc(o),Pr(o,d);break;case 6:mc(o);break;case 26:zn(o,o.return),p=o.stateNode,o.memoizedState!==null||p===null||Tt||p.parentNode.removeChild(p),Pr(o,d);break;case 22:o.memoizedState===null&&Pr(o,d);break;case 30:zn(o,o.return),Pr(o,d);break;case 7:zn(o,o.return);default:Pr(o,d)}s=s.sibling}}function ii(s,r,o){for(o=(r.subtreeFlags&8772)!==0?o:o&-2,r=r.child;r!==null;){var d=r.alternate,p=s,g=r,w=g.flags,T=(o&1)!==0;switch(g.tag){case 0:case 11:case 15:ii(p,g,o),pc(4,g);break;case 1:if(ii(p,g,o),d=g,p=d.stateNode,typeof p.componentDidMount=="function")try{p.componentDidMount()}catch(ae){Mt(d,d.return,ae)}if(d=g,p=d.updateQueue,p!==null){var $=d.stateNode;try{var ee=p.shared.hiddenCallbacks;if(ee!==null)for(p.shared.hiddenCallbacks=null,p=0;p<ee.length;p++)r1(ee[p],$)}catch(ae){Mt(d,d.return,ae)}}T&&w&64&&xb(g),bi(g,g.return);break;case 27:(o&2)!==0&&_b(g);case 5:g.tag!==5&&g.tag!==27||bb(g),ii(p,g,o),T&&d===null&&w&4&&Yp(g),bi(g,g.return);break;case 6:bb(g);break;case 26:$=g.stateNode,g.memoizedState!==null||$===null||Tn||Hm(jc($.ownerDocument),g.type,$),ii(p,g,o),T&&d===null&&w&4&&Yp(g),bi(g,g.return);break;case 12:ii(p,g,o);break;case 31:ii(p,g,o),T&&w&4&&Ob(p,g);break;case 13:ii(p,g,o),T&&w&4&&Lb(p,g);break;case 22:g.memoizedState===null&&ii(p,g,o),bi(g,g.return);break;case 30:ii(p,g,o),bi(g,g.return);break;case 7:bi(g,g.return);default:ii(p,g,o)}r=r.sibling}}function am(s,r){var o=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(o=s.memoizedState.cachePool.pool),s=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(s=r.memoizedState.cachePool.pool),s!==o&&(s!=null&&s.refCount++,o!=null&&tc(o))}function lm(s,r){s=null,r.alternate!==null&&(s=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==s&&(r.refCount++,s!=null&&tc(s))}function Fs(s,r,o,d){var p=(o&335544064)===o;if(r.subtreeFlags&(p?10262:10256))for(r=r.child;r!==null;)Bb(s,r,o,d),r=r.sibling;else p&&Nb(r)}function Bb(s,r,o,d){var p=(o&335544064)===o;p&&r.alternate===null&&r.return!==null&&r.return.alternate!==null&&Md(r);var g=r.flags;switch(r.tag){case 0:case 11:case 15:Fs(s,r,o,d),g&2048&&pc(9,r);break;case 1:Fs(s,r,o,d);break;case 3:Fs(s,r,o,d),p&&sm&&(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="")),g&2048&&(g=null,r.alternate!==null&&(g=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==g&&(r.refCount++,g!=null&&tc(g)));break;case 12:if(g&2048){Fs(s,r,o,d),g=r.stateNode;try{var w=r.memoizedProps,T=w.id,$=w.onPostCommit;typeof $=="function"&&$(T,r.alternate===null?"mount":"update",g.passiveEffectDuration,-0)}catch(ee){Mt(r,r.return,ee)}}else Fs(s,r,o,d);break;case 31:Fs(s,r,o,d);break;case 13:Fs(s,r,o,d);break;case 23:break;case 22:w=r.stateNode,T=r.alternate,r.memoizedState!==null?(p&&T!==null&&T.memoizedState===null&&Md(T),w._visibility&2?Fs(s,r,o,d):xc(s,r)):(p&&T!==null&&T.memoizedState!==null&&Md(r),w._visibility&2?Fs(s,r,o,d):(w._visibility|=2,Rl(s,r,o,d,(r.subtreeFlags&10256)!==0||!1))),g&2048&&am(T,r);break;case 24:Fs(s,r,o,d),g&2048&&lm(r.alternate,r);break;case 30:p&&(g=r.alternate,g!==null&&(_i(g.child,!0),_i(r.child,!0))),Fs(s,r,o,d);break;default:Fs(s,r,o,d)}}function Rl(s,r,o,d,p){for(p=p&&((r.subtreeFlags&10256)!==0||!1),r=r.child;r!==null;){var g=s,w=r,T=o,$=d,ee=w.flags;switch(w.tag){case 0:case 11:case 15:Rl(g,w,T,$,p),pc(8,w);break;case 23:break;case 22:var ae=w.stateNode;w.memoizedState!==null?ae._visibility&2?Rl(g,w,T,$,p):xc(g,w):(ae._visibility|=2,Rl(g,w,T,$,p)),p&&ee&2048&&am(w.alternate,w);break;case 24:Rl(g,w,T,$,p),p&&ee&2048&&lm(w.alternate,w);break;default:Rl(g,w,T,$,p)}r=r.sibling}}function xc(s,r){if(r.subtreeFlags&10256)for(r=r.child;r!==null;){var o=s,d=r,p=d.flags;switch(d.tag){case 22:xc(o,d),p&2048&&am(d.alternate,d);break;case 24:xc(o,d),p&2048&&lm(d.alternate,d);break;default:xc(o,d)}r=r.sibling}}var Pa=8192;function Ia(s,r,o){if(s.subtreeFlags&Pa)for(s=s.child;s!==null;)Pb(s,r,o),s=s.sibling}function Pb(s,r,o){switch(s.tag){case 26:Ia(s,r,o),s.flags&Pa&&(s.memoizedState!==null?pE(o,si,s.memoizedState,s.memoizedProps):(s=s.stateNode,(r&335544128)===r&&Gy(o,s)));break;case 5:Ia(s,r,o),s.flags&Pa&&(s=s.stateNode,(r&335544128)===r&&Gy(o,s));break;case 3:case 4:var d=si;si=jc(s.stateNode.containerInfo),Ia(s,r,o),si=d;break;case 22:s.memoizedState===null&&(d=s.alternate,d!==null&&d.memoizedState!==null?(d=Pa,Pa=16777216,Ia(s,r,o),Pa=d):Ia(s,r,o));break;case 30:if((s.flags&Pa)!==0&&(d=s.memoizedProps.name,d!=null&&d!=="auto")){var p=s.stateNode;p.paired=null,Cs===null&&(Cs=new Map),Cs.set(d,p)}Ia(s,r,o);break;default:Ia(s,r,o)}}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 vc(s){var r=s.deletions;if((s.flags&16)!==0){if(r!==null)for(var o=0;o<r.length;o++){var d=r[o];An=d,Ub(d,s)}Ib(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)Fb(s),s=s.sibling}function Fb(s){switch(s.tag){case 0:case 11:case 15:vc(s),s.flags&2048&&Br(9,s,s.return);break;case 3:vc(s);break;case 12:vc(s);break;case 22:var r=s.stateNode;s.memoizedState!==null&&r._visibility&2&&(s.return===null||s.return.tag!==13)?(r._visibility&=-3,Dd(s)):vc(s);break;default:vc(s)}}function Dd(s){var r=s.deletions;if((s.flags&16)!==0){if(r!==null)for(var o=0;o<r.length;o++){var d=r[o];An=d,Ub(d,s)}Ib(s)}for(s=s.child;s!==null;){switch(r=s,r.tag){case 0:case 11:case 15:Br(8,r,r.return),Dd(r);break;case 22:o=r.stateNode,o._visibility&2&&(o._visibility&=-3,Dd(r));break;default:Dd(r)}s=s.sibling}}function Ub(s,r){for(;An!==null;){var o=An;switch(o.tag){case 0:case 11:case 15:Br(8,o,r);break;case 23:case 22:if(o.memoizedState!==null&&o.memoizedState.cachePool!==null){var d=o.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:tc(o.memoizedState.cache)}if(d=o.child,d!==null)d.return=o,An=d;else e:for(o=s;An!==null;){d=An;var p=d.sibling,g=d.return;if(Mb(d),d===o){An=null;break e}if(p!==null){p.return=g,An=p;break e}An=g}}}var c3={getCacheForType:function(s){var r=On(pn),o=r.data.get(s);return o===void 0&&(o=s(),r.data.set(s,o)),o},cacheSignal:function(){return On(pn).controller.signal}},u3=typeof WeakMap=="function"?WeakMap:Map,Et=0,zt=null,ct=null,ft=0,At=0,Es=null,Ir=!1,Ol=!1,om=!1,tr=0,cn=0,Fr=0,Fa=0,zd=0,Ts=0,Ll=0,bc=null,ds=null,cm=!1,$d=0,Hb=0,Bd=1/0,Pd=null,Ur=null,tn=0,ri=null,Ua=null,ji=0,um=0,dm=null,qb=null,Dl=null,zl=null,$l=null,yc=0,Id=null;function As(){return(Et&2)!==0&&ft!==0?ft&-ft:Ce.T!==null?_m():ba()}function Vb(){if(Ts===0)if((ft&536870912)===0||lt){var s=ma;ma<<=1,(ma&3932160)===0&&(ma=262144),Ts=s}else Ts=536870912;return s=Ln.current,s!==null&&(s.flags|=32),Ts}function Bl(s,r){if(r!=null){var o=s.stateNode,d=o.ref;d===null&&(d=o.ref=jy(Vi(s.memoizedProps,o))),zl===null&&(zl=[]),zl.push(r.bind(null,d))}}function hs(s,r,o){(s===zt&&(At===2||At===9)||s.cancelPendingCommit!==null)&&(Pl(s,0),Hr(s,ft,Ts,!1)),fi(s,o),((Et&2)===0||s!==zt)&&(s===zt&&((Et&2)===0&&(Fa|=o),cn===4&&Hr(s,ft,Ts,!1)),Ni(s))}function Gb(s,r,o){if((Et&6)!==0)throw Error(i(327));var d=!o&&(r&127)===0&&(r&s.expiredLanes)===0||br(s,r),p=d?f3(s,r):fm(s,r,!0),g=d;do{if(p===0){Ol&&!d&&Hr(s,r,0,!1);break}else{if(o=s.current.alternate,g&&!d3(o)){p=fm(s,r,!1),g=!1;continue}if(p===2){if(g=r,s.errorRecoveryDisabledLanes&g)var w=0;else w=s.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){r=w;e:{var T=s;p=bc;var $=T.current.memoizedState.isDehydrated;if($&&(Pl(T,w).flags|=256),w=fm(T,w,!1),w!==2&&w!==6){if(om&&!$){T.errorRecoveryDisabledLanes|=g,Fa|=g,p=4;break e}g=ds,ds=p,g!==null&&(ds===null?ds=g:ds.push.apply(ds,g))}p=w}if(g=!1,p!==2)continue}}if(p===1){Pl(s,0),Hr(s,r,0,!0);break}e:{switch(d=s,g=p,g){case 0:case 1:throw Error(i(345));case 4:if((r&4194048)!==r&&(r&62914560)!==r)break;case 6:Hr(d,r,Ts,!Ir);break e;case 2:ds=null;break;case 3:case 5:break;default:throw Error(i(329))}if((r&62914560)===r&&(p=$d+300-sn(),10<p)){if(Hr(d,r,Ts,!Ir),Ws(d,0,!0)!==0)break e;ji=r,d.timeoutHandle=Rm(Yb.bind(null,d,o,ds,Pd,cm,r,Ts,Fa,Ll,Ir,g,"Throttled",-0,0),p);break e}Yb(d,o,ds,Pd,cm,r,Ts,Fa,Ll,Ir,g,null,-0,0)}}break}while(!0);Ni(s)}function Yb(s,r,o,d,p,g,w,T,$,ee,ae,pe,Z,ie){s.timeoutHandle=-1;var Te=r.subtreeFlags,Be=(g&335544064)===g;if(pe=null,(Be||Te&8192||(Te&16785408)===16785408)&&(pe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Xn},Cs=null,Pb(r,g,pe),Be&&(Te=pe,Be=s.containerInfo,Be=(Be.nodeType===9?Be:Be.ownerDocument).__reactViewTransition,Be!=null&&(Te.count++,Te.waitingForViewTransition=!0,Te=Ec.bind(Te),Be.finished.then(Te,Te))),Te=(g&62914560)===g?$d-sn():(g&4194048)===g?Hb-sn():0,Te=mE(pe,Te),Te!==null)){ji=g,s.cancelPendingCommit=Te(ty.bind(null,s,r,g,o,d,p,w,T,$,ee,ae,pe,null,Z,ie)),Hr(s,g,w,!ee);return}ty(s,r,g,o,d,p,w,T,$,ee,ae,pe)}function d3(s){for(var r=s;;){var o=r.tag;if((o===0||o===11||o===15)&&r.flags&16384&&(o=r.updateQueue,o!==null&&(o=o.stores,o!==null)))for(var d=0;d<o.length;d++){var p=o[d],g=p.getSnapshot;p=p.value;try{if(!js(g(),p))return!1}catch{return!1}}if(o=r.child,r.subtreeFlags&16384&&o!==null)o.return=r,r=o;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 Hr(s,r,o,d){r=Pi(s,r),r&=~zd,r&=~Fa,s.suspendedLanes|=r,s.pingedLanes&=~r,d&&(s.warmLanes|=r),d=s.expirationTimes;for(var p=r;0<p;){var g=31-en(p),w=1<<g;d[g]=-1,p&=~w}o!==0&&xa(s,o,r)}function Fd(){return(Et&6)===0?(_c(0),!1):!0}function hm(){if(ct!==null){if(At===0)var s=ct.return;else s=ct,Qi=Ta=null,yp(s),jl=null,ic=0,s=ct;for(;s!==null;)gb(s.alternate,s),s=s.return;ct=null}}function Pl(s,r){var o=s.timeoutHandle;return o!==-1&&(s.timeoutHandle=-1,D3(o)),o=s.cancelPendingCommit,o!==null&&(s.cancelPendingCommit=null,o()),ji=0,hm(),zt=s,ct=o=Yi(s.current,null),ft=r,At=0,Es=null,Ir=!1,Ol=br(s,r),om=!1,Ll=Ts=zd=Fa=Fr=cn=0,ds=bc=null,cm=!1,tr=Pi(s,r),Qu(),o}function Xb(s,r){tt=null,Ce.H=yd,r===kl||r===ad?(r=t1(),At=3):r===lp?(r=t1(),At=4):At=r===Dp?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,Es=r,ct===null&&(cn=1,_d(s,$s(r,s.current)))}function Qb(){var s=Ln.current;return s===null?!0:(ft&4194048)===ft?Fn===null:(ft&62914560)===ft||(ft&536870912)!==0?s===Fn:!1}function Wb(){var s=Ce.H;return Ce.H=yd,s===null?yd:s}function Kb(){var s=Ce.A;return Ce.A=c3,s}function Ud(){cn=4,Ir||(ft&4194048)!==ft&&Ln.current!==null||(Ol=!0),(Fr&134217727)===0&&(Fa&134217727)===0||zt===null||Hr(zt,ft,Ts,!1)}function fm(s,r,o){var d=Et;Et|=2;var p=Wb(),g=Kb();(zt!==s||ft!==r)&&(Pd=null,Pl(s,r)),r=!1;var w=cn;e:do try{if(At!==0&&ct!==null){var T=ct,$=Es;switch(At){case 8:hm(),w=6;break e;case 3:case 2:case 9:case 6:Ln.current===null&&(r=!0);var ee=At;if(At=0,Es=null,Il(s,T,$,ee),o&&Ol){w=0;break e}break;default:ee=At,At=0,Es=null,Il(s,T,$,ee)}}h3(),w=cn;break}catch(ae){Xb(s,ae)}while(!0);return r&&s.shellSuspendCounter++,Qi=Ta=null,Et=d,Ce.H=p,Ce.A=g,ct===null&&(zt=null,ft=0,Qu()),w}function h3(){for(;ct!==null;)Zb(ct)}function f3(s,r){var o=Et;Et|=2;var d=Wb(),p=Kb();zt!==s||ft!==r?(Pd=null,Bd=sn()+500,Pl(s,r)):Ol=br(s,r);e:do try{if(At!==0&&ct!==null){r=ct;var g=Es;t:switch(At){case 1:At=0,Es=null,Il(s,r,g,1);break;case 2:case 9:if(Jv(g)){At=0,Es=null,Jb(r);break}r=function(){At!==2&&At!==9||zt!==s||(At=7),Ni(s)},g.then(r,r);break e;case 3:At=7;break e;case 4:At=5;break e;case 7:Jv(g)?(At=0,Es=null,Jb(r)):(At=0,Es=null,Il(s,r,g,7));break;case 5:var w=null;switch(ct.tag){case 26:w=ct.memoizedState;case 5:case 27:var T=ct;if(w?qy(w):T.stateNode.complete){At=0,Es=null;var $=T.sibling;if($!==null)ct=$;else{var ee=T.return;ee!==null?(ct=ee,Hd(ee)):ct=null}break t}}At=0,Es=null,Il(s,r,g,5);break;case 6:At=0,Es=null,Il(s,r,g,6);break;case 8:hm(),cn=6;break e;default:throw Error(i(462))}}p3();break}catch(ae){Xb(s,ae)}while(!0);return Qi=Ta=null,Ce.H=d,Ce.A=p,Et=o,ct!==null?0:(zt=null,ft=0,Qu(),cn)}function p3(){for(;ct!==null&&!vs();)Zb(ct)}function Zb(s){var r=pb(s.alternate,s,tr);s.memoizedProps=s.pendingProps,r===null?Hd(s):ct=r}function Jb(s){var r=s,o=r.alternate;switch(r.tag){case 15:case 0:r=lb(o,r,r.pendingProps,r.type,void 0,ft);break;case 11:r=lb(o,r,r.pendingProps,r.type.render,r.ref,ft);break;case 5:yp(r);var d=r;d===En&&(lt?(td(d),d.tag===5&&d.stateNode!=null&&(Ht=d.stateNode)):(td(d),lt=!0));default:gb(o,r),r=ct=Uv(r,tr),r=pb(o,r,tr)}s.memoizedProps=s.pendingProps,r===null?Hd(s):ct=r}function Il(s,r,o,d){Qi=Ta=null,yp(r),jl=null,ic=0;var p=r.return;try{if(t3(s,p,r,o,ft)){cn=1,_d(s,$s(o,s.current)),ct=null;return}}catch(g){if(p!==null)throw ct=p,g;cn=1,_d(s,$s(o,s.current)),ct=null;return}r.flags&32768?(lt||d===1?s=!0:Ol||(ft&536870912)!==0?s=!1:(Ir=s=!0,(d===2||d===9||d===3||d===6)&&(d=Ln.current,d!==null&&d.tag===13&&(d.flags|=16384))),ey(r,s)):Hd(r)}function Hd(s){var r=s;do{if((r.flags&32768)!==0){ey(r,Ir);return}s=r.return;var o=r3(r.alternate,r,tr);if(o!==null){ct=o;return}if(r=r.sibling,r!==null){ct=r;return}ct=r=s}while(r!==null);cn===0&&(cn=5)}function ey(s,r){do{var o=a3(s.alternate,s);if(o!==null){o.flags&=32767,ct=o;return}if(o=s.return,o!==null&&(o.flags|=32768,o.subtreeFlags=0,o.deletions=null),!r&&(s=s.sibling,s!==null)){ct=s;return}ct=s=o}while(s!==null);cn=6,ct=null}function ty(s,r,o,d,p,g,w,T,$,ee,ae,pe){s.cancelPendingCommit=null;do qd();while(tn!==0);if((Et&6)!==0)throw Error(i(327));if(r!==null){if(r===s.current)throw Error(i(177));s===zt&&(ct=zt=null,ft=0),Ua=r,ri=s,ji=o,dm=p,qb=d,m3(s,r,o,w,T,$,pe)}}function m3(s,r,o,d,p,g,w){var T=r.lanes|r.childLanes;if(um=T,T|=Xf,ol(s,o,T,d,p,g),zl=null,(o&335544064)===o?($l=HC(s),d=10262):($l=null,d=10256),(r.subtreeFlags&d)!==0||(r.flags&d)!==0?(s.callbackNode=null,s.callbackPriority=0,_3(xe,function(){return xm(),null})):(s.callbackNode=null,s.callbackPriority=0),Td=!1,d=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||d){d=Ce.T,Ce.T=null,p=Re.p,Re.p=2,g=Et,Et|=4;try{l3(s,r,o)}finally{Et=g,Re.p=p,Ce.T=d}}tn=1,Td?Dl=F3(w,s.containerInfo,$l,pm,mm,x3,gm,xm,g3):(pm(),mm(),gm())}function g3(s){if(tn!==0){var r=ri.onRecoverableError;r(s,{componentStack:null})}}function x3(){tn===3&&(tn=0,$b(Ua,ri),tn=4)}function pm(){if(tn===1){tn=0;var s=ri,r=Ua,o=ji,d=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||d){d=Ce.T,Ce.T=null;var p=Re.p;Re.p=2;var g=Et;Et|=4;try{gc=Rd=!1,Db(r,s,o),o=Tm;var w=Rv(s.containerInfo),T=o.focusedElem,$=o.selectionRange;if(w!==T&&T&&T.ownerDocument&&Mv(T.ownerDocument.documentElement,T)){if($!==null&&Hf(T)){var ee=$.start,ae=$.end;if(ae===void 0&&(ae=ee),"selectionStart"in T)T.selectionStart=ee,T.selectionEnd=Math.min(ae,T.value.length);else{var pe=T.ownerDocument||document,Z=pe&&pe.defaultView||window;if(Z.getSelection){var ie=Z.getSelection(),Te=T.textContent.length,Be=Math.min($.start,Te),nt=$.end===void 0?Be:Math.min($.end,Te);!ie.extend&&Be>nt&&(w=nt,nt=Be,Be=w);var J=Av(T,Be),V=Av(T,nt);if(J&&V&&(ie.rangeCount!==1||ie.anchorNode!==J.node||ie.anchorOffset!==J.offset||ie.focusNode!==V.node||ie.focusOffset!==V.offset)){var ne=pe.createRange();ne.setStart(J.node,J.offset),ie.removeAllRanges(),Be>nt?(ie.addRange(ne),ie.extend(V.node,V.offset)):(ne.setEnd(V.node,V.offset),ie.addRange(ne))}}}}for(pe=[],ie=T;ie=ie.parentNode;)ie.nodeType===1&&pe.push({element:ie,left:ie.scrollLeft,top:ie.scrollTop});for(typeof T.focus=="function"&&T.focus(),T=0;T<pe.length;T++){var fe=pe[T];fe.element.scrollLeft=fe.left,fe.element.scrollTop=fe.top}}Xl=!!Em,Tm=Em=null}finally{Et=g,Re.p=p,Ce.T=d}}s.current=r,tn=2}}function mm(){if(tn===2){tn=0;var s=ri,r=Ua,o=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||o){o=Ce.T,Ce.T=null;var d=Re.p;Re.p=2;var p=Et;Et|=4;try{Tb(s,r.alternate,r)}finally{Et=p,Re.p=d,Ce.T=o}}tn=3}}function gm(){if(tn===4||tn===3){tn=0;var s=Dl;Dl=null,In();var r=ri,o=Ua,d=ji,p=qb,g=(d&335544064)===d?10262:10256;if((o.subtreeFlags&g)!==0||(o.flags&g)!==0?tn=5:(tn=0,Ua=ri=null,ny(r,r.pendingLanes)),g=r.pendingLanes,g===0&&(Ur=null),va(d),o=o.stateNode,xt&&typeof xt.onCommitFiberRoot=="function")try{xt.onCommitFiberRoot(Nn,o,void 0,(o.current.flags&128)===128)}catch{}if(p!==null){o=Ce.T,g=Re.p,Re.p=2,Ce.T=null;try{for(var w=r.onRecoverableError,T=0;T<p.length;T++){var $=p[T];w($.value,{componentStack:$.stack})}}finally{Ce.T=o,Re.p=g}}if(p=zl,w=$l,$l=null,p!==null&&(zl=null,w===null&&(w=[]),s!==null))for($=0;$<p.length;$++)o=(0,p[$])(w),o!==void 0&&s.finished.finally(o);(ji&3)!==0&&qd(),Ni(r),g=r.pendingLanes,(d&261930)!==0&&(g&42)!==0?r===Id?yc++:(yc=0,Id=r):(yc=0,Id=null),_c(0)}}function ny(s,r){(s.pooledCacheLanes&=r)===0&&(r=s.pooledCache,r!=null&&(s.pooledCache=null,tc(r)))}function qd(){return Dl!==null&&(Dl.skipTransition(),Dl=null),pm(),mm(),gm(),xm()}function xm(){if(tn!==5)return!1;var s=ri,r=um;um=0;var o=va(ji),d=Ce.T,p=Re.p;try{Re.p=32>o?32:o,Ce.T=null,o=dm,dm=null;var g=ri,w=ji;if(tn=0,Ua=ri=null,ji=0,(Et&6)!==0)throw Error(i(331));var T=Et;if(Et|=4,Fb(g.current),Bb(g,g.current,w,o),Et=T,_c(0,!1),xt&&typeof xt.onPostCommitFiberRoot=="function")try{xt.onPostCommitFiberRoot(Nn,g)}catch{}return!0}finally{Re.p=p,Ce.T=d,ny(s,r)}}function sy(s,r,o){r=$s(o,r),r=Lp(s.stateNode,r,2),s=Lr(s,r,2),s!==null&&(fi(s,2),Ni(s))}function Mt(s,r,o){if(s.tag===3)sy(s,s,o);else for(;r!==null;){if(r.tag===3){sy(r,s,o);break}else if(r.tag===1){var d=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(Ur===null||!Ur.has(d))){s=$s(o,s),o=J1(2),d=Lr(r,o,2),d!==null&&(eb(o,d,r,s),fi(d,2),Ni(d));break}}r=r.return}}function vm(s,r,o){var d=s.pingCache;if(d===null){d=s.pingCache=new u3;var p=new Set;d.set(r,p)}else p=d.get(r),p===void 0&&(p=new Set,d.set(r,p));p.has(o)||(om=!0,p.add(o),s=v3.bind(null,s,r,o),r.then(s,s))}function v3(s,r,o){var d=s.pingCache;d!==null&&d.delete(r),s.pingedLanes|=s.suspendedLanes&o,s.warmLanes&=~o,zt===s&&(ft&o)===o&&((cn===4||cn===3&&(ft&62914560)===ft&&300>sn()-$d)&&(Et&2)===0?Pl(s,0):zd|=o,Ll===ft&&(Ll=0)),Ni(s)}function iy(s,r){r===0&&(r=Bu()),s=Na(s,r),s!==null&&(fi(s,r),Ni(s))}function b3(s){var r=s.memoizedState,o=0;r!==null&&(o=r.retryLane),iy(s,o)}function y3(s,r){var o=0;switch(s.tag){case 31:case 13:var d=s.stateNode,p=s.memoizedState;p!==null&&(o=p.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),iy(s,o)}function _3(s,r){return is(s,r)}var Fl=null,Ul=null,bm=!1,Vd=!1,ym=!1,qr=0;function Ni(s){s!==Ul&&s.next===null&&(Ul===null?Fl=Ul=s:Ul=Ul.next=s),Vd=!0,bm||(bm=!0,S3())}function _c(s,r){if(!ym&&Vd){ym=!0;do for(var o=!1,d=Fl;d!==null;){if(s!==0){var p=d.pendingLanes;if(p===0)var g=0;else{var w=d.suspendedLanes,T=d.pingedLanes;g=(1<<31-en(42|s)+1)-1,g&=p&~(w&~T),g=g&201326741?g&201326741|1:g?g|2:0}g!==0&&(o=!0,oy(d,g))}else g=ft,g=Ws(d,d===zt?g:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(g&3)===0||br(d,g)||(o=!0,oy(d,g));d=d.next}while(o);ym=!1}}function w3(){ry()}function ry(){Vd=bm=!1;var s=0;qr!==0&&L3()&&(s=qr);for(var r=sn(),o=null,d=Fl;d!==null;){var p=d.next,g=ay(d,r);g===0?(d.next=null,o===null?Fl=p:o.next=p,p===null&&(Ul=o)):(o=d,(s!==0||(g&3)!==0)&&(Vd=!0)),d=p}tn!==0&&tn!==5||_c(s),qr!==0&&(qr=0)}function ay(s,r){for(var o=s.suspendedLanes,d=s.pingedLanes,p=s.expirationTimes,g=s.pendingLanes&-62914561;0<g;){var w=31-en(g),T=1<<w,$=p[w];$===-1?((T&o)===0||(T&d)!==0)&&(p[w]=Af(T,r)):$<=r&&(s.expiredLanes|=T),g&=~T}if(r=zt,o=ft,o=Ws(s,s===r?o:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),d=s.callbackNode,o===0||s===r&&(At===2||At===9)||s.cancelPendingCommit!==null)return d!==null&&d!==null&&Ct(d),s.callbackNode=null,s.callbackPriority=0;if((o&3)===0||br(s,o)){if(r=o&-o,r===s.callbackPriority)return r;switch(d!==null&&Ct(d),va(o)){case 2:case 8:o=le;break;case 32:o=xe;break;case 268435456:o=rt;break;default:o=xe}return d=ly.bind(null,s),o=is(o,d),s.callbackPriority=r,s.callbackNode=o,r}return d!==null&&d!==null&&Ct(d),s.callbackPriority=2,s.callbackNode=null,2}function ly(s,r){if(tn!==0&&tn!==5)return s.callbackNode=null,s.callbackPriority=0,null;var o=s.callbackNode;if(qd()&&s.callbackNode!==o)return null;var d=ft;return d=Ws(s,s===zt?d:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),d===0?null:(Gb(s,d,r),ay(s,sn()),s.callbackNode!=null&&s.callbackNode===o?ly.bind(null,s):null)}function oy(s,r){if(qd())return null;Gb(s,r,!0)}function S3(){z3(function(){(Et&6)!==0?is(Bi,w3):ry()})}function _m(){if(qr===0){var s=Ra;s===0&&(s=vr,vr<<=1,(vr&261888)===0&&(vr=256)),qr=s}return qr}function cy(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:Rn(s)}function k3(s,r,o,d,p){if(r==="submit"&&o&&o.stateNode===p){var g=cy((p[Cn]||null).action),w=d.submitter;w&&(r=(r=w[Cn]||null)?cy(r.formAction):w.getAttribute("formAction"),r!==null&&(g=r,w=null));var T=new Vu("action","action",null,d,p);s.push({event:T,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(qr!==0){var $=new FormData(p,w);Tp(o,{pending:!0,data:$,method:p.method,action:g},null,$)}}else typeof g=="function"&&(T.preventDefault(),$=new FormData(p,w),Tp(o,{pending:!0,data:$,method:p.method,action:g},g,$))},currentTarget:p}]})}}for(var wm=0;wm<Yf.length;wm++){var Sm=Yf[wm],j3=Sm.toLowerCase(),N3=Sm[0].toUpperCase()+Sm.slice(1);ti(j3,"on"+N3)}ti(Dv,"onAnimationEnd"),ti(zv,"onAnimationIteration"),ti($v,"onAnimationStart"),ti("dblclick","onDoubleClick"),ti("focusin","onFocus"),ti("focusout","onBlur"),ti(DC,"onTransitionRun"),ti(zC,"onTransitionStart"),ti($C,"onTransitionCancel"),ti(Bv,"onTransitionEnd"),Hi("onMouseEnter",["mouseout","mouseover"]),Hi("onMouseLeave",["mouseout","mouseover"]),Hi("onPointerEnter",["pointerout","pointerover"]),Hi("onPointerLeave",["pointerout","pointerover"]),Ui("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ui("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ui("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ui("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ui("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ui("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var wc="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(" "),C3=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(wc));function uy(s,r){r=(r&4)!==0;for(var o=0;o<s.length;o++){var d=s[o],p=d.event;d=d.listeners;e:{var g=void 0;if(r)for(var w=d.length-1;0<=w;w--){var T=d[w],$=T.instance,ee=T.currentTarget;if(T=T.listener,$!==g&&p.isPropagationStopped())break e;g=T,p.currentTarget=ee;try{g(p)}catch(ae){Xu(ae)}p.currentTarget=null,g=$}else for(w=0;w<d.length;w++){if(T=d[w],$=T.instance,ee=T.currentTarget,T=T.listener,$!==g&&p.isPropagationStopped())break e;g=T,p.currentTarget=ee;try{g(p)}catch(ae){Xu(ae)}p.currentTarget=null,g=$}}}}function ut(s,r){var o=r[Do];o===void 0&&(o=r[Do]=new Set);var d=s+"__bubble";o.has(d)||(dy(r,s,2,!1),o.add(d))}function km(s,r,o){var d=0;r&&(d|=4),dy(o,s,d,r)}var Gd="_reactListening"+Math.random().toString(36).slice(2);function jm(s){if(!s[Gd]){s[Gd]=!0,Ks.forEach(function(o){o!=="selectionchange"&&(C3.has(o)||km(o,!1,s),km(o,!0,s))});var r=s.nodeType===9?s:s.ownerDocument;r===null||r[Gd]||(r[Gd]=!0,km("selectionchange",!1,r))}}function dy(s,r,o,d){switch(e_(r)){case 2:var p=bE;break;case 8:p=yE;break;default:p=Vm}o=p.bind(null,r,o,s),p=void 0,!qo||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(p=!0),d?p!==void 0?s.addEventListener(r,o,{capture:!0,passive:p}):s.addEventListener(r,o,!0):p!==void 0?s.addEventListener(r,o,{passive:p}):s.addEventListener(r,o,!1)}function Nm(s,r,o,d,p){var g=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 T=d.stateNode.containerInfo;if(T===p)break;if(w===4)for(w=d.return;w!==null;){var $=w.tag;if(($===3||$===4)&&w.stateNode.containerInfo===p)return;w=w.return}for(;T!==null;){if(w=Fi(T),w===null)return;if($=w.tag,$===5||$===6||$===26||$===27){d=g=w;continue e}T=T.parentNode}}d=d.return}Ss(function(){var ee=g,ae=pl(o),pe=[];e:{var Z=Pv.get(s);if(Z!==void 0){var ie=Vu,Te=s;switch(s){case"keypress":if(ks(o)===0)break e;case"keydown":case"keyup":ie=dC;break;case"focusin":Te="focus",ie=$f;break;case"focusout":Te="blur",ie=$f;break;case"beforeblur":case"afterblur":ie=$f;break;case"click":if(o.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ie=pv;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ie=JN;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ie=gC;break;case Dv:case zv:case $v:ie=nC;break;case Bv:ie=vC;break;case"scroll":case"scrollend":ie=KN;break;case"wheel":ie=yC;break;case"copy":case"cut":case"paste":ie=iC;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ie=gv;break;case"submit":ie=pC;break;case"toggle":case"beforetoggle":ie=wC}var Be=(r&4)!==0,nt=!Be&&(s==="scroll"||s==="scrollend"),J=Be?Z!==null?Z+"Capture":null:Z;Be=[];for(var V=ee,ne;V!==null;){var fe=V;if(ne=fe.stateNode,fe=fe.tag,fe!==5&&fe!==26&&fe!==27||ne===null||J===null||(fe=jr(V,J),fe!=null&&Be.push(Sc(V,fe,ne))),nt)break;V=V.return}0<Be.length&&(Z=new ie(Z,Te,null,o,ae),pe.push({event:Z,listeners:Be}))}}if((r&7)===0){e:{if(ie=s==="mouseover"||s==="pointerover",Z=s==="mouseout"||s==="pointerout",ie&&o!==Sr&&(Te=o.relatedTarget||o.fromElement)&&(Fi(Te)||Te[mi]))break e;(Z||ie)&&(Te=ae.window===ae?ae:(ie=ae.ownerDocument)?ie.defaultView||ie.parentWindow:window,Z?(ie=o.relatedTarget||o.toElement,Z=ee,ie=ie?Fi(ie):null,ie!==null&&(nt=c(ie),Be=ie.tag,ie!==nt||Be!==5&&Be!==27&&Be!==6)&&(ie=null)):(Z=null,ie=ee),Z!==ie&&(Be=pv,fe="onMouseLeave",J="onMouseEnter",V="mouse",(s==="pointerout"||s==="pointerover")&&(Be=gv,fe="onPointerLeave",J="onPointerEnter",V="pointer"),nt=Z==null?Te:yr(Z),ne=ie==null?Te:yr(ie),Te=new Be(fe,V+"leave",Z,o,ae),Te.target=nt,Te.relatedTarget=ne,fe=null,Fi(ae)===ee&&(Be=new Be(J,V+"enter",ie,o,ae),Be.target=ne,Be.relatedTarget=nt,fe=Be),nt=fe,Be=Z&&ie?O(Z,ie,E3):null,Z!==null&&hy(pe,Te,Z,Be,!1),ie!==null&&nt!==null&&hy(pe,nt,ie,Be,!0)))}e:{if(Z=ee?yr(ee):window,ie=Z.nodeName&&Z.nodeName.toLowerCase(),ie==="select"||ie==="input"&&Z.type==="file")var Oe=kv;else if(wv(Z))if(jv)Oe=RC;else{Oe=AC;var pt=TC}else ie=Z.nodeName,!ie||ie.toLowerCase()!=="input"||Z.type!=="checkbox"&&Z.type!=="radio"?ee&&mt(ee.elementType)&&(Oe=kv):Oe=MC;if(Oe&&(Oe=Oe(s,ee))){Sv(pe,Oe,o,ae);break e}pt&&pt(s,Z,ee)}switch(pt=ee?yr(ee):window,s){case"focusin":(wv(pt)||pt.contentEditable==="true")&&(gl=pt,qf=ee,Zo=null);break;case"focusout":Zo=qf=gl=null;break;case"mousedown":Vf=!0;break;case"contextmenu":case"mouseup":case"dragend":Vf=!1,Ov(pe,o,ae);break;case"selectionchange":if(LC)break;case"keydown":case"keyup":Ov(pe,o,ae)}var Fe;if(Pf)e:{switch(s){case"compositionstart":var Ye="onCompositionStart";break e;case"compositionend":Ye="onCompositionEnd";break e;case"compositionupdate":Ye="onCompositionUpdate";break e}Ye=void 0}else ml?yv(s,o)&&(Ye="onCompositionEnd"):s==="keydown"&&o.keyCode===229&&(Ye="onCompositionStart");Ye&&(xv&&o.locale!=="ko"&&(ml||Ye!=="onCompositionStart"?Ye==="onCompositionEnd"&&ml&&(Fe=Vo()):(ei=ae,Hu="value"in ei?ei.value:ei.textContent,ml=!0)),pt=Yd(ee,Ye),0<pt.length&&(Ye=new mv(Ye,s,null,o,ae),pe.push({event:Ye,listeners:pt}),Fe?Ye.data=Fe:(Fe=_v(o),Fe!==null&&(Ye.data=Fe)))),(Fe=kC?jC(s,o):NC(s,o))&&(Ye=Yd(ee,"onBeforeInput"),0<Ye.length&&(pt=new mv("onBeforeInput","beforeinput",null,o,ae),pe.push({event:pt,listeners:Ye}),pt.data=Fe)),k3(pe,s,ee,o,ae)}uy(pe,r)})}function Sc(s,r,o){return{instance:s,listener:r,currentTarget:o}}function Yd(s,r){for(var o=r+"Capture",d=[];s!==null;){var p=s,g=p.stateNode;if(p=p.tag,p!==5&&p!==26&&p!==27||g===null||(p=jr(s,o),p!=null&&d.unshift(Sc(s,p,g)),p=jr(s,r),p!=null&&d.push(Sc(s,p,g))),s.tag===3)return d;s=s.return}return[]}function E3(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function hy(s,r,o,d,p){for(var g=r._reactName,w=[];o!==null&&o!==d;){var T=o,$=T.alternate,ee=T.stateNode;if(T=T.tag,$!==null&&$===d)break;T!==5&&T!==26&&T!==27||ee===null||($=ee,p?(ee=jr(o,g),ee!=null&&w.unshift(Sc(o,ee,$))):p||(ee=jr(o,g),ee!=null&&w.push(Sc(o,ee,$)))),o=o.return}w.length!==0&&s.push({event:r,listeners:w})}var T3=/\r\n?/g,A3=/\u0000|\uFFFD/g;function fy(s){return(typeof s=="string"?s:""+s).replace(T3,`
|
|
50
|
+
`).replace(A3,"")}function py(s,r){return r=fy(r),fy(s)===r}function Rt(s,r,o,d,p,g){switch(o){case"children":if(typeof d=="string")r==="body"||r==="textarea"&&d===""||qi(s,d);else if(typeof d=="number"||typeof d=="bigint")r!=="body"&&qi(s,""+d);else return;break;case"className":_a(s,"class",d);break;case"tabIndex":_a(s,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":_a(s,o,d);break;case"style":it(s,d,g);return;case"data":if(r!=="object"){_a(s,"data",d);break}case"src":case"href":if(d===""&&(r!=="a"||o!=="href")){s.removeAttribute(o);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){s.removeAttribute(o);break}d=Rn(d),s.setAttribute(o,d);break;case"action":case"formAction":if(typeof d=="function"){s.setAttribute(o,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof g=="function"&&(o==="formAction"?(r!=="input"&&Rt(s,r,"name",p.name,p,null),Rt(s,r,"formEncType",p.formEncType,p,null),Rt(s,r,"formMethod",p.formMethod,p,null),Rt(s,r,"formTarget",p.formTarget,p,null)):(Rt(s,r,"encType",p.encType,p,null),Rt(s,r,"method",p.method,p,null),Rt(s,r,"target",p.target,p,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){s.removeAttribute(o);break}d=Rn(d),s.setAttribute(o,d);break;case"onClick":d!=null&&(s.onclick=Xn);return;case"onScroll":d!=null&&ut("scroll",s);return;case"onScrollEnd":d!=null&&ut("scrollend",s);return;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(i(61));if(o=d.__html,o!=null){if(p.children!=null)throw Error(i(60));(g!=null?g.__html:void 0)!==o&&(s.innerHTML=o)}}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}o=Rn(d),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":d!=null&&typeof d!="function"&&typeof d!="symbol"?s.setAttribute(o,d):s.removeAttribute(o);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(o,""):s.removeAttribute(o);break;case"capture":case"download":d===!0?s.setAttribute(o,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?s.setAttribute(o,d):s.removeAttribute(o);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?s.setAttribute(o,d):s.removeAttribute(o);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?s.removeAttribute(o):s.setAttribute(o,d);break;case"popover":ut("beforetoggle",s),ut("toggle",s),fl(s,"popover",d);break;case"xlinkActuate":Ds(s,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":Ds(s,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":Ds(s,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":Ds(s,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":Ds(s,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":Ds(s,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":Ds(s,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":Ds(s,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":Ds(s,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":fl(s,"is",d);break;case"innerText":case"textContent":return;default:if(!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")o=gt.get(o)||o,fl(s,o,d);else return}vt=!0}function Cm(s,r,o,d,p,g){switch(o){case"style":it(s,d,g);return;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(i(61));if(o=d.__html,o!=null){if(p.children!=null)throw Error(i(60));(g!=null?g.__html:void 0)!==o&&(s.innerHTML=o)}}break;case"children":if(typeof d=="string")qi(s,d);else if(typeof d=="number"||typeof d=="bigint")qi(s,""+d);else return;break;case"onScroll":d!=null&&ut("scroll",s);return;case"onScrollEnd":d!=null&&ut("scrollend",s);return;case"onClick":d!=null&&(s.onclick=Xn);return;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":return;case"innerText":case"textContent":return;default:if(!dl.hasOwnProperty(o))e:{if(o[0]==="o"&&o[1]==="n"&&(p=o.endsWith("Capture"),g=o.slice(2,p?o.length-7:void 0),r=s[Cn]||null,r=r!=null?r[o]:null,typeof r=="function"&&s.removeEventListener(g,r,p),typeof d=="function")){typeof r!="function"&&r!==null&&(o in s?s[o]=null:s.hasAttribute(o)&&s.removeAttribute(o)),s.addEventListener(g,d,p);break e}vt=!0,o in s?s[o]=d:d===!0?s.setAttribute(o,""):fl(s,o,d)}return}vt=!0}function $n(s,r,o){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ut("error",s),ut("load",s);var d=!1,p=!1,g;for(g in o)if(o.hasOwnProperty(g)){var w=o[g];if(w!=null)switch(g){case"src":d=!0;break;case"srcSet":p=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:Rt(s,r,g,w,o,null)}}p&&Rt(s,r,"srcSet",o.srcSet,o,null),d&&Rt(s,r,"src",o.src,o,null);return;case"input":ut("invalid",s);var T=g=w=p=null,$=null,ee=null;for(d in o)if(o.hasOwnProperty(d)){var ae=o[d];if(ae!=null)switch(d){case"name":p=ae;break;case"type":w=ae;break;case"checked":$=ae;break;case"defaultChecked":ee=ae;break;case"value":g=ae;break;case"defaultValue":T=ae;break;case"children":case"dangerouslySetInnerHTML":if(ae!=null)throw Error(i(137,r));break;default:Rt(s,r,d,ae,o,null)}}Uu(s,g,T,$,ee,w,p,!1);return;case"select":ut("invalid",s),d=w=g=null;for(p in o)if(o.hasOwnProperty(p)&&(T=o[p],T!=null))switch(p){case"value":g=T;break;case"defaultValue":w=T;break;case"multiple":d=T;default:Rt(s,r,p,T,o,null)}r=g,o=w,s.multiple=!!d,r!=null?wr(s,!!d,r,!1):o!=null&&wr(s,!!d,o,!0);return;case"textarea":ut("invalid",s),g=p=d=null;for(w in o)if(o.hasOwnProperty(w)&&(T=o[w],T!=null))switch(w){case"value":d=T;break;case"defaultValue":p=T;break;case"children":g=T;break;case"dangerouslySetInnerHTML":if(T!=null)throw Error(i(91));break;default:Rt(s,r,w,T,o,null)}Uo(s,d,p,g);return;case"option":for($ in o)if(o.hasOwnProperty($)&&(d=o[$],d!=null))switch($){case"selected":s.selected=d&&typeof d!="function"&&typeof d!="symbol";break;default:Rt(s,r,$,d,o,null)}return;case"dialog":ut("beforetoggle",s),ut("toggle",s),ut("cancel",s),ut("close",s);break;case"iframe":case"object":ut("load",s);break;case"video":case"audio":for(d=0;d<wc.length;d++)ut(wc[d],s);break;case"image":ut("error",s),ut("load",s);break;case"details":ut("toggle",s);break;case"embed":case"source":case"link":ut("error",s),ut("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 o)if(o.hasOwnProperty(ee)&&(d=o[ee],d!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:Rt(s,r,ee,d,o,null)}return;default:if(mt(r)){for(ae in o)o.hasOwnProperty(ae)&&(d=o[ae],d!==void 0&&Cm(s,r,ae,d,o,void 0));return}}for(T in o)o.hasOwnProperty(T)&&(d=o[T],d!=null&&Rt(s,r,T,d,o,null))}var M3={};function R3(s,r,o,d){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var p=null,g=null,w=null,T=null,$=null,ee=null,ae=null;for(ie in o){var pe=o[ie];if(o.hasOwnProperty(ie)&&pe!=null)switch(ie){case"checked":break;case"value":break;case"defaultValue":$=pe;default:d.hasOwnProperty(ie)||Rt(s,r,ie,null,d,pe)}}for(var Z in d){var ie=d[Z];if(pe=o[Z],d.hasOwnProperty(Z)&&(ie!=null||pe!=null))switch(Z){case"type":ie!==pe&&(vt=!0),g=ie;break;case"name":ie!==pe&&(vt=!0),p=ie;break;case"checked":ie!==pe&&(vt=!0),ee=ie;break;case"defaultChecked":ie!==pe&&(vt=!0),ae=ie;break;case"value":ie!==pe&&(vt=!0),w=ie;break;case"defaultValue":ie!==pe&&(vt=!0),T=ie;break;case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(i(137,r));break;default:ie!==pe&&Rt(s,r,Z,ie,d,pe)}}Po(s,w,T,$,ee,ae,g,p);return;case"select":ie=w=T=Z=null;for(g in o)if($=o[g],o.hasOwnProperty(g)&&$!=null)switch(g){case"value":break;case"multiple":ie=$;default:d.hasOwnProperty(g)||Rt(s,r,g,null,d,$)}for(p in d)if(g=d[p],$=o[p],d.hasOwnProperty(p)&&(g!=null||$!=null))switch(p){case"value":g!==$&&(vt=!0),Z=g;break;case"defaultValue":g!==$&&(vt=!0),T=g;break;case"multiple":g!==$&&(vt=!0),w=g;default:g!==$&&Rt(s,r,p,g,d,$)}r=T,o=w,d=ie,Z!=null?wr(s,!!o,Z,!1):!!d!=!!o&&(r!=null?wr(s,!!o,r,!0):wr(s,!!o,o?[]:"",!1));return;case"textarea":ie=Z=null;for(T in o)if(p=o[T],o.hasOwnProperty(T)&&p!=null&&!d.hasOwnProperty(T))switch(T){case"value":break;case"children":break;default:Rt(s,r,T,null,d,p)}for(w in d)if(p=d[w],g=o[w],d.hasOwnProperty(w)&&(p!=null||g!=null))switch(w){case"value":p!==g&&(vt=!0),Z=p;break;case"defaultValue":p!==g&&(vt=!0),ie=p;break;case"children":break;case"dangerouslySetInnerHTML":if(p!=null)throw Error(i(91));break;default:p!==g&&Rt(s,r,w,p,d,g)}Fo(s,Z,ie);return;case"option":for(var Te in o)if(Z=o[Te],o.hasOwnProperty(Te)&&Z!=null&&!d.hasOwnProperty(Te))switch(Te){case"selected":s.selected=!1;break;default:Rt(s,r,Te,null,d,Z)}for($ in d)if(Z=d[$],ie=o[$],d.hasOwnProperty($)&&Z!==ie&&(Z!=null||ie!=null))switch($){case"selected":Z!==ie&&(vt=!0),s.selected=Z&&typeof Z!="function"&&typeof Z!="symbol";break;default:Rt(s,r,$,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 Be in o)Z=o[Be],o.hasOwnProperty(Be)&&Z!=null&&!d.hasOwnProperty(Be)&&Rt(s,r,Be,null,d,Z);for(ee in d)if(Z=d[ee],ie=o[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:Rt(s,r,ee,Z,d,ie)}return;default:if(mt(r)){for(var nt in o)Z=o[nt],o.hasOwnProperty(nt)&&Z!==void 0&&!d.hasOwnProperty(nt)&&Cm(s,r,nt,void 0,d,Z);for(ae in d)Z=d[ae],ie=o[ae],!d.hasOwnProperty(ae)||Z===ie||Z===void 0&&ie===void 0||Cm(s,r,ae,Z,d,ie);return}}for(var J in o)Z=o[J],o.hasOwnProperty(J)&&Z!=null&&!d.hasOwnProperty(J)&&Rt(s,r,J,null,d,Z);for(pe in d)Z=d[pe],ie=o[pe],!d.hasOwnProperty(pe)||Z===ie||Z==null&&ie==null||Rt(s,r,pe,Z,d,ie)}function my(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function O3(){if(typeof performance.getEntriesByType=="function"){for(var s=0,r=0,o=performance.getEntriesByType("resource"),d=0;d<o.length;d++){var p=o[d],g=p.transferSize,w=p.initiatorType,T=p.duration;if(g&&T&&my(w)){for(w=0,T=p.responseEnd,d+=1;d<o.length;d++){var $=o[d],ee=$.startTime;if(ee>T)break;var ae=$.transferSize,pe=$.initiatorType;ae&&my(pe)&&($=$.responseEnd,w+=ae*($<T?1:(T-ee)/($-ee)))}if(--d,r+=8*(g+w)/(p.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 Em=null,Tm=null;function kc(s){return s.nodeType===9?s:s.ownerDocument}function gy(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 xy(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 vy(s,r,o,d){return o=kc(o).createElement(s),o[dn]=d,o[Cn]=r,$n(o,s,r),ln(o),o}function Am(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 Mm=null;function L3(){var s=window.event;return s&&s.type==="popstate"?s===Mm?!1:(Mm=s,!0):(Mm=null,!1)}var Rm=typeof setTimeout=="function"?setTimeout:void 0,D3=typeof clearTimeout=="function"?clearTimeout:void 0,by=typeof Promise=="function"?Promise:void 0,yy=typeof requestAnimationFrame=="function"?requestAnimationFrame:Rm,z3=typeof queueMicrotask=="function"?queueMicrotask:typeof by<"u"?function(s){return by.resolve(null).then(s).catch($3)}:Rm;function $3(s){setTimeout(function(){throw s})}function Vr(s){return s==="head"}function _y(s,r){var o=r,d=0;do{var p=o.nextSibling;if(s.removeChild(o),p&&p.nodeType===8)if(o=p.data,o==="/$"||o==="/&"){if(d===0){s.removeChild(p),Ql(r);return}d--}else if(o==="$"||o==="$?"||o==="$~"||o==="$!"||o==="&")d++;else if(o==="html")Im(s.ownerDocument.documentElement);else if(o==="head"){o=s.ownerDocument.head,Im(o);for(var g=o.firstChild;g;){var w=g.nextSibling,T=g.nodeName;g[ya]||T==="SCRIPT"||T==="STYLE"||T==="LINK"&&g.rel.toLowerCase()==="stylesheet"||o.removeChild(g),g=w}}else o==="body"&&Im(s.ownerDocument.body);o=p}while(o);Ql(r)}function wy(s,r){var o=s;s=0;do{var d=o.nextSibling;if(o.nodeType===1?r?(o._stashedDisplay=o.style.display,o.style.display="none"):(o.style.display=o._stashedDisplay||"",o.getAttribute("style")===""&&o.removeAttribute("style")):o.nodeType===3&&(r?(o._stashedText=o.nodeValue,o.nodeValue=""):o.nodeValue=o._stashedText||""),d&&d.nodeType===8)if(o=d.data,o==="/$"){if(s===0)break;s--}else o!=="$"&&o!=="$?"&&o!=="$~"&&o!=="$!"||s++;o=d}while(o)}function Sy(s,r,o){if(r=CSS.escape(r)!==r?"r-"+btoa(r).replace(/=/g,""):r,s.style.viewTransitionName=r,o!=null&&(s.style.viewTransitionClass=o),o=getComputedStyle(s),o.display==="inline"){if(r=s.getClientRects(),r.length===1)var d=1;else for(var p=d=0;p<r.length;p++){var g=r[p];0<g.width&&0<g.height&&d++}d===1&&(s=s.style,s.display=r.length===1?"inline-block":"block",s.marginTop="-"+o.paddingTop,s.marginBottom="-"+o.paddingBottom)}}function ky(s,r){s=s.style,r=r.style;var o=r!=null?r.hasOwnProperty("viewTransitionName")?r.viewTransitionName:r.hasOwnProperty("view-transition-name")?r["view-transition-name"]:null:null;s.viewTransitionName=o==null||typeof o=="boolean"?"":(""+o).trim(),o=r!=null?r.hasOwnProperty("viewTransitionClass")?r.viewTransitionClass:r.hasOwnProperty("view-transition-class")?r["view-transition-class"]:null:null,s.viewTransitionClass=o==null||typeof o=="boolean"?"":(""+o).trim(),s.display==="inline-block"&&(r==null?s.display=s.margin="":(o=r.display,s.display=o==null||typeof o=="boolean"?"":o,o=r.margin,o!=null?s.margin=o:(o=r.hasOwnProperty("marginTop")?r.marginTop:r["margin-top"],s.marginTop=o==null||typeof o=="boolean"?"":o,r=r.hasOwnProperty("marginBottom")?r.marginBottom:r["margin-bottom"],s.marginBottom=r==null||typeof r=="boolean"?"":r)))}function B3(s,r,o){return o=o.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<=o.innerHeight&&s.left<=o.innerWidth}}function Om(s){var r=s.getBoundingClientRect(),o=getComputedStyle(s);return B3(r,o,s)}function P3(s){return s.documentElement.clientHeight}function I3(s){this.addEventListener("load",s),this.addEventListener("error",s)}function F3(s,r,o,d,p,g,w,T,$){var ee=r.nodeType===9?r:r.ownerDocument;try{var ae=ee.startViewTransition({update:function(){var Z=ee.defaultView,ie=Z.navigation&&Z.navigation.transition,Te=ee.fonts.status;d();var Be=[];if(Te==="loaded"&&(P3(ee),ee.fonts.status==="loading"&&Be.push(ee.fonts.ready)),Te=Be.length,s!==null)for(var nt=s.suspenseyImages,J=0,V=0;V<nt.length;V++){var ne=nt[V];if(!ne.complete){var fe=ne.getBoundingClientRect();if(0<fe.bottom&&0<fe.right&&fe.top<Z.innerHeight&&fe.left<Z.innerWidth){if(J+=Vy(ne),J>Wd){Be.length=Te;break}ne=new Promise(I3.bind(ne)),Be.push(ne)}}}if(0<Be.length)return Z=Promise.race([Promise.all(Be),new Promise(function(Oe){return setTimeout(Oe,500)})]).then(p,p),(ie?Promise.allSettled([ie.finished,Z]):Z).then(g,g);if(p(),ie)return ie.finished.then(g,g);g()},types:o});ee.__reactViewTransition=ae;var pe=[];return ae.ready.then(function(){for(var Z=ee.documentElement.getAnimations({subtree:!0}),ie=0;ie<Z.length;ie++){var Te=Z[ie],Be=Te.effect,nt=Be.pseudoElement;if(nt!=null&&nt.startsWith("::view-transition")){pe.push(Te),Te=Be.getKeyframes();for(var J=nt=void 0,V=!0,ne=0;ne<Te.length;ne++){var fe=Te[ne],Oe=fe.width;if(nt===void 0)nt=Oe;else if(nt!==Oe){V=!1;break}if(Oe=fe.height,J===void 0)J=Oe;else if(J!==Oe){V=!1;break}delete fe.width,delete fe.height,fe.transform==="none"&&delete fe.transform}V&&nt!==void 0&&J!==void 0&&(Be.setKeyframes(Te),V=getComputedStyle(Be.target,Be.pseudoElement),V.width!==nt||V.height!==J)&&(V=Te[0],V.width=nt,V.height=J,V=Te[Te.length-1],V.width=nt,V.height=J,Be.setKeyframes(Te))}}w()},function(Z){ee.__reactViewTransition===ae&&(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&&$(Z)}finally{d(),p(),w()}}),ae.finished.finally(function(){for(var Z=0;Z<pe.length;Z++)pe[Z].cancel();ee.__reactViewTransition===ae&&(ee.__reactViewTransition=null),T()}),ae}catch{return d(),p(),w(),null}}function Ha(s,r){this._scope=document.documentElement,this._selector="::view-transition-"+s+"("+r+")"}Ha.prototype.animate=function(s,r){return r=typeof r=="number"?{duration:r}:F({},r),r.pseudoElement=this._selector,this._scope.animate(s,r)},Ha.prototype.getAnimations=function(){for(var s=this._scope,r=this._selector,o=s.getAnimations({subtree:!0}),d=[],p=0;p<o.length;p++){var g=o[p].effect;g!==null&&g.target===s&&g.pseudoElement===r&&d.push(o[p])}return d},Ha.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function jy(s){return{name:s,group:new Ha("group",s),imagePair:new Ha("image-pair",s),old:new Ha("old",s),new:new Ha("new",s)}}function Ms(s){this._fragmentFiber=s,this._observers=this._eventListeners=null}Ms.prototype.addEventListener=function(s,r,o){var d=null,p=null;if(!(o!=null&&typeof o!="boolean"&&(d=o.signal||null,d!==null&&d.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var g=this._eventListeners;if(Cy(g,s,r,o)===-1){var w=this,T=r;o!=null&&typeof o!="boolean"&&o.once===!0&&(T=function($){w.removeEventListener(s,r,o),typeof r=="function"?r.call(this,$):r.handleEvent($)}),d!==null&&(p=w.removeEventListener.bind(w,s,r,o),d.addEventListener("abort",p,{once:!0}),p=d.removeEventListener.bind(d,"abort",p)),d=Hl(o),g.push({type:s,listener:r,optionsOrUseCapture:o,attachedListener:T,cleanup:p}),v(this._fragmentFiber.child,!1,U3,s,T,d)}this._eventListeners=g}};function U3(s,r,o,d){return N(s).addEventListener(r,o,d),!1}Ms.prototype.removeEventListener=function(s,r,o){var d=this._eventListeners;if(d!==null&&(r=Cy(d,s,r,o),r!==-1)){var p=d[r];o=p.attachedListener;var g=p.cleanup;p=Hl(p.optionsOrUseCapture),v(this._fragmentFiber.child,!1,H3,s,o,p),d.splice(r,1),g!==null&&g()}};function H3(s,r,o,d){return N(s).removeEventListener(r,o,d),!1}function Hl(s){return s!=null&&typeof s!="boolean"&&(s.once===!0||s.signal instanceof AbortSignal)?{capture:s.capture,passive:s.passive}:s}function Ny(s){return s==null?"c=0":typeof s=="boolean"?"c="+(s?"1":"0"):"c="+(s.capture?"1":"0")}function Cy(s,r,o,d){if(s.length===0)return-1;d=Ny(d);for(var p=0;p<s.length;p++){var g=s[p];if(g.type===r&&g.listener===o&&Ny(g.optionsOrUseCapture)===d)return p}return-1}Ms.prototype.dispatchEvent=function(s){var r=b(this._fragmentFiber);if(r===null)return!0;r=N(r);var o=this._eventListeners;if(o!==null&&0<o.length||!s.bubbles){var d=r.nodeType===9?r.createComment(""):document.createTextNode("");if(o)for(var p=0;p<o.length;p++){var g=o[p];d.addEventListener(g.type,g.attachedListener,Hl(g.optionsOrUseCapture))}if(r.appendChild(d),s=d.dispatchEvent(s),o)for(p=0;p<o.length;p++)g=o[p],d.removeEventListener(g.type,g.attachedListener,Hl(g.optionsOrUseCapture));return r.removeChild(d),s}return r.dispatchEvent(s)},Ms.prototype.focus=function(s){v(this._fragmentFiber.child,!0,Ey,s,void 0,void 0)};function Ey(s,r){return s.tag===6?!1:(s=N(s),tE(s,r))}Ms.prototype.focusLast=function(s){var r=[];v(this._fragmentFiber.child,!0,Lm,r,void 0,void 0);for(var o=r.length-1;0<=o&&!Ey(r[o],s);o--);};function Lm(s,r){return r.push(s),!1}Ms.prototype.blur=function(){var s=b(this._fragmentFiber);s!==null&&(s=N(s),s=kc(s).activeElement,s!==null&&v(this._fragmentFiber.child,!1,q3,s,void 0,void 0))};function q3(s,r){return s.tag===6?!1:(s=N(s),s===r||s.contains(r)?(r.blur(),!0):!1)}Ms.prototype.observeUsing=function(s){this._observers===null&&(this._observers=new Set),this._observers.add(s),v(this._fragmentFiber.child,!1,V3,s,void 0,void 0)};function V3(s,r){return s.tag===6||(s=N(s),r.observe(s)),!1}Ms.prototype.unobserveUsing=function(s){var r=this._observers;if(r!==null&&r.has(s)){r.delete(s),v(this._fragmentFiber.child,!1,G3,s,void 0,void 0);for(var o=r=0;o<ai.length;o++){var d=ai[o];d.fragmentInstance===this&&d.observer===s?s.unobserve(d.instance):ai[r++]=d}ai.length=r}};function G3(s,r){return s.tag===6||(s=N(s),r.unobserve(s)),!1}var ai=[],Dm=!1;function Y3(s,r,o){ai.push({fragmentInstance:s,observer:r,instance:o}),Dm||(Dm=!0,nE(function(){Dm=!1;var d=ai;ai=[];for(var p=0;p<d.length;p++){var g=d[p];g.observer.unobserve(g.instance)}}))}Ms.prototype.getClientRects=function(){var s=[];return v(this._fragmentFiber.child,!1,X3,s,void 0,void 0),s};function X3(s,r){if(s.tag===6){s=s.stateNode;var o=s.ownerDocument.createRange();o.selectNodeContents(s),r.push.apply(r,o.getClientRects())}else s=N(s),r.push.apply(r,s.getClientRects());return!1}Ms.prototype.getRootNode=function(s){var r=b(this._fragmentFiber);return r===null?this:N(r).getRootNode(s)},Ms.prototype.compareDocumentPosition=function(s){var r=b(this._fragmentFiber);if(r===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var o=[];v(this._fragmentFiber.child,!1,Lm,o,void 0,void 0);var d=N(r);if(o.length===0){if(o=d,y(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&&(o=r)}r=this._fragmentFiber;var p=d=o.compareDocumentPosition(s);return o===s?p=Node.DOCUMENT_POSITION_CONTAINS:d&Node.DOCUMENT_POSITION_CONTAINED_BY&&(o=_(r)[1],o===null?p=Node.DOCUMENT_POSITION_PRECEDING:(s=N(o).compareDocumentPosition(s),p=s===0||s&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),p|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}r=N(o[0]),p=N(o[o.length-1]);var g=y(this._fragmentFiber)?r.parentElement:d;if(g==null)return Node.DOCUMENT_POSITION_DISCONNECTED;d=g.compareDocumentPosition(r)&Node.DOCUMENT_POSITION_CONTAINED_BY,g=g.compareDocumentPosition(p)&Node.DOCUMENT_POSITION_CONTAINED_BY;var w=r.compareDocumentPosition(s),T=p.compareDocumentPosition(s),$=w&Node.DOCUMENT_POSITION_CONTAINED_BY||T&Node.DOCUMENT_POSITION_CONTAINED_BY;return T=d&&g&&w&Node.DOCUMENT_POSITION_FOLLOWING&&T&Node.DOCUMENT_POSITION_PRECEDING,r=d&&r===s||g&&p===s||$||T?Node.DOCUMENT_POSITION_CONTAINED_BY:!d&&r===s||!g&&p===s?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:w,r&Node.DOCUMENT_POSITION_DISCONNECTED||r&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||Q3(r,this._fragmentFiber,o[0],o[o.length-1],s)?r:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function Q3(s,r,o,d,p){var g=Fi(p);if(s&Node.DOCUMENT_POSITION_CONTAINED_BY){if(o=!!g)e:{for(;g!==null;){if(g.tag===7&&(g===r||g.alternate===r)){o=!0;break e}g=g.return}o=!1}return o}if(s&Node.DOCUMENT_POSITION_CONTAINS){if(g===null)return g=p.ownerDocument,p===g||p===g.documentElement||p===g.body;e:{for(g=r,r=b(r);g!==null;){if(!(g.tag!==5&&g.tag!==3&&g.tag!==27||g!==r&&g.alternate!==r)){g=!0;break e}g=g.return}g=!1}return g}return s&Node.DOCUMENT_POSITION_PRECEDING?((r=!!g)&&!(r=g===o)&&(r=O(o,g,L),r===null?r=!1:(v(r,!0,E,g,o),g=S,S=null,r=g!==null)),r):s&Node.DOCUMENT_POSITION_FOLLOWING?((r=!!g)&&!(r=g===d)&&(r=O(d,g,L),r===null?r=!1:(v(r,!0,R,g,d),g=S,C=S=null,r=g!==null)),r):!1}function Ty(s,r){var o=s.ownerDocument.createRange();o.selectNodeContents(s),s=o.getBoundingClientRect(),window.scrollTo(window.scrollX+s.left,r?window.scrollY+s.top:window.scrollY+s.bottom-window.innerHeight)}Ms.prototype.scrollIntoView=function(s){if(typeof s=="object")throw Error(i(566));var r=[];v(this._fragmentFiber.child,!1,Lm,r,void 0,void 0);var o=s!==!1;if(r.length===0){var d=_(this._fragmentFiber);if(d=o?d[1]||d[0]||b(this._fragmentFiber):d[0]||d[1],d===null)return;if(d.tag===6){s=N(d),Ty(s,o);return}if(d=N(d),d.nodeType!==9){if(d.nodeType===11){o="host"in d?d.host:null,o!==null&&o.scrollIntoView(s);return}d.scrollIntoView(s)}}for(d=o?r.length-1:0;d!==(o?-1:r.length);){var p=r[d];p.tag===6?(p=N(p),Ty(p,o)):N(p).scrollIntoView(s),d+=o?-1:1}};function W3(s,r){return s=N(s),Ay(s,r),!1}function Ay(s,r){s.reactFragments==null&&(s.reactFragments=new Set),s.reactFragments.add(r)}function My(s,r){var o=r._eventListeners;if(o!==null)for(var d=0;d<o.length;d++){var p=o[d];s.addEventListener(p.type,p.attachedListener,Hl(p.optionsOrUseCapture))}s.nodeType!==3&&(o=r._observers,o!==null&&o.forEach(function(g){for(var w=0,T=0;T<ai.length;T++){var $=ai[T];($.fragmentInstance!==r||$.observer!==g||$.instance!==s)&&(ai[w++]=$)}ai.length=w,g.observe(s)}),Ay(s,r))}function K3(s,r){var o=r._eventListeners;if(o!==null)for(var d=0;d<o.length;d++){var p=o[d];s.removeEventListener(p.type,p.attachedListener,Hl(p.optionsOrUseCapture))}s.nodeType!==3&&(o=r._observers,o!==null&&o.forEach(function(g){typeof g.rootMargin=="string"?Y3(r,g,s):g.unobserve(s)}),s.reactFragments!=null&&s.reactFragments.delete(r))}function zm(s){var r=s.firstChild;for(r&&r.nodeType===10&&(r=r.nextSibling);r;){var o=r;switch(r=r.nextSibling,o.nodeName){case"HTML":case"HEAD":case"BODY":zm(o),ul(o);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(o.rel.toLowerCase()==="stylesheet")continue}s.removeChild(o)}}function Z3(s,r,o,d){for(;s.nodeType===1;){var p=o;if(s.nodeName.toLowerCase()!==r.toLowerCase()){if(!d&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(d){if(!s[ya])switch(r){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(g=s.getAttribute("rel"),g==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(g!==p.rel||s.getAttribute("href")!==(p.href==null||p.href===""?null:p.href)||s.getAttribute("crossorigin")!==(p.crossOrigin==null?null:p.crossOrigin)||s.getAttribute("title")!==(p.title==null?null:p.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(g=s.getAttribute("src"),(g!==(p.src==null?null:p.src)||s.getAttribute("type")!==(p.type==null?null:p.type)||s.getAttribute("crossorigin")!==(p.crossOrigin==null?null:p.crossOrigin))&&g&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(r==="input"&&s.type==="hidden"){var g=p.name==null?null:""+p.name;if(p.type==="hidden"&&s.getAttribute("name")===g)return s}else return s;if(s=Us(s.nextSibling),s===null)break}return null}function J3(s,r,o){if(r==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!o||(s=Us(s.nextSibling),s===null))return null;return s}function Ry(s,r){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!r||(s=Us(s.nextSibling),s===null))return null;return s}function $m(s){return s.data==="$?"||s.data==="$~"}function Bm(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function eE(s,r){var o=s.ownerDocument;if(s.data==="$~")s._reactRetry=r;else if(s.data!=="$?"||o.readyState!=="loading")r();else{var d=function(){r(),o.removeEventListener("DOMContentLoaded",d)};o.addEventListener("DOMContentLoaded",d),s._reactRetry=d}}function Us(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 Pm=null;function Oy(s){s=s.nextSibling;for(var r=0;s;){if(s.nodeType===8){var o=s.data;if(o==="/$"||o==="/&"){if(r===0)return Us(s.nextSibling);r--}else o!=="$"&&o!=="$!"&&o!=="$?"&&o!=="$~"&&o!=="&"||r++}s=s.nextSibling}return null}function Ly(s){s=s.previousSibling;for(var r=0;s;){if(s.nodeType===8){var o=s.data;if(o==="$"||o==="$!"||o==="$?"||o==="$~"||o==="&"){if(r===0)return s;r--}else o!=="/$"&&o!=="/&"||r++}s=s.previousSibling}return null}function tE(s,r){function o(){d=!0}if(s.ownerDocument.activeElement===s)return!0;var d=!1;try{s.ownerDocument.addEventListener("focus",o,!0),(s.focus||HTMLElement.prototype.focus).call(s,r)}finally{s.ownerDocument.removeEventListener("focus",o,!0)}return d}function nE(s){yy(function(){yy(function(r){return s(r)})})}function Dy(s,r,o){switch(r=kc(o),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 zy(s,r,o){for(var d in o){var p=o[d];o.hasOwnProperty(d)&&p!=null&&Rt(s,r,d,null,M3,p)}o.dangerouslySetInnerHTML!=null&&(s.textContent=""),s.onclick===Xn&&(s.onclick=null),ul(s)}function Im(s){for(var r=s.attributes;r.length;)s.removeAttributeNode(r[0]);ul(s)}var Hs=new Map,$y=new Set;function jc(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 nr=Re.d;Re.d={f:sE,r:iE,D:rE,C:aE,L:lE,m:oE,X:uE,S:cE,M:dE};function sE(){var s=nr.f(),r=Fd();return s||r}function iE(s){var r=gi(s);r!==null&&r.tag===5&&r.type==="form"?P1(r):nr.r(s)}var ql=typeof document>"u"?null:document;function By(s,r,o){var d=ql;if(d&&typeof r=="string"&&r){var p=ls(r);p='link[rel="'+s+'"][href="'+p+'"]',typeof o=="string"&&(p+='[crossorigin="'+o+'"]'),$y.has(p)||($y.add(p),s={rel:s,crossOrigin:o,href:r},d.querySelector(p)===null&&(r=d.createElement("link"),$n(r,"link",s),ln(r),d.head.appendChild(r)))}}function rE(s){nr.D(s),By("dns-prefetch",s,null)}function aE(s,r){nr.C(s,r),By("preconnect",s,r)}function lE(s,r,o){nr.L(s,r,o);var d=ql;if(d&&s&&r){var p='link[rel="preload"][as="'+ls(r)+'"]';r==="image"&&o&&o.imageSrcSet?(p+='[imagesrcset="'+ls(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(p+='[imagesizes="'+ls(o.imageSizes)+'"]')):p+='[href="'+ls(s)+'"]';var g=p;switch(r){case"style":g=Vl(s);break;case"script":g=Gl(s)}if(!(Hs.has(g)||(s=F({rel:"preload",href:r==="image"&&o&&o.imageSrcSet?void 0:s,as:r},o),Hs.set(g,s),d.querySelector(p)!==null||r==="style"&&d.querySelector(Nc(g))||r==="script"&&d.querySelector(Cc(g))))){var w=d.createElement("link");$n(w,"link",s),r==="style"&&(w[cl]=!0,w.onload=w.onerror=function(){_s(w)}),ln(w),d.head.appendChild(w)}}}function oE(s,r){nr.m(s,r);var o=ql;if(o&&s){var d=r&&typeof r.as=="string"?r.as:"script",p='link[rel="modulepreload"][as="'+ls(d)+'"][href="'+ls(s)+'"]',g=p;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":g=Gl(s)}if(!Hs.has(g)&&(s=F({rel:"modulepreload",href:s},r),Hs.set(g,s),o.querySelector(p)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(Cc(g)))return}d=o.createElement("link"),$n(d,"link",s),ln(d),o.head.appendChild(d)}}}function cE(s,r,o){nr.S(s,r,o);var d=ql;if(d&&s){var p=as(d).hoistableStyles,g=Vl(s);r=r||"default";var w=p.get(g);if(!w){var T={loading:0,preload:null};if(w=d.querySelector(Nc(g)))T.loading=5;else{s=F({rel:"stylesheet",href:s,"data-precedence":r},o),(o=Hs.get(g))&&Fm(s,o);var $=w=d.createElement("link");ln($),$n($,"link",s),$._p=new Promise(function(ee,ae){$.onload=ee,$.onerror=ae}),$.addEventListener("load",function(){T.loading|=1}),$.addEventListener("error",function(){T.loading|=2}),T.loading|=4,Xd(w,r,d)}w={type:"stylesheet",instance:w,count:1,state:T},p.set(g,w)}}}function uE(s,r){nr.X(s,r);var o=ql;if(o&&s){var d=as(o).hoistableScripts,p=Gl(s),g=d.get(p);g||(g=o.querySelector(Cc(p)),g||(s=F({src:s,async:!0},r),(r=Hs.get(p))&&Um(s,r),g=o.createElement("script"),ln(g),$n(g,"link",s),o.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},d.set(p,g))}}function dE(s,r){nr.M(s,r);var o=ql;if(o&&s){var d=as(o).hoistableScripts,p=Gl(s),g=d.get(p);g||(g=o.querySelector(Cc(p)),g||(s=F({src:s,async:!0,type:"module"},r),(r=Hs.get(p))&&Um(s,r),g=o.createElement("script"),ln(g),$n(g,"link",s),o.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},d.set(p,g))}}function Py(s,r,o,d){var p=(p=se.current)?jc(p):null;if(!p)throw Error(i(446));switch(s){case"meta":case"title":return null;case"style":return typeof o.precedence=="string"&&typeof o.href=="string"?(o=Vl(o.href),r=as(p).hoistableStyles,d=r.get(o),d||(d={type:"style",instance:null,count:0,state:null},r.set(o,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(o.rel==="stylesheet"&&typeof o.href=="string"&&typeof o.precedence=="string"){s=Vl(o.href);var g=as(p).hoistableStyles,w=g.get(s);if(w||(p=p.ownerDocument||p,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},g.set(s,w),(g=p.querySelector(Nc(s)))?g._p||(w.instance=g,w.state.loading=5):(g=Hs.get(s),g||(g={rel:"preload",as:"style",href:o.href,crossOrigin:o.crossOrigin,integrity:o.integrity,media:o.media,hrefLang:o.hrefLang,referrerPolicy:o.referrerPolicy},Hs.set(s,g)),hE(p,s,g,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=o.async,o=o.src,typeof o=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(o=Gl(o),r=as(p).hoistableScripts,d=r.get(o),d||(d={type:"script",instance:null,count:0,state:null},r.set(o,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,s))}}function Vl(s){return'href="'+ls(s)+'"'}function Nc(s){return'link[rel="stylesheet"]['+s+"]"}function Iy(s){return F({},s,{"data-precedence":s.precedence,precedence:null})}function hE(s,r,o,d){if(r=s.querySelector('link[rel="preload"][as="style"]['+r+"]")){if(r[cl]!==!0){d.loading=1;return}}else r=s.createElement("link"),r[cl]=!0,r.onload=r.onerror=_s.bind(null,r),$n(r,"link",o),ln(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 Gl(s){return'[src="'+ls(s)+'"]'}function Cc(s){return"script[async]"+s}function Fy(s,r,o){if(r.count++,r.instance===null)switch(r.type){case"style":var d=s.querySelector('style[data-href~="'+ls(o.href)+'"]');if(d)return r.instance=d,ln(d),d;var p=F({},o,{"data-href":o.href,"data-precedence":o.precedence,href:null,precedence:null});return d=(s.ownerDocument||s).createElement("style"),ln(d),$n(d,"style",p),Xd(d,o.precedence,s),r.instance=d;case"stylesheet":p=Vl(o.href);var g=s.querySelector(Nc(p));if(g)return r.state.loading|=4,r.instance=g,ln(g),g;d=Iy(o),(p=Hs.get(p))&&Fm(d,p),g=(s.ownerDocument||s).createElement("link"),ln(g);var w=g;return w._p=new Promise(function(T,$){w.onload=T,w.onerror=$}),$n(g,"link",d),r.state.loading|=4,Xd(g,o.precedence,s),r.instance=g;case"script":return g=Gl(o.src),(p=s.querySelector(Cc(g)))?(r.instance=p,ln(p),p):(d=o,(p=Hs.get(g))&&(d=F({},o),Um(d,p)),s=s.ownerDocument||s,p=s.createElement("script"),ln(p),$n(p,"link",d),s.head.appendChild(p),r.instance=p);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,Xd(d,o.precedence,s));return r.instance}function Xd(s,r,o){for(var d=o.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),p=d.length?d[d.length-1]:null,g=p,w=0;w<d.length;w++){var T=d[w];if(T.dataset.precedence===r)g=T;else if(g!==p)break}g?g.parentNode.insertBefore(s,g.nextSibling):(r=o.nodeType===9?o.head:o,r.insertBefore(s,r.firstChild))}function Fm(s,r){s.crossOrigin==null&&(s.crossOrigin=r.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=r.referrerPolicy),s.title==null&&(s.title=r.title)}function Um(s,r){s.crossOrigin==null&&(s.crossOrigin=r.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=r.referrerPolicy),s.integrity==null&&(s.integrity=r.integrity)}var Qd=null;function Uy(s,r,o){if(Qd===null){var d=new Map,p=Qd=new Map;p.set(o,d)}else p=Qd,d=p.get(o),d||(d=new Map,p.set(o,d));if(d.has(s))return d;for(d.set(s,null),o=o.getElementsByTagName(s),p=0;p<o.length;p++){var g=o[p];if(!(g[ya]||g[dn]||s==="link"&&g.getAttribute("rel")==="stylesheet")&&g.namespaceURI!=="http://www.w3.org/2000/svg"){var w=g.getAttribute(r)||"";w=s+w;var T=d.get(w);T?T.push(g):d.set(w,[g])}}return d}function Hm(s,r,o){s=s.ownerDocument||s,s.head.insertBefore(o,r==="title"?s.querySelector("head > title"):null)}function fE(s,r,o){if(o===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 Hy(s,r){return s==="img"&&r.src!=null&&r.src!==""&&r.onLoad==null&&r.loading!=="lazy"}function qy(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function Vy(s){return(s.width||100)*(s.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function Gy(s,r){typeof r.decode=="function"&&(s.imgCount++,r.complete||(s.imgBytes+=Vy(r),s.suspenseyImages.push(r)),s=gE.bind(s),r.decode().then(s,s))}function pE(s,r,o,d){if(o.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(o.state.loading&4)===0){if(o.instance===null){var p=Vl(d.href),g=r.querySelector(Nc(p));if(g){r=g._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(s.count++,s=Ec.bind(s),r.then(s,s)),o.state.loading|=4,o.instance=g,ln(g);return}g=r.ownerDocument||r,d=Iy(d),(p=Hs.get(p))&&Fm(d,p),g=g.createElement("link"),ln(g);var w=g;w._p=new Promise(function(T,$){w.onload=T,w.onerror=$}),$n(g,"link",d),o.instance=g}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(o,r),(r=o.state.preload)&&(o.state.loading&3)===0&&(s.count++,o=Ec.bind(s),r.addEventListener("load",o),r.addEventListener("error",o))}}var Wd=0;function mE(s,r){return s.stylesheets&&s.count===0&&Zd(s,s.stylesheets),0<s.count||0<s.imgCount?function(o){var d=setTimeout(function(){if(s.stylesheets&&Zd(s,s.stylesheets),s.unsuspend){var g=s.unsuspend;s.unsuspend=null,g()}},6e4+r);0<s.imgBytes&&Wd===0&&(Wd=62500*O3());var p=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&Zd(s,s.stylesheets),s.unsuspend)){var g=s.unsuspend;s.unsuspend=null,g()}},(s.imgBytes>Wd?50:800)+r);return s.unsuspend=o,function(){s.unsuspend=null,clearTimeout(d),clearTimeout(p)}}:null}function Yy(s){if(s.count===0&&(s.imgCount===0||!s.waitingForImages)){if(s.stylesheets)Zd(s,s.stylesheets);else if(s.unsuspend){var r=s.unsuspend;s.unsuspend=null,r()}}}function Ec(){this.count--,Yy(this)}function gE(){this.imgCount--,Yy(this)}var Kd=null;function Zd(s,r){s.stylesheets=null,s.unsuspend!==null&&(s.count++,Kd=new Map,r.forEach(xE,s),Kd=null,Ec.call(s))}function xE(s,r){if(!(r.state.loading&4)){var o=Kd.get(s);if(o)var d=o.get(null);else{o=new Map,Kd.set(s,o);for(var p=s.querySelectorAll("link[data-precedence],style[data-precedence]"),g=0;g<p.length;g++){var w=p[g];(w.nodeName==="LINK"||w.getAttribute("media")!=="not all")&&(o.set(w.dataset.precedence,w),d=w)}d&&o.set(null,d)}p=r.instance,w=p.getAttribute("data-precedence"),g=o.get(w)||d,g===d&&o.set(null,p),o.set(w,p),this.count++,d=Ec.bind(this),p.addEventListener("load",d),p.addEventListener("error",d),g?g.parentNode.insertBefore(p,g.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(p,s.firstChild)),r.state.loading|=4}}var Yl={$$typeof:q,Provider:null,Consumer:null,_currentValue:It,_currentValue2:It,_threadCount:0};function vE(s,r,o,d,p,g,w,T,$){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=Ii(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ii(0),this.hiddenUpdates=Ii(null),this.identifierPrefix=d,this.onUncaughtError=p,this.onCaughtError=g,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=$,this.transitionTypes=null,this.incompleteTransitions=new Map}function Xy(s,r,o,d,p,g,w,T,$,ee,ae,pe){return s=new vE(s,r,o,w,$,ee,ae,pe,T),r=1,g===!0&&(r|=24),g=os(3,null,null,r),s.current=g,g.stateNode=s,r=ip(),r.refCount++,s.pooledCache=r,r.refCount++,g.memoizedState={element:d,isDehydrated:o,cache:r},op(g),s}function Qy(s){return s?(s=bl,s):bl}function Wy(s,r,o,d,p,g){p=Qy(p),d.context===null?d.context=p:d.pendingContext=p,d=Or(r),d.payload={element:o},g=g===void 0?null:g,g!==null&&(d.callback=g),o=Lr(s,d,r),o!==null&&(hs(o,s,r),rc(o,s,r))}function Ky(s,r){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var o=s.retryLane;s.retryLane=o!==0&&o<r?o:r}}function qm(s,r){Ky(s,r),(s=s.alternate)&&Ky(s,r)}function Zy(s){if(s.tag===13||s.tag===31){var r=Na(s,67108864);r!==null&&hs(r,s,67108864),qm(s,67108864)}}function Jy(s){if(s.tag===13||s.tag===31){var r=As();r=Lo(r);var o=Na(s,r);o!==null&&hs(o,s,r),qm(s,r)}}var Xl=!0;function bE(s,r,o,d){var p=Ce.T;Ce.T=null;var g=Re.p;try{Re.p=2,Vm(s,r,o,d)}finally{Re.p=g,Ce.T=p}}function yE(s,r,o,d){var p=Ce.T;Ce.T=null;var g=Re.p;try{Re.p=8,Vm(s,r,o,d)}finally{Re.p=g,Ce.T=p}}function Vm(s,r,o,d){if(Xl){var p=Gm(d);if(p===null)Nm(s,r,d,Jd,o),t_(s,d);else if(wE(p,s,r,o,d))d.stopPropagation();else if(t_(s,d),r&4&&-1<_E.indexOf(s)){for(;p!==null;){var g=gi(p);if(g!==null)switch(g.tag){case 3:if(g=g.stateNode,g.current.memoizedState.isDehydrated){var w=Qs(g.pendingLanes);if(w!==0){var T=g;for(T.pendingLanes|=2,T.entangledLanes|=2;w;){var $=1<<31-en(w);T.entanglements[1]|=$,w&=~$}Ni(g),(Et&6)===0&&(Bd=sn()+500,_c(0))}}break;case 31:case 13:T=Na(g,2),T!==null&&hs(T,g,2),Fd(),qm(g,2)}if(g=Gm(d),g===null&&Nm(s,r,d,Jd,o),g===p)break;p=g}p!==null&&d.stopPropagation()}else Nm(s,r,d,null,o)}}function Gm(s){return s=pl(s),Ym(s)}var Jd=null;function Ym(s){if(Jd=null,s=Fi(s),s!==null){var r=c(s);if(r===null)s=null;else{var o=r.tag;if(o===13){if(s=u(r),s!==null)return s;s=null}else if(o===31){if(s=h(r),s!==null)return s;s=null}else if(o===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;s=null}else r!==s&&(s=null)}}return Jd=s,null}function e_(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(xr()){case Bi:return 2;case le:return 8;case xe:case we:return 32;case rt:return 268435456;default:return 32}default:return 32}}var Xm=!1,Gr=null,Yr=null,Xr=null,Tc=new Map,Ac=new Map,Qr=[],_E="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 t_(s,r){switch(s){case"focusin":case"focusout":Gr=null;break;case"dragenter":case"dragleave":Yr=null;break;case"mouseover":case"mouseout":Xr=null;break;case"pointerover":case"pointerout":Tc.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ac.delete(r.pointerId)}}function Mc(s,r,o,d,p,g){return s===null||s.nativeEvent!==g?(s={blockedOn:r,domEventName:o,eventSystemFlags:d,nativeEvent:g,targetContainers:[p]},r!==null&&(r=gi(r),r!==null&&Zy(r)),s):(s.eventSystemFlags|=d,r=s.targetContainers,p!==null&&r.indexOf(p)===-1&&r.push(p),s)}function wE(s,r,o,d,p){switch(r){case"focusin":return Gr=Mc(Gr,s,r,o,d,p),!0;case"dragenter":return Yr=Mc(Yr,s,r,o,d,p),!0;case"mouseover":return Xr=Mc(Xr,s,r,o,d,p),!0;case"pointerover":var g=p.pointerId;return Tc.set(g,Mc(Tc.get(g)||null,s,r,o,d,p)),!0;case"gotpointercapture":return g=p.pointerId,Ac.set(g,Mc(Ac.get(g)||null,s,r,o,d,p)),!0}return!1}function n_(s){var r=Fi(s.target);if(r!==null){var o=c(r);if(o!==null){if(r=o.tag,r===13){if(r=u(o),r!==null){s.blockedOn=r,rs(s.priority,function(){Jy(o)});return}}else if(r===31){if(r=h(o),r!==null){s.blockedOn=r,rs(s.priority,function(){Jy(o)});return}}else if(r===3&&o.stateNode.current.memoizedState.isDehydrated){s.blockedOn=o.tag===3?o.stateNode.containerInfo:null;return}}}s.blockedOn=null}function eh(s){if(s.blockedOn!==null)return!1;for(var r=s.targetContainers;0<r.length;){var o=Gm(s.nativeEvent);if(o===null){o=s.nativeEvent;var d=new o.constructor(o.type,o);Sr=d,o.target.dispatchEvent(d),Sr=null}else return r=gi(o),r!==null&&Zy(r),s.blockedOn=o,!1;r.shift()}return!0}function s_(s,r,o){eh(s)&&o.delete(r)}function SE(){Xm=!1,Gr!==null&&eh(Gr)&&(Gr=null),Yr!==null&&eh(Yr)&&(Yr=null),Xr!==null&&eh(Xr)&&(Xr=null),Tc.forEach(s_),Ac.forEach(s_)}function th(s,r){s.blockedOn===r&&(s.blockedOn=null,Xm||(Xm=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,SE)))}var nh=null;function i_(s){nh!==s&&(nh=s,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){nh===s&&(nh=null);for(var r=0;r<s.length;r+=3){var o=s[r],d=s[r+1],p=s[r+2];if(typeof d!="function"){if(Ym(d||o)===null)continue;break}var g=gi(o);g!==null&&(s.splice(r,3),r-=3,Tp(g,{pending:!0,data:p,method:o.method,action:d},d,p))}}))}function Ql(s){function r($){return th($,s)}Gr!==null&&th(Gr,s),Yr!==null&&th(Yr,s),Xr!==null&&th(Xr,s),Tc.forEach(r),Ac.forEach(r);for(var o=0;o<Qr.length;o++){var d=Qr[o];d.blockedOn===s&&(d.blockedOn=null)}for(;0<Qr.length&&(o=Qr[0],o.blockedOn===null);)n_(o),o.blockedOn===null&&Qr.shift();if(o=(s.ownerDocument||s).$$reactFormReplay,o!=null)for(d=0;d<o.length;d+=3){var p=o[d],g=o[d+1],w=p[Cn]||null;if(typeof g=="function")w||i_(o);else if(w){var T=null;if(g&&g.hasAttribute("formAction")){if(p=g,w=g[Cn]||null)T=w.formAction;else if(Ym(p)!==null)continue}else T=w.action;typeof T=="function"?o[d+1]=T:(o.splice(d,3),d-=3),i_(o)}}}function r_(){function s(g){g.canIntercept&&g.info==="react-transition"&&g.intercept({handler:function(){return new Promise(function(w){return p=w})},focusReset:"manual",scroll:"manual"})}function r(){p!==null&&(p(),p=null),d||setTimeout(o,20)}function o(){if(!d&&!navigation.transition){var g=navigation.currentEntry;g&&g.url!=null&&navigation.navigate(g.url,{state:g.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var d=!1,p=null;return navigation.addEventListener("navigate",s),navigation.addEventListener("navigatesuccess",r),navigation.addEventListener("navigateerror",r),setTimeout(o,100),function(){d=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",r),navigation.removeEventListener("navigateerror",r),p!==null&&(p(),p=null)}}}function Qm(s){this._internalRoot=s}sh.prototype.render=Qm.prototype.render=function(s){var r=this._internalRoot;if(r===null)throw Error(i(409));var o=r.current,d=As();Wy(o,d,s,r,null,null)},sh.prototype.unmount=Qm.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var r=s.containerInfo;Wy(s.current,2,null,s,null,null),Fd(),r[mi]=null}};function sh(s){this._internalRoot=s}sh.prototype.unstable_scheduleHydration=function(s){if(s){var r=ba();s={blockedOn:null,target:s,priority:r};for(var o=0;o<Qr.length&&r!==0&&r<Qr[o].priority;o++);Qr.splice(o,0,s),o===0&&n_(s)}};var a_=t.version;if(a_!=="19.3.0")throw Error(i(527,a_,"19.3.0"));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=m(r),s=s!==null?x(s):null,s=s===null?null:s.stateNode,s};var kE={bundleType:0,version:"19.3.0",rendererPackageName:"react-dom",currentDispatcherRef:Ce,reconcilerVersion:"19.3.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ih=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ih.isDisabled&&ih.supportsFiber)try{Nn=ih.inject(kE),xt=ih}catch{}}return Oc.createRoot=function(s,r){if(!a(s))throw Error(i(299));var o=!1,d="",p=Q1,g=W1,w=K1;return r!=null&&(r.unstable_strictMode===!0&&(o=!0),r.identifierPrefix!==void 0&&(d=r.identifierPrefix),r.onUncaughtError!==void 0&&(p=r.onUncaughtError),r.onCaughtError!==void 0&&(g=r.onCaughtError),r.onRecoverableError!==void 0&&(w=r.onRecoverableError)),r=Xy(s,1,!1,null,null,o,d,null,p,g,w,r_),s[mi]=r.current,jm(s),new Qm(r)},Oc.hydrateRoot=function(s,r,o){if(!a(s))throw Error(i(299));var d=!1,p="",g=Q1,w=W1,T=K1,$=null;return o!=null&&(o.unstable_strictMode===!0&&(d=!0),o.identifierPrefix!==void 0&&(p=o.identifierPrefix),o.onUncaughtError!==void 0&&(g=o.onUncaughtError),o.onCaughtError!==void 0&&(w=o.onCaughtError),o.onRecoverableError!==void 0&&(T=o.onRecoverableError),o.formState!==void 0&&($=o.formState)),r=Xy(s,1,!0,r,o??null,d,p,$,g,w,T,r_),r.context=Qy(null),o=r.current,d=As(),d=Lo(d),p=Or(d),p.callback=null,Lr(o,p,d),o=d,r.current.lanes=o,fi(r,o),Ni(r),s[mi]=r.current,jm(s),new sh(r)},Oc.version="19.3.0",Oc}var v_;function $E(){if(v_)return Zm.exports;v_=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(),Zm.exports=zE(),Zm.exports}var BE=$E();const b_=e=>{let t;const n=new Set,i=(m,x)=>{const v=typeof m=="function"?m(t):m;if(!Object.is(v,t)){const b=t;t=x??(typeof v!="object"||v===null)?v:Object.assign({},t,v),n.forEach(y=>y(t,b))}},a=()=>t,h={setState:i,getState:a,getInitialState:()=>f,subscribe:m=>(n.add(m),()=>n.delete(m))},f=t=e(i,a,h);return h},PE=(e=>e?b_(e):b_),IE=e=>e;function FE(e,t=IE){const n=rh.useSyncExternalStore(e.subscribe,rh.useCallback(()=>t(e.getState()),[e,t]),rh.useCallback(()=>t(e.getInitialState()),[e,t]));return rh.useDebugValue(n),n}const y_=e=>{const t=PE(e),n=i=>FE(t,i);return Object.assign(n,t),n},UE=(e=>e?y_(e):y_),h0="companion_auth_token";function __(){return typeof window>"u"?null:localStorage.getItem(h0)||null}const HE=e=>({authToken:__(),isAuthenticated:__()!==null,setAuthToken:t=>{localStorage.setItem(h0,t),e({authToken:t,isAuthenticated:!0})},logout:()=>{localStorage.removeItem(h0),e({authToken:null,isAuthenticated:!1})}});function Vt(e,t){if(!e.has(t))return e;const n=new Map(e);return n.delete(t),n}function qE(e,t){if(!e.has(t))return e;const n=new Set(e);return n.delete(t),n}function VE(){if(typeof window>"u")return new Map;try{return new Map(JSON.parse(localStorage.getItem("cc-session-names")||"[]"))}catch{return new Map}}function GE(){return typeof window>"u"?null:localStorage.getItem("cc-current-session")||null}function YE(){if(typeof window>"u")return new Set;try{return new Set(JSON.parse(localStorage.getItem("cc-collapsed-projects")||"[]"))}catch{return new Set}}const XE=e=>({sessions:new Map,sdkSessions:[],currentSessionId:GE(),connectionStatus:new Map,cliConnected:new Map,cliReconnecting:new Map,sessionStatus:new Map,previousPermissionMode:new Map,sessionNames:VE(),recentlyRenamed:new Set,prStatus:new Map,linkedLinearIssues:new Map,mcpServers:new Map,rateLimit:new Map,collapsedProjects:YE(),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),c=a.get(t);return c&&a.set(t,{...c,...n}),{sessions:a}}),removeSession:t=>e(n=>{const i=Vt(n.sessionNames,t);return localStorage.setItem("cc-session-names",JSON.stringify(Array.from(i.entries()))),n.currentSessionId===t&&localStorage.removeItem("cc-current-session"),{sessions:Vt(n.sessions,t),connectionStatus:Vt(n.connectionStatus,t),cliConnected:Vt(n.cliConnected,t),cliReconnecting:Vt(n.cliReconnecting,t),sessionStatus:Vt(n.sessionStatus,t),previousPermissionMode:Vt(n.previousPermissionMode,t),sessionNames:i,recentlyRenamed:qE(n.recentlyRenamed,t),mcpServers:Vt(n.mcpServers,t),rateLimit:Vt(n.rateLimit,t),prStatus:Vt(n.prStatus,t),linkedLinearIssues:Vt(n.linkedLinearIssues,t),sdkSessions:n.sdkSessions.filter(a=>a.sessionId!==t),currentSessionId:n.currentSessionId===t?null:n.currentSessionId,messages:Vt(n.messages,t),streaming:Vt(n.streaming,t),streamingStartedAt:Vt(n.streamingStartedAt,t),streamingOutputTokens:Vt(n.streamingOutputTokens,t),pendingPermissions:Vt(n.pendingPermissions,t),aiResolvedPermissions:Vt(n.aiResolvedPermissions,t),sessionTasks:Vt(n.sessionTasks,t),changedFilesTick:Vt(n.changedFilesTick,t),gitChangedFilesCount:Vt(n.gitChangedFilesCount,t),sessionProcesses:Vt(n.sessionProcesses,t),toolProgress:Vt(n.toolProgress,t),toolActivity:Vt(n.toolActivity,t),diffPanelSelectedFile:Vt(n.diffPanelSelectedFile,t),chatTabReentryTickBySession:Vt(n.chatTabReentryTickBySession,t)}}),setSdkSessions:t=>e({sdkSessions:t}),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),c=a.get(t);return c?(a.set(t,{...c,...n}),{sessions:a}):{}}),setSessionMagicUi:(t,n)=>e(i=>{const a=new Map(i.sessions),c=a.get(t);return c?(a.set(t,{...c,magicUiActive:n}),{sessions:a}):{}})}),QE=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 c=new Map(i.messages);return c.set(t,[...a,n]),{messages:c}}),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),c=[...a.get(t)||[]];for(let u=c.length-1;u>=0;u--)if(c[u].role==="assistant"){c[u]=n(c[u]);break}return a.set(t,c),{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),c=new Map(i.streamingOutputTokens);return n===null?(a.delete(t),c.delete(t)):(n.startedAt!==void 0&&a.set(t,n.startedAt),n.outputTokens!==void 0&&c.set(t,n.outputTokens)),{streamingStartedAt:a,streamingOutputTokens:c}}),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}})}),WE=e=>({pendingPermissions:new Map,aiResolvedPermissions:new Map,addPermission:(t,n)=>e(i=>{const a=new Map(i.pendingPermissions),c=new Map(a.get(t)||[]);return c.set(n.request_id,n),a.set(t,c),{pendingPermissions:a}}),removePermission:(t,n)=>e(i=>{const a=new Map(i.pendingPermissions),c=a.get(t);if(c){const u=new Map(c);u.delete(n),a.set(t,u)}return{pendingPermissions:a}}),addAiResolvedPermission:(t,n)=>e(i=>{const a=new Map(i.aiResolvedPermissions),c=[...a.get(t)||[],n];return c.length>50&&c.splice(0,c.length-50),a.set(t,c),{aiResolvedPermissions:a}}),clearAiResolvedPermissions:t=>e(n=>{const i=new Map(n.aiResolvedPermissions);return i.delete(t),{aiResolvedPermissions:i}})}),KE=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),c=[...a.get(t)||[],n];return a.set(t,c),{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 c=new Map(a.sessionTasks),u=c.get(t);return u&&c.set(t,u.map(h=>h.id===n?{...h,...i}:h)),{sessionTasks:c}}),addProcess:(t,n)=>e(i=>{const a=new Map(i.sessionProcesses),c=[...a.get(t)||[],n];return a.set(t,c),{sessionProcesses:a}}),updateProcess:(t,n,i)=>e(a=>{const c=new Map(a.sessionProcesses),u=c.get(t);return u&&c.set(t,u.map(h=>h.taskId===n?{...h,...i}:h)),{sessionProcesses:c}}),updateProcessByToolUseId:(t,n,i)=>e(a=>{const c=new Map(a.sessionProcesses),u=c.get(t);return u&&c.set(t,u.map(h=>h.toolUseId===n?{...h,...i}:h)),{sessionProcesses:c}}),addBackgroundAgent:(t,n)=>e(i=>{const a=new Map(i.sessionBackgroundAgents),c=[...a.get(t)||[],n];return a.set(t,c),{sessionBackgroundAgents:a}}),updateBackgroundAgent:(t,n,i)=>e(a=>{const c=new Map(a.sessionBackgroundAgents),u=c.get(t);return u&&c.set(t,u.map(h=>h.toolUseId===n?{...h,...i}:h)),{sessionBackgroundAgents:c}}),bumpChangedFilesTick:t=>e(n=>{const i=new Map(n.changedFilesTick);return i.set(t,(i.get(t)??0)+1),{changedFilesTick:i}}),setGitChangedFilesCount:(t,n)=>e(i=>{const a=new Map(i.gitChangedFilesCount);return a.set(t,n),{gitChangedFilesCount:a}}),setToolProgress:(t,n,i)=>e(a=>{const c=new Map(a.toolProgress),u=new Map(c.get(t)||[]);return u.set(n,i),c.set(t,u),{toolProgress:c}}),clearToolProgress:(t,n)=>e(i=>{const a=new Map(i.toolProgress);if(n){const c=a.get(t);if(c){const u=new Map(c);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),c=[...a.get(t)||[]],u=c.findIndex(h=>h.toolUseId===n.toolUseId);if(u>=0){const h=c[u];c[u]={...h,...n,startedAt:h.startedAt,completedAt:n.completedAt??h.completedAt,elapsedSeconds:Math.max(h.elapsedSeconds,n.elapsedSeconds),isError:h.isError||n.isError}}else c.push(n);return a.set(t,c),{toolActivity:a}}),updateToolActivity:(t,n,i)=>e(a=>{const c=new Map(a.toolActivity),u=c.get(t);return u&&c.set(t,u.map(h=>h.toolUseId===n?{...h,...i}:h)),{toolActivity:c}})}),pr=[{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"]}],ZE=pr.map(e=>e.id),L2="cc-task-panel-config";function f0(){return{order:[...ZE],enabled:Object.fromEntries(pr.map(e=>[e.id,!0]))}}function JE(){if(typeof window>"u")return f0();try{const e=localStorage.getItem(L2);if(e){const t=JSON.parse(e),n=new Set(t.order);for(const a of pr)n.has(a.id)||(t.order.push(a.id),t.enabled[a.id]=!0);const i=new Set(pr.map(a=>a.id));return t.order=t.order.filter(a=>i.has(a)),t}}catch{}return f0()}function ah(e){try{localStorage.setItem(L2,JSON.stringify(e))}catch{}}function e4(){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 t4(){if(typeof window>"u")return!0;const e=localStorage.getItem("cc-notification-sound");return e!==null?e==="true":!0}function n4(){if(typeof window>"u")return!1;const e=localStorage.getItem("cc-notification-desktop");return e!==null?e==="true":!1}function D2(){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 s4(){if(typeof window>"u")return"standard";const e=window.localStorage.getItem("cc-density");return e==="standard"||e==="compact"?e:"standard"}const i4=e=>({darkMode:e4(),notificationSound:t4(),notificationDesktop:n4(),sidebarOpen:typeof window<"u"?window.innerWidth>=768:!0,taskPanelOpen:typeof window<"u"?window.innerWidth>=1024:!0,taskPanelConfig:JE(),taskPanelConfigMode:!1,homeResetKey:0,publicUrl:"",magicUiAvailable:!1,activeTab:"chat",chatTabReentryTickBySession:new Map,diffPanelSelectedFile:new Map,diffBase:D2(),density:s4(),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 ah(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 c={...n.taskPanelConfig,order:i};return ah(c),{taskPanelConfig:c}}),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 c={...n.taskPanelConfig,order:i};return ah(c),{taskPanelConfig:c}}),resetTaskPanelConfig:()=>{const t=f0();ah(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 z2(){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 r4=e=>({quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalPlacement:z2(),quickTerminalNextHostIndex:1,quickTerminalNextDockerIndex:1,terminalOpen:!1,terminalCwd:null,terminalId:null,setQuickTerminalOpen:t=>e({quickTerminalOpen:t}),openQuickTerminal:t=>e(n=>{if(t.reuseIfExists){const m=n.quickTerminalTabs.find(x=>x.cwd===t.cwd&&x.containerId===t.containerId);if(m)return{quickTerminalOpen:!0,activeQuickTerminalTabId:m.id}}const i=t.target==="docker",a=n.quickTerminalNextHostIndex,c=n.quickTerminalNextDockerIndex,u=i?a:a+1,h=i?c+1:c,f={id:`${t.target}-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,label:i?`Docker ${c}`: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 c;const i=n.quickTerminalTabs.filter(u=>u.id!==t),a=n.activeQuickTerminalTabId===t?((c=i[0])==null?void 0:c.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 a4(){return typeof window>"u"?null:localStorage.getItem("cc-update-dismissed")||null}const l4=e=>({updateInfo:null,updateDismissedVersion:a4(),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(c=>c.step===t.step);if(a>=0){const c=[...i];return c[a]=t,{creationProgress:c}}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})}),o4=e=>({magicUiState:new Map,setMagicUiState:(t,n)=>e(i=>{const a=i.magicUiState.get(t);if(a&&a.version>n.version)return{};const c=new Map(i.magicUiState);return c.set(t,n),{magicUiState:c}}),clearMagicUiState:t=>e(n=>{if(!n.magicUiState.has(t))return{};const i=new Map(n.magicUiState);return i.delete(t),{magicUiState:i}})}),K=UE((...e)=>({...HE(...e),...XE(...e),...QE(...e),...WE(...e),...KE(...e),...i4(...e),...r4(...e),...l4(...e),...o4(...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:D2(),quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalPlacement:z2(),quickTerminalNextHostIndex:1,quickTerminalNextDockerIndex:1,terminalOpen:!1,terminalCwd:null,terminalId:null})}})),c4=Object.freeze(Object.defineProperty({__proto__:null,useStore:K},Symbol.toStringTag,{value:"Module"})),u4="Your Claude login has expired or is invalid — re-authenticate (run `claude login` in a terminal), then use Reconnect to resume this session.",d4=/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 h4(e){return d4.test(e)}function f4(e){return e.is_error?e.api_error_status===401||e.api_error_status===403?!0:h4(`${e.result??""} ${(e.errors??[]).join(" ")}`):!1}const w_=["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"],S_=["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 k_(){const e=w_[Math.floor(Math.random()*w_.length)],t=S_[Math.floor(Math.random()*S_.length)];return`${e} ${t}`}function $2(e){for(let t=0;t<100;t++){const n=k_();if(!e.has(n))return n}return k_()}let ng=null;function p4(){return ng||(ng=new AudioContext),ng}function m4(){try{const e=p4();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(),c=e.createGain();a.type="sine",a.frequency.setValueAtTime(783.99,t+.15),c.gain.setValueAtTime(.001,t),c.gain.setValueAtTime(.3,t+.15),c.gain.exponentialRampToValueAtTime(.001,t+.5),a.connect(c),c.connect(e.destination),a.start(t+.15),a.stop(t+.5)}catch{}}class B2{diff(t,n,i={}){let a;typeof i=="function"?(a=i,i={}):"callback"in i&&(a=i.callback);const c=this.castInput(t,i),u=this.castInput(n,i),h=this.removeEmpty(this.tokenize(c,i)),f=this.removeEmpty(this.tokenize(u,i));return this.diffWithOptionsObj(h,f,i,a)}diffWithOptionsObj(t,n,i,a){var c;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 m=1,x=h+f;i.maxEditLength!=null&&(x=Math.min(x,i.maxEditLength));const v=(c=i.timeout)!==null&&c!==void 0?c:1/0,b=Date.now()+v,y=[{oldPos:-1,lastComponent:void 0}];let _=this.extractCommon(y[0],n,t,0,i);if(y[0].oldPos+1>=f&&_+1>=h)return u(this.buildValues(y[0].lastComponent,n,t));let j=-1/0,N=1/0;const S=()=>{for(let C=Math.max(j,-m);C<=Math.min(N,m);C+=2){let E;const R=y[C-1],L=y[C+1];R&&(y[C-1]=void 0);let O=!1;if(L){const D=L.oldPos-C;O=L&&0<=D&&D<h}const F=R&&R.oldPos+1<f;if(!O&&!F){y[C]=void 0;continue}if(!F||O&&R.oldPos<L.oldPos?E=this.addToPath(L,!0,!1,0,i):E=this.addToPath(R,!1,!0,1,i),_=this.extractCommon(E,n,t,C,i),E.oldPos+1>=f&&_+1>=h)return u(this.buildValues(E.lastComponent,n,t))||!0;y[C]=E,E.oldPos+1>=f&&(N=Math.min(N,C-1)),_+1>=h&&(j=Math.max(j,C+1))}m++};if(a)(function C(){setTimeout(function(){if(m>x||Date.now()>b)return a(void 0);S()||C()},0)})();else for(;m<=x&&Date.now()<=b;){const C=S();if(C)return C}}addToPath(t,n,i,a,c){const u=t.lastComponent;return u&&!c.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,c){const u=n.length,h=i.length;let f=t.oldPos,m=f-a,x=0;for(;m+1<u&&f+1<h&&this.equals(i[f+1],n[m+1],c);)m++,f++,x++,c.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return x&&!c.oneChangePerToken&&(t.lastComponent={count:x,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=f,m}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 c;for(;t;)a.push(t),c=t.previousComponent,delete t.previousComponent,t=c;a.reverse();const u=a.length;let h=0,f=0,m=0;for(;h<u;h++){const x=a[h];if(x.removed)x.value=this.join(i.slice(m,m+x.count)),m+=x.count;else{if(!x.added&&this.useLongestToken){let v=n.slice(f,f+x.count);v=v.map(function(b,y){const _=i[m+y];return _.length>b.length?_:b}),x.value=this.join(v)}else x.value=this.join(n.slice(f,f+x.count));f+=x.count,x.added||(m+=x.count)}}return a}}function j_(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 N_(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 p0(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 m0(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 Lc(e,t){return p0(e,t,"")}function lh(e,t){return m0(e,t,"")}function C_(e,t){return t.slice(0,g4(e,t))}function g4(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 c=0;a[0]=0;for(let u=1;u<i;u++){for(t[u]==t[c]?a[u]=a[c]:a[u]=c;c>0&&t[u]!=t[c];)c=a[c];t[u]==t[c]&&c++}c=0;for(let u=n;u<e.length;u++){for(;c>0&&e[u]!=t[c];)c=a[c];e[u]==t[c]&&c++}return c}function P2(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 g0(e,t){if(t)return Jc(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function ro(e,t){if(t)return Jc(e,t)[0];const n=e.match(/^\s*/);return n?n[0]:""}function Jc(e,t){if(!t)return[ro(e),g0(e)];if(t.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');const n=P2(e,t),i=n[0],a=n[n.length-1],c=/\s/.test(i)?i:"",u=/\s/.test(a)?a:"";return[c,u]}const E_="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}",x4=new RegExp(`[${E_}]+|\\s+|[^${E_}]`,"ug");class v4 extends B2{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=P2(t,u)}else i=t.match(x4)||[];const a=[];let c=null;return i.forEach(u=>{/\s/.test(u)?c==null?a.push(u):a.push(a.pop()+u):c!=null&&/\s/.test(c)?a[a.length-1]==c?a.push(a.pop()+u):a.push(c+u):a.push(u),c=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,c=null;return t.forEach(u=>{u.added?a=u:u.removed?c=u:((a||c)&&T_(i,c,a,u,n.intlSegmenter),i=u,a=null,c=null)}),(a||c)&&T_(i,c,a,null,n.intlSegmenter),t}}const b4=new v4;function y4(e,t,n){return b4.diff(e,t,n)}function T_(e,t,n,i,a){if(t&&n){const[c,u]=Jc(t.value,a),[h,f]=Jc(n.value,a);if(e){const m=j_(c,h);e.value=m0(e.value,h,m),t.value=Lc(t.value,m),n.value=Lc(n.value,m)}if(i){const m=N_(u,f);i.value=p0(i.value,f,m),t.value=lh(t.value,m),n.value=lh(n.value,m)}}else if(n){if(e){const c=ro(n.value,a);n.value=n.value.substring(c.length)}if(i){const c=ro(i.value,a);i.value=i.value.substring(c.length)}}else if(e&&i){const c=ro(i.value,a),[u,h]=Jc(t.value,a),f=j_(c,u);t.value=Lc(t.value,f);const m=N_(Lc(c,f),h);t.value=lh(t.value,m),i.value=p0(i.value,c,m),e.value=m0(e.value,c,c.slice(0,c.length-m.length))}else if(i){const c=ro(i.value,a),u=g0(t.value,a),h=C_(u,c);t.value=lh(t.value,h)}else if(e){const c=g0(e.value,a),u=ro(t.value,a),h=C_(c,u);t.value=Lc(t.value,h)}}class _4 extends B2{constructor(){super(...arguments),this.tokenize=S4}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 w4=new _4;function A_(e,t,n){return w4.diff(e,t,n)}function S4(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 c=i[a];a%2&&!t.newlineIsToken?n[n.length-1]+=c:n.push(c)}return n}function k4(e,t,n,i,a,c,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:x}=h;A_(n,i,Object.assign(Object.assign({},h),{callback:v=>{const b=m(v);x(b)}}))}else return m(A_(n,i,h));function m(x){if(!x)return;x.push({value:"",lines:[]});function v(C){return C.map(function(E){return" "+E})}const b=[];let y=0,_=0,j=[],N=1,S=1;for(let C=0;C<x.length;C++){const E=x[C],R=E.lines||j4(E.value);if(E.lines=R,E.added||E.removed){if(!y){const L=x[C-1];y=N,_=S,L&&(j=f>0?v(L.lines.slice(-f)):[],y-=j.length,_-=j.length)}for(const L of R)j.push((E.added?"+":"-")+L);E.added?S+=R.length:N+=R.length}else{if(y)if(R.length<=f*2&&C<x.length-2)for(const L of v(R))j.push(L);else{const L=Math.min(R.length,f);for(const F of v(R.slice(0,L)))j.push(F);const O={oldStart:y,oldLines:N-y+L,newStart:_,newLines:S-_+L,lines:j};b.push(O),y=0,_=0,j=[]}N+=R.length,S+=R.length}}for(const C of b)for(let E=0;E<C.lines.length;E++)C.lines[E].endsWith(`
|
|
56
|
+
`)?C.lines[E]=C.lines[E].slice(0,-1):(C.lines.splice(E+1,0,"\"),E++);return{oldFileName:e,newFileName:t,oldHeader:a,newHeader:c,hunks:b}}}function j4(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 N4(e,t){return k4("","",e,t,"","",{context:3}).hunks.map(i=>{const a=`@@ -${i.oldStart},${i.oldLines} +${i.newStart},${i.newLines} @@`,c=[];let u=i.oldStart,h=i.newStart;for(const f of i.lines){const m=f[0],x=f.slice(1);m==="-"?c.push({type:"del",content:x,oldLineNo:u++}):m==="+"?c.push({type:"add",content:x,newLineNo:h++}):c.push({type:"context",content:x,oldLineNo:u++,newLineNo:h++})}return I2(c),{header:a,lines:c}})}function C4(e){const t=[],n=e.split(`
|
|
60
|
+
`);let i=null,a=null,c=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),c=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:c++}):h.startsWith(" ")&&a.lines.push({type:"context",content:h.slice(1),oldLineNo:c++,newLineNo:u++}))}a&&i&&i.hunks.push(a),i&&t.push(i);for(const h of t)for(const f of h.hunks)I2(f.lines);return t}function I2(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 c=t,u=i-n,h=c-a;if(u>0&&h>0){const f=Math.min(u,h);for(let m=0;m<f;m++){const x=e[n+m],v=e[a+m],b=y4(x.content,v.content);x.wordChanges=b.filter(y=>!y.added).map(y=>({value:y.value,removed:y.removed})),v.wordChanges=b.filter(y=>!y.removed).map(y=>({value:y.value,added:y.added}))}}t===n&&t++}}function E4({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 T4({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(E4,{line:n}),!n.content&&" "]})]},i))]})}function A4({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 jo({oldText:e,newText:t,unifiedDiff:n,fileName:i,mode:a="compact"}){const c=a==="compact",u=!c,h=k.useMemo(()=>{if(n)return C4(n);const f=e??"",m=t??"";if(!f&&!m)return[];const x=N4(f,m);return[{fileName:i||"",hunks:x}]},[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 ${c?"diff-compact":"diff-full"}`,children:h.map((f,m)=>l.jsxs("div",{className:"diff-file",children:[(f.fileName||i)&&l.jsx(A4,{fileName:f.fileName||i||""}),f.hunks.map((x,v)=>l.jsx(T4,{hunk:x,showLineNumbers:u},v))]},m))})}const F2=k.createContext(null);function JB({value:e,children:t}){return l.jsx(F2.Provider,{value:e,children:t})}function M4(){const e=k.useContext(F2),t=K(n=>n.density);return e??t}function fa(){return M4()==="compact"}function xf({open:e,onToggle:t,marker:n,label:i,meta:a,labelClassName:c=""}){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 ${c}`,children:i}),a&&l.jsx("span",{className:"text-[10px] text-cc-muted/35 shrink-0 ml-auto tabular-nums",children:a})]})}const R4={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 No(e){return R4[e]||"tool"}function Oi(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 U2({name:e,input:t,toolUseId:n}){const[i,a]=k.useState(e==="Edit"),c=No(e),u=Oi(e),h=go(e,t);return e==="Edit"?l.jsx(O4,{input:t,toolUseId:n}):e==="Bash"?l.jsx(L4,{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(sl,{type:c}),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(D4,{name:e,input:t})})})]})}function O4({input:e,toolUseId:t}){const n=fa(),[i,a]=k.useState(!1),c=String(e.file_path||""),u=c?c.split("/").pop()||c:"",h=String(e.old_string||""),f=String(e.new_string||""),m=!!(h||f),x=!!e.replace_all,[v,b]=k.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),j=(h+f).split(`
|
|
61
|
+
`).length,N=j>15,S=l.jsx(l.Fragment,{children:m?l.jsxs("div",{className:"relative mt-1",children:[l.jsx("div",{className:`overflow-hidden ${N&&!v?"max-h-[240px]":""}`,children:l.jsx(jo,{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:()=>b(!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 ${j} lines`})]}):_.length>0?l.jsx("div",{className:"mt-1 space-y-1",children:_.map((C,E)=>{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}-${E}`)})}):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(xf,{open:i,onToggle:()=>a(!i),marker:"±",label:`Edit ${u||"file"}${x?" (all)":""}`,meta:m?`${j} ${j===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}),x&&l.jsx("span",{className:"text-[9px] uppercase tracking-wider font-semibold text-amber-600/70 dark:text-amber-400/70",children:"all"})]}),S]})}function L4({input:e,toolUseId:t}){const n=typeof e.command=="string"?e.command:"",i=typeof e.description=="string"?e.description:"",a=fa(),[c,u]=k.useState(!1);if(a){const h=n.split(`
|
|
62
|
+
`)[0]||"",f=i||h||"Command",m=n?n.split(`
|
|
63
|
+
`).length-1:0;return l.jsxs("div",{"data-tool-use-id":t,children:[l.jsx(xf,{open:c,onToggle:()=>u(!c),marker:"$",label:f,meta:!c&&m>0?`+${m}`:void 0,labelClassName:i?"italic":"font-mono-code"}),c&&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 D4({name:e,input:t}){switch(e){case"Bash":return l.jsx(z4,{input:t});case"Edit":return l.jsx($4,{input:t});case"Write":return l.jsx(B4,{input:t});case"Read":return l.jsx(P4,{input:t});case"Glob":return l.jsx(I4,{input:t});case"Grep":return l.jsx(F4,{input:t});case"WebSearch":case"web_search":return l.jsx(U4,{input:t});case"WebFetch":return l.jsx(H4,{input:t});case"Task":return l.jsx(q4,{input:t});case"TodoWrite":return l.jsx(V4,{input:t});case"NotebookEdit":return l.jsx(G4,{input:t});case"SendMessage":return l.jsx(Y4,{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 z4({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 $4({input:e}){const t=String(e.file_path||""),n=String(e.old_string||""),i=String(e.new_string||""),c=(Array.isArray(e.changes)?e.changes:[]).map(u=>({path:typeof u.path=="string"?u.path:"",kind:typeof u.kind=="string"?u.kind:"update"})).filter(u=>u.path);return 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(jo,{oldText:n,newText:i,fileName:t,mode:"compact"}):c.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}),c.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 B4({input:e}){const t=String(e.file_path||""),n=String(e.content||"");return l.jsx(jo,{newText:n,fileName:t,mode:"compact"})}function P4({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 I4({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 F4({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 U4({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 H4({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 q4({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 V4({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 G4({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 Y4({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 go(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 sl({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 X4=2e3,H2=6,Q4=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"]),di=new Map,fr=new Map,Ph=new Map,Nh=new Map,ta=new Map,eu=new Map,gu=new Map,Ih=new Map;function q2(e){return!!e&&(e.readyState===WebSocket.OPEN||e.readyState===WebSocket.CONNECTING)}function gx(e){return!e.archived&&e.state!=="exited"}function xx(e){const t=K.getState();if(t.currentSessionId===e)return!0;const n=t.sdkSessions.find(i=>i.sessionId===e);return n?gx(n):!1}function W4(){const e=K.getState(),t=new Set;e.currentSessionId&&t.add(e.currentSessionId);for(const n of e.sdkSessions)gx(n)&&t.add(n.sessionId);return Array.from(t)}const xo=[];function V2(){let e=0;for(const t of di.values())t.readyState===WebSocket.CONNECTING&&e++;return e}function G2(e){const t=xo.indexOf(e);t>=0&&xo.splice(t,1)}function M_(){if(!vo)for(;xo.length>0&&V2()<H2;){const e=xo.shift();xx(e)&&Co(e)}}let vo=typeof document<"u"?document.hidden:!1;typeof document<"u"&&document.addEventListener("visibilitychange",()=>{if(document.hidden){vo=!0;for(const[e,t]of fr)clearTimeout(t),fr.delete(e)}else{vo=!1;for(const e of W4()){if(!xx(e))continue;const t=di.get(e);if(!q2(t)){if(t){try{t.close()}catch{}di.delete(e)}Co(e)}}}});function Ch(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 K4(e,t){return e.startsWith("/")||!t?Ch(e):Ch(`${t}/${e}`)}function Z4(e,t){if(!t)return!0;const n=Ch(t);return e===n||e.startsWith(`${n}/`)}function J4(e){let t=Ih.get(e);return t||(t=new Set,Ih.set(e,t)),t}function sg(e,t){const n=K.getState(),i=J4(e);for(const a of t){if(a.type!=="tool_use")continue;const{name:c,input:u,id:h}=a;if(h){if(i.has(h))continue;i.add(h)}if(c==="TodoWrite"){const f=u.todos;if(Array.isArray(f)){const m=f.map((x,v)=>({id:String(v+1),subject:x.content||"Task",description:"",activeForm:x.activeForm,status:x.status||"pending"}));n.setTasks(e,m),Nh.set(e,m.length)}continue}if(c==="TaskCreate"){const f=(Nh.get(e)||0)+1;Nh.set(e,f);const m={id:String(f),subject:u.subject||"Task",description:u.description||"",activeForm:u.activeForm,status:"pending"};n.addTask(e,m);continue}if(c==="TaskUpdate"){const f=u.taskId;if(f){const m={};u.status&&(m.status=u.status),u.owner&&(m.owner=u.owner),u.activeForm!==void 0&&(m.activeForm=u.activeForm),u.addBlockedBy&&(m.blockedBy=u.addBlockedBy),n.updateTask(e,f,m)}}}}function ig(e,t){var c,u;const n=K.getState(),i=((c=n.sessions.get(e))==null?void 0:c.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:m}=h;if((f==="Edit"||f==="Write")&&typeof m.file_path=="string"){const x=K4(m.file_path,i);Z4(x,i)&&(a=!0)}}a&&n.bumpChangedFilesTick(e)}const Qc=new Map,eT=/Command running in background with ID:\s*(\S+)\.\s*Output is being written to:\s*(\S+)/;function rg(e,t){const n=K.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 c=Qc.get(e);c||(c=new Map,Qc.set(e,c)),c.set(i.id,{command:a.command||"",description:a.description||"",startedAt:Date.now()})}}if(i.type==="tool_result"){const a=i.tool_use_id,c=Qc.get(e),u=c==null?void 0:c.get(a);if(c&&u){const f=(typeof i.content=="string"?i.content:Array.isArray(i.content)?i.content.map(m=>"text"in m?m.text:"").join(""):"").match(eT);if(f){const m={taskId:f[1],toolUseId:a,command:u.command,description:u.description,outputFile:f[2],status:"running",startedAt:u.startedAt};n.addProcess(e,m)}c.delete(a),c.size===0&&Qc.delete(e)}}}}const oh=new Map,Fh=new Map;function ag(e,t){const n=K.getState();let i=Fh.get(e);i||(i=new Set,Fh.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 c=a.input;if(c.run_in_background===!0){a.id&&i.add(a.id);let u=oh.get(e);u||(u=new Map,oh.set(e,u));const h={toolUseId:a.id,name:c.name||c.description||"Background agent",description:c.description||"",agentType:c.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 c=a.tool_use_id,u=oh.get(e),h=u==null?void 0:u.get(c);if(u&&h){const f=typeof a.content=="string"?a.content:Array.isArray(a.content)?a.content.map(x=>"text"in x?x.text:"").join(""):"",m=a.is_error===!0;n.updateBackgroundAgent(e,c,{status:m?"failed":"completed",completedAt:Date.now(),summary:f.length>200?f.slice(0,200)+"...":f}),u.delete(c),u.size===0&&oh.delete(e)}}}}function R_(e,t,n){typeof Notification>"u"||Notification.permission==="granted"&&new Notification(e,{body:t,tag:n})}function O_(e){return e.subtype==="task_notification"?{detail:e.summary||void 0,metaCode:"task_notification"}:{}}function L_(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 tT=0,nT=0;function Ei(){return`msg-${Date.now()}-${++tT}`}function D_(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 f4(e)?`${u4}
|
|
64
|
+
|
|
65
|
+
Details: ${t}`:`Error: ${t}`}function sT(e,t){const n=gu.get(e)||[];n.push(t),gu.set(e,n)}function iT(e,t){const n=gu.get(e);if(!(!(n!=null&&n.length)||t.readyState!==WebSocket.OPEN)){gu.delete(e);for(const i of n)t.send(JSON.stringify(i))}}const ar=new Map;function z_(e,t,n){const i=K.getState(),a=i.messages.get(e)||[],c=eu.get(e);let u=a.filter(f=>!f.isStreaming||f.id===c),h=-1;if(c&&(h=u.findIndex(f=>f.id===c),h===-1&&eu.delete(e)),h===-1){const f=`stream-${e}-${Ei()}`;eu.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 Kr(e){eu.delete(e);const t=K.getState(),n=t.messages.get(e)||[],i=n.filter(a=>!a.isStreaming);return i.length!==n.length?(t.setMessages(e,i),!0):!1}const $_=new Map,rT=8e3;function Wl(e,t,n={}){if(console.warn(`[companion:session-event] ${t}`,{sessionId:e,...n.detail??{}}),!n.userText)return;const i=Date.now(),a=$_.get(e);a&&a.code===t&&i-a.at<rT||($_.set(e,{code:t,at:i}),K.getState().appendMessage(e,{id:`companion-notice-${t}-${i}`,role:"system",content:n.userText,timestamp:i,meta:!0,metaCode:t}))}function Y2(){return`cmsg-${Date.now()}-${++nT}`}function x0(){return Y2()}const aT=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 lT(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 X2(e){return`companion:last-seq:${e}`}function v0(e){const t=Ph.get(e);if(typeof t=="number")return t;try{const n=localStorage.getItem(X2(e)),i=n?Number(n):0,a=Number.isFinite(i)?Math.max(0,Math.floor(i)):0;return Ph.set(e,a),a}catch{return 0}}function B_(e,t){const n=Math.max(0,Math.floor(t));Ph.set(e,n);try{localStorage.setItem(X2(e),String(n))}catch{}}function P_(e,t){Un(e,{type:"session_ack",last_seq:t})}function Eh(e){return e.map(t=>t.type==="text"?t.text:t.type==="thinking"?t.thinking:"").filter(Boolean).join(`
|
|
66
|
+
`)}function lg(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 oT(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(lg(h),h);const c=[],u=new Set;for(const h of n){const f=lg(h);u.has(f)||(u.add(f),c.push(a.get(f)||h))}for(const h of i){const f=lg(h);u.has(f)||(u.add(f),c.push(h))}return c}function I_(e,t,n,i,a){return{toolUseId:e,toolName:t,preview:go(t,n),startedAt:i,elapsedSeconds:0,isError:!1,parentToolUseId:a||void 0}}function b0(e,t){const n=oT(e.contentBlocks,t.contentBlocks),i=n&&n.length>0?Eh(n):t.content||e.content;return{...e,...t,content:i,contentBlocks:n,timestamp:e.timestamp??t.timestamp,isStreaming:t.isStreaming}}function cT(e,t){const n=K.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 c=[...i];c[a]=b0(c[a],t),n.setMessages(e,c)}function uT(e,t){var a,c;let n;try{n=JSON.parse(t.data)}catch{console.warn(`[ws] Failed to parse incoming message for session ${e}:`,(c=(a=t.data)==null?void 0:a.substring)==null?void 0:c.call(a,0,120));return}const i=K.getState();i.connectionStatus.get(e)==="connecting"&&i.setConnectionStatus(e,"connected"),Q2(e,n)}function Q2(e,t,n={}){var u,h,f,m,x,v;const{processSeq:i=!0,ackSeqMessage:a=!0}=n,c=K.getState();if(i&&typeof t.seq=="number"){const b=v0(e);if(t.seq<=b)return;B_(e,t.seq),a&&P_(e,t.seq)}switch(Q4.has(t.type)&&c.setLastActivity(e,Date.now()),t.type){case"session_init":{const b=c.sessions.get(e);if(c.addSession(t.session),c.setCliConnected(e,!0),c.setCliReconnecting(e,!1),b||c.setSessionStatus(e,"idle"),!c.sessionNames.has(e)){const y=new Set(c.sessionNames.values()),_=$2(y);c.setSessionName(e,_)}break}case"session_update":{c.updateSession(e,t.session);break}case"assistant":{const b=t.message;if(b.model==="<synthetic>"){Kr(e),c.setStreaming(e,null),Wl(e,"synthetic_noop",{detail:{stopReason:b.stop_reason,text:Eh(b.content).slice(0,120)},userText:"The session resumed without generating a new response. If it seems stuck, resend your last message."});break}const y=Eh(b.content),_={id:b.id,role:"assistant",content:y,contentBlocks:b.content,timestamp:t.timestamp||Date.now(),parentToolUseId:t.parent_tool_use_id,model:b.model,stopReason:b.stop_reason};if(Kr(e),cT(e,_),c.setStreaming(e,null),ta.delete(e),ar.delete(e),(u=b.content)!=null&&u.length)for(const j of b.content)j.type==="tool_result"&&c.clearToolProgress(e,j.tool_use_id);if(c.setSessionStatus(e,"running"),c.streamingStartedAt.has(e)||c.setStreamingStats(e,{startedAt:Date.now()}),(h=b.content)!=null&&h.length)for(const j of b.content){if(j.type==="tool_use"){const N=j.input||{};c.addToolActivity(e,I_(j.id,j.name,N,t.timestamp||Date.now(),t.parent_tool_use_id))}j.type==="tool_result"&&c.updateToolActivity(e,j.tool_use_id,{completedAt:Date.now(),isError:!!j.is_error})}(f=b.content)!=null&&f.length&&(sg(e,b.content),ig(e,b.content),rg(e,b.content),ag(e,b.content));break}case"stream_event":{const b=t.event;if(b&&typeof b=="object"){if(b.type==="message_start"&&(ta.delete(e),ar.delete(e),Kr(e),c.setSessionStatus(e,"running"),c.streamingStartedAt.has(e)||c.setStreamingStats(e,{startedAt:Date.now(),outputTokens:0})),b.type==="content_block_delta"){const y=b.delta;if((y==null?void 0:y.type)==="text_delta"&&typeof y.text=="string"){const _=ar.get(e)||{thinking:"",text:""};ta.get(e)==="thinking"&&(_.thinking=""),_.text+=y.text,ar.set(e,_),ta.set(e,"text"),c.setStreaming(e,_.text),z_(e,_.text,"text")}if((y==null?void 0:y.type)==="thinking_delta"&&typeof y.thinking=="string"){const _=ar.get(e)||{thinking:"",text:""};_.thinking+=y.thinking,ar.set(e,_),ta.set(e,"thinking"),c.setStreaming(e,_.thinking),z_(e,_.thinking,"thinking")}}if(b.type==="message_delta"){const y=b.usage;y!=null&&y.output_tokens&&c.setStreamingStats(e,{outputTokens:y.output_tokens})}}break}case"result":{Ih.delete(e),Fh.delete(e);const b=t.data,y={total_cost_usd:b.total_cost_usd,num_turns:b.num_turns};if(typeof b.total_lines_added=="number"&&(y.total_lines_added=b.total_lines_added),typeof b.total_lines_removed=="number"&&(y.total_lines_removed=b.total_lines_removed),b.modelUsage){for(const _ of Object.values(b.modelUsage))if(_.contextWindow>0){const j=Math.round((_.inputTokens+_.outputTokens)/_.contextWindow*100);y.context_used_percent=Math.max(0,Math.min(j,100))}}c.updateSession(e,y),Kr(e),c.setStreaming(e,null),ta.delete(e),ar.delete(e),c.setStreamingStats(e,null),c.clearToolProgress(e),c.setSessionStatus(e,"idle"),!document.hasFocus()&&c.notificationSound&&m4(),!document.hasFocus()&&c.notificationDesktop&&R_("Session completed","Claude finished the task",e),b.is_error&&c.appendMessage(e,{id:Ei(),role:"system",content:D_(b),timestamp:Date.now()});break}case"permission_request":{if(c.addPermission(e,t.request),!document.hasFocus()&&c.notificationDesktop){const y=t.request;R_("Permission needed",`${y.tool_name}: approve or deny`,y.request_id)}const b=t.request;if(b.tool_name&&b.input){const y=[{type:"tool_use",id:b.tool_use_id,name:b.tool_name,input:b.input}];sg(e,y),ig(e,y),rg(e,y),ag(e,y)}break}case"permission_cancelled":{c.removePermission(e,t.request_id);break}case"permission_auto_resolved":{c.addAiResolvedPermission(e,{request:t.request,behavior:t.behavior,reason:t.reason,timestamp:Date.now()});break}case"tool_progress":{c.setToolProgress(e,t.tool_use_id,{toolName:t.tool_name,elapsedSeconds:t.elapsed_time_seconds}),c.updateToolActivity(e,t.tool_use_id,{elapsedSeconds:t.elapsed_time_seconds});break}case"tool_use_summary":{((m=c.sdkSessions.find(y=>y.sessionId===e))==null?void 0:m.backendType)==="codex"&&c.appendMessage(e,{id:Ei(),role:"system",content:t.summary,timestamp:Date.now()});break}case"user_message":{c.appendMessage(e,{id:t.id||Ei(),role:"user",content:t.content,timestamp:t.timestamp||Date.now()}),c.clearPromptSuggestions(e);break}case"system_event":{if(((x=t.event)==null?void 0:x.subtype)==="task_notification"){const{task_id:y,status:_,summary:j}=t.event;y&&_&&c.updateProcess(e,y,{status:_,completedAt:Date.now(),summary:j||void 0})}const b=L_(t.event);if(!b)break;c.appendMessage(e,{id:Ei(),role:"system",content:b,timestamp:t.timestamp||Date.now(),...O_(t.event)});break}case"status_change":{t.status==="compacting"?c.setSessionStatus(e,"compacting"):c.setSessionStatus(e,t.status);break}case"auth_status":{t.error&&c.appendMessage(e,{id:Ei(),role:"system",content:`Auth error: ${t.error}`,timestamp:Date.now()});break}case"error":{c.appendMessage(e,{id:Ei(),role:"system",content:t.message,timestamp:Date.now()});break}case"session_phase":{const b=t.phase;b==="terminated"?(c.setCliConnected(e,!1),c.setCliReconnecting(e,!1),c.setSessionStatus(e,null),c.setStreaming(e,null),c.setStreamingStats(e,null),Kr(e)?Wl(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."}):Wl(e,"session_terminated",{detail:{trigger:"session_phase:terminated",previousPhase:t.previousPhase,hadDraft:!1}})):b==="reconnecting"?(c.setCliConnected(e,!1),c.setCliReconnecting(e,!0),c.setSessionStatus(e,null),c.setStreaming(e,null),c.setStreamingStats(e,null),Kr(e)&&Wl(e,"interrupted_mid_stream",{detail:{trigger:"session_phase:reconnecting",previousPhase:t.previousPhase},userText:"Response interrupted — reconnecting to the backend…"})):b==="starting"||b==="initializing"?(c.setCliConnected(e,!1),c.setCliReconnecting(e,!0)):(c.setCliConnected(e,!0),c.setCliReconnecting(e,!1),b==="ready"?c.setSessionStatus(e,"idle"):b==="streaming"?c.setSessionStatus(e,"running"):b==="compacting"?c.setSessionStatus(e,"compacting"):b==="awaiting_permission"&&c.setSessionStatus(e,"running"));break}case"cli_disconnected":{c.setCliConnected(e,!1),c.setCliReconnecting(e,!1),c.setSessionStatus(e,null),c.setStreaming(e,null),c.setStreamingStats(e,null),Kr(e)?Wl(e,"interrupted_mid_stream",{detail:{trigger:"cli_disconnected"},userText:"Response interrupted — the backend disconnected before finishing. Trying to reconnect…"}):Wl(e,"cli_disconnected",{detail:{trigger:"cli_disconnected",hadDraft:!1}});break}case"cli_connected":{c.setCliConnected(e,!0),c.setCliReconnecting(e,!1);break}case"session_name_update":{const b=c.sessionNames.get(e),y=b&&/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(b);(!b||y)&&(c.setSessionName(e,t.name),c.markRecentlyRenamed(e));break}case"pr_status_update":{c.setPRStatus(e,{available:t.available,pr:t.pr});break}case"mcp_status":{c.setMcpServers(e,t.servers);break}case"rate_limit":{c.setRateLimit(e,t.info);break}case"message_history":{const b=[],y=new Map;for(let j=0;j<t.messages.length;j++){const N=t.messages[j];if(N.type==="user_message")b.push({id:N.id||Ei(),role:"user",content:N.content,timestamp:N.timestamp});else if(N.type==="assistant"){const S=N.message,C=Eh(S.content),E={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=b.findIndex(L=>L.role==="assistant"&&L.id===E.id);if(R===-1?b.push(E):b[R]=b0(b[R],E),(v=S.content)!=null&&v.length){sg(e,S.content),ig(e,S.content),rg(e,S.content),ag(e,S.content);const L=N.timestamp||Date.now();for(const O of S.content){if(O.type==="tool_use"){const F=O.input||{},D=y.get(O.id);y.set(O.id,D??I_(O.id,O.name,F,L,N.parent_tool_use_id))}if(O.type==="tool_result"){const F=y.get(O.tool_use_id);F&&y.set(O.tool_use_id,{...F,completedAt:L,isError:F.isError||!!O.is_error,elapsedSeconds:Math.max(F.elapsedSeconds,F.completedAt?F.elapsedSeconds:Math.max(0,(L-F.startedAt)/1e3))})}}}}else if(N.type==="result"){const S=N.data;S.is_error&&b.push({id:`hist-error-${j}`,role:"system",content:D_(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 E of Object.values(S.modelUsage))if(E.contextWindow>0){const R=E,L=Math.round((R.inputTokens+R.outputTokens)/R.contextWindow*100);C.context_used_percent=Math.max(0,Math.min(L,100))}}c.updateSession(e,C)}else if(N.type==="system_event"){const S=L_(N.event);if(!S)continue;b.push({id:`hist-system-event-${j}`,role:"system",content:S,timestamp:N.timestamp||Date.now(),...O_(N.event)})}}if(b.length>0){const j=c.messages.get(e)||[];if(j.length===0)c.setMessages(e,b);else{const N=[...j];for(const S of b){const C=N.findIndex(R=>R.id===S.id);if(C===-1){N.push(S);continue}const E=N[C];E.role==="assistant"&&S.role==="assistant"?N[C]=b0(E,S):N[C]=S}N.sort((S,C)=>(S.timestamp??0)-(C.timestamp??0)),c.setMessages(e,N)}}c.setToolActivity(e,Array.from(y.values()).sort((j,N)=>j.startedAt-N.startedAt));const _=t.messages[t.messages.length-1];(_==null?void 0:_.type)==="result"&&(Kr(e),c.setStreaming(e,null),ta.delete(e),ar.delete(e),c.setStreamingStats(e,null),c.clearToolProgress(e),c.setSessionStatus(e,"idle"));break}case"event_replay":{let b;for(const y of t.events){const _=v0(e);y.seq<=_||(B_(e,y.seq),b=y.seq,Q2(e,y.message,{processSeq:!1,ackSeqMessage:!1}))}typeof b=="number"&&P_(e,b);break}case"prompt_suggestion":{const b=t.suggestions;c.setPromptSuggestions(e,b);break}case"streamlined_text":{c.appendMessage(e,{id:Ei(),role:"assistant",content:t.text,timestamp:Date.now()});break}case"streamlined_tool_use_summary":{c.appendMessage(e,{id:Ei(),role:"system",content:t.tool_summary,timestamp:Date.now()});break}case"magic_ui_state":{c.setMagicUiState(e,t.state);break}default:{console.debug("[ws] Unhandled message type:",t.type);break}}}function Co(e){const t=di.get(e);if(q2(t))return;if(t){try{t.close()}catch{}di.delete(e)}const n=K.getState();if(n.setConnectionStatus(e,"connecting"),n.currentSessionId!==e&&V2()>=H2){xo.includes(e)||xo.push(e);return}G2(e);const i=new WebSocket(lT(e));di.set(e,i),i.onopen=()=>{const a=v0(e);i.send(JSON.stringify({type:"session_subscribe",last_seq:a})),iT(e,i);const c=fr.get(e);c&&(clearTimeout(c),fr.delete(e)),M_()},i.onmessage=a=>uT(e,a),i.onclose=()=>{di.get(e)===i&&(di.delete(e),K.getState().setConnectionStatus(e,"disconnected"),dT(e),M_())},i.onerror=()=>{i.close()}}function dT(e){if(fr.has(e)||vo)return;const t=setTimeout(()=>{fr.delete(e),!vo&&xx(e)&&Co(e)},X4);fr.set(e,t)}function y0(e){G2(e);const t=fr.get(e);t&&(clearTimeout(t),fr.delete(e));const n=di.get(e);n&&(n.close(),di.delete(e)),K.getState().setConnectionStatus(e,"disconnected"),Ih.delete(e),Fh.delete(e),Qc.delete(e),Nh.delete(e),ta.delete(e),eu.delete(e),ar.delete(e),Ph.delete(e),gu.delete(e)}function hT(e){if(vo)return;const t=K.getState().currentSessionId,n=e.filter(gx),i=t?[...n.filter(a=>a.sessionId===t),...n.filter(a=>a.sessionId!==t)]:n;for(const a of i)Co(a.sessionId)}function Un(e,t){const n=di.get(e);let i=t;const a=aT.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:Y2()});break}if((n==null?void 0:n.readyState)===WebSocket.OPEN){n.send(JSON.stringify(i));return}a&&sT(e,i)}function F_(e){Un(e,{type:"mcp_get_status"})}function fT(e,t,n){Un(e,{type:"mcp_toggle",serverName:t,enabled:n})}function pT(e,t){Un(e,{type:"mcp_reconnect",serverName:t})}function mT(e,t){Un(e,{type:"mcp_set_servers",servers:t})}function U_(e,t){Un(e,{type:"set_magic_ui",magicUiActive:t})}function eP(e){Un(e,{type:"magic_ui_sync"})}function gT(e,t){Un(e,{type:"set_ai_validation",...t})}const te="u">typeof window?window:void 0,Hn="u">typeof globalThis?globalThis:te,jn=Hn==null?void 0:Hn.navigator,he=Hn==null?void 0:Hn.document,Yt=Hn==null?void 0:Hn.location,xu=Hn==null?void 0:Hn.fetch,vx=Hn!=null&&Hn.XMLHttpRequest&&"withCredentials"in new Hn.XMLHttpRequest?Hn.XMLHttpRequest:void 0,H_=Hn==null?void 0:Hn.AbortController,xT=Hn==null?void 0:Hn.CompressionStream,es=jn==null?void 0:jn.userAgent;function W2(){return!(!te||te.navigator.onLine===!1)}const Dc=typeof globalThis<"u"?globalThis:te;Dc&&typeof self>"u"&&(Dc.self=Dc),Dc&&typeof File>"u"&&(Dc.File=function(){});const $e=te??{},vT="0.9.0",hr={DEBUG:!1,LIB_VERSION:vT,LIB_NAME:"browser-common"};var Ai=(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})({}),_0=(function(e){return e.GZipJS="gzip-js",e.Base64="base64",e})({});const bT=["$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"],yT=["token"];function Ue(e,t){return e.indexOf(t)!==-1}const vf=function(e){return e.trim()},w0=function(e){return e.replace(/^\$/,"")};function K2(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 Z2=Object.prototype,bx=Z2.hasOwnProperty,bf=Z2.toString,Ie=Array.isArray||function(e){return bf.call(e)==="[object Array]"},kn=e=>typeof e=="function",st=e=>e===Object(e)&&!Ie(e),ms=e=>{if(st(e)){for(const t in e)if(bx.call(e,t))return!1;return!0}return!1},ue=e=>e===void 0,Je=e=>bf.call(e)=="[object String]",tu=e=>Je(e)&&e.trim().length===0,Zt=e=>e===null,Ve=e=>ue(e)||Zt(e),Jt=e=>bf.call(e)=="[object Number]"&&e==e,lr=e=>Jt(e)&&e>0,ns=e=>bf.call(e)==="[object Boolean]",_T=e=>Ue(bT,e),wT=e=>Ue(yT,e);function J2(e){return e===null||typeof e!="object"}function Uh(e,t){return{}.toString.call(e)===`[object ${t}]`}function Eo(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 yx(e){return"u">typeof Event&&eS(e,Event)}function eS(e,t){try{return e instanceof t}catch{return!1}}const ST=[!0,"true",1,"1","yes"],og=e=>Ue(ST,e),kT=[!1,"false",0,"0","no"];function q_(e,t,n,i,a,c,u){try{var h=e[c](u),f=h.value}catch(m){return void n(m)}h.done?t(f):Promise.resolve(f).then(i,a)}function Bt(e){return function(){var t=this,n=arguments;return new Promise(function(i,a){var c=e.apply(t,n);function u(f){q_(c,i,a,u,h,"next",f)}function h(f){q_(c,i,a,u,h,"throw",f)}u(void 0)})}}const jT=["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"],V_=function(e,t=[]){if(!e)return!1;const n=e.toLowerCase();return jT.concat(t).some(i=>{const a=i.toLowerCase();return n.indexOf(a)!==-1})};function Ri(e,t,n,i,a){return t>n&&(i.warn("min cannot be greater than max."),t=n),Jt(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),Ri(a??n,t,n,i))}var NT=class{constructor(e){this.C={},this.I=e.I,this.R=Ri(e.bucketSize,0,100,e.$),this.A=Ri(e.refillRate,0,this.R,e.$),this.O=Ri(e.refillInterval,0,864e5,e.$)}F(e,t){const n=Math.floor((t-e.lastAccess)/this.O);n>0&&(e.tokens=Math.min(e.tokens+n*this.A,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 bo="Mobile",vu="Android",Hh="Tablet",tS="Android Tablet",nS="iPad",sS="Apple Watch",Th="Safari",yf="BlackBerry",iS="Samsung Internet",Ah="Chrome",rS="Chrome iOS",aS="Internet Explorer",lS="Internet Explorer Mobile",oS="Opera",cS="Microsoft Edge",Mh="Firefox",uS="Firefox iOS",qh="Nintendo",Vh="PlayStation",_f="Xbox",dS="Android Mobile",hS="Mobile Safari",cg="Windows",fS="Windows Phone",G_="Nokia",S0="Ouya",CT="Generic "+bo.toLowerCase(),pS="Generic "+Hh.toLowerCase(),k0="Konqueror",mS="Oculus Browser",gS="Vivaldi",xS="Yandex",vS="Whale",bS="DuckDuckGo",yS="Pale Moon",_S="Waterfox",j0="Brave",wS="Claude",SS="Codex",kS="ChatGPT",jS="Google Search App",ug=new RegExp("Version/(\\d+(\\.\\d+)?)"),dg=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),ET=new RegExp(_f,"i"),TT=new RegExp("PlayStation \\w+","i"),AT=new RegExp("Nintendo \\w+","i"),_x=new RegExp("BlackBerry|PlayBook|BB10","i"),MT={"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"},NS=function(e,t,n,i){return t=t||"",(function(c){return c!=null&&c.brave?j0:null})(n)||(i!=null&&i.detectGoogleSearchApp&&Ue(e,"GSA/")?jS:Ue(e," OPR/")&&Ue(e,"Mini")?"Opera Mini":Ue(e," OPR/")?oS:_x.test(e)?yf:Ue(e,"IEMobile")||Ue(e,"WPDesktop")?lS:Ue(e,"OculusBrowser")?mS:Ue(e,"SamsungBrowser")?iS:Ue(e,"Edge")||Ue(e,"Edg/")?cS:Ue(e,"Vivaldi/")?gS:Ue(e,"YaBrowser/")?xS:Ue(e,"Whale/")?vS:Ue(e,"DuckDuckGo/")||Ue(e,"Ddg/")?bS:Ue(e,"Claude/")?wS:Ue(e,"Codex/")?SS:Ue(e,"ChatGPT/")?kS:Ue(e,"FBIOS")?"Facebook Mobile":Ue(e,"UCWEB")||Ue(e,"UCBrowser")?"UC Browser":Ue(e,"CriOS")?rS:Ue(e,"CrMo")||Ue(e,Ah)?Ah:Ue(e,vu)&&Ue(e,Th)?dS:Ue(e,"FxiOS")?uS:Ue(e.toLowerCase(),k0.toLowerCase())?k0:Ue(e,"Brave/")?j0:((c,u)=>u&&Ue(u,"Apple")||(function(h){return Ue(h,Th)&&!Ue(h,Ah)&&!Ue(h,vu)})(c))(e,t)?Ue(e,bo)?hS:Th:Ue(e,"PaleMoon/")?yS:Ue(e,"Waterfox/")?_S:Ue(e,Mh)?Mh:Ue(e,"MSIE")||Ue(e,"Trident/")?aS:Ue(e,"Gecko")?Mh:"")},RT={[lS]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[cS]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[Ah]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[rS]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[Th]:[ug],[hS]:[ug],[oS]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[Mh]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[uS]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[k0]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[yf]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),ug],[dS]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[iS]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[mS]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[gS]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[xS]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[vS]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[j0]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[wS]:[dg],[SS]:[dg],[kS]:[dg],[bS]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[yS]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[_S]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[jS]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[aS]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},OT=function(e,t,n,i){const a=NS(e,t,n,i),c=RT[a];if(ue(c))return null;for(let u=0;c.length>u;u++){const h=e.match(c[u]);if(h)return parseFloat(h[h.length-2])}return null},Y_=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),e=>[_f,e&&e[1]||""]],[new RegExp(qh,"i"),[qh,""]],[new RegExp(Vh,"i"),[Vh,""]],[_x,[yf,""]],[new RegExp(cg,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[fS,""];if(new RegExp(bo).test(t)&&!/IEMobile\b/.test(t))return["Windows Mobile",""];const n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){let i=MT[n[1]]||"";return/arm/i.test(t)&&(i="RT"),[cg,i]}return[cg,""]}],[/((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]?[vu,[e[2],e[3],e[4]||"0"].join(".")]:[vu,""]],[/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",""]]],CS=function(e){for(let t=0;Y_.length>t;t++){const[n,i]=Y_[t],a=n.exec(e),c=a&&(kn(i)?i(a,e):i);if(c)return c}return["",""]},ES=function(e){return AT.test(e)?qh:TT.test(e)?Vh:ET.test(e)?_f:new RegExp(S0,"i").test(e)?S0:new RegExp("(Windows Phone|WPDesktop)","i").test(e)?fS:/iPad/.test(e)?nS:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?sS:_x.test(e)?yf:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(G_,"i").test(e)?G_:/(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(bo).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)?vu:tS:new RegExp("(pda|Mobile)","i").test(e)?CT:new RegExp(Hh,"i").test(e)&&!new RegExp("Tablet pc","i").test(e)?pS:""},LT=function(e,t){var n;const i=ES(e);return i===nS||i===tS||i==="Kobo"||i==="Kindle Fire"||i===pS?Hh:i===qh||i===_f||i===Vh||i===S0?"Console":i===sS?"Wearable":i?bo:(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,(c=t==null?void 0:t.screenHeight)!==null&&c!==void 0?c:0)/((u=t==null?void 0:t.devicePixelRatio)!==null&&u!==void 0?u:1)?bo:Hh:"Desktop";var a,c,u},hg=/\bFBAV\/(\d+(?:\.\d+)*)/i,X_=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",hg],[/\bFBAN\/EMA\b/i,"Facebook Lite",hg],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",hg],[/\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"]],N0="[Truncated]",Au="[Unserializable]";function fo(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 TS(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=Au}Object.defineProperty(e,i,{value:a,enumerable:!0,writable:!0,configurable:!0})}return e}const Rh=3e5;var AS=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,Rh);if(!t)return this.ts=n,void(this.es=n+i);this.es=Math.max(this.es,Math.min(n+i,this.ts+Rh))}remainingMs(){const e=Date.now();if(this.ts-5e3>e)return this.reset(),0;const t=Math.min(Rh,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 DT=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Q_(e,t){return typeof(n=e)=="string"&&DT.test(n)?e:t();var n}function MS(e,t){const n=new Error(t);try{Object.defineProperty(n,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch{}return n}function ca(e){return e&&e.split("#")[0]}function W_(e){try{return e()}catch{return}}function RS(e,t){const n=setTimeout(e,t);return n!=null&&n.unref&&(n==null||n.unref()),n}function K_(e,t,n){return OS.apply(this,arguments)}function OS(){return(OS=Bt(function*(e,t,n){let i;try{return yield Promise.race([e,new Promise((a,c)=>{i=RS(()=>{try{n==null||n(),a()}catch(u){c(u)}},t)})])}finally{clearTimeout(i)}})).apply(this,arguments)}let ch,Z_,fg;function zT(e){const t=globalThis._posthogChunkIds;if(!t)return;const n=Object.keys(t);return fg&&n.length===Z_||(Z_=n.length,fg=n.reduce((i,a)=>{ch||(ch={});const c=ch[a];if(c)i[c[0]]=c[1];else{const u=e(a);for(let h=u.length-1;h>=0;h--){const f=u[h],m=f==null?void 0:f.filename,x=t[a];if(m&&x){i[m]=x,ch[a]=[m,x];break}}}return i},{})),fg}function nu(e){return nu=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},nu(e)}function $T(e,t,n){return(t=(function(i){var a=(function(c){if(nu(c)!="object"||!c)return c;var u=c[Symbol.toPrimitive];if(u!==void 0){var h=u.call(c,"string");if(nu(h)!="object")return h;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(c)})(i);return nu(a)=="symbol"?a:a+""})(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function J_(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 B(e){for(var t=1;arguments.length>t;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?J_(Object(n),!0).forEach(function(i){$T(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):J_(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}var BT=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),c=this.parseStacktrace(i,a);return{$exception_list:this.convertToExceptionList(c,n),$exception_level:"error"}}modifyFrames(e){var t=this;return Bt(function*(){for(const n of e)n.stacktrace&&n.stacktrace.frames&&Ie(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 B(B({},e),{},{cause:i,stack:a,errors:(n=e.errors)===null||n===void 0?void 0:n.map(c=>this.parseStacktrace(c,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 Bt(function*(){let n=e;for(const i of t.modifiers)n=yield i(n);return n})()}convertToExceptionList(e,t){const n=[],i=(a,c,u)=>{var h;const f=n.length,m=c===void 0?B(B({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:c},x={type:a.type,value:a.value,mechanism:m};a.stack&&(x.stacktrace={type:"raw",frames:a.stack}),n.push(x),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:zT(this.stackParser),skipFirstLines:(t=e.skipFirstLines)!==null&&t!==void 0?t:1}}getAggregateErrors(e){try{if(Eo(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 c=e.errors;return Ie(c)?c:void 0}n=Object.getPrototypeOf(n)}}}catch{}}buildCoercingContext(e,t,n=0){let i=0,a=0,c=!1;const u=new Set,h=[],f={},m=(b,y,_=0)=>{const j=x(y,_),N=j.apply;if(j.apply=O=>{h.push(b);try{return N(O)}finally{h.pop()}},_>4||_>0&&h.indexOf(b)!==-1)return this.coerceFallback(j);const S=typeof b=="object"&&b!==null||typeof b=="function";if(_===0&&i>=50||S&&u.has(b))return;S&&u.add(b),_===0&&i++;const C=this.getAggregateErrors(b);let E,R;c||(c=!!C);try{if(E=this.applyCoercers(b,j),!E)throw f}catch(O){if(O===f)return void(_===0&&i--);if(!c)throw O;E=this.coerceFallback(j)}if(!C||i>=50)return E;try{R=C.length}catch{return E}if(!Number.isInteger(R)||0>R||R>4294967295)return E;const L=[];for(let O=0;50>i&&1e3>a&&R>O;O++){let F;a++;try{F=j.next(C[O])}catch{i++,F=this.coerceFallback(x(y+1))}F&&L.push(F)}return B(B({},E),{},{errors:L})},x=(b,y=0)=>B(B({},t),{},{syntheticException:b==0?t.syntheticException:void 0,mechanism:b==0?e:{},apply(_){const j=m(_,b,y+1);if(!j)throw f;return j},next:_=>m(_,b+1)}),v=x(n);return B(B({},v),{},{apply:b=>{var y;return(y=m(b,n))!==null&&y!==void 0?y:this.coerceFallback(v)}})}};const PT=/^([a-z][a-z0-9.+-]+):/i,IT=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function FT(e){if(!e||e==="<anonymous>")return!1;const t=PT.exec(e);return!t||IT.includes(t[1].toLowerCase())}function C0(e,t,n,i,a){const c={platform:e,filename:t,function:n==="<anonymous>"?"?":n,in_app:FT(t)};return ue(i)||(c.lineno=i),ue(a)||(c.colno=a),c}const LS=(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]},UT=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,HT=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,qT=/\((\S*)(?::(\d+))(?::(\d+))\)/,VT=(e,t)=>{const n=UT.exec(e);if(n){const[,a,c,u]=n;return C0(t,a,"?",+c,+u)}const i=HT.exec(e);if(i){if(i[2]&&i[2].indexOf("eval")===0){const u=qT.exec(i[2]);u&&(i[2]=u[1],i[3]=u[2],i[4]=u[3])}const[a,c]=LS(i[1]||"?",i[2]);return C0(t,c,a,i[3]?+i[3]:void 0,i[4]?+i[4]:void 0)}},GT=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,YT=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,XT=(e,t)=>{const n=GT.exec(e);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){const c=YT.exec(n[3]);c&&(n[1]=n[1]||"eval",n[3]=c[1],n[4]=c[2],n[5]="")}let i=n[3],a=n[1]||"?";return[a,i]=LS(a,i),C0(t,i,a,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},ew=/\(error: (.*)\)/;function wx(e,t){return e.filename===t.filename&&e.function===t.function&&e.module===t.module&&e.lineno===t.lineno&&e.colno===t.colno}function QT(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(!wx(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 WT(e,t){const n=t.start+t.length,i=zS(e,t);i&&e.splice(n+i===e.length?n:t.start,i)}function DS(e,t){let n=t.start;for(;n>0&&wx(e[n-1],e[n-1+t.length]);)n--;return t.start-n}function zS(e,t){const n=t.start+t.length;let i=n;for(;e.length>i&&wx(e[i],e[i-t.length]);)i++;return i-n}function KT(e,t){const n=t[0];let i=e.length-(n?DS(e,n):0);for(const a of t)i-=zS(e,a);return i}function ZT(e,t,n){for(let i=0;e.length>i;i++){const a=e[(t+i)%e.length],c=e[(n+i)%e.length];if(a!==c)return c>a}return!1}var JT=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){const n=Je(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 Uh(e,"DOMException")}isDOMError(e){return Uh(e,"DOMError")}},e6=class{match(e){return Eo(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,c=!!a;return{type:this.getType(e),value:this.getMessage(e,t),stack:i??a,cause:e.cause?t.next(e.cause):void 0,synthetic:c}}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}}},t6=class{match(e){return!!Uh(e,"ErrorEvent")&&(e.error!=null||this.ur(e))}coerce(e,t){var n;if(e.error!=null)return t.apply(e.error);const i=t.apply(e.message);return B(B({},i),{},{stack:(n=this.cr(e))!==null&&n!==void 0?n:i.stack,synthetic:!0})}ur(e){return Je(e.message)&&e.message.length>0}cr(e){var t,n;const i=e,a=(t=i.lineno)!==null&&t!==void 0?t:0,c=(n=i.colno)!==null&&n!==void 0?n:0;if(Je(i.filename)&&i.filename.length!==0&&a!==0)return`Error
|
|
67
|
+
at ${i.filename}:${a}:${c}`}};const n6=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var s6=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(n6);return i&&(t=i[1],n=i[2]),[t,n]}};const i6=["fatal","error","warning","log","info","debug"];function $S(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 r6=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(yx(e))return e.constructor.name;const t="name"in e?e.name:void 0;return Je(t)&&!tu(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: ${$S(e)}`}isSeverityLevel(e){return Je(e)&&!tu(e)&&i6.indexOf(e)>=0}getStack(e){try{return Je(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:Je(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(Eo(n))return n}}getObjectClassName(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},a6=class{match(e){return yx(e)}coerce(e,t){var n;const i=e.constructor.name;return{type:i,value:`${i} captured as exception with keys: ${$S(e)}`,stack:(n=t.syntheticException)===null||n===void 0?void 0:n.stack,synthetic:!0}}},l6=class{match(e){return J2(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}}},o6=class{match(e){return Uh(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!yx(e))return!1;try{const t=e.detail;return t!=null&&typeof t=="object"&&"reason"in t}catch{return!1}}coerce(e,t){var n;const i=this.getUnhandledRejectionReason(e);return J2(i)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(i)}`,stack:(n=t.syntheticException)===null||n===void 0?void 0:n.stack,synthetic:!0}:t.apply(i)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&e.detail!=null&&typeof e.detail=="object"&&"reason"in e.detail)return e.detail.reason}catch{}return e}};const Gh="$message",Yh="$timestamp",c6=new Set([Gh,Yh]),pg={enabled:!0,max_bytes:32768};function Xh(e){var t;return e?{enabled:(t=e.enabled)!==null&&t!==void 0?t:pg.enabled,max_bytes:d6(e.max_bytes,pg.max_bytes)}:B({},pg)}var u6=class{constructor(e){this.ns=[],this.ss=0,this.Rr=Xh(e)}setConfig(e){this.Rr=Xh(e),this.rs()}add(e){const t=(function(i){let a;try{a=K2(i)}catch{return}try{const c=JSON.parse(a);if(!st(c))return;const u=c,h=u[Gh],f=u[Yh];return!Je(h)||h.trim().length===0||!Je(f)&&!Jt(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 c=0;for(let u=0;a.length>u;u++)a[u]==="%"?(c+=1,u+=2):c+=1;return c})(t.json);n>this.Rr.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.Rr.max_bytes&&this.ns.length>0;){const e=this.ns.shift();e&&(this.ss-=e.bytes)}}};function d6(e,t){if(!Jt(e)||e===1/0||e===-1/0)return t;const n=Math.floor(e);return 0>n?t:n}const tw=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}};function nw(e){return typeof e=="string"||e}function sw(e){return typeof e=="string"?e:void 0}const h6=["$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","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],BS="NativeGzipValidationError",E0=e=>e.length>=2&&e[0]===31&&e[1]===139,iw=(e,t)=>e===_0.GZipJS||t===_0.GZipJS||t==="gzip",rw=e=>!(!e||typeof e!="object")&&("name"in e?String(e.name):"")==="NotReadableError";let zc;const uh=e=>{throw MS(BS,`Native gzip produced invalid output: ${e}`)},f6=(aw=Bt(function*(e,t){18>e.size&&uh("too-short");const n=new Uint8Array(yield e.slice(0,10).arrayBuffer());E0(n)&&n[2]===8||uh("invalid-header");const i=new DataView(yield e.slice(e.size-8).arrayBuffer());i.getUint32(0,!0)!==(c=>{const u=(()=>{if(zc)return zc;zc=[];for(let f=0;256>f;f++){let m=f;for(let x=0;8>x;x++)m=1&m?3988292384^m>>>1:m>>>1;zc[f]=m>>>0}return zc})();let h=4294967295;for(let f=0;c.length>f;f++)h=u[255&(h^c[f])]^h>>>8;return(4294967295^h)>>>0})(t)&&uh("invalid-crc");const a=t.length>>>0;i.getUint32(4,!0)!==a&&uh("invalid-size")}),function(e,t){return aw.apply(this,arguments)});var aw;function T0(){return T0=Bt(function*(e,t=!0,n){try{const a=new TextEncoder().encode(e),c=new globalThis.CompressionStream("gzip"),u=c.writable.getWriter(),h=u.write(a).then(()=>u.close()).catch((i=Bt(function*(x){try{yield u.abort(x)}catch{}throw x}),function(x){return i.apply(this,arguments)})),f=new Response(c.readable).blob(),[m]=yield Promise.all([f,h]);return yield f6(m,a),m}catch(a){if(n!=null&&n.rethrow)throw a;return t&&console.error("Failed to gzip compress data",a),null}var i}),T0.apply(this,arguments)}function PS(e,t){if(e==null)return{};var n,i,a=(function(u,h){if(u==null)return{};var f={};for(var m in u)if({}.hasOwnProperty.call(u,m)){if(h.includes(m))continue;f[m]=u[m]}return f})(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(i=0;c.length>i;i++)t.includes(n=c[i])||{}.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}const p6={}.propertyIsEnumerable;function Qh(e,t){try{return IS(e,t,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch{return[]}}function Sx(e,t,n,i){if(0>=n.remainingNodes)return{stringValue:N0};if(n.remainingNodes--,ns(e))return{boolValue:e};if(typeof e=="bigint")return(function(a,c){const u=a.toString(),h=BigInt("9223372036854775808");return a>=h||-h>a?(c==null||c.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:fo(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:N0};if(e instanceof Date){const a=e.getTime(),c=Number.isFinite(a)?e.toISOString():String(e);return{stringValue:typeof c=="string"?fo(c):String(c)}}n.ancestors.add(e);try{try{const a=e.toJSON;if(typeof a=="function")return Sx(a.call(e),t,n,i+1)}catch{}return Ie(e)?{arrayValue:{values:m6(e,t,n,i+1)}}:{kvlistValue:{values:IS(e,t,n,i+1)}}}finally{n.ancestors.delete(e)}}return{stringValue:fo(String(e))}}function m6(e,t,n,i){const a=[],c=Math.min(e.length,1e3);let u=0;for(;c>u&&n.remainingNodes>0;u++)try{const h=u in e?e[u]:void 0;if(Ve(h))continue;a.push(Sx(h,t,n,i))}catch{a.push({stringValue:Au})}return e.length>u&&a.push({stringValue:N0}),a}function IS(e,t,n,i){const a=[];for(const c in e)if(p6.call(e,c)){if(!c){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[c];if(Zt(u)||ue(u))continue;a.push({key:fo(c),value:Sx(u,t,n,i)})}catch{a.push({key:fo(c),value:{stringValue:Au}})}}return a}function FS(e,t,n){return B(B(B(B({},TS({},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 g6=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function US(e,t){const n=TS({},e),i={};for(const a of g6)({}).hasOwnProperty.call(n,a)&&(i[a]=n[a],delete n[a]);return[...Qh(n,t),...Qh(i,t)]}const lw={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"},HS={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}},x6=HS.info;function v6(e){try{return fo(String(e))}catch{return Au}}function b6(e,t,n,i){const a=e.level||"info",{text:c,number:u}=HS[a]||x6,h=(function(b=Date.now()){return String(b)+"000000"})(Jt(i)?i:void 0),f={};t.distinctId&&(f.posthogDistinctId=t.distinctId),t.sessionId&&(f.sessionId=t.sessionId),t.windowId&&(f["window.id"]=t.windowId),Ve(t.sessionStartTimestamp)||(f.sessionStartTimestamp=String(t.sessionStartTimestamp)),Ve(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 m=B({},f),x=e.attributes;if(x){let b=[];try{b=Object.keys(x)}catch{b=[]}for(const y of b){let _;try{_=x[y]}catch{_=Au}Object.defineProperty(m,y,{value:_,enumerable:!0,writable:!0,configurable:!0})}}const v={timeUnixNano:h,observedTimeUnixNano:h,severityNumber:u,severityText:c,body:{stringValue:v6(e.body)},attributes:Qh(m,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 qS(e,t,n){return FS(e,t,n)}function VS(e,t,n,i){return{resourceLogs:[{resource:{attributes:US(t)},scopeLogs:[{scope:{name:n,version:i},logRecords:e}]}]}}var GS=class{constructor(e){this.ls=e,this.us=0}get pending(){return!!this.hs}arm(e){this.clear(),this.us=Date.now()+e,this.hs=RS(()=>{this.hs=void 0,this.ls()},e)}armNoEarlierThan(e){this.hs&&Date.now()+e<=this.us||this.arm(e)}clear(){this.hs&&(clearTimeout(this.hs),this.hs=void 0)}};function YS(){return .75+.5*Math.random()}function XS(e,t,n,i){const a=Math.min(Math.max(0,t-1),6),c=e*Math.pow(2,a);return Math.round(Math.min(c,Math.max(i,e))*n)}var y6=class{constructor(e,t,n,i,a,c=()=>Promise.resolve(),u){var h;this._instance=e,this.Rr=t,this.$=n,this.cs=i,this.ds=a,this.vs=c,this.fs=u,this.ps=new GS(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new AS,this.ks=0,this.Ss=1,this.xs=0,this.Cs=0,this.$s=!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(Ai.LogsQueue,[])}reset(){this.ps.clear(),this.xs=0,this.Cs=0,this.$s=!1,this.ks=0,this.Ss=1,this.ws.reset(),this.Es=this.Rr.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.$.info("Log was rejected in beforeSend function");if(!this.Ds())return;const a={record:b6(i,(n=t==null?void 0:t.context)!==null&&n!==void 0?n:this.cs(),this.$,t==null?void 0:t.occurredAtMs)};this.ds(()=>this.Ls(a))}Os(e){const t=this.Rr.beforeSend;if(!t)return e;const n=Ie(t)?t:[t];let i=e;for(const a of n)try{const c=a(i);if(!c)return this.$.info("Log was rejected in beforeSend function"),null;i=c}catch(c){return this.$.error("Error in beforeSend function for log:",c),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.Cs=0,this.$s=!1),this.Rs>this.Cs?(this.Cs++,!0):(this.$s||(this.$.warn(`captureLog dropping logs: exceeded ${this.Rs} logs per ${this.Ps}ms`),this.$s=!0),!1)}flush(){var e=this;return Bt(function*(){if(!e._instance.isDisabled)return e.ys||(e.ys=e.Ns().finally(()=>{e.ys=null})),e.ys})()}Ns(){var e=this;return Bt(function*(){var t;e.ps.clear();let n=(t=e._instance.getPersistedProperty(Ai.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 c,u;const h=e._s;e.bs=0;const f=Math.min(n.length,e.Es),m=n.slice(0,f),x=VS(m.map(b=>b.record),e.qs(),(c=e.fs)!==null&&c!==void 0?c:e._instance.getLibraryId(),e._instance.getLibraryVersion()),v=yield e._instance.js(x);if(e._s!==h)return;if(v.kind==="too-large"&&m.length>1)e.Es=Math.max(1,Math.floor(m.length/2)),e.$.warn(`Logs batch of size ${m.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.$.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.Rr.maxBatchRecordsPerPost>e.Es&&(e.Es=Math.min(e.Rr.maxBatchRecordsPerPost,e.Es+1)),yield e.Bs(m.length),n=(u=e._instance.getPersistedProperty(Ai.LogsQueue))!==null&&u!==void 0?u:[],a+=m.length,v.kind==="fatal"))throw v.error}})()}Bs(e){var t=this;return Bt(function*(){var n;const i=Math.max(0,e-t.bs),a=(n=t._instance.getPersistedProperty(Ai.LogsQueue))!==null&&n!==void 0?n:[];t._instance.setPersistedProperty(Ai.LogsQueue,a.slice(i)),yield t.vs()})()}qs(){return qS(this.Rr,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(e){var t;if(this._instance.optedOut)return;const n=(t=this._instance.getPersistedProperty(Ai.LogsQueue))!==null&&t!==void 0?t:[];this.Is>n.length||(n.shift(),this.bs++,this.$.info("Logs queue is full, dropping oldest record.")),n.push(e),this._instance.setPersistedProperty(Ai.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()))}Hs(){return Math.max(XS(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){const e=this._instance.getPersistedProperty(Ai.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return Bt(function*(){t.ps.clear();const n=t.flush().catch(()=>{});e!==void 0?yield K_(n,e):yield n})()}flushWithTimeout(e){var t=this;return Bt(function*(){const n=t.flush();yield K_(n,e,()=>{n.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},e=>{this.ks++,this.Ss=YS(),this.$.error("PostHog logs flush failed:",e)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.Hs())})}};const mg=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function ow(e){return String(e)+"000000"}function cw(e,t,n,i){let a="";return i&&(a=Object.keys(i).sort().map(c=>`${JSON.stringify(c)}:${JSON.stringify(i[c])}`).join(",")),`${e}\0${t}\0${n??""}\0${a}`}var _6=class{constructor(e,t,n){this._instance=e,this.Rr=t,this.$=n,this.zs=new Map,this.ps=new GS(()=>this.flush().catch(i=>{this.$.error("Metrics flush failed:",i)})),this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.ws=new AS,this.ks=0,this.Ss=1,this.Gs=0}count(e,t=1,n){this.Zs({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.Zs({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.Zs({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=Bt(function*(){t&&(yield t.catch(()=>{})),yield e.Qs()});return function(){return i.apply(this,arguments)}})()().finally(()=>{this.ys===n&&(this.ys=null)});return this.ys=n,n}drainWindow(){if(this.zs.size===0)return null;const e=this.zs;return this.zs=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.zs=new Map,this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set}Zs(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.$.warn("Dropping metric with empty name");if(typeof t.value!="number"||!Number.isFinite(t.value))return void this.$.warn(`Dropping metric '${t.name}': value must be a finite number`);if(t.type==="count"&&0>t.value)return void this.$.warn(`Dropping count '${t.name}': counters are monotonic, value must be >= 0`);let n,i;try{n=t.attributes?B({},t.attributes):void 0,i=cw(t.type,t.name,t.unit,n)}catch(u){return void this.$.warn(`Dropping metric '${t.name}': attributes could not be serialized`,u)}let a=this.zs.get(i);if(!a){if(!this.Ks())return;a={name:t.name,type:t.type,unit:t.unit,attributes:n,windowStartMs:Date.now()},this.zs.set(i,a)}const c=this.Ws.get(t.name);c===void 0?this.Ws.set(t.name,t.type):c===t.type||this.Vs.has(t.name)||(this.Vs.add(t.name),this.$.warn(`Metric name '${t.name}' is already used as a ${c}; recording it as a ${t.type} too will blend both series in charts. Use a distinct name.`)),this.Xs(a,t.value),this.Fs()}Ks(){return this.Rr.maxSeriesPerFlush>this.zs.size||(this.Us||(this.Us=!0,this.$.warn(`Metric series cap reached (${this.Rr.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(mg.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,c){for(let u=0;c.length>u;u++)if(c[u]>=a)return u;return c.length})(t,mg)]+=1;break}}}Os(e){const t=this.Rr.beforeSend;if(!t)return e;const n=Ie(t)?t:[t];let i=e;for(const a of n)try{const c=a(i);if(!c)return this.$.info("Metric was rejected in beforeSend function"),null;i=c}catch(c){return this.$.error("Error in beforeSend function for metric:",c),null}return i}Fs(){this.ps.pending||this.ps.arm(this.Hs())}Hs(){return Math.max(XS(this.Rr.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Qs(){var e=this;return Bt(function*(){if(e.ps.clear(),e.zs.size===0)return;const t=e.zs;e.zs=new Map,e.Us=!1,e.Ws=new Map,e.Vs=new Set;const n=e.Gs,i=yield e._instance.Ys(e.Js(t));if(n===e.Gs)switch(e.ws.record(i),i.kind==="retry-later"?(e.ks++,e.Ss=YS()):(e.ks=0,e.Ss=1),e.ps.pending&&e.ps.arm(e.Hs()),i.kind){case"ok":return;case"retry-later":return e.ho(t),void e.ps.armNoEarlierThan(e.Hs());case"too-large":return void e.$.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e.$.error("Failed to send metrics batch:",i.error)}})()}Js(e){return t=this.vo(e),n=(function(c,u,h){return FS(c,u,h)})(this.Rr,this._instance.getLibraryId(),this._instance.getLibraryVersion()),i=this._instance.getLibraryId(),a=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:US(n)},scopeMetrics:[{scope:{name:i,version:a},metrics:t}]}]};var t,n,i,a}vo(e){const t=ow(Date.now()),n=new Map;for(const u of e.values()){var i;const h=cw(u.type,u.name,u.unit,void 0);let f=n.get(h);f||(f=B({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 m=Qh((i=u.attributes)!==null&&i!==void 0?i:{},this.$),x=ow(u.windowStartMs);if(u.type==="count"){var a;const v={attributes:m,startTimeUnixNano:x,timeUnixNano:t,asDouble:(a=u.total)!==null&&a!==void 0?a:0};f.sum.dataPoints.push(v)}else if(u.type==="gauge"){var c;const v={attributes:m,timeUnixNano:t,asDouble:(c=u.last)!==null&&c!==void 0?c:0};f.gauge.dataPoints.push(v)}else u.hist&&f.histogram.dataPoints.push({attributes:m,startTimeUnixNano:x,timeUnixNano:t,count:u.hist.count,sum:u.hist.sum,min:u.hist.min,max:u.hist.max,bucketCounts:u.hist.bucketCounts,explicitBounds:mg})}return Array.from(n.values())}ho(e){for(const[i,a]of e){const c=this.zs.get(i);if(c)switch(c.windowStartMs=Math.min(c.windowStartMs,a.windowStartMs),c.type){case"count":var t,n;c.total=((t=c.total)!==null&&t!==void 0?t:0)+((n=a.total)!==null&&n!==void 0?n:0);break;case"gauge":break;case"histogram":if(a.hist)if(c.hist){c.hist.count+=a.hist.count,c.hist.sum+=a.hist.sum,c.hist.min=Math.min(c.hist.min,a.hist.min),c.hist.max=Math.max(c.hist.max,a.hist.max);for(let u=0;c.hist.bucketCounts.length>u;u++)c.hist.bucketCounts[u]+=a.hist.bucketCounts[u]}else c.hist=a.hist}else this.Ks()&&this.zs.set(i,a)}}};const QS=(e,{debugEnabled:t}={})=>{const n={N(i,...a){te&&(hr.DEBUG||te.POSTHOG_DEBUG||t)&&!ue(te.console)&&te.console&&("__rrweb_original__"in te.console[i]?te.console[i].__rrweb_original__:te.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)=>QS(`${e} ${i}`,a)};return n},ye=QS("[PostHog.js]"),Qt=ye.createLogger,w6=Qt("[ExternalScriptsLoader]"),Wh=e=>{const t=he==null?void 0:he.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]}},Wa=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return w6.warn(`${t} was requested but loading of external scripts is disabled.`),n("Loading of external scripts is disabled");const i=Wh(t);if(i){if(i.__posthog_loading_callback_fired)return n();const c=i.__posthog_loading_error;return c?n(c):(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(!he)return n("document not found");if(Wh(t))return Wa(e,t,n);let c=he.createElement("script");if(c.type="text/javascript",c.crossOrigin="anonymous",c.src=t,c.onload=h=>{c.__posthog_loading_callback_fired=!0,n(void 0,h)},c.onerror=h=>{c.__posthog_loading_error=h,n(h)},e.config.prepare_external_dependency_script&&(c=e.config.prepare_external_dependency_script(c)),!c)return n("prepare_external_dependency_script returned null");if(e.config.external_scripts_inject_target==="head")he.head.appendChild(c);else{const h=he.querySelectorAll("body > script");var u;h.length>0?(u=h[0].parentNode)===null||u===void 0||u.insertBefore(c,h[0]):he.body.appendChild(c)}};he!=null&&he.body?a():he==null||he.addEventListener("DOMContentLoaded",a)},gg={},uw=(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)};$e.__PosthogExtensions__=$e.__PosthogExtensions__||{},$e.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{if(t==="remote-config"){const a=e.requestRouter.endpointFor("assets",`/array/${e.config.token}/config.js`);return void Wa(e,a,n)}const i=e.config.strict_script_versioning;if(i){const a=e.requestRouter.endpointFor("assets",`/static/${e.version}/${t}.js`),c=gg[a];if(i==="fallback"&&c){if(Wh(c))return void Wa(e,c,n);delete gg[a]}return void Wa(e,a,i==="fallback"?(u,h)=>{if(u)if(typeof u=="string")n(u);else{var f;const m=uw(e,t);gg[a]=m;const x=Wh(a);x==null||(f=x.parentNode)===null||f===void 0||f.removeChild(x),Wa(e,m,n)}else n(void 0,h)}:n)}Wa(e,uw(e,t),n)},$e.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{const i=e.requestRouter.endpointFor("api",t);Wa(e,i,n)},hr.DEBUG=!1,hr.LIB_VERSION="1.434.9",hr.LIB_NAME="web";var yn=hr;const S6="$people_distinct_id",oi="distinct_id",kx="$device_id",xg="$device_model",Kh="__alias",k6="__cmpns",dw="$fbc",po="$fbc_persistence",hw="$fbp",su="$fbp_persistence",A0="__timers",WS="$autocapture_disabled_server_side",M0="$heatmaps_enabled_server_side",R0="$exception_capture_enabled_server_side",KS="$error_tracking_suppression_rules",O0="$error_tracking_capture_extension_exceptions",L0="$web_vitals_enabled_server_side",jx="$dead_clicks_enabled_server_side",Nx="$product_tours_enabled_server_side",ZS="$logs_capture_enabled_server_side",JS="$web_vitals_allowed_metrics",iu="$session_recording_remote_config",j6="$session_recording_enabled_server_side",N6="$replay_sample_rate",C6="$replay_override_sampling",E6="$replay_override_linked_flag",T6="$replay_override_url_trigger",A6="$replay_override_event_trigger",oo="$sesid",ek="$session_is_sampled",M6="$session_past_minimum_duration",R6="$session_recording_url_trigger_activated_session",O6="$session_recording_event_trigger_activated_session",L6="$debug_first_full_snapshot_timestamp",D6="$sess_rec_flush_size",ci="$enabled_feature_flags",cr="$active_feature_flags",D0="$early_access_features",el="$feature_flag_details",sa="$feature_flag_payloads",tl="$feature_flag_request_id",ru="$minimal_flag_called_events",Ti="$override_feature_flags",Ka="$override_feature_flag_payloads",ia="$stored_person_properties",ra="$stored_group_properties",tk="$groups",z0="$surveys",Zh="$surveys_loaded_at",nk="$surveys_activated",sk="$surveys_activated_session",ik="$surveys_activated_timestamps",$0="ph_product_tours",z6="$product_tours_activated",$6="$product_tours_activated_session",B6="$conversations_widget_session_id",P6="$conversations_ticket_id",I6="$conversations_widget_state",F6="$conversations_user_traits",aa="$flag_call_reported",Wc="$flag_call_reported_session_id",bu="$feature_flag_errors",la="$feature_flag_evaluated_at",ts="$user_state",B0="$client_session_props",U6="$capture_rate_limit",rk="$initial_campaign_params",ak="$initial_referrer_info",co="$initial_person_info",Cx="$epp",vg="$posthog_cookieless",lk="$cookieless_mode",ok="$sdk_debug_extensions_init_method",ck="$sdk_debug_extensions_init_time_ms",uk="$sdk_debug_recording_script_not_loaded",dk="$sdk_debug_replay_stale_config",H6="$sdk_debug_replay_event_trigger_status",q6="$sdk_debug_replay_linked_flag_trigger_status",V6="$sdk_debug_replay_matched_recording_trigger_groups",G6="$sdk_debug_replay_pending_trigger_conditions",Y6="$sdk_debug_replay_remote_trigger_matching_config",X6="$sdk_debug_replay_trigger_groups_count",Q6="$sdk_debug_replay_url_trigger_status",W6="$session_recording_start_reason",Ex="PostHog loadExternalDependency extension not found.",ur="anonymous",Oh="identified",hk="identified_only",yu="visibilitychange",Jh="beforeunload",Tx="$pageview",fw="$pageleave",fk="$identify",pw="$groupidentify";function uo(e,t){Ie(e)&&e.forEach(t)}function jt(e,t){if(!Ve(e))if(Ie(e))e.forEach(t);else if((n=>n instanceof FormData)(e))e.forEach((n,i)=>t(n,i));else for(const n in e)bx.call(e,n)&&t(e[n],n)}const Dt=function(e,...t){for(const n of t)for(const i in n)n[i]!==void 0&&(e[i]=n[i]);return e};function Lh(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 K6=function(e){return function(...t){try{return e.apply(this,t)}catch(n){ye.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),ye.critical(n)}}},Ax=function(e){const t={};return jt(e,function(n,i){(Je(n)&&n.length>0||Jt(n))&&(t[i]=n)}),t};function pk(e){const t=B({},e);for(const n of["name","message","stack","cause","errors"])try{n in e&&(t[n]=e[n])}catch{}return t}const Z6=["herokuapp.com","vercel.app","netlify.app"];function J6(e){const t=e==null?void 0:e.hostname;if(!Je(t))return!1;const n=t.split(".").slice(-2).join(".");for(const i of Z6)if(n===i)return!1;return!0}function yt(e,t,n,i){const{capture:a=!1,passive:c=!0}=i??{};e==null||e.addEventListener(t,n,{capture:a,passive:c})}function P0(e){return e.name==="ph_toolbar_internal"}const ef=e=>{if(he){try{const t=e+"=",n=he.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 Jt(e)&&isFinite(e)&&Math.floor(e)===e});var eA=class I0{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 c=new Uint8Array(16);return c[0]=t/Math.pow(2,40),c[1]=t/Math.pow(2,32),c[2]=t/Math.pow(2,24),c[3]=t/Math.pow(2,16),c[4]=t/256,c[5]=t,c[6]=112|n>>>8,c[7]=n,c[8]=128|i>>>24,c[9]=i>>>16,c[10]=i>>>8,c[11]=i,c[12]=a>>>24,c[13]=a>>>16,c[14]=a>>>8,c[15]=a,new I0(c)}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 I0(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}},tA=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 Jt(t)&&isFinite(t)?Math.min(Math.max(Math.floor(t),0),0xffffffffffff):0})();if(e>this.Ct)this.Ct=e,this.Mt();else{if(this.Ct>=e+1e4)return;this.It++,this.It>4398046511103&&(this.Ct++,this.Mt())}return eA.fromFieldsV7(this.Ct,Math.trunc(this.It/Math.pow(2,30)),this.It&Math.pow(2,30)-1,this.Tt.nextUint32())}Mt(){this.It=1024*this.Tt.nextUint32()+(1023&this.Tt.nextUint32())}constructor(){this.Ct=0,this.It=0,this.Tt=new nA}};let mk=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};te&&!ue(te.crypto)&&crypto.getRandomValues&&(mk=e=>crypto.getRandomValues(e));var nA=class{nextUint32(){return this.Rt.length>this.$t||(mk(this.Rt),this.$t=0),this.Rt[this.$t++]}constructor(){this.Rt=new Uint32Array(8),this.$t=1/0}};let mw;const ui=()=>sA().toString(),sA=()=>(mw||(mw=new tA)).generate();let $c="";const iA=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let Kl=null;const Gt={Et(){if(!Zt(Kl))return Kl;if(Kl=!1,he)try{const e=`__ph_cookie_support_${ui()}`;Gt.At(e,"xyz"),Kl=ef(e)==='"xyz"',Gt.Lt(e)}catch{Kl=!1}return Kl},Pt(e){ye.error("cookieStore error: "+e)},Ot:ef,Dt(e){let t;try{t=JSON.parse(Gt.Ot(e))||{}}catch{}return t},At(e,t,n,i,a){if(!he)return!1;try{let c="",u="";const h=(function(m,x){if(x){let v=(function(b,y=he){if($c)return $c;if(!y||["localhost","127.0.0.1"].includes(b))return"";const _=b.split(".");let j=Math.min(_.length,8);const N="dmn_chk_"+ui();for(;!$c&&j--;){const S=_.slice(j).join("."),C=N+"=1;domain=."+S+";path=/";y.cookie=C+";max-age=3",y.cookie.includes(N)&&(y.cookie=C+";max-age=0",$c=S)}return $c})(m);if(!v){const b=(y=>{const _=y.match(iA);return _?_[0]:""})(m);b!==v&&ye.info("Warning: cookie subdomain discovery mismatch",b,v),v=b}return v?"; domain=."+v:""}return""})(he.location.hostname,i);if(n){const m=new Date;m.setTime(m.getTime()+864e5*n),c="; expires="+m.toUTCString()}a&&(u="; secure");const f=e+"="+encodeURIComponent(JSON.stringify(t))+c+"; SameSite=Lax; path=/"+h+u;return f.length>3686.4&&ye.warn("cookieStore warning: large cookie, len="+f.length),he.cookie=f,!0}catch{return!1}},Lt(e,t){if(he!=null&&he.cookie)try{Gt.At(e,"",-1,t)}catch{return}}};let bg=null;const ot={Et(){if(!Zt(bg))return bg;let e=!0;if(ue(te))e=!1;else try{const t="__mplssupport__";ot.At(t,"xyz"),ot.Ot(t)!=='"xyz"'&&(e=!1),ot.Lt(t)}catch{e=!1}return e||ye.error("localStorage unsupported; falling back to cookie store"),bg=e,e},Pt(e){ye.error("localStorage error: "+e)},Ot(e){try{return te==null?void 0:te.localStorage.getItem(e)}catch(t){ot.Pt(t)}return null},Dt(e){try{return JSON.parse(ot.Ot(e))||{}}catch{}return null},At(e,t){try{return te==null||te.localStorage.setItem(e,JSON.stringify(t)),!0}catch(n){ot.Pt(n)}return!1},Lt(e){try{te==null||te.localStorage.removeItem(e)}catch(t){ot.Pt(t)}}},yg=[ia,cr,ci,el,sa,tl,la,bu,aa],Za=[kx,oi,oo,ek,Cx,co,po,ts],tf=e=>e+"_cpm",rA=["__proto__","constructor","prototype"],_g=e=>{if(!st(e))return{};const t={};return Object.keys(e).forEach(n=>{rA.indexOf(n)===-1&&(t[n]=e[n])}),t},wg=(e,t=[])=>{const n={};return[...Za,...t].forEach(i=>{const a=e[i];ue(a)||Zt(a)||a===""||(n[i]=a)}),n},gk=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)},gw=(e,t)=>({p:t,f:gk(JSON.stringify(e))}),xw=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{const n=Gt.Dt(tf(e)),i=(n==null?void 0:n.f)===gk(t)&&Ie(n.p);return{properties:i?n.p:[],isValid:i}}catch{return{properties:[],isValid:!1}}},Sg=(e,t)=>t+"|"+(Gt.Ot(tf(e))||""),Zl={},F0={Et:()=>!0,Pt(e){ye.error("memoryStorage error: "+e)},Ot:e=>e in Zl?Zl[e]:null,Dt:e=>e in Zl?Zl[e]:null,At:(e,t)=>(Zl[e]=t,!0),Lt(e){delete Zl[e]}};let qa=null;const Ot={Et(){if(!Zt(qa))return qa;if(qa=!0,ue(te))qa=!1;else try{const e="__support__";Ot.At(e,"xyz"),Ot.Ot(e)!=='"xyz"'&&(qa=!1),Ot.Lt(e)}catch{qa=!1}return qa},Pt(e){ye.error("sessionStorage error: ",e)},Ot(e){try{return te==null?void 0:te.sessionStorage.getItem(e)}catch(t){Ot.Pt(t)}return null},Dt(e){try{return JSON.parse(Ot.Ot(e))||null}catch{}return null},At(e,t){try{return te==null||te.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(n){Ot.Pt(n)}return!1},Lt(e){try{te==null||te.sessionStorage.removeItem(e)}catch(t){Ot.Pt(t)}}};var aA=class{constructor(e){this._instance=e}get Rr(){return this._instance.config}get consent(){return this.Lo()?0:this.No}isOptedOut(){return this.Rr.cookieless_mode==="always"||this.isRejected()||this.consent===-1&&this.Rr.cookieless_mode==="on_reject"}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Rr.opt_out_capturing_by_default}optInOut(e){this.qo.At(this.jo,e?1:0,this.Rr.cookie_expiration,this.Rr.cross_subdomain_cookie,this.Rr.secure_cookie)}reset(){this.qo.Lt(this.jo,this.Rr.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 og(e)?1:Ue(kT,e)?0:-1}get qo(){const e=this.Rr.opt_out_capturing_persistence_type,t=e==="localStorage"?ot:Gt,n=t.Et()?t:F0;if(!this.Bo||this.Bo!==n){this.Bo=n;const i=e==="localStorage"?Gt:ot;i.Ot(this.jo)&&(this.Bo.Ot(this.jo)||this.optInOut(og(i.Ot(this.jo))),i.Lt(this.jo,this.Rr.cross_subdomain_cookie))}return this.Bo}Lo(){return!!this.Rr.respect_dnt&&[jn==null?void 0:jn.doNotTrack,jn==null?void 0:jn.msDoNotTrack,$e.doNotTrack,jn==null?void 0:jn.globalPrivacyControl].some(e=>og(e))}};function xk(e,t){var n;const i=e==null||(n=e.config)===null||n===void 0?void 0:n.get_current_url;if(!kn(i))return t;try{const a=i(t);return Je(a)&&a?a:t}catch(a){return ye.error("Error in get_current_url, falling back to window.location.href",a),t}}function vw(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 Li(e){return!!e&&e.nodeType===1}function Pn(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function vk(e){return!!e&&e.nodeType===3}function Mx(e){return!!e&&e.nodeType===11&&Li(e.host)}function Rx(e){return e?vf(e).split(/\s+/):[]}function bw(e,t){const n=(function(i){var a;const c=te==null||(a=te.location)===null||a===void 0?void 0:a.href;return ue(c)?void 0:xk(i,c)})(t);return!!(n&&e&&e.some(i=>n.match(i)))}function yo(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 Rx(t)}function bk(e){return Ve(e)?null:vf(e).split(/(\s+)/).filter(t=>lu(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function _u(e){let t="";return mo(e)&&!wu(e)&&e.childNodes&&e.childNodes.length&&jt(e.childNodes,function(n){var i;vk(n)&&n.textContent&&(t+=(i=bk(n.textContent))!==null&&i!==void 0?i:"")}),vf(t)}function au(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 Ox=["a","button","form","input","select","textarea","label"];function U0(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 H0(e,t){if(ue(t))return!0;for(const n of e)if(t.some(i=>U0(n,i)))return!0;return!1}function yk(e){const t=e.parentNode;return!(!t||!Li(t))&&t}const kg=[".ph-no-autocapture","[data-ph-no-autocapture]"],_k=["next","previous","prev",">","<"],lA=[..._k,"+","-","−","–"],yw=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,_w=[".ph-no-rageclick",".ph-no-capture"],oA=["","text","search","email","password","url","tel","number"];function wk(e,t){if(!te||Lx(e))return!1;let n,i,a;var c,u;if(ns(t)?(n=!!t&&_w,i=void 0,a=!1):(n=(c=t==null?void 0:t.css_selector_ignorelist)!==null&&c!==void 0?c:_w,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||!Li(f))&&(!!Pn(f,"textarea")||(Pn(f,"input")?Ue(oA,(f.getAttribute("type")||"").toLowerCase()):(function(m){var x;if(m.isContentEditable)return!0;const v=(x=m.getAttribute)===null||x===void 0?void 0:x.call(m,"contenteditable");return v==="true"||v===""})(f)))})(e))return!1;const{targetElementList:h}=Sk(e,!1);return!(function(f,m){if(f===!1||ue(f))return!1;let x;if(f===!0)x=_k;else{if(!Ie(f))return!1;if(f.length>10)return ye.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;x=f.map(v=>v.toLowerCase())}return m.some(({safeText:v,ariaLabel:b})=>x.some(y=>yw(v,y)||yw(b,y)))})(i,h.map(f=>{var m;return{safeText:_u(f).toLowerCase(),ariaLabel:((m=f.getAttribute("aria-label"))===null||m===void 0?void 0:m.toLowerCase().trim())||""}}))&&!H0(h,n)}const Lx=e=>!e||Pn(e,"html")||!Li(e),Sk=(e,t)=>{if(!te||Lx(e))return{parentIsUsefulElement:!1,targetElementList:[]};let n=!1;const i=[e];let a=e;for(;a.parentNode&&!Pn(a,"body");){if(Mx(a.parentNode)){i.push(a.parentNode.host),a=a.parentNode.host;continue}const c=yk(a);if(!c)break;if(t||Ox.indexOf(c.tagName.toLowerCase())>-1)n=!0;else try{const u=te.getComputedStyle(c);u&&u.getPropertyValue("cursor")==="pointer"&&(n=!0)}catch{}i.push(c),a=c}return{parentIsUsefulElement:n,targetElementList:i}};function mo(e){const t=new Set;let n=0;for(let c=e;c.parentNode&&!Pn(c,"body");c=c.parentNode){if(n++>=1e3||t.has(c))return!1;t.add(c);const u=yo(c);if(Ue(u,"ph-sensitive")||Ue(u,"ph-no-capture"))return!1}if(Ue(yo(e),"ph-include"))return!0;const i=e.type||"";if(Je(i))switch(i.toLowerCase()){case"hidden":case"password":return!1}const a=e.name||e.id||"";return!Je(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 wu(e){return!!(Pn(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Pn(e,"select")||Pn(e,"textarea")||e.getAttribute("contenteditable")==="true")}const ww=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}))$"),Sw=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,cA=[16,15,14,13],uA=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),kw=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),jw=/[0-9A-Za-z_]/;function dA(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 lu(e,t=!0){return!(Ve(e)||Je(e)&&(e=vf(e),(t?ww.test((e||"").replace(/[- ]/g,"")):(function(n){let i;for(Sw.lastIndex=0;i=Sw.exec(n);){const a=i[2];if(!a)continue;const c=a.replace(/[- ]/g,"");for(let u=0;c.length>u;u++)for(const h of cA){const f=u+h;if(c.length>=f){const m=c.slice(u,f);if(ww.test(m)&&dA(m))return!0}}}return!1})(e))||(t?uA.test(e):(function(n){let i;for(kw.lastIndex=0;i=kw.exec(n);){const a=i[1],c=i[3];if(!(a&&c&&jw.test(a)&&jw.test(c)))return!0}return!1})(e))))}function Nw(e){let t=_u(e);return t=`${t} ${kk(e)}`.trim(),lu(t)?t:""}function kk(e){let t="";return e&&e.childNodes&&e.childNodes.length&&jt(e.childNodes,function(n){var i;if(n&&((i=n.tagName)===null||i===void 0?void 0:i.toLowerCase())==="span")try{const a=_u(n);t=`${t} ${a}`.trim(),n.childNodes&&n.childNodes.length&&(t=`${t} ${kk(n)}`.trim())}catch(a){ye.error("[AutoCapture]",a)}}),t}function Cw(e){return e.replace(/"|\\"/g,'\\"')}function hA(e){const t=e.attr__class;if(t)return Ie(t)?t:Rx(t)}const dh=Qt("[Dead Clicks]"),fA=()=>!0,pA=e=>{var t;const n=!!(!((t=e.instance.persistence)===null||t===void 0)&&t.get_property(jx)),i=e.instance.config.capture_dead_clicks;return ns(i)?i:!!st(i)||n};var Ew=class{get lazyLoadedDeadClicksAutocapture(){return this.Ho}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({[jx]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.zo(()=>{this.Uo()}):this.stop()}zo(e){var t,n,i;!((t=$e.__PosthogExtensions__)===null||t===void 0)&&t.initDeadClicksAutocapture?e():(n=$e.__PosthogExtensions__)===null||n===void 0||(i=n.loadExternalDependency)===null||i===void 0||i.call(n,this.instance,"dead-clicks-autocapture",a=>{a?dh.error("failed to load script",a):e()})}Uo(){var e;if(he){if(!this.Ho&&(!((e=$e.__PosthogExtensions__)===null||e===void 0)&&e.initDeadClicksAutocapture)){const t=st(this.instance.config.capture_dead_clicks)?B({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this.Ho=$e.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.Ho.start(he),dh.info("starting...")}}else dh.error("`document` not found. Cannot start.")}stop(){this.Ho&&(this.Ho.stop(),this.Ho=void 0,dh.info("stopping..."))}};const Bc=Qt("[SegmentIntegration]");function Tw(e,t,n=!0){const i=e.config.segment;if(!i)return t();const{analytics:a,filterProperties:c}=(h=>kn(h.register))(u=i)?{analytics:u}:u;var u;(function(h,f,m,x){const v=y=>{const _=()=>y.anonymousId()||ui();h.config.get_device_id=_,x&&y.id()&&(h.register({distinct_id:y.id(),$device_id:_()}),h.persistence.set_property(ts,Oh)),m(x?void 0:y.anonymousId()||void 0)},b=f.user();"then"in b&&kn(b.then)?b.then(v):v(b)})(e,a,h=>{a.register(((f,m,{filterProperties:x}={})=>{typeof Promise<"u"&&Promise.resolve||Bc.warn("This browser does not have Promise support, and can not use the segment integration");const v=(b,y)=>{if(!y)return b;const _=!!m&&b.event.anonymousId===m&&!b.event.userId;_||b.event.userId||b.event.anonymousId===f.get_distinct_id()||(Bc.info("No userId set, resetting PostHog"),f.reset()),_||(m=void 0),b.event.userId&&b.event.userId!==f.get_distinct_id()&&(Bc.info("UserId set, identifying with PostHog"),f.identify(b.event.userId));let j=f.calculateEventProperties(y,b.event.properties);if(!Ve(x)){const N=b.event.properties||{},S={};for(const E of Object.keys(j))bx.call(N,E)||(S[E]=j[E]);const C=((E,R)=>{const L=Ie(E)?E:[E];let O=B({},R);for(const F of L)try{if(O=F(O),Ve(O))return null}catch(D){return Bc.error("Error in Segment filterProperties:",D),null}return O})(x,S);if(Ve(C))return b;j=C}return b.event.properties=Object.assign({},j,b.event.properties),b};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(b){return v(b,b.event.event)},page(b){return v(b,Tx)},identify(b){return v(b,fk)},screen(b){return v(b,"$screen")}}})(e,h,{filterProperties:c})).then(()=>{t()},f=>{Bc.error("Failed to register the Segment integration",f),t()})},n)}const jk="posthog-js";function Nk(e,{organization:t,projectId:n,prefix:i,severityAllowList:a=["error"],sendExceptionsToPostHog:c=!0}={}){return u=>{var h,f,m,x,v;if(a!=="*"&&!a.includes(u.level)||!e.__loaded)return u;u.tags||(u.tags={});const b=e.requestRouter.endpointFor("ui",`/project/${e.config.token}/person/${e.get_distinct_id()}`);u.tags["PostHog Person URL"]=b,e.sessionRecordingStarted()&&(u.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));const y=((h=u.exception)===null||h===void 0?void 0:h.values)||[],_=y.map(S=>B(B({},S),{},{stacktrace:S.stacktrace?B(B({},S.stacktrace),{},{type:"raw",frames:(S.stacktrace.frames||[]).map(C=>B(B({},C),{},{platform:"web:javascript"}))}):void 0})),j={$exception_message:((f=y[0])===null||f===void 0?void 0:f.value)||u.message,$exception_type:(m=y[0])===null||m===void 0?void 0:m.type,$exception_level:u.level,$exception_list:_,$sentry_event_id:u.event_id,$sentry_exception:u.exception,$sentry_exception_message:((x=y[0])===null||x===void 0?void 0:x.value)||u.message,$sentry_exception_type:(v=y[0])===null||v===void 0?void 0:v.type,$sentry_tags:u.tags};var N;return t&&n&&(j.$sentry_url=(i||"https://sentry.io/organizations/")+t+"/issues/?project="+n+"&query="+u.event_id),c&&((N=e.exceptions)===null||N===void 0||N.sendExceptionEvent(j)),u}}var mA=class{constructor(e,t,n,i,a,c){this.name=jk,this.setupOnce=function(u){u(Nk(e,{organization:t,projectId:n,prefix:i,severityAllowList:a,sendExceptionsToPostHog:c==null||c}))}}},Aw=class{constructor(e){this.Wo=(t,n,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(ye.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.Zo=(e=this._instance.sessionManager)===null||e===void 0?void 0:e.onSessionId(this.Wo)}destroy(){var e;(e=this.Zo)===null||e===void 0||e.call(this),this.Zo=void 0}doPageView(e,t){var n;const i=this.Qo(e,t);return this.Vo={pathname:(n=te==null?void 0:te.location.pathname)!==null&&n!==void 0?n:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),i}doPageLeave(e){var t;return this.Qo(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}}Qo(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:c,lastScrollY:u,maxScrollY:h,maxContentHeight:f,lastContentY:m,maxContentY:x}=a;if(!(ue(c)||ue(u)||ue(h)||ue(f)||ue(m)||ue(x))){c=Math.ceil(c),u=Math.ceil(u),h=Math.ceil(h),f=Math.ceil(f),m=Math.ceil(m),x=Math.ceil(x);const v=c>1?Ri(u/c,0,1,ye):1,b=c>1?Ri(h/c,0,1,ye):1,y=f>1?Ri(m/f,0,1,ye):1,_=f>1?Ri(x/f,0,1,ye):1;i=Dt(i,{$prev_pageview_last_scroll:u,$prev_pageview_last_scroll_percentage:v,$prev_pageview_max_scroll:h,$prev_pageview_max_scroll_percentage:b,$prev_pageview_last_content:m,$prev_pageview_last_content_percentage:y,$prev_pageview_max_content:x,$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 Pc=["flags","surveys"],gA={[S6]:{exposure:"hidden"},[Kh]:{exposure:"hidden"},[k6]:{exposure:"hidden"},[A0]:{exposure:"hidden"},[po]:{exposure:"hidden"},[su]:{exposure:"hidden"},[WS]:{exposure:"event"},[M0]:{exposure:"hidden"},[ZS]:{exposure:"hidden"},[R0]:{exposure:"event"},[KS]:{exposure:"hidden"},[O0]:{exposure:"event"},[L0]:{exposure:"event"},[jx]:{exposure:"event"},[Nx]:{exposure:"hidden"},[JS]:{exposure:"event"},[iu]:{exposure:"hidden"},[j6]:{exposure:"hidden"},[oo]:{exposure:"hidden"},[ek]:{exposure:"event"},[N6]:{exposure:"event",shouldSkipFromEventProperties:e=>Zt(e)},[M6]:{exposure:"event"},[R6]:{exposure:"event"},[O6]:{exposure:"event"},[L6]:{exposure:"event"},[D6]:{exposure:"hidden"},[ci]:{exposure:"hidden",storageGroup:"flags"},[cr]:{exposure:"hidden",storageGroup:"flags"},[D0]:{exposure:"hidden"},[el]:{exposure:"hidden",storageGroup:"flags"},[sa]:{exposure:"hidden",storageGroup:"flags"},[tl]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[ru]:{exposure:"hidden",storageGroup:"flags"},[Ti]:{exposure:"hidden"},[Ka]:{exposure:"hidden"},[ia]:{exposure:"hidden"},[ra]:{exposure:"hidden"},[z0]:{exposure:"hidden",storageGroup:"surveys"},[Zh]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[nk]:{exposure:"event"},[sk]:{exposure:"hidden"},[ik]:{exposure:"hidden"},[$0]:{exposure:"hidden"},[z6]:{exposure:"hidden"},[$6]:{exposure:"hidden"},[B6]:{exposure:"event"},[P6]:{exposure:"event"},[I6]:{exposure:"event"},[F6]:{exposure:"event"},[aa]:{exposure:"hidden"},[Wc]:{exposure:"hidden"},[tk]:{exposure:"event"},[bu]:{exposure:"hidden"},[la]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[ts]:{exposure:"hidden"},[B0]:{exposure:"hidden"},[U6]:{exposure:"hidden"},[rk]:{exposure:"hidden"},[ak]:{exposure:"hidden"},[co]:{exposure:"hidden"},[Cx]:{exposure:"hidden"},[C6]:{exposure:"event"},[E6]:{exposure:"event"},[T6]:{exposure:"event"},[A6]:{exposure:"event"},[ok]:{exposure:"event"},[ck]:{exposure:"event"},[uk]:{exposure:"event"},[dk]:{exposure:"event"},[H6]:{exposure:"event"},[q6]:{exposure:"event"},[V6]:{exposure:"event"},[G6]:{exposure:"event"},[Y6]:{exposure:"event"},[X6]:{exposure:"event"},[Q6]:{exposure:"event"},[W6]:{exposure:"event"}},xA=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Mn=e=>{const t=gA[e];if(t)return t;for(const[n,i]of xA)if(e.indexOf(n)===0)return i},ho=(e,t)=>{try{let n;return JSON.stringify(e,(i,a)=>{var c;return Eo(a)?((c=n)!==null&&c!==void 0||(n=new WeakMap),n.has(a)||n.set(a,pk(a)),n.get(a)):typeof a=="bigint"?a.toString():a},t)}catch{return K2(e)}},ua=e=>{const t=he==null?void 0:he.createElement("a");return ue(t)?null:(t.href=e,t)},_o=function(e,t){const n=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&");let i;for(let a=0;n.length>a;a++){const c=n[a].split("=");if(c[0]===t){i=c;break}}if(!Ie(i)||2>i.length)return"";{let a=i[1];try{a=decodeURIComponent(a)}catch{ye.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")}},Su=function(e,t,n){if(!e||!t||!t.length)return e;const i=e.split("#"),a=i[1],c=(i[0]||"").split("?"),u=c[1],h=c[0],f=(u||"").split("&"),m=[];for(let v=0;f.length>v;v++){const b=f[v].split("=");Ie(b)&&(t.includes(b[0])?m.push(b[0]+"="+n):m.push(f[v]))}let x=h;return u!=null&&(x+="?"+m.join("&")),a!=null&&(x+="#"+a),x},nf=function(e,t){const n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},Ck=(e,t)=>e>=t&&W2(),Ek=(e,t,n,i)=>{if(e===0){if(W2()){const a=t+1;return a===n&&i(),a}return t}return 0},wo=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],vA=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...wo],ku="<masked>",bA=["li_fat_id"];function Tk(e,t,n){if(!he)return{};const i=t?[...wo,...n||[]]:[],a=Ak(Su(he.URL,i,ku),e),c=(function(){const u={};return jt(bA,function(h){const f=ef(h);u[h]=f||null}),u})();return Dt(c,a)}function Ak(e,t){const n=vA.concat(t||[]),i={};return jt(n,function(a){const c=_o(e,a);i[a]=c||null}),i}function Mk(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(!Zt(t)){i.$search_engine=t;const a=he?_o(he.referrer,n):"";a.length&&(i.ph_keyword=a)}return i}function Rk(){return navigator.language||navigator.userLanguage}function yA(){const e=Rk();return typeof e=="string"?e.split("-")[0]:void 0}const sf="$direct";function Ok(){return(he==null?void 0:he.referrer)||sf}function Lk(e,t,n=!1){const i=e?[...wo,...t||[]]:[],a=n?ca(Yt==null?void 0:Yt.href):Yt==null?void 0:Yt.href,c=a==null?void 0:a.substring(0,1e3);return{r:Ok().substring(0,1e3),u:c?Su(c,i,ku):void 0}}function Dk(e,t=!1){var n;const{r:i,u:a}=e,c=t?ca(a):a,u={$referrer:i,$referring_domain:i==null?void 0:i==sf?sf:(n=ua(i))===null||n===void 0?void 0:n.host};if(c){u.$current_url=c;const h=ua(c);u.$host=h==null?void 0:h.host,u.$pathname=h==null?void 0:h.pathname;const f=Ak(c);Dt(u,f)}if(i){const h=Mk(i);Dt(u,h)}return u}function zk(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function _A(){try{return new Date().getTimezoneOffset()}catch{return}}const wA={flags:la,surveys:Zh},SA=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],hh=e=>`${e}_cookie_identity_change_pending`,fh=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},vn="main",or=[ci,cr,el,sa,tl,la,ru,ia],jg=e=>or.indexOf(e)!==-1,$k=[po,su],Mw=e=>$k.indexOf(e)!==-1,Zr=(e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch{return e===t}},Jl=e=>{if(!e)return{};const t=JSON.parse(e);return st(t)?t:{}},Rw=(e,t)=>{jt(e,(n,i)=>{const a=Mn(i);a&&a.exposure!=="event"||{}.hasOwnProperty.call(t,i)||delete e[i]})};var Ng=class{constructor(e,t,n=!0){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.Rr=e,this.la=n,this.props={},this.ua=void 0,this.ha=(i=>{let a="";return i.token&&(a=i.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),i.persistence_name?"ph_"+i.persistence_name:"ph_"+a+"_posthog"})(e),this.qo=this.ca(e),this.Yo=this.da(e),this.load(),this.va(),e.debug&&ye.info("Persistence loaded",e.persistence,B({},this.props)),this.update_config(e,e,t),this.save(),te){const i=()=>this.flush();yt(te,"beforeunload",i,{capture:!1}),yt(te,"pagehide",i,{capture:!1}),this.fa=a=>{if(this.Ko&&(!a.storageArea||a.storageArea===(te==null?void 0:te.localStorage))&&a.key)if(a.key!==this.ha){if(this.Yo){const c=Pc.find(u=>a.key===this.pa(u));c&&this.ga(a.key,c)}}else this.ga(a.key,vn)},yt(te,"storage",this.fa)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(([t,n])=>{const i=this.ia.get(t);if(!jg(t)||i===!0)return;if(n===!0)return void this.ma(t,!0);const a=new Set(i||[]);n.forEach(c=>a.add(c)),a.size&&this.ma(t,a)})}onCrossTabFeatureFlagChange(e){return this.aa.add(e),()=>this.aa.delete(e)}destroy(){this.fa&&te&&(te.removeEventListener("storage",this.fa),this.fa=void 0),this.aa.clear()}ga(e,t,n=!0){if(this.mi)return!1;let i,a;try{if(a=ot.Ot(e),Zt(a)){const h=this.ya(t);return h.storageValue=null,t!==vn&&(h.persisted=!1),!1}i=Jl(a)}catch{return!1}const c=t===vn?i:ot.Dt(this.ha);if(c&&this.ba(c))return!1;const u=this._a(i,t,n);return t===vn&&this.Yo&&!Zr(this.wa().main,i)||this.ka(i,t,!0,a),u}ba(e){const t=this.props[oi],n=e[oi];return!ue(t)&&!ue(n)&&t!==n}ka(e,t,n,i){const a=this.ya(t);a.storageValue=i,t!==vn&&(a.persisted=n);try{a.fingerprint=this.Sa(e,t)}catch{a.fingerprint=void 0}}_a(e,t,n){let i=!1;return or.forEach(a=>{var c;const u=(c=Mn(a))===null||c===void 0?void 0:c.storageGroup;if(t===vn&&this.Yo&&u||t!==vn&&u!==t)return;const h=a in e,f=this.xa(a,h?e[a]:void 0),m=this.ia.has(a)?a in this.props:h;m===a in this.props&&Zr(f,this.props[a])||(m?this.Ca(a,f,!1):this.$a(a,!1),i=!0)}),i&&n&&this.aa.forEach(a=>a()),i}Ta(){if(!this.Ko)return!1;try{this.ra=!1;const e=ot.Ot(this.ha),t=this.ya(vn);let n,i=!1,a=!1;if(e!==t.storageValue)if(Zt(e))t.storageValue=null;else{if(n=Jl(e),this.ra=!this.sa&&this.ba(n),this.ra)return!1;a=this._a(n,vn,!1),!this.Yo||Zr(this.wa().main,n)?this.ka(n,vn,!0,e):t.storageValue=e,i=!0}return this.Yo&&Pc.forEach(c=>{const u=ot.Ot(this.pa(c)),h=this.ya(c),f=n||{},m=i&&or.some(v=>{var b;return((b=Mn(v))===null||b===void 0?void 0:b.storageGroup)===c&&v in f});if(u===h.storageValue&&!m)return;if(Zt(u))return h.storageValue=null,h.persisted=!1,void(m&&(a=this._a(f,c,!1)||a));const x=Jl(u);a=this._a(x,c,!1)||a,this.ka(x,c,!0,u)}),a}catch{return!1}}ma(e,t){this.ia.set(e,t);const n=Mn(e);n!=null&&n.volatile||(this.ya((this.Yo?n==null?void 0:n.storageGroup:void 0)||vn).fingerprint=void 0,this.Ia(e))}Ma(){or.forEach(e=>this.ia.set(e,!0))}va(){if(this.Ko)try{const e=ot.Ot(this.ha),t=Jl(e);this.ya(vn).storageValue=e,or.forEach(n=>{var i;const a=this.Yo?(i=Mn(n))===null||i===void 0?void 0:i.storageGroup:void 0,c=a?ot.Ot(this.pa(a)):null;if(a){const h=this.ya(a);h.storageValue=c,h.persisted=!Zt(c)}const u=a&&!Zt(c)?Jl(c):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 c=new Set(Ie(t)?t:[]),u=new Set(Ie(this.props[e])?this.props[e]:[]);return n.forEach(h=>u.has(h)?c.add(h):c.delete(h)),Array.from(c)}const i=st(t)?B({},t):{},a=st(this.props[e])?this.props[e]:{};return n.forEach(c=>{c in a?i[c]=a[c]:delete i[c]}),i}Ea(e,t,n){if(!jg(e))return;const i=this.ia.get(e);if(i===!0)return;let a=t;if(this.Ko)try{var c;const h=this.Yo?(c=Mn(e))===null||c===void 0?void 0:c.storageGroup:void 0,f=h?this.pa(h):this.ha;a=Jl(ot.Ot(f))[e]}catch{}const u=new Set(i||[]);if(e==="$active_feature_flags"){if(!ue(t)&&!Ie(t)||!ue(a)&&!Ie(a)||!Ie(n))return void this.ma(e,!0);const h=new Set(t||[]),f=new Set(a||[]),m=new Set(n);new Set([...h,...m]).forEach(x=>{h.has(x)!==m.has(x)&&u.add(x)}),u.forEach(x=>{f.has(x)===m.has(x)&&u.delete(x)})}else{if(!st(n))return void(Zr(a,n)?this.ia.delete(e):this.ma(e,!0));{if(!ue(t)&&!st(t)||ue(t)&&ms(n)&&ue(a))return void this.ma(e,!0);const h=st(t)?t:{},f=st(a)?a:{};new Set([...Object.keys(h),...Object.keys(n)]).forEach(m=>{m in h==m in n&&Zr(h[m],n[m])||u.add(m)}),u.forEach(m=>{m in f==m in n&&Zr(f[m],n[m])&&u.delete(m)})}}u.size?this.ma(e,u):this.ia.delete(e)}Pa(){var e;const t=(e=this.Rr)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return Jt(t)&&t>0?t:0}Ra(e){if(this.Rr.cookieWinsOnConflict&&this.Rr.persistence.toLowerCase()==="localstorage+cookie")if(e)try{const t=wg(e,this.Rr.cookie_persisted_properties||[]),n=gw(t,this.Rr.cookie_persisted_properties||[]),i=JSON.stringify(t)+"|"+JSON.stringify(n),a=Gt.Ot(this.ha)||void 0;a&&Sg(this.ha,a)===i&&(this.Aa=i,this.Fa=a)}catch{}else try{const t=Gt.Ot(this.ha)||void 0;this.Aa=t?Sg(this.ha,t):void 0,this.Fa=t}catch{}}syncCookieProperties(){return this.Oa(this.Rr)}Oa(e,t=!1){if(this.mi&&!t||this.ea||!e.cookieWinsOnConflict||e.persistence.toLowerCase()!=="localstorage+cookie")return!1;let n;try{n=Gt.Ot(this.ha)||void 0}catch{}if(!n||n===this.Fa)return!1;const i=Sg(this.ha,n);let a;try{a=_g(JSON.parse(n))}catch{return!1}if((Gt.Ot(this.ha)||void 0)!==n)return!1;this.Aa=i,this.Fa=n;const c=xw(this.ha,n),u=[...Za,...c.properties],h={};if(Object.keys(a).forEach(j=>{const N=a[j];(ue(N)||Zt(N)||N===""||j==="$user_state"&&N!=="anonymous"&&N!=="identified")&&(h[j]=!0,delete a[j])}),ms(a))return!1;const f="distinct_id"in a||a.$user_state==="anonymous"||a.$user_state==="identified",m=this.props,x=m[oi],v=m[ts],b=Dt({},m);[...Za,...e.cookie_persisted_properties||[]].forEach(j=>{if(u.indexOf(j)!==-1&&!(j in a)&&!h[j]&&(f||j!=="distinct_id"&&j!=="$user_state")){const N=b[j];(c.isValid||Za.indexOf(j)===-1||N!==!1&&N!==0)&&delete b[j]}}),this.props=Dt(b,a),or.forEach(j=>{const N=j in this.props;j in m===N&&Zr(m[j],this.props[j])||(N?this.Ea(j,m[j],this.props[j]):this.ma(j,!0))}),!f||"$user_state"in a||"$user_state"in this.props||this.Ca(ts,ur);const y=this.props[oi],_=this.props[ts];return!f||y===x&&_===v||(this.sa=!0,this.ta=!0,Ot.At(hh(this.ha),!0),this.$a(ia),this.$a(cr),this.$a(ci),this.$a(el),this.$a(sa),this.$a(tl),this.$a(la),this.$a(bu),this.$a(aa),_!=="anonymous"||v!=="identified"&&a.$user_state!=="anonymous"&&(ue(x)||y===x)||(Rw(this.props,a),this.$a(ra)),_==="identified"?this.props.$user_id=y:delete this.props.$user_id,this.$a(Kh)),!0}consumeCookieIdentityChange(){const e=hh(this.ha),t=this.ta||!!Ot.Ot(e);return this.ta=!1,t&&Ot.Lt(e),t}Da(e=!1){return!(this.ea||this.mi&&!e||!this.Rr.cookieWinsOnConflict||this.Rr.persistence.toLowerCase()!=="localstorage+cookie"||(this.ea=!0,0))}La(){this.ea&&(ue(this.Na)||(clearTimeout(this.Na),this.Na=void 0),delete this.Jo[vn],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.mi}ca(e){SA.indexOf(e.persistence.toLowerCase())===-1&&(ye.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");const t=((u=[],h=!1)=>{const f=[...Za,...u];return B(B({},ot),{},{Dt(m){try{let v,b={};try{v=Gt.Ot(m)||void 0,b=v?_g(JSON.parse(v)):{}}catch{}const y=JSON.parse(ot.Ot(m)||"{}");let _;if(h){const j=xw(m,v),N=[...Za,...j.properties],S={};Object.keys(b).forEach(E=>{const R=b[E];Zt(R)||R===""||E==="$user_state"&&R!=="anonymous"&&R!=="identified"||(S[E]=R)});const C="distinct_id"in S||S.$user_state==="anonymous"||S.$user_state==="identified";if(Object.keys(S).length>0){var x;const E=y[oi],R=(x=y.$user_state)!==null&&x!==void 0?x:ur;f.forEach(L=>{if(N.indexOf(L)!==-1&&!(L in b)&&(C||L!=="distinct_id"&&L!=="$user_state")){const O=y[L];(j.isValid||Za.indexOf(L)===-1||O!==!1&&O!==0)&&delete y[L]}}),!C||"$user_state"in b||"$user_state"in y||(y[ts]=ur),!C||("distinct_id"in S?S[oi]:y[oi])===E&&("$user_state"in S?S[ts]:y[ts])===R||(yg.forEach(L=>delete y[L]),S.$user_state==="identified"&&"distinct_id"in S?y.$user_id=S[oi]:delete y.$user_id,S.$user_state!=="identified"&&(delete y[tk],delete y[ra]),delete y.__alias)}_=Dt(y,S)}else _=Dt(b,y);return ot.At(m,_),_}catch{}return null},At(m,x,v,b,y,_){const j=ot.At(m,x,void 0,void 0,_);try{const N=wg(x,u);if(Object.keys(N).length){if(h){const S=tf(m),C=gw(N,u);if(Gt.At(S,C,v,b,y,_),Gt.Ot(S)!==JSON.stringify(C)){Gt.Lt(S,b);const E=wg(x);return Gt.At(m,E,v,b,y,_),j}}Gt.At(m,N,v,b,y,_)}}catch(N){ot.Pt(N)}return j},Lt(m,x){try{te==null||te.localStorage.removeItem(m),Gt.Lt(m,x),Gt.Lt(tf(m),x)}catch(v){ot.Pt(v)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict);let n,i=!1,a=!1;const c=e.persistence.toLowerCase();return c==="localstorage"&&ot.Et()?(n=ot,a=!0):c==="localstorage+cookie"&&t.Et()?(n=t,a=!0,i=!0):c==="sessionstorage"&&Ot.Et()?n=Ot:c==="memory"?n=F0:c==="cookie"&&Gt.Et()?(n=Gt,i=!0):t.Et()?(n=t,a=!0,i=!0):Gt.Et()?(n=Gt,i=!0):n=F0,this.Ko=a,this.Xo=i,n}pa(e){return`${this.ha}__${e}`}da(e){return this.Ko&&!!e.split_storage}properties(){const e={};return jt(this.props,(t,n)=>{const i=Mn(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.mi&&!e)return;const t=this.Rr.cookieWinsOnConflict&&this.Rr.persistence.toLowerCase()==="localstorage+cookie",n=t?ot.Dt(this.ha):null;let i={};if(t)try{i=_g(Gt.Dt(this.ha)),jt(i,(h,f)=>{(ue(h)||Zt(h)||h==="")&&delete i[f]})}catch{}const a=this.qo.Dt(this.ha);if(a&&(this.props=Dt({},a)),this.Yo&&this.Ba(),t&&a){var c,u;const h=n==null?void 0:n[oi],f=(c=n==null?void 0:n.$user_state)!==null&&c!==void 0?c:ur,m=a[oi],x=(u=a.$user_state)!==null&&u!==void 0?u:ur;if(m!==h||x!==f){this.ta=!0,Ot.At(hh(this.ha),!0);const v=Dt({},this.props);yg.forEach(y=>delete v[y]),x!=="anonymous"||f!=="identified"&&i.$user_state!=="anonymous"&&(ue(h)||m===h)||(Rw(v,i),delete v[ra]),this.props=v;const b=new Set;yg.forEach(y=>{var _;const j=(_=Mn(y))===null||_===void 0?void 0:_.storageGroup;j&&b.add(j)}),b.forEach(y=>{const _={};jt(this.props,(j,N)=>{var S;((S=Mn(N))===null||S===void 0?void 0:S.storageGroup)===y&&(_[N]=j)}),ms(_)?(ot.Lt(this.pa(y)),this.Jo[y]={}):ot.At(this.pa(y),_)&&(this.Jo[y]={persisted:!0,fingerprint:this.Sa(_,y)})})}}Ot.Ot(hh(this.ha))&&(this.ta=!0)}Ba(){for(const e of Pc){const t=ot.Dt(this.pa(e));if(t&&!ms(t)){const n=this.ya(e);n.persisted=!0,this.Ha(e)||(n.fingerprint=this.Sa(t,e)),this.za(e,t)||Dt(this.props,t)}}}Ha(e){return Object.keys(this.props).some(t=>{var n;return((n=Mn(t))===null||n===void 0?void 0:n.storageGroup)===e})}za(e,t){const n=wA[e];if(!n)return!1;const i=t[n],a=this.props[n];return Jt(i)&&Jt(a)&&a>i}refreshKey(e){var t;if(this.mi||this.oa.has(e))return;const n=this.Yo?(t=Mn(e))===null||t===void 0?void 0:t.storageGroup:void 0,i=n?ot.Dt(this.pa(n)):this.qo.Dt(this.ha);if(i&&e in i)this.Ca(e,i[e],!1);else{if(n){const a=this.qo.Dt(this.ha);if(a&&e in a)return void this.Ca(e,a[e],!1)}this.$a(e,!1)}}save(){if(this.mi)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.mi||this.ea&&!e)return;e||(this.syncCookieProperties(),this.Rr.cookieWinsOnConflict&&this.Rr.persistence.toLowerCase()==="localstorage+cookie"||$k.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.Rr.debug&&ye.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.ha,this.props,vn);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.ha,e,vn);n==="written"&&this.Ra(e),n!=="failed"&&(this.sa=!1,this.oa.clear(),or.forEach(a=>{var c;!((c=Mn(a))===null||c===void 0)&&c.storageGroup||this.ia.delete(a)}));for(const a of Pc){var i;const c=t[a];if(ms(c)&&!(!((i=this.Jo[a])===null||i===void 0)&&i.persisted)){or.forEach(h=>{var f;((f=Mn(h))===null||f===void 0?void 0:f.storageGroup)===a&&this.ia.delete(h)});continue}const u=this.Wa(ot,this.pa(a),c,a);u!=="failed"&&or.forEach(h=>{const f=Mn(h);(f==null?void 0:f.storageGroup)!==a||u!=="written"&&f.volatile||this.ia.delete(h)})}}wa(){const e={},t={flags:{},surveys:{}};return jt(this.props,(n,i)=>{var a;const c=(a=Mn(i))===null||a===void 0?void 0:a.storageGroup;c?t[c][i]=n:e[i]=n}),{main:e,groups:t}}Sa(e,t){if(t===vn)return JSON.stringify(e)+"|"+this.Va+"|"+this.Ga+"|"+this.Za;const n={};return jt(e,(i,a)=>{var c;n[a]=!((c=Mn(a))===null||c===void 0)&&c.volatile?"__volatile__":i}),JSON.stringify(n)}Wa(e,t,n,i){const a=this.ya(i);if(i!==vn&&!a.dirty&&!ue(a.fingerprint))return"skipped";let c;try{if(c=this.Sa(n,i),c===a.fingerprint)return a.dirty=!1,"skipped"}catch{c=void 0}return e.At(t,n,this.Va,this.Ga,this.Za,this.Rr.debug)?(a.dirty=!1,i!==vn&&(a.persisted=!0),ue(c)||(a.fingerprint=c),this.Ko&&(a.storageValue=ot.Ot(t)),"written"):(this.Rr.debug&&ye.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.Lt(this.ha,!1),this.qo.Lt(this.ha,!0),!e&&this.la)for(const t of Pc)ot.Lt(this.pa(t));e?delete this.Jo[vn]:this.Jo={},this.Aa=void 0,this.Fa=void 0}clear(){this.remove(),this.props={}}register_once(e,t,n){if(st(e)){this.syncCookieProperties(),ue(t)&&(t="None"),this.Va=ue(n)?this.Qa:n;let i=!1;if(jt(e,(a,c)=>{this.props.hasOwnProperty(c)&&this.props[c]!==t||(this.Ca(c,a),i=!0)}),i)return this.save(),!0}return!1}register(e,t){if(st(e)){this.syncCookieProperties(),this.Va=ue(t)?this.Qa:t;let n=!1;if(jt(e,(i,a)=>{e.hasOwnProperty(a)&&(this.props[a]!==i||st(i)||Ie(i))&&(this.Ca(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.$a(i),n=!0);n&&this.save()}update_campaign_params(){const e=he==null?void 0:he.URL;if(e===this.ua)return;const t=Tk(this.Rr.custom_campaign_params,this.Rr.mask_personal_data_properties,this.Rr.custom_personal_data_properties),n=!ms(Ax(t));return n&&this.register(t),this.ua=e,n?t:void 0}update_search_keyword(){this.register((function(){const e=he==null?void 0:he.referrer;return e?Mk(e):{}})())}update_referrer_info(){var e;this.register_once({$referrer:Ok(),$referring_domain:(he==null?void 0:he.referrer)&&((e=ua(he.referrer))===null||e===void 0?void 0:e.host)||sf},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const e=Lk(this.Rr.mask_personal_data_properties,this.Rr.custom_personal_data_properties,this.Rr.disable_capture_url_hashes);this.register_once({[co]:this.Xo?{r:fh(e.r),u:e.u?fh(e.u):void 0}:e},void 0)}get_initial_props(){const e={};jt([ak,rk],n=>{const i=this.props[n];i&&jt(i,function(a,c){e["$initial_"+w0(c)]=a})});const t=this.props[co];if(t){const n=(function(i,a=!1){const c=Dk(i,a),u={};return jt(c,function(h,f){u[`$initial_${w0(f)}`]=h}),u})(t,this.Rr.disable_capture_url_hashes);Dt(e,n)}return e}safe_merge(e){return jt(this.props,function(t,n){n in e||(e[n]=t)}),e}update_config(e,t,n){const i=e.persistence!==t.persistence,a=!((y,_)=>{if(y.length!==_.length)return!1;const j=[...y].sort(),N=[..._].sort();return j.every((S,C)=>S===N[C])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),c=i||a,u=e.cookieWinsOnConflict!==t.cookieWinsOnConflict,h=e.disable_persistence||!!n,f=!!this.mi&&!h;h||this.Oa(t,f),this.Rr=e,!h&&(i||a||u)&&(this.Aa=void 0,this.Fa=void 0,this.Oa(B(B({},e),{},{cookie_persisted_properties:t.cookie_persisted_properties}),f));const m=c||u?this.ca(e):this.qo;this.Ja();const x=this.da(e),v=c||x!==this.Yo,b=!h&&(v||e.cross_subdomain_cookie!==this.Ga||e.secure_cookie!==this.Za)&&this.Da(f);this.na=v;try{if(this.Qa=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 y=this.props;this.clear(),this.qo=m,this.Yo=x,this.props=y,this.save()}else u&&(this.qo=m,h||(delete this.Jo[vn],this.qa()))}finally{this.na=!1,b&&this.ja()}}Ja(){const e=this.props[co];if(!this.Xo||!st(e)||typeof e.r!="string")return;const t=fh(e.r),n=typeof e.u=="string"?fh(e.u):e.u;t===e.r&&n===e.u||this.Ca(co,B(B({},e),{},{r:t,u:n}))}set_disabled(e){this.mi=e,this.mi?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.Za&&(this.Za=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){const n=this.props.__timers||{};n[e]=t,this.Ca(A0,n),this.save()}remove_event_timer(e){const t=this.props.__timers||{},n=t[e];return ue(n)||(delete t[e],this.Ca(A0,t),this.save()),n}get_property(e){return this.props[e]}set_property(e,t){this.Ca(e,t),this.save()}Ca(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),Mw(e)&&!Zr(a,t)&&this.oa.add(e),this.Ea(e,a,t),!((i=Mn(e))===null||i===void 0)&&i.volatile||this.Ia(e))}$a(e,t=!0){delete this.props[e],t&&(jg(e)&&this.ma(e,!0),Mw(e)&&this.oa.add(e),this.Ia(e))}Ia(e){var t;const n=(t=Mn(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 Os={GZipJS:"gzip-js",Base64:"base64"},Ic={Activation:"events",Cancellation:"cancelEvents"},Cg={Popover:"popover",API:"api",Widget:"widget"},dr={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},Eg={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},q0={Popover:"popover",Inline:"inline"};function ph(e){let t=!0;return{dispose(){if(t){t=!1;const n=e();n&&kn(n.then)&&n.then(void 0,()=>{})}}}}const kA={SHOWN:"product tour shown"},Ow={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},Lw=Qt("[RateLimiter]");var jA=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=>{Lw.info(`${i||"events"} is quota limited.`),this.serverLimits[i]=new Date().getTime()+6e4})}catch(i){return void Lw.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:c}=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*c,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 m=(Jt(h.dropped)?h.dropped:0)+1;h.dropped=m,!this.lastEventRateLimited&&this.Ka(m)&&(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!Ie(t)||!t.includes(e)}Ya(){var e;if(this.Xa("$current_url")&&this.Xa("$pathname")&&(Yt!=null&&Yt.pathname))return`${(e=Yt.origin)!==null&&e!==void 0?e:""}${Yt.pathname}`}Ka(e){var t,n;const{captureEventsBurstLimit:i,captureEventsPerSecond:a}=this,c=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`,c?`triggered on ${c}`: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 Jr=Qt("[RemoteConfig]");var Bk=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=$e._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=$e.__PosthogExtensions__)===null||t===void 0)&&t.loadExternalDependency?(n=$e.__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 Jr.info("Using preloaded remote config",this.remoteConfig),void this.il(this.remoteConfig);if(this._instance.nl())return void Jr.warn("Remote config is disabled. Falling back to local config.");this.tl(e=>{if(!e)return Jr.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){Jr.error("Error loading remote config",e),this.il()}}il(e,t){!e&&t&&(t.statusCode===0?t.error||Jr.warn("Failed to fetch remote config from PostHog."):Jr.error("Failed to fetch remote config from PostHog."));try{this._instance.il(e?{ok:!0,config:e}:{ok:!1})}catch(i){Jr.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){Jr.error("Error loading feature flags",i)}}},Xs=Uint8Array,gs=Uint16Array,So=Uint32Array,Dx=new Xs([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]),zx=new Xs([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]),Dw=new Xs([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Pk=function(e,t){for(var n=new gs(31),i=0;31>i;++i)n[i]=t+=1<<e[i-1];var a=new So(n[30]);for(i=1;30>i;++i)for(var c=n[i];n[i+1]>c;++c)a[c]=c-n[i]<<5|i;return[n,a]},Ik=Pk(Dx,2),V0=Ik[1];Ik[0][28]=258,V0[258]=28;for(var zw=Pk(zx,0)[1],Fk=new gs(32768),Xt=0;32768>Xt;++Xt){var eo=(43690&Xt)>>>1|(21845&Xt)<<1;Fk[Xt]=((65280&(eo=(61680&(eo=(52428&eo)>>>2|(13107&eo)<<2))>>>4|(3855&eo)<<4))>>>8|(255&eo)<<8)>>>1}var ou=function(e,t,n){for(var i=e.length,a=0,c=new gs(t);i>a;++a)++c[e[a]-1];var u,h=new gs(t);for(a=0;t>a;++a)h[a]=h[a-1]+c[a-1]<<1;for(u=new gs(i),a=0;i>a;++a)u[a]=Fk[h[e[a]-1]++]>>>15-e[a];return u},il=new Xs(288);for(Xt=0;144>Xt;++Xt)il[Xt]=8;for(Xt=144;256>Xt;++Xt)il[Xt]=9;for(Xt=256;280>Xt;++Xt)il[Xt]=7;for(Xt=280;288>Xt;++Xt)il[Xt]=8;var rf=new Xs(32);for(Xt=0;32>Xt;++Xt)rf[Xt]=5;var NA=ou(il,9),CA=ou(rf,5),Uk=function(e){return(e/8|0)+(7&e&&1)},Hk=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var i=new(e instanceof gs?gs:e instanceof So?So:Xs)(n-t);return i.set(e.subarray(t,n)),i},sr=function(e,t,n){var i=t/8|0;e[i]|=n<<=7&t,e[i+1]|=n>>>8},Fc=function(e,t,n){var i=t/8|0;e[i]|=n<<=7&t,e[i+1]|=n>>>8,e[i+2]|=n>>>16},Tg=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,c=n.slice();if(!a)return[new Xs(0),0];if(a==1){var u=new Xs(n[0].s+1);return u[n[0].s]=1,[u,1]}n.sort(function(L,O){return L.f-O.f}),n.push({s:-1,f:25001});var h=n[0],f=n[1],m=0,x=1,v=2;for(n[0]={s:-1,f:h.f+f.f,l:h,r:f};x!=a-1;)h=n[n[v].f>n[m].f?m++:v++],f=n[m!=x&&n[v].f>n[m].f?m++:v++],n[x++]={s:-1,f:h.f+f.f,l:h,r:f};var b=c[0].s;for(i=1;a>i;++i)c[i].s>b&&(b=c[i].s);var y=new gs(b+1),_=G0(n[x-1],y,0);if(_>t){i=0;var j=0,N=_-t,S=1<<N;for(c.sort(function(L,O){return y[O.s]-y[L.s]||L.f-O.f});a>i;++i){var C=c[i].s;if(t>=y[C])break;j+=S-(1<<_-y[C]),y[C]=t}for(j>>>=N;j>0;){var E=c[i].s;t>y[E]?j-=1<<t-y[E]++-1:++i}for(;i>=0&&j;--i){var R=c[i].s;y[R]==t&&(--y[R],++j)}_=t}return[new Xs(y),_]},G0=function(e,t,n){return e.s==-1?Math.max(G0(e.l,t,n+1),G0(e.r,t,n+1)):t[e.s]=n},$w=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new gs(++t),i=0,a=e[0],c=1,u=function(f){n[i++]=f},h=1;t>=h;++h)if(e[h]==a&&h!=t)++c;else{if(!a&&c>2){for(;c>138;c-=138)u(32754);c>2&&(u(c>10?c-11<<5|28690:c-3<<5|12305),c=0)}else if(c>3){for(u(a),--c;c>6;c-=6)u(8304);c>2&&(u(c-3<<5|8208),c=0)}for(;c--;)u(a);c=1,a=e[h]}return[n.subarray(0,i),t]},Uc=function(e,t){for(var n=0,i=0;t.length>i;++i)n+=e[i]*t[i];return n},Y0=function(e,t,n){var i=n.length,a=Uk(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 c=0;i>c;++c)e[a+c+4]=n[c];return 8*(a+4+i)},Bw=function(e,t,n,i,a,c,u,h,f,m,x){sr(t,x++,n),++a[256];for(var v=Tg(a,15),b=v[0],y=v[1],_=Tg(c,15),j=_[0],N=_[1],S=$w(b),C=S[0],E=S[1],R=$w(j),L=R[0],O=R[1],F=new gs(19),D=0;C.length>D;++D)F[31&C[D]]++;for(D=0;L.length>D;++D)F[31&L[D]]++;for(var Q=Tg(F,7),I=Q[0],X=Q[1],M=19;M>4&&!I[Dw[M-1]];--M);var de,W,q,H,U=m+5<<3,re=Uc(a,il)+Uc(c,rf)+u,ve=Uc(a,b)+Uc(c,j)+u+14+3*M+Uc(F,I)+(2*F[16]+3*F[17]+7*F[18]);if(re>=U&&ve>=U)return Y0(t,x,e.subarray(f,f+m));if(sr(t,x,1+(re>ve)),x+=2,re>ve){de=ou(b,y),W=b,q=ou(j,N),H=j;var A=ou(I,X);for(sr(t,x,E-257),sr(t,x+5,O-1),sr(t,x+10,M-4),x+=14,D=0;M>D;++D)sr(t,x+3*D,I[Dw[D]]);x+=3*M;for(var Ee=[C,L],Me=0;2>Me;++Me){var z=Ee[Me];for(D=0;z.length>D;++D)sr(t,x,A[P=31&z[D]]),x+=I[P],P>15&&(sr(t,x,z[D]>>>5&127),x+=z[D]>>>12)}}else de=NA,W=il,q=CA,H=rf;for(D=0;h>D;++D)if(i[D]>255){var P;Fc(t,x,de[257+(P=i[D]>>>18&31)]),x+=W[P+257],P>7&&(sr(t,x,i[D]>>>23&31),x+=Dx[P]);var oe=31&i[D];Fc(t,x,q[oe]),x+=H[oe],oe>3&&(Fc(t,x,i[D]>>>5&8191),x+=zx[oe])}else Fc(t,x,de[i[D]]),x+=W[i[D]];return Fc(t,x,de[256]),x+W[256]},EA=new So([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),TA=(function(){for(var e=new So(256),t=0;256>t;++t){for(var n=t,i=9;--i;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e})(),Ag=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function AA(e,t){t===void 0&&(t={});var n=(function(){var v=4294967295;return{p(b){for(var y=v,_=0;b.length>_;++_)y=TA[255&y^b[_]]^y>>>8;v=y},d(){return 4294967295^v}}})(),i=e.length;n.p(e);var a,c,u,h,f,m=(h=10+((a=t).filename&&a.filename.length+1||0),f=8,(function(v,b,y,_,j,N){var S=v.length,C=new Xs(_+S+5*(1+Math.floor(S/7e3))+j),E=C.subarray(_,C.length-j),R=0;if(!b||8>S)for(var L=0;S>=L;L+=65535){var O=L+65535;S>O?R=Y0(E,R,v.subarray(L,O)):(E[L]=N,R=Y0(E,R,v.subarray(L,S)))}else{for(var F=EA[b-1],D=F>>>13,Q=8191&F,I=(1<<y)-1,X=new gs(32768),M=new gs(I+1),de=Math.ceil(y/3),W=2*de,q=function(Xe){return(v[Xe]^v[Xe+1]<<de^v[Xe+2]<<W)&I},H=new So(25e3),U=new gs(288),re=new gs(32),ve=0,A=0,Ee=(L=0,0),Me=0,z=0;S>L;++L){var P=q(L),oe=32767&L,_e=M[P];if(X[oe]=_e,M[P]=oe,L>=Me){var Ne=S-L;if((ve>7e3||Ee>24576)&&Ne>423){R=Bw(v,E,0,H,U,re,A,Ee,z,L-z,R),Ee=ve=A=0,z=L;for(var Ae=0;286>Ae;++Ae)U[Ae]=0;for(Ae=0;30>Ae;++Ae)re[Ae]=0}var Le=2,De=0,Ce=Q,Re=oe-_e&32767;if(Ne>2&&P==q(L-Re))for(var It=Math.min(D,Ne)-1,Wt=Math.min(32767,L),Ft=Math.min(258,Ne);Wt>=Re&&--Ce&&oe!=_e;){if(v[L+Le]==v[L+Le-Re]){for(var Nt=0;Ft>Nt&&v[L+Nt]==v[L+Nt-Re];++Nt);if(Nt>Le){if(Le=Nt,De=Re,Nt>It)break;var wt=Math.min(Re,Nt-2),Qe=0;for(Ae=0;wt>Ae;++Ae){var St=L-Re+Ae+32768&32767,nn=St-X[St]+32768&32767;nn>Qe&&(Qe=nn,_e=St)}}}Re+=(oe=_e)-(_e=X[oe])+32768&32767}if(De){H[Ee++]=268435456|V0[Le]<<18|zw[De];var se=31&V0[Le],je=31&zw[De];A+=Dx[se]+zx[je],++U[257+se],++re[je],Me=L+Le,++ve}else H[Ee++]=v[L],++U[v[L]]}}R=Bw(v,E,N,H,U,re,A,Ee,z,L-z,R)}return Hk(C,0,_+Uk(R)+j)})(c=e,(u=t).level==null?6:u.level,u.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(c.length)))):12+u.mem,h,f,!0)),x=m.length;return(function(v,b){var y=b.filename;if(v[0]=31,v[1]=139,v[2]=8,v[8]=2>b.level?4:b.level==9?2:0,v[9]=3,b.mtime!=0&&Ag(v,4,Math.floor(new Date(b.mtime||Date.now())/1e3)),y){v[3]=8;for(var _=0;y.length>=_;++_)v[_+10]=y.charCodeAt(_)}})(m,t),Ag(m,x-8,n.d()),Ag(m,x-4,i),m}const MA=!!vx||!!xu,qk=new WeakMap,Vk="text/plain";let Mg=0,Dh=!1;const Gk=(e,t)=>{const[n,i]=e.split("#"),[a,c]=n.split("?");if(!c)return e;const u=c.split("&").filter(h=>h.split("=")[0]!==t).join("&");return`${a}${u?`?${u}`:""}${i?`#${i}`:""}`},Mu=(e,t,n=!0)=>{var i;const[a,c]=e.split("?"),u=B({},t),h=(i=c==null?void 0:c.split("&").map(m=>{var x;const[v,b]=m.split("="),y=n&&(x=u[v])!==null&&x!==void 0?x:b;return delete u[v],`${v}=${y}`}))!==null&&i!==void 0?i:[],f=(function(m,x="&"){let v,b;const y=[];return jt(m,function(_,j){ue(_)||ue(j)||j==="undefined"||(v=encodeURIComponent((N=>N instanceof File)(_)?_.name:_.toString()),b=encodeURIComponent(j),y[y.length]=b+"="+v)}),y.join(x)})(u);return f&&h.push(f),h.length>0?`${a}?${h.join("&")}`:a},Rg=e=>{if(e.sl)return e.sl;const{data:t,compression:n}=e;if(!t)return;if(n===Os.GZipJS){const a=AA((function(c){var u=c.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(c);for(var h=new Xs(c.length+(c.length>>>1)),f=0,m=function(y){h[f++]=y},x=0;u>x;++x){if(f+5>h.length){var v=new Xs(f+8+(u-x<<1));v.set(h),h=v}var b=c.charCodeAt(x);128>b?m(b):2048>b?(m(192|b>>>6),m(128|63&b)):b>55295&&57344>b?(m(240|(b=65536+(1047552&b)|1023&c.charCodeAt(++x))>>>18),m(128|b>>>12&63),m(128|b>>>6&63),m(128|63&b)):(m(224|b>>>12),m(128|b>>>6&63),m(128|63&b))}return Hk(h,0,f)})(ho(t)),{mtime:0});return{contentType:Vk,body:a.buffer.slice(a.byteOffset,a.byteOffset+a.byteLength),estimatedSize:a.byteLength}}if(n===Os.Base64){const a=(function(u){return u&&btoa(encodeURIComponent(u).replace(/%([0-9A-F]{2})/g,(h,f)=>String.fromCharCode(parseInt(f,16))))})(ho(t)),c=(u=>"data="+encodeURIComponent(typeof u=="string"?u:ho(u)))(a);return{contentType:"application/x-www-form-urlencoded",body:c,estimatedSize:new Blob([c]).size}}const i=ho(t);return{contentType:"application/json",body:i,estimatedSize:new Blob([i]).size}},Yk=e=>{const t=()=>e.transport==="sendBeacon"?{url:Mu(e.url,{compression:Os.Base64}),encodedBody:Rg(B(B({},e),{},{compression:Os.Base64,sl:void 0}))}:{url:Gk(e.url,"compression"),encodedBody:Rg(B(B({},e),{},{compression:void 0,sl:void 0}))};let n;try{n=Rg(e)}catch(a){if(iw(e.compression,_o(e.url,"compression")))return ye.error("Failed to gzip request body, sending uncompressed payload",a),t();throw a}return n&&iw(e.compression,_o(e.url,"compression"))&&!((i=n.body)instanceof ArrayBuffer?E0(new Uint8Array(i)):ArrayBuffer.isView(i)&&E0(new Uint8Array(i.buffer,i.byteOffset,i.byteLength)))?(Dh=!0,t()):{url:e.url,encodedBody:n};var i},Xk=e=>{try{return Yk(e)}catch(n){var t;return ye.error(n),void((t=e.callback)===null||t===void 0||t.call(e,{statusCode:0,error:n}))}},RA=(function(){var e=Bt(function*(t){const n=yield(function(a){return T0.apply(this,arguments)})(ho(t.data),yn.DEBUG,{rethrow:!0});if(!n)return t;const i=yield n.arrayBuffer();return B(B({},t),{},{sl:{contentType:Vk,body:i,estimatedSize:i.byteLength}})});return function(t){return e.apply(this,arguments)}})(),OA=/Failed to fetch|NetworkError|Load failed/i,Qk=e=>(e==null?void 0:e.name)==="TypeError"&&OA.test((e==null?void 0:e.message)||""),Wk=e=>{try{const t=(function(n,i=Date.now()){if(typeof n!="string"||!n)return;const a=n.trim(),c=/^\d+\s*,/.test(a)?a.slice(0,a.indexOf(",")).trim():a;if(/^\d+$/.test(c)){const f=1e3*Math.min(Number(c),300);return f>0?f:void 0}if(!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(c))return;const u=/^\w{3} \w{3} /.test(c)?c+" GMT":c,h=Date.parse(u)-i;return Number.isFinite(h)&&h>0?Math.min(h,Rh):void 0})(e());return ue(t)?void 0:Math.min(t,3e4)}catch{return}},Kk=e=>{const t=Xk(e);if(!t)return;const n=new vx;qk.set(n,!0);const{url:i,encodedBody:a}=t;n.open(e.method||"GET",i,!0);const{contentType:c,body:u}=a??{};jt(e.headers,function(h,f){n.setRequestHeader(f,h)}),c&&n.setRequestHeader("Content-Type",c),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,Wk(()=>n.getResponseHeader("Retry-After")))}},n.send(u)},Zk=e=>{const t=Xk(e);if(!t)return;const{url:n,encodedBody:i}=t,{contentType:a,body:c,estimatedSize:u}=i??{},h=new Headers;jt(e.headers,function(_,j){h.append(j,_)}),a&&h.append("Content-Type",a);let f=null,m=!1;if(H_){const _=new H_;f={signal:_.signal,timeout:setTimeout(()=>{m=!0;try{_.abort(MS("AbortError","PostHog request timed out"+((j=e.timeout)?` after ${j}ms`:"")))}catch(N){v(N)}var j},e.timeout)}}let x=!1;const v=_=>{var j;x||(x=!0,m&&(_==null?void 0:_.name)==="AbortError"||Qk(_)?ye.warn(_):ye.error(_),(j=e.callback)===null||j===void 0||j.call(e,{statusCode:0,error:_}))};let b=0;const y=()=>{Mg-=b,b=0,f&&clearTimeout(f.timeout)};try{const _=B({method:(e==null?void 0:e.method)||"GET",headers:h,referrerPolicy:"strict-origin",body:c,signal:f==null?void 0:f.signal},e.fetchOptions),j=u??(ue(c)?0:void 0);_.keepalive=_.method==="POST"&&!e.rl&&_.keepalive!==!1&&_.body===c&&!ue(j)&&j>=0&&52428.8>Mg+j,_.keepalive&&(b=j,Mg+=b),xu(n,_).then(N=>N.text().then(S=>{var C;if(x)return;const E={statusCode:N.status,text:S};if(N.status===200)try{E.json=JSON.parse(S)}catch(R){ye.error(R)}x=!0,y(),(C=e.callback)===null||C===void 0||C.call(e,E,Wk(()=>N.headers.get("Retry-After")))})).catch(N=>{y(),v(N)}).finally(y)}catch(_){y(),v(_)}},X0=e=>{try{var t;const{url:n,encodedBody:i}=Yk(e),{contentType:a,body:c,estimatedSize:u}=i??{};if(!c)return;const h=c instanceof Blob?c:new Blob([c],{type:a});if(jn.sendBeacon(n,h))return;const f=Ie(e.data)?e.data:(t=e.data)===null||t===void 0?void 0:t.batch;if(Ie(f)&&f.length>1&&(u??0)>16384){const m=Math.ceil(f.length/2),x=v=>Ie(e.data)?v:B(B({},e.data),{},{batch:v});return X0(B(B({},e),{},{data:x(f.slice(0,m))})),void X0(B(B({},e),{},{data:x(f.slice(m))}))}ye.warn(`Beacon of ~${u??0} bytes was rejected by the browser, falling back to ${xu?"fetch":"XHR"}`),xu?Zk(B(B({},e),{},{rl:!0})):Kk(e)}catch(n){ye.warn("Beacon send failed",n)}},Pw=(e,t,n,i)=>{const a=i==="query"?t==="POST"?"sent_at":"_":void 0;return Mu(n===Os.GZipJS?Gk(e,"compression"):e,B(B({},a?{[a]:Date.now().toString()}:{}),n===Os.GZipJS?{}:{compression:n}))},LA=(()=>{const e=[];return xu&&e.push({transport:"fetch",method:Zk}),vx&&e.push({transport:"XHR",method:Kk}),jn!=null&&jn.sendBeacon&&e.push({transport:"sendBeacon",method:X0}),e})();let Jk=!MA&&(es==null?void 0:es.indexOf("MSIE"))===-1&&(es==null?void 0:es.indexOf("Mozilla"))===-1;function ej(e,t,n){var i,a,c;n&&(t=B(B({},t),{},{callback:u=>n(u)})),e.__loaded?Jk?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=B(B({},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,m,x;const v=B(B({},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 b=(f=v.transport)!==null&&f!==void 0?f:"fetch";b==="sendBeacon"&&ue(v.compression)&&v.data&&(v.compression=Os.Base64),v.method==="POST"&&v.data&&(v.timestampMode==="capture-body"?v.data=(N=>{var S,C;const E=(Ie(N)?N:[N]).map(L=>B(B({},L),L.timestamp instanceof Date&&!isNaN(L.timestamp.getTime())?{timestamp:L.timestamp.toISOString()}:{})),R=E[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:E,sent_at:new Date().toISOString()}})(v.data):v.timestampMode==="body"&&(v.data=((N,S=new Date().toISOString())=>Ie(N)?N.map(C=>B(B({},C),{},{sent_at:S})):B(B({},N),{},{sent_at:S}))(v.data))),v.url=Pw(v.url,v.method,v.compression,v.timestampMode);const y=LA.filter(N=>!v.disableTransport||!N.transport||!v.disableTransport.includes(N.transport)),_=(m=(x=(function(N,S){for(let C=0;N.length>C;C++)if(S(N[C]))return N[C]})(y,N=>N.transport===b))===null||x===void 0?void 0:x.method)!==null&&m!==void 0?m:y[0].method;if(!_)throw new Error("No available transport method");const j=N=>{try{_(N)}catch(C){var S;Qk(C)?ye.warn(C):ye.error(C),(S=v.callback)===null||S===void 0||S.call(v,{statusCode:0,error:C})}};b!=="sendBeacon"&&!v.preferSyncCompression&&v.data&&v.compression===Os.GZipJS&&xT&&typeof Promise<"u"&&!Dh?RA(v).then(N=>{j(N)}).catch(N=>{if(rw(N))return Dh=!0,void j(B(B({},v),{},{compression:void 0,url:Pw(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 rw(S)||C===BS})(N)&&(Dh=!0),j(v)}):j(v)})(t,(u,h)=>{var f,m,x;e.rateLimiter.checkForLimiting(u),400>u.statusCode||(f=(m=e.config).on_request_error)===null||f===void 0||f.call(m,u),n?n(u,h):(x=t.callback)===null||x===void 0||x.call(t,u)})):t.fireCallbackOnDrop&&((c=t.callback)===null||c===void 0||c.call(t,{statusCode:0}))}var DA=class{constructor(e,t){this.ol=!0,this.al=[],this.ll=Ri((t==null?void 0:t.flush_interval_ms)||3e3,250,5e3,ye.createLogger("flush interval"),3e3),this.ul=e}enqueue(e){this.al.push(e),this.hl||this.cl()}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(n,"sendBeacon")})}enable(){this.ol=!1,this.cl()}cl(){this.ol||(this.hl=setTimeout(()=>{if(this.dl(),this.al.length>0){const e=this.vl();for(const t in e)this.fl(e[t])}},this.ll))}fl(e,t){try{this.ul(e,t)}catch(n){ye.error(n)}}dl(){clearTimeout(this.hl),this.hl=void 0}vl(){const e={};return jt(this.al,t=>{var n;const i=t,a=((i?i.batchKey:null)||i.url)+(i.batchGroup?`:${i.batchGroup}`:"");ue(e[a])&&(e[a]=B(B({},i),{},{data:[]})),(n=e[a].data)===null||n===void 0||n.push(i.data)}),this.al=[],e}};const zA=["retriesPerformedSoFar"];var $A=class{constructor(e){this._instance=e,this.pl=!1,this.gl=3e3,this.al=[],this.al=[],this.ml=!0,this.resume()}resume(){if(!ue(te)&&"onLine"in te.navigator){if(this.ml=te.navigator.onLine,this.yl)return;this.yl=()=>{this.ml=!0,this.bl()},this._l=()=>{this.ml=!1},yt(te,"online",this.yl),yt(te,"offline",this._l)}}get length(){return this.al.length}retriableRequest(e,t){let{retriesPerformedSoFar:n}=e,i=PS(e,zA);lr(n)&&(i.url=Mu(i.url,{retry_count:n})),ej(this._instance,t?B(B({},i),{},{transport:t}):i,(a,c)=>{var u;if(a.statusCode!==200&&(400>a.statusCode||a.statusCode>=500)){if((a.statusCode===0?3:10)>(n??0))return void this.Ls(B({retriesPerformedSoFar:n},i),c);a.statusCode===0&&ye.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,m=Math.min(18e5,h),x=(Math.random()-.5)*(m-f);return Math.ceil(m+x)})(n),t??0),a=Date.now()+i;this.al.push({retryAt:a,requestOptions:e});let c=`Enqueued failed request for retry in ${i}`;navigator.onLine||(c+=" (Browser is offline)"),ye.warn(c),this.pl||(this.pl=!0,this.wl())}wl(){if(this.kl&&clearTimeout(this.kl),this.al.length===0)return this.pl=!1,void(this.kl=void 0);this.kl=setTimeout(()=>{this.ml&&this.al.length>0&&this.bl(),this.wl()},this.gl)}bl(){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.pl=!1,ue(te)||(this.yl&&(te.removeEventListener("online",this.yl),this.yl=void 0),this._l&&(te.removeEventListener("offline",this._l),this._l=void 0));for(const{requestOptions:e}of this.al)try{this._instance._send_request(B(B({},e),{},{transport:"sendBeacon"}))}catch(t){ye.error(t)}this.al=[]}},BA=class{constructor(e){this._instance=e,this.Sl=()=>{var t,n,i,a;this.xl||(this.xl={});const c=this.scrollElement(),u=this.scrollY(),h=c?Math.max(0,c.scrollHeight-c.clientHeight):0,f=u+((c==null?void 0:c.clientHeight)||0),m=(c==null?void 0:c.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(m,(a=this.xl.maxContentHeight)!==null&&a!==void 0?a:0)}}get Cl(){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(){yt(te,"scroll",this.Sl,{capture:!0}),yt(te,"scrollend",this.Sl,{capture:!0}),yt(te,"resize",this.Sl)}scrollElement(){if(this.Cl){const n=Ie(this.Cl)?this.Cl:[this.Cl];for(const i of n){var e;const a=te==null||(e=te.document)===null||e===void 0?void 0:e.querySelector(i);if(a)return a}return}var t;return te==null||(t=te.document)===null||t===void 0?void 0:t.documentElement}$l(e){var t,n;const i=e==="y"?"scrollTop":"scrollLeft";if(this.Cl){const a=this.scrollElement();return a&&a[i]||0}return te?e==="y"?te.scrollY||te.pageYOffset||((t=te.document)===null||t===void 0||(t=t.documentElement)===null||t===void 0?void 0:t.scrollTop)||0:te.scrollX||te.pageXOffset||((n=te.document)===null||n===void 0||(n=n.documentElement)===null||n===void 0?void 0:n.scrollLeft)||0:0}scrollY(){return this.$l("y")}scrollX(){return this.$l("x")}};const PA=e=>Lk(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 Iw=class{constructor(e,t,n,i){this.Be=a=>{const c=this.Tl();if(c&&c.sessionId===a)return;const u={sessionId:a,props:this.Il(this._instance)};this.Ml.register({[B0]:u})},this._instance=e,this.El=t,this.Ml=n,this.Il=i||PA,this.El.onSessionId(this.Be)}Tl(){return this.Ml.props[B0]}getSetOnceProps(){var e;const t=(e=this.Tl())===null||e===void 0?void 0:e.props;return t?"r"in t?Dk(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 jt(Ax(this.getSetOnceProps()),(t,n)=>{n==="$current_url"&&(n="url"),e[`$session_entry_${w0(n)}`]=t}),e}},af=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 to=Qt("[SessionId]"),Fw=864e5;var Uw=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 af,this.Nl=(c,u)=>!(!lr(c)||!lr(u))&&Math.abs(c-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.Rr=e.config,this.Ml=e.persistence,this.He=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.ql=void 0,this._sessionActivityTimestamp=null,this.jl=t||ui,this.Bl=n||ui;const a=this.Rr.persistence_name||this.Rr.token;if(this._sessionTimeoutMs=1e3*Ri(this.Rr.session_idle_timeout_seconds||1800,60,36e3,to.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Hl(),this.zl="ph_"+a+"_window_id",this.Ul="ph_"+a+"_primary_window_exists",this.Wl()){const c=Ot.Dt(this.zl),u=Ot.Dt(this.Ul);c&&!u?this.He=c:Ot.Lt(this.zl),Ot.At(this.Ul,!0)}!((i=this.Rr.bootstrap)===null||i===void 0)&&i.sessionID&&this.setBootstrapSessionId(this.Rr.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.He),()=>{this.Ol=this.Ol.filter(t=>t!==e)}}Wl(){return this.Rr.persistence!=="memory"&&!this.Ml.mi&&Ot.Et()}Gl(e){e!==this.He&&(this.He=e,this.Wl()&&Ot.At(this.zl,e))}Zl(){return this.He?this.He:this.Wl()?Ot.Dt(this.zl):null}Ql(e){const t=this.Al;return!Zt(t)&&!Zt(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.Ql(t)||(this.Al=t,this.Ml.register({[oo]:[t,e,n]}))}Kl(){var e;const t=(e=this.Rr)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return lr(t)&&t>0}Xl(){this.Kl()?this.Ml.refreshKey(oo):(this.Ml.flush(),this.Ml.load())}Yl(){var e;if(Zt(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({[oo]:[this._sessionActivityTimestamp,(e=this.Xt)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.Ml.flush())}eu(){const[e]=this.tu(),t=lr(e)?e:0,n=lr(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[oo];return Ie(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 c=(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 c>a+6e4?void to.error("Bootstrap sessionID cannot be in the future"):c}catch(c){return void to.error("Invalid sessionID in bootstrap",c)}})(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&&te&&(te.removeEventListener(Jh,this.Dl,{capture:!1}),this.Dl=void 0),this.Ol=[]}Vl(){this.Dl=()=>{this.Yl(),this.Wl()&&Ot.Lt(this.Ul)},yt(te,Jh,this.Dl,{capture:!1})}checkAndGetSessionAndWindowId(e=!1,t=null,n=!1){if(this.Rr.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(Zt(this.Fl)||this.Fl>i||i-this.Fl>=1e3){var c,u;(c=(u=this.Ml).syncCookieProperties)===null||c===void 0||c.call(u),this.Fl=i}let[,h,f]=this.tu();const m=!ue(a)&&h!==a,x=this.eu();let v=this.Zl();const b=this.ql,y=!!b&&(b.sessionStartTimestamp>i+6e4||i-b.sessionStartTimestamp>Fw),_=b?y:lr(f)&&Math.abs(i-f)>Fw;let j=!1,N=m,S=!h||!!b;const C=h;let E=!S&&!e&&this.Nl(i,x);if(E&&(E=this.iu(i),E||to.info("cross-tab refresh kept the session alive",{sessionId:h}),[,h,f]=this.tu(),E||(S=!h||!!b)),S||E||_){N=!1;const F=b&&!y;h=F?b.sessionId:this.jl(),v=this.Bl(),to.info("new session ID assigned",{sessionId:h,windowId:v,bootstrapped:!!F,changeReason:{noSessionId:S,activityTimeout:E,sessionPastMaximumLength:_}}),f=F?b.sessionStartTimestamp:i,this.ql=void 0,j=!0}else v||(v=this.Bl(),j=!0),N=N||h!==C,N&&(to.info("adopted cross-tab session id",{sessionId:h,windowId:v}),j=!0);const R=lr(x)&&e&&!_?x:i,L=lr(f)?f:new Date().getTime();this.Gl(v),this.Jl(h,R,L),e||this.Hl();const O={noSessionId:S,activityTimeout:E,sessionPastMaximumLength:_,crossTabAdoption:N};return j&&this.Ol.forEach(F=>F(h,v,O)),{sessionId:h,windowId:v,sessionStartTimestamp:L,changeReason:j?O:void 0,lastActivityTimestamp:x}}Hl(){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.Hl()},1.1*this.sessionTimeoutMs))}};const tj=function(e,t){if(!e)return!1;const n=e.userAgent;if(n&&V_(n,t))return!0;try{const i=e==null?void 0:e.userAgentData;if(i!=null&&i.brands&&i.brands.some(a=>V_(a==null?void 0:a.brand,t)))return!0}catch{}return!!e.webdriver};function nj(){return(nj=Bt(function*(){const e=jn==null?void 0:jn.userAgentData;if(e!=null&&e.getHighEntropyValues)try{const t=yield e.getHighEntropyValues(["model"]),n=t==null?void 0:t.model;return Je(n)&&n.length>0?n:void 0}catch(t){return void ye.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}})).apply(this,arguments)}function IA(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 sj(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 lf=(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}},mh=e=>e.toLowerCase(),ij={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=>lf(n,i))),not_regex:(e,t)=>t.every(n=>e.every(i=>!lf(n,i))),icontains:(e,t)=>t.map(mh).some(n=>e.map(mh).some(i=>n.includes(i))),not_icontains:(e,t)=>t.map(mh).every(n=>e.map(mh).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 rj(e,t){return!e||Object.entries(e).every(([n,i])=>{const a=t==null?void 0:t[n];if(a==null)return!1;const c=ij[i.operator];return!!c&&c(i.values.map(String),[String(a)])})}function Og(e,t,n){return ho({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}const Q0="custom",Hw="i.posthog.com",FA=/^\/static\//,UA=["/s/","/e/","/i/"];var HA=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(`.${Hw}`,".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":Q0),this.su[this.apiHost]}ru(e){if(!FA.test(e))return;const t=this.instance.config.asset_host;return typeof t=="string"&&t.trim().replace(/\/$/,"")||void 0}ou(e){const t=ua(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 c;const u=((c=ua(n))===null||c===void 0?void 0:c.href)||n;i=a(new URL(u)).toString()}if(a&&e==="api"&&UA.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===Q0)return this.au(e,t,this.apiHost+t);const n=Hw+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 kt=Qt("[Surveys]"),aj=e=>{try{const t=(n=>((i,a)=>`seenSurvey_${(function(c){return c.current_iteration&&c.current_iteration>0?`${c.id}_${c.current_iteration}`:c.id})(a)}`)(0,n))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(t){kt.error("Failed to persist survey seen state",t)}},qA=[Cg.Popover,Cg.Widget,Cg.API],VA={ignoreConditions:!1,ignoreDelay:!1,displayType:q0.Popover},GA=Qt("[PostHog ExternalIntegrations]"),YA={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var XA=class{constructor(e){this._instance=e}zo(e,t){var n,i;(n=$e.__PosthogExtensions__)===null||n===void 0||(i=n.loadExternalDependency)===null||i===void 0||i.call(n,this._instance,e,a=>{if(a)return GA.error("failed to load script",a);t()})}startIfEnabledOrStop(){var e;for(const[a,c]of Object.entries((e=this._instance.config.integrations)!==null&&e!==void 0?e:{})){var t,n,i;c&&!(!((t=$e.__PosthogExtensions__)===null||t===void 0||(t=t.integrations)===null||t===void 0)&&t[a])&&this.zo(YA[a],()=>{var u;(u=$e.__PosthogExtensions__)===null||u===void 0||(u=u.integrations)===null||u===void 0||(u=u[a])===null||u===void 0||u.start(this._instance)}),!c&&(!((n=$e.__PosthogExtensions__)===null||n===void 0||(n=n.integrations)===null||n===void 0)&&n[a])&&((i=$e.__PosthogExtensions__)===null||i===void 0||(i=i.integrations)===null||i===void 0||(i=i[a])===null||i===void 0||i.stop())}}},QA=class{constructor(e,t){this.$=e,this.wo=t,this.uu=new Map,this.Io=!1}add(e){var t=this;return Bt(function*(){if(t.Io)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(t.uu.has(e.name))throw new Error(`Browser extension "${e.name}" is already registered`);t.uu.set(e.name,e);try{const n=e.setup(t.wo);n&&(yield n)}catch(n){const i=t.uu.get(e.name)===e;i&&t.uu.delete(e.name),t.$.error(`Failed to set up browser extension "${e.name}"`,n),i&&t.hu(e)}})()}getExtension(e){return this.uu.get(e)}dispose(){if(this.Io)return;this.Io=!0;const e=Array.from(this.uu.values()).reverse();this.uu.clear();for(const t of e)this.hu(t)}hu(e){try{var t;const n=(t=e.dispose)===null||t===void 0?void 0:t.call(e);n&&kn(n.then)&&n.then(void 0,i=>{this.$.error(`Failed to dispose browser extension "${e.name}"`,i)})}catch(n){this.$.error(`Failed to dispose browser extension "${e.name}"`,n)}}},WA=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)}};const qw="extensionsRemoteConfig";var KA=class{constructor(e){this.instance=e,this.Io=!1,this.$=ye,this.cu=e.du,this.kv=new WA(e),this.onEvent=t=>ph(this.instance.on("eventCaptured",n=>{try{t({event:n.event,properties:n.properties})}catch(i){this.$.error("Browser extension event listener failed",i)}})),this.onRemoteConfig=t=>{if(this.Io)return ph(()=>{});const n=a=>{try{t(a)}catch(c){this.$.error("Browser extension remote config listener failed",c)}},i=this.instance.vu.on(qw,n);return this.cu&&n(this.cu),ph(i)},this.fu=new QA(ye.createLogger("[BrowserExtensions]"),this)}get logger(){return this.$}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(kx);return typeof e=="string"?e:void 0}get library(){return{name:yn.LIB_NAME,version:yn.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;const a=(e=this.instance.sessionManager)===null||e===void 0?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:(t=a==null?void 0:a.sessionId)!==null&&t!==void 0?t:"",windowId:(n=a==null?void 0:a.windowId)!==null&&n!==void 0?n:"",sessionStartTimestamp:(i=a==null?void 0:a.sessionStartTimestamp)!==null&&i!==void 0?i:0}}catch{return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(e){return this.fu.add(e)}getExtension(e){return this.fu.getExtension(e)}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 ph(this.instance.pu(e))}handleRemoteConfig(e){this.Io||(this.cu=e,this.instance.vu.emit(qw,e))}sendRequest(e){var t=this;return Bt(function*(n,i={}){var a;const c=t.instance.requestRouter.endpointFor((a=i.target)!==null&&a!==void 0?a:"api",n),u={method:i.method,url:i.query?Mu(c,i.query):c,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"?_0.Base64:void 0,timestampMode:i.sentAt};return i.transport==="sendBeacon"?(t.instance._send_request(u),{statusCode:202}):new Promise(h=>{u.callback=h,t.instance._send_request(u)})}).apply(this,arguments)}dispose(){this.Io||(this.Io=!0,this.fu.dispose())}};const cu={};let Lg=0;const uu=()=>{},Vw='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Hc="Surveys module not available",Gw="sanitize_properties is deprecated. Use before_send instead",lj="Invalid value for property_denylist config: ",ZA=/^[A-Za-z0-9_-]{1,400}$/,Yw=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,Xw=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,JA=["token","distinct_id",lk],Kc="posthog",eM=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},Dg=e=>{var t;return B({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:J6(he==null?void 0:he.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:uu,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:e??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:Yt&&Je(Yt==null?void 0:Yt.search)&&Yt.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:(te==null||(t=te.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){ye.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:hk,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:uu},(n=>({rageclick:n&&n>="2026-05-30"?{content_ignorelist:lA,ignore_text_selection:!0}:!n||"2025-11-30">n||{content_ignorelist:!0},capture_pageview:!n||"2025-05-24">n||"history_change",session_recording:eM(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))},tM=[["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"]],Qw=e=>{const t={};for(const[a,c]of tM)ue(e[a])||(t[c]=e[a]);const n=Dt({},t,e),i=e.__preview_external_dependency_versioned_paths;return ue(i)||(ue(e.strict_script_versioning)&&(n.strict_script_versioning=!!i),Je(i)&&ue(e.asset_host)&&(n.asset_host=i)),Ie(e.property_blacklist)&&(ue(e.property_denylist)?n.property_denylist=e.property_blacklist:Ie(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:ye.error(lj+e.property_denylist)),n};var nM=class{constructor(){this.__forceAllowLocalhost=!1}get gu(){return this.__forceAllowLocalhost}set gu(e){ye.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},du=class na{mu(t){if(!t)return;const n=this.uu.indexOf(t);n!==-1&&this.uu.splice(n,1)}yu(t,n){var i;return this.mu(t),this.uu.push(n),(i=n.initialize)===null||i===void 0||i.call(n),n}bu(){return this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isRejected()}_u(){if(this.wu||this.config.reuseAnonymousId||this.config.segment||this.bu())return;const t=this.config.persistence==="memory"||this.config.persistence==="sessionStorage";if(!t&&!this.config.disable_persistence||this.ku)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.wu=!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}`)}Su(){if(this.bu()||this.get_distinct_id()!=="$posthog_cookieless")return;const t=this.persistence;if(!t)return;this.xu()||t.load(!0);const n=this.get_distinct_id();if(!n||n==="$posthog_cookieless"){const i=this.config.get_device_id(ui());this.register({distinct_id:i,$device_id:i}),t.set_property(ts,ur)}this.Cu()}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.Tu=!1,this.webPerformance=new nM,this.Iu=!1,this.version=yn.LIB_VERSION,this.Mu=new Set,this.Eu="",this.vu=new af,this.uu=[],this.Pu=[],this.ku=!1,this.wu=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Dg(),this.SentryIntegration=mA,this.sentryIntegration=i=>(function(a,c){const u=Nk(a,c);return{name:jk,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 BA(this),this.pageViewManager=new Aw(this),this.rateLimiter=new jA(this),this.requestRouter=new HA(this),this.consent=new aA(this),this.externalIntegrations=new XA(this);const n=(t=na.__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,c)=>{const u=Je(i)?{[i]:a}:i;this.setPersonProperties(u),c==null||c({})},set_once:(i,a,c)=>{const u=Je(i)?{[i]:a}:i;this.setPersonProperties(void 0,u),c==null||c({})}},this.on("eventCaptured",i=>ye.info(`send "${i==null?void 0:i.event}"`,i))}init(t,n,i){if(i&&i!==Kc){var a;const c=(a=cu[i])!==null&&a!==void 0?a:new na;return c._init(t,n,i),cu[i]=c,cu[Kc][i]=c,c}return this._init(t,n,i)}_init(t,n={},i){var a,c,u;const h=Je(t)?t.trim():"";if(!h)return ye.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=Dg(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 m=Dg(n.defaults),x=Qw(n),v=Dt({},m,x,{name:i,token:h});st(m.rageclick)&&st(x.rageclick)&&(v.rageclick=Dt({},m.rageclick,x.rageclick)),st(m.session_recording)&&st(x.session_recording)&&(v.session_recording=Dt({},m.session_recording,x.session_recording)),this.set_config(v),this.config.on_xhr_error&&ye.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:Os.GZipJS;const b=this.xu();if(this.persistence=new Ng(this.config,b),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Ng(B(B({},this.config),{},{persistence:"sessionStorage"}),b,!1),this.Eu="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties",this.config.persistence!=="memory"&&!b&&Ot.Et()){const S=Ot.Dt(this.Eu);Ie(S)&&S.forEach(C=>{Je(C)&&this.Mu.add(C)})}else Ot.Lt(this.Eu);const y=B({},this.persistence.props),_=B({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.qu=new DA((S,C)=>this.ju(S,C),this.config.request_queue_config),this.Bu=new $A(this),this.__request_queue=[];const j=this.bu();j||(this.sessionManager=new Uw(this),this.sessionPropsManager=new Iw(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((S,C,E)=>{(E!=null&&E.activityTimeout||E!=null&&E.sessionPastMaximumLength||E!=null&&E.crossTabAdoption)&&this.Hu()})),this.zu(),this.config.__preview_deferred_init_extensions?(ye.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.Uu(j)},0)):(ye.info("Initializing extensions synchronously"),this.Uu(j)),yn.DEBUG=yn.DEBUG||this.config.debug,yn.DEBUG&&ye.info("Starting in debug mode",{this:this,config:n,thisC:B({},this.config),p:y,s:_}),this.config.identity_distinct_id&&!(!((a=n.bootstrap)===null||a===void 0)&&a.distinctID)&&(n.bootstrap=B(B({},n.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));const N=(c=n.bootstrap)===null||c===void 0?void 0:c.distinctID;if(this.ku=!!N&&!tu(N),(u=n.bootstrap)===null||u===void 0?void 0:u.distinctID){const S=n.bootstrap.distinctID,C=this.get_distinct_id(),E=this.persistence.get_property(ts);if(n.bootstrap.isIdentifiedID&&C!=null&&C!==S&&E==="anonymous")this.identify(S);else if(n.bootstrap.isIdentifiedID&&C!=null&&C!==S&&E==="identified")ye.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 R=this.config.get_device_id(ui()),L=n.bootstrap.isIdentifiedID?R:S;this.persistence.set_property(ts,n.bootstrap.isIdentifiedID?Oh:ur),this.register({distinct_id:S,$device_id:L})}}if(j)this.register_once({distinct_id:vg,$device_id:null},"");else if(!this.get_distinct_id()){const S=this.config.get_device_id(ui());this.register_once({distinct_id:S,$device_id:S},""),this.persistence.set_property(ts,ur)}return yt(te,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),yt(te,"pageshow",()=>{var S;this.$u=!1,this.Tu||(S=this.Bu)===null||S===void 0||S.resume()}),n.segment?Tw(this,()=>this.Wu()):this.Wu(),kn(this.config._onCapture)&&this.config._onCapture!==uu&&(ye.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",S=>this.config._onCapture(S.event,S))),this.config.ip&&ye.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 nj.apply(this,arguments)})().then(S=>{S&&this.register({[xg]:S})}).catch(uu),this}Vu(t){const n=t;return Je(n.name)&&kn(n.setup)}Gu(t,n){this.Vu(t)?n.push(()=>{this.Zu().add(t).catch(()=>{var i;return(i=t.dispose)===null||i===void 0?void 0:i.call(t)}).catch(i=>{ye.error(`Failed to dispose browser extension "${t.name}"`,i)})}):this.uu.push(t)}zu(){var t,n,i;const a=(t=(n=this.config.__extensionClasses)===null||n===void 0?void 0:n.featureFlags)!==null&&t!==void 0?t:(i=na.__defaultExtensionClasses)===null||i===void 0?void 0:i.featureFlags;var c,u,h;a&&(this.featureFlags&&this.featureFlags instanceof a||((c=this.Qu)===null||c===void 0||c.call(this),this.Qu=void 0,this.featureFlags=new a(this)),kn(this.featureFlags.onReloading)&&kn(this.featureFlags.setup)?this.Qu||(this.Qu=this.featureFlags.onReloading(()=>{this.vu.emit("featureFlagsReloading",!0)}),this.Zu().add(this.featureFlags)):(u=(h=this.featureFlags).initialize)===null||u===void 0||u.call(h))}Uu(t){const n=performance.now(),i=B(B({},na.__defaultExtensionClasses),this.config.__extensionClasses),a=[];var c,u,h,f,m,x,v;i.exceptions&&this.uu.push(this.exceptions=(c=this.exceptions)!==null&&c!==void 0?c:new i.exceptions(this)),i.historyAutocapture&&this.uu.push(this.historyAutocapture=new i.historyAutocapture(this)),i.tracingHeaders&&this.uu.push(this.tracingHeaders=new i.tracingHeaders(this)),i.siteApps&&this.uu.push(this.siteApps=new i.siteApps(this)),i.sessionRecording&&!t&&this.uu.push(this.sessionRecording=new i.sessionRecording(this)),this.config.disable_scroll_properties||a.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),i.autocapture&&this.Gu(this.autocapture=new i.autocapture(this),a),i.surveys&&this.Gu(this.surveys=(u=this.surveys)!==null&&u!==void 0?u:new i.surveys(this),a),i.logs&&this.Gu(this.logs=(h=this.logs)!==null&&h!==void 0?h:new i.logs(this),a),i.metrics&&this.uu.push(this.metrics=(f=this.metrics)!==null&&f!==void 0?f:new i.metrics(this)),i.conversations&&this.uu.push(this.conversations=(m=this.conversations)!==null&&m!==void 0?m:new i.conversations(this)),i.productTours&&this.uu.push(this.productTours=new i.productTours(this)),i.heatmaps&&this.uu.push(this.heatmaps=new i.heatmaps(this)),i.webVitalsAutocapture&&this.uu.push(this.webVitalsAutocapture=new i.webVitalsAutocapture(this)),i.exceptionObserver&&this.uu.push(this.exceptionObserver=new i.exceptionObserver(this)),i.deadClicksAutocapture&&this.uu.push(this.deadClicksAutocapture=new i.deadClicksAutocapture(this,pA)),i.toolbar&&this.uu.push(this.toolbar=(x=this.toolbar)!==null&&x!==void 0?x:new i.toolbar(this)),i.experiments&&this.uu.push(this.experiments=(v=this.experiments)!==null&&v!==void 0?v:new i.experiments(this)),this.uu.forEach(b=>{b.initialize&&a.push(()=>{var y;(y=b.initialize)===null||y===void 0||y.call(b)})}),a.push(()=>{if(this.Ju){const b=this.Ju;this.Ju=void 0,this.uu.forEach(y=>{var _;return(_=y.onRemoteConfig)===null||_===void 0?void 0:_.call(y,b)})}}),this.Ku(a,n)}Ku(t,n){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-n>=30&&t.length>0)return void setTimeout(()=>{this.Ku(t,n)},0);const a=t.shift();if(a)try{a()}catch(c){ye.error("Error initializing extension:",c)}}const i=Math.round(performance.now()-n);this.register_for_session({[ok]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[ck]:i}),this.config.__preview_deferred_init_extensions&&ye.info(`PostHog extensions initialized (${i}ms)`)}il(t){var n;if(!he||!he.body)return ye.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.il(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.Ju=t),this.du=t,this.compression=void 0,t.ok){var i;const a=t.config;a.supportedCompression&&!this.config.disable_compression&&(this.compression=Ue(a.supportedCompression,Os.GZipJS)?Os.GZipJS:Ue(a.supportedCompression,Os.Base64)?Os.Base64:void 0),!((i=a.analytics)===null||i===void 0)&&i.endpoint&&(this.analyticsDefaultEndpoint=a.analytics.endpoint)}this.set_config({person_profiles:this.Fu?this.Fu:hk}),(n=this.Xu)===null||n===void 0||n.handleRemoteConfig(t),this.uu.forEach(a=>{var c;return(c=a.onRemoteConfig)===null||c===void 0?void 0:c.call(a,t)})}Wu(){try{this.config.loaded(this)}catch(t){ye.critical("`loaded` function failed",t)}if(this.Yu(),this.config.internal_or_test_user_hostname&&(Yt==null?void 0:Yt.hostname)){const t=Yt.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.bu())&&this.th()},1),this.eh=new Bk(this),this.eh.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()&&uo(this.__request_queue,t=>this.ju(t)),this.__request_queue=[],this.Yu()}_handle_unload(){var t,n,i,a,c,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.ih()&&this.capture(fw),(a=this.logs)===null||a===void 0||a.flushLogs("sendBeacon"),(c=this.qu)===null||c===void 0||c.unload(),(u=this.Bu)===null||u===void 0||u.unload()):this.ih()&&this.capture(fw,null,{transport:"sendBeacon"})}_send_request(t){ej(this,t)}ju(t,n){this.Bu?this.Bu.retriableRequest(t,n):this._send_request(n?B(B({},t),{},{transport:n}):t)}_execute_array(t){Lg++;try{let n;const i=[],a=[],c=[];uo(t,h=>{if(h)if(n=h[0],Ie(n))c.push(h);else if(kn(h))try{h.call(this)}catch(f){ye.error("Error executing queued PostHog call",h,f)}else Ie(h)&&n==="alias"?i.push(h):Ie(h)&&n.indexOf("capture")!==-1&&kn(this[n])?c.push(h):a.push(h)});const u=function(h,f){uo(h,function(m){try{if(Ie(m[0])){let x=f;jt(m,function(v){x=x[v[0]].apply(x,v.slice(1))})}else f[m[0]].apply(f,m.slice(1))}catch(x){ye.error("Error executing queued PostHog call",m,x)}})};u(i,this),u(a,this),u(c,this)}finally{Lg--}}push(t){if(Lg>0&&Ie(t)&&Je(t[0])){const n=na.prototype[t[0]];return void(kn(n)&&n.apply(this,t.slice(1)))}this._execute_array([t])}get nh(){return{property:dw,persistenceKey:po,cookieName:"_fbc",pattern:Yw,register:(t,n)=>{var i;return(i=this.persistence)===null||i===void 0?void 0:i.register({[po]:{value:t,delivered:n}})},unregister:()=>{var t;return(t=this.persistence)===null||t===void 0?void 0:t.unregister(po)}}}get sh(){return{property:hw,persistenceKey:su,cookieName:"_fbp",pattern:Xw,register:(t,n)=>{var i;return(i=this.persistence)===null||i===void 0?void 0:i.register({[su]:{value:t,delivered:n}})},unregister:()=>{var t;return(t=this.persistence)===null||t===void 0?void 0:t.unregister(su)}}}rh(t){var n;const i=(n=this.persistence)===null||n===void 0?void 0:n.get_property(t.persistenceKey);return Je(i)&&t.pattern.test(i)?{value:i,delivered:!1}:st(i)&&Je(i.value)&&t.pattern.test(i.value)?{value:i.value,delivered:i.delivered===!0}:void 0}oh(t,n,i){return n===(i==null?void 0:i.value)?{value:n,pending:!i.delivered}:(t.register(n,!1),{value:n,pending:!0})}ah(t){if(!this.config.save_campaign_params||this.bu())return;const n=ef(t.cookieName);return Je(n)&&t.pattern.test(n)?n:void 0}uh(t,n,i,a){if(!this.persistence)return;const c=this.nh;this.persistence.refreshKey(c.persistenceKey);const u=this.rh(c);if(a)return void c.unregister();if(i)return Je(n)&&Yw.test(n)?this.oh(c,n,u):void c.unregister();const h=Je(t)&&ZA.test(t)?t:void 0,f=this.ah(c);return f&&((m,x,v)=>{const b=m.split(".");if(x)return b[3]===x;if(!v)return!0;const y=v.value.split(".");return b[3]===y[3]||Number(b[2])>Number(y[2])})(f,h,u)?this.oh(c,f,u):h?(u==null?void 0:u.value.split(".")[3])===h?{value:u.value,pending:!u.delivered}:this.oh(c,`fb.1.${Date.now()}.${h}`,u):u?{value:u.value,pending:!u.delivered}:void 0}hh(t,n,i){if(!this.persistence)return;const a=this.sh;this.persistence.refreshKey(a.persistenceKey);const c=this.rh(a);if(i)return void a.unregister();if(n)return Je(t)&&Xw.test(t)?this.oh(a,t,c):void a.unregister();const u=this.ah(a);return u?this.oh(a,u,c):c?{value:c.value,pending:!c.delivered}:void 0}dh(t,n){if(!this.persistence)return;this.persistence.refreshKey(t.persistenceKey);const i=this.rh(t);(i==null?void 0:i.value)!==n||i.delivered||t.register(n,!0)}capture(t,n,i){var a,c;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.qu))return void ye.uninitializedWarning("posthog.capture");if(!this.is_capturing())return;if(ue(t)||!Je(t))return void ye.error("No event name provided to posthog.capture");this.Su();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 ye.critical("This capture call is ignored due to client rate limiting.");let f;n!=null&&n.$current_url&&!Je(n==null?void 0:n.$current_url)&&(ye.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.fh||ye.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 m=new Date,x=(i==null?void 0:i.timestamp)||m,v=Q_(i==null?void 0:i.uuid,ui);let b={uuid:v,event:t,properties:this.calculateEventProperties(t,n||{},x,v)};t==="$pageview"&&this.config.__preview_capture_bot_pageviews&&u&&(b.event="$bot_pageview",b.properties.$browser_type="bot"),h&&(b.properties.$lib_rate_limit_remaining_tokens=h.remainingTokens);const y=t==="$feature_flag_called"&&b.properties.$feature_flag_has_experiment===!1&&this.get_property("$minimal_flag_called_events")===!0;i!=null&&i.$set&&!y&&(b.$set=i==null?void 0:i.$set);const _=st(n==null?void 0:n.$set)?n.$set:void 0,j=Ie(n==null?void 0:n.$unset)?n.$unset:[],N=(i==null?void 0:i.$unset)||[],S=W=>{var q;const H=!!(i!=null&&i.$set)&&W in i.$set;return{hasProvided:H||!!_&&W in _,provided:H?i==null||(q=i.$set)===null||q===void 0?void 0:q[W]:_==null?void 0:_[W],unset:j.indexOf(W)!==-1||N.indexOf(W)!==-1}},C=S(dw),E=S(hw),R=[{channel:this.nh,hasProvided:C.hasProvided,update:this.uh(f==null?void 0:f.fbclid,C.provided,C.hasProvided,C.unset)},{channel:this.sh,hasProvided:E.hasProvided,update:this.hh(E.provided,E.hasProvided,E.unset)}];for(const{channel:W,hasProvided:q,update:H}of R)H&&b.properties.$process_person_profile===!0&&H.pending&&!q&&!y&&(b.$set=B({[W.property]:H.value},b.$set));const L=i==null?void 0:i.$unset;L&&(b.$unset=L);const O=y?void 0:this.ph(i==null?void 0:i.$set_once,t!==pw,t===fk);if(O&&(b.$set_once=O),i!=null&&i._noTruncate||(F=this.config.properties_string_max_length,b=(function(W,q){const H=new Set;return(function U(re,ve){if(re!==Object(re))return q?q(re):re;if(H.has(re))return;let A;if(H.add(re),Ie(re))A=[],uo(re,Ee=>{A.push(U(Ee))});else{const Ee={};jt(Eo(re)?pk(re):re,(Me,z)=>{H.has(Me)||(Ee[z]=U(Me))}),A=Ee}return A})(W)})(b,W=>Je(W)?W.slice(0,F):W)),b.timestamp=x,ue(i==null?void 0:i.timestamp)||(b.properties.$event_time_override_provided=!0,b.properties.$event_time_override_system_time=m),y&&(b.properties=((W,q=[])=>{const H={},U=re=>{W[re]!==void 0&&(H[re]=W[re])};return h6.forEach(U),q.forEach(U),H})(b.properties,JA)),t===dr.DISMISSED||t===dr.SENT){const W=n==null?void 0:n[Eg.SURVEY_ID],q=n==null?void 0:n[Eg.SURVEY_ITERATION];aj({id:W,current_iteration:q}),b.$set=B(B({},b.$set),{},{[IA({id:W,current_iteration:q},t===dr.SENT?"responded":"dismissed")]:!0})}else t===dr.SHOWN&&(b.$set=B(B({},b.$set),{},{[Eg.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var F;if(t===kA.SHOWN){const W=n==null?void 0:n[Ow.TOUR_TYPE];W&&(b.$set=B(B({},b.$set),{},{[`${Ow.TOUR_LAST_SEEN_DATE}/${W}`]:new Date().toISOString()}))}const D=B(B({},b.properties.$set),b.$set);if(ms(D)||this.setPersonPropertiesForFlags(D),!Ve(this.config.before_send)){const W=this.Os(b);if(!W)return;b=W,b.uuid=Q_(b.uuid,ui)}const Q=R.filter(({channel:W,update:q})=>{var H,U,re;const ve=(H=(U=b.$set)===null||U===void 0?void 0:U[W.property])!==null&&H!==void 0?H:st((re=b.properties)===null||re===void 0?void 0:re.$set)?b.properties.$set[W.property]:void 0;return(q==null?void 0:q.pending)&&ve===q.value});this.vu.emit("eventCaptured",b);const I=(a=i==null?void 0:i._url)!==null&&a!==void 0?a:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),X=(i==null?void 0:i._batchKey)==="recordings"||/\/s\/(?:\?|$)/.test(I),M=B(B(B({method:"POST",url:I,data:b,compression:"best-available",preferSyncCompression:i==null?void 0:i.send_instantly,timestampMode:X?"body":"capture-body",batchKey:i==null?void 0:i._batchKey},X&&(!((c=b.properties)===null||c===void 0)&&c.$session_id)?{batchGroup:b.properties.$session_id+(b.properties.$window_id?`-${b.properties.$window_id}`:"")}:{}),i!=null&&i.transport?{transport:i.transport}:{}),Q.length?{fireCallbackOnDrop:!0,callback:W=>{if(W.statusCode>=200&&300>W.statusCode)for(const{channel:q,update:H}of Q)this.dh(q,H.value)}}:{});if(!this.config.request_batching||i&&!(i!=null&&i._batchKey)||i!=null&&i.send_instantly||Q.length){var de;let W;!M.transport&&!M.callback&&ms((de=this.config.request_headers)!==null&&de!==void 0?de:{})&&this.$u&&(W="sendBeacon"),this.ju(M,W)}else this.qu.enqueue(M);return b}_addCaptureHook(t){return this.on("eventCaptured",n=>t(n.event,n))}getExtension(t){var n;return(n=this.Xu)===null||n===void 0?void 0:n.getExtension(t)}Zu(){var t;return(t=this.Xu)!==null&&t!==void 0?t:this.Xu=new KA(this)}pu(t){this.Pu.push(t);let n=!0;return()=>{if(!n)return;n=!1;const i=this.Pu.indexOf(t);i!==-1&&this.Pu.splice(i,1)}}gh(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.Mu.clear(),this.mh()),(i=this.featureFlags)===null||i===void 0||i.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,n,i,a,c){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return n;this.persistence.syncCookieProperties(),this.gh();const u=c?void 0:this.persistence.remove_event_timer(t);let h=B({},n);if(h.token=this.config.token,h.$config_defaults=this.config.defaults,this.bu()&&(h[lk]=!0),t==="$snapshot"){const C=B(B({},this.persistence.properties()),this.sessionPersistence.properties());return h.distinct_id=C.distinct_id,(!Je(h.distinct_id)&&!Jt(h.distinct_id)||tu(h.distinct_id))&&ye.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),h}const f=(function(C,E,R,L=!1){var O,F,D,Q;if(!es)return{};const I=C?[...wo,...E||[]]:[],[X,M]=CS(es),[de,W]=(function(P){for(let oe=0;X_.length>oe;oe++){const[_e,Ne,Ae]=X_[oe],Le=P.match(_e);if(Le){const De=Ae&&P.match(Ae)||Le;return[Ne,(De==null?void 0:De[1])||""]}}return["",""]})(es),q=(function(){const P="u">typeof navigator?navigator:void 0;return P!=null&&P.brave?{brave:!0}:{}})(),H={};ue(R)||(H.detectGoogleSearchApp=R);const U={},re=(O=navigator)===null||O===void 0||(O=O.userAgentData)===null||O===void 0?void 0:O.platform,ve=(F=navigator)===null||F===void 0?void 0:F.maxTouchPoints,A=te==null||(D=te.screen)===null||D===void 0?void 0:D.width,Ee=te==null||(Q=te.screen)===null||Q===void 0?void 0:Q.height,Me=te==null?void 0:te.devicePixelRatio;ue(re)||(U.userAgentDataPlatform=re),ue(ve)||(U.maxTouchPoints=ve),ue(A)||(U.screenWidth=A),ue(Ee)||(U.screenHeight=Ee),ue(Me)||(U.devicePixelRatio=Me);const z=Dt(Ax({$os:X,$os_version:M,$browser:NS(es,navigator.vendor,q,H),$webview_app:de,$webview_app_version:W,$device:ES(es),$device_type:LT(es,U),$timezone:zk(),$timezone_offset:_A()}),{$current_url:Su(L?ca(Yt==null?void 0:Yt.href):Yt==null?void 0:Yt.href,I,ku),$host:Yt==null?void 0:Yt.host,$pathname:Yt==null?void 0:Yt.pathname,$raw_user_agent:es.length>1e3?es.substring(0,997)+"...":es,$browser_version:OT(es,navigator.vendor,q,H),$browser_language:Rk(),$browser_language_prefix:yA(),$screen_height:te==null?void 0:te.screen.height,$screen_width:te==null?void 0:te.screen.width,$viewport_height:te==null?void 0:te.innerHeight,$viewport_width:te==null?void 0:te.innerWidth,$lib:hr.LIB_NAME,$lib_version:hr.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return hr.SDK_DIST_CHANNEL&&(z.$sdk_dist_channel=hr.SDK_DIST_CHANNEL),z})(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:E}=this.sessionManager.checkAndGetSessionAndWindowId(c,i.getTime(),!0);h.$session_id=C,h.$window_id=E}this.sessionPropsManager&&Dt(h,this.sessionPropsManager.getSessionProps());try{var m;this.sessionRecording&&Dt(h,this.sessionRecording.sdkDebugProperties),h.$sdk_debug_retry_queue_size=(m=this.Bu)===null||m===void 0?void 0:m.length}catch(C){h.$sdk_debug_error_capturing_properties=String(C)}let x;if(this.requestRouter.region===Q0&&(h.$lib_custom_api_host=this.config.api_host),x=t!=="$pageview"||c?t!=="$pageleave"||c?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,a),h=Dt(h,x),t==="$pageview"&&he&&(h.title=he.title),!ue(u)){const C=i.getTime()-u;h.$duration=parseFloat((C/1e3).toFixed(3))}es&&this.config.opt_out_useragent_filter&&(h.$browser_type=this._is_bot()?"bot":"browser");const v=this.persistence.properties(),b=this.sessionPersistence.properties(),y=h.$groups,_=v.$groups;st(y)&&!ms(y)&&(h.$groups=B(B({},st(_)?_:{}),y)),jt(["$referrer","$referring_domain"],C=>{C in v&&delete b[C]});const j={};if(this.Pu.length>0)for(const C of this.Pu.slice())try{Dt(j,C())}catch(E){ye.error("Failed to produce browser extension event properties",E)}h=Dt({},f,v,b,B(B({},j),h)),h.$is_identified=this._isIdentified(),Ie(this.config.property_denylist)?jt(this.config.property_denylist,function(C){delete h[C]}):ye.error(lj+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const N=this.config.sanitize_properties;N&&(ye.error(Gw),h=N(h,t));const S=this.yh();return h.$process_person_profile=S,S&&!c&&this.bh("_calculate_event_properties"),h}ph(t,n=!0,i=!1){var a;if(!this.persistence||!this.yh()||this.Iu&&!i)return t;const c=this.persistence.get_initial_props(),u=(a=this.sessionPropsManager)===null||a===void 0?void 0:a.getSetOnceProps();let h=Dt({},c,u||{},t||{});const f=this.config.sanitize_properties;return f&&(ye.error(Gw),h=f(h,"$set_once")),n&&(this.Iu=!0),ms(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.gh(),(i=this.sessionPersistence)===null||i===void 0||i.register(t),Object.keys(t).forEach(a=>this.Mu.add(a)),this.mh()}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.Mu.delete(t),this.mh()}_h(t,n){this.register({[t]:n})}Hu(){this.Mu.forEach(t=>{var n;(n=this.sessionPersistence)===null||n===void 0||n.unregister(t)}),this.Mu.clear(),this.mh()}mh(){var t;if(!this.Eu)return;if(this.config.persistence==="memory"||!((t=this.sessionPersistence)===null||t===void 0)&&t.mi||!Ot.Et())return void Ot.Lt(this.Eu);const n=[];this.Mu.forEach(i=>n.push(i)),n.length>0?Ot.At(this.Eu,n):Ot.Lt(this.Eu)}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.vu.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:Hc}),()=>{})}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:Hc})}getActiveMatchingSurveys(t,n=!1){this.surveys?this.surveys.getActiveMatchingSurveys(t,n):t([],{isLoaded:!1,error:Hc})}renderSurvey(t,n){var i;(i=this.surveys)===null||i===void 0||i.renderSurvey(t,n)}displaySurvey(t,n=VA){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:Hc}}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:Hc})}wh(t){return!t||tu(t)?(ye.critical("Unique user id has not been set in posthog.identify"),!1):t==="$posthog_cookieless"?(ye.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())||(ye.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 ye.uninitializedWarning("posthog.identify");if(Jt(t)&&(t=t.toString(),ye.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this.wh(t)||!this.bh("posthog.identify"))return;this.Su();const a=this.get_distinct_id(),c=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==a,u=this.gh(!1),h=this.persistence.Da();let f=!1;try{const x=this.get_distinct_id();this.register({$user_id:t}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:x},""),t!==x&&t!==this.get_property("__alias")&&(this.unregister(Kh),this.register({distinct_id:t}));const v=(this.persistence.get_property("$user_state")||"anonymous")===ur,b=t!==x,y=!b&&v;if(b&&v){var m;const _=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:x};this.persistence.set_property(ts,Oh),this.setPersonPropertiesForFlags({$set:n||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.La(),this.capture("$identify",_,{$set:n||{},$set_once:i||{}})&&(this.Ou=Og(t,n,i)),(m=this.featureFlags)===null||m===void 0||m.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:x)}else if(y){this.persistence.set_property(ts,Oh);const _=n||{},j=i||{};this.setPersonPropertiesForFlags({$set:_,$set_once:j},!1),this.config.cookieWinsOnConflict&&this.persistence.La(),this.capture("$set",{$set:_,$set_once:j})&&(this.Ou=Og(t,n,i))}else(n||i)&&this.setPersonProperties(n,i);b||c||u?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(aa)):y&&(n||i)&&this.reloadFeatureFlags(),f=!0}finally{h&&this.persistence.ja(f)}}setPersonProperties(t,n){if(!t&&!n||!this.bh("posthog.setPersonProperties"))return;const i=Og(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)):ye.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(t){var n;const i=(Ie(t)?t:[t]).filter(a=>Je(a)&&a.length>0);i.length!==0&&this.bh("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 ye.error("posthog.group requires a group type and group key");(a=this.persistence)===null||a===void 0||a.syncCookieProperties(),this.gh();const c=this.getGroups(),u=c[t]!==n;if(u&&this.resetGroupPropertiesForFlags(t),this.register({$groups:B(B({},c),{},{[t]:n})}),(u||i)&&this.yh()){const h={$group_type:t,$group_key:n};i&&(h.$group_set=i),this.capture(pw,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.bh("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=ns(t)?t:t==null?void 0:t.resetDeviceID,i=ns(t)||t==null?void 0:t.bootstrap;this.kh(n,!1,i)}kh(t,n=!1,i){var a,c,u,h,f,m;if(ye.info("reset"),!this.__loaded)return ye.uninitializedWarning("posthog.reset");const x=i==null?void 0:i.sessionID;this.config.bootstrap=i||((a=this.Lu)===null||a===void 0?void 0:a.bootstrap)||{},(c=this.featureFlags)===null||c===void 0||(u=c.updateConfig)===null||u===void 0||u.call(c,this.config,this.nl());const v=this.get_property(kx),b=this.get_property(xg),y=this.get_property(iu);(h=this.sessionRecording)===null||h===void 0||h.flushBeforeIdentityReset();const _=this.is_capturing();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 j=(f=this.persistence)===null||f===void 0||(m=f.Da)===null||m===void 0?void 0:m.call(f);let N=!1;try{var S,C,E,R,L,O,F,D,Q,I,X,M,de;if((S=this.persistence)===null||S===void 0||S.clear(),(C=this.sessionPersistence)===null||C===void 0||C.clear(),this.Mu.clear(),this.mh(),ue(y)||(I=this.persistence)===null||I===void 0||I.register({$session_recording_remote_config:y}),(E=this.surveys)===null||E===void 0||E.reset(),(R=this.featureFlags)===null||R===void 0||R.reset(),(L=this.conversations)===null||L===void 0||L.reset(),(O=this.logs)===null||O===void 0||O.reset(),(F=this.metrics)===null||F===void 0||F.reset(),(D=this.persistence)===null||D===void 0||D.set_property("$user_state","anonymous"),(Q=this.sessionManager)===null||Q===void 0||Q.resetSessionId(),this.Ou=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:vg,$device_id:null},"");else{const H=this.config.get_device_id(ui());this.register_once({distinct_id:H,$device_id:t?H:v},""),t||ue(b)||this.register({[xg]:b})}if(this.register({$last_posthog_reset:new Date().toISOString()},1),i&&(i.distinctID&&!this.bu()&&((de=this.persistence)===null||de===void 0||de.set_property("$user_state",i.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:i.distinctID})),(X=this.featureFlags)===null||X===void 0||X.initialize(),!Ve(x)&&!(!((M=this.sessionManager)===null||M===void 0)&&M.setBootstrapSessionId(x,!0)))){const H=B({},i);delete H.sessionID,this.config.bootstrap=H}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,N=!0}finally{var W,q;j&&((W=this.persistence)===null||W===void 0||(q=W.ja)===null||q===void 0||q.call(W,N))}this.reloadFeatureFlags()}shutdown(t){var n=this;return Bt(function*(){var i,a,c,u,h,f,m,x;if(n.__loaded){n.Tu=!0,n.Zu().dispose(),(i=n.sessionRecording)===null||i===void 0||i.dispose(),(a=n.logs)===null||a===void 0||a.flushLogs("sendBeacon"),(c=n.metrics)===null||c===void 0||c.flush("sendBeacon"),(u=n.metrics)===null||u===void 0||u.dispose(),(h=n.qu)===null||h===void 0||h.unload(),(f=n.Bu)===null||f===void 0||f.unload();try{var v;(v=n.featureFlags)===null||v===void 0||v.destroy()}catch(b){ye.error("Error while destroying feature flags",b)}(m=n.persistence)===null||m===void 0||m.destroy(),(x=n.sessionPersistence)===null||x===void 0||x.destroy()}else ye.uninitializedWarning("posthog.shutdown")})()}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.Sh()}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.xh()}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 c;const u=(c=t.timestampLookBack)!==null&&c!==void 0?c: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")?(ye.critical("Attempting to create alias for existing People user - aborting."),-2):this.bh("posthog.alias")?(ue(n)&&(n=this.get_distinct_id()),t!==n?(this._h(Kh,t),this.capture("$create_alias",{alias:t,distinct_id:n})):(ye.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){const n=B({},this.config);if(st(t)){var i,a,c,u,h,f,m,x,v,b,y,_,j,N;Dt(this.config,Qw(t));const C=this.xu();(i=this.persistence)===null||i===void 0||i.update_config(this.config,n,C),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Ng(B(B({},this.config),{},{persistence:"sessionStorage"}),C,!1);const E=this.Du(this.config.debug);var S;ns(E)&&(this.config.debug=E),ns(this.config.debug)&&(this.config.debug?(yn.DEBUG=!0,ot.Et()&&ot.At("ph_debug",!0),ye.info("set_config",{config:t,oldConfig:n,newConfig:B({},this.config)})):(yn.DEBUG=!1,ot.Et()&&ot.Lt("ph_debug"))),(a=this.featureFlags)===null||a===void 0||(c=a.updateConfig)===null||c===void 0||c.call(a,this.config,this.nl()),(u=this.exceptionObserver)===null||u===void 0||u.onConfigChange(),(h=this.exceptions)===null||h===void 0||h.onConfigChange(),(f=this.metrics)===null||f===void 0||f.onConfigChange(),(m=this.sessionRecording)===null||m===void 0||m.startIfEnabledOrStop(),(x=this.tracingHeaders)===null||x===void 0||x.startIfEnabledOrStop(),(v=this.autocapture)===null||v===void 0||v.startIfEnabled(),(b=this.heatmaps)===null||b===void 0||b.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&((S=this.historyAutocapture)===null||S===void 0||S.startIfEnabledOrStop()),(y=this.exceptionObserver)===null||y===void 0||y.startIfEnabledOrStop(),(_=this.deadClicksAutocapture)===null||_===void 0||_.startIfEnabledOrStop(),(j=this.surveys)===null||j===void 0||j.loadIfEnabled(),this.Cu(),(N=this.externalIntegrations)===null||N===void 0||N.startIfEnabledOrStop(),!n.segment&&this.config.segment&&this.persistence&&Tw(this,uu,!1)}}_overrideSDKInfo(t,n){yn.LIB_NAME=t,yn.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,c,u,h,f;Object.values(i).some(Boolean)&&((a=this.sessionManager)===null||a===void 0||a.checkAndGetSessionAndWindowId(),i.sampling&&((c=this.sessionRecording)===null||c===void 0||c.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(B(B({},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:na.Ch}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:Kc;return n!==Kc&&(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"}yh(){var t,n;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&ms(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))}ih(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&!!this.config.capture_pageview}createPersonProfile(){this.yh()||this.bh("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.bh("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}bh(t){return this.config.person_profiles==="never"?(ye.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._u(),this._h(Cx,!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")}Cu(){var t,n;const i=this.xu();var a,c,u;return this.is_capturing()||(a=this.logs)===null||a===void 0||a.$h(),((t=this.persistence)===null||t===void 0?void 0:t.mi)!==i&&((c=this.persistence)===null||c===void 0||c.set_disabled(i)),((n=this.sessionPersistence)===null||n===void 0?void 0:n.mi)!==i&&((u=this.sessionPersistence)===null||u===void 0||u.set_disabled(i)),i&&(this.Mu.clear(),this.mh()),i}opt_in_capturing(t){var n;if(this.config.cookieless_mode!=="always"){if(this.bu()){var i,a,c,u,h,f;(i=this.sessionRecording)===null||i===void 0||i.dispose({discardBufferedEvents:!0}),this.kh(!0,!0),(a=this.sessionManager)===null||a===void 0||a.destroy(),(c=this.pageViewManager)===null||c===void 0||c.destroy(),this.sessionManager=new Uw(this),this.pageViewManager=new Aw(this),this.persistence&&(this.sessionPropsManager=new Iw(this,this.sessionManager,this.persistence));const y=(u=(h=this.config.__extensionClasses)===null||h===void 0?void 0:h.sessionRecording)!==null&&u!==void 0?u:(f=na.__defaultExtensionClasses)===null||f===void 0?void 0:f.sessionRecording;var m,x;y&&(this.sessionRecording=this.yu(this.sessionRecording,new y(this)),this.du&&((m=this.sessionRecording)===null||m===void 0||(x=m.onRemoteConfig)===null||x===void 0||x.call(m,this.du)))}var v,b;this.consent.optInOut(!0),this.Cu(),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((b=t==null?void 0:t.captureEventName)!==null&&b!==void 0?b:"$opt_in",t==null?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.th()}else ye.warn(Vw)}opt_out_capturing(){if(this.config.cookieless_mode==="always")return void ye.warn(Vw);const t=this.config.cookieless_mode==="on_reject"?this.sessionRecording:void 0;var n,i;t==null||t.dispose({discardBufferedEvents:!0}),this.config.cookieless_mode==="on_reject"&&this.consent.isOptedIn()&&this.kh(!0,!0),this.consent.optInOut(!1),this.Cu(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:vg,$device_id:null}),this.mu(t),this.sessionRecording=void 0,(n=this.sessionManager)===null||n===void 0||n.destroy(),(i=this.pageViewManager)===null||i===void 0||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.th(),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.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.Cu()}_is_bot(){return jn?tj(jn,this.config.custom_blocked_useragents):void 0}th(){he&&(he.visibilityState==="visible"?this.Ru||(this.Ru=!0,this.capture(Tx,{title:he.title},{send_instantly:!0}),this.Au&&(he.removeEventListener(yu,this.Au),this.Au=null)):this.Au||(this.Au=this.th.bind(this),yt(he,yu,this.Au)))}debug(t){t===!1?(te==null||te.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(te==null||te.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?(ye.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,c,u){const h=i in n&&!Ve(n[i]),f=a in n&&!Ve(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,ye)}Os(t){var n;if(Ve(this.config.before_send))return t;const i=Object.keys((n=t.properties)!==null&&n!==void 0?n:{}).filter(wT),a=Ie(this.config.before_send)?this.config.before_send:[this.config.before_send];let c=t;for(const u of a)try{if(c=u(c),Ve(c)){const h=`Event '${t.event}' was rejected in beforeSend function`;return _T(t.event)?ye.warn(`${h}. This can cause unexpected behavior.`):ye.info(h),null}c.properties&&!ms(c.properties)||ye.warn(`Event '${t.event}' has no properties after beforeSend function, this is likely an error.`)}catch(h){return ye.error(`Error in beforeSend function for event '${t.event}':`,h),null}for(const u of i)if(c.properties&&Ve(c.properties[u]))return ye.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 c}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=ns(t)&&!t,i=ot.Et()&&ot.Ot("ph_debug")==="true";return!n&&(!!i||t)}};du.__defaultExtensionClasses={},du.Ch=(()=>{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]]=K6(e.prototype[t[n]])})(du,["identify"]);var oj=class{constructor(e){this.disabled=e===!1;const t=st(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 zg="$copy_autocapture",$g=Qt("[AutoCapture]");function Bg(e,t){return t.length>e?t.slice(0,e)+"...":t}function sM(e){if(e.previousElementSibling)return e.previousElementSibling;let t=e;do t=t.previousSibling;while(t&&!Li(t));return t}function iM(e,{e:t,maskAllElementAttributes:n,maskAllText:i,elementAttributeIgnoreList:a,elementsChainAsString:c,disableCaptureUrlHashes:u}){var h,f;if(!Li(e))return{props:{}};const m=[e],x=new Set([e]);let v=e;for(;v.parentNode&&!Pn(v,"body")&&1e3>m.length;){if(Mx(v.parentNode)){const O=v.parentNode.host;if(x.has(O))break;x.add(O),m.push(O),v=O;continue}if(!Li(v.parentNode)||x.has(v.parentNode))break;x.add(v.parentNode),m.push(v.parentNode),v=v.parentNode}const b=t.type==="click"&&e.namespaceURI==="http://www.w3.org/2000/svg"?m.findIndex(O=>Pn(O,"button")||Pn(O,"a")):-1;b>0&&(i=i||m.slice(0,b+1).some(O=>!mo(O)||wu(O)));const y=[],_={};let j,N=!1,S=!1;if(jt(m,O=>{const F=mo(O);if(Pn(O,"a")&&!n&&!(a!=null&&a.includes("href"))){const D=O.getAttribute("href");N=!!(F&&D&&lu(D))&&(u?ca(D):D)}Ue(yo(O),"ph-no-capture")&&(S=!0),y.push((function(D,Q,I,X,M=!1){const de=D.tagName.toLowerCase(),W={tag_name:de};Ox.indexOf(de)>-1&&!I&&(W.$el_text=de.toLowerCase()==="a"||de.toLowerCase()==="button"?Bg(1024,Nw(D)):Bg(1024,_u(D)));const q=yo(D);Q||X!=null&&X.includes("class")||0>=q.length||(W.classes=q.filter(function(ve){return ve!==""})),jt(D.attributes,function(ve){var A;if((!wu(D)||["name","id","class","aria-label"].indexOf(ve.name)!==-1)&&!(X!=null&&X.includes(ve.name))&&!Q&&lu(ve.value)&&(!Je(A=ve.name)||A.substring(0,10)!=="_ngcontent"&&A.substring(0,7)!=="_nghost")){let Ee=ve.value;ve.name==="class"&&(Ee=Rx(Ee).join(" ")),W["attr__"+ve.name]=Bg(1024,ve.name==="href"&&M?ca(Ee):Ee)}});let H=1,U=1,re=D;for(;re=sM(re);)H++,re.tagName===D.tagName&&U++;return W.nth_child=H,W.nth_of_type=U,W})(O,n,i,a,u)),jt((function(D){if(!mo(D))return{};const Q={};return jt(D.attributes,function(I){if(I.name&&I.name.indexOf("data-ph-capture-attribute")===0){const X=I.name.replace("data-ph-capture-attribute-",""),M=I.value;X&&M&&lu(M)&&(Q[X]=M)}}),Q})(O),(D,Q)=>{({}).hasOwnProperty.call(_,Q)||(_[Q]=D)})}),S)return{props:{},explicitNoCapture:S};if(b>0&&(e=m[b],y.splice(0,b)),i||(y[0].$el_text=Pn(e,"a")||Pn(e,"button")?Nw(e):_u(e)),N){var C,E;y[0].attr__href=N;const O=(C=ua(N))===null||C===void 0?void 0:C.host,F=te==null||(E=te.location)===null||E===void 0?void 0:E.host;O&&F&&O!==F&&(j=N)}return{props:Dt((L=t.type,{$event_type:L,$ce_version:1}),c?{}:{$elements:y},{$elements_chain:(R=y,Ie(R)?(function(O){return O.map(F=>{var D,Q;let I="";if(F.tag_name&&(I+=F.tag_name),F.attr_class){F.attr_class.sort();for(const de of F.attr_class)I+=`.${de.replace(/"/g,"")}`}const X=B(B(B(B({},F.text?{text:F.text}:{}),{},{"nth-child":(D=F.nth_child)!==null&&D!==void 0?D:0,"nth-of-type":(Q=F.nth_of_type)!==null&&Q!==void 0?Q:0},F.href?{href:F.href}:{}),F.attr_id?{attr_id:F.attr_id}:{}),F.attributes),M={};return Lh(X).sort(([de],[W])=>(function(q,H){return H>q?-1:q>H?1:0})(de,W)).forEach(([de,W])=>M[Cw(de.toString())]=Cw(W.toString())),I+=":",I+=Lh(M).map(([de,W])=>`${de}="${W}"`).join(""),I}).join(";")})((function(O){return O.map(F=>{var D,Q;const I={text:(D=F.$el_text)===null||D===void 0?void 0:D.slice(0,400),tag_name:F.tag_name,href:(Q=F.attr__href)===null||Q===void 0?void 0:Q.slice(0,2048),attr_class:hA(F),attr_id:F.attr__id,nth_child:F.nth_child,nth_of_type:F.nth_of_type,attributes:{}};return Lh(F).filter(([X])=>X.indexOf("attr__")===0).forEach(([X,M])=>I.attributes[X]=M),I})})(R)):"")},!((h=y[0])===null||h===void 0)&&h.$el_text?{$el_text:(f=y[0])===null||f===void 0?void 0:f.$el_text}:{},j&&t.type==="click"?{$external_click_url:j}:{},_),target:e};var R,L}var rM=class{fo(){this.po=void 0,clearTimeout(this.mo),this.mo=void 0}yo(e){var t;if(!mo(e))return!0;const n=(t=this.bo().css_selector_ignorelist)!==null&&t!==void 0?t:kg,i=new Set;let a=e;for(;a;){if(i.size>=1e3||i.has(a))return!0;i.add(a);const c=a,u=yo(c);if(Ue(u,"ph-no-capture")||Ue(u,"ph-sensitive")||wu(c)||n.some(f=>U0(c,f)))return!0;const h=a.parentNode;a=Mx(h)?h.host:h&&Li(h)?h:null}return!1}_o(e){if(!this.isEnabled||e.type==="pointercancel")return void this.fo();if(e.type==="pointerdown"){this.fo();const i=au(e);var t;return void(e.isPrimary&&e.button===0&&!e.ctrlKey&&i&&Li(i)&&(this.po={target:i,excluded:this.yo(i),id:e.pointerId,x:e.clientX,y:e.clientY,released:!1,distinctId:(t=this.wo)===null||t===void 0?void 0:t.distinctId}))}const n=this.po;n&&(e.pointerId!==n.id||Math.abs(e.clientX-n.x)>5||Math.abs(e.clientY-n.y)>5?this.fo():e.type==="pointerup"&&(n.released=!0,this.mo=setTimeout(()=>this.fo(),0)))}ko(e){var t;const n=this.po;this.fo();const i=au(e);if(n!=null&&n.released&&n.target.isConnected&&n.distinctId===((t=this.wo)===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&&(Pn(i,"html")||Pn(i,"body"))){var a;if(n.excluded)return null;const c=(a=this.bo().css_selector_ignorelist)!==null&&a!==void 0?a:kg;return[i,he==null?void 0:he.documentElement,he==null?void 0:he.body].some(u=>{if(!u)return!1;const h=yo(u);return Ue(h,"ph-no-capture")||Ue(h,"ph-sensitive")||!mo(u)||wu(u)||c.some(f=>U0(u,f))})?null:n.target}}constructor(e){this.So=e,this.name="autocapture",this.xo=!1,this.Co=null,this.$o=!1,this.To=!1,this.Rr={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.Io=!1,this.So.refresh(this.Rr),this.rageclicks=new oj(this.Rr.rageclick),this.Mo=null}setup(e){this.Eo(),this.wo=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.wo=void 0,(e=this.Po)===null||e===void 0||e.dispose(),this.Po=void 0,this.Ro())}bo(){return this.So.refresh(this.Rr),this.Rr}Eo(){var e,t;return this.bo(),this.Rr.url_allowlist=(e=this.Rr.url_allowlist)===null||e===void 0?void 0:e.map(n=>new RegExp(n)),this.Rr.url_ignorelist=(t=this.Rr.url_ignorelist)===null||t===void 0?void 0:t.map(n=>new RegExp(n)),this.Rr}Ao(){if(!this.isBrowserSupported())return void $g.info("Disabling Automatic Event Collection because this browser is not supported");if(!te||!he)return;const e=this.Fo=t=>{t=t||(te==null?void 0:te.event);try{if(t.type==="blur")return void this.fo();if(t.type.indexOf("pointer")===0)return void this._o(t);const n=t.type==="click"?this.ko(t):void 0;if(Zt(n))return;this.Oo(t,"$autocapture",n)}catch(n){$g.error("Failed to capture event",n)}};if(yt(te,"blur",e),yt(he,"submit",e,{capture:!0}),yt(he,"change",e,{capture:!0}),yt(he,"click",e,{capture:!0}),jt(["pointerdown","pointermove","pointerup","pointercancel"],t=>{yt(he,t,e,{capture:!0})}),this.bo().capture_copied_text){const t=this.Do=n=>{n=n||(te==null?void 0:te.event);try{this.Oo(n,zg)}catch(i){$g.error("Failed to capture clipboard event",i)}};yt(he,"copy",t,{capture:!0}),yt(he,"cut",t,{capture:!0}),yt(he,"paste",t,{capture:!0})}}Ro(){this.fo(),this.Fo&&(te==null||te.removeEventListener("blur",this.Fo),jt(["pointerdown","pointermove","pointerup","pointercancel"],e=>{he==null||he.removeEventListener(e,this.Fo,!0)}),he==null||he.removeEventListener("submit",this.Fo,!0),he==null||he.removeEventListener("change",this.Fo,!0),he==null||he.removeEventListener("click",this.Fo,!0),this.Fo=void 0),this.Do&&(he==null||he.removeEventListener("copy",this.Do,!0),he==null||he.removeEventListener("cut",this.Do,!0),he==null||he.removeEventListener("paste",this.Do,!0),this.Do=void 0),this.xo=!1}startIfEnabled(){this.isEnabled||this.fo(),!this.Io&&this.wo&&this.isEnabled&&!this.xo&&(this.Ao(),this.xo=!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;ns(n)&&((i=this.wo)===null||i===void 0||i.kv.set("$autocapture_disabled_server_side",n),this.Co=n),this.startIfEnabled()}setElementSelectors(e){this.Mo=e}getElementSelectors(e,t){var n;const i=[];return(n=this.Mo)===null||n===void 0||n.forEach(a=>{const c=he==null?void 0:he.querySelectorAll(a);c==null||c.forEach(u=>{e!==u&&t!==u||Ue(i,a)||i.push(a)})}),i}get isEnabled(){var e,t;if(this.Io)return!1;const n=(e=this.wo)===null||e===void 0?void 0:e.kv.get(WS),i=this.Co,a=this.bo();if(!a.remoteRequestsDisabled&&!this.$o)return!1;const c=a.remoteRequestsDisabled&&!this.$o;if(Zt(i)&&!ns(n)&&!c)return!1;const u=(t=this.Co)!==null&&t!==void 0?t:!!n;return!!a.enabled&&!u}Oo(e,t="$autocapture",n){if(!this.isEnabled)return void this.fo();let i=n||au(e);vk(i)&&(i=i.parentNode||null);const a=this.Eo();var c;t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&a.rageclick&&(!((c=this.rageclicks)===null||c===void 0)&&c.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime()))&&wk(i,a.rageclick)&&this.Oo(e,"$rageclick",n);const u=t===zg,h=u?B(B({},a),{},{dom_event_allowlist:void 0}):a;if(i&&(function(v,b,y,_,j,N){var S;if(!te||Lx(v)||y!=null&&y.url_allowlist&&!bw(y.url_allowlist,N)||y!=null&&y.url_ignorelist&&bw(y.url_ignorelist,N))return!1;if(y!=null&&y.dom_event_allowlist){const L=y.dom_event_allowlist;if(L&&!L.some(O=>b.type===O))return!1}const{parentIsUsefulElement:C,targetElementList:E}=Sk(v,_);if(!(function(L,O){const F=O==null?void 0:O.element_allowlist;if(ue(F))return!0;for(const D of L)if(F.some(Q=>D.tagName.toLowerCase()===Q))return!0;return!1})(E,y)||!H0(E,y==null?void 0:y.css_selector_allowlist)||H0(E,(S=y==null?void 0:y.css_selector_ignorelist)!==null&&S!==void 0?S:kg))return!1;try{const L=te.getComputedStyle(v);if(L&&L.getPropertyValue("cursor")==="pointer"&&b.type==="click")return!0}catch{}const R=v.tagName.toLowerCase();switch(R){case"html":return!1;case"form":return(j||["submit"]).indexOf(b.type)>=0;case"input":case"select":case"textarea":return(j||["change","click"]).indexOf(b.type)>=0;default:return C?(j||["click"]).indexOf(b.type)>=0:(j||["click"]).indexOf(b.type)>=0&&(Ox.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:b,target:y}=iM(i,{e,maskAllElementAttributes:a.maskAllElementAttributes,maskAllText:a.maskAllText,elementAttributeIgnoreList:a.element_attribute_ignorelist,elementsChainAsString:this.To,disableCaptureUrlHashes:a.disableCaptureUrlHashes});if(b)return!1;const _=this.getElementSelectors(i,y);if(_&&_.length>0&&(v.$element_selectors=_),t===zg){const j=e.type||"clipboard";if(j!=="paste"){var m,x;const N=te==null||(m=te.getSelection())===null||m===void 0?void 0:m.toString(),S=bk(N);if(!S)return!1;v.$selected_content=S,v.$clipboard_text_length=(x=N==null?void 0:N.length)!==null&&x!==void 0?x:0}v.$copy_type=j}return(f=this.wo)===null||f===void 0||f.capture(t,v),!0}}isBrowserSupported(){return kn(he==null?void 0:he.querySelectorAll)}},aM=class{constructor(e){this._instance=e}refresh(e){const t=this._instance.config,n=st(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 qc=Qt("[ExceptionAutocapture]"),Ww=()=>{},Kw=e=>{var t;if(kn(e))return(t=e.__posthog_layer__)!==null&&t!==void 0?t:e.__rrweb_layer__};function ju(e,t,n){try{if(!(t in e))return Ww;const i={next:e[t]},a=n(function(...c){return i.next.apply(this,c)});return kn(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 c=e[t],u=Kw(c);for(;u;){if(u.next===a)return void(u.next=i.next);c=u.next,u=Kw(c)}}}catch{return Ww}}const lM=Qt("[TracingHeaders]"),Va=Qt("[Web Vitals]"),Zw=9e5,Jw=["CLS","FCP","INP","LCP"],oM=["INP","LCP"],cM=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],Pg="disabled",e5="lazy_loading",ir=Qt("[SessionRecording]"),uM=Qt("[Heatmaps]");function Ig(e){return st(e)&&"clientX"in e&&"clientY"in e&&Jt(e.clientX)&&Jt(e.clientY)}const gh=Qt("[Product Tours]"),Fg=e=>{var t;return!e.config.disable_product_tours&&!!(!((t=e.persistence)===null||t===void 0)&&t.get_property(Nx))},dM=["$set_once","$set"],Ci=Qt("[SiteApps]"),t5="Error while initializing PostHog app with config id ",cj=(e,t)=>e!=null&&e.then?e.then(t):t(e),no="SDK is not enabled or survey functionality is not yet loaded",n5="Disabled. Not loading surveys.";var hM=class{constructor(e,t){this.So=e,this.Th=t,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Ih=!1,this.Mh=[],this.Eh=null,this.Ph=null,this.Io=!1,this.Rh=new Set,this.onRemoteConfig=n=>{if(this.Io||this.Rr.disableSurveys)return;if(!n.ok)return kt.warn("Remote config unavailable. Not loading surveys.");const i=n.config.surveys;if(Ve(i))return kt.warn("Flags not loaded yet. Not loading surveys.");this.Ah=ns(i)?i:i.length>0,kt.info(`flags response received, isSurveysEnabled: ${this.Ah}`),this.loadIfEnabled()}}setup(e){if(!this.Io)return this.Fh=e,cj(e.kv.initialize(),()=>{if(this.Fh!==e||this.Io)return;this.Fh=void 0,this.wo=e;const t=e.onRemoteConfig(this.onRemoteConfig);this.Io?t.dispose():(this.Po=t,this.loadIfEnabled())})}dispose(){var e,t,n,i;this.Io||(this.Io=!0,this.Fh=void 0,this.wo=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.Mh=[],this.Eh=null,this.Rh.forEach(a=>clearTimeout(a)),this.Rh.clear())}get Rr(){return this.So.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 c=localStorage.key(a);(c!=null&&c.startsWith("seenSurvey_")||c!=null&&c.startsWith("inProgressSurvey_"))&&i.push(c)}i.forEach(a=>localStorage.removeItem(a))}catch{}}loadIfEnabled(){if(this.Io||!this.wo)return;const e=this.Rr;if(this._surveyManager)return;if(this.Ih)return void kt.info("Already initializing surveys, skipping...");if(e.disableSurveys)return void kt.info(n5);if(e.cookielessMode&&this.So.isOptedOut())return void kt.info("Not loading surveys in cookieless mode without consent.");const t=this.So.getExtensions();if(!t)return void kt.error("PostHog Extensions not found.");if(ue(this.Ah)&&!e.advancedEnableSurveys)return;const n=this.Ah||e.advancedEnableSurveys;this.Ih=!0;try{const i=t.generateSurveys;if(i)return this.Oh(i,n),void(this.Ih=!1);const a=t.loadExternalDependency;if(!a)return this.Dh(Ex),void(this.Ih=!1);a(c=>{try{if(this.Io)return;const u=this.So.getExtensions();c||!(u!=null&&u.generateSurveys)?this.Dh("Could not load surveys script",c):this.Oh(u.generateSurveys,n)}finally{this.Ih=!1}})}catch(i){throw this.Ih=!1,this.Dh("Error initializing surveys",i),i}}Oh(e,t){this.Io||(this._surveyManager=e(t),this._surveyEventReceiver=this.So.createEventReceiver(),kt.info("Surveys loaded successfully"),this.Lh({isLoaded:!0}))}Dh(e,t){kt.error(e,t),this.Lh({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Mh.push(e),this._surveyManager&&this.Lh({isLoaded:!0}),()=>{this.Mh=this.Mh.filter(t=>t!==e)}}getSurveys(e,t=!1){var n;const i=(n=this.wo)!==null&&n!==void 0?n:this.Th;if(!i||this.Io)return;if(this.Rr.disableSurveys)return kt.info(n5),e([]);const a=i.kv.get(z0);if(a&&!t)return e(a,{isLoaded:!0}),void(this.Nh()&&this.getSurveys(()=>{},!0));if(this.Eh)return void this.Eh.then(({surveys:h,context:f})=>{this.Io||e(h,f)}).catch(h=>kt.error("Error in survey callback",h));const c=this.qh("/api/surveys/",{method:"GET",query:{token:i.projectToken},sentAt:"query",timeoutMs:this.Rr.requestTimeoutMs}).then(h=>{try{return this.jh(i,h)}catch(f){return kt.error("Error processing surveys response",f),this.jh(i,{statusCode:0,error:f})}},h=>this.jh(i,{statusCode:0,error:h}));this.Eh=c;const u=()=>{this.Eh===c&&(this.Eh=null)};c.then(h=>{u(),this.Io||e(h.surveys,h.context)},u).catch(h=>kt.error("Error in survey callback",h))}qh(e,t){const n=this.wo;return n?n.sendRequest(e,t):new Promise(i=>i({statusCode:0,error:new Error(no)}))}jh(e,t){if(this.Io)return{surveys:[],context:{isLoaded:!1,error:no}};const n=t.statusCode;if(n!==200||!t.json){const u=`Surveys API could not be loaded, status: ${n}`;return n!==0?kt.error(u):t.error||kt.warn(u),this.Ph=Date.now(),{surveys:[],context:{isLoaded:!1,error:u}}}this.Ph=null;const i=t.json.surveys||[],a=i.filter(u=>(function(h){return!(!h.start_date||h.end_date)})(u)&&(sj(u)||(function(h){var f;return!!(!((f=h.conditions)===null||f===void 0||(f=f.actions)===null||f===void 0||(f=f.values)===null||f===void 0)&&f.length)})(u)));var c;return a.length>0&&((c=this._surveyEventReceiver)===null||c===void 0||c.register(a)),e.kv.set({[z0]:i,[Zh]:Date.now()}),{surveys:i,context:{isLoaded:!0}}}Nh(){return this.Bh()&&!this.Eh&&!this.Hh()}Bh(){var e,t;const n=(e=(t=this.wo)!==null&&t!==void 0?t:this.Th)===null||e===void 0?void 0:e.kv.get(Zh);return Jt(n)&&Date.now()-n>3e5}Hh(){return Jt(this.Ph)&&3e5>Date.now()-this.Ph}markSurveyAsSeen(e,t){var n;const i={id:e,current_iteration:(n=t==null?void 0:t.iteration)!==null&&n!==void 0?n:null};aj(i);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}}Lh(e){for(const t of this.Mh)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(n){kt.error("Error in survey callback",n)}}getActiveMatchingSurveys(e,t=!1){if(!Ve(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);kt.warn("init was not called")}zh(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}Uh(e){if(Ve(this._surveyManager))return{eligible:!1,reason:no};const t=typeof e=="string"?this.zh(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}Wh(e){if(!this.So.isCapturing())return{eligible:!1,reason:"PostHog is not capturing, so a survey response cannot be recorded"};if(Ve(this._surveyManager))return{eligible:!1,reason:no};const t=typeof e=="string"?this.zh(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(Ve(this._surveyManager))return kt.warn("init was not called"),{visible:!1,disabledReason:no};const t=this.Wh(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return Ve(this._surveyManager)?(kt.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:no})):new Promise(n=>{this.getSurveys(i=>{var a;const c=(a=i.find(u=>u.id===e))!==null&&a!==void 0?a:null;if(c){const u=this.Wh(c);n({visible:u.eligible,disabledReason:u.reason})}else n({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t,n){var i;if(!this.So.isCapturing())return;if(Ve(this._surveyManager))return void kt.warn("init was not called");const a=typeof e=="string"?this.zh(e):e;if(!(a!=null&&a.id))return void kt.warn("Survey not found");if(!qA.includes(a.type))return void kt.warn(`Surveys of type ${a.type} cannot be rendered in the app`);const c=he==null?void 0:he.querySelector(t);if(c){if(!((i=a.appearance)===null||i===void 0)&&i.surveyPopupDelaySeconds){kt.info(`Rendering survey ${a.id} with delay of ${a.appearance.surveyPopupDelaySeconds} seconds`);const u=setTimeout(()=>{var h,f;this.Rh.delete(u),!this.Io&&this.So.isCapturing()&&(kt.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,c,n),kt.info(`Survey ${a.id} rendered`))},1e3*a.appearance.surveyPopupDelaySeconds);return void this.Rh.add(u)}this._surveyManager.renderSurvey(a,c,n)}else kt.warn("Survey element not found")}displaySurvey(e,t){var n;if(!this.So.isCapturing())return;if(Ve(this._surveyManager))return void kt.warn("init was not called");const i=this.zh(e);if(!i)return void kt.warn("Survey not found");let a=i;if(!((n=i.appearance)===null||n===void 0)&&n.surveyPopupDelaySeconds&&t.ignoreDelay&&(a=B(B({},i),{},{appearance:B(B({},i.appearance),{},{surveyPopupDelaySeconds:0})})),t.displayType!==q0.Popover&&t.initialResponses&&kt.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){const c=this.Uh(i);if(!c.eligible)return void kt.warn("Survey is not eligible to be displayed: ",c.reason)}t.displayType!==q0.Inline?this._surveyManager.handlePopoverSurvey(a,t):this.renderSurvey(a,t.selector,t.properties)}cancelPendingSurvey(e){Ve(this._surveyManager)?kt.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 so(e,t,n){if(Ve(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 fM=class{constructor(e){this._instance=e,this.Vh=new Set,this.Gh=new Set,this.Zh=new af,this.Qh=(t,n)=>this.Jh(t,n)&&this.Kh(t,n)&&this.Xh(t,n)&&this.Yh(t,n),this.Jh=(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.tc=(t=this._instance)===null||t===void 0?void 0:t._addCaptureHook((n,i)=>{this.on(n,i)}))}dispose(){var e;(e=this.tc)===null||e===void 0||e.call(this),this.tc=void 0,this.Zh=new af}register(e){var t,n;if(!ue((t=this._instance)===null||t===void 0?void 0:t._addCaptureHook)&&(e.forEach(i=>{var a;this.Vh.add(i),(a=i.steps)===null||a===void 0||a.forEach(c=>{this.Gh.add((c==null?void 0:c.event)||"")})}),(n=this._instance)===null||n===void 0?void 0:n.autocapture)){const i=new Set;this.Vh.forEach(a=>{var c;(c=a.steps)===null||c===void 0||c.forEach(u=>{u!=null&&u.selector&&i.add(u.selector)})}),this._instance.autocapture.setElementSelectors(i)}}replace(e){this.Vh.clear(),this.Gh.clear(),this.register(e)}on(e,t){t!=null&&e.length!=0&&(this.Gh.has(e)||this.Gh.has(t.event))&&this.Vh.forEach(n=>{this.ec(t,n)&&this.Zh.emit("actionCaptured",n.name)})}nc(e){this.onAction("actionCaptured",t=>e(t))}ec(e,t){if((t==null?void 0:t.steps)==null)return!1;for(const n of t.steps)if(this.Qh(e,n))return!0;return!1}onAction(e,t){return this.Zh.on(e,t)}Kh(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"||!so(i,t.url,t.url_matching||"contains"))return!1}return!0}Xh(e,t){return!!this.sc(e,t)&&!!this.rc(e,t)&&!!this.oc(e,t)}sc(e,t){var n;if(!(t!=null&&t.href))return!0;const i=this.ac(e);if(i.length>0)return i.some(c=>so(c.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&&so((function(c){const u=c.match(/(?::|")href="(.*?)"/);return u?u[1]:""})(a),t.href,t.href_matching||"exact")}rc(e,t){var n;if(!(t!=null&&t.text))return!0;const i=this.ac(e);if(i.length>0)return i.some(f=>so(f.text,t.text,t.text_matching||"exact")||so(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&&(c=(function(f){const m=[],x=/(?::|")text="(.*?)"/g;let v;for(;!Ve(v=x.exec(f));)m.includes(v[1])||m.push(v[1]);return m})(a),u=t.text,h=t.text_matching||"exact",c.some(f=>so(f,u,h)));var c,u,h}oc(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 c=(e==null||(i=e.properties)===null||i===void 0?void 0:i.$elements_chain)||"";if(t.selector_regex&&c)try{return new RegExp(t.selector_regex).test(c)}catch{return!1}return!1}ac(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}Yh(e,t){return!(t!=null&&t.properties)||t.properties.length===0||rj(t.properties.reduce((n,i)=>{const a=Ie(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)}},pM=class{constructor(e){var t,n;this.lc=[],this._instance=e,this.uc=new Map,this.hc=new Map,this.cc=new Map,this.dc=(t=this._instance)===null||t===void 0||(n=t.onSessionId)===null||n===void 0?void 0:n.call(t,i=>this.vc(i))}fc(e){return!1}gc(){return null}mc(e){}yc(){}bc(e,t){return!!e&&rj(e.propertyFilters,t==null?void 0:t.properties)}_c(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(c=>{if(c!=null&&c.name){const u=n.get(c.name)||[];u.push(i.id),n.set(c.name,u)}})}),n}wc(e,t,n){const i=(n===Ic.Activation?this.uc:this.hc).get(e);let a=[];return this.kc(c=>{a=c.filter(u=>i==null?void 0:i.includes(u.id))}),a.filter(c=>{var u;const h=(u=c.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.bc(h,t)})}register(e){this.Sc(e,!1)}replace(e){this.Sc(e,!0)}Sc(e,t){var n;ue((n=this._instance)===null||n===void 0?void 0:n._addCaptureHook)||(this.xc(e,t),this.Cc(e,t))}Cc(e,t){const n=e.filter(c=>{var u;return(u=c.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.cc.clear(),n.length===0)return void(t&&((i=this.$c)===null||i===void 0||i.replace([])));this.$c||(this.$c=new fM(this._instance),this.$c.init(),this.$c.nc(c=>this.onAction(c)));const a=[];n.forEach(c=>{var u;(u=c.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 m=(f=this.cc.get(h.name))!==null&&f!==void 0?f:[];m.includes(c.id)||m.push(c.id),this.cc.set(h.name,m)}})}),t?this.$c.replace(a):this.$c.register(a)}Tc(e,t){t.forEach((n,i)=>{var a;const c=(a=e.get(i))!==null&&a!==void 0?a:[];n.forEach(u=>{c.includes(u)||c.push(u)}),e.set(i,c)})}xc(e,t){var n,i;const a=e.filter(f=>{var m,x;return((m=f.conditions)===null||m===void 0?void 0:m.events)&&((x=f.conditions)===null||x===void 0||(x=x.events)===null||x===void 0||(x=x.values)===null||x===void 0?void 0:x.length)>0}),c=e.filter(f=>{var m,x;return((m=f.conditions)===null||m===void 0?void 0:m.cancelEvents)&&((x=f.conditions)===null||x===void 0||(x=x.cancelEvents)===null||x===void 0||(x=x.values)===null||x===void 0?void 0:x.length)>0}),u=this._c(e,Ic.Activation),h=this._c(e,Ic.Cancellation);t?(this.uc=u,this.hc=h):(this.Tc(this.uc,u),this.Tc(this.hc,h)),(a.length!==0||c.length!==0)&&((n=this.tc)!==null&&n!==void 0||(this.tc=(i=this._instance)===null||i===void 0?void 0:i._addCaptureHook((f,m)=>{this.onEvent(f,m)})))}onEvent(e,t){var n,i;const a=this.Ic(),c=(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(c&&this.getActivatedIds().includes(c)){const h=this.Mc(e,c);if(h==="consume")return a.info("event consumed activated item, removing it",{event:e,itemId:c}),void this.Ec([c]);if(h==="persist")return a.info("shown item promoted to persisted activation",{event:e,itemId:c}),this.Pc(c),void this.Rc([c])}if(this.hc.has(e)){const h=this.wc(e,t,Ic.Cancellation);h.length>0&&(a.info("cancel event matched, cancelling items",{event:e,itemsToCancel:h.map(f=>f.id)}),this.Ec(h.map(f=>f.id)),h.forEach(f=>this.Ac(f.id)))}if(!this.uc.has(e))return;a.info("event name matched",{event:e,eventPayload:t,items:this.uc.get(e)});const u=this.wc(e,t,Ic.Activation);this.Fc(u.map(h=>h.id))}onAction(e){this.cc.has(e)&&this.Fc(this.cc.get(e)||[])}Fc(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 c of e)i&&this.fc(c)?this.Pc(c)&&this.Oc(c):a.push(c);a.length>0&&(this.lc=[...new Set([...this.lc,...a])]),this.Ic().info("updating activated items",{activatedItems:this.getActivatedIds()})}Pc(e){this.lc=this.lc.filter(n=>n!==e);const t=this.Dc();return!t.includes(e)&&(this.Lc([...t,e]),this.Nc(),!0)}Ec(e){const t=new Set(e);this.lc=this.lc.filter(a=>!t.has(a));const n=this.qc(),i=n.filter(a=>!t.has(a));i.length!==n.length&&(this.Lc(i),i.length===0&&this.jc()),this.Rc(e)}Bc(){var e;const t=this.gc();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:{}}Oc(e){if(!this.gc())return;const t=this.Bc();this.mc(B(B({},t),{},{[e]:Date.now()}))}Rc(e){if(!this.gc())return;const t=this.Bc(),n={};let i=!1;for(const[a,c]of Object.entries(t))e.includes(a)?i=!0:n[a]=c;i&&(ms(n)?this.yc():this.mc(n))}Hc(){this.gc()&&this.yc()}getActivationTimestamp(e){if(!this.Dc().includes(e))return;const t=this.Bc()[e];return Jt(t)?t:void 0}qc(){var e;const t=this.zc();return((e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[t])||[]}Dc(){var e,t,n;const i=this.qc();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.Uc()],c=(t=this._instance)===null||t===void 0||(n=t.get_session_id)===null||n===void 0?void 0:n.call(t);return c&&a===c?i:[]}Nc(){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.Wc(n)}jc(){this.Vc()}vc(e){var t;const n=(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0?void 0:t.props[this.Uc()];if(n&&n!==e){const i=this.qc(),a=this.Bc();i.length>0&&(this.Lc([]),i.filter(c=>Jt(a[c])).forEach(c=>this.Ac(c))),this.jc(),this.Hc()}}getActivatedIds(){return[...new Set([...this.Dc(),...this.lc])].filter(e=>!this.Gc(e))}dispose(){var e,t,n;(e=this.dc)===null||e===void 0||e.call(this),this.dc=void 0,(t=this.tc)===null||t===void 0||t.call(this),this.tc=void 0,(n=this.$c)===null||n===void 0||n.dispose(),this.$c=void 0}reset(){this.lc=[],this.qc().length>0&&this.Lc([]),this.jc(),this.Hc()}getEventToItemsMap(){return this.uc}Zc(){return this.$c}},mM=class extends pM{constructor(e){super(e)}zc(){return nk}Uc(){return sk}gc(){return ik}mc(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated_timestamps:e})}yc(){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.unregister("$surveys_activated_timestamps")}fc(e){var t;let n;this.kc(a=>{n=a.find(c=>c.id===e)});const i=n==null||(t=n.appearance)===null||t===void 0?void 0:t.surveyPopupDelaySeconds;return Jt(i)&&i>0}Qc(){return dr.SHOWN}kc(e){var t;(t=this._instance)===null||t===void 0||t.getSurveys(e)}Ac(e){var t;(t=this._instance)===null||t===void 0||t.cancelPendingSurvey(e)}Ic(){return kt}Lc(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated:e})}Wc(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated_session:e})}Vc(){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.unregister("$surveys_activated_session")}Gc(){return!1}Mc(e,t){let n;return this.kc(i=>{n=i.find(a=>a.id===t)}),!n||(function(i){var a;return sj(i)&&!!(!((a=i.conditions)===null||a===void 0||(a=a.events)===null||a===void 0)&&a.repeatedActivation)||i.schedule==="always"})(n)?e===dr.SHOWN?"consume":"ignore":e===dr.SHOWN?"persist":e===dr.DISMISSED||e===dr.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},gM=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)}},xM=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=$e==null?void 0:$e.__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(){return new mM(this._instance)}};const vM=te!=null&&te.location?nf(te.location.hash,"__posthog")||nf(location.hash,"state"):null,s5="_postHogToolbarParams",i5=Qt("[Toolbar]"),r5=Qt("[FeatureFlags]");var bM=class{constructor(e,t=!1){this.Jc=!1,this.update(e,t)}update(e,t){this.Kc=((n,i)=>{var a,c,u,h,f,m,x,v;return{bootstrap:{featureFlags:(a=(c=n.bootstrap)===null||c===void 0?void 0:c.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,(m=n.feature_flag_request_max_retries)!==null&&m!==void 0?m:1),compression:n.disable_compression?void 0:"best-available",evaluationContexts:(x=(v=n.evaluation_contexts)!==null&&v!==void 0?v:n.evaluation_environments)!==null&&x!==void 0?x:[],flagKeys:Ie(n.flag_keys)?n.flag_keys:void 0}})(e,t),!e.evaluation_environments||e.evaluation_contexts||this.Jc||(r5.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Jc=!0),ue(e.flag_keys)||Ie(e.flag_keys)||r5.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this.Kc}};const a5=Qt("[FeatureFlags]"),Ga=Qt("[FeatureFlags]",{debugEnabled:!0}),Ug=`" failed. Feature flags didn't load in time.`,yM=[502,504],l5=["click","keydown","wheel","touchstart","pointerdown"],o5="connection_error",c5=e=>{const t={};for(let n=0;e.length>n;n++)t[e[n]]=!0;return t},u5=e=>{const t={};for(const[n,i]of Lh(e||{}))i&&(t[n]=i);return t},d5=e=>Eo(e)&&(e.name==="RangeError"&&e.message.indexOf("Maximum call stack size exceeded")===0||e.name==="InternalError"&&e.message==="too much recursion"),li=Qt("[Error tracking]"),W0="webkit-masked-url:",_M=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],wM=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",W0],SM=["__firefox__","__gCrWeb"],h5="Refusing to render web experiment since the viewer is a likely bot",kM={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>lf(t,e),not_regex:(e,t)=>!lf(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e},qs=Qt("[Conversations]"),Ya="Conversations not available yet.";function f5(e,t){var n,i,a,c,u,h,f;const m=(n=e==null?void 0:e.flushIntervalMs)!==null&&n!==void 0?n:3e3,x=(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,b=ue(v)?Math.max(x,2048):Math.max(x,v),y=B(B({},(function(){let _="",j="";try{const N=jn==null?void 0:jn.userAgent;N&&([_,j]=CS(N))}catch{}return(function(N,S){const C=(function(E){if(E)return{}.hasOwnProperty.call(lw,E)?lw[E]:E})(N);return B(B({},C?{"os.name":C}:{}),S?{"os.version":S}:{})})(_,j)})()),e==null?void 0:e.resourceAttributes);return{serviceName:(c=(u=y==null?void 0:y["service.name"])!==null&&u!==void 0?u:e==null?void 0:e.serviceName)!==null&&c!==void 0?c:t==null?void 0:t.serviceNameDefault,serviceVersion:(h=y==null?void 0:y["service.version"])!==null&&h!==void 0?h:e==null?void 0:e.serviceVersion,environment:(f=y==null?void 0:y["deployment.environment"])!==null&&f!==void 0?f:e==null?void 0:e.environment,resourceAttributes:y,beforeSend:e==null?void 0:e.beforeSend,flushIntervalMs:m,maxBufferSize:x,maxQueueSize:b,maxBatchRecordsPerPost:100,rateCapWindowMs:m,maxLogsPerInterval:v,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}const jM=["debug","log","warn","error","info"],NM=e=>{for(;e!=null&&e.__rrweb_original__;)e=e.__rrweb_original__;return e},p5="console",uj="__posthogHandledLogsRequestError",Hg=(e,t)=>{const n=e instanceof Error?e:new Error(t);return n[uj]=!0,n},m5=e=>!!e&&typeof e=="object"&&e[uj]===!0,of=Qt("[NetworkMetrics]"),$x=()=>{var e;return!(te==null||(e=te.performance)===null||e===void 0)&&e.now?te.performance.now():Date.now()},CM={"http:":80,"https:":443},EM=new Set(["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"]),dj=(e,t)=>{var n;const i=String(t);return{method:String(e).toUpperCase(),url:((n=ua(i))===null||n===void 0?void 0:n.href)||i}},K0=(e,t,n,i,a,c,u=!1)=>{try{var h,f;const m=a();if(!m)return;const x=n||void 0,v=$x()-i,b=ua(t.url);if(b&&b.protocol!=="http:"&&b.protocol!=="https:")return;const y={url:(b==null?void 0:b.href)||t.url,method:t.method},_=kn(m.name)?m.name(y):Je(m.name)?m.name:"http.client.request.duration";if(!_)return;const j=u&&!x?void 0:((S,C)=>S?400>S?void 0:String(S):(C==null?void 0:C.name)||"_OTHER")(x,c),N=B(B(B(B(B({},(S=>{const C=EM.has(S)?S:"_OTHER";return B({"http.request.method":C},C==="_OTHER"&&S!==C?{"http.request.method_original":S}:{})})(y.method)),b?(S=>{return{"server.address":S.hostname.startsWith("[")&&S.hostname.endsWith("]")?S.hostname.slice(1,-1):S.hostname,"server.port":Number(S.port)||CM[S.protocol],"url.scheme":S.protocol.slice(0,-1),"url.template":(C=S.pathname,C.split("/").map(E=>(R=>/^\d+$/.test(R)||R.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(R))(E)?":id":E).join("/"))};var C})(b):{}),x?{"http.response.status_code":x}:{}),j?{"error.type":j}:{}),(h=m.attributes)===null||h===void 0?void 0:h.call(m,y,{status:x,durationMs:v}));(f=e.metrics)===null||f===void 0||f.histogram(_,v,{unit:"ms",attributes:N})}catch(m){of.error("Failed to record network metric",m)}},hj=()=>{},TM=(e,t)=>kn(te==null?void 0:te.fetch)?ju(te,"fetch",n=>function(...i){const a=$x(),c=n.apply(this,i);if(!t())return c;try{var u,h,f;const[m,x]=i,v=dj((u=(h=x==null?void 0:x.method)!==null&&h!==void 0?h:m==null?void 0:m.method)!==null&&u!==void 0?u:"GET",(f=m==null?void 0:m.url)!==null&&f!==void 0?f:m);return c.then(b=>(K0(e,v,b==null?void 0:b.status,a,t,void 0,!0),b),b=>{throw K0(e,v,void 0,a,t,b),b})}catch(m){return of.error("Failed to observe fetch",m),c}}):hj,AM=(e,t)=>{var n;const i=te==null||(n=te.XMLHttpRequest)===null||n===void 0?void 0:n.prototype;if(!i)return hj;const a=new WeakMap,c=ju(i,"open",h=>function(...f){try{qk.has(this)||a.set(this,dj(f[0],f[1]))}catch(m){of.error("Failed to observe XHR open",m)}return h.apply(this,f)}),u=ju(i,"send",h=>function(...f){let m;try{const x=a.get(this);if(x&&t()){const v=$x();m=()=>{this.removeEventListener("loadend",m),K0(e,x,this.status,v,t)},yt(this,"loadend",m)}}catch(x){of.error("Failed to observe XHR send",x)}try{return h.apply(this,f)}catch(x){throw m&&this.removeEventListener("loadend",m),x}});return()=>{c(),u()}},wf={featureFlags:class{constructor(e){this.name="featureFlags",this.Xc=!1,this.featureFlagEventHandlers=[],this.$=a5,this.Yc={},this.td={},this.ed=[],this.nd=!1,this.sd=!1,this.rd=0,this.od=!1,this.ad=!1,this.ld=!1,this.ud=!1,this.hd=0,this.dd=!1,this.an=()=>{const t=this.vd();this.hd=0,t&&this.reloadFeatureFlags()},this.fd=()=>{var t,n;const i=this.pd,a=(t=this.gd)!==null&&t!==void 0?t:i;ue(i)||ue(a)||this.Rr.remoteRequestsDisabled||!he||he.visibilityState==="hidden"||Date.now()-((n=this.md)!==null&&n!==void 0?n:0)<a||(this.gd=this.dd||!this.Rr.idleRefreshBackoff?i:Math.min(2*a,36e5),this.dd=!1,this.reloadFeatureFlags(),this.yd())},this.bd=()=>{this.dd&&this.gd===this.pd||this._d()},this.ln=()=>{(he==null?void 0:he.visibilityState)==="visible"&&this._d()},"get"in e?this.So=e:(this._instance=e,this.wd=new bM(e.config,e.nl()),this.So=this.wd)}updateConfig(e,t){var n;(n=this.wd)===null||n===void 0||n.update(e,t),this.wo&&this.kd()}setup(e){return this.Fh=e,this.$=e.logger.createLogger("[FeatureFlags]"),cj(e.kv.initialize(),()=>{this.Fh===e&&(this.Fh=void 0,this.wo=e,this.Sd(e))})}Sd(e){var t;if(this.wo===e)return te&&yt(te,"online",this.an),this.kd(),this.xd=e.registerDynamicEventProperties(()=>this.Cd()?this.Yc:this.td),this.$d=(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0?void 0:t.onCrossTabFeatureFlagChange(()=>{this.Td(),this.Id(),this.Md()}),this.Id(),this.initialize()}_d(){this.dd=!0,this.gd=this.pd,this.fd()}kd(){const e=this.Rr.refreshIntervalMs,t=!this.Rr.remoteRequestsDisabled&&he&&!ue(e)&&e>0?e:void 0;this.Rr.idleRefreshBackoff||(this.gd=t),t!==this.pd&&(this.Ed(),ue(t)||(this.pd=t,this.gd=t,this.yd(),he!=null&&he.addEventListener&&(yt(he,yu,this.ln),uo(l5,n=>{yt(he,n,this.bd,{capture:!0})}))))}yd(){ue(this.pd)||(ue(this.Pd)||clearInterval(this.Pd),this.md=Date.now(),this.Pd=setInterval(this.fd,this.pd))}Ed(){var e;ue(this.Pd)||(clearInterval(this.Pd),this.Pd=void 0,he==null||(e=he.removeEventListener)===null||e===void 0||e.call(he,"visibilitychange",this.ln),uo(l5,t=>{var n;he==null||(n=he.removeEventListener)===null||n===void 0||n.call(he,t,this.bd,{capture:!0})})),this.pd=void 0,this.gd=void 0,this.dd=!1,this.md=void 0}destroy(){this.Rd()}dispose(){this.Rd()}Rd(){var e,t;this.Ed(),this.rd++,this.ad=!1,this.Fh=void 0,this.wo&&(this.Ad(),(e=this.xd)===null||e===void 0||e.dispose(),this.xd=void 0,(t=this.$d)===null||t===void 0||t.call(this),this.$d=void 0,this.ed=[],te==null||te.removeEventListener("online",this.an),this.wo=void 0)}get Rr(){return this.So.get()}Fd(e){var t;return this.Od&&e in this.Od?this.Od[e]:(t=this.wo)===null||t===void 0?void 0:t.kv.get(e)}Td(){return!!this.Od&&(this.Od=void 0,!0)}Dd(){var e;return!ue((e=this.wo)===null||e===void 0?void 0:e.kv.get("$enabled_feature_flags"))&&this.Td()}At(e){this.Ld(()=>{var t;return(t=this.wo)===null||t===void 0?void 0:t.kv.set(e)})}Nd(e,t,n){var i;if(!(!((i=this._instance)===null||i===void 0)&&i.persistence)||!e.$enabled_feature_flags)return;const a=this.Fd("$enabled_feature_flags")||{},c=e.$enabled_feature_flags||{},u=t.flags||t.featureFlags,h=t.flags?Object.entries(t.flags).filter(([,S])=>!(S!=null&&S.failed)).map(([S])=>S):[],f=!!t.errorsWhileComputingFlags&&!!t.flags,m=f?h:n&&!Ie(u)?Object.keys(u||{}):Array.from(new Set([...Object.keys(a),...Object.keys(c)])),x=this.Fd("$feature_flag_payloads")||{},v=e.$feature_flag_payloads||{},b=f||n?m:Array.from(new Set([...Object.keys(x),...Object.keys(v)])),y=!f&&!n,_=!!y||m,j=!!y||b,N={[cr]:_,[ci]:_,[sa]:j};e.$feature_flag_details&&(N[el]=_);for(const S of[tl,la,ru])ue(e[S])||(N[S]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(N)}Lt(e){this.Ld(()=>{var t;return(t=this.wo)===null||t===void 0?void 0:t.kv.remove(e)})}Ld(e){try{e()}catch(t){this.$.error("Failed to update feature flag persistence",t)}}Id(){const e={};for(const i of[cr,sa,tl,Ti]){const a=this.Fd(i);ue(a)||(e[i]=a)}this.Yc=e;const t=B({},e),n=this.Fd(ci);if(n)for(const[i,a]of Object.entries(n))t[`$feature/${i}`]=a;this.td=t}Cd(){const e=this.Rr.cacheTtlMs;if(!e||0>=e)return!1;const t=this.Fd(la);return typeof t!="number"||Date.now()-t>e}qd(){return!!this.Cd()&&(this.ud||this.sd||(this.ud=!0,this.$.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}jd(){const e=this.Rr.evaluationContexts;return e!=null&&e.length?e.filter(t=>{const n=t&&typeof t=="string"&&t.trim().length>0;return n||this.$.error("Invalid evaluation context found:",t,"Expected non-empty string"),n}):[]}Bd(){const e=this.Rr.flagKeys;if(!ue(e))return e.filter(t=>{const n=t&&typeof t=="string"&&t.trim().length>0;return n||this.$.error("Invalid flag key found:",t,"Expected non-empty string"),n})}initialize(){var e,t;const n=this.Rr,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,c;const u=(a=(c=n.bootstrap)===null||c===void 0?void 0:c.featureFlagPayloads)!==null&&a!==void 0?a:{},h=Object.keys(i).filter(m=>!ue(i[m])).reduce((m,x)=>(m[x]=i[x],m),{}),f=Object.keys(u).filter(m=>h[m]).reduce((m,x)=>(m[x]=u[x],m),{});return this.Hd({featureFlags:h,featureFlagPayloads:f},void 0,{persist:!1})}}updateFlags(e,t,n){var i,a;const c=n!=null&&n.merge&&(i=this.Fd("$enabled_feature_flags"))!==null&&i!==void 0?i:{},u=n!=null&&n.merge&&(a=this.Fd("$feature_flag_payloads"))!==null&&a!==void 0?a:{},h=B(B({},c),e),f=B(B({},u),t),m={};for(const[x,v]of Object.entries(h))m[x]={key:x,enabled:nw(v),variant:sw(v),reason:void 0,metadata:ue(f==null?void 0:f[x])?void 0:{id:0,version:void 0,description:void 0,payload:f[x]}};this.Hd({flags:m})}get hasLoadedFlags(){return this.nd}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const e=this.Fd(el),t=this.Fd(Ti),n=this.Fd(Ka);if(!n&&!t)return e||{};const i=Dt({},e||{}),a=[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])];for(const h of a){var c;const f=i[h],m=t==null?void 0:t[h],x=ue(m)?(c=f==null?void 0:f.enabled)!==null&&c!==void 0&&c:!!m,v=ue(m)?f==null?void 0:f.variant:typeof m=="string"?m:void 0,b=n==null?void 0:n[h],y=B(B({},f),{},{enabled:x,variant:x?v??(f==null?void 0:f.variant):void 0});var u;x!==(f==null?void 0:f.enabled)&&(y.original_enabled=f==null?void 0:f.enabled),v!==(f==null?void 0:f.variant)&&(y.original_variant=f==null?void 0:f.variant),b&&(y.metadata=B(B({},f==null?void 0:f.metadata),{},{payload:b,original_payload:f==null||(u=f.metadata)===null||u===void 0?void 0:u.payload})),i[h]=y}return this.Xc||(this.$.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:i}),this.Xc=!0),i}getAllFeatureFlags(){const e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map(n=>{const i=e[n];return{key:n,enabled:nw(i),variant:sw(i),payload:tw(t[n])}})}getFlagVariants(){const e=this.Fd(ci),t=this.Fd(Ti);if(!t)return e||{};const n=Dt({},e||{}),i=Object.keys(t);for(let a=0;i.length>a;a++)n[i[a]]=t[i[a]];return this.Xc||(this.$.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.Xc=!0),n}getFlagPayloads(){const e=this.Fd(sa),t=this.Fd(Ka);if(!t)return e||{};const n=Dt({},e||{}),i=Object.keys(t);for(let a=0;i.length>a;a++)n[i[a]]=t[i[a]];return this.Xc||(this.$.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),this.Xc=!0),n}reloadFeatureFlags(){this.od||this.Rr.featureFlagsDisabled||this.vd()||(this.sd&&(this.ad=!0),this.zd||(this.ed.slice().forEach(e=>{try{e()}catch(t){this.$.error("Error while running feature flags reloading callback",t)}}),this.zd=setTimeout(()=>{this.Ud()},5)))}Ad(){clearTimeout(this.zd),this.zd=void 0}onReloading(e){return this.ed.push(e),()=>{this.ed=this.ed.filter(t=>t!==e)}}ensureFlagsLoaded(){this.nd||this.sd||this.zd||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.od=e}resetFlagCallReported(){this.Lt(aa)}Ud(e){this.Ad();const t=this.wo;if(!t||this.Rr.remoteRequestsDisabled||this.vd())return;if(this.sd)return void(this.ad=!0);const n={token:t.projectToken,distinct_id:t.distinctId,groups:t.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:B(B(B({},t.initialPersonProperties),this.Fd("$stored_person_properties")||{}),{},{$lib:t.library.name,$lib_version:t.library.version}),group_properties:this.Fd(ra),timezone:zk()};ue(t.deviceId)||(n.$device_id=t.deviceId),(e!=null&&e.disableFlags||this.Rr.featureFlagsDisabled)&&(n.disable_flags=!0);const i=this.jd();i.length&&(n.evaluation_contexts=i);const a=this.Bd();ue(a)||(n.flag_keys=a);const c=this.Rr.onlyEvaluateSurveyFeatureFlags,u="/flags/?v=2"+(c?"&only_evaluate_survey_feature_flags=true":""),h=this.rd;this.sd=!0;const f=()=>{this.ad&&(this.ad=!1,this.Ud())},m=_=>{var j,N;const S=(j=_.json)!==null&&j!==void 0?j:{},C=_.statusCode!==200;if(this.sd=!1,h!==this.rd)return void f();if(this.Wd(_.statusCode),C||this.ad||(this.$anon_distinct_id=void 0),n.disable_flags&&!this.ad)return;this.ld=!C;const E=[];_.error?E.push(_.error instanceof Error&&_.error.name==="AbortError"?"timeout":_.error instanceof Error?o5:"unknown_error"):_.statusCode!==200&&E.push(`api_error_${_.statusCode}`),S.errorsWhileComputingFlags&&E.push("errors_while_computing_flags");const R=!!(!((N=S.quotaLimited)===null||N===void 0)&&N.includes("feature_flags"));R&&E.push("quota_limited"),this.At({[bu]:E}),R?this.$.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."):n.disable_flags||this.Hd(S,C,{partialResponse:c}),f()},x=_=>{this.sd=!1,h===this.rd&&(this.At({[bu]:[o5]}),this.$.error("Feature flag request failed",_),this.Dd()&&this.Md(!0)),f()};let v=this.Rr.requestMaxRetries;const b=()=>v>0&&h===this.rd,y=()=>{if(h!==this.rd||!this.wo||this.Rr.remoteRequestsDisabled)return this.sd=!1,void f();try{t.sendRequest(u,{target:"flags",method:"POST",body:n,compression:this.Rr.compression,sentAt:"body",timeoutMs:this.Rr.requestTimeoutMs}).then(_=>{if((j=>yM.includes(j.statusCode)||(N=>N.statusCode===0&&N.error instanceof Error&&N.error.name==="AbortError")(j))(_)&&b())return v--,void setTimeout(y,500);m(_)}).catch(x)}catch(_){x(_)}};y()}vd(){return Ck(this.hd,3)}Wd(e){this.hd=Ek(e,this.hd,3,()=>this.$.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.ld)return;if(!(this.nd||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlag for key "'+e+Ug);if(this.qd())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.ld)return;if(!(this.nd||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlagResult for key "'+e+Ug);if(this.qd())return;const n=this.getFlagVariants(),i=e in n,a=n[e],c=this.getFlagPayloads()[e],u=String(a),h=this.Fd("$feature_flag_request_id")||void 0,f=this.Fd("$feature_flag_evaluated_at")||void 0;let m,x=this.Fd("$flag_call_reported")||{};if(this.Rr.deduplicateCallsPerSession){var v;const Q=(v=this.wo)===null||v===void 0?void 0:v.session.sessionId,I=this.Fd(Wc);Q&&Q!==I&&(x={},m=Q)}if(t.send_event||!("send_event"in t))if(e in x&&x[e].includes(u))m&&this.At({[aa]:x,[Wc]:m});else{var b,y,_,j,N,S,C,E,R,L,O,F;Ie(x[e])?x[e].push(u):x[e]=[u],this.At(B({[aa]:x},m?{[Wc]:m}:{}));const Q=this.getFeatureFlagDetails(e),I=[...(b=this.Fd("$feature_flag_errors"))!==null&&b!==void 0?b:[]];ue(a)&&I.push("flag_missing");const X={$feature_flag:e,$feature_flag_response:a,$feature_flag_payload:c??null,$feature_flag_request_id:h,$feature_flag_evaluated_at:f,$feature_flag_bootstrapped_response:(y=(_=this.Rr.bootstrap)===null||_===void 0||(_=_.featureFlags)===null||_===void 0?void 0:_[e])!==null&&y!==void 0?y:null,$feature_flag_bootstrapped_payload:(j=(N=this.Rr.bootstrap)===null||N===void 0||(N=N.featureFlagPayloads)===null||N===void 0?void 0:N[e])!==null&&j!==void 0?j:null,$used_bootstrap_value:!this.ld};ue(Q==null||(S=Q.metadata)===null||S===void 0?void 0:S.has_experiment)||(X.$feature_flag_has_experiment=Q.metadata.has_experiment),ue(Q==null||(C=Q.metadata)===null||C===void 0?void 0:C.version)||(X.$feature_flag_version=Q.metadata.version);const M=(E=Q==null||(R=Q.reason)===null||R===void 0?void 0:R.description)!==null&&E!==void 0?E:Q==null||(L=Q.reason)===null||L===void 0?void 0:L.code;var D;M&&(X.$feature_flag_reason=M),!(Q==null||(O=Q.metadata)===null||O===void 0)&&O.id&&(X.$feature_flag_id=Q.metadata.id),ue(Q==null?void 0:Q.original_variant)&&ue(Q==null?void 0:Q.original_enabled)||(X.$feature_flag_original_response=ue(Q.original_variant)?Q.original_enabled:Q.original_variant),!(Q==null||(F=Q.metadata)===null||F===void 0)&&F.original_payload&&(X.$feature_flag_original_payload=Q==null||(D=Q.metadata)===null||D===void 0?void 0:D.original_payload),I.length&&(X.$feature_flag_error=I.join(",")),this.Vd(X)}else m&&this.At({[aa]:x,[Wc]:m});return i?{key:e,enabled:!!a,variant:typeof a=="string"?a:void 0,payload:tw(c)}:void 0}Vd(e){try{var t;(t=this.wo)===null||t===void 0||t.capture("$feature_flag_called",e)}catch(n){this.$.error("Failed to capture feature flag call",n)}}getRemoteConfigPayload(e,t){this.Gd(e,t)}Gd(e,t){var n=this;return Bt(function*(){const i=n.wo;if(!i)return;const a={distinct_id:i.distinctId,token:i.projectToken,person_properties:{$lib:i.library.name,$lib_version:i.library.version}},c=n.jd();c.length&&(a.evaluation_contexts=c);const u=n.Bd();let h;ue(u)||(a.flag_keys=u);try{var f;const m=(f=(yield i.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:a,compression:n.Rr.compression,sentAt:"body",timeoutMs:n.Rr.requestTimeoutMs})).json)===null||f===void 0?void 0:f.featureFlagPayloads;h=(m==null?void 0:m[e])||void 0}catch(m){return void n.$.error("Remote config feature flag request failed",m)}try{t(h)}catch(m){n.$.error("Remote config feature flag callback failed",m)}})()}isFeatureEnabled(e,t={}){if(t.fresh&&!this.ld)return t.defaultValue;if(!(this.nd||this.getFlags()&&this.getFlags().length>0))return this.$.warn('isFeatureEnabled for key "'+e+Ug),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.Hd(e,t,n)}Hd(e,t,n){if(!this.wo)return;this.nd=!0;const i=((a,c={},u={},h={},f,m=a5)=>{const x=((E,R)=>{const L=E.flags;if(L){const O=Object.fromEntries(Object.keys(L).map(D=>{var Q;return[D,(Q=L[D].variant)!==null&&Q!==void 0?Q:L[D].enabled]})),F=Object.fromEntries(Object.keys(L).filter(D=>L[D].enabled).filter(D=>{var Q;return!ue((Q=L[D].metadata)===null||Q===void 0?void 0:Q.payload)}).map(D=>{var Q;return[D,(Q=L[D].metadata)===null||Q===void 0?void 0:Q.payload]}));return B(B({},E),{},{featureFlags:O,featureFlagPayloads:F})}return E.featureFlags&&R.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),E})(a,m),v=x.flags,b=x.featureFlags,y=x.featureFlagPayloads;if(!b)return;const _=a.requestId,j=a.evaluatedAt;if(Ie(b)){m.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");const E={};if(b)for(let R=0;b.length>R;R++)E[b[R]]=!0;return{[cr]:b,[ci]:E,[ru]:!1}}let N=b,S=y,C=v;if(f!=null&&f.partialResponse){const E=Object.keys(N),R=S||{};N=B(B({},c),N),S=B(B({},u),R),E.forEach(L=>{L in R||S==null||delete S[L]}),C=B(B({},h),C)}else if(a.errorsWhileComputingFlags)if(v){const E=new Set(Object.keys(v).filter(L=>{var O;return!(!((O=v[L])===null||O===void 0)&&O.failed)}));N=B(B({},c),Object.fromEntries(Object.entries(N).filter(([L])=>E.has(L))));const R=Object.fromEntries(Object.entries(S||{}).filter(([L])=>E.has(L)));S=B(B({},u),R),E.forEach(L=>{L in R||S==null||delete S[L]}),C=B(B({},h),Object.fromEntries(Object.entries(C||{}).filter(([L])=>E.has(L))))}else N=B(B({},c),N),S=B(B({},u),S),C=B(B({},h),C);return B(B({[cr]:Object.keys(u5(N)),[ci]:N||{},[sa]:S||{},[el]:C||{},[ru]:a.minimalFlagCalledEvents===!0},_?{[tl]:_}:{}),j?{[la]:j}:{})})(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),n,this.$);if(i)if((n==null?void 0:n.persist)===!1){const a=!ue(this.wo.kv.get(ci));this.Od=i,a||this.At(i)}else this.Td(),this.Nd(i,e,!!(n!=null&&n.partialResponse)),this.At(i);else t&&this.Dd();t||(this.ud=!1),this.Md(t)}override(e,t=!1){this.$.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){this.Zd(e)}Zd(e){if(this.wo){if(e===!1)return this.Lt([Ti,Ka]),this.Md(),void Ga.info("All overrides cleared");if(Ie(e))return this.At({[Ti]:c5(e)}),this.Md(),void Ga.info("Flag overrides set",{flags:e});if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var t;const n=e;this.Xc=!!((t=n.suppressWarning)!==null&&t!==void 0&&t);const i={},a=n.flags,c=n.payloads;return a&&(i[Ti]=Ie(a)?c5(a):a),c&&(i[Ka]=c),Object.keys(i).length&&this.At(i),a===!1&&c===!1?this.Lt([Ti,Ka]):a===!1?this.Lt(Ti):c===!1&&this.Lt(Ka),this.Md(),a===!1?Ga.info("Flag overrides cleared"):a&&Ga.info("Flag overrides set",{flags:a}),void(c===!1?Ga.info("Payload overrides cleared"):c&&Ga.info("Payload overrides set",{payloads:c}))}if(e&&typeof e=="object")return this.At({[Ti]:e}),this.Md(),void Ga.info("Flag overrides set",{flags:e});this.$.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}else this.$.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.nd){const{flags:t,flagVariants:n}=this.Qd();try{e(t,n)}catch(i){this.$.error("Error while running feature flags callback",i)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,n){var i;const a=(this.Fd("$early_access_features")||[]).find(m=>m.flagKey===e),c={[`$feature_enrollment/${e}`]:t},u={$feature_flag:e,$feature_enrollment:t,$set:c};a&&(u.$early_access_feature_name=a.name),n&&(u.$feature_enrollment_stage=n);const h=B(B({},this.getFlagVariants()),{},{[e]:t});(i=this._instance)===null||i===void 0||(i=i.persistence)===null||i===void 0||i.markCrossTabFeatureFlagChanges({$active_feature_flags:[e],$enabled_feature_flags:[e],$stored_person_properties:Object.keys(c)}),this.At({[cr]:Object.keys(u5(h)),[ci]:h,[ia]:B(B({},this.Fd("$stored_person_properties")||{}),c)}),this.Md();try{var f;(f=this.wo)===null||f===void 0||f.capture("$feature_enrollment_update",u)}catch(m){this.$.error("Failed to capture early access feature enrollment",m)}}getEarlyAccessFeatures(e,t=!1,n){const i=this.Fd(D0);!i||t?this.Jd(e,n):e(i)}Jd(e,t){var n=this;return Bt(function*(){const i=n.wo;if(!i)return;const a=t?`&${t.map(u=>`stage=${u}`).join("&")}`:"";let c;try{const u=yield i.sendRequest(`/api/early_access_features/?token=${i.projectToken}${a}`,{target:"api",method:"GET",sentAt:"query"});if(!u.json)return;c=u.json.earlyAccessFeatures,n.At({[D0]:c})}catch(u){return void n.$.error("Early access feature request failed",u)}try{e(c)}catch(u){n.$.error("Early access feature callback failed",u)}})()}Qd(){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),{})}}Md(e){this.Id();const{flags:t,flagVariants:n}=this.Qd();this.featureFlagEventHandlers.forEach(i=>{try{i(t,n,{errorsLoading:e})}catch(a){this.$.error("Error while running feature flags callback",a)}})}setPersonPropertiesForFlags(e,t=!0){this.Kd(e,t)}Kd(e,t=!0){const n=this.Fd("$stored_person_properties")||{},i=(e==null?void 0:e.$set)||(e!=null&&e.$set_once?{}:e),a=e==null?void 0:e.$set_once,c={};if(a)for(const u in a)({}).hasOwnProperty.call(a,u)&&(u in n||(c[u]=a[u]));this.At({[ia]:B(B(B({},n),c),i)}),t&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t=!0){const n=B({},this.Fd("$stored_person_properties")||{});e.forEach(i=>{delete n[i]}),this.At({[ia]:n}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e=!0){this.Lt(ia),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t=!0){const n=this.Fd("$stored_group_properties")||{},i=B({},n);for(const a of Object.keys(e))i[a]=B(B({},n[a]),e[a]);this.At({[ra]:i}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){const t=this.Fd("$stored_group_properties")||{};this.At({[ra]:B(B({},t),{},{[e]:{}})})}else this.Lt(ra)}reset(){this.rd++,this.ad=!1,this.Yc={},this.td={},this.Od=void 0,this.nd=!1,this.od=!1,this.ld=!1,this.$anon_distinct_id=void 0,this.Ad(),this.Xc=!1,this.hd=0}}},MM={sessionRecording:class{get Rr(){return this._instance.config}get Ml(){return this._instance.persistence}get started(){var e;return!!(!((e=this.Xd)===null||e===void 0)&&e.isStarted)}get status(){var e,t;return this.Yd==="awaiting_config"||this.Yd==="missing_config"?this.Yd:(e=(t=this.Xd)===null||t===void 0?void 0:t.status)!==null&&e!==void 0?e:this.Yd}constructor(e){if(this._instance=e,this._forceAllowLocalhostNetworkCapture=!1,this.Yd=Pg,this.tv=void 0,this.ev=!1,this.Xe=(()=>{var t,n;if(!(he!=null&&he.visibilityState)||he.visibilityState==="visible")return!0;const i=te==null||(t=te.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.ln=()=>{var t,n;(he==null?void 0:he.visibilityState)==="visible"&&(this.Xe=!0,(t=this.Xd)===null||t===void 0||(n=t.setDocumentWasEverVisible)===null||n===void 0||n.call(t,!0))},!this._instance.sessionManager)throw ir.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if(this.Rr.cookieless_mode==="always")throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');he!=null&&he.addEventListener&&yt(he,"visibilitychange",this.ln)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:e=!1}={}){var t;this.ev=!0,he==null||(t=he.removeEventListener)===null||t===void 0||t.call(he,"visibilitychange",this.ln),e?this.iv(!0):this.stopRecording()}get nv(){var e;const t=!!(!((e=this._instance.get_property("$session_recording_remote_config"))===null||e===void 0)&&e.enabled),n=!this.Rr.disable_session_recording,i=this.Rr.disable_session_recording||this._instance.consent.isOptedOut();return te&&t&&n&&!i}startIfEnabledOrStop(e){var t;if(this.ev||this.nv&&(!((t=this.Xd)===null||t===void 0)&&t.isStarted))return;const n=!ue(Object.assign)&&!ue(Array.from);this.nv&&n?(this.sv(e),ir.info("starting")):(this.Yd=Pg,this.stopRecording())}sv(e){var t,n;if(this.nv)if(this.Yd!=="awaiting_config"&&this.Yd!=="missing_config"&&(this.Yd=e5),($e==null||(t=$e.__PosthogExtensions__)===null||t===void 0||(t=t.rrweb)===null||t===void 0?void 0:t.record)&&((n=$e.__PosthogExtensions__)===null||n===void 0?void 0:n.initSessionRecording))this.rv(e);else{var i,a;const c=this._instance.sessionManager;(i=$e.__PosthogExtensions__)===null||i===void 0||(a=i.loadExternalDependency)===null||a===void 0||a.call(i,this._instance,this.ov,u=>{if(!this.ev&&this.nv&&this._instance.sessionManager===c)return u?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),ir.error("could not load recorder",u)):void this.rv(e);this.Yd="disabled"})}}stopRecording(){var e,t;(e=this.tv)===null||e===void 0||e.call(this),this.tv=void 0,(t=this.Xd)===null||t===void 0||t.stop()}iv(e=!1){var t,n;(t=this.tv)===null||t===void 0||t.call(this),this.tv=void 0,(n=this.Xd)===null||n===void 0||n.discard({discardProducerEvents:e})}av(){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")}lv(e,t){if(Ve(e))return null;const n=Jt(e)?e:parseFloat(e);return typeof(i=n)!="number"||!Number.isFinite(i)||0>i||i>1?(ir.warn(`${t} must be between 0 and 1. Ignoring invalid value:`,e),null):n;var i}uv(e){if(this.Ml){var t,n;const i=this.Ml,a=()=>{var c;const u=e.sessionRecording===!1?void 0:e.sessionRecording,h=this.lv((c=this.Rr.session_recording)===null||c===void 0?void 0:c.sampleRate,"session_recording.sampleRate"),f=this.lv(u==null?void 0:u.sampleRate,"remote config sampleRate"),m=h??f;Ve(m)&&this.av();const x=u==null?void 0:u.minimumDurationMilliseconds;i.register({[iu]:B(B({cache_timestamp:Date.now(),enabled:!!u},u),{},{networkPayloadCapture:B({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:m,minimumDurationMilliseconds:ue(x)?null:x,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.tv)===null||t===void 0||t.call(this),this.tv=(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.uv(t),void this.iv()):(this.uv(t),void this.startIfEnabledOrStop()):(this.Yd==="awaiting_config"&&(this.Yd="missing_config",this._instance.register_for_session({[dk]:!0}),ir.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t="log"){var n;!((n=this.Xd)===null||n===void 0)&&n.log?this.Xd.log(e,t):ir.warn("log called before recorder was ready")}get ov(){var e,t;const n=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.get_property(iu);return(n==null||(t=n.scriptConfig)===null||t===void 0?void 0:t.script)||"lazy-recorder"}hv(){const e=this._instance.get_property(iu);if(!e)return!1;let t;try{t=typeof e=="object"?e:JSON.parse(e)}catch(n){return ir.warn("persisted remote config for session recording is invalid and will be ignored",n),!1}return!Ve(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}rv(e){var t,n,i;if(!this.ev&&this.nv&&this._instance.sessionManager){if(!(!((t=$e.__PosthogExtensions__)===null||t===void 0)&&t.initSessionRecording))return ir.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[uk]:!0});var a;if(this.Xd||(this.Xd=(a=$e.__PosthogExtensions__)===null||a===void 0?void 0:a.initSessionRecording(this._instance,this.Xe),this.Xd._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.hv())return this.Yd==="missing_config"||this.Yd==="awaiting_config"?void 0:(this.Yd="awaiting_config",ir.info("persisted remote config is stale, requesting fresh config before starting"),void new Bk(this._instance).load());this.Yd=e5,(n=(i=this.Xd).setDocumentWasEverVisible)===null||n===void 0||n.call(i,this.Xe),this.Xd.start(e)}else this.Yd=Pg}onRRwebEmit(e){var t,n;(t=this.Xd)===null||t===void 0||(n=t.onRRwebEmit)===null||n===void 0||n.call(t,e)}overrideLinkedFlag(){var e,t;this.Xd||(t=this.Ml)===null||t===void 0||t.register({$replay_override_linked_flag:!0}),(e=this.Xd)===null||e===void 0||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.Xd||(t=this.Ml)===null||t===void 0||t.register({$replay_override_sampling:!0}),(e=this.Xd)===null||e===void 0||e.overrideSampling()}overrideTrigger(e){var t,n;this.Xd||(n=this.Ml)===null||n===void 0||n.register({[e==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(t=this.Xd)===null||t===void 0||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.Xd)===null||e===void 0?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var n;return!!(!((n=this.Xd)===null||n===void 0)&&n.tryAddCustomEvent(e,t))}flushBeforeIdentityReset(){var e,t;(e=this.Xd)===null||e===void 0||(t=e.flushBeforeIdentityReset)===null||t===void 0||t.call(e)}}},RM={autocapture:class extends rM{constructor(e){super(new aM(e)),this.instance=e}},historyAutocapture:class{constructor(e){this._instance=e,this.dv=this.vv()}initialize(){this.startIfEnabled()}get isEnabled(){const e=this.fv();return!!(e.path||e.search||this.pv(e))}startIfEnabled(){this.isEnabled&&(ye.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.dv=this.vv(),this.startIfEnabled()}stop(){this.gv&&this.gv(),this.gv=void 0,this.mv&&this.mv(),this.mv=void 0,ye.info("History API monitoring stopped")}monitorHistoryChanges(){te&&te.history&&(this.yv("pushState"),this.yv("replaceState"),this.bv(),this.pv()&&this._v())}yv(e){var t;if(!te||!((t=te.history[e])===null||t===void 0)&&t.__posthog_wrapped__)return;const n=this;ju(te.history,e,i=>function(a,c,u){i.call(this,a,c,u),n.wv(e)})}vv(){const e=te==null?void 0:te.location;if(e!=null&&e.pathname)return{pathname:e.pathname,search:e.search,hash:e.hash}}fv(){const e=this._instance.config.capture_pageview;return e==="history_change"?{path:!0}:st(e)?e:{}}pv(e=this.fv()){return!!e.hash&&!this._instance.config.disable_capture_url_hashes}Sv(e){const t=this.fv(),n=this.dv;return!(!n||!(t.path&&e.pathname!==n.pathname||t.search&&e.search!==n.search||this.pv(t)&&e.hash!==n.hash))}wv(e){try{const t=this.vv();if(!t)return;this.Sv(t)&&this._instance.capture(Tx,{navigation_type:e}),this.dv=t}catch(t){ye.error(`Error capturing ${e} pageview`,t)}}bv(){if(this.gv)return;const e=()=>{this.wv("popstate")};yt(te,"popstate",e),this.gv=()=>{te&&te.removeEventListener("popstate",e)}}_v(){if(this.mv)return;const e=()=>{this.wv("hashchange")};yt(te,"hashchange",e),this.mv=()=>{te&&te.removeEventListener("hashchange",e)}}},heatmaps:class{get Rr(){return this.instance.config}constructor(e){var t;this.xv=!1,this.xo=!1,this.Cv=null,this.instance=e,this.xv=!!(!((t=this.instance.persistence)===null||t===void 0)&&t.props[M0]),this.rageclicks=new oj(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let e=5e3;return st(this.Rr.capture_heatmaps)&&this.Rr.capture_heatmaps.flush_interval_milliseconds&&(e=this.Rr.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return Ve(this.Rr.capture_heatmaps)?Ve(this.Rr.enable_heatmaps)?this.xv:this.Rr.enable_heatmaps:this.Rr.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.xo)return;uM.info("starting..."),this.$v(),this.ln()}else{var e;clearInterval((e=this.Cv)!==null&&e!==void 0?e:void 0),this.Tv(),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({[M0]:n}),this.xv=n,this.startIfEnabled()}getAndClearBuffer(){const e=this.Rt;return this.Rt=void 0,e}Iv(e){Ig(e.originalEvent)&&this.Tr(e.originalEvent,"deadclick")}ln(){this.Cv&&clearInterval(this.Cv),this.Cv=(he==null?void 0:he.visibilityState)==="visible"?setInterval(this.bl.bind(this),this.flushIntervalMilliseconds):null}$v(){te&&he&&(this.Mv=this.bl.bind(this),yt(te,Jh,this.Mv),this.Ev=e=>this.Tr(e||(te==null?void 0:te.event)),yt(he,"click",this.Ev,{capture:!0}),this.Pv=e=>this.Rv(e||(te==null?void 0:te.event)),yt(he,"mousemove",this.Pv,{capture:!0}),this.Av=new Ew(this.instance,fA,this.Iv.bind(this)),this.Av.startIfEnabledOrStop(),this.Fv=this.ln.bind(this),yt(he,yu,this.Fv),this.xo=!0)}Tv(){var e;te&&he&&(this.Mv&&te.removeEventListener(Jh,this.Mv),this.Ev&&he.removeEventListener("click",this.Ev,{capture:!0}),this.Pv&&he.removeEventListener("mousemove",this.Pv,{capture:!0}),this.Fv&&he.removeEventListener(yu,this.Fv),clearTimeout(this.Ov),(e=this.Av)===null||e===void 0||e.stop(),this.xo=!1)}Dv(e,t){const n=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),a=this.instance.scrollManager.scrollElement(),c=(function(u,h,f){let m=u;for(;m&&Li(m)&&!Pn(m,"body");){if(m===f)return!1;let y;try{var x,v,b;y=(x=(v=(b=m.ownerDocument)===null||b===void 0?void 0:b.defaultView)!==null&&v!==void 0?v:te)===null||x===void 0?void 0:x.getComputedStyle(m).position}catch{return!1}if(Ue(h,y))return!0;m=yk(m)}return!1})(au(e),["fixed","sticky"],a);return{x:e.clientX+(c?0:i),y:e.clientY+(c?0:n),target_fixed:c,type:t}}Tr(e,t="click"){var n;if(vw(e.target)||!Ig(e))return;const i=this.Dv(e,t);!((n=this.rageclicks)===null||n===void 0)&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&wk(au(e),this.instance.config.rageclick)&&this.Zs(B(B({},i),{},{type:"rageclick"})),this.Zs(i)}Rv(e){!vw(e.target)&&Ig(e)&&(clearTimeout(this.Ov),this.Ov=setTimeout(()=>{this.Zs(this.Dv(e,"mousemove"))},500))}Zs(e){if(!te)return;const t=this.Rr.disable_capture_url_hashes?ca(te.location.href):te.location.href,n=this.Rr.custom_personal_data_properties,i=this.Rr.mask_personal_data_properties?[...wo,...n||[]]:[],a=Su(t,i,ku);this.Rt=this.Rt||{},this.Rt[a]||(this.Rt[a]=[]),this.Rt[a].push(e)}bl(){this.Rt&&!ms(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Ew,webVitalsAutocapture:class{constructor(e){var t;this._instance=e,this.xv=!1,this.xo=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Lv=()=>{clearTimeout(this.Nv),this.Nv=void 0,this.Rt.metrics.length!==0&&(this._instance.capture("$web_vitals",B({$current_url:this.Rt.url},this.Rt.metrics.reduce((n,i)=>B(B({},n),{},{[`$web_vitals_${i.name}_event`]:B({},i),[`$web_vitals_${i.name}_value`]:i.value}),{}))),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.qv=n=>{var i;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},Ve(n==null?void 0:n.name)||Ve(n==null?void 0:n.value))return void Va.error("Invalid metric received",n);const a=typeof n.navigationURL=="string"?n.navigationURL:void 0,c=this.jv(a);if(ue(c))return;const u=Jt(n.navigationId)||typeof n.navigationId=="string"?`navigation:${n.navigationId}`:`url:${c}`;if(this.Bv&&n.value>=this.Bv)return void Va.error("Ignoring metric with value >= "+this.Bv,n);this.Rt.navigationKey!==u&&(this.Lv(),this.Nv=setTimeout(this.Lv,this.flushToCaptureTimeoutMs)),ue(this.Rt.navigationKey)&&(this.Rt.navigationKey=u,this.Rt.url=c),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=B(B(B({},n),a?{navigationURL:c}:{}),{},{$current_url:c,timestamp:Date.now()});if(delete f.entries,st(n.attribution)&&this.attributionMetrics.indexOf(n.name)>-1){const m={};for(const x of cM){const v=x==="url"&&typeof n.attribution[x]=="string"?this.jv(n.attribution[x]):n.attribution[x];ue(v)||(m[x]=v)}f.attribution=m}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.Lv()},this.Hv=()=>{if(this.xo)return;let n,i,a,c,u=!1;const h=$e.__PosthogExtensions__,f=h==null?void 0:h.postHogWebVitalsCallbacksByFlavor,m=(f==null?void 0:f[this.zv])||(this.zv==="web-vitals"&&ue(f)?h==null?void 0:h.postHogWebVitalsCallbacks:void 0);if(!ue(m)){const b=m.withoutAttribution,y=this.attributionMetrics;u=!ue(b),n=y.indexOf("LCP")>-1?m.onLCP:(b==null?void 0:b.onLCP)||m.onLCP,i=y.indexOf("CLS")>-1?m.onCLS:(b==null?void 0:b.onCLS)||m.onCLS,a=y.indexOf("FCP")>-1?m.onFCP:(b==null?void 0:b.onFCP)||m.onFCP,c=y.indexOf("INP")>-1?m.onINP:(b==null?void 0:b.onINP)||m.onINP}if(!(n&&i&&a&&c))return void Va.error("web vitals callbacks not loaded - not starting");const x={reportSoftNavs:this.useSoftNavs},v=u&&this.attributionMetrics.indexOf("INP")>-1?B(B({},x),{},{includeProcessedEventEntries:!1}):x;this.allowedMetrics.indexOf("LCP")>-1&&n(this.qv.bind(this),x),this.allowedMetrics.indexOf("CLS")>-1&&i(this.qv.bind(this),x),this.allowedMetrics.indexOf("FCP")>-1&&a(this.qv.bind(this),x),this.allowedMetrics.indexOf("INP")>-1&&c(this.qv.bind(this),v),this.xo=!0},this.xv=!!(!((t=this._instance.persistence)===null||t===void 0)&&t.props[L0]),this.startIfEnabled()}get Uv(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t;const n=st(this.Uv)?(e=this.Uv)===null||e===void 0?void 0:e.web_vitals_allowed_metrics:void 0;return Ve(n)?((t=this._instance.persistence)===null||t===void 0?void 0:t.props.$web_vitals_allowed_metrics)||Jw:n}get flushToCaptureTimeoutMs(){return(st(this.Uv)?this.Uv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const e=st(this.Uv)?this.Uv.web_vitals_attribution:void 0;return ns(e)?e?Jw:[]:Ie(e)?e:oM}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const e=st(this.Uv)?this.Uv.__preview_web_vitals_soft_navs:void 0;return e!=null&&e}get Bv(){const e=st(this.Uv)&&Jt(this.Uv.__web_vitals_max_value)?this.Uv.__web_vitals_max_value:Zw;return e>0&&6e4>=e?Zw:e}get isEnabled(){const e=Yt==null?void 0:Yt.protocol;if(e!=="http:"&&e!=="https:")return Va.info("Web Vitals are disabled on non-http/https protocols"),!1;const t=st(this.Uv)?this.Uv.web_vitals:ns(this.Uv)?this.Uv:void 0;return ns(t)?t:this.xv}startIfEnabled(){this.isEnabled&&!this.xo&&(Va.info("enabled, starting..."),this.zo(this.Hv))}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if(!("capturePerformance"in t))return;const n=st(t.capturePerformance)&&!!t.capturePerformance.web_vitals,i=st(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[L0]:n}),this._instance.persistence.register({[JS]:i})),this.xv=n,this.startIfEnabled()}get zv(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}zo(e){var t;const n=$e.__PosthogExtensions__,i=this.zv,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,c=>{c?Va.error("failed to load script",c):e()})}jv(e){const t=e||(te==null?void 0:te.location.href);if(!t)return void Va.error("Could not determine current URL");const n=this._instance.config.disable_capture_url_hashes?ca(t):t,i=this._instance.config.custom_personal_data_properties,a=this._instance.config.mask_personal_data_properties?[...wo,...i||[]]:[];return Su(n,a,ku)}}},OM={exceptionObserver:class{constructor(e){var t;this.Hv=()=>{var n;if(!te||!this.isEnabled||!(!((n=$e.__PosthogExtensions__)===null||n===void 0)&&n.errorWrappingFunctions))return;const i=$e.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,a=$e.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,c=$e.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Wv&&this.Rr.capture_unhandled_errors&&(this.Wv=i(this.captureException.bind(this))),!this.Vv&&this.Rr.capture_unhandled_rejections&&(this.Vv=a(this.captureException.bind(this))),!this.Gv&&this.Rr.capture_console_errors&&(this.Gv=c(this.captureException.bind(this)))}catch(u){qc.error("failed to start",u),this.Zv()}},this._instance=e,this.Qv=!!(!((t=this._instance.persistence)===null||t===void 0)&&t.props[R0]),this.wt=new NT(B(B({},(function(n={}){var i,a,c,u;return{refillRate:(i=(a=n.exceptionRateLimiterRefillRate)!==null&&a!==void 0?a:n.__exceptionRateLimiterRefillRate)!==null&&i!==void 0?i:1,bucketSize:(c=(u=n.exceptionRateLimiterBucketSize)!==null&&u!==void 0?u:n.__exceptionRateLimiterBucketSize)!==null&&c!==void 0?c:10}})(this._instance.config.error_tracking)),{},{refillInterval:1e4,$:qc})),this.Rr=this.Jv(),this.startIfEnabledOrStop()}Jv(){const e=this._instance.config.capture_exceptions;let t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return st(e)?t=B(B({},t),e):(ue(e)?this.Qv:e)&&(t=B(B({},t),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.Rr.capture_console_errors||this.Rr.capture_unhandled_errors||this.Rr.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(qc.info("enabled"),this.Zv(),this.zo(this.Hv)):this.Zv()}zo(e){var t,n,i;!((t=$e.__PosthogExtensions__)===null||t===void 0)&&t.errorWrappingFunctions?e():(n=$e.__PosthogExtensions__)===null||n===void 0||(i=n.loadExternalDependency)===null||i===void 0||i.call(n,this._instance,"exception-autocapture",a=>{if(a)return qc.error("failed to load script",a);e()})}Zv(){var e,t,n;(e=this.Wv)===null||e===void 0||e.call(this),this.Wv=void 0,(t=this.Vv)===null||t===void 0||t.call(this),this.Vv=void 0,(n=this.Gv)===null||n===void 0||n.call(this),this.Gv=void 0}onRemoteConfig(e){if(!e.ok)return;const t=e.config;"autocaptureExceptions"in t&&(this.Qv=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[R0]:this.Qv}),this.Rr=this.Jv(),this.startIfEnabledOrStop())}onConfigChange(){this.Rr=this.Jv()}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 qc.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.Kv=[],this.Xv=new BT([new JT,new o6,new t6,new e6,new a6,new r6,new s6,new l6],(function(i,...a){return(c,u=0)=>{const h=[],f=c.split(`
|
|
68
|
+
`),m=Math.min(f.length,u+1e3),x=[];for(let y=u;m>y;y++){const _=f[y];if(_.length>1024)continue;const j=ew.test(_)?_.replace(ew,"$1"):_;if(!j.match(/\S*Error: /)){for(const N of a){const S=N(j,i);if(S){h.push(S);const C=QT(h);if(C){for(let E=x.length-1;E>=0;E--){const R=x[E];if(C.start>=R.start+R.length)break;x.pop()}x.push(C)}break}}if(KT(h,x)>=50)break}}const v=[...x].sort((y,_)=>_.start-y.start),b=v[v.length-1];if(b){const y=DS(h,b);h.splice(b.start-y,y);for(const _ of v)_.start-=y}for(const y of v)WT(h,y);return x.some(y=>y.start===0&&h.length===y.length)&&(function(y){const _=y.map(N=>`${N.function}|${N.filename}|${N.lineno}|${N.colno}|${N.module}`);let j=0;for(let N=1;_.length>N;N++)ZT(_,N,j)&&(j=N);y.push(...y.splice(0,j))})(h),(function(y){if(!y.length)return[];const _=Array.from(y);return _.reverse(),_.slice(0,50).map(j=>{return B(B({},j),{},{filename:j.filename||(N=_,N[N.length-1]||{}).filename,function:j.function||"?"});var N})})(h)}})("web:javascript",VT,XT)),this._instance=e,this.Kv=(t=(n=this._instance.persistence)===null||n===void 0?void 0:n.get_property("$error_tracking_suppression_rules"))!==null&&t!==void 0?t:[],this.Yv=Xh(this.tf()),this.ef=new u6(this.Yv)}onConfigChange(){this.Yv=Xh(this.tf()),this.ef.setConfig(this.Yv)}onRemoteConfig(e){var t,n,i;if(!e.ok)return;const a=e.config;if(!("errorTracking"in a))return;const c=(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.Kv=c,this._instance.persistence&&this._instance.persistence.register({[KS]:this.Kv,[O0]:u})}get if(){var e;const t=!!this._instance.get_property(O0),n=this._instance.config.error_tracking.captureExtensionExceptions;return(e=n??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.Xv.buildFromUnknown(e,{syntheticException:t==null?void 0:t.syntheticException,mechanism:{handled:t==null?void 0:t.handled}})}addExceptionStep(e,t){if(this.Yv.enabled)try{if(!Je(e)||e.trim().length===0)return void li.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 c=[];return{sanitizedProperties:Object.keys(a).reduce((u,h)=>c6.has(h)?(c.push(h),u):(u[h]=a[h],u),{}),droppedKeys:c}})(this.nf(t));i.length>0&&li.warn("Ignoring reserved exception step fields",{droppedKeys:i}),this.ef.add(B({[Gh]:e,[Yh]:new Date().toISOString()},n))}catch(n){li.error("Failed to add exception step. Ignoring breadcrumb.",n)}}sendExceptionEvent(e){try{const t=e.$exception_list;if(this.sf(t)){if(this.rf(t))return this.af("Exception dropped: matched a suppression rule"),void li.info("Skipping exception capture because a suppression rule matched");if(!this.if&&this.lf(t))return this.af("Exception dropped: thrown by a browser extension"),void li.info("Skipping exception capture because it was thrown by an extension");if(!this.if&&this.uf(t))return this.af("Exception dropped: thrown by an injected browser script"),void li.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.hf(t))return this.af("Exception dropped: thrown by the PostHog SDK"),void li.info("Skipping exception capture because it was thrown by the PostHog SDK")}const n=this.Yv.enabled&&Ve(e.$exception_steps)?this.cf(e):e,i=(function(){const a=globalThis._posthogReleaseId;return typeof a=="string"&&a.length>0?a:void 0})();i&&(n.$release_id=i);try{const a=this._instance.capture("$exception",n,{_noTruncate:!0,_batchKey:"exceptionEvent",fh:!0});return a&&this.ef.clear(),a}catch(a){return d5(a)||li.error("Failed to capture exception event. Dropping this exception.",a),void this.ef.clear()}}catch(t){return void(d5(t)||li.error("Failed to process exception event. Ignoring this exception.",t))}}cf(e){try{const t=this.ef.getAttachable();return t.length===0?e:B(B({},e),{},{$exception_steps:t})}catch(t){return li.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}af(e){this.Yv.enabled&&this.ef.add({[Gh]:e,[Yh]:new Date().toISOString()})}nf(e){return st(e)?B({},e):{}}tf(){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:{}}rf(e){if(e.length===0)return!1;try{const t=e.reduce((n,{type:i,value:a})=>(Je(i)&&i.length>0&&n.$exception_types.push(i),Je(a)&&a.length>0&&n.$exception_values.push(a),n),{$exception_types:[],$exception_values:[]});return this.Kv.some(n=>{const i=n.values.map(a=>{const c=ij[a.operator],u=t[a.key];if(!c||!u)return!1;const h=Ie(a.value)?a.value:[a.value];return h.length>0&&c(h,u)});return n.type==="OR"?i.some(Boolean):i.every(Boolean)})}catch(t){return li.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}lf(e){const t=e.flatMap(i=>{var a,c;return(a=(c=i.stacktrace)===null||c===void 0?void 0:c.frames)!==null&&a!==void 0?a:[]}),n=t.filter(({filename:i})=>!!i&&wM.some(a=>i.startsWith(a)));return n.length!==0&&(!n.every(({filename:i})=>!!i&&i.startsWith(W0))||e.some(({type:i,value:a})=>i==="NoResponse"||Je(a)&&_M.some(({value:c,exact:u})=>u?a===c:a.includes(c)))&&!t.some(({in_app:i,filename:a})=>i&&!(a!=null&&a.startsWith(W0))))}uf(e){return e.some(({value:t})=>Je(t)&&SM.some(n=>t.includes(n)))}hf(e){if(e.length>0){var t,n,i,a;const c=(t=(n=e[0].stacktrace)===null||n===void 0?void 0:n.frames)!==null&&t!==void 0?t:[],u=c[c.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}sf(e){return!Ve(e)&&Ie(e)}}},LM=B({productTours:class{get Ml(){return this._instance.persistence}constructor(e){this.df=null,this.vf=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({[Nx]:!!t.productTours}),!Fg(this._instance))return!this.df&&Ve((n=this.Ml)===null||n===void 0?void 0:n.props.ph_product_tours)||gh.info("product tours disabled; stopping and clearing cached tours"),(i=this.df)===null||i===void 0||i.stop(),this.df=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.df&&Fg(this._instance)&&this.zo(()=>this.ff())}zo(e){var t,n,i;!((t=$e.__PosthogExtensions__)===null||t===void 0)&&t.generateProductTours?e():(n=$e.__PosthogExtensions__)===null||n===void 0||(i=n.loadExternalDependency)===null||i===void 0||i.call(n,this._instance,"product-tours",a=>{a?gh.error("Could not load product tours script",a):e()})}ff(){var e;!this.df&&(!((e=$e.__PosthogExtensions__)===null||e===void 0)&&e.generateProductTours)&&(this.df=$e.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t=!1){if(Ie(this.vf)&&!t)return void e(this.vf,{isLoaded:!0});const n=this.Ml;if(n){const i=n.props[$0];if(Ie(i)&&!t)return this.vf=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(!Fg(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||gh.warn(u):gh.error(u),void e([],{isLoaded:!1,error:u})}const c=Ie(i.json.product_tours)?i.json.product_tours:[];this.vf=c,n&&n.register({[$0]:c}),e(c,{isLoaded:!0})}})}getActiveProductTours(e){Ve(this.df)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.df.getActiveProductTours(e)}showProductTour(e){var t;(t=this.df)===null||t===void 0||t.showTourById(e)}previewTour(e){this.df?this.df.previewTour(e):this.zo(()=>{var t;this.ff(),(t=this.df)===null||t===void 0||t.previewTour(e)})}dismissProductTour(){var e;(e=this.df)===null||e===void 0||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.df)===null||e===void 0||e.nextStep()}previousStep(){var e;(e=this.df)===null||e===void 0||e.previousStep()}clearCache(){var e;this.vf=null,(e=this.Ml)===null||e===void 0||e.unregister("ph_product_tours")}resetTour(e){var t;(t=this.df)===null||t===void 0||t.resetTour(e)}resetAllTours(){var e;(e=this.df)===null||e===void 0||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.df)===null||t===void 0||t.cancelPendingTour(e)}}},wf),DM={siteApps:class{constructor(e){this._instance=e,this.pf=0,this.gf=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}mf(e,t){if(!t)return;const n=this.globalsForEvent(t);this.gf.push(n),this.gf.length>1e3&&(this.gf=this.gf.slice(10))}get siteAppLoaders(){var e;return(e=$e._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.mf.bind(this));this.yf=()=>{e(),this.gf=[],this.yf=void 0}}}globalsForEvent(e){var t,n,i,a,c,u,h;if(!e)throw new Error("Event payload is required");const f={},m=this._instance.get_property("$groups")||[],x=this._instance.get_property("$stored_group_properties")||{};for(const[y,_]of Object.entries(x))f[y]={id:m[y],type:y,properties:_};const{$set_once:v,$set:b}=e;return{event:B(B({},PS(e,dM)),{},{properties:B(B(B({},e.properties),b?{$set:B(B({},(t=(n=e.properties)===null||n===void 0?void 0:n.$set)!==null&&t!==void 0?t:{}),b)}:{}),v?{$set_once:B(B({},(i=(a=e.properties)===null||a===void 0?void 0:a.$set_once)!==null&&i!==void 0?i:{}),v)}:{}),elements_chain:(c=(u=e.properties)===null||u===void 0?void 0:u.$elements_chain)!==null&&c!==void 0?c:"",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}}bf(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)||(Ci.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)||(Ci.error("prepare_external_dependency_script returned null"),null):e}_f(){var e,t,n,i,a,c,u,h;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};const f=he==null?void 0:he.defaultView,m=f==null||(e=f.Node)===null||e===void 0?void 0:e.prototype;if(!f||!m)return()=>{};if(this.pf++,this.wf)return this.kf();const x=[],v=this,b=new WeakSet,y=(N,S,C)=>{if(!(N!=null&&N[S]))return;const E=N[S];N[S]=C(E),x.push(()=>{N[S]=E})},_=N=>{if(b.has(N))return N;const S=v.bf(N);return S&&b.add(S),S},j=N=>N.map(S=>typeof S=="string"?S:_(S)).filter(S=>!Zt(S));return y(m,"appendChild",N=>function(S){const C=_(S);return C?N.call(this,C):S}),y(m,"insertBefore",N=>function(S,C){const E=_(S);return E?N.call(this,E,C):S}),y(m,"replaceChild",N=>function(S,C){const E=_(S);return E?N.call(this,E,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=>{y(N,"append",S=>function(...C){return S.apply(this,j(C))}),y(N,"prepend",S=>function(...C){return S.apply(this,j(C))})}),[(a=f.Element)===null||a===void 0?void 0:a.prototype,(c=f.CharacterData)===null||c===void 0?void 0:c.prototype,(u=f.DocumentType)===null||u===void 0?void 0:u.prototype].forEach(N=>{y(N,"before",S=>function(...C){return S.apply(this,j(C))}),y(N,"after",S=>function(...C){return S.apply(this,j(C))}),y(N,"replaceWith",S=>function(...C){const E=j(C);return C.length&&!E.length?void 0:S.apply(this,E)})}),y((h=f.Element)===null||h===void 0?void 0:h.prototype,"insertAdjacentElement",N=>function(S,C){const E=_(C);return E?N.call(this,S,E):null}),this.wf=()=>{x.forEach(N=>N()),this.wf=void 0},this.kf()}kf(){let e=!1;return()=>{var t;e||(e=!0,this.pf--,this.pf===0&&((t=this.wf)===null||t===void 0||t.call(this)))}}Sf(e,t=!0){const n=this._f();try{const i=e(n);return t&&n(),i}catch(i){throw n(),i}}setupSiteApp(e){const t=this.apps[e.id],n=()=>{var c;!t.errored&&this.gf.length&&(Ci.info(`Processing ${this.gf.length} events for site app with id ${e.id}`),this.gf.forEach(u=>this.Sf(()=>{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)&&((c=this.yf)===null||c===void 0||c.call(this))};let i=!1;const a=c=>{t.errored=!c,t.loaded=!0,Ci.info(`Site app with id ${e.id} ${c?"loaded":"errored"}`),i&&n()};try{const{processEvent:c}=this.Sf(u=>e.init({posthog:this._instance,callback(h){u(),a(h)}}),!1);c&&(t.processEvent=c),i=!0}catch(c){Ci.error(t5+e.id,c),a(!1)}if(i&&t.loaded)try{n()}catch(c){Ci.error(`Error while processing buffered events PostHog app with config id ${e.id}`,c),t.errored=!0}}xf(){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)}Cf(e){if(Object.keys(this.apps).length===0)return;const t=this.globalsForEvent(e);for(const n of Object.values(this.apps))try{this.Sf(()=>{var i;return(i=n.processEvent)===null||i===void 0?void 0:i.call(n,t)})}catch(i){Ci.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.xf(),void this._instance.on("eventCaptured",h=>this.Cf(h))):void Ci.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.yf)===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 c,u;$e[`__$$ph_site_app_${h}`]=this._instance,(c=$e.__PosthogExtensions__)===null||c===void 0||(u=c.loadSiteApp)===null||u===void 0||u.call(c,this._instance,f,m=>{if(m)return Ci.error(t5+h,m)})}else Ci.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},zM={tracingHeaders:class{constructor(e){this._instance=e,this.$f=void 0,this.Tf=void 0,this.If=void 0,this.Hv=()=>{const t=this.Mf();var n,i;t?(ue(this.$f)&&(this.$f=(n=$e.__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.Tf)&&(this.Tf=(i=$e.__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.Zv()}}initialize(){this.startIfEnabledOrStop()}zo(e){var t,n,i;!((t=$e.__PosthogExtensions__)===null||t===void 0)&&t.tracingHeadersPatchFns?e():(n=$e.__PosthogExtensions__)===null||n===void 0||(i=n.loadExternalDependency)===null||i===void 0||i.call(n,this._instance,"tracing-headers",a=>{if(a)return lM.error("failed to load script",a);e()})}Ef(){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}Mf(){const e=this.Ef();return Ie(e)?(Ie(this.If)?this.If.splice(0,this.If.length,...e):this.If=[...e],e.length>0?this.If:void 0):(Ie(this.If)&&this.If.splice(0),this.If=e||void 0,this.If)}Zv(){var e,t;(e=this.$f)===null||e===void 0||e.call(this),(t=this.Tf)===null||t===void 0||t.call(this),this.$f=void 0,this.Tf=void 0}startIfEnabledOrStop(){this.Mf()?this.zo(this.Hv):this.Zv()}}},$M=B({surveys:class extends hM{constructor(e){var t;super(new xM(e),(t=e,{get projectToken(){return t.config.token},kv:new gM(t)})),this._instance=e}qh(e,t){const n=t.query?Mu(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})})}}},wf),BM={toolbar:class{constructor(e){this.instance=e}Pf(e){$e.ph_toolbar_state=e}Rf(){var e;return(e=$e.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(P0(this.instance.config)||!te||!he)return!1;e=(i=e)!==null&&i!==void 0?i:te.location,n=(a=n)!==null&&a!==void 0?a:te.history;try{if(!t){try{te.localStorage.setItem("test","test"),te.localStorage.removeItem("test")}catch{return!1}t=te==null?void 0:te.localStorage}const c=vM||nf(e.hash,"__posthog")||nf(e.hash,"state");let u;const h=c?W_(()=>JSON.parse(atob(decodeURIComponent(c))))||W_(()=>JSON.parse(decodeURIComponent(c))):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(s5)||"{}"),u.source="localstorage",delete u.userIntent),!(!u.token||this.instance.config.token!==u.token||(this.loadToolbar(u),0))}catch{return!1}}Af(e){const t=$e.ph_load_toolbar||$e.ph_load_editor;!Ve(t)&&kn(t)?t(e,this.instance):i5.warn("No toolbar load function found")}loadToolbar(e){const t=!!(he!=null&&he.getElementById("__POSTHOG_TOOLBAR__"));if(!te||t)return!1;const n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,i=B(B({token:this.instance.config.token},e),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(te.localStorage.setItem(s5,JSON.stringify(B(B({},i),{},{source:void 0}))),this.Rf()===2)this.Af(i);else if(this.Rf()===0){var a,c;this.Pf(1),(a=$e.__PosthogExtensions__)===null||a===void 0||(c=a.loadExternalDependency)===null||c===void 0||c.call(a,this.instance,"toolbar",u=>{if(u)return i5.error("[Toolbar] Failed to load",u),void this.Pf(0);this.Pf(2),this.Af(i)}),yt(te,"turbolinks:load",()=>{this.Pf(0),this.loadToolbar(i)})}return!0}Ff(e){return this.loadToolbar(e)}maybeLoadEditor(e=void 0,t=void 0,n=void 0){return this.maybeLoadToolbar(e,t,n)}}},PM=B({experiments:class Jn{get Rr(){return this._instance.config}constructor(t){this._instance=t,this.getWebExperimentsAndEvaluateDisplayLogic=(n=!1)=>{this.getWebExperiments(i=>{Jn.Of("retrieved web experiments from the server"),this.Df=new Map,i.forEach(a=>{if(a.feature_flag_key){var c;this.Df&&(Jn.Of("setting flag key ",a.feature_flag_key," to web experiment ",a),(c=this.Df)===null||c===void 0||c.set(a.feature_flag_key,a));const u=this._instance.getFeatureFlag(a.feature_flag_key);Je(u)&&a.variants[u]&&this.Lf(a.name,u,a.variants[u].transforms)}else if(a.variants)for(const u in a.variants){const h=a.variants[u];Jn.Nf(h,this._instance)&&this.Lf(a.name,u,h.transforms)}})},n)},this._instance.onFeatureFlags(n=>{this.onFeatureFlags(n)})}initialize(){}onFeatureFlags(t){if(this._is_bot())Jn.Of(h5);else if(!this.Rr.disable_web_experiments){if(Ve(this.Df))return this.Df=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Jn.Of("applying feature flags",t),t.forEach(n=>{var i;if(this.Df&&(!((i=this.Df)===null||i===void 0)&&i.has(n))){var a;const c=this._instance.getFeatureFlag(n),u=(a=this.Df)===null||a===void 0?void 0:a.get(n);c&&(u!=null&&u.variants[c])&&this.Lf(u.name,c,u.variants[c].transforms)}})}}previewWebExperiment(){const t=Jn.getWindowLocation();if(t!=null&&t.search){const n=_o(t==null?void 0:t.search,"__experiment_id"),i=_o(t==null?void 0:t.search,"__experiment_variant");n&&i&&(Jn.Of(`previewing web experiments ${n} && ${i}`),this.getWebExperiments(a=>{this.qf(parseInt(n),i,a)},!1,!0))}}loadIfEnabled(){this.Rr.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,n,i){if(this.Rr.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.Rr.token}`),method:"GET",timestampMode:"query",callback:c=>t(c.statusCode===200&&c.json&&c.json.experiments||[])})}qf(t,n,i){const a=i.filter(c=>c.id===t);a&&a.length>0&&(Jn.Of(`Previewing web experiment [${a[0].name}] with variant [${n}]`),this.Lf(a[0].name,n,a[0].variants[n].transforms))}static Nf(t,n){return!Ve(t.conditions)&&Jn.jf(t,n)&&Jn.Bf(t)}static jf(t,n){var i;if(Ve(t.conditions)||Ve((i=t.conditions)===null||i===void 0?void 0:i.url))return!0;const a=Jn.getWindowLocation();if(a){var c,u,h;const f=xk(n,a.href);return!(!((c=t.conditions)===null||c===void 0)&&c.url)||kM[(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 te==null?void 0:te.location}static Bf(t){var n;if(Ve(t.conditions)||Ve((n=t.conditions)===null||n===void 0?void 0:n.utm))return!0;const i=Tk();if(i.utm_source){var a,c,u,h,f,m,x,v;const b=!(!((a=t.conditions)===null||a===void 0||(a=a.utm)===null||a===void 0)&&a.utm_campaign)||((c=t.conditions)===null||c===void 0||(c=c.utm)===null||c===void 0?void 0:c.utm_campaign)==i.utm_campaign,y=!(!((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)||((m=t.conditions)===null||m===void 0||(m=m.utm)===null||m===void 0?void 0:m.utm_medium)==i.utm_medium,j=!(!((x=t.conditions)===null||x===void 0||(x=x.utm)===null||x===void 0)&&x.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 b&&_&&j&&y}return!1}static Of(t,...n){ye.info(`[WebExperiments] ${t}`,n)}Lf(t,n,i){this._is_bot()?Jn.Of(h5):n!=="control"?i.forEach(a=>{if(a.selector){var c;Jn.Of(`applying transform of variant ${n} for experiment ${t} `,a);const u=(c=document)===null||c===void 0?void 0:c.querySelectorAll(a.selector);u==null||u.forEach(h=>{const f=h;a.html&&(f.innerHTML=a.html),a.css&&f.setAttribute("style",a.css)})}}):Jn.Of("Control variants leave the page unmodified.")}_is_bot(){return jn&&this._instance?tj(jn,this.Rr.custom_blocked_useragents):void 0}}},wf),IM={conversations:class{constructor(e){this._instance=e,this.Hf=void 0,this._conversationsManager=null,this.zf=!1,this.ne=null,this.Uf=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(this._instance.config.disable_conversations||(this.Wf=e.ok,!e.ok))return;const t=e.config.conversations;Ve(t)||(ns(t)?this.Hf=t:(this.Hf=t.enabled,this.ne=t),this.loadIfEnabled())}reset(){var e;(e=this._conversationsManager)===null||e===void 0||e.reset(),this._conversationsManager=null,this.Hf=void 0,this.ne=null,this.Wf=void 0,this.Uf=!1}loadIfEnabled(){if(this._conversationsManager||this.zf||this._instance.config.disable_conversations||P0(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const e=$e==null?void 0:$e.__PosthogExtensions__;if(e&&!ue(this.Hf)&&this.Hf)if(this.ne&&this.ne.token){this.zf=!0;try{const t=e.initConversations;if(t)return this.Vf(t),void(this.zf=!1);const n=e.loadExternalDependency;if(!n)return void this.Gf(Ex);n(this._instance,"conversations",i=>{i||!e.initConversations?this.Gf("Could not load conversations script",i):this.Vf(e.initConversations),this.zf=!1})}catch(t){this.Gf("Error initializing conversations",t),this.zf=!1}}else qs.error("Conversations enabled but missing token in remote config.")}Vf(e){if(this.ne)try{this._conversationsManager=e(this.ne,this._instance),this.Uf=!1,qs.info("Conversations loaded successfully")}catch(t){this.Gf("Error completing conversations initialization",t)}else qs.error("Cannot complete initialization: remote config is null")}Gf(e,t){qs.error(e,t),this._conversationsManager=null,this.zf=!1,this.Uf=!0}show(){this._conversationsManager?this._conversationsManager.show():qs.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Hf===!0&&!Zt(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":P0(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":this.Wf===!1?"remote_config_failed":ue(this.Hf)?this.Wf?"disabled_in_project":"remote_config_pending":this.Hf?Ve(this.ne)||!this.ne.token?"missing_token":$e!=null&&$e.__PosthogExtensions__?this.zf?"initializing":this.Uf?"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 Bt(function*(){return i._conversationsManager?i._conversationsManager.sendMessage(e,t,n):(qs.warn(Ya),null)})()}getMessages(e,t){var n=this;return Bt(function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(qs.warn(Ya),null)})()}markAsRead(e){var t=this;return Bt(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(qs.warn(Ya),null)})()}getTickets(e){var t=this;return Bt(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(qs.warn(Ya),null)})()}requestRestoreLink(e){var t=this;return Bt(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(qs.warn(Ya),null)})()}restoreFromToken(e){var t=this;return Bt(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(qs.warn(Ya),null)})()}restoreFromUrlToken(){var e=this;return Bt(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(qs.warn(Ya),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}Sh(){var e;(e=this._conversationsManager)===null||e===void 0||e.setIdentity()}xh(){var e;(e=this._conversationsManager)===null||e===void 0||e.clearIdentity()}}},FM={logs:class{constructor(e){var t;this._instance=e,this.name="logs",this.Zf=!1,this.Qf=!1,this.Jf=!1,this.$=Qt("[logs]"),this.Kf=B(B({},this.$),{},{error:(...n)=>{n.some(m5)||this.$.error(...n)}}),this.al=[],this.Xf=[],this.hd=0,this.Io=!1,this.Yf=[],this.tp=[],this.ep=!1,this.np=!1,this.sp=()=>{var n,i;this.Io||(this.hd=0,(n=this.rp)===null||n===void 0||n.onReconnect(),(i=this.op)===null||i===void 0||i.onReconnect())},this._instance&&(!((t=this._instance.config.logs)===null||t===void 0)&&t.captureConsoleLogs)&&(this.Zf=!0),te&&yt(te,"online",this.sp)}ap(e,t,n,i){var a;const c=f5((a=this._instance)===null||a===void 0||(a=a.config)===null||a===void 0?void 0:a.logs,n);return[new y6(this.lp(e,t),c,this.Kf,()=>this.up(),u=>u(),void 0,i),c]}hp(){var e;const t=(e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.logs;var n;return this.rp&&this.cp===t||((n=this.rp)===null||n===void 0||n.reset(),this.cp=t,[this.rp,this.dp]=this.ap(()=>this.al,i=>{this.al=i})),this.rp}vp(){var e;const t=(e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.logs;var n;return this.op&&this.fp===t||((n=this.op)===null||n===void 0||n.reset(),this.fp=t,[this.op,this.pp]=this.ap(()=>this.Xf,i=>{this.Xf=i},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},p5)),this.op}setup(e){var t;if(this.Io)return;this.wo=e,!((t=this._instance)===null||t===void 0||(t=t.config)===null||t===void 0||(t=t.logs)===null||t===void 0)&&t.captureConsoleLogs&&(this.Zf=!0),(this.Zf||this.gp()&&this.mp())&&this.yp();let n=!1;const i=e.onRemoteConfig(a=>{var c;n=a.ok&&((c=a.config.logs)===null||c===void 0?void 0:c.captureConsoleLogs)===!0,this.onRemoteConfig(a)});this.Io?i.dispose():(this.Po=i,n||this.loadIfEnabled())}dispose(){var e,t,n,i;this.Io||(this.Io=!0,this.bp(),(e=this.Po)===null||e===void 0||e.dispose(),this.Po=void 0,this.wo=void 0,this.Jf=!1,te==null||te.removeEventListener("online",this.sp),(t=this._p)===null||t===void 0||t.call(this),this._p=void 0,(n=this.rp)===null||n===void 0||n.reset(),(i=this.op)===null||i===void 0||i.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;Ve(i)?this.wp():((n=this._instance)===null||n===void 0||(n=n.persistence)===null||n===void 0||n.register({$logs_capture_enabled_server_side:!!i}),i?(this.Zf=!0,this.Qf||this.yp(),this.loadIfEnabled()):this.wp())}reset(){var e,t,n,i;this.bp(),(e=this.rp)===null||e===void 0||e.clearQueue(),this.al=[],(t=this.rp)===null||t===void 0||t.reset(),(n=this.op)===null||n===void 0||n.clearQueue(),this.Xf=[],(i=this.op)===null||i===void 0||i.reset(),this.hd=0}captureLog(e){this.Io||this.hp().captureLog(e)}captureConsoleLog(e){this.Io||this.vp().captureLog(e)}captureBufferedConsoleLog(e,t,n){this.Io||this.vp().captureLog(e,{context:t,occurredAtMs:n})}mp(){var e;return!!(!((e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||(e=e.props)===null||e===void 0)&&e[ZS])}gp(){var e,t,n;return!(!((e=this._instance)===null||e===void 0||(t=e.nl)===null||t===void 0)&&t.call(e))||!!(!((n=$e._POSTHOG_REMOTE_CONFIG)===null||n===void 0||(n=n[this._instance.config.token])===null||n===void 0)&&n.config)}$h(){var e;this.bp(),(e=this.op)===null||e===void 0||e.clearQueue(),this.Xf=[]}wp(){this.Zf||this.bp()}yp(){var e;if(this.ep||!($e!=null&&$e.console))return;const t=f5((e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.logs).maxBufferSize;let n=!0;this.tp.push(()=>{n=!1});for(const i of jM){let a;try{a=NM($e.console[i])}catch{continue}a&&this.tp.push(ju($e.console,i,c=>{const u=(...h)=>{try{n&&this.kp(i,h,t)}catch{}return c.apply($e.console,h)};return u.__rrweb_original__=a,u}))}this.ep=!0,this.Sp=setTimeout(()=>{this.bp()},3e4)}kp(e,t,n){var i;if(this.ep&&!this.np&&t.length!==0)if(!((i=this._instance)===null||i===void 0)&&i.is_capturing()){if(n>this.Yf.length){this.np=!0;try{this.Yf.push({level:e,args:t,occurredAtMs:Date.now(),context:this.up()})}finally{this.np=!1}}}else this.bp()}bp(){if(this.Yf=[],this.ep){this.ep=!1,this.Sp&&(clearTimeout(this.Sp),this.Sp=void 0);for(const e of this.tp)e();this.tp=[]}}xp(){const e=this.Yf;return this.bp(),e}get logger(){return this.Cp||(this.Cp={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.Cp}flushLogs(e){e?this.$p(e):(this.rp&&this.rp.flush().catch(t=>this.Tp(t)),this.op&&this.op.flush().catch(t=>this.Tp(t)))}Tp(e){m5(e)||this.$.error("PostHog logs flush failed:",e)}loadIfEnabled(){if(this.Io||!this.Zf||this.Qf||this.Jf)return;const e=$e==null?void 0:$e.__PosthogExtensions__;if(!e)return this.$.error("PostHog Extensions not found."),void this.bp();const t=e.loadExternalDependency;if(!t)return this.$.error(Ex),void this.bp();this.Jf=!0;try{t(this._instance,"logs",n=>{if(this.Jf=!1,this.Io||!this.Zf)return;const i=e.logs;if(n||!(i!=null&&i.initializeLogs))this.$.error("Could not load logs script",n),this.bp();else{var a;const h=this.xp();var c,u;this._p=i.initializeLogs((a=this.wo)!==null&&a!==void 0?a:this._instance),this.Qf=!0,h.length>0&&((c=i.replayConsoleBuffer)===null||c===void 0||c.call(i,(u=this.wo)!==null&&u!==void 0?u:this._instance,h))}})}catch(n){throw this.Jf=!1,n}}lp(e,t){const n=this._instance;return{get isDisabled(){return!1},get optedOut(){return!n.is_capturing()},getPersistedProperty:i=>i===Ai.LogsQueue?e():void 0,setPersistedProperty(i,a){var c;i===Ai.LogsQueue&&t((c=a)!==null&&c!==void 0?c:[])},js:i=>this.js(i),getLibraryId:()=>yn.LIB_NAME,getLibraryVersion:()=>yn.LIB_VERSION}}js(e){return new Promise(t=>{if(Ck(this.hd,3))return void t({kind:"fatal",error:Hg(void 0,"logs endpoint is unreachable, dropping batch")});let n=!1;const i=c=>{n||(n=!0,clearTimeout(a),t(c))},a=setTimeout(()=>{this.$.warn("Logs request timed out before receiving a response"),i({kind:"retry-later",error:Hg(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this.Ip(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:c=>{const u=c.statusCode;if(this.Mp(u),u>=200&&300>u)i({kind:"ok"});else if(u===413)i({kind:"too-large"});else if(u!==0&&u!==408&&u!==429&&500>u)i({kind:"fatal",error:new Error(`logs request failed with status ${u}`)});else{var h;u===0?(c.error||this.$.warn("Logs request failed before receiving an HTTP response"),i({kind:"retry-later",error:Hg(c.error,"logs request failed before receiving an HTTP response")})):i({kind:"retry-later",error:(h=c.error)!==null&&h!==void 0?h:new Error(`logs request failed with status ${u}`)})}}})})}Mp(e){(e!==0||this._instance.__loaded)&&(this.hd=Ek(e,this.hd,3,()=>this.$.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.")))}$p(e){this.al.length>0&&this.Ep(e,this.al,this.dp,yn.LIB_NAME,t=>{this.al=t}),this.Xf.length>0&&this.Ep(e,this.Xf,this.pp,p5,t=>{this.Xf=t})}Ep(e,t,n,i,a){if(t.length===0)return;const c=t.map(h=>h.record);a([]);const u=VS(c,qS(n,yn.LIB_NAME,yn.LIB_VERSION),i,yn.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Ip(),data:u,compression:"best-available",batchKey:"logs",transport:e})}Ip(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}up(){var e;const t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){const{sessionId:n,windowId:i,sessionStartTimestamp:a,lastActivityTimestamp:c}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=n,t.windowId=i,Ve(a)||(t.sessionStartTimestamp=a),Ve(c)||(t.lastActivityTimestamp=c)}if(!($e==null||(e=$e.location)===null||e===void 0)&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?ca($e.location.href):$e.location.href),this._instance.featureFlags){const n=this._instance.featureFlags.getFlags();n&&n.length>0&&(t.activeFeatureFlags=n)}return t}}},UM={metrics:class{constructor(e){this._instance=e,this.$=Qt("[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.Pp?this.Pp=(n=>{let i=!0;const a=()=>i?(h=>{var f;const m=(f=h.config.metrics)===null||f===void 0?void 0:f.network;return m===!0?{}:m||void 0})(n):void 0,c=TM(n,a),u=AM(n,a);return()=>{i=!1,c(),u()}})(this._instance):!t&&this.Pp&&(this.Pp(),this.Pp=void 0)}hp(){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.rp&&this.cp===t||((n=this.rp)===null||n===void 0||n.reset(),this.cp=t,this.rp=new _6(this.lp(),(function(i){var a,c,u,h,f;const m=i==null?void 0:i.resourceAttributes;return{serviceName:(a=m==null?void 0:m["service.name"])!==null&&a!==void 0?a:i==null?void 0:i.serviceName,serviceVersion:(c=m==null?void 0:m["service.version"])!==null&&c!==void 0?c:i==null?void 0:i.serviceVersion,environment:(u=m==null?void 0:m["deployment.environment"])!==null&&u!==void 0?u:i==null?void 0:i.environment,resourceAttributes:m,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.$)),this.rp}count(e,t=1,n){this.hp().count(e,t,n)}gauge(e,t,n){this.hp().gauge(e,t,n)}histogram(e,t,n){this.hp().histogram(e,t,n)}flush(e){if(!this.rp)return Promise.resolve();if(e){const t=this.rp.drainWindow();return t&&this.Ys(t,e),Promise.resolve()}return this.rp.flush().catch(t=>this.$.error("PostHog metrics flush failed:",t))}reset(){var e;(e=this.rp)===null||e===void 0||e.reset()}dispose(){var e,t;this.Io=!0,(e=this.Pp)===null||e===void 0||e.call(this),this.Pp=void 0,(t=this.rp)===null||t===void 0||t.reset()}lp(){const e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},Ys:n=>t.Ys(n),getLibraryId:()=>yn.LIB_NAME,getLibraryVersion:()=>yn.LIB_VERSION}}Ys(e,t){return new Promise(n=>{let i=!1;const a=u=>{i||(i=!0,clearTimeout(c),n(u))},c=setTimeout(()=>a({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(B(B({method:"POST",url:this.Rp(),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}`)})}}}))})}Rp(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}};du.__defaultExtensionClasses=B({},B(B(B(B(B(B(B(B(B(B(B(B(B({},wf),MM),RM),OM),LM),DM),$M),zM),BM),PM),IM),FM),UM));const HM=(function(){yn.SDK_DIST_CHANNEL="npm";const e=cu[Kc]=new du;return(function(){function t(){t.done||(t.done=!0,Jk=!1,jt(cu,function(n){n._dom_loaded()}))}he!=null&&he.addEventListener?he.readyState==="complete"?t():yt(he,"DOMContentLoaded",t,{capture:!1}):te&&ye.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),e})();var Nu=HM;const qM="https://us.i.posthog.com",fj="cc-telemetry-enabled";let Z0=!1,Cu=!1;function VM(){return qM}function GM(){if(typeof localStorage>"u")return!0;const e=localStorage.getItem(fj);return e===null?!0:e==="true"}function pj(e){Z0&&(e?(Nu.opt_in_capturing({captureEventName:null}),Cu=!0):(Nu.opt_out_capturing(),Cu=!1))}function tP(e){typeof localStorage<"u"&&localStorage.setItem(fj,String(e)),pj(e)}function YM(){const e=void 0;return e?(Nu.init(e,{api_host:VM(),defaults:"2026-01-30",capture_pageview:!1,capture_pageleave:!0,capture_exceptions:!0,autocapture:!0,respect_dnt:!0}),Z0=!0,pj(GM()),!0):(Z0=!1,Cu=!1,!1)}function Bx(e,t){Cu&&Nu.capture(e,t)}function da(e,t){Cu&&Nu.captureException(e,t)}function XM(e){Bx("$pageview",{$current_url:e})}const Di="/api",mj="companion_auth_token";function ha(){if(typeof window>"u")return{};const e=localStorage.getItem(mj);return e?{Authorization:`Bearer ${e}`}:{}}function rl(e){e===401&&typeof window<"u"&&(localStorage.removeItem(mj),Vn(async()=>{const{useStore:t}=await Promise.resolve().then(()=>c4);return{useStore:t}},void 0).then(({useStore:t})=>{t.getState().logout()}).catch(()=>{}))}function _n(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}function Ru(e,t,n,i){Bx("api_request_succeeded",{method:e,path:t,status:i,duration_ms:Math.round(n)})}function zi(e,t,n,i,a){Bx("api_request_failed",{method:e,path:t,status:a,duration_ms:Math.round(n),error:i instanceof Error?i.message:String(i)}),da(i,{method:e,path:t,status:a})}async function He(e,t){const n=_n();let i=!1;try{const a=await fetch(`${Di}${e}`,{method:"POST",headers:{"Content-Type":"application/json",...ha()},body:t?JSON.stringify(t):void 0});if(!a.ok){rl(a.status);const c=await a.json().catch(()=>({error:a.statusText})),u=new Error(c.error||a.statusText);throw zi("POST",e,_n()-n,u,a.status),i=!0,u}return Ru("POST",e,_n()-n,a.status),a.json()}catch(a){throw i||zi("POST",e,_n()-n,a),a}}async function ze(e){const t=_n();let n=!1;try{const i=await fetch(`${Di}${e}`,{headers:{...ha()}});if(!i.ok){rl(i.status);const a=await i.json().catch(()=>({error:i.statusText})),c=new Error(a.error||i.statusText);throw zi("GET",e,_n()-t,c,i.status),n=!0,c}return Ru("GET",e,_n()-t,i.status),i.json()}catch(i){throw n||zi("GET",e,_n()-t,i),i}}async function Vs(e,t){const n=_n();let i=!1;try{const a=await fetch(`${Di}${e}`,{method:"PUT",headers:{"Content-Type":"application/json",...ha()},body:t?JSON.stringify(t):void 0});if(!a.ok){rl(a.status);const c=await a.json().catch(()=>({error:a.statusText})),u=new Error(c.error||a.statusText);throw zi("PUT",e,_n()-n,u,a.status),i=!0,u}return Ru("PUT",e,_n()-n,a.status),a.json()}catch(a){throw i||zi("PUT",e,_n()-n,a),a}}async function QM(e,t){const n=_n();let i=!1;try{const a=await fetch(`${Di}${e}`,{method:"PATCH",headers:{"Content-Type":"application/json",...ha()},body:t?JSON.stringify(t):void 0});if(!a.ok){rl(a.status);const c=await a.json().catch(()=>({error:a.statusText})),u=new Error(c.error||a.statusText);throw zi("PATCH",e,_n()-n,u,a.status),i=!0,u}return Ru("PATCH",e,_n()-n,a.status),a.json()}catch(a){throw i||zi("PATCH",e,_n()-n,a),a}}async function Gs(e,t){const n=_n();let i=!1;try{const a=await fetch(`${Di}${e}`,{method:"DELETE",headers:{...t?{"Content-Type":"application/json"}:{},...ha()},body:t?JSON.stringify(t):void 0});if(!a.ok){rl(a.status);const c=await a.json().catch(()=>({error:a.statusText})),u=new Error(c.error||a.statusText);throw zi("DELETE",e,_n()-n,u,a.status),i=!0,u}return Ru("DELETE",e,_n()-n,a.status),a.json()}catch(a){throw i||zi("DELETE",e,_n()-n,a),a}}async function WM(e,t){const n=await fetch(`${Di}/sessions/create-stream`,{method:"POST",headers:{"Content-Type":"application/json",...ha()},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 c="",u=null;for(;;){const{done:h,value:f}=await i.read();if(h)break;c+=a.decode(f,{stream:!0});const m=c.split(`
|
|
69
|
+
|
|
70
|
+
`);c=m.pop()||"";for(const x of m){if(!x.trim())continue;let v="",b="";for(const _ of x.split(`
|
|
71
|
+
`))_.startsWith("event:")?v=_.slice(6).trim():_.startsWith("data:")&&(b=_.slice(5).trim());if(!b)continue;const y=JSON.parse(b);if(v==="progress")t(y);else if(v==="done")u=y;else if(v==="error")throw new Error(y.error||"Session creation failed")}}if(!u)throw new Error("Stream ended without session creation result");return u}async function KM(){try{const e=await fetch(`${Di}/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 g5(e){try{const t=await fetch(`${Di}/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 ke={getAuthQr:()=>ze("/auth/qr"),getAuthToken:()=>ze("/auth/token"),regenerateAuthToken:()=>He("/auth/regenerate"),createSession:e=>He("/sessions/create",e),listSessions:()=>ze("/sessions"),discoverClaudeSessions:(e=200)=>ze(`/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 ze(`/claude/sessions/${encodeURIComponent(e)}/history?cursor=${encodeURIComponent(String(n))}&limit=${encodeURIComponent(String(i))}`)},killSession:e=>He(`/sessions/${encodeURIComponent(e)}/kill`),deleteSession:e=>Gs(`/sessions/${encodeURIComponent(e)}`),relaunchSession:e=>He(`/sessions/${encodeURIComponent(e)}/relaunch`),exportSession:async(e,t)=>{const n=await fetch(`${Di}/sessions/${encodeURIComponent(e)}/export?format=${t}`,{headers:{...ha()}});if(!n.ok)throw rl(n.status),new Error(`Export failed (${n.status})`);const i=await n.blob(),c=(n.headers.get("Content-Disposition")||"").match(/filename="?([^"]+)"?/),u=(c==null?void 0:c[1])||`session.${t}`;return{blob:i,filename:u}},archiveSession:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/archive`,t),getArchiveInfo:e=>ze(`/sessions/${encodeURIComponent(e)}/archive-info`),unarchiveSession:e=>He(`/sessions/${encodeURIComponent(e)}/unarchive`),renameSession:(e,t)=>QM(`/sessions/${encodeURIComponent(e)}/name`,{name:t}),listDirs:e=>ze(`/fs/list${e?`?path=${encodeURIComponent(e)}`:""}`),getHome:()=>ze("/fs/home"),listEnvs:()=>ze("/envs"),getEnv:e=>ze(`/envs/${encodeURIComponent(e)}`),createEnv:(e,t)=>He("/envs",{name:e,variables:t}),updateEnv:(e,t)=>Vs(`/envs/${encodeURIComponent(e)}`,t),deleteEnv:e=>Gs(`/envs/${encodeURIComponent(e)}`),listSandboxes:()=>ze("/sandboxes"),getSandbox:e=>ze(`/sandboxes/${encodeURIComponent(e)}`),createSandbox:(e,t)=>He("/sandboxes",{name:e,...t}),updateSandbox:(e,t)=>Vs(`/sandboxes/${encodeURIComponent(e)}`,t),deleteSandbox:e=>Gs(`/sandboxes/${encodeURIComponent(e)}`),testInitScript:(e,t,n)=>He(`/sandboxes/${encodeURIComponent(e)}/test-init`,{cwd:t,initScript:n}),buildBaseImage:()=>He("/docker/build-base"),getBaseImageStatus:()=>ze("/docker/base-image"),getSettings:()=>ze("/settings"),updateSettings:e=>Vs("/settings",e),verifyAnthropicKey:e=>He("/settings/anthropic/verify",{apiKey:e}),getCodexAccount:()=>ze("/codex/auth/account"),getCodexLoginStatus:()=>ze("/codex/auth/login"),startCodexLogin:()=>He("/codex/auth/login"),cancelCodexLogin:()=>He("/codex/auth/login/cancel"),codexLogout:()=>He("/codex/auth/logout"),getDashboard:()=>ze("/dashboard"),runDashboardUpdate:()=>He("/dashboard/run"),getDashboardRunStatus:()=>ze("/dashboard/run/status"),getTailscaleStatus:()=>ze("/tailscale/status"),startTailscaleFunnel:()=>He("/tailscale/funnel/start"),stopTailscaleFunnel:()=>He("/tailscale/funnel/stop"),listLinearConnections:()=>ze("/linear/connections"),createLinearConnection:e=>He("/linear/connections",e),updateLinearConnection:(e,t)=>Vs(`/linear/connections/${encodeURIComponent(e)}`,t),deleteLinearConnection:e=>Gs(`/linear/connections/${encodeURIComponent(e)}`),verifyLinearConnection:e=>He(`/linear/connections/${encodeURIComponent(e)}/verify`,{}),searchLinearIssues:(e,t=8,n)=>ze(`/linear/issues?query=${encodeURIComponent(e)}&limit=${encodeURIComponent(String(t))}${n?`&connectionId=${encodeURIComponent(n)}`:""}`),getLinearConnection:e=>ze(`/linear/connection${e?`?connectionId=${encodeURIComponent(e)}`:""}`),getLinearStates:e=>ze(`/linear/states${e?`?connectionId=${encodeURIComponent(e)}`:""}`),transitionLinearIssue:(e,t)=>He(`/linear/issues/${encodeURIComponent(e)}/transition${t?`?connectionId=${encodeURIComponent(t)}`:""}`,{}),listLinearProjects:e=>ze(`/linear/projects${e?`?connectionId=${encodeURIComponent(e)}`:""}`),getLinearProjectIssues:(e,t=15,n)=>ze(`/linear/project-issues?projectId=${encodeURIComponent(e)}&limit=${encodeURIComponent(String(t))}${n?`&connectionId=${encodeURIComponent(n)}`:""}`),getLinearProjectMapping:e=>ze(`/linear/project-mappings?repoRoot=${encodeURIComponent(e)}`),upsertLinearProjectMapping:e=>Vs("/linear/project-mappings",e),removeLinearProjectMapping:e=>Gs("/linear/project-mappings",{repoRoot:e}),linkLinearIssue:(e,t,n)=>Vs(`/sessions/${encodeURIComponent(e)}/linear-issue`,{...t,...n!==void 0?{connectionId:n}:{}}),unlinkLinearIssue:e=>Gs(`/sessions/${encodeURIComponent(e)}/linear-issue`),getLinkedLinearIssue:(e,t=!1)=>ze(`/sessions/${encodeURIComponent(e)}/linear-issue${t?"?refresh=true":""}`),createLinearIssue:e=>He("/linear/issues",e),addLinearComment:(e,t,n)=>He(`/linear/issues/${encodeURIComponent(e)}/comments`,{body:t,connectionId:n}),getRepoInfo:e=>ze(`/git/repo-info?path=${encodeURIComponent(e)}`),listBranches:e=>ze(`/git/branches?repoRoot=${encodeURIComponent(e)}`),gitFetch:e=>He("/git/fetch",{repoRoot:e}),gitPull:e=>He("/git/pull",{cwd:e}),listWorktrees:e=>ze(`/git/worktrees?repoRoot=${encodeURIComponent(e)}`),createWorktree:(e,t,n)=>He("/git/worktree",{repoRoot:e,branch:t,...n}),removeWorktree:(e,t,n)=>Gs("/git/worktree",{repoRoot:e,worktreePath:t,force:n}),getPRStatus:(e,t)=>ze(`/git/pr-status?cwd=${encodeURIComponent(e)}&branch=${encodeURIComponent(t)}`),getBackends:()=>ze("/backends"),getBackendModels:e=>ze(`/backends/${encodeURIComponent(e)}/models`),getContainerStatus:()=>ze("/containers/status"),getContainerImages:()=>ze("/containers/images"),getImageStatus:e=>ze(`/images/${encodeURIComponent(e)}/status`),pullImage:e=>He(`/images/${encodeURIComponent(e)}/pull`),getCloudProviderPlan:(e,t,n)=>ze(`/cloud/providers/${encodeURIComponent(e)}/plan?cwd=${encodeURIComponent(t)}&sessionId=${encodeURIComponent(n)}`),startEditor:e=>He(`/sessions/${encodeURIComponent(e)}/editor/start`),startBrowser:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/browser/start`,t?{url:t}:void 0),navigateBrowser:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/browser/navigate`,{url:t}),getFileTree:e=>ze(`/fs/tree?path=${encodeURIComponent(e)}`),readFile:e=>ze(`/fs/read?path=${encodeURIComponent(e)}`),getFileBlob:async e=>{const t=await fetch(`${Di}/fs/raw?path=${encodeURIComponent(e)}`,{headers:{...ha()}});if(!t.ok){rl(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)=>Vs("/fs/write",{path:e,content:t}),getFileDiff:(e,t)=>ze(`/fs/diff?path=${encodeURIComponent(e)}${t?`&base=${encodeURIComponent(t)}`:""}`),getChangedFiles:(e,t)=>ze(`/fs/changed-files?cwd=${encodeURIComponent(e)}${t?`&base=${encodeURIComponent(t)}`:""}`),getClaudeMdFiles:e=>ze(`/fs/claude-md?cwd=${encodeURIComponent(e)}`),saveClaudeMd:(e,t)=>Vs("/fs/claude-md",{path:e,content:t}),getClaudeConfig:e=>ze(`/fs/claude-config?cwd=${encodeURIComponent(e)}`),getUsageLimits:()=>ze("/usage-limits"),getSessionUsageLimits:e=>ze(`/sessions/${encodeURIComponent(e)}/usage-limits`),getSystemMemory:()=>ze("/system/memory"),getSystemDisk:()=>ze("/system/disk"),spawnTerminal:(e,t,n,i)=>He("/terminal/spawn",{cwd:e,cols:t,rows:n,containerId:i==null?void 0:i.containerId}),killTerminal:e=>He("/terminal/kill",{terminalId:e}),getTerminal:e=>ze(e?`/terminal?terminalId=${encodeURIComponent(e)}`:"/terminal"),checkForUpdate:()=>ze("/update-check"),forceCheckForUpdate:()=>He("/update-check"),triggerUpdate:()=>He("/update"),getClaudeCompat:()=>ze("/claude-compat"),refreshClaudeCompat:()=>He("/claude-compat/refresh"),pinClaudeVersion:e=>He("/claude-compat/pin",e?{version:e}:{}),patchClaudeBinary:()=>He("/claude-compat/patch"),unpatchClaudeBinary:()=>He("/claude-compat/unpatch"),dismissClaudeCompatBanner:e=>He("/claude-compat/dismiss-banner",{version:e}),listCronJobs:()=>ze("/cron/jobs"),getCronJob:e=>ze(`/cron/jobs/${encodeURIComponent(e)}`),createCronJob:e=>He("/cron/jobs",e),updateCronJob:(e,t)=>Vs(`/cron/jobs/${encodeURIComponent(e)}`,t),deleteCronJob:e=>Gs(`/cron/jobs/${encodeURIComponent(e)}`),toggleCronJob:e=>He(`/cron/jobs/${encodeURIComponent(e)}/toggle`),runCronJob:e=>He(`/cron/jobs/${encodeURIComponent(e)}/run`),getCronJobExecutions:e=>ze(`/cron/jobs/${encodeURIComponent(e)}/executions`),killProcess:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/processes/${encodeURIComponent(t)}/kill`),killAllProcesses:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/processes/kill-all`,{taskIds:t}),getSystemProcesses:e=>ze(`/sessions/${encodeURIComponent(e)}/processes/system`),killSystemProcess:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/processes/system/${t}/kill`),listAgents:()=>ze("/agents"),getAgent:e=>ze(`/agents/${encodeURIComponent(e)}`),createAgent:e=>He("/agents",e),updateAgent:(e,t)=>Vs(`/agents/${encodeURIComponent(e)}`,t),deleteAgent:e=>Gs(`/agents/${encodeURIComponent(e)}`),toggleAgent:e=>He(`/agents/${encodeURIComponent(e)}/toggle`),runAgent:(e,t)=>He(`/agents/${encodeURIComponent(e)}/run`,{input:t}),getAgentExecutions:e=>ze(`/agents/${encodeURIComponent(e)}/executions`),importAgent:e=>He("/agents/import",e),exportAgent:e=>ze(`/agents/${encodeURIComponent(e)}/export`),regenerateAgentWebhookSecret:e=>He(`/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 ze(`/executions${n?`?${n}`:""}`)},getLinearOAuthStatus:e=>{const t=new URLSearchParams;e&&t.set("stagingId",e);const n=t.toString();return ze(`/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 ze(`/linear/oauth/authorize-url${i?`?${i}`:""}`)},disconnectLinearOAuth:()=>He("/linear/oauth/disconnect"),createLinearStaging:e=>He("/linear/oauth/staging",e),getLinearStagingStatus:e=>ze(`/linear/oauth/staging/${encodeURIComponent(e)}/status`),deleteLinearStaging:e=>Gs(`/linear/oauth/staging/${encodeURIComponent(e)}`),listLinearOAuthConnections:()=>ze("/linear/oauth-connections"),createLinearOAuthConnection:e=>He("/linear/oauth-connections",e),updateLinearOAuthConnection:(e,t)=>Vs(`/linear/oauth-connections/${encodeURIComponent(e)}`,t),deleteLinearOAuthConnection:e=>Gs(`/linear/oauth-connections/${encodeURIComponent(e)}`),getLinearOAuthConnectionAuthorizeUrl:(e,t)=>ze(`/linear/oauth-connections/${encodeURIComponent(e)}/authorize-url${t?`?returnTo=${encodeURIComponent(t)}`:""}`),listSkills:()=>ze("/skills"),sendSessionMessage:(e,t)=>He(`/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 ze(`/prompts${i?`?${i}`:""}`)},createPrompt:e=>He("/prompts",e),updatePrompt:(e,t)=>Vs(`/prompts/${encodeURIComponent(e)}`,t),deletePrompt:e=>Gs(`/prompts/${encodeURIComponent(e)}`)};let x5=!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 b5(){return new Promise(()=>{})}function ZM(){if(x5||typeof window>"u")return;x5=!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 b5()}}}}catch{}return}try{Object.defineProperty(e,"clipboard",{configurable:!0,value:{writeText:async n=>{try{await v5(n)}catch{return b5()}}}})}catch{}}const y5="#/session/",_5="#/agents/";let w5=!1;function Px(){w5||(ZM(),w5=!0)}function Ix(e){if(Px(),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(_5)){const n=e.slice(_5.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 JM(e){return`#/session/${e}`}function Fx(e,t=!1){Px();const n=JM(e);t?(history.replaceState(null,"",n),window.dispatchEvent(new HashChangeEvent("hashchange"))):window.location.hash=`/session/${e}`}function qg(e=!1){Px(),e?(history.replaceState(null,"",window.location.pathname+window.location.search),window.dispatchEvent(new HashChangeEvent("hashchange"))):window.location.hash=""}function eR(){const[e,t]=k.useState(""),[n,i]=k.useState(null),[a,c]=k.useState(!1),u=K(x=>x.setAuthToken),h=k.useCallback(async x=>{x.preventDefault();const v=e.trim();if(!v){i("Please enter a token");return}c(!0),i(null),await g5(v)?u(v):i("Invalid token"),c(!1)},[e,u]);k.useEffect(()=>{KM().then(x=>{if(x){u(x);return}const b=new URLSearchParams(window.location.search).get("token");b&&(c(!0),g5(b).then(y=>{if(y){u(b);const _=new URL(window.location.href);_.searchParams.delete("token"),window.history.replaceState({},"",_.toString())}else i("Invalid token from URL"),c(!1)}))})},[u]);const[f,m]=k.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:x=>{t(x.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:()=>m(!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 To=O2();function tR({issueIdentifier:e,issueStateName:t,isContainerized:n,archiveTransitionConfigured:i,archiveTransitionStateName:a,hasBacklogState:c,onConfirm:u,onCancel:h}){const[f,m]=k.useState("none");return To.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:x=>x.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:()=>m("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 ${c?"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:()=>m("backlog"),disabled:!c,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:()=>m("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 nR(e,t){return t>0?"awaiting":(e.status==="running"||e.status==="compacting")&&e.isConnected?"running":e.isReconnecting?"reconnecting":e.isConnected?"idle":"exited"}function sR({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 iR({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 zh({session:e,isActive:t,isArchived:n,sessionName:i,permCount:a,isRecentlyRenamed:c,onSelect:u,onStartRename:h,onArchive:f,onUnarchive:m,onDelete:x,onClearRecentlyRenamed:v,editingSessionId:b,editingName:y,setEditingName:_,onConfirmRename:j,onCancelRename:N,editInputRef:S}){const C=e.id.slice(0,8),E=i||e.model||C,R=b===e.id,[L,O]=k.useState(!1),F=k.useRef(null),D=k.useRef(null),Q=n?"exited":nR(e,a),I=e.cwd||"";k.useEffect(()=>{if(!L)return;function M(W){var q;F.current&&!F.current.contains(W.target)&&D.current&&!D.current.contains(W.target)&&(O(!1),(q=D.current)==null||q.focus())}function de(W){var q,H,U;if(W.key==="Escape"){O(!1),(q=D.current)==null||q.focus();return}if(W.key==="Tab"){O(!1);return}if((W.key==="ArrowDown"||W.key==="ArrowUp")&&((H=F.current)!=null&&H.contains(document.activeElement)||D.current===document.activeElement)){W.preventDefault();const re=(U=F.current)==null?void 0:U.querySelectorAll("[role='menuitem']");if(!re||re.length===0)return;const ve=document.activeElement,A=Array.from(re).indexOf(ve);W.key==="ArrowDown"?re[A<re.length-1?A+1:0].focus():re[A>0?A-1:re.length-1].focus()}}return document.addEventListener("mousedown",M),document.addEventListener("touchstart",M),document.addEventListener("keydown",de),()=>{document.removeEventListener("mousedown",M),document.removeEventListener("touchstart",M),document.removeEventListener("keydown",de)}},[L]),k.useEffect(()=>{L&&requestAnimationFrame(()=>{var M,de;(de=(M=F.current)==null?void 0:M.querySelector("[role='menuitem']"))==null||de.focus()})},[L]);const X=k.useCallback(M=>{O(!1),M()},[]);return l.jsxs("div",{className:"relative group",children:[l.jsxs("button",{onClick:()=>u(e.id),onDoubleClick:M=>{M.preventDefault(),h(e.id,E)},onKeyDown:M=>{M.key==="F2"&&!R&&(M.preventDefault(),h(e.id,E))},className:`w-full flex items-center gap-2 py-2 pl-2.5 pr-12 min-h-[44px] rounded-lg transition-all duration-100 cursor-pointer relative ${t?"bg-cc-active":"hover:bg-cc-hover"}`,children:[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"}`}),!R&&l.jsx(sR,{status:Q}),R?l.jsx("input",{ref:S,value:y,onChange:M=>_(M.target.value),onKeyDown:M=>{M.key==="Enter"?(M.preventDefault(),j()):M.key==="Escape"&&(M.preventDefault(),N()),M.stopPropagation()},onBlur:j,onClick:M=>M.stopPropagation(),onDoubleClick:M=>M.stopPropagation(),className:"text-[12.5px] font-medium flex-1 min-w-0 text-cc-fg bg-transparent border border-cc-border rounded-md px-2 py-1 outline-none focus:border-cc-primary/50 focus:ring-1 focus:ring-cc-primary/20"}):l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("span",{className:`text-[12.5px] font-medium truncate block leading-snug ${t?"text-cc-fg":"text-cc-fg/90"} ${c?"animate-name-appear":""}`,onAnimationEnd:()=>v(e.id),children:E}),I&&l.jsx("span",{className:"text-[10px] text-cc-muted/70 truncate block leading-tight mt-px",children:I})]}),!R&&l.jsxs("span",{className:"flex items-center gap-1 shrink-0",children:[l.jsx(iR,{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"})})})]})]}),!n&&!R&&!L&&l.jsx("button",{onClick:M=>{M.stopPropagation(),f(M,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:D,onClick:M=>{M.stopPropagation(),O(!L)},className:"absolute right-1 top-1/2 -translate-y-1/2 p-1 rounded-md opacity-100 pointer-events-auto sm:opacity-0 sm:pointer-events-none sm:group-hover:opacity-100 sm:group-hover:pointer-events-auto hover:bg-cc-border text-cc-muted hover:text-cc-fg transition-all cursor-pointer",title:"Session actions","aria-label":"Session actions","aria-haspopup":"true","aria-expanded":L,children: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"})]})}),L&&l.jsxs("div",{ref:F,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:()=>X(()=>h(e.id,E)),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?l.jsxs(l.Fragment,{children:[l.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:M=>X(()=>m(M,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:M=>X(()=>x(M,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:M=>X(()=>f(M,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 rR({group:e,isCollapsed:t,onToggleCollapse:n,currentSessionId:i,sessionNames:a,pendingPermissions:c,recentlyRenamed:u,onSelect:h,onStartRename:f,onArchive:m,onUnarchive:x,onDelete:v,onClearRecentlyRenamed:b,editingSessionId:y,editingName:_,setEditingName:j,onConfirmRename:N,onCancelRename:S,editInputRef:C,isFirst:E}){const R=t?e.sessions.slice(0,2).map(L=>a.get(L.id)||L.model||L.id.slice(0,8)).join(", ")+(e.sessions.length>2?", ...":""):"";return l.jsxs("div",{className:E?"":"mt-3 pt-3 border-t border-cc-separator",children:[l.jsxs("button",{onClick:()=>n(e.key),"aria-expanded":!t,className:"w-full px-2 py-1 flex items-center gap-1.5 hover:bg-cc-hover rounded-md transition-colors cursor-pointer group/header",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${t?"":"rotate-90"}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx("span",{className:"text-[11px] font-semibold text-cc-fg/60 truncate uppercase tracking-wide",children:e.label}),l.jsxs("span",{className:"flex items-center gap-1 ml-auto shrink-0",children:[e.runningCount>0&&l.jsx("span",{className:"w-1 h-1 rounded-full bg-cc-success",title:`${e.runningCount} running`}),e.permCount>0&&l.jsx("span",{className:"w-1 h-1 rounded-full bg-cc-warning",title:`${e.permCount} waiting`})]}),l.jsx("span",{className:"text-[10px] text-cc-muted/50 tabular-nums shrink-0",children:e.sessions.length})]}),t&&R&&l.jsx("div",{className:"text-[10px] text-cc-muted/70 truncate pl-5 pb-0.5",children:R}),!t&&l.jsx("div",{className:"mt-0.5",children:e.sessions.map(L=>{var F;const O=((F=c.get(L.id))==null?void 0:F.size)??0;return l.jsx(zh,{session:L,isActive:i===L.id,sessionName:a.get(L.id),permCount:O,isRecentlyRenamed:u.has(L.id),onSelect:h,onStartRename:f,onArchive:m,onUnarchive:x,onDelete:v,onClearRecentlyRenamed:b,editingSessionId:y,editingName:_,setEditingName:j,onConfirmRename:N,onCancelRename:S,editInputRef:C},L.id)})})]})}function aR(e,t,n=!1){return(n&&!!t&&(t==="/workspace"||t.startsWith("/workspace/"))?e:t||e).replace(/\/+$/,"")||"/"}function lR(e){if(e==="/")return"/";const t=e.split("/").filter(Boolean);return t.length===0?"/":t[t.length-1]}function oR(e){const t=new Map;for(const i of e){const a=aR(i.cwd,i.repoRoot||void 0,i.isContainerized),c=lR(a);t.has(a)||t.set(a,{key:a,label:c,sessions:[],runningCount:0,permCount:0,mostRecentActivity:0});const u=t.get(a);u.sessions.push(i),i.status==="running"&&u.runningCount++,u.permCount+=i.permCount,u.mostRecentActivity=Math.max(u.mostRecentActivity,i.createdAt)}const n=Array.from(t.values()).sort((i,a)=>i.label.localeCompare(a.label));for(const i of n)i.sessions.sort((a,c)=>c.createdAt-a.createdAt);return n}const cR=[{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"}],uR=[{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"}],dR=[{id:"workbench",label:"Workbench",itemIds:["dashboard","prompts","integrations"]},{id:"workspace",label:"Workspace",itemIds:["environments","sandboxes","agents","settings"]}],hR=new Map(uR.map(e=>[e.id,e]));function fR(){var xr,Bi;const[e,t]=k.useState(null),[n,i]=k.useState(""),[a,c]=k.useState(!1),[u,h]=k.useState(null),[f,m]=k.useState(null),[x,v]=k.useState(null),[b,y]=k.useState(!1),[_,j]=k.useState(null),[N,S]=k.useState(!1),[C,E]=k.useState(()=>typeof window<"u"?window.location.hash:""),R=k.useRef(null),L=k.useRef(null),O=K(le=>le.sessions),F=K(le=>le.sdkSessions),D=K(le=>le.currentSessionId),Q=K(le=>le.cliConnected),I=K(le=>le.cliReconnecting),X=K(le=>le.sessionStatus),M=K(le=>le.removeSession),de=K(le=>le.sessionNames),W=K(le=>le.recentlyRenamed),q=K(le=>le.clearRecentlyRenamed),H=K(le=>le.pendingPermissions),U=K(le=>le.linkedLinearIssues),re=K(le=>le.collapsedProjects),ve=K(le=>le.toggleProjectCollapse),A=Ix(C);k.useEffect(()=>{let le=!0;async function xe(){try{const rt=await ke.listSessions();if(le){const Ut=K.getState();Ut.setSdkSessions(rt);const wn=K.getState(),Nn=new Set(rt.map(xt=>xt.sessionId));for(const xt of wn.sessions.keys())!Nn.has(xt)&&wn.connectionStatus.get(xt)!=="connected"&&wn.removeSession(xt);hT(rt);for(const xt of rt)if(xt.name&&(!Ut.sessionNames.has(xt.sessionId)||/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(Ut.sessionNames.get(xt.sessionId)))){const rn=Ut.sessionNames.get(xt.sessionId),en=!!rn&&/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(rn);rn!==xt.name&&(Ut.setSessionName(xt.sessionId,xt.name),en&&Ut.markRecentlyRenamed(xt.sessionId))}}}catch{}}xe();const we=setInterval(xe,5e3);return()=>{le=!1,clearInterval(we)}},[]),k.useEffect(()=>{const le=()=>E(window.location.hash);return window.addEventListener("hashchange",le),()=>window.removeEventListener("hashchange",le)},[]);function Ee(le){Fx(le),window.innerWidth<768&&K.getState().setSidebarOpen(!1)}function Me(){qg(),K.getState().newSession(),window.innerWidth<768&&K.getState().setSidebarOpen(!1)}k.useEffect(()=>{e&&R.current&&(R.current.focus(),R.current.select())},[e]);function z(){e&&n.trim()&&(K.getState().setSessionName(e,n.trim()),ke.renameSession(e,n.trim()).catch(()=>{})),t(null),i("")}function P(){t(null),i("")}function oe(le,xe){t(le),i(xe)}const _e=k.useCallback((le,xe)=>{le.stopPropagation(),j(xe)},[]),Ne=k.useCallback(async le=>{try{y0(le),await ke.deleteSession(le)}catch{}K.getState().currentSessionId===le&&qg(),M(le)},[M]),Ae=k.useCallback(()=>{_&&(Ne(_),j(null))},[_,Ne]),Le=k.useCallback(()=>{j(null)},[]),De=k.useCallback(()=>{S(!0)},[]),Ce=k.useCallback(async()=>{S(!1);const le=K.getState(),xe=new Set;for(const rt of le.sessions.keys())xe.add(rt);for(const rt of le.sdkSessions)xe.add(rt.sessionId);const we=Array.from(xe).filter(rt=>{const Ut=le.sdkSessions.find(wn=>wn.sessionId===rt);return(Ut==null?void 0:Ut.archived)??!1});for(const rt of we)await Ne(rt)},[Ne]),Re=k.useCallback(()=>{S(!1)},[]);k.useEffect(()=>{if(!_&&!N)return;requestAnimationFrame(()=>{var xe,we;(we=(xe=L.current)==null?void 0:xe.querySelector("button"))==null||we.focus()});function le(xe){var wn;if(xe.key==="Escape"){N?Re():Le();return}if(xe.key!=="Tab")return;const we=(wn=L.current)==null?void 0:wn.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(!we||we.length===0)return;const rt=we[0],Ut=we[we.length-1];xe.shiftKey&&document.activeElement===rt?(xe.preventDefault(),Ut.focus()):!xe.shiftKey&&document.activeElement===Ut&&(xe.preventDefault(),rt.focus())}return document.addEventListener("keydown",le),()=>document.removeEventListener("keydown",le)},[_,N,Le,Re]);const It=k.useCallback(async(le,xe)=>{le.stopPropagation();const we=F.find(rn=>rn.sessionId===xe),rt=O.get(xe),Ut=(rt==null?void 0:rt.is_containerized)||!!(we!=null&&we.containerId)||!1,wn=U.get(xe),Nn=((wn==null?void 0:wn.stateType)||"").toLowerCase();if(wn&&!(Nn==="completed"||Nn==="canceled"||Nn==="cancelled"))try{const rn=await ke.getArchiveInfo(xe);if(rn.issueNotDone){m(xe),v(rn),y(Ut);return}}catch{}if(Ut){h(xe);return}Wt(xe)},[F,O,U]),Wt=k.useCallback(async(le,xe,we)=>{try{y0(le);const rt={};xe&&(rt.force=!0),we&&we!=="none"&&(rt.linearTransition=we),await ke.archiveSession(le,Object.keys(rt).length>0?rt:void 0)}catch{}K.getState().currentSessionId===le&&(qg(),K.getState().newSession());try{const rt=await ke.listSessions();K.getState().setSdkSessions(rt)}catch{}},[]),Ft=k.useCallback(()=>{u&&(Wt(u,!0),h(null))},[u,Wt]),Nt=k.useCallback(()=>{h(null)},[]),wt=k.useCallback((le,xe)=>{f&&(Wt(f,xe,le),m(null),v(null))},[f,Wt]),Qe=k.useCallback(()=>{m(null),v(null)},[]),St=k.useCallback(async(le,xe)=>{le.stopPropagation();try{await ke.unarchiveSession(xe)}catch{}try{const we=await ke.listSessions();K.getState().setSdkSessions(we)}catch{}},[]),nn=new Set;for(const le of O.keys())nn.add(le);for(const le of F)nn.add(le.sessionId);const se=Array.from(nn).map(le=>{var rt;const xe=O.get(le),we=F.find(Ut=>Ut.sessionId===le);return{id:le,model:(xe==null?void 0:xe.model)||(we==null?void 0:we.model)||"",cwd:(xe==null?void 0:xe.cwd)||(we==null?void 0:we.cwd)||"",gitBranch:(xe==null?void 0:xe.git_branch)||(we==null?void 0:we.gitBranch)||"",isContainerized:(xe==null?void 0:xe.is_containerized)||!!(we!=null&&we.containerId)||!1,gitAhead:(xe==null?void 0:xe.git_ahead)||(we==null?void 0:we.gitAhead)||0,gitBehind:(xe==null?void 0:xe.git_behind)||(we==null?void 0:we.gitBehind)||0,linesAdded:(xe==null?void 0:xe.total_lines_added)||(we==null?void 0:we.totalLinesAdded)||0,linesRemoved:(xe==null?void 0:xe.total_lines_removed)||(we==null?void 0:we.totalLinesRemoved)||0,isConnected:Q.get(le)??!1,isReconnecting:I.get(le)??!1,status:X.get(le)??null,sdkState:(we==null?void 0:we.state)??null,createdAt:(we==null?void 0:we.createdAt)??0,archived:(we==null?void 0:we.archived)??!1,backendType:(xe==null?void 0:xe.backend_type)||(we==null?void 0:we.backendType)||"claude",repoRoot:(xe==null?void 0:xe.repo_root)||"",permCount:((rt=H.get(le))==null?void 0:rt.size)??0,cronJobId:(xe==null?void 0:xe.cronJobId)||(we==null?void 0:we.cronJobId),cronJobName:(xe==null?void 0:xe.cronJobName)||(we==null?void 0:we.cronJobName),agentId:(xe==null?void 0:xe.agentId)||(we==null?void 0:we.agentId),agentName:(xe==null?void 0:xe.agentName)||(we==null?void 0:we.agentName),userName:we==null?void 0:we.userName}}).sort((le,xe)=>xe.createdAt-le.createdAt),je=k.useMemo(()=>Array.from(new Set(se.map(le=>le.userName).filter(le=>!!le))).sort(),[se]),[Xe,et]=k.useState("__all__"),un=le=>Xe==="__all__"?!0:Xe==="__none__"?!le.userName:le.userName===Xe,ce=se.some(le=>!le.userName),be=se.filter(un),G=be.filter(le=>!le.archived&&!le.cronJobId&&!le.agentId),me=be.filter(le=>!le.archived&&!!le.cronJobId),Pe=be.filter(le=>!le.archived&&!!le.agentId),Ke=be.filter(le=>le.archived),at=D?se.find(le=>le.id===D):null,ht=(at==null?void 0:at.backendType)==="codex"?"/logo-codex.svg":"/logo.svg",[fn,is]=k.useState(!0),[Ct,vs]=k.useState(!0),In=k.useMemo(()=>oR(G),[G]),sn={onSelect:Ee,onStartRename:oe,onArchive:It,onUnarchive:St,onDelete:_e,onClearRecentlyRenamed:q,editingSessionId:e,editingName:n,setEditingName:i,onConfirmRename:z,onCancelRename:P,editInputRef:R};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:ht,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:Me,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:()=>K.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"})})})]})}),je.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:Xe,onChange:le=>et(le.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"}),je.map(le=>l.jsx("option",{value:le,children:le},le)),ce&&l.jsx("option",{value:"__none__",children:"No user data"})]})]}),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:Nt,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:Ft,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:G.length===0&&me.length===0&&Ke.length===0?l.jsx("p",{className:"px-3 py-8 text-xs text-cc-muted text-center leading-relaxed",children:"No sessions yet."}):l.jsxs(l.Fragment,{children:[In.map((le,xe)=>l.jsx(rR,{group:le,isCollapsed:re.has(le.key),onToggleCollapse:ve,currentSessionId:D,sessionNames:de,pendingPermissions:H,recentlyRenamed:W,isFirst:xe===0,...sn},le.key)),me.length>0&&l.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[l.jsxs("button",{onClick:()=>is(!fn),"aria-expanded":fn,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 ${fn?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),"Scheduled Runs (",me.length,")"]}),fn&&l.jsx("div",{className:"mt-0.5",children:me.map(le=>{var xe;return l.jsx(zh,{session:le,isActive:D===le.id,sessionName:de.get(le.id),permCount:((xe=H.get(le.id))==null?void 0:xe.size)??0,isRecentlyRenamed:W.has(le.id),...sn},le.id)})})]}),Pe.length>0&&l.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[l.jsxs("button",{onClick:()=>vs(!Ct),"aria-expanded":Ct,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 ${Ct?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),"Agent Runs (",Pe.length,")"]}),Ct&&l.jsx("div",{className:"mt-0.5",children:Pe.map(le=>{var xe;return l.jsx(zh,{session:le,isActive:D===le.id,sessionName:de.get(le.id),permCount:((xe=H.get(le.id))==null?void 0:xe.size)??0,isRecentlyRenamed:W.has(le.id),...sn},le.id)})})]}),Ke.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:()=>c(!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 (",Ke.length,")"]}),a&&Ke.length>1&&l.jsx("button",{onClick:De,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:Ke.map(le=>{var xe;return l.jsx(zh,{session:le,isActive:D===le.id,isArchived:!0,sessionName:de.get(le.id),permCount:((xe=H.get(le.id))==null?void 0:xe.size)??0,isRecentlyRenamed:W.has(le.id),...sn},le.id)})})]})]})}),l.jsx("div",{className:"md:hidden flex justify-end px-4 pb-2",children:l.jsx("button",{onClick:Me,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:dR.map(le=>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:le.label}),l.jsx("div",{className:"flex flex-col",children:le.itemIds.map(xe=>{const we=hR.get(xe);if(!we)return null;const rt=we.activePages?we.activePages.some(Ut=>A.page===Ut):A.page===we.id;return l.jsxs("button",{onClick:()=>{window.location.hash=we.hash,window.innerWidth<768&&K.getState().setSidebarOpen(!1)},title:we.label,"aria-current":rt?"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 ${rt?"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 ${rt?"bg-cc-primary":"bg-transparent group-hover:bg-cc-border"}`}),l.jsx("svg",{viewBox:we.viewBox,fill:"currentColor",className:"w-3.5 h-3.5 shrink-0",children:l.jsx("path",{d:we.iconPath,fillRule:we.fillRule,clipRule:we.clipRule})}),l.jsx("span",{className:"min-w-0 flex-1 text-[12px] font-medium leading-tight",children:we.label})]},we.id)})})]},le.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:cR.map(le=>l.jsx("a",{href:le.url,target:"_blank",rel:"noopener noreferrer",title:le.label,"aria-label":`Open ${le.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:le.viewBox,fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:le.iconPath})})},le.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?Re:Le,children:l.jsxs("div",{ref:L,role:"alertdialog","aria-modal":"true","aria-labelledby":"delete-dialog-title","aria-describedby":"delete-dialog-desc",className:"mx-4 w-full max-w-[280px] bg-cc-card border border-cc-border rounded-xl shadow-2xl p-5 animate-[menu-appear_150ms_ease-out]",onClick:le=>le.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 ${Ke.length} archived session${Ke.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?Re:Le,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?Ce:Ae,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&&x&&l.jsx(tR,{issueIdentifier:((xr=x.issue)==null?void 0:xr.identifier)||"",issueStateName:((Bi=x.issue)==null?void 0:Bi.stateName)||"",isContainerized:b,archiveTransitionConfigured:x.archiveTransitionConfigured||!1,archiveTransitionStateName:x.archiveTransitionStateName,hasBacklogState:x.hasBacklogState||!1,onConfirm:wt,onCancel:Qe})]})}function pR(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const mR=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,gR=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,xR={};function S5(e,t){return(xR.jsx?gR:mR).test(e)}const vR=/[ \t\n\f\r]/g;function bR(e){return typeof e=="object"?e.type==="text"?k5(e.value):!1:k5(e)}function k5(e){return e.replace(vR,"")===""}class Ou{constructor(t,n,i){this.normal=n,this.property=t,i&&(this.space=i)}}Ou.prototype.normal={};Ou.prototype.property={};Ou.prototype.space=void 0;function gj(e,t){const n={},i={};for(const a of e)Object.assign(n,a.property),Object.assign(i,a.normal);return new Ou(n,i,t)}function J0(e){return e.toLowerCase()}class xs{constructor(t,n){this.attribute=n,this.property=t}}xs.prototype.attribute="";xs.prototype.booleanish=!1;xs.prototype.boolean=!1;xs.prototype.commaOrSpaceSeparated=!1;xs.prototype.commaSeparated=!1;xs.prototype.defined=!1;xs.prototype.mustUseProperty=!1;xs.prototype.number=!1;xs.prototype.overloadedBoolean=!1;xs.prototype.property="";xs.prototype.spaceSeparated=!1;xs.prototype.space=void 0;let yR=0;const Ze=ll(),bn=ll(),ex=ll(),Se=ll(),$t=ll(),nl=ll(),Rs=ll();function ll(){return 2**++yR}const tx=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ze,booleanish:bn,commaOrSpaceSeparated:Rs,commaSeparated:nl,number:Se,overloadedBoolean:ex,spaceSeparated:$t},Symbol.toStringTag,{value:"Module"})),Vg=Object.keys(tx);class Ux extends xs{constructor(t,n,i,a){let c=-1;if(super(t,n),j5(this,"space",a),typeof i=="number")for(;++c<Vg.length;){const u=Vg[c];j5(this,Vg[c],(i&tx[u])===tx[u])}}}Ux.prototype.defined=!0;function j5(e,t,n){n&&(e[t]=n)}function Ao(e){const t={},n={};for(const[i,a]of Object.entries(e.properties)){const c=new Ux(i,e.transform(e.attributes||{},i),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(c.mustUseProperty=!0),t[i]=c,n[J0(i)]=i,n[J0(c.attribute)]=i}return new Ou(t,n,e.space)}const xj=Ao({properties:{ariaActiveDescendant:null,ariaAtomic:bn,ariaAutoComplete:null,ariaBusy:bn,ariaChecked:bn,ariaColCount:Se,ariaColIndex:Se,ariaColSpan:Se,ariaControls:$t,ariaCurrent:null,ariaDescribedBy:$t,ariaDetails:null,ariaDisabled:bn,ariaDropEffect:$t,ariaErrorMessage:null,ariaExpanded:bn,ariaFlowTo:$t,ariaGrabbed:bn,ariaHasPopup:null,ariaHidden:bn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:$t,ariaLevel:Se,ariaLive:null,ariaModal:bn,ariaMultiLine:bn,ariaMultiSelectable:bn,ariaOrientation:null,ariaOwns:$t,ariaPlaceholder:null,ariaPosInSet:Se,ariaPressed:bn,ariaReadOnly:bn,ariaRelevant:null,ariaRequired:bn,ariaRoleDescription:$t,ariaRowCount:Se,ariaRowIndex:Se,ariaRowSpan:Se,ariaSelected:bn,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 vj(e,t){return t in e?e[t]:t}function bj(e,t){return vj(e,t.toLowerCase())}const _R=Ao({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:nl,acceptCharset:$t,accessKey:$t,action:null,allow:null,allowFullScreen:Ze,allowPaymentRequest:Ze,allowUserMedia:Ze,alpha:Ze,alt:null,as:null,async:Ze,autoCapitalize:null,autoComplete:$t,autoFocus:Ze,autoPlay:Ze,blocking:$t,capture:null,charSet:null,checked:Ze,cite:null,className:$t,closedBy:null,colorSpace:null,cols:Se,colSpan:Se,command:null,commandFor:null,content:null,contentEditable:bn,controls:Ze,controlsList:$t,coords:Se|nl,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ze,defer:Ze,dir:null,dirName:null,disabled:Ze,download:ex,draggable:bn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ze,formTarget:null,headers:$t,height:Se,hidden:ex,high:Se,href:null,hrefLang:null,htmlFor:$t,httpEquiv:$t,id:null,imageSizes:null,imageSrcSet:null,inert:Ze,inputMode:null,integrity:null,is:null,isMap:Ze,itemId:null,itemProp:$t,itemRef:$t,itemScope:Ze,itemType:$t,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ze,low:Se,manifest:null,max:null,maxLength:Se,media:null,method:null,min:null,minLength:Se,multiple:Ze,muted:Ze,name:null,nonce:null,noModule:Ze,noValidate:Ze,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:Ze,optimum:Se,pattern:null,ping:$t,placeholder:null,playsInline:Ze,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ze,referrerPolicy:null,rel:$t,required:Ze,reversed:Ze,rows:Se,rowSpan:Se,sandbox:$t,scope:null,scoped:Ze,seamless:Ze,selected:Ze,shadowRootClonable:Ze,shadowRootCustomElementRegistry:Ze,shadowRootDelegatesFocus:Ze,shadowRootMode:null,shadowRootSerializable:Ze,shape:null,size:Se,sizes:null,slot:null,span:Se,spellCheck:bn,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:Ze,useMap:null,value:bn,width:Se,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:$t,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:Ze,declare:Ze,event:null,face:null,frame:null,frameBorder:null,hSpace:Se,leftMargin:Se,link:null,longDesc:null,lowSrc:null,marginHeight:Se,marginWidth:Se,noResize:Ze,noHref:Ze,noShade:Ze,noWrap:Ze,object:null,profile:null,prompt:null,rev:null,rightMargin:Se,rules:null,scheme:null,scrolling:bn,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:Ze,disablePictureInPicture:Ze,disableRemotePlayback:Ze,exportParts:nl,part:$t,prefix:null,property:null,results:Se,security:null,unselectable:null},space:"html",transform:bj}),wR=Ao({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:Rs,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:$t,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:Ze,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:nl,g2:nl,glyphName:nl,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:Rs,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:$t,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Se,pointsAtY:Se,pointsAtZ:Se,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Rs,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Rs,rev:Rs,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Rs,requiredFeatures:Rs,requiredFonts:Rs,requiredFormats:Rs,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:Rs,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:Rs,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:Rs,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:vj}),yj=Ao({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()}}),_j=Ao({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:bj}),wj=Ao({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),SR={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"},kR=/[A-Z]/g,N5=/-[a-z]/g,jR=/^data[-\w.:]+$/i;function NR(e,t){const n=J0(t);let i=t,a=xs;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&jR.test(t)){if(t.charAt(4)==="-"){const c=t.slice(5).replace(N5,ER);i="data"+c.charAt(0).toUpperCase()+c.slice(1)}else{const c=t.slice(4);if(!N5.test(c)){let u=c.replace(kR,CR);u.charAt(0)!=="-"&&(u="-"+u),t="data"+u}}a=Ux}return new a(i,t)}function CR(e){return"-"+e.toLowerCase()}function ER(e){return e.charAt(1).toUpperCase()}const TR=gj([xj,_R,yj,_j,wj],"html"),Hx=gj([xj,wR,yj,_j,wj],"svg");function AR(e){return e.join(" ").trim()}var io={},Gg,C5;function MR(){if(C5)return Gg;C5=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,c=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,h=/^\s+|\s+$/g,f=`
|
|
72
|
+
`,m="/",x="*",v="",b="comment",y="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,E=1;function R(W){var q=W.match(t);q&&(C+=q.length);var H=W.lastIndexOf(f);E=~H?W.length-H:E+W.length}function L(){var W={line:C,column:E};return function(q){return q.position=new O(W),Q(),q}}function O(W){this.start=W,this.end={line:C,column:E},this.source=S.source}O.prototype.content=N;function F(W){var q=new Error(S.source+":"+C+":"+E+": "+W);if(q.reason=W,q.filename=S.source,q.line=C,q.column=E,q.source=N,!S.silent)throw q}function D(W){var q=W.exec(N);if(q){var H=q[0];return R(H),N=N.slice(H.length),q}}function Q(){D(n)}function I(W){var q;for(W=W||[];q=X();)q!==!1&&W.push(q);return W}function X(){var W=L();if(!(m!=N.charAt(0)||x!=N.charAt(1))){for(var q=2;v!=N.charAt(q)&&(x!=N.charAt(q)||m!=N.charAt(q+1));)++q;if(q+=2,v===N.charAt(q-1))return F("End of comment missing");var H=N.slice(2,q-2);return E+=2,R(H),N=N.slice(q),E+=2,W({type:b,comment:H})}}function M(){var W=L(),q=D(i);if(q){if(X(),!D(a))return F("property missing ':'");var H=D(c),U=W({type:y,property:j(q[0].replace(e,v)),value:H?j(H[0].replace(e,v)):v});return D(u),U}}function de(){var W=[];I(W);for(var q;q=M();)q!==!1&&(W.push(q),I(W));return W}return Q(),de()}function j(N){return N?N.replace(h,v):v}return Gg=_,Gg}var E5;function RR(){if(E5)return io;E5=1;var e=io&&io.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(io,"__esModule",{value:!0}),io.default=n;const t=e(MR());function n(i,a){let c=null;if(!i||typeof i!="string")return c;const u=(0,t.default)(i),h=typeof a=="function";return u.forEach(f=>{if(f.type!=="declaration")return;const{property:m,value:x}=f;h?a(m,x,f):x&&(c=c||{},c[m]=x)}),c}return io}var Vc={},T5;function OR(){if(T5)return Vc;T5=1,Object.defineProperty(Vc,"__esModule",{value:!0}),Vc.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,c=function(m){return!m||n.test(m)||e.test(m)},u=function(m,x){return x.toUpperCase()},h=function(m,x){return"".concat(x,"-")},f=function(m,x){return x===void 0&&(x={}),c(m)?m:(m=m.toLowerCase(),x.reactCompat?m=m.replace(a,h):m=m.replace(i,h),m.replace(t,u))};return Vc.camelCase=f,Vc}var Gc,A5;function LR(){if(A5)return Gc;A5=1;var e=Gc&&Gc.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(RR()),n=OR();function i(a,c){var u={};return!a||typeof a!="string"||(0,t.default)(a,function(h,f){h&&f&&(u[(0,n.camelCase)(h,c)]=f)}),u}return i.default=i,Gc=i,Gc}var DR=LR();const zR=px(DR),Sj=kj("end"),qx=kj("start");function kj(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 $R(e){const t=qx(e),n=Sj(e);if(t&&n)return{start:t,end:n}}function hu(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?M5(e.position):"start"in e||"end"in e?M5(e):"line"in e||"column"in e?nx(e):""}function nx(e){return R5(e&&e.line)+":"+R5(e&&e.column)}function M5(e){return nx(e&&e.start)+"-"+nx(e&&e.end)}function R5(e){return e&&typeof e=="number"?e:1}class Gn extends Error{constructor(t,n,i){super(),typeof n=="string"&&(i=n,n=void 0);let a="",c={},u=!1;if(n&&("line"in n&&"column"in n?c={place:n}:"start"in n&&"end"in n?c={place:n}:"type"in n?c={ancestors:[n],place:n.position}:c={...n}),typeof t=="string"?a=t:!c.cause&&t&&(u=!0,a=t.message,c.cause=t),!c.ruleId&&!c.source&&typeof i=="string"){const f=i.indexOf(":");f===-1?c.ruleId=i:(c.source=i.slice(0,f),c.ruleId=i.slice(f+1))}if(!c.place&&c.ancestors&&c.ancestors){const f=c.ancestors[c.ancestors.length-1];f&&(c.place=f.position)}const h=c.place&&"start"in c.place?c.place.start:c.place;this.ancestors=c.ancestors||void 0,this.cause=c.cause||void 0,this.column=h?h.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=h?h.line:void 0,this.name=hu(c.place)||"1:1",this.place=c.place||void 0,this.reason=this.message,this.ruleId=c.ruleId||void 0,this.source=c.source||void 0,this.stack=u&&c.cause&&typeof c.cause.stack=="string"?c.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Gn.prototype.file="";Gn.prototype.name="";Gn.prototype.reason="";Gn.prototype.message="";Gn.prototype.stack="";Gn.prototype.column=void 0;Gn.prototype.line=void 0;Gn.prototype.ancestors=void 0;Gn.prototype.cause=void 0;Gn.prototype.fatal=void 0;Gn.prototype.place=void 0;Gn.prototype.ruleId=void 0;Gn.prototype.source=void 0;const Vx={}.hasOwnProperty,BR=new Map,PR=/[A-Z]/g,IR=new Set(["table","tbody","thead","tfoot","tr"]),FR=new Set(["td","th"]),jj="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function UR(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=WR(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=QR(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"?Hx:TR,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},c=Nj(a,e,void 0);return c&&typeof c!="string"?c:a.create(e,a.Fragment,{children:c||void 0},void 0)}function Nj(e,t,n){if(t.type==="element")return HR(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return qR(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return GR(e,t,n);if(t.type==="mdxjsEsm")return VR(e,t);if(t.type==="root")return YR(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=Hx,e.schema=a),e.ancestors.push(t);const c=Ej(e,t.tagName,!1),u=KR(e,t);let h=Yx(e,t);return IR.has(t.tagName)&&(h=h.filter(function(f){return typeof f=="string"?!bR(f):!0})),Cj(e,u,c,t),Gx(u,h),e.ancestors.pop(),e.schema=i,e.create(t,c,u,n)}function qR(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)}Eu(e,t.position)}function VR(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Eu(e,t.position)}function GR(e,t,n){const i=e.schema;let a=i;t.name==="svg"&&i.space==="html"&&(a=Hx,e.schema=a),e.ancestors.push(t);const c=t.name===null?e.Fragment:Ej(e,t.name,!0),u=ZR(e,t),h=Yx(e,t);return Cj(e,u,c,t),Gx(u,h),e.ancestors.pop(),e.schema=i,e.create(t,c,u,n)}function YR(e,t,n){const i={};return Gx(i,Yx(e,t)),e.create(t,e.Fragment,i,n)}function XR(e,t){return t.value}function Cj(e,t,n,i){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=i)}function Gx(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function QR(e,t,n){return i;function i(a,c,u,h){const m=Array.isArray(u.children)?n:t;return h?m(c,u,h):m(c,u)}}function WR(e,t){return n;function n(i,a,c,u){const h=Array.isArray(c.children),f=qx(i);return t(a,c,u,h,{columnNumber:f?f.column-1:void 0,fileName:e,lineNumber:f?f.line:void 0},void 0)}}function KR(e,t){const n={};let i,a;for(a in t.properties)if(a!=="children"&&Vx.call(t.properties,a)){const c=JR(e,a,t.properties[a]);if(c){const[u,h]=c;e.tableCellAlignToStyle&&u==="align"&&typeof h=="string"&&FR.has(t.tagName)?i=h:n[u]=h}}if(i){const c=n.style||(n.style={});c[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return n}function ZR(e,t){const n={};for(const i of t.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&e.evaluater){const c=i.data.estree.body[0];c.type;const u=c.expression;u.type;const h=u.properties[0];h.type,Object.assign(n,e.evaluater.evaluateExpression(h.argument))}else Eu(e,t.position);else{const a=i.name;let c;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,c=e.evaluater.evaluateExpression(h.expression)}else Eu(e,t.position);else c=i.value===null?!0:i.value;n[a]=c}return n}function Yx(e,t){const n=[];let i=-1;const a=e.passKeys?new Map:BR;for(;++i<t.children.length;){const c=t.children[i];let u;if(e.passKeys){const f=c.type==="element"?c.tagName:c.type==="mdxJsxFlowElement"||c.type==="mdxJsxTextElement"?c.name:void 0;if(f){const m=a.get(f)||0;u=f+"-"+m,a.set(f,m+1)}}const h=Nj(e,c,u);h!==void 0&&n.push(h)}return n}function JR(e,t,n){const i=NR(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=i.commaSeparated?pR(n):AR(n)),i.property==="style"){let a=typeof n=="object"?n:e8(e,String(n));return e.stylePropertyNameCase==="css"&&(a=t8(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&i.space?SR[i.property]||i.property:i.attribute,n]}}function e8(e,t){try{return zR(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const i=n,a=new Gn("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=jj+"#cannot-parse-style-attribute",a}}function Ej(e,t,n){let i;if(!n)i={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let c=-1,u;for(;++c<a.length;){const h=S5(a[c])?{type:"Identifier",name:a[c]}:{type:"Literal",value:a[c]};u=u?{type:"MemberExpression",object:u,property:h,computed:!!(c&&h.type==="Literal"),optional:!1}:h}i=u}else i=S5(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(i.type==="Literal"){const a=i.value;return Vx.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(i);Eu(e)}function Eu(e,t){const n=new Gn("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=jj+"#cannot-handle-mdx-estrees-without-createevaluater",n}function t8(e){const t={};let n;for(n in e)Vx.call(e,n)&&(t[n8(n)]=e[n]);return t}function n8(e){let t=e.replace(PR,s8);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function s8(e){return"-"+e.toLowerCase()}const Yg={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"]},i8={};function Xx(e,t){const n=i8,i=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Tj(e,i,a)}function Tj(e,t,n){if(r8(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 O5(e.children,t,n)}return Array.isArray(e)?O5(e,t,n):""}function O5(e,t,n){const i=[];let a=-1;for(;++a<e.length;)i[a]=Tj(e[a],t,n);return i.join("")}function r8(e){return!!(e&&typeof e=="object")}const L5=document.createElement("i");function Qx(e){const t="&"+e+";";L5.innerHTML=t;const n=L5.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Ls(e,t,n,i){const a=e.length;let c=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);c<i.length;)u=i.slice(c,c+1e4),u.unshift(t,0),e.splice(...u),c+=1e4,t+=1e4}function Ys(e,t){return e.length>0?(Ls(e,e.length,0,t),e):t}const D5={}.hasOwnProperty;function Aj(e){const t={};let n=-1;for(;++n<e.length;)a8(t,e[n]);return t}function a8(e,t){let n;for(n in t){const a=(D5.call(e,n)?e[n]:void 0)||(e[n]={}),c=t[n];let u;if(c)for(u in c){D5.call(a,u)||(a[u]=[]);const h=c[u];l8(a[u],Array.isArray(h)?h:h?[h]:[])}}}function l8(e,t){let n=-1;const i=[];for(;++n<t.length;)(t[n].add==="after"?e:i).push(t[n]);Ls(e,0,0,i)}function Mj(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 hi(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ss=pa(/[A-Za-z]/),qn=pa(/[\dA-Za-z]/),o8=pa(/[#-'*+\--9=?A-Z^-~]/);function cf(e){return e!==null&&(e<32||e===127)}const sx=pa(/\d/),c8=pa(/[\dA-Fa-f]/),u8=pa(/[!-/:-@[-`{-~]/);function qe(e){return e!==null&&e<-2}function Pt(e){return e!==null&&(e<0||e===32)}function dt(e){return e===-2||e===-1||e===32}const Sf=pa(new RegExp("\\p{P}|\\p{S}","u")),al=pa(/\s/);function pa(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Mo(e){const t=[];let n=-1,i=0,a=0;for(;++n<e.length;){const c=e.charCodeAt(n);let u="";if(c===37&&qn(e.charCodeAt(n+1))&&qn(e.charCodeAt(n+2)))a=2;else if(c<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(c))||(u=String.fromCharCode(c));else if(c>55295&&c<57344){const h=e.charCodeAt(n+1);c<56320&&h>56319&&h<57344?(u=String.fromCharCode(c,h),a=1):u="�"}else u=String.fromCharCode(c);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 _t(e,t,n,i){const a=i?i-1:Number.POSITIVE_INFINITY;let c=0;return u;function u(f){return dt(f)?(e.enter(n),h(f)):t(f)}function h(f){return dt(f)&&c++<a?(e.consume(f),h):(e.exit(n),t(f))}}const d8={tokenize:h8};function h8(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"),_t(e,t,"linePrefix")}function a(h){return e.enter("paragraph"),c(h)}function c(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 qe(h)?(e.consume(h),e.exit("chunkText"),c):(e.consume(h),u)}}const f8={tokenize:p8},z5={tokenize:m8};function p8(e){const t=this,n=[];let i=0,a,c,u;return h;function h(E){if(i<n.length){const R=n[i];return t.containerState=R[1],e.attempt(R[0].continuation,f,m)(E)}return m(E)}function f(E){if(i++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&C();const R=t.events.length;let L=R,O;for(;L--;)if(t.events[L][0]==="exit"&&t.events[L][1].type==="chunkFlow"){O=t.events[L][1].end;break}S(i);let F=R;for(;F<t.events.length;)t.events[F][1].end={...O},F++;return Ls(t.events,L+1,0,t.events.slice(R)),t.events.length=F,m(E)}return h(E)}function m(E){if(i===n.length){if(!a)return b(E);if(a.currentConstruct&&a.currentConstruct.concrete)return _(E);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(z5,x,v)(E)}function x(E){return a&&C(),S(i),b(E)}function v(E){return t.parser.lazy[t.now().line]=i!==n.length,u=t.now().offset,_(E)}function b(E){return t.containerState={},e.attempt(z5,y,_)(E)}function y(E){return i++,n.push([t.currentConstruct,t.containerState]),b(E)}function _(E){if(E===null){a&&C(),S(0),e.consume(E);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:c}),j(E)}function j(E){if(E===null){N(e.exit("chunkFlow"),!0),S(0),e.consume(E);return}return qe(E)?(e.consume(E),N(e.exit("chunkFlow")),i=0,t.interrupt=void 0,h):(e.consume(E),j)}function N(E,R){const L=t.sliceStream(E);if(R&&L.push(null),E.previous=c,c&&(c.next=E),c=E,a.defineSkip(E.start),a.write(L),t.parser.lazy[E.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 F=t.events.length;let D=F,Q,I;for(;D--;)if(t.events[D][0]==="exit"&&t.events[D][1].type==="chunkFlow"){if(Q){I=t.events[D][1].end;break}Q=!0}for(S(i),O=F;O<t.events.length;)t.events[O][1].end={...I},O++;Ls(t.events,D+1,0,t.events.slice(F)),t.events.length=O}}function S(E){let R=n.length;for(;R-- >E;){const L=n[R];t.containerState=L[1],L[0].exit.call(t,e)}n.length=E}function C(){a.write([null]),c=void 0,a=void 0,t.containerState._closeFlow=void 0}}function m8(e,t,n){return _t(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ko(e){if(e===null||Pt(e)||al(e))return 1;if(Sf(e))return 2}function kf(e,t,n){const i=[];let a=-1;for(;++a<e.length;){const c=e[a].resolveAll;c&&!i.includes(c)&&(t=c(t,n),i.push(c))}return t}const ix={name:"attention",resolveAll:g8,tokenize:x8};function g8(e,t){let n=-1,i,a,c,u,h,f,m,x;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(i=n;i--;)if(e[i][0]==="exit"&&e[i][1].type==="attentionSequence"&&e[i][1]._open&&t.sliceSerialize(e[i][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[i][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;f=e[i][1].end.offset-e[i][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const v={...e[i][1].end},b={...e[n][1].start};$5(v,-f),$5(b,f),u={type:f>1?"strongSequence":"emphasisSequence",start:v,end:{...e[i][1].end}},h={type:f>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:b},c={type:f>1?"strongText":"emphasisText",start:{...e[i][1].end},end:{...e[n][1].start}},a={type:f>1?"strong":"emphasis",start:{...u.start},end:{...h.end}},e[i][1].end={...u.start},e[n][1].start={...h.end},m=[],e[i][1].end.offset-e[i][1].start.offset&&(m=Ys(m,[["enter",e[i][1],t],["exit",e[i][1],t]])),m=Ys(m,[["enter",a,t],["enter",u,t],["exit",u,t],["enter",c,t]]),m=Ys(m,kf(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),m=Ys(m,[["exit",c,t],["enter",h,t],["exit",h,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(x=2,m=Ys(m,[["enter",e[n][1],t],["exit",e[n][1],t]])):x=0,Ls(e,i-1,n-i+3,m),n=i+m.length-x-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function x8(e,t){const n=this.parser.constructs.attentionMarkers.null,i=this.previous,a=ko(i);let c;return u;function u(f){return c=f,e.enter("attentionSequence"),h(f)}function h(f){if(f===c)return e.consume(f),h;const m=e.exit("attentionSequence"),x=ko(f),v=!x||x===2&&a||n.includes(f),b=!a||a===2&&x||n.includes(i);return m._open=!!(c===42?v:v&&(a||!b)),m._close=!!(c===42?b:b&&(x||!v)),t(f)}}function $5(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const v8={name:"autolink",tokenize:b8};function b8(e,t,n){let i=0;return a;function a(y){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),c}function c(y){return ss(y)?(e.consume(y),u):y===64?n(y):m(y)}function u(y){return y===43||y===45||y===46||qn(y)?(i=1,h(y)):m(y)}function h(y){return y===58?(e.consume(y),i=0,f):(y===43||y===45||y===46||qn(y))&&i++<32?(e.consume(y),h):(i=0,m(y))}function f(y){return y===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):y===null||y===32||y===60||cf(y)?n(y):(e.consume(y),f)}function m(y){return y===64?(e.consume(y),x):o8(y)?(e.consume(y),m):n(y)}function x(y){return qn(y)?v(y):n(y)}function v(y){return y===46?(e.consume(y),i=0,x):y===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):b(y)}function b(y){if((y===45||qn(y))&&i++<63){const _=y===45?b:v;return e.consume(y),_}return n(y)}}const Lu={partial:!0,tokenize:y8};function y8(e,t,n){return i;function i(c){return dt(c)?_t(e,a,"linePrefix")(c):a(c)}function a(c){return c===null||qe(c)?t(c):n(c)}}const Rj={continuation:{tokenize:w8},exit:S8,name:"blockQuote",tokenize:_8};function _8(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"),c}return n(u)}function c(u){return dt(u)?(e.enter("blockQuotePrefixWhitespace"),e.consume(u),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(u))}}function w8(e,t,n){const i=this;return a;function a(u){return dt(u)?_t(e,c,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u):c(u)}function c(u){return e.attempt(Rj,t,n)(u)}}function S8(e){e.exit("blockQuote")}const Oj={name:"characterEscape",tokenize:k8};function k8(e,t,n){return i;function i(c){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(c),e.exit("escapeMarker"),a}function a(c){return u8(c)?(e.enter("characterEscapeValue"),e.consume(c),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(c)}}const Lj={name:"characterReference",tokenize:j8};function j8(e,t,n){const i=this;let a=0,c,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"),m):(e.enter("characterReferenceValue"),c=31,u=qn,x(v))}function m(v){return v===88||v===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(v),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),c=6,u=c8,x):(e.enter("characterReferenceValue"),c=7,u=sx,x(v))}function x(v){if(v===59&&a){const b=e.exit("characterReferenceValue");return u===qn&&!Qx(i.sliceSerialize(b))?n(v):(e.enter("characterReferenceMarker"),e.consume(v),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return u(v)&&a++<c?(e.consume(v),x):n(v)}}const B5={partial:!0,tokenize:C8},P5={concrete:!0,name:"codeFenced",tokenize:N8};function N8(e,t,n){const i=this,a={partial:!0,tokenize:L};let c=0,u=0,h;return f;function f(O){return m(O)}function m(O){const F=i.events[i.events.length-1];return c=F&&F[1].type==="linePrefix"?F[2].sliceSerialize(F[1],!0).length:0,h=O,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),x(O)}function x(O){return O===h?(u++,e.consume(O),x):u<3?n(O):(e.exit("codeFencedFenceSequence"),dt(O)?_t(e,v,"whitespace")(O):v(O))}function v(O){return O===null||qe(O)?(e.exit("codeFencedFence"),i.interrupt?t(O):e.check(B5,j,R)(O)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),b(O))}function b(O){return O===null||qe(O)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),v(O)):dt(O)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),_t(e,y,"whitespace")(O)):O===96&&O===h?n(O):(e.consume(O),b)}function y(O){return O===null||qe(O)?v(O):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),_(O))}function _(O){return O===null||qe(O)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),v(O)):O===96&&O===h?n(O):(e.consume(O),_)}function j(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 c>0&&dt(O)?_t(e,C,"linePrefix",c+1)(O):C(O)}function C(O){return O===null||qe(O)?e.check(B5,j,R)(O):(e.enter("codeFlowValue"),E(O))}function E(O){return O===null||qe(O)?(e.exit("codeFlowValue"),C(O)):(e.consume(O),E)}function R(O){return e.exit("codeFenced"),t(O)}function L(O,F,D){let Q=0;return I;function I(q){return O.enter("lineEnding"),O.consume(q),O.exit("lineEnding"),X}function X(q){return O.enter("codeFencedFence"),dt(q)?_t(O,M,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(q):M(q)}function M(q){return q===h?(O.enter("codeFencedFenceSequence"),de(q)):D(q)}function de(q){return q===h?(Q++,O.consume(q),de):Q>=u?(O.exit("codeFencedFenceSequence"),dt(q)?_t(O,W,"whitespace")(q):W(q)):D(q)}function W(q){return q===null||qe(q)?(O.exit("codeFencedFence"),F(q)):D(q)}}}function C8(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"),c)}function c(u){return i.parser.lazy[i.now().line]?n(u):t(u)}}const Xg={name:"codeIndented",tokenize:T8},E8={partial:!0,tokenize:A8};function T8(e,t,n){const i=this;return a;function a(m){return e.enter("codeIndented"),_t(e,c,"linePrefix",5)(m)}function c(m){const x=i.events[i.events.length-1];return x&&x[1].type==="linePrefix"&&x[2].sliceSerialize(x[1],!0).length>=4?u(m):n(m)}function u(m){return m===null?f(m):qe(m)?e.attempt(E8,u,f)(m):(e.enter("codeFlowValue"),h(m))}function h(m){return m===null||qe(m)?(e.exit("codeFlowValue"),u(m)):(e.consume(m),h)}function f(m){return e.exit("codeIndented"),t(m)}}function A8(e,t,n){const i=this;return a;function a(u){return i.parser.lazy[i.now().line]?n(u):qe(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),a):_t(e,c,"linePrefix",5)(u)}function c(u){const h=i.events[i.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?t(u):qe(u)?a(u):n(u)}}const M8={name:"codeText",previous:O8,resolve:R8,tokenize:L8};function R8(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 O8(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function L8(e,t,n){let i=0,a,c;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?(c=e.enter("codeTextSequence"),a=0,x(v)):qe(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),f):(e.enter("codeTextData"),m(v))}function m(v){return v===null||v===32||v===96||qe(v)?(e.exit("codeTextData"),f(v)):(e.consume(v),m)}function x(v){return v===96?(e.consume(v),a++,x):a===i?(e.exit("codeTextSequence"),e.exit("codeText"),t(v)):(c.type="codeTextData",m(v))}}class D8{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 c=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return i&&Yc(this.left,i),c.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Yc(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Yc(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);Yc(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Yc(this.left,n.reverse())}}}function Yc(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 Dj(e){const t={};let n=-1,i,a,c,u,h,f,m;const x=new D8(e);for(;++n<x.length;){for(;n in t;)n=t[n];if(i=x.get(n),n&&i[1].type==="chunkFlow"&&x.get(n-1)[1].type==="listItemPrefix"&&(f=i[1]._tokenizer.events,c=0,c<f.length&&f[c][1].type==="lineEndingBlank"&&(c+=2),c<f.length&&f[c][1].type==="content"))for(;++c<f.length&&f[c][1].type!=="content";)f[c][1].type==="chunkText"&&(f[c][1]._isInFirstContentOfListItem=!0,c++);if(i[0]==="enter")i[1].contentType&&(Object.assign(t,z8(x,n)),n=t[n],m=!0);else if(i[1]._container){for(c=n,a=void 0;c--;)if(u=x.get(c),u[1].type==="lineEnding"||u[1].type==="lineEndingBlank")u[0]==="enter"&&(a&&(x.get(a)[1].type="lineEndingBlank"),u[1].type="lineEnding",a=c);else if(!(u[1].type==="linePrefix"||u[1].type==="listItemIndent"))break;a&&(i[1].end={...x.get(a)[1].start},h=x.slice(a,n),h.unshift(i),x.splice(a,n-a+1,h))}}return Ls(e,0,Number.POSITIVE_INFINITY,x.slice(0)),!m}function z8(e,t){const n=e.get(t)[1],i=e.get(t)[2];let a=t-1;const c=[];let u=n._tokenizer;u||(u=i.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(u._contentTypeTextTrailing=!0));const h=u.events,f=[],m={};let x,v,b=-1,y=n,_=0,j=0;const N=[j];for(;y;){for(;e.get(++a)[1]!==y;);c.push(a),y._tokenizer||(x=i.sliceStream(y),y.next||x.push(null),v&&u.defineSkip(y.start),y._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=!0),u.write(x),y._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=void 0)),v=y,y=y.next}for(y=n;++b<h.length;)h[b][0]==="exit"&&h[b-1][0]==="enter"&&h[b][1].type===h[b-1][1].type&&h[b][1].start.line!==h[b][1].end.line&&(j=b+1,N.push(j),y._tokenizer=void 0,y.previous=void 0,y=y.next);for(u.events=[],y?(y._tokenizer=void 0,y.previous=void 0):N.pop(),b=N.length;b--;){const S=h.slice(N[b],N[b+1]),C=c.pop();f.push([C,C+S.length-1]),e.splice(C,2,S)}for(f.reverse(),b=-1;++b<f.length;)m[_+f[b][0]]=_+f[b][1],_+=f[b][1]-f[b][0]-1;return m}const $8={resolve:P8,tokenize:I8},B8={partial:!0,tokenize:F8};function P8(e){return Dj(e),e}function I8(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?c(h):qe(h)?e.check(B8,u,c)(h):(e.consume(h),a)}function c(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 F8(e,t,n){const i=this;return a;function a(u){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),_t(e,c,"linePrefix")}function c(u){if(u===null||qe(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 zj(e,t,n,i,a,c,u,h,f){const m=f||Number.POSITIVE_INFINITY;let x=0;return v;function v(S){return S===60?(e.enter(i),e.enter(a),e.enter(c),e.consume(S),e.exit(c),b):S===null||S===32||S===41||cf(S)?n(S):(e.enter(i),e.enter(u),e.enter(h),e.enter("chunkString",{contentType:"string"}),j(S))}function b(S){return S===62?(e.enter(c),e.consume(S),e.exit(c),e.exit(a),e.exit(i),t):(e.enter(h),e.enter("chunkString",{contentType:"string"}),y(S))}function y(S){return S===62?(e.exit("chunkString"),e.exit(h),b(S)):S===null||S===60||qe(S)?n(S):(e.consume(S),S===92?_:y)}function _(S){return S===60||S===62||S===92?(e.consume(S),y):y(S)}function j(S){return!x&&(S===null||S===41||Pt(S))?(e.exit("chunkString"),e.exit(h),e.exit(u),e.exit(i),t(S)):x<m&&S===40?(e.consume(S),x++,j):S===41?(e.consume(S),x--,j):S===null||S===32||S===40||cf(S)?n(S):(e.consume(S),S===92?N:j)}function N(S){return S===40||S===41||S===92?(e.consume(S),j):j(S)}}function $j(e,t,n,i,a,c){const u=this;let h=0,f;return m;function m(y){return e.enter(i),e.enter(a),e.consume(y),e.exit(a),e.enter(c),x}function x(y){return h>999||y===null||y===91||y===93&&!f||y===94&&!h&&"_hiddenFootnoteSupport"in u.parser.constructs?n(y):y===93?(e.exit(c),e.enter(a),e.consume(y),e.exit(a),e.exit(i),t):qe(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),x):(e.enter("chunkString",{contentType:"string"}),v(y))}function v(y){return y===null||y===91||y===93||qe(y)||h++>999?(e.exit("chunkString"),x(y)):(e.consume(y),f||(f=!dt(y)),y===92?b:v)}function b(y){return y===91||y===92||y===93?(e.consume(y),h++,v):v(y)}}function Bj(e,t,n,i,a,c){let u;return h;function h(b){return b===34||b===39||b===40?(e.enter(i),e.enter(a),e.consume(b),e.exit(a),u=b===40?41:b,f):n(b)}function f(b){return b===u?(e.enter(a),e.consume(b),e.exit(a),e.exit(i),t):(e.enter(c),m(b))}function m(b){return b===u?(e.exit(c),f(u)):b===null?n(b):qe(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),_t(e,m,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),x(b))}function x(b){return b===u||b===null||qe(b)?(e.exit("chunkString"),m(b)):(e.consume(b),b===92?v:x)}function v(b){return b===u||b===92?(e.consume(b),x):x(b)}}function fu(e,t){let n;return i;function i(a){return qe(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,i):dt(a)?_t(e,i,n?"linePrefix":"lineSuffix")(a):t(a)}}const U8={name:"definition",tokenize:q8},H8={partial:!0,tokenize:V8};function q8(e,t,n){const i=this;let a;return c;function c(y){return e.enter("definition"),u(y)}function u(y){return $j.call(i,e,h,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function h(y){return a=hi(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),f):n(y)}function f(y){return Pt(y)?fu(e,m)(y):m(y)}function m(y){return zj(e,x,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function x(y){return e.attempt(H8,v,v)(y)}function v(y){return dt(y)?_t(e,b,"whitespace")(y):b(y)}function b(y){return y===null||qe(y)?(e.exit("definition"),i.parser.defined.push(a),t(y)):n(y)}}function V8(e,t,n){return i;function i(h){return Pt(h)?fu(e,a)(h):n(h)}function a(h){return Bj(e,c,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(h)}function c(h){return dt(h)?_t(e,u,"whitespace")(h):u(h)}function u(h){return h===null||qe(h)?t(h):n(h)}}const G8={name:"hardBreakEscape",tokenize:Y8};function Y8(e,t,n){return i;function i(c){return e.enter("hardBreakEscape"),e.consume(c),a}function a(c){return qe(c)?(e.exit("hardBreakEscape"),t(c)):n(c)}}const X8={name:"headingAtx",resolve:Q8,tokenize:W8};function Q8(e,t){let n=e.length-2,i=3,a,c;return e[i][1].type==="whitespace"&&(i+=2),n-2>i&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(i===n-1||n-4>i&&e[n-2][1].type==="whitespace")&&(n-=i+1===n?2:4),n>i&&(a={type:"atxHeadingText",start:e[i][1].start,end:e[n][1].end},c={type:"chunkText",start:e[i][1].start,end:e[n][1].end,contentType:"text"},Ls(e,i,n-i+1,[["enter",a,t],["enter",c,t],["exit",c,t],["exit",a,t]])),e}function W8(e,t,n){let i=0;return a;function a(x){return e.enter("atxHeading"),c(x)}function c(x){return e.enter("atxHeadingSequence"),u(x)}function u(x){return x===35&&i++<6?(e.consume(x),u):x===null||Pt(x)?(e.exit("atxHeadingSequence"),h(x)):n(x)}function h(x){return x===35?(e.enter("atxHeadingSequence"),f(x)):x===null||qe(x)?(e.exit("atxHeading"),t(x)):dt(x)?_t(e,h,"whitespace")(x):(e.enter("atxHeadingText"),m(x))}function f(x){return x===35?(e.consume(x),f):(e.exit("atxHeadingSequence"),h(x))}function m(x){return x===null||x===35||Pt(x)?(e.exit("atxHeadingText"),h(x)):(e.consume(x),m)}}const K8=["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"],I5=["pre","script","style","textarea"],Z8={concrete:!0,name:"htmlFlow",resolveTo:tO,tokenize:nO},J8={partial:!0,tokenize:iO},eO={partial:!0,tokenize:sO};function tO(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 nO(e,t,n){const i=this;let a,c,u,h,f;return m;function m(z){return x(z)}function x(z){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(z),v}function v(z){return z===33?(e.consume(z),b):z===47?(e.consume(z),c=!0,j):z===63?(e.consume(z),a=3,i.interrupt?t:A):ss(z)?(e.consume(z),u=String.fromCharCode(z),N):n(z)}function b(z){return z===45?(e.consume(z),a=2,y):z===91?(e.consume(z),a=5,h=0,_):ss(z)?(e.consume(z),a=4,i.interrupt?t:A):n(z)}function y(z){return z===45?(e.consume(z),i.interrupt?t:A):n(z)}function _(z){const P="CDATA[";return z===P.charCodeAt(h++)?(e.consume(z),h===P.length?i.interrupt?t:M:_):n(z)}function j(z){return ss(z)?(e.consume(z),u=String.fromCharCode(z),N):n(z)}function N(z){if(z===null||z===47||z===62||Pt(z)){const P=z===47,oe=u.toLowerCase();return!P&&!c&&I5.includes(oe)?(a=1,i.interrupt?t(z):M(z)):K8.includes(u.toLowerCase())?(a=6,P?(e.consume(z),S):i.interrupt?t(z):M(z)):(a=7,i.interrupt&&!i.parser.lazy[i.now().line]?n(z):c?C(z):E(z))}return z===45||qn(z)?(e.consume(z),u+=String.fromCharCode(z),N):n(z)}function S(z){return z===62?(e.consume(z),i.interrupt?t:M):n(z)}function C(z){return dt(z)?(e.consume(z),C):I(z)}function E(z){return z===47?(e.consume(z),I):z===58||z===95||ss(z)?(e.consume(z),R):dt(z)?(e.consume(z),E):I(z)}function R(z){return z===45||z===46||z===58||z===95||qn(z)?(e.consume(z),R):L(z)}function L(z){return z===61?(e.consume(z),O):dt(z)?(e.consume(z),L):E(z)}function O(z){return z===null||z===60||z===61||z===62||z===96?n(z):z===34||z===39?(e.consume(z),f=z,F):dt(z)?(e.consume(z),O):D(z)}function F(z){return z===f?(e.consume(z),f=null,Q):z===null||qe(z)?n(z):(e.consume(z),F)}function D(z){return z===null||z===34||z===39||z===47||z===60||z===61||z===62||z===96||Pt(z)?L(z):(e.consume(z),D)}function Q(z){return z===47||z===62||dt(z)?E(z):n(z)}function I(z){return z===62?(e.consume(z),X):n(z)}function X(z){return z===null||qe(z)?M(z):dt(z)?(e.consume(z),X):n(z)}function M(z){return z===45&&a===2?(e.consume(z),H):z===60&&a===1?(e.consume(z),U):z===62&&a===4?(e.consume(z),Ee):z===63&&a===3?(e.consume(z),A):z===93&&a===5?(e.consume(z),ve):qe(z)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(J8,Me,de)(z)):z===null||qe(z)?(e.exit("htmlFlowData"),de(z)):(e.consume(z),M)}function de(z){return e.check(eO,W,Me)(z)}function W(z){return e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),q}function q(z){return z===null||qe(z)?de(z):(e.enter("htmlFlowData"),M(z))}function H(z){return z===45?(e.consume(z),A):M(z)}function U(z){return z===47?(e.consume(z),u="",re):M(z)}function re(z){if(z===62){const P=u.toLowerCase();return I5.includes(P)?(e.consume(z),Ee):M(z)}return ss(z)&&u.length<8?(e.consume(z),u+=String.fromCharCode(z),re):M(z)}function ve(z){return z===93?(e.consume(z),A):M(z)}function A(z){return z===62?(e.consume(z),Ee):z===45&&a===2?(e.consume(z),A):M(z)}function Ee(z){return z===null||qe(z)?(e.exit("htmlFlowData"),Me(z)):(e.consume(z),Ee)}function Me(z){return e.exit("htmlFlow"),t(z)}}function sO(e,t,n){const i=this;return a;function a(u){return qe(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),c):n(u)}function c(u){return i.parser.lazy[i.now().line]?n(u):t(u)}}function iO(e,t,n){return i;function i(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(Lu,t,n)}}const rO={name:"htmlText",tokenize:aO};function aO(e,t,n){const i=this;let a,c,u;return h;function h(A){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(A),f}function f(A){return A===33?(e.consume(A),m):A===47?(e.consume(A),L):A===63?(e.consume(A),E):ss(A)?(e.consume(A),D):n(A)}function m(A){return A===45?(e.consume(A),x):A===91?(e.consume(A),c=0,_):ss(A)?(e.consume(A),C):n(A)}function x(A){return A===45?(e.consume(A),y):n(A)}function v(A){return A===null?n(A):A===45?(e.consume(A),b):qe(A)?(u=v,U(A)):(e.consume(A),v)}function b(A){return A===45?(e.consume(A),y):v(A)}function y(A){return A===62?H(A):A===45?b(A):v(A)}function _(A){const Ee="CDATA[";return A===Ee.charCodeAt(c++)?(e.consume(A),c===Ee.length?j:_):n(A)}function j(A){return A===null?n(A):A===93?(e.consume(A),N):qe(A)?(u=j,U(A)):(e.consume(A),j)}function N(A){return A===93?(e.consume(A),S):j(A)}function S(A){return A===62?H(A):A===93?(e.consume(A),S):j(A)}function C(A){return A===null||A===62?H(A):qe(A)?(u=C,U(A)):(e.consume(A),C)}function E(A){return A===null?n(A):A===63?(e.consume(A),R):qe(A)?(u=E,U(A)):(e.consume(A),E)}function R(A){return A===62?H(A):E(A)}function L(A){return ss(A)?(e.consume(A),O):n(A)}function O(A){return A===45||qn(A)?(e.consume(A),O):F(A)}function F(A){return qe(A)?(u=F,U(A)):dt(A)?(e.consume(A),F):H(A)}function D(A){return A===45||qn(A)?(e.consume(A),D):A===47||A===62||Pt(A)?Q(A):n(A)}function Q(A){return A===47?(e.consume(A),H):A===58||A===95||ss(A)?(e.consume(A),I):qe(A)?(u=Q,U(A)):dt(A)?(e.consume(A),Q):H(A)}function I(A){return A===45||A===46||A===58||A===95||qn(A)?(e.consume(A),I):X(A)}function X(A){return A===61?(e.consume(A),M):qe(A)?(u=X,U(A)):dt(A)?(e.consume(A),X):Q(A)}function M(A){return A===null||A===60||A===61||A===62||A===96?n(A):A===34||A===39?(e.consume(A),a=A,de):qe(A)?(u=M,U(A)):dt(A)?(e.consume(A),M):(e.consume(A),W)}function de(A){return A===a?(e.consume(A),a=void 0,q):A===null?n(A):qe(A)?(u=de,U(A)):(e.consume(A),de)}function W(A){return A===null||A===34||A===39||A===60||A===61||A===96?n(A):A===47||A===62||Pt(A)?Q(A):(e.consume(A),W)}function q(A){return A===47||A===62||Pt(A)?Q(A):n(A)}function H(A){return A===62?(e.consume(A),e.exit("htmlTextData"),e.exit("htmlText"),t):n(A)}function U(A){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),re}function re(A){return dt(A)?_t(e,ve,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(A):ve(A)}function ve(A){return e.enter("htmlTextData"),u(A)}}const Wx={name:"labelEnd",resolveAll:uO,resolveTo:dO,tokenize:hO},lO={tokenize:fO},oO={tokenize:pO},cO={tokenize:mO};function uO(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&&Ls(e,0,e.length,n),e}function dO(e,t){let n=e.length,i=0,a,c,u,h;for(;n--;)if(a=e[n][1],c){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(u){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(c=n,a.type!=="labelLink")){i=2;break}}else a.type==="labelEnd"&&(u=n);const f={type:e[c][1].type==="labelLink"?"link":"image",start:{...e[c][1].start},end:{...e[e.length-1][1].end}},m={type:"label",start:{...e[c][1].start},end:{...e[u][1].end}},x={type:"labelText",start:{...e[c+i+2][1].end},end:{...e[u-2][1].start}};return h=[["enter",f,t],["enter",m,t]],h=Ys(h,e.slice(c+1,c+i+3)),h=Ys(h,[["enter",x,t]]),h=Ys(h,kf(t.parser.constructs.insideSpan.null,e.slice(c+i+4,u-3),t)),h=Ys(h,[["exit",x,t],e[u-2],e[u-1],["exit",m,t]]),h=Ys(h,e.slice(u+1)),h=Ys(h,[["exit",f,t]]),Ls(e,c,e.length,h),e}function hO(e,t,n){const i=this;let a=i.events.length,c,u;for(;a--;)if((i.events[a][1].type==="labelImage"||i.events[a][1].type==="labelLink")&&!i.events[a][1]._balanced){c=i.events[a][1];break}return h;function h(b){return c?c._inactive?v(b):(u=i.parser.defined.includes(hi(i.sliceSerialize({start:c.end,end:i.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(b),e.exit("labelMarker"),e.exit("labelEnd"),f):n(b)}function f(b){return b===40?e.attempt(lO,x,u?x:v)(b):b===91?e.attempt(oO,x,u?m:v)(b):u?x(b):v(b)}function m(b){return e.attempt(cO,x,v)(b)}function x(b){return t(b)}function v(b){return c._balanced=!0,n(b)}}function fO(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 Pt(v)?fu(e,c)(v):c(v)}function c(v){return v===41?x(v):zj(e,u,h,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(v)}function u(v){return Pt(v)?fu(e,f)(v):x(v)}function h(v){return n(v)}function f(v){return v===34||v===39||v===40?Bj(e,m,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(v):x(v)}function m(v){return Pt(v)?fu(e,x)(v):x(v)}function x(v){return v===41?(e.enter("resourceMarker"),e.consume(v),e.exit("resourceMarker"),e.exit("resource"),t):n(v)}}function pO(e,t,n){const i=this;return a;function a(h){return $j.call(i,e,c,u,"reference","referenceMarker","referenceString")(h)}function c(h){return i.parser.defined.includes(hi(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?t(h):n(h)}function u(h){return n(h)}}function mO(e,t,n){return i;function i(c){return e.enter("reference"),e.enter("referenceMarker"),e.consume(c),e.exit("referenceMarker"),a}function a(c){return c===93?(e.enter("referenceMarker"),e.consume(c),e.exit("referenceMarker"),e.exit("reference"),t):n(c)}}const gO={name:"labelStartImage",resolveAll:Wx.resolveAll,tokenize:xO};function xO(e,t,n){const i=this;return a;function a(h){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(h),e.exit("labelImageMarker"),c}function c(h){return h===91?(e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),e.exit("labelImage"),u):n(h)}function u(h){return h===94&&"_hiddenFootnoteSupport"in i.parser.constructs?n(h):t(h)}}const vO={name:"labelStartLink",resolveAll:Wx.resolveAll,tokenize:bO};function bO(e,t,n){const i=this;return a;function a(u){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),e.exit("labelLink"),c}function c(u){return u===94&&"_hiddenFootnoteSupport"in i.parser.constructs?n(u):t(u)}}const Qg={name:"lineEnding",tokenize:yO};function yO(e,t){return n;function n(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),_t(e,t,"linePrefix")}}const $h={name:"thematicBreak",tokenize:_O};function _O(e,t,n){let i=0,a;return c;function c(m){return e.enter("thematicBreak"),u(m)}function u(m){return a=m,h(m)}function h(m){return m===a?(e.enter("thematicBreakSequence"),f(m)):i>=3&&(m===null||qe(m))?(e.exit("thematicBreak"),t(m)):n(m)}function f(m){return m===a?(e.consume(m),i++,f):(e.exit("thematicBreakSequence"),dt(m)?_t(e,h,"whitespace")(m):h(m))}}const ps={continuation:{tokenize:jO},exit:CO,name:"list",tokenize:kO},wO={partial:!0,tokenize:EO},SO={partial:!0,tokenize:NO};function kO(e,t,n){const i=this,a=i.events[i.events.length-1];let c=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,u=0;return h;function h(y){const _=i.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(_==="listUnordered"?!i.containerState.marker||y===i.containerState.marker:sx(y)){if(i.containerState.type||(i.containerState.type=_,e.enter(_,{_container:!0})),_==="listUnordered")return e.enter("listItemPrefix"),y===42||y===45?e.check($h,n,m)(y):m(y);if(!i.interrupt||y===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),f(y)}return n(y)}function f(y){return sx(y)&&++u<10?(e.consume(y),f):(!i.interrupt||u<2)&&(i.containerState.marker?y===i.containerState.marker:y===41||y===46)?(e.exit("listItemValue"),m(y)):n(y)}function m(y){return e.enter("listItemMarker"),e.consume(y),e.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||y,e.check(Lu,i.interrupt?n:x,e.attempt(wO,b,v))}function x(y){return i.containerState.initialBlankLine=!0,c++,b(y)}function v(y){return dt(y)?(e.enter("listItemPrefixWhitespace"),e.consume(y),e.exit("listItemPrefixWhitespace"),b):n(y)}function b(y){return i.containerState.size=c+i.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(y)}}function jO(e,t,n){const i=this;return i.containerState._closeFlow=void 0,e.check(Lu,a,c);function a(h){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,_t(e,t,"listItemIndent",i.containerState.size+1)(h)}function c(h){return i.containerState.furtherBlankLines||!dt(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(SO,t,u)(h))}function u(h){return i.containerState._closeFlow=!0,i.interrupt=void 0,_t(e,e.attempt(ps,t,n),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(h)}}function NO(e,t,n){const i=this;return _t(e,a,"listItemIndent",i.containerState.size+1);function a(c){const u=i.events[i.events.length-1];return u&&u[1].type==="listItemIndent"&&u[2].sliceSerialize(u[1],!0).length===i.containerState.size?t(c):n(c)}}function CO(e){e.exit(this.containerState.type)}function EO(e,t,n){const i=this;return _t(e,a,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(c){const u=i.events[i.events.length-1];return!dt(c)&&u&&u[1].type==="listItemPrefixWhitespace"?t(c):n(c)}}const F5={name:"setextUnderline",resolveTo:TO,tokenize:AO};function TO(e,t){let n=e.length,i,a,c;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){i=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!c&&e[n][1].type==="definition"&&(c=n);const u={type:"setextHeading",start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",c?(e.splice(a,0,["enter",u,t]),e.splice(c+1,0,["exit",e[i][1],t]),e[i][1].end={...e[c][1].end}):e[i][1]=u,e.push(["exit",u,t]),e}function AO(e,t,n){const i=this;let a;return c;function c(m){let x=i.events.length,v;for(;x--;)if(i.events[x][1].type!=="lineEnding"&&i.events[x][1].type!=="linePrefix"&&i.events[x][1].type!=="content"){v=i.events[x][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||v)?(e.enter("setextHeadingLine"),a=m,u(m)):n(m)}function u(m){return e.enter("setextHeadingLineSequence"),h(m)}function h(m){return m===a?(e.consume(m),h):(e.exit("setextHeadingLineSequence"),dt(m)?_t(e,f,"lineSuffix")(m):f(m))}function f(m){return m===null||qe(m)?(e.exit("setextHeadingLine"),t(m)):n(m)}}const MO={tokenize:RO};function RO(e){const t=this,n=e.attempt(Lu,i,e.attempt(this.parser.constructs.flowInitial,a,_t(e,e.attempt(this.parser.constructs.flow,a,e.attempt($8,a)),"linePrefix")));return n;function i(c){if(c===null){e.consume(c);return}return e.enter("lineEndingBlank"),e.consume(c),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const OO={resolveAll:Ij()},LO=Pj("string"),DO=Pj("text");function Pj(e){return{resolveAll:Ij(e==="text"?zO:void 0),tokenize:t};function t(n){const i=this,a=this.parser.constructs[e],c=n.attempt(a,u,h);return u;function u(x){return m(x)?c(x):h(x)}function h(x){if(x===null){n.consume(x);return}return n.enter("data"),n.consume(x),f}function f(x){return m(x)?(n.exit("data"),c(x)):(n.consume(x),f)}function m(x){if(x===null)return!0;const v=a[x];let b=-1;if(v)for(;++b<v.length;){const y=v[b];if(!y.previous||y.previous.call(i,i.previous))return!0}return!1}}}function Ij(e){return t;function t(n,i){let a=-1,c;for(;++a<=n.length;)c===void 0?n[a]&&n[a][1].type==="data"&&(c=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==c+2&&(n[c][1].end=n[a-1][1].end,n.splice(c+2,a-c-2),a=c+2),c=void 0);return e?e(n,i):n}}function zO(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const i=e[n-1][1],a=t.sliceStream(i);let c=a.length,u=-1,h=0,f;for(;c--;){const m=a[c];if(typeof m=="string"){for(u=m.length;m.charCodeAt(u-1)===32;)h++,u--;if(u)break;u=-1}else if(m===-2)f=!0,h++;else if(m!==-1){c++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(h=0),h){const m={type:n===e.length||f||h<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:c?u:i.start._bufferIndex+u,_index:i.start._index+c,line:i.end.line,column:i.end.column-h,offset:i.end.offset-h},end:{...i.end}};i.end={...m.start},i.start.offset===i.end.offset?Object.assign(i,m):(e.splice(n,0,["enter",m,t],["exit",m,t]),n+=2)}n++}return e}const $O={42:ps,43:ps,45:ps,48:ps,49:ps,50:ps,51:ps,52:ps,53:ps,54:ps,55:ps,56:ps,57:ps,62:Rj},BO={91:U8},PO={[-2]:Xg,[-1]:Xg,32:Xg},IO={35:X8,42:$h,45:[F5,$h],60:Z8,61:F5,95:$h,96:P5,126:P5},FO={38:Lj,92:Oj},UO={[-5]:Qg,[-4]:Qg,[-3]:Qg,33:gO,38:Lj,42:ix,60:[v8,rO],91:vO,92:[G8,Oj],93:Wx,95:ix,96:M8},HO={null:[ix,OO]},qO={null:[42,95]},VO={null:[]},GO=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:qO,contentInitial:BO,disable:VO,document:$O,flow:IO,flowInitial:PO,insideSpan:HO,string:FO,text:UO},Symbol.toStringTag,{value:"Module"}));function YO(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={},c=[];let u=[],h=[];const f={attempt:F(L),check:F(O),consume:C,enter:E,exit:R,interrupt:F(O,{interrupt:!0})},m={code:null,containerState:{},defineSkip:j,events:[],now:_,parser:e,previous:null,sliceSerialize:b,sliceStream:y,write:v};let x=t.tokenize.call(m,f);return t.resolveAll&&c.push(t),m;function v(X){return u=Ys(u,X),N(),u[u.length-1]!==null?[]:(D(t,0),m.events=kf(c,m.events,m),m.events)}function b(X,M){return QO(y(X),M)}function y(X){return XO(u,X)}function _(){const{_bufferIndex:X,_index:M,line:de,column:W,offset:q}=i;return{_bufferIndex:X,_index:M,line:de,column:W,offset:q}}function j(X){a[X.line]=X.column,I()}function N(){let X;for(;i._index<u.length;){const M=u[i._index];if(typeof M=="string")for(X=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===X&&i._bufferIndex<M.length;)S(M.charCodeAt(i._bufferIndex));else S(M)}}function S(X){x=x(X)}function C(X){qe(X)?(i.line++,i.column=1,i.offset+=X===-3?2:1,I()):X!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===u[i._index].length&&(i._bufferIndex=-1,i._index++)),m.previous=X}function E(X,M){const de=M||{};return de.type=X,de.start=_(),m.events.push(["enter",de,m]),h.push(de),de}function R(X){const M=h.pop();return M.end=_(),m.events.push(["exit",M,m]),M}function L(X,M){D(X,M.from)}function O(X,M){M.restore()}function F(X,M){return de;function de(W,q,H){let U,re,ve,A;return Array.isArray(W)?Me(W):"tokenize"in W?Me([W]):Ee(W);function Ee(_e){return Ne;function Ne(Ae){const Le=Ae!==null&&_e[Ae],De=Ae!==null&&_e.null,Ce=[...Array.isArray(Le)?Le:Le?[Le]:[],...Array.isArray(De)?De:De?[De]:[]];return Me(Ce)(Ae)}}function Me(_e){return U=_e,re=0,_e.length===0?H:z(_e[re])}function z(_e){return Ne;function Ne(Ae){return A=Q(),ve=_e,_e.partial||(m.currentConstruct=_e),_e.name&&m.parser.constructs.disable.null.includes(_e.name)?oe():_e.tokenize.call(M?Object.assign(Object.create(m),M):m,f,P,oe)(Ae)}}function P(_e){return X(ve,A),q}function oe(_e){return A.restore(),++re<U.length?z(U[re]):H}}}function D(X,M){X.resolveAll&&!c.includes(X)&&c.push(X),X.resolve&&Ls(m.events,M,m.events.length-M,X.resolve(m.events.slice(M),m)),X.resolveTo&&(m.events=X.resolveTo(m.events,m))}function Q(){const X=_(),M=m.previous,de=m.currentConstruct,W=m.events.length,q=Array.from(h);return{from:W,restore:H};function H(){i=X,m.previous=M,m.currentConstruct=de,m.events.length=W,h=q,I()}}function I(){i.line in a&&i.column<2&&(i.column=a[i.line],i.offset+=a[i.line]-1)}}function XO(e,t){const n=t.start._index,i=t.start._bufferIndex,a=t.end._index,c=t.end._bufferIndex;let u;if(n===a)u=[e[n].slice(i,c)];else{if(u=e.slice(n,a),i>-1){const h=u[0];typeof h=="string"?u[0]=h.slice(i):u.shift()}c>0&&u.push(e[a].slice(0,c))}return u}function QO(e,t){let n=-1;const i=[];let a;for(;++n<e.length;){const c=e[n];let u;if(typeof c=="string")u=c;else switch(c){case-5:{u="\r";break}case-4:{u=`
|
|
73
|
+
`;break}case-3:{u=`\r
|
|
74
|
+
`;break}case-2:{u=t?" ":" ";break}case-1:{if(!t&&a)continue;u=" ";break}default:u=String.fromCharCode(c)}a=c===-2,i.push(u)}return i.join("")}function WO(e){const i={constructs:Aj([GO,...(e||{}).extensions||[]]),content:a(d8),defined:[],document:a(f8),flow:a(MO),lazy:{},string:a(LO),text:a(DO)};return i;function a(c){return u;function u(h){return YO(i,c,h)}}}function KO(e){for(;!Dj(e););return e}const U5=/[\0\t\n\r]/g;function ZO(){let e=1,t="",n=!0,i;return a;function a(c,u,h){const f=[];let m,x,v,b,y;for(c=t+(typeof c=="string"?c.toString():new TextDecoder(u||void 0).decode(c)),v=0,t="",n&&(c.charCodeAt(0)===65279&&v++,n=void 0);v<c.length;){if(U5.lastIndex=v,m=U5.exec(c),b=m&&m.index!==void 0?m.index:c.length,y=c.charCodeAt(b),!m){t=c.slice(v);break}if(y===10&&v===b&&i)f.push(-3),i=void 0;else switch(i&&(f.push(-5),i=void 0),v<b&&(f.push(c.slice(v,b)),e+=b-v),y){case 0:{f.push(65533),e++;break}case 9:{for(x=Math.ceil(e/4)*4,f.push(-2);e++<x;)f.push(-1);break}case 10:{f.push(-4),e=1;break}default:i=!0,e=1}v=b+1}return h&&(i&&f.push(-5),t&&f.push(t),f.push(null)),f}}const JO=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function e7(e){return e.replace(JO,t7)}function t7(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),c=a===120||a===88;return Mj(n.slice(c?2:1),c?16:10)}return Qx(n)||e}const Fj={}.hasOwnProperty;function n7(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),s7(n)(KO(WO(n).document().write(ZO()(e,t,!0))))}function s7(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:c(St),autolinkProtocol:Q,autolinkEmail:Q,atxHeading:c(Ft),blockQuote:c(De),characterEscape:Q,characterReference:Q,codeFenced:c(Ce),codeFencedFenceInfo:u,codeFencedFenceMeta:u,codeIndented:c(Ce,u),codeText:c(Re,u),codeTextData:Q,data:Q,codeFlowValue:Q,definition:c(It),definitionDestinationString:u,definitionLabelString:u,definitionTitleString:u,emphasis:c(Wt),hardBreakEscape:c(Nt),hardBreakTrailing:c(Nt),htmlFlow:c(wt,u),htmlFlowData:Q,htmlText:c(wt,u),htmlTextData:Q,image:c(Qe),label:u,link:c(St),listItem:c(se),listItemValue:b,listOrdered:c(nn,v),listUnordered:c(nn),paragraph:c(je),reference:z,referenceString:u,resourceDestinationString:u,resourceTitleString:u,setextHeading:c(Ft),strong:c(Xe),thematicBreak:c(un)},exit:{atxHeading:f(),atxHeadingSequence:L,autolink:f(),autolinkEmail:Le,autolinkProtocol:Ae,blockQuote:f(),characterEscapeValue:I,characterReferenceMarkerHexadecimal:oe,characterReferenceMarkerNumeric:oe,characterReferenceValue:_e,characterReference:Ne,codeFenced:f(N),codeFencedFence:j,codeFencedFenceInfo:y,codeFencedFenceMeta:_,codeFlowValue:I,codeIndented:f(S),codeText:f(q),codeTextData:I,data:I,definition:f(),definitionDestinationString:R,definitionLabelString:C,definitionTitleString:E,emphasis:f(),hardBreakEscape:f(M),hardBreakTrailing:f(M),htmlFlow:f(de),htmlFlowData:I,htmlText:f(W),htmlTextData:I,image:f(U),label:ve,labelText:re,lineEnding:X,link:f(H),listItem:f(),listOrdered:f(),listUnordered:f(),paragraph:f(),referenceString:P,resourceDestinationString:A,resourceTitleString:Ee,resource:Me,setextHeading:f(D),setextHeadingLineSequence:F,setextHeadingText:O,strong:f(),thematicBreak:f()}};Uj(t,(e||{}).mdastExtensions||[]);const n={};return i;function i(ce){let be={type:"root",children:[]};const G={stack:[be],tokenStack:[],config:t,enter:h,exit:m,buffer:u,resume:x,data:n},me=[];let Pe=-1;for(;++Pe<ce.length;)if(ce[Pe][1].type==="listOrdered"||ce[Pe][1].type==="listUnordered")if(ce[Pe][0]==="enter")me.push(Pe);else{const Ke=me.pop();Pe=a(ce,Ke,Pe)}for(Pe=-1;++Pe<ce.length;){const Ke=t[ce[Pe][0]];Fj.call(Ke,ce[Pe][1].type)&&Ke[ce[Pe][1].type].call(Object.assign({sliceSerialize:ce[Pe][2].sliceSerialize},G),ce[Pe][1])}if(G.tokenStack.length>0){const Ke=G.tokenStack[G.tokenStack.length-1];(Ke[1]||H5).call(G,void 0,Ke[0])}for(be.position={start:ea(ce.length>0?ce[0][1].start:{line:1,column:1,offset:0}),end:ea(ce.length>0?ce[ce.length-2][1].end:{line:1,column:1,offset:0})},Pe=-1;++Pe<t.transforms.length;)be=t.transforms[Pe](be)||be;return be}function a(ce,be,G){let me=be-1,Pe=-1,Ke=!1,at,ht,fn,is;for(;++me<=G;){const Ct=ce[me];switch(Ct[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ct[0]==="enter"?Pe++:Pe--,is=void 0;break}case"lineEndingBlank":{Ct[0]==="enter"&&(at&&!is&&!Pe&&!fn&&(fn=me),is=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:is=void 0}if(!Pe&&Ct[0]==="enter"&&Ct[1].type==="listItemPrefix"||Pe===-1&&Ct[0]==="exit"&&(Ct[1].type==="listUnordered"||Ct[1].type==="listOrdered")){if(at){let vs=me;for(ht=void 0;vs--;){const In=ce[vs];if(In[1].type==="lineEnding"||In[1].type==="lineEndingBlank"){if(In[0]==="exit")continue;ht&&(ce[ht][1].type="lineEndingBlank",Ke=!0),In[1].type="lineEnding",ht=vs}else if(!(In[1].type==="linePrefix"||In[1].type==="blockQuotePrefix"||In[1].type==="blockQuotePrefixWhitespace"||In[1].type==="blockQuoteMarker"||In[1].type==="listItemIndent"))break}fn&&(!ht||fn<ht)&&(at._spread=!0),at.end=Object.assign({},ht?ce[ht][1].start:Ct[1].end),ce.splice(ht||me,0,["exit",at,Ct[2]]),me++,G++}if(Ct[1].type==="listItemPrefix"){const vs={type:"listItem",_spread:!1,start:Object.assign({},Ct[1].start),end:void 0};at=vs,ce.splice(me,0,["enter",vs,Ct[2]]),me++,G++,fn=void 0,is=!0}}}return ce[be][1]._spread=Ke,G}function c(ce,be){return G;function G(me){h.call(this,ce(me),me),be&&be.call(this,me)}}function u(){this.stack.push({type:"fragment",children:[]})}function h(ce,be,G){this.stack[this.stack.length-1].children.push(ce),this.stack.push(ce),this.tokenStack.push([be,G||void 0]),ce.position={start:ea(be.start),end:void 0}}function f(ce){return be;function be(G){ce&&ce.call(this,G),m.call(this,G)}}function m(ce,be){const G=this.stack.pop(),me=this.tokenStack.pop();if(me)me[0].type!==ce.type&&(be?be.call(this,ce,me[0]):(me[1]||H5).call(this,ce,me[0]));else throw new Error("Cannot close `"+ce.type+"` ("+hu({start:ce.start,end:ce.end})+"): it’s not open");G.position.end=ea(ce.end)}function x(){return Xx(this.stack.pop())}function v(){this.data.expectingFirstListItemValue=!0}function b(ce){if(this.data.expectingFirstListItemValue){const be=this.stack[this.stack.length-2];be.start=Number.parseInt(this.sliceSerialize(ce),10),this.data.expectingFirstListItemValue=void 0}}function y(){const ce=this.resume(),be=this.stack[this.stack.length-1];be.lang=ce}function _(){const ce=this.resume(),be=this.stack[this.stack.length-1];be.meta=ce}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function N(){const ce=this.resume(),be=this.stack[this.stack.length-1];be.value=ce.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function S(){const ce=this.resume(),be=this.stack[this.stack.length-1];be.value=ce.replace(/(\r?\n|\r)$/g,"")}function C(ce){const be=this.resume(),G=this.stack[this.stack.length-1];G.label=be,G.identifier=hi(this.sliceSerialize(ce)).toLowerCase()}function E(){const ce=this.resume(),be=this.stack[this.stack.length-1];be.title=ce}function R(){const ce=this.resume(),be=this.stack[this.stack.length-1];be.url=ce}function L(ce){const be=this.stack[this.stack.length-1];if(!be.depth){const G=this.sliceSerialize(ce).length;be.depth=G}}function O(){this.data.setextHeadingSlurpLineEnding=!0}function F(ce){const be=this.stack[this.stack.length-1];be.depth=this.sliceSerialize(ce).codePointAt(0)===61?1:2}function D(){this.data.setextHeadingSlurpLineEnding=void 0}function Q(ce){const G=this.stack[this.stack.length-1].children;let me=G[G.length-1];(!me||me.type!=="text")&&(me=et(),me.position={start:ea(ce.start),end:void 0},G.push(me)),this.stack.push(me)}function I(ce){const be=this.stack.pop();be.value+=this.sliceSerialize(ce),be.position.end=ea(ce.end)}function X(ce){const be=this.stack[this.stack.length-1];if(this.data.atHardBreak){const G=be.children[be.children.length-1];G.position.end=ea(ce.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(be.type)&&(Q.call(this,ce),I.call(this,ce))}function M(){this.data.atHardBreak=!0}function de(){const ce=this.resume(),be=this.stack[this.stack.length-1];be.value=ce}function W(){const ce=this.resume(),be=this.stack[this.stack.length-1];be.value=ce}function q(){const ce=this.resume(),be=this.stack[this.stack.length-1];be.value=ce}function H(){const ce=this.stack[this.stack.length-1];if(this.data.inReference){const be=this.data.referenceType||"shortcut";ce.type+="Reference",ce.referenceType=be,delete ce.url,delete ce.title}else delete ce.identifier,delete ce.label;this.data.referenceType=void 0}function U(){const ce=this.stack[this.stack.length-1];if(this.data.inReference){const be=this.data.referenceType||"shortcut";ce.type+="Reference",ce.referenceType=be,delete ce.url,delete ce.title}else delete ce.identifier,delete ce.label;this.data.referenceType=void 0}function re(ce){const be=this.sliceSerialize(ce),G=this.stack[this.stack.length-2];G.label=e7(be),G.identifier=hi(be).toLowerCase()}function ve(){const ce=this.stack[this.stack.length-1],be=this.resume(),G=this.stack[this.stack.length-1];if(this.data.inReference=!0,G.type==="link"){const me=ce.children;G.children=me}else G.alt=be}function A(){const ce=this.resume(),be=this.stack[this.stack.length-1];be.url=ce}function Ee(){const ce=this.resume(),be=this.stack[this.stack.length-1];be.title=ce}function Me(){this.data.inReference=void 0}function z(){this.data.referenceType="collapsed"}function P(ce){const be=this.resume(),G=this.stack[this.stack.length-1];G.label=be,G.identifier=hi(this.sliceSerialize(ce)).toLowerCase(),this.data.referenceType="full"}function oe(ce){this.data.characterReferenceType=ce.type}function _e(ce){const be=this.sliceSerialize(ce),G=this.data.characterReferenceType;let me;G?(me=Mj(be,G==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):me=Qx(be);const Pe=this.stack[this.stack.length-1];Pe.value+=me}function Ne(ce){const be=this.stack.pop();be.position.end=ea(ce.end)}function Ae(ce){I.call(this,ce);const be=this.stack[this.stack.length-1];be.url=this.sliceSerialize(ce)}function Le(ce){I.call(this,ce);const be=this.stack[this.stack.length-1];be.url="mailto:"+this.sliceSerialize(ce)}function De(){return{type:"blockquote",children:[]}}function Ce(){return{type:"code",lang:null,meta:null,value:""}}function Re(){return{type:"inlineCode",value:""}}function It(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Wt(){return{type:"emphasis",children:[]}}function Ft(){return{type:"heading",depth:0,children:[]}}function Nt(){return{type:"break"}}function wt(){return{type:"html",value:""}}function Qe(){return{type:"image",title:null,url:"",alt:null}}function St(){return{type:"link",title:null,url:"",children:[]}}function nn(ce){return{type:"list",ordered:ce.type==="listOrdered",start:null,spread:ce._spread,children:[]}}function se(ce){return{type:"listItem",spread:ce._spread,checked:null,children:[]}}function je(){return{type:"paragraph",children:[]}}function Xe(){return{type:"strong",children:[]}}function et(){return{type:"text",value:""}}function un(){return{type:"thematicBreak"}}}function ea(e){return{line:e.line,column:e.column,offset:e.offset}}function Uj(e,t){let n=-1;for(;++n<t.length;){const i=t[n];Array.isArray(i)?Uj(e,i):i7(e,i)}}function i7(e,t){let n;for(n in t)if(Fj.call(t,n))switch(n){case"canContainEols":{const i=t[n];i&&e[n].push(...i);break}case"transforms":{const i=t[n];i&&e[n].push(...i);break}case"enter":case"exit":{const i=t[n];i&&Object.assign(e[n],i);break}}}function H5(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+hu({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+hu({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+hu({start:t.start,end:t.end})+") is still open")}function r7(e){const t=this;t.parser=n;function n(i){return n7(i,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function a7(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 l7(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
75
|
+
`}]}function o7(e,t){const n=t.value?t.value+`
|
|
76
|
+
`:"",i={},a=t.lang?t.lang.split(/\s+/):[];a.length>0&&(i.className=["language-"+a[0]]);let c={type:"element",tagName:"code",properties:i,children:[{type:"text",value:n}]};return t.meta&&(c.data={meta:t.meta}),e.patch(t,c),c=e.applyData(t,c),c={type:"element",tagName:"pre",properties:{},children:[c]},e.patch(t,c),c}function c7(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function u7(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function d7(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=String(t.identifier).toUpperCase(),a=Mo(i.toLowerCase()),c=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=c+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 m={type:"element",tagName:"sup",properties:{},children:[f]};return e.patch(t,m),e.applyData(t,m)}function h7(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 f7(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Hj(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),c=a[0];c&&c.type==="text"?c.value="["+c.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 p7(e,t){const n=String(t.identifier).toUpperCase(),i=e.definitionById.get(n);if(!i)return Hj(e,t);const a={src:Mo(i.url||""),alt:t.alt};i.title!==null&&i.title!==void 0&&(a.title=i.title);const c={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,c),e.applyData(t,c)}function m7(e,t){const n={src:Mo(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 g7(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 x7(e,t){const n=String(t.identifier).toUpperCase(),i=e.definitionById.get(n);if(!i)return Hj(e,t);const a={href:Mo(i.url||"")};i.title!==null&&i.title!==void 0&&(a.title=i.title);const c={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,c),e.applyData(t,c)}function v7(e,t){const n={href:Mo(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 b7(e,t,n){const i=e.all(t),a=n?y7(n):qj(t),c={},u=[];if(typeof t.checked=="boolean"){const x=i[0];let v;x&&x.type==="element"&&x.tagName==="p"?v=x:(v={type:"element",tagName:"p",properties:{},children:[]},i.unshift(v)),v.children.length>0&&v.children.unshift({type:"text",value:" "}),v.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),c.className=["task-list-item"]}let h=-1;for(;++h<i.length;){const x=i[h];(a||h!==0||x.type!=="element"||x.tagName!=="p")&&u.push({type:"text",value:`
|
|
77
|
+
`}),x.type==="element"&&x.tagName==="p"&&!a?u.push(...x.children):u.push(x)}const f=i[i.length-1];f&&(a||f.type!=="element"||f.tagName!=="p")&&u.push({type:"text",value:`
|
|
78
|
+
`});const m={type:"element",tagName:"li",properties:c,children:u};return e.patch(t,m),e.applyData(t,m)}function y7(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=qj(n[i])}return t}function qj(e){const t=e.spread;return t??e.children.length>1}function _7(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 c={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(i,!0)};return e.patch(t,c),e.applyData(t,c)}function w7(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function S7(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function k7(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function j7(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=qx(t.children[1]),f=Sj(t.children[t.children.length-1]);h&&f&&(u.position={start:h,end:f}),a.push(u)}const c={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,c),e.applyData(t,c)}function N7(e,t,n){const i=n?n.children:void 0,c=(i?i.indexOf(t):1)===0?"th":"td",u=n&&n.type==="table"?n.align:void 0,h=u?u.length:t.children.length;let f=-1;const m=[];for(;++f<h;){const v=t.children[f],b={},y=u?u[f]:void 0;y&&(b.align=y);let _={type:"element",tagName:c,properties:b,children:[]};v&&(_.children=e.all(v),e.patch(v,_),_=e.applyData(v,_)),m.push(_)}const x={type:"element",tagName:"tr",properties:{},children:e.wrap(m,!0)};return e.patch(t,x),e.applyData(t,x)}function C7(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const q5=9,V5=32;function E7(e){const t=String(e),n=/\r?\n|\r/g;let i=n.exec(t),a=0;const c=[];for(;i;)c.push(G5(t.slice(a,i.index),a>0,!0),i[0]),a=i.index+i[0].length,i=n.exec(t);return c.push(G5(t.slice(a),a>0,!1)),c.join("")}function G5(e,t,n){let i=0,a=e.length;if(t){let c=e.codePointAt(i);for(;c===q5||c===V5;)i++,c=e.codePointAt(i)}if(n){let c=e.codePointAt(a-1);for(;c===q5||c===V5;)a--,c=e.codePointAt(a-1)}return a>i?e.slice(i,a):""}function T7(e,t){const n={type:"text",value:E7(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function A7(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const M7={blockquote:a7,break:l7,code:o7,delete:c7,emphasis:u7,footnoteReference:d7,heading:h7,html:f7,imageReference:p7,image:m7,inlineCode:g7,linkReference:x7,link:v7,listItem:b7,list:_7,paragraph:w7,root:S7,strong:k7,table:j7,tableCell:C7,tableRow:N7,text:T7,thematicBreak:A7,toml:xh,yaml:xh,definition:xh,footnoteDefinition:xh};function xh(){}const Vj=-1,jf=0,pu=1,uf=2,Kx=3,Zx=4,Jx=5,ev=6,Gj=7,Yj=8,{defineProperty:R7}=Object,Xj=typeof self=="object"?self:globalThis,Y5=(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 Xj[e](t)},O7=(e,t)=>{const n=(a,c)=>(e.set(c,a),a),i=a=>{if(e.has(a))return e.get(a);const[c,u]=t[a];switch(c){case jf:case Vj:return n(u,a);case pu:{const h=n([],a);for(const f of u)h.push(i(f));return h}case uf:{const h=n({},a);for(const[f,m]of u){const x=i(f),v=i(m);x==="__proto__"?R7(h,x,{value:v,configurable:!0,enumerable:!0,writable:!0}):h[x]=v}return h}case Kx:return n(new Date(u),a);case Zx:{const{source:h,flags:f}=u;return n(new RegExp(h,f),a)}case Jx:{const h=n(new Map,a);for(const[f,m]of u)h.set(i(f),i(m));return h}case ev:{const h=n(new Set,a);for(const f of u)h.add(i(f));return h}case Gj:{const{name:h,message:f}=u;return n(typeof Xj[h]=="function"?Y5(h,f):new Error(f),a)}case Yj: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(Y5(c,u),a)};return i},X5=e=>O7(new Map,e)(0),Ja="",{toString:L7}={},{keys:D7,is:z7}=Object,Xc=e=>{const t=typeof e;if(t!=="object"||!e)return[jf,t];const n=L7.call(e).slice(8,-1);switch(n){case"Array":return[pu,Ja];case"Object":return[uf,Ja];case"Date":return[Kx,Ja];case"RegExp":return[Zx,Ja];case"Map":return[Jx,Ja];case"Set":return[ev,Ja];case"DataView":return[pu,n]}return n.includes("Array")?[pu,n]:e instanceof Error?[Gj,e.name||"Error"]:[uf,n]},vh=([e,t])=>e===jf&&(t==="function"||t==="symbol"),$7=(e,t,n,i)=>{const a=(u,h)=>{const f=i.push(u)-1;return n.set(h,f),f},c=u=>{if(n.has(u))return n.get(u);let[h,f]=Xc(u);switch(h){case jf:{let x=u;switch(f){case"bigint":h=Yj,x=u.toString();break;case"number":if(!u&&z7(u,-0))return i.push(["-0"])-1;break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+f);x=null;break;case"undefined":return a([Vj],u)}return a([h,x],u)}case pu:{if(f){let b=u;return f==="DataView"?b=new Uint8Array(u.buffer):f==="ArrayBuffer"&&(b=new Uint8Array(u)),a([f,[...b]],u)}const x=[],v=a([h,x],u);for(const b of u)x.push(c(b));return v}case uf:{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 c(u.toJSON());const x=[],v=a([h,x],u);for(const b of D7(u))(e||!vh(Xc(u[b])))&&x.push([c(b),c(u[b])]);return v}case Kx:return a([h,isNaN(u.getTime())?Ja:u.toISOString()],u);case Zx:{const{source:x,flags:v}=u;return a([h,{source:x,flags:v}],u)}case Jx:{const x=[],v=a([h,x],u);for(const[b,y]of u)(e||!(vh(Xc(b))||vh(Xc(y))))&&x.push([c(b),c(y)]);return v}case ev:{const x=[],v=a([h,x],u);for(const b of u)(e||!vh(Xc(b)))&&x.push(c(b));return v}}const{message:m}=u;return a([h,{name:f,message:m}],u)};return c},Q5=(e,{json:t,lossy:n}={})=>{const i=[];return $7(!(t||n),!!t,new Map,i)(e),i},df=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?X5(Q5(e,t)):structuredClone(e):(e,t)=>X5(Q5(e,t));function B7(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 P7(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function I7(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||B7,i=e.options.footnoteBackLabel||P7,a=e.options.footnoteLabel||"Footnotes",c=e.options.footnoteLabelTagName||"h2",u=e.options.footnoteLabelProperties||{className:["sr-only"]},h=[];let f=-1;for(;++f<e.footnoteOrder.length;){const m=e.footnoteById.get(e.footnoteOrder[f]);if(!m)continue;const x=e.all(m),v=String(m.identifier).toUpperCase(),b=Mo(v.toLowerCase());let y=0;const _=[],j=e.footnoteCounts.get(v);for(;j!==void 0&&++y<=j;){_.length>0&&_.push({type:"text",value:" "});let C=typeof n=="string"?n:n(f,y);typeof C=="string"&&(C={type:"text",value:C}),_.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+b+(y>1?"-"+y:""),dataFootnoteBackref:"",ariaLabel:typeof i=="string"?i:i(f,y),className:["data-footnote-backref"]},children:Array.isArray(C)?C:[C]})}const N=x[x.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 x.push(..._);const S={type:"element",tagName:"li",properties:{id:t+"fn-"+b},children:e.wrap(x,!0)};e.patch(m,S),h.push(S)}if(h.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:c,properties:{...df(u),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:`
|
|
79
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(h,!0)},{type:"text",value:`
|
|
80
|
+
`}]}}const Nf=(function(e){if(e==null)return q7;if(typeof e=="function")return Cf(e);if(typeof e=="object")return Array.isArray(e)?F7(e):U7(e);if(typeof e=="string")return H7(e);throw new Error("Expected function, string, or object as test")});function F7(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Nf(e[n]);return Cf(i);function i(...a){let c=-1;for(;++c<t.length;)if(t[c].apply(this,a))return!0;return!1}}function U7(e){const t=e;return Cf(n);function n(i){const a=i;let c;for(c in e)if(a[c]!==t[c])return!1;return!0}}function H7(e){return Cf(t);function t(n){return n&&n.type===e}}function Cf(e){return t;function t(n,i,a){return!!(V7(n)&&e.call(this,n,typeof i=="number"?i:void 0,a||void 0))}}function q7(){return!0}function V7(e){return e!==null&&typeof e=="object"&&"type"in e}const Qj=[],G7=!0,rx=!1,Y7="skip";function Wj(e,t,n,i){let a;typeof t=="function"&&typeof n!="function"?(i=n,n=t):a=t;const c=Nf(a),u=i?-1:1;h(e,void 0,[])();function h(f,m,x){const v=f&&typeof f=="object"?f:{};if(typeof v.type=="string"){const y=typeof v.tagName=="string"?v.tagName:typeof v.name=="string"?v.name:void 0;Object.defineProperty(b,"name",{value:"node ("+(f.type+(y?"<"+y+">":""))+")"})}return b;function b(){let y=Qj,_,j,N;if((!t||c(f,m,x[x.length-1]||void 0))&&(y=X7(n(f,x)),y[0]===rx))return y;if("children"in f&&f.children){const S=f;if(S.children&&y[0]!==Y7)for(j=(i?S.children.length:-1)+u,N=x.concat(S);j>-1&&j<S.children.length;){const C=S.children[j];if(_=h(C,j,N)(),_[0]===rx)return _;j=typeof _[1]=="number"?_[1]:j+u}}return y}}}function X7(e){return Array.isArray(e)?e:typeof e=="number"?[G7,e]:e==null?Qj:[e]}function tv(e,t,n,i){let a,c,u;typeof t=="function"&&typeof n!="function"?(c=void 0,u=t,a=n):(c=t,u=n,a=i),Wj(e,c,h,a);function h(f,m){const x=m[m.length-1],v=x?x.children.indexOf(f):void 0;return u(f,v,x)}}const ax={}.hasOwnProperty,Q7={};function W7(e,t){const n=t||Q7,i=new Map,a=new Map,c=new Map,u={...M7,...n.handlers},h={all:m,applyData:Z7,definitionById:i,footnoteById:a,footnoteCounts:c,footnoteOrder:[],handlers:u,one:f,options:n,patch:K7,wrap:eL};return tv(e,function(x){if(x.type==="definition"||x.type==="footnoteDefinition"){const v=x.type==="definition"?i:a,b=String(x.identifier).toUpperCase();v.has(b)||v.set(b,x)}}),h;function f(x,v){const b=x.type,y=h.handlers[b];if(ax.call(h.handlers,b)&&y)return y(h,x,v);if(h.options.passThrough&&h.options.passThrough.includes(b)){if("children"in x){const{children:j,...N}=x,S=df(N);return S.children=h.all(x),S}return df(x)}return(h.options.unknownHandler||J7)(h,x,v)}function m(x){const v=[];if("children"in x){const b=x.children;let y=-1;for(;++y<b.length;){const _=h.one(b[y],x);if(_){if(y&&b[y-1].type==="break"&&(!Array.isArray(_)&&_.type==="text"&&(_.value=W5(_.value)),!Array.isArray(_)&&_.type==="element")){const j=_.children[0];j&&j.type==="text"&&(j.value=W5(j.value))}Array.isArray(_)?v.push(..._):v.push(_)}}}return v}}function K7(e,t){e.position&&(t.position=$R(e))}function Z7(e,t){let n=t;if(e&&e.data){const i=e.data.hName,a=e.data.hChildren,c=e.data.hProperties;if(typeof i=="string")if(n.type==="element")n.tagName=i;else{const u="children"in n?n.children:[n];n={type:"element",tagName:i,properties:{},children:u}}n.type==="element"&&c&&Object.assign(n.properties,df(c)),"children"in n&&n.children&&a!==null&&a!==void 0&&(n.children=a)}return n}function J7(e,t){const n=t.data||{},i="value"in t&&!(ax.call(n,"hProperties")||ax.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 eL(e,t){const n=[];let i=-1;for(t&&n.push({type:"text",value:`
|
|
81
|
+
`});++i<e.length;)i&&n.push({type:"text",value:`
|
|
82
|
+
`}),n.push(e[i]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
83
|
+
`}),n}function W5(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function K5(e,t){const n=W7(e,t),i=n.one(e,void 0),a=I7(n),c=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return a&&c.children.push({type:"text",value:`
|
|
84
|
+
`},a),c}function tL(e,t){return e&&"run"in e?async function(n,i){const a=K5(n,{file:i,...t});await e.run(a,i)}:function(n,i){return K5(n,{file:i,...e||t})}}function Z5(e){if(e)throw e}var Wg,J5;function nL(){if(J5)return Wg;J5=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=function(m){return typeof Array.isArray=="function"?Array.isArray(m):t.call(m)==="[object Array]"},c=function(m){if(!m||t.call(m)!=="[object Object]")return!1;var x=e.call(m,"constructor"),v=m.constructor&&m.constructor.prototype&&e.call(m.constructor.prototype,"isPrototypeOf");if(m.constructor&&!x&&!v)return!1;var b;for(b in m);return typeof b>"u"||e.call(m,b)},u=function(m,x){n&&x.name==="__proto__"?n(m,x.name,{enumerable:!0,configurable:!0,value:x.newValue,writable:!0}):m[x.name]=x.newValue},h=function(m,x){if(x==="__proto__")if(e.call(m,x)){if(i)return i(m,x).value}else return;return m[x]};return Wg=function f(){var m,x,v,b,y,_,j=arguments[0],N=1,S=arguments.length,C=!1;for(typeof j=="boolean"&&(C=j,j=arguments[1]||{},N=2),(j==null||typeof j!="object"&&typeof j!="function")&&(j={});N<S;++N)if(m=arguments[N],m!=null)for(x in m)v=h(j,x),b=h(m,x),j!==b&&(C&&b&&(c(b)||(y=a(b)))?(y?(y=!1,_=v&&a(v)?v:[]):_=v&&c(v)?v:{},u(j,{name:x,newValue:f(C,_,b)})):typeof b<"u"&&u(j,{name:x,newValue:b}));return j},Wg}var sL=nL();const Kg=px(sL);function lx(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 iL(){const e=[],t={run:n,use:i};return t;function n(...a){let c=-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,...m){const x=e[++c];let v=-1;if(f){u(f);return}for(;++v<a.length;)(m[v]===null||m[v]===void 0)&&(m[v]=a[v]);a=m,x?rL(x,h)(...m):u(null,...m)}}function i(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function rL(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(m){const x=m;if(h&&n)throw x;return a(x)}h||(f&&f.then&&typeof f.then=="function"?f.then(c,a):f instanceof Error?a(f):c(f))}function a(u,...h){n||(n=!0,t(u,...h))}function c(u){a(null,u)}}const Mi={basename:aL,dirname:lL,extname:oL,join:cL,sep:"/"};function aL(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Du(e);let n=0,i=-1,a=e.length,c;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(c){n=a+1;break}}else i<0&&(c=!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(c){n=a+1;break}}else u<0&&(c=!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 lL(e){if(Du(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 oL(e){Du(e);let t=e.length,n=-1,i=0,a=-1,c=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:c!==1&&(c=1):a>-1&&(c=-1)}return a<0||n<0||c===0||c===1&&a===n-1&&a===i+1?"":e.slice(a,n)}function cL(...e){let t=-1,n;for(;++t<e.length;)Du(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":uL(n)}function uL(e){Du(e);const t=e.codePointAt(0)===47;let n=dL(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function dL(e,t){let n="",i=0,a=-1,c=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||c===1))if(a!==u-1&&c===2){if(n.length<2||i!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(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,c=0;continue}}else if(n.length>0){n="",i=0,a=u,c=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,c=0}else h===46&&c>-1?c++:c=-1}return n}function Du(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const hL={cwd:fL};function fL(){return"/"}function ox(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function pL(e){if(typeof e=="string")e=new URL(e);else if(!ox(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 mL(e)}function mL(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 Zg=["history","path","basename","stem","extname","dirname"];class Kj{constructor(t){let n;t?ox(t)?n={path:t}:typeof t=="string"||gL(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":hL.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<Zg.length;){const c=Zg[i];c in n&&n[c]!==void 0&&n[c]!==null&&(this[c]=c==="history"?[...n[c]]:n[c])}let a;for(a in n)Zg.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?Mi.basename(this.path):void 0}set basename(t){e0(t,"basename"),Jg(t,"basename"),this.path=Mi.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Mi.dirname(this.path):void 0}set dirname(t){e2(this.basename,"dirname"),this.path=Mi.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Mi.extname(this.path):void 0}set extname(t){if(Jg(t,"extname"),e2(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=Mi.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){ox(t)&&(t=pL(t)),e0(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Mi.basename(this.path,this.extname):void 0}set stem(t){e0(t,"stem"),Jg(t,"stem"),this.path=Mi.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 Gn(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 Jg(e,t){if(e&&e.includes(Mi.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Mi.sep+"`")}function e0(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function e2(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function gL(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const xL=(function(e){const i=this.constructor.prototype,a=i[e],c=function(){return a.apply(c,arguments)};return Object.setPrototypeOf(c,i),c}),vL={}.hasOwnProperty;class nv extends xL{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=iL()}copy(){const t=new nv;let n=-1;for(;++n<this.attachers.length;){const i=this.attachers[n];t.use(...i)}return t.data(Kg(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(s0("data",this.frozen),this.namespace[t]=n,this):vL.call(this.namespace,t)&&this.namespace[t]||void 0:t?(s0("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=bh(t),i=this.parser||this.Parser;return t0("parse",i),i(String(n),n)}process(t,n){const i=this;return this.freeze(),t0("process",this.parser||this.Parser),n0("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(c,u){const h=bh(t),f=i.parse(h);i.run(f,h,function(x,v,b){if(x||!v||!b)return m(x);const y=v,_=i.stringify(y,b);_L(_)?b.value=_:b.result=_,m(x,b)});function m(x,v){x||!v?u(x):c?c(v):n(void 0,v)}}}processSync(t){let n=!1,i;return this.freeze(),t0("processSync",this.parser||this.Parser),n0("processSync",this.compiler||this.Compiler),this.process(t,a),n2("processSync","process",n),i;function a(c,u){n=!0,Z5(c),i=u}}run(t,n,i){t2(t),this.freeze();const a=this.transformers;return!i&&typeof n=="function"&&(i=n,n=void 0),i?c(void 0,i):new Promise(c);function c(u,h){const f=bh(n);a.run(t,f,m);function m(x,v,b){const y=v||t;x?h(x):u?u(y):i(void 0,y,b)}}}runSync(t,n){let i=!1,a;return this.run(t,n,c),n2("runSync","run",i),a;function c(u,h){Z5(u),a=h,i=!0}}stringify(t,n){this.freeze();const i=bh(n),a=this.compiler||this.Compiler;return n0("stringify",a),t2(t),a(t,i)}use(t,...n){const i=this.attachers,a=this.namespace;if(s0("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 c(m){if(typeof m=="function")f(m,[]);else if(typeof m=="object")if(Array.isArray(m)){const[x,...v]=m;f(x,v)}else u(m);else throw new TypeError("Expected usable value, not `"+m+"`")}function u(m){if(!("plugins"in m)&&!("settings"in m))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(m.plugins),m.settings&&(a.settings=Kg(!0,a.settings,m.settings))}function h(m){let x=-1;if(m!=null)if(Array.isArray(m))for(;++x<m.length;){const v=m[x];c(v)}else throw new TypeError("Expected a list of plugins, not `"+m+"`")}function f(m,x){let v=-1,b=-1;for(;++v<i.length;)if(i[v][0]===m){b=v;break}if(b===-1)i.push([m,...x]);else if(x.length>0){let[y,..._]=x;const j=i[b][1];lx(j)&&lx(y)&&(y=Kg(!0,j,y)),i[b]=[m,y,..._]}}}}const bL=new nv().freeze();function t0(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function n0(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function s0(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 t2(e){if(!lx(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function n2(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function bh(e){return yL(e)?e:new Kj(e)}function yL(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function _L(e){return typeof e=="string"||wL(e)}function wL(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const SL="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",s2=[],i2={allowDangerousHtml:!0},kL=/^(https?|ircs?|mailto|xmpp)$/i,jL=[{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 sv(e){const t=NL(e),n=CL(e);return EL(t.runSync(t.parse(n),n),e)}function NL(e){const t=e.rehypePlugins||s2,n=e.remarkPlugins||s2,i=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...i2}:i2;return bL().use(r7).use(n).use(tL,i).use(t)}function CL(e){const t=e.children||"",n=new Kj;return typeof t=="string"&&(n.value=t),n}function EL(e,t){const n=t.allowedElements,i=t.allowElement,a=t.components,c=t.disallowedElements,u=t.skipHtml,h=t.unwrapDisallowed,f=t.urlTransform||TL;for(const x of jL)Object.hasOwn(t,x.from)&&(""+x.from+(x.to?"use `"+x.to+"` instead":"remove it")+SL+x.id,void 0);return tv(e,m),UR(e,{Fragment:l.Fragment,components:a,ignoreInvalidStyle:!0,jsx:l.jsx,jsxs:l.jsxs,passKeys:!0,passNode:!0});function m(x,v,b){if(x.type==="raw"&&b&&typeof v=="number")return u?b.children.splice(v,1):b.children[v]={type:"text",value:x.value},v;if(x.type==="element"){let y;for(y in Yg)if(Object.hasOwn(Yg,y)&&Object.hasOwn(x.properties,y)){const _=x.properties[y],j=Yg[y];(j===null||j.includes(x.tagName))&&(x.properties[y]=f(String(_||""),y,x))}}if(x.type==="element"){let y=n?!n.includes(x.tagName):c?c.includes(x.tagName):!1;if(!y&&i&&typeof v=="number"&&(y=!i(x,v,b)),y&&b&&typeof v=="number")return h&&x.children?b.children.splice(v,1,...x.children):b.children.splice(v,1),v}}}function TL(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||kL.test(e.slice(0,t))?e:""}function r2(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 AL(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function ML(e,t,n){const a=Nf((n||{}).ignore||[]),c=RL(t);let u=-1;for(;++u<c.length;)Wj(e,"text",h);function h(m,x){let v=-1,b;for(;++v<x.length;){const y=x[v],_=b?b.children:void 0;if(a(y,_?_.indexOf(y):void 0,b))return;b=y}if(b)return f(m,x)}function f(m,x){const v=x[x.length-1],b=c[u][0],y=c[u][1];let _=0;const N=v.children.indexOf(m);let S=!1,C=[];b.lastIndex=0;let E=b.exec(m.value);for(;E;){const R=E.index,L={index:E.index,input:E.input,stack:[...x,m]};let O=y(...E,L);if(typeof O=="string"&&(O=O.length>0?{type:"text",value:O}:void 0),O===!1?b.lastIndex=R+1:(_!==R&&C.push({type:"text",value:m.value.slice(_,R)}),Array.isArray(O)?C.push(...O):O&&C.push(O),_=R+E[0].length,S=!0),!b.global)break;E=b.exec(m.value)}return S?(_<m.value.length&&C.push({type:"text",value:m.value.slice(_)}),v.children.splice(N,1,...C)):C=[m],N+C.length}}function RL(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let i=-1;for(;++i<n.length;){const a=n[i];t.push([OL(a[0]),LL(a[1])])}return t}function OL(e){return typeof e=="string"?new RegExp(AL(e),"g"):e}function LL(e){return typeof e=="function"?e:function(){return e}}const i0="phrasing",r0=["autolink","link","image","label"];function DL(){return{transforms:[UL],enter:{literalAutolink:$L,literalAutolinkEmail:a0,literalAutolinkHttp:a0,literalAutolinkWww:a0},exit:{literalAutolink:FL,literalAutolinkEmail:IL,literalAutolinkHttp:BL,literalAutolinkWww:PL}}}function zL(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:i0,notInConstruct:r0},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:i0,notInConstruct:r0},{character:":",before:"[ps]",after:"\\/",inConstruct:i0,notInConstruct:r0}]}}function $L(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function a0(e){this.config.enter.autolinkProtocol.call(this,e)}function BL(e){this.config.exit.autolinkProtocol.call(this,e)}function PL(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 IL(e){this.config.exit.autolinkEmail.call(this,e)}function FL(e){this.exit(e)}function UL(e){ML(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,HL],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),qL]],{ignore:["link","linkReference"]})}function HL(e,t,n,i,a){let c="";if(!Zj(a)||(/^w/i.test(t)&&(n=t+n,t="",c="http://"),!VL(n)))return!1;const u=GL(n+i);if(!u[0])return!1;const h={type:"link",title:null,url:c+t+u[0],children:[{type:"text",value:t+u[0]}]};return u[1]?[h,{type:"text",value:u[1]}]:h}function qL(e,t,n,i){return!Zj(i,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function VL(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 GL(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=r2(e,"(");let c=r2(e,")");for(;i!==-1&&a>c;)e+=n.slice(0,i+1),n=n.slice(i+1),i=n.indexOf(")"),c++;return[e,n]}function Zj(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||al(n)||Sf(n))&&(!t||n!==47)}Jj.peek=tD;function YL(){this.buffer()}function XL(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function QL(){this.buffer()}function WL(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function KL(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=hi(this.sliceSerialize(e)).toLowerCase(),n.label=t}function ZL(e){this.exit(e)}function JL(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=hi(this.sliceSerialize(e)).toLowerCase(),n.label=t}function eD(e){this.exit(e)}function tD(){return"["}function Jj(e,t,n,i){const a=n.createTracker(i);let c=a.move("[^");const u=n.enter("footnoteReference"),h=n.enter("reference");return c+=a.move(n.safe(n.associationId(e),{after:"]",before:c})),h(),u(),c+=a.move("]"),c}function nD(){return{enter:{gfmFootnoteCallString:YL,gfmFootnoteCall:XL,gfmFootnoteDefinitionLabelString:QL,gfmFootnoteDefinition:WL},exit:{gfmFootnoteCallString:KL,gfmFootnoteCall:ZL,gfmFootnoteDefinitionLabelString:JL,gfmFootnoteDefinition:eD}}}function sD(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Jj},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(i,a,c,u){const h=c.createTracker(u);let f=h.move("[^");const m=c.enter("footnoteDefinition"),x=c.enter("label");return f+=h.move(c.safe(c.associationId(i),{before:f,after:"]"})),x(),f+=h.move("]:"),i.children&&i.children.length>0&&(h.shift(4),f+=h.move((t?`
|
|
85
|
+
`:" ")+c.indentLines(c.containerFlow(i,h.current()),t?eN:iD))),m(),f}}function iD(e,t,n){return t===0?e:eN(e,t,n)}function eN(e,t,n){return(n?"":" ")+e}const rD=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];tN.peek=uD;function aD(){return{canContainEols:["delete"],enter:{strikethrough:oD},exit:{strikethrough:cD}}}function lD(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:rD}],handlers:{delete:tN}}}function oD(e){this.enter({type:"delete",children:[]},e)}function cD(e){this.exit(e)}function tN(e,t,n,i){const a=n.createTracker(i),c=n.enter("strikethrough");let u=a.move("~~");return u+=n.containerPhrasing(e,{...a.current(),before:u,after:"~"}),u+=a.move("~~"),c(),u}function uD(){return"~"}function dD(e){return e.length}function hD(e,t){const n=t||{},i=(n.align||[]).concat(),a=n.stringLength||dD,c=[],u=[],h=[],f=[];let m=0,x=-1;for(;++x<e.length;){const j=[],N=[];let S=-1;for(e[x].length>m&&(m=e[x].length);++S<e[x].length;){const C=fD(e[x][S]);if(n.alignDelimiters!==!1){const E=a(C);N[S]=E,(f[S]===void 0||E>f[S])&&(f[S]=E)}j.push(C)}u[x]=j,h[x]=N}let v=-1;if(typeof i=="object"&&"length"in i)for(;++v<m;)c[v]=a2(i[v]);else{const j=a2(i);for(;++v<m;)c[v]=j}v=-1;const b=[],y=[];for(;++v<m;){const j=c[v];let N="",S="";j===99?(N=":",S=":"):j===108?N=":":j===114&&(S=":");let C=n.alignDelimiters===!1?1:Math.max(1,f[v]-N.length-S.length);const E=N+"-".repeat(C)+S;n.alignDelimiters!==!1&&(C=N.length+C+S.length,C>f[v]&&(f[v]=C),y[v]=C),b[v]=E}u.splice(1,0,b),h.splice(1,0,y),x=-1;const _=[];for(;++x<u.length;){const j=u[x],N=h[x];v=-1;const S=[];for(;++v<m;){const C=j[v]||"";let E="",R="";if(n.alignDelimiters!==!1){const L=f[v]-(N[v]||0),O=c[v];O===114?E=" ".repeat(L):O===99?L%2?(E=" ".repeat(L/2+.5),R=" ".repeat(L/2-.5)):(E=" ".repeat(L/2),R=E):R=" ".repeat(L)}n.delimiterStart!==!1&&!v&&S.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&C==="")&&(n.delimiterStart!==!1||v)&&S.push(" "),n.alignDelimiters!==!1&&S.push(E),S.push(C),n.alignDelimiters!==!1&&S.push(R),n.padding!==!1&&S.push(" "),(n.delimiterEnd!==!1||v!==m-1)&&S.push("|")}_.push(n.delimiterEnd===!1?S.join("").replace(/ +$/,""):S.join(""))}return _.join(`
|
|
86
|
+
`)}function fD(e){return e==null?"":String(e)}function a2(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function pD(e,t,n,i){const a=n.enter("blockquote"),c=n.createTracker(i);c.move("> "),c.shift(2);const u=n.indentLines(n.containerFlow(e,c.current()),mD);return a(),u}function mD(e,t,n){return">"+(n?"":" ")+e}function gD(e,t){return l2(e,t.inConstruct,!0)&&!l2(e,t.notInConstruct,!1)}function l2(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 o2(e,t,n,i){let a=-1;for(;++a<n.unsafe.length;)if(n.unsafe[a].character===`
|
|
87
|
+
`&&gD(n.stack,n.unsafe[a]))return/[ \t]/.test(i.before)?"":" ";return`\\
|
|
88
|
+
`}function xD(e,t){const n=String(e);let i=n.indexOf(t),a=i,c=0,u=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;i!==-1;)i===a?++c>u&&(u=c):c=1,a=i+t.length,i=n.indexOf(t,a);return u}function vD(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function bD(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 yD(e,t,n,i){const a=bD(n),c=e.value||"",u=a==="`"?"GraveAccent":"Tilde";if(vD(e,n)){const v=n.enter("codeIndented"),b=n.indentLines(c,_D);return v(),b}const h=n.createTracker(i),f=a.repeat(Math.max(xD(c,a)+1,3)),m=n.enter("codeFenced");let x=h.move(f);if(e.lang){const v=n.enter(`codeFencedLang${u}`);x+=h.move(n.safe(e.lang,{before:x,after:" ",encode:["`"],...h.current()})),v()}if(e.lang&&e.meta){const v=n.enter(`codeFencedMeta${u}`);x+=h.move(" "),x+=h.move(n.safe(e.meta,{before:x,after:`
|
|
89
|
+
`,encode:["`"],...h.current()})),v()}return x+=h.move(`
|
|
90
|
+
`),c&&(x+=h.move(c+`
|
|
91
|
+
`)),x+=h.move(f),m(),x}function _D(e,t,n){return(n?"":" ")+e}function iv(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 wD(e,t,n,i){const a=iv(n),c=a==='"'?"Quote":"Apostrophe",u=n.enter("definition");let h=n.enter("label");const f=n.createTracker(i);let m=f.move("[");return m+=f.move(n.safe(n.associationId(e),{before:m,after:"]",...f.current()})),m+=f.move("]: "),h(),!e.url||/[\0- \u007F]/.test(e.url)?(h=n.enter("destinationLiteral"),m+=f.move("<"),m+=f.move(n.safe(e.url,{before:m,after:">",...f.current()})),m+=f.move(">")):(h=n.enter("destinationRaw"),m+=f.move(n.safe(e.url,{before:m,after:e.title?" ":`
|
|
92
|
+
`,...f.current()}))),h(),e.title&&(h=n.enter(`title${c}`),m+=f.move(" "+a),m+=f.move(n.safe(e.title,{before:m,after:a,...f.current()})),m+=f.move(a),h()),u(),m}function SD(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Tu(e){return"&#x"+e.toString(16).toUpperCase()+";"}function hf(e,t,n){const i=ko(e),a=ko(t);return i===void 0?a===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:i===1?a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}nN.peek=kD;function nN(e,t,n,i){const a=SD(n),c=n.enter("emphasis"),u=n.createTracker(i),h=u.move(a);let f=u.move(n.containerPhrasing(e,{after:a,before:h,...u.current()}));const m=f.charCodeAt(0),x=hf(i.before.charCodeAt(i.before.length-1),m,a);x.inside&&(f=Tu(m)+f.slice(1));const v=f.charCodeAt(f.length-1),b=hf(i.after.charCodeAt(0),v,a);b.inside&&(f=f.slice(0,-1)+Tu(v));const y=u.move(a);return c(),n.attentionEncodeSurroundingInfo={after:b.outside,before:x.outside},h+f+y}function kD(e,t,n){return n.options.emphasis||"*"}function jD(e,t){let n=!1;return tv(e,function(i){if("value"in i&&/\r?\n|\r/.test(i.value)||i.type==="break")return n=!0,rx}),!!((!e.depth||e.depth<3)&&Xx(e)&&(t.options.setext||n))}function ND(e,t,n,i){const a=Math.max(Math.min(6,e.depth||1),1),c=n.createTracker(i);if(jD(e,n)){const x=n.enter("headingSetext"),v=n.enter("phrasing"),b=n.containerPhrasing(e,{...c.current(),before:`
|
|
93
|
+
`,after:`
|
|
94
|
+
`});return v(),x(),b+`
|
|
95
|
+
`+(a===1?"=":"-").repeat(b.length-(Math.max(b.lastIndexOf("\r"),b.lastIndexOf(`
|
|
96
|
+
`))+1))}const u="#".repeat(a),h=n.enter("headingAtx"),f=n.enter("phrasing");c.move(u+" ");let m=n.containerPhrasing(e,{before:"# ",after:`
|
|
97
|
+
`,...c.current()});return/^[\t ]/.test(m)&&(m=Tu(m.charCodeAt(0))+m.slice(1)),m=m?u+" "+m:u,n.options.closeAtx&&(m+=" "+u),f(),h(),m}sN.peek=CD;function sN(e){return e.value||""}function CD(){return"<"}iN.peek=ED;function iN(e,t,n,i){const a=iv(n),c=a==='"'?"Quote":"Apostrophe",u=n.enter("image");let h=n.enter("label");const f=n.createTracker(i);let m=f.move("![");return m+=f.move(n.safe(e.alt,{before:m,after:"]",...f.current()})),m+=f.move("]("),h(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(h=n.enter("destinationLiteral"),m+=f.move("<"),m+=f.move(n.safe(e.url,{before:m,after:">",...f.current()})),m+=f.move(">")):(h=n.enter("destinationRaw"),m+=f.move(n.safe(e.url,{before:m,after:e.title?" ":")",...f.current()}))),h(),e.title&&(h=n.enter(`title${c}`),m+=f.move(" "+a),m+=f.move(n.safe(e.title,{before:m,after:a,...f.current()})),m+=f.move(a),h()),m+=f.move(")"),u(),m}function ED(){return"!"}rN.peek=TD;function rN(e,t,n,i){const a=e.referenceType,c=n.enter("imageReference");let u=n.enter("label");const h=n.createTracker(i);let f=h.move("![");const m=n.safe(e.alt,{before:f,after:"]",...h.current()});f+=h.move(m+"]["),u();const x=n.stack;n.stack=[],u=n.enter("reference");const v=n.safe(n.associationId(e),{before:f,after:"]",...h.current()});return u(),n.stack=x,c(),a==="full"||!m||m!==v?f+=h.move(v+"]"):a==="shortcut"?f=f.slice(0,-1):f+=h.move("]"),f}function TD(){return"!"}aN.peek=AD;function aN(e,t,n){let i=e.value||"",a="`",c=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(i);)a+="`";for(/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^`|`$/.test(i))&&(i=" "+i+" ");++c<n.unsafe.length;){const u=n.unsafe[c],h=n.compilePattern(u);let f;if(u.atBreak)for(;f=h.exec(i);){let m=f.index;i.charCodeAt(m)===10&&i.charCodeAt(m-1)===13&&m--,i=i.slice(0,m)+" "+i.slice(f.index+1)}}return a+i+a}function AD(){return"`"}function lN(e,t){const n=Xx(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))}oN.peek=MD;function oN(e,t,n,i){const a=iv(n),c=a==='"'?"Quote":"Apostrophe",u=n.createTracker(i);let h,f;if(lN(e,n)){const x=n.stack;n.stack=[],h=n.enter("autolink");let v=u.move("<");return v+=u.move(n.containerPhrasing(e,{before:v,after:">",...u.current()})),v+=u.move(">"),h(),n.stack=x,v}h=n.enter("link"),f=n.enter("label");let m=u.move("[");return m+=u.move(n.containerPhrasing(e,{before:m,after:"](",...u.current()})),m+=u.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),m+=u.move("<"),m+=u.move(n.safe(e.url,{before:m,after:">",...u.current()})),m+=u.move(">")):(f=n.enter("destinationRaw"),m+=u.move(n.safe(e.url,{before:m,after:e.title?" ":")",...u.current()}))),f(),e.title&&(f=n.enter(`title${c}`),m+=u.move(" "+a),m+=u.move(n.safe(e.title,{before:m,after:a,...u.current()})),m+=u.move(a),f()),m+=u.move(")"),h(),m}function MD(e,t,n){return lN(e,n)?"<":"["}cN.peek=RD;function cN(e,t,n,i){const a=e.referenceType,c=n.enter("linkReference");let u=n.enter("label");const h=n.createTracker(i);let f=h.move("[");const m=n.containerPhrasing(e,{before:f,after:"]",...h.current()});f+=h.move(m+"]["),u();const x=n.stack;n.stack=[],u=n.enter("reference");const v=n.safe(n.associationId(e),{before:f,after:"]",...h.current()});return u(),n.stack=x,c(),a==="full"||!m||m!==v?f+=h.move(v+"]"):a==="shortcut"?f=f.slice(0,-1):f+=h.move("]"),f}function RD(){return"["}function rv(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 OD(e){const t=rv(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 LD(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 uN(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 DD(e,t,n,i){const a=n.enter("list"),c=n.bulletCurrent;let u=e.ordered?LD(n):rv(n);const h=e.ordered?u==="."?")":".":OD(n);let f=t&&n.bulletLastUsed?u===n.bulletLastUsed:!1;if(!e.ordered){const x=e.children?e.children[0]:void 0;if((u==="*"||u==="-")&&x&&(!x.children||!x.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),uN(n)===u&&x){let v=-1;for(;++v<e.children.length;){const b=e.children[v];if(b&&b.type==="listItem"&&b.children&&b.children[0]&&b.children[0].type==="thematicBreak"){f=!0;break}}}}f&&(u=h),n.bulletCurrent=u;const m=n.containerFlow(e,i);return n.bulletLastUsed=u,n.bulletCurrent=c,a(),m}function zD(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 $D(e,t,n,i){const a=zD(n);let c=n.bulletCurrent||rv(n);t&&t.type==="list"&&t.ordered&&(c=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+c);let u=c.length+1;(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(c+" ".repeat(u-c.length)),h.shift(u);const f=n.enter("listItem"),m=n.indentLines(n.containerFlow(e,h.current()),x);return f(),m;function x(v,b,y){return b?(y?"":" ".repeat(u))+v:(y?c:c+" ".repeat(u-c.length))+v}}function BD(e,t,n,i){const a=n.enter("paragraph"),c=n.enter("phrasing"),u=n.containerPhrasing(e,i);return c(),a(),u}const PD=Nf(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function ID(e,t,n,i){return(e.children.some(function(u){return PD(u)})?n.containerPhrasing:n.containerFlow).call(n,e,i)}function FD(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}dN.peek=UD;function dN(e,t,n,i){const a=FD(n),c=n.enter("strong"),u=n.createTracker(i),h=u.move(a+a);let f=u.move(n.containerPhrasing(e,{after:a,before:h,...u.current()}));const m=f.charCodeAt(0),x=hf(i.before.charCodeAt(i.before.length-1),m,a);x.inside&&(f=Tu(m)+f.slice(1));const v=f.charCodeAt(f.length-1),b=hf(i.after.charCodeAt(0),v,a);b.inside&&(f=f.slice(0,-1)+Tu(v));const y=u.move(a+a);return c(),n.attentionEncodeSurroundingInfo={after:b.outside,before:x.outside},h+f+y}function UD(e,t,n){return n.options.strong||"*"}function HD(e,t,n,i){return n.safe(e.value,i)}function qD(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 VD(e,t,n){const i=(uN(n)+(n.options.ruleSpaces?" ":"")).repeat(qD(n));return n.options.ruleSpaces?i.slice(0,-1):i}const hN={blockquote:pD,break:o2,code:yD,definition:wD,emphasis:nN,hardBreak:o2,heading:ND,html:sN,image:iN,imageReference:rN,inlineCode:aN,link:oN,linkReference:cN,list:DD,listItem:$D,paragraph:BD,root:ID,strong:dN,text:HD,thematicBreak:VD};function GD(){return{enter:{table:YD,tableData:c2,tableHeader:c2,tableRow:QD},exit:{codeText:WD,table:XD,tableData:l0,tableHeader:l0,tableRow:l0}}}function YD(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 XD(e){this.exit(e),this.data.inTable=void 0}function QD(e){this.enter({type:"tableRow",children:[]},e)}function l0(e){this.exit(e)}function c2(e){this.enter({type:"tableCell",children:[]},e)}function WD(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,KD));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function KD(e,t){return t==="|"?t:e}function ZD(e){const t=e||{},n=t.tableCellPadding,i=t.tablePipeAlign,a=t.stringLength,c=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
98
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:b,table:u,tableCell:f,tableRow:h}};function u(y,_,j,N){return m(x(y,j,N),y.align)}function h(y,_,j,N){const S=v(y,j,N),C=m([S]);return C.slice(0,C.indexOf(`
|
|
99
|
+
`))}function f(y,_,j,N){const S=j.enter("tableCell"),C=j.enter("phrasing"),E=j.containerPhrasing(y,{...N,before:c,after:c});return C(),S(),E}function m(y,_){return hD(y,{align:_,alignDelimiters:i,padding:n,stringLength:a})}function x(y,_,j){const N=y.children;let S=-1;const C=[],E=_.enter("table");for(;++S<N.length;)C[S]=v(N[S],_,j);return E(),C}function v(y,_,j){const N=y.children;let S=-1;const C=[],E=_.enter("tableRow");for(;++S<N.length;)C[S]=f(N[S],y,_,j);return E(),C}function b(y,_,j){let N=hN.inlineCode(y,_,j);return j.stack.includes("tableCell")&&(N=N.replace(/\|/g,"\\$&")),N}}function JD(){return{exit:{taskListCheckValueChecked:u2,taskListCheckValueUnchecked:u2,paragraph:tz}}}function ez(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:nz}}}function u2(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function tz(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 c=-1,u;for(;++c<a.length;){const h=a[c];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 nz(e,t,n,i){const a=e.children[0],c=typeof e.checked=="boolean"&&a&&a.type==="paragraph",u="["+(e.checked?"x":" ")+"] ",h=n.createTracker(i);c&&h.move(u);let f=hN.listItem(e,t,n,{...i,...h.current()});return c&&(f=f.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,m)),f;function m(x){return x+u}}function sz(){return[DL(),nD(),aD(),GD(),JD()]}function iz(e){return{extensions:[zL(),sD(e),lD(),ZD(e),ez()]}}const rz={tokenize:dz,partial:!0},fN={tokenize:hz,partial:!0},pN={tokenize:fz,partial:!0},mN={tokenize:pz,partial:!0},az={tokenize:mz,partial:!0},gN={name:"wwwAutolink",tokenize:cz,previous:vN},xN={name:"protocolAutolink",tokenize:uz,previous:bN},gr={name:"emailAutolink",tokenize:oz,previous:yN},$i={};function lz(){return{text:$i}}let Xa=48;for(;Xa<123;)$i[Xa]=gr,Xa++,Xa===58?Xa=65:Xa===91&&(Xa=97);$i[43]=gr;$i[45]=gr;$i[46]=gr;$i[95]=gr;$i[72]=[gr,xN];$i[104]=[gr,xN];$i[87]=[gr,gN];$i[119]=[gr,gN];function oz(e,t,n){const i=this;let a,c;return u;function u(v){return!cx(v)||!yN.call(i,i.previous)||av(i.events)?n(v):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),h(v))}function h(v){return cx(v)?(e.consume(v),h):v===64?(e.consume(v),f):n(v)}function f(v){return v===46?e.check(az,x,m)(v):v===45||v===95||qn(v)?(c=!0,e.consume(v),f):x(v)}function m(v){return e.consume(v),a=!0,f}function x(v){return c&&a&&ss(i.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(v)):n(v)}}function cz(e,t,n){const i=this;return a;function a(u){return u!==87&&u!==119||!vN.call(i,i.previous)||av(i.events)?n(u):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(rz,e.attempt(fN,e.attempt(pN,c),n),n)(u))}function c(u){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(u)}}function uz(e,t,n){const i=this;let a="",c=!1;return u;function u(v){return(v===72||v===104)&&bN.call(i,i.previous)&&!av(i.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(v),e.consume(v),h):n(v)}function h(v){if(ss(v)&&a.length<5)return a+=String.fromCodePoint(v),e.consume(v),h;if(v===58){const b=a.toLowerCase();if(b==="http"||b==="https")return e.consume(v),f}return n(v)}function f(v){return v===47?(e.consume(v),c?m:(c=!0,f)):n(v)}function m(v){return v===null||cf(v)||Pt(v)||al(v)||Sf(v)?n(v):e.attempt(fN,e.attempt(pN,x),n)(v)}function x(v){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(v)}}function dz(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),c):n(u)}function c(u){return u===null?n(u):t(u)}}function hz(e,t,n){let i,a,c;return u;function u(m){return m===46||m===95?e.check(mN,f,h)(m):m===null||Pt(m)||al(m)||m!==45&&Sf(m)?f(m):(c=!0,e.consume(m),u)}function h(m){return m===95?i=!0:(a=i,i=void 0),e.consume(m),u}function f(m){return a||i||!c?n(m):t(m)}}function fz(e,t){let n=0,i=0;return a;function a(u){return u===40?(n++,e.consume(u),a):u===41&&i<n?c(u):u===33||u===34||u===38||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===60||u===63||u===93||u===95||u===126?e.check(mN,t,c)(u):u===null||Pt(u)||al(u)?t(u):(e.consume(u),a)}function c(u){return u===41&&i++,e.consume(u),a}}function pz(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),c):h===93?(e.consume(h),a):h===60||h===null||Pt(h)||al(h)?t(h):n(h)}function a(h){return h===null||h===40||h===91||Pt(h)||al(h)?t(h):i(h)}function c(h){return ss(h)?u(h):n(h)}function u(h){return h===59?(e.consume(h),i):ss(h)?(e.consume(h),u):n(h)}}function mz(e,t,n){return i;function i(c){return e.consume(c),a}function a(c){return qn(c)?n(c):t(c)}}function vN(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Pt(e)}function bN(e){return!ss(e)}function yN(e){return!(e===47||cx(e))}function cx(e){return e===43||e===45||e===46||e===95||qn(e)}function av(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 gz={tokenize:kz,partial:!0};function xz(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:_z,continuation:{tokenize:wz},exit:Sz}},text:{91:{name:"gfmFootnoteCall",tokenize:yz},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:vz,resolveTo:bz}}}}function vz(e,t,n){const i=this;let a=i.events.length;const c=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 m=hi(i.sliceSerialize({start:u.end,end:i.now()}));return m.codePointAt(0)!==94||!c.includes(m.slice(1))?n(f):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),t(f))}}function bz(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 c={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},u={type:"chunkString",contentType:"string",start:Object.assign({},c.start),end:Object.assign({},c.end)},h=[e[n+1],e[n+2],["enter",i,t],e[n+3],e[n+4],["enter",a,t],["exit",a,t],["enter",c,t],["enter",u,t],["exit",u,t],["exit",c,t],e[e.length-2],e[e.length-1],["exit",i,t]];return e.splice(n,e.length-n+1,...h),e}function yz(e,t,n){const i=this,a=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let c=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",m)}function m(v){if(c>999||v===93&&!u||v===null||v===91||Pt(v))return n(v);if(v===93){e.exit("chunkString");const b=e.exit("gfmFootnoteCallString");return a.includes(hi(i.sliceSerialize(b)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(v),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(v)}return Pt(v)||(u=!0),c++,e.consume(v),v===92?x:m}function x(v){return v===91||v===92||v===93?(e.consume(v),c++,m):m(v)}}function _z(e,t,n){const i=this,a=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let c,u=0,h;return f;function f(_){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(_),e.exit("gfmFootnoteDefinitionLabelMarker"),m}function m(_){return _===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(_),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",x):n(_)}function x(_){if(u>999||_===93&&!h||_===null||_===91||Pt(_))return n(_);if(_===93){e.exit("chunkString");const j=e.exit("gfmFootnoteDefinitionLabelString");return c=hi(i.sliceSerialize(j)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(_),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),b}return Pt(_)||(h=!0),u++,e.consume(_),_===92?v:x}function v(_){return _===91||_===92||_===93?(e.consume(_),u++,x):x(_)}function b(_){return _===58?(e.enter("definitionMarker"),e.consume(_),e.exit("definitionMarker"),a.includes(c)||a.push(c),_t(e,y,"gfmFootnoteDefinitionWhitespace")):n(_)}function y(_){return t(_)}}function wz(e,t,n){return e.check(Lu,t,e.attempt(gz,t,n))}function Sz(e){e.exit("gfmFootnoteDefinition")}function kz(e,t,n){const i=this;return _t(e,a,"gfmFootnoteDefinitionIndent",5);function a(c){const u=i.events[i.events.length-1];return u&&u[1].type==="gfmFootnoteDefinitionIndent"&&u[2].sliceSerialize(u[1],!0).length===4?t(c):n(c)}}function jz(e){let n=(e||{}).singleTilde;const i={name:"strikethrough",tokenize:c,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 m=f;for(;m--;)if(u[m][0]==="exit"&&u[m][1].type==="strikethroughSequenceTemporary"&&u[m][1]._open&&u[f][1].end.offset-u[f][1].start.offset===u[m][1].end.offset-u[m][1].start.offset){u[f][1].type="strikethroughSequence",u[m][1].type="strikethroughSequence";const x={type:"strikethrough",start:Object.assign({},u[m][1].start),end:Object.assign({},u[f][1].end)},v={type:"strikethroughText",start:Object.assign({},u[m][1].end),end:Object.assign({},u[f][1].start)},b=[["enter",x,h],["enter",u[m][1],h],["exit",u[m][1],h],["enter",v,h]],y=h.parser.constructs.insideSpan.null;y&&Ls(b,b.length,0,kf(y,u.slice(m+1,f),h)),Ls(b,b.length,0,[["exit",v,h],["enter",u[f][1],h],["exit",u[f][1],h],["exit",x,h]]),Ls(u,m-1,f-m+3,b),f=m+b.length-2;break}}for(f=-1;++f<u.length;)u[f][1].type==="strikethroughSequenceTemporary"&&(u[f][1].type="data");return u}function c(u,h,f){const m=this.previous,x=this.events;let v=0;return b;function b(_){return m===126&&x[x.length-1][1].type!=="characterEscape"?f(_):(u.enter("strikethroughSequenceTemporary"),y(_))}function y(_){const j=ko(m);if(_===126)return v>1?f(_):(u.consume(_),v++,y);if(v<2&&!n)return f(_);const N=u.exit("strikethroughSequenceTemporary"),S=ko(_);return N._open=!S||S===2&&!!j,N._close=!j||j===2&&!!S,h(_)}}}class Nz{constructor(){this.map=[],this.index=new Map}add(t,n,i){Cz(this,t,n,i)}consume(t){if(this.map.sort(function(c,u){return c[0]-u[0]}),this.map.length===0)return;let n=this.map.length;const i=[];for(;n>0;)n-=1,i.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];i.push(t.slice()),t.length=0;let a=i.pop();for(;a;){for(const c of a)t.push(c);a=i.pop()}this.map.length=0,this.index.clear()}}function Cz(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 c=[t,n,i];e.map.push(c),e.index.set(t,c)}function Ez(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 c=i.length-1;i[c]=i[c]==="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 Tz(){return{flow:{null:{name:"table",tokenize:Az,resolveAll:Mz}}}}function Az(e,t,n){const i=this;let a=0,c=0,u;return h;function h(I){let X=i.events.length-1;for(;X>-1;){const{type:W}=i.events[X][1];if(W==="lineEnding"||W==="linePrefix")X--;else break}const M=X>-1?i.events[X][1].type:null,de=M==="tableHead"||M==="tableRow"?O:f;return de===O&&i.parser.lazy[i.now().line]?n(I):de(I)}function f(I){return e.enter("tableHead"),e.enter("tableRow"),m(I)}function m(I){return I===124||(u=!0,c+=1),x(I)}function x(I){return I===null?n(I):qe(I)?c>1?(c=0,i.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),y):n(I):dt(I)?_t(e,x,"whitespace")(I):(c+=1,u&&(u=!1,a+=1),I===124?(e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),u=!0,x):(e.enter("data"),v(I)))}function v(I){return I===null||I===124||Pt(I)?(e.exit("data"),x(I)):(e.consume(I),I===92?b:v)}function b(I){return I===92||I===124?(e.consume(I),v):v(I)}function y(I){return i.interrupt=!1,i.parser.lazy[i.now().line]?n(I):(e.enter("tableDelimiterRow"),u=!1,dt(I)?_t(e,_,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):_(I))}function _(I){return I===45||I===58?N(I):I===124?(u=!0,e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),j):L(I)}function j(I){return dt(I)?_t(e,N,"whitespace")(I):N(I)}function N(I){return I===58?(c+=1,u=!0,e.enter("tableDelimiterMarker"),e.consume(I),e.exit("tableDelimiterMarker"),S):I===45?(c+=1,S(I)):I===null||qe(I)?R(I):L(I)}function S(I){return I===45?(e.enter("tableDelimiterFiller"),C(I)):L(I)}function C(I){return I===45?(e.consume(I),C):I===58?(u=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(I),e.exit("tableDelimiterMarker"),E):(e.exit("tableDelimiterFiller"),E(I))}function E(I){return dt(I)?_t(e,R,"whitespace")(I):R(I)}function R(I){return I===124?_(I):I===null||qe(I)?!u||a!==c?L(I):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(I)):L(I)}function L(I){return n(I)}function O(I){return e.enter("tableRow"),F(I)}function F(I){return I===124?(e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),F):I===null||qe(I)?(e.exit("tableRow"),t(I)):dt(I)?_t(e,F,"whitespace")(I):(e.enter("data"),D(I))}function D(I){return I===null||I===124||Pt(I)?(e.exit("data"),F(I)):(e.consume(I),I===92?Q:D)}function Q(I){return I===92||I===124?(e.consume(I),D):D(I)}}function Mz(e,t){let n=-1,i=!0,a=0,c=[0,0,0,0],u=[0,0,0,0],h=!1,f=0,m,x,v;const b=new Nz;for(;++n<e.length;){const y=e[n],_=y[1];y[0]==="enter"?_.type==="tableHead"?(h=!1,f!==0&&(d2(b,t,f,m,x),x=void 0,f=0),m={type:"table",start:Object.assign({},_.start),end:Object.assign({},_.end)},b.add(n,0,[["enter",m,t]])):_.type==="tableRow"||_.type==="tableDelimiterRow"?(i=!0,v=void 0,c=[0,0,0,0],u=[0,n+1,0,0],h&&(h=!1,x={type:"tableBody",start:Object.assign({},_.start),end:Object.assign({},_.end)},b.add(n,0,[["enter",x,t]])),a=_.type==="tableDelimiterRow"?2:x?3:1):a&&(_.type==="data"||_.type==="tableDelimiterMarker"||_.type==="tableDelimiterFiller")?(i=!1,u[2]===0&&(c[1]!==0&&(u[0]=u[1],v=yh(b,t,c,a,void 0,v),c=[0,0,0,0]),u[2]=n)):_.type==="tableCellDivider"&&(i?i=!1:(c[1]!==0&&(u[0]=u[1],v=yh(b,t,c,a,void 0,v)),c=u,u=[c[1],n,0,0])):_.type==="tableHead"?(h=!0,f=n):_.type==="tableRow"||_.type==="tableDelimiterRow"?(f=n,c[1]!==0?(u[0]=u[1],v=yh(b,t,c,a,n,v)):u[1]!==0&&(v=yh(b,t,u,a,n,v)),a=0):a&&(_.type==="data"||_.type==="tableDelimiterMarker"||_.type==="tableDelimiterFiller")&&(u[3]=n)}for(f!==0&&d2(b,t,f,m,x),b.consume(t.events),n=-1;++n<t.events.length;){const y=t.events[n];y[0]==="enter"&&y[1].type==="table"&&(y[1]._align=Ez(t.events,n))}return e}function yh(e,t,n,i,a,c){const u=i===1?"tableHeader":i===2?"tableDelimiter":"tableData",h="tableContent";n[0]!==0&&(c.end=Object.assign({},ao(t.events,n[0])),e.add(n[0],0,[["exit",c,t]]));const f=ao(t.events,n[1]);if(c={type:u,start:Object.assign({},f),end:Object.assign({},f)},e.add(n[1],0,[["enter",c,t]]),n[2]!==0){const m=ao(t.events,n[2]),x=ao(t.events,n[3]),v={type:h,start:Object.assign({},m),end:Object.assign({},x)};if(e.add(n[2],0,[["enter",v,t]]),i!==2){const b=t.events[n[2]],y=t.events[n[3]];if(b[1].end=Object.assign({},y[1].end),b[1].type="chunkText",b[1].contentType="text",n[3]>n[2]+1){const _=n[2]+1,j=n[3]-n[2]-1;e.add(_,j,[])}}e.add(n[3]+1,0,[["exit",v,t]])}return a!==void 0&&(c.end=Object.assign({},ao(t.events,a)),e.add(a,0,[["exit",c,t]]),c=void 0),c}function d2(e,t,n,i,a){const c=[],u=ao(t.events,n);a&&(a.end=Object.assign({},u),c.push(["exit",a,t])),i.end=Object.assign({},u),c.push(["exit",i,t]),e.add(n+1,0,c)}function ao(e,t){const n=e[t],i=n[0]==="enter"?"start":"end";return n[1][i]}const Rz={name:"tasklistCheck",tokenize:Lz};function Oz(){return{text:{91:Rz}}}function Lz(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"),c)}function c(f){return Pt(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 qe(f)?t(f):dt(f)?e.check({tokenize:Dz},t,n)(f):n(f)}}function Dz(e,t,n){return _t(e,i,"whitespace");function i(a){return a===null?n(a):t(a)}}function zz(e){return Aj([lz(),xz(),jz(e),Tz(),Oz()])}const $z={};function lv(e){const t=this,n=e||$z,i=t.data(),a=i.micromarkExtensions||(i.micromarkExtensions=[]),c=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),u=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);a.push(zz(n)),c.push(sz()),u.push(iz(n))}const Bz=1500;async function Pz(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 Ef({text:e,label:t="Copy",className:n=""}){const[i,a]=k.useState(!1),c=k.useRef(null);k.useEffect(()=>()=>{c.current&&clearTimeout(c.current)},[]);const u=async()=>{await Pz(e)&&(a(!0),c.current&&clearTimeout(c.current),c.current=setTimeout(()=>a(!1),Bz))},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 ff(e){var t;return e==null||typeof e=="boolean"?"":typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(ff).join(""):typeof e=="object"&&e!==null&&"props"in e?ff((t=e.props)==null?void 0:t.children):""}const o0=/https?:\/\/[^\s<>"'`]+/gi,Iz=`.,;:!?]}>'"`;function Fz(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,c=(i.match(/\)/g)||[]).length;if(a>=c)break;t--;continue}if(Iz.includes(n)){t--;continue}break}return e.slice(0,t)}function Uz(e){return/^https?:\/\/[^\s/]/i.test(e)}function Hz(e){if(!e)return[];const t=[];let n=0;o0.lastIndex=0;let i;for(;(i=o0.exec(e))!==null;){const a=Fz(i[0]);!a||!Uz(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,o0.lastIndex=n)}return n<e.length&&t.push({type:"text",value:e.slice(n)}),t}const h2=40;function qz(e){const t=e.replace(/\s+/g," ").trim();return t?`Copy ${t.length>h2?`${t.slice(0,h2-1)}…`:t}`:"Copy"}function _N({children:e,className:t="",textClassName:n="text-[12.5px] text-cc-fg/80"}){const i=ff(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=Hz(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((c,u)=>c.type==="link"?l.jsx("a",{href:c.href,target:"_blank",rel:"noopener noreferrer",className:"text-cc-primary underline decoration-cc-primary/40 hover:decoration-cc-primary",children:c.value},u):l.jsx("span",{children:c.value},u))}),l.jsx(Ef,{text:i,label:qz(i),className:"shrink-0 self-center w-4 h-4 -my-0.5 opacity-60 hover:opacity-100"})]})}const pf=25*1024*1024,mf=100*1024*1024;function wN(e){return new Promise((t,n)=>{const i=new FileReader;i.onload=()=>{const c=i.result.split(",")[1],u=e.type||"application/octet-stream";t({base64:c,mediaType:u})},i.onerror=n,i.readAsDataURL(e)})}function oa(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 SN(e){return e.startsWith("image/")}function kN({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 jN({name:e,mediaType:t,base64:n,size:i,onRemove:a,className:c="w-12 h-12"}){const u=SN(t);return l.jsxs("div",{className:"relative group",title:`${e} (${oa(i)})`,children:[l.jsx("div",{className:`${c} 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(kN,{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 Vz({name:e,mediaType:t,data:n,size:i}){return SN(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(kN,{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:oa(i)})]})]})}function Gz({message:e}){const t=fa(),[n,i]=k.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(c=>!c),"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 Yz({message:e}){return e.role==="system"?l.jsx(Gz,{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(Vz,{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(ov,{text:e.content})})]})}):l.jsx("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]",children:l.jsx(Zz,{message:e})})}function Xz(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 Qz(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 Wz(e){return e.kind==="content"&&e.block.type==="thinking"&&!e.block.thinking.trim()}function Kz({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 Zz({message:e}){var u;const t=e.contentBlocks||[],n=fa(),i=k.useMemo(()=>Xz(t),[t]),a=k.useMemo(()=>Qz(t),[t]),c=k.useMemo(()=>n?i.filter(h=>!Wz(h)):i,[i,n]);if(n&&c.length===0&&!((u=e.content)!=null&&u.trim()))return l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(Bh,{}),l.jsx("div",{className:"flex-1 min-w-0",children:l.jsx(Kz,{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(Bh,{}),l.jsx("div",{className:"flex-1 min-w-0",children:h?l.jsx(CN,{text:e.content}):l.jsx(ov,{text:e.content,showCursor:!!e.isStreaming})})]})}return l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(Bh,{}),l.jsx("div",{className:`flex-1 min-w-0 ${n?"space-y-1.5":"space-y-3"}`,children:c.map((h,f)=>{if(h.kind==="content")return l.jsx(Jz,{block:h.block,toolUseById:a},f);if(h.items.length===1){const m=h.items[0];return l.jsx(U2,{name:m.name,input:m.input,toolUseId:m.id},f)}return l.jsx(n$,{name:h.name,items:h.items},f)})})]})}function Bh(){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 ov({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(sv,{remarkPlugins:[lv],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,c=/language-(\w+)/.exec(a||"");if(c||typeof i=="string"&&i.includes(`
|
|
100
|
+
`)){const h=(c==null?void 0:c[1])||"",f=ff(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(Ef,{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(_N,{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 Jz({block:e,toolUseById:t}){if(e.type==="text")return l.jsx(ov,{text:e.text});if(e.type==="thinking")return l.jsx(CN,{text:e.thinking});if(e.type==="tool_use")return l.jsx(U2,{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,c=e.is_error??!1;return a==="Bash"?l.jsx(e$,{text:n,isError:c}):l.jsx(t$,{content:n,isError:c})}return null}function NN(e){return`${e} ${e===1?"line":"lines"}`}function e$({text:e,isError:t}){const n=e.split(/\r?\n/),i=n.length>20,[a,c]=k.useState(!1),u=fa(),[h,f]=k.useState(!1),m=a||!i?e:n.slice(-20).join(`
|
|
101
|
+
`),x=l.jsxs("div",{className:"relative rounded-lg bg-cc-code-bg overflow-hidden",children:[l.jsx(Ef,{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:m}),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:()=>c(!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(xf,{open:h,onToggle:()=>f(!h),marker:"›",label:t?"Error output":"Output",meta:NN(n.length),labelClassName:t?"text-cc-error/70":""}),h&&l.jsx("div",{className:"mt-1",children:x})]}):x}function t$({content:e,isError:t}){const n=fa(),[i,a]=k.useState(!1),c=l.jsxs("div",{className:"relative rounded-lg bg-cc-code-bg overflow-hidden",children:[l.jsx(Ef,{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(xf,{open:i,onToggle:()=>a(!i),marker:"›",label:t?"Error result":"Result",meta:NN(e.split(/\r?\n/).length),labelClassName:t?"text-cc-error/70":""}),i&&l.jsx("div",{className:"mt-1",children:c})]}):c}function n$({name:e,items:t}){const[n,i]=k.useState(!1),a=No(e),c=Oi(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(sl,{type:a}),l.jsx("span",{className:"text-xs font-medium text-cc-fg",children:c}),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=go(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 CN({text:e}){const t=e.trim(),n=fa(),[i,a]=k.useState(!1),c=t.split(`
|
|
102
|
+
`),u=n?2:8,h=n?200:600,f=c.length>u||t.length>h,m=f&&!i?c.slice(0,u).join(`
|
|
103
|
+
`):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(sv,{remarkPlugins:[lv],components:{p:({children:x})=>l.jsx("p",{className:"mb-2 last:mb-0",children:x}),ul:({children:x})=>l.jsx("ul",{className:"list-disc pl-4 mb-2 space-y-0.5",children:x}),ol:({children:x})=>l.jsx("ol",{className:"list-decimal pl-4 mb-2 space-y-0.5",children:x}),li:({children:x})=>l.jsx("li",{children:x}),code:({children:x})=>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:x})},children:m||"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 Zc(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function lo(e){const t=Math.floor(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function f2(e){try{const t=new Date(e).getTime()-Date.now();return Number.isFinite(t)?t<=0?"now":s$(t):"N/A"}catch{return"N/A"}}function ux(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),c=Math.floor(n%36e5/6e4);return i>0?`${i}d ${a}h`:a>0?`${a}h${c}m`:`${c}m`}function p2(e){return e>=1440?`${Math.round(e/1440)}d`:e>=60?`${Math.round(e/60)}h`:`${e}m`}function s$(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 i$({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(sl,{type:No(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:Oi(t.toolName)}),l.jsxs("span",{className:"text-cc-muted/50 tabular-nums",children:[t.elapsedSeconds,"s"]})]},n))})}function r$({entries:e}){const[t,n]=k.useState(!1),i=k.useMemo(()=>{const a=e.reduce((f,m)=>f+m.elapsedSeconds,0),c=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:c,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:`${Oi(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(a$,{entry:a,maxTime:i.maxTime},a.toolUseId))})]})}function a$({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(sl,{type:No(e.toolName)}),l.jsx("span",{className:"text-cc-fg/70 truncate",children:Oi(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 l$(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 o$(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:l$(t)}function c$(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 u$(e){if(e.length>=2)return!0;const t=e[0];return!(t.kind==="message"&&t.msg.role==="system")}function d$(e){const t=[];let n=[];const i=()=>{n.length!==0&&(u$(n)?t.push({kind:"activity_run",key:c$(n[0]),children:n}):t.push(...n),n=[])};for(const a of e)a.kind==="activity_run"||o$(a)?(i(),t.push(a)):n.push(a);return i(),t}const m2=160;function dx(e){const t=e.split(`
|
|
104
|
+
`).map(n=>n.trim()).find(n=>n.length>0);return t?t.length>m2?`${t.slice(0,m2)}…`:t:""}function EN(e,t){const n=go(e,t);return{label:n?`${Oi(e)} · ${n}`:Oi(e),toolName:e}}function h$(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.type==="tool_use")return EN(n.name,n.input);if(n.type==="text"&&n.text.trim())return{label:dx(n.text),italic:!0};if(n.type==="thinking"&&n.thinking.trim())return{label:dx(n.thinking),italic:!0}}return null}function f$(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?EN(n.name,n.input):null}case"activity_run":return Tf(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?h$(i)??{label:"Thinking…",italic:!0}:(t=n.content)!=null&&t.trim()?{label:dx(n.content),italic:!0}:{label:"Thinking…",italic:!0}}}}function TN(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,c]=TN(i);a!==null&&(t===null||a<t)&&(t=a),c!==null&&(n===null||c>n)&&(n=c)}return[t,n]}case"activity_run":{const t=Tf(e);return[t.startedAt,t.endedAt]}}}function Tf(e,t){let n=0,i=0,a=0,c=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=Tf(f);n+=v.toolCalls,i+=v.subagents,a+=v.errors}const[m,x]=TN(f);m!==null&&(c===null||m<c)&&(c=m),x!==null&&(u===null||x>u)&&(u=x)}t!==void 0&&c!==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:c,endedAt:u,latest:h?f$(h):null}}function p$({run:e,live:t,children:n}){const[i,a]=k.useState(!1),c=t?Date.now():void 0,u=k.useMemo(()=>Tf(e,c),[e,c]),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(lo(h));const m=t?"Working":"Worked",x=`${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(Bh,{}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("button",{type:"button",onClick:()=>a(b=>!b),"aria-expanded":i,"aria-label":`${m}: ${x}, ${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:m}),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((b,y)=>l.jsxs("span",{children:[l.jsx("span",{className:"text-cc-muted/35",children:" · "}),b]},y))}),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":x})]}),!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(sl,{type:No(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 _h=100,m$=40,g$=120,g2=1e4,x$=15*6e4,c0=new Map,v$=[],b$=[];function y$(e){const t=e.split("/").filter(Boolean);return t.length===0?e:t.slice(-2).join("/")}function _$(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 x2(e){return(e.contentBlocks||[]).filter(n=>n.type==="tool_use").map(n=>({id:n.id,name:n.name,input:n.input}))}function w$(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 AN(e){const t=[];for(const n of e){const i=_$(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(...x2(n)),a.endedAt=Math.max(a.endedAt,n.timestamp);continue}t.push({kind:"tool_msg_group",toolName:i,items:x2(n),firstId:n.id,startedAt:n.timestamp,endedAt:n.timestamp})}else t.push({kind:"message",msg:n})}return t}function MN(e,t,n){const i=AN(e),a=[];for(const c of i){a.push(c);const u=w$(c);for(const h of u){const f=n.get(h);if(f&&f.length>0){const m=t.get(h)||{description:"Subagent",agentType:""},x=MN(f,t,n);a.push({kind:"subagent",taskToolUseId:h,description:m.description,agentType:m.agentType,backend:m.backend,status:m.status,receiverCount:m.receiverCount,senderThreadId:m.senderThreadId,receiverThreadIds:m.receiverThreadIds,children:x})}}}return a}function S$(e){const t=new Map;for(const a of e)if(a.contentBlocks){for(const c of a.contentBlocks)if(c.type==="tool_use"&&c.name==="Task"){const{input:u,id:h}=c,f=Array.isArray(u==null?void 0:u.receiver_thread_ids)?u.receiver_thread_ids.filter(b=>typeof b=="string"&&b.length>0):void 0,m=f&&f.length>0?f.length:void 0,x=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"||x!==void 0||m!==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:m,senderThreadId:x,receiverThreadIds:f})}}if(t.size===0)return AN(e);const n=new Map,i=[];for(const a of e)if(a.parentToolUseId&&t.has(a.parentToolUseId)){let c=n.get(a.parentToolUseId);c||(c=[],n.set(a.parentToolUseId,c)),c.push(a)}else i.push(a);return MN(i,t,n)}function k$({group:e}){const[t,n]=k.useState(!1),i=No(e.toolName),a=Oi(e.toolName),c=e.items.length;if(c===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(v2,{}),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(sl,{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:go(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(v2,{}),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(sl,{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:c})]}),t&&l.jsx("div",{className:"border-t border-cc-border px-3 py-1.5",children:e.items.map((u,h)=>{const f=go(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(p$,{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(k$,{group:i},i.firstId||a);if(i.kind==="subagent")return l.jsx(C$,{group:i},i.taskToolUseId);const c=i.msg,u=j$(c),h=t&&u.length>0?t.filter(m=>u.includes(m.toolUseId)):[],f=h.length>0&&h.every(m=>m.completedAt);return l.jsxs("div",{children:[l.jsx(Yz,{message:c}),f&&l.jsx(r$,{entries:h})]},c.id)})})}function j$(e){var t;return(t=e.contentBlocks)!=null&&t.length?e.contentBlocks.filter(n=>n.type==="tool_use").map(n=>n.id):[]}function N$(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 C$({group:e}){const[t,n]=k.useState(!1),i=e.description||"Subagent",a=e.agentType,c=e.children.length,u=N$(e.status),h=e.receiverCount,f=e.senderThreadId,m=e.receiverThreadIds||[],x=e.backend||"claude",v=e.children[e.children.length-1],b=k.useMemo(()=>{var y,_;if(!v)return"";if(v.kind==="tool_msg_group")return`${Oi(v.toolName)}${v.items.length>1?` ×${v.items.length}`:""}`;if(v.kind==="message"&&v.msg.role==="assistant"){const j=(y=v.msg.content)==null?void 0:y.trim();if(j)return j.length>60?j.slice(0,60)+"...":j;const N=(_=v.msg.contentBlocks)==null?void 0:_.find(S=>S.type==="tool_use");if(N)return Oi(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:x==="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&&b&&l.jsx("span",{className:"text-[11px] text-cc-muted/40 truncate ml-1 font-mono-code",children:b}),l.jsx("span",{className:"text-[10px] text-cc-muted/40 tabular-nums shrink-0 ml-auto",children:c})]}),t&&l.jsxs("div",{className:"space-y-3 pb-2 mt-1",children:[(f||m.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]}),m.length>0&&l.jsxs("span",{children:["receivers: ",m.map(y=>l.jsx("span",{className:"font-mono-code ml-1",children:y},y))]})]}),l.jsx(cv,{entries:e.children})]})]})})}function v2(){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 E$({sessionId:e}){var nn;const t=K(se=>se.messages.get(e)??v$),n=K(se=>(se.sdkSessions||b$).find(je=>je.sessionId===e)),i=K(se=>se.streamingStartedAt.get(e)),a=K(se=>se.streamingOutputTokens.get(e)),c=K(se=>se.sessionStatus.get(e)),u=K(se=>se.lastActivityAt.get(e)),h=K(se=>se.sessionProcesses.get(e)),f=K(se=>se.toolProgress.get(e)),m=K(se=>se.toolActivity.get(e)),x=k.useRef(null),v=k.useRef(null),b=k.useRef(!0),[y,_]=k.useState(0),[j,N]=k.useState(_h),[S,C]=k.useState([]),[E,R]=k.useState(0),[L,O]=k.useState(!1),[F,D]=k.useState(!1),[Q,I]=k.useState(!1),[X,M]=k.useState(""),de=k.useRef(new Set),W=K(se=>se.chatTabReentryTickBySession.get(e)??0),q=k.useMemo(()=>t.some(se=>se.role==="assistant"&&se.isStreaming),[t]),H=k.useMemo(()=>(h??[]).filter(se=>se.status==="running"),[h]),U=H.length>0,re=k.useMemo(()=>{const se=m??[];for(let je=se.length-1;je>=0;je--)if(!se[je].completedAt)return se[je]},[m]),ve=k.useMemo(()=>H.length>0?Math.min(...H.map(se=>se.startedAt)):null,[H]),A=k.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]),Ee=A.length>0,Me=n!=null&&n.forkSession?"Forked from":"Continuing from",z=k.useMemo(()=>{if(S.length===0)return t;const se=[],je=new Set;for(const Xe of S)je.has(Xe.id)||(je.add(Xe.id),se.push(Xe));for(const Xe of t)je.has(Xe.id)||(je.add(Xe.id),se.push(Xe));return se},[S,t]),P=k.useMemo(()=>S$(z),[z]);k.useEffect(()=>{N(_h),C([]),R(0),O(!1),D(!1),I(!1),M(""),de.current=new Set},[e,A]);const oe=P.length,_e=oe>j,Ne=k.useMemo(()=>_e?P.slice(oe-j):P,[P,_e,oe,j]),Ae=oe-Ne.length,Le=fa(),De=k.useMemo(()=>Le?d$(Ne):Ne,[Le,Ne]),Ce=De[De.length-1],Re=c==="running"&&(Ce==null?void 0:Ce.kind)==="activity_run"?Ce.key:void 0,It=k.useCallback(()=>{const se=v.current,je=(se==null?void 0:se.scrollHeight)??0;N(Xe=>Xe+_h),requestAnimationFrame(()=>{if(se){const Xe=se.scrollHeight;se.scrollTop+=Xe-je}})},[]),Wt=k.useCallback(async(se={})=>{if(!Ee||!A||Q)return;const je=v.current,Xe=(je==null?void 0:je.scrollHeight)??0,et=F?E:0;I(!0),M("");try{const un=await ke.getClaudeSessionHistory(A,{cursor:et,limit:m$}),ce=un.messages.map(G=>({id:G.id,role:G.role,content:G.content,contentBlocks:G.role==="assistant"?G.contentBlocks:void 0,timestamp:G.timestamp||Date.now(),model:G.role==="assistant"?G.model:void 0,stopReason:G.role==="assistant"?G.stopReason:void 0})),be=[];for(const G of ce)de.current.has(G.id)||(de.current.add(G.id),be.push(G));C(G=>[...be,...G]),R(un.nextCursor),O(un.hasMore),D(!0),be.length>0&&N(G=>G+be.length),se.preserveScroll!==!1&&je&&requestAnimationFrame(()=>{const G=je.scrollHeight;je.scrollTop+=G-Xe})}catch(un){const ce=un instanceof Error?un.message:String(un);M(ce||"Failed to load previous history"),F||(C([]),R(0),O(!1))}finally{I(!1)}},[Ee,A,Q,F,E]);k.useEffect(()=>{if(!i&&c!=="running"&&!U){_(0);return}const se=i||Date.now();_(Date.now()-se);const je=setInterval(()=>_(Date.now()-se),1e3);return()=>clearInterval(je)},[i,c,U]);function Ft(){const se=v.current;if(!se)return;b.current=se.scrollHeight-se.scrollTop-se.clientHeight<120;const je=Math.max(0,se.scrollHeight-se.clientHeight-se.scrollTop);c0.set(e,je),Ee&&F&&L&&!Q&&se.scrollTop<=g$&&Wt({preserveScroll:!0})}const Nt=k.useCallback(()=>{const se=v.current;if(!se)return;const je=se.style.scrollBehavior;se.style.scrollBehavior="auto",se.scrollTop=se.scrollHeight,se.style.scrollBehavior=je},[]),wt=k.useCallback(()=>{const se=v.current;if(!se)return;const je=se.style.scrollBehavior;se.style.scrollBehavior="auto";const Xe=c0.get(e);typeof Xe=="number"?se.scrollTop=Math.max(0,se.scrollHeight-se.clientHeight-Xe):se.scrollTop=se.scrollHeight,se.style.scrollBehavior=je},[e]);if(k.useEffect(()=>{requestAnimationFrame(()=>wt())},[e,wt]),k.useEffect(()=>()=>{const se=v.current;if(!se)return;const je=Math.max(0,se.scrollHeight-se.clientHeight-se.scrollTop);c0.set(e,je)},[e]),k.useEffect(()=>{W&&requestAnimationFrame(()=>Nt())},[W,Nt]),k.useEffect(()=>{var se;b.current&&((se=x.current)==null||se.scrollIntoView({behavior:"smooth"}))},[t]),z.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:Ee?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:[Me," ",l.jsx("span",{className:"font-mono-code text-cc-fg/70",children:A.slice(0,8)}),". Load earlier messages when needed."]}),l.jsxs("button",{onClick:()=>void Wt({preserveScroll:!1}),disabled:Q,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"})}),Q?"Loading...":"Load previous history"]}),X&&l.jsx("p",{className:"text-xs text-cc-error mt-2",children:X})]}):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 Qe=c==="running"&&u!=null?Math.max(0,Date.now()-u):0,St=U&&(c!=="running"||Qe>=g2)?"background":Qe>=x$&&!re?"stalled":Qe>=g2?"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:Ft,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:[Ee&&!F&&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:[Me," existing Claude thread"]}),l.jsxs("p",{className:"text-[11px] text-cc-muted mt-1",children:[A," ",n!=null&&n.cwd?`· ${y$(n.cwd)}`:""]})]}),l.jsx("button",{onClick:()=>void Wt({preserveScroll:!0}),disabled:Q,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:Q?"Loading...":"Load previous history"})]}),X&&l.jsx("p",{className:"text-xs text-cc-error mt-2",children:X})]}),Ee&&F&&l.jsx("div",{className:"flex justify-center",children:l.jsx("p",{className:"text-[11px] text-cc-muted",children:L?Q?"Loading older transcript...":"Scroll to top to load older transcript":"Loaded all available prior transcript"})}),_e&&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(_h,Ae)," more",l.jsxs("span",{className:"text-cc-muted/50 tabular-nums",children:["(",Ae," hidden)"]})]})}),l.jsx(cv,{entries:De,toolActivity:m,liveRunKey:Re}),f&&f.size>0&&!q&&l.jsx(i$,{tools:Array.from(f.values())}),c==="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..."})]}),(c==="running"||U)&&y>=0&&l.jsxs("div",{"data-testid":"activity-indicator","data-activity-tier":St,className:`flex items-center gap-2 text-[11px] font-mono-code pl-10 stats-glow py-1 ${St==="stalled"?"text-cc-warning":"text-cc-muted"}`,children:[l.jsx("span",{className:`inline-block w-2 h-2 rounded-full ${St==="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]"}`}),St==="background"?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-fg/70",children:H.length===1?"Background process running":`${H.length} background processes running`}),ve!=null&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/30",children:"|"}),l.jsx("span",{className:"tabular-nums",children:lo(Math.max(0,Date.now()-ve))})]}),((nn=H[0])==null?void 0:nn.description)&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/30",children:"|"}),l.jsx("span",{className:"truncate max-w-[24ch]",children:H[0].description})]})]}):St==="stalled"?l.jsxs("span",{children:["No activity for ",lo(Qe)," — the agent may be stuck"]}):St==="quiet"?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-fg/70",children:re?`Running ${re.toolName}`:"Still working…"}),l.jsx("span",{className:"text-cc-muted/30",children:"|"}),l.jsx("span",{className:"tabular-nums",children:re?lo(Math.max(0,Date.now()-re.startedAt)):`no update for ${lo(Qe)}`}),(re==null?void 0:re.preview)&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/30",children:"|"}),l.jsx("span",{className:"truncate max-w-[32ch]",children:re.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:lo(y)}),(a??0)>0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/30",children:"|"}),l.jsxs("span",{className:"tabular-nums",children:[Zc(a)," tokens"]})]})]})]}),l.jsx("div",{ref:x})]})})]})}const T$={codex:"✳",xhigh:"★",max:"■",mini:"⚡"};function A$(e,t){for(const[i,a]of Object.entries(T$))if(e.includes(i))return a;const n=["◆","●","◕","✦"];return n[t%n.length]}function M$(e){return e.map((t,n)=>({value:t.value,label:t.label||t.value,icon:A$(t.value,n)}))}const RN=[{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",label:"Sonnet 5",icon:""},{value:"claude-haiku-4-5-20251001",label:"Haiku 4.5",icon:""}],ON=[{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:"●"}],uv=[{value:"bypassPermissions",label:"Agent"},{value:"plan",label:"Plan"}],dv=[{value:"bypassPermissions",label:"Auto"},{value:"plan",label:"Plan"}],R$=[{value:"",label:"Default"},{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"xhigh",label:"xHigh"},{value:"max",label:"Max"}],LN=[{value:"bypassPermissions",label:"Full Auto"},{value:"acceptEdits",label:"Auto-Edit"},{value:"default",label:"Supervised"}],DN=[{value:"bypassPermissions",label:"Full Auto"},{value:"default",label:"Supervised"}];function zN(e){return e==="codex"?ON:RN}function b2(e){return e==="codex"?dv:uv}function nP(e){return e==="codex"?DN:LN}function y2(e){return e==="codex"?ON[0].value:RN[0].value}function _2(e){return e==="codex"?dv[0].value:uv[0].value}function sP(e){return e==="codex"?DN[0].value:LN[0].value}function O$(e){return e==="codex"?[]:R$}function w2({sessionId:e}){const[t,n]=k.useState(!1),i=k.useRef(null),a=K(b=>b.sdkSessions.find(y=>y.sessionId===e)||null),c=K(b=>b.sessions.get(e)),u=K(b=>b.cliConnected.get(e)??!1),h=(a==null?void 0:a.backendType)??(c==null?void 0:c.backend_type)??"claude",f=(c==null?void 0:c.model)??(a==null?void 0:a.model)??"",m=zN(h),x=m.find(b=>b.value===f)||(f?{label:f,icon:"?"}:null),v=k.useCallback(b=>{if(n(!1),b===f)return;Un(e,{type:"set_model",model:b});const{sdkSessions:y,setSdkSessions:_}=K.getState();_(y.map(j=>j.sessionId===e?{...j,model:b}:j))},[e,f]);return k.useEffect(()=>{if(!t)return;const b=y=>{i.current&&!i.current.contains(y.target)&&n(!1)};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[t]),k.useEffect(()=>{if(!t)return;const b=y=>{y.key==="Escape"&&n(!1)};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[t]),!u||!x?null:l.jsxs("div",{ref:i,className:"relative shrink-0",children:[l.jsxs("button",{onClick:()=>n(b=>!b),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: ${x.label}`,"aria-label":"Switch model","aria-expanded":t,"aria-haspopup":"listbox",children:[x.icon&&l.jsx("span",{className:"text-[13px] leading-none",children:x.icon}),l.jsx("span",{children:x.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:m.map(b=>l.jsxs("button",{onClick:()=>v(b.value),className:`w-full flex items-center gap-2 px-3 min-h-[44px] text-[13px] transition-colors cursor-pointer ${b.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":b.value===f,children:[b.icon&&l.jsx("span",{className:"text-[14px] leading-none w-5 text-center",children:b.icon}),l.jsx("span",{className:"flex-1 text-left",children:b.label}),b.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"})})]},b.value))})]})}function $N({open:e,loading:t,prompts:n,selectedIndex:i,onSelect:a,menuRef:c,className:u=""}){return e?l.jsx("div",{ref:c,className:`max-h-[240px] overflow-y-auto bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-20 py-1 ${u}`,children:t?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 BN({text:e,caretPos:t,cwd:n,enabled:i=!0}){const[a,c]=k.useState(!1),[u,h]=k.useState(0),[f,m]=k.useState([]),[x,v]=k.useState(!1),b=k.useRef(null),y=k.useCallback(async()=>{v(!0);try{const S=await ke.listPrompts(n);m(S.filter(C=>!!C.name.trim()))}catch{m([])}finally{v(!1)}},[n]);k.useEffect(()=>{y()},[y]);const _=k.useMemo(()=>{const S=e.slice(0,t),C=S.match(/(^|\s)@([^\s@]*)$/);if(!C||C.index===void 0)return null;const E=S.length-C[0].length+C[1].length;return{query:C[2]||"",start:E,end:t}},[e,t]),j=k.useMemo(()=>{if(!a||!_)return[];const S=_.query.toLowerCase();if(!S)return f;const C=f.filter(R=>R.name.toLowerCase().startsWith(S)),E=f.filter(R=>!R.name.toLowerCase().startsWith(S)&&R.name.toLowerCase().includes(S));return[...C,...E]},[a,_,f]);k.useEffect(()=>{const S=i&&!!_;S&&!a?(c(!0),h(0)):!S&&a&&c(!1)},[i,_,a]),k.useEffect(()=>{u>=j.length&&h(Math.max(0,j.length-1))},[j.length,u]),k.useEffect(()=>{if(!b.current||!a)return;const C=b.current.querySelectorAll("[data-prompt-index]")[u];C&&C.scrollIntoView({block:"nearest"})},[u,a]);const N=k.useCallback(S=>{if(!_)return{nextText:e,nextCursor:t};const C=`${S.content} `,E=`${e.slice(0,_.start)}${C}${e.slice(_.end)}`,R=_.start+C.length;return{nextText:E,nextCursor:R}},[_,e,t]);return{mentionMenuOpen:a,setMentionMenuOpen:c,mentionMenuIndex:u,setMentionMenuIndex:h,mentionContext:_,filteredPrompts:j,promptsLoading:x,savedPrompts:f,selectPrompt:N,refreshPrompts:y,mentionMenuRef:b}}const L$=[];function S2({isPlan:e,isConnected:t,onToggle:n,modeLabel:i,size:a}){const c=a==="desktop",u=c?"px-2.5 py-1.5":"px-2 py-1",h=c?"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=c?"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 wh({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 k2(){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 j2({isRunning:e,canSend:t,onSend:n,onInterrupt:i,size:a}){const c=a==="desktop",u=c?"w-9 h-9":"w-10 h-10",h=c?"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 D$({sessionId:e}){var ce,be;const[t,n]=k.useState(""),[i,a]=k.useState([]),[c,u]=k.useState(null),[h,f]=k.useState(!1),[m,x]=k.useState(!1),[v,b]=k.useState(0),[y,_]=k.useState(!1),[j,N]=k.useState(""),[S,C]=k.useState("global"),[E,R]=k.useState(null),[L,O]=k.useState(0),F=k.useRef(null),D=k.useRef(null),Q=k.useRef(null),I=k.useRef(null),X=K(G=>G.cliConnected),M=K(G=>G.sessions.get(e)),de=K(G=>G.previousPermissionMode.get(e)||"acceptEdits"),W=X.get(e)??!1,q=(M==null?void 0:M.permissionMode)||"acceptEdits",H=q==="plan",U=(M==null?void 0:M.backend_type)==="codex",ve=((be=(ce=(U?dv:uv).find(G=>G.value===q))==null?void 0:ce.label)==null?void 0:be.toLowerCase())||q,A=BN({text:t,caretPos:L,cwd:M==null?void 0:M.cwd,enabled:!m}),Ee=k.useMemo(()=>{const G=[];if(M!=null&&M.slash_commands)for(const me of M.slash_commands)G.push({name:me,type:"command"});if(M!=null&&M.skills)for(const me of M.skills)G.push({name:me,type:"skill"});return G},[M==null?void 0:M.slash_commands,M==null?void 0:M.skills]),Me=k.useMemo(()=>{if(!m)return[];const G=t.match(/^\/(\S*)$/);if(!G)return[];const me=G[1].toLowerCase();return me===""?Ee:Ee.filter(Pe=>Pe.name.toLowerCase().includes(me))},[t,m,Ee]);k.useEffect(()=>{const G=t.startsWith("/")&&/^\/\S*$/.test(t)&&Ee.length>0;G&&!m?(x(!0),b(0)):!G&&m&&x(!1)},[t,Ee.length,m]),k.useEffect(()=>{v>=Me.length&&b(Math.max(0,Me.length-1))},[Me.length,v]),k.useEffect(()=>{if(!Q.current||!m)return;const me=Q.current.querySelectorAll("[data-cmd-index]")[v];me&&me.scrollIntoView({block:"nearest"})},[v,m]),k.useEffect(()=>{if(I.current===null||!F.current)return;const G=I.current;F.current.setSelectionRange(G,G),I.current=null},[t]);const z=k.useCallback(G=>{var me;n(`/${G.name} `),x(!1),(me=F.current)==null||me.focus()},[]),P=k.useCallback(G=>{var Pe;const me=A.selectPrompt(G);I.current=me.nextCursor,n(me.nextText),A.setMentionMenuOpen(!1),O(me.nextCursor),(Pe=F.current)==null||Pe.focus(),F.current&&(F.current.style.height="auto",F.current.style.height=Math.min(F.current.scrollHeight,200)+"px")},[A]);function oe(){var at;const G=t.trim();if(!G||!W)return;const me=x0(),Pe=i.length>0?i.map(ht=>({name:ht.name,media_type:ht.mediaType,data:ht.base64,size:ht.size})):void 0;Un(e,{type:"user_message",content:G,session_id:e,attachments:Pe,client_msg_id:me});const Ke=K.getState();Ke.appendMessage(e,{id:me,role:"user",content:G,attachments:Pe,timestamp:Date.now()}),Ke.setSessionStatus(e,"running"),Ke.setLastActivity(e,Date.now()),Ke.streamingStartedAt.has(e)||Ke.setStreamingStats(e,{startedAt:Date.now()}),n(""),a([]),u(null),x(!1),A.setMentionMenuOpen(!1),F.current&&(F.current.style.height="auto"),(at=F.current)==null||at.focus()}function _e(G){if(m&&Me.length>0){if(G.key==="ArrowDown"){G.preventDefault(),b(me=>(me+1)%Me.length);return}if(G.key==="ArrowUp"){G.preventDefault(),b(me=>(me-1+Me.length)%Me.length);return}if(G.key==="Tab"&&!G.shiftKey){G.preventDefault(),z(Me[v]);return}if(G.key==="Enter"&&!G.shiftKey){G.preventDefault(),z(Me[v]);return}if(G.key==="Escape"){G.preventDefault(),x(!1);return}}if(A.mentionMenuOpen&&G.key==="Escape"){G.preventDefault(),A.setMentionMenuOpen(!1);return}if(A.mentionMenuOpen&&A.filteredPrompts.length>0){if(G.key==="ArrowDown"){G.preventDefault(),A.setMentionMenuIndex(me=>(me+1)%A.filteredPrompts.length);return}if(G.key==="ArrowUp"){G.preventDefault(),A.setMentionMenuIndex(me=>(me-1+A.filteredPrompts.length)%A.filteredPrompts.length);return}if(G.key==="Tab"&&!G.shiftKey||G.key==="Enter"&&!G.shiftKey){G.preventDefault(),P(A.filteredPrompts[A.mentionMenuIndex]);return}}if(A.mentionMenuOpen&&A.filteredPrompts.length===0&&(G.key==="Enter"&&!G.shiftKey||G.key==="Tab"&&!G.shiftKey)){G.preventDefault();return}if(G.key==="Tab"&&G.shiftKey){G.preventDefault(),Qe();return}G.key==="Enter"&&!G.shiftKey&&(G.preventDefault(),oe())}function Ne(G){n(G.target.value),O(G.target.selectionStart??G.target.value.length);const me=G.target;me.style.height="auto",me.style.height=Math.min(me.scrollHeight,200)+"px"}function Ae(){F.current&&O(F.current.selectionStart??0)}function Le(){Un(e,{type:"interrupt"})}async function De(G){if(G.length===0)return;const me=[],Pe=[];let Ke=i.reduce((at,ht)=>at+ht.size,0);for(const at of G){if(at.size>pf){Pe.push(`${at.name} is too large (${oa(at.size)}, max ${oa(pf)})`);continue}if(Ke+at.size>mf){Pe.push(`${at.name} would exceed the per-message limit (${oa(mf)})`);continue}const{base64:ht,mediaType:fn}=await wN(at);me.push({name:at.name,base64:ht,mediaType:fn,size:at.size}),Ke+=at.size}me.length>0&&a(at=>[...at,...me]),u(Pe.length>0?Pe.join("; "):null)}async function Ce(G){const me=G.target.files;me&&(await De(Array.from(me)),G.target.value="")}function Re(G){a(me=>me.filter((Pe,Ke)=>Ke!==G))}async function It(G){var Ke;const me=(Ke=G.clipboardData)==null?void 0:Ke.items;if(!me)return;const Pe=[];for(const at of Array.from(me)){if(at.kind!=="file")continue;const ht=at.getAsFile();if(!ht)continue;const fn=ht.name&&ht.name.length>0?ht.name:`pasted-${Date.now()}.${(ht.type.split("/")[1]||"bin").replace(/[^a-zA-Z0-9]/g,"")}`;Pe.push(new File([ht],fn,{type:ht.type,lastModified:ht.lastModified}))}Pe.length>0&&(G.preventDefault(),await De(Pe))}function Wt(G){G.dataTransfer.types.includes("Files")&&(G.preventDefault(),G.stopPropagation(),f(!0))}function Ft(G){G.currentTarget===G.target&&f(!1)}async function Nt(G){if(!G.dataTransfer.types.includes("Files"))return;G.preventDefault(),G.stopPropagation(),f(!1);const me=Array.from(G.dataTransfer.files);me.length>0&&await De(me)}function wt(){const G=t.trim().slice(0,32);N(G||""),R(null),_(me=>!me)}function Qe(){if(!W)return;const G=K.getState();if(!H)G.setPreviousPermissionMode(e,q),Un(e,{type:"set_permission_mode",mode:"plan"}),G.updateSession(e,{permissionMode:"plan"});else{const me=de||(U?"bypassPermissions":"acceptEdits");Un(e,{type:"set_permission_mode",mode:me}),G.updateSession(e,{permissionMode:me})}}async function St(){const G=t.trim(),me=j.trim();if(!G||!me)return;if(S==="project"&&!(M!=null&&M.cwd)){R("No project folder available for this session");return}const Pe={name:me,content:G,scope:S};S==="project"&&(Pe.projectPaths=[M.cwd]);try{await ke.createPrompt(Pe),await A.refreshPrompts(),_(!1),N(""),C("global"),R(null)}catch(Ke){const at=Ke instanceof Error&&Ke.message?Ke.message:"Could not save prompt.";R(at)}}const se=K(G=>G.promptSuggestions.get(e))??L$,je=K(G=>G.clearPromptSuggestions),et=K(G=>G.sessionStatus).get(e)==="running",un=t.trim().length>0&&W;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:Wt,onDragLeave:Ft,onDrop:Nt,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((G,me)=>l.jsx(jN,{name:G.name,mediaType:G.mediaType,base64:G.base64,size:G.size,onRemove:()=>Re(me)},me))}),c&&l.jsx("div",{className:"mb-2 px-3 sm:px-0 text-[11px] text-cc-error",children:c}),l.jsx("input",{ref:D,type:"file",multiple:!0,onChange:Ce,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((G,me)=>l.jsx("button",{onClick:()=>{if(!W||et)return;const Pe=x0();Un(e,{type:"user_message",content:G,session_id:e,client_msg_id:Pe}),K.getState().appendMessage(e,{id:Pe,role:"user",content:G,timestamp:Date.now()}),je(e)},disabled:!W||et,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:G,children:G},me))}),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 ${H?"sm:border-cc-primary/40 sm:shadow-[0_10px_30px_rgba(217,119,87,0.08)]":"sm:focus-within:border-cc-primary/25"}`,children:[m&&Me.length>0&&l.jsx("div",{ref:Q,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:Me.map((G,me)=>l.jsxs("button",{"data-cmd-index":me,onClick:()=>z(G),className:`w-full px-3 py-2 text-left flex items-center gap-2.5 transition-colors cursor-pointer ${me===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:G.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:["/",G.name]}),l.jsx("span",{className:"ml-2 text-[11px] text-cc-muted",children:G.type})]})]},`${G.type}-${G.name}`))}),l.jsx($N,{open:A.mentionMenuOpen,loading:A.promptsLoading,prompts:A.filteredPrompts,selectedIndex:A.mentionMenuIndex,onSelect:P,menuRef:A.mentionMenuRef,className:"absolute left-2 right-2 bottom-full mb-1"}),y&&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:j,onChange:G=>{N(G.target.value),E&&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"&&(M==null?void 0:M.cwd)&&l.jsx("div",{className:"text-[10px] text-cc-muted font-mono-code truncate",title:M.cwd,children:M.cwd}),E?l.jsx("div",{className:"text-[11px] text-cc-error",children:E}):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:St,disabled:!j.trim()||!t.trim(),className:`px-2 py-1 text-[11px] rounded-md border ${j.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(S2,{isPlan:H,isConnected:W,onToggle:Qe,modeLabel:ve,size:"mobile"}),l.jsx(w2,{sessionId:e}),l.jsx("div",{className:"flex-1"}),l.jsx(wh,{onClick:wt,disabled:!W||!t.trim(),active:W&&!!t.trim(),title:"Save as prompt",children:l.jsx(k2,{})}),l.jsx(wh,{onClick:()=>{var G;return(G=D.current)==null?void 0:G.click()},disabled:!W,active:W,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:F,value:t,onChange:Ne,onKeyDown:_e,onClick:Ae,onKeyUp:Ae,onPaste:It,"aria-label":"Message input",placeholder:W?"Type a message... (/ + @)":"Waiting for CLI connection...",disabled:!W,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(j2,{isRunning:et,canSend:un,onSend:oe,onInterrupt:Le,size:"mobile"})}),l.jsxs("div",{className:"hidden sm:flex items-center gap-1.5 px-2.5 pb-2",children:[l.jsx(wh,{onClick:()=>{var G;return(G=D.current)==null?void 0:G.click()},disabled:!W,active:W,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(wh,{onClick:wt,disabled:!W||!t.trim(),active:W&&!!t.trim(),title:"Save as prompt",children:l.jsx(k2,{})}),l.jsx(S2,{isPlan:H,isConnected:W,onToggle:Qe,modeLabel:ve,size:"desktop"}),l.jsx("div",{className:"flex-1"}),l.jsx(w2,{sessionId:e}),l.jsx(j2,{isRunning:et,canSend:un,onSend:oe,onInterrupt:Le,size:"desktop"})]})]})]})})}function z$(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 $$(e,t){const n={};for(const[i,a]of Object.entries(t)){const c=e[Number(i)],u=typeof(c==null?void 0:c.question)=="string"&&c.question?c.question:i;n[u]=a}return n}function B$({permission:e,sessionId:t}){const[n,i]=k.useState(!1),a=K(m=>m.removePermission);function c(m,x){i(!0),Un(t,{type:"permission_response",request_id:e.request_id,behavior:"allow",updated_input:m,...x!=null&&x.length?{updated_permissions:x}:{}}),a(t,e.request_id)}function u(){i(!0),Un(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(H$,{input:e.input,onSelect:m=>c({...e.input,answers:m}),disabled:n}):l.jsx(F$,{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(I$,{validation:e.ai_validation}),!h&&l.jsxs("div",{className:"flex items-center gap-2 mt-3 flex-wrap",children:[l.jsxs("button",{onClick:()=>c(),disabled:n,className:"inline-flex items-center gap-1.5 px-3 py-2.5 text-xs font-medium rounded-lg bg-cc-success/90 hover:bg-cc-success text-white disabled:opacity-50 transition-colors cursor-pointer",children:[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((m,x)=>l.jsxs("button",{onClick:()=>c(void 0,[m]),disabled:n,title:`${m.type}: ${JSON.stringify(m)}`,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"})}),z$(m)]},x)),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 P$(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 I$({validation:e}){const t=e.verdict==="uncertain"&&P$(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 F$({toolName:e,input:t,description:n}){return e==="Bash"?l.jsx(U$,{input:t}):e==="Edit"?l.jsx(q$,{input:t}):e==="Write"?l.jsx(V$,{input:t}):e==="Read"?l.jsx(G$,{input:t}):e==="Glob"?l.jsx(Y$,{input:t}):e==="Grep"?l.jsx(X$,{input:t}):e==="ExitPlanMode"?l.jsx(Q$,{input:t}):l.jsx(PN,{input:t,description:n})}function U$({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 H$({input:e,onSelect:t,disabled:n}){const i=Array.isArray(e.questions)?e.questions:[],[a,c]=k.useState({}),[u,h]=k.useState({}),[f,m]=k.useState({});function x(N){return $$(i,N)}function v(N,S){const C=String(N);c(E=>({...E,[C]:S})),m(E=>({...E,[C]:!1})),i.length<=1&&t(x({[C]:S}))}function b(N){var E;const S=String(N),C=(E=u[S])==null?void 0:E.trim();C&&(c(R=>({...R,[S]:C})),i.length<=1&&t(x({[S]:C})))}function y(N,S){const C=String(N);h(R=>({...R,[C]:S}));const E=S.trim();c(R=>{if(!E){const L={...R};return delete L[C],L}return{...R,[C]:E}})}function _(N){const S=String(N);m(C=>{const E=!!C[S],R={...C,[S]:!E};return E&&(c(L=>{const O={...L};return delete O[S],O}),h(L=>{const O={...L};return delete O[S],O})),R})}function j(){t(x(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(PN,{input:e})}return l.jsxs("div",{className:"space-y-3",children:[i.map((N,S)=>{const C=typeof N.header=="string"?N.header:"",E=typeof N.question=="string"?N.question:"",R=Array.isArray(N.options)?N.options:[],L=String(S),O=a[L],F=f[L];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}),E&&l.jsx("p",{className:"text-sm text-cc-fg leading-relaxed",children:E}),R.length>0&&l.jsxs("div",{className:"space-y-1.5",children:[R.map((D,Q)=>{const I=typeof D.label=="string"?D.label:String(D),X=typeof D.description=="string"?D.description:"",M=O===I;return l.jsx("button",{onClick:()=>v(S,I),disabled:n,className:`w-full text-left px-3 py-2 rounded-lg border transition-all cursor-pointer disabled:opacity-50 ${M?"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 ${M?"border-cc-primary":"border-cc-muted/40"}`,children:M&&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:I}),X&&l.jsx("p",{className:"text-[11px] text-cc-muted mt-0.5 leading-snug",children:X})]})]})},Q)}),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 ${F?"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 ${F?"border-cc-primary":"border-cc-muted/40"}`,children:F&&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..."})]})}),F&&l.jsxs("div",{className:"pl-6",children:[l.jsx("input",{type:"text",value:u[L]||"",onChange:D=>y(S,D.target.value),onKeyDown:D=>{D.key==="Enter"&&b(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:j,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 q$({input:e}){const t=String(e.file_path||""),n=String(e.old_string||""),i=String(e.new_string||"");return l.jsx(jo,{oldText:n,newText:i,fileName:t,mode:"compact"})}function V$({input:e}){const t=String(e.file_path||""),n=String(e.content||"");return l.jsx(jo,{newText:n,fileName:t,mode:"compact"})}function G$({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 Y$({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 X$({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 Q$({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(sv,{remarkPlugins:[lv],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:c}=i;return/language-(\w+)/.exec(c||"")||typeof a=="string"&&a.includes(`
|
|
105
|
+
`)?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(_N,{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 PN({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 c=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:c})]},i)})})]})}function W$({entry:e,onDismiss:t}){const{request:n,behavior:i,reason:a}=e,c=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] ${c?"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-",c?"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 K$=[],Z$=[],N2="activity-tray-panel";function J$(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 e9(e,t,n=4e3){const[i,a]=k.useState(!1),c=k.useRef(void 0),u=e.length+t.length,h=u>0&&e.every(f=>f.status==="completed")&&t.every(f=>f.status!=="running");return k.useEffect(()=>(clearTimeout(c.current),h?c.current=setTimeout(()=>a(!0),n):a(!1),()=>clearTimeout(c.current)),[h,n]),k.useEffect(()=>{a(!1)},[u]),i}function t9(e){const[t,n]=k.useState(0);return k.useEffect(()=>{if(!e)return;const i=setInterval(()=>n(a=>a+1),1e3);return()=>clearInterval(i)},[e]),t}function n9({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 s9({agent:e,tick:t}){const[n,i]=k.useState(!1),a=e.status!=="running",c=!!e.summary,u=l.jsxs(l.Fragment,{children:[l.jsx(n9,{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:J$(e.startedAt,e.completedAt)})]});return l.jsxs("div",{className:`transition-opacity duration-300 ${a?"opacity-60":""}`,children:[c?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 i9({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 r9({sessionId:e}){const[t,n]=k.useState(!1),i=k.useRef(null),a=k.useRef(null),c=K(E=>E.sessionTasks.get(e)??K$),u=K(E=>E.sessionBackgroundAgents.get(e)??Z$),h=e9(c,u),f=u.some(E=>E.status==="running"),m=t9(f),x=u.filter(E=>E.status==="running").length,v=c.length,b=c.filter(E=>E.status==="completed").length,y=c.filter(E=>E.status==="in_progress").length,_=c.length>0||u.length>0,j=x>0||y>0,N=k.useCallback(()=>n(!1),[]);k.useEffect(()=>{if(!t)return;const E=R=>{R.key==="Escape"&&(R.stopPropagation(),N())};return document.addEventListener("keydown",E),()=>document.removeEventListener("keydown",E)},[t,N]),k.useEffect(()=>{if(!t)return;const E=R=>{i.current&&!i.current.contains(R.target)&&N()};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[t,N]),k.useEffect(()=>{t&&a.current&&a.current.focus()},[t]);const[S,C]=k.useState(!1);return k.useEffect(()=>{_&&C(!1)},[_,c.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:N2,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(E=>l.jsx(s9,{agent:E,tick:m},E.toolUseId))]}),u.length>0&&c.length>0&&l.jsx("div",{className:"border-t border-cc-border/30 mx-2",role:"separator"}),c.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"})}),c.map(E=>l.jsx(i9,{task:E},E.id))]})]}),l.jsxs("button",{type:"button",onClick:()=>n(!t),"aria-expanded":t,"aria-controls":N2,className:`
|
|
106
|
+
flex items-center gap-2 px-3 min-h-[36px] rounded-full
|
|
107
|
+
border border-cc-border/50 bg-cc-surface/90 backdrop-blur-lg
|
|
108
|
+
shadow-md shadow-black/15
|
|
109
|
+
hover:bg-cc-hover/80 hover:border-cc-border/70
|
|
110
|
+
transition-all duration-200 cursor-pointer
|
|
111
|
+
${t?"ring-1 ring-cc-primary/30":""}
|
|
112
|
+
`,"aria-label":`Activity: ${x} agents running, ${b}/${v} tasks`,children:[j?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:x>0?`${x} agent${x!==1?"s":""}`:`${u.length} done`}),u.length>0&&c.length>0&&l.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-cc-muted/30"}),c.length>0&&l.jsxs("span",{className:"text-[11px] text-cc-fg/70 tabular-nums",children:[b,"/",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 a9({sessionId:e}){const t=K(_=>_.pendingPermissions.get(e)),n=K(_=>_.aiResolvedPermissions.get(e)),i=K(_=>_.clearAiResolvedPermissions),a=K(_=>_.connectionStatus.get(e)??"disconnected"),c=K(_=>_.cliConnected.get(e)??!1),u=K(_=>_.cliReconnecting.get(e)??!1),h=K(_=>_.setCliReconnecting),[f,m]=k.useState(null),x=k.useRef(void 0);k.useEffect(()=>{m(null),clearTimeout(x.current)},[e,c]),k.useEffect(()=>()=>clearTimeout(x.current),[]);const v=k.useCallback(async()=>{m(null),clearTimeout(x.current),h(e,!0);try{await ke.relaunchSession(e)}catch(_){da(_),h(e,!1);const j=_ instanceof Error?_.message:"Reconnection failed";m(j),x.current=setTimeout(()=>m(null),4e3)}},[e,h]),b=k.useMemo(()=>t?Array.from(t.values()):[],[t]),y=a==="connected"&&!c;return l.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[y&&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(E$,{sessionId:e}),l.jsx(r9,{sessionId:e})]}),n&&n.length>0&&l.jsx("div",{className:"shrink-0 border-t border-cc-border bg-cc-card",children:l.jsx(W$,{entry:n[n.length-1],onDismiss:()=>i(e)})}),b.length>0&&l.jsx("div",{className:"shrink-0 max-h-[60dvh] overflow-y-auto border-t border-cc-border bg-cc-card",children:b.map(_=>l.jsx(B$,{permission:_,sessionId:e},_.request_id))}),l.jsx(D$,{sessionId:e})]})}function l9({sessionId:e}){const[t,n]=k.useState(!1),i=k.useRef(null),a=K(m=>m.sessions.get(e)),c=(a==null?void 0:a.aiValidationEnabled)??!1,u=(a==null?void 0:a.aiValidationAutoApprove)??!0,h=(a==null?void 0:a.aiValidationAutoDeny)??!1;k.useEffect(()=>{if(!t)return;function m(x){i.current&&!i.current.contains(x.target)&&n(!1)}return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[t]);function f(m,x){const v=!x,b={[m]:v};K.getState().setSessionAiValidation(e,b),gT(e,b)}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 ${c?"text-cc-success hover:bg-cc-hover":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:c?"AI Validation: On":"AI Validation: Off","aria-label":"Toggle AI validation settings","aria-expanded":t,children: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",c),className:"w-full flex items-center justify-between px-2 py-1.5 rounded-md hover:bg-cc-hover text-cc-fg transition-colors cursor-pointer","aria-label":"Toggle AI validation",children:[l.jsx("span",{className:"text-xs",children:"Enabled"}),l.jsx("span",{className:`text-[10px] font-medium ${c?"text-cc-success":"text-cc-muted"}`,children:c?"On":"Off"})]}),c&&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 o9({sessionId:e}){const[t,n]=k.useState(!1),[i,a]=k.useState(null),[c,u]=k.useState(!1),h=k.useRef(null);k.useEffect(()=>{if(!t)return;const m=v=>{h.current&&!h.current.contains(v.target)&&n(!1)},x=v=>{v.key==="Escape"&&n(!1)};return window.addEventListener("pointerdown",m),window.addEventListener("keydown",x),()=>{window.removeEventListener("pointerdown",m),window.removeEventListener("keydown",x)}},[t]);const f=k.useCallback(async m=>{a(m),u(!1);try{const{blob:x,filename:v}=await ke.exportSession(e,m),b=URL.createObjectURL(x),y=document.createElement("a");y.href=b,y.download=v,document.body.appendChild(y),y.click(),y.remove(),URL.revokeObjectURL(b),n(!1)}catch(x){da(x),u(!0)}finally{a(null)}},[e]);return l.jsxs("div",{ref:h,className:"relative",children:[l.jsx("button",{onClick:()=>n(m=>!m),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"})]}),c&&l.jsx("div",{className:"px-3 py-1.5 text-[11px] text-cc-error",children:"Export failed"})]})]})}function c9({sessionId:e}){const t=K(x=>x.density),n=K(x=>x.magicUiAvailable),i=K(x=>{var v;return!!e&&((v=x.sessions.get(e))==null?void 0:v.magicUiActive)===!0}),a=k.useCallback(()=>{var v;if(!e)return;const x=K.getState();((v=x.sessions.get(e))==null?void 0:v.magicUiActive)===!0&&(x.setSessionMagicUi(e,!1),U_(e,!1))},[e]),c=k.useCallback(()=>{K.getState().setDensity("standard"),a()},[a]),u=k.useCallback(()=>{K.getState().setDensity("compact"),a()},[a]),h=k.useCallback(()=>{e&&(K.getState().setSessionMagicUi(e,!0),U_(e,!0))},[e]);if(!n||!e)return l.jsx(u9,{});const f=t==="compact",m=[{key:"standard",label:"Standard view",active:!i&&!f,onClick:c,icon:l.jsx(IN,{})},{key:"compact",label:"Compact view",active:!i&&f,onClick:u,icon:l.jsx(FN,{})},{key:"magic",label:"Magic dashboard view",active:i,onClick:h,icon:l.jsx(d9,{})}];return l.jsx("div",{role:"group","aria-label":"View mode",className:"flex items-center rounded-md border border-cc-border overflow-hidden",children:m.map(x=>l.jsx("button",{onClick:x.onClick,className:`flex items-center justify-center w-8 h-8 transition-colors cursor-pointer ${x.active?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:x.label,"aria-label":x.label,"aria-pressed":x.active,children:x.icon},x.key))})}function u9(){const e=K(a=>a.density),t=k.useCallback(()=>K.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(FN,{}):l.jsx(IN,{})})}function IN(){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 FN(){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 d9(){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 h9(){var F;const e=k.useSyncExternalStore(D=>(window.addEventListener("hashchange",D),()=>window.removeEventListener("hashchange",D)),()=>window.location.hash),t=k.useMemo(()=>Ix(e),[e]),n=t.page==="session"||t.page==="home",i=K(D=>D.currentSessionId),a=K(D=>D.cliConnected),c=K(D=>D.sessionStatus),u=K(D=>D.sessionNames),h=K(D=>D.sdkSessions),f=K(D=>D.sidebarOpen),m=K(D=>D.setSidebarOpen),x=K(D=>D.taskPanelOpen),v=K(D=>D.setTaskPanelOpen),b=K(D=>D.activeTab),y=K(D=>D.setActiveTab),_=K(D=>D.markChatTabReentry),j=K(D=>i?D.gitChangedFilesCount.get(i)??0:0),N=i?c.get(i)??null:null,S=i?a.get(i)??!1:!1,C=i?(u==null?void 0:u.get(i))||((F=h.find(D=>D.sessionId===i))==null?void 0:F.name)||`Session ${i.slice(0,8)}`:null,E=!!(i&&n),R=t.page==="session"&&!!i,L=["chat","diff"],O=D=>{D==="chat"&&b!=="chat"&&i&&_(i),y(D)};return k.useEffect(()=>{const D=Q=>{if(!(Q.metaKey||Q.ctrlKey)||Q.key.toLowerCase()!=="j"||!E)return;const I=Q.target;if(I&&(I.tagName==="TEXTAREA"||I.tagName==="INPUT"||I.isContentEditable))return;Q.preventDefault();const X=Math.max(0,L.indexOf(b)),M=Q.shiftKey?-1:1,de=(X+M+L.length)%L.length;O(L[de])};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[E,L,b,y,_,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:()=>m(!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"})]})}),E&&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 ${b==="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 ${b==="diff"?"text-cc-fg border-cc-primary":"text-cc-muted hover:text-cc-fg border-transparent"}`,"aria-label":"Diffs tab",children:["Diffs",j>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:j})]})]}),l.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[E&&i&&l.jsx(l9,{sessionId:i}),E&&i&&l.jsx(o9,{sessionId:i}),E&&l.jsx(c9,{sessionId:i??null}),l.jsx(f9,{}),R&&l.jsx("button",{onClick:()=>v(!x),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer ${x?"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 f9(){const e=K(n=>n.darkMode),t=k.useCallback(()=>K.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 UN="cc-recent-dirs";function gf(){try{return JSON.parse(localStorage.getItem(UN)||"[]")}catch{return[]}}function HN(e){const t=gf().filter(n=>n!==e);t.unshift(e),localStorage.setItem(UN,JSON.stringify(t.slice(0,5)))}function p9(){return!1}function qN({onClose:e,embedded:t=!1}){const[n,i]=k.useState([]),[a,c]=k.useState(!0),[u,h]=k.useState(null),[f,m]=k.useState(""),[x,v]=k.useState([]),[b,y]=k.useState(""),[_,j]=k.useState(!1),[N,S]=k.useState(""),[C,E]=k.useState([{key:"",value:""}]),[R,L]=k.useState(!1),O=k.useCallback(()=>{ke.listEnvs().then(i).catch(()=>{}).finally(()=>c(!1))},[]);k.useEffect(()=>{O()},[O]);function F(q){h(q.slug),m(q.name);const H=Object.entries(q.variables).map(([U,re])=>({key:U,value:re}));H.length===0&&H.push({key:"",value:""}),v(H),y("")}function D(){h(null),y("")}async function Q(){if(!u)return;const q={};for(const H of x){const U=H.key.trim();U&&(q[U]=H.value)}try{await ke.updateEnv(u,{name:f.trim()||void 0,variables:q}),h(null),y(""),O()}catch(H){y(H instanceof Error?H.message:String(H))}}async function I(q){try{await ke.deleteEnv(q),u===q&&h(null),O()}catch(H){y(H instanceof Error?H.message:String(H))}}async function X(){const q=N.trim();if(!q)return;L(!0);const H={};for(const U of C){const re=U.key.trim();re&&(H[re]=U.value)}try{await ke.createEnv(q,H),S(""),E([{key:"",value:""}]),j(!1),y(""),O()}catch(U){y(U instanceof Error?U.message:String(U))}finally{L(!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:()=>j(!_),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:q=>S(q.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:q=>{q.key==="Enter"&&N.trim()&&X()}}),l.jsx(Sh,{rows:C,onChange:E}),b&&l.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:b}),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:X,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(q=>{const H=u===q.slug,U=Object.keys(q.variables).length;return H?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:re=>m(re.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(Sh,{rows:x,onChange:v})]})}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("button",{onClick:D,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 Q(),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"})]})]},q.slug):l.jsx(m9,{env:q,varCount:U,onStartEdit:()=>F(q),onDelete:()=>void I(q.slug)},q.slug)})}),b&&!_&&l.jsx("div",{className:"mt-4 px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:b})]})});const M=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:q=>S(q.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:q=>{q.key==="Enter"&&N.trim()&&X()}}),l.jsx(Sh,{rows:C,onChange:E}),l.jsx("button",{onClick:X,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(q=>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:q.name}),l.jsxs("span",{className:"text-xs text-cc-muted",children:[Object.keys(q.variables).length," var",Object.keys(q.variables).length!==1?"s":""]}),u===q.slug?l.jsx("button",{onClick:D,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:()=>F(q),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:()=>I(q.slug),className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-error cursor-pointer",children:"Delete"})]})]}),u===q.slug&&l.jsxs("div",{className:"px-3 py-3 space-y-2",children:[l.jsx("input",{type:"text",value:f,onChange:H=>m(H.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(Sh,{rows:x,onChange:v})]})}),l.jsx("button",{onClick:Q,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!==q.slug&&Object.keys(q.variables).length>0&&l.jsx("div",{className:"px-3 py-2.5 space-y-1",children:Object.entries(q.variables).map(([H,U])=>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:H}),l.jsx("span",{className:"text-cc-muted",children:"="}),l.jsx("span",{className:"font-mono-code text-cc-muted break-all whitespace-pre-wrap",children:U})]},H))})]},q.slug))}),W=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:q=>q.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:[b&&l.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:b}),de,M]})]});return To.createPortal(l.jsx("div",{className:"fixed inset-0 z-50 flex items-end sm:items-center justify-center bg-black/50",onClick:e,children:W}),document.body)}function m9({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 Sh({rows:e,onChange:t}){function n(c,u,h){const f=[...e];f[c]={...f[c],[u]:h},t(f)}function i(c){const u=e.filter((h,f)=>f!==c);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((c,u)=>l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx("input",{type:"text",value:c.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:c.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 g9=Object.freeze(Object.defineProperty({__proto__:null,EnvManager:qN},Symbol.toStringTag,{value:"Module"}));function x9(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 v9({initialPath:e,onSelect:t,onClose:n}){const[i,a]=k.useState(""),[c,u]=k.useState([]),[h,f]=k.useState(!0),[m,x]=k.useState(""),[v,b]=k.useState(""),[y,_]=k.useState(!1),[j,N]=k.useState(""),[S,C]=k.useState(-1),[E,R]=k.useState(!1),[L,O]=k.useState(()=>gf()),F=k.useRef(null),D=k.useRef(null),Q=k.useRef(null),I=k.useRef(new Map),X=k.useMemo(()=>{if(!j)return c;const U=j.toLowerCase();return c.filter(re=>re.name.toLowerCase().includes(U))},[c,j]),M=k.useCallback(async U=>{f(!0),x(""),N(""),C(-1);try{const re=await ke.listDirs(U);a(re.path),u(re.dirs)}catch{x("Could not load directory"),u([])}finally{f(!1)}},[]);k.useEffect(()=>{M(e||void 0)},[]),k.useEffect(()=>{const U=F.current;if(!U)return;function re(A){if(A.key!=="Tab")return;const Ee=U.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(Ee.length===0)return;const Me=Ee[0],z=Ee[Ee.length-1];A.shiftKey&&document.activeElement===Me?(A.preventDefault(),z.focus()):!A.shiftKey&&document.activeElement===z&&(A.preventDefault(),Me.focus())}document.addEventListener("keydown",re);const ve=setTimeout(()=>{var A;(A=Q.current)==null||A.focus()},80);return()=>{document.removeEventListener("keydown",re),clearTimeout(ve)}},[]);const de=k.useCallback(()=>{E||(R(!0),setTimeout(n,150))},[n,E]);k.useEffect(()=>{function U(re){if(re.key==="Escape"){if(y)return;de()}}return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[y,de]),k.useEffect(()=>{function U(re){var A,Ee;if(y)return;if(re.key==="Backspace"&&document.activeElement!==Q.current){if(i&&i!=="/"){re.preventDefault();const Me=i.split("/").slice(0,-1).join("/")||"/";M(Me)}return}const ve=X.length;if(ve!==0){if(re.key==="ArrowDown"){re.preventDefault();const Me=S<ve-1?S+1:0;C(Me),(A=I.current.get(Me))==null||A.focus()}else if(re.key==="ArrowUp"){re.preventDefault();const Me=S>0?S-1:ve-1;C(Me),(Ee=I.current.get(Me))==null||Ee.focus()}}}return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[y,X.length,S,i,M]),k.useEffect(()=>{var U;S>=0&&((U=I.current.get(S))==null||U.scrollIntoView({block:"nearest"}))},[S]);function W(U){HN(U),O(gf()),t(U),n()}const q=x9(i),H=i.split("/").pop()||"/";return To.createPortal(l.jsx("div",{className:`fixed inset-0 z-50 flex items-end sm:items-center justify-center transition-opacity duration-150 ${E?"opacity-0":"opacity-100"}`,style:{backgroundColor:"rgba(0,0,0,0.5)",backdropFilter:"blur(4px)"},onClick:de,children:l.jsxs("div",{ref:F,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 ${E?"translate-y-4 sm:translate-y-2 opacity-0":"translate-y-0 opacity-100"}`,style:{animation:"fadeSlideIn 200ms ease-out"},onClick:U=>U.stopPropagation(),children:[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"})})})]}),L.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:L.map(U=>l.jsx("li",{children:l.jsxs("button",{type:"button",onClick:()=>W(U),className:"w-full px-4 py-2 sm:py-1.5 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 text-cc-fg group",children:[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:U.split("/").pop()||U}),l.jsx("span",{className:"text-cc-muted font-mono-code text-[10px] truncate ml-auto",children:U})]})},U))})]}),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:y?l.jsx("input",{type:"text","aria-label":"Type a directory path",value:v,onChange:U=>b(U.target.value),onKeyDown:U=>{U.key==="Enter"&&v.trim()&&W(v.trim()),U.key==="Escape"&&(U.stopPropagation(),_(!1))},placeholder:"/path/to/project",className:"flex-1 px-2 py-1 text-base sm:text-xs bg-cc-input-bg border border-cc-border rounded-md text-cc-fg font-mono-code placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/50",autoFocus:!0}):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:q.map((U,re)=>{const ve=re===q.length-1;return l.jsxs("span",{className:"flex items-center gap-0.5 shrink-0",children:[re>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:()=>{ve||M(U.path)},className:`text-[11px] font-mono-code px-1 py-0.5 rounded transition-colors whitespace-nowrap ${ve?"text-cc-fg font-medium cursor-default":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover cursor-pointer"}`,"aria-current":ve?"location":void 0,tabIndex:ve?-1:0,children:U.label})]},U.path)})}),l.jsx("button",{type:"button","aria-label":"Type path manually",onClick:()=>{_(!0),b(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"})})})]})}),!y&&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:Q,type:"text","aria-label":"Filter directories",value:j,onChange:U=>{N(U.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:()=>W(i),"aria-label":`Select ${H}`,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:H})]})]}),l.jsx("div",{ref:D,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((U,re)=>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+re*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 ${re*.1}s infinite`}})]},re))}):m?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:m}),l.jsx("button",{type:"button",onClick:()=>M(i||void 0),className:"mt-1 text-xs text-cc-primary hover:text-cc-primary-hover transition-colors cursor-pointer font-medium",children:"Retry"})]}):X.length===0?l.jsxs("div",{className:"px-4 py-8 text-center",children:[l.jsx("p",{className:"text-xs text-cc-muted",children:j?"No matching directories":"No subdirectories"}),j&&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:X.map((U,re)=>l.jsxs("li",{className:`flex items-center transition-colors ${S===re?"bg-cc-hover":"hover:bg-cc-hover"}`,children:[l.jsxs("button",{type:"button",ref:ve=>{ve?I.current.set(re,ve):I.current.delete(re)},onClick:()=>M(U.path),onKeyDown:ve=>{ve.key==="Enter"&&(ve.preventDefault(),W(U.path))},className:"flex-1 min-w-0 px-4 py-2 sm:py-1.5 text-xs text-left cursor-pointer font-mono-code flex items-center gap-2 text-cc-fg focus:outline-none",title:U.path,"aria-label":`Navigate into ${U.name}`,children:[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:U.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:()=>W(U.path),className:"shrink-0 w-8 h-8 sm:w-6 sm:h-6 mr-2 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-primary hover:bg-cc-primary/10 transition-colors cursor-pointer","aria-label":`Select ${U.name}`,children: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"})})})]},U.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 b9(e,t){const n=t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,60);return`${e.toLowerCase()}-${n}`}function y9(e){return e.branchName&&e.branchName.trim()?e.branchName.trim():b9(e.identifier,e.title)}function mu({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 _9({defaultProjectId:e,connectionId:t,onCreated:n,onClose:i}){const[a,c]=k.useState(""),[u,h]=k.useState(""),[f,m]=k.useState(""),[x,v]=k.useState(0),[b,y]=k.useState(!0),[_,j]=k.useState([]),[N,S]=k.useState(""),[C,E]=k.useState(""),[R,L]=k.useState(!0),[O,F]=k.useState(!1),[D,Q]=k.useState("");k.useEffect(()=>{let X=!0;return Promise.all([ke.getLinearStates(t),ke.getLinearConnection(t)]).then(([M,de])=>{var q;if(!X)return;j(M.teams),S(de.viewerId);const W=((q=M.teams[0])==null?void 0:q.id)||"";m(W)}).catch(M=>{X&&Q(M instanceof Error?M.message:"Failed to load teams")}).finally(()=>{X&&L(!1)}),()=>{X=!1}},[t]),k.useEffect(()=>{if(!f||_.length===0){E("");return}const X=_.find(de=>de.id===f),M=X==null?void 0:X.states.find(de=>de.type==="backlog");E((M==null?void 0:M.id)||"")},[f,_]);async function I(){if(!(!a.trim()||!f)){F(!0),Q("");try{const X=await ke.createLinearIssue({title:a.trim(),description:u.trim()||void 0,teamId:f,priority:x,projectId:e||void 0,assigneeId:b&&N?N:void 0,stateId:C||void 0,connectionId:t});n(X.issue)}catch(X){Q(X instanceof Error?X.message:"Failed to create issue")}finally{F(!1)}}}return To.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:X=>X.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"})})})]}),D&&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:D}),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:X=>c(X.target.value),onKeyDown:X=>{X.key==="Enter"&&a.trim()&&f&&!O&&I()},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:X=>h(X.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:X=>m(X.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(X=>l.jsxs("option",{value:X.id,children:[X.name," (",X.key,")"]},X.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:x,onChange:X=>v(Number(X.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:b,onChange:X=>y(X.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:I,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 w9({cwd:e,gitRepoInfo:t,linearConfigured:n,selectedLinearIssue:i,onIssueSelect:a,onBranchFromIssue:c,onConnectionSelect:u}){const[h,f]=k.useState([]),[m,x]=k.useState(null),[v,b]=k.useState(!1),[y,_]=k.useState(""),[j,N]=k.useState([]),[S,C]=k.useState(!1),[E,R]=k.useState(!1),[L,O]=k.useState(""),[F,D]=k.useState(!1),[Q,I]=k.useState(null),[X,M]=k.useState([]),[de,W]=k.useState(!1),[q,H]=k.useState(""),[U,re]=k.useState(!1),[ve,A]=k.useState([]),[Ee,Me]=k.useState(!1),[z,P]=k.useState(""),[oe,_e]=k.useState(!1),[Ne,Ae]=k.useState([]),[Le,De]=k.useState(!1),[Ce,Re]=k.useState(!1),It=k.useRef(null);k.useEffect(()=>{function se(je){It.current&&!It.current.contains(je.target)&&(C(!1),re(!1))}return document.addEventListener("pointerdown",se),()=>document.removeEventListener("pointerdown",se)},[]),k.useEffect(()=>{if(!n){f([]),x(null),b(!1),u(null);return}let se=!0;return ke.listLinearConnections().then(({connections:je})=>{se&&(f(je),b(!0),je.length>0?(x(je[0].id),u(je[0].id)):(x(null),u(null)))}).catch(()=>{se&&b(!0)}),()=>{se=!1}},[n]);const Wt=k.useCallback(se=>{x(se),u(se),a(null),N([]),_(""),O(""),Ae([]),P(""),A([]),Q&&(W(!0),H(""),ke.getLinearProjectIssues(Q.projectId,10,se).then(({issues:je})=>{M(je)}).catch(je=>{H(je instanceof Error?je.message:String(je))}).finally(()=>{W(!1)}))},[Q,u,a]);k.useEffect(()=>{if(!t||!n){I(null),M([]);return}let se=!0;return W(!0),H(""),(async()=>{try{const{mapping:je}=await ke.getLinearProjectMapping(t.repoRoot);if(!se)return;if(I(je),je){const{issues:Xe}=await ke.getLinearProjectIssues(je.projectId,10,m??void 0);if(!se)return;M(Xe)}else M([])}catch(je){if(!se)return;H(je instanceof Error?je.message:String(je))}finally{se&&W(!1)}})(),()=>{se=!1}},[t,n,m]),k.useEffect(()=>{if(!n)return;const se=y.trim();if(se.length<2){N([]),O(""),R(!1);return}let je=!0;R(!0),O("");const Xe=setTimeout(()=>{ke.searchLinearIssues(se,8,m??void 0).then(et=>{je&&N(et.issues)}).catch(et=>{je&&(N([]),O(et instanceof Error?et.message:String(et)))}).finally(()=>{je&&R(!1)})},400);return()=>{je=!1,clearTimeout(Xe)}},[n,y,m]),k.useEffect(()=>{if(!n||!oe){Ae([]),De(!1);return}const se=z.trim();if(se.length<2){Ae([]),De(!1);return}let je=!0;De(!0);const Xe=setTimeout(()=>{ke.searchLinearIssues(se,10,m??void 0).then(et=>{je&&Ae(et.issues)}).catch(()=>{je&&Ae([])}).finally(()=>{je&&De(!1)})},400);return()=>{je=!1,clearTimeout(Xe)}},[n,oe,z,m]);function Ft(se,je=!1){a(se),_(`${se.identifier} - ${se.title}`);const Xe=y9(se);c(Xe,!0),je&&C(!1)}function Nt(){a(null),_(""),N([]),O("")}async function wt(se){if(t)try{const{mapping:je}=await ke.upsertLinearProjectMapping({repoRoot:t.repoRoot,projectId:se.id,projectName:se.name});I(je),re(!1),W(!0),H("");const{issues:Xe}=await ke.getLinearProjectIssues(se.id,10,m??void 0);M(Xe)}catch(je){H(je instanceof Error?je.message:String(je))}finally{W(!1)}}async function Qe(){if(t){try{await ke.removeLinearProjectMapping(t.repoRoot)}catch{}I(null),M([]),a(null),_("")}}function St(){if(!n){window.location.hash="#/integrations/linear";return}re(!0),ve.length===0&&(Me(!0),ke.listLinearProjects(m??void 0).then(({projects:se})=>A(se)).catch(()=>{}).finally(()=>Me(!1)))}function nn(se){Re(!1),Ft(se),Q&&(W(!0),ke.getLinearProjectIssues(Q.projectId,10,m??void 0).then(({issues:je})=>M(je)).catch(()=>{}).finally(()=>W(!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:m??"",onChange:se=>Wt(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))}),Q?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(mu,{className:"w-3.5 h-3.5"}),l.jsx("span",{children:Q.projectName}),l.jsx("button",{type:"button",onClick:Qe,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(mu,{className:"w-3.5 h-3.5"}),l.jsx("span",{children:"Linear"})]}),n&&t&&l.jsxs("button",{type:"button",onClick:St,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."})]})]}),Q&&(()=>{const se=z.trim().toLowerCase(),je=!oe&&se?X.filter(et=>et.identifier.toLowerCase().includes(se)||et.title.toLowerCase().includes(se)):oe?[]:X,Xe=oe?Ne:je;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:Nt,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:z,onChange:et=>P(et.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..."}):q?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-error",children:q}):Le?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..."}):Xe.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:Xe.map(et=>l.jsxs("button",{type:"button",onClick:()=>Ft(et),className:`w-full px-2 py-1.5 text-left rounded-md transition-colors cursor-pointer ${(i==null?void 0:i.id)===et.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:et.identifier})," ",et.title]}),l.jsx("div",{className:"text-[10px] text-cc-muted truncate",children:[et.stateName,et.priorityLabel].filter(Boolean).join(" - ")})]},et.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:et=>{_e(et.target.checked),et.target.checked||Ae([])},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"})]})]})})(),U&&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:()=>re(!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"})]})}),Ee?l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Loading projects..."}):ve.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:ve.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:y,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"})]})]}),y.trim().length<2&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Type at least 2 characters…"}),y.trim().length>=2&&E&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Searching Linear..."}),y.trim().length>=2&&!E&&L&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-error",children:L}),y.trim().length>=2&&!E&&!L&&j.length===0&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"No matching issues"}),y.trim().length>=2&&!E&&!L&&l.jsx("div",{className:"max-h-56 overflow-y-auto",children:j.map(se=>l.jsxs("button",{type:"button",onClick:()=>Ft(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"})})})]}),F&&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:()=>{D(!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"})})]}),Ce&&l.jsx(_9,{defaultProjectId:Q==null?void 0:Q.projectId,connectionId:m??void 0,onCreated:nn,onClose:()=>Re(!1)})]}):null}function S9({cwd:e,gitRepoInfo:t,selectedBranch:n,isNewBranch:i,useWorktree:a,onBranchChange:c,onWorktreeChange:u,onBranchesLoaded:h}){const[f,m]=k.useState([]),[x,v]=k.useState(!1),[b,y]=k.useState(""),_=k.useRef(null);return k.useEffect(()=>{function j(N){_.current&&!_.current.contains(N.target)&&v(!1)}return document.addEventListener("pointerdown",j),()=>document.removeEventListener("pointerdown",j)},[]),k.useEffect(()=>{t?ke.listBranches(t.repoRoot).then(j=>{m(j),h(j)}).catch(()=>{m([]),h([])}):(m([]),h([]))},[t]),t?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"relative",ref:_,children:[l.jsxs("button",{"aria-expanded":x,onClick:()=>{!x&&t&&ke.gitFetch(t.repoRoot).catch(()=>{}).finally(()=>{ke.listBranches(t.repoRoot).then(j=>{m(j),h(j)}).catch(()=>{m([]),h([])})}),v(!x),y("")},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"})})]}),x&&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:b,onChange:j=>y(j.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:j=>{j.key==="Escape"&&v(!1)}})}),l.jsx("div",{className:"max-h-[240px] overflow-y-auto py-1",children:(()=>{const j=b.toLowerCase().trim(),N=f.filter(R=>!R.isRemote&&(!j||R.name.toLowerCase().includes(j))),S=f.filter(R=>R.isRemote&&(!j||R.name.toLowerCase().includes(j))),C=f.some(R=>R.name.toLowerCase()===j),E=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:()=>{c(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:()=>{c(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}`))]}),!E&&j&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted text-center",children:"No matching branches"}),j&&!C&&l.jsx("div",{className:"border-t border-cc-border mt-1 pt-1",children:l.jsxs("button",{onClick:()=>{c(b.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:b.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 k9=336*60*60*1e3,Qa=12,j9=24;function hx(e){return e.split("/").filter(Boolean).pop()||e}function C2(e){var t,n;return((t=e.name)==null?void 0:t.trim())||((n=e.slug)==null?void 0:n.trim())||hx(e.cwd)}function N9(e){return e.length>8?e.slice(0,8):e}function C9(e,t=2){const n=e.split("/").filter(Boolean);return n.length<=t?e:`.../${n.slice(-t).join("/")}`}function E9(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 c=Math.floor(a/7);if(c<8)return`${c}w ago`;const u=Math.floor(a/30);return`${Math.max(1,u)}mo ago`}const kh="cc-draft-prompt";function T9(){var qi;const[e,t]=k.useState(()=>localStorage.getItem(kh)||"");k.useEffect(()=>{e?localStorage.setItem(kh,e):localStorage.removeItem(kh)},[e]);const[n]=k.useState(()=>!(localStorage.getItem("cc-user-name")||"").trim()),[i,a]=k.useState(()=>localStorage.getItem("cc-user-name")||""),[c,u]=k.useState(()=>localStorage.getItem("cc-session-prefix")||""),[h,f]=k.useState(""),[m,x]=k.useState(()=>localStorage.getItem("cc-backend")||"claude"),[v,b]=k.useState([]),[y,_]=k.useState(()=>y2(localStorage.getItem("cc-backend")||"claude")),[j,N]=k.useState(()=>_2(localStorage.getItem("cc-backend")||"claude")),[S,C]=k.useState(()=>localStorage.getItem("cc-effort")||""),[E,R]=k.useState(()=>gf()[0]||""),[L,O]=k.useState([]),[F,D]=k.useState(null),[Q,I]=k.useState(!1),[X,M]=k.useState(""),[de,W]=k.useState(null),[q,H]=k.useState(!1),[U,re]=k.useState(null),[ve,A]=k.useState(null),[Ee,Me]=k.useState(()=>localStorage.getItem("cc-onboarding-dismissed")!=="true"),z=de||zN(m),P=b2(m),oe=O$(m),[_e,Ne]=k.useState([]),[Ae,Le]=k.useState(()=>localStorage.getItem("cc-selected-env")||""),[De,Ce]=k.useState(!1),[Re,It]=k.useState(!1),Wt=p9(),[Ft,Nt]=k.useState(()=>Wt),[wt,Qe]=k.useState([]),[St,nn]=k.useState(()=>localStorage.getItem("cc-selected-sandbox")||""),[se,je]=k.useState(!1),Xe=k.useRef(null),[et,un]=k.useState(null),ce=k.useRef(null),be=k.useRef(null),[G,me]=k.useState(!1),[Pe,Ke]=k.useState(!1),[at,ht]=k.useState(!1),[fn,is]=k.useState(!1),[Ct,vs]=k.useState(!1),[In,sn]=k.useState(""),[xr,Bi]=k.useState(!0),[le,xe]=k.useState([]),[we,rt]=k.useState(!1),[Ut,wn]=k.useState(""),[Nn,xt]=k.useState(!1),[rn,en]=k.useState(Qa),[Ro,$u]=k.useState(""),[bs,vr]=k.useState(null),[ma,ga]=k.useState(!1),[Qs,Ws]=k.useState(""),[br,Pi]=k.useState(!1),[Af,Bu]=k.useState([]),[Ii,fi]=k.useState(null),[ol,xa]=k.useState(!1),[Oo,pi]=k.useState(""),[Lo,va]=k.useState(0),ba=k.useRef(null),rs=k.useRef(null),ys=k.useRef(null),dn=k.useRef(null),Cn=k.useRef(null),mi=k.useRef(null),Do=K(Y=>Y.currentSessionId),an=BN({text:e,caretPos:Lo,cwd:E||void 0});k.useEffect(()=>{if(ba.current===null||!rs.current)return;const Y=ba.current;rs.current.setSelectionRange(Y,Y),ba.current=null},[e]),k.useEffect(()=>{var ge;window.matchMedia("(min-width: 640px)").matches&&((ge=rs.current)==null||ge.focus())},[]),k.useEffect(()=>{ke.getHome().then(({home:Y,cwd:ge})=>{E||R(ge||Y)}).catch(()=>{}),ke.listEnvs().then(Ne).catch(()=>{}),ke.listSandboxes().then(Qe).catch(()=>{}),ke.getBackends().then(b).catch(()=>{}),ke.getSettings().then(Y=>{H(Y.linearApiKeyConfigured)}).catch(()=>{})},[]);function Mf(Y){x(Y),localStorage.setItem("cc-backend",Y),W(null),_(y2(Y)),N(_2(Y)),Y!=="claude"&&(vs(!1),xe([]),wn(""),rt(!1),xt(!1),en(Qa),$u(""))}k.useEffect(()=>{if(m!=="codex"){W(null);return}ke.getBackendModels(m).then(Y=>{if(Y.length>0){const ge=M$(Y);W(ge),ge.some(it=>it.value===y)||_(ge[0].value)}}).catch(()=>{})},[m]),k.useEffect(()=>{if(ce.current&&(clearInterval(ce.current),ce.current=null),un(null),!Ft)return;const Y="the-companion:latest",ge=()=>{ke.getImageStatus(Y).then(it=>{un(it),it.status==="idle"&&ke.pullImage(Y).catch(()=>{}),(it.status==="ready"||it.status==="error")&&ce.current&&(clearInterval(ce.current),ce.current=null)}).catch(()=>{})};return ge(),ce.current=setInterval(ge,2e3),()=>{ce.current&&(clearInterval(ce.current),ce.current=null)}},[Ft]),k.useEffect(()=>{function Y(ge){ys.current&&!ys.current.contains(ge.target)&&me(!1),dn.current&&!dn.current.contains(ge.target)&&Ke(!1),Cn.current&&!Cn.current.contains(ge.target)&&ht(!1),mi.current&&!mi.current.contains(ge.target)&&Ce(!1),Xe.current&&!Xe.current.contains(ge.target)&&je(!1)}return document.addEventListener("pointerdown",Y),()=>document.removeEventListener("pointerdown",Y)},[]),k.useEffect(()=>{if(!E){vr(null);return}ke.getRepoInfo(E).then(Y=>{vr(Y),Ws(Y.currentBranch),Pi(!1)}).catch(()=>{vr(null),Ws(""),Pi(!1)})},[E]);const zo=z.find(Y=>Y.value===y)||z[0],ya=P.find(Y=>Y.value===j)||P[0],cl=oe.find(Y=>Y.value===S)||oe[0],ul=m==="codex"?"/logo-codex.svg":"/logo.svg",Fi=E?E.split("/").pop()||E:"Select folder",gi=k.useMemo(()=>In.trim(),[In]),yr=m==="claude"&&Ct&&gi.length>0,as=k.useMemo(()=>{const Y=Date.now()-k9;return le.filter(ge=>ge.createdAt>=Y)},[le]),ln=k.useMemo(()=>Nn?le:as.length>0?as:le,[Nn,as,le]),_s=k.useMemo(()=>Ro.trim().toLowerCase(),[Ro]),Ks=k.useMemo(()=>_s?ln.filter(Y=>{const ge=C2(Y).toLowerCase(),it=hx(Y.cwd).toLowerCase(),mt=(Y.gitBranch||"").toLowerCase(),gt=Y.cwd.toLowerCase(),Ge=Y.resumeSessionId.toLowerCase();return ge.includes(_s)||it.includes(_s)||mt.includes(_s)||gt.includes(_s)||Ge.includes(_s)}):ln,[ln,_s]),dl=k.useMemo(()=>Ks.slice(0,rn),[Ks,rn]),Ui=rn<Ks.length,Hi=Math.max(0,le.length-as.length),Rf=!Nn&&as.length>0,hl=k.useCallback(async()=>{if(m==="claude"){rt(!0),wn("");try{const[Y,ge]=await Promise.all([ke.listSessions(),ke.discoverClaudeSessions(400).then(Ge=>Ge.sessions)]),it=new Map,mt=Ge=>{const Rn=it.get(Ge.resumeSessionId);(!Rn||Ge.createdAt>Rn.createdAt)&&it.set(Ge.resumeSessionId,Ge)};for(const Ge of Y)Ge.backendType!=="codex"&&Ge.cliSessionId&&mt({resumeSessionId:Ge.cliSessionId,sessionId:Ge.sessionId,name:Ge.name,model:Ge.model,createdAt:Ge.createdAt,cwd:Ge.cwd,gitBranch:Ge.gitBranch,source:"companion"});for(const Ge of ge)mt({resumeSessionId:Ge.sessionId,sessionId:Ge.sessionId,slug:Ge.slug,createdAt:Ge.lastActivityAt,cwd:Ge.cwd,gitBranch:Ge.gitBranch,source:"claude_disk"});const gt=Array.from(it.values()).sort((Ge,Rn)=>{const Xn=E&&Ge.cwd===E?0:1,Sr=E&&Rn.cwd===E?0:1;return Xn!==Sr?Xn-Sr:Rn.createdAt-Ge.createdAt});xe(gt),xt(!1),en(Qa)}catch(Y){const ge=Y instanceof Error?Y.message:String(Y);wn(ge||"Failed to load existing sessions"),xe([]),en(Qa)}finally{rt(!1)}}},[m,E]);k.useEffect(()=>{m==="claude"&&Ct&&hl()},[m,Ct,hl]),k.useEffect(()=>{en(Qa)},[_s,Nn]);async function $o(Y){if(Y.length===0)return;const ge=[],it=[];let mt=L.reduce((gt,Ge)=>gt+Ge.size,0);for(const gt of Y){if(gt.size>pf){it.push(`${gt.name} is too large (${oa(gt.size)}, max ${oa(pf)})`);continue}if(mt+gt.size>mf){it.push(`${gt.name} would exceed the per-message limit (${oa(mf)})`);continue}const{base64:Ge,mediaType:Rn}=await wN(gt);ge.push({name:gt.name,base64:Ge,mediaType:Rn,size:gt.size}),mt+=gt.size}ge.length>0&&O(gt=>[...gt,...ge]),D(it.length>0?it.join("; "):null)}async function Of(Y){const ge=Y.target.files;ge&&(await $o(Array.from(ge)),Y.target.value="")}function vt(Y){O(ge=>ge.filter((it,mt)=>mt!==Y))}async function Pu(Y){var mt;const ge=(mt=Y.clipboardData)==null?void 0:mt.items;if(!ge)return;const it=[];for(const gt of Array.from(ge)){if(gt.kind!=="file")continue;const Ge=gt.getAsFile();if(!Ge)continue;const Rn=Ge.name&&Ge.name.length>0?Ge.name:`pasted-${Date.now()}.${(Ge.type.split("/")[1]||"bin").replace(/[^a-zA-Z0-9]/g,"")}`;it.push(new File([Ge],Rn,{type:Ge.type,lastModified:Ge.lastModified}))}it.length>0&&(Y.preventDefault(),await $o(it))}function fl(Y){t(Y.target.value),va(Y.target.selectionStart??Y.target.value.length);const ge=Y.target;ge.style.height="auto",ge.style.height=Math.min(ge.scrollHeight,200)+"px"}function _a(){rs.current&&va(rs.current.selectionStart??0)}function Ds(Y){var it;const ge=an.selectPrompt(Y);ba.current=ge.nextCursor,t(ge.nextText),an.setMentionMenuOpen(!1),va(ge.nextCursor),(it=rs.current)==null||it.focus(),rs.current&&(rs.current.style.height="auto",rs.current.style.height=Math.min(rs.current.scrollHeight,200)+"px")}function Yn(Y){if(an.mentionMenuOpen&&Y.key==="Escape"){Y.preventDefault(),an.setMentionMenuOpen(!1);return}if(an.mentionMenuOpen&&an.filteredPrompts.length>0){if(Y.key==="ArrowDown"){Y.preventDefault(),an.setMentionMenuIndex(ge=>(ge+1)%an.filteredPrompts.length);return}if(Y.key==="ArrowUp"){Y.preventDefault(),an.setMentionMenuIndex(ge=>(ge-1+an.filteredPrompts.length)%an.filteredPrompts.length);return}if(Y.key==="Tab"&&!Y.shiftKey||Y.key==="Enter"&&!Y.shiftKey){Y.preventDefault(),Ds(an.filteredPrompts[an.mentionMenuIndex]);return}}if(an.mentionMenuOpen&&an.filteredPrompts.length===0&&(Y.key==="Enter"&&!Y.shiftKey||Y.key==="Tab"&&!Y.shiftKey)){Y.preventDefault();return}if(Y.key==="Tab"&&Y.shiftKey){Y.preventDefault();const ge=b2(m),mt=(ge.findIndex(gt=>gt.value===j)+1)%ge.length;N(ge[mt].value);return}Y.key==="Enter"&&!Y.shiftKey&&(Y.preventDefault(),Fu())}function Iu(Y){const ge=i.trim(),it=ge?`[${ge}]: ${Y}`:Y;if(!U)return it;const mt=(U.description??"").trim();return`${["Linear issue context:",`- Identifier: ${U.identifier}`,`- Title: ${U.title}`,U.stateName?`- State: ${U.stateName}`:"",U.priorityLabel?`- Priority: ${U.priorityLabel}`:"",U.teamName?`- Team: ${U.teamName}`:"",`- URL: ${U.url}`,mt?`- Description:
|
|
113
|
+
${mt}`:""].filter(Boolean).join(`
|
|
114
|
+
`)}
|
|
115
|
+
|
|
116
|
+
User request:
|
|
117
|
+
${it}`}async function Fu(){const Y=e.trim();if(!(!Y||Q)){if(n&&!i.trim()){M("Please enter your name before starting a session.");return}if(I(!0),M(""),pi(""),bs){const ge=Qs||bs.currentBranch;if(ge&&ge===bs.currentBranch){const it=Af.find(mt=>mt.name===ge&&!mt.isRemote);if(it&&it.behind>0){fi({behind:it.behind,branchName:ge});return}}}await _r(Y)}}async function _r(Y,ge){const it=K.getState();it.clearCreation(),it.setSessionCreating(!0,m);try{Do&&y0(Do);const mt=(ge==null?void 0:ge.resumeSessionAt)||(yr?gi:void 0),gt=mt?(ge==null?void 0:ge.forkSession)??(yr?xr:void 0):void 0,Ge=(ge==null?void 0:ge.cwd)||E,Rn=(ge==null?void 0:ge.branch)!==void 0?ge.branch.trim()||void 0:Qs.trim()||void 0,Xn=(ge==null?void 0:ge.useWorktree)!==void 0?ge.useWorktree:ma,Sr=(ge==null?void 0:ge.createBranch)!==void 0?ge.createBranch:!!(Rn&&br),pl=Y.trim(),ws=pl.length>0?Iu(pl):null,Zs=ws?x0():null,Ho=L.length>0?L.map(ks=>({name:ks.name,media_type:ks.mediaType,data:ks.base64,size:ks.size})):void 0,kr=await WM({initialMessage:ws&&Zs?{content:ws,attachments:Ho,clientMsgId:Zs}:void 0,model:y,permissionMode:j,effort:m==="claude"&&S?S:void 0,cwd:Ge||void 0,envSlug:Ae||void 0,sandboxEnabled:Ft?!0:void 0,sandboxSlug:Ft&&St?St:void 0,branch:Rn,createBranch:Sr?!0:void 0,useWorktree:Xn?!0:void 0,backend:m,codexInternetAccess:m==="codex"?!0:void 0,resumeSessionAt:mt,forkSession:gt,userName:i.trim()||void 0,linearConnectionId:U&&ve||void 0,linearIssue:U?{identifier:U.identifier,title:U.title,stateName:U.stateName,teamName:U.teamName,url:U.url}:void 0},ks=>{K.getState().addCreationProgress(ks)}),Ss=kr.sessionId,jr=K.getState(),Js=jr.sdkSessions.filter(ks=>ks.sessionId!==Ss);jr.setSdkSessions([...Js,{sessionId:Ss,state:kr.state,cwd:kr.cwd,createdAt:Date.now(),backendType:kr.backendType||m,model:y,permissionMode:j,userName:i.trim()||void 0,resumeSessionAt:mt,forkSession:mt?gt===!0:void 0}]);const qo=new Set(K.getState().sessionNames.values()),wa=$2(qo),ei=c.trim()||i.trim(),Sa=h.trim()||wa,Vo=ei?`${ei}_${Sa}`:Sa;K.getState().setSessionName(Ss,Vo),ke.renameSession(Ss,Vo).catch(()=>{}),f(""),Ge&&HN(Ge),K.getState().setPreviousPermissionMode(Ss,j),ws&&(localStorage.removeItem(kh),t("")),Fx(Ss,!0),Co(Ss),ws&&Zs&&K.getState().appendMessage(Ss,{id:Zs,role:"user",content:ws,attachments:Ho,timestamp:Date.now()}),U&&(ke.linkLinearIssue(Ss,U,ve||void 0).then(()=>K.getState().setLinkedLinearIssue(Ss,U)).catch(()=>{}),ke.transitionLinearIssue(U.id,ve||void 0).catch(()=>{})),K.getState().clearCreation()}catch(mt){const gt=mt instanceof Error?mt.message:String(mt);M(gt);const Ge=Y.trim();K.getState().setCreationError(gt,Ge?{text:Ge}:null),I(!1)}}async function Bo(Y,ge){Q||(I(!0),M(""),pi(""),R(Y.cwd),ga(!1),Pi(!1),Ws(Y.gitBranch||""),sn(Y.resumeSessionId),Bi(ge),await _r("",{resumeSessionAt:Y.resumeSessionId,forkSession:ge,cwd:Y.cwd,branch:Y.gitBranch,useWorktree:!1,createBranch:!1}))}async function Lf(){if(Ii){xa(!0),pi("");try{const Y=E||(bs==null?void 0:bs.repoRoot);if(!Y)throw new Error("No working directory");const ge=await ke.gitPull(Y);if(!ge.success){pi(ge.output||"Pull failed"),xa(!1),I(!1);return}fi(null),xa(!1),await _r(e.trim())}catch(Y){pi(Y instanceof Error?Y.message:String(Y)),xa(!1)}}}function ls(){const Y=e.trim();fi(null),pi(""),_r(Y)}function Po(){fi(null),pi(""),I(!1)}const Uu=k.useCallback((Y,ge)=>{Ws(Y),Pi(ge)},[]),Io=k.useCallback((Y,ge)=>{Ws(Y),Pi(ge)},[]),wr=k.useCallback(Y=>{Bu(Y)},[]),Fo=k.useCallback(Y=>{re(Y),!Y&&bs&&(Ws(bs.currentBranch),Pi(!1))},[bs]),Uo=e.trim().length>0&&!Q&&(!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:ul,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:Y=>{const ge=Y.target.value;a(ge),localStorage.setItem("cc-user-name",ge)},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:c,onChange:Y=>{const ge=Y.target.value;u(ge),localStorage.setItem("cc-session-prefix",ge)},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:Y=>f(Y.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:[c.trim()||i.trim()||"MA","_",h.trim()||"InvoicePdf"]}),"."]})]}),l.jsx("input",{ref:be,type:"file",multiple:!0,onChange:Of,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($N,{open:an.mentionMenuOpen,loading:an.promptsLoading,prompts:an.filteredPrompts,selectedIndex:an.mentionMenuIndex,onSelect:Ds,menuRef:an.mentionMenuRef,className:"absolute left-2 right-2 bottom-full mb-1"}),(U||L.length>0)&&l.jsxs("div",{className:"flex items-center gap-2 px-4 pt-3 flex-wrap",children:[U&&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:U.identifier}),l.jsx("span",{className:"truncate",children:U.title}),l.jsx("button",{type:"button",onClick:()=>Fo(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:"×"})]}),L.map((Y,ge)=>l.jsx(jN,{name:Y.name,mediaType:Y.mediaType,base64:Y.base64,size:Y.size,onRemove:()=>vt(ge),className:"w-10 h-10"},ge))]}),F&&l.jsx("div",{className:"px-4 pt-2 text-[11px] text-cc-error",children:F}),l.jsx("textarea",{ref:rs,value:e,onChange:fl,onKeyDown:Yn,onClick:_a,onKeyUp:_a,onPaste:Pu,"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:ys,children:[l.jsxs("button",{onClick:()=>me(!G),"aria-expanded":G,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:zo.icon}),l.jsx("span",{children:zo.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"})})]}),G&&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:z.map(Y=>l.jsxs("button",{onClick:()=>{_(Y.value),me(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 ${Y.value===y?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{children:Y.icon}),Y.label]},Y.value))})]}),oe.length>0&&l.jsxs("div",{className:"relative",ref:Cn,children:[l.jsxs("button",{onClick:()=>ht(!at),"aria-expanded":at,"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:cl.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"})})]}),at&&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(Y=>l.jsx("button",{onClick:()=>{C(Y.value),localStorage.setItem("cc-effort",Y.value),ht(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${Y.value===S?"text-cc-primary font-medium":"text-cc-fg"}`,children:Y.label},Y.value||"default"))})]}),l.jsxs("div",{className:"relative",ref:dn,children:[l.jsxs("button",{onClick:()=>Ke(!Pe),"aria-expanded":Pe,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"})}),ya.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"})})]}),Pe&&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:P.map(Y=>l.jsx("button",{onClick:()=>{N(Y.value),Ke(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${Y.value===j?"text-cc-primary font-medium":"text-cc-fg"}`,children:Y.label},Y.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:()=>is(!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:Fi})]}),fn&&l.jsx(v9,{initialPath:E||"",onSelect:Y=>{R(Y)},onClose:()=>is(!1)})]}),l.jsx(S9,{cwd:E,gitRepoInfo:bs,selectedBranch:Qs,isNewBranch:br,useWorktree:ma,onBranchChange:Uu,onWorktreeChange:ga,onBranchesLoaded:wr}),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:mi,children:[l.jsxs("button",{onClick:()=>{De||ke.listEnvs().then(Ne).catch(()=>{}),Ce(!De)},"aria-expanded":De,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:Ae?((qi=_e.find(Y=>Y.slug===Ae))==null?void 0:qi.name)||"Env":"No env"})]}),De&&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:()=>{Le(""),localStorage.setItem("cc-selected-env",""),Ce(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${Ae?"text-cc-fg":"text-cc-primary font-medium"}`,children:"No environment"}),_e.map(Y=>l.jsxs("button",{onClick:()=>{Le(Y.slug),localStorage.setItem("cc-selected-env",Y.slug),Ce(!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 ${Y.slug===Ae?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{className:"truncate",children:Y.name}),l.jsxs("span",{className:"text-cc-muted ml-auto shrink-0",children:[Object.keys(Y.variables).length," var",Object.keys(Y.variables).length!==1?"s":""]})]},Y.slug)),l.jsx("div",{className:"border-t border-cc-border mt-1 pt-1",children:l.jsx("button",{onClick:()=>{It(!0),Ce(!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..."})})]})]}),Wt,l.jsx("div",{className:"flex-1"}),l.jsx("button",{onClick:()=>{var Y;return(Y=be.current)==null?void 0:Y.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:Fu,disabled:!Uo,className:`flex items-center justify-center w-8 h-8 sm:w-9 sm:h-9 rounded-full transition-colors ${Uo?"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(Y=>l.jsxs("button",{onClick:()=>Y.available&&Mf(Y.id),disabled:!Y.available,title:Y.available?Y.name:`${Y.name} CLI not found in PATH`,className:`flex items-center gap-1 px-3 py-1.5 text-xs rounded-md transition-colors ${Y.available?m===Y.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:[Y.name,!Y.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"})]})]},Y.id))})}),m==="claude"&&l.jsxs("div",{children:[l.jsxs("button",{type:"button",onClick:()=>vs(Y=>!Y),className:`mx-auto flex items-center gap-1.5 px-2 py-1 text-[11px] sm:text-xs rounded-md transition-colors cursor-pointer ${Ct?"text-cc-primary":"text-cc-muted hover:text-cc-fg"}`,"aria-expanded":Ct,"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 ${Ct?"rotate-180":""}`,children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]}),l.jsx("div",{className:"accordion-panel","data-open":Ct?"true":"false",children:l.jsx("div",{className:"accordion-inner",inert:!Ct||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 hl(),disabled:we,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:we?"Refreshing...":"Refresh detected sessions"}),le.length>0&&l.jsxs("span",{className:"text-[11px] text-cc-muted",children:["Showing ",dl.length," of ",Ks.length," ",_s?"matching":Rf?"recent":"detected"," Claude session",Ks.length!==1?"s":"","."]}),!Nn&&Hi>0&&as.length>0&&l.jsxs("button",{type:"button",onClick:()=>{xt(!0),en(Qa)},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 (",Hi,")"]}),Nn&&as.length>0&&l.jsx("button",{type:"button",onClick:()=>{xt(!1),en(Qa)},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:Ro,onChange:Y=>$u(Y.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."]}),Ut&&l.jsx("p",{className:"text-[11px] text-cc-error",children:Ut}),!we&&!Ut&&Ks.length===0&&l.jsx("p",{className:"text-[11px] text-cc-muted",children:_s?"No sessions match this search.":"No Claude sessions detected yet."}),dl.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:dl.map(Y=>{const ge=C2(Y),it=hx(Y.cwd),mt=Y.source==="companion"?"Companion":"Claude",gt=gi===Y.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 ${gt?"text-cc-primary font-medium":"text-cc-fg"}`,children:ge}),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:N9(Y.resumeSessionId)}),l.jsx("span",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted",children:mt})]})]}),l.jsxs("div",{className:"min-w-0 text-[11px] text-cc-muted sm:font-mono-code truncate",title:Y.cwd,children:[l.jsx("div",{className:"truncate",children:it}),l.jsx("div",{className:"mt-0.5 text-[10px] text-cc-muted/70 truncate",title:Y.cwd,children:C9(Y.cwd)})]}),l.jsx("div",{className:"text-[11px] text-cc-muted sm:font-mono-code truncate",children:Y.gitBranch||"—"}),l.jsx("div",{className:"text-[11px] text-cc-muted",children:E9(Y.createdAt)}),l.jsxs("div",{className:"sm:text-right flex gap-1.5 sm:justify-end",children:[l.jsx("button",{type:"button",onClick:()=>{sn(Y.resumeSessionId),Bi(!0),Bo(Y,!0)},"aria-label":`Fork and open ${ge}`,className:`px-2 py-1 rounded-md text-[11px] border transition-colors cursor-pointer ${gt&&xr?"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
|
|
118
|
+
${Y.cwd}${Y.gitBranch?` (${Y.gitBranch})`:""}
|
|
119
|
+
${Y.resumeSessionId}`,children:"Fork"}),l.jsx("button",{type:"button",onClick:()=>{sn(Y.resumeSessionId),Bi(!1),Bo(Y,!1)},"aria-label":`Continue and open ${ge}`,className:`px-2 py-1 rounded-md text-[11px] border transition-colors cursor-pointer ${gt&&!xr?"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
|
|
120
|
+
${Y.resumeSessionId}`,children:"Continue"})]})]},`${Y.resumeSessionId}-row-${Y.sessionId}`)})}),Ui&&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:()=>en(Y=>Math.min(Y+j9,Ks.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 (",Ks.length-rn," 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."})]})})})]}),Ee&&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.",m==="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:()=>{Me(!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(w9,{cwd:E,gitRepoInfo:bs,linearConfigured:q,selectedLinearIssue:U,onIssueSelect:Fo,onBranchFromIssue:Io,onConnectionSelect:A})]}),Ii&&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:Ii.branchName})," is"," ",l.jsxs("span",{className:"font-semibold text-amber-500",children:[Ii.behind," commit",Ii.behind!==1?"s":""," behind"]})," ","remote. Pull before starting?"]}),Oo&&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:Oo}),l.jsxs("div",{className:"flex flex-wrap gap-2 mt-2.5",children:[l.jsx("button",{onClick:Po,disabled:ol,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:ls,disabled:ol,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:Lf,disabled:ol,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:ol?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"})]})]})]})}),X&&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:X})]})]}),Re&&l.jsx(qN,{onClose:()=>{It(!1),ke.listEnvs().then(Ne).catch(()=>{})}})]})}const A9=[],M9=[],R9={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"}},O9={label:"Unknown",badge:"text-cc-muted bg-cc-hover",dot:"bg-cc-muted opacity-40"};function L9({server:e,sessionId:t}){var h,f;const[n,i]=k.useState(!1),a=R9[e.status]||O9,c=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:()=>fT(t,e.name,!c),className:`w-6 h-6 flex items-center justify-center rounded-md transition-colors cursor-pointer ${c?"text-cc-muted hover:text-cc-fg hover:bg-cc-hover":"text-cc-muted/50 hover:text-cc-success hover:bg-cc-success/10"}`,title:c?"Disable server":"Enable server",children:c?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:()=>pT(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(m=>l.jsx("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded bg-cc-hover text-cc-fg",title:m.annotations&&Object.entries(m.annotations).filter(([,x])=>x).map(([x])=>x).join(", ")||void 0,children:m.name},m.name))})]})]})]})}function D9({sessionId:e,onDone:t}){const[n,i]=k.useState(""),[a,c]=k.useState("stdio"),[u,h]=k.useState(""),[f,m]=k.useState(""),[x,v]=k.useState(""),b=n.trim()&&(a==="stdio"?u.trim():x.trim());function y(_){if(_.preventDefault(),!b)return;const j={type:a};a==="stdio"?(j.command=u.trim(),f.trim()&&(j.args=f.trim().split(/\s+/))):j.url=x.trim(),mT(e,{[n.trim()]:j}),t()}return l.jsxs("form",{onSubmit:y,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:()=>c(_),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:_=>m(_.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:x,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:!b,className:`flex-1 text-[11px] font-medium py-1.5 rounded-md transition-colors ${b?"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 z9({sessionId:e}){const t=K(h=>h.mcpServers.get(e)||A9),n=K(h=>h.cliConnected.get(e)??!1),[i,a]=k.useState(!1),c=K(h=>{var f;return((f=h.sessions.get(e))==null?void 0:f.mcp_servers)??M9});k.useEffect(()=>{n&&F_(e)},[e,n]);const u=t.length>0?t:c.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:()=>F_(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(D9,{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(L9,{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 $9({cwd:e,open:t,onClose:n}){var X;const[i,a]=k.useState([]),[c,u]=k.useState(!0),[h,f]=k.useState(0),[m,x]=k.useState(""),[v,b]=k.useState(!1),[y,_]=k.useState(!1),[j,N]=k.useState(null),[S,C]=k.useState(null),E=k.useCallback(()=>{u(!0),N(null),ke.getClaudeMdFiles(e).then(M=>{a(M.files),M.files.length>0&&(f(0),x(M.files[0].content)),C(null),b(!1),u(!1)}).catch(M=>{N(M.message),u(!1)})},[e]);k.useEffect(()=>{t&&E()},[t,E]);const R=M=>{v&&!confirm("Discard unsaved changes?")||(f(M),x(i[M].content),b(!1),C(null))},L=async()=>{var de;const M=S||((de=i[h])==null?void 0:de.path);if(M){_(!0),N(null);try{await ke.saveClaudeMd(M,m),b(!1),S?E():a(W=>W.map((q,H)=>H===h?{...q,content:m}:q))}catch(W){N(W instanceof Error?W.message:"Failed to save")}finally{_(!1)}}},O=M=>{const de=M==="root"?`${e}/CLAUDE.md`:`${e}/.claude/CLAUDE.md`;C(de),x(`# CLAUDE.md
|
|
121
|
+
|
|
122
|
+
`),b(!0)},F=()=>{v&&!confirm("Discard unsaved changes?")||n()};if(!t)return null;const D=M=>M.startsWith(e+"/")?M.slice(e.length+1):M,Q=i.some(M=>M.path===`${e}/CLAUDE.md`),I=i.some(M=>M.path===`${e}/.claude/CLAUDE.md`);return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fixed inset-0 bg-black/40 z-50",onClick:F}),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:F,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:c?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((M,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:D(M.path)})]},M.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:D(S)})]})]}),(!Q||!I)&&!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"}),!Q&&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"})]}),!I&&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:D(S||(((X=i[h])==null?void 0:X.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:L,disabled:!v||y,className:`px-3 py-1 text-[11px] font-medium rounded-md transition-colors cursor-pointer ${v&&!y?"bg-cc-primary text-white hover:bg-cc-primary/90":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:y?"Saving...":"Save"})]})]}),l.jsx("textarea",{value:m,onChange:M=>{x(M.target.value),b(!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..."})]}),j&&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:j})]})]})})]})]})}function E2({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 rr({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 B9({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 P9({path:e,label:t,onClose:n}){const[i,a]=k.useState(""),[c,u]=k.useState(!0),[h,f]=k.useState(!1),[m,x]=k.useState(!1),[v,b]=k.useState(null);k.useEffect(()=>{ke.readFile(e).then(j=>{a(j.content),u(!1)}).catch(j=>{b(j instanceof Error?j.message:"Failed to read file"),u(!1)})},[e]);const y=async()=>{x(!0),b(null);try{await ke.writeFile(e,i),f(!1)}catch(j){b(j instanceof Error?j.message:"Failed to save")}finally{x(!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"})})})]}),c?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:y,disabled:!h||m,className:`px-3 py-1 text-[11px] font-medium rounded-md transition-colors cursor-pointer ${h&&!m?"bg-cc-primary text-white hover:bg-cc-primary/90":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:m?"Saving...":"Save"})]})]}),l.jsx("textarea",{value:i,onChange:j=>{a(j.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 I9({item:e,cwd:t,onClose:n}){if(e.kind==="json"){const[i,a]=k.useState(null),[c,u]=k.useState(!0);return k.useEffect(()=>{ke.readFile(e.path).then(h=>{a(h.content),u(!1)}).catch(()=>{a("Failed to read file"),u(!1)})},[e.path]),c?null:l.jsx(B9,{path:e.path,content:i||"",onClose:n})}return e.kind==="claude-md"?l.jsx($9,{cwd:e.editorCwd||t,open:!0,onClose:n}):l.jsx(P9,{path:e.path,label:e.label,onClose:n})}function F9({sessionId:e}){const t=K(S=>S.sessions.get(e)),n=K(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,c]=k.useState(null),[u,h]=k.useState(!0),[f,m]=k.useState(!1),[x,v]=k.useState(!1),[b,y]=k.useState(null),_=k.useCallback(async()=>{if(i)try{const S=await ke.getClaudeConfig(i);c(S)}catch{}finally{h(!1)}},[i]);if(k.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 j=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(E2,{icon:"project",title:`Project (${j})`,expanded:f,onToggle:()=>m(S=>!S)}),f&&l.jsxs("div",{className:"pb-1",children:[a.project.claudeMd.map(S=>l.jsx(rr,{label:S.path.includes(".claude/")?".claude/CLAUDE.md":"CLAUDE.md",onClick:()=>y({label:"CLAUDE.md",path:S.path,kind:"claude-md"})},S.path)),a.project.settings&&l.jsx(rr,{label:"settings.json",onClick:()=>y({label:"settings.json",path:a.project.settings.path,kind:"json"})}),a.project.settingsLocal&&l.jsx(rr,{label:"settings.local.json",onClick:()=>y({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(rr,{label:`/${S.name}`,onClick:()=>y({label:S.name,path:S.path,kind:"md"})},S.path))]}),j===0&&l.jsx("p",{className:"px-4 pl-10 py-1.5 text-[11px] text-cc-muted",children:"No .claude config found"})]}),l.jsx(E2,{icon:"user",title:`User (${N})`,expanded:x,onToggle:()=>v(S=>!S)}),x&&l.jsxs("div",{className:"pb-1",children:[a.user.claudeMd&&l.jsx(rr,{label:"CLAUDE.md",onClick:()=>y({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(rr,{label:S.name,sublabel:S.description?S.description.slice(0,40):void 0,onClick:()=>y({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(rr,{label:S.name,onClick:()=>y({label:S.name,path:S.path,kind:"md"})},S.path))]}),a.user.settings&&l.jsx(rr,{label:"settings.json",onClick:()=>y({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(rr,{label:`/${S.name}`,onClick:()=>y({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"})]}),b&&To.createPortal(l.jsx(I9,{item:b,cwd:i,onClose:()=>y(null)}),document.body)]})}function U9(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 H9 extends k.Component{constructor(){super(...arguments);l_(this,"state",{hasError:!1})}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(n){da(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 VN=[],hv=3e4,q9=6e4,V9=5*6e4;let T2=null,A2=new Map;function G9(e){return e!==T2&&(T2=e,A2=new Map(e.map(t=>[t.sessionId,t]))),A2}function zu(e){return K(k.useCallback(t=>G9(t.sdkSessions).get(e),[e]))}const GN="cc-panel-collapsed";function M2(){try{const e=localStorage.getItem(GN);if(e)return new Set(JSON.parse(e))}catch{}return new Set}function Y9(e){try{localStorage.setItem(GN,JSON.stringify([...e]))}catch{}}function YN({id:e,label:t,badge:n,defaultOpen:i=!0,children:a}){const[c,u]=k.useState(()=>M2().has(e)?!0:!i),h=k.useRef(!0);k.useEffect(()=>{if(h.current){h.current=!1;return}const m=M2();c?m.add(e):m.delete(e),Y9(m)},[c,e]);const f=k.useCallback(()=>{u(m=>!m)},[]);return l.jsxs("div",{className:"border-t border-cc-separator first:border-t-0",children:[l.jsxs("button",{onClick:f,"aria-expanded":!c,className:"w-full flex items-center gap-1.5 px-4 py-2 text-left hover:bg-cc-hover/50 transition-colors cursor-pointer",children:[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 ${c?"":"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":c?"false":"true",children:l.jsx("div",{className:"accordion-inner",children:a})})]})}function X9(){const[e,t]=k.useState(()=>localStorage.getItem("cc-user-name")||""),[n,i]=k.useState(()=>localStorage.getItem("cc-session-prefix")||"");return l.jsx(YN,{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 c=a.target.value;t(c),localStorage.setItem("cc-user-name",c)},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 c=a.target.value;i(c),localStorage.setItem("cc-session-prefix",c)},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 XN(e){return e>80?"bg-cc-error":e>50?"bg-cc-warning":"bg-cc-primary"}function QN(e){return e>80?"critical":e>50?"elevated":"normal"}function mr({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 — ${QN(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 ${XN(t)}`,style:{width:`${Math.min(t,100)}%`}})})]})}function Q9({sessionId:e}){var f;const[t,n]=k.useState(null),i=k.useCallback(async()=>{try{const m=await ke.getSessionUsageLimits(e);n(m)}catch{}},[e]),a=k.useRef(0);if(k.useEffect(()=>{i();const m=setInterval(()=>{a.current+=1,a.current%2===0?i():n(x=>x?{...x}:null)},hv);return()=>clearInterval(m)},[i]),!t)return null;const c=t.five_hour!==null,u=t.seven_day!==null,h=!c&&!u&&((f=t.extra_usage)==null?void 0:f.is_enabled);return!c&&!u&&!h?null:l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2",children:[t.five_hour&&l.jsx(mr,{label:"5h Limit",pct:t.five_hour.utilization,detail:t.five_hour.resets_at?f2(t.five_hour.resets_at):void 0}),t.seven_day&&l.jsx(mr,{label:"7d Limit",pct:t.seven_day.utilization,detail:t.seven_day.resets_at?f2(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 — ${QN(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 ${XN(t.extra_usage.utilization)}`,style:{width:`${Math.min(t.extra_usage.utilization,100)}%`}})})]})]})}function jh(e){const t=e/1073741824;return t>=1?`${t.toFixed(1)} GB`:`${Math.round(e/1024**2)} MB`}function W9(e){const[t,n]=k.useState(null);return k.useEffect(()=>{let i=!1;const a=async()=>{try{const u=await ke.getSystemMemory();i||n(u)}catch{}};a();const c=setInterval(a,q9);return()=>{i=!0,clearInterval(c)}},[]),t?l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2",children:[l.jsx(mr,{label:"Memory",pct:t.used_percent,detail:`${jh(t.used_bytes)} / ${jh(t.total_bytes)}`}),t.swap_total_bytes>0&&l.jsx(mr,{label:"Swap",pct:t.swap_used_percent,detail:`${jh(t.swap_used_bytes)} / ${jh(t.swap_total_bytes)}`})]}):null}function K9(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 Z9(e){const[t,n]=k.useState(null);return k.useEffect(()=>{let i=!1;const a=async()=>{try{const u=await ke.getSystemDisk();i||n(u)}catch{}};a();const c=setInterval(a,V9);return()=>{i=!0,clearInterval(c)}},[]),t?l.jsx("div",{className:"shrink-0 px-4 py-2.5",children:l.jsx(mr,{label:"Disk",pct:t.used_percent,detail:`${K9(t.available_bytes)} free`})}):null}function J9({sessionId:e}){const t=K(c=>{var u;return(u=c.sessions.get(e))==null?void 0:u.codex_rate_limits}),[,n]=k.useState(0);if(k.useEffect(()=>{if(!t)return;const c=setInterval(()=>n(u=>u+1),hv);return()=>clearInterval(c)},[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(mr,{label:`${p2(i.windowDurationMins)} Limit`,pct:i.usedPercent,detail:i.resetsAt>0?ux(i.resetsAt):void 0}),a&&l.jsx(mr,{label:`${p2(a.windowDurationMins)} Limit`,pct:a.usedPercent,detail:a.resetsAt>0?ux(a.resetsAt):void 0})]})}function eB({sessionId:e}){const t=K(i=>{var a;return(a=i.sessions.get(e))==null?void 0:a.codex_token_details}),n=K(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:Zc(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:Zc(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:Zc(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:Zc(t.reasoningOutputTokens)})]})]}),t.modelContextWindow>0&&l.jsx(mr,{label:"Context",pct:n})]}):null}function tB(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 nB({pr:e}){const t=tB(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 sB({sessionId:e}){const t=K(u=>u.sessions.get(e)),n=zu(e),i=K(u=>u.prStatus.get(e)),a=(t==null?void 0:t.cwd)||(n==null?void 0:n.cwd),c=(t==null?void 0:t.git_branch)||(n==null?void 0:n.gitBranch);return k.useEffect(()=>{i||!a||!c||ke.getPRStatus(a,c).then(u=>{K.getState().setPRStatus(e,u)}).catch(()=>{})},[e,a,c,i]),!(i!=null&&i.available)||!i.pr?null:l.jsx(nB,{pr:i.pr})}const iB=6e4;function u0(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 rB({sessionId:e}){const t=K(M=>M.linkedLinearIssues.get(e)),[n,i]=k.useState([]),[a,c]=k.useState(null),[u,h]=k.useState([]),[f,m]=k.useState(""),[x,v]=k.useState(!1),[b,y]=k.useState(!1),[_,j]=k.useState(!1),[N,S]=k.useState(""),[C,E]=k.useState([]),[R,L]=k.useState(!1),O=k.useRef(null);k.useEffect(()=>{ke.getLinkedLinearIssue(e).then(M=>{M.issue&&K.getState().setLinkedLinearIssue(e,M.issue)}).catch(()=>{})},[e]);const F=k.useCallback(async()=>{if(t)try{const M=await ke.getLinkedLinearIssue(e,!0);M.issue&&(K.getState().setLinkedLinearIssue(e,M.issue),M.issue.stateType==="completed"&&y(!0)),M.comments&&i(M.comments),M.assignee!==void 0&&c(M.assignee??null),M.labels&&h(M.labels)}catch{}},[e,t]);k.useEffect(()=>{if(!t)return;F();const M=setInterval(F,iB);return()=>clearInterval(M)},[F,t]),k.useEffect(()=>{if(!_)return;const M=N.trim();if(M.length<2){E([]);return}let de=!0;L(!0);const W=setTimeout(()=>{ke.searchLinearIssues(M,6).then(q=>{de&&E(q.issues)}).catch(()=>{de&&E([])}).finally(()=>{de&&L(!1)})},400);return()=>{de=!1,clearTimeout(W)}},[N,_]),k.useEffect(()=>{_&&setTimeout(()=>{var M;return(M=O.current)==null?void 0:M.focus()},50)},[_]);async function D(){if(!(!t||!f.trim()||x)){v(!0);try{const M=await ke.addLinearComment(t.id,f.trim());i(de=>[...de,M.comment]),m("")}catch{}finally{v(!1)}}}async function Q(){try{await ke.unlinkLinearIssue(e),K.getState().setLinkedLinearIssue(e,null),i([]),c(null),h([]),y(!1)}catch{}}async function I(M){try{await ke.linkLinearIssue(e,M),K.getState().setLinkedLinearIssue(e,M),j(!1),S(""),E([])}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(mu,{className:"w-3.5 h-3.5 text-cc-muted shrink-0"}),l.jsx("input",{ref:O,type:"text",value:N,onChange:M=>S(M.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:()=>{j(!1),S(""),E([])},"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(M=>l.jsxs("button",{onClick:()=>I(M),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:M.identifier}),l.jsx("span",{className:`text-[9px] font-medium px-1 rounded-full leading-[14px] ${u0(M.stateType,M.stateName).cls}`,children:u0(M.stateType,M.stateName).label})]}),l.jsx("p",{className:"text-[11px] text-cc-muted truncate mt-0.5",children:M.title})]},M.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:()=>j(!0),className:"flex items-center gap-1.5 text-[11px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:[l.jsx(mu,{className:"w-3.5 h-3.5"}),"Link Linear issue"]})});const X=u0(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(mu,{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] ${X.cls}`,children:X.label}),l.jsx("button",{onClick:Q,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(M=>l.jsx("span",{className:"text-[9px] px-1.5 py-0.5 rounded-full",style:{backgroundColor:`${M.color}20`,color:M.color},children:M.name},M.id))})]}),b&&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:()=>y(!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 ke.archiveSession(e),K.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(M=>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:M.userName}),l.jsx("span",{className:"text-[9px] text-cc-muted",children:U9(new Date(M.createdAt).getTime())})]}),l.jsx("p",{className:"text-cc-muted line-clamp-2",children:M.body})]},M.id))]}),l.jsxs("div",{className:"px-4 py-2 flex items-center gap-1.5",children:[l.jsx("input",{type:"text",value:f,onChange:M=>m(M.target.value),onKeyDown:M=>{M.key==="Enter"&&!M.shiftKey&&(M.preventDefault(),D())},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:D,disabled:!f.trim()||x,"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=K(u=>u.rateLimit.get(e)),[,n]=k.useState(0);if(k.useEffect(()=>{if(!t)return;const u=setInterval(()=>n(h=>h+1),hv);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,c=typeof t.resetsAt=="number"&&t.resetsAt>0?ux(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(mr,{label:t.rateLimitType==="five_hour"?"5h Limit":"Plan Limit",pct:a,detail:c}):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,c&&` · resets ${c}`]})]}),i&&l.jsxs("p",{className:"text-[11px] text-cc-error",children:["The API is refusing requests for this plan window",c?` — resets in ${c}.`:"."]})]})}function lB({sessionId:e}){const t=K(a=>a.sessions.get(e)),n=zu(e);return((t==null?void 0:t.backend_type)||(n==null?void 0:n.backendType))==="codex"?l.jsxs(l.Fragment,{children:[l.jsx(J9,{sessionId:e}),l.jsx(eB,{sessionId:e})]}):l.jsxs(l.Fragment,{children:[l.jsx(aB,{sessionId:e}),l.jsx(Q9,{sessionId:e})]})}function oB({sessionId:e}){const t=K(m=>m.sessions.get(e)),n=zu(e),i=(t==null?void 0:t.git_branch)||(n==null?void 0:n.gitBranch),a=(t==null?void 0:t.git_ahead)||0,c=(t==null?void 0:t.git_behind)||0,u=(t==null?void 0:t.total_lines_added)||0,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||c>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"})]}),c>0&&l.jsxs("span",{className:"text-cc-warning",children:[c,"↓",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"})]})]}),c>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:()=>{ke.gitPull(f).then(m=>{K.getState().updateSession(e,{git_ahead:m.git_ahead,git_behind:m.git_behind}),m.success||da(new Error(`git pull failed: ${m.output}`))}).catch(m=>da(m))},title:"Pull latest changes",children:"Pull"})]})]}):null}function cB({sessionId:e}){const t=K(c=>c.sessionTasks.get(e)||VN),n=K(c=>c.sessions.get(e)),i=zu(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(c=>l.jsx(mB,{task:c},c.id))})})}const uB={"usage-limits":lB,"server-memory":W9,"server-disk":Z9,"git-branch":oB,"github-pr":sB,"linear-issue":rB,"mcp-servers":z9,tasks:cB};function dB(e,t){const n=K(i=>i.sessionTasks.get(t)||VN);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 hB({isCodex:e}){const t=K(m=>m.taskPanelConfig),n=K(m=>m.toggleSectionEnabled),i=K(m=>m.moveSectionUp),a=K(m=>m.moveSectionDown),c=K(m=>m.resetTaskPanelConfig),u=K(m=>m.setTaskPanelConfigMode),h=e?"codex":"claude",f=t.order.filter(m=>{const x=pr.find(v=>v.id===m);return!(!x||x.backends&&!x.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((m,x)=>{const v=pr.find(j=>j.id===m),b=t.enabled[m]??!0,y=x===0,_=x===f.length-1;return l.jsxs("div",{"data-testid":`config-section-${m}`,className:`flex items-center gap-2 px-2.5 py-2 rounded-lg border border-cc-border transition-opacity ${b?"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(m),disabled:y,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-${m}`,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(m),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-${m}`,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(m),className:`shrink-0 w-8 h-[18px] rounded-full transition-colors cursor-pointer relative ${b?"bg-cc-primary":"bg-cc-hover"}`,title:b?"Hide section":"Show section",role:"switch","aria-checked":b,"data-testid":`toggle-${m}`,children:l.jsx("span",{className:`absolute top-[2px] left-0 w-[14px] h-[14px] rounded-full bg-white shadow transition-transform ${b?"translate-x-[16px]":"translate-x-[2px]"}`})})]},m)})}),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:()=>c(),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 fB({sectionId:e,sessionId:t,children:n}){var c;const i=((c=pr.find(u=>u.id===e))==null?void 0:c.label)??e,a=dB(e,t);return l.jsx(YN,{id:e,label:i,badge:a,children:n})}function pB({sessionId:e}){const t=K(x=>x.sessions.get(e)),n=zu(e),i=K(x=>x.taskPanelOpen),a=K(x=>x.setTaskPanelOpen),c=K(x=>x.taskPanelConfigMode),u=K(x=>x.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",m=u.order.filter(x=>{const v=pr.find(b=>b.id===x);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:c?"Panel Settings":"Context"}),l.jsx("button",{onClick:()=>{c?K.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"})})})]}),c?l.jsx(hB,{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(X9,{}),l.jsx(F9,{sessionId:e}),m.filter(x=>u.enabled[x]!==!1).map(x=>{var b;const v=uB[x];return v?l.jsx(fB,{sectionId:x,sessionId:e,children:l.jsx(H9,{label:(b=pr.find(y=>y.id===x))==null?void 0:b.label,children:l.jsx(v,{sessionId:e})})},x):null})]}),l.jsx("div",{className:"shrink-0 px-4 py-2 pb-safe border-t border-cc-separator",children:l.jsxs("button",{onClick:()=>K.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 mB({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 gB({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 xB({sessionId:e}){const t=K(L=>L.sessions.get(e)),n=K(L=>L.sdkSessions.find(O=>O.sessionId===e)),i=K(L=>L.diffPanelSelectedFile.get(e)??null),a=K(L=>L.setDiffPanelSelectedFile),c=K(L=>L.diffBase),u=K(L=>L.setDiffBase),h=K(L=>L.changedFilesTick.get(e)??0),f=(t==null?void 0:t.cwd)||(n==null?void 0:n.cwd),[m,x]=k.useState(""),[v,b]=k.useState(!1),[y,_]=k.useState(()=>typeof window<"u"?window.innerWidth>=640:!0),[j,N]=k.useState([]),S=K(L=>L.setGitChangedFilesCount);k.useEffect(()=>{if(!f)return;let L=!1;return ke.getChangedFiles(f,c).then(({files:O})=>{if(L)return;const F=`${f}/`,D=O.filter(Q=>Q.path===f||Q.path.startsWith(F)).map(Q=>({abs:Q.path,rel:Q.path.startsWith(F)?Q.path.slice(F.length):Q.path,status:Q.status==="A"||Q.status==="?"?"created":Q.status==="D"?"deleted":"updated"})).sort((Q,I)=>Q.rel.localeCompare(I.rel));N(D),S(e,D.length)}).catch(()=>{L||(N([]),S(e,0))}),()=>{L=!0}},[f,c,h,e,S]);const C=j;k.useEffect(()=>{!i&&C.length>0&&a(e,C[0].abs)},[i,C,e,a]),k.useEffect(()=>{var L;i&&(C.some(O=>O.abs===i)||a(e,((L=C[0])==null?void 0:L.abs)??null))},[i,C,e,a]),k.useEffect(()=>{if(!i){x("");return}let L=!1;return b(!0),ke.getFileDiff(i,c).then(O=>{L||(x(O.diff),b(!1))}).catch(()=>{L||(x(""),b(!1))}),()=>{L=!0}},[i,c]);const E=k.useCallback(L=>{a(e,L),typeof window<"u"&&window.innerWidth<640&&_(!1)},[e,a]),R=k.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:[y&&l.jsx("div",{className:"fixed inset-0 bg-black/30 z-20 sm:hidden",onClick:()=>_(!1)}),l.jsxs("div",{className:`
|
|
123
|
+
${y?"w-[220px] translate-x-0":"w-0 -translate-x-full"}
|
|
124
|
+
fixed sm:relative z-30 sm:z-auto
|
|
125
|
+
${y?"sm:w-[220px]":"sm:w-0 sm:-translate-x-full"}
|
|
126
|
+
shrink-0 h-full flex flex-col bg-cc-sidebar border-r border-cc-border transition-all duration-200 overflow-hidden
|
|
127
|
+
`,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:L,rel:O,status:F})=>l.jsxs("button",{onClick:()=>E(L),className:`flex items-center gap-2 w-full mx-1 px-2 py-2.5 text-[13px] rounded-[10px] hover:bg-cc-hover transition-colors cursor-pointer whitespace-nowrap ${L===i?"bg-cc-active text-cc-fg":"text-cc-fg/70"}`,style:{width:"calc(100% - 8px)"},children:[l.jsx(gB,{status:F}),l.jsx("span",{className:"truncate leading-snug",children:O})]},L))})]}),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:[!y&&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(c==="last-commit"?"default-branch":"last-commit"),className:"text-cc-muted text-[11px] shrink-0 hidden sm:inline hover:text-cc-fg transition-colors cursor-pointer",title:`Switch to ${c==="last-commit"?"default branch":"last commit"} comparison`,children:c==="default-branch"?"vs default branch":"vs last commit"})]}),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(jo,{unifiedDiff:m,fileName:R||void 0,mode:"full"})}):l.jsxs("div",{className:"h-full flex flex-col items-center justify-center",children:[!y&&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 vB(){const e=K(f=>f.updateInfo),t=K(f=>f.updateDismissedVersion),n=K(f=>f.dismissUpdate),[i,a]=k.useState(!1);if(!(e!=null&&e.updateAvailable)||!e.latestVersion||t===e.latestVersion)return null;const c=async()=>{a(!0);try{localStorage.setItem("companion_docker_prompt_pending","1"),await ke.triggerUpdate(),K.getState().setUpdateOverlayActive(!0)}catch(f){localStorage.removeItem("companion_docker_prompt_pending"),da(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:c,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 bB({text:e}){const[t,n]=k.useState(!1);k.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 yB({steps:e,error:t,unsentPrompt:n,backend:i,onCancel:a}){const c=i==="codex"?"/logo-codex.svg":"/logo.svg",u=e.some(b=>b.status==="in_progress"),h=e.length>0&&e.every(b=>b.status==="done"),f=e.some(b=>b.status==="error")||!!t,m=[...e].reverse().find(b=>b.status==="in_progress"),x=[...e].reverse().find(b=>b.status==="done"),v=f?"Something went wrong":h?"Launching session...":(m==null?void 0:m.label)||(x==null?void 0:x.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:c,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((b,y)=>l.jsxs("div",{className:"flex items-center gap-3 transition-all duration-300",style:{animationDelay:`${y*60}ms`},children:[l.jsxs("div",{className:"w-5 h-5 flex items-center justify-center shrink-0",children:[b.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"}),b.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"})})}),b.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 ${b.status==="in_progress"?"text-cc-fg font-medium":b.status==="done"?"text-cc-muted":"text-cc-error font-medium"}`,children:b.label}),b.detail&&b.status==="in_progress"&&l.jsx("span",{className:"text-[10px] text-cc-muted truncate ml-auto max-w-[120px]",children:b.detail})]},b.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(bB,{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(b=>b.status==="done").length/Math.max(e.length,1)*100)}%`}})})]})}function _B(){const e=localStorage.getItem("companion_auth_token");return e?{Authorization:`Bearer ${e}`}:{}}const wB={installing:"Installing update...",restarting:"Restarting server...",waiting:"Waiting for server...",ready:"Update complete!"};function SB(e){const[t,n]=k.useState("installing"),i=k.useRef(null),a=k.useRef(!0);return k.useEffect(()=>(a.current=!0,()=>{a.current=!1,i.current&&clearTimeout(i.current)}),[]),k.useEffect(()=>{if(!e)return;const c=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:_B()}).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(c),clearTimeout(u),i.current&&clearTimeout(i.current)}},[e]),t}function WN({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:wB[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 kB({active:e}){const t=SB(e);return e?l.jsx(WN,{phase:t,className:"fixed inset-0 z-[100]"}):null}function iP({phase:e}){return l.jsx(WN,{phase:e,className:"absolute inset-0"})}function jB(){const e=K(j=>j.dockerUpdateDialogOpen),t=K(j=>j.setDockerUpdateDialogOpen),[n,i]=k.useState("prompt"),[a,c]=k.useState(!1),[u,h]=k.useState(null),f=k.useRef(null);if(k.useEffect(()=>{e&&ke.getSettings().then(j=>{c(j.dockerAutoUpdate),j.dockerAutoUpdate&&m()}).catch(()=>{})},[e]),k.useEffect(()=>{if(n!=="pulling"){f.current&&(clearInterval(f.current),f.current=null);return}return f.current=setInterval(()=>{ke.getImageStatus("the-companion:latest").then(j=>{h(j),j.status==="ready"?i("done"):j.status==="error"&&i("error")}).catch(()=>{})},2e3),()=>{f.current&&(clearInterval(f.current),f.current=null)}},[n]),!e)return null;function m(){i("pulling"),ke.pullImage("the-companion:latest").then(j=>{j.state&&h(j.state)}).catch(()=>{i(j=>j==="pulling"?"error":j)})}function x(){m()}function v(){y()}function b(){y()}function y(){i("prompt"),h(null),t(!1)}async function _(){const j=!a;c(j);try{await ke.updateSettings({dockerAutoUpdate:j})}catch{c(!j)}}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:x,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(`
|
|
128
|
+
`)})]}),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:b,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(`
|
|
129
|
+
`)}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("button",{type:"button",onClick:y,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:x,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 rP({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...
|
|
130
|
+
Layer 1/5: abc123 downloading
|
|
131
|
+
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"})]})]})]})})}const NB=2e3;function CB(){const[e,t]=k.useState(null),[n,i]=k.useState({state:"idle"}),[a,c]=k.useState(!1),[u,h]=k.useState(""),[f,m]=k.useState(!1),x=k.useRef(null),v=k.useCallback(async()=>{try{t(await ke.getCodexAccount())}catch(R){h(R instanceof Error?R.message:String(R))}},[]),b=k.useCallback(()=>{x.current&&(clearInterval(x.current),x.current=null)},[]),y=k.useCallback(()=>{b(),x.current=setInterval(async()=>{try{const R=await ke.getCodexLoginStatus();i(R),R.state!=="pending"&&(b(),R.state==="success"&&v())}catch{}},NB)},[v,b]);k.useEffect(()=>(v(),ke.getCodexLoginStatus().then(R=>{i(R),R.state==="pending"&&y()}).catch(()=>{}),b),[v,y,b]);const _=async()=>{c(!0),h("");try{const R=await ke.startCodexLogin();i(R),R.state==="pending"?y():R.error&&h(R.error)}catch(R){h(R instanceof Error?R.message:String(R))}finally{c(!1)}},j=async()=>{c(!0),b();try{i(await ke.cancelCodexLogin())}catch(R){h(R instanceof Error?R.message:String(R))}finally{c(!1)}},N=async()=>{c(!0),h("");try{const R=await ke.codexLogout();!R.ok&&R.error&&h(R.error),i({state:"idle"}),await v()}catch(R){h(R instanceof Error?R.message:String(R))}finally{c(!1)}},S=async()=>{if(n.userCode)try{await navigator.clipboard.writeText(n.userCode),m(!0),setTimeout(()=>m(!1),1500)}catch{}},C=n.state==="pending",E=(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."}),E&&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."}),!E&&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:j,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||E,className:`px-4 py-2 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${a||E?"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 d0=["welcome","claude","codex","done"],R2='button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])';function fx(){return typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function EB({onComplete:e}){const[t,n]=k.useState("welcome"),[i,a]=k.useState(""),[c,u]=k.useState(""),[h,f]=k.useState(!1),[m,x]=k.useState(""),[v,b]=k.useState(!1),[y,_]=k.useState(!1),[j,N]=k.useState(fx),S=k.useRef(null);k.useEffect(()=>{j||requestAnimationFrame(()=>N(!0))},[j]),k.useEffect(()=>{const X=S.current;if(!X)return;function M(W){if(W.key==="Escape"){W.preventDefault();return}if(W.key!=="Tab")return;const q=X.querySelectorAll(R2);if(q.length===0)return;const H=q[0],U=q[q.length-1];W.shiftKey?document.activeElement===H&&(W.preventDefault(),U.focus()):document.activeElement===U&&(W.preventDefault(),H.focus())}document.addEventListener("keydown",M);const de=X.querySelector(R2);return de==null||de.focus(),()=>document.removeEventListener("keydown",M)},[t]);const C=k.useCallback(async()=>{if(!i.trim()){n("codex");return}f(!0),x("");try{await ke.updateSettings({claudeCodeOAuthToken:i.trim()}),b(!0),n("codex")}catch(X){x(X instanceof Error?X.message:"Failed to save token")}finally{f(!1)}},[i]),E=k.useCallback(async()=>{f(!0),x("");try{(await ke.getSettings()).codexDeviceAuthConfigured?(_(!0),await L()):x("No Codex auth found yet. Complete the sign-in above, then check again.")}catch(X){x(X instanceof Error?X.message:"Failed to check auth status")}finally{f(!1)}},[]),R=k.useCallback(async()=>{f(!0),x("");try{await ke.updateSettings({openaiApiKey:c.trim()}),_(!0),await L()}catch(X){x(X instanceof Error?X.message:"Failed to save API key")}finally{f(!1)}},[c]),L=k.useCallback(async()=>{try{await ke.updateSettings({onboardingCompleted:!0})}catch{}n("done")},[]),O=k.useCallback(()=>{e()},[e]),F=k.useCallback(async()=>{await L(),e()},[L,e]),D=k.useCallback(X=>{x(""),n(X)},[]),Q=d0.indexOf(t),I=fx();return To.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:j?1:0,transition:I?"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:j?"translateY(0)":"translateY(12px)",opacity:j?1:0,transition:I?"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 ${Q+1} of ${d0.length-1}`,children:d0.slice(0,3).map((X,M)=>l.jsx("div",{className:"h-[3px] rounded-full transition-[transform,background,opacity] duration-300",style:{width:32,transform:M===Q?"scaleX(1)":"scaleX(0.375)",transformOrigin:"center",background:M<=Q?"var(--color-cc-primary)":"var(--color-cc-border)",opacity:M<=Q?1:.5}},X))}),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(TB,{onSetupClaude:()=>D("claude"),onSetupCodex:()=>D("codex")}),t==="claude"&&l.jsx(AB,{token:i,onTokenChange:a,onSave:C,onSkip:()=>D("codex"),saving:h,error:m}),t==="codex"&&l.jsx(MB,{apiKey:c,onApiKeyChange:u,onCheckAuth:E,onSaveApiKey:R,onSkip:()=>L(),onBack:()=>D("claude"),saving:h,error:m}),t==="done"&&l.jsx(RB,{claudeConfigured:v,codexConfigured:y,onDone:O})]}),t==="welcome"&&l.jsx("button",{onClick:F,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 TB({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 AB({token:e,onTokenChange:t,onSave:n,onSkip:i,saving:a,error:c}){const u=k.useRef(null);k.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:"Generate an OAuth token by running this in your terminal:"})]}),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(OB,{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":c?h:void 0,"aria-invalid":c?!0:void 0,className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg border border-cc-border text-cc-fg placeholder:text-cc-muted/60 focus:outline-none focus:ring-1 focus:ring-cc-primary focus:border-cc-primary font-mono-code transition-shadow duration-150"})]}),c&&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:c})]}),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 MB({apiKey:e,onApiKeyChange:t,onCheckAuth:n,onSaveApiKey:i,onSkip:a,onBack:c,saving:u,error:h}){const[f,m]=k.useState(!1),x="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(CB,{}),h&&l.jsxs("div",{id:x,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:()=>m(!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?x: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:c,className:"px-3 py-2.5 min-h-[44px] min-w-[44px] rounded-lg text-sm text-cc-muted hover:text-cc-fg transition-colors flex items-center gap-1",children:[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 RB({claudeConfigured:e,codexConfigured:t,onDone:n}){const i=!e&&!t,a=fx(),[c,u]=k.useState(a);return k.useEffect(()=>{c||requestAnimationFrame(()=>u(!0))},[c]),l.jsxs("div",{className:"p-7 pb-6 text-center",style:{opacity:c?1:0,transform:c?"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 OB({text:e}){const[t,n]=k.useState(!1),i=k.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 LB(e){return K(t=>{var n;return!e||!t.magicUiAvailable?!1:((n=t.sessions.get(e))==null?void 0:n.magicUiActive)===!0})}const DB=k.lazy(()=>Vn(()=>import("./Playground-DvE5Hx7h.js"),__vite__mapDeps([0,1])).then(e=>({default:e.Playground}))),zB=k.lazy(()=>Vn(()=>import("./SettingsPage-DlqgaG3K.js"),[]).then(e=>({default:e.SettingsPage}))),$B=k.lazy(()=>Vn(()=>import("./IntegrationsPage-C3o8sLpo.js"),[]).then(e=>({default:e.IntegrationsPage}))),BB=k.lazy(()=>Vn(()=>import("./LinearSettingsPage-B-7G76Ns.js"),[]).then(e=>({default:e.LinearSettingsPage}))),PB=k.lazy(()=>Vn(()=>import("./LinearOAuthSettingsPage-C181ckxW.js"),[]).then(e=>({default:e.LinearOAuthSettingsPage}))),IB=k.lazy(()=>Vn(()=>import("./TailscalePage-DHuSFb11.js"),[]).then(e=>({default:e.TailscalePage}))),FB=k.lazy(()=>Vn(()=>import("./PromptsPage-BFYinvPb.js"),[]).then(e=>({default:e.PromptsPage}))),UB=k.lazy(()=>Vn(()=>Promise.resolve().then(()=>g9),void 0).then(e=>({default:e.EnvManager}))),HB=k.lazy(()=>Vn(()=>import("./SandboxManager-DRRe06TY.js"),[]).then(e=>({default:e.SandboxManager}))),qB=k.lazy(()=>Vn(()=>import("./CronManager-DNNKDHYb.js"),[]).then(e=>({default:e.CronManager}))),VB=k.lazy(()=>Vn(()=>import("./AgentsPage-DcOqIP9k.js"),[]).then(e=>({default:e.AgentsPage}))),GB=k.lazy(()=>Vn(()=>import("./RunsPage-C_wKk1gx.js"),[]).then(e=>({default:e.RunsPage}))),YB=k.lazy(()=>Vn(()=>import("./DashboardPage-B10_oar4.js"),[]).then(e=>({default:e.DashboardPage}))),XB=k.lazy(()=>Vn(()=>import("./MagicUIView-BmwHDokR.js"),__vite__mapDeps([2,1])).then(e=>({default:e.MagicUIView})));function fs(){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 QB(){return k.useSyncExternalStore(e=>(window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)),()=>window.location.hash)}function WB(){const e=K(A=>A.isAuthenticated),t=K(A=>A.darkMode),n=K(A=>A.currentSessionId),i=K(A=>A.sidebarOpen),a=K(A=>A.taskPanelOpen),c=K(A=>A.homeResetKey),u=K(A=>A.activeTab),h=LB(n),f=K(A=>A.sessionCreating),m=K(A=>A.sessionCreatingBackend),x=K(A=>A.creationProgress),v=K(A=>A.creationError),b=K(A=>A.creationDraft),y=K(A=>A.updateOverlayActive),_=QB(),j=k.useMemo(()=>Ix(_),[_]),N=j.page==="settings",S=j.page==="prompts",C=j.page==="integrations",E=j.page==="integration-linear",R=j.page==="integration-linear-oauth",L=j.page==="integration-tailscale",O=j.page==="environments",F=j.page==="sandboxes",D=j.page==="scheduled",Q=j.page==="agents"||j.page==="agent-detail",I=j.page==="runs",X=j.page==="dashboard",M=j.page==="session"||j.page==="home";k.useEffect(()=>{XM(_||"#/")},[_]),k.useEffect(()=>{document.documentElement.classList.toggle("dark",t)},[t]);const de=k.useRef(K.getState().currentSessionId);k.useEffect(()=>{if(de.current!==null&&j.page==="home"){Fx(de.current,!0),de.current=null;return}if(de.current=null,j.page==="session"){const A=K.getState();A.currentSessionId!==j.sessionId&&A.setCurrentSession(j.sessionId),Co(j.sessionId)}else if(j.page==="home"){const A=K.getState();A.currentSessionId!==null&&A.setCurrentSession(null)}},[j]);const W=K(A=>n?A.changedFilesTick.get(n)??0:0),q=K(A=>A.diffBase),H=K(A=>A.setGitChangedFilesCount),U=K(A=>{var Ee,Me;return n&&(((Ee=A.sessions.get(n))==null?void 0:Ee.cwd)||((Me=A.sdkSessions.find(z=>z.sessionId===n))==null?void 0:Me.cwd))||null});k.useEffect(()=>{if(!n||!U)return;let A=!1;return ke.getChangedFiles(U,q).then(({files:Ee})=>{if(A)return;const Me=`${U}/`,z=Ee.filter(P=>P.path===U||P.path.startsWith(Me)).length;H(n,z)}).catch(()=>{}),()=>{A=!0}},[n,U,q,W,H]),k.useEffect(()=>{const A=()=>{ke.checkForUpdate().then(Me=>{K.getState().setUpdateInfo(Me)}).catch(()=>{})};A();const Ee=setInterval(A,300*1e3);return()=>clearInterval(Ee)},[]),k.useEffect(()=>{const A=()=>{ke.getClaudeCompat().then(Me=>{K.getState().setClaudeCompatInfo(Me)}).catch(()=>{})};A();const Ee=setInterval(A,300*1e3);return()=>clearInterval(Ee)},[]);const[re,ve]=k.useState(!1);return k.useEffect(()=>{e&&ke.getSettings().then(A=>{A.publicUrl&&K.getState().setPublicUrl(A.publicUrl),K.getState().setMagicUiAvailable(!!A.magicUiEnabled&&!!A.claudeCliAvailable),A.onboardingCompleted||ve(!0)}).catch(()=>{})},[e]),k.useEffect(()=>{localStorage.getItem("companion_docker_prompt_pending")==="1"&&localStorage.removeItem("companion_docker_prompt_pending")},[]),e?j.page==="playground"?l.jsx(k.Suspense,{fallback:l.jsx(fs,{}),children:l.jsx(DB,{})}):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:()=>K.getState().setSidebarOpen(!1)}),l.jsx("div",{className:`
|
|
132
|
+
fixed inset-y-0 left-0 md:relative md:inset-auto z-40 md:z-auto
|
|
133
|
+
h-full shrink-0 transition-all duration-200 pt-safe md:pt-0
|
|
134
|
+
${i?"w-full md:w-[260px] translate-x-0":"w-0 -translate-x-full md:w-0 md:-translate-x-full"}
|
|
135
|
+
overflow-hidden
|
|
136
|
+
`,children:l.jsx(fR,{})}),l.jsxs("div",{className:"flex-1 flex flex-col min-w-0 overflow-hidden",children:[l.jsx(h9,{}),l.jsx(vB,{}),l.jsxs("div",{className:"flex-1 overflow-hidden relative",children:[N&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(fs,{}),children:l.jsx(zB,{embedded:!0})})}),S&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(fs,{}),children:l.jsx(FB,{embedded:!0})})}),C&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(fs,{}),children:l.jsx($B,{embedded:!0})})}),E&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(fs,{}),children:l.jsx(BB,{embedded:!0})})}),R&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(fs,{}),children:l.jsx(PB,{embedded:!0})})}),L&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(fs,{}),children:l.jsx(IB,{embedded:!0})})}),O&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(fs,{}),children:l.jsx(UB,{embedded:!0})})}),F&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(fs,{}),children:l.jsx(HB,{embedded:!0})})}),D&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(fs,{}),children:l.jsx(qB,{embedded:!0})})}),Q&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(fs,{}),children:l.jsx(VB,{route:j})})}),I&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(fs,{}),children:l.jsx(GB,{})})}),X&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(fs,{}),children:l.jsx(YB,{})})}),M&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"absolute inset-0",children:n?u==="diff"?l.jsx(xB,{sessionId:n}):h?l.jsx(k.Suspense,{fallback:l.jsx(fs,{}),children:l.jsx(XB,{sessionId:n})}):l.jsx(a9,{sessionId:n}):l.jsx(T9,{},c)}),f&&x&&x.length>0&&l.jsx(yB,{steps:x,error:v,unsentPrompt:(b==null?void 0:b.text)??null,backend:m??void 0,onCancel:()=>K.getState().clearCreation()})]})]})]}),n&&M&&l.jsxs(l.Fragment,{children:[!a&&l.jsxs("button",{type:"button",onClick:()=>K.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:()=>K.getState().setTaskPanelOpen(!1)}),l.jsx("div",{className:`
|
|
137
|
+
fixed inset-y-0 right-0 lg:relative lg:inset-auto z-40 lg:z-auto
|
|
138
|
+
h-full shrink-0 transition-all duration-200 pt-safe lg:pt-0
|
|
139
|
+
${a?"w-full lg:w-[320px] translate-x-0":"w-0 translate-x-full lg:w-0 lg:translate-x-full"}
|
|
140
|
+
overflow-hidden
|
|
141
|
+
`,children:l.jsx(pB,{sessionId:n})})]}),l.jsx(kB,{active:y}),l.jsx(jB,{}),re&&l.jsx(EB,{onComplete:()=>ve(!1)})]}):l.jsx(eR,{})}class KB extends k.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,n){da(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}}YM();BE.createRoot(document.getElementById("root")).render(l.jsx(k.StrictMode,{children:l.jsx(KB,{children:l.jsx(WB,{})})}));Vn(()=>import("./sw-register-D2DuNbEG.js"),[]).catch(()=>{});export{W$ as A,go as B,CB as C,JB as D,$9 as E,v9 as F,nB as G,zh as H,No as I,To as J,y2 as K,mu as L,E$ as M,zN as N,M$ as O,B$ as P,$$ as Q,z$ as R,yB as S,U2 as T,vB as U,eP as V,sP as W,nP as X,Vn as _,ke as a,qg as b,Un as c,D$ as d,lR as e,a9 as f,GM as g,Yz as h,p9 as i,l as j,p$ as k,jo as l,iP as m,Fx as n,rP as o,i$ as p,r$ as q,k as r,tP as s,U9 as t,K as u,l9 as v,J9 as w,eB as x,Oi as y,sl as z};
|