@hellcoder/companion 0.123.0 → 0.124.1
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/bin/cli.ts +9 -1
- package/dist/assets/{AgentsPage-D_ZGmkrU.js → AgentsPage-Byq8wvdn.js} +1 -1
- package/dist/assets/{CronManager-u5KuicVz.js → CronManager-Bq2lOMbZ.js} +1 -1
- package/dist/assets/{DashboardPage-Dab8XyGT.js → DashboardPage-V77HIt8S.js} +1 -1
- package/dist/assets/{IntegrationsPage-Bc7SgfqX.js → IntegrationsPage-C3aW9cDI.js} +1 -1
- package/dist/assets/{LinearOAuthSettingsPage-CxyO36qY.js → LinearOAuthSettingsPage-_eAbciJN.js} +1 -1
- package/dist/assets/{LinearSettingsPage-BWfwYF05.js → LinearSettingsPage-DDHFHt7j.js} +1 -1
- package/dist/assets/{MagicUIDashboard-CfD7iyXm.js → MagicUIDashboard-Cl18AKjV.js} +1 -1
- package/dist/assets/{MagicUIView-CO6pZB0M.js → MagicUIView-C0aiMTet.js} +1 -1
- package/dist/assets/{Playground-BiB_VDIl.js → Playground-CvoHRMBd.js} +1 -1
- package/dist/assets/{PromptsPage-BIE70OT1.js → PromptsPage-CzTs1_Se.js} +1 -1
- package/dist/assets/{RunsPage-BAblQKAW.js → RunsPage-B7xru-Xy.js} +1 -1
- package/dist/assets/{SandboxManager-DsR3hQz1.js → SandboxManager-C3tFkiWz.js} +1 -1
- package/dist/assets/{SettingsPage-DuzHKBe_.js → SettingsPage-BZ2fBrHD.js} +1 -1
- package/dist/assets/{TailscalePage-C3y_bGkT.js → TailscalePage-DFRiFKcb.js} +1 -1
- package/dist/assets/index-C7nK12tB.js +142 -0
- package/dist/assets/index-OAVDFR0O.css +1 -0
- package/dist/assets/{sw-register-CUhVLAo0.js → sw-register-Dc72vh_Y.js} +1 -1
- package/dist/index.html +2 -2
- package/dist/sw.js +1 -1
- package/package.json +1 -1
- package/server/cli-launcher.test.ts +16 -0
- package/server/cli-launcher.ts +14 -0
- package/server/index.ts +2 -2
- package/server/routes/system-routes.test.ts +57 -0
- package/server/routes/system-routes.ts +20 -24
- package/server/routes.test.ts +29 -0
- package/server/routes.ts +14 -0
- package/server/service.test.ts +232 -0
- package/server/service.ts +286 -23
- package/dist/assets/index-BnF_YIhB.css +0 -1
- package/dist/assets/index-Cd0HGwTS.js +0 -141
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Playground-BiB_VDIl.js","assets/MagicUIDashboard-CfD7iyXm.js","assets/MagicUIView-CO6pZB0M.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
var CE=Object.defineProperty;var EE=(e,t,n)=>t in e?CE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var u_=(e,t,n)=>EE(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))i(a);new MutationObserver(a=>{for(const o of a)if(o.type==="childList")for(const u of o.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&i(u)}).observe(document,{childList:!0,subtree:!0});function n(a){const o={};return a.integrity&&(o.integrity=a.integrity),a.referrerPolicy&&(o.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?o.credentials="include":a.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(a){if(a.ep)return;a.ep=!0;const o=n(a);fetch(a.href,o)}})();const TE="modulepreload",AE=function(e){return"/"+e},d_={},Vn=function(t,n,i){let a=Promise.resolve();if(n&&n.length>0){let u=function(m){return Promise.all(m.map(g=>Promise.resolve(g).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const h=document.querySelector("meta[property=csp-nonce]"),f=(h==null?void 0:h.nonce)||(h==null?void 0:h.getAttribute("nonce"));a=u(n.map(m=>{if(m=AE(m),m in d_)return;d_[m]=!0;const g=m.endsWith(".css"),v=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${v}`))return;const b=document.createElement("link");if(b.rel=g?"stylesheet":TE,g||(b.as="script"),b.crossOrigin="",b.href=m,f&&b.setAttribute("nonce",f),document.head.appendChild(b),g)return new Promise((y,_)=>{b.addEventListener("load",y),b.addEventListener("error",()=>_(new Error(`Unable to preload CSS for ${m}`)))})}))}function o(u){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=u,window.dispatchEvent(h),!h.defaultPrevented)throw u}return a.then(u=>{for(const h of u||[])h.status==="rejected"&&o(h.reason);return t().catch(o)})};function 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 h_;function ME(){if(h_)return Rc;h_=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(i,a,o){var u=null;if(o!==void 0&&(u=""+o),a.key!==void 0&&(u=""+a.key),"key"in a){o={};for(var h in a)h!=="key"&&(o[h]=a[h])}else o=a;return a=o.ref,{$$typeof:e,type:i,key:u,ref:a!==void 0?a:null,props:o}}return Rc.Fragment=t,Rc.jsx=n,Rc.jsxs=n,Rc}var f_;function RE(){return f_||(f_=1,Wm.exports=ME()),Wm.exports}var l=RE(),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 p_;function OE(){if(p_)return We;p_=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),u=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),g=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,w={};function C(P,oe,we){this.props=P,this.context=oe,this.refs=w,this.updater=we||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,we){this.props=P,this.context=oe,this.refs=w,this.updater=we||j}var M=R.prototype=new E;M.constructor=R,N(M,C.prototype),M.isPureReactComponent=!0;var L=Array.isArray;function F(){}var D={H:null,A:null,T:null,S:null},X=Object.prototype.hasOwnProperty;function U(P,oe,we){var Ne=we.ref;return{$$typeof:e,type:P,key:oe,ref:Ne!==void 0?Ne:null,props:we}}function G(P,oe){return U(P.type,oe,P.props)}function O(P){return typeof P=="object"&&P!==null&&P.$$typeof===e}function de(P){var oe={"=":"=0",":":"=2"};return"$"+P.replace(/[=:]/g,function(we){return oe[we]})}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 I(P,oe,we,Ne,Ae){var De=typeof P;(De==="undefined"||De==="boolean")&&(P=null);var ze=!1;if(P===null)ze=!0;else switch(De){case"bigint":case"string":case"number":ze=!0;break;case"object":switch(P.$$typeof){case e:case t:ze=!0;break;case g:return ze=P._init,I(ze(P._payload),oe,we,Ne,Ae)}}if(ze)return Ae=Ae(P),ze=Ne===""?"."+q(P,0):Ne,L(Ae)?(we="",ze!=null&&(we=ze.replace(W,"$&/")+"/"),I(Ae,oe,we,"",function(Ut){return Ut})):Ae!=null&&(O(Ae)&&(Ae=G(Ae,we+(Ae.key==null||P&&P.key===Ae.key?"":(""+Ae.key).replace(W,"$&/")+"/")+ze)),oe.push(Ae)),1;ze=0;var Ce=Ne===""?".":Ne+":";if(L(P))for(var Re=0;Re<P.length;Re++)Ne=P[Re],De=Ce+q(Ne,Re),ze+=I(Ne,oe,we,De,Ae);else if(Re=_(P),typeof Re=="function")for(P=Re.call(P),Re=0;!(Ne=P.next()).done;)Ne=Ne.value,De=Ce+q(Ne,Re++),ze+=I(Ne,oe,we,De,Ae);else if(De==="object"){if(typeof P.then=="function")return I(H(P),oe,we,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 ze}function re(P,oe,we){if(P==null)return P;var Ne=[],Ae=0;return I(P,Ne,"","",function(De){return oe.call(we,De,Ae++)}),Ne}function ve(P){if(P._status===-1){var oe=P._result,we=oe();we.then(function(Ne){(P._status===0||P._status===-1)&&(P._status=1,P._result=Ne,we.status===void 0&&(we.status="fulfilled",we.value=Ne))},function(Ne){(P._status===0||P._status===-1)&&(P._status=2,P._result=Ne,we.status===void 0&&(we.status="rejected",we.reason=Ne))}),P._status===-1&&(P._status=0,P._result=we)}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,we={};we.types=oe!==null?oe.types:null,D.T=we;try{var Ne=P(),Ae=D.S;Ae!==null&&Ae(we,Ne),typeof Ne=="object"&&Ne!==null&&typeof Ne.then=="function"&&Ne.then(F,A)}catch(De){A(De)}finally{oe!==null&&we.types!==null&&(oe.types=we.types),D.T=oe}}function Me(P){var oe=D.T;if(oe!==null){var we=oe.types;we===null?oe.types=[P]:we.indexOf(P)===-1&&we.push(P)}else Ee(Me.bind(null,P))}var z={map:re,forEach:function(P,oe,we){re(P,function(){oe.apply(this,arguments)},we)},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(!O(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,we){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(De in oe.key!==void 0&&(Ae=""+oe.key),oe)!X.call(oe,De)||De==="key"||De==="__self"||De==="__source"||De==="ref"&&oe.ref===void 0||(Ne[De]=oe[De]);var De=arguments.length-2;if(De===1)Ne.children=we;else if(1<De){for(var ze=Array(De),Ce=0;Ce<De;Ce++)ze[Ce]=arguments[Ce+2];Ne.children=ze}return U(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:o,_context:P},P},We.createElement=function(P,oe,we){var Ne,Ae={},De=null;if(oe!=null)for(Ne in oe.key!==void 0&&(De=""+oe.key),oe)X.call(oe,Ne)&&Ne!=="key"&&Ne!=="__self"&&Ne!=="__source"&&(Ae[Ne]=oe[Ne]);var ze=arguments.length-2;if(ze===1)Ae.children=we;else if(1<ze){for(var Ce=Array(ze),Re=0;Re<ze;Re++)Ce[Re]=arguments[Re+2];Ae.children=Ce}if(P&&P.defaultProps)for(Ne in ze=P.defaultProps,ze)Ae[Ne]===void 0&&(Ae[Ne]=ze[Ne]);return U(P,De,Ae)},We.createRef=function(){return{current:null}},We.forwardRef=function(P){return{$$typeof:h,render:P}},We.isValidElement=O,We.lazy=function(P){return{$$typeof:g,_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,we){return D.H.useActionState(P,oe,we)},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,we){return D.H.useImperativeHandle(P,oe,we)},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,we){return D.H.useReducer(P,oe,we)},We.useRef=function(P){return D.H.useRef(P)},We.useState=function(P){return D.H.useState(P)},We.useSyncExternalStore=function(P,oe,we){return D.H.useSyncExternalStore(P,oe,we)},We.useTransition=function(){return D.H.useTransition()},We.version="19.3.0",We}var m_;function mx(){return m_||(m_=1,Km.exports=OE()),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 g_;function LE(){return g_||(g_=1,(function(e){function t(H,I){var re=H.length;H.push(I);e:for(;0<re;){var ve=re-1>>>1,A=H[ve];if(0<a(A,I))H[ve]=I,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 I=H[0],re=H.pop();if(re!==I){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 I}function a(H,I){var re=H.sortIndex-I.sortIndex;return re!==0?re:H.id-I.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var u=Date,h=u.now();e.unstable_now=function(){return u.now()-h}}var f=[],m=[],g=1,v=null,b=3,y=!1,_=!1,j=!1,N=!1,w=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function R(H){for(var I=n(m);I!==null;){if(I.callback===null)i(m);else if(I.startTime<=H)i(m),I.sortIndex=I.expirationTime,t(f,I);else break;I=n(m)}}function M(H){if(j=!1,R(H),!_)if(n(f)!==null)_=!0,L||(L=!0,O());else{var I=n(m);I!==null&&q(M,I.startTime-H)}}var L=!1,F=-1,D=5,X=-1;function U(){return N?!0:!(e.unstable_now()-X<D)}function G(){if(N=!1,L){var H=e.unstable_now();X=H;var I=!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&&U());){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),I=!0;break t}v===n(f)&&i(f),R(H)}else i(f);v=n(f)}if(v!==null)I=!0;else{var Ee=n(m);Ee!==null&&q(M,Ee.startTime-H),I=!1}}break e}finally{v=null,b=re,y=!1}I=void 0}}finally{I?O():L=!1}}}var O;if(typeof E=="function")O=function(){E(G)};else if(typeof MessageChannel<"u"){var de=new MessageChannel,W=de.port2;de.port1.onmessage=G,O=function(){W.postMessage(null)}}else O=function(){w(G,0)};function q(H,I){F=w(function(){H(e.unstable_now())},I)}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 I=3;break;default:I=b}var re=b;b=I;try{return H()}finally{b=re}},e.unstable_requestPaint=function(){N=!0},e.unstable_runWithPriority=function(H,I){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var re=b;b=H;try{return I()}finally{b=re}},e.unstable_scheduleCallback=function(H,I,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:g++,callback:I,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(M,re-ve))):(H.sortIndex=A,t(f,H),_||y||(_=!0,L||(L=!0,O()))),H},e.unstable_shouldYield=U,e.unstable_wrapCallback=function(H){var I=b;return function(){var re=b;b=I;try{return H.apply(this,arguments)}finally{b=re}}}})(eg)),eg}var x_;function DE(){return x_||(x_=1,Jm.exports=LE()),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 v_;function zE(){if(v_)return Bn;v_=1;var e=mx();function t(g){var v="https://react.dev/errors/"+g;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 #"+g+"; visit "+v+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var i={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},a=Symbol.for("react.portal"),o=Symbol.for("react.recoverable"),u=Symbol.for("react.optimistic_key");function h(g,v,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:g,containerInfo:v,implementation:b}}var f=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function m(g,v){if(g==="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(g){return{$$typeof:o,_reason:g}},Bn.createPortal=function(g,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(g,v,null,b)},Bn.flushSync=function(g){var v=f.T,b=i.p;try{if(f.T=null,i.p=2,g)return g()}finally{f.T=v,i.p=b,i.d.f()}},Bn.preconnect=function(g,v){typeof g=="string"&&(v?(v=v.crossOrigin,v=typeof v=="string"?v==="use-credentials"?v:"":void 0):v=null,i.d.C(g,v))},Bn.prefetchDNS=function(g){typeof g=="string"&&i.d.D(g)},Bn.preinit=function(g,v){if(typeof g=="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(g,typeof v.precedence=="string"?v.precedence:void 0,{crossOrigin:y,integrity:_,fetchPriority:j}):b==="script"&&i.d.X(g,{crossOrigin:y,integrity:_,fetchPriority:j,nonce:typeof v.nonce=="string"?v.nonce:void 0})}},Bn.preinitModule=function(g,v){if(typeof g=="string")if(typeof v=="object"&&v!==null){if(v.as==null||v.as==="script"){var b=m(v.as,v.crossOrigin);i.d.M(g,{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(g)},Bn.preload=function(g,v){if(typeof g=="string"&&typeof v=="object"&&v!==null&&typeof v.as=="string"){var b=v.as,y=m(b,v.crossOrigin);i.d.L(g,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(g,v){if(typeof g=="string")if(v){var b=m(v.as,v.crossOrigin);i.d.m(g,{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(g)},Bn.requestFormReset=function(g){i.d.r(g)},Bn.unstable_batchedUpdates=function(g,v){return g(v)},Bn.useFormState=function(g,v,b){return f.H.useFormState(g,v,b)},Bn.useFormStatus=function(){return f.H.useHostTransitionStatus()},Bn.version="19.3.0",Bn}var b_;function z2(){if(b_)return tg.exports;b_=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=zE(),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 y_;function $E(){if(y_)return Oc;y_=1;var e=DE(),t=mx(),n=z2();function i(s){var r="https://react.dev/errors/"+s;if(1<arguments.length){r+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)r+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+s+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function o(s){for(var r=s,c=r;c&&!c.alternate;)r=c,(r.flags&4098)!==0&&(s=r.return),c=r.return;for(;r.return;)r=r.return;return r.tag===3?s:null}function u(s){if(s.tag===13){var r=s.memoizedState;if(r===null&&(s=s.alternate,s!==null&&(r=s.memoizedState)),r!==null)return r.dehydrated}return null}function h(s){if(s.tag===31){var r=s.memoizedState;if(r===null&&(s=s.alternate,s!==null&&(r=s.memoizedState)),r!==null)return r.dehydrated}return null}function f(s){if(o(s)!==s)throw Error(i(188))}function m(s){var r=s.alternate;if(!r){if(r=o(s),r===null)throw Error(i(188));return r!==s?null:s}for(var c=s,d=r;;){var p=c.return;if(p===null)break;var x=p.alternate;if(x===null){if(d=p.return,d!==null){c=d;continue}break}if(p.child===x.child){for(x=p.child;x;){if(x===c)return f(p),s;if(x===d)return f(p),r;x=x.sibling}throw Error(i(188))}if(c.return!==d.return)c=p,d=x;else{for(var S=!1,T=p.child;T;){if(T===c){S=!0,c=p,d=x;break}if(T===d){S=!0,d=p,c=x;break}T=T.sibling}if(!S){for(T=x.child;T;){if(T===c){S=!0,c=x,d=p;break}if(T===d){S=!0,d=x,c=p;break}T=T.sibling}if(!S)throw Error(i(189))}}if(c.alternate!==d)throw Error(i(190))}if(c.tag!==3)throw Error(i(188));return c.stateNode.current===c?s:r}function g(s){var r=s.tag;if(r===5||r===26||r===27||r===6)return s;for(s=s.child;s!==null;){if(r=g(s),r!==null)return r;s=s.sibling}return null}function v(s,r,c,d,p,x){for(;s!==null;){if((s.tag===5||s.tag===27||s.tag===6)&&c(s,d,p,x)||(s.tag!==22||s.memoizedState===null)&&(r||s.tag!==5&&s.tag!==27)&&v(s.child,r,c,d,p,x))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],c=b(s);return c===null||j(r,s,c.child,{foundSelf:!1}),r}function j(s,r,c,d){for(;c!==null;){if(c===r)d.foundSelf=!0;else if(c.tag===5||c.tag===27||c.tag===6){if(d.foundSelf)return s[1]=c,!0;s[0]=c}else if((c.tag!==22||c.memoizedState===null)&&j(s,r,c.child,d))return!0;c=c.sibling}return!1}function N(s){switch(s.tag){case 5:case 27:case 6:return s.stateNode;case 3:return s.stateNode.containerInfo;default:throw Error(i(559))}}var w=null,C=null;function E(s,r,c){return s===c?!0:s===r?(w=s,!0):!1}function R(s,r,c){return s===c?(C=s,!1):s===r?(C!==null&&(w=s),!0):!1}function M(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 L(s,r,c){for(var d=0,p=s;p;p=c(p))d++;p=0;for(var x=r;x;x=c(x))p++;for(;0<d-p;)s=c(s),d--;for(;0<p-d;)r=c(r),p--;for(;d--;){if(s===r||r!==null&&s===r.alternate)return s;s=c(s),r=c(r)}return null}var F=Object.assign,D=Symbol.for("react.element"),X=Symbol.for("react.transitional.element"),U=Symbol.for("react.portal"),G=Symbol.for("react.fragment"),O=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"),I=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"),we=Symbol.iterator;function Ne(s){return s===null||typeof s!="object"?null:(s=we&&s[we]||s["@@iterator"],typeof s=="function"?s:null)}var Ae=Symbol.for("react.client.reference");function De(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 G:return"Fragment";case de:return"Profiler";case O:return"StrictMode";case I:return"Suspense";case re:return"SuspenseList";case Ee:return"Activity";case P:return"ViewTransition"}if(typeof s=="object")switch(s.$$typeof){case U: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:De(s.type)||"Memo";case A:r=s._payload,s=s._init;try{return De(s(r))}catch{}}return null}var ze=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,Ut={pending:!1,data:null,method:null,action:null},Kt=[],Ft=-1;function jt(s){return{current:s}}function wt(s){0>Ft||(s.current=Kt[Ft],Kt[Ft]=null,Ft--)}function Xe(s,r){Ft++,Kt[Ft]=s.current,s.current=r}var St=jt(null),nn=jt(null),se=jt(null),je=jt(null);function Qe(s,r){switch(Xe(se,r),Xe(nn,s),Xe(St,null),r.nodeType){case 9:case 11:s=(s=r.documentElement)&&(s=s.namespaceURI)?by(s):0;break;default:if(s=r.tagName,r=r.namespaceURI)r=by(r),s=yy(r,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}wt(St),Xe(St,s)}function et(){wt(St),wt(nn),wt(se)}function un(s){var r=s.memoizedState;r!==null&&(Yl._currentValue=r.memoizedState,Xe(je,s)),r=St.current;var c=yy(r,s.type);r!==c&&(Xe(nn,s),Xe(St,c))}function ce(s){nn.current===s&&(wt(St),wt(nn)),je.current===s&&(wt(je),Yl._currentValue=Ut)}var be,Y;function me(s){if(be===void 0)try{throw Error()}catch(c){var r=c.stack.trim().match(/\n( *(at )?)/);be=r&&r[1]||"",Y=-1<c.stack.indexOf(`
|
|
43
|
-
at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
44
|
-
`+be+s+Y}var Pe=!1;function Ke(s,r){if(!s||Pe)return"";Pe=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(r){var pe=function(){throw Error()};if(Object.defineProperty(pe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(pe,[])}catch(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 x=d.DetermineComponentFrameRoot(),S=x[0],T=x[1];if(S&&T){var $=S.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=c}return(c=s?s.displayName||s.name:"")?me(c):""}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="",c=null;do r+=at(s,c),c=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,Un=e.unstable_requestPaint,sn=e.unstable_now,vr=e.unstable_getCurrentPriorityLevel,Pi=e.unstable_ImmediatePriority,le=e.unstable_UserBlockingPriority,xe=e.unstable_NormalPriority,Se=e.unstable_LowPriority,rt=e.unstable_IdlePriority,It=e.log,wn=e.unstable_setDisableYieldValue,Nn=null,vt=null;function rn(s){if(typeof It=="function"&&wn(s),vt&&typeof vt.setStrictMode=="function")try{vt.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 br=256,ma=262144,ga=4194304;function Xs(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,c){var d=s.pendingLanes;if(d===0)return 0;var p=0,x=s.suspendedLanes,S=s.pingedLanes;s=s.warmLanes;var T=d&134217727;return T!==0?(d=T&~x,d!==0?p=Xs(d):(S&=T,S!==0?p=Xs(S):c||(c=T&~s,c!==0&&(p=Xs(c))))):(T=d&~x,T!==0?p=Xs(T):S!==0?p=Xs(S):c||(c=d&~s,c!==0&&(p=Xs(c)))),p===0?0:r!==0&&r!==p&&(r&x)===0&&(x=p&-p,c=r&-r,x>=c||x===32&&(c&4194048)!==0)?r:p}function yr(s,r){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&r)===0}function Ui(s,r){(r&8)!==0&&(r|=r&32);var c=s.entangledLanes;if(c!==0)for(s=s.entanglements,c&=r;0<c;){var d=31-en(c),p=1<<d;r|=s[d],c&=~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 Fi(s){for(var r=[],c=0;31>c;c++)r.push(s);return r}function pi(s,r){s.pendingLanes|=r,r!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function ol(s,r,c,d,p,x){var S=s.pendingLanes;s.pendingLanes=c,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=c,s.entangledLanes&=c,s.errorRecoveryDisabledLanes&=c,s.shellSuspendCounter=0;var T=s.entanglements,$=s.expirationTimes,ee=s.hiddenUpdates;for(c=S&~c;0<c;){var ae=31-en(c),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)}c&=~pe}d!==0&&xa(s,d,0),x!==0&&p===0&&s.tag!==0&&(s.suspendedLanes|=x&~(S&~r))}function xa(s,r,c){s.pendingLanes|=r,s.suspendedLanes&=~r;var d=31-en(r);s.entangledLanes|=r,s.entanglements[d]=s.entanglements[d]|1073741824|c&261930}function Oo(s,r){var c=s.entangledLanes|=r;for(s=s.entanglements;c;){var d=31-en(c),p=1<<d;p&r|s[d]&r&&(s[d]|=r),c&=~p}}function mi(s,r){var c=r&-r;return c=(c&42)!==0?1:Lo(c),(c&(s.suspendedLanes|r))!==0?0:c}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:s_(s.type))}function rs(s,r){var c=Re.p;try{return Re.p=s,r()}finally{Re.p=c}}var ys=Math.random().toString(36).slice(2),dn="__reactFiber$"+ys,Cn="__reactProps$"+ys,gi="__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 Ii(s){var r;if(r=s[dn])return r;for(var c=s.parentNode;c;){if(r=c[gi]||c[dn]){if(c=r.alternate,r.child!==null||c!==null&&c.child!==null)for(s=$y(s);s!==null;){if(c=s[dn])return c;s=$y(s)}return r}s=c,c=s.parentNode}return null}function xi(s){if(s=s[dn]||s[gi]){var r=s.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return s}return null}function _r(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 Hi(s,r){qi(s,r),qi(s+"Capture",r)}function qi(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 bt=!1;function Pu(){var s=bt;return bt=!1,s}function fl(s,r,c){if(Of(r))if(c===null)s.removeAttribute(r);else{switch(typeof c){case"undefined":case"function":case"symbol":s.removeAttribute(r);return;case"boolean":var d=r.toLowerCase().slice(0,5);if(d!=="data-"&&d!=="aria-"){s.removeAttribute(r);return}}s.setAttribute(r,c)}}function _a(s,r,c){if(c===null)s.removeAttribute(r);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(r);return}s.setAttribute(r,c)}}function Ds(s,r,c,d){if(d===null)s.removeAttribute(c);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(c);return}s.setAttributeNS(r,c,d)}}function Yn(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function Uu(s){var r=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function Fu(s,r,c){var d=Object.getOwnPropertyDescriptor(s.constructor.prototype,r);if(!s.hasOwnProperty(r)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var p=d.get,x=d.set;return Object.defineProperty(s,r,{configurable:!0,get:function(){return p.call(this)},set:function(S){c=""+S,x.call(this,S)}}),Object.defineProperty(s,r,{enumerable:d.enumerable}),{getValue:function(){return c},setValue:function(S){c=""+S},stopTracking:function(){s._valueTracker=null,delete s[r]}}}}function wr(s){if(!s._valueTracker){var r=Uu(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 c=r.getValue(),d="";return s&&(d=Uu(s)?s.checked?"true":"false":s.value),s=d,s!==c?(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,c,d,p,x,S,T){s.name="",S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?s.type=S:s.removeAttribute("type"),r!=null?S==="number"?(r===0&&s.value===""||s.value!=r)&&(s.value=""+Yn(r)):s.value!==""+Yn(r)&&(s.value=""+Yn(r)):S!=="submit"&&S!=="reset"||s.removeAttribute("value"),r!=null?S==="number"&&s.value==r?Uo(s,Yn(s.value)):Uo(s,Yn(r)):c!=null?Uo(s,Yn(c)):d!=null&&s.removeAttribute("value"),p==null&&x!=null&&(s.defaultChecked=!!x),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 Iu(s,r,c,d,p,x,S,T){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(s.type=x),r!=null||c!=null){if(!(x!=="submit"&&x!=="reset"||r!=null)){wr(s);return}c=c!=null?""+Yn(c):"",r=r!=null?""+Yn(r):c,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,S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"&&(s.name=S),wr(s)}function Uo(s,r){s.defaultValue!==""+r&&(s.defaultValue=""+r)}function Sr(s,r,c,d){if(s=s.options,r){r={};for(var p=0;p<c.length;p++)r["$"+c[p]]=!0;for(c=0;c<s.length;c++)p=r.hasOwnProperty("$"+s[c].value),s[c].selected!==p&&(s[c].selected=p),p&&d&&(s[c].defaultSelected=!0)}else{for(c=""+Yn(c),r=null,p=0;p<s.length;p++){if(s[p].value===c){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,c){if(r!=null&&(r=""+Yn(r),r!==s.value&&(s.value=r),c==null)){s.defaultValue!==r&&(s.defaultValue=r);return}s.defaultValue=c!=null?""+Yn(c):""}function Io(s,r,c,d){if(r==null){if(d!=null){if(c!=null)throw Error(i(92));if(ze(d)){if(1<d.length)throw Error(i(93));d=d[0]}c=d}c==null&&(c=""),r=c}c=Yn(r),s.defaultValue=c,d=s.textContent,d===c&&d!==""&&d!==null&&(s.value=d),wr(s)}function Vi(s,r){if(r){var c=s.firstChild;if(c&&c===s.lastChild&&c.nodeType===3){c.nodeValue=r;return}}s.textContent=r}var Q=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function ge(s,r,c){var d=r.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?d?s.setProperty(r,""):r==="float"?s.cssFloat="":s[r]="":d?s.setProperty(r,c):typeof c!="number"||c===0||Q.has(r)?r==="float"?s.cssFloat=c:s[r]=(""+c).trim():s[r]=c+"px"}function it(s,r,c){if(r!=null&&typeof r!="object")throw Error(i(62));if(s=s.style,c!=null){for(var d in c)!c.hasOwnProperty(d)||r!=null&&r.hasOwnProperty(d)||(d.indexOf("--")===0?s.setProperty(d,""):d==="float"?s.cssFloat="":s[d]="",bt=!0);for(var p in r)d=r[p],r.hasOwnProperty(p)&&c[p]!==d&&(ge(s,p,d),bt=!0)}else for(var x in r)r.hasOwnProperty(x)&&ge(s,x,r[x])}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 Qn(){}var kr=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=xi(s);if(r&&(s=r.stateNode)){var c=s[Cn]||null;e:switch(s=r.stateNode,r.type){case"input":if(Po(s,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),r=c.name,c.type==="radio"&&r!=null){for(c=s;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+ls(""+r)+'"][type="radio"]'),r=0;r<c.length;r++){var d=c[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<c.length;r++)d=c[r],d.form===s.form&&Bo(d)}break e;case"textarea":Fo(s,c.value,c.defaultValue);break e;case"select":r=c.value,r!=null&&Sr(s,!!c.multiple,r,!1)}}}var jr=!1;function Ss(s,r,c){if(jr)return s(r,c);jr=!0;try{var d=s(r);return d}finally{if(jr=!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 Nr(s,r){var c=s.stateNode;if(c===null)return null;var d=c[Cn]||null;if(d===null)return null;c=d[r];e:switch(r){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(d=!d.disabled)||(s=s.type,d=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!d;break e;default:s=!1}if(s)return null;if(c&&typeof c!="function")throw Error(i(231,r,typeof c));return c}var 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,c=r.length,d,p="value"in ei?ei.value:ei.textContent,x=p.length;for(s=0;s<c&&r[s]===p[s];s++);var S=c-s;for(d=1;d<=S&&r[c-d]===p[x-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 gv(){return!1}function Xn(s){function r(c,d,p,x,S){this._reactName=c,this._targetInst=p,this.type=d,this.nativeEvent=x,this.target=S,this.currentTarget=null;for(var T in s)s.hasOwnProperty(T)&&(c=s[T],this[T]=c?c(x):x[T]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?qu:gv,this.isPropagationStopped=gv,this}return F(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=qu)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=qu)},persist:function(){},isPersistent:qu}),r}var Cr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Vu=Xn(Cr),Go=F({},Cr,{view:0,detail:0}),ZN=Xn(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}}),xv=Xn(Gu),JN=F({},Gu,{dataTransfer:0}),eC=Xn(JN),tC=F({},Go,{relatedTarget:0}),$f=Xn(tC),nC=F({},Cr,{animationName:0,elapsedTime:0,pseudoElement:0}),sC=Xn(nC),iC=F({},Cr,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),rC=Xn(iC),aC=F({},Cr,{data:0}),vv=Xn(aC),lC={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},oC={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"},cC={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function uC(s){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(s):(s=cC[s])?!!r[s]:!1}function Bf(){return uC}var dC=F({},Go,{key:function(s){if(s.key){var r=lC[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"?oC[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}}),hC=Xn(dC),fC=F({},Gu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),bv=Xn(fC),pC=F({},Cr,{submitter:0}),mC=Xn(pC),gC=F({},Go,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Bf}),xC=Xn(gC),vC=F({},Cr,{propertyName:0,elapsedTime:0,pseudoElement:0}),bC=Xn(vC),yC=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}),_C=Xn(yC),wC=F({},Cr,{newState:0,oldState:0,source:0}),SC=Xn(wC),kC=[9,13,27,32],Pf=Js&&"CompositionEvent"in window,Qo=null;Js&&"documentMode"in document&&(Qo=document.documentMode);var jC=Js&&"TextEvent"in window&&!Qo,yv=Js&&(!Pf||Qo&&8<Qo&&11>=Qo),_v=" ",wv=!1;function Sv(s,r){switch(s){case"keyup":return kC.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function kv(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var ml=!1;function NC(s,r){switch(s){case"compositionend":return kv(r);case"keypress":return r.which!==32?null:(wv=!0,_v);case"textInput":return s=r.data,s===_v&&wv?null:s;default:return null}}function CC(s,r){if(ml)return s==="compositionend"||!Pf&&Sv(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 yv&&r.locale!=="ko"?null:r.data;default:return null}}var EC={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 jv(s){var r=s&&s.nodeName&&s.nodeName.toLowerCase();return r==="input"?!!EC[s.type]:r==="textarea"}function Nv(s,r,c,d){ws?Zs?Zs.push(d):Zs=[d]:ws=d,r=Yd(r,"onChange"),0<r.length&&(c=new Vu("onChange","change",null,c,d),s.push({event:c,listeners:r}))}var Xo=null,Wo=null;function TC(s){fy(s,0)}function Yu(s){var r=_r(s);if(Bo(r))return s}function Cv(s,r){if(s==="change")return r}var Ev=!1;if(Js){var Uf;if(Js){var Ff="oninput"in document;if(!Ff){var Tv=document.createElement("div");Tv.setAttribute("oninput","return;"),Ff=typeof Tv.oninput=="function"}Uf=Ff}else Uf=!1;Ev=Uf&&(!document.documentMode||9<document.documentMode)}function Av(){Xo&&(Xo.detachEvent("onpropertychange",Mv),Wo=Xo=null)}function Mv(s){if(s.propertyName==="value"&&Yu(Wo)){var r=[];Nv(r,Wo,s,pl(s)),Ss(TC,r)}}function AC(s,r,c){s==="focusin"?(Av(),Xo=r,Wo=c,Xo.attachEvent("onpropertychange",Mv)):s==="focusout"&&Av()}function MC(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return Yu(Wo)}function RC(s,r){if(s==="click")return Yu(r)}function OC(s,r){if(s==="input"||s==="change")return Yu(r)}function LC(s,r){return s===r&&(s!==0||1/s===1/r)||s!==s&&r!==r}var js=typeof Object.is=="function"?Object.is:LC;function Ko(s,r){if(js(s,r))return!0;if(typeof s!="object"||s===null||typeof r!="object"||r===null)return!1;var c=Object.keys(s),d=Object.keys(r);if(c.length!==d.length)return!1;for(d=0;d<c.length;d++){var p=c[d];if(!fn.call(r,p)||!js(s[p],r[p]))return!1}return!0}function If(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 Rv(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function Ov(s,r){var c=Rv(s);s=0;for(var d;c;){if(c.nodeType===3){if(d=s+c.textContent.length,s<=r&&d>=r)return{node:c,offset:r-s};s=d}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=Rv(c)}}function Lv(s,r){return s&&r?s===r?!0:s&&s.nodeType===3?!1:r&&r.nodeType===3?Lv(s,r.parentNode):"contains"in s?s.contains(r):s.compareDocumentPosition?!!(s.compareDocumentPosition(r)&16):!1:!1}function Dv(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var r=If(s.document);r instanceof s.HTMLIFrameElement;){try{var c=typeof r.contentWindow.location.href=="string"}catch{c=!1}if(c)s=r.contentWindow;else break;r=If(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 DC=Js&&"documentMode"in document&&11>=document.documentMode,gl=null,qf=null,Zo=null,Vf=!1;function zv(s,r,c){var d=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;Vf||gl==null||gl!==If(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,c),s.push({event:r,listeners:d}),r.target=gl)))}function ka(s,r){var c={};return c[s.toLowerCase()]=r.toLowerCase(),c["Webkit"+s]="webkit"+r,c["Moz"+s]="moz"+r,c}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={},$v={};Js&&($v=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],c;for(c in r)if(r.hasOwnProperty(c)&&c in $v)return Gf[s]=r[c];return s}var Bv=ja("animationend"),Pv=ja("animationiteration"),Uv=ja("animationstart"),zC=ja("transitionrun"),$C=ja("transitionstart"),BC=ja("transitioncancel"),Fv=ja("transitionend"),Iv=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){Iv.set(s,r),Hi(r,[s])}var PC=0;function Gi(s,r){if(s.name!=null&&s.name!=="auto")return s.name;if(r.autoName!==null)return r.autoName;s=ri.identifierPrefix;var c=PC++;return s="_"+s+"t_"+c.toString(32)+"_",r.autoName=s}function Hv(s){if(s==null||typeof s=="string")return s;var r=null,c=$l;if(c!==null)for(var d=0;d<c.length;d++){var p=s[c[d]];if(p!=null){if(p==="none")return"none";r=r==null?p:r+(" "+p)}}return r??s.default}function Yi(s,r){return s=Hv(s),r=Hv(r),r==null?s==="auto"?null:s:r==="auto"?null:r}var Qu=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,Qf=0;function Xu(){for(var s=vl,r=Qf=vl=0;r<s;){var c=zs[r];zs[r++]=null;var d=zs[r];zs[r++]=null;var p=zs[r];zs[r++]=null;var x=zs[r];if(zs[r++]=null,d!==null&&p!==null){var S=d.pending;S===null?p.next=p:(p.next=S.next,S.next=p),d.pending=p}x!==0&&qv(c,p,x)}}function Wu(s,r,c,d){zs[vl++]=s,zs[vl++]=r,zs[vl++]=c,zs[vl++]=d,Qf|=d,s.lanes|=d,s=s.alternate,s!==null&&(s.lanes|=d)}function Xf(s,r,c,d){return Wu(s,r,c,d),Ku(s)}function Na(s,r){return Wu(s,null,null,r),Ku(s)}function qv(s,r,c){s.lanes|=c;var d=s.alternate;d!==null&&(d.lanes|=c);for(var p=!1,x=s.return;x!==null;)x.childLanes|=c,d=x.alternate,d!==null&&(d.childLanes|=c),x.tag===22&&(s=x.stateNode,s===null||s._visibility&1||(p=!0)),s=x,x=x.return;return s.tag===3?(x=s.stateNode,p&&r!==null&&(p=31-en(c),s=x.hiddenUpdates,d=s[p],d===null?s[p]=[r]:d.push(r),r.lane=c|536870912),x):null}function Ku(s){if(50<yc)throw yc=0,Ud=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 UC(s,r,c,d){this.tag=s,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=r,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function os(s,r,c,d){return new UC(s,r,c,d)}function Wf(s){return s=s.prototype,!(!s||!s.isReactComponent)}function Qi(s,r){var c=s.alternate;return c===null?(c=os(s.tag,r,s.key,s.mode),c.elementType=s.elementType,c.type=s.type,c.stateNode=s.stateNode,c.alternate=s,s.alternate=c):(c.pendingProps=r,c.type=s.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=s.flags&1206910976,c.childLanes=s.childLanes,c.lanes=s.lanes,c.child=s.child,c.memoizedProps=s.memoizedProps,c.memoizedState=s.memoizedState,c.updateQueue=s.updateQueue,r=s.dependencies,c.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},c.sibling=s.sibling,c.index=s.index,c.ref=s.ref,c.refCleanup=s.refCleanup,c}function Vv(s,r){s.flags&=1206910978;var c=s.alternate;return c===null?(s.childLanes=0,s.lanes=r,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=c.childLanes,s.lanes=c.lanes,s.child=c.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=c.memoizedProps,s.memoizedState=c.memoizedState,s.updateQueue=c.updateQueue,s.type=c.type,r=c.dependencies,s.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),s}function Zu(s,r,c,d,p,x){var S=0;if(d=s,typeof d=="function")Wf(d)&&(S=1);else if(typeof d=="string")S=pE(s,c,St.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(d){case Ee:return s=os(31,c,r,p),s.elementType=Ee,s.lanes=x,s;case G:return Ca(c.children,p,x,r);case O:S=8,p|=24;break;case de:return s=os(12,c,r,p|2),s.elementType=de,s.lanes=x,s;case I:return s=os(13,c,r,p),s.elementType=I,s.lanes=x,s;case re:return s=os(19,c,r,p),s.elementType=re,s.lanes=x,s;case Me:case P:return s=p|32,s=os(30,c,r,s),s.elementType=P,s.lanes=x,s.stateNode={autoName:null,paired:null,clones:null,ref:null},s;default:if(typeof d=="object"&&d!==null)switch(d.$$typeof){case q:S=10;break e;case W:S=9;break e;case H:S=11;break e;case ve:S=14;break e;case A:S=16,d=null;break e}S=29,c=Error(i(130,s===null?"null":typeof s,"")),d=null}return r=os(S,c,r,p),r.elementType=s,r.type=d,r.lanes=x,r}function Ca(s,r,c,d){return s=os(7,s,d,r),s.lanes=c,s}function Kf(s,r,c){return s=os(6,s,null,r),s.lanes=c,s}function Gv(s){var r=os(18,null,null,0);return r.stateNode=s,r}function Zf(s,r,c){return r=os(4,s.children!==null?s.children:[],s.key,r),r.lanes=c,r.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},r}var Yv=new WeakMap;function $s(s,r){if(typeof s=="object"&&s!==null){var c=Yv.get(s);return c!==void 0?c:(r={value:s,source:r,stack:ht(r)},Yv.set(s,r),r)}return{value:s,source:r,stack:ht(r)}}var yl=[],_l=0,Ju=null,Jo=0,Bs=[],Ps=0,Er=null,vi=1,bi="";function Xi(s,r){yl[_l++]=Jo,yl[_l++]=Ju,Ju=s,Jo=r}function Qv(s,r,c){Bs[Ps++]=vi,Bs[Ps++]=bi,Bs[Ps++]=Er,Er=s;var d=vi;s=bi;var p=32-en(d)-1;d&=~(1<<p),c+=1;var x=32-en(r)+p;if(30<x){var S=p-p%5;x=(d&(1<<S)-1).toString(32),d>>=S,p-=S,vi=1<<32-en(r)+p|c<<p|d,bi=x+s}else vi=1<<x|c<<p|d,bi=s}function ed(s){s.return!==null&&(Xi(s,1),Qv(s,1,0))}function Jf(s){for(;s===Ju;)Ju=yl[--_l],yl[_l]=null,Jo=yl[--_l],yl[_l]=null;for(;s===Er;)Er=Bs[--Ps],Bs[Ps]=null,bi=Bs[--Ps],Bs[Ps]=null,vi=Bs[--Ps],Bs[Ps]=null}function Xv(s,r){Bs[Ps++]=vi,Bs[Ps++]=bi,Bs[Ps++]=Er,vi=r.id,bi=r.overflow,Er=s}var En=null,Ht=null,lt=!1,Tr=null,Us=!1,ep=Error(i(519));function Ar(s){var r=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ec($s(r,s)),ep}function Wv(s){var r=s.stateNode,c=s.type,d=s.memoizedProps;switch(r[dn]=s,r[Cn]=d,c){case"dialog":dt("cancel",r),dt("close",r);break;case"iframe":case"object":case"embed":dt("load",r);break;case"video":case"audio":for(c=0;c<wc.length;c++)dt(wc[c],r);break;case"source":dt("error",r);break;case"img":case"image":case"link":dt("error",r),dt("load",r);break;case"details":dt("toggle",r);break;case"input":dt("invalid",r),Iu(r,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":dt("invalid",r);break;case"textarea":dt("invalid",r),Io(r,d.value,d.defaultValue,d.children)}c=d.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||r.textContent===""+c||d.suppressHydrationWarning===!0||xy(r.textContent,c)?(d.popover!=null&&(dt("beforetoggle",r),dt("toggle",r)),d.onScroll!=null&&dt("scroll",r),d.onScrollEnd!=null&&dt("scrollend",r),d.onClick!=null&&(r.onclick=Qn),r=!0):r=!1,r||Ar(s,!0)}function td(s){for(En=s.return;En;)switch(En.tag){case 5:case 31:case 13:Us=!1;return;case 27:case 3:Us=!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,c;if((c=r!==3&&r!==27)&&((c=r===5)&&(c=s.type,c=!(c!=="form"&&c!=="button")||Am(s.type,s.memoizedProps)),c=!c),c&&Ht&&Ar(s),td(s),r===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(317));Ht=zy(s)}else if(r===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(317));Ht=zy(s)}else r===27?(r=Ht,Gr(s.type)?(s=Pm,Pm=null,Ht=s):Ht=r):Ht=En?Is(s.stateNode.nextSibling):null;return!0}function Ea(){Ht=En=null,lt=!1}function tp(){var s=Tr;return s!==null&&(ds===null?ds=s:ds.push.apply(ds,s),Tr=null),s}function ec(s){Tr===null?Tr=[s]:Tr.push(s)}var np=jt(null),Ta=null,Wi=null;function Mr(s,r,c){Xe(np,r._currentValue),r._currentValue=c}function Ki(s){s._currentValue=np.current,wt(np)}function nd(s,r,c){for(;s!==null;){var d=s.alternate;if((s.childLanes&r)!==r?(s.childLanes|=r,d!==null&&(d.childLanes|=r)):d!==null&&(d.childLanes&r)!==r&&(d.childLanes|=r),s===c)break;s=s.return}}function sp(s,r,c,d){var p=s.child;for(p!==null&&(p.return=s);p!==null;){var x=p.dependencies;if(x!==null){var S=p.child;x=x.firstContext;e:for(;x!==null;){var T=x;x=p;for(var $=0;$<r.length;$++)if(T.context===r[$]){x.lanes|=c,T=x.alternate,T!==null&&(T.lanes|=c),nd(x.return,c,s),d||(S=null);break e}x=T.next}}else if(p.tag===18){if(S=p.return,S===null)throw Error(i(341));S.lanes|=c,x=S.alternate,x!==null&&(x.lanes|=c),nd(S,c,s),S=null}else p.tag===13&&p.memoizedState!==null&&p.memoizedState.dehydrated===null?(p.lanes|=c,S=p.alternate,S!==null&&(S.lanes|=c),nd(p.return,c,s),S=p.child,S=S!==null?S.sibling:null):S=p.child;if(S!==null)S.return=p;else for(S=p;S!==null;){if(S===s){S=null;break}if(p=S.sibling,p!==null){p.return=S.return,S=p;break}S=S.return}p=S}}function Aa(s,r,c,d){s=null;for(var p=r,x=!1;p!==null;){if(!x){if((p.flags&524288)!==0)x=!0;else if((p.flags&262144)!==0)break}if(p.tag===10){var S=p.alternate;if(S===null)throw Error(i(387));if(S=S.memoizedProps,S!==null){var T=p.type;js(p.pendingProps.value,S.value)||(s!==null?s.push(T):s=[T])}}else if(p===je.current){if(S=p.alternate,S===null)throw Error(i(387));S.memoizedState.memoizedState!==p.memoizedState.memoizedState&&(s!==null?s.push(Yl):s=[Yl])}p=p.return}return s!==null&&sp(r,s,c,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,Wi=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function On(s){return Kv(Ta,s)}function id(s,r){return Ta===null&&Ma(s),Kv(s,r)}function Kv(s,r){var c=r._currentValue;if(r={context:r,memoizedValue:c,next:null},Wi===null){if(s===null)throw Error(i(308));Wi=r,s.dependencies={lanes:0,firstContext:r},s.flags|=524288}else Wi=Wi.next=r;return c}var FC=typeof AbortController<"u"?AbortController:function(){var s=[],r=this.signal={aborted:!1,addEventListener:function(c,d){s.push(d)}};this.abort=function(){r.aborted=!0,s.forEach(function(c){return c()})}},IC=e.unstable_scheduleCallback,HC=e.unstable_NormalPriority,pn={$$typeof:q,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ip(){return{controller:new FC,data:new Map,refCount:0}}function tc(s){s.refCount--,s.refCount===0&&IC(HC,function(){s.controller.abort()})}function Zv(s,r){if((s.pendingLanes&4194048)!==0){var c=s.transitionTypes;for(c===null&&(c=s.transitionTypes=[]),s=0;s<r.length;s++){var d=r[s];c.indexOf(d)===-1&&c.push(d)}}}var nc=null;function qC(s){var r=s.transitionTypes;return s.transitionTypes=null,r}var sc=null,rp=0,Ra=0,Sl=null;function VC(s,r){if(sc===null){var c=sc=[];rp=0,Ra=_m(),Sl={status:"pending",value:void 0,then:function(d){c.push(d)}}}return rp++,r.then(Jv,Jv),r}function Jv(){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 GC(s,r){var c=[],d={status:"pending",value:null,reason:null,then:function(p){c.push(p)}};return s.then(function(){d.status="fulfilled",d.value=r;for(var p=0;p<c.length;p++)(0,c[p])(r)},function(p){for(d.status="rejected",d.reason=p,p=0;p<c.length;p++)(0,c[p])(void 0)}),d}var e1=Ce.S;Ce.S=function(s,r){if(Gb=sn(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&VC(s,r),nc!==null)for(var c=Fl;c!==null;)Zv(c,nc),c=c.next;if(c=s.types,c!==null){for(var d=Fl;d!==null;)Zv(d,c),d=d.next;if(Ra!==0){d=nc,d===null&&(d=nc=[]);for(var p=0;p<c.length;p++){var x=c[p];d.indexOf(x)===-1&&d.push(x)}}}e1!==null&&e1(s,r)};var Oa=jt(null);function ap(){var s=Oa.current;return s!==null?s:zt.pooledCache}function rd(s,r){r===null?Xe(Oa,Oa.current):Xe(Oa,r.pool)}function t1(){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 n1(s){return s=s.status,s==="fulfilled"||s==="rejected"}function s1(s,r,c){switch(c=s[c],c===void 0?s.push(r):c!==r&&(r.then(Qn,Qn),r=c),r.status){case"fulfilled":return r.value;case"rejected":throw s=r.reason,r1(s),s===void 0&&!("reason"in r)?Error(i(600)):s;default:if(typeof r.status=="string")r.then(Qn,Qn);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,r1(s),s}throw Da=r,kl}}function La(s){try{var r=s._init;return r(s._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(Da=c,kl):c}}var Da=null;function i1(){if(Da===null)throw Error(i(459));var s=Da;return Da=null,s}function r1(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=[]),s1(jl,s,r)}function Rr(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 a1(s){function r(J,V){if(s){var ne=J.deletions;ne===null?(J.deletions=[V],J.flags|=16):ne.push(V)}}function c(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=Qi(J,V),J.index=0,J.sibling=null,J}function x(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 S(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===G?(J=ae(J,V,ne.props.children,fe,ne.key),Rr(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),Rr(V,ne),V.return=J,V):(V=Zu(ne.type,ne.key,ne.props,null,J.mode,fe),Rr(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 X:return ne=Zu(V.type,V.key,V.props,null,J.mode,ne),Rr(ne,V),ne.return=J,ne;case U:return V=Zf(V,J.mode,ne),V.return=J,V;case A:return V=La(V),pe(J,V,ne)}if(ze(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 X:return ne.key===Oe?$(J,V,ne,fe):null;case U:return ne.key===Oe?ee(J,V,ne,fe):null;case A:return ne=La(ne),Z(J,V,ne,fe)}if(ze(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 X:return J=J.get(fe.key===null?ne:fe.key)||null,$(V,J,fe,Oe);case U: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(ze(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,Ie=V,Ye=V=0,xn=null;Ie!==null&&Ye<ne.length;Ye++){Ie.index>Ye?(xn=Ie,Ie=null):xn=Ie.sibling;var yt=Z(J,Ie,ne[Ye],fe);if(yt===null){Ie===null&&(Ie=xn);break}s&&Ie&&yt.alternate===null&&r(J,Ie),V=x(yt,V,Ye),pt===null?Oe=yt:pt.sibling=yt,pt=yt,Ie=xn}if(Ye===ne.length)return c(J,Ie),lt&&Xi(J,Ye),Oe;if(Ie===null){for(;Ye<ne.length;Ye++)Ie=pe(J,ne[Ye],fe),Ie!==null&&(V=x(Ie,V,Ye),pt===null?Oe=Ie:pt.sibling=Ie,pt=Ie);return lt&&Xi(J,Ye),Oe}for(Ie=d(Ie);Ye<ne.length;Ye++)xn=ie(Ie,J,Ye,ne[Ye],fe),xn!==null&&(s&&(yt=xn.alternate,yt!==null&&Ie.delete(yt.key===null?Ye:yt.key)),V=x(xn,V,Ye),pt===null?Oe=xn:pt.sibling=xn,pt=xn);return s&&Ie.forEach(function(Kr){return r(J,Kr)}),lt&&Xi(J,Ye),Oe}function Be(J,V,ne,fe){if(ne==null)throw Error(i(151));for(var Oe=null,pt=null,Ie=V,Ye=V=0,xn=null,yt=ne.next();Ie!==null&&!yt.done;Ye++,yt=ne.next()){Ie.index>Ye?(xn=Ie,Ie=null):xn=Ie.sibling;var Kr=Z(J,Ie,yt.value,fe);if(Kr===null){Ie===null&&(Ie=xn);break}s&&Ie&&Kr.alternate===null&&r(J,Ie),V=x(Kr,V,Ye),pt===null?Oe=Kr:pt.sibling=Kr,pt=Kr,Ie=xn}if(yt.done)return c(J,Ie),lt&&Xi(J,Ye),Oe;if(Ie===null){for(;!yt.done;Ye++,yt=ne.next())yt=pe(J,yt.value,fe),yt!==null&&(V=x(yt,V,Ye),pt===null?Oe=yt:pt.sibling=yt,pt=yt);return lt&&Xi(J,Ye),Oe}for(Ie=d(Ie);!yt.done;Ye++,yt=ne.next())yt=ie(Ie,J,Ye,yt.value,fe),yt!==null&&(s&&(xn=yt.alternate,xn!==null&&Ie.delete(xn.key===null?Ye:xn.key)),V=x(yt,V,Ye),pt===null?Oe=yt:pt.sibling=yt,pt=yt);return s&&Ie.forEach(function(NE){return r(J,NE)}),lt&&Xi(J,Ye),Oe}function nt(J,V,ne,fe){if(typeof ne=="object"&&ne!==null&&ne.type===G&&ne.key===null&&ne.props.ref===void 0&&(ne=ne.props.children),typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case X:e:{for(var Oe=ne.key;V!==null;){if(V.key===Oe){if(Oe=ne.type,Oe===G){if(V.tag===7){c(J,V.sibling),fe=p(V,ne.props.children),Rr(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){c(J,V.sibling),fe=p(V,ne.props),Rr(fe,ne),fe.return=J,J=fe;break e}c(J,V);break}else r(J,V);V=V.sibling}ne.type===G?(fe=Ca(ne.props.children,J.mode,fe,ne.key),Rr(fe,ne),fe.return=J,J=fe):(fe=Zu(ne.type,ne.key,ne.props,null,J.mode,fe),Rr(fe,ne),fe.return=J,J=fe)}return S(J);case U: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){c(J,V.sibling),fe=p(V,ne.children||[]),fe.return=J,J=fe;break e}else{c(J,V);break}else r(J,V);V=V.sibling}fe=Zf(ne,J.mode,fe),fe.return=J,J=fe}return S(J);case A:return ne=La(ne),nt(J,V,ne,fe)}if(ze(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?(c(J,V.sibling),fe=p(V,ne),fe.return=J,J=fe):(c(J,V),fe=Kf(ne,J.mode,fe),fe.return=J,J=fe),S(J)):c(J,V)}return function(J,V,ne,fe){try{ic=0;var Oe=nt(J,V,ne,fe);return jl=null,Oe}catch(Ie){if(Ie===kl||Ie===ad)throw Ie;var pt=os(29,Ie,null,J.mode);return pt.lanes=fe,pt.return=J,pt}finally{}}}var za=a1(!0),l1=a1(!1),Or=!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 Lr(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function Dr(s,r,c){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),qv(s,null,c),r}return Wu(s,d,r,c),Ku(s)}function rc(s,r,c){if(r=r.updateQueue,r!==null&&(r=r.shared,(c&4194048)!==0)){var d=r.lanes;d&=s.pendingLanes,c|=d,r.lanes=c,Oo(s,c)}}function up(s,r){var c=s.updateQueue,d=s.alternate;if(d!==null&&(d=d.updateQueue,c===d)){var p=null,x=null;if(c=c.firstBaseUpdate,c!==null){do{var S={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};x===null?p=x=S:x=x.next=S,c=c.next}while(c!==null);x===null?p=x=r:x=x.next=r}else p=x=r;c={baseState:d.baseState,firstBaseUpdate:p,lastBaseUpdate:x,shared:d.shared,callbacks:d.callbacks},s.updateQueue=c;return}s=c.lastBaseUpdate,s===null?c.firstBaseUpdate=r:s.next=r,c.lastBaseUpdate=r}var dp=!1;function ac(){if(dp){var s=Sl;if(s!==null)throw s}}function lc(s,r,c,d){dp=!1;var p=s.updateQueue;Or=!1;var x=p.firstBaseUpdate,S=p.lastBaseUpdate,T=p.shared.pending;if(T!==null){p.shared.pending=null;var $=T,ee=$.next;$.next=null,S===null?x=ee:S.next=ee,S=$;var ae=s.alternate;ae!==null&&(ae=ae.updateQueue,T=ae.lastBaseUpdate,T!==S&&(T===null?ae.firstBaseUpdate=ee:T.next=ee,ae.lastBaseUpdate=$))}if(x!==null){var pe=p.baseState;S=0,ae=ee=$=null,T=x;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=c;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:Or=!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,S|=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,x===null&&(p.shared.lanes=0),Ir|=S,s.lanes=S,s.memoizedState=pe}}function o1(s,r){if(typeof s!="function")throw Error(i(191,s));s.call(r)}function c1(s,r){var c=s.callbacks;if(c!==null)for(s.callbacks=null,s=0;s<c.length;s++)o1(c[s],r)}var zr=jt(null),ud=jt(0);function u1(s,r){s=nr,Xe(ud,s),Xe(zr,r),nr=s|r.baseLanes}function hp(){Xe(ud,nr),Xe(zr,zr.current)}function fp(){nr=ud.current,wt(zr),wt(ud)}var Ln=jt(null),Fn=null;function $r(s){var r=s.alternate;Xe(Dn,Dn.current&1),Xe(Ln,s),Fn===null&&(r===null||zr.current!==null||r.memoizedState!==null)&&(Fn=s)}function pp(s){Xe(Dn,Dn.current),Xe(Ln,s),Fn===null&&(Fn=s)}function d1(s){s.tag===22?(Xe(Dn,Dn.current),Xe(Ln,s),Fn===null&&(Fn=s)):Br()}function Br(){Xe(Dn,Dn.current),Xe(Ln,Ln.current)}function Ns(s){wt(Ln),Fn===s&&(Fn=null),wt(Dn)}var Dn=jt(0);function oc(s,r){Xe(Ln,Ln.current),Xe(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 c=r.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||$m(c)||Bm(c)))return r}else if(r.tag===19&&r.memoizedProps.revealOrder!=="independent"){if((r.flags&128)!==0)return r}else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===s)break;for(;r.sibling===null;){if(r.return===null||r.return===s)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}var Zi=0,tt=null,Lt=null,mn=null,hd=!1,Nl=!1,$a=!1,fd=0,cc=0,Cl=null,YC=0;function on(){throw Error(i(321))}function gp(s,r){if(r===null)return!1;for(var c=0;c<r.length&&c<s.length;c++)if(!js(s[c],r[c]))return!1;return!0}function xp(s,r,c,d,p,x){return Zi=x,tt=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,Ce.H=s===null||s.memoizedState===null?Q1:X1,$a=!1,x=c(d,p),$a=!1,Nl&&(x=f1(r,c,d,p)),h1(s),x}function h1(s){Ce.H=yd;var r=Lt!==null&&Lt.next!==null;if(Zi=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 f1(s,r,c,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 x=s.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}Ce.H=t3,x=r(c,d)}while(Nl);return x}function QC(){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,c){r.updateQueue=s.updateQueue,r.flags&=-2053,s.lanes&=~c}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}Zi=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=s1(Cl,s,r),r=tt,(mn===null?r.memoizedState:mn.next)===null&&(r=r.alternate,Ce.H=r===null||r.memoizedState===null?Q1:X1),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,c=tt.updateQueue;if(c!==null&&(r=c.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}),c===null&&(c=pd(),tt.updateQueue=c),c.memoCache=r,c=r.data[r.index],c===void 0)for(c=r.data[r.index]=Array(s),d=0;d<s;d++)c[d]=z;return r.index++,c}function Ji(s,r){return typeof r=="function"?r(s):r}function gd(s){var r=hn();return wp(r,Lt,s)}function wp(s,r,c){var d=s.queue;if(d===null)throw Error(i(311));d.lastRenderedReducer=c;var p=s.baseQueue,x=d.pending;if(x!==null){if(p!==null){var S=p.next;p.next=x.next,x.next=S}r.baseQueue=p=x,d.pending=null}if(x=s.baseState,p===null)s.memoizedState=x;else{r=p.next;var T=S=null,$=null,ee=r,ae=!1;do{var pe=ee.lane&-536870913;if(pe!==ee.lane?(ft&pe)===pe:(Zi&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((Zi&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,S=x):$=$.next=pe,tt.lanes|=Z,Ir|=Z;pe=ee.action,$a&&c(x,pe),x=ee.hasEagerState?ee.eagerState:c(x,pe)}else Z={lane:pe,revertLane:ee.revertLane,gesture:ee.gesture,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},$===null?(T=$=Z,S=x):$=$.next=Z,tt.lanes|=pe,Ir|=pe;ee=ee.next}while(ee!==null&&ee!==r);if($===null?S=x:$.next=T,!js(x,s.memoizedState)&&(gn=!0,ae&&(c=Sl,c!==null)))throw c;s.memoizedState=x,s.baseState=S,s.baseQueue=$,d.lastRenderedState=x}return p===null&&(d.lanes=0),[s.memoizedState,d.dispatch]}function Sp(s){var r=hn(),c=r.queue;if(c===null)throw Error(i(311));c.lastRenderedReducer=s;var d=c.dispatch,p=c.pending,x=r.memoizedState;if(p!==null){c.pending=null;var S=p=p.next;do x=s(x,S.action),S=S.next;while(S!==p);js(x,r.memoizedState)||(gn=!0),r.memoizedState=x,r.baseQueue===null&&(r.baseState=x),c.lastRenderedState=x}return[x,d]}function p1(s,r,c){var d=tt,p=hn(),x=lt;if(x){if(c===void 0)throw Error(i(407));c=c()}else c=r();var S=!js((Lt||p).memoizedState,c);if(S&&(p.memoizedState=c,gn=!0),p=p.queue,Np(x1.bind(null,d,p,s),[s]),s=p.getSnapshot!==r||S||mn!==null&&(mn.memoizedState.tag&1)!==0,El(s?9:8,{destroy:void 0},g1.bind(null,d,p,c,r),null),s){if(d.flags|=2048,zt===null)throw Error(i(349));x||(Zi&127)!==0||m1(d,r,c)}return c}function m1(s,r,c){s.flags|=16384,s={getSnapshot:r,value:c},r=tt.updateQueue,r===null?(r=pd(),tt.updateQueue=r,r.stores=[s]):(c=r.stores,c===null?r.stores=[s]:c.push(s))}function g1(s,r,c,d){r.value=c,r.getSnapshot=d,v1(r)&&b1(s)}function x1(s,r,c){return c(function(){v1(r)&&b1(s)})}function v1(s){var r=s.getSnapshot;s=s.value;try{var c=r();return!js(s,c)}catch{return!0}}function b1(s){var r=Na(s,2);r!==null&&hs(r,s,2)}function kp(s){var r=Wn();if(typeof s=="function"){var c=s;if(s=c(),$a){rn(!0);try{c()}finally{rn(!1)}}}return r.memoizedState=r.baseState=s,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ji,lastRenderedState:s},r}function y1(s,r,c,d){return s.baseState=c,wp(s,Lt,typeof d=="function"?d:Ji)}function XC(s,r,c,d,p){if(bd(s))throw Error(i(485));if(s=r.action,s!==null){var x={payload:p,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(S){x.listeners.push(S)}};Ce.T!==null?c(!0):x.isTransition=!1,d(x),c=r.pending,c===null?(x.next=r.pending=x,_1(r,x)):(x.next=c.next,r.pending=c.next=x)}}function _1(s,r){var c=r.action,d=r.payload,p=s.state;if(r.isTransition){var x=Ce.T,S={};S.types=x!==null?x.types:null,Ce.T=S;try{var T=c(p,d),$=Ce.S;$!==null&&$(S,T),w1(s,r,T)}catch(ee){jp(s,r,ee)}finally{x!==null&&S.types!==null&&(x.types=S.types),Ce.T=x}}else try{x=c(p,d),w1(s,r,x)}catch(ee){jp(s,r,ee)}}function w1(s,r,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(d){S1(s,r,d)},function(d){return jp(s,r,d)}):S1(s,r,c)}function S1(s,r,c){r.status="fulfilled",r.value=c,k1(r),s.state=c,r=s.pending,r!==null&&(c=r.next,c===r?s.pending=null:(c=c.next,r.next=c,_1(s,c)))}function jp(s,r,c){var d=s.pending;if(s.pending=null,d!==null){d=d.next;do r.status="rejected",r.reason=c,k1(r),r=r.next;while(r!==d)}s.action=null}function k1(s){s=s.listeners;for(var r=0;r<s.length;r++)(0,s[r])()}function j1(s,r){return r}function N1(s,r){if(lt){var c=zt.formState;if(c!==null){e:{var d=tt;if(lt){if(Ht){t:{for(var p=Ht,x=Us;p.nodeType!==8;){if(!x){p=null;break t}if(p=Is(p.nextSibling),p===null){p=null;break t}}x=p.data,p=x==="F!"||x==="F"?p:null}if(p){Ht=Is(p.nextSibling),d=p.data==="F!";break e}}Ar(d)}d=!1}d&&(r=c[0])}}return c=Wn(),c.memoizedState=c.baseState=r,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:j1,lastRenderedState:r},c.queue=d,c=V1.bind(null,tt,d),d.dispatch=c,d=kp(!1),x=Mp.bind(null,tt,!1,d.queue),d=Wn(),p={state:r,dispatch:null,action:s,pending:null},d.queue=p,c=XC.bind(null,tt,p,x,c),p.dispatch=c,d.memoizedState=s,[r,c,!1]}function C1(s){var r=hn();return E1(r,Lt,s)}function E1(s,r,c){if(r=wp(s,r,j1)[0],s=gd(Ji)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var d=uc(r)}catch(S){throw S===kl?ad:S}else d=r;r=hn();var p=r.queue,x=p.dispatch;return c!==r.memoizedState&&(tt.flags|=2048,El(9,{destroy:void 0},WC.bind(null,p,c),null)),[d,x,s]}function WC(s,r){s.action=r}function T1(s){var r=hn(),c=Lt;if(c!==null)return E1(r,c,s);hn(),r=r.memoizedState,c=hn();var d=c.queue.dispatch;return c.memoizedState=s,[r,d,!1]}function El(s,r,c,d){return s={tag:s,create:c,deps:d,inst:r,next:null},r=tt.updateQueue,r===null&&(r=pd(),tt.updateQueue=r),c=r.lastEffect,c===null?r.lastEffect=s.next=s:(d=c.next,c.next=s,s.next=d,r.lastEffect=s),s}function A1(){return hn().memoizedState}function xd(s,r,c,d){var p=Wn();tt.flags|=s,p.memoizedState=El(1|r,{destroy:void 0},c,d===void 0?null:d)}function vd(s,r,c,d){var p=hn();d=d===void 0?null:d;var x=p.memoizedState.inst;Lt!==null&&d!==null&&gp(d,Lt.memoizedState.deps)?p.memoizedState=El(r,x,c,d):(tt.flags|=s,p.memoizedState=El(1|r,x,c,d))}function M1(s,r){xd(8390656,8,s,r)}function Np(s,r){vd(2048,8,s,r)}function KC(s){tt.flags|=4;var r=tt.updateQueue;if(r===null)r=pd(),tt.updateQueue=r,r.events=[s];else{var c=r.events;c===null?r.events=[s]:c.push(s)}}function R1(s){var r=hn().memoizedState;return KC({ref:r,nextImpl:s}),function(){if((Et&2)!==0)throw Error(i(440));return r.impl.apply(void 0,arguments)}}function O1(s,r){return vd(4,2,s,r)}function L1(s,r){return vd(4,4,s,r)}function D1(s,r){if(typeof r=="function"){s=s();var c=r(s);return function(){typeof c=="function"?c():r(null)}}if(r!=null)return s=s(),r.current=s,function(){r.current=null}}function z1(s,r,c){c=c!=null?c.concat([s]):null,vd(4,4,D1.bind(null,r,s),c)}function Cp(){}function $1(s,r){var c=hn();r=r===void 0?null:r;var d=c.memoizedState;return r!==null&&gp(r,d[1])?d[0]:(c.memoizedState=[s,r],s)}function B1(s,r){var c=hn();r=r===void 0?null:r;var d=c.memoizedState;if(r!==null&&gp(r,d[1]))return d[0];if(d=s(),$a){rn(!0);try{s()}finally{rn(!1)}}return c.memoizedState=[d,r],d}function Ep(s,r,c){return c===void 0||(Zi&1073741824)!==0&&(ft&261930)===0?s.memoizedState=r:(s.memoizedState=c,s=Qb(),tt.lanes|=s,Ir|=s,c)}function P1(s,r,c,d){return js(c,r)?c:zr.current!==null?(s=Ep(s,c,d),js(s,r)||(gn=!0),s):(Zi&106)===0||(Zi&1073741824)!==0&&(ft&261930)===0?(gn=!0,s.memoizedState=c):(s=Qb(),tt.lanes|=s,Ir|=s,r)}function U1(s,r,c,d,p){var x=Re.p;Re.p=x!==0&&8>x?x:8;var S=Ce.T,T={};T.types=S!==null?S.types:null,Ce.T=T,Mp(s,!1,r,c);try{var $=p(),ee=Ce.S;if(ee!==null&&ee(T,$),$!==null&&typeof $=="object"&&typeof $.then=="function"){var ae=GC($,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=x,S!==null&&T.types!==null&&(S.types=T.types),Ce.T=S}}function ZC(){}function Tp(s,r,c,d){if(s.tag!==5)throw Error(i(476));var p=F1(s).queue;U1(s,p,r,Ut,c===null?ZC:function(){return I1(s),c(d)})}function F1(s){var r=s.memoizedState;if(r!==null)return r;r={memoizedState:Ut,baseState:Ut,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ji,lastRenderedState:Ut},next:null};var c={};return r.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ji,lastRenderedState:c},next:null},s.memoizedState=r,s=s.alternate,s!==null&&(s.memoizedState=r),r}function I1(s){var r=F1(s);r.next===null&&(r=s.alternate.memoizedState),dc(s,r.next.queue,{},As())}function Ap(){return On(Yl)}function H1(){return hn().memoizedState}function q1(){return hn().memoizedState}function JC(s){for(var r=s.return;r!==null;){switch(r.tag){case 24:case 3:var c=As();s=Lr(c);var d=Dr(r,s,c);d!==null&&(hs(d,r,c),rc(d,r,c)),r={cache:ip()},s.payload=r;return}r=r.return}}function e3(s,r,c){var d=As();c={lane:d,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},bd(s)?G1(r,c):(c=Xf(s,r,c,d),c!==null&&(hs(c,s,d),Y1(c,r,d)))}function V1(s,r,c){var d=As();dc(s,r,c,d)}function dc(s,r,c,d){var p={lane:d,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(bd(s))G1(r,p);else{var x=s.alternate;if(s.lanes===0&&(x===null||x.lanes===0)&&(x=r.lastRenderedReducer,x!==null))try{var S=r.lastRenderedState,T=x(S,c);if(p.hasEagerState=!0,p.eagerState=T,js(T,S))return Wu(s,r,p,0),zt===null&&Xu(),!1}catch{}finally{}if(c=Xf(s,r,p,d),c!==null)return hs(c,s,d),Y1(c,r,d),!0}return!1}function Mp(s,r,c,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=Xf(s,c,d,2),r!==null&&hs(r,s,2)}function bd(s){var r=s.alternate;return s===tt||r!==null&&r===tt}function G1(s,r){Nl=hd=!0;var c=s.pending;c===null?r.next=r:(r.next=c.next,c.next=r),s.pending=r}function Y1(s,r,c){if((c&4194048)!==0){var d=r.lanes;d&=s.pendingLanes,c|=d,r.lanes=c,Oo(s,c)}}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},Q1={readContext:On,use:md,useCallback:function(s,r){return Wn().memoizedState=[s,r===void 0?null:r],s},useContext:On,useEffect:M1,useImperativeHandle:function(s,r,c){c=c!=null?c.concat([s]):null,xd(4194308,4,D1.bind(null,r,s),c)},useLayoutEffect:function(s,r){return xd(4194308,4,s,r)},useInsertionEffect:function(s,r){xd(4,2,s,r)},useMemo:function(s,r){var c=Wn();r=r===void 0?null:r;var d=s();if($a){rn(!0);try{s()}finally{rn(!1)}}return c.memoizedState=[d,r],d},useReducer:function(s,r,c){var d=Wn();if(c!==void 0){var p=c(r);if($a){rn(!0);try{c(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=e3.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,c=V1.bind(null,tt,r);return r.dispatch=c,[s.memoizedState,c]},useDebugValue:Cp,useDeferredValue:function(s,r){var c=Wn();return Ep(c,s,r)},useTransition:function(){var s=kp(!1);return s=U1.bind(null,tt,s.queue,!0,!1),Wn().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,r,c){var d=tt,p=Wn();if(lt){if(c===void 0)throw Error(i(407));c=c()}else{if(c=r(),zt===null)throw Error(i(349));(ft&127)!==0||m1(d,r,c)}p.memoizedState=c;var x={value:c,getSnapshot:r};return p.queue=x,M1(x1.bind(null,d,x,s),[s]),d.flags|=2048,El(9,{destroy:void 0},g1.bind(null,d,x,c,r),null),c},useId:function(){var s=Wn(),r=zt.identifierPrefix;if(lt){var c=bi,d=vi;c=(d&~(1<<32-en(d)-1)).toString(32)+c,r="_"+r+"R_"+c,c=fd++,0<c&&(r+="H"+c.toString(32)),r+="_"}else c=YC++,r="_"+r+"r_"+c.toString(32)+"_";return s.memoizedState=r},useHostTransitionStatus:Ap,useFormState:N1,useActionState:N1,useOptimistic:function(s){var r=Wn();r.memoizedState=r.baseState=s;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=c,r=Mp.bind(null,tt,!0,c),c.dispatch=r,[s,r]},useMemoCache:_p,useCacheRefresh:function(){return Wn().memoizedState=JC.bind(null,tt)},useEffectEvent:function(s){var r=Wn(),c={impl:s};return r.memoizedState=c,function(){if((Et&2)!==0)throw Error(i(440));return c.impl.apply(void 0,arguments)}}},X1={readContext:On,use:md,useCallback:$1,useContext:On,useEffect:Np,useImperativeHandle:z1,useInsertionEffect:O1,useLayoutEffect:L1,useMemo:B1,useReducer:gd,useRef:A1,useState:function(){return gd(Ji)},useDebugValue:Cp,useDeferredValue:function(s,r){var c=hn();return P1(c,Lt.memoizedState,s,r)},useTransition:function(){var s=gd(Ji)[0],r=hn().memoizedState;return[typeof s=="boolean"?s:uc(s),r]},useSyncExternalStore:p1,useId:H1,useHostTransitionStatus:Ap,useFormState:C1,useActionState:C1,useOptimistic:function(s,r){var c=hn();return y1(c,Lt,s,r)},useMemoCache:_p,useCacheRefresh:q1,useEffectEvent:R1},t3={readContext:On,use:md,useCallback:$1,useContext:On,useEffect:Np,useImperativeHandle:z1,useInsertionEffect:O1,useLayoutEffect:L1,useMemo:B1,useReducer:Sp,useRef:A1,useState:function(){return Sp(Ji)},useDebugValue:Cp,useDeferredValue:function(s,r){var c=hn();return Lt===null?Ep(c,s,r):P1(c,Lt.memoizedState,s,r)},useTransition:function(){var s=Sp(Ji)[0],r=hn().memoizedState;return[typeof s=="boolean"?s:uc(s),r]},useSyncExternalStore:p1,useId:H1,useHostTransitionStatus:Ap,useFormState:T1,useActionState:T1,useOptimistic:function(s,r){var c=hn();return Lt!==null?y1(c,Lt,s,r):(c.baseState=s,[s,c.queue.dispatch])},useMemoCache:_p,useCacheRefresh:q1,useEffectEvent:R1};function Rp(s,r,c,d){r=s.memoizedState,c=c(d,r),c=c==null?r:F({},r,c),s.memoizedState=c,s.lanes===0&&(s.updateQueue.baseState=c)}var Op={enqueueSetState:function(s,r,c){s=s._reactInternals;var d=As(),p=Lr(d);p.payload=r,c!=null&&(p.callback=c),r=Dr(s,p,d),r!==null&&(hs(r,s,d),rc(r,s,d))},enqueueReplaceState:function(s,r,c){s=s._reactInternals;var d=As(),p=Lr(d);p.tag=1,p.payload=r,c!=null&&(p.callback=c),r=Dr(s,p,d),r!==null&&(hs(r,s,d),rc(r,s,d))},enqueueForceUpdate:function(s,r){s=s._reactInternals;var c=As(),d=Lr(c);d.tag=2,r!=null&&(d.callback=r),r=Dr(s,d,c),r!==null&&(hs(r,s,c),rc(r,s,c))}};function W1(s,r,c,d,p,x,S){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(d,x,S):r.prototype&&r.prototype.isPureReactComponent?!Ko(c,d)||!Ko(p,x):!0}function K1(s,r,c,d){s=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(c,d),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(c,d),r.state!==s&&Op.enqueueReplaceState(r,r.state,null)}function Ba(s,r){var c=r;if("ref"in r){c={};for(var d in r)d!=="ref"&&(c[d]=r[d])}if(s=s.defaultProps){c===r&&(c=F({},c));for(var p in s)c[p]===void 0&&(c[p]=s[p])}return c}function Z1(s){Qu(s)}function J1(s){console.error(s)}function eb(s){Qu(s)}function _d(s,r){try{var c=s.onUncaughtError;c(r.value,{componentStack:r.stack})}catch(d){setTimeout(function(){throw d})}}function tb(s,r,c){try{var d=s.onCaughtError;d(c.value,{componentStack:c.stack,errorBoundary:r.tag===1?r.stateNode:null})}catch(p){setTimeout(function(){throw p})}}function Lp(s,r,c){return c=Lr(c),c.tag=3,c.payload={element:null},c.callback=function(){_d(s,r)},c}function nb(s){return s=Lr(s),s.tag=3,s}function sb(s,r,c,d){var p=c.type.getDerivedStateFromError;if(typeof p=="function"){var x=d.value;s.payload=function(){return p(x)},s.callback=function(){tb(r,c,d)}}var S=c.stateNode;S!==null&&typeof S.componentDidCatch=="function"&&(s.callback=function(){tb(r,c,d),typeof p!="function"&&(Hr===null?Hr=new Set([this]):Hr.add(this));var T=d.stack;this.componentDidCatch(d.value,{componentStack:T!==null?T:""})})}function n3(s,r,c,d,p){if(c.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(r=c.alternate,r!==null&&Aa(r,c,p,!0),c=Ln.current,c!==null){switch(c.tag){case 31:case 13:case 19:return Fn===null?Id():c.alternate===null&&cn===0&&(cn=3),c.flags&=-257,c.flags|=65536,c.lanes=p,d===ld?c.flags|=16384:(r=c.updateQueue,r===null?c.updateQueue=new Set([d]):r.add(d),vm(s,d,p)),!1;case 22:return c.flags|=65536,d===ld?c.flags|=16384:(r=c.updateQueue,r===null?(r={transitions:null,markerInstances:null,retryQueue:new Set([d])},c.updateQueue=r):(c=r.retryQueue,c===null?r.retryQueue=new Set([d]):c.add(d)),vm(s,d,p)),!1}throw Error(i(435,c.tag))}return vm(s,d,p),Id(),!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,c)))):(d!==ep&&(r=Error(i(423),{cause:d}),ec($s(r,c))),s=s.current.alternate,s.flags|=65536,p&=-p,s.lanes|=p,d=$s(d,c),p=Lp(s.stateNode,d,p),up(s,p),cn!==4&&(cn=2)),!1;var x=Error(i(520),{cause:d});if(x=$s(x,c),bc===null?bc=[x]:bc.push(x),cn!==4&&(cn=2),r===null)return!0;d=$s(d,c),c=r;do{switch(c.tag){case 3:return c.flags|=65536,s=p&-p,c.lanes|=s,s=Lp(c.stateNode,d,s),up(c,s),!1;case 1:if(r=c.type,x=c.stateNode,(c.flags&128)===0&&(typeof r.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(Hr===null||!Hr.has(x))))return c.flags|=65536,p&=-p,c.lanes|=p,p=nb(p),sb(p,s,c,d),up(c,p),!1;break;case 22:if(c.memoizedState!==null)return c.flags|=65536,!1}c=c.return}while(c!==null);return!1}var Dp=Error(i(461)),gn=!1;function Sn(s,r,c,d){r.child=s===null?l1(r,null,c,d):za(r,s.child,c,d)}function ib(s,r,c,d,p){c=c.render;var x=r.ref;if("ref"in d){var S={};for(var T in d)T!=="ref"&&(S[T]=d[T])}else S=d;return Ma(r),d=xp(s,r,c,S,x,p),T=vp(),s!==null&&!gn?(bp(s,r,p),er(s,r,p)):(lt&&T&&ed(r),r.flags|=1,Sn(s,r,d,p),r.child)}function rb(s,r,c,d,p){if(s===null){var x=c.type;return typeof x=="function"&&!Wf(x)&&x.defaultProps===void 0&&c.compare===null?(r.tag=15,r.type=x,ab(s,r,x,d,p)):(s=Zu(c.type,null,d,r,r.mode,p),s.ref=r.ref,s.return=r,r.child=s)}if(x=s.child,!Hp(s,p)){var S=x.memoizedProps;if(c=c.compare,c=c!==null?c:Ko,c(S,d)&&s.ref===r.ref)return er(s,r,p)}return r.flags|=1,s=Qi(x,d),s.ref=r.ref,s.return=r,r.child=s}function ab(s,r,c,d,p){if(s!==null){var x=s.memoizedProps;if(Ko(x,d)&&s.ref===r.ref)if(gn=!1,r.pendingProps=d=x,Hp(s,p))(s.flags&131072)!==0&&(gn=!0);else return r.lanes=s.lanes,er(s,r,p)}return zp(s,r,c,d,p)}function lb(s,r,c,d){var p=d.children,x=s!==null?s.memoizedState:null;if(s===null&&r.stateNode===null&&(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((r.flags&128)!==0){if(x=x!==null?x.baseLanes|c:c,s!==null){for(d=r.child=s.child,p=0;d!==null;)p=p|d.lanes|d.childLanes,d=d.sibling;d=p&~x}else d=0,r.child=null;return ob(s,r,x,c,d)}if((c&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},s!==null&&rd(r,x!==null?x.cachePool:null),x!==null?u1(r,x):hp(),d1(r);else return d=r.lanes=536870912,ob(s,r,x!==null?x.baseLanes|c:c,c,d)}else x!==null?(rd(r,x.cachePool),u1(r,x),Br(),r.memoizedState=null):(s!==null&&rd(r,null),hp(),Br());return Sn(s,r,p,c),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 ob(s,r,c,d,p){var x=ap();return x=x===null?null:{parent:pn._currentValue,pool:x},r.memoizedState={baseLanes:c,cachePool:x},s!==null&&rd(r,null),hp(),d1(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 cb(s,r,c){return za(r,s.child,null,c),s=wd(r,r.pendingProps),s.flags|=2,Ns(r),r.memoizedState=null,s}function s3(s,r,c){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=Dy(s,Us),s=s!==null&&s.data==="&"?s:null,s!==null&&(r.memoizedState={dehydrated:s,treeContext:Er!==null?{id:vi,overflow:bi}:null,retryLane:536870912,hydrationErrors:null},c=Gv(s),c.return=r,r.child=c,En=r,Ht=null)):s=null,s===null)throw Ar(r);return r.lanes=536870912,null}return wd(r,d)}var x=s.memoizedState;if(x!==null){var S=x.dehydrated;if(pp(r),p)if(r.flags&256)r.flags&=-257,r=cb(s,r,c);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,c,!1),p=(c&s.childLanes)!==0,gn||p){if(zr.current===null){if(d=zt,d!==null&&(S=mi(d,c),S!==0&&S!==x.retryLane))throw x.retryLane=S,Na(s,S),hs(d,s,S),Dp;Id()}r=cb(s,r,c)}else s=x.treeContext,Ht=Is(S.nextSibling),En=r,lt=!0,Tr=null,Us=!1,s!==null&&Xv(r,s),r=wd(r,d),r.flags|=134221824;return r}return s=Qi(s.child,{mode:d.mode,children:d.children}),s.ref=r.ref,r.child=s,s.return=r,s}function Tl(s,r){var c=r.ref;if(c===null)s!==null&&s.ref!==null&&(r.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(i(284));(s===null||s.ref!==c)&&(r.flags|=4194816)}}function zp(s,r,c,d,p){return Ma(r),c=xp(s,r,c,d,void 0,p),d=vp(),s!==null&&!gn?(bp(s,r,p),er(s,r,p)):(lt&&d&&ed(r),r.flags|=1,Sn(s,r,c,p),r.child)}function ub(s,r,c,d,p,x){return Ma(r),r.updateQueue=null,c=f1(r,d,c,p),h1(s),d=vp(),s!==null&&!gn?(bp(s,r,x),er(s,r,x)):(lt&&d&&ed(r),r.flags|=1,Sn(s,r,c,x),r.child)}function db(s,r,c,d,p){if(Ma(r),r.stateNode===null){var x=bl,S=c.contextType;typeof S=="object"&&S!==null&&(x=On(S)),x=new c(d,x),r.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=Op,r.stateNode=x,x._reactInternals=r,x=r.stateNode,x.props=d,x.state=r.memoizedState,x.refs={},op(r),S=c.contextType,x.context=typeof S=="object"&&S!==null?On(S):bl,x.state=r.memoizedState,S=c.getDerivedStateFromProps,typeof S=="function"&&(Rp(r,c,S,d),x.state=r.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(S=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),S!==x.state&&Op.enqueueReplaceState(x,x.state,null),lc(r,d,x,p),ac(),x.state=r.memoizedState),typeof x.componentDidMount=="function"&&(r.flags|=4194308),d=!0}else if(s===null){x=r.stateNode;var T=r.memoizedProps,$=Ba(c,T);x.props=$;var ee=x.context,ae=c.contextType;S=bl,typeof ae=="object"&&ae!==null&&(S=On(ae));var pe=c.getDerivedStateFromProps;ae=typeof pe=="function"||typeof x.getSnapshotBeforeUpdate=="function",T=r.pendingProps!==T,ae||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(T||ee!==S)&&K1(r,x,d,S),Or=!1;var Z=r.memoizedState;x.state=Z,lc(r,d,x,p),ac(),ee=r.memoizedState,T||Z!==ee||Or?(typeof pe=="function"&&(Rp(r,c,pe,d),ee=r.memoizedState),($=Or||W1(r,c,$,d,Z,ee,S))?(ae||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount()),typeof x.componentDidMount=="function"&&(r.flags|=4194308)):(typeof x.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=d,r.memoizedState=ee),x.props=d,x.state=ee,x.context=S,d=$):(typeof x.componentDidMount=="function"&&(r.flags|=4194308),d=!1)}else{x=r.stateNode,cp(s,r),S=r.memoizedProps,ae=Ba(c,S),x.props=ae,pe=r.pendingProps,Z=x.context,ee=c.contextType,$=bl,typeof ee=="object"&&ee!==null&&($=On(ee)),T=c.getDerivedStateFromProps,(ee=typeof T=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(S!==pe||Z!==$)&&K1(r,x,d,$),Or=!1,Z=r.memoizedState,x.state=Z,lc(r,d,x,p),ac();var ie=r.memoizedState;S!==pe||Z!==ie||Or||s!==null&&s.dependencies!==null&&sd(s.dependencies)?(typeof T=="function"&&(Rp(r,c,T,d),ie=r.memoizedState),(ae=Or||W1(r,c,ae,d,Z,ie,$)||s!==null&&s.dependencies!==null&&sd(s.dependencies))?(ee||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(d,ie,$),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(d,ie,$)),typeof x.componentDidUpdate=="function"&&(r.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof x.componentDidUpdate!="function"||S===s.memoizedProps&&Z===s.memoizedState||(r.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||S===s.memoizedProps&&Z===s.memoizedState||(r.flags|=1024),r.memoizedProps=d,r.memoizedState=ie),x.props=d,x.state=ie,x.context=$,d=ae):(typeof x.componentDidUpdate!="function"||S===s.memoizedProps&&Z===s.memoizedState||(r.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||S===s.memoizedProps&&Z===s.memoizedState||(r.flags|=1024),d=!1)}return x=d,Tl(s,r),d=(r.flags&128)!==0,x||d?(x=r.stateNode,c=d&&typeof c.getDerivedStateFromError!="function"?null:x.render(),r.flags|=1,s!==null&&d?(r.child=za(r,s.child,null,p),r.child=za(r,null,c,p)):Sn(s,r,c,p),r.memoizedState=x.state,s=r.child):s=er(s,r,p),s}function hb(s,r,c,d){return Ea(),r.flags|=256,Sn(s,r,c,d),r.child}var $p={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Bp(s){return{baseLanes:s,cachePool:t1()}}function Pp(s,r,c){return s=s!==null?s.childLanes&~c:0,r&&(s|=Ts),s}function fb(s,r,c){var d=r.pendingProps,p=!1,x=(r.flags&128)!==0,S;if((S=x)||(S=s!==null&&s.memoizedState===null?!1:(Dn.current&2)!==0),S&&(p=!0,r.flags&=-129),S=(r.flags&32)!==0,r.flags&=-33,s===null){if(lt){if(p?$r(r):Br(),(s=Ht)?(s=Dy(s,Us),s=s!==null&&s.data!=="&"?s:null,s!==null&&(r.memoizedState={dehydrated:s,treeContext:Er!==null?{id:vi,overflow:bi}:null,retryLane:536870912,hydrationErrors:null},c=Gv(s),c.return=r,r.child=c,En=r,Ht=null)):s=null,s===null)throw Ar(r);return Bm(s)?r.lanes=32:r.lanes=536870912,null}return x=d.children,d=d.fallback,p?(Br(),p=r.mode,x=Sd({mode:"hidden",children:x},p),d=Ca(d,p,c,null),x.return=r,d.return=r,x.sibling=d,r.child=x,d=r.child,d.memoizedState=Bp(c),d.childLanes=Pp(s,S,c),r.memoizedState=$p,hc(null,d)):($r(r),Up(r,x))}var T=s.memoizedState;if(T!==null){var $=T.dehydrated;if($!==null)return i3(s,r,x,S,d,$,T,c)}return p?(Br(),p=d.fallback,x=r.mode,T=s.child,$=T.sibling,d=Qi(T,{mode:"hidden",children:d.children}),d.subtreeFlags=T.subtreeFlags&1206910976,$!==null?p=Qi($,p):(p=Ca(p,x,c,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(c):(x=p.cachePool,x!==null?(T=pn._currentValue,x=x.parent!==T?{parent:T,pool:T}:x):x=t1(),p={baseLanes:p.baseLanes|c,cachePool:x}),d.memoizedState=p,d.childLanes=Pp(s,S,c),r.memoizedState=$p,hc(s.child,d)):($r(r),c=s.child,s=c.sibling,c=Qi(c,{mode:"visible",children:d.children}),c.return=r,c.sibling=null,s!==null&&(S=r.deletions,S===null?(r.deletions=[s],r.flags|=16):S.push(s)),r.child=c,r.memoizedState=null,c)}function Up(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,c){return za(r,s.child,null,c),s=Up(r,r.pendingProps.children),s.flags|=2,r.memoizedState=null,s}function i3(s,r,c,d,p,x,S,T){if(c)return r.flags&256?($r(r),r.flags&=-257,kd(s,r,T)):r.memoizedState!==null?(Br(),r.child=s.child,r.flags|=128,null):(Br(),x=p.fallback,S=r.mode,p=Sd({mode:"visible",children:p.children},S),x=Ca(x,S,T,null),x.flags|=2,p.return=r,x.return=r,p.sibling=x,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($r(r),Bm(x)){if(d=x.nextSibling&&x.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(zr.current!==null)return kd(s,r,T);if(d=zt,d!==null&&(p=mi(d,T),p!==0&&p!==S.retryLane))throw S.retryLane=p,Na(s,p),hs(d,s,p),Dp;return $m(x)||Id(),kd(s,r,T)}return $m(x)?(r.flags|=192,r.child=s.child,null):(s=S.treeContext,Ht=Is(x.nextSibling),En=r,lt=!0,Tr=null,Us=!1,s!==null&&Xv(r,s),r=Up(r,p.children),r.flags|=134221824,r)}function pb(s,r,c){s.lanes|=r;var d=s.alternate;d!==null&&(d.lanes|=r),nd(s.return,r,c)}function mb(s){for(var r=null;s!==null;){var c=s.alternate;c!==null&&dd(c)===null&&(r=s),s=s.sibling}return r}function jd(s,r,c,d,p,x){var S=s.memoizedState;S===null?s.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:d,tail:c,tailMode:p,treeForkCount:x}:(S.isBackwards=r,S.rendering=null,S.renderingStartTime=0,S.last=d,S.tail=c,S.tailMode=p,S.treeForkCount=x)}function Fp(s){var r=s.child;for(s.child=null;r!==null;){var c=r.sibling;r.sibling=s.child,s.child=r,r=c}}function Ip(s,r,c){var d=r.pendingProps,p=d.revealOrder,x=d.tail;d=d.children;var S=Dn.current;if(r.flags&128)return oc(r,S),null;var T=(S&2)!==0;if(T?(S=S&1|2,r.flags|=128):S&=1,oc(r,S),p==="backwards"&&s!==null?(Fp(s),Sn(s,r,d,c),Fp(s)):Sn(s,r,d,c),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&&pb(s,c,r);else if(s.tag===19)pb(s,c,r);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===r)break e;for(;s.sibling===null;){if(s.return===null||s.return===r)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(p){case"backwards":c=mb(r.child),c===null?(p=r.child,r.child=null):(p=c.sibling,c.sibling=null,Fp(r)),jd(r,!0,p,null,x,d);break;case"unstable_legacy-backwards":for(c=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=c,c=p,p=s}jd(r,!0,c,null,x,d);break;case"together":jd(r,!1,null,null,void 0,d);break;case"independent":r.memoizedState=null;break;default:c=mb(r.child),c===null?(p=r.child,r.child=null):(p=c.sibling,c.sibling=null),jd(r,!1,p,c,x,d)}return r.child}function gb(s,r,c){var d=r.pendingProps;return Mr(r,r.type,d.value),Sn(s,r,d.children,c),r.child}function er(s,r,c){if(s!==null&&(r.dependencies=s.dependencies),Ir|=r.lanes,(c&r.childLanes)===0)if(s!==null){if(Aa(s,r,c,!1),(c&r.childLanes)===0)return null}else return null;if(s!==null&&r.child!==s.child)throw Error(i(153));if(r.child!==null){for(s=r.child,c=Qi(s,s.pendingProps),r.child=c,c.return=r;s.sibling!==null;)s=s.sibling,c=c.sibling=Qi(s,s.pendingProps),c.return=r;c.sibling=null}return r.child}function Hp(s,r){return(s.lanes&r)!==0?!0:(s=s.dependencies,!!(s!==null&&sd(s)))}function r3(s,r,c){switch(r.tag){case 3:Qe(r,r.stateNode.containerInfo),Mr(r,pn,s.memoizedState.cache),Ea();break;case 27:case 5:un(r);break;case 4:Qe(r,r.stateNode.containerInfo);break;case 10:Mr(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 $r(r),r.flags|=128,null;d=Aa(s,r,c,!1);var p=r.child.childLanes;return d||(c&p)!==0?fb(s,r,c):($r(r),s=er(s,r,c),s!==null?s.sibling:null)}$r(r);break;case 19:if(r.flags&128)return Ip(s,r,c);if(p=(s.flags&128)!==0,d=(c&r.childLanes)!==0,d||(Aa(s,r,c,!1),d=(c&r.childLanes)!==0),p){if(d)return Ip(s,r,c);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,lb(s,r,c,r.pendingProps);case 24:Mr(r,pn,s.memoizedState.cache)}return er(s,r,c)}function xb(s,r,c){if(s!==null)if(s.memoizedProps!==r.pendingProps)gn=!0;else{if(!Hp(s,c)&&(r.flags&128)===0)return gn=!1,r3(s,r,c);gn=(s.flags&131072)!==0}else gn=!1,lt&&(r.flags&1048576)!==0&&Qv(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=db(null,r,s,d,c)):(r.tag=0,r=zp(null,r,s,d,c));else{if(s!=null){var p=s.$$typeof;if(p===H){r.tag=11,r=ib(null,r,s,d,c);break e}else if(p===ve){r.tag=14,r=rb(null,r,s,d,c);break e}else if(p===q){r.tag=10,r.type=s,r=gb(null,r,c);break e}}throw r=De(s)||s,Error(i(306,r,""))}}return r;case 0:return zp(s,r,r.type,r.pendingProps,c);case 1:return d=r.type,p=Ba(d,r.pendingProps),db(s,r,d,p,c);case 3:e:{if(Qe(r,r.stateNode.containerInfo),s===null)throw Error(i(387));d=r.pendingProps;var x=r.memoizedState;p=x.element,cp(s,r),lc(r,d,null,c);var S=r.memoizedState;if(d=S.cache,Mr(r,pn,d),d!==x.cache&&sp(r,[pn],c,!0),ac(),d=S.element,x.isDehydrated)if(x={element:d,isDehydrated:!1,cache:S.cache},r.updateQueue.baseState=x,r.memoizedState=x,r.flags&256){r=hb(s,r,d,c);break e}else if(d!==p){p=$s(Error(i(424)),r),ec(p),r=hb(s,r,d,c);break e}else{switch(s=r.stateNode.containerInfo,s.nodeType){case 9:s=s.body;break;default:s=s.nodeName==="HTML"?s.ownerDocument.body:s}for(Ht=Is(s.firstChild),En=r,lt=!0,Tr=null,Us=!0,c=l1(r,null,d,c),r.child=c;c;)c.flags=c.flags&-3|134221824,c=c.sibling}else{if(Ea(),d===p){r=er(s,r,c);break e}Sn(s,r,d,c)}r=r.child}return r;case 26:return Tl(s,r),s===null?(c=Iy(r.type,null,r.pendingProps,null))?r.memoizedState=c:lt||(r.stateNode=_y(r.type,r.pendingProps,se.current,r)):r.memoizedState=Iy(r.type,s.memoizedProps,r.pendingProps,s.memoizedState),null;case 27:return un(r),s===null&<&&(d=r.stateNode=By(r.type,r.pendingProps,se.current),En=r,Us=!0,p=Ht,Gr(r.type)?(Pm=p,Ht=Is(d.firstChild)):Ht=p),Sn(s,r,r.pendingProps.children,c),Tl(s,r),s===null&&(r.flags|=4194304),r.child;case 5:return s===null&<&&((p=d=Ht)&&(d=J3(d,r.type,r.pendingProps,Us),d!==null?(r.stateNode=d,En=r,Ht=Is(d.firstChild),Us=!1,p=!0):p=!1),p||Ar(r)),un(r),p=r.type,x=r.pendingProps,S=s!==null?s.memoizedProps:null,d=x.children,Am(p,x)?d=null:S!==null&&Am(p,S)&&(r.flags|=32),r.memoizedState!==null&&(p=xp(s,r,QC,null,null,c),Yl._currentValue=p),Tl(s,r),Sn(s,r,d,c),r.child;case 6:return s===null&<&&((s=c=Ht)&&(c=eE(c,r.pendingProps,Us),c!==null?(r.stateNode=c,En=r,Ht=null,s=!0):s=!1),s||Ar(r)),null;case 13:return fb(s,r,c);case 4:return Qe(r,r.stateNode.containerInfo),d=r.pendingProps,s===null?r.child=za(r,null,d,c):Sn(s,r,d,c),r.child;case 11:return ib(s,r,r.type,r.pendingProps,c);case 7:return d=r.pendingProps,Tl(s,r),Sn(s,r,d,c),r.child;case 8:return Sn(s,r,r.pendingProps.children,c),r.child;case 12:return Sn(s,r,r.pendingProps.children,c),r.child;case 10:return gb(s,r,c);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,c),r.child;case 14:return rb(s,r,r.type,r.pendingProps,c);case 15:return ab(s,r,r.type,r.pendingProps,c);case 19:return Ip(s,r,c);case 31:return s3(s,r,c);case 22:return lb(s,r,c,r.pendingProps);case 24:return Ma(r),d=On(pn),s===null?(p=ap(),p===null&&(p=zt,x=ip(),p.pooledCache=x,x.refCount++,x!==null&&(p.pooledCacheLanes|=c),p=x),r.memoizedState={parent:d,cache:p},op(r),Mr(r,pn,p)):((s.lanes&c)!==0&&(cp(s,r),lc(r,null,null,c),ac()),p=s.memoizedState,x=r.memoizedState,p.parent!==d?(p={parent:d,cache:d},r.memoizedState=p,r.lanes===0&&(r.memoizedState=r.updateQueue.baseState=p),Mr(r,pn,d)):(d=x.cache,Mr(r,pn,d),d!==p.cache&&sp(r,[pn],c,!0))),Sn(s,r,r.pendingProps.children,c),r.child;case 30:return r.stateNode===null&&(r.stateNode={autoName:null,paired:null,clones:null,ref:null}),d=r.pendingProps,d.name!=null&&d.name!=="auto"?r.flags|=s===null?18882560:18874368:lt&&ed(r),s!==null&&s.memoizedProps.name!==d.name?r.flags|=4194816:Tl(s,r),Sn(s,r,d.children,c),r.child;case 29:throw r.pendingProps}throw Error(i(156,r.tag))}function tr(s){s.flags|=4}function qp(s,r,c,d,p){var x;if((x=(s.mode&32)!==0)&&(x=c===null?Gy(r,d):Gy(r,d)&&(d.src!==c.src||d.srcSet!==c.srcSet)),x){if(s.flags|=16777216,(p&335544128)===p)if(s.stateNode.complete)s.flags|=8192;else if(Zb())s.flags|=8192;else throw Da=ld,lp}else s.flags&=-16777217}function vb(s,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!Yy(r))if(Zb())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 c=s.tail,d=null;c!==null;)c.alternate!==null&&(d=c),c=c.sibling;d===null?r||s.tail===null?s.tail=null:s.tail.sibling=null:d.sibling=null;break;default:for(r=s.tail,c=null;r!==null;)r.alternate!==null&&(c=r),r=r.sibling;c===null?s.tail=null:c.sibling=null}}function qt(s){var r=s.alternate!==null&&s.alternate.child===s.child,c=0,d=0;if(r)for(var p=s.child;p!==null;)c|=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;)c|=p.lanes|p.childLanes,d|=p.subtreeFlags,d|=p.flags,p.return=s,p=p.sibling;return s.subtreeFlags|=d,s.childLanes=c,r}function a3(s,r,c){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 c=r.stateNode,d=null,s!==null&&(d=s.memoizedState.cache),r.memoizedState.cache!==d&&(r.flags|=2048),Ki(pn),et(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(s===null||s.child===null)&&(wl(r)?tr(r):s===null||s.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,tp())),qt(r),null;case 26:var p=r.type,x=r.memoizedState;return s===null?(tr(r),x!==null?(qt(r),vb(r,x)):(qt(r),qp(r,p,null,d,c))):x?x!==s.memoizedState?(tr(r),qt(r),vb(r,x)):(qt(r),r.flags&=-16777217):(s=s.memoizedProps,s!==d&&tr(r),qt(r),qp(r,p,s,d,c)),null;case 27:if(ce(r),c=se.current,p=r.type,s!==null&&r.stateNode!=null)s.memoizedProps!==d&&tr(r);else{if(!d){if(r.stateNode===null)throw Error(i(166));return qt(r),r.subtreeFlags&=-33554433,null}s=St.current,wl(r)?Wv(r):(s=By(p,d,c),r.stateNode=s,tr(r))}return qt(r),r.subtreeFlags&=-33554433,null;case 5:if(ce(r),p=r.type,s!==null&&r.stateNode!=null)s.memoizedProps!==d&&tr(r);else{if(!d){if(r.stateNode===null)throw Error(i(166));return qt(r),r.subtreeFlags&=-33554433,null}if(x=St.current,wl(r))Wv(r);else{var S=kc(se.current);switch(x){case 1:x=S.createElementNS("http://www.w3.org/2000/svg",p);break;case 2:x=S.createElementNS("http://www.w3.org/1998/Math/MathML",p);break;default:switch(p){case"svg":x=S.createElementNS("http://www.w3.org/2000/svg",p);break;case"math":x=S.createElementNS("http://www.w3.org/1998/Math/MathML",p);break;case"script":x=S.createElement("div"),x.innerHTML="<script><\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof d.is=="string"?S.createElement("select",{is:d.is}):S.createElement("select"),d.multiple?x.multiple=!0:d.size&&(x.size=d.size);break;default:x=typeof d.is=="string"?S.createElement(p,{is:d.is}):S.createElement(p)}}x[dn]=r,x[Cn]=d;e:for(S=r.child;S!==null;){if(S.tag===5||S.tag===6)x.appendChild(S.stateNode);else if(S.tag!==4&&S.tag!==27&&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}r.stateNode=x;e:switch($n(x,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&&tr(r)}}return qt(r),r.subtreeFlags&=-33554433,qp(r,r.type,s===null?null:s.memoizedProps,r.pendingProps,c),null;case 6:if(s&&r.stateNode!=null)s.memoizedProps!==d&&tr(r);else{if(typeof d!="string"&&r.stateNode===null)throw Error(i(166));if(s=se.current,wl(r)){if(s=r.stateNode,c=r.memoizedProps,d=null,p=En,p!==null)switch(p.tag){case 27:case 5:d=p.memoizedProps}s[dn]=r,s=!!(s.nodeValue===c||d!==null&&d.suppressHydrationWarning===!0||xy(s.nodeValue,c)),s||Ar(r,!0)}else s=kc(s).createTextNode(d),s[dn]=r,r.stateNode=s}return qt(r),null;case 31:if(c=r.memoizedState,s===null||s.memoizedState!==null){if(d=wl(r),c!==null){if(s===null){if(!d)throw Error(i(318));if(s=r.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(557));s[dn]=r}else Ea(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;qt(r),s=!1}else c=tp(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=c),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=c,r):(c=d!==null,s=s!==null&&s.memoizedState!==null,c&&(d=r.child,p=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(p=d.alternate.memoizedState.cachePool.pool),x=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(x=d.memoizedState.cachePool.pool),x!==p&&(d.flags|=2048)),c!==s&&c&&(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 Ki(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,x=d.rendering,x===null)if(p)fc(d,!1);else{if(cn!==0||s!==null&&(s.flags&128)!==0)for(s=r.child;s!==null;){if(x=dd(s),x!==null){for(r.flags|=128,fc(d,!1),s=x.updateQueue,r.updateQueue=s,Nd(r,s),r.subtreeFlags=0,s=c,c=r.child;c!==null;)Vv(c,s),c=c.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(x),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"&&!x.alternate&&!lt)return qt(r),null}else 2*sn()-d.renderingStartTime>Bd&&c!==536870912&&(r.flags|=128,p=!0,fc(d,!1),r.lanes=4194304);d.isBackwards?(x.sibling=r.child,r.child=x):(s=d.last,s!==null?s.sibling=x:r.child=x,d.last=x)}if(d.tail!==null){s=d.tail;e:{for(c=s;c!==null;){if(c.alternate!==null){c=!1;break e}c=c.sibling}c=!0}return d.rendering=s,d.tail=s.sibling,d.renderingStartTime=sn(),s.sibling=null,x=Dn.current,x=p?x&1|2:x&1,d.tailMode==="visible"||d.tailMode==="collapsed"||!c||lt?oc(r,x):(c=x,Xe(Ln,r),Xe(Dn,c),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?(c&536870912)!==0&&(r.flags&128)===0&&(qt(r),r.subtreeFlags&6&&(r.flags|=8192)):qt(r),c=r.updateQueue,c!==null&&Nd(r,c.retryQueue),c=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(c=s.memoizedState.cachePool.pool),d=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(d=r.memoizedState.cachePool.pool),d!==c&&(r.flags|=2048),s!==null&&wt(Oa),null;case 24:return c=null,s!==null&&(c=s.memoizedState.cache),r.memoizedState.cache!==c&&(r.flags|=2048),Ki(pn),qt(r),null;case 25:return null;case 30:return r.flags|=33554432,qt(r),null}throw Error(i(156,r.tag))}function l3(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 Ki(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 Ki(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 Ki(pn),null;case 25:return null;default:return null}}function bb(s,r){switch(Jf(r),r.tag){case 3:Ki(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:Ki(r.type);break;case 22:case 23:Ns(r),fp(),s!==null&&wt(Oa);break;case 24:Ki(pn)}}function pc(s,r){try{var c=r.updateQueue,d=c!==null?c.lastEffect:null;if(d!==null){var p=d.next;c=p;do{if((c.tag&s)===s){d=void 0;var x=c.create,S=c.inst;d=x(),S.destroy=d}c=c.next}while(c!==p)}}catch(T){Mt(r,r.return,T)}}function Pr(s,r,c){try{var d=r.updateQueue,p=d!==null?d.lastEffect:null;if(p!==null){var x=p.next;d=x;do{if((d.tag&s)===s){var S=d.inst,T=S.destroy;if(T!==void 0){S.destroy=void 0,p=r;var $=c,ee=T;try{ee()}catch(ae){Mt(p,$,ae)}}}d=d.next}while(d!==x)}}catch(ae){Mt(r,r.return,ae)}}function yb(s){var r=s.updateQueue;if(r!==null){var c=s.stateNode;try{c1(r,c)}catch(d){Mt(s,s.return,d)}}}function _b(s,r,c){c.props=Ba(s.type,s.memoizedProps),c.state=s.memoizedState;try{c.componentWillUnmount()}catch(d){Mt(s,r,d)}}function yi(s,r){try{var c=s.ref;if(c!==null){switch(s.tag){case 26:case 27:case 5:var d=s.stateNode;break;case 30:var p=s.stateNode,x=Gi(s.memoizedProps,p);(p.ref===null||p.ref.name!==x)&&(p.ref=Ey(x)),d=p.ref;break;case 7:if(s.stateNode===null){var S=new Ms(s);v(s.child,!1,K3,S,void 0,void 0),s.stateNode=S}d=s.stateNode;break;default:d=s.stateNode}typeof c=="function"?s.refCleanup=c(d):c.current=d}}catch(T){Mt(s,r,T)}}function zn(s,r){var c=s.ref,d=s.refCleanup;if(c!==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 c=="function")try{c(null)}catch(p){Mt(s,r,p)}else c.current=null}function Cd(s,r){if((s.tag===5||s.tag===27||s.tag===6)&&s.alternate===null&&r!==null)for(var c=0;c<r.length;c++)Ly(s.stateNode,r[c])}function wb(s){for(var r=s.return;r!==null&&(Gp(r)&&Ly(s.stateNode,r.stateNode),!Vp(r));)r=r.return}function mc(s){for(var r=s.return;r!==null&&(Gp(r)&&Z3(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,c=s.memoizedProps,d=s.stateNode;try{e:switch(r){case"button":case"input":case"select":case"textarea":c.autoFocus&&d.focus();break e;case"img":c.src?d.src=c.src:c.srcSet&&(d.srcset=c.srcSet)}}catch(p){Mt(s,s.return,p)}}function Qp(s,r,c){try{var d=s.stateNode;O3(d,s.type,c,r),d[Cn]=r}catch(p){Mt(s,s.return,p)}}function Sb(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&Gr(s.type)||s.tag===4}function Xp(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||Sb(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&&Gr(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,c,d){var p=s.tag;if(p===5||p===6)p=s.stateNode,r?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(p,r):(r=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,r.appendChild(p),c=c._reactRootContainer,c!=null||r.onclick!==null||(r.onclick=Qn)),Cd(s,d),bt=!0;else if(p!==4&&(p===27&&(Cd(s,d),d=null,Gr(s.type)&&(c=s.stateNode,r=null)),s=s.child,s!==null))for(Wp(s,r,c,d),s=s.sibling;s!==null;)Wp(s,r,c,d),s=s.sibling}function Ed(s,r,c,d){var p=s.tag;if(p===5||p===6)p=s.stateNode,r?c.insertBefore(p,r):c.appendChild(p),Cd(s,d),bt=!0;else if(p!==4&&(p===27&&(Cd(s,d),d=null,Gr(s.type)&&(c=s.stateNode)),s=s.child,s!==null))for(Ed(s,r,c,d),s=s.sibling;s!==null;)Ed(s,r,c,d),s=s.sibling}function kb(s){var r=s.stateNode,c=s.memoizedProps;try{for(var d=s.type,p=r.attributes;p.length;)r.removeAttributeNode(p[0]);$n(r,d,c),r[dn]=s,r[Cn]=c}catch(x){Mt(s,s.return,x)}}var Td=!1,Cs=null;function jb(s){(s.tag===30||(s.subtreeFlags&33554432)!==0)&&(Td=!0)}var _i=null;function Nb(){var s=_i;return _i=null,s}var cs=0;function Al(s,r,c,d,p){return cs=0,Cb(s.child,r,c,d,p)}function Cb(s,r,c,d,p){for(var x=!1;s!==null;){if(s.tag===5){var S=s.stateNode;if(d!==null){var T=Om(S);d.push(T),T.view&&(x=!0)}else x||Om(S).view&&(x=!0);Td=!0,Ny(S,cs===0?r:r+"_"+cs,c),cs++}else(s.tag!==22||s.memoizedState===null)&&(s.tag===30&&p||Cb(s.child,r,c,d,p)&&(x=!0));s=s.sibling}return x}function wi(s,r){for(;s!==null;)s.tag===5?Cy(s.stateNode,s.memoizedProps):(s.tag!==22||s.memoizedState===null)&&(s.tag===30&&r||wi(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 c=r.name;r=Yi(r.default,r.share),r!=="none"&&(Al(s,c,r,null,!1)||wi(s.child,!1))}s=s.sibling}}function Kp(s,r){if(s.tag===30){var c=s.stateNode,d=s.memoizedProps,p=Gi(d,c),x=Yi(d.default,c.paired?d.share:d.enter);x!=="none"?Al(s,p,x,null,!1)?(Ad(s),c.paired||r||Bl(s,d.onEnter)):wi(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 c=s.memoizedProps,d=c.name;if(d!=null&&d!=="auto"){var p=r.get(d);if(p!==void 0){var x=Yi(c.default,c.share);if(x!=="none"&&(Al(s,d,x,null,!1)?(x=s.stateNode,p.paired=x,x.paired=p,Bl(s,c.onShare)):wi(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,c=Gi(r,s.stateNode),d=Cs!==null?Cs.get(c):void 0,p=Yi(r.default,d!==void 0?r.share:r.exit);p!=="none"&&(Al(s,c,p,null,!1)?d!==void 0?(p=s.stateNode,d.paired=p,p.paired=d,Cs.delete(c),Bl(s,r.onShare)):Bl(s,r.onExit):wi(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 Eb(s){for(s=s.child;s!==null;){if(s.tag===30){var r=s.memoizedProps,c=Gi(r,s.stateNode);r=Yi(r.default,r.update),s.flags&=-5,r!=="none"&&Al(s,c,r,s.memoizedState=[],!1)}else(s.subtreeFlags&33554432)!==0&&Eb(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,wi(s.child,!1))}em(s)}s=s.sibling}}function Md(s){if(s.tag===30)s.stateNode.paired=null,wi(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 Tb(s){for(s=s.child;s!==null;)s.tag===30?wi(s.child,!1):(s.subtreeFlags&33554432)!==0&&Tb(s),s=s.sibling}function tm(s,r,c,d,p,x,S){for(var T=!1;r!==null;){if(r.tag===5){var $=r.stateNode;if(x!==null&&cs<x.length){var ee=x[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&&Ny($,cs===0?c:c+"_"+cs,p),T&&(s.flags&4)!==0||(_i===null&&(_i=[]),_i.push($,cs===0?d:d+"_"+cs,r.memoizedProps)),cs++}else(r.tag!==22||r.memoizedState===null)&&(r.tag===30&&S?s.flags|=r.flags&32:tm(s,r.child,c,d,p,x,S)&&(T=!0));r=r.sibling}return T}function Ab(s,r){for(s=s.child;s!==null;){if(s.tag===30){var c=s.memoizedProps,d=s.stateNode,p=Gi(c,d),x=Yi(c.default,c.update),S;S=s.memoizedState,s.memoizedState=null,d=s;var T=s.child;cs=0,p=tm(d,T,p,p,x,S,!1),(s.flags&4)!==0&&p&&Bl(s,c.onUpdate)}else(s.subtreeFlags&33554432)!==0&&Ab(s);s=s.sibling}}var Tn=!1,Tt=!1,Si=!1,nm=!1,Mb=typeof WeakSet=="function"?WeakSet:Set,An=null,ki=!1,gc=!1,Rd=!1,sm=!1;function o3(s,r,c){if(s=s.containerInfo,Em=Ql,s=Dv(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 x=p.anchorOffset,S=p.focusNode;p=p.focusOffset;try{d.nodeType,S.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||x!==0&&Z.nodeType!==3||($=T+x),Z!==S||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===x&&($=T),ie===S&&++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},Ql=!1,c=(c&335544064)===c,An=r,r=c?9270:1024;An!==null;){if(s=An,c&&(d=s.deletions,d!==null))for(x=0;x<d.length;x++)c&&Jp(d[x]);if(s.alternate===null&&(s.flags&2)!==0)c&&jb(s),Od(c);else{if(s.tag===22){if(d=s.alternate,s.memoizedState!==null){d!==null&&d.memoizedState===null&&c&&Jp(d),Od(c);continue}else if(d!==null&&d.memoizedState!==null){c&&jb(s),Od(c);continue}}d=s.child,(s.subtreeFlags&r)!==0&&d!==null?(d.return=s,An=d):(c&&Eb(s),Od(c))}}Cs=null}function Od(s){for(;An!==null;){var r=An,c=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){c=void 0,p=d.memoizedProps,d=d.memoizedState;var x=r.stateNode;try{var S=Ba(r.type,p);c=x.getSnapshotBeforeUpdate(S,d),x.__reactInternalSnapshotBeforeUpdate=c}catch(T){Mt(r,r.return,T)}}break;case 3:if((p&1024)!==0){if(d=r.stateNode.containerInfo,c=d.nodeType,c===9)zm(d);else if(c===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:c&&d!==null&&(c=Gi(d.memoizedProps,d.stateNode),p=r.memoizedProps,p=Yi(p.default,p.update),p!=="none"&&Al(d,c,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 Rb(s,r,c){var d=c.flags;switch(c.tag){case 0:case 11:case 15:ji(s,c),d&4&&pc(5,c);break;case 1:if(ji(s,c),d&4)if(s=c.stateNode,r===null)try{s.componentDidMount()}catch(S){Mt(c,c.return,S)}else{var p=Ba(c.type,r.memoizedProps);r=r.memoizedState;try{s.componentDidUpdate(p,r,s.__reactInternalSnapshotBeforeUpdate)}catch(S){Mt(c,c.return,S)}}d&64&&yb(c),d&512&&yi(c,c.return);break;case 3:if(ji(s,c),d&64&&(s=c.updateQueue,s!==null)){if(r=null,c.child!==null)switch(c.child.tag){case 27:case 5:r=c.child.stateNode;break;case 1:r=c.child.stateNode}try{c1(s,r)}catch(S){Mt(c,c.return,S)}}break;case 27:r===null&&d&4&&kb(c);case 26:case 5:ji(s,c),r===null&&d&4&&Yp(c),d&512&&yi(c,c.return);break;case 12:ji(s,c);break;case 31:ji(s,c),d&4&&zb(s,c);break;case 13:ji(s,c),d&4&&$b(s,c),d&64&&(s=c.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(c=y3.bind(null,c),tE(s,c))));break;case 22:if(d=c.memoizedState!==null||Tn,!d){var x=r!==null&&r.memoizedState!==null||Tt;r=Tn,p=Tt,Tn=d,(Tt=x)&&!p?(d=2,(c.subtreeFlags&8772)!==0&&(d|=1),ii(s,c,d)):ji(s,c),Tn=r,Tt=p}break;case 30:ji(s,c),d&512&&yi(c,c.return);break;case 7:d&512&&yi(c,c.return);default:ji(s,c)}}function im(s,r){for(s=s.child;s!==null;)Ob(s,r),s=s.sibling}function Ob(s,r){switch(s.tag){case 5:case 26:try{var c=s.stateNode;if(r){var d=c.style;typeof d.setProperty=="function"?d.setProperty("display","none","important"):d.display="none"}else{var p=s.stateNode,x=s.memoizedProps.style,S=x!=null&&x.hasOwnProperty("display")?x.display:null;p.style.display=S==null||typeof S=="boolean"?"":(""+S).trim()}}catch($){Mt(s,s.return,$)}rm(s,r);break;case 6:try{s.stateNode.nodeValue=r?"":s.memoizedProps,bt=!0}catch($){Mt(s,s.return,$)}break;case 18:try{var T=s.stateNode;r?jy(T,!0):jy(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 c=s,d=r;switch(c.tag){case 4:Ob(c,d);break e;case 22:c.memoizedState===null&&rm(c,d);break e;default:rm(c,d)}}s=s.sibling}}function Lb(s){var r=s.alternate;r!==null&&(s.alternate=null,Lb(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 Zt=null,us=!1;function ni(s,r,c){for(c=c.child;c!==null;)Db(s,r,c),c=c.sibling}function Db(s,r,c){if(vt&&typeof vt.onCommitFiberUnmount=="function")try{vt.onCommitFiberUnmount(Nn,c)}catch{}switch(c.tag){case 26:Tt||zn(c,r),ni(s,r,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&!Tt&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:Tt||zn(c,r),mc(c);var d=Zt,p=us;Gr(c.type)&&(Zt=c.stateNode,us=!1),ni(s,r,c),Py(c.stateNode,c.type,c.memoizedProps),Zt=d,us=p;break;case 5:Tt||zn(c,r),mc(c);case 6:if(c.tag===6&&mc(c),d=Zt,p=us,Zt=null,ni(s,r,c),Zt=d,us=p,Zt!==null)if(us)try{(Zt.nodeType===9?Zt.body:Zt.nodeName==="HTML"?Zt.ownerDocument.body:Zt).removeChild(c.stateNode),bt=!0}catch(x){Mt(c,r,x)}else try{Zt.removeChild(c.stateNode),bt=!0}catch(x){Mt(c,r,x)}break;case 18:Zt!==null&&(us?(s=Zt,ky(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,c.stateNode),Xl(s)):ky(Zt,c.stateNode));break;case 4:d=Zt,p=us,Zt=c.stateNode.containerInfo,us=!0,ni(s,r,c),Zt=d,us=p;break;case 0:case 11:case 14:case 15:Pr(2,c,r),Tt||Pr(4,c,r),ni(s,r,c);break;case 1:Tt||(zn(c,r),d=c.stateNode,typeof d.componentWillUnmount=="function"&&_b(c,r,d)),ni(s,r,c);break;case 21:ni(s,r,c);break;case 22:Tt=(d=Tt)||c.memoizedState!==null,ni(s,r,c),Tt=d;break;case 30:zn(c,r),ni(s,r,c);break;case 7:Tt||zn(c,r),ni(s,r,c);break;default:ni(s,r,c)}}function zb(s,r){if(r.memoizedState===null&&(s=r.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{Xl(s)}catch(c){Mt(r,r.return,c)}}}function $b(s,r){if(r.memoizedState===null&&(s=r.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{Xl(s)}catch(c){Mt(r,r.return,c)}}function c3(s){switch(s.tag){case 31:case 13:case 19:var r=s.stateNode;return r===null&&(r=s.stateNode=new Mb),r;case 22:return s=s.stateNode,r=s._retryCache,r===null&&(r=s._retryCache=new Mb),r;default:throw Error(i(435,s.tag))}}function Ld(s,r){var c=c3(s);r.forEach(function(d){if(!c.has(d)){c.add(d);var p=_3.bind(null,s,d);d.then(p,p)}})}function Kn(s,r,c){var d=r.deletions;if(d!==null)for(var p=0;p<d.length;p++){var x=d[p],S=s,T=r,$=T;e:for(;$!==null;){switch($.tag){case 27:if(Gr($.type)){Zt=$.stateNode,us=!1;break e}break;case 5:Zt=$.stateNode,us=!1;break e;case 3:case 4:Zt=$.stateNode.containerInfo,us=!0;break e}$=$.return}if(Zt===null)throw Error(i(160));Db(S,T,x),Zt=null,us=!1,S=x.alternate,S!==null&&(S.return=null),x.return=null}if(r.subtreeFlags&13886)for(r=r.child;r!==null;)Bb(r,s,c),r=r.sibling}var si=null;function Bb(s,r,c){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 x=0;x<d.length;x++){var S=d[x];S.ref.impl=S.nextImpl}Kn(r,s,c),Zn(s),p&4&&(Pr(3,s,s.return),pc(3,s),Pr(5,s,s.return));break;case 1:Kn(r,s,c),Zn(s),p&512&&(Tt||d===null||zn(d,d.return)),p&64&&Tn&&(s=s.updateQueue,s!==null&&(r=s.callbacks,r!==null&&(c=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=c===null?r:c.concat(r))));break;case 26:if(x=si,Kn(r,s,c),Zn(s),p&512&&(Tt||d===null||zn(d,d.return)),p&4)if(p=d!==null?d.memoizedState:null,c=s.memoizedState,d===null)if(c===null)if(s.stateNode===null)if(Tn)s.stateNode=_y(s.type,s.memoizedProps,r.containerInfo,s);else{e:{r=s.type,c=s.memoizedProps,p=x.ownerDocument||x;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,c),d[dn]=s,ln(d),r=d;break e;case"link":if(x=Vy("link","href",p).get(r+(c.href||""))){for(S=0;S<x.length;S++)if(d=x[S],d.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&d.getAttribute("rel")===(c.rel==null?null:c.rel)&&d.getAttribute("title")===(c.title==null?null:c.title)&&d.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){x.splice(S,1);break t}}d=p.createElement(r),$n(d,r,c),p.head.appendChild(d);break;case"meta":if(x=Vy("meta","content",p).get(r+(c.content||""))){for(S=0;S<x.length;S++)if(d=x[S],d.getAttribute("content")===(c.content==null?null:""+c.content)&&d.getAttribute("name")===(c.name==null?null:c.name)&&d.getAttribute("property")===(c.property==null?null:c.property)&&d.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&d.getAttribute("charset")===(c.charSet==null?null:c.charSet)){x.splice(S,1);break t}}d=p.createElement(r),$n(d,r,c),p.head.appendChild(d);break;default:throw Error(i(468,r))}d[dn]=s,ln(d),r=d}s.stateNode=r}else Tn||Hm(x,s.type,s.stateNode);else s.stateNode=qy(x,c,s.memoizedProps);else p!==c?(p===null?(r=d.stateNode,r===null||Tt||r.parentNode.removeChild(r)):p.count--,c===null?Tn||Hm(x,s.type,s.stateNode):qy(x,c,s.memoizedProps)):c===null&&s.stateNode!==null&&Qp(s,s.memoizedProps,d.memoizedProps);break;case 27:Kn(r,s,c),Zn(s),p&512&&(Tt||d===null||zn(d,d.return)),d!==null&&p&4&&Qp(s,s.memoizedProps,d.memoizedProps);break;case 5:if(x=Si,Si=!1,Kn(r,s,c),Si=x,Zn(s),p&512&&(Tt||d===null||zn(d,d.return)),s.flags&32){r=s.stateNode;try{Vi(r,""),bt=!0}catch(ae){Mt(s,s.return,ae)}}p&4&&s.stateNode!=null&&(r=s.memoizedProps,Qp(s,r,d!==null?d.memoizedProps:r)),p&1024&&(nm=!0);break;case 6:if(Kn(r,s,c),Zn(s),p&4){if(s.stateNode===null)throw Error(i(162));r=s.memoizedProps,c=s.stateNode;try{c.nodeValue=r,bt=!0}catch(ae){Mt(s,s.return,ae)}}break;case 3:if(bt=!1,Xd=null,x=si,si=jc(r.containerInfo),Kn(r,s,c),si=x,Zn(s),p&4&&d!==null&&d.memoizedState.isDehydrated)try{Xl(r.containerInfo)}catch(ae){Mt(s,s.return,ae)}nm&&(nm=!1,Pb(s)),bt=!1;break;case 4:p=Si,Si=Tn,d=Pu(),x=si,si=jc(s.stateNode.containerInfo),Kn(r,s,c),Zn(s),si=x,bt&&gc&&(Rd=!0),bt=d,Si=p;break;case 12:Kn(r,s,c),Zn(s);break;case 31:Kn(r,s,c),Zn(s),p&4&&(r=s.updateQueue,r!==null&&(s.updateQueue=null,Ld(s,r)));break;case 13:Kn(r,s,c),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:x=s.memoizedState!==null,S=d!==null&&d.memoizedState!==null;var T=Tn,$=Tt,ee=Si;Tn=T||x,Si=ee||x,Tt=$||S,Kn(r,s,c),Tt=$,Si=ee,Tn=T,Zn(s),p&8192&&(r=s.stateNode,r._visibility=x?r._visibility&-2:r._visibility|1,!x||d===null||S||Tn||Tt||(r=S||Tt,c=Tn,d=Tt,Tn=x||Tn,Tt=r,Ur(s,2),Tn=c,Tt=d),!x&&Si||im(s,x)),p&4&&(r=s.updateQueue,r!==null&&(c=r.retryQueue,c!==null&&(r.retryQueue=null,Ld(s,c))));break;case 19:Kn(r,s,c),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(),x=gc,S=(c&335544064)===c,T=s.memoizedProps,gc=S&&Yi(T.default,T.update)!=="none",Kn(r,s,c),Zn(s),S&&d!==null&&bt&&(s.flags|=4),gc=x,bt=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,c),Zn(s)}}function Zn(s){var r=s.flags;if(r&2){try{for(var c,d=s.return;d!==null;){if(Sb(d)){c=d;break}d=d.return}d=null;for(var p=s.return;p!==null;){if(Gp(p)){var x=p.stateNode;d===null?d=[x]:d.push(x)}if(Vp(p))break;p=p.return}var S=d;if(c==null)throw Error(i(160));switch(c.tag){case 27:var T=c.stateNode,$=Xp(s);Ed(s,$,T,S);break;case 5:var ee=c.stateNode;c.flags&32&&(Vi(ee,""),c.flags&=-33);var ae=Xp(s);Ed(s,ae,ee,S);break;case 3:case 4:var pe=c.stateNode.containerInfo,Z=Xp(s);Wp(s,Z,pe,S);break;default:throw Error(i(161))}}catch(ie){Mt(s,s.return,ie)}s.flags&=-3}r&4096&&(s.flags&=-4097)}function Pb(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var r=s;Pb(r),r.tag===5&&r.flags&1024&&(r=r.stateNode,Ql=!0,r.reset(),Ql=!1),s=s.sibling}}function Ml(s,r){if(r.subtreeFlags&9270)for(r=r.child;r!==null;)Ub(r,s),r=r.sibling;else Ab(r)}function Ub(s,r){var c=s.alternate;if(c===null)Kp(s,!1);else switch(s.tag){case 3:if(sm=ki=!1,Nb(),Ml(r,s),!ki&&!Rd){if(s=_i,s!==null)for(var d=0;d<s.length;d+=3){c=s[d];var p=s[d+1];Cy(c,s[d+2]),c=c.ownerDocument.documentElement,c!==null&&c.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group("+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}_i=null;break;case 5:Ml(r,s);break;case 4:d=ki,ki=!1,Ml(r,s),ki&&(Rd=!0),ki=d;break;case 22:s.memoizedState===null&&(c.memoizedState!==null?Kp(s,!1):Ml(r,s));break;case 30:d=ki,p=Nb(),ki=!1,Ml(r,s),ki&&(s.flags|=4);var x=s.memoizedProps,S=s.stateNode;r=Gi(x,S),S=Gi(c.memoizedProps,S);var T=Yi(x.default,x.update);T==="none"?r=!1:(x=c.memoizedState,c.memoizedState=null,c=s.child,cs=0,r=tm(s,c,r,S,T,x,!0),cs!==(x===null?0:x.length)&&(s.flags|=32)),(s.flags&4)!==0&&r?(Bl(s,s.memoizedProps.onUpdate),_i=p):p!==null&&(p.push.apply(p,_i),_i=p),ki=(s.flags&32)!==0?!0:d;break;default:Ml(r,s)}}function ji(s,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)Rb(s,r.alternate,r),r=r.sibling}function Ur(s,r){for(s=s.child;s!==null;){var c=s,d=r;switch(c.tag){case 0:case 11:case 14:case 15:Pr(4,c,c.return),Ur(c,d);break;case 1:zn(c,c.return);var p=c.stateNode;typeof p.componentWillUnmount=="function"&&_b(c,c.return,p),Ur(c,d);break;case 27:(d&2)!==0&&Py(c.stateNode,c.type,c.memoizedProps);case 5:zn(c,c.return),c.tag!==5&&c.tag!==27||mc(c),Ur(c,d);break;case 6:mc(c);break;case 26:zn(c,c.return),p=c.stateNode,c.memoizedState!==null||p===null||Tt||p.parentNode.removeChild(p),Ur(c,d);break;case 22:c.memoizedState===null&&Ur(c,d);break;case 30:zn(c,c.return),Ur(c,d);break;case 7:zn(c,c.return);default:Ur(c,d)}s=s.sibling}}function ii(s,r,c){for(c=(r.subtreeFlags&8772)!==0?c:c&-2,r=r.child;r!==null;){var d=r.alternate,p=s,x=r,S=x.flags,T=(c&1)!==0;switch(x.tag){case 0:case 11:case 15:ii(p,x,c),pc(4,x);break;case 1:if(ii(p,x,c),d=x,p=d.stateNode,typeof p.componentDidMount=="function")try{p.componentDidMount()}catch(ae){Mt(d,d.return,ae)}if(d=x,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++)o1(ee[p],$)}catch(ae){Mt(d,d.return,ae)}}T&&S&64&&yb(x),yi(x,x.return);break;case 27:(c&2)!==0&&kb(x);case 5:x.tag!==5&&x.tag!==27||wb(x),ii(p,x,c),T&&d===null&&S&4&&Yp(x),yi(x,x.return);break;case 6:wb(x);break;case 26:$=x.stateNode,x.memoizedState!==null||$===null||Tn||Hm(jc($.ownerDocument),x.type,$),ii(p,x,c),T&&d===null&&S&4&&Yp(x),yi(x,x.return);break;case 12:ii(p,x,c);break;case 31:ii(p,x,c),T&&S&4&&zb(p,x);break;case 13:ii(p,x,c),T&&S&4&&$b(p,x);break;case 22:x.memoizedState===null&&ii(p,x,c),yi(x,x.return);break;case 30:ii(p,x,c),yi(x,x.return);break;case 7:yi(x,x.return);default:ii(p,x,c)}r=r.sibling}}function am(s,r){var c=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(c=s.memoizedState.cachePool.pool),s=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(s=r.memoizedState.cachePool.pool),s!==c&&(s!=null&&s.refCount++,c!=null&&tc(c))}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,c,d){var p=(c&335544064)===c;if(r.subtreeFlags&(p?10262:10256))for(r=r.child;r!==null;)Fb(s,r,c,d),r=r.sibling;else p&&Tb(r)}function Fb(s,r,c,d){var p=(c&335544064)===c;p&&r.alternate===null&&r.return!==null&&r.return.alternate!==null&&Md(r);var x=r.flags;switch(r.tag){case 0:case 11:case 15:Fs(s,r,c,d),x&2048&&pc(9,r);break;case 1:Fs(s,r,c,d);break;case 3:Fs(s,r,c,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="")),x&2048&&(x=null,r.alternate!==null&&(x=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==x&&(r.refCount++,x!=null&&tc(x)));break;case 12:if(x&2048){Fs(s,r,c,d),x=r.stateNode;try{var S=r.memoizedProps,T=S.id,$=S.onPostCommit;typeof $=="function"&&$(T,r.alternate===null?"mount":"update",x.passiveEffectDuration,-0)}catch(ee){Mt(r,r.return,ee)}}else Fs(s,r,c,d);break;case 31:Fs(s,r,c,d);break;case 13:Fs(s,r,c,d);break;case 23:break;case 22:S=r.stateNode,T=r.alternate,r.memoizedState!==null?(p&&T!==null&&T.memoizedState===null&&Md(T),S._visibility&2?Fs(s,r,c,d):xc(s,r)):(p&&T!==null&&T.memoizedState!==null&&Md(r),S._visibility&2?Fs(s,r,c,d):(S._visibility|=2,Rl(s,r,c,d,(r.subtreeFlags&10256)!==0||!1))),x&2048&&am(T,r);break;case 24:Fs(s,r,c,d),x&2048&&lm(r.alternate,r);break;case 30:p&&(x=r.alternate,x!==null&&(wi(x.child,!0),wi(r.child,!0))),Fs(s,r,c,d);break;default:Fs(s,r,c,d)}}function Rl(s,r,c,d,p){for(p=p&&((r.subtreeFlags&10256)!==0||!1),r=r.child;r!==null;){var x=s,S=r,T=c,$=d,ee=S.flags;switch(S.tag){case 0:case 11:case 15:Rl(x,S,T,$,p),pc(8,S);break;case 23:break;case 22:var ae=S.stateNode;S.memoizedState!==null?ae._visibility&2?Rl(x,S,T,$,p):xc(x,S):(ae._visibility|=2,Rl(x,S,T,$,p)),p&&ee&2048&&am(S.alternate,S);break;case 24:Rl(x,S,T,$,p),p&&ee&2048&&lm(S.alternate,S);break;default:Rl(x,S,T,$,p)}r=r.sibling}}function xc(s,r){if(r.subtreeFlags&10256)for(r=r.child;r!==null;){var c=s,d=r,p=d.flags;switch(d.tag){case 22:xc(c,d),p&2048&&am(d.alternate,d);break;case 24:xc(c,d),p&2048&&lm(d.alternate,d);break;default:xc(c,d)}r=r.sibling}}var Pa=8192;function Ua(s,r,c){if(s.subtreeFlags&Pa)for(s=s.child;s!==null;)Ib(s,r,c),s=s.sibling}function Ib(s,r,c){switch(s.tag){case 26:Ua(s,r,c),s.flags&Pa&&(s.memoizedState!==null?mE(c,si,s.memoizedState,s.memoizedProps):(s=s.stateNode,(r&335544128)===r&&Xy(c,s)));break;case 5:Ua(s,r,c),s.flags&Pa&&(s=s.stateNode,(r&335544128)===r&&Xy(c,s));break;case 3:case 4:var d=si;si=jc(s.stateNode.containerInfo),Ua(s,r,c),si=d;break;case 22:s.memoizedState===null&&(d=s.alternate,d!==null&&d.memoizedState!==null?(d=Pa,Pa=16777216,Ua(s,r,c),Pa=d):Ua(s,r,c));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)}Ua(s,r,c);break;default:Ua(s,r,c)}}function Hb(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 c=0;c<r.length;c++){var d=r[c];An=d,Vb(d,s)}Hb(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)qb(s),s=s.sibling}function qb(s){switch(s.tag){case 0:case 11:case 15:vc(s),s.flags&2048&&Pr(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 c=0;c<r.length;c++){var d=r[c];An=d,Vb(d,s)}Hb(s)}for(s=s.child;s!==null;){switch(r=s,r.tag){case 0:case 11:case 15:Pr(8,r,r.return),Dd(r);break;case 22:c=r.stateNode,c._visibility&2&&(c._visibility&=-3,Dd(r));break;default:Dd(r)}s=s.sibling}}function Vb(s,r){for(;An!==null;){var c=An;switch(c.tag){case 0:case 11:case 15:Pr(8,c,r);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var d=c.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:tc(c.memoizedState.cache)}if(d=c.child,d!==null)d.return=c,An=d;else e:for(c=s;An!==null;){d=An;var p=d.sibling,x=d.return;if(Lb(d),d===c){An=null;break e}if(p!==null){p.return=x,An=p;break e}An=x}}}var u3={getCacheForType:function(s){var r=On(pn),c=r.data.get(s);return c===void 0&&(c=s(),r.data.set(s,c)),c},cacheSignal:function(){return On(pn).controller.signal}},d3=typeof WeakMap=="function"?WeakMap:Map,Et=0,zt=null,ut=null,ft=0,At=0,Es=null,Fr=!1,Ol=!1,om=!1,nr=0,cn=0,Ir=0,Fa=0,zd=0,Ts=0,Ll=0,bc=null,ds=null,cm=!1,$d=0,Gb=0,Bd=1/0,Pd=null,Hr=null,tn=0,ri=null,Ia=null,Ni=0,um=0,dm=null,Yb=null,Dl=null,zl=null,$l=null,yc=0,Ud=null;function As(){return(Et&2)!==0&&ft!==0?ft&-ft:Ce.T!==null?_m():ba()}function Qb(){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 c=s.stateNode,d=c.ref;d===null&&(d=c.ref=Ey(Gi(s.memoizedProps,c))),zl===null&&(zl=[]),zl.push(r.bind(null,d))}}function hs(s,r,c){(s===zt&&(At===2||At===9)||s.cancelPendingCommit!==null)&&(Pl(s,0),qr(s,ft,Ts,!1)),pi(s,c),((Et&2)===0||s!==zt)&&(s===zt&&((Et&2)===0&&(Fa|=c),cn===4&&qr(s,ft,Ts,!1)),Ci(s))}function Xb(s,r,c){if((Et&6)!==0)throw Error(i(327));var d=!c&&(r&127)===0&&(r&s.expiredLanes)===0||yr(s,r),p=d?p3(s,r):fm(s,r,!0),x=d;do{if(p===0){Ol&&!d&&qr(s,r,0,!1);break}else{if(c=s.current.alternate,x&&!h3(c)){p=fm(s,r,!1),x=!1;continue}if(p===2){if(x=r,s.errorRecoveryDisabledLanes&x)var S=0;else S=s.pendingLanes&-536870913,S=S!==0?S:S&536870912?536870912:0;if(S!==0){r=S;e:{var T=s;p=bc;var $=T.current.memoizedState.isDehydrated;if($&&(Pl(T,S).flags|=256),S=fm(T,S,!1),S!==2&&S!==6){if(om&&!$){T.errorRecoveryDisabledLanes|=x,Fa|=x,p=4;break e}x=ds,ds=p,x!==null&&(ds===null?ds=x:ds.push.apply(ds,x))}p=S}if(x=!1,p!==2)continue}}if(p===1){Pl(s,0),qr(s,r,0,!0);break}e:{switch(d=s,x=p,x){case 0:case 1:throw Error(i(345));case 4:if((r&4194048)!==r&&(r&62914560)!==r)break;case 6:qr(d,r,Ts,!Fr);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(qr(d,r,Ts,!Fr),Ws(d,0,!0)!==0)break e;Ni=r,d.timeoutHandle=Rm(Wb.bind(null,d,c,ds,Pd,cm,r,Ts,Fa,Ll,Fr,x,"Throttled",-0,0),p);break e}Wb(d,c,ds,Pd,cm,r,Ts,Fa,Ll,Fr,x,null,-0,0)}}break}while(!0);Ci(s)}function Wb(s,r,c,d,p,x,S,T,$,ee,ae,pe,Z,ie){s.timeoutHandle=-1;var Te=r.subtreeFlags,Be=(x&335544064)===x;if(pe=null,(Be||Te&8192||(Te&16785408)===16785408)&&(pe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Qn},Cs=null,Ib(r,x,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=(x&62914560)===x?$d-sn():(x&4194048)===x?Gb-sn():0,Te=gE(pe,Te),Te!==null)){Ni=x,s.cancelPendingCommit=Te(iy.bind(null,s,r,x,c,d,p,S,T,$,ee,ae,pe,null,Z,ie)),qr(s,x,S,!ee);return}iy(s,r,x,c,d,p,S,T,$,ee,ae,pe)}function h3(s){for(var r=s;;){var c=r.tag;if((c===0||c===11||c===15)&&r.flags&16384&&(c=r.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var d=0;d<c.length;d++){var p=c[d],x=p.getSnapshot;p=p.value;try{if(!js(x(),p))return!1}catch{return!1}}if(c=r.child,r.subtreeFlags&16384&&c!==null)c.return=r,r=c;else{if(r===s)break;for(;r.sibling===null;){if(r.return===null||r.return===s)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function qr(s,r,c,d){r=Ui(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 x=31-en(p),S=1<<x;d[x]=-1,p&=~S}c!==0&&xa(s,c,r)}function Fd(){return(Et&6)===0?(_c(0),!1):!0}function hm(){if(ut!==null){if(At===0)var s=ut.return;else s=ut,Wi=Ta=null,yp(s),jl=null,ic=0,s=ut;for(;s!==null;)bb(s.alternate,s),s=s.return;ut=null}}function Pl(s,r){var c=s.timeoutHandle;return c!==-1&&(s.timeoutHandle=-1,z3(c)),c=s.cancelPendingCommit,c!==null&&(s.cancelPendingCommit=null,c()),Ni=0,hm(),zt=s,ut=c=Qi(s.current,null),ft=r,At=0,Es=null,Fr=!1,Ol=yr(s,r),om=!1,Ll=Ts=zd=Fa=Ir=cn=0,ds=bc=null,cm=!1,nr=Ui(s,r),Xu(),c}function Kb(s,r){tt=null,Ce.H=yd,r===kl||r===ad?(r=i1(),At=3):r===lp?(r=i1(),At=4):At=r===Dp?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,Es=r,ut===null&&(cn=1,_d(s,$s(r,s.current)))}function Zb(){var s=Ln.current;return s===null?!0:(ft&4194048)===ft?Fn===null:(ft&62914560)===ft||(ft&536870912)!==0?s===Fn:!1}function Jb(){var s=Ce.H;return Ce.H=yd,s===null?yd:s}function ey(){var s=Ce.A;return Ce.A=u3,s}function Id(){cn=4,Fr||(ft&4194048)!==ft&&Ln.current!==null||(Ol=!0),(Ir&134217727)===0&&(Fa&134217727)===0||zt===null||qr(zt,ft,Ts,!1)}function fm(s,r,c){var d=Et;Et|=2;var p=Jb(),x=ey();(zt!==s||ft!==r)&&(Pd=null,Pl(s,r)),r=!1;var S=cn;e:do try{if(At!==0&&ut!==null){var T=ut,$=Es;switch(At){case 8:hm(),S=6;break e;case 3:case 2:case 9:case 6:Ln.current===null&&(r=!0);var ee=At;if(At=0,Es=null,Ul(s,T,$,ee),c&&Ol){S=0;break e}break;default:ee=At,At=0,Es=null,Ul(s,T,$,ee)}}f3(),S=cn;break}catch(ae){Kb(s,ae)}while(!0);return r&&s.shellSuspendCounter++,Wi=Ta=null,Et=d,Ce.H=p,Ce.A=x,ut===null&&(zt=null,ft=0,Xu()),S}function f3(){for(;ut!==null;)ty(ut)}function p3(s,r){var c=Et;Et|=2;var d=Jb(),p=ey();zt!==s||ft!==r?(Pd=null,Bd=sn()+500,Pl(s,r)):Ol=yr(s,r);e:do try{if(At!==0&&ut!==null){r=ut;var x=Es;t:switch(At){case 1:At=0,Es=null,Ul(s,r,x,1);break;case 2:case 9:if(n1(x)){At=0,Es=null,ny(r);break}r=function(){At!==2&&At!==9||zt!==s||(At=7),Ci(s)},x.then(r,r);break e;case 3:At=7;break e;case 4:At=5;break e;case 7:n1(x)?(At=0,Es=null,ny(r)):(At=0,Es=null,Ul(s,r,x,7));break;case 5:var S=null;switch(ut.tag){case 26:S=ut.memoizedState;case 5:case 27:var T=ut;if(S?Yy(S):T.stateNode.complete){At=0,Es=null;var $=T.sibling;if($!==null)ut=$;else{var ee=T.return;ee!==null?(ut=ee,Hd(ee)):ut=null}break t}}At=0,Es=null,Ul(s,r,x,5);break;case 6:At=0,Es=null,Ul(s,r,x,6);break;case 8:hm(),cn=6;break e;default:throw Error(i(462))}}m3();break}catch(ae){Kb(s,ae)}while(!0);return Wi=Ta=null,Ce.H=d,Ce.A=p,Et=c,ut!==null?0:(zt=null,ft=0,Xu(),cn)}function m3(){for(;ut!==null&&!vs();)ty(ut)}function ty(s){var r=xb(s.alternate,s,nr);s.memoizedProps=s.pendingProps,r===null?Hd(s):ut=r}function ny(s){var r=s,c=r.alternate;switch(r.tag){case 15:case 0:r=ub(c,r,r.pendingProps,r.type,void 0,ft);break;case 11:r=ub(c,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:bb(c,r),r=ut=Vv(r,nr),r=xb(c,r,nr)}s.memoizedProps=s.pendingProps,r===null?Hd(s):ut=r}function Ul(s,r,c,d){Wi=Ta=null,yp(r),jl=null,ic=0;var p=r.return;try{if(n3(s,p,r,c,ft)){cn=1,_d(s,$s(c,s.current)),ut=null;return}}catch(x){if(p!==null)throw ut=p,x;cn=1,_d(s,$s(c,s.current)),ut=null;return}r.flags&32768?(lt||d===1?s=!0:Ol||(ft&536870912)!==0?s=!1:(Fr=s=!0,(d===2||d===9||d===3||d===6)&&(d=Ln.current,d!==null&&d.tag===13&&(d.flags|=16384))),sy(r,s)):Hd(r)}function Hd(s){var r=s;do{if((r.flags&32768)!==0){sy(r,Fr);return}s=r.return;var c=a3(r.alternate,r,nr);if(c!==null){ut=c;return}if(r=r.sibling,r!==null){ut=r;return}ut=r=s}while(r!==null);cn===0&&(cn=5)}function sy(s,r){do{var c=l3(s.alternate,s);if(c!==null){c.flags&=32767,ut=c;return}if(c=s.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!r&&(s=s.sibling,s!==null)){ut=s;return}ut=s=c}while(s!==null);cn=6,ut=null}function iy(s,r,c,d,p,x,S,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&&(ut=zt=null,ft=0),Ia=r,ri=s,Ni=c,dm=p,Yb=d,g3(s,r,c,S,T,$,pe)}}function g3(s,r,c,d,p,x,S){var T=r.lanes|r.childLanes;if(um=T,T|=Qf,ol(s,c,T,d,p,x),zl=null,(c&335544064)===c?($l=qC(s),d=10262):($l=null,d=10256),(r.subtreeFlags&d)!==0||(r.flags&d)!==0?(s.callbackNode=null,s.callbackPriority=0,w3(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,x=Et,Et|=4;try{o3(s,r,c)}finally{Et=x,Re.p=p,Ce.T=d}}tn=1,Td?Dl=I3(S,s.containerInfo,$l,pm,mm,v3,gm,xm,x3):(pm(),mm(),gm())}function x3(s){if(tn!==0){var r=ri.onRecoverableError;r(s,{componentStack:null})}}function v3(){tn===3&&(tn=0,Ub(Ia,ri),tn=4)}function pm(){if(tn===1){tn=0;var s=ri,r=Ia,c=Ni,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 x=Et;Et|=4;try{gc=Rd=!1,Bb(r,s,c),c=Tm;var S=Dv(s.containerInfo),T=c.focusedElem,$=c.selectionRange;if(S!==T&&T&&T.ownerDocument&&Lv(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&&(S=nt,nt=Be,Be=S);var J=Ov(T,Be),V=Ov(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}}Ql=!!Em,Tm=Em=null}finally{Et=x,Re.p=p,Ce.T=d}}s.current=r,tn=2}}function mm(){if(tn===2){tn=0;var s=ri,r=Ia,c=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||c){c=Ce.T,Ce.T=null;var d=Re.p;Re.p=2;var p=Et;Et|=4;try{Rb(s,r.alternate,r)}finally{Et=p,Re.p=d,Ce.T=c}}tn=3}}function gm(){if(tn===4||tn===3){tn=0;var s=Dl;Dl=null,Un();var r=ri,c=Ia,d=Ni,p=Yb,x=(d&335544064)===d?10262:10256;if((c.subtreeFlags&x)!==0||(c.flags&x)!==0?tn=5:(tn=0,Ia=ri=null,ry(r,r.pendingLanes)),x=r.pendingLanes,x===0&&(Hr=null),va(d),c=c.stateNode,vt&&typeof vt.onCommitFiberRoot=="function")try{vt.onCommitFiberRoot(Nn,c,void 0,(c.current.flags&128)===128)}catch{}if(p!==null){c=Ce.T,x=Re.p,Re.p=2,Ce.T=null;try{for(var S=r.onRecoverableError,T=0;T<p.length;T++){var $=p[T];S($.value,{componentStack:$.stack})}}finally{Ce.T=c,Re.p=x}}if(p=zl,S=$l,$l=null,p!==null&&(zl=null,S===null&&(S=[]),s!==null))for($=0;$<p.length;$++)c=(0,p[$])(S),c!==void 0&&s.finished.finally(c);(Ni&3)!==0&&qd(),Ci(r),x=r.pendingLanes,(d&261930)!==0&&(x&42)!==0?r===Ud?yc++:(yc=0,Ud=r):(yc=0,Ud=null),_c(0)}}function ry(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 c=va(Ni),d=Ce.T,p=Re.p;try{Re.p=32>c?32:c,Ce.T=null,c=dm,dm=null;var x=ri,S=Ni;if(tn=0,Ia=ri=null,Ni=0,(Et&6)!==0)throw Error(i(331));var T=Et;if(Et|=4,qb(x.current),Fb(x,x.current,S,c),Et=T,_c(0,!1),vt&&typeof vt.onPostCommitFiberRoot=="function")try{vt.onPostCommitFiberRoot(Nn,x)}catch{}return!0}finally{Re.p=p,Ce.T=d,ry(s,r)}}function ay(s,r,c){r=$s(c,r),r=Lp(s.stateNode,r,2),s=Dr(s,r,2),s!==null&&(pi(s,2),Ci(s))}function Mt(s,r,c){if(s.tag===3)ay(s,s,c);else for(;r!==null;){if(r.tag===3){ay(r,s,c);break}else if(r.tag===1){var d=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(Hr===null||!Hr.has(d))){s=$s(c,s),c=nb(2),d=Dr(r,c,2),d!==null&&(sb(c,d,r,s),pi(d,2),Ci(d));break}}r=r.return}}function vm(s,r,c){var d=s.pingCache;if(d===null){d=s.pingCache=new d3;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(c)||(om=!0,p.add(c),s=b3.bind(null,s,r,c),r.then(s,s))}function b3(s,r,c){var d=s.pingCache;d!==null&&d.delete(r),s.pingedLanes|=s.suspendedLanes&c,s.warmLanes&=~c,zt===s&&(ft&c)===c&&((cn===4||cn===3&&(ft&62914560)===ft&&300>sn()-$d)&&(Et&2)===0?Pl(s,0):zd|=c,Ll===ft&&(Ll=0)),Ci(s)}function ly(s,r){r===0&&(r=Bu()),s=Na(s,r),s!==null&&(pi(s,r),Ci(s))}function y3(s){var r=s.memoizedState,c=0;r!==null&&(c=r.retryLane),ly(s,c)}function _3(s,r){var c=0;switch(s.tag){case 31:case 13:var d=s.stateNode,p=s.memoizedState;p!==null&&(c=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),ly(s,c)}function w3(s,r){return is(s,r)}var Fl=null,Il=null,bm=!1,Vd=!1,ym=!1,Vr=0;function Ci(s){s!==Il&&s.next===null&&(Il===null?Fl=Il=s:Il=Il.next=s),Vd=!0,bm||(bm=!0,k3())}function _c(s,r){if(!ym&&Vd){ym=!0;do for(var c=!1,d=Fl;d!==null;){if(s!==0){var p=d.pendingLanes;if(p===0)var x=0;else{var S=d.suspendedLanes,T=d.pingedLanes;x=(1<<31-en(42|s)+1)-1,x&=p&~(S&~T),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(c=!0,dy(d,x))}else x=ft,x=Ws(d,d===zt?x:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(x&3)===0||yr(d,x)||(c=!0,dy(d,x));d=d.next}while(c);ym=!1}}function S3(){oy()}function oy(){Vd=bm=!1;var s=0;Vr!==0&&D3()&&(s=Vr);for(var r=sn(),c=null,d=Fl;d!==null;){var p=d.next,x=cy(d,r);x===0?(d.next=null,c===null?Fl=p:c.next=p,p===null&&(Il=c)):(c=d,(s!==0||(x&3)!==0)&&(Vd=!0)),d=p}tn!==0&&tn!==5||_c(s),Vr!==0&&(Vr=0)}function cy(s,r){for(var c=s.suspendedLanes,d=s.pingedLanes,p=s.expirationTimes,x=s.pendingLanes&-62914561;0<x;){var S=31-en(x),T=1<<S,$=p[S];$===-1?((T&c)===0||(T&d)!==0)&&(p[S]=Af(T,r)):$<=r&&(s.expiredLanes|=T),x&=~T}if(r=zt,c=ft,c=Ws(s,s===r?c:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),d=s.callbackNode,c===0||s===r&&(At===2||At===9)||s.cancelPendingCommit!==null)return d!==null&&d!==null&&Ct(d),s.callbackNode=null,s.callbackPriority=0;if((c&3)===0||yr(s,c)){if(r=c&-c,r===s.callbackPriority)return r;switch(d!==null&&Ct(d),va(c)){case 2:case 8:c=le;break;case 32:c=xe;break;case 268435456:c=rt;break;default:c=xe}return d=uy.bind(null,s),c=is(c,d),s.callbackPriority=r,s.callbackNode=c,r}return d!==null&&d!==null&&Ct(d),s.callbackPriority=2,s.callbackNode=null,2}function uy(s,r){if(tn!==0&&tn!==5)return s.callbackNode=null,s.callbackPriority=0,null;var c=s.callbackNode;if(qd()&&s.callbackNode!==c)return null;var d=ft;return d=Ws(s,s===zt?d:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),d===0?null:(Xb(s,d,r),cy(s,sn()),s.callbackNode!=null&&s.callbackNode===c?uy.bind(null,s):null)}function dy(s,r){if(qd())return null;Xb(s,r,!0)}function k3(){$3(function(){(Et&6)!==0?is(Pi,S3):oy()})}function _m(){if(Vr===0){var s=Ra;s===0&&(s=br,br<<=1,(br&261888)===0&&(br=256)),Vr=s}return Vr}function hy(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:Rn(s)}function j3(s,r,c,d,p){if(r==="submit"&&c&&c.stateNode===p){var x=hy((p[Cn]||null).action),S=d.submitter;S&&(r=(r=S[Cn]||null)?hy(r.formAction):S.getAttribute("formAction"),r!==null&&(x=r,S=null));var T=new Vu("action","action",null,d,p);s.push({event:T,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(Vr!==0){var $=new FormData(p,S);Tp(c,{pending:!0,data:$,method:p.method,action:x},null,$)}}else typeof x=="function"&&(T.preventDefault(),$=new FormData(p,S),Tp(c,{pending:!0,data:$,method:p.method,action:x},x,$))},currentTarget:p}]})}}for(var wm=0;wm<Yf.length;wm++){var Sm=Yf[wm],N3=Sm.toLowerCase(),C3=Sm[0].toUpperCase()+Sm.slice(1);ti(N3,"on"+C3)}ti(Bv,"onAnimationEnd"),ti(Pv,"onAnimationIteration"),ti(Uv,"onAnimationStart"),ti("dblclick","onDoubleClick"),ti("focusin","onFocus"),ti("focusout","onBlur"),ti(zC,"onTransitionRun"),ti($C,"onTransitionStart"),ti(BC,"onTransitionCancel"),ti(Fv,"onTransitionEnd"),qi("onMouseEnter",["mouseout","mouseover"]),qi("onMouseLeave",["mouseout","mouseover"]),qi("onPointerEnter",["pointerout","pointerover"]),qi("onPointerLeave",["pointerout","pointerover"]),Hi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Hi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Hi("onBeforeInput",["compositionend","keypress","textInput","paste"]),Hi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Hi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Hi("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(" "),E3=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(wc));function fy(s,r){r=(r&4)!==0;for(var c=0;c<s.length;c++){var d=s[c],p=d.event;d=d.listeners;e:{var x=void 0;if(r)for(var S=d.length-1;0<=S;S--){var T=d[S],$=T.instance,ee=T.currentTarget;if(T=T.listener,$!==x&&p.isPropagationStopped())break e;x=T,p.currentTarget=ee;try{x(p)}catch(ae){Qu(ae)}p.currentTarget=null,x=$}else for(S=0;S<d.length;S++){if(T=d[S],$=T.instance,ee=T.currentTarget,T=T.listener,$!==x&&p.isPropagationStopped())break e;x=T,p.currentTarget=ee;try{x(p)}catch(ae){Qu(ae)}p.currentTarget=null,x=$}}}}function dt(s,r){var c=r[Do];c===void 0&&(c=r[Do]=new Set);var d=s+"__bubble";c.has(d)||(py(r,s,2,!1),c.add(d))}function km(s,r,c){var d=0;r&&(d|=4),py(c,s,d,r)}var Gd="_reactListening"+Math.random().toString(36).slice(2);function jm(s){if(!s[Gd]){s[Gd]=!0,Ks.forEach(function(c){c!=="selectionchange"&&(E3.has(c)||km(c,!1,s),km(c,!0,s))});var r=s.nodeType===9?s:s.ownerDocument;r===null||r[Gd]||(r[Gd]=!0,km("selectionchange",!1,r))}}function py(s,r,c,d){switch(s_(r)){case 2:var p=yE;break;case 8:p=_E;break;default:p=Vm}c=p.bind(null,r,c,s),p=void 0,!qo||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(p=!0),d?p!==void 0?s.addEventListener(r,c,{capture:!0,passive:p}):s.addEventListener(r,c,!0):p!==void 0?s.addEventListener(r,c,{passive:p}):s.addEventListener(r,c,!1)}function Nm(s,r,c,d,p){var x=d;if((r&1)===0&&(r&2)===0&&d!==null)e:for(;;){if(d===null)return;var S=d.tag;if(S===3||S===4){var T=d.stateNode.containerInfo;if(T===p)break;if(S===4)for(S=d.return;S!==null;){var $=S.tag;if(($===3||$===4)&&S.stateNode.containerInfo===p)return;S=S.return}for(;T!==null;){if(S=Ii(T),S===null)return;if($=S.tag,$===5||$===6||$===26||$===27){d=x=S;continue e}T=T.parentNode}}d=d.return}Ss(function(){var ee=x,ae=pl(c),pe=[];e:{var Z=Iv.get(s);if(Z!==void 0){var ie=Vu,Te=s;switch(s){case"keypress":if(ks(c)===0)break e;case"keydown":case"keyup":ie=hC;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(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ie=xv;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ie=eC;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ie=xC;break;case Bv:case Pv:case Uv:ie=sC;break;case Fv:ie=bC;break;case"scroll":case"scrollend":ie=ZN;break;case"wheel":ie=_C;break;case"copy":case"cut":case"paste":ie=rC;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ie=bv;break;case"submit":ie=mC;break;case"toggle":case"beforetoggle":ie=SC}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=Nr(V,J),fe!=null&&Be.push(Sc(V,fe,ne))),nt)break;V=V.return}0<Be.length&&(Z=new ie(Z,Te,null,c,ae),pe.push({event:Z,listeners:Be}))}}if((r&7)===0){e:{if(ie=s==="mouseover"||s==="pointerover",Z=s==="mouseout"||s==="pointerout",ie&&c!==kr&&(Te=c.relatedTarget||c.fromElement)&&(Ii(Te)||Te[gi]))break e;(Z||ie)&&(Te=ae.window===ae?ae:(ie=ae.ownerDocument)?ie.defaultView||ie.parentWindow:window,Z?(ie=c.relatedTarget||c.toElement,Z=ee,ie=ie?Ii(ie):null,ie!==null&&(nt=o(ie),Be=ie.tag,ie!==nt||Be!==5&&Be!==27&&Be!==6)&&(ie=null)):(Z=null,ie=ee),Z!==ie&&(Be=xv,fe="onMouseLeave",J="onMouseEnter",V="mouse",(s==="pointerout"||s==="pointerover")&&(Be=bv,fe="onPointerLeave",J="onPointerEnter",V="pointer"),nt=Z==null?Te:_r(Z),ne=ie==null?Te:_r(ie),Te=new Be(fe,V+"leave",Z,c,ae),Te.target=nt,Te.relatedTarget=ne,fe=null,Ii(ae)===ee&&(Be=new Be(J,V+"enter",ie,c,ae),Be.target=ne,Be.relatedTarget=nt,fe=Be),nt=fe,Be=Z&&ie?L(Z,ie,T3):null,Z!==null&&my(pe,Te,Z,Be,!1),ie!==null&&nt!==null&&my(pe,nt,ie,Be,!0)))}e:{if(Z=ee?_r(ee):window,ie=Z.nodeName&&Z.nodeName.toLowerCase(),ie==="select"||ie==="input"&&Z.type==="file")var Oe=Cv;else if(jv(Z))if(Ev)Oe=OC;else{Oe=MC;var pt=AC}else ie=Z.nodeName,!ie||ie.toLowerCase()!=="input"||Z.type!=="checkbox"&&Z.type!=="radio"?ee&&mt(ee.elementType)&&(Oe=Cv):Oe=RC;if(Oe&&(Oe=Oe(s,ee))){Nv(pe,Oe,c,ae);break e}pt&&pt(s,Z,ee)}switch(pt=ee?_r(ee):window,s){case"focusin":(jv(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,zv(pe,c,ae);break;case"selectionchange":if(DC)break;case"keydown":case"keyup":zv(pe,c,ae)}var Ie;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?Sv(s,c)&&(Ye="onCompositionEnd"):s==="keydown"&&c.keyCode===229&&(Ye="onCompositionStart");Ye&&(yv&&c.locale!=="ko"&&(ml||Ye!=="onCompositionStart"?Ye==="onCompositionEnd"&&ml&&(Ie=Vo()):(ei=ae,Hu="value"in ei?ei.value:ei.textContent,ml=!0)),pt=Yd(ee,Ye),0<pt.length&&(Ye=new vv(Ye,s,null,c,ae),pe.push({event:Ye,listeners:pt}),Ie?Ye.data=Ie:(Ie=kv(c),Ie!==null&&(Ye.data=Ie)))),(Ie=jC?NC(s,c):CC(s,c))&&(Ye=Yd(ee,"onBeforeInput"),0<Ye.length&&(pt=new vv("onBeforeInput","beforeinput",null,c,ae),pe.push({event:pt,listeners:Ye}),pt.data=Ie)),j3(pe,s,ee,c,ae)}fy(pe,r)})}function Sc(s,r,c){return{instance:s,listener:r,currentTarget:c}}function Yd(s,r){for(var c=r+"Capture",d=[];s!==null;){var p=s,x=p.stateNode;if(p=p.tag,p!==5&&p!==26&&p!==27||x===null||(p=Nr(s,c),p!=null&&d.unshift(Sc(s,p,x)),p=Nr(s,r),p!=null&&d.push(Sc(s,p,x))),s.tag===3)return d;s=s.return}return[]}function T3(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function my(s,r,c,d,p){for(var x=r._reactName,S=[];c!==null&&c!==d;){var T=c,$=T.alternate,ee=T.stateNode;if(T=T.tag,$!==null&&$===d)break;T!==5&&T!==26&&T!==27||ee===null||($=ee,p?(ee=Nr(c,x),ee!=null&&S.unshift(Sc(c,ee,$))):p||(ee=Nr(c,x),ee!=null&&S.push(Sc(c,ee,$)))),c=c.return}S.length!==0&&s.push({event:r,listeners:S})}var A3=/\r\n?/g,M3=/\u0000|\uFFFD/g;function gy(s){return(typeof s=="string"?s:""+s).replace(A3,`
|
|
50
|
-
`).replace(M3,"")}function xy(s,r){return r=gy(r),gy(s)===r}function Rt(s,r,c,d,p,x){switch(c){case"children":if(typeof d=="string")r==="body"||r==="textarea"&&d===""||Vi(s,d);else if(typeof d=="number"||typeof d=="bigint")r!=="body"&&Vi(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,c,d);break;case"style":it(s,d,x);return;case"data":if(r!=="object"){_a(s,"data",d);break}case"src":case"href":if(d===""&&(r!=="a"||c!=="href")){s.removeAttribute(c);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){s.removeAttribute(c);break}d=Rn(d),s.setAttribute(c,d);break;case"action":case"formAction":if(typeof d=="function"){s.setAttribute(c,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof x=="function"&&(c==="formAction"?(r!=="input"&&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(c);break}d=Rn(d),s.setAttribute(c,d);break;case"onClick":d!=null&&(s.onclick=Qn);return;case"onScroll":d!=null&&dt("scroll",s);return;case"onScrollEnd":d!=null&&dt("scrollend",s);return;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(i(61));if(c=d.__html,c!=null){if(p.children!=null)throw Error(i(60));(x!=null?x.__html:void 0)!==c&&(s.innerHTML=c)}}break;case"multiple":s.multiple=d&&typeof d!="function"&&typeof d!="symbol";break;case"muted":s.muted=d&&typeof d!="function"&&typeof d!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(d==null||typeof d=="function"||typeof d=="boolean"||typeof d=="symbol"){s.removeAttribute("xlink:href");break}c=Rn(d),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":d!=null&&typeof d!="function"&&typeof d!="symbol"?s.setAttribute(c,d):s.removeAttribute(c);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"credentialless":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":d&&typeof d!="function"&&typeof d!="symbol"?s.setAttribute(c,""):s.removeAttribute(c);break;case"capture":case"download":d===!0?s.setAttribute(c,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?s.setAttribute(c,d):s.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?s.setAttribute(c,d):s.removeAttribute(c);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?s.removeAttribute(c):s.setAttribute(c,d);break;case"popover":dt("beforetoggle",s),dt("toggle",s),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<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")c=gt.get(c)||c,fl(s,c,d);else return}bt=!0}function Cm(s,r,c,d,p,x){switch(c){case"style":it(s,d,x);return;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(i(61));if(c=d.__html,c!=null){if(p.children!=null)throw Error(i(60));(x!=null?x.__html:void 0)!==c&&(s.innerHTML=c)}}break;case"children":if(typeof d=="string")Vi(s,d);else if(typeof d=="number"||typeof d=="bigint")Vi(s,""+d);else return;break;case"onScroll":d!=null&&dt("scroll",s);return;case"onScrollEnd":d!=null&&dt("scrollend",s);return;case"onClick":d!=null&&(s.onclick=Qn);return;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":return;case"innerText":case"textContent":return;default:if(!dl.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(p=c.endsWith("Capture"),x=c.slice(2,p?c.length-7:void 0),r=s[Cn]||null,r=r!=null?r[c]:null,typeof r=="function"&&s.removeEventListener(x,r,p),typeof d=="function")){typeof r!="function"&&r!==null&&(c in s?s[c]=null:s.hasAttribute(c)&&s.removeAttribute(c)),s.addEventListener(x,d,p);break e}bt=!0,c in s?s[c]=d:d===!0?s.setAttribute(c,""):fl(s,c,d)}return}bt=!0}function $n(s,r,c){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":dt("error",s),dt("load",s);var d=!1,p=!1,x;for(x in c)if(c.hasOwnProperty(x)){var S=c[x];if(S!=null)switch(x){case"src":d=!0;break;case"srcSet":p=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:Rt(s,r,x,S,c,null)}}p&&Rt(s,r,"srcSet",c.srcSet,c,null),d&&Rt(s,r,"src",c.src,c,null);return;case"input":dt("invalid",s);var T=x=S=p=null,$=null,ee=null;for(d in c)if(c.hasOwnProperty(d)){var ae=c[d];if(ae!=null)switch(d){case"name":p=ae;break;case"type":S=ae;break;case"checked":$=ae;break;case"defaultChecked":ee=ae;break;case"value":x=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,c,null)}}Iu(s,x,T,$,ee,S,p,!1);return;case"select":dt("invalid",s),d=S=x=null;for(p in c)if(c.hasOwnProperty(p)&&(T=c[p],T!=null))switch(p){case"value":x=T;break;case"defaultValue":S=T;break;case"multiple":d=T;default:Rt(s,r,p,T,c,null)}r=x,c=S,s.multiple=!!d,r!=null?Sr(s,!!d,r,!1):c!=null&&Sr(s,!!d,c,!0);return;case"textarea":dt("invalid",s),x=p=d=null;for(S in c)if(c.hasOwnProperty(S)&&(T=c[S],T!=null))switch(S){case"value":d=T;break;case"defaultValue":p=T;break;case"children":x=T;break;case"dangerouslySetInnerHTML":if(T!=null)throw Error(i(91));break;default:Rt(s,r,S,T,c,null)}Io(s,d,p,x);return;case"option":for($ in c)if(c.hasOwnProperty($)&&(d=c[$],d!=null))switch($){case"selected":s.selected=d&&typeof d!="function"&&typeof d!="symbol";break;default:Rt(s,r,$,d,c,null)}return;case"dialog":dt("beforetoggle",s),dt("toggle",s),dt("cancel",s),dt("close",s);break;case"iframe":case"object":dt("load",s);break;case"video":case"audio":for(d=0;d<wc.length;d++)dt(wc[d],s);break;case"image":dt("error",s),dt("load",s);break;case"details":dt("toggle",s);break;case"embed":case"source":case"link":dt("error",s),dt("load",s);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ee in c)if(c.hasOwnProperty(ee)&&(d=c[ee],d!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:Rt(s,r,ee,d,c,null)}return;default:if(mt(r)){for(ae in c)c.hasOwnProperty(ae)&&(d=c[ae],d!==void 0&&Cm(s,r,ae,d,c,void 0));return}}for(T in c)c.hasOwnProperty(T)&&(d=c[T],d!=null&&Rt(s,r,T,d,c,null))}var R3={};function O3(s,r,c,d){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var p=null,x=null,S=null,T=null,$=null,ee=null,ae=null;for(ie in c){var pe=c[ie];if(c.hasOwnProperty(ie)&&pe!=null)switch(ie){case"checked":break;case"value":break;case"defaultValue":$=pe;default:d.hasOwnProperty(ie)||Rt(s,r,ie,null,d,pe)}}for(var Z in d){var ie=d[Z];if(pe=c[Z],d.hasOwnProperty(Z)&&(ie!=null||pe!=null))switch(Z){case"type":ie!==pe&&(bt=!0),x=ie;break;case"name":ie!==pe&&(bt=!0),p=ie;break;case"checked":ie!==pe&&(bt=!0),ee=ie;break;case"defaultChecked":ie!==pe&&(bt=!0),ae=ie;break;case"value":ie!==pe&&(bt=!0),S=ie;break;case"defaultValue":ie!==pe&&(bt=!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,S,T,$,ee,ae,x,p);return;case"select":ie=S=T=Z=null;for(x in c)if($=c[x],c.hasOwnProperty(x)&&$!=null)switch(x){case"value":break;case"multiple":ie=$;default:d.hasOwnProperty(x)||Rt(s,r,x,null,d,$)}for(p in d)if(x=d[p],$=c[p],d.hasOwnProperty(p)&&(x!=null||$!=null))switch(p){case"value":x!==$&&(bt=!0),Z=x;break;case"defaultValue":x!==$&&(bt=!0),T=x;break;case"multiple":x!==$&&(bt=!0),S=x;default:x!==$&&Rt(s,r,p,x,d,$)}r=T,c=S,d=ie,Z!=null?Sr(s,!!c,Z,!1):!!d!=!!c&&(r!=null?Sr(s,!!c,r,!0):Sr(s,!!c,c?[]:"",!1));return;case"textarea":ie=Z=null;for(T in c)if(p=c[T],c.hasOwnProperty(T)&&p!=null&&!d.hasOwnProperty(T))switch(T){case"value":break;case"children":break;default:Rt(s,r,T,null,d,p)}for(S in d)if(p=d[S],x=c[S],d.hasOwnProperty(S)&&(p!=null||x!=null))switch(S){case"value":p!==x&&(bt=!0),Z=p;break;case"defaultValue":p!==x&&(bt=!0),ie=p;break;case"children":break;case"dangerouslySetInnerHTML":if(p!=null)throw Error(i(91));break;default:p!==x&&Rt(s,r,S,p,d,x)}Fo(s,Z,ie);return;case"option":for(var Te in c)if(Z=c[Te],c.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=c[$],d.hasOwnProperty($)&&Z!==ie&&(Z!=null||ie!=null))switch($){case"selected":Z!==ie&&(bt=!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 c)Z=c[Be],c.hasOwnProperty(Be)&&Z!=null&&!d.hasOwnProperty(Be)&&Rt(s,r,Be,null,d,Z);for(ee in d)if(Z=d[ee],ie=c[ee],d.hasOwnProperty(ee)&&Z!==ie&&(Z!=null||ie!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":if(Z!=null)throw Error(i(137,r));break;default:Rt(s,r,ee,Z,d,ie)}return;default:if(mt(r)){for(var nt in c)Z=c[nt],c.hasOwnProperty(nt)&&Z!==void 0&&!d.hasOwnProperty(nt)&&Cm(s,r,nt,void 0,d,Z);for(ae in d)Z=d[ae],ie=c[ae],!d.hasOwnProperty(ae)||Z===ie||Z===void 0&&ie===void 0||Cm(s,r,ae,Z,d,ie);return}}for(var J in c)Z=c[J],c.hasOwnProperty(J)&&Z!=null&&!d.hasOwnProperty(J)&&Rt(s,r,J,null,d,Z);for(pe in d)Z=d[pe],ie=c[pe],!d.hasOwnProperty(pe)||Z===ie||Z==null&&ie==null||Rt(s,r,pe,Z,d,ie)}function vy(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function L3(){if(typeof performance.getEntriesByType=="function"){for(var s=0,r=0,c=performance.getEntriesByType("resource"),d=0;d<c.length;d++){var p=c[d],x=p.transferSize,S=p.initiatorType,T=p.duration;if(x&&T&&vy(S)){for(S=0,T=p.responseEnd,d+=1;d<c.length;d++){var $=c[d],ee=$.startTime;if(ee>T)break;var ae=$.transferSize,pe=$.initiatorType;ae&&vy(pe)&&($=$.responseEnd,S+=ae*($<T?1:(T-ee)/($-ee)))}if(--d,r+=8*(x+S)/(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 by(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 yy(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 _y(s,r,c,d){return c=kc(c).createElement(s),c[dn]=d,c[Cn]=r,$n(c,s,r),ln(c),c}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 D3(){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,z3=typeof clearTimeout=="function"?clearTimeout:void 0,wy=typeof Promise=="function"?Promise:void 0,Sy=typeof requestAnimationFrame=="function"?requestAnimationFrame:Rm,$3=typeof queueMicrotask=="function"?queueMicrotask:typeof wy<"u"?function(s){return wy.resolve(null).then(s).catch(B3)}:Rm;function B3(s){setTimeout(function(){throw s})}function Gr(s){return s==="head"}function ky(s,r){var c=r,d=0;do{var p=c.nextSibling;if(s.removeChild(c),p&&p.nodeType===8)if(c=p.data,c==="/$"||c==="/&"){if(d===0){s.removeChild(p),Xl(r);return}d--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")d++;else if(c==="html")Um(s.ownerDocument.documentElement);else if(c==="head"){c=s.ownerDocument.head,Um(c);for(var x=c.firstChild;x;){var S=x.nextSibling,T=x.nodeName;x[ya]||T==="SCRIPT"||T==="STYLE"||T==="LINK"&&x.rel.toLowerCase()==="stylesheet"||c.removeChild(x),x=S}}else c==="body"&&Um(s.ownerDocument.body);c=p}while(c);Xl(r)}function jy(s,r){var c=s;s=0;do{var d=c.nextSibling;if(c.nodeType===1?r?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(r?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),d&&d.nodeType===8)if(c=d.data,c==="/$"){if(s===0)break;s--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||s++;c=d}while(c)}function Ny(s,r,c){if(r=CSS.escape(r)!==r?"r-"+btoa(r).replace(/=/g,""):r,s.style.viewTransitionName=r,c!=null&&(s.style.viewTransitionClass=c),c=getComputedStyle(s),c.display==="inline"){if(r=s.getClientRects(),r.length===1)var d=1;else for(var p=d=0;p<r.length;p++){var x=r[p];0<x.width&&0<x.height&&d++}d===1&&(s=s.style,s.display=r.length===1?"inline-block":"block",s.marginTop="-"+c.paddingTop,s.marginBottom="-"+c.paddingBottom)}}function Cy(s,r){s=s.style,r=r.style;var c=r!=null?r.hasOwnProperty("viewTransitionName")?r.viewTransitionName:r.hasOwnProperty("view-transition-name")?r["view-transition-name"]:null:null;s.viewTransitionName=c==null||typeof c=="boolean"?"":(""+c).trim(),c=r!=null?r.hasOwnProperty("viewTransitionClass")?r.viewTransitionClass:r.hasOwnProperty("view-transition-class")?r["view-transition-class"]:null:null,s.viewTransitionClass=c==null||typeof c=="boolean"?"":(""+c).trim(),s.display==="inline-block"&&(r==null?s.display=s.margin="":(c=r.display,s.display=c==null||typeof c=="boolean"?"":c,c=r.margin,c!=null?s.margin=c:(c=r.hasOwnProperty("marginTop")?r.marginTop:r["margin-top"],s.marginTop=c==null||typeof c=="boolean"?"":c,r=r.hasOwnProperty("marginBottom")?r.marginBottom:r["margin-bottom"],s.marginBottom=r==null||typeof r=="boolean"?"":r)))}function P3(s,r,c){return c=c.ownerDocument.defaultView,{rect:s,abs:r.position==="absolute"||r.position==="fixed",clip:r.clipPath!=="none"||r.overflow!=="visible"||r.filter!=="none"||r.mask!=="none"||r.mask!=="none"||r.borderRadius!=="0px",view:0<=s.bottom&&0<=s.right&&s.top<=c.innerHeight&&s.left<=c.innerWidth}}function Om(s){var r=s.getBoundingClientRect(),c=getComputedStyle(s);return P3(r,c,s)}function U3(s){return s.documentElement.clientHeight}function F3(s){this.addEventListener("load",s),this.addEventListener("error",s)}function I3(s,r,c,d,p,x,S,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"&&(U3(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+=Qy(ne),J>Wd){Be.length=Te;break}ne=new Promise(F3.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(x,x);if(p(),ie)return ie.finished.then(x,x);x()},types:c});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))}}S()},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(),S()}}),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(),S(),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,c=s.getAnimations({subtree:!0}),d=[],p=0;p<c.length;p++){var x=c[p].effect;x!==null&&x.target===s&&x.pseudoElement===r&&d.push(c[p])}return d},Ha.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Ey(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,c){var d=null,p=null;if(!(c!=null&&typeof c!="boolean"&&(d=c.signal||null,d!==null&&d.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var x=this._eventListeners;if(Ay(x,s,r,c)===-1){var S=this,T=r;c!=null&&typeof c!="boolean"&&c.once===!0&&(T=function($){S.removeEventListener(s,r,c),typeof r=="function"?r.call(this,$):r.handleEvent($)}),d!==null&&(p=S.removeEventListener.bind(S,s,r,c),d.addEventListener("abort",p,{once:!0}),p=d.removeEventListener.bind(d,"abort",p)),d=Hl(c),x.push({type:s,listener:r,optionsOrUseCapture:c,attachedListener:T,cleanup:p}),v(this._fragmentFiber.child,!1,H3,s,T,d)}this._eventListeners=x}};function H3(s,r,c,d){return N(s).addEventListener(r,c,d),!1}Ms.prototype.removeEventListener=function(s,r,c){var d=this._eventListeners;if(d!==null&&(r=Ay(d,s,r,c),r!==-1)){var p=d[r];c=p.attachedListener;var x=p.cleanup;p=Hl(p.optionsOrUseCapture),v(this._fragmentFiber.child,!1,q3,s,c,p),d.splice(r,1),x!==null&&x()}};function q3(s,r,c,d){return N(s).removeEventListener(r,c,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 Ty(s){return s==null?"c=0":typeof s=="boolean"?"c="+(s?"1":"0"):"c="+(s.capture?"1":"0")}function Ay(s,r,c,d){if(s.length===0)return-1;d=Ty(d);for(var p=0;p<s.length;p++){var x=s[p];if(x.type===r&&x.listener===c&&Ty(x.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 c=this._eventListeners;if(c!==null&&0<c.length||!s.bubbles){var d=r.nodeType===9?r.createComment(""):document.createTextNode("");if(c)for(var p=0;p<c.length;p++){var x=c[p];d.addEventListener(x.type,x.attachedListener,Hl(x.optionsOrUseCapture))}if(r.appendChild(d),s=d.dispatchEvent(s),c)for(p=0;p<c.length;p++)x=c[p],d.removeEventListener(x.type,x.attachedListener,Hl(x.optionsOrUseCapture));return r.removeChild(d),s}return r.dispatchEvent(s)},Ms.prototype.focus=function(s){v(this._fragmentFiber.child,!0,My,s,void 0,void 0)};function My(s,r){return s.tag===6?!1:(s=N(s),nE(s,r))}Ms.prototype.focusLast=function(s){var r=[];v(this._fragmentFiber.child,!0,Lm,r,void 0,void 0);for(var c=r.length-1;0<=c&&!My(r[c],s);c--);};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,V3,s,void 0,void 0))};function V3(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,G3,s,void 0,void 0)};function G3(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,Y3,s,void 0,void 0);for(var c=r=0;c<ai.length;c++){var d=ai[c];d.fragmentInstance===this&&d.observer===s?s.unobserve(d.instance):ai[r++]=d}ai.length=r}};function Y3(s,r){return s.tag===6||(s=N(s),r.unobserve(s)),!1}var ai=[],Dm=!1;function Q3(s,r,c){ai.push({fragmentInstance:s,observer:r,instance:c}),Dm||(Dm=!0,sE(function(){Dm=!1;var d=ai;ai=[];for(var p=0;p<d.length;p++){var x=d[p];x.observer.unobserve(x.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 c=s.ownerDocument.createRange();c.selectNodeContents(s),r.push.apply(r,c.getClientRects())}else s=N(s),r.push.apply(r,s.getClientRects());return!1}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 c=[];v(this._fragmentFiber.child,!1,Lm,c,void 0,void 0);var d=N(r);if(c.length===0){if(c=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&&(c=r)}r=this._fragmentFiber;var p=d=c.compareDocumentPosition(s);return c===s?p=Node.DOCUMENT_POSITION_CONTAINS:d&Node.DOCUMENT_POSITION_CONTAINED_BY&&(c=_(r)[1],c===null?p=Node.DOCUMENT_POSITION_PRECEDING:(s=N(c).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(c[0]),p=N(c[c.length-1]);var x=y(this._fragmentFiber)?r.parentElement:d;if(x==null)return Node.DOCUMENT_POSITION_DISCONNECTED;d=x.compareDocumentPosition(r)&Node.DOCUMENT_POSITION_CONTAINED_BY,x=x.compareDocumentPosition(p)&Node.DOCUMENT_POSITION_CONTAINED_BY;var S=r.compareDocumentPosition(s),T=p.compareDocumentPosition(s),$=S&Node.DOCUMENT_POSITION_CONTAINED_BY||T&Node.DOCUMENT_POSITION_CONTAINED_BY;return T=d&&x&&S&Node.DOCUMENT_POSITION_FOLLOWING&&T&Node.DOCUMENT_POSITION_PRECEDING,r=d&&r===s||x&&p===s||$||T?Node.DOCUMENT_POSITION_CONTAINED_BY:!d&&r===s||!x&&p===s?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:S,r&Node.DOCUMENT_POSITION_DISCONNECTED||r&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||W3(r,this._fragmentFiber,c[0],c[c.length-1],s)?r:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function W3(s,r,c,d,p){var x=Ii(p);if(s&Node.DOCUMENT_POSITION_CONTAINED_BY){if(c=!!x)e:{for(;x!==null;){if(x.tag===7&&(x===r||x.alternate===r)){c=!0;break e}x=x.return}c=!1}return c}if(s&Node.DOCUMENT_POSITION_CONTAINS){if(x===null)return x=p.ownerDocument,p===x||p===x.documentElement||p===x.body;e:{for(x=r,r=b(r);x!==null;){if(!(x.tag!==5&&x.tag!==3&&x.tag!==27||x!==r&&x.alternate!==r)){x=!0;break e}x=x.return}x=!1}return x}return s&Node.DOCUMENT_POSITION_PRECEDING?((r=!!x)&&!(r=x===c)&&(r=L(c,x,M),r===null?r=!1:(v(r,!0,E,x,c),x=w,w=null,r=x!==null)),r):s&Node.DOCUMENT_POSITION_FOLLOWING?((r=!!x)&&!(r=x===d)&&(r=L(d,x,M),r===null?r=!1:(v(r,!0,R,x,d),x=w,C=w=null,r=x!==null)),r):!1}function Ry(s,r){var c=s.ownerDocument.createRange();c.selectNodeContents(s),s=c.getBoundingClientRect(),window.scrollTo(window.scrollX+s.left,r?window.scrollY+s.top:window.scrollY+s.bottom-window.innerHeight)}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 c=s!==!1;if(r.length===0){var d=_(this._fragmentFiber);if(d=c?d[1]||d[0]||b(this._fragmentFiber):d[0]||d[1],d===null)return;if(d.tag===6){s=N(d),Ry(s,c);return}if(d=N(d),d.nodeType!==9){if(d.nodeType===11){c="host"in d?d.host:null,c!==null&&c.scrollIntoView(s);return}d.scrollIntoView(s)}}for(d=c?r.length-1:0;d!==(c?-1:r.length);){var p=r[d];p.tag===6?(p=N(p),Ry(p,c)):N(p).scrollIntoView(s),d+=c?-1:1}};function K3(s,r){return s=N(s),Oy(s,r),!1}function Oy(s,r){s.reactFragments==null&&(s.reactFragments=new Set),s.reactFragments.add(r)}function Ly(s,r){var c=r._eventListeners;if(c!==null)for(var d=0;d<c.length;d++){var p=c[d];s.addEventListener(p.type,p.attachedListener,Hl(p.optionsOrUseCapture))}s.nodeType!==3&&(c=r._observers,c!==null&&c.forEach(function(x){for(var S=0,T=0;T<ai.length;T++){var $=ai[T];($.fragmentInstance!==r||$.observer!==x||$.instance!==s)&&(ai[S++]=$)}ai.length=S,x.observe(s)}),Oy(s,r))}function Z3(s,r){var c=r._eventListeners;if(c!==null)for(var d=0;d<c.length;d++){var p=c[d];s.removeEventListener(p.type,p.attachedListener,Hl(p.optionsOrUseCapture))}s.nodeType!==3&&(c=r._observers,c!==null&&c.forEach(function(x){typeof x.rootMargin=="string"?Q3(r,x,s):x.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 c=r;switch(r=r.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":zm(c),ul(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}s.removeChild(c)}}function J3(s,r,c,d){for(;s.nodeType===1;){var p=c;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(x=s.getAttribute("rel"),x==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(x!==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(x=s.getAttribute("src"),(x!==(p.src==null?null:p.src)||s.getAttribute("type")!==(p.type==null?null:p.type)||s.getAttribute("crossorigin")!==(p.crossOrigin==null?null:p.crossOrigin))&&x&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(r==="input"&&s.type==="hidden"){var x=p.name==null?null:""+p.name;if(p.type==="hidden"&&s.getAttribute("name")===x)return s}else return s;if(s=Is(s.nextSibling),s===null)break}return null}function eE(s,r,c){if(r==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!c||(s=Is(s.nextSibling),s===null))return null;return s}function Dy(s,r){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!r||(s=Is(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 tE(s,r){var c=s.ownerDocument;if(s.data==="$~")s._reactRetry=r;else if(s.data!=="$?"||c.readyState!=="loading")r();else{var d=function(){r(),c.removeEventListener("DOMContentLoaded",d)};c.addEventListener("DOMContentLoaded",d),s._reactRetry=d}}function Is(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 zy(s){s=s.nextSibling;for(var r=0;s;){if(s.nodeType===8){var c=s.data;if(c==="/$"||c==="/&"){if(r===0)return Is(s.nextSibling);r--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||r++}s=s.nextSibling}return null}function $y(s){s=s.previousSibling;for(var r=0;s;){if(s.nodeType===8){var c=s.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(r===0)return s;r--}else c!=="/$"&&c!=="/&"||r++}s=s.previousSibling}return null}function nE(s,r){function c(){d=!0}if(s.ownerDocument.activeElement===s)return!0;var d=!1;try{s.ownerDocument.addEventListener("focus",c,!0),(s.focus||HTMLElement.prototype.focus).call(s,r)}finally{s.ownerDocument.removeEventListener("focus",c,!0)}return d}function sE(s){Sy(function(){Sy(function(r){return s(r)})})}function By(s,r,c){switch(r=kc(c),s){case"html":if(s=r.documentElement,!s)throw Error(i(452));return s;case"head":if(s=r.head,!s)throw Error(i(453));return s;case"body":if(s=r.body,!s)throw Error(i(454));return s;default:throw Error(i(451))}}function Py(s,r,c){for(var d in c){var p=c[d];c.hasOwnProperty(d)&&p!=null&&Rt(s,r,d,null,R3,p)}c.dangerouslySetInnerHTML!=null&&(s.textContent=""),s.onclick===Qn&&(s.onclick=null),ul(s)}function Um(s){for(var r=s.attributes;r.length;)s.removeAttributeNode(r[0]);ul(s)}var Hs=new Map,Uy=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 sr=Re.d;Re.d={f:iE,r:rE,D:aE,C:lE,L:oE,m:cE,X:dE,S:uE,M:hE};function iE(){var s=sr.f(),r=Fd();return s||r}function rE(s){var r=xi(s);r!==null&&r.tag===5&&r.type==="form"?I1(r):sr.r(s)}var ql=typeof document>"u"?null:document;function Fy(s,r,c){var d=ql;if(d&&typeof r=="string"&&r){var p=ls(r);p='link[rel="'+s+'"][href="'+p+'"]',typeof c=="string"&&(p+='[crossorigin="'+c+'"]'),Uy.has(p)||(Uy.add(p),s={rel:s,crossOrigin:c,href:r},d.querySelector(p)===null&&(r=d.createElement("link"),$n(r,"link",s),ln(r),d.head.appendChild(r)))}}function aE(s){sr.D(s),Fy("dns-prefetch",s,null)}function lE(s,r){sr.C(s,r),Fy("preconnect",s,r)}function oE(s,r,c){sr.L(s,r,c);var d=ql;if(d&&s&&r){var p='link[rel="preload"][as="'+ls(r)+'"]';r==="image"&&c&&c.imageSrcSet?(p+='[imagesrcset="'+ls(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(p+='[imagesizes="'+ls(c.imageSizes)+'"]')):p+='[href="'+ls(s)+'"]';var x=p;switch(r){case"style":x=Vl(s);break;case"script":x=Gl(s)}if(!(Hs.has(x)||(s=F({rel:"preload",href:r==="image"&&c&&c.imageSrcSet?void 0:s,as:r},c),Hs.set(x,s),d.querySelector(p)!==null||r==="style"&&d.querySelector(Nc(x))||r==="script"&&d.querySelector(Cc(x))))){var S=d.createElement("link");$n(S,"link",s),r==="style"&&(S[cl]=!0,S.onload=S.onerror=function(){_s(S)}),ln(S),d.head.appendChild(S)}}}function cE(s,r){sr.m(s,r);var c=ql;if(c&&s){var d=r&&typeof r.as=="string"?r.as:"script",p='link[rel="modulepreload"][as="'+ls(d)+'"][href="'+ls(s)+'"]',x=p;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=Gl(s)}if(!Hs.has(x)&&(s=F({rel:"modulepreload",href:s},r),Hs.set(x,s),c.querySelector(p)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(Cc(x)))return}d=c.createElement("link"),$n(d,"link",s),ln(d),c.head.appendChild(d)}}}function uE(s,r,c){sr.S(s,r,c);var d=ql;if(d&&s){var p=as(d).hoistableStyles,x=Vl(s);r=r||"default";var S=p.get(x);if(!S){var T={loading:0,preload:null};if(S=d.querySelector(Nc(x)))T.loading=5;else{s=F({rel:"stylesheet",href:s,"data-precedence":r},c),(c=Hs.get(x))&&Fm(s,c);var $=S=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,Qd(S,r,d)}S={type:"stylesheet",instance:S,count:1,state:T},p.set(x,S)}}}function dE(s,r){sr.X(s,r);var c=ql;if(c&&s){var d=as(c).hoistableScripts,p=Gl(s),x=d.get(p);x||(x=c.querySelector(Cc(p)),x||(s=F({src:s,async:!0},r),(r=Hs.get(p))&&Im(s,r),x=c.createElement("script"),ln(x),$n(x,"link",s),c.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},d.set(p,x))}}function hE(s,r){sr.M(s,r);var c=ql;if(c&&s){var d=as(c).hoistableScripts,p=Gl(s),x=d.get(p);x||(x=c.querySelector(Cc(p)),x||(s=F({src:s,async:!0,type:"module"},r),(r=Hs.get(p))&&Im(s,r),x=c.createElement("script"),ln(x),$n(x,"link",s),c.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},d.set(p,x))}}function Iy(s,r,c,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 c.precedence=="string"&&typeof c.href=="string"?(c=Vl(c.href),r=as(p).hoistableStyles,d=r.get(c),d||(d={type:"style",instance:null,count:0,state:null},r.set(c,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){s=Vl(c.href);var x=as(p).hoistableStyles,S=x.get(s);if(S||(p=p.ownerDocument||p,S={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(s,S),(x=p.querySelector(Nc(s)))?x._p||(S.instance=x,S.state.loading=5):(x=Hs.get(s),x||(x={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},Hs.set(s,x)),fE(p,s,x,S.state))),r&&d===null)throw Error(i(528,""));return S}if(r&&d!==null)throw Error(i(529,""));return null;case"script":return r=c.async,c=c.src,typeof c=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(c=Gl(c),r=as(p).hoistableScripts,d=r.get(c),d||(d={type:"script",instance:null,count:0,state:null},r.set(c,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,s))}}function Vl(s){return'href="'+ls(s)+'"'}function Nc(s){return'link[rel="stylesheet"]['+s+"]"}function Hy(s){return F({},s,{"data-precedence":s.precedence,precedence:null})}function fE(s,r,c,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",c),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 qy(s,r,c){if(r.count++,r.instance===null)switch(r.type){case"style":var d=s.querySelector('style[data-href~="'+ls(c.href)+'"]');if(d)return r.instance=d,ln(d),d;var p=F({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return d=(s.ownerDocument||s).createElement("style"),ln(d),$n(d,"style",p),Qd(d,c.precedence,s),r.instance=d;case"stylesheet":p=Vl(c.href);var x=s.querySelector(Nc(p));if(x)return r.state.loading|=4,r.instance=x,ln(x),x;d=Hy(c),(p=Hs.get(p))&&Fm(d,p),x=(s.ownerDocument||s).createElement("link"),ln(x);var S=x;return S._p=new Promise(function(T,$){S.onload=T,S.onerror=$}),$n(x,"link",d),r.state.loading|=4,Qd(x,c.precedence,s),r.instance=x;case"script":return x=Gl(c.src),(p=s.querySelector(Cc(x)))?(r.instance=p,ln(p),p):(d=c,(p=Hs.get(x))&&(d=F({},c),Im(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,Qd(d,c.precedence,s));return r.instance}function Qd(s,r,c){for(var d=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),p=d.length?d[d.length-1]:null,x=p,S=0;S<d.length;S++){var T=d[S];if(T.dataset.precedence===r)x=T;else if(x!==p)break}x?x.parentNode.insertBefore(s,x.nextSibling):(r=c.nodeType===9?c.head:c,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 Im(s,r){s.crossOrigin==null&&(s.crossOrigin=r.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=r.referrerPolicy),s.integrity==null&&(s.integrity=r.integrity)}var Xd=null;function Vy(s,r,c){if(Xd===null){var d=new Map,p=Xd=new Map;p.set(c,d)}else p=Xd,d=p.get(c),d||(d=new Map,p.set(c,d));if(d.has(s))return d;for(d.set(s,null),c=c.getElementsByTagName(s),p=0;p<c.length;p++){var x=c[p];if(!(x[ya]||x[dn]||s==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var S=x.getAttribute(r)||"";S=s+S;var T=d.get(S);T?T.push(x):d.set(S,[x])}}return d}function Hm(s,r,c){s=s.ownerDocument||s,s.head.insertBefore(c,r==="title"?s.querySelector("head > title"):null)}function pE(s,r,c){if(c===1||r.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof r.precedence!="string"||typeof r.href!="string"||r.href==="")break;return!0;case"link":if(typeof r.rel!="string"||typeof r.href!="string"||r.href===""||r.onLoad||r.onError)break;switch(r.rel){case"stylesheet":return s=r.disabled,typeof r.precedence=="string"&&s==null;default:return!0}case"script":if(r.async&&typeof r.async!="function"&&typeof r.async!="symbol"&&!r.onLoad&&!r.onError&&r.src&&typeof r.src=="string")return!0}return!1}function Gy(s,r){return s==="img"&&r.src!=null&&r.src!==""&&r.onLoad==null&&r.loading!=="lazy"}function Yy(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function Qy(s){return(s.width||100)*(s.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function Xy(s,r){typeof r.decode=="function"&&(s.imgCount++,r.complete||(s.imgBytes+=Qy(r),s.suspenseyImages.push(r)),s=xE.bind(s),r.decode().then(s,s))}function mE(s,r,c,d){if(c.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var p=Vl(d.href),x=r.querySelector(Nc(p));if(x){r=x._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(s.count++,s=Ec.bind(s),r.then(s,s)),c.state.loading|=4,c.instance=x,ln(x);return}x=r.ownerDocument||r,d=Hy(d),(p=Hs.get(p))&&Fm(d,p),x=x.createElement("link"),ln(x);var S=x;S._p=new Promise(function(T,$){S.onload=T,S.onerror=$}),$n(x,"link",d),c.instance=x}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(c,r),(r=c.state.preload)&&(c.state.loading&3)===0&&(s.count++,c=Ec.bind(s),r.addEventListener("load",c),r.addEventListener("error",c))}}var Wd=0;function gE(s,r){return s.stylesheets&&s.count===0&&Zd(s,s.stylesheets),0<s.count||0<s.imgCount?function(c){var d=setTimeout(function(){if(s.stylesheets&&Zd(s,s.stylesheets),s.unsuspend){var x=s.unsuspend;s.unsuspend=null,x()}},6e4+r);0<s.imgBytes&&Wd===0&&(Wd=62500*L3());var p=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&Zd(s,s.stylesheets),s.unsuspend)){var x=s.unsuspend;s.unsuspend=null,x()}},(s.imgBytes>Wd?50:800)+r);return s.unsuspend=c,function(){s.unsuspend=null,clearTimeout(d),clearTimeout(p)}}:null}function Wy(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--,Wy(this)}function xE(){this.imgCount--,Wy(this)}var Kd=null;function Zd(s,r){s.stylesheets=null,s.unsuspend!==null&&(s.count++,Kd=new Map,r.forEach(vE,s),Kd=null,Ec.call(s))}function vE(s,r){if(!(r.state.loading&4)){var c=Kd.get(s);if(c)var d=c.get(null);else{c=new Map,Kd.set(s,c);for(var p=s.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x<p.length;x++){var S=p[x];(S.nodeName==="LINK"||S.getAttribute("media")!=="not all")&&(c.set(S.dataset.precedence,S),d=S)}d&&c.set(null,d)}p=r.instance,S=p.getAttribute("data-precedence"),x=c.get(S)||d,x===d&&c.set(null,p),c.set(S,p),this.count++,d=Ec.bind(this),p.addEventListener("load",d),p.addEventListener("error",d),x?x.parentNode.insertBefore(p,x.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:Ut,_currentValue2:Ut,_threadCount:0};function bE(s,r,c,d,p,x,S,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=Fi(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Fi(0),this.hiddenUpdates=Fi(null),this.identifierPrefix=d,this.onUncaughtError=p,this.onCaughtError=x,this.onRecoverableError=S,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=$,this.transitionTypes=null,this.incompleteTransitions=new Map}function Ky(s,r,c,d,p,x,S,T,$,ee,ae,pe){return s=new bE(s,r,c,S,$,ee,ae,pe,T),r=1,x===!0&&(r|=24),x=os(3,null,null,r),s.current=x,x.stateNode=s,r=ip(),r.refCount++,s.pooledCache=r,r.refCount++,x.memoizedState={element:d,isDehydrated:c,cache:r},op(x),s}function Zy(s){return s?(s=bl,s):bl}function Jy(s,r,c,d,p,x){p=Zy(p),d.context===null?d.context=p:d.pendingContext=p,d=Lr(r),d.payload={element:c},x=x===void 0?null:x,x!==null&&(d.callback=x),c=Dr(s,d,r),c!==null&&(hs(c,s,r),rc(c,s,r))}function e_(s,r){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var c=s.retryLane;s.retryLane=c!==0&&c<r?c:r}}function qm(s,r){e_(s,r),(s=s.alternate)&&e_(s,r)}function t_(s){if(s.tag===13||s.tag===31){var r=Na(s,67108864);r!==null&&hs(r,s,67108864),qm(s,67108864)}}function n_(s){if(s.tag===13||s.tag===31){var r=As();r=Lo(r);var c=Na(s,r);c!==null&&hs(c,s,r),qm(s,r)}}var Ql=!0;function yE(s,r,c,d){var p=Ce.T;Ce.T=null;var x=Re.p;try{Re.p=2,Vm(s,r,c,d)}finally{Re.p=x,Ce.T=p}}function _E(s,r,c,d){var p=Ce.T;Ce.T=null;var x=Re.p;try{Re.p=8,Vm(s,r,c,d)}finally{Re.p=x,Ce.T=p}}function Vm(s,r,c,d){if(Ql){var p=Gm(d);if(p===null)Nm(s,r,d,Jd,c),i_(s,d);else if(SE(p,s,r,c,d))d.stopPropagation();else if(i_(s,d),r&4&&-1<wE.indexOf(s)){for(;p!==null;){var x=xi(p);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var S=Xs(x.pendingLanes);if(S!==0){var T=x;for(T.pendingLanes|=2,T.entangledLanes|=2;S;){var $=1<<31-en(S);T.entanglements[1]|=$,S&=~$}Ci(x),(Et&6)===0&&(Bd=sn()+500,_c(0))}}break;case 31:case 13:T=Na(x,2),T!==null&&hs(T,x,2),Fd(),qm(x,2)}if(x=Gm(d),x===null&&Nm(s,r,d,Jd,c),x===p)break;p=x}p!==null&&d.stopPropagation()}else Nm(s,r,d,null,c)}}function Gm(s){return s=pl(s),Ym(s)}var Jd=null;function Ym(s){if(Jd=null,s=Ii(s),s!==null){var r=o(s);if(r===null)s=null;else{var c=r.tag;if(c===13){if(s=u(r),s!==null)return s;s=null}else if(c===31){if(s=h(r),s!==null)return s;s=null}else if(c===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;s=null}else r!==s&&(s=null)}}return Jd=s,null}function s_(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(vr()){case Pi:return 2;case le:return 8;case xe:case Se:return 32;case rt:return 268435456;default:return 32}default:return 32}}var Qm=!1,Yr=null,Qr=null,Xr=null,Tc=new Map,Ac=new Map,Wr=[],wE="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 i_(s,r){switch(s){case"focusin":case"focusout":Yr=null;break;case"dragenter":case"dragleave":Qr=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,c,d,p,x){return s===null||s.nativeEvent!==x?(s={blockedOn:r,domEventName:c,eventSystemFlags:d,nativeEvent:x,targetContainers:[p]},r!==null&&(r=xi(r),r!==null&&t_(r)),s):(s.eventSystemFlags|=d,r=s.targetContainers,p!==null&&r.indexOf(p)===-1&&r.push(p),s)}function SE(s,r,c,d,p){switch(r){case"focusin":return Yr=Mc(Yr,s,r,c,d,p),!0;case"dragenter":return Qr=Mc(Qr,s,r,c,d,p),!0;case"mouseover":return Xr=Mc(Xr,s,r,c,d,p),!0;case"pointerover":var x=p.pointerId;return Tc.set(x,Mc(Tc.get(x)||null,s,r,c,d,p)),!0;case"gotpointercapture":return x=p.pointerId,Ac.set(x,Mc(Ac.get(x)||null,s,r,c,d,p)),!0}return!1}function r_(s){var r=Ii(s.target);if(r!==null){var c=o(r);if(c!==null){if(r=c.tag,r===13){if(r=u(c),r!==null){s.blockedOn=r,rs(s.priority,function(){n_(c)});return}}else if(r===31){if(r=h(c),r!==null){s.blockedOn=r,rs(s.priority,function(){n_(c)});return}}else if(r===3&&c.stateNode.current.memoizedState.isDehydrated){s.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}s.blockedOn=null}function eh(s){if(s.blockedOn!==null)return!1;for(var r=s.targetContainers;0<r.length;){var c=Gm(s.nativeEvent);if(c===null){c=s.nativeEvent;var d=new c.constructor(c.type,c);kr=d,c.target.dispatchEvent(d),kr=null}else return r=xi(c),r!==null&&t_(r),s.blockedOn=c,!1;r.shift()}return!0}function a_(s,r,c){eh(s)&&c.delete(r)}function kE(){Qm=!1,Yr!==null&&eh(Yr)&&(Yr=null),Qr!==null&&eh(Qr)&&(Qr=null),Xr!==null&&eh(Xr)&&(Xr=null),Tc.forEach(a_),Ac.forEach(a_)}function th(s,r){s.blockedOn===r&&(s.blockedOn=null,Qm||(Qm=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,kE)))}var nh=null;function l_(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 c=s[r],d=s[r+1],p=s[r+2];if(typeof d!="function"){if(Ym(d||c)===null)continue;break}var x=xi(c);x!==null&&(s.splice(r,3),r-=3,Tp(x,{pending:!0,data:p,method:c.method,action:d},d,p))}}))}function Xl(s){function r($){return th($,s)}Yr!==null&&th(Yr,s),Qr!==null&&th(Qr,s),Xr!==null&&th(Xr,s),Tc.forEach(r),Ac.forEach(r);for(var c=0;c<Wr.length;c++){var d=Wr[c];d.blockedOn===s&&(d.blockedOn=null)}for(;0<Wr.length&&(c=Wr[0],c.blockedOn===null);)r_(c),c.blockedOn===null&&Wr.shift();if(c=(s.ownerDocument||s).$$reactFormReplay,c!=null)for(d=0;d<c.length;d+=3){var p=c[d],x=c[d+1],S=p[Cn]||null;if(typeof x=="function")S||l_(c);else if(S){var T=null;if(x&&x.hasAttribute("formAction")){if(p=x,S=x[Cn]||null)T=S.formAction;else if(Ym(p)!==null)continue}else T=S.action;typeof T=="function"?c[d+1]=T:(c.splice(d,3),d-=3),l_(c)}}}function o_(){function s(x){x.canIntercept&&x.info==="react-transition"&&x.intercept({handler:function(){return new Promise(function(S){return p=S})},focusReset:"manual",scroll:"manual"})}function r(){p!==null&&(p(),p=null),d||setTimeout(c,20)}function c(){if(!d&&!navigation.transition){var x=navigation.currentEntry;x&&x.url!=null&&navigation.navigate(x.url,{state:x.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var d=!1,p=null;return navigation.addEventListener("navigate",s),navigation.addEventListener("navigatesuccess",r),navigation.addEventListener("navigateerror",r),setTimeout(c,100),function(){d=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",r),navigation.removeEventListener("navigateerror",r),p!==null&&(p(),p=null)}}}function Xm(s){this._internalRoot=s}sh.prototype.render=Xm.prototype.render=function(s){var r=this._internalRoot;if(r===null)throw Error(i(409));var c=r.current,d=As();Jy(c,d,s,r,null,null)},sh.prototype.unmount=Xm.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var r=s.containerInfo;Jy(s.current,2,null,s,null,null),Fd(),r[gi]=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 c=0;c<Wr.length&&r!==0&&r<Wr[c].priority;c++);Wr.splice(c,0,s),c===0&&r_(s)}};var c_=t.version;if(c_!=="19.3.0")throw Error(i(527,c_,"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?g(s):null,s=s===null?null:s.stateNode,s};var jE={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(jE),vt=ih}catch{}}return Oc.createRoot=function(s,r){if(!a(s))throw Error(i(299));var c=!1,d="",p=Z1,x=J1,S=eb;return r!=null&&(r.unstable_strictMode===!0&&(c=!0),r.identifierPrefix!==void 0&&(d=r.identifierPrefix),r.onUncaughtError!==void 0&&(p=r.onUncaughtError),r.onCaughtError!==void 0&&(x=r.onCaughtError),r.onRecoverableError!==void 0&&(S=r.onRecoverableError)),r=Ky(s,1,!1,null,null,c,d,null,p,x,S,o_),s[gi]=r.current,jm(s),new Xm(r)},Oc.hydrateRoot=function(s,r,c){if(!a(s))throw Error(i(299));var d=!1,p="",x=Z1,S=J1,T=eb,$=null;return c!=null&&(c.unstable_strictMode===!0&&(d=!0),c.identifierPrefix!==void 0&&(p=c.identifierPrefix),c.onUncaughtError!==void 0&&(x=c.onUncaughtError),c.onCaughtError!==void 0&&(S=c.onCaughtError),c.onRecoverableError!==void 0&&(T=c.onRecoverableError),c.formState!==void 0&&($=c.formState)),r=Ky(s,1,!0,r,c??null,d,p,$,x,S,T,o_),r.context=Zy(null),c=r.current,d=As(),d=Lo(d),p=Lr(d),p.callback=null,Dr(c,p,d),c=d,r.current.lanes=c,pi(r,c),Ci(r),s[gi]=r.current,jm(s),new sh(r)},Oc.version="19.3.0",Oc}var __;function BE(){if(__)return Zm.exports;__=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=$E(),Zm.exports}var PE=BE();const w_=e=>{let t;const n=new Set,i=(m,g)=>{const v=typeof m=="function"?m(t):m;if(!Object.is(v,t)){const b=t;t=g??(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},UE=(e=>e?w_(e):w_),FE=e=>e;function IE(e,t=FE){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 S_=e=>{const t=UE(e),n=i=>IE(t,i);return Object.assign(n,t),n},HE=(e=>e?S_(e):S_),h0="companion_auth_token";function k_(){return typeof window>"u"?null:localStorage.getItem(h0)||null}const qE=e=>({authToken:k_(),isAuthenticated:k_()!==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 VE(e,t){if(!e.has(t))return e;const n=new Set(e);return n.delete(t),n}function GE(){if(typeof window>"u")return new Map;try{return new Map(JSON.parse(localStorage.getItem("cc-session-names")||"[]"))}catch{return new Map}}function YE(){return typeof window>"u"?null:localStorage.getItem("cc-current-session")||null}function QE(){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:YE(),connectionStatus:new Map,cliConnected:new Map,cliReconnecting:new Map,sessionStatus:new Map,previousPermissionMode:new Map,sessionNames:GE(),recentlyRenamed:new Set,prStatus:new Map,linkedLinearIssues:new Map,mcpServers:new Map,rateLimit:new Map,collapsedProjects:QE(),setCurrentSession:t=>{t?localStorage.setItem("cc-current-session",t):localStorage.removeItem("cc-current-session"),e({currentSessionId:t})},addSession:t=>e(n=>{const i=new Map(n.sessions);i.set(t.session_id,t);const a=new Map(n.messages);return a.has(t.session_id)||a.set(t.session_id,[]),{sessions:i,messages:a}}),updateSession:(t,n)=>e(i=>{const a=new Map(i.sessions),o=a.get(t);return o&&a.set(t,{...o,...n}),{sessions:a}}),removeSession:t=>e(n=>{const i=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:VE(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),o=a.get(t);return o?(a.set(t,{...o,...n}),{sessions:a}):{}}),setSessionMagicUi:(t,n)=>e(i=>{const a=new Map(i.sessions),o=a.get(t);return o?(a.set(t,{...o,magicUiActive:n}),{sessions:a}):{}})}),WE=e=>({messages:new Map,streaming:new Map,streamingStartedAt:new Map,streamingOutputTokens:new Map,lastActivityAt:new Map,appendMessage:(t,n)=>e(i=>{const a=i.messages.get(t)||[];if(n.id&&a.some(u=>u.id===n.id))return i;const o=new Map(i.messages);return o.set(t,[...a,n]),{messages:o}}),setMessages:(t,n)=>e(i=>{const a=new Map(i.messages);return a.set(t,n),{messages:a}}),updateLastAssistantMessage:(t,n)=>e(i=>{const a=new Map(i.messages),o=[...a.get(t)||[]];for(let u=o.length-1;u>=0;u--)if(o[u].role==="assistant"){o[u]=n(o[u]);break}return a.set(t,o),{messages:a}}),setStreaming:(t,n)=>e(i=>{const a=new Map(i.streaming);return n===null?a.delete(t):a.set(t,n),{streaming:a}}),setStreamingStats:(t,n)=>e(i=>{const a=new Map(i.streamingStartedAt),o=new Map(i.streamingOutputTokens);return n===null?(a.delete(t),o.delete(t)):(n.startedAt!==void 0&&a.set(t,n.startedAt),n.outputTokens!==void 0&&o.set(t,n.outputTokens)),{streamingStartedAt:a,streamingOutputTokens:o}}),setLastActivity:(t,n)=>e(i=>{const a=new Map(i.lastActivityAt);return a.set(t,n),{lastActivityAt:a}}),promptSuggestions:new Map,setPromptSuggestions:(t,n)=>e(i=>{const a=new Map(i.promptSuggestions);return a.set(t,n),{promptSuggestions:a}}),clearPromptSuggestions:t=>e(n=>{const i=new Map(n.promptSuggestions);return i.delete(t),{promptSuggestions:i}})}),KE=e=>({pendingPermissions:new Map,aiResolvedPermissions:new Map,addPermission:(t,n)=>e(i=>{const a=new Map(i.pendingPermissions),o=new Map(a.get(t)||[]);return o.set(n.request_id,n),a.set(t,o),{pendingPermissions:a}}),removePermission:(t,n)=>e(i=>{const a=new Map(i.pendingPermissions),o=a.get(t);if(o){const u=new Map(o);u.delete(n),a.set(t,u)}return{pendingPermissions:a}}),addAiResolvedPermission:(t,n)=>e(i=>{const a=new Map(i.aiResolvedPermissions),o=[...a.get(t)||[],n];return o.length>50&&o.splice(0,o.length-50),a.set(t,o),{aiResolvedPermissions:a}}),clearAiResolvedPermissions:t=>e(n=>{const i=new Map(n.aiResolvedPermissions);return i.delete(t),{aiResolvedPermissions:i}})}),ZE=e=>({sessionTasks:new Map,sessionProcesses:new Map,sessionBackgroundAgents:new Map,changedFilesTick:new Map,gitChangedFilesCount:new Map,toolProgress:new Map,toolActivity:new Map,addTask:(t,n)=>e(i=>{const a=new Map(i.sessionTasks),o=[...a.get(t)||[],n];return a.set(t,o),{sessionTasks:a}}),setTasks:(t,n)=>e(i=>{const a=new Map(i.sessionTasks);return a.set(t,n),{sessionTasks:a}}),updateTask:(t,n,i)=>e(a=>{const o=new Map(a.sessionTasks),u=o.get(t);return u&&o.set(t,u.map(h=>h.id===n?{...h,...i}:h)),{sessionTasks:o}}),addProcess:(t,n)=>e(i=>{const a=new Map(i.sessionProcesses),o=[...a.get(t)||[],n];return a.set(t,o),{sessionProcesses:a}}),updateProcess:(t,n,i)=>e(a=>{const o=new Map(a.sessionProcesses),u=o.get(t);return u&&o.set(t,u.map(h=>h.taskId===n?{...h,...i}:h)),{sessionProcesses:o}}),updateProcessByToolUseId:(t,n,i)=>e(a=>{const o=new Map(a.sessionProcesses),u=o.get(t);return u&&o.set(t,u.map(h=>h.toolUseId===n?{...h,...i}:h)),{sessionProcesses:o}}),addBackgroundAgent:(t,n)=>e(i=>{const a=new Map(i.sessionBackgroundAgents),o=[...a.get(t)||[],n];return a.set(t,o),{sessionBackgroundAgents:a}}),updateBackgroundAgent:(t,n,i)=>e(a=>{const o=new Map(a.sessionBackgroundAgents),u=o.get(t);return u&&o.set(t,u.map(h=>h.toolUseId===n?{...h,...i}:h)),{sessionBackgroundAgents:o}}),bumpChangedFilesTick:t=>e(n=>{const i=new Map(n.changedFilesTick);return i.set(t,(i.get(t)??0)+1),{changedFilesTick:i}}),setGitChangedFilesCount:(t,n)=>e(i=>{const a=new Map(i.gitChangedFilesCount);return a.set(t,n),{gitChangedFilesCount:a}}),setToolProgress:(t,n,i)=>e(a=>{const o=new Map(a.toolProgress),u=new Map(o.get(t)||[]);return u.set(n,i),o.set(t,u),{toolProgress:o}}),clearToolProgress:(t,n)=>e(i=>{const a=new Map(i.toolProgress);if(n){const o=a.get(t);if(o){const u=new Map(o);u.delete(n),a.set(t,u)}}else a.delete(t);return{toolProgress:a}}),setToolActivity:(t,n)=>e(i=>{const a=new Map(i.toolActivity);return n.length===0?a.delete(t):a.set(t,n),{toolActivity:a}}),addToolActivity:(t,n)=>e(i=>{const a=new Map(i.toolActivity),o=[...a.get(t)||[]],u=o.findIndex(h=>h.toolUseId===n.toolUseId);if(u>=0){const h=o[u];o[u]={...h,...n,startedAt:h.startedAt,completedAt:n.completedAt??h.completedAt,elapsedSeconds:Math.max(h.elapsedSeconds,n.elapsedSeconds),isError:h.isError||n.isError}}else o.push(n);return a.set(t,o),{toolActivity:a}}),updateToolActivity:(t,n,i)=>e(a=>{const o=new Map(a.toolActivity),u=o.get(t);return u&&o.set(t,u.map(h=>h.toolUseId===n?{...h,...i}:h)),{toolActivity:o}})}),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"]}],JE=pr.map(e=>e.id),$2="cc-task-panel-config";function f0(){return{order:[...JE],enabled:Object.fromEntries(pr.map(e=>[e.id,!0]))}}function e4(){if(typeof window>"u")return f0();try{const e=localStorage.getItem($2);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($2,JSON.stringify(e))}catch{}}function t4(){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 n4(){if(typeof window>"u")return!0;const e=localStorage.getItem("cc-notification-sound");return e!==null?e==="true":!0}function s4(){if(typeof window>"u")return!1;const e=localStorage.getItem("cc-notification-desktop");return e!==null?e==="true":!1}function B2(){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 i4(){if(typeof window>"u")return"standard";const e=window.localStorage.getItem("cc-density");return e==="standard"||e==="compact"?e:"standard"}const r4=e=>({darkMode:t4(),notificationSound:n4(),notificationDesktop:s4(),sidebarOpen:typeof window<"u"?window.innerWidth>=768:!0,taskPanelOpen:typeof window<"u"?window.innerWidth>=1024:!0,taskPanelConfig:e4(),taskPanelConfigMode:!1,homeResetKey:0,publicUrl:"",magicUiAvailable:!1,activeTab:"chat",chatTabReentryTickBySession:new Map,diffPanelSelectedFile:new Map,diffBase:B2(),density:i4(),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 o={...n.taskPanelConfig,order:i};return ah(o),{taskPanelConfig:o}}),moveSectionDown:t=>e(n=>{const i=[...n.taskPanelConfig.order],a=i.indexOf(t);if(a<0||a>=i.length-1)return n;[i[a],i[a+1]]=[i[a+1],i[a]];const o={...n.taskPanelConfig,order:i};return ah(o),{taskPanelConfig:o}}),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 P2(){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 a4=e=>({quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalPlacement:P2(),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(g=>g.cwd===t.cwd&&g.containerId===t.containerId);if(m)return{quickTerminalOpen:!0,activeQuickTerminalTabId:m.id}}const i=t.target==="docker",a=n.quickTerminalNextHostIndex,o=n.quickTerminalNextDockerIndex,u=i?a:a+1,h=i?o+1:o,f={id:`${t.target}-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,label:i?`Docker ${o}`:a===1?"Terminal":`Terminal ${a}`,cwd:t.cwd,containerId:t.containerId};return{quickTerminalOpen:!0,quickTerminalTabs:[...n.quickTerminalTabs,f],activeQuickTerminalTabId:f.id,quickTerminalNextHostIndex:u,quickTerminalNextDockerIndex:h}}),closeQuickTerminalTab:t=>e(n=>{var o;const i=n.quickTerminalTabs.filter(u=>u.id!==t),a=n.activeQuickTerminalTabId===t?((o=i[0])==null?void 0:o.id)||null:n.activeQuickTerminalTabId;return{quickTerminalTabs:i,activeQuickTerminalTabId:a,quickTerminalOpen:i.length>0?n.quickTerminalOpen:!1}}),setActiveQuickTerminalTabId:t=>e({activeQuickTerminalTabId:t}),resetQuickTerminal:()=>e({quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalNextHostIndex:1,quickTerminalNextDockerIndex:1}),setTerminalOpen:t=>e({terminalOpen:t}),setTerminalCwd:t=>e({terminalCwd:t}),setTerminalId:t=>e({terminalId:t}),openTerminal:t=>e({terminalOpen:!0,terminalCwd:t}),closeTerminal:()=>e({terminalOpen:!1,terminalCwd:null,terminalId:null})});function l4(){return typeof window>"u"?null:localStorage.getItem("cc-update-dismissed")||null}const o4=e=>({updateInfo:null,updateDismissedVersion:l4(),updateOverlayActive:!1,dockerUpdateDialogOpen:!1,creationProgress:null,creationError:null,creationDraft:null,sessionCreating:!1,sessionCreatingBackend:null,claudeCompatInfo:null,setUpdateInfo:t=>e({updateInfo:t}),dismissUpdate:t=>{localStorage.setItem("cc-update-dismissed",t),e({updateDismissedVersion:t})},setUpdateOverlayActive:t=>e({updateOverlayActive:t}),setDockerUpdateDialogOpen:t=>e({dockerUpdateDialogOpen:t}),addCreationProgress:t=>e(n=>{const i=n.creationProgress||[],a=i.findIndex(o=>o.step===t.step);if(a>=0){const o=[...i];return o[a]=t,{creationProgress:o}}return{creationProgress:[...i,t]}}),clearCreation:()=>e({creationProgress:null,creationError:null,creationDraft:null,sessionCreating:!1,sessionCreatingBackend:null}),setSessionCreating:(t,n)=>e({sessionCreating:t,sessionCreatingBackend:n??null}),setCreationError:(t,n)=>e({creationError:t,creationDraft:n??null}),setClaudeCompatInfo:t=>e({claudeCompatInfo:t})}),c4=e=>({magicUiState:new Map,setMagicUiState:(t,n)=>e(i=>{const a=i.magicUiState.get(t);if(a&&a.version>n.version)return{};const o=new Map(i.magicUiState);return o.set(t,n),{magicUiState:o}}),clearMagicUiState:t=>e(n=>{if(!n.magicUiState.has(t))return{};const i=new Map(n.magicUiState);return i.delete(t),{magicUiState:i}})}),K=HE((...e)=>({...qE(...e),...XE(...e),...WE(...e),...KE(...e),...ZE(...e),...r4(...e),...a4(...e),...o4(...e),...c4(...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:B2(),quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalPlacement:P2(),quickTerminalNextHostIndex:1,quickTerminalNextDockerIndex:1,terminalOpen:!1,terminalCwd:null,terminalId:null})}})),u4=Object.freeze(Object.defineProperty({__proto__:null,useStore:K},Symbol.toStringTag,{value:"Module"})),d4="Your Claude login has expired or is invalid — re-authenticate (run `claude login` in a terminal), then use Reconnect to resume this session.",h4=/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 f4(e){return h4.test(e)}function p4(e){return e.is_error?e.api_error_status===401||e.api_error_status===403?!0:f4(`${e.result??""} ${(e.errors??[]).join(" ")}`):!1}const j_=["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"],N_=["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 C_(){const e=j_[Math.floor(Math.random()*j_.length)],t=N_[Math.floor(Math.random()*N_.length)];return`${e} ${t}`}function U2(e){for(let t=0;t<100;t++){const n=C_();if(!e.has(n))return n}return C_()}let ng=null;function m4(){return ng||(ng=new AudioContext),ng}function g4(){try{const e=m4();e.state==="suspended"&&e.resume();const t=e.currentTime,n=e.createOscillator(),i=e.createGain();n.type="sine",n.frequency.setValueAtTime(659.25,t),i.gain.setValueAtTime(.3,t),i.gain.exponentialRampToValueAtTime(.001,t+.3),n.connect(i),i.connect(e.destination),n.start(t),n.stop(t+.3);const a=e.createOscillator(),o=e.createGain();a.type="sine",a.frequency.setValueAtTime(783.99,t+.15),o.gain.setValueAtTime(.001,t),o.gain.setValueAtTime(.3,t+.15),o.gain.exponentialRampToValueAtTime(.001,t+.5),a.connect(o),o.connect(e.destination),a.start(t+.15),a.stop(t+.5)}catch{}}class F2{diff(t,n,i={}){let a;typeof i=="function"?(a=i,i={}):"callback"in i&&(a=i.callback);const o=this.castInput(t,i),u=this.castInput(n,i),h=this.removeEmpty(this.tokenize(o,i)),f=this.removeEmpty(this.tokenize(u,i));return this.diffWithOptionsObj(h,f,i,a)}diffWithOptionsObj(t,n,i,a){var o;const u=C=>{if(C=this.postProcess(C,i),a){setTimeout(function(){a(C)},0);return}else return C},h=n.length,f=t.length;let m=1,g=h+f;i.maxEditLength!=null&&(g=Math.min(g,i.maxEditLength));const v=(o=i.timeout)!==null&&o!==void 0?o:1/0,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 w=()=>{for(let C=Math.max(j,-m);C<=Math.min(N,m);C+=2){let E;const R=y[C-1],M=y[C+1];R&&(y[C-1]=void 0);let L=!1;if(M){const D=M.oldPos-C;L=M&&0<=D&&D<h}const F=R&&R.oldPos+1<f;if(!L&&!F){y[C]=void 0;continue}if(!F||L&&R.oldPos<M.oldPos?E=this.addToPath(M,!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>g||Date.now()>b)return a(void 0);w()||C()},0)})();else for(;m<=g&&Date.now()<=b;){const C=w();if(C)return C}}addToPath(t,n,i,a,o){const u=t.lastComponent;return u&&!o.oneChangePerToken&&u.added===n&&u.removed===i?{oldPos:t.oldPos+a,lastComponent:{count:u.count+1,added:n,removed:i,previousComponent:u.previousComponent}}:{oldPos:t.oldPos+a,lastComponent:{count:1,added:n,removed:i,previousComponent:u}}}extractCommon(t,n,i,a,o){const u=n.length,h=i.length;let f=t.oldPos,m=f-a,g=0;for(;m+1<u&&f+1<h&&this.equals(i[f+1],n[m+1],o);)m++,f++,g++,o.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return g&&!o.oneChangePerToken&&(t.lastComponent={count:g,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=f,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 o;for(;t;)a.push(t),o=t.previousComponent,delete t.previousComponent,t=o;a.reverse();const u=a.length;let h=0,f=0,m=0;for(;h<u;h++){const g=a[h];if(g.removed)g.value=this.join(i.slice(m,m+g.count)),m+=g.count;else{if(!g.added&&this.useLongestToken){let v=n.slice(f,f+g.count);v=v.map(function(b,y){const _=i[m+y];return _.length>b.length?_:b}),g.value=this.join(v)}else g.value=this.join(n.slice(f,f+g.count));f+=g.count,g.added||(m+=g.count)}}return a}}function E_(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 T_(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 A_(e,t){return t.slice(0,x4(e,t))}function x4(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let i=t.length;e.length<t.length&&(i=e.length);const a=Array(i);let o=0;a[0]=0;for(let u=1;u<i;u++){for(t[u]==t[o]?a[u]=a[o]:a[u]=o;o>0&&t[u]!=t[o];)o=a[o];t[u]==t[o]&&o++}o=0;for(let u=n;u<e.length;u++){for(;o>0&&e[u]!=t[o];)o=a[o];e[u]==t[o]&&o++}return o}function I2(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 ao(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[ao(e),g0(e)];if(t.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');const n=I2(e,t),i=n[0],a=n[n.length-1],o=/\s/.test(i)?i:"",u=/\s/.test(a)?a:"";return[o,u]}const M_="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}",v4=new RegExp(`[${M_}]+|\\s+|[^${M_}]`,"ug");class b4 extends F2{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=I2(t,u)}else i=t.match(v4)||[];const a=[];let o=null;return i.forEach(u=>{/\s/.test(u)?o==null?a.push(u):a.push(a.pop()+u):o!=null&&/\s/.test(o)?a[a.length-1]==o?a.push(a.pop()+u):a.push(o+u):a.push(u),o=u}),a}join(t){return t.map((n,i)=>i==0?n:n.replace(/^\s+/,"")).join("")}postProcess(t,n){if(!t||n.oneChangePerToken)return t;let i=null,a=null,o=null;return t.forEach(u=>{u.added?a=u:u.removed?o=u:((a||o)&&R_(i,o,a,u,n.intlSegmenter),i=u,a=null,o=null)}),(a||o)&&R_(i,o,a,null,n.intlSegmenter),t}}const y4=new b4;function _4(e,t,n){return y4.diff(e,t,n)}function R_(e,t,n,i,a){if(t&&n){const[o,u]=Jc(t.value,a),[h,f]=Jc(n.value,a);if(e){const m=E_(o,h);e.value=m0(e.value,h,m),t.value=Lc(t.value,m),n.value=Lc(n.value,m)}if(i){const m=T_(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 o=ao(n.value,a);n.value=n.value.substring(o.length)}if(i){const o=ao(i.value,a);i.value=i.value.substring(o.length)}}else if(e&&i){const o=ao(i.value,a),[u,h]=Jc(t.value,a),f=E_(o,u);t.value=Lc(t.value,f);const m=T_(Lc(o,f),h);t.value=lh(t.value,m),i.value=p0(i.value,o,m),e.value=m0(e.value,o,o.slice(0,o.length-m.length))}else if(i){const o=ao(i.value,a),u=g0(t.value,a),h=A_(u,o);t.value=lh(t.value,h)}else if(e){const o=g0(e.value,a),u=ao(t.value,a),h=A_(o,u);t.value=Lc(t.value,h)}}class w4 extends F2{constructor(){super(...arguments),this.tokenize=k4}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 S4=new w4;function O_(e,t,n){return S4.diff(e,t,n)}function k4(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
|
|
55
|
-
`));const n=[],i=e.split(/(\n|\r\n)/);i[i.length-1]||i.pop();for(let a=0;a<i.length;a++){const o=i[a];a%2&&!t.newlineIsToken?n[n.length-1]+=o:n.push(o)}return n}function j4(e,t,n,i,a,o,u){let h;u?typeof u=="function"?h={callback:u}:h=u:h={},typeof h.context>"u"&&(h.context=4);const f=h.context;if(h.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(h.callback){const{callback:g}=h;O_(n,i,Object.assign(Object.assign({},h),{callback:v=>{const b=m(v);g(b)}}))}else return m(O_(n,i,h));function m(g){if(!g)return;g.push({value:"",lines:[]});function v(C){return C.map(function(E){return" "+E})}const b=[];let y=0,_=0,j=[],N=1,w=1;for(let C=0;C<g.length;C++){const E=g[C],R=E.lines||N4(E.value);if(E.lines=R,E.added||E.removed){if(!y){const M=g[C-1];y=N,_=w,M&&(j=f>0?v(M.lines.slice(-f)):[],y-=j.length,_-=j.length)}for(const M of R)j.push((E.added?"+":"-")+M);E.added?w+=R.length:N+=R.length}else{if(y)if(R.length<=f*2&&C<g.length-2)for(const M of v(R))j.push(M);else{const M=Math.min(R.length,f);for(const F of v(R.slice(0,M)))j.push(F);const L={oldStart:y,oldLines:N-y+M,newStart:_,newLines:w-_+M,lines:j};b.push(L),y=0,_=0,j=[]}N+=R.length,w+=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:o,hunks:b}}}function N4(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 C4(e,t){return j4("","",e,t,"","",{context:3}).hunks.map(i=>{const a=`@@ -${i.oldStart},${i.oldLines} +${i.newStart},${i.newLines} @@`,o=[];let u=i.oldStart,h=i.newStart;for(const f of i.lines){const m=f[0],g=f.slice(1);m==="-"?o.push({type:"del",content:g,oldLineNo:u++}):m==="+"?o.push({type:"add",content:g,newLineNo:h++}):o.push({type:"context",content:g,oldLineNo:u++,newLineNo:h++})}return H2(o),{header:a,lines:o}})}function E4(e){const t=[],n=e.split(`
|
|
60
|
-
`);let i=null,a=null,o=0,u=0;for(const h of n){if(h.startsWith("diff --git")||h.startsWith("diff --cc")){a&&i&&i.hunks.push(a),i&&t.push(i),i={fileName:"",hunks:[]},a=null;continue}if(h.startsWith("--- a/")||h.startsWith("--- /dev/null"))continue;if(h.startsWith("+++ b/")){i&&(i.fileName=h.slice(6));continue}if(h.startsWith("+++ /dev/null")||h.startsWith("index ")||h.startsWith("new file")||h.startsWith("deleted file")||h.startsWith("old mode")||h.startsWith("new mode")||h.startsWith("rename from")||h.startsWith("rename to")||h.startsWith("similarity index")||h.startsWith("Binary files"))continue;const f=h.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@(.*)$/);if(f){a&&i&&i.hunks.push(a),o=parseInt(f[1],10),u=parseInt(f[2],10),a={header:h,lines:[]};continue}a&&(h.startsWith("+")?a.lines.push({type:"add",content:h.slice(1),newLineNo:u++}):h.startsWith("-")?a.lines.push({type:"del",content:h.slice(1),oldLineNo:o++}):h.startsWith(" ")&&a.lines.push({type:"context",content:h.slice(1),oldLineNo:o++,newLineNo:u++}))}a&&i&&i.hunks.push(a),i&&t.push(i);for(const h of t)for(const f of h.hunks)H2(f.lines);return t}function H2(e){let t=0;for(;t<e.length;){const n=t;for(;t<e.length&&e[t].type==="del";)t++;const i=t,a=t;for(;t<e.length&&e[t].type==="add";)t++;const o=t,u=i-n,h=o-a;if(u>0&&h>0){const f=Math.min(u,h);for(let m=0;m<f;m++){const g=e[n+m],v=e[a+m],b=_4(g.content,v.content);g.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 T4({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 A4({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(T4,{line:n}),!n.content&&" "]})]},i))]})}function M4({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 o=a==="compact",u=!o,h=k.useMemo(()=>{if(n)return E4(n);const f=e??"",m=t??"";if(!f&&!m)return[];const g=C4(f,m);return[{fileName:i||"",hunks:g}]},[e,t,n,i]);return h.length===0||h.every(f=>f.hunks.length===0)?l.jsx("div",{className:"diff-viewer diff-empty",children:l.jsx("span",{className:"text-cc-muted text-xs",children:"No changes"})}):l.jsx("div",{className:`diff-viewer ${o?"diff-compact":"diff-full"}`,children:h.map((f,m)=>l.jsxs("div",{className:"diff-file",children:[(f.fileName||i)&&l.jsx(M4,{fileName:f.fileName||i||""}),f.hunks.map((g,v)=>l.jsx(A4,{hunk:g,showLineNumbers:u},v))]},m))})}const q2=k.createContext(null);function iP({value:e,children:t}){return l.jsx(q2.Provider,{value:e,children:t})}function R4(){const e=k.useContext(q2),t=K(n=>n.density);return e??t}function fa(){return R4()==="compact"}function xf({open:e,onToggle:t,marker:n,label:i,meta:a,labelClassName:o=""}){return l.jsxs("button",{type:"button",onClick:t,"aria-expanded":e,className:"w-full flex items-center gap-1.5 py-0.5 text-left group cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",className:`w-2.5 h-2.5 shrink-0 text-cc-muted/40 group-hover:text-cc-muted/70 transition-transform duration-200 ${e?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),n&&l.jsx("span",{className:"text-[11px] font-mono-code text-cc-muted/40 select-none shrink-0",children:n}),l.jsx("span",{className:`text-[11px] text-cc-muted/60 group-hover:text-cc-muted truncate min-w-0 ${o}`,children:i}),a&&l.jsx("span",{className:"text-[10px] text-cc-muted/35 shrink-0 ml-auto tabular-nums",children:a})]})}const O4={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 O4[e]||"tool"}function Li(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 V2({name:e,input:t,toolUseId:n}){const[i,a]=k.useState(e==="Edit"),o=No(e),u=Li(e),h=xo(e,t);return e==="Edit"?l.jsx(L4,{input:t,toolUseId:n}):e==="Bash"?l.jsx(D4,{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:o}),l.jsx("span",{className:"text-xs font-medium text-cc-fg",children:u}),h&&l.jsx("span",{className:"text-xs text-cc-muted truncate flex-1 font-mono-code",children:h})]}),i&&l.jsx("div",{className:"px-3 pb-3 pt-0 border-t border-cc-border/60",children:l.jsx("div",{className:"mt-2",children:l.jsx(z4,{name:e,input:t})})})]})}function L4({input:e,toolUseId:t}){const n=fa(),[i,a]=k.useState(!1),o=String(e.file_path||""),u=o?o.split("/").pop()||o:"",h=String(e.old_string||""),f=String(e.new_string||""),m=!!(h||f),g=!!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,w=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"}${g?" (all)":""}`,meta:m?`${j} ${j===1?"line":"lines"}`:void 0,labelClassName:"font-mono-code"}),i&&l.jsx("div",{className:"mt-0.5",children:w})]}):l.jsxs("div",{"data-tool-use-id":t,children:[l.jsxs("div",{className:"flex items-center gap-1.5 py-0.5",children:[l.jsx("span",{className:"text-[11px] font-medium text-emerald-600/70 dark:text-emerald-400/70",children:"Edit"}),u&&l.jsx("span",{className:"text-[11px] font-mono-code text-cc-fg/70",children:u}),g&&l.jsx("span",{className:"text-[9px] uppercase tracking-wider font-semibold text-amber-600/70 dark:text-amber-400/70",children:"all"})]}),w]})}function D4({input:e,toolUseId:t}){const n=typeof e.command=="string"?e.command:"",i=typeof e.description=="string"?e.description:"",a=fa(),[o,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:o,onToggle:()=>u(!o),marker:"$",label:f,meta:!o&&m>0?`+${m}`:void 0,labelClassName:i?"italic":"font-mono-code"}),o&&l.jsx("div",{className:"rounded-lg bg-cc-code-bg px-3 py-2 mt-1 overflow-x-auto",children:l.jsxs("pre",{className:"text-[12px] font-mono-code text-cc-code-fg leading-relaxed whitespace-pre-wrap break-words",children:[l.jsx("span",{className:"text-cc-muted/40 select-none",children:"$ "}),n]})})]})}return l.jsxs("div",{"data-tool-use-id":t,children:[i&&l.jsx("div",{className:"text-[11px] text-cc-muted/50 mb-1 italic",children:i}),l.jsx("div",{className:"rounded-lg bg-cc-code-bg px-3 py-2 overflow-x-auto",children:l.jsxs("pre",{className:"text-[12px] font-mono-code text-cc-code-fg leading-relaxed whitespace-pre-wrap break-words",children:[l.jsx("span",{className:"text-cc-muted/40 select-none",children:"$ "}),n]})})]})}function z4({name:e,input:t}){switch(e){case"Bash":return l.jsx($4,{input:t});case"Edit":return l.jsx(B4,{input:t});case"Write":return l.jsx(P4,{input:t});case"Read":return l.jsx(U4,{input:t});case"Glob":return l.jsx(F4,{input:t});case"Grep":return l.jsx(I4,{input:t});case"WebSearch":case"web_search":return l.jsx(H4,{input:t});case"WebFetch":return l.jsx(q4,{input:t});case"Task":return l.jsx(V4,{input:t});case"TodoWrite":return l.jsx(G4,{input:t});case"NotebookEdit":return l.jsx(Y4,{input:t});case"SendMessage":return l.jsx(Q4,{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 $4({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 B4({input:e}){const t=String(e.file_path||""),n=String(e.old_string||""),i=String(e.new_string||""),o=(Array.isArray(e.changes)?e.changes:[]).map(u=>({path:typeof u.path=="string"?u.path:"",kind:typeof u.kind=="string"?u.kind:"update"})).filter(u=>u.path);return l.jsxs("div",{className:"space-y-1.5",children:[!!e.replace_all&&l.jsx("span",{className:"inline-block text-[10px] font-medium px-1.5 py-0.5 rounded bg-cc-warning/10 text-cc-warning",children:"replace all"}),n||i?l.jsx(jo,{oldText:n,newText:i,fileName:t,mode:"compact"}):o.length>0?l.jsxs("div",{className:"space-y-1.5",children:[!!t&&l.jsx("div",{className:"text-xs text-cc-muted font-mono-code",children:t}),o.map((u,h)=>l.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-cc-fg",children:[l.jsx("span",{className:"inline-block text-[10px] font-medium px-1.5 py-0.5 rounded bg-cc-primary/10 text-cc-primary min-w-[54px] text-center",children:u.kind}),l.jsx("span",{className:"font-mono-code truncate",children:u.path})]},`${u.path}-${h}`))]}):l.jsx("pre",{className:"text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto",children:JSON.stringify(e,null,2)})]})}function P4({input:e}){const t=String(e.file_path||""),n=String(e.content||"");return l.jsx(jo,{newText:n,fileName:t,mode:"compact"})}function U4({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 F4({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 I4({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 H4({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 q4({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 V4({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 G4({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 Y4({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 Q4({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 xo(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,G2=6,W4=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,na=new Map,eu=new Map,xu=new Map,Uh=new Map;function Y2(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 K4(){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 vo=[];function Q2(){let e=0;for(const t of di.values())t.readyState===WebSocket.CONNECTING&&e++;return e}function X2(e){const t=vo.indexOf(e);t>=0&&vo.splice(t,1)}function L_(){if(!bo)for(;vo.length>0&&Q2()<G2;){const e=vo.shift();xx(e)&&Co(e)}}let bo=typeof document<"u"?document.hidden:!1;typeof document<"u"&&document.addEventListener("visibilitychange",()=>{if(document.hidden){bo=!0;for(const[e,t]of fr)clearTimeout(t),fr.delete(e)}else{bo=!1;for(const e of K4()){if(!xx(e))continue;const t=di.get(e);if(!Y2(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 Z4(e,t){return e.startsWith("/")||!t?Ch(e):Ch(`${t}/${e}`)}function J4(e,t){if(!t)return!0;const n=Ch(t);return e===n||e.startsWith(`${n}/`)}function eT(e){let t=Uh.get(e);return t||(t=new Set,Uh.set(e,t)),t}function sg(e,t){const n=K.getState(),i=eT(e);for(const a of t){if(a.type!=="tool_use")continue;const{name:o,input:u,id:h}=a;if(h){if(i.has(h))continue;i.add(h)}if(o==="TodoWrite"){const f=u.todos;if(Array.isArray(f)){const m=f.map((g,v)=>({id:String(v+1),subject:g.content||"Task",description:"",activeForm:g.activeForm,status:g.status||"pending"}));n.setTasks(e,m),Nh.set(e,m.length)}continue}if(o==="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(o==="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 o,u;const n=K.getState(),i=((o=n.sessions.get(e))==null?void 0:o.cwd)||((u=n.sdkSessions.find(h=>h.sessionId===e))==null?void 0:u.cwd);let a=!1;for(const h of t){if(h.type!=="tool_use")continue;const{name:f,input:m}=h;if((f==="Edit"||f==="Write")&&typeof m.file_path=="string"){const g=Z4(m.file_path,i);J4(g,i)&&(a=!0)}}a&&n.bumpChangedFilesTick(e)}const Qc=new Map,tT=/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 o=Qc.get(e);o||(o=new Map,Qc.set(e,o)),o.set(i.id,{command:a.command||"",description:a.description||"",startedAt:Date.now()})}}if(i.type==="tool_result"){const a=i.tool_use_id,o=Qc.get(e),u=o==null?void 0:o.get(a);if(o&&u){const f=(typeof i.content=="string"?i.content:Array.isArray(i.content)?i.content.map(m=>"text"in m?m.text:"").join(""):"").match(tT);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)}o.delete(a),o.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 o=a.input;if(o.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:o.name||o.description||"Background agent",description:o.description||"",agentType:o.subagent_type||"general-purpose",status:"running",startedAt:Date.now()};u.set(a.id,{name:h.name,description:h.description,agentType:h.agentType,startedAt:h.startedAt}),n.addBackgroundAgent(e,h)}}if(a.type==="tool_result"){const o=a.tool_use_id,u=oh.get(e),h=u==null?void 0:u.get(o);if(u&&h){const f=typeof a.content=="string"?a.content:Array.isArray(a.content)?a.content.map(g=>"text"in g?g.text:"").join(""):"",m=a.is_error===!0;n.updateBackgroundAgent(e,o,{status:m?"failed":"completed",completedAt:Date.now(),summary:f.length>200?f.slice(0,200)+"...":f}),u.delete(o),u.size===0&&oh.delete(e)}}}}function D_(e,t,n){typeof Notification>"u"||Notification.permission==="granted"&&new Notification(e,{body:t,tag:n})}function z_(e){return e.subtype==="task_notification"?{detail:e.summary||void 0,metaCode:"task_notification"}:{}}function $_(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 nT=0,sT=0;function Ti(){return`msg-${Date.now()}-${++nT}`}function B_(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 p4(e)?`${d4}
|
|
64
|
-
|
|
65
|
-
Details: ${t}`:`Error: ${t}`}function iT(e,t){const n=xu.get(e)||[];n.push(t),xu.set(e,n)}function rT(e,t){const n=xu.get(e);if(!(!(n!=null&&n.length)||t.readyState!==WebSocket.OPEN)){xu.delete(e);for(const i of n)t.send(JSON.stringify(i))}}const lr=new Map;function P_(e,t,n){const i=K.getState(),a=i.messages.get(e)||[],o=eu.get(e);let u=a.filter(f=>!f.isStreaming||f.id===o),h=-1;if(o&&(h=u.findIndex(f=>f.id===o),h===-1&&eu.delete(e)),h===-1){const f=`stream-${e}-${Ti()}`;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 Zr(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 U_=new Map,aT=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=U_.get(e);a&&a.code===t&&i-a.at<aT||(U_.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 W2(){return`cmsg-${Date.now()}-${++sT}`}function x0(){return W2()}const lT=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 oT(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 K2(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(K2(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 F_(e,t){const n=Math.max(0,Math.floor(t));Ph.set(e,n);try{localStorage.setItem(K2(e),String(n))}catch{}}function I_(e,t){In(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 cT(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 o=[],u=new Set;for(const h of n){const f=lg(h);u.has(f)||(u.add(f),o.push(a.get(f)||h))}for(const h of i){const f=lg(h);u.has(f)||(u.add(f),o.push(h))}return o}function H_(e,t,n,i,a){return{toolUseId:e,toolName:t,preview:xo(t,n),startedAt:i,elapsedSeconds:0,isError:!1,parentToolUseId:a||void 0}}function b0(e,t){const n=cT(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 uT(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 o=[...i];o[a]=b0(o[a],t),n.setMessages(e,o)}function dT(e,t){var a,o;let n;try{n=JSON.parse(t.data)}catch{console.warn(`[ws] Failed to parse incoming message for session ${e}:`,(o=(a=t.data)==null?void 0:a.substring)==null?void 0:o.call(a,0,120));return}const i=K.getState();i.connectionStatus.get(e)==="connecting"&&i.setConnectionStatus(e,"connected"),Z2(e,n)}function Z2(e,t,n={}){var u,h,f,m,g,v;const{processSeq:i=!0,ackSeqMessage:a=!0}=n,o=K.getState();if(i&&typeof t.seq=="number"){const b=v0(e);if(t.seq<=b)return;F_(e,t.seq),a&&I_(e,t.seq)}switch(W4.has(t.type)&&o.setLastActivity(e,Date.now()),t.type){case"session_init":{const b=o.sessions.get(e);if(o.addSession(t.session),o.setCliConnected(e,!0),o.setCliReconnecting(e,!1),b||o.setSessionStatus(e,"idle"),!o.sessionNames.has(e)){const y=new Set(o.sessionNames.values()),_=U2(y);o.setSessionName(e,_)}break}case"session_update":{o.updateSession(e,t.session);break}case"assistant":{const b=t.message;if(b.model==="<synthetic>"){Zr(e),o.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(Zr(e),uT(e,_),o.setStreaming(e,null),na.delete(e),lr.delete(e),(u=b.content)!=null&&u.length)for(const j of b.content)j.type==="tool_result"&&o.clearToolProgress(e,j.tool_use_id);if(o.setSessionStatus(e,"running"),o.streamingStartedAt.has(e)||o.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||{};o.addToolActivity(e,H_(j.id,j.name,N,t.timestamp||Date.now(),t.parent_tool_use_id))}j.type==="tool_result"&&o.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"&&(na.delete(e),lr.delete(e),Zr(e),o.setSessionStatus(e,"running"),o.streamingStartedAt.has(e)||o.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 _=lr.get(e)||{thinking:"",text:""};na.get(e)==="thinking"&&(_.thinking=""),_.text+=y.text,lr.set(e,_),na.set(e,"text"),o.setStreaming(e,_.text),P_(e,_.text,"text")}if((y==null?void 0:y.type)==="thinking_delta"&&typeof y.thinking=="string"){const _=lr.get(e)||{thinking:"",text:""};_.thinking+=y.thinking,lr.set(e,_),na.set(e,"thinking"),o.setStreaming(e,_.thinking),P_(e,_.thinking,"thinking")}}if(b.type==="message_delta"){const y=b.usage;y!=null&&y.output_tokens&&o.setStreamingStats(e,{outputTokens:y.output_tokens})}}break}case"result":{Uh.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))}}o.updateSession(e,y),Zr(e),o.setStreaming(e,null),na.delete(e),lr.delete(e),o.setStreamingStats(e,null),o.clearToolProgress(e),o.setSessionStatus(e,"idle"),!document.hasFocus()&&o.notificationSound&&g4(),!document.hasFocus()&&o.notificationDesktop&&D_("Session completed","Claude finished the task",e),b.is_error&&o.appendMessage(e,{id:Ti(),role:"system",content:B_(b),timestamp:Date.now()});break}case"permission_request":{if(o.addPermission(e,t.request),!document.hasFocus()&&o.notificationDesktop){const y=t.request;D_("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":{o.removePermission(e,t.request_id);break}case"permission_auto_resolved":{o.addAiResolvedPermission(e,{request:t.request,behavior:t.behavior,reason:t.reason,timestamp:Date.now()});break}case"tool_progress":{o.setToolProgress(e,t.tool_use_id,{toolName:t.tool_name,elapsedSeconds:t.elapsed_time_seconds}),o.updateToolActivity(e,t.tool_use_id,{elapsedSeconds:t.elapsed_time_seconds});break}case"tool_use_summary":{((m=o.sdkSessions.find(y=>y.sessionId===e))==null?void 0:m.backendType)==="codex"&&o.appendMessage(e,{id:Ti(),role:"system",content:t.summary,timestamp:Date.now()});break}case"user_message":{o.appendMessage(e,{id:t.id||Ti(),role:"user",content:t.content,timestamp:t.timestamp||Date.now()}),o.clearPromptSuggestions(e);break}case"system_event":{if(((g=t.event)==null?void 0:g.subtype)==="task_notification"){const{task_id:y,status:_,summary:j}=t.event;y&&_&&o.updateProcess(e,y,{status:_,completedAt:Date.now(),summary:j||void 0})}const b=$_(t.event);if(!b)break;o.appendMessage(e,{id:Ti(),role:"system",content:b,timestamp:t.timestamp||Date.now(),...z_(t.event)});break}case"status_change":{t.status==="compacting"?o.setSessionStatus(e,"compacting"):o.setSessionStatus(e,t.status);break}case"auth_status":{t.error&&o.appendMessage(e,{id:Ti(),role:"system",content:`Auth error: ${t.error}`,timestamp:Date.now()});break}case"error":{o.appendMessage(e,{id:Ti(),role:"system",content:t.message,timestamp:Date.now()});break}case"session_phase":{const b=t.phase;b==="terminated"?(o.setCliConnected(e,!1),o.setCliReconnecting(e,!1),o.setSessionStatus(e,null),o.setStreaming(e,null),o.setStreamingStats(e,null),Zr(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"?(o.setCliConnected(e,!1),o.setCliReconnecting(e,!0),o.setSessionStatus(e,null),o.setStreaming(e,null),o.setStreamingStats(e,null),Zr(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"?(o.setCliConnected(e,!1),o.setCliReconnecting(e,!0)):(o.setCliConnected(e,!0),o.setCliReconnecting(e,!1),b==="ready"?o.setSessionStatus(e,"idle"):b==="streaming"?o.setSessionStatus(e,"running"):b==="compacting"?o.setSessionStatus(e,"compacting"):b==="awaiting_permission"&&o.setSessionStatus(e,"running"));break}case"cli_disconnected":{o.setCliConnected(e,!1),o.setCliReconnecting(e,!1),o.setSessionStatus(e,null),o.setStreaming(e,null),o.setStreamingStats(e,null),Zr(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":{o.setCliConnected(e,!0),o.setCliReconnecting(e,!1);break}case"session_name_update":{const b=o.sessionNames.get(e),y=b&&/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(b);(!b||y)&&(o.setSessionName(e,t.name),o.markRecentlyRenamed(e));break}case"pr_status_update":{o.setPRStatus(e,{available:t.available,pr:t.pr});break}case"mcp_status":{o.setMcpServers(e,t.servers);break}case"rate_limit":{o.setRateLimit(e,t.info);break}case"message_history":{const 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||Ti(),role:"user",content:N.content,timestamp:N.timestamp});else if(N.type==="assistant"){const w=N.message,C=Eh(w.content),E={id:w.id,role:"assistant",content:C,contentBlocks:w.content,timestamp:N.timestamp||Date.now(),parentToolUseId:N.parent_tool_use_id,model:w.model,stopReason:w.stop_reason},R=b.findIndex(M=>M.role==="assistant"&&M.id===E.id);if(R===-1?b.push(E):b[R]=b0(b[R],E),(v=w.content)!=null&&v.length){sg(e,w.content),ig(e,w.content),rg(e,w.content),ag(e,w.content);const M=N.timestamp||Date.now();for(const L of w.content){if(L.type==="tool_use"){const F=L.input||{},D=y.get(L.id);y.set(L.id,D??H_(L.id,L.name,F,M,N.parent_tool_use_id))}if(L.type==="tool_result"){const F=y.get(L.tool_use_id);F&&y.set(L.tool_use_id,{...F,completedAt:M,isError:F.isError||!!L.is_error,elapsedSeconds:Math.max(F.elapsedSeconds,F.completedAt?F.elapsedSeconds:Math.max(0,(M-F.startedAt)/1e3))})}}}}else if(N.type==="result"){const w=N.data;w.is_error&&b.push({id:`hist-error-${j}`,role:"system",content:B_(w),timestamp:Date.now()});const C={total_cost_usd:w.total_cost_usd,num_turns:w.num_turns};if(typeof w.total_lines_added=="number"&&(C.total_lines_added=w.total_lines_added),typeof w.total_lines_removed=="number"&&(C.total_lines_removed=w.total_lines_removed),w.modelUsage){for(const E of Object.values(w.modelUsage))if(E.contextWindow>0){const R=E,M=Math.round((R.inputTokens+R.outputTokens)/R.contextWindow*100);C.context_used_percent=Math.max(0,Math.min(M,100))}}o.updateSession(e,C)}else if(N.type==="system_event"){const w=$_(N.event);if(!w)continue;b.push({id:`hist-system-event-${j}`,role:"system",content:w,timestamp:N.timestamp||Date.now(),...z_(N.event)})}}if(b.length>0){const j=o.messages.get(e)||[];if(j.length===0)o.setMessages(e,b);else{const N=[...j];for(const w of b){const C=N.findIndex(R=>R.id===w.id);if(C===-1){N.push(w);continue}const E=N[C];E.role==="assistant"&&w.role==="assistant"?N[C]=b0(E,w):N[C]=w}N.sort((w,C)=>(w.timestamp??0)-(C.timestamp??0)),o.setMessages(e,N)}}o.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"&&(Zr(e),o.setStreaming(e,null),na.delete(e),lr.delete(e),o.setStreamingStats(e,null),o.clearToolProgress(e),o.setSessionStatus(e,"idle"));break}case"event_replay":{let b;for(const y of t.events){const _=v0(e);y.seq<=_||(F_(e,y.seq),b=y.seq,Z2(e,y.message,{processSeq:!1,ackSeqMessage:!1}))}typeof b=="number"&&I_(e,b);break}case"prompt_suggestion":{const b=t.suggestions;o.setPromptSuggestions(e,b);break}case"streamlined_text":{o.appendMessage(e,{id:Ti(),role:"assistant",content:t.text,timestamp:Date.now()});break}case"streamlined_tool_use_summary":{o.appendMessage(e,{id:Ti(),role:"system",content:t.tool_summary,timestamp:Date.now()});break}case"magic_ui_state":{o.setMagicUiState(e,t.state);break}default:{console.debug("[ws] Unhandled message type:",t.type);break}}}function Co(e){const t=di.get(e);if(Y2(t))return;if(t){try{t.close()}catch{}di.delete(e)}const n=K.getState();if(n.setConnectionStatus(e,"connecting"),n.currentSessionId!==e&&Q2()>=G2){vo.includes(e)||vo.push(e);return}X2(e);const i=new WebSocket(oT(e));di.set(e,i),i.onopen=()=>{const a=v0(e);i.send(JSON.stringify({type:"session_subscribe",last_seq:a})),rT(e,i);const o=fr.get(e);o&&(clearTimeout(o),fr.delete(e)),L_()},i.onmessage=a=>dT(e,a),i.onclose=()=>{di.get(e)===i&&(di.delete(e),K.getState().setConnectionStatus(e,"disconnected"),hT(e),L_())},i.onerror=()=>{i.close()}}function hT(e){if(fr.has(e)||bo)return;const t=setTimeout(()=>{fr.delete(e),!bo&&xx(e)&&Co(e)},X4);fr.set(e,t)}function y0(e){X2(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"),Uh.delete(e),Fh.delete(e),Qc.delete(e),Nh.delete(e),na.delete(e),eu.delete(e),lr.delete(e),Ph.delete(e),xu.delete(e)}function fT(e){if(bo)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 In(e,t){const n=di.get(e);let i=t;const a=lT.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:W2()});break}if((n==null?void 0:n.readyState)===WebSocket.OPEN){n.send(JSON.stringify(i));return}a&&iT(e,i)}function q_(e){In(e,{type:"mcp_get_status"})}function pT(e,t,n){In(e,{type:"mcp_toggle",serverName:t,enabled:n})}function mT(e,t){In(e,{type:"mcp_reconnect",serverName:t})}function gT(e,t){In(e,{type:"mcp_set_servers",servers:t})}function V_(e,t){In(e,{type:"set_magic_ui",magicUiActive:t})}function rP(e){In(e,{type:"magic_ui_sync"})}function xT(e,t){In(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,vu=Hn==null?void 0:Hn.fetch,vx=Hn!=null&&Hn.XMLHttpRequest&&"withCredentials"in new Hn.XMLHttpRequest?Hn.XMLHttpRequest:void 0,G_=Hn==null?void 0:Hn.AbortController,vT=Hn==null?void 0:Hn.CompressionStream,es=jn==null?void 0:jn.userAgent;function J2(){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??{},bT="0.9.0",hr={DEBUG:!1,LIB_VERSION:bT,LIB_NAME:"browser-common"};var Mi=(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 yT=["$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"],_T=["token"];function He(e,t){return e.indexOf(t)!==-1}const vf=function(e){return e.trim()},w0=function(e){return e.replace(/^\$/,"")};function eS(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 tS=Object.prototype,bx=tS.hasOwnProperty,bf=tS.toString,Ue=Array.isArray||function(e){return bf.call(e)==="[object Array]"},kn=e=>typeof e=="function",st=e=>e===Object(e)&&!Ue(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,Qt=e=>e===null,qe=e=>ue(e)||Qt(e),Jt=e=>bf.call(e)=="[object Number]"&&e==e,or=e=>Jt(e)&&e>0,ns=e=>bf.call(e)==="[object Boolean]",wT=e=>He(yT,e),ST=e=>He(_T,e);function nS(e){return e===null||typeof e!="object"}function Ih(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 sS(e,Error)}}function yx(e){return"u">typeof Event&&sS(e,Event)}function sS(e,t){try{return e instanceof t}catch{return!1}}const kT=[!0,"true",1,"1","yes"],og=e=>He(kT,e),jT=[!1,"false",0,"0","no"];function Y_(e,t,n,i,a,o,u){try{var h=e[o](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 o=e.apply(t,n);function u(f){Y_(o,i,a,u,h,"next",f)}function h(f){Y_(o,i,a,u,h,"throw",f)}u(void 0)})}}const NT=["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"],Q_=function(e,t=[]){if(!e)return!1;const n=e.toLowerCase();return NT.concat(t).some(i=>{const a=i.toLowerCase();return n.indexOf(a)!==-1})};function Oi(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),Oi(a??n,t,n,i))}var CT=class{constructor(e){this.C={},this.I=e.I,this.R=Oi(e.bucketSize,0,100,e.$),this.A=Oi(e.refillRate,0,this.R,e.$),this.O=Oi(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 yo="Mobile",bu="Android",Hh="Tablet",iS="Android Tablet",rS="iPad",aS="Apple Watch",Th="Safari",yf="BlackBerry",lS="Samsung Internet",Ah="Chrome",oS="Chrome iOS",cS="Internet Explorer",uS="Internet Explorer Mobile",dS="Opera",hS="Microsoft Edge",Mh="Firefox",fS="Firefox iOS",qh="Nintendo",Vh="PlayStation",_f="Xbox",pS="Android Mobile",mS="Mobile Safari",cg="Windows",gS="Windows Phone",X_="Nokia",S0="Ouya",ET="Generic "+yo.toLowerCase(),xS="Generic "+Hh.toLowerCase(),k0="Konqueror",vS="Oculus Browser",bS="Vivaldi",yS="Yandex",_S="Whale",wS="DuckDuckGo",SS="Pale Moon",kS="Waterfox",j0="Brave",jS="Claude",NS="Codex",CS="ChatGPT",ES="Google Search App",ug=new RegExp("Version/(\\d+(\\.\\d+)?)"),dg=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),TT=new RegExp(_f,"i"),AT=new RegExp("PlayStation \\w+","i"),MT=new RegExp("Nintendo \\w+","i"),_x=new RegExp("BlackBerry|PlayBook|BB10","i"),RT={"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"},TS=function(e,t,n,i){return t=t||"",(function(o){return o!=null&&o.brave?j0:null})(n)||(i!=null&&i.detectGoogleSearchApp&&He(e,"GSA/")?ES:He(e," OPR/")&&He(e,"Mini")?"Opera Mini":He(e," OPR/")?dS:_x.test(e)?yf:He(e,"IEMobile")||He(e,"WPDesktop")?uS:He(e,"OculusBrowser")?vS:He(e,"SamsungBrowser")?lS:He(e,"Edge")||He(e,"Edg/")?hS:He(e,"Vivaldi/")?bS:He(e,"YaBrowser/")?yS:He(e,"Whale/")?_S:He(e,"DuckDuckGo/")||He(e,"Ddg/")?wS:He(e,"Claude/")?jS:He(e,"Codex/")?NS:He(e,"ChatGPT/")?CS:He(e,"FBIOS")?"Facebook Mobile":He(e,"UCWEB")||He(e,"UCBrowser")?"UC Browser":He(e,"CriOS")?oS:He(e,"CrMo")||He(e,Ah)?Ah:He(e,bu)&&He(e,Th)?pS:He(e,"FxiOS")?fS:He(e.toLowerCase(),k0.toLowerCase())?k0:He(e,"Brave/")?j0:((o,u)=>u&&He(u,"Apple")||(function(h){return He(h,Th)&&!He(h,Ah)&&!He(h,bu)})(o))(e,t)?He(e,yo)?mS:Th:He(e,"PaleMoon/")?SS:He(e,"Waterfox/")?kS:He(e,Mh)?Mh:He(e,"MSIE")||He(e,"Trident/")?cS:He(e,"Gecko")?Mh:"")},OT={[uS]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[hS]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[Ah]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[oS]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[Th]:[ug],[mS]:[ug],[dS]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[Mh]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[fS]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[k0]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[yf]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),ug],[pS]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[lS]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[vS]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[bS]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[yS]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[_S]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[j0]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[jS]:[dg],[NS]:[dg],[CS]:[dg],[wS]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[SS]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[kS]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[ES]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[cS]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},LT=function(e,t,n,i){const a=TS(e,t,n,i),o=OT[a];if(ue(o))return null;for(let u=0;o.length>u;u++){const h=e.match(o[u]);if(h)return parseFloat(h[h.length-2])}return null},W_=[[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[gS,""];if(new RegExp(yo).test(t)&&!/IEMobile\b/.test(t))return["Windows Mobile",""];const n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){let i=RT[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]?[bu,[e[2],e[3],e[4]||"0"].join(".")]:[bu,""]],[/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",""]]],AS=function(e){for(let t=0;W_.length>t;t++){const[n,i]=W_[t],a=n.exec(e),o=a&&(kn(i)?i(a,e):i);if(o)return o}return["",""]},MS=function(e){return MT.test(e)?qh:AT.test(e)?Vh:TT.test(e)?_f:new RegExp(S0,"i").test(e)?S0:new RegExp("(Windows Phone|WPDesktop)","i").test(e)?gS:/iPad/.test(e)?rS:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?aS:_x.test(e)?yf:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(X_,"i").test(e)?X_:/(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(yo).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)?bu:iS:new RegExp("(pda|Mobile)","i").test(e)?ET:new RegExp(Hh,"i").test(e)&&!new RegExp("Tablet pc","i").test(e)?xS:""},DT=function(e,t){var n;const i=MS(e);return i===rS||i===iS||i==="Kobo"||i==="Kindle Fire"||i===xS?Hh:i===qh||i===_f||i===Vh||i===S0?"Console":i===aS?"Wearable":i?yo:(t==null?void 0:t.userAgentDataPlatform)==="Android"&&((n=t==null?void 0:t.maxTouchPoints)!==null&&n!==void 0?n:0)>0?600>Math.min((a=t==null?void 0:t.screenWidth)!==null&&a!==void 0?a:0,(o=t==null?void 0:t.screenHeight)!==null&&o!==void 0?o:0)/((u=t==null?void 0:t.devicePixelRatio)!==null&&u!==void 0?u:1)?yo:Hh:"Desktop";var a,o,u},hg=/\bFBAV\/(\d+(?:\.\d+)*)/i,K_=[[/\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 po(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 RS(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 OS=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 zT=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Z_(e,t){return typeof(n=e)=="string"&&zT.test(n)?e:t();var n}function LS(e,t){const n=new Error(t);try{Object.defineProperty(n,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch{}return n}function ua(e){return e&&e.split("#")[0]}function J_(e){try{return e()}catch{return}}function DS(e,t){const n=setTimeout(e,t);return n!=null&&n.unref&&(n==null||n.unref()),n}function ew(e,t,n){return zS.apply(this,arguments)}function zS(){return(zS=Bt(function*(e,t,n){let i;try{return yield Promise.race([e,new Promise((a,o)=>{i=DS(()=>{try{n==null||n(),a()}catch(u){o(u)}},t)})])}finally{clearTimeout(i)}})).apply(this,arguments)}let ch,tw,fg;function $T(e){const t=globalThis._posthogChunkIds;if(!t)return;const n=Object.keys(t);return fg&&n.length===tw||(tw=n.length,fg=n.reduce((i,a)=>{ch||(ch={});const o=ch[a];if(o)i[o[0]]=o[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,g=t[a];if(m&&g){i[m]=g,ch[a]=[m,g];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 BT(e,t,n){return(t=(function(i){var a=(function(o){if(nu(o)!="object"||!o)return o;var u=o[Symbol.toPrimitive];if(u!==void 0){var h=u.call(o,"string");if(nu(h)!="object")return h;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(o)})(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 nw(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?nw(Object(n),!0).forEach(function(i){BT(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nw(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}var PT=class{constructor(e,t,n=[]){this.coercers=e,this.stackParser=t,this.modifiers=n}buildFromUnknown(e,t={}){const n=t&&t.mechanism||{handled:!0,type:"generic"},i=this.buildCoercingContext(n,t,0).apply(e),a=this.buildParsingContext(t),o=this.parseStacktrace(i,a);return{$exception_list:this.convertToExceptionList(o,n),$exception_level:"error"}}modifyFrames(e){var t=this;return Bt(function*(){for(const n of e)n.stacktrace&&n.stacktrace.frames&&Ue(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(o=>this.parseStacktrace(o,t))})}applyChunkIds(e,t){return e.map(n=>(n.filename&&t&&(n.chunk_id=t[n.filename]),n))}applyCoercers(e,t){for(const n of this.coercers)if(n.match(e))return n.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return Bt(function*(){let n=e;for(const i of t.modifiers)n=yield i(n);return n})()}convertToExceptionList(e,t){const n=[],i=(a,o,u)=>{var h;const f=n.length,m=o===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:o},g={type:a.type,value:a.value,mechanism:m};a.stack&&(g.stacktrace={type:"raw",frames:a.stack}),n.push(g),a.cause&&i(a.cause,f,"cause");for(const v of(h=a.errors)!==null&&h!==void 0?h:[])i(v,f,"member")};return i(e),n}buildParsingContext(e){var t;return{chunkIdMap:$T(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 o=e.errors;return Ue(o)?o:void 0}n=Object.getPrototypeOf(n)}}}catch{}}buildCoercingContext(e,t,n=0){let i=0,a=0,o=!1;const u=new Set,h=[],f={},m=(b,y,_=0)=>{const j=g(y,_),N=j.apply;if(j.apply=L=>{h.push(b);try{return N(L)}finally{h.pop()}},_>4||_>0&&h.indexOf(b)!==-1)return this.coerceFallback(j);const w=typeof b=="object"&&b!==null||typeof b=="function";if(_===0&&i>=50||w&&u.has(b))return;w&&u.add(b),_===0&&i++;const C=this.getAggregateErrors(b);let E,R;o||(o=!!C);try{if(E=this.applyCoercers(b,j),!E)throw f}catch(L){if(L===f)return void(_===0&&i--);if(!o)throw L;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 M=[];for(let L=0;50>i&&1e3>a&&R>L;L++){let F;a++;try{F=j.next(C[L])}catch{i++,F=this.coerceFallback(g(y+1))}F&&M.push(F)}return B(B({},E),{},{errors:M})},g=(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=g(n);return B(B({},v),{},{apply:b=>{var y;return(y=m(b,n))!==null&&y!==void 0?y:this.coerceFallback(v)}})}};const UT=/^([a-z][a-z0-9.+-]+):/i,FT=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function IT(e){if(!e||e==="<anonymous>")return!1;const t=UT.exec(e);return!t||FT.includes(t[1].toLowerCase())}function C0(e,t,n,i,a){const o={platform:e,filename:t,function:n==="<anonymous>"?"?":n,in_app:IT(t)};return ue(i)||(o.lineno=i),ue(a)||(o.colno=a),o}const $S=(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]},HT=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,qT=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,VT=/\((\S*)(?::(\d+))(?::(\d+))\)/,GT=(e,t)=>{const n=HT.exec(e);if(n){const[,a,o,u]=n;return C0(t,a,"?",+o,+u)}const i=qT.exec(e);if(i){if(i[2]&&i[2].indexOf("eval")===0){const u=VT.exec(i[2]);u&&(i[2]=u[1],i[3]=u[2],i[4]=u[3])}const[a,o]=$S(i[1]||"?",i[2]);return C0(t,o,a,i[3]?+i[3]:void 0,i[4]?+i[4]:void 0)}},YT=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,QT=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,XT=(e,t)=>{const n=YT.exec(e);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){const o=QT.exec(n[3]);o&&(n[1]=n[1]||"eval",n[3]=o[1],n[4]=o[2],n[5]="")}let i=n[3],a=n[1]||"?";return[a,i]=$S(a,i),C0(t,i,a,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},sw=/\(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 WT(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 KT(e,t){const n=t.start+t.length,i=PS(e,t);i&&e.splice(n+i===e.length?n:t.start,i)}function BS(e,t){let n=t.start;for(;n>0&&wx(e[n-1],e[n-1+t.length]);)n--;return t.start-n}function PS(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 ZT(e,t){const n=t[0];let i=e.length-(n?BS(e,n):0);for(const a of t)i-=PS(e,a);return i}function JT(e,t,n){for(let i=0;e.length>i;i++){const a=e[(t+i)%e.length],o=e[(n+i)%e.length];if(a!==o)return o>a}return!1}var e6=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 Ih(e,"DOMException")}isDOMError(e){return Ih(e,"DOMError")}},t6=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,o=!!a;return{type:this.getType(e),value:this.getMessage(e,t),stack:i??a,cause:e.cause?t.next(e.cause):void 0,synthetic:o}}getType(e){return e.name||e.constructor.name}getMessage(e,t){const n=e.message;return String(n.error&&typeof n.error.message=="string"?n.error.message:n)}getStack(e){try{const t=e.stacktrace;if(typeof t=="string"&&t.length>0)return t;const n=e.stack;return typeof n=="string"&&n.length>0?n:void 0}catch{return}}},n6=class{match(e){return!!Ih(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,o=(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}:${o}`}};const s6=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var i6=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(s6);return i&&(t=i[1],n=i[2]),[t,n]}};const r6=["fatal","error","warning","log","info","debug"];function US(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 a6=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: ${US(e)}`}isSeverityLevel(e){return Je(e)&&!tu(e)&&r6.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}}},l6=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: ${US(e)}`,stack:(n=t.syntheticException)===null||n===void 0?void 0:n.stack,synthetic:!0}}},o6=class{match(e){return nS(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}}},c6=class{match(e){return Ih(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 nS(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",u6=new Set([Gh,Yh]),pg={enabled:!0,max_bytes:32768};function Qh(e){var t;return e?{enabled:(t=e.enabled)!==null&&t!==void 0?t:pg.enabled,max_bytes:h6(e.max_bytes,pg.max_bytes)}:B({},pg)}var d6=class{constructor(e){this.ns=[],this.ss=0,this.Rr=Qh(e)}setConfig(e){this.Rr=Qh(e),this.rs()}add(e){const t=(function(i){let a;try{a=eS(i)}catch{return}try{const o=JSON.parse(a);if(!st(o))return;const u=o,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 o=0;for(let u=0;a.length>u;u++)a[u]==="%"?(o+=1,u+=2):o+=1;return o})(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 h6(e,t){if(!Jt(e)||e===1/0||e===-1/0)return t;const n=Math.floor(e);return 0>n?t:n}const iw=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}};function rw(e){return typeof e=="string"||e}function aw(e){return typeof e=="string"?e:void 0}const f6=["$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"],FS="NativeGzipValidationError",E0=e=>e.length>=2&&e[0]===31&&e[1]===139,lw=(e,t)=>e===_0.GZipJS||t===_0.GZipJS||t==="gzip",ow=e=>!(!e||typeof e!="object")&&("name"in e?String(e.name):"")==="NotReadableError";let zc;const uh=e=>{throw LS(FS,`Native gzip produced invalid output: ${e}`)},p6=(cw=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)!==(o=>{const u=(()=>{if(zc)return zc;zc=[];for(let f=0;256>f;f++){let m=f;for(let g=0;8>g;g++)m=1&m?3988292384^m>>>1:m>>>1;zc[f]=m>>>0}return zc})();let h=4294967295;for(let f=0;o.length>f;f++)h=u[255&(h^o[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 cw.apply(this,arguments)});var cw;function T0(){return T0=Bt(function*(e,t=!0,n){try{const a=new TextEncoder().encode(e),o=new globalThis.CompressionStream("gzip"),u=o.writable.getWriter(),h=u.write(a).then(()=>u.close()).catch((i=Bt(function*(g){try{yield u.abort(g)}catch{}throw g}),function(g){return i.apply(this,arguments)})),f=new Response(o.readable).blob(),[m]=yield Promise.all([f,h]);return yield p6(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 IS(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 o=Object.getOwnPropertySymbols(e);for(i=0;o.length>i;i++)t.includes(n=o[i])||{}.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}const m6={}.propertyIsEnumerable;function Xh(e,t){try{return HS(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,o){const u=a.toString(),h=BigInt("9223372036854775808");return a>=h||-h>a?(o==null||o.debug(`Attribute ${u} is outside the int64 range; encoding it as a string`),{stringValue:u}):{intValue:u}})(e,t);if(typeof e=="number"){if(!Number.isFinite(e))return{stringValue:String(e)};if(Number.isInteger(e)){if(Number.isSafeInteger(e))return{intValue:String(e)};if(typeof BigInt>"u")return{stringValue:String(e)};const a=BigInt(e).toString();return e>=9223372036854776e3||-9223372036854776e3>e?(t==null||t.debug(`Attribute ${a} is outside the int64 range; encoding it as a string`),{stringValue:a}):{intValue:a}}return{doubleValue:e}}if(typeof e=="string")return{stringValue:po(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(),o=Number.isFinite(a)?e.toISOString():String(e);return{stringValue:typeof o=="string"?po(o):String(o)}}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 Ue(e)?{arrayValue:{values:g6(e,t,n,i+1)}}:{kvlistValue:{values:HS(e,t,n,i+1)}}}finally{n.ancestors.delete(e)}}return{stringValue:po(String(e))}}function g6(e,t,n,i){const a=[],o=Math.min(e.length,1e3);let u=0;for(;o>u&&n.remainingNodes>0;u++)try{const h=u in e?e[u]:void 0;if(qe(h))continue;a.push(Sx(h,t,n,i))}catch{a.push({stringValue:Au})}return e.length>u&&a.push({stringValue:N0}),a}function HS(e,t,n,i){const a=[];for(const o in e)if(m6.call(e,o)){if(!o){t==null||t.debug("Dropping an attribute with an empty key");continue}if(a.length>=1e3||0>=n.remainingNodes){t==null||t.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{const u=e[o];if(Qt(u)||ue(u))continue;a.push({key:po(o),value:Sx(u,t,n,i)})}catch{a.push({key:po(o),value:{stringValue:Au}})}}return a}function qS(e,t,n){return B(B(B(B({},RS({},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 x6=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function VS(e,t){const n=RS({},e),i={};for(const a of x6)({}).hasOwnProperty.call(n,a)&&(i[a]=n[a],delete n[a]);return[...Xh(n,t),...Xh(i,t)]}const uw={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"},GS={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}},v6=GS.info;function b6(e){try{return po(String(e))}catch{return Au}}function y6(e,t,n,i){const a=e.level||"info",{text:o,number:u}=GS[a]||v6,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),qe(t.sessionStartTimestamp)||(f.sessionStartTimestamp=String(t.sessionStartTimestamp)),qe(t.lastActivityTimestamp)||(f.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(f["url.full"]=t.currentUrl),t.screenName&&(f["screen.name"]=t.screenName),t.appState&&(f["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(f.feature_flags=t.activeFeatureFlags);const m=B({},f),g=e.attributes;if(g){let b=[];try{b=Object.keys(g)}catch{b=[]}for(const y of b){let _;try{_=g[y]}catch{_=Au}Object.defineProperty(m,y,{value:_,enumerable:!0,writable:!0,configurable:!0})}}const v={timeUnixNano:h,observedTimeUnixNano:h,severityNumber:u,severityText:o,body:{stringValue:b6(e.body)},attributes:Xh(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 YS(e,t,n){return qS(e,t,n)}function QS(e,t,n,i){return{resourceLogs:[{resource:{attributes:VS(t)},scopeLogs:[{scope:{name:n,version:i},logRecords:e}]}]}}var XS=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=DS(()=>{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 WS(){return .75+.5*Math.random()}function KS(e,t,n,i){const a=Math.min(Math.max(0,t-1),6),o=e*Math.pow(2,a);return Math.round(Math.min(o,Math.max(i,e))*n)}var _6=class{constructor(e,t,n,i,a,o=()=>Promise.resolve(),u){var h;this._instance=e,this.Rr=t,this.$=n,this.cs=i,this.ds=a,this.vs=o,this.fs=u,this.ps=new XS(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new OS,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(Mi.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:y6(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=Ue(t)?t:[t];let i=e;for(const a of n)try{const o=a(i);if(!o)return this.$.info("Log was rejected in beforeSend function"),null;i=o}catch(o){return this.$.error("Error in beforeSend function for log:",o),null}return i}Ds(){if(this.Rs===void 0)return!0;const e=Date.now(),t=e-this.xs;return this.Ps>t&&t>=0||(this.xs=e,this.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(Mi.LogsQueue))!==null&&t!==void 0?t:[];if(n.length===0)return;const i=n.length;let a=0;for(;n.length>0&&i>a;){var o,u;const h=e._s;e.bs=0;const f=Math.min(n.length,e.Es),m=n.slice(0,f),g=QS(m.map(b=>b.record),e.qs(),(o=e.fs)!==null&&o!==void 0?o:e._instance.getLibraryId(),e._instance.getLibraryVersion()),v=yield e._instance.js(g);if(e._s!==h)return;if(v.kind==="too-large"&&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(Mi.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(Mi.LogsQueue))!==null&&n!==void 0?n:[];t._instance.setPersistedProperty(Mi.LogsQueue,a.slice(i)),yield t.vs()})()}qs(){return YS(this.Rr,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(e){var t;if(this._instance.optedOut)return;const n=(t=this._instance.getPersistedProperty(Mi.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(Mi.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(KS(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){const e=this._instance.getPersistedProperty(Mi.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 ew(n,e):yield n})()}flushWithTimeout(e){var t=this;return Bt(function*(){const n=t.flush();yield ew(n,e,()=>{n.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},e=>{this.ks++,this.Ss=WS(),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 dw(e){return String(e)+"000000"}function hw(e,t,n,i){let a="";return i&&(a=Object.keys(i).sort().map(o=>`${JSON.stringify(o)}:${JSON.stringify(i[o])}`).join(",")),`${e}\0${t}\0${n??""}\0${a}`}var w6=class{constructor(e,t,n){this._instance=e,this.Rr=t,this.$=n,this.zs=new Map,this.ps=new XS(()=>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 OS,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=hw(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 o=this.Ws.get(t.name);o===void 0?this.Ws.set(t.name,t.type):o===t.type||this.Vs.has(t.name)||(this.Vs.add(t.name),this.$.warn(`Metric name '${t.name}' is already used as a ${o}; recording it as a ${t.type} too will blend both series in charts. Use a distinct name.`)),this.Xs(a,t.value),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,o){for(let u=0;o.length>u;u++)if(o[u]>=a)return u;return o.length})(t,mg)]+=1;break}}}Os(e){const t=this.Rr.beforeSend;if(!t)return e;const n=Ue(t)?t:[t];let i=e;for(const a of n)try{const o=a(i);if(!o)return this.$.info("Metric was rejected in beforeSend function"),null;i=o}catch(o){return this.$.error("Error in beforeSend function for metric:",o),null}return i}Fs(){this.ps.pending||this.ps.arm(this.Hs())}Hs(){return Math.max(KS(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=WS()):(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(o,u,h){return qS(o,u,h)})(this.Rr,this._instance.getLibraryId(),this._instance.getLibraryVersion()),i=this._instance.getLibraryId(),a=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:VS(n)},scopeMetrics:[{scope:{name:i,version:a},metrics:t}]}]};var t,n,i,a}vo(e){const t=dw(Date.now()),n=new Map;for(const u of e.values()){var i;const h=hw(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=Xh((i=u.attributes)!==null&&i!==void 0?i:{},this.$),g=dw(u.windowStartMs);if(u.type==="count"){var a;const v={attributes:m,startTimeUnixNano:g,timeUnixNano:t,asDouble:(a=u.total)!==null&&a!==void 0?a:0};f.sum.dataPoints.push(v)}else if(u.type==="gauge"){var o;const v={attributes:m,timeUnixNano:t,asDouble:(o=u.last)!==null&&o!==void 0?o:0};f.gauge.dataPoints.push(v)}else u.hist&&f.histogram.dataPoints.push({attributes:m,startTimeUnixNano:g,timeUnixNano:t,count:u.hist.count,sum:u.hist.sum,min:u.hist.min,max:u.hist.max,bucketCounts:u.hist.bucketCounts,explicitBounds:mg})}return Array.from(n.values())}ho(e){for(const[i,a]of e){const o=this.zs.get(i);if(o)switch(o.windowStartMs=Math.min(o.windowStartMs,a.windowStartMs),o.type){case"count":var t,n;o.total=((t=o.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(o.hist){o.hist.count+=a.hist.count,o.hist.sum+=a.hist.sum,o.hist.min=Math.min(o.hist.min,a.hist.min),o.hist.max=Math.max(o.hist.max,a.hist.max);for(let u=0;o.hist.bucketCounts.length>u;u++)o.hist.bucketCounts[u]+=a.hist.bucketCounts[u]}else o.hist=a.hist}else this.Ks()&&this.zs.set(i,a)}}};const ZS=(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)=>ZS(`${e} ${i}`,a)};return n},ye=ZS("[PostHog.js]"),Wt=ye.createLogger,S6=Wt("[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 S6.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 o=i.__posthog_loading_error;return o?n(o):(i.addEventListener("load",u=>{i.__posthog_loading_callback_fired=!0,n(void 0,u)}),void i.addEventListener("error",u=>{i.__posthog_loading_error=u,n(u)}))}const a=()=>{if(!he)return n("document not found");if(Wh(t))return Wa(e,t,n);let o=he.createElement("script");if(o.type="text/javascript",o.crossOrigin="anonymous",o.src=t,o.onload=h=>{o.__posthog_loading_callback_fired=!0,n(void 0,h)},o.onerror=h=>{o.__posthog_loading_error=h,n(h)},e.config.prepare_external_dependency_script&&(o=e.config.prepare_external_dependency_script(o)),!o)return n("prepare_external_dependency_script returned null");if(e.config.external_scripts_inject_target==="head")he.head.appendChild(o);else{const h=he.querySelectorAll("body > script");var u;h.length>0?(u=h[0].parentNode)===null||u===void 0||u.insertBefore(o,h[0]):he.body.appendChild(o)}};he!=null&&he.body?a():he==null||he.addEventListener("DOMContentLoaded",a)},gg={},fw=(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`),o=gg[a];if(i==="fallback"&&o){if(Wh(o))return void Wa(e,o,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=fw(e,t);gg[a]=m;const g=Wh(a);g==null||(f=g.parentNode)===null||f===void 0||f.removeChild(g),Wa(e,m,n)}else n(void 0,h)}:n)}Wa(e,fw(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.435.1",hr.LIB_NAME="web";var yn=hr;const k6="$people_distinct_id",oi="distinct_id",kx="$device_id",xg="$device_model",Kh="__alias",j6="__cmpns",pw="$fbc",mo="$fbc_persistence",mw="$fbp",su="$fbp_persistence",A0="__timers",JS="$autocapture_disabled_server_side",M0="$heatmaps_enabled_server_side",R0="$exception_capture_enabled_server_side",ek="$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",tk="$logs_capture_enabled_server_side",nk="$web_vitals_allowed_metrics",iu="$session_recording_remote_config",N6="$session_recording_enabled_server_side",C6="$replay_sample_rate",E6="$replay_override_sampling",T6="$replay_override_linked_flag",A6="$replay_override_url_trigger",M6="$replay_override_event_trigger",co="$sesid",sk="$session_is_sampled",R6="$session_past_minimum_duration",O6="$session_recording_url_trigger_activated_session",L6="$session_recording_event_trigger_activated_session",D6="$debug_first_full_snapshot_timestamp",z6="$sess_rec_flush_size",ci="$enabled_feature_flags",ur="$active_feature_flags",D0="$early_access_features",el="$feature_flag_details",ia="$feature_flag_payloads",tl="$feature_flag_request_id",ru="$minimal_flag_called_events",Ai="$override_feature_flags",Ka="$override_feature_flag_payloads",ra="$stored_person_properties",aa="$stored_group_properties",ik="$groups",Xc="$surveys",Zh="$surveys_loaded_at",rk="$surveys_activated",ak="$surveys_activated_session",lk="$surveys_activated_timestamps",z0="ph_product_tours",$6="$product_tours_activated",B6="$product_tours_activated_session",P6="$conversations_widget_session_id",U6="$conversations_ticket_id",F6="$conversations_widget_state",I6="$conversations_user_traits",la="$flag_call_reported",Wc="$flag_call_reported_session_id",yu="$feature_flag_errors",oa="$feature_flag_evaluated_at",ts="$user_state",$0="$client_session_props",H6="$capture_rate_limit",ok="$initial_campaign_params",ck="$initial_referrer_info",uo="$initial_person_info",Cx="$epp",vg="$posthog_cookieless",uk="$cookieless_mode",dk="$sdk_debug_extensions_init_method",hk="$sdk_debug_extensions_init_time_ms",fk="$sdk_debug_recording_script_not_loaded",pk="$sdk_debug_replay_stale_config",q6="$sdk_debug_replay_event_trigger_status",V6="$sdk_debug_replay_linked_flag_trigger_status",G6="$sdk_debug_replay_matched_recording_trigger_groups",Y6="$sdk_debug_replay_pending_trigger_conditions",Q6="$sdk_debug_replay_remote_trigger_matching_config",X6="$sdk_debug_replay_trigger_groups_count",W6="$sdk_debug_replay_url_trigger_status",K6="$session_recording_start_reason",Ex="PostHog loadExternalDependency extension not found.",dr="anonymous",Oh="identified",mk="identified_only",_u="visibilitychange",Jh="beforeunload",Tx="$pageview",gw="$pageleave",gk="$identify",xw="$groupidentify";function ho(e,t){Ue(e)&&e.forEach(t)}function kt(e,t){if(!qe(e))if(Ue(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 Z6=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 kt(e,function(n,i){(Je(n)&&n.length>0||Jt(n))&&(t[i]=n)}),t};function xk(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 J6=["herokuapp.com","vercel.app","netlify.app"];function eA(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 J6)if(n===i)return!1;return!0}function xt(e,t,n,i){const{capture:a=!1,passive:o=!0}=i??{};e==null||e.addEventListener(t,n,{capture:a,passive:o})}function B0(e){return e.name==="ph_toolbar_internal"}const au=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 tA=class P0{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,n,i,a){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(i)||!Number.isInteger(a)||0>t||0>n||0>i||0>a||t>0xffffffffffff||n>4095||i>1073741823||a>4294967295)throw new RangeError("invalid field value");const o=new Uint8Array(16);return o[0]=t/Math.pow(2,40),o[1]=t/Math.pow(2,32),o[2]=t/Math.pow(2,24),o[3]=t/Math.pow(2,16),o[4]=t/256,o[5]=t,o[6]=112|n>>>8,o[7]=n,o[8]=128|i>>>24,o[9]=i>>>16,o[10]=i>>>8,o[11]=i,o[12]=a>>>24,o[13]=a>>>16,o[14]=a>>>8,o[15]=a,new P0(o)}toString(){let t="";for(let n=0;this.bytes.length>n;n++)t=t+(this.bytes[n]>>>4).toString(16)+(15&this.bytes[n]).toString(16),n!==3&&n!==5&&n!==7&&n!==9||(t+="-");if(t.length!==36)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new P0(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}},nA=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 tA.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 sA}};let vk=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&&(vk=e=>crypto.getRandomValues(e));var sA=class{nextUint32(){return this.Rt.length>this.$t||(vk(this.Rt),this.$t=0),this.Rt[this.$t++]}constructor(){this.Rt=new Uint32Array(8),this.$t=1/0}};let vw;const ui=()=>iA().toString(),iA=()=>(vw||(vw=new nA)).generate();let $c="";const rA=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let Kl=null;const Gt={Et(){if(!Qt(Kl))return Kl;if(Kl=!1,he)try{const e=`__ph_cookie_support_${ui()}`;Gt.At(e,"xyz"),Kl=au(e)==='"xyz"',Gt.Lt(e)}catch{Kl=!1}return Kl},Pt(e){ye.error("cookieStore error: "+e)},Ot:au,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 o="",u="";const h=(function(m,g){if(g){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 w=_.slice(j).join("."),C=N+"=1;domain=."+w+";path=/";y.cookie=C+";max-age=3",y.cookie.includes(N)&&(y.cookie=C+";max-age=0",$c=w)}return $c})(m);if(!v){const b=(y=>{const _=y.match(rA);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),o="; expires="+m.toUTCString()}a&&(u="; secure");const f=e+"="+encodeURIComponent(JSON.stringify(t))+o+"; 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&&(!t||!Qt(au(e))))try{Gt.At(e,"",-1,t)}catch{return}}};let bg=null;const ct={Et(){if(!Qt(bg))return bg;let e=!0;if(ue(te))e=!1;else try{const t="__mplssupport__";ct.At(t,"xyz"),ct.Ot(t)!=='"xyz"'&&(e=!1),ct.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){ct.Pt(t)}return null},Dt(e){try{return JSON.parse(ct.Ot(e))||{}}catch{}return null},At(e,t){try{return te==null||te.localStorage.setItem(e,JSON.stringify(t)),!0}catch(n){ct.Pt(n)}return!1},Lt(e){try{te==null||te.localStorage.removeItem(e)}catch(t){ct.Pt(t)}}},yg=[ra,ur,ci,el,ia,tl,oa,yu,la],Za=[kx,oi,co,sk,Cx,uo,mo,ts],ef=e=>e+"_cpm",aA=["__proto__","constructor","prototype"],_g=e=>{if(!st(e))return{};const t={};return Object.keys(e).forEach(n=>{aA.indexOf(n)===-1&&(t[n]=e[n])}),t},wg=(e,t=[])=>{const n={};return[...Za,...t].forEach(i=>{const a=e[i];ue(a)||Qt(a)||a===""||(n[i]=a)}),n},bk=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)},bw=(e,t)=>({p:t,f:bk(JSON.stringify(e))}),yw=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{const n=Gt.Dt(ef(e)),i=(n==null?void 0:n.f)===bk(t)&&Ue(n.p);return{properties:i?n.p:[],isValid:i}}catch{return{properties:[],isValid:!1}}},Sg=(e,t)=>t+"|"+(Gt.Ot(ef(e))||""),Zl={},U0={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(!Qt(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 lA=class{constructor(e){this._instance=e}get Rr(){return this._instance.config}get consent(){return this.No()?0:this.qo}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.jo.At(this.Bo,e?1:0,this.Rr.cookie_expiration,this.Rr.cross_subdomain_cookie,this.Rr.secure_cookie)}reset(){this.jo.Lt(this.Bo,this.Rr.cross_subdomain_cookie)}get Bo(){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 qo(){const e=this.jo.Ot(this.Bo);return og(e)?1:He(jT,e)?0:-1}get jo(){const e=this.Rr.opt_out_capturing_persistence_type,t=e==="localStorage"?ct:Gt,n=t.Et()?t:U0;if(!this.Ho||this.Ho!==n){this.Ho=n;const i=e==="localStorage"?Gt:ct;i.Ot(this.Bo)&&(this.Ho.Ot(this.Bo)||this.optInOut(og(i.Ot(this.Bo))),i.Lt(this.Bo,this.Rr.cross_subdomain_cookie))}return this.Ho}No(){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 yk(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 _w(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 Di(e){return!!e&&e.nodeType===1}function Pn(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function _k(e){return!!e&&e.nodeType===3}function Mx(e){return!!e&&e.nodeType===11&&Di(e.host)}function Rx(e){return e?vf(e).split(/\s+/):[]}function ww(e,t){const n=(function(i){var a;const o=te==null||(a=te.location)===null||a===void 0?void 0:a.href;return ue(o)?void 0:yk(i,o)})(t);return!!(n&&e&&e.some(i=>n.match(i)))}function _o(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 wk(e){return qe(e)?null:vf(e).split(/(\s+)/).filter(t=>ou(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function wu(e){let t="";return go(e)&&!Su(e)&&e.childNodes&&e.childNodes.length&&kt(e.childNodes,function(n){var i;_k(n)&&n.textContent&&(t+=(i=wk(n.textContent))!==null&&i!==void 0?i:"")}),vf(t)}function lu(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 F0(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 I0(e,t){if(ue(t))return!0;for(const n of e)if(t.some(i=>F0(n,i)))return!0;return!1}function Sk(e){const t=e.parentNode;return!(!t||!Di(t))&&t}const kg=[".ph-no-autocapture","[data-ph-no-autocapture]"],kk=["next","previous","prev",">","<"],oA=[...kk,"+","-","−","–"],Sw=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,kw=[".ph-no-rageclick",".ph-no-capture"],cA=["","text","search","email","password","url","tel","number"];function jk(e,t){if(!te||Lx(e))return!1;let n,i,a;var o,u;if(ns(t)?(n=!!t&&kw,i=void 0,a=!1):(n=(o=t==null?void 0:t.css_selector_ignorelist)!==null&&o!==void 0?o:kw,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||!Di(f))&&(!!Pn(f,"textarea")||(Pn(f,"input")?He(cA,(f.getAttribute("type")||"").toLowerCase()):(function(m){var g;if(m.isContentEditable)return!0;const v=(g=m.getAttribute)===null||g===void 0?void 0:g.call(m,"contenteditable");return v==="true"||v===""})(f)))})(e))return!1;const{targetElementList:h}=Nk(e,!1);return!(function(f,m){if(f===!1||ue(f))return!1;let g;if(f===!0)g=kk;else{if(!Ue(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;g=f.map(v=>v.toLowerCase())}return m.some(({safeText:v,ariaLabel:b})=>g.some(y=>Sw(v,y)||Sw(b,y)))})(i,h.map(f=>{var m;return{safeText:wu(f).toLowerCase(),ariaLabel:((m=f.getAttribute("aria-label"))===null||m===void 0?void 0:m.toLowerCase().trim())||""}}))&&!I0(h,n)}const Lx=e=>!e||Pn(e,"html")||!Di(e),Nk=(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 o=Sk(a);if(!o)break;if(t||Ox.indexOf(o.tagName.toLowerCase())>-1)n=!0;else try{const u=te.getComputedStyle(o);u&&u.getPropertyValue("cursor")==="pointer"&&(n=!0)}catch{}i.push(o),a=o}return{parentIsUsefulElement:n,targetElementList:i}};function go(e){const t=new Set;let n=0;for(let o=e;o.parentNode&&!Pn(o,"body");o=o.parentNode){if(n++>=1e3||t.has(o))return!1;t.add(o);const u=_o(o);if(He(u,"ph-sensitive")||He(u,"ph-no-capture"))return!1}if(He(_o(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 Su(e){return!!(Pn(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Pn(e,"select")||Pn(e,"textarea")||e.getAttribute("contenteditable")==="true")}const jw=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}))$"),Nw=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,uA=[16,15,14,13],dA=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Cw=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Ew=/[0-9A-Za-z_]/;function hA(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 ou(e,t=!0){return!(qe(e)||Je(e)&&(e=vf(e),(t?jw.test((e||"").replace(/[- ]/g,"")):(function(n){let i;for(Nw.lastIndex=0;i=Nw.exec(n);){const a=i[2];if(!a)continue;const o=a.replace(/[- ]/g,"");for(let u=0;o.length>u;u++)for(const h of uA){const f=u+h;if(o.length>=f){const m=o.slice(u,f);if(jw.test(m)&&hA(m))return!0}}}return!1})(e))||(t?dA.test(e):(function(n){let i;for(Cw.lastIndex=0;i=Cw.exec(n);){const a=i[1],o=i[3];if(!(a&&o&&Ew.test(a)&&Ew.test(o)))return!0}return!1})(e))))}function Tw(e){let t=wu(e);return t=`${t} ${Ck(e)}`.trim(),ou(t)?t:""}function Ck(e){let t="";return e&&e.childNodes&&e.childNodes.length&&kt(e.childNodes,function(n){var i;if(n&&((i=n.tagName)===null||i===void 0?void 0:i.toLowerCase())==="span")try{const a=wu(n);t=`${t} ${a}`.trim(),n.childNodes&&n.childNodes.length&&(t=`${t} ${Ck(n)}`.trim())}catch(a){ye.error("[AutoCapture]",a)}}),t}function Aw(e){return e.replace(/"|\\"/g,'\\"')}function fA(e){const t=e.attr__class;if(t)return Ue(t)?t:Rx(t)}const dh=Wt("[Dead Clicks]"),pA=()=>!0,mA=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 Mw=class{get lazyLoadedDeadClicksAutocapture(){return this.zo}constructor(e,t,n){this.instance=e,this.isEnabled=t,this.onCapture=n,this.startIfEnabledOrStop()}onRemoteConfig(e){if(!e.ok)return;const t=e.config;"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[jx]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.Uo(()=>{this.Wo()}):this.stop()}Uo(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()})}Wo(){var e;if(he){if(!this.zo&&(!((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.zo=$e.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.zo.start(he),dh.info("starting...")}}else dh.error("`document` not found. Cannot start.")}stop(){this.zo&&(this.zo.stop(),this.zo=void 0,dh.info("stopping..."))}};const Bc=Wt("[SegmentIntegration]");function Rw(e,t,n=!0){const i=e.config.segment;if(!i)return t();const{analytics:a,filterProperties:o}=(h=>kn(h.register))(u=i)?{analytics:u}:u;var u;(function(h,f,m,g){const v=y=>{const _=()=>y.anonymousId()||ui();h.config.get_device_id=_,g&&y.id()&&(h.register({distinct_id:y.id(),$device_id:_()}),h.persistence.set_property(ts,Oh)),m(g?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:g}={})=>{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(!qe(g)){const N=b.event.properties||{},w={};for(const E of Object.keys(j))bx.call(N,E)||(w[E]=j[E]);const C=((E,R)=>{const M=Ue(E)?E:[E];let L=B({},R);for(const F of M)try{if(L=F(L),qe(L))return null}catch(D){return Bc.error("Error in Segment filterProperties:",D),null}return L})(g,w);if(qe(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,gk)},screen(b){return v(b,"$screen")}}})(e,h,{filterProperties:o})).then(()=>{t()},f=>{Bc.error("Failed to register the Segment integration",f),t()})},n)}const Ek="posthog-js";function Tk(e,{organization:t,projectId:n,prefix:i,severityAllowList:a=["error"],sendExceptionsToPostHog:o=!0}={}){return u=>{var h,f,m,g,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(w=>B(B({},w),{},{stacktrace:w.stacktrace?B(B({},w.stacktrace),{},{type:"raw",frames:(w.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:((g=y[0])===null||g===void 0?void 0:g.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),o&&((N=e.exceptions)===null||N===void 0||N.sendExceptionEvent(j)),u}}var gA=class{constructor(e,t,n,i,a,o){this.name=Ek,this.setupOnce=function(u){u(Tk(e,{organization:t,projectId:n,prefix:i,severityAllowList:a,sendExceptionsToPostHog:o==null||o}))}}},Ow=class{constructor(e){this.Vo=(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.Go=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.Zo()}Zo(){var e;this.Qo=(e=this._instance.sessionManager)===null||e===void 0?void 0:e.onSessionId(this.Vo)}destroy(){var e;(e=this.Qo)===null||e===void 0||e.call(this),this.Qo=void 0}doPageView(e,t){var n;const i=this.Jo(e,t);return this.Go={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.Jo(e,(t=this.Go)===null||t===void 0?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.Go)===null||e===void 0?void 0:e.pageViewId}}Jo(e,t){const n=this.Go;if(!n)return{$pageview_id:t};let i={$pageview_id:t,$prev_pageview_id:n.pageViewId};const a=this._instance.scrollManager.getContext();if(a&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:o,lastScrollY:u,maxScrollY:h,maxContentHeight:f,lastContentY:m,maxContentY:g}=a;if(!(ue(o)||ue(u)||ue(h)||ue(f)||ue(m)||ue(g))){o=Math.ceil(o),u=Math.ceil(u),h=Math.ceil(h),f=Math.ceil(f),m=Math.ceil(m),g=Math.ceil(g);const v=o>1?Oi(u/o,0,1,ye):1,b=o>1?Oi(h/o,0,1,ye):1,y=f>1?Oi(m/f,0,1,ye):1,_=f>1?Oi(g/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:g,$prev_pageview_max_content_percentage:_})}}return n.pathname&&(i.$prev_pageview_pathname=n.pathname),n.timestamp&&(i.$prev_pageview_duration=(e.getTime()-n.timestamp.getTime())/1e3),i}};const Pc=["flags","surveys"],xA={[k6]:{exposure:"hidden"},[Kh]:{exposure:"hidden"},[j6]:{exposure:"hidden"},[A0]:{exposure:"hidden"},[mo]:{exposure:"hidden"},[su]:{exposure:"hidden"},[JS]:{exposure:"event"},[M0]:{exposure:"hidden"},[tk]:{exposure:"hidden"},[R0]:{exposure:"event"},[ek]:{exposure:"hidden"},[O0]:{exposure:"event"},[L0]:{exposure:"event"},[jx]:{exposure:"event"},[Nx]:{exposure:"hidden"},[nk]:{exposure:"event"},[iu]:{exposure:"hidden"},[N6]:{exposure:"hidden"},[co]:{exposure:"hidden"},[sk]:{exposure:"event"},[C6]:{exposure:"event",shouldSkipFromEventProperties:e=>Qt(e)},[R6]:{exposure:"event"},[O6]:{exposure:"event"},[L6]:{exposure:"event"},[D6]:{exposure:"event"},[z6]:{exposure:"hidden"},[ci]:{exposure:"hidden",storageGroup:"flags"},[ur]:{exposure:"hidden",storageGroup:"flags"},[D0]:{exposure:"hidden"},[el]:{exposure:"hidden",storageGroup:"flags"},[ia]:{exposure:"hidden",storageGroup:"flags"},[tl]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[ru]:{exposure:"hidden",storageGroup:"flags"},[Ai]:{exposure:"hidden"},[Ka]:{exposure:"hidden"},[ra]:{exposure:"hidden"},[aa]:{exposure:"hidden"},[Xc]:{exposure:"hidden",storageGroup:"surveys"},[Zh]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[rk]:{exposure:"event"},[ak]:{exposure:"hidden"},[lk]:{exposure:"hidden"},[z0]:{exposure:"hidden"},[$6]:{exposure:"hidden"},[B6]:{exposure:"hidden"},[P6]:{exposure:"event"},[U6]:{exposure:"event"},[F6]:{exposure:"event"},[I6]:{exposure:"event"},[la]:{exposure:"hidden"},[Wc]:{exposure:"hidden"},[ik]:{exposure:"event"},[yu]:{exposure:"hidden"},[oa]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[ts]:{exposure:"hidden"},[$0]:{exposure:"hidden"},[H6]:{exposure:"hidden"},[ok]:{exposure:"hidden"},[ck]:{exposure:"hidden"},[uo]:{exposure:"hidden"},[Cx]:{exposure:"hidden"},[E6]:{exposure:"event"},[T6]:{exposure:"event"},[A6]:{exposure:"event"},[M6]:{exposure:"event"},[dk]:{exposure:"event"},[hk]:{exposure:"event"},[fk]:{exposure:"event"},[pk]:{exposure:"event"},[q6]:{exposure:"event"},[V6]:{exposure:"event"},[G6]:{exposure:"event"},[Y6]:{exposure:"event"},[Q6]:{exposure:"event"},[X6]:{exposure:"event"},[W6]:{exposure:"event"},[K6]:{exposure:"event"}},vA=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Mn=e=>{const t=xA[e];if(t)return t;for(const[n,i]of vA)if(e.indexOf(n)===0)return i},fo=(e,t)=>{try{let n;return JSON.stringify(e,(i,a)=>{var o;return Eo(a)?((o=n)!==null&&o!==void 0||(n=new WeakMap),n.has(a)||n.set(a,xk(a)),n.get(a)):typeof a=="bigint"?a.toString():a},t)}catch{return eS(e)}},mr=e=>{const t=he==null?void 0:he.createElement("a");return ue(t)?null:(t.href=e,t)},wo=function(e,t){const n=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&");let i;for(let a=0;n.length>a;a++){const o=n[a].split("=");if(o[0]===t){i=o;break}}if(!Ue(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," ")}},ku=function(e,t,n){if(!e||!t||!t.length)return e;const i=e.split("#"),a=i[1],o=(i[0]||"").split("?"),u=o[1],h=o[0],f=(u||"").split("&"),m=[];for(let v=0;f.length>v;v++){const b=f[v].split("=");Ue(b)&&(t.includes(b[0])?m.push(b[0]+"="+n):m.push(f[v]))}let g=h;return u!=null&&(g+="?"+m.join("&")),a!=null&&(g+="#"+a),g},tf=function(e,t){const n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},Ak=(e,t)=>e>=t&&J2(),Mk=(e,t,n,i)=>{if(e===0){if(J2()){const a=t+1;return a===n&&i(),a}return t}return 0},So=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],bA=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...So],ju="<masked>",yA=["li_fat_id"];function Rk(e,t,n){if(!he)return{};const i=t?[...So,...n||[]]:[],a=Ok(ku(he.URL,i,ju),e),o=(function(){const u={};return kt(yA,function(h){const f=au(h);u[h]=f||null}),u})();return Dt(o,a)}function Ok(e,t){const n=bA.concat(t||[]),i={};return kt(n,function(a){const o=wo(e,a);i[a]=o||null}),i}function Lk(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(!Qt(t)){i.$search_engine=t;const a=he?wo(he.referrer,n):"";a.length&&(i.ph_keyword=a)}return i}function Dk(){return navigator.language||navigator.userLanguage}function _A(){const e=Dk();return typeof e=="string"?e.split("-")[0]:void 0}const nf="$direct";function zk(){return(he==null?void 0:he.referrer)||nf}function $k(e,t,n=!1){const i=e?[...So,...t||[]]:[],a=n?ua(Yt==null?void 0:Yt.href):Yt==null?void 0:Yt.href,o=a==null?void 0:a.substring(0,1e3);return{r:zk().substring(0,1e3),u:o?ku(o,i,ju):void 0}}function Bk(e,t=!1){var n;const{r:i,u:a}=e,o=t?ua(a):a,u={$referrer:i,$referring_domain:i==null?void 0:i==nf?nf:(n=mr(i))===null||n===void 0?void 0:n.host};if(o){u.$current_url=o;const h=mr(o);u.$host=h==null?void 0:h.host,u.$pathname=h==null?void 0:h.pathname;const f=Ok(o);Dt(u,f)}if(i){const h=Lk(i);Dt(u,h)}return u}function Pk(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function wA(){try{return new Date().getTimezoneOffset()}catch{return}}const SA={flags:oa,surveys:Zh},kA=["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",cr=[ci,ur,el,ia,tl,oa,ru,ra],jg=e=>cr.indexOf(e)!==-1,Uk=[mo,su],Lw=e=>Uk.indexOf(e)!==-1,Jr=(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:{}},Dw=(e,t)=>{kt(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.Ko={},this.Xo=!1,this.Yo=!1,this.ta=!1,this.ea=!1,this.ia=!1,this.na=new Map,this.sa=!1,this.ra=!1,this.oa=!1,this.aa=new Set,this.la=new Set,this.Rr=e,this.ua=n,this.props={},this.ha=void 0,this.ca=(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.mi=e.disable_persistence||!!t,this.jo=this.da(e),this.ta=this.va(e),this.load(),this.fa(),e.debug&&ye.info("Persistence loaded",e.persistence,B({},this.props)),this.update_config(e,e,t),this.save(),te){const i=()=>this.flush();xt(te,"beforeunload",i,{capture:!1}),xt(te,"pagehide",i,{capture:!1}),this.pa=a=>{if(this.Xo&&(!a.storageArea||a.storageArea===(te==null?void 0:te.localStorage))&&a.key)if(a.key!==this.ca){if(this.ta){const o=Pc.find(u=>a.key===this.ga(u));o&&this.ma(a.key,o)}}else this.ma(a.key,vn)},xt(te,"storage",this.pa)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(([t,n])=>{const i=this.na.get(t);if(!jg(t)||i===!0)return;if(n===!0)return void this.ya(t,!0);const a=new Set(i||[]);n.forEach(o=>a.add(o)),a.size&&this.ya(t,a)})}onCrossTabFeatureFlagChange(e){return this.la.add(e),()=>this.la.delete(e)}destroy(){this.pa&&te&&(te.removeEventListener("storage",this.pa),this.pa=void 0),this.la.clear()}ma(e,t,n=!0){if(this.mi)return!1;let i,a;try{if(a=ct.Ot(e),Qt(a)){const h=this.ba(t);return h.storageValue=null,t!==vn&&(h.persisted=!1),!1}i=Jl(a)}catch{return!1}const o=t===vn?i:ct.Dt(this.ca);if(o&&this._a(o))return!1;const u=this.wa(i,t,n);return t===vn&&this.ta&&!Jr(this.ka().main,i)||this.Sa(i,t,!0,a),u}_a(e){const t=this.props[oi],n=e[oi];return!ue(t)&&!ue(n)&&t!==n}Sa(e,t,n,i){const a=this.ba(t);a.storageValue=i,t!==vn&&(a.persisted=n);try{a.fingerprint=this.xa(e,t)}catch{a.fingerprint=void 0}}wa(e,t,n){let i=!1;return cr.forEach(a=>{var o;const u=(o=Mn(a))===null||o===void 0?void 0:o.storageGroup;if(t===vn&&this.ta&&u||t!==vn&&u!==t)return;const h=a in e,f=this.Ca(a,h?e[a]:void 0),m=this.na.has(a)?a in this.props:h;m===a in this.props&&Jr(f,this.props[a])||(m?this.$a(a,f,!1):this.Ta(a,!1),i=!0)}),i&&n&&this.la.forEach(a=>a()),i}Ia(){if(!this.Xo)return!1;try{this.oa=!1;const e=ct.Ot(this.ca),t=this.ba(vn);let n,i=!1,a=!1;if(e!==t.storageValue)if(Qt(e))t.storageValue=null;else{if(n=Jl(e),this.oa=!this.ra&&this._a(n),this.oa)return!1;a=this.wa(n,vn,!1),!this.ta||Jr(this.ka().main,n)?this.Sa(n,vn,!0,e):t.storageValue=e,i=!0}return this.ta&&Pc.forEach(o=>{const u=ct.Ot(this.ga(o)),h=this.ba(o),f=n||{},m=i&&cr.some(v=>{var b;return((b=Mn(v))===null||b===void 0?void 0:b.storageGroup)===o&&v in f});if(u===h.storageValue&&!m)return;if(Qt(u))return h.storageValue=null,h.persisted=!1,void(m&&(a=this.wa(f,o,!1)||a));const g=Jl(u);a=this.wa(g,o,!1)||a,this.Sa(g,o,!0,u)}),a}catch{return!1}}ya(e,t){this.na.set(e,t);const n=Mn(e);n!=null&&n.volatile||(this.ba((this.ta?n==null?void 0:n.storageGroup:void 0)||vn).fingerprint=void 0,this.Ma(e))}Ea(){cr.forEach(e=>this.na.set(e,!0))}fa(){if(this.Xo)try{const e=ct.Ot(this.ca),t=Jl(e);this.ba(vn).storageValue=e,cr.forEach(n=>{var i;const a=this.ta?(i=Mn(n))===null||i===void 0?void 0:i.storageGroup:void 0,o=a?ct.Ot(this.ga(a)):null;if(a){const h=this.ba(a);h.storageValue=o,h.persisted=!Qt(o)}const u=a&&!Qt(o)?Jl(o):t;n in this.props?this.Pa(n,u[n],this.props[n]):n in u&&this.ya(n,!0)})}catch{}}Ca(e,t){const n=this.na.get(e);if(!n)return t;if(n===!0)return this.props[e];if(e==="$active_feature_flags"){const o=new Set(Ue(t)?t:[]),u=new Set(Ue(this.props[e])?this.props[e]:[]);return n.forEach(h=>u.has(h)?o.add(h):o.delete(h)),Array.from(o)}const i=st(t)?B({},t):{},a=st(this.props[e])?this.props[e]:{};return n.forEach(o=>{o in a?i[o]=a[o]:delete i[o]}),i}Pa(e,t,n){if(!jg(e))return;const i=this.na.get(e);if(i===!0)return;let a=t;if(this.Xo)try{var o;const h=this.ta?(o=Mn(e))===null||o===void 0?void 0:o.storageGroup:void 0,f=h?this.ga(h):this.ca;a=Jl(ct.Ot(f))[e]}catch{}const u=new Set(i||[]);if(e==="$active_feature_flags"){if(!ue(t)&&!Ue(t)||!ue(a)&&!Ue(a)||!Ue(n))return void this.ya(e,!0);const h=new Set(t||[]),f=new Set(a||[]),m=new Set(n);new Set([...h,...m]).forEach(g=>{h.has(g)!==m.has(g)&&u.add(g)}),u.forEach(g=>{f.has(g)===m.has(g)&&u.delete(g)})}else{if(!st(n))return void(Jr(a,n)?this.na.delete(e):this.ya(e,!0));{if(!ue(t)&&!st(t)||ue(t)&&ms(n)&&ue(a))return void this.ya(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&&Jr(h[m],n[m])||u.add(m)}),u.forEach(m=>{m in f==m in n&&Jr(f[m],n[m])&&u.delete(m)})}}u.size?this.ya(e,u):this.na.delete(e)}Ra(){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}Aa(e){if(this.Rr.cookieWinsOnConflict&&this.Rr.persistence.toLowerCase()==="localstorage+cookie")if(e)try{const t=wg(e,this.Rr.cookie_persisted_properties||[]),n=bw(t,this.Rr.cookie_persisted_properties||[]),i=JSON.stringify(t)+"|"+JSON.stringify(n),a=Gt.Ot(this.ca)||void 0;a&&Sg(this.ca,a)===i&&(this.Fa=i,this.Oa=a)}catch{}else try{const t=Gt.Ot(this.ca)||void 0;this.Fa=t?Sg(this.ca,t):void 0,this.Oa=t}catch{}}syncCookieProperties(){return this.Da(this.Rr)}Da(e,t=!1){if(this.mi&&!t||this.ia||!e.cookieWinsOnConflict||e.persistence.toLowerCase()!=="localstorage+cookie")return!1;let n;try{n=Gt.Ot(this.ca)||void 0}catch{}if(!n||n===this.Oa)return!1;const i=Sg(this.ca,n);let a;try{a=_g(JSON.parse(n))}catch{return!1}if((Gt.Ot(this.ca)||void 0)!==n)return!1;this.Fa=i,this.Oa=n;const o=yw(this.ca,n),u=[...Za,...o.properties],h={};if(Object.keys(a).forEach(j=>{const N=a[j];(ue(N)||Qt(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,g=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];(o.isValid||Za.indexOf(j)===-1||N!==!1&&N!==0)&&delete b[j]}}),this.props=Dt(b,a),cr.forEach(j=>{const N=j in this.props;j in m===N&&Jr(m[j],this.props[j])||(N?this.Pa(j,m[j],this.props[j]):this.ya(j,!0))}),!f||"$user_state"in a||"$user_state"in this.props||this.$a(ts,dr);const y=this.props[oi],_=this.props[ts];return!f||y===g&&_===v||(this.ra=!0,this.ea=!0,Ot.At(hh(this.ca),!0),this.Ta(ra),this.Ta(ur),this.Ta(ci),this.Ta(el),this.Ta(ia),this.Ta(tl),this.Ta(oa),this.Ta(yu),this.Ta(la),_!=="anonymous"||v!=="identified"&&a.$user_state!=="anonymous"&&(ue(g)||y===g)||(Dw(this.props,a),this.Ta(aa)),_==="identified"?this.props.$user_id=y:delete this.props.$user_id,this.Ta(Kh)),!0}consumeCookieIdentityChange(){const e=hh(this.ca),t=this.ea||!!Ot.Ot(e);return this.ea=!1,t&&Ot.Lt(e),t}La(e=!1){return!(this.ia||this.mi&&!e||!this.Rr.cookieWinsOnConflict||this.Rr.persistence.toLowerCase()!=="localstorage+cookie"||(this.ia=!0,0))}Na(){this.ia&&(ue(this.qa)||(clearTimeout(this.qa),this.qa=void 0),delete this.Ko[vn],this.ja(!0))}Ba(e=!0){if(this.ia)try{e?this.Na():ue(this.qa)||(clearTimeout(this.qa),this.qa=void 0)}finally{this.ia=!1}}isDisabled(){return!!this.mi}da(e){kA.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({},ct),{},{Dt(m){try{let v,b={};try{v=Gt.Ot(m)||void 0,b=v?_g(JSON.parse(v)):{}}catch{}const y=JSON.parse(ct.Ot(m)||"{}");let _;if(h){const j=yw(m,v),N=[...Za,...j.properties],w={};Object.keys(b).forEach(E=>{const R=b[E];Qt(R)||R===""||E==="$user_state"&&R!=="anonymous"&&R!=="identified"||(w[E]=R)});const C="distinct_id"in w||w.$user_state==="anonymous"||w.$user_state==="identified";if(Object.keys(w).length>0){var g;const E=y[oi],R=(g=y.$user_state)!==null&&g!==void 0?g:dr;f.forEach(M=>{if(N.indexOf(M)!==-1&&!(M in b)&&(C||M!=="distinct_id"&&M!=="$user_state")){const L=y[M];(j.isValid||Za.indexOf(M)===-1||L!==!1&&L!==0)&&delete y[M]}}),!C||"$user_state"in b||"$user_state"in y||(y[ts]=dr),!C||("distinct_id"in w?w[oi]:y[oi])===E&&("$user_state"in w?w[ts]:y[ts])===R||(yg.forEach(M=>delete y[M]),w.$user_state==="identified"&&"distinct_id"in w?y.$user_id=w[oi]:delete y.$user_id,w.$user_state!=="identified"&&(delete y[ik],delete y[aa]),delete y.__alias)}_=Dt(y,w)}else _=Dt(b,y);return ct.At(m,_),_}catch{}return null},At(m,g,v,b,y,_){const j=ct.At(m,g,void 0,void 0,_);try{const N=wg(g,u);if(Object.keys(N).length){if(h){const w=ef(m),C=bw(N,u);if(Gt.At(w,C,v,b,y,_),Gt.Ot(w)!==JSON.stringify(C)){Gt.Lt(w,b);const E=wg(g);return Gt.At(m,E,v,b,y,_),j}}Gt.At(m,N,v,b,y,_)}}catch(N){ct.Pt(N)}return j},Lt(m,g){try{te==null||te.localStorage.removeItem(m),Gt.Lt(m,g),Gt.Lt(ef(m),g)}catch(v){ct.Pt(v)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict);let n,i=!1,a=!1;const o=e.persistence.toLowerCase();return o==="localstorage"&&ct.Et()?(n=ct,a=!0):o==="localstorage+cookie"&&t.Et()?(n=t,a=!0,i=!0):o==="sessionstorage"&&Ot.Et()?n=Ot:o==="memory"?n=U0:o==="cookie"&&Gt.Et()?(n=Gt,i=!0):t.Et()?(n=t,a=!0,i=!0):Gt.Et()?(n=Gt,i=!0):n=U0,this.Xo=a,this.Yo=i,n}ga(e){return`${this.ca}__${e}`}va(e){return this.Xo&&!!e.split_storage}properties(){const e={};return kt(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?ct.Dt(this.ca):null;let i={};if(t)try{i=_g(Gt.Dt(this.ca)),kt(i,(h,f)=>{(ue(h)||Qt(h)||h==="")&&delete i[f]})}catch{}const a=this.jo.Dt(this.ca);if(a&&(this.props=Dt({},a)),this.ta&&this.Ha(),t&&a){var o,u;const h=n==null?void 0:n[oi],f=(o=n==null?void 0:n.$user_state)!==null&&o!==void 0?o:dr,m=a[oi],g=(u=a.$user_state)!==null&&u!==void 0?u:dr;if(m!==h||g!==f){this.ea=!0,Ot.At(hh(this.ca),!0);const v=Dt({},this.props);yg.forEach(y=>delete v[y]),g!=="anonymous"||f!=="identified"&&i.$user_state!=="anonymous"&&(ue(h)||m===h)||(Dw(v,i),delete v[aa]),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 _={};kt(this.props,(j,N)=>{var w;((w=Mn(N))===null||w===void 0?void 0:w.storageGroup)===y&&(_[N]=j)}),ms(_)?(ct.Lt(this.ga(y)),this.Ko[y]={}):ct.At(this.ga(y),_)&&(this.Ko[y]={persisted:!0,fingerprint:this.xa(_,y)})})}}Ot.Ot(hh(this.ca))&&(this.ea=!0)}Ha(){for(const e of Pc){const t=ct.Dt(this.ga(e));if(t&&!ms(t)){const n=this.ba(e);n.persisted=!0,this.za(e)||(n.fingerprint=this.xa(t,e)),this.Ua(e,t)||Dt(this.props,t)}}}za(e){return Object.keys(this.props).some(t=>{var n;return((n=Mn(t))===null||n===void 0?void 0:n.storageGroup)===e})}Ua(e,t){const n=SA[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.aa.has(e))return;const n=this.ta?(t=Mn(e))===null||t===void 0?void 0:t.storageGroup:void 0,i=n?ct.Dt(this.ga(n)):this.jo.Dt(this.ca);if(i&&e in i)this.$a(e,i[e],!1);else{if(n){const a=this.jo.Dt(this.ca);if(a&&e in a)return void this.$a(e,a[e],!1)}this.Ta(e,!1)}}save(){if(this.mi)return;const e=this.Ra();e>0?ue(this.qa)&&(this.qa=setTimeout(()=>{this.qa=void 0,this.ja()},e)):this.ja()}flush(){ue(this.qa)||(clearTimeout(this.qa),this.qa=void 0,this.ja())}ja(e=!1){if(this.mi||this.ia&&!e)return;e||(this.syncCookieProperties(),this.Rr.cookieWinsOnConflict&&this.Rr.persistence.toLowerCase()==="localstorage+cookie"||Uk.forEach(a=>this.refreshKey(a)));const t=!e&&!this.sa;t||(this.oa=!1);const n=!!t&&this.Ia();if(this.oa)return void(this.Rr.debug&&ye.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.ta)return this.Wa(),void(n&&this.la.forEach(a=>a()));const i=this.Va(this.jo,this.ca,this.props,vn);i==="written"&&this.Aa(this.props),i!=="failed"&&(this.na.clear(),this.ra=!1,this.aa.clear()),n&&this.la.forEach(a=>a())}Wa(){const{main:e,groups:t}=this.ka(),n=this.Va(this.jo,this.ca,e,vn);n==="written"&&this.Aa(e),n!=="failed"&&(this.ra=!1,this.aa.clear(),cr.forEach(a=>{var o;!((o=Mn(a))===null||o===void 0)&&o.storageGroup||this.na.delete(a)}));for(const a of Pc){var i;const o=t[a];if(ms(o)&&!(!((i=this.Ko[a])===null||i===void 0)&&i.persisted)){cr.forEach(h=>{var f;((f=Mn(h))===null||f===void 0?void 0:f.storageGroup)===a&&this.na.delete(h)});continue}const u=this.Va(ct,this.ga(a),o,a);u!=="failed"&&cr.forEach(h=>{const f=Mn(h);(f==null?void 0:f.storageGroup)!==a||u!=="written"&&f.volatile||this.na.delete(h)})}}ka(){const e={},t={flags:{},surveys:{}};return kt(this.props,(n,i)=>{var a;const o=(a=Mn(i))===null||a===void 0?void 0:a.storageGroup;o?t[o][i]=n:e[i]=n}),{main:e,groups:t}}xa(e,t){if(t===vn)return JSON.stringify(e)+"|"+this.Ga+"|"+this.Za+"|"+this.Qa;const n={};return kt(e,(i,a)=>{var o;n[a]=!((o=Mn(a))===null||o===void 0)&&o.volatile?"__volatile__":i}),JSON.stringify(n)}Va(e,t,n,i){const a=this.ba(i);if(i!==vn&&!a.dirty&&!ue(a.fingerprint))return"skipped";let o;try{if(o=this.xa(n,i),o===a.fingerprint)return a.dirty=!1,"skipped"}catch{o=void 0}return e.At(t,n,this.Ga,this.Za,this.Qa,this.Rr.debug)?(a.dirty=!1,i!==vn&&(a.persisted=!0),ue(o)||(a.fingerprint=o),this.Xo&&(a.storageValue=ct.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.Ea(),ue(this.qa)||(clearTimeout(this.qa),this.qa=void 0),this.jo.Lt(this.ca,!1),this.jo.Lt(this.ca,!0),!e&&this.ua)for(const t of Pc)ct.Lt(this.ga(t));e?delete this.Ko[vn]:this.Ko={},this.Fa=void 0,this.Oa=void 0}clear(){this.remove(),this.props={}}register_once(e,t,n){if(st(e)){this.syncCookieProperties(),ue(t)&&(t="None"),this.Ga=ue(n)?this.Ja:n;let i=!1;if(kt(e,(a,o)=>{this.props.hasOwnProperty(o)&&this.props[o]!==t||(this.$a(o,a),i=!0)}),i)return this.save(),!0}return!1}register(e,t){if(st(e)){this.syncCookieProperties(),this.Ga=ue(t)?this.Ja:t;let n=!1;if(kt(e,(i,a)=>{e.hasOwnProperty(a)&&(this.props[a]!==i||st(i)||Ue(i))&&(this.$a(a,i),n=!0)}),n)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();const t=typeof e=="string"?[e]:e;let n=!1;for(const i of t)i in this.props&&(this.Ta(i),n=!0);n&&this.save()}update_campaign_params(){const e=he==null?void 0:he.URL;if(e===this.ha)return;const t=Rk(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.ha=e,n?t:void 0}update_search_keyword(){this.register((function(){const e=he==null?void 0:he.referrer;return e?Lk(e):{}})())}update_referrer_info(){var e;this.register_once({$referrer:zk(),$referring_domain:(he==null?void 0:he.referrer)&&((e=mr(he.referrer))===null||e===void 0?void 0:e.host)||nf},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const e=$k(this.Rr.mask_personal_data_properties,this.Rr.custom_personal_data_properties,this.Rr.disable_capture_url_hashes);this.register_once({[uo]:this.Yo?{r:fh(e.r),u:e.u?fh(e.u):void 0}:e},void 0)}get_initial_props(){const e={};kt([ck,ok],n=>{const i=this.props[n];i&&kt(i,function(a,o){e["$initial_"+w0(o)]=a})});const t=this.props[uo];if(t){const n=(function(i,a=!1){const o=Bk(i,a),u={};return kt(o,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 kt(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((w,C)=>w===N[C])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),o=i||a,u=e.cookieWinsOnConflict!==t.cookieWinsOnConflict,h=e.disable_persistence||!!n,f=!!this.mi&&!h;h||this.Da(t,f),this.Rr=e,!h&&(i||a||u)&&(this.Fa=void 0,this.Oa=void 0,this.Da(B(B({},e),{},{cookie_persisted_properties:t.cookie_persisted_properties}),f));const m=o||u?this.da(e):this.jo;this.Ka();const g=this.va(e),v=o||g!==this.ta,b=!h&&(v||e.cross_subdomain_cookie!==this.Za||e.secure_cookie!==this.Qa)&&this.La(f);this.sa=v;try{if(this.Ja=this.Ga=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.jo=m,this.ta=g,this.props=y,this.save()}else u&&(this.jo=m,h||(delete this.Ko[vn],this.ja()))}finally{this.sa=!1,b&&this.Ba()}}Ka(){const e=this.props[uo];if(!this.Yo||!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.$a(uo,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.Za&&(this.Za=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.Qa&&(this.Qa=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){const n=this.props.__timers||{};n[e]=t,this.$a(A0,n),this.save()}remove_event_timer(e){const t=this.props.__timers||{},n=t[e];return ue(n)||(delete t[e],this.$a(A0,t),this.save()),n}get_property(e){return this.props[e]}set_property(e,t){this.$a(e,t),this.save()}$a(e,t,n=!0){var i;const a=this.props[e];this.props[e]=t,n&&(e!=="distinct_id"&&e!=="$user_state"||a===t||(this.ra=!0),Lw(e)&&!Jr(a,t)&&this.aa.add(e),this.Pa(e,a,t),!((i=Mn(e))===null||i===void 0)&&i.volatile||this.Ma(e))}Ta(e,t=!0){delete this.props[e],t&&(jg(e)&&this.ya(e,!0),Lw(e)&&this.aa.add(e),this.Ma(e))}Ma(e){var t;const n=(t=Mn(e))===null||t===void 0?void 0:t.storageGroup;n&&(this.ba(n).dirty=!0)}ba(e){return this.Ko[e]||(this.Ko[e]={})}};const Ls={GZipJS:"gzip-js",Base64:"base64"},Uc={Activation:"events",Cancellation:"cancelEvents"},Cg={Popover:"popover",API:"api",Widget:"widget"},Os={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"},H0={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 jA={SHOWN:"product tour shown"},zw={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},$w=Wt("[RateLimiter]");var NA=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=>{$w.info(`${i||"events"} is quota limited.`),this.serverLimits[i]=new Date().getTime()+6e4})}catch(i){return void $w.warn(`could not rate limit - continuing. Error: "${i==null?void 0:i.message}"`,{text:n})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)===null||e===void 0?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)===null||e===void 0?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e=!1){var t,n,i;const{captureEventsBurstLimit:a,captureEventsPerSecond:o}=this,u=new Date().getTime(),h=(t=(n=this.instance.persistence)===null||n===void 0?void 0:n.get_property("$capture_rate_limit"))!==null&&t!==void 0?t:{tokens:a,last:u};h.tokens+=(u-h.last)/1e3*o,h.last=u,h.tokens>a&&(h.tokens=a);const f=1>h.tokens;if(f||e||(h.tokens=Math.max(0,h.tokens-1)),f&&!e){const m=(Jt(h.dropped)?h.dropped:0)+1;h.dropped=m,!this.lastEventRateLimited&&this.Xa(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}}Ya(e){const t=this.instance.config.property_denylist;return!Ue(t)||!t.includes(e)}tl(){var e;if(this.Ya("$current_url")&&this.Ya("$pathname")&&(Yt!=null&&Yt.pathname))return`${(e=Yt.origin)!==null&&e!==void 0?e:""}${Yt.pathname}`}Xa(e){var t,n;const{captureEventsBurstLimit:i,captureEventsPerSecond:a}=this,o=this.tl(),u=this.Ya("$session_id")?(t=(n=this.instance).get_session_id)===null||t===void 0?void 0:t.call(n):void 0,h=[`${e} event(s) dropped since the last warning`,o?`triggered on ${o}`:void 0,u?`session ${u}`:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:`posthog-js client rate limited: ${h}. Config is set to ${a} events per second and ${i} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(e){const t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}};const ea=Wt("[RemoteConfig]");var Fk=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}el(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()}il(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 ea.info("Using preloaded remote config",this.remoteConfig),void this.nl(this.remoteConfig);if(this._instance.sl())return void ea.warn("Remote config is disabled. Falling back to local config.");this.el(e=>{if(!e)return ea.info("No config found after loading remote JS config. Falling back to JSON."),void this.il(t=>{this.nl(t.json,t)});this.nl(e)})}catch(e){ea.error("Error loading remote config",e),this.nl()}}nl(e,t){!e&&t&&(t.statusCode===0?t.error||ea.warn("Failed to fetch remote config from PostHog."):ea.error("Failed to fetch remote config from PostHog."));try{this._instance.nl(e?{ok:!0,config:e}:{ok:!1})}catch(i){ea.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){ea.error("Error loading feature flags",i)}}},Qs=Uint8Array,gs=Uint16Array,ko=Uint32Array,Dx=new Qs([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 Qs([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]),Bw=new Qs([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ik=function(e,t){for(var n=new gs(31),i=0;31>i;++i)n[i]=t+=1<<e[i-1];var a=new ko(n[30]);for(i=1;30>i;++i)for(var o=n[i];n[i+1]>o;++o)a[o]=o-n[i]<<5|i;return[n,a]},Hk=Ik(Dx,2),q0=Hk[1];Hk[0][28]=258,q0[258]=28;for(var Pw=Ik(zx,0)[1],qk=new gs(32768),Xt=0;32768>Xt;++Xt){var eo=(43690&Xt)>>>1|(21845&Xt)<<1;qk[Xt]=((65280&(eo=(61680&(eo=(52428&eo)>>>2|(13107&eo)<<2))>>>4|(3855&eo)<<4))>>>8|(255&eo)<<8)>>>1}var cu=function(e,t,n){for(var i=e.length,a=0,o=new gs(t);i>a;++a)++o[e[a]-1];var u,h=new gs(t);for(a=0;t>a;++a)h[a]=h[a-1]+o[a-1]<<1;for(u=new gs(i),a=0;i>a;++a)u[a]=qk[h[e[a]-1]++]>>>15-e[a];return u},il=new Qs(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 sf=new Qs(32);for(Xt=0;32>Xt;++Xt)sf[Xt]=5;var CA=cu(il,9),EA=cu(sf,5),Vk=function(e){return(e/8|0)+(7&e&&1)},Gk=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var i=new(e instanceof gs?gs:e instanceof ko?ko:Qs)(n-t);return i.set(e.subarray(t,n)),i},ir=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,o=n.slice();if(!a)return[new Qs(0),0];if(a==1){var u=new Qs(n[0].s+1);return u[n[0].s]=1,[u,1]}n.sort(function(M,L){return M.f-L.f}),n.push({s:-1,f:25001});var h=n[0],f=n[1],m=0,g=1,v=2;for(n[0]={s:-1,f:h.f+f.f,l:h,r:f};g!=a-1;)h=n[n[v].f>n[m].f?m++:v++],f=n[m!=g&&n[v].f>n[m].f?m++:v++],n[g++]={s:-1,f:h.f+f.f,l:h,r:f};var b=o[0].s;for(i=1;a>i;++i)o[i].s>b&&(b=o[i].s);var y=new gs(b+1),_=V0(n[g-1],y,0);if(_>t){i=0;var j=0,N=_-t,w=1<<N;for(o.sort(function(M,L){return y[L.s]-y[M.s]||M.f-L.f});a>i;++i){var C=o[i].s;if(t>=y[C])break;j+=w-(1<<_-y[C]),y[C]=t}for(j>>>=N;j>0;){var E=o[i].s;t>y[E]?j-=1<<t-y[E]++-1:++i}for(;i>=0&&j;--i){var R=o[i].s;y[R]==t&&(--y[R],++j)}_=t}return[new Qs(y),_]},V0=function(e,t,n){return e.s==-1?Math.max(V0(e.l,t,n+1),V0(e.r,t,n+1)):t[e.s]=n},Uw=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new gs(++t),i=0,a=e[0],o=1,u=function(f){n[i++]=f},h=1;t>=h;++h)if(e[h]==a&&h!=t)++o;else{if(!a&&o>2){for(;o>138;o-=138)u(32754);o>2&&(u(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(u(a),--o;o>6;o-=6)u(8304);o>2&&(u(o-3<<5|8208),o=0)}for(;o--;)u(a);o=1,a=e[h]}return[n.subarray(0,i),t]},Ic=function(e,t){for(var n=0,i=0;t.length>i;++i)n+=e[i]*t[i];return n},G0=function(e,t,n){var i=n.length,a=Vk(t+2);e[a]=255&i,e[a+1]=i>>>8,e[a+2]=255^e[a],e[a+3]=255^e[a+1];for(var o=0;i>o;++o)e[a+o+4]=n[o];return 8*(a+4+i)},Fw=function(e,t,n,i,a,o,u,h,f,m,g){ir(t,g++,n),++a[256];for(var v=Tg(a,15),b=v[0],y=v[1],_=Tg(o,15),j=_[0],N=_[1],w=Uw(b),C=w[0],E=w[1],R=Uw(j),M=R[0],L=R[1],F=new gs(19),D=0;C.length>D;++D)F[31&C[D]]++;for(D=0;M.length>D;++D)F[31&M[D]]++;for(var X=Tg(F,7),U=X[0],G=X[1],O=19;O>4&&!U[Bw[O-1]];--O);var de,W,q,H,I=m+5<<3,re=Ic(a,il)+Ic(o,sf)+u,ve=Ic(a,b)+Ic(o,j)+u+14+3*O+Ic(F,U)+(2*F[16]+3*F[17]+7*F[18]);if(re>=I&&ve>=I)return G0(t,g,e.subarray(f,f+m));if(ir(t,g,1+(re>ve)),g+=2,re>ve){de=cu(b,y),W=b,q=cu(j,N),H=j;var A=cu(U,G);for(ir(t,g,E-257),ir(t,g+5,L-1),ir(t,g+10,O-4),g+=14,D=0;O>D;++D)ir(t,g+3*D,U[Bw[D]]);g+=3*O;for(var Ee=[C,M],Me=0;2>Me;++Me){var z=Ee[Me];for(D=0;z.length>D;++D)ir(t,g,A[P=31&z[D]]),g+=U[P],P>15&&(ir(t,g,z[D]>>>5&127),g+=z[D]>>>12)}}else de=CA,W=il,q=EA,H=sf;for(D=0;h>D;++D)if(i[D]>255){var P;Fc(t,g,de[257+(P=i[D]>>>18&31)]),g+=W[P+257],P>7&&(ir(t,g,i[D]>>>23&31),g+=Dx[P]);var oe=31&i[D];Fc(t,g,q[oe]),g+=H[oe],oe>3&&(Fc(t,g,i[D]>>>5&8191),g+=zx[oe])}else Fc(t,g,de[i[D]]),g+=W[i[D]];return Fc(t,g,de[256]),g+W[256]},TA=new ko([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),AA=(function(){for(var e=new ko(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 MA(e,t){t===void 0&&(t={});var n=(function(){var v=4294967295;return{p(b){for(var y=v,_=0;b.length>_;++_)y=AA[255&y^b[_]]^y>>>8;v=y},d(){return 4294967295^v}}})(),i=e.length;n.p(e);var a,o,u,h,f,m=(h=10+((a=t).filename&&a.filename.length+1||0),f=8,(function(v,b,y,_,j,N){var w=v.length,C=new Qs(_+w+5*(1+Math.floor(w/7e3))+j),E=C.subarray(_,C.length-j),R=0;if(!b||8>w)for(var M=0;w>=M;M+=65535){var L=M+65535;w>L?R=G0(E,R,v.subarray(M,L)):(E[M]=N,R=G0(E,R,v.subarray(M,w)))}else{for(var F=TA[b-1],D=F>>>13,X=8191&F,U=(1<<y)-1,G=new gs(32768),O=new gs(U+1),de=Math.ceil(y/3),W=2*de,q=function(Qe){return(v[Qe]^v[Qe+1]<<de^v[Qe+2]<<W)&U},H=new ko(25e3),I=new gs(288),re=new gs(32),ve=0,A=0,Ee=(M=0,0),Me=0,z=0;w>M;++M){var P=q(M),oe=32767&M,we=O[P];if(G[oe]=we,O[P]=oe,M>=Me){var Ne=w-M;if((ve>7e3||Ee>24576)&&Ne>423){R=Fw(v,E,0,H,I,re,A,Ee,z,M-z,R),Ee=ve=A=0,z=M;for(var Ae=0;286>Ae;++Ae)I[Ae]=0;for(Ae=0;30>Ae;++Ae)re[Ae]=0}var De=2,ze=0,Ce=X,Re=oe-we&32767;if(Ne>2&&P==q(M-Re))for(var Ut=Math.min(D,Ne)-1,Kt=Math.min(32767,M),Ft=Math.min(258,Ne);Kt>=Re&&--Ce&&oe!=we;){if(v[M+De]==v[M+De-Re]){for(var jt=0;Ft>jt&&v[M+jt]==v[M+jt-Re];++jt);if(jt>De){if(De=jt,ze=Re,jt>Ut)break;var wt=Math.min(Re,jt-2),Xe=0;for(Ae=0;wt>Ae;++Ae){var St=M-Re+Ae+32768&32767,nn=St-G[St]+32768&32767;nn>Xe&&(Xe=nn,we=St)}}}Re+=(oe=we)-(we=G[oe])+32768&32767}if(ze){H[Ee++]=268435456|q0[De]<<18|Pw[ze];var se=31&q0[De],je=31&Pw[ze];A+=Dx[se]+zx[je],++I[257+se],++re[je],Me=M+De,++ve}else H[Ee++]=v[M],++I[v[M]]}}R=Fw(v,E,N,H,I,re,A,Ee,z,M-z,R)}return Gk(C,0,_+Vk(R)+j)})(o=e,(u=t).level==null?6:u.level,u.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(o.length)))):12+u.mem,h,f,!0)),g=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,g-8,n.d()),Ag(m,g-4,i),m}const RA=!!vx||!!vu,Yk=new WeakMap,Qk="text/plain";let Mg=0,Dh=!1;const Xk=(e,t)=>{const[n,i]=e.split("#"),[a,o]=n.split("?");if(!o)return e;const u=o.split("&").filter(h=>h.split("=")[0]!==t).join("&");return`${a}${u?`?${u}`:""}${i?`#${i}`:""}`},Mu=(e,t,n=!0)=>{var i;const[a,o]=e.split("?"),u=B({},t),h=(i=o==null?void 0:o.split("&").map(m=>{var g;const[v,b]=m.split("="),y=n&&(g=u[v])!==null&&g!==void 0?g:b;return delete u[v],`${v}=${y}`}))!==null&&i!==void 0?i:[],f=(function(m,g="&"){let v,b;const y=[];return kt(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(g)})(u);return f&&h.push(f),h.length>0?`${a}?${h.join("&")}`:a},Rg=e=>{if(e.rl)return e.rl;const{data:t,compression:n}=e;if(!t)return;if(n===Ls.GZipJS){const a=MA((function(o){var u=o.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(o);for(var h=new Qs(o.length+(o.length>>>1)),f=0,m=function(y){h[f++]=y},g=0;u>g;++g){if(f+5>h.length){var v=new Qs(f+8+(u-g<<1));v.set(h),h=v}var b=o.charCodeAt(g);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&o.charCodeAt(++g))>>>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 Gk(h,0,f)})(fo(t)),{mtime:0});return{contentType:Qk,body:a.buffer.slice(a.byteOffset,a.byteOffset+a.byteLength),estimatedSize:a.byteLength}}if(n===Ls.Base64){const a=(function(u){return u&&btoa(encodeURIComponent(u).replace(/%([0-9A-F]{2})/g,(h,f)=>String.fromCharCode(parseInt(f,16))))})(fo(t)),o=(u=>"data="+encodeURIComponent(typeof u=="string"?u:fo(u)))(a);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}const i=fo(t);return{contentType:"application/json",body:i,estimatedSize:new Blob([i]).size}},Wk=e=>{const t=()=>e.transport==="sendBeacon"?{url:Mu(e.url,{compression:Ls.Base64}),encodedBody:Rg(B(B({},e),{},{compression:Ls.Base64,rl:void 0}))}:{url:Xk(e.url,"compression"),encodedBody:Rg(B(B({},e),{},{compression:void 0,rl:void 0}))};let n;try{n=Rg(e)}catch(a){if(lw(e.compression,wo(e.url,"compression")))return ye.error("Failed to gzip request body, sending uncompressed payload",a),t();throw a}return n&&lw(e.compression,wo(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},Kk=e=>{try{return Wk(e)}catch(n){var t;return ye.error(n),void((t=e.callback)===null||t===void 0||t.call(e,{statusCode:0,error:n}))}},OA=(function(){var e=Bt(function*(t){const n=yield(function(a){return T0.apply(this,arguments)})(fo(t.data),yn.DEBUG,{rethrow:!0});if(!n)return t;const i=yield n.arrayBuffer();return B(B({},t),{},{rl:{contentType:Qk,body:i,estimatedSize:i.byteLength}})});return function(t){return e.apply(this,arguments)}})(),LA=/Failed to fetch|NetworkError|Load failed/i,Zk=e=>(e==null?void 0:e.name)==="TypeError"&&LA.test((e==null?void 0:e.message)||""),Jk=e=>{try{const t=(function(n,i=Date.now()){if(typeof n!="string"||!n)return;const a=n.trim(),o=/^\d+\s*,/.test(a)?a.slice(0,a.indexOf(",")).trim():a;if(/^\d+$/.test(o)){const f=1e3*Math.min(Number(o),300);return f>0?f:void 0}if(!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(o))return;const u=/^\w{3} \w{3} /.test(o)?o+" GMT":o,h=Date.parse(u)-i;return Number.isFinite(h)&&h>0?Math.min(h,Rh):void 0})(e());return ue(t)?void 0:Math.min(t,3e4)}catch{return}},ej=e=>{const t=Kk(e);if(!t)return;const n=new vx;Yk.set(n,!0);const{url:i,encodedBody:a}=t;n.open(e.method||"GET",i,!0);const{contentType:o,body:u}=a??{};kt(e.headers,function(h,f){n.setRequestHeader(f,h)}),o&&n.setRequestHeader("Content-Type",o),e.timeout&&(n.timeout=e.timeout),n.onreadystatechange=()=>{if(n.readyState===4){var h;const f={statusCode:n.status,text:n.responseText};if(n.status===200)try{f.json=JSON.parse(n.responseText)}catch{}(h=e.callback)===null||h===void 0||h.call(e,f,Jk(()=>n.getResponseHeader("Retry-After")))}},n.send(u)},tj=e=>{const t=Kk(e);if(!t)return;const{url:n,encodedBody:i}=t,{contentType:a,body:o,estimatedSize:u}=i??{},h=new Headers;kt(e.headers,function(_,j){h.append(j,_)}),a&&h.append("Content-Type",a);let f=null,m=!1;if(G_){const _=new G_;f={signal:_.signal,timeout:setTimeout(()=>{m=!0;try{_.abort(LS("AbortError","PostHog request timed out"+((j=e.timeout)?` after ${j}ms`:"")))}catch(N){v(N)}var j},e.timeout)}}let g=!1;const v=_=>{var j;g||(g=!0,m&&(_==null?void 0:_.name)==="AbortError"||Zk(_)?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:o,signal:f==null?void 0:f.signal},e.fetchOptions),j=u??(ue(o)?0:void 0);_.keepalive=_.method==="POST"&&!e.ol&&_.keepalive!==!1&&_.body===o&&!ue(j)&&j>=0&&52428.8>Mg+j,_.keepalive&&(b=j,Mg+=b),vu(n,_).then(N=>N.text().then(w=>{var C;if(g)return;const E={statusCode:N.status,text:w};if(N.status===200)try{E.json=JSON.parse(w)}catch(R){ye.error(R)}g=!0,y(),(C=e.callback)===null||C===void 0||C.call(e,E,Jk(()=>N.headers.get("Retry-After")))})).catch(N=>{y(),v(N)}).finally(y)}catch(_){y(),v(_)}},Y0=e=>{try{var t;const{url:n,encodedBody:i}=Wk(e),{contentType:a,body:o,estimatedSize:u}=i??{};if(!o)return;const h=o instanceof Blob?o:new Blob([o],{type:a});if(jn.sendBeacon(n,h))return;const f=Ue(e.data)?e.data:(t=e.data)===null||t===void 0?void 0:t.batch;if(Ue(f)&&f.length>1&&(u??0)>16384){const m=Math.ceil(f.length/2),g=v=>Ue(e.data)?v:B(B({},e.data),{},{batch:v});return Y0(B(B({},e),{},{data:g(f.slice(0,m))})),void Y0(B(B({},e),{},{data:g(f.slice(m))}))}ye.warn(`Beacon of ~${u??0} bytes was rejected by the browser, falling back to ${vu?"fetch":"XHR"}`),vu?tj(B(B({},e),{},{ol:!0})):ej(e)}catch(n){ye.warn("Beacon send failed",n)}},Iw=(e,t,n,i)=>{const a=i==="query"?t==="POST"?"sent_at":"_":void 0;return Mu(n===Ls.GZipJS?Xk(e,"compression"):e,B(B({},a?{[a]:Date.now().toString()}:{}),n===Ls.GZipJS?{}:{compression:n}))},DA=(()=>{const e=[];return vu&&e.push({transport:"fetch",method:tj}),vx&&e.push({transport:"XHR",method:ej}),jn!=null&&jn.sendBeacon&&e.push({transport:"sendBeacon",method:Y0}),e})();let nj=!RA&&(es==null?void 0:es.indexOf("MSIE"))===-1&&(es==null?void 0:es.indexOf("Mozilla"))===-1;function sj(e,t,n){var i,a,o;n&&(t=B(B({},t),{},{callback:u=>n(u)})),e.__loaded?nj?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,g;const v=B(B({},u),{},{callback:h??(N=>{var w;return(w=u.callback)===null||w===void 0?void 0:w.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=Ls.Base64),v.method==="POST"&&v.data&&(v.timestampMode==="capture-body"?v.data=(N=>{var w,C;const E=(Ue(N)?N:[N]).map(M=>B(B({},M),M.timestamp instanceof Date&&!isNaN(M.timestamp.getTime())?{timestamp:M.timestamp.toISOString()}:{})),R=E[0];return{api_key:(w=R==null||(C=R.properties)===null||C===void 0?void 0:C.token)!==null&&w!==void 0?w:R==null?void 0:R.token,batch:E,sent_at:new Date().toISOString()}})(v.data):v.timestampMode==="body"&&(v.data=((N,w=new Date().toISOString())=>Ue(N)?N.map(C=>B(B({},C),{},{sent_at:w})):B(B({},N),{},{sent_at:w}))(v.data))),v.url=Iw(v.url,v.method,v.compression,v.timestampMode);const y=DA.filter(N=>!v.disableTransport||!N.transport||!v.disableTransport.includes(N.transport)),_=(m=(g=(function(N,w){for(let C=0;N.length>C;C++)if(w(N[C]))return N[C]})(y,N=>N.transport===b))===null||g===void 0?void 0:g.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 w;Zk(C)?ye.warn(C):ye.error(C),(w=v.callback)===null||w===void 0||w.call(v,{statusCode:0,error:C})}};b!=="sendBeacon"&&!v.preferSyncCompression&&v.data&&v.compression===Ls.GZipJS&&vT&&typeof Promise<"u"&&!Dh?OA(v).then(N=>{j(N)}).catch(N=>{if(ow(N))return Dh=!0,void j(B(B({},v),{},{compression:void 0,url:Iw(u.url,u.method,void 0,u.timestampMode)}));(w=>{if(!w||typeof w!="object")return!1;const C="name"in w?String(w.name):"";return ow(w)||C===FS})(N)&&(Dh=!0),j(v)}):j(v)})(t,(u,h)=>{var f,m,g;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):(g=t.callback)===null||g===void 0||g.call(t,u)})):t.fireCallbackOnDrop&&((o=t.callback)===null||o===void 0||o.call(t,{statusCode:0}))}var zA=class{constructor(e,t){this.al=!0,this.ll=[],this.ul=Oi((t==null?void 0:t.flush_interval_ms)||3e3,250,5e3,ye.createLogger("flush interval"),3e3),this.hl=e}enqueue(e){this.ll.push(e),this.cl||this.dl()}unload(){this.vl();const e=this.ll.length>0?this.fl():{},t=Object.values(e);[...t.filter(n=>n.url.indexOf("/e")===0),...t.filter(n=>n.url.indexOf("/e")!==0)].map(n=>{this.pl(n,"sendBeacon")})}enable(){this.al=!1,this.dl()}dl(){this.al||(this.cl=setTimeout(()=>{if(this.vl(),this.ll.length>0){const e=this.fl();for(const t in e)this.pl(e[t])}},this.ul))}pl(e,t){try{this.hl(e,t)}catch(n){ye.error(n)}}vl(){clearTimeout(this.cl),this.cl=void 0}fl(){const e={};return kt(this.ll,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.ll=[],e}};const $A=["retriesPerformedSoFar"];var BA=class{constructor(e){this._instance=e,this.gl=!1,this.ml=3e3,this.ll=[],this.ll=[],this.yl=!0,this.resume()}resume(){if(!ue(te)&&"onLine"in te.navigator){if(this.yl=te.navigator.onLine,this.bl)return;this.bl=()=>{this.yl=!0,this._l()},this.wl=()=>{this.yl=!1},xt(te,"online",this.bl),xt(te,"offline",this.wl)}}get length(){return this.ll.length}retriableRequest(e,t){let{retriesPerformedSoFar:n}=e,i=IS(e,$A);or(n)&&(i.url=Mu(i.url,{retry_count:n})),sj(this._instance,t?B(B({},i),{},{transport:t}):i,(a,o)=>{var u;if(a.statusCode!==200&&(400>a.statusCode||a.statusCode>=500)){if((a.statusCode===0?3:10)>(n??0))return void this.Ls(B({retriesPerformedSoFar:n},i),o);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),g=(Math.random()-.5)*(m-f);return Math.ceil(m+g)})(n),t??0),a=Date.now()+i;this.ll.push({retryAt:a,requestOptions:e});let o=`Enqueued failed request for retry in ${i}`;navigator.onLine||(o+=" (Browser is offline)"),ye.warn(o),this.gl||(this.gl=!0,this.kl())}kl(){if(this.Sl&&clearTimeout(this.Sl),this.ll.length===0)return this.gl=!1,void(this.Sl=void 0);this.Sl=setTimeout(()=>{this.yl&&this.ll.length>0&&this._l(),this.kl()},this.ml)}_l(){const e=Date.now(),t=[],n=this.ll.filter(i=>e>i.retryAt||(t.push(i),!1));if(this.ll=t,n.length>0)for(const{requestOptions:i}of n)this.retriableRequest(i)}unload(){this.Sl&&(clearTimeout(this.Sl),this.Sl=void 0),this.gl=!1,ue(te)||(this.bl&&(te.removeEventListener("online",this.bl),this.bl=void 0),this.wl&&(te.removeEventListener("offline",this.wl),this.wl=void 0));for(const{requestOptions:e}of this.ll)try{this._instance._send_request(B(B({},e),{},{transport:"sendBeacon"}))}catch(t){ye.error(t)}this.ll=[]}},PA=class{constructor(e){this._instance=e,this.xl=()=>{var t,n,i,a;this.Cl||(this.Cl={});const o=this.scrollElement(),u=this.scrollY(),h=o?Math.max(0,o.scrollHeight-o.clientHeight):0,f=u+((o==null?void 0:o.clientHeight)||0),m=(o==null?void 0:o.scrollHeight)||0;this.Cl.lastScrollY=Math.ceil(u),this.Cl.maxScrollY=Math.max(u,(t=this.Cl.maxScrollY)!==null&&t!==void 0?t:0),this.Cl.maxScrollHeight=Math.max(h,(n=this.Cl.maxScrollHeight)!==null&&n!==void 0?n:0),this.Cl.lastContentY=f,this.Cl.maxContentY=Math.max(f,(i=this.Cl.maxContentY)!==null&&i!==void 0?i:0),this.Cl.maxContentHeight=Math.max(m,(a=this.Cl.maxContentHeight)!==null&&a!==void 0?a:0)}}get $l(){return this._instance.config.scroll_root_selector}getContext(){return this.Cl}resetContext(){const e=this.Cl;return this.Cl=void 0,setTimeout(this.xl,0),e}startMeasuringScrollPosition(){xt(te,"scroll",this.xl,{capture:!0}),xt(te,"scrollend",this.xl,{capture:!0}),xt(te,"resize",this.xl)}scrollElement(){if(this.$l){const n=Ue(this.$l)?this.$l:[this.$l];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}Tl(e){var t,n;const i=e==="y"?"scrollTop":"scrollLeft";if(this.$l){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.Tl("y")}scrollX(){return this.Tl("x")}};const UA=e=>$k(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 Hw=class{constructor(e,t,n,i){this.Be=a=>{const o=this.Il();if(o&&o.sessionId===a)return;const u={sessionId:a,props:this.Ml(this._instance)};this.El.register({[$0]:u})},this._instance=e,this.Pl=t,this.El=n,this.Ml=i||UA,this.Pl.onSessionId(this.Be)}Il(){return this.El.props[$0]}getSetOnceProps(){var e;const t=(e=this.Il())===null||e===void 0?void 0:e.props;return t?"r"in t?Bk(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 kt(Ax(this.getSetOnceProps()),(t,n)=>{n==="$current_url"&&(n="url"),e[`$session_entry_${w0(n)}`]=t}),e}},rf=class{on(e,t){return this.Rl[e]||(this.Rl[e]=[]),this.Rl[e].push(t),()=>{this.Rl[e]=this.Rl[e].filter(n=>n!==t)}}emit(e,t){for(const n of this.Rl[e]||[])n(t);for(const n of this.Rl["*"]||[])n(e,t)}constructor(){this.Rl={}}};const to=Wt("[SessionId]"),qw=864e5;var Vw=class{on(e,t){return this.Al.on(e,t)}constructor(e,t,n){var i;if(this.Fl=null,this.Ol=null,this.Dl=[],this.Ll=void 0,this.Nl=!1,this.Al=new rf,this.ql=(o,u)=>!(!or(o)||!or(u))&&Math.abs(o-u)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Rr=e.config,this.El=e.persistence,this.He=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.jl=void 0,this._sessionActivityTimestamp=null,this.Bl=t||ui,this.Hl=n||ui;const a=this.Rr.persistence_name||this.Rr.token;if(this._sessionTimeoutMs=1e3*Oi(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.zl(),this.Ul="ph_"+a+"_window_id",this.Wl="ph_"+a+"_primary_window_exists",this.Vl()){const o=Ot.Dt(this.Ul),u=Ot.Dt(this.Wl);o&&!u?this.He=o:Ot.Lt(this.Ul),Ot.At(this.Wl,!0)}!((i=this.Rr.bootstrap)===null||i===void 0)&&i.sessionID&&this.setBootstrapSessionId(this.Rr.bootstrap.sessionID),this.Gl()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return ue(this.Dl)&&(this.Dl=[]),this.Dl.push(e),this.Xt&&e(this.Xt,this.He),()=>{this.Dl=this.Dl.filter(t=>t!==e)}}Vl(){return this.Rr.persistence!=="memory"&&!this.El.mi&&Ot.Et()}Zl(e){e!==this.He&&(this.He=e,this.Vl()&&Ot.At(this.Ul,e))}Ql(){return this.He?this.He:this.Vl()?Ot.Dt(this.Ul):null}Jl(e){const t=this.Fl;return!Qt(t)&&!Qt(e)&&5e3>Math.abs(e-t)}Kl(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.Jl(t)||(this.Fl=t,this.El.register({[co]:[t,e,n]}))}Xl(){var e;const t=(e=this.Rr)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return or(t)&&t>0}Yl(){this.Xl()?this.El.refreshKey(co):(this.El.flush(),this.El.load())}tu(){var e;if(Qt(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Fl)return;this.Yl();const[,t,n]=this.eu();t===this.Xt&&n===this._sessionStartTimestamp&&(this.Fl=this._sessionActivityTimestamp,this.El.register({[co]:[this._sessionActivityTimestamp,(e=this.Xt)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.El.flush())}iu(){const[e]=this.eu(),t=or(e)?e:0,n=or(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,n)}nu(e){return this.Yl(),this.ql(e,this.iu())}eu(){const e=this.El.props[co];return Ue(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Fl=null,this.jl=void 0,clearTimeout(this.su),this.su=void 0,this.Kl(null,null,null)}setBootstrapSessionId(e,t=!1){const n=((i,a=new Date().getTime())=>{try{const o=(u=>{const h=u.replace(/-/g,"");if(h.length!==32)throw new Error("Not a valid UUID");if(h[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(h.substring(0,12),16)})(i);return o>a+6e4?void to.error("Bootstrap sessionID cannot be in the future"):o}catch(o){return void to.error("Invalid sessionID in bootstrap",o)}})(e);return!ue(n)&&(t?this.jl={sessionId:e,sessionStartTimestamp:n}:this.Kl(e,new Date().getTime(),n),!0)}destroy(){this.Nl=!0,this.tu(),clearTimeout(this.su),this.su=void 0,this.Ll&&te&&(te.removeEventListener(Jh,this.Ll,{capture:!1}),this.Ll=void 0),this.Dl=[]}Gl(){this.Ll=()=>{this.tu(),this.Vl()&&Ot.Lt(this.Wl)},xt(te,Jh,this.Ll,{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.Ol=i;else if(Qt(this.Ol)||this.Ol>i||i-this.Ol>=1e3){var o,u;(o=(u=this.El).syncCookieProperties)===null||o===void 0||o.call(u),this.Ol=i}let[,h,f]=this.eu();const m=!ue(a)&&h!==a,g=this.iu();let v=this.Ql();const b=this.jl,y=!!b&&(b.sessionStartTimestamp>i+6e4||i-b.sessionStartTimestamp>qw),_=b?y:or(f)&&Math.abs(i-f)>qw;let j=!1,N=m,w=!h||!!b;const C=h;let E=!w&&!e&&this.ql(i,g);if(E&&(E=this.nu(i),E||to.info("cross-tab refresh kept the session alive",{sessionId:h}),[,h,f]=this.eu(),E||(w=!h||!!b)),w||E||_){N=!1;const F=b&&!y;h=F?b.sessionId:this.Bl(),v=this.Hl(),to.info("new session ID assigned",{sessionId:h,windowId:v,bootstrapped:!!F,changeReason:{noSessionId:w,activityTimeout:E,sessionPastMaximumLength:_}}),f=F?b.sessionStartTimestamp:i,this.jl=void 0,j=!0}else v||(v=this.Hl(),j=!0),N=N||h!==C,N&&(to.info("adopted cross-tab session id",{sessionId:h,windowId:v}),j=!0);const R=or(g)&&e&&!_?g:i,M=or(f)?f:new Date().getTime();this.Zl(v),this.Kl(h,R,M),e||this.zl();const L={noSessionId:w,activityTimeout:E,sessionPastMaximumLength:_,crossTabAdoption:N};return j&&this.Dl.forEach(F=>F(h,v,L)),{sessionId:h,windowId:v,sessionStartTimestamp:M,changeReason:j?L:void 0,lastActivityTimestamp:g}}zl(){this.Nl||(clearTimeout(this.su),this.su=setTimeout(()=>{if(!this.Nl)if(this.nu(new Date().getTime())){const e=this.Xt;this.resetSessionId(),this.Al.emit("forcedIdleReset",{idleSessionId:e})}else this.zl()},1.1*this.sessionTimeoutMs))}};const ij=function(e,t){if(!e)return!1;const n=e.userAgent;if(n&&Q_(n,t))return!0;try{const i=e==null?void 0:e.userAgentData;if(i!=null&&i.brands&&i.brands.some(a=>Q_(a==null?void 0:a.brand,t)))return!0}catch{}return!!e.webdriver};function rj(){return(rj=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 FA(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 aj(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 af=(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(),lj={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=>af(n,i))),not_regex:(e,t)=>t.every(n=>e.every(i=>!af(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 oj(e,t){return!e||Object.entries(e).every(([n,i])=>{const a=t==null?void 0:t[n];if(a==null)return!1;const o=lj[i.operator];return!!o&&o(i.values.map(String),[String(a)])})}function Og(e,t,n){return fo({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}const Q0="custom",Gw="i.posthog.com",IA=/^\/static\//,HA=["/s/","/e/","/i/"];var qA=class{constructor(e){this.ru={},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(`.${Gw}`,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.ru[this.apiHost]||(this.ru[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.ru[this.apiHost]}ou(e){if(!IA.test(e))return;const t=this.instance.config.asset_host;return typeof t=="string"&&t.trim().replace(/\/$/,"")||void 0}au(e){const t=mr(e);return t?t.protocol+"//"+t.host+t.pathname:void 0}lu(e,t,n){if(e==="ui")return n;let i=n;const a=this.instance.config.rewriteRequestPath;if(a){var o;const u=((o=mr(n))===null||o===void 0?void 0:o.href)||n;i=a(new URL(u)).toString()}if(a&&e==="api"&&HA.some(u=>t.indexOf(u)===0)){const u=this.au(i);if(u){const h=this.apiHost;let f=this.uu;(f==null?void 0:f.apiHost)===h&&f.rewriteRequestPath===a||(f={apiHost:h,rewriteRequestPath:a,urls:new Set},this.uu=f),f.urls.add(u)}}return i}isIngestionEndpoint(e){const t=this.uu,n=this.au(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.lu(e,t,this.uiHost+t);if(e==="flags")return this.lu(e,t,this.flagsApiHost+t);if(e==="assets"){const i=this.ou(t);if(i)return this.lu(e,t,`${i}${t}`)}if(this.region===Q0)return this.lu(e,t,this.apiHost+t);const n=Gw+t;switch(e){case"assets":return this.lu(e,t,`https://${this.region}-assets.${n}`);case"api":return this.lu(e,t,`https://${this.region}.${n}`)}}};const _t=Wt("[Surveys]"),cj=e=>{try{const t=(n=>((i,a)=>`seenSurvey_${(function(o){return o.current_iteration&&o.current_iteration>0?`${o.id}_${o.current_iteration}`:o.id})(a)}`)(0,n))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(t){_t.error("Failed to persist survey seen state",t)}},VA=[Cg.Popover,Cg.Widget,Cg.API],GA={ignoreConditions:!1,ignoreDelay:!1,displayType:H0.Popover},YA=Wt("[PostHog ExternalIntegrations]"),QA={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var XA=class{constructor(e){this._instance=e}Uo(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 YA.error("failed to load script",a);t()})}startIfEnabledOrStop(){var e;for(const[a,o]of Object.entries((e=this._instance.config.integrations)!==null&&e!==void 0?e:{})){var t,n,i;o&&!(!((t=$e.__PosthogExtensions__)===null||t===void 0||(t=t.integrations)===null||t===void 0)&&t[a])&&this.Uo(QA[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)}),!o&&(!((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())}}},WA=class{constructor(e,t){this.$=e,this.wo=t,this.hu=new Map,this.Mo=!1}add(e){var t=this;return Bt(function*(){if(t.Mo)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(t.hu.has(e.name))throw new Error(`Browser extension "${e.name}" is already registered`);t.hu.set(e.name,e);try{const n=e.setup(t.wo);n&&(yield n)}catch(n){const i=t.hu.get(e.name)===e;i&&t.hu.delete(e.name),t.$.error(`Failed to set up browser extension "${e.name}"`,n),i&&t.cu(e)}})()}getExtension(e){return this.hu.get(e)}dispose(){if(this.Mo)return;this.Mo=!0;const e=Array.from(this.hu.values()).reverse();this.hu.clear();for(const t of e)this.cu(t)}cu(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)}}},KA=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 Yw="extensionsRemoteConfig";var ZA=class{constructor(e){this.instance=e,this.Mo=!1,this.$=ye,this.du=e.vu,this.kv=new KA(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.Mo)return ph(()=>{});const n=a=>{try{t(a)}catch(o){this.$.error("Browser extension remote config listener failed",o)}},i=this.instance.fu.on(Yw,n);return this.du&&n(this.du),ph(i)},this.pu=new WA(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.pu.add(e)}getExtension(e){return this.pu.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.gu(e))}handleRemoteConfig(e){this.Mo||(this.du=e,this.instance.fu.emit(Yw,e))}sendRequest(e){var t=this;return Bt(function*(n,i={}){var a;const o=t.instance.requestRouter.endpointFor((a=i.target)!==null&&a!==void 0?a:"api",n),u={method:i.method,url:i.query?Mu(o,i.query):o,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.Mo||(this.Mo=!0,this.pu.dispose())}};const uu={};let Lg=0;const du=()=>{},Qw='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',no="Surveys module not available",Xw="sanitize_properties is deprecated. Use before_send instead",uj="Invalid value for property_denylist config: ",JA=/^[A-Za-z0-9_-]{1,400}$/,Ww=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,Kw=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,eM=["token","distinct_id",uk],Kc="posthog",tM=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:eA(he==null?void 0:he.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:du,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:mk,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:du},(n=>({rageclick:n&&n>="2026-05-30"?{content_ignorelist:oA,ignore_text_selection:!0}:!n||"2025-11-30">n||{content_ignorelist:!0},capture_pageview:!n||"2025-05-24">n||"history_change",session_recording:tM(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))},nM=[["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"]],Zw=e=>{const t={};for(const[a,o]of nM)ue(e[a])||(t[o]=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)),Ue(e.property_blacklist)&&(ue(e.property_denylist)?n.property_denylist=e.property_blacklist:Ue(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:ye.error(uj+e.property_denylist)),n};var sM=class{constructor(){this.__forceAllowLocalhost=!1}get mu(){return this.__forceAllowLocalhost}set mu(e){ye.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},hu=class sa{yu(t){if(!t)return;const n=this.hu.indexOf(t);n!==-1&&this.hu.splice(n,1)}bu(t,n){var i;return this.yu(t),this.hu.push(n),(i=n.initialize)===null||i===void 0||i.call(n),n}_u(){return this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isRejected()}wu(){if(this.ku||this.config.reuseAnonymousId||this.config.segment||this._u())return;const t=this.config.persistence==="memory"||this.config.persistence==="sessionStorage";if(!t&&!this.config.disable_persistence||this.Su)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.ku=!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}`)}xu(){if(this._u()||this.get_distinct_id()!=="$posthog_cookieless")return;const t=this.persistence;if(!t)return;this.Cu()||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,dr)}this.$u()}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.Tu=!1,this.Iu=!1,this.webPerformance=new sM,this.Mu=!1,this.version=yn.LIB_VERSION,this.Eu=new Set,this.Pu="",this.fu=new rf,this.hu=[],this.Ru=[],this.Su=!1,this.ku=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Dg(),this.SentryIntegration=gA,this.sentryIntegration=i=>(function(a,o){const u=Tk(a,o);return{name:Ek,processEvent:h=>u(h)}})(this,i),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Au=!1,this.Fu=null,this.Ou=null,this.Du=null,this.scrollManager=new PA(this),this.pageViewManager=new Ow(this),this.rateLimiter=new NA(this),this.requestRouter=new qA(this),this.consent=new lA(this),this.externalIntegrations=new XA(this);const n=(t=sa.__defaultExtensionClasses)!==null&&t!==void 0?t:{};this.featureFlags=n.featureFlags&&new n.featureFlags(this),this.toolbar=n.toolbar&&new n.toolbar(this),this.surveys=n.surveys&&new n.surveys(this),this.conversations=n.conversations&&new n.conversations(this),this.logs=n.logs&&new n.logs(this),this.metrics=n.metrics&&new n.metrics(this),this.experiments=n.experiments&&new n.experiments(this),this.exceptions=n.exceptions&&new n.exceptions(this),this.people={set:(i,a,o)=>{const u=Je(i)?{[i]:a}:i;this.setPersonProperties(u),o==null||o({})},set_once:(i,a,o)=>{const u=Je(i)?{[i]:a}:i;this.setPersonProperties(void 0,u),o==null||o({})}},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 o=(a=uu[i])!==null&&a!==void 0?a:new sa;return o._init(t,n,i),uu[i]=o,uu[Kc][i]=o,o}return this._init(t,n,i)}_init(t,n={},i){var a,o,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.Lu(n.debug),this.Nu=n,this.qu=[],n.person_profiles?this.Ou=n.person_profiles:n.process_person&&(this.Ou=n.process_person);const m=Dg(n.defaults),g=Zw(n),v=Dt({},m,g,{name:i,token:h});st(m.rageclick)&&st(g.rageclick)&&(v.rageclick=Dt({},m.rageclick,g.rageclick)),st(m.session_recording)&&st(g.session_recording)&&(v.session_recording=Dt({},m.session_recording,g.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:Ls.GZipJS;const b=this.Cu();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.Pu="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties",this.config.persistence!=="memory"&&!b&&Ot.Et()){const w=Ot.Dt(this.Pu);Ue(w)&&w.forEach(C=>{Je(C)&&this.Eu.add(C)})}else Ot.Lt(this.Pu);const y=B({},this.persistence.props),_=B({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.ju=new zA((w,C)=>this.Bu(w,C),this.config.request_queue_config),this.Hu=new BA(this),this.__request_queue=[];const j=this._u();j||(this.sessionManager=new Vw(this),this.sessionPropsManager=new Hw(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((w,C,E)=>{(E!=null&&E.activityTimeout||E!=null&&E.sessionPastMaximumLength||E!=null&&E.crossTabAdoption)&&this.zu()})),this.Uu(),this.config.__preview_deferred_init_extensions?(ye.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.Wu(j)},0)):(ye.info("Initializing extensions synchronously"),this.Wu(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=(o=n.bootstrap)===null||o===void 0?void 0:o.distinctID;if(this.Su=!!N&&!tu(N),(u=n.bootstrap)===null||u===void 0?void 0:u.distinctID){const w=n.bootstrap.distinctID,C=this.get_distinct_id(),E=this.persistence.get_property(ts);if(n.bootstrap.isIdentifiedID&&C!=null&&C!==w&&E==="anonymous")this.identify(w);else if(n.bootstrap.isIdentifiedID&&C!=null&&C!==w&&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()),M=n.bootstrap.isIdentifiedID?R:w;this.persistence.set_property(ts,n.bootstrap.isIdentifiedID?Oh:dr),this.register({distinct_id:w,$device_id:M})}}if(j)this.register_once({distinct_id:vg,$device_id:null},"");else if(!this.get_distinct_id()){const w=this.config.get_device_id(ui());this.register_once({distinct_id:w,$device_id:w},""),this.persistence.set_property(ts,dr)}return xt(te,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),xt(te,"pageshow",()=>{var w;this.Tu=!1,this.Iu||(w=this.Hu)===null||w===void 0||w.resume()}),n.segment?Rw(this,()=>this.Vu()):this.Vu(),kn(this.config._onCapture)&&this.config._onCapture!==du&&(ye.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",w=>this.config._onCapture(w.event,w))),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 rj.apply(this,arguments)})().then(w=>{w&&this.register({[xg]:w})}).catch(du),this}Gu(t){const n=t;return Je(n.name)&&kn(n.setup)}Zu(t,n){this.Gu(t)?n.push(()=>{this.Qu().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.hu.push(t)}Uu(){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=sa.__defaultExtensionClasses)===null||i===void 0?void 0:i.featureFlags;var o,u,h;a&&(this.featureFlags&&this.featureFlags instanceof a||((o=this.Ju)===null||o===void 0||o.call(this),this.Ju=void 0,this.featureFlags=new a(this)),kn(this.featureFlags.onReloading)&&kn(this.featureFlags.setup)?this.Ju||(this.Ju=this.featureFlags.onReloading(()=>{this.fu.emit("featureFlagsReloading",!0)}),this.Qu().add(this.featureFlags)):(u=(h=this.featureFlags).initialize)===null||u===void 0||u.call(h))}Wu(t){const n=performance.now(),i=B(B({},sa.__defaultExtensionClasses),this.config.__extensionClasses),a=[];var o,u,h,f,m,g,v;i.exceptions&&this.hu.push(this.exceptions=(o=this.exceptions)!==null&&o!==void 0?o:new i.exceptions(this)),i.historyAutocapture&&this.hu.push(this.historyAutocapture=new i.historyAutocapture(this)),i.tracingHeaders&&this.hu.push(this.tracingHeaders=new i.tracingHeaders(this)),i.siteApps&&this.hu.push(this.siteApps=new i.siteApps(this)),i.sessionRecording&&!t&&this.hu.push(this.sessionRecording=new i.sessionRecording(this)),this.config.disable_scroll_properties||a.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),i.autocapture&&this.Zu(this.autocapture=new i.autocapture(this),a),i.surveys&&this.Zu(this.surveys=(u=this.surveys)!==null&&u!==void 0?u:new i.surveys(this),a),i.logs&&this.Zu(this.logs=(h=this.logs)!==null&&h!==void 0?h:new i.logs(this),a),i.metrics&&this.hu.push(this.metrics=(f=this.metrics)!==null&&f!==void 0?f:new i.metrics(this)),i.conversations&&this.hu.push(this.conversations=(m=this.conversations)!==null&&m!==void 0?m:new i.conversations(this)),i.productTours&&this.hu.push(this.productTours=new i.productTours(this)),i.heatmaps&&this.hu.push(this.heatmaps=new i.heatmaps(this)),i.webVitalsAutocapture&&this.hu.push(this.webVitalsAutocapture=new i.webVitalsAutocapture(this)),i.exceptionObserver&&this.hu.push(this.exceptionObserver=new i.exceptionObserver(this)),i.deadClicksAutocapture&&this.hu.push(this.deadClicksAutocapture=new i.deadClicksAutocapture(this,mA)),i.toolbar&&this.hu.push(this.toolbar=(g=this.toolbar)!==null&&g!==void 0?g:new i.toolbar(this)),i.experiments&&this.hu.push(this.experiments=(v=this.experiments)!==null&&v!==void 0?v:new i.experiments(this)),this.hu.forEach(b=>{b.initialize&&a.push(()=>{var y;(y=b.initialize)===null||y===void 0||y.call(b)})}),a.push(()=>{if(this.Ku){const b=this.Ku;this.Ku=void 0,this.hu.forEach(y=>{var _;return(_=y.onRemoteConfig)===null||_===void 0?void 0:_.call(y,b)})}}),this.Xu(a,n)}Xu(t,n){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-n>=30&&t.length>0)return void setTimeout(()=>{this.Xu(t,n)},0);const a=t.shift();if(a)try{a()}catch(o){ye.error("Error initializing extension:",o)}}const i=Math.round(performance.now()-n);this.register_for_session({[dk]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[hk]:i}),this.config.__preview_deferred_init_extensions&&ye.info(`PostHog extensions initialized (${i}ms)`)}nl(t){var n;if(!he||!he.body)return ye.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.nl(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.Ku=t),this.vu=t,this.compression=void 0,t.ok){var i;const a=t.config;a.supportedCompression&&!this.config.disable_compression&&(this.compression=He(a.supportedCompression,Ls.GZipJS)?Ls.GZipJS:He(a.supportedCompression,Ls.Base64)?Ls.Base64:void 0),!((i=a.analytics)===null||i===void 0)&&i.endpoint&&(this.analyticsDefaultEndpoint=a.analytics.endpoint)}this.set_config({person_profiles:this.Ou?this.Ou:mk}),(n=this.Yu)===null||n===void 0||n.handleRemoteConfig(t),this.hu.forEach(a=>{var o;return(o=a.onRemoteConfig)===null||o===void 0?void 0:o.call(a,t)})}Vu(){try{this.config.loaded(this)}catch(t){ye.critical("`loaded` function failed",t)}if(this.th(),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._u())&&this.eh()},1),this.ih=new Fk(this),this.ih.load()}th(){var t;this.is_capturing()&&this.config.request_batching&&((t=this.ju)===null||t===void 0||t.enable())}_dom_loaded(){this.is_capturing()&&ho(this.__request_queue,t=>this.Bu(t)),this.__request_queue=[],this.th()}_handle_unload(){var t,n,i,a,o,u;this.Tu=!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.nh()&&this.capture(gw),(a=this.logs)===null||a===void 0||a.flushLogs("sendBeacon"),(o=this.ju)===null||o===void 0||o.unload(),(u=this.Hu)===null||u===void 0||u.unload()):this.nh()&&this.capture(gw,null,{transport:"sendBeacon"})}_send_request(t){sj(this,t)}Bu(t,n){this.Hu?this.Hu.retriableRequest(t,n):this._send_request(n?B(B({},t),{},{transport:n}):t)}_execute_array(t){Lg++;try{let n;const i=[],a=[],o=[];ho(t,h=>{if(h)if(n=h[0],Ue(n))o.push(h);else if(kn(h))try{h.call(this)}catch(f){ye.error("Error executing queued PostHog call",h,f)}else Ue(h)&&n==="alias"?i.push(h):Ue(h)&&n.indexOf("capture")!==-1&&kn(this[n])?o.push(h):a.push(h)});const u=function(h,f){ho(h,function(m){try{if(Ue(m[0])){let g=f;kt(m,function(v){g=g[v[0]].apply(g,v.slice(1))})}else f[m[0]].apply(f,m.slice(1))}catch(g){ye.error("Error executing queued PostHog call",m,g)}})};u(i,this),u(a,this),u(o,this)}finally{Lg--}}push(t){if(Lg>0&&Ue(t)&&Je(t[0])){const n=sa.prototype[t[0]];return void(kn(n)&&n.apply(this,t.slice(1)))}this._execute_array([t])}get sh(){return{property:pw,persistenceKey:mo,cookieName:"_fbc",pattern:Ww,register:(t,n)=>{var i;return(i=this.persistence)===null||i===void 0?void 0:i.register({[mo]:{value:t,delivered:n}})},unregister:()=>{var t;return(t=this.persistence)===null||t===void 0?void 0:t.unregister(mo)}}}get rh(){return{property:mw,persistenceKey:su,cookieName:"_fbp",pattern:Kw,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)}}}oh(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}ah(t,n,i){return n===(i==null?void 0:i.value)?{value:n,pending:!i.delivered}:(t.register(n,!1),{value:n,pending:!0})}uh(t){if(!this.config.save_campaign_params||this._u())return;const n=au(t.cookieName);return Je(n)&&t.pattern.test(n)?n:void 0}hh(t,n,i,a){if(!this.persistence)return;const o=this.sh;this.persistence.refreshKey(o.persistenceKey);const u=this.oh(o);if(a)return void o.unregister();if(i)return Je(n)&&Ww.test(n)?this.ah(o,n,u):void o.unregister();const h=Je(t)&&JA.test(t)?t:void 0,f=this.uh(o);return f&&((m,g,v)=>{const b=m.split(".");if(g)return b[3]===g;if(!v)return!0;const y=v.value.split(".");return b[3]===y[3]||Number(b[2])>Number(y[2])})(f,h,u)?this.ah(o,f,u):h?(u==null?void 0:u.value.split(".")[3])===h?{value:u.value,pending:!u.delivered}:this.ah(o,`fb.1.${Date.now()}.${h}`,u):u?{value:u.value,pending:!u.delivered}:void 0}dh(t,n,i){if(!this.persistence)return;const a=this.rh;this.persistence.refreshKey(a.persistenceKey);const o=this.oh(a);if(i)return void a.unregister();if(n)return Je(t)&&Kw.test(t)?this.ah(a,t,o):void a.unregister();const u=this.uh(a);return u?this.ah(a,u,o):o?{value:o.value,pending:!o.delivered}:void 0}fh(t,n){if(!this.persistence)return;this.persistence.refreshKey(t.persistenceKey);const i=this.oh(t);(i==null?void 0:i.value)!==n||i.delivered||t.register(n,!0)}capture(t,n,i){var a,o;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.ju))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.xu();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.ph||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,g=(i==null?void 0:i.timestamp)||m,v=Z_(i==null?void 0:i.uuid,ui);let b={uuid:v,event:t,properties:this.calculateEventProperties(t,n||{},g,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=Ue(n==null?void 0:n.$unset)?n.$unset:[],N=(i==null?void 0:i.$unset)||[],w=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=w(pw),E=w(mw),R=[{channel:this.sh,hasProvided:C.hasProvided,update:this.hh(f==null?void 0:f.fbclid,C.provided,C.hasProvided,C.unset)},{channel:this.rh,hasProvided:E.hasProvided,update:this.dh(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 M=i==null?void 0:i.$unset;M&&(b.$unset=M);const L=y?void 0:this.gh(i==null?void 0:i.$set_once,t!==xw,t===gk);if(L&&(b.$set_once=L),i!=null&&i._noTruncate||(F=this.config.properties_string_max_length,b=(function(W,q){const H=new Set;return(function I(re,ve){if(re!==Object(re))return q?q(re):re;if(H.has(re))return;let A;if(H.add(re),Ue(re))A=[],ho(re,Ee=>{A.push(I(Ee))});else{const Ee={};kt(Eo(re)?xk(re):re,(Me,z)=>{H.has(Me)||(Ee[z]=I(Me))}),A=Ee}return A})(W)})(b,W=>Je(W)?W.slice(0,F):W)),b.timestamp=g,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={},I=re=>{W[re]!==void 0&&(H[re]=W[re])};return f6.forEach(I),q.forEach(I),H})(b.properties,eM)),t===Os.DISMISSED||t===Os.SENT){const W=n==null?void 0:n[Eg.SURVEY_ID],q=n==null?void 0:n[Eg.SURVEY_ITERATION];cj({id:W,current_iteration:q}),b.$set=B(B({},b.$set),{},{[FA({id:W,current_iteration:q},t===Os.SENT?"responded":"dismissed")]:!0})}else t===Os.SHOWN&&(b.$set=B(B({},b.$set),{},{[Eg.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var F;if(t===jA.SHOWN){const W=n==null?void 0:n[zw.TOUR_TYPE];W&&(b.$set=B(B({},b.$set),{},{[`${zw.TOUR_LAST_SEEN_DATE}/${W}`]:new Date().toISOString()}))}const D=B(B({},b.properties.$set),b.$set);if(ms(D)||this.setPersonPropertiesForFlags(D),!qe(this.config.before_send)){const W=this.Os(b);if(!W)return;b=W,b.uuid=Z_(b.uuid,ui)}const X=R.filter(({channel:W,update:q})=>{var H,I,re;const ve=(H=(I=b.$set)===null||I===void 0?void 0:I[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.fu.emit("eventCaptured",b);const U=(a=i==null?void 0:i._url)!==null&&a!==void 0?a:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),G=(i==null?void 0:i._batchKey)==="recordings"||/\/s\/(?:\?|$)/.test(U),O=B(B(B({method:"POST",url:U,data:b,compression:"best-available",preferSyncCompression:i==null?void 0:i.send_instantly,timestampMode:G?"body":"capture-body",batchKey:i==null?void 0:i._batchKey},G&&(!((o=b.properties)===null||o===void 0)&&o.$session_id)?{batchGroup:b.properties.$session_id+(b.properties.$window_id?`-${b.properties.$window_id}`:"")}:{}),i!=null&&i.transport?{transport:i.transport}:{}),X.length?{fireCallbackOnDrop:!0,callback:W=>{if(W.statusCode>=200&&300>W.statusCode)for(const{channel:q,update:H}of X)this.fh(q,H.value)}}:{});if(!this.config.request_batching||i&&!(i!=null&&i._batchKey)||i!=null&&i.send_instantly||X.length){var de;let W;!O.transport&&!O.callback&&ms((de=this.config.request_headers)!==null&&de!==void 0?de:{})&&this.Tu&&(W="sendBeacon"),this.Bu(O,W)}else this.ju.enqueue(O);return b}_addCaptureHook(t){return this.on("eventCaptured",n=>t(n.event,n))}getExtension(t){var n;return(n=this.Yu)===null||n===void 0?void 0:n.getExtension(t)}Qu(){var t;return(t=this.Yu)!==null&&t!==void 0?t:this.Yu=new ZA(this)}gu(t){this.Ru.push(t);let n=!0;return()=>{if(!n)return;n=!1;const i=this.Ru.indexOf(t);i!==-1&&this.Ru.splice(i,1)}}mh(t=!0){var n,i,a;return!!(!((n=this.persistence)===null||n===void 0)&&n.consumeCookieIdentityChange())&&(this.Du=null,this.persistence.get_property("$user_state")==="anonymous"&&((a=this.sessionPersistence)===null||a===void 0||a.clear(),this.Eu.clear(),this.yh()),(i=this.featureFlags)===null||i===void 0||i.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,n,i,a,o){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return n;this.persistence.syncCookieProperties(),this.mh();const u=o?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._u()&&(h[uk]=!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,M=!1){var L,F,D,X;if(!es)return{};const U=C?[...So,...E||[]]:[],[G,O]=AS(es),[de,W]=(function(P){for(let oe=0;K_.length>oe;oe++){const[we,Ne,Ae]=K_[oe],De=P.match(we);if(De){const ze=Ae&&P.match(Ae)||De;return[Ne,(ze==null?void 0:ze[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 I={},re=(L=navigator)===null||L===void 0||(L=L.userAgentData)===null||L===void 0?void 0:L.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||(X=te.screen)===null||X===void 0?void 0:X.height,Me=te==null?void 0:te.devicePixelRatio;ue(re)||(I.userAgentDataPlatform=re),ue(ve)||(I.maxTouchPoints=ve),ue(A)||(I.screenWidth=A),ue(Ee)||(I.screenHeight=Ee),ue(Me)||(I.devicePixelRatio=Me);const z=Dt(Ax({$os:G,$os_version:O,$browser:TS(es,navigator.vendor,q,H),$webview_app:de,$webview_app_version:W,$device:MS(es),$device_type:DT(es,I),$timezone:Pk(),$timezone_offset:wA()}),{$current_url:ku(M?ua(Yt==null?void 0:Yt.href):Yt==null?void 0:Yt.href,U,ju),$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:LT(es,navigator.vendor,q,H),$browser_language:Dk(),$browser_language_prefix:_A(),$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(o,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.Hu)===null||m===void 0?void 0:m.length}catch(C){h.$sdk_debug_error_capturing_properties=String(C)}let g;if(this.requestRouter.region===Q0&&(h.$lib_custom_api_host=this.config.api_host),g=t!=="$pageview"||o?t!=="$pageleave"||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,a),h=Dt(h,g),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)),kt(["$referrer","$referring_domain"],C=>{C in v&&delete b[C]});const j={};if(this.Ru.length>0)for(const C of this.Ru.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(),Ue(this.config.property_denylist)?kt(this.config.property_denylist,function(C){delete h[C]}):ye.error(uj+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const N=this.config.sanitize_properties;N&&(ye.error(Xw),h=N(h,t));const w=this.bh();return h.$process_person_profile=w,w&&!o&&this._h("_calculate_event_properties"),h}gh(t,n=!0,i=!1){var a;if(!this.persistence||!this.bh()||this.Mu&&!i)return t;const o=this.persistence.get_initial_props(),u=(a=this.sessionPropsManager)===null||a===void 0?void 0:a.getSetOnceProps();let h=Dt({},o,u||{},t||{});const f=this.config.sanitize_properties;return f&&(ye.error(Xw),h=f(h,"$set_once")),n&&(this.Mu=!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.mh(),(i=this.sessionPersistence)===null||i===void 0||i.register(t),Object.keys(t).forEach(a=>this.Eu.add(a)),this.yh()}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.Eu.delete(t),this.yh()}wh(t,n){this.register({[t]:n})}zu(){this.Eu.forEach(t=>{var n;(n=this.sessionPersistence)===null||n===void 0||n.unregister(t)}),this.Eu.clear(),this.yh()}yh(){var t;if(!this.Pu)return;if(this.config.persistence==="memory"||!((t=this.sessionPersistence)===null||t===void 0)&&t.mi||!Ot.Et())return void Ot.Lt(this.Pu);const n=[];this.Eu.forEach(i=>n.push(i)),n.length>0?Ot.At(this.Pu,n):Ot.Lt(this.Pu)}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.fu.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:no}),()=>{})}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:no})}getActiveMatchingSurveys(t,n=!1){this.surveys?this.surveys.getActiveMatchingSurveys(t,n):t([],{isLoaded:!1,error:no})}onActiveMatchingSurveysChanged(t){return this.surveys?this.surveys.onActiveMatchingSurveysChanged(t):(t([],{isLoaded:!1,error:no}),()=>{})}renderSurvey(t,n){var i;(i=this.surveys)===null||i===void 0||i.renderSurvey(t,n)}displaySurvey(t,n=GA){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:no}}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:no})}kh(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.kh(t)||!this._h("posthog.identify"))return;this.xu();const a=this.get_distinct_id(),o=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==a,u=this.mh(!1),h=this.persistence.La();let f=!1;try{const g=this.get_distinct_id();this.register({$user_id:t}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:g},""),t!==g&&t!==this.get_property("__alias")&&(this.unregister(Kh),this.register({distinct_id:t}));const v=(this.persistence.get_property("$user_state")||"anonymous")===dr,b=t!==g,y=!b&&v;if(b&&v){var m;const _=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:g};this.persistence.set_property(ts,Oh),this.setPersonPropertiesForFlags({$set:n||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Na(),this.capture("$identify",_,{$set:n||{},$set_once:i||{}})&&(this.Du=Og(t,n,i)),(m=this.featureFlags)===null||m===void 0||m.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:g)}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.Na(),this.capture("$set",{$set:_,$set_once:j})&&(this.Du=Og(t,n,i))}else(n||i)&&this.setPersonProperties(n,i);b||o||u?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(la)):y&&(n||i)&&this.reloadFeatureFlags(),f=!0}finally{h&&this.persistence.Ba(f)}}setPersonProperties(t,n){if(!t&&!n||!this._h("posthog.setPersonProperties"))return;const i=Og(this.get_distinct_id(),t,n);this.Du!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:n||{}},!0),this.capture("$set",{$set:t||{},$set_once:n||{}})&&(this.Du=i)):ye.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(t){var n;const i=(Ue(t)?t:[t]).filter(a=>Je(a)&&a.length>0);i.length!==0&&this._h("posthog.unsetPersonProperties")&&((n=this.featureFlags)===null||n===void 0||n.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.Du=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.mh();const o=this.getGroups(),u=o[t]!==n;if(u&&this.resetGroupPropertiesForFlags(t),this.register({$groups:B(B({},o),{},{[t]:n})}),(u||i)&&this.bh()){const h={$group_type:t,$group_key:n};i&&(h.$group_set=i),this.capture(xw,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._h("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.Sh(n,!1,i)}Sh(t,n=!1,i){var a,o,u,h,f,m;if(ye.info("reset"),!this.__loaded)return ye.uninitializedWarning("posthog.reset");const g=i==null?void 0:i.sessionID;this.config.bootstrap=i||((a=this.Nu)===null||a===void 0?void 0:a.bootstrap)||{},(o=this.featureFlags)===null||o===void 0||(u=o.updateConfig)===null||u===void 0||u.call(o,this.config,this.sl());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.La)===null||m===void 0?void 0:m.call(f);let N=!1;try{var w,C,E,R,M,L,F,D,X,U,G,O,de;if((w=this.persistence)===null||w===void 0||w.clear(),(C=this.sessionPersistence)===null||C===void 0||C.clear(),this.Eu.clear(),this.yh(),ue(y)||(U=this.persistence)===null||U===void 0||U.register({$session_recording_remote_config:y}),(E=this.surveys)===null||E===void 0||E.reset(),(R=this.featureFlags)===null||R===void 0||R.reset(),(M=this.conversations)===null||M===void 0||M.reset(),(L=this.logs)===null||L===void 0||L.reset(),(F=this.metrics)===null||F===void 0||F.reset(),(D=this.persistence)===null||D===void 0||D.set_property("$user_state","anonymous"),(X=this.sessionManager)===null||X===void 0||X.resetSessionId(),this.Du=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._u()&&((de=this.persistence)===null||de===void 0||de.set_property("$user_state",i.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:i.distinctID})),(G=this.featureFlags)===null||G===void 0||G.initialize(),!qe(g)&&!(!((O=this.sessionManager)===null||O===void 0)&&O.setBootstrapSessionId(g,!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.Ba)===null||q===void 0||q.call(W,N))}this.reloadFeatureFlags()}shutdown(t){var n=this;return Bt(function*(){var i,a,o,u,h,f,m,g;if(n.__loaded){n.Iu=!0,n.Qu().dispose(),(i=n.sessionRecording)===null||i===void 0||i.dispose(),(a=n.logs)===null||a===void 0||a.flushLogs("sendBeacon"),(o=n.metrics)===null||o===void 0||o.flush("sendBeacon"),(u=n.metrics)===null||u===void 0||u.dispose(),(h=n.ju)===null||h===void 0||h.unload(),(f=n.Hu)===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(),(g=n.sessionPersistence)===null||g===void 0||g.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.xh()}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.Ch()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,n;return(t=(n=this.sessionManager)===null||n===void 0?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&t!==void 0?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";const{sessionId:n,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0);let a=this.requestRouter.endpointFor("ui",`/project/${this.config.token}/replay/${n}`);if(t!=null&&t.withTimestamp&&i){var o;const u=(o=t.timestampLookBack)!==null&&o!==void 0?o:10;if(!i)return a;a+=`?t=${Math.max(Math.floor((new Date().getTime()-i)/1e3)-u,0)}`}return a}alias(t,n){return t===this.get_property("$people_distinct_id")?(ye.critical("Attempting to create alias for existing People user - aborting."),-2):this._h("posthog.alias")?(ue(n)&&(n=this.get_distinct_id()),t!==n?(this.wh(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,o,u,h,f,m,g,v,b,y,_,j,N;Dt(this.config,Zw(t));const C=this.Cu();(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.Lu(this.config.debug);var w;ns(E)&&(this.config.debug=E),ns(this.config.debug)&&(this.config.debug?(yn.DEBUG=!0,ct.Et()&&ct.At("ph_debug",!0),ye.info("set_config",{config:t,oldConfig:n,newConfig:B({},this.config)})):(yn.DEBUG=!1,ct.Et()&&ct.Lt("ph_debug"))),(a=this.featureFlags)===null||a===void 0||(o=a.updateConfig)===null||o===void 0||o.call(a,this.config,this.sl()),(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(),(g=this.tracingHeaders)===null||g===void 0||g.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)&&((w=this.historyAutocapture)===null||w===void 0||w.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.$u(),(N=this.externalIntegrations)===null||N===void 0||N.startIfEnabledOrStop(),!n.segment&&this.config.segment&&this.persistence&&Rw(this,du,!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,o,u,h,f;Object.values(i).some(Boolean)&&((a=this.sessionManager)===null||a===void 0||a.checkAndGetSessionAndWindowId(),i.sampling&&((o=this.sessionRecording)===null||o===void 0||o.overrideSampling()),i.linked_flag&&((u=this.sessionRecording)===null||u===void 0||u.overrideLinkedFlag()),i.url_trigger&&((h=this.sessionRecording)===null||h===void 0||h.overrideTrigger("url")),i.event_trigger&&((f=this.sessionRecording)===null||f===void 0||f.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!!(!((t=this.sessionRecording)===null||t===void 0)&&t.started)}captureException(t,n){try{if(!this.exceptions)return;const i=this.exceptions.buildProperties(t,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(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:sa.$h}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"}bh(){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))}nh(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&!!this.config.capture_pageview}createPersonProfile(){this.bh()||this._h("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this._h("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}_h(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.wu(),this.wh(Cx,!0),!0)}Cu(){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")}$u(){var t,n;const i=this.Cu();var a,o,u;return this.is_capturing()||(a=this.logs)===null||a===void 0||a.Th(),((t=this.persistence)===null||t===void 0?void 0:t.mi)!==i&&((o=this.persistence)===null||o===void 0||o.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.Eu.clear(),this.yh()),i}opt_in_capturing(t){var n;if(this.config.cookieless_mode!=="always"){if(this._u()){var i,a,o,u,h,f;(i=this.sessionRecording)===null||i===void 0||i.dispose({discardBufferedEvents:!0}),this.Sh(!0,!0),(a=this.sessionManager)===null||a===void 0||a.destroy(),(o=this.pageViewManager)===null||o===void 0||o.destroy(),this.sessionManager=new Vw(this),this.pageViewManager=new Ow(this),this.persistence&&(this.sessionPropsManager=new Hw(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=sa.__defaultExtensionClasses)===null||f===void 0?void 0:f.sessionRecording;var m,g;y&&(this.sessionRecording=this.bu(this.sessionRecording,new y(this)),this.vu&&((m=this.sessionRecording)===null||m===void 0||(g=m.onRemoteConfig)===null||g===void 0||g.call(m,this.vu)))}var v,b;this.consent.optInOut(!0),this.$u(),this.th(),(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.eh()}else ye.warn(Qw)}opt_out_capturing(){if(this.config.cookieless_mode==="always")return void ye.warn(Qw);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.Sh(!0,!0),this.consent.optInOut(!1),this.$u(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:vg,$device_id:null}),this.yu(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.eh(),this.th())}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.$u()}_is_bot(){return jn?ij(jn,this.config.custom_blocked_useragents):void 0}eh(){he&&(he.visibilityState==="visible"?this.Au||(this.Au=!0,this.capture(Tx,{title:he.title},{send_instantly:!0}),this.Fu&&(he.removeEventListener(_u,this.Fu),this.Fu=null)):this.Fu||(this.Fu=this.eh.bind(this),xt(he,_u,this.Fu)))}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}))}sl(){const t=this.Nu||{};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,o,u){const h=i in n&&!qe(n[i]),f=a in n&&!qe(n[a]);return h?n[i]:!!f&&(u&&u.warn(`Config field '${a}' is deprecated. Please use '${i}' instead. The old field will be removed in a future major version.`),n[a])})(t,"advanced_disable_flags","advanced_disable_decide",0,ye)}Os(t){var n;if(qe(this.config.before_send))return t;const i=Object.keys((n=t.properties)!==null&&n!==void 0?n:{}).filter(ST),a=Ue(this.config.before_send)?this.config.before_send:[this.config.before_send];let o=t;for(const u of a)try{if(o=u(o),qe(o)){const h=`Event '${t.event}' was rejected in beforeSend function`;return wT(t.event)?ye.warn(`${h}. This can cause unexpected behavior.`):ye.info(h),null}o.properties&&!ms(o.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(o.properties&&qe(o.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 o}getPageViewId(){var t;return(t=this.pageViewManager.Go)===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)})}Lu(t){const n=ns(t)&&!t,i=ct.Et()&&ct.Ot("ph_debug")==="true";return!n&&(!!i||t)}};hu.__defaultExtensionClasses={},hu.$h=(()=>{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]]=Z6(e.prototype[t[n]])})(hu,["identify"]);var dj=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=Wt("[AutoCapture]");function Bg(e,t){return t.length>e?t.slice(0,e)+"...":t}function iM(e){if(e.previousElementSibling)return e.previousElementSibling;let t=e;do t=t.previousSibling;while(t&&!Di(t));return t}function rM(e,{e:t,maskAllElementAttributes:n,maskAllText:i,elementAttributeIgnoreList:a,elementsChainAsString:o,disableCaptureUrlHashes:u}){var h,f;if(!Di(e))return{props:{}};const m=[e],g=new Set([e]);let v=e;for(;v.parentNode&&!Pn(v,"body")&&1e3>m.length;){if(Mx(v.parentNode)){const L=v.parentNode.host;if(g.has(L))break;g.add(L),m.push(L),v=L;continue}if(!Di(v.parentNode)||g.has(v.parentNode))break;g.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(L=>Pn(L,"button")||Pn(L,"a")):-1;b>0&&(i=i||m.slice(0,b+1).some(L=>!go(L)||Su(L)));const y=[],_={};let j,N=!1,w=!1;if(kt(m,L=>{const F=go(L);if(Pn(L,"a")&&!n&&!(a!=null&&a.includes("href"))){const D=L.getAttribute("href");N=!!(F&&D&&ou(D))&&(u?ua(D):D)}He(_o(L),"ph-no-capture")&&(w=!0),y.push((function(D,X,U,G,O=!1){const de=D.tagName.toLowerCase(),W={tag_name:de};Ox.indexOf(de)>-1&&!U&&(W.$el_text=de.toLowerCase()==="a"||de.toLowerCase()==="button"?Bg(1024,Tw(D)):Bg(1024,wu(D)));const q=_o(D);X||G!=null&&G.includes("class")||0>=q.length||(W.classes=q.filter(function(ve){return ve!==""})),kt(D.attributes,function(ve){var A;if((!Su(D)||["name","id","class","aria-label"].indexOf(ve.name)!==-1)&&!(G!=null&&G.includes(ve.name))&&!X&&ou(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"&&O?ua(Ee):Ee)}});let H=1,I=1,re=D;for(;re=iM(re);)H++,re.tagName===D.tagName&&I++;return W.nth_child=H,W.nth_of_type=I,W})(L,n,i,a,u)),kt((function(D){if(!go(D))return{};const X={};return kt(D.attributes,function(U){if(U.name&&U.name.indexOf("data-ph-capture-attribute")===0){const G=U.name.replace("data-ph-capture-attribute-",""),O=U.value;G&&O&&ou(O)&&(X[G]=O)}}),X})(L),(D,X)=>{({}).hasOwnProperty.call(_,X)||(_[X]=D)})}),w)return{props:{},explicitNoCapture:w};if(b>0&&(e=m[b],y.splice(0,b)),i||(y[0].$el_text=Pn(e,"a")||Pn(e,"button")?Tw(e):wu(e)),N){var C,E;y[0].attr__href=N;const L=(C=mr(N))===null||C===void 0?void 0:C.host,F=te==null||(E=te.location)===null||E===void 0?void 0:E.host;L&&F&&L!==F&&(j=N)}return{props:Dt((M=t.type,{$event_type:M,$ce_version:1}),o?{}:{$elements:y},{$elements_chain:(R=y,Ue(R)?(function(L){return L.map(F=>{var D,X;let U="";if(F.tag_name&&(U+=F.tag_name),F.attr_class){F.attr_class.sort();for(const de of F.attr_class)U+=`.${de.replace(/"/g,"")}`}const G=B(B(B(B({},F.text?{text:F.text}:{}),{},{"nth-child":(D=F.nth_child)!==null&&D!==void 0?D:0,"nth-of-type":(X=F.nth_of_type)!==null&&X!==void 0?X:0},F.href?{href:F.href}:{}),F.attr_id?{attr_id:F.attr_id}:{}),F.attributes),O={};return Lh(G).sort(([de],[W])=>(function(q,H){return H>q?-1:q>H?1:0})(de,W)).forEach(([de,W])=>O[Aw(de.toString())]=Aw(W.toString())),U+=":",U+=Lh(O).map(([de,W])=>`${de}="${W}"`).join(""),U}).join(";")})((function(L){return L.map(F=>{var D,X;const U={text:(D=F.$el_text)===null||D===void 0?void 0:D.slice(0,400),tag_name:F.tag_name,href:(X=F.attr__href)===null||X===void 0?void 0:X.slice(0,2048),attr_class:fA(F),attr_id:F.attr__id,nth_child:F.nth_child,nth_of_type:F.nth_of_type,attributes:{}};return Lh(F).filter(([G])=>G.indexOf("attr__")===0).forEach(([G,O])=>U.attributes[G]=O),U})})(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,M}var aM=class{fo(){this.po=void 0,clearTimeout(this.mo),this.mo=void 0}yo(e){var t;if(!go(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 o=a,u=_o(o);if(He(u,"ph-no-capture")||He(u,"ph-sensitive")||Su(o)||n.some(f=>F0(o,f)))return!0;const h=a.parentNode;a=Mx(h)?h.host:h&&Di(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=lu(e);var t;return void(e.isPrimary&&e.button===0&&!e.ctrlKey&&i&&Di(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=lu(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 o=(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=_o(u);return He(h,"ph-no-capture")||He(h,"ph-sensitive")||!go(u)||Su(u)||o.some(f=>F0(u,f))})?null:n.target}}constructor(e){this.So=e,this.name="autocapture",this.xo=!1,this.Co=null,this.$o=!1,this.To=new Map,this.Io=!1,this.Rr={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.Mo=!1,this.So.refresh(this.Rr),this.rageclicks=new dj(this.Rr.rageclick),this.Eo=null}setup(e){this.Po(),this.wo=e;const t=e.onRemoteConfig(this.onRemoteConfig.bind(this));this.Mo?t.dispose():(this.Ro=t,this.startIfEnabled())}dispose(){var e;this.Mo||(this.Mo=!0,this.wo=void 0,(e=this.Ro)===null||e===void 0||e.dispose(),this.Ro=void 0,this.To.clear(),this.Eo=null,this.Ao())}bo(){return this.So.refresh(this.Rr),this.Rr}Po(){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}Fo(){if(!this.isBrowserSupported())return void $g.info("Disabling Automatic Event Collection because this browser is not supported");if(!te||!he)return;const e=this.Oo=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(Qt(n))return;this.Do(t,"$autocapture",n)}catch(n){$g.error("Failed to capture event",n)}};if(xt(te,"blur",e),xt(he,"submit",e,{capture:!0}),xt(he,"change",e,{capture:!0}),xt(he,"click",e,{capture:!0}),kt(["pointerdown","pointermove","pointerup","pointercancel"],t=>{xt(he,t,e,{capture:!0})}),this.bo().capture_copied_text){const t=this.Lo=n=>{n=n||(te==null?void 0:te.event);try{this.Do(n,zg)}catch(i){$g.error("Failed to capture clipboard event",i)}};xt(he,"copy",t,{capture:!0}),xt(he,"cut",t,{capture:!0}),xt(he,"paste",t,{capture:!0})}}Ao(){this.fo(),this.Oo&&(te==null||te.removeEventListener("blur",this.Oo),kt(["pointerdown","pointermove","pointerup","pointercancel"],e=>{he==null||he.removeEventListener(e,this.Oo,!0)}),he==null||he.removeEventListener("submit",this.Oo,!0),he==null||he.removeEventListener("change",this.Oo,!0),he==null||he.removeEventListener("click",this.Oo,!0),this.Oo=void 0),this.Lo&&(he==null||he.removeEventListener("copy",this.Lo,!0),he==null||he.removeEventListener("cut",this.Lo,!0),he==null||he.removeEventListener("paste",this.Lo,!0),this.Lo=void 0),this.xo=!1}startIfEnabled(){this.isEnabled||this.fo(),!this.Mo&&this.wo&&this.isEnabled&&!this.xo&&(this.Fo(),this.xo=!0)}onRemoteConfig(e){if(this.Mo)return;if(this.$o=!0,!e.ok)return void this.startIfEnabled();const t=e.config;t.elementsChainAsString&&(this.Io=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,t=this){if(this.Mo)return;e.size?this.To.set(t,new Set(e)):this.To.delete(t);const n=new Set;this.To.forEach(i=>{i.forEach(a=>n.add(a))}),this.Eo=n}getElementSelectors(e,t){var n;const i=[];return(n=this.Eo)===null||n===void 0||n.forEach(a=>{const o=he==null?void 0:he.querySelectorAll(a);o==null||o.forEach(u=>{e!==u&&t!==u||He(i,a)||i.push(a)})}),i}get isEnabled(){var e,t;if(this.Mo)return!1;const n=(e=this.wo)===null||e===void 0?void 0:e.kv.get(JS),i=this.Co,a=this.bo();if(!a.remoteRequestsDisabled&&!this.$o)return!1;const o=a.remoteRequestsDisabled&&!this.$o;if(Qt(i)&&!ns(n)&&!o)return!1;const u=(t=this.Co)!==null&&t!==void 0?t:!!n;return!!a.enabled&&!u}Do(e,t="$autocapture",n){if(!this.isEnabled)return void this.fo();let i=n||lu(e);_k(i)&&(i=i.parentNode||null);const a=this.Po();var o;t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&a.rageclick&&(!((o=this.rageclicks)===null||o===void 0)&&o.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime()))&&jk(i,a.rageclick)&&this.Do(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 w;if(!te||Lx(v)||y!=null&&y.url_allowlist&&!ww(y.url_allowlist,N)||y!=null&&y.url_ignorelist&&ww(y.url_ignorelist,N))return!1;if(y!=null&&y.dom_event_allowlist){const M=y.dom_event_allowlist;if(M&&!M.some(L=>b.type===L))return!1}const{parentIsUsefulElement:C,targetElementList:E}=Nk(v,_);if(!(function(M,L){const F=L==null?void 0:L.element_allowlist;if(ue(F))return!0;for(const D of M)if(F.some(X=>D.tagName.toLowerCase()===X))return!0;return!1})(E,y)||!I0(E,y==null?void 0:y.css_selector_allowlist)||I0(E,(w=y==null?void 0:y.css_selector_ignorelist)!==null&&w!==void 0?w:kg))return!1;try{const M=te.getComputedStyle(v);if(M&&M.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}=rM(i,{e,maskAllElementAttributes:a.maskAllElementAttributes,maskAllText:a.maskAllText,elementAttributeIgnoreList:a.element_attribute_ignorelist,elementsChainAsString:this.Io,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,g;const N=te==null||(m=te.getSelection())===null||m===void 0?void 0:m.toString(),w=wk(N);if(!w)return!1;v.$selected_content=w,v.$clipboard_text_length=(g=N==null?void 0:N.length)!==null&&g!==void 0?g: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)}},lM=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.sl(),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 Hc=Wt("[ExceptionAutocapture]"),Jw=()=>{},e5=e=>{var t;if(kn(e))return(t=e.__posthog_layer__)!==null&&t!==void 0?t:e.__rrweb_layer__};function Nu(e,t,n){try{if(!(t in e))return Jw;const i={next:e[t]},a=n(function(...o){return i.next.apply(this,o)});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 o=e[t],u=e5(o);for(;u;){if(u.next===a)return void(u.next=i.next);o=u.next,u=e5(o)}}}catch{return Jw}}const oM=Wt("[TracingHeaders]"),Va=Wt("[Web Vitals]"),t5=9e5,n5=["CLS","FCP","INP","LCP"],cM=["INP","LCP"],uM=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],Pg="disabled",s5="lazy_loading",rr=Wt("[SessionRecording]"),dM=Wt("[Heatmaps]");function Ug(e){return st(e)&&"clientX"in e&&"clientY"in e&&Jt(e.clientX)&&Jt(e.clientY)}const gh=Wt("[Product Tours]"),Fg=e=>{var t;return!e.config.disable_product_tours&&!!(!((t=e.persistence)===null||t===void 0)&&t.get_property(Nx))},hM=["$set_once","$set"],Ei=Wt("[SiteApps]"),i5="Error while initializing PostHog app with config id ",hj=(e,t)=>e!=null&&e.then?e.then(t):t(e),so="SDK is not enabled or survey functionality is not yet loaded",r5="Disabled. Not loading surveys.";var fM=class{constructor(e,t){this.So=e,this.Ih=t,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Mh=!1,this.Eh=!1,this.Ph=[],this.Rh=[],this.Ah=null,this.Fh=null,this.Mo=!1,this.Oh=new Set,this.onRemoteConfig=n=>{if(this.Mo||this.Rr.disableSurveys)return;if(!n.ok)return this.Eh=!0,this.Dh({isLoaded:!1,error:"Remote config unavailable. Not loading surveys."}),_t.warn("Remote config unavailable. Not loading surveys.");const i=n.config.surveys;if(qe(i))return _t.warn("Flags not loaded yet. Not loading surveys.");this.Lh=ns(i)?i:i.length>0,_t.info(`flags response received, isSurveysEnabled: ${this.Lh}`),this.loadIfEnabled()},this.Dh=n=>{this.Rh.slice().forEach(i=>this.Nh(i,n))}}setup(e){if(!this.Mo)return this.qh=e,hj(e.kv.initialize(),()=>{if(this.qh!==e||this.Mo)return;this.qh=void 0,this.wo=e;const t=e.onRemoteConfig(this.onRemoteConfig);this.Mo?t.dispose():(this.Ro=t,this.loadIfEnabled())})}dispose(){var e,t,n,i,a;this.Mo||(this.Mo=!0,this.qh=void 0,this.wo=void 0,(e=this.Ro)===null||e===void 0||e.dispose(),this.Ro=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.Ph=[],this.Rh.forEach(o=>{o.active=!1}),this.Rh=[],(a=this.jh)===null||a===void 0||a.call(this),this.jh=void 0,this.Ah=null,this.Oh.forEach(o=>clearTimeout(o)),this.Oh.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 o=localStorage.key(a);(o!=null&&o.startsWith("seenSurvey_")||o!=null&&o.startsWith("inProgressSurvey_"))&&i.push(o)}i.forEach(a=>localStorage.removeItem(a))}catch{}this.Dh()}loadIfEnabled(){if(this.Mo||!this.wo)return;const e=this.Rr;if(this._surveyManager)return;if(this.Mh)return void _t.info("Already initializing surveys, skipping...");if(e.disableSurveys)return void _t.info(r5);if(e.cookielessMode&&this.So.isOptedOut())return void _t.info("Not loading surveys in cookieless mode without consent.");const t=this.So.getExtensions();if(!t)return void this.Bh("PostHog Extensions not found.");if(ue(this.Lh)&&!e.advancedEnableSurveys)return;const n=this.Lh||e.advancedEnableSurveys;this.Mh=!0,this.Eh=!1;try{const i=t.generateSurveys;if(i)return this.Hh(i,n),void(this.Mh=!1);const a=t.loadExternalDependency;if(!a)return this.Bh(Ex),void(this.Mh=!1);a(o=>{try{if(this.Mo)return;const u=this.So.getExtensions();o||!(u!=null&&u.generateSurveys)?this.Bh("Could not load surveys script",o):this.Hh(u.generateSurveys,n)}finally{this.Mh=!1}})}catch(i){throw this.Mh=!1,this.Bh("Error initializing surveys",i),i}}Hh(e,t){var n,i;if(this.Mo)return;this._surveyManager=e(t),this._surveyEventReceiver=this.So.createEventReceiver(this.Dh);const a=(n=(i=this.wo)!==null&&i!==void 0?i:this.Ih)===null||n===void 0?void 0:n.kv.get(Xc);a&&this.zh(a),_t.info("Surveys loaded successfully"),this.Uh(),this.Dh(),this.Wh({isLoaded:!0})}Bh(e,t){this.Eh=!0,_t.error(e,t),this.Dh({isLoaded:!1,error:e}),this.Wh({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Ph.push(e),this._surveyManager&&this.Wh({isLoaded:!0}),()=>{this.Ph=this.Ph.filter(t=>t!==e)}}getSurveys(e,t=!1){var n;const i=(n=this.wo)!==null&&n!==void 0?n:this.Ih;if(!i||this.Mo)return;if(this.Rr.disableSurveys)return _t.info(r5),e([]);const a=i.kv.get(Xc);if(a&&!t)return e(a,{isLoaded:!0}),void(this.Vh()&&this.getSurveys(()=>{},!0));if(this.Ah)return void this.Ah.then(({surveys:h,context:f})=>{this.Mo||e(h,f)}).catch(h=>_t.error("Error in survey callback",h));const o=this.Gh("/api/surveys/",{method:"GET",query:{token:i.projectToken},sentAt:"query",timeoutMs:this.Rr.requestTimeoutMs}).then(h=>{try{return this.Zh(i,h)}catch(f){return _t.error("Error processing surveys response",f),this.Zh(i,{statusCode:0,error:f})}},h=>this.Zh(i,{statusCode:0,error:h}));this.Ah=o;const u=()=>{this.Ah===o&&(this.Ah=null)};o.then(h=>{u(),this.Mo||(this.Dh(h.context),e(h.surveys,h.context))},u).catch(h=>_t.error("Error in survey callback",h))}Gh(e,t){const n=this.wo;return n?n.sendRequest(e,t):new Promise(i=>i({statusCode:0,error:new Error(so)}))}Zh(e,t){if(this.Mo)return{surveys:[],context:{isLoaded:!1,error:so}};const n=t.statusCode;if(n!==200||!t.json){const a=`Surveys API could not be loaded, status: ${n}`;return n!==0?_t.error(a):t.error||_t.warn(a),this.Fh=Date.now(),{surveys:[],context:{isLoaded:!1,error:a}}}this.Fh=null;const i=t.json.surveys||[];return e.kv.set({[Xc]:i,[Zh]:Date.now()}),this.zh(i),{surveys:i,context:{isLoaded:!0}}}zh(e){var t;const n=e.filter(i=>(function(a){return!(!a.start_date||a.end_date)})(i)&&(aj(i)||(function(a){var o;return!!(!((o=a.conditions)===null||o===void 0||(o=o.actions)===null||o===void 0||(o=o.values)===null||o===void 0)&&o.length)})(i)));(t=this._surveyEventReceiver)===null||t===void 0||t.replace(n)}Vh(){return this.Qh()&&!this.Ah&&!this.Jh()}Qh(){var e,t;const n=(e=(t=this.wo)!==null&&t!==void 0?t:this.Ih)===null||e===void 0?void 0:e.kv.get(Zh);return Jt(n)&&Date.now()-n>3e5}Jh(){return Jt(this.Fh)&&3e5>Date.now()-this.Fh}markSurveyAsSeen(e,t){var n;const i={id:e,current_iteration:(n=t==null?void 0:t.iteration)!==null&&n!==void 0?n:null};cj(i);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}this.Dh()}Wh(e){for(const t of this.Ph)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(n){_t.error("Error in survey callback",n)}}getActiveMatchingSurveys(e,t=!1){if(!qe(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);_t.warn("init was not called")}onActiveMatchingSurveysChanged(e){var t,n;if(this.Mo)return()=>{};const i={callback:e,active:!0,revision:0};this.Rh.push(i),this.Uh();const a=(t=(n=this.wo)!==null&&n!==void 0?n:this.Ih)===null||t===void 0?void 0:t.kv.get(Xc);return this.Rr.disableSurveys||!this._surveyManager&&this.Eh&&!this.Mh||!a&&!qe(this.Fh)&&!this.Ah?this.Nh(i,{isLoaded:!1}):this._surveyManager&&this.Nh(i),()=>{var o;i.active=!1,this.Rh=this.Rh.filter(u=>u!==i),this.Rh.length===0&&((o=this.jh)===null||o===void 0||o.call(this),this.jh=void 0)}}Uh(){var e,t,n;this._surveyManager&&this.Rh.length>0&&((e=this.jh)!==null&&e!==void 0||(this.jh=(t=(n=this.So).onMatchingConditionsChanged)===null||t===void 0?void 0:t.call(n,this.Dh)))}Nh(e,t){if(this.Mo||!e.active)return;const n=++e.revision,i=a=>{if(!this.Mo&&e.active&&n===e.revision)try{const o=t??{isLoaded:!0},u=JSON.stringify([a,o]);if(u===e.lastResult)return;e.lastResult=u,e.callback(a,o)}catch(o){_t.error("Error in active matching surveys callback",o)}};try{t&&!t.isLoaded?i([]):this.getActiveMatchingSurveys(i)}catch(a){_t.error("Error in active matching surveys callback",a)}}Kh(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}Xh(e){if(qe(this._surveyManager))return{eligible:!1,reason:so};const t=typeof e=="string"?this.Kh(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}Yh(e){if(!this.So.isCapturing())return{eligible:!1,reason:"PostHog is not capturing, so a survey response cannot be recorded"};if(qe(this._surveyManager))return{eligible:!1,reason:so};const t=typeof e=="string"?this.Kh(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(qe(this._surveyManager))return _t.warn("init was not called"),{visible:!1,disabledReason:so};const t=this.Yh(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return qe(this._surveyManager)?(_t.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:so})):new Promise(n=>{this.getSurveys(i=>{var a;const o=(a=i.find(u=>u.id===e))!==null&&a!==void 0?a:null;if(o){const u=this.Yh(o);n({visible:u.eligible,disabledReason:u.reason})}else n({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t,n){var i;if(!this.So.isCapturing())return;if(qe(this._surveyManager))return void _t.warn("init was not called");const a=typeof e=="string"?this.Kh(e):e;if(!(a!=null&&a.id))return void _t.warn("Survey not found");if(!VA.includes(a.type))return void _t.warn(`Surveys of type ${a.type} cannot be rendered in the app`);const o=he==null?void 0:he.querySelector(t);if(o){if(!((i=a.appearance)===null||i===void 0)&&i.surveyPopupDelaySeconds){_t.info(`Rendering survey ${a.id} with delay of ${a.appearance.surveyPopupDelaySeconds} seconds`);const u=setTimeout(()=>{var h,f;this.Oh.delete(u),!this.Mo&&this.So.isCapturing()&&(_t.info(`Rendering survey ${a.id} with delay of ${(h=a.appearance)===null||h===void 0?void 0:h.surveyPopupDelaySeconds} seconds`),(f=this._surveyManager)===null||f===void 0||f.renderSurvey(a,o,n),_t.info(`Survey ${a.id} rendered`))},1e3*a.appearance.surveyPopupDelaySeconds);return void this.Oh.add(u)}this._surveyManager.renderSurvey(a,o,n)}else _t.warn("Survey element not found")}displaySurvey(e,t){var n;if(!this.So.isCapturing())return;if(qe(this._surveyManager))return void _t.warn("init was not called");const i=this.Kh(e);if(!i)return void _t.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!==H0.Popover&&t.initialResponses&&_t.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){const o=this.Xh(i);if(!o.eligible)return void _t.warn("Survey is not eligible to be displayed: ",o.reason)}t.displayType!==H0.Inline?this._surveyManager.handlePopoverSurvey(a,t):this.renderSurvey(a,t.selector,t.properties)}cancelPendingSurvey(e){qe(this._surveyManager)?_t.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 io(e,t,n){if(qe(e))return!1;switch(n){case"exact":return e===t;case"contains":{const i=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(i,"i").test(e)}case"regex":try{return new RegExp(t).test(e)}catch{return!1}default:return!1}}var pM=class{constructor(e){this._instance=e,this.tc=new Set,this.ec=new Set,this.nc=new rf,this.sc=(t,n)=>this.rc(t,n)&&this.oc(t,n)&&this.ac(t,n)&&this.lc(t,n),this.rc=(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.uc=(t=this._instance)===null||t===void 0?void 0:t._addCaptureHook((n,i)=>{this.on(n,i)}))}dispose(){var e,t;(e=this.uc)===null||e===void 0||e.call(this),this.uc=void 0,(t=this._instance)===null||t===void 0||(t=t.autocapture)===null||t===void 0||t.setElementSelectors(new Set,this),this.nc=new rf}register(e){var t,n;if(!ue((t=this._instance)===null||t===void 0?void 0:t._addCaptureHook)&&(e.forEach(i=>{var a;this.tc.add(i),(a=i.steps)===null||a===void 0||a.forEach(o=>{this.ec.add((o==null?void 0:o.event)||"")})}),(n=this._instance)===null||n===void 0?void 0:n.autocapture)){const i=new Set;this.tc.forEach(a=>{var o;(o=a.steps)===null||o===void 0||o.forEach(u=>{u!=null&&u.selector&&i.add(u.selector)})}),this._instance.autocapture.setElementSelectors(i,this)}}replace(e){this.tc.clear(),this.ec.clear(),this.register(e)}on(e,t){t!=null&&e.length!=0&&(this.ec.has(e)||this.ec.has(t.event))&&this.tc.forEach(n=>{this.hc(t,n)&&this.nc.emit("actionCaptured",n.name)})}cc(e){this.onAction("actionCaptured",t=>e(t))}hc(e,t){if((t==null?void 0:t.steps)==null)return!1;for(const n of t.steps)if(this.sc(e,n))return!0;return!1}onAction(e,t){return this.nc.on(e,t)}oc(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"||!io(i,t.url,t.url_matching||"contains"))return!1}return!0}ac(e,t){return!!this.dc(e,t)&&!!this.vc(e,t)&&!!this.fc(e,t)}dc(e,t){var n;if(!(t!=null&&t.href))return!0;const i=this.gc(e);if(i.length>0)return i.some(o=>io(o.href,t.href,t.href_matching||"exact"));const a=(e==null||(n=e.properties)===null||n===void 0?void 0:n.$elements_chain)||"";return!!a&&io((function(o){const u=o.match(/(?::|")href="(.*?)"/);return u?u[1]:""})(a),t.href,t.href_matching||"exact")}vc(e,t){var n;if(!(t!=null&&t.text))return!0;const i=this.gc(e);if(i.length>0)return i.some(f=>io(f.text,t.text,t.text_matching||"exact")||io(f.$el_text,t.text,t.text_matching||"exact"));const a=(e==null||(n=e.properties)===null||n===void 0?void 0:n.$elements_chain)||"";return!!a&&(o=(function(f){const m=[],g=/(?::|")text="(.*?)"/g;let v;for(;!qe(v=g.exec(f));)m.includes(v[1])||m.push(v[1]);return m})(a),u=t.text,h=t.text_matching||"exact",o.some(f=>io(f,u,h)));var o,u,h}fc(e,t){var n,i;if(!(t!=null&&t.selector))return!0;const a=e==null||(n=e.properties)===null||n===void 0?void 0:n.$element_selectors;if(a!=null&&a.includes(t.selector))return!0;const o=(e==null||(i=e.properties)===null||i===void 0?void 0:i.$elements_chain)||"";if(t.selector_regex&&o)try{return new RegExp(t.selector_regex).test(o)}catch{return!1}return!1}gc(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}lc(e,t){return!(t!=null&&t.properties)||t.properties.length===0||oj(t.properties.reduce((n,i)=>{const a=Ue(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)}},mM=class{constructor(e,t){var n,i;this.mc=[],this._instance=e,this.yc=t,this.bc=new Map,this._c=new Map,this.wc=new Map,this.kc=(n=this._instance)===null||n===void 0||(i=n.onSessionId)===null||i===void 0?void 0:i.call(n,a=>this.Sc(a))}xc(e){return!1}Cc(){return null}$c(e){}Tc(){}Ic(e,t){return!!e&&oj(e.propertyFilters,t==null?void 0:t.properties)}Mc(e,t){const n=new Map;return e.forEach(i=>{var a;(a=i.conditions)===null||a===void 0||(a=a[t])===null||a===void 0||(a=a.values)===null||a===void 0||a.forEach(o=>{if(o!=null&&o.name){const u=n.get(o.name)||[];u.push(i.id),n.set(o.name,u)}})}),n}Ec(e,t,n){const i=(n===Uc.Activation?this.bc:this._c).get(e);let a=[];return this.Pc(o=>{a=o.filter(u=>i==null?void 0:i.includes(u.id))}),a.filter(o=>{var u;const h=(u=o.conditions)===null||u===void 0||(u=u[n])===null||u===void 0||(u=u.values)===null||u===void 0?void 0:u.find(f=>f.name===e);return this.Ic(h,t)})}register(e){this.Rc(e,!1)}replace(e){this.Rc(e,!0)}Rc(e,t){var n;ue((n=this._instance)===null||n===void 0?void 0:n._addCaptureHook)||(this.Ac(e,t),this.Fc(e,t))}Fc(e,t){const n=e.filter(o=>{var u;return(u=o.conditions)===null||u===void 0||(u=u.actions)===null||u===void 0||(u=u.values)===null||u===void 0?void 0:u.length});var i;if(t&&this.wc.clear(),n.length===0)return void(t&&((i=this.Oc)===null||i===void 0||i.replace([])));this.Oc||(this.Oc=new pM(this._instance),this.Oc.init(),this.Oc.cc(o=>this.onAction(o)));const a=[];n.forEach(o=>{var u;(u=o.conditions)===null||u===void 0||(u=u.actions)===null||u===void 0||u.values.forEach(h=>{if(a.push(h),h.name){var f;const m=(f=this.wc.get(h.name))!==null&&f!==void 0?f:[];m.includes(o.id)||m.push(o.id),this.wc.set(h.name,m)}})}),t?this.Oc.replace(a):this.Oc.register(a)}Dc(e,t){t.forEach((n,i)=>{var a;const o=(a=e.get(i))!==null&&a!==void 0?a:[];n.forEach(u=>{o.includes(u)||o.push(u)}),e.set(i,o)})}Ac(e,t){var n,i;const a=e.filter(f=>{var m,g;return((m=f.conditions)===null||m===void 0?void 0:m.events)&&((g=f.conditions)===null||g===void 0||(g=g.events)===null||g===void 0||(g=g.values)===null||g===void 0?void 0:g.length)>0}),o=e.filter(f=>{var m,g;return((m=f.conditions)===null||m===void 0?void 0:m.cancelEvents)&&((g=f.conditions)===null||g===void 0||(g=g.cancelEvents)===null||g===void 0||(g=g.values)===null||g===void 0?void 0:g.length)>0}),u=this.Mc(e,Uc.Activation),h=this.Mc(e,Uc.Cancellation);t?(this.bc=u,this._c=h):(this.Dc(this.bc,u),this.Dc(this._c,h)),(a.length!==0||o.length!==0||e.some(f=>{var m;return(m=f.conditions)===null||m===void 0||(m=m.actions)===null||m===void 0||(m=m.values)===null||m===void 0?void 0:m.length}))&&((n=this.uc)!==null&&n!==void 0||(this.uc=(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.Lc(),o=(t==null||(n=t.properties)===null||n===void 0?void 0:n.$survey_id)||(t==null||(i=t.properties)===null||i===void 0?void 0:i.$product_tour_id);if(o&&this.getActivatedIds().includes(o)){const h=this.Nc(e,o,t);if(h==="consume")return a.info("event consumed activated item, removing it",{event:e,itemId:o}),void this.qc([o]);if(h==="persist")return a.info("shown item promoted to persisted activation",{event:e,itemId:o}),this.jc(o),void this.Bc([o])}if(this._c.has(e)){const h=this.Ec(e,t,Uc.Cancellation);h.length>0&&(a.info("cancel event matched, cancelling items",{event:e,itemsToCancel:h.map(f=>f.id)}),this.qc(h.map(f=>f.id)),h.forEach(f=>this.Hc(f.id)))}if(!this.bc.has(e))return;a.info("event name matched",{event:e,eventPayload:t,items:this.bc.get(e)});const u=this.Ec(e,t,Uc.Activation);this.zc(u.map(h=>h.id))}onAction(e){this.wc.has(e)&&this.zc(this.wc.get(e)||[])}zc(e){var t,n;if(e.length===0)return;const i=!!(!((t=this._instance)===null||t===void 0||(n=t.get_session_id)===null||n===void 0)&&n.call(t)),a=[];for(const o of e)i&&this.xc(o)?this.jc(o)&&this.Uc(o):a.push(o);a.length>0&&(this.mc=[...new Set([...this.mc,...a])]),this.Lc().info("updating activated items",{activatedItems:this.getActivatedIds()}),this.Wc()}jc(e){this.mc=this.mc.filter(n=>n!==e);const t=this.Vc();return!t.includes(e)&&(this.Gc([...t,e]),this.Zc(),!0)}qc(e){const t=new Set(e);this.mc=this.mc.filter(a=>!t.has(a));const n=this.Qc(),i=n.filter(a=>!t.has(a));i.length!==n.length&&(this.Gc(i),i.length===0&&this.Jc()),this.Bc(e),this.Wc()}Wc(){try{var e;(e=this.yc)===null||e===void 0||e.call(this)}catch(t){this.Lc().error("Error while handling activated items change",t)}}Kc(){var e;const t=this.Cc();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:{}}Uc(e){if(!this.Cc())return;const t=this.Kc();this.$c(B(B({},t),{},{[e]:Date.now()}))}Bc(e){if(!this.Cc())return;const t=this.Kc(),n={};let i=!1;for(const[a,o]of Object.entries(t))e.includes(a)?i=!0:n[a]=o;i&&(ms(n)?this.Tc():this.$c(n))}Xc(){this.Cc()&&this.Tc()}getActivationTimestamp(e){if(!this.Vc().includes(e))return;const t=this.Kc()[e];return Jt(t)?t:void 0}Qc(){var e;const t=this.Yc();return((e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[t])||[]}Vc(){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.td()],o=(t=this._instance)===null||t===void 0||(n=t.get_session_id)===null||n===void 0?void 0:n.call(t);return o&&a===o?i:[]}Zc(){var e,t;const n=(e=this._instance)===null||e===void 0||(t=e.get_session_id)===null||t===void 0?void 0:t.call(e);n&&this.ed(n)}Jc(){this.nd()}Sc(e){var t;const n=(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0?void 0:t.props[this.td()];if(n&&n!==e){const i=this.Qc(),a=this.Kc();i.length>0&&(this.Gc([]),i.filter(o=>Jt(a[o])).forEach(o=>this.Hc(o))),this.Jc(),this.Xc(),i.length>0&&this.Wc()}}getActivatedIds(){return[...new Set([...this.Vc(),...this.mc])].filter(e=>!this.sd(e))}dispose(){var e,t,n;(e=this.kc)===null||e===void 0||e.call(this),this.kc=void 0,(t=this.uc)===null||t===void 0||t.call(this),this.uc=void 0,(n=this.Oc)===null||n===void 0||n.dispose(),this.Oc=void 0}reset(){this.mc=[],this.Qc().length>0&&this.Gc([]),this.Jc(),this.Xc(),this.Wc()}getEventToItemsMap(){return this.bc}rd(){return this.Oc}},gM=class extends mM{constructor(e,t){super(e,t)}Yc(){return rk}td(){return ak}Cc(){return lk}$c(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated_timestamps:e})}Tc(){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.unregister("$surveys_activated_timestamps")}xc(e){var t;let n;this.Pc(a=>{n=a.find(o=>o.id===e)});const i=n==null||(t=n.appearance)===null||t===void 0?void 0:t.surveyPopupDelaySeconds;return Jt(i)&&i>0}od(){return Os.SHOWN}Pc(e){var t;(t=this._instance)===null||t===void 0||t.getSurveys(e)}Hc(e){var t;(t=this._instance)===null||t===void 0||t.cancelPendingSurvey(e)}Lc(){return _t}Gc(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated:e})}ed(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated_session:e})}nd(){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.unregister("$surveys_activated_session")}sd(){return!1}Nc(e,t,n){var i;if(e===Os.SENT&&(n==null||(i=n.properties)===null||i===void 0?void 0:i.$survey_completed)===!1)return"ignore";let a;return this.Pc(o=>{a=o.find(u=>u.id===t)}),!a||(function(o){var u;return aj(o)&&!!(!((u=o.conditions)===null||u===void 0||(u=u.events)===null||u===void 0)&&u.repeatedActivation)||o.schedule==="always"})(a)?e===Os.SHOWN?"consume":"ignore":e===Os.SHOWN?"persist":e===Os.DISMISSED||e===Os.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},xM=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)}},vM=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(e){return new gM(this._instance,e)}onMatchingConditionsChanged(e){const t=this._instance._addCaptureHook(o=>{o!=="$pageview"&&o!==Os.SHOWN&&o!==Os.DISMISSED&&o!==Os.SENT||e()}),n=()=>e();xt(te,"PHSurveyShown",n);let i=!1;const a=this._instance.onFeatureFlags(()=>{i&&e()});return i=!0,()=>{i=!1,t(),a(),te==null||te.removeEventListener("PHSurveyShown",n)}}};const bM=te!=null&&te.location?tf(te.location.hash,"__posthog")||tf(location.hash,"state"):null,a5="_postHogToolbarParams",l5=Wt("[Toolbar]"),o5=Wt("[FeatureFlags]");var yM=class{constructor(e,t=!1){this.ad=!1,this.update(e,t)}update(e,t){this.ld=((n,i)=>{var a,o,u,h,f,m,g,v;return{bootstrap:{featureFlags:(a=(o=n.bootstrap)===null||o===void 0?void 0:o.featureFlags)!==null&&a!==void 0?a:void 0,featureFlagPayloads:(u=(h=n.bootstrap)===null||h===void 0?void 0:h.featureFlagPayloads)!==null&&u!==void 0?u:void 0},remoteRequestsDisabled:i,featureFlagsDisabled:!!n.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!n.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!n.advanced_feature_flags_dedup_per_session,cacheTtlMs:n.feature_flag_cache_ttl_ms,refreshIntervalMs:(f=n.remote_config_refresh_interval_ms)!==null&&f!==void 0?f:3e5,idleRefreshBackoff:ue(n.remote_config_refresh_interval_ms),requestTimeoutMs:n.feature_flag_request_timeout_ms,requestMaxRetries:Math.max(0,(m=n.feature_flag_request_max_retries)!==null&&m!==void 0?m:1),compression:n.disable_compression?void 0:"best-available",evaluationContexts:(g=(v=n.evaluation_contexts)!==null&&v!==void 0?v:n.evaluation_environments)!==null&&g!==void 0?g:[],flagKeys:Ue(n.flag_keys)?n.flag_keys:void 0}})(e,t),!e.evaluation_environments||e.evaluation_contexts||this.ad||(o5.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.ad=!0),ue(e.flag_keys)||Ue(e.flag_keys)||o5.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this.ld}};const c5=Wt("[FeatureFlags]"),Ga=Wt("[FeatureFlags]",{debugEnabled:!0}),Ig=`" failed. Feature flags didn't load in time.`,_M=[502,504],u5=["click","keydown","wheel","touchstart","pointerdown"],d5="connection_error",h5=e=>{const t={};for(let n=0;e.length>n;n++)t[e[n]]=!0;return t},f5=e=>{const t={};for(const[n,i]of Lh(e||{}))i&&(t[n]=i);return t},p5=e=>Eo(e)&&(e.name==="RangeError"&&e.message.indexOf("Maximum call stack size exceeded")===0||e.name==="InternalError"&&e.message==="too much recursion"),li=Wt("[Error tracking]"),X0="webkit-masked-url:",wM=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],SM=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",X0],kM=["__firefox__","__gCrWeb"],m5="Refusing to render web experiment since the viewer is a likely bot",jM={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>af(t,e),not_regex:(e,t)=>!af(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e},qs=Wt("[Conversations]"),Ya="Conversations not available yet.";function g5(e,t){var n,i,a,o,u,h,f;const m=(n=e==null?void 0:e.flushIntervalMs)!==null&&n!==void 0?n:3e3,g=(i=e==null?void 0:e.maxBufferSize)!==null&&i!==void 0?i:100,v=t!=null&&t.consoleCapture?void 0:(a=e==null?void 0:e.maxLogsPerInterval)!==null&&a!==void 0?a:1e3,b=ue(v)?Math.max(g,2048):Math.max(g,v),y=B(B({},(function(){let _="",j="";try{const N=jn==null?void 0:jn.userAgent;N&&([_,j]=AS(N))}catch{}return(function(N,w){const C=(function(E){if(E)return{}.hasOwnProperty.call(uw,E)?uw[E]:E})(N);return B(B({},C?{"os.name":C}:{}),w?{"os.version":w}:{})})(_,j)})()),e==null?void 0:e.resourceAttributes);return{serviceName:(o=(u=y==null?void 0:y["service.name"])!==null&&u!==void 0?u:e==null?void 0:e.serviceName)!==null&&o!==void 0?o:t==null?void 0:t.serviceNameDefault,serviceVersion:(h=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:g,maxQueueSize:b,maxBatchRecordsPerPost:100,rateCapWindowMs:m,maxLogsPerInterval:v,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}const NM=["debug","log","warn","error","info"],CM=e=>{for(;e!=null&&e.__rrweb_original__;)e=e.__rrweb_original__;return e},x5="console",fj="__posthogHandledLogsRequestError",Hg=(e,t)=>{const n=e instanceof Error?e:new Error(t);return n[fj]=!0,n},v5=e=>!!e&&typeof e=="object"&&e[fj]===!0,lf=Wt("[NetworkMetrics]"),$x=()=>{var e;return!(te==null||(e=te.performance)===null||e===void 0)&&e.now?te.performance.now():Date.now()},EM={"http:":80,"https:":443},TM=new Set(["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"]),pj=(e,t)=>{var n;const i=String(t);return{method:String(e).toUpperCase(),url:((n=mr(i))===null||n===void 0?void 0:n.href)||i}},W0=(e,t,n,i,a,o,u=!1)=>{try{var h,f;const m=a();if(!m)return;const g=n||void 0,v=$x()-i,b=mr(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&&!g?void 0:((w,C)=>w?400>w?void 0:String(w):(C==null?void 0:C.name)||"_OTHER")(g,o),N=B(B(B(B(B({},(w=>{const C=TM.has(w)?w:"_OTHER";return B({"http.request.method":C},C==="_OTHER"&&w!==C?{"http.request.method_original":w}:{})})(y.method)),b?(w=>{return{"server.address":w.hostname.startsWith("[")&&w.hostname.endsWith("]")?w.hostname.slice(1,-1):w.hostname,"server.port":Number(w.port)||EM[w.protocol],"url.scheme":w.protocol.slice(0,-1),"url.template":(C=w.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):{}),g?{"http.response.status_code":g}:{}),j?{"error.type":j}:{}),(h=m.attributes)===null||h===void 0?void 0:h.call(m,y,{status:g,durationMs:v}));(f=e.metrics)===null||f===void 0||f.histogram(_,v,{unit:"ms",attributes:N})}catch(m){lf.error("Failed to record network metric",m)}},mj=()=>{},AM=(e,t)=>kn(te==null?void 0:te.fetch)?Nu(te,"fetch",n=>function(...i){const a=$x(),o=n.apply(this,i);if(!t())return o;try{var u,h,f;const[m,g]=i,v=pj((u=(h=g==null?void 0:g.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 o.then(b=>(W0(e,v,b==null?void 0:b.status,a,t,void 0,!0),b),b=>{throw W0(e,v,void 0,a,t,b),b})}catch(m){return lf.error("Failed to observe fetch",m),o}}):mj,MM=(e,t)=>{var n;const i=te==null||(n=te.XMLHttpRequest)===null||n===void 0?void 0:n.prototype;if(!i)return mj;const a=new WeakMap,o=Nu(i,"open",h=>function(...f){try{Yk.has(this)||a.set(this,pj(f[0],f[1]))}catch(m){lf.error("Failed to observe XHR open",m)}return h.apply(this,f)}),u=Nu(i,"send",h=>function(...f){let m;try{const g=a.get(this);if(g&&t()){const v=$x();m=()=>{this.removeEventListener("loadend",m),W0(e,g,this.status,v,t)},xt(this,"loadend",m)}}catch(g){lf.error("Failed to observe XHR send",g)}try{return h.apply(this,f)}catch(g){throw m&&this.removeEventListener("loadend",m),g}});return()=>{o(),u()}},wf={featureFlags:class{constructor(e){this.name="featureFlags",this.ud=!1,this.featureFlagEventHandlers=[],this.$=c5,this.hd={},this.dd={},this.vd=[],this.fd=!1,this.pd=!1,this.gd=0,this.md=!1,this.yd=!1,this.bd=!1,this._d=!1,this.wd=0,this.kd=!1,this.an=()=>{const t=this.Sd();this.wd=0,t&&this.reloadFeatureFlags()},this.xd=()=>{var t,n;const i=this.Cd,a=(t=this.$d)!==null&&t!==void 0?t:i;ue(i)||ue(a)||this.Rr.remoteRequestsDisabled||!he||he.visibilityState==="hidden"||Date.now()-((n=this.Td)!==null&&n!==void 0?n:0)<a||(this.$d=this.kd||!this.Rr.idleRefreshBackoff?i:Math.min(2*a,36e5),this.kd=!1,this.reloadFeatureFlags(),this.Id())},this.Md=()=>{this.kd&&this.$d===this.Cd||this.Ed()},this.ln=()=>{(he==null?void 0:he.visibilityState)==="visible"&&this.Ed()},"get"in e?this.So=e:(this._instance=e,this.Pd=new yM(e.config,e.sl()),this.So=this.Pd)}updateConfig(e,t){var n;(n=this.Pd)===null||n===void 0||n.update(e,t),this.wo&&this.Rd()}setup(e){return this.qh=e,this.$=e.logger.createLogger("[FeatureFlags]"),hj(e.kv.initialize(),()=>{this.qh===e&&(this.qh=void 0,this.wo=e,this.Ad(e))})}Ad(e){var t;if(this.wo===e)return te&&xt(te,"online",this.an),this.Rd(),this.Fd=e.registerDynamicEventProperties(()=>this.Od()?this.hd:this.dd),this.Dd=(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0?void 0:t.onCrossTabFeatureFlagChange(()=>{this.Ld(),this.Nd(),this.qd()}),this.Nd(),this.initialize()}Ed(){this.kd=!0,this.$d=this.Cd,this.xd()}Rd(){const e=this.Rr.refreshIntervalMs,t=!this.Rr.remoteRequestsDisabled&&he&&!ue(e)&&e>0?e:void 0;this.Rr.idleRefreshBackoff||(this.$d=t),t!==this.Cd&&(this.jd(),ue(t)||(this.Cd=t,this.$d=t,this.Id(),he!=null&&he.addEventListener&&(xt(he,_u,this.ln),ho(u5,n=>{xt(he,n,this.Md,{capture:!0})}))))}Id(){ue(this.Cd)||(ue(this.Bd)||clearInterval(this.Bd),this.Td=Date.now(),this.Bd=setInterval(this.xd,this.Cd))}jd(){var e;ue(this.Bd)||(clearInterval(this.Bd),this.Bd=void 0,he==null||(e=he.removeEventListener)===null||e===void 0||e.call(he,"visibilitychange",this.ln),ho(u5,t=>{var n;he==null||(n=he.removeEventListener)===null||n===void 0||n.call(he,t,this.Md,{capture:!0})})),this.Cd=void 0,this.$d=void 0,this.kd=!1,this.Td=void 0}destroy(){this.Hd()}dispose(){this.Hd()}Hd(){var e,t;this.jd(),this.gd++,this.yd=!1,this.qh=void 0,this.wo&&(this.zd(),(e=this.Fd)===null||e===void 0||e.dispose(),this.Fd=void 0,(t=this.Dd)===null||t===void 0||t.call(this),this.Dd=void 0,this.vd=[],te==null||te.removeEventListener("online",this.an),this.wo=void 0)}get Rr(){return this.So.get()}Ud(e){var t;return this.Wd&&e in this.Wd?this.Wd[e]:(t=this.wo)===null||t===void 0?void 0:t.kv.get(e)}Ld(){return!!this.Wd&&(this.Wd=void 0,!0)}Vd(){var e;return!ue((e=this.wo)===null||e===void 0?void 0:e.kv.get("$enabled_feature_flags"))&&this.Ld()}At(e){this.Gd(()=>{var t;return(t=this.wo)===null||t===void 0?void 0:t.kv.set(e)})}Zd(e,t,n){var i;if(!(!((i=this._instance)===null||i===void 0)&&i.persistence)||!e.$enabled_feature_flags)return;const a=this.Ud("$enabled_feature_flags")||{},o=e.$enabled_feature_flags||{},u=t.flags||t.featureFlags,h=t.flags?Object.entries(t.flags).filter(([,w])=>!(w!=null&&w.failed)).map(([w])=>w):[],f=!!t.errorsWhileComputingFlags&&!!t.flags,m=f?h:n&&!Ue(u)?Object.keys(u||{}):Array.from(new Set([...Object.keys(a),...Object.keys(o)])),g=this.Ud("$feature_flag_payloads")||{},v=e.$feature_flag_payloads||{},b=f||n?m:Array.from(new Set([...Object.keys(g),...Object.keys(v)])),y=!f&&!n,_=!!y||m,j=!!y||b,N={[ur]:_,[ci]:_,[ia]:j};e.$feature_flag_details&&(N[el]=_);for(const w of[tl,oa,ru])ue(e[w])||(N[w]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(N)}Lt(e){this.Gd(()=>{var t;return(t=this.wo)===null||t===void 0?void 0:t.kv.remove(e)})}Gd(e){try{e()}catch(t){this.$.error("Failed to update feature flag persistence",t)}}Nd(){const e={};for(const i of[ur,ia,tl,Ai]){const a=this.Ud(i);ue(a)||(e[i]=a)}this.hd=e;const t=B({},e),n=this.Ud(ci);if(n)for(const[i,a]of Object.entries(n))t[`$feature/${i}`]=a;this.dd=t}Od(){const e=this.Rr.cacheTtlMs;if(!e||0>=e)return!1;const t=this.Ud(oa);return typeof t!="number"||Date.now()-t>e}Qd(){return!!this.Od()&&(this._d||this.pd||(this._d=!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}):[]}Kd(){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,o;const u=(a=(o=n.bootstrap)===null||o===void 0?void 0:o.featureFlagPayloads)!==null&&a!==void 0?a:{},h=Object.keys(i).filter(m=>!ue(i[m])).reduce((m,g)=>(m[g]=i[g],m),{}),f=Object.keys(u).filter(m=>h[m]).reduce((m,g)=>(m[g]=u[g],m),{});return this.Xd({featureFlags:h,featureFlagPayloads:f},void 0,{persist:!1})}}updateFlags(e,t,n){var i,a;const o=n!=null&&n.merge&&(i=this.Ud("$enabled_feature_flags"))!==null&&i!==void 0?i:{},u=n!=null&&n.merge&&(a=this.Ud("$feature_flag_payloads"))!==null&&a!==void 0?a:{},h=B(B({},o),e),f=B(B({},u),t),m={};for(const[g,v]of Object.entries(h))m[g]={key:g,enabled:rw(v),variant:aw(v),reason:void 0,metadata:ue(f==null?void 0:f[g])?void 0:{id:0,version:void 0,description:void 0,payload:f[g]}};this.Xd({flags:m})}get hasLoadedFlags(){return this.fd}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const e=this.Ud(el),t=this.Ud(Ai),n=this.Ud(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 o;const f=i[h],m=t==null?void 0:t[h],g=ue(m)?(o=f==null?void 0:f.enabled)!==null&&o!==void 0&&o:!!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:g,variant:g?v??(f==null?void 0:f.variant):void 0});var u;g!==(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.ud||(this.$.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:i}),this.ud=!0),i}getAllFeatureFlags(){const e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map(n=>{const i=e[n];return{key:n,enabled:rw(i),variant:aw(i),payload:iw(t[n])}})}getFlagVariants(){const e=this.Ud(ci),t=this.Ud(Ai);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.ud||(this.$.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.ud=!0),n}getFlagPayloads(){const e=this.Ud(ia),t=this.Ud(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.ud||(this.$.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),this.ud=!0),n}reloadFeatureFlags(){this.md||this.Rr.featureFlagsDisabled||this.Sd()||(this.pd&&(this.yd=!0),this.Yd||(this.vd.slice().forEach(e=>{try{e()}catch(t){this.$.error("Error while running feature flags reloading callback",t)}}),this.Yd=setTimeout(()=>{this.tv()},5)))}zd(){clearTimeout(this.Yd),this.Yd=void 0}onReloading(e){return this.vd.push(e),()=>{this.vd=this.vd.filter(t=>t!==e)}}ensureFlagsLoaded(){this.fd||this.pd||this.Yd||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.md=e}resetFlagCallReported(){this.Lt(la)}tv(e){this.zd();const t=this.wo;if(!t||this.Rr.remoteRequestsDisabled||this.Sd())return;if(this.pd)return void(this.yd=!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.Ud("$stored_person_properties")||{}),{},{$lib:t.library.name,$lib_version:t.library.version}),group_properties:this.Ud(aa),timezone:Pk()};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.Kd();ue(a)||(n.flag_keys=a);const o=this.Rr.onlyEvaluateSurveyFeatureFlags,u="/flags/?v=2"+(o?"&only_evaluate_survey_feature_flags=true":""),h=this.gd;this.pd=!0;const f=()=>{this.yd&&(this.yd=!1,this.tv())},m=_=>{var j,N;const w=(j=_.json)!==null&&j!==void 0?j:{},C=_.statusCode!==200;if(this.pd=!1,h!==this.gd)return void f();if(this.ev(_.statusCode),C||this.yd||(this.$anon_distinct_id=void 0),n.disable_flags&&!this.yd)return;this.bd=!C;const E=[];_.error?E.push(_.error instanceof Error&&_.error.name==="AbortError"?"timeout":_.error instanceof Error?d5:"unknown_error"):_.statusCode!==200&&E.push(`api_error_${_.statusCode}`),w.errorsWhileComputingFlags&&E.push("errors_while_computing_flags");const R=!!(!((N=w.quotaLimited)===null||N===void 0)&&N.includes("feature_flags"));R&&E.push("quota_limited"),this.At({[yu]: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.Xd(w,C,{partialResponse:o}),f()},g=_=>{this.pd=!1,h===this.gd&&(this.At({[yu]:[d5]}),this.$.error("Feature flag request failed",_),this.Vd()&&this.qd(!0)),f()};let v=this.Rr.requestMaxRetries;const b=()=>v>0&&h===this.gd,y=()=>{if(h!==this.gd||!this.wo||this.Rr.remoteRequestsDisabled)return this.pd=!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=>_M.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(g)}catch(_){g(_)}};y()}Sd(){return Ak(this.wd,3)}ev(e){this.wd=Mk(e,this.wd,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.bd)return;if(!(this.fd||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlag for key "'+e+Ig);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.bd)return;if(!(this.fd||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlagResult for key "'+e+Ig);if(this.Qd())return;const n=this.getFlagVariants(),i=e in n,a=n[e],o=this.getFlagPayloads()[e],u=String(a),h=this.Ud("$feature_flag_request_id")||void 0,f=this.Ud("$feature_flag_evaluated_at")||void 0;let m,g=this.Ud("$flag_call_reported")||{};if(this.Rr.deduplicateCallsPerSession){var v;const X=(v=this.wo)===null||v===void 0?void 0:v.session.sessionId,U=this.Ud(Wc);X&&X!==U&&(g={},m=X)}if(t.send_event||!("send_event"in t))if(e in g&&g[e].includes(u))m&&this.At({[la]:g,[Wc]:m});else{var b,y,_,j,N,w,C,E,R,M,L,F;Ue(g[e])?g[e].push(u):g[e]=[u],this.At(B({[la]:g},m?{[Wc]:m}:{}));const X=this.getFeatureFlagDetails(e),U=[...(b=this.Ud("$feature_flag_errors"))!==null&&b!==void 0?b:[]];ue(a)&&U.push("flag_missing");const G={$feature_flag:e,$feature_flag_response:a,$feature_flag_payload:o??null,$feature_flag_request_id:h,$feature_flag_evaluated_at:f,$feature_flag_bootstrapped_response:(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.bd};ue(X==null||(w=X.metadata)===null||w===void 0?void 0:w.has_experiment)||(G.$feature_flag_has_experiment=X.metadata.has_experiment),ue(X==null||(C=X.metadata)===null||C===void 0?void 0:C.version)||(G.$feature_flag_version=X.metadata.version);const O=(E=X==null||(R=X.reason)===null||R===void 0?void 0:R.description)!==null&&E!==void 0?E:X==null||(M=X.reason)===null||M===void 0?void 0:M.code;var D;O&&(G.$feature_flag_reason=O),!(X==null||(L=X.metadata)===null||L===void 0)&&L.id&&(G.$feature_flag_id=X.metadata.id),ue(X==null?void 0:X.original_variant)&&ue(X==null?void 0:X.original_enabled)||(G.$feature_flag_original_response=ue(X.original_variant)?X.original_enabled:X.original_variant),!(X==null||(F=X.metadata)===null||F===void 0)&&F.original_payload&&(G.$feature_flag_original_payload=X==null||(D=X.metadata)===null||D===void 0?void 0:D.original_payload),U.length&&(G.$feature_flag_error=U.join(",")),this.iv(G)}else m&&this.At({[la]:g,[Wc]:m});return i?{key:e,enabled:!!a,variant:typeof a=="string"?a:void 0,payload:iw(o)}:void 0}iv(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.nv(e,t)}nv(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}},o=n.Jd();o.length&&(a.evaluation_contexts=o);const u=n.Kd();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.bd)return t.defaultValue;if(!(this.fd||this.getFlags()&&this.getFlags().length>0))return this.$.warn('isFeatureEnabled for key "'+e+Ig),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.Xd(e,t,n)}Xd(e,t,n){if(!this.wo)return;this.fd=!0;const i=((a,o={},u={},h={},f,m=c5)=>{const g=((E,R)=>{const M=E.flags;if(M){const L=Object.fromEntries(Object.keys(M).map(D=>{var X;return[D,(X=M[D].variant)!==null&&X!==void 0?X:M[D].enabled]})),F=Object.fromEntries(Object.keys(M).filter(D=>M[D].enabled).filter(D=>{var X;return!ue((X=M[D].metadata)===null||X===void 0?void 0:X.payload)}).map(D=>{var X;return[D,(X=M[D].metadata)===null||X===void 0?void 0:X.payload]}));return B(B({},E),{},{featureFlags:L,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=g.flags,b=g.featureFlags,y=g.featureFlagPayloads;if(!b)return;const _=a.requestId,j=a.evaluatedAt;if(Ue(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{[ur]:b,[ci]:E,[ru]:!1}}let N=b,w=y,C=v;if(f!=null&&f.partialResponse){const E=Object.keys(N),R=w||{};N=B(B({},o),N),w=B(B({},u),R),E.forEach(M=>{M in R||w==null||delete w[M]}),C=B(B({},h),C)}else if(a.errorsWhileComputingFlags)if(v){const E=new Set(Object.keys(v).filter(M=>{var L;return!(!((L=v[M])===null||L===void 0)&&L.failed)}));N=B(B({},o),Object.fromEntries(Object.entries(N).filter(([M])=>E.has(M))));const R=Object.fromEntries(Object.entries(w||{}).filter(([M])=>E.has(M)));w=B(B({},u),R),E.forEach(M=>{M in R||w==null||delete w[M]}),C=B(B({},h),Object.fromEntries(Object.entries(C||{}).filter(([M])=>E.has(M))))}else N=B(B({},o),N),w=B(B({},u),w),C=B(B({},h),C);return B(B({[ur]:Object.keys(f5(N)),[ci]:N||{},[ia]:w||{},[el]:C||{},[ru]:a.minimalFlagCalledEvents===!0},_?{[tl]:_}:{}),j?{[oa]: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.Wd=i,a||this.At(i)}else this.Ld(),this.Zd(i,e,!!(n!=null&&n.partialResponse)),this.At(i);else t&&this.Vd();t||(this._d=!1),this.qd(t)}override(e,t=!1){this.$.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){this.sv(e)}sv(e){if(this.wo){if(e===!1)return this.Lt([Ai,Ka]),this.qd(),void Ga.info("All overrides cleared");if(Ue(e))return this.At({[Ai]:h5(e)}),this.qd(),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.ud=!!((t=n.suppressWarning)!==null&&t!==void 0&&t);const i={},a=n.flags,o=n.payloads;return a&&(i[Ai]=Ue(a)?h5(a):a),o&&(i[Ka]=o),Object.keys(i).length&&this.At(i),a===!1&&o===!1?this.Lt([Ai,Ka]):a===!1?this.Lt(Ai):o===!1&&this.Lt(Ka),this.qd(),a===!1?Ga.info("Flag overrides cleared"):a&&Ga.info("Flag overrides set",{flags:a}),void(o===!1?Ga.info("Payload overrides cleared"):o&&Ga.info("Payload overrides set",{payloads:o}))}if(e&&typeof e=="object")return this.At({[Ai]:e}),this.qd(),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.fd){const{flags:t,flagVariants:n}=this.rv();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.Ud("$early_access_features")||[]).find(m=>m.flagKey===e),o={[`$feature_enrollment/${e}`]:t},u={$feature_flag:e,$feature_enrollment:t,$set:o};a&&(u.$early_access_feature_name=a.name),n&&(u.$feature_enrollment_stage=n);const h=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(o)}),this.At({[ur]:Object.keys(f5(h)),[ci]:h,[ra]:B(B({},this.Ud("$stored_person_properties")||{}),o)}),this.qd();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.Ud(D0);!i||t?this.ov(e,n):e(i)}ov(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 o;try{const u=yield i.sendRequest(`/api/early_access_features/?token=${i.projectToken}${a}`,{target:"api",method:"GET",sentAt:"query"});if(!u.json)return;o=u.json.earlyAccessFeatures,n.At({[D0]:o})}catch(u){return void n.$.error("Early access feature request failed",u)}try{e(o)}catch(u){n.$.error("Early access feature callback failed",u)}})()}rv(){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),{})}}qd(e){this.Nd();const{flags:t,flagVariants:n}=this.rv();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.av(e,t)}av(e,t=!0){const n=this.Ud("$stored_person_properties")||{},i=(e==null?void 0:e.$set)||(e!=null&&e.$set_once?{}:e),a=e==null?void 0:e.$set_once,o={};if(a)for(const u in a)({}).hasOwnProperty.call(a,u)&&(u in n||(o[u]=a[u]));this.At({[ra]:B(B(B({},n),o),i)}),t&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t=!0){const n=B({},this.Ud("$stored_person_properties")||{});e.forEach(i=>{delete n[i]}),this.At({[ra]:n}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e=!0){this.Lt(ra),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t=!0){const n=this.Ud("$stored_group_properties")||{},i=B({},n);for(const a of Object.keys(e))i[a]=B(B({},n[a]),e[a]);this.At({[aa]:i}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){const t=this.Ud("$stored_group_properties")||{};this.At({[aa]:B(B({},t),{},{[e]:{}})})}else this.Lt(aa)}reset(){this.gd++,this.yd=!1,this.hd={},this.dd={},this.Wd=void 0,this.fd=!1,this.md=!1,this.bd=!1,this.$anon_distinct_id=void 0,this.zd(),this.ud=!1,this.wd=0}}},RM={sessionRecording:class{get Rr(){return this._instance.config}get El(){return this._instance.persistence}get started(){var e;return!!(!((e=this.lv)===null||e===void 0)&&e.isStarted)}get status(){var e,t;return this.uv==="awaiting_config"||this.uv==="missing_config"?this.uv:(e=(t=this.lv)===null||t===void 0?void 0:t.status)!==null&&e!==void 0?e:this.uv}constructor(e){if(this._instance=e,this._forceAllowLocalhostNetworkCapture=!1,this.uv=Pg,this.hv=void 0,this.dv=!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.lv)===null||t===void 0||(n=t.setDocumentWasEverVisible)===null||n===void 0||n.call(t,!0))},!this._instance.sessionManager)throw rr.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&&xt(he,"visibilitychange",this.ln)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:e=!1}={}){var t;this.dv=!0,he==null||(t=he.removeEventListener)===null||t===void 0||t.call(he,"visibilitychange",this.ln),e?this.vv(!0):this.stopRecording()}get fv(){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.dv||this.fv&&(!((t=this.lv)===null||t===void 0)&&t.isStarted))return;const n=!ue(Object.assign)&&!ue(Array.from);this.fv&&n?(this.pv(e),rr.info("starting")):(this.uv=Pg,this.stopRecording())}pv(e){var t,n;if(this.fv)if(this.uv!=="awaiting_config"&&this.uv!=="missing_config"&&(this.uv=s5),($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.gv(e);else{var i,a;const o=this._instance.sessionManager;(i=$e.__PosthogExtensions__)===null||i===void 0||(a=i.loadExternalDependency)===null||a===void 0||a.call(i,this._instance,this.mv,u=>{if(!this.dv&&this.fv&&this._instance.sessionManager===o)return u?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),rr.error("could not load recorder",u)):void this.gv(e);this.uv="disabled"})}}stopRecording(){var e,t;(e=this.hv)===null||e===void 0||e.call(this),this.hv=void 0,(t=this.lv)===null||t===void 0||t.stop()}vv(e=!1){var t,n;(t=this.hv)===null||t===void 0||t.call(this),this.hv=void 0,(n=this.lv)===null||n===void 0||n.discard({discardProducerEvents:e})}yv(){var e,t;(e=this.El)===null||e===void 0||e.unregister("$session_is_sampled"),(t=this.El)===null||t===void 0||t.unregister("$replay_sample_rate")}bv(e,t){if(qe(e))return null;const n=Jt(e)?e:parseFloat(e);return typeof(i=n)!="number"||!Number.isFinite(i)||0>i||i>1?(rr.warn(`${t} must be between 0 and 1. Ignoring invalid value:`,e),null):n;var i}_v(e){if(this.El){var t,n;const i=this.El,a=()=>{var o;const u=e.sessionRecording===!1?void 0:e.sessionRecording,h=this.bv((o=this.Rr.session_recording)===null||o===void 0?void 0:o.sampleRate,"session_recording.sampleRate"),f=this.bv(u==null?void 0:u.sampleRate,"remote config sampleRate"),m=h??f;qe(m)&&this.yv();const g=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(g)?null:g,endpoint:u==null?void 0:u.endpoint,triggerMatchType:u==null?void 0:u.triggerMatchType,masking:u==null?void 0:u.masking,urlTriggers:u==null?void 0:u.urlTriggers,version:u==null?void 0:u.version,triggerGroups:u==null?void 0:u.triggerGroups})})};a(),(t=this.hv)===null||t===void 0||t.call(this),this.hv=(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._v(t),void this.vv()):(this._v(t),void this.startIfEnabledOrStop()):(this.uv==="awaiting_config"&&(this.uv="missing_config",this._instance.register_for_session({[pk]:!0}),rr.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t="log"){var n;!((n=this.lv)===null||n===void 0)&&n.log?this.lv.log(e,t):rr.warn("log called before recorder was ready")}get mv(){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"}wv(){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 rr.warn("persisted remote config for session recording is invalid and will be ignored",n),!1}return!qe(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}gv(e){var t,n,i;if(!this.dv&&this.fv&&this._instance.sessionManager){if(!(!((t=$e.__PosthogExtensions__)===null||t===void 0)&&t.initSessionRecording))return rr.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[fk]:!0});var a;if(this.lv||(this.lv=(a=$e.__PosthogExtensions__)===null||a===void 0?void 0:a.initSessionRecording(this._instance,this.Xe),this.lv._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.wv())return this.uv==="missing_config"||this.uv==="awaiting_config"?void 0:(this.uv="awaiting_config",rr.info("persisted remote config is stale, requesting fresh config before starting"),void new Fk(this._instance).load());this.uv=s5,(n=(i=this.lv).setDocumentWasEverVisible)===null||n===void 0||n.call(i,this.Xe),this.lv.start(e)}else this.uv=Pg}onRRwebEmit(e){var t,n;(t=this.lv)===null||t===void 0||(n=t.onRRwebEmit)===null||n===void 0||n.call(t,e)}overrideLinkedFlag(){var e,t;this.lv||(t=this.El)===null||t===void 0||t.register({$replay_override_linked_flag:!0}),(e=this.lv)===null||e===void 0||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.lv||(t=this.El)===null||t===void 0||t.register({$replay_override_sampling:!0}),(e=this.lv)===null||e===void 0||e.overrideSampling()}overrideTrigger(e){var t,n;this.lv||(n=this.El)===null||n===void 0||n.register({[e==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(t=this.lv)===null||t===void 0||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.lv)===null||e===void 0?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var n;return!!(!((n=this.lv)===null||n===void 0)&&n.tryAddCustomEvent(e,t))}flushBeforeIdentityReset(){var e,t;(e=this.lv)===null||e===void 0||(t=e.flushBeforeIdentityReset)===null||t===void 0||t.call(e)}}},OM={autocapture:class extends aM{constructor(e){super(new lM(e)),this.instance=e}},historyAutocapture:class{constructor(e){this.Sv=!1,this._instance=e,this.xv=this.Cv()}initialize(){this.startIfEnabled()}get isEnabled(){const e=this.$v();return!!(e.path||e.search||this.Tv(e))}startIfEnabled(){this.isEnabled&&(ye.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.xv=this.Cv(),this.startIfEnabled()}stop(){this.Iv&&this.Iv(),this.Iv=void 0,this.Mv&&this.Mv(),this.Mv=void 0,ye.info("History API monitoring stopped")}monitorHistoryChanges(){te&&te.history&&(this.Ev("pushState"),this.Ev("replaceState"),this.Pv(),this.Tv()&&this.Rv())}Ev(e){var t;if(!te||!((t=te.history[e])===null||t===void 0)&&t.__posthog_wrapped__)return;const n=this;Nu(te.history,e,i=>function(a,o,u){var h;n.Av(u)&&n.Fv(),i.call(this,a,o,u),n.Ov(e,!n.Sv&&(te==null||(h=te.event)===null||h===void 0?void 0:h.type)!=="popstate")})}Cv(){const e=te==null?void 0:te.location;if(e!=null&&e.pathname)return{pathname:e.pathname,search:e.search,hash:e.hash}}$v(){const e=this._instance.config.capture_pageview;return e==="history_change"?{path:!0}:st(e)?e:{}}Tv(e=this.$v()){return!!e.hash&&!this._instance.config.disable_capture_url_hashes}Dv(e){const t=this.$v(),n=this.xv;return!(!n||!(t.path&&e.pathname!==n.pathname||t.search&&e.search!==n.search||this.Tv(t)&&e.hash!==n.hash))}Ov(e,t=!1){try{t||this.Fv();const n=this.Cv();if(!n)return;if(this.Dv(n)){const i=()=>this._instance.capture(Tx,{navigation_type:e});t?(this.Lv=i,Promise.resolve().then(()=>this.Fv())):i()}this.xv=n}catch(n){ye.error(`Error capturing ${e} pageview`,n)}}Av(e){var t,n;return!(qe(e)||!te)&&((t=mr(String(e)))===null||t===void 0?void 0:t.href)!==((n=te.location)===null||n===void 0?void 0:n.href)}Fv(){const e=this.Lv;if(e){this.Lv=void 0,this.Sv=!0;try{e()}catch(t){ye.error("Error capturing deferred pageview",t)}finally{this.Sv=!1}this.xv=this.Cv()}}Pv(){if(this.Iv)return;const e=()=>{this.Ov("popstate")};xt(te,"popstate",e),this.Iv=()=>{te&&te.removeEventListener("popstate",e)}}Rv(){if(this.Mv)return;const e=()=>{this.Ov("hashchange")};xt(te,"hashchange",e),this.Mv=()=>{te&&te.removeEventListener("hashchange",e)}}},heatmaps:class{get Rr(){return this.instance.config}constructor(e){var t;this.Nv=!1,this.xo=!1,this.qv=null,this.instance=e,this.Nv=!!(!((t=this.instance.persistence)===null||t===void 0)&&t.props[M0]),this.rageclicks=new dj(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 qe(this.Rr.capture_heatmaps)?qe(this.Rr.enable_heatmaps)?this.Nv:this.Rr.enable_heatmaps:this.Rr.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.xo)return;dM.info("starting..."),this.jv(),this.ln()}else{var e;clearInterval((e=this.qv)!==null&&e!==void 0?e:void 0),this.Bv(),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.Nv=n,this.startIfEnabled()}getAndClearBuffer(){const e=this.Rt;return this.Rt=void 0,e}Hv(e){Ug(e.originalEvent)&&this.Tr(e.originalEvent,"deadclick")}ln(){this.qv&&clearInterval(this.qv),this.qv=(he==null?void 0:he.visibilityState)==="visible"?setInterval(this._l.bind(this),this.flushIntervalMilliseconds):null}jv(){te&&he&&(this.zv=this._l.bind(this),xt(te,Jh,this.zv),this.Uv=e=>this.Tr(e||(te==null?void 0:te.event)),xt(he,"click",this.Uv,{capture:!0}),this.Wv=e=>this.Vv(e||(te==null?void 0:te.event)),xt(he,"mousemove",this.Wv,{capture:!0}),this.Gv=new Mw(this.instance,pA,this.Hv.bind(this)),this.Gv.startIfEnabledOrStop(),this.Zv=this.ln.bind(this),xt(he,_u,this.Zv),this.xo=!0)}Bv(){var e;te&&he&&(this.zv&&te.removeEventListener(Jh,this.zv),this.Uv&&he.removeEventListener("click",this.Uv,{capture:!0}),this.Wv&&he.removeEventListener("mousemove",this.Wv,{capture:!0}),this.Zv&&he.removeEventListener(_u,this.Zv),clearTimeout(this.Qv),(e=this.Gv)===null||e===void 0||e.stop(),this.xo=!1)}Jv(e,t){const n=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),a=this.instance.scrollManager.scrollElement(),o=(function(u,h,f){let m=u;for(;m&&Di(m)&&!Pn(m,"body");){if(m===f)return!1;let y;try{var g,v,b;y=(g=(v=(b=m.ownerDocument)===null||b===void 0?void 0:b.defaultView)!==null&&v!==void 0?v:te)===null||g===void 0?void 0:g.getComputedStyle(m).position}catch{return!1}if(He(h,y))return!0;m=Sk(m)}return!1})(lu(e),["fixed","sticky"],a);return{x:e.clientX+(o?0:i),y:e.clientY+(o?0:n),target_fixed:o,type:t}}Tr(e,t="click"){var n;if(_w(e.target)||!Ug(e))return;const i=this.Jv(e,t);!((n=this.rageclicks)===null||n===void 0)&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&jk(lu(e),this.instance.config.rageclick)&&this.Zs(B(B({},i),{},{type:"rageclick"})),this.Zs(i)}Vv(e){!_w(e.target)&&Ug(e)&&(clearTimeout(this.Qv),this.Qv=setTimeout(()=>{this.Zs(this.Jv(e,"mousemove"))},500))}Zs(e){if(!te)return;const t=this.Rr.disable_capture_url_hashes?ua(te.location.href):te.location.href,n=this.Rr.custom_personal_data_properties,i=this.Rr.mask_personal_data_properties?[...So,...n||[]]:[],a=ku(t,i,ju);this.Rt=this.Rt||{},this.Rt[a]||(this.Rt[a]=[]),this.Rt[a].push(e)}_l(){this.Rt&&!ms(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Mw,webVitalsAutocapture:class{constructor(e){var t;this._instance=e,this.Nv=!1,this.xo=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Kv=()=>{clearTimeout(this.Xv),this.Xv=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.Yv=n=>{var i;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},qe(n==null?void 0:n.name)||qe(n==null?void 0:n.value))return void Va.error("Invalid metric received",n);const a=typeof n.navigationURL=="string"?n.navigationURL:void 0,o=this.tf(a);if(ue(o))return;const u=Jt(n.navigationId)||typeof n.navigationId=="string"?`navigation:${n.navigationId}`:`url:${o}`;if(this.ef&&n.value>=this.ef)return void Va.error("Ignoring metric with value >= "+this.ef,n);this.Rt.navigationKey!==u&&(this.Kv(),this.Xv=setTimeout(this.Kv,this.flushToCaptureTimeoutMs)),ue(this.Rt.navigationKey)&&(this.Rt.navigationKey=u,this.Rt.url=o),this.Rt.firstMetricTimestamp=ue(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;const h=(i=this._instance.sessionManager)===null||i===void 0?void 0:i.checkAndGetSessionAndWindowId(!0),f=B(B(B({},n),a?{navigationURL:o}:{}),{},{$current_url:o,timestamp:Date.now()});if(delete f.entries,st(n.attribution)&&this.attributionMetrics.indexOf(n.name)>-1){const m={};for(const g of uM){const v=g==="url"&&typeof n.attribution[g]=="string"?this.tf(n.attribution[g]):n.attribution[g];ue(v)||(m[g]=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.Kv()},this.if=()=>{if(this.xo)return;let n,i,a,o,u=!1;const h=$e.__PosthogExtensions__,f=h==null?void 0:h.postHogWebVitalsCallbacksByFlavor,m=(f==null?void 0:f[this.nf])||(this.nf==="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,o=y.indexOf("INP")>-1?m.onINP:(b==null?void 0:b.onINP)||m.onINP}if(!(n&&i&&a&&o))return void Va.error("web vitals callbacks not loaded - not starting");const g={reportSoftNavs:this.useSoftNavs},v=u&&this.attributionMetrics.indexOf("INP")>-1?B(B({},g),{},{includeProcessedEventEntries:!1}):g;this.allowedMetrics.indexOf("LCP")>-1&&n(this.Yv.bind(this),g),this.allowedMetrics.indexOf("CLS")>-1&&i(this.Yv.bind(this),g),this.allowedMetrics.indexOf("FCP")>-1&&a(this.Yv.bind(this),g),this.allowedMetrics.indexOf("INP")>-1&&o(this.Yv.bind(this),v),this.xo=!0},this.Nv=!!(!((t=this._instance.persistence)===null||t===void 0)&&t.props[L0]),this.startIfEnabled()}get sf(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t;const n=st(this.sf)?(e=this.sf)===null||e===void 0?void 0:e.web_vitals_allowed_metrics:void 0;return qe(n)?((t=this._instance.persistence)===null||t===void 0?void 0:t.props.$web_vitals_allowed_metrics)||n5:n}get flushToCaptureTimeoutMs(){return(st(this.sf)?this.sf.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const e=st(this.sf)?this.sf.web_vitals_attribution:void 0;return ns(e)?e?n5:[]:Ue(e)?e:cM}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const e=st(this.sf)?this.sf.__preview_web_vitals_soft_navs:void 0;return e!=null&&e}get ef(){const e=st(this.sf)&&Jt(this.sf.__web_vitals_max_value)?this.sf.__web_vitals_max_value:t5;return e>0&&6e4>=e?t5: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.sf)?this.sf.web_vitals:ns(this.sf)?this.sf:void 0;return ns(t)?t:this.Nv}startIfEnabled(){this.isEnabled&&!this.xo&&(Va.info("enabled, starting..."),this.Uo(this.if))}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({[nk]:i})),this.Nv=n,this.startIfEnabled()}get nf(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}Uo(e){var t;const n=$e.__PosthogExtensions__,i=this.nf,a=n==null?void 0:n.postHogWebVitalsCallbacksByFlavor;a!=null&&a[i]||i==="web-vitals"&&ue(a)&&(n!=null&&n.postHogWebVitalsCallbacks)?e():n==null||(t=n.loadExternalDependency)===null||t===void 0||t.call(n,this._instance,i,o=>{o?Va.error("failed to load script",o):e()})}tf(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?ua(t):t,i=this._instance.config.custom_personal_data_properties,a=this._instance.config.mask_personal_data_properties?[...So,...i||[]]:[];return ku(n,a,ju)}}},LM={exceptionObserver:class{constructor(e){var t;this.if=()=>{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,o=$e.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.rf&&this.Rr.capture_unhandled_errors&&(this.rf=i(this.captureException.bind(this))),!this.af&&this.Rr.capture_unhandled_rejections&&(this.af=a(this.captureException.bind(this))),!this.lf&&this.Rr.capture_console_errors&&(this.lf=o(this.captureException.bind(this)))}catch(u){Hc.error("failed to start",u),this.uf()}},this._instance=e,this.hf=!!(!((t=this._instance.persistence)===null||t===void 0)&&t.props[R0]),this.wt=new CT(B(B({},(function(n={}){var i,a,o,u;return{refillRate:(i=(a=n.exceptionRateLimiterRefillRate)!==null&&a!==void 0?a:n.__exceptionRateLimiterRefillRate)!==null&&i!==void 0?i:1,bucketSize:(o=(u=n.exceptionRateLimiterBucketSize)!==null&&u!==void 0?u:n.__exceptionRateLimiterBucketSize)!==null&&o!==void 0?o:10}})(this._instance.config.error_tracking)),{},{refillInterval:1e4,$:Hc})),this.Rr=this.cf(),this.startIfEnabledOrStop()}cf(){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.hf: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?(Hc.info("enabled"),this.uf(),this.Uo(this.if)):this.uf()}Uo(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 Hc.error("failed to load script",a);e()})}uf(){var e,t,n;(e=this.rf)===null||e===void 0||e.call(this),this.rf=void 0,(t=this.af)===null||t===void 0||t.call(this),this.af=void 0,(n=this.lf)===null||n===void 0||n.call(this),this.lf=void 0}onRemoteConfig(e){if(!e.ok)return;const t=e.config;"autocaptureExceptions"in t&&(this.hf=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[R0]:this.hf}),this.Rr=this.cf(),this.startIfEnabledOrStop())}onConfigChange(){this.Rr=this.cf()}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 Hc.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.df=[],this.vf=new PT([new e6,new c6,new n6,new t6,new l6,new a6,new i6,new o6],(function(i,...a){return(o,u=0)=>{const h=[],f=o.split(`
|
|
68
|
-
`),m=Math.min(f.length,u+1e3),g=[];for(let y=u;m>y;y++){const _=f[y];if(_.length>1024)continue;const j=sw.test(_)?_.replace(sw,"$1"):_;if(!j.match(/\S*Error: /)){for(const N of a){const w=N(j,i);if(w){h.push(w);const C=WT(h);if(C){for(let E=g.length-1;E>=0;E--){const R=g[E];if(C.start>=R.start+R.length)break;g.pop()}g.push(C)}break}}if(ZT(h,g)>=50)break}}const v=[...g].sort((y,_)=>_.start-y.start),b=v[v.length-1];if(b){const y=BS(h,b);h.splice(b.start-y,y);for(const _ of v)_.start-=y}for(const y of v)KT(h,y);return g.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++)JT(_,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",GT,XT)),this._instance=e,this.df=(t=(n=this._instance.persistence)===null||n===void 0?void 0:n.get_property("$error_tracking_suppression_rules"))!==null&&t!==void 0?t:[],this.ff=Qh(this.pf()),this.gf=new d6(this.ff)}onConfigChange(){this.ff=Qh(this.pf()),this.gf.setConfig(this.ff)}onRemoteConfig(e){var t,n,i;if(!e.ok)return;const a=e.config;if(!("errorTracking"in a))return;const o=(t=(n=a.errorTracking)===null||n===void 0?void 0:n.suppressionRules)!==null&&t!==void 0?t:[],u=(i=a.errorTracking)===null||i===void 0?void 0:i.captureExtensionExceptions;this.df=o,this._instance.persistence&&this._instance.persistence.register({[ek]:this.df,[O0]:u})}get mf(){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.vf.buildFromUnknown(e,{syntheticException:t==null?void 0:t.syntheticException,mechanism:{handled:t==null?void 0:t.handled}})}addExceptionStep(e,t){if(this.ff.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 o=[];return{sanitizedProperties:Object.keys(a).reduce((u,h)=>u6.has(h)?(o.push(h),u):(u[h]=a[h],u),{}),droppedKeys:o}})(this.yf(t));i.length>0&&li.warn("Ignoring reserved exception step fields",{droppedKeys:i}),this.gf.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.bf(t)){if(this._f(t))return this.wf("Exception dropped: matched a suppression rule"),void li.info("Skipping exception capture because a suppression rule matched");if(!this.mf&&this.kf(t))return this.wf("Exception dropped: thrown by a browser extension"),void li.info("Skipping exception capture because it was thrown by an extension");if(!this.mf&&this.Sf(t))return this.wf("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.xf(t))return this.wf("Exception dropped: thrown by the PostHog SDK"),void li.info("Skipping exception capture because it was thrown by the PostHog SDK")}const n=this.ff.enabled&&qe(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",ph:!0});return a&&this.gf.clear(),a}catch(a){return p5(a)||li.error("Failed to capture exception event. Dropping this exception.",a),void this.gf.clear()}}catch(t){return void(p5(t)||li.error("Failed to process exception event. Ignoring this exception.",t))}}Cf(e){try{const t=this.gf.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}}wf(e){this.ff.enabled&&this.gf.add({[Gh]:e,[Yh]:new Date().toISOString()})}yf(e){return st(e)?B({},e):{}}pf(){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:{}}_f(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.df.some(n=>{const i=n.values.map(a=>{const o=lj[a.operator],u=t[a.key];if(!o||!u)return!1;const h=Ue(a.value)?a.value:[a.value];return h.length>0&&o(h,u)});return n.type==="OR"?i.some(Boolean):i.every(Boolean)})}catch(t){return li.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}kf(e){const t=e.flatMap(i=>{var a,o;return(a=(o=i.stacktrace)===null||o===void 0?void 0:o.frames)!==null&&a!==void 0?a:[]}),n=t.filter(({filename:i})=>!!i&&SM.some(a=>i.startsWith(a)));return n.length!==0&&(!n.every(({filename:i})=>!!i&&i.startsWith(X0))||e.some(({type:i,value:a})=>i==="NoResponse"||Je(a)&&wM.some(({value:o,exact:u})=>u?a===o:a.includes(o)))&&!t.some(({in_app:i,filename:a})=>i&&!(a!=null&&a.startsWith(X0))))}Sf(e){return e.some(({value:t})=>Je(t)&&kM.some(n=>t.includes(n)))}xf(e){if(e.length>0){var t,n,i,a;const o=(t=(n=e[0].stacktrace)===null||n===void 0?void 0:n.frames)!==null&&t!==void 0?t:[],u=o[o.length-1];return(i=u==null||(a=u.filename)===null||a===void 0?void 0:a.includes("posthog.com/static"))!==null&&i!==void 0&&i}return!1}bf(e){return!qe(e)&&Ue(e)}}},DM=B({productTours:class{get El(){return this._instance.persistence}constructor(e){this.$f=null,this.Tf=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.El&&this.El.register({[Nx]:!!t.productTours}),!Fg(this._instance))return!this.$f&&qe((n=this.El)===null||n===void 0?void 0:n.props.ph_product_tours)||gh.info("product tours disabled; stopping and clearing cached tours"),(i=this.$f)===null||i===void 0||i.stop(),this.$f=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.$f&&Fg(this._instance)&&this.Uo(()=>this.If())}Uo(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()})}If(){var e;!this.$f&&(!((e=$e.__PosthogExtensions__)===null||e===void 0)&&e.generateProductTours)&&(this.$f=$e.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t=!1){if(Ue(this.Tf)&&!t)return void e(this.Tf,{isLoaded:!0});const n=this.El;if(n){const i=n.props[z0];if(Ue(i)&&!t)return this.Tf=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 o=Ue(i.json.product_tours)?i.json.product_tours:[];this.Tf=o,n&&n.register({[z0]:o}),e(o,{isLoaded:!0})}})}getActiveProductTours(e){qe(this.$f)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.$f.getActiveProductTours(e)}showProductTour(e){var t;(t=this.$f)===null||t===void 0||t.showTourById(e)}previewTour(e){this.$f?this.$f.previewTour(e):this.Uo(()=>{var t;this.If(),(t=this.$f)===null||t===void 0||t.previewTour(e)})}dismissProductTour(){var e;(e=this.$f)===null||e===void 0||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.$f)===null||e===void 0||e.nextStep()}previousStep(){var e;(e=this.$f)===null||e===void 0||e.previousStep()}clearCache(){var e;this.Tf=null,(e=this.El)===null||e===void 0||e.unregister("ph_product_tours")}resetTour(e){var t;(t=this.$f)===null||t===void 0||t.resetTour(e)}resetAllTours(){var e;(e=this.$f)===null||e===void 0||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.$f)===null||t===void 0||t.cancelPendingTour(e)}}},wf),zM={siteApps:class{constructor(e){this._instance=e,this.Mf=0,this.Ef=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Pf(e,t){if(!t)return;const n=this.globalsForEvent(t);this.Ef.push(n),this.Ef.length>1e3&&(this.Ef=this.Ef.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.Pf.bind(this));this.Rf=()=>{e(),this.Ef=[],this.Rf=void 0}}}globalsForEvent(e){var t,n,i,a,o,u,h;if(!e)throw new Error("Event payload is required");const f={},m=this._instance.get_property("$groups")||[],g=this._instance.get_property("$stored_group_properties")||{};for(const[y,_]of Object.entries(g))f[y]={id:m[y],type:y,properties:_};const{$set_once:v,$set:b}=e;return{event:B(B({},IS(e,hM)),{},{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:(o=(u=e.properties)===null||u===void 0?void 0:u.$elements_chain)!==null&&o!==void 0?o:"",distinct_id:(h=e.properties)===null||h===void 0?void 0:h.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:f}}Af(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)||(Ei.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)||(Ei.error("prepare_external_dependency_script returned null"),null):e}Ff(){var e,t,n,i,a,o,u,h;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};const f=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.Mf++,this.Of)return this.Df();const g=[],v=this,b=new WeakSet,y=(N,w,C)=>{if(!(N!=null&&N[w]))return;const E=N[w];N[w]=C(E),g.push(()=>{N[w]=E})},_=N=>{if(b.has(N))return N;const w=v.Af(N);return w&&b.add(w),w},j=N=>N.map(w=>typeof w=="string"?w:_(w)).filter(w=>!Qt(w));return y(m,"appendChild",N=>function(w){const C=_(w);return C?N.call(this,C):w}),y(m,"insertBefore",N=>function(w,C){const E=_(w);return E?N.call(this,E,C):w}),y(m,"replaceChild",N=>function(w,C){const E=_(w);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",w=>function(...C){return w.apply(this,j(C))}),y(N,"prepend",w=>function(...C){return w.apply(this,j(C))})}),[(a=f.Element)===null||a===void 0?void 0:a.prototype,(o=f.CharacterData)===null||o===void 0?void 0:o.prototype,(u=f.DocumentType)===null||u===void 0?void 0:u.prototype].forEach(N=>{y(N,"before",w=>function(...C){return w.apply(this,j(C))}),y(N,"after",w=>function(...C){return w.apply(this,j(C))}),y(N,"replaceWith",w=>function(...C){const E=j(C);return C.length&&!E.length?void 0:w.apply(this,E)})}),y((h=f.Element)===null||h===void 0?void 0:h.prototype,"insertAdjacentElement",N=>function(w,C){const E=_(C);return E?N.call(this,w,E):null}),this.Of=()=>{g.forEach(N=>N()),this.Of=void 0},this.Df()}Df(){let e=!1;return()=>{var t;e||(e=!0,this.Mf--,this.Mf===0&&((t=this.Of)===null||t===void 0||t.call(this)))}}Lf(e,t=!0){const n=this.Ff();try{const i=e(n);return t&&n(),i}catch(i){throw n(),i}}setupSiteApp(e){const t=this.apps[e.id],n=()=>{var o;!t.errored&&this.Ef.length&&(Ei.info(`Processing ${this.Ef.length} events for site app with id ${e.id}`),this.Ef.forEach(u=>this.Lf(()=>{var h;return(h=t.processEvent)===null||h===void 0?void 0:h.call(t,u)})),t.processedBuffer=!0),Object.values(this.apps).every(u=>u.processedBuffer||u.errored)&&((o=this.Rf)===null||o===void 0||o.call(this))};let i=!1;const a=o=>{t.errored=!o,t.loaded=!0,Ei.info(`Site app with id ${e.id} ${o?"loaded":"errored"}`),i&&n()};try{const{processEvent:o}=this.Lf(u=>e.init({posthog:this._instance,callback(h){u(),a(h)}}),!1);o&&(t.processEvent=o),i=!0}catch(o){Ei.error(i5+e.id,o),a(!1)}if(i&&t.loaded)try{n()}catch(o){Ei.error(`Error while processing buffered events PostHog app with config id ${e.id}`,o),t.errored=!0}}Nf(){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)}qf(e){if(Object.keys(this.apps).length===0)return;const t=this.globalsForEvent(e);for(const n of Object.values(this.apps))try{this.Lf(()=>{var i;return(i=n.processEvent)===null||i===void 0?void 0:i.call(n,t)})}catch(i){Ei.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.Nf(),void this._instance.on("eventCaptured",h=>this.qf(h))):void Ei.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.Rf)===null||n===void 0||n.call(this),!e.ok)return;const a=e.config;if(!((i=a.siteApps)===null||i===void 0)&&i.length)if(this.isEnabled)for(const{id:h,url:f}of a.siteApps){var o,u;$e[`__$$ph_site_app_${h}`]=this._instance,(o=$e.__PosthogExtensions__)===null||o===void 0||(u=o.loadSiteApp)===null||u===void 0||u.call(o,this._instance,f,m=>{if(m)return Ei.error(i5+h,m)})}else Ei.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},$M={tracingHeaders:class{constructor(e){this._instance=e,this.jf=void 0,this.Bf=void 0,this.Hf=void 0,this.if=()=>{const t=this.zf();var n,i;t?(ue(this.jf)&&(this.jf=(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.Bf)&&(this.Bf=(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.uf()}}initialize(){this.startIfEnabledOrStop()}Uo(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 oM.error("failed to load script",a);e()})}Uf(){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}zf(){const e=this.Uf();return Ue(e)?(Ue(this.Hf)?this.Hf.splice(0,this.Hf.length,...e):this.Hf=[...e],e.length>0?this.Hf:void 0):(Ue(this.Hf)&&this.Hf.splice(0),this.Hf=e||void 0,this.Hf)}uf(){var e,t;(e=this.jf)===null||e===void 0||e.call(this),(t=this.Bf)===null||t===void 0||t.call(this),this.jf=void 0,this.Bf=void 0}startIfEnabledOrStop(){this.zf()?this.Uo(this.if):this.uf()}}},BM=B({surveys:class extends fM{constructor(e){var t;super(new vM(e),(t=e,{get projectToken(){return t.config.token},kv:new xM(t)})),this._instance=e}Gh(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),PM={toolbar:class{constructor(e){this.instance=e}Wf(e){$e.ph_toolbar_state=e}Vf(){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(B0(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 o=bM||tf(e.hash,"__posthog")||tf(e.hash,"state");let u;const h=o?J_(()=>JSON.parse(atob(decodeURIComponent(o))))||J_(()=>JSON.parse(decodeURIComponent(o))):null;return h&&h.action==="ph_authorize"?(u=h,u.source="url",u&&Object.keys(u).length>0&&(h.desiredHash?e.hash=h.desiredHash:n?n.replaceState(n.state,"",e.pathname+e.search):e.hash="")):(u=JSON.parse(t.getItem(a5)||"{}"),u.source="localstorage",delete u.userIntent),!(!u.token||this.instance.config.token!==u.token||(this.loadToolbar(u),0))}catch{return!1}}Gf(e){const t=$e.ph_load_toolbar||$e.ph_load_editor;!qe(t)&&kn(t)?t(e,this.instance):l5.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(a5,JSON.stringify(B(B({},i),{},{source:void 0}))),this.Vf()===2)this.Gf(i);else if(this.Vf()===0){var a,o;this.Wf(1),(a=$e.__PosthogExtensions__)===null||a===void 0||(o=a.loadExternalDependency)===null||o===void 0||o.call(a,this.instance,"toolbar",u=>{if(u)return l5.error("[Toolbar] Failed to load",u),void this.Wf(0);this.Wf(2),this.Gf(i)}),xt(te,"turbolinks:load",()=>{this.Wf(0),this.loadToolbar(i)})}return!0}Zf(e){return this.loadToolbar(e)}maybeLoadEditor(e=void 0,t=void 0,n=void 0){return this.maybeLoadToolbar(e,t,n)}}},UM=B({experiments:class Jn{get Rr(){return this._instance.config}constructor(t){this._instance=t,this.getWebExperimentsAndEvaluateDisplayLogic=(n=!1)=>{this.getWebExperiments(i=>{Jn.Qf("retrieved web experiments from the server"),this.Jf=new Map,i.forEach(a=>{if(a.feature_flag_key){var o;this.Jf&&(Jn.Qf("setting flag key ",a.feature_flag_key," to web experiment ",a),(o=this.Jf)===null||o===void 0||o.set(a.feature_flag_key,a));const u=this._instance.getFeatureFlag(a.feature_flag_key);Je(u)&&a.variants[u]&&this.Kf(a.name,u,a.variants[u].transforms)}else if(a.variants)for(const u in a.variants){const h=a.variants[u];Jn.Xf(h,this._instance)&&this.Kf(a.name,u,h.transforms)}})},n)},this._instance.onFeatureFlags(n=>{this.onFeatureFlags(n)})}initialize(){}onFeatureFlags(t){if(this._is_bot())Jn.Qf(m5);else if(!this.Rr.disable_web_experiments){if(qe(this.Jf))return this.Jf=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Jn.Qf("applying feature flags",t),t.forEach(n=>{var i;if(this.Jf&&(!((i=this.Jf)===null||i===void 0)&&i.has(n))){var a;const o=this._instance.getFeatureFlag(n),u=(a=this.Jf)===null||a===void 0?void 0:a.get(n);o&&(u!=null&&u.variants[o])&&this.Kf(u.name,o,u.variants[o].transforms)}})}}previewWebExperiment(){const t=Jn.getWindowLocation();if(t!=null&&t.search){const n=wo(t==null?void 0:t.search,"__experiment_id"),i=wo(t==null?void 0:t.search,"__experiment_variant");n&&i&&(Jn.Qf(`previewing web experiments ${n} && ${i}`),this.getWebExperiments(a=>{this.Yf(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:o=>t(o.statusCode===200&&o.json&&o.json.experiments||[])})}Yf(t,n,i){const a=i.filter(o=>o.id===t);a&&a.length>0&&(Jn.Qf(`Previewing web experiment [${a[0].name}] with variant [${n}]`),this.Kf(a[0].name,n,a[0].variants[n].transforms))}static Xf(t,n){return!qe(t.conditions)&&Jn.tp(t,n)&&Jn.ep(t)}static tp(t,n){var i;if(qe(t.conditions)||qe((i=t.conditions)===null||i===void 0?void 0:i.url))return!0;const a=Jn.getWindowLocation();if(a){var o,u,h;const f=yk(n,a.href);return!(!((o=t.conditions)===null||o===void 0)&&o.url)||jM[(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 ep(t){var n;if(qe(t.conditions)||qe((n=t.conditions)===null||n===void 0?void 0:n.utm))return!0;const i=Rk();if(i.utm_source){var a,o,u,h,f,m,g,v;const b=!(!((a=t.conditions)===null||a===void 0||(a=a.utm)===null||a===void 0)&&a.utm_campaign)||((o=t.conditions)===null||o===void 0||(o=o.utm)===null||o===void 0?void 0:o.utm_campaign)==i.utm_campaign,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=!(!((g=t.conditions)===null||g===void 0||(g=g.utm)===null||g===void 0)&&g.utm_term)||((v=t.conditions)===null||v===void 0||(v=v.utm)===null||v===void 0?void 0:v.utm_term)==i.utm_term;return b&&_&&j&&y}return!1}static Qf(t,...n){ye.info(`[WebExperiments] ${t}`,n)}Kf(t,n,i){this._is_bot()?Jn.Qf(m5):n!=="control"?i.forEach(a=>{if(a.selector){var o;Jn.Qf(`applying transform of variant ${n} for experiment ${t} `,a);const u=(o=document)===null||o===void 0?void 0:o.querySelectorAll(a.selector);u==null||u.forEach(h=>{const f=h;a.html&&(f.innerHTML=a.html),a.css&&f.setAttribute("style",a.css)})}}):Jn.Qf("Control variants leave the page unmodified.")}_is_bot(){return jn&&this._instance?ij(jn,this.Rr.custom_blocked_useragents):void 0}}},wf),FM={conversations:class{constructor(e){this._instance=e,this.np=void 0,this._conversationsManager=null,this.sp=!1,this.ne=null,this.rp=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(this._instance.config.disable_conversations||(this.op=e.ok,!e.ok))return;const t=e.config.conversations;qe(t)||(ns(t)?this.np=t:(this.np=t.enabled,this.ne=t),this.loadIfEnabled())}reset(){var e;(e=this._conversationsManager)===null||e===void 0||e.reset(),this._conversationsManager=null,this.np=void 0,this.ne=null,this.op=void 0,this.rp=!1}loadIfEnabled(){if(this._conversationsManager||this.sp||this._instance.config.disable_conversations||B0(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.np)&&this.np)if(this.ne&&this.ne.token){this.sp=!0;try{const t=e.initConversations;if(t)return this.ap(t),void(this.sp=!1);const n=e.loadExternalDependency;if(!n)return void this.lp(Ex);n(this._instance,"conversations",i=>{i||!e.initConversations?this.lp("Could not load conversations script",i):this.ap(e.initConversations),this.sp=!1})}catch(t){this.lp("Error initializing conversations",t),this.sp=!1}}else qs.error("Conversations enabled but missing token in remote config.")}ap(e){if(this.ne)try{this._conversationsManager=e(this.ne,this._instance),this.rp=!1,qs.info("Conversations loaded successfully")}catch(t){this.lp("Error completing conversations initialization",t)}else qs.error("Cannot complete initialization: remote config is null")}lp(e,t){qs.error(e,t),this._conversationsManager=null,this.sp=!1,this.rp=!0}show(){this._conversationsManager?this._conversationsManager.show():qs.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.np===!0&&!Qt(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":B0(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":this.op===!1?"remote_config_failed":ue(this.np)?this.op?"disabled_in_project":"remote_config_pending":this.np?qe(this.ne)||!this.ne.token?"missing_token":$e!=null&&$e.__PosthogExtensions__?this.sp?"initializing":this.rp?"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}xh(){var e;(e=this._conversationsManager)===null||e===void 0||e.setIdentity()}Ch(){var e;(e=this._conversationsManager)===null||e===void 0||e.clearIdentity()}}},IM={logs:class{constructor(e){var t;this._instance=e,this.name="logs",this.up=!1,this.hp=!1,this.cp=!1,this.$=Wt("[logs]"),this.dp=B(B({},this.$),{},{error:(...n)=>{n.some(v5)||this.$.error(...n)}}),this.ll=[],this.vp=[],this.wd=0,this.Mo=!1,this.fp=[],this.pp=[],this.gp=!1,this.mp=!1,this.yp=()=>{var n,i;this.Mo||(this.wd=0,(n=this.bp)===null||n===void 0||n.onReconnect(),(i=this._p)===null||i===void 0||i.onReconnect())},this._instance&&(!((t=this._instance.config.logs)===null||t===void 0)&&t.captureConsoleLogs)&&(this.up=!0),te&&xt(te,"online",this.yp)}wp(e,t,n,i){var a;const o=g5((a=this._instance)===null||a===void 0||(a=a.config)===null||a===void 0?void 0:a.logs,n);return[new _6(this.kp(e,t),o,this.dp,()=>this.Sp(),u=>u(),void 0,i),o]}xp(){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.bp&&this.Cp===t||((n=this.bp)===null||n===void 0||n.reset(),this.Cp=t,[this.bp,this.$p]=this.wp(()=>this.ll,i=>{this.ll=i})),this.bp}Tp(){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._p&&this.Ip===t||((n=this._p)===null||n===void 0||n.reset(),this.Ip=t,[this._p,this.Mp]=this.wp(()=>this.vp,i=>{this.vp=i},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},x5)),this._p}setup(e){var t;if(this.Mo)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.up=!0),(this.up||this.Ep()&&this.Pp())&&this.Rp();let n=!1;const i=e.onRemoteConfig(a=>{var o;n=a.ok&&((o=a.config.logs)===null||o===void 0?void 0:o.captureConsoleLogs)===!0,this.onRemoteConfig(a)});this.Mo?i.dispose():(this.Ro=i,n||this.loadIfEnabled())}dispose(){var e,t,n,i;this.Mo||(this.Mo=!0,this.Ap(),(e=this.Ro)===null||e===void 0||e.dispose(),this.Ro=void 0,this.wo=void 0,this.cp=!1,te==null||te.removeEventListener("online",this.yp),(t=this.Fp)===null||t===void 0||t.call(this),this.Fp=void 0,(n=this.bp)===null||n===void 0||n.reset(),(i=this._p)===null||i===void 0||i.reset())}onRemoteConfig(e){var t,n;if(this.Mo)return;const i=e.ok?(t=e.config.logs)===null||t===void 0?void 0:t.captureConsoleLogs:void 0;qe(i)?this.Op():((n=this._instance)===null||n===void 0||(n=n.persistence)===null||n===void 0||n.register({$logs_capture_enabled_server_side:!!i}),i?(this.up=!0,this.hp||this.Rp(),this.loadIfEnabled()):this.Op())}reset(){var e,t,n,i;this.Ap(),(e=this.bp)===null||e===void 0||e.clearQueue(),this.ll=[],(t=this.bp)===null||t===void 0||t.reset(),(n=this._p)===null||n===void 0||n.clearQueue(),this.vp=[],(i=this._p)===null||i===void 0||i.reset(),this.wd=0}captureLog(e){this.Mo||this.xp().captureLog(e)}captureConsoleLog(e){this.Mo||this.Tp().captureLog(e)}captureBufferedConsoleLog(e,t,n){this.Mo||this.Tp().captureLog(e,{context:t,occurredAtMs:n})}Pp(){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[tk])}Ep(){var e,t,n;return!(!((e=this._instance)===null||e===void 0||(t=e.sl)===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)}Th(){var e;this.Ap(),(e=this._p)===null||e===void 0||e.clearQueue(),this.vp=[]}Op(){this.up||this.Ap()}Rp(){var e;if(this.gp||!($e!=null&&$e.console))return;const t=g5((e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.logs).maxBufferSize;let n=!0;this.pp.push(()=>{n=!1});for(const i of NM){let a;try{a=CM($e.console[i])}catch{continue}a&&this.pp.push(Nu($e.console,i,o=>{const u=(...h)=>{try{n&&this.Dp(i,h,t)}catch{}return o.apply($e.console,h)};return u.__rrweb_original__=a,u}))}this.gp=!0,this.Lp=setTimeout(()=>{this.Ap()},3e4)}Dp(e,t,n){var i;if(this.gp&&!this.mp&&t.length!==0)if(!((i=this._instance)===null||i===void 0)&&i.is_capturing()){if(n>this.fp.length){this.mp=!0;try{this.fp.push({level:e,args:t,occurredAtMs:Date.now(),context:this.Sp()})}finally{this.mp=!1}}}else this.Ap()}Ap(){if(this.fp=[],this.gp){this.gp=!1,this.Lp&&(clearTimeout(this.Lp),this.Lp=void 0);for(const e of this.pp)e();this.pp=[]}}Np(){const e=this.fp;return this.Ap(),e}get logger(){return this.qp||(this.qp={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.qp}flushLogs(e){e?this.jp(e):(this.bp&&this.bp.flush().catch(t=>this.Bp(t)),this._p&&this._p.flush().catch(t=>this.Bp(t)))}Bp(e){v5(e)||this.$.error("PostHog logs flush failed:",e)}loadIfEnabled(){if(this.Mo||!this.up||this.hp||this.cp)return;const e=$e==null?void 0:$e.__PosthogExtensions__;if(!e)return this.$.error("PostHog Extensions not found."),void this.Ap();const t=e.loadExternalDependency;if(!t)return this.$.error(Ex),void this.Ap();this.cp=!0;try{t(this._instance,"logs",n=>{if(this.cp=!1,this.Mo||!this.up)return;const i=e.logs;if(n||!(i!=null&&i.initializeLogs))this.$.error("Could not load logs script",n),this.Ap();else{var a;const h=this.Np();var o,u;this.Fp=i.initializeLogs((a=this.wo)!==null&&a!==void 0?a:this._instance),this.hp=!0,h.length>0&&((o=i.replayConsoleBuffer)===null||o===void 0||o.call(i,(u=this.wo)!==null&&u!==void 0?u:this._instance,h))}})}catch(n){throw this.cp=!1,n}}kp(e,t){const n=this._instance;return{get isDisabled(){return!1},get optedOut(){return!n.is_capturing()},getPersistedProperty:i=>i===Mi.LogsQueue?e():void 0,setPersistedProperty(i,a){var o;i===Mi.LogsQueue&&t((o=a)!==null&&o!==void 0?o:[])},js:i=>this.js(i),getLibraryId:()=>yn.LIB_NAME,getLibraryVersion:()=>yn.LIB_VERSION}}js(e){return new Promise(t=>{if(Ak(this.wd,3))return void t({kind:"fatal",error:Hg(void 0,"logs endpoint is unreachable, dropping batch")});let n=!1;const i=o=>{n||(n=!0,clearTimeout(a),t(o))},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.Hp(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:o=>{const u=o.statusCode;if(this.zp(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?(o.error||this.$.warn("Logs request failed before receiving an HTTP response"),i({kind:"retry-later",error:Hg(o.error,"logs request failed before receiving an HTTP response")})):i({kind:"retry-later",error:(h=o.error)!==null&&h!==void 0?h:new Error(`logs request failed with status ${u}`)})}}})})}zp(e){(e!==0||this._instance.__loaded)&&(this.wd=Mk(e,this.wd,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.")))}jp(e){this.ll.length>0&&this.Up(e,this.ll,this.$p,yn.LIB_NAME,t=>{this.ll=t}),this.vp.length>0&&this.Up(e,this.vp,this.Mp,x5,t=>{this.vp=t})}Up(e,t,n,i,a){if(t.length===0)return;const o=t.map(h=>h.record);a([]);const u=QS(o,YS(n,yn.LIB_NAME,yn.LIB_VERSION),i,yn.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Hp(),data:u,compression:"best-available",batchKey:"logs",transport:e})}Hp(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}Sp(){var e;const t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){const{sessionId:n,windowId:i,sessionStartTimestamp:a,lastActivityTimestamp:o}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=n,t.windowId=i,qe(a)||(t.sessionStartTimestamp=a),qe(o)||(t.lastActivityTimestamp=o)}if(!($e==null||(e=$e.location)===null||e===void 0)&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?ua($e.location.href):$e.location.href),this._instance.featureFlags){const n=this._instance.featureFlags.getFlags();n&&n.length>0&&(t.activeFeatureFlags=n)}return t}}},HM={metrics:class{constructor(e){this._instance=e,this.$=Wt("[metrics]"),this.Mo=!1}initialize(){this.onConfigChange()}onConfigChange(){var e;if(this.Mo)return;const t=!!(!((e=this._instance.config.metrics)===null||e===void 0)&&e.network);t&&!this.Wp?this.Wp=(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,o=AM(n,a),u=MM(n,a);return()=>{i=!1,o(),u()}})(this._instance):!t&&this.Wp&&(this.Wp(),this.Wp=void 0)}xp(){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.bp&&this.Cp===t||((n=this.bp)===null||n===void 0||n.reset(),this.Cp=t,this.bp=new w6(this.kp(),(function(i){var a,o,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:(o=m==null?void 0:m["service.version"])!==null&&o!==void 0?o: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.bp}count(e,t=1,n){this.xp().count(e,t,n)}gauge(e,t,n){this.xp().gauge(e,t,n)}histogram(e,t,n){this.xp().histogram(e,t,n)}flush(e){if(!this.bp)return Promise.resolve();if(e){const t=this.bp.drainWindow();return t&&this.Ys(t,e),Promise.resolve()}return this.bp.flush().catch(t=>this.$.error("PostHog metrics flush failed:",t))}reset(){var e;(e=this.bp)===null||e===void 0||e.reset()}dispose(){var e,t;this.Mo=!0,(e=this.Wp)===null||e===void 0||e.call(this),this.Wp=void 0,(t=this.bp)===null||t===void 0||t.reset()}kp(){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(o),n(u))},o=setTimeout(()=>a({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(B(B({method:"POST",url:this.Vp(),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}`)})}}}))})}Vp(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}};hu.__defaultExtensionClasses=B({},B(B(B(B(B(B(B(B(B(B(B(B(B({},wf),RM),OM),LM),DM),zM),BM),$M),PM),UM),FM),IM),HM));const qM=(function(){yn.SDK_DIST_CHANNEL="npm";const e=uu[Kc]=new hu;return(function(){function t(){t.done||(t.done=!0,nj=!1,kt(uu,function(n){n._dom_loaded()}))}he!=null&&he.addEventListener?he.readyState==="complete"?t():xt(he,"DOMContentLoaded",t,{capture:!1}):te&&ye.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),e})();var Cu=qM;const VM="https://us.i.posthog.com",gj="cc-telemetry-enabled";let K0=!1,Eu=!1;function GM(){return VM}function YM(){if(typeof localStorage>"u")return!0;const e=localStorage.getItem(gj);return e===null?!0:e==="true"}function xj(e){K0&&(e?(Cu.opt_in_capturing({captureEventName:null}),Eu=!0):(Cu.opt_out_capturing(),Eu=!1))}function aP(e){typeof localStorage<"u"&&localStorage.setItem(gj,String(e)),xj(e)}function QM(){const e=void 0;return e?(Cu.init(e,{api_host:GM(),defaults:"2026-01-30",capture_pageview:!1,capture_pageleave:!0,capture_exceptions:!0,autocapture:!0,respect_dnt:!0}),K0=!0,xj(YM()),!0):(K0=!1,Eu=!1,!1)}function Bx(e,t){Eu&&Cu.capture(e,t)}function da(e,t){Eu&&Cu.captureException(e,t)}function XM(e){Bx("$pageview",{$current_url:e})}const zi="/api",vj="companion_auth_token";function ha(){if(typeof window>"u")return{};const e=localStorage.getItem(vj);return e?{Authorization:`Bearer ${e}`}:{}}function rl(e){e===401&&typeof window<"u"&&(localStorage.removeItem(vj),Vn(async()=>{const{useStore:t}=await Promise.resolve().then(()=>u4);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 $i(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 Fe(e,t){const n=_n();let i=!1;try{const a=await fetch(`${zi}${e}`,{method:"POST",headers:{"Content-Type":"application/json",...ha()},body:t?JSON.stringify(t):void 0});if(!a.ok){rl(a.status);const o=await a.json().catch(()=>({error:a.statusText})),u=new Error(o.error||a.statusText);throw $i("POST",e,_n()-n,u,a.status),i=!0,u}return Ru("POST",e,_n()-n,a.status),a.json()}catch(a){throw i||$i("POST",e,_n()-n,a),a}}async function Le(e){const t=_n();let n=!1;try{const i=await fetch(`${zi}${e}`,{headers:{...ha()}});if(!i.ok){rl(i.status);const a=await i.json().catch(()=>({error:i.statusText})),o=new Error(a.error||i.statusText);throw $i("GET",e,_n()-t,o,i.status),n=!0,o}return Ru("GET",e,_n()-t,i.status),i.json()}catch(i){throw n||$i("GET",e,_n()-t,i),i}}async function Vs(e,t){const n=_n();let i=!1;try{const a=await fetch(`${zi}${e}`,{method:"PUT",headers:{"Content-Type":"application/json",...ha()},body:t?JSON.stringify(t):void 0});if(!a.ok){rl(a.status);const o=await a.json().catch(()=>({error:a.statusText})),u=new Error(o.error||a.statusText);throw $i("PUT",e,_n()-n,u,a.status),i=!0,u}return Ru("PUT",e,_n()-n,a.status),a.json()}catch(a){throw i||$i("PUT",e,_n()-n,a),a}}async function WM(e,t){const n=_n();let i=!1;try{const a=await fetch(`${zi}${e}`,{method:"PATCH",headers:{"Content-Type":"application/json",...ha()},body:t?JSON.stringify(t):void 0});if(!a.ok){rl(a.status);const o=await a.json().catch(()=>({error:a.statusText})),u=new Error(o.error||a.statusText);throw $i("PATCH",e,_n()-n,u,a.status),i=!0,u}return Ru("PATCH",e,_n()-n,a.status),a.json()}catch(a){throw i||$i("PATCH",e,_n()-n,a),a}}async function Gs(e,t){const n=_n();let i=!1;try{const a=await fetch(`${zi}${e}`,{method:"DELETE",headers:{...t?{"Content-Type":"application/json"}:{},...ha()},body:t?JSON.stringify(t):void 0});if(!a.ok){rl(a.status);const o=await a.json().catch(()=>({error:a.statusText})),u=new Error(o.error||a.statusText);throw $i("DELETE",e,_n()-n,u,a.status),i=!0,u}return Ru("DELETE",e,_n()-n,a.status),a.json()}catch(a){throw i||$i("DELETE",e,_n()-n,a),a}}async function KM(e,t){const n=await fetch(`${zi}/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 o="",u=null;for(;;){const{done:h,value:f}=await i.read();if(h)break;o+=a.decode(f,{stream:!0});const m=o.split(`
|
|
69
|
-
|
|
70
|
-
`);o=m.pop()||"";for(const g of m){if(!g.trim())continue;let v="",b="";for(const _ of g.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 ZM(){try{const e=await fetch(`${zi}/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 b5(e){try{const t=await fetch(`${zi}/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 _e={getAuthQr:()=>Le("/auth/qr"),getAuthToken:()=>Le("/auth/token"),regenerateAuthToken:()=>Fe("/auth/regenerate"),createSession:e=>Fe("/sessions/create",e),listSessions:()=>Le("/sessions"),discoverClaudeSessions:(e=200)=>Le(`/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 Le(`/claude/sessions/${encodeURIComponent(e)}/history?cursor=${encodeURIComponent(String(n))}&limit=${encodeURIComponent(String(i))}`)},killSession:e=>Fe(`/sessions/${encodeURIComponent(e)}/kill`),deleteSession:e=>Gs(`/sessions/${encodeURIComponent(e)}`),relaunchSession:e=>Fe(`/sessions/${encodeURIComponent(e)}/relaunch`),exportSession:async(e,t)=>{const n=await fetch(`${zi}/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(),o=(n.headers.get("Content-Disposition")||"").match(/filename="?([^"]+)"?/),u=(o==null?void 0:o[1])||`session.${t}`;return{blob:i,filename:u}},archiveSession:(e,t)=>Fe(`/sessions/${encodeURIComponent(e)}/archive`,t),getArchiveInfo:e=>Le(`/sessions/${encodeURIComponent(e)}/archive-info`),unarchiveSession:e=>Fe(`/sessions/${encodeURIComponent(e)}/unarchive`),renameSession:(e,t)=>WM(`/sessions/${encodeURIComponent(e)}/name`,{name:t}),listDirs:e=>Le(`/fs/list${e?`?path=${encodeURIComponent(e)}`:""}`),getHome:()=>Le("/fs/home"),listEnvs:()=>Le("/envs"),getEnv:e=>Le(`/envs/${encodeURIComponent(e)}`),createEnv:(e,t)=>Fe("/envs",{name:e,variables:t}),updateEnv:(e,t)=>Vs(`/envs/${encodeURIComponent(e)}`,t),deleteEnv:e=>Gs(`/envs/${encodeURIComponent(e)}`),listSandboxes:()=>Le("/sandboxes"),getSandbox:e=>Le(`/sandboxes/${encodeURIComponent(e)}`),createSandbox:(e,t)=>Fe("/sandboxes",{name:e,...t}),updateSandbox:(e,t)=>Vs(`/sandboxes/${encodeURIComponent(e)}`,t),deleteSandbox:e=>Gs(`/sandboxes/${encodeURIComponent(e)}`),testInitScript:(e,t,n)=>Fe(`/sandboxes/${encodeURIComponent(e)}/test-init`,{cwd:t,initScript:n}),buildBaseImage:()=>Fe("/docker/build-base"),getBaseImageStatus:()=>Le("/docker/base-image"),getSettings:()=>Le("/settings"),updateSettings:e=>Vs("/settings",e),verifyAnthropicKey:e=>Fe("/settings/anthropic/verify",{apiKey:e}),getCodexAccount:()=>Le("/codex/auth/account"),getCodexLoginStatus:()=>Le("/codex/auth/login"),startCodexLogin:()=>Fe("/codex/auth/login"),cancelCodexLogin:()=>Fe("/codex/auth/login/cancel"),codexLogout:()=>Fe("/codex/auth/logout"),getClaudeAccount:()=>Le("/claude/auth/account"),getClaudeLoginStatus:()=>Le("/claude/auth/login"),startClaudeLogin:()=>Fe("/claude/auth/login"),submitClaudeLoginCode:e=>Fe("/claude/auth/login/code",{code:e}),cancelClaudeLogin:()=>Fe("/claude/auth/login/cancel"),claudeLogout:()=>Fe("/claude/auth/logout"),getDashboard:()=>Le("/dashboard"),runDashboardUpdate:()=>Fe("/dashboard/run"),getDashboardRunStatus:()=>Le("/dashboard/run/status"),getTailscaleStatus:()=>Le("/tailscale/status"),startTailscaleFunnel:()=>Fe("/tailscale/funnel/start"),stopTailscaleFunnel:()=>Fe("/tailscale/funnel/stop"),listLinearConnections:()=>Le("/linear/connections"),createLinearConnection:e=>Fe("/linear/connections",e),updateLinearConnection:(e,t)=>Vs(`/linear/connections/${encodeURIComponent(e)}`,t),deleteLinearConnection:e=>Gs(`/linear/connections/${encodeURIComponent(e)}`),verifyLinearConnection:e=>Fe(`/linear/connections/${encodeURIComponent(e)}/verify`,{}),searchLinearIssues:(e,t=8,n)=>Le(`/linear/issues?query=${encodeURIComponent(e)}&limit=${encodeURIComponent(String(t))}${n?`&connectionId=${encodeURIComponent(n)}`:""}`),getLinearConnection:e=>Le(`/linear/connection${e?`?connectionId=${encodeURIComponent(e)}`:""}`),getLinearStates:e=>Le(`/linear/states${e?`?connectionId=${encodeURIComponent(e)}`:""}`),transitionLinearIssue:(e,t)=>Fe(`/linear/issues/${encodeURIComponent(e)}/transition${t?`?connectionId=${encodeURIComponent(t)}`:""}`,{}),listLinearProjects:e=>Le(`/linear/projects${e?`?connectionId=${encodeURIComponent(e)}`:""}`),getLinearProjectIssues:(e,t=15,n)=>Le(`/linear/project-issues?projectId=${encodeURIComponent(e)}&limit=${encodeURIComponent(String(t))}${n?`&connectionId=${encodeURIComponent(n)}`:""}`),getLinearProjectMapping:e=>Le(`/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)=>Le(`/sessions/${encodeURIComponent(e)}/linear-issue${t?"?refresh=true":""}`),createLinearIssue:e=>Fe("/linear/issues",e),addLinearComment:(e,t,n)=>Fe(`/linear/issues/${encodeURIComponent(e)}/comments`,{body:t,connectionId:n}),getRepoInfo:e=>Le(`/git/repo-info?path=${encodeURIComponent(e)}`),listBranches:e=>Le(`/git/branches?repoRoot=${encodeURIComponent(e)}`),gitFetch:e=>Fe("/git/fetch",{repoRoot:e}),gitPull:e=>Fe("/git/pull",{cwd:e}),listWorktrees:e=>Le(`/git/worktrees?repoRoot=${encodeURIComponent(e)}`),createWorktree:(e,t,n)=>Fe("/git/worktree",{repoRoot:e,branch:t,...n}),removeWorktree:(e,t,n)=>Gs("/git/worktree",{repoRoot:e,worktreePath:t,force:n}),getPRStatus:(e,t)=>Le(`/git/pr-status?cwd=${encodeURIComponent(e)}&branch=${encodeURIComponent(t)}`),getBackends:()=>Le("/backends"),getBackendModels:e=>Le(`/backends/${encodeURIComponent(e)}/models`),getContainerStatus:()=>Le("/containers/status"),getContainerImages:()=>Le("/containers/images"),getImageStatus:e=>Le(`/images/${encodeURIComponent(e)}/status`),pullImage:e=>Fe(`/images/${encodeURIComponent(e)}/pull`),getCloudProviderPlan:(e,t,n)=>Le(`/cloud/providers/${encodeURIComponent(e)}/plan?cwd=${encodeURIComponent(t)}&sessionId=${encodeURIComponent(n)}`),startEditor:e=>Fe(`/sessions/${encodeURIComponent(e)}/editor/start`),startBrowser:(e,t)=>Fe(`/sessions/${encodeURIComponent(e)}/browser/start`,t?{url:t}:void 0),navigateBrowser:(e,t)=>Fe(`/sessions/${encodeURIComponent(e)}/browser/navigate`,{url:t}),getFileTree:e=>Le(`/fs/tree?path=${encodeURIComponent(e)}`),readFile:e=>Le(`/fs/read?path=${encodeURIComponent(e)}`),getFileBlob:async e=>{const t=await fetch(`${zi}/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)=>Le(`/fs/diff?path=${encodeURIComponent(e)}${t?`&base=${encodeURIComponent(t)}`:""}`),getChangedFiles:(e,t)=>Le(`/fs/changed-files?cwd=${encodeURIComponent(e)}${t?`&base=${encodeURIComponent(t)}`:""}`),getClaudeMdFiles:e=>Le(`/fs/claude-md?cwd=${encodeURIComponent(e)}`),saveClaudeMd:(e,t)=>Vs("/fs/claude-md",{path:e,content:t}),getClaudeConfig:e=>Le(`/fs/claude-config?cwd=${encodeURIComponent(e)}`),getUsageLimits:()=>Le("/usage-limits"),getSessionUsageLimits:e=>Le(`/sessions/${encodeURIComponent(e)}/usage-limits`),getSystemMemory:()=>Le("/system/memory"),getSystemDisk:()=>Le("/system/disk"),spawnTerminal:(e,t,n,i)=>Fe("/terminal/spawn",{cwd:e,cols:t,rows:n,containerId:i==null?void 0:i.containerId}),killTerminal:e=>Fe("/terminal/kill",{terminalId:e}),getTerminal:e=>Le(e?`/terminal?terminalId=${encodeURIComponent(e)}`:"/terminal"),checkForUpdate:()=>Le("/update-check"),forceCheckForUpdate:()=>Fe("/update-check"),triggerUpdate:()=>Fe("/update"),getClaudeCompat:()=>Le("/claude-compat"),refreshClaudeCompat:()=>Fe("/claude-compat/refresh"),pinClaudeVersion:e=>Fe("/claude-compat/pin",e?{version:e}:{}),patchClaudeBinary:()=>Fe("/claude-compat/patch"),unpatchClaudeBinary:()=>Fe("/claude-compat/unpatch"),dismissClaudeCompatBanner:e=>Fe("/claude-compat/dismiss-banner",{version:e}),listCronJobs:()=>Le("/cron/jobs"),getCronJob:e=>Le(`/cron/jobs/${encodeURIComponent(e)}`),createCronJob:e=>Fe("/cron/jobs",e),updateCronJob:(e,t)=>Vs(`/cron/jobs/${encodeURIComponent(e)}`,t),deleteCronJob:e=>Gs(`/cron/jobs/${encodeURIComponent(e)}`),toggleCronJob:e=>Fe(`/cron/jobs/${encodeURIComponent(e)}/toggle`),runCronJob:e=>Fe(`/cron/jobs/${encodeURIComponent(e)}/run`),getCronJobExecutions:e=>Le(`/cron/jobs/${encodeURIComponent(e)}/executions`),killProcess:(e,t)=>Fe(`/sessions/${encodeURIComponent(e)}/processes/${encodeURIComponent(t)}/kill`),killAllProcesses:(e,t)=>Fe(`/sessions/${encodeURIComponent(e)}/processes/kill-all`,{taskIds:t}),getSystemProcesses:e=>Le(`/sessions/${encodeURIComponent(e)}/processes/system`),killSystemProcess:(e,t)=>Fe(`/sessions/${encodeURIComponent(e)}/processes/system/${t}/kill`),listAgents:()=>Le("/agents"),getAgent:e=>Le(`/agents/${encodeURIComponent(e)}`),createAgent:e=>Fe("/agents",e),updateAgent:(e,t)=>Vs(`/agents/${encodeURIComponent(e)}`,t),deleteAgent:e=>Gs(`/agents/${encodeURIComponent(e)}`),toggleAgent:e=>Fe(`/agents/${encodeURIComponent(e)}/toggle`),runAgent:(e,t)=>Fe(`/agents/${encodeURIComponent(e)}/run`,{input:t}),getAgentExecutions:e=>Le(`/agents/${encodeURIComponent(e)}/executions`),importAgent:e=>Fe("/agents/import",e),exportAgent:e=>Le(`/agents/${encodeURIComponent(e)}/export`),regenerateAgentWebhookSecret:e=>Fe(`/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 Le(`/executions${n?`?${n}`:""}`)},getLinearOAuthStatus:e=>{const t=new URLSearchParams;e&&t.set("stagingId",e);const n=t.toString();return Le(`/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 Le(`/linear/oauth/authorize-url${i?`?${i}`:""}`)},disconnectLinearOAuth:()=>Fe("/linear/oauth/disconnect"),createLinearStaging:e=>Fe("/linear/oauth/staging",e),getLinearStagingStatus:e=>Le(`/linear/oauth/staging/${encodeURIComponent(e)}/status`),deleteLinearStaging:e=>Gs(`/linear/oauth/staging/${encodeURIComponent(e)}`),listLinearOAuthConnections:()=>Le("/linear/oauth-connections"),createLinearOAuthConnection:e=>Fe("/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)=>Le(`/linear/oauth-connections/${encodeURIComponent(e)}/authorize-url${t?`?returnTo=${encodeURIComponent(t)}`:""}`),listSkills:()=>Le("/skills"),sendSessionMessage:(e,t)=>Fe(`/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 Le(`/prompts${i?`?${i}`:""}`)},createPrompt:e=>Fe("/prompts",e),updatePrompt:(e,t)=>Vs(`/prompts/${encodeURIComponent(e)}`,t),deletePrompt:e=>Gs(`/prompts/${encodeURIComponent(e)}`)};let y5=!1;function _5(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 w5(){return new Promise(()=>{})}function JM(){if(y5||typeof window>"u")return;y5=!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 _5(i)}catch{return w5()}}}}catch{}return}try{Object.defineProperty(e,"clipboard",{configurable:!0,value:{writeText:async n=>{try{await _5(n)}catch{return w5()}}}})}catch{}}const S5="#/session/",k5="#/agents/";let j5=!1;function Px(){j5||(JM(),j5=!0)}function Ux(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(k5)){const n=e.slice(k5.length);if(n)return{page:"agent-detail",agentId:n}}if(e.startsWith(S5)){const n=e.slice(S5.length);if(n)return{page:"session",sessionId:n}}return{page:"home"}}function eR(e){return`#/session/${e}`}function Fx(e,t=!1){Px();const n=eR(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 tR(){const[e,t]=k.useState(""),[n,i]=k.useState(null),[a,o]=k.useState(!1),u=K(g=>g.setAuthToken),h=k.useCallback(async g=>{g.preventDefault();const v=e.trim();if(!v){i("Please enter a token");return}o(!0),i(null),await b5(v)?u(v):i("Invalid token"),o(!1)},[e,u]);k.useEffect(()=>{ZM().then(g=>{if(g){u(g);return}const b=new URLSearchParams(window.location.search).get("token");b&&(o(!0),b5(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"),o(!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:g=>{t(g.target.value),i(null)},placeholder:"Paste your token here",className:"w-full px-3 py-2 pr-16 text-sm bg-cc-hover border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted/50 focus:outline-none focus:ring-1 focus:ring-cc-primary focus:border-cc-primary font-mono",autoComplete:"off",disabled:a}),l.jsx("button",{type:"button",onClick:()=>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=z2();function nR({issueIdentifier:e,issueStateName:t,isContainerized:n,archiveTransitionConfigured:i,archiveTransitionStateName:a,hasBacklogState:o,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:g=>g.stopPropagation(),children:[l.jsxs("div",{className:"flex items-center justify-between mb-3",children:[l.jsx("h3",{className:"text-sm font-semibold text-cc-fg",children:"Archive session"}),l.jsx("button",{type:"button","aria-label":"Close",onClick:h,className:"inline-flex h-6 w-6 items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]}),n&&l.jsx("div",{className:"mb-3 p-2.5 rounded-lg bg-amber-500/10 border border-amber-500/20",children:l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-amber-500 shrink-0 mt-0.5",children:l.jsx("path",{d:"M8.982 1.566a1.13 1.13 0 00-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 01-1.1 0L7.1 5.995A.905.905 0 018 5zm.002 6a1 1 0 110 2 1 1 0 010-2z"})}),l.jsxs("p",{className:"text-[11px] text-cc-fg leading-snug",children:["Archiving will ",l.jsx("strong",{children:"remove the container"})," and any uncommitted changes."]})]})}),l.jsxs("p",{className:"text-xs text-cc-muted mb-3",children:["This session is linked to ",l.jsx("strong",{className:"text-cc-fg",children:e})," ",l.jsxs("span",{className:"text-cc-muted",children:["(",t,")"]}),". What should happen to the issue?"]}),l.jsxs("fieldset",{className:"space-y-2 mb-4",children:[l.jsx("legend",{className:"sr-only",children:"Linear issue transition choice"}),l.jsxs("label",{className:"flex items-center gap-2.5 px-2.5 py-2 rounded-lg border border-cc-border hover:bg-cc-hover/50 transition-colors cursor-pointer",children:[l.jsx("input",{type:"radio",name:"archive-linear-choice",value:"none",checked:f==="none",onChange:()=>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 ${o?"hover:bg-cc-hover/50 cursor-pointer":"opacity-50 cursor-not-allowed"}`,children:[l.jsx("input",{type:"radio",name:"archive-linear-choice",value:"backlog",checked:f==="backlog",onChange:()=>m("backlog"),disabled:!o,className:"accent-cc-primary"}),l.jsx("span",{className:"text-xs text-cc-fg",children:"Move to Backlog"})]}),i&&a&&l.jsxs("label",{className:"flex items-center gap-2.5 px-2.5 py-2 rounded-lg border border-cc-border hover:bg-cc-hover/50 transition-colors cursor-pointer",children:[l.jsx("input",{type:"radio",name:"archive-linear-choice",value:"configured",checked:f==="configured",onChange:()=>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 sR(e,t){return t>0?"awaiting":(e.status==="running"||e.status==="compacting")&&e.isConnected?"running":e.isReconnecting?"reconnecting":e.isConnected?"idle":"exited"}function iR({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 rR({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:o,onSelect:u,onStartRename:h,onArchive:f,onUnarchive:m,onDelete:g,onClearRecentlyRenamed:v,editingSessionId:b,editingName:y,setEditingName:_,onConfirmRename:j,onCancelRename:N,editInputRef:w}){const C=e.id.slice(0,8),E=i||e.model||C,R=b===e.id,[M,L]=k.useState(!1),F=k.useRef(null),D=k.useRef(null),X=n?"exited":sR(e,a),U=e.cwd||"";k.useEffect(()=>{if(!M)return;function O(W){var q;F.current&&!F.current.contains(W.target)&&D.current&&!D.current.contains(W.target)&&(L(!1),(q=D.current)==null||q.focus())}function de(W){var q,H,I;if(W.key==="Escape"){L(!1),(q=D.current)==null||q.focus();return}if(W.key==="Tab"){L(!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=(I=F.current)==null?void 0:I.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",O),document.addEventListener("touchstart",O),document.addEventListener("keydown",de),()=>{document.removeEventListener("mousedown",O),document.removeEventListener("touchstart",O),document.removeEventListener("keydown",de)}},[M]),k.useEffect(()=>{M&&requestAnimationFrame(()=>{var O,de;(de=(O=F.current)==null?void 0:O.querySelector("[role='menuitem']"))==null||de.focus()})},[M]);const G=k.useCallback(O=>{L(!1),O()},[]);return l.jsxs("div",{className:"relative group",children:[l.jsxs("button",{onClick:()=>u(e.id),onDoubleClick:O=>{O.preventDefault(),h(e.id,E)},onKeyDown:O=>{O.key==="F2"&&!R&&(O.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(iR,{status:X}),R?l.jsx("input",{ref:w,value:y,onChange:O=>_(O.target.value),onKeyDown:O=>{O.key==="Enter"?(O.preventDefault(),j()):O.key==="Escape"&&(O.preventDefault(),N()),O.stopPropagation()},onBlur:j,onClick:O=>O.stopPropagation(),onDoubleClick:O=>O.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"} ${o?"animate-name-appear":""}`,onAnimationEnd:()=>v(e.id),children:E}),U&&l.jsx("span",{className:"text-[10px] text-cc-muted/70 truncate block leading-tight mt-px",children:U})]}),!R&&l.jsxs("span",{className:"flex items-center gap-1 shrink-0",children:[l.jsx(rR,{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&&!M&&l.jsx("button",{onClick:O=>{O.stopPropagation(),f(O,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:O=>{O.stopPropagation(),L(!M)},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":M,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"})]})}),M&&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:()=>G(()=>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:O=>G(()=>m(O,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:O=>G(()=>g(O,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:O=>G(()=>f(O,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 aR({group:e,isCollapsed:t,onToggleCollapse:n,currentSessionId:i,sessionNames:a,pendingPermissions:o,recentlyRenamed:u,onSelect:h,onStartRename:f,onArchive:m,onUnarchive:g,onDelete:v,onClearRecentlyRenamed:b,editingSessionId:y,editingName:_,setEditingName:j,onConfirmRename:N,onCancelRename:w,editInputRef:C,isFirst:E}){const R=t?e.sessions.slice(0,2).map(M=>a.get(M.id)||M.model||M.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(M=>{var F;const L=((F=o.get(M.id))==null?void 0:F.size)??0;return l.jsx(zh,{session:M,isActive:i===M.id,sessionName:a.get(M.id),permCount:L,isRecentlyRenamed:u.has(M.id),onSelect:h,onStartRename:f,onArchive:m,onUnarchive:g,onDelete:v,onClearRecentlyRenamed:b,editingSessionId:y,editingName:_,setEditingName:j,onConfirmRename:N,onCancelRename:w,editInputRef:C},M.id)})})]})}function lR(e,t,n=!1){return(n&&!!t&&(t==="/workspace"||t.startsWith("/workspace/"))?e:t||e).replace(/\/+$/,"")||"/"}function oR(e){if(e==="/")return"/";const t=e.split("/").filter(Boolean);return t.length===0?"/":t[t.length-1]}function cR(e){const t=new Map;for(const i of e){const a=lR(i.cwd,i.repoRoot||void 0,i.isContainerized),o=oR(a);t.has(a)||t.set(a,{key:a,label:o,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,o)=>o.createdAt-a.createdAt);return n}const uR=[{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"}],dR=[{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"}],hR=[{id:"workbench",label:"Workbench",itemIds:["dashboard","prompts","integrations"]},{id:"workspace",label:"Workspace",itemIds:["environments","sandboxes","agents","settings"]}],fR=new Map(dR.map(e=>[e.id,e]));function pR(){var vr,Pi;const[e,t]=k.useState(null),[n,i]=k.useState(""),[a,o]=k.useState(!1),[u,h]=k.useState(null),[f,m]=k.useState(null),[g,v]=k.useState(null),[b,y]=k.useState(!1),[_,j]=k.useState(null),[N,w]=k.useState(!1),[C,E]=k.useState(()=>typeof window<"u"?window.location.hash:""),R=k.useRef(null),M=k.useRef(null),L=K(le=>le.sessions),F=K(le=>le.sdkSessions),D=K(le=>le.currentSessionId),X=K(le=>le.cliConnected),U=K(le=>le.cliReconnecting),G=K(le=>le.sessionStatus),O=K(le=>le.removeSession),de=K(le=>le.sessionNames),W=K(le=>le.recentlyRenamed),q=K(le=>le.clearRecentlyRenamed),H=K(le=>le.pendingPermissions),I=K(le=>le.linkedLinearIssues),re=K(le=>le.collapsedProjects),ve=K(le=>le.toggleProjectCollapse),A=Ux(C);k.useEffect(()=>{let le=!0;async function xe(){try{const rt=await _e.listSessions();if(le){const It=K.getState();It.setSdkSessions(rt);const wn=K.getState(),Nn=new Set(rt.map(vt=>vt.sessionId));for(const vt of wn.sessions.keys())!Nn.has(vt)&&wn.connectionStatus.get(vt)!=="connected"&&wn.removeSession(vt);fT(rt);for(const vt of rt)if(vt.name&&(!It.sessionNames.has(vt.sessionId)||/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(It.sessionNames.get(vt.sessionId)))){const rn=It.sessionNames.get(vt.sessionId),en=!!rn&&/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(rn);rn!==vt.name&&(It.setSessionName(vt.sessionId,vt.name),en&&It.markRecentlyRenamed(vt.sessionId))}}}catch{}}xe();const Se=setInterval(xe,5e3);return()=>{le=!1,clearInterval(Se)}},[]),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()),_e.renameSession(e,n.trim()).catch(()=>{})),t(null),i("")}function P(){t(null),i("")}function oe(le,xe){t(le),i(xe)}const we=k.useCallback((le,xe)=>{le.stopPropagation(),j(xe)},[]),Ne=k.useCallback(async le=>{try{y0(le),await _e.deleteSession(le)}catch{}K.getState().currentSessionId===le&&qg(),O(le)},[O]),Ae=k.useCallback(()=>{_&&(Ne(_),j(null))},[_,Ne]),De=k.useCallback(()=>{j(null)},[]),ze=k.useCallback(()=>{w(!0)},[]),Ce=k.useCallback(async()=>{w(!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 Se=Array.from(xe).filter(rt=>{const It=le.sdkSessions.find(wn=>wn.sessionId===rt);return(It==null?void 0:It.archived)??!1});for(const rt of Se)await Ne(rt)},[Ne]),Re=k.useCallback(()=>{w(!1)},[]);k.useEffect(()=>{if(!_&&!N)return;requestAnimationFrame(()=>{var xe,Se;(Se=(xe=M.current)==null?void 0:xe.querySelector("button"))==null||Se.focus()});function le(xe){var wn;if(xe.key==="Escape"){N?Re():De();return}if(xe.key!=="Tab")return;const Se=(wn=M.current)==null?void 0:wn.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(!Se||Se.length===0)return;const rt=Se[0],It=Se[Se.length-1];xe.shiftKey&&document.activeElement===rt?(xe.preventDefault(),It.focus()):!xe.shiftKey&&document.activeElement===It&&(xe.preventDefault(),rt.focus())}return document.addEventListener("keydown",le),()=>document.removeEventListener("keydown",le)},[_,N,De,Re]);const Ut=k.useCallback(async(le,xe)=>{le.stopPropagation();const Se=F.find(rn=>rn.sessionId===xe),rt=L.get(xe),It=(rt==null?void 0:rt.is_containerized)||!!(Se!=null&&Se.containerId)||!1,wn=I.get(xe),Nn=((wn==null?void 0:wn.stateType)||"").toLowerCase();if(wn&&!(Nn==="completed"||Nn==="canceled"||Nn==="cancelled"))try{const rn=await _e.getArchiveInfo(xe);if(rn.issueNotDone){m(xe),v(rn),y(It);return}}catch{}if(It){h(xe);return}Kt(xe)},[F,L,I]),Kt=k.useCallback(async(le,xe,Se)=>{try{y0(le);const rt={};xe&&(rt.force=!0),Se&&Se!=="none"&&(rt.linearTransition=Se),await _e.archiveSession(le,Object.keys(rt).length>0?rt:void 0)}catch{}K.getState().currentSessionId===le&&(qg(),K.getState().newSession());try{const rt=await _e.listSessions();K.getState().setSdkSessions(rt)}catch{}},[]),Ft=k.useCallback(()=>{u&&(Kt(u,!0),h(null))},[u,Kt]),jt=k.useCallback(()=>{h(null)},[]),wt=k.useCallback((le,xe)=>{f&&(Kt(f,xe,le),m(null),v(null))},[f,Kt]),Xe=k.useCallback(()=>{m(null),v(null)},[]),St=k.useCallback(async(le,xe)=>{le.stopPropagation();try{await _e.unarchiveSession(xe)}catch{}try{const Se=await _e.listSessions();K.getState().setSdkSessions(Se)}catch{}},[]),nn=new Set;for(const le of L.keys())nn.add(le);for(const le of F)nn.add(le.sessionId);const se=Array.from(nn).map(le=>{var rt;const xe=L.get(le),Se=F.find(It=>It.sessionId===le);return{id:le,model:(xe==null?void 0:xe.model)||(Se==null?void 0:Se.model)||"",cwd:(xe==null?void 0:xe.cwd)||(Se==null?void 0:Se.cwd)||"",gitBranch:(xe==null?void 0:xe.git_branch)||(Se==null?void 0:Se.gitBranch)||"",isContainerized:(xe==null?void 0:xe.is_containerized)||!!(Se!=null&&Se.containerId)||!1,gitAhead:(xe==null?void 0:xe.git_ahead)||(Se==null?void 0:Se.gitAhead)||0,gitBehind:(xe==null?void 0:xe.git_behind)||(Se==null?void 0:Se.gitBehind)||0,linesAdded:(xe==null?void 0:xe.total_lines_added)||(Se==null?void 0:Se.totalLinesAdded)||0,linesRemoved:(xe==null?void 0:xe.total_lines_removed)||(Se==null?void 0:Se.totalLinesRemoved)||0,isConnected:X.get(le)??!1,isReconnecting:U.get(le)??!1,status:G.get(le)??null,sdkState:(Se==null?void 0:Se.state)??null,createdAt:(Se==null?void 0:Se.createdAt)??0,archived:(Se==null?void 0:Se.archived)??!1,backendType:(xe==null?void 0:xe.backend_type)||(Se==null?void 0:Se.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)||(Se==null?void 0:Se.cronJobId),cronJobName:(xe==null?void 0:xe.cronJobName)||(Se==null?void 0:Se.cronJobName),agentId:(xe==null?void 0:xe.agentId)||(Se==null?void 0:Se.agentId),agentName:(xe==null?void 0:xe.agentName)||(Se==null?void 0:Se.agentName),userName:Se==null?void 0:Se.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]),[Qe,et]=k.useState("__all__"),un=le=>Qe==="__all__"?!0:Qe==="__none__"?!le.userName:le.userName===Qe,ce=se.some(le=>!le.userName),be=se.filter(un),Y=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),Un=k.useMemo(()=>cR(Y),[Y]),sn={onSelect:Ee,onStartRename:oe,onArchive:Ut,onUnarchive:St,onDelete:we,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:Qe,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:jt,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:Y.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:[Un.map((le,xe)=>l.jsx(aR,{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:()=>o(!a),"aria-expanded":a,className:"flex-1 px-2 py-1 text-[11px] font-semibold text-cc-fg/60 uppercase tracking-wide flex items-center gap-1.5 hover:bg-cc-hover rounded-md transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${a?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),"Archived (",Ke.length,")"]}),a&&Ke.length>1&&l.jsx("button",{onClick:ze,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:hR.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 Se=fR.get(xe);if(!Se)return null;const rt=Se.activePages?Se.activePages.some(It=>A.page===It):A.page===Se.id;return l.jsxs("button",{onClick:()=>{window.location.hash=Se.hash,window.innerWidth<768&&K.getState().setSidebarOpen(!1)},title:Se.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:Se.viewBox,fill:"currentColor",className:"w-3.5 h-3.5 shrink-0",children:l.jsx("path",{d:Se.iconPath,fillRule:Se.fillRule,clipRule:Se.clipRule})}),l.jsx("span",{className:"min-w-0 flex-1 text-[12px] font-medium leading-tight",children:Se.label})]},Se.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:uR.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:De,children:l.jsxs("div",{ref:M,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:De,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&&g&&l.jsx(nR,{issueIdentifier:((vr=g.issue)==null?void 0:vr.identifier)||"",issueStateName:((Pi=g.issue)==null?void 0:Pi.stateName)||"",isContainerized:b,archiveTransitionConfigured:g.archiveTransitionConfigured||!1,archiveTransitionStateName:g.archiveTransitionStateName,hasBacklogState:g.hasBacklogState||!1,onConfirm:wt,onCancel:Xe})]})}function mR(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const gR=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,xR=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,vR={};function N5(e,t){return(vR.jsx?xR:gR).test(e)}const bR=/[ \t\n\f\r]/g;function yR(e){return typeof e=="object"?e.type==="text"?C5(e.value):!1:C5(e)}function C5(e){return e.replace(bR,"")===""}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 bj(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 Z0(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 _R=0;const Ze=ll(),bn=ll(),J0=ll(),ke=ll(),$t=ll(),nl=ll(),Rs=ll();function ll(){return 2**++_R}const ex=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ze,booleanish:bn,commaOrSpaceSeparated:Rs,commaSeparated:nl,number:ke,overloadedBoolean:J0,spaceSeparated:$t},Symbol.toStringTag,{value:"Module"})),Vg=Object.keys(ex);class Ix extends xs{constructor(t,n,i,a){let o=-1;if(super(t,n),E5(this,"space",a),typeof i=="number")for(;++o<Vg.length;){const u=Vg[o];E5(this,Vg[o],(i&ex[u])===ex[u])}}}Ix.prototype.defined=!0;function E5(e,t,n){n&&(e[t]=n)}function Ao(e){const t={},n={};for(const[i,a]of Object.entries(e.properties)){const o=new Ix(i,e.transform(e.attributes||{},i),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(o.mustUseProperty=!0),t[i]=o,n[Z0(i)]=i,n[Z0(o.attribute)]=i}return new Ou(t,n,e.space)}const yj=Ao({properties:{ariaActiveDescendant:null,ariaAtomic:bn,ariaAutoComplete:null,ariaBusy:bn,ariaChecked:bn,ariaColCount:ke,ariaColIndex:ke,ariaColSpan:ke,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:ke,ariaLive:null,ariaModal:bn,ariaMultiLine:bn,ariaMultiSelectable:bn,ariaOrientation:null,ariaOwns:$t,ariaPlaceholder:null,ariaPosInSet:ke,ariaPressed:bn,ariaReadOnly:bn,ariaRelevant:null,ariaRequired:bn,ariaRoleDescription:$t,ariaRowCount:ke,ariaRowIndex:ke,ariaRowSpan:ke,ariaSelected:bn,ariaSetSize:ke,ariaSort:null,ariaValueMax:ke,ariaValueMin:ke,ariaValueNow:ke,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function _j(e,t){return t in e?e[t]:t}function wj(e,t){return _j(e,t.toLowerCase())}const wR=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:ke,colSpan:ke,command:null,commandFor:null,content:null,contentEditable:bn,controls:Ze,controlsList:$t,coords:ke|nl,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ze,defer:Ze,dir:null,dirName:null,disabled:Ze,download:J0,draggable:bn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ze,formTarget:null,headers:$t,height:ke,hidden:J0,high:ke,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:ke,manifest:null,max:null,maxLength:ke,media:null,method:null,min:null,minLength:ke,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:ke,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:ke,rowSpan:ke,sandbox:$t,scope:null,scoped:Ze,seamless:Ze,selected:Ze,shadowRootClonable:Ze,shadowRootCustomElementRegistry:Ze,shadowRootDelegatesFocus:Ze,shadowRootMode:null,shadowRootSerializable:Ze,shape:null,size:ke,sizes:null,slot:null,span:ke,spellCheck:bn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ke,step:null,style:null,tabIndex:ke,target:null,title:null,translate:null,type:null,typeMustMatch:Ze,useMap:null,value:bn,width:ke,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:$t,axis:null,background:null,bgColor:null,border:ke,borderColor:null,bottomMargin:ke,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:ke,leftMargin:ke,link:null,longDesc:null,lowSrc:null,marginHeight:ke,marginWidth:ke,noResize:Ze,noHref:Ze,noShade:Ze,noWrap:Ze,object:null,profile:null,prompt:null,rev:null,rightMargin:ke,rules:null,scheme:null,scrolling:bn,standby:null,summary:null,text:null,topMargin:ke,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ke,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Ze,disablePictureInPicture:Ze,disableRemotePlayback:Ze,exportParts:nl,part:$t,prefix:null,property:null,results:ke,security:null,unselectable:null},space:"html",transform:wj}),SR=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:ke,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ke,amplitude:ke,arabicForm:null,ascent:ke,attributeName:null,attributeType:null,azimuth:ke,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ke,by:null,calcMode:null,capHeight:ke,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:ke,diffuseConstant:ke,direction:null,display:null,dur:null,divisor:ke,dominantBaseline:null,download:Ze,dx:null,dy:null,edgeMode:null,editable:null,elevation:ke,enableBackground:null,end:null,event:null,exponent:ke,externalResourcesRequired:null,fill:null,fillOpacity:ke,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:ke,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ke,horizOriginX:ke,horizOriginY:ke,id:null,ideographic:ke,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ke,k:ke,k1:ke,k2:ke,k3:ke,k4:ke,kernelMatrix:Rs,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ke,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:ke,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:ke,overlineThickness:ke,paintOrder:null,panose1:null,path:null,pathLength:ke,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:$t,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ke,pointsAtY:ke,pointsAtZ:ke,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:ke,specularExponent:ke,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ke,strikethroughThickness:ke,string:null,stroke:null,strokeDashArray:Rs,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ke,strokeOpacity:ke,strokeWidth:null,style:null,surfaceScale:ke,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Rs,tabIndex:ke,tableValues:null,target:null,targetX:ke,targetY:ke,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:ke,underlineThickness:ke,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ke,values:null,vAlphabetic:ke,vMathematical:ke,vectorEffect:null,vHanging:ke,vIdeographic:ke,version:null,vertAdvY:ke,vertOriginX:ke,vertOriginY:ke,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ke,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:_j}),Sj=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()}}),kj=Ao({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:wj}),jj=Ao({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),kR={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"},jR=/[A-Z]/g,T5=/-[a-z]/g,NR=/^data[-\w.:]+$/i;function CR(e,t){const n=Z0(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"&&NR.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(T5,TR);i="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!T5.test(o)){let u=o.replace(jR,ER);u.charAt(0)!=="-"&&(u="-"+u),t="data"+u}}a=Ix}return new a(i,t)}function ER(e){return"-"+e.toLowerCase()}function TR(e){return e.charAt(1).toUpperCase()}const AR=bj([yj,wR,Sj,kj,jj],"html"),Hx=bj([yj,SR,Sj,kj,jj],"svg");function MR(e){return e.join(" ").trim()}var ro={},Gg,A5;function RR(){if(A5)return Gg;A5=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,h=/^\s+|\s+$/g,f=`
|
|
72
|
-
`,m="/",g="*",v="",b="comment",y="declaration";function _(N,w){if(typeof N!="string")throw new TypeError("First argument must be a string");if(!N)return[];w=w||{};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 M(){var W={line:C,column:E};return function(q){return q.position=new L(W),X(),q}}function L(W){this.start=W,this.end={line:C,column:E},this.source=w.source}L.prototype.content=N;function F(W){var q=new Error(w.source+":"+C+":"+E+": "+W);if(q.reason=W,q.filename=w.source,q.line=C,q.column=E,q.source=N,!w.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 X(){D(n)}function U(W){var q;for(W=W||[];q=G();)q!==!1&&W.push(q);return W}function G(){var W=M();if(!(m!=N.charAt(0)||g!=N.charAt(1))){for(var q=2;v!=N.charAt(q)&&(g!=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 O(){var W=M(),q=D(i);if(q){if(G(),!D(a))return F("property missing ':'");var H=D(o),I=W({type:y,property:j(q[0].replace(e,v)),value:H?j(H[0].replace(e,v)):v});return D(u),I}}function de(){var W=[];U(W);for(var q;q=O();)q!==!1&&(W.push(q),U(W));return W}return X(),de()}function j(N){return N?N.replace(h,v):v}return Gg=_,Gg}var M5;function OR(){if(M5)return ro;M5=1;var e=ro&&ro.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(ro,"__esModule",{value:!0}),ro.default=n;const t=e(RR());function n(i,a){let o=null;if(!i||typeof i!="string")return o;const u=(0,t.default)(i),h=typeof a=="function";return u.forEach(f=>{if(f.type!=="declaration")return;const{property:m,value:g}=f;h?a(m,g,f):g&&(o=o||{},o[m]=g)}),o}return ro}var qc={},R5;function LR(){if(R5)return qc;R5=1,Object.defineProperty(qc,"__esModule",{value:!0}),qc.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(m){return!m||n.test(m)||e.test(m)},u=function(m,g){return g.toUpperCase()},h=function(m,g){return"".concat(g,"-")},f=function(m,g){return g===void 0&&(g={}),o(m)?m:(m=m.toLowerCase(),g.reactCompat?m=m.replace(a,h):m=m.replace(i,h),m.replace(t,u))};return qc.camelCase=f,qc}var Vc,O5;function DR(){if(O5)return Vc;O5=1;var e=Vc&&Vc.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(OR()),n=LR();function i(a,o){var u={};return!a||typeof a!="string"||(0,t.default)(a,function(h,f){h&&f&&(u[(0,n.camelCase)(h,o)]=f)}),u}return i.default=i,Vc=i,Vc}var zR=DR();const $R=px(zR),Nj=Cj("end"),qx=Cj("start");function Cj(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 BR(e){const t=qx(e),n=Nj(e);if(t&&n)return{start:t,end:n}}function fu(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?L5(e.position):"start"in e||"end"in e?L5(e):"line"in e||"column"in e?tx(e):""}function tx(e){return D5(e&&e.line)+":"+D5(e&&e.column)}function L5(e){return tx(e&&e.start)+"-"+tx(e&&e.end)}function D5(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="",o={},u=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?a=t:!o.cause&&t&&(u=!0,a=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof i=="string"){const f=i.indexOf(":");f===-1?o.ruleId=i:(o.source=i.slice(0,f),o.ruleId=i.slice(f+1))}if(!o.place&&o.ancestors&&o.ancestors){const f=o.ancestors[o.ancestors.length-1];f&&(o.place=f.position)}const h=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=h?h.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=h?h.line:void 0,this.name=fu(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=u&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}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,PR=new Map,UR=/[A-Z]/g,FR=new Set(["table","tbody","thead","tfoot","tr"]),IR=new Set(["td","th"]),Ej="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function HR(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=KR(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=WR(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:AR,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=Tj(a,e,void 0);return o&&typeof o!="string"?o:a.create(e,a.Fragment,{children:o||void 0},void 0)}function Tj(e,t,n){if(t.type==="element")return qR(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return VR(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return YR(e,t,n);if(t.type==="mdxjsEsm")return GR(e,t);if(t.type==="root")return QR(e,t,n);if(t.type==="text")return XR(e,t)}function qR(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 o=Mj(e,t.tagName,!1),u=ZR(e,t);let h=Yx(e,t);return FR.has(t.tagName)&&(h=h.filter(function(f){return typeof f=="string"?!yR(f):!0})),Aj(e,u,o,t),Gx(u,h),e.ancestors.pop(),e.schema=i,e.create(t,o,u,n)}function VR(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)}Tu(e,t.position)}function GR(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Tu(e,t.position)}function YR(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 o=t.name===null?e.Fragment:Mj(e,t.name,!0),u=JR(e,t),h=Yx(e,t);return Aj(e,u,o,t),Gx(u,h),e.ancestors.pop(),e.schema=i,e.create(t,o,u,n)}function QR(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 Aj(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 WR(e,t,n){return i;function i(a,o,u,h){const m=Array.isArray(u.children)?n:t;return h?m(o,u,h):m(o,u)}}function KR(e,t){return n;function n(i,a,o,u){const h=Array.isArray(o.children),f=qx(i);return t(a,o,u,h,{columnNumber:f?f.column-1:void 0,fileName:e,lineNumber:f?f.line:void 0},void 0)}}function ZR(e,t){const n={};let i,a;for(a in t.properties)if(a!=="children"&&Vx.call(t.properties,a)){const o=e8(e,a,t.properties[a]);if(o){const[u,h]=o;e.tableCellAlignToStyle&&u==="align"&&typeof h=="string"&&IR.has(t.tagName)?i=h:n[u]=h}}if(i){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return n}function JR(e,t){const n={};for(const i of t.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&e.evaluater){const o=i.data.estree.body[0];o.type;const u=o.expression;u.type;const h=u.properties[0];h.type,Object.assign(n,e.evaluater.evaluateExpression(h.argument))}else Tu(e,t.position);else{const a=i.name;let o;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&e.evaluater){const h=i.value.data.estree.body[0];h.type,o=e.evaluater.evaluateExpression(h.expression)}else Tu(e,t.position);else o=i.value===null?!0:i.value;n[a]=o}return n}function Yx(e,t){const n=[];let i=-1;const a=e.passKeys?new Map:PR;for(;++i<t.children.length;){const o=t.children[i];let u;if(e.passKeys){const f=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(f){const m=a.get(f)||0;u=f+"-"+m,a.set(f,m+1)}}const h=Tj(e,o,u);h!==void 0&&n.push(h)}return n}function e8(e,t,n){const i=CR(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=i.commaSeparated?mR(n):MR(n)),i.property==="style"){let a=typeof n=="object"?n:t8(e,String(n));return e.stylePropertyNameCase==="css"&&(a=n8(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&i.space?kR[i.property]||i.property:i.attribute,n]}}function t8(e,t){try{return $R(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=Ej+"#cannot-parse-style-attribute",a}}function Mj(e,t,n){let i;if(!n)i={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let o=-1,u;for(;++o<a.length;){const h=N5(a[o])?{type:"Identifier",name:a[o]}:{type:"Literal",value:a[o]};u=u?{type:"MemberExpression",object:u,property:h,computed:!!(o&&h.type==="Literal"),optional:!1}:h}i=u}else i=N5(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);Tu(e)}function Tu(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=Ej+"#cannot-handle-mdx-estrees-without-createevaluater",n}function n8(e){const t={};let n;for(n in e)Vx.call(e,n)&&(t[s8(n)]=e[n]);return t}function s8(e){let t=e.replace(UR,i8);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function i8(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"]},r8={};function Qx(e,t){const n=r8,i=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Rj(e,i,a)}function Rj(e,t,n){if(a8(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 z5(e.children,t,n)}return Array.isArray(e)?z5(e,t,n):""}function z5(e,t,n){const i=[];let a=-1;for(;++a<e.length;)i[a]=Rj(e[a],t,n);return i.join("")}function a8(e){return!!(e&&typeof e=="object")}const $5=document.createElement("i");function Xx(e){const t="&"+e+";";$5.innerHTML=t;const n=$5.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function hi(e,t,n,i){const a=e.length;let o=0,u;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,i.length<1e4)u=Array.from(i),u.unshift(t,n),e.splice(...u);else for(n&&e.splice(t,n);o<i.length;)u=i.slice(o,o+1e4),u.unshift(t,0),e.splice(...u),o+=1e4,t+=1e4}function Ys(e,t){return e.length>0?(hi(e,e.length,0,t),e):t}const B5={}.hasOwnProperty;function Oj(e){const t={};let n=-1;for(;++n<e.length;)l8(t,e[n]);return t}function l8(e,t){let n;for(n in t){const a=(B5.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let u;if(o)for(u in o){B5.call(a,u)||(a[u]=[]);const h=o[u];o8(a[u],Array.isArray(h)?h:h?[h]:[])}}}function o8(e,t){let n=-1;const i=[];for(;++n<t.length;)(t[n].add==="after"?e:i).push(t[n]);hi(e,0,0,i)}function Lj(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 fi(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ss=pa(/[A-Za-z]/),qn=pa(/[\dA-Za-z]/),c8=pa(/[#-'*+\--9=?A-Z^-~]/);function of(e){return e!==null&&(e<32||e===127)}const nx=pa(/\d/),u8=pa(/[\dA-Fa-f]/),d8=pa(/[!-/:-@[-`{-~]/);function Ve(e){return e!==null&&e<-2}function Pt(e){return e!==null&&(e<0||e===32)}function ot(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 o=e.charCodeAt(n);let u="";if(o===37&&qn(e.charCodeAt(n+1))&&qn(e.charCodeAt(n+2)))a=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(u=String.fromCharCode(o));else if(o>55295&&o<57344){const h=e.charCodeAt(n+1);o<56320&&h>56319&&h<57344?(u=String.fromCharCode(o,h),a=1):u="�"}else u=String.fromCharCode(o);u&&(t.push(e.slice(i,n),encodeURIComponent(u)),i=n+a+1,u=""),a&&(n+=a,a=0)}return t.join("")+e.slice(i)}function Nt(e,t,n,i){const a=i?i-1:1/0;let o=0;return u;function u(f){return ot(f)?(e.enter(n),h(f)):t(f)}function h(f){return ot(f)&&o++<a?(e.consume(f),h):(e.exit(n),t(f))}}function Dj(e,t,n,i,a,o){let u=0;return h;function h(g){return ot(g)?(e.enter(i),f(g)):m(g)}function f(g){return ot(g)&&u<o?(e.consume(g),u++,f):(e.exit(i),m(g))}function m(g){return u>=a?t(g):n(g)}}const h8={tokenize:f8};function f8(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"),Nt(e,t,"linePrefix")}function a(h){return e.enter("paragraph"),o(h)}function o(h){const f=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=f),n=f,u(h)}function u(h){if(h===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(h);return}return Ve(h)?(e.consume(h),e.exit("chunkText"),o):(e.consume(h),u)}}let cf=class{constructor(){this.index=new Map,this.map=[]}add(t,n,i){P5(this,t,n,i,!1)}addBefore(t,n,i){P5(this,t,n,i,!0)}consume(t){if(this.map.sort(function(o,u){return o[0]-u[0]}),this.map.length===0)return;let n=this.map.length;const i=[];for(;n>0;)n-=1,i.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];i.push(t.slice()),t.length=0;let a=i.pop();for(;a;){for(const o of a)t.push(o);a=i.pop()}this.map.length=0,this.index.clear()}};function P5(e,t,n,i,a){if(n===0&&i.length===0)return;const o=e.index.get(t);if(o){o[1]+=n,a?(i.push(...o[2]),o[2]=i):o[2].push(...i);return}const u=[t,n,i];e.map.push(u),e.index.set(t,u)}const p8={tokenize:m8},U5={tokenize:g8};function m8(e){const t=this,n=[];let i=0,a,o,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 M=R,L;for(;M--;)if(t.events[M][0]==="exit"&&t.events[M][1].type==="chunkFlow"){L=t.events[M][1].end;break}w(i);let F=R;for(;F<t.events.length;)t.events[F][1].end={...L},F++;const D=new cf;return D.add(M+1,0,t.events.slice(R)),D.add(R,F-R,[]),D.consume(t.events),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(U5,g,v)(E)}function g(E){return a&&C(),w(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(U5,y,_)(E)}function y(E){return i++,n.push([t.currentConstruct,t.containerState]),b(E)}function _(E){if(E===null){a&&C(),w(0),e.consume(E);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:o}),j(E)}function j(E){if(E===null){N(e.exit("chunkFlow"),!0),w(0),e.consume(E);return}return Ve(E)?(e.consume(E),N(e.exit("chunkFlow")),i=0,t.interrupt=void 0,h):(e.consume(E),j)}function N(E,R){const M=t.sliceStream(E);if(R&&M.push(null),E.previous=o,o&&(o.next=E),o=E,a.defineSkip(E.start),a.write(M),t.parser.lazy[E.start.line]){let L=a.events.length;for(;L--;)if(a.events[L][1].start.offset<u&&(!a.events[L][1].end||a.events[L][1].end.offset>u))return;const F=t.events.length;let D=F,X,U;for(;D--;)if(t.events[D][0]==="exit"&&t.events[D][1].type==="chunkFlow"){if(X){U=t.events[D][1].end;break}X=!0}for(w(i),L=F;L<t.events.length;)t.events[L][1].end={...U},L++;const G=new cf;G.add(D+1,0,t.events.slice(F)),G.add(F,L-F,[]),G.consume(t.events)}}function w(E){let R=n.length;for(;R-- >E;){const M=n[R];t.containerState=M[1],M[0].exit.call(t,e)}n.length=E}function C(){a.write([null]),o=void 0,a=void 0,t.containerState._closeFlow=void 0}}function g8(e,t,n){return Nt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function uf(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 o=e[a].resolveAll;o&&!i.includes(o)&&(t=o(t,n),i.push(o))}return t}const sx={name:"attention",resolveAll:x8,tokenize:v8};function x8(e,t){let n=-1,i;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){let a=n;for(;a--;)if(e[a][0]==="exit"&&e[a][1].type==="attentionSequence"&&e[a][1]._open&&t.sliceSerialize(e[a][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[a][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[a][1].end.offset-e[a][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;const o=e[a][1].end.offset-e[a][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1,u={...e[a][1].end},h={...e[n][1].start};F5(u,-o),F5(h,o);const f={type:o>1?"strongSequence":"emphasisSequence",start:u,end:{...e[a][1].end}},m={type:o>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:h},g={type:o>1?"strongText":"emphasisText",start:{...e[a][1].end},end:{...e[n][1].start}},v={type:o>1?"strong":"emphasis",start:{...f.start},end:{...m.end}};e[a][1].end={...f.start},e[n][1].start={...m.end},i=[],e[a][1].end.offset-e[a][1].start.offset&&(i=Ys(i,[["enter",e[a][1],t],["exit",e[a][1],t]])),i=Ys(i,[["enter",v,t],["enter",f,t],["exit",f,t],["enter",g,t]]),i=Ys(i,kf(t.parser.constructs.insideSpan.null,e.slice(a+1,n),t)),i=Ys(i,[["exit",g,t],["enter",m,t],["exit",m,t],["exit",v,t]]);let b=0;e[n][1].end.offset-e[n][1].start.offset&&(b=2,i=Ys(i,[["enter",e[n][1],t],["exit",e[n][1],t]])),hi(e,a-1,n-a+3,i),n=a+i.length-b-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function v8(e,t){const n=this.parser.constructs.attentionMarkers.null,i=this.previous,a=uf(i);let o;return u;function u(f){return o=f,e.enter("attentionSequence"),h(f)}function h(f){if(f===o)return e.consume(f),h;const m=e.exit("attentionSequence"),g=uf(f),v=!g||g===2&&a||n.includes(f)&&f!==42&&f!==95,b=!a||a===2&&g||n.includes(i)&&i!==42&&i!==95;return m._open=!!(o===42?v:v&&(a||!b)),m._close=!!(o===42?b:b&&(g||!v)),t(f)}}function F5(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const b8={name:"autolink",tokenize:y8};function y8(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"),o}function o(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||of(y)?n(y):(e.consume(y),f)}function m(y){return y===64?(e.consume(y),g):c8(y)?(e.consume(y),m):n(y)}function g(y){return qn(y)?v(y):n(y)}function v(y){return y===46?(e.consume(y),i=0,g):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:_8};function _8(e,t,n){return i;function i(o){return ot(o)?Nt(e,a,"linePrefix")(o):a(o)}function a(o){return o===null||Ve(o)?t(o):n(o)}}const zj={continuation:{tokenize:S8},exit:k8,name:"blockQuote",tokenize:w8};function w8(e,t,n){const i=this;return a;function a(u){if(u===62){const h=i.containerState;return h.open||(e.enter("blockQuote",{_container:!0}),h.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(u),e.exit("blockQuoteMarker"),o}return n(u)}function o(u){return ot(u)?(e.enter("blockQuotePrefixWhitespace"),e.consume(u),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(u))}}function S8(e,t,n){const i=this;return a;function a(u){return ot(u)?Nt(e,o,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u):o(u)}function o(u){return e.attempt(zj,t,n)(u)}}function k8(e){e.exit("blockQuote")}const $j={name:"characterEscape",tokenize:j8};function j8(e,t,n){return i;function i(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),a}function a(o){return d8(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const Bj={name:"characterReference",tokenize:N8};function N8(e,t,n){const i=this;let a=0,o,u;return h;function h(v){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(v),e.exit("characterReferenceMarker"),f}function f(v){return v===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(v),e.exit("characterReferenceMarkerNumeric"),m):(e.enter("characterReferenceValue"),o=31,u=qn,g(v))}function m(v){return v===88||v===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(v),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,u=u8,g):(e.enter("characterReferenceValue"),o=7,u=nx,g(v))}function g(v){if(v===59&&a){const b=e.exit("characterReferenceValue");return u===qn&&!Xx(i.sliceSerialize(b))?n(v):(e.enter("characterReferenceMarker"),e.consume(v),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return u(v)&&a++<o?(e.consume(v),g):n(v)}}const ix={partial:!0,tokenize:C8};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"),o)}function o(u){return i.parser.lazy[i.now().line]?n(u):t(u)}}const I5={concrete:!0,name:"codeFenced",tokenize:E8};function E8(e,t,n){const i=this,a={partial:!0,tokenize:M};let o=0,u=0,h;return f;function f(L){return m(L)}function m(L){const F=i.events[i.events.length-1];return o=F&&F[1].type==="linePrefix"?F[2].sliceSerialize(F[1],!0).length:0,h=L,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(L)}function g(L){return L===h?(u++,e.consume(L),g):u<3?n(L):(e.exit("codeFencedFenceSequence"),ot(L)?Nt(e,v,"whitespace")(L):v(L))}function v(L){return L===null||Ve(L)?(e.exit("codeFencedFence"),i.interrupt?t(L):e.check(ix,j,R)(L)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),b(L))}function b(L){return L===null||Ve(L)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),v(L)):ot(L)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Nt(e,y,"whitespace")(L)):L===96&&L===h?n(L):(e.consume(L),b)}function y(L){return L===null||Ve(L)?v(L):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),_(L))}function _(L){return L===null||Ve(L)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),v(L)):L===96&&L===h?n(L):(e.consume(L),_)}function j(L){return e.attempt(a,R,N)(L)}function N(L){return e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),w}function w(L){return o>0&&ot(L)?Nt(e,C,"linePrefix",o+1)(L):C(L)}function C(L){return L===null||Ve(L)?e.check(ix,j,R)(L):(e.enter("codeFlowValue"),E(L))}function E(L){return L===null||Ve(L)?(e.exit("codeFlowValue"),C(L)):(e.consume(L),E)}function R(L){return e.exit("codeFenced"),t(L)}function M(L,F,D){let X=0;return U;function U(q){return L.enter("lineEnding"),L.consume(q),L.exit("lineEnding"),G}function G(q){return L.enter("codeFencedFence"),ot(q)?Nt(L,O,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(q):O(q)}function O(q){return q===h?(L.enter("codeFencedFenceSequence"),de(q)):D(q)}function de(q){return q===h?(X++,L.consume(q),de):X>=u?(L.exit("codeFencedFenceSequence"),ot(q)?Nt(L,W,"whitespace")(q):W(q)):D(q)}function W(q){return q===null||Ve(q)?(L.exit("codeFencedFence"),F(q)):D(q)}}}const Qg={name:"codeIndented",tokenize:A8},T8={partial:!0,tokenize:M8};function A8(e,t,n){return i;function i(h){return e.enter("codeIndented"),Dj(e,a,n,"linePrefix",4,4)(h)}function a(h){return h===null?u(h):Ve(h)?e.attempt(T8,a,u)(h):(e.enter("codeFlowValue"),o(h))}function o(h){return h===null||Ve(h)?(e.exit("codeFlowValue"),a(h)):(e.consume(h),o)}function u(h){return e.exit("codeIndented"),t(h)}}function M8(e,t,n){const i=this;return a;function a(u){return i.parser.lazy[i.now().line]?n(u):Ve(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),a):Dj(e,t,o,"linePrefix",4,4)(u)}function o(u){return Ve(u)?a(u):n(u)}}const R8={name:"codeText",previous:L8,resolve:O8,tokenize:D8};function O8(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 L8(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function D8(e,t,n){let i=0,a,o;return u;function u(v){return e.enter("codeText"),e.enter("codeTextSequence"),h(v)}function h(v){return v===96?(e.consume(v),i++,h):(e.exit("codeTextSequence"),f(v))}function f(v){return v===null?n(v):v===32?(e.enter("space"),e.consume(v),e.exit("space"),f):v===96?(o=e.enter("codeTextSequence"),a=0,g(v)):Ve(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||Ve(v)?(e.exit("codeTextData"),f(v)):(e.consume(v),m)}function g(v){return v===96?(e.consume(v),a++,g):a===i?(e.exit("codeTextSequence"),e.exit("codeText"),t(v)):(o.type="codeTextData",m(v))}}class z8{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const i=n??Number.POSITIVE_INFINITY;return i<this.left.length?this.left.slice(t,i):t>this.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(t,n,i){const a=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return i&&Gc(this.left,i),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Gc(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Gc(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);Gc(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Gc(this.left,n.reverse())}}}function Gc(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 Pj(e){const t={};let n=-1,i,a,o,u,h,f,m;const g=new z8(e);for(;++n<g.length;){for(;n in t;)n=t[n];if(i=g.get(n),n&&i[1].type==="chunkFlow"&&g.get(n-1)[1].type==="listItemPrefix"&&(f=i[1]._tokenizer.events,o=0,o<f.length&&f[o][1].type==="lineEndingBlank"&&(o+=2),o<f.length&&f[o][1].type==="content"))for(;++o<f.length&&f[o][1].type!=="content";)f[o][1].type==="chunkText"&&(f[o][1]._isInFirstContentOfListItem=!0,o++);if(i[0]==="enter")i[1].contentType&&(Object.assign(t,$8(g,n)),n=t[n],m=!0);else if(i[1]._container){for(o=n,a=void 0;o--;)if(u=g.get(o),u[1].type==="lineEnding"||u[1].type==="lineEndingBlank")u[0]==="enter"&&(a&&(g.get(a)[1].type="lineEndingBlank"),u[1].type="lineEnding",a=o);else if(!(u[1].type==="linePrefix"||u[1].type==="listItemIndent"))break;a&&(i[1].end={...g.get(a)[1].start},h=g.slice(a,n),h.unshift(i),g.splice(a,n-a+1,h))}}return hi(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!m}function $8(e,t){const n=e.get(t)[1],i=e.get(t)[2];let a=t-1;const o=[];let u=n._tokenizer;u||(u=i.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(u._contentTypeTextTrailing=!0));const h=u.events,f=[],m={};let g,v,b=-1,y=n,_=0,j=0;const N=[j];for(;y;){for(;e.get(++a)[1]!==y;);o.push(a),y._tokenizer||(g=i.sliceStream(y),y.next||g.push(null),v&&u.defineSkip(y.start),y._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=!0),u.write(g),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 w=h.slice(N[b],N[b+1]),C=o.pop();f.push([C,C+w.length-1]),e.splice(C,2,w)}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 B8={resolve:U8,tokenize:F8},P8={partial:!0,tokenize:I8};function U8(e){return Pj(e),e}function F8(e,t){let n;return i;function i(h){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(h)}function a(h){return h===null?o(h):Ve(h)?e.check(P8,u,o)(h):(e.consume(h),a)}function o(h){return e.exit("chunkContent"),e.exit("content"),t(h)}function u(h){return e.consume(h),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function I8(e,t,n){const i=this;return a;function a(u){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),Nt(e,o,"linePrefix")}function o(u){if(u===null||Ve(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 Uj(e,t,n,i,a,o,u,h,f){const m=f||Number.POSITIVE_INFINITY;let g=0;return v;function v(w){return w===60?(e.enter(i),e.enter(a),e.enter(o),e.consume(w),e.exit(o),b):w===null||w===32||w===41||of(w)?n(w):(e.enter(i),e.enter(u),e.enter(h),e.enter("chunkString",{contentType:"string"}),j(w))}function b(w){return w===62?(e.enter(o),e.consume(w),e.exit(o),e.exit(a),e.exit(i),t):(e.enter(h),e.enter("chunkString",{contentType:"string"}),y(w))}function y(w){return w===62?(e.exit("chunkString"),e.exit(h),b(w)):w===null||w===60||Ve(w)?n(w):(e.consume(w),w===92?_:y)}function _(w){return w===60||w===62||w===92?(e.consume(w),y):y(w)}function j(w){return!g&&(w===null||w===41||Pt(w))?(e.exit("chunkString"),e.exit(h),e.exit(u),e.exit(i),t(w)):g<m&&w===40?(e.consume(w),g++,j):w===41?(e.consume(w),g--,j):w===null||w===32||w===40||of(w)?n(w):(e.consume(w),w===92?N:j)}function N(w){return w===40||w===41||w===92?(e.consume(w),j):j(w)}}function Fj(e,t,n,i,a,o){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(o),g}function g(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(o),e.enter(a),e.consume(y),e.exit(a),e.exit(i),t):Ve(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),v(y))}function v(y){return y===null||y===91||y===93||Ve(y)||h++>999?(e.exit("chunkString"),g(y)):(e.consume(y),f||(f=!ot(y)),y===92?b:v)}function b(y){return y===91||y===92||y===93?(e.consume(y),h++,v):v(y)}}function Ij(e,t,n,i,a,o){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(o),m(b))}function m(b){return b===u?(e.exit(o),f(u)):b===null?n(b):Ve(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),Nt(e,m,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(b))}function g(b){return b===u||b===null||Ve(b)?(e.exit("chunkString"),m(b)):(e.consume(b),b===92?v:g)}function v(b){return b===u||b===92?(e.consume(b),g):g(b)}}function pu(e,t){let n;return i;function i(a){return Ve(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,i):ot(a)?Nt(e,i,n?"linePrefix":"lineSuffix")(a):t(a)}}const H8={name:"definition",tokenize:V8},q8={partial:!0,tokenize:G8};function V8(e,t,n){const i=this;let a;return o;function o(y){return e.enter("definition"),u(y)}function u(y){return Fj.call(i,e,h,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function h(y){return a=fi(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)?pu(e,m)(y):m(y)}function m(y){return Uj(e,g,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function g(y){return e.attempt(q8,v,v)(y)}function v(y){return ot(y)?Nt(e,b,"whitespace")(y):b(y)}function b(y){return y===null||Ve(y)?(e.exit("definition"),i.parser.defined.push(a),t(y)):n(y)}}function G8(e,t,n){return i;function i(h){return Pt(h)?pu(e,a)(h):n(h)}function a(h){return Ij(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(h)}function o(h){return ot(h)?Nt(e,u,"whitespace")(h):u(h)}function u(h){return h===null||Ve(h)?t(h):n(h)}}const Y8={name:"hardBreakEscape",tokenize:Q8};function Q8(e,t,n){return i;function i(o){return e.enter("hardBreakEscape"),e.consume(o),a}function a(o){return Ve(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const X8={name:"headingAtx",resolve:W8,tokenize:K8};function W8(e,t){let n=e.length-2,i=3;if(e[i][1].type==="whitespace"&&(i+=2),n-2>i&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(i===n-1||n-4>i&&e[n-2][1].type==="whitespace")&&(n-=i+1===n?2:4),n>i){const a={type:"atxHeadingText",start:e[i][1].start,end:e[n][1].end},o={type:"chunkText",start:e[i][1].start,end:e[n][1].end,contentType:"text"};hi(e,i,n-i+1,[["enter",a,t],["enter",o,t],["exit",o,t],["exit",a,t]])}return e}function K8(e,t,n){let i=0;return a;function a(g){return e.enter("atxHeading"),o(g)}function o(g){return e.enter("atxHeadingSequence"),u(g)}function u(g){return g===35&&i++<6?(e.consume(g),u):g===null||Pt(g)?(e.exit("atxHeadingSequence"),h(g)):n(g)}function h(g){return g===35?(e.enter("atxHeadingSequence"),f(g)):g===null||Ve(g)?(e.exit("atxHeading"),t(g)):ot(g)?Nt(e,h,"whitespace")(g):(e.enter("atxHeadingText"),m(g))}function f(g){return g===35?(e.consume(g),f):(e.exit("atxHeadingSequence"),h(g))}function m(g){return g===null||g===35||Pt(g)?(e.exit("atxHeadingText"),h(g)):(e.consume(g),m)}}const Z8=["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"],H5=["pre","script","style","textarea"],J8={concrete:!0,name:"htmlFlow",resolveTo:tO,tokenize:nO},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,o,u,h,f;return m;function m(z){return g(z)}function g(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),o=!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:O:_):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&&!o&&H5.includes(oe)?(a=1,i.interrupt?t(z):O(z)):Z8.includes(u.toLowerCase())?(a=6,P?(e.consume(z),w):i.interrupt?t(z):O(z)):(a=7,i.interrupt&&!i.parser.lazy[i.now().line]?n(z):o?C(z):E(z))}return z===45||qn(z)?(e.consume(z),u+=String.fromCharCode(z),N):n(z)}function w(z){return z===62?(e.consume(z),i.interrupt?t:O):n(z)}function C(z){return ot(z)?(e.consume(z),C):U(z)}function E(z){return z===47?(e.consume(z),U):z===58||z===95||ss(z)?(e.consume(z),R):ot(z)?(e.consume(z),E):U(z)}function R(z){return z===45||z===46||z===58||z===95||qn(z)?(e.consume(z),R):M(z)}function M(z){return z===61?(e.consume(z),L):ot(z)?(e.consume(z),M):E(z)}function L(z){return z===null||z===60||z===61||z===62||z===96?n(z):z===34||z===39?(e.consume(z),f=z,F):ot(z)?(e.consume(z),L):D(z)}function F(z){return z===f?(e.consume(z),f=null,X):z===null||Ve(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)?M(z):(e.consume(z),D)}function X(z){return z===47||z===62||ot(z)?E(z):n(z)}function U(z){return z===62?(e.consume(z),G):n(z)}function G(z){return z===null||Ve(z)?O(z):ot(z)?(e.consume(z),G):n(z)}function O(z){return z===45&&a===2?(e.consume(z),H):z===60&&a===1?(e.consume(z),I):z===62&&a===4?(e.consume(z),Ee):z===63&&a===3?(e.consume(z),A):z===93&&a===5?(e.consume(z),ve):Ve(z)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(eO,Me,de)(z)):z===null||Ve(z)?(e.exit("htmlFlowData"),de(z)):(e.consume(z),O)}function de(z){return e.check(ix,W,Me)(z)}function W(z){return e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),q}function q(z){return z===null||Ve(z)?de(z):(e.enter("htmlFlowData"),O(z))}function H(z){return z===45?(e.consume(z),A):O(z)}function I(z){return z===47?(e.consume(z),u="",re):O(z)}function re(z){if(z===62){const P=u.toLowerCase();return H5.includes(P)?(e.consume(z),Ee):O(z)}return ss(z)&&u.length<8?(e.consume(z),u+=String.fromCharCode(z),re):O(z)}function ve(z){return z===93?(e.consume(z),A):O(z)}function A(z){return z===62?(e.consume(z),Ee):z===45&&a===2?(e.consume(z),A):O(z)}function Ee(z){return z===null||Ve(z)?(e.exit("htmlFlowData"),Me(z)):(e.consume(z),Ee)}function Me(z){return e.exit("htmlFlow"),t(z)}}function sO(e,t,n){return i;function i(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(Lu,t,n)}}const iO={name:"htmlText",tokenize:rO};function rO(e,t,n){const i=this;let a,o,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),M):A===63?(e.consume(A),E):ss(A)?(e.consume(A),D):n(A)}function m(A){return A===45?(e.consume(A),g):A===91?(e.consume(A),o=0,_):ss(A)?(e.consume(A),C):n(A)}function g(A){return A===45?(e.consume(A),y):n(A)}function v(A){return A===null?n(A):A===45?(e.consume(A),b):Ve(A)?(u=v,I(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(o++)?(e.consume(A),o===Ee.length?j:_):n(A)}function j(A){return A===null?n(A):A===93?(e.consume(A),N):Ve(A)?(u=j,I(A)):(e.consume(A),j)}function N(A){return A===93?(e.consume(A),w):j(A)}function w(A){return A===62?H(A):A===93?(e.consume(A),w):j(A)}function C(A){return A===null||A===62?H(A):Ve(A)?(u=C,I(A)):(e.consume(A),C)}function E(A){return A===null?n(A):A===63?(e.consume(A),R):Ve(A)?(u=E,I(A)):(e.consume(A),E)}function R(A){return A===62?H(A):E(A)}function M(A){return ss(A)?(e.consume(A),L):n(A)}function L(A){return A===45||qn(A)?(e.consume(A),L):F(A)}function F(A){return Ve(A)?(u=F,I(A)):ot(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)?X(A):n(A)}function X(A){return A===47?(e.consume(A),H):A===58||A===95||ss(A)?(e.consume(A),U):Ve(A)?(u=X,I(A)):ot(A)?(e.consume(A),X):H(A)}function U(A){return A===45||A===46||A===58||A===95||qn(A)?(e.consume(A),U):G(A)}function G(A){return A===61?(e.consume(A),O):Ve(A)?(u=G,I(A)):ot(A)?(e.consume(A),G):X(A)}function O(A){return A===null||A===60||A===61||A===62||A===96?n(A):A===34||A===39?(e.consume(A),a=A,de):Ve(A)?(u=O,I(A)):ot(A)?(e.consume(A),O):(e.consume(A),W)}function de(A){return A===a?(e.consume(A),a=void 0,q):A===null?n(A):Ve(A)?(u=de,I(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)?X(A):(e.consume(A),W)}function q(A){return A===47||A===62||Pt(A)?X(A):n(A)}function H(A){return A===62?(e.consume(A),e.exit("htmlTextData"),e.exit("htmlText"),t):n(A)}function I(A){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),re}function re(A){return ot(A)?Nt(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:cO,resolveTo:uO,tokenize:dO},aO={tokenize:hO},lO={tokenize:fO},oO={tokenize:pO};function cO(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&&hi(e,0,e.length,n),e}function uO(e,t){let n=e.length,i=0,a,o,u;for(;n--;){const g=e[n][1];if(a){if(g.type==="link"||g.type==="labelLink"&&g._inactive)break;e[n][0]==="enter"&&g.type==="labelLink"&&(g._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(g.type==="labelImage"||g.type==="labelLink")&&!g._balanced&&(a=n,g.type!=="labelLink")){i=2;break}}else g.type==="labelEnd"&&(o=n)}const h={type:e[a][1].type==="labelLink"?"link":"image",start:{...e[a][1].start},end:{...e[e.length-1][1].end}},f={type:"label",start:{...e[a][1].start},end:{...e[o][1].end}},m={type:"labelText",start:{...e[a+i+2][1].end},end:{...e[o-2][1].start}};return u=[["enter",h,t],["enter",f,t]],u=Ys(u,e.slice(a+1,a+i+3)),u=Ys(u,[["enter",m,t]]),u=Ys(u,kf(t.parser.constructs.insideSpan.null,e.slice(a+i+4,o-3),t)),u=Ys(u,[["exit",m,t],e[o-2],e[o-1],["exit",f,t]]),u=Ys(u,e.slice(o+1)),u=Ys(u,[["exit",h,t]]),hi(e,a,e.length,u),e}function dO(e,t,n){const i=this,a=i._labelStarts;let o,u;if(a){for(;a.length>0&&a[a.length-1]._balanced;)a.pop();o=a[a.length-1]}return h;function h(b){return o?o._inactive?v(b):(u=i.parser.defined.includes(fi(i.sliceSerialize({start:o.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(aO,g,u?g:v)(b):b===91?e.attempt(lO,g,u?m:v)(b):u?g(b):v(b)}function m(b){return e.attempt(oO,g,v)(b)}function g(b){return a.pop(),t(b)}function v(b){return o._balanced=!0,n(b)}}function hO(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)?pu(e,o)(v):o(v)}function o(v){return v===41?g(v):Uj(e,u,h,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(v)}function u(v){return Pt(v)?pu(e,f)(v):g(v)}function h(v){return n(v)}function f(v){return v===34||v===39||v===40?Ij(e,m,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(v):g(v)}function m(v){return Pt(v)?pu(e,g)(v):g(v)}function g(v){return v===41?(e.enter("resourceMarker"),e.consume(v),e.exit("resourceMarker"),e.exit("resource"),t):n(v)}}function fO(e,t,n){const i=this;return a;function a(h){return Fj.call(i,e,o,u,"reference","referenceMarker","referenceString")(h)}function o(h){return i.parser.defined.includes(fi(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?t(h):n(h)}function u(h){return n(h)}}function pO(e,t,n){return i;function i(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),a}function a(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const mO={name:"labelStartImage",resolveAll:Wx.resolveAll,tokenize:gO};function gO(e,t,n){const i=this;let a;return o;function o(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),u}function u(f){return f===91?(e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),a=e.exit("labelImage"),h):n(f)}function h(f){return f===94&&"_hiddenFootnoteSupport"in i.parser.constructs?n(f):(i._labelStarts=i._labelStarts||[],i._labelStarts.push(a),t(f))}}const xO={name:"labelStartLink",resolveAll:Wx.resolveAll,tokenize:vO};function vO(e,t,n){const i=this;let a;return o;function o(h){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),a=e.exit("labelLink"),u}function u(h){return h===94&&"_hiddenFootnoteSupport"in i.parser.constructs?n(h):(i._labelStarts=i._labelStarts||[],i._labelStarts.push(a),t(h))}}const Xg={name:"lineEnding",tokenize:bO};function bO(e,t){return n;function n(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),Nt(e,t,"linePrefix")}}const $h={name:"thematicBreak",tokenize:yO};function yO(e,t,n){let i=0,a;return o;function o(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||Ve(m))?(e.exit("thematicBreak"),t(m)):n(m)}function f(m){return m===a?(e.consume(m),i++,f):(e.exit("thematicBreakSequence"),ot(m)?Nt(e,h,"whitespace")(m):h(m))}}const ps={continuation:{tokenize:kO},exit:NO,name:"list",tokenize:SO},_O={partial:!0,tokenize:CO},wO={partial:!0,tokenize:jO};function SO(e,t,n){const i=this,a=i.events[i.events.length-1];let o=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,u=0;return h;function h(y){const _=i.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(_==="listUnordered"?!i.containerState.marker||y===i.containerState.marker:nx(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 nx(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:g,e.attempt(_O,b,v))}function g(y){return i.containerState.initialBlankLine=!0,o++,b(y)}function v(y){return ot(y)?(e.enter("listItemPrefixWhitespace"),e.consume(y),e.exit("listItemPrefixWhitespace"),b):n(y)}function b(y){return i.containerState.size=o+i.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(y)}}function kO(e,t,n){const i=this;return i.containerState._closeFlow=void 0,e.check(Lu,a,o);function a(h){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,Nt(e,t,"listItemIndent",i.containerState.size+1)(h)}function o(h){return i.containerState.furtherBlankLines||!ot(h)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,u(h)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,e.attempt(wO,t,u)(h))}function u(h){return i.containerState._closeFlow=!0,i.interrupt=void 0,Nt(e,e.attempt(ps,t,n),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(h)}}function jO(e,t,n){const i=this;return Nt(e,a,"listItemIndent",i.containerState.size+1);function a(o){const u=i.events[i.events.length-1];return u&&u[1].type==="listItemIndent"&&u[2].sliceSerialize(u[1],!0).length===i.containerState.size?t(o):n(o)}}function NO(e){e.exit(this.containerState.type)}function CO(e,t,n){const i=this;return Nt(e,a,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(o){const u=i.events[i.events.length-1];return!ot(o)&&u&&u[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const q5={name:"setextUnderline",resolveTo:EO,tokenize:TO};function EO(e,t){const n=new cf;let i=e.length,a,o,u;for(;i--;)if(e[i][0]==="enter"){if(e[i][1].type==="content"){a=i;break}e[i][1].type==="paragraph"&&(o=i)}else e[i][1].type==="content"&&n.add(i,1,[]),!u&&e[i][1].type==="definition"&&(u=i);const h={type:"setextHeading",start:{...e[a][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",u?(n.add(o,0,[["enter",h,t]]),n.add(u+1,0,[["exit",e[a][1],t]]),e[a][1].end={...e[u][1].end}):e[a][1]=h,n.add(e.length,0,[["exit",h,t]]),n.consume(e),e}function TO(e,t,n){const i=this;let a;return o;function o(m){let g=i.events.length,v;for(;g--;)if(i.events[g][1].type!=="lineEnding"&&i.events[g][1].type!=="linePrefix"&&i.events[g][1].type!=="content"){v=i.events[g][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||v)?(e.enter("setextHeadingLine"),a=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"),ot(m)?Nt(e,f,"lineSuffix")(m):f(m))}function f(m){return m===null||Ve(m)?(e.exit("setextHeadingLine"),t(m)):n(m)}}const AO={tokenize:MO};function MO(e){const t=this,n=e.attempt(Lu,i,e.attempt(this.parser.constructs.flowInitial,a,Nt(e,e.attempt(this.parser.constructs.flow,a,e.attempt(B8,a)),"linePrefix")));return n;function i(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const RO={resolveAll:qj()},OO=Hj("string"),LO=Hj("text");function Hj(e){return{resolveAll:qj(e==="text"?DO:void 0),tokenize:t};function t(n){const i=this,a=this.parser.constructs[e],o=n.attempt(a,u,h);return u;function u(g){return m(g)?o(g):h(g)}function h(g){if(g===null){n.consume(g);return}return n.enter("data"),n.consume(g),f}function f(g){return m(g)?(n.exit("data"),o(g)):(n.consume(g),f)}function m(g){if(g===null)return!0;const v=a[g];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 qj(e){return t;function t(n,i){let a=-1,o;for(;++a<=n.length;)o===void 0?n[a]&&n[a][1].type==="data"&&(o=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==o+2&&(n[o][1].end=n[a-1][1].end,n.splice(o+2,a-o-2),a=o+2),o=void 0);return e?e(n,i):n}}function DO(e,t){const n=new cf;let i=0;for(;++i<=e.length;)if((i===e.length||e[i][1].type==="lineEnding")&&e[i-1][1].type==="data"){const a=e[i-1][1],o=t.sliceStream(a);let u=o.length,h=-1,f=0,m;for(;u--;){const g=o[u];if(typeof g=="string"){for(h=g.length;g.charCodeAt(h-1)===32;)f++,h--;if(h)break;h=-1}else if(g===-2)m=!0,f++;else if(g!==-1){u++;break}}if(t._contentTypeTextTrailing&&i===e.length&&(f=0),f){const g={type:i===e.length||m||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:u?h:a.start._bufferIndex+h,_index:a.start._index+u,line:a.end.line,column:a.end.column-f,offset:a.end.offset-f},end:{...a.end}};a.end={...g.start},a.start.offset===a.end.offset?Object.assign(a,g):n.add(i,0,[["enter",g,t],["exit",g,t]])}i++}return n.consume(e),e}const zO={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:zj},$O={91:H8},BO={[-2]:Qg,[-1]:Qg,32:Qg},PO={35:X8,42:$h,45:[q5,$h],60:J8,61:q5,95:$h,96:I5,126:I5},UO={38:Bj,92:$j},FO={[-5]:Xg,[-4]:Xg,[-3]:Xg,33:mO,38:Bj,42:sx,60:[b8,iO],91:xO,92:[Y8,$j],93:Wx,95:sx,96:R8},IO={null:[sx,RO]},HO={null:[42,95]},qO={null:[]},VO=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:HO,contentInitial:$O,disable:qO,document:zO,flow:PO,flowInitial:BO,insideSpan:IO,string:UO,text:FO},Symbol.toStringTag,{value:"Module"}));function GO(e,t,n){let i={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},o=[];let u=[],h=[];const f={attempt:F(M),check:F(L),consume:C,enter:E,exit:R,interrupt:F(L,{interrupt:!0})},m={code:null,containerState:{},defineSkip:j,events:[],now:_,parser:e,previous:null,sliceSerialize:b,sliceStream:y,write:v};let g=t.tokenize.call(m,f);return t.resolveAll&&o.push(t),m;function v(G){return u=Ys(u,G),N(),u[u.length-1]!==null?[]:(D(t,0),m.events=kf(o,m.events,m),m.events)}function b(G,O){return QO(y(G),O)}function y(G){return YO(u,G)}function _(){const{_bufferIndex:G,_index:O,line:de,column:W,offset:q}=i;return{_bufferIndex:G,_index:O,line:de,column:W,offset:q}}function j(G){a[G.line]=G.column,U()}function N(){for(;i._index<u.length;){const G=u[i._index];if(typeof G=="string"){const O=i._index;for(i._bufferIndex<0&&(i._bufferIndex=0);i._index===O&&i._bufferIndex<G.length;)w(G.charCodeAt(i._bufferIndex))}else w(G)}}function w(G){g=g(G)}function C(G){Ve(G)?(i.line++,i.column=1,i.offset+=G===-3?2:1,U()):G!==-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=G}function E(G,O){const de=O||{};return de.type=G,de.start=_(),m.events.push(["enter",de,m]),h.push(de),de}function R(G){const O=h.pop();return O.end=_(),m.events.push(["exit",O,m]),O}function M(G,O){D(G,O.from)}function L(G,O){O.restore()}function F(G,O){return de;function de(W,q,H){let I,re,ve,A;return Array.isArray(W)?Me(W):"tokenize"in W?Me([W]):Ee(W);function Ee(we){return Ne;function Ne(Ae){const De=Ae!==null&&we[Ae],ze=Ae!==null&&we.null,Ce=[...Array.isArray(De)?De:De?[De]:[],...Array.isArray(ze)?ze:ze?[ze]:[]];return Me(Ce)(Ae)}}function Me(we){return I=we,re=0,we.length===0?H:z(we[re])}function z(we){return Ne;function Ne(Ae){return A=X(),ve=we,we.partial||(m.currentConstruct=we),we.name&&m.parser.constructs.disable.null.includes(we.name)?oe():we.tokenize.call(O?Object.assign(Object.create(m),O):m,f,P,oe)(Ae)}}function P(we){return G(ve,A),q}function oe(we){return A.restore(),++re<I.length?z(I[re]):H}}}function D(G,O){G.resolveAll&&!o.includes(G)&&o.push(G),G.resolve&&hi(m.events,O,m.events.length-O,G.resolve(m.events.slice(O),m)),G.resolveTo&&(m.events=G.resolveTo(m.events,m))}function X(){const G=_(),O=m.previous,de=m.currentConstruct,W=m.events.length,q=Array.from(h);return{from:W,restore:H};function H(){i=G,m.previous=O,m.currentConstruct=de,m.events.length=W,h=q,U()}}function U(){i.line in a&&i.column<2&&(i.column=a[i.line],i.offset+=a[i.line]-1)}}function YO(e,t){const n=t.start._index,i=t.start._bufferIndex,a=t.end._index,o=t.end._bufferIndex;let u;if(n===a)u=[e[n].slice(i,o)];else{if(u=e.slice(n,a),i>-1){const h=u[0];typeof h=="string"?u[0]=h.slice(i):u.shift()}o>0&&u.push(e[a].slice(0,o))}return u}function QO(e,t){let n=-1;const i=[];let a;for(;++n<e.length;){const o=e[n];let u;if(typeof o=="string")u=o;else switch(o){case-5:{u="\r";break}case-4:{u=`
|
|
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(o)}a=o===-2,i.push(u)}return i.join("")}function XO(e){const i={constructs:Oj([VO,...(e||{}).extensions||[]]),content:a(h8),defined:[],document:a(p8),flow:a(AO),lazy:{},string:a(OO),text:a(LO)};return i;function a(o){return u;function u(h){return GO(i,o,h)}}}function WO(e){for(;!Pj(e););return e}const V5=/[\0\t\n\r]/g;function KO(){let e=1,t="",n=!0,i;return a;function a(o,u,h){o=t+(typeof o=="string"?o.toString():new TextDecoder(u||void 0).decode(o));const f=[];let m=0;for(t="",n&&(o.charCodeAt(0)===65279&&m++,n=void 0);m<o.length;){V5.lastIndex=m;const g=V5.exec(o),v=g&&g.index!==void 0?g.index:o.length,b=o.charCodeAt(v);if(!g){t=o.slice(m);break}if(b===10&&m===v&&i)f.push(-3),i=void 0;else switch(i&&(f.push(-5),i=void 0),m<v&&(f.push(o.slice(m,v)),e+=v-m),b){case 0:{f.push(65533),e++;break}case 9:{const y=Math.ceil(e/4)*4;for(f.push(-2);e++<y;)f.push(-1);break}case 10:{f.push(-4),e=1;break}default:i=!0,e=1}m=v+1}return h&&(i&&f.push(-5),t&&f.push(t),f.push(null)),f}}const ZO=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function JO(e){return e.replace(ZO,e7)}function e7(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),o=a===120||a===88;return Lj(n.slice(o?2:1),o?16:10)}return Xx(n)||e}const Vj={}.hasOwnProperty;function t7(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),n7(n)(WO(XO(n).document().write(KO()(e,t,!0))))}function n7(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(St),autolinkProtocol:X,autolinkEmail:X,atxHeading:o(Ft),blockQuote:o(ze),characterEscape:X,characterReference:X,codeFenced:o(Ce),codeFencedFenceInfo:u,codeFencedFenceMeta:u,codeIndented:o(Ce,u),codeText:o(Re,u),codeTextData:X,data:X,codeFlowValue:X,definition:o(Ut),definitionDestinationString:u,definitionLabelString:u,definitionTitleString:u,emphasis:o(Kt),hardBreakEscape:o(jt),hardBreakTrailing:o(jt),htmlFlow:o(wt,u),htmlFlowData:X,htmlText:o(wt,u),htmlTextData:X,image:o(Xe),label:u,link:o(St),listItem:o(se),listItemValue:b,listOrdered:o(nn,v),listUnordered:o(nn),paragraph:o(je),reference:z,referenceString:u,resourceDestinationString:u,resourceTitleString:u,setextHeading:o(Ft),strong:o(Qe),thematicBreak:o(un)},exit:{atxHeading:f(),atxHeadingSequence:M,autolink:f(),autolinkEmail:De,autolinkProtocol:Ae,blockQuote:f(),characterEscapeValue:U,characterReferenceMarkerHexadecimal:oe,characterReferenceMarkerNumeric:oe,characterReferenceValue:we,characterReference:Ne,codeFenced:f(N),codeFencedFence:j,codeFencedFenceInfo:y,codeFencedFenceMeta:_,codeFlowValue:U,codeIndented:f(w),codeText:f(q),codeTextData:U,data:U,definition:f(),definitionDestinationString:R,definitionLabelString:C,definitionTitleString:E,emphasis:f(),hardBreakEscape:f(O),hardBreakTrailing:f(O),htmlFlow:f(de),htmlFlowData:U,htmlText:f(W),htmlTextData:U,image:f(I),label:ve,labelText:re,lineEnding:G,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:L,strong:f(),thematicBreak:f()}};Gj(t,(e||{}).mdastExtensions||[]);const n={};return i;function i(ce){let be={type:"root",children:[]};const Y={stack:[be],tokenStack:[],config:t,enter:h,exit:m,buffer:u,resume:g,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]];Vj.call(Ke,ce[Pe][1].type)&&Ke[ce[Pe][1].type].call(Object.assign({sliceSerialize:ce[Pe][2].sliceSerialize},Y),ce[Pe][1])}if(Y.tokenStack.length>0){const Ke=Y.tokenStack[Y.tokenStack.length-1];(Ke[1]||G5).call(Y,void 0,Ke[0])}for(be.position={start:ta(ce.length>0?ce[0][1].start:{line:1,column:1,offset:0}),end:ta(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,Y){let me=be-1,Pe=-1,Ke=!1,at,ht,fn,is;for(;++me<=Y;){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 Un=ce[vs];if(Un[1].type==="lineEnding"||Un[1].type==="lineEndingBlank"){if(Un[0]==="exit")continue;ht&&(ce[ht][1].type="lineEndingBlank",Ke=!0),Un[1].type="lineEnding",ht=vs}else if(!(Un[1].type==="linePrefix"||Un[1].type==="blockQuotePrefix"||Un[1].type==="blockQuotePrefixWhitespace"||Un[1].type==="blockQuoteMarker"||Un[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++,Y++}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++,Y++,fn=void 0,is=!0}}}return ce[be][1]._spread=Ke,Y}function o(ce,be){return Y;function Y(me){h.call(this,ce(me),me),be&&be.call(this,me)}}function u(){this.stack.push({type:"fragment",children:[]})}function h(ce,be,Y){this.stack[this.stack.length-1].children.push(ce),this.stack.push(ce),this.tokenStack.push([be,Y||void 0]),ce.position={start:ta(be.start),end:void 0}}function f(ce){return be;function be(Y){ce&&ce.call(this,Y),m.call(this,Y)}}function m(ce,be){const Y=this.stack.pop(),me=this.tokenStack.pop();if(me)me[0].type!==ce.type&&(be?be.call(this,ce,me[0]):(me[1]||G5).call(this,ce,me[0]));else throw new Error("Cannot close `"+ce.type+"` ("+fu({start:ce.start,end:ce.end})+"): it’s not open");Y.position.end=ta(ce.end)}function g(){return Qx(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 w(){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(),Y=this.stack[this.stack.length-1];Y.label=be,Y.identifier=fi(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 M(ce){const be=this.stack[this.stack.length-1];if(!be.depth){const Y=this.sliceSerialize(ce).length;be.depth=Y}}function L(){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 X(ce){const Y=this.stack[this.stack.length-1].children;let me=Y[Y.length-1];(!me||me.type!=="text")&&(me=et(),me.position={start:ta(ce.start),end:void 0},Y.push(me)),this.stack.push(me)}function U(ce){const be=this.stack.pop();be.value+=this.sliceSerialize(ce),be.position.end=ta(ce.end)}function G(ce){const be=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Y=be.children[be.children.length-1];Y.position.end=ta(ce.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(be.type)&&(X.call(this,ce),U.call(this,ce))}function O(){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 I(){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),Y=this.stack[this.stack.length-2];Y.label=JO(be),Y.identifier=fi(be).toLowerCase()}function ve(){const ce=this.stack[this.stack.length-1],be=this.resume(),Y=this.stack[this.stack.length-1];if(this.data.inReference=!0,Y.type==="link"){const me=ce.children;Y.children=me}else Y.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(),Y=this.stack[this.stack.length-1];Y.label=be,Y.identifier=fi(this.sliceSerialize(ce)).toLowerCase(),this.data.referenceType="full"}function oe(ce){this.data.characterReferenceType=ce.type}function we(ce){const be=this.sliceSerialize(ce),Y=this.data.characterReferenceType;let me;Y?(me=Lj(be,Y==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):me=Xx(be);const Pe=this.stack[this.stack.length-1];Pe.value+=me}function Ne(ce){const be=this.stack.pop();be.position.end=ta(ce.end)}function Ae(ce){U.call(this,ce);const be=this.stack[this.stack.length-1];be.url=this.sliceSerialize(ce)}function De(ce){U.call(this,ce);const be=this.stack[this.stack.length-1];be.url="mailto:"+this.sliceSerialize(ce)}function ze(){return{type:"blockquote",children:[]}}function Ce(){return{type:"code",lang:null,meta:null,value:""}}function Re(){return{type:"inlineCode",value:""}}function Ut(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Kt(){return{type:"emphasis",children:[]}}function Ft(){return{type:"heading",depth:0,children:[]}}function jt(){return{type:"break"}}function wt(){return{type:"html",value:""}}function Xe(){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 Qe(){return{type:"strong",children:[]}}function et(){return{type:"text",value:""}}function un(){return{type:"thematicBreak"}}}function ta(e){return{line:e.line,column:e.column,offset:e.offset}}function Gj(e,t){let n=-1;for(;++n<t.length;){const i=t[n];Array.isArray(i)?Gj(e,i):s7(e,i)}}function s7(e,t){let n;for(n in t)if(Vj.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 G5(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+fu({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+fu({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+fu({start:t.start,end:t.end})+") is still open")}function i7(e){const t=this;t.parser=n;function n(i){return t7(i,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function r7(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 a7(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
75
|
-
`}]}function l7(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 o={type:"element",tagName:"code",properties:i,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function o7(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function c7(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function u7(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=String(t.identifier).toUpperCase(),a=Mo(i.toLowerCase()),o=e.footnoteOrder.indexOf(i);let u,h=e.footnoteCounts.get(i);h===void 0?(h=0,e.footnoteOrder.push(i),u=e.footnoteOrder.length):u=o+1,h+=1,e.footnoteCounts.set(i,h);const f={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(h>1?"-"+h:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(u)}]};e.patch(t,f);const m={type:"element",tagName:"sup",properties:{},children:[f]};return e.patch(t,m),e.applyData(t,m)}function d7(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 h7(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Yj(e,t){const n=t.referenceType;let i="]";if(n==="collapsed"?i+="[]":n==="full"&&(i+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+i}];const a=e.all(t),o=a[0];o&&o.type==="text"?o.value="["+o.value:a.unshift({type:"text",value:"["});const u=a[a.length-1];return u&&u.type==="text"?u.value+=i:a.push({type:"text",value:i}),a}function f7(e,t){const n=String(t.identifier).toUpperCase(),i=e.definitionById.get(n);if(!i)return Yj(e,t);const a={src:Mo(i.url||""),alt:t.alt};i.title!==null&&i.title!==void 0&&(a.title=i.title);const o={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,o),e.applyData(t,o)}function p7(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 m7(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 g7(e,t){const n=String(t.identifier).toUpperCase(),i=e.definitionById.get(n);if(!i)return Yj(e,t);const a={href:Mo(i.url||"")};i.title!==null&&i.title!==void 0&&(a.title=i.title);const o={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function x7(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 v7(e,t,n){const i=e.all(t),a=n?b7(n):Qj(t),o={},u=[];if(typeof t.checked=="boolean"){const g=i[0];let v;g&&g.type==="element"&&g.tagName==="p"?v=g:(v={type:"element",tagName:"p",properties:{},children:[]},i.unshift(v)),v.children.length>0&&v.children.unshift({type:"text",value:" "}),v.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let h=-1;for(;++h<i.length;){const g=i[h];(a||h!==0||g.type!=="element"||g.tagName!=="p")&&u.push({type:"text",value:`
|
|
77
|
-
`}),g.type==="element"&&g.tagName==="p"&&!a?u.push(...g.children):u.push(g)}const f=i[i.length-1];f&&(a||f.type!=="element"||f.tagName!=="p")&&u.push({type:"text",value:`
|
|
78
|
-
`});const m={type:"element",tagName:"li",properties:o,children:u};return e.patch(t,m),e.applyData(t,m)}function b7(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 y7(e,t){const n={},i=e.all(t);let a=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++a<i.length;){const u=i[a];if(u.type==="element"&&u.tagName==="li"&&u.properties&&Array.isArray(u.properties.className)&&u.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(i,!0)};return e.patch(t,o),e.applyData(t,o)}function _7(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function w7(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function S7(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function k7(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=Nj(t.children[t.children.length-1]);h&&f&&(u.position={start:h,end:f}),a.push(u)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,o),e.applyData(t,o)}function j7(e,t,n){const i=n?n.children:void 0,o=(i?i.indexOf(t):1)===0?"th":"td",u=n&&n.type==="table"?n.align:void 0,h=u?u.length:t.children.length;let f=-1;const m=[];for(;++f<h;){const v=t.children[f],b={},y=u?u[f]:void 0;y&&(b.align=y);let _={type:"element",tagName:o,properties:b,children:[]};v&&(_.children=e.all(v),e.patch(v,_),_=e.applyData(v,_)),m.push(_)}const g={type:"element",tagName:"tr",properties:{},children:e.wrap(m,!0)};return e.patch(t,g),e.applyData(t,g)}function N7(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Y5=9,Q5=32;function C7(e){const t=String(e),n=/\r?\n|\r/g;let i=n.exec(t),a=0;const o=[];for(;i;)o.push(X5(t.slice(a,i.index),a>0,!0),i[0]),a=i.index+i[0].length,i=n.exec(t);return o.push(X5(t.slice(a),a>0,!1)),o.join("")}function X5(e,t,n){let i=0,a=e.length;if(t){let o=e.codePointAt(i);for(;o===Y5||o===Q5;)i++,o=e.codePointAt(i)}if(n){let o=e.codePointAt(a-1);for(;o===Y5||o===Q5;)a--,o=e.codePointAt(a-1)}return a>i?e.slice(i,a):""}function E7(e,t){const n={type:"text",value:C7(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function T7(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const A7={blockquote:r7,break:a7,code:l7,delete:o7,emphasis:c7,footnoteReference:u7,heading:d7,html:h7,imageReference:f7,image:p7,inlineCode:m7,linkReference:g7,link:x7,listItem:v7,list:y7,paragraph:_7,root:w7,strong:S7,table:k7,tableCell:N7,tableRow:j7,text:E7,thematicBreak:T7,toml:xh,yaml:xh,definition:xh,footnoteDefinition:xh};function xh(){}const Xj=-1,jf=0,mu=1,df=2,Kx=3,Zx=4,Jx=5,ev=6,Wj=7,Kj=8,{defineProperty:M7}=Object,Zj=typeof self=="object"?self:globalThis,W5=(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 Zj[e](t)},R7=(e,t)=>{const n=(a,o)=>(e.set(o,a),a),i=a=>{if(e.has(a))return e.get(a);const[o,u]=t[a];switch(o){case jf:case Xj:return n(u,a);case mu:{const h=n([],a);for(const f of u)h.push(i(f));return h}case df:{const h=n({},a);for(const[f,m]of u){const g=i(f),v=i(m);g==="__proto__"?M7(h,g,{value:v,configurable:!0,enumerable:!0,writable:!0}):h[g]=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 Wj:{const{name:h,message:f}=u;return n(typeof Zj[h]=="function"?W5(h,f):new Error(f),a)}case Kj: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(W5(o,u),a)};return i},K5=e=>R7(new Map,e)(0),Ja="",{toString:O7}={},{keys:L7,is:D7}=Object,Yc=e=>{const t=typeof e;if(t!=="object"||!e)return[jf,t];const n=O7.call(e).slice(8,-1);switch(n){case"Array":return[mu,Ja];case"Object":return[df,Ja];case"Date":return[Kx,Ja];case"RegExp":return[Zx,Ja];case"Map":return[Jx,Ja];case"Set":return[ev,Ja];case"DataView":return[mu,n]}return n.includes("Array")?[mu,n]:e instanceof Error?[Wj,e.name||"Error"]:[df,n]},vh=([e,t])=>e===jf&&(t==="function"||t==="symbol"),z7=(e,t,n,i)=>{const a=(u,h)=>{const f=i.push(u)-1;return n.set(h,f),f},o=u=>{if(n.has(u))return n.get(u);let[h,f]=Yc(u);switch(h){case jf:{let g=u;switch(f){case"bigint":h=Kj,g=u.toString();break;case"number":if(!u&&D7(u,-0))return i.push(["-0"])-1;break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+f);g=null;break;case"undefined":return a([Xj],u)}return a([h,g],u)}case mu:{if(f){let b=u;return f==="DataView"?b=new Uint8Array(u.buffer):f==="ArrayBuffer"&&(b=new Uint8Array(u)),a([f,[...b]],u)}const g=[],v=a([h,g],u);for(const b of u)g.push(o(b));return v}case df:{if(f)switch(f){case"BigInt":return a([f,u.toString()],u);case"Boolean":case"Number":case"String":return a([f,u.valueOf()],u)}if(t&&"toJSON"in u)return o(u.toJSON());const g=[],v=a([h,g],u);for(const b of L7(u))(e||!vh(Yc(u[b])))&&g.push([o(b),o(u[b])]);return v}case Kx:return a([h,isNaN(u.getTime())?Ja:u.toISOString()],u);case Zx:{const{source:g,flags:v}=u;return a([h,{source:g,flags:v}],u)}case Jx:{const g=[],v=a([h,g],u);for(const[b,y]of u)(e||!(vh(Yc(b))||vh(Yc(y))))&&g.push([o(b),o(y)]);return v}case ev:{const g=[],v=a([h,g],u);for(const b of u)(e||!vh(Yc(b)))&&g.push(o(b));return v}}const{message:m}=u;return a([h,{name:f,message:m}],u)};return o},Z5=(e,{json:t,lossy:n}={})=>{const i=[];return z7(!(t||n),!!t,new Map,i)(e),i},hf=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?K5(Z5(e,t)):structuredClone(e):(e,t)=>K5(Z5(e,t));function $7(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 B7(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function P7(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||$7,i=e.options.footnoteBackLabel||B7,a=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",u=e.options.footnoteLabelProperties||{className:["sr-only"]},h=[];let f=-1;for(;++f<e.footnoteOrder.length;){const m=e.footnoteById.get(e.footnoteOrder[f]);if(!m)continue;const g=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=g[g.length-1];if(N&&N.type==="element"&&N.tagName==="p"){const C=N.children[N.children.length-1];C&&C.type==="text"?C.value+=" ":N.children.push({type:"text",value:" "}),N.children.push(..._)}else g.push(..._);const w={type:"element",tagName:"li",properties:{id:t+"fn-"+b},children:e.wrap(g,!0)};e.patch(m,w),h.push(w)}if(h.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...hf(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 H7;if(typeof e=="function")return Cf(e);if(typeof e=="object")return Array.isArray(e)?U7(e):F7(e);if(typeof e=="string")return I7(e);throw new Error("Expected function, string, or object as test")});function U7(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Nf(e[n]);return Cf(i);function i(...a){let o=-1;for(;++o<t.length;)if(t[o].apply(this,a))return!0;return!1}}function F7(e){const t=e;return Cf(n);function n(i){const a=i;let o;for(o in e)if(a[o]!==t[o])return!1;return!0}}function I7(e){return Cf(t);function t(n){return n&&n.type===e}}function Cf(e){return t;function t(n,i,a){return!!(q7(n)&&e.call(this,n,typeof i=="number"?i:void 0,a||void 0))}}function H7(){return!0}function q7(e){return e!==null&&typeof e=="object"&&"type"in e}const Jj=[],V7=!0,rx=!1,G7="skip";function eN(e,t,n,i){let a;typeof t=="function"&&typeof n!="function"?(i=n,n=t):a=t;const o=Nf(a),u=i?-1:1;h(e,void 0,[])();function h(f,m,g){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=Jj,_,j,N;if((!t||o(f,m,g[g.length-1]||void 0))&&(y=Y7(n(f,g)),y[0]===rx))return y;if("children"in f&&f.children){const w=f;if(w.children&&y[0]!==G7)for(j=(i?w.children.length:-1)+u,N=g.concat(w);j>-1&&j<w.children.length;){const C=w.children[j];if(_=h(C,j,N)(),_[0]===rx)return _;j=typeof _[1]=="number"?_[1]:j+u}}return y}}}function Y7(e){return Array.isArray(e)?e:typeof e=="number"?[V7,e]:e==null?Jj:[e]}function tv(e,t,n,i){let a,o,u;typeof t=="function"&&typeof n!="function"?(o=void 0,u=t,a=n):(o=t,u=n,a=i),eN(e,o,h,a);function h(f,m){const g=m[m.length-1],v=g?g.children.indexOf(f):void 0;return u(f,v,g)}}const ax={}.hasOwnProperty,Q7={};function X7(e,t){const n=t||Q7,i=new Map,a=new Map,o=new Map,u={...A7,...n.handlers},h={all:m,applyData:K7,definitionById:i,footnoteById:a,footnoteCounts:o,footnoteOrder:[],handlers:u,one:f,options:n,patch:W7,wrap:J7};return tv(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const v=g.type==="definition"?i:a,b=String(g.identifier).toUpperCase();v.has(b)||v.set(b,g)}}),h;function f(g,v){const b=g.type,y=h.handlers[b];if(ax.call(h.handlers,b)&&y)return y(h,g,v);if(h.options.passThrough&&h.options.passThrough.includes(b)){if("children"in g){const{children:j,...N}=g,w=hf(N);return w.children=h.all(g),w}return hf(g)}return(h.options.unknownHandler||Z7)(h,g,v)}function m(g){const v=[];if("children"in g){const b=g.children;let y=-1;for(;++y<b.length;){const _=h.one(b[y],g);if(_){if(y&&b[y-1].type==="break"&&(!Array.isArray(_)&&_.type==="text"&&(_.value=J5(_.value)),!Array.isArray(_)&&_.type==="element")){const j=_.children[0];j&&j.type==="text"&&(j.value=J5(j.value))}Array.isArray(_)?v.push(..._):v.push(_)}}}return v}}function W7(e,t){e.position&&(t.position=BR(e))}function K7(e,t){let n=t;if(e&&e.data){const i=e.data.hName,a=e.data.hChildren,o=e.data.hProperties;if(typeof i=="string")if(n.type==="element")n.tagName=i;else{const u="children"in n?n.children:[n];n={type:"element",tagName:i,properties:{},children:u}}n.type==="element"&&o&&Object.assign(n.properties,hf(o)),"children"in n&&n.children&&a!==null&&a!==void 0&&(n.children=a)}return n}function Z7(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 J7(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 J5(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function e2(e,t){const n=X7(e,t),i=n.one(e,void 0),a=P7(n),o=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return a&&o.children.push({type:"text",value:`
|
|
84
|
-
`},a),o}function eL(e,t){return e&&"run"in e?async function(n,i){const a=e2(n,{file:i,...t});await e.run(a,i)}:function(n,i){return e2(n,{file:i,...e||t})}}function t2(e){if(e)throw e}var Wg,n2;function tL(){if(n2)return Wg;n2=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]"},o=function(m){if(!m||t.call(m)!=="[object Object]")return!1;var g=e.call(m,"constructor"),v=m.constructor&&m.constructor.prototype&&e.call(m.constructor.prototype,"isPrototypeOf");if(m.constructor&&!g&&!v)return!1;var b;for(b in m);return typeof b>"u"||e.call(m,b)},u=function(m,g){n&&g.name==="__proto__"?n(m,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):m[g.name]=g.newValue},h=function(m,g){if(g==="__proto__")if(e.call(m,g)){if(i)return i(m,g).value}else return;return m[g]};return Wg=function f(){var m,g,v,b,y,_,j=arguments[0],N=1,w=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<w;++N)if(m=arguments[N],m!=null)for(g in m)v=h(j,g),b=h(m,g),j!==b&&(C&&b&&(o(b)||(y=a(b)))?(y?(y=!1,_=v&&a(v)?v:[]):_=v&&o(v)?v:{},u(j,{name:g,newValue:f(C,_,b)})):typeof b<"u"&&u(j,{name:g,newValue:b}));return j},Wg}var nL=tL();const Kg=px(nL);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 sL(){const e=[],t={run:n,use:i};return t;function n(...a){let o=-1;const u=a.pop();if(typeof u!="function")throw new TypeError("Expected function as last argument, not "+u);h(null,...a);function h(f,...m){const g=e[++o];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,g?iL(g,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 iL(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 g=m;if(h&&n)throw g;return a(g)}h||(f&&f.then&&typeof f.then=="function"?f.then(o,a):f instanceof Error?a(f):o(f))}function a(u,...h){n||(n=!0,t(u,...h))}function o(u){a(null,u)}}const Ri={basename:rL,dirname:aL,extname:lL,join:oL,sep:"/"};function rL(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,o;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(o){n=a+1;break}}else i<0&&(o=!0,i=a+1);return i<0?"":e.slice(n,i)}if(t===e)return"";let u=-1,h=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(o){n=a+1;break}}else u<0&&(o=!0,u=a+1),h>-1&&(e.codePointAt(a)===t.codePointAt(h--)?h<0&&(i=a):(h=-1,i=u));return n===i?i=u:i<0&&(i=e.length),e.slice(n,i)}function aL(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 lL(e){Du(e);let t=e.length,n=-1,i=0,a=-1,o=0,u;for(;t--;){const h=e.codePointAt(t);if(h===47){if(u){i=t+1;break}continue}n<0&&(u=!0,n=t+1),h===46?a<0?a=t:o!==1&&(o=1):a>-1&&(o=-1)}return a<0||n<0||o===0||o===1&&a===n-1&&a===i+1?"":e.slice(a,n)}function oL(...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?".":cL(n)}function cL(e){Du(e);const t=e.codePointAt(0)===47;let n=uL(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function uL(e,t){let n="",i=0,a=-1,o=0,u=-1,h,f;for(;++u<=e.length;){if(u<e.length)h=e.codePointAt(u);else{if(h===47)break;h=47}if(h===47){if(!(a===u-1||o===1))if(a!==u-1&&o===2){if(n.length<2||i!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(f=n.lastIndexOf("/"),f!==n.length-1){f<0?(n="",i=0):(n=n.slice(0,f),i=n.length-1-n.lastIndexOf("/")),a=u,o=0;continue}}else if(n.length>0){n="",i=0,a=u,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",i=2)}else n.length>0?n+="/"+e.slice(a+1,u):n=e.slice(a+1,u),i=u-a-1;a=u,o=0}else h===46&&o>-1?o++:o=-1}return n}function Du(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const dL={cwd:hL};function hL(){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 fL(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 pL(e)}function pL(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 tN{constructor(t){let n;t?ox(t)?n={path:t}:typeof t=="string"||mL(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":dL.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<Zg.length;){const o=Zg[i];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let a;for(a in n)Zg.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?Ri.basename(this.path):void 0}set basename(t){e0(t,"basename"),Jg(t,"basename"),this.path=Ri.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Ri.dirname(this.path):void 0}set dirname(t){s2(this.basename,"dirname"),this.path=Ri.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Ri.extname(this.path):void 0}set extname(t){if(Jg(t,"extname"),s2(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=Ri.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){ox(t)&&(t=fL(t)),e0(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Ri.basename(this.path,this.extname):void 0}set stem(t){e0(t,"stem"),Jg(t,"stem"),this.path=Ri.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(Ri.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ri.sep+"`")}function e0(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function s2(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function mL(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const gL=(function(e){const i=this.constructor.prototype,a=i[e],o=function(){return a.apply(o,arguments)};return Object.setPrototypeOf(o,i),o}),xL={}.hasOwnProperty;class nv extends gL{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=sL()}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):xL.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(o,u){const h=bh(t),f=i.parse(h);i.run(f,h,function(g,v,b){if(g||!v||!b)return m(g);const y=v,_=i.stringify(y,b);yL(_)?b.value=_:b.result=_,m(g,b)});function m(g,v){g||!v?u(g):o?o(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),r2("processSync","process",n),i;function a(o,u){n=!0,t2(o),i=u}}run(t,n,i){i2(t),this.freeze();const a=this.transformers;return!i&&typeof n=="function"&&(i=n,n=void 0),i?o(void 0,i):new Promise(o);function o(u,h){const f=bh(n);a.run(t,f,m);function m(g,v,b){const y=v||t;g?h(g):u?u(y):i(void 0,y,b)}}}runSync(t,n){let i=!1,a;return this.run(t,n,o),r2("runSync","run",i),a;function o(u,h){t2(u),a=h,i=!0}}stringify(t,n){this.freeze();const i=bh(n),a=this.compiler||this.Compiler;return n0("stringify",a),i2(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 o(m){if(typeof m=="function")f(m,[]);else if(typeof m=="object")if(Array.isArray(m)){const[g,...v]=m;f(g,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 g=-1;if(m!=null)if(Array.isArray(m))for(;++g<m.length;){const v=m[g];o(v)}else throw new TypeError("Expected a list of plugins, not `"+m+"`")}function f(m,g){let v=-1,b=-1;for(;++v<i.length;)if(i[v][0]===m){b=v;break}if(b===-1)i.push([m,...g]);else if(g.length>0){let[y,..._]=g;const j=i[b][1];lx(j)&&lx(y)&&(y=Kg(!0,j,y)),i[b]=[m,y,..._]}}}}const vL=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 i2(e){if(!lx(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function r2(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function bh(e){return bL(e)?e:new tN(e)}function bL(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function yL(e){return typeof e=="string"||_L(e)}function _L(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const wL="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",a2=[],l2={allowDangerousHtml:!0},SL=/^(https?|ircs?|mailto|xmpp)$/i,kL=[{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=jL(e),n=NL(e);return CL(t.runSync(t.parse(n),n),e)}function jL(e){const t=e.rehypePlugins||a2,n=e.remarkPlugins||a2,i=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...l2}:l2;return vL().use(i7).use(n).use(eL,i).use(t)}function NL(e){const t=e.children||"",n=new tN;return typeof t=="string"&&(n.value=t),n}function CL(e,t){const n=t.allowedElements,i=t.allowElement,a=t.components,o=t.disallowedElements,u=t.skipHtml,h=t.unwrapDisallowed,f=t.urlTransform||EL;for(const g of kL)Object.hasOwn(t,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+wL+g.id,void 0);return tv(e,m),HR(e,{Fragment:l.Fragment,components:a,ignoreInvalidStyle:!0,jsx:l.jsx,jsxs:l.jsxs,passKeys:!0,passNode:!0});function m(g,v,b){if(g.type==="raw"&&b&&typeof v=="number")return u?b.children.splice(v,1):b.children[v]={type:"text",value:g.value},v;if(g.type==="element"){let y;for(y in Yg)if(Object.hasOwn(Yg,y)&&Object.hasOwn(g.properties,y)){const _=g.properties[y],j=Yg[y];(j===null||j.includes(g.tagName))&&(g.properties[y]=f(String(_||""),y,g))}}if(g.type==="element"){let y=n?!n.includes(g.tagName):o?o.includes(g.tagName):!1;if(!y&&i&&typeof v=="number"&&(y=!i(g,v,b)),y&&b&&typeof v=="number")return h&&g.children?b.children.splice(v,1,...g.children):b.children.splice(v,1),v}}}function EL(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||SL.test(e.slice(0,t))?e:""}function o2(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 TL(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function AL(e,t,n){const a=Nf((n||{}).ignore||[]),o=ML(t);let u=-1;for(;++u<o.length;)eN(e,"text",h);function h(m,g){let v=-1,b;for(;++v<g.length;){const y=g[v],_=b?b.children:void 0;if(a(y,_?_.indexOf(y):void 0,b))return;b=y}if(b)return f(m,g)}function f(m,g){const v=g[g.length-1],b=o[u][0],y=o[u][1];let _=0;const N=v.children.indexOf(m);let w=!1,C=[];b.lastIndex=0;let E=b.exec(m.value);for(;E;){const R=E.index,M={index:E.index,input:E.input,stack:[...g,m]};let L=y(...E,M);if(typeof L=="string"&&(L=L.length>0?{type:"text",value:L}:void 0),L===!1?b.lastIndex=R+1:(_!==R&&C.push({type:"text",value:m.value.slice(_,R)}),Array.isArray(L)?C.push(...L):L&&C.push(L),_=R+E[0].length,w=!0),!b.global)break;E=b.exec(m.value)}return w?(_<m.value.length&&C.push({type:"text",value:m.value.slice(_)}),v.children.splice(N,1,...C)):C=[m],N+C.length}}function ML(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([RL(a[0]),OL(a[1])])}return t}function RL(e){return typeof e=="string"?new RegExp(TL(e),"g"):e}function OL(e){return typeof e=="function"?e:function(){return e}}const i0="phrasing",r0=["autolink","link","image","label"];function LL(){return{transforms:[FL],enter:{literalAutolink:zL,literalAutolinkEmail:a0,literalAutolinkHttp:a0,literalAutolinkWww:a0},exit:{literalAutolink:UL,literalAutolinkEmail:PL,literalAutolinkHttp:$L,literalAutolinkWww:BL}}}function DL(){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 zL(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function a0(e){this.config.enter.autolinkProtocol.call(this,e)}function $L(e){this.config.exit.autolinkProtocol.call(this,e)}function BL(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 PL(e){this.config.exit.autolinkEmail.call(this,e)}function UL(e){this.exit(e)}function FL(e){AL(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,IL],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),HL]],{ignore:["link","linkReference"]})}function IL(e,t,n,i,a){let o="";if(!nN(a)||(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!qL(n)))return!1;const u=VL(n+i);if(!u[0])return!1;const h={type:"link",title:null,url:o+t+u[0],children:[{type:"text",value:t+u[0]}]};return u[1]?[h,{type:"text",value:u[1]}]:h}function HL(e,t,n,i){return!nN(i,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function qL(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 VL(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=o2(e,"(");let o=o2(e,")");for(;i!==-1&&a>o;)e+=n.slice(0,i+1),n=n.slice(i+1),i=n.indexOf(")"),o++;return[e,n]}function nN(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||al(n)||Sf(n))&&(!t||n!==47)}sN.peek=eD;function GL(){this.buffer()}function YL(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function QL(){this.buffer()}function XL(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function WL(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=fi(this.sliceSerialize(e)).toLowerCase(),n.label=t}function KL(e){this.exit(e)}function ZL(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=fi(this.sliceSerialize(e)).toLowerCase(),n.label=t}function JL(e){this.exit(e)}function eD(){return"["}function sN(e,t,n,i){const a=n.createTracker(i);let o=a.move("[^");const u=n.enter("footnoteReference"),h=n.enter("reference");return o+=a.move(n.safe(n.associationId(e),{after:"]",before:o})),h(),u(),o+=a.move("]"),o}function tD(){return{enter:{gfmFootnoteCallString:GL,gfmFootnoteCall:YL,gfmFootnoteDefinitionLabelString:QL,gfmFootnoteDefinition:XL},exit:{gfmFootnoteCallString:WL,gfmFootnoteCall:KL,gfmFootnoteDefinitionLabelString:ZL,gfmFootnoteDefinition:JL}}}function nD(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:sN},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(i,a,o,u){const h=o.createTracker(u);let f=h.move("[^");const m=o.enter("footnoteDefinition"),g=o.enter("label");return f+=h.move(o.safe(o.associationId(i),{before:f,after:"]"})),g(),f+=h.move("]:"),i.children&&i.children.length>0&&(h.shift(4),f+=h.move((t?`
|
|
85
|
-
`:" ")+o.indentLines(o.containerFlow(i,h.current()),t?iN:sD))),m(),f}}function sD(e,t,n){return t===0?e:iN(e,t,n)}function iN(e,t,n){return(n?"":" ")+e}const iD=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];iv.attention=cD;iv.peek=uD;function rD(){return{canContainEols:["delete"],enter:{strikethrough:lD},exit:{strikethrough:oD}}}function aD(){return{handlers:{delete:iv},unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:iD}]}}function lD(e){this.enter({type:"delete",children:[],position:void 0},e)}function oD(e){this.exit(e)}function iv(e,t,n,i){const a=n.createTracker(i),o=n.stack.includes("strikethrough")?"~":"~~",u=n.enter("strikethrough");let h=a.move(o);return h+=n.containerPhrasing(e,{...a.current(),before:h,after:"~"}),h+=a.move(o),u(),h}function cD(){return{construct:"strikethrough",markers:["~"],sizes:[2,1]}}function uD(){return"~"}function dD(e){return e.length}function hD(e,t){const n=t||{},i=(n.align||[]).concat(),a=n.stringLength||dD,o=[],u=[],h=[],f=[];let m=0,g=-1;for(;++g<e.length;){const j=[],N=[];let w=-1;for(e[g].length>m&&(m=e[g].length);++w<e[g].length;){const C=fD(e[g][w]);if(n.alignDelimiters!==!1){const E=a(C);N[w]=E,(f[w]===void 0||E>f[w])&&(f[w]=E)}j.push(C)}u[g]=j,h[g]=N}let v=-1;if(typeof i=="object"&&"length"in i)for(;++v<m;)o[v]=c2(i[v]);else{const j=c2(i);for(;++v<m;)o[v]=j}v=-1;const b=[],y=[];for(;++v<m;){const j=o[v];let N="",w="";j===99?(N=":",w=":"):j===108?N=":":j===114&&(w=":");let C=n.alignDelimiters===!1?1:Math.max(1,f[v]-N.length-w.length);const E=N+"-".repeat(C)+w;n.alignDelimiters!==!1&&(C=N.length+C+w.length,C>f[v]&&(f[v]=C),y[v]=C),b[v]=E}u.splice(1,0,b),h.splice(1,0,y),g=-1;const _=[];for(;++g<u.length;){const j=u[g],N=h[g];v=-1;const w=[];for(;++v<m;){const C=j[v]||"";let E="",R="";if(n.alignDelimiters!==!1){const M=f[v]-(N[v]||0),L=o[v];L===114?E=" ".repeat(M):L===99?M%2?(E=" ".repeat(M/2+.5),R=" ".repeat(M/2-.5)):(E=" ".repeat(M/2),R=E):R=" ".repeat(M)}n.delimiterStart!==!1&&!v&&w.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&C==="")&&(n.delimiterStart!==!1||v)&&w.push(" "),n.alignDelimiters!==!1&&w.push(E),w.push(C),n.alignDelimiters!==!1&&w.push(R),n.padding!==!1&&w.push(" "),(n.delimiterEnd!==!1||v!==m-1)&&w.push("|")}_.push(n.delimiterEnd===!1?w.join("").replace(/ +$/,""):w.join(""))}return _.join(`
|
|
86
|
-
`)}function fD(e){return e==null?"":String(e)}function c2(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}const pD=Nf(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function mD(e,t,n,i){const a=n.enter("blockquote"),o=n.createTracker(i);o.move("> "),o.shift(2);const u=n.indentLines(n.containerFlow(e,o.current()),gD);return a(),u}function gD(e,t,n){return">"+(n?"":" ")+e}function xD(e,t){return u2(e,t.inConstruct,!0)&&!u2(e,t.notInConstruct,!1)}function u2(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 d2(e,t,n,i){let a=-1;for(;++a<n.unsafe.length;){const o=n.unsafe[a];if(o.character===`
|
|
87
|
-
`&&!o.before&&!o.after&&xD(n.stack,o))return/[\t ]/.test(i.before)?"":" "}return`\\
|
|
88
|
-
`}function vD(e,t){const n=String(e);let i=n.indexOf(t),a=i,o=0,u=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;i!==-1;)i===a?++o>u&&(u=o):o=1,a=i+t.length,i=n.indexOf(t,a);return u}function bD(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^\n\r ]/.test(e.value)&&!/^[\t ]*(?:[\n\r]|$)|(?:^|[\n\r])[\t ]*$/.test(e.value))}function yD(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 _D(e,t,n,i){const a=yD(n),o=e.value||"";if(bD(e,n)){const v=n.enter("codeIndented"),b=n.indentLines(o,wD);return v(),b}const u=n.createTracker(i),h=a.repeat(Math.max(vD(o,a)+1,3)),f=n.enter("codeFenced"),m=a==="`"?"GraveAccent":"Tilde";let g=u.move(h);if(e.lang){const v=n.enter(`codeFencedLang${m}`);g+=u.move(n.safe(e.lang,{before:g,after:" ",encode:["`"],...u.current()})),v()}if(e.lang&&e.meta){const v=n.enter(`codeFencedMeta${m}`);g+=u.move(" "),g+=u.move(n.safe(e.meta,{before:g,after:`
|
|
89
|
-
`,encode:["`"],...u.current()})),v()}return g+=u.move(`
|
|
90
|
-
`),o&&(g+=u.move(o+`
|
|
91
|
-
`)),g+=u.move(h),f(),g}function wD(e,t,n){return(n?"":" ")+e}function rv(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 SD(e,t,n,i){const a=rv(n),o=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${o}`),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 kD(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}av.attention=jD;av.peek=ND;function av(e,t,n,i){const a=n.enter("phrasing"),o=n.containerPhrasing({type:"root",children:[e]},i);return a(),o}function jD(e,t){return{construct:"emphasis",markers:kD(t)==="*"?["*","_"]:["_","*"],sizes:[1]}}function ND(e,t,n){return n.options.emphasis||"*"}function CD(e){return"&#x"+e.toString(16).toUpperCase()+";"}function ED(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)&&Qx(e)&&(t.options.setext||n))}function TD(e,t,n,i){const a=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(i);if(ED(e,n)){const v=n.enter("headingSetext"),b=n.enter("phrasing"),y=n.containerPhrasing(e,{...o.current(),before:`
|
|
93
|
-
`,after:`
|
|
94
|
-
`});return b(),v(),y+`
|
|
95
|
-
`+(a===1?"=":"-").repeat(y.length-(Math.max(y.lastIndexOf("\r"),y.lastIndexOf(`
|
|
96
|
-
`))+1))}const u="#".repeat(a),h=n.enter("headingAtx"),f=n.enter("phrasing");o.move(u+" ");let m=n.containerPhrasing(e,{before:"# ",after:`
|
|
97
|
-
`,...o.current()});const g=m.charCodeAt(0);return(g===9||g===32)&&(m=CD(g)+m.slice(1)),m=m?u+" "+m:u,n.options.closeAtx&&(m+=" "+u),f(),h(),m}rN.peek=AD;function rN(e){return e.value||""}function AD(){return"<"}aN.peek=MD;function aN(e,t,n,i){const a=rv(n),o=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${o}`),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 MD(){return"!"}lN.peek=RD;function lN(e,t,n,i){const a=e.referenceType,o=n.enter("imageReference");let u=n.enter("label");const h=n.createTracker(i);let f=h.move("![");const m=n.safe(e.alt,{before:f,after:"]",...h.current()});f+=h.move(m+"]["),u();const g=n.stack;n.stack=g.filter(function(b){return b!=="phrasing"}),u=n.enter("reference");const v=n.safe(n.associationId(e),{before:f,after:"]",...h.current()});return u(),n.stack=g,o(),a==="full"||!m||m!==v?f+=h.move(v+"]"):a==="shortcut"?f=f.slice(0,-1):f+=h.move("]"),f}function RD(){return"!"}oN.peek=OD;function oN(e,t,n){let i=e.value||"",a="`",o=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(i);)a+="`";for(/[^\n\r ]/.test(i)&&(/^[\n\r ]/.test(i)&&/[\n\r ]$/.test(i)||/^`|`$/.test(i))&&(i=" "+i+" ");++o<n.unsafe.length;){const u=n.unsafe[o],h=n.compilePattern(u);if(!u.atBreak)continue;let f;for(;f=h.exec(i);){let 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 OD(){return"`"}function cN(e,t){const n=Qx(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))}uN.peek=LD;function uN(e,t,n,i){const a=rv(n),o=a==='"'?"Quote":"Apostrophe",u=n.createTracker(i);if(cN(e,n)){const g=n.stack;n.stack=g.filter(function(y){return y!=="phrasing"});const v=n.enter("autolink");let b=u.move("<");return b+=u.move(n.containerPhrasing(e,{before:b,after:">",...u.current()})),b+=u.move(">"),v(),n.stack=g,b}const h=n.enter("link");let f=n.enter("label"),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${o}`),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 LD(e,t,n){return cN(e,n)?"<":"["}dN.peek=DD;function dN(e,t,n,i){const a=e.referenceType,o=n.enter("linkReference");let u=n.enter("label");const h=n.createTracker(i);let f=h.move("[");const m=n.containerPhrasing(e,{before:f,after:"]",...h.current()});f+=h.move(m+"]["),u();const g=n.stack;n.stack=g.filter(function(b){return b!=="phrasing"}),u=n.enter("reference");const v=n.safe(n.associationId(e),{before:f,after:"]",...h.current()});return u(),n.stack=g,o(),a==="full"||!m||m!==v?f+=h.move(v+"]"):a==="shortcut"?f=f.slice(0,-1):f+=h.move("]"),f}function DD(){return"["}function lv(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 zD(e){const t=lv(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 $D(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 hN(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 BD(e,t,n,i){const a=n.enter("list"),o=n.bulletCurrent;let u=e.ordered?$D(n):lv(n);const h=e.ordered?u==="."?")":".":zD(n);let f=t&&n.bulletLastUsed?u===n.bulletLastUsed:!1;if(!e.ordered){const g=e.children?e.children[0]:void 0;if((u==="*"||u==="-")&&g&&(!g.children||!g.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(f=!0),hN(n)===u&&g){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=o,a(),m}function PD(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 UD(e,t,n,i){const a=PD(n);let o=n.bulletCurrent||lv(n);t&&t.type==="list"&&t.ordered&&(o=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let u=o.length+1;(a==="tab"||a==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(u=Math.ceil(u/4)*4);const h=n.createTracker(i);h.move(o+" ".repeat(u-o.length)),h.shift(u);const f=n.enter("listItem"),m=n.indentLines(n.containerFlow(e,h.current()),g);return f(),m;function g(v,b,y){return b?(y?"":" ".repeat(u))+v:(y?o:o+" ".repeat(u-o.length))+v}}function FD(e,t,n,i){const a=n.enter("paragraph"),o=n.enter("phrasing"),u=n.containerPhrasing(e,i);return o(),a(),u}function ID(e,t,n,i){if(!e.children.some(function(h){return pD(h)}))return n.containerFlow(e,i);const o=n.enter("phrasing"),u=n.containerPhrasing(e,i);return o(),u}function HD(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}ov.attention=qD;ov.peek=VD;function ov(e,t,n,i){const a=n.enter("phrasing"),o=n.containerPhrasing({type:"root",children:[e]},i);return a(),o}function qD(e,t){return{construct:"strong",markers:HD(t)==="*"?["*","_"]:["_","*"],sizes:[2]}}function VD(e,t,n){return n.options.strong||"*"}function GD(e,t,n,i){return n.safe(e.value,i)}function YD(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 QD(e,t,n){const i=(hN(n)+(n.options.ruleSpaces?" ":"")).repeat(YD(n));return n.options.ruleSpaces?i.slice(0,-1):i}const fN={blockquote:mD,break:d2,code:_D,definition:SD,emphasis:av,hardBreak:d2,heading:TD,html:rN,image:aN,imageReference:lN,inlineCode:oN,link:uN,linkReference:dN,list:BD,listItem:UD,paragraph:FD,root:ID,strong:ov,text:GD,thematicBreak:QD};function XD(){return{enter:{table:WD,tableData:h2,tableHeader:h2,tableRow:ZD},exit:{codeText:JD,table:KD,tableData:l0,tableHeader:l0,tableRow:l0}}}function WD(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 KD(e){this.exit(e),this.data.inTable=void 0}function ZD(e){this.enter({type:"tableRow",children:[]},e)}function l0(e){this.exit(e)}function h2(e){this.enter({type:"tableCell",children:[]},e)}function JD(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,ez));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function ez(e,t){return t==="|"?t:e}function tz(e){const t=e||{},n=t.tableCellPadding,i=t.tablePipeAlign,a=t.stringLength,o=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(g(y,j,N),y.align)}function h(y,_,j,N){const w=v(y,j,N),C=m([w]);return C.slice(0,C.indexOf(`
|
|
99
|
-
`))}function f(y,_,j,N){const w=j.enter("tableCell"),C=j.enter("phrasing"),E=j.containerPhrasing(y,{...N,before:o,after:o});return C(),w(),E}function m(y,_){return hD(y,{align:_,alignDelimiters:i,padding:n,stringLength:a})}function g(y,_,j){const N=y.children;let w=-1;const C=[],E=_.enter("table");for(;++w<N.length;)C[w]=v(N[w],_,j);return E(),C}function v(y,_,j){const N=y.children;let w=-1;const C=[],E=_.enter("tableRow");for(;++w<N.length;)C[w]=f(N[w],y,_,j);return E(),C}function b(y,_,j){let N=fN.inlineCode(y,_,j);return j.stack.includes("tableCell")&&(N=N.replace(/\|/g,"\\$&")),N}}function nz(){return{exit:{taskListCheckValueChecked:f2,taskListCheckValueUnchecked:f2,paragraph:iz}}}function sz(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:rz}}}function f2(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function iz(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const i=n.children[0];if(i&&i.type==="text"){const a=t.children;let o=-1,u;for(;++o<a.length;){const h=a[o];if(h.type==="paragraph"){u=h;break}}u===n&&(i.value=i.value.slice(1),i.value.length===0?n.children.shift():n.position&&i.position&&typeof i.position.start.offset=="number"&&(i.position.start.column++,i.position.start.offset++,n.position.start=Object.assign({},i.position.start)))}}this.exit(e)}function rz(e,t,n,i){const a=e.children[0],o=typeof e.checked=="boolean"&&a&&a.type==="paragraph",u="["+(e.checked?"x":" ")+"] ",h=n.createTracker(i);o&&h.move(u);let f=fN.listItem(e,t,n,{...i,...h.current()});return o&&(f=f.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,m)),f;function m(g){return g+u}}function az(){return[LL(),tD(),rD(),XD(),nz()]}function lz(e){return{extensions:[DL(),nD(e),aD(),tz(e),sz()]}}const oz={tokenize:pz,partial:!0},pN={tokenize:mz,partial:!0},mN={tokenize:gz,partial:!0},gN={tokenize:xz,partial:!0},cz={tokenize:vz,partial:!0},xN={name:"wwwAutolink",tokenize:hz,previous:bN},vN={name:"protocolAutolink",tokenize:fz,previous:yN},xr={name:"emailAutolink",tokenize:dz,previous:_N},Bi={};function uz(){return{text:Bi}}let Qa=48;for(;Qa<123;)Bi[Qa]=xr,Qa++,Qa===58?Qa=65:Qa===91&&(Qa=97);Bi[43]=xr;Bi[45]=xr;Bi[46]=xr;Bi[95]=xr;Bi[72]=[xr,vN];Bi[104]=[xr,vN];Bi[87]=[xr,xN];Bi[119]=[xr,xN];function dz(e,t,n){const i=this;let a,o;return u;function u(v){return!cx(v)||!_N.call(i,i.previous)||cv(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(cz,g,m)(v):v===45||v===95||qn(v)?(o=!0,e.consume(v),f):g(v)}function m(v){return e.consume(v),a=!0,f}function g(v){return o&&a&&ss(i.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(v)):n(v)}}function hz(e,t,n){const i=this;return a;function a(u){return u!==87&&u!==119||!bN.call(i,i.previous)||cv(i.events)?n(u):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(oz,e.attempt(pN,e.attempt(mN,o),n),n)(u))}function o(u){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(u)}}function fz(e,t,n){const i=this;let a="",o=!1;return u;function u(v){return(v===72||v===104)&&yN.call(i,i.previous)&&!cv(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),o?m:(o=!0,f)):n(v)}function m(v){return v===null||of(v)||Pt(v)||al(v)||Sf(v)?n(v):e.attempt(pN,e.attempt(mN,g),n)(v)}function g(v){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(v)}}function pz(e,t,n){let i=0;return a;function a(u){return(u===87||u===119)&&i<3?(i++,e.consume(u),a):u===46&&i===3?(e.consume(u),o):n(u)}function o(u){return u===null?n(u):t(u)}}function mz(e,t,n){let i,a,o;return u;function u(m){return m===46||m===95?e.check(gN,f,h)(m):m===null||Pt(m)||al(m)||m!==45&&Sf(m)?f(m):(o=!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||!o?n(m):t(m)}}function gz(e,t){let n=0,i=0;return a;function a(u){return u===40?(n++,e.consume(u),a):u===41&&i<n?o(u):u===33||u===34||u===38||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===60||u===63||u===93||u===95||u===126?e.check(gN,t,o)(u):u===null||Pt(u)||al(u)?t(u):(e.consume(u),a)}function o(u){return u===41&&i++,e.consume(u),a}}function xz(e,t,n){return i;function i(h){return h===33||h===34||h===39||h===41||h===42||h===44||h===46||h===58||h===59||h===63||h===95||h===126?(e.consume(h),i):h===38?(e.consume(h),o):h===93?(e.consume(h),a):h===60||h===null||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 o(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 vz(e,t,n){return i;function i(o){return e.consume(o),a}function a(o){return qn(o)?n(o):t(o)}}function bN(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Pt(e)}function yN(e){return!ss(e)}function _N(e){return!(e===47||cx(e))}function cx(e){return e===43||e===45||e===46||e===95||qn(e)}function cv(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 bz={tokenize:Cz,partial:!0};function yz(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:kz,continuation:{tokenize:jz},exit:Nz}},text:{91:{name:"gfmFootnoteCall",tokenize:Sz},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:_z,resolveTo:wz}}}}function _z(e,t,n){const i=this;let a=i.events.length;const o=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let u;for(;a--;){const f=i.events[a][1];if(f.type==="labelImage"){u=f;break}if(f.type==="gfmFootnoteCall"||f.type==="labelLink"||f.type==="label"||f.type==="image"||f.type==="link")break}return h;function h(f){if(!u||!u._balanced)return n(f);const m=fi(i.sliceSerialize({start:u.end,end:i.now()}));return m.codePointAt(0)!==94||!o.includes(m.slice(1))?n(f):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),t(f))}}function wz(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const i={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},u={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},h=[e[n+1],e[n+2],["enter",i,t],e[n+3],e[n+4],["enter",a,t],["exit",a,t],["enter",o,t],["enter",u,t],["exit",u,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",i,t]];return e.splice(n,e.length-n+1,...h),e}function Sz(e,t,n){const i=this,a=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let o=0,u;return h;function h(v){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(v),e.exit("gfmFootnoteCallLabelMarker"),f}function f(v){return v!==94?n(v):(e.enter("gfmFootnoteCallMarker"),e.consume(v),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",m)}function m(v){if(o>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(fi(i.sliceSerialize(b)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(v),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(v)}return Pt(v)||(u=!0),o++,e.consume(v),v===92?g:m}function g(v){return v===91||v===92||v===93?(e.consume(v),o++,m):m(v)}}function kz(e,t,n){const i=this,a=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let o,u=0,h;return f;function f(_){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(_),e.exit("gfmFootnoteDefinitionLabelMarker"),m}function m(_){return _===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(_),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",g):n(_)}function g(_){if(u>999||_===93&&!h||_===null||_===91||Pt(_))return n(_);if(_===93){e.exit("chunkString");const j=e.exit("gfmFootnoteDefinitionLabelString");return o=fi(i.sliceSerialize(j)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(_),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),b}return Pt(_)||(h=!0),u++,e.consume(_),_===92?v:g}function v(_){return _===91||_===92||_===93?(e.consume(_),u++,g):g(_)}function b(_){return _===58?(e.enter("definitionMarker"),e.consume(_),e.exit("definitionMarker"),a.includes(o)||a.push(o),Nt(e,y,"gfmFootnoteDefinitionWhitespace")):n(_)}function y(_){return t(_)}}function jz(e,t,n){return e.check(Lu,t,e.attempt(bz,t,n))}function Nz(e){e.exit("gfmFootnoteDefinition")}function Cz(e,t,n){const i=this;return Nt(e,a,"gfmFootnoteDefinitionIndent",5);function a(o){const u=i.events[i.events.length-1];return u&&u[1].type==="gfmFootnoteDefinitionIndent"&&u[2].sliceSerialize(u[1],!0).length===4?t(o):n(o)}}function Ez(e){let n=(e||{}).singleTilde;const i={name:"strikethrough",tokenize:o,resolveAll:a};return n==null&&(n=!0),{text:{126:i},insideSpan:{null:[i]},attentionMarkers:{null:[126]}};function a(u,h){let f=-1;for(;++f<u.length;)if(u[f][0]==="enter"&&u[f][1].type==="strikethroughSequenceTemporary"&&u[f][1]._close){let 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 g={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",g,h],["enter",u[m][1],h],["exit",u[m][1],h],["enter",v,h]],y=h.parser.constructs.insideSpan.null;y&&hi(b,b.length,0,kf(y,u.slice(m+1,f),h)),hi(b,b.length,0,[["exit",v,h],["enter",u[f][1],h],["exit",u[f][1],h],["exit",g,h]]),hi(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 o(u,h,f){const m=this.previous,g=this.events;let v=0;return b;function b(_){return m===126&&g[g.length-1][1].type!=="characterEscape"?f(_):(u.enter("strikethroughSequenceTemporary"),y(_))}function y(_){const j=uf(m);if(_===126)return v>1?f(_):(u.consume(_),v++,y);if(v<2&&!n)return f(_);const N=u.exit("strikethroughSequenceTemporary"),w=uf(_);return N._open=!w||w===2&&!!j,N._close=!j||j===2&&!!w,h(_)}}}class Tz{constructor(){this.map=[],this.index=new Map}add(t,n,i){Az(this,t,n,i)}consume(t){if(this.map.sort(function(o,u){return o[0]-u[0]}),this.map.length===0)return;let n=this.map.length;const i=[];for(;n>0;)n-=1,i.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];i.push(t.slice()),t.length=0;let a=i.pop();for(;a;){for(const o of a)t.push(o);a=i.pop()}this.map.length=0,this.index.clear()}}function Az(e,t,n,i){if(n===0&&i.length===0)return;const a=e.index.get(t);if(a){a[1]+=n,a[2].push(...i);return}const o=[t,n,i];e.map.push(o),e.index.set(t,o)}function Mz(e,t){let n=!1;const i=[];for(;t<e.length;){const a=e[t];if(n){if(a[0]==="enter")a[1].type==="tableContent"&&i.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(a[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const o=i.length-1;i[o]=i[o]==="left"?"center":"right"}}else if(a[1].type==="tableDelimiterRow")break}else a[0]==="enter"&&a[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return i}function Rz(){return{flow:{null:{name:"table",tokenize:Oz,resolveAll:Lz}}}}function Oz(e,t,n){const i=this;let a=0,o=0,u;return h;function h(U){let G=i.events.length-1;for(;G>-1;){const{type:W}=i.events[G][1];if(W==="lineEnding"||W==="linePrefix")G--;else break}const O=G>-1?i.events[G][1].type:null,de=O==="tableHead"||O==="tableRow"?L:f;return de===L&&i.parser.lazy[i.now().line]?n(U):de(U)}function f(U){return e.enter("tableHead"),e.enter("tableRow"),m(U)}function m(U){return U===124||(u=!0,o+=1),g(U)}function g(U){return U===null?n(U):Ve(U)?o>1?(o=0,i.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(U),e.exit("lineEnding"),y):n(U):ot(U)?Nt(e,g,"whitespace")(U):(o+=1,u&&(u=!1,a+=1),U===124?(e.enter("tableCellDivider"),e.consume(U),e.exit("tableCellDivider"),u=!0,g):(e.enter("data"),v(U)))}function v(U){return U===null||U===124||Pt(U)?(e.exit("data"),g(U)):(e.consume(U),U===92?b:v)}function b(U){return U===92||U===124?(e.consume(U),v):v(U)}function y(U){return i.interrupt=!1,i.parser.lazy[i.now().line]?n(U):(e.enter("tableDelimiterRow"),u=!1,ot(U)?Nt(e,_,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(U):_(U))}function _(U){return U===45||U===58?N(U):U===124?(u=!0,e.enter("tableCellDivider"),e.consume(U),e.exit("tableCellDivider"),j):M(U)}function j(U){return ot(U)?Nt(e,N,"whitespace")(U):N(U)}function N(U){return U===58?(o+=1,u=!0,e.enter("tableDelimiterMarker"),e.consume(U),e.exit("tableDelimiterMarker"),w):U===45?(o+=1,w(U)):U===null||Ve(U)?R(U):M(U)}function w(U){return U===45?(e.enter("tableDelimiterFiller"),C(U)):M(U)}function C(U){return U===45?(e.consume(U),C):U===58?(u=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(U),e.exit("tableDelimiterMarker"),E):(e.exit("tableDelimiterFiller"),E(U))}function E(U){return ot(U)?Nt(e,R,"whitespace")(U):R(U)}function R(U){return U===124?_(U):U===null||Ve(U)?!u||a!==o?M(U):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(U)):M(U)}function M(U){return n(U)}function L(U){return e.enter("tableRow"),F(U)}function F(U){return U===124?(e.enter("tableCellDivider"),e.consume(U),e.exit("tableCellDivider"),F):U===null||Ve(U)?(e.exit("tableRow"),t(U)):ot(U)?Nt(e,F,"whitespace")(U):(e.enter("data"),D(U))}function D(U){return U===null||U===124||Pt(U)?(e.exit("data"),F(U)):(e.consume(U),U===92?X:D)}function X(U){return U===92||U===124?(e.consume(U),D):D(U)}}function Lz(e,t){let n=-1,i=!0,a=0,o=[0,0,0,0],u=[0,0,0,0],h=!1,f=0,m,g,v;const b=new Tz;for(;++n<e.length;){const y=e[n],_=y[1];y[0]==="enter"?_.type==="tableHead"?(h=!1,f!==0&&(p2(b,t,f,m,g),g=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,o=[0,0,0,0],u=[0,n+1,0,0],h&&(h=!1,g={type:"tableBody",start:Object.assign({},_.start),end:Object.assign({},_.end)},b.add(n,0,[["enter",g,t]])),a=_.type==="tableDelimiterRow"?2:g?3:1):a&&(_.type==="data"||_.type==="tableDelimiterMarker"||_.type==="tableDelimiterFiller")?(i=!1,u[2]===0&&(o[1]!==0&&(u[0]=u[1],v=yh(b,t,o,a,void 0,v),o=[0,0,0,0]),u[2]=n)):_.type==="tableCellDivider"&&(i?i=!1:(o[1]!==0&&(u[0]=u[1],v=yh(b,t,o,a,void 0,v)),o=u,u=[o[1],n,0,0])):_.type==="tableHead"?(h=!0,f=n):_.type==="tableRow"||_.type==="tableDelimiterRow"?(f=n,o[1]!==0?(u[0]=u[1],v=yh(b,t,o,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&&p2(b,t,f,m,g),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=Mz(t.events,n))}return e}function yh(e,t,n,i,a,o){const u=i===1?"tableHeader":i===2?"tableDelimiter":"tableData",h="tableContent";n[0]!==0&&(o.end=Object.assign({},lo(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const f=lo(t.events,n[1]);if(o={type:u,start:Object.assign({},f),end:Object.assign({},f)},e.add(n[1],0,[["enter",o,t]]),n[2]!==0){const m=lo(t.events,n[2]),g=lo(t.events,n[3]),v={type:h,start:Object.assign({},m),end:Object.assign({},g)};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&&(o.end=Object.assign({},lo(t.events,a)),e.add(a,0,[["exit",o,t]]),o=void 0),o}function p2(e,t,n,i,a){const o=[],u=lo(t.events,n);a&&(a.end=Object.assign({},u),o.push(["exit",a,t])),i.end=Object.assign({},u),o.push(["exit",i,t]),e.add(n+1,0,o)}function lo(e,t){const n=e[t],i=n[0]==="enter"?"start":"end";return n[1][i]}const Dz={name:"tasklistCheck",tokenize:$z};function zz(){return{text:{91:Dz}}}function $z(e,t,n){const i=this;return a;function a(f){return i.previous!==null||!i._gfmTasklistFirstContentOfListItem?n(f):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(f),e.exit("taskListCheckMarker"),o)}function o(f){return 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 Ve(f)?t(f):ot(f)?e.check({tokenize:Bz},t,n)(f):n(f)}}function Bz(e,t,n){return Nt(e,i,"whitespace");function i(a){return a===null?n(a):t(a)}}function Pz(e){return Oj([uz(),yz(),Ez(e),Rz(),zz()])}const Uz={};function uv(e){const t=this,n=e||Uz,i=t.data(),a=i.micromarkExtensions||(i.micromarkExtensions=[]),o=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),u=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);a.push(Pz(n)),o.push(az()),u.push(lz(n))}const Fz=1500;async function Iz(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),o=k.useRef(null);k.useEffect(()=>()=>{o.current&&clearTimeout(o.current)},[]);const u=async()=>{await Iz(e)&&(a(!0),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>a(!1),Fz))},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,Hz=`.,;:!?]}>'"`;function qz(e){let t=e.length;for(;t>0;){const n=e[t-1];if(n===")"){const i=e.slice(0,t),a=(i.match(/\(/g)||[]).length,o=(i.match(/\)/g)||[]).length;if(a>=o)break;t--;continue}if(Hz.includes(n)){t--;continue}break}return e.slice(0,t)}function Vz(e){return/^https?:\/\/[^\s/]/i.test(e)}function Gz(e){if(!e)return[];const t=[];let n=0;o0.lastIndex=0;let i;for(;(i=o0.exec(e))!==null;){const a=qz(i[0]);!a||!Vz(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 m2=40;function Yz(e){const t=e.replace(/\s+/g," ").trim();return t?`Copy ${t.length>m2?`${t.slice(0,m2-1)}…`:t}`:"Copy"}function wN({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=Gz(i);return l.jsxs("span",{className:`inline-flex items-center align-middle max-w-full gap-1 pl-1.5 pr-1 py-0.5 rounded-md bg-cc-fg/[0.06] border border-cc-border/40 ${t}`,children:[l.jsx("code",{className:`min-w-0 break-all font-mono-code ${n}`,children:a.map((o,u)=>o.type==="link"?l.jsx("a",{href:o.href,target:"_blank",rel:"noopener noreferrer",className:"text-cc-primary underline decoration-cc-primary/40 hover:decoration-cc-primary",children:o.value},u):l.jsx("span",{children:o.value},u))}),l.jsx(Ef,{text:i,label:Yz(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 SN(e){return new Promise((t,n)=>{const i=new FileReader;i.onload=()=>{const o=i.result.split(",")[1],u=e.type||"application/octet-stream";t({base64:o,mediaType:u})},i.onerror=n,i.readAsDataURL(e)})}function ca(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 kN(e){return e.startsWith("image/")}function jN({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 NN({name:e,mediaType:t,base64:n,size:i,onRemove:a,className:o="w-12 h-12"}){const u=kN(t);return l.jsxs("div",{className:"relative group",title:`${e} (${ca(i)})`,children:[l.jsx("div",{className:`${o} rounded-lg overflow-hidden border border-cc-border`,children:u?l.jsx("img",{src:`data:${t};base64,${n}`,alt:e,className:"w-full h-full object-cover"}):l.jsx(jN,{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 Qz({name:e,mediaType:t,data:n,size:i}){return kN(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(jN,{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:ca(i)})]})]})}function Xz({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(o=>!o),"aria-expanded":n,className:"shrink-0 text-[11px] text-cc-muted/60 hover:text-cc-muted underline decoration-dotted cursor-pointer",children:n?"hide report":"show report"}),l.jsx("div",{className:"shrink-0 flex-1 h-px bg-cc-border"})]}),a&&n&&l.jsx("pre",{className:"mt-1.5 mx-3 text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap break-words max-h-80 overflow-auto rounded-md bg-cc-hover/40 p-2",children:e.detail})]})}function Wz({message:e}){return e.role==="system"?l.jsx(Xz,{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(Qz,{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(dv,{text:e.content})})]})}):l.jsx("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]",children:l.jsx(t$,{message:e})})}function Kz(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 Zz(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 Jz(e){return e.kind==="content"&&e.block.type==="thinking"&&!e.block.thinking.trim()}function e$({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 t$({message:e}){var u;const t=e.contentBlocks||[],n=fa(),i=k.useMemo(()=>Kz(t),[t]),a=k.useMemo(()=>Zz(t),[t]),o=k.useMemo(()=>n?i.filter(h=>!Jz(h)):i,[i,n]);if(n&&o.length===0&&!((u=e.content)!=null&&u.trim()))return l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(Bh,{}),l.jsx("div",{className:"flex-1 min-w-0",children:l.jsx(e$,{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(EN,{text:e.content}):l.jsx(dv,{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:o.map((h,f)=>{if(h.kind==="content")return l.jsx(n$,{block:h.block,toolUseById:a},f);if(h.items.length===1){const m=h.items[0];return l.jsx(V2,{name:m.name,input:m.input,toolUseId:m.id},f)}return l.jsx(r$,{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 dv({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:[uv],components:{p:({children:n})=>l.jsx("p",{className:"mb-3 last:mb-0",children:n}),strong:({children:n})=>l.jsx("strong",{className:"font-semibold text-cc-fg",children:n}),em:({children:n})=>l.jsx("em",{className:"italic",children:n}),h1:({children:n})=>l.jsx("h1",{className:"text-xl font-bold text-cc-fg mt-4 mb-2",children:n}),h2:({children:n})=>l.jsx("h2",{className:"text-lg font-bold text-cc-fg mt-3 mb-2",children:n}),h3:({children:n})=>l.jsx("h3",{className:"text-base font-semibold text-cc-fg mt-3 mb-1",children:n}),ul:({children:n})=>l.jsx("ul",{className:"list-disc pl-5 mb-3 space-y-1",children:n}),ol:({children:n})=>l.jsx("ol",{className:"list-decimal pl-5 mb-3 space-y-1",children:n}),li:({children:n})=>l.jsx("li",{className:"text-cc-fg",children:n}),a:({href:n,children:i})=>l.jsx("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:"text-cc-primary hover:underline",children:i}),blockquote:({children:n})=>l.jsx("blockquote",{className:"border-l-2 border-cc-primary/30 pl-3 my-2 text-cc-muted italic",children:n}),hr:()=>l.jsx("hr",{className:"border-cc-border my-4"}),code:n=>{const{children:i,className:a}=n,o=/language-(\w+)/.exec(a||"");if(o||typeof i=="string"&&i.includes(`
|
|
100
|
-
`)){const h=(o==null?void 0:o[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(wN,{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 n$({block:e,toolUseById:t}){if(e.type==="text")return l.jsx(dv,{text:e.text});if(e.type==="thinking")return l.jsx(EN,{text:e.thinking});if(e.type==="tool_use")return l.jsx(V2,{name:e.name,input:e.input,toolUseId:e.id});if(e.type==="tool_result"){const n=typeof e.content=="string"?e.content:JSON.stringify(e.content),i=t.get(e.tool_use_id),a=i==null?void 0:i.name,o=e.is_error??!1;return a==="Bash"?l.jsx(s$,{text:n,isError:o}):l.jsx(i$,{content:n,isError:o})}return null}function CN(e){return`${e} ${e===1?"line":"lines"}`}function s$({text:e,isError:t}){const n=e.split(/\r?\n/),i=n.length>20,[a,o]=k.useState(!1),u=fa(),[h,f]=k.useState(!1),m=a||!i?e:n.slice(-20).join(`
|
|
101
|
-
`),g=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:()=>o(!a),className:"text-[10px] text-cc-muted/40 hover:text-cc-muted/70 transition-colors cursor-pointer",children:a?"Show tail":"Show all"})]})]});return u?l.jsxs("div",{children:[l.jsx(xf,{open:h,onToggle:()=>f(!h),marker:"›",label:t?"Error output":"Output",meta:CN(n.length),labelClassName:t?"text-cc-error/70":""}),h&&l.jsx("div",{className:"mt-1",children:g})]}):g}function i$({content:e,isError:t}){const n=fa(),[i,a]=k.useState(!1),o=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:CN(e.split(/\r?\n/).length),labelClassName:t?"text-cc-error/70":""}),i&&l.jsx("div",{className:"mt-1",children:o})]}):o}function r$({name:e,items:t}){const[n,i]=k.useState(!1),a=No(e),o=Li(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:o}),l.jsx("span",{className:"text-[10px] text-cc-muted bg-cc-hover rounded-full px-1.5 py-0.5 tabular-nums",children:t.length})]}),n&&l.jsx("div",{className:"border-t border-cc-border px-3 py-1.5",children:t.map((u,h)=>{const f=xo(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 EN({text:e}){const t=e.trim(),n=fa(),[i,a]=k.useState(!1),o=t.split(`
|
|
102
|
-
`),u=n?2:8,h=n?200:600,f=o.length>u||t.length>h,m=f&&!i?o.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:[uv],components:{p:({children:g})=>l.jsx("p",{className:"mb-2 last:mb-0",children:g}),ul:({children:g})=>l.jsx("ul",{className:"list-disc pl-4 mb-2 space-y-0.5",children:g}),ol:({children:g})=>l.jsx("ol",{className:"list-decimal pl-4 mb-2 space-y-0.5",children:g}),li:({children:g})=>l.jsx("li",{children:g}),code:({children:g})=>l.jsx("code",{className:"px-1 py-0.5 rounded bg-cc-fg/[0.03] text-cc-fg/40 font-mono-code text-[12px] not-italic",children:g})},children: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 oo(e){const t=Math.floor(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function g2(e){try{const t=new Date(e).getTime()-Date.now();return Number.isFinite(t)?t<=0?"now":a$(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),o=Math.floor(n%36e5/6e4);return i>0?`${i}d ${a}h`:a>0?`${a}h${o}m`:`${o}m`}function x2(e){return e>=1440?`${Math.round(e/1440)}d`:e>=60?`${Math.round(e/60)}h`:`${e}m`}function a$(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 l$({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:Li(t.toolName)}),l.jsxs("span",{className:"text-cc-muted/50 tabular-nums",children:[t.elapsedSeconds,"s"]})]},n))})}function o$({entries:e}){const[t,n]=k.useState(!1),i=k.useMemo(()=>{const a=e.reduce((f,m)=>f+m.elapsedSeconds,0),o=Math.max(...e.map(f=>f.elapsedSeconds),.1),u=e.filter(f=>f.isError).length,h=e.filter(f=>!f.completedAt).length;return{totalTime:a,maxTime:o,errorCount:u,running:h}},[e]);return e.length===0?null:l.jsxs("div",{className:"pl-10 pr-4 animate-[fadeSlideIn_0.3s_ease-out]",children:[l.jsxs("button",{onClick:()=>n(!t),className:"group flex items-center gap-2 text-[11px] text-cc-muted hover:text-cc-fg/80 transition-colors cursor-pointer py-1 w-full","aria-expanded":t,"aria-label":`${e.length} tools executed in ${i.totalTime.toFixed(1)}s`,children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2.5 h-2.5 transition-transform duration-200 shrink-0 ${t?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsxs("span",{className:"font-mono-code flex items-center gap-1.5",children:[l.jsxs("span",{className:"text-cc-fg/60 font-medium",children:[e.length," tool",e.length>1?"s":""]}),l.jsx("span",{className:"text-cc-muted/40",children:"·"}),l.jsxs("span",{className:"tabular-nums",children:[i.totalTime.toFixed(1),"s"]}),i.errorCount>0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/40",children:"·"}),l.jsxs("span",{className:"text-cc-error",children:[i.errorCount," error",i.errorCount>1?"s":""]})]}),i.running>0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/40",children:"·"}),l.jsxs("span",{className:"text-cc-primary",children:[i.running," running"]})]})]}),!t&&e.length>1&&l.jsx("span",{className:"hidden sm:flex items-center gap-px ml-auto flex-shrink-0 h-1.5 max-w-[120px]",children:e.map(a=>l.jsx("span",{className:`h-full rounded-full ${a.isError?"bg-cc-error/40":a.completedAt?"bg-cc-success/30":"bg-cc-primary/40 animate-[typing-breathe_1.5s_ease-in-out_infinite]"}`,style:{width:`${Math.max(4,a.elapsedSeconds/i.maxTime*100)}%`,minWidth:"3px"},title:`${Li(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(c$,{entry:a,maxTime:i.maxTime},a.toolUseId))})]})}function c$({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:Li(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 u$(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 d$(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:u$(t)}function h$(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 f$(e){if(e.length>=2)return!0;const t=e[0];return!(t.kind==="message"&&t.msg.role==="system")}function p$(e){const t=[];let n=[];const i=()=>{n.length!==0&&(f$(n)?t.push({kind:"activity_run",key:h$(n[0]),children:n}):t.push(...n),n=[])};for(const a of e)a.kind==="activity_run"||d$(a)?(i(),t.push(a)):n.push(a);return i(),t}const v2=160;function dx(e){const t=e.split(`
|
|
104
|
-
`).map(n=>n.trim()).find(n=>n.length>0);return t?t.length>v2?`${t.slice(0,v2)}…`:t:""}function TN(e,t){const n=xo(e,t);return{label:n?`${Li(e)} · ${n}`:Li(e),toolName:e}}function m$(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.type==="tool_use")return TN(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 g$(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?TN(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?m$(i)??{label:"Thinking…",italic:!0}:(t=n.content)!=null&&t.trim()?{label:dx(n.content),italic:!0}:{label:"Thinking…",italic:!0}}}}function AN(e){switch(e.kind){case"message":return[e.msg.timestamp,e.msg.timestamp];case"tool_msg_group":return[e.startedAt,e.endedAt];case"subagent":{let t=null,n=null;for(const i of e.children){const[a,o]=AN(i);a!==null&&(t===null||a<t)&&(t=a),o!==null&&(n===null||o>n)&&(n=o)}return[t,n]}case"activity_run":{const t=Tf(e);return[t.startedAt,t.endedAt]}}}function Tf(e,t){let n=0,i=0,a=0,o=null,u=null;for(const f of e.children){if(f.kind==="subagent")i++;else if(f.kind==="tool_msg_group")n+=f.items.length;else if(f.kind==="message")for(const v of f.msg.contentBlocks??[])v.type==="tool_use"&&n++,v.type==="tool_result"&&v.is_error&&a++;else{const v=Tf(f);n+=v.toolCalls,i+=v.subagents,a+=v.errors}const[m,g]=AN(f);m!==null&&(o===null||m<o)&&(o=m),g!==null&&(u===null||g>u)&&(u=g)}t!==void 0&&o!==null&&(u=Math.max(u??t,t));const h=e.children[e.children.length-1];return{toolCalls:n,subagents:i,errors:a,steps:e.children.length,startedAt:o,endedAt:u,latest:h?g$(h):null}}function x$({run:e,live:t,children:n}){const[i,a]=k.useState(!1),o=t?Date.now():void 0,u=k.useMemo(()=>Tf(e,o),[e,o]),h=u.startedAt!==null&&u.endedAt!==null?Math.max(0,u.endedAt-u.startedAt):null,f=[];u.toolCalls>0&&f.push(`${u.toolCalls} tool call${u.toolCalls===1?"":"s"}`),u.subagents>0&&f.push(`${u.subagents} subagent${u.subagents===1?"":"s"}`),u.errors>0&&f.push(l.jsxs("span",{className:"text-cc-error",children:[u.errors," error",u.errors===1?"":"s"]},"err")),h!==null&&h>=1e3&&f.push(oo(h));const m=t?"Working":"Worked",g=`${u.steps} step${u.steps===1?"":"s"}`,v=u.latest;return l.jsxs("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]","data-activity-run":e.key,children:[l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(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}: ${g}, ${i?"collapse":"expand"} details`,className:"w-full flex items-center gap-1.5 py-0.5 text-left group cursor-pointer min-w-0",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",className:`w-2.5 h-2.5 shrink-0 text-cc-muted/40 group-hover:text-cc-muted/70 transition-transform duration-200 ${i?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx("span",{"aria-hidden":"true",className:`w-1.5 h-1.5 rounded-full shrink-0 ${t?"bg-cc-primary animate-[typing-breathe_1.5s_ease-in-out_infinite]":"bg-cc-success/60"}`}),l.jsx("span",{className:"text-[11px] font-medium text-cc-fg/70 shrink-0",children: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":g})]}),!i&&v&&l.jsxs("div",{role:"status",className:"flex items-center gap-1.5 pl-4 py-0.5 text-[11px] min-w-0",children:[v.toolName&&l.jsx(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,v$=40,b$=120,b2=1e4,y$=15*6e4,c0=new Map,_$=[],w$=[];function S$(e){const t=e.split("/").filter(Boolean);return t.length===0?e:t.slice(-2).join("/")}function k$(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 y2(e){return(e.contentBlocks||[]).filter(n=>n.type==="tool_use").map(n=>({id:n.id,name:n.name,input:n.input}))}function j$(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 MN(e){const t=[];for(const n of e){const i=k$(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(...y2(n)),a.endedAt=Math.max(a.endedAt,n.timestamp);continue}t.push({kind:"tool_msg_group",toolName:i,items:y2(n),firstId:n.id,startedAt:n.timestamp,endedAt:n.timestamp})}else t.push({kind:"message",msg:n})}return t}function RN(e,t,n){const i=MN(e),a=[];for(const o of i){a.push(o);const u=j$(o);for(const h of u){const f=n.get(h);if(f&&f.length>0){const m=t.get(h)||{description:"Subagent",agentType:""},g=RN(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:g})}}}return a}function N$(e){const t=new Map;for(const a of e)if(a.contentBlocks){for(const o of a.contentBlocks)if(o.type==="tool_use"&&o.name==="Task"){const{input:u,id:h}=o,f=Array.isArray(u==null?void 0:u.receiver_thread_ids)?u.receiver_thread_ids.filter(b=>typeof b=="string"&&b.length>0):void 0,m=f&&f.length>0?f.length:void 0,g=typeof(u==null?void 0:u.sender_thread_id)=="string"&&u.sender_thread_id.length>0?u.sender_thread_id:void 0,v=typeof(u==null?void 0:u.codex_status)=="string"||g!==void 0||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:g,receiverThreadIds:f})}}if(t.size===0)return MN(e);const n=new Map,i=[];for(const a of e)if(a.parentToolUseId&&t.has(a.parentToolUseId)){let o=n.get(a.parentToolUseId);o||(o=[],n.set(a.parentToolUseId,o)),o.push(a)}else i.push(a);return RN(i,t,n)}function C$({group:e}){const[t,n]=k.useState(!1),i=No(e.toolName),a=Li(e.toolName),o=e.items.length;if(o===1){const u=e.items[0];return l.jsx("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(_2,{}),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:xo(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(_2,{}),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:o})]}),t&&l.jsx("div",{className:"border-t border-cc-border px-3 py-1.5",children:e.items.map((u,h)=>{const f=xo(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 hv({entries:e,toolActivity:t,liveRunKey:n}){return l.jsx(l.Fragment,{children:e.map((i,a)=>{if(i.kind==="activity_run")return l.jsx(x$,{run:i,live:i.key===n,children:l.jsx(hv,{entries:i.children,toolActivity:t})},i.key);if(i.kind==="tool_msg_group")return l.jsx(C$,{group:i},i.firstId||a);if(i.kind==="subagent")return l.jsx(A$,{group:i},i.taskToolUseId);const o=i.msg,u=E$(o),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(Wz,{message:o}),f&&l.jsx(o$,{entries:h})]},o.id)})})}function E$(e){var t;return(t=e.contentBlocks)!=null&&t.length?e.contentBlocks.filter(n=>n.type==="tool_use").map(n=>n.id):[]}function T$(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 A$({group:e}){const[t,n]=k.useState(!1),i=e.description||"Subagent",a=e.agentType,o=e.children.length,u=T$(e.status),h=e.receiverCount,f=e.senderThreadId,m=e.receiverThreadIds||[],g=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`${Li(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(w=>w.type==="tool_use");if(N)return Li(N.name)}return""},[v]);return l.jsx("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]",children:l.jsxs("div",{className:"ml-10 border-l border-cc-border/50 pl-4",children:[l.jsxs("button",{type:"button",onClick:()=>n(!t),className:"relative z-10 flex items-center gap-1.5 py-1 text-left cursor-pointer group w-full",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2.5 h-2.5 text-cc-muted/40 group-hover:text-cc-muted/70 transition-transform shrink-0 ${t?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx("span",{className:"text-[11px] font-medium text-cc-primary/70",children:i}),a&&l.jsx("span",{className:"text-[10px] text-cc-muted/50",children:a}),l.jsx("span",{className:"text-[10px] text-cc-muted/40",children:g==="codex"?"Codex":"Claude"}),u&&l.jsx("span",{className:`text-[10px] ${u.className}`,children:u.label}),h!==void 0&&l.jsxs("span",{className:"text-[10px] text-cc-muted/40",children:[h," agent",h===1?"":"s"]}),!t&&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:o})]}),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(hv,{entries:e.children})]})]})})}function _2(){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 M$({sessionId:e}){var nn;const t=K(se=>se.messages.get(e)??_$),n=K(se=>(se.sdkSessions||w$).find(je=>je.sessionId===e)),i=K(se=>se.streamingStartedAt.get(e)),a=K(se=>se.streamingOutputTokens.get(e)),o=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)),g=k.useRef(null),v=k.useRef(null),b=k.useRef(!0),[y,_]=k.useState(0),[j,N]=k.useState(_h),[w,C]=k.useState([]),[E,R]=k.useState(0),[M,L]=k.useState(!1),[F,D]=k.useState(!1),[X,U]=k.useState(!1),[G,O]=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]),I=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(w.length===0)return t;const se=[],je=new Set;for(const Qe of w)je.has(Qe.id)||(je.add(Qe.id),se.push(Qe));for(const Qe of t)je.has(Qe.id)||(je.add(Qe.id),se.push(Qe));return se},[w,t]),P=k.useMemo(()=>N$(z),[z]);k.useEffect(()=>{N(_h),C([]),R(0),L(!1),D(!1),U(!1),O(""),de.current=new Set},[e,A]);const oe=P.length,we=oe>j,Ne=k.useMemo(()=>we?P.slice(oe-j):P,[P,we,oe,j]),Ae=oe-Ne.length,De=fa(),ze=k.useMemo(()=>De?p$(Ne):Ne,[De,Ne]),Ce=ze[ze.length-1],Re=o==="running"&&(Ce==null?void 0:Ce.kind)==="activity_run"?Ce.key:void 0,Ut=k.useCallback(()=>{const se=v.current,je=(se==null?void 0:se.scrollHeight)??0;N(Qe=>Qe+_h),requestAnimationFrame(()=>{if(se){const Qe=se.scrollHeight;se.scrollTop+=Qe-je}})},[]),Kt=k.useCallback(async(se={})=>{if(!Ee||!A||X)return;const je=v.current,Qe=(je==null?void 0:je.scrollHeight)??0,et=F?E:0;U(!0),O("");try{const un=await _e.getClaudeSessionHistory(A,{cursor:et,limit:v$}),ce=un.messages.map(Y=>({id:Y.id,role:Y.role,content:Y.content,contentBlocks:Y.role==="assistant"?Y.contentBlocks:void 0,timestamp:Y.timestamp||Date.now(),model:Y.role==="assistant"?Y.model:void 0,stopReason:Y.role==="assistant"?Y.stopReason:void 0})),be=[];for(const Y of ce)de.current.has(Y.id)||(de.current.add(Y.id),be.push(Y));C(Y=>[...be,...Y]),R(un.nextCursor),L(un.hasMore),D(!0),be.length>0&&N(Y=>Y+be.length),se.preserveScroll!==!1&&je&&requestAnimationFrame(()=>{const Y=je.scrollHeight;je.scrollTop+=Y-Qe})}catch(un){const ce=un instanceof Error?un.message:String(un);O(ce||"Failed to load previous history"),F||(C([]),R(0),L(!1))}finally{U(!1)}},[Ee,A,X,F,E]);k.useEffect(()=>{if(!i&&o!=="running"&&!I){_(0);return}const se=i||Date.now();_(Date.now()-se);const je=setInterval(()=>_(Date.now()-se),1e3);return()=>clearInterval(je)},[i,o,I]);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&&M&&!X&&se.scrollTop<=b$&&Kt({preserveScroll:!0})}const jt=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 Qe=c0.get(e);typeof Qe=="number"?se.scrollTop=Math.max(0,se.scrollHeight-se.clientHeight-Qe):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(()=>jt())},[W,jt]),k.useEffect(()=>{var se;b.current&&((se=g.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 Kt({preserveScroll:!1}),disabled:X,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"})}),X?"Loading...":"Load previous history"]}),G&&l.jsx("p",{className:"text-xs text-cc-error mt-2",children:G})]}):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 Xe=o==="running"&&u!=null?Math.max(0,Date.now()-u):0,St=I&&(o!=="running"||Xe>=b2)?"background":Xe>=y$&&!re?"stalled":Xe>=b2?"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?`· ${S$(n.cwd)}`:""]})]}),l.jsx("button",{onClick:()=>void Kt({preserveScroll:!0}),disabled:X,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:X?"Loading...":"Load previous history"})]}),G&&l.jsx("p",{className:"text-xs text-cc-error mt-2",children:G})]}),Ee&&F&&l.jsx("div",{className:"flex justify-center",children:l.jsx("p",{className:"text-[11px] text-cc-muted",children:M?X?"Loading older transcript...":"Scroll to top to load older transcript":"Loaded all available prior transcript"})}),we&&l.jsx("div",{className:"flex justify-center pb-3",children:l.jsxs("button",{onClick:Ut,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(hv,{entries:ze,toolActivity:m,liveRunKey:Re}),f&&f.size>0&&!q&&l.jsx(l$,{tools:Array.from(f.values())}),o==="compacting"&&l.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-cc-warning font-mono-code pl-10 py-1",children:[l.jsxs("svg",{className:"w-3.5 h-3.5 animate-spin shrink-0",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[l.jsx("circle",{cx:"8",cy:"8",r:"6",opacity:"0.2"}),l.jsx("path",{d:"M8 2a6 6 0 0 1 6 6",strokeLinecap:"round"})]}),l.jsx("span",{children:"Compacting context..."})]}),(o==="running"||I)&&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:oo(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 ",oo(Xe)," — 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?oo(Math.max(0,Date.now()-re.startedAt)):`no update for ${oo(Xe)}`}),(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:oo(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:g})]})})]})}const R$={codex:"✳",xhigh:"★",max:"■",mini:"⚡"};function O$(e,t){for(const[i,a]of Object.entries(R$))if(e.includes(i))return a;const n=["◆","●","◕","✦"];return n[t%n.length]}function L$(e){return e.map((t,n)=>({value:t.value,label:t.label||t.value,icon:O$(t.value,n)}))}const ON=[{value:"claude-opus-5-5",label:"Opus 5.5",icon:""},{value:"claude-opus-5",label:"Opus 5",icon:""},{value:"claude-opus-4-8",label:"Opus 4.8",icon:""},{value:"claude-fable-5-1",label:"Fable 5.1",icon:"★"},{value:"claude-fable-5",label:"Fable 5",icon:"★"},{value:"claude-opus-4-7",label:"Opus 4.7",icon:""},{value:"claude-opus-4-6",label:"Opus 4.6",icon:""},{value:"claude-sonnet-5-5",label:"Sonnet 5.5",icon:""},{value:"claude-sonnet-5",label:"Sonnet 5",icon:""},{value:"claude-haiku-4-5-20251001",label:"Haiku 4.5",icon:""}],LN=[{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:"●"}],fv=[{value:"bypassPermissions",label:"Agent"},{value:"plan",label:"Plan"}],pv=[{value:"bypassPermissions",label:"Auto"},{value:"plan",label:"Plan"}],D$=[{value:"",label:"Default"},{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"xhigh",label:"xHigh"},{value:"max",label:"Max"}],DN=[{value:"bypassPermissions",label:"Full Auto"},{value:"acceptEdits",label:"Auto-Edit"},{value:"default",label:"Supervised"}],zN=[{value:"bypassPermissions",label:"Full Auto"},{value:"default",label:"Supervised"}];function $N(e){return e==="codex"?LN:ON}function w2(e){return e==="codex"?pv:fv}function oP(e){return e==="codex"?zN:DN}function S2(e){return e==="codex"?LN[0].value:ON[0].value}function k2(e){return e==="codex"?pv[0].value:fv[0].value}function cP(e){return e==="codex"?zN[0].value:DN[0].value}function z$(e){return e==="codex"?[]:D$}function j2({sessionId:e}){const[t,n]=k.useState(!1),i=k.useRef(null),a=K(b=>b.sdkSessions.find(y=>y.sessionId===e)||null),o=K(b=>b.sessions.get(e)),u=K(b=>b.cliConnected.get(e)??!1),h=(a==null?void 0:a.backendType)??(o==null?void 0:o.backend_type)??"claude",f=(o==null?void 0:o.model)??(a==null?void 0:a.model)??"",m=$N(h),g=m.find(b=>b.value===f)||(f?{label:f,icon:"?"}:null),v=k.useCallback(b=>{if(n(!1),b===f)return;In(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||!g?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: ${g.label}`,"aria-label":"Switch model","aria-expanded":t,"aria-haspopup":"listbox",children:[g.icon&&l.jsx("span",{className:"text-[13px] leading-none",children:g.icon}),l.jsx("span",{children:g.label}),l.jsx("svg",{viewBox:"0 0 12 12",fill:"currentColor",className:"w-2.5 h-2.5 opacity-50",children:l.jsx("path",{d:"M6 8L1.5 3.5h9L6 8z"})})]}),t&&l.jsx("div",{className:"absolute right-0 bottom-full mb-1 z-50 min-w-[160px] rounded-lg border border-cc-separator bg-cc-bg shadow-lg overflow-hidden",role:"listbox","aria-label":"Select model",children: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 BN({open:e,loading:t,prompts:n,selectedIndex:i,onSelect:a,menuRef:o,className:u=""}){return e?l.jsx("div",{ref:o,className:`max-h-[240px] overflow-y-auto bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-20 py-1 ${u}`,children:t?l.jsx("div",{className:"px-3 py-2 text-[12px] text-cc-muted",children:"Searching prompts..."}):n.length>0?n.map((h,f)=>l.jsxs("button",{"data-prompt-index":f,onClick:()=>a(h),className:`w-full px-3 py-2 text-left flex items-center gap-2.5 transition-colors cursor-pointer ${f===i?"bg-cc-hover":"hover:bg-cc-hover/50"}`,children:[l.jsx("span",{className:"flex items-center justify-center w-6 h-6 rounded-md bg-cc-hover text-cc-muted shrink-0",children:l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:[l.jsx("path",{d:"M2.5 8a5.5 5.5 0 1111 0v3a2.5 2.5 0 01-2.5 2.5h-1",strokeLinecap:"round"}),l.jsx("circle",{cx:"8",cy:"8",r:"1.75",fill:"currentColor",stroke:"none"})]})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"text-[13px] font-medium text-cc-fg truncate",children:["@",h.name]}),l.jsx("div",{className:"text-[11px] text-cc-muted truncate",children:h.content})]}),l.jsx("span",{className:"text-[10px] text-cc-muted shrink-0",children:h.scope})]},h.id)):l.jsx("div",{className:"px-3 py-2 text-[12px] text-cc-muted",children:"No prompts found."})}):null}function PN({text:e,caretPos:t,cwd:n,enabled:i=!0}){const[a,o]=k.useState(!1),[u,h]=k.useState(0),[f,m]=k.useState([]),[g,v]=k.useState(!1),b=k.useRef(null),y=k.useCallback(async()=>{v(!0);try{const w=await _e.listPrompts(n);m(w.filter(C=>!!C.name.trim()))}catch{m([])}finally{v(!1)}},[n]);k.useEffect(()=>{y()},[y]);const _=k.useMemo(()=>{const w=e.slice(0,t),C=w.match(/(^|\s)@([^\s@]*)$/);if(!C||C.index===void 0)return null;const E=w.length-C[0].length+C[1].length;return{query:C[2]||"",start:E,end:t}},[e,t]),j=k.useMemo(()=>{if(!a||!_)return[];const w=_.query.toLowerCase();if(!w)return f;const C=f.filter(R=>R.name.toLowerCase().startsWith(w)),E=f.filter(R=>!R.name.toLowerCase().startsWith(w)&&R.name.toLowerCase().includes(w));return[...C,...E]},[a,_,f]);k.useEffect(()=>{const w=i&&!!_;w&&!a?(o(!0),h(0)):!w&&a&&o(!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(w=>{if(!_)return{nextText:e,nextCursor:t};const C=`${w.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:o,mentionMenuIndex:u,setMentionMenuIndex:h,mentionContext:_,filteredPrompts:j,promptsLoading:g,savedPrompts:f,selectPrompt:N,refreshPrompts:y,mentionMenuRef:b}}const $$=[];function N2({isPlan:e,isConnected:t,onToggle:n,modeLabel:i,size:a}){const o=a==="desktop",u=o?"px-2.5 py-1.5":"px-2 py-1",h=o?"text-cc-primary border-cc-primary/30 bg-cc-primary/8 hover:bg-cc-primary/12 cursor-pointer":"text-cc-primary border-cc-primary/30 bg-cc-primary/8",f=o?"text-cc-muted border-cc-border hover:text-cc-fg hover:bg-cc-hover cursor-pointer":"text-cc-muted border-cc-border";return l.jsxs("button",{onClick:n,disabled:!t,className:`flex items-center gap-1.5 ${u} rounded-md text-[12px] font-semibold transition-all border select-none shrink-0 ${t?e?h:f:"opacity-30 cursor-not-allowed text-cc-muted border-transparent"}`,title:"Toggle mode (Shift+Tab)",children:[e?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:[l.jsx("rect",{x:"3",y:"3",width:"3.5",height:"10",rx:"0.75"}),l.jsx("rect",{x:"9.5",y:"3",width:"3.5",height:"10",rx:"0.75"})]}):l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:[l.jsx("path",{d:"M2.5 4l4 4-4 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),l.jsx("path",{d:"M8.5 4l4 4-4 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]}),l.jsx("span",{children:i})]})}function 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 C2(){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 E2({isRunning:e,canSend:t,onSend:n,onInterrupt:i,size:a}){const o=a==="desktop",u=o?"w-9 h-9":"w-10 h-10",h=o?"bg-cc-primary hover:bg-cc-primary-hover hover:scale-105 text-white cursor-pointer shadow-[0_4px_16px_rgba(217,119,87,0.25)]":"bg-cc-primary hover:bg-cc-primary-hover active:scale-95 text-white cursor-pointer shadow-[0_4px_16px_rgba(217,119,87,0.25)]";return e?l.jsx("button",{onClick:i,className:`flex items-center justify-center ${u} rounded-lg bg-cc-error/10 hover:bg-cc-error/20 text-cc-error transition-colors cursor-pointer`,title:"Stop generation",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1"})})}):l.jsx("button",{onClick:n,disabled:!t,className:`flex items-center justify-center ${u} rounded-full transition-all duration-200 ${t?h:"bg-cc-hover text-cc-muted cursor-not-allowed"}`,title:"Send message",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M3 2l11 6-11 6V9.5l7-1.5-7-1.5V2z"})})})}function B$({sessionId:e}){var ce,be;const[t,n]=k.useState(""),[i,a]=k.useState([]),[o,u]=k.useState(null),[h,f]=k.useState(!1),[m,g]=k.useState(!1),[v,b]=k.useState(0),[y,_]=k.useState(!1),[j,N]=k.useState(""),[w,C]=k.useState("global"),[E,R]=k.useState(null),[M,L]=k.useState(0),F=k.useRef(null),D=k.useRef(null),X=k.useRef(null),U=k.useRef(null),G=K(Y=>Y.cliConnected),O=K(Y=>Y.sessions.get(e)),de=K(Y=>Y.previousPermissionMode.get(e)||"acceptEdits"),W=G.get(e)??!1,q=(O==null?void 0:O.permissionMode)||"acceptEdits",H=q==="plan",I=(O==null?void 0:O.backend_type)==="codex",ve=((be=(ce=(I?pv:fv).find(Y=>Y.value===q))==null?void 0:ce.label)==null?void 0:be.toLowerCase())||q,A=PN({text:t,caretPos:M,cwd:O==null?void 0:O.cwd,enabled:!m}),Ee=k.useMemo(()=>{const Y=[];if(O!=null&&O.slash_commands)for(const me of O.slash_commands)Y.push({name:me,type:"command"});if(O!=null&&O.skills)for(const me of O.skills)Y.push({name:me,type:"skill"});return Y},[O==null?void 0:O.slash_commands,O==null?void 0:O.skills]),Me=k.useMemo(()=>{if(!m)return[];const Y=t.match(/^\/(\S*)$/);if(!Y)return[];const me=Y[1].toLowerCase();return me===""?Ee:Ee.filter(Pe=>Pe.name.toLowerCase().includes(me))},[t,m,Ee]);k.useEffect(()=>{const Y=t.startsWith("/")&&/^\/\S*$/.test(t)&&Ee.length>0;Y&&!m?(g(!0),b(0)):!Y&&m&&g(!1)},[t,Ee.length,m]),k.useEffect(()=>{v>=Me.length&&b(Math.max(0,Me.length-1))},[Me.length,v]),k.useEffect(()=>{if(!X.current||!m)return;const me=X.current.querySelectorAll("[data-cmd-index]")[v];me&&me.scrollIntoView({block:"nearest"})},[v,m]),k.useEffect(()=>{if(U.current===null||!F.current)return;const Y=U.current;F.current.setSelectionRange(Y,Y),U.current=null},[t]);const z=k.useCallback(Y=>{var me;n(`/${Y.name} `),g(!1),(me=F.current)==null||me.focus()},[]),P=k.useCallback(Y=>{var Pe;const me=A.selectPrompt(Y);U.current=me.nextCursor,n(me.nextText),A.setMentionMenuOpen(!1),L(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 Y=t.trim();if(!Y||!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;In(e,{type:"user_message",content:Y,session_id:e,attachments:Pe,client_msg_id:me});const Ke=K.getState();Ke.appendMessage(e,{id:me,role:"user",content:Y,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),g(!1),A.setMentionMenuOpen(!1),F.current&&(F.current.style.height="auto"),(at=F.current)==null||at.focus()}function we(Y){if(m&&Me.length>0){if(Y.key==="ArrowDown"){Y.preventDefault(),b(me=>(me+1)%Me.length);return}if(Y.key==="ArrowUp"){Y.preventDefault(),b(me=>(me-1+Me.length)%Me.length);return}if(Y.key==="Tab"&&!Y.shiftKey){Y.preventDefault(),z(Me[v]);return}if(Y.key==="Enter"&&!Y.shiftKey){Y.preventDefault(),z(Me[v]);return}if(Y.key==="Escape"){Y.preventDefault(),g(!1);return}}if(A.mentionMenuOpen&&Y.key==="Escape"){Y.preventDefault(),A.setMentionMenuOpen(!1);return}if(A.mentionMenuOpen&&A.filteredPrompts.length>0){if(Y.key==="ArrowDown"){Y.preventDefault(),A.setMentionMenuIndex(me=>(me+1)%A.filteredPrompts.length);return}if(Y.key==="ArrowUp"){Y.preventDefault(),A.setMentionMenuIndex(me=>(me-1+A.filteredPrompts.length)%A.filteredPrompts.length);return}if(Y.key==="Tab"&&!Y.shiftKey||Y.key==="Enter"&&!Y.shiftKey){Y.preventDefault(),P(A.filteredPrompts[A.mentionMenuIndex]);return}}if(A.mentionMenuOpen&&A.filteredPrompts.length===0&&(Y.key==="Enter"&&!Y.shiftKey||Y.key==="Tab"&&!Y.shiftKey)){Y.preventDefault();return}if(Y.key==="Tab"&&Y.shiftKey){Y.preventDefault(),Xe();return}Y.key==="Enter"&&!Y.shiftKey&&(Y.preventDefault(),oe())}function Ne(Y){n(Y.target.value),L(Y.target.selectionStart??Y.target.value.length);const me=Y.target;me.style.height="auto",me.style.height=Math.min(me.scrollHeight,200)+"px"}function Ae(){F.current&&L(F.current.selectionStart??0)}function De(){In(e,{type:"interrupt"})}async function ze(Y){if(Y.length===0)return;const me=[],Pe=[];let Ke=i.reduce((at,ht)=>at+ht.size,0);for(const at of Y){if(at.size>pf){Pe.push(`${at.name} is too large (${ca(at.size)}, max ${ca(pf)})`);continue}if(Ke+at.size>mf){Pe.push(`${at.name} would exceed the per-message limit (${ca(mf)})`);continue}const{base64:ht,mediaType:fn}=await SN(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(Y){const me=Y.target.files;me&&(await ze(Array.from(me)),Y.target.value="")}function Re(Y){a(me=>me.filter((Pe,Ke)=>Ke!==Y))}async function Ut(Y){var Ke;const me=(Ke=Y.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&&(Y.preventDefault(),await ze(Pe))}function Kt(Y){Y.dataTransfer.types.includes("Files")&&(Y.preventDefault(),Y.stopPropagation(),f(!0))}function Ft(Y){Y.currentTarget===Y.target&&f(!1)}async function jt(Y){if(!Y.dataTransfer.types.includes("Files"))return;Y.preventDefault(),Y.stopPropagation(),f(!1);const me=Array.from(Y.dataTransfer.files);me.length>0&&await ze(me)}function wt(){const Y=t.trim().slice(0,32);N(Y||""),R(null),_(me=>!me)}function Xe(){if(!W)return;const Y=K.getState();if(!H)Y.setPreviousPermissionMode(e,q),In(e,{type:"set_permission_mode",mode:"plan"}),Y.updateSession(e,{permissionMode:"plan"});else{const me=de||(I?"bypassPermissions":"acceptEdits");In(e,{type:"set_permission_mode",mode:me}),Y.updateSession(e,{permissionMode:me})}}async function St(){const Y=t.trim(),me=j.trim();if(!Y||!me)return;if(w==="project"&&!(O!=null&&O.cwd)){R("No project folder available for this session");return}const Pe={name:me,content:Y,scope:w};w==="project"&&(Pe.projectPaths=[O.cwd]);try{await _e.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(Y=>Y.promptSuggestions.get(e))??$$,je=K(Y=>Y.clearPromptSuggestions),et=K(Y=>Y.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:Kt,onDragLeave:Ft,onDrop:jt,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((Y,me)=>l.jsx(NN,{name:Y.name,mediaType:Y.mediaType,base64:Y.base64,size:Y.size,onRemove:()=>Re(me)},me))}),o&&l.jsx("div",{className:"mb-2 px-3 sm:px-0 text-[11px] text-cc-error",children:o}),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((Y,me)=>l.jsx("button",{onClick:()=>{if(!W||et)return;const Pe=x0();In(e,{type:"user_message",content:Y,session_id:e,client_msg_id:Pe}),K.getState().appendMessage(e,{id:Pe,role:"user",content:Y,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:Y,children:Y},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:X,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((Y,me)=>l.jsxs("button",{"data-cmd-index":me,onClick:()=>z(Y),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:Y.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:["/",Y.name]}),l.jsx("span",{className:"ml-2 text-[11px] text-cc-muted",children:Y.type})]})]},`${Y.type}-${Y.name}`))}),l.jsx(BN,{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:Y=>{N(Y.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":w==="global",onClick:()=>C("global"),className:`px-2 py-0.5 text-[11px] rounded border transition-colors cursor-pointer ${w==="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":w==="project",onClick:()=>C("project"),className:`px-2 py-0.5 text-[11px] rounded border transition-colors cursor-pointer ${w==="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"})]}),w==="project"&&(O==null?void 0:O.cwd)&&l.jsx("div",{className:"text-[10px] text-cc-muted font-mono-code truncate",title:O.cwd,children:O.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(N2,{isPlan:H,isConnected:W,onToggle:Xe,modeLabel:ve,size:"mobile"}),l.jsx(j2,{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(C2,{})}),l.jsx(wh,{onClick:()=>{var Y;return(Y=D.current)==null?void 0:Y.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:we,onClick:Ae,onKeyUp:Ae,onPaste:Ut,"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(E2,{isRunning:et,canSend:un,onSend:oe,onInterrupt:De,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 Y;return(Y=D.current)==null?void 0:Y.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(C2,{})}),l.jsx(N2,{isPlan:H,isConnected:W,onToggle:Xe,modeLabel:ve,size:"desktop"}),l.jsx("div",{className:"flex-1"}),l.jsx(j2,{sessionId:e}),l.jsx(E2,{isRunning:et,canSend:un,onSend:oe,onInterrupt:De,size:"desktop"})]})]})]})})}function P$(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 U$(e,t){const n={};for(const[i,a]of Object.entries(t)){const o=e[Number(i)],u=typeof(o==null?void 0:o.question)=="string"&&o.question?o.question:i;n[u]=a}return n}function F$({permission:e,sessionId:t}){const[n,i]=k.useState(!1),a=K(m=>m.removePermission);function o(m,g){i(!0),In(t,{type:"permission_response",request_id:e.request_id,behavior:"allow",updated_input:m,...g!=null&&g.length?{updated_permissions:g}:{}}),a(t,e.request_id)}function u(){i(!0),In(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(G$,{input:e.input,onSelect:m=>o({...e.input,answers:m}),disabled:n}):l.jsx(q$,{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(H$,{validation:e.ai_validation}),!h&&l.jsxs("div",{className:"flex items-center gap-2 mt-3 flex-wrap",children:[l.jsxs("button",{onClick:()=>o(),disabled:n,className:"inline-flex items-center gap-1.5 px-3 py-2.5 text-xs font-medium rounded-lg bg-cc-success/90 hover:bg-cc-success text-white disabled:opacity-50 transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-3 h-3",children:l.jsx("path",{d:"M3 8.5l3.5 3.5 6.5-7"})}),"Allow"]}),f==null?void 0:f.map((m,g)=>l.jsxs("button",{onClick:()=>o(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"})}),P$(m)]},g)),l.jsxs("button",{onClick:u,disabled:n,className:"inline-flex items-center gap-1.5 px-3 py-2.5 text-xs font-medium rounded-lg bg-cc-hover hover:bg-cc-active text-cc-fg border border-cc-border disabled:opacity-50 transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-3 h-3",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})}),"Deny"]})]})]})]})})})}function I$(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 H$({validation:e}){const t=e.verdict==="uncertain"&&I$(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 q$({toolName:e,input:t,description:n}){return e==="Bash"?l.jsx(V$,{input:t}):e==="Edit"?l.jsx(Y$,{input:t}):e==="Write"?l.jsx(Q$,{input:t}):e==="Read"?l.jsx(X$,{input:t}):e==="Glob"?l.jsx(W$,{input:t}):e==="Grep"?l.jsx(K$,{input:t}):e==="ExitPlanMode"?l.jsx(Z$,{input:t}):l.jsx(UN,{input:t,description:n})}function V$({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 G$({input:e,onSelect:t,disabled:n}){const i=Array.isArray(e.questions)?e.questions:[],[a,o]=k.useState({}),[u,h]=k.useState({}),[f,m]=k.useState({});function g(N){return U$(i,N)}function v(N,w){const C=String(N);o(E=>({...E,[C]:w})),m(E=>({...E,[C]:!1})),i.length<=1&&t(g({[C]:w}))}function b(N){var E;const w=String(N),C=(E=u[w])==null?void 0:E.trim();C&&(o(R=>({...R,[w]:C})),i.length<=1&&t(g({[w]:C})))}function y(N,w){const C=String(N);h(R=>({...R,[C]:w}));const E=w.trim();o(R=>{if(!E){const M={...R};return delete M[C],M}return{...R,[C]:E}})}function _(N){const w=String(N);m(C=>{const E=!!C[w],R={...C,[w]:!E};return E&&(o(M=>{const L={...M};return delete L[w],L}),h(M=>{const L={...M};return delete L[w],L})),R})}function j(){t(g(a))}if(i.length===0){const N=typeof e.question=="string"?e.question:"";return N?l.jsx("div",{className:"text-sm text-cc-fg bg-cc-code-bg/30 rounded-lg px-3 py-2",children:N}):l.jsx(UN,{input:e})}return l.jsxs("div",{className:"space-y-3",children:[i.map((N,w)=>{const C=typeof N.header=="string"?N.header:"",E=typeof N.question=="string"?N.question:"",R=Array.isArray(N.options)?N.options:[],M=String(w),L=a[M],F=f[M];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,X)=>{const U=typeof D.label=="string"?D.label:String(D),G=typeof D.description=="string"?D.description:"",O=L===U;return l.jsx("button",{onClick:()=>v(w,U),disabled:n,className:`w-full text-left px-3 py-2 rounded-lg border transition-all cursor-pointer disabled:opacity-50 ${O?"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 ${O?"border-cc-primary":"border-cc-muted/40"}`,children:O&&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:U}),G&&l.jsx("p",{className:"text-[11px] text-cc-muted mt-0.5 leading-snug",children:G})]})]})},X)}),l.jsx("button",{onClick:()=>_(w),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[M]||"",onChange:D=>y(w,D.target.value),onKeyDown:D=>{D.key==="Enter"&&b(w)},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"})]})]})]},w)}),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 Y$({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 Q$({input:e}){const t=String(e.file_path||""),n=String(e.content||"");return l.jsx(jo,{newText:n,fileName:t,mode:"compact"})}function X$({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 W$({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 K$({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 Z$({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:[uv],components:{h1:({children:i})=>l.jsx("h1",{className:"text-base font-semibold text-cc-fg mb-2",children:i}),h2:({children:i})=>l.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-1.5 mt-3 first:mt-0",children:i}),h3:({children:i})=>l.jsx("h3",{className:"text-sm font-medium text-cc-fg mb-1.5 mt-2",children:i}),p:({children:i})=>l.jsx("p",{className:"mb-2 last:mb-0",children:i}),ul:({children:i})=>l.jsx("ul",{className:"list-disc pl-4 mb-2 space-y-0.5",children:i}),ol:({children:i})=>l.jsx("ol",{className:"list-decimal pl-4 mb-2 space-y-0.5",children:i}),li:({children:i})=>l.jsx("li",{children:i}),strong:({children:i})=>l.jsx("strong",{className:"font-semibold text-cc-fg",children:i}),a:({href:i,children:a})=>l.jsx("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"text-cc-primary hover:underline",children:a}),code:i=>{const{children:a,className:o}=i;return/language-(\w+)/.exec(o||"")||typeof a=="string"&&a.includes(`
|
|
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(wN,{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 UN({input:e,description:t}){const n=Object.entries(e).filter(([,i])=>i!=null&&i!=="");return n.length===0&&t?l.jsx("div",{className:"text-xs text-cc-fg",children:t}):l.jsxs("div",{className:"space-y-1",children:[t&&l.jsx("div",{className:"text-xs text-cc-muted mb-1",children:t}),l.jsx("div",{className:"bg-cc-code-bg/30 rounded-lg px-3 py-2 space-y-1",children:n.map(([i,a])=>{const o=typeof a=="string"?a.length>200?a.slice(0,200)+"...":a:JSON.stringify(a);return l.jsxs("div",{className:"flex gap-2 text-[11px] font-mono-code",children:[l.jsxs("span",{className:"text-cc-muted shrink-0",children:[i,":"]}),l.jsx("span",{className:"text-cc-fg break-all",children:o})]},i)})})]})}function J$({entry:e,onDismiss:t}){const{request:n,behavior:i,reason:a}=e,o=i==="allow";let u=n.tool_name;if(n.tool_name==="Bash"&&typeof n.input.command=="string"){const h=n.input.command;u=h.length>60?h.slice(0,60)+"...":h}else(n.tool_name==="Read"||n.tool_name==="Write"||n.tool_name==="Edit")&&typeof n.input.file_path=="string"?u=`${n.tool_name} ${n.input.file_path}`:n.tool_name==="Glob"&&typeof n.input.pattern=="string"?u=`Glob ${n.input.pattern}`:n.tool_name==="Grep"&&typeof n.input.pattern=="string"&&(u=`Grep ${n.input.pattern}`);return l.jsxs("div",{className:`flex items-center gap-2 px-3 py-1.5 text-[11px] ${o?"text-cc-success":"text-cc-error"}`,children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 shrink-0 opacity-70",children:l.jsx("path",{fillRule:"evenodd",d:"M8 1.246l.542.228c1.926.812 3.732.95 5.408.435l.61-.187v6.528a5.75 5.75 0 01-2.863 4.973L8 15.5l-3.697-2.277A5.75 5.75 0 011.44 8.25V1.722l.61.187c1.676.515 3.482.377 5.408-.435L8 1.246z",clipRule:"evenodd"})}),l.jsxs("span",{className:"flex-1",children:["AI auto-",o?"approved":"denied",":"," ",l.jsx("span",{className:"font-mono-code opacity-80",children:u}),a&&l.jsxs("span",{className:"text-cc-muted ml-1",children:["(",a,")"]})]}),t&&l.jsx("button",{onClick:t,className:"opacity-50 hover:opacity-100 transition-opacity cursor-pointer flex-shrink-0","aria-label":"Dismiss notification",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]})}const e9=[],t9=[],T2="activity-tray-panel";function n9(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 s9(e,t,n=4e3){const[i,a]=k.useState(!1),o=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(o.current),h?o.current=setTimeout(()=>a(!0),n):a(!1),()=>clearTimeout(o.current)),[h,n]),k.useEffect(()=>{a(!1)},[u]),i}function i9(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 r9({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 a9({agent:e,tick:t}){const[n,i]=k.useState(!1),a=e.status!=="running",o=!!e.summary,u=l.jsxs(l.Fragment,{children:[l.jsx(r9,{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:n9(e.startedAt,e.completedAt)})]});return l.jsxs("div",{className:`transition-opacity duration-300 ${a?"opacity-60":""}`,children:[o?l.jsx("button",{type:"button",onClick:()=>i(!n),"aria-expanded":n,className:"w-full flex items-center gap-2 px-2.5 min-h-[36px] text-left hover:bg-cc-hover/50 rounded-md transition-colors cursor-pointer",children:u}):l.jsx("div",{className:"flex items-center gap-2 px-2.5 min-h-[36px]",children:u}),n&&e.summary&&l.jsx("p",{className:"px-2.5 pb-1.5 ml-4 text-[10px] text-cc-muted/60 leading-relaxed line-clamp-3 font-mono-code",children:e.summary})]})}function l9({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 o9({sessionId:e}){const[t,n]=k.useState(!1),i=k.useRef(null),a=k.useRef(null),o=K(E=>E.sessionTasks.get(e)??e9),u=K(E=>E.sessionBackgroundAgents.get(e)??t9),h=s9(o,u),f=u.some(E=>E.status==="running"),m=i9(f),g=u.filter(E=>E.status==="running").length,v=o.length,b=o.filter(E=>E.status==="completed").length,y=o.filter(E=>E.status==="in_progress").length,_=o.length>0||u.length>0,j=g>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[w,C]=k.useState(!1);return k.useEffect(()=>{_&&C(!1)},[_,o.length,u.length]),!_||w?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:T2,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(a9,{agent:E,tick:m},E.toolUseId))]}),u.length>0&&o.length>0&&l.jsx("div",{className:"border-t border-cc-border/30 mx-2",role:"separator"}),o.length>0&&l.jsxs("div",{className:"py-1",children:[l.jsx("div",{className:"px-3 py-1",role:"heading","aria-level":4,children:l.jsx("span",{className:"text-[9px] text-cc-muted/40 uppercase tracking-widest font-semibold",children:"Tasks"})}),o.map(E=>l.jsx(l9,{task:E},E.id))]})]}),l.jsxs("button",{type:"button",onClick:()=>n(!t),"aria-expanded":t,"aria-controls":T2,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: ${g} 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:g>0?`${g} agent${g!==1?"s":""}`:`${u.length} done`}),u.length>0&&o.length>0&&l.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-cc-muted/30"}),o.length>0&&l.jsxs("span",{className:"text-[11px] text-cc-fg/70 tabular-nums",children:[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 c9({sessionId:e}){const t=K(_=>_.pendingPermissions.get(e)),n=K(_=>_.aiResolvedPermissions.get(e)),i=K(_=>_.clearAiResolvedPermissions),a=K(_=>_.connectionStatus.get(e)??"disconnected"),o=K(_=>_.cliConnected.get(e)??!1),u=K(_=>_.cliReconnecting.get(e)??!1),h=K(_=>_.setCliReconnecting),[f,m]=k.useState(null),g=k.useRef(void 0);k.useEffect(()=>{m(null),clearTimeout(g.current)},[e,o]),k.useEffect(()=>()=>clearTimeout(g.current),[]);const v=k.useCallback(async()=>{m(null),clearTimeout(g.current),h(e,!0);try{await _e.relaunchSession(e)}catch(_){da(_),h(e,!1);const j=_ instanceof Error?_.message:"Reconnection failed";m(j),g.current=setTimeout(()=>m(null),4e3)}},[e,h]),b=k.useMemo(()=>t?Array.from(t.values()):[],[t]),y=a==="connected"&&!o;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(M$,{sessionId:e}),l.jsx(o9,{sessionId:e})]}),n&&n.length>0&&l.jsx("div",{className:"shrink-0 border-t border-cc-border bg-cc-card",children:l.jsx(J$,{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(F$,{permission:_,sessionId:e},_.request_id))}),l.jsx(B$,{sessionId:e})]})}function u9({sessionId:e}){const[t,n]=k.useState(!1),i=k.useRef(null),a=K(m=>m.sessions.get(e)),o=(a==null?void 0:a.aiValidationEnabled)??!1,u=(a==null?void 0:a.aiValidationAutoApprove)??!0,h=(a==null?void 0:a.aiValidationAutoDeny)??!1;k.useEffect(()=>{if(!t)return;function m(g){i.current&&!i.current.contains(g.target)&&n(!1)}return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[t]);function f(m,g){const v=!g,b={[m]:v};K.getState().setSessionAiValidation(e,b),xT(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 ${o?"text-cc-success hover:bg-cc-hover":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:o?"AI Validation: On":"AI Validation: Off","aria-label":"Toggle AI validation settings","aria-expanded":t,children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-[15px] h-[15px]",children:l.jsx("path",{fillRule:"evenodd",d:"M8 1.246l.542.228c1.926.812 3.732.95 5.408.435l.61-.187v6.528a5.75 5.75 0 01-2.863 4.973L8 15.5l-3.697-2.277A5.75 5.75 0 011.44 8.25V1.722l.61.187c1.676.515 3.482.377 5.408-.435L8 1.246z",clipRule:"evenodd"})})}),t&&l.jsxs("div",{className:"absolute right-0 top-full mt-1 z-50 w-64 bg-cc-bg border border-cc-border rounded-lg shadow-lg p-2 space-y-1",children:[l.jsx("p",{className:"text-[10px] text-cc-muted px-2 pt-1 pb-1",children:"AI Validation for this session"}),l.jsxs("button",{type:"button",onClick:()=>f("aiValidationEnabled",o),className:"w-full flex items-center justify-between px-2 py-1.5 rounded-md hover:bg-cc-hover text-cc-fg transition-colors cursor-pointer","aria-label":"Toggle AI validation",children:[l.jsx("span",{className:"text-xs",children:"Enabled"}),l.jsx("span",{className:`text-[10px] font-medium ${o?"text-cc-success":"text-cc-muted"}`,children:o?"On":"Off"})]}),o&&l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button",onClick:()=>f("aiValidationAutoApprove",u),className:"w-full flex items-center justify-between px-2 py-1.5 rounded-md hover:bg-cc-hover text-cc-fg transition-colors cursor-pointer","aria-label":"Toggle auto-approve safe tools",children:[l.jsx("span",{className:"text-xs",children:"Auto-approve safe"}),l.jsx("span",{className:`text-[10px] font-medium ${u?"text-cc-success":"text-cc-muted"}`,children:u?"On":"Off"})]}),l.jsxs("button",{type:"button",onClick:()=>f("aiValidationAutoDeny",h),className:"w-full flex items-center justify-between px-2 py-1.5 rounded-md hover:bg-cc-hover text-cc-fg transition-colors cursor-pointer","aria-label":"Toggle auto-deny dangerous tools",children:[l.jsx("span",{className:"text-xs",children:"Auto-deny dangerous"}),l.jsx("span",{className:`text-[10px] font-medium ${h?"text-cc-success":"text-cc-muted"}`,children:h?"On":"Off"})]})]})]})]})}function d9({sessionId:e}){const[t,n]=k.useState(!1),[i,a]=k.useState(null),[o,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)},g=v=>{v.key==="Escape"&&n(!1)};return window.addEventListener("pointerdown",m),window.addEventListener("keydown",g),()=>{window.removeEventListener("pointerdown",m),window.removeEventListener("keydown",g)}},[t]);const f=k.useCallback(async m=>{a(m),u(!1);try{const{blob:g,filename:v}=await _e.exportSession(e,m),b=URL.createObjectURL(g),y=document.createElement("a");y.href=b,y.download=v,document.body.appendChild(y),y.click(),y.remove(),URL.revokeObjectURL(b),n(!1)}catch(g){da(g),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"})]}),o&&l.jsx("div",{className:"px-3 py-1.5 text-[11px] text-cc-error",children:"Export failed"})]})]})}function h9({sessionId:e}){const t=K(g=>g.density),n=K(g=>g.magicUiAvailable),i=K(g=>{var v;return!!e&&((v=g.sessions.get(e))==null?void 0:v.magicUiActive)===!0}),a=k.useCallback(()=>{var v;if(!e)return;const g=K.getState();((v=g.sessions.get(e))==null?void 0:v.magicUiActive)===!0&&(g.setSessionMagicUi(e,!1),V_(e,!1))},[e]),o=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),V_(e,!0))},[e]);if(!n||!e)return l.jsx(f9,{});const f=t==="compact",m=[{key:"standard",label:"Standard view",active:!i&&!f,onClick:o,icon:l.jsx(FN,{})},{key:"compact",label:"Compact view",active:!i&&f,onClick:u,icon:l.jsx(IN,{})},{key:"magic",label:"Magic dashboard view",active:i,onClick:h,icon:l.jsx(p9,{})}];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(g=>l.jsx("button",{onClick:g.onClick,className:`flex items-center justify-center w-8 h-8 transition-colors cursor-pointer ${g.active?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:g.label,"aria-label":g.label,"aria-pressed":g.active,children:g.icon},g.key))})}function f9(){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(IN,{}):l.jsx(FN,{})})}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 6h16M4 12h16M4 18h16"})})}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 7h16M4 11h16M4 15h16M4 19h16"})})}function p9(){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 m9(){var F;const e=k.useSyncExternalStore(D=>(window.addEventListener("hashchange",D),()=>window.removeEventListener("hashchange",D)),()=>window.location.hash),t=k.useMemo(()=>Ux(e),[e]),n=t.page==="session"||t.page==="home",i=K(D=>D.currentSessionId),a=K(D=>D.cliConnected),o=K(D=>D.sessionStatus),u=K(D=>D.sessionNames),h=K(D=>D.sdkSessions),f=K(D=>D.sidebarOpen),m=K(D=>D.setSidebarOpen),g=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?o.get(i)??null:null,w=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,M=["chat","diff"],L=D=>{D==="chat"&&b!=="chat"&&i&&_(i),y(D)};return k.useEffect(()=>{const D=X=>{if(!(X.metaKey||X.ctrlKey)||X.key.toLowerCase()!=="j"||!E)return;const U=X.target;if(U&&(U.tagName==="TEXTAREA"||U.tagName==="INPUT"||U.isContentEditable))return;X.preventDefault();const G=Math.max(0,M.indexOf(b)),O=X.shiftKey?-1:1,de=(G+O+M.length)%M.length;L(M[de])};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[E,M,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:()=>L("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 ${w?N==="running"?"bg-cc-primary":N==="compacting"?"bg-cc-warning":"bg-cc-success":"bg-cc-muted opacity-45"}`}),"Session"]}),l.jsxs("button",{onClick:()=>L("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(u9,{sessionId:i}),E&&i&&l.jsx(d9,{sessionId:i}),E&&l.jsx(h9,{sessionId:i??null}),l.jsx(g9,{}),R&&l.jsx("button",{onClick:()=>v(!g),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer ${g?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:"Toggle context panel","aria-label":"Toggle context panel",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 3h18v18H3V3z"}),l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 3v18"})]})})]})]})})}function g9(){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 HN="cc-recent-dirs";function gf(){try{return JSON.parse(localStorage.getItem(HN)||"[]")}catch{return[]}}function qN(e){const t=gf().filter(n=>n!==e);t.unshift(e),localStorage.setItem(HN,JSON.stringify(t.slice(0,5)))}function x9(){return!1}function VN({onClose:e,embedded:t=!1}){const[n,i]=k.useState([]),[a,o]=k.useState(!0),[u,h]=k.useState(null),[f,m]=k.useState(""),[g,v]=k.useState([]),[b,y]=k.useState(""),[_,j]=k.useState(!1),[N,w]=k.useState(""),[C,E]=k.useState([{key:"",value:""}]),[R,M]=k.useState(!1),L=k.useCallback(()=>{_e.listEnvs().then(i).catch(()=>{}).finally(()=>o(!1))},[]);k.useEffect(()=>{L()},[L]);function F(q){h(q.slug),m(q.name);const H=Object.entries(q.variables).map(([I,re])=>({key:I,value:re}));H.length===0&&H.push({key:"",value:""}),v(H),y("")}function D(){h(null),y("")}async function X(){if(!u)return;const q={};for(const H of g){const I=H.key.trim();I&&(q[I]=H.value)}try{await _e.updateEnv(u,{name:f.trim()||void 0,variables:q}),h(null),y(""),L()}catch(H){y(H instanceof Error?H.message:String(H))}}async function U(q){try{await _e.deleteEnv(q),u===q&&h(null),L()}catch(H){y(H instanceof Error?H.message:String(H))}}async function G(){const q=N.trim();if(!q)return;M(!0);const H={};for(const I of C){const re=I.key.trim();re&&(H[re]=I.value)}try{await _e.createEnv(q,H),w(""),E([{key:"",value:""}]),j(!1),y(""),L()}catch(I){y(I instanceof Error?I.message:String(I))}finally{M(!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=>w(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()&&G()}}),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:G,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,I=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:g,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 X(),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(v9,{env:q,varCount:I,onStartEdit:()=>F(q),onDelete:()=>void U(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 O=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=>w(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()&&G()}}),l.jsx(Sh,{rows:C,onChange:E}),l.jsx("button",{onClick:G,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:()=>U(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:g,onChange:v})]})}),l.jsx("button",{onClick:X,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,I])=>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:I})]},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,O]})]});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 v9({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(o,u,h){const f=[...e];f[o]={...f[o],[u]:h},t(f)}function i(o){const u=e.filter((h,f)=>f!==o);u.length===0&&u.push({key:"",value:""}),t(u)}function a(){t([...e,{key:"",value:""}])}return l.jsxs("div",{className:"space-y-1.5",children:[e.map((o,u)=>l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx("input",{type:"text",value:o.key,onChange:h=>n(u,"key",h.target.value),placeholder:"KEY",className:"flex-1 min-w-0 px-3 py-2.5 min-h-[44px] text-xs font-mono-code bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),l.jsx("span",{className:"text-[10px] text-cc-muted",children:"="}),l.jsx("input",{type:"text",value:o.value,onChange:h=>n(u,"value",h.target.value),placeholder:"value",className:"flex-1 min-w-0 px-3 py-2.5 min-h-[44px] text-xs font-mono-code bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),l.jsx("button",{onClick:()=>i(u),"aria-label":"Remove variable",className:"w-10 h-10 min-h-[44px] flex items-center justify-center rounded-lg text-cc-muted hover:text-cc-error hover:bg-cc-error/10 transition-colors cursor-pointer shrink-0",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]},u)),l.jsx("button",{onClick:a,className:"text-xs py-2 min-h-[44px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"+ Add variable"})]})}const b9=Object.freeze(Object.defineProperty({__proto__:null,EnvManager:VN},Symbol.toStringTag,{value:"Module"}));function y9(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 _9({initialPath:e,onSelect:t,onClose:n}){const[i,a]=k.useState(""),[o,u]=k.useState([]),[h,f]=k.useState(!0),[m,g]=k.useState(""),[v,b]=k.useState(""),[y,_]=k.useState(!1),[j,N]=k.useState(""),[w,C]=k.useState(-1),[E,R]=k.useState(!1),[M,L]=k.useState(()=>gf()),F=k.useRef(null),D=k.useRef(null),X=k.useRef(null),U=k.useRef(new Map),G=k.useMemo(()=>{if(!j)return o;const I=j.toLowerCase();return o.filter(re=>re.name.toLowerCase().includes(I))},[o,j]),O=k.useCallback(async I=>{f(!0),g(""),N(""),C(-1);try{const re=await _e.listDirs(I);a(re.path),u(re.dirs)}catch{g("Could not load directory"),u([])}finally{f(!1)}},[]);k.useEffect(()=>{O(e||void 0)},[]),k.useEffect(()=>{const I=F.current;if(!I)return;function re(A){if(A.key!=="Tab")return;const Ee=I.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=X.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 I(re){if(re.key==="Escape"){if(y)return;de()}}return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[y,de]),k.useEffect(()=>{function I(re){var A,Ee;if(y)return;if(re.key==="Backspace"&&document.activeElement!==X.current){if(i&&i!=="/"){re.preventDefault();const Me=i.split("/").slice(0,-1).join("/")||"/";O(Me)}return}const ve=G.length;if(ve!==0){if(re.key==="ArrowDown"){re.preventDefault();const Me=w<ve-1?w+1:0;C(Me),(A=U.current.get(Me))==null||A.focus()}else if(re.key==="ArrowUp"){re.preventDefault();const Me=w>0?w-1:ve-1;C(Me),(Ee=U.current.get(Me))==null||Ee.focus()}}}return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[y,G.length,w,i,O]),k.useEffect(()=>{var I;w>=0&&((I=U.current.get(w))==null||I.scrollIntoView({block:"nearest"}))},[w]);function W(I){qN(I),L(gf()),t(I),n()}const q=y9(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:I=>I.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"})})})]}),M.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:M.map(I=>l.jsx("li",{children:l.jsxs("button",{type:"button",onClick:()=>W(I),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:I.split("/").pop()||I}),l.jsx("span",{className:"text-cc-muted font-mono-code text-[10px] truncate ml-auto",children:I})]})},I))})]}),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:I=>b(I.target.value),onKeyDown:I=>{I.key==="Enter"&&v.trim()&&W(v.trim()),I.key==="Escape"&&(I.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((I,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||O(I.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:I.label})]},I.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:X,type:"text","aria-label":"Filter directories",value:j,onChange:I=>{N(I.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((I,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:()=>O(i||void 0),className:"mt-1 text-xs text-cc-primary hover:text-cc-primary-hover transition-colors cursor-pointer font-medium",children:"Retry"})]}):G.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:G.map((I,re)=>l.jsxs("li",{className:`flex items-center transition-colors ${w===re?"bg-cc-hover":"hover:bg-cc-hover"}`,children:[l.jsxs("button",{type:"button",ref:ve=>{ve?U.current.set(re,ve):U.current.delete(re)},onClick:()=>O(I.path),onKeyDown:ve=>{ve.key==="Enter"&&(ve.preventDefault(),W(I.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:I.path,"aria-label":`Navigate into ${I.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:I.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(I.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 ${I.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"})})})]},I.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 w9(e,t){const n=t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,60);return`${e.toLowerCase()}-${n}`}function S9(e){return e.branchName&&e.branchName.trim()?e.branchName.trim():w9(e.identifier,e.title)}function gu({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 k9({defaultProjectId:e,connectionId:t,onCreated:n,onClose:i}){const[a,o]=k.useState(""),[u,h]=k.useState(""),[f,m]=k.useState(""),[g,v]=k.useState(0),[b,y]=k.useState(!0),[_,j]=k.useState([]),[N,w]=k.useState(""),[C,E]=k.useState(""),[R,M]=k.useState(!0),[L,F]=k.useState(!1),[D,X]=k.useState("");k.useEffect(()=>{let G=!0;return Promise.all([_e.getLinearStates(t),_e.getLinearConnection(t)]).then(([O,de])=>{var q;if(!G)return;j(O.teams),w(de.viewerId);const W=((q=O.teams[0])==null?void 0:q.id)||"";m(W)}).catch(O=>{G&&X(O instanceof Error?O.message:"Failed to load teams")}).finally(()=>{G&&M(!1)}),()=>{G=!1}},[t]),k.useEffect(()=>{if(!f||_.length===0){E("");return}const G=_.find(de=>de.id===f),O=G==null?void 0:G.states.find(de=>de.type==="backlog");E((O==null?void 0:O.id)||"")},[f,_]);async function U(){if(!(!a.trim()||!f)){F(!0),X("");try{const G=await _e.createLinearIssue({title:a.trim(),description:u.trim()||void 0,teamId:f,priority:g,projectId:e||void 0,assigneeId:b&&N?N:void 0,stateId:C||void 0,connectionId:t});n(G.issue)}catch(G){X(G instanceof Error?G.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:G=>G.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:G=>o(G.target.value),onKeyDown:G=>{G.key==="Enter"&&a.trim()&&f&&!L&&U()},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:G=>h(G.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:G=>m(G.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(G=>l.jsxs("option",{value:G.id,children:[G.name," (",G.key,")"]},G.id))})]}),l.jsxs("div",{children:[l.jsx("label",{htmlFor:"create-issue-priority",className:"text-xs text-cc-muted block mb-1",children:"Priority"}),l.jsxs("select",{id:"create-issue-priority",value:g,onChange:G=>v(Number(G.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:G=>y(G.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:U,disabled:!a.trim()||!f||L,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:L?"Creating...":"Create Issue"})]})]})]})}),document.body)}function j9({cwd:e,gitRepoInfo:t,linearConfigured:n,selectedLinearIssue:i,onIssueSelect:a,onBranchFromIssue:o,onConnectionSelect:u}){const[h,f]=k.useState([]),[m,g]=k.useState(null),[v,b]=k.useState(!1),[y,_]=k.useState(""),[j,N]=k.useState([]),[w,C]=k.useState(!1),[E,R]=k.useState(!1),[M,L]=k.useState(""),[F,D]=k.useState(!1),[X,U]=k.useState(null),[G,O]=k.useState([]),[de,W]=k.useState(!1),[q,H]=k.useState(""),[I,re]=k.useState(!1),[ve,A]=k.useState([]),[Ee,Me]=k.useState(!1),[z,P]=k.useState(""),[oe,we]=k.useState(!1),[Ne,Ae]=k.useState([]),[De,ze]=k.useState(!1),[Ce,Re]=k.useState(!1),Ut=k.useRef(null);k.useEffect(()=>{function se(je){Ut.current&&!Ut.current.contains(je.target)&&(C(!1),re(!1))}return document.addEventListener("pointerdown",se),()=>document.removeEventListener("pointerdown",se)},[]),k.useEffect(()=>{if(!n){f([]),g(null),b(!1),u(null);return}let se=!0;return _e.listLinearConnections().then(({connections:je})=>{se&&(f(je),b(!0),je.length>0?(g(je[0].id),u(je[0].id)):(g(null),u(null)))}).catch(()=>{se&&b(!0)}),()=>{se=!1}},[n]);const Kt=k.useCallback(se=>{g(se),u(se),a(null),N([]),_(""),L(""),Ae([]),P(""),A([]),X&&(W(!0),H(""),_e.getLinearProjectIssues(X.projectId,10,se).then(({issues:je})=>{O(je)}).catch(je=>{H(je instanceof Error?je.message:String(je))}).finally(()=>{W(!1)}))},[X,u,a]);k.useEffect(()=>{if(!t||!n){U(null),O([]);return}let se=!0;return W(!0),H(""),(async()=>{try{const{mapping:je}=await _e.getLinearProjectMapping(t.repoRoot);if(!se)return;if(U(je),je){const{issues:Qe}=await _e.getLinearProjectIssues(je.projectId,10,m??void 0);if(!se)return;O(Qe)}else O([])}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([]),L(""),R(!1);return}let je=!0;R(!0),L("");const Qe=setTimeout(()=>{_e.searchLinearIssues(se,8,m??void 0).then(et=>{je&&N(et.issues)}).catch(et=>{je&&(N([]),L(et instanceof Error?et.message:String(et)))}).finally(()=>{je&&R(!1)})},400);return()=>{je=!1,clearTimeout(Qe)}},[n,y,m]),k.useEffect(()=>{if(!n||!oe){Ae([]),ze(!1);return}const se=z.trim();if(se.length<2){Ae([]),ze(!1);return}let je=!0;ze(!0);const Qe=setTimeout(()=>{_e.searchLinearIssues(se,10,m??void 0).then(et=>{je&&Ae(et.issues)}).catch(()=>{je&&Ae([])}).finally(()=>{je&&ze(!1)})},400);return()=>{je=!1,clearTimeout(Qe)}},[n,oe,z,m]);function Ft(se,je=!1){a(se),_(`${se.identifier} - ${se.title}`);const Qe=S9(se);o(Qe,!0),je&&C(!1)}function jt(){a(null),_(""),N([]),L("")}async function wt(se){if(t)try{const{mapping:je}=await _e.upsertLinearProjectMapping({repoRoot:t.repoRoot,projectId:se.id,projectName:se.name});U(je),re(!1),W(!0),H("");const{issues:Qe}=await _e.getLinearProjectIssues(se.id,10,m??void 0);O(Qe)}catch(je){H(je instanceof Error?je.message:String(je))}finally{W(!1)}}async function Xe(){if(t){try{await _e.removeLinearProjectMapping(t.repoRoot)}catch{}U(null),O([]),a(null),_("")}}function St(){if(!n){window.location.hash="#/integrations/linear";return}re(!0),ve.length===0&&(Me(!0),_e.listLinearProjects(m??void 0).then(({projects:se})=>A(se)).catch(()=>{}).finally(()=>Me(!1)))}function nn(se){Re(!1),Ft(se),X&&(W(!0),_e.getLinearProjectIssues(X.projectId,10,m??void 0).then(({issues:je})=>O(je)).catch(()=>{}).finally(()=>W(!1)))}return n?l.jsxs("aside",{className:"space-y-2 mt-0.5",ref:Ut,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=>Kt(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))}),X?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(gu,{className:"w-3.5 h-3.5"}),l.jsx("span",{children:X.projectName}),l.jsx("button",{type:"button",onClick:Xe,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":w,onClick:()=>{if(!n){window.location.hash="#/integrations/linear";return}C(!w)},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(gu,{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."})]})]}),X&&(()=>{const se=z.trim().toLowerCase(),je=!oe&&se?G.filter(et=>et.identifier.toLowerCase().includes(se)||et.title.toLowerCase().includes(se)):oe?[]:G,Qe=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:jt,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}):De?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..."}):Qe.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:Qe.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=>{we(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"})]})]})})(),I&&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))})]}),w&&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&&M&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-error",children:M}),y.trim().length>=2&&!E&&!M&&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&&!M&&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(k9,{defaultProjectId:X==null?void 0:X.projectId,connectionId:m??void 0,onCreated:nn,onClose:()=>Re(!1)})]}):null}function N9({cwd:e,gitRepoInfo:t,selectedBranch:n,isNewBranch:i,useWorktree:a,onBranchChange:o,onWorktreeChange:u,onBranchesLoaded:h}){const[f,m]=k.useState([]),[g,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?_e.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":g,onClick:()=>{!g&&t&&_e.gitFetch(t.repoRoot).catch(()=>{}).finally(()=>{_e.listBranches(t.repoRoot).then(j=>{m(j),h(j)}).catch(()=>{m([]),h([])})}),v(!g),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"})})]}),g&&l.jsxs("div",{className:"absolute left-0 bottom-full mb-1 w-72 max-w-[calc(100%-2rem)] bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 overflow-hidden",children:[l.jsx("div",{className:"px-2 py-2 border-b border-cc-border",children:l.jsx("input",{type:"text",value: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))),w=f.filter(R=>R.isRemote&&(!j||R.name.toLowerCase().includes(j))),C=f.some(R=>R.name.toLowerCase()===j),E=N.length>0||w.length>0;return l.jsxs(l.Fragment,{children:[N.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"px-3 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:"Local"}),N.map(R=>l.jsxs("button",{onClick:()=>{o(R.name,!1),v(!1)},className:`w-full px-3 py-1.5 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 ${R.name===n?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{className:"truncate font-mono-code",children:R.name}),l.jsxs("span",{className:"ml-auto flex items-center gap-1.5 shrink-0",children:[R.ahead>0&&l.jsxs("span",{className:"text-[9px] text-green-500",children:[R.ahead,"↑"]}),R.behind>0&&l.jsxs("span",{className:"text-[9px] text-amber-500",children:[R.behind,"↓"]}),R.worktreePath&&l.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-blue-500/15 text-blue-600 dark:text-blue-400",children:"wt"}),R.isCurrent&&l.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-green-500/15 text-green-600 dark:text-green-400",children:"current"})]})]},R.name))]}),w.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"}),w.map(R=>l.jsxs("button",{onClick:()=>{o(R.name,!1),v(!1)},className:`w-full px-3 py-1.5 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 ${R.name===n?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{className:"truncate font-mono-code",children:R.name}),l.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-cc-hover text-cc-muted ml-auto shrink-0",children:"remote"})]},`remote-${R.name}`))]}),!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:()=>{o(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 C9=336*60*60*1e3,Xa=12,E9=24;function hx(e){return e.split("/").filter(Boolean).pop()||e}function A2(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 T9(e){return e.length>8?e.slice(0,8):e}function A9(e,t=2){const n=e.split("/").filter(Boolean);return n.length<=t?e:`.../${n.slice(-t).join("/")}`}function M9(e){if(!Number.isFinite(e)||e<=0)return"Unknown";const t=Date.now()-e;if(t<6e4)return"Just now";const n=Math.floor(t/6e4);if(n<60)return`${n}m ago`;const i=Math.floor(n/60);if(i<24)return`${i}h ago`;const a=Math.floor(i/24);if(a<14)return`${a}d ago`;const o=Math.floor(a/7);if(o<8)return`${o}w ago`;const u=Math.floor(a/30);return`${Math.max(1,u)}mo ago`}const kh="cc-draft-prompt";function R9(){var Vi;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")||""),[o,u]=k.useState(()=>localStorage.getItem("cc-session-prefix")||""),[h,f]=k.useState(""),[m,g]=k.useState(()=>localStorage.getItem("cc-backend")||"claude"),[v,b]=k.useState([]),[y,_]=k.useState(()=>S2(localStorage.getItem("cc-backend")||"claude")),[j,N]=k.useState(()=>k2(localStorage.getItem("cc-backend")||"claude")),[w,C]=k.useState(()=>localStorage.getItem("cc-effort")||""),[E,R]=k.useState(()=>gf()[0]||""),[M,L]=k.useState([]),[F,D]=k.useState(null),[X,U]=k.useState(!1),[G,O]=k.useState(""),[de,W]=k.useState(null),[q,H]=k.useState(!1),[I,re]=k.useState(null),[ve,A]=k.useState(null),[Ee,Me]=k.useState(()=>localStorage.getItem("cc-onboarding-dismissed")!=="true"),z=de||$N(m),P=w2(m),oe=z$(m),[we,Ne]=k.useState([]),[Ae,De]=k.useState(()=>localStorage.getItem("cc-selected-env")||""),[ze,Ce]=k.useState(!1),[Re,Ut]=k.useState(!1),Kt=x9(),[Ft,jt]=k.useState(()=>Kt),[wt,Xe]=k.useState([]),[St,nn]=k.useState(()=>localStorage.getItem("cc-selected-sandbox")||""),[se,je]=k.useState(!1),Qe=k.useRef(null),[et,un]=k.useState(null),ce=k.useRef(null),be=k.useRef(null),[Y,me]=k.useState(!1),[Pe,Ke]=k.useState(!1),[at,ht]=k.useState(!1),[fn,is]=k.useState(!1),[Ct,vs]=k.useState(!1),[Un,sn]=k.useState(""),[vr,Pi]=k.useState(!0),[le,xe]=k.useState([]),[Se,rt]=k.useState(!1),[It,wn]=k.useState(""),[Nn,vt]=k.useState(!1),[rn,en]=k.useState(Xa),[Ro,$u]=k.useState(""),[bs,br]=k.useState(null),[ma,ga]=k.useState(!1),[Xs,Ws]=k.useState(""),[yr,Ui]=k.useState(!1),[Af,Bu]=k.useState([]),[Fi,pi]=k.useState(null),[ol,xa]=k.useState(!1),[Oo,mi]=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),gi=k.useRef(null),Do=K(Q=>Q.currentSessionId),an=PN({text:e,caretPos:Lo,cwd:E||void 0});k.useEffect(()=>{if(ba.current===null||!rs.current)return;const Q=ba.current;rs.current.setSelectionRange(Q,Q),ba.current=null},[e]),k.useEffect(()=>{var ge;window.matchMedia("(min-width: 640px)").matches&&((ge=rs.current)==null||ge.focus())},[]),k.useEffect(()=>{_e.getHome().then(({home:Q,cwd:ge})=>{E||R(ge||Q)}).catch(()=>{}),_e.listEnvs().then(Ne).catch(()=>{}),_e.listSandboxes().then(Xe).catch(()=>{}),_e.getBackends().then(b).catch(()=>{}),_e.getSettings().then(Q=>{H(Q.linearApiKeyConfigured)}).catch(()=>{})},[]);function Mf(Q){g(Q),localStorage.setItem("cc-backend",Q),W(null),_(S2(Q)),N(k2(Q)),Q!=="claude"&&(vs(!1),xe([]),wn(""),rt(!1),vt(!1),en(Xa),$u(""))}k.useEffect(()=>{if(m!=="codex"){W(null);return}_e.getBackendModels(m).then(Q=>{if(Q.length>0){const ge=L$(Q);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 Q="the-companion:latest",ge=()=>{_e.getImageStatus(Q).then(it=>{un(it),it.status==="idle"&&_e.pullImage(Q).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 Q(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),gi.current&&!gi.current.contains(ge.target)&&Ce(!1),Qe.current&&!Qe.current.contains(ge.target)&&je(!1)}return document.addEventListener("pointerdown",Q),()=>document.removeEventListener("pointerdown",Q)},[]),k.useEffect(()=>{if(!E){br(null);return}_e.getRepoInfo(E).then(Q=>{br(Q),Ws(Q.currentBranch),Ui(!1)}).catch(()=>{br(null),Ws(""),Ui(!1)})},[E]);const zo=z.find(Q=>Q.value===y)||z[0],ya=P.find(Q=>Q.value===j)||P[0],cl=oe.find(Q=>Q.value===w)||oe[0],ul=m==="codex"?"/logo-codex.svg":"/logo.svg",Ii=E?E.split("/").pop()||E:"Select folder",xi=k.useMemo(()=>Un.trim(),[Un]),_r=m==="claude"&&Ct&&xi.length>0,as=k.useMemo(()=>{const Q=Date.now()-C9;return le.filter(ge=>ge.createdAt>=Q)},[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(Q=>{const ge=A2(Q).toLowerCase(),it=hx(Q.cwd).toLowerCase(),mt=(Q.gitBranch||"").toLowerCase(),gt=Q.cwd.toLowerCase(),Ge=Q.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]),Hi=rn<Ks.length,qi=Math.max(0,le.length-as.length),Rf=!Nn&&as.length>0,hl=k.useCallback(async()=>{if(m==="claude"){rt(!0),wn("");try{const[Q,ge]=await Promise.all([_e.listSessions(),_e.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 Q)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 Qn=E&&Ge.cwd===E?0:1,kr=E&&Rn.cwd===E?0:1;return Qn!==kr?Qn-kr:Rn.createdAt-Ge.createdAt});xe(gt),vt(!1),en(Xa)}catch(Q){const ge=Q instanceof Error?Q.message:String(Q);wn(ge||"Failed to load existing sessions"),xe([]),en(Xa)}finally{rt(!1)}}},[m,E]);k.useEffect(()=>{m==="claude"&&Ct&&hl()},[m,Ct,hl]),k.useEffect(()=>{en(Xa)},[_s,Nn]);async function $o(Q){if(Q.length===0)return;const ge=[],it=[];let mt=M.reduce((gt,Ge)=>gt+Ge.size,0);for(const gt of Q){if(gt.size>pf){it.push(`${gt.name} is too large (${ca(gt.size)}, max ${ca(pf)})`);continue}if(mt+gt.size>mf){it.push(`${gt.name} would exceed the per-message limit (${ca(mf)})`);continue}const{base64:Ge,mediaType:Rn}=await SN(gt);ge.push({name:gt.name,base64:Ge,mediaType:Rn,size:gt.size}),mt+=gt.size}ge.length>0&&L(gt=>[...gt,...ge]),D(it.length>0?it.join("; "):null)}async function Of(Q){const ge=Q.target.files;ge&&(await $o(Array.from(ge)),Q.target.value="")}function bt(Q){L(ge=>ge.filter((it,mt)=>mt!==Q))}async function Pu(Q){var mt;const ge=(mt=Q.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&&(Q.preventDefault(),await $o(it))}function fl(Q){t(Q.target.value),va(Q.target.selectionStart??Q.target.value.length);const ge=Q.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(Q){var it;const ge=an.selectPrompt(Q);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(Q){if(an.mentionMenuOpen&&Q.key==="Escape"){Q.preventDefault(),an.setMentionMenuOpen(!1);return}if(an.mentionMenuOpen&&an.filteredPrompts.length>0){if(Q.key==="ArrowDown"){Q.preventDefault(),an.setMentionMenuIndex(ge=>(ge+1)%an.filteredPrompts.length);return}if(Q.key==="ArrowUp"){Q.preventDefault(),an.setMentionMenuIndex(ge=>(ge-1+an.filteredPrompts.length)%an.filteredPrompts.length);return}if(Q.key==="Tab"&&!Q.shiftKey||Q.key==="Enter"&&!Q.shiftKey){Q.preventDefault(),Ds(an.filteredPrompts[an.mentionMenuIndex]);return}}if(an.mentionMenuOpen&&an.filteredPrompts.length===0&&(Q.key==="Enter"&&!Q.shiftKey||Q.key==="Tab"&&!Q.shiftKey)){Q.preventDefault();return}if(Q.key==="Tab"&&Q.shiftKey){Q.preventDefault();const ge=w2(m),mt=(ge.findIndex(gt=>gt.value===j)+1)%ge.length;N(ge[mt].value);return}Q.key==="Enter"&&!Q.shiftKey&&(Q.preventDefault(),Fu())}function Uu(Q){const ge=i.trim(),it=ge?`[${ge}]: ${Q}`:Q;if(!I)return it;const mt=(I.description??"").trim();return`${["Linear issue context:",`- Identifier: ${I.identifier}`,`- Title: ${I.title}`,I.stateName?`- State: ${I.stateName}`:"",I.priorityLabel?`- Priority: ${I.priorityLabel}`:"",I.teamName?`- Team: ${I.teamName}`:"",`- URL: ${I.url}`,mt?`- Description:
|
|
113
|
-
${mt}`:""].filter(Boolean).join(`
|
|
114
|
-
`)}
|
|
115
|
-
|
|
116
|
-
User request:
|
|
117
|
-
${it}`}async function Fu(){const Q=e.trim();if(!(!Q||X)){if(n&&!i.trim()){O("Please enter your name before starting a session.");return}if(U(!0),O(""),mi(""),bs){const ge=Xs||bs.currentBranch;if(ge&&ge===bs.currentBranch){const it=Af.find(mt=>mt.name===ge&&!mt.isRemote);if(it&&it.behind>0){pi({behind:it.behind,branchName:ge});return}}}await wr(Q)}}async function wr(Q,ge){const it=K.getState();it.clearCreation(),it.setSessionCreating(!0,m);try{Do&&y0(Do);const mt=(ge==null?void 0:ge.resumeSessionAt)||(_r?xi:void 0),gt=mt?(ge==null?void 0:ge.forkSession)??(_r?vr: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:Xs.trim()||void 0,Qn=(ge==null?void 0:ge.useWorktree)!==void 0?ge.useWorktree:ma,kr=(ge==null?void 0:ge.createBranch)!==void 0?ge.createBranch:!!(Rn&&yr),pl=Q.trim(),ws=pl.length>0?Uu(pl):null,Zs=ws?x0():null,Ho=M.length>0?M.map(ks=>({name:ks.name,media_type:ks.mediaType,data:ks.base64,size:ks.size})):void 0,jr=await KM({initialMessage:ws&&Zs?{content:ws,attachments:Ho,clientMsgId:Zs}:void 0,model:y,permissionMode:j,effort:m==="claude"&&w?w:void 0,cwd:Ge||void 0,envSlug:Ae||void 0,sandboxEnabled:Ft?!0:void 0,sandboxSlug:Ft&&St?St:void 0,branch:Rn,createBranch:kr?!0:void 0,useWorktree:Qn?!0:void 0,backend:m,codexInternetAccess:m==="codex"?!0:void 0,resumeSessionAt:mt,forkSession:gt,userName:i.trim()||void 0,linearConnectionId:I&&ve||void 0,linearIssue:I?{identifier:I.identifier,title:I.title,stateName:I.stateName,teamName:I.teamName,url:I.url}:void 0},ks=>{K.getState().addCreationProgress(ks)}),Ss=jr.sessionId,Nr=K.getState(),Js=Nr.sdkSessions.filter(ks=>ks.sessionId!==Ss);Nr.setSdkSessions([...Js,{sessionId:Ss,state:jr.state,cwd:jr.cwd,createdAt:Date.now(),backendType:jr.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=U2(qo),ei=o.trim()||i.trim(),Sa=h.trim()||wa,Vo=ei?`${ei}_${Sa}`:Sa;K.getState().setSessionName(Ss,Vo),_e.renameSession(Ss,Vo).catch(()=>{}),f(""),Ge&&qN(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()}),I&&(_e.linkLinearIssue(Ss,I,ve||void 0).then(()=>K.getState().setLinkedLinearIssue(Ss,I)).catch(()=>{}),_e.transitionLinearIssue(I.id,ve||void 0).catch(()=>{})),K.getState().clearCreation()}catch(mt){const gt=mt instanceof Error?mt.message:String(mt);O(gt);const Ge=Q.trim();K.getState().setCreationError(gt,Ge?{text:Ge}:null),U(!1)}}async function Bo(Q,ge){X||(U(!0),O(""),mi(""),R(Q.cwd),ga(!1),Ui(!1),Ws(Q.gitBranch||""),sn(Q.resumeSessionId),Pi(ge),await wr("",{resumeSessionAt:Q.resumeSessionId,forkSession:ge,cwd:Q.cwd,branch:Q.gitBranch,useWorktree:!1,createBranch:!1}))}async function Lf(){if(Fi){xa(!0),mi("");try{const Q=E||(bs==null?void 0:bs.repoRoot);if(!Q)throw new Error("No working directory");const ge=await _e.gitPull(Q);if(!ge.success){mi(ge.output||"Pull failed"),xa(!1),U(!1);return}pi(null),xa(!1),await wr(e.trim())}catch(Q){mi(Q instanceof Error?Q.message:String(Q)),xa(!1)}}}function ls(){const Q=e.trim();pi(null),mi(""),wr(Q)}function Po(){pi(null),mi(""),U(!1)}const Iu=k.useCallback((Q,ge)=>{Ws(Q),Ui(ge)},[]),Uo=k.useCallback((Q,ge)=>{Ws(Q),Ui(ge)},[]),Sr=k.useCallback(Q=>{Bu(Q)},[]),Fo=k.useCallback(Q=>{re(Q),!Q&&bs&&(Ws(bs.currentBranch),Ui(!1))},[bs]),Io=e.trim().length>0&&!X&&(!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:Q=>{const ge=Q.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:o,onChange:Q=>{const ge=Q.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:Q=>f(Q.target.value),maxLength:50,placeholder:"e.g. InvoicePdf","aria-label":"Session topic",className:"w-full px-3 py-2 text-sm bg-cc-card border border-cc-border rounded-lg focus:outline-none focus:border-cc-primary text-cc-fg placeholder:text-cc-muted/70"}),l.jsxs("span",{className:"text-[10px] text-cc-muted/70 leading-snug",children:["When set, the session is named"," ",l.jsxs("span",{className:"font-mono-code",children:[o.trim()||i.trim()||"MA","_",h.trim()||"InvoicePdf"]}),"."]})]}),l.jsx("input",{ref: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(BN,{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"}),(I||M.length>0)&&l.jsxs("div",{className:"flex items-center gap-2 px-4 pt-3 flex-wrap",children:[I&&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:I.identifier}),l.jsx("span",{className:"truncate",children:I.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:"×"})]}),M.map((Q,ge)=>l.jsx(NN,{name:Q.name,mediaType:Q.mediaType,base64:Q.base64,size:Q.size,onRemove:()=>bt(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(!Y),"aria-expanded":Y,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"})})]}),Y&&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(Q=>l.jsxs("button",{onClick:()=>{_(Q.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 ${Q.value===y?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{children:Q.icon}),Q.label]},Q.value))})]}),oe.length>0&&l.jsxs("div",{className:"relative",ref:Cn,children:[l.jsxs("button",{onClick:()=>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(Q=>l.jsx("button",{onClick:()=>{C(Q.value),localStorage.setItem("cc-effort",Q.value),ht(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${Q.value===w?"text-cc-primary font-medium":"text-cc-fg"}`,children:Q.label},Q.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(Q=>l.jsx("button",{onClick:()=>{N(Q.value),Ke(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${Q.value===j?"text-cc-primary font-medium":"text-cc-fg"}`,children:Q.label},Q.value))})]}),l.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-cc-muted/30 mx-0.5 hidden sm:block"}),l.jsxs("div",{children:[l.jsxs("button",{onClick:()=>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:Ii})]}),fn&&l.jsx(_9,{initialPath:E||"",onSelect:Q=>{R(Q)},onClose:()=>is(!1)})]}),l.jsx(N9,{cwd:E,gitRepoInfo:bs,selectedBranch:Xs,isNewBranch:yr,useWorktree:ma,onBranchChange:Iu,onWorktreeChange:ga,onBranchesLoaded:Sr}),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:gi,children:[l.jsxs("button",{onClick:()=>{ze||_e.listEnvs().then(Ne).catch(()=>{}),Ce(!ze)},"aria-expanded":ze,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?((Vi=we.find(Q=>Q.slug===Ae))==null?void 0:Vi.name)||"Env":"No env"})]}),ze&&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:()=>{De(""),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"}),we.map(Q=>l.jsxs("button",{onClick:()=>{De(Q.slug),localStorage.setItem("cc-selected-env",Q.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 ${Q.slug===Ae?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{className:"truncate",children:Q.name}),l.jsxs("span",{className:"text-cc-muted ml-auto shrink-0",children:[Object.keys(Q.variables).length," var",Object.keys(Q.variables).length!==1?"s":""]})]},Q.slug)),l.jsx("div",{className:"border-t border-cc-border mt-1 pt-1",children:l.jsx("button",{onClick:()=>{Ut(!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..."})})]})]}),Kt,l.jsx("div",{className:"flex-1"}),l.jsx("button",{onClick:()=>{var Q;return(Q=be.current)==null?void 0:Q.click()},className:"flex items-center justify-center w-7 h-7 rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:"Attach file",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M11.5 6.5L7 11a2 2 0 1 1-2.83-2.83l5-5a3.25 3.25 0 1 1 4.6 4.6l-5.7 5.7a4.5 4.5 0 0 1-6.36-6.36L7 2",strokeLinecap:"round",strokeLinejoin:"round"})})}),l.jsx("button",{onClick:Fu,disabled:!Io,className:`flex items-center justify-center w-8 h-8 sm:w-9 sm:h-9 rounded-full transition-colors ${Io?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,title:"Send message",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M3 2l11 6-11 6V9.5l7-1.5-7-1.5V2z"})})})]})]}),l.jsxs("div",{className:"mt-3 sm:mt-4 space-y-2",children:[v.length>1&&l.jsx("div",{className:"flex items-center justify-center",children:l.jsx("div",{className:"flex items-center bg-cc-hover/50 rounded-lg p-0.5",children:v.map(Q=>l.jsxs("button",{onClick:()=>Q.available&&Mf(Q.id),disabled:!Q.available,title:Q.available?Q.name:`${Q.name} CLI not found in PATH`,className:`flex items-center gap-1 px-3 py-1.5 text-xs rounded-md transition-colors ${Q.available?m===Q.id?"bg-cc-card text-cc-fg font-medium shadow-sm cursor-pointer":"text-cc-muted hover:text-cc-fg cursor-pointer":"text-cc-muted/40 cursor-not-allowed"}`,children:[Q.name,!Q.available&&l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3 text-cc-error/60",children:[l.jsx("circle",{cx:"8",cy:"8",r:"6"}),l.jsx("path",{d:"M5.5 5.5l5 5M10.5 5.5l-5 5"})]})]},Q.id))})}),m==="claude"&&l.jsxs("div",{children:[l.jsxs("button",{type:"button",onClick:()=>vs(Q=>!Q),className:`mx-auto flex items-center gap-1.5 px-2 py-1 text-[11px] sm:text-xs rounded-md transition-colors cursor-pointer ${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:Se,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:Se?"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&&qi>0&&as.length>0&&l.jsxs("button",{type:"button",onClick:()=>{vt(!0),en(Xa)},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 (",qi,")"]}),Nn&&as.length>0&&l.jsx("button",{type:"button",onClick:()=>{vt(!1),en(Xa)},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:Q=>$u(Q.target.value),placeholder:"Search sessions, branch, folder, or ID",className:"w-full bg-cc-card border border-cc-border rounded-md pl-8 pr-2.5 py-1.5 text-xs text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 focus:border-cc-primary/40"})]})]}),l.jsxs("p",{className:"text-[11px] text-cc-muted",children:[l.jsx("span",{className:"font-medium text-cc-fg",children:"Fork"})," opens a new session that leaves the original untouched.",l.jsx("span",{className:"mx-1",children:"•"}),l.jsx("span",{className:"font-medium text-cc-fg",children:"Continue"})," opens from the same linear thread."]}),It&&l.jsx("p",{className:"text-[11px] text-cc-error",children:It}),!Se&&!It&&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(Q=>{const ge=A2(Q),it=hx(Q.cwd),mt=Q.source==="companion"?"Companion":"Claude",gt=xi===Q.resumeSessionId;return l.jsxs("div",{className:"px-2 py-2 sm:px-2.5 sm:py-2.5 grid grid-cols-1 gap-1.5 sm:gap-2 sm:grid-cols-[minmax(0,1.5fr)_minmax(0,1.2fr)_minmax(0,0.8fr)_minmax(0,0.7fr)_auto] sm:items-center",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("p",{className:`text-xs truncate ${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:T9(Q.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:Q.cwd,children:[l.jsx("div",{className:"truncate",children:it}),l.jsx("div",{className:"mt-0.5 text-[10px] text-cc-muted/70 truncate",title:Q.cwd,children:A9(Q.cwd)})]}),l.jsx("div",{className:"text-[11px] text-cc-muted sm:font-mono-code truncate",children:Q.gitBranch||"—"}),l.jsx("div",{className:"text-[11px] text-cc-muted",children:M9(Q.createdAt)}),l.jsxs("div",{className:"sm:text-right flex gap-1.5 sm:justify-end",children:[l.jsx("button",{type:"button",onClick:()=>{sn(Q.resumeSessionId),Pi(!0),Bo(Q,!0)},"aria-label":`Fork and open ${ge}`,className:`px-2 py-1 rounded-md text-[11px] border transition-colors cursor-pointer ${gt&&vr?"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
|
-
${Q.cwd}${Q.gitBranch?` (${Q.gitBranch})`:""}
|
|
119
|
-
${Q.resumeSessionId}`,children:"Fork"}),l.jsx("button",{type:"button",onClick:()=>{sn(Q.resumeSessionId),Pi(!1),Bo(Q,!1)},"aria-label":`Continue and open ${ge}`,className:`px-2 py-1 rounded-md text-[11px] border transition-colors cursor-pointer ${gt&&!vr?"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
|
-
${Q.resumeSessionId}`,children:"Continue"})]})]},`${Q.resumeSessionId}-row-${Q.sessionId}`)})}),Hi&&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(Q=>Math.min(Q+E9,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(j9,{cwd:E,gitRepoInfo:bs,linearConfigured:q,selectedLinearIssue:I,onIssueSelect:Fo,onBranchFromIssue:Uo,onConnectionSelect:A})]}),Fi&&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:Fi.branchName})," is"," ",l.jsxs("span",{className:"font-semibold text-amber-500",children:[Fi.behind," commit",Fi.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"})]})]})]})}),G&&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:G})]})]}),Re&&l.jsx(VN,{onClose:()=>{Ut(!1),_e.listEnvs().then(Ne).catch(()=>{})}})]})}const O9=[],L9=[],D9={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"}},z9={label:"Unknown",badge:"text-cc-muted bg-cc-hover",dot:"bg-cc-muted opacity-40"};function $9({server:e,sessionId:t}){var h,f;const[n,i]=k.useState(!1),a=D9[e.status]||z9,o=e.status!=="disabled",u=((h=e.tools)==null?void 0:h.length)??0;return l.jsxs("div",{className:"rounded-lg border border-cc-border bg-cc-bg",children:[l.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-2",children:[l.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${a.dot}`}),l.jsx("button",{onClick:()=>i(!n),className:"flex-1 min-w-0 text-left cursor-pointer",children:l.jsx("span",{className:"text-[12px] font-medium text-cc-fg truncate block",children:e.name})}),l.jsx("span",{className:`text-[9px] font-medium px-1.5 rounded-full leading-[16px] shrink-0 ${a.badge}`,children:a.label}),l.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[l.jsx("button",{onClick:()=>pT(t,e.name,!o),className:`w-6 h-6 flex items-center justify-center rounded-md transition-colors cursor-pointer ${o?"text-cc-muted hover:text-cc-fg hover:bg-cc-hover":"text-cc-muted/50 hover:text-cc-success hover:bg-cc-success/10"}`,title:o?"Disable server":"Enable server",children:o?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:[l.jsx("circle",{cx:"8",cy:"8",r:"6"}),l.jsx("path",{d:"M5 8h6",strokeLinecap:"round"})]}):l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:[l.jsx("circle",{cx:"8",cy:"8",r:"6"}),l.jsx("path",{d:"M8 5v6M5 8h6",strokeLinecap:"round"})]})}),(e.status==="failed"||e.status==="connected")&&l.jsx("button",{onClick:()=>mT(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(([,g])=>g).map(([g])=>g).join(", ")||void 0,children:m.name},m.name))})]})]})]})}function B9({sessionId:e,onDone:t}){const[n,i]=k.useState(""),[a,o]=k.useState("stdio"),[u,h]=k.useState(""),[f,m]=k.useState(""),[g,v]=k.useState(""),b=n.trim()&&(a==="stdio"?u.trim():g.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=g.trim(),gT(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:()=>o(_),className:`text-[11px] px-2 py-1 rounded-md border transition-colors cursor-pointer ${a===_?"border-cc-primary text-cc-primary bg-cc-primary/10":"border-cc-border text-cc-muted hover:text-cc-fg hover:border-cc-muted"}`,children:_},_))})]}),a==="stdio"&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Command"}),l.jsx("input",{type:"text",value:u,onChange:_=>h(_.target.value),placeholder:"npx -y @modelcontextprotocol/server-memory",className:"w-full text-[12px] bg-cc-input-bg border border-cc-border rounded px-2 py-1.5 text-cc-fg placeholder:text-cc-muted/40 font-mono focus:outline-none focus:border-cc-primary"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Args (space-separated, optional)"}),l.jsx("input",{type:"text",value:f,onChange:_=>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:g,onChange:_=>v(_.target.value),placeholder:"http://localhost:3000/mcp",className:"w-full text-[12px] bg-cc-input-bg border border-cc-border rounded px-2 py-1.5 text-cc-fg placeholder:text-cc-muted/40 font-mono focus:outline-none focus:border-cc-primary"})]}),l.jsxs("div",{className:"flex gap-1.5 pt-1",children:[l.jsx("button",{type:"submit",disabled:!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 P9({sessionId:e}){const t=K(h=>h.mcpServers.get(e)||O9),n=K(h=>h.cliConnected.get(e)??!1),[i,a]=k.useState(!1),o=K(h=>{var f;return((f=h.sessions.get(e))==null?void 0:f.mcp_servers)??L9});k.useEffect(()=>{n&&q_(e)},[e,n]);const u=t.length>0?t:o.map(h=>({name:h.name,status:h.status,config:{type:"unknown"},scope:""}));return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"shrink-0 px-4 py-2.5 flex items-center justify-between",children:[l.jsxs("span",{className:"text-[13px] font-semibold text-cc-fg flex items-center gap-1.5",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-muted",children:l.jsx("path",{d:"M1.5 3A1.5 1.5 0 013 1.5h10A1.5 1.5 0 0114.5 3v1A1.5 1.5 0 0113 5.5H3A1.5 1.5 0 011.5 4V3zm0 5A1.5 1.5 0 013 6.5h10A1.5 1.5 0 0114.5 8v1A1.5 1.5 0 0113 10.5H3A1.5 1.5 0 011.5 9V8zm0 5A1.5 1.5 0 013 11.5h10a1.5 1.5 0 011.5 1.5v1a1.5 1.5 0 01-1.5 1.5H3A1.5 1.5 0 011.5 14v-1z"})}),"MCP Servers"]}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("button",{onClick:()=>a(!i),disabled:!n,className:`text-[11px] font-medium transition-colors ${n?"text-cc-muted hover:text-cc-fg cursor-pointer":"text-cc-muted/30 cursor-not-allowed"}`,title:"Add MCP server",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M8 3v10M3 8h10",strokeLinecap:"round"})})}),l.jsx("button",{onClick:()=>q_(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(B9,{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($9,{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 U9({cwd:e,open:t,onClose:n}){var G;const[i,a]=k.useState([]),[o,u]=k.useState(!0),[h,f]=k.useState(0),[m,g]=k.useState(""),[v,b]=k.useState(!1),[y,_]=k.useState(!1),[j,N]=k.useState(null),[w,C]=k.useState(null),E=k.useCallback(()=>{u(!0),N(null),_e.getClaudeMdFiles(e).then(O=>{a(O.files),O.files.length>0&&(f(0),g(O.files[0].content)),C(null),b(!1),u(!1)}).catch(O=>{N(O.message),u(!1)})},[e]);k.useEffect(()=>{t&&E()},[t,E]);const R=O=>{v&&!confirm("Discard unsaved changes?")||(f(O),g(i[O].content),b(!1),C(null))},M=async()=>{var de;const O=w||((de=i[h])==null?void 0:de.path);if(O){_(!0),N(null);try{await _e.saveClaudeMd(O,m),b(!1),w?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)}}},L=O=>{const de=O==="root"?`${e}/CLAUDE.md`:`${e}/.claude/CLAUDE.md`;C(de),g(`# CLAUDE.md
|
|
121
|
-
|
|
122
|
-
`),b(!0)},F=()=>{v&&!confirm("Discard unsaved changes?")||n()};if(!t)return null;const D=O=>O.startsWith(e+"/")?O.slice(e.length+1):O,X=i.some(O=>O.path===`${e}/CLAUDE.md`),U=i.some(O=>O.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:o?l.jsx("div",{className:"flex-1 flex items-center justify-center",children:l.jsx("div",{className:"w-5 h-5 border-2 border-cc-primary border-t-transparent rounded-full animate-spin"})}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"shrink-0 w-[180px] sm:w-[200px] border-r border-cc-border bg-cc-sidebar flex flex-col",children:[l.jsx("div",{className:"px-3 py-2 text-[10px] font-semibold text-cc-muted uppercase tracking-wider border-b border-cc-border",children:"Files"}),l.jsxs("div",{className:"flex-1 overflow-y-auto py-1",children:[i.map((O,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 ${!w&&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(O.path)})]},O.path)),w&&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(w)})]})]}),(!X||!U)&&!w&&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"}),!X&&l.jsxs("button",{onClick:()=>L("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"})]}),!U&&l.jsxs("button",{onClick:()=>L("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&&!w?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:()=>L("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:()=>L("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(w||(((G=i[h])==null?void 0:G.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:M,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:O=>{g(O.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 M2({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 ar({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 F9({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 I9({path:e,label:t,onClose:n}){const[i,a]=k.useState(""),[o,u]=k.useState(!0),[h,f]=k.useState(!1),[m,g]=k.useState(!1),[v,b]=k.useState(null);k.useEffect(()=>{_e.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()=>{g(!0),b(null);try{await _e.writeFile(e,i),f(!1)}catch(j){b(j instanceof Error?j.message:"Failed to save")}finally{g(!1)}},_=()=>{h&&!confirm("Discard unsaved changes?")||n()};return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fixed inset-0 bg-black/40 z-50",onClick:_}),l.jsxs("div",{className:"fixed inset-4 sm:inset-8 md:inset-x-[10%] md:inset-y-[5%] z-50 flex flex-col bg-cc-bg border border-cc-border rounded-2xl shadow-2xl overflow-hidden",children:[l.jsxs("div",{className:"shrink-0 flex items-center justify-between px-4 sm:px-5 py-3 bg-cc-card border-b border-cc-border",children:[l.jsxs("div",{className:"flex items-center gap-2.5",children:[l.jsx("div",{className:"w-7 h-7 rounded-lg bg-cc-primary/10 flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:l.jsx("path",{d:"M4 1.5a.5.5 0 01.5-.5h7a.5.5 0 01.354.146l2 2A.5.5 0 0114 3.5v11a.5.5 0 01-.5.5h-11a.5.5 0 01-.5-.5v-13zm1 .5v12h8V4h-1.5a.5.5 0 01-.5-.5V2H5zm6 0v1h1l-1-1z"})})}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("h2",{className:"text-sm font-semibold text-cc-fg truncate",children:t}),l.jsx("p",{className:"text-[11px] text-cc-muted truncate",children:e})]})]}),l.jsx("button",{onClick:_,className:"w-7 h-7 flex items-center justify-center rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer","aria-label":"Close",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),o?l.jsx("div",{className:"flex-1 flex items-center justify-center",children:l.jsx("div",{className:"w-5 h-5 border-2 border-cc-primary border-t-transparent rounded-full animate-spin"})}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"shrink-0 flex items-center justify-between px-4 py-2 bg-cc-card border-b border-cc-border",children:[l.jsx("span",{className:"text-[12px] text-cc-muted font-mono-code truncate",children:e.split("/").pop()}),l.jsxs("div",{className:"flex items-center gap-2",children:[h&&l.jsx("span",{className:"text-[10px] text-cc-warning font-medium",children:"Unsaved"}),l.jsx("button",{onClick: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 H9({item:e,cwd:t,onClose:n}){if(e.kind==="json"){const[i,a]=k.useState(null),[o,u]=k.useState(!0);return k.useEffect(()=>{_e.readFile(e.path).then(h=>{a(h.content),u(!1)}).catch(()=>{a("Failed to read file"),u(!1)})},[e.path]),o?null:l.jsx(F9,{path:e.path,content:i||"",onClose:n})}return e.kind==="claude-md"?l.jsx(U9,{cwd:e.editorCwd||t,open:!0,onClose:n}):l.jsx(I9,{path:e.path,label:e.label,onClose:n})}function q9({sessionId:e}){const t=K(w=>w.sessions.get(e)),n=K(w=>w.sdkSessions.find(C=>C.sessionId===e)),i=(t==null?void 0:t.repo_root)||(t==null?void 0:t.cwd)||(n==null?void 0:n.cwd),[a,o]=k.useState(null),[u,h]=k.useState(!0),[f,m]=k.useState(!1),[g,v]=k.useState(!1),[b,y]=k.useState(null),_=k.useCallback(async()=>{if(i)try{const w=await _e.getClaudeConfig(i);o(w)}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(M2,{icon:"project",title:`Project (${j})`,expanded:f,onToggle:()=>m(w=>!w)}),f&&l.jsxs("div",{className:"pb-1",children:[a.project.claudeMd.map(w=>l.jsx(ar,{label:w.path.includes(".claude/")?".claude/CLAUDE.md":"CLAUDE.md",onClick:()=>y({label:"CLAUDE.md",path:w.path,kind:"claude-md"})},w.path)),a.project.settings&&l.jsx(ar,{label:"settings.json",onClick:()=>y({label:"settings.json",path:a.project.settings.path,kind:"json"})}),a.project.settingsLocal&&l.jsx(ar,{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(w=>l.jsx(ar,{label:`/${w.name}`,onClick:()=>y({label:w.name,path:w.path,kind:"md"})},w.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(M2,{icon:"user",title:`User (${N})`,expanded:g,onToggle:()=>v(w=>!w)}),g&&l.jsxs("div",{className:"pb-1",children:[a.user.claudeMd&&l.jsx(ar,{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(w=>l.jsx(ar,{label:w.name,sublabel:w.description?w.description.slice(0,40):void 0,onClick:()=>y({label:w.name,path:w.path,kind:"md"})},w.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(w=>l.jsx(ar,{label:w.name,onClick:()=>y({label:w.name,path:w.path,kind:"md"})},w.path))]}),a.user.settings&&l.jsx(ar,{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(w=>l.jsx(ar,{label:`/${w.name}`,onClick:()=>y({label:w.name,path:w.path,kind:"md"})},w.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(H9,{item:b,cwd:i,onClose:()=>y(null)}),document.body)]})}function V9(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 G9 extends k.Component{constructor(){super(...arguments);u_(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 GN=[],mv=3e4,Y9=6e4,Q9=5*6e4;let R2=null,O2=new Map;function X9(e){return e!==R2&&(R2=e,O2=new Map(e.map(t=>[t.sessionId,t]))),O2}function zu(e){return K(k.useCallback(t=>X9(t.sdkSessions).get(e),[e]))}const YN="cc-panel-collapsed";function L2(){try{const e=localStorage.getItem(YN);if(e)return new Set(JSON.parse(e))}catch{}return new Set}function W9(e){try{localStorage.setItem(YN,JSON.stringify([...e]))}catch{}}function QN({id:e,label:t,badge:n,defaultOpen:i=!0,children:a}){const[o,u]=k.useState(()=>L2().has(e)?!0:!i),h=k.useRef(!0);k.useEffect(()=>{if(h.current){h.current=!1;return}const m=L2();o?m.add(e):m.delete(e),W9(m)},[o,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":!o,className:"w-full flex items-center gap-1.5 px-4 py-2 text-left hover:bg-cc-hover/50 transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":!0,className:`w-2.5 h-2.5 text-cc-muted/60 shrink-0 transition-transform duration-150 ${o?"":"rotate-90"}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx("span",{className:"text-[11px] font-semibold text-cc-muted uppercase tracking-wider flex-1 truncate",children:t}),n&&l.jsx("span",{className:"shrink-0",children:n})]}),l.jsx("div",{className:"accordion-panel","data-open":o?"false":"true",children:l.jsx("div",{className:"accordion-inner",children:a})})]})}function K9(){const[e,t]=k.useState(()=>localStorage.getItem("cc-user-name")||""),[n,i]=k.useState(()=>localStorage.getItem("cc-session-prefix")||"");return l.jsx(QN,{id:"identity",label:"Identity",children:l.jsxs("div",{className:"px-4 pb-3 pt-1 flex flex-col gap-3",children:[l.jsxs("label",{className:"flex flex-col gap-1",children:[l.jsx("span",{className:"text-[11px] font-medium text-cc-muted",children:"Your name"}),l.jsx("input",{type:"text",value:e,onChange:a=>{const o=a.target.value;t(o),localStorage.setItem("cc-user-name",o)},placeholder:"e.g. Moritz","aria-label":"Your name",className:"w-full px-2.5 py-1.5 text-[13px] bg-cc-input-bg border border-cc-border rounded-md focus:outline-none focus:border-cc-primary text-cc-fg placeholder:text-cc-muted/70"})]}),l.jsxs("label",{className:"flex flex-col gap-1",children:[l.jsxs("span",{className:"text-[11px] font-medium text-cc-muted",children:["Session prefix ",l.jsx("span",{className:"text-cc-muted/60",children:"(optional)"})]}),l.jsx("input",{type:"text",value:n,onChange:a=>{const o=a.target.value;i(o),localStorage.setItem("cc-session-prefix",o)},placeholder:"e.g. MA","aria-label":"Session prefix",className:"w-full px-2.5 py-1.5 text-[13px] bg-cc-input-bg border border-cc-border rounded-md focus:outline-none focus:border-cc-primary text-cc-fg placeholder:text-cc-muted/70"})]}),l.jsxs("p",{className:"text-[10px] text-cc-muted/70 leading-snug",children:["Applied to new sessions: your name prefixes the first message as"," ",l.jsx("span",{className:"font-mono-code",children:"[Name]:"})," and the prefix names sessions ",l.jsx("span",{className:"font-mono-code",children:"prefix_Name"}),"."]})]})})}function XN(e){return e>80?"bg-cc-error":e>50?"bg-cc-warning":"bg-cc-primary"}function WN(e){return e>80?"critical":e>50?"elevated":"normal"}function gr({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 — ${WN(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 Z9({sessionId:e}){var f;const[t,n]=k.useState(null),i=k.useCallback(async()=>{try{const m=await _e.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(g=>g?{...g}:null)},mv);return()=>clearInterval(m)},[i]),!t)return null;const o=t.five_hour!==null,u=t.seven_day!==null,h=!o&&!u&&((f=t.extra_usage)==null?void 0:f.is_enabled);return!o&&!u&&!h?null:l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2",children:[t.five_hour&&l.jsx(gr,{label:"5h Limit",pct:t.five_hour.utilization,detail:t.five_hour.resets_at?g2(t.five_hour.resets_at):void 0}),t.seven_day&&l.jsx(gr,{label:"7d Limit",pct:t.seven_day.utilization,detail:t.seven_day.resets_at?g2(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 — ${WN(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 J9(e){const[t,n]=k.useState(null);return k.useEffect(()=>{let i=!1;const a=async()=>{try{const u=await _e.getSystemMemory();i||n(u)}catch{}};a();const o=setInterval(a,Y9);return()=>{i=!0,clearInterval(o)}},[]),t?l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2",children:[l.jsx(gr,{label:"Memory",pct:t.used_percent,detail:`${jh(t.used_bytes)} / ${jh(t.total_bytes)}`}),t.swap_total_bytes>0&&l.jsx(gr,{label:"Swap",pct:t.swap_used_percent,detail:`${jh(t.swap_used_bytes)} / ${jh(t.swap_total_bytes)}`})]}):null}function eB(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 tB(e){const[t,n]=k.useState(null);return k.useEffect(()=>{let i=!1;const a=async()=>{try{const u=await _e.getSystemDisk();i||n(u)}catch{}};a();const o=setInterval(a,Q9);return()=>{i=!0,clearInterval(o)}},[]),t?l.jsx("div",{className:"shrink-0 px-4 py-2.5",children:l.jsx(gr,{label:"Disk",pct:t.used_percent,detail:`${eB(t.available_bytes)} free`})}):null}function nB({sessionId:e}){const t=K(o=>{var u;return(u=o.sessions.get(e))==null?void 0:u.codex_rate_limits}),[,n]=k.useState(0);if(k.useEffect(()=>{if(!t)return;const o=setInterval(()=>n(u=>u+1),mv);return()=>clearInterval(o)},[t]),!t)return null;const{primary:i,secondary:a}=t;return!i&&!a?null:l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2",children:[i&&l.jsx(gr,{label:`${x2(i.windowDurationMins)} Limit`,pct:i.usedPercent,detail:i.resetsAt>0?ux(i.resetsAt):void 0}),a&&l.jsx(gr,{label:`${x2(a.windowDurationMins)} Limit`,pct:a.usedPercent,detail:a.resetsAt>0?ux(a.resetsAt):void 0})]})}function sB({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(gr,{label:"Context",pct:n})]}):null}function iB(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 rB({pr:e}){const t=iB(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 aB({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),o=(t==null?void 0:t.git_branch)||(n==null?void 0:n.gitBranch);return k.useEffect(()=>{i||!a||!o||_e.getPRStatus(a,o).then(u=>{K.getState().setPRStatus(e,u)}).catch(()=>{})},[e,a,o,i]),!(i!=null&&i.available)||!i.pr?null:l.jsx(rB,{pr:i.pr})}const lB=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 oB({sessionId:e}){const t=K(O=>O.linkedLinearIssues.get(e)),[n,i]=k.useState([]),[a,o]=k.useState(null),[u,h]=k.useState([]),[f,m]=k.useState(""),[g,v]=k.useState(!1),[b,y]=k.useState(!1),[_,j]=k.useState(!1),[N,w]=k.useState(""),[C,E]=k.useState([]),[R,M]=k.useState(!1),L=k.useRef(null);k.useEffect(()=>{_e.getLinkedLinearIssue(e).then(O=>{O.issue&&K.getState().setLinkedLinearIssue(e,O.issue)}).catch(()=>{})},[e]);const F=k.useCallback(async()=>{if(t)try{const O=await _e.getLinkedLinearIssue(e,!0);O.issue&&(K.getState().setLinkedLinearIssue(e,O.issue),O.issue.stateType==="completed"&&y(!0)),O.comments&&i(O.comments),O.assignee!==void 0&&o(O.assignee??null),O.labels&&h(O.labels)}catch{}},[e,t]);k.useEffect(()=>{if(!t)return;F();const O=setInterval(F,lB);return()=>clearInterval(O)},[F,t]),k.useEffect(()=>{if(!_)return;const O=N.trim();if(O.length<2){E([]);return}let de=!0;M(!0);const W=setTimeout(()=>{_e.searchLinearIssues(O,6).then(q=>{de&&E(q.issues)}).catch(()=>{de&&E([])}).finally(()=>{de&&M(!1)})},400);return()=>{de=!1,clearTimeout(W)}},[N,_]),k.useEffect(()=>{_&&setTimeout(()=>{var O;return(O=L.current)==null?void 0:O.focus()},50)},[_]);async function D(){if(!(!t||!f.trim()||g)){v(!0);try{const O=await _e.addLinearComment(t.id,f.trim());i(de=>[...de,O.comment]),m("")}catch{}finally{v(!1)}}}async function X(){try{await _e.unlinkLinearIssue(e),K.getState().setLinkedLinearIssue(e,null),i([]),o(null),h([]),y(!1)}catch{}}async function U(O){try{await _e.linkLinearIssue(e,O),K.getState().setLinkedLinearIssue(e,O),j(!1),w(""),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(gu,{className:"w-3.5 h-3.5 text-cc-muted shrink-0"}),l.jsx("input",{ref:L,type:"text",value:N,onChange:O=>w(O.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),w(""),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(O=>l.jsxs("button",{onClick:()=>U(O),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:O.identifier}),l.jsx("span",{className:`text-[9px] font-medium px-1 rounded-full leading-[14px] ${u0(O.stateType,O.stateName).cls}`,children:u0(O.stateType,O.stateName).label})]}),l.jsx("p",{className:"text-[11px] text-cc-muted truncate mt-0.5",children:O.title})]},O.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(gu,{className:"w-3.5 h-3.5"}),"Link Linear issue"]})});const G=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(gu,{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] ${G.cls}`,children:G.label}),l.jsx("button",{onClick:X,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(O=>l.jsx("span",{className:"text-[9px] px-1.5 py-0.5 rounded-full",style:{backgroundColor:`${O.color}20`,color:O.color},children:O.name},O.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 _e.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(O=>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:O.userName}),l.jsx("span",{className:"text-[9px] text-cc-muted",children:V9(new Date(O.createdAt).getTime())})]}),l.jsx("p",{className:"text-cc-muted line-clamp-2",children:O.body})]},O.id))]}),l.jsxs("div",{className:"px-4 py-2 flex items-center gap-1.5",children:[l.jsx("input",{type:"text",value:f,onChange:O=>m(O.target.value),onKeyDown:O=>{O.key==="Enter"&&!O.shiftKey&&(O.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()||g,"aria-label":"Send comment",className:"flex items-center justify-center w-7 h-7 rounded-md text-cc-primary disabled:text-cc-muted cursor-pointer disabled:cursor-not-allowed transition-colors",title:"Send comment",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M1.724 1.053a.5.5 0 0 0-.714.545l1.403 4.85a.5.5 0 0 0 .397.354l5.19.736-5.19.737a.5.5 0 0 0-.397.353L1.01 13.48a.5.5 0 0 0 .714.545l13-6.5a.5.5 0 0 0 0-.894l-13-6.5z"})})})]})]})}function cB({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),mv);return()=>clearInterval(u)},[t]),!(t!=null&&t.status)||t.status==="allowed")return null;const i=t.status==="rejected",a=typeof t.utilization=="number"?t.utilization*100:void 0,o=typeof t.resetsAt=="number"&&t.resetsAt>0?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(gr,{label:t.rateLimitType==="five_hour"?"5h Limit":"Plan Limit",pct:a,detail:o}):l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[11px] text-cc-muted uppercase tracking-wider",children:"Plan Limit"}),l.jsxs("span",{className:`text-[11px] tabular-nums ${i?"text-cc-error":"text-cc-warning"}`,children:[i?"rate limited":t.status,o&&` · resets ${o}`]})]}),i&&l.jsxs("p",{className:"text-[11px] text-cc-error",children:["The API is refusing requests for this plan window",o?` — resets in ${o}.`:"."]})]})}function uB({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(nB,{sessionId:e}),l.jsx(sB,{sessionId:e})]}):l.jsxs(l.Fragment,{children:[l.jsx(cB,{sessionId:e}),l.jsx(Z9,{sessionId:e})]})}function dB({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,o=(t==null?void 0:t.git_behind)||0,u=(t==null?void 0:t.total_lines_added)||0,h=(t==null?void 0:t.total_lines_removed)||0,f=(t==null?void 0:t.repo_root)||(t==null?void 0:t.cwd)||(n==null?void 0:n.cwd);return i?l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-1.5",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("p",{className:"text-xs font-mono-code text-cc-fg truncate",title:i,children:i}),(t==null?void 0:t.is_containerized)&&l.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-cc-info/10 text-cc-info shrink-0 ml-2",children:"container"})]}),(a>0||o>0||u>0||h>0)&&l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsxs("div",{className:"flex items-center gap-1.5 text-[11px]",children:[a>0&&l.jsxs("span",{className:"text-cc-success",children:[a,"↑",l.jsx("span",{className:"sr-only",children:" commits ahead"})]}),o>0&&l.jsxs("span",{className:"text-cc-warning",children:[o,"↓",l.jsx("span",{className:"sr-only",children:" commits behind"})]}),u>0&&l.jsxs("span",{className:"text-cc-success",children:["+",u,l.jsx("span",{className:"sr-only",children:" lines added"})]}),h>0&&l.jsxs("span",{className:"text-cc-error",children:["-",h,l.jsx("span",{className:"sr-only",children:" lines removed"})]})]}),o>0&&f&&l.jsx("button",{type:"button",className:"text-[11px] font-medium text-cc-warning hover:text-cc-warning/80 transition-colors cursor-pointer",onClick:()=>{_e.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 hB({sessionId:e}){const t=K(o=>o.sessionTasks.get(e)||GN),n=K(o=>o.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(o=>l.jsx(vB,{task:o},o.id))})})}const fB={"usage-limits":uB,"server-memory":J9,"server-disk":tB,"git-branch":dB,"github-pr":aB,"linear-issue":oB,"mcp-servers":P9,tasks:hB};function pB(e,t){const n=K(i=>i.sessionTasks.get(t)||GN);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 mB({isCodex:e}){const t=K(m=>m.taskPanelConfig),n=K(m=>m.toggleSectionEnabled),i=K(m=>m.moveSectionUp),a=K(m=>m.moveSectionDown),o=K(m=>m.resetTaskPanelConfig),u=K(m=>m.setTaskPanelConfigMode),h=e?"codex":"claude",f=t.order.filter(m=>{const g=pr.find(v=>v.id===m);return!(!g||g.backends&&!g.backends.includes(h))});return l.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[l.jsx("div",{className:"flex-1 overflow-y-auto px-3 py-3 space-y-1",children:f.map((m,g)=>{const v=pr.find(j=>j.id===m),b=t.enabled[m]??!0,y=g===0,_=g===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:()=>o(),className:"text-[11px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer","data-testid":"reset-panel-config",children:"Reset to defaults"}),l.jsx("button",{onClick:()=>u(!1),className:"text-[11px] font-medium text-cc-primary hover:text-cc-primary-hover transition-colors cursor-pointer","data-testid":"config-done",children:"Done"})]})]})}function gB({sectionId:e,sessionId:t,children:n}){var o;const i=((o=pr.find(u=>u.id===e))==null?void 0:o.label)??e,a=pB(e,t);return l.jsx(QN,{id:e,label:i,badge:a,children:n})}function xB({sessionId:e}){const t=K(g=>g.sessions.get(e)),n=zu(e),i=K(g=>g.taskPanelOpen),a=K(g=>g.setTaskPanelOpen),o=K(g=>g.taskPanelConfigMode),u=K(g=>g.taskPanelConfig);if(!i)return null;const h=((t==null?void 0:t.backend_type)||(n==null?void 0:n.backendType))==="codex",f=h?"codex":"claude",m=u.order.filter(g=>{const v=pr.find(b=>b.id===g);return!(!v||v.backends&&!v.backends.includes(f))});return l.jsxs("aside",{"aria-label":"Session context",className:"w-full lg:w-[320px] h-full flex flex-col overflow-hidden bg-cc-card",children:[l.jsxs("div",{className:"shrink-0 h-11 flex items-center justify-between px-4 bg-cc-card border-b border-cc-separator",children:[l.jsx("h2",{className:"text-sm font-semibold text-cc-fg tracking-tight",children:o?"Panel Settings":"Context"}),l.jsx("button",{onClick:()=>{o?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"})})})]}),o?l.jsx(mB,{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(K9,{}),l.jsx(q9,{sessionId:e}),m.filter(g=>u.enabled[g]!==!1).map(g=>{var b;const v=fB[g];return v?l.jsx(gB,{sectionId:g,sessionId:e,children:l.jsx(G9,{label:(b=pr.find(y=>y.id===g))==null?void 0:b.label,children:l.jsx(v,{sessionId:e})})},g):null})]}),l.jsx("div",{className:"shrink-0 px-4 py-2 pb-safe border-t border-cc-separator",children:l.jsxs("button",{onClick:()=>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 vB({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 bB({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 yB({sessionId:e}){const t=K(M=>M.sessions.get(e)),n=K(M=>M.sdkSessions.find(L=>L.sessionId===e)),i=K(M=>M.diffPanelSelectedFile.get(e)??null),a=K(M=>M.setDiffPanelSelectedFile),o=K(M=>M.diffBase),u=K(M=>M.setDiffBase),h=K(M=>M.changedFilesTick.get(e)??0),f=(t==null?void 0:t.cwd)||(n==null?void 0:n.cwd),[m,g]=k.useState(""),[v,b]=k.useState(!1),[y,_]=k.useState(()=>typeof window<"u"?window.innerWidth>=640:!0),[j,N]=k.useState([]),w=K(M=>M.setGitChangedFilesCount);k.useEffect(()=>{if(!f)return;let M=!1;return _e.getChangedFiles(f,o).then(({files:L})=>{if(M)return;const F=`${f}/`,D=L.filter(X=>X.path===f||X.path.startsWith(F)).map(X=>({abs:X.path,rel:X.path.startsWith(F)?X.path.slice(F.length):X.path,status:X.status==="A"||X.status==="?"?"created":X.status==="D"?"deleted":"updated"})).sort((X,U)=>X.rel.localeCompare(U.rel));N(D),w(e,D.length)}).catch(()=>{M||(N([]),w(e,0))}),()=>{M=!0}},[f,o,h,e,w]);const C=j;k.useEffect(()=>{!i&&C.length>0&&a(e,C[0].abs)},[i,C,e,a]),k.useEffect(()=>{var M;i&&(C.some(L=>L.abs===i)||a(e,((M=C[0])==null?void 0:M.abs)??null))},[i,C,e,a]),k.useEffect(()=>{if(!i){g("");return}let M=!1;return b(!0),_e.getFileDiff(i,o).then(L=>{M||(g(L.diff),b(!1))}).catch(()=>{M||(g(""),b(!1))}),()=>{M=!0}},[i,o]);const E=k.useCallback(M=>{a(e,M),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:M,rel:L,status:F})=>l.jsxs("button",{onClick:()=>E(M),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 ${M===i?"bg-cc-active text-cc-fg":"text-cc-fg/70"}`,style:{width:"calc(100% - 8px)"},children:[l.jsx(bB,{status:F}),l.jsx("span",{className:"truncate leading-snug",children:L})]},M))})]}),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(o==="last-commit"?"default-branch":"last-commit"),className:"text-cc-muted text-[11px] shrink-0 hidden sm:inline hover:text-cc-fg transition-colors cursor-pointer",title:`Switch to ${o==="last-commit"?"default branch":"last commit"} comparison`,children:o==="default-branch"?"vs default branch":"vs last commit"})]}),l.jsx("div",{className:"flex-1 overflow-auto",children:v?l.jsx("div",{className:"h-full flex items-center justify-center",children:l.jsx("div",{className:"w-5 h-5 border-2 border-cc-primary border-t-transparent rounded-full animate-spin"})}):i?l.jsx("div",{className:"p-4",children:l.jsx(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 _B(){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 o=async()=>{a(!0);try{localStorage.setItem("companion_docker_prompt_pending","1"),await _e.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:o,disabled:h,className:"text-xs font-medium px-2.5 py-0.5 rounded-md bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",children:h?"Updating...":"Update & Restart"}):l.jsxs("span",{className:"text-xs text-cc-muted",children:["Run"," ",l.jsx("code",{className:"font-mono-code bg-cc-code-bg px-1 py-0.5 rounded text-cc-code-fg",children:"the-companion install"})," ","for auto-updates"]}),l.jsx("button",{onClick:u,className:"text-cc-muted hover:text-cc-fg transition-colors cursor-pointer ml-auto",title:"Dismiss",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})})]})}function wB({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 SB({steps:e,error:t,unsentPrompt:n,backend:i,onCancel:a}){const o=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"),g=[...e].reverse().find(b=>b.status==="done"),v=f?"Something went wrong":h?"Launching session...":(m==null?void 0:m.label)||(g==null?void 0:g.label)||"Preparing...";return l.jsxs("div",{className:"absolute inset-0 z-50 flex flex-col items-center justify-center bg-cc-bg/95 backdrop-blur-sm animate-fade-in",children:[l.jsxs("div",{className:"relative mb-8",children:[u&&!f&&l.jsx("div",{className:"absolute inset-0 -m-4 rounded-full bg-cc-primary/10 animate-pulse"}),l.jsx("img",{src:o,alt:"Launching",className:`w-20 h-20 relative z-10 transition-transform duration-500 ${u&&!f?"scale-110":""} ${f?"opacity-40 grayscale":""}`}),u&&!f&&l.jsx("div",{className:"absolute -inset-3 z-0",children:l.jsx("svg",{className:"w-full h-full animate-spin-slow",viewBox:"0 0 100 100",children:l.jsx("circle",{cx:"50",cy:"50",r:"46",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"60 230",strokeLinecap:"round",className:"text-cc-primary/40"})})}),h&&!f&&l.jsx("div",{className:"absolute -inset-3 z-0 rounded-full border-2 border-cc-success/30"})]}),l.jsx("p",{className:`text-sm font-medium mb-6 transition-colors ${f?"text-cc-error":"text-cc-fg"}`,children:v}),l.jsx("div",{className:"w-full max-w-xs space-y-2 px-4",children:e.map((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(wB,{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 kB(){const e=localStorage.getItem("companion_auth_token");return e?{Authorization:`Bearer ${e}`}:{}}const jB={installing:"Installing update...",restarting:"Restarting server...",waiting:"Waiting for server...",ready:"Update complete!"};function NB(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 o=setTimeout(()=>{a.current&&n("restarting")},3e3),u=setTimeout(()=>{a.current&&n("waiting"),h()},5e3);function h(){a.current&&fetch("/api/update-check",{signal:AbortSignal.timeout(3e3),headers:kB()}).then(f=>{if(!f.ok)throw new Error("not ready");return f.json()}).then(()=>{a.current&&(n("ready"),setTimeout(()=>{a.current&&window.location.reload()},800))}).catch(()=>{i.current=setTimeout(h,1500)})}return()=>{clearTimeout(o),clearTimeout(u),i.current&&clearTimeout(i.current)}},[e]),t}function KN({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:jB[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 CB({active:e}){const t=NB(e);return e?l.jsx(KN,{phase:t,className:"fixed inset-0 z-[100]"}):null}function uP({phase:e}){return l.jsx(KN,{phase:e,className:"absolute inset-0"})}function EB(){const e=K(j=>j.dockerUpdateDialogOpen),t=K(j=>j.setDockerUpdateDialogOpen),[n,i]=k.useState("prompt"),[a,o]=k.useState(!1),[u,h]=k.useState(null),f=k.useRef(null);if(k.useEffect(()=>{e&&_e.getSettings().then(j=>{o(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(()=>{_e.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"),_e.pullImage("the-companion:latest").then(j=>{j.state&&h(j.state)}).catch(()=>{i(j=>j==="pulling"?"error":j)})}function g(){m()}function v(){y()}function b(){y()}function y(){i("prompt"),h(null),t(!1)}async function _(){const j=!a;o(j);try{await _e.updateSettings({dockerAutoUpdate:j})}catch{o(!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:g,className:"px-4 py-2 min-h-[40px] rounded-lg text-sm font-medium bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Update"})]})]}),n==="pulling"&&l.jsxs("div",{className:"p-6",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[l.jsx("svg",{className:"w-4 h-4 animate-spin text-cc-primary",viewBox:"0 0 24 24",fill:"none",children:l.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2.5",strokeDasharray:"31.4 31.4",strokeLinecap:"round"})}),l.jsx("h2",{className:"text-base font-semibold text-cc-fg",children:"Updating Sandbox Image..."})]}),l.jsx("p",{className:"text-sm text-cc-muted mb-3",children:"Pulling the-companion:latest"}),(u==null?void 0:u.progress)&&u.progress.length>0&&l.jsx("pre",{className:"px-3 py-2 text-[10px] font-mono-code bg-cc-code-bg rounded-lg text-cc-muted max-h-[160px] overflow-auto whitespace-pre-wrap","data-testid":"pull-progress",children:u.progress.slice(-20).join(`
|
|
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:g,className:"px-4 py-2 min-h-[40px] rounded-lg text-sm font-medium bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Retry"})]})]})]})})}function dP({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"})]})]})]})})}function TB(){const[e,t]=k.useState(null),[n,i]=k.useState({state:"idle"}),[a,o]=k.useState(""),[u,h]=k.useState(!1),[f,m]=k.useState(""),g=k.useCallback(async()=>{try{t(await _e.getClaudeAccount())}catch(M){m(M instanceof Error?M.message:String(M))}},[]);k.useEffect(()=>{g(),_e.getClaudeLoginStatus().then(i).catch(()=>{})},[g]);const v=async()=>{h(!0),m(""),o("");try{const M=await _e.startClaudeLogin();i(M),M.state==="error"&&M.error&&m(M.error)}catch(M){m(M instanceof Error?M.message:String(M))}finally{h(!1)}},b=async()=>{h(!0),m("");try{const M=await _e.submitClaudeLoginCode(a);i(M),M.state==="success"&&(o(""),await g())}catch(M){m(M instanceof Error?M.message:String(M))}finally{h(!1)}},y=async()=>{h(!0);try{i(await _e.cancelClaudeLogin()),o("")}catch(M){m(M instanceof Error?M.message:String(M))}finally{h(!1)}},_=async()=>{h(!0),m("");try{const M=await _e.claudeLogout();!M.ok&&M.error&&m(M.error),i({state:"idle"}),await g()}catch(M){m(M instanceof Error?M.message:String(M))}finally{h(!1)}},j=n.state==="awaiting_code",N=n.state==="verifying",w=j||N,C=(e==null?void 0:e.cliAvailable)===!1,E=e!=null&&e.orgName&&e.email&&e.orgName.includes(e.email)?null:(e==null?void 0:e.orgName)??null,R=e!=null&&e.authenticated?[e.email,e.subscriptionType?AB(e.subscriptionType):null,E].filter(Boolean).join(" · "):null;return l.jsxs("div",{className:"space-y-2",children:[l.jsx("h3",{className:"block text-sm font-medium",children:"Claude Account"}),l.jsx("p",{className:"text-xs text-cc-muted",children:"Sign in with your Claude subscription. You'll open a link, approve on any device, and paste the code back here — no terminal access needed."}),C&&l.jsx("div",{role:"status",className:"px-3 py-2 rounded-lg bg-cc-error/10 border border-cc-error/20 text-xs text-cc-error",children:"Claude CLI not found on this machine. Install it to sign in."}),!C&&e&&!w&&l.jsx("p",{className:"text-xs text-cc-muted","data-testid":"claude-account-status",children:R?`Signed in as ${R}`:e.authenticated?"Signed in":"Not signed in"}),w&&l.jsxs("div",{className:"px-3 py-3 rounded-lg bg-cc-bg border border-cc-primary/20 space-y-3",children:[l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("p",{className:"text-xs text-cc-muted",children:"1. Open this link and approve:"}),l.jsx("a",{href:n.authUrl,target:"_blank",rel:"noreferrer","data-testid":"claude-auth-url",className:"block text-xs text-cc-primary underline break-all",children:n.authUrl})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("label",{className:"block text-xs text-cc-muted",htmlFor:"claude-auth-code",children:"2. Paste the code you were shown:"}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("input",{id:"claude-auth-code",type:"text",value:a,disabled:N,autoComplete:"off",spellCheck:!1,onChange:M=>o(M.target.value),onKeyDown:M=>{M.key==="Enter"&&a.trim()&&!u&&(M.preventDefault(),b())},placeholder:"Paste code here",className:"flex-1 px-3 py-2 min-h-[40px] text-sm font-mono-code bg-cc-bg rounded-lg border border-cc-border text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40"}),l.jsx("button",{type:"button",onClick:b,disabled:u||!a.trim(),className:`px-3 py-2 min-h-[40px] rounded-lg text-sm font-medium transition-colors ${u||!a.trim()?"bg-cc-hover text-cc-muted cursor-not-allowed":"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer"}`,children:N?"Verifying…":"Submit"})]})]}),n.error&&l.jsx("p",{role:"alert",className:"text-xs text-cc-error",children:n.error})]}),n.state==="success"&&l.jsx("div",{role:"status",className:"px-3 py-2 rounded-lg bg-cc-success/10 border border-cc-success/20 text-xs text-cc-success",children:"Signed in to Claude. New sessions will use this account."}),(n.state==="error"||f)&&l.jsx("div",{role:"alert",className:"px-3 py-2 rounded-lg bg-cc-error/10 border border-cc-error/20 text-xs text-cc-error",children:f||n.error}),l.jsxs("div",{className:"flex flex-wrap gap-2",children:[w?l.jsx("button",{type:"button",onClick:y,disabled:u,className:"px-4 py-2 min-h-[44px] rounded-lg text-sm font-medium bg-cc-hover text-cc-fg cursor-pointer",children:"Cancel"}):l.jsx("button",{type:"button",onClick:v,disabled:u||C,className:`px-4 py-2 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${u||C?"bg-cc-hover text-cc-muted cursor-not-allowed":"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer"}`,children:u?"Starting…":e!=null&&e.authenticated?"Sign in again":"Sign in with Claude"}),(e==null?void 0:e.authenticated)&&!w&&l.jsx("button",{type:"button",onClick:_,disabled:u,className:"px-4 py-2 min-h-[44px] rounded-lg text-sm font-medium bg-cc-hover text-cc-fg cursor-pointer",children:"Sign out"})]})]})}function AB(e){return e.charAt(0).toUpperCase()+e.slice(1)}const MB=2e3;function RB(){const[e,t]=k.useState(null),[n,i]=k.useState({state:"idle"}),[a,o]=k.useState(!1),[u,h]=k.useState(""),[f,m]=k.useState(!1),g=k.useRef(null),v=k.useCallback(async()=>{try{t(await _e.getCodexAccount())}catch(R){h(R instanceof Error?R.message:String(R))}},[]),b=k.useCallback(()=>{g.current&&(clearInterval(g.current),g.current=null)},[]),y=k.useCallback(()=>{b(),g.current=setInterval(async()=>{try{const R=await _e.getCodexLoginStatus();i(R),R.state!=="pending"&&(b(),R.state==="success"&&v())}catch{}},MB)},[v,b]);k.useEffect(()=>(v(),_e.getCodexLoginStatus().then(R=>{i(R),R.state==="pending"&&y()}).catch(()=>{}),b),[v,y,b]);const _=async()=>{o(!0),h("");try{const R=await _e.startCodexLogin();i(R),R.state==="pending"?y():R.error&&h(R.error)}catch(R){h(R instanceof Error?R.message:String(R))}finally{o(!1)}},j=async()=>{o(!0),b();try{i(await _e.cancelCodexLogin())}catch(R){h(R instanceof Error?R.message:String(R))}finally{o(!1)}},N=async()=>{o(!0),h("");try{const R=await _e.codexLogout();!R.ok&&R.error&&h(R.error),i({state:"idle"}),await v()}catch(R){h(R instanceof Error?R.message:String(R))}finally{o(!1)}},w=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:w,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"],D2='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 OB({onComplete:e}){const[t,n]=k.useState("welcome"),[i,a]=k.useState(""),[o,u]=k.useState(""),[h,f]=k.useState(!1),[m,g]=k.useState(""),[v,b]=k.useState(!1),[y,_]=k.useState(!1),[j,N]=k.useState(fx),w=k.useRef(null);k.useEffect(()=>{j||requestAnimationFrame(()=>N(!0))},[j]),k.useEffect(()=>{const G=w.current;if(!G)return;function O(W){if(W.key==="Escape"){W.preventDefault();return}if(W.key!=="Tab")return;const q=G.querySelectorAll(D2);if(q.length===0)return;const H=q[0],I=q[q.length-1];W.shiftKey?document.activeElement===H&&(W.preventDefault(),I.focus()):document.activeElement===I&&(W.preventDefault(),H.focus())}document.addEventListener("keydown",O);const de=G.querySelector(D2);return de==null||de.focus(),()=>document.removeEventListener("keydown",O)},[t]);const C=k.useCallback(async()=>{if(!i.trim()){n("codex");return}f(!0),g("");try{await _e.updateSettings({claudeCodeOAuthToken:i.trim()}),b(!0),n("codex")}catch(G){g(G instanceof Error?G.message:"Failed to save token")}finally{f(!1)}},[i]),E=k.useCallback(async()=>{f(!0),g("");try{(await _e.getSettings()).codexDeviceAuthConfigured?(_(!0),await M()):g("No Codex auth found yet. Complete the sign-in above, then check again.")}catch(G){g(G instanceof Error?G.message:"Failed to check auth status")}finally{f(!1)}},[]),R=k.useCallback(async()=>{f(!0),g("");try{await _e.updateSettings({openaiApiKey:o.trim()}),_(!0),await M()}catch(G){g(G instanceof Error?G.message:"Failed to save API key")}finally{f(!1)}},[o]),M=k.useCallback(async()=>{try{await _e.updateSettings({onboardingCompleted:!0})}catch{}n("done")},[]),L=k.useCallback(()=>{e()},[e]),F=k.useCallback(async()=>{await M(),e()},[M,e]),D=k.useCallback(G=>{g(""),n(G)},[]),X=d0.indexOf(t),U=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:U?"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:w,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:U?"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 ${X+1} of ${d0.length-1}`,children:d0.slice(0,3).map((G,O)=>l.jsx("div",{className:"h-[3px] rounded-full transition-[transform,background,opacity] duration-300",style:{width:32,transform:O===X?"scaleX(1)":"scaleX(0.375)",transformOrigin:"center",background:O<=X?"var(--color-cc-primary)":"var(--color-cc-border)",opacity:O<=X?1:.5}},G))}),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(LB,{onSetupClaude:()=>D("claude"),onSetupCodex:()=>D("codex")}),t==="claude"&&l.jsx(DB,{token:i,onTokenChange:a,onSave:C,onSkip:()=>D("codex"),saving:h,error:m}),t==="codex"&&l.jsx(zB,{apiKey:o,onApiKeyChange:u,onCheckAuth:E,onSaveApiKey:R,onSkip:()=>M(),onBack:()=>D("claude"),saving:h,error:m}),t==="done"&&l.jsx($B,{claudeConfigured:v,codexConfigured:y,onDone:L})]}),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 LB({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 DB({token:e,onTokenChange:t,onSave:n,onSkip:i,saving:a,error:o}){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:"Sign in with your Claude subscription — no terminal needed."})]}),l.jsx(TB,{}),l.jsx("div",{className:"mt-5 pt-4 border-t border-cc-border",children:l.jsx("p",{className:"text-xs text-cc-muted mb-2",children:"Or paste a long-lived token instead — generate one with:"})}),l.jsxs("div",{className:"rounded-lg overflow-hidden mb-4 border border-cc-border",style:{background:"var(--color-cc-code-bg)"},children:[l.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-cc-border",children:[l.jsxs("div",{className:"flex items-center gap-1.5","aria-hidden":"true",children:[l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-error opacity-60"}),l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-warning opacity-60"}),l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-success opacity-60"})]}),l.jsx(BB,{text:"claude setup-token"})]}),l.jsx("div",{className:"px-3.5 py-3",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-cc-muted text-xs font-mono-code select-none","aria-hidden":"true",children:"$"}),l.jsx("code",{className:"text-[13px] font-mono-code text-cc-fg select-all",children:"claude setup-token"})]})})]}),l.jsxs("div",{className:"mb-4",children:[l.jsx("label",{htmlFor:"claude-token",className:"text-xs text-cc-muted block mb-1.5",children:"OAuth Token"}),l.jsx("input",{ref:u,id:"claude-token",type:"password",value:e,onChange:f=>t(f.target.value),placeholder:"Paste the token from your terminal...","aria-describedby":o?h:void 0,"aria-invalid":o?!0:void 0,className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg border border-cc-border text-cc-fg placeholder:text-cc-muted/60 focus:outline-none focus:ring-1 focus:ring-cc-primary focus:border-cc-primary font-mono-code transition-shadow duration-150"})]}),o&&l.jsxs("div",{id:h,role:"alert",className:"flex items-start gap-2 mb-4 text-xs text-cc-error",children:[l.jsxs("svg",{className:"w-3.5 h-3.5 mt-0.5 flex-shrink-0",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24","aria-hidden":"true",children:[l.jsx("circle",{cx:"12",cy:"12",r:"10"}),l.jsx("path",{d:"M12 8v4m0 4h.01"})]}),l.jsx("span",{children:o})]}),l.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[l.jsx("button",{onClick:i,className:"flex-1 px-4 py-2.5 min-h-[44px] rounded-lg text-sm text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors",children:"Skip"}),l.jsx("button",{onClick:n,disabled:a,className:"btn-primary-aa flex-1 px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium text-white transition-[background,opacity] duration-150 disabled:opacity-50",style:{boxShadow:a?"none":"0 1px 3px var(--color-cc-primary-btn)"},children:a?"Saving...":e.trim()?"Save & Continue":"Continue"})]})]})}function zB({apiKey:e,onApiKeyChange:t,onCheckAuth:n,onSaveApiKey:i,onSkip:a,onBack:o,saving:u,error:h}){const[f,m]=k.useState(!1),g="codex-auth-error";return l.jsxs("div",{className:"p-7 pb-6",children:[l.jsxs("div",{className:"mb-5",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-cc-muted font-medium mb-2",children:"Step 2 of 2"}),l.jsx("h2",{className:"text-xl font-semibold text-cc-fg leading-tight",children:"Set up Codex"}),l.jsx("p",{className:"text-sm text-cc-muted mt-1.5 leading-relaxed",children:"Sign in with your ChatGPT account — no terminal needed."})]}),l.jsx(RB,{}),h&&l.jsxs("div",{id:g,role:"alert",className:"flex items-start gap-2 mb-4 text-xs text-cc-error",children:[l.jsxs("svg",{className:"w-3.5 h-3.5 mt-0.5 flex-shrink-0",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24","aria-hidden":"true",children:[l.jsx("circle",{cx:"12",cy:"12",r:"10"}),l.jsx("path",{d:"M12 8v4m0 4h.01"})]}),l.jsx("span",{children:h})]}),l.jsxs("div",{className:"mb-4",children:[l.jsxs("button",{onClick:()=>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?g:void 0,"aria-invalid":h?!0:void 0,className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg border border-cc-border text-cc-fg placeholder:text-cc-muted/60 focus:outline-none focus:ring-1 focus:ring-cc-codex focus:border-cc-codex font-mono-code transition-shadow duration-150"})]})})})]}),l.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[l.jsxs("button",{onClick:o,className:"px-3 py-2.5 min-h-[44px] min-w-[44px] rounded-lg text-sm text-cc-muted hover:text-cc-fg transition-colors flex items-center gap-1",children:[l.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})}),"Back"]}),l.jsx("div",{className:"flex-1"}),l.jsx("button",{onClick:a,className:"px-4 py-2.5 min-h-[44px] rounded-lg text-sm text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors",children:"Skip"}),l.jsx("button",{onClick:e.trim()?i:n,disabled:u,className:"btn-codex-aa px-5 py-2.5 min-h-[44px] rounded-lg text-sm font-medium text-white transition-[background,opacity] duration-150 disabled:opacity-50",style:{boxShadow:u?"none":"0 1px 3px var(--color-cc-codex-btn)"},children:u?"Checking...":e.trim()?"Save & Finish":"I've logged in"})]})]})}function $B({claudeConfigured:e,codexConfigured:t,onDone:n}){const i=!e&&!t,a=fx(),[o,u]=k.useState(a);return k.useEffect(()=>{o||requestAnimationFrame(()=>u(!0))},[o]),l.jsxs("div",{className:"p-7 pb-6 text-center",style:{opacity:o?1:0,transform:o?"translateY(0)":"translateY(8px)",transition:a?"none":"opacity 400ms cubic-bezier(0.16, 1, 0.3, 1), transform 400ms cubic-bezier(0.16, 1, 0.3, 1)"},children:[l.jsx("div",{className:"w-14 h-14 mx-auto rounded-2xl flex items-center justify-center mb-5",style:{background:i?"var(--color-cc-hover)":"color-mix(in srgb, var(--color-cc-success) 12%, transparent)"},children:i?l.jsx("svg",{className:"w-6 h-6 text-cc-muted",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}):l.jsx("svg",{className:"w-6 h-6 text-cc-success",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}),l.jsx("h2",{className:"text-xl font-semibold text-cc-fg mb-2",children:i?"Setup Skipped":"You're all set!"}),l.jsx("div",{className:"text-sm text-cc-muted leading-relaxed mb-6",children:i?"You can configure providers anytime in Settings.":l.jsxs(l.Fragment,{children:[e&&l.jsx("span",{className:"block",children:"Claude Code is ready."}),t&&l.jsx("span",{className:"block",children:"Codex is ready."}),l.jsx("span",{className:"block mt-1 text-xs",children:"You can update these anytime in Settings."})]})}),l.jsx("button",{onClick:n,className:"btn-primary-aa w-full px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium text-white transition-[background] duration-150",style:{boxShadow:"0 1px 3px var(--color-cc-primary-btn)"},children:"Get Started"})]})}function BB({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 PB(e){return K(t=>{var n;return!e||!t.magicUiAvailable?!1:((n=t.sessions.get(e))==null?void 0:n.magicUiActive)===!0})}const UB=k.lazy(()=>Vn(()=>import("./Playground-BiB_VDIl.js"),__vite__mapDeps([0,1])).then(e=>({default:e.Playground}))),FB=k.lazy(()=>Vn(()=>import("./SettingsPage-DuzHKBe_.js"),[]).then(e=>({default:e.SettingsPage}))),IB=k.lazy(()=>Vn(()=>import("./IntegrationsPage-Bc7SgfqX.js"),[]).then(e=>({default:e.IntegrationsPage}))),HB=k.lazy(()=>Vn(()=>import("./LinearSettingsPage-BWfwYF05.js"),[]).then(e=>({default:e.LinearSettingsPage}))),qB=k.lazy(()=>Vn(()=>import("./LinearOAuthSettingsPage-CxyO36qY.js"),[]).then(e=>({default:e.LinearOAuthSettingsPage}))),VB=k.lazy(()=>Vn(()=>import("./TailscalePage-C3y_bGkT.js"),[]).then(e=>({default:e.TailscalePage}))),GB=k.lazy(()=>Vn(()=>import("./PromptsPage-BIE70OT1.js"),[]).then(e=>({default:e.PromptsPage}))),YB=k.lazy(()=>Vn(()=>Promise.resolve().then(()=>b9),void 0).then(e=>({default:e.EnvManager}))),QB=k.lazy(()=>Vn(()=>import("./SandboxManager-DsR3hQz1.js"),[]).then(e=>({default:e.SandboxManager}))),XB=k.lazy(()=>Vn(()=>import("./CronManager-u5KuicVz.js"),[]).then(e=>({default:e.CronManager}))),WB=k.lazy(()=>Vn(()=>import("./AgentsPage-D_ZGmkrU.js"),[]).then(e=>({default:e.AgentsPage}))),KB=k.lazy(()=>Vn(()=>import("./RunsPage-BAblQKAW.js"),[]).then(e=>({default:e.RunsPage}))),ZB=k.lazy(()=>Vn(()=>import("./DashboardPage-Dab8XyGT.js"),[]).then(e=>({default:e.DashboardPage}))),JB=k.lazy(()=>Vn(()=>import("./MagicUIView-CO6pZB0M.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 eP(){return k.useSyncExternalStore(e=>(window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)),()=>window.location.hash)}function tP(){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),o=K(A=>A.homeResetKey),u=K(A=>A.activeTab),h=PB(n),f=K(A=>A.sessionCreating),m=K(A=>A.sessionCreatingBackend),g=K(A=>A.creationProgress),v=K(A=>A.creationError),b=K(A=>A.creationDraft),y=K(A=>A.updateOverlayActive),_=eP(),j=k.useMemo(()=>Ux(_),[_]),N=j.page==="settings",w=j.page==="prompts",C=j.page==="integrations",E=j.page==="integration-linear",R=j.page==="integration-linear-oauth",M=j.page==="integration-tailscale",L=j.page==="environments",F=j.page==="sandboxes",D=j.page==="scheduled",X=j.page==="agents"||j.page==="agent-detail",U=j.page==="runs",G=j.page==="dashboard",O=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),I=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||!I)return;let A=!1;return _e.getChangedFiles(I,q).then(({files:Ee})=>{if(A)return;const Me=`${I}/`,z=Ee.filter(P=>P.path===I||P.path.startsWith(Me)).length;H(n,z)}).catch(()=>{}),()=>{A=!0}},[n,I,q,W,H]),k.useEffect(()=>{const A=()=>{_e.checkForUpdate().then(Me=>{K.getState().setUpdateInfo(Me)}).catch(()=>{})};A();const Ee=setInterval(A,300*1e3);return()=>clearInterval(Ee)},[]),k.useEffect(()=>{const A=()=>{_e.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&&_e.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(UB,{})}):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(pR,{})}),l.jsxs("div",{className:"flex-1 flex flex-col min-w-0 overflow-hidden",children:[l.jsx(m9,{}),l.jsx(_B,{}),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(FB,{embedded:!0})})}),w&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(fs,{}),children:l.jsx(GB,{embedded:!0})})}),C&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(fs,{}),children:l.jsx(IB,{embedded:!0})})}),E&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(fs,{}),children:l.jsx(HB,{embedded:!0})})}),R&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(fs,{}),children:l.jsx(qB,{embedded:!0})})}),M&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(fs,{}),children:l.jsx(VB,{embedded:!0})})}),L&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(fs,{}),children:l.jsx(YB,{embedded:!0})})}),F&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(fs,{}),children:l.jsx(QB,{embedded:!0})})}),D&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(fs,{}),children:l.jsx(XB,{embedded:!0})})}),X&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(fs,{}),children:l.jsx(WB,{route:j})})}),U&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(fs,{}),children:l.jsx(KB,{})})}),G&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(fs,{}),children:l.jsx(ZB,{})})}),O&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"absolute inset-0",children:n?u==="diff"?l.jsx(yB,{sessionId:n}):h?l.jsx(k.Suspense,{fallback:l.jsx(fs,{}),children:l.jsx(JB,{sessionId:n})}):l.jsx(c9,{sessionId:n}):l.jsx(R9,{},o)}),f&&g&&g.length>0&&l.jsx(SB,{steps:g,error:v,unsentPrompt:(b==null?void 0:b.text)??null,backend:m??void 0,onCancel:()=>K.getState().clearCreation()})]})]})]}),n&&O&&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(xB,{sessionId:n})})]}),l.jsx(CB,{active:y}),l.jsx(EB,{}),re&&l.jsx(OB,{onComplete:()=>ve(!1)})]}):l.jsx(tR,{})}class nP 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}}QM();PE.createRoot(document.getElementById("root")).render(l.jsx(k.StrictMode,{children:l.jsx(nP,{children:l.jsx(tP,{})})}));Vn(()=>import("./sw-register-CUhVLAo0.js"),[]).catch(()=>{});export{J$ as A,sl as B,TB as C,iP as D,xo as E,_9 as F,rB as G,U9 as H,zh as I,No as J,To as K,gu as L,M$ as M,S2 as N,$N as O,F$ as P,L$ as Q,U$ as R,SB as S,V2 as T,_B as U,P$ as V,rP as W,cP as X,oP as Y,Vn as _,_e as a,qg as b,RB as c,In as d,oR as e,B$ as f,YM as g,c9 as h,x9 as i,l as j,Wz as k,x$ as l,jo as m,Fx as n,uP as o,dP as p,l$ as q,k as r,aP as s,V9 as t,K as u,o$ as v,u9 as w,nB as x,sB as y,Li as z};
|