@hellcoder/companion 0.119.0 → 0.120.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AgentsPage-TD9AO1Er.js → AgentsPage-V7NBPNSh.js} +5 -5
- package/dist/assets/CronManager-CGfXlVZS.js +1 -0
- package/dist/assets/{DashboardPage-CQc0PLwb.js → DashboardPage-N7MWZiJQ.js} +1 -1
- package/dist/assets/{IntegrationsPage-ChVMH0yi.js → IntegrationsPage-DRP477b0.js} +1 -1
- package/dist/assets/{LinearOAuthSettingsPage-Bb7Tu4o3.js → LinearOAuthSettingsPage-CPW4TQuD.js} +1 -1
- package/dist/assets/{LinearSettingsPage-BxKEO7CY.js → LinearSettingsPage-BwVTEKqs.js} +1 -1
- package/dist/assets/{MagicUIDashboard-j4axrj9-.js → MagicUIDashboard-exuRY5LQ.js} +1 -1
- package/dist/assets/MagicUIView-AKoy6jOb.js +1 -0
- package/dist/assets/{Playground-DlNnNZL_.js → Playground-BiEa7THU.js} +6 -6
- package/dist/assets/{PromptsPage-C-VOgj-R.js → PromptsPage-BYtZdliB.js} +1 -1
- package/dist/assets/{RunsPage-Ce99iVIk.js → RunsPage-DD6KPNKm.js} +1 -1
- package/dist/assets/{SandboxManager-ZtcsgPxE.js → SandboxManager-C8tBjBXY.js} +1 -1
- package/dist/assets/SettingsPage-77tDzDuD.js +1 -0
- package/dist/assets/{TailscalePage-C61E10pR.js → TailscalePage-B0TbcOPL.js} +1 -1
- package/dist/assets/index-BM8QkiV8.js +140 -0
- package/dist/assets/index-CUfPwiv5.css +1 -0
- package/dist/assets/{sw-register-NM2AysKf.js → sw-register-Cr16zatT.js} +1 -1
- package/dist/index.html +2 -2
- package/dist/sw.js +1 -1
- package/package.json +1 -1
- package/server/codex-app-server.ts +61 -0
- package/server/codex-auth.test.ts +254 -0
- package/server/codex-auth.ts +315 -0
- package/server/codex-models.ts +2 -43
- package/server/protocol/codex-upstream/ClientRequest.ts.txt +62 -17
- package/server/protocol/codex-upstream/README.md +1 -1
- package/server/protocol/codex-upstream/ServerNotification.ts.txt +52 -4
- package/server/protocol/codex-upstream/ServerRequest.ts.txt +4 -1
- package/server/protocol/codex-upstream/v2/DynamicToolCallParams.ts.txt +1 -1
- package/server/routes/codex-auth-routes.test.ts +115 -0
- package/server/routes/codex-auth-routes.ts +49 -0
- package/server/routes.ts +2 -0
- package/dist/assets/CronManager-DQXJXJO2.js +0 -1
- package/dist/assets/MagicUIView-D6jNdxHM.js +0 -1
- package/dist/assets/SettingsPage-QEkLsk5w.js +0 -1
- package/dist/assets/index-CnVoJw43.js +0 -140
- package/dist/assets/index-DB85gIpd.css +0 -1
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Playground-BiEa7THU.js","assets/MagicUIDashboard-exuRY5LQ.js","assets/MagicUIView-AKoy6jOb.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var XN=Object.defineProperty;var KN=(e,t,n)=>t in e?XN(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Wb=(e,t,n)=>KN(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"]'))r(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"&&r(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 r(a){if(a.ep)return;a.ep=!0;const o=n(a);fetch(a.href,o)}})();const ZN="modulepreload",JN=function(e){return"/"+e},Qb={},Vn=function(t,n,r){let a=Promise.resolve();if(n&&n.length>0){let u=function(p){return Promise.all(p.map(m=>Promise.resolve(m).then(x=>({status:"fulfilled",value:x}),x=>({status:"rejected",reason:x}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),f=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));a=u(n.map(p=>{if(p=JN(p),p in Qb)return;Qb[p]=!0;const m=p.endsWith(".css"),x=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${x}`))return;const b=document.createElement("link");if(b.rel=m?"stylesheet":ZN,m||(b.as="script"),b.crossOrigin="",b.href=p,f&&b.setAttribute("nonce",f),document.head.appendChild(b),m)return new Promise((y,_)=>{b.addEventListener("load",y),b.addEventListener("error",()=>_(new Error(`Unable to preload CSS for ${p}`)))})}))}function o(u){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=u,window.dispatchEvent(d),!d.defaultPrevented)throw u}return a.then(u=>{for(const d of u||[])d.status==="rejected"&&o(d.reason);return t().catch(o)})};function Nx(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var tm={exports:{}},ic={};/**
|
|
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 Xb;function eC(){if(Xb)return ic;Xb=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,a,o){var u=null;if(o!==void 0&&(u=""+o),a.key!==void 0&&(u=""+a.key),"key"in a){o={};for(var d in a)d!=="key"&&(o[d]=a[d])}else o=a;return a=o.ref,{$$typeof:e,type:r,key:u,ref:a!==void 0?a:null,props:o}}return ic.Fragment=t,ic.jsx=n,ic.jsxs=n,ic}var Kb;function tC(){return Kb||(Kb=1,tm.exports=eC()),tm.exports}var l=tC(),nm={exports:{}},Qe={};/**
|
|
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 Zb;function nC(){if(Zb)return Qe;Zb=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),u=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),x=Symbol.for("react.activity"),b=Symbol.iterator;function y(B){return B===null||typeof B!="object"?null:(B=b&&B[b]||B["@@iterator"],typeof B=="function"?B:null)}var _={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,N={};function w(B,Q,R){this.props=B,this.context=Q,this.refs=N,this.updater=R||_}w.prototype.isReactComponent={},w.prototype.setState=function(B,Q){if(typeof B!="object"&&typeof B!="function"&&B!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,B,Q,"setState")},w.prototype.forceUpdate=function(B){this.updater.enqueueForceUpdate(this,B,"forceUpdate")};function E(){}E.prototype=w.prototype;function C(B,Q,R){this.props=B,this.context=Q,this.refs=N,this.updater=R||_}var T=C.prototype=new E;T.constructor=C,j(T,w.prototype),T.isPureReactComponent=!0;var O=Array.isArray;function z(){}var I={H:null,A:null,T:null,S:null},U=Object.prototype.hasOwnProperty;function Z(B,Q,R){var me=R.ref;return{$$typeof:e,type:B,key:Q,ref:me!==void 0?me:null,props:R}}function L(B,Q){return Z(B.type,Q,B.props)}function q(B){return typeof B=="object"&&B!==null&&B.$$typeof===e}function M(B){var Q={"=":"=0",":":"=2"};return"$"+B.replace(/[=:]/g,function(R){return Q[R]})}var ie=/\/+/g;function X(B,Q){return typeof B=="object"&&B!==null&&B.key!=null?M(""+B.key):Q.toString(36)}function Y(B){switch(B.status){case"fulfilled":return B.value;case"rejected":throw B.reason;default:switch(typeof B.status=="string"?B.then(z,z):(B.status="pending",B.then(function(Q){B.status==="pending"&&(B.status="fulfilled",B.value=Q)},function(Q){B.status==="pending"&&(B.status="rejected",B.reason=Q)})),B.status){case"fulfilled":return B.value;case"rejected":throw B.reason}}throw B}function P(B,Q,R,me,be){var Ce=typeof B;(Ce==="undefined"||Ce==="boolean")&&(B=null);var Le=!1;if(B===null)Le=!0;else switch(Ce){case"bigint":case"string":case"number":Le=!0;break;case"object":switch(B.$$typeof){case e:case t:Le=!0;break;case m:return Le=B._init,P(Le(B._payload),Q,R,me,be)}}if(Le)return be=be(B),Le=me===""?"."+X(B,0):me,O(be)?(R="",Le!=null&&(R=Le.replace(ie,"$&/")+"/"),P(be,Q,R,"",function(Ue){return Ue})):be!=null&&(q(be)&&(be=L(be,R+(be.key==null||B&&B.key===be.key?"":(""+be.key).replace(ie,"$&/")+"/")+Le)),Q.push(be)),1;Le=0;var Ee=me===""?".":me+":";if(O(B))for(var Ae=0;Ae<B.length;Ae++)me=B[Ae],Ce=Ee+X(me,Ae),Le+=P(me,Q,R,Ce,be);else if(Ae=y(B),typeof Ae=="function")for(B=Ae.call(B),Ae=0;!(me=B.next()).done;)me=me.value,Ce=Ee+X(me,Ae++),Le+=P(me,Q,R,Ce,be);else if(Ce==="object"){if(typeof B.then=="function")return P(Y(B),Q,R,me,be);throw Q=String(B),Error("Objects are not valid as a React child (found: "+(Q==="[object Object]"?"object with keys {"+Object.keys(B).join(", ")+"}":Q)+"). If you meant to render a collection of children, use an array instead.")}return Le}function $(B,Q,R){if(B==null)return B;var me=[],be=0;return P(B,me,"","",function(Ce){return Q.call(R,Ce,be++)}),me}function re(B){if(B._status===-1){var Q=B._result;Q=Q(),Q.then(function(R){(B._status===0||B._status===-1)&&(B._status=1,B._result=R)},function(R){(B._status===0||B._status===-1)&&(B._status=2,B._result=R)}),B._status===-1&&(B._status=0,B._result=Q)}if(B._status===1)return B._result.default;throw B._result}var ae=typeof reportError=="function"?reportError:function(B){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Q=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof B=="object"&&B!==null&&typeof B.message=="string"?String(B.message):String(B),error:B});if(!window.dispatchEvent(Q))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",B);return}console.error(B)},D={map:$,forEach:function(B,Q,R){$(B,function(){Q.apply(this,arguments)},R)},count:function(B){var Q=0;return $(B,function(){Q++}),Q},toArray:function(B){return $(B,function(Q){return Q})||[]},only:function(B){if(!q(B))throw Error("React.Children.only expected to receive a single React element child.");return B}};return Qe.Activity=x,Qe.Children=D,Qe.Component=w,Qe.Fragment=n,Qe.Profiler=a,Qe.PureComponent=C,Qe.StrictMode=r,Qe.Suspense=f,Qe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=I,Qe.__COMPILER_RUNTIME={__proto__:null,c:function(B){return I.H.useMemoCache(B)}},Qe.cache=function(B){return function(){return B.apply(null,arguments)}},Qe.cacheSignal=function(){return null},Qe.cloneElement=function(B,Q,R){if(B==null)throw Error("The argument must be a React element, but you passed "+B+".");var me=j({},B.props),be=B.key;if(Q!=null)for(Ce in Q.key!==void 0&&(be=""+Q.key),Q)!U.call(Q,Ce)||Ce==="key"||Ce==="__self"||Ce==="__source"||Ce==="ref"&&Q.ref===void 0||(me[Ce]=Q[Ce]);var Ce=arguments.length-2;if(Ce===1)me.children=R;else if(1<Ce){for(var Le=Array(Ce),Ee=0;Ee<Ce;Ee++)Le[Ee]=arguments[Ee+2];me.children=Le}return Z(B.type,be,me)},Qe.createContext=function(B){return B={$$typeof:u,_currentValue:B,_currentValue2:B,_threadCount:0,Provider:null,Consumer:null},B.Provider=B,B.Consumer={$$typeof:o,_context:B},B},Qe.createElement=function(B,Q,R){var me,be={},Ce=null;if(Q!=null)for(me in Q.key!==void 0&&(Ce=""+Q.key),Q)U.call(Q,me)&&me!=="key"&&me!=="__self"&&me!=="__source"&&(be[me]=Q[me]);var Le=arguments.length-2;if(Le===1)be.children=R;else if(1<Le){for(var Ee=Array(Le),Ae=0;Ae<Le;Ae++)Ee[Ae]=arguments[Ae+2];be.children=Ee}if(B&&B.defaultProps)for(me in Le=B.defaultProps,Le)be[me]===void 0&&(be[me]=Le[me]);return Z(B,Ce,be)},Qe.createRef=function(){return{current:null}},Qe.forwardRef=function(B){return{$$typeof:d,render:B}},Qe.isValidElement=q,Qe.lazy=function(B){return{$$typeof:m,_payload:{_status:-1,_result:B},_init:re}},Qe.memo=function(B,Q){return{$$typeof:p,type:B,compare:Q===void 0?null:Q}},Qe.startTransition=function(B){var Q=I.T,R={};I.T=R;try{var me=B(),be=I.S;be!==null&&be(R,me),typeof me=="object"&&me!==null&&typeof me.then=="function"&&me.then(z,ae)}catch(Ce){ae(Ce)}finally{Q!==null&&R.types!==null&&(Q.types=R.types),I.T=Q}},Qe.unstable_useCacheRefresh=function(){return I.H.useCacheRefresh()},Qe.use=function(B){return I.H.use(B)},Qe.useActionState=function(B,Q,R){return I.H.useActionState(B,Q,R)},Qe.useCallback=function(B,Q){return I.H.useCallback(B,Q)},Qe.useContext=function(B){return I.H.useContext(B)},Qe.useDebugValue=function(){},Qe.useDeferredValue=function(B,Q){return I.H.useDeferredValue(B,Q)},Qe.useEffect=function(B,Q){return I.H.useEffect(B,Q)},Qe.useEffectEvent=function(B){return I.H.useEffectEvent(B)},Qe.useId=function(){return I.H.useId()},Qe.useImperativeHandle=function(B,Q,R){return I.H.useImperativeHandle(B,Q,R)},Qe.useInsertionEffect=function(B,Q){return I.H.useInsertionEffect(B,Q)},Qe.useLayoutEffect=function(B,Q){return I.H.useLayoutEffect(B,Q)},Qe.useMemo=function(B,Q){return I.H.useMemo(B,Q)},Qe.useOptimistic=function(B,Q){return I.H.useOptimistic(B,Q)},Qe.useReducer=function(B,Q,R){return I.H.useReducer(B,Q,R)},Qe.useRef=function(B){return I.H.useRef(B)},Qe.useState=function(B){return I.H.useState(B)},Qe.useSyncExternalStore=function(B,Q,R){return I.H.useSyncExternalStore(B,Q,R)},Qe.useTransition=function(){return I.H.useTransition()},Qe.version="19.2.8",Qe}var Jb;function Cx(){return Jb||(Jb=1,nm.exports=nC()),nm.exports}var k=Cx();const jd=Nx(k);var rm={exports:{}},ac={},sm={exports:{}},im={};/**
|
|
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 ey;function rC(){return ey||(ey=1,(function(e){function t(P,$){var re=P.length;P.push($);e:for(;0<re;){var ae=re-1>>>1,D=P[ae];if(0<a(D,$))P[ae]=$,P[re]=D,re=ae;else break e}}function n(P){return P.length===0?null:P[0]}function r(P){if(P.length===0)return null;var $=P[0],re=P.pop();if(re!==$){P[0]=re;e:for(var ae=0,D=P.length,B=D>>>1;ae<B;){var Q=2*(ae+1)-1,R=P[Q],me=Q+1,be=P[me];if(0>a(R,re))me<D&&0>a(be,R)?(P[ae]=be,P[me]=re,ae=me):(P[ae]=R,P[Q]=re,ae=Q);else if(me<D&&0>a(be,re))P[ae]=be,P[me]=re,ae=me;else break e}}return $}function a(P,$){var re=P.sortIndex-$.sortIndex;return re!==0?re:P.id-$.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,d=u.now();e.unstable_now=function(){return u.now()-d}}var f=[],p=[],m=1,x=null,b=3,y=!1,_=!1,j=!1,N=!1,w=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;function T(P){for(var $=n(p);$!==null;){if($.callback===null)r(p);else if($.startTime<=P)r(p),$.sortIndex=$.expirationTime,t(f,$);else break;$=n(p)}}function O(P){if(j=!1,T(P),!_)if(n(f)!==null)_=!0,z||(z=!0,M());else{var $=n(p);$!==null&&Y(O,$.startTime-P)}}var z=!1,I=-1,U=5,Z=-1;function L(){return N?!0:!(e.unstable_now()-Z<U)}function q(){if(N=!1,z){var P=e.unstable_now();Z=P;var $=!0;try{e:{_=!1,j&&(j=!1,E(I),I=-1),y=!0;var re=b;try{t:{for(T(P),x=n(f);x!==null&&!(x.expirationTime>P&&L());){var ae=x.callback;if(typeof ae=="function"){x.callback=null,b=x.priorityLevel;var D=ae(x.expirationTime<=P);if(P=e.unstable_now(),typeof D=="function"){x.callback=D,T(P),$=!0;break t}x===n(f)&&r(f),T(P)}else r(f);x=n(f)}if(x!==null)$=!0;else{var B=n(p);B!==null&&Y(O,B.startTime-P),$=!1}}break e}finally{x=null,b=re,y=!1}$=void 0}}finally{$?M():z=!1}}}var M;if(typeof C=="function")M=function(){C(q)};else if(typeof MessageChannel<"u"){var ie=new MessageChannel,X=ie.port2;ie.port1.onmessage=q,M=function(){X.postMessage(null)}}else M=function(){w(q,0)};function Y(P,$){I=w(function(){P(e.unstable_now())},$)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(P){P.callback=null},e.unstable_forceFrameRate=function(P){0>P||125<P?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):U=0<P?Math.floor(1e3/P):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(P){switch(b){case 1:case 2:case 3:var $=3;break;default:$=b}var re=b;b=$;try{return P()}finally{b=re}},e.unstable_requestPaint=function(){N=!0},e.unstable_runWithPriority=function(P,$){switch(P){case 1:case 2:case 3:case 4:case 5:break;default:P=3}var re=b;b=P;try{return $()}finally{b=re}},e.unstable_scheduleCallback=function(P,$,re){var ae=e.unstable_now();switch(typeof re=="object"&&re!==null?(re=re.delay,re=typeof re=="number"&&0<re?ae+re:ae):re=ae,P){case 1:var D=-1;break;case 2:D=250;break;case 5:D=1073741823;break;case 4:D=1e4;break;default:D=5e3}return D=re+D,P={id:m++,callback:$,priorityLevel:P,startTime:re,expirationTime:D,sortIndex:-1},re>ae?(P.sortIndex=re,t(p,P),n(f)===null&&P===n(p)&&(j?(E(I),I=-1):j=!0,Y(O,re-ae))):(P.sortIndex=D,t(f,P),_||y||(_=!0,z||(z=!0,M()))),P},e.unstable_shouldYield=L,e.unstable_wrapCallback=function(P){var $=b;return function(){var re=b;b=$;try{return P.apply(this,arguments)}finally{b=re}}}})(im)),im}var ty;function sC(){return ty||(ty=1,sm.exports=rC()),sm.exports}var am={exports:{}},Fn={};/**
|
|
27
|
+
* @license React
|
|
28
|
+
* react-dom.production.js
|
|
29
|
+
*
|
|
30
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
31
|
+
*
|
|
32
|
+
* This source code is licensed under the MIT license found in the
|
|
33
|
+
* LICENSE file in the root directory of this source tree.
|
|
34
|
+
*/var ny;function iC(){if(ny)return Fn;ny=1;var e=Cx();function t(f){var p="https://react.dev/errors/"+f;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var m=2;m<arguments.length;m++)p+="&args[]="+encodeURIComponent(arguments[m])}return"Minified React error #"+f+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={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");function o(f,p,m){var x=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:x==null?null:""+x,children:f,containerInfo:p,implementation:m}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(f,p){if(f==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return Fn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Fn.createPortal=function(f,p){var m=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(t(299));return o(f,p,null,m)},Fn.flushSync=function(f){var p=u.T,m=r.p;try{if(u.T=null,r.p=2,f)return f()}finally{u.T=p,r.p=m,r.d.f()}},Fn.preconnect=function(f,p){typeof f=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,r.d.C(f,p))},Fn.prefetchDNS=function(f){typeof f=="string"&&r.d.D(f)},Fn.preinit=function(f,p){if(typeof f=="string"&&p&&typeof p.as=="string"){var m=p.as,x=d(m,p.crossOrigin),b=typeof p.integrity=="string"?p.integrity:void 0,y=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;m==="style"?r.d.S(f,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:x,integrity:b,fetchPriority:y}):m==="script"&&r.d.X(f,{crossOrigin:x,integrity:b,fetchPriority:y,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},Fn.preinitModule=function(f,p){if(typeof f=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var m=d(p.as,p.crossOrigin);r.d.M(f,{crossOrigin:m,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&r.d.M(f)},Fn.preload=function(f,p){if(typeof f=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var m=p.as,x=d(m,p.crossOrigin);r.d.L(f,m,{crossOrigin:x,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},Fn.preloadModule=function(f,p){if(typeof f=="string")if(p){var m=d(p.as,p.crossOrigin);r.d.m(f,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:m,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else r.d.m(f)},Fn.requestFormReset=function(f){r.d.r(f)},Fn.unstable_batchedUpdates=function(f,p){return f(p)},Fn.useFormState=function(f,p,m){return u.H.useFormState(f,p,m)},Fn.useFormStatus=function(){return u.H.useHostTransitionStatus()},Fn.version="19.2.8",Fn}var ry;function dw(){if(ry)return am.exports;ry=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(),am.exports=iC(),am.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 sy;function aC(){if(sy)return ac;sy=1;var e=sC(),t=Cx(),n=dw();function r(s){var i="https://react.dev/errors/"+s;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)i+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+s+"; visit "+i+" 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){var i=s,c=s;if(s.alternate)for(;i.return;)i=i.return;else{s=i;do i=s,(i.flags&4098)!==0&&(c=i.return),s=i.return;while(s)}return i.tag===3?c:null}function u(s){if(s.tag===13){var i=s.memoizedState;if(i===null&&(s=s.alternate,s!==null&&(i=s.memoizedState)),i!==null)return i.dehydrated}return null}function d(s){if(s.tag===31){var i=s.memoizedState;if(i===null&&(s=s.alternate,s!==null&&(i=s.memoizedState)),i!==null)return i.dehydrated}return null}function f(s){if(o(s)!==s)throw Error(r(188))}function p(s){var i=s.alternate;if(!i){if(i=o(s),i===null)throw Error(r(188));return i!==s?null:s}for(var c=s,h=i;;){var g=c.return;if(g===null)break;var v=g.alternate;if(v===null){if(h=g.return,h!==null){c=h;continue}break}if(g.child===v.child){for(v=g.child;v;){if(v===c)return f(g),s;if(v===h)return f(g),i;v=v.sibling}throw Error(r(188))}if(c.return!==h.return)c=g,h=v;else{for(var S=!1,A=g.child;A;){if(A===c){S=!0,c=g,h=v;break}if(A===h){S=!0,h=g,c=v;break}A=A.sibling}if(!S){for(A=v.child;A;){if(A===c){S=!0,c=v,h=g;break}if(A===h){S=!0,h=v,c=g;break}A=A.sibling}if(!S)throw Error(r(189))}}if(c.alternate!==h)throw Error(r(190))}if(c.tag!==3)throw Error(r(188));return c.stateNode.current===c?s:i}function m(s){var i=s.tag;if(i===5||i===26||i===27||i===6)return s;for(s=s.child;s!==null;){if(i=m(s),i!==null)return i;s=s.sibling}return null}var x=Object.assign,b=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),_=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),N=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),E=Symbol.for("react.consumer"),C=Symbol.for("react.context"),T=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),z=Symbol.for("react.suspense_list"),I=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),Z=Symbol.for("react.activity"),L=Symbol.for("react.memo_cache_sentinel"),q=Symbol.iterator;function M(s){return s===null||typeof s!="object"?null:(s=q&&s[q]||s["@@iterator"],typeof s=="function"?s:null)}var ie=Symbol.for("react.client.reference");function X(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===ie?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case j:return"Fragment";case w:return"Profiler";case N:return"StrictMode";case O:return"Suspense";case z:return"SuspenseList";case Z:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case _:return"Portal";case C:return s.displayName||"Context";case E:return(s._context.displayName||"Context")+".Consumer";case T:var i=s.render;return s=s.displayName,s||(s=i.displayName||i.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case I:return i=s.displayName||null,i!==null?i:X(s.type)||"Memo";case U:i=s._payload,s=s._init;try{return X(s(i))}catch{}}return null}var Y=Array.isArray,P=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,re={pending:!1,data:null,method:null,action:null},ae=[],D=-1;function B(s){return{current:s}}function Q(s){0>D||(s.current=ae[D],ae[D]=null,D--)}function R(s,i){D++,ae[D]=s.current,s.current=i}var me=B(null),be=B(null),Ce=B(null),Le=B(null);function Ee(s,i){switch(R(Ce,i),R(be,s),R(me,null),i.nodeType){case 9:case 11:s=(s=i.documentElement)&&(s=s.namespaceURI)?xb(s):0;break;default:if(s=i.tagName,i=i.namespaceURI)i=xb(i),s=vb(i,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}Q(me),R(me,s)}function Ae(){Q(me),Q(be),Q(Ce)}function Ue(s){s.memoizedState!==null&&R(Le,s);var i=me.current,c=vb(i,s.type);i!==c&&(R(be,s),R(me,c))}function dt(s){be.current===s&&(Q(me),Q(be)),Le.current===s&&(Q(Le),tc._currentValue=re)}var Je,At;function mt(s){if(Je===void 0)try{throw Error()}catch(c){var i=c.stack.trim().match(/\n( *(at )?)/);Je=i&&i[1]||"",At=-1<c.stack.indexOf(`
|
|
43
|
+
at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
44
|
+
`+Je+s+At}var rt=!1;function Lt(s,i){if(!s||rt)return"";rt=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var h={DetermineComponentFrameRoot:function(){try{if(i){var fe=function(){throw Error()};if(Object.defineProperty(fe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(fe,[])}catch(le){var se=le}Reflect.construct(s,[],fe)}else{try{fe.call()}catch(le){se=le}s.call(fe.prototype)}}else{try{throw Error()}catch(le){se=le}(fe=s())&&typeof fe.catch=="function"&&fe.catch(function(){})}}catch(le){if(le&&se&&typeof le.stack=="string")return[le.stack,se.stack]}return[null,null]}};h.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var g=Object.getOwnPropertyDescriptor(h.DetermineComponentFrameRoot,"name");g&&g.configurable&&Object.defineProperty(h.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var v=h.DetermineComponentFrameRoot(),S=v[0],A=v[1];if(S&&A){var F=S.split(`
|
|
45
|
+
`),ee=A.split(`
|
|
46
|
+
`);for(g=h=0;h<F.length&&!F[h].includes("DetermineComponentFrameRoot");)h++;for(;g<ee.length&&!ee[g].includes("DetermineComponentFrameRoot");)g++;if(h===F.length||g===ee.length)for(h=F.length-1,g=ee.length-1;1<=h&&0<=g&&F[h]!==ee[g];)g--;for(;1<=h&&0<=g;h--,g--)if(F[h]!==ee[g]){if(h!==1||g!==1)do if(h--,g--,0>g||F[h]!==ee[g]){var ue=`
|
|
47
|
+
`+F[h].replace(" at new "," at ");return s.displayName&&ue.includes("<anonymous>")&&(ue=ue.replace("<anonymous>",s.displayName)),ue}while(1<=h&&0<=g);break}}}finally{rt=!1,Error.prepareStackTrace=c}return(c=s?s.displayName||s.name:"")?mt(c):""}function we(s,i){switch(s.tag){case 26:case 27:case 5:return mt(s.type);case 16:return mt("Lazy");case 13:return s.child!==i&&i!==null?mt("Suspense Fallback"):mt("Suspense");case 19:return mt("SuspenseList");case 0:case 15:return Lt(s.type,!1);case 11:return Lt(s.type.render,!1);case 1:return Lt(s.type,!0);case 31:return mt("Activity");default:return""}}function Ge(s){try{var i="",c=null;do i+=we(s,c),c=s,s=s.return;while(s);return i}catch(h){return`
|
|
48
|
+
Error generating stack: `+h.message+`
|
|
49
|
+
`+h.stack}}var gt=Object.prototype.hasOwnProperty,_n=e.unstable_scheduleCallback,Ne=e.unstable_cancelCallback,Be=e.unstable_shouldYield,yt=e.unstable_requestPaint,Te=e.unstable_now,Xr=e.unstable_getCurrentPriorityLevel,oe=e.unstable_ImmediatePriority,ke=e.unstable_UserBlockingPriority,W=e.unstable_NormalPriority,xe=e.unstable_LowPriority,Oe=e.unstable_IdlePriority,Xe=e.log,lt=e.unstable_setDisableYieldValue,ot=null,Et=null;function wn(s){if(typeof Xe=="function"&<(s),Et&&typeof Et.setStrictMode=="function")try{Et.setStrictMode(ot,s)}catch{}}var st=Math.clz32?Math.clz32:cs,fr=Math.log,Pn=Math.LN2;function cs(s){return s>>>=0,s===0?32:31-(fr(s)/Pn|0)|0}var Kr=256,Zr=262144,ne=4194304;function ve(s){var i=s&42;if(i!==0)return i;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&261888;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 _e(s,i,c){var h=s.pendingLanes;if(h===0)return 0;var g=0,v=s.suspendedLanes,S=s.pingedLanes;s=s.warmLanes;var A=h&134217727;return A!==0?(h=A&~v,h!==0?g=ve(h):(S&=A,S!==0?g=ve(S):c||(c=A&~s,c!==0&&(g=ve(c))))):(A=h&~v,A!==0?g=ve(A):S!==0?g=ve(S):c||(c=h&~s,c!==0&&(g=ve(c)))),g===0?0:i!==0&&i!==g&&(i&v)===0&&(v=g&-g,c=i&-i,v>=c||v===32&&(c&4194048)!==0)?i:g}function Ke(s,i){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&i)===0}function qt(s,i){switch(s){case 1:case 2:case 4:case 8:case 64:return i+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 i+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 fn(){var s=ne;return ne<<=1,(ne&62914560)===0&&(ne=4194304),s}function $n(s){for(var i=[],c=0;31>c;c++)i.push(s);return i}function Vt(s,i){s.pendingLanes|=i,i!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function Yn(s,i,c,h,g,v){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 A=s.entanglements,F=s.expirationTimes,ee=s.hiddenUpdates;for(c=S&~c;0<c;){var ue=31-st(c),fe=1<<ue;A[ue]=0,F[ue]=-1;var se=ee[ue];if(se!==null)for(ee[ue]=null,ue=0;ue<se.length;ue++){var le=se[ue];le!==null&&(le.lane&=-536870913)}c&=~fe}h!==0&&Tr(s,h,0),v!==0&&g===0&&s.tag!==0&&(s.suspendedLanes|=v&~(S&~i))}function Tr(s,i,c){s.pendingLanes|=i,s.suspendedLanes&=~i;var h=31-st(i);s.entangledLanes|=i,s.entanglements[h]=s.entanglements[h]|1073741824|c&261930}function Ua(s,i){var c=s.entangledLanes|=i;for(s=s.entanglements;c;){var h=31-st(c),g=1<<h;g&i|s[h]&i&&(s[h]|=i),c&=~g}}function uo(s,i){var c=i&-i;return c=(c&42)!==0?1:Wn(c),(c&(s.suspendedLanes|i))!==0?0:c}function Wn(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 Ji(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function ho(){var s=$.p;return s!==0?s:(s=window.event,s===void 0?32:Ub(s.type))}function fo(s,i){var c=$.p;try{return $.p=s,i()}finally{$.p=c}}var Mr=Math.random().toString(36).slice(2),en="__reactFiber$"+Mr,Tn="__reactProps$"+Mr,pr="__reactContainer$"+Mr,po="__reactEvents$"+Mr,ef="__reactListeners$"+Mr,ea="__reactHandles$"+Mr,ta="__reactResources$"+Mr,us="__reactMarker$"+Mr;function oi(s){delete s[en],delete s[Tn],delete s[po],delete s[ef],delete s[ea]}function As(s){var i=s[en];if(i)return i;for(var c=s.parentNode;c;){if(i=c[pr]||c[en]){if(c=i.alternate,i.child!==null||c!==null&&c.child!==null)for(s=jb(s);s!==null;){if(c=s[en])return c;s=jb(s)}return i}s=c,c=s.parentNode}return null}function Jn(s){if(s=s[en]||s[pr]){var i=s.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return s}return null}function na(s){var i=s.tag;if(i===5||i===26||i===27||i===6)return s.stateNode;throw Error(r(33))}function ds(s){var i=s[ta];return i||(i=s[ta]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function nn(s){s[us]=!0}var er=new Set,Ia={};function Jr(s,i){hs(s,i),hs(s+"Capture",i)}function hs(s,i){for(Ia[s]=i,s=0;s<i.length;s++)er.add(i[s])}var mo=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]*$"),go={},rn={};function tf(s){return gt.call(rn,s)?!0:gt.call(go,s)?!1:mo.test(s)?rn[s]=!0:(go[s]=!0,!1)}function ra(s,i,c){if(tf(i))if(c===null)s.removeAttribute(i);else{switch(typeof c){case"undefined":case"function":case"symbol":s.removeAttribute(i);return;case"boolean":var h=i.toLowerCase().slice(0,5);if(h!=="data-"&&h!=="aria-"){s.removeAttribute(i);return}}s.setAttribute(i,""+c)}}function Ha(s,i,c){if(c===null)s.removeAttribute(i);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(i);return}s.setAttribute(i,""+c)}}function es(s,i,c,h){if(h===null)s.removeAttribute(c);else{switch(typeof h){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(c);return}s.setAttributeNS(i,c,""+h)}}function tr(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function cu(s){var i=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function xo(s,i,c){var h=Object.getOwnPropertyDescriptor(s.constructor.prototype,i);if(!s.hasOwnProperty(i)&&typeof h<"u"&&typeof h.get=="function"&&typeof h.set=="function"){var g=h.get,v=h.set;return Object.defineProperty(s,i,{configurable:!0,get:function(){return g.call(this)},set:function(S){c=""+S,v.call(this,S)}}),Object.defineProperty(s,i,{enumerable:h.enumerable}),{getValue:function(){return c},setValue:function(S){c=""+S},stopTracking:function(){s._valueTracker=null,delete s[i]}}}}function qa(s){if(!s._valueTracker){var i=cu(s)?"checked":"value";s._valueTracker=xo(s,i,""+s[i])}}function fs(s){if(!s)return!1;var i=s._valueTracker;if(!i)return!0;var c=i.getValue(),h="";return s&&(h=cu(s)?s.checked?"true":"false":s.value),s=h,s!==c?(i.setValue(s),!0):!1}function ci(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}}var Rr=/[\n"\\]/g;function un(s){return s.replace(Rr,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function sa(s,i,c,h,g,v,S,A){s.name="",S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?s.type=S:s.removeAttribute("type"),i!=null?S==="number"?(i===0&&s.value===""||s.value!=i)&&(s.value=""+tr(i)):s.value!==""+tr(i)&&(s.value=""+tr(i)):S!=="submit"&&S!=="reset"||s.removeAttribute("value"),i!=null?Va(s,S,tr(i)):c!=null?Va(s,S,tr(c)):h!=null&&s.removeAttribute("value"),g==null&&v!=null&&(s.defaultChecked=!!v),g!=null&&(s.checked=g&&typeof g!="function"&&typeof g!="symbol"),A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?s.name=""+tr(A):s.removeAttribute("name")}function uu(s,i,c,h,g,v,S,A){if(v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(s.type=v),i!=null||c!=null){if(!(v!=="submit"&&v!=="reset"||i!=null)){qa(s);return}c=c!=null?""+tr(c):"",i=i!=null?""+tr(i):c,A||i===s.value||(s.value=i),s.defaultValue=i}h=h??g,h=typeof h!="function"&&typeof h!="symbol"&&!!h,s.checked=A?s.checked:!!h,s.defaultChecked=!!h,S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"&&(s.name=S),qa(s)}function Va(s,i,c){i==="number"&&ci(s.ownerDocument)===s||s.defaultValue===""+c||(s.defaultValue=""+c)}function ui(s,i,c,h){if(s=s.options,i){i={};for(var g=0;g<c.length;g++)i["$"+c[g]]=!0;for(c=0;c<s.length;c++)g=i.hasOwnProperty("$"+s[c].value),s[c].selected!==g&&(s[c].selected=g),g&&h&&(s[c].defaultSelected=!0)}else{for(c=""+tr(c),i=null,g=0;g<s.length;g++){if(s[g].value===c){s[g].selected=!0,h&&(s[g].defaultSelected=!0);return}i!==null||s[g].disabled||(i=s[g])}i!==null&&(i.selected=!0)}}function Ga(s,i,c){if(i!=null&&(i=""+tr(i),i!==s.value&&(s.value=i),c==null)){s.defaultValue!==i&&(s.defaultValue=i);return}s.defaultValue=c!=null?""+tr(c):""}function vo(s,i,c,h){if(i==null){if(h!=null){if(c!=null)throw Error(r(92));if(Y(h)){if(1<h.length)throw Error(r(93));h=h[0]}c=h}c==null&&(c=""),i=c}c=tr(i),s.defaultValue=c,h=s.textContent,h===c&&h!==""&&h!==null&&(s.value=h),qa(s)}function di(s,i){if(i){var c=s.firstChild;if(c&&c===s.lastChild&&c.nodeType===3){c.nodeValue=i;return}}s.textContent=i}var nf=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 du(s,i,c){var h=i.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?h?s.setProperty(i,""):i==="float"?s.cssFloat="":s[i]="":h?s.setProperty(i,c):typeof c!="number"||c===0||nf.has(i)?i==="float"?s.cssFloat=c:s[i]=(""+c).trim():s[i]=c+"px"}function hu(s,i,c){if(i!=null&&typeof i!="object")throw Error(r(62));if(s=s.style,c!=null){for(var h in c)!c.hasOwnProperty(h)||i!=null&&i.hasOwnProperty(h)||(h.indexOf("--")===0?s.setProperty(h,""):h==="float"?s.cssFloat="":s[h]="");for(var g in i)h=i[g],i.hasOwnProperty(g)&&c[g]!==h&&du(s,g,h)}else for(var v in i)i.hasOwnProperty(v)&&du(s,v,i[v])}function Ya(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 fu=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),rf=/^[\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 Wa(s){return rf.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function Dr(){}var hi=null;function Qa(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var fi=null,pi=null;function pu(s){var i=Jn(s);if(i&&(s=i.stateNode)){var c=s[Tn]||null;e:switch(s=i.stateNode,i.type){case"input":if(sa(s,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),i=c.name,c.type==="radio"&&i!=null){for(c=s;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+un(""+i)+'"][type="radio"]'),i=0;i<c.length;i++){var h=c[i];if(h!==s&&h.form===s.form){var g=h[Tn]||null;if(!g)throw Error(r(90));sa(h,g.value,g.defaultValue,g.defaultValue,g.checked,g.defaultChecked,g.type,g.name)}}for(i=0;i<c.length;i++)h=c[i],h.form===s.form&&fs(h)}break e;case"textarea":Ga(s,c.value,c.defaultValue);break e;case"select":i=c.value,i!=null&&ui(s,!!c.multiple,i,!1)}}}var bo=!1;function mu(s,i,c){if(bo)return s(i,c);bo=!0;try{var h=s(i);return h}finally{if(bo=!1,(fi!==null||pi!==null)&&(rd(),fi&&(i=fi,s=pi,pi=fi=null,pu(i),s)))for(i=0;i<s.length;i++)pu(s[i])}}function ia(s,i){var c=s.stateNode;if(c===null)return null;var h=c[Tn]||null;if(h===null)return null;c=h[i];e:switch(i){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(h=!h.disabled)||(s=s.type,h=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!h;break e;default:s=!1}if(s)return null;if(c&&typeof c!="function")throw Error(r(231,i,typeof c));return c}var Lr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Xa=!1;if(Lr)try{var mi={};Object.defineProperty(mi,"passive",{get:function(){Xa=!0}}),window.addEventListener("test",mi,mi),window.removeEventListener("test",mi,mi)}catch{Xa=!1}var H=null,ge=null,Ze=null;function _t(){if(Ze)return Ze;var s,i=ge,c=i.length,h,g="value"in H?H.value:H.textContent,v=g.length;for(s=0;s<c&&i[s]===g[s];s++);var S=c-s;for(h=1;h<=S&&i[c-h]===g[v-h];h++);return Ze=g.slice(s,1<h?1-h:void 0)}function ct(s){var i=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&i===13&&(s=13)):s=i,s===10&&(s=13),32<=s||s===13?s:0}function Ve(){return!0}function Qn(){return!1}function kn(s){function i(c,h,g,v,S){this._reactName=c,this._targetInst=g,this.type=h,this.nativeEvent=v,this.target=S,this.currentTarget=null;for(var A in s)s.hasOwnProperty(A)&&(c=s[A],this[A]=c?c(v):v[A]);return this.isDefaultPrevented=(v.defaultPrevented!=null?v.defaultPrevented:v.returnValue===!1)?Ve:Qn,this.isPropagationStopped=Qn,this}return x(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=Ve)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=Ve)},persist:function(){},isPersistent:Ve}),i}var Or={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ts=kn(Or),Sn=x({},Or,{view:0,detail:0}),gu=kn(Sn),yo,_o,aa,la=x({},Sn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:af,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!==aa&&(aa&&s.type==="mousemove"?(yo=s.screenX-aa.screenX,_o=s.screenY-aa.screenY):_o=yo=0,aa=s),yo)},movementY:function(s){return"movementY"in s?s.movementY:_o}}),sf=kn(la),xu=x({},la,{dataTransfer:0}),vu=kn(xu),bu=x({},Sn,{relatedTarget:0}),ps=kn(bu),yu=x({},Or,{animationName:0,elapsedTime:0,pseudoElement:0}),_u=kn(yu),Ka=x({},Or,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),tj=kn(Ka),nj=x({},Or,{data:0}),_v=kn(nj),rj={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},sj={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"},ij={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function aj(s){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(s):(s=ij[s])?!!i[s]:!1}function af(){return aj}var lj=x({},Sn,{key:function(s){if(s.key){var i=rj[s.key]||s.key;if(i!=="Unidentified")return i}return s.type==="keypress"?(s=ct(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?sj[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:af,charCode:function(s){return s.type==="keypress"?ct(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?ct(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),oj=kn(lj),cj=x({},la,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),wv=kn(cj),uj=x({},Sn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:af}),dj=kn(uj),hj=x({},Or,{propertyName:0,elapsedTime:0,pseudoElement:0}),fj=kn(hj),pj=x({},la,{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}),mj=kn(pj),gj=x({},Or,{newState:0,oldState:0}),xj=kn(gj),vj=[9,13,27,32],lf=Lr&&"CompositionEvent"in window,wo=null;Lr&&"documentMode"in document&&(wo=document.documentMode);var bj=Lr&&"TextEvent"in window&&!wo,kv=Lr&&(!lf||wo&&8<wo&&11>=wo),Sv=" ",jv=!1;function Nv(s,i){switch(s){case"keyup":return vj.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Cv(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var Za=!1;function yj(s,i){switch(s){case"compositionend":return Cv(i);case"keypress":return i.which!==32?null:(jv=!0,Sv);case"textInput":return s=i.data,s===Sv&&jv?null:s;default:return null}}function _j(s,i){if(Za)return s==="compositionend"||!lf&&Nv(s,i)?(s=_t(),Ze=ge=H=null,Za=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1<i.char.length)return i.char;if(i.which)return String.fromCharCode(i.which)}return null;case"compositionend":return kv&&i.locale!=="ko"?null:i.data;default:return null}}var wj={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 Ev(s){var i=s&&s.nodeName&&s.nodeName.toLowerCase();return i==="input"?!!wj[s.type]:i==="textarea"}function Av(s,i,c,h){fi?pi?pi.push(h):pi=[h]:fi=h,i=ud(i,"onChange"),0<i.length&&(c=new Ts("onChange","change",null,c,h),s.push({event:c,listeners:i}))}var ko=null,So=null;function kj(s){db(s,0)}function wu(s){var i=na(s);if(fs(i))return s}function Tv(s,i){if(s==="change")return i}var Mv=!1;if(Lr){var of;if(Lr){var cf="oninput"in document;if(!cf){var Rv=document.createElement("div");Rv.setAttribute("oninput","return;"),cf=typeof Rv.oninput=="function"}of=cf}else of=!1;Mv=of&&(!document.documentMode||9<document.documentMode)}function Dv(){ko&&(ko.detachEvent("onpropertychange",Lv),So=ko=null)}function Lv(s){if(s.propertyName==="value"&&wu(So)){var i=[];Av(i,So,s,Qa(s)),mu(kj,i)}}function Sj(s,i,c){s==="focusin"?(Dv(),ko=i,So=c,ko.attachEvent("onpropertychange",Lv)):s==="focusout"&&Dv()}function jj(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return wu(So)}function Nj(s,i){if(s==="click")return wu(i)}function Cj(s,i){if(s==="input"||s==="change")return wu(i)}function Ej(s,i){return s===i&&(s!==0||1/s===1/i)||s!==s&&i!==i}var mr=typeof Object.is=="function"?Object.is:Ej;function jo(s,i){if(mr(s,i))return!0;if(typeof s!="object"||s===null||typeof i!="object"||i===null)return!1;var c=Object.keys(s),h=Object.keys(i);if(c.length!==h.length)return!1;for(h=0;h<c.length;h++){var g=c[h];if(!gt.call(i,g)||!mr(s[g],i[g]))return!1}return!0}function Ov(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function zv(s,i){var c=Ov(s);s=0;for(var h;c;){if(c.nodeType===3){if(h=s+c.textContent.length,s<=i&&h>=i)return{node:c,offset:i-s};s=h}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=Ov(c)}}function Bv(s,i){return s&&i?s===i?!0:s&&s.nodeType===3?!1:i&&i.nodeType===3?Bv(s,i.parentNode):"contains"in s?s.contains(i):s.compareDocumentPosition?!!(s.compareDocumentPosition(i)&16):!1:!1}function Pv(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var i=ci(s.document);i instanceof s.HTMLIFrameElement;){try{var c=typeof i.contentWindow.location.href=="string"}catch{c=!1}if(c)s=i.contentWindow;else break;i=ci(s.document)}return i}function uf(s){var i=s&&s.nodeName&&s.nodeName.toLowerCase();return i&&(i==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||i==="textarea"||s.contentEditable==="true")}var Aj=Lr&&"documentMode"in document&&11>=document.documentMode,Ja=null,df=null,No=null,hf=!1;function $v(s,i,c){var h=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;hf||Ja==null||Ja!==ci(h)||(h=Ja,"selectionStart"in h&&uf(h)?h={start:h.selectionStart,end:h.selectionEnd}:(h=(h.ownerDocument&&h.ownerDocument.defaultView||window).getSelection(),h={anchorNode:h.anchorNode,anchorOffset:h.anchorOffset,focusNode:h.focusNode,focusOffset:h.focusOffset}),No&&jo(No,h)||(No=h,h=ud(df,"onSelect"),0<h.length&&(i=new Ts("onSelect","select",null,i,c),s.push({event:i,listeners:h}),i.target=Ja)))}function oa(s,i){var c={};return c[s.toLowerCase()]=i.toLowerCase(),c["Webkit"+s]="webkit"+i,c["Moz"+s]="moz"+i,c}var el={animationend:oa("Animation","AnimationEnd"),animationiteration:oa("Animation","AnimationIteration"),animationstart:oa("Animation","AnimationStart"),transitionrun:oa("Transition","TransitionRun"),transitionstart:oa("Transition","TransitionStart"),transitioncancel:oa("Transition","TransitionCancel"),transitionend:oa("Transition","TransitionEnd")},ff={},Fv={};Lr&&(Fv=document.createElement("div").style,"AnimationEvent"in window||(delete el.animationend.animation,delete el.animationiteration.animation,delete el.animationstart.animation),"TransitionEvent"in window||delete el.transitionend.transition);function ca(s){if(ff[s])return ff[s];if(!el[s])return s;var i=el[s],c;for(c in i)if(i.hasOwnProperty(c)&&c in Fv)return ff[s]=i[c];return s}var Uv=ca("animationend"),Iv=ca("animationiteration"),Hv=ca("animationstart"),Tj=ca("transitionrun"),Mj=ca("transitionstart"),Rj=ca("transitioncancel"),qv=ca("transitionend"),Vv=new Map,pf="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");pf.push("scrollEnd");function ts(s,i){Vv.set(s,i),Jr(i,[s])}var ku=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var i=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(i))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)},zr=[],tl=0,mf=0;function Su(){for(var s=tl,i=mf=tl=0;i<s;){var c=zr[i];zr[i++]=null;var h=zr[i];zr[i++]=null;var g=zr[i];zr[i++]=null;var v=zr[i];if(zr[i++]=null,h!==null&&g!==null){var S=h.pending;S===null?g.next=g:(g.next=S.next,S.next=g),h.pending=g}v!==0&&Gv(c,g,v)}}function ju(s,i,c,h){zr[tl++]=s,zr[tl++]=i,zr[tl++]=c,zr[tl++]=h,mf|=h,s.lanes|=h,s=s.alternate,s!==null&&(s.lanes|=h)}function gf(s,i,c,h){return ju(s,i,c,h),Nu(s)}function ua(s,i){return ju(s,null,null,i),Nu(s)}function Gv(s,i,c){s.lanes|=c;var h=s.alternate;h!==null&&(h.lanes|=c);for(var g=!1,v=s.return;v!==null;)v.childLanes|=c,h=v.alternate,h!==null&&(h.childLanes|=c),v.tag===22&&(s=v.stateNode,s===null||s._visibility&1||(g=!0)),s=v,v=v.return;return s.tag===3?(v=s.stateNode,g&&i!==null&&(g=31-st(c),s=v.hiddenUpdates,h=s[g],h===null?s[g]=[i]:h.push(i),i.lane=c|536870912),v):null}function Nu(s){if(50<Wo)throw Wo=0,jp=null,Error(r(185));for(var i=s.return;i!==null;)s=i,i=s.return;return s.tag===3?s.stateNode:null}var nl={};function Dj(s,i,c,h){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=i,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=h,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function gr(s,i,c,h){return new Dj(s,i,c,h)}function xf(s){return s=s.prototype,!(!s||!s.isReactComponent)}function Ms(s,i){var c=s.alternate;return c===null?(c=gr(s.tag,i,s.key,s.mode),c.elementType=s.elementType,c.type=s.type,c.stateNode=s.stateNode,c.alternate=s,s.alternate=c):(c.pendingProps=i,c.type=s.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=s.flags&65011712,c.childLanes=s.childLanes,c.lanes=s.lanes,c.child=s.child,c.memoizedProps=s.memoizedProps,c.memoizedState=s.memoizedState,c.updateQueue=s.updateQueue,i=s.dependencies,c.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},c.sibling=s.sibling,c.index=s.index,c.ref=s.ref,c.refCleanup=s.refCleanup,c}function Yv(s,i){s.flags&=65011714;var c=s.alternate;return c===null?(s.childLanes=0,s.lanes=i,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,i=c.dependencies,s.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),s}function Cu(s,i,c,h,g,v){var S=0;if(h=s,typeof s=="function")xf(s)&&(S=1);else if(typeof s=="string")S=PN(s,c,me.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case Z:return s=gr(31,c,i,g),s.elementType=Z,s.lanes=v,s;case j:return da(c.children,g,v,i);case N:S=8,g|=24;break;case w:return s=gr(12,c,i,g|2),s.elementType=w,s.lanes=v,s;case O:return s=gr(13,c,i,g),s.elementType=O,s.lanes=v,s;case z:return s=gr(19,c,i,g),s.elementType=z,s.lanes=v,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case C:S=10;break e;case E:S=9;break e;case T:S=11;break e;case I:S=14;break e;case U:S=16,h=null;break e}S=29,c=Error(r(130,s===null?"null":typeof s,"")),h=null}return i=gr(S,c,i,g),i.elementType=s,i.type=h,i.lanes=v,i}function da(s,i,c,h){return s=gr(7,s,h,i),s.lanes=c,s}function vf(s,i,c){return s=gr(6,s,null,i),s.lanes=c,s}function Wv(s){var i=gr(18,null,null,0);return i.stateNode=s,i}function bf(s,i,c){return i=gr(4,s.children!==null?s.children:[],s.key,i),i.lanes=c,i.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},i}var Qv=new WeakMap;function Br(s,i){if(typeof s=="object"&&s!==null){var c=Qv.get(s);return c!==void 0?c:(i={value:s,source:i,stack:Ge(i)},Qv.set(s,i),i)}return{value:s,source:i,stack:Ge(i)}}var rl=[],sl=0,Eu=null,Co=0,Pr=[],$r=0,gi=null,ms=1,gs="";function Rs(s,i){rl[sl++]=Co,rl[sl++]=Eu,Eu=s,Co=i}function Xv(s,i,c){Pr[$r++]=ms,Pr[$r++]=gs,Pr[$r++]=gi,gi=s;var h=ms;s=gs;var g=32-st(h)-1;h&=~(1<<g),c+=1;var v=32-st(i)+g;if(30<v){var S=g-g%5;v=(h&(1<<S)-1).toString(32),h>>=S,g-=S,ms=1<<32-st(i)+g|c<<g|h,gs=v+s}else ms=1<<v|c<<g|h,gs=s}function yf(s){s.return!==null&&(Rs(s,1),Xv(s,1,0))}function _f(s){for(;s===Eu;)Eu=rl[--sl],rl[sl]=null,Co=rl[--sl],rl[sl]=null;for(;s===gi;)gi=Pr[--$r],Pr[$r]=null,gs=Pr[--$r],Pr[$r]=null,ms=Pr[--$r],Pr[$r]=null}function Kv(s,i){Pr[$r++]=ms,Pr[$r++]=gs,Pr[$r++]=gi,ms=i.id,gs=i.overflow,gi=s}var Mn=null,Yt=null,bt=!1,xi=null,Fr=!1,wf=Error(r(519));function vi(s){var i=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Eo(Br(i,s)),wf}function Zv(s){var i=s.stateNode,c=s.type,h=s.memoizedProps;switch(i[en]=s,i[Tn]=h,c){case"dialog":ft("cancel",i),ft("close",i);break;case"iframe":case"object":case"embed":ft("load",i);break;case"video":case"audio":for(c=0;c<Xo.length;c++)ft(Xo[c],i);break;case"source":ft("error",i);break;case"img":case"image":case"link":ft("error",i),ft("load",i);break;case"details":ft("toggle",i);break;case"input":ft("invalid",i),uu(i,h.value,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name,!0);break;case"select":ft("invalid",i);break;case"textarea":ft("invalid",i),vo(i,h.value,h.defaultValue,h.children)}c=h.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||i.textContent===""+c||h.suppressHydrationWarning===!0||mb(i.textContent,c)?(h.popover!=null&&(ft("beforetoggle",i),ft("toggle",i)),h.onScroll!=null&&ft("scroll",i),h.onScrollEnd!=null&&ft("scrollend",i),h.onClick!=null&&(i.onclick=Dr),i=!0):i=!1,i||vi(s,!0)}function Jv(s){for(Mn=s.return;Mn;)switch(Mn.tag){case 5:case 31:case 13:Fr=!1;return;case 27:case 3:Fr=!0;return;default:Mn=Mn.return}}function il(s){if(s!==Mn)return!1;if(!bt)return Jv(s),bt=!0,!1;var i=s.tag,c;if((c=i!==3&&i!==27)&&((c=i===5)&&(c=s.type,c=!(c!=="form"&&c!=="button")||Fp(s.type,s.memoizedProps)),c=!c),c&&Yt&&vi(s),Jv(s),i===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(317));Yt=Sb(s)}else if(i===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(317));Yt=Sb(s)}else i===27?(i=Yt,Ri(s.type)?(s=Vp,Vp=null,Yt=s):Yt=i):Yt=Mn?Ir(s.stateNode.nextSibling):null;return!0}function ha(){Yt=Mn=null,bt=!1}function kf(){var s=xi;return s!==null&&(ir===null?ir=s:ir.push.apply(ir,s),xi=null),s}function Eo(s){xi===null?xi=[s]:xi.push(s)}var Sf=B(null),fa=null,Ds=null;function bi(s,i,c){R(Sf,i._currentValue),i._currentValue=c}function Ls(s){s._currentValue=Sf.current,Q(Sf)}function jf(s,i,c){for(;s!==null;){var h=s.alternate;if((s.childLanes&i)!==i?(s.childLanes|=i,h!==null&&(h.childLanes|=i)):h!==null&&(h.childLanes&i)!==i&&(h.childLanes|=i),s===c)break;s=s.return}}function Nf(s,i,c,h){var g=s.child;for(g!==null&&(g.return=s);g!==null;){var v=g.dependencies;if(v!==null){var S=g.child;v=v.firstContext;e:for(;v!==null;){var A=v;v=g;for(var F=0;F<i.length;F++)if(A.context===i[F]){v.lanes|=c,A=v.alternate,A!==null&&(A.lanes|=c),jf(v.return,c,s),h||(S=null);break e}v=A.next}}else if(g.tag===18){if(S=g.return,S===null)throw Error(r(341));S.lanes|=c,v=S.alternate,v!==null&&(v.lanes|=c),jf(S,c,s),S=null}else S=g.child;if(S!==null)S.return=g;else for(S=g;S!==null;){if(S===s){S=null;break}if(g=S.sibling,g!==null){g.return=S.return,S=g;break}S=S.return}g=S}}function al(s,i,c,h){s=null;for(var g=i,v=!1;g!==null;){if(!v){if((g.flags&524288)!==0)v=!0;else if((g.flags&262144)!==0)break}if(g.tag===10){var S=g.alternate;if(S===null)throw Error(r(387));if(S=S.memoizedProps,S!==null){var A=g.type;mr(g.pendingProps.value,S.value)||(s!==null?s.push(A):s=[A])}}else if(g===Le.current){if(S=g.alternate,S===null)throw Error(r(387));S.memoizedState.memoizedState!==g.memoizedState.memoizedState&&(s!==null?s.push(tc):s=[tc])}g=g.return}s!==null&&Nf(i,s,c,h),i.flags|=262144}function Au(s){for(s=s.firstContext;s!==null;){if(!mr(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function pa(s){fa=s,Ds=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function Rn(s){return e0(fa,s)}function Tu(s,i){return fa===null&&pa(s),e0(s,i)}function e0(s,i){var c=i._currentValue;if(i={context:i,memoizedValue:c,next:null},Ds===null){if(s===null)throw Error(r(308));Ds=i,s.dependencies={lanes:0,firstContext:i},s.flags|=524288}else Ds=Ds.next=i;return c}var Lj=typeof AbortController<"u"?AbortController:function(){var s=[],i=this.signal={aborted:!1,addEventListener:function(c,h){s.push(h)}};this.abort=function(){i.aborted=!0,s.forEach(function(c){return c()})}},Oj=e.unstable_scheduleCallback,zj=e.unstable_NormalPriority,pn={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Cf(){return{controller:new Lj,data:new Map,refCount:0}}function Ao(s){s.refCount--,s.refCount===0&&Oj(zj,function(){s.controller.abort()})}var To=null,Ef=0,ll=0,ol=null;function Bj(s,i){if(To===null){var c=To=[];Ef=0,ll=Mp(),ol={status:"pending",value:void 0,then:function(h){c.push(h)}}}return Ef++,i.then(t0,t0),i}function t0(){if(--Ef===0&&To!==null){ol!==null&&(ol.status="fulfilled");var s=To;To=null,ll=0,ol=null;for(var i=0;i<s.length;i++)(0,s[i])()}}function Pj(s,i){var c=[],h={status:"pending",value:null,reason:null,then:function(g){c.push(g)}};return s.then(function(){h.status="fulfilled",h.value=i;for(var g=0;g<c.length;g++)(0,c[g])(i)},function(g){for(h.status="rejected",h.reason=g,g=0;g<c.length;g++)(0,c[g])(void 0)}),h}var n0=P.S;P.S=function(s,i){$1=Te(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&Bj(s,i),n0!==null&&n0(s,i)};var ma=B(null);function Af(){var s=ma.current;return s!==null?s:Ut.pooledCache}function Mu(s,i){i===null?R(ma,ma.current):R(ma,i.pool)}function r0(){var s=Af();return s===null?null:{parent:pn._currentValue,pool:s}}var cl=Error(r(460)),Tf=Error(r(474)),Ru=Error(r(542)),Du={then:function(){}};function s0(s){return s=s.status,s==="fulfilled"||s==="rejected"}function i0(s,i,c){switch(c=s[c],c===void 0?s.push(i):c!==i&&(i.then(Dr,Dr),i=c),i.status){case"fulfilled":return i.value;case"rejected":throw s=i.reason,l0(s),s;default:if(typeof i.status=="string")i.then(Dr,Dr);else{if(s=Ut,s!==null&&100<s.shellSuspendCounter)throw Error(r(482));s=i,s.status="pending",s.then(function(h){if(i.status==="pending"){var g=i;g.status="fulfilled",g.value=h}},function(h){if(i.status==="pending"){var g=i;g.status="rejected",g.reason=h}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw s=i.reason,l0(s),s}throw xa=i,cl}}function ga(s){try{var i=s._init;return i(s._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(xa=c,cl):c}}var xa=null;function a0(){if(xa===null)throw Error(r(459));var s=xa;return xa=null,s}function l0(s){if(s===cl||s===Ru)throw Error(r(483))}var ul=null,Mo=0;function Lu(s){var i=Mo;return Mo+=1,ul===null&&(ul=[]),i0(ul,s,i)}function Ro(s,i){i=i.props.ref,s.ref=i!==void 0?i:null}function Ou(s,i){throw i.$$typeof===b?Error(r(525)):(s=Object.prototype.toString.call(i),Error(r(31,s==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":s)))}function o0(s){function i(K,V){if(s){var J=K.deletions;J===null?(K.deletions=[V],K.flags|=16):J.push(V)}}function c(K,V){if(!s)return null;for(;V!==null;)i(K,V),V=V.sibling;return null}function h(K){for(var V=new Map;K!==null;)K.key!==null?V.set(K.key,K):V.set(K.index,K),K=K.sibling;return V}function g(K,V){return K=Ms(K,V),K.index=0,K.sibling=null,K}function v(K,V,J){return K.index=J,s?(J=K.alternate,J!==null?(J=J.index,J<V?(K.flags|=67108866,V):J):(K.flags|=67108866,V)):(K.flags|=1048576,V)}function S(K){return s&&K.alternate===null&&(K.flags|=67108866),K}function A(K,V,J,he){return V===null||V.tag!==6?(V=vf(J,K.mode,he),V.return=K,V):(V=g(V,J),V.return=K,V)}function F(K,V,J,he){var $e=J.type;return $e===j?ue(K,V,J.props.children,he,J.key):V!==null&&(V.elementType===$e||typeof $e=="object"&&$e!==null&&$e.$$typeof===U&&ga($e)===V.type)?(V=g(V,J.props),Ro(V,J),V.return=K,V):(V=Cu(J.type,J.key,J.props,null,K.mode,he),Ro(V,J),V.return=K,V)}function ee(K,V,J,he){return V===null||V.tag!==4||V.stateNode.containerInfo!==J.containerInfo||V.stateNode.implementation!==J.implementation?(V=bf(J,K.mode,he),V.return=K,V):(V=g(V,J.children||[]),V.return=K,V)}function ue(K,V,J,he,$e){return V===null||V.tag!==7?(V=da(J,K.mode,he,$e),V.return=K,V):(V=g(V,J),V.return=K,V)}function fe(K,V,J){if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return V=vf(""+V,K.mode,J),V.return=K,V;if(typeof V=="object"&&V!==null){switch(V.$$typeof){case y:return J=Cu(V.type,V.key,V.props,null,K.mode,J),Ro(J,V),J.return=K,J;case _:return V=bf(V,K.mode,J),V.return=K,V;case U:return V=ga(V),fe(K,V,J)}if(Y(V)||M(V))return V=da(V,K.mode,J,null),V.return=K,V;if(typeof V.then=="function")return fe(K,Lu(V),J);if(V.$$typeof===C)return fe(K,Tu(K,V),J);Ou(K,V)}return null}function se(K,V,J,he){var $e=V!==null?V.key:null;if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return $e!==null?null:A(K,V,""+J,he);if(typeof J=="object"&&J!==null){switch(J.$$typeof){case y:return J.key===$e?F(K,V,J,he):null;case _:return J.key===$e?ee(K,V,J,he):null;case U:return J=ga(J),se(K,V,J,he)}if(Y(J)||M(J))return $e!==null?null:ue(K,V,J,he,null);if(typeof J.then=="function")return se(K,V,Lu(J),he);if(J.$$typeof===C)return se(K,V,Tu(K,J),he);Ou(K,J)}return null}function le(K,V,J,he,$e){if(typeof he=="string"&&he!==""||typeof he=="number"||typeof he=="bigint")return K=K.get(J)||null,A(V,K,""+he,$e);if(typeof he=="object"&&he!==null){switch(he.$$typeof){case y:return K=K.get(he.key===null?J:he.key)||null,F(V,K,he,$e);case _:return K=K.get(he.key===null?J:he.key)||null,ee(V,K,he,$e);case U:return he=ga(he),le(K,V,J,he,$e)}if(Y(he)||M(he))return K=K.get(J)||null,ue(V,K,he,$e,null);if(typeof he.then=="function")return le(K,V,J,Lu(he),$e);if(he.$$typeof===C)return le(K,V,J,Tu(V,he),$e);Ou(V,he)}return null}function Re(K,V,J,he){for(var $e=null,St=null,ze=V,it=V=0,vt=null;ze!==null&&it<J.length;it++){ze.index>it?(vt=ze,ze=null):vt=ze.sibling;var jt=se(K,ze,J[it],he);if(jt===null){ze===null&&(ze=vt);break}s&&ze&&jt.alternate===null&&i(K,ze),V=v(jt,V,it),St===null?$e=jt:St.sibling=jt,St=jt,ze=vt}if(it===J.length)return c(K,ze),bt&&Rs(K,it),$e;if(ze===null){for(;it<J.length;it++)ze=fe(K,J[it],he),ze!==null&&(V=v(ze,V,it),St===null?$e=ze:St.sibling=ze,St=ze);return bt&&Rs(K,it),$e}for(ze=h(ze);it<J.length;it++)vt=le(ze,K,it,J[it],he),vt!==null&&(s&&vt.alternate!==null&&ze.delete(vt.key===null?it:vt.key),V=v(vt,V,it),St===null?$e=vt:St.sibling=vt,St=vt);return s&&ze.forEach(function(Bi){return i(K,Bi)}),bt&&Rs(K,it),$e}function qe(K,V,J,he){if(J==null)throw Error(r(151));for(var $e=null,St=null,ze=V,it=V=0,vt=null,jt=J.next();ze!==null&&!jt.done;it++,jt=J.next()){ze.index>it?(vt=ze,ze=null):vt=ze.sibling;var Bi=se(K,ze,jt.value,he);if(Bi===null){ze===null&&(ze=vt);break}s&&ze&&Bi.alternate===null&&i(K,ze),V=v(Bi,V,it),St===null?$e=Bi:St.sibling=Bi,St=Bi,ze=vt}if(jt.done)return c(K,ze),bt&&Rs(K,it),$e;if(ze===null){for(;!jt.done;it++,jt=J.next())jt=fe(K,jt.value,he),jt!==null&&(V=v(jt,V,it),St===null?$e=jt:St.sibling=jt,St=jt);return bt&&Rs(K,it),$e}for(ze=h(ze);!jt.done;it++,jt=J.next())jt=le(ze,K,it,jt.value,he),jt!==null&&(s&&jt.alternate!==null&&ze.delete(jt.key===null?it:jt.key),V=v(jt,V,it),St===null?$e=jt:St.sibling=jt,St=jt);return s&&ze.forEach(function(QN){return i(K,QN)}),bt&&Rs(K,it),$e}function Bt(K,V,J,he){if(typeof J=="object"&&J!==null&&J.type===j&&J.key===null&&(J=J.props.children),typeof J=="object"&&J!==null){switch(J.$$typeof){case y:e:{for(var $e=J.key;V!==null;){if(V.key===$e){if($e=J.type,$e===j){if(V.tag===7){c(K,V.sibling),he=g(V,J.props.children),he.return=K,K=he;break e}}else if(V.elementType===$e||typeof $e=="object"&&$e!==null&&$e.$$typeof===U&&ga($e)===V.type){c(K,V.sibling),he=g(V,J.props),Ro(he,J),he.return=K,K=he;break e}c(K,V);break}else i(K,V);V=V.sibling}J.type===j?(he=da(J.props.children,K.mode,he,J.key),he.return=K,K=he):(he=Cu(J.type,J.key,J.props,null,K.mode,he),Ro(he,J),he.return=K,K=he)}return S(K);case _:e:{for($e=J.key;V!==null;){if(V.key===$e)if(V.tag===4&&V.stateNode.containerInfo===J.containerInfo&&V.stateNode.implementation===J.implementation){c(K,V.sibling),he=g(V,J.children||[]),he.return=K,K=he;break e}else{c(K,V);break}else i(K,V);V=V.sibling}he=bf(J,K.mode,he),he.return=K,K=he}return S(K);case U:return J=ga(J),Bt(K,V,J,he)}if(Y(J))return Re(K,V,J,he);if(M(J)){if($e=M(J),typeof $e!="function")throw Error(r(150));return J=$e.call(J),qe(K,V,J,he)}if(typeof J.then=="function")return Bt(K,V,Lu(J),he);if(J.$$typeof===C)return Bt(K,V,Tu(K,J),he);Ou(K,J)}return typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint"?(J=""+J,V!==null&&V.tag===6?(c(K,V.sibling),he=g(V,J),he.return=K,K=he):(c(K,V),he=vf(J,K.mode,he),he.return=K,K=he),S(K)):c(K,V)}return function(K,V,J,he){try{Mo=0;var $e=Bt(K,V,J,he);return ul=null,$e}catch(ze){if(ze===cl||ze===Ru)throw ze;var St=gr(29,ze,null,K.mode);return St.lanes=he,St.return=K,St}finally{}}}var va=o0(!0),c0=o0(!1),yi=!1;function Mf(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Rf(s,i){s=s.updateQueue,i.updateQueue===s&&(i.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function _i(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function wi(s,i,c){var h=s.updateQueue;if(h===null)return null;if(h=h.shared,(Ct&2)!==0){var g=h.pending;return g===null?i.next=i:(i.next=g.next,g.next=i),h.pending=i,i=Nu(s),Gv(s,null,c),i}return ju(s,h,i,c),Nu(s)}function Do(s,i,c){if(i=i.updateQueue,i!==null&&(i=i.shared,(c&4194048)!==0)){var h=i.lanes;h&=s.pendingLanes,c|=h,i.lanes=c,Ua(s,c)}}function Df(s,i){var c=s.updateQueue,h=s.alternate;if(h!==null&&(h=h.updateQueue,c===h)){var g=null,v=null;if(c=c.firstBaseUpdate,c!==null){do{var S={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};v===null?g=v=S:v=v.next=S,c=c.next}while(c!==null);v===null?g=v=i:v=v.next=i}else g=v=i;c={baseState:h.baseState,firstBaseUpdate:g,lastBaseUpdate:v,shared:h.shared,callbacks:h.callbacks},s.updateQueue=c;return}s=c.lastBaseUpdate,s===null?c.firstBaseUpdate=i:s.next=i,c.lastBaseUpdate=i}var Lf=!1;function Lo(){if(Lf){var s=ol;if(s!==null)throw s}}function Oo(s,i,c,h){Lf=!1;var g=s.updateQueue;yi=!1;var v=g.firstBaseUpdate,S=g.lastBaseUpdate,A=g.shared.pending;if(A!==null){g.shared.pending=null;var F=A,ee=F.next;F.next=null,S===null?v=ee:S.next=ee,S=F;var ue=s.alternate;ue!==null&&(ue=ue.updateQueue,A=ue.lastBaseUpdate,A!==S&&(A===null?ue.firstBaseUpdate=ee:A.next=ee,ue.lastBaseUpdate=F))}if(v!==null){var fe=g.baseState;S=0,ue=ee=F=null,A=v;do{var se=A.lane&-536870913,le=se!==A.lane;if(le?(xt&se)===se:(h&se)===se){se!==0&&se===ll&&(Lf=!0),ue!==null&&(ue=ue.next={lane:0,tag:A.tag,payload:A.payload,callback:null,next:null});e:{var Re=s,qe=A;se=i;var Bt=c;switch(qe.tag){case 1:if(Re=qe.payload,typeof Re=="function"){fe=Re.call(Bt,fe,se);break e}fe=Re;break e;case 3:Re.flags=Re.flags&-65537|128;case 0:if(Re=qe.payload,se=typeof Re=="function"?Re.call(Bt,fe,se):Re,se==null)break e;fe=x({},fe,se);break e;case 2:yi=!0}}se=A.callback,se!==null&&(s.flags|=64,le&&(s.flags|=8192),le=g.callbacks,le===null?g.callbacks=[se]:le.push(se))}else le={lane:se,tag:A.tag,payload:A.payload,callback:A.callback,next:null},ue===null?(ee=ue=le,F=fe):ue=ue.next=le,S|=se;if(A=A.next,A===null){if(A=g.shared.pending,A===null)break;le=A,A=le.next,le.next=null,g.lastBaseUpdate=le,g.shared.pending=null}}while(!0);ue===null&&(F=fe),g.baseState=F,g.firstBaseUpdate=ee,g.lastBaseUpdate=ue,v===null&&(g.shared.lanes=0),Ci|=S,s.lanes=S,s.memoizedState=fe}}function u0(s,i){if(typeof s!="function")throw Error(r(191,s));s.call(i)}function d0(s,i){var c=s.callbacks;if(c!==null)for(s.callbacks=null,s=0;s<c.length;s++)u0(c[s],i)}var dl=B(null),zu=B(0);function h0(s,i){s=Hs,R(zu,s),R(dl,i),Hs=s|i.baseLanes}function Of(){R(zu,Hs),R(dl,dl.current)}function zf(){Hs=zu.current,Q(dl),Q(zu)}var xr=B(null),Ur=null;function ki(s){var i=s.alternate;R(dn,dn.current&1),R(xr,s),Ur===null&&(i===null||dl.current!==null||i.memoizedState!==null)&&(Ur=s)}function Bf(s){R(dn,dn.current),R(xr,s),Ur===null&&(Ur=s)}function f0(s){s.tag===22?(R(dn,dn.current),R(xr,s),Ur===null&&(Ur=s)):Si()}function Si(){R(dn,dn.current),R(xr,xr.current)}function vr(s){Q(xr),Ur===s&&(Ur=null),Q(dn)}var dn=B(0);function Bu(s){for(var i=s;i!==null;){if(i.tag===13){var c=i.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||Hp(c)||qp(c)))return i}else if(i.tag===19&&(i.memoizedProps.revealOrder==="forwards"||i.memoizedProps.revealOrder==="backwards"||i.memoizedProps.revealOrder==="unstable_legacy-backwards"||i.memoizedProps.revealOrder==="together")){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===s)break;for(;i.sibling===null;){if(i.return===null||i.return===s)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var Os=0,et=null,Ot=null,mn=null,Pu=!1,hl=!1,ba=!1,$u=0,zo=0,fl=null,$j=0;function ln(){throw Error(r(321))}function Pf(s,i){if(i===null)return!1;for(var c=0;c<i.length&&c<s.length;c++)if(!mr(s[c],i[c]))return!1;return!0}function $f(s,i,c,h,g,v){return Os=v,et=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,P.H=s===null||s.memoizedState===null?X0:ep,ba=!1,v=c(h,g),ba=!1,hl&&(v=m0(i,c,h,g)),p0(s),v}function p0(s){P.H=$o;var i=Ot!==null&&Ot.next!==null;if(Os=0,mn=Ot=et=null,Pu=!1,zo=0,fl=null,i)throw Error(r(300));s===null||gn||(s=s.dependencies,s!==null&&Au(s)&&(gn=!0))}function m0(s,i,c,h){et=s;var g=0;do{if(hl&&(fl=null),zo=0,hl=!1,25<=g)throw Error(r(301));if(g+=1,mn=Ot=null,s.updateQueue!=null){var v=s.updateQueue;v.lastEffect=null,v.events=null,v.stores=null,v.memoCache!=null&&(v.memoCache.index=0)}P.H=K0,v=i(c,h)}while(hl);return v}function Fj(){var s=P.H,i=s.useState()[0];return i=typeof i.then=="function"?Bo(i):i,s=s.useState()[0],(Ot!==null?Ot.memoizedState:null)!==s&&(et.flags|=1024),i}function Ff(){var s=$u!==0;return $u=0,s}function Uf(s,i,c){i.updateQueue=s.updateQueue,i.flags&=-2053,s.lanes&=~c}function If(s){if(Pu){for(s=s.memoizedState;s!==null;){var i=s.queue;i!==null&&(i.pending=null),s=s.next}Pu=!1}Os=0,mn=Ot=et=null,hl=!1,zo=$u=0,fl=null}function Xn(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return mn===null?et.memoizedState=mn=s:mn=mn.next=s,mn}function hn(){if(Ot===null){var s=et.alternate;s=s!==null?s.memoizedState:null}else s=Ot.next;var i=mn===null?et.memoizedState:mn.next;if(i!==null)mn=i,Ot=s;else{if(s===null)throw et.alternate===null?Error(r(467)):Error(r(310));Ot=s,s={memoizedState:Ot.memoizedState,baseState:Ot.baseState,baseQueue:Ot.baseQueue,queue:Ot.queue,next:null},mn===null?et.memoizedState=mn=s:mn=mn.next=s}return mn}function Fu(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Bo(s){var i=zo;return zo+=1,fl===null&&(fl=[]),s=i0(fl,s,i),i=et,(mn===null?i.memoizedState:mn.next)===null&&(i=i.alternate,P.H=i===null||i.memoizedState===null?X0:ep),s}function Uu(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return Bo(s);if(s.$$typeof===C)return Rn(s)}throw Error(r(438,String(s)))}function Hf(s){var i=null,c=et.updateQueue;if(c!==null&&(i=c.memoCache),i==null){var h=et.alternate;h!==null&&(h=h.updateQueue,h!==null&&(h=h.memoCache,h!=null&&(i={data:h.data.map(function(g){return g.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),c===null&&(c=Fu(),et.updateQueue=c),c.memoCache=i,c=i.data[i.index],c===void 0)for(c=i.data[i.index]=Array(s),h=0;h<s;h++)c[h]=L;return i.index++,c}function zs(s,i){return typeof i=="function"?i(s):i}function Iu(s){var i=hn();return qf(i,Ot,s)}function qf(s,i,c){var h=s.queue;if(h===null)throw Error(r(311));h.lastRenderedReducer=c;var g=s.baseQueue,v=h.pending;if(v!==null){if(g!==null){var S=g.next;g.next=v.next,v.next=S}i.baseQueue=g=v,h.pending=null}if(v=s.baseState,g===null)s.memoizedState=v;else{i=g.next;var A=S=null,F=null,ee=i,ue=!1;do{var fe=ee.lane&-536870913;if(fe!==ee.lane?(xt&fe)===fe:(Os&fe)===fe){var se=ee.revertLane;if(se===0)F!==null&&(F=F.next={lane:0,revertLane:0,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null}),fe===ll&&(ue=!0);else if((Os&se)===se){ee=ee.next,se===ll&&(ue=!0);continue}else fe={lane:0,revertLane:ee.revertLane,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},F===null?(A=F=fe,S=v):F=F.next=fe,et.lanes|=se,Ci|=se;fe=ee.action,ba&&c(v,fe),v=ee.hasEagerState?ee.eagerState:c(v,fe)}else se={lane:fe,revertLane:ee.revertLane,gesture:ee.gesture,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},F===null?(A=F=se,S=v):F=F.next=se,et.lanes|=fe,Ci|=fe;ee=ee.next}while(ee!==null&&ee!==i);if(F===null?S=v:F.next=A,!mr(v,s.memoizedState)&&(gn=!0,ue&&(c=ol,c!==null)))throw c;s.memoizedState=v,s.baseState=S,s.baseQueue=F,h.lastRenderedState=v}return g===null&&(h.lanes=0),[s.memoizedState,h.dispatch]}function Vf(s){var i=hn(),c=i.queue;if(c===null)throw Error(r(311));c.lastRenderedReducer=s;var h=c.dispatch,g=c.pending,v=i.memoizedState;if(g!==null){c.pending=null;var S=g=g.next;do v=s(v,S.action),S=S.next;while(S!==g);mr(v,i.memoizedState)||(gn=!0),i.memoizedState=v,i.baseQueue===null&&(i.baseState=v),c.lastRenderedState=v}return[v,h]}function g0(s,i,c){var h=et,g=hn(),v=bt;if(v){if(c===void 0)throw Error(r(407));c=c()}else c=i();var S=!mr((Ot||g).memoizedState,c);if(S&&(g.memoizedState=c,gn=!0),g=g.queue,Wf(b0.bind(null,h,g,s),[s]),g.getSnapshot!==i||S||mn!==null&&mn.memoizedState.tag&1){if(h.flags|=2048,pl(9,{destroy:void 0},v0.bind(null,h,g,c,i),null),Ut===null)throw Error(r(349));v||(Os&127)!==0||x0(h,i,c)}return c}function x0(s,i,c){s.flags|=16384,s={getSnapshot:i,value:c},i=et.updateQueue,i===null?(i=Fu(),et.updateQueue=i,i.stores=[s]):(c=i.stores,c===null?i.stores=[s]:c.push(s))}function v0(s,i,c,h){i.value=c,i.getSnapshot=h,y0(i)&&_0(s)}function b0(s,i,c){return c(function(){y0(i)&&_0(s)})}function y0(s){var i=s.getSnapshot;s=s.value;try{var c=i();return!mr(s,c)}catch{return!0}}function _0(s){var i=ua(s,2);i!==null&&ar(i,s,2)}function Gf(s){var i=Xn();if(typeof s=="function"){var c=s;if(s=c(),ba){wn(!0);try{c()}finally{wn(!1)}}}return i.memoizedState=i.baseState=s,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:zs,lastRenderedState:s},i}function w0(s,i,c,h){return s.baseState=c,qf(s,Ot,typeof h=="function"?h:zs)}function Uj(s,i,c,h,g){if(Vu(s))throw Error(r(485));if(s=i.action,s!==null){var v={payload:g,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(S){v.listeners.push(S)}};P.T!==null?c(!0):v.isTransition=!1,h(v),c=i.pending,c===null?(v.next=i.pending=v,k0(i,v)):(v.next=c.next,i.pending=c.next=v)}}function k0(s,i){var c=i.action,h=i.payload,g=s.state;if(i.isTransition){var v=P.T,S={};P.T=S;try{var A=c(g,h),F=P.S;F!==null&&F(S,A),S0(s,i,A)}catch(ee){Yf(s,i,ee)}finally{v!==null&&S.types!==null&&(v.types=S.types),P.T=v}}else try{v=c(g,h),S0(s,i,v)}catch(ee){Yf(s,i,ee)}}function S0(s,i,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(h){j0(s,i,h)},function(h){return Yf(s,i,h)}):j0(s,i,c)}function j0(s,i,c){i.status="fulfilled",i.value=c,N0(i),s.state=c,i=s.pending,i!==null&&(c=i.next,c===i?s.pending=null:(c=c.next,i.next=c,k0(s,c)))}function Yf(s,i,c){var h=s.pending;if(s.pending=null,h!==null){h=h.next;do i.status="rejected",i.reason=c,N0(i),i=i.next;while(i!==h)}s.action=null}function N0(s){s=s.listeners;for(var i=0;i<s.length;i++)(0,s[i])()}function C0(s,i){return i}function E0(s,i){if(bt){var c=Ut.formState;if(c!==null){e:{var h=et;if(bt){if(Yt){t:{for(var g=Yt,v=Fr;g.nodeType!==8;){if(!v){g=null;break t}if(g=Ir(g.nextSibling),g===null){g=null;break t}}v=g.data,g=v==="F!"||v==="F"?g:null}if(g){Yt=Ir(g.nextSibling),h=g.data==="F!";break e}}vi(h)}h=!1}h&&(i=c[0])}}return c=Xn(),c.memoizedState=c.baseState=i,h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:C0,lastRenderedState:i},c.queue=h,c=Y0.bind(null,et,h),h.dispatch=c,h=Gf(!1),v=Jf.bind(null,et,!1,h.queue),h=Xn(),g={state:i,dispatch:null,action:s,pending:null},h.queue=g,c=Uj.bind(null,et,g,v,c),g.dispatch=c,h.memoizedState=s,[i,c,!1]}function A0(s){var i=hn();return T0(i,Ot,s)}function T0(s,i,c){if(i=qf(s,i,C0)[0],s=Iu(zs)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var h=Bo(i)}catch(S){throw S===cl?Ru:S}else h=i;i=hn();var g=i.queue,v=g.dispatch;return c!==i.memoizedState&&(et.flags|=2048,pl(9,{destroy:void 0},Ij.bind(null,g,c),null)),[h,v,s]}function Ij(s,i){s.action=i}function M0(s){var i=hn(),c=Ot;if(c!==null)return T0(i,c,s);hn(),i=i.memoizedState,c=hn();var h=c.queue.dispatch;return c.memoizedState=s,[i,h,!1]}function pl(s,i,c,h){return s={tag:s,create:c,deps:h,inst:i,next:null},i=et.updateQueue,i===null&&(i=Fu(),et.updateQueue=i),c=i.lastEffect,c===null?i.lastEffect=s.next=s:(h=c.next,c.next=s,s.next=h,i.lastEffect=s),s}function R0(){return hn().memoizedState}function Hu(s,i,c,h){var g=Xn();et.flags|=s,g.memoizedState=pl(1|i,{destroy:void 0},c,h===void 0?null:h)}function qu(s,i,c,h){var g=hn();h=h===void 0?null:h;var v=g.memoizedState.inst;Ot!==null&&h!==null&&Pf(h,Ot.memoizedState.deps)?g.memoizedState=pl(i,v,c,h):(et.flags|=s,g.memoizedState=pl(1|i,v,c,h))}function D0(s,i){Hu(8390656,8,s,i)}function Wf(s,i){qu(2048,8,s,i)}function Hj(s){et.flags|=4;var i=et.updateQueue;if(i===null)i=Fu(),et.updateQueue=i,i.events=[s];else{var c=i.events;c===null?i.events=[s]:c.push(s)}}function L0(s){var i=hn().memoizedState;return Hj({ref:i,nextImpl:s}),function(){if((Ct&2)!==0)throw Error(r(440));return i.impl.apply(void 0,arguments)}}function O0(s,i){return qu(4,2,s,i)}function z0(s,i){return qu(4,4,s,i)}function B0(s,i){if(typeof i=="function"){s=s();var c=i(s);return function(){typeof c=="function"?c():i(null)}}if(i!=null)return s=s(),i.current=s,function(){i.current=null}}function P0(s,i,c){c=c!=null?c.concat([s]):null,qu(4,4,B0.bind(null,i,s),c)}function Qf(){}function $0(s,i){var c=hn();i=i===void 0?null:i;var h=c.memoizedState;return i!==null&&Pf(i,h[1])?h[0]:(c.memoizedState=[s,i],s)}function F0(s,i){var c=hn();i=i===void 0?null:i;var h=c.memoizedState;if(i!==null&&Pf(i,h[1]))return h[0];if(h=s(),ba){wn(!0);try{s()}finally{wn(!1)}}return c.memoizedState=[h,i],h}function Xf(s,i,c){return c===void 0||(Os&1073741824)!==0&&(xt&261930)===0?s.memoizedState=i:(s.memoizedState=c,s=U1(),et.lanes|=s,Ci|=s,c)}function U0(s,i,c,h){return mr(c,i)?c:dl.current!==null?(s=Xf(s,c,h),mr(s,i)||(gn=!0),s):(Os&42)===0||(Os&1073741824)!==0&&(xt&261930)===0?(gn=!0,s.memoizedState=c):(s=U1(),et.lanes|=s,Ci|=s,i)}function I0(s,i,c,h,g){var v=$.p;$.p=v!==0&&8>v?v:8;var S=P.T,A={};P.T=A,Jf(s,!1,i,c);try{var F=g(),ee=P.S;if(ee!==null&&ee(A,F),F!==null&&typeof F=="object"&&typeof F.then=="function"){var ue=Pj(F,h);Po(s,i,ue,_r(s))}else Po(s,i,h,_r(s))}catch(fe){Po(s,i,{then:function(){},status:"rejected",reason:fe},_r())}finally{$.p=v,S!==null&&A.types!==null&&(S.types=A.types),P.T=S}}function qj(){}function Kf(s,i,c,h){if(s.tag!==5)throw Error(r(476));var g=H0(s).queue;I0(s,g,i,re,c===null?qj:function(){return q0(s),c(h)})}function H0(s){var i=s.memoizedState;if(i!==null)return i;i={memoizedState:re,baseState:re,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:zs,lastRenderedState:re},next:null};var c={};return i.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:zs,lastRenderedState:c},next:null},s.memoizedState=i,s=s.alternate,s!==null&&(s.memoizedState=i),i}function q0(s){var i=H0(s);i.next===null&&(i=s.alternate.memoizedState),Po(s,i.next.queue,{},_r())}function Zf(){return Rn(tc)}function V0(){return hn().memoizedState}function G0(){return hn().memoizedState}function Vj(s){for(var i=s.return;i!==null;){switch(i.tag){case 24:case 3:var c=_r();s=_i(c);var h=wi(i,s,c);h!==null&&(ar(h,i,c),Do(h,i,c)),i={cache:Cf()},s.payload=i;return}i=i.return}}function Gj(s,i,c){var h=_r();c={lane:h,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Vu(s)?W0(i,c):(c=gf(s,i,c,h),c!==null&&(ar(c,s,h),Q0(c,i,h)))}function Y0(s,i,c){var h=_r();Po(s,i,c,h)}function Po(s,i,c,h){var g={lane:h,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(Vu(s))W0(i,g);else{var v=s.alternate;if(s.lanes===0&&(v===null||v.lanes===0)&&(v=i.lastRenderedReducer,v!==null))try{var S=i.lastRenderedState,A=v(S,c);if(g.hasEagerState=!0,g.eagerState=A,mr(A,S))return ju(s,i,g,0),Ut===null&&Su(),!1}catch{}finally{}if(c=gf(s,i,g,h),c!==null)return ar(c,s,h),Q0(c,i,h),!0}return!1}function Jf(s,i,c,h){if(h={lane:2,revertLane:Mp(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},Vu(s)){if(i)throw Error(r(479))}else i=gf(s,c,h,2),i!==null&&ar(i,s,2)}function Vu(s){var i=s.alternate;return s===et||i!==null&&i===et}function W0(s,i){hl=Pu=!0;var c=s.pending;c===null?i.next=i:(i.next=c.next,c.next=i),s.pending=i}function Q0(s,i,c){if((c&4194048)!==0){var h=i.lanes;h&=s.pendingLanes,c|=h,i.lanes=c,Ua(s,c)}}var $o={readContext:Rn,use:Uu,useCallback:ln,useContext:ln,useEffect:ln,useImperativeHandle:ln,useLayoutEffect:ln,useInsertionEffect:ln,useMemo:ln,useReducer:ln,useRef:ln,useState:ln,useDebugValue:ln,useDeferredValue:ln,useTransition:ln,useSyncExternalStore:ln,useId:ln,useHostTransitionStatus:ln,useFormState:ln,useActionState:ln,useOptimistic:ln,useMemoCache:ln,useCacheRefresh:ln};$o.useEffectEvent=ln;var X0={readContext:Rn,use:Uu,useCallback:function(s,i){return Xn().memoizedState=[s,i===void 0?null:i],s},useContext:Rn,useEffect:D0,useImperativeHandle:function(s,i,c){c=c!=null?c.concat([s]):null,Hu(4194308,4,B0.bind(null,i,s),c)},useLayoutEffect:function(s,i){return Hu(4194308,4,s,i)},useInsertionEffect:function(s,i){Hu(4,2,s,i)},useMemo:function(s,i){var c=Xn();i=i===void 0?null:i;var h=s();if(ba){wn(!0);try{s()}finally{wn(!1)}}return c.memoizedState=[h,i],h},useReducer:function(s,i,c){var h=Xn();if(c!==void 0){var g=c(i);if(ba){wn(!0);try{c(i)}finally{wn(!1)}}}else g=i;return h.memoizedState=h.baseState=g,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:g},h.queue=s,s=s.dispatch=Gj.bind(null,et,s),[h.memoizedState,s]},useRef:function(s){var i=Xn();return s={current:s},i.memoizedState=s},useState:function(s){s=Gf(s);var i=s.queue,c=Y0.bind(null,et,i);return i.dispatch=c,[s.memoizedState,c]},useDebugValue:Qf,useDeferredValue:function(s,i){var c=Xn();return Xf(c,s,i)},useTransition:function(){var s=Gf(!1);return s=I0.bind(null,et,s.queue,!0,!1),Xn().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,i,c){var h=et,g=Xn();if(bt){if(c===void 0)throw Error(r(407));c=c()}else{if(c=i(),Ut===null)throw Error(r(349));(xt&127)!==0||x0(h,i,c)}g.memoizedState=c;var v={value:c,getSnapshot:i};return g.queue=v,D0(b0.bind(null,h,v,s),[s]),h.flags|=2048,pl(9,{destroy:void 0},v0.bind(null,h,v,c,i),null),c},useId:function(){var s=Xn(),i=Ut.identifierPrefix;if(bt){var c=gs,h=ms;c=(h&~(1<<32-st(h)-1)).toString(32)+c,i="_"+i+"R_"+c,c=$u++,0<c&&(i+="H"+c.toString(32)),i+="_"}else c=$j++,i="_"+i+"r_"+c.toString(32)+"_";return s.memoizedState=i},useHostTransitionStatus:Zf,useFormState:E0,useActionState:E0,useOptimistic:function(s){var i=Xn();i.memoizedState=i.baseState=s;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=c,i=Jf.bind(null,et,!0,c),c.dispatch=i,[s,i]},useMemoCache:Hf,useCacheRefresh:function(){return Xn().memoizedState=Vj.bind(null,et)},useEffectEvent:function(s){var i=Xn(),c={impl:s};return i.memoizedState=c,function(){if((Ct&2)!==0)throw Error(r(440));return c.impl.apply(void 0,arguments)}}},ep={readContext:Rn,use:Uu,useCallback:$0,useContext:Rn,useEffect:Wf,useImperativeHandle:P0,useInsertionEffect:O0,useLayoutEffect:z0,useMemo:F0,useReducer:Iu,useRef:R0,useState:function(){return Iu(zs)},useDebugValue:Qf,useDeferredValue:function(s,i){var c=hn();return U0(c,Ot.memoizedState,s,i)},useTransition:function(){var s=Iu(zs)[0],i=hn().memoizedState;return[typeof s=="boolean"?s:Bo(s),i]},useSyncExternalStore:g0,useId:V0,useHostTransitionStatus:Zf,useFormState:A0,useActionState:A0,useOptimistic:function(s,i){var c=hn();return w0(c,Ot,s,i)},useMemoCache:Hf,useCacheRefresh:G0};ep.useEffectEvent=L0;var K0={readContext:Rn,use:Uu,useCallback:$0,useContext:Rn,useEffect:Wf,useImperativeHandle:P0,useInsertionEffect:O0,useLayoutEffect:z0,useMemo:F0,useReducer:Vf,useRef:R0,useState:function(){return Vf(zs)},useDebugValue:Qf,useDeferredValue:function(s,i){var c=hn();return Ot===null?Xf(c,s,i):U0(c,Ot.memoizedState,s,i)},useTransition:function(){var s=Vf(zs)[0],i=hn().memoizedState;return[typeof s=="boolean"?s:Bo(s),i]},useSyncExternalStore:g0,useId:V0,useHostTransitionStatus:Zf,useFormState:M0,useActionState:M0,useOptimistic:function(s,i){var c=hn();return Ot!==null?w0(c,Ot,s,i):(c.baseState=s,[s,c.queue.dispatch])},useMemoCache:Hf,useCacheRefresh:G0};K0.useEffectEvent=L0;function tp(s,i,c,h){i=s.memoizedState,c=c(h,i),c=c==null?i:x({},i,c),s.memoizedState=c,s.lanes===0&&(s.updateQueue.baseState=c)}var np={enqueueSetState:function(s,i,c){s=s._reactInternals;var h=_r(),g=_i(h);g.payload=i,c!=null&&(g.callback=c),i=wi(s,g,h),i!==null&&(ar(i,s,h),Do(i,s,h))},enqueueReplaceState:function(s,i,c){s=s._reactInternals;var h=_r(),g=_i(h);g.tag=1,g.payload=i,c!=null&&(g.callback=c),i=wi(s,g,h),i!==null&&(ar(i,s,h),Do(i,s,h))},enqueueForceUpdate:function(s,i){s=s._reactInternals;var c=_r(),h=_i(c);h.tag=2,i!=null&&(h.callback=i),i=wi(s,h,c),i!==null&&(ar(i,s,c),Do(i,s,c))}};function Z0(s,i,c,h,g,v,S){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(h,v,S):i.prototype&&i.prototype.isPureReactComponent?!jo(c,h)||!jo(g,v):!0}function J0(s,i,c,h){s=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(c,h),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(c,h),i.state!==s&&np.enqueueReplaceState(i,i.state,null)}function ya(s,i){var c=i;if("ref"in i){c={};for(var h in i)h!=="ref"&&(c[h]=i[h])}if(s=s.defaultProps){c===i&&(c=x({},c));for(var g in s)c[g]===void 0&&(c[g]=s[g])}return c}function e1(s){ku(s)}function t1(s){console.error(s)}function n1(s){ku(s)}function Gu(s,i){try{var c=s.onUncaughtError;c(i.value,{componentStack:i.stack})}catch(h){setTimeout(function(){throw h})}}function r1(s,i,c){try{var h=s.onCaughtError;h(c.value,{componentStack:c.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(g){setTimeout(function(){throw g})}}function rp(s,i,c){return c=_i(c),c.tag=3,c.payload={element:null},c.callback=function(){Gu(s,i)},c}function s1(s){return s=_i(s),s.tag=3,s}function i1(s,i,c,h){var g=c.type.getDerivedStateFromError;if(typeof g=="function"){var v=h.value;s.payload=function(){return g(v)},s.callback=function(){r1(i,c,h)}}var S=c.stateNode;S!==null&&typeof S.componentDidCatch=="function"&&(s.callback=function(){r1(i,c,h),typeof g!="function"&&(Ei===null?Ei=new Set([this]):Ei.add(this));var A=h.stack;this.componentDidCatch(h.value,{componentStack:A!==null?A:""})})}function Yj(s,i,c,h,g){if(c.flags|=32768,h!==null&&typeof h=="object"&&typeof h.then=="function"){if(i=c.alternate,i!==null&&al(i,c,g,!0),c=xr.current,c!==null){switch(c.tag){case 31:case 13:return Ur===null?sd():c.alternate===null&&on===0&&(on=3),c.flags&=-257,c.flags|=65536,c.lanes=g,h===Du?c.flags|=16384:(i=c.updateQueue,i===null?c.updateQueue=new Set([h]):i.add(h),Ep(s,h,g)),!1;case 22:return c.flags|=65536,h===Du?c.flags|=16384:(i=c.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([h])},c.updateQueue=i):(c=i.retryQueue,c===null?i.retryQueue=new Set([h]):c.add(h)),Ep(s,h,g)),!1}throw Error(r(435,c.tag))}return Ep(s,h,g),sd(),!1}if(bt)return i=xr.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=g,h!==wf&&(s=Error(r(422),{cause:h}),Eo(Br(s,c)))):(h!==wf&&(i=Error(r(423),{cause:h}),Eo(Br(i,c))),s=s.current.alternate,s.flags|=65536,g&=-g,s.lanes|=g,h=Br(h,c),g=rp(s.stateNode,h,g),Df(s,g),on!==4&&(on=2)),!1;var v=Error(r(520),{cause:h});if(v=Br(v,c),Yo===null?Yo=[v]:Yo.push(v),on!==4&&(on=2),i===null)return!0;h=Br(h,c),c=i;do{switch(c.tag){case 3:return c.flags|=65536,s=g&-g,c.lanes|=s,s=rp(c.stateNode,h,s),Df(c,s),!1;case 1:if(i=c.type,v=c.stateNode,(c.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(Ei===null||!Ei.has(v))))return c.flags|=65536,g&=-g,c.lanes|=g,g=s1(g),i1(g,s,c,h),Df(c,g),!1}c=c.return}while(c!==null);return!1}var sp=Error(r(461)),gn=!1;function Dn(s,i,c,h){i.child=s===null?c0(i,null,c,h):va(i,s.child,c,h)}function a1(s,i,c,h,g){c=c.render;var v=i.ref;if("ref"in h){var S={};for(var A in h)A!=="ref"&&(S[A]=h[A])}else S=h;return pa(i),h=$f(s,i,c,S,v,g),A=Ff(),s!==null&&!gn?(Uf(s,i,g),Bs(s,i,g)):(bt&&A&&yf(i),i.flags|=1,Dn(s,i,h,g),i.child)}function l1(s,i,c,h,g){if(s===null){var v=c.type;return typeof v=="function"&&!xf(v)&&v.defaultProps===void 0&&c.compare===null?(i.tag=15,i.type=v,o1(s,i,v,h,g)):(s=Cu(c.type,null,h,i,i.mode,g),s.ref=i.ref,s.return=i,i.child=s)}if(v=s.child,!hp(s,g)){var S=v.memoizedProps;if(c=c.compare,c=c!==null?c:jo,c(S,h)&&s.ref===i.ref)return Bs(s,i,g)}return i.flags|=1,s=Ms(v,h),s.ref=i.ref,s.return=i,i.child=s}function o1(s,i,c,h,g){if(s!==null){var v=s.memoizedProps;if(jo(v,h)&&s.ref===i.ref)if(gn=!1,i.pendingProps=h=v,hp(s,g))(s.flags&131072)!==0&&(gn=!0);else return i.lanes=s.lanes,Bs(s,i,g)}return ip(s,i,c,h,g)}function c1(s,i,c,h){var g=h.children,v=s!==null?s.memoizedState:null;if(s===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),h.mode==="hidden"){if((i.flags&128)!==0){if(v=v!==null?v.baseLanes|c:c,s!==null){for(h=i.child=s.child,g=0;h!==null;)g=g|h.lanes|h.childLanes,h=h.sibling;h=g&~v}else h=0,i.child=null;return u1(s,i,v,c,h)}if((c&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},s!==null&&Mu(i,v!==null?v.cachePool:null),v!==null?h0(i,v):Of(),f0(i);else return h=i.lanes=536870912,u1(s,i,v!==null?v.baseLanes|c:c,c,h)}else v!==null?(Mu(i,v.cachePool),h0(i,v),Si(),i.memoizedState=null):(s!==null&&Mu(i,null),Of(),Si());return Dn(s,i,g,c),i.child}function Fo(s,i){return s!==null&&s.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function u1(s,i,c,h,g){var v=Af();return v=v===null?null:{parent:pn._currentValue,pool:v},i.memoizedState={baseLanes:c,cachePool:v},s!==null&&Mu(i,null),Of(),f0(i),s!==null&&al(s,i,h,!0),i.childLanes=g,null}function Yu(s,i){return i=Qu({mode:i.mode,children:i.children},s.mode),i.ref=s.ref,s.child=i,i.return=s,i}function d1(s,i,c){return va(i,s.child,null,c),s=Yu(i,i.pendingProps),s.flags|=2,vr(i),i.memoizedState=null,s}function Wj(s,i,c){var h=i.pendingProps,g=(i.flags&128)!==0;if(i.flags&=-129,s===null){if(bt){if(h.mode==="hidden")return s=Yu(i,h),i.lanes=536870912,Fo(null,s);if(Bf(i),(s=Yt)?(s=kb(s,Fr),s=s!==null&&s.data==="&"?s:null,s!==null&&(i.memoizedState={dehydrated:s,treeContext:gi!==null?{id:ms,overflow:gs}:null,retryLane:536870912,hydrationErrors:null},c=Wv(s),c.return=i,i.child=c,Mn=i,Yt=null)):s=null,s===null)throw vi(i);return i.lanes=536870912,null}return Yu(i,h)}var v=s.memoizedState;if(v!==null){var S=v.dehydrated;if(Bf(i),g)if(i.flags&256)i.flags&=-257,i=d1(s,i,c);else if(i.memoizedState!==null)i.child=s.child,i.flags|=128,i=null;else throw Error(r(558));else if(gn||al(s,i,c,!1),g=(c&s.childLanes)!==0,gn||g){if(h=Ut,h!==null&&(S=uo(h,c),S!==0&&S!==v.retryLane))throw v.retryLane=S,ua(s,S),ar(h,s,S),sp;sd(),i=d1(s,i,c)}else s=v.treeContext,Yt=Ir(S.nextSibling),Mn=i,bt=!0,xi=null,Fr=!1,s!==null&&Kv(i,s),i=Yu(i,h),i.flags|=4096;return i}return s=Ms(s.child,{mode:h.mode,children:h.children}),s.ref=i.ref,i.child=s,s.return=i,s}function Wu(s,i){var c=i.ref;if(c===null)s!==null&&s.ref!==null&&(i.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(r(284));(s===null||s.ref!==c)&&(i.flags|=4194816)}}function ip(s,i,c,h,g){return pa(i),c=$f(s,i,c,h,void 0,g),h=Ff(),s!==null&&!gn?(Uf(s,i,g),Bs(s,i,g)):(bt&&h&&yf(i),i.flags|=1,Dn(s,i,c,g),i.child)}function h1(s,i,c,h,g,v){return pa(i),i.updateQueue=null,c=m0(i,h,c,g),p0(s),h=Ff(),s!==null&&!gn?(Uf(s,i,v),Bs(s,i,v)):(bt&&h&&yf(i),i.flags|=1,Dn(s,i,c,v),i.child)}function f1(s,i,c,h,g){if(pa(i),i.stateNode===null){var v=nl,S=c.contextType;typeof S=="object"&&S!==null&&(v=Rn(S)),v=new c(h,v),i.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,v.updater=np,i.stateNode=v,v._reactInternals=i,v=i.stateNode,v.props=h,v.state=i.memoizedState,v.refs={},Mf(i),S=c.contextType,v.context=typeof S=="object"&&S!==null?Rn(S):nl,v.state=i.memoizedState,S=c.getDerivedStateFromProps,typeof S=="function"&&(tp(i,c,S,h),v.state=i.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(S=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),S!==v.state&&np.enqueueReplaceState(v,v.state,null),Oo(i,h,v,g),Lo(),v.state=i.memoizedState),typeof v.componentDidMount=="function"&&(i.flags|=4194308),h=!0}else if(s===null){v=i.stateNode;var A=i.memoizedProps,F=ya(c,A);v.props=F;var ee=v.context,ue=c.contextType;S=nl,typeof ue=="object"&&ue!==null&&(S=Rn(ue));var fe=c.getDerivedStateFromProps;ue=typeof fe=="function"||typeof v.getSnapshotBeforeUpdate=="function",A=i.pendingProps!==A,ue||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(A||ee!==S)&&J0(i,v,h,S),yi=!1;var se=i.memoizedState;v.state=se,Oo(i,h,v,g),Lo(),ee=i.memoizedState,A||se!==ee||yi?(typeof fe=="function"&&(tp(i,c,fe,h),ee=i.memoizedState),(F=yi||Z0(i,c,F,h,se,ee,S))?(ue||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount()),typeof v.componentDidMount=="function"&&(i.flags|=4194308)):(typeof v.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=h,i.memoizedState=ee),v.props=h,v.state=ee,v.context=S,h=F):(typeof v.componentDidMount=="function"&&(i.flags|=4194308),h=!1)}else{v=i.stateNode,Rf(s,i),S=i.memoizedProps,ue=ya(c,S),v.props=ue,fe=i.pendingProps,se=v.context,ee=c.contextType,F=nl,typeof ee=="object"&&ee!==null&&(F=Rn(ee)),A=c.getDerivedStateFromProps,(ee=typeof A=="function"||typeof v.getSnapshotBeforeUpdate=="function")||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(S!==fe||se!==F)&&J0(i,v,h,F),yi=!1,se=i.memoizedState,v.state=se,Oo(i,h,v,g),Lo();var le=i.memoizedState;S!==fe||se!==le||yi||s!==null&&s.dependencies!==null&&Au(s.dependencies)?(typeof A=="function"&&(tp(i,c,A,h),le=i.memoizedState),(ue=yi||Z0(i,c,ue,h,se,le,F)||s!==null&&s.dependencies!==null&&Au(s.dependencies))?(ee||typeof v.UNSAFE_componentWillUpdate!="function"&&typeof v.componentWillUpdate!="function"||(typeof v.componentWillUpdate=="function"&&v.componentWillUpdate(h,le,F),typeof v.UNSAFE_componentWillUpdate=="function"&&v.UNSAFE_componentWillUpdate(h,le,F)),typeof v.componentDidUpdate=="function"&&(i.flags|=4),typeof v.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof v.componentDidUpdate!="function"||S===s.memoizedProps&&se===s.memoizedState||(i.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||S===s.memoizedProps&&se===s.memoizedState||(i.flags|=1024),i.memoizedProps=h,i.memoizedState=le),v.props=h,v.state=le,v.context=F,h=ue):(typeof v.componentDidUpdate!="function"||S===s.memoizedProps&&se===s.memoizedState||(i.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||S===s.memoizedProps&&se===s.memoizedState||(i.flags|=1024),h=!1)}return v=h,Wu(s,i),h=(i.flags&128)!==0,v||h?(v=i.stateNode,c=h&&typeof c.getDerivedStateFromError!="function"?null:v.render(),i.flags|=1,s!==null&&h?(i.child=va(i,s.child,null,g),i.child=va(i,null,c,g)):Dn(s,i,c,g),i.memoizedState=v.state,s=i.child):s=Bs(s,i,g),s}function p1(s,i,c,h){return ha(),i.flags|=256,Dn(s,i,c,h),i.child}var ap={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function lp(s){return{baseLanes:s,cachePool:r0()}}function op(s,i,c){return s=s!==null?s.childLanes&~c:0,i&&(s|=yr),s}function m1(s,i,c){var h=i.pendingProps,g=!1,v=(i.flags&128)!==0,S;if((S=v)||(S=s!==null&&s.memoizedState===null?!1:(dn.current&2)!==0),S&&(g=!0,i.flags&=-129),S=(i.flags&32)!==0,i.flags&=-33,s===null){if(bt){if(g?ki(i):Si(),(s=Yt)?(s=kb(s,Fr),s=s!==null&&s.data!=="&"?s:null,s!==null&&(i.memoizedState={dehydrated:s,treeContext:gi!==null?{id:ms,overflow:gs}:null,retryLane:536870912,hydrationErrors:null},c=Wv(s),c.return=i,i.child=c,Mn=i,Yt=null)):s=null,s===null)throw vi(i);return qp(s)?i.lanes=32:i.lanes=536870912,null}var A=h.children;return h=h.fallback,g?(Si(),g=i.mode,A=Qu({mode:"hidden",children:A},g),h=da(h,g,c,null),A.return=i,h.return=i,A.sibling=h,i.child=A,h=i.child,h.memoizedState=lp(c),h.childLanes=op(s,S,c),i.memoizedState=ap,Fo(null,h)):(ki(i),cp(i,A))}var F=s.memoizedState;if(F!==null&&(A=F.dehydrated,A!==null)){if(v)i.flags&256?(ki(i),i.flags&=-257,i=up(s,i,c)):i.memoizedState!==null?(Si(),i.child=s.child,i.flags|=128,i=null):(Si(),A=h.fallback,g=i.mode,h=Qu({mode:"visible",children:h.children},g),A=da(A,g,c,null),A.flags|=2,h.return=i,A.return=i,h.sibling=A,i.child=h,va(i,s.child,null,c),h=i.child,h.memoizedState=lp(c),h.childLanes=op(s,S,c),i.memoizedState=ap,i=Fo(null,h));else if(ki(i),qp(A)){if(S=A.nextSibling&&A.nextSibling.dataset,S)var ee=S.dgst;S=ee,h=Error(r(419)),h.stack="",h.digest=S,Eo({value:h,source:null,stack:null}),i=up(s,i,c)}else if(gn||al(s,i,c,!1),S=(c&s.childLanes)!==0,gn||S){if(S=Ut,S!==null&&(h=uo(S,c),h!==0&&h!==F.retryLane))throw F.retryLane=h,ua(s,h),ar(S,s,h),sp;Hp(A)||sd(),i=up(s,i,c)}else Hp(A)?(i.flags|=192,i.child=s.child,i=null):(s=F.treeContext,Yt=Ir(A.nextSibling),Mn=i,bt=!0,xi=null,Fr=!1,s!==null&&Kv(i,s),i=cp(i,h.children),i.flags|=4096);return i}return g?(Si(),A=h.fallback,g=i.mode,F=s.child,ee=F.sibling,h=Ms(F,{mode:"hidden",children:h.children}),h.subtreeFlags=F.subtreeFlags&65011712,ee!==null?A=Ms(ee,A):(A=da(A,g,c,null),A.flags|=2),A.return=i,h.return=i,h.sibling=A,i.child=h,Fo(null,h),h=i.child,A=s.child.memoizedState,A===null?A=lp(c):(g=A.cachePool,g!==null?(F=pn._currentValue,g=g.parent!==F?{parent:F,pool:F}:g):g=r0(),A={baseLanes:A.baseLanes|c,cachePool:g}),h.memoizedState=A,h.childLanes=op(s,S,c),i.memoizedState=ap,Fo(s.child,h)):(ki(i),c=s.child,s=c.sibling,c=Ms(c,{mode:"visible",children:h.children}),c.return=i,c.sibling=null,s!==null&&(S=i.deletions,S===null?(i.deletions=[s],i.flags|=16):S.push(s)),i.child=c,i.memoizedState=null,c)}function cp(s,i){return i=Qu({mode:"visible",children:i},s.mode),i.return=s,s.child=i}function Qu(s,i){return s=gr(22,s,null,i),s.lanes=0,s}function up(s,i,c){return va(i,s.child,null,c),s=cp(i,i.pendingProps.children),s.flags|=2,i.memoizedState=null,s}function g1(s,i,c){s.lanes|=i;var h=s.alternate;h!==null&&(h.lanes|=i),jf(s.return,i,c)}function dp(s,i,c,h,g,v){var S=s.memoizedState;S===null?s.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:h,tail:c,tailMode:g,treeForkCount:v}:(S.isBackwards=i,S.rendering=null,S.renderingStartTime=0,S.last=h,S.tail=c,S.tailMode=g,S.treeForkCount=v)}function x1(s,i,c){var h=i.pendingProps,g=h.revealOrder,v=h.tail;h=h.children;var S=dn.current,A=(S&2)!==0;if(A?(S=S&1|2,i.flags|=128):S&=1,R(dn,S),Dn(s,i,h,c),h=bt?Co:0,!A&&s!==null&&(s.flags&128)!==0)e:for(s=i.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&g1(s,c,i);else if(s.tag===19)g1(s,c,i);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===i)break e;for(;s.sibling===null;){if(s.return===null||s.return===i)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(g){case"forwards":for(c=i.child,g=null;c!==null;)s=c.alternate,s!==null&&Bu(s)===null&&(g=c),c=c.sibling;c=g,c===null?(g=i.child,i.child=null):(g=c.sibling,c.sibling=null),dp(i,!1,g,c,v,h);break;case"backwards":case"unstable_legacy-backwards":for(c=null,g=i.child,i.child=null;g!==null;){if(s=g.alternate,s!==null&&Bu(s)===null){i.child=g;break}s=g.sibling,g.sibling=c,c=g,g=s}dp(i,!0,c,null,v,h);break;case"together":dp(i,!1,null,null,void 0,h);break;default:i.memoizedState=null}return i.child}function Bs(s,i,c){if(s!==null&&(i.dependencies=s.dependencies),Ci|=i.lanes,(c&i.childLanes)===0)if(s!==null){if(al(s,i,c,!1),(c&i.childLanes)===0)return null}else return null;if(s!==null&&i.child!==s.child)throw Error(r(153));if(i.child!==null){for(s=i.child,c=Ms(s,s.pendingProps),i.child=c,c.return=i;s.sibling!==null;)s=s.sibling,c=c.sibling=Ms(s,s.pendingProps),c.return=i;c.sibling=null}return i.child}function hp(s,i){return(s.lanes&i)!==0?!0:(s=s.dependencies,!!(s!==null&&Au(s)))}function Qj(s,i,c){switch(i.tag){case 3:Ee(i,i.stateNode.containerInfo),bi(i,pn,s.memoizedState.cache),ha();break;case 27:case 5:Ue(i);break;case 4:Ee(i,i.stateNode.containerInfo);break;case 10:bi(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,Bf(i),null;break;case 13:var h=i.memoizedState;if(h!==null)return h.dehydrated!==null?(ki(i),i.flags|=128,null):(c&i.child.childLanes)!==0?m1(s,i,c):(ki(i),s=Bs(s,i,c),s!==null?s.sibling:null);ki(i);break;case 19:var g=(s.flags&128)!==0;if(h=(c&i.childLanes)!==0,h||(al(s,i,c,!1),h=(c&i.childLanes)!==0),g){if(h)return x1(s,i,c);i.flags|=128}if(g=i.memoizedState,g!==null&&(g.rendering=null,g.tail=null,g.lastEffect=null),R(dn,dn.current),h)break;return null;case 22:return i.lanes=0,c1(s,i,c,i.pendingProps);case 24:bi(i,pn,s.memoizedState.cache)}return Bs(s,i,c)}function v1(s,i,c){if(s!==null)if(s.memoizedProps!==i.pendingProps)gn=!0;else{if(!hp(s,c)&&(i.flags&128)===0)return gn=!1,Qj(s,i,c);gn=(s.flags&131072)!==0}else gn=!1,bt&&(i.flags&1048576)!==0&&Xv(i,Co,i.index);switch(i.lanes=0,i.tag){case 16:e:{var h=i.pendingProps;if(s=ga(i.elementType),i.type=s,typeof s=="function")xf(s)?(h=ya(s,h),i.tag=1,i=f1(null,i,s,h,c)):(i.tag=0,i=ip(null,i,s,h,c));else{if(s!=null){var g=s.$$typeof;if(g===T){i.tag=11,i=a1(null,i,s,h,c);break e}else if(g===I){i.tag=14,i=l1(null,i,s,h,c);break e}}throw i=X(s)||s,Error(r(306,i,""))}}return i;case 0:return ip(s,i,i.type,i.pendingProps,c);case 1:return h=i.type,g=ya(h,i.pendingProps),f1(s,i,h,g,c);case 3:e:{if(Ee(i,i.stateNode.containerInfo),s===null)throw Error(r(387));h=i.pendingProps;var v=i.memoizedState;g=v.element,Rf(s,i),Oo(i,h,null,c);var S=i.memoizedState;if(h=S.cache,bi(i,pn,h),h!==v.cache&&Nf(i,[pn],c,!0),Lo(),h=S.element,v.isDehydrated)if(v={element:h,isDehydrated:!1,cache:S.cache},i.updateQueue.baseState=v,i.memoizedState=v,i.flags&256){i=p1(s,i,h,c);break e}else if(h!==g){g=Br(Error(r(424)),i),Eo(g),i=p1(s,i,h,c);break e}else{switch(s=i.stateNode.containerInfo,s.nodeType){case 9:s=s.body;break;default:s=s.nodeName==="HTML"?s.ownerDocument.body:s}for(Yt=Ir(s.firstChild),Mn=i,bt=!0,xi=null,Fr=!0,c=c0(i,null,h,c),i.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling}else{if(ha(),h===g){i=Bs(s,i,c);break e}Dn(s,i,h,c)}i=i.child}return i;case 26:return Wu(s,i),s===null?(c=Ab(i.type,null,i.pendingProps,null))?i.memoizedState=c:bt||(c=i.type,s=i.pendingProps,h=dd(Ce.current).createElement(c),h[en]=i,h[Tn]=s,Ln(h,c,s),nn(h),i.stateNode=h):i.memoizedState=Ab(i.type,s.memoizedProps,i.pendingProps,s.memoizedState),null;case 27:return Ue(i),s===null&&bt&&(h=i.stateNode=Nb(i.type,i.pendingProps,Ce.current),Mn=i,Fr=!0,g=Yt,Ri(i.type)?(Vp=g,Yt=Ir(h.firstChild)):Yt=g),Dn(s,i,i.pendingProps.children,c),Wu(s,i),s===null&&(i.flags|=4194304),i.child;case 5:return s===null&&bt&&((g=h=Yt)&&(h=jN(h,i.type,i.pendingProps,Fr),h!==null?(i.stateNode=h,Mn=i,Yt=Ir(h.firstChild),Fr=!1,g=!0):g=!1),g||vi(i)),Ue(i),g=i.type,v=i.pendingProps,S=s!==null?s.memoizedProps:null,h=v.children,Fp(g,v)?h=null:S!==null&&Fp(g,S)&&(i.flags|=32),i.memoizedState!==null&&(g=$f(s,i,Fj,null,null,c),tc._currentValue=g),Wu(s,i),Dn(s,i,h,c),i.child;case 6:return s===null&&bt&&((s=c=Yt)&&(c=NN(c,i.pendingProps,Fr),c!==null?(i.stateNode=c,Mn=i,Yt=null,s=!0):s=!1),s||vi(i)),null;case 13:return m1(s,i,c);case 4:return Ee(i,i.stateNode.containerInfo),h=i.pendingProps,s===null?i.child=va(i,null,h,c):Dn(s,i,h,c),i.child;case 11:return a1(s,i,i.type,i.pendingProps,c);case 7:return Dn(s,i,i.pendingProps,c),i.child;case 8:return Dn(s,i,i.pendingProps.children,c),i.child;case 12:return Dn(s,i,i.pendingProps.children,c),i.child;case 10:return h=i.pendingProps,bi(i,i.type,h.value),Dn(s,i,h.children,c),i.child;case 9:return g=i.type._context,h=i.pendingProps.children,pa(i),g=Rn(g),h=h(g),i.flags|=1,Dn(s,i,h,c),i.child;case 14:return l1(s,i,i.type,i.pendingProps,c);case 15:return o1(s,i,i.type,i.pendingProps,c);case 19:return x1(s,i,c);case 31:return Wj(s,i,c);case 22:return c1(s,i,c,i.pendingProps);case 24:return pa(i),h=Rn(pn),s===null?(g=Af(),g===null&&(g=Ut,v=Cf(),g.pooledCache=v,v.refCount++,v!==null&&(g.pooledCacheLanes|=c),g=v),i.memoizedState={parent:h,cache:g},Mf(i),bi(i,pn,g)):((s.lanes&c)!==0&&(Rf(s,i),Oo(i,null,null,c),Lo()),g=s.memoizedState,v=i.memoizedState,g.parent!==h?(g={parent:h,cache:h},i.memoizedState=g,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=g),bi(i,pn,h)):(h=v.cache,bi(i,pn,h),h!==g.cache&&Nf(i,[pn],c,!0))),Dn(s,i,i.pendingProps.children,c),i.child;case 29:throw i.pendingProps}throw Error(r(156,i.tag))}function Ps(s){s.flags|=4}function fp(s,i,c,h,g){if((i=(s.mode&32)!==0)&&(i=!1),i){if(s.flags|=16777216,(g&335544128)===g)if(s.stateNode.complete)s.flags|=8192;else if(V1())s.flags|=8192;else throw xa=Du,Tf}else s.flags&=-16777217}function b1(s,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!Lb(i))if(V1())s.flags|=8192;else throw xa=Du,Tf}function Xu(s,i){i!==null&&(s.flags|=4),s.flags&16384&&(i=s.tag!==22?fn():536870912,s.lanes|=i,vl|=i)}function Uo(s,i){if(!bt)switch(s.tailMode){case"hidden":i=s.tail;for(var c=null;i!==null;)i.alternate!==null&&(c=i),i=i.sibling;c===null?s.tail=null:c.sibling=null;break;case"collapsed":c=s.tail;for(var h=null;c!==null;)c.alternate!==null&&(h=c),c=c.sibling;h===null?i||s.tail===null?s.tail=null:s.tail.sibling=null:h.sibling=null}}function Wt(s){var i=s.alternate!==null&&s.alternate.child===s.child,c=0,h=0;if(i)for(var g=s.child;g!==null;)c|=g.lanes|g.childLanes,h|=g.subtreeFlags&65011712,h|=g.flags&65011712,g.return=s,g=g.sibling;else for(g=s.child;g!==null;)c|=g.lanes|g.childLanes,h|=g.subtreeFlags,h|=g.flags,g.return=s,g=g.sibling;return s.subtreeFlags|=h,s.childLanes=c,i}function Xj(s,i,c){var h=i.pendingProps;switch(_f(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Wt(i),null;case 1:return Wt(i),null;case 3:return c=i.stateNode,h=null,s!==null&&(h=s.memoizedState.cache),i.memoizedState.cache!==h&&(i.flags|=2048),Ls(pn),Ae(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(s===null||s.child===null)&&(il(i)?Ps(i):s===null||s.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,kf())),Wt(i),null;case 26:var g=i.type,v=i.memoizedState;return s===null?(Ps(i),v!==null?(Wt(i),b1(i,v)):(Wt(i),fp(i,g,null,h,c))):v?v!==s.memoizedState?(Ps(i),Wt(i),b1(i,v)):(Wt(i),i.flags&=-16777217):(s=s.memoizedProps,s!==h&&Ps(i),Wt(i),fp(i,g,s,h,c)),null;case 27:if(dt(i),c=Ce.current,g=i.type,s!==null&&i.stateNode!=null)s.memoizedProps!==h&&Ps(i);else{if(!h){if(i.stateNode===null)throw Error(r(166));return Wt(i),null}s=me.current,il(i)?Zv(i):(s=Nb(g,h,c),i.stateNode=s,Ps(i))}return Wt(i),null;case 5:if(dt(i),g=i.type,s!==null&&i.stateNode!=null)s.memoizedProps!==h&&Ps(i);else{if(!h){if(i.stateNode===null)throw Error(r(166));return Wt(i),null}if(v=me.current,il(i))Zv(i);else{var S=dd(Ce.current);switch(v){case 1:v=S.createElementNS("http://www.w3.org/2000/svg",g);break;case 2:v=S.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;default:switch(g){case"svg":v=S.createElementNS("http://www.w3.org/2000/svg",g);break;case"math":v=S.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;case"script":v=S.createElement("div"),v.innerHTML="<script><\/script>",v=v.removeChild(v.firstChild);break;case"select":v=typeof h.is=="string"?S.createElement("select",{is:h.is}):S.createElement("select"),h.multiple?v.multiple=!0:h.size&&(v.size=h.size);break;default:v=typeof h.is=="string"?S.createElement(g,{is:h.is}):S.createElement(g)}}v[en]=i,v[Tn]=h;e:for(S=i.child;S!==null;){if(S.tag===5||S.tag===6)v.appendChild(S.stateNode);else if(S.tag!==4&&S.tag!==27&&S.child!==null){S.child.return=S,S=S.child;continue}if(S===i)break e;for(;S.sibling===null;){if(S.return===null||S.return===i)break e;S=S.return}S.sibling.return=S.return,S=S.sibling}i.stateNode=v;e:switch(Ln(v,g,h),g){case"button":case"input":case"select":case"textarea":h=!!h.autoFocus;break e;case"img":h=!0;break e;default:h=!1}h&&Ps(i)}}return Wt(i),fp(i,i.type,s===null?null:s.memoizedProps,i.pendingProps,c),null;case 6:if(s&&i.stateNode!=null)s.memoizedProps!==h&&Ps(i);else{if(typeof h!="string"&&i.stateNode===null)throw Error(r(166));if(s=Ce.current,il(i)){if(s=i.stateNode,c=i.memoizedProps,h=null,g=Mn,g!==null)switch(g.tag){case 27:case 5:h=g.memoizedProps}s[en]=i,s=!!(s.nodeValue===c||h!==null&&h.suppressHydrationWarning===!0||mb(s.nodeValue,c)),s||vi(i,!0)}else s=dd(s).createTextNode(h),s[en]=i,i.stateNode=s}return Wt(i),null;case 31:if(c=i.memoizedState,s===null||s.memoizedState!==null){if(h=il(i),c!==null){if(s===null){if(!h)throw Error(r(318));if(s=i.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(557));s[en]=i}else ha(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Wt(i),s=!1}else c=kf(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=c),s=!0;if(!s)return i.flags&256?(vr(i),i):(vr(i),null);if((i.flags&128)!==0)throw Error(r(558))}return Wt(i),null;case 13:if(h=i.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(g=il(i),h!==null&&h.dehydrated!==null){if(s===null){if(!g)throw Error(r(318));if(g=i.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(r(317));g[en]=i}else ha(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Wt(i),g=!1}else g=kf(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=g),g=!0;if(!g)return i.flags&256?(vr(i),i):(vr(i),null)}return vr(i),(i.flags&128)!==0?(i.lanes=c,i):(c=h!==null,s=s!==null&&s.memoizedState!==null,c&&(h=i.child,g=null,h.alternate!==null&&h.alternate.memoizedState!==null&&h.alternate.memoizedState.cachePool!==null&&(g=h.alternate.memoizedState.cachePool.pool),v=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(v=h.memoizedState.cachePool.pool),v!==g&&(h.flags|=2048)),c!==s&&c&&(i.child.flags|=8192),Xu(i,i.updateQueue),Wt(i),null);case 4:return Ae(),s===null&&Op(i.stateNode.containerInfo),Wt(i),null;case 10:return Ls(i.type),Wt(i),null;case 19:if(Q(dn),h=i.memoizedState,h===null)return Wt(i),null;if(g=(i.flags&128)!==0,v=h.rendering,v===null)if(g)Uo(h,!1);else{if(on!==0||s!==null&&(s.flags&128)!==0)for(s=i.child;s!==null;){if(v=Bu(s),v!==null){for(i.flags|=128,Uo(h,!1),s=v.updateQueue,i.updateQueue=s,Xu(i,s),i.subtreeFlags=0,s=c,c=i.child;c!==null;)Yv(c,s),c=c.sibling;return R(dn,dn.current&1|2),bt&&Rs(i,h.treeForkCount),i.child}s=s.sibling}h.tail!==null&&Te()>td&&(i.flags|=128,g=!0,Uo(h,!1),i.lanes=4194304)}else{if(!g)if(s=Bu(v),s!==null){if(i.flags|=128,g=!0,s=s.updateQueue,i.updateQueue=s,Xu(i,s),Uo(h,!0),h.tail===null&&h.tailMode==="hidden"&&!v.alternate&&!bt)return Wt(i),null}else 2*Te()-h.renderingStartTime>td&&c!==536870912&&(i.flags|=128,g=!0,Uo(h,!1),i.lanes=4194304);h.isBackwards?(v.sibling=i.child,i.child=v):(s=h.last,s!==null?s.sibling=v:i.child=v,h.last=v)}return h.tail!==null?(s=h.tail,h.rendering=s,h.tail=s.sibling,h.renderingStartTime=Te(),s.sibling=null,c=dn.current,R(dn,g?c&1|2:c&1),bt&&Rs(i,h.treeForkCount),s):(Wt(i),null);case 22:case 23:return vr(i),zf(),h=i.memoizedState!==null,s!==null?s.memoizedState!==null!==h&&(i.flags|=8192):h&&(i.flags|=8192),h?(c&536870912)!==0&&(i.flags&128)===0&&(Wt(i),i.subtreeFlags&6&&(i.flags|=8192)):Wt(i),c=i.updateQueue,c!==null&&Xu(i,c.retryQueue),c=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(c=s.memoizedState.cachePool.pool),h=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(h=i.memoizedState.cachePool.pool),h!==c&&(i.flags|=2048),s!==null&&Q(ma),null;case 24:return c=null,s!==null&&(c=s.memoizedState.cache),i.memoizedState.cache!==c&&(i.flags|=2048),Ls(pn),Wt(i),null;case 25:return null;case 30:return null}throw Error(r(156,i.tag))}function Kj(s,i){switch(_f(i),i.tag){case 1:return s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 3:return Ls(pn),Ae(),s=i.flags,(s&65536)!==0&&(s&128)===0?(i.flags=s&-65537|128,i):null;case 26:case 27:case 5:return dt(i),null;case 31:if(i.memoizedState!==null){if(vr(i),i.alternate===null)throw Error(r(340));ha()}return s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 13:if(vr(i),s=i.memoizedState,s!==null&&s.dehydrated!==null){if(i.alternate===null)throw Error(r(340));ha()}return s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 19:return Q(dn),null;case 4:return Ae(),null;case 10:return Ls(i.type),null;case 22:case 23:return vr(i),zf(),s!==null&&Q(ma),s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 24:return Ls(pn),null;case 25:return null;default:return null}}function y1(s,i){switch(_f(i),i.tag){case 3:Ls(pn),Ae();break;case 26:case 27:case 5:dt(i);break;case 4:Ae();break;case 31:i.memoizedState!==null&&vr(i);break;case 13:vr(i);break;case 19:Q(dn);break;case 10:Ls(i.type);break;case 22:case 23:vr(i),zf(),s!==null&&Q(ma);break;case 24:Ls(pn)}}function Io(s,i){try{var c=i.updateQueue,h=c!==null?c.lastEffect:null;if(h!==null){var g=h.next;c=g;do{if((c.tag&s)===s){h=void 0;var v=c.create,S=c.inst;h=v(),S.destroy=h}c=c.next}while(c!==g)}}catch(A){Mt(i,i.return,A)}}function ji(s,i,c){try{var h=i.updateQueue,g=h!==null?h.lastEffect:null;if(g!==null){var v=g.next;h=v;do{if((h.tag&s)===s){var S=h.inst,A=S.destroy;if(A!==void 0){S.destroy=void 0,g=i;var F=c,ee=A;try{ee()}catch(ue){Mt(g,F,ue)}}}h=h.next}while(h!==v)}}catch(ue){Mt(i,i.return,ue)}}function _1(s){var i=s.updateQueue;if(i!==null){var c=s.stateNode;try{d0(i,c)}catch(h){Mt(s,s.return,h)}}}function w1(s,i,c){c.props=ya(s.type,s.memoizedProps),c.state=s.memoizedState;try{c.componentWillUnmount()}catch(h){Mt(s,i,h)}}function Ho(s,i){try{var c=s.ref;if(c!==null){switch(s.tag){case 26:case 27:case 5:var h=s.stateNode;break;case 30:h=s.stateNode;break;default:h=s.stateNode}typeof c=="function"?s.refCleanup=c(h):c.current=h}}catch(g){Mt(s,i,g)}}function xs(s,i){var c=s.ref,h=s.refCleanup;if(c!==null)if(typeof h=="function")try{h()}catch(g){Mt(s,i,g)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(g){Mt(s,i,g)}else c.current=null}function k1(s){var i=s.type,c=s.memoizedProps,h=s.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":c.autoFocus&&h.focus();break e;case"img":c.src?h.src=c.src:c.srcSet&&(h.srcset=c.srcSet)}}catch(g){Mt(s,s.return,g)}}function pp(s,i,c){try{var h=s.stateNode;bN(h,s.type,c,i),h[Tn]=i}catch(g){Mt(s,s.return,g)}}function S1(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&Ri(s.type)||s.tag===4}function mp(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||S1(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&&Ri(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 gp(s,i,c){var h=s.tag;if(h===5||h===6)s=s.stateNode,i?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(s,i):(i=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,i.appendChild(s),c=c._reactRootContainer,c!=null||i.onclick!==null||(i.onclick=Dr));else if(h!==4&&(h===27&&Ri(s.type)&&(c=s.stateNode,i=null),s=s.child,s!==null))for(gp(s,i,c),s=s.sibling;s!==null;)gp(s,i,c),s=s.sibling}function Ku(s,i,c){var h=s.tag;if(h===5||h===6)s=s.stateNode,i?c.insertBefore(s,i):c.appendChild(s);else if(h!==4&&(h===27&&Ri(s.type)&&(c=s.stateNode),s=s.child,s!==null))for(Ku(s,i,c),s=s.sibling;s!==null;)Ku(s,i,c),s=s.sibling}function j1(s){var i=s.stateNode,c=s.memoizedProps;try{for(var h=s.type,g=i.attributes;g.length;)i.removeAttributeNode(g[0]);Ln(i,h,c),i[en]=s,i[Tn]=c}catch(v){Mt(s,s.return,v)}}var $s=!1,xn=!1,xp=!1,N1=typeof WeakSet=="function"?WeakSet:Set,Cn=null;function Zj(s,i){if(s=s.containerInfo,Pp=vd,s=Pv(s),uf(s)){if("selectionStart"in s)var c={start:s.selectionStart,end:s.selectionEnd};else e:{c=(c=s.ownerDocument)&&c.defaultView||window;var h=c.getSelection&&c.getSelection();if(h&&h.rangeCount!==0){c=h.anchorNode;var g=h.anchorOffset,v=h.focusNode;h=h.focusOffset;try{c.nodeType,v.nodeType}catch{c=null;break e}var S=0,A=-1,F=-1,ee=0,ue=0,fe=s,se=null;t:for(;;){for(var le;fe!==c||g!==0&&fe.nodeType!==3||(A=S+g),fe!==v||h!==0&&fe.nodeType!==3||(F=S+h),fe.nodeType===3&&(S+=fe.nodeValue.length),(le=fe.firstChild)!==null;)se=fe,fe=le;for(;;){if(fe===s)break t;if(se===c&&++ee===g&&(A=S),se===v&&++ue===h&&(F=S),(le=fe.nextSibling)!==null)break;fe=se,se=fe.parentNode}fe=le}c=A===-1||F===-1?null:{start:A,end:F}}else c=null}c=c||{start:0,end:0}}else c=null;for($p={focusedElem:s,selectionRange:c},vd=!1,Cn=i;Cn!==null;)if(i=Cn,s=i.child,(i.subtreeFlags&1028)!==0&&s!==null)s.return=i,Cn=s;else for(;Cn!==null;){switch(i=Cn,v=i.alternate,s=i.flags,i.tag){case 0:if((s&4)!==0&&(s=i.updateQueue,s=s!==null?s.events:null,s!==null))for(c=0;c<s.length;c++)g=s[c],g.ref.impl=g.nextImpl;break;case 11:case 15:break;case 1:if((s&1024)!==0&&v!==null){s=void 0,c=i,g=v.memoizedProps,v=v.memoizedState,h=c.stateNode;try{var Re=ya(c.type,g);s=h.getSnapshotBeforeUpdate(Re,v),h.__reactInternalSnapshotBeforeUpdate=s}catch(qe){Mt(c,c.return,qe)}}break;case 3:if((s&1024)!==0){if(s=i.stateNode.containerInfo,c=s.nodeType,c===9)Ip(s);else if(c===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":Ip(s);break;default:s.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((s&1024)!==0)throw Error(r(163))}if(s=i.sibling,s!==null){s.return=i.return,Cn=s;break}Cn=i.return}}function C1(s,i,c){var h=c.flags;switch(c.tag){case 0:case 11:case 15:Us(s,c),h&4&&Io(5,c);break;case 1:if(Us(s,c),h&4)if(s=c.stateNode,i===null)try{s.componentDidMount()}catch(S){Mt(c,c.return,S)}else{var g=ya(c.type,i.memoizedProps);i=i.memoizedState;try{s.componentDidUpdate(g,i,s.__reactInternalSnapshotBeforeUpdate)}catch(S){Mt(c,c.return,S)}}h&64&&_1(c),h&512&&Ho(c,c.return);break;case 3:if(Us(s,c),h&64&&(s=c.updateQueue,s!==null)){if(i=null,c.child!==null)switch(c.child.tag){case 27:case 5:i=c.child.stateNode;break;case 1:i=c.child.stateNode}try{d0(s,i)}catch(S){Mt(c,c.return,S)}}break;case 27:i===null&&h&4&&j1(c);case 26:case 5:Us(s,c),i===null&&h&4&&k1(c),h&512&&Ho(c,c.return);break;case 12:Us(s,c);break;case 31:Us(s,c),h&4&&T1(s,c);break;case 13:Us(s,c),h&4&&M1(s,c),h&64&&(s=c.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(c=lN.bind(null,c),CN(s,c))));break;case 22:if(h=c.memoizedState!==null||$s,!h){i=i!==null&&i.memoizedState!==null||xn,g=$s;var v=xn;$s=h,(xn=i)&&!v?Is(s,c,(c.subtreeFlags&8772)!==0):Us(s,c),$s=g,xn=v}break;case 30:break;default:Us(s,c)}}function E1(s){var i=s.alternate;i!==null&&(s.alternate=null,E1(i)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(i=s.stateNode,i!==null&&oi(i)),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 tn=null,nr=!1;function Fs(s,i,c){for(c=c.child;c!==null;)A1(s,i,c),c=c.sibling}function A1(s,i,c){if(Et&&typeof Et.onCommitFiberUnmount=="function")try{Et.onCommitFiberUnmount(ot,c)}catch{}switch(c.tag){case 26:xn||xs(c,i),Fs(s,i,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:xn||xs(c,i);var h=tn,g=nr;Ri(c.type)&&(tn=c.stateNode,nr=!1),Fs(s,i,c),Zo(c.stateNode),tn=h,nr=g;break;case 5:xn||xs(c,i);case 6:if(h=tn,g=nr,tn=null,Fs(s,i,c),tn=h,nr=g,tn!==null)if(nr)try{(tn.nodeType===9?tn.body:tn.nodeName==="HTML"?tn.ownerDocument.body:tn).removeChild(c.stateNode)}catch(v){Mt(c,i,v)}else try{tn.removeChild(c.stateNode)}catch(v){Mt(c,i,v)}break;case 18:tn!==null&&(nr?(s=tn,_b(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,c.stateNode),Nl(s)):_b(tn,c.stateNode));break;case 4:h=tn,g=nr,tn=c.stateNode.containerInfo,nr=!0,Fs(s,i,c),tn=h,nr=g;break;case 0:case 11:case 14:case 15:ji(2,c,i),xn||ji(4,c,i),Fs(s,i,c);break;case 1:xn||(xs(c,i),h=c.stateNode,typeof h.componentWillUnmount=="function"&&w1(c,i,h)),Fs(s,i,c);break;case 21:Fs(s,i,c);break;case 22:xn=(h=xn)||c.memoizedState!==null,Fs(s,i,c),xn=h;break;default:Fs(s,i,c)}}function T1(s,i){if(i.memoizedState===null&&(s=i.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{Nl(s)}catch(c){Mt(i,i.return,c)}}}function M1(s,i){if(i.memoizedState===null&&(s=i.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{Nl(s)}catch(c){Mt(i,i.return,c)}}function Jj(s){switch(s.tag){case 31:case 13:case 19:var i=s.stateNode;return i===null&&(i=s.stateNode=new N1),i;case 22:return s=s.stateNode,i=s._retryCache,i===null&&(i=s._retryCache=new N1),i;default:throw Error(r(435,s.tag))}}function Zu(s,i){var c=Jj(s);i.forEach(function(h){if(!c.has(h)){c.add(h);var g=oN.bind(null,s,h);h.then(g,g)}})}function rr(s,i){var c=i.deletions;if(c!==null)for(var h=0;h<c.length;h++){var g=c[h],v=s,S=i,A=S;e:for(;A!==null;){switch(A.tag){case 27:if(Ri(A.type)){tn=A.stateNode,nr=!1;break e}break;case 5:tn=A.stateNode,nr=!1;break e;case 3:case 4:tn=A.stateNode.containerInfo,nr=!0;break e}A=A.return}if(tn===null)throw Error(r(160));A1(v,S,g),tn=null,nr=!1,v=g.alternate,v!==null&&(v.return=null),g.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)R1(i,s),i=i.sibling}var ns=null;function R1(s,i){var c=s.alternate,h=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:rr(i,s),sr(s),h&4&&(ji(3,s,s.return),Io(3,s),ji(5,s,s.return));break;case 1:rr(i,s),sr(s),h&512&&(xn||c===null||xs(c,c.return)),h&64&&$s&&(s=s.updateQueue,s!==null&&(h=s.callbacks,h!==null&&(c=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=c===null?h:c.concat(h))));break;case 26:var g=ns;if(rr(i,s),sr(s),h&512&&(xn||c===null||xs(c,c.return)),h&4){var v=c!==null?c.memoizedState:null;if(h=s.memoizedState,c===null)if(h===null)if(s.stateNode===null){e:{h=s.type,c=s.memoizedProps,g=g.ownerDocument||g;t:switch(h){case"title":v=g.getElementsByTagName("title")[0],(!v||v[us]||v[en]||v.namespaceURI==="http://www.w3.org/2000/svg"||v.hasAttribute("itemprop"))&&(v=g.createElement(h),g.head.insertBefore(v,g.querySelector("head > title"))),Ln(v,h,c),v[en]=s,nn(v),h=v;break e;case"link":var S=Rb("link","href",g).get(h+(c.href||""));if(S){for(var A=0;A<S.length;A++)if(v=S[A],v.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&v.getAttribute("rel")===(c.rel==null?null:c.rel)&&v.getAttribute("title")===(c.title==null?null:c.title)&&v.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){S.splice(A,1);break t}}v=g.createElement(h),Ln(v,h,c),g.head.appendChild(v);break;case"meta":if(S=Rb("meta","content",g).get(h+(c.content||""))){for(A=0;A<S.length;A++)if(v=S[A],v.getAttribute("content")===(c.content==null?null:""+c.content)&&v.getAttribute("name")===(c.name==null?null:c.name)&&v.getAttribute("property")===(c.property==null?null:c.property)&&v.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&v.getAttribute("charset")===(c.charSet==null?null:c.charSet)){S.splice(A,1);break t}}v=g.createElement(h),Ln(v,h,c),g.head.appendChild(v);break;default:throw Error(r(468,h))}v[en]=s,nn(v),h=v}s.stateNode=h}else Db(g,s.type,s.stateNode);else s.stateNode=Mb(g,h,s.memoizedProps);else v!==h?(v===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):v.count--,h===null?Db(g,s.type,s.stateNode):Mb(g,h,s.memoizedProps)):h===null&&s.stateNode!==null&&pp(s,s.memoizedProps,c.memoizedProps)}break;case 27:rr(i,s),sr(s),h&512&&(xn||c===null||xs(c,c.return)),c!==null&&h&4&&pp(s,s.memoizedProps,c.memoizedProps);break;case 5:if(rr(i,s),sr(s),h&512&&(xn||c===null||xs(c,c.return)),s.flags&32){g=s.stateNode;try{di(g,"")}catch(Re){Mt(s,s.return,Re)}}h&4&&s.stateNode!=null&&(g=s.memoizedProps,pp(s,g,c!==null?c.memoizedProps:g)),h&1024&&(xp=!0);break;case 6:if(rr(i,s),sr(s),h&4){if(s.stateNode===null)throw Error(r(162));h=s.memoizedProps,c=s.stateNode;try{c.nodeValue=h}catch(Re){Mt(s,s.return,Re)}}break;case 3:if(pd=null,g=ns,ns=hd(i.containerInfo),rr(i,s),ns=g,sr(s),h&4&&c!==null&&c.memoizedState.isDehydrated)try{Nl(i.containerInfo)}catch(Re){Mt(s,s.return,Re)}xp&&(xp=!1,D1(s));break;case 4:h=ns,ns=hd(s.stateNode.containerInfo),rr(i,s),sr(s),ns=h;break;case 12:rr(i,s),sr(s);break;case 31:rr(i,s),sr(s),h&4&&(h=s.updateQueue,h!==null&&(s.updateQueue=null,Zu(s,h)));break;case 13:rr(i,s),sr(s),s.child.flags&8192&&s.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(ed=Te()),h&4&&(h=s.updateQueue,h!==null&&(s.updateQueue=null,Zu(s,h)));break;case 22:g=s.memoizedState!==null;var F=c!==null&&c.memoizedState!==null,ee=$s,ue=xn;if($s=ee||g,xn=ue||F,rr(i,s),xn=ue,$s=ee,sr(s),h&8192)e:for(i=s.stateNode,i._visibility=g?i._visibility&-2:i._visibility|1,g&&(c===null||F||$s||xn||_a(s)),c=null,i=s;;){if(i.tag===5||i.tag===26){if(c===null){F=c=i;try{if(v=F.stateNode,g)S=v.style,typeof S.setProperty=="function"?S.setProperty("display","none","important"):S.display="none";else{A=F.stateNode;var fe=F.memoizedProps.style,se=fe!=null&&fe.hasOwnProperty("display")?fe.display:null;A.style.display=se==null||typeof se=="boolean"?"":(""+se).trim()}}catch(Re){Mt(F,F.return,Re)}}}else if(i.tag===6){if(c===null){F=i;try{F.stateNode.nodeValue=g?"":F.memoizedProps}catch(Re){Mt(F,F.return,Re)}}}else if(i.tag===18){if(c===null){F=i;try{var le=F.stateNode;g?wb(le,!0):wb(F.stateNode,!1)}catch(Re){Mt(F,F.return,Re)}}}else if((i.tag!==22&&i.tag!==23||i.memoizedState===null||i===s)&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===s)break e;for(;i.sibling===null;){if(i.return===null||i.return===s)break e;c===i&&(c=null),i=i.return}c===i&&(c=null),i.sibling.return=i.return,i=i.sibling}h&4&&(h=s.updateQueue,h!==null&&(c=h.retryQueue,c!==null&&(h.retryQueue=null,Zu(s,c))));break;case 19:rr(i,s),sr(s),h&4&&(h=s.updateQueue,h!==null&&(s.updateQueue=null,Zu(s,h)));break;case 30:break;case 21:break;default:rr(i,s),sr(s)}}function sr(s){var i=s.flags;if(i&2){try{for(var c,h=s.return;h!==null;){if(S1(h)){c=h;break}h=h.return}if(c==null)throw Error(r(160));switch(c.tag){case 27:var g=c.stateNode,v=mp(s);Ku(s,v,g);break;case 5:var S=c.stateNode;c.flags&32&&(di(S,""),c.flags&=-33);var A=mp(s);Ku(s,A,S);break;case 3:case 4:var F=c.stateNode.containerInfo,ee=mp(s);gp(s,ee,F);break;default:throw Error(r(161))}}catch(ue){Mt(s,s.return,ue)}s.flags&=-3}i&4096&&(s.flags&=-4097)}function D1(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var i=s;D1(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),s=s.sibling}}function Us(s,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)C1(s,i.alternate,i),i=i.sibling}function _a(s){for(s=s.child;s!==null;){var i=s;switch(i.tag){case 0:case 11:case 14:case 15:ji(4,i,i.return),_a(i);break;case 1:xs(i,i.return);var c=i.stateNode;typeof c.componentWillUnmount=="function"&&w1(i,i.return,c),_a(i);break;case 27:Zo(i.stateNode);case 26:case 5:xs(i,i.return),_a(i);break;case 22:i.memoizedState===null&&_a(i);break;case 30:_a(i);break;default:_a(i)}s=s.sibling}}function Is(s,i,c){for(c=c&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var h=i.alternate,g=s,v=i,S=v.flags;switch(v.tag){case 0:case 11:case 15:Is(g,v,c),Io(4,v);break;case 1:if(Is(g,v,c),h=v,g=h.stateNode,typeof g.componentDidMount=="function")try{g.componentDidMount()}catch(ee){Mt(h,h.return,ee)}if(h=v,g=h.updateQueue,g!==null){var A=h.stateNode;try{var F=g.shared.hiddenCallbacks;if(F!==null)for(g.shared.hiddenCallbacks=null,g=0;g<F.length;g++)u0(F[g],A)}catch(ee){Mt(h,h.return,ee)}}c&&S&64&&_1(v),Ho(v,v.return);break;case 27:j1(v);case 26:case 5:Is(g,v,c),c&&h===null&&S&4&&k1(v),Ho(v,v.return);break;case 12:Is(g,v,c);break;case 31:Is(g,v,c),c&&S&4&&T1(g,v);break;case 13:Is(g,v,c),c&&S&4&&M1(g,v);break;case 22:v.memoizedState===null&&Is(g,v,c),Ho(v,v.return);break;case 30:break;default:Is(g,v,c)}i=i.sibling}}function vp(s,i){var c=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(c=s.memoizedState.cachePool.pool),s=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(s=i.memoizedState.cachePool.pool),s!==c&&(s!=null&&s.refCount++,c!=null&&Ao(c))}function bp(s,i){s=null,i.alternate!==null&&(s=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==s&&(i.refCount++,s!=null&&Ao(s))}function rs(s,i,c,h){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)L1(s,i,c,h),i=i.sibling}function L1(s,i,c,h){var g=i.flags;switch(i.tag){case 0:case 11:case 15:rs(s,i,c,h),g&2048&&Io(9,i);break;case 1:rs(s,i,c,h);break;case 3:rs(s,i,c,h),g&2048&&(s=null,i.alternate!==null&&(s=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==s&&(i.refCount++,s!=null&&Ao(s)));break;case 12:if(g&2048){rs(s,i,c,h),s=i.stateNode;try{var v=i.memoizedProps,S=v.id,A=v.onPostCommit;typeof A=="function"&&A(S,i.alternate===null?"mount":"update",s.passiveEffectDuration,-0)}catch(F){Mt(i,i.return,F)}}else rs(s,i,c,h);break;case 31:rs(s,i,c,h);break;case 13:rs(s,i,c,h);break;case 23:break;case 22:v=i.stateNode,S=i.alternate,i.memoizedState!==null?v._visibility&2?rs(s,i,c,h):qo(s,i):v._visibility&2?rs(s,i,c,h):(v._visibility|=2,ml(s,i,c,h,(i.subtreeFlags&10256)!==0||!1)),g&2048&&vp(S,i);break;case 24:rs(s,i,c,h),g&2048&&bp(i.alternate,i);break;default:rs(s,i,c,h)}}function ml(s,i,c,h,g){for(g=g&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var v=s,S=i,A=c,F=h,ee=S.flags;switch(S.tag){case 0:case 11:case 15:ml(v,S,A,F,g),Io(8,S);break;case 23:break;case 22:var ue=S.stateNode;S.memoizedState!==null?ue._visibility&2?ml(v,S,A,F,g):qo(v,S):(ue._visibility|=2,ml(v,S,A,F,g)),g&&ee&2048&&vp(S.alternate,S);break;case 24:ml(v,S,A,F,g),g&&ee&2048&&bp(S.alternate,S);break;default:ml(v,S,A,F,g)}i=i.sibling}}function qo(s,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var c=s,h=i,g=h.flags;switch(h.tag){case 22:qo(c,h),g&2048&&vp(h.alternate,h);break;case 24:qo(c,h),g&2048&&bp(h.alternate,h);break;default:qo(c,h)}i=i.sibling}}var Vo=8192;function gl(s,i,c){if(s.subtreeFlags&Vo)for(s=s.child;s!==null;)O1(s,i,c),s=s.sibling}function O1(s,i,c){switch(s.tag){case 26:gl(s,i,c),s.flags&Vo&&s.memoizedState!==null&&$N(c,ns,s.memoizedState,s.memoizedProps);break;case 5:gl(s,i,c);break;case 3:case 4:var h=ns;ns=hd(s.stateNode.containerInfo),gl(s,i,c),ns=h;break;case 22:s.memoizedState===null&&(h=s.alternate,h!==null&&h.memoizedState!==null?(h=Vo,Vo=16777216,gl(s,i,c),Vo=h):gl(s,i,c));break;default:gl(s,i,c)}}function z1(s){var i=s.alternate;if(i!==null&&(s=i.child,s!==null)){i.child=null;do i=s.sibling,s.sibling=null,s=i;while(s!==null)}}function Go(s){var i=s.deletions;if((s.flags&16)!==0){if(i!==null)for(var c=0;c<i.length;c++){var h=i[c];Cn=h,P1(h,s)}z1(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)B1(s),s=s.sibling}function B1(s){switch(s.tag){case 0:case 11:case 15:Go(s),s.flags&2048&&ji(9,s,s.return);break;case 3:Go(s);break;case 12:Go(s);break;case 22:var i=s.stateNode;s.memoizedState!==null&&i._visibility&2&&(s.return===null||s.return.tag!==13)?(i._visibility&=-3,Ju(s)):Go(s);break;default:Go(s)}}function Ju(s){var i=s.deletions;if((s.flags&16)!==0){if(i!==null)for(var c=0;c<i.length;c++){var h=i[c];Cn=h,P1(h,s)}z1(s)}for(s=s.child;s!==null;){switch(i=s,i.tag){case 0:case 11:case 15:ji(8,i,i.return),Ju(i);break;case 22:c=i.stateNode,c._visibility&2&&(c._visibility&=-3,Ju(i));break;default:Ju(i)}s=s.sibling}}function P1(s,i){for(;Cn!==null;){var c=Cn;switch(c.tag){case 0:case 11:case 15:ji(8,c,i);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var h=c.memoizedState.cachePool.pool;h!=null&&h.refCount++}break;case 24:Ao(c.memoizedState.cache)}if(h=c.child,h!==null)h.return=c,Cn=h;else e:for(c=s;Cn!==null;){h=Cn;var g=h.sibling,v=h.return;if(E1(h),h===c){Cn=null;break e}if(g!==null){g.return=v,Cn=g;break e}Cn=v}}}var eN={getCacheForType:function(s){var i=Rn(pn),c=i.data.get(s);return c===void 0&&(c=s(),i.data.set(s,c)),c},cacheSignal:function(){return Rn(pn).controller.signal}},tN=typeof WeakMap=="function"?WeakMap:Map,Ct=0,Ut=null,ht=null,xt=0,Tt=0,br=null,Ni=!1,xl=!1,yp=!1,Hs=0,on=0,Ci=0,wa=0,_p=0,yr=0,vl=0,Yo=null,ir=null,wp=!1,ed=0,$1=0,td=1/0,nd=null,Ei=null,jn=0,Ai=null,bl=null,qs=0,kp=0,Sp=null,F1=null,Wo=0,jp=null;function _r(){return(Ct&2)!==0&&xt!==0?xt&-xt:P.T!==null?Mp():ho()}function U1(){if(yr===0)if((xt&536870912)===0||bt){var s=Zr;Zr<<=1,(Zr&3932160)===0&&(Zr=262144),yr=s}else yr=536870912;return s=xr.current,s!==null&&(s.flags|=32),yr}function ar(s,i,c){(s===Ut&&(Tt===2||Tt===9)||s.cancelPendingCommit!==null)&&(yl(s,0),Ti(s,xt,yr,!1)),Vt(s,c),((Ct&2)===0||s!==Ut)&&(s===Ut&&((Ct&2)===0&&(wa|=c),on===4&&Ti(s,xt,yr,!1)),vs(s))}function I1(s,i,c){if((Ct&6)!==0)throw Error(r(327));var h=!c&&(i&127)===0&&(i&s.expiredLanes)===0||Ke(s,i),g=h?sN(s,i):Cp(s,i,!0),v=h;do{if(g===0){xl&&!h&&Ti(s,i,0,!1);break}else{if(c=s.current.alternate,v&&!nN(c)){g=Cp(s,i,!1),v=!1;continue}if(g===2){if(v=i,s.errorRecoveryDisabledLanes&v)var S=0;else S=s.pendingLanes&-536870913,S=S!==0?S:S&536870912?536870912:0;if(S!==0){i=S;e:{var A=s;g=Yo;var F=A.current.memoizedState.isDehydrated;if(F&&(yl(A,S).flags|=256),S=Cp(A,S,!1),S!==2){if(yp&&!F){A.errorRecoveryDisabledLanes|=v,wa|=v,g=4;break e}v=ir,ir=g,v!==null&&(ir===null?ir=v:ir.push.apply(ir,v))}g=S}if(v=!1,g!==2)continue}}if(g===1){yl(s,0),Ti(s,i,0,!0);break}e:{switch(h=s,v=g,v){case 0:case 1:throw Error(r(345));case 4:if((i&4194048)!==i)break;case 6:Ti(h,i,yr,!Ni);break e;case 2:ir=null;break;case 3:case 5:break;default:throw Error(r(329))}if((i&62914560)===i&&(g=ed+300-Te(),10<g)){if(Ti(h,i,yr,!Ni),_e(h,0,!0)!==0)break e;qs=i,h.timeoutHandle=bb(H1.bind(null,h,c,ir,nd,wp,i,yr,wa,vl,Ni,v,"Throttled",-0,0),g);break e}H1(h,c,ir,nd,wp,i,yr,wa,vl,Ni,v,null,-0,0)}}break}while(!0);vs(s)}function H1(s,i,c,h,g,v,S,A,F,ee,ue,fe,se,le){if(s.timeoutHandle=-1,fe=i.subtreeFlags,fe&8192||(fe&16785408)===16785408){fe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Dr},O1(i,v,fe);var Re=(v&62914560)===v?ed-Te():(v&4194048)===v?$1-Te():0;if(Re=FN(fe,Re),Re!==null){qs=v,s.cancelPendingCommit=Re(K1.bind(null,s,i,v,c,h,g,S,A,F,ue,fe,null,se,le)),Ti(s,v,S,!ee);return}}K1(s,i,v,c,h,g,S,A,F)}function nN(s){for(var i=s;;){var c=i.tag;if((c===0||c===11||c===15)&&i.flags&16384&&(c=i.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var h=0;h<c.length;h++){var g=c[h],v=g.getSnapshot;g=g.value;try{if(!mr(v(),g))return!1}catch{return!1}}if(c=i.child,i.subtreeFlags&16384&&c!==null)c.return=i,i=c;else{if(i===s)break;for(;i.sibling===null;){if(i.return===null||i.return===s)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function Ti(s,i,c,h){i&=~_p,i&=~wa,s.suspendedLanes|=i,s.pingedLanes&=~i,h&&(s.warmLanes|=i),h=s.expirationTimes;for(var g=i;0<g;){var v=31-st(g),S=1<<v;h[v]=-1,g&=~S}c!==0&&Tr(s,c,i)}function rd(){return(Ct&6)===0?(Qo(0),!1):!0}function Np(){if(ht!==null){if(Tt===0)var s=ht.return;else s=ht,Ds=fa=null,If(s),ul=null,Mo=0,s=ht;for(;s!==null;)y1(s.alternate,s),s=s.return;ht=null}}function yl(s,i){var c=s.timeoutHandle;c!==-1&&(s.timeoutHandle=-1,wN(c)),c=s.cancelPendingCommit,c!==null&&(s.cancelPendingCommit=null,c()),qs=0,Np(),Ut=s,ht=c=Ms(s.current,null),xt=i,Tt=0,br=null,Ni=!1,xl=Ke(s,i),yp=!1,vl=yr=_p=wa=Ci=on=0,ir=Yo=null,wp=!1,(i&8)!==0&&(i|=i&32);var h=s.entangledLanes;if(h!==0)for(s=s.entanglements,h&=i;0<h;){var g=31-st(h),v=1<<g;i|=s[g],h&=~v}return Hs=i,Su(),c}function q1(s,i){et=null,P.H=$o,i===cl||i===Ru?(i=a0(),Tt=3):i===Tf?(i=a0(),Tt=4):Tt=i===sp?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,br=i,ht===null&&(on=1,Gu(s,Br(i,s.current)))}function V1(){var s=xr.current;return s===null?!0:(xt&4194048)===xt?Ur===null:(xt&62914560)===xt||(xt&536870912)!==0?s===Ur:!1}function G1(){var s=P.H;return P.H=$o,s===null?$o:s}function Y1(){var s=P.A;return P.A=eN,s}function sd(){on=4,Ni||(xt&4194048)!==xt&&xr.current!==null||(xl=!0),(Ci&134217727)===0&&(wa&134217727)===0||Ut===null||Ti(Ut,xt,yr,!1)}function Cp(s,i,c){var h=Ct;Ct|=2;var g=G1(),v=Y1();(Ut!==s||xt!==i)&&(nd=null,yl(s,i)),i=!1;var S=on;e:do try{if(Tt!==0&&ht!==null){var A=ht,F=br;switch(Tt){case 8:Np(),S=6;break e;case 3:case 2:case 9:case 6:xr.current===null&&(i=!0);var ee=Tt;if(Tt=0,br=null,_l(s,A,F,ee),c&&xl){S=0;break e}break;default:ee=Tt,Tt=0,br=null,_l(s,A,F,ee)}}rN(),S=on;break}catch(ue){q1(s,ue)}while(!0);return i&&s.shellSuspendCounter++,Ds=fa=null,Ct=h,P.H=g,P.A=v,ht===null&&(Ut=null,xt=0,Su()),S}function rN(){for(;ht!==null;)W1(ht)}function sN(s,i){var c=Ct;Ct|=2;var h=G1(),g=Y1();Ut!==s||xt!==i?(nd=null,td=Te()+500,yl(s,i)):xl=Ke(s,i);e:do try{if(Tt!==0&&ht!==null){i=ht;var v=br;t:switch(Tt){case 1:Tt=0,br=null,_l(s,i,v,1);break;case 2:case 9:if(s0(v)){Tt=0,br=null,Q1(i);break}i=function(){Tt!==2&&Tt!==9||Ut!==s||(Tt=7),vs(s)},v.then(i,i);break e;case 3:Tt=7;break e;case 4:Tt=5;break e;case 7:s0(v)?(Tt=0,br=null,Q1(i)):(Tt=0,br=null,_l(s,i,v,7));break;case 5:var S=null;switch(ht.tag){case 26:S=ht.memoizedState;case 5:case 27:var A=ht;if(S?Lb(S):A.stateNode.complete){Tt=0,br=null;var F=A.sibling;if(F!==null)ht=F;else{var ee=A.return;ee!==null?(ht=ee,id(ee)):ht=null}break t}}Tt=0,br=null,_l(s,i,v,5);break;case 6:Tt=0,br=null,_l(s,i,v,6);break;case 8:Np(),on=6;break e;default:throw Error(r(462))}}iN();break}catch(ue){q1(s,ue)}while(!0);return Ds=fa=null,P.H=h,P.A=g,Ct=c,ht!==null?0:(Ut=null,xt=0,Su(),on)}function iN(){for(;ht!==null&&!Be();)W1(ht)}function W1(s){var i=v1(s.alternate,s,Hs);s.memoizedProps=s.pendingProps,i===null?id(s):ht=i}function Q1(s){var i=s,c=i.alternate;switch(i.tag){case 15:case 0:i=h1(c,i,i.pendingProps,i.type,void 0,xt);break;case 11:i=h1(c,i,i.pendingProps,i.type.render,i.ref,xt);break;case 5:If(i);default:y1(c,i),i=ht=Yv(i,Hs),i=v1(c,i,Hs)}s.memoizedProps=s.pendingProps,i===null?id(s):ht=i}function _l(s,i,c,h){Ds=fa=null,If(i),ul=null,Mo=0;var g=i.return;try{if(Yj(s,g,i,c,xt)){on=1,Gu(s,Br(c,s.current)),ht=null;return}}catch(v){if(g!==null)throw ht=g,v;on=1,Gu(s,Br(c,s.current)),ht=null;return}i.flags&32768?(bt||h===1?s=!0:xl||(xt&536870912)!==0?s=!1:(Ni=s=!0,(h===2||h===9||h===3||h===6)&&(h=xr.current,h!==null&&h.tag===13&&(h.flags|=16384))),X1(i,s)):id(i)}function id(s){var i=s;do{if((i.flags&32768)!==0){X1(i,Ni);return}s=i.return;var c=Xj(i.alternate,i,Hs);if(c!==null){ht=c;return}if(i=i.sibling,i!==null){ht=i;return}ht=i=s}while(i!==null);on===0&&(on=5)}function X1(s,i){do{var c=Kj(s.alternate,s);if(c!==null){c.flags&=32767,ht=c;return}if(c=s.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!i&&(s=s.sibling,s!==null)){ht=s;return}ht=s=c}while(s!==null);on=6,ht=null}function K1(s,i,c,h,g,v,S,A,F){s.cancelPendingCommit=null;do ad();while(jn!==0);if((Ct&6)!==0)throw Error(r(327));if(i!==null){if(i===s.current)throw Error(r(177));if(v=i.lanes|i.childLanes,v|=mf,Yn(s,c,v,S,A,F),s===Ut&&(ht=Ut=null,xt=0),bl=i,Ai=s,qs=c,kp=v,Sp=g,F1=h,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,cN(W,function(){return nb(),null})):(s.callbackNode=null,s.callbackPriority=0),h=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||h){h=P.T,P.T=null,g=$.p,$.p=2,S=Ct,Ct|=4;try{Zj(s,i,c)}finally{Ct=S,$.p=g,P.T=h}}jn=1,Z1(),J1(),eb()}}function Z1(){if(jn===1){jn=0;var s=Ai,i=bl,c=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||c){c=P.T,P.T=null;var h=$.p;$.p=2;var g=Ct;Ct|=4;try{R1(i,s);var v=$p,S=Pv(s.containerInfo),A=v.focusedElem,F=v.selectionRange;if(S!==A&&A&&A.ownerDocument&&Bv(A.ownerDocument.documentElement,A)){if(F!==null&&uf(A)){var ee=F.start,ue=F.end;if(ue===void 0&&(ue=ee),"selectionStart"in A)A.selectionStart=ee,A.selectionEnd=Math.min(ue,A.value.length);else{var fe=A.ownerDocument||document,se=fe&&fe.defaultView||window;if(se.getSelection){var le=se.getSelection(),Re=A.textContent.length,qe=Math.min(F.start,Re),Bt=F.end===void 0?qe:Math.min(F.end,Re);!le.extend&&qe>Bt&&(S=Bt,Bt=qe,qe=S);var K=zv(A,qe),V=zv(A,Bt);if(K&&V&&(le.rangeCount!==1||le.anchorNode!==K.node||le.anchorOffset!==K.offset||le.focusNode!==V.node||le.focusOffset!==V.offset)){var J=fe.createRange();J.setStart(K.node,K.offset),le.removeAllRanges(),qe>Bt?(le.addRange(J),le.extend(V.node,V.offset)):(J.setEnd(V.node,V.offset),le.addRange(J))}}}}for(fe=[],le=A;le=le.parentNode;)le.nodeType===1&&fe.push({element:le,left:le.scrollLeft,top:le.scrollTop});for(typeof A.focus=="function"&&A.focus(),A=0;A<fe.length;A++){var he=fe[A];he.element.scrollLeft=he.left,he.element.scrollTop=he.top}}vd=!!Pp,$p=Pp=null}finally{Ct=g,$.p=h,P.T=c}}s.current=i,jn=2}}function J1(){if(jn===2){jn=0;var s=Ai,i=bl,c=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||c){c=P.T,P.T=null;var h=$.p;$.p=2;var g=Ct;Ct|=4;try{C1(s,i.alternate,i)}finally{Ct=g,$.p=h,P.T=c}}jn=3}}function eb(){if(jn===4||jn===3){jn=0,yt();var s=Ai,i=bl,c=qs,h=F1;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?jn=5:(jn=0,bl=Ai=null,tb(s,s.pendingLanes));var g=s.pendingLanes;if(g===0&&(Ei=null),Ji(c),i=i.stateNode,Et&&typeof Et.onCommitFiberRoot=="function")try{Et.onCommitFiberRoot(ot,i,void 0,(i.current.flags&128)===128)}catch{}if(h!==null){i=P.T,g=$.p,$.p=2,P.T=null;try{for(var v=s.onRecoverableError,S=0;S<h.length;S++){var A=h[S];v(A.value,{componentStack:A.stack})}}finally{P.T=i,$.p=g}}(qs&3)!==0&&ad(),vs(s),g=s.pendingLanes,(c&261930)!==0&&(g&42)!==0?s===jp?Wo++:(Wo=0,jp=s):Wo=0,Qo(0)}}function tb(s,i){(s.pooledCacheLanes&=i)===0&&(i=s.pooledCache,i!=null&&(s.pooledCache=null,Ao(i)))}function ad(){return Z1(),J1(),eb(),nb()}function nb(){if(jn!==5)return!1;var s=Ai,i=kp;kp=0;var c=Ji(qs),h=P.T,g=$.p;try{$.p=32>c?32:c,P.T=null,c=Sp,Sp=null;var v=Ai,S=qs;if(jn=0,bl=Ai=null,qs=0,(Ct&6)!==0)throw Error(r(331));var A=Ct;if(Ct|=4,B1(v.current),L1(v,v.current,S,c),Ct=A,Qo(0,!1),Et&&typeof Et.onPostCommitFiberRoot=="function")try{Et.onPostCommitFiberRoot(ot,v)}catch{}return!0}finally{$.p=g,P.T=h,tb(s,i)}}function rb(s,i,c){i=Br(c,i),i=rp(s.stateNode,i,2),s=wi(s,i,2),s!==null&&(Vt(s,2),vs(s))}function Mt(s,i,c){if(s.tag===3)rb(s,s,c);else for(;i!==null;){if(i.tag===3){rb(i,s,c);break}else if(i.tag===1){var h=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(Ei===null||!Ei.has(h))){s=Br(c,s),c=s1(2),h=wi(i,c,2),h!==null&&(i1(c,h,i,s),Vt(h,2),vs(h));break}}i=i.return}}function Ep(s,i,c){var h=s.pingCache;if(h===null){h=s.pingCache=new tN;var g=new Set;h.set(i,g)}else g=h.get(i),g===void 0&&(g=new Set,h.set(i,g));g.has(c)||(yp=!0,g.add(c),s=aN.bind(null,s,i,c),i.then(s,s))}function aN(s,i,c){var h=s.pingCache;h!==null&&h.delete(i),s.pingedLanes|=s.suspendedLanes&c,s.warmLanes&=~c,Ut===s&&(xt&c)===c&&(on===4||on===3&&(xt&62914560)===xt&&300>Te()-ed?(Ct&2)===0&&yl(s,0):_p|=c,vl===xt&&(vl=0)),vs(s)}function sb(s,i){i===0&&(i=fn()),s=ua(s,i),s!==null&&(Vt(s,i),vs(s))}function lN(s){var i=s.memoizedState,c=0;i!==null&&(c=i.retryLane),sb(s,c)}function oN(s,i){var c=0;switch(s.tag){case 31:case 13:var h=s.stateNode,g=s.memoizedState;g!==null&&(c=g.retryLane);break;case 19:h=s.stateNode;break;case 22:h=s.stateNode._retryCache;break;default:throw Error(r(314))}h!==null&&h.delete(i),sb(s,c)}function cN(s,i){return _n(s,i)}var ld=null,wl=null,Ap=!1,od=!1,Tp=!1,Mi=0;function vs(s){s!==wl&&s.next===null&&(wl===null?ld=wl=s:wl=wl.next=s),od=!0,Ap||(Ap=!0,dN())}function Qo(s,i){if(!Tp&&od){Tp=!0;do for(var c=!1,h=ld;h!==null;){if(s!==0){var g=h.pendingLanes;if(g===0)var v=0;else{var S=h.suspendedLanes,A=h.pingedLanes;v=(1<<31-st(42|s)+1)-1,v&=g&~(S&~A),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(c=!0,ob(h,v))}else v=xt,v=_e(h,h===Ut?v:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),(v&3)===0||Ke(h,v)||(c=!0,ob(h,v));h=h.next}while(c);Tp=!1}}function uN(){ib()}function ib(){od=Ap=!1;var s=0;Mi!==0&&_N()&&(s=Mi);for(var i=Te(),c=null,h=ld;h!==null;){var g=h.next,v=ab(h,i);v===0?(h.next=null,c===null?ld=g:c.next=g,g===null&&(wl=c)):(c=h,(s!==0||(v&3)!==0)&&(od=!0)),h=g}jn!==0&&jn!==5||Qo(s),Mi!==0&&(Mi=0)}function ab(s,i){for(var c=s.suspendedLanes,h=s.pingedLanes,g=s.expirationTimes,v=s.pendingLanes&-62914561;0<v;){var S=31-st(v),A=1<<S,F=g[S];F===-1?((A&c)===0||(A&h)!==0)&&(g[S]=qt(A,i)):F<=i&&(s.expiredLanes|=A),v&=~A}if(i=Ut,c=xt,c=_e(s,s===i?c:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),h=s.callbackNode,c===0||s===i&&(Tt===2||Tt===9)||s.cancelPendingCommit!==null)return h!==null&&h!==null&&Ne(h),s.callbackNode=null,s.callbackPriority=0;if((c&3)===0||Ke(s,c)){if(i=c&-c,i===s.callbackPriority)return i;switch(h!==null&&Ne(h),Ji(c)){case 2:case 8:c=ke;break;case 32:c=W;break;case 268435456:c=Oe;break;default:c=W}return h=lb.bind(null,s),c=_n(c,h),s.callbackPriority=i,s.callbackNode=c,i}return h!==null&&h!==null&&Ne(h),s.callbackPriority=2,s.callbackNode=null,2}function lb(s,i){if(jn!==0&&jn!==5)return s.callbackNode=null,s.callbackPriority=0,null;var c=s.callbackNode;if(ad()&&s.callbackNode!==c)return null;var h=xt;return h=_e(s,s===Ut?h:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),h===0?null:(I1(s,h,i),ab(s,Te()),s.callbackNode!=null&&s.callbackNode===c?lb.bind(null,s):null)}function ob(s,i){if(ad())return null;I1(s,i,!0)}function dN(){kN(function(){(Ct&6)!==0?_n(oe,uN):ib()})}function Mp(){if(Mi===0){var s=ll;s===0&&(s=Kr,Kr<<=1,(Kr&261888)===0&&(Kr=256)),Mi=s}return Mi}function cb(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:Wa(""+s)}function ub(s,i){var c=i.ownerDocument.createElement("input");return c.name=i.name,c.value=i.value,s.id&&c.setAttribute("form",s.id),i.parentNode.insertBefore(c,i),s=new FormData(s),c.parentNode.removeChild(c),s}function hN(s,i,c,h,g){if(i==="submit"&&c&&c.stateNode===g){var v=cb((g[Tn]||null).action),S=h.submitter;S&&(i=(i=S[Tn]||null)?cb(i.formAction):S.getAttribute("formAction"),i!==null&&(v=i,S=null));var A=new Ts("action","action",null,h,g);s.push({event:A,listeners:[{instance:null,listener:function(){if(h.defaultPrevented){if(Mi!==0){var F=S?ub(g,S):new FormData(g);Kf(c,{pending:!0,data:F,method:g.method,action:v},null,F)}}else typeof v=="function"&&(A.preventDefault(),F=S?ub(g,S):new FormData(g),Kf(c,{pending:!0,data:F,method:g.method,action:v},v,F))},currentTarget:g}]})}}for(var Rp=0;Rp<pf.length;Rp++){var Dp=pf[Rp],fN=Dp.toLowerCase(),pN=Dp[0].toUpperCase()+Dp.slice(1);ts(fN,"on"+pN)}ts(Uv,"onAnimationEnd"),ts(Iv,"onAnimationIteration"),ts(Hv,"onAnimationStart"),ts("dblclick","onDoubleClick"),ts("focusin","onFocus"),ts("focusout","onBlur"),ts(Tj,"onTransitionRun"),ts(Mj,"onTransitionStart"),ts(Rj,"onTransitionCancel"),ts(qv,"onTransitionEnd"),hs("onMouseEnter",["mouseout","mouseover"]),hs("onMouseLeave",["mouseout","mouseover"]),hs("onPointerEnter",["pointerout","pointerover"]),hs("onPointerLeave",["pointerout","pointerover"]),Jr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Jr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Jr("onBeforeInput",["compositionend","keypress","textInput","paste"]),Jr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Jr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Jr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Xo="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(" "),mN=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Xo));function db(s,i){i=(i&4)!==0;for(var c=0;c<s.length;c++){var h=s[c],g=h.event;h=h.listeners;e:{var v=void 0;if(i)for(var S=h.length-1;0<=S;S--){var A=h[S],F=A.instance,ee=A.currentTarget;if(A=A.listener,F!==v&&g.isPropagationStopped())break e;v=A,g.currentTarget=ee;try{v(g)}catch(ue){ku(ue)}g.currentTarget=null,v=F}else for(S=0;S<h.length;S++){if(A=h[S],F=A.instance,ee=A.currentTarget,A=A.listener,F!==v&&g.isPropagationStopped())break e;v=A,g.currentTarget=ee;try{v(g)}catch(ue){ku(ue)}g.currentTarget=null,v=F}}}}function ft(s,i){var c=i[po];c===void 0&&(c=i[po]=new Set);var h=s+"__bubble";c.has(h)||(hb(i,s,2,!1),c.add(h))}function Lp(s,i,c){var h=0;i&&(h|=4),hb(c,s,h,i)}var cd="_reactListening"+Math.random().toString(36).slice(2);function Op(s){if(!s[cd]){s[cd]=!0,er.forEach(function(c){c!=="selectionchange"&&(mN.has(c)||Lp(c,!1,s),Lp(c,!0,s))});var i=s.nodeType===9?s:s.ownerDocument;i===null||i[cd]||(i[cd]=!0,Lp("selectionchange",!1,i))}}function hb(s,i,c,h){switch(Ub(i)){case 2:var g=HN;break;case 8:g=qN;break;default:g=Xp}c=g.bind(null,i,c,s),g=void 0,!Xa||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(g=!0),h?g!==void 0?s.addEventListener(i,c,{capture:!0,passive:g}):s.addEventListener(i,c,!0):g!==void 0?s.addEventListener(i,c,{passive:g}):s.addEventListener(i,c,!1)}function zp(s,i,c,h,g){var v=h;if((i&1)===0&&(i&2)===0&&h!==null)e:for(;;){if(h===null)return;var S=h.tag;if(S===3||S===4){var A=h.stateNode.containerInfo;if(A===g)break;if(S===4)for(S=h.return;S!==null;){var F=S.tag;if((F===3||F===4)&&S.stateNode.containerInfo===g)return;S=S.return}for(;A!==null;){if(S=As(A),S===null)return;if(F=S.tag,F===5||F===6||F===26||F===27){h=v=S;continue e}A=A.parentNode}}h=h.return}mu(function(){var ee=v,ue=Qa(c),fe=[];e:{var se=Vv.get(s);if(se!==void 0){var le=Ts,Re=s;switch(s){case"keypress":if(ct(c)===0)break e;case"keydown":case"keyup":le=oj;break;case"focusin":Re="focus",le=ps;break;case"focusout":Re="blur",le=ps;break;case"beforeblur":case"afterblur":le=ps;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":le=sf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":le=vu;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":le=dj;break;case Uv:case Iv:case Hv:le=_u;break;case qv:le=fj;break;case"scroll":case"scrollend":le=gu;break;case"wheel":le=mj;break;case"copy":case"cut":case"paste":le=tj;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":le=wv;break;case"toggle":case"beforetoggle":le=xj}var qe=(i&4)!==0,Bt=!qe&&(s==="scroll"||s==="scrollend"),K=qe?se!==null?se+"Capture":null:se;qe=[];for(var V=ee,J;V!==null;){var he=V;if(J=he.stateNode,he=he.tag,he!==5&&he!==26&&he!==27||J===null||K===null||(he=ia(V,K),he!=null&&qe.push(Ko(V,he,J))),Bt)break;V=V.return}0<qe.length&&(se=new le(se,Re,null,c,ue),fe.push({event:se,listeners:qe}))}}if((i&7)===0){e:{if(se=s==="mouseover"||s==="pointerover",le=s==="mouseout"||s==="pointerout",se&&c!==hi&&(Re=c.relatedTarget||c.fromElement)&&(As(Re)||Re[pr]))break e;if((le||se)&&(se=ue.window===ue?ue:(se=ue.ownerDocument)?se.defaultView||se.parentWindow:window,le?(Re=c.relatedTarget||c.toElement,le=ee,Re=Re?As(Re):null,Re!==null&&(Bt=o(Re),qe=Re.tag,Re!==Bt||qe!==5&&qe!==27&&qe!==6)&&(Re=null)):(le=null,Re=ee),le!==Re)){if(qe=sf,he="onMouseLeave",K="onMouseEnter",V="mouse",(s==="pointerout"||s==="pointerover")&&(qe=wv,he="onPointerLeave",K="onPointerEnter",V="pointer"),Bt=le==null?se:na(le),J=Re==null?se:na(Re),se=new qe(he,V+"leave",le,c,ue),se.target=Bt,se.relatedTarget=J,he=null,As(ue)===ee&&(qe=new qe(K,V+"enter",Re,c,ue),qe.target=J,qe.relatedTarget=Bt,he=qe),Bt=he,le&&Re)t:{for(qe=gN,K=le,V=Re,J=0,he=K;he;he=qe(he))J++;he=0;for(var $e=V;$e;$e=qe($e))he++;for(;0<J-he;)K=qe(K),J--;for(;0<he-J;)V=qe(V),he--;for(;J--;){if(K===V||V!==null&&K===V.alternate){qe=K;break t}K=qe(K),V=qe(V)}qe=null}else qe=null;le!==null&&fb(fe,se,le,qe,!1),Re!==null&&Bt!==null&&fb(fe,Bt,Re,qe,!0)}}e:{if(se=ee?na(ee):window,le=se.nodeName&&se.nodeName.toLowerCase(),le==="select"||le==="input"&&se.type==="file")var St=Tv;else if(Ev(se))if(Mv)St=Cj;else{St=jj;var ze=Sj}else le=se.nodeName,!le||le.toLowerCase()!=="input"||se.type!=="checkbox"&&se.type!=="radio"?ee&&Ya(ee.elementType)&&(St=Tv):St=Nj;if(St&&(St=St(s,ee))){Av(fe,St,c,ue);break e}ze&&ze(s,se,ee),s==="focusout"&&ee&&se.type==="number"&&ee.memoizedProps.value!=null&&Va(se,"number",se.value)}switch(ze=ee?na(ee):window,s){case"focusin":(Ev(ze)||ze.contentEditable==="true")&&(Ja=ze,df=ee,No=null);break;case"focusout":No=df=Ja=null;break;case"mousedown":hf=!0;break;case"contextmenu":case"mouseup":case"dragend":hf=!1,$v(fe,c,ue);break;case"selectionchange":if(Aj)break;case"keydown":case"keyup":$v(fe,c,ue)}var it;if(lf)e:{switch(s){case"compositionstart":var vt="onCompositionStart";break e;case"compositionend":vt="onCompositionEnd";break e;case"compositionupdate":vt="onCompositionUpdate";break e}vt=void 0}else Za?Nv(s,c)&&(vt="onCompositionEnd"):s==="keydown"&&c.keyCode===229&&(vt="onCompositionStart");vt&&(kv&&c.locale!=="ko"&&(Za||vt!=="onCompositionStart"?vt==="onCompositionEnd"&&Za&&(it=_t()):(H=ue,ge="value"in H?H.value:H.textContent,Za=!0)),ze=ud(ee,vt),0<ze.length&&(vt=new _v(vt,s,null,c,ue),fe.push({event:vt,listeners:ze}),it?vt.data=it:(it=Cv(c),it!==null&&(vt.data=it)))),(it=bj?yj(s,c):_j(s,c))&&(vt=ud(ee,"onBeforeInput"),0<vt.length&&(ze=new _v("onBeforeInput","beforeinput",null,c,ue),fe.push({event:ze,listeners:vt}),ze.data=it)),hN(fe,s,ee,c,ue)}db(fe,i)})}function Ko(s,i,c){return{instance:s,listener:i,currentTarget:c}}function ud(s,i){for(var c=i+"Capture",h=[];s!==null;){var g=s,v=g.stateNode;if(g=g.tag,g!==5&&g!==26&&g!==27||v===null||(g=ia(s,c),g!=null&&h.unshift(Ko(s,g,v)),g=ia(s,i),g!=null&&h.push(Ko(s,g,v))),s.tag===3)return h;s=s.return}return[]}function gN(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function fb(s,i,c,h,g){for(var v=i._reactName,S=[];c!==null&&c!==h;){var A=c,F=A.alternate,ee=A.stateNode;if(A=A.tag,F!==null&&F===h)break;A!==5&&A!==26&&A!==27||ee===null||(F=ee,g?(ee=ia(c,v),ee!=null&&S.unshift(Ko(c,ee,F))):g||(ee=ia(c,v),ee!=null&&S.push(Ko(c,ee,F)))),c=c.return}S.length!==0&&s.push({event:i,listeners:S})}var xN=/\r\n?/g,vN=/\u0000|\uFFFD/g;function pb(s){return(typeof s=="string"?s:""+s).replace(xN,`
|
|
50
|
+
`).replace(vN,"")}function mb(s,i){return i=pb(i),pb(s)===i}function zt(s,i,c,h,g,v){switch(c){case"children":typeof h=="string"?i==="body"||i==="textarea"&&h===""||di(s,h):(typeof h=="number"||typeof h=="bigint")&&i!=="body"&&di(s,""+h);break;case"className":Ha(s,"class",h);break;case"tabIndex":Ha(s,"tabindex",h);break;case"dir":case"role":case"viewBox":case"width":case"height":Ha(s,c,h);break;case"style":hu(s,h,v);break;case"data":if(i!=="object"){Ha(s,"data",h);break}case"src":case"href":if(h===""&&(i!=="a"||c!=="href")){s.removeAttribute(c);break}if(h==null||typeof h=="function"||typeof h=="symbol"||typeof h=="boolean"){s.removeAttribute(c);break}h=Wa(""+h),s.setAttribute(c,h);break;case"action":case"formAction":if(typeof h=="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 v=="function"&&(c==="formAction"?(i!=="input"&&zt(s,i,"name",g.name,g,null),zt(s,i,"formEncType",g.formEncType,g,null),zt(s,i,"formMethod",g.formMethod,g,null),zt(s,i,"formTarget",g.formTarget,g,null)):(zt(s,i,"encType",g.encType,g,null),zt(s,i,"method",g.method,g,null),zt(s,i,"target",g.target,g,null)));if(h==null||typeof h=="symbol"||typeof h=="boolean"){s.removeAttribute(c);break}h=Wa(""+h),s.setAttribute(c,h);break;case"onClick":h!=null&&(s.onclick=Dr);break;case"onScroll":h!=null&&ft("scroll",s);break;case"onScrollEnd":h!=null&&ft("scrollend",s);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(r(61));if(c=h.__html,c!=null){if(g.children!=null)throw Error(r(60));s.innerHTML=c}}break;case"multiple":s.multiple=h&&typeof h!="function"&&typeof h!="symbol";break;case"muted":s.muted=h&&typeof h!="function"&&typeof h!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(h==null||typeof h=="function"||typeof h=="boolean"||typeof h=="symbol"){s.removeAttribute("xlink:href");break}c=Wa(""+h),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":h!=null&&typeof h!="function"&&typeof h!="symbol"?s.setAttribute(c,""+h):s.removeAttribute(c);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":h&&typeof h!="function"&&typeof h!="symbol"?s.setAttribute(c,""):s.removeAttribute(c);break;case"capture":case"download":h===!0?s.setAttribute(c,""):h!==!1&&h!=null&&typeof h!="function"&&typeof h!="symbol"?s.setAttribute(c,h):s.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":h!=null&&typeof h!="function"&&typeof h!="symbol"&&!isNaN(h)&&1<=h?s.setAttribute(c,h):s.removeAttribute(c);break;case"rowSpan":case"start":h==null||typeof h=="function"||typeof h=="symbol"||isNaN(h)?s.removeAttribute(c):s.setAttribute(c,h);break;case"popover":ft("beforetoggle",s),ft("toggle",s),ra(s,"popover",h);break;case"xlinkActuate":es(s,"http://www.w3.org/1999/xlink","xlink:actuate",h);break;case"xlinkArcrole":es(s,"http://www.w3.org/1999/xlink","xlink:arcrole",h);break;case"xlinkRole":es(s,"http://www.w3.org/1999/xlink","xlink:role",h);break;case"xlinkShow":es(s,"http://www.w3.org/1999/xlink","xlink:show",h);break;case"xlinkTitle":es(s,"http://www.w3.org/1999/xlink","xlink:title",h);break;case"xlinkType":es(s,"http://www.w3.org/1999/xlink","xlink:type",h);break;case"xmlBase":es(s,"http://www.w3.org/XML/1998/namespace","xml:base",h);break;case"xmlLang":es(s,"http://www.w3.org/XML/1998/namespace","xml:lang",h);break;case"xmlSpace":es(s,"http://www.w3.org/XML/1998/namespace","xml:space",h);break;case"is":ra(s,"is",h);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=fu.get(c)||c,ra(s,c,h))}}function Bp(s,i,c,h,g,v){switch(c){case"style":hu(s,h,v);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(r(61));if(c=h.__html,c!=null){if(g.children!=null)throw Error(r(60));s.innerHTML=c}}break;case"children":typeof h=="string"?di(s,h):(typeof h=="number"||typeof h=="bigint")&&di(s,""+h);break;case"onScroll":h!=null&&ft("scroll",s);break;case"onScrollEnd":h!=null&&ft("scrollend",s);break;case"onClick":h!=null&&(s.onclick=Dr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Ia.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(g=c.endsWith("Capture"),i=c.slice(2,g?c.length-7:void 0),v=s[Tn]||null,v=v!=null?v[c]:null,typeof v=="function"&&s.removeEventListener(i,v,g),typeof h=="function")){typeof v!="function"&&v!==null&&(c in s?s[c]=null:s.hasAttribute(c)&&s.removeAttribute(c)),s.addEventListener(i,h,g);break e}c in s?s[c]=h:h===!0?s.setAttribute(c,""):ra(s,c,h)}}}function Ln(s,i,c){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ft("error",s),ft("load",s);var h=!1,g=!1,v;for(v in c)if(c.hasOwnProperty(v)){var S=c[v];if(S!=null)switch(v){case"src":h=!0;break;case"srcSet":g=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,i));default:zt(s,i,v,S,c,null)}}g&&zt(s,i,"srcSet",c.srcSet,c,null),h&&zt(s,i,"src",c.src,c,null);return;case"input":ft("invalid",s);var A=v=S=g=null,F=null,ee=null;for(h in c)if(c.hasOwnProperty(h)){var ue=c[h];if(ue!=null)switch(h){case"name":g=ue;break;case"type":S=ue;break;case"checked":F=ue;break;case"defaultChecked":ee=ue;break;case"value":v=ue;break;case"defaultValue":A=ue;break;case"children":case"dangerouslySetInnerHTML":if(ue!=null)throw Error(r(137,i));break;default:zt(s,i,h,ue,c,null)}}uu(s,v,A,F,ee,S,g,!1);return;case"select":ft("invalid",s),h=S=v=null;for(g in c)if(c.hasOwnProperty(g)&&(A=c[g],A!=null))switch(g){case"value":v=A;break;case"defaultValue":S=A;break;case"multiple":h=A;default:zt(s,i,g,A,c,null)}i=v,c=S,s.multiple=!!h,i!=null?ui(s,!!h,i,!1):c!=null&&ui(s,!!h,c,!0);return;case"textarea":ft("invalid",s),v=g=h=null;for(S in c)if(c.hasOwnProperty(S)&&(A=c[S],A!=null))switch(S){case"value":h=A;break;case"defaultValue":g=A;break;case"children":v=A;break;case"dangerouslySetInnerHTML":if(A!=null)throw Error(r(91));break;default:zt(s,i,S,A,c,null)}vo(s,h,g,v);return;case"option":for(F in c)if(c.hasOwnProperty(F)&&(h=c[F],h!=null))switch(F){case"selected":s.selected=h&&typeof h!="function"&&typeof h!="symbol";break;default:zt(s,i,F,h,c,null)}return;case"dialog":ft("beforetoggle",s),ft("toggle",s),ft("cancel",s),ft("close",s);break;case"iframe":case"object":ft("load",s);break;case"video":case"audio":for(h=0;h<Xo.length;h++)ft(Xo[h],s);break;case"image":ft("error",s),ft("load",s);break;case"details":ft("toggle",s);break;case"embed":case"source":case"link":ft("error",s),ft("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)&&(h=c[ee],h!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,i));default:zt(s,i,ee,h,c,null)}return;default:if(Ya(i)){for(ue in c)c.hasOwnProperty(ue)&&(h=c[ue],h!==void 0&&Bp(s,i,ue,h,c,void 0));return}}for(A in c)c.hasOwnProperty(A)&&(h=c[A],h!=null&&zt(s,i,A,h,c,null))}function bN(s,i,c,h){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var g=null,v=null,S=null,A=null,F=null,ee=null,ue=null;for(le in c){var fe=c[le];if(c.hasOwnProperty(le)&&fe!=null)switch(le){case"checked":break;case"value":break;case"defaultValue":F=fe;default:h.hasOwnProperty(le)||zt(s,i,le,null,h,fe)}}for(var se in h){var le=h[se];if(fe=c[se],h.hasOwnProperty(se)&&(le!=null||fe!=null))switch(se){case"type":v=le;break;case"name":g=le;break;case"checked":ee=le;break;case"defaultChecked":ue=le;break;case"value":S=le;break;case"defaultValue":A=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(r(137,i));break;default:le!==fe&&zt(s,i,se,le,h,fe)}}sa(s,S,A,F,ee,ue,v,g);return;case"select":le=S=A=se=null;for(v in c)if(F=c[v],c.hasOwnProperty(v)&&F!=null)switch(v){case"value":break;case"multiple":le=F;default:h.hasOwnProperty(v)||zt(s,i,v,null,h,F)}for(g in h)if(v=h[g],F=c[g],h.hasOwnProperty(g)&&(v!=null||F!=null))switch(g){case"value":se=v;break;case"defaultValue":A=v;break;case"multiple":S=v;default:v!==F&&zt(s,i,g,v,h,F)}i=A,c=S,h=le,se!=null?ui(s,!!c,se,!1):!!h!=!!c&&(i!=null?ui(s,!!c,i,!0):ui(s,!!c,c?[]:"",!1));return;case"textarea":le=se=null;for(A in c)if(g=c[A],c.hasOwnProperty(A)&&g!=null&&!h.hasOwnProperty(A))switch(A){case"value":break;case"children":break;default:zt(s,i,A,null,h,g)}for(S in h)if(g=h[S],v=c[S],h.hasOwnProperty(S)&&(g!=null||v!=null))switch(S){case"value":se=g;break;case"defaultValue":le=g;break;case"children":break;case"dangerouslySetInnerHTML":if(g!=null)throw Error(r(91));break;default:g!==v&&zt(s,i,S,g,h,v)}Ga(s,se,le);return;case"option":for(var Re in c)if(se=c[Re],c.hasOwnProperty(Re)&&se!=null&&!h.hasOwnProperty(Re))switch(Re){case"selected":s.selected=!1;break;default:zt(s,i,Re,null,h,se)}for(F in h)if(se=h[F],le=c[F],h.hasOwnProperty(F)&&se!==le&&(se!=null||le!=null))switch(F){case"selected":s.selected=se&&typeof se!="function"&&typeof se!="symbol";break;default:zt(s,i,F,se,h,le)}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 qe in c)se=c[qe],c.hasOwnProperty(qe)&&se!=null&&!h.hasOwnProperty(qe)&&zt(s,i,qe,null,h,se);for(ee in h)if(se=h[ee],le=c[ee],h.hasOwnProperty(ee)&&se!==le&&(se!=null||le!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(r(137,i));break;default:zt(s,i,ee,se,h,le)}return;default:if(Ya(i)){for(var Bt in c)se=c[Bt],c.hasOwnProperty(Bt)&&se!==void 0&&!h.hasOwnProperty(Bt)&&Bp(s,i,Bt,void 0,h,se);for(ue in h)se=h[ue],le=c[ue],!h.hasOwnProperty(ue)||se===le||se===void 0&&le===void 0||Bp(s,i,ue,se,h,le);return}}for(var K in c)se=c[K],c.hasOwnProperty(K)&&se!=null&&!h.hasOwnProperty(K)&&zt(s,i,K,null,h,se);for(fe in h)se=h[fe],le=c[fe],!h.hasOwnProperty(fe)||se===le||se==null&&le==null||zt(s,i,fe,se,h,le)}function gb(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function yN(){if(typeof performance.getEntriesByType=="function"){for(var s=0,i=0,c=performance.getEntriesByType("resource"),h=0;h<c.length;h++){var g=c[h],v=g.transferSize,S=g.initiatorType,A=g.duration;if(v&&A&&gb(S)){for(S=0,A=g.responseEnd,h+=1;h<c.length;h++){var F=c[h],ee=F.startTime;if(ee>A)break;var ue=F.transferSize,fe=F.initiatorType;ue&&gb(fe)&&(F=F.responseEnd,S+=ue*(F<A?1:(A-ee)/(F-ee)))}if(--h,i+=8*(v+S)/(g.duration/1e3),s++,10<s)break}}if(0<s)return i/s/1e6}return navigator.connection&&(s=navigator.connection.downlink,typeof s=="number")?s:5}var Pp=null,$p=null;function dd(s){return s.nodeType===9?s:s.ownerDocument}function xb(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 vb(s,i){if(s===0)switch(i){case"svg":return 1;case"math":return 2;default:return 0}return s===1&&i==="foreignObject"?0:s}function Fp(s,i){return s==="textarea"||s==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.children=="bigint"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var Up=null;function _N(){var s=window.event;return s&&s.type==="popstate"?s===Up?!1:(Up=s,!0):(Up=null,!1)}var bb=typeof setTimeout=="function"?setTimeout:void 0,wN=typeof clearTimeout=="function"?clearTimeout:void 0,yb=typeof Promise=="function"?Promise:void 0,kN=typeof queueMicrotask=="function"?queueMicrotask:typeof yb<"u"?function(s){return yb.resolve(null).then(s).catch(SN)}:bb;function SN(s){setTimeout(function(){throw s})}function Ri(s){return s==="head"}function _b(s,i){var c=i,h=0;do{var g=c.nextSibling;if(s.removeChild(c),g&&g.nodeType===8)if(c=g.data,c==="/$"||c==="/&"){if(h===0){s.removeChild(g),Nl(i);return}h--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")h++;else if(c==="html")Zo(s.ownerDocument.documentElement);else if(c==="head"){c=s.ownerDocument.head,Zo(c);for(var v=c.firstChild;v;){var S=v.nextSibling,A=v.nodeName;v[us]||A==="SCRIPT"||A==="STYLE"||A==="LINK"&&v.rel.toLowerCase()==="stylesheet"||c.removeChild(v),v=S}}else c==="body"&&Zo(s.ownerDocument.body);c=g}while(c);Nl(i)}function wb(s,i){var c=s;s=0;do{var h=c.nextSibling;if(c.nodeType===1?i?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(i?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),h&&h.nodeType===8)if(c=h.data,c==="/$"){if(s===0)break;s--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||s++;c=h}while(c)}function Ip(s){var i=s.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var c=i;switch(i=i.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":Ip(c),oi(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}s.removeChild(c)}}function jN(s,i,c,h){for(;s.nodeType===1;){var g=c;if(s.nodeName.toLowerCase()!==i.toLowerCase()){if(!h&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(h){if(!s[us])switch(i){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(v=s.getAttribute("rel"),v==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(v!==g.rel||s.getAttribute("href")!==(g.href==null||g.href===""?null:g.href)||s.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin)||s.getAttribute("title")!==(g.title==null?null:g.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(v=s.getAttribute("src"),(v!==(g.src==null?null:g.src)||s.getAttribute("type")!==(g.type==null?null:g.type)||s.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin))&&v&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(i==="input"&&s.type==="hidden"){var v=g.name==null?null:""+g.name;if(g.type==="hidden"&&s.getAttribute("name")===v)return s}else return s;if(s=Ir(s.nextSibling),s===null)break}return null}function NN(s,i,c){if(i==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!c||(s=Ir(s.nextSibling),s===null))return null;return s}function kb(s,i){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!i||(s=Ir(s.nextSibling),s===null))return null;return s}function Hp(s){return s.data==="$?"||s.data==="$~"}function qp(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function CN(s,i){var c=s.ownerDocument;if(s.data==="$~")s._reactRetry=i;else if(s.data!=="$?"||c.readyState!=="loading")i();else{var h=function(){i(),c.removeEventListener("DOMContentLoaded",h)};c.addEventListener("DOMContentLoaded",h),s._reactRetry=h}}function Ir(s){for(;s!=null;s=s.nextSibling){var i=s.nodeType;if(i===1||i===3)break;if(i===8){if(i=s.data,i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"||i==="F!"||i==="F")break;if(i==="/$"||i==="/&")return null}}return s}var Vp=null;function Sb(s){s=s.nextSibling;for(var i=0;s;){if(s.nodeType===8){var c=s.data;if(c==="/$"||c==="/&"){if(i===0)return Ir(s.nextSibling);i--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||i++}s=s.nextSibling}return null}function jb(s){s=s.previousSibling;for(var i=0;s;){if(s.nodeType===8){var c=s.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(i===0)return s;i--}else c!=="/$"&&c!=="/&"||i++}s=s.previousSibling}return null}function Nb(s,i,c){switch(i=dd(c),s){case"html":if(s=i.documentElement,!s)throw Error(r(452));return s;case"head":if(s=i.head,!s)throw Error(r(453));return s;case"body":if(s=i.body,!s)throw Error(r(454));return s;default:throw Error(r(451))}}function Zo(s){for(var i=s.attributes;i.length;)s.removeAttributeNode(i[0]);oi(s)}var Hr=new Map,Cb=new Set;function hd(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var Vs=$.d;$.d={f:EN,r:AN,D:TN,C:MN,L:RN,m:DN,X:ON,S:LN,M:zN};function EN(){var s=Vs.f(),i=rd();return s||i}function AN(s){var i=Jn(s);i!==null&&i.tag===5&&i.type==="form"?q0(i):Vs.r(s)}var kl=typeof document>"u"?null:document;function Eb(s,i,c){var h=kl;if(h&&typeof i=="string"&&i){var g=un(i);g='link[rel="'+s+'"][href="'+g+'"]',typeof c=="string"&&(g+='[crossorigin="'+c+'"]'),Cb.has(g)||(Cb.add(g),s={rel:s,crossOrigin:c,href:i},h.querySelector(g)===null&&(i=h.createElement("link"),Ln(i,"link",s),nn(i),h.head.appendChild(i)))}}function TN(s){Vs.D(s),Eb("dns-prefetch",s,null)}function MN(s,i){Vs.C(s,i),Eb("preconnect",s,i)}function RN(s,i,c){Vs.L(s,i,c);var h=kl;if(h&&s&&i){var g='link[rel="preload"][as="'+un(i)+'"]';i==="image"&&c&&c.imageSrcSet?(g+='[imagesrcset="'+un(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(g+='[imagesizes="'+un(c.imageSizes)+'"]')):g+='[href="'+un(s)+'"]';var v=g;switch(i){case"style":v=Sl(s);break;case"script":v=jl(s)}Hr.has(v)||(s=x({rel:"preload",href:i==="image"&&c&&c.imageSrcSet?void 0:s,as:i},c),Hr.set(v,s),h.querySelector(g)!==null||i==="style"&&h.querySelector(Jo(v))||i==="script"&&h.querySelector(ec(v))||(i=h.createElement("link"),Ln(i,"link",s),nn(i),h.head.appendChild(i)))}}function DN(s,i){Vs.m(s,i);var c=kl;if(c&&s){var h=i&&typeof i.as=="string"?i.as:"script",g='link[rel="modulepreload"][as="'+un(h)+'"][href="'+un(s)+'"]',v=g;switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=jl(s)}if(!Hr.has(v)&&(s=x({rel:"modulepreload",href:s},i),Hr.set(v,s),c.querySelector(g)===null)){switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(ec(v)))return}h=c.createElement("link"),Ln(h,"link",s),nn(h),c.head.appendChild(h)}}}function LN(s,i,c){Vs.S(s,i,c);var h=kl;if(h&&s){var g=ds(h).hoistableStyles,v=Sl(s);i=i||"default";var S=g.get(v);if(!S){var A={loading:0,preload:null};if(S=h.querySelector(Jo(v)))A.loading=5;else{s=x({rel:"stylesheet",href:s,"data-precedence":i},c),(c=Hr.get(v))&&Gp(s,c);var F=S=h.createElement("link");nn(F),Ln(F,"link",s),F._p=new Promise(function(ee,ue){F.onload=ee,F.onerror=ue}),F.addEventListener("load",function(){A.loading|=1}),F.addEventListener("error",function(){A.loading|=2}),A.loading|=4,fd(S,i,h)}S={type:"stylesheet",instance:S,count:1,state:A},g.set(v,S)}}}function ON(s,i){Vs.X(s,i);var c=kl;if(c&&s){var h=ds(c).hoistableScripts,g=jl(s),v=h.get(g);v||(v=c.querySelector(ec(g)),v||(s=x({src:s,async:!0},i),(i=Hr.get(g))&&Yp(s,i),v=c.createElement("script"),nn(v),Ln(v,"link",s),c.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},h.set(g,v))}}function zN(s,i){Vs.M(s,i);var c=kl;if(c&&s){var h=ds(c).hoistableScripts,g=jl(s),v=h.get(g);v||(v=c.querySelector(ec(g)),v||(s=x({src:s,async:!0,type:"module"},i),(i=Hr.get(g))&&Yp(s,i),v=c.createElement("script"),nn(v),Ln(v,"link",s),c.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},h.set(g,v))}}function Ab(s,i,c,h){var g=(g=Ce.current)?hd(g):null;if(!g)throw Error(r(446));switch(s){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(i=Sl(c.href),c=ds(g).hoistableStyles,h=c.get(i),h||(h={type:"style",instance:null,count:0,state:null},c.set(i,h)),h):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){s=Sl(c.href);var v=ds(g).hoistableStyles,S=v.get(s);if(S||(g=g.ownerDocument||g,S={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(s,S),(v=g.querySelector(Jo(s)))&&!v._p&&(S.instance=v,S.state.loading=5),Hr.has(s)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},Hr.set(s,c),v||BN(g,s,c,S.state))),i&&h===null)throw Error(r(528,""));return S}if(i&&h!==null)throw Error(r(529,""));return null;case"script":return i=c.async,c=c.src,typeof c=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=jl(c),c=ds(g).hoistableScripts,h=c.get(i),h||(h={type:"script",instance:null,count:0,state:null},c.set(i,h)),h):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,s))}}function Sl(s){return'href="'+un(s)+'"'}function Jo(s){return'link[rel="stylesheet"]['+s+"]"}function Tb(s){return x({},s,{"data-precedence":s.precedence,precedence:null})}function BN(s,i,c,h){s.querySelector('link[rel="preload"][as="style"]['+i+"]")?h.loading=1:(i=s.createElement("link"),h.preload=i,i.addEventListener("load",function(){return h.loading|=1}),i.addEventListener("error",function(){return h.loading|=2}),Ln(i,"link",c),nn(i),s.head.appendChild(i))}function jl(s){return'[src="'+un(s)+'"]'}function ec(s){return"script[async]"+s}function Mb(s,i,c){if(i.count++,i.instance===null)switch(i.type){case"style":var h=s.querySelector('style[data-href~="'+un(c.href)+'"]');if(h)return i.instance=h,nn(h),h;var g=x({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return h=(s.ownerDocument||s).createElement("style"),nn(h),Ln(h,"style",g),fd(h,c.precedence,s),i.instance=h;case"stylesheet":g=Sl(c.href);var v=s.querySelector(Jo(g));if(v)return i.state.loading|=4,i.instance=v,nn(v),v;h=Tb(c),(g=Hr.get(g))&&Gp(h,g),v=(s.ownerDocument||s).createElement("link"),nn(v);var S=v;return S._p=new Promise(function(A,F){S.onload=A,S.onerror=F}),Ln(v,"link",h),i.state.loading|=4,fd(v,c.precedence,s),i.instance=v;case"script":return v=jl(c.src),(g=s.querySelector(ec(v)))?(i.instance=g,nn(g),g):(h=c,(g=Hr.get(v))&&(h=x({},c),Yp(h,g)),s=s.ownerDocument||s,g=s.createElement("script"),nn(g),Ln(g,"link",h),s.head.appendChild(g),i.instance=g);case"void":return null;default:throw Error(r(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(h=i.instance,i.state.loading|=4,fd(h,c.precedence,s));return i.instance}function fd(s,i,c){for(var h=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),g=h.length?h[h.length-1]:null,v=g,S=0;S<h.length;S++){var A=h[S];if(A.dataset.precedence===i)v=A;else if(v!==g)break}v?v.parentNode.insertBefore(s,v.nextSibling):(i=c.nodeType===9?c.head:c,i.insertBefore(s,i.firstChild))}function Gp(s,i){s.crossOrigin==null&&(s.crossOrigin=i.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=i.referrerPolicy),s.title==null&&(s.title=i.title)}function Yp(s,i){s.crossOrigin==null&&(s.crossOrigin=i.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=i.referrerPolicy),s.integrity==null&&(s.integrity=i.integrity)}var pd=null;function Rb(s,i,c){if(pd===null){var h=new Map,g=pd=new Map;g.set(c,h)}else g=pd,h=g.get(c),h||(h=new Map,g.set(c,h));if(h.has(s))return h;for(h.set(s,null),c=c.getElementsByTagName(s),g=0;g<c.length;g++){var v=c[g];if(!(v[us]||v[en]||s==="link"&&v.getAttribute("rel")==="stylesheet")&&v.namespaceURI!=="http://www.w3.org/2000/svg"){var S=v.getAttribute(i)||"";S=s+S;var A=h.get(S);A?A.push(v):h.set(S,[v])}}return h}function Db(s,i,c){s=s.ownerDocument||s,s.head.insertBefore(c,i==="title"?s.querySelector("head > title"):null)}function PN(s,i,c){if(c===1||i.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;switch(i.rel){case"stylesheet":return s=i.disabled,typeof i.precedence=="string"&&s==null;default:return!0}case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function Lb(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function $N(s,i,c,h){if(c.type==="stylesheet"&&(typeof h.media!="string"||matchMedia(h.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var g=Sl(h.href),v=i.querySelector(Jo(g));if(v){i=v._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(s.count++,s=md.bind(s),i.then(s,s)),c.state.loading|=4,c.instance=v,nn(v);return}v=i.ownerDocument||i,h=Tb(h),(g=Hr.get(g))&&Gp(h,g),v=v.createElement("link"),nn(v);var S=v;S._p=new Promise(function(A,F){S.onload=A,S.onerror=F}),Ln(v,"link",h),c.instance=v}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(c,i),(i=c.state.preload)&&(c.state.loading&3)===0&&(s.count++,c=md.bind(s),i.addEventListener("load",c),i.addEventListener("error",c))}}var Wp=0;function FN(s,i){return s.stylesheets&&s.count===0&&xd(s,s.stylesheets),0<s.count||0<s.imgCount?function(c){var h=setTimeout(function(){if(s.stylesheets&&xd(s,s.stylesheets),s.unsuspend){var v=s.unsuspend;s.unsuspend=null,v()}},6e4+i);0<s.imgBytes&&Wp===0&&(Wp=62500*yN());var g=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&xd(s,s.stylesheets),s.unsuspend)){var v=s.unsuspend;s.unsuspend=null,v()}},(s.imgBytes>Wp?50:800)+i);return s.unsuspend=c,function(){s.unsuspend=null,clearTimeout(h),clearTimeout(g)}}:null}function md(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)xd(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var gd=null;function xd(s,i){s.stylesheets=null,s.unsuspend!==null&&(s.count++,gd=new Map,i.forEach(UN,s),gd=null,md.call(s))}function UN(s,i){if(!(i.state.loading&4)){var c=gd.get(s);if(c)var h=c.get(null);else{c=new Map,gd.set(s,c);for(var g=s.querySelectorAll("link[data-precedence],style[data-precedence]"),v=0;v<g.length;v++){var S=g[v];(S.nodeName==="LINK"||S.getAttribute("media")!=="not all")&&(c.set(S.dataset.precedence,S),h=S)}h&&c.set(null,h)}g=i.instance,S=g.getAttribute("data-precedence"),v=c.get(S)||h,v===h&&c.set(null,g),c.set(S,g),this.count++,h=md.bind(this),g.addEventListener("load",h),g.addEventListener("error",h),v?v.parentNode.insertBefore(g,v.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(g,s.firstChild)),i.state.loading|=4}}var tc={$$typeof:C,Provider:null,Consumer:null,_currentValue:re,_currentValue2:re,_threadCount:0};function IN(s,i,c,h,g,v,S,A,F){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=$n(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=$n(0),this.hiddenUpdates=$n(null),this.identifierPrefix=h,this.onUncaughtError=g,this.onCaughtError=v,this.onRecoverableError=S,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=F,this.incompleteTransitions=new Map}function Ob(s,i,c,h,g,v,S,A,F,ee,ue,fe){return s=new IN(s,i,c,S,F,ee,ue,fe,A),i=1,v===!0&&(i|=24),v=gr(3,null,null,i),s.current=v,v.stateNode=s,i=Cf(),i.refCount++,s.pooledCache=i,i.refCount++,v.memoizedState={element:h,isDehydrated:c,cache:i},Mf(v),s}function zb(s){return s?(s=nl,s):nl}function Bb(s,i,c,h,g,v){g=zb(g),h.context===null?h.context=g:h.pendingContext=g,h=_i(i),h.payload={element:c},v=v===void 0?null:v,v!==null&&(h.callback=v),c=wi(s,h,i),c!==null&&(ar(c,s,i),Do(c,s,i))}function Pb(s,i){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var c=s.retryLane;s.retryLane=c!==0&&c<i?c:i}}function Qp(s,i){Pb(s,i),(s=s.alternate)&&Pb(s,i)}function $b(s){if(s.tag===13||s.tag===31){var i=ua(s,67108864);i!==null&&ar(i,s,67108864),Qp(s,67108864)}}function Fb(s){if(s.tag===13||s.tag===31){var i=_r();i=Wn(i);var c=ua(s,i);c!==null&&ar(c,s,i),Qp(s,i)}}var vd=!0;function HN(s,i,c,h){var g=P.T;P.T=null;var v=$.p;try{$.p=2,Xp(s,i,c,h)}finally{$.p=v,P.T=g}}function qN(s,i,c,h){var g=P.T;P.T=null;var v=$.p;try{$.p=8,Xp(s,i,c,h)}finally{$.p=v,P.T=g}}function Xp(s,i,c,h){if(vd){var g=Kp(h);if(g===null)zp(s,i,h,bd,c),Ib(s,h);else if(GN(g,s,i,c,h))h.stopPropagation();else if(Ib(s,h),i&4&&-1<VN.indexOf(s)){for(;g!==null;){var v=Jn(g);if(v!==null)switch(v.tag){case 3:if(v=v.stateNode,v.current.memoizedState.isDehydrated){var S=ve(v.pendingLanes);if(S!==0){var A=v;for(A.pendingLanes|=2,A.entangledLanes|=2;S;){var F=1<<31-st(S);A.entanglements[1]|=F,S&=~F}vs(v),(Ct&6)===0&&(td=Te()+500,Qo(0))}}break;case 31:case 13:A=ua(v,2),A!==null&&ar(A,v,2),rd(),Qp(v,2)}if(v=Kp(h),v===null&&zp(s,i,h,bd,c),v===g)break;g=v}g!==null&&h.stopPropagation()}else zp(s,i,h,null,c)}}function Kp(s){return s=Qa(s),Zp(s)}var bd=null;function Zp(s){if(bd=null,s=As(s),s!==null){var i=o(s);if(i===null)s=null;else{var c=i.tag;if(c===13){if(s=u(i),s!==null)return s;s=null}else if(c===31){if(s=d(i),s!==null)return s;s=null}else if(c===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;s=null}else i!==s&&(s=null)}}return bd=s,null}function Ub(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"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Xr()){case oe:return 2;case ke:return 8;case W:case xe:return 32;case Oe:return 268435456;default:return 32}default:return 32}}var Jp=!1,Di=null,Li=null,Oi=null,nc=new Map,rc=new Map,zi=[],VN="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 Ib(s,i){switch(s){case"focusin":case"focusout":Di=null;break;case"dragenter":case"dragleave":Li=null;break;case"mouseover":case"mouseout":Oi=null;break;case"pointerover":case"pointerout":nc.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":rc.delete(i.pointerId)}}function sc(s,i,c,h,g,v){return s===null||s.nativeEvent!==v?(s={blockedOn:i,domEventName:c,eventSystemFlags:h,nativeEvent:v,targetContainers:[g]},i!==null&&(i=Jn(i),i!==null&&$b(i)),s):(s.eventSystemFlags|=h,i=s.targetContainers,g!==null&&i.indexOf(g)===-1&&i.push(g),s)}function GN(s,i,c,h,g){switch(i){case"focusin":return Di=sc(Di,s,i,c,h,g),!0;case"dragenter":return Li=sc(Li,s,i,c,h,g),!0;case"mouseover":return Oi=sc(Oi,s,i,c,h,g),!0;case"pointerover":var v=g.pointerId;return nc.set(v,sc(nc.get(v)||null,s,i,c,h,g)),!0;case"gotpointercapture":return v=g.pointerId,rc.set(v,sc(rc.get(v)||null,s,i,c,h,g)),!0}return!1}function Hb(s){var i=As(s.target);if(i!==null){var c=o(i);if(c!==null){if(i=c.tag,i===13){if(i=u(c),i!==null){s.blockedOn=i,fo(s.priority,function(){Fb(c)});return}}else if(i===31){if(i=d(c),i!==null){s.blockedOn=i,fo(s.priority,function(){Fb(c)});return}}else if(i===3&&c.stateNode.current.memoizedState.isDehydrated){s.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}s.blockedOn=null}function yd(s){if(s.blockedOn!==null)return!1;for(var i=s.targetContainers;0<i.length;){var c=Kp(s.nativeEvent);if(c===null){c=s.nativeEvent;var h=new c.constructor(c.type,c);hi=h,c.target.dispatchEvent(h),hi=null}else return i=Jn(c),i!==null&&$b(i),s.blockedOn=c,!1;i.shift()}return!0}function qb(s,i,c){yd(s)&&c.delete(i)}function YN(){Jp=!1,Di!==null&&yd(Di)&&(Di=null),Li!==null&&yd(Li)&&(Li=null),Oi!==null&&yd(Oi)&&(Oi=null),nc.forEach(qb),rc.forEach(qb)}function _d(s,i){s.blockedOn===i&&(s.blockedOn=null,Jp||(Jp=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,YN)))}var wd=null;function Vb(s){wd!==s&&(wd=s,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){wd===s&&(wd=null);for(var i=0;i<s.length;i+=3){var c=s[i],h=s[i+1],g=s[i+2];if(typeof h!="function"){if(Zp(h||c)===null)continue;break}var v=Jn(c);v!==null&&(s.splice(i,3),i-=3,Kf(v,{pending:!0,data:g,method:c.method,action:h},h,g))}}))}function Nl(s){function i(F){return _d(F,s)}Di!==null&&_d(Di,s),Li!==null&&_d(Li,s),Oi!==null&&_d(Oi,s),nc.forEach(i),rc.forEach(i);for(var c=0;c<zi.length;c++){var h=zi[c];h.blockedOn===s&&(h.blockedOn=null)}for(;0<zi.length&&(c=zi[0],c.blockedOn===null);)Hb(c),c.blockedOn===null&&zi.shift();if(c=(s.ownerDocument||s).$$reactFormReplay,c!=null)for(h=0;h<c.length;h+=3){var g=c[h],v=c[h+1],S=g[Tn]||null;if(typeof v=="function")S||Vb(c);else if(S){var A=null;if(v&&v.hasAttribute("formAction")){if(g=v,S=v[Tn]||null)A=S.formAction;else if(Zp(g)!==null)continue}else A=S.action;typeof A=="function"?c[h+1]=A:(c.splice(h,3),h-=3),Vb(c)}}}function Gb(){function s(v){v.canIntercept&&v.info==="react-transition"&&v.intercept({handler:function(){return new Promise(function(S){return g=S})},focusReset:"manual",scroll:"manual"})}function i(){g!==null&&(g(),g=null),h||setTimeout(c,20)}function c(){if(!h&&!navigation.transition){var v=navigation.currentEntry;v&&v.url!=null&&navigation.navigate(v.url,{state:v.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var h=!1,g=null;return navigation.addEventListener("navigate",s),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(c,100),function(){h=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),g!==null&&(g(),g=null)}}}function em(s){this._internalRoot=s}kd.prototype.render=em.prototype.render=function(s){var i=this._internalRoot;if(i===null)throw Error(r(409));var c=i.current,h=_r();Bb(c,h,s,i,null,null)},kd.prototype.unmount=em.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var i=s.containerInfo;Bb(s.current,2,null,s,null,null),rd(),i[pr]=null}};function kd(s){this._internalRoot=s}kd.prototype.unstable_scheduleHydration=function(s){if(s){var i=ho();s={blockedOn:null,target:s,priority:i};for(var c=0;c<zi.length&&i!==0&&i<zi[c].priority;c++);zi.splice(c,0,s),c===0&&Hb(s)}};var Yb=t.version;if(Yb!=="19.2.8")throw Error(r(527,Yb,"19.2.8"));$.findDOMNode=function(s){var i=s._reactInternals;if(i===void 0)throw typeof s.render=="function"?Error(r(188)):(s=Object.keys(s).join(","),Error(r(268,s)));return s=p(i),s=s!==null?m(s):null,s=s===null?null:s.stateNode,s};var WN={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:P,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Sd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Sd.isDisabled&&Sd.supportsFiber)try{ot=Sd.inject(WN),Et=Sd}catch{}}return ac.createRoot=function(s,i){if(!a(s))throw Error(r(299));var c=!1,h="",g=e1,v=t1,S=n1;return i!=null&&(i.unstable_strictMode===!0&&(c=!0),i.identifierPrefix!==void 0&&(h=i.identifierPrefix),i.onUncaughtError!==void 0&&(g=i.onUncaughtError),i.onCaughtError!==void 0&&(v=i.onCaughtError),i.onRecoverableError!==void 0&&(S=i.onRecoverableError)),i=Ob(s,1,!1,null,null,c,h,null,g,v,S,Gb),s[pr]=i.current,Op(s),new em(i)},ac.hydrateRoot=function(s,i,c){if(!a(s))throw Error(r(299));var h=!1,g="",v=e1,S=t1,A=n1,F=null;return c!=null&&(c.unstable_strictMode===!0&&(h=!0),c.identifierPrefix!==void 0&&(g=c.identifierPrefix),c.onUncaughtError!==void 0&&(v=c.onUncaughtError),c.onCaughtError!==void 0&&(S=c.onCaughtError),c.onRecoverableError!==void 0&&(A=c.onRecoverableError),c.formState!==void 0&&(F=c.formState)),i=Ob(s,1,!0,i,c??null,h,g,F,v,S,A,Gb),i.context=zb(null),c=i.current,h=_r(),h=Wn(h),g=_i(h),g.callback=null,wi(c,g,h),c=h,i.current.lanes=c,Vt(i,c),vs(i),s[pr]=i.current,Op(s),new kd(i)},ac.version="19.2.8",ac}var iy;function lC(){if(iy)return rm.exports;iy=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(),rm.exports=aC(),rm.exports}var oC=lC();const ay=e=>{let t;const n=new Set,r=(p,m)=>{const x=typeof p=="function"?p(t):p;if(!Object.is(x,t)){const b=t;t=m??(typeof x!="object"||x===null)?x:Object.assign({},t,x),n.forEach(y=>y(t,b))}},a=()=>t,d={setState:r,getState:a,getInitialState:()=>f,subscribe:p=>(n.add(p),()=>n.delete(p))},f=t=e(r,a,d);return d},cC=(e=>e?ay(e):ay),uC=e=>e;function dC(e,t=uC){const n=jd.useSyncExternalStore(e.subscribe,jd.useCallback(()=>t(e.getState()),[e,t]),jd.useCallback(()=>t(e.getInitialState()),[e,t]));return jd.useDebugValue(n),n}const ly=e=>{const t=cC(e),n=r=>dC(t,r);return Object.assign(n,t),n},hC=(e=>e?ly(e):ly),fg="companion_auth_token";function oy(){return typeof window>"u"?null:localStorage.getItem(fg)||null}const fC=e=>({authToken:oy(),isAuthenticated:oy()!==null,setAuthToken:t=>{localStorage.setItem(fg,t),e({authToken:t,isAuthenticated:!0})},logout:()=>{localStorage.removeItem(fg),e({authToken:null,isAuthenticated:!1})}});function Qt(e,t){if(!e.has(t))return e;const n=new Map(e);return n.delete(t),n}function pC(e,t){if(!e.has(t))return e;const n=new Set(e);return n.delete(t),n}function mC(){if(typeof window>"u")return new Map;try{return new Map(JSON.parse(localStorage.getItem("cc-session-names")||"[]"))}catch{return new Map}}function gC(){return typeof window>"u"?null:localStorage.getItem("cc-current-session")||null}function xC(){if(typeof window>"u")return new Set;try{return new Set(JSON.parse(localStorage.getItem("cc-collapsed-projects")||"[]"))}catch{return new Set}}const vC=e=>({sessions:new Map,sdkSessions:[],currentSessionId:gC(),connectionStatus:new Map,cliConnected:new Map,cliReconnecting:new Map,sessionStatus:new Map,previousPermissionMode:new Map,sessionNames:mC(),recentlyRenamed:new Set,prStatus:new Map,linkedLinearIssues:new Map,mcpServers:new Map,rateLimit:new Map,collapsedProjects:xC(),setCurrentSession:t=>{t?localStorage.setItem("cc-current-session",t):localStorage.removeItem("cc-current-session"),e({currentSessionId:t})},addSession:t=>e(n=>{const r=new Map(n.sessions);r.set(t.session_id,t);const a=new Map(n.messages);return a.has(t.session_id)||a.set(t.session_id,[]),{sessions:r,messages:a}}),updateSession:(t,n)=>e(r=>{const a=new Map(r.sessions),o=a.get(t);return o&&a.set(t,{...o,...n}),{sessions:a}}),removeSession:t=>e(n=>{const r=Qt(n.sessionNames,t);return localStorage.setItem("cc-session-names",JSON.stringify(Array.from(r.entries()))),n.currentSessionId===t&&localStorage.removeItem("cc-current-session"),{sessions:Qt(n.sessions,t),connectionStatus:Qt(n.connectionStatus,t),cliConnected:Qt(n.cliConnected,t),cliReconnecting:Qt(n.cliReconnecting,t),sessionStatus:Qt(n.sessionStatus,t),previousPermissionMode:Qt(n.previousPermissionMode,t),sessionNames:r,recentlyRenamed:pC(n.recentlyRenamed,t),mcpServers:Qt(n.mcpServers,t),rateLimit:Qt(n.rateLimit,t),prStatus:Qt(n.prStatus,t),linkedLinearIssues:Qt(n.linkedLinearIssues,t),sdkSessions:n.sdkSessions.filter(a=>a.sessionId!==t),currentSessionId:n.currentSessionId===t?null:n.currentSessionId,messages:Qt(n.messages,t),streaming:Qt(n.streaming,t),streamingStartedAt:Qt(n.streamingStartedAt,t),streamingOutputTokens:Qt(n.streamingOutputTokens,t),pendingPermissions:Qt(n.pendingPermissions,t),aiResolvedPermissions:Qt(n.aiResolvedPermissions,t),sessionTasks:Qt(n.sessionTasks,t),changedFilesTick:Qt(n.changedFilesTick,t),gitChangedFilesCount:Qt(n.gitChangedFilesCount,t),sessionProcesses:Qt(n.sessionProcesses,t),toolProgress:Qt(n.toolProgress,t),toolActivity:Qt(n.toolActivity,t),diffPanelSelectedFile:Qt(n.diffPanelSelectedFile,t),chatTabReentryTickBySession:Qt(n.chatTabReentryTickBySession,t)}}),setSdkSessions:t=>e({sdkSessions:t}),setConnectionStatus:(t,n)=>e(r=>{const a=new Map(r.connectionStatus);return a.set(t,n),{connectionStatus:a}}),setCliConnected:(t,n)=>e(r=>{const a=new Map(r.cliConnected);return a.set(t,n),{cliConnected:a}}),setCliReconnecting:(t,n)=>e(r=>{const a=new Map(r.cliReconnecting);return n?a.set(t,!0):a.delete(t),{cliReconnecting:a}}),setSessionStatus:(t,n)=>e(r=>{const a=new Map(r.sessionStatus);return a.set(t,n),{sessionStatus:a}}),setPreviousPermissionMode:(t,n)=>e(r=>{const a=new Map(r.previousPermissionMode);return a.set(t,n),{previousPermissionMode:a}}),setSessionName:(t,n)=>e(r=>{const a=new Map(r.sessionNames);return a.set(t,n),localStorage.setItem("cc-session-names",JSON.stringify(Array.from(a.entries()))),{sessionNames:a}}),markRecentlyRenamed:t=>e(n=>{const r=new Set(n.recentlyRenamed);return r.add(t),{recentlyRenamed:r}}),clearRecentlyRenamed:t=>e(n=>{const r=new Set(n.recentlyRenamed);return r.delete(t),{recentlyRenamed:r}}),setPRStatus:(t,n)=>e(r=>{const a=new Map(r.prStatus);return a.set(t,n),{prStatus:a}}),setLinkedLinearIssue:(t,n)=>e(r=>{const a=new Map(r.linkedLinearIssues);return n?a.set(t,n):a.delete(t),{linkedLinearIssues:a}}),setMcpServers:(t,n)=>e(r=>{const a=new Map(r.mcpServers);return a.set(t,n),{mcpServers:a}}),setRateLimit:(t,n)=>e(r=>{const a=new Map(r.rateLimit);return a.set(t,n),{rateLimit:a}}),toggleProjectCollapse:t=>e(n=>{const r=new Set(n.collapsedProjects);return r.has(t)?r.delete(t):r.add(t),localStorage.setItem("cc-collapsed-projects",JSON.stringify(Array.from(r))),{collapsedProjects:r}}),setSessionAiValidation:(t,n)=>e(r=>{const a=new Map(r.sessions),o=a.get(t);return o?(a.set(t,{...o,...n}),{sessions:a}):{}}),setSessionMagicUi:(t,n)=>e(r=>{const a=new Map(r.sessions),o=a.get(t);return o?(a.set(t,{...o,magicUiActive:n}),{sessions:a}):{}})}),bC=e=>({messages:new Map,streaming:new Map,streamingStartedAt:new Map,streamingOutputTokens:new Map,lastActivityAt:new Map,appendMessage:(t,n)=>e(r=>{const a=r.messages.get(t)||[];if(n.id&&a.some(u=>u.id===n.id))return r;const o=new Map(r.messages);return o.set(t,[...a,n]),{messages:o}}),setMessages:(t,n)=>e(r=>{const a=new Map(r.messages);return a.set(t,n),{messages:a}}),updateLastAssistantMessage:(t,n)=>e(r=>{const a=new Map(r.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(r=>{const a=new Map(r.streaming);return n===null?a.delete(t):a.set(t,n),{streaming:a}}),setStreamingStats:(t,n)=>e(r=>{const a=new Map(r.streamingStartedAt),o=new Map(r.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(r=>{const a=new Map(r.lastActivityAt);return a.set(t,n),{lastActivityAt:a}}),promptSuggestions:new Map,setPromptSuggestions:(t,n)=>e(r=>{const a=new Map(r.promptSuggestions);return a.set(t,n),{promptSuggestions:a}}),clearPromptSuggestions:t=>e(n=>{const r=new Map(n.promptSuggestions);return r.delete(t),{promptSuggestions:r}})}),yC=e=>({pendingPermissions:new Map,aiResolvedPermissions:new Map,addPermission:(t,n)=>e(r=>{const a=new Map(r.pendingPermissions),o=new Map(a.get(t)||[]);return o.set(n.request_id,n),a.set(t,o),{pendingPermissions:a}}),removePermission:(t,n)=>e(r=>{const a=new Map(r.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(r=>{const a=new Map(r.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 r=new Map(n.aiResolvedPermissions);return r.delete(t),{aiResolvedPermissions:r}})}),_C=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(r=>{const a=new Map(r.sessionTasks),o=[...a.get(t)||[],n];return a.set(t,o),{sessionTasks:a}}),setTasks:(t,n)=>e(r=>{const a=new Map(r.sessionTasks);return a.set(t,n),{sessionTasks:a}}),updateTask:(t,n,r)=>e(a=>{const o=new Map(a.sessionTasks),u=o.get(t);return u&&o.set(t,u.map(d=>d.id===n?{...d,...r}:d)),{sessionTasks:o}}),addProcess:(t,n)=>e(r=>{const a=new Map(r.sessionProcesses),o=[...a.get(t)||[],n];return a.set(t,o),{sessionProcesses:a}}),updateProcess:(t,n,r)=>e(a=>{const o=new Map(a.sessionProcesses),u=o.get(t);return u&&o.set(t,u.map(d=>d.taskId===n?{...d,...r}:d)),{sessionProcesses:o}}),updateProcessByToolUseId:(t,n,r)=>e(a=>{const o=new Map(a.sessionProcesses),u=o.get(t);return u&&o.set(t,u.map(d=>d.toolUseId===n?{...d,...r}:d)),{sessionProcesses:o}}),addBackgroundAgent:(t,n)=>e(r=>{const a=new Map(r.sessionBackgroundAgents),o=[...a.get(t)||[],n];return a.set(t,o),{sessionBackgroundAgents:a}}),updateBackgroundAgent:(t,n,r)=>e(a=>{const o=new Map(a.sessionBackgroundAgents),u=o.get(t);return u&&o.set(t,u.map(d=>d.toolUseId===n?{...d,...r}:d)),{sessionBackgroundAgents:o}}),bumpChangedFilesTick:t=>e(n=>{const r=new Map(n.changedFilesTick);return r.set(t,(r.get(t)??0)+1),{changedFilesTick:r}}),setGitChangedFilesCount:(t,n)=>e(r=>{const a=new Map(r.gitChangedFilesCount);return a.set(t,n),{gitChangedFilesCount:a}}),setToolProgress:(t,n,r)=>e(a=>{const o=new Map(a.toolProgress),u=new Map(o.get(t)||[]);return u.set(n,r),o.set(t,u),{toolProgress:o}}),clearToolProgress:(t,n)=>e(r=>{const a=new Map(r.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(r=>{const a=new Map(r.toolActivity);return n.length===0?a.delete(t):a.set(t,n),{toolActivity:a}}),addToolActivity:(t,n)=>e(r=>{const a=new Map(r.toolActivity),o=[...a.get(t)||[]],u=o.findIndex(d=>d.toolUseId===n.toolUseId);if(u>=0){const d=o[u];o[u]={...d,...n,startedAt:d.startedAt,completedAt:n.completedAt??d.completedAt,elapsedSeconds:Math.max(d.elapsedSeconds,n.elapsedSeconds),isError:d.isError||n.isError}}else o.push(n);return a.set(t,o),{toolActivity:a}}),updateToolActivity:(t,n,r)=>e(a=>{const o=new Map(a.toolActivity),u=o.get(t);return u&&o.set(t,u.map(d=>d.toolUseId===n?{...d,...r}:d)),{toolActivity:o}})}),ii=[{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"]}],wC=ii.map(e=>e.id),hw="cc-task-panel-config";function pg(){return{order:[...wC],enabled:Object.fromEntries(ii.map(e=>[e.id,!0]))}}function kC(){if(typeof window>"u")return pg();try{const e=localStorage.getItem(hw);if(e){const t=JSON.parse(e),n=new Set(t.order);for(const a of ii)n.has(a.id)||(t.order.push(a.id),t.enabled[a.id]=!0);const r=new Set(ii.map(a=>a.id));return t.order=t.order.filter(a=>r.has(a)),t}}catch{}return pg()}function Nd(e){try{localStorage.setItem(hw,JSON.stringify(e))}catch{}}function SC(){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 jC(){if(typeof window>"u")return!0;const e=localStorage.getItem("cc-notification-sound");return e!==null?e==="true":!0}function NC(){if(typeof window>"u")return!1;const e=localStorage.getItem("cc-notification-desktop");return e!==null?e==="true":!1}function fw(){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 CC(){if(typeof window>"u")return"standard";const e=window.localStorage.getItem("cc-density");return e==="standard"||e==="compact"?e:"standard"}const EC=e=>({darkMode:SC(),notificationSound:jC(),notificationDesktop:NC(),sidebarOpen:typeof window<"u"?window.innerWidth>=768:!0,taskPanelOpen:typeof window<"u"?window.innerWidth>=1024:!0,taskPanelConfig:kC(),taskPanelConfigMode:!1,homeResetKey:0,publicUrl:"",magicUiAvailable:!1,activeTab:"chat",chatTabReentryTickBySession:new Map,diffPanelSelectedFile:new Map,diffBase:fw(),density:CC(),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 r={order:[...n.taskPanelConfig.order],enabled:{...n.taskPanelConfig.enabled,[t]:!n.taskPanelConfig.enabled[t]}};return Nd(r),{taskPanelConfig:r}}),moveSectionUp:t=>e(n=>{const r=[...n.taskPanelConfig.order],a=r.indexOf(t);if(a<=0)return n;[r[a-1],r[a]]=[r[a],r[a-1]];const o={...n.taskPanelConfig,order:r};return Nd(o),{taskPanelConfig:o}}),moveSectionDown:t=>e(n=>{const r=[...n.taskPanelConfig.order],a=r.indexOf(t);if(a<0||a>=r.length-1)return n;[r[a],r[a+1]]=[r[a+1],r[a]];const o={...n.taskPanelConfig,order:r};return Nd(o),{taskPanelConfig:o}}),resetTaskPanelConfig:()=>{const t=pg();Nd(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 r=new Map(n.chatTabReentryTickBySession),a=(r.get(t)??0)+1;return r.set(t,a),{chatTabReentryTickBySession:r}}),setDiffPanelSelectedFile:(t,n)=>e(r=>{const a=new Map(r.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 pw(){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 AC=e=>({quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalPlacement:pw(),quickTerminalNextHostIndex:1,quickTerminalNextDockerIndex:1,terminalOpen:!1,terminalCwd:null,terminalId:null,setQuickTerminalOpen:t=>e({quickTerminalOpen:t}),openQuickTerminal:t=>e(n=>{if(t.reuseIfExists){const p=n.quickTerminalTabs.find(m=>m.cwd===t.cwd&&m.containerId===t.containerId);if(p)return{quickTerminalOpen:!0,activeQuickTerminalTabId:p.id}}const r=t.target==="docker",a=n.quickTerminalNextHostIndex,o=n.quickTerminalNextDockerIndex,u=r?a:a+1,d=r?o+1:o,f={id:`${t.target}-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,label:r?`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:d}}),closeQuickTerminalTab:t=>e(n=>{var o;const r=n.quickTerminalTabs.filter(u=>u.id!==t),a=n.activeQuickTerminalTabId===t?((o=r[0])==null?void 0:o.id)||null:n.activeQuickTerminalTabId;return{quickTerminalTabs:r,activeQuickTerminalTabId:a,quickTerminalOpen:r.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 TC(){return typeof window>"u"?null:localStorage.getItem("cc-update-dismissed")||null}const MC=e=>({updateInfo:null,updateDismissedVersion:TC(),updateOverlayActive:!1,dockerUpdateDialogOpen:!1,creationProgress:null,creationError: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 r=n.creationProgress||[],a=r.findIndex(o=>o.step===t.step);if(a>=0){const o=[...r];return o[a]=t,{creationProgress:o}}return{creationProgress:[...r,t]}}),clearCreation:()=>e({creationProgress:null,creationError:null,sessionCreating:!1,sessionCreatingBackend:null}),setSessionCreating:(t,n)=>e({sessionCreating:t,sessionCreatingBackend:n??null}),setCreationError:t=>e({creationError:t}),setClaudeCompatInfo:t=>e({claudeCompatInfo:t})}),RC=e=>({magicUiState:new Map,setMagicUiState:(t,n)=>e(r=>{const a=r.magicUiState.get(t);if(a&&a.version>n.version)return{};const o=new Map(r.magicUiState);return o.set(t,n),{magicUiState:o}}),clearMagicUiState:t=>e(n=>{if(!n.magicUiState.has(t))return{};const r=new Map(n.magicUiState);return r.delete(t),{magicUiState:r}})}),G=hC((...e)=>({...fC(...e),...vC(...e),...bC(...e),...yC(...e),..._C(...e),...EC(...e),...AC(...e),...MC(...e),...RC(...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:fw(),quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalPlacement:pw(),quickTerminalNextHostIndex:1,quickTerminalNextDockerIndex:1,terminalOpen:!1,terminalCwd:null,terminalId:null})}})),DC=Object.freeze(Object.defineProperty({__proto__:null,useStore:G},Symbol.toStringTag,{value:"Module"})),LC="Your Claude login has expired or is invalid — re-authenticate (run `claude login` in a terminal), then use Reconnect to resume this session.",OC=/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 zC(e){return OC.test(e)}function BC(e){return e.is_error?e.api_error_status===401||e.api_error_status===403?!0:zC(`${e.result??""} ${(e.errors??[]).join(" ")}`):!1}const cy=["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"],uy=["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 dy(){const e=cy[Math.floor(Math.random()*cy.length)],t=uy[Math.floor(Math.random()*uy.length)];return`${e} ${t}`}function mw(e){for(let t=0;t<100;t++){const n=dy();if(!e.has(n))return n}return dy()}let lm=null;function PC(){return lm||(lm=new AudioContext),lm}function $C(){try{const e=PC();e.state==="suspended"&&e.resume();const t=e.currentTime,n=e.createOscillator(),r=e.createGain();n.type="sine",n.frequency.setValueAtTime(659.25,t),r.gain.setValueAtTime(.3,t),r.gain.exponentialRampToValueAtTime(.001,t+.3),n.connect(r),r.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 gw{diff(t,n,r={}){let a;typeof r=="function"?(a=r,r={}):"callback"in r&&(a=r.callback);const o=this.castInput(t,r),u=this.castInput(n,r),d=this.removeEmpty(this.tokenize(o,r)),f=this.removeEmpty(this.tokenize(u,r));return this.diffWithOptionsObj(d,f,r,a)}diffWithOptionsObj(t,n,r,a){var o;const u=E=>{if(E=this.postProcess(E,r),a){setTimeout(function(){a(E)},0);return}else return E},d=n.length,f=t.length;let p=1,m=d+f;r.maxEditLength!=null&&(m=Math.min(m,r.maxEditLength));const x=(o=r.timeout)!==null&&o!==void 0?o:1/0,b=Date.now()+x,y=[{oldPos:-1,lastComponent:void 0}];let _=this.extractCommon(y[0],n,t,0,r);if(y[0].oldPos+1>=f&&_+1>=d)return u(this.buildValues(y[0].lastComponent,n,t));let j=-1/0,N=1/0;const w=()=>{for(let E=Math.max(j,-p);E<=Math.min(N,p);E+=2){let C;const T=y[E-1],O=y[E+1];T&&(y[E-1]=void 0);let z=!1;if(O){const U=O.oldPos-E;z=O&&0<=U&&U<d}const I=T&&T.oldPos+1<f;if(!z&&!I){y[E]=void 0;continue}if(!I||z&&T.oldPos<O.oldPos?C=this.addToPath(O,!0,!1,0,r):C=this.addToPath(T,!1,!0,1,r),_=this.extractCommon(C,n,t,E,r),C.oldPos+1>=f&&_+1>=d)return u(this.buildValues(C.lastComponent,n,t))||!0;y[E]=C,C.oldPos+1>=f&&(N=Math.min(N,E-1)),_+1>=d&&(j=Math.max(j,E+1))}p++};if(a)(function E(){setTimeout(function(){if(p>m||Date.now()>b)return a(void 0);w()||E()},0)})();else for(;p<=m&&Date.now()<=b;){const E=w();if(E)return E}}addToPath(t,n,r,a,o){const u=t.lastComponent;return u&&!o.oneChangePerToken&&u.added===n&&u.removed===r?{oldPos:t.oldPos+a,lastComponent:{count:u.count+1,added:n,removed:r,previousComponent:u.previousComponent}}:{oldPos:t.oldPos+a,lastComponent:{count:1,added:n,removed:r,previousComponent:u}}}extractCommon(t,n,r,a,o){const u=n.length,d=r.length;let f=t.oldPos,p=f-a,m=0;for(;p+1<u&&f+1<d&&this.equals(r[f+1],n[p+1],o);)p++,f++,m++,o.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return m&&!o.oneChangePerToken&&(t.lastComponent={count:m,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=f,p}equals(t,n,r){return r.comparator?r.comparator(t,n):t===n||!!r.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){const n=[];for(let r=0;r<t.length;r++)t[r]&&n.push(t[r]);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,r){const a=[];let o;for(;t;)a.push(t),o=t.previousComponent,delete t.previousComponent,t=o;a.reverse();const u=a.length;let d=0,f=0,p=0;for(;d<u;d++){const m=a[d];if(m.removed)m.value=this.join(r.slice(p,p+m.count)),p+=m.count;else{if(!m.added&&this.useLongestToken){let x=n.slice(f,f+m.count);x=x.map(function(b,y){const _=r[p+y];return _.length>b.length?_:b}),m.value=this.join(x)}else m.value=this.join(n.slice(f,f+m.count));f+=m.count,m.added||(p+=m.count)}}return a}}function hy(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 fy(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 mg(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 gg(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 mg(e,t,"")}function Cd(e,t){return gg(e,t,"")}function py(e,t){return t.slice(0,FC(e,t))}function FC(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);const a=Array(r);let o=0;a[0]=0;for(let u=1;u<r;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 xw(e,t){const n=[];for(const r of Array.from(t.segment(e))){const a=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(a)?n[n.length-1]+=a:n.push(a)}return n}function xg(e,t){if(t)return Ac(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function Bl(e,t){if(t)return Ac(e,t)[0];const n=e.match(/^\s*/);return n?n[0]:""}function Ac(e,t){if(!t)return[Bl(e),xg(e)];if(t.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');const n=xw(e,t),r=n[0],a=n[n.length-1],o=/\s/.test(r)?r:"",u=/\s/.test(a)?a:"";return[o,u]}const my="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}",UC=new RegExp(`[${my}]+|\\s+|[^${my}]`,"ug");class IC extends gw{equals(t,n,r){return r.ignoreCase&&(t=t.toLowerCase(),n=n.toLowerCase()),t.trim()===n.trim()}tokenize(t,n={}){let r;if(n.intlSegmenter){const u=n.intlSegmenter;if(u.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');r=xw(t,u)}else r=t.match(UC)||[];const a=[];let o=null;return r.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,r)=>r==0?n:n.replace(/^\s+/,"")).join("")}postProcess(t,n){if(!t||n.oneChangePerToken)return t;let r=null,a=null,o=null;return t.forEach(u=>{u.added?a=u:u.removed?o=u:((a||o)&&gy(r,o,a,u,n.intlSegmenter),r=u,a=null,o=null)}),(a||o)&&gy(r,o,a,null,n.intlSegmenter),t}}const HC=new IC;function qC(e,t,n){return HC.diff(e,t,n)}function gy(e,t,n,r,a){if(t&&n){const[o,u]=Ac(t.value,a),[d,f]=Ac(n.value,a);if(e){const p=hy(o,d);e.value=gg(e.value,d,p),t.value=lc(t.value,p),n.value=lc(n.value,p)}if(r){const p=fy(u,f);r.value=mg(r.value,f,p),t.value=Cd(t.value,p),n.value=Cd(n.value,p)}}else if(n){if(e){const o=Bl(n.value,a);n.value=n.value.substring(o.length)}if(r){const o=Bl(r.value,a);r.value=r.value.substring(o.length)}}else if(e&&r){const o=Bl(r.value,a),[u,d]=Ac(t.value,a),f=hy(o,u);t.value=lc(t.value,f);const p=fy(lc(o,f),d);t.value=Cd(t.value,p),r.value=mg(r.value,o,p),e.value=gg(e.value,o,o.slice(0,o.length-p.length))}else if(r){const o=Bl(r.value,a),u=xg(t.value,a),d=py(u,o);t.value=Cd(t.value,d)}else if(e){const o=xg(e.value,a),u=Bl(t.value,a),d=py(o,u);t.value=lc(t.value,d)}}class VC extends gw{constructor(){super(...arguments),this.tokenize=YC}equals(t,n,r){return r.ignoreWhitespace?((!r.newlineIsToken||!t.includes(`
|
|
51
|
+
`))&&(t=t.trim()),(!r.newlineIsToken||!n.includes(`
|
|
52
|
+
`))&&(n=n.trim())):r.ignoreNewlineAtEof&&!r.newlineIsToken&&(t.endsWith(`
|
|
53
|
+
`)&&(t=t.slice(0,-1)),n.endsWith(`
|
|
54
|
+
`)&&(n=n.slice(0,-1))),super.equals(t,n,r)}}const GC=new VC;function xy(e,t,n){return GC.diff(e,t,n)}function YC(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
|
|
55
|
+
`));const n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let a=0;a<r.length;a++){const o=r[a];a%2&&!t.newlineIsToken?n[n.length-1]+=o:n.push(o)}return n}function WC(e,t,n,r,a,o,u){let d;u?typeof u=="function"?d={callback:u}:d=u:d={},typeof d.context>"u"&&(d.context=4);const f=d.context;if(d.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(d.callback){const{callback:m}=d;xy(n,r,Object.assign(Object.assign({},d),{callback:x=>{const b=p(x);m(b)}}))}else return p(xy(n,r,d));function p(m){if(!m)return;m.push({value:"",lines:[]});function x(E){return E.map(function(C){return" "+C})}const b=[];let y=0,_=0,j=[],N=1,w=1;for(let E=0;E<m.length;E++){const C=m[E],T=C.lines||QC(C.value);if(C.lines=T,C.added||C.removed){if(!y){const O=m[E-1];y=N,_=w,O&&(j=f>0?x(O.lines.slice(-f)):[],y-=j.length,_-=j.length)}for(const O of T)j.push((C.added?"+":"-")+O);C.added?w+=T.length:N+=T.length}else{if(y)if(T.length<=f*2&&E<m.length-2)for(const O of x(T))j.push(O);else{const O=Math.min(T.length,f);for(const I of x(T.slice(0,O)))j.push(I);const z={oldStart:y,oldLines:N-y+O,newStart:_,newLines:w-_+O,lines:j};b.push(z),y=0,_=0,j=[]}N+=T.length,w+=T.length}}for(const E of b)for(let C=0;C<E.lines.length;C++)E.lines[C].endsWith(`
|
|
56
|
+
`)?E.lines[C]=E.lines[C].slice(0,-1):(E.lines.splice(C+1,0,"\"),C++);return{oldFileName:e,newFileName:t,oldHeader:a,newHeader:o,hunks:b}}}function QC(e){const t=e.endsWith(`
|
|
57
|
+
`),n=e.split(`
|
|
58
|
+
`).map(r=>r+`
|
|
59
|
+
`);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function XC(e,t){return WC("","",e,t,"","",{context:3}).hunks.map(r=>{const a=`@@ -${r.oldStart},${r.oldLines} +${r.newStart},${r.newLines} @@`,o=[];let u=r.oldStart,d=r.newStart;for(const f of r.lines){const p=f[0],m=f.slice(1);p==="-"?o.push({type:"del",content:m,oldLineNo:u++}):p==="+"?o.push({type:"add",content:m,newLineNo:d++}):o.push({type:"context",content:m,oldLineNo:u++,newLineNo:d++})}return vw(o),{header:a,lines:o}})}function KC(e){const t=[],n=e.split(`
|
|
60
|
+
`);let r=null,a=null,o=0,u=0;for(const d of n){if(d.startsWith("diff --git")||d.startsWith("diff --cc")){a&&r&&r.hunks.push(a),r&&t.push(r),r={fileName:"",hunks:[]},a=null;continue}if(d.startsWith("--- a/")||d.startsWith("--- /dev/null"))continue;if(d.startsWith("+++ b/")){r&&(r.fileName=d.slice(6));continue}if(d.startsWith("+++ /dev/null")||d.startsWith("index ")||d.startsWith("new file")||d.startsWith("deleted file")||d.startsWith("old mode")||d.startsWith("new mode")||d.startsWith("rename from")||d.startsWith("rename to")||d.startsWith("similarity index")||d.startsWith("Binary files"))continue;const f=d.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@(.*)$/);if(f){a&&r&&r.hunks.push(a),o=parseInt(f[1],10),u=parseInt(f[2],10),a={header:d,lines:[]};continue}a&&(d.startsWith("+")?a.lines.push({type:"add",content:d.slice(1),newLineNo:u++}):d.startsWith("-")?a.lines.push({type:"del",content:d.slice(1),oldLineNo:o++}):d.startsWith(" ")&&a.lines.push({type:"context",content:d.slice(1),oldLineNo:o++,newLineNo:u++}))}a&&r&&r.hunks.push(a),r&&t.push(r);for(const d of t)for(const f of d.hunks)vw(f.lines);return t}function vw(e){let t=0;for(;t<e.length;){const n=t;for(;t<e.length&&e[t].type==="del";)t++;const r=t,a=t;for(;t<e.length&&e[t].type==="add";)t++;const o=t,u=r-n,d=o-a;if(u>0&&d>0){const f=Math.min(u,d);for(let p=0;p<f;p++){const m=e[n+p],x=e[a+p],b=qC(m.content,x.content);m.wordChanges=b.filter(y=>!y.added).map(y=>({value:y.value,removed:y.removed})),x.wordChanges=b.filter(y=>!y.removed).map(y=>({value:y.value,added:y.added}))}}t===n&&t++}}function ZC({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 JC({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,r)=>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(ZC,{line:n}),!n.content&&" "]})]},r))]})}function e3({fileName:e}){const t=e.split("/"),n=t.pop()||e,r=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"})]}),r&&l.jsxs("span",{className:"text-cc-muted",children:[r,"/"]}),l.jsx("span",{className:"font-semibold text-cc-fg",children:n})]})}function ao({oldText:e,newText:t,unifiedDiff:n,fileName:r,mode:a="compact"}){const o=a==="compact",u=!o,d=k.useMemo(()=>{if(n)return KC(n);const f=e??"",p=t??"";if(!f&&!p)return[];const m=XC(f,p);return[{fileName:r||"",hunks:m}]},[e,t,n,r]);return d.length===0||d.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:d.map((f,p)=>l.jsxs("div",{className:"diff-file",children:[(f.fileName||r)&&l.jsx(e3,{fileName:f.fileName||r||""}),f.hunks.map((m,x)=>l.jsx(JC,{hunk:m,showLineNumbers:u},x))]},p))})}const bw=k.createContext(null);function Mz({value:e,children:t}){return l.jsx(bw.Provider,{value:e,children:t})}function t3(){const e=k.useContext(bw),t=G(n=>n.density);return e??t}function $a(){return t3()==="compact"}function Hh({open:e,onToggle:t,marker:n,label:r,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:r}),a&&l.jsx("span",{className:"text-[10px] text-cc-muted/35 shrink-0 ml-auto tabular-nums",children:a})]})}const n3={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 tu(e){return n3[e]||"tool"}function Yi(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 yw({name:e,input:t,toolUseId:n}){const[r,a]=k.useState(e==="Edit"),o=tu(e),u=Yi(e),d=Ic(e,t);return e==="Edit"?l.jsx(r3,{input:t,toolUseId:n}):e==="Bash"?l.jsx(s3,{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(!r),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 ${r?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx(Xl,{type:o}),l.jsx("span",{className:"text-xs font-medium text-cc-fg",children:u}),d&&l.jsx("span",{className:"text-xs text-cc-muted truncate flex-1 font-mono-code",children:d})]}),r&&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(i3,{name:e,input:t})})})]})}function r3({input:e,toolUseId:t}){const n=$a(),[r,a]=k.useState(!1),o=String(e.file_path||""),u=o?o.split("/").pop()||o:"",d=String(e.old_string||""),f=String(e.new_string||""),p=!!(d||f),m=!!e.replace_all,[x,b]=k.useState(!1),_=(Array.isArray(e.changes)?e.changes:[]).map(E=>({path:typeof E.path=="string"?E.path:"",kind:typeof E.kind=="string"?E.kind:"update"})).filter(E=>E.path),j=(d+f).split(`
|
|
61
|
+
`).length,N=j>15,w=l.jsx(l.Fragment,{children:p?l.jsxs("div",{className:"relative mt-1",children:[l.jsx("div",{className:`overflow-hidden ${N&&!x?"max-h-[240px]":""}`,children:l.jsx(ao,{oldText:d,newText:f,mode:"compact"})}),N&&!x&&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(!x),className:"relative z-10 mt-1 text-[11px] text-cc-muted/40 hover:text-cc-muted/70 cursor-pointer transition-colors",children:x?"Show less":`Show all ${j} lines`})]}):_.length>0?l.jsx("div",{className:"mt-1 space-y-1",children:_.map((E,C)=>{const T=E.path.split("/").pop()||E.path;return l.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[l.jsx("span",{className:`text-[9px] font-semibold uppercase ${E.kind==="create"?"text-emerald-600/70 dark:text-emerald-400/70":E.kind==="delete"?"text-cc-error/70":"text-amber-600/70 dark:text-amber-400/70"}`,children:E.kind}),l.jsx("span",{className:"font-mono-code text-cc-fg/60 truncate",children:T})]},`${E.path}-${C}`)})}):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(Hh,{open:r,onToggle:()=>a(!r),marker:"±",label:`Edit ${u||"file"}${m?" (all)":""}`,meta:p?`${j} ${j===1?"line":"lines"}`:void 0,labelClassName:"font-mono-code"}),r&&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}),m&&l.jsx("span",{className:"text-[9px] uppercase tracking-wider font-semibold text-amber-600/70 dark:text-amber-400/70",children:"all"})]}),w]})}function s3({input:e,toolUseId:t}){const n=typeof e.command=="string"?e.command:"",r=typeof e.description=="string"?e.description:"",a=$a(),[o,u]=k.useState(!1);if(a){const d=n.split(`
|
|
62
|
+
`)[0]||"",f=r||d||"Command",p=n?n.split(`
|
|
63
|
+
`).length-1:0;return l.jsxs("div",{"data-tool-use-id":t,children:[l.jsx(Hh,{open:o,onToggle:()=>u(!o),marker:"$",label:f,meta:!o&&p>0?`+${p}`:void 0,labelClassName:r?"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:[r&&l.jsx("div",{className:"text-[11px] text-cc-muted/50 mb-1 italic",children:r}),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 i3({name:e,input:t}){switch(e){case"Bash":return l.jsx(a3,{input:t});case"Edit":return l.jsx(l3,{input:t});case"Write":return l.jsx(o3,{input:t});case"Read":return l.jsx(c3,{input:t});case"Glob":return l.jsx(u3,{input:t});case"Grep":return l.jsx(d3,{input:t});case"WebSearch":case"web_search":return l.jsx(h3,{input:t});case"WebFetch":return l.jsx(f3,{input:t});case"Task":return l.jsx(p3,{input:t});case"TodoWrite":return l.jsx(m3,{input:t});case"NotebookEdit":return l.jsx(g3,{input:t});case"SendMessage":return l.jsx(x3,{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 a3({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 l3({input:e}){const t=String(e.file_path||""),n=String(e.old_string||""),r=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||r?l.jsx(ao,{oldText:n,newText:r,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,d)=>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}-${d}`))]}):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 o3({input:e}){const t=String(e.file_path||""),n=String(e.content||"");return l.jsx(ao,{newText:n,fileName:t,mode:"compact"})}function c3({input:e}){const t=String(e.file_path||e.path||""),n=e.offset,r=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||r!=null)&&l.jsxs("div",{className:"flex gap-2 text-[10px] text-cc-muted",children:[n!=null&&l.jsxs("span",{children:["offset: ",n]}),r!=null&&l.jsxs("span",{children:["limit: ",r]})]})]})}function u3({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 d3({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 h3({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 f3({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 p3({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 m3({input:e}){const t=e.todos;return Array.isArray(t)?l.jsx("div",{className:"space-y-0.5",children:t.map((n,r)=>{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"})]},r)})}):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 g3({input:e}){const t=String(e.notebook_path||""),n=e.cell_type,r=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]}),r&&l.jsxs("span",{children:["mode: ",r]}),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 x3({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 Ic(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),r=t.path?` in ${String(t.path).split("/").slice(-2).join("/")}`:"",a=n+r;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 Xl({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 v3=2e3,b3=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"]),ls=new Map,si=new Map,oh=new Map,Kd=new Map,Ii=new Map,Tc=new Map,Hc=new Map,ch=new Map;function _w(e){return!!e&&(e.readyState===WebSocket.OPEN||e.readyState===WebSocket.CONNECTING)}function ww(e){const t=G.getState(),n=t.sdkSessions.find(r=>r.sessionId===e);return n?!n.archived:t.currentSessionId===e}function y3(){const e=G.getState(),t=new Set;for(const n of e.sdkSessions)n.archived||t.add(n.sessionId);return e.currentSessionId&&t.add(e.currentSessionId),Array.from(t)}let qc=typeof document<"u"?document.hidden:!1;typeof document<"u"&&document.addEventListener("visibilitychange",()=>{if(document.hidden){qc=!0;for(const[e,t]of si)clearTimeout(t),si.delete(e)}else{qc=!1;for(const e of y3()){if(!ww(e))continue;const t=ls.get(e);if(!_w(t)){if(t){try{t.close()}catch{}ls.delete(e)}nu(e)}}}});function Zd(e){const t=e.startsWith("/"),n=e.split("/"),r=[];for(const a of n)if(!(!a||a===".")){if(a===".."){r.length>0&&r.pop();continue}r.push(a)}return`${t?"/":""}${r.join("/")}`}function _3(e,t){return e.startsWith("/")||!t?Zd(e):Zd(`${t}/${e}`)}function w3(e,t){if(!t)return!0;const n=Zd(t);return e===n||e.startsWith(`${n}/`)}function k3(e){let t=ch.get(e);return t||(t=new Set,ch.set(e,t)),t}function om(e,t){const n=G.getState(),r=k3(e);for(const a of t){if(a.type!=="tool_use")continue;const{name:o,input:u,id:d}=a;if(d){if(r.has(d))continue;r.add(d)}if(o==="TodoWrite"){const f=u.todos;if(Array.isArray(f)){const p=f.map((m,x)=>({id:String(x+1),subject:m.content||"Task",description:"",activeForm:m.activeForm,status:m.status||"pending"}));n.setTasks(e,p),Kd.set(e,p.length)}continue}if(o==="TaskCreate"){const f=(Kd.get(e)||0)+1;Kd.set(e,f);const p={id:String(f),subject:u.subject||"Task",description:u.description||"",activeForm:u.activeForm,status:"pending"};n.addTask(e,p);continue}if(o==="TaskUpdate"){const f=u.taskId;if(f){const p={};u.status&&(p.status=u.status),u.owner&&(p.owner=u.owner),u.activeForm!==void 0&&(p.activeForm=u.activeForm),u.addBlockedBy&&(p.blockedBy=u.addBlockedBy),n.updateTask(e,f,p)}}}}function cm(e,t){var o,u;const n=G.getState(),r=((o=n.sessions.get(e))==null?void 0:o.cwd)||((u=n.sdkSessions.find(d=>d.sessionId===e))==null?void 0:u.cwd);let a=!1;for(const d of t){if(d.type!=="tool_use")continue;const{name:f,input:p}=d;if((f==="Edit"||f==="Write")&&typeof p.file_path=="string"){const m=_3(p.file_path,r);w3(m,r)&&(a=!0)}}a&&n.bumpChangedFilesTick(e)}const kc=new Map,S3=/Command running in background with ID:\s*(\S+)\.\s*Output is being written to:\s*(\S+)/;function um(e,t){const n=G.getState();for(const r of t){if(r.type==="tool_use"&&r.name==="Bash"){const a=r.input;if(a.run_in_background===!0){let o=kc.get(e);o||(o=new Map,kc.set(e,o)),o.set(r.id,{command:a.command||"",description:a.description||"",startedAt:Date.now()})}}if(r.type==="tool_result"){const a=r.tool_use_id,o=kc.get(e),u=o==null?void 0:o.get(a);if(o&&u){const f=(typeof r.content=="string"?r.content:Array.isArray(r.content)?r.content.map(p=>"text"in p?p.text:"").join(""):"").match(S3);if(f){const p={taskId:f[1],toolUseId:a,command:u.command,description:u.description,outputFile:f[2],status:"running",startedAt:u.startedAt};n.addProcess(e,p)}o.delete(a),o.size===0&&kc.delete(e)}}}}const Ed=new Map,uh=new Map;function dm(e,t){const n=G.getState();let r=uh.get(e);r||(r=new Set,uh.set(e,r));for(const a of t){if(a.type==="tool_use"&&a.name==="Agent"){if(a.id&&r.has(a.id))continue;const o=a.input;if(o.run_in_background===!0){a.id&&r.add(a.id);let u=Ed.get(e);u||(u=new Map,Ed.set(e,u));const d={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:d.name,description:d.description,agentType:d.agentType,startedAt:d.startedAt}),n.addBackgroundAgent(e,d)}}if(a.type==="tool_result"){const o=a.tool_use_id,u=Ed.get(e),d=u==null?void 0:u.get(o);if(u&&d){const f=typeof a.content=="string"?a.content:Array.isArray(a.content)?a.content.map(m=>"text"in m?m.text:"").join(""):"",p=a.is_error===!0;n.updateBackgroundAgent(e,o,{status:p?"failed":"completed",completedAt:Date.now(),summary:f.length>200?f.slice(0,200)+"...":f}),u.delete(o),u.size===0&&Ed.delete(e)}}}}function vy(e,t,n){typeof Notification>"u"||Notification.permission==="granted"&&new Notification(e,{body:t,tag:n})}function by(e){return e.subtype==="task_notification"?{detail:e.summary||void 0,metaCode:"task_notification"}:{}}function yy(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 j3=0,N3=0;function ys(){return`msg-${Date.now()}-${++j3}`}function _y(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 BC(e)?`${LC}
|
|
64
|
+
|
|
65
|
+
Details: ${t}`:`Error: ${t}`}function C3(e,t){const n=Hc.get(e)||[];n.push(t),Hc.set(e,n)}function E3(e,t){const n=Hc.get(e);if(!(!(n!=null&&n.length)||t.readyState!==WebSocket.OPEN)){Hc.delete(e);for(const r of n)t.send(JSON.stringify(r))}}const Xs=new Map;function wy(e,t,n){const r=G.getState(),a=r.messages.get(e)||[],o=Tc.get(e);let u=a.filter(f=>!f.isStreaming||f.id===o),d=-1;if(o&&(d=u.findIndex(f=>f.id===o),d===-1&&Tc.delete(e)),d===-1){const f=`stream-${e}-${ys()}`;Tc.set(e,f),u=[...u,{id:f,role:"assistant",content:t,timestamp:Date.now(),isStreaming:!0,streamingPhase:n}]}else{u=[...u];const f=u[d];u[d]={...f,role:"assistant",content:t,isStreaming:!0,streamingPhase:n}}r.setMessages(e,u)}function Pi(e){Tc.delete(e);const t=G.getState(),n=t.messages.get(e)||[],r=n.filter(a=>!a.isStreaming);return r.length!==n.length?(t.setMessages(e,r),!0):!1}const ky=new Map,A3=8e3;function Cl(e,t,n={}){if(console.warn(`[companion:session-event] ${t}`,{sessionId:e,...n.detail??{}}),!n.userText)return;const r=Date.now(),a=ky.get(e);a&&a.code===t&&r-a.at<A3||(ky.set(e,{code:t,at:r}),G.getState().appendMessage(e,{id:`companion-notice-${t}-${r}`,role:"system",content:n.userText,timestamp:r,meta:!0,metaCode:t}))}function kw(){return`cmsg-${Date.now()}-${++N3}`}function vg(){return kw()}const T3=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 M3(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 Sw(e){return`companion:last-seq:${e}`}function bg(e){const t=oh.get(e);if(typeof t=="number")return t;try{const n=localStorage.getItem(Sw(e)),r=n?Number(n):0,a=Number.isFinite(r)?Math.max(0,Math.floor(r)):0;return oh.set(e,a),a}catch{return 0}}function Sy(e,t){const n=Math.max(0,Math.floor(t));oh.set(e,n);try{localStorage.setItem(Sw(e),String(n))}catch{}}function jy(e,t){Bn(e,{type:"session_ack",last_seq:t})}function Jd(e){return e.map(t=>t.type==="text"?t.text:t.type==="thinking"?t.thinking:"").filter(Boolean).join(`
|
|
66
|
+
`)}function hm(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 R3(e,t){const n=e||[],r=t||[];if(n.length===0&&r.length===0)return;const a=new Map;for(const d of r)a.set(hm(d),d);const o=[],u=new Set;for(const d of n){const f=hm(d);u.has(f)||(u.add(f),o.push(a.get(f)||d))}for(const d of r){const f=hm(d);u.has(f)||(u.add(f),o.push(d))}return o}function Ny(e,t,n,r,a){return{toolUseId:e,toolName:t,preview:Ic(t,n),startedAt:r,elapsedSeconds:0,isError:!1,parentToolUseId:a||void 0}}function yg(e,t){const n=R3(e.contentBlocks,t.contentBlocks),r=n&&n.length>0?Jd(n):t.content||e.content;return{...e,...t,content:r,contentBlocks:n,timestamp:e.timestamp??t.timestamp,isStreaming:t.isStreaming}}function D3(e,t){const n=G.getState(),r=n.messages.get(e)||[],a=r.findIndex(u=>u.role==="assistant"&&u.id===t.id);if(a===-1){n.appendMessage(e,t);return}const o=[...r];o[a]=yg(o[a],t),n.setMessages(e,o)}function L3(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 r=G.getState();r.connectionStatus.get(e)==="connecting"&&r.setConnectionStatus(e,"connected"),jw(e,n)}function jw(e,t,n={}){var u,d,f,p,m,x;const{processSeq:r=!0,ackSeqMessage:a=!0}=n,o=G.getState();if(r&&typeof t.seq=="number"){const b=bg(e);if(t.seq<=b)return;Sy(e,t.seq),a&&jy(e,t.seq)}switch(b3.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()),_=mw(y);o.setSessionName(e,_)}break}case"session_update":{o.updateSession(e,t.session);break}case"assistant":{const b=t.message;if(b.model==="<synthetic>"){Pi(e),o.setStreaming(e,null),Cl(e,"synthetic_noop",{detail:{stopReason:b.stop_reason,text:Jd(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=Jd(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(Pi(e),D3(e,_),o.setStreaming(e,null),Ii.delete(e),Xs.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()}),(d=b.content)!=null&&d.length)for(const j of b.content){if(j.type==="tool_use"){const N=j.input||{};o.addToolActivity(e,Ny(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&&(om(e,b.content),cm(e,b.content),um(e,b.content),dm(e,b.content));break}case"stream_event":{const b=t.event;if(b&&typeof b=="object"){if(b.type==="message_start"&&(Ii.delete(e),Xs.delete(e),Pi(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 _=Xs.get(e)||{thinking:"",text:""};Ii.get(e)==="thinking"&&(_.thinking=""),_.text+=y.text,Xs.set(e,_),Ii.set(e,"text"),o.setStreaming(e,_.text),wy(e,_.text,"text")}if((y==null?void 0:y.type)==="thinking_delta"&&typeof y.thinking=="string"){const _=Xs.get(e)||{thinking:"",text:""};_.thinking+=y.thinking,Xs.set(e,_),Ii.set(e,"thinking"),o.setStreaming(e,_.thinking),wy(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":{ch.delete(e),uh.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),Pi(e),o.setStreaming(e,null),Ii.delete(e),Xs.delete(e),o.setStreamingStats(e,null),o.clearToolProgress(e),o.setSessionStatus(e,"idle"),!document.hasFocus()&&o.notificationSound&&$C(),!document.hasFocus()&&o.notificationDesktop&&vy("Session completed","Claude finished the task",e),b.is_error&&o.appendMessage(e,{id:ys(),role:"system",content:_y(b),timestamp:Date.now()});break}case"permission_request":{if(o.addPermission(e,t.request),!document.hasFocus()&&o.notificationDesktop){const y=t.request;vy("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}];om(e,y),cm(e,y),um(e,y),dm(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":{((p=o.sdkSessions.find(y=>y.sessionId===e))==null?void 0:p.backendType)==="codex"&&o.appendMessage(e,{id:ys(),role:"system",content:t.summary,timestamp:Date.now()});break}case"user_message":{o.appendMessage(e,{id:t.id||ys(),role:"user",content:t.content,timestamp:t.timestamp||Date.now()}),o.clearPromptSuggestions(e);break}case"system_event":{if(((m=t.event)==null?void 0:m.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=yy(t.event);if(!b)break;o.appendMessage(e,{id:ys(),role:"system",content:b,timestamp:t.timestamp||Date.now(),...by(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:ys(),role:"system",content:`Auth error: ${t.error}`,timestamp:Date.now()});break}case"error":{o.appendMessage(e,{id:ys(),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),Pi(e)?Cl(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."}):Cl(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),Pi(e)&&Cl(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),Pi(e)?Cl(e,"interrupted_mid_stream",{detail:{trigger:"cli_disconnected"},userText:"Response interrupted — the backend disconnected before finishing. Trying to reconnect…"}):Cl(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||ys(),role:"user",content:N.content,timestamp:N.timestamp});else if(N.type==="assistant"){const w=N.message,E=Jd(w.content),C={id:w.id,role:"assistant",content:E,contentBlocks:w.content,timestamp:N.timestamp||Date.now(),parentToolUseId:N.parent_tool_use_id,model:w.model,stopReason:w.stop_reason},T=b.findIndex(O=>O.role==="assistant"&&O.id===C.id);if(T===-1?b.push(C):b[T]=yg(b[T],C),(x=w.content)!=null&&x.length){om(e,w.content),cm(e,w.content),um(e,w.content),dm(e,w.content);const O=N.timestamp||Date.now();for(const z of w.content){if(z.type==="tool_use"){const I=z.input||{},U=y.get(z.id);y.set(z.id,U??Ny(z.id,z.name,I,O,N.parent_tool_use_id))}if(z.type==="tool_result"){const I=y.get(z.tool_use_id);I&&y.set(z.tool_use_id,{...I,completedAt:O,isError:I.isError||!!z.is_error,elapsedSeconds:Math.max(I.elapsedSeconds,I.completedAt?I.elapsedSeconds:Math.max(0,(O-I.startedAt)/1e3))})}}}}else if(N.type==="result"){const w=N.data;w.is_error&&b.push({id:`hist-error-${j}`,role:"system",content:_y(w),timestamp:Date.now()});const E={total_cost_usd:w.total_cost_usd,num_turns:w.num_turns};if(typeof w.total_lines_added=="number"&&(E.total_lines_added=w.total_lines_added),typeof w.total_lines_removed=="number"&&(E.total_lines_removed=w.total_lines_removed),w.modelUsage){for(const C of Object.values(w.modelUsage))if(C.contextWindow>0){const T=C,O=Math.round((T.inputTokens+T.outputTokens)/T.contextWindow*100);E.context_used_percent=Math.max(0,Math.min(O,100))}}o.updateSession(e,E)}else if(N.type==="system_event"){const w=yy(N.event);if(!w)continue;b.push({id:`hist-system-event-${j}`,role:"system",content:w,timestamp:N.timestamp||Date.now(),...by(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 E=N.findIndex(T=>T.id===w.id);if(E===-1){N.push(w);continue}const C=N[E];C.role==="assistant"&&w.role==="assistant"?N[E]=yg(C,w):N[E]=w}N.sort((w,E)=>(w.timestamp??0)-(E.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"&&(Pi(e),o.setStreaming(e,null),Ii.delete(e),Xs.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 _=bg(e);y.seq<=_||(Sy(e,y.seq),b=y.seq,jw(e,y.message,{processSeq:!1,ackSeqMessage:!1}))}typeof b=="number"&&jy(e,b);break}case"prompt_suggestion":{const b=t.suggestions;o.setPromptSuggestions(e,b);break}case"streamlined_text":{o.appendMessage(e,{id:ys(),role:"assistant",content:t.text,timestamp:Date.now()});break}case"streamlined_tool_use_summary":{o.appendMessage(e,{id:ys(),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 nu(e){const t=ls.get(e);if(_w(t))return;if(t){try{t.close()}catch{}ls.delete(e)}G.getState().setConnectionStatus(e,"connecting");const r=new WebSocket(M3(e));ls.set(e,r),r.onopen=()=>{const a=bg(e);r.send(JSON.stringify({type:"session_subscribe",last_seq:a})),E3(e,r);const o=si.get(e);o&&(clearTimeout(o),si.delete(e))},r.onmessage=a=>L3(e,a),r.onclose=()=>{ls.get(e)===r&&(ls.delete(e),G.getState().setConnectionStatus(e,"disconnected"),O3(e))},r.onerror=()=>{r.close()}}function O3(e){if(si.has(e)||qc)return;const t=setTimeout(()=>{si.delete(e),!qc&&ww(e)&&nu(e)},v3);si.set(e,t)}function _g(e){const t=si.get(e);t&&(clearTimeout(t),si.delete(e));const n=ls.get(e);n&&(n.close(),ls.delete(e)),G.getState().setConnectionStatus(e,"disconnected"),ch.delete(e),uh.delete(e),kc.delete(e),Kd.delete(e),Ii.delete(e),Tc.delete(e),Xs.delete(e),oh.delete(e),Hc.delete(e)}function z3(e){if(!qc)for(const t of e)t.archived||nu(t.sessionId)}function B3(e){return new Promise((t,n)=>{const r=setInterval(()=>{const o=ls.get(e);(o==null?void 0:o.readyState)===WebSocket.OPEN&&(clearInterval(r),clearTimeout(a),t())},50),a=setTimeout(()=>{clearInterval(r),n(new Error("Connection timeout"))},1e4)})}function Bn(e,t){const n=ls.get(e);let r=t;const a=T3.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||(r={...t,client_msg_id:kw()});break}if((n==null?void 0:n.readyState)===WebSocket.OPEN){n.send(JSON.stringify(r));return}a&&C3(e,r)}function Cy(e){Bn(e,{type:"mcp_get_status"})}function P3(e,t,n){Bn(e,{type:"mcp_toggle",serverName:t,enabled:n})}function $3(e,t){Bn(e,{type:"mcp_reconnect",serverName:t})}function F3(e,t){Bn(e,{type:"mcp_set_servers",servers:t})}function Ey(e,t){Bn(e,{type:"set_magic_ui",magicUiActive:t})}function Rz(e){Bn(e,{type:"magic_ui_sync"})}function U3(e,t){Bn(e,{type:"set_ai_validation",...t})}var te="u">typeof window?window:void 0,Hn="u">typeof globalThis?globalThis:te,Nn=Hn==null?void 0:Hn.navigator,pe=Hn==null?void 0:Hn.document,Zt=Hn==null?void 0:Hn.location,Ex=Hn==null?void 0:Hn.fetch,wg=Hn!=null&&Hn.XMLHttpRequest&&"withCredentials"in new Hn.XMLHttpRequest?Hn.XMLHttpRequest:void 0,Ay=Hn==null?void 0:Hn.AbortController,I3=Hn==null?void 0:Hn.CompressionStream,cr=Nn==null?void 0:Nn.userAgent;function Nw(){return!(!te||te.navigator.onLine===!1)}var oc=typeof globalThis<"u"?globalThis:te;oc&&typeof self>"u"&&(oc.self=oc),oc&&typeof File>"u"&&(oc.File=function(){});var De=te??{},Pt={DEBUG:!1,LIB_VERSION:"0.7.2",LIB_NAME:"browser-common"};function Ty(e,t,n,r,a,o,u){try{var d=e[o](u),f=d.value}catch(p){return void n(p)}d.done?t(f):Promise.resolve(f).then(r,a)}function Ft(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function u(f){Ty(o,r,a,u,d,"next",f)}function d(f){Ty(o,r,a,u,d,"throw",f)}u(void 0)}))}}function de(){return de=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},de.apply(null,arguments)}function Cw(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var H3=["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"],My=function(e,t){if(t===void 0&&(t=[]),!e)return!1;var n=e.toLowerCase();return H3.concat(t).some((r=>{var a=r.toLowerCase();return n.indexOf(a)!==-1}))};function Ie(e,t){return e.indexOf(t)!==-1}var qh=function(e){return e.trim()},kg=function(e){return e.replace(/^\$/,"")};function Ew(e){var t,n=[];return(t=JSON.stringify(e,(function(r,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"}var ws=(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.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e.DeviceId="device_id",e})({}),Sg=(function(e){return e.GZipJS="gzip-js",e.Base64="base64",e})({}),q3=["$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"],V3=["token"],Aw=Object.prototype,Tw=Aw.hasOwnProperty,Vh=Aw.toString,Pe=Array.isArray||function(e){return Vh.call(e)==="[object Array]"},In=e=>typeof e=="function",nt=e=>e===Object(e)&&!Pe(e),Nr=e=>{if(nt(e)){for(var t in e)if(Tw.call(e,t))return!1;return!0}return!1},ce=e=>e===void 0,at=e=>Vh.call(e)=="[object String]",Mc=e=>at(e)&&e.trim().length===0,sn=e=>e===null,Ye=e=>ce(e)||sn(e),an=e=>Vh.call(e)=="[object Number]"&&e==e,Ks=e=>an(e)&&e>0,Kn=e=>Vh.call(e)==="[object Boolean]",G3=e=>e instanceof FormData,Y3=e=>Ie(q3,e),W3=e=>Ie(V3,e);function Mw(e){return e===null||typeof e!="object"}function dh(e,t){return{}.toString.call(e)==="[object "+t+"]"}function Ax(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 Rw(e,Error)}}function Tx(e){return"u">typeof Event&&Rw(e,Event)}function Rw(e,t){try{return e instanceof t}catch{return!1}}var Q3=[!0,"true",1,"1","yes"],fm=e=>Ie(Q3,e),X3=[!1,"false",0,"0","no"];function js(e,t,n,r,a){return t>n&&(r.warn("min cannot be greater than max."),t=n),an(e)?e>n?(r.warn(" cannot be greater than max: "+n+". Using max value instead."),n):t>e?(r.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(r.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+a),js(a??n,t,n,r))}class K3{constructor(t){this.C={},this.I=t.I,this.R=js(t.bucketSize,0,100,t.A),this.O=js(t.refillRate,0,this.R,t.A),this.N=js(t.refillInterval,0,864e5,t.A)}F(t,n){var r=Math.floor((n-t.lastAccess)/this.N);r>0&&(t.tokens=Math.min(t.tokens+r*this.O,this.R),t.lastAccess=t.lastAccess+r*this.N)}consumeRateLimit(t){var n,r=Date.now(),a=String(t),o=this.C[a];return o?this.F(o,r):this.C[a]=o={tokens:this.R,lastAccess:r},o.tokens===0||(o.tokens--,o.tokens===0&&((n=this.I)==null||n.call(this,t)),o.tokens===0)}stop(){this.C={}}}var Er="Mobile",hh="iOS",ni="Android",Kl="Tablet",Dw=ni+" "+Kl,Lw="iPad",Ow="Apple",zw=Ow+" Watch",Rc="Safari",Zl="BlackBerry",Bw="Samsung",Pw=Bw+"Browser",$w=Bw+" Internet",La="Chrome",Z3=La+" OS",Fw=La+" "+hh,Mx="Internet Explorer",Uw=Mx+" "+Er,Rx="Opera",J3=Rx+" Mini",Dx="Edge",Iw="Microsoft "+Dx,Vl="Firefox",Hw=Vl+" "+hh,Vc="Nintendo",Gc="PlayStation",Gl="Xbox",qw=ni+" "+Er,Vw=Er+" "+Rc,Sc="Windows",jg=Sc+" Phone",Ry="Nokia",Ng="Ouya",Gw="Generic",e4=Gw+" "+Er.toLowerCase(),Yw=Gw+" "+Kl.toLowerCase(),Cg="Konqueror",Ww="Oculus Browser",fh="Vivaldi",Qw="Yandex",ph="Whale",Eg="DuckDuckGo",Xw="Pale Moon",mh="Waterfox",Dc="Brave",gh="Claude",xh="Codex",vh="ChatGPT",Kw="Google Search App",Xt="(\\d+(\\.\\d+)?)",pm=new RegExp("Version/"+Xt),mm=new RegExp("("+gh+"|"+xh+"|"+vh+")\\/"+Xt),t4=new RegExp(Gl,"i"),n4=new RegExp(Gc+" \\w+","i"),r4=new RegExp(Vc+" \\w+","i"),Lx=new RegExp(Zl+"|PlayBook|BB10","i"),s4={"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"},Zw=function(e,t,n,r){t=t||"";var a=(function(o){return o!=null&&o.brave?Dc:null})(n);return a||(r!=null&&r.detectGoogleSearchApp&&Ie(e,"GSA/")?Kw:Ie(e," OPR/")&&Ie(e,"Mini")?J3:Ie(e," OPR/")?Rx:Lx.test(e)?Zl:Ie(e,"IE"+Er)||Ie(e,"WPDesktop")?Uw:Ie(e,"OculusBrowser")?Ww:Ie(e,Pw)?$w:Ie(e,Dx)||Ie(e,"Edg/")?Iw:Ie(e,fh+"/")?fh:Ie(e,"YaBrowser/")?Qw:Ie(e,ph+"/")?ph:Ie(e,Eg+"/")||Ie(e,"Ddg/")?Eg:Ie(e,gh+"/")?gh:Ie(e,xh+"/")?xh:Ie(e,vh+"/")?vh:Ie(e,"FBIOS")?"Facebook "+Er:Ie(e,"UCWEB")||Ie(e,"UCBrowser")?"UC Browser":Ie(e,"CriOS")?Fw:Ie(e,"CrMo")||Ie(e,La)?La:Ie(e,ni)&&Ie(e,Rc)?qw:Ie(e,"FxiOS")?Hw:Ie(e.toLowerCase(),Cg.toLowerCase())?Cg:Ie(e,Dc+"/")?Dc:((o,u)=>u&&Ie(u,Ow)||(function(d){return Ie(d,Rc)&&!Ie(d,La)&&!Ie(d,ni)})(o))(e,t)?Ie(e,Er)?Vw:Rc:Ie(e,"PaleMoon/")?Xw:Ie(e,mh+"/")?mh:Ie(e,Vl)?Vl:Ie(e,"MSIE")||Ie(e,"Trident/")?Mx:Ie(e,"Gecko")?Vl:"")},i4={[Uw]:[new RegExp("rv:"+Xt)],[Iw]:[new RegExp(Dx+"?\\/"+Xt)],[La]:[new RegExp("("+La+"|CrMo)\\/"+Xt)],[Fw]:[new RegExp("CriOS\\/"+Xt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Xt)],[Rc]:[pm],[Vw]:[pm],[Rx]:[new RegExp("(Opera|OPR)\\/"+Xt)],[Vl]:[new RegExp(Vl+"\\/"+Xt)],[Hw]:[new RegExp("FxiOS\\/"+Xt)],[Cg]:[new RegExp("Konqueror[:/]?"+Xt,"i")],[Zl]:[new RegExp(Zl+" "+Xt),pm],[qw]:[new RegExp("android\\s"+Xt,"i")],[$w]:[new RegExp(Pw+"\\/"+Xt)],[Ww]:[new RegExp("OculusBrowser\\/"+Xt)],[fh]:[new RegExp(fh+"\\/"+Xt)],[Qw]:[new RegExp("YaBrowser\\/"+Xt)],[ph]:[new RegExp(ph+"\\/"+Xt)],[Dc]:[new RegExp(Dc+"\\/"+Xt)],[gh]:[mm],[xh]:[mm],[vh]:[mm],[Eg]:[new RegExp("(DuckDuckGo|Ddg)\\/"+Xt)],[Xw]:[new RegExp("PaleMoon\\/"+Xt)],[mh]:[new RegExp(mh+"\\/"+Xt)],[Kw]:[new RegExp("GSA\\/"+Xt)],[Mx]:[new RegExp("(rv:|MSIE )"+Xt)],Mozilla:[new RegExp("rv:"+Xt)]},a4=function(e,t,n,r){var a=Zw(e,t,n,r),o=i4[a];if(ce(o))return null;for(var u=0;o.length>u;u++){var d=e.match(o[u]);if(d)return parseFloat(d[d.length-2])}return null},Dy=[[new RegExp(Gl+"; "+Gl+" (.*?)[);]","i"),e=>[Gl,e&&e[1]||""]],[new RegExp(Vc,"i"),[Vc,""]],[new RegExp(Gc,"i"),[Gc,""]],[Lx,[Zl,""]],[new RegExp(Sc,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[jg,""];if(new RegExp(Er).test(t)&&!/IEMobile\b/.test(t))return[Sc+" "+Er,""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var r=s4[n[1]]||"";return/arm/i.test(t)&&(r="RT"),[Sc,r]}return[Sc,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[hh,[e[3],e[4],e[5]||"0"].join(".")]:[hh,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=ce(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+ni+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+ni+")","i"),e=>e&&e[2]?[ni,[e[2],e[3],e[4]||"0"].join(".")]:[ni,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Z3,""]],[/Linux|debian/i,["Linux",""]]],Jw=function(e){for(var t=0;Dy.length>t;t++){var n=Dy[t],r=n[1],a=n[0].exec(e),o=a&&(In(r)?r(a,e):r);if(o)return o}return["",""]},Ly=function(e){return r4.test(e)?Vc:n4.test(e)?Gc:t4.test(e)?Gl:new RegExp(Ng,"i").test(e)?Ng:new RegExp("("+jg+"|WPDesktop)","i").test(e)?jg:/iPad/.test(e)?Lw:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?zw:Lx.test(e)?Zl:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Ry,"i").test(e)?Ry:/(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(Er).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)?ni:Dw:new RegExp("(pda|"+Er+")","i").test(e)?e4:new RegExp(Kl,"i").test(e)&&!new RegExp(Kl+" pc","i").test(e)?Yw:""},l4=20,e2=1e3,o4=1e4,c4="[Circular]",Ag="[Truncated]",Gh="[Unserializable]",u4="[Function]";function Yl(e){for(var t="",n=0;e.length>n;n++){var r=e.charCodeAt(n);if(55296>r||r>56319)t+=56320>r||r>57343?e[n]:"�";else{var a=e.charCodeAt(n+1);56320>a||a>57343?t+="�":(t+=e[n]+e[n+1],n++)}}return t}var Ad,Oy,gm,d4=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function zy(e,t){return typeof(n=e)=="string"&&d4.test(n)?e:t();var n}function t2(e,t){var n=new Error(t);try{Object.defineProperty(n,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch{}return n}function Wi(e){return e&&e.split("#")[0]}function Ox(e,t){var n=setTimeout(e,t);return n!=null&&n.unref&&(n==null||n.unref()),n}function By(e,t,n){return n2.apply(this,arguments)}function n2(){return(n2=Ft((function*(e,t,n){var r;try{return yield Promise.race([e,new Promise(((a,o)=>{r=Ox((()=>{try{n==null||n(),a()}catch(u){o(u)}}),t)}))])}finally{clearTimeout(r)}}))).apply(this,arguments)}function h4(e){var t=globalThis._posthogChunkIds;if(t){var n=Object.keys(t);return gm&&n.length===Oy||(Oy=n.length,gm=n.reduce(((r,a)=>{Ad||(Ad={});var o=Ad[a];if(o)r[o[0]]=o[1];else for(var u=e(a),d=u.length-1;d>=0;d--){var f=u[d],p=f==null?void 0:f.filename,m=t[a];if(p&&m){r[p]=m,Ad[a]=[p,m];break}}return r}),{})),gm}}class f4{constructor(t,n,r){r===void 0&&(r=[]),this.coercers=t,this.stackParser=n,this.modifiers=r}buildFromUnknown(t,n){n===void 0&&(n={});var r=n&&n.mechanism||{handled:!0,type:"generic"},a=this.buildCoercingContext(r,n,0).apply(t),o=this.buildParsingContext(n),u=this.parseStacktrace(a,o);return{$exception_list:this.convertToExceptionList(u,r),$exception_level:"error"}}modifyFrames(t){var n=this;return Ft((function*(){for(var r of t)r.stacktrace&&r.stacktrace.frames&&Pe(r.stacktrace.frames)&&(r.stacktrace.frames=yield n.applyModifiers(r.stacktrace.frames));return t}))()}coerceFallback(t){var n;return{type:"Error",value:"Unknown error",stack:(n=t.syntheticException)==null?void 0:n.stack,synthetic:!0}}parseStacktrace(t,n){var r,a;return t.cause!=null&&(r=this.parseStacktrace(t.cause,n)),t.stack!=""&&t.stack!=null&&(a=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?n.skipFirstLines:0),n.chunkIdMap)),de({},t,{cause:r,stack:a})}applyChunkIds(t,n){return t.map((r=>(r.filename&&n&&(r.chunk_id=n[r.filename]),r)))}applyCoercers(t,n){for(var r of this.coercers)if(r.match(t))return r.coerce(t,n);return this.coerceFallback(n)}applyModifiers(t){var n=this;return Ft((function*(){var r=t;for(var a of n.modifiers)r=yield a(r);return r}))()}convertToExceptionList(t,n){var r,a,o,u={type:t.type,value:t.value,mechanism:{type:(r=n.type)!==null&&r!==void 0?r:"generic",handled:(a=n.handled)===null||a===void 0||a,synthetic:(o=t.synthetic)!==null&&o!==void 0&&o}};t.stack&&(u.stacktrace={type:"raw",frames:t.stack});var d=[u];return t.cause!=null&&d.push(...this.convertToExceptionList(t.cause,de({},n,{handled:!0}))),d}buildParsingContext(t){var n;return{chunkIdMap:h4(this.stackParser),skipFirstLines:(n=t.skipFirstLines)!==null&&n!==void 0?n:1}}buildCoercingContext(t,n,r){r===void 0&&(r=0);var a=(o,u)=>{if(4>=u){var d=this.buildCoercingContext(t,n,u);return this.applyCoercers(o,d)}};return de({},n,{syntheticException:r==0?n.syntheticException:void 0,mechanism:t,apply:o=>a(o,r),next:o=>a(o,r+1)})}}var Jl="?";function Tg(e,t,n,r,a){var o={platform:e,filename:t,function:n==="<anonymous>"?Jl:n,in_app:!!t&&!t.startsWith("webkit-masked-url://")&&t!=="<anonymous>"};return ce(r)||(o.lineno=r),ce(a)||(o.colno=a),o}var r2=(e,t)=>{var n=e.indexOf("safari-extension")!==-1,r=e.indexOf("safari-web-extension")!==-1;return n||r?[e.indexOf("@")!==-1?e.split("@")[0]:Jl,n?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},p4=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,m4=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,g4=/\((\S*)(?::(\d+))(?::(\d+))\)/,x4=(e,t)=>{var n=p4.exec(e);if(n)return Tg(t,n[1],Jl,+n[2],+n[3]);var r=m4.exec(e);if(r){if(r[2]&&r[2].indexOf("eval")===0){var a=g4.exec(r[2]);a&&(r[2]=a[1],r[3]=a[2],r[4]=a[3])}var o=r2(r[1]||Jl,r[2]);return Tg(t,o[1],o[0],r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},v4=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,b4=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,y4=(e,t)=>{var n=v4.exec(e);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){var r=b4.exec(n[3]);r&&(n[1]=n[1]||"eval",n[3]=r[1],n[4]=r[2],n[5]="")}var a=n[3],o=n[1]||Jl,u=r2(o,a);return Tg(t,a=u[1],o=u[0],n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},Py=/\(error: (.*)\)/;class _4{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,n){var r=at(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:r?t.stack:void 0,cause:t.cause?n.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var n=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?n+": "+t.message:n}isDOMException(t){return dh(t,"DOMException")}isDOMError(t){return dh(t,"DOMError")}}class w4{match(t){return Ax(t)}coerce(t,n){var r,a=this.getStack(t),o=a===void 0;return{type:this.getType(t),value:this.getMessage(t,n),stack:a??((r=n.syntheticException)==null?void 0:r.stack),cause:t.cause?n.next(t.cause):void 0,synthetic:o}}getType(t){return t.name||t.constructor.name}getMessage(t,n){var r=t.message;return String(r.error&&typeof r.error.message=="string"?r.error.message:r)}getStack(t){return t.stacktrace||t.stack||void 0}}class k4{match(t){return!!dh(t,"ErrorEvent")&&(t.error!=null||this.Vi(t))}coerce(t,n){var r;if(t.error!=null)return n.apply(t.error);var a=n.apply(t.message);return de({},a,{stack:(r=this.Zi(t))!==null&&r!==void 0?r:a.stack,synthetic:!0})}Vi(t){return at(t.message)&&t.message.length>0}Zi(t){var n,r,a=t,o=(n=a.lineno)!==null&&n!==void 0?n:0,u=(r=a.colno)!==null&&r!==void 0?r:0;if(at(a.filename)&&a.filename.length!==0&&o!==0)return`Error
|
|
67
|
+
at `+a.filename+":"+o+":"+u}}var S4=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class j4{match(t){return typeof t=="string"}coerce(t,n){var r,a=this.getInfos(t),o=a[0],u=a[1];return{type:o??"Error",value:u??t,stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}getInfos(t){var n="Error",r=t,a=t.match(S4);return a&&(n=a[1],r=a[2]),[n,r]}}var N4=["fatal","error","warning","log","info","debug"];function s2(e,t){t===void 0&&(t=40);var n=Object.keys(e);if(n.sort(),!n.length)return"[object has no keys]";for(var r=n.length;r>0;r--){var a=n.slice(0,r).join(", ");if(t>=a.length)return r===n.length?a:a.length>t?a.slice(0,t)+"...":a}return""}class C4{match(t){return typeof t=="object"&&t!==null}coerce(t,n){var r,a,o=this.getErrorPropertyFromObject(t);return o?n.apply(o):{type:this.getType(t),value:this.getValue(t),stack:(r=this.getStack(t))!==null&&r!==void 0?r:(a=n.syntheticException)==null?void 0:a.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){if(Tx(t))return t.constructor.name;var n="name"in t?t.name:void 0;return at(n)&&!Mc(n)?n:"Error"}getValue(t){if("name"in t&&typeof t.name=="string"){var n="'"+t.name+"' captured as exception";return"message"in t&&typeof t.message=="string"&&(n+=" with message: '"+t.message+"'"),n}if("message"in t&&typeof t.message=="string")return t.message;var r=this.getObjectClassName(t);return(r&&r!=="Object"?"'"+r+"'":"Object")+" captured as exception with keys: "+s2(t)}isSeverityLevel(t){return at(t)&&!Mc(t)&&N4.indexOf(t)>=0}getStack(t){try{return at(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:at(t.stack)&&t.stack.length>0?t.stack:void 0}catch{return}}getErrorPropertyFromObject(t){for(var n in t)if({}.hasOwnProperty.call(t,n)){var r=t[n];if(Ax(r))return r}}getObjectClassName(t){try{var n=Object.getPrototypeOf(t);return n?n.constructor.name:void 0}catch{return}}}class E4{match(t){return Tx(t)}coerce(t,n){var r,a=t.constructor.name;return{type:a,value:a+" captured as exception with keys: "+s2(t),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class A4{match(t){return Mw(t)}coerce(t,n){var r;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class T4{match(t){return dh(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!Tx(t))return!1;try{var n=t.detail;return n!=null&&typeof n=="object"&&"reason"in n}catch{return!1}}coerce(t,n){var r,a=this.getUnhandledRejectionReason(t);return Mw(a)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(a),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}:n.apply(a)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&t.detail!=null&&typeof t.detail=="object"&&"reason"in t.detail)return t.detail.reason}catch{}return t}}var bh="$message",yh="$timestamp",M4=new Set([bh,yh]),xm={enabled:!0,max_bytes:32768};function _h(e){var t;return e?{enabled:(t=e.enabled)!==null&&t!==void 0?t:xm.enabled,max_bytes:D4(e.max_bytes,xm.max_bytes)}:de({},xm)}class R4{constructor(t){this.Fn=[],this.Dn=0,this.mn=_h(t)}setConfig(t){this.mn=_h(t),this.$n()}add(t){var n=(function(a){var o;try{o=Ew(a)}catch{return}try{var u=JSON.parse(o);if(!nt(u))return;var d=u,f=d[bh],p=d[yh];return!at(f)||f.trim().length===0||!at(p)&&!an(p)?void 0:{step:d,json:o}}catch{return}})(t);if(n){var r=(function(a){if("u">typeof TextEncoder)return new TextEncoder().encode(a).length;for(var o=encodeURIComponent(a),u=0,d=0;o.length>d;d++)o[d]==="%"?(u+=1,d+=2):u+=1;return u})(n.json);r>this.mn.max_bytes||(this.Fn.push({step:n.step,bytes:r}),this.Dn+=r,this.$n())}}getAttachable(){return this.Fn.map((t=>t.step))}clear(){this.Fn=[],this.Dn=0}size(){return this.Fn.length}$n(){for(;this.Dn>this.mn.max_bytes&&this.Fn.length>0;){var t=this.Fn.shift();t&&(this.Dn-=t.bytes)}}}function D4(e,t){if(!an(e)||e===1/0||e===-1/0)return t;var n=Math.floor(e);return 0>n?t:n}var $y=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}};function Fy(e){return typeof e=="string"||e}function Uy(e){return typeof e=="string"?e:void 0}var cc,L4=["$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"],i2="NativeGzipValidationError",Mg=e=>e.length>=2&&e[0]===31&&e[1]===139,Iy=(e,t)=>e===Sg.GZipJS||t===Sg.GZipJS||t==="gzip",Hy=e=>!(!e||typeof e!="object")&&("name"in e?String(e.name):"")==="NotReadableError",Td=e=>{throw t2(i2,"Native gzip produced invalid output: "+e)},O4=(function(){var e=Ft((function*(t,n){18>t.size&&Td("too-short");var r=new Uint8Array(yield t.slice(0,10).arrayBuffer());Mg(r)&&r[2]===8||Td("invalid-header");var a=new DataView(yield t.slice(t.size-8).arrayBuffer());a.getUint32(0,!0)!==(u=>{for(var d=(()=>{if(cc)return cc;cc=[];for(var m=0;256>m;m++){for(var x=m,b=0;8>b;b++)x=1&x?3988292384^x>>>1:x>>>1;cc[m]=x>>>0}return cc})(),f=4294967295,p=0;u.length>p;p++)f=d[255&(f^u[p])]^f>>>8;return(4294967295^f)>>>0})(n)&&Td("invalid-crc");var o=n.length>>>0;a.getUint32(4,!0)!==o&&Td("invalid-size")}));return function(t,n){return e.apply(this,arguments)}})();function Rg(){return Rg=Ft((function*(e,t,n){t===void 0&&(t=!0);try{var r=new TextEncoder().encode(e),a=new globalThis.CompressionStream("gzip"),o=a.writable.getWriter(),u=o.write(r).then((()=>o.close())).catch((function(){var p=Ft((function*(m){try{yield o.abort(m)}catch{}throw m}));return function(m){return p.apply(this,arguments)}})()),d=new Response(a.readable).blob(),f=(yield Promise.all([d,u]))[0];return yield O4(f,r),f}catch(p){if(n!=null&&n.rethrow)throw p;return t&&console.error("Failed to gzip compress data",p),null}})),Rg.apply(this,arguments)}var qy=9223372036854776e3,z4="9223372036854775808",B4={}.propertyIsEnumerable;function wh(e,t){try{return a2(e,t,{ancestors:new WeakSet,remainingNodes:o4},0)}catch{return[]}}function zx(e,t,n,r){if(0>=n.remainingNodes)return{stringValue:Ag};if(n.remainingNodes--,Kn(e))return{boolValue:e};if(typeof e=="bigint")return(function(f,p){var m=f.toString(),x=BigInt(z4);return f>=x||-x>f?(p==null||p.debug("Attribute "+m+" is outside the int64 range; encoding it as a string"),{stringValue:m}):{intValue:m}})(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)};var a=BigInt(e).toString();return e>=qy||-qy>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:Yl(e)};if(typeof e=="function")return{stringValue:u4};if(typeof e=="symbol")return{stringValue:String(e)};if(typeof e=="object"&&e!==null){if(n.ancestors.has(e))return{stringValue:c4};if(r>=l4)return{stringValue:Ag};if(e instanceof Date){var o=e.getTime(),u=Number.isFinite(o)?e.toISOString():String(e);return{stringValue:typeof u=="string"?Yl(u):String(u)}}n.ancestors.add(e);try{try{var d=e.toJSON;if(typeof d=="function")return zx(d.call(e),t,n,r+1)}catch{}return Pe(e)?{arrayValue:{values:P4(e,t,n,r+1)}}:{kvlistValue:{values:a2(e,t,n,r+1)}}}finally{n.ancestors.delete(e)}}return{stringValue:Yl(String(e))}}function P4(e,t,n,r){for(var a=[],o=Math.min(e.length,e2),u=0;o>u&&n.remainingNodes>0;u++)try{var d=u in e?e[u]:void 0;if(Ye(d))continue;a.push(zx(d,t,n,r))}catch{a.push({stringValue:Gh})}return e.length>u&&a.push({stringValue:Ag}),a}function a2(e,t,n,r){var a=[];for(var o in e)if(B4.call(e,o)){if(!o){t==null||t.debug("Dropping an attribute with an empty key");continue}if(a.length>=e2||0>=n.remainingNodes){t==null||t.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{var u=e[o];if(sn(u)||ce(u))continue;a.push({key:Yl(o),value:zx(u,t,n,r)})}catch{a.push({key:Yl(o),value:{stringValue:Gh}})}}return a}function l2(e,t,n){return de({},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})}var Vy={darwin:"macOS",win32:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",aix:"AIX","Mac OS X":"macOS"},o2={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}},$4=o2.info;function F4(e){try{return Yl(String(e))}catch{return Gh}}function U4(e,t,n,r){var a,o=o2[e.level||"info"]||$4,u=o.text,d=o.number,f=((a=an(r)?r:void 0)===void 0&&(a=Date.now()),String(a)+"000000"),p={};t.distinctId&&(p.posthogDistinctId=t.distinctId),t.sessionId&&(p.sessionId=t.sessionId),t.windowId&&(p["window.id"]=t.windowId),Ye(t.sessionStartTimestamp)||(p.sessionStartTimestamp=String(t.sessionStartTimestamp)),Ye(t.lastActivityTimestamp)||(p.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(p["url.full"]=t.currentUrl),t.screenName&&(p["screen.name"]=t.screenName),t.appState&&(p["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(p.feature_flags=t.activeFeatureFlags);var m=de({},p),x=e.attributes;if(x){var b=[];try{b=Object.keys(x)}catch{b=[]}for(var y of b){var _=void 0;try{_=x[y]}catch{_=Gh}Object.defineProperty(m,y,{value:_,enumerable:!0,writable:!0,configurable:!0})}}var j={timeUnixNano:f,observedTimeUnixNano:f,severityNumber:d,severityText:u,body:{stringValue:F4(e.body)},attributes:wh(m,n)};return e.trace_id&&(j.traceId=e.trace_id),e.span_id&&(j.spanId=e.span_id),ce(e.trace_flags)||(j.flags=e.trace_flags),j}function c2(e,t,n){return l2(e,t,n)}function u2(e,t,n,r){return{resourceLogs:[{resource:{attributes:wh(t)},scopeLogs:[{scope:{name:n,version:r},logRecords:e}]}]}}let I4=class{constructor(e,t,n,r,a,o,u){var d;o===void 0&&(o=()=>Promise.resolve()),this._instance=e,this.mn=t,this.A=n,this.Nn=r,this.qn=a,this.jn=o,this.Bn=u,this.Hn=null,this.zn=0,this.Un=0,this.Wn=0,this.Vn=0,this.Gn=0,this.Zn=!1,this.Qn=t.maxBufferSize,this.Jn=Math.max((d=t.maxQueueSize)!==null&&d!==void 0?d:t.maxBufferSize,t.maxBufferSize),this.Kn=t.flushIntervalMs,this.Yn=t.maxBatchRecordsPerPost,this.Xn=t.rateCapWindowMs,this.ts=t.maxLogsPerInterval}clearQueue(){this.Un++,this._instance.setPersistedProperty(ws.LogsQueue,[])}reset(){this.es(),this.Vn=0,this.Gn=0,this.Zn=!1,this.Wn=0,this.Yn=this.mn.maxBatchRecordsPerPost}onReconnect(){this.Wn=0,this.rs()}captureLog(e,t){var n;if(!this._instance.isDisabled&&!this._instance.optedOut&&e!=null&&e.body){var r=this.ns(e);if(r!==null)if(r.body){if(this.ss()){var a={record:U4(r,(n=t==null?void 0:t.context)!==null&&n!==void 0?n:this.Nn(),this.A,t==null?void 0:t.occurredAtMs)};this.qn((()=>this.os(a)))}}else this.A.info("Log was rejected in beforeSend function")}}ns(e){var t=this.mn.beforeSend;if(!t)return e;var n=Pe(t)?t:[t],r=e;for(var a of n)try{var o=a(r);if(!o)return this.A.info("Log was rejected in beforeSend function"),null;r=o}catch(u){return this.A.error("Error in beforeSend function for log:",u),null}return r}ss(){if(this.ts===void 0)return!0;var e=Date.now(),t=e-this.Vn;return this.Xn>t&&t>=0||(this.Vn=e,this.Gn=0,this.Zn=!1),this.ts>this.Gn?(this.Gn++,!0):(this.Zn||(this.A.warn("captureLog dropping logs: exceeded "+this.ts+" logs per "+this.Xn+"ms"),this.Zn=!0),!1)}flush(){var e=this;return Ft((function*(){if(!e._instance.isDisabled)return e.Hn||(e.Hn=e.ls().finally((()=>{e.Hn=null}))),e.Hn}))()}ls(){var e=this;return Ft((function*(){var t;e.es();var n=(t=e._instance.getPersistedProperty(ws.LogsQueue))!==null&&t!==void 0?t:[];if(n.length!==0)for(var r=n.length,a=0;n.length>0&&r>a;){var o,u,d=e.Un;e.zn=0;var f=Math.min(n.length,e.Yn),p=n.slice(0,f),m=u2(p.map((b=>b.record)),e.us(),(o=e.Bn)!==null&&o!==void 0?o:e._instance.getLibraryId(),e._instance.getLibraryVersion()),x=yield e._instance.hs(m);if(e.Un!==d)return;if(x.kind==="too-large"&&p.length>1)e.Yn=Math.max(1,Math.floor(p.length/2)),e.A.warn("Received 413 when sending logs batch of size "+p.length+", reducing batch size to "+e.Yn);else if(x.kind==="retry-later"||(x.kind==="too-large"?e.A.warn("Dropping a single log record after 413 with batch size 1 — the record is larger than the server cap and cannot be split further."):x.kind==="ok"&&e.mn.maxBatchRecordsPerPost>e.Yn&&(e.Yn=Math.min(e.mn.maxBatchRecordsPerPost,e.Yn+1)),yield e.ds(p.length),n=(u=e._instance.getPersistedProperty(ws.LogsQueue))!==null&&u!==void 0?u:[],a+=p.length,x.kind==="fatal"))throw x.error}}))()}ds(e){var t=this;return Ft((function*(){var n,r=Math.max(0,e-t.zn),a=(n=t._instance.getPersistedProperty(ws.LogsQueue))!==null&&n!==void 0?n:[];t._instance.setPersistedProperty(ws.LogsQueue,a.slice(r)),yield t.jn()}))()}us(){return c2(this.mn,this._instance.getLibraryId(),this._instance.getLibraryVersion())}os(e){var t;if(!this._instance.optedOut){var n=(t=this._instance.getPersistedProperty(ws.LogsQueue))!==null&&t!==void 0?t:[];this.Jn>n.length||(n.shift(),this.zn++,this.A.info("Logs queue is full, dropping oldest record.")),n.push(e),this._instance.setPersistedProperty(ws.LogsQueue,n),this.Qn>n.length?this.vs():this.rs()}}vs(e){e===void 0&&(e=this.Kn),this.cs||(this.cs=Ox((()=>{this.cs=void 0,this.rs()}),e))}fs(){var e=Math.min(Math.max(0,this.Wn-1),6);return this.Kn*Math.pow(2,e)}ps(){var e=this._instance.getPersistedProperty(ws.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return Ft((function*(){t.es();var n=t.flush().catch((()=>{}));e!==void 0?yield By(n,e):yield n}))()}flushWithTimeout(e){var t=this;return Ft((function*(){var n=t.flush();yield By(n,e,(()=>{n.catch((()=>{}))}))}))()}rs(){this.flush().then((()=>{this.Wn=0}),(e=>{this.Wn++,this.A.error("PostHog logs flush failed:",e)})).finally((()=>{!this._instance.isDisabled&&this.ps()&&this.vs(this.fs())}))}es(){this.cs&&(clearTimeout(this.cs),this.cs=void 0)}};var vm=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Gy(e){return String(e)+"000000"}function Yy(e,t,n,r){var a="";return r&&(a=Object.keys(r).sort().map((o=>JSON.stringify(o)+":"+JSON.stringify(r[o]))).join(",")),e+"\0"+t+"\0"+(n??"")+"\0"+a}let H4=class{constructor(e,t,n){this._instance=e,this.mn=t,this.A=n,this.gs=new Map,this.Hn=null,this.ys=!1,this.bs=new Map,this._s=new Set,this.ws=0}count(e,t,n){t===void 0&&(t=1),this.ks({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.ks({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.ks({name:e,type:"histogram",value:t,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}flush(){var e=this,t=this.Hn,n=(function(){var a=Ft((function*(){t&&(yield t.catch((()=>{}))),yield e.Ss()}));return function(){return a.apply(this,arguments)}})(),r=n().finally((()=>{this.Hn===r&&(this.Hn=null)}));return this.Hn=r,r}drainWindow(){if(this.gs.size===0)return null;var e=this.gs;return this.gs=new Map,this.ys=!1,this.bs=new Map,this._s=new Set,this.xs(e)}reset(){this.ws++,this.es(),this.gs=new Map,this.Hn=null,this.ys=!1,this.bs=new Map,this._s=new Set}ks(e){if(!this._instance.isDisabled&&!this._instance.optedOut){var t=this.ns(e);if(t!==null)if(t.name&&typeof t.name=="string")if(typeof t.value=="number"&&Number.isFinite(t.value))if(t.type==="count"&&0>t.value)this.A.warn("Dropping count '"+t.name+"': counters are monotonic, value must be >= 0");else{var n,r;try{n=t.attributes?de({},t.attributes):void 0,r=Yy(t.type,t.name,t.unit,n)}catch(u){return void this.A.warn("Dropping metric '"+t.name+"': attributes could not be serialized",u)}var a=this.gs.get(r);if(!a){if(!this.Cs())return;a={name:t.name,type:t.type,unit:t.unit,attributes:n,windowStartMs:Date.now()},this.gs.set(r,a)}var o=this.bs.get(t.name);o===void 0?this.bs.set(t.name,t.type):o===t.type||this._s.has(t.name)||(this._s.add(t.name),this.A.warn("Metric name '"+t.name+"' is already used as a "+o+"; recording it as a "+t.type+" too will blend both series in charts. Use a distinct name.")),this.Ts(a,t.value),this.vs()}else this.A.warn("Dropping metric '"+t.name+"': value must be a finite number");else this.A.warn("Dropping metric with empty name")}}Cs(){return this.mn.maxSeriesPerFlush>this.gs.size||(this.ys||(this.ys=!0,this.A.warn("Metric series cap reached ("+this.mn.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}Ts(e,t){var n;switch(e.type){case"count":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(vm.length+1).fill(0)});var r=e.hist;r.count+=1,r.sum+=t,r.min=Math.min(r.min,t),r.max=Math.max(r.max,t),r.bucketCounts[(function(a,o){for(var u=0;o.length>u;u++)if(o[u]>=a)return u;return o.length})(t,vm)]+=1}}ns(e){var t=this.mn.beforeSend;if(!t)return e;var n=Pe(t)?t:[t],r=e;for(var a of n)try{var o=a(r);if(!o)return this.A.info("Metric was rejected in beforeSend function"),null;r=o}catch(u){return this.A.error("Error in beforeSend function for metric:",u),null}return r}vs(){this.cs||(this.cs=Ox((()=>{this.cs=void 0,this.flush().catch((e=>{this.A.error("Metrics flush failed:",e)}))}),this.mn.flushIntervalMs))}es(){this.cs&&(clearTimeout(this.cs),this.cs=void 0)}Ss(){var e=this;return Ft((function*(){if(e.gs.size!==0){var t=e.gs;e.gs=new Map,e.ys=!1,e.bs=new Map,e._s=new Set;var n=e.ws,r=yield e._instance.Ms(e.xs(t));if(n===e.ws)switch(r.kind){case"ok":return;case"retry-later":return e.Is(t),void e.vs();case"too-large":return void e.A.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e.A.error("Failed to send metrics batch:",r.error)}}}))()}xs(e){return t=this.Es(e),n=(function(o,u,d){return l2(o,u,d)})(this.mn,this._instance.getLibraryId(),this._instance.getLibraryVersion()),r=this._instance.getLibraryId(),a=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:wh(n)},scopeMetrics:[{scope:{name:r,version:a},metrics:t}]}]};var t,n,r,a}Es(e){var t=Gy(Date.now()),n=new Map;for(var r of e.values()){var a,o=Yy(r.type,r.name,r.unit,void 0),u=n.get(o);u||(u=de({name:r.name},r.unit&&{unit:r.unit}),r.type==="count"?u.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:r.type==="gauge"?u.gauge={dataPoints:[]}:u.histogram={aggregationTemporality:1,dataPoints:[]},n.set(o,u));var d=wh((a=r.attributes)!==null&&a!==void 0?a:{},this.A),f=Gy(r.windowStartMs);if(r.type==="count"){var p,m={attributes:d,startTimeUnixNano:f,timeUnixNano:t,asDouble:(p=r.total)!==null&&p!==void 0?p:0};u.sum.dataPoints.push(m)}else if(r.type==="gauge"){var x,b={attributes:d,timeUnixNano:t,asDouble:(x=r.last)!==null&&x!==void 0?x:0};u.gauge.dataPoints.push(b)}else r.hist&&u.histogram.dataPoints.push({attributes:d,startTimeUnixNano:f,timeUnixNano:t,count:r.hist.count,sum:r.hist.sum,min:r.hist.min,max:r.hist.max,bucketCounts:r.hist.bucketCounts,explicitBounds:vm})}return Array.from(n.values())}Is(e){var t,n;for(var r of e){var a=r[0],o=r[1],u=this.gs.get(a);if(u)switch(u.windowStartMs=Math.min(u.windowStartMs,o.windowStartMs),u.type){case"count":u.total=((t=u.total)!==null&&t!==void 0?t:0)+((n=o.total)!==null&&n!==void 0?n:0);break;case"gauge":break;case"histogram":if(o.hist)if(u.hist){u.hist.count+=o.hist.count,u.hist.sum+=o.hist.sum,u.hist.min=Math.min(u.hist.min,o.hist.min),u.hist.max=Math.max(u.hist.max,o.hist.max);for(var d=0;u.hist.bucketCounts.length>d;d++)u.hist.bucketCounts[d]+=o.hist.bucketCounts[d]}else u.hist=o.hist}else this.Cs()&&this.gs.set(a,o)}}};var d2=function(e,t){var n=(t===void 0?{}:t).debugEnabled,r={q(a){if(te&&(Pt.DEBUG||te.POSTHOG_DEBUG||n)&&!ce(te.console)&&te.console){for(var o=("__rrweb_original__"in te.console[a])?te.console[a].__rrweb_original__:te.console[a],u=arguments.length,d=new Array(u>1?u-1:0),f=1;u>f;f++)d[f-1]=arguments[f];o(e,...d)}},debug(){for(var a=arguments.length,o=new Array(a),u=0;a>u;u++)o[u]=arguments[u];r.q("debug",...o)},info(){for(var a=arguments.length,o=new Array(a),u=0;a>u;u++)o[u]=arguments[u];r.q("log",...o)},warn(){for(var a=arguments.length,o=new Array(a),u=0;a>u;u++)o[u]=arguments[u];r.q("warn",...o)},error(){for(var a=arguments.length,o=new Array(a),u=0;a>u;u++)o[u]=arguments[u];r.q("error",...o)},critical(){for(var a=arguments.length,o=new Array(a),u=0;a>u;u++)o[u]=arguments[u];console.error(e,...o)},uninitializedWarning(a){r.error("You must initialize PostHog before calling "+a)},createLogger:(a,o)=>d2(e+" "+a,o)};return r},ye=d2("[PostHog.js]"),Gt=ye.createLogger,q4=Gt("[ExternalScriptsLoader]"),kh=e=>{var t=pe==null?void 0:pe.querySelectorAll("script");if(t){for(var n=0;t.length>n;n++)if(t[n].src===e||t[n].getAttribute("src")===e)return t[n]}},Aa=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return q4.warn(t+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var r=kh(t);if(r){if(r.__posthog_loading_callback_fired)return n();var a=r.__posthog_loading_error;return a?n(a):(r.addEventListener("load",(u=>{r.__posthog_loading_callback_fired=!0,n(void 0,u)})),void r.addEventListener("error",(u=>{r.__posthog_loading_error=u,n(u)})))}var o=()=>{if(!pe)return n("document not found");if(kh(t))return Aa(e,t,n);var u=pe.createElement("script");if(u.type="text/javascript",u.crossOrigin="anonymous",u.src=t,u.onload=p=>{u.__posthog_loading_callback_fired=!0,n(void 0,p)},u.onerror=p=>{u.__posthog_loading_error=p,n(p)},e.config.prepare_external_dependency_script&&(u=e.config.prepare_external_dependency_script(u)),!u)return n("prepare_external_dependency_script returned null");if(e.config.external_scripts_inject_target==="head")pe.head.appendChild(u);else{var d,f=pe.querySelectorAll("body > script");f.length>0?(d=f[0].parentNode)==null||d.insertBefore(u,f[0]):pe.body.appendChild(u)}};pe!=null&&pe.body?o():pe==null||pe.addEventListener("DOMContentLoaded",o)},bm={},Wy=(e,t)=>{var n="/static/"+t+".js?v="+e.version;if(t==="toolbar"){var r=3e5;n=n+"&t="+Math.floor(Date.now()/r)*r}return e.requestRouter.endpointFor("assets",n)};De.__PosthogExtensions__=De.__PosthogExtensions__||{},De.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{if(t!=="remote-config"){var r=e.config.strict_script_versioning;if(r){var a=e.requestRouter.endpointFor("assets","/static/"+e.version+"/"+t+".js"),o=bm[a];if(r==="fallback"&&o){if(kh(o))return void Aa(e,o,n);delete bm[a]}Aa(e,a,r==="fallback"?(d,f)=>{if(d)if(typeof d=="string")n(d);else{var p,m=Wy(e,t);bm[a]=m;var x=kh(a);x==null||(p=x.parentNode)==null||p.removeChild(x),Aa(e,m,n)}else n(void 0,f)}:n)}else Aa(e,Wy(e,t),n)}else{var u=e.requestRouter.endpointFor("assets","/array/"+e.config.token+"/config.js");Aa(e,u,n)}},De.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{var r=e.requestRouter.endpointFor("api",t);Aa(e,r,n)};Pt.DEBUG=!1,Pt.LIB_VERSION="1.427.2",Pt.LIB_NAME="web";var h2="$people_distinct_id",En="distinct_id",Yc="$device_id",ym="$device_model",Fl="__alias",Gs="$fbc",ur="$fbc_persistence",jc="__timers",Dg="$autocapture_disabled_server_side",Lg="$heatmaps_enabled_server_side",Og="$exception_capture_enabled_server_side",zg="$error_tracking_suppression_rules",Bg="$error_tracking_capture_extension_exceptions",Pg="$web_vitals_enabled_server_side",Bx="$dead_clicks_enabled_server_side",Px="$product_tours_enabled_server_side",$g="$logs_capture_enabled_server_side",Fg="$web_vitals_allowed_metrics",Da="$session_recording_remote_config",f2="$replay_sample_rate",p2="$replay_override_sampling",m2="$replay_override_linked_flag",g2="$replay_override_url_trigger",x2="$replay_override_event_trigger",Ul="$sesid",$x="$session_is_sampled",On="$enabled_feature_flags",Yr="$active_feature_flags",eh="$early_access_features",qi="$feature_flag_details",is="$feature_flag_payloads",Vi="$feature_flag_request_id",Wl="$minimal_flag_called_events",_s="$override_feature_flags",Ta="$override_feature_flag_payloads",kr="$stored_person_properties",Ss="$stored_group_properties",v2="$groups",Ug="$surveys",Sh="$surveys_loaded_at",Ig="$surveys_activated",th="$surveys_activated_session",nh="$surveys_activated_timestamps",Nc="ph_product_tours",Js="$flag_call_reported",Cc="$flag_call_reported_session_id",Ql="$feature_flag_errors",ri="$feature_flag_evaluated_at",tt="$user_state",Hg="$client_session_props",qg="$capture_rate_limit",Vg="$initial_campaign_params",Gg="$initial_referrer_info",Il="$initial_person_info",jh="$epp",El="$posthog_cookieless",b2="$cookieless_mode",y2="$sdk_debug_extensions_init_method",_2="$sdk_debug_extensions_init_time_ms",Yg="$sdk_debug_recording_script_not_loaded",Fx="PostHog loadExternalDependency extension not found.",Hi="on_reject",ei="always",cn="anonymous",zn="identified",Wg="identified_only",eo="visibilitychange",Nh="beforeunload",Hl="$pageview",_m="$pageleave",Qg="$identify",Qy="$groupidentify";function Md(e,t){Pe(e)&&e.forEach(t)}function Nt(e,t){if(!Ye(e))if(Pe(e))e.forEach(t);else if(G3(e))e.forEach(((r,a)=>t(r,a)));else for(var n in e)Tw.call(e,n)&&t(e[n],n)}var $t=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;t>r;r++)n[r-1]=arguments[r];for(var a of n)for(var o in a)a[o]!==void 0&&(e[o]=a[o]);return e};function rh(e){for(var t=Object.keys(e),n=t.length,r=new Array(n);n--;)r[n]=[t[n],e[t[n]]];return r}var Xy=function(e){try{return e()}catch{return}},V4=function(e){return function(){try{for(var t=arguments.length,n=new Array(t),r=0;t>r;r++)n[r]=arguments[r];return e.apply(this,n)}catch(a){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(a)}}},Ux=function(e){var t={};return Nt(e,(function(n,r){(at(n)&&n.length>0||an(n))&&(t[r]=n)})),t},G4=["herokuapp.com","vercel.app","netlify.app"];function Y4(e){var t=e==null?void 0:e.hostname;if(!at(t))return!1;var n=t.split(".").slice(-2).join(".");for(var r of G4)if(n===r)return!1;return!0}function Dt(e,t,n,r){var a=r??{},o=a.capture,u=a.passive;e==null||e.addEventListener(t,n,{capture:o!==void 0&&o,passive:u===void 0||u})}function Xg(e){return e.name==="ph_toolbar_internal"}var Kg=e=>{if(pe){try{for(var t=e+"=",n=pe.cookie.split(";").filter((o=>o.length)),r=0;n.length>r;r++){for(var a=n[r];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 an(e)&&isFinite(e)&&Math.floor(e)===e});class Ch{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,n,r,a){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(a)||0>t||0>n||0>r||0>a||t>0xffffffffffff||n>4095||r>1073741823||a>4294967295)throw new RangeError("invalid field value");var 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|r>>>24,o[9]=r>>>16,o[10]=r>>>8,o[11]=r,o[12]=a>>>24,o[13]=a>>>16,o[14]=a>>>8,o[15]=a,new Ch(o)}toString(){for(var t="",n=0;this.bytes.length>n;n++)t=t+(this.bytes[n]>>>4).toString(16)+(15&this.bytes[n]).toString(16),n!==3&&n!==5&&n!==7&&n!==9||(t+="-");if(t.length!==36)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new Ch(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(var n=0;16>n;n++){var r=this.bytes[n]-t.bytes[n];if(r!==0)return Math.sign(r)}return 0}}class W4{generate(){var t=this.generateOrAbort();if(!ce(t))return t;this.Kr=0;var n=this.generateOrAbort();if(ce(n))throw new Error("Could not generate UUID after timestamp reset");return n}generateOrAbort(){var t=Date.now();if(t>this.Kr)this.Kr=t,this.Xr();else{if(this.Kr>=t+1e4)return;this.ti++,this.ti>4398046511103&&(this.Kr++,this.Xr())}return Ch.fromFieldsV7(this.Kr,Math.trunc(this.ti/Math.pow(2,30)),this.ti&Math.pow(2,30)-1,this.ei.nextUint32())}Xr(){this.ti=1024*this.ei.nextUint32()+(1023&this.ei.nextUint32())}constructor(){this.Kr=0,this.ti=0,this.ei=new Q4}}var Ky,w2=e=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};te&&!ce(te.crypto)&&crypto.getRandomValues&&(w2=e=>crypto.getRandomValues(e));class Q4{nextUint32(){return this.De.length>this.ri||(w2(this.De),this.ri=0),this.De[this.ri++]}constructor(){this.De=new Uint32Array(8),this.ri=1/0}}var as=()=>X4().toString(),X4=()=>(Ky||(Ky=new W4)).generate(),uc="",K4=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,Al=null,Kt={ii(){if(!sn(Al))return Al;if(Al=!1,pe)try{var e="__ph_cookie_support_"+as();Kt.ni(e,"xyz"),Al=Kg(e)==='"xyz"',Kt.oi(e)}catch{Al=!1}return Al},si(e){ye.error("cookieStore error: "+e)},ai:Kg,ui(e){var t;try{t=JSON.parse(Kt.ai(e))||{}}catch{}return t},ni(e,t,n,r,a){if(!pe)return!1;try{var o="",u="",d=(function(m,x){if(x){var b=(function(_,j){if(j===void 0&&(j=pe),uc)return uc;if(!j||["localhost","127.0.0.1"].includes(_))return"";for(var N=_.split("."),w=Math.min(N.length,8),E="dmn_chk_"+as();!uc&&w--;){var C=N.slice(w).join("."),T=E+"=1;domain=."+C+";path=/";j.cookie=T+";max-age=3",j.cookie.includes(E)&&(j.cookie=T+";max-age=0",uc=C)}return uc})(m);if(!b){var y=(_=>{var j=_.match(K4);return j?j[0]:""})(m);y!==b&&ye.info("Warning: cookie subdomain discovery mismatch",y,b),b=y}return b?"; domain=."+b:""}return""})(pe.location.hostname,r);if(n){var f=new Date;f.setTime(f.getTime()+864e5*n),o="; expires="+f.toUTCString()}a&&(u="; secure");var p=e+"="+encodeURIComponent(JSON.stringify(t))+o+"; SameSite=Lax; path=/"+d+u;return p.length>3686.4&&ye.warn("cookieStore warning: large cookie, len="+p.length),pe.cookie=p,!0}catch{return!1}},oi(e,t){if(pe!=null&&pe.cookie)try{Kt.ni(e,"",-1,t)}catch{return}}},wm=null,ut={ii(){if(!sn(wm))return wm;var e=!0;if(ce(te))e=!1;else try{var t="__mplssupport__";ut.ni(t,"xyz"),ut.ai(t)!=='"xyz"'&&(e=!1),ut.oi(t)}catch{e=!1}return e||ye.error("localStorage unsupported; falling back to cookie store"),wm=e,e},si(e){ye.error("localStorage error: "+e)},ai(e){try{return te==null?void 0:te.localStorage.getItem(e)}catch(t){ut.si(t)}return null},ui(e){try{return JSON.parse(ut.ai(e))||{}}catch{}return null},ni(e,t){try{return te==null||te.localStorage.setItem(e,JSON.stringify(t)),!0}catch(n){ut.si(n)}return!1},oi(e){try{te==null||te.localStorage.removeItem(e)}catch(t){ut.si(t)}}},km=[kr,Yr,On,qi,is,Vi,ri,Ql,Js],Ma=[Yc,En,Ul,$x,jh,Il,ur,tt],Eh=e=>e+"_cpm",Z4=["__proto__","constructor","prototype"],Sm=e=>{if(!nt(e))return{};var t={};return Object.keys(e).forEach((n=>{Z4.indexOf(n)===-1&&(t[n]=e[n])})),t},jm=function(e,t){t===void 0&&(t=[]);var n={};return[...Ma,...t].forEach((r=>{var a=e[r];ce(a)||sn(a)||a===""||(n[r]=a)})),n},k2=e=>{for(var t=5381,n=2166136261,r=0;e.length>r;r++){var a=e.charCodeAt(r);t=33*t^a,n=Math.imul(n^a,16777619)}return e.length.toString(36)+"."+(t>>>0).toString(36)+"."+(n>>>0).toString(36)},Zy=(e,t)=>({p:t,f:k2(JSON.stringify(e))}),Jy=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{var n=Kt.ui(Eh(e)),r=(n==null?void 0:n.f)===k2(t)&&Pe(n.p);return{properties:r?n.p:[],isValid:r}}catch{return{properties:[],isValid:!1}}},Nm=(e,t)=>t+"|"+(Kt.ai(Eh(e))||""),Tl={},Zg={ii:()=>!0,si(e){ye.error("memoryStorage error: "+e)},ai:e=>e in Tl?Tl[e]:null,ui:e=>e in Tl?Tl[e]:null,ni:(e,t)=>(Tl[e]=t,!0),oi(e){delete Tl[e]}},ka=null,Rt={ii(){if(!sn(ka))return ka;if(ka=!0,ce(te))ka=!1;else try{var e="__support__";Rt.ni(e,"xyz"),Rt.ai(e)!=='"xyz"'&&(ka=!1),Rt.oi(e)}catch{ka=!1}return ka},si(e){ye.error("sessionStorage error: ",e)},ai(e){try{return te==null?void 0:te.sessionStorage.getItem(e)}catch(t){Rt.si(t)}return null},ui(e){try{return JSON.parse(Rt.ai(e))||null}catch{}return null},ni(e,t){try{return te==null||te.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(n){Rt.si(n)}return!1},oi(e){try{te==null||te.sessionStorage.removeItem(e)}catch(t){Rt.si(t)}}};class J4{constructor(t){this._instance=t}get mn(){return this._instance.config}get consent(){return this.Vs()?0:this.Gs}isOptedOut(){return this.mn.cookieless_mode===ei||this.isRejected()||this.consent===-1&&this.mn.cookieless_mode===Hi}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.mn.opt_out_capturing_by_default}optInOut(t){this.Zs.ni(this.Qs,t?1:0,this.mn.cookie_expiration,this.mn.cross_subdomain_cookie,this.mn.secure_cookie)}reset(){this.Zs.oi(this.Qs,this.mn.cross_subdomain_cookie)}get Qs(){var t=this._instance.config,n=t.token,r=t.opt_out_capturing_cookie_prefix;return t.consent_persistence_name||(r?r+n:"__ph_opt_in_out_"+n)}get Gs(){var t=this.Zs.ai(this.Qs);return fm(t)?1:Ie(X3,t)?0:-1}get Zs(){var t=this.mn.opt_out_capturing_persistence_type,n=t==="localStorage"?ut:Kt,r=n.ii()?n:Zg;if(!this.Js||this.Js!==r){this.Js=r;var a=t==="localStorage"?Kt:ut;a.ai(this.Qs)&&(this.Js.ai(this.Qs)||this.optInOut(fm(a.ai(this.Qs))),a.oi(this.Qs,this.mn.cross_subdomain_cookie))}return this.Js}Vs(){return!!this.mn.respect_dnt&&[Nn==null?void 0:Nn.doNotTrack,Nn==null?void 0:Nn.msDoNotTrack,De.doNotTrack,Nn==null?void 0:Nn.globalPrivacyControl].some((t=>fm(t)))}}function S2(e,t){var n,r=e==null||(n=e.config)==null?void 0:n.get_current_url;if(!In(r))return t;try{var a=r(t);return at(a)&&a?a:t}catch(o){return ye.error("Error in get_current_url, falling back to window.location.href",o),t}}var j2="__POSTHOG_TOOLBAR__",eE=1,tE=3,nE=11;function e_(e){return e instanceof Element&&(e.id===j2||!(e.closest==null||!e.closest(".toolbar-global-fade-container")))}function Qi(e){return!!e&&e.nodeType===eE}function Cr(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function N2(e){return!!e&&e.nodeType===tE}function C2(e){return!!e&&e.nodeType===nE&&Qi(e.host)}var E2=1e3;function Ix(e){return e?qh(e).split(/\s+/):[]}function t_(e,t){var n=(function(r){var a,o=te==null||(a=te.location)==null?void 0:a.href;return ce(o)?void 0:S2(r,o)})(t);return!!(n&&e&&e.some((r=>n.match(r))))}function Ah(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return Ix(t)}function A2(e){return Ye(e)?null:qh(e).split(/(\s+)/).filter((t=>Lc(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Wc(e){var t="";return tx(e)&&!L2(e)&&e.childNodes&&e.childNodes.length&&Nt(e.childNodes,(function(n){var r;N2(n)&&n.textContent&&(t+=(r=A2(n.textContent))!==null&&r!==void 0?r:"")})),qh(t)}function Jg(e){var t;return ce(e.target)?e.srcElement||null:(t=e.target)!=null&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}var Hx=["a","button","form","input","select","textarea","label"];function ex(e,t){if(ce(t))return!0;var n,r=function(o){if(t.some((u=>(function(d,f){var p=d.matches||d.matchesSelector||d.msMatchesSelector||d.mozMatchesSelector||d.webkitMatchesSelector||d.oMatchesSelector;try{return!!p&&p.call(d,f)}catch{return!1}})(o,u))))return{v:!0}};for(var a of e)if(n=r(a))return n.v;return!1}function T2(e){var t=e.parentNode;return!(!t||!Qi(t))&&t}var rE=[".ph-no-autocapture","[data-ph-no-autocapture]"],M2=["next","previous","prev",">","<"],sE=[...M2,"+","-","−","–"],n_=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,r_=[".ph-no-rageclick",".ph-no-capture"],iE=["","text","search","email","password","url","tel","number"];function R2(e,t){if(!te||qx(e))return!1;var n,r,a,o,u;if(Kn(t)?(n=!!t&&r_,r=void 0,a=!1):(n=(o=t==null?void 0:t.css_selector_ignorelist)!==null&&o!==void 0?o:r_,r=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||!Qi(f))&&(!!Cr(f,"textarea")||(Cr(f,"input")?Ie(iE,(f.getAttribute("type")||"").toLowerCase()):(function(p){if(p.isContentEditable)return!0;var m=p.getAttribute==null?void 0:p.getAttribute("contenteditable");return m==="true"||m===""})(f)))})(e))return!1;var d=D2(e,!1).targetElementList;return!(function(f,p){if(f===!1||ce(f))return!1;var m;if(f===!0)m=M2;else{if(!Pe(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;m=f.map((x=>x.toLowerCase()))}return p.some((x=>{var b=x.safeText,y=x.ariaLabel;return m.some((_=>n_(b,_)||n_(y,_)))}))})(r,d.map((f=>{var p;return{safeText:Wc(f).toLowerCase(),ariaLabel:((p=f.getAttribute("aria-label"))==null?void 0:p.toLowerCase().trim())||""}})))&&!ex(d,n)}var qx=e=>!e||Cr(e,"html")||!Qi(e),D2=(e,t)=>{if(!te||qx(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,r=[e],a=e;a.parentNode&&!Cr(a,"body");)if(C2(a.parentNode))r.push(a.parentNode.host),a=a.parentNode.host;else{var o=T2(a);if(!o)break;if(t||Hx.indexOf(o.tagName.toLowerCase())>-1)n=!0;else try{var u=te.getComputedStyle(o);u&&u.getPropertyValue("cursor")==="pointer"&&(n=!0)}catch{}r.push(o),a=o}return{parentIsUsefulElement:n,targetElementList:r}};function tx(e){for(var t=new Set,n=0,r=e;r.parentNode&&!Cr(r,"body");r=r.parentNode){if(n++>=E2||t.has(r))return!1;t.add(r);var a=Ah(r);if(Ie(a,"ph-sensitive")||Ie(a,"ph-no-capture"))return!1}if(Ie(Ah(e),"ph-include"))return!0;var o=e.type||"";if(at(o))switch(o.toLowerCase()){case"hidden":case"password":return!1}var u=e.name||e.id||"";return!at(u)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(u.replace(/[^a-zA-Z0-9]/g,""))}function L2(e){return!!(Cr(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Cr(e,"select")||Cr(e,"textarea")||e.getAttribute("contenteditable")==="true")}var s_=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}))$"),i_=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,aE=[16,15,14,13],lE=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),a_=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),l_=/[0-9A-Za-z_]/;function oE(e){for(var t=0,n=!1,r=e.length-1;r>=0;r--){var a=e.charCodeAt(r)-48;n&&(a*=2)>9&&(a-=9),t+=a,n=!n}return t%10==0}function Lc(e,t){if(t===void 0&&(t=!0),Ye(e))return!1;if(at(e)){e=qh(e);var n=t?s_.test((e||"").replace(/[- ]/g,"")):(function(a){var o;for(i_.lastIndex=0;o=i_.exec(a);){var u=o[2];if(u)for(var d=u.replace(/[- ]/g,""),f=0;d.length>f;f++)for(var p of aE){var m=f+p;if(d.length>=m){var x=d.slice(f,m);if(s_.test(x)&&oE(x))return!0}}}return!1})(e);if(n)return!1;var r=t?lE.test(e):(function(a){var o;for(a_.lastIndex=0;o=a_.exec(a);){var u=o[1],d=o[3];if(!(u&&d&&l_.test(u)&&l_.test(d)))return!0}return!1})(e);if(r)return!1}return!0}function o_(e){var t=Wc(e);return Lc(t=(t+" "+O2(e)).trim())?t:""}function O2(e){var t="";return e&&e.childNodes&&e.childNodes.length&&Nt(e.childNodes,(function(n){var r;if(n&&((r=n.tagName)==null?void 0:r.toLowerCase())==="span")try{var a=Wc(n);t=(t+" "+a).trim(),n.childNodes&&n.childNodes.length&&(t=(t+" "+O2(n)).trim())}catch(o){ye.error("[AutoCapture]",o)}})),t}function c_(e){return e.replace(/"|\\"/g,'\\"')}function cE(e){var t=e.attr__class;if(t)return Pe(t)?t:Ix(t)}var Rd=Gt("[Dead Clicks]"),uE=()=>!0,dE=e=>{var t,n=!((t=e.instance.persistence)==null||!t.get_property(Bx)),r=e.instance.config.capture_dead_clicks;return Kn(r)?r:!!nt(r)||n};class u_{get lazyLoadedDeadClicksAutocapture(){return this.Ks}constructor(t,n,r){this.instance=t,this.isEnabled=n,this.onCapture=r,this.startIfEnabledOrStop()}onRemoteConfig(t){if(t.ok){var n=t.config;"captureDeadClicks"in n&&(this.instance.persistence&&this.instance.persistence.register({[Bx]:n.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.Ys((()=>{this.Xs()})):this.stop()}Ys(t){var n,r;(n=De.__PosthogExtensions__)!=null&&n.initDeadClicksAutocapture?t():(r=De.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this.instance,"dead-clicks-autocapture",(a=>{a?Rd.error("failed to load script",a):t()}))}Xs(){var t;if(pe){if(!this.Ks&&(t=De.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture){var n=nt(this.instance.config.capture_dead_clicks)?de({},this.instance.config.capture_dead_clicks):{};n.__onCapture=this.onCapture,this.onCapture&&(n.capture_dead_swipes=!1),this.Ks=De.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.Ks.start(pe),Rd.info("starting...")}}else Rd.error("`document` not found. Cannot start.")}stop(){this.Ks&&(this.Ks.stop(),this.Ks=void 0,Rd.info("stopping..."))}}var Dd=Gt("[SegmentIntegration]");function d_(e,t,n){n===void 0&&(n=!0);var r=e.config.segment;if(!r)return t();(function(a,o,u){var d=a.config.segment;if(!d)return o();var f=m=>{var x=()=>m.anonymousId()||as();a.config.get_device_id=x,u&&m.id()&&(a.register({distinct_id:m.id(),$device_id:x()}),a.persistence.set_property(tt,zn)),o(u?void 0:m.anonymousId()||void 0)},p=d.user();"then"in p&&In(p.then)?p.then(f):f(p)})(e,(a=>{r.register(((o,u)=>{typeof Promise<"u"&&Promise.resolve||Dd.warn("This browser does not have Promise support, and can not use the segment integration");var d=(f,p)=>{if(!p)return f;var m=!!u&&f.event.anonymousId===u&&!f.event.userId;m||f.event.userId||f.event.anonymousId===o.get_distinct_id()||(Dd.info("No userId set, resetting PostHog"),o.reset()),m||(u=void 0),f.event.userId&&f.event.userId!==o.get_distinct_id()&&(Dd.info("UserId set, identifying with PostHog"),o.identify(f.event.userId));var x=o.calculateEventProperties(p,f.event.properties);return f.event.properties=Object.assign({},x,f.event.properties),f};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(f){return d(f,f.event.event)},page(f){return d(f,Hl)},identify(f){return d(f,Qg)},screen(f){return d(f,"$screen")}}})(e,a)).then((()=>{t()}),(o=>{Dd.error("Failed to register the Segment integration",o),t()}))}),n)}var z2="posthog-js";function B2(e,t){var n=t===void 0?{}:t,r=n.organization,a=n.projectId,o=n.prefix,u=n.severityAllowList,d=u===void 0?["error"]:u,f=n.sendExceptionsToPostHog,p=f===void 0||f;return m=>{var x,b,y,_,j;if(d!=="*"&&!d.includes(m.level)||!e.__loaded)return m;m.tags||(m.tags={});var N=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());m.tags["PostHog Person URL"]=N,e.sessionRecordingStarted()&&(m.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var w,E=((x=m.exception)==null?void 0:x.values)||[],C=E.map((O=>de({},O,{stacktrace:O.stacktrace?de({},O.stacktrace,{type:"raw",frames:(O.stacktrace.frames||[]).map((z=>de({},z,{platform:"web:javascript"})))}):void 0}))),T={$exception_message:((b=E[0])==null?void 0:b.value)||m.message,$exception_type:(y=E[0])==null?void 0:y.type,$exception_level:m.level,$exception_list:C,$sentry_event_id:m.event_id,$sentry_exception:m.exception,$sentry_exception_message:((_=E[0])==null?void 0:_.value)||m.message,$sentry_exception_type:(j=E[0])==null?void 0:j.type,$sentry_tags:m.tags};return r&&a&&(T.$sentry_url=(o||"https://sentry.io/organizations/")+r+"/issues/?project="+a+"&query="+m.event_id),p&&((w=e.exceptions)==null||w.sendExceptionEvent(T)),m}}class hE{constructor(t,n,r,a,o,u){this.name=z2,this.setupOnce=function(d){d(B2(t,{organization:n,projectId:r,prefix:a,severityAllowList:o,sendExceptionsToPostHog:u==null||u}))}}}class h_{constructor(t){this.eo=(n,r,a)=>{a&&(a.noSessionId||a.activityTimeout||a.sessionPastMaximumLength||a.crossTabAdoption)&&(ye.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:n,changeReason:a}),this.io=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.ro()}ro(){var t;this.no=(t=this._instance.sessionManager)==null?void 0:t.onSessionId(this.eo)}destroy(){var t;(t=this.no)==null||t.call(this),this.no=void 0}doPageView(t,n){var r,a=this.so(t,n);return this.io={pathname:(r=te==null?void 0:te.location.pathname)!==null&&r!==void 0?r:"",pageViewId:n,timestamp:t},this._instance.scrollManager.resetContext(),a}doPageLeave(t){var n;return this.so(t,(n=this.io)==null?void 0:n.pageViewId)}doEvent(){var t;return{$pageview_id:(t=this.io)==null?void 0:t.pageViewId}}so(t,n){var r=this.io;if(!r)return{$pageview_id:n};var a={$pageview_id:n,$prev_pageview_id:r.pageViewId},o=this._instance.scrollManager.getContext();if(o&&!this._instance.config.disable_scroll_properties){var u=o.maxScrollHeight,d=o.lastScrollY,f=o.maxScrollY,p=o.maxContentHeight,m=o.lastContentY,x=o.maxContentY;if(!(ce(u)||ce(d)||ce(f)||ce(p)||ce(m)||ce(x))){u=Math.ceil(u),d=Math.ceil(d),f=Math.ceil(f),p=Math.ceil(p),m=Math.ceil(m),x=Math.ceil(x);var b=u>1?js(d/u,0,1,ye):1,y=u>1?js(f/u,0,1,ye):1,_=p>1?js(m/p,0,1,ye):1,j=p>1?js(x/p,0,1,ye):1;a=$t(a,{$prev_pageview_last_scroll:d,$prev_pageview_last_scroll_percentage:b,$prev_pageview_max_scroll:f,$prev_pageview_max_scroll_percentage:y,$prev_pageview_last_content:m,$prev_pageview_last_content_percentage:_,$prev_pageview_max_content:x,$prev_pageview_max_content_percentage:j})}}return r.pathname&&(a.$prev_pageview_pathname=r.pathname),r.timestamp&&(a.$prev_pageview_duration=(t.getTime()-r.timestamp.getTime())/1e3),a}}var dc=["flags","surveys"],fE={[h2]:{exposure:"hidden"},[Fl]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[jc]:{exposure:"hidden"},[ur]:{exposure:"hidden"},[Dg]:{exposure:"event"},[Lg]:{exposure:"hidden"},[$g]:{exposure:"hidden"},[Og]:{exposure:"event"},[zg]:{exposure:"hidden"},[Bg]:{exposure:"event"},[Pg]:{exposure:"event"},[Bx]:{exposure:"event"},[Px]:{exposure:"hidden"},[Fg]:{exposure:"event"},[Da]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[Ul]:{exposure:"hidden"},[$x]:{exposure:"event"},[f2]:{exposure:"event",shouldSkipFromEventProperties:e=>sn(e)},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},$sess_rec_flush_size:{exposure:"hidden"},[On]:{exposure:"hidden",storageGroup:"flags"},[Yr]:{exposure:"hidden",storageGroup:"flags"},[eh]:{exposure:"hidden"},[qi]:{exposure:"hidden",storageGroup:"flags"},[is]:{exposure:"hidden",storageGroup:"flags"},[Vi]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Wl]:{exposure:"hidden",storageGroup:"flags"},[_s]:{exposure:"hidden"},[Ta]:{exposure:"hidden"},[kr]:{exposure:"hidden"},[Ss]:{exposure:"hidden"},[Ug]:{exposure:"hidden",storageGroup:"surveys"},[Sh]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[Ig]:{exposure:"event"},[th]:{exposure:"hidden"},[nh]:{exposure:"hidden"},[Nc]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$product_tours_activated_session:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[Js]:{exposure:"hidden"},[Cc]:{exposure:"hidden"},[v2]:{exposure:"event"},[Ql]:{exposure:"hidden"},[ri]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[tt]:{exposure:"hidden"},[Hg]:{exposure:"hidden"},[qg]:{exposure:"hidden"},[Vg]:{exposure:"hidden"},[Gg]:{exposure:"hidden"},[Il]:{exposure:"hidden"},[jh]:{exposure:"hidden"},[p2]:{exposure:"event"},[m2]:{exposure:"event"},[g2]:{exposure:"event"},[x2]:{exposure:"event"},[y2]:{exposure:"event"},[_2]:{exposure:"event"},[Yg]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_pending_trigger_conditions:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},pE=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],An=e=>{var t=fE[e];if(t)return t;for(var n of pE){var r=n[1];if(e.indexOf(n[0])===0)return r}},ql=(e,t)=>{try{return JSON.stringify(e,((n,r)=>typeof r=="bigint"?r.toString():r),t)}catch{return Ew(e)}},to=e=>{var t=pe==null?void 0:pe.createElement("a");return ce(t)?null:(t.href=e,t)},no=function(e,t){for(var n,r=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),a=0;r.length>a;a++){var o=r[a].split("=");if(o[0]===t){n=o;break}}if(!Pe(n)||2>n.length)return"";var u=n[1];try{u=decodeURIComponent(u)}catch{ye.error("Skipping decoding for malformed query param: "+u)}return u.replace(/\+/g," ")},Qc=function(e,t,n){if(!e||!t||!t.length)return e;for(var r=e.split("#"),a=r[1],o=(r[0]||"").split("?"),u=o[1],d=o[0],f=(u||"").split("&"),p=[],m=0;f.length>m;m++){var x=f[m].split("=");Pe(x)&&(t.includes(x[0])?p.push(x[0]+"="+n):p.push(f[m]))}var b=d;return u!=null&&(b+="?"+p.join("&")),a!=null&&(b+="#"+a),b},Th=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},P2=(e,t)=>e>=t&&Nw(),$2=(e,t,n,r)=>{if(e===0){if(Nw()){var a=t+1;return a===n&&r(),a}return t}return 0},Ld="https?://(.*)",ro=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],mE=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...ro],Xc="<masked>",gE=["li_fat_id"];function F2(e,t,n){if(!pe)return{};var r,a=t?[...ro,...n||[]]:[],o=U2(Qc(pe.URL,a,Xc),e),u=(r={},Nt(gE,(function(d){var f=Kg(d);r[d]=f||null})),r);return $t(u,o)}function U2(e,t){var n=mE.concat(t||[]),r={};return Nt(n,(function(a){var o=no(e,a);r[a]=o||null})),r}function I2(e){var t=(function(o){return o?o.search(Ld+"google.([^/?]*)")===0?"google":o.search(Ld+"bing.com")===0?"bing":o.search(Ld+"yahoo.com")===0?"yahoo":o.search(Ld+"duckduckgo.com")===0?"duckduckgo":null:null})(e),n=t!="yahoo"?"q":"p",r={};if(!sn(t)){r.$search_engine=t;var a=pe?no(pe.referrer,n):"";a.length&&(r.ph_keyword=a)}return r}function f_(){return navigator.language||navigator.userLanguage}var Mh="$direct";function H2(){return(pe==null?void 0:pe.referrer)||Mh}function q2(e,t,n){n===void 0&&(n=!1);var r=e?[...ro,...t||[]]:[],a=n?Wi(Zt==null?void 0:Zt.href):Zt==null?void 0:Zt.href,o=a==null?void 0:a.substring(0,1e3);return{r:H2().substring(0,1e3),u:o?Qc(o,r,Xc):void 0}}function V2(e,t){var n;t===void 0&&(t=!1);var r=e.r,a=e.u,o=t?Wi(a):a,u={$referrer:r,$referring_domain:r==null?void 0:r==Mh?Mh:(n=to(r))==null?void 0:n.host};if(o){u.$current_url=o;var d=to(o);u.$host=d==null?void 0:d.host,u.$pathname=d==null?void 0:d.pathname;var f=U2(o);$t(u,f)}if(r){var p=I2(r);$t(u,p)}return u}function G2(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function xE(){try{return new Date().getTimezoneOffset()}catch{return}}var vE={flags:ri,surveys:Sh},bE=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Od=e=>e+"_cookie_identity_change_pending",zd=e=>{var t="",n=0;for(var r of e){var a=encodeURIComponent(JSON.stringify(r).slice(1,-1)).length;if(n+a>1e3)break;t+=r,n+=a}return t},vn="main",Zs=[On,Yr,qi,is,Vi,ri,Wl,kr],Cm=e=>Zs.indexOf(e)!==-1,$i=(e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch{return e===t}},Ml=e=>{if(!e)return{};var t=JSON.parse(e);return nt(t)?t:{}},p_=(e,t)=>{Nt(e,((n,r)=>{var a=An(r);a&&a.exposure!=="event"||{}.hasOwnProperty.call(t,r)||delete e[r]}))};class Em{constructor(t,n,r){if(r===void 0&&(r=!0),this.oo={},this.ao=!1,this.lo=!1,this.uo=!1,this.ho=!1,this.do=!1,this.vo=new Map,this.co=!1,this.fo=!1,this.po=!1,this.mo=!1,this.yo=new Set,this.mn=t,this.bo=r,this.props={},this._o=void 0,this.wo=(o=>{var u="";return o.token&&(u=o.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),o.persistence_name?"ph_"+o.persistence_name:"ph_"+u+"_posthog"})(t),this.Zs=this.ko(t),this.uo=this.So(t),this.load(),this.xo(),t.debug&&ye.info("Persistence loaded",t.persistence,de({},this.props)),this.update_config(t,t,n),this.save(),te){var a=()=>this.flush();Dt(te,"beforeunload",a,{capture:!1}),Dt(te,"pagehide",a,{capture:!1}),this.Co=o=>{if(this.ao&&(!o.storageArea||o.storageArea===(te==null?void 0:te.localStorage))&&o.key)if(o.key!==this.wo){if(this.uo){var u=dc.find((d=>o.key===this.To(d)));u&&this.Mo(o.key,u)}}else this.Mo(o.key,vn)},Dt(te,"storage",this.Co)}}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach((n=>{var r=n[0],a=n[1],o=this.vo.get(r);if(Cm(r)&&o!==!0)if(a!==!0){var u=new Set(o||[]);a.forEach((d=>u.add(d))),u.size&&this.Io(r,u)}else this.Io(r,!0)}))}onCrossTabFeatureFlagChange(t){return this.yo.add(t),()=>this.yo.delete(t)}destroy(){this.Co&&te&&(te.removeEventListener("storage",this.Co),this.Co=void 0),this.yo.clear()}Mo(t,n,r){if(r===void 0&&(r=!0),this.Eo)return!1;var a,o;try{if(o=ut.ai(t),sn(o)){var u=this.Ro(n);return u.storageValue=null,n!==vn&&(u.persisted=!1),!1}a=Ml(o)}catch{return!1}var d=n===vn?a:ut.ui(this.wo);if(d&&this.Po(d))return!1;var f=this.Ao(a,n,r);return n===vn&&this.uo&&!$i(this.Fo().main,a)||this.Oo(a,n,!0,o),f}Po(t){var n=this.props[En],r=t[En];return!ce(n)&&!ce(r)&&n!==r}Oo(t,n,r,a){var o=this.Ro(n);o.storageValue=a,n!==vn&&(o.persisted=r);try{o.fingerprint=this.Lo(t,n)}catch{o.fingerprint=void 0}}Ao(t,n,r){var a=!1;return Zs.forEach((o=>{var u,d=(u=An(o))==null?void 0:u.storageGroup;if(!(n===vn&&this.uo&&d||n!==vn&&d!==n)){var f=o in t,p=this.Do(o,f?t[o]:void 0),m=this.vo.has(o)?o in this.props:f;m===o in this.props&&$i(p,this.props[o])||(m?this.$o(o,p,!1):this.No(o,!1),a=!0)}})),a&&r&&this.yo.forEach((o=>o())),a}qo(){if(!this.ao)return!1;try{this.po=!1;var t,n=ut.ai(this.wo),r=this.Ro(vn),a=!1,o=!1;if(n!==r.storageValue)if(sn(n))r.storageValue=null;else{if(t=Ml(n),this.po=!this.fo&&this.Po(t),this.po)return!1;o=this.Ao(t,vn,!1),!this.uo||$i(this.Fo().main,t)?this.Oo(t,vn,!0,n):r.storageValue=n,a=!0}return this.uo&&dc.forEach((u=>{var d=ut.ai(this.To(u)),f=this.Ro(u),p=t||{},m=a&&Zs.some((b=>{var y;return((y=An(b))==null?void 0:y.storageGroup)===u&&b in p}));if(d!==f.storageValue||m){if(sn(d))return f.storageValue=null,f.persisted=!1,void(m&&(o=this.Ao(p,u,!1)||o));var x=Ml(d);o=this.Ao(x,u,!1)||o,this.Oo(x,u,!0,d)}})),o}catch{return!1}}Io(t,n){this.vo.set(t,n);var r=An(t);r!=null&&r.volatile||(this.Ro((this.uo?r==null?void 0:r.storageGroup:void 0)||vn).fingerprint=void 0,this.jo(t))}Bo(){Zs.forEach((t=>this.vo.set(t,!0)))}xo(){if(this.ao)try{var t=ut.ai(this.wo),n=Ml(t);this.Ro(vn).storageValue=t,Zs.forEach((r=>{var a,o=this.uo?(a=An(r))==null?void 0:a.storageGroup:void 0,u=o?ut.ai(this.To(o)):null;if(o){var d=this.Ro(o);d.storageValue=u,d.persisted=!sn(u)}var f=o&&!sn(u)?Ml(u):n;r in this.props?this.Ho(r,f[r],this.props[r]):r in f&&this.Io(r,!0)}))}catch{}}Do(t,n){var r=this.vo.get(t);if(!r)return n;if(r===!0)return this.props[t];if(t===Yr){var a=new Set(Pe(n)?n:[]),o=new Set(Pe(this.props[t])?this.props[t]:[]);return r.forEach((f=>o.has(f)?a.add(f):a.delete(f))),Array.from(a)}var u=nt(n)?de({},n):{},d=nt(this.props[t])?this.props[t]:{};return r.forEach((f=>{f in d?u[f]=d[f]:delete u[f]})),u}Ho(t,n,r){if(Cm(t)){var a=this.vo.get(t);if(a!==!0){var o=n;if(this.ao)try{var u,d=this.uo?(u=An(t))==null?void 0:u.storageGroup:void 0,f=d?this.To(d):this.wo;o=Ml(ut.ai(f))[t]}catch{}var p=new Set(a||[]);if(t===Yr){if(!ce(n)&&!Pe(n)||!ce(o)&&!Pe(o)||!Pe(r))return void this.Io(t,!0);var m=new Set(n||[]),x=new Set(o||[]),b=new Set(r);new Set([...m,...b]).forEach((j=>{m.has(j)!==b.has(j)&&p.add(j)})),p.forEach((j=>{x.has(j)===b.has(j)&&p.delete(j)}))}else{if(!nt(r))return void($i(o,r)?this.vo.delete(t):this.Io(t,!0));if(!ce(n)&&!nt(n)||ce(n)&&Nr(r)&&ce(o))return void this.Io(t,!0);var y=nt(n)?n:{},_=nt(o)?o:{};new Set([...Object.keys(y),...Object.keys(r)]).forEach((j=>{j in y==j in r&&$i(y[j],r[j])||p.add(j)})),p.forEach((j=>{j in _==j in r&&$i(_[j],r[j])&&p.delete(j)}))}p.size?this.Io(t,p):this.vo.delete(t)}}}zo(){var t,n=(t=this.mn)==null?void 0:t.persistence_save_debounce_ms;return an(n)&&n>0?n:0}Uo(t){if(this.mn.cookieWinsOnConflict&&this.mn.persistence.toLowerCase()==="localstorage+cookie")if(t)try{var n=jm(t,this.mn.cookie_persisted_properties||[]),r=Zy(n,this.mn.cookie_persisted_properties||[]),a=JSON.stringify(n)+"|"+JSON.stringify(r),o=Kt.ai(this.wo)||void 0;o&&Nm(this.wo,o)===a&&(this.Wo=a,this.Vo=o)}catch{}else try{var u=Kt.ai(this.wo)||void 0;this.Wo=u?Nm(this.wo,u):void 0,this.Vo=u}catch{}}syncCookieProperties(){return this.Go(this.mn)}Go(t,n){if(n===void 0&&(n=!1),this.Eo&&!n||this.do||!t.cookieWinsOnConflict||t.persistence.toLowerCase()!=="localstorage+cookie")return!1;var r;try{r=Kt.ai(this.wo)||void 0}catch{}if(!r||r===this.Vo)return!1;var a,o=Nm(this.wo,r);try{a=Sm(JSON.parse(r))}catch{return!1}if((Kt.ai(this.wo)||void 0)!==r)return!1;this.Wo=o,this.Vo=r;var u=Jy(this.wo,r),d=[...Ma,...u.properties],f={};if(Object.keys(a).forEach((N=>{var w=a[N];(ce(w)||sn(w)||w===""||N===tt&&w!==cn&&w!==zn)&&(f[N]=!0,delete a[N])})),Nr(a))return!1;var p=En in a||a[tt]===cn||a[tt]===zn,m=this.props,x=m[En],b=m[tt],y=$t({},m);[...Ma,...t.cookie_persisted_properties||[]].forEach((N=>{if(d.indexOf(N)!==-1&&!(N in a)&&!f[N]&&(p||N!==En&&N!==tt)){var w=y[N];!u.isValid&&Ma.indexOf(N)!==-1&&(w===!1||w===0)||delete y[N]}})),this.props=$t(y,a),Zs.forEach((N=>{var w=N in this.props;N in m===w&&$i(m[N],this.props[N])||(w?this.Ho(N,m[N],this.props[N]):this.Io(N,!0))})),!p||tt in a||tt in this.props||this.$o(tt,cn);var _=this.props[En],j=this.props[tt];return!p||_===x&&j===b||(this.fo=!0,this.ho=!0,Rt.ni(Od(this.wo),!0),this.No(kr),this.No(Yr),this.No(On),this.No(qi),this.No(is),this.No(Vi),this.No(ri),this.No(Ql),this.No(Js),j===cn&&(b===zn||a[tt]===cn||!ce(x)&&_!==x)&&(p_(this.props,a),this.No(Ss)),j===zn?this.props.$user_id=_:delete this.props.$user_id,this.No(Fl)),!0}consumeCookieIdentityChange(){var t=Od(this.wo),n=this.ho||!!Rt.ai(t);return this.ho=!1,n&&Rt.oi(t),n}Zo(t){return t===void 0&&(t=!1),!(this.do||this.Eo&&!t||!this.mn.cookieWinsOnConflict||this.mn.persistence.toLowerCase()!=="localstorage+cookie"||(this.do=!0,0))}Qo(){this.do&&(ce(this.Jo)||(clearTimeout(this.Jo),this.Jo=void 0),delete this.oo[vn],this.Ko(!0))}Yo(t){if(t===void 0&&(t=!0),this.do)try{t?this.Qo():ce(this.Jo)||(clearTimeout(this.Jo),this.Jo=void 0)}finally{this.do=!1}}isDisabled(){return!!this.Eo}ko(t){bE.indexOf(t.persistence.toLowerCase())===-1&&(ye.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var n,r=(function(d,f){d===void 0&&(d=[]),f===void 0&&(f=!1);var p=[...Ma,...d];return de({},ut,{ui(m){try{var x,b={};try{x=Kt.ai(m)||void 0,b=x?Sm(JSON.parse(x)):{}}catch{}var y,_=JSON.parse(ut.ai(m)||"{}");if(f){var j=Jy(m,x),N=[...Ma,...j.properties],w={};Object.keys(b).forEach((z=>{var I=b[z];sn(I)||I===""||z===tt&&I!==cn&&I!==zn||(w[z]=I)}));var E=En in w||w[tt]===cn||w[tt]===zn;if(Object.keys(w).length>0){var C,T=_[En],O=(C=_[tt])!==null&&C!==void 0?C:cn;p.forEach((z=>{if(N.indexOf(z)!==-1&&!(z in b)&&(E||z!==En&&z!==tt)){var I=_[z];!j.isValid&&Ma.indexOf(z)!==-1&&(I===!1||I===0)||delete _[z]}})),!E||tt in b||tt in _||(_[tt]=cn),!E||(En in w?w[En]:_[En])===T&&(tt in w?w[tt]:_[tt])===O||(km.forEach((z=>delete _[z])),w[tt]===zn&&En in w?_.$user_id=w[En]:delete _.$user_id,w[tt]!==zn&&(delete _[v2],delete _[Ss]),delete _.__alias)}y=$t(_,w)}else y=$t(b,_);return ut.ni(m,y),y}catch{}return null},ni(m,x,b,y,_,j){var N=ut.ni(m,x,void 0,void 0,j);try{var w=jm(x,d);if(Object.keys(w).length){if(f){var E=Eh(m),C=Zy(w,d);if(Kt.ni(E,C,b,y,_,j),Kt.ai(E)!==JSON.stringify(C)){Kt.oi(E,y);var T=jm(x);return Kt.ni(m,T,b,y,_,j),N}}Kt.ni(m,w,b,y,_,j)}}catch(O){ut.si(O)}return N},oi(m,x){try{te==null||te.localStorage.removeItem(m),Kt.oi(m,x),Kt.oi(Eh(m),x)}catch(b){ut.si(b)}}})})(t.cookie_persisted_properties||[],t.cookieWinsOnConflict),a=!1,o=!1,u=t.persistence.toLowerCase();return u==="localstorage"&&ut.ii()?(n=ut,o=!0):u==="localstorage+cookie"&&r.ii()?(n=r,o=!0,a=!0):u==="sessionstorage"&&Rt.ii()?n=Rt:u==="memory"?n=Zg:u==="cookie"&&Kt.ii()?(n=Kt,a=!0):r.ii()?(n=r,o=!0,a=!0):Kt.ii()?(n=Kt,a=!0):n=Zg,this.ao=o,this.lo=a,n}To(t){return this.wo+"__"+t}So(t){return this.ao&&!!t.split_storage}properties(){var t={};return Nt(this.props,((n,r)=>{var a=An(r);if(!a||a.exposure==="event"){if(a!=null&&a.shouldSkipFromEventProperties!=null&&a.shouldSkipFromEventProperties(n))return;t[r]=n}})),t}load(t){if(t===void 0&&(t=!1),!this.Eo||t){var n=this.mn.cookieWinsOnConflict&&this.mn.persistence.toLowerCase()==="localstorage+cookie",r=n?ut.ui(this.wo):null,a={};if(n)try{Nt(a=Sm(Kt.ui(this.wo)),((_,j)=>{(ce(_)||sn(_)||_==="")&&delete a[j]}))}catch{}var o=this.Zs.ui(this.wo);if(o&&(this.props=$t({},o)),this.uo&&this.Xo(),n&&o){var u,d,f=r==null?void 0:r[En],p=(u=r==null?void 0:r[tt])!==null&&u!==void 0?u:cn,m=o[En],x=(d=o[tt])!==null&&d!==void 0?d:cn;if(m!==f||x!==p){this.ho=!0,Rt.ni(Od(this.wo),!0);var b=$t({},this.props);km.forEach((_=>delete b[_])),x===cn&&(p===zn||a[tt]===cn||!ce(f)&&m!==f)&&(p_(b,a),delete b[Ss]),this.props=b;var y=new Set;km.forEach((_=>{var j,N=(j=An(_))==null?void 0:j.storageGroup;N&&y.add(N)})),y.forEach((_=>{var j={};Nt(this.props,((N,w)=>{var E;((E=An(w))==null?void 0:E.storageGroup)===_&&(j[w]=N)})),Nr(j)?(ut.oi(this.To(_)),this.oo[_]={}):ut.ni(this.To(_),j)&&(this.oo[_]={persisted:!0,fingerprint:this.Lo(j,_)})}))}}Rt.ai(Od(this.wo))&&(this.ho=!0)}}Xo(){for(var t of dc){var n=ut.ui(this.To(t));if(n&&!Nr(n)){var r=this.Ro(t);r.persisted=!0,this.ta(t)||(r.fingerprint=this.Lo(n,t)),this.ea(t,n)||$t(this.props,n)}}}ta(t){return Object.keys(this.props).some((n=>{var r;return((r=An(n))==null?void 0:r.storageGroup)===t}))}ea(t,n){var r=vE[t];if(!r)return!1;var a=n[r],o=this.props[r];return an(a)&&an(o)&&o>a}refreshKey(t){var n;if(!(this.Eo||t===ur&&this.mo)){var r=this.uo?(n=An(t))==null?void 0:n.storageGroup:void 0,a=r?ut.ui(this.To(r)):this.Zs.ui(this.wo);if(a&&t in a)this.$o(t,a[t],!1);else{if(r){var o=this.Zs.ui(this.wo);if(o&&t in o)return void this.$o(t,o[t],!1)}this.No(t,!1)}}}save(){if(!this.Eo){var t=this.zo();t>0?ce(this.Jo)&&(this.Jo=setTimeout((()=>{this.Jo=void 0,this.Ko()}),t)):this.Ko()}}flush(){ce(this.Jo)||(clearTimeout(this.Jo),this.Jo=void 0,this.Ko())}Ko(t){if(t===void 0&&(t=!1),!(this.Eo||this.do&&!t)){t||(this.syncCookieProperties(),this.mo||this.mn.cookieWinsOnConflict&&this.mn.persistence.toLowerCase()==="localstorage+cookie"||this.refreshKey(ur));var n=!t&&!this.co;n||(this.po=!1);var r=!!n&&this.qo();if(this.po)this.mn.debug&&ye.warn("skipping persistence write because storage belongs to a different distinct ID");else{if(this.uo)return this.ia(),void(r&&this.yo.forEach((o=>o())));var a=this.ra(this.Zs,this.wo,this.props,vn);a==="written"&&this.Uo(this.props),a!=="failed"&&(this.vo.clear(),this.fo=!1,this.mo=!1),r&&this.yo.forEach((o=>o()))}}}ia(){var t=this,n=this.Fo(),r=n.main,a=n.groups,o=this.ra(this.Zs,this.wo,r,vn);o==="written"&&this.Uo(r),o!=="failed"&&(this.fo=!1,this.mo=!1,Zs.forEach((f=>{var p;(p=An(f))!=null&&p.storageGroup||this.vo.delete(f)})));var u=function(f){var p,m=a[f];if(Nr(m)&&((p=t.oo[f])==null||!p.persisted))return Zs.forEach((b=>{var y;((y=An(b))==null?void 0:y.storageGroup)===f&&t.vo.delete(b)})),1;var x=t.ra(ut,t.To(f),m,f);x!=="failed"&&Zs.forEach((b=>{var y=An(b);(y==null?void 0:y.storageGroup)!==f||x!=="written"&&y.volatile||t.vo.delete(b)}))};for(var d of dc)u(d)}Fo(){var t={},n={flags:{},surveys:{}};return Nt(this.props,((r,a)=>{var o,u=(o=An(a))==null?void 0:o.storageGroup;u?n[u][a]=r:t[a]=r})),{main:t,groups:n}}Lo(t,n){if(n===vn)return JSON.stringify(t)+"|"+this.na+"|"+this.sa+"|"+this.oa;var r={};return Nt(t,((a,o)=>{var u;r[o]=(u=An(o))!=null&&u.volatile?"__volatile__":a})),JSON.stringify(r)}ra(t,n,r,a){var o,u=this.Ro(a);if(a!==vn&&!u.dirty&&!ce(u.fingerprint))return"skipped";try{if((o=this.Lo(r,a))===u.fingerprint)return u.dirty=!1,"skipped"}catch{o=void 0}return t.ni(n,r,this.na,this.sa,this.oa,this.mn.debug)?(u.dirty=!1,a!==vn&&(u.persisted=!0),ce(o)||(u.fingerprint=o),this.ao&&(u.storageValue=ut.ai(n)),"written"):(this.mn.debug&&ye.warn('failed to persist storage entry "'+n+'"; will retry on next save'),"failed")}remove(t){var n=(t===void 0?{}:t).keepGroupEntries,r=n!==void 0&&n;if(this.Bo(),ce(this.Jo)||(clearTimeout(this.Jo),this.Jo=void 0),this.Zs.oi(this.wo,!1),this.Zs.oi(this.wo,!0),!r&&this.bo)for(var a of dc)ut.oi(this.To(a));r?delete this.oo[vn]:this.oo={},this.Wo=void 0,this.Vo=void 0}clear(){this.remove(),this.props={}}register_once(t,n,r){if(nt(t)){this.syncCookieProperties(),ce(n)&&(n="None"),this.na=ce(r)?this.aa:r;var a=!1;if(Nt(t,((o,u)=>{this.props.hasOwnProperty(u)&&this.props[u]!==n||(this.$o(u,o),a=!0)})),a)return this.save(),!0}return!1}register(t,n){if(nt(t)){this.syncCookieProperties(),this.na=ce(n)?this.aa:n;var r=!1;if(Nt(t,((a,o)=>{t.hasOwnProperty(o)&&(this.props[o]!==a||nt(a)||Pe(a))&&(this.$o(o,a),r=!0)})),r)return this.save(),!0}return!1}unregister(t){this.syncCookieProperties();var n=typeof t=="string"?[t]:t,r=!1;for(var a of n)a in this.props&&(this.No(a),r=!0);r&&this.save()}update_campaign_params(){var t=pe==null?void 0:pe.URL;if(t!==this._o){var n=F2(this.mn.custom_campaign_params,this.mn.mask_personal_data_properties,this.mn.custom_personal_data_properties),r=!Nr(Ux(n));return r&&this.register(n),this._o=t,r?n:void 0}}update_search_keyword(){var t;this.register((t=pe==null?void 0:pe.referrer)?I2(t):{})}update_referrer_info(){var t;this.register_once({$referrer:H2(),$referring_domain:pe!=null&&pe.referrer&&((t=to(pe.referrer))==null?void 0:t.host)||Mh},void 0)}set_initial_person_info(){if(!this.props[Vg]&&!this.props[Gg]){var t=q2(this.mn.mask_personal_data_properties,this.mn.custom_personal_data_properties,this.mn.disable_capture_url_hashes);this.register_once({[Il]:this.lo?{r:zd(t.r),u:t.u?zd(t.u):void 0}:t},void 0)}}get_initial_props(){var t={};Nt([Gg,Vg],(a=>{var o=this.props[a];o&&Nt(o,(function(u,d){t["$initial_"+kg(d)]=u}))}));var n=this.props[Il];if(n){var r=(function(a,o){o===void 0&&(o=!1);var u=V2(a,o),d={};return Nt(u,(function(f,p){d["$initial_"+kg(p)]=f})),d})(n,this.mn.disable_capture_url_hashes);$t(t,r)}return t}safe_merge(t){return Nt(this.props,(function(n,r){r in t||(t[r]=n)})),t}update_config(t,n,r){var a=t.persistence!==n.persistence,o=!((j,N)=>{if(j.length!==N.length)return!1;var w=[...j].sort(),E=[...N].sort();return w.every(((C,T)=>C===E[T]))})(t.cookie_persisted_properties||[],n.cookie_persisted_properties||[]),u=a||o,d=t.cookieWinsOnConflict!==n.cookieWinsOnConflict,f=t.disable_persistence||!!r,p=!!this.Eo&&!f;f||this.Go(n,p),this.mn=t,!f&&(a||o||d)&&(this.Wo=void 0,this.Vo=void 0,this.Go(de({},t,{cookie_persisted_properties:n.cookie_persisted_properties}),p));var m=u||d?this.ko(t):this.Zs;this.la();var x=this.So(t),b=u||x!==this.uo,y=!f&&(b||t.cross_subdomain_cookie!==this.sa||t.secure_cookie!==this.oa)&&this.Zo(p);this.co=b;try{if(this.aa=this.na=t.cookie_expiration,this.set_disabled(f),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),b){var _=this.props;this.clear(),this.Zs=m,this.uo=x,this.props=_,this.save()}else d&&(this.Zs=m,f||(delete this.oo[vn],this.Ko()))}finally{this.co=!1,y&&this.Yo()}}la(){var t=this.props[Il];if(this.lo&&nt(t)&&typeof t.r=="string"){var n=zd(t.r),r=typeof t.u=="string"?zd(t.u):t.u;n===t.r&&r===t.u||this.$o(Il,de({},t,{r:n,u:r}))}}set_disabled(t){this.Eo=t,this.Eo?this.remove():this.save()}set_cross_subdomain(t){t!==this.sa&&(this.sa=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.oa&&(this.oa=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,n){var r=this.props[jc]||{};r[t]=n,this.$o(jc,r),this.save()}remove_event_timer(t){var n=this.props[jc]||{},r=n[t];return ce(r)||(delete n[t],this.$o(jc,n),this.save()),r}get_property(t){return this.props[t]}set_property(t,n){this.$o(t,n),this.save()}$o(t,n,r){var a;r===void 0&&(r=!0);var o=this.props[t];this.props[t]=n,r&&(t!==En&&t!==tt||o===n||(this.fo=!0),t!==ur||$i(o,n)||(this.mo=!0),this.Ho(t,o,n),(a=An(t))!=null&&a.volatile||this.jo(t))}No(t,n){n===void 0&&(n=!0),delete this.props[t],n&&(Cm(t)&&this.Io(t,!0),t===ur&&(this.mo=!0),this.jo(t))}jo(t){var n,r=(n=An(t))==null?void 0:n.storageGroup;r&&(this.Ro(r).dirty=!0)}Ro(t){return this.oo[t]||(this.oo[t]={})}}var Sr={GZipJS:"gzip-js",Base64:"base64"},hc={Activation:"events",Cancellation:"cancelEvents"},Am={Popover:"popover",API:"api",Widget:"widget"},ti={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},Tm={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},nx={Popover:"popover",Inline:"inline"};function Bd(e){var t=!0;return{dispose(){if(t){t=!1;var n=e();n&&In(n.then)&&n.then(void 0,(()=>{}))}}}}var yE={SHOWN:"product tour shown"},m_={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},g_=Gt("[RateLimiter]");class _E{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=n=>{var r=n.text;if(r&&r.length)try{(JSON.parse(r).quota_limited||[]).forEach((a=>{g_.info((a||"events")+" is quota limited."),this.serverLimits[a]=new Date().getTime()+6e4}))}catch(a){return void g_.warn('could not rate limit - continuing. Error: "'+(a==null?void 0:a.message)+'"',{text:r})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return((t=this.instance.config.rate_limiting)==null?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max(((t=this.instance.config.rate_limiting)==null?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var n,r,a;t===void 0&&(t=!1);var o=this.captureEventsBurstLimit,u=this.captureEventsPerSecond,d=new Date().getTime(),f=(n=(r=this.instance.persistence)==null?void 0:r.get_property(qg))!==null&&n!==void 0?n:{tokens:o,last:d};f.tokens+=(d-f.last)/1e3*u,f.last=d,f.tokens>o&&(f.tokens=o);var p=1>f.tokens;if(p||t||(f.tokens=Math.max(0,f.tokens-1)),p&&!t){var m=(an(f.dropped)?f.dropped:0)+1;f.dropped=m,!this.lastEventRateLimited&&this.ua(m)&&(f.dropped=0)}return this.lastEventRateLimited=p,(a=this.instance.persistence)==null||a.set_property(qg,f),{isRateLimited:p,remainingTokens:f.tokens}}ha(t){var n=this.instance.config.property_denylist;return!Pe(n)||!n.includes(t)}da(){var t;if(this.ha("$current_url")&&this.ha("$pathname")&&Zt!=null&&Zt.pathname)return""+((t=Zt.origin)!==null&&t!==void 0?t:"")+Zt.pathname}ua(t){var n,r,a=this.captureEventsBurstLimit,o=this.captureEventsPerSecond,u=this.da(),d=this.ha("$session_id")?(n=(r=this.instance).get_session_id)==null?void 0:n.call(r):void 0,f=[t+" event(s) dropped since the last warning",u?"triggered on "+u:void 0,d?"session "+d:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited: "+f+". Config is set to "+o+" events per second and "+a+" events burst limit."},{skip_client_rate_limiting:!0})}isServerRateLimited(t){var n=this.serverLimits[t||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var Fi=Gt("[RemoteConfig]");class Y2{constructor(t){this._instance=t}get remoteConfig(){var t;return(t=De._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.config}va(t){var n,r;(n=De.__PosthogExtensions__)!=null&&n.loadExternalDependency?(r=De.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}ca(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t})}load(){try{if(this.remoteConfig)return Fi.info("Using preloaded remote config",this.remoteConfig),void this.fa(this.remoteConfig);if(this._instance.pa())return void Fi.warn("Remote config is disabled. Falling back to local config.");this.va((t=>{if(!t)return Fi.info("No config found after loading remote JS config. Falling back to JSON."),void this.ca((n=>{this.fa(n.json,n)}));this.fa(t)}))}catch(t){Fi.error("Error loading remote config",t),this.fa()}}fa(t,n){!t&&n&&(n.statusCode===0?n.error||Fi.warn("Failed to fetch remote config from PostHog."):Fi.error("Failed to fetch remote config from PostHog."));try{this._instance.fa(t?{ok:!0,config:t}:{ok:!1})}catch(a){Fi.error("Error applying remote config",a)}if((t==null?void 0:t.hasFeatureFlags)!==!1&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var r;(r=this._instance.featureFlags)==null||r.ensureFlagsLoaded()}catch(a){Fi.error("Error loading feature flags",a)}}}var Qr=Uint8Array,dr=Uint16Array,so=Uint32Array,Vx=new Qr([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]),Gx=new Qr([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]),x_=new Qr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),W2=function(e,t){for(var n=new dr(31),r=0;31>r;++r)n[r]=t+=1<<e[r-1];var a=new so(n[30]);for(r=1;30>r;++r)for(var o=n[r];n[r+1]>o;++o)a[o]=o-n[r]<<5|r;return[n,a]},Q2=W2(Vx,2),rx=Q2[1];Q2[0][28]=258,rx[258]=28;for(var v_=W2(Gx,0)[1],X2=new dr(32768),Jt=0;32768>Jt;++Jt){var Rl=(43690&Jt)>>>1|(21845&Jt)<<1;X2[Jt]=((65280&(Rl=(61680&(Rl=(52428&Rl)>>>2|(13107&Rl)<<2))>>>4|(3855&Rl)<<4))>>>8|(255&Rl)<<8)>>>1}var Oc=function(e,t,n){for(var r=e.length,a=0,o=new dr(t);r>a;++a)++o[e[a]-1];var u,d=new dr(t);for(a=0;t>a;++a)d[a]=d[a-1]+o[a-1]<<1;for(u=new dr(r),a=0;r>a;++a)u[a]=X2[d[e[a]-1]++]>>>15-e[a];return u},za=new Qr(288);for(Jt=0;144>Jt;++Jt)za[Jt]=8;for(Jt=144;256>Jt;++Jt)za[Jt]=9;for(Jt=256;280>Jt;++Jt)za[Jt]=7;for(Jt=280;288>Jt;++Jt)za[Jt]=8;var Rh=new Qr(32);for(Jt=0;32>Jt;++Jt)Rh[Jt]=5;var wE=Oc(za,9),kE=Oc(Rh,5),K2=function(e){return(e/8>>0)+(7&e&&1)},Z2=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var r=new(e instanceof dr?dr:e instanceof so?so:Qr)(n-t);return r.set(e.subarray(t,n)),r},Ys=function(e,t,n){var r=t/8>>0;e[r]|=n<<=7&t,e[r+1]|=n>>>8},fc=function(e,t,n){var r=t/8>>0;e[r]|=n<<=7&t,e[r+1]|=n>>>8,e[r+2]|=n>>>16},Mm=function(e,t){for(var n=[],r=0;e.length>r;++r)e[r]&&n.push({s:r,f:e[r]});var a=n.length,o=n.slice();if(!a)return[new Qr(0),0];if(a==1){var u=new Qr(n[0].s+1);return u[n[0].s]=1,[u,1]}n.sort((function(O,z){return O.f-z.f})),n.push({s:-1,f:25001});var d=n[0],f=n[1],p=0,m=1,x=2;for(n[0]={s:-1,f:d.f+f.f,l:d,r:f};m!=a-1;)d=n[n[x].f>n[p].f?p++:x++],f=n[p!=m&&n[x].f>n[p].f?p++:x++],n[m++]={s:-1,f:d.f+f.f,l:d,r:f};var b=o[0].s;for(r=1;a>r;++r)o[r].s>b&&(b=o[r].s);var y=new dr(b+1),_=sx(n[m-1],y,0);if(_>t){r=0;var j=0,N=_-t,w=1<<N;for(o.sort((function(O,z){return y[z.s]-y[O.s]||O.f-z.f}));a>r;++r){var E=o[r].s;if(t>=y[E])break;j+=w-(1<<_-y[E]),y[E]=t}for(j>>>=N;j>0;){var C=o[r].s;t>y[C]?j-=1<<t-y[C]++-1:++r}for(;r>=0&&j;--r){var T=o[r].s;y[T]==t&&(--y[T],++j)}_=t}return[new Qr(y),_]},sx=function(e,t,n){return e.s==-1?Math.max(sx(e.l,t,n+1),sx(e.r,t,n+1)):t[e.s]=n},b_=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new dr(++t),r=0,a=e[0],o=1,u=function(f){n[r++]=f},d=1;t>=d;++d)if(e[d]==a&&d!=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[d]}return[n.subarray(0,r),t]},pc=function(e,t){for(var n=0,r=0;t.length>r;++r)n+=e[r]*t[r];return n},ix=function(e,t,n){var r=n.length,a=K2(t+2);e[a]=255&r,e[a+1]=r>>>8,e[a+2]=255^e[a],e[a+3]=255^e[a+1];for(var o=0;r>o;++o)e[a+o+4]=n[o];return 8*(a+4+r)},y_=function(e,t,n,r,a,o,u,d,f,p,m){Ys(t,m++,n),++a[256];for(var x=Mm(a,15),b=x[0],y=x[1],_=Mm(o,15),j=_[0],N=_[1],w=b_(b),E=w[0],C=w[1],T=b_(j),O=T[0],z=T[1],I=new dr(19),U=0;E.length>U;++U)I[31&E[U]]++;for(U=0;O.length>U;++U)I[31&O[U]]++;for(var Z=Mm(I,7),L=Z[0],q=Z[1],M=19;M>4&&!L[x_[M-1]];--M);var ie,X,Y,P,$=p+5<<3,re=pc(a,za)+pc(o,Rh)+u,ae=pc(a,b)+pc(o,j)+u+14+3*M+pc(I,L)+(2*I[16]+3*I[17]+7*I[18]);if(re>=$&&ae>=$)return ix(t,m,e.subarray(f,f+p));if(Ys(t,m,1+(re>ae)),m+=2,re>ae){ie=Oc(b,y),X=b,Y=Oc(j,N),P=j;var D=Oc(L,q);for(Ys(t,m,C-257),Ys(t,m+5,z-1),Ys(t,m+10,M-4),m+=14,U=0;M>U;++U)Ys(t,m+3*U,L[x_[U]]);m+=3*M;for(var B=[E,O],Q=0;2>Q;++Q){var R=B[Q];for(U=0;R.length>U;++U)Ys(t,m,D[me=31&R[U]]),m+=L[me],me>15&&(Ys(t,m,R[U]>>>5&127),m+=R[U]>>>12)}}else ie=wE,X=za,Y=kE,P=Rh;for(U=0;d>U;++U)if(r[U]>255){var me;fc(t,m,ie[257+(me=r[U]>>>18&31)]),m+=X[me+257],me>7&&(Ys(t,m,r[U]>>>23&31),m+=Vx[me]);var be=31&r[U];fc(t,m,Y[be]),m+=P[be],be>3&&(fc(t,m,r[U]>>>5&8191),m+=Gx[be])}else fc(t,m,ie[r[U]]),m+=X[r[U]];return fc(t,m,ie[256]),m+X[256]},SE=new so([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),jE=(function(){for(var e=new so(256),t=0;256>t;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e})(),Rm=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function NE(e,t){t===void 0&&(t={});var n=(function(){var x=4294967295;return{p(b){for(var y=x,_=0;b.length>_;++_)y=jE[255&y^b[_]]^y>>>8;x=y},d(){return 4294967295^x}}})(),r=e.length;n.p(e);var a,o,u,d,f,p=(d=10+((a=t).filename&&a.filename.length+1||0),f=8,(function(x,b,y,_,j,N){var w=x.length,E=new Qr(_+w+5*(1+Math.floor(w/7e3))+j),C=E.subarray(_,E.length-j),T=0;if(!b||8>w)for(var O=0;w>=O;O+=65535){var z=O+65535;w>z?T=ix(C,T,x.subarray(O,z)):(C[O]=!0,T=ix(C,T,x.subarray(O,w)))}else{for(var I=SE[b-1],U=I>>>13,Z=8191&I,L=(1<<y)-1,q=new dr(32768),M=new dr(L+1),ie=Math.ceil(y/3),X=2*ie,Y=function(yt){return(x[yt]^x[yt+1]<<ie^x[yt+2]<<X)&L},P=new so(25e3),$=new dr(288),re=new dr(32),ae=0,D=0,B=(O=0,0),Q=0,R=0;w>O;++O){var me=Y(O),be=32767&O,Ce=M[me];if(q[be]=Ce,M[me]=be,O>=Q){var Le=w-O;if((ae>7e3||B>24576)&&Le>423){T=y_(x,C,0,P,$,re,D,B,R,O-R,T),B=ae=D=0,R=O;for(var Ee=0;286>Ee;++Ee)$[Ee]=0;for(Ee=0;30>Ee;++Ee)re[Ee]=0}var Ae=2,Ue=0,dt=Z,Je=be-Ce&32767;if(Le>2&&me==Y(O-Je))for(var At=Math.min(U,Le)-1,mt=Math.min(32767,O),rt=Math.min(258,Le);mt>=Je&&--dt&&be!=Ce;){if(x[O+Ae]==x[O+Ae-Je]){for(var Lt=0;rt>Lt&&x[O+Lt]==x[O+Lt-Je];++Lt);if(Lt>Ae){if(Ae=Lt,Ue=Je,Lt>At)break;var we=Math.min(Je,Lt-2),Ge=0;for(Ee=0;we>Ee;++Ee){var gt=O-Je+Ee+32768&32767,_n=gt-q[gt]+32768&32767;_n>Ge&&(Ge=_n,Ce=gt)}}}Je+=(be=Ce)-(Ce=q[be])+32768&32767}if(Ue){P[B++]=268435456|rx[Ae]<<18|v_[Ue];var Ne=31&rx[Ae],Be=31&v_[Ue];D+=Vx[Ne]+Gx[Be],++$[257+Ne],++re[Be],Q=O+Ae,++ae}else P[B++]=x[O],++$[x[O]]}}T=y_(x,C,!0,P,$,re,D,B,R,O-R,T)}return Z2(E,0,_+K2(T)+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,d,f)),m=p.length;return(function(x,b){var y=b.filename;if(x[0]=31,x[1]=139,x[2]=8,x[8]=2>b.level?4:b.level==9?2:0,x[9]=3,b.mtime!=0&&Rm(x,4,Math.floor(new Date(b.mtime||Date.now())/1e3)),y){x[3]=8;for(var _=0;y.length>=_;++_)x[_+10]=y.charCodeAt(_)}})(p,t),Rm(p,m-8,n.d()),Rm(p,m-4,r),p}var CE=!!wg||!!Ex,J2="text/plain",sh=!1,ek=(e,t)=>{var n=e.split("#"),r=n[1],a=n[0].split("?"),o=a[0],u=a[1];if(!u)return e;var d=u.split("&").filter((f=>f.split("=")[0]!==t)).join("&");return o+(d?"?"+d:"")+(r?"#"+r:"")},ru=function(e,t,n){var r;n===void 0&&(n=!0);var a=e.split("?"),o=a[0],u=a[1],d=de({},t),f=(r=u==null?void 0:u.split("&").map((m=>{var x,b=m.split("="),y=b[0],_=n&&(x=d[y])!==null&&x!==void 0?x:b[1];return delete d[y],y+"="+_})))!==null&&r!==void 0?r:[],p=(function(m,x){var b,y;x===void 0&&(x="&");var _=[];return Nt(m,(function(j,N){ce(j)||ce(N)||N==="undefined"||(b=encodeURIComponent((w=>w instanceof File)(j)?j.name:j.toString()),y=encodeURIComponent(N),_[_.length]=y+"="+b)})),_.join(x)})(d);return p&&f.push(p),f.length>0?o+"?"+f.join("&"):o},Dm=e=>{if(e.ga)return e.ga;var t=e.data,n=e.compression;if(t){if(n===Sr.GZipJS){var r=NE((function(d,f){var p=d.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(d);for(var m=new Qr(d.length+(d.length>>>1)),x=0,b=function(N){m[x++]=N},y=0;p>y;++y){if(x+5>m.length){var _=new Qr(x+8+(p-y<<1));_.set(m),m=_}var j=d.charCodeAt(y);128>j?b(j):2048>j?(b(192|j>>>6),b(128|63&j)):j>55295&&57344>j?(b(240|(j=65536+(1047552&j)|1023&d.charCodeAt(++y))>>>18),b(128|j>>>12&63),b(128|j>>>6&63),b(128|63&j)):(b(224|j>>>12),b(128|j>>>6&63),b(128|63&j))}return Z2(m,0,x)})(ql(t)),{mtime:0});return{contentType:J2,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(n===Sr.Base64){var a=(function(d){return d&&btoa(encodeURIComponent(d).replace(/%([0-9A-F]{2})/g,((f,p)=>String.fromCharCode(parseInt(p,16)))))})(ql(t)),o=(d=>"data="+encodeURIComponent(typeof d=="string"?d:ql(d)))(a);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var u=ql(t);return{contentType:"application/json",body:u,estimatedSize:new Blob([u]).size}}},tk=e=>{var t,n,r=()=>e.transport==="sendBeacon"?{url:ru(e.url,{compression:Sr.Base64}),encodedBody:Dm(de({},e,{compression:Sr.Base64,ga:void 0}))}:{url:ek(e.url,"compression"),encodedBody:Dm(de({},e,{compression:void 0,ga:void 0}))};try{t=Dm(e)}catch(a){if(Iy(e.compression,no(e.url,"compression")))return ye.error("Failed to gzip request body, sending uncompressed payload",a),r();throw a}return t&&Iy(e.compression,no(e.url,"compression"))&&!((n=t.body)instanceof ArrayBuffer?Mg(new Uint8Array(n)):ArrayBuffer.isView(n)&&Mg(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)))?(sh=!0,r()):{url:e.url,encodedBody:t}},nk=e=>{try{return tk(e)}catch(t){return ye.error(t),void(e.callback==null||e.callback({statusCode:0,error:t}))}},EE=(function(){var e=Ft((function*(t){var n=ql(t.data),r=yield(function(o,u,d){return Rg.apply(this,arguments)})(n,Pt.DEBUG,{rethrow:!0});if(!r)return t;var a=yield r.arrayBuffer();return de({},t,{ga:{contentType:J2,body:a,estimatedSize:a.byteLength}})}));return function(t){return e.apply(this,arguments)}})(),AE=/Failed to fetch|NetworkError|Load failed/i,rk=e=>(e==null?void 0:e.name)==="TypeError"&&AE.test((e==null?void 0:e.message)||""),sk=e=>{var t=nk(e);if(t){var n=t.url,r=t.encodedBody,a=r??{},o=a.contentType,u=a.body,d=a.estimatedSize,f=new Headers;Nt(e.headers,(function(_,j){f.append(j,_)})),o&&f.append("Content-Type",o);var p=null,m=!1;if(Ay){var x=new Ay;p={signal:x.signal,timeout:setTimeout((()=>{var _;m=!0,x.abort(t2("AbortError","PostHog request timed out"+((_=e.timeout)?" after "+_+"ms":"")))}),e.timeout)}}var b=_=>{m&&(_==null?void 0:_.name)==="AbortError"||rk(_)?ye.warn(_):ye.error(_),e.callback==null||e.callback({statusCode:0,error:_})};try{var y;Ex(n,de({method:(e==null?void 0:e.method)||"GET",headers:f,keepalive:e.method==="POST"&&!e.ma&&52428.8>(d||0),body:u,signal:(y=p)==null?void 0:y.signal},e.fetchOptions)).then((_=>_.text().then((j=>{var N={statusCode:_.status,text:j};if(_.status===200)try{N.json=JSON.parse(j)}catch(w){ye.error(w)}e.callback==null||e.callback(N)})))).catch(b).finally((()=>p?clearTimeout(p.timeout):null))}catch(_){p&&clearTimeout(p.timeout),b(_)}}},ax=e=>{try{var t,n=tk(e),r=n.url,a=n.encodedBody,o=a??{},u=o.body,d=o.estimatedSize;if(!u)return;var f=u instanceof Blob?u:new Blob([u],{type:o.contentType});if(Nn.sendBeacon(r,f))return;var p=Pe(e.data)?e.data:(t=e.data)==null?void 0:t.batch;if(Pe(p)&&p.length>1&&(d??0)>16384){var m=Math.ceil(p.length/2),x=b=>Pe(e.data)?b:de({},e.data,{batch:b});return ax(de({},e,{data:x(p.slice(0,m))})),void ax(de({},e,{data:x(p.slice(m))}))}ye.warn("Beacon of ~"+(d??0)+" bytes was rejected by the browser, falling back to fetch"),sk(de({},e,{ma:!0}))}catch(b){ye.warn("Beacon send failed",b)}},__=(e,t,n,r)=>{var a=r==="query"?t==="POST"?"sent_at":"_":void 0;return ru(n===Sr.GZipJS?ek(e,"compression"):e,de({},a?{[a]:Date.now().toString()}:{},n===Sr.GZipJS?{}:{compression:n}))},ih=[];Ex&&ih.push({transport:"fetch",method:sk}),wg&&ih.push({transport:"XHR",method(e){var t=nk(e);if(t){var n=new wg,r=t.encodedBody;n.open(e.method||"GET",t.url,!0);var a=r??{},o=a.contentType,u=a.body;Nt(e.headers,(function(d,f){n.setRequestHeader(f,d)})),o&&n.setRequestHeader("Content-Type",o),e.timeout&&(n.timeout=e.timeout),n.onreadystatechange=()=>{if(n.readyState===4){var d={statusCode:n.status,text:n.responseText};if(n.status===200)try{d.json=JSON.parse(n.responseText)}catch{}e.callback==null||e.callback(d)}},n.send(u)}}}),Nn!=null&&Nn.sendBeacon&&ih.push({transport:"sendBeacon",method:ax});var lx=3e3;class TE{constructor(t,n){this.ya=!0,this.ba=[],this._a=js((n==null?void 0:n.flush_interval_ms)||lx,250,5e3,ye.createLogger("flush interval"),lx),this.wa=t}enqueue(t){this.ba.push(t),this.ka||this.Sa()}unload(){this.xa();var t=this.ba.length>0?this.Ca():{},n=Object.values(t);[...n.filter((r=>r.url.indexOf("/e")===0)),...n.filter((r=>r.url.indexOf("/e")!==0))].map((r=>{this.Ta(de({},r,{transport:"sendBeacon"}))}))}enable(){this.ya=!1,this.Sa()}Sa(){var t=this;this.ya||(this.ka=setTimeout((()=>{if(this.xa(),this.ba.length>0){var n=this.Ca(),r=function(){var o=n[a],u=new Date().getTime();o.data&&Pe(o.data)&&Nt(o.data,(d=>{d.offset=Math.abs(d.timestamp-u),delete d.timestamp})),t.Ta(o)};for(var a in n)r()}}),this._a))}Ta(t){try{this.wa(t)}catch(n){ye.error(n)}}xa(){clearTimeout(this.ka),this.ka=void 0}Ca(){var t={};return Nt(this.ba,(n=>{var r,a=n,o=(a?a.batchKey:null)||a.url;ce(t[o])&&(t[o]=de({},a,{data:[]})),(r=t[o].data)==null||r.push(a.data)})),this.ba=[],t}}var ME=["retriesPerformedSoFar"];class RE{constructor(t){this.Ma=!1,this.Ia=3e3,this.ba=[],this._instance=t,this.ba=[],this.Ea=!0,!ce(te)&&"onLine"in te.navigator&&(this.Ea=te.navigator.onLine,this.Ra=()=>{this.Ea=!0,this.Pa()},this.Aa=()=>{this.Ea=!1},Dt(te,"online",this.Ra),Dt(te,"offline",this.Aa))}get length(){return this.ba.length}retriableRequest(t){var n=t.retriesPerformedSoFar,r=Cw(t,ME);Ks(n)&&(r.url=ru(r.url,{retry_count:n})),this._instance._send_request(de({},r,{callback:a=>{if(a.statusCode!==200&&(400>a.statusCode||a.statusCode>=500)){if((a.statusCode===0?3:10)>(n??0))return void this.os(de({retriesPerformedSoFar:n},r));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.")}r.callback==null||r.callback(a)}}))}os(t){var n=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=n+1;var r=(function(u){var d=3e3*Math.pow(2,u),f=d/2,p=Math.min(18e5,d),m=Math.random()-.5;return Math.ceil(p+m*(p-f))})(n),a=Date.now()+r;this.ba.push({retryAt:a,requestOptions:t});var o="Enqueued failed request for retry in "+r;navigator.onLine||(o+=" (Browser is offline)"),ye.warn(o),this.Ma||(this.Ma=!0,this.Fa())}Fa(){if(this.Oa&&clearTimeout(this.Oa),this.ba.length===0)return this.Ma=!1,void(this.Oa=void 0);this.Oa=setTimeout((()=>{this.Ea&&this.ba.length>0&&this.Pa(),this.Fa()}),this.Ia)}Pa(){var t=Date.now(),n=[],r=this.ba.filter((o=>t>o.retryAt||(n.push(o),!1)));if(this.ba=n,r.length>0)for(var a of r)this.retriableRequest(a.requestOptions)}unload(){for(var t of(this.Oa&&(clearTimeout(this.Oa),this.Oa=void 0),this.Ma=!1,ce(te)||(this.Ra&&(te.removeEventListener("online",this.Ra),this.Ra=void 0),this.Aa&&(te.removeEventListener("offline",this.Aa),this.Aa=void 0)),this.ba)){var n=t.requestOptions;try{this._instance._send_request(de({},n,{transport:"sendBeacon"}))}catch(r){ye.error(r)}}this.ba=[]}}class DE{constructor(t){this.La=()=>{var n,r,a,o;this.Da||(this.Da={});var u=this.scrollElement(),d=this.scrollY(),f=u?Math.max(0,u.scrollHeight-u.clientHeight):0,p=d+((u==null?void 0:u.clientHeight)||0),m=(u==null?void 0:u.scrollHeight)||0;this.Da.lastScrollY=Math.ceil(d),this.Da.maxScrollY=Math.max(d,(n=this.Da.maxScrollY)!==null&&n!==void 0?n:0),this.Da.maxScrollHeight=Math.max(f,(r=this.Da.maxScrollHeight)!==null&&r!==void 0?r:0),this.Da.lastContentY=p,this.Da.maxContentY=Math.max(p,(a=this.Da.maxContentY)!==null&&a!==void 0?a:0),this.Da.maxContentHeight=Math.max(m,(o=this.Da.maxContentHeight)!==null&&o!==void 0?o:0)},this._instance=t}get $a(){return this._instance.config.scroll_root_selector}getContext(){return this.Da}resetContext(){var t=this.Da;return setTimeout(this.La,0),t}startMeasuringScrollPosition(){Dt(te,"scroll",this.La,{capture:!0}),Dt(te,"scrollend",this.La,{capture:!0}),Dt(te,"resize",this.La)}scrollElement(){var t;if(!this.$a)return te==null||(t=te.document)==null?void 0:t.documentElement;var n=Pe(this.$a)?this.$a:[this.$a];for(var r of n){var a,o=te==null||(a=te.document)==null?void 0:a.querySelector(r);if(o)return o}}Na(t){var n,r,a=t==="y"?"scrollTop":"scrollLeft";if(this.$a){var o=this.scrollElement();return o&&o[a]||0}return te?t==="y"?te.scrollY||te.pageYOffset||((n=te.document)==null||(n=n.documentElement)==null?void 0:n.scrollTop)||0:te.scrollX||te.pageXOffset||((r=te.document)==null||(r=r.documentElement)==null?void 0:r.scrollLeft)||0:0}scrollY(){return this.Na("y")}scrollX(){return this.Na("x")}}var LE=e=>q2(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);class w_{constructor(t,n,r,a){this.Te=o=>{var u=this.qa();if(!u||u.sessionId!==o){var d={sessionId:o,props:this.ja(this._instance)};this.Ba.register({[Hg]:d})}},this._instance=t,this.Ha=n,this.Ba=r,this.ja=a||LE,this.Ha.onSessionId(this.Te)}qa(){return this.Ba.props[Hg]}getSetOnceProps(){var t,n=(t=this.qa())==null?void 0:t.props;return n?"r"in n?V2(n,this._instance.config.disable_capture_url_hashes):{$referring_domain:n.referringDomain,$pathname:n.initialPathName,utm_source:n.utm_source,utm_campaign:n.utm_campaign,utm_medium:n.utm_medium,utm_content:n.utm_content,utm_term:n.utm_term}:{}}getSessionProps(){var t={};return Nt(Ux(this.getSetOnceProps()),((n,r)=>{r==="$current_url"&&(r="url"),t["$session_entry_"+kg(r)]=n})),t}}class Dh{on(t,n){return this.za[t]||(this.za[t]=[]),this.za[t].push(n),()=>{this.za[t]=this.za[t].filter((r=>r!==n))}}emit(t,n){for(var r of this.za[t]||[])r(n);for(var a of this.za["*"]||[])a(t,n)}constructor(){this.za={}}}var Dl=Gt("[SessionId]"),k_=864e5;class S_{on(t,n){return this.Ua.on(t,n)}constructor(t,n,r){var a;if(this.Wa=null,this.Va=null,this.Ga=[],this.Za=void 0,this.Qa=!1,this.Ua=new Dh,this.Ja=(f,p)=>!(!Ks(f)||!Ks(p))&&Math.abs(f-p)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===ei)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.mn=t.config,this.Ba=t.persistence,this.Ie=void 0,this.Bt=void 0,this._sessionStartTimestamp=null,this.Ka=void 0,this._sessionActivityTimestamp=null,this.Ya=n||as,this.Xa=r||as;var o=this.mn.persistence_name||this.mn.token;if(this._sessionTimeoutMs=1e3*js(this.mn.session_idle_timeout_seconds||1800,60,36e3,Dl.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.tl(),this.el="ph_"+o+"_window_id",this.il="ph_"+o+"_primary_window_exists",this.rl()){var u=Rt.ui(this.el),d=Rt.ui(this.il);u&&!d?this.Ie=u:Rt.oi(this.el),Rt.ni(this.il,!0)}(a=this.mn.bootstrap)!=null&&a.sessionID&&this.setBootstrapSessionId(this.mn.bootstrap.sessionID),this.nl()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return ce(this.Ga)&&(this.Ga=[]),this.Ga.push(t),this.Bt&&t(this.Bt,this.Ie),()=>{this.Ga=this.Ga.filter((n=>n!==t))}}rl(){return this.mn.persistence!=="memory"&&!this.Ba.Eo&&Rt.ii()}sl(t){t!==this.Ie&&(this.Ie=t,this.rl()&&Rt.ni(this.el,t))}ol(){return this.Ie?this.Ie:this.rl()?Rt.ui(this.el):null}al(t){var n=this.Wa;return!sn(n)&&!sn(t)&&5e3>Math.abs(t-n)}ll(t,n,r){var a=n!==this._sessionActivityTimestamp,o=!(t!==this.Bt||r!==this._sessionStartTimestamp);this._sessionStartTimestamp=r,this._sessionActivityTimestamp=n,this.Bt=t,o&&!a||o&&this.al(n)||(this.Wa=n,this.Ba.register({[Ul]:[n,t,r]}))}ul(){var t,n=(t=this.mn)==null?void 0:t.persistence_save_debounce_ms;return Ks(n)&&n>0}hl(){this.ul()?this.Ba.refreshKey(Ul):(this.Ba.flush(),this.Ba.load())}dl(){var t;if(!sn(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Wa){this.hl();var n=this.vl();n[1]===this.Bt&&n[2]===this._sessionStartTimestamp&&(this.Wa=this._sessionActivityTimestamp,this.Ba.register({[Ul]:[this._sessionActivityTimestamp,(t=this.Bt)!==null&&t!==void 0?t:null,this._sessionStartTimestamp]}),this.Ba.flush())}}cl(){var t=this.vl()[0],n=Ks(t)?t:0,r=Ks(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(n,r)}fl(t){return this.hl(),this.Ja(t,this.cl())}vl(){var t=this.Ba.props[Ul];return Pe(t)&&t.length===2&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Wa=null,this.Ka=void 0,clearTimeout(this.pl),this.pl=void 0,this.ll(null,null,null)}setBootstrapSessionId(t,n){n===void 0&&(n=!1);var r=(function(a,o){o===void 0&&(o=new Date().getTime());try{var u=(d=>{var f=d.replace(/-/g,"");if(f.length!==32)throw new Error("Not a valid UUID");if(f[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(f.substring(0,12),16)})(a);return u>o+6e4?void Dl.error("Bootstrap sessionID cannot be in the future"):u}catch(d){return void Dl.error("Invalid sessionID in bootstrap",d)}})(t);return!ce(r)&&(n?this.Ka={sessionId:t,sessionStartTimestamp:r}:this.ll(t,new Date().getTime(),r),!0)}destroy(){this.Qa=!0,this.dl(),clearTimeout(this.pl),this.pl=void 0,this.Za&&te&&(te.removeEventListener(Nh,this.Za,{capture:!1}),this.Za=void 0),this.Ga=[]}nl(){this.Za=()=>{this.dl(),this.rl()&&Rt.oi(this.il)},Dt(te,Nh,this.Za,{capture:!1})}checkAndGetSessionAndWindowId(t,n,r){if(t===void 0&&(t=!1),n===void 0&&(n=null),r===void 0&&(r=!1),this.mn.cookieless_mode===ei)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var a=n||new Date().getTime(),o=this.Bt;if(r)this.Va=a;else if(sn(this.Va)||this.Va>a||a-this.Va>=1e3){var u,d;(u=(d=this.Ba).syncCookieProperties)==null||u.call(d),this.Va=a}var f=this.vl(),p=f[1],m=f[2],x=!ce(o)&&p!==o,b=this.cl(),y=this.ol(),_=this.Ka,j=!!_&&(_.sessionStartTimestamp>a+6e4||a-_.sessionStartTimestamp>k_),N=_?j:Ks(m)&&Math.abs(a-m)>k_,w=!1,E=x,C=!p||!!_,T=p,O=!C&&!t&&this.Ja(a,b);if(O){(O=this.fl(a))||Dl.info("cross-tab refresh kept the session alive",{sessionId:p});var z=this.vl();p=z[1],m=z[2]}if(C||O||N){E=!1;var I=_&&!j;p=I?_.sessionId:this.Ya(),y=this.Xa(),Dl.info("new session ID assigned",{sessionId:p,windowId:y,bootstrapped:!!I,changeReason:{noSessionId:C,activityTimeout:O,sessionPastMaximumLength:N}}),m=I?_.sessionStartTimestamp:a,this.Ka=void 0,w=!0}else y||(y=this.Xa(),w=!0),(E=E||p!==T)&&(Dl.info("adopted cross-tab session id",{sessionId:p,windowId:y}),w=!0);var U=Ks(b)&&t&&!N?b:a,Z=Ks(m)?m:new Date().getTime();this.sl(y),this.ll(p,U,Z),t||this.tl();var L={noSessionId:C,activityTimeout:O,sessionPastMaximumLength:N,crossTabAdoption:E};return w&&this.Ga.forEach((q=>q(p,y,L))),{sessionId:p,windowId:y,sessionStartTimestamp:Z,changeReason:w?L:void 0,lastActivityTimestamp:b}}tl(){this.Qa||(clearTimeout(this.pl),this.pl=setTimeout((()=>{if(!this.Qa)if(this.fl(new Date().getTime())){var t=this.Bt;this.resetSessionId(),this.Ua.emit("forcedIdleReset",{idleSessionId:t})}else this.tl()}),1.1*this.sessionTimeoutMs))}}var ik=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&My(n,t))return!0;try{var r=e==null?void 0:e.userAgentData;if(r!=null&&r.brands&&r.brands.some((a=>My(a==null?void 0:a.brand,t))))return!0}catch{}return!!e.webdriver};function ak(){return(ak=Ft((function*(){var e=Nn==null?void 0:Nn.userAgentData;if(e!=null&&e.getHighEntropyValues)try{var t=yield e.getHighEntropyValues(["model"]),n=t==null?void 0:t.model;return at(n)&&n.length>0?n:void 0}catch(r){return void ye.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",r)}}))).apply(this,arguments)}function lk(e){var t;return!((t=e.conditions)==null||(t=t.events)==null||(t=t.values)==null||!t.length)}var Lh=(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}},Pd=e=>e.toLowerCase(),ok={exact:(e,t)=>t.some((n=>e.some((r=>n===r)))),is_not:(e,t)=>t.every((n=>e.every((r=>n!==r)))),regex:(e,t)=>t.some((n=>e.some((r=>Lh(n,r))))),not_regex:(e,t)=>t.every((n=>e.every((r=>!Lh(n,r))))),icontains:(e,t)=>t.map(Pd).some((n=>e.map(Pd).some((r=>n.includes(r))))),not_icontains:(e,t)=>t.map(Pd).every((n=>e.map(Pd).every((r=>!n.includes(r))))),gt:(e,t)=>t.some((n=>{var r=parseFloat(n);return!isNaN(r)&&e.some((a=>r>parseFloat(a)))})),lt:(e,t)=>t.some((n=>{var r=parseFloat(n);return!isNaN(r)&&e.some((a=>r<parseFloat(a)))}))};function ck(e,t){return!e||Object.entries(e).every((n=>{var r=n[1],a=t==null?void 0:t[n[0]];if(a==null)return!1;var o=ok[r.operator];return!!o&&o(r.values,[String(a)])}))}function Lm(e,t,n){return ql({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}var ox="custom",j_="i.posthog.com",OE=/^\/static\//,zE=["/s/","/e/","/i/"];class BE{constructor(t){this.gl={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return t==="https://app.posthog.com"?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,n=(t=this.instance.config.ui_host)==null?void 0:t.replace(/\/$/,"");return n||(n=this.apiHost.replace("."+j_,".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this.gl[this.apiHost]||(this.gl[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":ox),this.gl[this.apiHost]}ml(t){if(OE.test(t)){var n=this.instance.config.asset_host;if(typeof n=="string")return n.trim().replace(/\/$/,"")||void 0}}yl(t){var n=to(t);return n?n.protocol+"//"+n.host+n.pathname:void 0}bl(t,n,r){if(t==="ui")return r;var a=r,o=this.instance.config.rewriteRequestPath;if(o){var u,d=((u=to(r))==null?void 0:u.href)||r;a=o(new URL(d)).toString()}if(o&&t==="api"&&zE.some((b=>n.indexOf(b)===0))){var f=this.yl(a);if(f){var p,m=this.apiHost,x=this._l;((p=x)==null?void 0:p.apiHost)===m&&x.rewriteRequestPath===o||(x={apiHost:m,rewriteRequestPath:o,urls:new Set},this._l=x),x.urls.add(f)}}return a}isIngestionEndpoint(t){var n=this._l,r=this.yl(t);return(n==null?void 0:n.apiHost)===this.apiHost&&n.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!r&&n.urls.has(r)}endpointFor(t,n){if(n===void 0&&(n=""),n&&(n=n[0]==="/"?n:"/"+n),t==="ui")return this.bl(t,n,this.uiHost+n);if(t==="flags")return this.bl(t,n,this.flagsApiHost+n);if(t==="assets"){var r=this.ml(n);if(r)return this.bl(t,n,""+r+n)}if(this.region===ox)return this.bl(t,n,this.apiHost+n);var a=j_+n;switch(t){case"assets":return this.bl(t,n,"https://"+this.region+"-assets."+a);case"api":return this.bl(t,n,"https://"+this.region+"."+a)}}}var kt=Gt("[Surveys]"),uk="seenSurvey_",dk=e=>{try{var t=(n=>((r,a)=>""+uk+(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(n){kt.error("Failed to persist survey seen state",n)}},PE=[Am.Popover,Am.Widget,Am.API],$E={ignoreConditions:!1,ignoreDelay:!1,displayType:nx.Popover},FE=Gt("[PostHog ExternalIntegrations]"),UE={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class IE{constructor(t){this._instance=t}Ys(t,n){var r;(r=De.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,t,(a=>{if(a)return FE.error("failed to load script",a);n()}))}startIfEnabledOrStop(){var t=this,n=function(){var o,u,d,f=r[0],p=r[1];!p||(o=De.__PosthogExtensions__)!=null&&(o=o.integrations)!=null&&o[f]||t.Ys(UE[f],(()=>{var m;(m=De.__PosthogExtensions__)==null||(m=m.integrations)==null||(m=m[f])==null||m.start(t._instance)})),!p&&(u=De.__PosthogExtensions__)!=null&&(u=u.integrations)!=null&&u[f]&&((d=De.__PosthogExtensions__)==null||(d=d.integrations)==null||(d=d[f])==null||d.stop())};for(var r of Object.entries((a=this._instance.config.integrations)!==null&&a!==void 0?a:{})){var a;n()}}}class HE{constructor(t,n){this.A=t,this.Ns=n,this.wl=new Map,this.Os=!1}add(t){var n=this;return Ft((function*(){if(n.Os)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(n.wl.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');n.wl.set(t.name,t);try{var r=t.setup(n.Ns);r&&(yield r)}catch(o){var a=n.wl.get(t.name)===t;a&&n.wl.delete(t.name),n.A.error('Failed to set up browser extension "'+t.name+'"',o),a&&n.kl(t)}}))()}getExtension(t){return this.wl.get(t)}dispose(){if(!this.Os){this.Os=!0;var t=Array.from(this.wl.values()).reverse();for(var n of(this.wl.clear(),t))this.kl(n)}}kl(t){try{var n=t.dispose==null?void 0:t.dispose();n&&In(n.then)&&n.then(void 0,(r=>{this.A.error('Failed to dispose browser extension "'+t.name+'"',r)}))}catch(r){this.A.error('Failed to dispose browser extension "'+t.name+'"',r)}}}class qE{constructor(t){this._instance=t}initialize(){}get(t){var n=this._instance.persistence;if(typeof t=="string")return n==null?void 0:n.get_property(t);var r={};for(var a of t){var o=n==null?void 0:n.get_property(a);ce(o)||(r[a]=o)}return r}set(t,n){var r;(r=this._instance.persistence)==null||r.register(typeof t=="string"?{[t]:n}:t)}remove(t){var n;(n=this._instance.persistence)==null||n.unregister(t)}}var N_="extensionsRemoteConfig";class VE{constructor(t){this.Os=!1,this.instance=t,this.A=ye,this.Sl=t.xl,this.kv=new qE(t),this.onEvent=n=>Bd(this.instance.on("eventCaptured",(r=>{try{n({event:r.event,properties:r.properties})}catch(a){this.A.error("Browser extension event listener failed",a)}}))),this.onRemoteConfig=n=>{if(this.Os)return Bd((()=>{}));var r=o=>{try{n(o)}catch(u){this.A.error("Browser extension remote config listener failed",u)}},a=this.instance.Cl.on(N_,r);return this.Sl&&r(this.Sl),Bd(a)},this.Tl=new HE(ye.createLogger("[BrowserExtensions]"),this)}get logger(){return this.A}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return(t=this.instance.get_property(Yc))!==null&&t!==void 0?t:this.distinctId}get deviceId(){var t=this.instance.get_property(Yc);return typeof t=="string"?t:void 0}get library(){return{name:Pt.LIB_NAME,version:Pt.LIB_VERSION}}get initialPersonProperties(){var t,n;return(t=(n=this.instance.persistence)==null?void 0:n.get_initial_props())!==null&&t!==void 0?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,n,r,a,o=(t=this.instance.sessionManager)==null?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:(n=o==null?void 0:o.sessionId)!==null&&n!==void 0?n:"",windowId:(r=o==null?void 0:o.windowId)!==null&&r!==void 0?r:"",sessionStartTimestamp:(a=o==null?void 0:o.sessionStartTimestamp)!==null&&a!==void 0?a:0}}catch{return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(t){return this.Tl.add(t)}getExtension(t){return this.Tl.getExtension(t)}capture(t,n,r){var a=this;return Ft((function*(){r?a.instance.capture(t,n,{timestamp:r.timestamp,uuid:r.uuid,$set:r.set,$set_once:r.setOnce}):a.instance.capture(t,n)}))()}registerDynamicEventProperties(t){return Bd(this.instance.Ml(t))}handleRemoteConfig(t){this.Os||(this.Sl=t,this.instance.Cl.emit(N_,t))}sendRequest(t,n){var r=this;return Ft((function*(){var a;n===void 0&&(n={});var o=r.instance.requestRouter.endpointFor((a=n.target)!==null&&a!==void 0?a:"api",t),u={method:n.method,url:n.query?ru(o,n.query):o,data:n.body,headers:n.headers,timeout:n.timeoutMs,fireCallbackOnDrop:!0,transport:n.transport,compression:n.compression,compressionFallback:n.target==="flags"&&n.compression==="best-available"?Sg.Base64:void 0,timestampMode:n.sentAt};return n.transport==="sendBeacon"?(r.instance._send_request(u),{statusCode:202}):new Promise((d=>{u.callback=d,r.instance._send_request(u)}))}))()}dispose(){this.Os||(this.Os=!0,this.Tl.dispose())}}var zc={},Om=0,Bc=()=>{},C_='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',mc="Surveys module not available",E_="sanitize_properties is deprecated. Use before_send instead",hk="Invalid value for property_denylist config: ",GE=/^[A-Za-z0-9_-]{1,400}$/,zm=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,YE=["token","distinct_id",b2],Pl="posthog",fk=!CE&&(cr==null?void 0:cr.indexOf("MSIE"))===-1&&(cr==null?void 0:cr.indexOf("Mozilla"))===-1,WE=e=>{var 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},Bm=e=>{var t;return de({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Y4(pe==null?void 0:pe.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Bc,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:Zt&&at(Zt==null?void 0:Zt.search)&&Zt.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?void 0:t.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(n){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:Wg,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:lx},error_tracking:{},_onCapture:Bc},(n=>({rageclick:n&&n>="2026-05-30"?{content_ignorelist:sE,ignore_text_selection:!0}:!n||"2025-11-30">n||{content_ignorelist:!0},capture_pageview:!n||"2025-05-24">n||"history_change",session_recording:WE(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))},QE=[["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"]],A_=e=>{var t={};for(var n of QE){var r=n[0],a=n[1];ce(e[r])||(t[a]=e[r])}var o=$t({},t,e),u=e.__preview_external_dependency_versioned_paths;return ce(u)||(ce(e.strict_script_versioning)&&(o.strict_script_versioning=!!u),at(u)&&ce(e.asset_host)&&(o.asset_host=u)),Pe(e.property_blacklist)&&(ce(e.property_denylist)?o.property_denylist=e.property_blacklist:Pe(e.property_denylist)?o.property_denylist=[...e.property_blacklist,...e.property_denylist]:ye.error(hk+e.property_denylist)),o};class XE{constructor(){this.__forceAllowLocalhost=!1}get Il(){return this.__forceAllowLocalhost}set Il(t){ye.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class jr{El(t){if(t){var n=this.wl.indexOf(t);n!==-1&&this.wl.splice(n,1)}}Rl(t,n){return this.El(t),this.wl.push(n),n.initialize==null||n.initialize(),n}Pl(){return this.config.cookieless_mode===ei||this.config.cookieless_mode===Hi&&this.consent.isRejected()}Al(){if(!(this.Fl||this.config.reuseAnonymousId||this.config.segment||this.Pl())){var t,n,r,a=this.config.persistence==="memory"||this.config.persistence==="sessionStorage";(a||this.config.disable_persistence)&&(this.Ol||(a?(t="persistence is set to '"+this.config.persistence+"'",n=this.config.persistence==="memory"?"on every page load":"for every new browser tab or window",r="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(t="persistence is disabled (disable_persistence is true)",n="on every page load",r="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this.Fl=!0,console.warn("[PostHog.js]",t+" but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID "+n+", 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. "+r)))}}Ll(){if(!this.Pl()&&this.get_distinct_id()===El){var t=this.persistence;if(t){this.Dl()||t.load(!0);var n=this.get_distinct_id();if(!n||n===El){var r=this.config.get_device_id(as());this.register({distinct_id:r,$device_id:r}),t.set_property(tt,cn)}this.$l()}}}get decideEndpointWasHit(){var t,n;return(t=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&t!==void 0&&t}get flagsEndpointWasHit(){var t,n;return(t=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&t!==void 0&&t}constructor(){var t;this.webPerformance=new XE,this.Nl=!1,this.version=Pt.LIB_VERSION,this.ql=new Set,this.jl="",this.Cl=new Dh,this.wl=[],this.Bl=[],this.Ol=!1,this.Fl=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Bm(),this.SentryIntegration=hE,this.sentryIntegration=r=>(function(a,o){var u=B2(a,o);return{name:z2,processEvent:d=>u(d)}})(this,r),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Hl=!1,this.zl=null,this.Ul=null,this.Wl=null,this.scrollManager=new DE(this),this.pageViewManager=new h_(this),this.rateLimiter=new _E(this),this.requestRouter=new BE(this),this.consent=new J4(this),this.externalIntegrations=new IE(this);var n=(t=jr.__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:(r,a,o)=>{var u=at(r)?{[r]:a}:r;this.setPersonProperties(u),o==null||o({})},set_once:(r,a,o)=>{var u=at(r)?{[r]:a}:r;this.setPersonProperties(void 0,u),o==null||o({})}},this.on("eventCaptured",(r=>ye.info('send "'+(r==null?void 0:r.event)+'"',r)))}init(t,n,r){if(r&&r!==Pl){var a,o=(a=zc[r])!==null&&a!==void 0?a:new jr;return o._init(t,n,r),zc[r]=o,zc[Pl][r]=o,o}return this._init(t,n,r)}_init(t,n,r){var a,o,u;n===void 0&&(n={});var d,f=at(t)?t.trim():"";if(!f)return ye.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return f!==((d=this.config)==null?void 0:d.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('"+f+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=Bm(n.defaults),n.debug=this.Vl(n.debug),this.Gl=n,this.Zl=[],n.person_profiles?this.Ul=n.person_profiles:n.process_person&&(this.Ul=n.process_person);var p=Bm(n.defaults),m=A_(n),x=$t({},p,m,{name:r,token:f});nt(p.rageclick)&&nt(m.rageclick)&&(x.rageclick=$t({},p.rageclick,m.rageclick)),nt(p.session_recording)&&nt(m.session_recording)&&(x.session_recording=$t({},p.session_recording,m.session_recording)),this.set_config(x),this.config.on_xhr_error&&ye.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:Sr.GZipJS;var b=this.Dl();if(this.persistence=new Em(this.config,b),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Em(de({},this.config,{persistence:"sessionStorage"}),b,!1),this.jl="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties",this.config.persistence!=="memory"&&!b&&Rt.ii()){var y=Rt.ui(this.jl);Pe(y)&&y.forEach((U=>{at(U)&&this.ql.add(U)}))}else Rt.oi(this.jl);var _=de({},this.persistence.props),j=de({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Ql=new TE((U=>this.Jl(U)),this.config.request_queue_config),this.Kl=new RE(this),this.__request_queue=[];var N=this.Pl();N||(this.sessionManager=new S_(this),this.sessionPropsManager=new w_(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId(((U,Z,L)=>{(L!=null&&L.activityTimeout||L!=null&&L.sessionPastMaximumLength||L!=null&&L.crossTabAdoption)&&this.Yl()}))),this.Xl(),this.config.__preview_deferred_init_extensions?(ye.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.tu(N)}),0)):(ye.info("Initializing extensions synchronously"),this.tu(N)),Pt.DEBUG=Pt.DEBUG||this.config.debug,Pt.DEBUG&&ye.info("Starting in debug mode",{this:this,config:n,thisC:de({},this.config),p:_,s:j}),!this.config.identity_distinct_id||(a=n.bootstrap)!=null&&a.distinctID||(n.bootstrap=de({},n.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));var w=(o=n.bootstrap)==null?void 0:o.distinctID;if(this.Ol=!!w&&!Mc(w),((u=n.bootstrap)==null?void 0:u.distinctID)!==void 0){var E=n.bootstrap.distinctID,C=this.get_distinct_id(),T=this.persistence.get_property(tt);if(n.bootstrap.isIdentifiedID&&C!=null&&C!==E&&T===cn)this.identify(E);else if(n.bootstrap.isIdentifiedID&&C!=null&&C!==E&&T===zn)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{var O=this.config.get_device_id(as()),z=n.bootstrap.isIdentifiedID?O:E;this.persistence.set_property(tt,n.bootstrap.isIdentifiedID?zn:cn),this.register({distinct_id:E,$device_id:z})}}if(N)this.register_once({distinct_id:El,$device_id:null},"");else if(!this.get_distinct_id()){var I=this.config.get_device_id(as());this.register_once({distinct_id:I,$device_id:I},""),this.persistence.set_property(tt,cn)}return Dt(te,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),n.segment?d_(this,(()=>this.eu())):this.eu(),In(this.config._onCapture)&&this.config._onCapture!==Bc&&(ye.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(U=>this.config._onCapture(U.event,U)))),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 ak.apply(this,arguments)})().then((U=>{U&&this.register({[ym]:U})})).catch(Bc),this}iu(t){var n=t;return at(n.name)&&In(n.setup)}ru(t,n){this.iu(t)?n.push((()=>{this.nu().add(t).catch((()=>t.dispose==null?void 0:t.dispose())).catch((r=>{ye.error('Failed to dispose browser extension "'+t.name+'"',r)}))})):this.wl.push(t)}Xl(){var t,n,r,a,o,u,d=(t=(n=this.config.__extensionClasses)==null?void 0:n.featureFlags)!==null&&t!==void 0?t:(r=jr.__defaultExtensionClasses)==null?void 0:r.featureFlags;d&&(this.featureFlags&&this.featureFlags instanceof d||((a=this.su)==null||a.call(this),this.su=void 0,this.featureFlags=new d(this)),In(this.featureFlags.onReloading)&&In(this.featureFlags.setup)?this.su||(this.su=this.featureFlags.onReloading((()=>{this.Cl.emit("featureFlagsReloading",!0)})),this.nu().add(this.featureFlags)):(o=(u=this.featureFlags).initialize)==null||o.call(u))}tu(t){var n,r,a,o,u,d,f,p=performance.now(),m=de({},jr.__defaultExtensionClasses,this.config.__extensionClasses),x=[];m.exceptions&&this.wl.push(this.exceptions=(n=this.exceptions)!==null&&n!==void 0?n:new m.exceptions(this)),m.historyAutocapture&&this.wl.push(this.historyAutocapture=new m.historyAutocapture(this)),m.tracingHeaders&&this.wl.push(this.tracingHeaders=new m.tracingHeaders(this)),m.siteApps&&this.wl.push(this.siteApps=new m.siteApps(this)),m.sessionRecording&&!t&&this.wl.push(this.sessionRecording=new m.sessionRecording(this)),this.config.disable_scroll_properties||x.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),m.autocapture&&this.ru(this.autocapture=new m.autocapture(this),x),m.surveys&&this.ru(this.surveys=(r=this.surveys)!==null&&r!==void 0?r:new m.surveys(this),x),m.logs&&this.ru(this.logs=(a=this.logs)!==null&&a!==void 0?a:new m.logs(this),x),m.metrics&&this.wl.push(this.metrics=(o=this.metrics)!==null&&o!==void 0?o:new m.metrics(this)),m.conversations&&this.wl.push(this.conversations=(u=this.conversations)!==null&&u!==void 0?u:new m.conversations(this)),m.productTours&&this.wl.push(this.productTours=new m.productTours(this)),m.heatmaps&&this.wl.push(this.heatmaps=new m.heatmaps(this)),m.webVitalsAutocapture&&this.wl.push(this.webVitalsAutocapture=new m.webVitalsAutocapture(this)),m.exceptionObserver&&this.wl.push(this.exceptionObserver=new m.exceptionObserver(this)),m.deadClicksAutocapture&&this.wl.push(this.deadClicksAutocapture=new m.deadClicksAutocapture(this,dE)),m.toolbar&&this.wl.push(this.toolbar=(d=this.toolbar)!==null&&d!==void 0?d:new m.toolbar(this)),m.experiments&&this.wl.push(this.experiments=(f=this.experiments)!==null&&f!==void 0?f:new m.experiments(this)),this.wl.forEach((b=>{b.initialize&&x.push((()=>{b.initialize==null||b.initialize()}))})),x.push((()=>{if(this.ou){var b=this.ou;this.ou=void 0,this.wl.forEach((y=>y.onRemoteConfig==null?void 0:y.onRemoteConfig(b)))}})),this.au(x,p)}au(t,n){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-n>=30&&t.length>0)return void setTimeout((()=>{this.au(t,n)}),0);var r=t.shift();if(r)try{r()}catch(o){ye.error("Error initializing extension:",o)}}var a=Math.round(performance.now()-n);this.register_for_session({[y2]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[_2]:a}),this.config.__preview_deferred_init_extensions&&ye.info("PostHog extensions initialized ("+a+"ms)")}fa(t){var n;if(!pe||!pe.body)return ye.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.fa(t)}),500);if(this.config.__preview_deferred_init_extensions&&(this.ou=t),this.xl=t,this.compression=void 0,t.ok){var r,a=t.config;a.supportedCompression&&!this.config.disable_compression&&(this.compression=Ie(a.supportedCompression,Sr.GZipJS)?Sr.GZipJS:Ie(a.supportedCompression,Sr.Base64)?Sr.Base64:void 0),(r=a.analytics)!=null&&r.endpoint&&(this.analyticsDefaultEndpoint=a.analytics.endpoint)}this.set_config({person_profiles:this.Ul?this.Ul:Wg}),(n=this.lu)==null||n.handleRemoteConfig(t),this.wl.forEach((o=>o.onRemoteConfig==null?void 0:o.onRemoteConfig(t)))}eu(){try{this.config.loaded(this)}catch(r){ye.critical("`loaded` function failed",r)}if(this.uu(),this.config.internal_or_test_user_hostname&&Zt!=null&&Zt.hostname){var t=Zt.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.Pl())&&this.hu()}),1),this.du=new Y2(this),this.du.load()}uu(){var t;this.is_capturing()&&this.config.request_batching&&((t=this.Ql)==null||t.enable())}_dom_loaded(){this.is_capturing()&&Md(this.__request_queue,(t=>this.Jl(t))),this.__request_queue=[],this.uu()}_handle_unload(){var t,n,r,a,o;(t=this.surveys)==null||t.handlePageUnload==null||t.handlePageUnload(),(n=this.metrics)==null||n.flush("sendBeacon"),this.config.request_batching?(this.vu()&&this.capture(_m),(r=this.logs)==null||r.flushLogs("sendBeacon"),(a=this.Ql)==null||a.unload(),(o=this.Kl)==null||o.unload()):this.vu()&&this.capture(_m,null,{transport:"sendBeacon"})}_send_request(t){var n;this.__loaded?fk?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(t.callback==null||t.callback({statusCode:429})):(t.transport=t.transport||this.config.api_transport,t.headers=de({},this.config.request_headers,t.headers),t.compression=t.compression==="best-available"?(n=this.compression)!==null&&n!==void 0?n:t.compressionFallback:t.compression,(ce(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(r=>{var a,o,u,d=de({},r);d.timeout=d.timeout||6e4;var f,p,m,x,b,y=(a=d.transport)!==null&&a!==void 0?a:"fetch";y==="sendBeacon"&&ce(d.compression)&&d.data&&(d.compression=Sr.Base64),d.method==="POST"&&d.data&&(d.timestampMode==="capture-body"?d.data={api_key:(p=(b=(x=(Pe(f=d.data)?f:[f]).map((w=>de({},w,w.timestamp instanceof Date&&!isNaN(w.timestamp.getTime())?{timestamp:w.timestamp.toISOString()}:{}))))[0])==null||(m=b.properties)==null?void 0:m.token)!==null&&p!==void 0?p:b==null?void 0:b.token,batch:x,sent_at:new Date().toISOString()}:d.timestampMode==="body"&&(d.data=(function(w,E){return E===void 0&&(E=new Date().toISOString()),Pe(w)?w.map((C=>de({},C,{sent_at:E}))):de({},w,{sent_at:E})})(d.data))),d.url=__(d.url,d.method,d.compression,d.timestampMode);var _=ih.filter((w=>!d.disableTransport||!w.transport||!d.disableTransport.includes(w.transport))),j=(o=(u=(function(w,E){for(var C=0;w.length>C;C++)if(w[C].transport===y)return w[C]})(_))==null?void 0:u.method)!==null&&o!==void 0?o:_[0].method;if(!j)throw new Error("No available transport method");var N=w=>{try{j(w)}catch(E){rk(E)?ye.warn(E):ye.error(E),d.callback==null||d.callback({statusCode:0,error:E})}};y!=="sendBeacon"&&d.data&&d.compression===Sr.GZipJS&&I3&&typeof Promise<"u"&&!sh?EE(d).then((w=>{N(w)})).catch((w=>{if(Hy(w))return sh=!0,void N(de({},d,{compression:void 0,url:__(r.url,r.method,void 0,r.timestampMode)}));(E=>{if(!E||typeof E!="object")return!1;var C="name"in E?String(E.name):"";return Hy(E)||C===i2})(w)&&(sh=!0),N(d)})):j(d)})(de({},t,{callback:r=>{var a,o;this.rateLimiter.checkForLimiting(r),400>r.statusCode||(a=(o=this.config).on_request_error)==null||a.call(o,r),t.callback==null||t.callback(r)}}))):t.fireCallbackOnDrop&&(t.callback==null||t.callback({statusCode:0}))}Jl(t){this.Kl?this.Kl.retriableRequest(t):this._send_request(t)}_execute_array(t){Om++;try{var n,r=[],a=[],o=[];Md(t,(d=>{if(d)if(Pe(n=d[0]))o.push(d);else if(In(d))try{d.call(this)}catch(f){ye.error("Error executing queued PostHog call",d,f)}else Pe(d)&&n==="alias"?r.push(d):Pe(d)&&n.indexOf("capture")!==-1&&In(this[n])?o.push(d):a.push(d)}));var u=function(d,f){Md(d,(function(p){try{if(Pe(p[0])){var m=f;Nt(p,(function(x){m=m[x[0]].apply(m,x.slice(1))}))}else f[p[0]].apply(f,p.slice(1))}catch(x){ye.error("Error executing queued PostHog call",p,x)}}))};u(r,this),u(a,this),u(o,this)}finally{Om--}}push(t){if(Om>0&&Pe(t)&&at(t[0])){var n=jr.prototype[t[0]];In(n)&&n.apply(this,t.slice(1))}else this._execute_array([t])}cu(){var t,n=(t=this.persistence)==null?void 0:t.get_property(ur);return at(n)&&zm.test(n)?{value:n,delivered:!1}:nt(n)&&at(n.value)&&zm.test(n.value)?{value:n.value,delivered:n.delivered===!0}:void 0}fu(t,n,r,a){if(this.persistence){this.persistence.refreshKey(ur);var o=this.cu();if(!a){if(r)return at(n)&&zm.test(n)?(n!==(o==null?void 0:o.value)&&this.persistence.register({[ur]:{value:n,delivered:!1}}),{value:n,pending:n!==(o==null?void 0:o.value)||!o.delivered}):void this.persistence.unregister(ur);if(at(t)&&GE.test(t)){if((o==null?void 0:o.value.split(".")[3])===t)return{value:o.value,pending:!o.delivered};var u="fb.1."+Date.now()+"."+t;return this.persistence.register({[ur]:{value:u,delivered:!1}}),{value:u,pending:!0}}return o?{value:o.value,pending:!o.delivered}:void 0}this.persistence.unregister(ur)}}pu(t){if(this.persistence){this.persistence.refreshKey(ur);var n=this.cu();(n==null?void 0:n.value)!==t||n.delivered||this.persistence.register({[ur]:{value:t,delivered:!0}})}}capture(t,n,r){var a,o,u,d,f,p,m,x,b,y;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Ql){if(this.is_capturing())if(!ce(t)&&at(t)){this.Ll();var _=!this.config.opt_out_useragent_filter&&this._is_bot();if(!_||this.config.__preview_capture_bot_pageviews){var j=r!=null&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(j==null||!j.isRateLimited){var N;n!=null&&n.$current_url&&!at(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"||r!=null&&r.gu||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&&(N=this.sessionPersistence.update_campaign_params()),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var w=new Date,E=(r==null?void 0:r.timestamp)||w,C=zy(r==null?void 0:r.uuid,as),T={uuid:C,event:t,properties:this.calculateEventProperties(t,n||{},E,C)};t===Hl&&this.config.__preview_capture_bot_pageviews&&_&&(T.event="$bot_pageview",T.properties.$browser_type="bot"),j&&(T.properties.$lib_rate_limit_remaining_tokens=j.remainingTokens);var O=t==="$feature_flag_called"&&T.properties.$feature_flag_has_experiment===!1&&this.get_property(Wl)===!0;r!=null&&r.$set&&!O&&(T.$set=r==null?void 0:r.$set);var z=nt(n==null?void 0:n.$set)?n.$set:void 0,I=!(r==null||!r.$set)&&Gs in r.$set,U=I||!!z&&Gs in z,Z=I?r==null||(a=r.$set)==null?void 0:a[Gs]:z==null?void 0:z[Gs],L=Pe(n==null?void 0:n.$unset)?n.$unset:[],q=(r==null?void 0:r.$unset)||[],M=L.indexOf(Gs)!==-1||q.indexOf(Gs)!==-1,ie=this.fu((o=N)==null?void 0:o.fbclid,Z,U,M);ie&&T.properties.$process_person_profile===!0&&ie.pending&&!U&&!O&&(T.$set=de({[Gs]:ie.value},T.$set));var X=r==null?void 0:r.$unset;X&&(T.$unset=X);var Y,P,$,re=O?void 0:this.mu(r==null?void 0:r.$set_once,t!==Qy,t===Qg);if(re&&(T.$set_once=re),r!=null&&r._noTruncate||(m=this.config.properties_string_max_length,x=T,b=Ee=>at(Ee)?Ee.slice(0,m):Ee,y=new Set,T=(function Ee(Ae,Ue){if(Ae!==Object(Ae))return b?b(Ae):Ae;if(!y.has(Ae)){var dt;if(y.add(Ae),Pe(Ae))dt=[],Md(Ae,(At=>{dt.push(Ee(At))}));else{var Je={};Nt(Ae,((At,mt)=>{y.has(At)||(Je[mt]=Ee(At))})),dt=Je}return dt}})(x)),T.timestamp=E,ce(r==null?void 0:r.timestamp)||(T.properties.$event_time_override_provided=!0,T.properties.$event_time_override_system_time=w),O&&(T.properties=(function(Ee,Ae){Ae===void 0&&(Ae=[]);var Ue={},dt=Je=>{Ee[Je]!==void 0&&(Ue[Je]=Ee[Je])};return L4.forEach(dt),Ae.forEach(dt),Ue})(T.properties,YE)),t===ti.DISMISSED||t===ti.SENT){var ae=n==null?void 0:n[Tm.SURVEY_ID],D=n==null?void 0:n[Tm.SURVEY_ITERATION];dk({id:ae,current_iteration:D}),T.$set=de({},T.$set,{[(Y={id:ae,current_iteration:D},P=t===ti.SENT?"responded":"dismissed",$="$survey_"+P+"/"+Y.id,Y.current_iteration&&Y.current_iteration>0&&($="$survey_"+P+"/"+Y.id+"/"+Y.current_iteration),$)]:!0})}else t===ti.SHOWN&&(T.$set=de({},T.$set,{[Tm.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(t===yE.SHOWN){var B=n==null?void 0:n[m_.TOUR_TYPE];B&&(T.$set=de({},T.$set,{[m_.TOUR_LAST_SEEN_DATE+"/"+B]:new Date().toISOString()}))}var Q=de({},T.properties.$set,T.$set);if(Nr(Q)||this.setPersonPropertiesForFlags(Q),!Ye(this.config.before_send)){var R=this.ns(T);if(!R)return;(T=R).uuid=zy(T.uuid,as)}var me=(u=(d=T.$set)==null?void 0:d[Gs])!==null&&u!==void 0?u:nt((f=T.properties)==null?void 0:f.$set)?T.properties.$set[Gs]:void 0,be=ie!=null&&ie.pending&&me===ie.value?ie.value:void 0;this.Cl.emit("eventCaptured",T);var Ce=(p=r==null?void 0:r._url)!==null&&p!==void 0?p:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),Le=de({method:"POST",url:Ce,data:T,compression:"best-available",timestampMode:(r==null?void 0:r._batchKey)==="recordings"||/\/s\/(?:\?|$)/.test(Ce)?"body":"capture-body",batchKey:r==null?void 0:r._batchKey},r!=null&&r.transport?{transport:r.transport}:{},be?{fireCallbackOnDrop:!0,callback:Ee=>{Ee.statusCode>=200&&300>Ee.statusCode&&this.pu(be)}}:{});return!this.config.request_batching||r&&(r==null||!r._batchKey)||r!=null&&r.send_instantly||be?this.Jl(Le):this.Ql.enqueue(Le),T}ye.critical("This capture call is ignored due to client rate limiting.")}}else ye.error("No event name provided to posthog.capture")}else ye.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(n=>t(n.event,n)))}getExtension(t){var n;return(n=this.lu)==null?void 0:n.getExtension(t)}nu(){var t;return(t=this.lu)!==null&&t!==void 0?t:this.lu=new VE(this)}Ml(t){this.Bl.push(t);var n=!0;return()=>{if(n){n=!1;var r=this.Bl.indexOf(t);r!==-1&&this.Bl.splice(r,1)}}}yu(t){var n,r,a;return t===void 0&&(t=!0),!((n=this.persistence)==null||!n.consumeCookieIdentityChange())&&(this.Wl=null,this.persistence.get_property(tt)===cn&&((a=this.sessionPersistence)==null||a.clear(),this.ql.clear(),this.bu()),(r=this.featureFlags)==null||r.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,n,r,a,o){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return n;this.persistence.syncCookieProperties(),this.yu();var u=o?void 0:this.persistence.remove_event_timer(t),d=de({},n);if(d.token=this.config.token,d.$config_defaults=this.config.defaults,this.Pl()&&(d[b2]=!0),t==="$snapshot"){var f=de({},this.persistence.properties(),this.sessionPersistence.properties());return d.distinct_id=f.distinct_id,(!at(d.distinct_id)&&!an(d.distinct_id)||Mc(d.distinct_id))&&ye.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),d}var p,m=(function(I,U,Z,L){var q,M,ie,X;if(L===void 0&&(L=!1),!cr)return{};var Y,P=I?[...ro,...U||[]]:[],$=Jw(cr),re=$[0],ae=$[1],D=(Y="u">typeof navigator?navigator:void 0)!=null&&Y.brave?{brave:!0}:{},B={};ce(Z)||(B.detectGoogleSearchApp=Z);var Q={},R=(q=navigator)==null||(q=q.userAgentData)==null?void 0:q.platform,me=(M=navigator)==null?void 0:M.maxTouchPoints,be=te==null||(ie=te.screen)==null?void 0:ie.width,Ce=te==null||(X=te.screen)==null?void 0:X.height,Le=te==null?void 0:te.devicePixelRatio;ce(R)||(Q.userAgentDataPlatform=R),ce(me)||(Q.maxTouchPoints=me),ce(be)||(Q.screenWidth=be),ce(Ce)||(Q.screenHeight=Ce),ce(Le)||(Q.devicePixelRatio=Le);var Ee,Ae,Ue,dt,Je,At,mt,rt,Lt=$t(Ux({$os:re,$os_version:ae,$browser:Zw(cr,navigator.vendor,D,B),$device:Ly(cr),$device_type:(Ae=cr,Ue=Q,rt=Ly(Ae),rt===Lw||rt===Dw||rt==="Kobo"||rt==="Kindle Fire"||rt===Yw?Kl:rt===Vc||rt===Gl||rt===Gc||rt===Ng?"Console":rt===zw?"Wearable":rt?Er:(Ue==null?void 0:Ue.userAgentDataPlatform)==="Android"&&((dt=Ue==null?void 0:Ue.maxTouchPoints)!==null&&dt!==void 0?dt:0)>0?600>Math.min((Je=Ue==null?void 0:Ue.screenWidth)!==null&&Je!==void 0?Je:0,(At=Ue==null?void 0:Ue.screenHeight)!==null&&At!==void 0?At:0)/((mt=Ue==null?void 0:Ue.devicePixelRatio)!==null&&mt!==void 0?mt:1)?Er:Kl:"Desktop"),$timezone:G2(),$timezone_offset:xE()}),{$current_url:Qc(L?Wi(Zt==null?void 0:Zt.href):Zt==null?void 0:Zt.href,P,Xc),$host:Zt==null?void 0:Zt.host,$pathname:Zt==null?void 0:Zt.pathname,$raw_user_agent:cr.length>1e3?cr.substring(0,997)+"...":cr,$browser_version:a4(cr,navigator.vendor,D,B),$browser_language:f_(),$browser_language_prefix:(Ee=f_(),typeof Ee=="string"?Ee.split("-")[0]:void 0),$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:Pt.LIB_NAME,$lib_version:Pt.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Pt.SDK_DIST_CHANNEL&&(Lt.$sdk_dist_channel=Pt.SDK_DIST_CHANNEL),Lt})(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){var x=this.sessionManager.checkAndGetSessionAndWindowId(o,r.getTime(),!0),b=x.windowId;d.$session_id=x.sessionId,d.$window_id=b}this.sessionPropsManager&&$t(d,this.sessionPropsManager.getSessionProps());try{var y;this.sessionRecording&&$t(d,this.sessionRecording.sdkDebugProperties),d.$sdk_debug_retry_queue_size=(y=this.Kl)==null?void 0:y.length}catch(I){d.$sdk_debug_error_capturing_properties=String(I)}if(this.requestRouter.region===ox&&(d.$lib_custom_api_host=this.config.api_host),p=t!==Hl||o?t!==_m||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,a),d=$t(d,p),t===Hl&&pe&&(d.title=pe.title),!ce(u)){var _=r.getTime()-u;d.$duration=parseFloat((_/1e3).toFixed(3))}cr&&this.config.opt_out_useragent_filter&&(d.$browser_type=this._is_bot()?"bot":"browser");var j=this.persistence.properties(),N=this.sessionPersistence.properties(),w=d.$groups,E=j.$groups;nt(w)&&!Nr(w)&&(d.$groups=de({},nt(E)?E:{},w)),Nt(["$referrer","$referring_domain"],(I=>{I in j&&delete N[I]}));var C={};if(this.Bl.length>0)for(var T of this.Bl.slice())try{$t(C,T())}catch(I){ye.error("Failed to produce browser extension event properties",I)}(d=$t({},m,j,N,de({},C,d))).$is_identified=this._isIdentified(),Pe(this.config.property_denylist)?Nt(this.config.property_denylist,(function(I){delete d[I]})):ye.error(hk+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var O=this.config.sanitize_properties;O&&(ye.error(E_),d=O(d,t));var z=this._u();return d.$process_person_profile=z,z&&!o&&this.wu("_calculate_event_properties"),d}mu(t,n,r){var a;if(n===void 0&&(n=!0),r===void 0&&(r=!1),!this.persistence||!this._u()||this.Nl&&!r)return t;var o=this.persistence.get_initial_props(),u=(a=this.sessionPropsManager)==null?void 0:a.getSetOnceProps(),d=$t({},o,u||{},t||{}),f=this.config.sanitize_properties;return f&&(ye.error(E_),d=f(d,"$set_once")),n&&(this.Nl=!0),Nr(d)?void 0:d}register(t,n){var r;(r=this.persistence)==null||r.register(t,n)}register_once(t,n,r){var a;(a=this.persistence)==null||a.register_once(t,n,r)}register_for_session(t){var n,r;(n=this.persistence)==null||n.syncCookieProperties(),this.yu(),(r=this.sessionPersistence)==null||r.register(t),Object.keys(t).forEach((a=>this.ql.add(a))),this.bu()}unregister(t){var n;(n=this.persistence)==null||n.unregister(t)}unregister_for_session(t){var n;(n=this.sessionPersistence)==null||n.unregister(t),this.ql.delete(t),this.bu()}ku(t,n){this.register({[t]:n})}Yl(){this.ql.forEach((t=>{var n;(n=this.sessionPersistence)==null||n.unregister(t)})),this.ql.clear(),this.bu()}bu(){var t;if(this.jl)if(this.config.persistence==="memory"||(t=this.sessionPersistence)!=null&&t.Eo||!Rt.ii())Rt.oi(this.jl);else{var n=[];this.ql.forEach((r=>n.push(r))),n.length>0?Rt.ni(this.jl,n):Rt.oi(this.jl)}}getFeatureFlag(t,n){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlag(t,n)}getFeatureFlagPayload(t){var n;return(n=this.featureFlags)==null?void 0:n.getFeatureFlagPayload(t)}getFeatureFlagResult(t,n){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlagResult(t,n)}getAllFeatureFlags(){var t,n;return(t=(n=this.featureFlags)==null?void 0:n.getAllFeatureFlags())!==null&&t!==void 0?t:[]}isFeatureEnabled(t,n){var r,a;return(r=(a=this.featureFlags)==null?void 0:a.isFeatureEnabled(t,n))!==null&&r!==void 0?r:n==null?void 0:n.defaultValue}reloadFeatureFlags(){var t;(t=this.featureFlags)==null||t.reloadFeatureFlags()}updateFlags(t,n,r){var a;(a=this.featureFlags)==null||a.updateFlags(t,n,r)}updateEarlyAccessFeatureEnrollment(t,n,r){var a;(a=this.featureFlags)==null||a.updateEarlyAccessFeatureEnrollment(t,n,r)}getEarlyAccessFeatures(t,n,r){var a;return n===void 0&&(n=!1),(a=this.featureFlags)==null?void 0:a.getEarlyAccessFeatures(t,n,r)}on(t,n){return this.Cl.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:mc}),()=>{})}onSessionId(t){var n,r;return(n=(r=this.sessionManager)==null?void 0:r.onSessionId(t))!==null&&n!==void 0?n:()=>{}}getSurveys(t,n){n===void 0&&(n=!1),this.surveys?this.surveys.getSurveys(t,n):t([],{isLoaded:!1,error:mc})}getActiveMatchingSurveys(t,n){n===void 0&&(n=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,n):t([],{isLoaded:!1,error:mc})}renderSurvey(t,n){var r;(r=this.surveys)==null||r.renderSurvey(t,n)}displaySurvey(t,n){var r;n===void 0&&(n=$E),(r=this.surveys)==null||r.displaySurvey(t,n)}cancelPendingSurvey(t){var n;(n=this.surveys)==null||n.cancelPendingSurvey(t)}canRenderSurvey(t){var n,r;return(n=(r=this.surveys)==null?void 0:r.canRenderSurvey(t))!==null&&n!==void 0?n:{visible:!1,disabledReason:mc}}canRenderSurveyAsync(t,n){var r,a;return n===void 0&&(n=!1),(r=(a=this.surveys)==null?void 0:a.canRenderSurveyAsync(t,n))!==null&&r!==void 0?r:Promise.resolve({visible:!1,disabledReason:mc})}Su(t){return!t||Mc(t)?(ye.critical("Unique user id has not been set in posthog.identify"),!1):t===El?(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,r){if(!this.__loaded||!this.persistence)return ye.uninitializedWarning("posthog.identify");if(an(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.Su(t)&&this.wu("posthog.identify")){this.Ll();var a=this.get_distinct_id(),o=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==a,u=this.yu(!1),d=this.persistence.Zo(),f=!1;try{var p=this.get_distinct_id();this.register({$user_id:t}),this.get_property(Yc)||this.register_once({$had_persisted_distinct_id:!0,$device_id:p},""),t!==p&&t!==this.get_property(Fl)&&(this.unregister(Fl),this.register({distinct_id:t}));var m=(this.persistence.get_property(tt)||cn)===cn,x=t!==p,b=!x&&m;if(x&&m){var y,_=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:p};this.persistence.set_property(tt,zn),this.setPersonPropertiesForFlags({$set:n||{},$set_once:r||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Qo(),this.capture(Qg,_,{$set:n||{},$set_once:r||{}}),this.Wl=Lm(t,n,r),(y=this.featureFlags)==null||y.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:p)}else if(b){this.persistence.set_property(tt,zn);var j=n||{},N=r||{};this.setPersonPropertiesForFlags({$set:j,$set_once:N},!1),this.config.cookieWinsOnConflict&&this.persistence.Qo(),this.capture("$set",{$set:j,$set_once:N}),this.Wl=Lm(t,n,r)}else(n||r)&&this.setPersonProperties(n,r);x||o||u?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(Js)):b&&(n||r)&&this.reloadFeatureFlags(),f=!0}finally{d&&this.persistence.Yo(f)}}}setPersonProperties(t,n){if((t||n)&&this.wu("posthog.setPersonProperties")){var r=Lm(this.get_distinct_id(),t,n);this.Wl!==r?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:n||{}},!0),this.capture("$set",{$set:t||{},$set_once:n||{}}),this.Wl=r):ye.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var n,r=(Pe(t)?t:[t]).filter((a=>at(a)&&a.length>0));r.length!==0&&this.wu("posthog.unsetPersonProperties")&&((n=this.featureFlags)==null||n.unsetPersonPropertiesForFlags(r,!0),this.capture("$set",{$unset:r}),this.Wl=null)}group(t,n,r){var a;if(t&&n){(a=this.persistence)==null||a.syncCookieProperties(),this.yu();var o=this.getGroups(),u=o[t]!==n;if(u&&this.resetGroupPropertiesForFlags(t),this.register({$groups:de({},o,{[t]:n})}),(u||r)&&this._u()){var d={$group_type:t,$group_key:n};r&&(d.$group_set=r),this.capture(Qy,d)}r&&this.setGroupPropertiesForFlags({[t]:r}),u&&!r&&this.reloadFeatureFlags()}else ye.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,n){var r;n===void 0&&(n=!0),(r=this.featureFlags)==null||r.setPersonPropertiesForFlags(t,n)}resetPersonPropertiesForFlags(t){var n;t===void 0&&(t=!0),(n=this.featureFlags)==null||n.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,n){var r;n===void 0&&(n=!0),this.wu("posthog.setGroupPropertiesForFlags")&&((r=this.featureFlags)==null||r.setGroupPropertiesForFlags(t,n))}resetGroupPropertiesForFlags(t){var n;(n=this.featureFlags)==null||n.resetGroupPropertiesForFlags(t)}reset(t){var n=Kn(t)?t:t==null?void 0:t.resetDeviceID,r=Kn(t)||t==null?void 0:t.bootstrap;this.xu(n,!1,r)}xu(t,n,r){var a,o,u;if(n===void 0&&(n=!1),ye.info("reset"),!this.__loaded)return ye.uninitializedWarning("posthog.reset");var d=r==null?void 0:r.sessionID;this.config.bootstrap=r||((a=this.Gl)==null?void 0:a.bootstrap)||{},(o=this.featureFlags)==null||o.updateConfig==null||o.updateConfig(this.config,this.pa());var f=this.get_property(Yc),p=this.get_property(ym),m=this.get_property(Da),x=this.is_capturing();this.consent.reset(),n||!x||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.");var b=(u=this.persistence)==null||u.Zo==null?void 0:u.Zo(),y=!1;try{var _,j,N,w,E,C,T,O,z,I,U,Z,L;if((_=this.persistence)==null||_.clear(),(j=this.sessionPersistence)==null||j.clear(),this.ql.clear(),this.bu(),ce(m)||(I=this.persistence)==null||I.register({[Da]:m}),(N=this.surveys)==null||N.reset(),(w=this.featureFlags)==null||w.reset(),(E=this.conversations)==null||E.reset(),(C=this.logs)==null||C.reset(),(T=this.metrics)==null||T.reset(),(O=this.persistence)==null||O.set_property(tt,cn),(z=this.sessionManager)==null||z.resetSessionId(),this.Wl=null,this.config.cookieless_mode===ei)this.register_once({distinct_id:El,$device_id:null},"");else{var q=this.config.get_device_id(as());this.register_once({distinct_id:q,$device_id:t?q:f},""),t||ce(p)||this.register({[ym]:p})}if(this.register({$last_posthog_reset:new Date().toISOString()},1),r&&(r.distinctID===void 0||this.Pl()||((L=this.persistence)==null||L.set_property(tt,r.isIdentifiedID?zn:cn),this.register({distinct_id:r.distinctID})),(U=this.featureFlags)==null||U.initialize(),!(ce(d)||(Z=this.sessionManager)!=null&&Z.setBootstrapSessionId(d,!0)))){var M=de({},r);delete M.sessionID,this.config.bootstrap=M}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,y=!0}finally{var ie;b&&((ie=this.persistence)==null||ie.Yo==null||ie.Yo(y))}this.reloadFeatureFlags()}shutdown(t){var n=this;return Ft((function*(){var r,a,o,u,d,f,p;if(n.__loaded){n.nu().dispose(),(r=n.sessionRecording)==null||r.dispose(),(a=n.logs)==null||a.flushLogs("sendBeacon"),(o=n.metrics)==null||o.flush("sendBeacon"),(u=n.Ql)==null||u.unload(),(d=n.Kl)==null||d.unload();try{var m;(m=n.featureFlags)==null||m.destroy()}catch(x){ye.error("Error while destroying feature flags",x)}(f=n.persistence)==null||f.destroy(),(p=n.sessionPersistence)==null||p.destroy()}else ye.uninitializedWarning("posthog.shutdown")}))()}setIdentity(t,n){var r;delete this.config.identity_claims,this.config.identity_distinct_id=t,this.config.identity_hash=n,this.alias(t),(r=this.conversations)==null||r.Cu()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,(t=this.conversations)==null||t.Tu()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,n;return(t=(n=this.sessionManager)==null?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&t!==void 0?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var n=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=n.sessionStartTimestamp,a=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+n.sessionId);if(t!=null&&t.withTimestamp&&r){var o,u=(o=t.timestampLookBack)!==null&&o!==void 0?o:10;if(!r)return a;a+="?t="+Math.max(Math.floor((new Date().getTime()-r)/1e3)-u,0)}return a}alias(t,n){return t===this.get_property(h2)?(ye.critical("Attempting to create alias for existing People user - aborting."),-2):this.wu("posthog.alias")?(ce(n)&&(n=this.get_distinct_id()),t!==n?(this.ku(Fl,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){var n=de({},this.config);if(nt(t)){var r,a,o,u,d,f,p,m,x,b,y,_;$t(this.config,A_(t));var j=this.Dl();(r=this.persistence)==null||r.update_config(this.config,n,j),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Em(de({},this.config,{persistence:"sessionStorage"}),j,!1);var N,w=this.Vl(this.config.debug);Kn(w)&&(this.config.debug=w),Kn(this.config.debug)&&(this.config.debug?(Pt.DEBUG=!0,ut.ii()&&ut.ni("ph_debug",!0),ye.info("set_config",{config:t,oldConfig:n,newConfig:de({},this.config)})):(Pt.DEBUG=!1,ut.ii()&&ut.oi("ph_debug"))),(a=this.featureFlags)==null||a.updateConfig==null||a.updateConfig(this.config,this.pa()),(o=this.exceptionObserver)==null||o.onConfigChange(),(u=this.exceptions)==null||u.onConfigChange(),(d=this.sessionRecording)==null||d.startIfEnabledOrStop(),(f=this.tracingHeaders)==null||f.startIfEnabledOrStop(),(p=this.autocapture)==null||p.startIfEnabled(),(m=this.heatmaps)==null||m.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&((N=this.historyAutocapture)==null||N.startIfEnabledOrStop()),(x=this.exceptionObserver)==null||x.startIfEnabledOrStop(),(b=this.deadClicksAutocapture)==null||b.startIfEnabledOrStop(),(y=this.surveys)==null||y.loadIfEnabled(),this.$l(),(_=this.externalIntegrations)==null||_.startIfEnabledOrStop(),!n.segment&&this.config.segment&&this.persistence&&d_(this,Bc,!1)}}_overrideSDKInfo(t,n){Pt.LIB_NAME=t,Pt.LIB_VERSION=n}startSessionRecording(t){var n,r,a,o,u,d=t===!0,f={sampling:d||!(t==null||!t.sampling),linked_flag:d||!(t==null||!t.linked_flag),url_trigger:d||!(t==null||!t.url_trigger),event_trigger:d||!(t==null||!t.event_trigger)};Object.values(f).some(Boolean)&&((n=this.sessionManager)==null||n.checkAndGetSessionAndWindowId(),f.sampling&&((r=this.sessionRecording)==null||r.overrideSampling()),f.linked_flag&&((a=this.sessionRecording)==null||a.overrideLinkedFlag()),f.url_trigger&&((o=this.sessionRecording)==null||o.overrideTrigger("url")),f.event_trigger&&((u=this.sessionRecording)==null||u.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!((t=this.sessionRecording)==null||!t.started)}captureException(t,n){try{if(!this.exceptions)return;var r=new Error("PostHog syntheticException"),a=this.exceptions.buildProperties(t,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(de({},a,n))}catch{return}}addExceptionStep(t,n){var r;(r=this.exceptions)==null||r.addExceptionStep(t,n)}captureLog(t){var n;(n=this.logs)==null||n.captureLog(t)}get logger(){var t,n;return(t=(n=this.logs)==null?void 0:n.logger)!==null&&t!==void 0?t:jr.Mu}startExceptionAutocapture(t){this.set_config({capture_exceptions:t==null||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var n,r;return(n=(r=this.toolbar)==null?void 0:r.loadToolbar(t))!==null&&n!==void 0&&n}get_property(t){var n;return(n=this.persistence)==null?void 0:n.props[t]}getSessionProperty(t){var n;return(n=this.sessionPersistence)==null?void 0:n.props[t]}toString(){var t,n=(t=this.config.name)!==null&&t!==void 0?t:Pl;return n!==Pl&&(n=Pl+"."+n),n}_isIdentified(){var t,n;return((t=this.persistence)==null?void 0:t.get_property(tt))===zn||((n=this.sessionPersistence)==null?void 0:n.get_property(tt))===zn}_u(){var t,n;return!(this.config.person_profiles==="never"||this.config.person_profiles===Wg&&!this._isIdentified()&&Nr(this.getGroups())&&((t=this.persistence)==null||(t=t.props)==null||!t[Fl])&&((n=this.persistence)==null||(n=n.props)==null||!n[jh]))}vu(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&!!this.config.capture_pageview}createPersonProfile(){this._u()||this.wu("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.wu("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}wu(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.Al(),this.ku(jh,!0),!0)}Dl(){if(this.config.cookieless_mode==="always")return!0;var t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==Hi)}$l(){var t,n,r,a,o,u=this.Dl();return this.is_capturing()||(r=this.logs)==null||r.Iu(),((t=this.persistence)==null?void 0:t.Eo)!==u&&((a=this.persistence)==null||a.set_disabled(u)),((n=this.sessionPersistence)==null?void 0:n.Eo)!==u&&((o=this.sessionPersistence)==null||o.set_disabled(u)),u&&(this.ql.clear(),this.bu()),u}opt_in_capturing(t){var n;if(this.config.cookieless_mode!==ei){if(this.Pl()){var r,a,o,u,d,f;(r=this.sessionRecording)==null||r.dispose({discardBufferedEvents:!0}),this.xu(!0,!0),(a=this.sessionManager)==null||a.destroy(),(o=this.pageViewManager)==null||o.destroy(),this.sessionManager=new S_(this),this.pageViewManager=new h_(this),this.persistence&&(this.sessionPropsManager=new w_(this,this.sessionManager,this.persistence));var p,m=(u=(d=this.config.__extensionClasses)==null?void 0:d.sessionRecording)!==null&&u!==void 0?u:(f=jr.__defaultExtensionClasses)==null?void 0:f.sessionRecording;m&&(this.sessionRecording=this.Rl(this.sessionRecording,new m(this)),this.xl&&((p=this.sessionRecording)==null||p.onRemoteConfig==null||p.onRemoteConfig(this.xl)))}var x,b;this.consent.optInOut(!0),this.$l(),this.uu(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),this.config.cookieless_mode==Hi&&((x=this.surveys)==null||x.loadIfEnabled()),(ce(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.hu()}else ye.warn(C_)}opt_out_capturing(){if(this.config.cookieless_mode!==ei){var t,n,r=this.config.cookieless_mode===Hi?this.sessionRecording:void 0;r==null||r.dispose({discardBufferedEvents:!0}),this.config.cookieless_mode===Hi&&this.consent.isOptedIn()&&this.xu(!0,!0),this.consent.optInOut(!1),this.$l(),this.config.cookieless_mode===Hi&&(this.register({distinct_id:El,$device_id:null}),this.El(r),this.sessionRecording=void 0,(t=this.sessionManager)==null||t.destroy(),(n=this.pageViewManager)==null||n.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.hu(),this.uu())}else ye.warn(C_)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return t===1?"granted":t===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===ei||(this.config.cookieless_mode===Hi?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.$l()}_is_bot(){return Nn?ik(Nn,this.config.custom_blocked_useragents):void 0}hu(){pe&&(pe.visibilityState==="visible"?this.Hl||(this.Hl=!0,this.capture(Hl,{title:pe.title},{send_instantly:!0}),this.zl&&(pe.removeEventListener(eo,this.zl),this.zl=null)):this.zl||(this.zl=this.hu.bind(this),Dt(pe,eo,this.zl)))}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}))}pa(){var t=this.Gl||{};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,r,a,o,u){var d=r in n&&!Ye(n[r]),f=a in n&&!Ye(n[a]);return d?n[r]:!!f&&(u&&u.warn("Config field '"+a+"' is deprecated. Please use '"+r+"' instead. The old field will be removed in a future major version."),n[a])})(t,"advanced_disable_flags","advanced_disable_decide",0,ye)}ns(t){var n;if(Ye(this.config.before_send))return t;var r=Object.keys((n=t.properties)!==null&&n!==void 0?n:{}).filter(W3),a=Pe(this.config.before_send)?this.config.before_send:[this.config.before_send],o=t;for(var u of a)try{if(o=u(o),Ye(o)){var d="Event '"+t.event+"' was rejected in beforeSend function";return Y3(t.event)?ye.warn(d+". This can cause unexpected behavior."):ye.info(d),null}o.properties&&!Nr(o.properties)||ye.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}catch(p){return ye.error("Error in beforeSend function for event '"+t.event+"':",p),null}for(var f of r)if(o.properties&&Ye(o.properties[f]))return ye.warn("Event '"+t.event+"' had its '"+f+"' 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.io)==null?void 0:t.pageViewId}captureTraceFeedback(t,n){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:n})}captureTraceMetric(t,n,r){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:n,$ai_metric_value:String(r)})}Vl(t){var n=Kn(t)&&!t,r=ut.ii()&&ut.ai("ph_debug")==="true";return!n&&(!!r||t)}}jr.__defaultExtensionClasses={},jr.Mu=(()=>{var e=()=>{};return{trace:e,debug:e,info:e,warn:e,error:e,fatal:e}})(),(function(e,t){for(var n=0;t.length>n;n++)e.prototype[t[n]]=V4(e.prototype[t[n]])})(jr,["identify"]);class pk{constructor(t){this.disabled=t===!1;var n=nt(t)?t:{};this.thresholdPx=n.threshold_px||30,this.timeoutMs=n.timeout_ms||1e3,this.clickCount=n.click_count||3,this.clicks=[]}isRageClick(t,n,r){if(this.disabled)return!1;var a=this.clicks[this.clicks.length-1];if(a&&Math.abs(t-a.x)+Math.abs(n-a.y)<this.thresholdPx&&this.timeoutMs>r-a.timestamp){if(this.clicks.push({x:t,y:n,timestamp:r}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:n,timestamp:r}];return!1}}var Pm="$copy_autocapture",$d=Gt("[AutoCapture]");function $m(e,t){return t.length>e?t.slice(0,e)+"...":t}function KE(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!Qi(t));return t}function ZE(e,t){var n,r,a=t.e,o=t.maskAllElementAttributes,u=t.maskAllText,d=t.elementAttributeIgnoreList,f=t.elementsChainAsString,p=t.disableCaptureUrlHashes;if(!Qi(e))return{props:{}};for(var m=[e],x=new Set([e]),b=e;b.parentNode&&!Cr(b,"body")&&E2>m.length;)if(C2(b.parentNode)){var y=b.parentNode.host;if(x.has(y))break;x.add(y),m.push(y),b=y}else{if(!Qi(b.parentNode)||x.has(b.parentNode))break;x.add(b.parentNode),m.push(b.parentNode),b=b.parentNode}var _,j,N=[],w={},E=!1,C=!1;if(Nt(m,(U=>{var Z=tx(U);if(Cr(U,"a")){var L=U.getAttribute("href");E=!!(Z&&L&&Lc(L))&&(p?Wi(L):L)}Ie(Ah(U),"ph-no-capture")&&(C=!0),N.push((function(M,ie,X,Y,P){P===void 0&&(P=!1);var $=M.tagName.toLowerCase(),re={tag_name:$};Hx.indexOf($)>-1&&!X&&(re.$el_text=$.toLowerCase()==="a"||$.toLowerCase()==="button"?$m(1024,o_(M)):$m(1024,Wc(M)));var ae=Ah(M);ae.length>0&&(re.classes=ae.filter((function(R){return R!==""}))),Nt(M.attributes,(function(R){var me;if((!L2(M)||["name","id","class","aria-label"].indexOf(R.name)!==-1)&&(Y==null||!Y.includes(R.name))&&!ie&&Lc(R.value)&&(!at(me=R.name)||me.substring(0,10)!=="_ngcontent"&&me.substring(0,7)!=="_nghost")){var be=R.value;R.name==="class"&&(be=Ix(be).join(" ")),re["attr__"+R.name]=$m(1024,R.name==="href"&&P?Wi(be):be)}}));for(var D=1,B=1,Q=M;Q=KE(Q);)D++,Q.tagName===M.tagName&&B++;return re.nth_child=D,re.nth_of_type=B,re})(U,o,u,d,p));var q=(function(M){if(!tx(M))return{};var ie={};return Nt(M.attributes,(function(X){if(X.name&&X.name.indexOf("data-ph-capture-attribute")===0){var Y=X.name.replace("data-ph-capture-attribute-",""),P=X.value;Y&&P&&Lc(P)&&(ie[Y]=P)}})),ie})(U);Nt(q,((M,ie)=>{({}).hasOwnProperty.call(w,ie)||(w[ie]=M)}))})),C)return{props:{},explicitNoCapture:C};if(u||(N[0].$el_text=Cr(e,"a")||Cr(e,"button")?o_(e):Wc(e)),E){var T,O;N[0].attr__href=E;var z=(T=to(E))==null?void 0:T.host,I=te==null||(O=te.location)==null?void 0:O.host;z&&I&&z!==I&&(_=E)}return{props:$t({$event_type:a.type,$ce_version:1},f?{}:{$elements:N},{$elements_chain:(j=N,Pe(j)?(function(U){return U.map((Z=>{var L,q,M="";if(Z.tag_name&&(M+=Z.tag_name),Z.attr_class)for(var ie of(Z.attr_class.sort(),Z.attr_class))M+="."+ie.replace(/"/g,"");var X=de({},Z.text?{text:Z.text}:{},{"nth-child":(L=Z.nth_child)!==null&&L!==void 0?L:0,"nth-of-type":(q=Z.nth_of_type)!==null&&q!==void 0?q:0},Z.href?{href:Z.href}:{},Z.attr_id?{attr_id:Z.attr_id}:{},Z.attributes),Y={};return rh(X).sort(((P,$)=>{return(ae=$[0])>(re=P[0])?-1:re>ae?1:0;var re,ae})).forEach((P=>{var $=P[1];return Y[c_(P[0].toString())]=c_($.toString())})),(M+=":")+rh(Y).map((P=>P[0]+'="'+P[1]+'"')).join("")})).join(";")})((function(U){return U.map((Z=>{var L,q,M={text:(L=Z.$el_text)==null?void 0:L.slice(0,400),tag_name:Z.tag_name,href:(q=Z.attr__href)==null?void 0:q.slice(0,2048),attr_class:cE(Z),attr_id:Z.attr__id,nth_child:Z.nth_child,nth_of_type:Z.nth_of_type,attributes:{}};return rh(Z).filter((ie=>ie[0].indexOf("attr__")===0)).forEach((ie=>M.attributes[ie[0]]=ie[1])),M}))})(j)):"")},(n=N[0])!=null&&n.$el_text?{$el_text:(r=N[0])==null?void 0:r.$el_text}:{},_&&a.type==="click"?{$external_click_url:_}:{},w)}}class JE{constructor(t){this.name="autocapture",this.Rs=!1,this.Ps=null,this.As=!1,this.Fs=!1,this.mn={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.Os=!1,this.Ls=t,this.Ls.refresh(this.mn),this.rageclicks=new pk(this.mn.rageclick),this.Ds=null}setup(t){this.$s(),this.Ns=t;var n=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.Os?n.dispose():(this.qs=n,this.startIfEnabled())}dispose(){var t;this.Os||(this.Os=!0,this.Ns=void 0,(t=this.qs)==null||t.dispose(),this.qs=void 0,this.js())}Bs(){return this.Ls.refresh(this.mn),this.mn}$s(){var t,n;return this.Bs(),this.mn.url_allowlist=(t=this.mn.url_allowlist)==null?void 0:t.map((r=>new RegExp(r))),this.mn.url_ignorelist=(n=this.mn.url_ignorelist)==null?void 0:n.map((r=>new RegExp(r))),this.mn}Hs(){if(this.isBrowserSupported()){if(te&&pe){var t=this.zs=r=>{r=r||(te==null?void 0:te.event);try{this.Us(r)}catch(a){$d.error("Failed to capture event",a)}};if(Dt(pe,"submit",t,{capture:!0}),Dt(pe,"change",t,{capture:!0}),Dt(pe,"click",t,{capture:!0}),this.Bs().capture_copied_text){var n=this.Ws=r=>{r=r||(te==null?void 0:te.event);try{this.Us(r,Pm)}catch(a){$d.error("Failed to capture clipboard event",a)}};Dt(pe,"copy",n,{capture:!0}),Dt(pe,"cut",n,{capture:!0}),Dt(pe,"paste",n,{capture:!0})}}}else $d.info("Disabling Automatic Event Collection because this browser is not supported")}js(){this.zs&&(pe==null||pe.removeEventListener("submit",this.zs,!0),pe==null||pe.removeEventListener("change",this.zs,!0),pe==null||pe.removeEventListener("click",this.zs,!0),this.zs=void 0),this.Ws&&(pe==null||pe.removeEventListener("copy",this.Ws,!0),pe==null||pe.removeEventListener("cut",this.Ws,!0),pe==null||pe.removeEventListener("paste",this.Ws,!0),this.Ws=void 0),this.Rs=!1}startIfEnabled(){!this.Os&&this.Ns&&this.isEnabled&&!this.Rs&&(this.Hs(),this.Rs=!0)}onRemoteConfig(t){if(!this.Os)if(this.As=!0,t.ok){var n=t.config;n.elementsChainAsString&&(this.Fs=n.elementsChainAsString);var r,a=n.autocapture_opt_out;Kn(a)&&((r=this.Ns)==null||r.kv.set(Dg,a),this.Ps=a),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(t){this.Ds=t}getElementSelectors(t){var n,r=[];return(n=this.Ds)==null||n.forEach((a=>{var o=pe==null?void 0:pe.querySelectorAll(a);o==null||o.forEach((u=>{t===u&&r.push(a)}))})),r}get isEnabled(){var t,n;if(this.Os)return!1;var r=(t=this.Ns)==null?void 0:t.kv.get(Dg),a=this.Ps,o=this.Bs(),u=o.remoteRequestsDisabled&&!this.As;if(sn(a)&&!Kn(r)&&!u)return!1;var d=(n=this.Ps)!==null&&n!==void 0?n:!!r;return!!o.enabled&&!d}Us(t,n){if(n===void 0&&(n="$autocapture"),this.isEnabled){var r=Jg(t);N2(r)&&(r=r.parentNode||null);var a,o=this.$s();n==="$autocapture"&&t.type==="click"&&t instanceof MouseEvent&&o.rageclick&&(a=this.rageclicks)!=null&&a.isRageClick(t.clientX,t.clientY,t.timeStamp||new Date().getTime())&&R2(r,o.rageclick)&&this.Us(t,"$rageclick");var u=n===Pm,d=u?de({},o,{dom_event_allowlist:void 0}):o;if(r&&(function(w,E,C,T,O,z){var I;if(!te||qx(w)||C!=null&&C.url_allowlist&&!t_(C.url_allowlist,z)||C!=null&&C.url_ignorelist&&t_(C.url_ignorelist,z))return!1;if(C!=null&&C.dom_event_allowlist){var U=C.dom_event_allowlist;if(U&&!U.some((X=>E.type===X)))return!1}var Z=D2(w,T),L=Z.parentIsUsefulElement,q=Z.targetElementList;if(!(function(X,Y){var P=Y==null?void 0:Y.element_allowlist;if(ce(P))return!0;var $,re=function(D){if(P.some((B=>D.tagName.toLowerCase()===B)))return{v:!0}};for(var ae of X)if($=re(ae))return $.v;return!1})(q,C)||!ex(q,C==null?void 0:C.css_selector_allowlist)||ex(q,(I=C==null?void 0:C.css_selector_ignorelist)!==null&&I!==void 0?I:rE))return!1;try{var M=te.getComputedStyle(w);if(M&&M.getPropertyValue("cursor")==="pointer"&&E.type==="click")return!0}catch{}var ie=w.tagName.toLowerCase();switch(ie){case"html":return!1;case"form":return(O||["submit"]).indexOf(E.type)>=0;case"input":case"select":case"textarea":return(O||["change","click"]).indexOf(E.type)>=0;default:return L?(O||["click"]).indexOf(E.type)>=0:(O||["click"]).indexOf(E.type)>=0&&(Hx.indexOf(ie)>-1||w.getAttribute("contenteditable")==="true")}})(r,t,d,u,u?["copy","cut","paste"]:void 0,{config:{get_current_url:o.getCurrentUrl}})){var f,p=ZE(r,{e:t,maskAllElementAttributes:o.maskAllElementAttributes,maskAllText:o.maskAllText,elementAttributeIgnoreList:o.element_attribute_ignorelist,elementsChainAsString:this.Fs,disableCaptureUrlHashes:o.disableCaptureUrlHashes}),m=p.props;if(p.explicitNoCapture)return!1;var x=this.getElementSelectors(r);if(x&&x.length>0&&(m.$element_selectors=x),n===Pm){var b=t.type||"clipboard";if(b!=="paste"){var y,_,j=te==null||(y=te.getSelection())==null?void 0:y.toString(),N=A2(j);if(!N)return!1;m.$selected_content=N,m.$clipboard_text_length=(_=j==null?void 0:j.length)!==null&&_!==void 0?_:0}m.$copy_type=b}return(f=this.Ns)==null||f.capture(n,m).catch((w=>$d.error("Failed to capture event",w))),!0}}}isBrowserSupported(){return In(pe==null?void 0:pe.querySelectorAll)}}class e6{constructor(t){this._instance=t}refresh(t){var n=this._instance.config,r=nt(n.autocapture)?n.autocapture:void 0;t.enabled=!!n.autocapture,t.rageclick=n.rageclick,t.maskAllElementAttributes=n.mask_all_element_attributes,t.maskAllText=n.mask_all_text,t.disableCaptureUrlHashes=n.disable_capture_url_hashes,t.getCurrentUrl=n.get_current_url,t.remoteRequestsDisabled=this._instance.pa(),t.url_allowlist=r==null?void 0:r.url_allowlist,t.url_ignorelist=r==null?void 0:r.url_ignorelist,t.dom_event_allowlist=r==null?void 0:r.dom_event_allowlist,t.element_allowlist=r==null?void 0:r.element_allowlist,t.css_selector_allowlist=r==null?void 0:r.css_selector_allowlist,t.css_selector_ignorelist=r==null?void 0:r.css_selector_ignorelist,t.element_attribute_ignorelist=r==null?void 0:r.element_attribute_ignorelist,t.capture_copied_text=r==null?void 0:r.capture_copied_text}}var gc=Gt("[ExceptionAutocapture]"),T_=()=>{},M_=e=>{var t;if(In(e))return(t=e.__posthog_layer__)!==null&&t!==void 0?t:e.__rrweb_layer__};function mk(e,t,n){try{if(!(t in e))return T_;var r={next:e[t]},a=n((function(){for(var o=arguments.length,u=new Array(o),d=0;o>d;d++)u[d]=arguments[d];return r.next.apply(this,u)}));return In(a)&&(a.prototype=a.prototype||{},Object.defineProperties(a,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:r}})),e[t]=a,()=>{if(e[t]!==a)for(var o=e[t],u=M_(o);u;){if(u.next===a)return void(u.next=r.next);u=M_(o=u.next)}else e[t]=r.next}}catch{return T_}}var t6=Gt("[TracingHeaders]"),Sa=Gt("[Web Vitals]"),R_=9e5,D_=["CLS","FCP","INP","LCP"],n6=["INP","LCP"],r6=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],Fd="disabled",L_="lazy_loading",xc="awaiting_config",Ud="missing_config";Gt("[SessionRecording]"),Gt("[SessionRecording]");var cx="[SessionRecording]",Ws=Gt(cx),s6=Gt("[Heatmaps]");function Fm(e){return nt(e)&&"clientX"in e&&"clientY"in e&&an(e.clientX)&&an(e.clientY)}var Id=Gt("[Product Tours]"),Um=e=>{var t;return!e.config.disable_product_tours&&!((t=e.persistence)==null||!t.get_property(Px))},i6=["$set_once","$set"],bs=Gt("[SiteApps]"),O_="Error while initializing PostHog app with config id ",gk=(e,t)=>e!=null&&e.then?e.then(t):t(e),Ll="SDK is not enabled or survey functionality is not yet loaded",z_="Disabled. Not loading surveys.";class a6{constructor(t,n){this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Eu=!1,this.Ru=[],this.Pu=null,this.Au=null,this.Os=!1,this.Fu=new Set,this.onRemoteConfig=r=>{if(!this.Os&&!this.mn.disableSurveys){if(!r.ok)return kt.warn("Remote config unavailable. Not loading surveys.");var a=r.config.surveys;if(Ye(a))return kt.warn("Flags not loaded yet. Not loading surveys.");this.Ou=Kn(a)?a:a.length>0,kt.info("flags response received, isSurveysEnabled: "+this.Ou),this.loadIfEnabled()}},this.Ls=t,this.Lu=n}setup(t){if(!this.Os)return this.Du=t,gk(t.kv.initialize(),(()=>{if(this.Du===t&&!this.Os){this.Du=void 0,this.Ns=t;var n=t.onRemoteConfig(this.onRemoteConfig);this.Os?n.dispose():(this.qs=n,this.loadIfEnabled())}}))}dispose(){var t,n,r;this.Os||(this.Os=!0,this.Du=void 0,this.Ns=void 0,(t=this.qs)==null||t.dispose(),this.qs=void 0,(n=this._surveyEventReceiver)==null||n.dispose(),this._surveyEventReceiver=null,(r=this._surveyManager)==null||r.dispose==null||r.dispose(),this._surveyManager=null,this.Ru=[],this.Pu=null,this.Fu.forEach((a=>clearTimeout(a))),this.Fu.clear())}get mn(){return this.Ls.get()}initialize(){this.loadIfEnabled()}reset(){try{var t;(t=this._surveyEventReceiver)==null||t.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var n=[],r=0;r<localStorage.length;r++){var a=localStorage.key(r);(a!=null&&a.startsWith(uk)||a!=null&&a.startsWith("inProgressSurvey_"))&&n.push(a)}n.forEach((o=>localStorage.removeItem(o)))}catch{}}loadIfEnabled(){if(!this.Os&&this.Ns){var t=this.mn;if(!this._surveyManager)if(this.Eu)kt.info("Already initializing surveys, skipping...");else if(t.disableSurveys)kt.info(z_);else if(t.cookielessMode&&this.Ls.isOptedOut())kt.info("Not loading surveys in cookieless mode without consent.");else{var n=this.Ls.getExtensions();if(n){if(!ce(this.Ou)||t.advancedEnableSurveys){var r=this.Ou||t.advancedEnableSurveys;this.Eu=!0;try{var a=n.generateSurveys;if(a)return this.$u(a,r),void(this.Eu=!1);var o=n.loadExternalDependency;if(!o)return this.Nu(Fx),void(this.Eu=!1);o((u=>{try{if(this.Os)return;var d=this.Ls.getExtensions();u||d==null||!d.generateSurveys?this.Nu("Could not load surveys script",u):this.$u(d.generateSurveys,r)}finally{this.Eu=!1}}))}catch(u){throw this.Eu=!1,this.Nu("Error initializing surveys",u),u}}}else kt.error("PostHog Extensions not found.")}}}$u(t,n){this.Os||(this._surveyManager=t(n),this._surveyEventReceiver=this.Ls.createEventReceiver(),kt.info("Surveys loaded successfully"),this.qu({isLoaded:!0}))}Nu(t,n){kt.error(t,n),this.qu({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.Ru.push(t),this._surveyManager&&this.qu({isLoaded:!0}),()=>{this.Ru=this.Ru.filter((n=>n!==t))}}getSurveys(t,n){var r;n===void 0&&(n=!1);var a=(r=this.Ns)!==null&&r!==void 0?r:this.Lu;if(a&&!this.Os){if(this.mn.disableSurveys)return kt.info(z_),t([]);var o=a.kv.get(Ug);if(o&&!n)return t(o,{isLoaded:!0}),void(this.ju()&&this.getSurveys((()=>{}),!0));if(this.Pu)this.Pu.then((f=>{this.Os||t(f.surveys,f.context)})).catch((f=>kt.error("Error in survey callback",f)));else{var u=this.Bu("/api/surveys/",{method:"GET",query:{token:a.projectToken},sentAt:"query",timeoutMs:this.mn.requestTimeoutMs}).then((f=>{try{return this.Hu(a,f)}catch(p){return kt.error("Error processing surveys response",p),this.Hu(a,{statusCode:0,error:p})}}),(f=>this.Hu(a,{statusCode:0,error:f})));this.Pu=u;var d=()=>{this.Pu===u&&(this.Pu=null)};u.then((f=>{d(),this.Os||t(f.surveys,f.context)}),d).catch((f=>kt.error("Error in survey callback",f)))}}}Bu(t,n){var r=this.Ns;return r?r.sendRequest(t,n):new Promise((a=>a({statusCode:0,error:new Error(Ll)})))}Hu(t,n){if(this.Os)return{surveys:[],context:{isLoaded:!1,error:Ll}};var r=n.statusCode;if(r!==200||!n.json){var a="Surveys API could not be loaded, status: "+r;return r!==0?kt.error(a):n.error||kt.warn(a),this.Au=Date.now(),{surveys:[],context:{isLoaded:!1,error:a}}}this.Au=null;var o,u=n.json.surveys||[],d=u.filter((f=>(function(p){return!(!p.start_date||p.end_date)})(f)&&(lk(f)||(function(p){var m;return!((m=p.conditions)==null||(m=m.actions)==null||(m=m.values)==null||!m.length)})(f))));return d.length>0&&((o=this._surveyEventReceiver)==null||o.register(d)),t.kv.set({[Ug]:u,[Sh]:Date.now()}),{surveys:u,context:{isLoaded:!0}}}ju(){return this.zu()&&!this.Pu&&!this.Uu()}zu(){var t,n,r=(t=(n=this.Ns)!==null&&n!==void 0?n:this.Lu)==null?void 0:t.kv.get(Sh);return an(r)&&Date.now()-r>3e5}Uu(){return an(this.Au)&&3e5>Date.now()-this.Au}markSurveyAsSeen(t,n){var r,a={id:t,current_iteration:(r=n==null?void 0:n.iteration)!==null&&r!==void 0?r:null};dk(a);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}}qu(t){for(var n of this.Ru)try{if(!t.isLoaded)return n([],t);this.getSurveys(n)}catch(r){kt.error("Error in survey callback",r)}}getActiveMatchingSurveys(t,n){if(n===void 0&&(n=!1),!Ye(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,n);kt.warn("init was not called")}Wu(t){var n=null;return this.getSurveys((r=>{var a;n=(a=r.find((o=>o.id===t)))!==null&&a!==void 0?a:null})),n}Vu(t){if(Ye(this._surveyManager))return{eligible:!1,reason:Ll};var n=typeof t=="string"?this.Wu(t):t;return n?this._surveyManager.checkSurveyEligibility(n):{eligible:!1,reason:"Survey not found"}}Gu(t){if(Ye(this._surveyManager))return{eligible:!1,reason:Ll};var n=typeof t=="string"?this.Wu(t):t;return n?this._surveyManager.checkSurveyRenderability(n):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(Ye(this._surveyManager))return kt.warn("init was not called"),{visible:!1,disabledReason:Ll};var n=this.Gu(t);return{visible:n.eligible,disabledReason:n.reason}}canRenderSurveyAsync(t,n){return Ye(this._surveyManager)?(kt.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Ll})):new Promise((r=>{this.getSurveys((a=>{var o,u=(o=a.find((f=>f.id===t)))!==null&&o!==void 0?o:null;if(u){var d=this.Gu(u);r({visible:d.eligible,disabledReason:d.reason})}else r({visible:!1,disabledReason:"Survey not found"})}),n)}))}renderSurvey(t,n,r){var a;if(Ye(this._surveyManager))kt.warn("init was not called");else{var o=typeof t=="string"?this.Wu(t):t;if(o!=null&&o.id)if(PE.includes(o.type)){var u=pe==null?void 0:pe.querySelector(n);if(u)if((a=o.appearance)!=null&&a.surveyPopupDelaySeconds){kt.info("Rendering survey "+o.id+" with delay of "+o.appearance.surveyPopupDelaySeconds+" seconds");var d=setTimeout((()=>{var f,p;this.Fu.delete(d),this.Os||(kt.info("Rendering survey "+o.id+" with delay of "+((f=o.appearance)==null?void 0:f.surveyPopupDelaySeconds)+" seconds"),(p=this._surveyManager)==null||p.renderSurvey(o,u,r),kt.info("Survey "+o.id+" rendered"))}),1e3*o.appearance.surveyPopupDelaySeconds);this.Fu.add(d)}else this._surveyManager.renderSurvey(o,u,r);else kt.warn("Survey element not found")}else kt.warn("Surveys of type "+o.type+" cannot be rendered in the app");else kt.warn("Survey not found")}}displaySurvey(t,n){var r;if(Ye(this._surveyManager))kt.warn("init was not called");else{var a=this.Wu(t);if(a){var o=a;if((r=a.appearance)!=null&&r.surveyPopupDelaySeconds&&n.ignoreDelay&&(o=de({},a,{appearance:de({},a.appearance,{surveyPopupDelaySeconds:0})})),n.displayType!==nx.Popover&&n.initialResponses&&kt.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),n.ignoreConditions===!1){var u=this.Vu(a);if(!u.eligible)return void kt.warn("Survey is not eligible to be displayed: ",u.reason)}n.displayType!==nx.Inline?this._surveyManager.handlePopoverSurvey(o,n):this.renderSurvey(o,n.selector,n.properties)}else kt.warn("Survey not found")}}cancelPendingSurvey(t){Ye(this._surveyManager)?kt.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;(t=this._surveyManager)==null||t.handlePageUnload==null||t.handlePageUnload()}}function Ol(e,t,n){if(Ye(e))return!1;switch(n){case"exact":return e===t;case"contains":var r=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch{return!1}default:return!1}}class l6{constructor(t){this.Zu=new Set,this.Qu=new Set,this.Ju=new Dh,this.Ku=(n,r)=>this.Yu(n,r)&&this.Xu(n,r)&&this.th(n,r)&&this.eh(n,r),this.Yu=(n,r)=>r==null||!r.event||(n==null?void 0:n.event)===(r==null?void 0:r.event),this._instance=t}init(){var t,n;ce((t=this._instance)==null?void 0:t._addCaptureHook)||(this.ih=(n=this._instance)==null?void 0:n._addCaptureHook(((r,a)=>{this.on(r,a)})))}dispose(){var t;(t=this.ih)==null||t.call(this),this.ih=void 0,this.Ju=new Dh}register(t){var n,r;if(!ce((n=this._instance)==null?void 0:n._addCaptureHook)&&(t.forEach((o=>{var u;this.Zu.add(o),(u=o.steps)==null||u.forEach((d=>{this.Qu.add((d==null?void 0:d.event)||"")}))})),(r=this._instance)!=null&&r.autocapture)){var a=new Set;this.Zu.forEach((o=>{var u;(u=o.steps)==null||u.forEach((d=>{d!=null&&d.selector&&a.add(d.selector)}))})),this._instance.autocapture.setElementSelectors(a)}}replace(t){this.Zu.clear(),this.Qu.clear(),this.register(t)}on(t,n){n!=null&&t.length!=0&&(this.Qu.has(t)||this.Qu.has(n.event))&&this.Zu.forEach((r=>{this.rh(n,r)&&this.Ju.emit("actionCaptured",r.name)}))}nh(t){this.onAction("actionCaptured",(n=>t(n)))}rh(t,n){if((n==null?void 0:n.steps)==null)return!1;for(var r of n.steps)if(this.Ku(t,r))return!0;return!1}onAction(t,n){return this.Ju.on(t,n)}Xu(t,n){if(n!=null&&n.url){var r,a=t==null||(r=t.properties)==null?void 0:r.$current_url;if(!a||typeof a!="string"||!Ol(a,n.url,n.url_matching||"contains"))return!1}return!0}th(t,n){return!!this.sh(t,n)&&!!this.oh(t,n)&&!!this.ah(t,n)}sh(t,n){var r;if(n==null||!n.href)return!0;var a=this.lh(t);if(a.length>0)return a.some((d=>Ol(d.href,n.href,n.href_matching||"exact")));var o,u=(t==null||(r=t.properties)==null?void 0:r.$elements_chain)||"";return!!u&&Ol((o=u.match(/(?::|")href="(.*?)"/))?o[1]:"",n.href,n.href_matching||"exact")}oh(t,n){var r;if(n==null||!n.text)return!0;var a=this.lh(t);if(a.length>0)return a.some((p=>Ol(p.text,n.text,n.text_matching||"exact")||Ol(p.$el_text,n.text,n.text_matching||"exact")));var o,u,d,f=(t==null||(r=t.properties)==null?void 0:r.$elements_chain)||"";return!!f&&(o=(function(p){for(var m,x=[],b=/(?::|")text="(.*?)"/g;!Ye(m=b.exec(p));)x.includes(m[1])||x.push(m[1]);return x})(f),u=n.text,d=n.text_matching||"exact",o.some((p=>Ol(p,u,d))))}ah(t,n){var r,a;if(n==null||!n.selector)return!0;var o=t==null||(r=t.properties)==null?void 0:r.$element_selectors;if(o!=null&&o.includes(n.selector))return!0;var u=(t==null||(a=t.properties)==null?void 0:a.$elements_chain)||"";if(n.selector_regex&&u)try{return new RegExp(n.selector_regex).test(u)}catch{return!1}return!1}lh(t){var n;return(t==null||(n=t.properties)==null?void 0:n.$elements)==null?[]:t==null?void 0:t.properties.$elements}eh(t,n){return n==null||!n.properties||n.properties.length===0||ck(n.properties.reduce(((r,a)=>{var o=Pe(a.value)?a.value.map(String):a.value!=null?[String(a.value)]:[];return r[a.key]={values:o,operator:a.operator||"exact"},r}),{}),t==null?void 0:t.properties)}}class o6{constructor(t){var n;this.uh=[],this._instance=t,this.hh=new Map,this.dh=new Map,this.fh=new Map,this.ph=(n=this._instance)==null||n.onSessionId==null?void 0:n.onSessionId((r=>this.gh(r)))}mh(t){return!1}yh(){return null}bh(t){}_h(){}wh(t,n){return!!t&&ck(t.propertyFilters,n==null?void 0:n.properties)}kh(t,n){var r=new Map;return t.forEach((a=>{var o;(o=a.conditions)==null||(o=o[n])==null||(o=o.values)==null||o.forEach((u=>{if(u!=null&&u.name){var d=r.get(u.name)||[];d.push(a.id),r.set(u.name,d)}}))})),r}Sh(t,n,r){var a=(r===hc.Activation?this.hh:this.dh).get(t),o=[];return this.xh((u=>{o=u.filter((d=>a==null?void 0:a.includes(d.id)))})),o.filter((u=>{var d,f=(d=u.conditions)==null||(d=d[r])==null||(d=d.values)==null?void 0:d.find((p=>p.name===t));return this.wh(f,n)}))}register(t){this.Ch(t,!1)}replace(t){this.Ch(t,!0)}Ch(t,n){var r;ce((r=this._instance)==null?void 0:r._addCaptureHook)||(this.Th(t,n),this.Mh(t,n))}Mh(t,n){var r=t.filter((u=>{var d;return(d=u.conditions)==null||(d=d.actions)==null||(d=d.values)==null?void 0:d.length}));if(n&&this.fh.clear(),r.length!==0){this.Ih||(this.Ih=new l6(this._instance),this.Ih.init(),this.Ih.nh((u=>this.onAction(u))));var a=[];r.forEach((u=>{var d;(d=u.conditions)==null||(d=d.actions)==null||d.values.forEach((f=>{if(a.push(f),f.name){var p,m=(p=this.fh.get(f.name))!==null&&p!==void 0?p:[];m.includes(u.id)||m.push(u.id),this.fh.set(f.name,m)}}))})),n?this.Ih.replace(a):this.Ih.register(a)}else{var o;n&&((o=this.Ih)==null||o.replace([]))}}Eh(t,n){n.forEach(((r,a)=>{var o,u=(o=t.get(a))!==null&&o!==void 0?o:[];r.forEach((d=>{u.includes(d)||u.push(d)})),t.set(a,u)}))}Th(t,n){var r,a,o=t.filter((p=>{var m,x;return((m=p.conditions)==null?void 0:m.events)&&((x=p.conditions)==null||(x=x.events)==null||(x=x.values)==null?void 0:x.length)>0})),u=t.filter((p=>{var m,x;return((m=p.conditions)==null?void 0:m.cancelEvents)&&((x=p.conditions)==null||(x=x.cancelEvents)==null||(x=x.values)==null?void 0:x.length)>0})),d=this.kh(t,hc.Activation),f=this.kh(t,hc.Cancellation);n?(this.hh=d,this.dh=f):(this.Eh(this.hh,d),this.Eh(this.dh,f)),(o.length!==0||u.length!==0)&&((r=this.ih)!==null&&r!==void 0||(this.ih=(a=this._instance)==null?void 0:a._addCaptureHook(((p,m)=>{this.onEvent(p,m)}))))}onEvent(t,n){var r,a,o=this.Rh(),u=(n==null||(r=n.properties)==null?void 0:r.$survey_id)||(n==null||(a=n.properties)==null?void 0:a.$product_tour_id);if(u&&this.getActivatedIds().includes(u)){var d=this.Ph(t,u);if(d==="consume")return o.info("event consumed activated item, removing it",{event:t,itemId:u}),void this.Ah([u]);if(d==="persist")return o.info("shown item promoted to persisted activation",{event:t,itemId:u}),this.Fh(u),void this.Oh([u])}if(this.dh.has(t)){var f=this.Sh(t,n,hc.Cancellation);f.length>0&&(o.info("cancel event matched, cancelling items",{event:t,itemsToCancel:f.map((m=>m.id))}),this.Ah(f.map((m=>m.id))),f.forEach((m=>this.Lh(m.id))))}if(this.hh.has(t)){o.info("event name matched",{event:t,eventPayload:n,items:this.hh.get(t)});var p=this.Sh(t,n,hc.Activation);this.Dh(p.map((m=>m.id)))}}onAction(t){this.fh.has(t)&&this.Dh(this.fh.get(t)||[])}Dh(t){var n;if(t.length!==0){var r=!((n=this._instance)==null||n.get_session_id==null||!n.get_session_id()),a=[];for(var o of t)r&&this.mh(o)?this.Fh(o)&&this.$h(o):a.push(o);a.length>0&&(this.uh=[...new Set([...this.uh,...a])]),this.Rh().info("updating activated items",{activatedItems:this.getActivatedIds()})}}Fh(t){this.uh=this.uh.filter((r=>r!==t));var n=this.Nh();return!n.includes(t)&&(this.qh([...n,t]),this.jh(),!0)}Ah(t){var n=new Set(t);this.uh=this.uh.filter((o=>!n.has(o)));var r=this.Bh(),a=r.filter((o=>!n.has(o)));a.length!==r.length&&(this.qh(a),a.length===0&&this.Hh()),this.Oh(t)}zh(){var t,n=this.yh();if(!n)return{};var r=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[n];return r&&typeof r=="object"?r:{}}$h(t){if(this.yh()){var n=this.zh();this.bh(de({},n,{[t]:Date.now()}))}}Oh(t){if(this.yh()){var n=this.zh(),r={},a=!1;for(var o of Object.entries(n)){var u=o[0],d=o[1];t.includes(u)?a=!0:r[u]=d}a&&(Nr(r)?this._h():this.bh(r))}}Uh(){this.yh()&&this._h()}getActivationTimestamp(t){if(this.Nh().includes(t)){var n=this.zh()[t];return an(n)?n:void 0}}Bh(){var t,n=this.Wh();return((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[n])||[]}Nh(){var t,n,r=this.Bh();if(r.length===0)return[];var a=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[this.Vh()],o=(n=this._instance)==null||n.get_session_id==null?void 0:n.get_session_id();return o&&a===o?r:[]}jh(){var t,n=(t=this._instance)==null||t.get_session_id==null?void 0:t.get_session_id();n&&this.Gh(n)}Hh(){this.Zh()}gh(t){var n,r=(n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[this.Vh()];if(r&&r!==t){var a=this.Bh(),o=this.zh();a.length>0&&(this.qh([]),a.filter((u=>an(o[u]))).forEach((u=>this.Lh(u)))),this.Hh(),this.Uh()}}getActivatedIds(){return[...new Set([...this.Nh(),...this.uh])].filter((t=>!this.Qh(t)))}dispose(){var t,n,r;(t=this.ph)==null||t.call(this),this.ph=void 0,(n=this.ih)==null||n.call(this),this.ih=void 0,(r=this.Ih)==null||r.dispose(),this.Ih=void 0}reset(){this.uh=[],this.Bh().length>0&&this.qh([]),this.Hh(),this.Uh()}getEventToItemsMap(){return this.hh}Jh(){return this.Ih}}class c6 extends o6{constructor(t){super(t)}Wh(){return Ig}Vh(){return th}yh(){return nh}bh(t){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[nh]:t})}_h(){var t;(t=this._instance)==null||(t=t.persistence)==null||t.unregister(nh)}mh(t){var n,r;this.xh((o=>{r=o.find((u=>u.id===t))}));var a=(n=r)==null||(n=n.appearance)==null?void 0:n.surveyPopupDelaySeconds;return an(a)&&a>0}Kh(){return ti.SHOWN}xh(t){var n;(n=this._instance)==null||n.getSurveys(t)}Lh(t){var n;(n=this._instance)==null||n.cancelPendingSurvey(t)}Rh(){return kt}qh(t){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[Ig]:t})}Gh(t){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[th]:t})}Zh(){var t;(t=this._instance)==null||(t=t.persistence)==null||t.unregister(th)}Qh(){return!1}Ph(t,n){var r;this.xh((o=>{r=o.find((u=>u.id===n))}));var a=!r||(function(o){var u;return lk(o)&&!((u=o.conditions)==null||(u=u.events)==null||!u.repeatedActivation)||o.schedule==="always"})(r);return a?t===ti.SHOWN?"consume":"ignore":t===ti.SHOWN?"persist":t===ti.DISMISSED||t===ti.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}class u6{constructor(t){this._instance=t}initialize(){}get(t){if(typeof t=="string")return this._instance.get_property(t);var n={};for(var r of t){var a=this._instance.get_property(r);ce(a)||(n[r]=a)}return n}set(t,n){this._instance.register(typeof t=="string"?{[t]:n}:t)}remove(t){typeof t!="string"?t.forEach((n=>this._instance.unregister(n))):this._instance.unregister(t)}}class d6{constructor(t){this._instance=t}get(){var t=this._instance.config;return{disableSurveys:t.disable_surveys,cookielessMode:!!t.cookieless_mode,advancedEnableSurveys:t.advanced_enable_surveys,requestTimeoutMs:t.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}getExtensions(){var t=De==null?void 0:De.__PosthogExtensions__;if(t){var n=t.generateSurveys,r=t.loadExternalDependency;return{generateSurveys:n?a=>n(this._instance,a):void 0,loadExternalDependency:r?a=>r(this._instance,"surveys",a):void 0}}}createEventReceiver(){return new c6(this._instance)}}var h6=te!=null&&te.location?Th(te.location.hash,"__posthog")||Th(location.hash,"state"):null,B_="_postHogToolbarParams",P_=Gt("[Toolbar]"),$_=Gt("[FeatureFlags]");class f6{constructor(t,n){n===void 0&&(n=!1),this.Yh=!1,this.update(t,n)}update(t,n){this.Xh=((r,a)=>{var o,u,d,f,p;return{bootstrap:{featureFlags:(o=r.bootstrap)==null?void 0:o.featureFlags,featureFlagPayloads:(u=r.bootstrap)==null?void 0:u.featureFlagPayloads},remoteRequestsDisabled:a,featureFlagsDisabled:!!r.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!r.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!r.advanced_feature_flags_dedup_per_session,cacheTtlMs:r.feature_flag_cache_ttl_ms,refreshIntervalMs:(d=r.remote_config_refresh_interval_ms)!==null&&d!==void 0?d:3e5,requestTimeoutMs:r.feature_flag_request_timeout_ms,compression:r.disable_compression?void 0:"best-available",evaluationContexts:(f=(p=r.evaluation_contexts)!==null&&p!==void 0?p:r.evaluation_environments)!==null&&f!==void 0?f:[],flagKeys:Pe(r.flag_keys)?r.flag_keys:void 0}})(t,n),!t.evaluation_environments||t.evaluation_contexts||this.Yh||($_.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Yh=!0),ce(t.flag_keys)||Pe(t.flag_keys)||$_.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.Xh}}var F_=Gt("[FeatureFlags]"),ja=Gt("[FeatureFlags]",{debugEnabled:!0}),Im=`" failed. Feature flags didn't load in time.`,U_="connection_error",I_=e=>{for(var t={},n=0;e.length>n;n++)t[e[n]]=!0;return t},H_=e=>{var t={};for(var n of rh(e||{})){var r=n[1];r&&(t[n[0]]=r)}return t},q_=e=>Ax(e)&&(e.name==="RangeError"&&e.message.indexOf("Maximum call stack size exceeded")===0||e.name==="InternalError"&&e.message==="too much recursion"),ss=Gt("[Error tracking]"),ux="webkit-masked-url:",p6=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",ux],m6=["__firefox__","__gCrWeb"],V_="Refusing to render web experiment since the viewer is a likely bot",g6={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>Lh(t,e),not_regex:(e,t)=>!Lh(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e};class Un{get mn(){return this._instance.config}constructor(t){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(r){r===void 0&&(r=!1),n.getWebExperiments((a=>{Un.td("retrieved web experiments from the server"),n.ed=new Map,a.forEach((o=>{if(o.feature_flag_key){var u;n.ed&&(Un.td("setting flag key ",o.feature_flag_key," to web experiment ",o),(u=n.ed)==null||u.set(o.feature_flag_key,o));var d=n._instance.getFeatureFlag(o.feature_flag_key);at(d)&&o.variants[d]&&n.rd(o.name,d,o.variants[d].transforms)}else if(o.variants)for(var f in o.variants){var p=o.variants[f];Un.nd(p,n._instance)&&n.rd(o.name,f,p.transforms)}}))}),r)},this._instance=t,this._instance.onFeatureFlags((r=>{this.onFeatureFlags(r)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())Un.td(V_);else if(!this.mn.disable_web_experiments){if(Ye(this.ed))return this.ed=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Un.td("applying feature flags",t),t.forEach((n=>{var r;if(this.ed&&(r=this.ed)!=null&&r.has(n)){var a,o=this._instance.getFeatureFlag(n),u=(a=this.ed)==null?void 0:a.get(n);o&&u!=null&&u.variants[o]&&this.rd(u.name,o,u.variants[o].transforms)}}))}}previewWebExperiment(){var t=Un.getWindowLocation();if(t!=null&&t.search){var n=no(t==null?void 0:t.search,"__experiment_id"),r=no(t==null?void 0:t.search,"__experiment_variant");n&&r&&(Un.td("previewing web experiments "+n+" && "+r),this.getWebExperiments((a=>{this.sd(parseInt(n),r,a)}),!1,!0))}}loadIfEnabled(){this.mn.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,n,r){if(this.mn.disable_web_experiments&&!r)return t([]);var 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.mn.token),method:"GET",timestampMode:"query",callback:o=>t(o.statusCode===200&&o.json&&o.json.experiments||[])})}sd(t,n,r){var a=r.filter((o=>o.id===t));a&&a.length>0&&(Un.td("Previewing web experiment ["+a[0].name+"] with variant ["+n+"]"),this.rd(a[0].name,n,a[0].variants[n].transforms))}static nd(t,n){return!Ye(t.conditions)&&Un.od(t,n)&&Un.ad(t)}static od(t,n){var r;if(Ye(t.conditions)||Ye((r=t.conditions)==null?void 0:r.url))return!0;var a=Un.getWindowLocation();if(a){var o,u,d,f=S2(n,a.href);return(o=t.conditions)==null||!o.url||g6[(u=(d=t.conditions)==null?void 0:d.urlMatchType)!==null&&u!==void 0?u:"icontains"](t.conditions.url,f)}return!1}static getWindowLocation(){return te==null?void 0:te.location}static ad(t){var n;if(Ye(t.conditions)||Ye((n=t.conditions)==null?void 0:n.utm))return!0;var r=F2();if(r.utm_source){var a,o,u,d,f,p,m,x,b=(a=t.conditions)==null||(a=a.utm)==null||!a.utm_campaign||((o=t.conditions)==null||(o=o.utm)==null?void 0:o.utm_campaign)==r.utm_campaign,y=(u=t.conditions)==null||(u=u.utm)==null||!u.utm_source||((d=t.conditions)==null||(d=d.utm)==null?void 0:d.utm_source)==r.utm_source,_=(f=t.conditions)==null||(f=f.utm)==null||!f.utm_medium||((p=t.conditions)==null||(p=p.utm)==null?void 0:p.utm_medium)==r.utm_medium,j=(m=t.conditions)==null||(m=m.utm)==null||!m.utm_term||((x=t.conditions)==null||(x=x.utm)==null?void 0:x.utm_term)==r.utm_term;return b&&_&&j&&y}return!1}static td(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;n>a;a++)r[a-1]=arguments[a];ye.info("[WebExperiments] "+t,r)}rd(t,n,r){this._is_bot()?Un.td(V_):n!=="control"?r.forEach((a=>{if(a.selector){var o;Un.td("applying transform of variant "+n+" for experiment "+t+" ",a);var u=(o=document)==null?void 0:o.querySelectorAll(a.selector);u==null||u.forEach((d=>{var f=d;a.html&&(f.innerHTML=a.html),a.css&&f.setAttribute("style",a.css)}))}})):Un.td("Control variants leave the page unmodified.")}_is_bot(){return Nn&&this._instance?ik(Nn,this.mn.custom_blocked_useragents):void 0}}var qr=Gt("[Conversations]"),Na="Conversations not available yet.";function G_(e,t){var n,r,a,o,u,d,f,p=(n=e==null?void 0:e.flushIntervalMs)!==null&&n!==void 0?n:3e3,m=(r=e==null?void 0:e.maxBufferSize)!==null&&r!==void 0?r:100,x=t!=null&&t.consoleCapture?void 0:(a=e==null?void 0:e.maxLogsPerInterval)!==null&&a!==void 0?a:1e3,b=ce(x)?Math.max(m,2048):Math.max(m,x),y=de({},(function(){var _="",j="";try{var N=Nn==null?void 0:Nn.userAgent;if(N){var w=Jw(N);_=w[0],j=w[1]}}catch{}return(function(E,C){var T=(function(O){if(O)return{}.hasOwnProperty.call(Vy,O)?Vy[O]:O})(E);return de({},T?{"os.name":T}:{},C?{"os.version":C}:{})})(_,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:(d=y==null?void 0:y["service.version"])!==null&&d!==void 0?d: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:p,maxBufferSize:m,maxQueueSize:b,maxBatchRecordsPerPost:100,rateCapWindowMs:p,maxLogsPerInterval:x,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}var x6=["debug","log","warn","error","info"],Y_="console",xk="__posthogHandledLogsRequestError",Hm=(e,t)=>{var n=e instanceof Error?e:new Error(t);return n[xk]=!0,n},W_=e=>!!e&&typeof e=="object"&&e[xk]===!0,Yh={featureFlags:class{constructor(e){this.name="featureFlags",this.ld=!1,this.featureFlagEventHandlers=[],this.A=F_,this.ud={},this.hd={},this.dd=[],this.vd=!1,this.fd=!1,this.pd=0,this.gd=!1,this.md=!1,this.yd=!1,this.bd=!1,this._d=0,this.We=()=>{var t=this.wd();this._d=0,t&&this.reloadFeatureFlags()},this.kd=()=>{var t,n=this.Sd;ce(n)||this.mn.remoteRequestsDisabled||!pe||pe.visibilityState==="hidden"||Date.now()-((t=this.xd)!==null&&t!==void 0?t:0)<n||(this.reloadFeatureFlags(),this.Cd())},this.Ve=()=>{(pe==null?void 0:pe.visibilityState)==="visible"&&this.kd()},"get"in e?this.Ls=e:(this._instance=e,this.Td=new f6(e.config,e.pa()),this.Ls=this.Td)}updateConfig(e,t){var n;(n=this.Td)==null||n.update(e,t),this.Ns&&this.Md()}setup(e){return this.Du=e,this.A=e.logger.createLogger("[FeatureFlags]"),gk(e.kv.initialize(),(()=>{this.Du===e&&(this.Du=void 0,this.Ns=e,this.Id(e))}))}Id(e){var t;if(this.Ns===e)return te&&Dt(te,"online",this.We),this.Md(),this.Ed=e.registerDynamicEventProperties((()=>this.Rd()?this.ud:this.hd)),this.Pd=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.onCrossTabFeatureFlagChange((()=>{this.Ad(),this.Fd(),this.Od()})),this.Fd(),this.initialize()}Md(){var e=this.mn.refreshIntervalMs,t=!this.mn.remoteRequestsDisabled&&pe&&!ce(e)&&e>0?e:void 0;t!==this.Sd&&(this.Ld(),ce(t)||(this.Sd=t,this.Cd(),pe!=null&&pe.addEventListener&&Dt(pe,eo,this.Ve)))}Cd(){ce(this.Sd)||(ce(this.Dd)||clearInterval(this.Dd),this.xd=Date.now(),this.Dd=setInterval(this.kd,this.Sd))}Ld(){ce(this.Dd)||(clearInterval(this.Dd),this.Dd=void 0,pe==null||pe.removeEventListener==null||pe.removeEventListener(eo,this.Ve)),this.Sd=void 0,this.xd=void 0}destroy(){this.$d()}dispose(){this.$d()}$d(){var e,t;this.Ld(),this.pd++,this.md=!1,this.Du=void 0,this.Ns&&(this.Nd(),(e=this.Ed)==null||e.dispose(),this.Ed=void 0,(t=this.Pd)==null||t.call(this),this.Pd=void 0,this.dd=[],te==null||te.removeEventListener("online",this.We),this.Ns=void 0)}get mn(){return this.Ls.get()}qd(e){var t;return this.jd&&e in this.jd?this.jd[e]:(t=this.Ns)==null?void 0:t.kv.get(e)}Ad(){return!!this.jd&&(this.jd=void 0,!0)}Bd(){var e;return!ce((e=this.Ns)==null?void 0:e.kv.get(On))&&this.Ad()}ni(e){this.Hd((()=>{var t;return(t=this.Ns)==null?void 0:t.kv.set(e)}))}zd(e,t,n){var r;if((r=this._instance)!=null&&r.persistence&&e[On]){var a=this.qd(On)||{},o=e[On]||{},u=t.flags||t.featureFlags,d=t.flags?Object.entries(t.flags).filter((w=>{var E=w[1];return!(E!=null&&E.failed)})).map((w=>w[0])):[],f=!!t.errorsWhileComputingFlags&&!!t.flags,p=f?d:n&&!Pe(u)?Object.keys(u||{}):Array.from(new Set([...Object.keys(a),...Object.keys(o)])),m=this.qd(is)||{},x=e[is]||{},b=f||n?p:Array.from(new Set([...Object.keys(m),...Object.keys(x)])),y=!f&&!n,_=!!y||p,j={[Yr]:_,[On]:_,[is]:!!y||b};for(var N of(e[qi]&&(j[qi]=_),[Vi,ri,Wl]))ce(e[N])||(j[N]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(j)}}oi(e){this.Hd((()=>{var t;return(t=this.Ns)==null?void 0:t.kv.remove(e)}))}Hd(e){try{e()}catch(t){this.A.error("Failed to update feature flag persistence",t)}}Fd(){var e={};for(var t of[Yr,is,Vi,_s]){var n=this.qd(t);ce(n)||(e[t]=n)}this.ud=e;var r=de({},e),a=this.qd(On);if(a)for(var o of Object.entries(a))r["$feature/"+o[0]]=o[1];this.hd=r}Rd(){var e=this.mn.cacheTtlMs;if(!e||0>=e)return!1;var t=this.qd(ri);return typeof t!="number"||Date.now()-t>e}Ud(){return!!this.Rd()&&(this.bd||this.fd||(this.bd=!0,this.A.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Wd(){var e=this.mn.evaluationContexts;return e!=null&&e.length?e.filter((t=>{var n=t&&typeof t=="string"&&t.trim().length>0;return n||this.A.error("Invalid evaluation context found:",t,"Expected non-empty string"),n})):[]}Vd(){var e=this.mn.flagKeys;if(!ce(e))return e.filter((t=>{var n=t&&typeof t=="string"&&t.trim().length>0;return n||this.A.error("Invalid flag key found:",t,"Expected non-empty string"),n}))}initialize(){var e,t,n=this.mn,r=(e=(t=n.bootstrap)==null?void 0:t.featureFlags)!==null&&e!==void 0?e:{};if(Object.keys(r).length){var a,o,u=(a=(o=n.bootstrap)==null?void 0:o.featureFlagPayloads)!==null&&a!==void 0?a:{},d=Object.keys(r).filter((p=>!ce(r[p]))).reduce(((p,m)=>(p[m]=r[m],p)),{}),f=Object.keys(u).filter((p=>d[p])).reduce(((p,m)=>(p[m]=u[m],p)),{});return this.Gd({featureFlags:d,featureFlagPayloads:f},void 0,{persist:!1})}}updateFlags(e,t,n){var r,a,o=n!=null&&n.merge&&(r=this.qd(On))!==null&&r!==void 0?r:{},u=n!=null&&n.merge&&(a=this.qd(is))!==null&&a!==void 0?a:{},d=de({},o,e),f=de({},u,t),p={};for(var m of Object.entries(d)){var x=m[0],b=m[1];p[x]={key:x,enabled:Fy(b),variant:Uy(b),reason:void 0,metadata:ce(f==null?void 0:f[x])?void 0:{id:0,version:void 0,description:void 0,payload:f[x]}}}this.Gd({flags:p})}get hasLoadedFlags(){return this.vd}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this.qd(qi),t=this.qd(_s),n=this.qd(Ta);if(!n&&!t)return e||{};var r=$t({},e||{}),a=[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])];for(var o of a){var u,d,f=r[o],p=t==null?void 0:t[o],m=ce(p)?(u=f==null?void 0:f.enabled)!==null&&u!==void 0&&u:!!p,x=ce(p)?f==null?void 0:f.variant:typeof p=="string"?p:void 0,b=n==null?void 0:n[o],y=de({},f,{enabled:m,variant:m?x??(f==null?void 0:f.variant):void 0});m!==(f==null?void 0:f.enabled)&&(y.original_enabled=f==null?void 0:f.enabled),x!==(f==null?void 0:f.variant)&&(y.original_variant=f==null?void 0:f.variant),b&&(y.metadata=de({},f==null?void 0:f.metadata,{payload:b,original_payload:f==null||(d=f.metadata)==null?void 0:d.payload})),r[o]=y}return this.ld||(this.A.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:r}),this.ld=!0),r}getAllFeatureFlags(){var e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map((n=>{var r=e[n];return{key:n,enabled:Fy(r),variant:Uy(r),payload:$y(t[n])}}))}getFlagVariants(){var e=this.qd(On),t=this.qd(_s);if(!t)return e||{};for(var n=$t({},e||{}),r=Object.keys(t),a=0;r.length>a;a++)n[r[a]]=t[r[a]];return this.ld||(this.A.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.ld=!0),n}getFlagPayloads(){var e=this.qd(is),t=this.qd(Ta);if(!t)return e||{};for(var n=$t({},e||{}),r=Object.keys(t),a=0;r.length>a;a++)n[r[a]]=t[r[a]];return this.ld||(this.A.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),this.ld=!0),n}reloadFeatureFlags(){this.gd||this.mn.featureFlagsDisabled||this.wd()||(this.fd&&(this.md=!0),this.Zd||(this.dd.slice().forEach((e=>{try{e()}catch(t){this.A.error("Error while running feature flags reloading callback",t)}})),this.Zd=setTimeout((()=>{this.Qd()}),5)))}Nd(){clearTimeout(this.Zd),this.Zd=void 0}onReloading(e){return this.dd.push(e),()=>{this.dd=this.dd.filter((t=>t!==e))}}ensureFlagsLoaded(){this.vd||this.fd||this.Zd||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.gd=e}resetFlagCallReported(){this.oi(Js)}Qd(e){this.Nd();var t=this.Ns;if(t&&!this.mn.remoteRequestsDisabled&&!this.wd())if(this.fd)this.md=!0;else{var n={token:t.projectToken,distinct_id:t.distinctId,groups:t.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:de({},t.initialPersonProperties,this.qd(kr)||{},{$lib:t.library.name,$lib_version:t.library.version}),group_properties:this.qd(Ss),timezone:G2()};ce(t.deviceId)||(n.$device_id=t.deviceId),(e!=null&&e.disableFlags||this.mn.featureFlagsDisabled)&&(n.disable_flags=!0);var r=this.Wd();r.length&&(n.evaluation_contexts=r);var a=this.Vd();ce(a)||(n.flag_keys=a);var o=this.mn.onlyEvaluateSurveyFeatureFlags,u="/flags/?v=2"+(o?"&only_evaluate_survey_feature_flags=true":""),d=this.pd;this.fd=!0;var f=()=>{this.md&&(this.md=!1,this.Qd())},p=m=>{this.fd=!1,d===this.pd&&(this.ni({[Ql]:[U_]}),this.A.error("Feature flag request failed",m),this.Bd()&&this.Od(!0)),f()};try{t.sendRequest(u,{target:"flags",method:"POST",body:n,compression:this.mn.compression,sentAt:"body",timeoutMs:this.mn.requestTimeoutMs}).then((m=>{var x,b,y=(x=m.json)!==null&&x!==void 0?x:{},_=m.statusCode!==200;if(this.fd=!1,d===this.pd){if(this.Jd(m.statusCode),_||this.md||(this.$anon_distinct_id=void 0),!n.disable_flags||this.md){this.yd=!_;var j=[];m.error?j.push(m.error instanceof Error&&m.error.name==="AbortError"?"timeout":m.error instanceof Error?U_:"unknown_error"):m.statusCode!==200&&j.push("api_error_"+m.statusCode),y.errorsWhileComputingFlags&&j.push("errors_while_computing_flags");var N=!((b=y.quotaLimited)==null||!b.includes("feature_flags"));N&&j.push("quota_limited"),this.ni({[Ql]:j}),N?this.A.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):n.disable_flags||this.Gd(y,_,{partialResponse:o}),f()}}else f()})).catch(p)}catch(m){p(m)}}}wd(){return P2(this._d,3)}Jd(e){this._d=$2(e,this._d,3,(()=>this.A.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes.")))}getFeatureFlag(e,t){var n;if(t===void 0&&(t={}),!t.fresh||this.yd)if(this.vd||this.getFlags()&&this.getFlags().length>0){if(!this.Ud()){var r=this.getFeatureFlagResult(e,t);return(n=r==null?void 0:r.variant)!==null&&n!==void 0?n:r==null?void 0:r.enabled}}else this.A.warn('getFeatureFlag for key "'+e+Im)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return t==null?void 0:t.payload}getFeatureFlagResult(e,t){if(t===void 0&&(t={}),!t.fresh||this.yd)if(this.vd||this.getFlags()&&this.getFlags().length>0){if(!this.Ud()){var n,r=this.getFlagVariants(),a=e in r,o=r[e],u=this.getFlagPayloads()[e],d=String(o),f=this.qd(Vi)||void 0,p=this.qd(ri)||void 0,m=this.qd(Js)||{};if(this.mn.deduplicateCallsPerSession){var x,b=(x=this.Ns)==null?void 0:x.session.sessionId,y=this.qd(Cc);b&&b!==y&&(m={},n=b)}if(t.send_event||!("send_event"in t))if(e in m&&m[e].includes(d))n&&this.ni({[Js]:m,[Cc]:n});else{var _,j,N,w,E,C,T,O,z,I,U,Z;Pe(m[e])?m[e].push(d):m[e]=[d],this.ni(de({[Js]:m},n?{[Cc]:n}:{}));var L=this.getFeatureFlagDetails(e),q=[...(_=this.qd(Ql))!==null&&_!==void 0?_:[]];ce(o)&&q.push("flag_missing");var M={$feature_flag:e,$feature_flag_response:o,$feature_flag_payload:u??null,$feature_flag_request_id:f,$feature_flag_evaluated_at:p,$feature_flag_bootstrapped_response:(j=(N=this.mn.bootstrap)==null||(N=N.featureFlags)==null?void 0:N[e])!==null&&j!==void 0?j:null,$feature_flag_bootstrapped_payload:(w=(E=this.mn.bootstrap)==null||(E=E.featureFlagPayloads)==null?void 0:E[e])!==null&&w!==void 0?w:null,$used_bootstrap_value:!this.yd};ce(L==null||(C=L.metadata)==null?void 0:C.has_experiment)||(M.$feature_flag_has_experiment=L.metadata.has_experiment),ce(L==null||(T=L.metadata)==null?void 0:T.version)||(M.$feature_flag_version=L.metadata.version);var ie,X=(O=L==null||(z=L.reason)==null?void 0:z.description)!==null&&O!==void 0?O:L==null||(I=L.reason)==null?void 0:I.code;X&&(M.$feature_flag_reason=X),L!=null&&(U=L.metadata)!=null&&U.id&&(M.$feature_flag_id=L.metadata.id),ce(L==null?void 0:L.original_variant)&&ce(L==null?void 0:L.original_enabled)||(M.$feature_flag_original_response=ce(L.original_variant)?L.original_enabled:L.original_variant),L!=null&&(Z=L.metadata)!=null&&Z.original_payload&&(M.$feature_flag_original_payload=L==null||(ie=L.metadata)==null?void 0:ie.original_payload),q.length&&(M.$feature_flag_error=q.join(",")),this.Kd(M)}else n&&this.ni({[Js]:m,[Cc]:n});if(a)return{key:e,enabled:!!o,variant:typeof o=="string"?o:void 0,payload:$y(u)}}}else this.A.warn('getFeatureFlagResult for key "'+e+Im)}Kd(e){try{var t;(t=this.Ns)==null||t.capture("$feature_flag_called",e).catch((n=>{this.A.error("Failed to capture feature flag call",n)}))}catch(n){this.A.error("Failed to capture feature flag call",n)}}getRemoteConfigPayload(e,t){this.Yd(e,t)}Yd(e,t){var n=this;return Ft((function*(){var r=n.Ns;if(r){var a={distinct_id:r.distinctId,token:r.projectToken,person_properties:{$lib:r.library.name,$lib_version:r.library.version}},o=n.Wd();o.length&&(a.evaluation_contexts=o);var u,d=n.Vd();ce(d)||(a.flag_keys=d);try{var f,p=(f=(yield r.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:a,compression:n.mn.compression,sentAt:"body",timeoutMs:n.mn.requestTimeoutMs})).json)==null?void 0:f.featureFlagPayloads;u=(p==null?void 0:p[e])||void 0}catch(m){return void n.A.error("Remote config feature flag request failed",m)}try{t(u)}catch(m){n.A.error("Remote config feature flag callback failed",m)}}}))()}isFeatureEnabled(e,t){if(t===void 0&&(t={}),t.fresh&&!this.yd)return t.defaultValue;if(!(this.vd||this.getFlags()&&this.getFlags().length>0))return this.A.warn('isFeatureEnabled for key "'+e+Im),t.defaultValue;var n=this.getFeatureFlag(e,t);return ce(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.Gd(e,t,n)}Gd(e,t,n){if(this.Ns){this.vd=!0;var r=(function(o,u,d,f,p,m){u===void 0&&(u={}),d===void 0&&(d={}),f===void 0&&(f={}),m===void 0&&(m=F_);var x=((L,q)=>{var M=L.flags;return M?de({},L,{featureFlags:Object.fromEntries(Object.keys(M).map((ie=>{var X;return[ie,(X=M[ie].variant)!==null&&X!==void 0?X:M[ie].enabled]}))),featureFlagPayloads:Object.fromEntries(Object.keys(M).filter((ie=>M[ie].enabled)).filter((ie=>{var X;return!ce((X=M[ie].metadata)==null?void 0:X.payload)})).map((ie=>{var X;return[ie,(X=M[ie].metadata)==null?void 0:X.payload]})))}):(L.featureFlags&&q.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),L)})(o,m),b=x.flags,y=x.featureFlags,_=x.featureFlagPayloads;if(y){var j=o.requestId,N=o.evaluatedAt;if(Pe(y)){m.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var w={};if(y)for(var E=0;y.length>E;E++)w[y[E]]=!0;return{[Yr]:y,[On]:w,[Wl]:!1}}var C=y,T=_,O=b;if(p!=null&&p.partialResponse){var z=Object.keys(C),I=T||{};C=de({},u,C),T=de({},d,I),z.forEach((L=>{var q;L in I||(q=T)==null||delete q[L]})),O=de({},f,O)}else if(o.errorsWhileComputingFlags)if(b){var U=new Set(Object.keys(b).filter((L=>{var q;return!((q=b[L])!=null&&q.failed)})));C=de({},u,Object.fromEntries(Object.entries(C).filter((L=>U.has(L[0])))));var Z=Object.fromEntries(Object.entries(T||{}).filter((L=>U.has(L[0]))));T=de({},d,Z),U.forEach((L=>{var q;L in Z||(q=T)==null||delete q[L]})),O=de({},f,Object.fromEntries(Object.entries(O||{}).filter((L=>U.has(L[0])))))}else C=de({},u,C),T=de({},d,T),O=de({},f,O);return de({[Yr]:Object.keys(H_(C)),[On]:C||{},[is]:T||{},[qi]:O||{},[Wl]:o.minimalFlagCalledEvents===!0},j?{[Vi]:j}:{},N?{[ri]:N}:{})}})(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),n,this.A);if(r)if((n==null?void 0:n.persist)===!1){var a=!ce(this.Ns.kv.get(On));this.jd=r,a||this.ni(r)}else this.Ad(),this.zd(r,e,!(n==null||!n.partialResponse)),this.ni(r);else t&&this.Bd();t||(this.bd=!1),this.Od(t)}}override(e,t){t===void 0&&(t=!1),this.A.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){this.Xd(e)}Xd(e){if(this.Ns){if(e===!1)return this.oi([_s,Ta]),this.Od(),void ja.info("All overrides cleared");if(Pe(e))return this.ni({[_s]:I_(e)}),this.Od(),void ja.info("Flag overrides set",{flags:e});if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var t,n=e;this.ld=!!((t=n.suppressWarning)!==null&&t!==void 0&&t);var r={},a=n.flags,o=n.payloads;return a&&(r[_s]=Pe(a)?I_(a):a),o&&(r[Ta]=o),Object.keys(r).length&&this.ni(r),a===!1&&o===!1?this.oi([_s,Ta]):a===!1?this.oi(_s):o===!1&&this.oi(Ta),this.Od(),a===!1?ja.info("Flag overrides cleared"):a&&ja.info("Flag overrides set",{flags:a}),void(o===!1?ja.info("Payload overrides cleared"):o&&ja.info("Payload overrides set",{payloads:o}))}if(e&&typeof e=="object")return this.ni({[_s]:e}),this.Od(),void ja.info("Flag overrides set",{flags:e});this.A.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}else this.A.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.vd){var t=this.tv(),n=t.flags,r=t.flagVariants;try{e(n,r)}catch(a){this.A.error("Error while running feature flags callback",a)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,n){var r,a=(this.qd(eh)||[]).find((p=>p.flagKey===e)),o={["$feature_enrollment/"+e]:t},u={$feature_flag:e,$feature_enrollment:t,$set:o};a&&(u.$early_access_feature_name=a.name),n&&(u.$feature_enrollment_stage=n);var d=de({},this.getFlagVariants(),{[e]:t});(r=this._instance)==null||(r=r.persistence)==null||r.markCrossTabFeatureFlagChanges({[Yr]:[e],[On]:[e],[kr]:Object.keys(o)}),this.ni({[Yr]:Object.keys(H_(d)),[On]:d,[kr]:de({},this.qd(kr)||{},o)}),this.Od();try{var f;(f=this.Ns)==null||f.capture("$feature_enrollment_update",u).catch((p=>{this.A.error("Failed to capture early access feature enrollment",p)}))}catch(p){this.A.error("Failed to capture early access feature enrollment",p)}}getEarlyAccessFeatures(e,t,n){t===void 0&&(t=!1);var r=this.qd(eh);!r||t?this.ev(e,n):e(r)}ev(e,t){var n=this;return Ft((function*(){var r=n.Ns;if(r){var a,o=t?"&"+t.map((d=>"stage="+d)).join("&"):"";try{var u=yield r.sendRequest("/api/early_access_features/?token="+r.projectToken+o,{target:"api",method:"GET",sentAt:"query"});if(!u.json)return;n.ni({[eh]:a=u.json.earlyAccessFeatures})}catch(d){return void n.A.error("Early access feature request failed",d)}try{e(a)}catch(d){n.A.error("Early access feature callback failed",d)}}}))()}tv(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((n=>t[n])),flagVariants:Object.keys(t).filter((n=>t[n])).reduce(((n,r)=>(n[r]=t[r],n)),{})}}Od(e){this.Fd();var t=this.tv(),n=t.flags,r=t.flagVariants;this.featureFlagEventHandlers.forEach((a=>{try{a(n,r,{errorsLoading:e})}catch(o){this.A.error("Error while running feature flags callback",o)}}))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0),this.iv(e,t)}iv(e,t){t===void 0&&(t=!0);var n=this.qd(kr)||{},r=(e==null?void 0:e.$set)||(e!=null&&e.$set_once?{}:e),a=e==null?void 0:e.$set_once,o={};if(a)for(var u in a)({}).hasOwnProperty.call(a,u)&&(u in n||(o[u]=a[u]));this.ni({[kr]:de({},n,o,r)}),t&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=de({},this.qd(kr)||{});e.forEach((r=>{delete n[r]})),this.ni({[kr]:n}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e){e===void 0&&(e=!0),this.oi(kr),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this.qd(Ss)||{},r=de({},n);for(var a of Object.keys(e))r[a]=de({},n[a],e[a]);this.ni({[Ss]:r}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.qd(Ss)||{};this.ni({[Ss]:de({},t,{[e]:{}})})}else this.oi(Ss)}reset(){this.pd++,this.md=!1,this.ud={},this.hd={},this.jd=void 0,this.vd=!1,this.gd=!1,this.yd=!1,this.$anon_distinct_id=void 0,this.Nd(),this.ld=!1,this._d=0}}},v6={sessionRecording:class{get mn(){return this._instance.config}get Ba(){return this._instance.persistence}get started(){var e;return!((e=this.rv)==null||!e.isStarted)}get status(){var e,t;return this.nv===xc||this.nv===Ud?this.nv:(e=(t=this.rv)==null?void 0:t.status)!==null&&e!==void 0?e:this.nv}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.nv=Fd,this.sv=void 0,this.ov=!1,this.je=(()=>{var t;if(pe==null||!pe.visibilityState||pe.visibilityState==="visible")return!0;var n=te==null||(t=te.performance)==null||t.getEntriesByType==null?void 0:t.getEntriesByType("visibility-state");return!(n!=null&&n.length)||n.some((r=>r.name==="visible"))})(),this.Ve=()=>{var t;(pe==null?void 0:pe.visibilityState)==="visible"&&(this.je=!0,(t=this.rv)==null||t.setDocumentWasEverVisible==null||t.setDocumentWasEverVisible(!0))},this._instance=e,!this._instance.sessionManager)throw Ws.error("started without valid sessionManager"),new Error(cx+" started without valid sessionManager. This is a bug.");if(this.mn.cookieless_mode===ei)throw new Error(cx+' cannot be used with cookieless_mode="always"');pe!=null&&pe.addEventListener&&Dt(pe,"visibilitychange",this.Ve)}initialize(){this.startIfEnabledOrStop()}dispose(e){var t=(e===void 0?{}:e).discardBufferedEvents,n=t!==void 0&&t;this.ov=!0,pe==null||pe.removeEventListener==null||pe.removeEventListener("visibilitychange",this.Ve),n?this.av(!0):this.stopRecording()}get lv(){var e,t=!((e=this._instance.get_property(Da))==null||!e.enabled),n=!this.mn.disable_session_recording,r=this.mn.disable_session_recording||this._instance.consent.isOptedOut();return te&&t&&n&&!r}startIfEnabledOrStop(e){var t;if(!(this.ov||this.lv&&(t=this.rv)!=null&&t.isStarted)){var n=!ce(Object.assign)&&!ce(Array.from);this.lv&&n?(this.uv(e),Ws.info("starting")):(this.nv=Fd,this.stopRecording())}}uv(e){var t,n;if(this.lv)if(this.nv!==xc&&this.nv!==Ud&&(this.nv=L_),De!=null&&(t=De.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(n=De.__PosthogExtensions__)!=null&&n.initSessionRecording)this.hv(e);else{var r,a=this._instance.sessionManager;(r=De.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,this.dv,(o=>{if(!this.ov&&this.lv&&this._instance.sessionManager===a)return o?(this._instance.register_for_session({[Yg]:!0}),Ws.error("could not load recorder",o)):void this.hv(e);this.nv=Fd}))}}stopRecording(){var e,t;(e=this.sv)==null||e.call(this),this.sv=void 0,(t=this.rv)==null||t.stop()}av(e){var t,n;e===void 0&&(e=!1),(t=this.sv)==null||t.call(this),this.sv=void 0,(n=this.rv)==null||n.discard({discardProducerEvents:e})}vv(){var e,t;(e=this.Ba)==null||e.unregister($x),(t=this.Ba)==null||t.unregister(f2)}fv(e,t){if(Ye(e))return null;var n,r=an(e)?e:parseFloat(e);return typeof(n=r)!="number"||!Number.isFinite(n)||0>n||n>1?(Ws.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):r}pv(e){if(this.Ba){var t,n,r=this.Ba,a=()=>{var o,u=e.sessionRecording===!1?void 0:e.sessionRecording,d=this.fv((o=this.mn.session_recording)==null?void 0:o.sampleRate,"session_recording.sampleRate"),f=this.fv(u==null?void 0:u.sampleRate,"remote config sampleRate"),p=d??f;Ye(p)&&this.vv();var m=u==null?void 0:u.minimumDurationMilliseconds;r.register({[Da]:de({cache_timestamp:Date.now(),enabled:!!u},u,{networkPayloadCapture:de({capturePerformance:e.capturePerformance},u==null?void 0:u.networkPayloadCapture),canvasRecording:{enabled:u==null?void 0:u.recordCanvas,fps:u==null?void 0:u.canvasFps,quality:u==null?void 0:u.canvasQuality},sampleRate:p,minimumDurationMilliseconds:ce(m)?null:m,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.sv)==null||t.call(this),this.sv=(n=this._instance.sessionManager)==null?void 0:n.onSessionId(a)}}onRemoteConfig(e){var t=e.ok?e.config:void 0;return t&&"sessionRecording"in t?t.sessionRecording===!1?(this.pv(t),void this.av()):(this.pv(t),void this.startIfEnabledOrStop()):(this.nv===xc&&(this.nv=Ud,Ws.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t){var n;t===void 0&&(t="log"),(n=this.rv)!=null&&n.log?this.rv.log(e,t):Ws.warn("log called before recorder was ready")}get dv(){var e,t,n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(Da);return(n==null||(t=n.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}gv(){var e,t=this._instance.get_property(Da);if(!t)return!1;try{e=typeof t=="object"?t:JSON.parse(t)}catch(n){return Ws.warn("persisted remote config for session recording is invalid and will be ignored",n),!1}return!Ye(e.cache_timestamp)&&36e5>=Date.now()-e.cache_timestamp}hv(e){var t,n,r;if(!this.ov&&this.lv&&this._instance.sessionManager){if((t=De.__PosthogExtensions__)==null||!t.initSessionRecording)return Ws.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Yg]:!0});var a;if(this.rv||(this.rv=(a=De.__PosthogExtensions__)==null?void 0:a.initSessionRecording(this._instance,this.je),this.rv._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.gv())return this.nv===Ud||this.nv===xc?void 0:(this.nv=xc,Ws.info("persisted remote config is stale, requesting fresh config before starting"),void new Y2(this._instance).load());this.nv=L_,(n=(r=this.rv).setDocumentWasEverVisible)==null||n.call(r,this.je),this.rv.start(e)}else this.nv=Fd}onRRwebEmit(e){var t;(t=this.rv)==null||t.onRRwebEmit==null||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.rv||(t=this.Ba)==null||t.register({[m2]:!0}),(e=this.rv)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.rv||(t=this.Ba)==null||t.register({[p2]:!0}),(e=this.rv)==null||e.overrideSampling()}overrideTrigger(e){var t,n;this.rv||(n=this.Ba)==null||n.register({[e==="url"?g2:x2]:!0}),(t=this.rv)==null||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.rv)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var n;return!((n=this.rv)==null||!n.tryAddCustomEvent(e,t))}}},b6={autocapture:class extends JE{constructor(e){super(new e6(e)),this.instance=e}},historyAutocapture:class{constructor(e){this._instance=e,this.mv=this.yv()}initialize(){this.startIfEnabled()}get isEnabled(){var e=this.bv();return!!(e.path||e.search||this._v(e))}startIfEnabled(){this.isEnabled&&(ye.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.mv=this.yv(),this.startIfEnabled()}stop(){this.wv&&this.wv(),this.wv=void 0,this.Sv&&this.Sv(),this.Sv=void 0,ye.info("History API monitoring stopped")}monitorHistoryChanges(){te&&te.history&&(this.xv("pushState"),this.xv("replaceState"),this.Cv(),this._v()&&this.Tv())}xv(e){var t;if(te&&((t=te.history[e])==null||!t.__posthog_wrapped__)){var n=this;mk(te.history,e,(r=>function(a,o,u){r.call(this,a,o,u),n.Mv(e)}))}}yv(){var e=te==null?void 0:te.location;if(e!=null&&e.pathname)return{pathname:e.pathname,search:e.search,hash:e.hash}}bv(){var e=this._instance.config.capture_pageview;return e==="history_change"?{path:!0}:nt(e)?e:{}}_v(e){return e===void 0&&(e=this.bv()),!!e.hash&&!this._instance.config.disable_capture_url_hashes}Iv(e){var t=this.bv(),n=this.mv;return!(!n||!(t.path&&e.pathname!==n.pathname||t.search&&e.search!==n.search||this._v(t)&&e.hash!==n.hash))}Mv(e){try{var t=this.yv();if(!t)return;this.Iv(t)&&this._instance.capture(Hl,{navigation_type:e}),this.mv=t}catch(n){ye.error("Error capturing "+e+" pageview",n)}}Cv(){if(!this.wv){var e=()=>{this.Mv("popstate")};Dt(te,"popstate",e),this.wv=()=>{te&&te.removeEventListener("popstate",e)}}}Tv(){if(!this.Sv){var e=()=>{this.Mv("hashchange")};Dt(te,"hashchange",e),this.Sv=()=>{te&&te.removeEventListener("hashchange",e)}}}},heatmaps:class{get mn(){return this.instance.config}constructor(e){var t;this.Ev=!1,this.Rs=!1,this.Rv=null,this.instance=e,this.Ev=!((t=this.instance.persistence)==null||!t.props[Lg]),this.rageclicks=new pk(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return nt(this.mn.capture_heatmaps)&&this.mn.capture_heatmaps.flush_interval_milliseconds&&(e=this.mn.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return Ye(this.mn.capture_heatmaps)?Ye(this.mn.enable_heatmaps)?this.Ev:this.mn.enable_heatmaps:this.mn.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.Rs)return;s6.info("starting..."),this.Pv(),this.Ve()}else{var e;clearInterval((e=this.Rv)!==null&&e!==void 0?e:void 0),this.Av(),this.getAndClearBuffer()}}onRemoteConfig(e){if(e.ok){var t=e.config;if("heatmaps"in t){var n=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Lg]:n}),this.Ev=n,this.startIfEnabled()}}}getAndClearBuffer(){var e=this.De;return this.De=void 0,e}Fv(e){Fm(e.originalEvent)&&this.Xi(e.originalEvent,"deadclick")}Ve(){this.Rv&&clearInterval(this.Rv),this.Rv=(pe==null?void 0:pe.visibilityState)==="visible"?setInterval(this.Pa.bind(this),this.flushIntervalMilliseconds):null}Pv(){te&&pe&&(this.Ov=this.Pa.bind(this),Dt(te,Nh,this.Ov),this.Lv=e=>this.Xi(e||(te==null?void 0:te.event)),Dt(pe,"click",this.Lv,{capture:!0}),this.Dv=e=>this.$v(e||(te==null?void 0:te.event)),Dt(pe,"mousemove",this.Dv,{capture:!0}),this.Nv=new u_(this.instance,uE,this.Fv.bind(this)),this.Nv.startIfEnabledOrStop(),this.qv=this.Ve.bind(this),Dt(pe,eo,this.qv),this.Rs=!0)}Av(){var e;te&&pe&&(this.Ov&&te.removeEventListener(Nh,this.Ov),this.Lv&&pe.removeEventListener("click",this.Lv,{capture:!0}),this.Dv&&pe.removeEventListener("mousemove",this.Dv,{capture:!0}),this.qv&&pe.removeEventListener(eo,this.qv),clearTimeout(this.jv),(e=this.Nv)==null||e.stop(),this.Rs=!1)}Bv(e,t){var n=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),a=this.instance.scrollManager.scrollElement(),o=(function(u,d,f){for(var p=u;p&&Qi(p)&&!Cr(p,"body");){if(p===f)return!1;var m=void 0;try{var x,b,y;m=(x=(b=(y=p.ownerDocument)==null?void 0:y.defaultView)!==null&&b!==void 0?b:te)==null?void 0:x.getComputedStyle(p).position}catch{return!1}if(Ie(d,m))return!0;p=T2(p)}return!1})(Jg(e),["fixed","sticky"],a);return{x:e.clientX+(o?0:r),y:e.clientY+(o?0:n),target_fixed:o,type:t}}Xi(e,t){var n;if(t===void 0&&(t="click"),!e_(e.target)&&Fm(e)){var r=this.Bv(e,t);(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&R2(Jg(e),this.instance.config.rageclick)&&this.ks(de({},r,{type:"rageclick"})),this.ks(r)}}$v(e){!e_(e.target)&&Fm(e)&&(clearTimeout(this.jv),this.jv=setTimeout((()=>{this.ks(this.Bv(e,"mousemove"))}),500))}ks(e){if(te){var t=this.mn.disable_capture_url_hashes?Wi(te.location.href):te.location.href,n=this.mn.custom_personal_data_properties,r=this.mn.mask_personal_data_properties?[...ro,...n||[]]:[],a=Qc(t,r,Xc);this.De=this.De||{},this.De[a]||(this.De[a]=[]),this.De[a].push(e)}}Pa(){this.De&&!Nr(this.De)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:u_,webVitalsAutocapture:class{constructor(e){var t;this.Ev=!1,this.Rs=!1,this.De={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Hv=()=>{clearTimeout(this.zv),this.zv=void 0,this.De.metrics.length!==0&&(this._instance.capture("$web_vitals",de({$current_url:this.De.url},this.De.metrics.reduce(((n,r)=>de({},n,{["$web_vitals_"+r.name+"_event"]:de({},r),["$web_vitals_"+r.name+"_value"]:r.value})),{}))),this.De={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Uv=n=>{var r;if(this.De=this.De||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},Ye(n==null?void 0:n.name)||Ye(n==null?void 0:n.value))Sa.error("Invalid metric received",n);else{var a=typeof n.navigationURL=="string"?n.navigationURL:void 0,o=this.Wv(a);if(!ce(o)){var u=an(n.navigationId)||typeof n.navigationId=="string"?"navigation:"+n.navigationId:"url:"+o;if(!this.Vv||this.Vv>n.value){this.De.navigationKey!==u&&(this.Hv(),this.zv=setTimeout(this.Hv,this.flushToCaptureTimeoutMs)),ce(this.De.navigationKey)&&(this.De.navigationKey=u,this.De.url=o),this.De.firstMetricTimestamp=ce(this.De.firstMetricTimestamp)?Date.now():this.De.firstMetricTimestamp;var d=(r=this._instance.sessionManager)==null?void 0:r.checkAndGetSessionAndWindowId(!0),f=de({},n,a?{navigationURL:o}:{},{$current_url:o,timestamp:Date.now()});if(delete f.entries,nt(n.attribution)&&this.attributionMetrics.indexOf(n.name)>-1){var p={};for(var m of r6){var x=m==="url"&&typeof n.attribution[m]=="string"?this.Wv(n.attribution[m]):n.attribution[m];ce(x)||(p[m]=x)}f.attribution=p}else delete f.attribution;ce(d)||(f.$session_id=d.sessionId,f.$window_id=d.windowId),this.De.metrics.push(f),this.De.metrics.length===this.allowedMetrics.length&&this.Hv()}else Sa.error("Ignoring metric with value >= "+this.Vv,n)}}},this.Gv=()=>{if(!this.Rs){var n,r,a,o,u=!1,d=De.__PosthogExtensions__,f=d==null?void 0:d.postHogWebVitalsCallbacksByFlavor,p=(f==null?void 0:f[this.Zv])||(this.Zv==="web-vitals"&&ce(f)?d==null?void 0:d.postHogWebVitalsCallbacks:void 0);if(!ce(p)){var m=p.withoutAttribution,x=this.attributionMetrics;u=!ce(m),n=x.indexOf("LCP")>-1?p.onLCP:(m==null?void 0:m.onLCP)||p.onLCP,r=x.indexOf("CLS")>-1?p.onCLS:(m==null?void 0:m.onCLS)||p.onCLS,a=x.indexOf("FCP")>-1?p.onFCP:(m==null?void 0:m.onFCP)||p.onFCP,o=x.indexOf("INP")>-1?p.onINP:(m==null?void 0:m.onINP)||p.onINP}if(n&&r&&a&&o){var b={reportSoftNavs:this.useSoftNavs},y=u&&this.attributionMetrics.indexOf("INP")>-1?de({},b,{includeProcessedEventEntries:!1}):b;this.allowedMetrics.indexOf("LCP")>-1&&n(this.Uv.bind(this),b),this.allowedMetrics.indexOf("CLS")>-1&&r(this.Uv.bind(this),b),this.allowedMetrics.indexOf("FCP")>-1&&a(this.Uv.bind(this),b),this.allowedMetrics.indexOf("INP")>-1&&o(this.Uv.bind(this),y),this.Rs=!0}else Sa.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.Ev=!((t=this._instance.persistence)==null||!t.props[Pg]),this.startIfEnabled()}get Qv(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,n=nt(this.Qv)?(e=this.Qv)==null?void 0:e.web_vitals_allowed_metrics:void 0;return Ye(n)?((t=this._instance.persistence)==null?void 0:t.props[Fg])||D_:n}get flushToCaptureTimeoutMs(){return(nt(this.Qv)?this.Qv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){var e=nt(this.Qv)?this.Qv.web_vitals_attribution:void 0;return Kn(e)?e?D_:[]:Pe(e)?e:n6}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){var e=nt(this.Qv)?this.Qv.__preview_web_vitals_soft_navs:void 0;return e!=null&&e}get Vv(){var e=nt(this.Qv)&&an(this.Qv.__web_vitals_max_value)?this.Qv.__web_vitals_max_value:R_;return e>0&&6e4>=e?R_:e}get isEnabled(){var e=Zt==null?void 0:Zt.protocol;if(e!=="http:"&&e!=="https:")return Sa.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=nt(this.Qv)?this.Qv.web_vitals:Kn(this.Qv)?this.Qv:void 0;return Kn(t)?t:this.Ev}startIfEnabled(){this.isEnabled&&!this.Rs&&(Sa.info("enabled, starting..."),this.Ys(this.Gv))}onRemoteConfig(e){if(e.ok){var t=e.config;if("capturePerformance"in t){var n=nt(t.capturePerformance)&&!!t.capturePerformance.web_vitals,r=nt(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Pg]:n}),this._instance.persistence.register({[Fg]:r})),this.Ev=n,this.startIfEnabled()}}}get Zv(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}Ys(e){var t=De.__PosthogExtensions__,n=this.Zv,r=t==null?void 0:t.postHogWebVitalsCallbacksByFlavor;r!=null&&r[n]||n==="web-vitals"&&ce(r)&&t!=null&&t.postHogWebVitalsCallbacks?e():t==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,n,(a=>{a?Sa.error("failed to load script",a):e()}))}Wv(e){var t=e||(te==null?void 0:te.location.href);if(t){var n=this._instance.config.disable_capture_url_hashes?Wi(t):t,r=this._instance.config.custom_personal_data_properties,a=this._instance.config.mask_personal_data_properties?[...ro,...r||[]]:[];return Qc(n,a,Xc)}Sa.error("Could not determine current URL")}}},y6={exceptionObserver:class{constructor(e){var t;this.Gv=()=>{var n;if(te&&this.isEnabled&&(n=De.__PosthogExtensions__)!=null&&n.errorWrappingFunctions){var r=De.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,a=De.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,o=De.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Jv&&this.mn.capture_unhandled_errors&&(this.Jv=r(this.captureException.bind(this))),!this.Kv&&this.mn.capture_unhandled_rejections&&(this.Kv=a(this.captureException.bind(this))),!this.Yv&&this.mn.capture_console_errors&&(this.Yv=o(this.captureException.bind(this)))}catch(u){gc.error("failed to start",u),this.Xv()}}},this._instance=e,this.tc=!((t=this._instance.persistence)==null||!t.props[Og]),this.wt=new K3(de({},(function(n){var r,a,o,u;return n===void 0&&(n={}),{refillRate:(r=(a=n.exceptionRateLimiterRefillRate)!==null&&a!==void 0?a:n.__exceptionRateLimiterRefillRate)!==null&&r!==void 0?r:1,bucketSize:(o=(u=n.exceptionRateLimiterBucketSize)!==null&&u!==void 0?u:n.__exceptionRateLimiterBucketSize)!==null&&o!==void 0?o:10}})(this._instance.config.error_tracking),{refillInterval:1e4,A:gc})),this.mn=this.ec(),this.startIfEnabledOrStop()}ec(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return nt(e)?t=de({},t,e):(ce(e)?this.tc:e)&&(t=de({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.mn.capture_console_errors||this.mn.capture_unhandled_errors||this.mn.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(gc.info("enabled"),this.Xv(),this.Ys(this.Gv)):this.Xv()}Ys(e){var t,n;(t=De.__PosthogExtensions__)!=null&&t.errorWrappingFunctions?e():(n=De.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",(r=>{if(r)return gc.error("failed to load script",r);e()}))}Xv(){var e,t,n;(e=this.Jv)==null||e.call(this),this.Jv=void 0,(t=this.Kv)==null||t.call(this),this.Kv=void 0,(n=this.Yv)==null||n.call(this),this.Yv=void 0}onRemoteConfig(e){if(e.ok){var t=e.config;"autocaptureExceptions"in t&&(this.tc=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Og]:this.tc}),this.mn=this.ec(),this.startIfEnabledOrStop())}}onConfigChange(){this.mn=this.ec()}captureException(e){try{var t,n,r,a=(t=e==null||(n=e.$exception_list)==null||(n=n[0])==null?void 0:n.type)!==null&&t!==void 0?t:"Exception";if(this.wt.consumeRateLimit(a))return void gc.info("Skipping exception capture because of client rate limiting.",{exception:a});(r=this._instance.exceptions)==null||r.sendExceptionEvent(e)}catch{}}},exceptions:class{constructor(e){var t,n;this.ic=[],this.rc=new f4([new _4,new T4,new k4,new w4,new E4,new C4,new j4,new A4],(function(r){for(var a=arguments.length,o=new Array(a>1?a-1:0),u=1;a>u;u++)o[u-1]=arguments[u];return function(d,f){f===void 0&&(f=0);for(var p=[],m=d.split(`
|
|
68
|
+
`),x=f;m.length>x;x++){var b=m[x];if(1024>=b.length){var y=Py.test(b)?b.replace(Py,"$1"):b;if(!y.match(/\S*Error: /)){for(var _ of o){var j=_(y,r);if(j){p.push(j);break}}if(p.length>=50)break}}}return(function(N){if(!N.length)return[];var w=Array.from(N);return w.reverse(),w.slice(0,50).map((E=>{return de({},E,{filename:E.filename||(C=w,C[C.length-1]||{}).filename,function:E.function||Jl});var C}))})(p)}})("web:javascript",x4,y4)),this._instance=e,this.ic=(t=(n=this._instance.persistence)==null?void 0:n.get_property(zg))!==null&&t!==void 0?t:[],this.nc=_h(this.sc()),this.oc=new R4(this.nc)}onConfigChange(){this.nc=_h(this.sc()),this.oc.setConfig(this.nc)}onRemoteConfig(e){var t,n,r;if(e.ok){var a=e.config;if("errorTracking"in a){var o=(t=(n=a.errorTracking)==null?void 0:n.suppressionRules)!==null&&t!==void 0?t:[],u=(r=a.errorTracking)==null?void 0:r.captureExtensionExceptions;this.ic=o,this._instance.persistence&&this._instance.persistence.register({[zg]:this.ic,[Bg]:u})}}}get ac(){var e,t=!!this._instance.get_property(Bg),n=this._instance.config.error_tracking.captureExtensionExceptions;return(e=n??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.rc.buildFromUnknown(e,{syntheticException:t==null?void 0:t.syntheticException,mechanism:{handled:t==null?void 0:t.handled}})}addExceptionStep(e,t){if(this.nc.enabled)try{if(!at(e)||e.trim().length===0)return void ss.warn("Ignoring exception step because message must be a non-empty string");var n=(function(o){if(!o)return{sanitizedProperties:{},droppedKeys:[]};var u=[];return{sanitizedProperties:Object.keys(o).reduce(((d,f)=>M4.has(f)?(u.push(f),d):(d[f]=o[f],d)),{}),droppedKeys:u}})(this.lc(t)),r=n.sanitizedProperties,a=n.droppedKeys;a.length>0&&ss.warn("Ignoring reserved exception step fields",{droppedKeys:a}),this.oc.add(de({[bh]:e,[yh]:new Date().toISOString()},r))}catch(o){ss.error("Failed to add exception step. Ignoring breadcrumb.",o)}}sendExceptionEvent(e){try{var t=e.$exception_list;if(this.uc(t)){if(this.hc(t))return this.dc("Exception dropped: matched a suppression rule"),void ss.info("Skipping exception capture because a suppression rule matched");if(!this.ac&&this.vc(t))return this.dc("Exception dropped: thrown by a browser extension"),void ss.info("Skipping exception capture because it was thrown by an extension");if(!this.ac&&this.cc(t))return this.dc("Exception dropped: thrown by an injected browser script"),void ss.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.fc(t))return this.dc("Exception dropped: thrown by the PostHog SDK"),void ss.info("Skipping exception capture because it was thrown by the PostHog SDK")}var n=this.nc.enabled&&Ye(e.$exception_steps)?this.gc(e):e,r=typeof(o=globalThis._posthogReleaseId)=="string"&&o.length>0?o:void 0;r&&(n.$release_id=r);try{var a=this._instance.capture("$exception",n,{_noTruncate:!0,_batchKey:"exceptionEvent",gu:!0});return a&&this.oc.clear(),a}catch(u){return q_(u)||ss.error("Failed to capture exception event. Dropping this exception.",u),void this.oc.clear()}}catch(u){return void(q_(u)||ss.error("Failed to process exception event. Ignoring this exception.",u))}var o}gc(e){try{var t=this.oc.getAttachable();return t.length===0?e:de({},e,{$exception_steps:t})}catch(n){return ss.error("Failed to read buffered exception steps. Capturing exception without steps.",n),e}}dc(e){this.nc.enabled&&this.oc.add({[bh]:e,[yh]:new Date().toISOString()})}lc(e){return nt(e)?de({},e):{}}sc(){var e,t;return(e=(t=this._instance.config.error_tracking)==null?void 0:t.exception_steps)!==null&&e!==void 0?e:{}}hc(e){if(e.length===0)return!1;try{var t=e.reduce(((n,r)=>{var a=r.type,o=r.value;return at(a)&&a.length>0&&n.$exception_types.push(a),at(o)&&o.length>0&&n.$exception_values.push(o),n}),{$exception_types:[],$exception_values:[]});return this.ic.some((n=>{var r=n.values.map((a=>{var o=ok[a.operator],u=t[a.key];if(!o||!u)return!1;var d=Pe(a.value)?a.value:[a.value];return d.length>0&&o(d,u)}));return n.type==="OR"?r.some(Boolean):r.every(Boolean)}))}catch(n){return ss.warn("Failed to evaluate suppression rules. Capturing the exception.",n),!1}}vc(e){var t=e.flatMap((r=>{var a,o;return(a=(o=r.stacktrace)==null?void 0:o.frames)!==null&&a!==void 0?a:[]})),n=t.filter((r=>{var a=r.filename;return!!a&&p6.some((o=>a.startsWith(o)))}));return n.length!==0&&(!n.every((r=>{var a=r.filename;return!!a&&a.startsWith(ux)}))||e.some((r=>{var a=r.value;return at(a)&&a.includes("isolatedAPI.contexts.topHostname")}))&&!t.some((r=>{var a=r.filename;return r.in_app&&!(a!=null&&a.startsWith(ux))})))}cc(e){return e.some((t=>{var n=t.value;return at(n)&&m6.some((r=>n.includes(r)))}))}fc(e){if(e.length>0){var t,n,r,a,o=(t=(n=e[0].stacktrace)==null?void 0:n.frames)!==null&&t!==void 0?t:[],u=o[o.length-1];return(r=u==null||(a=u.filename)==null?void 0:a.includes("posthog.com/static"))!==null&&r!==void 0&&r}return!1}uc(e){return!Ye(e)&&Pe(e)}}},_6=de({productTours:class{get Ba(){return this._instance.persistence}constructor(e){this.mc=null,this.yc=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(e.ok){var t=e.config;if("productTours"in t){var n,r;if(this.Ba&&this.Ba.register({[Px]:!!t.productTours}),!Um(this._instance))return!this.mc&&Ye((n=this.Ba)==null?void 0:n.props[Nc])||Id.info("product tours disabled; stopping and clearing cached tours"),(r=this.mc)==null||r.stop(),this.mc=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.mc&&Um(this._instance)&&this.Ys((()=>this.bc()))}Ys(e){var t,n;(t=De.__PosthogExtensions__)!=null&&t.generateProductTours?e():(n=De.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"product-tours",(r=>{r?Id.error("Could not load product tours script",r):e()}))}bc(){var e;!this.mc&&(e=De.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.mc=De.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(t===void 0&&(t=!1),!Pe(this.yc)||t){var n=this.Ba;if(n){var r=n.props[Nc];if(Pe(r)&&!t)return this.yc=r,void e(r,{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:a=>{if(Um(this._instance)){var o=a.statusCode;if(o!==200||!a.json){var u="Product Tours API could not be loaded, status: "+o;return o===0?a.error||Id.warn(u):Id.error(u),void e([],{isLoaded:!1,error:u})}var d=Pe(a.json.product_tours)?a.json.product_tours:[];this.yc=d,n&&n.register({[Nc]:d}),e(d,{isLoaded:!0})}else e([],{isLoaded:!0})}})}else e(this.yc,{isLoaded:!0})}getActiveProductTours(e){Ye(this.mc)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.mc.getActiveProductTours(e)}showProductTour(e){var t;(t=this.mc)==null||t.showTourById(e)}previewTour(e){this.mc?this.mc.previewTour(e):this.Ys((()=>{var t;this.bc(),(t=this.mc)==null||t.previewTour(e)}))}dismissProductTour(){var e;(e=this.mc)==null||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.mc)==null||e.nextStep()}previousStep(){var e;(e=this.mc)==null||e.previousStep()}clearCache(){var e;this.yc=null,(e=this.Ba)==null||e.unregister(Nc)}resetTour(e){var t;(t=this.mc)==null||t.resetTour(e)}resetAllTours(){var e;(e=this.mc)==null||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.mc)==null||t.cancelPendingTour(e)}}},Yh),w6={siteApps:class{constructor(e){this._c=0,this._instance=e,this.wc=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}kc(e,t){if(t){var n=this.globalsForEvent(t);this.wc.push(n),this.wc.length>1e3&&(this.wc=this.wc.slice(10))}}get siteAppLoaders(){var e;return(e=De._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}initialize(){if(this.isEnabled){var e=this._instance._addCaptureHook(this.kc.bind(this));this.Sc=()=>{e(),this.wc=[],this.Sc=void 0}}}globalsForEvent(e){var t,n,r,a,o,u,d;if(!e)throw new Error("Event payload is required");var f={},p=this._instance.get_property("$groups")||[],m=this._instance.get_property("$stored_group_properties")||{};for(var x of Object.entries(m)){var b=x[0];f[b]={id:p[b],type:b,properties:x[1]}}var y=e.$set_once,_=e.$set;return{event:de({},Cw(e,i6),{properties:de({},e.properties,_?{$set:de({},(t=(n=e.properties)==null?void 0:n.$set)!==null&&t!==void 0?t:{},_)}:{},y?{$set_once:de({},(r=(a=e.properties)==null?void 0:a.$set_once)!==null&&r!==void 0?r:{},y)}:{}),elements_chain:(o=(u=e.properties)==null?void 0:u.$elements_chain)!==null&&o!==void 0?o:"",distinct_id:(d=e.properties)==null?void 0:d.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:f}}xc(e){var t,n=(t=e.tagName)==null?void 0:t.toLowerCase();return n==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||(bs.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)||(bs.error("prepare_external_dependency_script returned null"),null):e}Cc(){var e,t,n,r,a,o,u,d;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var f=pe==null?void 0:pe.defaultView,p=f==null||(e=f.Node)==null?void 0:e.prototype;if(!f||!p)return()=>{};if(this._c++,this.Tc)return this.Mc();var m=[],x=this,b=new WeakSet,y=(N,w,E)=>{if(N!=null&&N[w]){var C=N[w];N[w]=E(C),m.push((()=>{N[w]=C}))}},_=N=>{if(b.has(N))return N;var w=x.xc(N);return w&&b.add(w),w},j=N=>N.map((w=>typeof w=="string"?w:_(w))).filter((w=>!sn(w)));return y(p,"appendChild",(N=>function(w){var E=_(w);return E?N.call(this,E):w})),y(p,"insertBefore",(N=>function(w,E){var C=_(w);return C?N.call(this,C,E):w})),y(p,"replaceChild",(N=>function(w,E){var C=_(w);return C?N.call(this,C,E):E})),[(t=f.Element)==null?void 0:t.prototype,(n=f.Document)==null?void 0:n.prototype,(r=f.DocumentFragment)==null?void 0:r.prototype].forEach((N=>{y(N,"append",(w=>function(){for(var E=arguments.length,C=new Array(E),T=0;E>T;T++)C[T]=arguments[T];return w.apply(this,j(C))})),y(N,"prepend",(w=>function(){for(var E=arguments.length,C=new Array(E),T=0;E>T;T++)C[T]=arguments[T];return w.apply(this,j(C))}))})),[(a=f.Element)==null?void 0:a.prototype,(o=f.CharacterData)==null?void 0:o.prototype,(u=f.DocumentType)==null?void 0:u.prototype].forEach((N=>{y(N,"before",(w=>function(){for(var E=arguments.length,C=new Array(E),T=0;E>T;T++)C[T]=arguments[T];return w.apply(this,j(C))})),y(N,"after",(w=>function(){for(var E=arguments.length,C=new Array(E),T=0;E>T;T++)C[T]=arguments[T];return w.apply(this,j(C))})),y(N,"replaceWith",(w=>function(){for(var E=arguments.length,C=new Array(E),T=0;E>T;T++)C[T]=arguments[T];var O=j(C);return C.length&&!O.length?void 0:w.apply(this,O)}))})),y((d=f.Element)==null?void 0:d.prototype,"insertAdjacentElement",(N=>function(w,E){var C=_(E);return C?N.call(this,w,C):null})),this.Tc=()=>{m.forEach((N=>N())),this.Tc=void 0},this.Mc()}Mc(){var e=!1;return()=>{var t;e||(e=!0,this._c--,this._c===0&&((t=this.Tc)==null||t.call(this)))}}Ic(e,t){t===void 0&&(t=!0);var n=this.Cc();try{var r=e(n);return t&&n(),r}catch(a){throw n(),a}}setupSiteApp(e){var t=this.apps[e.id],n=()=>{var u;!t.errored&&this.wc.length&&(bs.info("Processing "+this.wc.length+" events for site app with id "+e.id),this.wc.forEach((d=>this.Ic((()=>t.processEvent==null?void 0:t.processEvent(d))))),t.processedBuffer=!0),Object.values(this.apps).every((d=>d.processedBuffer||d.errored))&&((u=this.Sc)==null||u.call(this))},r=!1,a=u=>{t.errored=!u,t.loaded=!0,bs.info("Site app with id "+e.id+" "+(u?"loaded":"errored")),r&&n()};try{var o=this.Ic((u=>e.init({posthog:this._instance,callback(d){u(),a(d)}})),!1).processEvent;o&&(t.processEvent=o),r=!0}catch(u){bs.error(O_+e.id,u),a(!1)}if(r&&t.loaded)try{n()}catch(u){bs.error("Error while processing buffered events PostHog app with config id "+e.id,u),t.errored=!0}}Ec(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var n of e)this.setupSiteApp(n)}Rc(e){var t=this;if(Object.keys(this.apps).length!==0){var n=this.globalsForEvent(e),r=function(o){try{t.Ic((()=>o.processEvent==null?void 0:o.processEvent(n)))}catch(u){bs.error("Error while processing event "+e.event+" for site app "+o.id,u)}};for(var a of Object.values(this.apps))r(a)}}onRemoteConfig(e){var t,n,r,a=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.Ec(),void this._instance.on("eventCaptured",(f=>this.Rc(f)))):void bs.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.Sc)==null||n.call(this),e.ok){var o=e.config;if((r=o.siteApps)!=null&&r.length)if(this.isEnabled){var u=function(){var f,p=d.id,m=d.url;De["__$$ph_site_app_"+p]=a._instance,(f=De.__PosthogExtensions__)==null||f.loadSiteApp==null||f.loadSiteApp(a._instance,m,(x=>{if(x)return bs.error(O_+p,x)}))};for(var d of o.siteApps)u()}else bs.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},k6={tracingHeaders:class{constructor(e){this.Pc=void 0,this.Ac=void 0,this.Fc=void 0,this.Gv=()=>{var t,n,r=this.Oc();r?(ce(this.Pc)&&(this.Pc=(t=De.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null?void 0:t._patchXHR(r,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),ce(this.Ac)&&(this.Ac=(n=De.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null?void 0:n._patchFetch(r,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.Xv()},this._instance=e}initialize(){this.startIfEnabledOrStop()}Ys(e){var t,n;(t=De.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns?e():(n=De.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",(r=>{if(r)return t6.error("failed to load script",r);e()}))}Lc(){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}Oc(){var e=this.Lc();return Pe(e)?(Pe(this.Fc)?this.Fc.splice(0,this.Fc.length,...e):this.Fc=[...e],e.length>0?this.Fc:void 0):(Pe(this.Fc)&&this.Fc.splice(0),this.Fc=e||void 0,this.Fc)}Xv(){var e,t;(e=this.Pc)==null||e.call(this),(t=this.Ac)==null||t.call(this),this.Pc=void 0,this.Ac=void 0}startIfEnabledOrStop(){this.Oc()?this.Ys(this.Gv):this.Xv()}}},S6=de({surveys:class extends a6{constructor(e){var t;super(new d6(e),{get projectToken(){return t.config.token},kv:new u6(t=e)}),this._instance=e}Bu(e,t){var n=t.query?ru(e,t.query):e;return new Promise((r=>{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:r})}))}}},Yh),j6={toolbar:class{constructor(e){this.instance=e}Dc(e){De.ph_toolbar_state=e}$c(){var e;return(e=De.ph_toolbar_state)!==null&&e!==void 0?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,t,n){if(e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),Xg(this.instance.config)||!te||!pe)return!1;e=e??te.location,n=n??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}var r,a=h6||Th(e.hash,"__posthog")||Th(e.hash,"state"),o=a?Xy((()=>JSON.parse(atob(decodeURIComponent(a)))))||Xy((()=>JSON.parse(decodeURIComponent(a)))):null;return o&&o.action==="ph_authorize"?((r=o).source="url",r&&Object.keys(r).length>0&&(o.desiredHash?e.hash=o.desiredHash:n?n.replaceState(n.state,"",e.pathname+e.search):e.hash="")):((r=JSON.parse(t.getItem(B_)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch{return!1}}Nc(e){var t=De.ph_load_toolbar||De.ph_load_editor;!Ye(t)&&In(t)?t(e,this.instance):P_.warn("No toolbar load function found")}loadToolbar(e){var t=!(pe==null||!pe.getElementById(j2));if(!te||t)return!1;var n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,r=de({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(te.localStorage.setItem(B_,JSON.stringify(de({},r,{source:void 0}))),this.$c()===2)this.Nc(r);else if(this.$c()===0){var a;this.Dc(1),(a=De.__PosthogExtensions__)==null||a.loadExternalDependency==null||a.loadExternalDependency(this.instance,"toolbar",(o=>{if(o)return P_.error("[Toolbar] Failed to load",o),void this.Dc(0);this.Dc(2),this.Nc(r)})),Dt(te,"turbolinks:load",(()=>{this.Dc(0),this.loadToolbar(r)}))}return!0}qc(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,n){return e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),this.maybeLoadToolbar(e,t,n)}}},N6=de({experiments:Un},Yh),C6={conversations:class{constructor(e){this.jc=void 0,this._conversationsManager=null,this.Bc=!1,this.zt=null,this.Hc=!1,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations&&(this.zc=e.ok,e.ok)){var t=e.config.conversations;Ye(t)||(Kn(t)?this.jc=t:(this.jc=t.enabled,this.zt=t),this.loadIfEnabled())}}reset(){var e;(e=this._conversationsManager)==null||e.reset(),this._conversationsManager=null,this.jc=void 0,this.zt=null,this.zc=void 0,this.Hc=!1}loadIfEnabled(){if(!(this._conversationsManager||this.Bc||this._instance.config.disable_conversations||Xg(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=De==null?void 0:De.__PosthogExtensions__;if(e&&!ce(this.jc)&&this.jc)if(this.zt&&this.zt.token){this.Bc=!0;try{var t=e.initConversations;if(t)return this.Uc(t),void(this.Bc=!1);var n=e.loadExternalDependency;if(!n)return void this.Wc(Fx);n(this._instance,"conversations",(r=>{r||!e.initConversations?this.Wc("Could not load conversations script",r):this.Uc(e.initConversations),this.Bc=!1}))}catch(r){this.Wc("Error initializing conversations",r),this.Bc=!1}}else qr.error("Conversations enabled but missing token in remote config.")}}Uc(e){if(this.zt)try{this._conversationsManager=e(this.zt,this._instance),this.Hc=!1,qr.info("Conversations loaded successfully")}catch(t){this.Wc("Error completing conversations initialization",t)}else qr.error("Cannot complete initialization: remote config is null")}Wc(e,t){qr.error(e,t),this._conversationsManager=null,this.Bc=!1,this.Hc=!0}show(){this._conversationsManager?this._conversationsManager.show():qr.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.jc===!0&&!sn(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":Xg(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":this.zc===!1?"remote_config_failed":ce(this.jc)?this.zc?"disabled_in_project":"remote_config_pending":this.jc?Ye(this.zt)||!this.zt.token?"missing_token":De!=null&&De.__PosthogExtensions__?this.Bc?"initializing":this.Hc?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.isVisible())!==null&&e!==void 0&&e}sendMessage(e,t,n){var r=this;return Ft((function*(){return r._conversationsManager?r._conversationsManager.sendMessage(e,t,n):(qr.warn(Na),null)}))()}getMessages(e,t){var n=this;return Ft((function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(qr.warn(Na),null)}))()}markAsRead(e){var t=this;return Ft((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(qr.warn(Na),null)}))()}getTickets(e){var t=this;return Ft((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(qr.warn(Na),null)}))()}requestRestoreLink(e){var t=this;return Ft((function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(qr.warn(Na),null)}))()}restoreFromToken(e){var t=this;return Ft((function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(qr.warn(Na),null)}))()}restoreFromUrlToken(){var e=this;return Ft((function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(qr.warn(Na),null)}))()}getCurrentTicketId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getCurrentTicketId())!==null&&e!==void 0?e:null}getWidgetSessionId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getWidgetSessionId())!==null&&e!==void 0?e:null}Cu(){var e;(e=this._conversationsManager)==null||e.setIdentity()}Tu(){var e;(e=this._conversationsManager)==null||e.clearIdentity()}}},E6={logs:class{constructor(e){var t,n=this;this.name="logs",this.Vc=!1,this.Gc=!1,this.Zc=!1,this.A=Gt("[logs]"),this.Qc=de({},this.A,{error(){for(var r=arguments.length,a=new Array(r),o=0;r>o;o++)a[o]=arguments[o];a.some(W_)||n.A.error(...a)}}),this.ba=[],this.Jc=[],this._d=0,this.Os=!1,this.Kc=[],this.Yc=[],this.Xc=!1,this.tf=!1,this.ef=()=>{var r,a;this.Os||(this._d=0,(r=this.if)==null||r.onReconnect(),(a=this.rf)==null||a.onReconnect())},this._instance=e,this._instance&&(t=this._instance.config.logs)!=null&&t.captureConsoleLogs&&(this.Vc=!0),te&&Dt(te,"online",this.ef)}nf(e,t,n,r){var a,o=G_((a=this._instance)==null||(a=a.config)==null?void 0:a.logs,n);return[new I4(this.sf(e,t),o,this.Qc,(()=>this.af()),(u=>u()),void 0,r),o]}lf(){var e,t=(e=this._instance)==null||(e=e.config)==null?void 0:e.logs;if(!this.if||this.uf!==t){var n;(n=this.if)==null||n.reset(),this.uf=t;var r=this.nf((()=>this.ba),(a=>{this.ba=a}));this.if=r[0],this.hf=r[1]}return this.if}df(){var e,t=(e=this._instance)==null||(e=e.config)==null?void 0:e.logs;if(!this.rf||this.vf!==t){var n;(n=this.rf)==null||n.reset(),this.vf=t;var r=this.nf((()=>this.Jc),(a=>{this.Jc=a}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Y_);this.rf=r[0],this.cf=r[1]}return this.rf}setup(e){var t;if(!this.Os){this.Ns=e,(t=this._instance)!=null&&(t=t.config)!=null&&(t=t.logs)!=null&&t.captureConsoleLogs&&(this.Vc=!0),(this.Vc||this.ff()&&this.pf())&&this.gf();var n=!1,r=e.onRemoteConfig((a=>{var o;n=a.ok&&((o=a.config.logs)==null?void 0:o.captureConsoleLogs)===!0,this.onRemoteConfig(a)}));this.Os?r.dispose():(this.qs=r,n||this.loadIfEnabled())}}dispose(){var e,t,n,r;this.Os||(this.Os=!0,this.mf(),(e=this.qs)==null||e.dispose(),this.qs=void 0,this.Ns=void 0,this.Zc=!1,te==null||te.removeEventListener("online",this.ef),(t=this.yf)==null||t.call(this),this.yf=void 0,(n=this.if)==null||n.reset(),(r=this.rf)==null||r.reset())}onRemoteConfig(e){var t,n;if(!this.Os){var r=e.ok?(t=e.config.logs)==null?void 0:t.captureConsoleLogs:void 0;Ye(r)?this.bf():((n=this._instance)==null||(n=n.persistence)==null||n.register({[$g]:!!r}),r?(this.Vc=!0,this.Gc||this.gf(),this.loadIfEnabled()):this.bf())}}reset(){var e,t,n,r;this.mf(),(e=this.if)==null||e.clearQueue(),this.ba=[],(t=this.if)==null||t.reset(),(n=this.rf)==null||n.clearQueue(),this.Jc=[],(r=this.rf)==null||r.reset(),this._d=0}captureLog(e){this.Os||this.lf().captureLog(e)}captureConsoleLog(e){this.Os||this.df().captureLog(e)}captureBufferedConsoleLog(e,t,n){this.Os||this.df().captureLog(e,{context:t,occurredAtMs:n})}pf(){var e;return!((e=this._instance)==null||(e=e.persistence)==null||(e=e.props)==null||!e[$g])}ff(){var e,t;return(e=this._instance)==null||e.pa==null||!e.pa()||!((t=De._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null||!t.config)}Iu(){var e;this.mf(),(e=this.rf)==null||e.clearQueue(),this.Jc=[]}bf(){this.Vc||this.mf()}gf(){var e,t=this;if(!this.Xc&&De!=null&&De.console){var n=G_((e=this._instance)==null||(e=e.config)==null?void 0:e.logs).maxBufferSize,r=function(o){var u;try{u=(d=>{for(;(f=d)!=null&&f.__rrweb_original__;){var f;d=d.__rrweb_original__}return d})(De.console[o])}catch{return 0}if(!u)return 0;t.Yc.push(mk(De.console,o,(d=>{var f=function(){for(var p=arguments.length,m=new Array(p),x=0;p>x;x++)m[x]=arguments[x];try{t._f(o,m,n)}catch{}return d.apply(De.console,m)};return f.__rrweb_original__=u,f})))};for(var a of x6)r(a);this.Xc=!0,this.wf=setTimeout((()=>{this.mf()}),3e4)}}_f(e,t,n){var r;if(this.Xc&&!this.tf&&t.length!==0)if((r=this._instance)!=null&&r.is_capturing()){if(n>this.Kc.length){this.tf=!0;try{this.Kc.push({level:e,args:t,occurredAtMs:Date.now(),context:this.af()})}finally{this.tf=!1}}}else this.mf()}mf(){if(this.Kc=[],this.Xc){for(var e of(this.Xc=!1,this.wf&&(clearTimeout(this.wf),this.wf=void 0),this.Yc))e();this.Yc=[]}}kf(){var e=this.Kc;return this.mf(),e}get logger(){return this.Sf||(this.Sf={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.Sf}flushLogs(e){e?this.xf(e):(this.if&&this.if.flush().catch((t=>this.Cf(t))),this.rf&&this.rf.flush().catch((t=>this.Cf(t))))}Cf(e){W_(e)||this.A.error("PostHog logs flush failed:",e)}loadIfEnabled(){if(!this.Os&&this.Vc&&!this.Gc&&!this.Zc){var e=De==null?void 0:De.__PosthogExtensions__;if(!e)return this.A.error("PostHog Extensions not found."),void this.mf();var t=e.loadExternalDependency;if(!t)return this.A.error(Fx),void this.mf();this.Zc=!0;try{t(this._instance,"logs",(n=>{if(this.Zc=!1,!this.Os&&this.Vc){var r=e.logs;if(n||r==null||!r.initializeLogs)this.A.error("Could not load logs script",n),this.mf();else{var a,o,u=this.kf();this.yf=r.initializeLogs((a=this.Ns)!==null&&a!==void 0?a:this._instance),this.Gc=!0,u.length>0&&(r.replayConsoleBuffer==null||r.replayConsoleBuffer((o=this.Ns)!==null&&o!==void 0?o:this._instance,u))}}}))}catch(n){throw this.Zc=!1,n}}}sf(e,t){var n=this._instance;return{get isDisabled(){return!1},get optedOut(){return!n.is_capturing()},getPersistedProperty:r=>r===ws.LogsQueue?e():void 0,setPersistedProperty(r,a){var o;r===ws.LogsQueue&&t((o=a)!==null&&o!==void 0?o:[])},hs:r=>this.hs(r),getLibraryId:()=>Pt.LIB_NAME,getLibraryVersion:()=>Pt.LIB_VERSION}}hs(e){return new Promise((t=>{if(P2(this._d,3))t({kind:"fatal",error:Hm(void 0,"logs endpoint is unreachable, dropping batch")});else{var n=!1,r=o=>{n||(n=!0,clearTimeout(a),t(o))},a=setTimeout((()=>{this.A.warn("Logs request timed out before receiving a response"),r({kind:"retry-later",error:Hm(void 0,"logs request timed out")})}),9e4);this._instance._send_request({method:"POST",url:this.Tf(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:o=>{var u=o.statusCode;if(this.Mf(u),u>=200&&300>u)r({kind:"ok"});else if(u===413)r({kind:"too-large"});else if(u!==0&&u!==408&&u!==429&&500>u)r({kind:"fatal",error:new Error("logs request failed with status "+u)});else{var d;u===0?(o.error||this.A.warn("Logs request failed before receiving an HTTP response"),r({kind:"retry-later",error:Hm(o.error,"logs request failed before receiving an HTTP response")})):r({kind:"retry-later",error:(d=o.error)!==null&&d!==void 0?d:new Error("logs request failed with status "+u)})}}})}}))}Mf(e){(e!==0||this._instance.__loaded)&&(this._d=$2(e,this._d,3,(()=>this.A.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes."))))}xf(e){this.ba.length>0&&this.If(e,this.ba,this.hf,Pt.LIB_NAME,(t=>{this.ba=t})),this.Jc.length>0&&this.If(e,this.Jc,this.cf,Y_,(t=>{this.Jc=t}))}If(e,t,n,r,a){if(t.length!==0){var o=t.map((d=>d.record));a([]);var u=u2(o,c2(n,Pt.LIB_NAME,Pt.LIB_VERSION),r,Pt.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Tf(),data:u,compression:"best-available",batchKey:"logs",transport:e})}}Tf(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}af(){var e,t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var n=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),r=n.windowId,a=n.sessionStartTimestamp,o=n.lastActivityTimestamp;t.sessionId=n.sessionId,t.windowId=r,Ye(a)||(t.sessionStartTimestamp=a),Ye(o)||(t.lastActivityTimestamp=o)}if(De!=null&&(e=De.location)!=null&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?Wi(De.location.href):De.location.href),this._instance.featureFlags){var u=this._instance.featureFlags.getFlags();u&&u.length>0&&(t.activeFeatureFlags=u)}return t}}},A6={metrics:class{constructor(e){this.A=Gt("[metrics]"),this._instance=e}initialize(){}lf(){var e,t,n=(e=this._instance)==null||(e=e.config)==null?void 0:e.metrics;return this.if&&this.uf===n||((t=this.if)==null||t.reset(),this.uf=n,this.if=new H4(this.sf(),(function(r){var a,o,u,d,f,p=r==null?void 0:r.resourceAttributes;return{serviceName:(a=p==null?void 0:p["service.name"])!==null&&a!==void 0?a:r==null?void 0:r.serviceName,serviceVersion:(o=p==null?void 0:p["service.version"])!==null&&o!==void 0?o:r==null?void 0:r.serviceVersion,environment:(u=p==null?void 0:p["deployment.environment"])!==null&&u!==void 0?u:r==null?void 0:r.environment,resourceAttributes:p,beforeSend:r==null?void 0:r.beforeSend,flushIntervalMs:(d=r==null?void 0:r.flushIntervalMs)!==null&&d!==void 0?d:1e4,maxSeriesPerFlush:(f=r==null?void 0:r.maxSeriesPerFlush)!==null&&f!==void 0?f:1e3}})(n),this.A)),this.if}count(e,t,n){t===void 0&&(t=1),this.lf().count(e,t,n)}gauge(e,t,n){this.lf().gauge(e,t,n)}histogram(e,t,n){this.lf().histogram(e,t,n)}flush(e){if(!this.if)return Promise.resolve();if(e){var t=this.if.drainWindow();return t&&this.Ms(t,e),Promise.resolve()}return this.if.flush().catch((n=>this.A.error("PostHog metrics flush failed:",n)))}reset(){var e;(e=this.if)==null||e.reset()}sf(){var e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},Ms:n=>t.Ms(n),getLibraryId:()=>Pt.LIB_NAME,getLibraryVersion:()=>Pt.LIB_VERSION}}Ms(e,t){return new Promise((n=>{var r=!1,a=u=>{r||(r=!0,clearTimeout(o),n(u))},o=setTimeout((()=>a({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(de({method:"POST",url:this.Ef(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t},{fireCallbackOnDrop:!0,callback(u){var d=u.statusCode;if(d>=200&&300>d)a({kind:"ok"});else if(d===413)a({kind:"too-large"});else if(d!==0&&d!==408&&d!==429&&500>d)a({kind:"fatal",error:new Error("metrics request failed with status "+d)});else{var f;a({kind:"retry-later",error:(f=u.error)!==null&&f!==void 0?f:new Error("metrics request failed with status "+d)})}}}))}))}Ef(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},T6=de({},Yh,v6,b6,y6,_6,w6,S6,k6,j6,N6,C6,E6,A6);jr.__defaultExtensionClasses=de({},T6);var Kc=(function(){Pt.SDK_DIST_CHANNEL="npm";var e=zc[Pl]=new jr;return(function(){function t(){t.done||(t.done=!0,fk=!1,Nt(zc,(function(n){n._dom_loaded()})))}pe!=null&&pe.addEventListener?pe.readyState==="complete"?t():Dt(pe,"DOMContentLoaded",t,{capture:!1}):te&&ye.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),e})();const M6="https://us.i.posthog.com",vk="cc-telemetry-enabled";let dx=!1,Zc=!1;function R6(){return M6}function D6(){if(typeof localStorage>"u")return!0;const e=localStorage.getItem(vk);return e===null?!0:e==="true"}function bk(e){dx&&(e?(Kc.opt_in_capturing({captureEventName:null}),Zc=!0):(Kc.opt_out_capturing(),Zc=!1))}function Dz(e){typeof localStorage<"u"&&localStorage.setItem(vk,String(e)),bk(e)}function L6(){const e=void 0;return e?(Kc.init(e,{api_host:R6(),defaults:"2026-01-30",capture_pageview:!1,capture_pageleave:!0,capture_exceptions:!0,autocapture:!0,respect_dnt:!0}),dx=!0,bk(D6()),!0):(dx=!1,Zc=!1,!1)}function Yx(e,t){Zc&&Kc.capture(e,t)}function Xi(e,t){Zc&&Kc.captureException(e,t)}function O6(e){Yx("$pageview",{$current_url:e})}const Ns="/api",yk="companion_auth_token";function Ki(){if(typeof window>"u")return{};const e=localStorage.getItem(yk);return e?{Authorization:`Bearer ${e}`}:{}}function Ba(e){e===401&&typeof window<"u"&&(localStorage.removeItem(yk),Vn(async()=>{const{useStore:t}=await Promise.resolve().then(()=>DC);return{useStore:t}},void 0).then(({useStore:t})=>{t.getState().logout()}).catch(()=>{}))}function yn(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}function su(e,t,n,r){Yx("api_request_succeeded",{method:e,path:t,status:r,duration_ms:Math.round(n)})}function Cs(e,t,n,r,a){Yx("api_request_failed",{method:e,path:t,status:a,duration_ms:Math.round(n),error:r instanceof Error?r.message:String(r)}),Xi(r,{method:e,path:t,status:a})}async function Fe(e,t){const n=yn();let r=!1;try{const a=await fetch(`${Ns}${e}`,{method:"POST",headers:{"Content-Type":"application/json",...Ki()},body:t?JSON.stringify(t):void 0});if(!a.ok){Ba(a.status);const o=await a.json().catch(()=>({error:a.statusText})),u=new Error(o.error||a.statusText);throw Cs("POST",e,yn()-n,u,a.status),r=!0,u}return su("POST",e,yn()-n,a.status),a.json()}catch(a){throw r||Cs("POST",e,yn()-n,a),a}}async function Me(e){const t=yn();let n=!1;try{const r=await fetch(`${Ns}${e}`,{headers:{...Ki()}});if(!r.ok){Ba(r.status);const a=await r.json().catch(()=>({error:r.statusText})),o=new Error(a.error||r.statusText);throw Cs("GET",e,yn()-t,o,r.status),n=!0,o}return su("GET",e,yn()-t,r.status),r.json()}catch(r){throw n||Cs("GET",e,yn()-t,r),r}}async function Vr(e,t){const n=yn();let r=!1;try{const a=await fetch(`${Ns}${e}`,{method:"PUT",headers:{"Content-Type":"application/json",...Ki()},body:t?JSON.stringify(t):void 0});if(!a.ok){Ba(a.status);const o=await a.json().catch(()=>({error:a.statusText})),u=new Error(o.error||a.statusText);throw Cs("PUT",e,yn()-n,u,a.status),r=!0,u}return su("PUT",e,yn()-n,a.status),a.json()}catch(a){throw r||Cs("PUT",e,yn()-n,a),a}}async function z6(e,t){const n=yn();let r=!1;try{const a=await fetch(`${Ns}${e}`,{method:"PATCH",headers:{"Content-Type":"application/json",...Ki()},body:t?JSON.stringify(t):void 0});if(!a.ok){Ba(a.status);const o=await a.json().catch(()=>({error:a.statusText})),u=new Error(o.error||a.statusText);throw Cs("PATCH",e,yn()-n,u,a.status),r=!0,u}return su("PATCH",e,yn()-n,a.status),a.json()}catch(a){throw r||Cs("PATCH",e,yn()-n,a),a}}async function Gr(e,t){const n=yn();let r=!1;try{const a=await fetch(`${Ns}${e}`,{method:"DELETE",headers:{...t?{"Content-Type":"application/json"}:{},...Ki()},body:t?JSON.stringify(t):void 0});if(!a.ok){Ba(a.status);const o=await a.json().catch(()=>({error:a.statusText})),u=new Error(o.error||a.statusText);throw Cs("DELETE",e,yn()-n,u,a.status),r=!0,u}return su("DELETE",e,yn()-n,a.status),a.json()}catch(a){throw r||Cs("DELETE",e,yn()-n,a),a}}async function B6(e,t){const n=await fetch(`${Ns}/sessions/create-stream`,{method:"POST",headers:{"Content-Type":"application/json",...Ki()},body:JSON.stringify(e??{})});if(!n.ok||!n.body){const d=await n.json().catch(()=>({error:n.statusText}));throw new Error(d.error||n.statusText)}const r=n.body.getReader(),a=new TextDecoder;let o="",u=null;for(;;){const{done:d,value:f}=await r.read();if(d)break;o+=a.decode(f,{stream:!0});const p=o.split(`
|
|
69
|
+
|
|
70
|
+
`);o=p.pop()||"";for(const m of p){if(!m.trim())continue;let x="",b="";for(const _ of m.split(`
|
|
71
|
+
`))_.startsWith("event:")?x=_.slice(6).trim():_.startsWith("data:")&&(b=_.slice(5).trim());if(!b)continue;const y=JSON.parse(b);if(x==="progress")t(y);else if(x==="done")u=y;else if(x==="error")throw new Error(y.error||"Session creation failed")}}if(!u)throw new Error("Stream ended without session creation result");return u}async function P6(){try{const e=await fetch(`${Ns}/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 Q_(e){try{const t=await fetch(`${Ns}/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 je={getAuthQr:()=>Me("/auth/qr"),getAuthToken:()=>Me("/auth/token"),regenerateAuthToken:()=>Fe("/auth/regenerate"),createSession:e=>Fe("/sessions/create",e),listSessions:()=>Me("/sessions"),discoverClaudeSessions:(e=200)=>Me(`/claude/sessions/discover?limit=${encodeURIComponent(String(e))}`),getClaudeSessionHistory:(e,t)=>{const n=Math.max(0,Math.floor((t==null?void 0:t.cursor)??0)),r=Math.max(1,Math.floor((t==null?void 0:t.limit)??40));return Me(`/claude/sessions/${encodeURIComponent(e)}/history?cursor=${encodeURIComponent(String(n))}&limit=${encodeURIComponent(String(r))}`)},killSession:e=>Fe(`/sessions/${encodeURIComponent(e)}/kill`),deleteSession:e=>Gr(`/sessions/${encodeURIComponent(e)}`),relaunchSession:e=>Fe(`/sessions/${encodeURIComponent(e)}/relaunch`),exportSession:async(e,t)=>{const n=await fetch(`${Ns}/sessions/${encodeURIComponent(e)}/export?format=${t}`,{headers:{...Ki()}});if(!n.ok)throw Ba(n.status),new Error(`Export failed (${n.status})`);const r=await n.blob(),o=(n.headers.get("Content-Disposition")||"").match(/filename="?([^"]+)"?/),u=(o==null?void 0:o[1])||`session.${t}`;return{blob:r,filename:u}},archiveSession:(e,t)=>Fe(`/sessions/${encodeURIComponent(e)}/archive`,t),getArchiveInfo:e=>Me(`/sessions/${encodeURIComponent(e)}/archive-info`),unarchiveSession:e=>Fe(`/sessions/${encodeURIComponent(e)}/unarchive`),renameSession:(e,t)=>z6(`/sessions/${encodeURIComponent(e)}/name`,{name:t}),listDirs:e=>Me(`/fs/list${e?`?path=${encodeURIComponent(e)}`:""}`),getHome:()=>Me("/fs/home"),listEnvs:()=>Me("/envs"),getEnv:e=>Me(`/envs/${encodeURIComponent(e)}`),createEnv:(e,t)=>Fe("/envs",{name:e,variables:t}),updateEnv:(e,t)=>Vr(`/envs/${encodeURIComponent(e)}`,t),deleteEnv:e=>Gr(`/envs/${encodeURIComponent(e)}`),listSandboxes:()=>Me("/sandboxes"),getSandbox:e=>Me(`/sandboxes/${encodeURIComponent(e)}`),createSandbox:(e,t)=>Fe("/sandboxes",{name:e,...t}),updateSandbox:(e,t)=>Vr(`/sandboxes/${encodeURIComponent(e)}`,t),deleteSandbox:e=>Gr(`/sandboxes/${encodeURIComponent(e)}`),testInitScript:(e,t,n)=>Fe(`/sandboxes/${encodeURIComponent(e)}/test-init`,{cwd:t,initScript:n}),buildBaseImage:()=>Fe("/docker/build-base"),getBaseImageStatus:()=>Me("/docker/base-image"),getSettings:()=>Me("/settings"),updateSettings:e=>Vr("/settings",e),verifyAnthropicKey:e=>Fe("/settings/anthropic/verify",{apiKey:e}),getCodexAccount:()=>Me("/codex/auth/account"),getCodexLoginStatus:()=>Me("/codex/auth/login"),startCodexLogin:()=>Fe("/codex/auth/login"),cancelCodexLogin:()=>Fe("/codex/auth/login/cancel"),codexLogout:()=>Fe("/codex/auth/logout"),getDashboard:()=>Me("/dashboard"),runDashboardUpdate:()=>Fe("/dashboard/run"),getDashboardRunStatus:()=>Me("/dashboard/run/status"),getTailscaleStatus:()=>Me("/tailscale/status"),startTailscaleFunnel:()=>Fe("/tailscale/funnel/start"),stopTailscaleFunnel:()=>Fe("/tailscale/funnel/stop"),listLinearConnections:()=>Me("/linear/connections"),createLinearConnection:e=>Fe("/linear/connections",e),updateLinearConnection:(e,t)=>Vr(`/linear/connections/${encodeURIComponent(e)}`,t),deleteLinearConnection:e=>Gr(`/linear/connections/${encodeURIComponent(e)}`),verifyLinearConnection:e=>Fe(`/linear/connections/${encodeURIComponent(e)}/verify`,{}),searchLinearIssues:(e,t=8,n)=>Me(`/linear/issues?query=${encodeURIComponent(e)}&limit=${encodeURIComponent(String(t))}${n?`&connectionId=${encodeURIComponent(n)}`:""}`),getLinearConnection:e=>Me(`/linear/connection${e?`?connectionId=${encodeURIComponent(e)}`:""}`),getLinearStates:e=>Me(`/linear/states${e?`?connectionId=${encodeURIComponent(e)}`:""}`),transitionLinearIssue:(e,t)=>Fe(`/linear/issues/${encodeURIComponent(e)}/transition${t?`?connectionId=${encodeURIComponent(t)}`:""}`,{}),listLinearProjects:e=>Me(`/linear/projects${e?`?connectionId=${encodeURIComponent(e)}`:""}`),getLinearProjectIssues:(e,t=15,n)=>Me(`/linear/project-issues?projectId=${encodeURIComponent(e)}&limit=${encodeURIComponent(String(t))}${n?`&connectionId=${encodeURIComponent(n)}`:""}`),getLinearProjectMapping:e=>Me(`/linear/project-mappings?repoRoot=${encodeURIComponent(e)}`),upsertLinearProjectMapping:e=>Vr("/linear/project-mappings",e),removeLinearProjectMapping:e=>Gr("/linear/project-mappings",{repoRoot:e}),linkLinearIssue:(e,t,n)=>Vr(`/sessions/${encodeURIComponent(e)}/linear-issue`,{...t,...n!==void 0?{connectionId:n}:{}}),unlinkLinearIssue:e=>Gr(`/sessions/${encodeURIComponent(e)}/linear-issue`),getLinkedLinearIssue:(e,t=!1)=>Me(`/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=>Me(`/git/repo-info?path=${encodeURIComponent(e)}`),listBranches:e=>Me(`/git/branches?repoRoot=${encodeURIComponent(e)}`),gitFetch:e=>Fe("/git/fetch",{repoRoot:e}),gitPull:e=>Fe("/git/pull",{cwd:e}),listWorktrees:e=>Me(`/git/worktrees?repoRoot=${encodeURIComponent(e)}`),createWorktree:(e,t,n)=>Fe("/git/worktree",{repoRoot:e,branch:t,...n}),removeWorktree:(e,t,n)=>Gr("/git/worktree",{repoRoot:e,worktreePath:t,force:n}),getPRStatus:(e,t)=>Me(`/git/pr-status?cwd=${encodeURIComponent(e)}&branch=${encodeURIComponent(t)}`),getBackends:()=>Me("/backends"),getBackendModels:e=>Me(`/backends/${encodeURIComponent(e)}/models`),getContainerStatus:()=>Me("/containers/status"),getContainerImages:()=>Me("/containers/images"),getImageStatus:e=>Me(`/images/${encodeURIComponent(e)}/status`),pullImage:e=>Fe(`/images/${encodeURIComponent(e)}/pull`),getCloudProviderPlan:(e,t,n)=>Me(`/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=>Me(`/fs/tree?path=${encodeURIComponent(e)}`),readFile:e=>Me(`/fs/read?path=${encodeURIComponent(e)}`),getFileBlob:async e=>{const t=await fetch(`${Ns}/fs/raw?path=${encodeURIComponent(e)}`,{headers:{...Ki()}});if(!t.ok){Ba(t.status);const r=await t.json().catch(()=>({error:t.statusText}));throw new Error(r.error||t.statusText)}const n=await t.blob();return URL.createObjectURL(n)},writeFile:(e,t)=>Vr("/fs/write",{path:e,content:t}),getFileDiff:(e,t)=>Me(`/fs/diff?path=${encodeURIComponent(e)}${t?`&base=${encodeURIComponent(t)}`:""}`),getChangedFiles:(e,t)=>Me(`/fs/changed-files?cwd=${encodeURIComponent(e)}${t?`&base=${encodeURIComponent(t)}`:""}`),getClaudeMdFiles:e=>Me(`/fs/claude-md?cwd=${encodeURIComponent(e)}`),saveClaudeMd:(e,t)=>Vr("/fs/claude-md",{path:e,content:t}),getClaudeConfig:e=>Me(`/fs/claude-config?cwd=${encodeURIComponent(e)}`),getUsageLimits:()=>Me("/usage-limits"),getSessionUsageLimits:e=>Me(`/sessions/${encodeURIComponent(e)}/usage-limits`),getSystemMemory:()=>Me("/system/memory"),getSystemDisk:()=>Me("/system/disk"),spawnTerminal:(e,t,n,r)=>Fe("/terminal/spawn",{cwd:e,cols:t,rows:n,containerId:r==null?void 0:r.containerId}),killTerminal:e=>Fe("/terminal/kill",{terminalId:e}),getTerminal:e=>Me(e?`/terminal?terminalId=${encodeURIComponent(e)}`:"/terminal"),checkForUpdate:()=>Me("/update-check"),forceCheckForUpdate:()=>Fe("/update-check"),triggerUpdate:()=>Fe("/update"),getClaudeCompat:()=>Me("/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:()=>Me("/cron/jobs"),getCronJob:e=>Me(`/cron/jobs/${encodeURIComponent(e)}`),createCronJob:e=>Fe("/cron/jobs",e),updateCronJob:(e,t)=>Vr(`/cron/jobs/${encodeURIComponent(e)}`,t),deleteCronJob:e=>Gr(`/cron/jobs/${encodeURIComponent(e)}`),toggleCronJob:e=>Fe(`/cron/jobs/${encodeURIComponent(e)}/toggle`),runCronJob:e=>Fe(`/cron/jobs/${encodeURIComponent(e)}/run`),getCronJobExecutions:e=>Me(`/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=>Me(`/sessions/${encodeURIComponent(e)}/processes/system`),killSystemProcess:(e,t)=>Fe(`/sessions/${encodeURIComponent(e)}/processes/system/${t}/kill`),listAgents:()=>Me("/agents"),getAgent:e=>Me(`/agents/${encodeURIComponent(e)}`),createAgent:e=>Fe("/agents",e),updateAgent:(e,t)=>Vr(`/agents/${encodeURIComponent(e)}`,t),deleteAgent:e=>Gr(`/agents/${encodeURIComponent(e)}`),toggleAgent:e=>Fe(`/agents/${encodeURIComponent(e)}/toggle`),runAgent:(e,t)=>Fe(`/agents/${encodeURIComponent(e)}/run`,{input:t}),getAgentExecutions:e=>Me(`/agents/${encodeURIComponent(e)}/executions`),importAgent:e=>Fe("/agents/import",e),exportAgent:e=>Me(`/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 Me(`/executions${n?`?${n}`:""}`)},getLinearOAuthStatus:e=>{const t=new URLSearchParams;e&&t.set("stagingId",e);const n=t.toString();return Me(`/linear/oauth/status${n?`?${n}`:""}`)},getLinearOAuthAuthorizeUrl:(e,t)=>{const n=new URLSearchParams;e&&n.set("returnTo",e),t&&n.set("stagingId",t);const r=n.toString();return Me(`/linear/oauth/authorize-url${r?`?${r}`:""}`)},disconnectLinearOAuth:()=>Fe("/linear/oauth/disconnect"),createLinearStaging:e=>Fe("/linear/oauth/staging",e),getLinearStagingStatus:e=>Me(`/linear/oauth/staging/${encodeURIComponent(e)}/status`),deleteLinearStaging:e=>Gr(`/linear/oauth/staging/${encodeURIComponent(e)}`),listLinearOAuthConnections:()=>Me("/linear/oauth-connections"),createLinearOAuthConnection:e=>Fe("/linear/oauth-connections",e),updateLinearOAuthConnection:(e,t)=>Vr(`/linear/oauth-connections/${encodeURIComponent(e)}`,t),deleteLinearOAuthConnection:e=>Gr(`/linear/oauth-connections/${encodeURIComponent(e)}`),getLinearOAuthConnectionAuthorizeUrl:(e,t)=>Me(`/linear/oauth-connections/${encodeURIComponent(e)}/authorize-url${t?`?returnTo=${encodeURIComponent(t)}`:""}`),listSkills:()=>Me("/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 r=n.toString();return Me(`/prompts${r?`?${r}`:""}`)},createPrompt:e=>Fe("/prompts",e),updatePrompt:(e,t)=>Vr(`/prompts/${encodeURIComponent(e)}`,t),deletePrompt:e=>Gr(`/prompts/${encodeURIComponent(e)}`)};let X_=!1;function K_(e){return new Promise((t,n)=>{if(typeof document>"u"||typeof document.execCommand!="function"){n(new Error("Clipboard fallback is unavailable"));return}try{const r=document.createElement("textarea");r.value=e,r.setAttribute("readonly",""),r.style.position="fixed",r.style.left="-9999px",document.body.appendChild(r),r.select();const a=document.execCommand("copy");if(document.body.removeChild(r),!a){n(new Error("Copy command was rejected"));return}t()}catch(r){n(r instanceof Error?r:new Error("Clipboard copy failed"))}})}function Z_(){return new Promise(()=>{})}function $6(){if(X_||typeof window>"u")return;X_=!0;const e=window.navigator,t=e.clipboard;if(t!=null&&t.writeText){const n=t.writeText.bind(t);try{t.writeText=async r=>{try{await n(r)}catch{try{await K_(r)}catch{return Z_()}}}}catch{}return}try{Object.defineProperty(e,"clipboard",{configurable:!0,value:{writeText:async n=>{try{await K_(n)}catch{return Z_()}}}})}catch{}}const J_="#/session/",e5="#/agents/";let t5=!1;function Wx(){t5||($6(),t5=!0)}function Qx(e){if(Wx(),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(e5)){const n=e.slice(e5.length);if(n)return{page:"agent-detail",agentId:n}}if(e.startsWith(J_)){const n=e.slice(J_.length);if(n)return{page:"session",sessionId:n}}return{page:"home"}}function F6(e){return`#/session/${e}`}function Xx(e,t=!1){Wx();const n=F6(e);t?(history.replaceState(null,"",n),window.dispatchEvent(new HashChangeEvent("hashchange"))):window.location.hash=`/session/${e}`}function qm(e=!1){Wx(),e?(history.replaceState(null,"",window.location.pathname+window.location.search),window.dispatchEvent(new HashChangeEvent("hashchange"))):window.location.hash=""}function U6(){const[e,t]=k.useState(""),[n,r]=k.useState(null),[a,o]=k.useState(!1),u=G(m=>m.setAuthToken),d=k.useCallback(async m=>{m.preventDefault();const x=e.trim();if(!x){r("Please enter a token");return}o(!0),r(null),await Q_(x)?u(x):r("Invalid token"),o(!1)},[e,u]);k.useEffect(()=>{P6().then(m=>{if(m){u(m);return}const b=new URLSearchParams(window.location.search).get("token");b&&(o(!0),Q_(b).then(y=>{if(y){u(b);const _=new URL(window.location.href);_.searchParams.delete("token"),window.history.replaceState({},"",_.toString())}else r("Invalid token from URL"),o(!1)}))})},[u]);const[f,p]=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:d,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:m=>{t(m.target.value),r(null)},placeholder:"Paste your token here",className:"w-full px-3 py-2 pr-16 text-sm bg-cc-hover border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted/50 focus:outline-none focus:ring-1 focus:ring-cc-primary focus:border-cc-primary font-mono",autoComplete:"off",disabled:a}),l.jsx("button",{type:"button",onClick:()=>p(!f),className:"absolute right-2 top-1/2 -translate-y-1/2 text-[11px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer px-1.5 py-0.5 rounded hover:bg-cc-hover",tabIndex:-1,children:f?"Hide":"Show"})]})]}),n&&l.jsx("p",{className:"text-xs text-cc-error",role:"alert",children:n}),l.jsx("button",{type:"submit",disabled:a||!e.trim(),className:"w-full py-2 px-4 text-sm font-medium bg-cc-primary text-white rounded-md hover:opacity-90 disabled:opacity-50 transition-opacity cursor-pointer disabled:cursor-not-allowed",children:a?"Verifying...":"Login"})]}),l.jsx("p",{className:"mt-6 text-[11px] text-cc-muted text-center leading-relaxed",children:"Scan the QR code in Settings with your phone camera to authenticate, or find your token in the server console."})]})})}var lo=dw();function I6({issueIdentifier:e,issueStateName:t,isContainerized:n,archiveTransitionConfigured:r,archiveTransitionStateName:a,hasBacklogState:o,onConfirm:u,onCancel:d}){const[f,p]=k.useState("none");return lo.createPortal(l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:d,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:m=>m.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:d,className:"inline-flex h-6 w-6 items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]}),n&&l.jsx("div",{className:"mb-3 p-2.5 rounded-lg bg-amber-500/10 border border-amber-500/20",children:l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-amber-500 shrink-0 mt-0.5",children:l.jsx("path",{d:"M8.982 1.566a1.13 1.13 0 00-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 01-1.1 0L7.1 5.995A.905.905 0 018 5zm.002 6a1 1 0 110 2 1 1 0 010-2z"})}),l.jsxs("p",{className:"text-[11px] text-cc-fg leading-snug",children:["Archiving will ",l.jsx("strong",{children:"remove the container"})," and any uncommitted changes."]})]})}),l.jsxs("p",{className:"text-xs text-cc-muted mb-3",children:["This session is linked to ",l.jsx("strong",{className:"text-cc-fg",children:e})," ",l.jsxs("span",{className:"text-cc-muted",children:["(",t,")"]}),". What should happen to the issue?"]}),l.jsxs("fieldset",{className:"space-y-2 mb-4",children:[l.jsx("legend",{className:"sr-only",children:"Linear issue transition choice"}),l.jsxs("label",{className:"flex items-center gap-2.5 px-2.5 py-2 rounded-lg border border-cc-border hover:bg-cc-hover/50 transition-colors cursor-pointer",children:[l.jsx("input",{type:"radio",name:"archive-linear-choice",value:"none",checked:f==="none",onChange:()=>p("none"),className:"accent-cc-primary"}),l.jsx("span",{className:"text-xs text-cc-fg",children:"Keep current status"})]}),l.jsxs("label",{className:`flex items-center gap-2.5 px-2.5 py-2 rounded-lg border border-cc-border transition-colors ${o?"hover:bg-cc-hover/50 cursor-pointer":"opacity-50 cursor-not-allowed"}`,children:[l.jsx("input",{type:"radio",name:"archive-linear-choice",value:"backlog",checked:f==="backlog",onChange:()=>p("backlog"),disabled:!o,className:"accent-cc-primary"}),l.jsx("span",{className:"text-xs text-cc-fg",children:"Move to Backlog"})]}),r&&a&&l.jsxs("label",{className:"flex items-center gap-2.5 px-2.5 py-2 rounded-lg border border-cc-border hover:bg-cc-hover/50 transition-colors cursor-pointer",children:[l.jsx("input",{type:"radio",name:"archive-linear-choice",value:"configured",checked:f==="configured",onChange:()=>p("configured"),className:"accent-cc-primary"}),l.jsxs("span",{className:"text-xs text-cc-fg",children:["Move to ",a]})]})]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("button",{type:"button",onClick:d,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 H6(e,t){return t>0?"awaiting":(e.status==="running"||e.status==="compacting")&&e.isConnected?"running":e.isReconnecting?"reconnecting":e.isConnected?"idle":"exited"}function q6({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 V6({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 ah({session:e,isActive:t,isArchived:n,sessionName:r,permCount:a,isRecentlyRenamed:o,onSelect:u,onStartRename:d,onArchive:f,onUnarchive:p,onDelete:m,onClearRecentlyRenamed:x,editingSessionId:b,editingName:y,setEditingName:_,onConfirmRename:j,onCancelRename:N,editInputRef:w}){const E=e.id.slice(0,8),C=r||e.model||E,T=b===e.id,[O,z]=k.useState(!1),I=k.useRef(null),U=k.useRef(null),Z=n?"exited":H6(e,a),L=e.cwd||"";k.useEffect(()=>{if(!O)return;function M(X){var Y;I.current&&!I.current.contains(X.target)&&U.current&&!U.current.contains(X.target)&&(z(!1),(Y=U.current)==null||Y.focus())}function ie(X){var Y,P,$;if(X.key==="Escape"){z(!1),(Y=U.current)==null||Y.focus();return}if(X.key==="Tab"){z(!1);return}if((X.key==="ArrowDown"||X.key==="ArrowUp")&&((P=I.current)!=null&&P.contains(document.activeElement)||U.current===document.activeElement)){X.preventDefault();const re=($=I.current)==null?void 0:$.querySelectorAll("[role='menuitem']");if(!re||re.length===0)return;const ae=document.activeElement,D=Array.from(re).indexOf(ae);X.key==="ArrowDown"?re[D<re.length-1?D+1:0].focus():re[D>0?D-1:re.length-1].focus()}}return document.addEventListener("mousedown",M),document.addEventListener("touchstart",M),document.addEventListener("keydown",ie),()=>{document.removeEventListener("mousedown",M),document.removeEventListener("touchstart",M),document.removeEventListener("keydown",ie)}},[O]),k.useEffect(()=>{O&&requestAnimationFrame(()=>{var M,ie;(ie=(M=I.current)==null?void 0:M.querySelector("[role='menuitem']"))==null||ie.focus()})},[O]);const q=k.useCallback(M=>{z(!1),M()},[]);return l.jsxs("div",{className:"relative group",children:[l.jsxs("button",{onClick:()=>u(e.id),onDoubleClick:M=>{M.preventDefault(),d(e.id,C)},onKeyDown:M=>{M.key==="F2"&&!T&&(M.preventDefault(),d(e.id,C))},className:`w-full flex items-center gap-2 py-2 pl-2.5 pr-12 min-h-[44px] rounded-lg transition-all duration-100 cursor-pointer relative ${t?"bg-cc-active":"hover:bg-cc-hover"}`,children:[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"}`}),!T&&l.jsx(q6,{status:Z}),T?l.jsx("input",{ref:w,value:y,onChange:M=>_(M.target.value),onKeyDown:M=>{M.key==="Enter"?(M.preventDefault(),j()):M.key==="Escape"&&(M.preventDefault(),N()),M.stopPropagation()},onBlur:j,onClick:M=>M.stopPropagation(),onDoubleClick:M=>M.stopPropagation(),className:"text-[12.5px] font-medium flex-1 min-w-0 text-cc-fg bg-transparent border border-cc-border rounded-md px-2 py-1 outline-none focus:border-cc-primary/50 focus:ring-1 focus:ring-cc-primary/20"}):l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("span",{className:`text-[12.5px] font-medium truncate block leading-snug ${t?"text-cc-fg":"text-cc-fg/90"} ${o?"animate-name-appear":""}`,onAnimationEnd:()=>x(e.id),children:C}),L&&l.jsx("span",{className:"text-[10px] text-cc-muted/70 truncate block leading-tight mt-px",children:L})]}),!T&&l.jsxs("span",{className:"flex items-center gap-1 shrink-0",children:[l.jsx(V6,{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&&!T&&!O&&l.jsx("button",{onClick:M=>{M.stopPropagation(),f(M,e.id)},className:"absolute right-7 top-1/2 -translate-y-1/2 p-1 rounded-md opacity-0 pointer-events-none sm:group-hover:opacity-100 sm:group-hover:pointer-events-auto hover:bg-cc-border text-cc-muted hover:text-cc-fg transition-all cursor-pointer",title:"Archive","aria-label":"Archive session",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M2 4a1 1 0 011-1h10a1 1 0 011 1v1H2V4zm1 2h10v6a1 1 0 01-1 1H4a1 1 0 01-1-1V6zm3 2a.5.5 0 000 1h4a.5.5 0 000-1H6z"})})}),l.jsx("button",{ref:U,onClick:M=>{M.stopPropagation(),z(!O)},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":O,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"})]})}),O&&l.jsxs("div",{ref:I,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:()=>q(()=>d(e.id,C)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted",children:l.jsx("path",{d:"M12.146.854a.5.5 0 00-.707 0L3.714 8.579a.5.5 0 00-.138.242l-.777 3.11a.5.5 0 00.607.607l3.11-.777a.5.5 0 00.242-.138L14.573 3.854a.5.5 0 000-.708L12.146.854z"})}),"Rename"]}),n?l.jsxs(l.Fragment,{children:[l.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:M=>q(()=>p(M,e.id)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted",children:[l.jsx("path",{d:"M8 4a.5.5 0 01.5.5v3.793l1.854-1.853a.5.5 0 01.707.707l-2.828 2.828a.5.5 0 01-.707 0L4.697 7.147a.5.5 0 01.707-.707L7.5 8.293V4.5A.5.5 0 018 4z"}),l.jsx("path",{d:"M2 12.5A1.5 1.5 0 003.5 14h9a1.5 1.5 0 001.5-1.5v-2a.5.5 0 00-1 0v2a.5.5 0 01-.5.5h-9a.5.5 0 01-.5-.5v-2a.5.5 0 00-1 0v2z"})]}),"Restore"]}),l.jsx("div",{className:"my-1 mx-2 border-t border-cc-border/50"}),l.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:M=>q(()=>m(M,e.id)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-error hover:bg-cc-error/5 transition-colors cursor-pointer flex items-center gap-2",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:[l.jsx("path",{d:"M5.5 5.5A.5.5 0 016 6v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm2.5 0a.5.5 0 01.5.5v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm3 .5a.5.5 0 00-1 0v6a.5.5 0 001 0V6z"}),l.jsx("path",{fillRule:"evenodd",d:"M14.5 3a1 1 0 01-1 1H13v9a2 2 0 01-2 2H5a2 2 0 01-2-2V4h-.5a1 1 0 010-2H6a1 1 0 011-1h2a1 1 0 011 1h3.5a1 1 0 011 1zM4.118 4L4 4.059V13a1 1 0 001 1h6a1 1 0 001-1V4.059L11.882 4H4.118zM6 2h4v1H6V2z",clipRule:"evenodd"})]}),"Delete"]})]}):l.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:M=>q(()=>f(M,e.id)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted",children:l.jsx("path",{d:"M2 4a1 1 0 011-1h10a1 1 0 011 1v1H2V4zm1 2h10v6a1 1 0 01-1 1H4a1 1 0 01-1-1V6zm3 2a.5.5 0 000 1h4a.5.5 0 000-1H6z"})}),"Archive"]})]})]})}function G6({group:e,isCollapsed:t,onToggleCollapse:n,currentSessionId:r,sessionNames:a,pendingPermissions:o,recentlyRenamed:u,onSelect:d,onStartRename:f,onArchive:p,onUnarchive:m,onDelete:x,onClearRecentlyRenamed:b,editingSessionId:y,editingName:_,setEditingName:j,onConfirmRename:N,onCancelRename:w,editInputRef:E,isFirst:C}){const T=t?e.sessions.slice(0,2).map(O=>a.get(O.id)||O.model||O.id.slice(0,8)).join(", ")+(e.sessions.length>2?", ...":""):"";return l.jsxs("div",{className:C?"":"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&&T&&l.jsx("div",{className:"text-[10px] text-cc-muted/70 truncate pl-5 pb-0.5",children:T}),!t&&l.jsx("div",{className:"mt-0.5",children:e.sessions.map(O=>{var I;const z=((I=o.get(O.id))==null?void 0:I.size)??0;return l.jsx(ah,{session:O,isActive:r===O.id,sessionName:a.get(O.id),permCount:z,isRecentlyRenamed:u.has(O.id),onSelect:d,onStartRename:f,onArchive:p,onUnarchive:m,onDelete:x,onClearRecentlyRenamed:b,editingSessionId:y,editingName:_,setEditingName:j,onConfirmRename:N,onCancelRename:w,editInputRef:E},O.id)})})]})}function Y6(e,t,n=!1){return(n&&!!t&&(t==="/workspace"||t.startsWith("/workspace/"))?e:t||e).replace(/\/+$/,"")||"/"}function W6(e){if(e==="/")return"/";const t=e.split("/").filter(Boolean);return t.length===0?"/":t[t.length-1]}function Q6(e){const t=new Map;for(const r of e){const a=Y6(r.cwd,r.repoRoot||void 0,r.isContainerized),o=W6(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(r),r.status==="running"&&u.runningCount++,u.permCount+=r.permCount,u.mostRecentActivity=Math.max(u.mostRecentActivity,r.createdAt)}const n=Array.from(t.values()).sort((r,a)=>r.label.localeCompare(a.label));for(const r of n)r.sessions.sort((a,o)=>o.createdAt-a.createdAt);return n}const X6=[{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"}],K6=[{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"}],Z6=[{id:"workbench",label:"Workbench",itemIds:["dashboard","prompts","integrations"]},{id:"workspace",label:"Workspace",itemIds:["environments","sandboxes","agents","settings"]}],J6=new Map(K6.map(e=>[e.id,e]));function eA(){var Kr,Zr;const[e,t]=k.useState(null),[n,r]=k.useState(""),[a,o]=k.useState(!1),[u,d]=k.useState(null),[f,p]=k.useState(null),[m,x]=k.useState(null),[b,y]=k.useState(!1),[_,j]=k.useState(null),[N,w]=k.useState(!1),[E,C]=k.useState(()=>typeof window<"u"?window.location.hash:""),T=k.useRef(null),O=k.useRef(null),z=G(ne=>ne.sessions),I=G(ne=>ne.sdkSessions),U=G(ne=>ne.currentSessionId),Z=G(ne=>ne.cliConnected),L=G(ne=>ne.cliReconnecting),q=G(ne=>ne.sessionStatus),M=G(ne=>ne.removeSession),ie=G(ne=>ne.sessionNames),X=G(ne=>ne.recentlyRenamed),Y=G(ne=>ne.clearRecentlyRenamed),P=G(ne=>ne.pendingPermissions),$=G(ne=>ne.linkedLinearIssues),re=G(ne=>ne.collapsedProjects),ae=G(ne=>ne.toggleProjectCollapse),D=Qx(E);k.useEffect(()=>{let ne=!0;async function ve(){try{const Ke=await je.listSessions();if(ne){const qt=G.getState();qt.setSdkSessions(Ke);const fn=G.getState(),$n=new Set(Ke.map(Vt=>Vt.sessionId));for(const Vt of fn.sessions.keys())!$n.has(Vt)&&fn.connectionStatus.get(Vt)!=="connected"&&fn.removeSession(Vt);z3(Ke);for(const Vt of Ke)if(Vt.name&&(!qt.sessionNames.has(Vt.sessionId)||/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(qt.sessionNames.get(Vt.sessionId)))){const Yn=qt.sessionNames.get(Vt.sessionId),Tr=!!Yn&&/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(Yn);Yn!==Vt.name&&(qt.setSessionName(Vt.sessionId,Vt.name),Tr&&qt.markRecentlyRenamed(Vt.sessionId))}}}catch{}}ve();const _e=setInterval(ve,5e3);return()=>{ne=!1,clearInterval(_e)}},[]),k.useEffect(()=>{const ne=()=>C(window.location.hash);return window.addEventListener("hashchange",ne),()=>window.removeEventListener("hashchange",ne)},[]);function B(ne){Xx(ne),window.innerWidth<768&&G.getState().setSidebarOpen(!1)}function Q(){qm(),G.getState().newSession(),window.innerWidth<768&&G.getState().setSidebarOpen(!1)}k.useEffect(()=>{e&&T.current&&(T.current.focus(),T.current.select())},[e]);function R(){e&&n.trim()&&(G.getState().setSessionName(e,n.trim()),je.renameSession(e,n.trim()).catch(()=>{})),t(null),r("")}function me(){t(null),r("")}function be(ne,ve){t(ne),r(ve)}const Ce=k.useCallback((ne,ve)=>{ne.stopPropagation(),j(ve)},[]),Le=k.useCallback(async ne=>{try{_g(ne),await je.deleteSession(ne)}catch{}G.getState().currentSessionId===ne&&qm(),M(ne)},[M]),Ee=k.useCallback(()=>{_&&(Le(_),j(null))},[_,Le]),Ae=k.useCallback(()=>{j(null)},[]),Ue=k.useCallback(()=>{w(!0)},[]),dt=k.useCallback(async()=>{w(!1);const ne=G.getState(),ve=new Set;for(const Ke of ne.sessions.keys())ve.add(Ke);for(const Ke of ne.sdkSessions)ve.add(Ke.sessionId);const _e=Array.from(ve).filter(Ke=>{const qt=ne.sdkSessions.find(fn=>fn.sessionId===Ke);return(qt==null?void 0:qt.archived)??!1});for(const Ke of _e)await Le(Ke)},[Le]),Je=k.useCallback(()=>{w(!1)},[]);k.useEffect(()=>{if(!_&&!N)return;requestAnimationFrame(()=>{var ve,_e;(_e=(ve=O.current)==null?void 0:ve.querySelector("button"))==null||_e.focus()});function ne(ve){var fn;if(ve.key==="Escape"){N?Je():Ae();return}if(ve.key!=="Tab")return;const _e=(fn=O.current)==null?void 0:fn.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(!_e||_e.length===0)return;const Ke=_e[0],qt=_e[_e.length-1];ve.shiftKey&&document.activeElement===Ke?(ve.preventDefault(),qt.focus()):!ve.shiftKey&&document.activeElement===qt&&(ve.preventDefault(),Ke.focus())}return document.addEventListener("keydown",ne),()=>document.removeEventListener("keydown",ne)},[_,N,Ae,Je]);const At=k.useCallback(async(ne,ve)=>{ne.stopPropagation();const _e=I.find(Yn=>Yn.sessionId===ve),Ke=z.get(ve),qt=(Ke==null?void 0:Ke.is_containerized)||!!(_e!=null&&_e.containerId)||!1,fn=$.get(ve),$n=((fn==null?void 0:fn.stateType)||"").toLowerCase();if(fn&&!($n==="completed"||$n==="canceled"||$n==="cancelled"))try{const Yn=await je.getArchiveInfo(ve);if(Yn.issueNotDone){p(ve),x(Yn),y(qt);return}}catch{}if(qt){d(ve);return}mt(ve)},[I,z,$]),mt=k.useCallback(async(ne,ve,_e)=>{try{_g(ne);const Ke={};ve&&(Ke.force=!0),_e&&_e!=="none"&&(Ke.linearTransition=_e),await je.archiveSession(ne,Object.keys(Ke).length>0?Ke:void 0)}catch{}G.getState().currentSessionId===ne&&(qm(),G.getState().newSession());try{const Ke=await je.listSessions();G.getState().setSdkSessions(Ke)}catch{}},[]),rt=k.useCallback(()=>{u&&(mt(u,!0),d(null))},[u,mt]),Lt=k.useCallback(()=>{d(null)},[]),we=k.useCallback((ne,ve)=>{f&&(mt(f,ve,ne),p(null),x(null))},[f,mt]),Ge=k.useCallback(()=>{p(null),x(null)},[]),gt=k.useCallback(async(ne,ve)=>{ne.stopPropagation();try{await je.unarchiveSession(ve)}catch{}try{const _e=await je.listSessions();G.getState().setSdkSessions(_e)}catch{}},[]),_n=new Set;for(const ne of z.keys())_n.add(ne);for(const ne of I)_n.add(ne.sessionId);const Ne=Array.from(_n).map(ne=>{var Ke;const ve=z.get(ne),_e=I.find(qt=>qt.sessionId===ne);return{id:ne,model:(ve==null?void 0:ve.model)||(_e==null?void 0:_e.model)||"",cwd:(ve==null?void 0:ve.cwd)||(_e==null?void 0:_e.cwd)||"",gitBranch:(ve==null?void 0:ve.git_branch)||(_e==null?void 0:_e.gitBranch)||"",isContainerized:(ve==null?void 0:ve.is_containerized)||!!(_e!=null&&_e.containerId)||!1,gitAhead:(ve==null?void 0:ve.git_ahead)||(_e==null?void 0:_e.gitAhead)||0,gitBehind:(ve==null?void 0:ve.git_behind)||(_e==null?void 0:_e.gitBehind)||0,linesAdded:(ve==null?void 0:ve.total_lines_added)||(_e==null?void 0:_e.totalLinesAdded)||0,linesRemoved:(ve==null?void 0:ve.total_lines_removed)||(_e==null?void 0:_e.totalLinesRemoved)||0,isConnected:Z.get(ne)??!1,isReconnecting:L.get(ne)??!1,status:q.get(ne)??null,sdkState:(_e==null?void 0:_e.state)??null,createdAt:(_e==null?void 0:_e.createdAt)??0,archived:(_e==null?void 0:_e.archived)??!1,backendType:(ve==null?void 0:ve.backend_type)||(_e==null?void 0:_e.backendType)||"claude",repoRoot:(ve==null?void 0:ve.repo_root)||"",permCount:((Ke=P.get(ne))==null?void 0:Ke.size)??0,cronJobId:(ve==null?void 0:ve.cronJobId)||(_e==null?void 0:_e.cronJobId),cronJobName:(ve==null?void 0:ve.cronJobName)||(_e==null?void 0:_e.cronJobName),agentId:(ve==null?void 0:ve.agentId)||(_e==null?void 0:_e.agentId),agentName:(ve==null?void 0:ve.agentName)||(_e==null?void 0:_e.agentName),userName:_e==null?void 0:_e.userName}}).sort((ne,ve)=>ve.createdAt-ne.createdAt),Be=k.useMemo(()=>Array.from(new Set(Ne.map(ne=>ne.userName).filter(ne=>!!ne))).sort(),[Ne]),[yt,Te]=k.useState("__all__"),Xr=ne=>yt==="__all__"?!0:yt==="__none__"?!ne.userName:ne.userName===yt,oe=Ne.some(ne=>!ne.userName),ke=Ne.filter(Xr),W=ke.filter(ne=>!ne.archived&&!ne.cronJobId&&!ne.agentId),xe=ke.filter(ne=>!ne.archived&&!!ne.cronJobId),Oe=ke.filter(ne=>!ne.archived&&!!ne.agentId),Xe=ke.filter(ne=>ne.archived),lt=U?Ne.find(ne=>ne.id===U):null,ot=(lt==null?void 0:lt.backendType)==="codex"?"/logo-codex.svg":"/logo.svg",[Et,wn]=k.useState(!0),[st,fr]=k.useState(!0),Pn=k.useMemo(()=>Q6(W),[W]),cs={onSelect:B,onStartRename:be,onArchive:At,onUnarchive:gt,onDelete:Ce,onClearRecentlyRenamed:Y,editingSessionId:e,editingName:n,setEditingName:r,onConfirmRename:R,onCancelRename:me,editInputRef:T};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:ot,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:Q,title:"New Session","aria-label":"New Session",className:"ml-auto hidden md:flex w-8 h-8 rounded-lg bg-cc-primary hover:bg-cc-primary-hover text-white items-center justify-center transition-colors duration-150 cursor-pointer",children: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:()=>G.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"})})})]})}),Be.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:yt,onChange:ne=>Te(ne.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"}),Be.map(ne=>l.jsx("option",{value:ne,children:ne},ne)),oe&&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:Lt,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:rt,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:W.length===0&&xe.length===0&&Xe.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:[Pn.map((ne,ve)=>l.jsx(G6,{group:ne,isCollapsed:re.has(ne.key),onToggleCollapse:ae,currentSessionId:U,sessionNames:ie,pendingPermissions:P,recentlyRenamed:X,isFirst:ve===0,...cs},ne.key)),xe.length>0&&l.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[l.jsxs("button",{onClick:()=>wn(!Et),"aria-expanded":Et,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 ${Et?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),"Scheduled Runs (",xe.length,")"]}),Et&&l.jsx("div",{className:"mt-0.5",children:xe.map(ne=>{var ve;return l.jsx(ah,{session:ne,isActive:U===ne.id,sessionName:ie.get(ne.id),permCount:((ve=P.get(ne.id))==null?void 0:ve.size)??0,isRecentlyRenamed:X.has(ne.id),...cs},ne.id)})})]}),Oe.length>0&&l.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[l.jsxs("button",{onClick:()=>fr(!st),"aria-expanded":st,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 ${st?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),"Agent Runs (",Oe.length,")"]}),st&&l.jsx("div",{className:"mt-0.5",children:Oe.map(ne=>{var ve;return l.jsx(ah,{session:ne,isActive:U===ne.id,sessionName:ie.get(ne.id),permCount:((ve=P.get(ne.id))==null?void 0:ve.size)??0,isRecentlyRenamed:X.has(ne.id),...cs},ne.id)})})]}),Xe.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 (",Xe.length,")"]}),a&&Xe.length>1&&l.jsx("button",{onClick:Ue,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:Xe.map(ne=>{var ve;return l.jsx(ah,{session:ne,isActive:U===ne.id,isArchived:!0,sessionName:ie.get(ne.id),permCount:((ve=P.get(ne.id))==null?void 0:ve.size)??0,isRecentlyRenamed:X.has(ne.id),...cs},ne.id)})})]})]})}),l.jsx("div",{className:"md:hidden flex justify-end px-4 pb-2",children:l.jsx("button",{onClick:Q,title:"New Session","aria-label":"New Session",className:"w-12 h-12 rounded-full bg-cc-primary hover:bg-cc-primary-hover text-white flex items-center justify-center shadow-lg transition-colors duration-150 cursor-pointer",children: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:Z6.map(ne=>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:ne.label}),l.jsx("div",{className:"flex flex-col",children:ne.itemIds.map(ve=>{const _e=J6.get(ve);if(!_e)return null;const Ke=_e.activePages?_e.activePages.some(qt=>D.page===qt):D.page===_e.id;return l.jsxs("button",{onClick:()=>{window.location.hash=_e.hash,window.innerWidth<768&&G.getState().setSidebarOpen(!1)},title:_e.label,"aria-current":Ke?"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 ${Ke?"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 ${Ke?"bg-cc-primary":"bg-transparent group-hover:bg-cc-border"}`}),l.jsx("svg",{viewBox:_e.viewBox,fill:"currentColor",className:"w-3.5 h-3.5 shrink-0",children:l.jsx("path",{d:_e.iconPath,fillRule:_e.fillRule,clipRule:_e.clipRule})}),l.jsx("span",{className:"min-w-0 flex-1 text-[12px] font-medium leading-tight",children:_e.label})]},_e.id)})})]},ne.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:X6.map(ne=>l.jsx("a",{href:ne.url,target:"_blank",rel:"noopener noreferrer",title:ne.label,"aria-label":`Open ${ne.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:ne.viewBox,fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:ne.iconPath})})},ne.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?Je:Ae,children:l.jsxs("div",{ref:O,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:ne=>ne.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 ${Xe.length} archived session${Xe.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?Je:Ae,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?dt:Ee,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&&m&&l.jsx(I6,{issueIdentifier:((Kr=m.issue)==null?void 0:Kr.identifier)||"",issueStateName:((Zr=m.issue)==null?void 0:Zr.stateName)||"",isContainerized:b,archiveTransitionConfigured:m.archiveTransitionConfigured||!1,archiveTransitionStateName:m.archiveTransitionStateName,hasBacklogState:m.hasBacklogState||!1,onConfirm:we,onCancel:Ge})]})}function tA(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const nA=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,rA=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,sA={};function n5(e,t){return(sA.jsx?rA:nA).test(e)}const iA=/[ \t\n\f\r]/g;function aA(e){return typeof e=="object"?e.type==="text"?r5(e.value):!1:r5(e)}function r5(e){return e.replace(iA,"")===""}class iu{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}iu.prototype.normal={};iu.prototype.property={};iu.prototype.space=void 0;function _k(e,t){const n={},r={};for(const a of e)Object.assign(n,a.property),Object.assign(r,a.normal);return new iu(n,r,t)}function hx(e){return e.toLowerCase()}class hr{constructor(t,n){this.attribute=n,this.property=t}}hr.prototype.attribute="";hr.prototype.booleanish=!1;hr.prototype.boolean=!1;hr.prototype.commaOrSpaceSeparated=!1;hr.prototype.commaSeparated=!1;hr.prototype.defined=!1;hr.prototype.mustUseProperty=!1;hr.prototype.number=!1;hr.prototype.overloadedBoolean=!1;hr.prototype.property="";hr.prototype.spaceSeparated=!1;hr.prototype.space=void 0;let lA=0;const We=Fa(),bn=Fa(),fx=Fa(),Se=Fa(),It=Fa(),Oa=Fa(),wr=Fa();function Fa(){return 2**++lA}const px=Object.freeze(Object.defineProperty({__proto__:null,boolean:We,booleanish:bn,commaOrSpaceSeparated:wr,commaSeparated:Oa,number:Se,overloadedBoolean:fx,spaceSeparated:It},Symbol.toStringTag,{value:"Module"})),Vm=Object.keys(px);class Kx extends hr{constructor(t,n,r,a){let o=-1;if(super(t,n),s5(this,"space",a),typeof r=="number")for(;++o<Vm.length;){const u=Vm[o];s5(this,Vm[o],(r&px[u])===px[u])}}}Kx.prototype.defined=!0;function s5(e,t,n){n&&(e[t]=n)}function oo(e){const t={},n={};for(const[r,a]of Object.entries(e.properties)){const o=new Kx(r,e.transform(e.attributes||{},r),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[hx(r)]=r,n[hx(o.attribute)]=r}return new iu(t,n,e.space)}const wk=oo({properties:{ariaActiveDescendant:null,ariaAtomic:bn,ariaAutoComplete:null,ariaBusy:bn,ariaChecked:bn,ariaColCount:Se,ariaColIndex:Se,ariaColSpan:Se,ariaControls:It,ariaCurrent:null,ariaDescribedBy:It,ariaDetails:null,ariaDisabled:bn,ariaDropEffect:It,ariaErrorMessage:null,ariaExpanded:bn,ariaFlowTo:It,ariaGrabbed:bn,ariaHasPopup:null,ariaHidden:bn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:It,ariaLevel:Se,ariaLive:null,ariaModal:bn,ariaMultiLine:bn,ariaMultiSelectable:bn,ariaOrientation:null,ariaOwns:It,ariaPlaceholder:null,ariaPosInSet:Se,ariaPressed:bn,ariaReadOnly:bn,ariaRelevant:null,ariaRequired:bn,ariaRoleDescription:It,ariaRowCount:Se,ariaRowIndex:Se,ariaRowSpan:Se,ariaSelected:bn,ariaSetSize:Se,ariaSort:null,ariaValueMax:Se,ariaValueMin:Se,ariaValueNow:Se,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function kk(e,t){return t in e?e[t]:t}function Sk(e,t){return kk(e,t.toLowerCase())}const oA=oo({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Oa,acceptCharset:It,accessKey:It,action:null,allow:null,allowFullScreen:We,allowPaymentRequest:We,allowUserMedia:We,alpha:We,alt:null,as:null,async:We,autoCapitalize:null,autoComplete:It,autoFocus:We,autoPlay:We,blocking:It,capture:null,charSet:null,checked:We,cite:null,className:It,closedBy:null,colorSpace:null,cols:Se,colSpan:Se,command:null,commandFor:null,content:null,contentEditable:bn,controls:We,controlsList:It,coords:Se|Oa,crossOrigin:null,data:null,dateTime:null,decoding:null,default:We,defer:We,dir:null,dirName:null,disabled:We,download:fx,draggable:bn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:We,formTarget:null,headers:It,height:Se,hidden:fx,high:Se,href:null,hrefLang:null,htmlFor:It,httpEquiv:It,id:null,imageSizes:null,imageSrcSet:null,inert:We,inputMode:null,integrity:null,is:null,isMap:We,itemId:null,itemProp:It,itemRef:It,itemScope:We,itemType:It,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:We,low:Se,manifest:null,max:null,maxLength:Se,media:null,method:null,min:null,minLength:Se,multiple:We,muted:We,name:null,nonce:null,noModule:We,noValidate:We,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:We,optimum:Se,pattern:null,ping:It,placeholder:null,playsInline:We,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:We,referrerPolicy:null,rel:It,required:We,reversed:We,rows:Se,rowSpan:Se,sandbox:It,scope:null,scoped:We,seamless:We,selected:We,shadowRootClonable:We,shadowRootCustomElementRegistry:We,shadowRootDelegatesFocus:We,shadowRootMode:null,shadowRootSerializable:We,shape:null,size:Se,sizes:null,slot:null,span:Se,spellCheck:bn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Se,step:null,style:null,tabIndex:Se,target:null,title:null,translate:null,type:null,typeMustMatch:We,useMap:null,value:bn,width:Se,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:It,axis:null,background:null,bgColor:null,border:Se,borderColor:null,bottomMargin:Se,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:We,declare:We,event:null,face:null,frame:null,frameBorder:null,hSpace:Se,leftMargin:Se,link:null,longDesc:null,lowSrc:null,marginHeight:Se,marginWidth:Se,noResize:We,noHref:We,noShade:We,noWrap:We,object:null,profile:null,prompt:null,rev:null,rightMargin:Se,rules:null,scheme:null,scrolling:bn,standby:null,summary:null,text:null,topMargin:Se,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Se,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:We,disablePictureInPicture:We,disableRemotePlayback:We,exportParts:Oa,part:It,prefix:null,property:null,results:Se,security:null,unselectable:null},space:"html",transform:Sk}),cA=oo({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:wr,accentHeight:Se,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Se,amplitude:Se,arabicForm:null,ascent:Se,attributeName:null,attributeType:null,azimuth:Se,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Se,by:null,calcMode:null,capHeight:Se,className:It,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Se,diffuseConstant:Se,direction:null,display:null,dur:null,divisor:Se,dominantBaseline:null,download:We,dx:null,dy:null,edgeMode:null,editable:null,elevation:Se,enableBackground:null,end:null,event:null,exponent:Se,externalResourcesRequired:null,fill:null,fillOpacity:Se,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Oa,g2:Oa,glyphName:Oa,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Se,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Se,horizOriginX:Se,horizOriginY:Se,id:null,ideographic:Se,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Se,k:Se,k1:Se,k2:Se,k3:Se,k4:Se,kernelMatrix:wr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Se,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Se,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Se,overlineThickness:Se,paintOrder:null,panose1:null,path:null,pathLength:Se,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:It,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Se,pointsAtY:Se,pointsAtZ:Se,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:wr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:wr,rev:wr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:wr,requiredFeatures:wr,requiredFonts:wr,requiredFormats:wr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Se,specularExponent:Se,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Se,strikethroughThickness:Se,string:null,stroke:null,strokeDashArray:wr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Se,strokeOpacity:Se,strokeWidth:null,style:null,surfaceScale:Se,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:wr,tabIndex:Se,tableValues:null,target:null,targetX:Se,targetY:Se,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:wr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Se,underlineThickness:Se,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Se,values:null,vAlphabetic:Se,vMathematical:Se,vectorEffect:null,vHanging:Se,vIdeographic:Se,version:null,vertAdvY:Se,vertOriginX:Se,vertOriginY:Se,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Se,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:kk}),jk=oo({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()}}),Nk=oo({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Sk}),Ck=oo({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),uA={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"},dA=/[A-Z]/g,i5=/-[a-z]/g,hA=/^data[-\w.:]+$/i;function fA(e,t){const n=hx(t);let r=t,a=hr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&hA.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(i5,mA);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!i5.test(o)){let u=o.replace(dA,pA);u.charAt(0)!=="-"&&(u="-"+u),t="data"+u}}a=Kx}return new a(r,t)}function pA(e){return"-"+e.toLowerCase()}function mA(e){return e.charAt(1).toUpperCase()}const gA=_k([wk,oA,jk,Nk,Ck],"html"),Zx=_k([wk,cA,jk,Nk,Ck],"svg");function xA(e){return e.join(" ").trim()}var zl={},Gm,a5;function vA(){if(a5)return Gm;a5=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,d=/^\s+|\s+$/g,f=`
|
|
72
|
+
`,p="/",m="*",x="",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 E=1,C=1;function T(X){var Y=X.match(t);Y&&(E+=Y.length);var P=X.lastIndexOf(f);C=~P?X.length-P:C+X.length}function O(){var X={line:E,column:C};return function(Y){return Y.position=new z(X),Z(),Y}}function z(X){this.start=X,this.end={line:E,column:C},this.source=w.source}z.prototype.content=N;function I(X){var Y=new Error(w.source+":"+E+":"+C+": "+X);if(Y.reason=X,Y.filename=w.source,Y.line=E,Y.column=C,Y.source=N,!w.silent)throw Y}function U(X){var Y=X.exec(N);if(Y){var P=Y[0];return T(P),N=N.slice(P.length),Y}}function Z(){U(n)}function L(X){var Y;for(X=X||[];Y=q();)Y!==!1&&X.push(Y);return X}function q(){var X=O();if(!(p!=N.charAt(0)||m!=N.charAt(1))){for(var Y=2;x!=N.charAt(Y)&&(m!=N.charAt(Y)||p!=N.charAt(Y+1));)++Y;if(Y+=2,x===N.charAt(Y-1))return I("End of comment missing");var P=N.slice(2,Y-2);return C+=2,T(P),N=N.slice(Y),C+=2,X({type:b,comment:P})}}function M(){var X=O(),Y=U(r);if(Y){if(q(),!U(a))return I("property missing ':'");var P=U(o),$=X({type:y,property:j(Y[0].replace(e,x)),value:P?j(P[0].replace(e,x)):x});return U(u),$}}function ie(){var X=[];L(X);for(var Y;Y=M();)Y!==!1&&(X.push(Y),L(X));return X}return Z(),ie()}function j(N){return N?N.replace(d,x):x}return Gm=_,Gm}var l5;function bA(){if(l5)return zl;l5=1;var e=zl&&zl.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(zl,"__esModule",{value:!0}),zl.default=n;const t=e(vA());function n(r,a){let o=null;if(!r||typeof r!="string")return o;const u=(0,t.default)(r),d=typeof a=="function";return u.forEach(f=>{if(f.type!=="declaration")return;const{property:p,value:m}=f;d?a(p,m,f):m&&(o=o||{},o[p]=m)}),o}return zl}var vc={},o5;function yA(){if(o5)return vc;o5=1,Object.defineProperty(vc,"__esModule",{value:!0}),vc.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(p){return!p||n.test(p)||e.test(p)},u=function(p,m){return m.toUpperCase()},d=function(p,m){return"".concat(m,"-")},f=function(p,m){return m===void 0&&(m={}),o(p)?p:(p=p.toLowerCase(),m.reactCompat?p=p.replace(a,d):p=p.replace(r,d),p.replace(t,u))};return vc.camelCase=f,vc}var bc,c5;function _A(){if(c5)return bc;c5=1;var e=bc&&bc.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(bA()),n=yA();function r(a,o){var u={};return!a||typeof a!="string"||(0,t.default)(a,function(d,f){d&&f&&(u[(0,n.camelCase)(d,o)]=f)}),u}return r.default=r,bc=r,bc}var wA=_A();const kA=Nx(wA),Ek=Ak("end"),Jx=Ak("start");function Ak(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function SA(e){const t=Jx(e),n=Ek(e);if(t&&n)return{start:t,end:n}}function Pc(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?u5(e.position):"start"in e||"end"in e?u5(e):"line"in e||"column"in e?mx(e):""}function mx(e){return d5(e&&e.line)+":"+d5(e&&e.column)}function u5(e){return mx(e&&e.start)+"-"+mx(e&&e.end)}function d5(e){return e&&typeof e=="number"?e:1}class Gn extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=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 r=="string"){const f=r.indexOf(":");f===-1?o.ruleId=r:(o.source=r.slice(0,f),o.ruleId=r.slice(f+1))}if(!o.place&&o.ancestors&&o.ancestors){const f=o.ancestors[o.ancestors.length-1];f&&(o.place=f.position)}const d=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=d?d.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=d?d.line:void 0,this.name=Pc(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 ev={}.hasOwnProperty,jA=new Map,NA=/[A-Z]/g,CA=new Set(["table","tbody","thead","tfoot","tr"]),EA=new Set(["td","th"]),Tk="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function AA(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=BA(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");r=zA(n,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,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"?Zx:gA,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=Mk(a,e,void 0);return o&&typeof o!="string"?o:a.create(e,a.Fragment,{children:o||void 0},void 0)}function Mk(e,t,n){if(t.type==="element")return TA(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return MA(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return DA(e,t,n);if(t.type==="mdxjsEsm")return RA(e,t);if(t.type==="root")return LA(e,t,n);if(t.type==="text")return OA(e,t)}function TA(e,t,n){const r=e.schema;let a=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(a=Zx,e.schema=a),e.ancestors.push(t);const o=Dk(e,t.tagName,!1),u=PA(e,t);let d=nv(e,t);return CA.has(t.tagName)&&(d=d.filter(function(f){return typeof f=="string"?!aA(f):!0})),Rk(e,u,o,t),tv(u,d),e.ancestors.pop(),e.schema=r,e.create(t,o,u,n)}function MA(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Jc(e,t.position)}function RA(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Jc(e,t.position)}function DA(e,t,n){const r=e.schema;let a=r;t.name==="svg"&&r.space==="html"&&(a=Zx,e.schema=a),e.ancestors.push(t);const o=t.name===null?e.Fragment:Dk(e,t.name,!0),u=$A(e,t),d=nv(e,t);return Rk(e,u,o,t),tv(u,d),e.ancestors.pop(),e.schema=r,e.create(t,o,u,n)}function LA(e,t,n){const r={};return tv(r,nv(e,t)),e.create(t,e.Fragment,r,n)}function OA(e,t){return t.value}function Rk(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function tv(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function zA(e,t,n){return r;function r(a,o,u,d){const p=Array.isArray(u.children)?n:t;return d?p(o,u,d):p(o,u)}}function BA(e,t){return n;function n(r,a,o,u){const d=Array.isArray(o.children),f=Jx(r);return t(a,o,u,d,{columnNumber:f?f.column-1:void 0,fileName:e,lineNumber:f?f.line:void 0},void 0)}}function PA(e,t){const n={};let r,a;for(a in t.properties)if(a!=="children"&&ev.call(t.properties,a)){const o=FA(e,a,t.properties[a]);if(o){const[u,d]=o;e.tableCellAlignToStyle&&u==="align"&&typeof d=="string"&&EA.has(t.tagName)?r=d:n[u]=d}}if(r){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function $A(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const o=r.data.estree.body[0];o.type;const u=o.expression;u.type;const d=u.properties[0];d.type,Object.assign(n,e.evaluater.evaluateExpression(d.argument))}else Jc(e,t.position);else{const a=r.name;let o;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const d=r.value.data.estree.body[0];d.type,o=e.evaluater.evaluateExpression(d.expression)}else Jc(e,t.position);else o=r.value===null?!0:r.value;n[a]=o}return n}function nv(e,t){const n=[];let r=-1;const a=e.passKeys?new Map:jA;for(;++r<t.children.length;){const o=t.children[r];let u;if(e.passKeys){const f=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(f){const p=a.get(f)||0;u=f+"-"+p,a.set(f,p+1)}}const d=Mk(e,o,u);d!==void 0&&n.push(d)}return n}function FA(e,t,n){const r=fA(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?tA(n):xA(n)),r.property==="style"){let a=typeof n=="object"?n:UA(e,String(n));return e.stylePropertyNameCase==="css"&&(a=IA(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&r.space?uA[r.property]||r.property:r.attribute,n]}}function UA(e,t){try{return kA(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,a=new Gn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=Tk+"#cannot-parse-style-attribute",a}}function Dk(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let o=-1,u;for(;++o<a.length;){const d=n5(a[o])?{type:"Identifier",name:a[o]}:{type:"Literal",value:a[o]};u=u?{type:"MemberExpression",object:u,property:d,computed:!!(o&&d.type==="Literal"),optional:!1}:d}r=u}else r=n5(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const a=r.value;return ev.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(r);Jc(e)}function Jc(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=Tk+"#cannot-handle-mdx-estrees-without-createevaluater",n}function IA(e){const t={};let n;for(n in e)ev.call(e,n)&&(t[HA(n)]=e[n]);return t}function HA(e){let t=e.replace(NA,qA);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function qA(e){return"-"+e.toLowerCase()}const Ym={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"]},VA={};function rv(e,t){const n=VA,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Lk(e,r,a)}function Lk(e,t,n){if(GA(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 h5(e.children,t,n)}return Array.isArray(e)?h5(e,t,n):""}function h5(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=Lk(e[a],t,n);return r.join("")}function GA(e){return!!(e&&typeof e=="object")}const f5=document.createElement("i");function sv(e){const t="&"+e+";";f5.innerHTML=t;const n=f5.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Ar(e,t,n,r){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,r.length<1e4)u=Array.from(r),u.unshift(t,n),e.splice(...u);else for(n&&e.splice(t,n);o<r.length;)u=r.slice(o,o+1e4),u.unshift(t,0),e.splice(...u),o+=1e4,t+=1e4}function Wr(e,t){return e.length>0?(Ar(e,e.length,0,t),e):t}const p5={}.hasOwnProperty;function Ok(e){const t={};let n=-1;for(;++n<e.length;)YA(t,e[n]);return t}function YA(e,t){let n;for(n in t){const a=(p5.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let u;if(o)for(u in o){p5.call(a,u)||(a[u]=[]);const d=o[u];WA(a[u],Array.isArray(d)?d:d?[d]:[])}}}function WA(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Ar(e,0,0,r)}function zk(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 os(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Zn=Zi(/[A-Za-z]/),qn=Zi(/[\dA-Za-z]/),QA=Zi(/[#-'*+\--9=?A-Z^-~]/);function Oh(e){return e!==null&&(e<32||e===127)}const gx=Zi(/\d/),XA=Zi(/[\dA-Fa-f]/),KA=Zi(/[!-/:-@[-`{-~]/);function He(e){return e!==null&&e<-2}function Ht(e){return e!==null&&(e<0||e===32)}function pt(e){return e===-2||e===-1||e===32}const Wh=Zi(new RegExp("\\p{P}|\\p{S}","u")),Pa=Zi(/\s/);function Zi(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function co(e){const t=[];let n=-1,r=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 d=e.charCodeAt(n+1);o<56320&&d>56319&&d<57344?(u=String.fromCharCode(o,d),a=1):u="�"}else u=String.fromCharCode(o);u&&(t.push(e.slice(r,n),encodeURIComponent(u)),r=n+a+1,u=""),a&&(n+=a,a=0)}return t.join("")+e.slice(r)}function wt(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let o=0;return u;function u(f){return pt(f)?(e.enter(n),d(f)):t(f)}function d(f){return pt(f)&&o++<a?(e.consume(f),d):(e.exit(n),t(f))}}const ZA={tokenize:JA};function JA(e){const t=e.attempt(this.parser.constructs.contentInitial,r,a);let n;return t;function r(d){if(d===null){e.consume(d);return}return e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),wt(e,t,"linePrefix")}function a(d){return e.enter("paragraph"),o(d)}function o(d){const f=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=f),n=f,u(d)}function u(d){if(d===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(d);return}return He(d)?(e.consume(d),e.exit("chunkText"),o):(e.consume(d),u)}}const eT={tokenize:tT},m5={tokenize:nT};function tT(e){const t=this,n=[];let r=0,a,o,u;return d;function d(C){if(r<n.length){const T=n[r];return t.containerState=T[1],e.attempt(T[0].continuation,f,p)(C)}return p(C)}function f(C){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&E();const T=t.events.length;let O=T,z;for(;O--;)if(t.events[O][0]==="exit"&&t.events[O][1].type==="chunkFlow"){z=t.events[O][1].end;break}w(r);let I=T;for(;I<t.events.length;)t.events[I][1].end={...z},I++;return Ar(t.events,O+1,0,t.events.slice(T)),t.events.length=I,p(C)}return d(C)}function p(C){if(r===n.length){if(!a)return b(C);if(a.currentConstruct&&a.currentConstruct.concrete)return _(C);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(m5,m,x)(C)}function m(C){return a&&E(),w(r),b(C)}function x(C){return t.parser.lazy[t.now().line]=r!==n.length,u=t.now().offset,_(C)}function b(C){return t.containerState={},e.attempt(m5,y,_)(C)}function y(C){return r++,n.push([t.currentConstruct,t.containerState]),b(C)}function _(C){if(C===null){a&&E(),w(0),e.consume(C);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:o}),j(C)}function j(C){if(C===null){N(e.exit("chunkFlow"),!0),w(0),e.consume(C);return}return He(C)?(e.consume(C),N(e.exit("chunkFlow")),r=0,t.interrupt=void 0,d):(e.consume(C),j)}function N(C,T){const O=t.sliceStream(C);if(T&&O.push(null),C.previous=o,o&&(o.next=C),o=C,a.defineSkip(C.start),a.write(O),t.parser.lazy[C.start.line]){let z=a.events.length;for(;z--;)if(a.events[z][1].start.offset<u&&(!a.events[z][1].end||a.events[z][1].end.offset>u))return;const I=t.events.length;let U=I,Z,L;for(;U--;)if(t.events[U][0]==="exit"&&t.events[U][1].type==="chunkFlow"){if(Z){L=t.events[U][1].end;break}Z=!0}for(w(r),z=I;z<t.events.length;)t.events[z][1].end={...L},z++;Ar(t.events,U+1,0,t.events.slice(I)),t.events.length=z}}function w(C){let T=n.length;for(;T-- >C;){const O=n[T];t.containerState=O[1],O[0].exit.call(t,e)}n.length=C}function E(){a.write([null]),o=void 0,a=void 0,t.containerState._closeFlow=void 0}}function nT(e,t,n){return wt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function io(e){if(e===null||Ht(e)||Pa(e))return 1;if(Wh(e))return 2}function Qh(e,t,n){const r=[];let a=-1;for(;++a<e.length;){const o=e[a].resolveAll;o&&!r.includes(o)&&(t=o(t,n),r.push(o))}return t}const xx={name:"attention",resolveAll:rT,tokenize:sT};function rT(e,t){let n=-1,r,a,o,u,d,f,p,m;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;f=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const x={...e[r][1].end},b={...e[n][1].start};g5(x,-f),g5(b,f),u={type:f>1?"strongSequence":"emphasisSequence",start:x,end:{...e[r][1].end}},d={type:f>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:b},o={type:f>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},a={type:f>1?"strong":"emphasis",start:{...u.start},end:{...d.end}},e[r][1].end={...u.start},e[n][1].start={...d.end},p=[],e[r][1].end.offset-e[r][1].start.offset&&(p=Wr(p,[["enter",e[r][1],t],["exit",e[r][1],t]])),p=Wr(p,[["enter",a,t],["enter",u,t],["exit",u,t],["enter",o,t]]),p=Wr(p,Qh(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),p=Wr(p,[["exit",o,t],["enter",d,t],["exit",d,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(m=2,p=Wr(p,[["enter",e[n][1],t],["exit",e[n][1],t]])):m=0,Ar(e,r-1,n-r+3,p),n=r+p.length-m-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function sT(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=io(r);let o;return u;function u(f){return o=f,e.enter("attentionSequence"),d(f)}function d(f){if(f===o)return e.consume(f),d;const p=e.exit("attentionSequence"),m=io(f),x=!m||m===2&&a||n.includes(f),b=!a||a===2&&m||n.includes(r);return p._open=!!(o===42?x:x&&(a||!b)),p._close=!!(o===42?b:b&&(m||!x)),t(f)}}function g5(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const iT={name:"autolink",tokenize:aT};function aT(e,t,n){let r=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 Zn(y)?(e.consume(y),u):y===64?n(y):p(y)}function u(y){return y===43||y===45||y===46||qn(y)?(r=1,d(y)):p(y)}function d(y){return y===58?(e.consume(y),r=0,f):(y===43||y===45||y===46||qn(y))&&r++<32?(e.consume(y),d):(r=0,p(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||Oh(y)?n(y):(e.consume(y),f)}function p(y){return y===64?(e.consume(y),m):QA(y)?(e.consume(y),p):n(y)}function m(y){return qn(y)?x(y):n(y)}function x(y){return y===46?(e.consume(y),r=0,m):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))&&r++<63){const _=y===45?b:x;return e.consume(y),_}return n(y)}}const au={partial:!0,tokenize:lT};function lT(e,t,n){return r;function r(o){return pt(o)?wt(e,a,"linePrefix")(o):a(o)}function a(o){return o===null||He(o)?t(o):n(o)}}const Bk={continuation:{tokenize:cT},exit:uT,name:"blockQuote",tokenize:oT};function oT(e,t,n){const r=this;return a;function a(u){if(u===62){const d=r.containerState;return d.open||(e.enter("blockQuote",{_container:!0}),d.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(u),e.exit("blockQuoteMarker"),o}return n(u)}function o(u){return pt(u)?(e.enter("blockQuotePrefixWhitespace"),e.consume(u),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(u))}}function cT(e,t,n){const r=this;return a;function a(u){return pt(u)?wt(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u):o(u)}function o(u){return e.attempt(Bk,t,n)(u)}}function uT(e){e.exit("blockQuote")}const Pk={name:"characterEscape",tokenize:dT};function dT(e,t,n){return r;function r(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),a}function a(o){return KA(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const $k={name:"characterReference",tokenize:hT};function hT(e,t,n){const r=this;let a=0,o,u;return d;function d(x){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(x),e.exit("characterReferenceMarker"),f}function f(x){return x===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(x),e.exit("characterReferenceMarkerNumeric"),p):(e.enter("characterReferenceValue"),o=31,u=qn,m(x))}function p(x){return x===88||x===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(x),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,u=XA,m):(e.enter("characterReferenceValue"),o=7,u=gx,m(x))}function m(x){if(x===59&&a){const b=e.exit("characterReferenceValue");return u===qn&&!sv(r.sliceSerialize(b))?n(x):(e.enter("characterReferenceMarker"),e.consume(x),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return u(x)&&a++<o?(e.consume(x),m):n(x)}}const x5={partial:!0,tokenize:pT},v5={concrete:!0,name:"codeFenced",tokenize:fT};function fT(e,t,n){const r=this,a={partial:!0,tokenize:O};let o=0,u=0,d;return f;function f(z){return p(z)}function p(z){const I=r.events[r.events.length-1];return o=I&&I[1].type==="linePrefix"?I[2].sliceSerialize(I[1],!0).length:0,d=z,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),m(z)}function m(z){return z===d?(u++,e.consume(z),m):u<3?n(z):(e.exit("codeFencedFenceSequence"),pt(z)?wt(e,x,"whitespace")(z):x(z))}function x(z){return z===null||He(z)?(e.exit("codeFencedFence"),r.interrupt?t(z):e.check(x5,j,T)(z)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),b(z))}function b(z){return z===null||He(z)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),x(z)):pt(z)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),wt(e,y,"whitespace")(z)):z===96&&z===d?n(z):(e.consume(z),b)}function y(z){return z===null||He(z)?x(z):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),_(z))}function _(z){return z===null||He(z)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),x(z)):z===96&&z===d?n(z):(e.consume(z),_)}function j(z){return e.attempt(a,T,N)(z)}function N(z){return e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),w}function w(z){return o>0&&pt(z)?wt(e,E,"linePrefix",o+1)(z):E(z)}function E(z){return z===null||He(z)?e.check(x5,j,T)(z):(e.enter("codeFlowValue"),C(z))}function C(z){return z===null||He(z)?(e.exit("codeFlowValue"),E(z)):(e.consume(z),C)}function T(z){return e.exit("codeFenced"),t(z)}function O(z,I,U){let Z=0;return L;function L(Y){return z.enter("lineEnding"),z.consume(Y),z.exit("lineEnding"),q}function q(Y){return z.enter("codeFencedFence"),pt(Y)?wt(z,M,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(Y):M(Y)}function M(Y){return Y===d?(z.enter("codeFencedFenceSequence"),ie(Y)):U(Y)}function ie(Y){return Y===d?(Z++,z.consume(Y),ie):Z>=u?(z.exit("codeFencedFenceSequence"),pt(Y)?wt(z,X,"whitespace")(Y):X(Y)):U(Y)}function X(Y){return Y===null||He(Y)?(z.exit("codeFencedFence"),I(Y)):U(Y)}}}function pT(e,t,n){const r=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 r.parser.lazy[r.now().line]?n(u):t(u)}}const Wm={name:"codeIndented",tokenize:gT},mT={partial:!0,tokenize:xT};function gT(e,t,n){const r=this;return a;function a(p){return e.enter("codeIndented"),wt(e,o,"linePrefix",5)(p)}function o(p){const m=r.events[r.events.length-1];return m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?u(p):n(p)}function u(p){return p===null?f(p):He(p)?e.attempt(mT,u,f)(p):(e.enter("codeFlowValue"),d(p))}function d(p){return p===null||He(p)?(e.exit("codeFlowValue"),u(p)):(e.consume(p),d)}function f(p){return e.exit("codeIndented"),t(p)}}function xT(e,t,n){const r=this;return a;function a(u){return r.parser.lazy[r.now().line]?n(u):He(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),a):wt(e,o,"linePrefix",5)(u)}function o(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?t(u):He(u)?a(u):n(u)}}const vT={name:"codeText",previous:yT,resolve:bT,tokenize:_T};function bT(e){let t=e.length-4,n=3,r,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)a===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(a=r):(r===t||e[r][1].type==="lineEnding")&&(e[a][1].type="codeTextData",r!==a+2&&(e[a][1].end=e[r-1][1].end,e.splice(a+2,r-a-2),t-=r-a-2,r=a+2),a=void 0);return e}function yT(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function _T(e,t,n){let r=0,a,o;return u;function u(x){return e.enter("codeText"),e.enter("codeTextSequence"),d(x)}function d(x){return x===96?(e.consume(x),r++,d):(e.exit("codeTextSequence"),f(x))}function f(x){return x===null?n(x):x===32?(e.enter("space"),e.consume(x),e.exit("space"),f):x===96?(o=e.enter("codeTextSequence"),a=0,m(x)):He(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),f):(e.enter("codeTextData"),p(x))}function p(x){return x===null||x===32||x===96||He(x)?(e.exit("codeTextData"),f(x)):(e.consume(x),p)}function m(x){return x===96?(e.consume(x),a++,m):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(x)):(o.type="codeTextData",p(x))}}class wT{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 r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const a=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return r&&yc(this.left,r),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),yc(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),yc(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);yc(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);yc(this.left,n.reverse())}}}function yc(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Fk(e){const t={};let n=-1,r,a,o,u,d,f,p;const m=new wT(e);for(;++n<m.length;){for(;n in t;)n=t[n];if(r=m.get(n),n&&r[1].type==="chunkFlow"&&m.get(n-1)[1].type==="listItemPrefix"&&(f=r[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(r[0]==="enter")r[1].contentType&&(Object.assign(t,kT(m,n)),n=t[n],p=!0);else if(r[1]._container){for(o=n,a=void 0;o--;)if(u=m.get(o),u[1].type==="lineEnding"||u[1].type==="lineEndingBlank")u[0]==="enter"&&(a&&(m.get(a)[1].type="lineEndingBlank"),u[1].type="lineEnding",a=o);else if(!(u[1].type==="linePrefix"||u[1].type==="listItemIndent"))break;a&&(r[1].end={...m.get(a)[1].start},d=m.slice(a,n),d.unshift(r),m.splice(a,n-a+1,d))}}return Ar(e,0,Number.POSITIVE_INFINITY,m.slice(0)),!p}function kT(e,t){const n=e.get(t)[1],r=e.get(t)[2];let a=t-1;const o=[];let u=n._tokenizer;u||(u=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(u._contentTypeTextTrailing=!0));const d=u.events,f=[],p={};let m,x,b=-1,y=n,_=0,j=0;const N=[j];for(;y;){for(;e.get(++a)[1]!==y;);o.push(a),y._tokenizer||(m=r.sliceStream(y),y.next||m.push(null),x&&u.defineSkip(y.start),y._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=!0),u.write(m),y._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=void 0)),x=y,y=y.next}for(y=n;++b<d.length;)d[b][0]==="exit"&&d[b-1][0]==="enter"&&d[b][1].type===d[b-1][1].type&&d[b][1].start.line!==d[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=d.slice(N[b],N[b+1]),E=o.pop();f.push([E,E+w.length-1]),e.splice(E,2,w)}for(f.reverse(),b=-1;++b<f.length;)p[_+f[b][0]]=_+f[b][1],_+=f[b][1]-f[b][0]-1;return p}const ST={resolve:NT,tokenize:CT},jT={partial:!0,tokenize:ET};function NT(e){return Fk(e),e}function CT(e,t){let n;return r;function r(d){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(d)}function a(d){return d===null?o(d):He(d)?e.check(jT,u,o)(d):(e.consume(d),a)}function o(d){return e.exit("chunkContent"),e.exit("content"),t(d)}function u(d){return e.consume(d),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function ET(e,t,n){const r=this;return a;function a(u){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),wt(e,o,"linePrefix")}function o(u){if(u===null||He(u))return n(u);const d=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?t(u):e.interrupt(r.parser.constructs.flow,n,t)(u)}}function Uk(e,t,n,r,a,o,u,d,f){const p=f||Number.POSITIVE_INFINITY;let m=0;return x;function x(w){return w===60?(e.enter(r),e.enter(a),e.enter(o),e.consume(w),e.exit(o),b):w===null||w===32||w===41||Oh(w)?n(w):(e.enter(r),e.enter(u),e.enter(d),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(r),t):(e.enter(d),e.enter("chunkString",{contentType:"string"}),y(w))}function y(w){return w===62?(e.exit("chunkString"),e.exit(d),b(w)):w===null||w===60||He(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!m&&(w===null||w===41||Ht(w))?(e.exit("chunkString"),e.exit(d),e.exit(u),e.exit(r),t(w)):m<p&&w===40?(e.consume(w),m++,j):w===41?(e.consume(w),m--,j):w===null||w===32||w===40||Oh(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 Ik(e,t,n,r,a,o){const u=this;let d=0,f;return p;function p(y){return e.enter(r),e.enter(a),e.consume(y),e.exit(a),e.enter(o),m}function m(y){return d>999||y===null||y===91||y===93&&!f||y===94&&!d&&"_hiddenFootnoteSupport"in u.parser.constructs?n(y):y===93?(e.exit(o),e.enter(a),e.consume(y),e.exit(a),e.exit(r),t):He(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),m):(e.enter("chunkString",{contentType:"string"}),x(y))}function x(y){return y===null||y===91||y===93||He(y)||d++>999?(e.exit("chunkString"),m(y)):(e.consume(y),f||(f=!pt(y)),y===92?b:x)}function b(y){return y===91||y===92||y===93?(e.consume(y),d++,x):x(y)}}function Hk(e,t,n,r,a,o){let u;return d;function d(b){return b===34||b===39||b===40?(e.enter(r),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(r),t):(e.enter(o),p(b))}function p(b){return b===u?(e.exit(o),f(u)):b===null?n(b):He(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),wt(e,p,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),m(b))}function m(b){return b===u||b===null||He(b)?(e.exit("chunkString"),p(b)):(e.consume(b),b===92?x:m)}function x(b){return b===u||b===92?(e.consume(b),m):m(b)}}function $c(e,t){let n;return r;function r(a){return He(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):pt(a)?wt(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const AT={name:"definition",tokenize:MT},TT={partial:!0,tokenize:RT};function MT(e,t,n){const r=this;let a;return o;function o(y){return e.enter("definition"),u(y)}function u(y){return Ik.call(r,e,d,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function d(y){return a=os(r.sliceSerialize(r.events[r.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 Ht(y)?$c(e,p)(y):p(y)}function p(y){return Uk(e,m,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function m(y){return e.attempt(TT,x,x)(y)}function x(y){return pt(y)?wt(e,b,"whitespace")(y):b(y)}function b(y){return y===null||He(y)?(e.exit("definition"),r.parser.defined.push(a),t(y)):n(y)}}function RT(e,t,n){return r;function r(d){return Ht(d)?$c(e,a)(d):n(d)}function a(d){return Hk(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(d)}function o(d){return pt(d)?wt(e,u,"whitespace")(d):u(d)}function u(d){return d===null||He(d)?t(d):n(d)}}const DT={name:"hardBreakEscape",tokenize:LT};function LT(e,t,n){return r;function r(o){return e.enter("hardBreakEscape"),e.consume(o),a}function a(o){return He(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const OT={name:"headingAtx",resolve:zT,tokenize:BT};function zT(e,t){let n=e.length-2,r=3,a,o;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(a={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},o={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Ar(e,r,n-r+1,[["enter",a,t],["enter",o,t],["exit",o,t],["exit",a,t]])),e}function BT(e,t,n){let r=0;return a;function a(m){return e.enter("atxHeading"),o(m)}function o(m){return e.enter("atxHeadingSequence"),u(m)}function u(m){return m===35&&r++<6?(e.consume(m),u):m===null||Ht(m)?(e.exit("atxHeadingSequence"),d(m)):n(m)}function d(m){return m===35?(e.enter("atxHeadingSequence"),f(m)):m===null||He(m)?(e.exit("atxHeading"),t(m)):pt(m)?wt(e,d,"whitespace")(m):(e.enter("atxHeadingText"),p(m))}function f(m){return m===35?(e.consume(m),f):(e.exit("atxHeadingSequence"),d(m))}function p(m){return m===null||m===35||Ht(m)?(e.exit("atxHeadingText"),d(m)):(e.consume(m),p)}}const PT=["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"],b5=["pre","script","style","textarea"],$T={concrete:!0,name:"htmlFlow",resolveTo:IT,tokenize:HT},FT={partial:!0,tokenize:VT},UT={partial:!0,tokenize:qT};function IT(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 HT(e,t,n){const r=this;let a,o,u,d,f;return p;function p(R){return m(R)}function m(R){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(R),x}function x(R){return R===33?(e.consume(R),b):R===47?(e.consume(R),o=!0,j):R===63?(e.consume(R),a=3,r.interrupt?t:D):Zn(R)?(e.consume(R),u=String.fromCharCode(R),N):n(R)}function b(R){return R===45?(e.consume(R),a=2,y):R===91?(e.consume(R),a=5,d=0,_):Zn(R)?(e.consume(R),a=4,r.interrupt?t:D):n(R)}function y(R){return R===45?(e.consume(R),r.interrupt?t:D):n(R)}function _(R){const me="CDATA[";return R===me.charCodeAt(d++)?(e.consume(R),d===me.length?r.interrupt?t:M:_):n(R)}function j(R){return Zn(R)?(e.consume(R),u=String.fromCharCode(R),N):n(R)}function N(R){if(R===null||R===47||R===62||Ht(R)){const me=R===47,be=u.toLowerCase();return!me&&!o&&b5.includes(be)?(a=1,r.interrupt?t(R):M(R)):PT.includes(u.toLowerCase())?(a=6,me?(e.consume(R),w):r.interrupt?t(R):M(R)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(R):o?E(R):C(R))}return R===45||qn(R)?(e.consume(R),u+=String.fromCharCode(R),N):n(R)}function w(R){return R===62?(e.consume(R),r.interrupt?t:M):n(R)}function E(R){return pt(R)?(e.consume(R),E):L(R)}function C(R){return R===47?(e.consume(R),L):R===58||R===95||Zn(R)?(e.consume(R),T):pt(R)?(e.consume(R),C):L(R)}function T(R){return R===45||R===46||R===58||R===95||qn(R)?(e.consume(R),T):O(R)}function O(R){return R===61?(e.consume(R),z):pt(R)?(e.consume(R),O):C(R)}function z(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(e.consume(R),f=R,I):pt(R)?(e.consume(R),z):U(R)}function I(R){return R===f?(e.consume(R),f=null,Z):R===null||He(R)?n(R):(e.consume(R),I)}function U(R){return R===null||R===34||R===39||R===47||R===60||R===61||R===62||R===96||Ht(R)?O(R):(e.consume(R),U)}function Z(R){return R===47||R===62||pt(R)?C(R):n(R)}function L(R){return R===62?(e.consume(R),q):n(R)}function q(R){return R===null||He(R)?M(R):pt(R)?(e.consume(R),q):n(R)}function M(R){return R===45&&a===2?(e.consume(R),P):R===60&&a===1?(e.consume(R),$):R===62&&a===4?(e.consume(R),B):R===63&&a===3?(e.consume(R),D):R===93&&a===5?(e.consume(R),ae):He(R)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(FT,Q,ie)(R)):R===null||He(R)?(e.exit("htmlFlowData"),ie(R)):(e.consume(R),M)}function ie(R){return e.check(UT,X,Q)(R)}function X(R){return e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),Y}function Y(R){return R===null||He(R)?ie(R):(e.enter("htmlFlowData"),M(R))}function P(R){return R===45?(e.consume(R),D):M(R)}function $(R){return R===47?(e.consume(R),u="",re):M(R)}function re(R){if(R===62){const me=u.toLowerCase();return b5.includes(me)?(e.consume(R),B):M(R)}return Zn(R)&&u.length<8?(e.consume(R),u+=String.fromCharCode(R),re):M(R)}function ae(R){return R===93?(e.consume(R),D):M(R)}function D(R){return R===62?(e.consume(R),B):R===45&&a===2?(e.consume(R),D):M(R)}function B(R){return R===null||He(R)?(e.exit("htmlFlowData"),Q(R)):(e.consume(R),B)}function Q(R){return e.exit("htmlFlow"),t(R)}}function qT(e,t,n){const r=this;return a;function a(u){return He(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),o):n(u)}function o(u){return r.parser.lazy[r.now().line]?n(u):t(u)}}function VT(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(au,t,n)}}const GT={name:"htmlText",tokenize:YT};function YT(e,t,n){const r=this;let a,o,u;return d;function d(D){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(D),f}function f(D){return D===33?(e.consume(D),p):D===47?(e.consume(D),O):D===63?(e.consume(D),C):Zn(D)?(e.consume(D),U):n(D)}function p(D){return D===45?(e.consume(D),m):D===91?(e.consume(D),o=0,_):Zn(D)?(e.consume(D),E):n(D)}function m(D){return D===45?(e.consume(D),y):n(D)}function x(D){return D===null?n(D):D===45?(e.consume(D),b):He(D)?(u=x,$(D)):(e.consume(D),x)}function b(D){return D===45?(e.consume(D),y):x(D)}function y(D){return D===62?P(D):D===45?b(D):x(D)}function _(D){const B="CDATA[";return D===B.charCodeAt(o++)?(e.consume(D),o===B.length?j:_):n(D)}function j(D){return D===null?n(D):D===93?(e.consume(D),N):He(D)?(u=j,$(D)):(e.consume(D),j)}function N(D){return D===93?(e.consume(D),w):j(D)}function w(D){return D===62?P(D):D===93?(e.consume(D),w):j(D)}function E(D){return D===null||D===62?P(D):He(D)?(u=E,$(D)):(e.consume(D),E)}function C(D){return D===null?n(D):D===63?(e.consume(D),T):He(D)?(u=C,$(D)):(e.consume(D),C)}function T(D){return D===62?P(D):C(D)}function O(D){return Zn(D)?(e.consume(D),z):n(D)}function z(D){return D===45||qn(D)?(e.consume(D),z):I(D)}function I(D){return He(D)?(u=I,$(D)):pt(D)?(e.consume(D),I):P(D)}function U(D){return D===45||qn(D)?(e.consume(D),U):D===47||D===62||Ht(D)?Z(D):n(D)}function Z(D){return D===47?(e.consume(D),P):D===58||D===95||Zn(D)?(e.consume(D),L):He(D)?(u=Z,$(D)):pt(D)?(e.consume(D),Z):P(D)}function L(D){return D===45||D===46||D===58||D===95||qn(D)?(e.consume(D),L):q(D)}function q(D){return D===61?(e.consume(D),M):He(D)?(u=q,$(D)):pt(D)?(e.consume(D),q):Z(D)}function M(D){return D===null||D===60||D===61||D===62||D===96?n(D):D===34||D===39?(e.consume(D),a=D,ie):He(D)?(u=M,$(D)):pt(D)?(e.consume(D),M):(e.consume(D),X)}function ie(D){return D===a?(e.consume(D),a=void 0,Y):D===null?n(D):He(D)?(u=ie,$(D)):(e.consume(D),ie)}function X(D){return D===null||D===34||D===39||D===60||D===61||D===96?n(D):D===47||D===62||Ht(D)?Z(D):(e.consume(D),X)}function Y(D){return D===47||D===62||Ht(D)?Z(D):n(D)}function P(D){return D===62?(e.consume(D),e.exit("htmlTextData"),e.exit("htmlText"),t):n(D)}function $(D){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),re}function re(D){return pt(D)?wt(e,ae,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):ae(D)}function ae(D){return e.enter("htmlTextData"),u(D)}}const iv={name:"labelEnd",resolveAll:KT,resolveTo:ZT,tokenize:JT},WT={tokenize:eM},QT={tokenize:tM},XT={tokenize:nM};function KT(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const a=r.type==="labelImage"?4:2;r.type="data",t+=a}}return e.length!==n.length&&Ar(e,0,e.length,n),e}function ZT(e,t){let n=e.length,r=0,a,o,u,d;for(;n--;)if(a=e[n][1],o){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(u){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(o=n,a.type!=="labelLink")){r=2;break}}else a.type==="labelEnd"&&(u=n);const f={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},p={type:"label",start:{...e[o][1].start},end:{...e[u][1].end}},m={type:"labelText",start:{...e[o+r+2][1].end},end:{...e[u-2][1].start}};return d=[["enter",f,t],["enter",p,t]],d=Wr(d,e.slice(o+1,o+r+3)),d=Wr(d,[["enter",m,t]]),d=Wr(d,Qh(t.parser.constructs.insideSpan.null,e.slice(o+r+4,u-3),t)),d=Wr(d,[["exit",m,t],e[u-2],e[u-1],["exit",p,t]]),d=Wr(d,e.slice(u+1)),d=Wr(d,[["exit",f,t]]),Ar(e,o,e.length,d),e}function JT(e,t,n){const r=this;let a=r.events.length,o,u;for(;a--;)if((r.events[a][1].type==="labelImage"||r.events[a][1].type==="labelLink")&&!r.events[a][1]._balanced){o=r.events[a][1];break}return d;function d(b){return o?o._inactive?x(b):(u=r.parser.defined.includes(os(r.sliceSerialize({start:o.end,end:r.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(WT,m,u?m:x)(b):b===91?e.attempt(QT,m,u?p:x)(b):u?m(b):x(b)}function p(b){return e.attempt(XT,m,x)(b)}function m(b){return t(b)}function x(b){return o._balanced=!0,n(b)}}function eM(e,t,n){return r;function r(x){return e.enter("resource"),e.enter("resourceMarker"),e.consume(x),e.exit("resourceMarker"),a}function a(x){return Ht(x)?$c(e,o)(x):o(x)}function o(x){return x===41?m(x):Uk(e,u,d,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(x)}function u(x){return Ht(x)?$c(e,f)(x):m(x)}function d(x){return n(x)}function f(x){return x===34||x===39||x===40?Hk(e,p,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(x):m(x)}function p(x){return Ht(x)?$c(e,m)(x):m(x)}function m(x){return x===41?(e.enter("resourceMarker"),e.consume(x),e.exit("resourceMarker"),e.exit("resource"),t):n(x)}}function tM(e,t,n){const r=this;return a;function a(d){return Ik.call(r,e,o,u,"reference","referenceMarker","referenceString")(d)}function o(d){return r.parser.defined.includes(os(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(d):n(d)}function u(d){return n(d)}}function nM(e,t,n){return r;function r(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 rM={name:"labelStartImage",resolveAll:iv.resolveAll,tokenize:sM};function sM(e,t,n){const r=this;return a;function a(d){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(d),e.exit("labelImageMarker"),o}function o(d){return d===91?(e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),e.exit("labelImage"),u):n(d)}function u(d){return d===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(d):t(d)}}const iM={name:"labelStartLink",resolveAll:iv.resolveAll,tokenize:aM};function aM(e,t,n){const r=this;return a;function a(u){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),e.exit("labelLink"),o}function o(u){return u===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(u):t(u)}}const Qm={name:"lineEnding",tokenize:lM};function lM(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),wt(e,t,"linePrefix")}}const lh={name:"thematicBreak",tokenize:oM};function oM(e,t,n){let r=0,a;return o;function o(p){return e.enter("thematicBreak"),u(p)}function u(p){return a=p,d(p)}function d(p){return p===a?(e.enter("thematicBreakSequence"),f(p)):r>=3&&(p===null||He(p))?(e.exit("thematicBreak"),t(p)):n(p)}function f(p){return p===a?(e.consume(p),r++,f):(e.exit("thematicBreakSequence"),pt(p)?wt(e,d,"whitespace")(p):d(p))}}const or={continuation:{tokenize:hM},exit:pM,name:"list",tokenize:dM},cM={partial:!0,tokenize:mM},uM={partial:!0,tokenize:fM};function dM(e,t,n){const r=this,a=r.events[r.events.length-1];let o=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,u=0;return d;function d(y){const _=r.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(_==="listUnordered"?!r.containerState.marker||y===r.containerState.marker:gx(y)){if(r.containerState.type||(r.containerState.type=_,e.enter(_,{_container:!0})),_==="listUnordered")return e.enter("listItemPrefix"),y===42||y===45?e.check(lh,n,p)(y):p(y);if(!r.interrupt||y===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),f(y)}return n(y)}function f(y){return gx(y)&&++u<10?(e.consume(y),f):(!r.interrupt||u<2)&&(r.containerState.marker?y===r.containerState.marker:y===41||y===46)?(e.exit("listItemValue"),p(y)):n(y)}function p(y){return e.enter("listItemMarker"),e.consume(y),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||y,e.check(au,r.interrupt?n:m,e.attempt(cM,b,x))}function m(y){return r.containerState.initialBlankLine=!0,o++,b(y)}function x(y){return pt(y)?(e.enter("listItemPrefixWhitespace"),e.consume(y),e.exit("listItemPrefixWhitespace"),b):n(y)}function b(y){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(y)}}function hM(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(au,a,o);function a(d){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,wt(e,t,"listItemIndent",r.containerState.size+1)(d)}function o(d){return r.containerState.furtherBlankLines||!pt(d)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,u(d)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(uM,t,u)(d))}function u(d){return r.containerState._closeFlow=!0,r.interrupt=void 0,wt(e,e.attempt(or,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d)}}function fM(e,t,n){const r=this;return wt(e,a,"listItemIndent",r.containerState.size+1);function a(o){const u=r.events[r.events.length-1];return u&&u[1].type==="listItemIndent"&&u[2].sliceSerialize(u[1],!0).length===r.containerState.size?t(o):n(o)}}function pM(e){e.exit(this.containerState.type)}function mM(e,t,n){const r=this;return wt(e,a,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(o){const u=r.events[r.events.length-1];return!pt(o)&&u&&u[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const y5={name:"setextUnderline",resolveTo:gM,tokenize:xM};function gM(e,t){let n=e.length,r,a,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const u={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",o?(e.splice(a,0,["enter",u,t]),e.splice(o+1,0,["exit",e[r][1],t]),e[r][1].end={...e[o][1].end}):e[r][1]=u,e.push(["exit",u,t]),e}function xM(e,t,n){const r=this;let a;return o;function o(p){let m=r.events.length,x;for(;m--;)if(r.events[m][1].type!=="lineEnding"&&r.events[m][1].type!=="linePrefix"&&r.events[m][1].type!=="content"){x=r.events[m][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||x)?(e.enter("setextHeadingLine"),a=p,u(p)):n(p)}function u(p){return e.enter("setextHeadingLineSequence"),d(p)}function d(p){return p===a?(e.consume(p),d):(e.exit("setextHeadingLineSequence"),pt(p)?wt(e,f,"lineSuffix")(p):f(p))}function f(p){return p===null||He(p)?(e.exit("setextHeadingLine"),t(p)):n(p)}}const vM={tokenize:bM};function bM(e){const t=this,n=e.attempt(au,r,e.attempt(this.parser.constructs.flowInitial,a,wt(e,e.attempt(this.parser.constructs.flow,a,e.attempt(ST,a)),"linePrefix")));return n;function r(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 yM={resolveAll:Vk()},_M=qk("string"),wM=qk("text");function qk(e){return{resolveAll:Vk(e==="text"?kM:void 0),tokenize:t};function t(n){const r=this,a=this.parser.constructs[e],o=n.attempt(a,u,d);return u;function u(m){return p(m)?o(m):d(m)}function d(m){if(m===null){n.consume(m);return}return n.enter("data"),n.consume(m),f}function f(m){return p(m)?(n.exit("data"),o(m)):(n.consume(m),f)}function p(m){if(m===null)return!0;const x=a[m];let b=-1;if(x)for(;++b<x.length;){const y=x[b];if(!y.previous||y.previous.call(r,r.previous))return!0}return!1}}}function Vk(e){return t;function t(n,r){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,r):n}}function kM(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],a=t.sliceStream(r);let o=a.length,u=-1,d=0,f;for(;o--;){const p=a[o];if(typeof p=="string"){for(u=p.length;p.charCodeAt(u-1)===32;)d++,u--;if(u)break;u=-1}else if(p===-2)f=!0,d++;else if(p!==-1){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(d=0),d){const p={type:n===e.length||f||d<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?u:r.start._bufferIndex+u,_index:r.start._index+o,line:r.end.line,column:r.end.column-d,offset:r.end.offset-d},end:{...r.end}};r.end={...p.start},r.start.offset===r.end.offset?Object.assign(r,p):(e.splice(n,0,["enter",p,t],["exit",p,t]),n+=2)}n++}return e}const SM={42:or,43:or,45:or,48:or,49:or,50:or,51:or,52:or,53:or,54:or,55:or,56:or,57:or,62:Bk},jM={91:AT},NM={[-2]:Wm,[-1]:Wm,32:Wm},CM={35:OT,42:lh,45:[y5,lh],60:$T,61:y5,95:lh,96:v5,126:v5},EM={38:$k,92:Pk},AM={[-5]:Qm,[-4]:Qm,[-3]:Qm,33:rM,38:$k,42:xx,60:[iT,GT],91:iM,92:[DT,Pk],93:iv,95:xx,96:vT},TM={null:[xx,yM]},MM={null:[42,95]},RM={null:[]},DM=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:MM,contentInitial:jM,disable:RM,document:SM,flow:CM,flowInitial:NM,insideSpan:TM,string:EM,text:AM},Symbol.toStringTag,{value:"Module"}));function LM(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},o=[];let u=[],d=[];const f={attempt:I(O),check:I(z),consume:E,enter:C,exit:T,interrupt:I(z,{interrupt:!0})},p={code:null,containerState:{},defineSkip:j,events:[],now:_,parser:e,previous:null,sliceSerialize:b,sliceStream:y,write:x};let m=t.tokenize.call(p,f);return t.resolveAll&&o.push(t),p;function x(q){return u=Wr(u,q),N(),u[u.length-1]!==null?[]:(U(t,0),p.events=Qh(o,p.events,p),p.events)}function b(q,M){return zM(y(q),M)}function y(q){return OM(u,q)}function _(){const{_bufferIndex:q,_index:M,line:ie,column:X,offset:Y}=r;return{_bufferIndex:q,_index:M,line:ie,column:X,offset:Y}}function j(q){a[q.line]=q.column,L()}function N(){let q;for(;r._index<u.length;){const M=u[r._index];if(typeof M=="string")for(q=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===q&&r._bufferIndex<M.length;)w(M.charCodeAt(r._bufferIndex));else w(M)}}function w(q){m=m(q)}function E(q){He(q)?(r.line++,r.column=1,r.offset+=q===-3?2:1,L()):q!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===u[r._index].length&&(r._bufferIndex=-1,r._index++)),p.previous=q}function C(q,M){const ie=M||{};return ie.type=q,ie.start=_(),p.events.push(["enter",ie,p]),d.push(ie),ie}function T(q){const M=d.pop();return M.end=_(),p.events.push(["exit",M,p]),M}function O(q,M){U(q,M.from)}function z(q,M){M.restore()}function I(q,M){return ie;function ie(X,Y,P){let $,re,ae,D;return Array.isArray(X)?Q(X):"tokenize"in X?Q([X]):B(X);function B(Ce){return Le;function Le(Ee){const Ae=Ee!==null&&Ce[Ee],Ue=Ee!==null&&Ce.null,dt=[...Array.isArray(Ae)?Ae:Ae?[Ae]:[],...Array.isArray(Ue)?Ue:Ue?[Ue]:[]];return Q(dt)(Ee)}}function Q(Ce){return $=Ce,re=0,Ce.length===0?P:R(Ce[re])}function R(Ce){return Le;function Le(Ee){return D=Z(),ae=Ce,Ce.partial||(p.currentConstruct=Ce),Ce.name&&p.parser.constructs.disable.null.includes(Ce.name)?be():Ce.tokenize.call(M?Object.assign(Object.create(p),M):p,f,me,be)(Ee)}}function me(Ce){return q(ae,D),Y}function be(Ce){return D.restore(),++re<$.length?R($[re]):P}}}function U(q,M){q.resolveAll&&!o.includes(q)&&o.push(q),q.resolve&&Ar(p.events,M,p.events.length-M,q.resolve(p.events.slice(M),p)),q.resolveTo&&(p.events=q.resolveTo(p.events,p))}function Z(){const q=_(),M=p.previous,ie=p.currentConstruct,X=p.events.length,Y=Array.from(d);return{from:X,restore:P};function P(){r=q,p.previous=M,p.currentConstruct=ie,p.events.length=X,d=Y,L()}}function L(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function OM(e,t){const n=t.start._index,r=t.start._bufferIndex,a=t.end._index,o=t.end._bufferIndex;let u;if(n===a)u=[e[n].slice(r,o)];else{if(u=e.slice(n,a),r>-1){const d=u[0];typeof d=="string"?u[0]=d.slice(r):u.shift()}o>0&&u.push(e[a].slice(0,o))}return u}function zM(e,t){let n=-1;const r=[];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,r.push(u)}return r.join("")}function BM(e){const r={constructs:Ok([DM,...(e||{}).extensions||[]]),content:a(ZA),defined:[],document:a(eT),flow:a(vM),lazy:{},string:a(_M),text:a(wM)};return r;function a(o){return u;function u(d){return LM(r,o,d)}}}function PM(e){for(;!Fk(e););return e}const _5=/[\0\t\n\r]/g;function $M(){let e=1,t="",n=!0,r;return a;function a(o,u,d){const f=[];let p,m,x,b,y;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(u||void 0).decode(o)),x=0,t="",n&&(o.charCodeAt(0)===65279&&x++,n=void 0);x<o.length;){if(_5.lastIndex=x,p=_5.exec(o),b=p&&p.index!==void 0?p.index:o.length,y=o.charCodeAt(b),!p){t=o.slice(x);break}if(y===10&&x===b&&r)f.push(-3),r=void 0;else switch(r&&(f.push(-5),r=void 0),x<b&&(f.push(o.slice(x,b)),e+=b-x),y){case 0:{f.push(65533),e++;break}case 9:{for(m=Math.ceil(e/4)*4,f.push(-2);e++<m;)f.push(-1);break}case 10:{f.push(-4),e=1;break}default:r=!0,e=1}x=b+1}return d&&(r&&f.push(-5),t&&f.push(t),f.push(null)),f}}const FM=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function UM(e){return e.replace(FM,IM)}function IM(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),o=a===120||a===88;return zk(n.slice(o?2:1),o?16:10)}return sv(n)||e}const Gk={}.hasOwnProperty;function HM(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),qM(n)(PM(BM(n).document().write($M()(e,t,!0))))}function qM(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(gt),autolinkProtocol:Z,autolinkEmail:Z,atxHeading:o(rt),blockQuote:o(Ue),characterEscape:Z,characterReference:Z,codeFenced:o(dt),codeFencedFenceInfo:u,codeFencedFenceMeta:u,codeIndented:o(dt,u),codeText:o(Je,u),codeTextData:Z,data:Z,codeFlowValue:Z,definition:o(At),definitionDestinationString:u,definitionLabelString:u,definitionTitleString:u,emphasis:o(mt),hardBreakEscape:o(Lt),hardBreakTrailing:o(Lt),htmlFlow:o(we,u),htmlFlowData:Z,htmlText:o(we,u),htmlTextData:Z,image:o(Ge),label:u,link:o(gt),listItem:o(Ne),listItemValue:b,listOrdered:o(_n,x),listUnordered:o(_n),paragraph:o(Be),reference:R,referenceString:u,resourceDestinationString:u,resourceTitleString:u,setextHeading:o(rt),strong:o(yt),thematicBreak:o(Xr)},exit:{atxHeading:f(),atxHeadingSequence:O,autolink:f(),autolinkEmail:Ae,autolinkProtocol:Ee,blockQuote:f(),characterEscapeValue:L,characterReferenceMarkerHexadecimal:be,characterReferenceMarkerNumeric:be,characterReferenceValue:Ce,characterReference:Le,codeFenced:f(N),codeFencedFence:j,codeFencedFenceInfo:y,codeFencedFenceMeta:_,codeFlowValue:L,codeIndented:f(w),codeText:f(Y),codeTextData:L,data:L,definition:f(),definitionDestinationString:T,definitionLabelString:E,definitionTitleString:C,emphasis:f(),hardBreakEscape:f(M),hardBreakTrailing:f(M),htmlFlow:f(ie),htmlFlowData:L,htmlText:f(X),htmlTextData:L,image:f($),label:ae,labelText:re,lineEnding:q,link:f(P),listItem:f(),listOrdered:f(),listUnordered:f(),paragraph:f(),referenceString:me,resourceDestinationString:D,resourceTitleString:B,resource:Q,setextHeading:f(U),setextHeadingLineSequence:I,setextHeadingText:z,strong:f(),thematicBreak:f()}};Yk(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(oe){let ke={type:"root",children:[]};const W={stack:[ke],tokenStack:[],config:t,enter:d,exit:p,buffer:u,resume:m,data:n},xe=[];let Oe=-1;for(;++Oe<oe.length;)if(oe[Oe][1].type==="listOrdered"||oe[Oe][1].type==="listUnordered")if(oe[Oe][0]==="enter")xe.push(Oe);else{const Xe=xe.pop();Oe=a(oe,Xe,Oe)}for(Oe=-1;++Oe<oe.length;){const Xe=t[oe[Oe][0]];Gk.call(Xe,oe[Oe][1].type)&&Xe[oe[Oe][1].type].call(Object.assign({sliceSerialize:oe[Oe][2].sliceSerialize},W),oe[Oe][1])}if(W.tokenStack.length>0){const Xe=W.tokenStack[W.tokenStack.length-1];(Xe[1]||w5).call(W,void 0,Xe[0])}for(ke.position={start:Ui(oe.length>0?oe[0][1].start:{line:1,column:1,offset:0}),end:Ui(oe.length>0?oe[oe.length-2][1].end:{line:1,column:1,offset:0})},Oe=-1;++Oe<t.transforms.length;)ke=t.transforms[Oe](ke)||ke;return ke}function a(oe,ke,W){let xe=ke-1,Oe=-1,Xe=!1,lt,ot,Et,wn;for(;++xe<=W;){const st=oe[xe];switch(st[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{st[0]==="enter"?Oe++:Oe--,wn=void 0;break}case"lineEndingBlank":{st[0]==="enter"&&(lt&&!wn&&!Oe&&!Et&&(Et=xe),wn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:wn=void 0}if(!Oe&&st[0]==="enter"&&st[1].type==="listItemPrefix"||Oe===-1&&st[0]==="exit"&&(st[1].type==="listUnordered"||st[1].type==="listOrdered")){if(lt){let fr=xe;for(ot=void 0;fr--;){const Pn=oe[fr];if(Pn[1].type==="lineEnding"||Pn[1].type==="lineEndingBlank"){if(Pn[0]==="exit")continue;ot&&(oe[ot][1].type="lineEndingBlank",Xe=!0),Pn[1].type="lineEnding",ot=fr}else if(!(Pn[1].type==="linePrefix"||Pn[1].type==="blockQuotePrefix"||Pn[1].type==="blockQuotePrefixWhitespace"||Pn[1].type==="blockQuoteMarker"||Pn[1].type==="listItemIndent"))break}Et&&(!ot||Et<ot)&&(lt._spread=!0),lt.end=Object.assign({},ot?oe[ot][1].start:st[1].end),oe.splice(ot||xe,0,["exit",lt,st[2]]),xe++,W++}if(st[1].type==="listItemPrefix"){const fr={type:"listItem",_spread:!1,start:Object.assign({},st[1].start),end:void 0};lt=fr,oe.splice(xe,0,["enter",fr,st[2]]),xe++,W++,Et=void 0,wn=!0}}}return oe[ke][1]._spread=Xe,W}function o(oe,ke){return W;function W(xe){d.call(this,oe(xe),xe),ke&&ke.call(this,xe)}}function u(){this.stack.push({type:"fragment",children:[]})}function d(oe,ke,W){this.stack[this.stack.length-1].children.push(oe),this.stack.push(oe),this.tokenStack.push([ke,W||void 0]),oe.position={start:Ui(ke.start),end:void 0}}function f(oe){return ke;function ke(W){oe&&oe.call(this,W),p.call(this,W)}}function p(oe,ke){const W=this.stack.pop(),xe=this.tokenStack.pop();if(xe)xe[0].type!==oe.type&&(ke?ke.call(this,oe,xe[0]):(xe[1]||w5).call(this,oe,xe[0]));else throw new Error("Cannot close `"+oe.type+"` ("+Pc({start:oe.start,end:oe.end})+"): it’s not open");W.position.end=Ui(oe.end)}function m(){return rv(this.stack.pop())}function x(){this.data.expectingFirstListItemValue=!0}function b(oe){if(this.data.expectingFirstListItemValue){const ke=this.stack[this.stack.length-2];ke.start=Number.parseInt(this.sliceSerialize(oe),10),this.data.expectingFirstListItemValue=void 0}}function y(){const oe=this.resume(),ke=this.stack[this.stack.length-1];ke.lang=oe}function _(){const oe=this.resume(),ke=this.stack[this.stack.length-1];ke.meta=oe}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function N(){const oe=this.resume(),ke=this.stack[this.stack.length-1];ke.value=oe.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function w(){const oe=this.resume(),ke=this.stack[this.stack.length-1];ke.value=oe.replace(/(\r?\n|\r)$/g,"")}function E(oe){const ke=this.resume(),W=this.stack[this.stack.length-1];W.label=ke,W.identifier=os(this.sliceSerialize(oe)).toLowerCase()}function C(){const oe=this.resume(),ke=this.stack[this.stack.length-1];ke.title=oe}function T(){const oe=this.resume(),ke=this.stack[this.stack.length-1];ke.url=oe}function O(oe){const ke=this.stack[this.stack.length-1];if(!ke.depth){const W=this.sliceSerialize(oe).length;ke.depth=W}}function z(){this.data.setextHeadingSlurpLineEnding=!0}function I(oe){const ke=this.stack[this.stack.length-1];ke.depth=this.sliceSerialize(oe).codePointAt(0)===61?1:2}function U(){this.data.setextHeadingSlurpLineEnding=void 0}function Z(oe){const W=this.stack[this.stack.length-1].children;let xe=W[W.length-1];(!xe||xe.type!=="text")&&(xe=Te(),xe.position={start:Ui(oe.start),end:void 0},W.push(xe)),this.stack.push(xe)}function L(oe){const ke=this.stack.pop();ke.value+=this.sliceSerialize(oe),ke.position.end=Ui(oe.end)}function q(oe){const ke=this.stack[this.stack.length-1];if(this.data.atHardBreak){const W=ke.children[ke.children.length-1];W.position.end=Ui(oe.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ke.type)&&(Z.call(this,oe),L.call(this,oe))}function M(){this.data.atHardBreak=!0}function ie(){const oe=this.resume(),ke=this.stack[this.stack.length-1];ke.value=oe}function X(){const oe=this.resume(),ke=this.stack[this.stack.length-1];ke.value=oe}function Y(){const oe=this.resume(),ke=this.stack[this.stack.length-1];ke.value=oe}function P(){const oe=this.stack[this.stack.length-1];if(this.data.inReference){const ke=this.data.referenceType||"shortcut";oe.type+="Reference",oe.referenceType=ke,delete oe.url,delete oe.title}else delete oe.identifier,delete oe.label;this.data.referenceType=void 0}function $(){const oe=this.stack[this.stack.length-1];if(this.data.inReference){const ke=this.data.referenceType||"shortcut";oe.type+="Reference",oe.referenceType=ke,delete oe.url,delete oe.title}else delete oe.identifier,delete oe.label;this.data.referenceType=void 0}function re(oe){const ke=this.sliceSerialize(oe),W=this.stack[this.stack.length-2];W.label=UM(ke),W.identifier=os(ke).toLowerCase()}function ae(){const oe=this.stack[this.stack.length-1],ke=this.resume(),W=this.stack[this.stack.length-1];if(this.data.inReference=!0,W.type==="link"){const xe=oe.children;W.children=xe}else W.alt=ke}function D(){const oe=this.resume(),ke=this.stack[this.stack.length-1];ke.url=oe}function B(){const oe=this.resume(),ke=this.stack[this.stack.length-1];ke.title=oe}function Q(){this.data.inReference=void 0}function R(){this.data.referenceType="collapsed"}function me(oe){const ke=this.resume(),W=this.stack[this.stack.length-1];W.label=ke,W.identifier=os(this.sliceSerialize(oe)).toLowerCase(),this.data.referenceType="full"}function be(oe){this.data.characterReferenceType=oe.type}function Ce(oe){const ke=this.sliceSerialize(oe),W=this.data.characterReferenceType;let xe;W?(xe=zk(ke,W==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):xe=sv(ke);const Oe=this.stack[this.stack.length-1];Oe.value+=xe}function Le(oe){const ke=this.stack.pop();ke.position.end=Ui(oe.end)}function Ee(oe){L.call(this,oe);const ke=this.stack[this.stack.length-1];ke.url=this.sliceSerialize(oe)}function Ae(oe){L.call(this,oe);const ke=this.stack[this.stack.length-1];ke.url="mailto:"+this.sliceSerialize(oe)}function Ue(){return{type:"blockquote",children:[]}}function dt(){return{type:"code",lang:null,meta:null,value:""}}function Je(){return{type:"inlineCode",value:""}}function At(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function mt(){return{type:"emphasis",children:[]}}function rt(){return{type:"heading",depth:0,children:[]}}function Lt(){return{type:"break"}}function we(){return{type:"html",value:""}}function Ge(){return{type:"image",title:null,url:"",alt:null}}function gt(){return{type:"link",title:null,url:"",children:[]}}function _n(oe){return{type:"list",ordered:oe.type==="listOrdered",start:null,spread:oe._spread,children:[]}}function Ne(oe){return{type:"listItem",spread:oe._spread,checked:null,children:[]}}function Be(){return{type:"paragraph",children:[]}}function yt(){return{type:"strong",children:[]}}function Te(){return{type:"text",value:""}}function Xr(){return{type:"thematicBreak"}}}function Ui(e){return{line:e.line,column:e.column,offset:e.offset}}function Yk(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Yk(e,r):VM(e,r)}}function VM(e,t){let n;for(n in t)if(Gk.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function w5(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Pc({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Pc({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Pc({start:t.start,end:t.end})+") is still open")}function GM(e){const t=this;t.parser=n;function n(r){return HM(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function YM(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 WM(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
75
|
+
`}]}function QM(e,t){const n=t.value?t.value+`
|
|
76
|
+
`:"",r={},a=t.lang?t.lang.split(/\s+/):[];a.length>0&&(r.className=["language-"+a[0]]);let o={type:"element",tagName:"code",properties:r,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 XM(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function KM(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function ZM(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),a=co(r.toLowerCase()),o=e.footnoteOrder.indexOf(r);let u,d=e.footnoteCounts.get(r);d===void 0?(d=0,e.footnoteOrder.push(r),u=e.footnoteOrder.length):u=o+1,d+=1,e.footnoteCounts.set(r,d);const f={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(d>1?"-"+d:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(u)}]};e.patch(t,f);const p={type:"element",tagName:"sup",properties:{},children:[f]};return e.patch(t,p),e.applyData(t,p)}function JM(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 e8(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Wk(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];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+=r:a.push({type:"text",value:r}),a}function t8(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Wk(e,t);const a={src:co(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(a.title=r.title);const o={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,o),e.applyData(t,o)}function n8(e,t){const n={src:co(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 r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function r8(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function s8(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Wk(e,t);const a={href:co(r.url||"")};r.title!==null&&r.title!==void 0&&(a.title=r.title);const o={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function i8(e,t){const n={href:co(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function a8(e,t,n){const r=e.all(t),a=n?l8(n):Qk(t),o={},u=[];if(typeof t.checked=="boolean"){const m=r[0];let x;m&&m.type==="element"&&m.tagName==="p"?x=m:(x={type:"element",tagName:"p",properties:{},children:[]},r.unshift(x)),x.children.length>0&&x.children.unshift({type:"text",value:" "}),x.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let d=-1;for(;++d<r.length;){const m=r[d];(a||d!==0||m.type!=="element"||m.tagName!=="p")&&u.push({type:"text",value:`
|
|
77
|
+
`}),m.type==="element"&&m.tagName==="p"&&!a?u.push(...m.children):u.push(m)}const f=r[r.length-1];f&&(a||f.type!=="element"||f.tagName!=="p")&&u.push({type:"text",value:`
|
|
78
|
+
`});const p={type:"element",tagName:"li",properties:o,children:u};return e.patch(t,p),e.applyData(t,p)}function l8(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=Qk(n[r])}return t}function Qk(e){const t=e.spread;return t??e.children.length>1}function o8(e,t){const n={},r=e.all(t);let a=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++a<r.length;){const u=r[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(r,!0)};return e.patch(t,o),e.applyData(t,o)}function c8(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function u8(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function d8(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function h8(e,t){const n=e.all(t),r=n.shift(),a=[];if(r){const u={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!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)},d=Jx(t.children[1]),f=Ek(t.children[t.children.length-1]);d&&f&&(u.position={start:d,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 f8(e,t,n){const r=n?n.children:void 0,o=(r?r.indexOf(t):1)===0?"th":"td",u=n&&n.type==="table"?n.align:void 0,d=u?u.length:t.children.length;let f=-1;const p=[];for(;++f<d;){const x=t.children[f],b={},y=u?u[f]:void 0;y&&(b.align=y);let _={type:"element",tagName:o,properties:b,children:[]};x&&(_.children=e.all(x),e.patch(x,_),_=e.applyData(x,_)),p.push(_)}const m={type:"element",tagName:"tr",properties:{},children:e.wrap(p,!0)};return e.patch(t,m),e.applyData(t,m)}function p8(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const k5=9,S5=32;function m8(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),a=0;const o=[];for(;r;)o.push(j5(t.slice(a,r.index),a>0,!0),r[0]),a=r.index+r[0].length,r=n.exec(t);return o.push(j5(t.slice(a),a>0,!1)),o.join("")}function j5(e,t,n){let r=0,a=e.length;if(t){let o=e.codePointAt(r);for(;o===k5||o===S5;)r++,o=e.codePointAt(r)}if(n){let o=e.codePointAt(a-1);for(;o===k5||o===S5;)a--,o=e.codePointAt(a-1)}return a>r?e.slice(r,a):""}function g8(e,t){const n={type:"text",value:m8(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function x8(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const v8={blockquote:YM,break:WM,code:QM,delete:XM,emphasis:KM,footnoteReference:ZM,heading:JM,html:e8,imageReference:t8,image:n8,inlineCode:r8,linkReference:s8,link:i8,listItem:a8,list:o8,paragraph:c8,root:u8,strong:d8,table:h8,tableCell:p8,tableRow:f8,text:g8,thematicBreak:x8,toml:Hd,yaml:Hd,definition:Hd,footnoteDefinition:Hd};function Hd(){}const Xk=-1,Xh=0,Fc=1,zh=2,av=3,lv=4,ov=5,cv=6,Kk=7,Zk=8,{defineProperty:b8}=Object,Jk=typeof self=="object"?self:globalThis,N5=(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 Jk[e](t)},y8=(e,t)=>{const n=(a,o)=>(e.set(o,a),a),r=a=>{if(e.has(a))return e.get(a);const[o,u]=t[a];switch(o){case Xh:case Xk:return n(u,a);case Fc:{const d=n([],a);for(const f of u)d.push(r(f));return d}case zh:{const d=n({},a);for(const[f,p]of u){const m=r(f),x=r(p);m==="__proto__"?b8(d,m,{value:x,configurable:!0,enumerable:!0,writable:!0}):d[m]=x}return d}case av:return n(new Date(u),a);case lv:{const{source:d,flags:f}=u;return n(new RegExp(d,f),a)}case ov:{const d=n(new Map,a);for(const[f,p]of u)d.set(r(f),r(p));return d}case cv:{const d=n(new Set,a);for(const f of u)d.add(r(f));return d}case Kk:{const{name:d,message:f}=u;return n(typeof Jk[d]=="function"?N5(d,f):new Error(f),a)}case Zk: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:d}=new Uint8Array(u);return n(new DataView(d),u)}case"-0":return-0}return n(N5(o,u),a)};return r},C5=e=>y8(new Map,e)(0),Ra="",{toString:_8}={},{keys:w8,is:k8}=Object,_c=e=>{const t=typeof e;if(t!=="object"||!e)return[Xh,t];const n=_8.call(e).slice(8,-1);switch(n){case"Array":return[Fc,Ra];case"Object":return[zh,Ra];case"Date":return[av,Ra];case"RegExp":return[lv,Ra];case"Map":return[ov,Ra];case"Set":return[cv,Ra];case"DataView":return[Fc,n]}return n.includes("Array")?[Fc,n]:e instanceof Error?[Kk,e.name||"Error"]:[zh,n]},qd=([e,t])=>e===Xh&&(t==="function"||t==="symbol"),S8=(e,t,n,r)=>{const a=(u,d)=>{const f=r.push(u)-1;return n.set(d,f),f},o=u=>{if(n.has(u))return n.get(u);let[d,f]=_c(u);switch(d){case Xh:{let m=u;switch(f){case"bigint":d=Zk,m=u.toString();break;case"number":if(!u&&k8(u,-0))return r.push(["-0"])-1;break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+f);m=null;break;case"undefined":return a([Xk],u)}return a([d,m],u)}case Fc:{if(f){let b=u;return f==="DataView"?b=new Uint8Array(u.buffer):f==="ArrayBuffer"&&(b=new Uint8Array(u)),a([f,[...b]],u)}const m=[],x=a([d,m],u);for(const b of u)m.push(o(b));return x}case zh:{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 m=[],x=a([d,m],u);for(const b of w8(u))(e||!qd(_c(u[b])))&&m.push([o(b),o(u[b])]);return x}case av:return a([d,isNaN(u.getTime())?Ra:u.toISOString()],u);case lv:{const{source:m,flags:x}=u;return a([d,{source:m,flags:x}],u)}case ov:{const m=[],x=a([d,m],u);for(const[b,y]of u)(e||!(qd(_c(b))||qd(_c(y))))&&m.push([o(b),o(y)]);return x}case cv:{const m=[],x=a([d,m],u);for(const b of u)(e||!qd(_c(b)))&&m.push(o(b));return x}}const{message:p}=u;return a([d,{name:f,message:p}],u)};return o},E5=(e,{json:t,lossy:n}={})=>{const r=[];return S8(!(t||n),!!t,new Map,r)(e),r},Bh=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?C5(E5(e,t)):structuredClone(e):(e,t)=>C5(E5(e,t));function j8(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 N8(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function C8(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||j8,r=e.options.footnoteBackLabel||N8,a=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",u=e.options.footnoteLabelProperties||{className:["sr-only"]},d=[];let f=-1;for(;++f<e.footnoteOrder.length;){const p=e.footnoteById.get(e.footnoteOrder[f]);if(!p)continue;const m=e.all(p),x=String(p.identifier).toUpperCase(),b=co(x.toLowerCase());let y=0;const _=[],j=e.footnoteCounts.get(x);for(;j!==void 0&&++y<=j;){_.length>0&&_.push({type:"text",value:" "});let E=typeof n=="string"?n:n(f,y);typeof E=="string"&&(E={type:"text",value:E}),_.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+b+(y>1?"-"+y:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(f,y),className:["data-footnote-backref"]},children:Array.isArray(E)?E:[E]})}const N=m[m.length-1];if(N&&N.type==="element"&&N.tagName==="p"){const E=N.children[N.children.length-1];E&&E.type==="text"?E.value+=" ":N.children.push({type:"text",value:" "}),N.children.push(..._)}else m.push(..._);const w={type:"element",tagName:"li",properties:{id:t+"fn-"+b},children:e.wrap(m,!0)};e.patch(p,w),d.push(w)}if(d.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...Bh(u),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:`
|
|
79
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(d,!0)},{type:"text",value:`
|
|
80
|
+
`}]}}const Kh=(function(e){if(e==null)return M8;if(typeof e=="function")return Zh(e);if(typeof e=="object")return Array.isArray(e)?E8(e):A8(e);if(typeof e=="string")return T8(e);throw new Error("Expected function, string, or object as test")});function E8(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Kh(e[n]);return Zh(r);function r(...a){let o=-1;for(;++o<t.length;)if(t[o].apply(this,a))return!0;return!1}}function A8(e){const t=e;return Zh(n);function n(r){const a=r;let o;for(o in e)if(a[o]!==t[o])return!1;return!0}}function T8(e){return Zh(t);function t(n){return n&&n.type===e}}function Zh(e){return t;function t(n,r,a){return!!(R8(n)&&e.call(this,n,typeof r=="number"?r:void 0,a||void 0))}}function M8(){return!0}function R8(e){return e!==null&&typeof e=="object"&&"type"in e}const eS=[],D8=!0,vx=!1,L8="skip";function tS(e,t,n,r){let a;typeof t=="function"&&typeof n!="function"?(r=n,n=t):a=t;const o=Kh(a),u=r?-1:1;d(e,void 0,[])();function d(f,p,m){const x=f&&typeof f=="object"?f:{};if(typeof x.type=="string"){const y=typeof x.tagName=="string"?x.tagName:typeof x.name=="string"?x.name:void 0;Object.defineProperty(b,"name",{value:"node ("+(f.type+(y?"<"+y+">":""))+")"})}return b;function b(){let y=eS,_,j,N;if((!t||o(f,p,m[m.length-1]||void 0))&&(y=O8(n(f,m)),y[0]===vx))return y;if("children"in f&&f.children){const w=f;if(w.children&&y[0]!==L8)for(j=(r?w.children.length:-1)+u,N=m.concat(w);j>-1&&j<w.children.length;){const E=w.children[j];if(_=d(E,j,N)(),_[0]===vx)return _;j=typeof _[1]=="number"?_[1]:j+u}}return y}}}function O8(e){return Array.isArray(e)?e:typeof e=="number"?[D8,e]:e==null?eS:[e]}function uv(e,t,n,r){let a,o,u;typeof t=="function"&&typeof n!="function"?(o=void 0,u=t,a=n):(o=t,u=n,a=r),tS(e,o,d,a);function d(f,p){const m=p[p.length-1],x=m?m.children.indexOf(f):void 0;return u(f,x,m)}}const bx={}.hasOwnProperty,z8={};function B8(e,t){const n=t||z8,r=new Map,a=new Map,o=new Map,u={...v8,...n.handlers},d={all:p,applyData:$8,definitionById:r,footnoteById:a,footnoteCounts:o,footnoteOrder:[],handlers:u,one:f,options:n,patch:P8,wrap:U8};return uv(e,function(m){if(m.type==="definition"||m.type==="footnoteDefinition"){const x=m.type==="definition"?r:a,b=String(m.identifier).toUpperCase();x.has(b)||x.set(b,m)}}),d;function f(m,x){const b=m.type,y=d.handlers[b];if(bx.call(d.handlers,b)&&y)return y(d,m,x);if(d.options.passThrough&&d.options.passThrough.includes(b)){if("children"in m){const{children:j,...N}=m,w=Bh(N);return w.children=d.all(m),w}return Bh(m)}return(d.options.unknownHandler||F8)(d,m,x)}function p(m){const x=[];if("children"in m){const b=m.children;let y=-1;for(;++y<b.length;){const _=d.one(b[y],m);if(_){if(y&&b[y-1].type==="break"&&(!Array.isArray(_)&&_.type==="text"&&(_.value=A5(_.value)),!Array.isArray(_)&&_.type==="element")){const j=_.children[0];j&&j.type==="text"&&(j.value=A5(j.value))}Array.isArray(_)?x.push(..._):x.push(_)}}}return x}}function P8(e,t){e.position&&(t.position=SA(e))}function $8(e,t){let n=t;if(e&&e.data){const r=e.data.hName,a=e.data.hChildren,o=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const u="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:u}}n.type==="element"&&o&&Object.assign(n.properties,Bh(o)),"children"in n&&n.children&&a!==null&&a!==void 0&&(n.children=a)}return n}function F8(e,t){const n=t.data||{},r="value"in t&&!(bx.call(n,"hProperties")||bx.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function U8(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
|
|
81
|
+
`});++r<e.length;)r&&n.push({type:"text",value:`
|
|
82
|
+
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
83
|
+
`}),n}function A5(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function T5(e,t){const n=B8(e,t),r=n.one(e,void 0),a=C8(n),o=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return a&&o.children.push({type:"text",value:`
|
|
84
|
+
`},a),o}function I8(e,t){return e&&"run"in e?async function(n,r){const a=T5(n,{file:r,...t});await e.run(a,r)}:function(n,r){return T5(n,{file:r,...e||t})}}function M5(e){if(e)throw e}var Xm,R5;function H8(){if(R5)return Xm;R5=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,a=function(p){return typeof Array.isArray=="function"?Array.isArray(p):t.call(p)==="[object Array]"},o=function(p){if(!p||t.call(p)!=="[object Object]")return!1;var m=e.call(p,"constructor"),x=p.constructor&&p.constructor.prototype&&e.call(p.constructor.prototype,"isPrototypeOf");if(p.constructor&&!m&&!x)return!1;var b;for(b in p);return typeof b>"u"||e.call(p,b)},u=function(p,m){n&&m.name==="__proto__"?n(p,m.name,{enumerable:!0,configurable:!0,value:m.newValue,writable:!0}):p[m.name]=m.newValue},d=function(p,m){if(m==="__proto__")if(e.call(p,m)){if(r)return r(p,m).value}else return;return p[m]};return Xm=function f(){var p,m,x,b,y,_,j=arguments[0],N=1,w=arguments.length,E=!1;for(typeof j=="boolean"&&(E=j,j=arguments[1]||{},N=2),(j==null||typeof j!="object"&&typeof j!="function")&&(j={});N<w;++N)if(p=arguments[N],p!=null)for(m in p)x=d(j,m),b=d(p,m),j!==b&&(E&&b&&(o(b)||(y=a(b)))?(y?(y=!1,_=x&&a(x)?x:[]):_=x&&o(x)?x:{},u(j,{name:m,newValue:f(E,_,b)})):typeof b<"u"&&u(j,{name:m,newValue:b}));return j},Xm}var q8=H8();const Km=Nx(q8);function yx(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 V8(){const e=[],t={run:n,use:r};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);d(null,...a);function d(f,...p){const m=e[++o];let x=-1;if(f){u(f);return}for(;++x<a.length;)(p[x]===null||p[x]===void 0)&&(p[x]=a[x]);a=p,m?G8(m,d)(...p):u(null,...p)}}function r(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function G8(e,t){let n;return r;function r(...u){const d=e.length>u.length;let f;d&&u.push(a);try{f=e.apply(this,u)}catch(p){const m=p;if(d&&n)throw m;return a(m)}d||(f&&f.then&&typeof f.then=="function"?f.then(o,a):f instanceof Error?a(f):o(f))}function a(u,...d){n||(n=!0,t(u,...d))}function o(u){a(null,u)}}const ks={basename:Y8,dirname:W8,extname:Q8,join:X8,sep:"/"};function Y8(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');lu(e);let n=0,r=-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 r<0&&(o=!0,r=a+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let u=-1,d=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(o){n=a+1;break}}else u<0&&(o=!0,u=a+1),d>-1&&(e.codePointAt(a)===t.codePointAt(d--)?d<0&&(r=a):(d=-1,r=u));return n===r?r=u:r<0&&(r=e.length),e.slice(n,r)}function W8(e){if(lu(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function Q8(e){lu(e);let t=e.length,n=-1,r=0,a=-1,o=0,u;for(;t--;){const d=e.codePointAt(t);if(d===47){if(u){r=t+1;break}continue}n<0&&(u=!0,n=t+1),d===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===r+1?"":e.slice(a,n)}function X8(...e){let t=-1,n;for(;++t<e.length;)lu(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":K8(n)}function K8(e){lu(e);const t=e.codePointAt(0)===47;let n=Z8(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Z8(e,t){let n="",r=0,a=-1,o=0,u=-1,d,f;for(;++u<=e.length;){if(u<e.length)d=e.codePointAt(u);else{if(d===47)break;d=47}if(d===47){if(!(a===u-1||o===1))if(a!==u-1&&o===2){if(n.length<2||r!==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="",r=0):(n=n.slice(0,f),r=n.length-1-n.lastIndexOf("/")),a=u,o=0;continue}}else if(n.length>0){n="",r=0,a=u,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(a+1,u):n=e.slice(a+1,u),r=u-a-1;a=u,o=0}else d===46&&o>-1?o++:o=-1}return n}function lu(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const J8={cwd:e7};function e7(){return"/"}function _x(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function t7(e){if(typeof e=="string")e=new URL(e);else if(!_x(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 n7(e)}function n7(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===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 Zm=["history","path","basename","stem","extname","dirname"];class nS{constructor(t){let n;t?_x(t)?n={path:t}:typeof t=="string"||r7(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":J8.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Zm.length;){const o=Zm[r];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let a;for(a in n)Zm.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?ks.basename(this.path):void 0}set basename(t){eg(t,"basename"),Jm(t,"basename"),this.path=ks.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?ks.dirname(this.path):void 0}set dirname(t){D5(this.basename,"dirname"),this.path=ks.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?ks.extname(this.path):void 0}set extname(t){if(Jm(t,"extname"),D5(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=ks.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){_x(t)&&(t=t7(t)),eg(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?ks.basename(this.path,this.extname):void 0}set stem(t){eg(t,"stem"),Jm(t,"stem"),this.path=ks.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const a=this.message(t,n,r);throw a.fatal=!0,a}info(t,n,r){const a=this.message(t,n,r);return a.fatal=void 0,a}message(t,n,r){const a=new Gn(t,n,r);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 Jm(e,t){if(e&&e.includes(ks.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+ks.sep+"`")}function eg(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function D5(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function r7(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const s7=(function(e){const r=this.constructor.prototype,a=r[e],o=function(){return a.apply(o,arguments)};return Object.setPrototypeOf(o,r),o}),i7={}.hasOwnProperty;class dv extends s7{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=V8()}copy(){const t=new dv;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Km(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(rg("data",this.frozen),this.namespace[t]=n,this):i7.call(this.namespace,t)&&this.namespace[t]||void 0:t?(rg("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,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const a=n.call(t,...r);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Vd(t),r=this.parser||this.Parser;return tg("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),tg("process",this.parser||this.Parser),ng("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(o,u){const d=Vd(t),f=r.parse(d);r.run(f,d,function(m,x,b){if(m||!x||!b)return p(m);const y=x,_=r.stringify(y,b);o7(_)?b.value=_:b.result=_,p(m,b)});function p(m,x){m||!x?u(m):o?o(x):n(void 0,x)}}}processSync(t){let n=!1,r;return this.freeze(),tg("processSync",this.parser||this.Parser),ng("processSync",this.compiler||this.Compiler),this.process(t,a),O5("processSync","process",n),r;function a(o,u){n=!0,M5(o),r=u}}run(t,n,r){L5(t),this.freeze();const a=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?o(void 0,r):new Promise(o);function o(u,d){const f=Vd(n);a.run(t,f,p);function p(m,x,b){const y=x||t;m?d(m):u?u(y):r(void 0,y,b)}}}runSync(t,n){let r=!1,a;return this.run(t,n,o),O5("runSync","run",r),a;function o(u,d){M5(u),a=d,r=!0}}stringify(t,n){this.freeze();const r=Vd(n),a=this.compiler||this.Compiler;return ng("stringify",a),L5(t),a(t,r)}use(t,...n){const r=this.attachers,a=this.namespace;if(rg("use",this.frozen),t!=null)if(typeof t=="function")f(t,n);else if(typeof t=="object")Array.isArray(t)?d(t):u(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function o(p){if(typeof p=="function")f(p,[]);else if(typeof p=="object")if(Array.isArray(p)){const[m,...x]=p;f(m,x)}else u(p);else throw new TypeError("Expected usable value, not `"+p+"`")}function u(p){if(!("plugins"in p)&&!("settings"in p))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");d(p.plugins),p.settings&&(a.settings=Km(!0,a.settings,p.settings))}function d(p){let m=-1;if(p!=null)if(Array.isArray(p))for(;++m<p.length;){const x=p[m];o(x)}else throw new TypeError("Expected a list of plugins, not `"+p+"`")}function f(p,m){let x=-1,b=-1;for(;++x<r.length;)if(r[x][0]===p){b=x;break}if(b===-1)r.push([p,...m]);else if(m.length>0){let[y,..._]=m;const j=r[b][1];yx(j)&&yx(y)&&(y=Km(!0,j,y)),r[b]=[p,y,..._]}}}}const a7=new dv().freeze();function tg(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function ng(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function rg(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 L5(e){if(!yx(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function O5(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Vd(e){return l7(e)?e:new nS(e)}function l7(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function o7(e){return typeof e=="string"||c7(e)}function c7(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const u7="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",z5=[],B5={allowDangerousHtml:!0},d7=/^(https?|ircs?|mailto|xmpp)$/i,h7=[{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 hv(e){const t=f7(e),n=p7(e);return m7(t.runSync(t.parse(n),n),e)}function f7(e){const t=e.rehypePlugins||z5,n=e.remarkPlugins||z5,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...B5}:B5;return a7().use(GM).use(n).use(I8,r).use(t)}function p7(e){const t=e.children||"",n=new nS;return typeof t=="string"&&(n.value=t),n}function m7(e,t){const n=t.allowedElements,r=t.allowElement,a=t.components,o=t.disallowedElements,u=t.skipHtml,d=t.unwrapDisallowed,f=t.urlTransform||g7;for(const m of h7)Object.hasOwn(t,m.from)&&(""+m.from+(m.to?"use `"+m.to+"` instead":"remove it")+u7+m.id,void 0);return uv(e,p),AA(e,{Fragment:l.Fragment,components:a,ignoreInvalidStyle:!0,jsx:l.jsx,jsxs:l.jsxs,passKeys:!0,passNode:!0});function p(m,x,b){if(m.type==="raw"&&b&&typeof x=="number")return u?b.children.splice(x,1):b.children[x]={type:"text",value:m.value},x;if(m.type==="element"){let y;for(y in Ym)if(Object.hasOwn(Ym,y)&&Object.hasOwn(m.properties,y)){const _=m.properties[y],j=Ym[y];(j===null||j.includes(m.tagName))&&(m.properties[y]=f(String(_||""),y,m))}}if(m.type==="element"){let y=n?!n.includes(m.tagName):o?o.includes(m.tagName):!1;if(!y&&r&&typeof x=="number"&&(y=!r(m,x,b)),y&&b&&typeof x=="number")return d&&m.children?b.children.splice(x,1,...m.children):b.children.splice(x,1),x}}}function g7(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),a=e.indexOf("/");return t===-1||a!==-1&&t>a||n!==-1&&t>n||r!==-1&&t>r||d7.test(e.slice(0,t))?e:""}function P5(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,a=n.indexOf(t);for(;a!==-1;)r++,a=n.indexOf(t,a+t.length);return r}function x7(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function v7(e,t,n){const a=Kh((n||{}).ignore||[]),o=b7(t);let u=-1;for(;++u<o.length;)tS(e,"text",d);function d(p,m){let x=-1,b;for(;++x<m.length;){const y=m[x],_=b?b.children:void 0;if(a(y,_?_.indexOf(y):void 0,b))return;b=y}if(b)return f(p,m)}function f(p,m){const x=m[m.length-1],b=o[u][0],y=o[u][1];let _=0;const N=x.children.indexOf(p);let w=!1,E=[];b.lastIndex=0;let C=b.exec(p.value);for(;C;){const T=C.index,O={index:C.index,input:C.input,stack:[...m,p]};let z=y(...C,O);if(typeof z=="string"&&(z=z.length>0?{type:"text",value:z}:void 0),z===!1?b.lastIndex=T+1:(_!==T&&E.push({type:"text",value:p.value.slice(_,T)}),Array.isArray(z)?E.push(...z):z&&E.push(z),_=T+C[0].length,w=!0),!b.global)break;C=b.exec(p.value)}return w?(_<p.value.length&&E.push({type:"text",value:p.value.slice(_)}),x.children.splice(N,1,...E)):E=[p],N+E.length}}function b7(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 r=-1;for(;++r<n.length;){const a=n[r];t.push([y7(a[0]),_7(a[1])])}return t}function y7(e){return typeof e=="string"?new RegExp(x7(e),"g"):e}function _7(e){return typeof e=="function"?e:function(){return e}}const sg="phrasing",ig=["autolink","link","image","label"];function w7(){return{transforms:[A7],enter:{literalAutolink:S7,literalAutolinkEmail:ag,literalAutolinkHttp:ag,literalAutolinkWww:ag},exit:{literalAutolink:E7,literalAutolinkEmail:C7,literalAutolinkHttp:j7,literalAutolinkWww:N7}}}function k7(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:sg,notInConstruct:ig},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:sg,notInConstruct:ig},{character:":",before:"[ps]",after:"\\/",inConstruct:sg,notInConstruct:ig}]}}function S7(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function ag(e){this.config.enter.autolinkProtocol.call(this,e)}function j7(e){this.config.exit.autolinkProtocol.call(this,e)}function N7(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 C7(e){this.config.exit.autolinkEmail.call(this,e)}function E7(e){this.exit(e)}function A7(e){v7(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,T7],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),M7]],{ignore:["link","linkReference"]})}function T7(e,t,n,r,a){let o="";if(!rS(a)||(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!R7(n)))return!1;const u=D7(n+r);if(!u[0])return!1;const d={type:"link",title:null,url:o+t+u[0],children:[{type:"text",value:t+u[0]}]};return u[1]?[d,{type:"text",value:u[1]}]:d}function M7(e,t,n,r){return!rS(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function R7(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 D7(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const a=P5(e,"(");let o=P5(e,")");for(;r!==-1&&a>o;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),o++;return[e,n]}function rS(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Pa(n)||Wh(n))&&(!t||n!==47)}sS.peek=I7;function L7(){this.buffer()}function O7(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function z7(){this.buffer()}function B7(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function P7(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=os(this.sliceSerialize(e)).toLowerCase(),n.label=t}function $7(e){this.exit(e)}function F7(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=os(this.sliceSerialize(e)).toLowerCase(),n.label=t}function U7(e){this.exit(e)}function I7(){return"["}function sS(e,t,n,r){const a=n.createTracker(r);let o=a.move("[^");const u=n.enter("footnoteReference"),d=n.enter("reference");return o+=a.move(n.safe(n.associationId(e),{after:"]",before:o})),d(),u(),o+=a.move("]"),o}function H7(){return{enter:{gfmFootnoteCallString:L7,gfmFootnoteCall:O7,gfmFootnoteDefinitionLabelString:z7,gfmFootnoteDefinition:B7},exit:{gfmFootnoteCallString:P7,gfmFootnoteCall:$7,gfmFootnoteDefinitionLabelString:F7,gfmFootnoteDefinition:U7}}}function q7(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:sS},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,a,o,u){const d=o.createTracker(u);let f=d.move("[^");const p=o.enter("footnoteDefinition"),m=o.enter("label");return f+=d.move(o.safe(o.associationId(r),{before:f,after:"]"})),m(),f+=d.move("]:"),r.children&&r.children.length>0&&(d.shift(4),f+=d.move((t?`
|
|
85
|
+
`:" ")+o.indentLines(o.containerFlow(r,d.current()),t?iS:V7))),p(),f}}function V7(e,t,n){return t===0?e:iS(e,t,n)}function iS(e,t,n){return(n?"":" ")+e}const G7=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];aS.peek=K7;function Y7(){return{canContainEols:["delete"],enter:{strikethrough:Q7},exit:{strikethrough:X7}}}function W7(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:G7}],handlers:{delete:aS}}}function Q7(e){this.enter({type:"delete",children:[]},e)}function X7(e){this.exit(e)}function aS(e,t,n,r){const a=n.createTracker(r),o=n.enter("strikethrough");let u=a.move("~~");return u+=n.containerPhrasing(e,{...a.current(),before:u,after:"~"}),u+=a.move("~~"),o(),u}function K7(){return"~"}function Z7(e){return e.length}function J7(e,t){const n=t||{},r=(n.align||[]).concat(),a=n.stringLength||Z7,o=[],u=[],d=[],f=[];let p=0,m=-1;for(;++m<e.length;){const j=[],N=[];let w=-1;for(e[m].length>p&&(p=e[m].length);++w<e[m].length;){const E=eR(e[m][w]);if(n.alignDelimiters!==!1){const C=a(E);N[w]=C,(f[w]===void 0||C>f[w])&&(f[w]=C)}j.push(E)}u[m]=j,d[m]=N}let x=-1;if(typeof r=="object"&&"length"in r)for(;++x<p;)o[x]=$5(r[x]);else{const j=$5(r);for(;++x<p;)o[x]=j}x=-1;const b=[],y=[];for(;++x<p;){const j=o[x];let N="",w="";j===99?(N=":",w=":"):j===108?N=":":j===114&&(w=":");let E=n.alignDelimiters===!1?1:Math.max(1,f[x]-N.length-w.length);const C=N+"-".repeat(E)+w;n.alignDelimiters!==!1&&(E=N.length+E+w.length,E>f[x]&&(f[x]=E),y[x]=E),b[x]=C}u.splice(1,0,b),d.splice(1,0,y),m=-1;const _=[];for(;++m<u.length;){const j=u[m],N=d[m];x=-1;const w=[];for(;++x<p;){const E=j[x]||"";let C="",T="";if(n.alignDelimiters!==!1){const O=f[x]-(N[x]||0),z=o[x];z===114?C=" ".repeat(O):z===99?O%2?(C=" ".repeat(O/2+.5),T=" ".repeat(O/2-.5)):(C=" ".repeat(O/2),T=C):T=" ".repeat(O)}n.delimiterStart!==!1&&!x&&w.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&E==="")&&(n.delimiterStart!==!1||x)&&w.push(" "),n.alignDelimiters!==!1&&w.push(C),w.push(E),n.alignDelimiters!==!1&&w.push(T),n.padding!==!1&&w.push(" "),(n.delimiterEnd!==!1||x!==p-1)&&w.push("|")}_.push(n.delimiterEnd===!1?w.join("").replace(/ +$/,""):w.join(""))}return _.join(`
|
|
86
|
+
`)}function eR(e){return e==null?"":String(e)}function $5(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function tR(e,t,n,r){const a=n.enter("blockquote"),o=n.createTracker(r);o.move("> "),o.shift(2);const u=n.indentLines(n.containerFlow(e,o.current()),nR);return a(),u}function nR(e,t,n){return">"+(n?"":" ")+e}function rR(e,t){return F5(e,t.inConstruct,!0)&&!F5(e,t.notInConstruct,!1)}function F5(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function U5(e,t,n,r){let a=-1;for(;++a<n.unsafe.length;)if(n.unsafe[a].character===`
|
|
87
|
+
`&&rR(n.stack,n.unsafe[a]))return/[ \t]/.test(r.before)?"":" ";return`\\
|
|
88
|
+
`}function sR(e,t){const n=String(e);let r=n.indexOf(t),a=r,o=0,u=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===a?++o>u&&(u=o):o=1,a=r+t.length,r=n.indexOf(t,a);return u}function iR(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function aR(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 lR(e,t,n,r){const a=aR(n),o=e.value||"",u=a==="`"?"GraveAccent":"Tilde";if(iR(e,n)){const x=n.enter("codeIndented"),b=n.indentLines(o,oR);return x(),b}const d=n.createTracker(r),f=a.repeat(Math.max(sR(o,a)+1,3)),p=n.enter("codeFenced");let m=d.move(f);if(e.lang){const x=n.enter(`codeFencedLang${u}`);m+=d.move(n.safe(e.lang,{before:m,after:" ",encode:["`"],...d.current()})),x()}if(e.lang&&e.meta){const x=n.enter(`codeFencedMeta${u}`);m+=d.move(" "),m+=d.move(n.safe(e.meta,{before:m,after:`
|
|
89
|
+
`,encode:["`"],...d.current()})),x()}return m+=d.move(`
|
|
90
|
+
`),o&&(m+=d.move(o+`
|
|
91
|
+
`)),m+=d.move(f),p(),m}function oR(e,t,n){return(n?"":" ")+e}function fv(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 cR(e,t,n,r){const a=fv(n),o=a==='"'?"Quote":"Apostrophe",u=n.enter("definition");let d=n.enter("label");const f=n.createTracker(r);let p=f.move("[");return p+=f.move(n.safe(n.associationId(e),{before:p,after:"]",...f.current()})),p+=f.move("]: "),d(),!e.url||/[\0- \u007F]/.test(e.url)?(d=n.enter("destinationLiteral"),p+=f.move("<"),p+=f.move(n.safe(e.url,{before:p,after:">",...f.current()})),p+=f.move(">")):(d=n.enter("destinationRaw"),p+=f.move(n.safe(e.url,{before:p,after:e.title?" ":`
|
|
92
|
+
`,...f.current()}))),d(),e.title&&(d=n.enter(`title${o}`),p+=f.move(" "+a),p+=f.move(n.safe(e.title,{before:p,after:a,...f.current()})),p+=f.move(a),d()),u(),p}function uR(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function eu(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Ph(e,t,n){const r=io(e),a=io(t);return r===void 0?a===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}lS.peek=dR;function lS(e,t,n,r){const a=uR(n),o=n.enter("emphasis"),u=n.createTracker(r),d=u.move(a);let f=u.move(n.containerPhrasing(e,{after:a,before:d,...u.current()}));const p=f.charCodeAt(0),m=Ph(r.before.charCodeAt(r.before.length-1),p,a);m.inside&&(f=eu(p)+f.slice(1));const x=f.charCodeAt(f.length-1),b=Ph(r.after.charCodeAt(0),x,a);b.inside&&(f=f.slice(0,-1)+eu(x));const y=u.move(a);return o(),n.attentionEncodeSurroundingInfo={after:b.outside,before:m.outside},d+f+y}function dR(e,t,n){return n.options.emphasis||"*"}function hR(e,t){let n=!1;return uv(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,vx}),!!((!e.depth||e.depth<3)&&rv(e)&&(t.options.setext||n))}function fR(e,t,n,r){const a=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(r);if(hR(e,n)){const m=n.enter("headingSetext"),x=n.enter("phrasing"),b=n.containerPhrasing(e,{...o.current(),before:`
|
|
93
|
+
`,after:`
|
|
94
|
+
`});return x(),m(),b+`
|
|
95
|
+
`+(a===1?"=":"-").repeat(b.length-(Math.max(b.lastIndexOf("\r"),b.lastIndexOf(`
|
|
96
|
+
`))+1))}const u="#".repeat(a),d=n.enter("headingAtx"),f=n.enter("phrasing");o.move(u+" ");let p=n.containerPhrasing(e,{before:"# ",after:`
|
|
97
|
+
`,...o.current()});return/^[\t ]/.test(p)&&(p=eu(p.charCodeAt(0))+p.slice(1)),p=p?u+" "+p:u,n.options.closeAtx&&(p+=" "+u),f(),d(),p}oS.peek=pR;function oS(e){return e.value||""}function pR(){return"<"}cS.peek=mR;function cS(e,t,n,r){const a=fv(n),o=a==='"'?"Quote":"Apostrophe",u=n.enter("image");let d=n.enter("label");const f=n.createTracker(r);let p=f.move("![");return p+=f.move(n.safe(e.alt,{before:p,after:"]",...f.current()})),p+=f.move("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=n.enter("destinationLiteral"),p+=f.move("<"),p+=f.move(n.safe(e.url,{before:p,after:">",...f.current()})),p+=f.move(">")):(d=n.enter("destinationRaw"),p+=f.move(n.safe(e.url,{before:p,after:e.title?" ":")",...f.current()}))),d(),e.title&&(d=n.enter(`title${o}`),p+=f.move(" "+a),p+=f.move(n.safe(e.title,{before:p,after:a,...f.current()})),p+=f.move(a),d()),p+=f.move(")"),u(),p}function mR(){return"!"}uS.peek=gR;function uS(e,t,n,r){const a=e.referenceType,o=n.enter("imageReference");let u=n.enter("label");const d=n.createTracker(r);let f=d.move("![");const p=n.safe(e.alt,{before:f,after:"]",...d.current()});f+=d.move(p+"]["),u();const m=n.stack;n.stack=[],u=n.enter("reference");const x=n.safe(n.associationId(e),{before:f,after:"]",...d.current()});return u(),n.stack=m,o(),a==="full"||!p||p!==x?f+=d.move(x+"]"):a==="shortcut"?f=f.slice(0,-1):f+=d.move("]"),f}function gR(){return"!"}dS.peek=xR;function dS(e,t,n){let r=e.value||"",a="`",o=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(r);)a+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++o<n.unsafe.length;){const u=n.unsafe[o],d=n.compilePattern(u);let f;if(u.atBreak)for(;f=d.exec(r);){let p=f.index;r.charCodeAt(p)===10&&r.charCodeAt(p-1)===13&&p--,r=r.slice(0,p)+" "+r.slice(f.index+1)}}return a+r+a}function xR(){return"`"}function hS(e,t){const n=rv(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))}fS.peek=vR;function fS(e,t,n,r){const a=fv(n),o=a==='"'?"Quote":"Apostrophe",u=n.createTracker(r);let d,f;if(hS(e,n)){const m=n.stack;n.stack=[],d=n.enter("autolink");let x=u.move("<");return x+=u.move(n.containerPhrasing(e,{before:x,after:">",...u.current()})),x+=u.move(">"),d(),n.stack=m,x}d=n.enter("link"),f=n.enter("label");let p=u.move("[");return p+=u.move(n.containerPhrasing(e,{before:p,after:"](",...u.current()})),p+=u.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),p+=u.move("<"),p+=u.move(n.safe(e.url,{before:p,after:">",...u.current()})),p+=u.move(">")):(f=n.enter("destinationRaw"),p+=u.move(n.safe(e.url,{before:p,after:e.title?" ":")",...u.current()}))),f(),e.title&&(f=n.enter(`title${o}`),p+=u.move(" "+a),p+=u.move(n.safe(e.title,{before:p,after:a,...u.current()})),p+=u.move(a),f()),p+=u.move(")"),d(),p}function vR(e,t,n){return hS(e,n)?"<":"["}pS.peek=bR;function pS(e,t,n,r){const a=e.referenceType,o=n.enter("linkReference");let u=n.enter("label");const d=n.createTracker(r);let f=d.move("[");const p=n.containerPhrasing(e,{before:f,after:"]",...d.current()});f+=d.move(p+"]["),u();const m=n.stack;n.stack=[],u=n.enter("reference");const x=n.safe(n.associationId(e),{before:f,after:"]",...d.current()});return u(),n.stack=m,o(),a==="full"||!p||p!==x?f+=d.move(x+"]"):a==="shortcut"?f=f.slice(0,-1):f+=d.move("]"),f}function bR(){return"["}function pv(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 yR(e){const t=pv(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function _R(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function mS(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 wR(e,t,n,r){const a=n.enter("list"),o=n.bulletCurrent;let u=e.ordered?_R(n):pv(n);const d=e.ordered?u==="."?")":".":yR(n);let f=t&&n.bulletLastUsed?u===n.bulletLastUsed:!1;if(!e.ordered){const m=e.children?e.children[0]:void 0;if((u==="*"||u==="-")&&m&&(!m.children||!m.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),mS(n)===u&&m){let x=-1;for(;++x<e.children.length;){const b=e.children[x];if(b&&b.type==="listItem"&&b.children&&b.children[0]&&b.children[0].type==="thematicBreak"){f=!0;break}}}}f&&(u=d),n.bulletCurrent=u;const p=n.containerFlow(e,r);return n.bulletLastUsed=u,n.bulletCurrent=o,a(),p}function kR(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 SR(e,t,n,r){const a=kR(n);let o=n.bulletCurrent||pv(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 d=n.createTracker(r);d.move(o+" ".repeat(u-o.length)),d.shift(u);const f=n.enter("listItem"),p=n.indentLines(n.containerFlow(e,d.current()),m);return f(),p;function m(x,b,y){return b?(y?"":" ".repeat(u))+x:(y?o:o+" ".repeat(u-o.length))+x}}function jR(e,t,n,r){const a=n.enter("paragraph"),o=n.enter("phrasing"),u=n.containerPhrasing(e,r);return o(),a(),u}const NR=Kh(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function CR(e,t,n,r){return(e.children.some(function(u){return NR(u)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function ER(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}gS.peek=AR;function gS(e,t,n,r){const a=ER(n),o=n.enter("strong"),u=n.createTracker(r),d=u.move(a+a);let f=u.move(n.containerPhrasing(e,{after:a,before:d,...u.current()}));const p=f.charCodeAt(0),m=Ph(r.before.charCodeAt(r.before.length-1),p,a);m.inside&&(f=eu(p)+f.slice(1));const x=f.charCodeAt(f.length-1),b=Ph(r.after.charCodeAt(0),x,a);b.inside&&(f=f.slice(0,-1)+eu(x));const y=u.move(a+a);return o(),n.attentionEncodeSurroundingInfo={after:b.outside,before:m.outside},d+f+y}function AR(e,t,n){return n.options.strong||"*"}function TR(e,t,n,r){return n.safe(e.value,r)}function MR(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 RR(e,t,n){const r=(mS(n)+(n.options.ruleSpaces?" ":"")).repeat(MR(n));return n.options.ruleSpaces?r.slice(0,-1):r}const xS={blockquote:tR,break:U5,code:lR,definition:cR,emphasis:lS,hardBreak:U5,heading:fR,html:oS,image:cS,imageReference:uS,inlineCode:dS,link:fS,linkReference:pS,list:wR,listItem:SR,paragraph:jR,root:CR,strong:gS,text:TR,thematicBreak:RR};function DR(){return{enter:{table:LR,tableData:I5,tableHeader:I5,tableRow:zR},exit:{codeText:BR,table:OR,tableData:lg,tableHeader:lg,tableRow:lg}}}function LR(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 OR(e){this.exit(e),this.data.inTable=void 0}function zR(e){this.enter({type:"tableRow",children:[]},e)}function lg(e){this.exit(e)}function I5(e){this.enter({type:"tableCell",children:[]},e)}function BR(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,PR));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function PR(e,t){return t==="|"?t:e}function $R(e){const t=e||{},n=t.tableCellPadding,r=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:d}};function u(y,_,j,N){return p(m(y,j,N),y.align)}function d(y,_,j,N){const w=x(y,j,N),E=p([w]);return E.slice(0,E.indexOf(`
|
|
99
|
+
`))}function f(y,_,j,N){const w=j.enter("tableCell"),E=j.enter("phrasing"),C=j.containerPhrasing(y,{...N,before:o,after:o});return E(),w(),C}function p(y,_){return J7(y,{align:_,alignDelimiters:r,padding:n,stringLength:a})}function m(y,_,j){const N=y.children;let w=-1;const E=[],C=_.enter("table");for(;++w<N.length;)E[w]=x(N[w],_,j);return C(),E}function x(y,_,j){const N=y.children;let w=-1;const E=[],C=_.enter("tableRow");for(;++w<N.length;)E[w]=f(N[w],y,_,j);return C(),E}function b(y,_,j){let N=xS.inlineCode(y,_,j);return j.stack.includes("tableCell")&&(N=N.replace(/\|/g,"\\$&")),N}}function FR(){return{exit:{taskListCheckValueChecked:H5,taskListCheckValueUnchecked:H5,paragraph:IR}}}function UR(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:HR}}}function H5(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function IR(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 r=n.children[0];if(r&&r.type==="text"){const a=t.children;let o=-1,u;for(;++o<a.length;){const d=a[o];if(d.type==="paragraph"){u=d;break}}u===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function HR(e,t,n,r){const a=e.children[0],o=typeof e.checked=="boolean"&&a&&a.type==="paragraph",u="["+(e.checked?"x":" ")+"] ",d=n.createTracker(r);o&&d.move(u);let f=xS.listItem(e,t,n,{...r,...d.current()});return o&&(f=f.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,p)),f;function p(m){return m+u}}function qR(){return[w7(),H7(),Y7(),DR(),FR()]}function VR(e){return{extensions:[k7(),q7(e),W7(),$R(e),UR()]}}const GR={tokenize:ZR,partial:!0},vS={tokenize:JR,partial:!0},bS={tokenize:eD,partial:!0},yS={tokenize:tD,partial:!0},YR={tokenize:nD,partial:!0},_S={name:"wwwAutolink",tokenize:XR,previous:kS},wS={name:"protocolAutolink",tokenize:KR,previous:SS},li={name:"emailAutolink",tokenize:QR,previous:jS},Es={};function WR(){return{text:Es}}let Ca=48;for(;Ca<123;)Es[Ca]=li,Ca++,Ca===58?Ca=65:Ca===91&&(Ca=97);Es[43]=li;Es[45]=li;Es[46]=li;Es[95]=li;Es[72]=[li,wS];Es[104]=[li,wS];Es[87]=[li,_S];Es[119]=[li,_S];function QR(e,t,n){const r=this;let a,o;return u;function u(x){return!wx(x)||!jS.call(r,r.previous)||mv(r.events)?n(x):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),d(x))}function d(x){return wx(x)?(e.consume(x),d):x===64?(e.consume(x),f):n(x)}function f(x){return x===46?e.check(YR,m,p)(x):x===45||x===95||qn(x)?(o=!0,e.consume(x),f):m(x)}function p(x){return e.consume(x),a=!0,f}function m(x){return o&&a&&Zn(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(x)):n(x)}}function XR(e,t,n){const r=this;return a;function a(u){return u!==87&&u!==119||!kS.call(r,r.previous)||mv(r.events)?n(u):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(GR,e.attempt(vS,e.attempt(bS,o),n),n)(u))}function o(u){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(u)}}function KR(e,t,n){const r=this;let a="",o=!1;return u;function u(x){return(x===72||x===104)&&SS.call(r,r.previous)&&!mv(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(x),e.consume(x),d):n(x)}function d(x){if(Zn(x)&&a.length<5)return a+=String.fromCodePoint(x),e.consume(x),d;if(x===58){const b=a.toLowerCase();if(b==="http"||b==="https")return e.consume(x),f}return n(x)}function f(x){return x===47?(e.consume(x),o?p:(o=!0,f)):n(x)}function p(x){return x===null||Oh(x)||Ht(x)||Pa(x)||Wh(x)?n(x):e.attempt(vS,e.attempt(bS,m),n)(x)}function m(x){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(x)}}function ZR(e,t,n){let r=0;return a;function a(u){return(u===87||u===119)&&r<3?(r++,e.consume(u),a):u===46&&r===3?(e.consume(u),o):n(u)}function o(u){return u===null?n(u):t(u)}}function JR(e,t,n){let r,a,o;return u;function u(p){return p===46||p===95?e.check(yS,f,d)(p):p===null||Ht(p)||Pa(p)||p!==45&&Wh(p)?f(p):(o=!0,e.consume(p),u)}function d(p){return p===95?r=!0:(a=r,r=void 0),e.consume(p),u}function f(p){return a||r||!o?n(p):t(p)}}function eD(e,t){let n=0,r=0;return a;function a(u){return u===40?(n++,e.consume(u),a):u===41&&r<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(yS,t,o)(u):u===null||Ht(u)||Pa(u)?t(u):(e.consume(u),a)}function o(u){return u===41&&r++,e.consume(u),a}}function tD(e,t,n){return r;function r(d){return d===33||d===34||d===39||d===41||d===42||d===44||d===46||d===58||d===59||d===63||d===95||d===126?(e.consume(d),r):d===38?(e.consume(d),o):d===93?(e.consume(d),a):d===60||d===null||Ht(d)||Pa(d)?t(d):n(d)}function a(d){return d===null||d===40||d===91||Ht(d)||Pa(d)?t(d):r(d)}function o(d){return Zn(d)?u(d):n(d)}function u(d){return d===59?(e.consume(d),r):Zn(d)?(e.consume(d),u):n(d)}}function nD(e,t,n){return r;function r(o){return e.consume(o),a}function a(o){return qn(o)?n(o):t(o)}}function kS(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Ht(e)}function SS(e){return!Zn(e)}function jS(e){return!(e===47||wx(e))}function wx(e){return e===43||e===45||e===46||e===95||qn(e)}function mv(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const rD={tokenize:dD,partial:!0};function sD(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:oD,continuation:{tokenize:cD},exit:uD}},text:{91:{name:"gfmFootnoteCall",tokenize:lD},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:iD,resolveTo:aD}}}}function iD(e,t,n){const r=this;let a=r.events.length;const o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let u;for(;a--;){const f=r.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 d;function d(f){if(!u||!u._balanced)return n(f);const p=os(r.sliceSerialize({start:u.end,end:r.now()}));return p.codePointAt(0)!==94||!o.includes(p.slice(1))?n(f):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),t(f))}}function aD(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 r={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)},d=[e[n+1],e[n+2],["enter",r,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",r,t]];return e.splice(n,e.length-n+1,...d),e}function lD(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o=0,u;return d;function d(x){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(x),e.exit("gfmFootnoteCallLabelMarker"),f}function f(x){return x!==94?n(x):(e.enter("gfmFootnoteCallMarker"),e.consume(x),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",p)}function p(x){if(o>999||x===93&&!u||x===null||x===91||Ht(x))return n(x);if(x===93){e.exit("chunkString");const b=e.exit("gfmFootnoteCallString");return a.includes(os(r.sliceSerialize(b)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(x),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(x)}return Ht(x)||(u=!0),o++,e.consume(x),x===92?m:p}function m(x){return x===91||x===92||x===93?(e.consume(x),o++,p):p(x)}}function oD(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,u=0,d;return f;function f(_){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(_),e.exit("gfmFootnoteDefinitionLabelMarker"),p}function p(_){return _===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(_),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",m):n(_)}function m(_){if(u>999||_===93&&!d||_===null||_===91||Ht(_))return n(_);if(_===93){e.exit("chunkString");const j=e.exit("gfmFootnoteDefinitionLabelString");return o=os(r.sliceSerialize(j)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(_),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),b}return Ht(_)||(d=!0),u++,e.consume(_),_===92?x:m}function x(_){return _===91||_===92||_===93?(e.consume(_),u++,m):m(_)}function b(_){return _===58?(e.enter("definitionMarker"),e.consume(_),e.exit("definitionMarker"),a.includes(o)||a.push(o),wt(e,y,"gfmFootnoteDefinitionWhitespace")):n(_)}function y(_){return t(_)}}function cD(e,t,n){return e.check(au,t,e.attempt(rD,t,n))}function uD(e){e.exit("gfmFootnoteDefinition")}function dD(e,t,n){const r=this;return wt(e,a,"gfmFootnoteDefinitionIndent",5);function a(o){const u=r.events[r.events.length-1];return u&&u[1].type==="gfmFootnoteDefinitionIndent"&&u[2].sliceSerialize(u[1],!0).length===4?t(o):n(o)}}function hD(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:o,resolveAll:a};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function a(u,d){let f=-1;for(;++f<u.length;)if(u[f][0]==="enter"&&u[f][1].type==="strikethroughSequenceTemporary"&&u[f][1]._close){let p=f;for(;p--;)if(u[p][0]==="exit"&&u[p][1].type==="strikethroughSequenceTemporary"&&u[p][1]._open&&u[f][1].end.offset-u[f][1].start.offset===u[p][1].end.offset-u[p][1].start.offset){u[f][1].type="strikethroughSequence",u[p][1].type="strikethroughSequence";const m={type:"strikethrough",start:Object.assign({},u[p][1].start),end:Object.assign({},u[f][1].end)},x={type:"strikethroughText",start:Object.assign({},u[p][1].end),end:Object.assign({},u[f][1].start)},b=[["enter",m,d],["enter",u[p][1],d],["exit",u[p][1],d],["enter",x,d]],y=d.parser.constructs.insideSpan.null;y&&Ar(b,b.length,0,Qh(y,u.slice(p+1,f),d)),Ar(b,b.length,0,[["exit",x,d],["enter",u[f][1],d],["exit",u[f][1],d],["exit",m,d]]),Ar(u,p-1,f-p+3,b),f=p+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,d,f){const p=this.previous,m=this.events;let x=0;return b;function b(_){return p===126&&m[m.length-1][1].type!=="characterEscape"?f(_):(u.enter("strikethroughSequenceTemporary"),y(_))}function y(_){const j=io(p);if(_===126)return x>1?f(_):(u.consume(_),x++,y);if(x<2&&!n)return f(_);const N=u.exit("strikethroughSequenceTemporary"),w=io(_);return N._open=!w||w===2&&!!j,N._close=!j||j===2&&!!w,d(_)}}}class fD{constructor(){this.map=[]}add(t,n,r){pD(this,t,n,r)}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 r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let a=r.pop();for(;a;){for(const o of a)t.push(o);a=r.pop()}this.map.length=0}}function pD(e,t,n,r){let a=0;if(!(n===0&&r.length===0)){for(;a<e.map.length;){if(e.map[a][0]===t){e.map[a][1]+=n,e.map[a][2].push(...r);return}a+=1}e.map.push([t,n,r])}}function mD(e,t){let n=!1;const r=[];for(;t<e.length;){const a=e[t];if(n){if(a[0]==="enter")a[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(a[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const o=r.length-1;r[o]=r[o]==="left"?"center":"right"}}else if(a[1].type==="tableDelimiterRow")break}else a[0]==="enter"&&a[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function gD(){return{flow:{null:{name:"table",tokenize:xD,resolveAll:vD}}}}function xD(e,t,n){const r=this;let a=0,o=0,u;return d;function d(L){let q=r.events.length-1;for(;q>-1;){const X=r.events[q][1].type;if(X==="lineEnding"||X==="linePrefix")q--;else break}const M=q>-1?r.events[q][1].type:null,ie=M==="tableHead"||M==="tableRow"?z:f;return ie===z&&r.parser.lazy[r.now().line]?n(L):ie(L)}function f(L){return e.enter("tableHead"),e.enter("tableRow"),p(L)}function p(L){return L===124||(u=!0,o+=1),m(L)}function m(L){return L===null?n(L):He(L)?o>1?(o=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),y):n(L):pt(L)?wt(e,m,"whitespace")(L):(o+=1,u&&(u=!1,a+=1),L===124?(e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),u=!0,m):(e.enter("data"),x(L)))}function x(L){return L===null||L===124||Ht(L)?(e.exit("data"),m(L)):(e.consume(L),L===92?b:x)}function b(L){return L===92||L===124?(e.consume(L),x):x(L)}function y(L){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(L):(e.enter("tableDelimiterRow"),u=!1,pt(L)?wt(e,_,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):_(L))}function _(L){return L===45||L===58?N(L):L===124?(u=!0,e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),j):O(L)}function j(L){return pt(L)?wt(e,N,"whitespace")(L):N(L)}function N(L){return L===58?(o+=1,u=!0,e.enter("tableDelimiterMarker"),e.consume(L),e.exit("tableDelimiterMarker"),w):L===45?(o+=1,w(L)):L===null||He(L)?T(L):O(L)}function w(L){return L===45?(e.enter("tableDelimiterFiller"),E(L)):O(L)}function E(L){return L===45?(e.consume(L),E):L===58?(u=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(L),e.exit("tableDelimiterMarker"),C):(e.exit("tableDelimiterFiller"),C(L))}function C(L){return pt(L)?wt(e,T,"whitespace")(L):T(L)}function T(L){return L===124?_(L):L===null||He(L)?!u||a!==o?O(L):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(L)):O(L)}function O(L){return n(L)}function z(L){return e.enter("tableRow"),I(L)}function I(L){return L===124?(e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),I):L===null||He(L)?(e.exit("tableRow"),t(L)):pt(L)?wt(e,I,"whitespace")(L):(e.enter("data"),U(L))}function U(L){return L===null||L===124||Ht(L)?(e.exit("data"),I(L)):(e.consume(L),L===92?Z:U)}function Z(L){return L===92||L===124?(e.consume(L),U):U(L)}}function vD(e,t){let n=-1,r=!0,a=0,o=[0,0,0,0],u=[0,0,0,0],d=!1,f=0,p,m,x;const b=new fD;for(;++n<e.length;){const y=e[n],_=y[1];y[0]==="enter"?_.type==="tableHead"?(d=!1,f!==0&&(q5(b,t,f,p,m),m=void 0,f=0),p={type:"table",start:Object.assign({},_.start),end:Object.assign({},_.end)},b.add(n,0,[["enter",p,t]])):_.type==="tableRow"||_.type==="tableDelimiterRow"?(r=!0,x=void 0,o=[0,0,0,0],u=[0,n+1,0,0],d&&(d=!1,m={type:"tableBody",start:Object.assign({},_.start),end:Object.assign({},_.end)},b.add(n,0,[["enter",m,t]])),a=_.type==="tableDelimiterRow"?2:m?3:1):a&&(_.type==="data"||_.type==="tableDelimiterMarker"||_.type==="tableDelimiterFiller")?(r=!1,u[2]===0&&(o[1]!==0&&(u[0]=u[1],x=Gd(b,t,o,a,void 0,x),o=[0,0,0,0]),u[2]=n)):_.type==="tableCellDivider"&&(r?r=!1:(o[1]!==0&&(u[0]=u[1],x=Gd(b,t,o,a,void 0,x)),o=u,u=[o[1],n,0,0])):_.type==="tableHead"?(d=!0,f=n):_.type==="tableRow"||_.type==="tableDelimiterRow"?(f=n,o[1]!==0?(u[0]=u[1],x=Gd(b,t,o,a,n,x)):u[1]!==0&&(x=Gd(b,t,u,a,n,x)),a=0):a&&(_.type==="data"||_.type==="tableDelimiterMarker"||_.type==="tableDelimiterFiller")&&(u[3]=n)}for(f!==0&&q5(b,t,f,p,m),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=mD(t.events,n))}return e}function Gd(e,t,n,r,a,o){const u=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",d="tableContent";n[0]!==0&&(o.end=Object.assign({},$l(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const f=$l(t.events,n[1]);if(o={type:u,start:Object.assign({},f),end:Object.assign({},f)},e.add(n[1],0,[["enter",o,t]]),n[2]!==0){const p=$l(t.events,n[2]),m=$l(t.events,n[3]),x={type:d,start:Object.assign({},p),end:Object.assign({},m)};if(e.add(n[2],0,[["enter",x,t]]),r!==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",x,t]])}return a!==void 0&&(o.end=Object.assign({},$l(t.events,a)),e.add(a,0,[["exit",o,t]]),o=void 0),o}function q5(e,t,n,r,a){const o=[],u=$l(t.events,n);a&&(a.end=Object.assign({},u),o.push(["exit",a,t])),r.end=Object.assign({},u),o.push(["exit",r,t]),e.add(n+1,0,o)}function $l(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const bD={name:"tasklistCheck",tokenize:_D};function yD(){return{text:{91:bD}}}function _D(e,t,n){const r=this;return a;function a(f){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(f):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(f),e.exit("taskListCheckMarker"),o)}function o(f){return Ht(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"),d):n(f)}function d(f){return He(f)?t(f):pt(f)?e.check({tokenize:wD},t,n)(f):n(f)}}function wD(e,t,n){return wt(e,r,"whitespace");function r(a){return a===null?n(a):t(a)}}function kD(e){return Ok([WR(),sD(),hD(e),gD(),yD()])}const SD={};function gv(e){const t=this,n=e||SD,r=t.data(),a=r.micromarkExtensions||(r.micromarkExtensions=[]),o=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),u=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);a.push(kD(n)),o.push(qR()),u.push(VR(n))}const jD=1500;async function ND(e){var r;try{if(typeof navigator<"u"&&((r=navigator.clipboard)!=null&&r.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 Jh({text:e,label:t="Copy",className:n=""}){const[r,a]=k.useState(!1),o=k.useRef(null);k.useEffect(()=>()=>{o.current&&clearTimeout(o.current)},[]);const u=async()=>{await ND(e)&&(a(!0),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>a(!1),jD))},d=r?"Copied":t;return l.jsx("button",{type:"button",onClick:u,"aria-label":d,title:d,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:r?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 $h(e){var t;return e==null||typeof e=="boolean"?"":typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map($h).join(""):typeof e=="object"&&e!==null&&"props"in e?$h((t=e.props)==null?void 0:t.children):""}const og=/https?:\/\/[^\s<>"'`]+/gi,CD=`.,;:!?]}>'"`;function ED(e){let t=e.length;for(;t>0;){const n=e[t-1];if(n===")"){const r=e.slice(0,t),a=(r.match(/\(/g)||[]).length,o=(r.match(/\)/g)||[]).length;if(a>=o)break;t--;continue}if(CD.includes(n)){t--;continue}break}return e.slice(0,t)}function AD(e){return/^https?:\/\/[^\s/]/i.test(e)}function TD(e){if(!e)return[];const t=[];let n=0;og.lastIndex=0;let r;for(;(r=og.exec(e))!==null;){const a=ED(r[0]);!a||!AD(a)||(r.index>n&&t.push({type:"text",value:e.slice(n,r.index)}),t.push({type:"link",value:a,href:a}),n=r.index+a.length,og.lastIndex=n)}return n<e.length&&t.push({type:"text",value:e.slice(n)}),t}const V5=40;function MD(e){const t=e.replace(/\s+/g," ").trim();return t?`Copy ${t.length>V5?`${t.slice(0,V5-1)}…`:t}`:"Copy"}function NS({children:e,className:t="",textClassName:n="text-[12.5px] text-cc-fg/80"}){const r=$h(e);if(!r)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=TD(r);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(Jh,{text:r,label:MD(r),className:"shrink-0 self-center w-4 h-4 -my-0.5 opacity-60 hover:opacity-100"})]})}const Fh=25*1024*1024,Uh=100*1024*1024;function CS(e){return new Promise((t,n)=>{const r=new FileReader;r.onload=()=>{const o=r.result.split(",")[1],u=e.type||"application/octet-stream";t({base64:o,mediaType:u})},r.onerror=n,r.readAsDataURL(e)})}function Gi(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 ES(e){return e.startsWith("image/")}function AS({name:e,mediaType:t}){const n=(e.split(".").pop()||"").toLowerCase();let r="FILE";return t==="application/pdf"||n==="pdf"?r="PDF":["zip","tar","gz","tgz","bz2","xz","7z","rar"].includes(n)?r="ZIP":["csv","tsv"].includes(n)?r="CSV":["json","yaml","yml","toml","xml"].includes(n)?r="DATA":["md","txt","log"].includes(n)?r="TXT":["doc","docx","rtf","odt"].includes(n)?r="DOC":["xls","xlsx","ods"].includes(n)?r="XLS":["mp3","wav","ogg","flac","m4a"].includes(n)?r="AUD":["mp4","mov","webm","mkv","avi"].includes(n)?r="VID":n&&(r=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:r})]})}function TS({name:e,mediaType:t,base64:n,size:r,onRemove:a,className:o="w-12 h-12"}){const u=ES(t);return l.jsxs("div",{className:"relative group",title:`${e} (${Gi(r)})`,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(AS,{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 RD({name:e,mediaType:t,data:n,size:r}){return ES(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(AS,{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:Gi(r)})]})]})}function DD({message:e}){const t=$a(),[n,r]=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:()=>r(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 LD({message:e}){return e.role==="system"?l.jsx(DD,{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(RD,{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(xv,{text:e.content})})]})}):l.jsx("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]",children:l.jsx($D,{message:e})})}function OD(e){const t=[];for(const n of e)if(n.type==="tool_use"){const r=t[t.length-1];(r==null?void 0:r.kind)==="tool_group"&&r.name===n.name?r.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 zD(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 BD(e){return e.kind==="content"&&e.block.type==="thinking"&&!e.block.thinking.trim()}function PD({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 $D({message:e}){var u;const t=e.contentBlocks||[],n=$a(),r=k.useMemo(()=>OD(t),[t]),a=k.useMemo(()=>zD(t),[t]),o=k.useMemo(()=>n?r.filter(d=>!BD(d)):r,[r,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(cg,{}),l.jsx("div",{className:"flex-1 min-w-0",children:l.jsx(PD,{streaming:e.isStreaming})})]});if(t.length===0&&e.content){const d=e.isStreaming&&e.streamingPhase==="thinking";return l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(cg,{}),l.jsx("div",{className:"flex-1 min-w-0",children:d?l.jsx(RS,{text:e.content}):l.jsx(xv,{text:e.content,showCursor:!!e.isStreaming})})]})}return l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(cg,{}),l.jsx("div",{className:`flex-1 min-w-0 ${n?"space-y-1.5":"space-y-3"}`,children:o.map((d,f)=>{if(d.kind==="content")return l.jsx(FD,{block:d.block,toolUseById:a},f);if(d.items.length===1){const p=d.items[0];return l.jsx(yw,{name:p.name,input:p.input,toolUseId:p.id},f)}return l.jsx(HD,{name:d.name,items:d.items},f)})})]})}function cg(){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 xv({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(hv,{remarkPlugins:[gv],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:r})=>l.jsx("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:"text-cc-primary hover:underline",children:r}),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:r,className:a}=n,o=/language-(\w+)/.exec(a||"");if(o||typeof r=="string"&&r.includes(`
|
|
100
|
+
`)){const d=(o==null?void 0:o[1])||"",f=$h(r);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"})]}),d&&l.jsx("span",{className:"text-[10px] text-cc-muted/70 font-mono-code uppercase tracking-wider",children:d}),l.jsx(Jh,{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:r})})]})}return l.jsx(NS,{children:r})},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 FD({block:e,toolUseById:t}){if(e.type==="text")return l.jsx(xv,{text:e.text});if(e.type==="thinking")return l.jsx(RS,{text:e.thinking});if(e.type==="tool_use")return l.jsx(yw,{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),r=t.get(e.tool_use_id),a=r==null?void 0:r.name,o=e.is_error??!1;return a==="Bash"?l.jsx(UD,{text:n,isError:o}):l.jsx(ID,{content:n,isError:o})}return null}function MS(e){return`${e} ${e===1?"line":"lines"}`}function UD({text:e,isError:t}){const n=e.split(/\r?\n/),r=n.length>20,[a,o]=k.useState(!1),u=$a(),[d,f]=k.useState(!1),p=a||!r?e:n.slice(-20).join(`
|
|
101
|
+
`),m=l.jsxs("div",{className:"relative rounded-lg bg-cc-code-bg overflow-hidden",children:[l.jsx(Jh,{text:e,label:"Copy output",className:"absolute top-1 right-1 z-10 bg-cc-code-bg/80 backdrop-blur-sm"}),l.jsx("pre",{className:`text-[12px] font-mono-code px-3 py-2 whitespace-pre-wrap leading-relaxed ${t?"text-cc-error":"text-cc-code-fg/60"}`,children:p}),r&&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(Hh,{open:d,onToggle:()=>f(!d),marker:"›",label:t?"Error output":"Output",meta:MS(n.length),labelClassName:t?"text-cc-error/70":""}),d&&l.jsx("div",{className:"mt-1",children:m})]}):m}function ID({content:e,isError:t}){const n=$a(),[r,a]=k.useState(!1),o=l.jsxs("div",{className:"relative rounded-lg bg-cc-code-bg overflow-hidden",children:[l.jsx(Jh,{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(Hh,{open:r,onToggle:()=>a(!r),marker:"›",label:t?"Error result":"Result",meta:MS(e.split(/\r?\n/).length),labelClassName:t?"text-cc-error/70":""}),r&&l.jsx("div",{className:"mt-1",children:o})]}):o}function HD({name:e,items:t}){const[n,r]=k.useState(!1),a=tu(e),o=Yi(e);return l.jsxs("div",{className:"border border-cc-border rounded-[10px] overflow-hidden bg-cc-card tool-card",children:[l.jsxs("button",{onClick:()=>r(!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(Xl,{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,d)=>{const f=Ic(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||d)})})]})}function RS({text:e}){const t=e.trim(),n=$a(),[r,a]=k.useState(!1),o=t.split(`
|
|
102
|
+
`),u=n?2:8,d=n?200:600,f=o.length>u||t.length>d,p=f&&!r?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(hv,{remarkPlugins:[gv],components:{p:({children:m})=>l.jsx("p",{className:"mb-2 last:mb-0",children:m}),ul:({children:m})=>l.jsx("ul",{className:"list-disc pl-4 mb-2 space-y-0.5",children:m}),ol:({children:m})=>l.jsx("ol",{className:"list-decimal pl-4 mb-2 space-y-0.5",children:m}),li:({children:m})=>l.jsx("li",{children:m}),code:({children:m})=>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:m})},children:p||"No thinking text captured."})}),f&&!r&&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 Ec(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function wc(e){const t=Math.floor(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function G5(e){try{const t=new Date(e).getTime()-Date.now();return Number.isFinite(t)?t<=0?"now":qD(t):"N/A"}catch{return"N/A"}}function kx(e){const n=(e>0&&e<1e12?e*1e3:e)-Date.now();if(n<=0)return"now";const r=Math.floor(n/864e5),a=Math.floor(n%864e5/36e5),o=Math.floor(n%36e5/6e4);return r>0?`${r}d ${a}h`:a>0?`${a}h${o}m`:`${o}m`}function Y5(e){return e>=1440?`${Math.round(e/1440)}d`:e>=60?`${Math.round(e/60)}h`:`${e}m`}function qD(e){const t=Math.floor(e/864e5),n=Math.floor(e%864e5/36e5),r=Math.floor(e%36e5/6e4);return t>0?`${t}d ${n}h${r}m`:n>0?`${n}h${r}m`:`${r}m`}function VD({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(Xl,{type:tu(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:Yi(t.toolName)}),l.jsxs("span",{className:"text-cc-muted/50 tabular-nums",children:[t.elapsedSeconds,"s"]})]},n))})}function GD({entries:e}){const[t,n]=k.useState(!1),r=k.useMemo(()=>{const a=e.reduce((f,p)=>f+p.elapsedSeconds,0),o=Math.max(...e.map(f=>f.elapsedSeconds),.1),u=e.filter(f=>f.isError).length,d=e.filter(f=>!f.completedAt).length;return{totalTime:a,maxTime:o,errorCount:u,running:d}},[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 ${r.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:[r.totalTime.toFixed(1),"s"]}),r.errorCount>0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/40",children:"·"}),l.jsxs("span",{className:"text-cc-error",children:[r.errorCount," error",r.errorCount>1?"s":""]})]}),r.running>0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/40",children:"·"}),l.jsxs("span",{className:"text-cc-primary",children:[r.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/r.maxTime*100)}%`,minWidth:"3px"},title:`${Yi(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(YD,{entry:a,maxTime:r.maxTime},a.toolUseId))})]})}function YD({entry:e,maxTime:t}){const n=Math.max(3,e.elapsedSeconds/t*100),r=!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":r?"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(Xl,{type:tu(e.toolName)}),l.jsx("span",{className:"text-cc-fg/70 truncate",children:Yi(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":r?"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})]})}const Yd=100,WD=40,QD=120,W5=1e4,XD=15*6e4,ug=new Map,KD=[],ZD=[];function JD(e){const t=e.split("/").filter(Boolean);return t.length===0?e:t.slice(-2).join("/")}function eL(e){if(e.role!=="assistant")return null;const t=e.contentBlocks;if(!t||t.length===0)return null;let n=null;for(const r of t){if(r.type==="text"&&r.text.trim()||r.type==="thinking")return null;if(r.type==="tool_use"){if(n===null)n=r.name;else if(n!==r.name)return null}}return n}function Q5(e){return(e.contentBlocks||[]).filter(n=>n.type==="tool_use").map(n=>({id:n.id,name:n.name,input:n.input}))}function tL(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 DS(e){const t=[];for(const n of e){const r=eL(n);if(r){const a=t[t.length-1];if((a==null?void 0:a.kind)==="tool_msg_group"&&a.toolName===r){a.items.push(...Q5(n));continue}t.push({kind:"tool_msg_group",toolName:r,items:Q5(n),firstId:n.id})}else t.push({kind:"message",msg:n})}return t}function LS(e,t,n){const r=DS(e),a=[];for(const o of r){a.push(o);const u=tL(o);for(const d of u){const f=n.get(d);if(f&&f.length>0){const p=t.get(d)||{description:"Subagent",agentType:""},m=LS(f,t,n);a.push({kind:"subagent",taskToolUseId:d,description:p.description,agentType:p.agentType,backend:p.backend,status:p.status,receiverCount:p.receiverCount,senderThreadId:p.senderThreadId,receiverThreadIds:p.receiverThreadIds,children:m})}}}return a}function nL(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:d}=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,p=f&&f.length>0?f.length:void 0,m=typeof(u==null?void 0:u.sender_thread_id)=="string"&&u.sender_thread_id.length>0?u.sender_thread_id:void 0,x=typeof(u==null?void 0:u.codex_status)=="string"||m!==void 0||p!==void 0;t.set(d,{description:String((u==null?void 0:u.description)||"Subagent"),agentType:String((u==null?void 0:u.subagent_type)||""),backend:x?"codex":"claude",status:typeof(u==null?void 0:u.codex_status)=="string"?u.codex_status:void 0,receiverCount:p,senderThreadId:m,receiverThreadIds:f})}}if(t.size===0)return DS(e);const n=new Map,r=[];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 r.push(a);return LS(r,t,n)}function rL({group:e}){const[t,n]=k.useState(!1),r=tu(e.toolName),a=Yi(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(X5,{}),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(Xl,{type:r}),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:Ic(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(X5,{}),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(Xl,{type:r}),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,d)=>{const f=Ic(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||d)})})]})})]})})}function OS({entries:e,toolActivity:t}){return l.jsx(l.Fragment,{children:e.map((n,r)=>{if(n.kind==="tool_msg_group")return l.jsx(rL,{group:n},n.firstId||r);if(n.kind==="subagent")return l.jsx(aL,{group:n},n.taskToolUseId);const a=n.msg,o=sL(a),u=t&&o.length>0?t.filter(f=>o.includes(f.toolUseId)):[],d=u.length>0&&u.every(f=>f.completedAt);return l.jsxs("div",{children:[l.jsx(LD,{message:a}),d&&l.jsx(GD,{entries:u})]},a.id)})})}function sL(e){var t;return(t=e.contentBlocks)!=null&&t.length?e.contentBlocks.filter(n=>n.type==="tool_use").map(n=>n.id):[]}function iL(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 aL({group:e}){const[t,n]=k.useState(!1),r=e.description||"Subagent",a=e.agentType,o=e.children.length,u=iL(e.status),d=e.receiverCount,f=e.senderThreadId,p=e.receiverThreadIds||[],m=e.backend||"claude",x=e.children[e.children.length-1],b=k.useMemo(()=>{var y,_;if(!x)return"";if(x.kind==="tool_msg_group")return`${Yi(x.toolName)}${x.items.length>1?` ×${x.items.length}`:""}`;if(x.kind==="message"&&x.msg.role==="assistant"){const j=(y=x.msg.content)==null?void 0:y.trim();if(j)return j.length>60?j.slice(0,60)+"...":j;const N=(_=x.msg.contentBlocks)==null?void 0:_.find(w=>w.type==="tool_use");if(N)return Yi(N.name)}return""},[x]);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:r}),a&&l.jsx("span",{className:"text-[10px] text-cc-muted/50",children:a}),l.jsx("span",{className:"text-[10px] text-cc-muted/40",children:m==="codex"?"Codex":"Claude"}),u&&l.jsx("span",{className:`text-[10px] ${u.className}`,children:u.label}),d!==void 0&&l.jsxs("span",{className:"text-[10px] text-cc-muted/40",children:[d," agent",d===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||p.length>0)&&l.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[10px] text-cc-muted/50 pl-4",children:[f&&l.jsxs("span",{className:"font-mono-code",children:["sender: ",f]}),p.length>0&&l.jsxs("span",{children:["receivers: ",p.map(y=>l.jsx("span",{className:"font-mono-code ml-1",children:y},y))]})]}),l.jsx(OS,{entries:e.children})]})]})})}function X5(){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 lL({sessionId:e}){var Lt;const t=G(we=>we.messages.get(e)??KD),n=G(we=>(we.sdkSessions||ZD).find(Ge=>Ge.sessionId===e)),r=G(we=>we.streamingStartedAt.get(e)),a=G(we=>we.streamingOutputTokens.get(e)),o=G(we=>we.sessionStatus.get(e)),u=G(we=>we.lastActivityAt.get(e)),d=G(we=>we.sessionProcesses.get(e)),f=G(we=>we.toolProgress.get(e)),p=G(we=>we.toolActivity.get(e)),m=k.useRef(null),x=k.useRef(null),b=k.useRef(!0),[y,_]=k.useState(0),[j,N]=k.useState(Yd),[w,E]=k.useState([]),[C,T]=k.useState(0),[O,z]=k.useState(!1),[I,U]=k.useState(!1),[Z,L]=k.useState(!1),[q,M]=k.useState(""),ie=k.useRef(new Set),X=G(we=>we.chatTabReentryTickBySession.get(e)??0),Y=k.useMemo(()=>t.some(we=>we.role==="assistant"&&we.isStreaming),[t]),P=k.useMemo(()=>(d??[]).filter(we=>we.status==="running"),[d]),$=P.length>0,re=k.useMemo(()=>{const we=p??[];for(let Ge=we.length-1;Ge>=0;Ge--)if(!we[Ge].completedAt)return we[Ge]},[p]),ae=k.useMemo(()=>P.length>0?Math.min(...P.map(we=>we.startedAt)):null,[P]),D=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]),B=D.length>0,Q=n!=null&&n.forkSession?"Forked from":"Continuing from",R=k.useMemo(()=>{if(w.length===0)return t;const we=[],Ge=new Set;for(const gt of w)Ge.has(gt.id)||(Ge.add(gt.id),we.push(gt));for(const gt of t)Ge.has(gt.id)||(Ge.add(gt.id),we.push(gt));return we},[w,t]),me=k.useMemo(()=>nL(R),[R]);k.useEffect(()=>{N(Yd),E([]),T(0),z(!1),U(!1),L(!1),M(""),ie.current=new Set},[e,D]);const be=me.length,Ce=be>j,Le=Ce?me.slice(be-j):me,Ee=be-Le.length,Ae=k.useCallback(()=>{const we=x.current,Ge=(we==null?void 0:we.scrollHeight)??0;N(gt=>gt+Yd),requestAnimationFrame(()=>{if(we){const gt=we.scrollHeight;we.scrollTop+=gt-Ge}})},[]),Ue=k.useCallback(async(we={})=>{if(!B||!D||Z)return;const Ge=x.current,gt=(Ge==null?void 0:Ge.scrollHeight)??0,_n=I?C:0;L(!0),M("");try{const Ne=await je.getClaudeSessionHistory(D,{cursor:_n,limit:WD}),Be=Ne.messages.map(Te=>({id:Te.id,role:Te.role,content:Te.content,contentBlocks:Te.role==="assistant"?Te.contentBlocks:void 0,timestamp:Te.timestamp||Date.now(),model:Te.role==="assistant"?Te.model:void 0,stopReason:Te.role==="assistant"?Te.stopReason:void 0})),yt=[];for(const Te of Be)ie.current.has(Te.id)||(ie.current.add(Te.id),yt.push(Te));E(Te=>[...yt,...Te]),T(Ne.nextCursor),z(Ne.hasMore),U(!0),yt.length>0&&N(Te=>Te+yt.length),we.preserveScroll!==!1&&Ge&&requestAnimationFrame(()=>{const Te=Ge.scrollHeight;Ge.scrollTop+=Te-gt})}catch(Ne){const Be=Ne instanceof Error?Ne.message:String(Ne);M(Be||"Failed to load previous history"),I||(E([]),T(0),z(!1))}finally{L(!1)}},[B,D,Z,I,C]);k.useEffect(()=>{if(!r&&o!=="running"&&!$){_(0);return}const we=r||Date.now();_(Date.now()-we);const Ge=setInterval(()=>_(Date.now()-we),1e3);return()=>clearInterval(Ge)},[r,o,$]);function dt(){const we=x.current;if(!we)return;b.current=we.scrollHeight-we.scrollTop-we.clientHeight<120;const Ge=Math.max(0,we.scrollHeight-we.clientHeight-we.scrollTop);ug.set(e,Ge),B&&I&&O&&!Z&&we.scrollTop<=QD&&Ue({preserveScroll:!0})}const Je=k.useCallback(()=>{const we=x.current;if(!we)return;const Ge=we.style.scrollBehavior;we.style.scrollBehavior="auto",we.scrollTop=we.scrollHeight,we.style.scrollBehavior=Ge},[]),At=k.useCallback(()=>{const we=x.current;if(!we)return;const Ge=we.style.scrollBehavior;we.style.scrollBehavior="auto";const gt=ug.get(e);typeof gt=="number"?we.scrollTop=Math.max(0,we.scrollHeight-we.clientHeight-gt):we.scrollTop=we.scrollHeight,we.style.scrollBehavior=Ge},[e]);if(k.useEffect(()=>{requestAnimationFrame(()=>At())},[e,At]),k.useEffect(()=>()=>{const we=x.current;if(!we)return;const Ge=Math.max(0,we.scrollHeight-we.clientHeight-we.scrollTop);ug.set(e,Ge)},[e]),k.useEffect(()=>{X&&requestAnimationFrame(()=>Je())},[X,Je]),k.useEffect(()=>{var we;b.current&&((we=m.current)==null||we.scrollIntoView({behavior:"smooth"}))},[t]),R.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:B?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:[Q," ",l.jsx("span",{className:"font-mono-code text-cc-fg/70",children:D.slice(0,8)}),". Load earlier messages when needed."]}),l.jsxs("button",{onClick:()=>void Ue({preserveScroll:!1}),disabled:Z,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"})}),Z?"Loading...":"Load previous history"]}),q&&l.jsx("p",{className:"text-xs text-cc-error mt-2",children:q})]}):l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"text-[15px] text-cc-fg font-medium mb-1.5",children:"Start a conversation"}),l.jsx("p",{className:"text-xs text-cc-muted leading-relaxed",children:"Send a message to begin working with The Companion."})]})})]});const mt=o==="running"&&u!=null?Math.max(0,Date.now()-u):0,rt=$&&(o!=="running"||mt>=W5)?"background":mt>=XD&&!re?"stalled":mt>=W5?"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:x,onScroll:dt,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:[B&&!I&&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:[Q," existing Claude thread"]}),l.jsxs("p",{className:"text-[11px] text-cc-muted mt-1",children:[D," ",n!=null&&n.cwd?`· ${JD(n.cwd)}`:""]})]}),l.jsx("button",{onClick:()=>void Ue({preserveScroll:!0}),disabled:Z,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:Z?"Loading...":"Load previous history"})]}),q&&l.jsx("p",{className:"text-xs text-cc-error mt-2",children:q})]}),B&&I&&l.jsx("div",{className:"flex justify-center",children:l.jsx("p",{className:"text-[11px] text-cc-muted",children:O?Z?"Loading older transcript...":"Scroll to top to load older transcript":"Loaded all available prior transcript"})}),Ce&&l.jsx("div",{className:"flex justify-center pb-3",children:l.jsxs("button",{onClick:Ae,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(Yd,Ee)," more",l.jsxs("span",{className:"text-cc-muted/50 tabular-nums",children:["(",Ee," hidden)"]})]})}),l.jsx(OS,{entries:Le,toolActivity:p}),f&&f.size>0&&!Y&&l.jsx(VD,{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"||$)&&y>=0&&l.jsxs("div",{"data-testid":"activity-indicator","data-activity-tier":rt,className:`flex items-center gap-2 text-[11px] font-mono-code pl-10 stats-glow py-1 ${rt==="stalled"?"text-cc-warning":"text-cc-muted"}`,children:[l.jsx("span",{className:`inline-block w-2 h-2 rounded-full ${rt==="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]"}`}),rt==="background"?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-fg/70",children:P.length===1?"Background process running":`${P.length} background processes running`}),ae!=null&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/30",children:"|"}),l.jsx("span",{className:"tabular-nums",children:wc(Math.max(0,Date.now()-ae))})]}),((Lt=P[0])==null?void 0:Lt.description)&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/30",children:"|"}),l.jsx("span",{className:"truncate max-w-[24ch]",children:P[0].description})]})]}):rt==="stalled"?l.jsxs("span",{children:["No activity for ",wc(mt)," — the agent may be stuck"]}):rt==="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?wc(Math.max(0,Date.now()-re.startedAt)):`no update for ${wc(mt)}`}),(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:wc(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:[Ec(a)," tokens"]})]})]})]}),l.jsx("div",{ref:m})]})})]})}const oL={codex:"✳",xhigh:"★",max:"■",mini:"⚡"};function cL(e,t){for(const[r,a]of Object.entries(oL))if(e.includes(r))return a;const n=["◆","●","◕","✦"];return n[t%n.length]}function uL(e){return e.map((t,n)=>({value:t.value,label:t.label||t.value,icon:cL(t.value,n)}))}const zS=[{value:"claude-opus-5",label:"Opus 5",icon:""},{value:"claude-opus-4-8",label:"Opus 4.8",icon:""},{value:"claude-fable-5-1",label:"Fable 5.1",icon:"★"},{value:"claude-fable-5",label:"Fable 5",icon:"★"},{value:"claude-opus-4-7",label:"Opus 4.7",icon:""},{value:"claude-opus-4-6",label:"Opus 4.6",icon:""},{value:"claude-sonnet-5",label:"Sonnet 5",icon:""},{value:"claude-haiku-4-5-20251001",label:"Haiku 4.5",icon:""}],BS=[{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:"●"}],vv=[{value:"bypassPermissions",label:"Agent"},{value:"plan",label:"Plan"}],bv=[{value:"bypassPermissions",label:"Auto"},{value:"plan",label:"Plan"}],dL=[{value:"",label:"Default"},{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"xhigh",label:"xHigh"},{value:"max",label:"Max"}],PS=[{value:"bypassPermissions",label:"Full Auto"},{value:"acceptEdits",label:"Auto-Edit"},{value:"default",label:"Supervised"}],$S=[{value:"bypassPermissions",label:"Full Auto"},{value:"default",label:"Supervised"}];function FS(e){return e==="codex"?BS:zS}function K5(e){return e==="codex"?bv:vv}function Lz(e){return e==="codex"?$S:PS}function Z5(e){return e==="codex"?BS[0].value:zS[0].value}function J5(e){return e==="codex"?bv[0].value:vv[0].value}function Oz(e){return e==="codex"?$S[0].value:PS[0].value}function hL(e){return e==="codex"?[]:dL}function ew({sessionId:e}){const[t,n]=k.useState(!1),r=k.useRef(null),a=G(b=>b.sdkSessions.find(y=>y.sessionId===e)||null),o=G(b=>b.sessions.get(e)),u=G(b=>b.cliConnected.get(e)??!1),d=(a==null?void 0:a.backendType)??(o==null?void 0:o.backend_type)??"claude",f=(o==null?void 0:o.model)??(a==null?void 0:a.model)??"",p=FS(d),m=p.find(b=>b.value===f)||(f?{label:f,icon:"?"}:null),x=k.useCallback(b=>{if(n(!1),b===f)return;Bn(e,{type:"set_model",model:b});const{sdkSessions:y,setSdkSessions:_}=G.getState();_(y.map(j=>j.sessionId===e?{...j,model:b}:j))},[e,f]);return k.useEffect(()=>{if(!t)return;const b=y=>{r.current&&!r.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||!m?null:l.jsxs("div",{ref:r,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: ${m.label}`,"aria-label":"Switch model","aria-expanded":t,"aria-haspopup":"listbox",children:[m.icon&&l.jsx("span",{className:"text-[13px] leading-none",children:m.icon}),l.jsx("span",{children:m.label}),l.jsx("svg",{viewBox:"0 0 12 12",fill:"currentColor",className:"w-2.5 h-2.5 opacity-50",children:l.jsx("path",{d:"M6 8L1.5 3.5h9L6 8z"})})]}),t&&l.jsx("div",{className:"absolute right-0 bottom-full mb-1 z-50 min-w-[160px] rounded-lg border border-cc-separator bg-cc-bg shadow-lg overflow-hidden",role:"listbox","aria-label":"Select model",children:p.map(b=>l.jsxs("button",{onClick:()=>x(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 US({open:e,loading:t,prompts:n,selectedIndex:r,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((d,f)=>l.jsxs("button",{"data-prompt-index":f,onClick:()=>a(d),className:`w-full px-3 py-2 text-left flex items-center gap-2.5 transition-colors cursor-pointer ${f===r?"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:["@",d.name]}),l.jsx("div",{className:"text-[11px] text-cc-muted truncate",children:d.content})]}),l.jsx("span",{className:"text-[10px] text-cc-muted shrink-0",children:d.scope})]},d.id)):l.jsx("div",{className:"px-3 py-2 text-[12px] text-cc-muted",children:"No prompts found."})}):null}function IS({text:e,caretPos:t,cwd:n,enabled:r=!0}){const[a,o]=k.useState(!1),[u,d]=k.useState(0),[f,p]=k.useState([]),[m,x]=k.useState(!1),b=k.useRef(null),y=k.useCallback(async()=>{x(!0);try{const w=await je.listPrompts(n);p(w.filter(E=>!!E.name.trim()))}catch{p([])}finally{x(!1)}},[n]);k.useEffect(()=>{y()},[y]);const _=k.useMemo(()=>{const w=e.slice(0,t),E=w.match(/(^|\s)@([^\s@]*)$/);if(!E||E.index===void 0)return null;const C=w.length-E[0].length+E[1].length;return{query:E[2]||"",start:C,end:t}},[e,t]),j=k.useMemo(()=>{if(!a||!_)return[];const w=_.query.toLowerCase();if(!w)return f;const E=f.filter(T=>T.name.toLowerCase().startsWith(w)),C=f.filter(T=>!T.name.toLowerCase().startsWith(w)&&T.name.toLowerCase().includes(w));return[...E,...C]},[a,_,f]);k.useEffect(()=>{const w=r&&!!_;w&&!a?(o(!0),d(0)):!w&&a&&o(!1)},[r,_,a]),k.useEffect(()=>{u>=j.length&&d(Math.max(0,j.length-1))},[j.length,u]),k.useEffect(()=>{if(!b.current||!a)return;const E=b.current.querySelectorAll("[data-prompt-index]")[u];E&&E.scrollIntoView({block:"nearest"})},[u,a]);const N=k.useCallback(w=>{if(!_)return{nextText:e,nextCursor:t};const E=`${w.content} `,C=`${e.slice(0,_.start)}${E}${e.slice(_.end)}`,T=_.start+E.length;return{nextText:C,nextCursor:T}},[_,e,t]);return{mentionMenuOpen:a,setMentionMenuOpen:o,mentionMenuIndex:u,setMentionMenuIndex:d,mentionContext:_,filteredPrompts:j,promptsLoading:m,savedPrompts:f,selectPrompt:N,refreshPrompts:y,mentionMenuRef:b}}const fL=[];function tw({isPlan:e,isConnected:t,onToggle:n,modeLabel:r,size:a}){const o=a==="desktop",u=o?"px-2.5 py-1.5":"px-2 py-1",d=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?d: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:r})]})}function Wd({onClick:e,disabled:t,active:n,title:r,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:r,children:a})}function nw(){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 rw({isRunning:e,canSend:t,onSend:n,onInterrupt:r,size:a}){const o=a==="desktop",u=o?"w-9 h-9":"w-10 h-10",d=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:r,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?d:"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 pL({sessionId:e}){var oe,ke;const[t,n]=k.useState(""),[r,a]=k.useState([]),[o,u]=k.useState(null),[d,f]=k.useState(!1),[p,m]=k.useState(!1),[x,b]=k.useState(0),[y,_]=k.useState(!1),[j,N]=k.useState(""),[w,E]=k.useState("global"),[C,T]=k.useState(null),[O,z]=k.useState(0),I=k.useRef(null),U=k.useRef(null),Z=k.useRef(null),L=k.useRef(null),q=G(W=>W.cliConnected),M=G(W=>W.sessions.get(e)),ie=G(W=>W.previousPermissionMode.get(e)||"acceptEdits"),X=q.get(e)??!1,Y=(M==null?void 0:M.permissionMode)||"acceptEdits",P=Y==="plan",$=(M==null?void 0:M.backend_type)==="codex",ae=((ke=(oe=($?bv:vv).find(W=>W.value===Y))==null?void 0:oe.label)==null?void 0:ke.toLowerCase())||Y,D=IS({text:t,caretPos:O,cwd:M==null?void 0:M.cwd,enabled:!p}),B=k.useMemo(()=>{const W=[];if(M!=null&&M.slash_commands)for(const xe of M.slash_commands)W.push({name:xe,type:"command"});if(M!=null&&M.skills)for(const xe of M.skills)W.push({name:xe,type:"skill"});return W},[M==null?void 0:M.slash_commands,M==null?void 0:M.skills]),Q=k.useMemo(()=>{if(!p)return[];const W=t.match(/^\/(\S*)$/);if(!W)return[];const xe=W[1].toLowerCase();return xe===""?B:B.filter(Oe=>Oe.name.toLowerCase().includes(xe))},[t,p,B]);k.useEffect(()=>{const W=t.startsWith("/")&&/^\/\S*$/.test(t)&&B.length>0;W&&!p?(m(!0),b(0)):!W&&p&&m(!1)},[t,B.length,p]),k.useEffect(()=>{x>=Q.length&&b(Math.max(0,Q.length-1))},[Q.length,x]),k.useEffect(()=>{if(!Z.current||!p)return;const xe=Z.current.querySelectorAll("[data-cmd-index]")[x];xe&&xe.scrollIntoView({block:"nearest"})},[x,p]),k.useEffect(()=>{if(L.current===null||!I.current)return;const W=L.current;I.current.setSelectionRange(W,W),L.current=null},[t]);const R=k.useCallback(W=>{var xe;n(`/${W.name} `),m(!1),(xe=I.current)==null||xe.focus()},[]),me=k.useCallback(W=>{var Oe;const xe=D.selectPrompt(W);L.current=xe.nextCursor,n(xe.nextText),D.setMentionMenuOpen(!1),z(xe.nextCursor),(Oe=I.current)==null||Oe.focus(),I.current&&(I.current.style.height="auto",I.current.style.height=Math.min(I.current.scrollHeight,200)+"px")},[D]);function be(){var lt;const W=t.trim();if(!W||!X)return;const xe=vg(),Oe=r.length>0?r.map(ot=>({name:ot.name,media_type:ot.mediaType,data:ot.base64,size:ot.size})):void 0;Bn(e,{type:"user_message",content:W,session_id:e,attachments:Oe,client_msg_id:xe});const Xe=G.getState();Xe.appendMessage(e,{id:xe,role:"user",content:W,attachments:Oe,timestamp:Date.now()}),Xe.setSessionStatus(e,"running"),Xe.setLastActivity(e,Date.now()),Xe.streamingStartedAt.has(e)||Xe.setStreamingStats(e,{startedAt:Date.now()}),n(""),a([]),u(null),m(!1),D.setMentionMenuOpen(!1),I.current&&(I.current.style.height="auto"),(lt=I.current)==null||lt.focus()}function Ce(W){if(p&&Q.length>0){if(W.key==="ArrowDown"){W.preventDefault(),b(xe=>(xe+1)%Q.length);return}if(W.key==="ArrowUp"){W.preventDefault(),b(xe=>(xe-1+Q.length)%Q.length);return}if(W.key==="Tab"&&!W.shiftKey){W.preventDefault(),R(Q[x]);return}if(W.key==="Enter"&&!W.shiftKey){W.preventDefault(),R(Q[x]);return}if(W.key==="Escape"){W.preventDefault(),m(!1);return}}if(D.mentionMenuOpen&&W.key==="Escape"){W.preventDefault(),D.setMentionMenuOpen(!1);return}if(D.mentionMenuOpen&&D.filteredPrompts.length>0){if(W.key==="ArrowDown"){W.preventDefault(),D.setMentionMenuIndex(xe=>(xe+1)%D.filteredPrompts.length);return}if(W.key==="ArrowUp"){W.preventDefault(),D.setMentionMenuIndex(xe=>(xe-1+D.filteredPrompts.length)%D.filteredPrompts.length);return}if(W.key==="Tab"&&!W.shiftKey||W.key==="Enter"&&!W.shiftKey){W.preventDefault(),me(D.filteredPrompts[D.mentionMenuIndex]);return}}if(D.mentionMenuOpen&&D.filteredPrompts.length===0&&(W.key==="Enter"&&!W.shiftKey||W.key==="Tab"&&!W.shiftKey)){W.preventDefault();return}if(W.key==="Tab"&&W.shiftKey){W.preventDefault(),Ge();return}W.key==="Enter"&&!W.shiftKey&&(W.preventDefault(),be())}function Le(W){n(W.target.value),z(W.target.selectionStart??W.target.value.length);const xe=W.target;xe.style.height="auto",xe.style.height=Math.min(xe.scrollHeight,200)+"px"}function Ee(){I.current&&z(I.current.selectionStart??0)}function Ae(){Bn(e,{type:"interrupt"})}async function Ue(W){if(W.length===0)return;const xe=[],Oe=[];let Xe=r.reduce((lt,ot)=>lt+ot.size,0);for(const lt of W){if(lt.size>Fh){Oe.push(`${lt.name} is too large (${Gi(lt.size)}, max ${Gi(Fh)})`);continue}if(Xe+lt.size>Uh){Oe.push(`${lt.name} would exceed the per-message limit (${Gi(Uh)})`);continue}const{base64:ot,mediaType:Et}=await CS(lt);xe.push({name:lt.name,base64:ot,mediaType:Et,size:lt.size}),Xe+=lt.size}xe.length>0&&a(lt=>[...lt,...xe]),u(Oe.length>0?Oe.join("; "):null)}async function dt(W){const xe=W.target.files;xe&&(await Ue(Array.from(xe)),W.target.value="")}function Je(W){a(xe=>xe.filter((Oe,Xe)=>Xe!==W))}async function At(W){var Xe;const xe=(Xe=W.clipboardData)==null?void 0:Xe.items;if(!xe)return;const Oe=[];for(const lt of Array.from(xe)){if(lt.kind!=="file")continue;const ot=lt.getAsFile();if(!ot)continue;const Et=ot.name&&ot.name.length>0?ot.name:`pasted-${Date.now()}.${(ot.type.split("/")[1]||"bin").replace(/[^a-zA-Z0-9]/g,"")}`;Oe.push(new File([ot],Et,{type:ot.type,lastModified:ot.lastModified}))}Oe.length>0&&(W.preventDefault(),await Ue(Oe))}function mt(W){W.dataTransfer.types.includes("Files")&&(W.preventDefault(),W.stopPropagation(),f(!0))}function rt(W){W.currentTarget===W.target&&f(!1)}async function Lt(W){if(!W.dataTransfer.types.includes("Files"))return;W.preventDefault(),W.stopPropagation(),f(!1);const xe=Array.from(W.dataTransfer.files);xe.length>0&&await Ue(xe)}function we(){const W=t.trim().slice(0,32);N(W||""),T(null),_(xe=>!xe)}function Ge(){if(!X)return;const W=G.getState();if(!P)W.setPreviousPermissionMode(e,Y),Bn(e,{type:"set_permission_mode",mode:"plan"}),W.updateSession(e,{permissionMode:"plan"});else{const xe=ie||($?"bypassPermissions":"acceptEdits");Bn(e,{type:"set_permission_mode",mode:xe}),W.updateSession(e,{permissionMode:xe})}}async function gt(){const W=t.trim(),xe=j.trim();if(!W||!xe)return;if(w==="project"&&!(M!=null&&M.cwd)){T("No project folder available for this session");return}const Oe={name:xe,content:W,scope:w};w==="project"&&(Oe.projectPaths=[M.cwd]);try{await je.createPrompt(Oe),await D.refreshPrompts(),_(!1),N(""),E("global"),T(null)}catch(Xe){const lt=Xe instanceof Error&&Xe.message?Xe.message:"Could not save prompt.";T(lt)}}const Ne=G(W=>W.promptSuggestions.get(e))??fL,Be=G(W=>W.clearPromptSuggestions),Te=G(W=>W.sessionStatus).get(e)==="running",Xr=t.trim().length>0&&X;return l.jsx("div",{className:`shrink-0 px-0 sm:px-6 pt-0 sm:pt-3 pb-5 sm:pb-4 bg-cc-input-bg sm:bg-transparent relative ${d?"ring-2 ring-cc-primary/40 rounded-2xl":""}`,onDragOver:mt,onDragLeave:rt,onDrop:Lt,children:l.jsxs("div",{className:"max-w-3xl mx-auto",children:[d&&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"})}),r.length>0&&l.jsx("div",{className:"flex items-center gap-2 mb-2 px-3 sm:px-0 flex-wrap",children:r.map((W,xe)=>l.jsx(TS,{name:W.name,mediaType:W.mediaType,base64:W.base64,size:W.size,onRemove:()=>Je(xe)},xe))}),o&&l.jsx("div",{className:"mb-2 px-3 sm:px-0 text-[11px] text-cc-error",children:o}),l.jsx("input",{ref:U,type:"file",multiple:!0,onChange:dt,className:"hidden","aria-label":"Attach files"}),Ne.length>0&&l.jsx("div",{className:"flex flex-wrap gap-1.5 px-2 sm:px-4 pb-2",children:Ne.map((W,xe)=>l.jsx("button",{onClick:()=>{if(!X||Te)return;const Oe=vg();Bn(e,{type:"user_message",content:W,session_id:e,client_msg_id:Oe}),G.getState().appendMessage(e,{id:Oe,role:"user",content:W,timestamp:Date.now()}),Be(e)},disabled:!X||Te,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:W,children:W},xe))}),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 ${P?"sm:border-cc-primary/40 sm:shadow-[0_10px_30px_rgba(217,119,87,0.08)]":"sm:focus-within:border-cc-primary/25"}`,children:[p&&Q.length>0&&l.jsx("div",{ref:Z,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:Q.map((W,xe)=>l.jsxs("button",{"data-cmd-index":xe,onClick:()=>R(W),className:`w-full px-3 py-2 text-left flex items-center gap-2.5 transition-colors cursor-pointer ${xe===x?"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:W.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:["/",W.name]}),l.jsx("span",{className:"ml-2 text-[11px] text-cc-muted",children:W.type})]})]},`${W.type}-${W.name}`))}),l.jsx(US,{open:D.mentionMenuOpen,loading:D.promptsLoading,prompts:D.filteredPrompts,selectedIndex:D.mentionMenuIndex,onSelect:me,menuRef:D.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:W=>{N(W.target.value),C&&T(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:()=>E("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:()=>E("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"&&(M==null?void 0:M.cwd)&&l.jsx("div",{className:"text-[10px] text-cc-muted font-mono-code truncate",title:M.cwd,children:M.cwd}),C?l.jsx("div",{className:"text-[11px] text-cc-error",children:C}):null,l.jsxs("div",{className:"flex items-center gap-1.5 justify-end",children:[l.jsx("button",{onClick:()=>{_(!1),E("global"),T(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:gt,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(tw,{isPlan:P,isConnected:X,onToggle:Ge,modeLabel:ae,size:"mobile"}),l.jsx(ew,{sessionId:e}),l.jsx("div",{className:"flex-1"}),l.jsx(Wd,{onClick:we,disabled:!X||!t.trim(),active:X&&!!t.trim(),title:"Save as prompt",children:l.jsx(nw,{})}),l.jsx(Wd,{onClick:()=>{var W;return(W=U.current)==null?void 0:W.click()},disabled:!X,active:X,title:"Attach file",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-4 h-4",children:l.jsx("path",{d:"M11.5 6.5L7 11a2 2 0 1 1-2.83-2.83l5-5a3.25 3.25 0 1 1 4.6 4.6l-5.7 5.7a4.5 4.5 0 0 1-6.36-6.36L7 2",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),l.jsx("div",{className:"px-3 sm:px-3 pt-1 sm:pt-2.5",children:l.jsx("textarea",{ref:I,value:t,onChange:Le,onKeyDown:Ce,onClick:Ee,onKeyUp:Ee,onPaste:At,"aria-label":"Message input",placeholder:X?"Type a message... (/ + @)":"Waiting for CLI connection...",disabled:!X,rows:1,className:"w-full px-1 py-1.5 text-base sm:text-sm bg-transparent resize-none outline-none text-cc-fg font-sans-ui placeholder:text-cc-muted disabled:opacity-50 overflow-y-auto",style:{minHeight:"36px",maxHeight:"200px"}})}),l.jsx("div",{className:"flex items-center justify-end gap-1 px-3 pb-1 sm:hidden",children:l.jsx(rw,{isRunning:Te,canSend:Xr,onSend:be,onInterrupt:Ae,size:"mobile"})}),l.jsxs("div",{className:"hidden sm:flex items-center gap-1.5 px-2.5 pb-2",children:[l.jsx(Wd,{onClick:()=>{var W;return(W=U.current)==null?void 0:W.click()},disabled:!X,active:X,title:"Attach file",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-4 h-4",children:l.jsx("path",{d:"M8 3v10M3 8h10",strokeLinecap:"round"})})}),l.jsx(Wd,{onClick:we,disabled:!X||!t.trim(),active:X&&!!t.trim(),title:"Save as prompt",children:l.jsx(nw,{})}),l.jsx(tw,{isPlan:P,isConnected:X,onToggle:Ge,modeLabel:ae,size:"desktop"}),l.jsx("div",{className:"flex-1"}),l.jsx(ew,{sessionId:e}),l.jsx(rw,{isRunning:Te,canSend:Xr,onSend:be,onInterrupt:Ae,size:"desktop"})]})]})]})})}function mL(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 r=e.rules[0];if(r!=null&&r.ruleContent)return`Allow "${r.ruleContent}" ${n}`;if(r!=null&&r.toolName)return`Allow ${r.toolName} ${n}`}return e.type==="addDirectories"?`Trust ${e.directories[0]||"directory"} ${n}`:`Allow ${n}`}function gL(e,t){const n={};for(const[r,a]of Object.entries(t)){const o=e[Number(r)],u=typeof(o==null?void 0:o.question)=="string"&&o.question?o.question:r;n[u]=a}return n}function xL({permission:e,sessionId:t}){const[n,r]=k.useState(!1),a=G(p=>p.removePermission);function o(p,m){r(!0),Bn(t,{type:"permission_response",request_id:e.request_id,behavior:"allow",updated_input:p,...m!=null&&m.length?{updated_permissions:m}:{}}),a(t,e.request_id)}function u(){r(!0),Bn(t,{type:"permission_response",request_id:e.request_id,behavior:"deny",message:"Denied by user"}),a(t,e.request_id)}const d=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 ${d?"bg-cc-primary/10 border border-cc-primary/20":"bg-cc-warning/10 border border-cc-warning/20"}`,children:d?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 ${d?"text-cc-primary":"text-cc-warning"}`,children:d?"Question":"Permission Request"}),!d&&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})]}),d?l.jsx(wL,{input:e.input,onSelect:p=>o({...e.input,answers:p}),disabled:n}):l.jsx(yL,{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&&!d&&l.jsx(bL,{validation:e.ai_validation}),!d&&l.jsxs("div",{className:"flex items-center gap-2 mt-3 flex-wrap",children:[l.jsxs("button",{onClick:()=>o(),disabled:n,className:"inline-flex items-center gap-1.5 px-3 py-2.5 text-xs font-medium rounded-lg bg-cc-success/90 hover:bg-cc-success text-white disabled:opacity-50 transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-3 h-3",children:l.jsx("path",{d:"M3 8.5l3.5 3.5 6.5-7"})}),"Allow"]}),f==null?void 0:f.map((p,m)=>l.jsxs("button",{onClick:()=>o(void 0,[p]),disabled:n,title:`${p.type}: ${JSON.stringify(p)}`,className:"inline-flex items-center gap-1.5 px-3 py-2.5 text-xs font-medium rounded-lg bg-cc-primary/10 hover:bg-cc-primary/20 text-cc-primary border border-cc-primary/20 disabled:opacity-50 transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:l.jsx("path",{d:"M3 8.5l3.5 3.5 6.5-7"})}),mL(p)]},m)),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 vL(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 bL({validation:e}){const t=e.verdict==="uncertain"&&vL(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",r=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:r}),l.jsx("span",{children:e.reason})]})}function yL({toolName:e,input:t,description:n}){return e==="Bash"?l.jsx(_L,{input:t}):e==="Edit"?l.jsx(kL,{input:t}):e==="Write"?l.jsx(SL,{input:t}):e==="Read"?l.jsx(jL,{input:t}):e==="Glob"?l.jsx(NL,{input:t}):e==="Grep"?l.jsx(CL,{input:t}):e==="ExitPlanMode"?l.jsx(EL,{input:t}):l.jsx(HS,{input:t,description:n})}function _L({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 wL({input:e,onSelect:t,disabled:n}){const r=Array.isArray(e.questions)?e.questions:[],[a,o]=k.useState({}),[u,d]=k.useState({}),[f,p]=k.useState({});function m(N){return gL(r,N)}function x(N,w){const E=String(N);o(C=>({...C,[E]:w})),p(C=>({...C,[E]:!1})),r.length<=1&&t(m({[E]:w}))}function b(N){var C;const w=String(N),E=(C=u[w])==null?void 0:C.trim();E&&(o(T=>({...T,[w]:E})),r.length<=1&&t(m({[w]:E})))}function y(N,w){const E=String(N);d(T=>({...T,[E]:w}));const C=w.trim();o(T=>{if(!C){const O={...T};return delete O[E],O}return{...T,[E]:C}})}function _(N){const w=String(N);p(E=>{const C=!!E[w],T={...E,[w]:!C};return C&&(o(O=>{const z={...O};return delete z[w],z}),d(O=>{const z={...O};return delete z[w],z})),T})}function j(){t(m(a))}if(r.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(HS,{input:e})}return l.jsxs("div",{className:"space-y-3",children:[r.map((N,w)=>{const E=typeof N.header=="string"?N.header:"",C=typeof N.question=="string"?N.question:"",T=Array.isArray(N.options)?N.options:[],O=String(w),z=a[O],I=f[O];return l.jsxs("div",{className:"space-y-2",children:[E&&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:E}),C&&l.jsx("p",{className:"text-sm text-cc-fg leading-relaxed",children:C}),T.length>0&&l.jsxs("div",{className:"space-y-1.5",children:[T.map((U,Z)=>{const L=typeof U.label=="string"?U.label:String(U),q=typeof U.description=="string"?U.description:"",M=z===L;return l.jsx("button",{onClick:()=>x(w,L),disabled:n,className:`w-full text-left px-3 py-2 rounded-lg border transition-all cursor-pointer disabled:opacity-50 ${M?"border-cc-primary bg-cc-primary/10 ring-1 ring-cc-primary/30":"border-cc-border bg-cc-hover/50 hover:bg-cc-hover hover:border-cc-primary/30"}`,children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:`w-4 h-4 rounded-full border-2 flex items-center justify-center shrink-0 ${M?"border-cc-primary":"border-cc-muted/40"}`,children:M&&l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-primary"})}),l.jsxs("div",{children:[l.jsx("span",{className:"text-xs font-medium text-cc-fg",children:L}),q&&l.jsx("p",{className:"text-[11px] text-cc-muted mt-0.5 leading-snug",children:q})]})]})},Z)}),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 ${I?"border-cc-primary bg-cc-primary/10 ring-1 ring-cc-primary/30":"border-cc-border bg-cc-hover/50 hover:bg-cc-hover hover:border-cc-primary/30"}`,children: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 ${I?"border-cc-primary":"border-cc-muted/40"}`,children:I&&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..."})]})}),I&&l.jsxs("div",{className:"pl-6",children:[l.jsx("input",{type:"text",value:u[O]||"",onChange:U=>y(w,U.target.value),onKeyDown:U=>{U.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}),r.length<=1&&l.jsx("p",{className:"mt-1 text-[10px] text-cc-muted",children:"Press Enter to submit"})]})]})]},w)}),r.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 kL({input:e}){const t=String(e.file_path||""),n=String(e.old_string||""),r=String(e.new_string||"");return l.jsx(ao,{oldText:n,newText:r,fileName:t,mode:"compact"})}function SL({input:e}){const t=String(e.file_path||""),n=String(e.content||"");return l.jsx(ao,{newText:n,fileName:t,mode:"compact"})}function jL({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 NL({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 CL({input:e}){const t=typeof e.pattern=="string"?e.pattern:"",n=typeof e.path=="string"?e.path:"",r=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}),r&&l.jsx("div",{className:"text-cc-muted",children:r})]})}function EL({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(hv,{remarkPlugins:[gv],components:{h1:({children:r})=>l.jsx("h1",{className:"text-base font-semibold text-cc-fg mb-2",children:r}),h2:({children:r})=>l.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-1.5 mt-3 first:mt-0",children:r}),h3:({children:r})=>l.jsx("h3",{className:"text-sm font-medium text-cc-fg mb-1.5 mt-2",children:r}),p:({children:r})=>l.jsx("p",{className:"mb-2 last:mb-0",children:r}),ul:({children:r})=>l.jsx("ul",{className:"list-disc pl-4 mb-2 space-y-0.5",children:r}),ol:({children:r})=>l.jsx("ol",{className:"list-decimal pl-4 mb-2 space-y-0.5",children:r}),li:({children:r})=>l.jsx("li",{children:r}),strong:({children:r})=>l.jsx("strong",{className:"font-semibold text-cc-fg",children:r}),a:({href:r,children:a})=>l.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"text-cc-primary hover:underline",children:a}),code:r=>{const{children:a,className:o}=r;return/language-(\w+)/.exec(o||"")||typeof a=="string"&&a.includes(`
|
|
104
|
+
`)?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(NS,{textClassName:"text-[12px] text-cc-code-fg",children:a})},pre:({children:r})=>l.jsx(l.Fragment,{children:r}),blockquote:({children:r})=>l.jsx("blockquote",{className:"border-l-2 border-cc-primary/40 pl-2 text-cc-muted italic my-2",children:r})},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((r,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(r.tool||"")}),l.jsx("span",{className:"text-cc-fg",children:String(r.prompt||"")})]},a))})]}),!t&&n.length===0&&l.jsx("div",{className:"text-xs text-cc-muted",children:"Plan approval requested"})]})}function HS({input:e,description:t}){const n=Object.entries(e).filter(([,r])=>r!=null&&r!=="");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(([r,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:[r,":"]}),l.jsx("span",{className:"text-cc-fg break-all",children:o})]},r)})})]})}function AL({entry:e,onDismiss:t}){const{request:n,behavior:r,reason:a}=e,o=r==="allow";let u=n.tool_name;if(n.tool_name==="Bash"&&typeof n.input.command=="string"){const d=n.input.command;u=d.length>60?d.slice(0,60)+"...":d}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 TL=[],ML=[],sw="activity-tray-panel";function RL(e,t){const n=Math.round(((t||Date.now())-e)/1e3);if(n<60)return`${n}s`;const r=Math.floor(n/60),a=n%60;return`${r}m${a>0?` ${a}s`:""}`}function DL(e,t,n=4e3){const[r,a]=k.useState(!1),o=k.useRef(void 0),u=e.length+t.length,d=u>0&&e.every(f=>f.status==="completed")&&t.every(f=>f.status!=="running");return k.useEffect(()=>(clearTimeout(o.current),d?o.current=setTimeout(()=>a(!0),n):a(!1),()=>clearTimeout(o.current)),[d,n]),k.useEffect(()=>{a(!1)},[u]),r}function LL(e){const[t,n]=k.useState(0);return k.useEffect(()=>{if(!e)return;const r=setInterval(()=>n(a=>a+1),1e3);return()=>clearInterval(r)},[e]),t}function OL({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 zL({agent:e,tick:t}){const[n,r]=k.useState(!1),a=e.status!=="running",o=!!e.summary,u=l.jsxs(l.Fragment,{children:[l.jsx(OL,{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:RL(e.startedAt,e.completedAt)})]});return l.jsxs("div",{className:`transition-opacity duration-300 ${a?"opacity-60":""}`,children:[o?l.jsx("button",{type:"button",onClick:()=>r(!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 BL({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 PL({sessionId:e}){const[t,n]=k.useState(!1),r=k.useRef(null),a=k.useRef(null),o=G(C=>C.sessionTasks.get(e)??TL),u=G(C=>C.sessionBackgroundAgents.get(e)??ML),d=DL(o,u),f=u.some(C=>C.status==="running"),p=LL(f),m=u.filter(C=>C.status==="running").length,x=o.length,b=o.filter(C=>C.status==="completed").length,y=o.filter(C=>C.status==="in_progress").length,_=o.length>0||u.length>0,j=m>0||y>0,N=k.useCallback(()=>n(!1),[]);k.useEffect(()=>{if(!t)return;const C=T=>{T.key==="Escape"&&(T.stopPropagation(),N())};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[t,N]),k.useEffect(()=>{if(!t)return;const C=T=>{r.current&&!r.current.contains(T.target)&&N()};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[t,N]),k.useEffect(()=>{t&&a.current&&a.current.focus()},[t]);const[w,E]=k.useState(!1);return k.useEffect(()=>{_&&E(!1)},[_,o.length,u.length]),!_||w?null:l.jsxs("div",{ref:r,className:`absolute bottom-3 right-3 z-20 transition-opacity duration-500 ${d?"opacity-0 pointer-events-none":"opacity-100"}`,style:d?void 0:{animation:"fadeSlideIn 0.3s ease-out"},onTransitionEnd:()=>{d&&E(!0)},children:[t&&l.jsxs("div",{ref:a,id:sw,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(C=>l.jsx(zL,{agent:C,tick:p},C.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(C=>l.jsx(BL,{task:C},C.id))]})]}),l.jsxs("button",{type:"button",onClick:()=>n(!t),"aria-expanded":t,"aria-controls":sw,className:`
|
|
105
|
+
flex items-center gap-2 px-3 min-h-[36px] rounded-full
|
|
106
|
+
border border-cc-border/50 bg-cc-surface/90 backdrop-blur-lg
|
|
107
|
+
shadow-md shadow-black/15
|
|
108
|
+
hover:bg-cc-hover/80 hover:border-cc-border/70
|
|
109
|
+
transition-all duration-200 cursor-pointer
|
|
110
|
+
${t?"ring-1 ring-cc-primary/30":""}
|
|
111
|
+
`,"aria-label":`Activity: ${m} agents running, ${b}/${x} 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:m>0?`${m} agent${m!==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,"/",x]}),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 $L({sessionId:e}){const t=G(_=>_.pendingPermissions.get(e)),n=G(_=>_.aiResolvedPermissions.get(e)),r=G(_=>_.clearAiResolvedPermissions),a=G(_=>_.connectionStatus.get(e)??"disconnected"),o=G(_=>_.cliConnected.get(e)??!1),u=G(_=>_.cliReconnecting.get(e)??!1),d=G(_=>_.setCliReconnecting),[f,p]=k.useState(null),m=k.useRef(void 0);k.useEffect(()=>{p(null),clearTimeout(m.current)},[e,o]),k.useEffect(()=>()=>clearTimeout(m.current),[]);const x=k.useCallback(async()=>{p(null),clearTimeout(m.current),d(e,!0);try{await je.relaunchSession(e)}catch(_){Xi(_),d(e,!1);const j=_ instanceof Error?_.message:"Reconnection failed";p(j),m.current=setTimeout(()=>p(null),4e3)}},[e,d]),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:x,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:x,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(lL,{sessionId:e}),l.jsx(PL,{sessionId:e})]}),n&&n.length>0&&l.jsx("div",{className:"shrink-0 border-t border-cc-border bg-cc-card",children:l.jsx(AL,{entry:n[n.length-1],onDismiss:()=>r(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(xL,{permission:_,sessionId:e},_.request_id))}),l.jsx(pL,{sessionId:e})]})}function FL({sessionId:e}){const[t,n]=k.useState(!1),r=k.useRef(null),a=G(p=>p.sessions.get(e)),o=(a==null?void 0:a.aiValidationEnabled)??!1,u=(a==null?void 0:a.aiValidationAutoApprove)??!0,d=(a==null?void 0:a.aiValidationAutoDeny)??!1;k.useEffect(()=>{if(!t)return;function p(m){r.current&&!r.current.contains(m.target)&&n(!1)}return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[t]);function f(p,m){const x=!m,b={[p]:x};G.getState().setSessionAiValidation(e,b),U3(e,b)}return l.jsxs("div",{ref:r,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",d),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 ${d?"text-cc-success":"text-cc-muted"}`,children:d?"On":"Off"})]})]})]})]})}function UL({sessionId:e}){const[t,n]=k.useState(!1),[r,a]=k.useState(null),[o,u]=k.useState(!1),d=k.useRef(null);k.useEffect(()=>{if(!t)return;const p=x=>{d.current&&!d.current.contains(x.target)&&n(!1)},m=x=>{x.key==="Escape"&&n(!1)};return window.addEventListener("pointerdown",p),window.addEventListener("keydown",m),()=>{window.removeEventListener("pointerdown",p),window.removeEventListener("keydown",m)}},[t]);const f=k.useCallback(async p=>{a(p),u(!1);try{const{blob:m,filename:x}=await je.exportSession(e,p),b=URL.createObjectURL(m),y=document.createElement("a");y.href=b,y.download=x,document.body.appendChild(y),y.click(),y.remove(),URL.revokeObjectURL(b),n(!1)}catch(m){Xi(m),u(!0)}finally{a(null)}},[e]);return l.jsxs("div",{ref:d,className:"relative",children:[l.jsx("button",{onClick:()=>n(p=>!p),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer ${t?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:"Export session","aria-label":"Export session","aria-haspopup":"menu","aria-expanded":t,children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3v12m0 0l-4-4m4 4l4-4"}),l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 17v2a2 2 0 002 2h12a2 2 0 002-2v-2"})]})}),t&&l.jsxs("div",{role:"menu",className:"absolute right-0 top-9 z-50 min-w-[176px] rounded-lg border border-cc-border bg-cc-card shadow-lg py-1 animate-[fadeSlideIn_0.15s_ease-out]",children:[l.jsx("div",{className:"px-3 py-1.5 text-[10px] uppercase tracking-wide text-cc-muted",children:"Export session"}),l.jsxs("button",{role:"menuitem",onClick:()=>f("html"),disabled:r!==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:[r==="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:r!==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:[r==="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 IL({sessionId:e}){const t=G(m=>m.density),n=G(m=>m.magicUiAvailable),r=G(m=>{var x;return!!e&&((x=m.sessions.get(e))==null?void 0:x.magicUiActive)===!0}),a=k.useCallback(()=>{var x;if(!e)return;const m=G.getState();((x=m.sessions.get(e))==null?void 0:x.magicUiActive)===!0&&(m.setSessionMagicUi(e,!1),Ey(e,!1))},[e]),o=k.useCallback(()=>{G.getState().setDensity("standard"),a()},[a]),u=k.useCallback(()=>{G.getState().setDensity("compact"),a()},[a]),d=k.useCallback(()=>{e&&(G.getState().setSessionMagicUi(e,!0),Ey(e,!0))},[e]);if(!n||!e)return l.jsx(HL,{});const f=t==="compact",p=[{key:"standard",label:"Standard view",active:!r&&!f,onClick:o,icon:l.jsx(qS,{})},{key:"compact",label:"Compact view",active:!r&&f,onClick:u,icon:l.jsx(VS,{})},{key:"magic",label:"Magic dashboard view",active:r,onClick:d,icon:l.jsx(qL,{})}];return l.jsx("div",{role:"group","aria-label":"View mode",className:"flex items-center rounded-md border border-cc-border overflow-hidden",children:p.map(m=>l.jsx("button",{onClick:m.onClick,className:`flex items-center justify-center w-8 h-8 transition-colors cursor-pointer ${m.active?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:m.label,"aria-label":m.label,"aria-pressed":m.active,children:m.icon},m.key))})}function HL(){const e=G(a=>a.density),t=k.useCallback(()=>G.getState().toggleDensity(),[]),n=e==="compact",r=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:r,"aria-label":r,"aria-pressed":n,children:n?l.jsx(VS,{}):l.jsx(qS,{})})}function qS(){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 VS(){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 qL(){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 VL(){var I;const e=k.useSyncExternalStore(U=>(window.addEventListener("hashchange",U),()=>window.removeEventListener("hashchange",U)),()=>window.location.hash),t=k.useMemo(()=>Qx(e),[e]),n=t.page==="session"||t.page==="home",r=G(U=>U.currentSessionId),a=G(U=>U.cliConnected),o=G(U=>U.sessionStatus),u=G(U=>U.sessionNames),d=G(U=>U.sdkSessions),f=G(U=>U.sidebarOpen),p=G(U=>U.setSidebarOpen),m=G(U=>U.taskPanelOpen),x=G(U=>U.setTaskPanelOpen),b=G(U=>U.activeTab),y=G(U=>U.setActiveTab),_=G(U=>U.markChatTabReentry),j=G(U=>r?U.gitChangedFilesCount.get(r)??0:0),N=r?o.get(r)??null:null,w=r?a.get(r)??!1:!1,E=r?(u==null?void 0:u.get(r))||((I=d.find(U=>U.sessionId===r))==null?void 0:I.name)||`Session ${r.slice(0,8)}`:null,C=!!(r&&n),T=t.page==="session"&&!!r,O=["chat","diff"],z=U=>{U==="chat"&&b!=="chat"&&r&&_(r),y(U)};return k.useEffect(()=>{const U=Z=>{if(!(Z.metaKey||Z.ctrlKey)||Z.key.toLowerCase()!=="j"||!C)return;const L=Z.target;if(L&&(L.tagName==="TEXTAREA"||L.tagName==="INPUT"||L.isContentEditable))return;Z.preventDefault();const q=Math.max(0,O.indexOf(b)),M=Z.shiftKey?-1:1,ie=(q+M+O.length)%O.length;z(O[ie])};return window.addEventListener("keydown",U),()=>window.removeEventListener("keydown",U)},[C,O,b,y,_,r]),l.jsx("header",{className:"relative shrink-0 h-11 px-4 bg-cc-bg",children:l.jsxs("div",{className:"h-full flex items-center gap-1 min-w-0",children:[l.jsx("button",{onClick:()=>p(!f),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer shrink-0 ${f?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,"aria-label":"Toggle sidebar",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 3h18v18H3V3z"}),l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 3v18"})]})}),C&&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:()=>z("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:E||"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:()=>z("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:[C&&r&&l.jsx(FL,{sessionId:r}),C&&r&&l.jsx(UL,{sessionId:r}),C&&l.jsx(IL,{sessionId:r??null}),l.jsx(GL,{}),T&&l.jsx("button",{onClick:()=>x(!m),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer ${m?"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 GL(){const e=G(n=>n.darkMode),t=k.useCallback(()=>G.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 GS="cc-recent-dirs";function Ih(){try{return JSON.parse(localStorage.getItem(GS)||"[]")}catch{return[]}}function YS(e){const t=Ih().filter(n=>n!==e);t.unshift(e),localStorage.setItem(GS,JSON.stringify(t.slice(0,5)))}function YL(){return!1}function WS({onClose:e,embedded:t=!1}){const[n,r]=k.useState([]),[a,o]=k.useState(!0),[u,d]=k.useState(null),[f,p]=k.useState(""),[m,x]=k.useState([]),[b,y]=k.useState(""),[_,j]=k.useState(!1),[N,w]=k.useState(""),[E,C]=k.useState([{key:"",value:""}]),[T,O]=k.useState(!1),z=k.useCallback(()=>{je.listEnvs().then(r).catch(()=>{}).finally(()=>o(!1))},[]);k.useEffect(()=>{z()},[z]);function I(Y){d(Y.slug),p(Y.name);const P=Object.entries(Y.variables).map(([$,re])=>({key:$,value:re}));P.length===0&&P.push({key:"",value:""}),x(P),y("")}function U(){d(null),y("")}async function Z(){if(!u)return;const Y={};for(const P of m){const $=P.key.trim();$&&(Y[$]=P.value)}try{await je.updateEnv(u,{name:f.trim()||void 0,variables:Y}),d(null),y(""),z()}catch(P){y(P instanceof Error?P.message:String(P))}}async function L(Y){try{await je.deleteEnv(Y),u===Y&&d(null),z()}catch(P){y(P instanceof Error?P.message:String(P))}}async function q(){const Y=N.trim();if(!Y)return;O(!0);const P={};for(const $ of E){const re=$.key.trim();re&&(P[re]=$.value)}try{await je.createEnv(Y,P),w(""),C([{key:"",value:""}]),j(!1),y(""),z()}catch($){y($ instanceof Error?$.message:String($))}finally{O(!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:Y=>w(Y.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:Y=>{Y.key==="Enter"&&N.trim()&&q()}}),l.jsx(Qd,{rows:E,onChange:C}),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:q,disabled:!N.trim()||T,className:`px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${N.trim()&&!T?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:T?"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(Y=>{const P=u===Y.slug,$=Object.keys(Y.variables).length;return P?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=>p(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(Qd,{rows:m,onChange:x})]})}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("button",{onClick:U,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 Z(),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"})]})]},Y.slug):l.jsx(WL,{env:Y,varCount:$,onStartEdit:()=>I(Y),onDelete:()=>void L(Y.slug)},Y.slug)})}),b&&!_&&l.jsx("div",{className:"mt-4 px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:b})]})});const M=l.jsxs("div",{className:"rounded-xl bg-cc-card p-4 space-y-2.5",children:[l.jsx("span",{className:"text-sm font-medium text-cc-fg",children:"New Environment"}),l.jsx("input",{type:"text",value:N,onChange:Y=>w(Y.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:Y=>{Y.key==="Enter"&&N.trim()&&q()}}),l.jsx(Qd,{rows:E,onChange:C}),l.jsx("button",{onClick:q,disabled:!N.trim()||T,className:`px-4 py-2.5 min-h-[44px] text-sm font-medium rounded-lg transition-colors ${N.trim()&&!T?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:T?"Creating...":"Create"})]}),ie=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(Y=>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:Y.name}),l.jsxs("span",{className:"text-xs text-cc-muted",children:[Object.keys(Y.variables).length," var",Object.keys(Y.variables).length!==1?"s":""]}),u===Y.slug?l.jsx("button",{onClick:U,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:()=>I(Y),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:()=>L(Y.slug),className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-error cursor-pointer",children:"Delete"})]})]}),u===Y.slug&&l.jsxs("div",{className:"px-3 py-3 space-y-2",children:[l.jsx("input",{type:"text",value:f,onChange:P=>p(P.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(Qd,{rows:m,onChange:x})]})}),l.jsx("button",{onClick:Z,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!==Y.slug&&Object.keys(Y.variables).length>0&&l.jsx("div",{className:"px-3 py-2.5 space-y-1",children:Object.entries(Y.variables).map(([P,$])=>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:P}),l.jsx("span",{className:"text-cc-muted",children:"="}),l.jsx("span",{className:"font-mono-code text-cc-muted break-all whitespace-pre-wrap",children:$})]},P))})]},Y.slug))}),X=l.jsxs("div",{className:"w-full max-w-lg max-h-[90dvh] sm:max-h-[80dvh] mx-0 sm:mx-4 flex flex-col bg-cc-bg rounded-t-[14px] sm:rounded-[14px] shadow-2xl overflow-hidden",onClick:Y=>Y.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}),ie,M]})]});return lo.createPortal(l.jsx("div",{className:"fixed inset-0 z-50 flex items-end sm:items-center justify-center bg-black/50",onClick:e,children:X}),document.body)}function WL({env:e,varCount:t,onStartEdit:n,onDelete:r}){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:r,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 Qd({rows:e,onChange:t}){function n(o,u,d){const f=[...e];f[o]={...f[o],[u]:d},t(f)}function r(o){const u=e.filter((d,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:d=>n(u,"key",d.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:d=>n(u,"value",d.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:()=>r(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 QL=Object.freeze(Object.defineProperty({__proto__:null,EnvManager:WS},Symbol.toStringTag,{value:"Module"}));function XL(e){if(!e)return[];const t=e.split("/").filter(Boolean),n=[{label:"/",path:"/"}];let r="";for(const a of t)r+="/"+a,n.push({label:a,path:r});return n}function KL({initialPath:e,onSelect:t,onClose:n}){const[r,a]=k.useState(""),[o,u]=k.useState([]),[d,f]=k.useState(!0),[p,m]=k.useState(""),[x,b]=k.useState(""),[y,_]=k.useState(!1),[j,N]=k.useState(""),[w,E]=k.useState(-1),[C,T]=k.useState(!1),[O,z]=k.useState(()=>Ih()),I=k.useRef(null),U=k.useRef(null),Z=k.useRef(null),L=k.useRef(new Map),q=k.useMemo(()=>{if(!j)return o;const $=j.toLowerCase();return o.filter(re=>re.name.toLowerCase().includes($))},[o,j]),M=k.useCallback(async $=>{f(!0),m(""),N(""),E(-1);try{const re=await je.listDirs($);a(re.path),u(re.dirs)}catch{m("Could not load directory"),u([])}finally{f(!1)}},[]);k.useEffect(()=>{M(e||void 0)},[]),k.useEffect(()=>{const $=I.current;if(!$)return;function re(D){if(D.key!=="Tab")return;const B=$.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(B.length===0)return;const Q=B[0],R=B[B.length-1];D.shiftKey&&document.activeElement===Q?(D.preventDefault(),R.focus()):!D.shiftKey&&document.activeElement===R&&(D.preventDefault(),Q.focus())}document.addEventListener("keydown",re);const ae=setTimeout(()=>{var D;(D=Z.current)==null||D.focus()},80);return()=>{document.removeEventListener("keydown",re),clearTimeout(ae)}},[]);const ie=k.useCallback(()=>{C||(T(!0),setTimeout(n,150))},[n,C]);k.useEffect(()=>{function $(re){if(re.key==="Escape"){if(y)return;ie()}}return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[y,ie]),k.useEffect(()=>{function $(re){var D,B;if(y)return;if(re.key==="Backspace"&&document.activeElement!==Z.current){if(r&&r!=="/"){re.preventDefault();const Q=r.split("/").slice(0,-1).join("/")||"/";M(Q)}return}const ae=q.length;if(ae!==0){if(re.key==="ArrowDown"){re.preventDefault();const Q=w<ae-1?w+1:0;E(Q),(D=L.current.get(Q))==null||D.focus()}else if(re.key==="ArrowUp"){re.preventDefault();const Q=w>0?w-1:ae-1;E(Q),(B=L.current.get(Q))==null||B.focus()}}}return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[y,q.length,w,r,M]),k.useEffect(()=>{var $;w>=0&&(($=L.current.get(w))==null||$.scrollIntoView({block:"nearest"}))},[w]);function X($){YS($),z(Ih()),t($),n()}const Y=XL(r),P=r.split("/").pop()||"/";return lo.createPortal(l.jsx("div",{className:`fixed inset-0 z-50 flex items-end sm:items-center justify-center transition-opacity duration-150 ${C?"opacity-0":"opacity-100"}`,style:{backgroundColor:"rgba(0,0,0,0.5)",backdropFilter:"blur(4px)"},onClick:ie,children:l.jsxs("div",{ref:I,role:"dialog","aria-modal":"true","aria-label":"Select folder",className:`w-full max-w-lg h-[min(520px,90dvh)] mx-0 sm:mx-4 flex flex-col bg-cc-bg border border-cc-border rounded-t-[14px] sm:rounded-[14px] shadow-2xl overflow-hidden transition-transform duration-150 ${C?"translate-y-4 sm:translate-y-2 opacity-0":"translate-y-0 opacity-100"}`,style:{animation:"fadeSlideIn 200ms ease-out"},onClick:$=>$.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:ie,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"})})})]}),O.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:O.map($=>l.jsx("li",{children:l.jsxs("button",{type:"button",onClick:()=>X($),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:$.split("/").pop()||$}),l.jsx("span",{className:"text-cc-muted font-mono-code text-[10px] truncate ml-auto",children:$})]})},$))})]}),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:x,onChange:$=>b($.target.value),onKeyDown:$=>{$.key==="Enter"&&x.trim()&&X(x.trim()),$.key==="Escape"&&($.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:Y.map(($,re)=>{const ae=re===Y.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:()=>{ae||M($.path)},className:`text-[11px] font-mono-code px-1 py-0.5 rounded transition-colors whitespace-nowrap ${ae?"text-cc-fg font-medium cursor-default":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover cursor-pointer"}`,"aria-current":ae?"location":void 0,tabIndex:ae?-1:0,children:$.label})]},$.path)})}),l.jsx("button",{type:"button","aria-label":"Type path manually",onClick:()=>{_(!0),b(r)},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:Z,type:"text","aria-label":"Filter directories",value:j,onChange:$=>{N($.target.value),E(-1)},placeholder:"Filter...",className:"w-full pl-7 pr-2 py-1.5 text-base sm:text-xs bg-transparent text-cc-fg font-mono-code placeholder:text-cc-muted/60 focus:outline-none rounded-md border border-transparent focus:border-cc-border transition-colors"})]}),l.jsxs("button",{type:"button",onClick:()=>X(r),"aria-label":`Select ${P}`,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:P})]})]}),l.jsx("div",{ref:U,className:"flex-1 min-h-0 overflow-y-auto","aria-label":"Subdirectories",children:d?l.jsx("div",{className:"px-4 py-2 space-y-1","aria-busy":"true","aria-label":"Loading directories",children:Array.from({length:6}).map(($,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))}):p?l.jsxs("div",{className:"px-4 py-8 flex flex-col items-center gap-2 text-center",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-5 h-5 text-cc-error/70",children:l.jsx("path",{d:"M8.982 1.566a1.13 1.13 0 00-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 01-1.1 0L7.1 5.995A.905.905 0 018 5zm.002 6a1 1 0 110 2 1 1 0 010-2z"})}),l.jsx("p",{className:"text-xs text-cc-muted",children:p}),l.jsx("button",{type:"button",onClick:()=>M(r||void 0),className:"mt-1 text-xs text-cc-primary hover:text-cc-primary-hover transition-colors cursor-pointer font-medium",children:"Retry"})]}):q.length===0?l.jsxs("div",{className:"px-4 py-8 text-center",children:[l.jsx("p",{className:"text-xs text-cc-muted",children: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:q.map(($,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:ae=>{ae?L.current.set(re,ae):L.current.delete(re)},onClick:()=>M($.path),onKeyDown:ae=>{ae.key==="Enter"&&(ae.preventDefault(),X($.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:$.path,"aria-label":`Navigate into ${$.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:$.name}),l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-25 shrink-0 ml-auto",children:l.jsx("path",{d:"M6 4l4 4-4 4"})})]}),l.jsx("button",{type:"button",onClick:()=>X($.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 ${$.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"})})})]},$.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 ZL(e,t){const n=t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,60);return`${e.toLowerCase()}-${n}`}function JL(e){return e.branchName&&e.branchName.trim()?e.branchName.trim():ZL(e.identifier,e.title)}function Uc({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 eO({defaultProjectId:e,connectionId:t,onCreated:n,onClose:r}){const[a,o]=k.useState(""),[u,d]=k.useState(""),[f,p]=k.useState(""),[m,x]=k.useState(0),[b,y]=k.useState(!0),[_,j]=k.useState([]),[N,w]=k.useState(""),[E,C]=k.useState(""),[T,O]=k.useState(!0),[z,I]=k.useState(!1),[U,Z]=k.useState("");k.useEffect(()=>{let q=!0;return Promise.all([je.getLinearStates(t),je.getLinearConnection(t)]).then(([M,ie])=>{var Y;if(!q)return;j(M.teams),w(ie.viewerId);const X=((Y=M.teams[0])==null?void 0:Y.id)||"";p(X)}).catch(M=>{q&&Z(M instanceof Error?M.message:"Failed to load teams")}).finally(()=>{q&&O(!1)}),()=>{q=!1}},[t]),k.useEffect(()=>{if(!f||_.length===0){C("");return}const q=_.find(ie=>ie.id===f),M=q==null?void 0:q.states.find(ie=>ie.type==="backlog");C((M==null?void 0:M.id)||"")},[f,_]);async function L(){if(!(!a.trim()||!f)){I(!0),Z("");try{const q=await je.createLinearIssue({title:a.trim(),description:u.trim()||void 0,teamId:f,priority:m,projectId:e||void 0,assigneeId:b&&N?N:void 0,stateId:E||void 0,connectionId:t});n(q.issue)}catch(q){Z(q instanceof Error?q.message:"Failed to create issue")}finally{I(!1)}}}return lo.createPortal(l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:r,children:l.jsxs("div",{className:"mx-4 w-full max-w-md bg-cc-card border border-cc-border rounded-xl shadow-2xl p-5",onClick:q=>q.stopPropagation(),children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsx("h3",{className:"text-sm font-semibold text-cc-fg",children:"Create Linear Issue"}),l.jsx("button",{type:"button",onClick:r,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"})})})]}),U&&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:U}),T?l.jsx("div",{className:"py-8 text-xs text-cc-muted text-center",children:"Loading teams..."}):l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{children:[l.jsx("label",{htmlFor:"create-issue-title",className:"text-xs text-cc-muted block mb-1",children:"Title *"}),l.jsx("input",{id:"create-issue-title",type:"text",value:a,onChange:q=>o(q.target.value),onKeyDown:q=>{q.key==="Enter"&&a.trim()&&f&&!z&&L()},placeholder:"Issue title",autoFocus:!0,className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60"})]}),l.jsxs("div",{children:[l.jsx("label",{htmlFor:"create-issue-desc",className:"text-xs text-cc-muted block mb-1",children:"Description"}),l.jsx("textarea",{id:"create-issue-desc",value:u,onChange:q=>d(q.target.value),placeholder:"Add details... (Markdown supported)",rows:3,className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60 resize-none"})]}),l.jsxs("div",{children:[l.jsx("label",{htmlFor:"create-issue-team",className:"text-xs text-cc-muted block mb-1",children:"Team *"}),l.jsx("select",{id:"create-issue-team",value:f,onChange:q=>p(q.target.value),className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg cursor-pointer",children:_.map(q=>l.jsxs("option",{value:q.id,children:[q.name," (",q.key,")"]},q.id))})]}),l.jsxs("div",{children:[l.jsx("label",{htmlFor:"create-issue-priority",className:"text-xs text-cc-muted block mb-1",children:"Priority"}),l.jsxs("select",{id:"create-issue-priority",value:m,onChange:q=>x(Number(q.target.value)),className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg cursor-pointer",children:[l.jsx("option",{value:0,children:"No priority"}),l.jsx("option",{value:1,children:"Urgent"}),l.jsx("option",{value:2,children:"High"}),l.jsx("option",{value:3,children:"Medium"}),l.jsx("option",{value:4,children:"Low"})]})]}),l.jsxs("label",{htmlFor:"create-issue-assign",className:"flex items-center gap-2 cursor-pointer",children:[l.jsx("input",{id:"create-issue-assign",type:"checkbox",checked:b,onChange:q=>y(q.target.checked),className:"rounded border-cc-border text-cc-primary focus:ring-cc-primary/30 cursor-pointer"}),l.jsx("span",{className:"text-xs text-cc-muted",children:"Assign to me"})]}),l.jsxs("div",{className:"flex gap-2.5 pt-2",children:[l.jsx("button",{type:"button",onClick:r,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:L,disabled:!a.trim()||!f||z,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:z?"Creating...":"Create Issue"})]})]})]})}),document.body)}function tO({cwd:e,gitRepoInfo:t,linearConfigured:n,selectedLinearIssue:r,onIssueSelect:a,onBranchFromIssue:o,onConnectionSelect:u}){const[d,f]=k.useState([]),[p,m]=k.useState(null),[x,b]=k.useState(!1),[y,_]=k.useState(""),[j,N]=k.useState([]),[w,E]=k.useState(!1),[C,T]=k.useState(!1),[O,z]=k.useState(""),[I,U]=k.useState(!1),[Z,L]=k.useState(null),[q,M]=k.useState([]),[ie,X]=k.useState(!1),[Y,P]=k.useState(""),[$,re]=k.useState(!1),[ae,D]=k.useState([]),[B,Q]=k.useState(!1),[R,me]=k.useState(""),[be,Ce]=k.useState(!1),[Le,Ee]=k.useState([]),[Ae,Ue]=k.useState(!1),[dt,Je]=k.useState(!1),At=k.useRef(null);k.useEffect(()=>{function Ne(Be){At.current&&!At.current.contains(Be.target)&&(E(!1),re(!1))}return document.addEventListener("pointerdown",Ne),()=>document.removeEventListener("pointerdown",Ne)},[]),k.useEffect(()=>{if(!n){f([]),m(null),b(!1),u(null);return}let Ne=!0;return je.listLinearConnections().then(({connections:Be})=>{Ne&&(f(Be),b(!0),Be.length>0?(m(Be[0].id),u(Be[0].id)):(m(null),u(null)))}).catch(()=>{Ne&&b(!0)}),()=>{Ne=!1}},[n]);const mt=k.useCallback(Ne=>{m(Ne),u(Ne),a(null),N([]),_(""),z(""),Ee([]),me(""),D([]),Z&&(X(!0),P(""),je.getLinearProjectIssues(Z.projectId,10,Ne).then(({issues:Be})=>{M(Be)}).catch(Be=>{P(Be instanceof Error?Be.message:String(Be))}).finally(()=>{X(!1)}))},[Z,u,a]);k.useEffect(()=>{if(!t||!n){L(null),M([]);return}let Ne=!0;return X(!0),P(""),(async()=>{try{const{mapping:Be}=await je.getLinearProjectMapping(t.repoRoot);if(!Ne)return;if(L(Be),Be){const{issues:yt}=await je.getLinearProjectIssues(Be.projectId,10,p??void 0);if(!Ne)return;M(yt)}else M([])}catch(Be){if(!Ne)return;P(Be instanceof Error?Be.message:String(Be))}finally{Ne&&X(!1)}})(),()=>{Ne=!1}},[t,n,p]),k.useEffect(()=>{if(!n)return;const Ne=y.trim();if(Ne.length<2){N([]),z(""),T(!1);return}let Be=!0;T(!0),z("");const yt=setTimeout(()=>{je.searchLinearIssues(Ne,8,p??void 0).then(Te=>{Be&&N(Te.issues)}).catch(Te=>{Be&&(N([]),z(Te instanceof Error?Te.message:String(Te)))}).finally(()=>{Be&&T(!1)})},400);return()=>{Be=!1,clearTimeout(yt)}},[n,y,p]),k.useEffect(()=>{if(!n||!be){Ee([]),Ue(!1);return}const Ne=R.trim();if(Ne.length<2){Ee([]),Ue(!1);return}let Be=!0;Ue(!0);const yt=setTimeout(()=>{je.searchLinearIssues(Ne,10,p??void 0).then(Te=>{Be&&Ee(Te.issues)}).catch(()=>{Be&&Ee([])}).finally(()=>{Be&&Ue(!1)})},400);return()=>{Be=!1,clearTimeout(yt)}},[n,be,R,p]);function rt(Ne,Be=!1){a(Ne),_(`${Ne.identifier} - ${Ne.title}`);const yt=JL(Ne);o(yt,!0),Be&&E(!1)}function Lt(){a(null),_(""),N([]),z("")}async function we(Ne){if(t)try{const{mapping:Be}=await je.upsertLinearProjectMapping({repoRoot:t.repoRoot,projectId:Ne.id,projectName:Ne.name});L(Be),re(!1),X(!0),P("");const{issues:yt}=await je.getLinearProjectIssues(Ne.id,10,p??void 0);M(yt)}catch(Be){P(Be instanceof Error?Be.message:String(Be))}finally{X(!1)}}async function Ge(){if(t){try{await je.removeLinearProjectMapping(t.repoRoot)}catch{}L(null),M([]),a(null),_("")}}function gt(){if(!n){window.location.hash="#/integrations/linear";return}re(!0),ae.length===0&&(Q(!0),je.listLinearProjects(p??void 0).then(({projects:Ne})=>D(Ne)).catch(()=>{}).finally(()=>Q(!1)))}function _n(Ne){Je(!1),rt(Ne),Z&&(X(!0),je.getLinearProjectIssues(Z.projectId,10,p??void 0).then(({issues:Be})=>M(Be)).catch(()=>{}).finally(()=>X(!1)))}return n?l.jsxs("aside",{className:"space-y-2 mt-0.5",ref:At,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"}),x&&d.length>1&&l.jsx("select",{value:p??"",onChange:Ne=>mt(Ne.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:d.map(Ne=>l.jsx("option",{value:Ne.id,children:Ne.workspaceName||Ne.name},Ne.id))}),Z?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(Uc,{className:"w-3.5 h-3.5"}),l.jsx("span",{children:Z.projectName}),l.jsx("button",{type:"button",onClick:Ge,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:()=>Je(!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}E(!w)},className:`inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs border transition-colors cursor-pointer ${r?"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(Uc,{className:"w-3.5 h-3.5"}),l.jsx("span",{children:"Linear"})]}),n&&t&&l.jsxs("button",{type:"button",onClick:gt,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:()=>Je(!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."})]})]}),Z&&(()=>{const Ne=R.trim().toLowerCase(),Be=!be&&Ne?q.filter(Te=>Te.identifier.toLowerCase().includes(Ne)||Te.title.toLowerCase().includes(Ne)):be?[]:q,yt=be?Le:Be;return l.jsxs("div",{className:"mt-2",children:[r&&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:r.identifier})," - ",r.title]}),l.jsx("button",{type:"button",onClick:Lt,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:R,onChange:Te=>me(Te.target.value),placeholder:be?"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"}),ie?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Loading recent issues..."}):Y?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-error",children:Y}):Ae?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Searching..."}):be&&Ne.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..."}):yt.length===0?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:Ne?"No matching issues":"No active issues found"}):l.jsx("div",{className:"max-h-56 overflow-y-auto -mx-0.5 mt-1",children:yt.map(Te=>l.jsxs("button",{type:"button",onClick:()=>rt(Te),className:`w-full px-2 py-1.5 text-left rounded-md transition-colors cursor-pointer ${(r==null?void 0:r.id)===Te.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:Te.identifier})," ",Te.title]}),l.jsx("div",{className:"text-[10px] text-cc-muted truncate",children:[Te.stateName,Te.priorityLabel].filter(Boolean).join(" - ")})]},Te.id))}),l.jsxs("label",{className:"mt-1.5 flex items-center gap-1.5 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:be,onChange:Te=>{Ce(Te.target.checked),Te.target.checked||Ee([])},className:"rounded border-cc-border text-cc-primary focus:ring-cc-primary/30 cursor-pointer"}),l.jsx("span",{className:"text-[11px] text-cc-muted",children:"Search all projects"})]})]})})(),$&&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"})]})}),B?l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Loading projects..."}):ae.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:ae.map(Ne=>l.jsx("button",{type:"button",onClick:()=>we(Ne),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:Ne.name})},Ne.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:Ne=>{_(Ne.target.value)},onFocus:()=>E(!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:()=>{E(!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&&C&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Searching Linear..."}),y.trim().length>=2&&!C&&O&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-error",children:O}),y.trim().length>=2&&!C&&!O&&j.length===0&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"No matching issues"}),y.trim().length>=2&&!C&&!O&&l.jsx("div",{className:"max-h-56 overflow-y-auto",children:j.map(Ne=>l.jsxs("button",{type:"button",onClick:()=>rt(Ne,!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:Ne.identifier})," - ",Ne.title]}),l.jsx("div",{className:"text-[10px] text-cc-muted truncate",children:[Ne.stateName,Ne.teamName].filter(Boolean).join(" • ")})]},Ne.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"})})})]}),I&&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:()=>{U(!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"})})]}),dt&&l.jsx(eO,{defaultProjectId:Z==null?void 0:Z.projectId,connectionId:p??void 0,onCreated:_n,onClose:()=>Je(!1)})]}):null}function nO({cwd:e,gitRepoInfo:t,selectedBranch:n,isNewBranch:r,useWorktree:a,onBranchChange:o,onWorktreeChange:u,onBranchesLoaded:d}){const[f,p]=k.useState([]),[m,x]=k.useState(!1),[b,y]=k.useState(""),_=k.useRef(null);return k.useEffect(()=>{function j(N){_.current&&!_.current.contains(N.target)&&x(!1)}return document.addEventListener("pointerdown",j),()=>document.removeEventListener("pointerdown",j)},[]),k.useEffect(()=>{t?je.listBranches(t.repoRoot).then(j=>{p(j),d(j)}).catch(()=>{p([]),d([])}):(p([]),d([]))},[t]),t?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"relative",ref:_,children:[l.jsxs("button",{"aria-expanded":m,onClick:()=>{!m&&t&&je.gitFetch(t.repoRoot).catch(()=>{}).finally(()=>{je.listBranches(t.repoRoot).then(j=>{p(j),d(j)}).catch(()=>{p([]),d([])})}),x(!m),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":r?"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"})})]}),m&&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"&&x(!1)}})}),l.jsx("div",{className:"max-h-[240px] overflow-y-auto py-1",children:(()=>{const j=b.toLowerCase().trim(),N=f.filter(T=>!T.isRemote&&(!j||T.name.toLowerCase().includes(j))),w=f.filter(T=>T.isRemote&&(!j||T.name.toLowerCase().includes(j))),E=f.some(T=>T.name.toLowerCase()===j),C=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(T=>l.jsxs("button",{onClick:()=>{o(T.name,!1),x(!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 ${T.name===n?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{className:"truncate font-mono-code",children:T.name}),l.jsxs("span",{className:"ml-auto flex items-center gap-1.5 shrink-0",children:[T.ahead>0&&l.jsxs("span",{className:"text-[9px] text-green-500",children:[T.ahead,"↑"]}),T.behind>0&&l.jsxs("span",{className:"text-[9px] text-amber-500",children:[T.behind,"↓"]}),T.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"}),T.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"})]})]},T.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(T=>l.jsxs("button",{onClick:()=>{o(T.name,!1),x(!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 ${T.name===n?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{className:"truncate font-mono-code",children:T.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-${T.name}`))]}),!C&&j&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted text-center",children:"No matching branches"}),j&&!E&&l.jsx("div",{className:"border-t border-cc-border mt-1 pt-1",children:l.jsxs("button",{onClick:()=>{o(b.trim(),!0),x(!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 rO=336*60*60*1e3,Ea=12,sO=24;function Sx(e){return e.split("/").filter(Boolean).pop()||e}function iw(e){var t,n;return((t=e.name)==null?void 0:t.trim())||((n=e.slug)==null?void 0:n.trim())||Sx(e.cwd)}function iO(e){return e.length>8?e.slice(0,8):e}function aO(e,t=2){const n=e.split("/").filter(Boolean);return n.length<=t?e:`.../${n.slice(-t).join("/")}`}function lO(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 r=Math.floor(n/60);if(r<24)return`${r}h ago`;const a=Math.floor(r/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`}function oO(){var mi;const[e,t]=k.useState(""),[n]=k.useState(()=>!(localStorage.getItem("cc-user-name")||"").trim()),[r,a]=k.useState(()=>localStorage.getItem("cc-user-name")||""),[o,u]=k.useState(()=>localStorage.getItem("cc-session-prefix")||""),[d,f]=k.useState(""),[p,m]=k.useState(()=>localStorage.getItem("cc-backend")||"claude"),[x,b]=k.useState([]),[y,_]=k.useState(()=>Z5(localStorage.getItem("cc-backend")||"claude")),[j,N]=k.useState(()=>J5(localStorage.getItem("cc-backend")||"claude")),[w,E]=k.useState(()=>localStorage.getItem("cc-effort")||""),[C,T]=k.useState(()=>Ih()[0]||""),[O,z]=k.useState([]),[I,U]=k.useState(null),[Z,L]=k.useState(!1),[q,M]=k.useState(""),[ie,X]=k.useState(null),[Y,P]=k.useState(!1),[$,re]=k.useState(null),[ae,D]=k.useState(null),[B,Q]=k.useState(()=>localStorage.getItem("cc-onboarding-dismissed")!=="true"),R=ie||FS(p),me=K5(p),be=hL(p),[Ce,Le]=k.useState([]),[Ee,Ae]=k.useState(()=>localStorage.getItem("cc-selected-env")||""),[Ue,dt]=k.useState(!1),[Je,At]=k.useState(!1),mt=YL(),[rt,Lt]=k.useState(()=>mt),[we,Ge]=k.useState([]),[gt,_n]=k.useState(()=>localStorage.getItem("cc-selected-sandbox")||""),[Ne,Be]=k.useState(!1),yt=k.useRef(null),[Te,Xr]=k.useState(null),oe=k.useRef(null),ke=k.useRef(null),[W,xe]=k.useState(!1),[Oe,Xe]=k.useState(!1),[lt,ot]=k.useState(!1),[Et,wn]=k.useState(!1),[st,fr]=k.useState(!1),[Pn,cs]=k.useState(""),[Kr,Zr]=k.useState(!0),[ne,ve]=k.useState([]),[_e,Ke]=k.useState(!1),[qt,fn]=k.useState(""),[$n,Vt]=k.useState(!1),[Yn,Tr]=k.useState(Ea),[Ua,uo]=k.useState(""),[Wn,Ji]=k.useState(null),[ho,fo]=k.useState(!1),[Mr,en]=k.useState(""),[Tn,pr]=k.useState(!1),[po,ef]=k.useState([]),[ea,ta]=k.useState(null),[us,oi]=k.useState(!1),[As,Jn]=k.useState(""),[na,ds]=k.useState(0),nn=k.useRef(null),er=k.useRef(null),Ia=k.useRef(null),Jr=k.useRef(null),hs=k.useRef(null),mo=k.useRef(null),go=G(H=>H.currentSessionId),rn=IS({text:e,caretPos:na,cwd:C||void 0});k.useEffect(()=>{if(nn.current===null||!er.current)return;const H=nn.current;er.current.setSelectionRange(H,H),nn.current=null},[e]),k.useEffect(()=>{var ge;window.matchMedia("(min-width: 640px)").matches&&((ge=er.current)==null||ge.focus())},[]),k.useEffect(()=>{je.getHome().then(({home:H,cwd:ge})=>{C||T(ge||H)}).catch(()=>{}),je.listEnvs().then(Le).catch(()=>{}),je.listSandboxes().then(Ge).catch(()=>{}),je.getBackends().then(b).catch(()=>{}),je.getSettings().then(H=>{P(H.linearApiKeyConfigured)}).catch(()=>{})},[]);function tf(H){m(H),localStorage.setItem("cc-backend",H),X(null),_(Z5(H)),N(J5(H)),H!=="claude"&&(fr(!1),ve([]),fn(""),Ke(!1),Vt(!1),Tr(Ea),uo(""))}k.useEffect(()=>{if(p!=="codex"){X(null);return}je.getBackendModels(p).then(H=>{if(H.length>0){const ge=uL(H);X(ge),ge.some(Ze=>Ze.value===y)||_(ge[0].value)}}).catch(()=>{})},[p]),k.useEffect(()=>{if(oe.current&&(clearInterval(oe.current),oe.current=null),Xr(null),!rt)return;const H="the-companion:latest",ge=()=>{je.getImageStatus(H).then(Ze=>{Xr(Ze),Ze.status==="idle"&&je.pullImage(H).catch(()=>{}),(Ze.status==="ready"||Ze.status==="error")&&oe.current&&(clearInterval(oe.current),oe.current=null)}).catch(()=>{})};return ge(),oe.current=setInterval(ge,2e3),()=>{oe.current&&(clearInterval(oe.current),oe.current=null)}},[rt]),k.useEffect(()=>{function H(ge){Ia.current&&!Ia.current.contains(ge.target)&&xe(!1),Jr.current&&!Jr.current.contains(ge.target)&&Xe(!1),hs.current&&!hs.current.contains(ge.target)&&ot(!1),mo.current&&!mo.current.contains(ge.target)&&dt(!1),yt.current&&!yt.current.contains(ge.target)&&Be(!1)}return document.addEventListener("pointerdown",H),()=>document.removeEventListener("pointerdown",H)},[]),k.useEffect(()=>{if(!C){Ji(null);return}je.getRepoInfo(C).then(H=>{Ji(H),en(H.currentBranch),pr(!1)}).catch(()=>{Ji(null),en(""),pr(!1)})},[C]);const ra=R.find(H=>H.value===y)||R[0],Ha=me.find(H=>H.value===j)||me[0],es=be.find(H=>H.value===w)||be[0],tr=p==="codex"?"/logo-codex.svg":"/logo.svg",cu=C?C.split("/").pop()||C:"Select folder",xo=k.useMemo(()=>Pn.trim(),[Pn]),qa=p==="claude"&&st&&xo.length>0,fs=k.useMemo(()=>{const H=Date.now()-rO;return ne.filter(ge=>ge.createdAt>=H)},[ne]),ci=k.useMemo(()=>$n?ne:fs.length>0?fs:ne,[$n,fs,ne]),Rr=k.useMemo(()=>Ua.trim().toLowerCase(),[Ua]),un=k.useMemo(()=>Rr?ci.filter(H=>{const ge=iw(H).toLowerCase(),Ze=Sx(H.cwd).toLowerCase(),_t=(H.gitBranch||"").toLowerCase(),ct=H.cwd.toLowerCase(),Ve=H.resumeSessionId.toLowerCase();return ge.includes(Rr)||Ze.includes(Rr)||_t.includes(Rr)||ct.includes(Rr)||Ve.includes(Rr)}):ci,[ci,Rr]),sa=k.useMemo(()=>un.slice(0,Yn),[un,Yn]),uu=Yn<un.length,Va=Math.max(0,ne.length-fs.length),ui=!$n&&fs.length>0,Ga=k.useCallback(async()=>{if(p==="claude"){Ke(!0),fn("");try{const[H,ge]=await Promise.all([je.listSessions(),je.discoverClaudeSessions(400).then(Ve=>Ve.sessions)]),Ze=new Map,_t=Ve=>{const Qn=Ze.get(Ve.resumeSessionId);(!Qn||Ve.createdAt>Qn.createdAt)&&Ze.set(Ve.resumeSessionId,Ve)};for(const Ve of H)Ve.backendType!=="codex"&&Ve.cliSessionId&&_t({resumeSessionId:Ve.cliSessionId,sessionId:Ve.sessionId,name:Ve.name,model:Ve.model,createdAt:Ve.createdAt,cwd:Ve.cwd,gitBranch:Ve.gitBranch,source:"companion"});for(const Ve of ge)_t({resumeSessionId:Ve.sessionId,sessionId:Ve.sessionId,slug:Ve.slug,createdAt:Ve.lastActivityAt,cwd:Ve.cwd,gitBranch:Ve.gitBranch,source:"claude_disk"});const ct=Array.from(Ze.values()).sort((Ve,Qn)=>{const kn=C&&Ve.cwd===C?0:1,Or=C&&Qn.cwd===C?0:1;return kn!==Or?kn-Or:Qn.createdAt-Ve.createdAt});ve(ct),Vt(!1),Tr(Ea)}catch(H){const ge=H instanceof Error?H.message:String(H);fn(ge||"Failed to load existing sessions"),ve([]),Tr(Ea)}finally{Ke(!1)}}},[p,C]);k.useEffect(()=>{p==="claude"&&st&&Ga()},[p,st,Ga]),k.useEffect(()=>{Tr(Ea)},[Rr,$n]);async function vo(H){if(H.length===0)return;const ge=[],Ze=[];let _t=O.reduce((ct,Ve)=>ct+Ve.size,0);for(const ct of H){if(ct.size>Fh){Ze.push(`${ct.name} is too large (${Gi(ct.size)}, max ${Gi(Fh)})`);continue}if(_t+ct.size>Uh){Ze.push(`${ct.name} would exceed the per-message limit (${Gi(Uh)})`);continue}const{base64:Ve,mediaType:Qn}=await CS(ct);ge.push({name:ct.name,base64:Ve,mediaType:Qn,size:ct.size}),_t+=ct.size}ge.length>0&&z(ct=>[...ct,...ge]),U(Ze.length>0?Ze.join("; "):null)}async function di(H){const ge=H.target.files;ge&&(await vo(Array.from(ge)),H.target.value="")}function nf(H){z(ge=>ge.filter((Ze,_t)=>_t!==H))}async function du(H){var _t;const ge=(_t=H.clipboardData)==null?void 0:_t.items;if(!ge)return;const Ze=[];for(const ct of Array.from(ge)){if(ct.kind!=="file")continue;const Ve=ct.getAsFile();if(!Ve)continue;const Qn=Ve.name&&Ve.name.length>0?Ve.name:`pasted-${Date.now()}.${(Ve.type.split("/")[1]||"bin").replace(/[^a-zA-Z0-9]/g,"")}`;Ze.push(new File([Ve],Qn,{type:Ve.type,lastModified:Ve.lastModified}))}Ze.length>0&&(H.preventDefault(),await vo(Ze))}function hu(H){t(H.target.value),ds(H.target.selectionStart??H.target.value.length);const ge=H.target;ge.style.height="auto",ge.style.height=Math.min(ge.scrollHeight,200)+"px"}function Ya(){er.current&&ds(er.current.selectionStart??0)}function fu(H){var Ze;const ge=rn.selectPrompt(H);nn.current=ge.nextCursor,t(ge.nextText),rn.setMentionMenuOpen(!1),ds(ge.nextCursor),(Ze=er.current)==null||Ze.focus(),er.current&&(er.current.style.height="auto",er.current.style.height=Math.min(er.current.scrollHeight,200)+"px")}function rf(H){if(rn.mentionMenuOpen&&H.key==="Escape"){H.preventDefault(),rn.setMentionMenuOpen(!1);return}if(rn.mentionMenuOpen&&rn.filteredPrompts.length>0){if(H.key==="ArrowDown"){H.preventDefault(),rn.setMentionMenuIndex(ge=>(ge+1)%rn.filteredPrompts.length);return}if(H.key==="ArrowUp"){H.preventDefault(),rn.setMentionMenuIndex(ge=>(ge-1+rn.filteredPrompts.length)%rn.filteredPrompts.length);return}if(H.key==="Tab"&&!H.shiftKey||H.key==="Enter"&&!H.shiftKey){H.preventDefault(),fu(rn.filteredPrompts[rn.mentionMenuIndex]);return}}if(rn.mentionMenuOpen&&rn.filteredPrompts.length===0&&(H.key==="Enter"&&!H.shiftKey||H.key==="Tab"&&!H.shiftKey)){H.preventDefault();return}if(H.key==="Tab"&&H.shiftKey){H.preventDefault();const ge=K5(p),_t=(ge.findIndex(ct=>ct.value===j)+1)%ge.length;N(ge[_t].value);return}H.key==="Enter"&&!H.shiftKey&&(H.preventDefault(),Dr())}function Wa(H){const ge=r.trim(),Ze=ge?`[${ge}]: ${H}`:H;if(!$)return Ze;const _t=($.description??"").trim();return`${["Linear issue context:",`- Identifier: ${$.identifier}`,`- Title: ${$.title}`,$.stateName?`- State: ${$.stateName}`:"",$.priorityLabel?`- Priority: ${$.priorityLabel}`:"",$.teamName?`- Team: ${$.teamName}`:"",`- URL: ${$.url}`,_t?`- Description:
|
|
112
|
+
${_t}`:""].filter(Boolean).join(`
|
|
113
|
+
`)}
|
|
114
|
+
|
|
115
|
+
User request:
|
|
116
|
+
${Ze}`}async function Dr(){const H=e.trim();if(!(!H||Z)){if(n&&!r.trim()){M("Please enter your name before starting a session.");return}if(L(!0),M(""),Jn(""),Wn){const ge=Mr||Wn.currentBranch;if(ge&&ge===Wn.currentBranch){const Ze=po.find(_t=>_t.name===ge&&!_t.isRemote);if(Ze&&Ze.behind>0){ta({behind:Ze.behind,branchName:ge});return}}}await hi(H)}}async function hi(H,ge){const Ze=G.getState();Ze.clearCreation(),Ze.setSessionCreating(!0,p);try{go&&_g(go);const _t=(ge==null?void 0:ge.resumeSessionAt)||(qa?xo:void 0),ct=_t?(ge==null?void 0:ge.forkSession)??(qa?Kr:void 0):void 0,Ve=(ge==null?void 0:ge.cwd)||C,Qn=(ge==null?void 0:ge.branch)!==void 0?ge.branch.trim()||void 0:Mr.trim()||void 0,kn=(ge==null?void 0:ge.useWorktree)!==void 0?ge.useWorktree:ho,Or=(ge==null?void 0:ge.createBranch)!==void 0?ge.createBranch:!!(Qn&&Tn),Ts=await B6({model:y,permissionMode:j,effort:p==="claude"&&w?w:void 0,cwd:Ve||void 0,envSlug:Ee||void 0,sandboxEnabled:rt?!0:void 0,sandboxSlug:rt&>?gt:void 0,branch:Qn,createBranch:Or?!0:void 0,useWorktree:kn?!0:void 0,backend:p,codexInternetAccess:p==="codex"?!0:void 0,resumeSessionAt:_t,forkSession:ct,userName:r.trim()||void 0,linearConnectionId:$&&ae||void 0,linearIssue:$?{identifier:$.identifier,title:$.title,stateName:$.stateName,teamName:$.teamName,url:$.url}:void 0},ps=>{G.getState().addCreationProgress(ps)}),Sn=Ts.sessionId,gu=G.getState(),yo=gu.sdkSessions.filter(ps=>ps.sessionId!==Sn);gu.setSdkSessions([...yo,{sessionId:Sn,state:Ts.state,cwd:Ts.cwd,createdAt:Date.now(),backendType:Ts.backendType||p,model:y,permissionMode:j,userName:r.trim()||void 0,resumeSessionAt:_t,forkSession:_t?ct===!0:void 0}]);const _o=new Set(G.getState().sessionNames.values()),aa=mw(_o),la=o.trim()||r.trim(),xu=d.trim()||aa,vu=la?`${la}_${xu}`:xu;G.getState().setSessionName(Sn,vu),je.renameSession(Sn,vu).catch(()=>{}),f(""),Ve&&YS(Ve),G.getState().setPreviousPermissionMode(Sn,j),Xx(Sn,!0),nu(Sn),await B3(Sn);const bu=H.trim();if(bu.length>0){const ps=Wa(bu),yu=vg(),_u=O.length>0?O.map(Ka=>({name:Ka.name,media_type:Ka.mediaType,data:Ka.base64,size:Ka.size})):void 0;Bn(Sn,{type:"user_message",content:ps,session_id:Sn,attachments:_u,client_msg_id:yu}),G.getState().appendMessage(Sn,{id:yu,role:"user",content:ps,attachments:_u,timestamp:Date.now()})}$&&(je.linkLinearIssue(Sn,$,ae||void 0).then(()=>G.getState().setLinkedLinearIssue(Sn,$)).catch(()=>{}),je.transitionLinearIssue($.id,ae||void 0).catch(()=>{})),G.getState().clearCreation()}catch(_t){const ct=_t instanceof Error?_t.message:String(_t);M(ct),G.getState().setCreationError(ct),L(!1)}}async function Qa(H,ge){Z||(L(!0),M(""),Jn(""),T(H.cwd),fo(!1),pr(!1),en(H.gitBranch||""),cs(H.resumeSessionId),Zr(ge),await hi("",{resumeSessionAt:H.resumeSessionId,forkSession:ge,cwd:H.cwd,branch:H.gitBranch,useWorktree:!1,createBranch:!1}))}async function fi(){if(ea){oi(!0),Jn("");try{const H=C||(Wn==null?void 0:Wn.repoRoot);if(!H)throw new Error("No working directory");const ge=await je.gitPull(H);if(!ge.success){Jn(ge.output||"Pull failed"),oi(!1),L(!1);return}ta(null),oi(!1),await hi(e.trim())}catch(H){Jn(H instanceof Error?H.message:String(H)),oi(!1)}}}function pi(){const H=e.trim();ta(null),Jn(""),hi(H)}function pu(){ta(null),Jn(""),L(!1)}const bo=k.useCallback((H,ge)=>{en(H),pr(ge)},[]),mu=k.useCallback((H,ge)=>{en(H),pr(ge)},[]),ia=k.useCallback(H=>{ef(H)},[]),Lr=k.useCallback(H=>{re(H),!H&&Wn&&(en(Wn.currentBranch),pr(!1))},[Wn]),Xa=e.trim().length>0&&!Z&&(!n||r.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:tr,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:r,onChange:H=>{const ge=H.target.value;a(ge),localStorage.setItem("cc-user-name",ge)},placeholder:"e.g. Moritz","aria-label":"Your name","aria-required":"true","aria-invalid":r.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:H=>{const ge=H.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:d,onChange:H=>f(H.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()||r.trim()||"MA","_",d.trim()||"InvoicePdf"]}),"."]})]}),l.jsx("input",{ref:ke,type:"file",multiple:!0,onChange:di,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(US,{open:rn.mentionMenuOpen,loading:rn.promptsLoading,prompts:rn.filteredPrompts,selectedIndex:rn.mentionMenuIndex,onSelect:fu,menuRef:rn.mentionMenuRef,className:"absolute left-2 right-2 bottom-full mb-1"}),($||O.length>0)&&l.jsxs("div",{className:"flex items-center gap-2 px-4 pt-3 flex-wrap",children:[$&&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:$.identifier}),l.jsx("span",{className:"truncate",children:$.title}),l.jsx("button",{type:"button",onClick:()=>Lr(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:"×"})]}),O.map((H,ge)=>l.jsx(TS,{name:H.name,mediaType:H.mediaType,base64:H.base64,size:H.size,onRemove:()=>nf(ge),className:"w-10 h-10"},ge))]}),I&&l.jsx("div",{className:"px-4 pt-2 text-[11px] text-cc-error",children:I}),l.jsx("textarea",{ref:er,value:e,onChange:hu,onKeyDown:rf,onClick:Ya,onKeyUp:Ya,onPaste:du,"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:Ia,children:[l.jsxs("button",{onClick:()=>xe(!W),"aria-expanded":W,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:ra.icon}),l.jsx("span",{children:ra.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"})})]}),W&&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:R.map(H=>l.jsxs("button",{onClick:()=>{_(H.value),xe(!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 ${H.value===y?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{children:H.icon}),H.label]},H.value))})]}),be.length>0&&l.jsxs("div",{className:"relative",ref:hs,children:[l.jsxs("button",{onClick:()=>ot(!lt),"aria-expanded":lt,"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:es.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"})})]}),lt&&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:be.map(H=>l.jsx("button",{onClick:()=>{E(H.value),localStorage.setItem("cc-effort",H.value),ot(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${H.value===w?"text-cc-primary font-medium":"text-cc-fg"}`,children:H.label},H.value||"default"))})]}),l.jsxs("div",{className:"relative",ref:Jr,children:[l.jsxs("button",{onClick:()=>Xe(!Oe),"aria-expanded":Oe,className:"flex items-center gap-1 px-2 py-1 text-[11px] sm:text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:l.jsx("path",{d:"M2 4h12M2 8h8M2 12h10",strokeLinecap:"round"})}),Ha.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"})})]}),Oe&&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:me.map(H=>l.jsx("button",{onClick:()=>{N(H.value),Xe(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${H.value===j?"text-cc-primary font-medium":"text-cc-fg"}`,children:H.label},H.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:()=>wn(!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:cu})]}),Et&&l.jsx(KL,{initialPath:C||"",onSelect:H=>{T(H)},onClose:()=>wn(!1)})]}),l.jsx(nO,{cwd:C,gitRepoInfo:Wn,selectedBranch:Mr,isNewBranch:Tn,useWorktree:ho,onBranchChange:bo,onWorktreeChange:fo,onBranchesLoaded:ia}),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:mo,children:[l.jsxs("button",{onClick:()=>{Ue||je.listEnvs().then(Le).catch(()=>{}),dt(!Ue)},"aria-expanded":Ue,className:"flex items-center gap-1 px-2 py-1 text-[11px] sm:text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:l.jsx("path",{d:"M8 1a2 2 0 012 2v1h2a2 2 0 012 2v6a2 2 0 01-2 2H4a2 2 0 01-2-2V6a2 2 0 012-2h2V3a2 2 0 012-2zm0 1.5a.5.5 0 00-.5.5v1h1V3a.5.5 0 00-.5-.5zM4 5.5a.5.5 0 00-.5.5v6a.5.5 0 00.5.5h8a.5.5 0 00.5-.5V6a.5.5 0 00-.5-.5H4z"})}),l.jsx("span",{className:"max-w-[80px] sm:max-w-[100px] truncate",children:Ee?((mi=Ce.find(H=>H.slug===Ee))==null?void 0:mi.name)||"Env":"No env"})]}),Ue&&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:()=>{Ae(""),localStorage.setItem("cc-selected-env",""),dt(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${Ee?"text-cc-fg":"text-cc-primary font-medium"}`,children:"No environment"}),Ce.map(H=>l.jsxs("button",{onClick:()=>{Ae(H.slug),localStorage.setItem("cc-selected-env",H.slug),dt(!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 ${H.slug===Ee?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{className:"truncate",children:H.name}),l.jsxs("span",{className:"text-cc-muted ml-auto shrink-0",children:[Object.keys(H.variables).length," var",Object.keys(H.variables).length!==1?"s":""]})]},H.slug)),l.jsx("div",{className:"border-t border-cc-border mt-1 pt-1",children:l.jsx("button",{onClick:()=>{At(!0),dt(!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..."})})]})]}),mt,l.jsx("div",{className:"flex-1"}),l.jsx("button",{onClick:()=>{var H;return(H=ke.current)==null?void 0:H.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:Dr,disabled:!Xa,className:`flex items-center justify-center w-8 h-8 sm:w-9 sm:h-9 rounded-full transition-colors ${Xa?"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:[x.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:x.map(H=>l.jsxs("button",{onClick:()=>H.available&&tf(H.id),disabled:!H.available,title:H.available?H.name:`${H.name} CLI not found in PATH`,className:`flex items-center gap-1 px-3 py-1.5 text-xs rounded-md transition-colors ${H.available?p===H.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:[H.name,!H.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"})]})]},H.id))})}),p==="claude"&&l.jsxs("div",{children:[l.jsxs("button",{type:"button",onClick:()=>fr(H=>!H),className:`mx-auto flex items-center gap-1.5 px-2 py-1 text-[11px] sm:text-xs rounded-md transition-colors cursor-pointer ${st?"text-cc-primary":"text-cc-muted hover:text-cc-fg"}`,"aria-expanded":st,"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 ${st?"rotate-180":""}`,children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]}),l.jsx("div",{className:"accordion-panel","data-open":st?"true":"false",children:l.jsx("div",{className:"accordion-inner",inert:!st||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 Ga(),disabled:_e,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:_e?"Refreshing...":"Refresh detected sessions"}),ne.length>0&&l.jsxs("span",{className:"text-[11px] text-cc-muted",children:["Showing ",sa.length," of ",un.length," ",Rr?"matching":ui?"recent":"detected"," Claude session",un.length!==1?"s":"","."]}),!$n&&Va>0&&fs.length>0&&l.jsxs("button",{type:"button",onClick:()=>{Vt(!0),Tr(Ea)},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 (",Va,")"]}),$n&&fs.length>0&&l.jsx("button",{type:"button",onClick:()=>{Vt(!1),Tr(Ea)},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:Ua,onChange:H=>uo(H.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."]}),qt&&l.jsx("p",{className:"text-[11px] text-cc-error",children:qt}),!_e&&!qt&&un.length===0&&l.jsx("p",{className:"text-[11px] text-cc-muted",children:Rr?"No sessions match this search.":"No Claude sessions detected yet."}),sa.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:sa.map(H=>{const ge=iw(H),Ze=Sx(H.cwd),_t=H.source==="companion"?"Companion":"Claude",ct=xo===H.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 ${ct?"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:iO(H.resumeSessionId)}),l.jsx("span",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted",children:_t})]})]}),l.jsxs("div",{className:"min-w-0 text-[11px] text-cc-muted sm:font-mono-code truncate",title:H.cwd,children:[l.jsx("div",{className:"truncate",children:Ze}),l.jsx("div",{className:"mt-0.5 text-[10px] text-cc-muted/70 truncate",title:H.cwd,children:aO(H.cwd)})]}),l.jsx("div",{className:"text-[11px] text-cc-muted sm:font-mono-code truncate",children:H.gitBranch||"—"}),l.jsx("div",{className:"text-[11px] text-cc-muted",children:lO(H.createdAt)}),l.jsxs("div",{className:"sm:text-right flex gap-1.5 sm:justify-end",children:[l.jsx("button",{type:"button",onClick:()=>{cs(H.resumeSessionId),Zr(!0),Qa(H,!0)},"aria-label":`Fork and open ${ge}`,className:`px-2 py-1 rounded-md text-[11px] border transition-colors cursor-pointer ${ct&&Kr?"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
|
|
117
|
+
${H.cwd}${H.gitBranch?` (${H.gitBranch})`:""}
|
|
118
|
+
${H.resumeSessionId}`,children:"Fork"}),l.jsx("button",{type:"button",onClick:()=>{cs(H.resumeSessionId),Zr(!1),Qa(H,!1)},"aria-label":`Continue and open ${ge}`,className:`px-2 py-1 rounded-md text-[11px] border transition-colors cursor-pointer ${ct&&!Kr?"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
|
|
119
|
+
${H.resumeSessionId}`,children:"Continue"})]})]},`${H.resumeSessionId}-row-${H.sessionId}`)})}),uu&&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:()=>Tr(H=>Math.min(H+sO,un.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 (",un.length-Yn," 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."})]})})})]}),B&&l.jsxs("div",{className:"flex items-start gap-2 px-3 py-2 rounded-xl bg-cc-primary/5 border border-cc-primary/10 text-[11px] text-cc-muted",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary/60 shrink-0 mt-0.5",children:l.jsx("path",{d:"M8 1.5a6.5 6.5 0 100 13 6.5 6.5 0 000-13zM0 8a8 8 0 1116 0A8 8 0 010 8zm6.5-.25A.75.75 0 017.25 7h1a.75.75 0 01.75.75v2.75h.25a.75.75 0 010 1.5h-2a.75.75 0 010-1.5h.25v-2h-.25a.75.75 0 01-.75-.75zM8 6a1 1 0 110-2 1 1 0 010 2z"})}),l.jsxs("span",{className:"flex-1",children:["The toolbar sets where your code lives, which model to use, and how the session runs.",p==="claude"&&l.jsxs(l.Fragment,{children:[" ",l.jsx("strong",{className:"text-cc-fg",children:"Branch from session"})," below lets you fork or continue a previous Claude session."]})]}),l.jsx("button",{onClick:()=>{Q(!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(tO,{cwd:C,gitRepoInfo:Wn,linearConfigured:Y,selectedLinearIssue:$,onIssueSelect:Lr,onBranchFromIssue:mu,onConnectionSelect:D})]}),ea&&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:ea.branchName})," is"," ",l.jsxs("span",{className:"font-semibold text-amber-500",children:[ea.behind," commit",ea.behind!==1?"s":""," behind"]})," ","remote. Pull before starting?"]}),As&&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:As}),l.jsxs("div",{className:"flex flex-wrap gap-2 mt-2.5",children:[l.jsx("button",{onClick:pu,disabled:us,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:pi,disabled:us,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:fi,disabled:us,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:us?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"w-3 h-3 border-2 border-cc-primary/30 border-t-cc-primary rounded-full animate-spin"}),"Pulling..."]}):"Pull and continue"})]})]})]})}),q&&l.jsxs("div",{className:"mt-3 flex items-center gap-2 px-3 py-2 rounded-lg bg-cc-error/5 border border-cc-error/20",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-error shrink-0",children:l.jsx("path",{fillRule:"evenodd",d:"M8 15A7 7 0 108 1a7 7 0 000 14zm1-3a1 1 0 11-2 0 1 1 0 012 0zM7.5 5.5a.5.5 0 011 0v3a.5.5 0 01-1 0v-3z",clipRule:"evenodd"})}),l.jsx("p",{className:"text-xs text-cc-error",children:q})]})]}),Je&&l.jsx(WS,{onClose:()=>{At(!1),je.listEnvs().then(Le).catch(()=>{})}})]})}const cO=[],uO=[],dO={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"}},hO={label:"Unknown",badge:"text-cc-muted bg-cc-hover",dot:"bg-cc-muted opacity-40"};function fO({server:e,sessionId:t}){var d,f;const[n,r]=k.useState(!1),a=dO[e.status]||hO,o=e.status!=="disabled",u=((d=e.tools)==null?void 0:d.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:()=>r(!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:()=>P3(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:()=>$3(t,e.name),className:"w-6 h-6 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:"Reconnect server",children:l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:[l.jsx("path",{d:"M2.5 8a5.5 5.5 0 019.78-3.5M13.5 8a5.5 5.5 0 01-9.78 3.5",strokeLinecap:"round"}),l.jsx("path",{d:"M12.5 2v3h-3M3.5 14v-3h3",strokeLinecap:"round",strokeLinejoin:"round"})]})})]})]}),n&&l.jsxs("div",{className:"px-2.5 pb-2.5 space-y-1.5 pt-2",children:[l.jsxs("div",{className:"text-[11px] text-cc-muted space-y-0.5",children:[l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("span",{className:"text-cc-muted/60",children:"Type:"}),l.jsx("span",{children:e.config.type})]}),e.config.command&&l.jsxs("div",{className:"flex items-start gap-1",children:[l.jsx("span",{className:"text-cc-muted/60 shrink-0",children:"Cmd:"}),l.jsxs("span",{className:"font-mono text-[10px] break-all",children:[e.config.command,(f=e.config.args)!=null&&f.length?` ${e.config.args.join(" ")}`:""]})]}),e.config.url&&l.jsxs("div",{className:"flex items-start gap-1",children:[l.jsx("span",{className:"text-cc-muted/60 shrink-0",children:"URL:"}),l.jsx("span",{className:"font-mono text-[10px] break-all",children:e.config.url})]}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("span",{className:"text-cc-muted/60",children:"Scope:"}),l.jsx("span",{children:e.scope})]})]}),e.error&&l.jsx("div",{className:"text-[11px] text-cc-error bg-cc-error/5 rounded px-2 py-1",children:e.error}),u>0&&l.jsxs("div",{className:"space-y-1",children:[l.jsxs("span",{className:"text-[10px] text-cc-muted uppercase tracking-wider",children:["Tools (",u,")"]}),l.jsx("div",{className:"flex flex-wrap gap-1",children:e.tools.map(p=>l.jsx("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded bg-cc-hover text-cc-fg",title:p.annotations&&Object.entries(p.annotations).filter(([,m])=>m).map(([m])=>m).join(", ")||void 0,children:p.name},p.name))})]})]})]})}function pO({sessionId:e,onDone:t}){const[n,r]=k.useState(""),[a,o]=k.useState("stdio"),[u,d]=k.useState(""),[f,p]=k.useState(""),[m,x]=k.useState(""),b=n.trim()&&(a==="stdio"?u.trim():m.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=m.trim(),F3(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:_=>r(_.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:_=>d(_.target.value),placeholder:"npx -y @modelcontextprotocol/server-memory",className:"w-full text-[12px] bg-cc-input-bg border border-cc-border rounded px-2 py-1.5 text-cc-fg placeholder:text-cc-muted/40 font-mono focus:outline-none focus:border-cc-primary"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Args (space-separated, optional)"}),l.jsx("input",{type:"text",value:f,onChange:_=>p(_.target.value),placeholder:"--port 3000",className:"w-full text-[12px] bg-cc-input-bg border border-cc-border rounded px-2 py-1.5 text-cc-fg placeholder:text-cc-muted/40 font-mono focus:outline-none focus:border-cc-primary"})]})]}),(a==="sse"||a==="http")&&l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"URL"}),l.jsx("input",{type:"text",value:m,onChange:_=>x(_.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 mO({sessionId:e}){const t=G(d=>d.mcpServers.get(e)||cO),n=G(d=>d.cliConnected.get(e)??!1),[r,a]=k.useState(!1),o=G(d=>{var f;return((f=d.sessions.get(e))==null?void 0:f.mcp_servers)??uO});k.useEffect(()=>{n&&Cy(e)},[e,n]);const u=t.length>0?t:o.map(d=>({name:d.name,status:d.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(!r),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:()=>Cy(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"})]})})]})]}),r&&l.jsx("div",{className:"px-3 py-2",children:l.jsx(pO,{sessionId:e,onDone:()=>a(!1)})}),u.length>0&&l.jsx("div",{className:"px-3 py-2 space-y-1.5",children:u.map(d=>l.jsx(fO,{server:d,sessionId:e},d.name))}),!r&&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 gO({cwd:e,open:t,onClose:n}){var q;const[r,a]=k.useState([]),[o,u]=k.useState(!0),[d,f]=k.useState(0),[p,m]=k.useState(""),[x,b]=k.useState(!1),[y,_]=k.useState(!1),[j,N]=k.useState(null),[w,E]=k.useState(null),C=k.useCallback(()=>{u(!0),N(null),je.getClaudeMdFiles(e).then(M=>{a(M.files),M.files.length>0&&(f(0),m(M.files[0].content)),E(null),b(!1),u(!1)}).catch(M=>{N(M.message),u(!1)})},[e]);k.useEffect(()=>{t&&C()},[t,C]);const T=M=>{x&&!confirm("Discard unsaved changes?")||(f(M),m(r[M].content),b(!1),E(null))},O=async()=>{var ie;const M=w||((ie=r[d])==null?void 0:ie.path);if(M){_(!0),N(null);try{await je.saveClaudeMd(M,p),b(!1),w?C():a(X=>X.map((Y,P)=>P===d?{...Y,content:p}:Y))}catch(X){N(X instanceof Error?X.message:"Failed to save")}finally{_(!1)}}},z=M=>{const ie=M==="root"?`${e}/CLAUDE.md`:`${e}/.claude/CLAUDE.md`;E(ie),m(`# CLAUDE.md
|
|
120
|
+
|
|
121
|
+
`),b(!0)},I=()=>{x&&!confirm("Discard unsaved changes?")||n()};if(!t)return null;const U=M=>M.startsWith(e+"/")?M.slice(e.length+1):M,Z=r.some(M=>M.path===`${e}/CLAUDE.md`),L=r.some(M=>M.path===`${e}/.claude/CLAUDE.md`);return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fixed inset-0 bg-black/40 z-50",onClick:I}),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:I,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:[r.map((M,ie)=>l.jsxs("button",{onClick:()=>T(ie),className:`flex items-center gap-2 w-full px-3 py-2 text-left text-[12px] transition-colors cursor-pointer ${!w&&d===ie?"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:U(M.path)})]},M.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:U(w)})]})]}),(!Z||!L)&&!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"}),!Z&&l.jsxs("button",{onClick:()=>z("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"})]}),!L&&l.jsxs("button",{onClick:()=>z("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:[r.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:()=>z("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:()=>z("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:U(w||(((q=r[d])==null?void 0:q.path)??""))}),l.jsxs("div",{className:"flex items-center gap-2",children:[x&&l.jsx("span",{className:"text-[10px] text-cc-warning font-medium",children:"Unsaved"}),l.jsx("button",{onClick:O,disabled:!x||y,className:`px-3 py-1 text-[11px] font-medium rounded-md transition-colors cursor-pointer ${x&&!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:p,onChange:M=>{m(M.target.value),b(!0)},spellCheck:!1,className:"flex-1 w-full p-4 bg-cc-bg text-cc-fg text-[13px] font-mono-code leading-relaxed resize-none focus:outline-none",placeholder:"Write your project instructions here..."})]}),j&&l.jsx("div",{className:"shrink-0 px-4 py-2 bg-cc-error/10 border-t border-cc-error/20 text-xs text-cc-error",children:j})]})]})})]})]})}function aw({icon:e,title:t,expanded:n,onToggle:r}){return l.jsxs("button",{onClick:r,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 Qs({label:e,sublabel:t,count:n,onClick:r}){return l.jsxs("button",{onClick:r,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 xO({path:e,content:t,onClose:n}){let r;try{r=JSON.stringify(JSON.parse(t),null,2)}catch{r=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:r})}),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 vO({path:e,label:t,onClose:n}){const[r,a]=k.useState(""),[o,u]=k.useState(!0),[d,f]=k.useState(!1),[p,m]=k.useState(!1),[x,b]=k.useState(null);k.useEffect(()=>{je.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()=>{m(!0),b(null);try{await je.writeFile(e,r),f(!1)}catch(j){b(j instanceof Error?j.message:"Failed to save")}finally{m(!1)}},_=()=>{d&&!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:[d&&l.jsx("span",{className:"text-[10px] text-cc-warning font-medium",children:"Unsaved"}),l.jsx("button",{onClick:y,disabled:!d||p,className:`px-3 py-1 text-[11px] font-medium rounded-md transition-colors cursor-pointer ${d&&!p?"bg-cc-primary text-white hover:bg-cc-primary/90":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:p?"Saving...":"Save"})]})]}),l.jsx("textarea",{value:r,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..."})]}),x&&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:x})]})]})}function bO({item:e,cwd:t,onClose:n}){if(e.kind==="json"){const[r,a]=k.useState(null),[o,u]=k.useState(!0);return k.useEffect(()=>{je.readFile(e.path).then(d=>{a(d.content),u(!1)}).catch(()=>{a("Failed to read file"),u(!1)})},[e.path]),o?null:l.jsx(xO,{path:e.path,content:r||"",onClose:n})}return e.kind==="claude-md"?l.jsx(gO,{cwd:e.editorCwd||t,open:!0,onClose:n}):l.jsx(vO,{path:e.path,label:e.label,onClose:n})}function yO({sessionId:e}){const t=G(w=>w.sessions.get(e)),n=G(w=>w.sdkSessions.find(E=>E.sessionId===e)),r=(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,d]=k.useState(!0),[f,p]=k.useState(!1),[m,x]=k.useState(!1),[b,y]=k.useState(null),_=k.useCallback(async()=>{if(r)try{const w=await je.getClaudeConfig(r);o(w)}catch{}finally{d(!1)}},[r]);if(k.useEffect(()=>{_()},[_]),!r)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(aw,{icon:"project",title:`Project (${j})`,expanded:f,onToggle:()=>p(w=>!w)}),f&&l.jsxs("div",{className:"pb-1",children:[a.project.claudeMd.map(w=>l.jsx(Qs,{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(Qs,{label:"settings.json",onClick:()=>y({label:"settings.json",path:a.project.settings.path,kind:"json"})}),a.project.settingsLocal&&l.jsx(Qs,{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(Qs,{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(aw,{icon:"user",title:`User (${N})`,expanded:m,onToggle:()=>x(w=>!w)}),m&&l.jsxs("div",{className:"pb-1",children:[a.user.claudeMd&&l.jsx(Qs,{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(Qs,{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(Qs,{label:w.name,onClick:()=>y({label:w.name,path:w.path,kind:"md"})},w.path))]}),a.user.settings&&l.jsx(Qs,{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(Qs,{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&&lo.createPortal(l.jsx(bO,{item:b,cwd:r,onClose:()=>y(null)}),document.body)]})}function _O(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 r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}class wO extends k.Component{constructor(){super(...arguments);Wb(this,"state",{hasError:!1})}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(n){Xi(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 QS=[],yv=3e4,kO=6e4,SO=5*6e4;let lw=null,ow=new Map;function jO(e){return e!==lw&&(lw=e,ow=new Map(e.map(t=>[t.sessionId,t]))),ow}function ou(e){return G(k.useCallback(t=>jO(t.sdkSessions).get(e),[e]))}const XS="cc-panel-collapsed";function cw(){try{const e=localStorage.getItem(XS);if(e)return new Set(JSON.parse(e))}catch{}return new Set}function NO(e){try{localStorage.setItem(XS,JSON.stringify([...e]))}catch{}}function KS({id:e,label:t,badge:n,defaultOpen:r=!0,children:a}){const[o,u]=k.useState(()=>cw().has(e)?!0:!r),d=k.useRef(!0);k.useEffect(()=>{if(d.current){d.current=!1;return}const p=cw();o?p.add(e):p.delete(e),NO(p)},[o,e]);const f=k.useCallback(()=>{u(p=>!p)},[]);return l.jsxs("div",{className:"border-t border-cc-separator first:border-t-0",children:[l.jsxs("button",{onClick:f,"aria-expanded":!o,className:"w-full flex items-center gap-1.5 px-4 py-2 text-left hover:bg-cc-hover/50 transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":!0,className:`w-2.5 h-2.5 text-cc-muted/60 shrink-0 transition-transform duration-150 ${o?"":"rotate-90"}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx("span",{className:"text-[11px] font-semibold text-cc-muted uppercase tracking-wider flex-1 truncate",children:t}),n&&l.jsx("span",{className:"shrink-0",children:n})]}),l.jsx("div",{className:"accordion-panel","data-open":o?"false":"true",children:l.jsx("div",{className:"accordion-inner",children:a})})]})}function CO(){const[e,t]=k.useState(()=>localStorage.getItem("cc-user-name")||""),[n,r]=k.useState(()=>localStorage.getItem("cc-session-prefix")||"");return l.jsx(KS,{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;r(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 ZS(e){return e>80?"bg-cc-error":e>50?"bg-cc-warning":"bg-cc-primary"}function JS(e){return e>80?"critical":e>50?"elevated":"normal"}function ai({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 — ${JS(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 ${ZS(t)}`,style:{width:`${Math.min(t,100)}%`}})})]})}function EO({sessionId:e}){var f;const[t,n]=k.useState(null),r=k.useCallback(async()=>{try{const p=await je.getSessionUsageLimits(e);n(p)}catch{}},[e]),a=k.useRef(0);if(k.useEffect(()=>{r();const p=setInterval(()=>{a.current+=1,a.current%2===0?r():n(m=>m?{...m}:null)},yv);return()=>clearInterval(p)},[r]),!t)return null;const o=t.five_hour!==null,u=t.seven_day!==null,d=!o&&!u&&((f=t.extra_usage)==null?void 0:f.is_enabled);return!o&&!u&&!d?null:l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2",children:[t.five_hour&&l.jsx(ai,{label:"5h Limit",pct:t.five_hour.utilization,detail:t.five_hour.resets_at?G5(t.five_hour.resets_at):void 0}),t.seven_day&&l.jsx(ai,{label:"7d Limit",pct:t.seven_day.utilization,detail:t.seven_day.resets_at?G5(t.seven_day.resets_at):void 0}),d&&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 — ${JS(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 ${ZS(t.extra_usage.utilization)}`,style:{width:`${Math.min(t.extra_usage.utilization,100)}%`}})})]})]})}function Xd(e){const t=e/1073741824;return t>=1?`${t.toFixed(1)} GB`:`${Math.round(e/1024**2)} MB`}function AO(e){const[t,n]=k.useState(null);return k.useEffect(()=>{let r=!1;const a=async()=>{try{const u=await je.getSystemMemory();r||n(u)}catch{}};a();const o=setInterval(a,kO);return()=>{r=!0,clearInterval(o)}},[]),t?l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2",children:[l.jsx(ai,{label:"Memory",pct:t.used_percent,detail:`${Xd(t.used_bytes)} / ${Xd(t.total_bytes)}`}),t.swap_total_bytes>0&&l.jsx(ai,{label:"Swap",pct:t.swap_used_percent,detail:`${Xd(t.swap_used_bytes)} / ${Xd(t.swap_total_bytes)}`})]}):null}function TO(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 MO(e){const[t,n]=k.useState(null);return k.useEffect(()=>{let r=!1;const a=async()=>{try{const u=await je.getSystemDisk();r||n(u)}catch{}};a();const o=setInterval(a,SO);return()=>{r=!0,clearInterval(o)}},[]),t?l.jsx("div",{className:"shrink-0 px-4 py-2.5",children:l.jsx(ai,{label:"Disk",pct:t.used_percent,detail:`${TO(t.available_bytes)} free`})}):null}function RO({sessionId:e}){const t=G(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),yv);return()=>clearInterval(o)},[t]),!t)return null;const{primary:r,secondary:a}=t;return!r&&!a?null:l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2",children:[r&&l.jsx(ai,{label:`${Y5(r.windowDurationMins)} Limit`,pct:r.usedPercent,detail:r.resetsAt>0?kx(r.resetsAt):void 0}),a&&l.jsx(ai,{label:`${Y5(a.windowDurationMins)} Limit`,pct:a.usedPercent,detail:a.resetsAt>0?kx(a.resetsAt):void 0})]})}function DO({sessionId:e}){const t=G(r=>{var a;return(a=r.sessions.get(e))==null?void 0:a.codex_token_details}),n=G(r=>{var a;return((a=r.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:Ec(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:Ec(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:Ec(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:Ec(t.reasoningOutputTokens)})]})]}),t.modelContextWindow>0&&l.jsx(ai,{label:"Context",pct:n})]}):null}function LO(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 OO({pr:e}){const t=LO(e.state,e.isDraft),{checksSummary:n,reviewThreads:r}=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"]}),r.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"})}),r.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 zO({sessionId:e}){const t=G(u=>u.sessions.get(e)),n=ou(e),r=G(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(()=>{r||!a||!o||je.getPRStatus(a,o).then(u=>{G.getState().setPRStatus(e,u)}).catch(()=>{})},[e,a,o,r]),!(r!=null&&r.available)||!r.pr?null:l.jsx(OO,{pr:r.pr})}const BO=6e4;function dg(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 PO({sessionId:e}){const t=G(M=>M.linkedLinearIssues.get(e)),[n,r]=k.useState([]),[a,o]=k.useState(null),[u,d]=k.useState([]),[f,p]=k.useState(""),[m,x]=k.useState(!1),[b,y]=k.useState(!1),[_,j]=k.useState(!1),[N,w]=k.useState(""),[E,C]=k.useState([]),[T,O]=k.useState(!1),z=k.useRef(null);k.useEffect(()=>{je.getLinkedLinearIssue(e).then(M=>{M.issue&&G.getState().setLinkedLinearIssue(e,M.issue)}).catch(()=>{})},[e]);const I=k.useCallback(async()=>{if(t)try{const M=await je.getLinkedLinearIssue(e,!0);M.issue&&(G.getState().setLinkedLinearIssue(e,M.issue),M.issue.stateType==="completed"&&y(!0)),M.comments&&r(M.comments),M.assignee!==void 0&&o(M.assignee??null),M.labels&&d(M.labels)}catch{}},[e,t]);k.useEffect(()=>{if(!t)return;I();const M=setInterval(I,BO);return()=>clearInterval(M)},[I,t]),k.useEffect(()=>{if(!_)return;const M=N.trim();if(M.length<2){C([]);return}let ie=!0;O(!0);const X=setTimeout(()=>{je.searchLinearIssues(M,6).then(Y=>{ie&&C(Y.issues)}).catch(()=>{ie&&C([])}).finally(()=>{ie&&O(!1)})},400);return()=>{ie=!1,clearTimeout(X)}},[N,_]),k.useEffect(()=>{_&&setTimeout(()=>{var M;return(M=z.current)==null?void 0:M.focus()},50)},[_]);async function U(){if(!(!t||!f.trim()||m)){x(!0);try{const M=await je.addLinearComment(t.id,f.trim());r(ie=>[...ie,M.comment]),p("")}catch{}finally{x(!1)}}}async function Z(){try{await je.unlinkLinearIssue(e),G.getState().setLinkedLinearIssue(e,null),r([]),o(null),d([]),y(!1)}catch{}}async function L(M){try{await je.linkLinearIssue(e,M),G.getState().setLinkedLinearIssue(e,M),j(!1),w(""),C([])}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(Uc,{className:"w-3.5 h-3.5 text-cc-muted shrink-0"}),l.jsx("input",{ref:z,type:"text",value:N,onChange:M=>w(M.target.value),placeholder:"Search issues...","aria-label":"Search Linear issues",className:"flex-1 text-[11px] bg-transparent border border-cc-border rounded-md px-2 py-1.5 text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/50"}),l.jsx("button",{onClick:()=>{j(!1),w(""),C([])},"aria-label":"Close search",className:"w-7 h-7 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children: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"})})})]}),T&&l.jsx("p",{className:"text-[10px] text-cc-muted",children:"Searching..."}),E.length>0&&l.jsx("div",{className:"space-y-0.5 max-h-48 overflow-y-auto",children:E.map(M=>l.jsxs("button",{onClick:()=>L(M),className:"w-full text-left px-2 py-1.5 rounded-md hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx("span",{className:"text-[11px] font-mono-code text-cc-primary shrink-0",children:M.identifier}),l.jsx("span",{className:`text-[9px] font-medium px-1 rounded-full leading-[14px] ${dg(M.stateType,M.stateName).cls}`,children:dg(M.stateType,M.stateName).label})]}),l.jsx("p",{className:"text-[11px] text-cc-muted truncate mt-0.5",children:M.title})]},M.id))}),N.trim().length>=2&&!T&&E.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(Uc,{className:"w-3.5 h-3.5"}),"Link Linear issue"]})});const q=dg(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(Uc,{className:"w-3.5 h-3.5 text-cc-muted shrink-0"}),l.jsx("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:"text-[12px] font-semibold text-cc-fg hover:text-cc-primary transition-colors font-mono-code",children:t.identifier}),l.jsx("span",{className:`text-[9px] font-medium px-1.5 rounded-full leading-[16px] ${q.cls}`,children:q.label}),l.jsx("button",{onClick:Z,className:"ml-auto flex items-center justify-center w-7 h-7 rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:"Unlink issue","aria-label":"Unlink issue",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})})]}),l.jsx("p",{className:"text-[11px] text-cc-muted truncate",title:t.title,children:t.title}),l.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-cc-muted",children:[t.priorityLabel&&l.jsx("span",{children:t.priorityLabel}),t.teamName&&l.jsxs(l.Fragment,{children:[t.priorityLabel&&l.jsx("span",{children:"·"}),l.jsx("span",{children:t.teamName})]}),a&&l.jsxs(l.Fragment,{children:[l.jsx("span",{children:"·"}),l.jsxs("span",{children:["@ ",a.name]})]})]}),u.length>0&&l.jsx("div",{className:"flex flex-wrap gap-1",children:u.map(M=>l.jsx("span",{className:"text-[9px] px-1.5 py-0.5 rounded-full",style:{backgroundColor:`${M.color}20`,color:M.color},children:M.name},M.id))})]}),b&&t.stateType==="completed"&&l.jsxs("div",{className:"px-4 py-2 bg-cc-success/10 border-t border-cc-success/20 flex items-center justify-between gap-2",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("p",{className:"text-[11px] text-cc-success font-medium",children:"Issue completed"}),l.jsx("p",{className:"text-[10px] text-cc-success/80",children:"Ticket moved to done."})]}),l.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[l.jsx("button",{onClick:()=>y(!1),className:"text-[10px] text-cc-muted hover:text-cc-fg px-1.5 py-0.5 rounded cursor-pointer",children:"Dismiss"}),l.jsx("button",{onClick:async()=>{try{await je.archiveSession(e),G.getState().newSession()}catch{}},className:"text-[10px] text-cc-success font-medium px-2 py-0.5 rounded bg-cc-success/20 hover:bg-cc-success/30 cursor-pointer",children:"Close session"})]})]}),n.length>0&&l.jsxs("div",{className:"px-4 py-2 space-y-1.5 max-h-36 overflow-y-auto",children:[l.jsx("span",{className:"text-[10px] text-cc-muted uppercase tracking-wider",children:"Comments"}),n.slice(-3).map(M=>l.jsxs("div",{className:"text-[11px]",children:[l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("span",{className:"font-medium text-cc-fg",children:M.userName}),l.jsx("span",{className:"text-[9px] text-cc-muted",children:_O(new Date(M.createdAt).getTime())})]}),l.jsx("p",{className:"text-cc-muted line-clamp-2",children:M.body})]},M.id))]}),l.jsxs("div",{className:"px-4 py-2 flex items-center gap-1.5",children:[l.jsx("input",{type:"text",value:f,onChange:M=>p(M.target.value),onKeyDown:M=>{M.key==="Enter"&&!M.shiftKey&&(M.preventDefault(),U())},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:U,disabled:!f.trim()||m,"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 $O({sessionId:e}){const t=G(u=>u.rateLimit.get(e)),[,n]=k.useState(0);if(k.useEffect(()=>{if(!t)return;const u=setInterval(()=>n(d=>d+1),yv);return()=>clearInterval(u)},[t]),!(t!=null&&t.status)||t.status==="allowed")return null;const r=t.status==="rejected",a=typeof t.utilization=="number"?t.utilization*100:void 0,o=typeof t.resetsAt=="number"&&t.resetsAt>0?kx(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(ai,{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 ${r?"text-cc-error":"text-cc-warning"}`,children:[r?"rate limited":t.status,o&&` · resets ${o}`]})]}),r&&l.jsxs("p",{className:"text-[11px] text-cc-error",children:["The API is refusing requests for this plan window",o?` — resets in ${o}.`:"."]})]})}function FO({sessionId:e}){const t=G(a=>a.sessions.get(e)),n=ou(e);return((t==null?void 0:t.backend_type)||(n==null?void 0:n.backendType))==="codex"?l.jsxs(l.Fragment,{children:[l.jsx(RO,{sessionId:e}),l.jsx(DO,{sessionId:e})]}):l.jsxs(l.Fragment,{children:[l.jsx($O,{sessionId:e}),l.jsx(EO,{sessionId:e})]})}function UO({sessionId:e}){const t=G(p=>p.sessions.get(e)),n=ou(e),r=(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,d=(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 r?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:r,children:r}),(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||d>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"})]}),d>0&&l.jsxs("span",{className:"text-cc-error",children:["-",d,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:()=>{je.gitPull(f).then(p=>{G.getState().updateSession(e,{git_ahead:p.git_ahead,git_behind:p.git_behind}),p.success||Xi(new Error(`git pull failed: ${p.output}`))}).catch(p=>Xi(p))},title:"Pull latest changes",children:"Pull"})]})]}):null}function IO({sessionId:e}){const t=G(o=>o.sessionTasks.get(e)||QS),n=G(o=>o.sessions.get(e)),r=ou(e),a=((n==null?void 0:n.backend_type)||(r==null?void 0:r.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(WO,{task:o},o.id))})})}const HO={"usage-limits":FO,"server-memory":AO,"server-disk":MO,"git-branch":UO,"github-pr":zO,"linear-issue":PO,"mcp-servers":mO,tasks:IO};function qO(e,t){const n=G(r=>r.sessionTasks.get(t)||QS);if(e==="tasks"&&n.length>0){const r=n.filter(a=>a.status==="completed").length;return l.jsxs("span",{className:"text-[10px] text-cc-muted tabular-nums",children:[r,"/",n.length]})}return null}function VO({isCodex:e}){const t=G(p=>p.taskPanelConfig),n=G(p=>p.toggleSectionEnabled),r=G(p=>p.moveSectionUp),a=G(p=>p.moveSectionDown),o=G(p=>p.resetTaskPanelConfig),u=G(p=>p.setTaskPanelConfigMode),d=e?"codex":"claude",f=t.order.filter(p=>{const m=ii.find(x=>x.id===p);return!(!m||m.backends&&!m.backends.includes(d))});return l.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[l.jsx("div",{className:"flex-1 overflow-y-auto px-3 py-3 space-y-1",children:f.map((p,m)=>{const x=ii.find(j=>j.id===p),b=t.enabled[p]??!0,y=m===0,_=m===f.length-1;return l.jsxs("div",{"data-testid":`config-section-${p}`,className:`flex items-center gap-2 px-2.5 py-2 rounded-lg border border-cc-border transition-opacity ${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:()=>r(p),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-${p}`,children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M8 4l4 4H4l4-4z"})})}),l.jsx("button",{onClick:()=>a(p),disabled:_,className:"w-5 h-4 flex items-center justify-center text-cc-muted hover:text-cc-fg disabled:opacity-20 disabled:cursor-not-allowed cursor-pointer transition-colors",title:"Move down","data-testid":`move-down-${p}`,children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M8 12l4-4H4l4 4z"})})})]}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("span",{className:"text-[12px] font-medium text-cc-fg block",children:x.label}),l.jsx("span",{className:"text-[10px] text-cc-muted block truncate",children:x.description})]}),l.jsx("button",{onClick:()=>n(p),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-${p}`,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]"}`})})]},p)})}),l.jsxs("div",{className:"shrink-0 px-3 py-2.5 flex items-center justify-between border-t border-cc-separator",children:[l.jsx("button",{onClick:()=>o(),className:"text-[11px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer","data-testid":"reset-panel-config",children:"Reset to defaults"}),l.jsx("button",{onClick:()=>u(!1),className:"text-[11px] font-medium text-cc-primary hover:text-cc-primary-hover transition-colors cursor-pointer","data-testid":"config-done",children:"Done"})]})]})}function GO({sectionId:e,sessionId:t,children:n}){var o;const r=((o=ii.find(u=>u.id===e))==null?void 0:o.label)??e,a=qO(e,t);return l.jsx(KS,{id:e,label:r,badge:a,children:n})}function YO({sessionId:e}){const t=G(m=>m.sessions.get(e)),n=ou(e),r=G(m=>m.taskPanelOpen),a=G(m=>m.setTaskPanelOpen),o=G(m=>m.taskPanelConfigMode),u=G(m=>m.taskPanelConfig);if(!r)return null;const d=((t==null?void 0:t.backend_type)||(n==null?void 0:n.backendType))==="codex",f=d?"codex":"claude",p=u.order.filter(m=>{const x=ii.find(b=>b.id===m);return!(!x||x.backends&&!x.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?G.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(VO,{isCodex:d}):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(CO,{}),l.jsx(yO,{sessionId:e}),p.filter(m=>u.enabled[m]!==!1).map(m=>{var b;const x=HO[m];return x?l.jsx(GO,{sectionId:m,sessionId:e,children:l.jsx(wO,{label:(b=ii.find(y=>y.id===m))==null?void 0:b.label,children:l.jsx(x,{sessionId:e})})},m):null})]}),l.jsx("div",{className:"shrink-0 px-4 py-2 pb-safe border-t border-cc-separator",children:l.jsxs("button",{onClick:()=>G.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 WO({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(r=>`#${r}`).join(", ")]})]})]})}function QO({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 XO({sessionId:e}){const t=G(O=>O.sessions.get(e)),n=G(O=>O.sdkSessions.find(z=>z.sessionId===e)),r=G(O=>O.diffPanelSelectedFile.get(e)??null),a=G(O=>O.setDiffPanelSelectedFile),o=G(O=>O.diffBase),u=G(O=>O.setDiffBase),d=G(O=>O.changedFilesTick.get(e)??0),f=(t==null?void 0:t.cwd)||(n==null?void 0:n.cwd),[p,m]=k.useState(""),[x,b]=k.useState(!1),[y,_]=k.useState(()=>typeof window<"u"?window.innerWidth>=640:!0),[j,N]=k.useState([]),w=G(O=>O.setGitChangedFilesCount);k.useEffect(()=>{if(!f)return;let O=!1;return je.getChangedFiles(f,o).then(({files:z})=>{if(O)return;const I=`${f}/`,U=z.filter(Z=>Z.path===f||Z.path.startsWith(I)).map(Z=>({abs:Z.path,rel:Z.path.startsWith(I)?Z.path.slice(I.length):Z.path,status:Z.status==="A"||Z.status==="?"?"created":Z.status==="D"?"deleted":"updated"})).sort((Z,L)=>Z.rel.localeCompare(L.rel));N(U),w(e,U.length)}).catch(()=>{O||(N([]),w(e,0))}),()=>{O=!0}},[f,o,d,e,w]);const E=j;k.useEffect(()=>{!r&&E.length>0&&a(e,E[0].abs)},[r,E,e,a]),k.useEffect(()=>{var O;r&&(E.some(z=>z.abs===r)||a(e,((O=E[0])==null?void 0:O.abs)??null))},[r,E,e,a]),k.useEffect(()=>{if(!r){m("");return}let O=!1;return b(!0),je.getFileDiff(r,o).then(z=>{O||(m(z.diff),b(!1))}).catch(()=>{O||(m(""),b(!1))}),()=>{O=!0}},[r,o]);const C=k.useCallback(O=>{a(e,O),typeof window<"u"&&window.innerWidth<640&&_(!1)},[e,a]),T=k.useMemo(()=>!r||!f?r:r.startsWith(f+"/")?r.slice(f.length+1):r,[r,f]);return f?E.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:`
|
|
122
|
+
${y?"w-[220px] translate-x-0":"w-0 -translate-x-full"}
|
|
123
|
+
fixed sm:relative z-30 sm:z-auto
|
|
124
|
+
${y?"sm:w-[220px]":"sm:w-0 sm:-translate-x-full"}
|
|
125
|
+
shrink-0 h-full flex flex-col bg-cc-sidebar border-r border-cc-border transition-all duration-200 overflow-hidden
|
|
126
|
+
`,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 (",E.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:E.map(({abs:O,rel:z,status:I})=>l.jsxs("button",{onClick:()=>C(O),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 ${O===r?"bg-cc-active text-cc-fg":"text-cc-fg/70"}`,style:{width:"calc(100% - 8px)"},children:[l.jsx(QO,{status:I}),l.jsx("span",{className:"truncate leading-snug",children:z})]},O))})]}),l.jsxs("div",{className:"flex-1 min-w-0 h-full flex flex-col",children:[r&&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:T==null?void 0:T.split("/").pop()}),l.jsx("span",{className:"text-cc-muted truncate text-[11px] hidden sm:block font-mono-code",children:T})]}),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:x?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"})}):r?l.jsx("div",{className:"p-4",children:l.jsx(ao,{unifiedDiff:p,fileName:T||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 KO(){const e=G(f=>f.updateInfo),t=G(f=>f.updateDismissedVersion),n=G(f=>f.dismissUpdate),[r,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 je.triggerUpdate(),G.getState().setUpdateOverlayActive(!0)}catch(f){localStorage.removeItem("companion_docker_prompt_pending"),Xi(f),a(!1)}},u=()=>{n(e.latestVersion)},d=r||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:d,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:d?"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 ZO({steps:e,error:t,backend:n,onCancel:r}){const a=n==="codex"?"/logo-codex.svg":"/logo.svg",o=e.some(x=>x.status==="in_progress"),u=e.length>0&&e.every(x=>x.status==="done"),d=e.some(x=>x.status==="error")||!!t,f=[...e].reverse().find(x=>x.status==="in_progress"),p=[...e].reverse().find(x=>x.status==="done"),m=d?"Something went wrong":u?"Launching session...":(f==null?void 0:f.label)||(p==null?void 0:p.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:[o&&!d&&l.jsx("div",{className:"absolute inset-0 -m-4 rounded-full bg-cc-primary/10 animate-pulse"}),l.jsx("img",{src:a,alt:"Launching",className:`w-20 h-20 relative z-10 transition-transform duration-500 ${o&&!d?"scale-110":""} ${d?"opacity-40 grayscale":""}`}),o&&!d&&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"})})}),u&&!d&&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 ${d?"text-cc-error":"text-cc-fg"}`,children:m}),l.jsx("div",{className:"w-full max-w-xs space-y-2 px-4",children:e.map((x,b)=>l.jsxs("div",{className:"flex items-center gap-3 transition-all duration-300",style:{animationDelay:`${b*60}ms`},children:[l.jsxs("div",{className:"w-5 h-5 flex items-center justify-center shrink-0",children:[x.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"}),x.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"})})}),x.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 ${x.status==="in_progress"?"text-cc-fg font-medium":x.status==="done"?"text-cc-muted":"text-cc-error font-medium"}`,children:x.label}),x.detail&&x.status==="in_progress"&&l.jsx("span",{className:"text-[10px] text-cc-muted truncate ml-auto max-w-[120px]",children:x.detail})]},x.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})})}),(d||o)&&r&&l.jsx("button",{onClick:r,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:d?"Dismiss":"Cancel"}),!d&&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(x=>x.status==="done").length/Math.max(e.length,1)*100)}%`}})})]})}function JO(){const e=localStorage.getItem("companion_auth_token");return e?{Authorization:`Bearer ${e}`}:{}}const ez={installing:"Installing update...",restarting:"Restarting server...",waiting:"Waiting for server...",ready:"Update complete!"};function tz(e){const[t,n]=k.useState("installing"),r=k.useRef(null),a=k.useRef(!0);return k.useEffect(()=>(a.current=!0,()=>{a.current=!1,r.current&&clearTimeout(r.current)}),[]),k.useEffect(()=>{if(!e)return;const o=setTimeout(()=>{a.current&&n("restarting")},3e3),u=setTimeout(()=>{a.current&&n("waiting"),d()},5e3);function d(){a.current&&fetch("/api/update-check",{signal:AbortSignal.timeout(3e3),headers:JO()}).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(()=>{r.current=setTimeout(d,1500)})}return()=>{clearTimeout(o),clearTimeout(u),r.current&&clearTimeout(r.current)}},[e]),t}function ej({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:ez[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(r=>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:`${r*.2}s`}},r))}),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 nz({active:e}){const t=tz(e);return e?l.jsx(ej,{phase:t,className:"fixed inset-0 z-[100]"}):null}function zz({phase:e}){return l.jsx(ej,{phase:e,className:"absolute inset-0"})}function rz(){const e=G(j=>j.dockerUpdateDialogOpen),t=G(j=>j.setDockerUpdateDialogOpen),[n,r]=k.useState("prompt"),[a,o]=k.useState(!1),[u,d]=k.useState(null),f=k.useRef(null);if(k.useEffect(()=>{e&&je.getSettings().then(j=>{o(j.dockerAutoUpdate),j.dockerAutoUpdate&&p()}).catch(()=>{})},[e]),k.useEffect(()=>{if(n!=="pulling"){f.current&&(clearInterval(f.current),f.current=null);return}return f.current=setInterval(()=>{je.getImageStatus("the-companion:latest").then(j=>{d(j),j.status==="ready"?r("done"):j.status==="error"&&r("error")}).catch(()=>{})},2e3),()=>{f.current&&(clearInterval(f.current),f.current=null)}},[n]),!e)return null;function p(){r("pulling"),je.pullImage("the-companion:latest").then(j=>{j.state&&d(j.state)}).catch(()=>{r(j=>j==="pulling"?"error":j)})}function m(){p()}function x(){y()}function b(){y()}function y(){r("prompt"),d(null),t(!1)}async function _(){const j=!a;o(j);try{await je.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:x,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:m,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(`
|
|
127
|
+
`)})]}),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(`
|
|
128
|
+
`)}),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:m,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 Bz({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...
|
|
129
|
+
Layer 1/5: abc123 downloading
|
|
130
|
+
Layer 2/5: def456 complete`})]}),e==="done"&&l.jsxs("div",{className:"p-5",children:[l.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-success",children:l.jsx("path",{fillRule:"evenodd",d:"M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm3.78-9.72a.75.75 0 0 0-1.06-1.06L7 8.94 5.28 7.22a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.06 0l4.25-4.25z"})}),l.jsx("h2",{className:"text-sm font-semibold text-cc-success",children:"Sandbox Image Updated"})]}),l.jsx("p",{className:"text-xs text-cc-muted mb-4",children:"The Docker image has been updated successfully."}),l.jsx("div",{className:"flex justify-end",children:l.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-primary text-white",children:"Done"})})]}),e==="error"&&l.jsxs("div",{className:"p-5",children:[l.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-error",children:l.jsx("path",{fillRule:"evenodd",d:"M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zM5.22 5.22a.75.75 0 0 1 1.06 0L8 6.94l1.72-1.72a.75.75 0 1 1 1.06 1.06L9.06 8l1.72 1.72a.75.75 0 1 1-1.06 1.06L8 9.06l-1.72 1.72a.75.75 0 0 1-1.06-1.06L6.94 8 5.22 6.28a.75.75 0 0 1 0-1.06z"})}),l.jsx("h2",{className:"text-sm font-semibold text-cc-error",children:"Image Update Failed"})]}),l.jsx("p",{className:"text-xs text-cc-muted mb-4",children:"Failed to update the Docker image."}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-hover text-cc-fg",children:"Close"}),l.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-primary text-white",children:"Retry"})]})]})]})})}const sz=2e3;function iz(){const[e,t]=k.useState(null),[n,r]=k.useState({state:"idle"}),[a,o]=k.useState(!1),[u,d]=k.useState(""),[f,p]=k.useState(!1),m=k.useRef(null),x=k.useCallback(async()=>{try{t(await je.getCodexAccount())}catch(T){d(T instanceof Error?T.message:String(T))}},[]),b=k.useCallback(()=>{m.current&&(clearInterval(m.current),m.current=null)},[]),y=k.useCallback(()=>{b(),m.current=setInterval(async()=>{try{const T=await je.getCodexLoginStatus();r(T),T.state!=="pending"&&(b(),T.state==="success"&&x())}catch{}},sz)},[x,b]);k.useEffect(()=>(x(),je.getCodexLoginStatus().then(T=>{r(T),T.state==="pending"&&y()}).catch(()=>{}),b),[x,y,b]);const _=async()=>{o(!0),d("");try{const T=await je.startCodexLogin();r(T),T.state==="pending"?y():T.error&&d(T.error)}catch(T){d(T instanceof Error?T.message:String(T))}finally{o(!1)}},j=async()=>{o(!0),b();try{r(await je.cancelCodexLogin())}catch(T){d(T instanceof Error?T.message:String(T))}finally{o(!1)}},N=async()=>{o(!0),d("");try{const T=await je.codexLogout();!T.ok&&T.error&&d(T.error),r({state:"idle"}),await x()}catch(T){d(T instanceof Error?T.message:String(T))}finally{o(!1)}},w=async()=>{if(n.userCode)try{await navigator.clipboard.writeText(n.userCode),p(!0),setTimeout(()=>p(!1),1500)}catch{}},E=n.state==="pending",C=(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."}),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:"Codex CLI not found on this machine. Install it to sign in."}),!C&&e&&!E&&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"}),E&&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:[E?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||C,className:`px-4 py-2 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${a||C?"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)&&!E&&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 hg=["welcome","claude","codex","done"],uw='button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])';function jx(){return typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function az({onComplete:e}){const[t,n]=k.useState("welcome"),[r,a]=k.useState(""),[o,u]=k.useState(""),[d,f]=k.useState(!1),[p,m]=k.useState(""),[x,b]=k.useState(!1),[y,_]=k.useState(!1),[j,N]=k.useState(jx),w=k.useRef(null);k.useEffect(()=>{j||requestAnimationFrame(()=>N(!0))},[j]),k.useEffect(()=>{const q=w.current;if(!q)return;function M(X){if(X.key==="Escape"){X.preventDefault();return}if(X.key!=="Tab")return;const Y=q.querySelectorAll(uw);if(Y.length===0)return;const P=Y[0],$=Y[Y.length-1];X.shiftKey?document.activeElement===P&&(X.preventDefault(),$.focus()):document.activeElement===$&&(X.preventDefault(),P.focus())}document.addEventListener("keydown",M);const ie=q.querySelector(uw);return ie==null||ie.focus(),()=>document.removeEventListener("keydown",M)},[t]);const E=k.useCallback(async()=>{if(!r.trim()){n("codex");return}f(!0),m("");try{await je.updateSettings({claudeCodeOAuthToken:r.trim()}),b(!0),n("codex")}catch(q){m(q instanceof Error?q.message:"Failed to save token")}finally{f(!1)}},[r]),C=k.useCallback(async()=>{f(!0),m("");try{(await je.getSettings()).codexDeviceAuthConfigured?(_(!0),await O()):m("No Codex auth found yet. Complete the sign-in above, then check again.")}catch(q){m(q instanceof Error?q.message:"Failed to check auth status")}finally{f(!1)}},[]),T=k.useCallback(async()=>{f(!0),m("");try{await je.updateSettings({openaiApiKey:o.trim()}),_(!0),await O()}catch(q){m(q instanceof Error?q.message:"Failed to save API key")}finally{f(!1)}},[o]),O=k.useCallback(async()=>{try{await je.updateSettings({onboardingCompleted:!0})}catch{}n("done")},[]),z=k.useCallback(()=>{e()},[e]),I=k.useCallback(async()=>{await O(),e()},[O,e]),U=k.useCallback(q=>{m(""),n(q)},[]),Z=hg.indexOf(t),L=jx();return lo.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:L?"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:L?"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 ${Z+1} of ${hg.length-1}`,children:hg.slice(0,3).map((q,M)=>l.jsx("div",{className:"h-[3px] rounded-full transition-[transform,background,opacity] duration-300",style:{width:32,transform:M===Z?"scaleX(1)":"scaleX(0.375)",transformOrigin:"center",background:M<=Z?"var(--color-cc-primary)":"var(--color-cc-border)",opacity:M<=Z?1:.5}},q))}),l.jsxs("div",{className:"bg-cc-card border border-cc-border overflow-hidden",style:{borderRadius:16,boxShadow:"0 1px 3px var(--color-cc-border), 0 8px 32px var(--color-cc-border)"},children:[t==="welcome"&&l.jsx(lz,{onSetupClaude:()=>U("claude"),onSetupCodex:()=>U("codex")}),t==="claude"&&l.jsx(oz,{token:r,onTokenChange:a,onSave:E,onSkip:()=>U("codex"),saving:d,error:p}),t==="codex"&&l.jsx(cz,{apiKey:o,onApiKeyChange:u,onCheckAuth:C,onSaveApiKey:T,onSkip:()=>O(),onBack:()=>U("claude"),saving:d,error:p}),t==="done"&&l.jsx(uz,{claudeConfigured:x,codexConfigured:y,onDone:z})]}),t==="welcome"&&l.jsx("button",{onClick:I,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 lz({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 oz({token:e,onTokenChange:t,onSave:n,onSkip:r,saving:a,error:o}){const u=k.useRef(null);k.useEffect(()=>{var f;(f=u.current)==null||f.focus()},[]);const d="claude-token-error";return l.jsxs("div",{className:"p-7 pb-6",children:[l.jsxs("div",{className:"mb-5",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-cc-muted font-medium mb-2",children:"Step 1 of 2"}),l.jsx("h2",{className:"text-xl font-semibold text-cc-fg leading-tight",children:"Set up Claude Code"}),l.jsx("p",{className:"text-sm text-cc-muted mt-1.5 leading-relaxed",children:"Generate an OAuth token by running this in your terminal:"})]}),l.jsxs("div",{className:"rounded-lg overflow-hidden mb-4 border border-cc-border",style:{background:"var(--color-cc-code-bg)"},children:[l.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-cc-border",children:[l.jsxs("div",{className:"flex items-center gap-1.5","aria-hidden":"true",children:[l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-error opacity-60"}),l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-warning opacity-60"}),l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-success opacity-60"})]}),l.jsx(dz,{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?d: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:d,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:r,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 cz({apiKey:e,onApiKeyChange:t,onCheckAuth:n,onSaveApiKey:r,onSkip:a,onBack:o,saving:u,error:d}){const[f,p]=k.useState(!1),m="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(iz,{}),d&&l.jsxs("div",{id:m,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:d})]}),l.jsxs("div",{className:"mb-4",children:[l.jsxs("button",{onClick:()=>p(!f),className:"text-xs text-cc-muted hover:text-cc-fg transition-colors flex items-center gap-1",children:[l.jsx("svg",{className:"w-3 h-3 transition-transform duration-150",style:{transform:f?"rotate(90deg)":"rotate(0deg)"},fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),"Or use an API key instead"]}),l.jsx("div",{className:"accordion-panel","data-open":f?"true":"false",children:l.jsx("div",{className:"accordion-inner",children:l.jsxs("div",{className:"mt-3",children:[l.jsx("label",{htmlFor:"openai-key",className:"text-xs text-cc-muted block mb-1.5",children:"OpenAI API Key"}),l.jsx("input",{id:"openai-key",type:"password",value:e,onChange:x=>t(x.target.value),placeholder:"sk-...","aria-describedby":d?m:void 0,"aria-invalid":d?!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()?r: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 uz({claudeConfigured:e,codexConfigured:t,onDone:n}){const r=!e&&!t,a=jx(),[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:r?"var(--color-cc-hover)":"color-mix(in srgb, var(--color-cc-success) 12%, transparent)"},children:r?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:r?"Setup Skipped":"You're all set!"}),l.jsx("div",{className:"text-sm text-cc-muted leading-relaxed mb-6",children:r?"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 dz({text:e}){const[t,n]=k.useState(!1),r=k.useCallback(()=>{navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)}).catch(()=>{})},[e]);return l.jsx("button",{onClick:r,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 hz(e){return G(t=>{var n;return!e||!t.magicUiAvailable?!1:((n=t.sessions.get(e))==null?void 0:n.magicUiActive)===!0})}const fz=k.lazy(()=>Vn(()=>import("./Playground-BiEa7THU.js"),__vite__mapDeps([0,1])).then(e=>({default:e.Playground}))),pz=k.lazy(()=>Vn(()=>import("./SettingsPage-77tDzDuD.js"),[]).then(e=>({default:e.SettingsPage}))),mz=k.lazy(()=>Vn(()=>import("./IntegrationsPage-DRP477b0.js"),[]).then(e=>({default:e.IntegrationsPage}))),gz=k.lazy(()=>Vn(()=>import("./LinearSettingsPage-BwVTEKqs.js"),[]).then(e=>({default:e.LinearSettingsPage}))),xz=k.lazy(()=>Vn(()=>import("./LinearOAuthSettingsPage-CPW4TQuD.js"),[]).then(e=>({default:e.LinearOAuthSettingsPage}))),vz=k.lazy(()=>Vn(()=>import("./TailscalePage-B0TbcOPL.js"),[]).then(e=>({default:e.TailscalePage}))),bz=k.lazy(()=>Vn(()=>import("./PromptsPage-BYtZdliB.js"),[]).then(e=>({default:e.PromptsPage}))),yz=k.lazy(()=>Vn(()=>Promise.resolve().then(()=>QL),void 0).then(e=>({default:e.EnvManager}))),_z=k.lazy(()=>Vn(()=>import("./SandboxManager-C8tBjBXY.js"),[]).then(e=>({default:e.SandboxManager}))),wz=k.lazy(()=>Vn(()=>import("./CronManager-CGfXlVZS.js"),[]).then(e=>({default:e.CronManager}))),kz=k.lazy(()=>Vn(()=>import("./AgentsPage-V7NBPNSh.js"),[]).then(e=>({default:e.AgentsPage}))),Sz=k.lazy(()=>Vn(()=>import("./RunsPage-DD6KPNKm.js"),[]).then(e=>({default:e.RunsPage}))),jz=k.lazy(()=>Vn(()=>import("./DashboardPage-N7MWZiJQ.js"),[]).then(e=>({default:e.DashboardPage}))),Nz=k.lazy(()=>Vn(()=>import("./MagicUIView-AKoy6jOb.js"),__vite__mapDeps([2,1])).then(e=>({default:e.MagicUIView})));function lr(){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 Cz(){return k.useSyncExternalStore(e=>(window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)),()=>window.location.hash)}function Ez(){const e=G(ae=>ae.isAuthenticated),t=G(ae=>ae.darkMode),n=G(ae=>ae.currentSessionId),r=G(ae=>ae.sidebarOpen),a=G(ae=>ae.taskPanelOpen),o=G(ae=>ae.homeResetKey),u=G(ae=>ae.activeTab),d=hz(n),f=G(ae=>ae.sessionCreating),p=G(ae=>ae.sessionCreatingBackend),m=G(ae=>ae.creationProgress),x=G(ae=>ae.creationError),b=G(ae=>ae.updateOverlayActive),y=Cz(),_=k.useMemo(()=>Qx(y),[y]),j=_.page==="settings",N=_.page==="prompts",w=_.page==="integrations",E=_.page==="integration-linear",C=_.page==="integration-linear-oauth",T=_.page==="integration-tailscale",O=_.page==="environments",z=_.page==="sandboxes",I=_.page==="scheduled",U=_.page==="agents"||_.page==="agent-detail",Z=_.page==="runs",L=_.page==="dashboard",q=_.page==="session"||_.page==="home";k.useEffect(()=>{O6(y||"#/")},[y]),k.useEffect(()=>{document.documentElement.classList.toggle("dark",t)},[t]);const M=k.useRef(G.getState().currentSessionId);k.useEffect(()=>{if(M.current!==null&&_.page==="home"){Xx(M.current,!0),M.current=null;return}if(M.current=null,_.page==="session"){const ae=G.getState();ae.currentSessionId!==_.sessionId&&ae.setCurrentSession(_.sessionId),nu(_.sessionId)}else if(_.page==="home"){const ae=G.getState();ae.currentSessionId!==null&&ae.setCurrentSession(null)}},[_]);const ie=G(ae=>n?ae.changedFilesTick.get(n)??0:0),X=G(ae=>ae.diffBase),Y=G(ae=>ae.setGitChangedFilesCount),P=G(ae=>{var D,B;return n&&(((D=ae.sessions.get(n))==null?void 0:D.cwd)||((B=ae.sdkSessions.find(Q=>Q.sessionId===n))==null?void 0:B.cwd))||null});k.useEffect(()=>{if(!n||!P)return;let ae=!1;return je.getChangedFiles(P,X).then(({files:D})=>{if(ae)return;const B=`${P}/`,Q=D.filter(R=>R.path===P||R.path.startsWith(B)).length;Y(n,Q)}).catch(()=>{}),()=>{ae=!0}},[n,P,X,ie,Y]),k.useEffect(()=>{const ae=()=>{je.checkForUpdate().then(B=>{G.getState().setUpdateInfo(B)}).catch(()=>{})};ae();const D=setInterval(ae,300*1e3);return()=>clearInterval(D)},[]),k.useEffect(()=>{const ae=()=>{je.getClaudeCompat().then(B=>{G.getState().setClaudeCompatInfo(B)}).catch(()=>{})};ae();const D=setInterval(ae,300*1e3);return()=>clearInterval(D)},[]);const[$,re]=k.useState(!1);return k.useEffect(()=>{e&&je.getSettings().then(ae=>{ae.publicUrl&&G.getState().setPublicUrl(ae.publicUrl),G.getState().setMagicUiAvailable(!!ae.magicUiEnabled&&!!ae.claudeCliAvailable),ae.onboardingCompleted||re(!0)}).catch(()=>{})},[e]),k.useEffect(()=>{localStorage.getItem("companion_docker_prompt_pending")==="1"&&localStorage.removeItem("companion_docker_prompt_pending")},[]),e?_.page==="playground"?l.jsx(k.Suspense,{fallback:l.jsx(lr,{}),children:l.jsx(fz,{})}):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:[r&&l.jsx("div",{className:"fixed inset-0 bg-black/30 z-30 md:hidden",onClick:()=>G.getState().setSidebarOpen(!1)}),l.jsx("div",{className:`
|
|
131
|
+
fixed inset-y-0 left-0 md:relative md:inset-auto z-40 md:z-auto
|
|
132
|
+
h-full shrink-0 transition-all duration-200 pt-safe md:pt-0
|
|
133
|
+
${r?"w-full md:w-[260px] translate-x-0":"w-0 -translate-x-full md:w-0 md:-translate-x-full"}
|
|
134
|
+
overflow-hidden
|
|
135
|
+
`,children:l.jsx(eA,{})}),l.jsxs("div",{className:"flex-1 flex flex-col min-w-0 overflow-hidden",children:[l.jsx(VL,{}),l.jsx(KO,{}),l.jsxs("div",{className:"flex-1 overflow-hidden relative",children:[j&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(lr,{}),children:l.jsx(pz,{embedded:!0})})}),N&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(lr,{}),children:l.jsx(bz,{embedded:!0})})}),w&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(lr,{}),children:l.jsx(mz,{embedded:!0})})}),E&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(lr,{}),children:l.jsx(gz,{embedded:!0})})}),C&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(lr,{}),children:l.jsx(xz,{embedded:!0})})}),T&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(lr,{}),children:l.jsx(vz,{embedded:!0})})}),O&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(lr,{}),children:l.jsx(yz,{embedded:!0})})}),z&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(lr,{}),children:l.jsx(_z,{embedded:!0})})}),I&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(lr,{}),children:l.jsx(wz,{embedded:!0})})}),U&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(lr,{}),children:l.jsx(kz,{route:_})})}),Z&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(lr,{}),children:l.jsx(Sz,{})})}),L&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(lr,{}),children:l.jsx(jz,{})})}),q&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"absolute inset-0",children:n?u==="diff"?l.jsx(XO,{sessionId:n}):d?l.jsx(k.Suspense,{fallback:l.jsx(lr,{}),children:l.jsx(Nz,{sessionId:n})}):l.jsx($L,{sessionId:n}):l.jsx(oO,{},o)}),f&&m&&m.length>0&&l.jsx(ZO,{steps:m,error:x,backend:p??void 0,onCancel:()=>G.getState().clearCreation()})]})]})]}),n&&q&&l.jsxs(l.Fragment,{children:[!a&&l.jsxs("button",{type:"button",onClick:()=>G.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:()=>G.getState().setTaskPanelOpen(!1)}),l.jsx("div",{className:`
|
|
136
|
+
fixed inset-y-0 right-0 lg:relative lg:inset-auto z-40 lg:z-auto
|
|
137
|
+
h-full shrink-0 transition-all duration-200 pt-safe lg:pt-0
|
|
138
|
+
${a?"w-full lg:w-[320px] translate-x-0":"w-0 translate-x-full lg:w-0 lg:translate-x-full"}
|
|
139
|
+
overflow-hidden
|
|
140
|
+
`,children:l.jsx(YO,{sessionId:n})})]}),l.jsx(nz,{active:b}),l.jsx(rz,{}),$&&l.jsx(az,{onComplete:()=>re(!1)})]}):l.jsx(U6,{})}class Az extends k.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,n){Xi(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}}L6();oC.createRoot(document.getElementById("root")).render(l.jsx(k.StrictMode,{children:l.jsx(Az,{children:l.jsx(Ez,{})})}));Vn(()=>import("./sw-register-Cr16zatT.js"),[]).catch(()=>{});export{AL as A,gO as B,iz as C,Mz as D,ah as E,KL as F,OO as G,tu as H,lo as I,Z5 as J,FS as K,Uc as L,lL as M,uL as N,gL as O,xL as P,mL as Q,Rz as R,ZO as S,yw as T,KO as U,Oz as V,Lz as W,Vn as _,je as a,qm as b,Bn as c,pL as d,W6 as e,$L as f,D6 as g,LD as h,YL as i,l as j,ao as k,zz as l,Bz as m,Xx as n,VD as o,GD as p,FL as q,k as r,Dz as s,_O as t,G as u,RO as v,DO as w,Yi as x,Xl as y,Ic as z};
|