@hellcoder/companion 0.117.0 → 0.118.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. package/dist/assets/{AgentsPage-DJIGGU86.js → AgentsPage-DkcwIsY1.js} +1 -1
  2. package/dist/assets/{CronManager-D7aAMVgs.js → CronManager-BrGSjzJz.js} +1 -1
  3. package/dist/assets/{DashboardPage-Bporj7Vr.js → DashboardPage-B2q0O3yD.js} +1 -1
  4. package/dist/assets/{IntegrationsPage-BSY0-fsO.js → IntegrationsPage-CRfvSp68.js} +1 -1
  5. package/dist/assets/{LinearOAuthSettingsPage-Cl5dP05g.js → LinearOAuthSettingsPage-DgzYg2kb.js} +1 -1
  6. package/dist/assets/{LinearSettingsPage-dwMpnpxL.js → LinearSettingsPage-BTQJFAj4.js} +1 -1
  7. package/dist/assets/{MagicUIDashboard-Bpa4AupX.js → MagicUIDashboard-BegKqU3e.js} +1 -1
  8. package/dist/assets/{MagicUIView-BoHMBELi.js → MagicUIView-D23itGQ5.js} +1 -1
  9. package/dist/assets/{Playground-By2aXWQF.js → Playground-BJAQWThl.js} +14 -6
  10. package/dist/assets/{PromptsPage-DVv0Qn3d.js → PromptsPage-BKEK_e8P.js} +1 -1
  11. package/dist/assets/{RunsPage-bu3TZ6ai.js → RunsPage-Biakia-J.js} +1 -1
  12. package/dist/assets/{SandboxManager-CDjGbD5N.js → SandboxManager-BZfEkHsb.js} +1 -1
  13. package/dist/assets/{SettingsPage-D0v_BZTU.js → SettingsPage-BwZoML1s.js} +1 -1
  14. package/dist/assets/{TailscalePage-B8SJQpMF.js → TailscalePage-B6eauJ__.js} +1 -1
  15. package/dist/assets/index-DB85gIpd.css +1 -0
  16. package/dist/assets/index-n6Tt3UFW.js +140 -0
  17. package/dist/assets/{sw-register-CvyRJNug.js → sw-register-fN5inCkx.js} +1 -1
  18. package/dist/index.html +2 -2
  19. package/dist/sw.js +1 -1
  20. package/package.json +1 -1
  21. package/dist/assets/index-BqOdTpct.css +0 -1
  22. package/dist/assets/index-DqIZ_Ol5.js +0 -140
@@ -1,140 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Playground-By2aXWQF.js","assets/MagicUIDashboard-Bpa4AupX.js","assets/MagicUIView-BoHMBELi.js"])))=>i.map(i=>d[i]);
2
- var pN=Object.defineProperty;var mN=(e,t,n)=>t in e?pN(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var wb=(e,t,n)=>mN(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 gN="modulepreload",xN=function(e){return"/"+e},kb={},$n=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 f=document.querySelector("meta[property=csp-nonce]"),h=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));a=u(n.map(p=>{if(p=xN(p),p in kb)return;kb[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":gN,m||(b.as="script"),b.crossOrigin="",b.href=p,h&&b.setAttribute("nonce",h),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 f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=u,window.dispatchEvent(f),!f.defaultPrevented)throw u}return a.then(u=>{for(const f of u||[])f.status==="rejected"&&o(f.reason);return t().catch(o)})};function ex(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Op={exports:{}},Vo={};/**
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 Sb;function vN(){if(Sb)return Vo;Sb=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 f in a)f!=="key"&&(o[f]=a[f])}else o=a;return a=o.ref,{$$typeof:e,type:r,key:u,ref:a!==void 0?a:null,props:o}}return Vo.Fragment=t,Vo.jsx=n,Vo.jsxs=n,Vo}var jb;function bN(){return jb||(jb=1,Op.exports=vN()),Op.exports}var l=bN(),Bp={exports:{}},We={};/**
11
- * @license React
12
- * react.production.js
13
- *
14
- * Copyright (c) Meta Platforms, Inc. and affiliates.
15
- *
16
- * This source code is licensed under the MIT license found in the
17
- * LICENSE file in the root directory of this source tree.
18
- */var Nb;function yN(){if(Nb)return We;Nb=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"),f=Symbol.for("react.forward_ref"),h=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 S(B,Z,M){this.props=B,this.context=Z,this.refs=N,this.updater=M||_}S.prototype.isReactComponent={},S.prototype.setState=function(B,Z){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,Z,"setState")},S.prototype.forceUpdate=function(B){this.updater.enqueueForceUpdate(this,B,"forceUpdate")};function E(){}E.prototype=S.prototype;function C(B,Z,M){this.props=B,this.context=Z,this.refs=N,this.updater=M||_}var O=C.prototype=new E;O.constructor=C,j(O,S.prototype),O.isPureReactComponent=!0;var D=Array.isArray;function L(){}var I={H:null,A:null,T:null,S:null},F=Object.prototype.hasOwnProperty;function W(B,Z,M){var pe=M.ref;return{$$typeof:e,type:B,key:Z,ref:pe!==void 0?pe:null,props:M}}function z(B,Z){return W(B.type,Z,B.props)}function q(B){return typeof B=="object"&&B!==null&&B.$$typeof===e}function A(B){var Z={"=":"=0",":":"=2"};return"$"+B.replace(/[=:]/g,function(M){return Z[M]})}var ie=/\/+/g;function K(B,Z){return typeof B=="object"&&B!==null&&B.key!=null?A(""+B.key):Z.toString(36)}function G(B){switch(B.status){case"fulfilled":return B.value;case"rejected":throw B.reason;default:switch(typeof B.status=="string"?B.then(L,L):(B.status="pending",B.then(function(Z){B.status==="pending"&&(B.status="fulfilled",B.value=Z)},function(Z){B.status==="pending"&&(B.status="rejected",B.reason=Z)})),B.status){case"fulfilled":return B.value;case"rejected":throw B.reason}}throw B}function P(B,Z,M,pe,_e){var Ce=typeof B;(Ce==="undefined"||Ce==="boolean")&&(B=null);var De=!1;if(B===null)De=!0;else switch(Ce){case"bigint":case"string":case"number":De=!0;break;case"object":switch(B.$$typeof){case e:case t:De=!0;break;case m:return De=B._init,P(De(B._payload),Z,M,pe,_e)}}if(De)return _e=_e(B),De=pe===""?"."+K(B,0):pe,D(_e)?(M="",De!=null&&(M=De.replace(ie,"$&/")+"/"),P(_e,Z,M,"",function(Je){return Je})):_e!=null&&(q(_e)&&(_e=z(_e,M+(_e.key==null||B&&B.key===_e.key?"":(""+_e.key).replace(ie,"$&/")+"/")+De)),Z.push(_e)),1;De=0;var Ee=pe===""?".":pe+":";if(D(B))for(var Be=0;Be<B.length;Be++)pe=B[Be],Ce=Ee+K(pe,Be),De+=P(pe,Z,M,Ce,_e);else if(Be=y(B),typeof Be=="function")for(B=Be.call(B),Be=0;!(pe=B.next()).done;)pe=pe.value,Ce=Ee+K(pe,Be++),De+=P(pe,Z,M,Ce,_e);else if(Ce==="object"){if(typeof B.then=="function")return P(G(B),Z,M,pe,_e);throw Z=String(B),Error("Objects are not valid as a React child (found: "+(Z==="[object Object]"?"object with keys {"+Object.keys(B).join(", ")+"}":Z)+"). If you meant to render a collection of children, use an array instead.")}return De}function $(B,Z,M){if(B==null)return B;var pe=[],_e=0;return P(B,pe,"","",function(Ce){return Z.call(M,Ce,_e++)}),pe}function se(B){if(B._status===-1){var Z=B._result;Z=Z(),Z.then(function(M){(B._status===0||B._status===-1)&&(B._status=1,B._result=M)},function(M){(B._status===0||B._status===-1)&&(B._status=2,B._result=M)}),B._status===-1&&(B._status=0,B._result=Z)}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 Z=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(Z))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",B);return}console.error(B)},R={map:$,forEach:function(B,Z,M){$(B,function(){Z.apply(this,arguments)},M)},count:function(B){var Z=0;return $(B,function(){Z++}),Z},toArray:function(B){return $(B,function(Z){return Z})||[]},only:function(B){if(!q(B))throw Error("React.Children.only expected to receive a single React element child.");return B}};return We.Activity=x,We.Children=R,We.Component=S,We.Fragment=n,We.Profiler=a,We.PureComponent=C,We.StrictMode=r,We.Suspense=h,We.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=I,We.__COMPILER_RUNTIME={__proto__:null,c:function(B){return I.H.useMemoCache(B)}},We.cache=function(B){return function(){return B.apply(null,arguments)}},We.cacheSignal=function(){return null},We.cloneElement=function(B,Z,M){if(B==null)throw Error("The argument must be a React element, but you passed "+B+".");var pe=j({},B.props),_e=B.key;if(Z!=null)for(Ce in Z.key!==void 0&&(_e=""+Z.key),Z)!F.call(Z,Ce)||Ce==="key"||Ce==="__self"||Ce==="__source"||Ce==="ref"&&Z.ref===void 0||(pe[Ce]=Z[Ce]);var Ce=arguments.length-2;if(Ce===1)pe.children=M;else if(1<Ce){for(var De=Array(Ce),Ee=0;Ee<Ce;Ee++)De[Ee]=arguments[Ee+2];pe.children=De}return W(B.type,_e,pe)},We.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},We.createElement=function(B,Z,M){var pe,_e={},Ce=null;if(Z!=null)for(pe in Z.key!==void 0&&(Ce=""+Z.key),Z)F.call(Z,pe)&&pe!=="key"&&pe!=="__self"&&pe!=="__source"&&(_e[pe]=Z[pe]);var De=arguments.length-2;if(De===1)_e.children=M;else if(1<De){for(var Ee=Array(De),Be=0;Be<De;Be++)Ee[Be]=arguments[Be+2];_e.children=Ee}if(B&&B.defaultProps)for(pe in De=B.defaultProps,De)_e[pe]===void 0&&(_e[pe]=De[pe]);return W(B,Ce,_e)},We.createRef=function(){return{current:null}},We.forwardRef=function(B){return{$$typeof:f,render:B}},We.isValidElement=q,We.lazy=function(B){return{$$typeof:m,_payload:{_status:-1,_result:B},_init:se}},We.memo=function(B,Z){return{$$typeof:p,type:B,compare:Z===void 0?null:Z}},We.startTransition=function(B){var Z=I.T,M={};I.T=M;try{var pe=B(),_e=I.S;_e!==null&&_e(M,pe),typeof pe=="object"&&pe!==null&&typeof pe.then=="function"&&pe.then(L,ae)}catch(Ce){ae(Ce)}finally{Z!==null&&M.types!==null&&(Z.types=M.types),I.T=Z}},We.unstable_useCacheRefresh=function(){return I.H.useCacheRefresh()},We.use=function(B){return I.H.use(B)},We.useActionState=function(B,Z,M){return I.H.useActionState(B,Z,M)},We.useCallback=function(B,Z){return I.H.useCallback(B,Z)},We.useContext=function(B){return I.H.useContext(B)},We.useDebugValue=function(){},We.useDeferredValue=function(B,Z){return I.H.useDeferredValue(B,Z)},We.useEffect=function(B,Z){return I.H.useEffect(B,Z)},We.useEffectEvent=function(B){return I.H.useEffectEvent(B)},We.useId=function(){return I.H.useId()},We.useImperativeHandle=function(B,Z,M){return I.H.useImperativeHandle(B,Z,M)},We.useInsertionEffect=function(B,Z){return I.H.useInsertionEffect(B,Z)},We.useLayoutEffect=function(B,Z){return I.H.useLayoutEffect(B,Z)},We.useMemo=function(B,Z){return I.H.useMemo(B,Z)},We.useOptimistic=function(B,Z){return I.H.useOptimistic(B,Z)},We.useReducer=function(B,Z,M){return I.H.useReducer(B,Z,M)},We.useRef=function(B){return I.H.useRef(B)},We.useState=function(B){return I.H.useState(B)},We.useSyncExternalStore=function(B,Z,M){return I.H.useSyncExternalStore(B,Z,M)},We.useTransition=function(){return I.H.useTransition()},We.version="19.2.8",We}var Cb;function tx(){return Cb||(Cb=1,Bp.exports=yN()),Bp.exports}var k=tx();const od=ex(k);var Pp={exports:{}},Go={},$p={exports:{}},Fp={};/**
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 Eb;function _N(){return Eb||(Eb=1,(function(e){function t(P,$){var se=P.length;P.push($);e:for(;0<se;){var ae=se-1>>>1,R=P[ae];if(0<a(R,$))P[ae]=$,P[se]=R,se=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],se=P.pop();if(se!==$){P[0]=se;e:for(var ae=0,R=P.length,B=R>>>1;ae<B;){var Z=2*(ae+1)-1,M=P[Z],pe=Z+1,_e=P[pe];if(0>a(M,se))pe<R&&0>a(_e,M)?(P[ae]=_e,P[pe]=se,ae=pe):(P[ae]=M,P[Z]=se,ae=Z);else if(pe<R&&0>a(_e,se))P[ae]=_e,P[pe]=se,ae=pe;else break e}}return $}function a(P,$){var se=P.sortIndex-$.sortIndex;return se!==0?se: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,f=u.now();e.unstable_now=function(){return u.now()-f}}var h=[],p=[],m=1,x=null,b=3,y=!1,_=!1,j=!1,N=!1,S=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;function O(P){for(var $=n(p);$!==null;){if($.callback===null)r(p);else if($.startTime<=P)r(p),$.sortIndex=$.expirationTime,t(h,$);else break;$=n(p)}}function D(P){if(j=!1,O(P),!_)if(n(h)!==null)_=!0,L||(L=!0,A());else{var $=n(p);$!==null&&G(D,$.startTime-P)}}var L=!1,I=-1,F=5,W=-1;function z(){return N?!0:!(e.unstable_now()-W<F)}function q(){if(N=!1,L){var P=e.unstable_now();W=P;var $=!0;try{e:{_=!1,j&&(j=!1,E(I),I=-1),y=!0;var se=b;try{t:{for(O(P),x=n(h);x!==null&&!(x.expirationTime>P&&z());){var ae=x.callback;if(typeof ae=="function"){x.callback=null,b=x.priorityLevel;var R=ae(x.expirationTime<=P);if(P=e.unstable_now(),typeof R=="function"){x.callback=R,O(P),$=!0;break t}x===n(h)&&r(h),O(P)}else r(h);x=n(h)}if(x!==null)$=!0;else{var B=n(p);B!==null&&G(D,B.startTime-P),$=!1}}break e}finally{x=null,b=se,y=!1}$=void 0}}finally{$?A():L=!1}}}var A;if(typeof C=="function")A=function(){C(q)};else if(typeof MessageChannel<"u"){var ie=new MessageChannel,K=ie.port2;ie.port1.onmessage=q,A=function(){K.postMessage(null)}}else A=function(){S(q,0)};function G(P,$){I=S(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"):F=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 se=b;b=$;try{return P()}finally{b=se}},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 se=b;b=P;try{return $()}finally{b=se}},e.unstable_scheduleCallback=function(P,$,se){var ae=e.unstable_now();switch(typeof se=="object"&&se!==null?(se=se.delay,se=typeof se=="number"&&0<se?ae+se:ae):se=ae,P){case 1:var R=-1;break;case 2:R=250;break;case 5:R=1073741823;break;case 4:R=1e4;break;default:R=5e3}return R=se+R,P={id:m++,callback:$,priorityLevel:P,startTime:se,expirationTime:R,sortIndex:-1},se>ae?(P.sortIndex=se,t(p,P),n(h)===null&&P===n(p)&&(j?(E(I),I=-1):j=!0,G(D,se-ae))):(P.sortIndex=R,t(h,P),_||y||(_=!0,L||(L=!0,A()))),P},e.unstable_shouldYield=z,e.unstable_wrapCallback=function(P){var $=b;return function(){var se=b;b=$;try{return P.apply(this,arguments)}finally{b=se}}}})(Fp)),Fp}var Tb;function wN(){return Tb||(Tb=1,$p.exports=_N()),$p.exports}var Up={exports:{}},zn={};/**
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 Ab;function kN(){if(Ab)return zn;Ab=1;var e=tx();function t(h){var p="https://react.dev/errors/"+h;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 #"+h+"; 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(h,p,m){var x=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:x==null?null:""+x,children:h,containerInfo:p,implementation:m}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(h,p){if(h==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return zn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,zn.createPortal=function(h,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(h,p,null,m)},zn.flushSync=function(h){var p=u.T,m=r.p;try{if(u.T=null,r.p=2,h)return h()}finally{u.T=p,r.p=m,r.d.f()}},zn.preconnect=function(h,p){typeof h=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,r.d.C(h,p))},zn.prefetchDNS=function(h){typeof h=="string"&&r.d.D(h)},zn.preinit=function(h,p){if(typeof h=="string"&&p&&typeof p.as=="string"){var m=p.as,x=f(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(h,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:x,integrity:b,fetchPriority:y}):m==="script"&&r.d.X(h,{crossOrigin:x,integrity:b,fetchPriority:y,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},zn.preinitModule=function(h,p){if(typeof h=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var m=f(p.as,p.crossOrigin);r.d.M(h,{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(h)},zn.preload=function(h,p){if(typeof h=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var m=p.as,x=f(m,p.crossOrigin);r.d.L(h,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})}},zn.preloadModule=function(h,p){if(typeof h=="string")if(p){var m=f(p.as,p.crossOrigin);r.d.m(h,{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(h)},zn.requestFormReset=function(h){r.d.r(h)},zn.unstable_batchedUpdates=function(h,p){return h(p)},zn.useFormState=function(h,p,m){return u.H.useFormState(h,p,m)},zn.useFormStatus=function(){return u.H.useHostTransitionStatus()},zn.version="19.2.8",zn}var Mb;function D5(){if(Mb)return Up.exports;Mb=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(),Up.exports=kN(),Up.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 Rb;function SN(){if(Rb)return Go;Rb=1;var e=wN(),t=tx(),n=D5();function r(i){var s="https://react.dev/errors/"+i;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)s+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+i+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function o(i){var s=i,c=i;if(i.alternate)for(;s.return;)s=s.return;else{i=s;do s=i,(s.flags&4098)!==0&&(c=s.return),i=s.return;while(i)}return s.tag===3?c:null}function u(i){if(i.tag===13){var s=i.memoizedState;if(s===null&&(i=i.alternate,i!==null&&(s=i.memoizedState)),s!==null)return s.dehydrated}return null}function f(i){if(i.tag===31){var s=i.memoizedState;if(s===null&&(i=i.alternate,i!==null&&(s=i.memoizedState)),s!==null)return s.dehydrated}return null}function h(i){if(o(i)!==i)throw Error(r(188))}function p(i){var s=i.alternate;if(!s){if(s=o(i),s===null)throw Error(r(188));return s!==i?null:i}for(var c=i,d=s;;){var g=c.return;if(g===null)break;var v=g.alternate;if(v===null){if(d=g.return,d!==null){c=d;continue}break}if(g.child===v.child){for(v=g.child;v;){if(v===c)return h(g),i;if(v===d)return h(g),s;v=v.sibling}throw Error(r(188))}if(c.return!==d.return)c=g,d=v;else{for(var w=!1,T=g.child;T;){if(T===c){w=!0,c=g,d=v;break}if(T===d){w=!0,d=g,c=v;break}T=T.sibling}if(!w){for(T=v.child;T;){if(T===c){w=!0,c=v,d=g;break}if(T===d){w=!0,d=v,c=g;break}T=T.sibling}if(!w)throw Error(r(189))}}if(c.alternate!==d)throw Error(r(190))}if(c.tag!==3)throw Error(r(188));return c.stateNode.current===c?i:s}function m(i){var s=i.tag;if(s===5||s===26||s===27||s===6)return i;for(i=i.child;i!==null;){if(s=m(i),s!==null)return s;i=i.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"),S=Symbol.for("react.profiler"),E=Symbol.for("react.consumer"),C=Symbol.for("react.context"),O=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),I=Symbol.for("react.memo"),F=Symbol.for("react.lazy"),W=Symbol.for("react.activity"),z=Symbol.for("react.memo_cache_sentinel"),q=Symbol.iterator;function A(i){return i===null||typeof i!="object"?null:(i=q&&i[q]||i["@@iterator"],typeof i=="function"?i:null)}var ie=Symbol.for("react.client.reference");function K(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===ie?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case j:return"Fragment";case S:return"Profiler";case N:return"StrictMode";case D:return"Suspense";case L:return"SuspenseList";case W:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case _:return"Portal";case C:return i.displayName||"Context";case E:return(i._context.displayName||"Context")+".Consumer";case O:var s=i.render;return i=i.displayName,i||(i=s.displayName||s.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case I:return s=i.displayName||null,s!==null?s:K(i.type)||"Memo";case F:s=i._payload,i=i._init;try{return K(i(s))}catch{}}return null}var G=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,se={pending:!1,data:null,method:null,action:null},ae=[],R=-1;function B(i){return{current:i}}function Z(i){0>R||(i.current=ae[R],ae[R]=null,R--)}function M(i,s){R++,ae[R]=i.current,i.current=s}var pe=B(null),_e=B(null),Ce=B(null),De=B(null);function Ee(i,s){switch(M(Ce,s),M(_e,i),M(pe,null),s.nodeType){case 9:case 11:i=(i=s.documentElement)&&(i=i.namespaceURI)?V1(i):0;break;default:if(i=s.tagName,s=s.namespaceURI)s=V1(s),i=G1(s,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}Z(pe),M(pe,i)}function Be(){Z(pe),Z(_e),Z(Ce)}function Je(i){i.memoizedState!==null&&M(De,i);var s=pe.current,c=G1(s,i.type);s!==c&&(M(_e,i),M(pe,c))}function Et(i){_e.current===i&&(Z(pe),Z(_e)),De.current===i&&(Z(De),Uo._currentValue=se)}var ft,vt;function bt(i){if(ft===void 0)try{throw Error()}catch(c){var s=c.stack.trim().match(/\n( *(at )?)/);ft=s&&s[1]||"",vt=-1<c.stack.indexOf(`
43
- at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
44
- `+ft+i+vt}var wt=!1;function Tt(i,s){if(!i||wt)return"";wt=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(s){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 ne=le}Reflect.construct(i,[],fe)}else{try{fe.call()}catch(le){ne=le}i.call(fe.prototype)}}else{try{throw Error()}catch(le){ne=le}(fe=i())&&typeof fe.catch=="function"&&fe.catch(function(){})}}catch(le){if(le&&ne&&typeof le.stack=="string")return[le.stack,ne.stack]}return[null,null]}};d.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var g=Object.getOwnPropertyDescriptor(d.DetermineComponentFrameRoot,"name");g&&g.configurable&&Object.defineProperty(d.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var v=d.DetermineComponentFrameRoot(),w=v[0],T=v[1];if(w&&T){var U=w.split(`
45
- `),ee=T.split(`
46
- `);for(g=d=0;d<U.length&&!U[d].includes("DetermineComponentFrameRoot");)d++;for(;g<ee.length&&!ee[g].includes("DetermineComponentFrameRoot");)g++;if(d===U.length||g===ee.length)for(d=U.length-1,g=ee.length-1;1<=d&&0<=g&&U[d]!==ee[g];)g--;for(;1<=d&&0<=g;d--,g--)if(U[d]!==ee[g]){if(d!==1||g!==1)do if(d--,g--,0>g||U[d]!==ee[g]){var ce=`
47
- `+U[d].replace(" at new "," at ");return i.displayName&&ce.includes("<anonymous>")&&(ce=ce.replace("<anonymous>",i.displayName)),ce}while(1<=d&&0<=g);break}}}finally{wt=!1,Error.prepareStackTrace=c}return(c=i?i.displayName||i.name:"")?bt(c):""}function ve(i,s){switch(i.tag){case 26:case 27:case 5:return bt(i.type);case 16:return bt("Lazy");case 13:return i.child!==s&&s!==null?bt("Suspense Fallback"):bt("Suspense");case 19:return bt("SuspenseList");case 0:case 15:return Tt(i.type,!1);case 11:return Tt(i.type.render,!1);case 1:return Tt(i.type,!0);case 31:return bt("Activity");default:return""}}function $e(i){try{var s="",c=null;do s+=ve(i,c),c=i,i=i.return;while(i);return s}catch(d){return`
48
- Error generating stack: `+d.message+`
49
- `+d.stack}}var rt=Object.prototype.hasOwnProperty,rn=e.unstable_scheduleCallback,je=e.unstable_cancelCallback,ze=e.unstable_shouldYield,pt=e.unstable_requestPaint,Te=e.unstable_now,Hr=e.unstable_getCurrentPriorityLevel,oe=e.unstable_ImmediatePriority,we=e.unstable_UserBlockingPriority,Q=e.unstable_NormalPriority,me=e.unstable_LowPriority,Re=e.unstable_IdlePriority,Qe=e.log,it=e.unstable_setDisableYieldValue,st=null,jt=null;function yn(i){if(typeof Qe=="function"&&it(i),jt&&typeof jt.setStrictMode=="function")try{jt.setStrictMode(st,i)}catch{}}var et=Math.clz32?Math.clz32:ti,cr=Math.log,Ln=Math.LN2;function ti(i){return i>>>=0,i===0?32:31-(cr(i)/Ln|0)|0}var Ir=256,Vr=262144,te=4194304;function xe(i){var s=i&42;if(s!==0)return s;switch(i&-i){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 i&261888;case 262144:case 524288:case 1048576:case 2097152:return i&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function be(i,s,c){var d=i.pendingLanes;if(d===0)return 0;var g=0,v=i.suspendedLanes,w=i.pingedLanes;i=i.warmLanes;var T=d&134217727;return T!==0?(d=T&~v,d!==0?g=xe(d):(w&=T,w!==0?g=xe(w):c||(c=T&~i,c!==0&&(g=xe(c))))):(T=d&~v,T!==0?g=xe(T):w!==0?g=xe(w):c||(c=d&~i,c!==0&&(g=xe(c)))),g===0?0:s!==0&&s!==g&&(s&v)===0&&(v=g&-g,c=s&-s,v>=c||v===32&&(c&4194048)!==0)?s:g}function Xe(i,s){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&s)===0}function Ht(i,s){switch(i){case 1:case 2:case 4:case 8:case 64:return s+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return s+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function hn(){var i=te;return te<<=1,(te&62914560)===0&&(te=4194304),i}function Dn(i){for(var s=[],c=0;31>c;c++)s.push(i);return s}function It(i,s){i.pendingLanes|=s,s!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function Un(i,s,c,d,g,v){var w=i.pendingLanes;i.pendingLanes=c,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=c,i.entangledLanes&=c,i.errorRecoveryDisabledLanes&=c,i.shellSuspendCounter=0;var T=i.entanglements,U=i.expirationTimes,ee=i.hiddenUpdates;for(c=w&~c;0<c;){var ce=31-et(c),fe=1<<ce;T[ce]=0,U[ce]=-1;var ne=ee[ce];if(ne!==null)for(ee[ce]=null,ce=0;ce<ne.length;ce++){var le=ne[ce];le!==null&&(le.lane&=-536870913)}c&=~fe}d!==0&&Sr(i,d,0),v!==0&&g===0&&i.tag!==0&&(i.suspendedLanes|=v&~(w&~s))}function Sr(i,s,c){i.pendingLanes|=s,i.suspendedLanes&=~s;var d=31-et(s);i.entangledLanes|=s,i.entanglements[d]=i.entanglements[d]|1073741824|c&261930}function Da(i,s){var c=i.entangledLanes|=s;for(i=i.entanglements;c;){var d=31-et(c),g=1<<d;g&s|i[d]&s&&(i[d]|=s),c&=~g}}function Xl(i,s){var c=s&-s;return c=(c&42)!==0?1:qn(c),(c&(i.suspendedLanes|s))!==0?0:c}function qn(i){switch(i){case 2:i=1;break;case 8:i=4;break;case 32:i=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:i=128;break;case 268435456:i=134217728;break;default:i=0}return i}function Hs(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function Kl(){var i=$.p;return i!==0?i:(i=window.event,i===void 0?32:mb(i.type))}function Zl(i,s){var c=$.p;try{return $.p=i,s()}finally{$.p=c}}var jr=Math.random().toString(36).slice(2),Zt="__reactFiber$"+jr,Nn="__reactProps$"+jr,ur="__reactContainer$"+jr,Jl="__reactEvents$"+jr,Of="__reactListeners$"+jr,Is="__reactHandles$"+jr,Vs="__reactResources$"+jr,ni="__reactMarker$"+jr;function ts(i){delete i[Zt],delete i[Nn],delete i[Jl],delete i[Of],delete i[Is]}function wi(i){var s=i[Zt];if(s)return s;for(var c=i.parentNode;c;){if(s=c[ur]||c[Zt]){if(c=s.alternate,s.child!==null||c!==null&&c.child!==null)for(i=J1(i);i!==null;){if(c=i[Zt])return c;i=J1(i)}return s}i=c,c=i.parentNode}return null}function Xn(i){if(i=i[Zt]||i[ur]){var s=i.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return i}return null}function Gs(i){var s=i.tag;if(s===5||s===26||s===27||s===6)return i.stateNode;throw Error(r(33))}function ri(i){var s=i[Vs];return s||(s=i[Vs]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function tn(i){i[ni]=!0}var Kn=new Set,za={};function Gr(i,s){ii(i,s),ii(i+"Capture",s)}function ii(i,s){for(za[i]=s,i=0;i<s.length;i++)Kn.add(s[i])}var eo=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]*$"),to={},nn={};function Bf(i){return rt.call(nn,i)?!0:rt.call(to,i)?!1:eo.test(i)?nn[i]=!0:(to[i]=!0,!1)}function Ys(i,s,c){if(Bf(s))if(c===null)i.removeAttribute(s);else{switch(typeof c){case"undefined":case"function":case"symbol":i.removeAttribute(s);return;case"boolean":var d=s.toLowerCase().slice(0,5);if(d!=="data-"&&d!=="aria-"){i.removeAttribute(s);return}}i.setAttribute(s,""+c)}}function Oa(i,s,c){if(c===null)i.removeAttribute(s);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(s);return}i.setAttribute(s,""+c)}}function Yr(i,s,c,d){if(d===null)i.removeAttribute(c);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(c);return}i.setAttributeNS(s,c,""+d)}}function Zn(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function Gc(i){var s=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function no(i,s,c){var d=Object.getOwnPropertyDescriptor(i.constructor.prototype,s);if(!i.hasOwnProperty(s)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var g=d.get,v=d.set;return Object.defineProperty(i,s,{configurable:!0,get:function(){return g.call(this)},set:function(w){c=""+w,v.call(this,w)}}),Object.defineProperty(i,s,{enumerable:d.enumerable}),{getValue:function(){return c},setValue:function(w){c=""+w},stopTracking:function(){i._valueTracker=null,delete i[s]}}}}function Ba(i){if(!i._valueTracker){var s=Gc(i)?"checked":"value";i._valueTracker=no(i,s,""+i[s])}}function si(i){if(!i)return!1;var s=i._valueTracker;if(!s)return!0;var c=s.getValue(),d="";return i&&(d=Gc(i)?i.checked?"true":"false":i.value),i=d,i!==c?(s.setValue(i),!0):!1}function ns(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}var Nr=/[\n"\\]/g;function on(i){return i.replace(Nr,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function Ws(i,s,c,d,g,v,w,T){i.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?i.type=w:i.removeAttribute("type"),s!=null?w==="number"?(s===0&&i.value===""||i.value!=s)&&(i.value=""+Zn(s)):i.value!==""+Zn(s)&&(i.value=""+Zn(s)):w!=="submit"&&w!=="reset"||i.removeAttribute("value"),s!=null?Pa(i,w,Zn(s)):c!=null?Pa(i,w,Zn(c)):d!=null&&i.removeAttribute("value"),g==null&&v!=null&&(i.defaultChecked=!!v),g!=null&&(i.checked=g&&typeof g!="function"&&typeof g!="symbol"),T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"?i.name=""+Zn(T):i.removeAttribute("name")}function Yc(i,s,c,d,g,v,w,T){if(v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(i.type=v),s!=null||c!=null){if(!(v!=="submit"&&v!=="reset"||s!=null)){Ba(i);return}c=c!=null?""+Zn(c):"",s=s!=null?""+Zn(s):c,T||s===i.value||(i.value=s),i.defaultValue=s}d=d??g,d=typeof d!="function"&&typeof d!="symbol"&&!!d,i.checked=T?i.checked:!!d,i.defaultChecked=!!d,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(i.name=w),Ba(i)}function Pa(i,s,c){s==="number"&&ns(i.ownerDocument)===i||i.defaultValue===""+c||(i.defaultValue=""+c)}function rs(i,s,c,d){if(i=i.options,s){s={};for(var g=0;g<c.length;g++)s["$"+c[g]]=!0;for(c=0;c<i.length;c++)g=s.hasOwnProperty("$"+i[c].value),i[c].selected!==g&&(i[c].selected=g),g&&d&&(i[c].defaultSelected=!0)}else{for(c=""+Zn(c),s=null,g=0;g<i.length;g++){if(i[g].value===c){i[g].selected=!0,d&&(i[g].defaultSelected=!0);return}s!==null||i[g].disabled||(s=i[g])}s!==null&&(s.selected=!0)}}function $a(i,s,c){if(s!=null&&(s=""+Zn(s),s!==i.value&&(i.value=s),c==null)){i.defaultValue!==s&&(i.defaultValue=s);return}i.defaultValue=c!=null?""+Zn(c):""}function ro(i,s,c,d){if(s==null){if(d!=null){if(c!=null)throw Error(r(92));if(G(d)){if(1<d.length)throw Error(r(93));d=d[0]}c=d}c==null&&(c=""),s=c}c=Zn(s),i.defaultValue=c,d=i.textContent,d===c&&d!==""&&d!==null&&(i.value=d),Ba(i)}function is(i,s){if(s){var c=i.firstChild;if(c&&c===i.lastChild&&c.nodeType===3){c.nodeValue=s;return}}i.textContent=s}var Pf=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 Wc(i,s,c){var d=s.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?d?i.setProperty(s,""):s==="float"?i.cssFloat="":i[s]="":d?i.setProperty(s,c):typeof c!="number"||c===0||Pf.has(s)?s==="float"?i.cssFloat=c:i[s]=(""+c).trim():i[s]=c+"px"}function Qc(i,s,c){if(s!=null&&typeof s!="object")throw Error(r(62));if(i=i.style,c!=null){for(var d in c)!c.hasOwnProperty(d)||s!=null&&s.hasOwnProperty(d)||(d.indexOf("--")===0?i.setProperty(d,""):d==="float"?i.cssFloat="":i[d]="");for(var g in s)d=s[g],s.hasOwnProperty(g)&&c[g]!==d&&Wc(i,g,d)}else for(var v in s)s.hasOwnProperty(v)&&Wc(i,v,s[v])}function Fa(i){if(i.indexOf("-")===-1)return!1;switch(i){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 Xc=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"]]),$f=/^[\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 Ua(i){return $f.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function Cr(){}var ss=null;function qa(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var as=null,ls=null;function Kc(i){var s=Xn(i);if(s&&(i=s.stateNode)){var c=i[Nn]||null;e:switch(i=s.stateNode,s.type){case"input":if(Ws(i,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),s=c.name,c.type==="radio"&&s!=null){for(c=i;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+on(""+s)+'"][type="radio"]'),s=0;s<c.length;s++){var d=c[s];if(d!==i&&d.form===i.form){var g=d[Nn]||null;if(!g)throw Error(r(90));Ws(d,g.value,g.defaultValue,g.defaultValue,g.checked,g.defaultChecked,g.type,g.name)}}for(s=0;s<c.length;s++)d=c[s],d.form===i.form&&si(d)}break e;case"textarea":$a(i,c.value,c.defaultValue);break e;case"select":s=c.value,s!=null&&rs(i,!!c.multiple,s,!1)}}}var io=!1;function Zc(i,s,c){if(io)return i(s,c);io=!0;try{var d=i(s);return d}finally{if(io=!1,(as!==null||ls!==null)&&(Fu(),as&&(s=as,i=ls,ls=as=null,Kc(s),i)))for(s=0;s<i.length;s++)Kc(i[s])}}function Qs(i,s){var c=i.stateNode;if(c===null)return null;var d=c[Nn]||null;if(d===null)return null;c=d[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(d=!d.disabled)||(i=i.type,d=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!d;break e;default:i=!1}if(i)return null;if(c&&typeof c!="function")throw Error(r(231,s,typeof c));return c}var Er=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ha=!1;if(Er)try{var os={};Object.defineProperty(os,"passive",{get:function(){Ha=!0}}),window.addEventListener("test",os,os),window.removeEventListener("test",os,os)}catch{Ha=!1}var H=null,he=null,Ke=null;function mt(){if(Ke)return Ke;var i,s=he,c=s.length,d,g="value"in H?H.value:H.textContent,v=g.length;for(i=0;i<c&&s[i]===g[i];i++);var w=c-i;for(d=1;d<=w&&s[c-d]===g[v-d];d++);return Ke=g.slice(i,1<d?1-d:void 0)}function at(i){var s=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&s===13&&(i=13)):i=s,i===10&&(i=13),32<=i||i===13?i:0}function He(){return!0}function Hn(){return!1}function _n(i){function s(c,d,g,v,w){this._reactName=c,this._targetInst=g,this.type=d,this.nativeEvent=v,this.target=w,this.currentTarget=null;for(var T in i)i.hasOwnProperty(T)&&(c=i[T],this[T]=c?c(v):v[T]);return this.isDefaultPrevented=(v.defaultPrevented!=null?v.defaultPrevented:v.returnValue===!1)?He:Hn,this.isPropagationStopped=Hn,this}return x(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=He)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=He)},persist:function(){},isPersistent:He}),s}var Tr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ki=_n(Tr),wn=x({},Tr,{view:0,detail:0}),Jc=_n(wn),so,ao,Xs,Ks=x({},wn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Uf,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==Xs&&(Xs&&i.type==="mousemove"?(so=i.screenX-Xs.screenX,ao=i.screenY-Xs.screenY):ao=so=0,Xs=i),so)},movementY:function(i){return"movementY"in i?i.movementY:ao}}),Ff=_n(Ks),eu=x({},Ks,{dataTransfer:0}),tu=_n(eu),nu=x({},wn,{relatedTarget:0}),ai=_n(nu),ru=x({},Tr,{animationName:0,elapsedTime:0,pseudoElement:0}),iu=_n(ru),Ia=x({},Tr,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),bS=_n(Ia),yS=x({},Tr,{data:0}),Qx=_n(yS),_S={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},wS={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"},kS={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function SS(i){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(i):(i=kS[i])?!!s[i]:!1}function Uf(){return SS}var jS=x({},wn,{key:function(i){if(i.key){var s=_S[i.key]||i.key;if(s!=="Unidentified")return s}return i.type==="keypress"?(i=at(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?wS[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Uf,charCode:function(i){return i.type==="keypress"?at(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?at(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),NS=_n(jS),CS=x({},Ks,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Xx=_n(CS),ES=x({},wn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Uf}),TS=_n(ES),AS=x({},Tr,{propertyName:0,elapsedTime:0,pseudoElement:0}),MS=_n(AS),RS=x({},Ks,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),LS=_n(RS),DS=x({},Tr,{newState:0,oldState:0}),zS=_n(DS),OS=[9,13,27,32],qf=Er&&"CompositionEvent"in window,lo=null;Er&&"documentMode"in document&&(lo=document.documentMode);var BS=Er&&"TextEvent"in window&&!lo,Kx=Er&&(!qf||lo&&8<lo&&11>=lo),Zx=" ",Jx=!1;function e0(i,s){switch(i){case"keyup":return OS.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function t0(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var Va=!1;function PS(i,s){switch(i){case"compositionend":return t0(s);case"keypress":return s.which!==32?null:(Jx=!0,Zx);case"textInput":return i=s.data,i===Zx&&Jx?null:i;default:return null}}function $S(i,s){if(Va)return i==="compositionend"||!qf&&e0(i,s)?(i=mt(),Ke=he=H=null,Va=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return Kx&&s.locale!=="ko"?null:s.data;default:return null}}var FS={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 n0(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s==="input"?!!FS[i.type]:s==="textarea"}function r0(i,s,c,d){as?ls?ls.push(d):ls=[d]:as=d,s=Yu(s,"onChange"),0<s.length&&(c=new ki("onChange","change",null,c,d),i.push({event:c,listeners:s}))}var oo=null,co=null;function US(i){$1(i,0)}function su(i){var s=Gs(i);if(si(s))return i}function i0(i,s){if(i==="change")return s}var s0=!1;if(Er){var Hf;if(Er){var If="oninput"in document;if(!If){var a0=document.createElement("div");a0.setAttribute("oninput","return;"),If=typeof a0.oninput=="function"}Hf=If}else Hf=!1;s0=Hf&&(!document.documentMode||9<document.documentMode)}function l0(){oo&&(oo.detachEvent("onpropertychange",o0),co=oo=null)}function o0(i){if(i.propertyName==="value"&&su(co)){var s=[];r0(s,co,i,qa(i)),Zc(US,s)}}function qS(i,s,c){i==="focusin"?(l0(),oo=s,co=c,oo.attachEvent("onpropertychange",o0)):i==="focusout"&&l0()}function HS(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return su(co)}function IS(i,s){if(i==="click")return su(s)}function VS(i,s){if(i==="input"||i==="change")return su(s)}function GS(i,s){return i===s&&(i!==0||1/i===1/s)||i!==i&&s!==s}var dr=typeof Object.is=="function"?Object.is:GS;function uo(i,s){if(dr(i,s))return!0;if(typeof i!="object"||i===null||typeof s!="object"||s===null)return!1;var c=Object.keys(i),d=Object.keys(s);if(c.length!==d.length)return!1;for(d=0;d<c.length;d++){var g=c[d];if(!rt.call(s,g)||!dr(i[g],s[g]))return!1}return!0}function c0(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function u0(i,s){var c=c0(i);i=0;for(var d;c;){if(c.nodeType===3){if(d=i+c.textContent.length,i<=s&&d>=s)return{node:c,offset:s-i};i=d}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=c0(c)}}function d0(i,s){return i&&s?i===s?!0:i&&i.nodeType===3?!1:s&&s.nodeType===3?d0(i,s.parentNode):"contains"in i?i.contains(s):i.compareDocumentPosition?!!(i.compareDocumentPosition(s)&16):!1:!1}function f0(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var s=ns(i.document);s instanceof i.HTMLIFrameElement;){try{var c=typeof s.contentWindow.location.href=="string"}catch{c=!1}if(c)i=s.contentWindow;else break;s=ns(i.document)}return s}function Vf(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s&&(s==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||s==="textarea"||i.contentEditable==="true")}var YS=Er&&"documentMode"in document&&11>=document.documentMode,Ga=null,Gf=null,fo=null,Yf=!1;function h0(i,s,c){var d=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;Yf||Ga==null||Ga!==ns(d)||(d=Ga,"selectionStart"in d&&Vf(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),fo&&uo(fo,d)||(fo=d,d=Yu(Gf,"onSelect"),0<d.length&&(s=new ki("onSelect","select",null,s,c),i.push({event:s,listeners:d}),s.target=Ga)))}function Zs(i,s){var c={};return c[i.toLowerCase()]=s.toLowerCase(),c["Webkit"+i]="webkit"+s,c["Moz"+i]="moz"+s,c}var Ya={animationend:Zs("Animation","AnimationEnd"),animationiteration:Zs("Animation","AnimationIteration"),animationstart:Zs("Animation","AnimationStart"),transitionrun:Zs("Transition","TransitionRun"),transitionstart:Zs("Transition","TransitionStart"),transitioncancel:Zs("Transition","TransitionCancel"),transitionend:Zs("Transition","TransitionEnd")},Wf={},p0={};Er&&(p0=document.createElement("div").style,"AnimationEvent"in window||(delete Ya.animationend.animation,delete Ya.animationiteration.animation,delete Ya.animationstart.animation),"TransitionEvent"in window||delete Ya.transitionend.transition);function Js(i){if(Wf[i])return Wf[i];if(!Ya[i])return i;var s=Ya[i],c;for(c in s)if(s.hasOwnProperty(c)&&c in p0)return Wf[i]=s[c];return i}var m0=Js("animationend"),g0=Js("animationiteration"),x0=Js("animationstart"),WS=Js("transitionrun"),QS=Js("transitionstart"),XS=Js("transitioncancel"),v0=Js("transitionend"),b0=new Map,Qf="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(" ");Qf.push("scrollEnd");function Wr(i,s){b0.set(i,s),Gr(s,[i])}var au=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},Ar=[],Wa=0,Xf=0;function lu(){for(var i=Wa,s=Xf=Wa=0;s<i;){var c=Ar[s];Ar[s++]=null;var d=Ar[s];Ar[s++]=null;var g=Ar[s];Ar[s++]=null;var v=Ar[s];if(Ar[s++]=null,d!==null&&g!==null){var w=d.pending;w===null?g.next=g:(g.next=w.next,w.next=g),d.pending=g}v!==0&&y0(c,g,v)}}function ou(i,s,c,d){Ar[Wa++]=i,Ar[Wa++]=s,Ar[Wa++]=c,Ar[Wa++]=d,Xf|=d,i.lanes|=d,i=i.alternate,i!==null&&(i.lanes|=d)}function Kf(i,s,c,d){return ou(i,s,c,d),cu(i)}function ea(i,s){return ou(i,null,null,s),cu(i)}function y0(i,s,c){i.lanes|=c;var d=i.alternate;d!==null&&(d.lanes|=c);for(var g=!1,v=i.return;v!==null;)v.childLanes|=c,d=v.alternate,d!==null&&(d.childLanes|=c),v.tag===22&&(i=v.stateNode,i===null||i._visibility&1||(g=!0)),i=v,v=v.return;return i.tag===3?(v=i.stateNode,g&&s!==null&&(g=31-et(c),i=v.hiddenUpdates,d=i[g],d===null?i[g]=[s]:d.push(s),s.lane=c|536870912),v):null}function cu(i){if(50<Do)throw Do=0,ap=null,Error(r(185));for(var s=i.return;s!==null;)i=s,s=i.return;return i.tag===3?i.stateNode:null}var Qa={};function KS(i,s,c,d){this.tag=i,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=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function fr(i,s,c,d){return new KS(i,s,c,d)}function Zf(i){return i=i.prototype,!(!i||!i.isReactComponent)}function Si(i,s){var c=i.alternate;return c===null?(c=fr(i.tag,s,i.key,i.mode),c.elementType=i.elementType,c.type=i.type,c.stateNode=i.stateNode,c.alternate=i,i.alternate=c):(c.pendingProps=s,c.type=i.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=i.flags&65011712,c.childLanes=i.childLanes,c.lanes=i.lanes,c.child=i.child,c.memoizedProps=i.memoizedProps,c.memoizedState=i.memoizedState,c.updateQueue=i.updateQueue,s=i.dependencies,c.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},c.sibling=i.sibling,c.index=i.index,c.ref=i.ref,c.refCleanup=i.refCleanup,c}function _0(i,s){i.flags&=65011714;var c=i.alternate;return c===null?(i.childLanes=0,i.lanes=s,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=c.childLanes,i.lanes=c.lanes,i.child=c.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=c.memoizedProps,i.memoizedState=c.memoizedState,i.updateQueue=c.updateQueue,i.type=c.type,s=c.dependencies,i.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),i}function uu(i,s,c,d,g,v){var w=0;if(d=i,typeof i=="function")Zf(i)&&(w=1);else if(typeof i=="string")w=nN(i,c,pe.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case W:return i=fr(31,c,s,g),i.elementType=W,i.lanes=v,i;case j:return ta(c.children,g,v,s);case N:w=8,g|=24;break;case S:return i=fr(12,c,s,g|2),i.elementType=S,i.lanes=v,i;case D:return i=fr(13,c,s,g),i.elementType=D,i.lanes=v,i;case L:return i=fr(19,c,s,g),i.elementType=L,i.lanes=v,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case C:w=10;break e;case E:w=9;break e;case O:w=11;break e;case I:w=14;break e;case F:w=16,d=null;break e}w=29,c=Error(r(130,i===null?"null":typeof i,"")),d=null}return s=fr(w,c,s,g),s.elementType=i,s.type=d,s.lanes=v,s}function ta(i,s,c,d){return i=fr(7,i,d,s),i.lanes=c,i}function Jf(i,s,c){return i=fr(6,i,null,s),i.lanes=c,i}function w0(i){var s=fr(18,null,null,0);return s.stateNode=i,s}function eh(i,s,c){return s=fr(4,i.children!==null?i.children:[],i.key,s),s.lanes=c,s.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},s}var k0=new WeakMap;function Mr(i,s){if(typeof i=="object"&&i!==null){var c=k0.get(i);return c!==void 0?c:(s={value:i,source:s,stack:$e(s)},k0.set(i,s),s)}return{value:i,source:s,stack:$e(s)}}var Xa=[],Ka=0,du=null,ho=0,Rr=[],Lr=0,cs=null,li=1,oi="";function ji(i,s){Xa[Ka++]=ho,Xa[Ka++]=du,du=i,ho=s}function S0(i,s,c){Rr[Lr++]=li,Rr[Lr++]=oi,Rr[Lr++]=cs,cs=i;var d=li;i=oi;var g=32-et(d)-1;d&=~(1<<g),c+=1;var v=32-et(s)+g;if(30<v){var w=g-g%5;v=(d&(1<<w)-1).toString(32),d>>=w,g-=w,li=1<<32-et(s)+g|c<<g|d,oi=v+i}else li=1<<v|c<<g|d,oi=i}function th(i){i.return!==null&&(ji(i,1),S0(i,1,0))}function nh(i){for(;i===du;)du=Xa[--Ka],Xa[Ka]=null,ho=Xa[--Ka],Xa[Ka]=null;for(;i===cs;)cs=Rr[--Lr],Rr[Lr]=null,oi=Rr[--Lr],Rr[Lr]=null,li=Rr[--Lr],Rr[Lr]=null}function j0(i,s){Rr[Lr++]=li,Rr[Lr++]=oi,Rr[Lr++]=cs,li=s.id,oi=s.overflow,cs=i}var Cn=null,Gt=null,ht=!1,us=null,Dr=!1,rh=Error(r(519));function ds(i){var s=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw po(Mr(s,i)),rh}function N0(i){var s=i.stateNode,c=i.type,d=i.memoizedProps;switch(s[Zt]=i,s[Nn]=d,c){case"dialog":ot("cancel",s),ot("close",s);break;case"iframe":case"object":case"embed":ot("load",s);break;case"video":case"audio":for(c=0;c<Oo.length;c++)ot(Oo[c],s);break;case"source":ot("error",s);break;case"img":case"image":case"link":ot("error",s),ot("load",s);break;case"details":ot("toggle",s);break;case"input":ot("invalid",s),Yc(s,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":ot("invalid",s);break;case"textarea":ot("invalid",s),ro(s,d.value,d.defaultValue,d.children)}c=d.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||s.textContent===""+c||d.suppressHydrationWarning===!0||H1(s.textContent,c)?(d.popover!=null&&(ot("beforetoggle",s),ot("toggle",s)),d.onScroll!=null&&ot("scroll",s),d.onScrollEnd!=null&&ot("scrollend",s),d.onClick!=null&&(s.onclick=Cr),s=!0):s=!1,s||ds(i,!0)}function C0(i){for(Cn=i.return;Cn;)switch(Cn.tag){case 5:case 31:case 13:Dr=!1;return;case 27:case 3:Dr=!0;return;default:Cn=Cn.return}}function Za(i){if(i!==Cn)return!1;if(!ht)return C0(i),ht=!0,!1;var s=i.tag,c;if((c=s!==3&&s!==27)&&((c=s===5)&&(c=i.type,c=!(c!=="form"&&c!=="button")||_p(i.type,i.memoizedProps)),c=!c),c&&Gt&&ds(i),C0(i),s===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));Gt=Z1(i)}else if(s===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));Gt=Z1(i)}else s===27?(s=Gt,js(i.type)?(i=Np,Np=null,Gt=i):Gt=s):Gt=Cn?Or(i.stateNode.nextSibling):null;return!0}function na(){Gt=Cn=null,ht=!1}function ih(){var i=us;return i!==null&&(nr===null?nr=i:nr.push.apply(nr,i),us=null),i}function po(i){us===null?us=[i]:us.push(i)}var sh=B(null),ra=null,Ni=null;function fs(i,s,c){M(sh,s._currentValue),s._currentValue=c}function Ci(i){i._currentValue=sh.current,Z(sh)}function ah(i,s,c){for(;i!==null;){var d=i.alternate;if((i.childLanes&s)!==s?(i.childLanes|=s,d!==null&&(d.childLanes|=s)):d!==null&&(d.childLanes&s)!==s&&(d.childLanes|=s),i===c)break;i=i.return}}function lh(i,s,c,d){var g=i.child;for(g!==null&&(g.return=i);g!==null;){var v=g.dependencies;if(v!==null){var w=g.child;v=v.firstContext;e:for(;v!==null;){var T=v;v=g;for(var U=0;U<s.length;U++)if(T.context===s[U]){v.lanes|=c,T=v.alternate,T!==null&&(T.lanes|=c),ah(v.return,c,i),d||(w=null);break e}v=T.next}}else if(g.tag===18){if(w=g.return,w===null)throw Error(r(341));w.lanes|=c,v=w.alternate,v!==null&&(v.lanes|=c),ah(w,c,i),w=null}else w=g.child;if(w!==null)w.return=g;else for(w=g;w!==null;){if(w===i){w=null;break}if(g=w.sibling,g!==null){g.return=w.return,w=g;break}w=w.return}g=w}}function Ja(i,s,c,d){i=null;for(var g=s,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 w=g.alternate;if(w===null)throw Error(r(387));if(w=w.memoizedProps,w!==null){var T=g.type;dr(g.pendingProps.value,w.value)||(i!==null?i.push(T):i=[T])}}else if(g===De.current){if(w=g.alternate,w===null)throw Error(r(387));w.memoizedState.memoizedState!==g.memoizedState.memoizedState&&(i!==null?i.push(Uo):i=[Uo])}g=g.return}i!==null&&lh(s,i,c,d),s.flags|=262144}function fu(i){for(i=i.firstContext;i!==null;){if(!dr(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function ia(i){ra=i,Ni=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function En(i){return E0(ra,i)}function hu(i,s){return ra===null&&ia(i),E0(i,s)}function E0(i,s){var c=s._currentValue;if(s={context:s,memoizedValue:c,next:null},Ni===null){if(i===null)throw Error(r(308));Ni=s,i.dependencies={lanes:0,firstContext:s},i.flags|=524288}else Ni=Ni.next=s;return c}var ZS=typeof AbortController<"u"?AbortController:function(){var i=[],s=this.signal={aborted:!1,addEventListener:function(c,d){i.push(d)}};this.abort=function(){s.aborted=!0,i.forEach(function(c){return c()})}},JS=e.unstable_scheduleCallback,ej=e.unstable_NormalPriority,pn={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function oh(){return{controller:new ZS,data:new Map,refCount:0}}function mo(i){i.refCount--,i.refCount===0&&JS(ej,function(){i.controller.abort()})}var go=null,ch=0,el=0,tl=null;function tj(i,s){if(go===null){var c=go=[];ch=0,el=fp(),tl={status:"pending",value:void 0,then:function(d){c.push(d)}}}return ch++,s.then(T0,T0),s}function T0(){if(--ch===0&&go!==null){tl!==null&&(tl.status="fulfilled");var i=go;go=null,el=0,tl=null;for(var s=0;s<i.length;s++)(0,i[s])()}}function nj(i,s){var c=[],d={status:"pending",value:null,reason:null,then:function(g){c.push(g)}};return i.then(function(){d.status="fulfilled",d.value=s;for(var g=0;g<c.length;g++)(0,c[g])(s)},function(g){for(d.status="rejected",d.reason=g,g=0;g<c.length;g++)(0,c[g])(void 0)}),d}var A0=P.S;P.S=function(i,s){h1=Te(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&tj(i,s),A0!==null&&A0(i,s)};var sa=B(null);function uh(){var i=sa.current;return i!==null?i:$t.pooledCache}function pu(i,s){s===null?M(sa,sa.current):M(sa,s.pool)}function M0(){var i=uh();return i===null?null:{parent:pn._currentValue,pool:i}}var nl=Error(r(460)),dh=Error(r(474)),mu=Error(r(542)),gu={then:function(){}};function R0(i){return i=i.status,i==="fulfilled"||i==="rejected"}function L0(i,s,c){switch(c=i[c],c===void 0?i.push(s):c!==s&&(s.then(Cr,Cr),s=c),s.status){case"fulfilled":return s.value;case"rejected":throw i=s.reason,z0(i),i;default:if(typeof s.status=="string")s.then(Cr,Cr);else{if(i=$t,i!==null&&100<i.shellSuspendCounter)throw Error(r(482));i=s,i.status="pending",i.then(function(d){if(s.status==="pending"){var g=s;g.status="fulfilled",g.value=d}},function(d){if(s.status==="pending"){var g=s;g.status="rejected",g.reason=d}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw i=s.reason,z0(i),i}throw la=s,nl}}function aa(i){try{var s=i._init;return s(i._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(la=c,nl):c}}var la=null;function D0(){if(la===null)throw Error(r(459));var i=la;return la=null,i}function z0(i){if(i===nl||i===mu)throw Error(r(483))}var rl=null,xo=0;function xu(i){var s=xo;return xo+=1,rl===null&&(rl=[]),L0(rl,i,s)}function vo(i,s){s=s.props.ref,i.ref=s!==void 0?s:null}function vu(i,s){throw s.$$typeof===b?Error(r(525)):(i=Object.prototype.toString.call(s),Error(r(31,i==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":i)))}function O0(i){function s(X,V){if(i){var J=X.deletions;J===null?(X.deletions=[V],X.flags|=16):J.push(V)}}function c(X,V){if(!i)return null;for(;V!==null;)s(X,V),V=V.sibling;return null}function d(X){for(var V=new Map;X!==null;)X.key!==null?V.set(X.key,X):V.set(X.index,X),X=X.sibling;return V}function g(X,V){return X=Si(X,V),X.index=0,X.sibling=null,X}function v(X,V,J){return X.index=J,i?(J=X.alternate,J!==null?(J=J.index,J<V?(X.flags|=67108866,V):J):(X.flags|=67108866,V)):(X.flags|=1048576,V)}function w(X){return i&&X.alternate===null&&(X.flags|=67108866),X}function T(X,V,J,ue){return V===null||V.tag!==6?(V=Jf(J,X.mode,ue),V.return=X,V):(V=g(V,J),V.return=X,V)}function U(X,V,J,ue){var Pe=J.type;return Pe===j?ce(X,V,J.props.children,ue,J.key):V!==null&&(V.elementType===Pe||typeof Pe=="object"&&Pe!==null&&Pe.$$typeof===F&&aa(Pe)===V.type)?(V=g(V,J.props),vo(V,J),V.return=X,V):(V=uu(J.type,J.key,J.props,null,X.mode,ue),vo(V,J),V.return=X,V)}function ee(X,V,J,ue){return V===null||V.tag!==4||V.stateNode.containerInfo!==J.containerInfo||V.stateNode.implementation!==J.implementation?(V=eh(J,X.mode,ue),V.return=X,V):(V=g(V,J.children||[]),V.return=X,V)}function ce(X,V,J,ue,Pe){return V===null||V.tag!==7?(V=ta(J,X.mode,ue,Pe),V.return=X,V):(V=g(V,J),V.return=X,V)}function fe(X,V,J){if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return V=Jf(""+V,X.mode,J),V.return=X,V;if(typeof V=="object"&&V!==null){switch(V.$$typeof){case y:return J=uu(V.type,V.key,V.props,null,X.mode,J),vo(J,V),J.return=X,J;case _:return V=eh(V,X.mode,J),V.return=X,V;case F:return V=aa(V),fe(X,V,J)}if(G(V)||A(V))return V=ta(V,X.mode,J,null),V.return=X,V;if(typeof V.then=="function")return fe(X,xu(V),J);if(V.$$typeof===C)return fe(X,hu(X,V),J);vu(X,V)}return null}function ne(X,V,J,ue){var Pe=V!==null?V.key:null;if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return Pe!==null?null:T(X,V,""+J,ue);if(typeof J=="object"&&J!==null){switch(J.$$typeof){case y:return J.key===Pe?U(X,V,J,ue):null;case _:return J.key===Pe?ee(X,V,J,ue):null;case F:return J=aa(J),ne(X,V,J,ue)}if(G(J)||A(J))return Pe!==null?null:ce(X,V,J,ue,null);if(typeof J.then=="function")return ne(X,V,xu(J),ue);if(J.$$typeof===C)return ne(X,V,hu(X,J),ue);vu(X,J)}return null}function le(X,V,J,ue,Pe){if(typeof ue=="string"&&ue!==""||typeof ue=="number"||typeof ue=="bigint")return X=X.get(J)||null,T(V,X,""+ue,Pe);if(typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case y:return X=X.get(ue.key===null?J:ue.key)||null,U(V,X,ue,Pe);case _:return X=X.get(ue.key===null?J:ue.key)||null,ee(V,X,ue,Pe);case F:return ue=aa(ue),le(X,V,J,ue,Pe)}if(G(ue)||A(ue))return X=X.get(J)||null,ce(V,X,ue,Pe,null);if(typeof ue.then=="function")return le(X,V,J,xu(ue),Pe);if(ue.$$typeof===C)return le(X,V,J,hu(V,ue),Pe);vu(V,ue)}return null}function Ae(X,V,J,ue){for(var Pe=null,yt=null,Le=V,tt=V=0,dt=null;Le!==null&&tt<J.length;tt++){Le.index>tt?(dt=Le,Le=null):dt=Le.sibling;var _t=ne(X,Le,J[tt],ue);if(_t===null){Le===null&&(Le=dt);break}i&&Le&&_t.alternate===null&&s(X,Le),V=v(_t,V,tt),yt===null?Pe=_t:yt.sibling=_t,yt=_t,Le=dt}if(tt===J.length)return c(X,Le),ht&&ji(X,tt),Pe;if(Le===null){for(;tt<J.length;tt++)Le=fe(X,J[tt],ue),Le!==null&&(V=v(Le,V,tt),yt===null?Pe=Le:yt.sibling=Le,yt=Le);return ht&&ji(X,tt),Pe}for(Le=d(Le);tt<J.length;tt++)dt=le(Le,X,tt,J[tt],ue),dt!==null&&(i&&dt.alternate!==null&&Le.delete(dt.key===null?tt:dt.key),V=v(dt,V,tt),yt===null?Pe=dt:yt.sibling=dt,yt=dt);return i&&Le.forEach(function(As){return s(X,As)}),ht&&ji(X,tt),Pe}function Ue(X,V,J,ue){if(J==null)throw Error(r(151));for(var Pe=null,yt=null,Le=V,tt=V=0,dt=null,_t=J.next();Le!==null&&!_t.done;tt++,_t=J.next()){Le.index>tt?(dt=Le,Le=null):dt=Le.sibling;var As=ne(X,Le,_t.value,ue);if(As===null){Le===null&&(Le=dt);break}i&&Le&&As.alternate===null&&s(X,Le),V=v(As,V,tt),yt===null?Pe=As:yt.sibling=As,yt=As,Le=dt}if(_t.done)return c(X,Le),ht&&ji(X,tt),Pe;if(Le===null){for(;!_t.done;tt++,_t=J.next())_t=fe(X,_t.value,ue),_t!==null&&(V=v(_t,V,tt),yt===null?Pe=_t:yt.sibling=_t,yt=_t);return ht&&ji(X,tt),Pe}for(Le=d(Le);!_t.done;tt++,_t=J.next())_t=le(Le,X,tt,_t.value,ue),_t!==null&&(i&&_t.alternate!==null&&Le.delete(_t.key===null?tt:_t.key),V=v(_t,V,tt),yt===null?Pe=_t:yt.sibling=_t,yt=_t);return i&&Le.forEach(function(hN){return s(X,hN)}),ht&&ji(X,tt),Pe}function Ot(X,V,J,ue){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 Pe=J.key;V!==null;){if(V.key===Pe){if(Pe=J.type,Pe===j){if(V.tag===7){c(X,V.sibling),ue=g(V,J.props.children),ue.return=X,X=ue;break e}}else if(V.elementType===Pe||typeof Pe=="object"&&Pe!==null&&Pe.$$typeof===F&&aa(Pe)===V.type){c(X,V.sibling),ue=g(V,J.props),vo(ue,J),ue.return=X,X=ue;break e}c(X,V);break}else s(X,V);V=V.sibling}J.type===j?(ue=ta(J.props.children,X.mode,ue,J.key),ue.return=X,X=ue):(ue=uu(J.type,J.key,J.props,null,X.mode,ue),vo(ue,J),ue.return=X,X=ue)}return w(X);case _:e:{for(Pe=J.key;V!==null;){if(V.key===Pe)if(V.tag===4&&V.stateNode.containerInfo===J.containerInfo&&V.stateNode.implementation===J.implementation){c(X,V.sibling),ue=g(V,J.children||[]),ue.return=X,X=ue;break e}else{c(X,V);break}else s(X,V);V=V.sibling}ue=eh(J,X.mode,ue),ue.return=X,X=ue}return w(X);case F:return J=aa(J),Ot(X,V,J,ue)}if(G(J))return Ae(X,V,J,ue);if(A(J)){if(Pe=A(J),typeof Pe!="function")throw Error(r(150));return J=Pe.call(J),Ue(X,V,J,ue)}if(typeof J.then=="function")return Ot(X,V,xu(J),ue);if(J.$$typeof===C)return Ot(X,V,hu(X,J),ue);vu(X,J)}return typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint"?(J=""+J,V!==null&&V.tag===6?(c(X,V.sibling),ue=g(V,J),ue.return=X,X=ue):(c(X,V),ue=Jf(J,X.mode,ue),ue.return=X,X=ue),w(X)):c(X,V)}return function(X,V,J,ue){try{xo=0;var Pe=Ot(X,V,J,ue);return rl=null,Pe}catch(Le){if(Le===nl||Le===mu)throw Le;var yt=fr(29,Le,null,X.mode);return yt.lanes=ue,yt.return=X,yt}finally{}}}var oa=O0(!0),B0=O0(!1),hs=!1;function fh(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function hh(i,s){i=i.updateQueue,s.updateQueue===i&&(s.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function ps(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function ms(i,s,c){var d=i.updateQueue;if(d===null)return null;if(d=d.shared,(kt&2)!==0){var g=d.pending;return g===null?s.next=s:(s.next=g.next,g.next=s),d.pending=s,s=cu(i),y0(i,null,c),s}return ou(i,d,s,c),cu(i)}function bo(i,s,c){if(s=s.updateQueue,s!==null&&(s=s.shared,(c&4194048)!==0)){var d=s.lanes;d&=i.pendingLanes,c|=d,s.lanes=c,Da(i,c)}}function ph(i,s){var c=i.updateQueue,d=i.alternate;if(d!==null&&(d=d.updateQueue,c===d)){var g=null,v=null;if(c=c.firstBaseUpdate,c!==null){do{var w={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};v===null?g=v=w:v=v.next=w,c=c.next}while(c!==null);v===null?g=v=s:v=v.next=s}else g=v=s;c={baseState:d.baseState,firstBaseUpdate:g,lastBaseUpdate:v,shared:d.shared,callbacks:d.callbacks},i.updateQueue=c;return}i=c.lastBaseUpdate,i===null?c.firstBaseUpdate=s:i.next=s,c.lastBaseUpdate=s}var mh=!1;function yo(){if(mh){var i=tl;if(i!==null)throw i}}function _o(i,s,c,d){mh=!1;var g=i.updateQueue;hs=!1;var v=g.firstBaseUpdate,w=g.lastBaseUpdate,T=g.shared.pending;if(T!==null){g.shared.pending=null;var U=T,ee=U.next;U.next=null,w===null?v=ee:w.next=ee,w=U;var ce=i.alternate;ce!==null&&(ce=ce.updateQueue,T=ce.lastBaseUpdate,T!==w&&(T===null?ce.firstBaseUpdate=ee:T.next=ee,ce.lastBaseUpdate=U))}if(v!==null){var fe=g.baseState;w=0,ce=ee=U=null,T=v;do{var ne=T.lane&-536870913,le=ne!==T.lane;if(le?(ut&ne)===ne:(d&ne)===ne){ne!==0&&ne===el&&(mh=!0),ce!==null&&(ce=ce.next={lane:0,tag:T.tag,payload:T.payload,callback:null,next:null});e:{var Ae=i,Ue=T;ne=s;var Ot=c;switch(Ue.tag){case 1:if(Ae=Ue.payload,typeof Ae=="function"){fe=Ae.call(Ot,fe,ne);break e}fe=Ae;break e;case 3:Ae.flags=Ae.flags&-65537|128;case 0:if(Ae=Ue.payload,ne=typeof Ae=="function"?Ae.call(Ot,fe,ne):Ae,ne==null)break e;fe=x({},fe,ne);break e;case 2:hs=!0}}ne=T.callback,ne!==null&&(i.flags|=64,le&&(i.flags|=8192),le=g.callbacks,le===null?g.callbacks=[ne]:le.push(ne))}else le={lane:ne,tag:T.tag,payload:T.payload,callback:T.callback,next:null},ce===null?(ee=ce=le,U=fe):ce=ce.next=le,w|=ne;if(T=T.next,T===null){if(T=g.shared.pending,T===null)break;le=T,T=le.next,le.next=null,g.lastBaseUpdate=le,g.shared.pending=null}}while(!0);ce===null&&(U=fe),g.baseState=U,g.firstBaseUpdate=ee,g.lastBaseUpdate=ce,v===null&&(g.shared.lanes=0),ys|=w,i.lanes=w,i.memoizedState=fe}}function P0(i,s){if(typeof i!="function")throw Error(r(191,i));i.call(s)}function $0(i,s){var c=i.callbacks;if(c!==null)for(i.callbacks=null,i=0;i<c.length;i++)P0(c[i],s)}var il=B(null),bu=B(0);function F0(i,s){i=Oi,M(bu,i),M(il,s),Oi=i|s.baseLanes}function gh(){M(bu,Oi),M(il,il.current)}function xh(){Oi=bu.current,Z(il),Z(bu)}var hr=B(null),zr=null;function gs(i){var s=i.alternate;M(cn,cn.current&1),M(hr,i),zr===null&&(s===null||il.current!==null||s.memoizedState!==null)&&(zr=i)}function vh(i){M(cn,cn.current),M(hr,i),zr===null&&(zr=i)}function U0(i){i.tag===22?(M(cn,cn.current),M(hr,i),zr===null&&(zr=i)):xs()}function xs(){M(cn,cn.current),M(hr,hr.current)}function pr(i){Z(hr),zr===i&&(zr=null),Z(cn)}var cn=B(0);function yu(i){for(var s=i;s!==null;){if(s.tag===13){var c=s.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||Sp(c)||jp(c)))return s}else if(s.tag===19&&(s.memoizedProps.revealOrder==="forwards"||s.memoizedProps.revealOrder==="backwards"||s.memoizedProps.revealOrder==="unstable_legacy-backwards"||s.memoizedProps.revealOrder==="together")){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===i)break;for(;s.sibling===null;){if(s.return===null||s.return===i)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var Ei=0,Ze=null,Dt=null,mn=null,_u=!1,sl=!1,ca=!1,wu=0,wo=0,al=null,rj=0;function sn(){throw Error(r(321))}function bh(i,s){if(s===null)return!1;for(var c=0;c<s.length&&c<i.length;c++)if(!dr(i[c],s[c]))return!1;return!0}function yh(i,s,c,d,g,v){return Ei=v,Ze=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,P.H=i===null||i.memoizedState===null?Sv:zh,ca=!1,v=c(d,g),ca=!1,sl&&(v=H0(s,c,d,g)),q0(i),v}function q0(i){P.H=jo;var s=Dt!==null&&Dt.next!==null;if(Ei=0,mn=Dt=Ze=null,_u=!1,wo=0,al=null,s)throw Error(r(300));i===null||gn||(i=i.dependencies,i!==null&&fu(i)&&(gn=!0))}function H0(i,s,c,d){Ze=i;var g=0;do{if(sl&&(al=null),wo=0,sl=!1,25<=g)throw Error(r(301));if(g+=1,mn=Dt=null,i.updateQueue!=null){var v=i.updateQueue;v.lastEffect=null,v.events=null,v.stores=null,v.memoCache!=null&&(v.memoCache.index=0)}P.H=jv,v=s(c,d)}while(sl);return v}function ij(){var i=P.H,s=i.useState()[0];return s=typeof s.then=="function"?ko(s):s,i=i.useState()[0],(Dt!==null?Dt.memoizedState:null)!==i&&(Ze.flags|=1024),s}function _h(){var i=wu!==0;return wu=0,i}function wh(i,s,c){s.updateQueue=i.updateQueue,s.flags&=-2053,i.lanes&=~c}function kh(i){if(_u){for(i=i.memoizedState;i!==null;){var s=i.queue;s!==null&&(s.pending=null),i=i.next}_u=!1}Ei=0,mn=Dt=Ze=null,sl=!1,wo=wu=0,al=null}function In(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return mn===null?Ze.memoizedState=mn=i:mn=mn.next=i,mn}function un(){if(Dt===null){var i=Ze.alternate;i=i!==null?i.memoizedState:null}else i=Dt.next;var s=mn===null?Ze.memoizedState:mn.next;if(s!==null)mn=s,Dt=i;else{if(i===null)throw Ze.alternate===null?Error(r(467)):Error(r(310));Dt=i,i={memoizedState:Dt.memoizedState,baseState:Dt.baseState,baseQueue:Dt.baseQueue,queue:Dt.queue,next:null},mn===null?Ze.memoizedState=mn=i:mn=mn.next=i}return mn}function ku(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ko(i){var s=wo;return wo+=1,al===null&&(al=[]),i=L0(al,i,s),s=Ze,(mn===null?s.memoizedState:mn.next)===null&&(s=s.alternate,P.H=s===null||s.memoizedState===null?Sv:zh),i}function Su(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return ko(i);if(i.$$typeof===C)return En(i)}throw Error(r(438,String(i)))}function Sh(i){var s=null,c=Ze.updateQueue;if(c!==null&&(s=c.memoCache),s==null){var d=Ze.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(s={data:d.data.map(function(g){return g.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),c===null&&(c=ku(),Ze.updateQueue=c),c.memoCache=s,c=s.data[s.index],c===void 0)for(c=s.data[s.index]=Array(i),d=0;d<i;d++)c[d]=z;return s.index++,c}function Ti(i,s){return typeof s=="function"?s(i):s}function ju(i){var s=un();return jh(s,Dt,i)}function jh(i,s,c){var d=i.queue;if(d===null)throw Error(r(311));d.lastRenderedReducer=c;var g=i.baseQueue,v=d.pending;if(v!==null){if(g!==null){var w=g.next;g.next=v.next,v.next=w}s.baseQueue=g=v,d.pending=null}if(v=i.baseState,g===null)i.memoizedState=v;else{s=g.next;var T=w=null,U=null,ee=s,ce=!1;do{var fe=ee.lane&-536870913;if(fe!==ee.lane?(ut&fe)===fe:(Ei&fe)===fe){var ne=ee.revertLane;if(ne===0)U!==null&&(U=U.next={lane:0,revertLane:0,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null}),fe===el&&(ce=!0);else if((Ei&ne)===ne){ee=ee.next,ne===el&&(ce=!0);continue}else fe={lane:0,revertLane:ee.revertLane,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},U===null?(T=U=fe,w=v):U=U.next=fe,Ze.lanes|=ne,ys|=ne;fe=ee.action,ca&&c(v,fe),v=ee.hasEagerState?ee.eagerState:c(v,fe)}else ne={lane:fe,revertLane:ee.revertLane,gesture:ee.gesture,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},U===null?(T=U=ne,w=v):U=U.next=ne,Ze.lanes|=fe,ys|=fe;ee=ee.next}while(ee!==null&&ee!==s);if(U===null?w=v:U.next=T,!dr(v,i.memoizedState)&&(gn=!0,ce&&(c=tl,c!==null)))throw c;i.memoizedState=v,i.baseState=w,i.baseQueue=U,d.lastRenderedState=v}return g===null&&(d.lanes=0),[i.memoizedState,d.dispatch]}function Nh(i){var s=un(),c=s.queue;if(c===null)throw Error(r(311));c.lastRenderedReducer=i;var d=c.dispatch,g=c.pending,v=s.memoizedState;if(g!==null){c.pending=null;var w=g=g.next;do v=i(v,w.action),w=w.next;while(w!==g);dr(v,s.memoizedState)||(gn=!0),s.memoizedState=v,s.baseQueue===null&&(s.baseState=v),c.lastRenderedState=v}return[v,d]}function I0(i,s,c){var d=Ze,g=un(),v=ht;if(v){if(c===void 0)throw Error(r(407));c=c()}else c=s();var w=!dr((Dt||g).memoizedState,c);if(w&&(g.memoizedState=c,gn=!0),g=g.queue,Th(Y0.bind(null,d,g,i),[i]),g.getSnapshot!==s||w||mn!==null&&mn.memoizedState.tag&1){if(d.flags|=2048,ll(9,{destroy:void 0},G0.bind(null,d,g,c,s),null),$t===null)throw Error(r(349));v||(Ei&127)!==0||V0(d,s,c)}return c}function V0(i,s,c){i.flags|=16384,i={getSnapshot:s,value:c},s=Ze.updateQueue,s===null?(s=ku(),Ze.updateQueue=s,s.stores=[i]):(c=s.stores,c===null?s.stores=[i]:c.push(i))}function G0(i,s,c,d){s.value=c,s.getSnapshot=d,W0(s)&&Q0(i)}function Y0(i,s,c){return c(function(){W0(s)&&Q0(i)})}function W0(i){var s=i.getSnapshot;i=i.value;try{var c=s();return!dr(i,c)}catch{return!0}}function Q0(i){var s=ea(i,2);s!==null&&rr(s,i,2)}function Ch(i){var s=In();if(typeof i=="function"){var c=i;if(i=c(),ca){yn(!0);try{c()}finally{yn(!1)}}}return s.memoizedState=s.baseState=i,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ti,lastRenderedState:i},s}function X0(i,s,c,d){return i.baseState=c,jh(i,Dt,typeof d=="function"?d:Ti)}function sj(i,s,c,d,g){if(Eu(i))throw Error(r(485));if(i=s.action,i!==null){var v={payload:g,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){v.listeners.push(w)}};P.T!==null?c(!0):v.isTransition=!1,d(v),c=s.pending,c===null?(v.next=s.pending=v,K0(s,v)):(v.next=c.next,s.pending=c.next=v)}}function K0(i,s){var c=s.action,d=s.payload,g=i.state;if(s.isTransition){var v=P.T,w={};P.T=w;try{var T=c(g,d),U=P.S;U!==null&&U(w,T),Z0(i,s,T)}catch(ee){Eh(i,s,ee)}finally{v!==null&&w.types!==null&&(v.types=w.types),P.T=v}}else try{v=c(g,d),Z0(i,s,v)}catch(ee){Eh(i,s,ee)}}function Z0(i,s,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(d){J0(i,s,d)},function(d){return Eh(i,s,d)}):J0(i,s,c)}function J0(i,s,c){s.status="fulfilled",s.value=c,ev(s),i.state=c,s=i.pending,s!==null&&(c=s.next,c===s?i.pending=null:(c=c.next,s.next=c,K0(i,c)))}function Eh(i,s,c){var d=i.pending;if(i.pending=null,d!==null){d=d.next;do s.status="rejected",s.reason=c,ev(s),s=s.next;while(s!==d)}i.action=null}function ev(i){i=i.listeners;for(var s=0;s<i.length;s++)(0,i[s])()}function tv(i,s){return s}function nv(i,s){if(ht){var c=$t.formState;if(c!==null){e:{var d=Ze;if(ht){if(Gt){t:{for(var g=Gt,v=Dr;g.nodeType!==8;){if(!v){g=null;break t}if(g=Or(g.nextSibling),g===null){g=null;break t}}v=g.data,g=v==="F!"||v==="F"?g:null}if(g){Gt=Or(g.nextSibling),d=g.data==="F!";break e}}ds(d)}d=!1}d&&(s=c[0])}}return c=In(),c.memoizedState=c.baseState=s,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:tv,lastRenderedState:s},c.queue=d,c=_v.bind(null,Ze,d),d.dispatch=c,d=Ch(!1),v=Dh.bind(null,Ze,!1,d.queue),d=In(),g={state:s,dispatch:null,action:i,pending:null},d.queue=g,c=sj.bind(null,Ze,g,v,c),g.dispatch=c,d.memoizedState=i,[s,c,!1]}function rv(i){var s=un();return iv(s,Dt,i)}function iv(i,s,c){if(s=jh(i,s,tv)[0],i=ju(Ti)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var d=ko(s)}catch(w){throw w===nl?mu:w}else d=s;s=un();var g=s.queue,v=g.dispatch;return c!==s.memoizedState&&(Ze.flags|=2048,ll(9,{destroy:void 0},aj.bind(null,g,c),null)),[d,v,i]}function aj(i,s){i.action=s}function sv(i){var s=un(),c=Dt;if(c!==null)return iv(s,c,i);un(),s=s.memoizedState,c=un();var d=c.queue.dispatch;return c.memoizedState=i,[s,d,!1]}function ll(i,s,c,d){return i={tag:i,create:c,deps:d,inst:s,next:null},s=Ze.updateQueue,s===null&&(s=ku(),Ze.updateQueue=s),c=s.lastEffect,c===null?s.lastEffect=i.next=i:(d=c.next,c.next=i,i.next=d,s.lastEffect=i),i}function av(){return un().memoizedState}function Nu(i,s,c,d){var g=In();Ze.flags|=i,g.memoizedState=ll(1|s,{destroy:void 0},c,d===void 0?null:d)}function Cu(i,s,c,d){var g=un();d=d===void 0?null:d;var v=g.memoizedState.inst;Dt!==null&&d!==null&&bh(d,Dt.memoizedState.deps)?g.memoizedState=ll(s,v,c,d):(Ze.flags|=i,g.memoizedState=ll(1|s,v,c,d))}function lv(i,s){Nu(8390656,8,i,s)}function Th(i,s){Cu(2048,8,i,s)}function lj(i){Ze.flags|=4;var s=Ze.updateQueue;if(s===null)s=ku(),Ze.updateQueue=s,s.events=[i];else{var c=s.events;c===null?s.events=[i]:c.push(i)}}function ov(i){var s=un().memoizedState;return lj({ref:s,nextImpl:i}),function(){if((kt&2)!==0)throw Error(r(440));return s.impl.apply(void 0,arguments)}}function cv(i,s){return Cu(4,2,i,s)}function uv(i,s){return Cu(4,4,i,s)}function dv(i,s){if(typeof s=="function"){i=i();var c=s(i);return function(){typeof c=="function"?c():s(null)}}if(s!=null)return i=i(),s.current=i,function(){s.current=null}}function fv(i,s,c){c=c!=null?c.concat([i]):null,Cu(4,4,dv.bind(null,s,i),c)}function Ah(){}function hv(i,s){var c=un();s=s===void 0?null:s;var d=c.memoizedState;return s!==null&&bh(s,d[1])?d[0]:(c.memoizedState=[i,s],i)}function pv(i,s){var c=un();s=s===void 0?null:s;var d=c.memoizedState;if(s!==null&&bh(s,d[1]))return d[0];if(d=i(),ca){yn(!0);try{i()}finally{yn(!1)}}return c.memoizedState=[d,s],d}function Mh(i,s,c){return c===void 0||(Ei&1073741824)!==0&&(ut&261930)===0?i.memoizedState=s:(i.memoizedState=c,i=m1(),Ze.lanes|=i,ys|=i,c)}function mv(i,s,c,d){return dr(c,s)?c:il.current!==null?(i=Mh(i,c,d),dr(i,s)||(gn=!0),i):(Ei&42)===0||(Ei&1073741824)!==0&&(ut&261930)===0?(gn=!0,i.memoizedState=c):(i=m1(),Ze.lanes|=i,ys|=i,s)}function gv(i,s,c,d,g){var v=$.p;$.p=v!==0&&8>v?v:8;var w=P.T,T={};P.T=T,Dh(i,!1,s,c);try{var U=g(),ee=P.S;if(ee!==null&&ee(T,U),U!==null&&typeof U=="object"&&typeof U.then=="function"){var ce=nj(U,d);So(i,s,ce,xr(i))}else So(i,s,d,xr(i))}catch(fe){So(i,s,{then:function(){},status:"rejected",reason:fe},xr())}finally{$.p=v,w!==null&&T.types!==null&&(w.types=T.types),P.T=w}}function oj(){}function Rh(i,s,c,d){if(i.tag!==5)throw Error(r(476));var g=xv(i).queue;gv(i,g,s,se,c===null?oj:function(){return vv(i),c(d)})}function xv(i){var s=i.memoizedState;if(s!==null)return s;s={memoizedState:se,baseState:se,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ti,lastRenderedState:se},next:null};var c={};return s.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ti,lastRenderedState:c},next:null},i.memoizedState=s,i=i.alternate,i!==null&&(i.memoizedState=s),s}function vv(i){var s=xv(i);s.next===null&&(s=i.alternate.memoizedState),So(i,s.next.queue,{},xr())}function Lh(){return En(Uo)}function bv(){return un().memoizedState}function yv(){return un().memoizedState}function cj(i){for(var s=i.return;s!==null;){switch(s.tag){case 24:case 3:var c=xr();i=ps(c);var d=ms(s,i,c);d!==null&&(rr(d,s,c),bo(d,s,c)),s={cache:oh()},i.payload=s;return}s=s.return}}function uj(i,s,c){var d=xr();c={lane:d,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Eu(i)?wv(s,c):(c=Kf(i,s,c,d),c!==null&&(rr(c,i,d),kv(c,s,d)))}function _v(i,s,c){var d=xr();So(i,s,c,d)}function So(i,s,c,d){var g={lane:d,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(Eu(i))wv(s,g);else{var v=i.alternate;if(i.lanes===0&&(v===null||v.lanes===0)&&(v=s.lastRenderedReducer,v!==null))try{var w=s.lastRenderedState,T=v(w,c);if(g.hasEagerState=!0,g.eagerState=T,dr(T,w))return ou(i,s,g,0),$t===null&&lu(),!1}catch{}finally{}if(c=Kf(i,s,g,d),c!==null)return rr(c,i,d),kv(c,s,d),!0}return!1}function Dh(i,s,c,d){if(d={lane:2,revertLane:fp(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},Eu(i)){if(s)throw Error(r(479))}else s=Kf(i,c,d,2),s!==null&&rr(s,i,2)}function Eu(i){var s=i.alternate;return i===Ze||s!==null&&s===Ze}function wv(i,s){sl=_u=!0;var c=i.pending;c===null?s.next=s:(s.next=c.next,c.next=s),i.pending=s}function kv(i,s,c){if((c&4194048)!==0){var d=s.lanes;d&=i.pendingLanes,c|=d,s.lanes=c,Da(i,c)}}var jo={readContext:En,use:Su,useCallback:sn,useContext:sn,useEffect:sn,useImperativeHandle:sn,useLayoutEffect:sn,useInsertionEffect:sn,useMemo:sn,useReducer:sn,useRef:sn,useState:sn,useDebugValue:sn,useDeferredValue:sn,useTransition:sn,useSyncExternalStore:sn,useId:sn,useHostTransitionStatus:sn,useFormState:sn,useActionState:sn,useOptimistic:sn,useMemoCache:sn,useCacheRefresh:sn};jo.useEffectEvent=sn;var Sv={readContext:En,use:Su,useCallback:function(i,s){return In().memoizedState=[i,s===void 0?null:s],i},useContext:En,useEffect:lv,useImperativeHandle:function(i,s,c){c=c!=null?c.concat([i]):null,Nu(4194308,4,dv.bind(null,s,i),c)},useLayoutEffect:function(i,s){return Nu(4194308,4,i,s)},useInsertionEffect:function(i,s){Nu(4,2,i,s)},useMemo:function(i,s){var c=In();s=s===void 0?null:s;var d=i();if(ca){yn(!0);try{i()}finally{yn(!1)}}return c.memoizedState=[d,s],d},useReducer:function(i,s,c){var d=In();if(c!==void 0){var g=c(s);if(ca){yn(!0);try{c(s)}finally{yn(!1)}}}else g=s;return d.memoizedState=d.baseState=g,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:g},d.queue=i,i=i.dispatch=uj.bind(null,Ze,i),[d.memoizedState,i]},useRef:function(i){var s=In();return i={current:i},s.memoizedState=i},useState:function(i){i=Ch(i);var s=i.queue,c=_v.bind(null,Ze,s);return s.dispatch=c,[i.memoizedState,c]},useDebugValue:Ah,useDeferredValue:function(i,s){var c=In();return Mh(c,i,s)},useTransition:function(){var i=Ch(!1);return i=gv.bind(null,Ze,i.queue,!0,!1),In().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,s,c){var d=Ze,g=In();if(ht){if(c===void 0)throw Error(r(407));c=c()}else{if(c=s(),$t===null)throw Error(r(349));(ut&127)!==0||V0(d,s,c)}g.memoizedState=c;var v={value:c,getSnapshot:s};return g.queue=v,lv(Y0.bind(null,d,v,i),[i]),d.flags|=2048,ll(9,{destroy:void 0},G0.bind(null,d,v,c,s),null),c},useId:function(){var i=In(),s=$t.identifierPrefix;if(ht){var c=oi,d=li;c=(d&~(1<<32-et(d)-1)).toString(32)+c,s="_"+s+"R_"+c,c=wu++,0<c&&(s+="H"+c.toString(32)),s+="_"}else c=rj++,s="_"+s+"r_"+c.toString(32)+"_";return i.memoizedState=s},useHostTransitionStatus:Lh,useFormState:nv,useActionState:nv,useOptimistic:function(i){var s=In();s.memoizedState=s.baseState=i;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=c,s=Dh.bind(null,Ze,!0,c),c.dispatch=s,[i,s]},useMemoCache:Sh,useCacheRefresh:function(){return In().memoizedState=cj.bind(null,Ze)},useEffectEvent:function(i){var s=In(),c={impl:i};return s.memoizedState=c,function(){if((kt&2)!==0)throw Error(r(440));return c.impl.apply(void 0,arguments)}}},zh={readContext:En,use:Su,useCallback:hv,useContext:En,useEffect:Th,useImperativeHandle:fv,useInsertionEffect:cv,useLayoutEffect:uv,useMemo:pv,useReducer:ju,useRef:av,useState:function(){return ju(Ti)},useDebugValue:Ah,useDeferredValue:function(i,s){var c=un();return mv(c,Dt.memoizedState,i,s)},useTransition:function(){var i=ju(Ti)[0],s=un().memoizedState;return[typeof i=="boolean"?i:ko(i),s]},useSyncExternalStore:I0,useId:bv,useHostTransitionStatus:Lh,useFormState:rv,useActionState:rv,useOptimistic:function(i,s){var c=un();return X0(c,Dt,i,s)},useMemoCache:Sh,useCacheRefresh:yv};zh.useEffectEvent=ov;var jv={readContext:En,use:Su,useCallback:hv,useContext:En,useEffect:Th,useImperativeHandle:fv,useInsertionEffect:cv,useLayoutEffect:uv,useMemo:pv,useReducer:Nh,useRef:av,useState:function(){return Nh(Ti)},useDebugValue:Ah,useDeferredValue:function(i,s){var c=un();return Dt===null?Mh(c,i,s):mv(c,Dt.memoizedState,i,s)},useTransition:function(){var i=Nh(Ti)[0],s=un().memoizedState;return[typeof i=="boolean"?i:ko(i),s]},useSyncExternalStore:I0,useId:bv,useHostTransitionStatus:Lh,useFormState:sv,useActionState:sv,useOptimistic:function(i,s){var c=un();return Dt!==null?X0(c,Dt,i,s):(c.baseState=i,[i,c.queue.dispatch])},useMemoCache:Sh,useCacheRefresh:yv};jv.useEffectEvent=ov;function Oh(i,s,c,d){s=i.memoizedState,c=c(d,s),c=c==null?s:x({},s,c),i.memoizedState=c,i.lanes===0&&(i.updateQueue.baseState=c)}var Bh={enqueueSetState:function(i,s,c){i=i._reactInternals;var d=xr(),g=ps(d);g.payload=s,c!=null&&(g.callback=c),s=ms(i,g,d),s!==null&&(rr(s,i,d),bo(s,i,d))},enqueueReplaceState:function(i,s,c){i=i._reactInternals;var d=xr(),g=ps(d);g.tag=1,g.payload=s,c!=null&&(g.callback=c),s=ms(i,g,d),s!==null&&(rr(s,i,d),bo(s,i,d))},enqueueForceUpdate:function(i,s){i=i._reactInternals;var c=xr(),d=ps(c);d.tag=2,s!=null&&(d.callback=s),s=ms(i,d,c),s!==null&&(rr(s,i,c),bo(s,i,c))}};function Nv(i,s,c,d,g,v,w){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(d,v,w):s.prototype&&s.prototype.isPureReactComponent?!uo(c,d)||!uo(g,v):!0}function Cv(i,s,c,d){i=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(c,d),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(c,d),s.state!==i&&Bh.enqueueReplaceState(s,s.state,null)}function ua(i,s){var c=s;if("ref"in s){c={};for(var d in s)d!=="ref"&&(c[d]=s[d])}if(i=i.defaultProps){c===s&&(c=x({},c));for(var g in i)c[g]===void 0&&(c[g]=i[g])}return c}function Ev(i){au(i)}function Tv(i){console.error(i)}function Av(i){au(i)}function Tu(i,s){try{var c=i.onUncaughtError;c(s.value,{componentStack:s.stack})}catch(d){setTimeout(function(){throw d})}}function Mv(i,s,c){try{var d=i.onCaughtError;d(c.value,{componentStack:c.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(g){setTimeout(function(){throw g})}}function Ph(i,s,c){return c=ps(c),c.tag=3,c.payload={element:null},c.callback=function(){Tu(i,s)},c}function Rv(i){return i=ps(i),i.tag=3,i}function Lv(i,s,c,d){var g=c.type.getDerivedStateFromError;if(typeof g=="function"){var v=d.value;i.payload=function(){return g(v)},i.callback=function(){Mv(s,c,d)}}var w=c.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(i.callback=function(){Mv(s,c,d),typeof g!="function"&&(_s===null?_s=new Set([this]):_s.add(this));var T=d.stack;this.componentDidCatch(d.value,{componentStack:T!==null?T:""})})}function dj(i,s,c,d,g){if(c.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(s=c.alternate,s!==null&&Ja(s,c,g,!0),c=hr.current,c!==null){switch(c.tag){case 31:case 13:return zr===null?Uu():c.alternate===null&&an===0&&(an=3),c.flags&=-257,c.flags|=65536,c.lanes=g,d===gu?c.flags|=16384:(s=c.updateQueue,s===null?c.updateQueue=new Set([d]):s.add(d),cp(i,d,g)),!1;case 22:return c.flags|=65536,d===gu?c.flags|=16384:(s=c.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([d])},c.updateQueue=s):(c=s.retryQueue,c===null?s.retryQueue=new Set([d]):c.add(d)),cp(i,d,g)),!1}throw Error(r(435,c.tag))}return cp(i,d,g),Uu(),!1}if(ht)return s=hr.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=g,d!==rh&&(i=Error(r(422),{cause:d}),po(Mr(i,c)))):(d!==rh&&(s=Error(r(423),{cause:d}),po(Mr(s,c))),i=i.current.alternate,i.flags|=65536,g&=-g,i.lanes|=g,d=Mr(d,c),g=Ph(i.stateNode,d,g),ph(i,g),an!==4&&(an=2)),!1;var v=Error(r(520),{cause:d});if(v=Mr(v,c),Lo===null?Lo=[v]:Lo.push(v),an!==4&&(an=2),s===null)return!0;d=Mr(d,c),c=s;do{switch(c.tag){case 3:return c.flags|=65536,i=g&-g,c.lanes|=i,i=Ph(c.stateNode,d,i),ph(c,i),!1;case 1:if(s=c.type,v=c.stateNode,(c.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(_s===null||!_s.has(v))))return c.flags|=65536,g&=-g,c.lanes|=g,g=Rv(g),Lv(g,i,c,d),ph(c,g),!1}c=c.return}while(c!==null);return!1}var $h=Error(r(461)),gn=!1;function Tn(i,s,c,d){s.child=i===null?B0(s,null,c,d):oa(s,i.child,c,d)}function Dv(i,s,c,d,g){c=c.render;var v=s.ref;if("ref"in d){var w={};for(var T in d)T!=="ref"&&(w[T]=d[T])}else w=d;return ia(s),d=yh(i,s,c,w,v,g),T=_h(),i!==null&&!gn?(wh(i,s,g),Ai(i,s,g)):(ht&&T&&th(s),s.flags|=1,Tn(i,s,d,g),s.child)}function zv(i,s,c,d,g){if(i===null){var v=c.type;return typeof v=="function"&&!Zf(v)&&v.defaultProps===void 0&&c.compare===null?(s.tag=15,s.type=v,Ov(i,s,v,d,g)):(i=uu(c.type,null,d,s,s.mode,g),i.ref=s.ref,i.return=s,s.child=i)}if(v=i.child,!Yh(i,g)){var w=v.memoizedProps;if(c=c.compare,c=c!==null?c:uo,c(w,d)&&i.ref===s.ref)return Ai(i,s,g)}return s.flags|=1,i=Si(v,d),i.ref=s.ref,i.return=s,s.child=i}function Ov(i,s,c,d,g){if(i!==null){var v=i.memoizedProps;if(uo(v,d)&&i.ref===s.ref)if(gn=!1,s.pendingProps=d=v,Yh(i,g))(i.flags&131072)!==0&&(gn=!0);else return s.lanes=i.lanes,Ai(i,s,g)}return Fh(i,s,c,d,g)}function Bv(i,s,c,d){var g=d.children,v=i!==null?i.memoizedState:null;if(i===null&&s.stateNode===null&&(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((s.flags&128)!==0){if(v=v!==null?v.baseLanes|c:c,i!==null){for(d=s.child=i.child,g=0;d!==null;)g=g|d.lanes|d.childLanes,d=d.sibling;d=g&~v}else d=0,s.child=null;return Pv(i,s,v,c,d)}if((c&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},i!==null&&pu(s,v!==null?v.cachePool:null),v!==null?F0(s,v):gh(),U0(s);else return d=s.lanes=536870912,Pv(i,s,v!==null?v.baseLanes|c:c,c,d)}else v!==null?(pu(s,v.cachePool),F0(s,v),xs(),s.memoizedState=null):(i!==null&&pu(s,null),gh(),xs());return Tn(i,s,g,c),s.child}function No(i,s){return i!==null&&i.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function Pv(i,s,c,d,g){var v=uh();return v=v===null?null:{parent:pn._currentValue,pool:v},s.memoizedState={baseLanes:c,cachePool:v},i!==null&&pu(s,null),gh(),U0(s),i!==null&&Ja(i,s,d,!0),s.childLanes=g,null}function Au(i,s){return s=Ru({mode:s.mode,children:s.children},i.mode),s.ref=i.ref,i.child=s,s.return=i,s}function $v(i,s,c){return oa(s,i.child,null,c),i=Au(s,s.pendingProps),i.flags|=2,pr(s),s.memoizedState=null,i}function fj(i,s,c){var d=s.pendingProps,g=(s.flags&128)!==0;if(s.flags&=-129,i===null){if(ht){if(d.mode==="hidden")return i=Au(s,d),s.lanes=536870912,No(null,i);if(vh(s),(i=Gt)?(i=K1(i,Dr),i=i!==null&&i.data==="&"?i:null,i!==null&&(s.memoizedState={dehydrated:i,treeContext:cs!==null?{id:li,overflow:oi}:null,retryLane:536870912,hydrationErrors:null},c=w0(i),c.return=s,s.child=c,Cn=s,Gt=null)):i=null,i===null)throw ds(s);return s.lanes=536870912,null}return Au(s,d)}var v=i.memoizedState;if(v!==null){var w=v.dehydrated;if(vh(s),g)if(s.flags&256)s.flags&=-257,s=$v(i,s,c);else if(s.memoizedState!==null)s.child=i.child,s.flags|=128,s=null;else throw Error(r(558));else if(gn||Ja(i,s,c,!1),g=(c&i.childLanes)!==0,gn||g){if(d=$t,d!==null&&(w=Xl(d,c),w!==0&&w!==v.retryLane))throw v.retryLane=w,ea(i,w),rr(d,i,w),$h;Uu(),s=$v(i,s,c)}else i=v.treeContext,Gt=Or(w.nextSibling),Cn=s,ht=!0,us=null,Dr=!1,i!==null&&j0(s,i),s=Au(s,d),s.flags|=4096;return s}return i=Si(i.child,{mode:d.mode,children:d.children}),i.ref=s.ref,s.child=i,i.return=s,i}function Mu(i,s){var c=s.ref;if(c===null)i!==null&&i.ref!==null&&(s.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(r(284));(i===null||i.ref!==c)&&(s.flags|=4194816)}}function Fh(i,s,c,d,g){return ia(s),c=yh(i,s,c,d,void 0,g),d=_h(),i!==null&&!gn?(wh(i,s,g),Ai(i,s,g)):(ht&&d&&th(s),s.flags|=1,Tn(i,s,c,g),s.child)}function Fv(i,s,c,d,g,v){return ia(s),s.updateQueue=null,c=H0(s,d,c,g),q0(i),d=_h(),i!==null&&!gn?(wh(i,s,v),Ai(i,s,v)):(ht&&d&&th(s),s.flags|=1,Tn(i,s,c,v),s.child)}function Uv(i,s,c,d,g){if(ia(s),s.stateNode===null){var v=Qa,w=c.contextType;typeof w=="object"&&w!==null&&(v=En(w)),v=new c(d,v),s.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,v.updater=Bh,s.stateNode=v,v._reactInternals=s,v=s.stateNode,v.props=d,v.state=s.memoizedState,v.refs={},fh(s),w=c.contextType,v.context=typeof w=="object"&&w!==null?En(w):Qa,v.state=s.memoizedState,w=c.getDerivedStateFromProps,typeof w=="function"&&(Oh(s,c,w,d),v.state=s.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(w=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),w!==v.state&&Bh.enqueueReplaceState(v,v.state,null),_o(s,d,v,g),yo(),v.state=s.memoizedState),typeof v.componentDidMount=="function"&&(s.flags|=4194308),d=!0}else if(i===null){v=s.stateNode;var T=s.memoizedProps,U=ua(c,T);v.props=U;var ee=v.context,ce=c.contextType;w=Qa,typeof ce=="object"&&ce!==null&&(w=En(ce));var fe=c.getDerivedStateFromProps;ce=typeof fe=="function"||typeof v.getSnapshotBeforeUpdate=="function",T=s.pendingProps!==T,ce||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(T||ee!==w)&&Cv(s,v,d,w),hs=!1;var ne=s.memoizedState;v.state=ne,_o(s,d,v,g),yo(),ee=s.memoizedState,T||ne!==ee||hs?(typeof fe=="function"&&(Oh(s,c,fe,d),ee=s.memoizedState),(U=hs||Nv(s,c,U,d,ne,ee,w))?(ce||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"&&(s.flags|=4194308)):(typeof v.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=d,s.memoizedState=ee),v.props=d,v.state=ee,v.context=w,d=U):(typeof v.componentDidMount=="function"&&(s.flags|=4194308),d=!1)}else{v=s.stateNode,hh(i,s),w=s.memoizedProps,ce=ua(c,w),v.props=ce,fe=s.pendingProps,ne=v.context,ee=c.contextType,U=Qa,typeof ee=="object"&&ee!==null&&(U=En(ee)),T=c.getDerivedStateFromProps,(ee=typeof T=="function"||typeof v.getSnapshotBeforeUpdate=="function")||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(w!==fe||ne!==U)&&Cv(s,v,d,U),hs=!1,ne=s.memoizedState,v.state=ne,_o(s,d,v,g),yo();var le=s.memoizedState;w!==fe||ne!==le||hs||i!==null&&i.dependencies!==null&&fu(i.dependencies)?(typeof T=="function"&&(Oh(s,c,T,d),le=s.memoizedState),(ce=hs||Nv(s,c,ce,d,ne,le,U)||i!==null&&i.dependencies!==null&&fu(i.dependencies))?(ee||typeof v.UNSAFE_componentWillUpdate!="function"&&typeof v.componentWillUpdate!="function"||(typeof v.componentWillUpdate=="function"&&v.componentWillUpdate(d,le,U),typeof v.UNSAFE_componentWillUpdate=="function"&&v.UNSAFE_componentWillUpdate(d,le,U)),typeof v.componentDidUpdate=="function"&&(s.flags|=4),typeof v.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof v.componentDidUpdate!="function"||w===i.memoizedProps&&ne===i.memoizedState||(s.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||w===i.memoizedProps&&ne===i.memoizedState||(s.flags|=1024),s.memoizedProps=d,s.memoizedState=le),v.props=d,v.state=le,v.context=U,d=ce):(typeof v.componentDidUpdate!="function"||w===i.memoizedProps&&ne===i.memoizedState||(s.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||w===i.memoizedProps&&ne===i.memoizedState||(s.flags|=1024),d=!1)}return v=d,Mu(i,s),d=(s.flags&128)!==0,v||d?(v=s.stateNode,c=d&&typeof c.getDerivedStateFromError!="function"?null:v.render(),s.flags|=1,i!==null&&d?(s.child=oa(s,i.child,null,g),s.child=oa(s,null,c,g)):Tn(i,s,c,g),s.memoizedState=v.state,i=s.child):i=Ai(i,s,g),i}function qv(i,s,c,d){return na(),s.flags|=256,Tn(i,s,c,d),s.child}var Uh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function qh(i){return{baseLanes:i,cachePool:M0()}}function Hh(i,s,c){return i=i!==null?i.childLanes&~c:0,s&&(i|=gr),i}function Hv(i,s,c){var d=s.pendingProps,g=!1,v=(s.flags&128)!==0,w;if((w=v)||(w=i!==null&&i.memoizedState===null?!1:(cn.current&2)!==0),w&&(g=!0,s.flags&=-129),w=(s.flags&32)!==0,s.flags&=-33,i===null){if(ht){if(g?gs(s):xs(),(i=Gt)?(i=K1(i,Dr),i=i!==null&&i.data!=="&"?i:null,i!==null&&(s.memoizedState={dehydrated:i,treeContext:cs!==null?{id:li,overflow:oi}:null,retryLane:536870912,hydrationErrors:null},c=w0(i),c.return=s,s.child=c,Cn=s,Gt=null)):i=null,i===null)throw ds(s);return jp(i)?s.lanes=32:s.lanes=536870912,null}var T=d.children;return d=d.fallback,g?(xs(),g=s.mode,T=Ru({mode:"hidden",children:T},g),d=ta(d,g,c,null),T.return=s,d.return=s,T.sibling=d,s.child=T,d=s.child,d.memoizedState=qh(c),d.childLanes=Hh(i,w,c),s.memoizedState=Uh,No(null,d)):(gs(s),Ih(s,T))}var U=i.memoizedState;if(U!==null&&(T=U.dehydrated,T!==null)){if(v)s.flags&256?(gs(s),s.flags&=-257,s=Vh(i,s,c)):s.memoizedState!==null?(xs(),s.child=i.child,s.flags|=128,s=null):(xs(),T=d.fallback,g=s.mode,d=Ru({mode:"visible",children:d.children},g),T=ta(T,g,c,null),T.flags|=2,d.return=s,T.return=s,d.sibling=T,s.child=d,oa(s,i.child,null,c),d=s.child,d.memoizedState=qh(c),d.childLanes=Hh(i,w,c),s.memoizedState=Uh,s=No(null,d));else if(gs(s),jp(T)){if(w=T.nextSibling&&T.nextSibling.dataset,w)var ee=w.dgst;w=ee,d=Error(r(419)),d.stack="",d.digest=w,po({value:d,source:null,stack:null}),s=Vh(i,s,c)}else if(gn||Ja(i,s,c,!1),w=(c&i.childLanes)!==0,gn||w){if(w=$t,w!==null&&(d=Xl(w,c),d!==0&&d!==U.retryLane))throw U.retryLane=d,ea(i,d),rr(w,i,d),$h;Sp(T)||Uu(),s=Vh(i,s,c)}else Sp(T)?(s.flags|=192,s.child=i.child,s=null):(i=U.treeContext,Gt=Or(T.nextSibling),Cn=s,ht=!0,us=null,Dr=!1,i!==null&&j0(s,i),s=Ih(s,d.children),s.flags|=4096);return s}return g?(xs(),T=d.fallback,g=s.mode,U=i.child,ee=U.sibling,d=Si(U,{mode:"hidden",children:d.children}),d.subtreeFlags=U.subtreeFlags&65011712,ee!==null?T=Si(ee,T):(T=ta(T,g,c,null),T.flags|=2),T.return=s,d.return=s,d.sibling=T,s.child=d,No(null,d),d=s.child,T=i.child.memoizedState,T===null?T=qh(c):(g=T.cachePool,g!==null?(U=pn._currentValue,g=g.parent!==U?{parent:U,pool:U}:g):g=M0(),T={baseLanes:T.baseLanes|c,cachePool:g}),d.memoizedState=T,d.childLanes=Hh(i,w,c),s.memoizedState=Uh,No(i.child,d)):(gs(s),c=i.child,i=c.sibling,c=Si(c,{mode:"visible",children:d.children}),c.return=s,c.sibling=null,i!==null&&(w=s.deletions,w===null?(s.deletions=[i],s.flags|=16):w.push(i)),s.child=c,s.memoizedState=null,c)}function Ih(i,s){return s=Ru({mode:"visible",children:s},i.mode),s.return=i,i.child=s}function Ru(i,s){return i=fr(22,i,null,s),i.lanes=0,i}function Vh(i,s,c){return oa(s,i.child,null,c),i=Ih(s,s.pendingProps.children),i.flags|=2,s.memoizedState=null,i}function Iv(i,s,c){i.lanes|=s;var d=i.alternate;d!==null&&(d.lanes|=s),ah(i.return,s,c)}function Gh(i,s,c,d,g,v){var w=i.memoizedState;w===null?i.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:d,tail:c,tailMode:g,treeForkCount:v}:(w.isBackwards=s,w.rendering=null,w.renderingStartTime=0,w.last=d,w.tail=c,w.tailMode=g,w.treeForkCount=v)}function Vv(i,s,c){var d=s.pendingProps,g=d.revealOrder,v=d.tail;d=d.children;var w=cn.current,T=(w&2)!==0;if(T?(w=w&1|2,s.flags|=128):w&=1,M(cn,w),Tn(i,s,d,c),d=ht?ho:0,!T&&i!==null&&(i.flags&128)!==0)e:for(i=s.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&Iv(i,c,s);else if(i.tag===19)Iv(i,c,s);else if(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;i=i.return}i.sibling.return=i.return,i=i.sibling}switch(g){case"forwards":for(c=s.child,g=null;c!==null;)i=c.alternate,i!==null&&yu(i)===null&&(g=c),c=c.sibling;c=g,c===null?(g=s.child,s.child=null):(g=c.sibling,c.sibling=null),Gh(s,!1,g,c,v,d);break;case"backwards":case"unstable_legacy-backwards":for(c=null,g=s.child,s.child=null;g!==null;){if(i=g.alternate,i!==null&&yu(i)===null){s.child=g;break}i=g.sibling,g.sibling=c,c=g,g=i}Gh(s,!0,c,null,v,d);break;case"together":Gh(s,!1,null,null,void 0,d);break;default:s.memoizedState=null}return s.child}function Ai(i,s,c){if(i!==null&&(s.dependencies=i.dependencies),ys|=s.lanes,(c&s.childLanes)===0)if(i!==null){if(Ja(i,s,c,!1),(c&s.childLanes)===0)return null}else return null;if(i!==null&&s.child!==i.child)throw Error(r(153));if(s.child!==null){for(i=s.child,c=Si(i,i.pendingProps),s.child=c,c.return=s;i.sibling!==null;)i=i.sibling,c=c.sibling=Si(i,i.pendingProps),c.return=s;c.sibling=null}return s.child}function Yh(i,s){return(i.lanes&s)!==0?!0:(i=i.dependencies,!!(i!==null&&fu(i)))}function hj(i,s,c){switch(s.tag){case 3:Ee(s,s.stateNode.containerInfo),fs(s,pn,i.memoizedState.cache),na();break;case 27:case 5:Je(s);break;case 4:Ee(s,s.stateNode.containerInfo);break;case 10:fs(s,s.type,s.memoizedProps.value);break;case 31:if(s.memoizedState!==null)return s.flags|=128,vh(s),null;break;case 13:var d=s.memoizedState;if(d!==null)return d.dehydrated!==null?(gs(s),s.flags|=128,null):(c&s.child.childLanes)!==0?Hv(i,s,c):(gs(s),i=Ai(i,s,c),i!==null?i.sibling:null);gs(s);break;case 19:var g=(i.flags&128)!==0;if(d=(c&s.childLanes)!==0,d||(Ja(i,s,c,!1),d=(c&s.childLanes)!==0),g){if(d)return Vv(i,s,c);s.flags|=128}if(g=s.memoizedState,g!==null&&(g.rendering=null,g.tail=null,g.lastEffect=null),M(cn,cn.current),d)break;return null;case 22:return s.lanes=0,Bv(i,s,c,s.pendingProps);case 24:fs(s,pn,i.memoizedState.cache)}return Ai(i,s,c)}function Gv(i,s,c){if(i!==null)if(i.memoizedProps!==s.pendingProps)gn=!0;else{if(!Yh(i,c)&&(s.flags&128)===0)return gn=!1,hj(i,s,c);gn=(i.flags&131072)!==0}else gn=!1,ht&&(s.flags&1048576)!==0&&S0(s,ho,s.index);switch(s.lanes=0,s.tag){case 16:e:{var d=s.pendingProps;if(i=aa(s.elementType),s.type=i,typeof i=="function")Zf(i)?(d=ua(i,d),s.tag=1,s=Uv(null,s,i,d,c)):(s.tag=0,s=Fh(null,s,i,d,c));else{if(i!=null){var g=i.$$typeof;if(g===O){s.tag=11,s=Dv(null,s,i,d,c);break e}else if(g===I){s.tag=14,s=zv(null,s,i,d,c);break e}}throw s=K(i)||i,Error(r(306,s,""))}}return s;case 0:return Fh(i,s,s.type,s.pendingProps,c);case 1:return d=s.type,g=ua(d,s.pendingProps),Uv(i,s,d,g,c);case 3:e:{if(Ee(s,s.stateNode.containerInfo),i===null)throw Error(r(387));d=s.pendingProps;var v=s.memoizedState;g=v.element,hh(i,s),_o(s,d,null,c);var w=s.memoizedState;if(d=w.cache,fs(s,pn,d),d!==v.cache&&lh(s,[pn],c,!0),yo(),d=w.element,v.isDehydrated)if(v={element:d,isDehydrated:!1,cache:w.cache},s.updateQueue.baseState=v,s.memoizedState=v,s.flags&256){s=qv(i,s,d,c);break e}else if(d!==g){g=Mr(Error(r(424)),s),po(g),s=qv(i,s,d,c);break e}else{switch(i=s.stateNode.containerInfo,i.nodeType){case 9:i=i.body;break;default:i=i.nodeName==="HTML"?i.ownerDocument.body:i}for(Gt=Or(i.firstChild),Cn=s,ht=!0,us=null,Dr=!0,c=B0(s,null,d,c),s.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling}else{if(na(),d===g){s=Ai(i,s,c);break e}Tn(i,s,d,c)}s=s.child}return s;case 26:return Mu(i,s),i===null?(c=rb(s.type,null,s.pendingProps,null))?s.memoizedState=c:ht||(c=s.type,i=s.pendingProps,d=Wu(Ce.current).createElement(c),d[Zt]=s,d[Nn]=i,An(d,c,i),tn(d),s.stateNode=d):s.memoizedState=rb(s.type,i.memoizedProps,s.pendingProps,i.memoizedState),null;case 27:return Je(s),i===null&&ht&&(d=s.stateNode=eb(s.type,s.pendingProps,Ce.current),Cn=s,Dr=!0,g=Gt,js(s.type)?(Np=g,Gt=Or(d.firstChild)):Gt=g),Tn(i,s,s.pendingProps.children,c),Mu(i,s),i===null&&(s.flags|=4194304),s.child;case 5:return i===null&&ht&&((g=d=Gt)&&(d=Hj(d,s.type,s.pendingProps,Dr),d!==null?(s.stateNode=d,Cn=s,Gt=Or(d.firstChild),Dr=!1,g=!0):g=!1),g||ds(s)),Je(s),g=s.type,v=s.pendingProps,w=i!==null?i.memoizedProps:null,d=v.children,_p(g,v)?d=null:w!==null&&_p(g,w)&&(s.flags|=32),s.memoizedState!==null&&(g=yh(i,s,ij,null,null,c),Uo._currentValue=g),Mu(i,s),Tn(i,s,d,c),s.child;case 6:return i===null&&ht&&((i=c=Gt)&&(c=Ij(c,s.pendingProps,Dr),c!==null?(s.stateNode=c,Cn=s,Gt=null,i=!0):i=!1),i||ds(s)),null;case 13:return Hv(i,s,c);case 4:return Ee(s,s.stateNode.containerInfo),d=s.pendingProps,i===null?s.child=oa(s,null,d,c):Tn(i,s,d,c),s.child;case 11:return Dv(i,s,s.type,s.pendingProps,c);case 7:return Tn(i,s,s.pendingProps,c),s.child;case 8:return Tn(i,s,s.pendingProps.children,c),s.child;case 12:return Tn(i,s,s.pendingProps.children,c),s.child;case 10:return d=s.pendingProps,fs(s,s.type,d.value),Tn(i,s,d.children,c),s.child;case 9:return g=s.type._context,d=s.pendingProps.children,ia(s),g=En(g),d=d(g),s.flags|=1,Tn(i,s,d,c),s.child;case 14:return zv(i,s,s.type,s.pendingProps,c);case 15:return Ov(i,s,s.type,s.pendingProps,c);case 19:return Vv(i,s,c);case 31:return fj(i,s,c);case 22:return Bv(i,s,c,s.pendingProps);case 24:return ia(s),d=En(pn),i===null?(g=uh(),g===null&&(g=$t,v=oh(),g.pooledCache=v,v.refCount++,v!==null&&(g.pooledCacheLanes|=c),g=v),s.memoizedState={parent:d,cache:g},fh(s),fs(s,pn,g)):((i.lanes&c)!==0&&(hh(i,s),_o(s,null,null,c),yo()),g=i.memoizedState,v=s.memoizedState,g.parent!==d?(g={parent:d,cache:d},s.memoizedState=g,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=g),fs(s,pn,d)):(d=v.cache,fs(s,pn,d),d!==g.cache&&lh(s,[pn],c,!0))),Tn(i,s,s.pendingProps.children,c),s.child;case 29:throw s.pendingProps}throw Error(r(156,s.tag))}function Mi(i){i.flags|=4}function Wh(i,s,c,d,g){if((s=(i.mode&32)!==0)&&(s=!1),s){if(i.flags|=16777216,(g&335544128)===g)if(i.stateNode.complete)i.flags|=8192;else if(b1())i.flags|=8192;else throw la=gu,dh}else i.flags&=-16777217}function Yv(i,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!ob(s))if(b1())i.flags|=8192;else throw la=gu,dh}function Lu(i,s){s!==null&&(i.flags|=4),i.flags&16384&&(s=i.tag!==22?hn():536870912,i.lanes|=s,dl|=s)}function Co(i,s){if(!ht)switch(i.tailMode){case"hidden":s=i.tail;for(var c=null;s!==null;)s.alternate!==null&&(c=s),s=s.sibling;c===null?i.tail=null:c.sibling=null;break;case"collapsed":c=i.tail;for(var d=null;c!==null;)c.alternate!==null&&(d=c),c=c.sibling;d===null?s||i.tail===null?i.tail=null:i.tail.sibling=null:d.sibling=null}}function Yt(i){var s=i.alternate!==null&&i.alternate.child===i.child,c=0,d=0;if(s)for(var g=i.child;g!==null;)c|=g.lanes|g.childLanes,d|=g.subtreeFlags&65011712,d|=g.flags&65011712,g.return=i,g=g.sibling;else for(g=i.child;g!==null;)c|=g.lanes|g.childLanes,d|=g.subtreeFlags,d|=g.flags,g.return=i,g=g.sibling;return i.subtreeFlags|=d,i.childLanes=c,s}function pj(i,s,c){var d=s.pendingProps;switch(nh(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Yt(s),null;case 1:return Yt(s),null;case 3:return c=s.stateNode,d=null,i!==null&&(d=i.memoizedState.cache),s.memoizedState.cache!==d&&(s.flags|=2048),Ci(pn),Be(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(i===null||i.child===null)&&(Za(s)?Mi(s):i===null||i.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,ih())),Yt(s),null;case 26:var g=s.type,v=s.memoizedState;return i===null?(Mi(s),v!==null?(Yt(s),Yv(s,v)):(Yt(s),Wh(s,g,null,d,c))):v?v!==i.memoizedState?(Mi(s),Yt(s),Yv(s,v)):(Yt(s),s.flags&=-16777217):(i=i.memoizedProps,i!==d&&Mi(s),Yt(s),Wh(s,g,i,d,c)),null;case 27:if(Et(s),c=Ce.current,g=s.type,i!==null&&s.stateNode!=null)i.memoizedProps!==d&&Mi(s);else{if(!d){if(s.stateNode===null)throw Error(r(166));return Yt(s),null}i=pe.current,Za(s)?N0(s):(i=eb(g,d,c),s.stateNode=i,Mi(s))}return Yt(s),null;case 5:if(Et(s),g=s.type,i!==null&&s.stateNode!=null)i.memoizedProps!==d&&Mi(s);else{if(!d){if(s.stateNode===null)throw Error(r(166));return Yt(s),null}if(v=pe.current,Za(s))N0(s);else{var w=Wu(Ce.current);switch(v){case 1:v=w.createElementNS("http://www.w3.org/2000/svg",g);break;case 2:v=w.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;default:switch(g){case"svg":v=w.createElementNS("http://www.w3.org/2000/svg",g);break;case"math":v=w.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;case"script":v=w.createElement("div"),v.innerHTML="<script><\/script>",v=v.removeChild(v.firstChild);break;case"select":v=typeof d.is=="string"?w.createElement("select",{is:d.is}):w.createElement("select"),d.multiple?v.multiple=!0:d.size&&(v.size=d.size);break;default:v=typeof d.is=="string"?w.createElement(g,{is:d.is}):w.createElement(g)}}v[Zt]=s,v[Nn]=d;e:for(w=s.child;w!==null;){if(w.tag===5||w.tag===6)v.appendChild(w.stateNode);else if(w.tag!==4&&w.tag!==27&&w.child!==null){w.child.return=w,w=w.child;continue}if(w===s)break e;for(;w.sibling===null;){if(w.return===null||w.return===s)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}s.stateNode=v;e:switch(An(v,g,d),g){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}d&&Mi(s)}}return Yt(s),Wh(s,s.type,i===null?null:i.memoizedProps,s.pendingProps,c),null;case 6:if(i&&s.stateNode!=null)i.memoizedProps!==d&&Mi(s);else{if(typeof d!="string"&&s.stateNode===null)throw Error(r(166));if(i=Ce.current,Za(s)){if(i=s.stateNode,c=s.memoizedProps,d=null,g=Cn,g!==null)switch(g.tag){case 27:case 5:d=g.memoizedProps}i[Zt]=s,i=!!(i.nodeValue===c||d!==null&&d.suppressHydrationWarning===!0||H1(i.nodeValue,c)),i||ds(s,!0)}else i=Wu(i).createTextNode(d),i[Zt]=s,s.stateNode=i}return Yt(s),null;case 31:if(c=s.memoizedState,i===null||i.memoizedState!==null){if(d=Za(s),c!==null){if(i===null){if(!d)throw Error(r(318));if(i=s.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(557));i[Zt]=s}else na(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Yt(s),i=!1}else c=ih(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=c),i=!0;if(!i)return s.flags&256?(pr(s),s):(pr(s),null);if((s.flags&128)!==0)throw Error(r(558))}return Yt(s),null;case 13:if(d=s.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(g=Za(s),d!==null&&d.dehydrated!==null){if(i===null){if(!g)throw Error(r(318));if(g=s.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(r(317));g[Zt]=s}else na(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Yt(s),g=!1}else g=ih(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=g),g=!0;if(!g)return s.flags&256?(pr(s),s):(pr(s),null)}return pr(s),(s.flags&128)!==0?(s.lanes=c,s):(c=d!==null,i=i!==null&&i.memoizedState!==null,c&&(d=s.child,g=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(g=d.alternate.memoizedState.cachePool.pool),v=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(v=d.memoizedState.cachePool.pool),v!==g&&(d.flags|=2048)),c!==i&&c&&(s.child.flags|=8192),Lu(s,s.updateQueue),Yt(s),null);case 4:return Be(),i===null&&gp(s.stateNode.containerInfo),Yt(s),null;case 10:return Ci(s.type),Yt(s),null;case 19:if(Z(cn),d=s.memoizedState,d===null)return Yt(s),null;if(g=(s.flags&128)!==0,v=d.rendering,v===null)if(g)Co(d,!1);else{if(an!==0||i!==null&&(i.flags&128)!==0)for(i=s.child;i!==null;){if(v=yu(i),v!==null){for(s.flags|=128,Co(d,!1),i=v.updateQueue,s.updateQueue=i,Lu(s,i),s.subtreeFlags=0,i=c,c=s.child;c!==null;)_0(c,i),c=c.sibling;return M(cn,cn.current&1|2),ht&&ji(s,d.treeForkCount),s.child}i=i.sibling}d.tail!==null&&Te()>Pu&&(s.flags|=128,g=!0,Co(d,!1),s.lanes=4194304)}else{if(!g)if(i=yu(v),i!==null){if(s.flags|=128,g=!0,i=i.updateQueue,s.updateQueue=i,Lu(s,i),Co(d,!0),d.tail===null&&d.tailMode==="hidden"&&!v.alternate&&!ht)return Yt(s),null}else 2*Te()-d.renderingStartTime>Pu&&c!==536870912&&(s.flags|=128,g=!0,Co(d,!1),s.lanes=4194304);d.isBackwards?(v.sibling=s.child,s.child=v):(i=d.last,i!==null?i.sibling=v:s.child=v,d.last=v)}return d.tail!==null?(i=d.tail,d.rendering=i,d.tail=i.sibling,d.renderingStartTime=Te(),i.sibling=null,c=cn.current,M(cn,g?c&1|2:c&1),ht&&ji(s,d.treeForkCount),i):(Yt(s),null);case 22:case 23:return pr(s),xh(),d=s.memoizedState!==null,i!==null?i.memoizedState!==null!==d&&(s.flags|=8192):d&&(s.flags|=8192),d?(c&536870912)!==0&&(s.flags&128)===0&&(Yt(s),s.subtreeFlags&6&&(s.flags|=8192)):Yt(s),c=s.updateQueue,c!==null&&Lu(s,c.retryQueue),c=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(c=i.memoizedState.cachePool.pool),d=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(d=s.memoizedState.cachePool.pool),d!==c&&(s.flags|=2048),i!==null&&Z(sa),null;case 24:return c=null,i!==null&&(c=i.memoizedState.cache),s.memoizedState.cache!==c&&(s.flags|=2048),Ci(pn),Yt(s),null;case 25:return null;case 30:return null}throw Error(r(156,s.tag))}function mj(i,s){switch(nh(s),s.tag){case 1:return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 3:return Ci(pn),Be(),i=s.flags,(i&65536)!==0&&(i&128)===0?(s.flags=i&-65537|128,s):null;case 26:case 27:case 5:return Et(s),null;case 31:if(s.memoizedState!==null){if(pr(s),s.alternate===null)throw Error(r(340));na()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 13:if(pr(s),i=s.memoizedState,i!==null&&i.dehydrated!==null){if(s.alternate===null)throw Error(r(340));na()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 19:return Z(cn),null;case 4:return Be(),null;case 10:return Ci(s.type),null;case 22:case 23:return pr(s),xh(),i!==null&&Z(sa),i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 24:return Ci(pn),null;case 25:return null;default:return null}}function Wv(i,s){switch(nh(s),s.tag){case 3:Ci(pn),Be();break;case 26:case 27:case 5:Et(s);break;case 4:Be();break;case 31:s.memoizedState!==null&&pr(s);break;case 13:pr(s);break;case 19:Z(cn);break;case 10:Ci(s.type);break;case 22:case 23:pr(s),xh(),i!==null&&Z(sa);break;case 24:Ci(pn)}}function Eo(i,s){try{var c=s.updateQueue,d=c!==null?c.lastEffect:null;if(d!==null){var g=d.next;c=g;do{if((c.tag&i)===i){d=void 0;var v=c.create,w=c.inst;d=v(),w.destroy=d}c=c.next}while(c!==g)}}catch(T){Mt(s,s.return,T)}}function vs(i,s,c){try{var d=s.updateQueue,g=d!==null?d.lastEffect:null;if(g!==null){var v=g.next;d=v;do{if((d.tag&i)===i){var w=d.inst,T=w.destroy;if(T!==void 0){w.destroy=void 0,g=s;var U=c,ee=T;try{ee()}catch(ce){Mt(g,U,ce)}}}d=d.next}while(d!==v)}}catch(ce){Mt(s,s.return,ce)}}function Qv(i){var s=i.updateQueue;if(s!==null){var c=i.stateNode;try{$0(s,c)}catch(d){Mt(i,i.return,d)}}}function Xv(i,s,c){c.props=ua(i.type,i.memoizedProps),c.state=i.memoizedState;try{c.componentWillUnmount()}catch(d){Mt(i,s,d)}}function To(i,s){try{var c=i.ref;if(c!==null){switch(i.tag){case 26:case 27:case 5:var d=i.stateNode;break;case 30:d=i.stateNode;break;default:d=i.stateNode}typeof c=="function"?i.refCleanup=c(d):c.current=d}}catch(g){Mt(i,s,g)}}function ci(i,s){var c=i.ref,d=i.refCleanup;if(c!==null)if(typeof d=="function")try{d()}catch(g){Mt(i,s,g)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(g){Mt(i,s,g)}else c.current=null}function Kv(i){var s=i.type,c=i.memoizedProps,d=i.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":c.autoFocus&&d.focus();break e;case"img":c.src?d.src=c.src:c.srcSet&&(d.srcset=c.srcSet)}}catch(g){Mt(i,i.return,g)}}function Qh(i,s,c){try{var d=i.stateNode;Bj(d,i.type,c,s),d[Nn]=s}catch(g){Mt(i,i.return,g)}}function Zv(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&js(i.type)||i.tag===4}function Xh(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||Zv(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.tag===27&&js(i.type)||i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function Kh(i,s,c){var d=i.tag;if(d===5||d===6)i=i.stateNode,s?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(i,s):(s=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,s.appendChild(i),c=c._reactRootContainer,c!=null||s.onclick!==null||(s.onclick=Cr));else if(d!==4&&(d===27&&js(i.type)&&(c=i.stateNode,s=null),i=i.child,i!==null))for(Kh(i,s,c),i=i.sibling;i!==null;)Kh(i,s,c),i=i.sibling}function Du(i,s,c){var d=i.tag;if(d===5||d===6)i=i.stateNode,s?c.insertBefore(i,s):c.appendChild(i);else if(d!==4&&(d===27&&js(i.type)&&(c=i.stateNode),i=i.child,i!==null))for(Du(i,s,c),i=i.sibling;i!==null;)Du(i,s,c),i=i.sibling}function Jv(i){var s=i.stateNode,c=i.memoizedProps;try{for(var d=i.type,g=s.attributes;g.length;)s.removeAttributeNode(g[0]);An(s,d,c),s[Zt]=i,s[Nn]=c}catch(v){Mt(i,i.return,v)}}var Ri=!1,xn=!1,Zh=!1,e1=typeof WeakSet=="function"?WeakSet:Set,Sn=null;function gj(i,s){if(i=i.containerInfo,bp=td,i=f0(i),Vf(i)){if("selectionStart"in i)var c={start:i.selectionStart,end:i.selectionEnd};else e:{c=(c=i.ownerDocument)&&c.defaultView||window;var d=c.getSelection&&c.getSelection();if(d&&d.rangeCount!==0){c=d.anchorNode;var g=d.anchorOffset,v=d.focusNode;d=d.focusOffset;try{c.nodeType,v.nodeType}catch{c=null;break e}var w=0,T=-1,U=-1,ee=0,ce=0,fe=i,ne=null;t:for(;;){for(var le;fe!==c||g!==0&&fe.nodeType!==3||(T=w+g),fe!==v||d!==0&&fe.nodeType!==3||(U=w+d),fe.nodeType===3&&(w+=fe.nodeValue.length),(le=fe.firstChild)!==null;)ne=fe,fe=le;for(;;){if(fe===i)break t;if(ne===c&&++ee===g&&(T=w),ne===v&&++ce===d&&(U=w),(le=fe.nextSibling)!==null)break;fe=ne,ne=fe.parentNode}fe=le}c=T===-1||U===-1?null:{start:T,end:U}}else c=null}c=c||{start:0,end:0}}else c=null;for(yp={focusedElem:i,selectionRange:c},td=!1,Sn=s;Sn!==null;)if(s=Sn,i=s.child,(s.subtreeFlags&1028)!==0&&i!==null)i.return=s,Sn=i;else for(;Sn!==null;){switch(s=Sn,v=s.alternate,i=s.flags,s.tag){case 0:if((i&4)!==0&&(i=s.updateQueue,i=i!==null?i.events:null,i!==null))for(c=0;c<i.length;c++)g=i[c],g.ref.impl=g.nextImpl;break;case 11:case 15:break;case 1:if((i&1024)!==0&&v!==null){i=void 0,c=s,g=v.memoizedProps,v=v.memoizedState,d=c.stateNode;try{var Ae=ua(c.type,g);i=d.getSnapshotBeforeUpdate(Ae,v),d.__reactInternalSnapshotBeforeUpdate=i}catch(Ue){Mt(c,c.return,Ue)}}break;case 3:if((i&1024)!==0){if(i=s.stateNode.containerInfo,c=i.nodeType,c===9)kp(i);else if(c===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":kp(i);break;default:i.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((i&1024)!==0)throw Error(r(163))}if(i=s.sibling,i!==null){i.return=s.return,Sn=i;break}Sn=s.return}}function t1(i,s,c){var d=c.flags;switch(c.tag){case 0:case 11:case 15:Di(i,c),d&4&&Eo(5,c);break;case 1:if(Di(i,c),d&4)if(i=c.stateNode,s===null)try{i.componentDidMount()}catch(w){Mt(c,c.return,w)}else{var g=ua(c.type,s.memoizedProps);s=s.memoizedState;try{i.componentDidUpdate(g,s,i.__reactInternalSnapshotBeforeUpdate)}catch(w){Mt(c,c.return,w)}}d&64&&Qv(c),d&512&&To(c,c.return);break;case 3:if(Di(i,c),d&64&&(i=c.updateQueue,i!==null)){if(s=null,c.child!==null)switch(c.child.tag){case 27:case 5:s=c.child.stateNode;break;case 1:s=c.child.stateNode}try{$0(i,s)}catch(w){Mt(c,c.return,w)}}break;case 27:s===null&&d&4&&Jv(c);case 26:case 5:Di(i,c),s===null&&d&4&&Kv(c),d&512&&To(c,c.return);break;case 12:Di(i,c);break;case 31:Di(i,c),d&4&&i1(i,c);break;case 13:Di(i,c),d&4&&s1(i,c),d&64&&(i=c.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(c=jj.bind(null,c),Vj(i,c))));break;case 22:if(d=c.memoizedState!==null||Ri,!d){s=s!==null&&s.memoizedState!==null||xn,g=Ri;var v=xn;Ri=d,(xn=s)&&!v?zi(i,c,(c.subtreeFlags&8772)!==0):Di(i,c),Ri=g,xn=v}break;case 30:break;default:Di(i,c)}}function n1(i){var s=i.alternate;s!==null&&(i.alternate=null,n1(s)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(s=i.stateNode,s!==null&&ts(s)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}var Jt=null,Jn=!1;function Li(i,s,c){for(c=c.child;c!==null;)r1(i,s,c),c=c.sibling}function r1(i,s,c){if(jt&&typeof jt.onCommitFiberUnmount=="function")try{jt.onCommitFiberUnmount(st,c)}catch{}switch(c.tag){case 26:xn||ci(c,s),Li(i,s,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:xn||ci(c,s);var d=Jt,g=Jn;js(c.type)&&(Jt=c.stateNode,Jn=!1),Li(i,s,c),Po(c.stateNode),Jt=d,Jn=g;break;case 5:xn||ci(c,s);case 6:if(d=Jt,g=Jn,Jt=null,Li(i,s,c),Jt=d,Jn=g,Jt!==null)if(Jn)try{(Jt.nodeType===9?Jt.body:Jt.nodeName==="HTML"?Jt.ownerDocument.body:Jt).removeChild(c.stateNode)}catch(v){Mt(c,s,v)}else try{Jt.removeChild(c.stateNode)}catch(v){Mt(c,s,v)}break;case 18:Jt!==null&&(Jn?(i=Jt,Q1(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,c.stateNode),bl(i)):Q1(Jt,c.stateNode));break;case 4:d=Jt,g=Jn,Jt=c.stateNode.containerInfo,Jn=!0,Li(i,s,c),Jt=d,Jn=g;break;case 0:case 11:case 14:case 15:vs(2,c,s),xn||vs(4,c,s),Li(i,s,c);break;case 1:xn||(ci(c,s),d=c.stateNode,typeof d.componentWillUnmount=="function"&&Xv(c,s,d)),Li(i,s,c);break;case 21:Li(i,s,c);break;case 22:xn=(d=xn)||c.memoizedState!==null,Li(i,s,c),xn=d;break;default:Li(i,s,c)}}function i1(i,s){if(s.memoizedState===null&&(i=s.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{bl(i)}catch(c){Mt(s,s.return,c)}}}function s1(i,s){if(s.memoizedState===null&&(i=s.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{bl(i)}catch(c){Mt(s,s.return,c)}}function xj(i){switch(i.tag){case 31:case 13:case 19:var s=i.stateNode;return s===null&&(s=i.stateNode=new e1),s;case 22:return i=i.stateNode,s=i._retryCache,s===null&&(s=i._retryCache=new e1),s;default:throw Error(r(435,i.tag))}}function zu(i,s){var c=xj(i);s.forEach(function(d){if(!c.has(d)){c.add(d);var g=Nj.bind(null,i,d);d.then(g,g)}})}function er(i,s){var c=s.deletions;if(c!==null)for(var d=0;d<c.length;d++){var g=c[d],v=i,w=s,T=w;e:for(;T!==null;){switch(T.tag){case 27:if(js(T.type)){Jt=T.stateNode,Jn=!1;break e}break;case 5:Jt=T.stateNode,Jn=!1;break e;case 3:case 4:Jt=T.stateNode.containerInfo,Jn=!0;break e}T=T.return}if(Jt===null)throw Error(r(160));r1(v,w,g),Jt=null,Jn=!1,v=g.alternate,v!==null&&(v.return=null),g.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)a1(s,i),s=s.sibling}var Qr=null;function a1(i,s){var c=i.alternate,d=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:er(s,i),tr(i),d&4&&(vs(3,i,i.return),Eo(3,i),vs(5,i,i.return));break;case 1:er(s,i),tr(i),d&512&&(xn||c===null||ci(c,c.return)),d&64&&Ri&&(i=i.updateQueue,i!==null&&(d=i.callbacks,d!==null&&(c=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=c===null?d:c.concat(d))));break;case 26:var g=Qr;if(er(s,i),tr(i),d&512&&(xn||c===null||ci(c,c.return)),d&4){var v=c!==null?c.memoizedState:null;if(d=i.memoizedState,c===null)if(d===null)if(i.stateNode===null){e:{d=i.type,c=i.memoizedProps,g=g.ownerDocument||g;t:switch(d){case"title":v=g.getElementsByTagName("title")[0],(!v||v[ni]||v[Zt]||v.namespaceURI==="http://www.w3.org/2000/svg"||v.hasAttribute("itemprop"))&&(v=g.createElement(d),g.head.insertBefore(v,g.querySelector("head > title"))),An(v,d,c),v[Zt]=i,tn(v),d=v;break e;case"link":var w=ab("link","href",g).get(d+(c.href||""));if(w){for(var T=0;T<w.length;T++)if(v=w[T],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)){w.splice(T,1);break t}}v=g.createElement(d),An(v,d,c),g.head.appendChild(v);break;case"meta":if(w=ab("meta","content",g).get(d+(c.content||""))){for(T=0;T<w.length;T++)if(v=w[T],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)){w.splice(T,1);break t}}v=g.createElement(d),An(v,d,c),g.head.appendChild(v);break;default:throw Error(r(468,d))}v[Zt]=i,tn(v),d=v}i.stateNode=d}else lb(g,i.type,i.stateNode);else i.stateNode=sb(g,d,i.memoizedProps);else v!==d?(v===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):v.count--,d===null?lb(g,i.type,i.stateNode):sb(g,d,i.memoizedProps)):d===null&&i.stateNode!==null&&Qh(i,i.memoizedProps,c.memoizedProps)}break;case 27:er(s,i),tr(i),d&512&&(xn||c===null||ci(c,c.return)),c!==null&&d&4&&Qh(i,i.memoizedProps,c.memoizedProps);break;case 5:if(er(s,i),tr(i),d&512&&(xn||c===null||ci(c,c.return)),i.flags&32){g=i.stateNode;try{is(g,"")}catch(Ae){Mt(i,i.return,Ae)}}d&4&&i.stateNode!=null&&(g=i.memoizedProps,Qh(i,g,c!==null?c.memoizedProps:g)),d&1024&&(Zh=!0);break;case 6:if(er(s,i),tr(i),d&4){if(i.stateNode===null)throw Error(r(162));d=i.memoizedProps,c=i.stateNode;try{c.nodeValue=d}catch(Ae){Mt(i,i.return,Ae)}}break;case 3:if(Ku=null,g=Qr,Qr=Qu(s.containerInfo),er(s,i),Qr=g,tr(i),d&4&&c!==null&&c.memoizedState.isDehydrated)try{bl(s.containerInfo)}catch(Ae){Mt(i,i.return,Ae)}Zh&&(Zh=!1,l1(i));break;case 4:d=Qr,Qr=Qu(i.stateNode.containerInfo),er(s,i),tr(i),Qr=d;break;case 12:er(s,i),tr(i);break;case 31:er(s,i),tr(i),d&4&&(d=i.updateQueue,d!==null&&(i.updateQueue=null,zu(i,d)));break;case 13:er(s,i),tr(i),i.child.flags&8192&&i.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(Bu=Te()),d&4&&(d=i.updateQueue,d!==null&&(i.updateQueue=null,zu(i,d)));break;case 22:g=i.memoizedState!==null;var U=c!==null&&c.memoizedState!==null,ee=Ri,ce=xn;if(Ri=ee||g,xn=ce||U,er(s,i),xn=ce,Ri=ee,tr(i),d&8192)e:for(s=i.stateNode,s._visibility=g?s._visibility&-2:s._visibility|1,g&&(c===null||U||Ri||xn||da(i)),c=null,s=i;;){if(s.tag===5||s.tag===26){if(c===null){U=c=s;try{if(v=U.stateNode,g)w=v.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{T=U.stateNode;var fe=U.memoizedProps.style,ne=fe!=null&&fe.hasOwnProperty("display")?fe.display:null;T.style.display=ne==null||typeof ne=="boolean"?"":(""+ne).trim()}}catch(Ae){Mt(U,U.return,Ae)}}}else if(s.tag===6){if(c===null){U=s;try{U.stateNode.nodeValue=g?"":U.memoizedProps}catch(Ae){Mt(U,U.return,Ae)}}}else if(s.tag===18){if(c===null){U=s;try{var le=U.stateNode;g?X1(le,!0):X1(U.stateNode,!1)}catch(Ae){Mt(U,U.return,Ae)}}}else if((s.tag!==22&&s.tag!==23||s.memoizedState===null||s===i)&&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;c===s&&(c=null),s=s.return}c===s&&(c=null),s.sibling.return=s.return,s=s.sibling}d&4&&(d=i.updateQueue,d!==null&&(c=d.retryQueue,c!==null&&(d.retryQueue=null,zu(i,c))));break;case 19:er(s,i),tr(i),d&4&&(d=i.updateQueue,d!==null&&(i.updateQueue=null,zu(i,d)));break;case 30:break;case 21:break;default:er(s,i),tr(i)}}function tr(i){var s=i.flags;if(s&2){try{for(var c,d=i.return;d!==null;){if(Zv(d)){c=d;break}d=d.return}if(c==null)throw Error(r(160));switch(c.tag){case 27:var g=c.stateNode,v=Xh(i);Du(i,v,g);break;case 5:var w=c.stateNode;c.flags&32&&(is(w,""),c.flags&=-33);var T=Xh(i);Du(i,T,w);break;case 3:case 4:var U=c.stateNode.containerInfo,ee=Xh(i);Kh(i,ee,U);break;default:throw Error(r(161))}}catch(ce){Mt(i,i.return,ce)}i.flags&=-3}s&4096&&(i.flags&=-4097)}function l1(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var s=i;l1(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),i=i.sibling}}function Di(i,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)t1(i,s.alternate,s),s=s.sibling}function da(i){for(i=i.child;i!==null;){var s=i;switch(s.tag){case 0:case 11:case 14:case 15:vs(4,s,s.return),da(s);break;case 1:ci(s,s.return);var c=s.stateNode;typeof c.componentWillUnmount=="function"&&Xv(s,s.return,c),da(s);break;case 27:Po(s.stateNode);case 26:case 5:ci(s,s.return),da(s);break;case 22:s.memoizedState===null&&da(s);break;case 30:da(s);break;default:da(s)}i=i.sibling}}function zi(i,s,c){for(c=c&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var d=s.alternate,g=i,v=s,w=v.flags;switch(v.tag){case 0:case 11:case 15:zi(g,v,c),Eo(4,v);break;case 1:if(zi(g,v,c),d=v,g=d.stateNode,typeof g.componentDidMount=="function")try{g.componentDidMount()}catch(ee){Mt(d,d.return,ee)}if(d=v,g=d.updateQueue,g!==null){var T=d.stateNode;try{var U=g.shared.hiddenCallbacks;if(U!==null)for(g.shared.hiddenCallbacks=null,g=0;g<U.length;g++)P0(U[g],T)}catch(ee){Mt(d,d.return,ee)}}c&&w&64&&Qv(v),To(v,v.return);break;case 27:Jv(v);case 26:case 5:zi(g,v,c),c&&d===null&&w&4&&Kv(v),To(v,v.return);break;case 12:zi(g,v,c);break;case 31:zi(g,v,c),c&&w&4&&i1(g,v);break;case 13:zi(g,v,c),c&&w&4&&s1(g,v);break;case 22:v.memoizedState===null&&zi(g,v,c),To(v,v.return);break;case 30:break;default:zi(g,v,c)}s=s.sibling}}function Jh(i,s){var c=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(c=i.memoizedState.cachePool.pool),i=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(i=s.memoizedState.cachePool.pool),i!==c&&(i!=null&&i.refCount++,c!=null&&mo(c))}function ep(i,s){i=null,s.alternate!==null&&(i=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==i&&(s.refCount++,i!=null&&mo(i))}function Xr(i,s,c,d){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)o1(i,s,c,d),s=s.sibling}function o1(i,s,c,d){var g=s.flags;switch(s.tag){case 0:case 11:case 15:Xr(i,s,c,d),g&2048&&Eo(9,s);break;case 1:Xr(i,s,c,d);break;case 3:Xr(i,s,c,d),g&2048&&(i=null,s.alternate!==null&&(i=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==i&&(s.refCount++,i!=null&&mo(i)));break;case 12:if(g&2048){Xr(i,s,c,d),i=s.stateNode;try{var v=s.memoizedProps,w=v.id,T=v.onPostCommit;typeof T=="function"&&T(w,s.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(U){Mt(s,s.return,U)}}else Xr(i,s,c,d);break;case 31:Xr(i,s,c,d);break;case 13:Xr(i,s,c,d);break;case 23:break;case 22:v=s.stateNode,w=s.alternate,s.memoizedState!==null?v._visibility&2?Xr(i,s,c,d):Ao(i,s):v._visibility&2?Xr(i,s,c,d):(v._visibility|=2,ol(i,s,c,d,(s.subtreeFlags&10256)!==0||!1)),g&2048&&Jh(w,s);break;case 24:Xr(i,s,c,d),g&2048&&ep(s.alternate,s);break;default:Xr(i,s,c,d)}}function ol(i,s,c,d,g){for(g=g&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var v=i,w=s,T=c,U=d,ee=w.flags;switch(w.tag){case 0:case 11:case 15:ol(v,w,T,U,g),Eo(8,w);break;case 23:break;case 22:var ce=w.stateNode;w.memoizedState!==null?ce._visibility&2?ol(v,w,T,U,g):Ao(v,w):(ce._visibility|=2,ol(v,w,T,U,g)),g&&ee&2048&&Jh(w.alternate,w);break;case 24:ol(v,w,T,U,g),g&&ee&2048&&ep(w.alternate,w);break;default:ol(v,w,T,U,g)}s=s.sibling}}function Ao(i,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var c=i,d=s,g=d.flags;switch(d.tag){case 22:Ao(c,d),g&2048&&Jh(d.alternate,d);break;case 24:Ao(c,d),g&2048&&ep(d.alternate,d);break;default:Ao(c,d)}s=s.sibling}}var Mo=8192;function cl(i,s,c){if(i.subtreeFlags&Mo)for(i=i.child;i!==null;)c1(i,s,c),i=i.sibling}function c1(i,s,c){switch(i.tag){case 26:cl(i,s,c),i.flags&Mo&&i.memoizedState!==null&&rN(c,Qr,i.memoizedState,i.memoizedProps);break;case 5:cl(i,s,c);break;case 3:case 4:var d=Qr;Qr=Qu(i.stateNode.containerInfo),cl(i,s,c),Qr=d;break;case 22:i.memoizedState===null&&(d=i.alternate,d!==null&&d.memoizedState!==null?(d=Mo,Mo=16777216,cl(i,s,c),Mo=d):cl(i,s,c));break;default:cl(i,s,c)}}function u1(i){var s=i.alternate;if(s!==null&&(i=s.child,i!==null)){s.child=null;do s=i.sibling,i.sibling=null,i=s;while(i!==null)}}function Ro(i){var s=i.deletions;if((i.flags&16)!==0){if(s!==null)for(var c=0;c<s.length;c++){var d=s[c];Sn=d,f1(d,i)}u1(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)d1(i),i=i.sibling}function d1(i){switch(i.tag){case 0:case 11:case 15:Ro(i),i.flags&2048&&vs(9,i,i.return);break;case 3:Ro(i);break;case 12:Ro(i);break;case 22:var s=i.stateNode;i.memoizedState!==null&&s._visibility&2&&(i.return===null||i.return.tag!==13)?(s._visibility&=-3,Ou(i)):Ro(i);break;default:Ro(i)}}function Ou(i){var s=i.deletions;if((i.flags&16)!==0){if(s!==null)for(var c=0;c<s.length;c++){var d=s[c];Sn=d,f1(d,i)}u1(i)}for(i=i.child;i!==null;){switch(s=i,s.tag){case 0:case 11:case 15:vs(8,s,s.return),Ou(s);break;case 22:c=s.stateNode,c._visibility&2&&(c._visibility&=-3,Ou(s));break;default:Ou(s)}i=i.sibling}}function f1(i,s){for(;Sn!==null;){var c=Sn;switch(c.tag){case 0:case 11:case 15:vs(8,c,s);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var d=c.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:mo(c.memoizedState.cache)}if(d=c.child,d!==null)d.return=c,Sn=d;else e:for(c=i;Sn!==null;){d=Sn;var g=d.sibling,v=d.return;if(n1(d),d===c){Sn=null;break e}if(g!==null){g.return=v,Sn=g;break e}Sn=v}}}var vj={getCacheForType:function(i){var s=En(pn),c=s.data.get(i);return c===void 0&&(c=i(),s.data.set(i,c)),c},cacheSignal:function(){return En(pn).controller.signal}},bj=typeof WeakMap=="function"?WeakMap:Map,kt=0,$t=null,lt=null,ut=0,At=0,mr=null,bs=!1,ul=!1,tp=!1,Oi=0,an=0,ys=0,fa=0,np=0,gr=0,dl=0,Lo=null,nr=null,rp=!1,Bu=0,h1=0,Pu=1/0,$u=null,_s=null,kn=0,ws=null,fl=null,Bi=0,ip=0,sp=null,p1=null,Do=0,ap=null;function xr(){return(kt&2)!==0&&ut!==0?ut&-ut:P.T!==null?fp():Kl()}function m1(){if(gr===0)if((ut&536870912)===0||ht){var i=Vr;Vr<<=1,(Vr&3932160)===0&&(Vr=262144),gr=i}else gr=536870912;return i=hr.current,i!==null&&(i.flags|=32),gr}function rr(i,s,c){(i===$t&&(At===2||At===9)||i.cancelPendingCommit!==null)&&(hl(i,0),ks(i,ut,gr,!1)),It(i,c),((kt&2)===0||i!==$t)&&(i===$t&&((kt&2)===0&&(fa|=c),an===4&&ks(i,ut,gr,!1)),ui(i))}function g1(i,s,c){if((kt&6)!==0)throw Error(r(327));var d=!c&&(s&127)===0&&(s&i.expiredLanes)===0||Xe(i,s),g=d?wj(i,s):op(i,s,!0),v=d;do{if(g===0){ul&&!d&&ks(i,s,0,!1);break}else{if(c=i.current.alternate,v&&!yj(c)){g=op(i,s,!1),v=!1;continue}if(g===2){if(v=s,i.errorRecoveryDisabledLanes&v)var w=0;else w=i.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){s=w;e:{var T=i;g=Lo;var U=T.current.memoizedState.isDehydrated;if(U&&(hl(T,w).flags|=256),w=op(T,w,!1),w!==2){if(tp&&!U){T.errorRecoveryDisabledLanes|=v,fa|=v,g=4;break e}v=nr,nr=g,v!==null&&(nr===null?nr=v:nr.push.apply(nr,v))}g=w}if(v=!1,g!==2)continue}}if(g===1){hl(i,0),ks(i,s,0,!0);break}e:{switch(d=i,v=g,v){case 0:case 1:throw Error(r(345));case 4:if((s&4194048)!==s)break;case 6:ks(d,s,gr,!bs);break e;case 2:nr=null;break;case 3:case 5:break;default:throw Error(r(329))}if((s&62914560)===s&&(g=Bu+300-Te(),10<g)){if(ks(d,s,gr,!bs),be(d,0,!0)!==0)break e;Bi=s,d.timeoutHandle=Y1(x1.bind(null,d,c,nr,$u,rp,s,gr,fa,dl,bs,v,"Throttled",-0,0),g);break e}x1(d,c,nr,$u,rp,s,gr,fa,dl,bs,v,null,-0,0)}}break}while(!0);ui(i)}function x1(i,s,c,d,g,v,w,T,U,ee,ce,fe,ne,le){if(i.timeoutHandle=-1,fe=s.subtreeFlags,fe&8192||(fe&16785408)===16785408){fe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Cr},c1(s,v,fe);var Ae=(v&62914560)===v?Bu-Te():(v&4194048)===v?h1-Te():0;if(Ae=iN(fe,Ae),Ae!==null){Bi=v,i.cancelPendingCommit=Ae(j1.bind(null,i,s,v,c,d,g,w,T,U,ce,fe,null,ne,le)),ks(i,v,w,!ee);return}}j1(i,s,v,c,d,g,w,T,U)}function yj(i){for(var s=i;;){var c=s.tag;if((c===0||c===11||c===15)&&s.flags&16384&&(c=s.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var d=0;d<c.length;d++){var g=c[d],v=g.getSnapshot;g=g.value;try{if(!dr(v(),g))return!1}catch{return!1}}if(c=s.child,s.subtreeFlags&16384&&c!==null)c.return=s,s=c;else{if(s===i)break;for(;s.sibling===null;){if(s.return===null||s.return===i)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function ks(i,s,c,d){s&=~np,s&=~fa,i.suspendedLanes|=s,i.pingedLanes&=~s,d&&(i.warmLanes|=s),d=i.expirationTimes;for(var g=s;0<g;){var v=31-et(g),w=1<<v;d[v]=-1,g&=~w}c!==0&&Sr(i,c,s)}function Fu(){return(kt&6)===0?(zo(0),!1):!0}function lp(){if(lt!==null){if(At===0)var i=lt.return;else i=lt,Ni=ra=null,kh(i),rl=null,xo=0,i=lt;for(;i!==null;)Wv(i.alternate,i),i=i.return;lt=null}}function hl(i,s){var c=i.timeoutHandle;c!==-1&&(i.timeoutHandle=-1,Fj(c)),c=i.cancelPendingCommit,c!==null&&(i.cancelPendingCommit=null,c()),Bi=0,lp(),$t=i,lt=c=Si(i.current,null),ut=s,At=0,mr=null,bs=!1,ul=Xe(i,s),tp=!1,dl=gr=np=fa=ys=an=0,nr=Lo=null,rp=!1,(s&8)!==0&&(s|=s&32);var d=i.entangledLanes;if(d!==0)for(i=i.entanglements,d&=s;0<d;){var g=31-et(d),v=1<<g;s|=i[g],d&=~v}return Oi=s,lu(),c}function v1(i,s){Ze=null,P.H=jo,s===nl||s===mu?(s=D0(),At=3):s===dh?(s=D0(),At=4):At=s===$h?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,mr=s,lt===null&&(an=1,Tu(i,Mr(s,i.current)))}function b1(){var i=hr.current;return i===null?!0:(ut&4194048)===ut?zr===null:(ut&62914560)===ut||(ut&536870912)!==0?i===zr:!1}function y1(){var i=P.H;return P.H=jo,i===null?jo:i}function _1(){var i=P.A;return P.A=vj,i}function Uu(){an=4,bs||(ut&4194048)!==ut&&hr.current!==null||(ul=!0),(ys&134217727)===0&&(fa&134217727)===0||$t===null||ks($t,ut,gr,!1)}function op(i,s,c){var d=kt;kt|=2;var g=y1(),v=_1();($t!==i||ut!==s)&&($u=null,hl(i,s)),s=!1;var w=an;e:do try{if(At!==0&&lt!==null){var T=lt,U=mr;switch(At){case 8:lp(),w=6;break e;case 3:case 2:case 9:case 6:hr.current===null&&(s=!0);var ee=At;if(At=0,mr=null,pl(i,T,U,ee),c&&ul){w=0;break e}break;default:ee=At,At=0,mr=null,pl(i,T,U,ee)}}_j(),w=an;break}catch(ce){v1(i,ce)}while(!0);return s&&i.shellSuspendCounter++,Ni=ra=null,kt=d,P.H=g,P.A=v,lt===null&&($t=null,ut=0,lu()),w}function _j(){for(;lt!==null;)w1(lt)}function wj(i,s){var c=kt;kt|=2;var d=y1(),g=_1();$t!==i||ut!==s?($u=null,Pu=Te()+500,hl(i,s)):ul=Xe(i,s);e:do try{if(At!==0&&lt!==null){s=lt;var v=mr;t:switch(At){case 1:At=0,mr=null,pl(i,s,v,1);break;case 2:case 9:if(R0(v)){At=0,mr=null,k1(s);break}s=function(){At!==2&&At!==9||$t!==i||(At=7),ui(i)},v.then(s,s);break e;case 3:At=7;break e;case 4:At=5;break e;case 7:R0(v)?(At=0,mr=null,k1(s)):(At=0,mr=null,pl(i,s,v,7));break;case 5:var w=null;switch(lt.tag){case 26:w=lt.memoizedState;case 5:case 27:var T=lt;if(w?ob(w):T.stateNode.complete){At=0,mr=null;var U=T.sibling;if(U!==null)lt=U;else{var ee=T.return;ee!==null?(lt=ee,qu(ee)):lt=null}break t}}At=0,mr=null,pl(i,s,v,5);break;case 6:At=0,mr=null,pl(i,s,v,6);break;case 8:lp(),an=6;break e;default:throw Error(r(462))}}kj();break}catch(ce){v1(i,ce)}while(!0);return Ni=ra=null,P.H=d,P.A=g,kt=c,lt!==null?0:($t=null,ut=0,lu(),an)}function kj(){for(;lt!==null&&!ze();)w1(lt)}function w1(i){var s=Gv(i.alternate,i,Oi);i.memoizedProps=i.pendingProps,s===null?qu(i):lt=s}function k1(i){var s=i,c=s.alternate;switch(s.tag){case 15:case 0:s=Fv(c,s,s.pendingProps,s.type,void 0,ut);break;case 11:s=Fv(c,s,s.pendingProps,s.type.render,s.ref,ut);break;case 5:kh(s);default:Wv(c,s),s=lt=_0(s,Oi),s=Gv(c,s,Oi)}i.memoizedProps=i.pendingProps,s===null?qu(i):lt=s}function pl(i,s,c,d){Ni=ra=null,kh(s),rl=null,xo=0;var g=s.return;try{if(dj(i,g,s,c,ut)){an=1,Tu(i,Mr(c,i.current)),lt=null;return}}catch(v){if(g!==null)throw lt=g,v;an=1,Tu(i,Mr(c,i.current)),lt=null;return}s.flags&32768?(ht||d===1?i=!0:ul||(ut&536870912)!==0?i=!1:(bs=i=!0,(d===2||d===9||d===3||d===6)&&(d=hr.current,d!==null&&d.tag===13&&(d.flags|=16384))),S1(s,i)):qu(s)}function qu(i){var s=i;do{if((s.flags&32768)!==0){S1(s,bs);return}i=s.return;var c=pj(s.alternate,s,Oi);if(c!==null){lt=c;return}if(s=s.sibling,s!==null){lt=s;return}lt=s=i}while(s!==null);an===0&&(an=5)}function S1(i,s){do{var c=mj(i.alternate,i);if(c!==null){c.flags&=32767,lt=c;return}if(c=i.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!s&&(i=i.sibling,i!==null)){lt=i;return}lt=i=c}while(i!==null);an=6,lt=null}function j1(i,s,c,d,g,v,w,T,U){i.cancelPendingCommit=null;do Hu();while(kn!==0);if((kt&6)!==0)throw Error(r(327));if(s!==null){if(s===i.current)throw Error(r(177));if(v=s.lanes|s.childLanes,v|=Xf,Un(i,c,v,w,T,U),i===$t&&(lt=$t=null,ut=0),fl=s,ws=i,Bi=c,ip=v,sp=g,p1=d,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,Cj(Q,function(){return A1(),null})):(i.callbackNode=null,i.callbackPriority=0),d=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||d){d=P.T,P.T=null,g=$.p,$.p=2,w=kt,kt|=4;try{gj(i,s,c)}finally{kt=w,$.p=g,P.T=d}}kn=1,N1(),C1(),E1()}}function N1(){if(kn===1){kn=0;var i=ws,s=fl,c=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||c){c=P.T,P.T=null;var d=$.p;$.p=2;var g=kt;kt|=4;try{a1(s,i);var v=yp,w=f0(i.containerInfo),T=v.focusedElem,U=v.selectionRange;if(w!==T&&T&&T.ownerDocument&&d0(T.ownerDocument.documentElement,T)){if(U!==null&&Vf(T)){var ee=U.start,ce=U.end;if(ce===void 0&&(ce=ee),"selectionStart"in T)T.selectionStart=ee,T.selectionEnd=Math.min(ce,T.value.length);else{var fe=T.ownerDocument||document,ne=fe&&fe.defaultView||window;if(ne.getSelection){var le=ne.getSelection(),Ae=T.textContent.length,Ue=Math.min(U.start,Ae),Ot=U.end===void 0?Ue:Math.min(U.end,Ae);!le.extend&&Ue>Ot&&(w=Ot,Ot=Ue,Ue=w);var X=u0(T,Ue),V=u0(T,Ot);if(X&&V&&(le.rangeCount!==1||le.anchorNode!==X.node||le.anchorOffset!==X.offset||le.focusNode!==V.node||le.focusOffset!==V.offset)){var J=fe.createRange();J.setStart(X.node,X.offset),le.removeAllRanges(),Ue>Ot?(le.addRange(J),le.extend(V.node,V.offset)):(J.setEnd(V.node,V.offset),le.addRange(J))}}}}for(fe=[],le=T;le=le.parentNode;)le.nodeType===1&&fe.push({element:le,left:le.scrollLeft,top:le.scrollTop});for(typeof T.focus=="function"&&T.focus(),T=0;T<fe.length;T++){var ue=fe[T];ue.element.scrollLeft=ue.left,ue.element.scrollTop=ue.top}}td=!!bp,yp=bp=null}finally{kt=g,$.p=d,P.T=c}}i.current=s,kn=2}}function C1(){if(kn===2){kn=0;var i=ws,s=fl,c=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||c){c=P.T,P.T=null;var d=$.p;$.p=2;var g=kt;kt|=4;try{t1(i,s.alternate,s)}finally{kt=g,$.p=d,P.T=c}}kn=3}}function E1(){if(kn===4||kn===3){kn=0,pt();var i=ws,s=fl,c=Bi,d=p1;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?kn=5:(kn=0,fl=ws=null,T1(i,i.pendingLanes));var g=i.pendingLanes;if(g===0&&(_s=null),Hs(c),s=s.stateNode,jt&&typeof jt.onCommitFiberRoot=="function")try{jt.onCommitFiberRoot(st,s,void 0,(s.current.flags&128)===128)}catch{}if(d!==null){s=P.T,g=$.p,$.p=2,P.T=null;try{for(var v=i.onRecoverableError,w=0;w<d.length;w++){var T=d[w];v(T.value,{componentStack:T.stack})}}finally{P.T=s,$.p=g}}(Bi&3)!==0&&Hu(),ui(i),g=i.pendingLanes,(c&261930)!==0&&(g&42)!==0?i===ap?Do++:(Do=0,ap=i):Do=0,zo(0)}}function T1(i,s){(i.pooledCacheLanes&=s)===0&&(s=i.pooledCache,s!=null&&(i.pooledCache=null,mo(s)))}function Hu(){return N1(),C1(),E1(),A1()}function A1(){if(kn!==5)return!1;var i=ws,s=ip;ip=0;var c=Hs(Bi),d=P.T,g=$.p;try{$.p=32>c?32:c,P.T=null,c=sp,sp=null;var v=ws,w=Bi;if(kn=0,fl=ws=null,Bi=0,(kt&6)!==0)throw Error(r(331));var T=kt;if(kt|=4,d1(v.current),o1(v,v.current,w,c),kt=T,zo(0,!1),jt&&typeof jt.onPostCommitFiberRoot=="function")try{jt.onPostCommitFiberRoot(st,v)}catch{}return!0}finally{$.p=g,P.T=d,T1(i,s)}}function M1(i,s,c){s=Mr(c,s),s=Ph(i.stateNode,s,2),i=ms(i,s,2),i!==null&&(It(i,2),ui(i))}function Mt(i,s,c){if(i.tag===3)M1(i,i,c);else for(;s!==null;){if(s.tag===3){M1(s,i,c);break}else if(s.tag===1){var d=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(_s===null||!_s.has(d))){i=Mr(c,i),c=Rv(2),d=ms(s,c,2),d!==null&&(Lv(c,d,s,i),It(d,2),ui(d));break}}s=s.return}}function cp(i,s,c){var d=i.pingCache;if(d===null){d=i.pingCache=new bj;var g=new Set;d.set(s,g)}else g=d.get(s),g===void 0&&(g=new Set,d.set(s,g));g.has(c)||(tp=!0,g.add(c),i=Sj.bind(null,i,s,c),s.then(i,i))}function Sj(i,s,c){var d=i.pingCache;d!==null&&d.delete(s),i.pingedLanes|=i.suspendedLanes&c,i.warmLanes&=~c,$t===i&&(ut&c)===c&&(an===4||an===3&&(ut&62914560)===ut&&300>Te()-Bu?(kt&2)===0&&hl(i,0):np|=c,dl===ut&&(dl=0)),ui(i)}function R1(i,s){s===0&&(s=hn()),i=ea(i,s),i!==null&&(It(i,s),ui(i))}function jj(i){var s=i.memoizedState,c=0;s!==null&&(c=s.retryLane),R1(i,c)}function Nj(i,s){var c=0;switch(i.tag){case 31:case 13:var d=i.stateNode,g=i.memoizedState;g!==null&&(c=g.retryLane);break;case 19:d=i.stateNode;break;case 22:d=i.stateNode._retryCache;break;default:throw Error(r(314))}d!==null&&d.delete(s),R1(i,c)}function Cj(i,s){return rn(i,s)}var Iu=null,ml=null,up=!1,Vu=!1,dp=!1,Ss=0;function ui(i){i!==ml&&i.next===null&&(ml===null?Iu=ml=i:ml=ml.next=i),Vu=!0,up||(up=!0,Tj())}function zo(i,s){if(!dp&&Vu){dp=!0;do for(var c=!1,d=Iu;d!==null;){if(i!==0){var g=d.pendingLanes;if(g===0)var v=0;else{var w=d.suspendedLanes,T=d.pingedLanes;v=(1<<31-et(42|i)+1)-1,v&=g&~(w&~T),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(c=!0,O1(d,v))}else v=ut,v=be(d,d===$t?v:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(v&3)===0||Xe(d,v)||(c=!0,O1(d,v));d=d.next}while(c);dp=!1}}function Ej(){L1()}function L1(){Vu=up=!1;var i=0;Ss!==0&&$j()&&(i=Ss);for(var s=Te(),c=null,d=Iu;d!==null;){var g=d.next,v=D1(d,s);v===0?(d.next=null,c===null?Iu=g:c.next=g,g===null&&(ml=c)):(c=d,(i!==0||(v&3)!==0)&&(Vu=!0)),d=g}kn!==0&&kn!==5||zo(i),Ss!==0&&(Ss=0)}function D1(i,s){for(var c=i.suspendedLanes,d=i.pingedLanes,g=i.expirationTimes,v=i.pendingLanes&-62914561;0<v;){var w=31-et(v),T=1<<w,U=g[w];U===-1?((T&c)===0||(T&d)!==0)&&(g[w]=Ht(T,s)):U<=s&&(i.expiredLanes|=T),v&=~T}if(s=$t,c=ut,c=be(i,i===s?c:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),d=i.callbackNode,c===0||i===s&&(At===2||At===9)||i.cancelPendingCommit!==null)return d!==null&&d!==null&&je(d),i.callbackNode=null,i.callbackPriority=0;if((c&3)===0||Xe(i,c)){if(s=c&-c,s===i.callbackPriority)return s;switch(d!==null&&je(d),Hs(c)){case 2:case 8:c=we;break;case 32:c=Q;break;case 268435456:c=Re;break;default:c=Q}return d=z1.bind(null,i),c=rn(c,d),i.callbackPriority=s,i.callbackNode=c,s}return d!==null&&d!==null&&je(d),i.callbackPriority=2,i.callbackNode=null,2}function z1(i,s){if(kn!==0&&kn!==5)return i.callbackNode=null,i.callbackPriority=0,null;var c=i.callbackNode;if(Hu()&&i.callbackNode!==c)return null;var d=ut;return d=be(i,i===$t?d:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),d===0?null:(g1(i,d,s),D1(i,Te()),i.callbackNode!=null&&i.callbackNode===c?z1.bind(null,i):null)}function O1(i,s){if(Hu())return null;g1(i,s,!0)}function Tj(){Uj(function(){(kt&6)!==0?rn(oe,Ej):L1()})}function fp(){if(Ss===0){var i=el;i===0&&(i=Ir,Ir<<=1,(Ir&261888)===0&&(Ir=256)),Ss=i}return Ss}function B1(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:Ua(""+i)}function P1(i,s){var c=s.ownerDocument.createElement("input");return c.name=s.name,c.value=s.value,i.id&&c.setAttribute("form",i.id),s.parentNode.insertBefore(c,s),i=new FormData(i),c.parentNode.removeChild(c),i}function Aj(i,s,c,d,g){if(s==="submit"&&c&&c.stateNode===g){var v=B1((g[Nn]||null).action),w=d.submitter;w&&(s=(s=w[Nn]||null)?B1(s.formAction):w.getAttribute("formAction"),s!==null&&(v=s,w=null));var T=new ki("action","action",null,d,g);i.push({event:T,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(Ss!==0){var U=w?P1(g,w):new FormData(g);Rh(c,{pending:!0,data:U,method:g.method,action:v},null,U)}}else typeof v=="function"&&(T.preventDefault(),U=w?P1(g,w):new FormData(g),Rh(c,{pending:!0,data:U,method:g.method,action:v},v,U))},currentTarget:g}]})}}for(var hp=0;hp<Qf.length;hp++){var pp=Qf[hp],Mj=pp.toLowerCase(),Rj=pp[0].toUpperCase()+pp.slice(1);Wr(Mj,"on"+Rj)}Wr(m0,"onAnimationEnd"),Wr(g0,"onAnimationIteration"),Wr(x0,"onAnimationStart"),Wr("dblclick","onDoubleClick"),Wr("focusin","onFocus"),Wr("focusout","onBlur"),Wr(WS,"onTransitionRun"),Wr(QS,"onTransitionStart"),Wr(XS,"onTransitionCancel"),Wr(v0,"onTransitionEnd"),ii("onMouseEnter",["mouseout","mouseover"]),ii("onMouseLeave",["mouseout","mouseover"]),ii("onPointerEnter",["pointerout","pointerover"]),ii("onPointerLeave",["pointerout","pointerover"]),Gr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Gr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Gr("onBeforeInput",["compositionend","keypress","textInput","paste"]),Gr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Gr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Gr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Oo="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(" "),Lj=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Oo));function $1(i,s){s=(s&4)!==0;for(var c=0;c<i.length;c++){var d=i[c],g=d.event;d=d.listeners;e:{var v=void 0;if(s)for(var w=d.length-1;0<=w;w--){var T=d[w],U=T.instance,ee=T.currentTarget;if(T=T.listener,U!==v&&g.isPropagationStopped())break e;v=T,g.currentTarget=ee;try{v(g)}catch(ce){au(ce)}g.currentTarget=null,v=U}else for(w=0;w<d.length;w++){if(T=d[w],U=T.instance,ee=T.currentTarget,T=T.listener,U!==v&&g.isPropagationStopped())break e;v=T,g.currentTarget=ee;try{v(g)}catch(ce){au(ce)}g.currentTarget=null,v=U}}}}function ot(i,s){var c=s[Jl];c===void 0&&(c=s[Jl]=new Set);var d=i+"__bubble";c.has(d)||(F1(s,i,2,!1),c.add(d))}function mp(i,s,c){var d=0;s&&(d|=4),F1(c,i,d,s)}var Gu="_reactListening"+Math.random().toString(36).slice(2);function gp(i){if(!i[Gu]){i[Gu]=!0,Kn.forEach(function(c){c!=="selectionchange"&&(Lj.has(c)||mp(c,!1,i),mp(c,!0,i))});var s=i.nodeType===9?i:i.ownerDocument;s===null||s[Gu]||(s[Gu]=!0,mp("selectionchange",!1,s))}}function F1(i,s,c,d){switch(mb(s)){case 2:var g=lN;break;case 8:g=oN;break;default:g=Mp}c=g.bind(null,s,c,i),g=void 0,!Ha||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(g=!0),d?g!==void 0?i.addEventListener(s,c,{capture:!0,passive:g}):i.addEventListener(s,c,!0):g!==void 0?i.addEventListener(s,c,{passive:g}):i.addEventListener(s,c,!1)}function xp(i,s,c,d,g){var v=d;if((s&1)===0&&(s&2)===0&&d!==null)e:for(;;){if(d===null)return;var w=d.tag;if(w===3||w===4){var T=d.stateNode.containerInfo;if(T===g)break;if(w===4)for(w=d.return;w!==null;){var U=w.tag;if((U===3||U===4)&&w.stateNode.containerInfo===g)return;w=w.return}for(;T!==null;){if(w=wi(T),w===null)return;if(U=w.tag,U===5||U===6||U===26||U===27){d=v=w;continue e}T=T.parentNode}}d=d.return}Zc(function(){var ee=v,ce=qa(c),fe=[];e:{var ne=b0.get(i);if(ne!==void 0){var le=ki,Ae=i;switch(i){case"keypress":if(at(c)===0)break e;case"keydown":case"keyup":le=NS;break;case"focusin":Ae="focus",le=ai;break;case"focusout":Ae="blur",le=ai;break;case"beforeblur":case"afterblur":le=ai;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=Ff;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":le=tu;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":le=TS;break;case m0:case g0:case x0:le=iu;break;case v0:le=MS;break;case"scroll":case"scrollend":le=Jc;break;case"wheel":le=LS;break;case"copy":case"cut":case"paste":le=bS;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":le=Xx;break;case"toggle":case"beforetoggle":le=zS}var Ue=(s&4)!==0,Ot=!Ue&&(i==="scroll"||i==="scrollend"),X=Ue?ne!==null?ne+"Capture":null:ne;Ue=[];for(var V=ee,J;V!==null;){var ue=V;if(J=ue.stateNode,ue=ue.tag,ue!==5&&ue!==26&&ue!==27||J===null||X===null||(ue=Qs(V,X),ue!=null&&Ue.push(Bo(V,ue,J))),Ot)break;V=V.return}0<Ue.length&&(ne=new le(ne,Ae,null,c,ce),fe.push({event:ne,listeners:Ue}))}}if((s&7)===0){e:{if(ne=i==="mouseover"||i==="pointerover",le=i==="mouseout"||i==="pointerout",ne&&c!==ss&&(Ae=c.relatedTarget||c.fromElement)&&(wi(Ae)||Ae[ur]))break e;if((le||ne)&&(ne=ce.window===ce?ce:(ne=ce.ownerDocument)?ne.defaultView||ne.parentWindow:window,le?(Ae=c.relatedTarget||c.toElement,le=ee,Ae=Ae?wi(Ae):null,Ae!==null&&(Ot=o(Ae),Ue=Ae.tag,Ae!==Ot||Ue!==5&&Ue!==27&&Ue!==6)&&(Ae=null)):(le=null,Ae=ee),le!==Ae)){if(Ue=Ff,ue="onMouseLeave",X="onMouseEnter",V="mouse",(i==="pointerout"||i==="pointerover")&&(Ue=Xx,ue="onPointerLeave",X="onPointerEnter",V="pointer"),Ot=le==null?ne:Gs(le),J=Ae==null?ne:Gs(Ae),ne=new Ue(ue,V+"leave",le,c,ce),ne.target=Ot,ne.relatedTarget=J,ue=null,wi(ce)===ee&&(Ue=new Ue(X,V+"enter",Ae,c,ce),Ue.target=J,Ue.relatedTarget=Ot,ue=Ue),Ot=ue,le&&Ae)t:{for(Ue=Dj,X=le,V=Ae,J=0,ue=X;ue;ue=Ue(ue))J++;ue=0;for(var Pe=V;Pe;Pe=Ue(Pe))ue++;for(;0<J-ue;)X=Ue(X),J--;for(;0<ue-J;)V=Ue(V),ue--;for(;J--;){if(X===V||V!==null&&X===V.alternate){Ue=X;break t}X=Ue(X),V=Ue(V)}Ue=null}else Ue=null;le!==null&&U1(fe,ne,le,Ue,!1),Ae!==null&&Ot!==null&&U1(fe,Ot,Ae,Ue,!0)}}e:{if(ne=ee?Gs(ee):window,le=ne.nodeName&&ne.nodeName.toLowerCase(),le==="select"||le==="input"&&ne.type==="file")var yt=i0;else if(n0(ne))if(s0)yt=VS;else{yt=HS;var Le=qS}else le=ne.nodeName,!le||le.toLowerCase()!=="input"||ne.type!=="checkbox"&&ne.type!=="radio"?ee&&Fa(ee.elementType)&&(yt=i0):yt=IS;if(yt&&(yt=yt(i,ee))){r0(fe,yt,c,ce);break e}Le&&Le(i,ne,ee),i==="focusout"&&ee&&ne.type==="number"&&ee.memoizedProps.value!=null&&Pa(ne,"number",ne.value)}switch(Le=ee?Gs(ee):window,i){case"focusin":(n0(Le)||Le.contentEditable==="true")&&(Ga=Le,Gf=ee,fo=null);break;case"focusout":fo=Gf=Ga=null;break;case"mousedown":Yf=!0;break;case"contextmenu":case"mouseup":case"dragend":Yf=!1,h0(fe,c,ce);break;case"selectionchange":if(YS)break;case"keydown":case"keyup":h0(fe,c,ce)}var tt;if(qf)e:{switch(i){case"compositionstart":var dt="onCompositionStart";break e;case"compositionend":dt="onCompositionEnd";break e;case"compositionupdate":dt="onCompositionUpdate";break e}dt=void 0}else Va?e0(i,c)&&(dt="onCompositionEnd"):i==="keydown"&&c.keyCode===229&&(dt="onCompositionStart");dt&&(Kx&&c.locale!=="ko"&&(Va||dt!=="onCompositionStart"?dt==="onCompositionEnd"&&Va&&(tt=mt()):(H=ce,he="value"in H?H.value:H.textContent,Va=!0)),Le=Yu(ee,dt),0<Le.length&&(dt=new Qx(dt,i,null,c,ce),fe.push({event:dt,listeners:Le}),tt?dt.data=tt:(tt=t0(c),tt!==null&&(dt.data=tt)))),(tt=BS?PS(i,c):$S(i,c))&&(dt=Yu(ee,"onBeforeInput"),0<dt.length&&(Le=new Qx("onBeforeInput","beforeinput",null,c,ce),fe.push({event:Le,listeners:dt}),Le.data=tt)),Aj(fe,i,ee,c,ce)}$1(fe,s)})}function Bo(i,s,c){return{instance:i,listener:s,currentTarget:c}}function Yu(i,s){for(var c=s+"Capture",d=[];i!==null;){var g=i,v=g.stateNode;if(g=g.tag,g!==5&&g!==26&&g!==27||v===null||(g=Qs(i,c),g!=null&&d.unshift(Bo(i,g,v)),g=Qs(i,s),g!=null&&d.push(Bo(i,g,v))),i.tag===3)return d;i=i.return}return[]}function Dj(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function U1(i,s,c,d,g){for(var v=s._reactName,w=[];c!==null&&c!==d;){var T=c,U=T.alternate,ee=T.stateNode;if(T=T.tag,U!==null&&U===d)break;T!==5&&T!==26&&T!==27||ee===null||(U=ee,g?(ee=Qs(c,v),ee!=null&&w.unshift(Bo(c,ee,U))):g||(ee=Qs(c,v),ee!=null&&w.push(Bo(c,ee,U)))),c=c.return}w.length!==0&&i.push({event:s,listeners:w})}var zj=/\r\n?/g,Oj=/\u0000|\uFFFD/g;function q1(i){return(typeof i=="string"?i:""+i).replace(zj,`
50
- `).replace(Oj,"")}function H1(i,s){return s=q1(s),q1(i)===s}function zt(i,s,c,d,g,v){switch(c){case"children":typeof d=="string"?s==="body"||s==="textarea"&&d===""||is(i,d):(typeof d=="number"||typeof d=="bigint")&&s!=="body"&&is(i,""+d);break;case"className":Oa(i,"class",d);break;case"tabIndex":Oa(i,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":Oa(i,c,d);break;case"style":Qc(i,d,v);break;case"data":if(s!=="object"){Oa(i,"data",d);break}case"src":case"href":if(d===""&&(s!=="a"||c!=="href")){i.removeAttribute(c);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){i.removeAttribute(c);break}d=Ua(""+d),i.setAttribute(c,d);break;case"action":case"formAction":if(typeof d=="function"){i.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"?(s!=="input"&&zt(i,s,"name",g.name,g,null),zt(i,s,"formEncType",g.formEncType,g,null),zt(i,s,"formMethod",g.formMethod,g,null),zt(i,s,"formTarget",g.formTarget,g,null)):(zt(i,s,"encType",g.encType,g,null),zt(i,s,"method",g.method,g,null),zt(i,s,"target",g.target,g,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){i.removeAttribute(c);break}d=Ua(""+d),i.setAttribute(c,d);break;case"onClick":d!=null&&(i.onclick=Cr);break;case"onScroll":d!=null&&ot("scroll",i);break;case"onScrollEnd":d!=null&&ot("scrollend",i);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(r(61));if(c=d.__html,c!=null){if(g.children!=null)throw Error(r(60));i.innerHTML=c}}break;case"multiple":i.multiple=d&&typeof d!="function"&&typeof d!="symbol";break;case"muted":i.muted=d&&typeof d!="function"&&typeof d!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(d==null||typeof d=="function"||typeof d=="boolean"||typeof d=="symbol"){i.removeAttribute("xlink:href");break}c=Ua(""+d),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":d!=null&&typeof d!="function"&&typeof d!="symbol"?i.setAttribute(c,""+d):i.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":d&&typeof d!="function"&&typeof d!="symbol"?i.setAttribute(c,""):i.removeAttribute(c);break;case"capture":case"download":d===!0?i.setAttribute(c,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?i.setAttribute(c,d):i.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?i.setAttribute(c,d):i.removeAttribute(c);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?i.removeAttribute(c):i.setAttribute(c,d);break;case"popover":ot("beforetoggle",i),ot("toggle",i),Ys(i,"popover",d);break;case"xlinkActuate":Yr(i,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":Yr(i,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":Yr(i,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":Yr(i,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":Yr(i,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":Yr(i,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":Yr(i,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":Yr(i,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":Yr(i,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":Ys(i,"is",d);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=Xc.get(c)||c,Ys(i,c,d))}}function vp(i,s,c,d,g,v){switch(c){case"style":Qc(i,d,v);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(r(61));if(c=d.__html,c!=null){if(g.children!=null)throw Error(r(60));i.innerHTML=c}}break;case"children":typeof d=="string"?is(i,d):(typeof d=="number"||typeof d=="bigint")&&is(i,""+d);break;case"onScroll":d!=null&&ot("scroll",i);break;case"onScrollEnd":d!=null&&ot("scrollend",i);break;case"onClick":d!=null&&(i.onclick=Cr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!za.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(g=c.endsWith("Capture"),s=c.slice(2,g?c.length-7:void 0),v=i[Nn]||null,v=v!=null?v[c]:null,typeof v=="function"&&i.removeEventListener(s,v,g),typeof d=="function")){typeof v!="function"&&v!==null&&(c in i?i[c]=null:i.hasAttribute(c)&&i.removeAttribute(c)),i.addEventListener(s,d,g);break e}c in i?i[c]=d:d===!0?i.setAttribute(c,""):Ys(i,c,d)}}}function An(i,s,c){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ot("error",i),ot("load",i);var d=!1,g=!1,v;for(v in c)if(c.hasOwnProperty(v)){var w=c[v];if(w!=null)switch(v){case"src":d=!0;break;case"srcSet":g=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,s));default:zt(i,s,v,w,c,null)}}g&&zt(i,s,"srcSet",c.srcSet,c,null),d&&zt(i,s,"src",c.src,c,null);return;case"input":ot("invalid",i);var T=v=w=g=null,U=null,ee=null;for(d in c)if(c.hasOwnProperty(d)){var ce=c[d];if(ce!=null)switch(d){case"name":g=ce;break;case"type":w=ce;break;case"checked":U=ce;break;case"defaultChecked":ee=ce;break;case"value":v=ce;break;case"defaultValue":T=ce;break;case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(r(137,s));break;default:zt(i,s,d,ce,c,null)}}Yc(i,v,T,U,ee,w,g,!1);return;case"select":ot("invalid",i),d=w=v=null;for(g in c)if(c.hasOwnProperty(g)&&(T=c[g],T!=null))switch(g){case"value":v=T;break;case"defaultValue":w=T;break;case"multiple":d=T;default:zt(i,s,g,T,c,null)}s=v,c=w,i.multiple=!!d,s!=null?rs(i,!!d,s,!1):c!=null&&rs(i,!!d,c,!0);return;case"textarea":ot("invalid",i),v=g=d=null;for(w in c)if(c.hasOwnProperty(w)&&(T=c[w],T!=null))switch(w){case"value":d=T;break;case"defaultValue":g=T;break;case"children":v=T;break;case"dangerouslySetInnerHTML":if(T!=null)throw Error(r(91));break;default:zt(i,s,w,T,c,null)}ro(i,d,g,v);return;case"option":for(U in c)if(c.hasOwnProperty(U)&&(d=c[U],d!=null))switch(U){case"selected":i.selected=d&&typeof d!="function"&&typeof d!="symbol";break;default:zt(i,s,U,d,c,null)}return;case"dialog":ot("beforetoggle",i),ot("toggle",i),ot("cancel",i),ot("close",i);break;case"iframe":case"object":ot("load",i);break;case"video":case"audio":for(d=0;d<Oo.length;d++)ot(Oo[d],i);break;case"image":ot("error",i),ot("load",i);break;case"details":ot("toggle",i);break;case"embed":case"source":case"link":ot("error",i),ot("load",i);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ee in c)if(c.hasOwnProperty(ee)&&(d=c[ee],d!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,s));default:zt(i,s,ee,d,c,null)}return;default:if(Fa(s)){for(ce in c)c.hasOwnProperty(ce)&&(d=c[ce],d!==void 0&&vp(i,s,ce,d,c,void 0));return}}for(T in c)c.hasOwnProperty(T)&&(d=c[T],d!=null&&zt(i,s,T,d,c,null))}function Bj(i,s,c,d){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var g=null,v=null,w=null,T=null,U=null,ee=null,ce=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":U=fe;default:d.hasOwnProperty(le)||zt(i,s,le,null,d,fe)}}for(var ne in d){var le=d[ne];if(fe=c[ne],d.hasOwnProperty(ne)&&(le!=null||fe!=null))switch(ne){case"type":v=le;break;case"name":g=le;break;case"checked":ee=le;break;case"defaultChecked":ce=le;break;case"value":w=le;break;case"defaultValue":T=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(r(137,s));break;default:le!==fe&&zt(i,s,ne,le,d,fe)}}Ws(i,w,T,U,ee,ce,v,g);return;case"select":le=w=T=ne=null;for(v in c)if(U=c[v],c.hasOwnProperty(v)&&U!=null)switch(v){case"value":break;case"multiple":le=U;default:d.hasOwnProperty(v)||zt(i,s,v,null,d,U)}for(g in d)if(v=d[g],U=c[g],d.hasOwnProperty(g)&&(v!=null||U!=null))switch(g){case"value":ne=v;break;case"defaultValue":T=v;break;case"multiple":w=v;default:v!==U&&zt(i,s,g,v,d,U)}s=T,c=w,d=le,ne!=null?rs(i,!!c,ne,!1):!!d!=!!c&&(s!=null?rs(i,!!c,s,!0):rs(i,!!c,c?[]:"",!1));return;case"textarea":le=ne=null;for(T in c)if(g=c[T],c.hasOwnProperty(T)&&g!=null&&!d.hasOwnProperty(T))switch(T){case"value":break;case"children":break;default:zt(i,s,T,null,d,g)}for(w in d)if(g=d[w],v=c[w],d.hasOwnProperty(w)&&(g!=null||v!=null))switch(w){case"value":ne=g;break;case"defaultValue":le=g;break;case"children":break;case"dangerouslySetInnerHTML":if(g!=null)throw Error(r(91));break;default:g!==v&&zt(i,s,w,g,d,v)}$a(i,ne,le);return;case"option":for(var Ae in c)if(ne=c[Ae],c.hasOwnProperty(Ae)&&ne!=null&&!d.hasOwnProperty(Ae))switch(Ae){case"selected":i.selected=!1;break;default:zt(i,s,Ae,null,d,ne)}for(U in d)if(ne=d[U],le=c[U],d.hasOwnProperty(U)&&ne!==le&&(ne!=null||le!=null))switch(U){case"selected":i.selected=ne&&typeof ne!="function"&&typeof ne!="symbol";break;default:zt(i,s,U,ne,d,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 Ue in c)ne=c[Ue],c.hasOwnProperty(Ue)&&ne!=null&&!d.hasOwnProperty(Ue)&&zt(i,s,Ue,null,d,ne);for(ee in d)if(ne=d[ee],le=c[ee],d.hasOwnProperty(ee)&&ne!==le&&(ne!=null||le!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(r(137,s));break;default:zt(i,s,ee,ne,d,le)}return;default:if(Fa(s)){for(var Ot in c)ne=c[Ot],c.hasOwnProperty(Ot)&&ne!==void 0&&!d.hasOwnProperty(Ot)&&vp(i,s,Ot,void 0,d,ne);for(ce in d)ne=d[ce],le=c[ce],!d.hasOwnProperty(ce)||ne===le||ne===void 0&&le===void 0||vp(i,s,ce,ne,d,le);return}}for(var X in c)ne=c[X],c.hasOwnProperty(X)&&ne!=null&&!d.hasOwnProperty(X)&&zt(i,s,X,null,d,ne);for(fe in d)ne=d[fe],le=c[fe],!d.hasOwnProperty(fe)||ne===le||ne==null&&le==null||zt(i,s,fe,ne,d,le)}function I1(i){switch(i){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Pj(){if(typeof performance.getEntriesByType=="function"){for(var i=0,s=0,c=performance.getEntriesByType("resource"),d=0;d<c.length;d++){var g=c[d],v=g.transferSize,w=g.initiatorType,T=g.duration;if(v&&T&&I1(w)){for(w=0,T=g.responseEnd,d+=1;d<c.length;d++){var U=c[d],ee=U.startTime;if(ee>T)break;var ce=U.transferSize,fe=U.initiatorType;ce&&I1(fe)&&(U=U.responseEnd,w+=ce*(U<T?1:(T-ee)/(U-ee)))}if(--d,s+=8*(v+w)/(g.duration/1e3),i++,10<i)break}}if(0<i)return s/i/1e6}return navigator.connection&&(i=navigator.connection.downlink,typeof i=="number")?i:5}var bp=null,yp=null;function Wu(i){return i.nodeType===9?i:i.ownerDocument}function V1(i){switch(i){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function G1(i,s){if(i===0)switch(s){case"svg":return 1;case"math":return 2;default:return 0}return i===1&&s==="foreignObject"?0:i}function _p(i,s){return i==="textarea"||i==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.children=="bigint"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var wp=null;function $j(){var i=window.event;return i&&i.type==="popstate"?i===wp?!1:(wp=i,!0):(wp=null,!1)}var Y1=typeof setTimeout=="function"?setTimeout:void 0,Fj=typeof clearTimeout=="function"?clearTimeout:void 0,W1=typeof Promise=="function"?Promise:void 0,Uj=typeof queueMicrotask=="function"?queueMicrotask:typeof W1<"u"?function(i){return W1.resolve(null).then(i).catch(qj)}:Y1;function qj(i){setTimeout(function(){throw i})}function js(i){return i==="head"}function Q1(i,s){var c=s,d=0;do{var g=c.nextSibling;if(i.removeChild(c),g&&g.nodeType===8)if(c=g.data,c==="/$"||c==="/&"){if(d===0){i.removeChild(g),bl(s);return}d--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")d++;else if(c==="html")Po(i.ownerDocument.documentElement);else if(c==="head"){c=i.ownerDocument.head,Po(c);for(var v=c.firstChild;v;){var w=v.nextSibling,T=v.nodeName;v[ni]||T==="SCRIPT"||T==="STYLE"||T==="LINK"&&v.rel.toLowerCase()==="stylesheet"||c.removeChild(v),v=w}}else c==="body"&&Po(i.ownerDocument.body);c=g}while(c);bl(s)}function X1(i,s){var c=i;i=0;do{var d=c.nextSibling;if(c.nodeType===1?s?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(s?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),d&&d.nodeType===8)if(c=d.data,c==="/$"){if(i===0)break;i--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||i++;c=d}while(c)}function kp(i){var s=i.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var c=s;switch(s=s.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":kp(c),ts(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}i.removeChild(c)}}function Hj(i,s,c,d){for(;i.nodeType===1;){var g=c;if(i.nodeName.toLowerCase()!==s.toLowerCase()){if(!d&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(d){if(!i[ni])switch(s){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(v=i.getAttribute("rel"),v==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(v!==g.rel||i.getAttribute("href")!==(g.href==null||g.href===""?null:g.href)||i.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin)||i.getAttribute("title")!==(g.title==null?null:g.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(v=i.getAttribute("src"),(v!==(g.src==null?null:g.src)||i.getAttribute("type")!==(g.type==null?null:g.type)||i.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin))&&v&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(s==="input"&&i.type==="hidden"){var v=g.name==null?null:""+g.name;if(g.type==="hidden"&&i.getAttribute("name")===v)return i}else return i;if(i=Or(i.nextSibling),i===null)break}return null}function Ij(i,s,c){if(s==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!c||(i=Or(i.nextSibling),i===null))return null;return i}function K1(i,s){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!s||(i=Or(i.nextSibling),i===null))return null;return i}function Sp(i){return i.data==="$?"||i.data==="$~"}function jp(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function Vj(i,s){var c=i.ownerDocument;if(i.data==="$~")i._reactRetry=s;else if(i.data!=="$?"||c.readyState!=="loading")s();else{var d=function(){s(),c.removeEventListener("DOMContentLoaded",d)};c.addEventListener("DOMContentLoaded",d),i._reactRetry=d}}function Or(i){for(;i!=null;i=i.nextSibling){var s=i.nodeType;if(s===1||s===3)break;if(s===8){if(s=i.data,s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"||s==="F!"||s==="F")break;if(s==="/$"||s==="/&")return null}}return i}var Np=null;function Z1(i){i=i.nextSibling;for(var s=0;i;){if(i.nodeType===8){var c=i.data;if(c==="/$"||c==="/&"){if(s===0)return Or(i.nextSibling);s--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||s++}i=i.nextSibling}return null}function J1(i){i=i.previousSibling;for(var s=0;i;){if(i.nodeType===8){var c=i.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(s===0)return i;s--}else c!=="/$"&&c!=="/&"||s++}i=i.previousSibling}return null}function eb(i,s,c){switch(s=Wu(c),i){case"html":if(i=s.documentElement,!i)throw Error(r(452));return i;case"head":if(i=s.head,!i)throw Error(r(453));return i;case"body":if(i=s.body,!i)throw Error(r(454));return i;default:throw Error(r(451))}}function Po(i){for(var s=i.attributes;s.length;)i.removeAttributeNode(s[0]);ts(i)}var Br=new Map,tb=new Set;function Qu(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var Pi=$.d;$.d={f:Gj,r:Yj,D:Wj,C:Qj,L:Xj,m:Kj,X:Jj,S:Zj,M:eN};function Gj(){var i=Pi.f(),s=Fu();return i||s}function Yj(i){var s=Xn(i);s!==null&&s.tag===5&&s.type==="form"?vv(s):Pi.r(i)}var gl=typeof document>"u"?null:document;function nb(i,s,c){var d=gl;if(d&&typeof s=="string"&&s){var g=on(s);g='link[rel="'+i+'"][href="'+g+'"]',typeof c=="string"&&(g+='[crossorigin="'+c+'"]'),tb.has(g)||(tb.add(g),i={rel:i,crossOrigin:c,href:s},d.querySelector(g)===null&&(s=d.createElement("link"),An(s,"link",i),tn(s),d.head.appendChild(s)))}}function Wj(i){Pi.D(i),nb("dns-prefetch",i,null)}function Qj(i,s){Pi.C(i,s),nb("preconnect",i,s)}function Xj(i,s,c){Pi.L(i,s,c);var d=gl;if(d&&i&&s){var g='link[rel="preload"][as="'+on(s)+'"]';s==="image"&&c&&c.imageSrcSet?(g+='[imagesrcset="'+on(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(g+='[imagesizes="'+on(c.imageSizes)+'"]')):g+='[href="'+on(i)+'"]';var v=g;switch(s){case"style":v=xl(i);break;case"script":v=vl(i)}Br.has(v)||(i=x({rel:"preload",href:s==="image"&&c&&c.imageSrcSet?void 0:i,as:s},c),Br.set(v,i),d.querySelector(g)!==null||s==="style"&&d.querySelector($o(v))||s==="script"&&d.querySelector(Fo(v))||(s=d.createElement("link"),An(s,"link",i),tn(s),d.head.appendChild(s)))}}function Kj(i,s){Pi.m(i,s);var c=gl;if(c&&i){var d=s&&typeof s.as=="string"?s.as:"script",g='link[rel="modulepreload"][as="'+on(d)+'"][href="'+on(i)+'"]',v=g;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=vl(i)}if(!Br.has(v)&&(i=x({rel:"modulepreload",href:i},s),Br.set(v,i),c.querySelector(g)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(Fo(v)))return}d=c.createElement("link"),An(d,"link",i),tn(d),c.head.appendChild(d)}}}function Zj(i,s,c){Pi.S(i,s,c);var d=gl;if(d&&i){var g=ri(d).hoistableStyles,v=xl(i);s=s||"default";var w=g.get(v);if(!w){var T={loading:0,preload:null};if(w=d.querySelector($o(v)))T.loading=5;else{i=x({rel:"stylesheet",href:i,"data-precedence":s},c),(c=Br.get(v))&&Cp(i,c);var U=w=d.createElement("link");tn(U),An(U,"link",i),U._p=new Promise(function(ee,ce){U.onload=ee,U.onerror=ce}),U.addEventListener("load",function(){T.loading|=1}),U.addEventListener("error",function(){T.loading|=2}),T.loading|=4,Xu(w,s,d)}w={type:"stylesheet",instance:w,count:1,state:T},g.set(v,w)}}}function Jj(i,s){Pi.X(i,s);var c=gl;if(c&&i){var d=ri(c).hoistableScripts,g=vl(i),v=d.get(g);v||(v=c.querySelector(Fo(g)),v||(i=x({src:i,async:!0},s),(s=Br.get(g))&&Ep(i,s),v=c.createElement("script"),tn(v),An(v,"link",i),c.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},d.set(g,v))}}function eN(i,s){Pi.M(i,s);var c=gl;if(c&&i){var d=ri(c).hoistableScripts,g=vl(i),v=d.get(g);v||(v=c.querySelector(Fo(g)),v||(i=x({src:i,async:!0,type:"module"},s),(s=Br.get(g))&&Ep(i,s),v=c.createElement("script"),tn(v),An(v,"link",i),c.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},d.set(g,v))}}function rb(i,s,c,d){var g=(g=Ce.current)?Qu(g):null;if(!g)throw Error(r(446));switch(i){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(s=xl(c.href),c=ri(g).hoistableStyles,d=c.get(s),d||(d={type:"style",instance:null,count:0,state:null},c.set(s,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){i=xl(c.href);var v=ri(g).hoistableStyles,w=v.get(i);if(w||(g=g.ownerDocument||g,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(i,w),(v=g.querySelector($o(i)))&&!v._p&&(w.instance=v,w.state.loading=5),Br.has(i)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},Br.set(i,c),v||tN(g,i,c,w.state))),s&&d===null)throw Error(r(528,""));return w}if(s&&d!==null)throw Error(r(529,""));return null;case"script":return s=c.async,c=c.src,typeof c=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=vl(c),c=ri(g).hoistableScripts,d=c.get(s),d||(d={type:"script",instance:null,count:0,state:null},c.set(s,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,i))}}function xl(i){return'href="'+on(i)+'"'}function $o(i){return'link[rel="stylesheet"]['+i+"]"}function ib(i){return x({},i,{"data-precedence":i.precedence,precedence:null})}function tN(i,s,c,d){i.querySelector('link[rel="preload"][as="style"]['+s+"]")?d.loading=1:(s=i.createElement("link"),d.preload=s,s.addEventListener("load",function(){return d.loading|=1}),s.addEventListener("error",function(){return d.loading|=2}),An(s,"link",c),tn(s),i.head.appendChild(s))}function vl(i){return'[src="'+on(i)+'"]'}function Fo(i){return"script[async]"+i}function sb(i,s,c){if(s.count++,s.instance===null)switch(s.type){case"style":var d=i.querySelector('style[data-href~="'+on(c.href)+'"]');if(d)return s.instance=d,tn(d),d;var g=x({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return d=(i.ownerDocument||i).createElement("style"),tn(d),An(d,"style",g),Xu(d,c.precedence,i),s.instance=d;case"stylesheet":g=xl(c.href);var v=i.querySelector($o(g));if(v)return s.state.loading|=4,s.instance=v,tn(v),v;d=ib(c),(g=Br.get(g))&&Cp(d,g),v=(i.ownerDocument||i).createElement("link"),tn(v);var w=v;return w._p=new Promise(function(T,U){w.onload=T,w.onerror=U}),An(v,"link",d),s.state.loading|=4,Xu(v,c.precedence,i),s.instance=v;case"script":return v=vl(c.src),(g=i.querySelector(Fo(v)))?(s.instance=g,tn(g),g):(d=c,(g=Br.get(v))&&(d=x({},c),Ep(d,g)),i=i.ownerDocument||i,g=i.createElement("script"),tn(g),An(g,"link",d),i.head.appendChild(g),s.instance=g);case"void":return null;default:throw Error(r(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(d=s.instance,s.state.loading|=4,Xu(d,c.precedence,i));return s.instance}function Xu(i,s,c){for(var d=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),g=d.length?d[d.length-1]:null,v=g,w=0;w<d.length;w++){var T=d[w];if(T.dataset.precedence===s)v=T;else if(v!==g)break}v?v.parentNode.insertBefore(i,v.nextSibling):(s=c.nodeType===9?c.head:c,s.insertBefore(i,s.firstChild))}function Cp(i,s){i.crossOrigin==null&&(i.crossOrigin=s.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=s.referrerPolicy),i.title==null&&(i.title=s.title)}function Ep(i,s){i.crossOrigin==null&&(i.crossOrigin=s.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=s.referrerPolicy),i.integrity==null&&(i.integrity=s.integrity)}var Ku=null;function ab(i,s,c){if(Ku===null){var d=new Map,g=Ku=new Map;g.set(c,d)}else g=Ku,d=g.get(c),d||(d=new Map,g.set(c,d));if(d.has(i))return d;for(d.set(i,null),c=c.getElementsByTagName(i),g=0;g<c.length;g++){var v=c[g];if(!(v[ni]||v[Zt]||i==="link"&&v.getAttribute("rel")==="stylesheet")&&v.namespaceURI!=="http://www.w3.org/2000/svg"){var w=v.getAttribute(s)||"";w=i+w;var T=d.get(w);T?T.push(v):d.set(w,[v])}}return d}function lb(i,s,c){i=i.ownerDocument||i,i.head.insertBefore(c,s==="title"?i.querySelector("head > title"):null)}function nN(i,s,c){if(c===1||s.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;switch(s.rel){case"stylesheet":return i=s.disabled,typeof s.precedence=="string"&&i==null;default:return!0}case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function ob(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function rN(i,s,c,d){if(c.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var g=xl(d.href),v=s.querySelector($o(g));if(v){s=v._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(i.count++,i=Zu.bind(i),s.then(i,i)),c.state.loading|=4,c.instance=v,tn(v);return}v=s.ownerDocument||s,d=ib(d),(g=Br.get(g))&&Cp(d,g),v=v.createElement("link"),tn(v);var w=v;w._p=new Promise(function(T,U){w.onload=T,w.onerror=U}),An(v,"link",d),c.instance=v}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(c,s),(s=c.state.preload)&&(c.state.loading&3)===0&&(i.count++,c=Zu.bind(i),s.addEventListener("load",c),s.addEventListener("error",c))}}var Tp=0;function iN(i,s){return i.stylesheets&&i.count===0&&ed(i,i.stylesheets),0<i.count||0<i.imgCount?function(c){var d=setTimeout(function(){if(i.stylesheets&&ed(i,i.stylesheets),i.unsuspend){var v=i.unsuspend;i.unsuspend=null,v()}},6e4+s);0<i.imgBytes&&Tp===0&&(Tp=62500*Pj());var g=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&ed(i,i.stylesheets),i.unsuspend)){var v=i.unsuspend;i.unsuspend=null,v()}},(i.imgBytes>Tp?50:800)+s);return i.unsuspend=c,function(){i.unsuspend=null,clearTimeout(d),clearTimeout(g)}}:null}function Zu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ed(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var Ju=null;function ed(i,s){i.stylesheets=null,i.unsuspend!==null&&(i.count++,Ju=new Map,s.forEach(sN,i),Ju=null,Zu.call(i))}function sN(i,s){if(!(s.state.loading&4)){var c=Ju.get(i);if(c)var d=c.get(null);else{c=new Map,Ju.set(i,c);for(var g=i.querySelectorAll("link[data-precedence],style[data-precedence]"),v=0;v<g.length;v++){var w=g[v];(w.nodeName==="LINK"||w.getAttribute("media")!=="not all")&&(c.set(w.dataset.precedence,w),d=w)}d&&c.set(null,d)}g=s.instance,w=g.getAttribute("data-precedence"),v=c.get(w)||d,v===d&&c.set(null,g),c.set(w,g),this.count++,d=Zu.bind(this),g.addEventListener("load",d),g.addEventListener("error",d),v?v.parentNode.insertBefore(g,v.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(g,i.firstChild)),s.state.loading|=4}}var Uo={$$typeof:C,Provider:null,Consumer:null,_currentValue:se,_currentValue2:se,_threadCount:0};function aN(i,s,c,d,g,v,w,T,U){this.tag=1,this.containerInfo=i,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=Dn(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Dn(0),this.hiddenUpdates=Dn(null),this.identifierPrefix=d,this.onUncaughtError=g,this.onCaughtError=v,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=U,this.incompleteTransitions=new Map}function cb(i,s,c,d,g,v,w,T,U,ee,ce,fe){return i=new aN(i,s,c,w,U,ee,ce,fe,T),s=1,v===!0&&(s|=24),v=fr(3,null,null,s),i.current=v,v.stateNode=i,s=oh(),s.refCount++,i.pooledCache=s,s.refCount++,v.memoizedState={element:d,isDehydrated:c,cache:s},fh(v),i}function ub(i){return i?(i=Qa,i):Qa}function db(i,s,c,d,g,v){g=ub(g),d.context===null?d.context=g:d.pendingContext=g,d=ps(s),d.payload={element:c},v=v===void 0?null:v,v!==null&&(d.callback=v),c=ms(i,d,s),c!==null&&(rr(c,i,s),bo(c,i,s))}function fb(i,s){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var c=i.retryLane;i.retryLane=c!==0&&c<s?c:s}}function Ap(i,s){fb(i,s),(i=i.alternate)&&fb(i,s)}function hb(i){if(i.tag===13||i.tag===31){var s=ea(i,67108864);s!==null&&rr(s,i,67108864),Ap(i,67108864)}}function pb(i){if(i.tag===13||i.tag===31){var s=xr();s=qn(s);var c=ea(i,s);c!==null&&rr(c,i,s),Ap(i,s)}}var td=!0;function lN(i,s,c,d){var g=P.T;P.T=null;var v=$.p;try{$.p=2,Mp(i,s,c,d)}finally{$.p=v,P.T=g}}function oN(i,s,c,d){var g=P.T;P.T=null;var v=$.p;try{$.p=8,Mp(i,s,c,d)}finally{$.p=v,P.T=g}}function Mp(i,s,c,d){if(td){var g=Rp(d);if(g===null)xp(i,s,d,nd,c),gb(i,d);else if(uN(g,i,s,c,d))d.stopPropagation();else if(gb(i,d),s&4&&-1<cN.indexOf(i)){for(;g!==null;){var v=Xn(g);if(v!==null)switch(v.tag){case 3:if(v=v.stateNode,v.current.memoizedState.isDehydrated){var w=xe(v.pendingLanes);if(w!==0){var T=v;for(T.pendingLanes|=2,T.entangledLanes|=2;w;){var U=1<<31-et(w);T.entanglements[1]|=U,w&=~U}ui(v),(kt&6)===0&&(Pu=Te()+500,zo(0))}}break;case 31:case 13:T=ea(v,2),T!==null&&rr(T,v,2),Fu(),Ap(v,2)}if(v=Rp(d),v===null&&xp(i,s,d,nd,c),v===g)break;g=v}g!==null&&d.stopPropagation()}else xp(i,s,d,null,c)}}function Rp(i){return i=qa(i),Lp(i)}var nd=null;function Lp(i){if(nd=null,i=wi(i),i!==null){var s=o(i);if(s===null)i=null;else{var c=s.tag;if(c===13){if(i=u(s),i!==null)return i;i=null}else if(c===31){if(i=f(s),i!==null)return i;i=null}else if(c===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;i=null}else s!==i&&(i=null)}}return nd=i,null}function mb(i){switch(i){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(Hr()){case oe:return 2;case we:return 8;case Q:case me:return 32;case Re:return 268435456;default:return 32}default:return 32}}var Dp=!1,Ns=null,Cs=null,Es=null,qo=new Map,Ho=new Map,Ts=[],cN="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 gb(i,s){switch(i){case"focusin":case"focusout":Ns=null;break;case"dragenter":case"dragleave":Cs=null;break;case"mouseover":case"mouseout":Es=null;break;case"pointerover":case"pointerout":qo.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ho.delete(s.pointerId)}}function Io(i,s,c,d,g,v){return i===null||i.nativeEvent!==v?(i={blockedOn:s,domEventName:c,eventSystemFlags:d,nativeEvent:v,targetContainers:[g]},s!==null&&(s=Xn(s),s!==null&&hb(s)),i):(i.eventSystemFlags|=d,s=i.targetContainers,g!==null&&s.indexOf(g)===-1&&s.push(g),i)}function uN(i,s,c,d,g){switch(s){case"focusin":return Ns=Io(Ns,i,s,c,d,g),!0;case"dragenter":return Cs=Io(Cs,i,s,c,d,g),!0;case"mouseover":return Es=Io(Es,i,s,c,d,g),!0;case"pointerover":var v=g.pointerId;return qo.set(v,Io(qo.get(v)||null,i,s,c,d,g)),!0;case"gotpointercapture":return v=g.pointerId,Ho.set(v,Io(Ho.get(v)||null,i,s,c,d,g)),!0}return!1}function xb(i){var s=wi(i.target);if(s!==null){var c=o(s);if(c!==null){if(s=c.tag,s===13){if(s=u(c),s!==null){i.blockedOn=s,Zl(i.priority,function(){pb(c)});return}}else if(s===31){if(s=f(c),s!==null){i.blockedOn=s,Zl(i.priority,function(){pb(c)});return}}else if(s===3&&c.stateNode.current.memoizedState.isDehydrated){i.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}i.blockedOn=null}function rd(i){if(i.blockedOn!==null)return!1;for(var s=i.targetContainers;0<s.length;){var c=Rp(i.nativeEvent);if(c===null){c=i.nativeEvent;var d=new c.constructor(c.type,c);ss=d,c.target.dispatchEvent(d),ss=null}else return s=Xn(c),s!==null&&hb(s),i.blockedOn=c,!1;s.shift()}return!0}function vb(i,s,c){rd(i)&&c.delete(s)}function dN(){Dp=!1,Ns!==null&&rd(Ns)&&(Ns=null),Cs!==null&&rd(Cs)&&(Cs=null),Es!==null&&rd(Es)&&(Es=null),qo.forEach(vb),Ho.forEach(vb)}function id(i,s){i.blockedOn===s&&(i.blockedOn=null,Dp||(Dp=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,dN)))}var sd=null;function bb(i){sd!==i&&(sd=i,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){sd===i&&(sd=null);for(var s=0;s<i.length;s+=3){var c=i[s],d=i[s+1],g=i[s+2];if(typeof d!="function"){if(Lp(d||c)===null)continue;break}var v=Xn(c);v!==null&&(i.splice(s,3),s-=3,Rh(v,{pending:!0,data:g,method:c.method,action:d},d,g))}}))}function bl(i){function s(U){return id(U,i)}Ns!==null&&id(Ns,i),Cs!==null&&id(Cs,i),Es!==null&&id(Es,i),qo.forEach(s),Ho.forEach(s);for(var c=0;c<Ts.length;c++){var d=Ts[c];d.blockedOn===i&&(d.blockedOn=null)}for(;0<Ts.length&&(c=Ts[0],c.blockedOn===null);)xb(c),c.blockedOn===null&&Ts.shift();if(c=(i.ownerDocument||i).$$reactFormReplay,c!=null)for(d=0;d<c.length;d+=3){var g=c[d],v=c[d+1],w=g[Nn]||null;if(typeof v=="function")w||bb(c);else if(w){var T=null;if(v&&v.hasAttribute("formAction")){if(g=v,w=v[Nn]||null)T=w.formAction;else if(Lp(g)!==null)continue}else T=w.action;typeof T=="function"?c[d+1]=T:(c.splice(d,3),d-=3),bb(c)}}}function yb(){function i(v){v.canIntercept&&v.info==="react-transition"&&v.intercept({handler:function(){return new Promise(function(w){return g=w})},focusReset:"manual",scroll:"manual"})}function s(){g!==null&&(g(),g=null),d||setTimeout(c,20)}function c(){if(!d&&!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 d=!1,g=null;return navigation.addEventListener("navigate",i),navigation.addEventListener("navigatesuccess",s),navigation.addEventListener("navigateerror",s),setTimeout(c,100),function(){d=!0,navigation.removeEventListener("navigate",i),navigation.removeEventListener("navigatesuccess",s),navigation.removeEventListener("navigateerror",s),g!==null&&(g(),g=null)}}}function zp(i){this._internalRoot=i}ad.prototype.render=zp.prototype.render=function(i){var s=this._internalRoot;if(s===null)throw Error(r(409));var c=s.current,d=xr();db(c,d,i,s,null,null)},ad.prototype.unmount=zp.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var s=i.containerInfo;db(i.current,2,null,i,null,null),Fu(),s[ur]=null}};function ad(i){this._internalRoot=i}ad.prototype.unstable_scheduleHydration=function(i){if(i){var s=Kl();i={blockedOn:null,target:i,priority:s};for(var c=0;c<Ts.length&&s!==0&&s<Ts[c].priority;c++);Ts.splice(c,0,i),c===0&&xb(i)}};var _b=t.version;if(_b!=="19.2.8")throw Error(r(527,_b,"19.2.8"));$.findDOMNode=function(i){var s=i._reactInternals;if(s===void 0)throw typeof i.render=="function"?Error(r(188)):(i=Object.keys(i).join(","),Error(r(268,i)));return i=p(s),i=i!==null?m(i):null,i=i===null?null:i.stateNode,i};var fN={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:P,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ld=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ld.isDisabled&&ld.supportsFiber)try{st=ld.inject(fN),jt=ld}catch{}}return Go.createRoot=function(i,s){if(!a(i))throw Error(r(299));var c=!1,d="",g=Ev,v=Tv,w=Av;return s!=null&&(s.unstable_strictMode===!0&&(c=!0),s.identifierPrefix!==void 0&&(d=s.identifierPrefix),s.onUncaughtError!==void 0&&(g=s.onUncaughtError),s.onCaughtError!==void 0&&(v=s.onCaughtError),s.onRecoverableError!==void 0&&(w=s.onRecoverableError)),s=cb(i,1,!1,null,null,c,d,null,g,v,w,yb),i[ur]=s.current,gp(i),new zp(s)},Go.hydrateRoot=function(i,s,c){if(!a(i))throw Error(r(299));var d=!1,g="",v=Ev,w=Tv,T=Av,U=null;return c!=null&&(c.unstable_strictMode===!0&&(d=!0),c.identifierPrefix!==void 0&&(g=c.identifierPrefix),c.onUncaughtError!==void 0&&(v=c.onUncaughtError),c.onCaughtError!==void 0&&(w=c.onCaughtError),c.onRecoverableError!==void 0&&(T=c.onRecoverableError),c.formState!==void 0&&(U=c.formState)),s=cb(i,1,!0,s,c??null,d,g,U,v,w,T,yb),s.context=ub(null),c=s.current,d=xr(),d=qn(d),g=ps(d),g.callback=null,ms(c,g,d),c=d,s.current.lanes=c,It(s,c),ui(s),i[ur]=s.current,gp(i),new ad(s)},Go.version="19.2.8",Go}var Lb;function jN(){if(Lb)return Pp.exports;Lb=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(),Pp.exports=SN(),Pp.exports}var NN=jN();const Db=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,f={setState:r,getState:a,getInitialState:()=>h,subscribe:p=>(n.add(p),()=>n.delete(p))},h=t=e(r,a,f);return f},CN=(e=>e?Db(e):Db),EN=e=>e;function TN(e,t=EN){const n=od.useSyncExternalStore(e.subscribe,od.useCallback(()=>t(e.getState()),[e,t]),od.useCallback(()=>t(e.getInitialState()),[e,t]));return od.useDebugValue(n),n}const zb=e=>{const t=CN(e),n=r=>TN(t,r);return Object.assign(n,t),n},AN=(e=>e?zb(e):zb),Qm="companion_auth_token";function Ob(){return typeof window>"u"?null:localStorage.getItem(Qm)||null}const MN=e=>({authToken:Ob(),isAuthenticated:Ob()!==null,setAuthToken:t=>{localStorage.setItem(Qm,t),e({authToken:t,isAuthenticated:!0})},logout:()=>{localStorage.removeItem(Qm),e({authToken:null,isAuthenticated:!1})}});function Wt(e,t){if(!e.has(t))return e;const n=new Map(e);return n.delete(t),n}function RN(e,t){if(!e.has(t))return e;const n=new Set(e);return n.delete(t),n}function LN(){if(typeof window>"u")return new Map;try{return new Map(JSON.parse(localStorage.getItem("cc-session-names")||"[]"))}catch{return new Map}}function DN(){return typeof window>"u"?null:localStorage.getItem("cc-current-session")||null}function zN(){if(typeof window>"u")return new Set;try{return new Set(JSON.parse(localStorage.getItem("cc-collapsed-projects")||"[]"))}catch{return new Set}}const ON=e=>({sessions:new Map,sdkSessions:[],currentSessionId:DN(),connectionStatus:new Map,cliConnected:new Map,cliReconnecting:new Map,sessionStatus:new Map,previousPermissionMode:new Map,sessionNames:LN(),recentlyRenamed:new Set,prStatus:new Map,linkedLinearIssues:new Map,mcpServers:new Map,rateLimit:new Map,collapsedProjects:zN(),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=Wt(n.sessionNames,t);return localStorage.setItem("cc-session-names",JSON.stringify(Array.from(r.entries()))),n.currentSessionId===t&&localStorage.removeItem("cc-current-session"),{sessions:Wt(n.sessions,t),connectionStatus:Wt(n.connectionStatus,t),cliConnected:Wt(n.cliConnected,t),cliReconnecting:Wt(n.cliReconnecting,t),sessionStatus:Wt(n.sessionStatus,t),previousPermissionMode:Wt(n.previousPermissionMode,t),sessionNames:r,recentlyRenamed:RN(n.recentlyRenamed,t),mcpServers:Wt(n.mcpServers,t),rateLimit:Wt(n.rateLimit,t),prStatus:Wt(n.prStatus,t),linkedLinearIssues:Wt(n.linkedLinearIssues,t),sdkSessions:n.sdkSessions.filter(a=>a.sessionId!==t),currentSessionId:n.currentSessionId===t?null:n.currentSessionId,messages:Wt(n.messages,t),streaming:Wt(n.streaming,t),streamingStartedAt:Wt(n.streamingStartedAt,t),streamingOutputTokens:Wt(n.streamingOutputTokens,t),pendingPermissions:Wt(n.pendingPermissions,t),aiResolvedPermissions:Wt(n.aiResolvedPermissions,t),sessionTasks:Wt(n.sessionTasks,t),changedFilesTick:Wt(n.changedFilesTick,t),gitChangedFilesCount:Wt(n.gitChangedFilesCount,t),sessionProcesses:Wt(n.sessionProcesses,t),toolProgress:Wt(n.toolProgress,t),toolActivity:Wt(n.toolActivity,t),diffPanelSelectedFile:Wt(n.diffPanelSelectedFile,t),chatTabReentryTickBySession:Wt(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}):{}})}),BN=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}})}),PN=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}})}),$N=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(f=>f.id===n?{...f,...r}:f)),{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(f=>f.taskId===n?{...f,...r}:f)),{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(f=>f.toolUseId===n?{...f,...r}:f)),{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(f=>f.toolUseId===n?{...f,...r}:f)),{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(f=>f.toolUseId===n.toolUseId);if(u>=0){const f=o[u];o[u]={...f,...n,startedAt:f.startedAt,completedAt:n.completedAt??f.completedAt,elapsedSeconds:Math.max(f.elapsedSeconds,n.elapsedSeconds),isError:f.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(f=>f.toolUseId===n?{...f,...r}:f)),{toolActivity:o}})}),Zi=[{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"]}],FN=Zi.map(e=>e.id),z5="cc-task-panel-config";function Xm(){return{order:[...FN],enabled:Object.fromEntries(Zi.map(e=>[e.id,!0]))}}function UN(){if(typeof window>"u")return Xm();try{const e=localStorage.getItem(z5);if(e){const t=JSON.parse(e),n=new Set(t.order);for(const a of Zi)n.has(a.id)||(t.order.push(a.id),t.enabled[a.id]=!0);const r=new Set(Zi.map(a=>a.id));return t.order=t.order.filter(a=>r.has(a)),t}}catch{}return Xm()}function cd(e){try{localStorage.setItem(z5,JSON.stringify(e))}catch{}}function qN(){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 HN(){if(typeof window>"u")return!0;const e=localStorage.getItem("cc-notification-sound");return e!==null?e==="true":!0}function IN(){if(typeof window>"u")return!1;const e=localStorage.getItem("cc-notification-desktop");return e!==null?e==="true":!1}function O5(){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 VN(){if(typeof window>"u")return"standard";const e=window.localStorage.getItem("cc-density");return e==="standard"||e==="compact"?e:"standard"}const GN=e=>({darkMode:qN(),notificationSound:HN(),notificationDesktop:IN(),sidebarOpen:typeof window<"u"?window.innerWidth>=768:!0,taskPanelOpen:typeof window<"u"?window.innerWidth>=1024:!0,taskPanelConfig:UN(),taskPanelConfigMode:!1,homeResetKey:0,publicUrl:"",magicUiAvailable:!1,activeTab:"chat",chatTabReentryTickBySession:new Map,diffPanelSelectedFile:new Map,diffBase:O5(),density:VN(),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 cd(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 cd(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 cd(o),{taskPanelConfig:o}}),resetTaskPanelConfig:()=>{const t=Xm();cd(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 B5(){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 YN=e=>({quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalPlacement:B5(),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,f=r?o+1:o,h={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,h],activeQuickTerminalTabId:h.id,quickTerminalNextHostIndex:u,quickTerminalNextDockerIndex:f}}),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 WN(){return typeof window>"u"?null:localStorage.getItem("cc-update-dismissed")||null}const QN=e=>({updateInfo:null,updateDismissedVersion:WN(),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})}),XN=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}})}),Y=AN((...e)=>({...MN(...e),...ON(...e),...BN(...e),...PN(...e),...$N(...e),...GN(...e),...YN(...e),...QN(...e),...XN(...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:O5(),quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalPlacement:B5(),quickTerminalNextHostIndex:1,quickTerminalNextDockerIndex:1,terminalOpen:!1,terminalCwd:null,terminalId:null})}})),KN=Object.freeze(Object.defineProperty({__proto__:null,useStore:Y},Symbol.toStringTag,{value:"Module"})),ZN="Your Claude login has expired or is invalid — re-authenticate (run `claude login` in a terminal), then use Reconnect to resume this session.",JN=/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 eC(e){return JN.test(e)}function tC(e){return e.is_error?e.api_error_status===401||e.api_error_status===403?!0:eC(`${e.result??""} ${(e.errors??[]).join(" ")}`):!1}const Bb=["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"],Pb=["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 $b(){const e=Bb[Math.floor(Math.random()*Bb.length)],t=Pb[Math.floor(Math.random()*Pb.length)];return`${e} ${t}`}function P5(e){for(let t=0;t<100;t++){const n=$b();if(!e.has(n))return n}return $b()}let qp=null;function nC(){return qp||(qp=new AudioContext),qp}function rC(){try{const e=nC();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 $5{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),f=this.removeEmpty(this.tokenize(o,r)),h=this.removeEmpty(this.tokenize(u,r));return this.diffWithOptionsObj(f,h,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},f=n.length,h=t.length;let p=1,m=f+h;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>=h&&_+1>=f)return u(this.buildValues(y[0].lastComponent,n,t));let j=-1/0,N=1/0;const S=()=>{for(let E=Math.max(j,-p);E<=Math.min(N,p);E+=2){let C;const O=y[E-1],D=y[E+1];O&&(y[E-1]=void 0);let L=!1;if(D){const F=D.oldPos-E;L=D&&0<=F&&F<f}const I=O&&O.oldPos+1<h;if(!L&&!I){y[E]=void 0;continue}if(!I||L&&O.oldPos<D.oldPos?C=this.addToPath(D,!0,!1,0,r):C=this.addToPath(O,!1,!0,1,r),_=this.extractCommon(C,n,t,E,r),C.oldPos+1>=h&&_+1>=f)return u(this.buildValues(C.lastComponent,n,t))||!0;y[E]=C,C.oldPos+1>=h&&(N=Math.min(N,E-1)),_+1>=f&&(j=Math.max(j,E+1))}p++};if(a)(function E(){setTimeout(function(){if(p>m||Date.now()>b)return a(void 0);S()||E()},0)})();else for(;p<=m&&Date.now()<=b;){const E=S();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,f=r.length;let h=t.oldPos,p=h-a,m=0;for(;p+1<u&&h+1<f&&this.equals(r[h+1],n[p+1],o);)p++,h++,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=h,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 f=0,h=0,p=0;for(;f<u;f++){const m=a[f];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(h,h+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(h,h+m.count));h+=m.count,m.added||(p+=m.count)}}return a}}function Fb(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 Ub(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 Km(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 Zm(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 Yo(e,t){return Km(e,t,"")}function ud(e,t){return Zm(e,t,"")}function qb(e,t){return t.slice(0,iC(e,t))}function iC(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 F5(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 Jm(e,t){if(t)return pc(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function jl(e,t){if(t)return pc(e,t)[0];const n=e.match(/^\s*/);return n?n[0]:""}function pc(e,t){if(!t)return[jl(e),Jm(e)];if(t.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');const n=F5(e,t),r=n[0],a=n[n.length-1],o=/\s/.test(r)?r:"",u=/\s/.test(a)?a:"";return[o,u]}const Hb="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}",sC=new RegExp(`[${Hb}]+|\\s+|[^${Hb}]`,"ug");class aC extends $5{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=F5(t,u)}else r=t.match(sC)||[];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)&&Ib(r,o,a,u,n.intlSegmenter),r=u,a=null,o=null)}),(a||o)&&Ib(r,o,a,null,n.intlSegmenter),t}}const lC=new aC;function oC(e,t,n){return lC.diff(e,t,n)}function Ib(e,t,n,r,a){if(t&&n){const[o,u]=pc(t.value,a),[f,h]=pc(n.value,a);if(e){const p=Fb(o,f);e.value=Zm(e.value,f,p),t.value=Yo(t.value,p),n.value=Yo(n.value,p)}if(r){const p=Ub(u,h);r.value=Km(r.value,h,p),t.value=ud(t.value,p),n.value=ud(n.value,p)}}else if(n){if(e){const o=jl(n.value,a);n.value=n.value.substring(o.length)}if(r){const o=jl(r.value,a);r.value=r.value.substring(o.length)}}else if(e&&r){const o=jl(r.value,a),[u,f]=pc(t.value,a),h=Fb(o,u);t.value=Yo(t.value,h);const p=Ub(Yo(o,h),f);t.value=ud(t.value,p),r.value=Km(r.value,o,p),e.value=Zm(e.value,o,o.slice(0,o.length-p.length))}else if(r){const o=jl(r.value,a),u=Jm(t.value,a),f=qb(u,o);t.value=ud(t.value,f)}else if(e){const o=Jm(e.value,a),u=jl(t.value,a),f=qb(o,u);t.value=Yo(t.value,f)}}class cC extends $5{constructor(){super(...arguments),this.tokenize=dC}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 uC=new cC;function Vb(e,t,n){return uC.diff(e,t,n)}function dC(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 fC(e,t,n,r,a,o,u){let f;u?typeof u=="function"?f={callback:u}:f=u:f={},typeof f.context>"u"&&(f.context=4);const h=f.context;if(f.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(f.callback){const{callback:m}=f;Vb(n,r,Object.assign(Object.assign({},f),{callback:x=>{const b=p(x);m(b)}}))}else return p(Vb(n,r,f));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,S=1;for(let E=0;E<m.length;E++){const C=m[E],O=C.lines||hC(C.value);if(C.lines=O,C.added||C.removed){if(!y){const D=m[E-1];y=N,_=S,D&&(j=h>0?x(D.lines.slice(-h)):[],y-=j.length,_-=j.length)}for(const D of O)j.push((C.added?"+":"-")+D);C.added?S+=O.length:N+=O.length}else{if(y)if(O.length<=h*2&&E<m.length-2)for(const D of x(O))j.push(D);else{const D=Math.min(O.length,h);for(const I of x(O.slice(0,D)))j.push(I);const L={oldStart:y,oldLines:N-y+D,newStart:_,newLines:S-_+D,lines:j};b.push(L),y=0,_=0,j=[]}N+=O.length,S+=O.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 hC(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 pC(e,t){return fC("","",e,t,"","",{context:3}).hunks.map(r=>{const a=`@@ -${r.oldStart},${r.oldLines} +${r.newStart},${r.newLines} @@`,o=[];let u=r.oldStart,f=r.newStart;for(const h of r.lines){const p=h[0],m=h.slice(1);p==="-"?o.push({type:"del",content:m,oldLineNo:u++}):p==="+"?o.push({type:"add",content:m,newLineNo:f++}):o.push({type:"context",content:m,oldLineNo:u++,newLineNo:f++})}return U5(o),{header:a,lines:o}})}function mC(e){const t=[],n=e.split(`
60
- `);let r=null,a=null,o=0,u=0;for(const f of n){if(f.startsWith("diff --git")||f.startsWith("diff --cc")){a&&r&&r.hunks.push(a),r&&t.push(r),r={fileName:"",hunks:[]},a=null;continue}if(f.startsWith("--- a/")||f.startsWith("--- /dev/null"))continue;if(f.startsWith("+++ b/")){r&&(r.fileName=f.slice(6));continue}if(f.startsWith("+++ /dev/null")||f.startsWith("index ")||f.startsWith("new file")||f.startsWith("deleted file")||f.startsWith("old mode")||f.startsWith("new mode")||f.startsWith("rename from")||f.startsWith("rename to")||f.startsWith("similarity index")||f.startsWith("Binary files"))continue;const h=f.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@(.*)$/);if(h){a&&r&&r.hunks.push(a),o=parseInt(h[1],10),u=parseInt(h[2],10),a={header:f,lines:[]};continue}a&&(f.startsWith("+")?a.lines.push({type:"add",content:f.slice(1),newLineNo:u++}):f.startsWith("-")?a.lines.push({type:"del",content:f.slice(1),oldLineNo:o++}):f.startsWith(" ")&&a.lines.push({type:"context",content:f.slice(1),oldLineNo:o++,newLineNo:u++}))}a&&r&&r.hunks.push(a),r&&t.push(r);for(const f of t)for(const h of f.hunks)U5(h.lines);return t}function U5(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,f=o-a;if(u>0&&f>0){const h=Math.min(u,f);for(let p=0;p<h;p++){const m=e[n+p],x=e[a+p],b=oC(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 gC({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 xC({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(gC,{line:n}),!n.content&&" "]})]},r))]})}function vC({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 Vl({oldText:e,newText:t,unifiedDiff:n,fileName:r,mode:a="compact"}){const o=a==="compact",u=!o,f=k.useMemo(()=>{if(n)return mC(n);const h=e??"",p=t??"";if(!h&&!p)return[];const m=pC(h,p);return[{fileName:r||"",hunks:m}]},[e,t,n,r]);return f.length===0||f.every(h=>h.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:f.map((h,p)=>l.jsxs("div",{className:"diff-file",children:[(h.fileName||r)&&l.jsx(vC,{fileName:h.fileName||r||""}),h.hunks.map((m,x)=>l.jsx(xC,{hunk:m,showLineNumbers:u},x))]},p))})}const q5=k.createContext(null);function bz({value:e,children:t}){return l.jsx(q5.Provider,{value:e,children:t})}function bC(){const e=k.useContext(q5),t=Y(n=>n.density);return e??t}function Gl(){return bC()==="compact"}function Nf({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 yC={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 $c(e){return yC[e]||"tool"}function Bs(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 H5({name:e,input:t,toolUseId:n}){const[r,a]=k.useState(e==="Edit"),o=$c(e),u=Bs(e),f=jc(e,t);return e==="Edit"?l.jsx(_C,{input:t,toolUseId:n}):e==="Bash"?l.jsx(wC,{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(Ol,{type:o}),l.jsx("span",{className:"text-xs font-medium text-cc-fg",children:u}),f&&l.jsx("span",{className:"text-xs text-cc-muted truncate flex-1 font-mono-code",children:f})]}),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(kC,{name:e,input:t})})})]})}function _C({input:e,toolUseId:t}){const n=Gl(),[r,a]=k.useState(!1),o=String(e.file_path||""),u=o?o.split("/").pop()||o:"",f=String(e.old_string||""),h=String(e.new_string||""),p=!!(f||h),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=(f+h).split(`
61
- `).length,N=j>15,S=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(Vl,{oldText:f,newText:h,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 O=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:O})]},`${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(Nf,{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:S})]}):l.jsxs("div",{"data-tool-use-id":t,children:[l.jsxs("div",{className:"flex items-center gap-1.5 py-0.5",children:[l.jsx("span",{className:"text-[11px] font-medium text-emerald-600/70 dark:text-emerald-400/70",children:"Edit"}),u&&l.jsx("span",{className:"text-[11px] font-mono-code text-cc-fg/70",children:u}),m&&l.jsx("span",{className:"text-[9px] uppercase tracking-wider font-semibold text-amber-600/70 dark:text-amber-400/70",children:"all"})]}),S]})}function wC({input:e,toolUseId:t}){const n=typeof e.command=="string"?e.command:"",r=typeof e.description=="string"?e.description:"",a=Gl(),[o,u]=k.useState(!1);if(a){const f=n.split(`
62
- `)[0]||"",h=r||f||"Command",p=n?n.split(`
63
- `).length-1:0;return l.jsxs("div",{"data-tool-use-id":t,children:[l.jsx(Nf,{open:o,onToggle:()=>u(!o),marker:"$",label:h,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 kC({name:e,input:t}){switch(e){case"Bash":return l.jsx(SC,{input:t});case"Edit":return l.jsx(jC,{input:t});case"Write":return l.jsx(NC,{input:t});case"Read":return l.jsx(CC,{input:t});case"Glob":return l.jsx(EC,{input:t});case"Grep":return l.jsx(TC,{input:t});case"WebSearch":case"web_search":return l.jsx(AC,{input:t});case"WebFetch":return l.jsx(MC,{input:t});case"Task":return l.jsx(RC,{input:t});case"TodoWrite":return l.jsx(LC,{input:t});case"NotebookEdit":return l.jsx(DC,{input:t});case"SendMessage":return l.jsx(zC,{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 SC({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 jC({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(Vl,{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,f)=>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}-${f}`))]}):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 NC({input:e}){const t=String(e.file_path||""),n=String(e.content||"");return l.jsx(Vl,{newText:n,fileName:t,mode:"compact"})}function CC({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 EC({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 TC({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 AC({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 MC({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 RC({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 LC({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 DC({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 zC({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 jc(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 Ol({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 OC=2e3,BC=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"]),Zr=new Map,Ki=new Map,Id=new Map,Ld=new Map,zs=new Map,mc=new Map,Nc=new Map,Vd=new Map;function I5(e){return!!e&&(e.readyState===WebSocket.OPEN||e.readyState===WebSocket.CONNECTING)}function V5(e){const t=Y.getState(),n=t.sdkSessions.find(r=>r.sessionId===e);return n?!n.archived:t.currentSessionId===e}function PC(){const e=Y.getState(),t=new Set;for(const n of e.sdkSessions)n.archived||t.add(n.sessionId);return e.currentSessionId&&t.add(e.currentSessionId),Array.from(t)}let Cc=typeof document<"u"?document.hidden:!1;typeof document<"u"&&document.addEventListener("visibilitychange",()=>{if(document.hidden){Cc=!0;for(const[e,t]of Ki)clearTimeout(t),Ki.delete(e)}else{Cc=!1;for(const e of PC()){if(!V5(e))continue;const t=Zr.get(e);if(!I5(t)){if(t){try{t.close()}catch{}Zr.delete(e)}Fc(e)}}}});function Dd(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 $C(e,t){return e.startsWith("/")||!t?Dd(e):Dd(`${t}/${e}`)}function FC(e,t){if(!t)return!0;const n=Dd(t);return e===n||e.startsWith(`${n}/`)}function UC(e){let t=Vd.get(e);return t||(t=new Set,Vd.set(e,t)),t}function Hp(e,t){const n=Y.getState(),r=UC(e);for(const a of t){if(a.type!=="tool_use")continue;const{name:o,input:u,id:f}=a;if(f){if(r.has(f))continue;r.add(f)}if(o==="TodoWrite"){const h=u.todos;if(Array.isArray(h)){const p=h.map((m,x)=>({id:String(x+1),subject:m.content||"Task",description:"",activeForm:m.activeForm,status:m.status||"pending"}));n.setTasks(e,p),Ld.set(e,p.length)}continue}if(o==="TaskCreate"){const h=(Ld.get(e)||0)+1;Ld.set(e,h);const p={id:String(h),subject:u.subject||"Task",description:u.description||"",activeForm:u.activeForm,status:"pending"};n.addTask(e,p);continue}if(o==="TaskUpdate"){const h=u.taskId;if(h){const p={};u.status&&(p.status=u.status),u.owner&&(p.owner=u.owner),u.activeForm!==void 0&&(p.activeForm=u.activeForm),u.addBlockedBy&&(p.blockedBy=u.addBlockedBy),n.updateTask(e,h,p)}}}}function Ip(e,t){var o,u;const n=Y.getState(),r=((o=n.sessions.get(e))==null?void 0:o.cwd)||((u=n.sdkSessions.find(f=>f.sessionId===e))==null?void 0:u.cwd);let a=!1;for(const f of t){if(f.type!=="tool_use")continue;const{name:h,input:p}=f;if((h==="Edit"||h==="Write")&&typeof p.file_path=="string"){const m=$C(p.file_path,r);FC(m,r)&&(a=!0)}}a&&n.bumpChangedFilesTick(e)}const oc=new Map,qC=/Command running in background with ID:\s*(\S+)\.\s*Output is being written to:\s*(\S+)/;function Vp(e,t){const n=Y.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=oc.get(e);o||(o=new Map,oc.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=oc.get(e),u=o==null?void 0:o.get(a);if(o&&u){const h=(typeof r.content=="string"?r.content:Array.isArray(r.content)?r.content.map(p=>"text"in p?p.text:"").join(""):"").match(qC);if(h){const p={taskId:h[1],toolUseId:a,command:u.command,description:u.description,outputFile:h[2],status:"running",startedAt:u.startedAt};n.addProcess(e,p)}o.delete(a),o.size===0&&oc.delete(e)}}}}const dd=new Map,Gd=new Map;function Gp(e,t){const n=Y.getState();let r=Gd.get(e);r||(r=new Set,Gd.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=dd.get(e);u||(u=new Map,dd.set(e,u));const f={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:f.name,description:f.description,agentType:f.agentType,startedAt:f.startedAt}),n.addBackgroundAgent(e,f)}}if(a.type==="tool_result"){const o=a.tool_use_id,u=dd.get(e),f=u==null?void 0:u.get(o);if(u&&f){const h=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:h.length>200?h.slice(0,200)+"...":h}),u.delete(o),u.size===0&&dd.delete(e)}}}}function Gb(e,t,n){typeof Notification>"u"||Notification.permission==="granted"&&new Notification(e,{body:t,tag:n})}function Yb(e){if(e.subtype==="compact_boundary")return`Context compacted (${e.compact_metadata.trigger}, pre-tokens: ${e.compact_metadata.pre_tokens}).`;if(e.subtype==="task_notification"){const t=e.summary?` ${e.summary}`:"";return`Task ${e.status}: ${e.task_id}.${t}`}if(e.subtype==="files_persisted"){const t=e.files.length,n=e.failed.length;return n>0?`Persisted ${t} file(s), ${n} failed.`:`Persisted ${t} file(s).`}if(e.subtype==="hook_started")return`Hook started: ${e.hook_name} (${e.hook_event}).`;if(e.subtype==="hook_response"){const t=typeof e.exit_code=="number"?` (exit ${e.exit_code})`:"";return`Hook ${e.outcome}: ${e.hook_name} (${e.hook_event})${t}.`}return null}let HC=0,IC=0;function hi(){return`msg-${Date.now()}-${++HC}`}function Wb(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 tC(e)?`${ZN}
64
-
65
- Details: ${t}`:`Error: ${t}`}function VC(e,t){const n=Nc.get(e)||[];n.push(t),Nc.set(e,n)}function GC(e,t){const n=Nc.get(e);if(!(!(n!=null&&n.length)||t.readyState!==WebSocket.OPEN)){Nc.delete(e);for(const r of n)t.send(JSON.stringify(r))}}const qi=new Map;function Qb(e,t,n){const r=Y.getState(),a=r.messages.get(e)||[],o=mc.get(e);let u=a.filter(h=>!h.isStreaming||h.id===o),f=-1;if(o&&(f=u.findIndex(h=>h.id===o),f===-1&&mc.delete(e)),f===-1){const h=`stream-${e}-${hi()}`;mc.set(e,h),u=[...u,{id:h,role:"assistant",content:t,timestamp:Date.now(),isStreaming:!0,streamingPhase:n}]}else{u=[...u];const h=u[f];u[f]={...h,role:"assistant",content:t,isStreaming:!0,streamingPhase:n}}r.setMessages(e,u)}function Ms(e){mc.delete(e);const t=Y.getState(),n=t.messages.get(e)||[],r=n.filter(a=>!a.isStreaming);return r.length!==n.length?(t.setMessages(e,r),!0):!1}const Xb=new Map,YC=8e3;function yl(e,t,n={}){if(console.warn(`[companion:session-event] ${t}`,{sessionId:e,...n.detail??{}}),!n.userText)return;const r=Date.now(),a=Xb.get(e);a&&a.code===t&&r-a.at<YC||(Xb.set(e,{code:t,at:r}),Y.getState().appendMessage(e,{id:`companion-notice-${t}-${r}`,role:"system",content:n.userText,timestamp:r,meta:!0,metaCode:t}))}function G5(){return`cmsg-${Date.now()}-${++IC}`}function eg(){return G5()}const WC=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 QC(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 Y5(e){return`companion:last-seq:${e}`}function tg(e){const t=Id.get(e);if(typeof t=="number")return t;try{const n=localStorage.getItem(Y5(e)),r=n?Number(n):0,a=Number.isFinite(r)?Math.max(0,Math.floor(r)):0;return Id.set(e,a),a}catch{return 0}}function Kb(e,t){const n=Math.max(0,Math.floor(t));Id.set(e,n);try{localStorage.setItem(Y5(e),String(n))}catch{}}function Zb(e,t){Rn(e,{type:"session_ack",last_seq:t})}function zd(e){return e.map(t=>t.type==="text"?t.text:t.type==="thinking"?t.thinking:"").filter(Boolean).join(`
66
- `)}function Yp(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 XC(e,t){const n=e||[],r=t||[];if(n.length===0&&r.length===0)return;const a=new Map;for(const f of r)a.set(Yp(f),f);const o=[],u=new Set;for(const f of n){const h=Yp(f);u.has(h)||(u.add(h),o.push(a.get(h)||f))}for(const f of r){const h=Yp(f);u.has(h)||(u.add(h),o.push(f))}return o}function Jb(e,t,n,r,a){return{toolUseId:e,toolName:t,preview:jc(t,n),startedAt:r,elapsedSeconds:0,isError:!1,parentToolUseId:a||void 0}}function ng(e,t){const n=XC(e.contentBlocks,t.contentBlocks),r=n&&n.length>0?zd(n):t.content||e.content;return{...e,...t,content:r,contentBlocks:n,timestamp:e.timestamp??t.timestamp,isStreaming:t.isStreaming}}function KC(e,t){const n=Y.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]=ng(o[a],t),n.setMessages(e,o)}function ZC(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=Y.getState();r.connectionStatus.get(e)==="connecting"&&r.setConnectionStatus(e,"connected"),W5(e,n)}function W5(e,t,n={}){var u,f,h,p,m,x;const{processSeq:r=!0,ackSeqMessage:a=!0}=n,o=Y.getState();if(r&&typeof t.seq=="number"){const b=tg(e);if(t.seq<=b)return;Kb(e,t.seq),a&&Zb(e,t.seq)}switch(BC.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()),_=P5(y);o.setSessionName(e,_)}break}case"session_update":{o.updateSession(e,t.session);break}case"assistant":{const b=t.message;if(b.model==="<synthetic>"){Ms(e),o.setStreaming(e,null),yl(e,"synthetic_noop",{detail:{stopReason:b.stop_reason,text:zd(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=zd(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(Ms(e),KC(e,_),o.setStreaming(e,null),zs.delete(e),qi.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()}),(f=b.content)!=null&&f.length)for(const j of b.content){if(j.type==="tool_use"){const N=j.input||{};o.addToolActivity(e,Jb(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})}(h=b.content)!=null&&h.length&&(Hp(e,b.content),Ip(e,b.content),Vp(e,b.content),Gp(e,b.content));break}case"stream_event":{const b=t.event;if(b&&typeof b=="object"){if(b.type==="message_start"&&(zs.delete(e),qi.delete(e),Ms(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 _=qi.get(e)||{thinking:"",text:""};zs.get(e)==="thinking"&&(_.thinking=""),_.text+=y.text,qi.set(e,_),zs.set(e,"text"),o.setStreaming(e,_.text),Qb(e,_.text,"text")}if((y==null?void 0:y.type)==="thinking_delta"&&typeof y.thinking=="string"){const _=qi.get(e)||{thinking:"",text:""};_.thinking+=y.thinking,qi.set(e,_),zs.set(e,"thinking"),o.setStreaming(e,_.thinking),Qb(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":{Vd.delete(e),Gd.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),Ms(e),o.setStreaming(e,null),zs.delete(e),qi.delete(e),o.setStreamingStats(e,null),o.clearToolProgress(e),o.setSessionStatus(e,"idle"),!document.hasFocus()&&o.notificationSound&&rC(),!document.hasFocus()&&o.notificationDesktop&&Gb("Session completed","Claude finished the task",e),b.is_error&&o.appendMessage(e,{id:hi(),role:"system",content:Wb(b),timestamp:Date.now()});break}case"permission_request":{if(o.addPermission(e,t.request),!document.hasFocus()&&o.notificationDesktop){const y=t.request;Gb("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}];Hp(e,y),Ip(e,y),Vp(e,y),Gp(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:hi(),role:"system",content:t.summary,timestamp:Date.now()});break}case"user_message":{o.appendMessage(e,{id:t.id||hi(),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=Yb(t.event);if(!b)break;o.appendMessage(e,{id:hi(),role:"system",content:b,timestamp:t.timestamp||Date.now()});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:hi(),role:"system",content:`Auth error: ${t.error}`,timestamp:Date.now()});break}case"error":{o.appendMessage(e,{id:hi(),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),Ms(e)?yl(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."}):yl(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),Ms(e)&&yl(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),Ms(e)?yl(e,"interrupted_mid_stream",{detail:{trigger:"cli_disconnected"},userText:"Response interrupted — the backend disconnected before finishing. Trying to reconnect…"}):yl(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||hi(),role:"user",content:N.content,timestamp:N.timestamp});else if(N.type==="assistant"){const S=N.message,E=zd(S.content),C={id:S.id,role:"assistant",content:E,contentBlocks:S.content,timestamp:N.timestamp||Date.now(),parentToolUseId:N.parent_tool_use_id,model:S.model,stopReason:S.stop_reason},O=b.findIndex(D=>D.role==="assistant"&&D.id===C.id);if(O===-1?b.push(C):b[O]=ng(b[O],C),(x=S.content)!=null&&x.length){Hp(e,S.content),Ip(e,S.content),Vp(e,S.content),Gp(e,S.content);const D=N.timestamp||Date.now();for(const L of S.content){if(L.type==="tool_use"){const I=L.input||{},F=y.get(L.id);y.set(L.id,F??Jb(L.id,L.name,I,D,N.parent_tool_use_id))}if(L.type==="tool_result"){const I=y.get(L.tool_use_id);I&&y.set(L.tool_use_id,{...I,completedAt:D,isError:I.isError||!!L.is_error,elapsedSeconds:Math.max(I.elapsedSeconds,I.completedAt?I.elapsedSeconds:Math.max(0,(D-I.startedAt)/1e3))})}}}}else if(N.type==="result"){const S=N.data;S.is_error&&b.push({id:`hist-error-${j}`,role:"system",content:Wb(S),timestamp:Date.now()});const E={total_cost_usd:S.total_cost_usd,num_turns:S.num_turns};if(typeof S.total_lines_added=="number"&&(E.total_lines_added=S.total_lines_added),typeof S.total_lines_removed=="number"&&(E.total_lines_removed=S.total_lines_removed),S.modelUsage){for(const C of Object.values(S.modelUsage))if(C.contextWindow>0){const O=C,D=Math.round((O.inputTokens+O.outputTokens)/O.contextWindow*100);E.context_used_percent=Math.max(0,Math.min(D,100))}}o.updateSession(e,E)}else if(N.type==="system_event"){const S=Yb(N.event);if(!S)continue;b.push({id:`hist-system-event-${j}`,role:"system",content:S,timestamp:N.timestamp||Date.now()})}}if(b.length>0){const j=o.messages.get(e)||[];if(j.length===0)o.setMessages(e,b);else{const N=[...j];for(const S of b){const E=N.findIndex(O=>O.id===S.id);if(E===-1){N.push(S);continue}const C=N[E];C.role==="assistant"&&S.role==="assistant"?N[E]=ng(C,S):N[E]=S}N.sort((S,E)=>(S.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"&&(Ms(e),o.setStreaming(e,null),zs.delete(e),qi.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 _=tg(e);y.seq<=_||(Kb(e,y.seq),b=y.seq,W5(e,y.message,{processSeq:!1,ackSeqMessage:!1}))}typeof b=="number"&&Zb(e,b);break}case"prompt_suggestion":{const b=t.suggestions;o.setPromptSuggestions(e,b);break}case"streamlined_text":{o.appendMessage(e,{id:hi(),role:"assistant",content:t.text,timestamp:Date.now()});break}case"streamlined_tool_use_summary":{o.appendMessage(e,{id:hi(),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 Fc(e){const t=Zr.get(e);if(I5(t))return;if(t){try{t.close()}catch{}Zr.delete(e)}Y.getState().setConnectionStatus(e,"connecting");const r=new WebSocket(QC(e));Zr.set(e,r),r.onopen=()=>{const a=tg(e);r.send(JSON.stringify({type:"session_subscribe",last_seq:a})),GC(e,r);const o=Ki.get(e);o&&(clearTimeout(o),Ki.delete(e))},r.onmessage=a=>ZC(e,a),r.onclose=()=>{Zr.get(e)===r&&(Zr.delete(e),Y.getState().setConnectionStatus(e,"disconnected"),JC(e))},r.onerror=()=>{r.close()}}function JC(e){if(Ki.has(e)||Cc)return;const t=setTimeout(()=>{Ki.delete(e),!Cc&&V5(e)&&Fc(e)},OC);Ki.set(e,t)}function rg(e){const t=Ki.get(e);t&&(clearTimeout(t),Ki.delete(e));const n=Zr.get(e);n&&(n.close(),Zr.delete(e)),Y.getState().setConnectionStatus(e,"disconnected"),Vd.delete(e),Gd.delete(e),oc.delete(e),Ld.delete(e),zs.delete(e),mc.delete(e),qi.delete(e),Id.delete(e),Nc.delete(e)}function e3(e){if(!Cc)for(const t of e)t.archived||Fc(t.sessionId)}function t3(e){return new Promise((t,n)=>{const r=setInterval(()=>{const o=Zr.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 Rn(e,t){const n=Zr.get(e);let r=t;const a=WC.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:G5()});break}if((n==null?void 0:n.readyState)===WebSocket.OPEN){n.send(JSON.stringify(r));return}a&&VC(e,r)}function ey(e){Rn(e,{type:"mcp_get_status"})}function n3(e,t,n){Rn(e,{type:"mcp_toggle",serverName:t,enabled:n})}function r3(e,t){Rn(e,{type:"mcp_reconnect",serverName:t})}function i3(e,t){Rn(e,{type:"mcp_set_servers",servers:t})}function ty(e,t){Rn(e,{type:"set_magic_ui",magicUiActive:t})}function yz(e){Rn(e,{type:"magic_ui_sync"})}function s3(e,t){Rn(e,{type:"set_ai_validation",...t})}var re=typeof window<"u"?window:void 0,Bn=typeof globalThis<"u"?globalThis:re,Qn=Bn==null?void 0:Bn.navigator,Se=Bn==null?void 0:Bn.document,Qt=Bn==null?void 0:Bn.location,nx=Bn==null?void 0:Bn.fetch,ig=Bn!=null&&Bn.XMLHttpRequest&&"withCredentials"in new Bn.XMLHttpRequest?Bn.XMLHttpRequest:void 0,ny=Bn==null?void 0:Bn.AbortController,a3=Bn==null?void 0:Bn.CompressionStream,ar=Qn==null?void 0:Qn.userAgent;function Q5(){return!(!re||re.navigator.onLine===!1)}var Wo=typeof globalThis<"u"?globalThis:re;Wo&&typeof self>"u"&&(Wo.self=Wo),Wo&&typeof File>"u"&&(Wo.File=function(){});var Oe=re??{},Bt={DEBUG:!1,LIB_VERSION:"0.5.0",LIB_NAME:"browser-common"};function ry(e,t,n,r,a,o,u){try{var f=e[o](u),h=f.value}catch(p){return void n(p)}f.done?t(h):Promise.resolve(h).then(r,a)}function Pt(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function u(h){ry(o,r,a,u,f,"next",h)}function f(h){ry(o,r,a,u,f,"throw",h)}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 X5(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 iy=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}};function sy(e){return typeof e=="string"||e}function ay(e){return typeof e=="string"?e:void 0}var Qo,l3=["$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"],Ii=(function(e){return e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.EnablePersonProcessing="enable_person_processing",e.PersonMode="person_mode",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.AiQueue="ai_queue",e.AiCaptureQueue="ai_capture_queue",e.LogsQueue="logs_queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.PushRegistered="push_registered",e.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e.DeviceId="device_id",e})({}),ly=(function(e){return e.GZipJS="gzip-js",e.Base64="base64",e})({}),o3=["$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"],c3=["token"],K5="NativeGzipValidationError",sg=e=>e.length>=2&&e[0]===31&&e[1]===139,oy=(e,t)=>e===ly.GZipJS||t===ly.GZipJS||t==="gzip",cy=e=>!(!e||typeof e!="object")&&("name"in e?String(e.name):"")==="NotReadableError",fd=e=>{var t=new Error("Native gzip produced invalid output: "+e);throw t.name=K5,t},u3=(function(){var e=Pt((function*(t,n){18>t.size&&fd("too-short");var r=new Uint8Array(yield t.slice(0,10).arrayBuffer());sg(r)&&r[2]===8||fd("invalid-header");var a=new DataView(yield t.slice(t.size-8).arrayBuffer());a.getUint32(0,!0)!==(u=>{for(var f=(()=>{if(Qo)return Qo;Qo=[];for(var m=0;256>m;m++){for(var x=m,b=0;8>b;b++)x=1&x?3988292384^x>>>1:x>>>1;Qo[m]=x>>>0}return Qo})(),h=4294967295,p=0;u.length>p;p++)h=f[255&(h^u[p])]^h>>>8;return(4294967295^h)>>>0})(n)&&fd("invalid-crc");var o=n.length>>>0;a.getUint32(4,!0)!==o&&fd("invalid-size")}));return function(t,n){return e.apply(this,arguments)}})();function ag(){return ag=Pt((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=Pt((function*(m){try{yield o.abort(m)}catch{}throw m}));return function(m){return p.apply(this,arguments)}})()),f=new Response(a.readable).blob(),h=(yield Promise.all([f,u]))[0];return yield u3(h,r),h}catch(p){if(n!=null&&n.rethrow)throw p;return t&&console.error("Failed to gzip compress data",p),null}})),ag.apply(this,arguments)}var d3=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],uy=function(e,t){if(t===void 0&&(t=[]),!e)return!1;var n=e.toLowerCase();return d3.concat(t).some((r=>{var a=r.toLowerCase();return n.indexOf(a)!==-1}))};function Ve(e,t){return e.indexOf(t)!==-1}var Cf=function(e){return e.trim()},lg=function(e){return e.replace(/^\$/,"")};function Z5(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 J5=Object.prototype,ew=J5.hasOwnProperty,Ef=J5.toString,Ie=Array.isArray||function(e){return Ef.call(e)==="[object Array]"},Gn=e=>typeof e=="function",Ut=e=>e===Object(e)&&!Ie(e),Jr=e=>{if(Ut(e)){for(var t in e)if(ew.call(e,t))return!1;return!0}return!1},ge=e=>e===void 0,gt=e=>Ef.call(e)=="[object String]",Yd=e=>gt(e)&&e.trim().length===0,jn=e=>e===null,Ge=e=>ge(e)||jn(e),ln=e=>Ef.call(e)=="[object Number]"&&e==e,Hi=e=>ln(e)&&e>0,yr=e=>Ef.call(e)==="[object Boolean]",f3=e=>e instanceof FormData,h3=e=>Ve(o3,e),p3=e=>Ve(c3,e);function tw(e){return e===null||typeof e!="object"}function Wd(e,t){return{}.toString.call(e)==="[object "+t+"]"}function nw(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 rx(e){return typeof Event<"u"&&rw(e,Event)}function rw(e,t){try{return e instanceof t}catch{return!1}}var m3=[!0,"true",1,"1","yes"],Wp=e=>Ve(m3,e),g3=[!1,"false",0,"0","no"];function vi(e,t,n,r,a){return t>n&&(r.warn("min cannot be greater than max."),t=n),ln(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),vi(a||n,t,n,r))}class x3{constructor(t){this.it={},this.rt=t.rt,this.nt=vi(t.bucketSize,0,100,t.st),this.ot=vi(t.refillRate,0,this.nt,t.st),this.ut=vi(t.refillInterval,0,864e5,t.st)}ht(t,n){var r=Math.floor((n-t.lastAccess)/this.ut);r>0&&(t.tokens=Math.min(t.tokens+r*this.ot,this.nt),t.lastAccess=t.lastAccess+r*this.ut)}consumeRateLimit(t){var n,r=Date.now(),a=String(t),o=this.it[a];return o?this.ht(o,r):this.it[a]=o={tokens:this.nt,lastAccess:r},o.tokens===0||(o.tokens--,o.tokens===0&&((n=this.rt)==null||n.call(this,t)),o.tokens===0)}stop(){this.it={}}}var wr="Mobile",Qd="iOS",Xi="Android",Bl="Tablet",iw=Xi+" "+Bl,sw="iPad",aw="Apple",lw=aw+" Watch",gc="Safari",Pl="BlackBerry",ow="Samsung",cw=ow+"Browser",uw=ow+" Internet",Ca="Chrome",v3=Ca+" OS",dw=Ca+" "+Qd,ix="Internet Explorer",fw=ix+" "+wr,sx="Opera",b3=sx+" Mini",ax="Edge",hw="Microsoft "+ax,Rl="Firefox",pw=Rl+" "+Qd,Ec="Nintendo",Tc="PlayStation",Ll="Xbox",mw=Xi+" "+wr,gw=wr+" "+gc,cc="Windows",og=cc+" Phone",dy="Nokia",cg="Ouya",xw="Generic",y3=xw+" "+wr.toLowerCase(),vw=xw+" "+Bl.toLowerCase(),ug="Konqueror",bw="Oculus Browser",Xd="Vivaldi",yw="Yandex",Kd="Whale",dg="DuckDuckGo",_w="Pale Moon",Zd="Waterfox",xc="Brave",ww="Google Search App",en="(\\d+(\\.\\d+)?)",Qp=new RegExp("Version/"+en),_3=new RegExp(Ll,"i"),w3=new RegExp(Tc+" \\w+","i"),k3=new RegExp(Ec+" \\w+","i"),lx=new RegExp(Pl+"|PlayBook|BB10","i"),S3={"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"},kw=function(e,t,n,r){t=t||"";var a=(function(o){return o!=null&&o.brave?xc:null})(n);return a||(r!=null&&r.detectGoogleSearchApp&&Ve(e,"GSA/")?ww:Ve(e," OPR/")&&Ve(e,"Mini")?b3:Ve(e," OPR/")?sx:lx.test(e)?Pl:Ve(e,"IE"+wr)||Ve(e,"WPDesktop")?fw:Ve(e,"OculusBrowser")?bw:Ve(e,cw)?uw:Ve(e,ax)||Ve(e,"Edg/")?hw:Ve(e,Xd+"/")?Xd:Ve(e,"YaBrowser/")?yw:Ve(e,Kd+"/")?Kd:Ve(e,dg+"/")||Ve(e,"Ddg/")?dg:Ve(e,"FBIOS")?"Facebook "+wr:Ve(e,"UCWEB")||Ve(e,"UCBrowser")?"UC Browser":Ve(e,"CriOS")?dw:Ve(e,"CrMo")||Ve(e,Ca)?Ca:Ve(e,Xi)&&Ve(e,gc)?mw:Ve(e,"FxiOS")?pw:Ve(e.toLowerCase(),ug.toLowerCase())?ug:Ve(e,xc+"/")?xc:((o,u)=>u&&Ve(u,aw)||(function(f){return Ve(f,gc)&&!Ve(f,Ca)&&!Ve(f,Xi)})(o))(e,t)?Ve(e,wr)?gw:gc:Ve(e,"PaleMoon/")?_w:Ve(e,Zd+"/")?Zd:Ve(e,Rl)?Rl:Ve(e,"MSIE")||Ve(e,"Trident/")?ix:Ve(e,"Gecko")?Rl:"")},j3={[fw]:[new RegExp("rv:"+en)],[hw]:[new RegExp(ax+"?\\/"+en)],[Ca]:[new RegExp("("+Ca+"|CrMo)\\/"+en)],[dw]:[new RegExp("CriOS\\/"+en)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+en)],[gc]:[Qp],[gw]:[Qp],[sx]:[new RegExp("(Opera|OPR)\\/"+en)],[Rl]:[new RegExp(Rl+"\\/"+en)],[pw]:[new RegExp("FxiOS\\/"+en)],[ug]:[new RegExp("Konqueror[:/]?"+en,"i")],[Pl]:[new RegExp(Pl+" "+en),Qp],[mw]:[new RegExp("android\\s"+en,"i")],[uw]:[new RegExp(cw+"\\/"+en)],[bw]:[new RegExp("OculusBrowser\\/"+en)],[Xd]:[new RegExp(Xd+"\\/"+en)],[yw]:[new RegExp("YaBrowser\\/"+en)],[Kd]:[new RegExp(Kd+"\\/"+en)],[xc]:[new RegExp(xc+"\\/"+en)],[dg]:[new RegExp("(DuckDuckGo|Ddg)\\/"+en)],[_w]:[new RegExp("PaleMoon\\/"+en)],[Zd]:[new RegExp(Zd+"\\/"+en)],[ww]:[new RegExp("GSA\\/"+en)],[ix]:[new RegExp("(rv:|MSIE )"+en)],Mozilla:[new RegExp("rv:"+en)]},N3=function(e,t,n,r){var a=kw(e,t,n,r),o=j3[a];if(ge(o))return null;for(var u=0;o.length>u;u++){var f=e.match(o[u]);if(f)return parseFloat(f[f.length-2])}return null},fy=[[new RegExp(Ll+"; "+Ll+" (.*?)[);]","i"),e=>[Ll,e&&e[1]||""]],[new RegExp(Ec,"i"),[Ec,""]],[new RegExp(Tc,"i"),[Tc,""]],[lx,[Pl,""]],[new RegExp(cc,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[og,""];if(new RegExp(wr).test(t)&&!/IEMobile\b/.test(t))return[cc+" "+wr,""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var r=S3[n[1]]||"";return/arm/i.test(t)&&(r="RT"),[cc,r]}return[cc,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[Qd,[e[3],e[4],e[5]||"0"].join(".")]:[Qd,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=ge(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+Xi+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Xi+")","i"),e=>e&&e[2]?[Xi,[e[2],e[3],e[4]||"0"].join(".")]:[Xi,""]],[/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/,[v3,""]],[/Linux|debian/i,["Linux",""]]],hy=function(e){return k3.test(e)?Ec:w3.test(e)?Tc:_3.test(e)?Ll:new RegExp(cg,"i").test(e)?cg:new RegExp("("+og+"|WPDesktop)","i").test(e)?og:/iPad/.test(e)?sw:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?lw:lx.test(e)?Pl:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(dy,"i").test(e)?dy:/(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(wr).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)?Xi:iw:new RegExp("(pda|"+wr+")","i").test(e)?y3:new RegExp(Bl,"i").test(e)&&!new RegExp(Bl+" pc","i").test(e)?vw:""},C3=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function py(e,t){return typeof(n=e)=="string"&&C3.test(n)?e:t();var n}function Ps(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 my(e,t,n){return Sw.apply(this,arguments)}function Sw(){return(Sw=Pt((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)}var jw={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}},E3=jw.info;function Nw(e){if(yr(e))return{boolValue:e};if(typeof e=="number")return Number.isFinite(e)?Number.isInteger(e)?{intValue:e}:{doubleValue:e}:{stringValue:String(e)};if(typeof e=="string")return{stringValue:e};if(Ie(e))return{arrayValue:{values:e.map((t=>Nw(t)))}};try{return{stringValue:JSON.stringify(e)}}catch{return{stringValue:String(e)}}}function Jd(e){var t=[];for(var n in e){var r=e[n];jn(r)||ge(r)||t.push({key:n,value:Nw(r)})}return t}function T3(e,t){var n=jw[e.level||"info"]||E3,r=n.text,a=n.number,o=String(Date.now())+"000000",u={};t.distinctId&&(u.posthogDistinctId=t.distinctId),t.sessionId&&(u.sessionId=t.sessionId),t.windowId&&(u["window.id"]=t.windowId),Ge(t.sessionStartTimestamp)||(u.sessionStartTimestamp=String(t.sessionStartTimestamp)),Ge(t.lastActivityTimestamp)||(u.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(u["url.full"]=t.currentUrl),t.screenName&&(u["screen.name"]=t.screenName),t.appState&&(u["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(u.feature_flags=t.activeFeatureFlags);var f=de({},u,e.attributes||{}),h={timeUnixNano:o,observedTimeUnixNano:o,severityNumber:a,severityText:r,body:{stringValue:e.body},attributes:Jd(f)};return e.trace_id&&(h.traceId=e.trace_id),e.span_id&&(h.spanId=e.span_id),ge(e.trace_flags)||(h.flags=e.trace_flags),h}function Cw(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})}function Ew(e,t,n,r){return{resourceLogs:[{resource:{attributes:Jd(t)},scopeLogs:[{scope:{name:n,version:r},logRecords:e}]}]}}let A3=class{constructor(e,t,n,r,a,o,u){var f;o===void 0&&(o=()=>Promise.resolve()),this._instance=e,this.qe=t,this.st=n,this.dt=r,this.vt=a,this.ct=o,this.ft=u,this.yt=null,this.bt=0,this._t=0,this.wt=0,this.kt=0,this.xt=!1,this.St=t.maxBufferSize,this.Ct=Math.max((f=t.maxQueueSize)!==null&&f!==void 0?f:t.maxBufferSize,t.maxBufferSize),this.Mt=t.flushIntervalMs,this.Tt=t.maxBatchRecordsPerPost,this.Et=t.rateCapWindowMs,this.It=t.maxLogsPerInterval}reset(){this.Pt(),this.yt=null,this.wt=0,this.kt=0,this.xt=!1,this.bt=0,this._t=0,this.Tt=this.qe.maxBatchRecordsPerPost}onReconnect(){this._t=0,this.Rt()}captureLog(e){if(!this._instance.isDisabled&&!this._instance.optedOut&&e!=null&&e.body){var t=this.At(e);if(t!==null)if(t.body){if(this.Ft()){var n={record:T3(t,this.dt())};this.vt((()=>this.Ot(n)))}}else this.st.info("Log was rejected in beforeSend function")}}At(e){var t=this.qe.beforeSend;if(!t)return e;var n=Ie(t)?t:[t],r=e;for(var a of n)try{var o=a(r);if(!o)return this.st.info("Log was rejected in beforeSend function"),null;r=o}catch(u){return this.st.error("Error in beforeSend function for log:",u),null}return r}Ft(){if(this.It===void 0)return!0;var e=Date.now(),t=e-this.wt;return this.Et>t&&t>=0||(this.wt=e,this.kt=0,this.xt=!1),this.It>this.kt?(this.kt++,!0):(this.xt||(this.st.warn("captureLog dropping logs: exceeded "+this.It+" logs per "+this.Et+"ms"),this.xt=!0),!1)}flush(){var e=this;return Pt((function*(){if(!e._instance.isDisabled)return e.yt||(e.yt=e.Lt().finally((()=>{e.yt=null}))),e.yt}))()}Lt(){var e=this;return Pt((function*(){var t;e.Pt();var n=(t=e._instance.getPersistedProperty(Ii.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;e.bt=0;var f=Math.min(n.length,e.Tt),h=n.slice(0,f),p=Ew(h.map((x=>x.record)),e.Dt(),(o=e.ft)!==null&&o!==void 0?o:e._instance.getLibraryId(),e._instance.getLibraryVersion()),m=yield e._instance.$t(p);if(m.kind==="too-large"&&h.length>1)e.Tt=Math.max(1,Math.floor(h.length/2)),e.st.warn("Received 413 when sending logs batch of size "+h.length+", reducing batch size to "+e.Tt);else if(m.kind==="retry-later"||(m.kind==="too-large"?e.st.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."):m.kind==="ok"&&e.qe.maxBatchRecordsPerPost>e.Tt&&(e.Tt=Math.min(e.qe.maxBatchRecordsPerPost,e.Tt+1)),yield e.Nt(h.length),n=(u=e._instance.getPersistedProperty(Ii.LogsQueue))!==null&&u!==void 0?u:[],a+=h.length,m.kind==="fatal"))throw m.error}}))()}Nt(e){var t=this;return Pt((function*(){var n,r=Math.max(0,e-t.bt),a=(n=t._instance.getPersistedProperty(Ii.LogsQueue))!==null&&n!==void 0?n:[];t._instance.setPersistedProperty(Ii.LogsQueue,a.slice(r)),yield t.ct()}))()}Dt(){return Cw(this.qe,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ot(e){var t;if(!this._instance.optedOut){var n=(t=this._instance.getPersistedProperty(Ii.LogsQueue))!==null&&t!==void 0?t:[];this.Ct>n.length||(n.shift(),this.bt++,this.st.info("Logs queue is full, dropping oldest record.")),n.push(e),this._instance.setPersistedProperty(Ii.LogsQueue,n),this.St>n.length?this.qt():this.Rt()}}qt(e){e===void 0&&(e=this.Mt),this.jt||(this.jt=ox((()=>{this.jt=void 0,this.Rt()}),e))}Bt(){var e=Math.min(Math.max(0,this._t-1),6);return this.Mt*Math.pow(2,e)}Ht(){var e=this._instance.getPersistedProperty(Ii.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return Pt((function*(){t.Pt();var n=t.flush().catch((()=>{}));e!==void 0?yield my(n,e):yield n}))()}flushWithTimeout(e){var t=this;return Pt((function*(){var n=t.flush();yield my(n,e,(()=>{n.catch((()=>{}))}))}))()}Rt(){this.flush().then((()=>{this._t=0}),(e=>{this._t++,this.st.error("PostHog logs flush failed:",e)})).finally((()=>{!this._instance.isDisabled&&this.Ht()&&this.qt(this.Bt())}))}Pt(){this.jt&&(clearTimeout(this.jt),this.jt=void 0)}};var Xp=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function gy(e){return String(e)+"000000"}function xy(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 M3=class{constructor(e,t,n){this._instance=e,this.qe=t,this.st=n,this.Ut=new Map,this.yt=null,this.zt=!1,this.Wt=new Map,this.Vt=new Set,this.Zt=0}count(e,t,n){t===void 0&&(t=1),this.Gt({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.Gt({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.Gt({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.yt,n=(function(){var a=Pt((function*(){t&&(yield t.catch((()=>{}))),yield e.Qt()}));return function(){return a.apply(this,arguments)}})(),r=n().finally((()=>{this.yt===r&&(this.yt=null)}));return this.yt=r,r}drainWindow(){if(this.Ut.size===0)return null;var e=this.Ut;return this.Ut=new Map,this.zt=!1,this.Wt=new Map,this.Vt=new Set,this.Jt(e)}reset(){this.Zt++,this.Pt(),this.Ut=new Map,this.yt=null,this.zt=!1,this.Wt=new Map,this.Vt=new Set}Gt(e){if(!this._instance.isDisabled&&!this._instance.optedOut){var t=this.At(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.st.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=xy(t.type,t.name,t.unit,n)}catch(u){return void this.st.warn("Dropping metric '"+t.name+"': attributes could not be serialized",u)}var a=this.Ut.get(r);if(!a){if(!this.Kt())return;a={name:t.name,type:t.type,unit:t.unit,attributes:n,windowStartMs:Date.now()},this.Ut.set(r,a)}var o=this.Wt.get(t.name);o===void 0?this.Wt.set(t.name,t.type):o===t.type||this.Vt.has(t.name)||(this.Vt.add(t.name),this.st.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.Yt(a,t.value),this.qt()}else this.st.warn("Dropping metric '"+t.name+"': value must be a finite number");else this.st.warn("Dropping metric with empty name")}}Kt(){return this.qe.maxSeriesPerFlush>this.Ut.size||(this.zt||(this.zt=!0,this.st.warn("Metric series cap reached ("+this.qe.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}Yt(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(Xp.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,Xp)]+=1}}At(e){var t=this.qe.beforeSend;if(!t)return e;var n=Ie(t)?t:[t],r=e;for(var a of n)try{var o=a(r);if(!o)return this.st.info("Metric was rejected in beforeSend function"),null;r=o}catch(u){return this.st.error("Error in beforeSend function for metric:",u),null}return r}qt(){this.jt||(this.jt=ox((()=>{this.jt=void 0,this.flush().catch((e=>{this.st.error("Metrics flush failed:",e)}))}),this.qe.flushIntervalMs))}Pt(){this.jt&&(clearTimeout(this.jt),this.jt=void 0)}Qt(){var e=this;return Pt((function*(){if(e.Ut.size!==0){var t=e.Ut;e.Ut=new Map,e.zt=!1,e.Wt=new Map,e.Vt=new Set;var n=e.Zt,r=yield e._instance.Xt(e.Jt(t));if(n===e.Zt)switch(r.kind){case"ok":return;case"retry-later":return e.ti(t),void e.qt();case"too-large":return void e.st.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e.st.error("Failed to send metrics batch:",r.error)}}}))()}Jt(e){return t=this.ei(e),n=(function(o,u,f){return de({},o.resourceAttributes,{"service.name":o.serviceName||"unknown_service"},o.environment&&{"deployment.environment":o.environment},o.serviceVersion&&{"service.version":o.serviceVersion},{"telemetry.sdk.name":u,"telemetry.sdk.version":f})})(this.qe,this._instance.getLibraryId(),this._instance.getLibraryVersion()),r=this._instance.getLibraryId(),a=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:Jd(n)},scopeMetrics:[{scope:{name:r,version:a},metrics:t}]}]};var t,n,r,a}ei(e){var t=gy(Date.now()),n=new Map;for(var r of e.values()){var a,o=xy(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 f=Jd((a=r.attributes)!==null&&a!==void 0?a:{}),h=gy(r.windowStartMs);if(r.type==="count"){var p,m={attributes:f,startTimeUnixNano:h,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:f,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:f,startTimeUnixNano:h,timeUnixNano:t,count:r.hist.count,sum:r.hist.sum,min:r.hist.min,max:r.hist.max,bucketCounts:r.hist.bucketCounts,explicitBounds:Xp})}return Array.from(n.values())}ti(e){var t,n;for(var r of e){var a=r[0],o=r[1],u=this.Ut.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 f=0;u.hist.bucketCounts.length>f;f++)u.hist.bucketCounts[f]+=o.hist.bucketCounts[f]}else u.hist=o.hist}else this.Kt()&&this.Ut.set(a,o)}}};var hd,vy,Kp;function R3(e){var t=globalThis._posthogChunkIds;if(t){var n=Object.keys(t);return Kp&&n.length===vy||(vy=n.length,Kp=n.reduce(((r,a)=>{hd||(hd={});var o=hd[a];if(o)r[o[0]]=o[1];else for(var u=e(a),f=u.length-1;f>=0;f--){var h=u[f],p=h==null?void 0:h.filename,m=t[a];if(p&&m){r[p]=m,hd[a]=[p,m];break}}return r}),{})),Kp}}class L3{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 Pt((function*(){for(var r of t)r.stacktrace&&r.stacktrace.frames&&Ie(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 Pt((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 f=[u];return t.cause!=null&&f.push(...this.convertToExceptionList(t.cause,de({},n,{handled:!0}))),f}buildParsingContext(t){var n;return{chunkIdMap:R3(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 f=this.buildCoercingContext(t,n,u);return this.applyCoercers(o,f)}};return de({},n,{syntheticException:r==0?n.syntheticException:void 0,mechanism:t,apply:o=>a(o,r),next:o=>a(o,r+1)})}}var $l="?";function fg(e,t,n,r,a){var o={platform:e,filename:t,function:n==="<anonymous>"?$l:n,in_app:!0};return ge(r)||(o.lineno=r),ge(a)||(o.colno=a),o}var Tw=(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]:$l,n?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},D3=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,z3=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,O3=/\((\S*)(?::(\d+))(?::(\d+))\)/,B3=(e,t)=>{var n=D3.exec(e);if(n)return fg(t,n[1],$l,+n[2],+n[3]);var r=z3.exec(e);if(r){if(r[2]&&r[2].indexOf("eval")===0){var a=O3.exec(r[2]);a&&(r[2]=a[1],r[3]=a[2],r[4]=a[3])}var o=Tw(r[1]||$l,r[2]);return fg(t,o[1],o[0],r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},P3=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,$3=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,F3=(e,t)=>{var n=P3.exec(e);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){var r=$3.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]||$l,u=Tw(o,a);return fg(t,a=u[1],o=u[0],n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},by=/\(error: (.*)\)/;class U3{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,n){var r=gt(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 Wd(t,"DOMException")}isDOMError(t){return Wd(t,"DOMError")}}class q3{match(t){return nw(t)}coerce(t,n){return{type:this.getType(t),value:this.getMessage(t,n),stack:this.getStack(t),cause:t.cause?n.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,n){var 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 H3{constructor(){}match(t){return!!Wd(t,"ErrorEvent")&&(t.error!=null||this.fe(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.pe(t))!==null&&r!==void 0?r:a.stack,synthetic:!0})}fe(t){return gt(t.message)&&t.message.length>0}pe(t){var n=t;if(gt(n.filename)&&n.filename.length>0){var r,a,o=(r=n.lineno)!==null&&r!==void 0?r:0,u=(a=n.colno)!==null&&a!==void 0?a:0;return`Error
67
- at `+n.filename+":"+o+":"+u}}}var I3=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class V3{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(I3);return a&&(n=a[1],r=a[2]),[n,r]}}var G3=["fatal","error","warning","log","info","debug"];function Aw(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 Y3{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(rx(t))return t.constructor.name;var n="name"in t?t.name:void 0;return gt(n)&&!Yd(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: "+Aw(t)}isSeverityLevel(t){return gt(t)&&!Yd(t)&&G3.indexOf(t)>=0}getStack(t){try{return gt(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:gt(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(nw(r))return r}}getObjectClassName(t){try{var n=Object.getPrototypeOf(t);return n?n.constructor.name:void 0}catch{return}}}class W3{match(t){return rx(t)}coerce(t,n){var r,a=t.constructor.name;return{type:a,value:a+" captured as exception with keys: "+Aw(t),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class Q3{match(t){return tw(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 X3{match(t){return Wd(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!rx(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 tw(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 ef="$message",tf="$timestamp",K3=new Set([ef,tf]),Zp={enabled:!0,max_bytes:32768};function nf(e){var t;return e?{enabled:(t=e.enabled)!==null&&t!==void 0?t:Zp.enabled,max_bytes:J3(e.max_bytes,Zp.max_bytes)}:de({},Zp)}class Z3{constructor(t){this.ii=[],this.ri=0,this.qe=nf(t)}setConfig(t){this.qe=nf(t),this.ni()}add(t){var n=(function(a){var o;try{o=Z5(a)}catch{return}try{var u=JSON.parse(o);if(!Ut(u))return;var f=u,h=f[ef],p=f[tf];return!gt(h)||h.trim().length===0||!gt(p)&&!ln(p)?void 0:{step:f,json:o}}catch{return}})(t);if(n){var r=(function(a){if(typeof TextEncoder<"u")return new TextEncoder().encode(a).length;for(var o=encodeURIComponent(a),u=0,f=0;o.length>f;f++)o[f]==="%"?(u+=1,f+=2):u+=1;return u})(n.json);r>this.qe.max_bytes||(this.ii.push({step:n.step,bytes:r}),this.ri+=r,this.ni())}}getAttachable(){return this.ii.map((t=>t.step))}clear(){this.ii=[],this.ri=0}size(){return this.ii.length}ni(){for(;this.ri>this.qe.max_bytes&&this.ii.length>0;){var t=this.ii.shift();t&&(this.ri-=t.bytes)}}}function J3(e,t){if(!ln(e)||e===1/0||e===-1/0)return t;var n=Math.floor(e);return 0>n?t:n}var Mw=function(e,t){var n=(t===void 0?{}:t).debugEnabled,r={k(a){if(re&&(Bt.DEBUG||re.POSTHOG_DEBUG||n)&&!ge(re.console)&&re.console){for(var o=("__rrweb_original__"in re.console[a])?re.console[a].__rrweb_original__:re.console[a],u=arguments.length,f=new Array(u>1?u-1:0),h=1;u>h;h++)f[h-1]=arguments[h];o(e,...f)}},debug(){for(var a=arguments.length,o=new Array(a),u=0;a>u;u++)o[u]=arguments[u];r.k("debug",...o)},info(){for(var a=arguments.length,o=new Array(a),u=0;a>u;u++)o[u]=arguments[u];r.k("log",...o)},warn(){for(var a=arguments.length,o=new Array(a),u=0;a>u;u++)o[u]=arguments[u];r.k("warn",...o)},error(){for(var a=arguments.length,o=new Array(a),u=0;a>u;u++)o[u]=arguments[u];r.k("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)=>Mw(e+" "+a,o)};return r},ye=Mw("[PostHog.js]"),Vt=ye.createLogger,e4=Vt("[ExternalScriptsLoader]"),rf=e=>{var t=Se==null?void 0:Se.querySelectorAll("script");if(t){for(var n=0;t.length>n;n++)if(t[n].src===e)return t[n]}},ba=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return e4.warn(t+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var r=rf(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(!Se)return n("document not found");if(rf(t))return ba(e,t,n);var u=Se.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")Se.head.appendChild(u);else{var f,h=Se.querySelectorAll("body > script");h.length>0?(f=h[0].parentNode)==null||f.insertBefore(u,h[0]):Se.body.appendChild(u)}};Se!=null&&Se.body?o():Se==null||Se.addEventListener("DOMContentLoaded",o)},Jp={},yy=(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)};Oe.__PosthogExtensions__=Oe.__PosthogExtensions__||{},Oe.__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=Jp[a];if(r==="fallback"&&o){if(rf(o))return void ba(e,o,n);delete Jp[a]}ba(e,a,r==="fallback"?(f,h)=>{if(f)if(typeof f=="string")n(f);else{var p,m=yy(e,t);Jp[a]=m;var x=rf(a);x==null||(p=x.parentNode)==null||p.removeChild(x),ba(e,m,n)}else n(void 0,h)}:n)}else ba(e,yy(e,t),n)}else{var u=e.requestRouter.endpointFor("assets","/array/"+e.config.token+"/config.js");ba(e,u,n)}},Oe.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{var r=e.requestRouter.endpointFor("api",t);ba(e,r,n)};Bt.DEBUG=!1,Bt.LIB_VERSION="1.418.0",Bt.LIB_NAME="web";var Rw="$people_distinct_id",Vn="distinct_id",Ac="$device_id",em="$device_model",Tl="__alias",uc="__timers",hg="$autocapture_disabled_server_side",pg="$heatmaps_enabled_server_side",mg="$exception_capture_enabled_server_side",gg="$error_tracking_suppression_rules",xg="$error_tracking_capture_extension_exceptions",vg="$web_vitals_enabled_server_side",cx="$dead_clicks_enabled_server_side",ux="$product_tours_enabled_server_side",bg="$web_vitals_allowed_metrics",Sa="$session_recording_remote_config",Lw="$replay_sample_rate",Dw="$replay_override_sampling",zw="$replay_override_linked_flag",Ow="$replay_override_url_trigger",Bw="$replay_override_event_trigger",Al="$sesid",dx="$session_is_sampled",Vi="$enabled_feature_flags",ja="$active_feature_flags",Od="$early_access_features",Mc="$feature_flag_details",Na="$feature_flag_payloads",Dl="$feature_flag_request_id",sf="$minimal_flag_called_events",pi="$override_feature_flags",ya="$override_feature_flag_payloads",Kr="$stored_person_properties",xi="$stored_group_properties",Pw="$groups",yg="$surveys",af="$surveys_loaded_at",_g="$surveys_activated",Bd="$surveys_activated_session",Pd="$surveys_activated_timestamps",dc="ph_product_tours",Yi="$flag_call_reported",fc="$flag_call_reported_session_id",zl="$feature_flag_errors",Ea="$feature_flag_evaluated_at",nt="$user_state",wg="$client_session_props",kg="$capture_rate_limit",Sg="$initial_campaign_params",jg="$initial_referrer_info",lf="$initial_person_info",of="$epp",pd="$posthog_cookieless",$w="$cookieless_mode",Fw="$sdk_debug_extensions_init_method",Uw="$sdk_debug_extensions_init_time_ms",qw="$sdk_debug_recording_script_not_loaded",fx="PostHog loadExternalDependency extension not found.",_a="on_reject",Wi="always",fn="anonymous",Mn="identified",Ng="identified_only",cf="visibilitychange",uf="beforeunload",Nl="$pageview",tm="$pageleave",nm="$identify",_y="$groupidentify";function md(e,t){Ie(e)&&e.forEach(t)}function St(e,t){if(!Ge(e))if(Ie(e))e.forEach(t);else if(f3(e))e.forEach(((r,a)=>t(r,a)));else for(var n in e)ew.call(e,n)&&t(e[n],n)}var Rt=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 $d(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 wy=function(e){try{return e()}catch{return}},t4=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)}}},hx=function(e){var t={};return St(e,(function(n,r){(gt(n)&&n.length>0||ln(n))&&(t[r]=n)})),t},n4=["herokuapp.com","vercel.app","netlify.app"];function r4(e){var t=e==null?void 0:e.hostname;if(!gt(t))return!1;var n=t.split(".").slice(-2).join(".");for(var r of n4)if(n===r)return!1;return!0}function Xt(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 Cg(e){return e.name==="ph_toolbar_internal"}var Hw=e=>{if(Se){try{for(var t=e+"=",n=Se.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 ln(e)&&isFinite(e)&&Math.floor(e)===e});class df{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 df(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 df(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 i4{generate(){var t=this.generateOrAbort();if(!ge(t))return t;this.S=0;var n=this.generateOrAbort();if(ge(n))throw new Error("Could not generate UUID after timestamp reset");return n}generateOrAbort(){var t=Date.now();if(t>this.S)this.S=t,this.C();else{if(this.S>=t+1e4)return;this.I++,this.I>4398046511103&&(this.S++,this.C())}return df.fromFieldsV7(this.S,Math.trunc(this.I/Math.pow(2,30)),this.I&Math.pow(2,30)-1,this.A.nextUint32())}C(){this.I=1024*this.A.nextUint32()+(1023&this.A.nextUint32())}constructor(){this.S=0,this.I=0,this.A=new s4}}var ky,Iw=e=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};re&&!ge(re.crypto)&&crypto.getRandomValues&&(Iw=e=>crypto.getRandomValues(e));class s4{nextUint32(){return this.R.length>this.O||(Iw(this.R),this.O=0),this.R[this.O++]}constructor(){this.R=new Uint32Array(8),this.O=1/0}}var Gi=()=>a4().toString(),a4=()=>(ky||(ky=new i4)).generate(),Xo="",l4=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,dn={N:()=>!!Se,j(e){ye.error("cookieStore error: "+e)},P:Hw,H(e){var t;try{t=JSON.parse(dn.P(e))||{}}catch{}return t},F(e,t,n,r,a){if(!Se)return!1;try{var o="",u="",f=(function(m,x){if(x){var b=(function(_,j){if(j===void 0&&(j=Se),Xo)return Xo;if(!j||["localhost","127.0.0.1"].includes(_))return"";for(var N=_.split("."),S=Math.min(N.length,8),E="dmn_chk_"+Gi();!Xo&&S--;){var C=N.slice(S).join("."),O=E+"=1;domain=."+C+";path=/";j.cookie=O+";max-age=3",j.cookie.includes(E)&&(j.cookie=O+";max-age=0",Xo=C)}return Xo})(m);if(!b){var y=(_=>{var j=_.match(l4);return j?j[0]:""})(m);y!==b&&ye.info("Warning: cookie subdomain discovery mismatch",y,b),b=y}return b?"; domain=."+b:""}return""})(Se.location.hostname,r);if(n){var h=new Date;h.setTime(h.getTime()+864e5*n),o="; expires="+h.toUTCString()}a&&(u="; secure");var p=e+"="+encodeURIComponent(JSON.stringify(t))+o+"; SameSite=Lax; path=/"+f+u;return p.length>3686.4&&ye.warn("cookieStore warning: large cookie, len="+p.length),Se.cookie=p,!0}catch{return!1}},q(e,t){if(Se!=null&&Se.cookie)try{dn.F(e,"",-1,t)}catch{return}}},rm=null,Ct={N(){if(!jn(rm))return rm;var e=!0;if(ge(re))e=!1;else try{var t="__mplssupport__";Ct.F(t,"xyz"),Ct.P(t)!=='"xyz"'&&(e=!1),Ct.q(t)}catch{e=!1}return e||ye.error("localStorage unsupported; falling back to cookie store"),rm=e,e},j(e){ye.error("localStorage error: "+e)},P(e){try{return re==null?void 0:re.localStorage.getItem(e)}catch(t){Ct.j(t)}return null},H(e){try{return JSON.parse(Ct.P(e))||{}}catch{}return null},F(e,t){try{return re==null||re.localStorage.setItem(e,JSON.stringify(t)),!0}catch(n){Ct.j(n)}return!1},q(e){try{re==null||re.localStorage.removeItem(e)}catch(t){Ct.j(t)}}},im=[Kr,ja,Vi,Mc,Na,Dl,Ea,zl,Yi],wa=[Ac,Vn,Al,dx,of,lf,nt],ff=e=>e+"_cpm",o4=["__proto__","constructor","prototype"],sm=e=>{if(!Ut(e))return{};var t={};return Object.keys(e).forEach((n=>{o4.indexOf(n)===-1&&(t[n]=e[n])})),t},am=function(e,t){t===void 0&&(t=[]);var n={};return[...wa,...t].forEach((r=>{var a=e[r];ge(a)||jn(a)||a===""||(n[r]=a)})),n},Vw=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)},Sy=(e,t)=>({p:t,f:Vw(JSON.stringify(e))}),jy=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{var n=dn.H(ff(e)),r=(n==null?void 0:n.f)===Vw(t)&&Ie(n.p);return{properties:r?n.p:[],isValid:r}}catch{return{properties:[],isValid:!1}}},lm=(e,t)=>t+"|"+(dn.P(ff(e))||""),gd={},c4={N:()=>!0,j(e){ye.error("memoryStorage error: "+e)},P:e=>gd[e]||null,H:e=>gd[e]||null,F:(e,t)=>(gd[e]=t,!0),q(e){delete gd[e]}},ha=null,Lt={N(){if(!jn(ha))return ha;if(ha=!0,ge(re))ha=!1;else try{var e="__support__";Lt.F(e,"xyz"),Lt.P(e)!=='"xyz"'&&(ha=!1),Lt.q(e)}catch{ha=!1}return ha},j(e){ye.error("sessionStorage error: ",e)},P(e){try{return re==null?void 0:re.sessionStorage.getItem(e)}catch(t){Lt.j(t)}return null},H(e){try{return JSON.parse(Lt.P(e))||null}catch{}return null},F(e,t){try{return re==null||re.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(n){Lt.j(n)}return!1},q(e){try{re==null||re.sessionStorage.removeItem(e)}catch(t){Lt.j(t)}}};class u4{constructor(t){this._instance=t}get qe(){return this._instance.config}get consent(){return this.si()?0:this.ai}isOptedOut(){return this.qe.cookieless_mode===Wi||this.isRejected()||this.consent===-1&&this.qe.cookieless_mode===_a}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.qe.opt_out_capturing_by_default}optInOut(t){this.oi.F(this.li,t?1:0,this.qe.cookie_expiration,this.qe.cross_subdomain_cookie,this.qe.secure_cookie)}reset(){this.oi.q(this.li,this.qe.cross_subdomain_cookie)}get li(){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 ai(){var t=this.oi.P(this.li);return Wp(t)?1:Ve(g3,t)?0:-1}get oi(){var t=this.qe.opt_out_capturing_persistence_type,n=t==="localStorage"?Ct:dn;if(!this.ui||this.ui!==n){this.ui=n;var r=t==="localStorage"?dn:Ct;r.P(this.li)&&(this.ui.P(this.li)||this.optInOut(Wp(r.P(this.li))),r.q(this.li,this.qe.cross_subdomain_cookie))}return this.ui}si(){return!!this.qe.respect_dnt&&[Qn==null?void 0:Qn.doNotTrack,Qn==null?void 0:Qn.msDoNotTrack,Oe.doNotTrack].some((t=>Wp(t)))}}function Gw(e,t){var n,r=e==null||(n=e.config)==null?void 0:n.get_current_url;if(!Gn(r))return t;try{var a=r(t);return gt(a)&&a?a:t}catch(o){return ye.error("Error in get_current_url, falling back to window.location.href",o),t}}var Yw="__POSTHOG_TOOLBAR__",d4=1,f4=3,h4=11;function Ny(e){return e instanceof Element&&(e.id===Yw||!(e.closest==null||!e.closest(".toolbar-global-fade-container")))}function $s(e){return!!e&&e.nodeType===d4}function _r(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function Ww(e){return!!e&&e.nodeType===f4}function Qw(e){return!!e&&e.nodeType===h4&&$s(e.host)}var Xw=1e3;function px(e){return e?Cf(e).split(/\s+/):[]}function Cy(e,t){var n=(function(r){var a,o=re==null||(a=re.location)==null?void 0:a.href;return ge(o)?void 0:Gw(r,o)})(t);return!!(n&&e&&e.some((r=>n.match(r))))}function hf(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 px(t)}function Kw(e){return Ge(e)?null:Cf(e).split(/(\s+)/).filter((t=>vc(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Rc(e){var t="";return Tg(e)&&!t2(e)&&e.childNodes&&e.childNodes.length&&St(e.childNodes,(function(n){var r;Ww(n)&&n.textContent&&(t+=(r=Kw(n.textContent))!==null&&r!==void 0?r:"")})),Cf(t)}function om(e){var t;return ge(e.target)?e.srcElement||null:(t=e.target)!=null&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}var mx=["a","button","form","input","select","textarea","label"];function Eg(e,t){if(ge(t))return!0;var n,r=function(o){if(t.some((u=>(function(f,h){var p=f.matches||f.matchesSelector||f.msMatchesSelector||f.mozMatchesSelector||f.webkitMatchesSelector||f.oMatchesSelector;try{return!!p&&p.call(f,h)}catch{return!1}})(o,u))))return{v:!0}};for(var a of e)if(n=r(a))return n.v;return!1}function Zw(e){var t=e.parentNode;return!(!t||!$s(t))&&t}var p4=[".ph-no-autocapture","[data-ph-no-autocapture]"],Jw=["next","previous","prev",">","<"],m4=[...Jw,"+","-","−","–"],Ey=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,Ty=[".ph-no-rageclick",".ph-no-capture"],g4=["","text","search","email","password","url","tel","number"];function Ay(e,t){if(!re||gx(e))return!1;var n,r,a,o,u;if(yr(t)?(n=!!t&&Ty,r=void 0,a=!1):(n=(o=t==null?void 0:t.css_selector_ignorelist)!==null&&o!==void 0?o:Ty,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(h){return!(!h||!$s(h))&&(!!_r(h,"textarea")||(_r(h,"input")?Ve(g4,(h.getAttribute("type")||"").toLowerCase()):(function(p){if(p.isContentEditable)return!0;var m=p.getAttribute==null?void 0:p.getAttribute("contenteditable");return m==="true"||m===""})(h)))})(e))return!1;var f=e2(e,!1).targetElementList;return!(function(h,p){if(h===!1||ge(h))return!1;var m;if(h===!0)m=Jw;else{if(!Ie(h))return!1;if(h.length>10)return ye.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;m=h.map((x=>x.toLowerCase()))}return p.some((x=>{var b=x.safeText,y=x.ariaLabel;return m.some((_=>Ey(b,_)||Ey(y,_)))}))})(r,f.map((h=>{var p;return{safeText:Rc(h).toLowerCase(),ariaLabel:((p=h.getAttribute("aria-label"))==null?void 0:p.toLowerCase().trim())||""}})))&&!Eg(f,n)}var gx=e=>!e||_r(e,"html")||!$s(e),e2=(e,t)=>{if(!re||gx(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,r=[e],a=e;a.parentNode&&!_r(a,"body");)if(Qw(a.parentNode))r.push(a.parentNode.host),a=a.parentNode.host;else{var o=Zw(a);if(!o)break;if(t||mx.indexOf(o.tagName.toLowerCase())>-1)n=!0;else try{var u=re.getComputedStyle(o);u&&u.getPropertyValue("cursor")==="pointer"&&(n=!0)}catch{}r.push(o),a=o}return{parentIsUsefulElement:n,targetElementList:r}};function Tg(e){for(var t=new Set,n=0,r=e;r.parentNode&&!_r(r,"body");r=r.parentNode){if(n++>=Xw||t.has(r))return!1;t.add(r);var a=hf(r);if(Ve(a,"ph-sensitive")||Ve(a,"ph-no-capture"))return!1}if(Ve(hf(e),"ph-include"))return!0;var o=e.type||"";if(gt(o))switch(o.toLowerCase()){case"hidden":case"password":return!1}var u=e.name||e.id||"";return!gt(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 t2(e){return!!(_r(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||_r(e,"select")||_r(e,"textarea")||e.getAttribute("contenteditable")==="true")}var My=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}))$"),Ry=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,x4=[16,15,14,13],v4=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Ly=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Dy=/[0-9A-Za-z_]/;function b4(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 vc(e,t){if(t===void 0&&(t=!0),Ge(e))return!1;if(gt(e)){e=Cf(e);var n=t?My.test((e||"").replace(/[- ]/g,"")):(function(a){var o;for(Ry.lastIndex=0;o=Ry.exec(a);){var u=o[2];if(u)for(var f=u.replace(/[- ]/g,""),h=0;f.length>h;h++)for(var p of x4){var m=h+p;if(f.length>=m){var x=f.slice(h,m);if(My.test(x)&&b4(x))return!0}}}return!1})(e);if(n)return!1;var r=t?v4.test(e):(function(a){var o;for(Ly.lastIndex=0;o=Ly.exec(a);){var u=o[1],f=o[3];if(!(u&&f&&Dy.test(u)&&Dy.test(f)))return!0}return!1})(e);if(r)return!1}return!0}function zy(e){var t=Rc(e);return vc(t=(t+" "+n2(e)).trim())?t:""}function n2(e){var t="";return e&&e.childNodes&&e.childNodes.length&&St(e.childNodes,(function(n){var r;if(n&&((r=n.tagName)==null?void 0:r.toLowerCase())==="span")try{var a=Rc(n);t=(t+" "+a).trim(),n.childNodes&&n.childNodes.length&&(t=(t+" "+n2(n)).trim())}catch(o){ye.error("[AutoCapture]",o)}})),t}function Oy(e){return e.replace(/"|\\"/g,'\\"')}function y4(e){var t=e.attr__class;if(t)return Ie(t)?t:px(t)}var xd=Vt("[Dead Clicks]"),_4=()=>!0,w4=e=>{var t,n=!((t=e.instance.persistence)==null||!t.get_property(cx)),r=e.instance.config.capture_dead_clicks;return yr(r)?r:!!Ut(r)||n};class By{get lazyLoadedDeadClicksAutocapture(){return this.hi}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({[cx]:n.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.di((()=>{this.vi()})):this.stop()}di(t){var n,r;(n=Oe.__PosthogExtensions__)!=null&&n.initDeadClicksAutocapture?t():(r=Oe.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this.instance,"dead-clicks-autocapture",(a=>{a?xd.error("failed to load script",a):t()}))}vi(){var t;if(Se){if(!this.hi&&(t=Oe.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture){var n=Ut(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.hi=Oe.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.hi.start(Se),xd.info("starting...")}}else xd.error("`document` not found. Cannot start.")}stop(){this.hi&&(this.hi.stop(),this.hi=void 0,xd.info("stopping..."))}}var cm=Vt("[SegmentIntegration]"),r2="posthog-js";function i2(e,t){var n=t===void 0?{}:t,r=n.organization,a=n.projectId,o=n.prefix,u=n.severityAllowList,f=u===void 0?["error"]:u,h=n.sendExceptionsToPostHog,p=h===void 0||h;return m=>{var x,b,y,_,j;if(f!=="*"&&!f.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 S,E=((x=m.exception)==null?void 0:x.values)||[],C=E.map((D=>de({},D,{stacktrace:D.stacktrace?de({},D.stacktrace,{type:"raw",frames:(D.stacktrace.frames||[]).map((L=>de({},L,{platform:"web:javascript"})))}):void 0}))),O={$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&&(O.$sentry_url=(o||"https://sentry.io/organizations/")+r+"/issues/?project="+a+"&query="+m.event_id),p&&((S=e.exceptions)==null||S.sendExceptionEvent(O)),m}}class k4{constructor(t,n,r,a,o,u){this.name=r2,this.setupOnce=function(f){f(i2(t,{organization:n,projectId:r,prefix:a,severityAllowList:o,sendExceptionsToPostHog:u==null||u}))}}}class Py{constructor(t){this.ci=(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.fi=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.pi()}pi(){var t;this.gi=(t=this._instance.sessionManager)==null?void 0:t.onSessionId(this.ci)}destroy(){var t;(t=this.gi)==null||t.call(this),this.gi=void 0}doPageView(t,n){var r,a=this.mi(t,n);return this.fi={pathname:(r=re==null?void 0:re.location.pathname)!==null&&r!==void 0?r:"",pageViewId:n,timestamp:t},this._instance.scrollManager.resetContext(),a}doPageLeave(t){var n;return this.mi(t,(n=this.fi)==null?void 0:n.pageViewId)}doEvent(){var t;return{$pageview_id:(t=this.fi)==null?void 0:t.pageViewId}}mi(t,n){var r=this.fi;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,f=o.lastScrollY,h=o.maxScrollY,p=o.maxContentHeight,m=o.lastContentY,x=o.maxContentY;if(!(ge(u)||ge(f)||ge(h)||ge(p)||ge(m)||ge(x))){u=Math.ceil(u),f=Math.ceil(f),h=Math.ceil(h),p=Math.ceil(p),m=Math.ceil(m),x=Math.ceil(x);var b=u>1?vi(f/u,0,1,ye):1,y=u>1?vi(h/u,0,1,ye):1,_=p>1?vi(m/p,0,1,ye):1,j=p>1?vi(x/p,0,1,ye):1;a=Rt(a,{$prev_pageview_last_scroll:f,$prev_pageview_last_scroll_percentage:b,$prev_pageview_max_scroll:h,$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 um=["flags","surveys"],S4={[Rw]:{exposure:"hidden"},[Tl]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[uc]:{exposure:"hidden"},[hg]:{exposure:"event"},[pg]:{exposure:"hidden"},[mg]:{exposure:"event"},[gg]:{exposure:"hidden"},[xg]:{exposure:"event"},[vg]:{exposure:"event"},[cx]:{exposure:"event"},[ux]:{exposure:"hidden"},[bg]:{exposure:"event"},[Sa]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[Al]:{exposure:"hidden"},[dx]:{exposure:"event"},[Lw]:{exposure:"event",shouldSkipFromEventProperties:e=>jn(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"},[Vi]:{exposure:"hidden",storageGroup:"flags"},[ja]:{exposure:"hidden",storageGroup:"flags"},[Od]:{exposure:"hidden"},[Mc]:{exposure:"hidden",storageGroup:"flags"},[Na]:{exposure:"hidden",storageGroup:"flags"},[Dl]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[sf]:{exposure:"hidden",storageGroup:"flags"},[pi]:{exposure:"hidden"},[ya]:{exposure:"hidden"},[Kr]:{exposure:"hidden"},[xi]:{exposure:"hidden"},[yg]:{exposure:"hidden",storageGroup:"surveys"},[af]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[_g]:{exposure:"event"},[Bd]:{exposure:"hidden"},[Pd]:{exposure:"hidden"},[dc]:{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"},[Yi]:{exposure:"hidden"},[fc]:{exposure:"hidden"},[Pw]:{exposure:"event"},[zl]:{exposure:"hidden"},[Ea]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[nt]:{exposure:"hidden"},[wg]:{exposure:"hidden"},[kg]:{exposure:"hidden"},[Sg]:{exposure:"hidden"},[jg]:{exposure:"hidden"},[lf]:{exposure:"hidden"},[of]:{exposure:"hidden"},[Dw]:{exposure:"event"},[zw]:{exposure:"event"},[Ow]:{exposure:"event"},[Bw]:{exposure:"event"},[Fw]:{exposure:"event"},[Uw]:{exposure:"event"},[qw]:{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_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"}},j4=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],mi=e=>{var t=S4[e];if(t)return t;for(var n of j4){var r=n[1];if(e.indexOf(n[0])===0)return r}},Ml=(e,t)=>{try{return JSON.stringify(e,((n,r)=>typeof r=="bigint"?r.toString():r),t)}catch{return Z5(e)}},Fl=e=>{var t=Se==null?void 0:Se.createElement("a");return ge(t)?null:(t.href=e,t)},Ul=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(!Ie(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," ")},Lc=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],f=o[0],h=(u||"").split("&"),p=[],m=0;h.length>m;m++){var x=h[m].split("=");Ie(x)&&(t.includes(x[0])?p.push(x[0]+"="+n):p.push(h[m]))}var b=f;return u!=null&&(b+="?"+p.join("&")),a!=null&&(b+="#"+a),b},pf=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},s2=(e,t)=>e>=t&&Q5(),a2=(e,t,n,r)=>{if(e===0){if(Q5()){var a=t+1;return a===n&&r(),a}return t}return 0},vd="https?://(.*)",ql=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],N4=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...ql],Dc="<masked>",C4=["li_fat_id"];function l2(e,t,n){if(!Se)return{};var r,a=t?[...ql,...n||[]]:[],o=o2(Lc(Se.URL,a,Dc),e),u=(r={},St(C4,(function(f){var h=Hw(f);r[f]=h||null})),r);return Rt(u,o)}function o2(e,t){var n=N4.concat(t||[]),r={};return St(n,(function(a){var o=Ul(e,a);r[a]=o||null})),r}function c2(e){var t=(function(o){return o?o.search(vd+"google.([^/?]*)")===0?"google":o.search(vd+"bing.com")===0?"bing":o.search(vd+"yahoo.com")===0?"yahoo":o.search(vd+"duckduckgo.com")===0?"duckduckgo":null:null})(e),n=t!="yahoo"?"q":"p",r={};if(!jn(t)){r.$search_engine=t;var a=Se?Ul(Se.referrer,n):"";a.length&&(r.ph_keyword=a)}return r}function $y(){return navigator.language||navigator.userLanguage}var mf="$direct";function u2(){return(Se==null?void 0:Se.referrer)||mf}function d2(e,t,n){n===void 0&&(n=!1);var r=e?[...ql,...t||[]]:[],a=n?Ps(Qt==null?void 0:Qt.href):Qt==null?void 0:Qt.href,o=a==null?void 0:a.substring(0,1e3);return{r:u2().substring(0,1e3),u:o?Lc(o,r,Dc):void 0}}function f2(e,t){var n;t===void 0&&(t=!1);var r=e.r,a=e.u,o=t?Ps(a):a,u={$referrer:r,$referring_domain:r==null?void 0:r==mf?mf:(n=Fl(r))==null?void 0:n.host};if(o){u.$current_url=o;var f=Fl(o);u.$host=f==null?void 0:f.host,u.$pathname=f==null?void 0:f.pathname;var h=o2(o);Rt(u,h)}if(r){var p=c2(r);Rt(u,p)}return u}function h2(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function E4(){try{return new Date().getTimezoneOffset()}catch{return}}var T4={flags:Ea,surveys:af},A4=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],bd=e=>e+"_cookie_identity_change_pending",Rs="main",Fy=(e,t)=>{St(e,((n,r)=>{var a=mi(r);a&&a.exposure!=="event"||{}.hasOwnProperty.call(t,r)||delete e[r]}))};class dm{constructor(t,n,r){if(r===void 0&&(r=!0),this.yi={},this.bi=!1,this.wi=!1,this.ki=!1,this.xi=!1,this.qe=t,this.Si=r,this.props={},this.Ci=void 0,this.Mi=(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.oi=this.Ti(t),this.wi=this.Ei(t),this.load(),t.debug&&ye.info("Persistence loaded",t.persistence,de({},this.props)),this.update_config(t,t,n),this.save(),re){var a=()=>this.flush();Xt(re,"beforeunload",a,{capture:!1}),Xt(re,"pagehide",a,{capture:!1})}}Ii(){var t,n=(t=this.qe)==null?void 0:t.persistence_save_debounce_ms;return ln(n)&&n>0?n:0}Pi(t){if(this.qe.cookieWinsOnConflict&&this.qe.persistence.toLowerCase()==="localstorage+cookie")if(t)try{var n=am(t,this.qe.cookie_persisted_properties||[]),r=Sy(n,this.qe.cookie_persisted_properties||[]),a=JSON.stringify(n)+"|"+JSON.stringify(r),o=dn.P(this.Mi)||void 0;o&&lm(this.Mi,o)===a&&(this.Ri=a,this.Ai=o)}catch{}else try{var u=dn.P(this.Mi)||void 0;this.Ri=u?lm(this.Mi,u):void 0,this.Ai=u}catch{}}syncCookieProperties(){return this.Fi(this.qe)}Fi(t,n){if(n===void 0&&(n=!1),this.Oi&&!n||this.xi||!t.cookieWinsOnConflict||t.persistence.toLowerCase()!=="localstorage+cookie")return!1;var r;try{r=dn.P(this.Mi)||void 0}catch{}if(!r||r===this.Ai)return!1;var a,o=lm(this.Mi,r);try{a=sm(JSON.parse(r))}catch{return!1}if((dn.P(this.Mi)||void 0)!==r)return!1;this.Ri=o,this.Ai=r;var u=jy(this.Mi,r),f=[...wa,...u.properties],h={};if(Object.keys(a).forEach((j=>{var N=a[j];(ge(N)||jn(N)||N===""||j===nt&&N!==fn&&N!==Mn)&&(h[j]=!0,delete a[j])})),Jr(a))return!1;var p=Vn in a||a[nt]===fn||a[nt]===Mn,m=this.props[Vn],x=this.props[nt],b=Rt({},this.props);[...wa,...t.cookie_persisted_properties||[]].forEach((j=>{if(f.indexOf(j)!==-1&&!(j in a)&&!h[j]&&(p||j!==Vn&&j!==nt)){var N=b[j];!u.isValid&&wa.indexOf(j)!==-1&&(N===!1||N===0)||delete b[j]}})),this.props=Rt(b,a),!p||nt in a||nt in this.props||this.Li(nt,fn);var y=this.props[Vn],_=this.props[nt];return!p||y===m&&_===x||(this.ki=!0,Lt.F(bd(this.Mi),!0),this.Di(Kr),this.Di(ja),this.Di(Vi),this.Di(Mc),this.Di(Na),this.Di(Dl),this.Di(Ea),this.Di(zl),this.Di(Yi),_===fn&&(x===Mn||a[nt]===fn||!ge(m)&&y!==m)&&(Fy(this.props,a),this.Di(xi)),_===Mn?this.props.$user_id=y:delete this.props.$user_id,this.Di(Tl)),!0}consumeCookieIdentityChange(){var t=bd(this.Mi),n=this.ki||!!Lt.P(t);return this.ki=!1,n&&Lt.q(t),n}$i(t){return t===void 0&&(t=!1),!(this.xi||this.Oi&&!t||!this.qe.cookieWinsOnConflict||this.qe.persistence.toLowerCase()!=="localstorage+cookie"||(this.xi=!0,0))}Ni(){this.xi&&(ge(this.qi)||(clearTimeout(this.qi),this.qi=void 0),delete this.yi[Rs],this.ji(!0))}Bi(t){if(t===void 0&&(t=!0),this.xi)try{t?this.Ni():ge(this.qi)||(clearTimeout(this.qi),this.qi=void 0)}finally{this.xi=!1}}isDisabled(){return!!this.Oi}Ti(t){A4.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(u,f){u===void 0&&(u=[]),f===void 0&&(f=!1);var h=[...wa,...u];return de({},Ct,{H(p){try{var m,x={};try{m=dn.P(p)||void 0,x=m?sm(JSON.parse(m)):{}}catch{}var b,y=JSON.parse(Ct.P(p)||"{}");if(f){var _=jy(p,m),j=[...wa,..._.properties],N={};Object.keys(x).forEach((D=>{var L=x[D];jn(L)||L===""||D===nt&&L!==fn&&L!==Mn||(N[D]=L)}));var S=Vn in N||N[nt]===fn||N[nt]===Mn;if(Object.keys(N).length>0){var E,C=y[Vn],O=(E=y[nt])!==null&&E!==void 0?E:fn;h.forEach((D=>{if(j.indexOf(D)!==-1&&!(D in x)&&(S||D!==Vn&&D!==nt)){var L=y[D];!_.isValid&&wa.indexOf(D)!==-1&&(L===!1||L===0)||delete y[D]}})),!S||nt in x||nt in y||(y[nt]=fn),!S||(Vn in N?N[Vn]:y[Vn])===C&&(nt in N?N[nt]:y[nt])===O||(im.forEach((D=>delete y[D])),N[nt]===Mn&&Vn in N?y.$user_id=N[Vn]:delete y.$user_id,N[nt]!==Mn&&(delete y[Pw],delete y[xi]),delete y.__alias)}b=Rt(y,N)}else b=Rt(x,y);return Ct.F(p,b),b}catch{}return null},F(p,m,x,b,y,_){var j=Ct.F(p,m,void 0,void 0,_);try{var N=am(m,u);if(Object.keys(N).length){if(f){var S=ff(p),E=Sy(N,u);if(dn.F(S,E,x,b,y,_),dn.P(S)!==JSON.stringify(E)){dn.q(S,b);var C=am(m);return dn.F(p,C,x,b,y,_),j}}dn.F(p,N,x,b,y,_)}}catch(O){Ct.j(O)}return j},q(p,m){try{re==null||re.localStorage.removeItem(p),dn.q(p,m),dn.q(ff(p),m)}catch(x){Ct.j(x)}}})})(t.cookie_persisted_properties||[],t.cookieWinsOnConflict),a=!1,o=t.persistence.toLowerCase();return o==="localstorage"&&Ct.N()?(n=Ct,a=!0):o==="localstorage+cookie"&&r.N()?(n=r,a=!0):o==="sessionstorage"&&Lt.N()?n=Lt:o==="memory"?n=c4:o==="cookie"?n=dn:r.N()?(n=r,a=!0):n=dn,this.bi=a,n}Hi(t){return this.Mi+"__"+t}Ei(t){return this.bi&&!!t.split_storage}properties(){var t={};return St(this.props,((n,r)=>{var a=mi(r);if(!a||a.exposure==="event"){if(a!=null&&a.shouldSkipFromEventProperties!=null&&a.shouldSkipFromEventProperties(n))return;t[r]=n}})),t}load(){if(!this.Oi){var t=this.qe.cookieWinsOnConflict&&this.qe.persistence.toLowerCase()==="localstorage+cookie",n=t?Ct.H(this.Mi):null,r={};if(t)try{St(r=sm(dn.H(this.Mi)),((y,_)=>{(ge(y)||jn(y)||y==="")&&delete r[_]}))}catch{}var a=this.oi.H(this.Mi);if(a&&(this.props=Rt({},a)),this.wi&&this.Ui(),t&&a){var o,u,f=n==null?void 0:n[Vn],h=(o=n==null?void 0:n[nt])!==null&&o!==void 0?o:fn,p=a[Vn],m=(u=a[nt])!==null&&u!==void 0?u:fn;if(p!==f||m!==h){this.ki=!0,Lt.F(bd(this.Mi),!0);var x=Rt({},this.props);im.forEach((y=>delete x[y])),m===fn&&(h===Mn||r[nt]===fn||!ge(f)&&p!==f)&&(Fy(x,r),delete x[xi]),this.props=x;var b=new Set;im.forEach((y=>{var _,j=(_=mi(y))==null?void 0:_.storageGroup;j&&b.add(j)})),b.forEach((y=>{var _={};St(this.props,((j,N)=>{var S;((S=mi(N))==null?void 0:S.storageGroup)===y&&(_[N]=j)})),Jr(_)?(Ct.q(this.Hi(y)),this.yi[y]={}):Ct.F(this.Hi(y),_)&&(this.yi[y]={persisted:!0,fingerprint:this.zi(_,y)})}))}}Lt.P(bd(this.Mi))&&(this.ki=!0)}}Ui(){for(var t of um){var n=Ct.H(this.Hi(t));if(n&&!Jr(n)){var r=this.Wi(t);r.persisted=!0,this.Vi(t)||(r.fingerprint=this.zi(n,t)),this.Zi(t,n)||Rt(this.props,n)}}}Vi(t){return Object.keys(this.props).some((n=>{var r;return((r=mi(n))==null?void 0:r.storageGroup)===t}))}Zi(t,n){var r=T4[t];if(!r)return!1;var a=n[r],o=this.props[r];return ln(a)&&ln(o)&&o>a}refreshKey(t){var n;if(!this.Oi){var r=this.wi?(n=mi(t))==null?void 0:n.storageGroup:void 0,a=r?Ct.H(this.Hi(r)):this.oi.H(this.Mi);if(a&&t in a)this.Li(t,a[t]);else{if(r){var o=this.oi.H(this.Mi);if(o&&t in o)return void this.Li(t,o[t])}this.Di(t)}}}save(){if(!this.Oi){var t=this.Ii();t>0?ge(this.qi)&&(this.qi=setTimeout((()=>{this.qi=void 0,this.ji()}),t)):this.ji()}}flush(){ge(this.qi)||(clearTimeout(this.qi),this.qi=void 0,this.ji())}ji(t){t===void 0&&(t=!1),this.Oi||this.xi&&!t||(t||this.syncCookieProperties(),this.wi?this.Gi():this.Qi(this.oi,this.Mi,this.props,Rs)&&this.Pi(this.props))}Gi(){var t=this.Ji(),n=t.main,r=t.groups;for(var a of(this.Qi(this.oi,this.Mi,n,Rs)&&this.Pi(n),um)){var o,u=r[a];(!Jr(u)||(o=this.yi[a])!=null&&o.persisted)&&this.Qi(Ct,this.Hi(a),u,a)}}Ji(){var t={},n={flags:{},surveys:{}};return St(this.props,((r,a)=>{var o,u=(o=mi(a))==null?void 0:o.storageGroup;u?n[u][a]=r:t[a]=r})),{main:t,groups:n}}zi(t,n){if(n===Rs)return JSON.stringify(t)+"|"+this.Ki+"|"+this.Yi+"|"+this.Xi;var r={};return St(t,((a,o)=>{var u;r[o]=(u=mi(o))!=null&&u.volatile?"__volatile__":a})),JSON.stringify(r)}Qi(t,n,r,a){var o,u=this.Wi(a);if(a!==Rs&&!u.dirty&&!ge(u.fingerprint))return!1;try{if((o=this.zi(r,a))===u.fingerprint)return u.dirty=!1,!1}catch{o=void 0}return t.F(n,r,this.Ki,this.Yi,this.Xi,this.qe.debug)?(u.dirty=!1,a!==Rs&&(u.persisted=!0),ge(o)||(u.fingerprint=o),!0):(this.qe.debug&&ye.warn('failed to persist storage entry "'+n+'"; will retry on next save'),!1)}remove(t){var n=(t===void 0?{}:t).keepGroupEntries,r=n!==void 0&&n;if(ge(this.qi)||(clearTimeout(this.qi),this.qi=void 0),this.oi.q(this.Mi,!1),this.oi.q(this.Mi,!0),!r&&this.Si)for(var a of um)Ct.q(this.Hi(a));r?delete this.yi[Rs]:this.yi={},this.Ri=void 0,this.Ai=void 0}clear(){this.remove(),this.props={}}register_once(t,n,r){if(Ut(t)){this.syncCookieProperties(),ge(n)&&(n="None"),this.Ki=ge(r)?this.tr:r;var a=!1;if(St(t,((o,u)=>{this.props.hasOwnProperty(u)&&this.props[u]!==n||(this.Li(u,o),a=!0)})),a)return this.save(),!0}return!1}register(t,n){if(Ut(t)){this.syncCookieProperties(),this.Ki=ge(n)?this.tr:n;var r=!1;if(St(t,((a,o)=>{t.hasOwnProperty(o)&&(this.props[o]!==a||Ut(a)||Ie(a))&&(this.Li(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.Di(a),r=!0);r&&this.save()}update_campaign_params(){var t=Se==null?void 0:Se.URL;if(t!==this.Ci){var n=l2(this.qe.custom_campaign_params,this.qe.mask_personal_data_properties,this.qe.custom_personal_data_properties);Jr(hx(n))||this.register(n),this.Ci=t}}update_search_keyword(){var t;this.register((t=Se==null?void 0:Se.referrer)?c2(t):{})}update_referrer_info(){var t;this.register_once({$referrer:u2(),$referring_domain:Se!=null&&Se.referrer&&((t=Fl(Se.referrer))==null?void 0:t.host)||mf},void 0)}set_initial_person_info(){this.props[Sg]||this.props[jg]||this.register_once({[lf]:d2(this.qe.mask_personal_data_properties,this.qe.custom_personal_data_properties,this.qe.disable_capture_url_hashes)},void 0)}get_initial_props(){var t={};St([jg,Sg],(a=>{var o=this.props[a];o&&St(o,(function(u,f){t["$initial_"+lg(f)]=u}))}));var n=this.props[lf];if(n){var r=(function(a,o){o===void 0&&(o=!1);var u=f2(a,o),f={};return St(u,(function(h,p){f["$initial_"+lg(p)]=h})),f})(n,this.qe.disable_capture_url_hashes);Rt(t,r)}return t}safe_merge(t){return St(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 S=[...j].sort(),E=[...N].sort();return S.every(((C,O)=>C===E[O]))})(t.cookie_persisted_properties||[],n.cookie_persisted_properties||[]),u=a||o,f=t.cookieWinsOnConflict!==n.cookieWinsOnConflict,h=t.disable_persistence||!!r,p=!!this.Oi&&!h;h||this.Fi(n,p),this.qe=t,!h&&(a||o||f)&&(this.Ri=void 0,this.Ai=void 0,this.Fi(de({},t,{cookie_persisted_properties:n.cookie_persisted_properties}),p));var m=u||f?this.Ti(t):this.oi,x=this.Ei(t),b=u||x!==this.wi,y=!h&&(b||t.cross_subdomain_cookie!==this.Yi||t.secure_cookie!==this.Xi)&&this.$i(p);try{if(this.tr=this.Ki=t.cookie_expiration,this.set_disabled(h),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),b){var _=this.props;this.clear(),this.oi=m,this.wi=x,this.props=_,this.save()}else f&&(this.oi=m,h||(delete this.yi[Rs],this.ji()))}finally{y&&this.Bi()}}set_disabled(t){this.Oi=t,this.Oi?this.remove():this.save()}set_cross_subdomain(t){t!==this.Yi&&(this.Yi=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.Xi&&(this.Xi=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,n){var r=this.props[uc]||{};r[t]=n,this.Li(uc,r),this.save()}remove_event_timer(t){var n=this.props[uc]||{},r=n[t];return ge(r)||(delete n[t],this.Li(uc,n),this.save()),r}get_property(t){return this.props[t]}set_property(t,n){this.Li(t,n),this.save()}Li(t,n){var r;this.props[t]=n,(r=mi(t))!=null&&r.volatile||this.er(t)}Di(t){delete this.props[t],this.er(t)}er(t){var n,r=(n=mi(t))==null?void 0:n.storageGroup;r&&(this.Wi(r).dirty=!0)}Wi(t){return this.yi[t]||(this.yi[t]={})}}function yd(e){var t=!0;return{dispose(){if(t){t=!1;var n=e();n&&Gn(n.then)&&n.then(void 0,(()=>{}))}}}}var Yn={GZipJS:"gzip-js",Base64:"base64"},Ko={Activation:"events",Cancellation:"cancelEvents"},fm={Popover:"popover",API:"api",Widget:"widget"},Qi={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},hm={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},Ag={Popover:"popover",Inline:"inline"},M4={SHOWN:"product tour shown"},Uy={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},qy=Vt("[RateLimiter]");class R4{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=>{qy.info((a||"events")+" is quota limited."),this.serverLimits[a]=new Date().getTime()+6e4}))}catch(a){return void qy.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,f=new Date().getTime(),h=(n=(r=this.instance.persistence)==null?void 0:r.get_property(kg))!==null&&n!==void 0?n:{tokens:o,last:f};h.tokens+=(f-h.last)/1e3*u,h.last=f,h.tokens>o&&(h.tokens=o);var p=1>h.tokens;if(p||t||(h.tokens=Math.max(0,h.tokens-1)),p&&!t){var m=(ln(h.dropped)?h.dropped:0)+1;h.dropped=m,!this.lastEventRateLimited&&this.ir(m)&&(h.dropped=0)}return this.lastEventRateLimited=p,(a=this.instance.persistence)==null||a.set_property(kg,h),{isRateLimited:p,remainingTokens:h.tokens}}rr(t){var n=this.instance.config.property_denylist;return!Ie(n)||!n.includes(t)}nr(){var t;if(this.rr("$current_url")&&this.rr("$pathname")&&Qt!=null&&Qt.pathname)return""+((t=Qt.origin)!==null&&t!==void 0?t:"")+Qt.pathname}ir(t){var n,r,a=this.captureEventsBurstLimit,o=this.captureEventsPerSecond,u=this.nr(),f=this.rr("$session_id")?(n=(r=this.instance).get_session_id)==null?void 0:n.call(r):void 0,h=[t+" event(s) dropped since the last warning",u?"triggered on "+u:void 0,f?"session "+f:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited: "+h+". Config is set to "+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 Ls=Vt("[RemoteConfig]");class p2{constructor(t){this._instance=t}get remoteConfig(){var t;return(t=Oe._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.config}sr(t){var n,r;(n=Oe.__PosthogExtensions__)!=null&&n.loadExternalDependency?(r=Oe.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}ar(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 Ls.info("Using preloaded remote config",this.remoteConfig),this.lr(this.remoteConfig),void this.ur();if(this._instance.hr())return void Ls.warn("Remote config is disabled. Falling back to local config.");this.sr((t=>{if(!t)return Ls.info("No config found after loading remote JS config. Falling back to JSON."),void this.ar((n=>{this.lr(n.json,n),this.ur()}));this.lr(t),this.ur()}))}catch(t){Ls.error("Error loading remote config",t),this.lr()}}stop(){this.dr&&(clearInterval(this.dr),this.dr=void 0)}refresh(){!this._instance.hr()&&Se&&Se.visibilityState!=="hidden"&&this._instance.reloadFeatureFlags()}ur(){var t;if(!this.dr){var n=(t=this._instance.config.remote_config_refresh_interval_ms)!==null&&t!==void 0?t:3e5;n!==0&&(this.dr=setInterval((()=>{this.refresh()}),n))}}lr(t,n){!t&&n&&(n.statusCode===0?n.error||Ls.warn("Failed to fetch remote config from PostHog."):Ls.error("Failed to fetch remote config from PostHog."));try{this._instance.lr(t?{ok:!0,config:t}:{ok:!1})}catch(a){Ls.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){Ls.error("Error loading feature flags",a)}}}var qr=Uint8Array,lr=Uint16Array,Hl=Uint32Array,xx=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]),vx=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]),Hy=new qr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),m2=function(e,t){for(var n=new lr(31),r=0;31>r;++r)n[r]=t+=1<<e[r-1];var a=new Hl(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]},g2=m2(xx,2),Mg=g2[1];g2[0][28]=258,Mg[258]=28;for(var Iy=m2(vx,0)[1],x2=new lr(32768),Kt=0;32768>Kt;++Kt){var _l=(43690&Kt)>>>1|(21845&Kt)<<1;x2[Kt]=((65280&(_l=(61680&(_l=(52428&_l)>>>2|(13107&_l)<<2))>>>4|(3855&_l)<<4))>>>8|(255&_l)<<8)>>>1}var bc=function(e,t,n){for(var r=e.length,a=0,o=new lr(t);r>a;++a)++o[e[a]-1];var u,f=new lr(t);for(a=0;t>a;++a)f[a]=f[a-1]+o[a-1]<<1;for(u=new lr(r),a=0;r>a;++a)u[a]=x2[f[e[a]-1]++]>>>15-e[a];return u},Aa=new qr(288);for(Kt=0;144>Kt;++Kt)Aa[Kt]=8;for(Kt=144;256>Kt;++Kt)Aa[Kt]=9;for(Kt=256;280>Kt;++Kt)Aa[Kt]=7;for(Kt=280;288>Kt;++Kt)Aa[Kt]=8;var gf=new qr(32);for(Kt=0;32>Kt;++Kt)gf[Kt]=5;var L4=bc(Aa,9),D4=bc(gf,5),v2=function(e){return(e/8>>0)+(7&e&&1)},b2=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var r=new(e instanceof lr?lr:e instanceof Hl?Hl:qr)(n-t);return r.set(e.subarray(t,n)),r},$i=function(e,t,n){var r=t/8>>0;e[r]|=n<<=7&t,e[r+1]|=n>>>8},Zo=function(e,t,n){var r=t/8>>0;e[r]|=n<<=7&t,e[r+1]|=n>>>8,e[r+2]|=n>>>16},pm=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(D,L){return D.f-L.f})),n.push({s:-1,f:25001});var f=n[0],h=n[1],p=0,m=1,x=2;for(n[0]={s:-1,f:f.f+h.f,l:f,r:h};m!=a-1;)f=n[n[x].f>n[p].f?p++:x++],h=n[p!=m&&n[x].f>n[p].f?p++:x++],n[m++]={s:-1,f:f.f+h.f,l:f,r:h};var b=o[0].s;for(r=1;a>r;++r)o[r].s>b&&(b=o[r].s);var y=new lr(b+1),_=Rg(n[m-1],y,0);if(_>t){r=0;var j=0,N=_-t,S=1<<N;for(o.sort((function(D,L){return y[L.s]-y[D.s]||D.f-L.f}));a>r;++r){var E=o[r].s;if(t>=y[E])break;j+=S-(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 O=o[r].s;y[O]==t&&(--y[O],++j)}_=t}return[new qr(y),_]},Rg=function(e,t,n){return e.s==-1?Math.max(Rg(e.l,t,n+1),Rg(e.r,t,n+1)):t[e.s]=n},Vy=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new lr(++t),r=0,a=e[0],o=1,u=function(h){n[r++]=h},f=1;t>=f;++f)if(e[f]==a&&f!=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[f]}return[n.subarray(0,r),t]},Jo=function(e,t){for(var n=0,r=0;t.length>r;++r)n+=e[r]*t[r];return n},Lg=function(e,t,n){var r=n.length,a=v2(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)},Gy=function(e,t,n,r,a,o,u,f,h,p,m){$i(t,m++,n),++a[256];for(var x=pm(a,15),b=x[0],y=x[1],_=pm(o,15),j=_[0],N=_[1],S=Vy(b),E=S[0],C=S[1],O=Vy(j),D=O[0],L=O[1],I=new lr(19),F=0;E.length>F;++F)I[31&E[F]]++;for(F=0;D.length>F;++F)I[31&D[F]]++;for(var W=pm(I,7),z=W[0],q=W[1],A=19;A>4&&!z[Hy[A-1]];--A);var ie,K,G,P,$=p+5<<3,se=Jo(a,Aa)+Jo(o,gf)+u,ae=Jo(a,b)+Jo(o,j)+u+14+3*A+Jo(I,z)+(2*I[16]+3*I[17]+7*I[18]);if(se>=$&&ae>=$)return Lg(t,m,e.subarray(h,h+p));if($i(t,m,1+(se>ae)),m+=2,se>ae){ie=bc(b,y),K=b,G=bc(j,N),P=j;var R=bc(z,q);for($i(t,m,C-257),$i(t,m+5,L-1),$i(t,m+10,A-4),m+=14,F=0;A>F;++F)$i(t,m+3*F,z[Hy[F]]);m+=3*A;for(var B=[E,D],Z=0;2>Z;++Z){var M=B[Z];for(F=0;M.length>F;++F)$i(t,m,R[pe=31&M[F]]),m+=z[pe],pe>15&&($i(t,m,M[F]>>>5&127),m+=M[F]>>>12)}}else ie=L4,K=Aa,G=D4,P=gf;for(F=0;f>F;++F)if(r[F]>255){var pe;Zo(t,m,ie[257+(pe=r[F]>>>18&31)]),m+=K[pe+257],pe>7&&($i(t,m,r[F]>>>23&31),m+=xx[pe]);var _e=31&r[F];Zo(t,m,G[_e]),m+=P[_e],_e>3&&(Zo(t,m,r[F]>>>5&8191),m+=vx[_e])}else Zo(t,m,ie[r[F]]),m+=K[r[F]];return Zo(t,m,ie[256]),m+K[256]},z4=new Hl([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),O4=(function(){for(var e=new Hl(256),t=0;256>t;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e})(),mm=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function B4(e,t){t===void 0&&(t={});var n=(function(){var x=4294967295;return{p(b){for(var y=x,_=0;b.length>_;++_)y=O4[255&y^b[_]]^y>>>8;x=y},d(){return 4294967295^x}}})(),r=e.length;n.p(e);var a,o,u,f,h,p=(f=10+((a=t).filename&&a.filename.length+1||0),h=8,(function(x,b,y,_,j,N){var S=x.length,E=new qr(_+S+5*(1+Math.floor(S/7e3))+j),C=E.subarray(_,E.length-j),O=0;if(!b||8>S)for(var D=0;S>=D;D+=65535){var L=D+65535;S>L?O=Lg(C,O,x.subarray(D,L)):(C[D]=!0,O=Lg(C,O,x.subarray(D,S)))}else{for(var I=z4[b-1],F=I>>>13,W=8191&I,z=(1<<y)-1,q=new lr(32768),A=new lr(z+1),ie=Math.ceil(y/3),K=2*ie,G=function(pt){return(x[pt]^x[pt+1]<<ie^x[pt+2]<<K)&z},P=new Hl(25e3),$=new lr(288),se=new lr(32),ae=0,R=0,B=(D=0,0),Z=0,M=0;S>D;++D){var pe=G(D),_e=32767&D,Ce=A[pe];if(q[_e]=Ce,A[pe]=_e,D>=Z){var De=S-D;if((ae>7e3||B>24576)&&De>423){O=Gy(x,C,0,P,$,se,R,B,M,D-M,O),B=ae=R=0,M=D;for(var Ee=0;286>Ee;++Ee)$[Ee]=0;for(Ee=0;30>Ee;++Ee)se[Ee]=0}var Be=2,Je=0,Et=W,ft=_e-Ce&32767;if(De>2&&pe==G(D-ft))for(var vt=Math.min(F,De)-1,bt=Math.min(32767,D),wt=Math.min(258,De);bt>=ft&&--Et&&_e!=Ce;){if(x[D+Be]==x[D+Be-ft]){for(var Tt=0;wt>Tt&&x[D+Tt]==x[D+Tt-ft];++Tt);if(Tt>Be){if(Be=Tt,Je=ft,Tt>vt)break;var ve=Math.min(ft,Tt-2),$e=0;for(Ee=0;ve>Ee;++Ee){var rt=D-ft+Ee+32768&32767,rn=rt-q[rt]+32768&32767;rn>$e&&($e=rn,Ce=rt)}}}ft+=(_e=Ce)-(Ce=q[_e])+32768&32767}if(Je){P[B++]=268435456|Mg[Be]<<18|Iy[Je];var je=31&Mg[Be],ze=31&Iy[Je];R+=xx[je]+vx[ze],++$[257+je],++se[ze],Z=D+Be,++ae}else P[B++]=x[D],++$[x[D]]}}O=Gy(x,C,!0,P,$,se,R,B,M,D-M,O)}return b2(E,0,_+v2(O)+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,f,h)),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&&mm(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),mm(p,m-8,n.d()),mm(p,m-4,r),p}var P4=!!ig||!!nx,y2="text/plain",Fd=!1,_2=(e,t)=>{var n=e.split("#"),r=n[1],a=n[0].split("?"),o=a[0],u=a[1];if(!u)return e;var f=u.split("&").filter((h=>h.split("=")[0]!==t)).join("&");return o+(f?"?"+f:"")+(r?"#"+r:"")},Tf=function(e,t,n){var r;n===void 0&&(n=!0);var a=e.split("?"),o=a[0],u=a[1],f=de({},t),h=(r=u==null?void 0:u.split("&").map((m=>{var x,b=m.split("="),y=b[0],_=n&&(x=f[y])!==null&&x!==void 0?x:b[1];return delete f[y],y+"="+_})))!==null&&r!==void 0?r:[],p=(function(m,x){var b,y;x===void 0&&(x="&");var _=[];return St(m,(function(j,N){ge(j)||ge(N)||N==="undefined"||(b=encodeURIComponent((S=>S instanceof File)(j)?j.name:j.toString()),y=encodeURIComponent(N),_[_.length]=y+"="+b)})),_.join(x)})(f);return p&&h.push(p),h.length>0?o+"?"+h.join("&"):o},gm=e=>{if(e.vr)return e.vr;var t=e.data,n=e.compression;if(t){if(n===Yn.GZipJS){var r=B4((function(f,h){var p=f.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(f);for(var m=new qr(f.length+(f.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=f.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&f.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 b2(m,0,x)})(Ml(t)),{mtime:0});return{contentType:y2,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(n===Yn.Base64){var a=(function(f){return f&&btoa(encodeURIComponent(f).replace(/%([0-9A-F]{2})/g,((h,p)=>String.fromCharCode(parseInt(p,16)))))})(Ml(t)),o=(f=>"data="+encodeURIComponent(typeof f=="string"?f:Ml(f)))(a);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var u=Ml(t);return{contentType:"application/json",body:u,estimatedSize:new Blob([u]).size}}},w2=e=>{var t,n,r=()=>e.transport==="sendBeacon"?{url:Tf(e.url,{compression:Yn.Base64}),encodedBody:gm(de({},e,{compression:Yn.Base64,vr:void 0}))}:{url:_2(e.url,"compression"),encodedBody:gm(de({},e,{compression:void 0,vr:void 0}))};try{t=gm(e)}catch(a){if(oy(e.compression,Ul(e.url,"compression")))return ye.error("Failed to gzip request body, sending uncompressed payload",a),r();throw a}return t&&oy(e.compression,Ul(e.url,"compression"))&&!((n=t.body)instanceof ArrayBuffer?sg(new Uint8Array(n)):ArrayBuffer.isView(n)&&sg(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)))?(Fd=!0,r()):{url:e.url,encodedBody:t}},k2=e=>{try{return w2(e)}catch(t){return ye.error(t),void(e.callback==null||e.callback({statusCode:0,error:t}))}},$4=(function(){var e=Pt((function*(t){var n=Ml(t.data),r=yield(function(o,u,f){return ag.apply(this,arguments)})(n,Bt.DEBUG,{rethrow:!0});if(!r)return t;var a=yield r.arrayBuffer();return de({},t,{vr:{contentType:y2,body:a,estimatedSize:a.byteLength}})}));return function(t){return e.apply(this,arguments)}})(),F4=/Failed to fetch|NetworkError|Load failed/i,S2=e=>(e==null?void 0:e.name)==="TypeError"&&F4.test((e==null?void 0:e.message)||""),j2=e=>{var t=k2(e);if(t){var n=t.url,r=t.encodedBody,a=r??{},o=a.contentType,u=a.body,f=a.estimatedSize,h=new Headers;St(e.headers,(function(_,j){h.append(j,_)})),o&&h.append("Content-Type",o);var p=null,m=!1;if(ny){var x=new ny;p={signal:x.signal,timeout:setTimeout((()=>{var _,j;m=!0,x.abort((_=e.timeout,(j=new Error("PostHog request timed out"+(_?" after "+_+"ms":""))).name="AbortError",j))}),e.timeout)}}var b=_=>{m&&(_==null?void 0:_.name)==="AbortError"||S2(_)?ye.warn(_):ye.error(_),e.callback==null||e.callback({statusCode:0,error:_})};try{var y;nx(n,de({method:(e==null?void 0:e.method)||"GET",headers:h,keepalive:e.method==="POST"&&!e.cr&&52428.8>(f||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(S){ye.error(S)}e.callback==null||e.callback(N)})))).catch(b).finally((()=>p?clearTimeout(p.timeout):null))}catch(_){p&&clearTimeout(p.timeout),b(_)}}},Dg=e=>{try{var t,n=w2(e),r=n.url,a=n.encodedBody,o=a??{},u=o.body,f=o.estimatedSize;if(!u)return;var h=u instanceof Blob?u:new Blob([u],{type:o.contentType});if(Qn.sendBeacon(r,h))return;var p=Ie(e.data)?e.data:(t=e.data)==null?void 0:t.batch;if(Ie(p)&&p.length>1&&(f??0)>16384){var m=Math.ceil(p.length/2),x=b=>Ie(e.data)?b:de({},e.data,{batch:b});return Dg(de({},e,{data:x(p.slice(0,m))})),void Dg(de({},e,{data:x(p.slice(m))}))}ye.warn("Beacon of ~"+(f??0)+" bytes was rejected by the browser, falling back to fetch"),j2(de({},e,{cr:!0}))}catch(b){ye.warn("Beacon send failed",b)}},Yy=(e,t,n,r)=>{var a=r==="query"?t==="POST"?"sent_at":"_":void 0;return Tf(n===Yn.GZipJS?_2(e,"compression"):e,de({},a?{[a]:Date.now().toString()}:{},n===Yn.GZipJS?{}:{compression:n}))},Ud=[];nx&&Ud.push({transport:"fetch",method:j2}),ig&&Ud.push({transport:"XHR",method(e){var t=k2(e);if(t){var n=new ig,r=t.encodedBody;n.open(e.method||"GET",t.url,!0);var a=r??{},o=a.contentType,u=a.body;St(e.headers,(function(f,h){n.setRequestHeader(h,f)})),o&&n.setRequestHeader("Content-Type",o),e.timeout&&(n.timeout=e.timeout),n.onreadystatechange=()=>{if(n.readyState===4){var f={statusCode:n.status,text:n.responseText};if(n.status===200)try{f.json=JSON.parse(n.responseText)}catch{}e.callback==null||e.callback(f)}},n.send(u)}}}),Qn!=null&&Qn.sendBeacon&&Ud.push({transport:"sendBeacon",method:Dg});var zg=3e3;class U4{constructor(t,n){this.pr=!0,this.gr=[],this.mr=vi((n==null?void 0:n.flush_interval_ms)||zg,250,5e3,ye.createLogger("flush interval"),zg),this.yr=t}enqueue(t){this.gr.push(t),this.br||this._r()}unload(){this.wr();var t=this.gr.length>0?this.kr():{},n=Object.values(t);[...n.filter((r=>r.url.indexOf("/e")===0)),...n.filter((r=>r.url.indexOf("/e")!==0))].map((r=>{this.Sr(de({},r,{transport:"sendBeacon"}))}))}enable(){this.pr=!1,this._r()}_r(){var t=this;this.pr||(this.br=setTimeout((()=>{if(this.wr(),this.gr.length>0){var n=this.kr(),r=function(){var o=n[a],u=new Date().getTime();o.data&&Ie(o.data)&&St(o.data,(f=>{f.offset=Math.abs(f.timestamp-u),delete f.timestamp})),t.Sr(o)};for(var a in n)r()}}),this.mr))}Sr(t){try{this.yr(t)}catch(n){ye.error(n)}}wr(){clearTimeout(this.br),this.br=void 0}kr(){var t={};return St(this.gr,(n=>{var r,a=n,o=(a?a.batchKey:null)||a.url;ge(t[o])&&(t[o]=de({},a,{data:[]})),(r=t[o].data)==null||r.push(a.data)})),this.gr=[],t}}var q4=["retriesPerformedSoFar"];class H4{constructor(t){this.Cr=!1,this.Mr=3e3,this.gr=[],this._instance=t,this.gr=[],this.Tr=!0,!ge(re)&&"onLine"in re.navigator&&(this.Tr=re.navigator.onLine,this.Er=()=>{this.Tr=!0,this.Ir()},this.Pr=()=>{this.Tr=!1},Xt(re,"online",this.Er),Xt(re,"offline",this.Pr))}get length(){return this.gr.length}retriableRequest(t){var n=t.retriesPerformedSoFar,r=X5(t,q4);Hi(n)&&(r.url=Tf(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.Ot(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)}}))}Ot(t){var n=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=n+1;var r=(function(u){var f=3e3*Math.pow(2,u),h=f/2,p=Math.min(18e5,f),m=Math.random()-.5;return Math.ceil(p+m*(p-h))})(n),a=Date.now()+r;this.gr.push({retryAt:a,requestOptions:t});var o="Enqueued failed request for retry in "+r;navigator.onLine||(o+=" (Browser is offline)"),ye.warn(o),this.Cr||(this.Cr=!0,this.Rr())}Rr(){if(this.Ar&&clearTimeout(this.Ar),this.gr.length===0)return this.Cr=!1,void(this.Ar=void 0);this.Ar=setTimeout((()=>{this.Tr&&this.gr.length>0&&this.Ir(),this.Rr()}),this.Mr)}Ir(){var t=Date.now(),n=[],r=this.gr.filter((o=>t>o.retryAt||(n.push(o),!1)));if(this.gr=n,r.length>0)for(var a of r)this.retriableRequest(a.requestOptions)}unload(){for(var t of(this.Ar&&(clearTimeout(this.Ar),this.Ar=void 0),this.Cr=!1,ge(re)||(this.Er&&(re.removeEventListener("online",this.Er),this.Er=void 0),this.Pr&&(re.removeEventListener("offline",this.Pr),this.Pr=void 0)),this.gr)){var n=t.requestOptions;try{this._instance._send_request(de({},n,{transport:"sendBeacon"}))}catch(r){ye.error(r)}}this.gr=[]}}class I4{constructor(t){this.Fr=()=>{var n,r,a,o;this.Or||(this.Or={});var u=this.scrollElement(),f=this.scrollY(),h=u?Math.max(0,u.scrollHeight-u.clientHeight):0,p=f+((u==null?void 0:u.clientHeight)||0),m=(u==null?void 0:u.scrollHeight)||0;this.Or.lastScrollY=Math.ceil(f),this.Or.maxScrollY=Math.max(f,(n=this.Or.maxScrollY)!==null&&n!==void 0?n:0),this.Or.maxScrollHeight=Math.max(h,(r=this.Or.maxScrollHeight)!==null&&r!==void 0?r:0),this.Or.lastContentY=p,this.Or.maxContentY=Math.max(p,(a=this.Or.maxContentY)!==null&&a!==void 0?a:0),this.Or.maxContentHeight=Math.max(m,(o=this.Or.maxContentHeight)!==null&&o!==void 0?o:0)},this._instance=t}get Lr(){return this._instance.config.scroll_root_selector}getContext(){return this.Or}resetContext(){var t=this.Or;return setTimeout(this.Fr,0),t}startMeasuringScrollPosition(){Xt(re,"scroll",this.Fr,{capture:!0}),Xt(re,"scrollend",this.Fr,{capture:!0}),Xt(re,"resize",this.Fr)}scrollElement(){if(!this.Lr)return re==null?void 0:re.document.documentElement;var t=Ie(this.Lr)?this.Lr:[this.Lr];for(var n of t){var r=re==null?void 0:re.document.querySelector(n);if(r)return r}}Dr(t){var n=t==="y"?"scrollTop":"scrollLeft";if(this.Lr){var r=this.scrollElement();return r&&r[n]||0}return re?t==="y"?re.scrollY||re.pageYOffset||re.document.documentElement.scrollTop||0:re.scrollX||re.pageXOffset||re.document.documentElement.scrollLeft||0:0}scrollY(){return this.Dr("y")}scrollX(){return this.Dr("x")}}var V4=e=>d2(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 Wy{constructor(t,n,r,a){this.$r=o=>{var u=this.Nr();if(!u||u.sessionId!==o){var f={sessionId:o,props:this.qr(this._instance)};this.jr.register({[wg]:f})}},this._instance=t,this.Br=n,this.jr=r,this.qr=a||V4,this.Br.onSessionId(this.$r)}Nr(){return this.jr.props[wg]}getSetOnceProps(){var t,n=(t=this.Nr())==null?void 0:t.props;return n?"r"in n?f2(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 St(hx(this.getSetOnceProps()),((n,r)=>{r==="$current_url"&&(r="url"),t["$session_entry_"+lg(r)]=n})),t}}class bx{on(t,n){return this.Hr[t]||(this.Hr[t]=[]),this.Hr[t].push(n),()=>{this.Hr[t]=this.Hr[t].filter((r=>r!==n))}}emit(t,n){for(var r of this.Hr[t]||[])r(n);for(var a of this.Hr["*"]||[])a(t,n)}constructor(){this.Hr={}}}var wl=Vt("[SessionId]"),Qy=864e5;class Xy{on(t,n){return this.Ur.on(t,n)}constructor(t,n,r){var a;if(this.zr=null,this.Wr=null,this.Vr=[],this.Zr=void 0,this.Gr=!1,this.Ur=new bx,this.Qr=(h,p)=>!(!Hi(h)||!Hi(p))&&Math.abs(h-p)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===Wi)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.qe=t.config,this.jr=t.persistence,this.Jr=void 0,this.Kr=void 0,this._sessionStartTimestamp=null,this.Yr=void 0,this._sessionActivityTimestamp=null,this.Xr=n||Gi,this.tn=r||Gi;var o=this.qe.persistence_name||this.qe.token;if(this._sessionTimeoutMs=1e3*vi(this.qe.session_idle_timeout_seconds||1800,60,36e3,wl.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.en(),this.rn="ph_"+o+"_window_id",this.nn="ph_"+o+"_primary_window_exists",this.sn()){var u=Lt.H(this.rn),f=Lt.H(this.nn);u&&!f?this.Jr=u:Lt.q(this.rn),Lt.F(this.nn,!0)}(a=this.qe.bootstrap)!=null&&a.sessionID&&this.setBootstrapSessionId(this.qe.bootstrap.sessionID),this.an()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return ge(this.Vr)&&(this.Vr=[]),this.Vr.push(t),this.Kr&&t(this.Kr,this.Jr),()=>{this.Vr=this.Vr.filter((n=>n!==t))}}sn(){return this.qe.persistence!=="memory"&&!this.jr.Oi&&Lt.N()}ln(t){t!==this.Jr&&(this.Jr=t,this.sn()&&Lt.F(this.rn,t))}un(){return this.Jr?this.Jr:this.sn()?Lt.H(this.rn):null}hn(t){var n=this.zr;return!jn(n)&&!jn(t)&&5e3>Math.abs(t-n)}dn(t,n,r){var a=n!==this._sessionActivityTimestamp,o=!(t!==this.Kr||r!==this._sessionStartTimestamp);this._sessionStartTimestamp=r,this._sessionActivityTimestamp=n,this.Kr=t,o&&!a||o&&this.hn(n)||(this.zr=n,this.jr.register({[Al]:[n,t,r]}))}vn(){var t,n=(t=this.qe)==null?void 0:t.persistence_save_debounce_ms;return Hi(n)&&n>0}cn(){this.vn()?this.jr.refreshKey(Al):(this.jr.flush(),this.jr.load())}fn(){var t;if(!jn(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.zr){this.cn();var n=this.pn();n[1]===this.Kr&&n[2]===this._sessionStartTimestamp&&(this.zr=this._sessionActivityTimestamp,this.jr.register({[Al]:[this._sessionActivityTimestamp,(t=this.Kr)!==null&&t!==void 0?t:null,this._sessionStartTimestamp]}),this.jr.flush())}}gn(){var t=this.pn()[0],n=Hi(t)?t:0,r=Hi(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(n,r)}mn(t){return this.cn(),this.Qr(t,this.gn())}pn(){var t=this.jr.props[Al];return Ie(t)&&t.length===2&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.zr=null,this.Yr=void 0,clearTimeout(this.yn),this.yn=void 0,this.dn(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=(f=>{var h=f.replace(/-/g,"");if(h.length!==32)throw new Error("Not a valid UUID");if(h[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(h.substring(0,12),16)})(a);return u>o+6e4?void wl.error("Bootstrap sessionID cannot be in the future"):u}catch(f){return void wl.error("Invalid sessionID in bootstrap",f)}})(t);return!ge(r)&&(n?this.Yr={sessionId:t,sessionStartTimestamp:r}:this.dn(t,new Date().getTime(),r),!0)}destroy(){this.Gr=!0,this.fn(),clearTimeout(this.yn),this.yn=void 0,this.Zr&&re&&(re.removeEventListener(uf,this.Zr,{capture:!1}),this.Zr=void 0),this.Vr=[]}an(){this.Zr=()=>{this.fn(),this.sn()&&Lt.q(this.nn)},Xt(re,uf,this.Zr,{capture:!1})}checkAndGetSessionAndWindowId(t,n,r){if(t===void 0&&(t=!1),n===void 0&&(n=null),r===void 0&&(r=!1),this.qe.cookieless_mode===Wi)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var a=n||new Date().getTime(),o=this.Kr;if(r)this.Wr=a;else if(jn(this.Wr)||this.Wr>a||a-this.Wr>=1e3){var u,f;(u=(f=this.jr).syncCookieProperties)==null||u.call(f),this.Wr=a}var h=this.pn(),p=h[1],m=h[2],x=!ge(o)&&p!==o,b=this.gn(),y=this.un(),_=this.Yr,j=!!_&&(_.sessionStartTimestamp>a+6e4||a-_.sessionStartTimestamp>Qy),N=_?j:Hi(m)&&Math.abs(a-m)>Qy,S=!1,E=x,C=!p||!!_,O=p,D=!C&&!t&&this.Qr(a,b);if(D){(D=this.mn(a))||wl.info("cross-tab refresh kept the session alive",{sessionId:p});var L=this.pn();p=L[1],m=L[2]}if(C||D||N){E=!1;var I=_&&!j;p=I?_.sessionId:this.Xr(),y=this.tn(),wl.info("new session ID assigned",{sessionId:p,windowId:y,bootstrapped:!!I,changeReason:{noSessionId:C,activityTimeout:D,sessionPastMaximumLength:N}}),m=I?_.sessionStartTimestamp:a,this.Yr=void 0,S=!0}else y||(y=this.tn(),S=!0),(E=E||p!==O)&&(wl.info("adopted cross-tab session id",{sessionId:p,windowId:y}),S=!0);var F=Hi(b)&&t&&!N?b:a,W=Hi(m)?m:new Date().getTime();this.ln(y),this.dn(p,F,W),t||this.en();var z={noSessionId:C,activityTimeout:D,sessionPastMaximumLength:N,crossTabAdoption:E};return S&&this.Vr.forEach((q=>q(p,y,z))),{sessionId:p,windowId:y,sessionStartTimestamp:W,changeReason:S?z:void 0,lastActivityTimestamp:b}}en(){this.Gr||(clearTimeout(this.yn),this.yn=setTimeout((()=>{if(!this.Gr)if(this.mn(new Date().getTime())){var t=this.Kr;this.resetSessionId(),this.Ur.emit("forcedIdleReset",{idleSessionId:t})}else this.en()}),1.1*this.sessionTimeoutMs))}}var N2=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&uy(n,t))return!0;try{var r=e==null?void 0:e.userAgentData;if(r!=null&&r.brands&&r.brands.some((a=>uy(a==null?void 0:a.brand,t))))return!0}catch{}return!!e.webdriver};function C2(){return(C2=Pt((function*(){var e=Qn==null?void 0:Qn.userAgentData;if(e!=null&&e.getHighEntropyValues)try{var t=yield e.getHighEntropyValues(["model"]),n=t==null?void 0:t.model;return gt(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)}var xf=function(e,t){if(!(function(n){try{new RegExp(n)}catch{return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}};function xm(e,t,n){return Ml({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}var E2={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=>xf(n,r))))),not_regex:(e,t)=>t.every((n=>e.every((r=>!xf(n,r))))),icontains:(e,t)=>t.map(_d).some((n=>e.map(_d).some((r=>n.includes(r))))),not_icontains:(e,t)=>t.map(_d).every((n=>e.map(_d).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)))}))},_d=e=>e.toLowerCase();function T2(e,t){return!e||Object.entries(e).every((n=>{var r=n[1],a=t==null?void 0:t[n[0]];if(ge(a)||jn(a))return!1;var o=[String(a)],u=E2[r.operator];return!!u&&u(r.values,o)}))}var Og="custom",Ky="i.posthog.com",G4=/^\/static\//,Y4=["/s/","/e/","/i/"];class W4{constructor(t){this.bn={},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("."+Ky,".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this.bn[this.apiHost]||(this.bn[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":Og),this.bn[this.apiHost]}_n(t){if(G4.test(t)){var n=this.instance.config.asset_host;if(typeof n=="string")return n.trim().replace(/\/$/,"")||void 0}}wn(t){var n=Fl(t);return n?n.protocol+"//"+n.host+n.pathname:void 0}kn(t,n,r){if(t==="ui")return r;var a=r,o=this.instance.config.rewriteRequestPath;if(o){var u,f=((u=Fl(r))==null?void 0:u.href)||r;a=o(new URL(f)).toString()}if(o&&t==="api"&&Y4.some((b=>n.indexOf(b)===0))){var h=this.wn(a);if(h){var p,m=this.apiHost,x=this.xn;((p=x)==null?void 0:p.apiHost)===m&&x.rewriteRequestPath===o||(x={apiHost:m,rewriteRequestPath:o,urls:new Set},this.xn=x),x.urls.add(h)}}return a}isIngestionEndpoint(t){var n=this.xn,r=this.wn(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.kn(t,n,this.uiHost+n);if(t==="flags")return this.kn(t,n,this.flagsApiHost+n);if(t==="assets"){var r=this._n(n);if(r)return this.kn(t,n,""+r+n)}if(this.region===Og)return this.kn(t,n,this.apiHost+n);var a=Ky+n;switch(t){case"assets":return this.kn(t,n,"https://"+this.region+"-assets."+a);case"api":return this.kn(t,n,"https://"+this.region+"."+a)}}}function A2(e){var t;return!((t=e.conditions)==null||(t=t.events)==null||(t=t.values)==null||!t.length)}var Nt=Vt("[Surveys]"),M2="seenSurvey_",R2=e=>{try{var t=(n=>((r,a)=>""+M2+(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){Nt.error("Failed to persist survey seen state",n)}},Q4=[fm.Popover,fm.Widget,fm.API],X4={ignoreConditions:!1,ignoreDelay:!1,displayType:Ag.Popover},K4=Vt("[PostHog ExternalIntegrations]"),Z4={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class J4{constructor(t){this._instance=t}di(t,n){var r;(r=Oe.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,t,(a=>{if(a)return K4.error("failed to load script",a);n()}))}startIfEnabledOrStop(){var t=this,n=function(){var o,u,f,h=r[0],p=r[1];!p||(o=Oe.__PosthogExtensions__)!=null&&(o=o.integrations)!=null&&o[h]||t.di(Z4[h],(()=>{var m;(m=Oe.__PosthogExtensions__)==null||(m=m.integrations)==null||(m=m[h])==null||m.start(t._instance)})),!p&&(u=Oe.__PosthogExtensions__)!=null&&(u=u.integrations)!=null&&u[h]&&((f=Oe.__PosthogExtensions__)==null||(f=f.integrations)==null||(f=f[h])==null||f.stop())};for(var r of Object.entries((a=this._instance.config.integrations)!==null&&a!==void 0?a:{})){var a;n()}}}class eE{constructor(t,n){this.st=t,this.Sn=n,this.Cn=new Map,this.Mn=!1}add(t){var n=this;return Pt((function*(){if(n.Mn)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(n.Cn.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');n.Cn.set(t.name,t);try{var r=t.setup(n.Sn);r&&(yield r)}catch(o){var a=n.Cn.get(t.name)===t;a&&n.Cn.delete(t.name),n.st.error('Failed to set up browser extension "'+t.name+'"',o),a&&n.Tn(t)}}))()}dispose(){if(!this.Mn){this.Mn=!0;var t=Array.from(this.Cn.values()).reverse();for(var n of(this.Cn.clear(),t))this.Tn(n)}}Tn(t){try{var n=t.dispose==null?void 0:t.dispose();n&&Gn(n.then)&&n.then(void 0,(r=>{this.st.error('Failed to dispose browser extension "'+t.name+'"',r)}))}catch(r){this.st.error('Failed to dispose browser extension "'+t.name+'"',r)}}}class tE{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);ge(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 Zy="extensionsRemoteConfig";class nE{constructor(t){this.Mn=!1,this.instance=t,this.st=ye,this.En=t.In,this.kv=new tE(t),this.onEvent=n=>yd(this.instance.on("eventCaptured",(r=>{try{n({event:r.event,properties:r.properties})}catch(a){this.st.error("Browser extension event listener failed",a)}}))),this.onRemoteConfig=n=>{if(this.Mn)return yd((()=>{}));var r=o=>{try{n(o)}catch(u){this.st.error("Browser extension remote config listener failed",u)}},a=this.instance.Pn.on(Zy,r);return this.En&&r(this.En),yd(a)},this.Rn=new eE(ye.createLogger("[BrowserExtensions]"),this)}get logger(){return this.st}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return(t=this.instance.get_property(Ac))!==null&&t!==void 0?t:this.distinctId}get deviceId(){var t=this.instance.get_property(Ac);return typeof t=="string"?t:void 0}get library(){return{name:Bt.LIB_NAME,version:Bt.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 projectToken(){return this.instance.config.token}add(t){return this.Rn.add(t)}capture(t,n,r){var a=this;return Pt((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 yd(this.instance.An(t))}handleRemoteConfig(t){this.Mn||(this.En=t,this.instance.Pn.emit(Zy,t))}sendRequest(t,n){var r=this;return Pt((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?Tf(o,n.query):o,data:n.body,headers:n.headers,timeout:n.timeoutMs,fireCallbackOnDrop:!0,transport:n.transport,compression:n.compression,timestampMode:n.sentAt};return n.transport==="sendBeacon"?(r.instance._send_request(u),{statusCode:202}):new Promise((f=>{u.callback=f,r.instance._send_request(u)}))}))()}dispose(){this.Mn||(this.Mn=!0,this.Rn.dispose())}}var yc={},vm=0,vf=()=>{},Jy='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',ec="Surveys module not available",e_="sanitize_properties is deprecated. Use before_send instead",L2="Invalid value for property_denylist config: ",rE=["token","distinct_id",$w],Cl="posthog",D2=!P4&&(ar==null?void 0:ar.indexOf("MSIE"))===-1&&(ar==null?void 0:ar.indexOf("Mozilla"))===-1,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:r4(Se==null?void 0:Se.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:vf,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:Qt&&gt(Qt==null?void 0:Qt.search)&&Qt.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,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:(re==null||(t=re.location)==null?void 0:t.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(n){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:Ng,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:zg},error_tracking:{},_onCapture:vf},(n=>({rageclick:n&&n>="2026-05-30"?{content_ignorelist:m4,ignore_text_selection:!0}:!n||"2025-11-30">n||{content_ignorelist:!0},capture_pageview:!n||"2025-05-24">n||"history_change",session_recording:n&&n>="2026-06-25"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6},streamNetworkBody:!0}:n&&n>="2026-05-30"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6}}:n&&n>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:n&&n>="2026-01-30"?"head":"body",internal_or_test_user_hostname:n&&n>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,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))},iE=[["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"]],t_=e=>{var t={};for(var n of iE){var r=n[0],a=n[1];ge(e[r])||(t[a]=e[r])}var o=Rt({},t,e),u=e.__preview_external_dependency_versioned_paths;return ge(u)||(ge(e.strict_script_versioning)&&(o.strict_script_versioning=!!u),gt(u)&&ge(e.asset_host)&&(o.asset_host=u)),Ie(e.property_blacklist)&&(ge(e.property_denylist)?o.property_denylist=e.property_blacklist:Ie(e.property_denylist)?o.property_denylist=[...e.property_blacklist,...e.property_denylist]:ye.error(L2+e.property_denylist)),o};class sE{constructor(){this.__forceAllowLocalhost=!1}get Fn(){return this.__forceAllowLocalhost}set Fn(t){ye.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class br{On(t,n){if(t){var r=this.Cn.indexOf(t);r!==-1&&this.Cn.splice(r,1)}return this.Cn.push(n),n.initialize==null||n.initialize(),n}Ln(){return this.config.cookieless_mode===Wi||this.config.cookieless_mode===_a&&this.consent.isRejected()}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 sE,this.Dn=!1,this.version=Bt.LIB_VERSION,this.$n=new Set,this.Nn="",this.Pn=new bx,this.Cn=[],this.qn=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=bm(),this.SentryIntegration=k4,this.sentryIntegration=r=>(function(a,o){var u=i2(a,o);return{name:r2,processEvent:f=>u(f)}})(this,r),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.jn=!1,this.Bn=null,this.Hn=null,this.Un=null,this.scrollManager=new I4(this),this.pageViewManager=new Py(this),this.rateLimiter=new R4(this),this.requestRouter=new W4(this),this.consent=new u4(this),this.externalIntegrations=new J4(this);var n=(t=br.__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=gt(r)?{[r]:a}:r;this.setPersonProperties(u),o==null||o({})},set_once:(r,a,o)=>{var u=gt(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!==Cl){var a,o=(a=yc[r])!==null&&a!==void 0?a:new br;return o._init(t,n,r),yc[r]=o,yc[Cl][r]=o,o}return this._init(t,n,r)}_init(t,n,r){var a,o;n===void 0&&(n={});var u,f=gt(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!==((u=this.config)==null?void 0:u.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.zn(n.debug),this.Wn=n,this.Vn=[],n.person_profiles?this.Hn=n.person_profiles:n.process_person&&(this.Hn=n.process_person);var h=bm(n.defaults),p=t_(n),m=Rt({},h,p,{name:r,token:f});Ut(h.rageclick)&&Ut(p.rageclick)&&(m.rageclick=Rt({},h.rageclick,p.rageclick)),Ut(h.session_recording)&&Ut(p.session_recording)&&(m.session_recording=Rt({},h.session_recording,p.session_recording)),this.set_config(m),this.config.on_xhr_error&&ye.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:Yn.GZipJS;var x=this.Zn();if(this.persistence=new dm(this.config,x),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new dm(de({},this.config,{persistence:"sessionStorage"}),x,!1),this.Nn="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties",this.config.persistence!=="memory"&&!x&&Lt.N()){var b=Lt.H(this.Nn);Ie(b)&&b.forEach((L=>{gt(L)&&this.$n.add(L)}))}else Lt.q(this.Nn);var y=de({},this.persistence.props),_=de({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Gn=new U4((L=>this.Qn(L)),this.config.request_queue_config),this.Jn=new H4(this),this.__request_queue=[];var j=this.Ln();if(j||(this.sessionManager=new Xy(this),this.sessionPropsManager=new Wy(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId(((L,I,F)=>{(F!=null&&F.activityTimeout||F!=null&&F.sessionPastMaximumLength||F!=null&&F.crossTabAdoption)&&this.Kn()}))),this.Yn(),this.config.__preview_deferred_init_extensions?(ye.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Xn(j)}),0)):(ye.info("Initializing extensions synchronously"),this.Xn(j)),Bt.DEBUG=Bt.DEBUG||this.config.debug,Bt.DEBUG&&ye.info("Starting in debug mode",{this:this,config:n,thisC:de({},this.config),p:y,s:_}),!this.config.identity_distinct_id||(a=n.bootstrap)!=null&&a.distinctID||(n.bootstrap=de({},n.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((o=n.bootstrap)==null?void 0:o.distinctID)!==void 0){var N=n.bootstrap.distinctID,S=this.get_distinct_id(),E=this.persistence.get_property(nt);if(n.bootstrap.isIdentifiedID&&S!=null&&S!==N&&E===fn)this.identify(N);else if(n.bootstrap.isIdentifiedID&&S!=null&&S!==N&&E===Mn)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 C=this.config.get_device_id(Gi()),O=n.bootstrap.isIdentifiedID?C:N;this.persistence.set_property(nt,n.bootstrap.isIdentifiedID?Mn:fn),this.register({distinct_id:N,$device_id:O})}}if(j)this.register_once({distinct_id:pd,$device_id:null},"");else if(!this.get_distinct_id()){var D=this.config.get_device_id(Gi());this.register_once({distinct_id:D,$device_id:D},""),this.persistence.set_property(nt,fn)}return Xt(re,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),n.segment?(function(L,I){var F=L.config.segment;if(!F)return I();(function(W,z){var q=W.config.segment;if(!q)return z();var A=K=>{var G=()=>K.anonymousId()||Gi();W.config.get_device_id=G,K.id()&&(W.register({distinct_id:K.id(),$device_id:G()}),W.persistence.set_property(nt,Mn)),z()},ie=q.user();"then"in ie&&Gn(ie.then)?ie.then(A):A(ie)})(L,(()=>{F.register((W=>{typeof Promise<"u"&&Promise.resolve||cm.warn("This browser does not have Promise support, and can not use the segment integration");var z=(q,A)=>{if(!A)return q;q.event.userId||q.event.anonymousId===W.get_distinct_id()||(cm.info("No userId set, resetting PostHog"),W.reset()),q.event.userId&&q.event.userId!==W.get_distinct_id()&&(cm.info("UserId set, identifying with PostHog"),W.identify(q.event.userId));var ie=W.calculateEventProperties(A,q.event.properties);return q.event.properties=Object.assign({},ie,q.event.properties),q};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:q=>z(q,q.event.event),page:q=>z(q,Nl),identify:q=>z(q,nm),screen:q=>z(q,"$screen")}})(L)).then((()=>{I()}))}))})(this,(()=>this.ts())):this.ts(),Gn(this.config._onCapture)&&this.config._onCapture!==vf&&(ye.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(L=>this.config._onCapture(L.event,L)))),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 C2.apply(this,arguments)})().then((L=>{L&&this.register({[em]:L})})).catch(vf),this}Yn(){var t,n,r,a,o,u,f=(t=(n=this.config.__extensionClasses)==null?void 0:n.featureFlags)!==null&&t!==void 0?t:(r=br.__defaultExtensionClasses)==null?void 0:r.featureFlags;f&&(this.featureFlags&&this.featureFlags instanceof f||((a=this.es)==null||a.call(this),this.es=void 0,this.featureFlags=new f(this)),Gn(this.featureFlags.onReloading)&&Gn(this.featureFlags.setup)?this.es||(this.es=this.featureFlags.onReloading((()=>{this.Pn.emit("featureFlagsReloading",!0)})),this.rs().add(this.featureFlags)):(o=(u=this.featureFlags).initialize)==null||o.call(u))}Xn(t){var n,r,a,o,u,f,h,p=performance.now(),m=de({},br.__defaultExtensionClasses,this.config.__extensionClasses),x=[];m.exceptions&&this.Cn.push(this.exceptions=(n=this.exceptions)!==null&&n!==void 0?n:new m.exceptions(this)),m.historyAutocapture&&this.Cn.push(this.historyAutocapture=new m.historyAutocapture(this)),m.tracingHeaders&&this.Cn.push(this.tracingHeaders=new m.tracingHeaders(this)),m.siteApps&&this.Cn.push(this.siteApps=new m.siteApps(this)),m.sessionRecording&&!t&&this.Cn.push(this.sessionRecording=new m.sessionRecording(this)),this.config.disable_scroll_properties||x.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),m.autocapture&&this.Cn.push(this.autocapture=new m.autocapture(this)),m.surveys&&this.Cn.push(this.surveys=(r=this.surveys)!==null&&r!==void 0?r:new m.surveys(this)),m.logs&&this.Cn.push(this.logs=(a=this.logs)!==null&&a!==void 0?a:new m.logs(this)),m.metrics&&this.Cn.push(this.metrics=(o=this.metrics)!==null&&o!==void 0?o:new m.metrics(this)),m.conversations&&this.Cn.push(this.conversations=(u=this.conversations)!==null&&u!==void 0?u:new m.conversations(this)),m.productTours&&this.Cn.push(this.productTours=new m.productTours(this)),m.heatmaps&&this.Cn.push(this.heatmaps=new m.heatmaps(this)),m.webVitalsAutocapture&&this.Cn.push(this.webVitalsAutocapture=new m.webVitalsAutocapture(this)),m.exceptionObserver&&this.Cn.push(this.exceptionObserver=new m.exceptionObserver(this)),m.deadClicksAutocapture&&this.Cn.push(this.deadClicksAutocapture=new m.deadClicksAutocapture(this,w4)),m.toolbar&&this.Cn.push(this.toolbar=(f=this.toolbar)!==null&&f!==void 0?f:new m.toolbar(this)),m.experiments&&this.Cn.push(this.experiments=(h=this.experiments)!==null&&h!==void 0?h:new m.experiments(this)),this.Cn.forEach((b=>{b.initialize&&x.push((()=>{b.initialize==null||b.initialize()}))})),x.push((()=>{if(this.ns){var b=this.ns;this.ns=void 0,this.Cn.forEach((y=>y.onRemoteConfig==null?void 0:y.onRemoteConfig(b)))}})),this.ss(x,p)}ss(t,n){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-n>=30&&t.length>0)return void setTimeout((()=>{this.ss(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({[Fw]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Uw]:a}),this.config.__preview_deferred_init_extensions&&ye.info("PostHog extensions initialized ("+a+"ms)")}lr(t){var n;if(!Se||!Se.body)return ye.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.lr(t)}),500);if(this.config.__preview_deferred_init_extensions&&(this.ns=t),this.In=t,this.compression=void 0,t.ok){var r,a=t.config;a.supportedCompression&&!this.config.disable_compression&&(this.compression=Ve(a.supportedCompression,Yn.GZipJS)?Yn.GZipJS:Ve(a.supportedCompression,Yn.Base64)?Yn.Base64:void 0),(r=a.analytics)!=null&&r.endpoint&&(this.analyticsDefaultEndpoint=a.analytics.endpoint)}this.set_config({person_profiles:this.Hn?this.Hn:Ng}),(n=this.os)==null||n.handleRemoteConfig(t),this.Cn.forEach((o=>o.onRemoteConfig==null?void 0:o.onRemoteConfig(t)))}ts(){try{this.config.loaded(this)}catch(r){ye.critical("`loaded` function failed",r)}if(this.ls(),this.config.internal_or_test_user_hostname&&Qt!=null&&Qt.hostname){var t=Qt.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.Ln())&&this.us()}),1),this.hs=new p2(this),this.hs.load()}ls(){var t;this.is_capturing()&&this.config.request_batching&&((t=this.Gn)==null||t.enable())}_dom_loaded(){this.is_capturing()&&md(this.__request_queue,(t=>this.Qn(t))),this.__request_queue=[],this.ls()}_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.ds()&&this.capture(tm),(r=this.logs)==null||r.flushLogs("sendBeacon"),(a=this.Gn)==null||a.unload(),(o=this.Jn)==null||o.unload()):this.ds()&&this.capture(tm,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded?D2?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"?this.compression:t.compression,(ge(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(n=>{var r,a,o,u=de({},n);u.timeout=u.timeout||6e4;var f,h,p,m,x,b=(r=u.transport)!==null&&r!==void 0?r:"fetch";b==="sendBeacon"&&ge(u.compression)&&u.data&&(u.compression=Yn.Base64),u.method==="POST"&&u.data&&(u.timestampMode==="capture-body"?u.data={api_key:(h=(x=(m=(Ie(f=u.data)?f:[f]).map((N=>de({},N,N.timestamp instanceof Date&&!isNaN(N.timestamp.getTime())?{timestamp:N.timestamp.toISOString()}:{}))))[0])==null||(p=x.properties)==null?void 0:p.token)!==null&&h!==void 0?h:x==null?void 0:x.token,batch:m,sent_at:new Date().toISOString()}:u.timestampMode==="body"&&(u.data=(function(N,S){return S===void 0&&(S=new Date().toISOString()),Ie(N)?N.map((E=>de({},E,{sent_at:S}))):de({},N,{sent_at:S})})(u.data))),u.url=Yy(u.url,u.method,u.compression,u.timestampMode);var y=Ud.filter((N=>!u.disableTransport||!N.transport||!u.disableTransport.includes(N.transport))),_=(a=(o=(function(N,S){for(var E=0;N.length>E;E++)if(N[E].transport===b)return N[E]})(y))==null?void 0:o.method)!==null&&a!==void 0?a:y[0].method;if(!_)throw new Error("No available transport method");var j=N=>{try{_(N)}catch(S){S2(S)?ye.warn(S):ye.error(S),u.callback==null||u.callback({statusCode:0,error:S})}};b!=="sendBeacon"&&u.data&&u.compression===Yn.GZipJS&&a3&&typeof Promise<"u"&&!Fd?$4(u).then((N=>{j(N)})).catch((N=>{if(cy(N))return Fd=!0,void j(de({},u,{compression:void 0,url:Yy(n.url,n.method,void 0,n.timestampMode)}));(S=>{if(!S||typeof S!="object")return!1;var E="name"in S?String(S.name):"";return cy(S)||E===K5})(N)&&(Fd=!0),j(u)})):_(u)})(de({},t,{callback:n=>{var r,a;this.rateLimiter.checkForLimiting(n),400>n.statusCode||(r=(a=this.config).on_request_error)==null||r.call(a,n),t.callback==null||t.callback(n)}}))):t.fireCallbackOnDrop&&(t.callback==null||t.callback({statusCode:0}))}Qn(t){this.Jn?this.Jn.retriableRequest(t):this._send_request(t)}_execute_array(t){vm++;try{var n,r=[],a=[],o=[];md(t,(f=>{if(f)if(Ie(n=f[0]))o.push(f);else if(Gn(f))try{f.call(this)}catch(h){ye.error("Error executing queued PostHog call",f,h)}else Ie(f)&&n==="alias"?r.push(f):Ie(f)&&n.indexOf("capture")!==-1&&Gn(this[n])?o.push(f):a.push(f)}));var u=function(f,h){md(f,(function(p){try{if(Ie(p[0])){var m=h;St(p,(function(x){m=m[x[0]].apply(m,x.slice(1))}))}else h[p[0]].apply(h,p.slice(1))}catch(x){ye.error("Error executing queued PostHog call",p,x)}}))};u(r,this),u(a,this),u(o,this)}finally{vm--}}push(t){if(vm>0&&Ie(t)&&gt(t[0])){var n=br.prototype[t[0]];Gn(n)&&n.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,n,r){var a,o,u,f,h;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Gn){if(this.is_capturing())if(!ge(t)&&gt(t)){var p=!this.config.opt_out_useragent_filter&&this._is_bot();if(!p||this.config.__preview_capture_bot_pageviews){var m=r!=null&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(m==null||!m.isRateLimited){n!=null&&n.$current_url&&!gt(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.vs||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&&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 x=new Date,b=(r==null?void 0:r.timestamp)||x,y=py(r==null?void 0:r.uuid,Gi),_={uuid:y,event:t,properties:this.calculateEventProperties(t,n||{},b,y)};t===Nl&&this.config.__preview_capture_bot_pageviews&&p&&(_.event="$bot_pageview",_.properties.$browser_type="bot"),m&&(_.properties.$lib_rate_limit_remaining_tokens=m.remainingTokens);var j=t==="$feature_flag_called"&&_.properties.$feature_flag_has_experiment===!1&&this.get_property(sf)===!0;r!=null&&r.$set&&!j&&(_.$set=r==null?void 0:r.$set);var N=r==null?void 0:r.$unset;N&&(_.$unset=N);var S,E,C,O=j?void 0:this.cs(r==null?void 0:r.$set_once,t!==_y,t===nm);if(O&&(_.$set_once=O),r!=null&&r._noTruncate||(o=this.config.properties_string_max_length,u=_,f=A=>gt(A)?A.slice(0,o):A,h=new Set,_=(function A(ie,K){if(ie!==Object(ie))return f?f(ie):ie;if(!h.has(ie)){var G;if(h.add(ie),Ie(ie))G=[],md(ie,($=>{G.push(A($))}));else{var P={};St(ie,(($,se)=>{h.has($)||(P[se]=A($))})),G=P}return G}})(u)),_.timestamp=b,ge(r==null?void 0:r.timestamp)||(_.properties.$event_time_override_provided=!0,_.properties.$event_time_override_system_time=x),j&&(_.properties=(function(A,ie){ie===void 0&&(ie=[]);var K={},G=P=>{A[P]!==void 0&&(K[P]=A[P])};return l3.forEach(G),ie.forEach(G),K})(_.properties,rE)),t===Qi.DISMISSED||t===Qi.SENT){var D=n==null?void 0:n[hm.SURVEY_ID],L=n==null?void 0:n[hm.SURVEY_ITERATION];R2({id:D,current_iteration:L}),_.$set=de({},_.$set,{[(S={id:D,current_iteration:L},E=t===Qi.SENT?"responded":"dismissed",C="$survey_"+E+"/"+S.id,S.current_iteration&&S.current_iteration>0&&(C="$survey_"+E+"/"+S.id+"/"+S.current_iteration),C)]:!0})}else t===Qi.SHOWN&&(_.$set=de({},_.$set,{[hm.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(t===M4.SHOWN){var I=n==null?void 0:n[Uy.TOUR_TYPE];I&&(_.$set=de({},_.$set,{[Uy.TOUR_LAST_SEEN_DATE+"/"+I]:new Date().toISOString()}))}var F=de({},_.properties.$set,_.$set);if(Jr(F)||this.setPersonPropertiesForFlags(F),!Ge(this.config.before_send)){var W=this.At(_);if(!W)return;(_=W).uuid=py(_.uuid,Gi)}this.Pn.emit("eventCaptured",_);var z=(a=r==null?void 0:r._url)!==null&&a!==void 0?a:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),q={method:"POST",url:z,data:_,compression:"best-available",timestampMode:(r==null?void 0:r._batchKey)==="recordings"||/\/s\/(?:\?|$)/.test(z)?"body":"capture-body",batchKey:r==null?void 0:r._batchKey,transport:r==null?void 0:r.transport};return!this.config.request_batching||r&&(r==null||!r._batchKey)||r!=null&&r.send_instantly?this.Qn(q):this.Gn.enqueue(q),_}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)))}rs(){var t;return(t=this.os)!==null&&t!==void 0?t:this.os=new nE(this)}An(t){this.qn.push(t);var n=!0;return()=>{if(n){n=!1;var r=this.qn.indexOf(t);r!==-1&&this.qn.splice(r,1)}}}fs(t){var n,r,a;return t===void 0&&(t=!0),!((n=this.persistence)==null||!n.consumeCookieIdentityChange())&&(this.Un=null,this.persistence.get_property(nt)===fn&&((a=this.sessionPersistence)==null||a.clear(),this.$n.clear(),this.ps()),(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.fs();var u=o?void 0:this.persistence.remove_event_timer(t),f=de({},n);if(f.token=this.config.token,f.$config_defaults=this.config.defaults,this.Ln()&&(f[$w]=!0),t==="$snapshot"){var h=de({},this.persistence.properties(),this.sessionPersistence.properties());return f.distinct_id=h.distinct_id,(!gt(f.distinct_id)&&!ln(f.distinct_id)||Yd(f.distinct_id))&&ye.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),f}var p,m=(function(D,L,I,F){var W,z,q,A;if(F===void 0&&(F=!1),!ar)return{};var ie,K=D?[...ql,...L||[]]:[],G=(function(wt){for(var Tt=0;fy.length>Tt;Tt++){var ve=fy[Tt],$e=ve[1],rt=ve[0].exec(wt),rn=rt&&(Gn($e)?$e(rt,wt):$e);if(rn)return rn}return["",""]})(ar),P=G[0],$=G[1],se=(ie=typeof navigator<"u"?navigator:void 0)!=null&&ie.brave?{brave:!0}:{},ae={};ge(I)||(ae.detectGoogleSearchApp=I);var R={},B=(W=navigator)==null||(W=W.userAgentData)==null?void 0:W.platform,Z=(z=navigator)==null?void 0:z.maxTouchPoints,M=re==null||(q=re.screen)==null?void 0:q.width,pe=re==null||(A=re.screen)==null?void 0:A.height,_e=re==null?void 0:re.devicePixelRatio;ge(B)||(R.userAgentDataPlatform=B),ge(Z)||(R.maxTouchPoints=Z),ge(M)||(R.screenWidth=M),ge(pe)||(R.screenHeight=pe),ge(_e)||(R.devicePixelRatio=_e);var Ce,De,Ee,Be,Je,Et,ft,vt,bt=Rt(hx({$os:P,$os_version:$,$browser:kw(ar,navigator.vendor,se,ae),$device:hy(ar),$device_type:(De=ar,Ee=R,vt=hy(De),vt===sw||vt===iw||vt==="Kobo"||vt==="Kindle Fire"||vt===vw?Bl:vt===Ec||vt===Ll||vt===Tc||vt===cg?"Console":vt===lw?"Wearable":vt?wr:(Ee==null?void 0:Ee.userAgentDataPlatform)==="Android"&&((Be=Ee==null?void 0:Ee.maxTouchPoints)!==null&&Be!==void 0?Be:0)>0?600>Math.min((Je=Ee==null?void 0:Ee.screenWidth)!==null&&Je!==void 0?Je:0,(Et=Ee==null?void 0:Ee.screenHeight)!==null&&Et!==void 0?Et:0)/((ft=Ee==null?void 0:Ee.devicePixelRatio)!==null&&ft!==void 0?ft:1)?wr:Bl:"Desktop"),$timezone:h2(),$timezone_offset:E4()}),{$current_url:Lc(F?Ps(Qt==null?void 0:Qt.href):Qt==null?void 0:Qt.href,K,Dc),$host:Qt==null?void 0:Qt.host,$pathname:Qt==null?void 0:Qt.pathname,$raw_user_agent:ar.length>1e3?ar.substring(0,997)+"...":ar,$browser_version:N3(ar,navigator.vendor,se,ae),$browser_language:$y(),$browser_language_prefix:(Ce=$y(),typeof Ce=="string"?Ce.split("-")[0]:void 0),$screen_height:re==null?void 0:re.screen.height,$screen_width:re==null?void 0:re.screen.width,$viewport_height:re==null?void 0:re.innerHeight,$viewport_width:re==null?void 0:re.innerWidth,$lib:Bt.LIB_NAME,$lib_version:Bt.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Bt.SDK_DIST_CHANNEL&&(bt.$sdk_dist_channel=Bt.SDK_DIST_CHANNEL),bt})(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;f.$session_id=x.sessionId,f.$window_id=b}this.sessionPropsManager&&Rt(f,this.sessionPropsManager.getSessionProps());try{var y;this.sessionRecording&&Rt(f,this.sessionRecording.sdkDebugProperties),f.$sdk_debug_retry_queue_size=(y=this.Jn)==null?void 0:y.length}catch(D){f.$sdk_debug_error_capturing_properties=String(D)}if(this.requestRouter.region===Og&&(f.$lib_custom_api_host=this.config.api_host),p=t!==Nl||o?t!==tm||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,a),f=Rt(f,p),t===Nl&&Se&&(f.title=Se.title),!ge(u)){var _=r.getTime()-u;f.$duration=parseFloat((_/1e3).toFixed(3))}ar&&this.config.opt_out_useragent_filter&&(f.$browser_type=this._is_bot()?"bot":"browser");var j=this.persistence.properties(),N=this.sessionPersistence.properties();St(["$referrer","$referring_domain"],(D=>{D in j&&delete N[D]}));var S={};if(this.qn.length>0)for(var E of this.qn.slice())try{Rt(S,E())}catch(D){ye.error("Failed to produce browser extension event properties",D)}(f=Rt({},m,j,N,de({},S,f))).$is_identified=this._isIdentified(),Ie(this.config.property_denylist)?St(this.config.property_denylist,(function(D){delete f[D]})):ye.error(L2+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var C=this.config.sanitize_properties;C&&(ye.error(e_),f=C(f,t));var O=this.gs();return f.$process_person_profile=O,O&&!o&&this.ys("_calculate_event_properties"),f}cs(t,n,r){var a;if(n===void 0&&(n=!0),r===void 0&&(r=!1),!this.persistence||!this.gs()||this.Dn&&!r)return t;var o=this.persistence.get_initial_props(),u=(a=this.sessionPropsManager)==null?void 0:a.getSetOnceProps(),f=Rt({},o,u||{},t||{}),h=this.config.sanitize_properties;return h&&(ye.error(e_),f=h(f,"$set_once")),n&&(this.Dn=!0),Jr(f)?void 0:f}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.fs(),(r=this.sessionPersistence)==null||r.register(t),Object.keys(t).forEach((a=>this.$n.add(a))),this.ps()}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.$n.delete(t),this.ps()}bs(t,n){this.register({[t]:n})}Kn(){this.$n.forEach((t=>{var n;(n=this.sessionPersistence)==null||n.unregister(t)})),this.$n.clear(),this.ps()}ps(){var t;if(this.Nn)if(this.config.persistence==="memory"||(t=this.sessionPersistence)!=null&&t.Oi||!Lt.N())Lt.q(this.Nn);else{var n=[];this.$n.forEach((r=>n.push(r))),n.length>0?Lt.F(this.Nn,n):Lt.q(this.Nn)}}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.Pn.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:ec}),()=>{})}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:ec})}getActiveMatchingSurveys(t,n){n===void 0&&(n=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,n):t([],{isLoaded:!1,error:ec})}renderSurvey(t,n){var r;(r=this.surveys)==null||r.renderSurvey(t,n)}displaySurvey(t,n){var r;n===void 0&&(n=X4),(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:ec}}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:ec})}_s(t){return!t||Yd(t)?(ye.critical("Unique user id has not been set in posthog.identify"),!1):t===pd?(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(ln(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._s(t)&&this.ys("posthog.identify")){var a=this.get_distinct_id(),o=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==a,u=this.fs(!1),f=this.persistence.$i(),h=!1;try{var p=this.get_distinct_id();this.register({$user_id:t}),this.get_property(Ac)||this.register_once({$had_persisted_distinct_id:!0,$device_id:p},""),t!==p&&t!==this.get_property(Tl)&&(this.unregister(Tl),this.register({distinct_id:t}));var m,x=(this.persistence.get_property(nt)||fn)===fn,b=t!==p,y=!b&&x;if(b&&x)this.persistence.set_property(nt,Mn),this.setPersonPropertiesForFlags({$set:n||{},$set_once:r||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Ni(),this.capture(nm,{distinct_id:t,$anon_distinct_id:p},{$set:n||{},$set_once:r||{}}),this.Un=xm(t,n,r),(m=this.featureFlags)==null||m.setAnonymousDistinctId(p);else if(y){this.persistence.set_property(nt,Mn);var _=n||{},j=r||{};this.setPersonPropertiesForFlags({$set:_,$set_once:j},!1),this.config.cookieWinsOnConflict&&this.persistence.Ni(),this.capture("$set",{$set:_,$set_once:j}),this.Un=xm(t,n,r)}else(n||r)&&this.setPersonProperties(n,r);b||o||u?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(Yi)):y&&(n||r)&&this.reloadFeatureFlags(),h=!0}finally{f&&this.persistence.Bi(h)}}}setPersonProperties(t,n){if((t||n)&&this.ys("posthog.setPersonProperties")){var r=xm(this.get_distinct_id(),t,n);this.Un!==r?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:n||{}},!0),this.capture("$set",{$set:t||{},$set_once:n||{}}),this.Un=r):ye.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var n,r=(Ie(t)?t:[t]).filter((a=>gt(a)&&a.length>0));r.length!==0&&this.ys("posthog.unsetPersonProperties")&&((n=this.featureFlags)==null||n.unsetPersonPropertiesForFlags(r,!0),this.capture("$set",{$unset:r}),this.Un=null)}group(t,n,r){var a;if(t&&n){(a=this.persistence)==null||a.syncCookieProperties(),this.fs();var o=this.getGroups(),u=o[t]!==n;if(u&&this.resetGroupPropertiesForFlags(t),this.register({$groups:de({},o,{[t]:n})}),u||r){var f={$group_type:t,$group_key:n};r&&(f.$group_set=r),this.capture(_y,f)}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.ys("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=yr(t)?t:t==null?void 0:t.resetDeviceID,r=yr(t)||t==null?void 0:t.bootstrap;this.ws(n,!1,r)}ws(t,n,r){var a,o,u;if(n===void 0&&(n=!1),ye.info("reset"),!this.__loaded)return ye.uninitializedWarning("posthog.reset");var f=r==null?void 0:r.sessionID;this.config.bootstrap=r||((a=this.Wn)==null?void 0:a.bootstrap)||{},(o=this.featureFlags)==null||o.updateConfig==null||o.updateConfig(this.config,this.hr());var h=this.get_property(Ac),p=this.get_property(em),m=this.get_property(Sa),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.$i==null?void 0:u.$i(),y=!1;try{var _,j,N,S,E,C,O,D,L,I,F,W,z,q;if((_=this.persistence)==null||_.clear(),(j=this.sessionPersistence)==null||j.clear(),this.$n.clear(),this.ps(),ge(m)||(F=this.persistence)==null||F.register({[Sa]:m}),(N=this.surveys)==null||N.reset(),(S=this.hs)==null||S.stop(),(E=this.featureFlags)==null||E.reset(),(C=this.conversations)==null||C.reset(),(O=this.logs)==null||O.reset(),(D=this.metrics)==null||D.reset(),(L=this.persistence)==null||L.set_property(nt,fn),(I=this.sessionManager)==null||I.resetSessionId(),this.Un=null,this.config.cookieless_mode===Wi)this.register_once({distinct_id:pd,$device_id:null},"");else{var A=this.config.get_device_id(Gi());this.register_once({distinct_id:A,$device_id:t?A:h},""),t||ge(p)||this.register({[em]:p})}if(this.register({$last_posthog_reset:new Date().toISOString()},1),r&&(r.distinctID===void 0||this.Ln()||((q=this.persistence)==null||q.set_property(nt,r.isIdentifiedID?Mn:fn),this.register({distinct_id:r.distinctID})),(W=this.featureFlags)==null||W.initialize(),!(ge(f)||(z=this.sessionManager)!=null&&z.setBootstrapSessionId(f,!0)))){var ie=de({},r);delete ie.sessionID,this.config.bootstrap=ie}delete this.config.identity_distinct_id,delete this.config.identity_hash,y=!0}finally{var K;b&&((K=this.persistence)==null||K.Bi==null||K.Bi(y))}this.reloadFeatureFlags()}shutdown(t){var n=this;return Pt((function*(){var r,a,o,u,f,h,p;if(n.__loaded){(r=n.hs)==null||r.stop(),(a=n.os)==null||a.dispose(),(o=n.sessionRecording)==null||o.dispose(),(u=n.logs)==null||u.flushLogs("sendBeacon"),(f=n.metrics)==null||f.flush("sendBeacon"),(h=n.Gn)==null||h.unload(),(p=n.Jn)==null||p.unload();try{var m;(m=n.featureFlags)==null||m.destroy()}catch(x){ye.error("Error while destroying feature flags",x)}}else ye.uninitializedWarning("posthog.shutdown")}))()}setIdentity(t,n){var r;this.config.identity_distinct_id=t,this.config.identity_hash=n,this.alias(t),(r=this.conversations)==null||r.ks()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,(t=this.conversations)==null||t.xs()}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(Rw)?(ye.critical("Attempting to create alias for existing People user - aborting."),-2):this.ys("posthog.alias")?(ge(n)&&(n=this.get_distinct_id()),t!==n?(this.bs(Tl,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(Ut(t)){var r,a,o,u,f,h,p,m,x,b,y,_;Rt(this.config,t_(t));var j=this.Zn();(r=this.persistence)==null||r.update_config(this.config,n,j),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new dm(de({},this.config,{persistence:"sessionStorage"}),j,!1);var N=this.zn(this.config.debug);yr(N)&&(this.config.debug=N),yr(this.config.debug)&&(this.config.debug?(Bt.DEBUG=!0,Ct.N()&&Ct.F("ph_debug",!0),ye.info("set_config",{config:t,oldConfig:n,newConfig:de({},this.config)})):(Bt.DEBUG=!1,Ct.N()&&Ct.q("ph_debug"))),(a=this.featureFlags)==null||a.updateConfig==null||a.updateConfig(this.config,this.hr()),(o=this.exceptionObserver)==null||o.onConfigChange(),(u=this.exceptions)==null||u.onConfigChange(),(f=this.sessionRecording)==null||f.startIfEnabledOrStop(),(h=this.tracingHeaders)==null||h.startIfEnabledOrStop(),(p=this.autocapture)==null||p.startIfEnabled(),(m=this.heatmaps)==null||m.startIfEnabled(),(x=this.exceptionObserver)==null||x.startIfEnabledOrStop(),(b=this.deadClicksAutocapture)==null||b.startIfEnabledOrStop(),(y=this.surveys)==null||y.loadIfEnabled(),this.Ss(),(_=this.externalIntegrations)==null||_.startIfEnabledOrStop()}}_overrideSDKInfo(t,n){Bt.LIB_NAME=t,Bt.LIB_VERSION=n}startSessionRecording(t){var n,r,a,o,u,f=t===!0,h={sampling:f||!(t==null||!t.sampling),linked_flag:f||!(t==null||!t.linked_flag),url_trigger:f||!(t==null||!t.url_trigger),event_trigger:f||!(t==null||!t.event_trigger)};Object.values(h).some(Boolean)&&((n=this.sessionManager)==null||n.checkAndGetSessionAndWindowId(),h.sampling&&((r=this.sessionRecording)==null||r.overrideSampling()),h.linked_flag&&((a=this.sessionRecording)==null||a.overrideLinkedFlag()),h.url_trigger&&((o=this.sessionRecording)==null||o.overrideTrigger("url")),h.event_trigger&&((u=this.sessionRecording)==null||u.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!((t=this.sessionRecording)==null||!t.started)}captureException(t,n){if(this.exceptions){var r=new Error("PostHog syntheticException"),a=this.exceptions.buildProperties(t,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(de({},a,n))}}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:br.Cs}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:Cl;return n!==Cl&&(n=Cl+"."+n),n}_isIdentified(){var t,n;return((t=this.persistence)==null?void 0:t.get_property(nt))===Mn||((n=this.sessionPersistence)==null?void 0:n.get_property(nt))===Mn}gs(){var t,n;return!(this.config.person_profiles==="never"||this.config.person_profiles===Ng&&!this._isIdentified()&&Jr(this.getGroups())&&((t=this.persistence)==null||(t=t.props)==null||!t[Tl])&&((n=this.persistence)==null||(n=n.props)==null||!n[of]))}ds(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.gs()||this.ys("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.ys("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}ys(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.bs(of,!0),!0)}Zn(){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!==_a)}Ss(){var t,n,r,a,o=this.Zn();return((t=this.persistence)==null?void 0:t.Oi)!==o&&((r=this.persistence)==null||r.set_disabled(o)),((n=this.sessionPersistence)==null?void 0:n.Oi)!==o&&((a=this.sessionPersistence)==null||a.set_disabled(o)),o&&(this.$n.clear(),this.ps()),o}opt_in_capturing(t){var n;if(this.config.cookieless_mode!==Wi){if(this.Ln()){var r,a,o,u,f;this.ws(!0,!0),(r=this.sessionManager)==null||r.destroy(),(a=this.pageViewManager)==null||a.destroy(),this.sessionManager=new Xy(this),this.pageViewManager=new Py(this),this.persistence&&(this.sessionPropsManager=new Wy(this,this.sessionManager,this.persistence));var h,p=(o=(u=this.config.__extensionClasses)==null?void 0:u.sessionRecording)!==null&&o!==void 0?o:(f=br.__defaultExtensionClasses)==null?void 0:f.sessionRecording;p&&(this.sessionRecording=this.On(this.sessionRecording,new p(this)),this.In&&((h=this.sessionRecording)==null||h.onRemoteConfig==null||h.onRemoteConfig(this.In)))}var m,x;this.consent.optInOut(!0),this.Ss(),this.ls(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),this.config.cookieless_mode==_a&&((m=this.surveys)==null||m.loadIfEnabled()),(ge(t==null?void 0:t.captureEventName)||t!=null&&t.captureEventName)&&this.capture((x=t==null?void 0:t.captureEventName)!==null&&x!==void 0?x:"$opt_in",t==null?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.us()}else ye.warn(Jy)}opt_out_capturing(){var t,n,r;this.config.cookieless_mode!==Wi?(this.config.cookieless_mode===_a&&this.consent.isOptedIn()&&this.ws(!0,!0),this.consent.optInOut(!1),this.Ss(),this.config.cookieless_mode===_a&&(this.register({distinct_id:pd,$device_id:null}),(t=this.sessionRecording)==null||t.stopRecording(),this.sessionRecording=void 0,(n=this.sessionManager)==null||n.destroy(),(r=this.pageViewManager)==null||r.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.us(),this.ls())):ye.warn(Jy)}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===Wi||(this.config.cookieless_mode===_a?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Ss()}_is_bot(){return Qn?N2(Qn,this.config.custom_blocked_useragents):void 0}us(){Se&&(Se.visibilityState==="visible"?this.jn||(this.jn=!0,this.capture(Nl,{title:Se.title},{send_instantly:!0}),this.Bn&&(Se.removeEventListener(cf,this.Bn),this.Bn=null)):this.Bn||(this.Bn=this.us.bind(this),Xt(Se,cf,this.Bn)))}debug(t){t===!1?(re==null||re.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(re==null||re.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}hr(){var t=this.Wn||{};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 f=r in n&&!Ge(n[r]),h=a in n&&!Ge(n[a]);return f?n[r]:!!h&&(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)}At(t){var n;if(Ge(this.config.before_send))return t;var r=Object.keys((n=t.properties)!==null&&n!==void 0?n:{}).filter(p3),a=Ie(this.config.before_send)?this.config.before_send:[this.config.before_send],o=t;for(var u of a){if(o=u(o),Ge(o)){var f="Event '"+t.event+"' was rejected in beforeSend function";return h3(t.event)?ye.warn(f+". This can cause unexpected behavior."):ye.info(f),null}o.properties&&!Jr(o.properties)||ye.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}for(var h of r)if(o.properties&&Ge(o.properties[h]))return ye.warn("Event '"+t.event+"' had its '"+h+"' 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.fi)==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)})}zn(t){var n=yr(t)&&!t,r=Ct.N()&&Ct.P("ph_debug")==="true";return!n&&(!!r||t)}}br.__defaultExtensionClasses={},br.Cs=(()=>{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]]=t4(e.prototype[t[n]])})(br,["identify"]);class n_{constructor(t){this.disabled=t===!1;var n=Ut(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 ym="$copy_autocapture",_m=Vt("[AutoCapture]");function wm(e,t){return t.length>e?t.slice(0,e)+"...":t}function aE(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!$s(t));return t}function lE(e,t){var n,r,a=t.e,o=t.maskAllElementAttributes,u=t.maskAllText,f=t.elementAttributeIgnoreList,h=t.elementsChainAsString,p=t.disableCaptureUrlHashes;if(!$s(e))return{props:{}};for(var m=[e],x=new Set([e]),b=e;b.parentNode&&!_r(b,"body")&&Xw>m.length;)if(Qw(b.parentNode)){var y=b.parentNode.host;if(x.has(y))break;x.add(y),m.push(y),b=y}else{if(!$s(b.parentNode)||x.has(b.parentNode))break;x.add(b.parentNode),m.push(b.parentNode),b=b.parentNode}var _,j,N=[],S={},E=!1,C=!1;if(St(m,(F=>{var W=Tg(F);if(_r(F,"a")){var z=F.getAttribute("href");E=!!(W&&z&&vc(z))&&(p?Ps(z):z)}Ve(hf(F),"ph-no-capture")&&(C=!0),N.push((function(A,ie,K,G,P){P===void 0&&(P=!1);var $=A.tagName.toLowerCase(),se={tag_name:$};mx.indexOf($)>-1&&!K&&(se.$el_text=$.toLowerCase()==="a"||$.toLowerCase()==="button"?wm(1024,zy(A)):wm(1024,Rc(A)));var ae=hf(A);ae.length>0&&(se.classes=ae.filter((function(M){return M!==""}))),St(A.attributes,(function(M){var pe;if((!t2(A)||["name","id","class","aria-label"].indexOf(M.name)!==-1)&&(G==null||!G.includes(M.name))&&!ie&&vc(M.value)&&(!gt(pe=M.name)||pe.substring(0,10)!=="_ngcontent"&&pe.substring(0,7)!=="_nghost")){var _e=M.value;M.name==="class"&&(_e=px(_e).join(" ")),se["attr__"+M.name]=wm(1024,M.name==="href"&&P?Ps(_e):_e)}}));for(var R=1,B=1,Z=A;Z=aE(Z);)R++,Z.tagName===A.tagName&&B++;return se.nth_child=R,se.nth_of_type=B,se})(F,o,u,f,p));var q=(function(A){if(!Tg(A))return{};var ie={};return St(A.attributes,(function(K){if(K.name&&K.name.indexOf("data-ph-capture-attribute")===0){var G=K.name.replace("data-ph-capture-attribute-",""),P=K.value;G&&P&&vc(P)&&(ie[G]=P)}})),ie})(F);Rt(S,q)})),C)return{props:{},explicitNoCapture:C};if(u||(N[0].$el_text=_r(e,"a")||_r(e,"button")?zy(e):Rc(e)),E){var O,D;N[0].attr__href=E;var L=(O=Fl(E))==null?void 0:O.host,I=re==null||(D=re.location)==null?void 0:D.host;L&&I&&L!==I&&(_=E)}return{props:Rt({$event_type:a.type,$ce_version:1},h?{}:{$elements:N},{$elements_chain:(j=N,(function(F){return F.map((W=>{var z,q,A="";if(W.tag_name&&(A+=W.tag_name),W.attr_class)for(var ie of(W.attr_class.sort(),W.attr_class))A+="."+ie.replace(/"/g,"");var K=de({},W.text?{text:W.text}:{},{"nth-child":(z=W.nth_child)!==null&&z!==void 0?z:0,"nth-of-type":(q=W.nth_of_type)!==null&&q!==void 0?q:0},W.href?{href:W.href}:{},W.attr_id?{attr_id:W.attr_id}:{},W.attributes),G={};return $d(K).sort(((P,$)=>P[0].localeCompare($[0]))).forEach((P=>{var $=P[1];return G[Oy(P[0].toString())]=Oy($.toString())})),(A+=":")+$d(G).map((P=>P[0]+'="'+P[1]+'"')).join("")})).join(";")})((function(F){return F.map((W=>{var z,q,A={text:(z=W.$el_text)==null?void 0:z.slice(0,400),tag_name:W.tag_name,href:(q=W.attr__href)==null?void 0:q.slice(0,2048),attr_class:y4(W),attr_id:W.attr__id,nth_child:W.nth_child,nth_of_type:W.nth_of_type,attributes:{}};return $d(W).filter((ie=>ie[0].indexOf("attr__")===0)).forEach((ie=>A.attributes[ie[0]]=ie[1])),A}))})(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:_}:{},S)}}var tc=Vt("[ExceptionAutocapture]"),r_=()=>{},oE=Vt("[TracingHeaders]"),pa=Vt("[Web Vitals]"),i_=9e5,s_="disabled",a_="lazy_loading",nc="awaiting_config",wd="missing_config";Vt("[SessionRecording]"),Vt("[SessionRecording]");var Bg="[SessionRecording]",Fi=Vt(Bg),cE=Vt("[Heatmaps]");function km(e){return Ut(e)&&"clientX"in e&&"clientY"in e&&ln(e.clientX)&&ln(e.clientY)}var kd=Vt("[Product Tours]"),Sm=e=>{var t;return!e.config.disable_product_tours&&!((t=e.persistence)==null||!t.get_property(ux))},uE=["$set_once","$set"],di=Vt("[SiteApps]"),l_="Error while initializing PostHog app with config id ";function kl(e,t,n){if(Ge(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 dE{constructor(t){this.Ms=new bx,this.Ts=(n,r)=>this.Es(n,r)&&this.Is(n,r)&&this.Ps(n,r)&&this.Rs(n,r),this.Es=(n,r)=>r==null||!r.event||(n==null?void 0:n.event)===(r==null?void 0:r.event),this._instance=t,this.As=new Set,this.Fs=new Set}init(){var t,n;ge((t=this._instance)==null?void 0:t._addCaptureHook)||(n=this._instance)==null||n._addCaptureHook(((r,a)=>{this.on(r,a)}))}register(t){var n,r;if(!ge((n=this._instance)==null?void 0:n._addCaptureHook)&&(t.forEach((u=>{var f,h;(f=this.Fs)==null||f.add(u),(h=u.steps)==null||h.forEach((p=>{var m;(m=this.As)==null||m.add((p==null?void 0:p.event)||"")}))})),(r=this._instance)!=null&&r.autocapture)){var a,o=new Set;t.forEach((u=>{var f;(f=u.steps)==null||f.forEach((h=>{h!=null&&h.selector&&o.add(h==null?void 0:h.selector)}))})),(a=this._instance)==null||a.autocapture.setElementSelectors(o)}}on(t,n){var r;n!=null&&t.length!=0&&(this.As.has(t)||this.As.has(n.event))&&this.Fs&&((r=this.Fs)==null?void 0:r.size)>0&&this.Fs.forEach((a=>{this.Os(n,a)&&this.Ms.emit("actionCaptured",a.name)}))}Ls(t){this.onAction("actionCaptured",(n=>t(n)))}Os(t,n){if((n==null?void 0:n.steps)==null)return!1;for(var r of n.steps)if(this.Ts(t,r))return!0;return!1}onAction(t,n){return this.Ms.on(t,n)}Is(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"||!kl(a,n.url,n.url_matching||"contains"))return!1}return!0}Ps(t,n){return!!this.Ds(t,n)&&!!this.$s(t,n)&&!!this.Ns(t,n)}Ds(t,n){var r;if(n==null||!n.href)return!0;var a=this.qs(t);if(a.length>0)return a.some((f=>kl(f.href,n.href,n.href_matching||"exact")));var o,u=(t==null||(r=t.properties)==null?void 0:r.$elements_chain)||"";return!!u&&kl((o=u.match(/(?::|")href="(.*?)"/))?o[1]:"",n.href,n.href_matching||"exact")}$s(t,n){var r;if(n==null||!n.text)return!0;var a=this.qs(t);if(a.length>0)return a.some((p=>kl(p.text,n.text,n.text_matching||"exact")||kl(p.$el_text,n.text,n.text_matching||"exact")));var o,u,f,h=(t==null||(r=t.properties)==null?void 0:r.$elements_chain)||"";return!!h&&(o=(function(p){for(var m,x=[],b=/(?::|")text="(.*?)"/g;!Ge(m=b.exec(p));)x.includes(m[1])||x.push(m[1]);return x})(h),u=n.text,f=n.text_matching||"exact",o.some((p=>kl(p,u,f))))}Ns(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}qs(t){var n;return(t==null||(n=t.properties)==null?void 0:n.$elements)==null?[]:t==null?void 0:t.properties.$elements}Rs(t,n){return n==null||!n.properties||n.properties.length===0||T2(n.properties.reduce(((r,a)=>{var o=Ie(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 fE{constructor(t){var n;this.js=[],this._instance=t,this.Bs=new Map,this.Hs=new Map,this.Us=new Map,(n=this._instance)==null||n.onSessionId==null||n.onSessionId((r=>this.zs(r)))}Ws(t){return!1}Vs(){return null}Zs(t){}Gs(){}Qs(t,n){return!!t&&T2(t.propertyFilters,n==null?void 0:n.properties)}Js(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 f=r.get(u.name)||[];f.push(a.id),r.set(u.name,f)}}))})),r}Ks(t,n,r){var a=(r===Ko.Activation?this.Bs:this.Hs).get(t),o=[];return this.Ys((u=>{o=u.filter((f=>a==null?void 0:a.includes(f.id)))})),o.filter((u=>{var f,h=(f=u.conditions)==null||(f=f[r])==null||(f=f.values)==null?void 0:f.find((p=>p.name===t));return this.Qs(h,n)}))}register(t){var n;ge((n=this._instance)==null?void 0:n._addCaptureHook)||(this.Xs(t),this.ta(t))}ta(t){var n=t.filter((r=>{var a,o;return((a=r.conditions)==null?void 0:a.actions)&&((o=r.conditions)==null||(o=o.actions)==null||(o=o.values)==null?void 0:o.length)>0}));n.length!==0&&(this.ea==null&&(this.ea=new dE(this._instance),this.ea.init(),this.ea.Ls((r=>{this.onAction(r)}))),n.forEach((r=>{var a,o,u,f,h;r.conditions&&(a=r.conditions)!=null&&a.actions&&(o=r.conditions)!=null&&(o=o.actions)!=null&&o.values&&((u=r.conditions)==null||(u=u.actions)==null||(u=u.values)==null?void 0:u.length)>0&&((f=this.ea)==null||f.register(r.conditions.actions.values),(h=r.conditions)==null||(h=h.actions)==null||(h=h.values)==null||h.forEach((p=>{if(p&&p.name){var m=this.Us.get(p.name);m&&m.push(r.id),this.Us.set(p.name,m||[r.id])}})))})))}Xs(t){var n,r=t.filter((o=>{var u,f;return((u=o.conditions)==null?void 0:u.events)&&((f=o.conditions)==null||(f=f.events)==null||(f=f.values)==null?void 0:f.length)>0})),a=t.filter((o=>{var u,f;return((u=o.conditions)==null?void 0:u.cancelEvents)&&((f=o.conditions)==null||(f=f.cancelEvents)==null||(f=f.values)==null?void 0:f.length)>0}));r.length===0&&a.length===0||((n=this._instance)==null||n._addCaptureHook(((o,u)=>{this.onEvent(o,u)})),this.Bs=this.Js(t,Ko.Activation),this.Hs=this.Js(t,Ko.Cancellation))}onEvent(t,n){var r,a,o=this.ia(),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 f=this.ra(t,u);if(f==="consume")return o.info("event consumed activated item, removing it",{event:t,itemId:u}),void this.na([u]);if(f==="persist")return o.info("shown item promoted to persisted activation",{event:t,itemId:u}),this.sa(u),void this.aa([u])}if(this.Hs.has(t)){var h=this.Ks(t,n,Ko.Cancellation);h.length>0&&(o.info("cancel event matched, cancelling items",{event:t,itemsToCancel:h.map((m=>m.id))}),this.na(h.map((m=>m.id))),h.forEach((m=>this.oa(m.id))))}if(this.Bs.has(t)){o.info("event name matched",{event:t,eventPayload:n,items:this.Bs.get(t)});var p=this.Ks(t,n,Ko.Activation);this.la(p.map((m=>m.id)))}}onAction(t){this.Us.has(t)&&this.la(this.Us.get(t)||[])}la(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.Ws(o)?this.sa(o)&&this.ua(o):a.push(o);a.length>0&&(this.js=[...new Set([...this.js,...a])]),this.ia().info("updating activated items",{activatedItems:this.getActivatedIds()})}}sa(t){this.js=this.js.filter((r=>r!==t));var n=this.ha();return!n.includes(t)&&(this.da([...n,t]),this.va(),!0)}na(t){var n=new Set(t);this.js=this.js.filter((o=>!n.has(o)));var r=this.ca(),a=r.filter((o=>!n.has(o)));a.length!==r.length&&(this.da(a),a.length===0&&this.fa()),this.aa(t)}pa(){var t,n=this.Vs();if(!n)return{};var r=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[n];return r&&typeof r=="object"?r:{}}ua(t){if(this.Vs()){var n=this.pa();this.Zs(de({},n,{[t]:Date.now()}))}}aa(t){if(this.Vs()){var n=this.pa(),r={},a=!1;for(var o of Object.entries(n)){var u=o[0],f=o[1];t.includes(u)?a=!0:r[u]=f}a&&(Jr(r)?this.Gs():this.Zs(r))}}ga(){this.Vs()&&this.Gs()}getActivationTimestamp(t){if(this.ha().includes(t)){var n=this.pa()[t];return ln(n)?n:void 0}}ca(){var t,n=this.ma();return((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[n])||[]}ha(){var t,n,r=this.ca();if(r.length===0)return[];var a=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[this.ya()],o=(n=this._instance)==null||n.get_session_id==null?void 0:n.get_session_id();return o&&a===o?r:[]}va(){var t,n=(t=this._instance)==null||t.get_session_id==null?void 0:t.get_session_id();n&&this.ba(n)}fa(){this._a()}zs(t){var n,r=(n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[this.ya()];if(r&&r!==t){var a=this.ca(),o=this.pa();a.length>0&&(this.da([]),a.filter((u=>ln(o[u]))).forEach((u=>this.oa(u)))),this.fa(),this.ga()}}getActivatedIds(){return[...new Set([...this.ha(),...this.js])].filter((t=>!this.wa(t)))}reset(){this.js=[],this.ca().length>0&&this.da([]),this.fa(),this.ga()}getEventToItemsMap(){return this.Bs}ka(){return this.ea}}class hE extends fE{constructor(t){super(t)}ma(){return _g}ya(){return Bd}Vs(){return Pd}Zs(t){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[Pd]:t})}Gs(){var t;(t=this._instance)==null||(t=t.persistence)==null||t.unregister(Pd)}Ws(t){var n,r;this.Ys((o=>{r=o.find((u=>u.id===t))}));var a=(n=r)==null||(n=n.appearance)==null?void 0:n.surveyPopupDelaySeconds;return ln(a)&&a>0}xa(){return Qi.SHOWN}Ys(t){var n;(n=this._instance)==null||n.getSurveys(t)}oa(t){var n;(n=this._instance)==null||n.cancelPendingSurvey(t)}ia(){return Nt}da(t){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[_g]:t})}ba(t){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[Bd]:t})}_a(){var t;(t=this._instance)==null||(t=t.persistence)==null||t.unregister(Bd)}wa(){return!1}ra(t,n){var r;this.Ys((o=>{r=o.find((u=>u.id===n))}));var a=!r||(function(o){var u;return A2(o)&&!((u=o.conditions)==null||(u=u.events)==null||!u.repeatedActivation)||o.schedule==="always"})(r);return a?t===Qi.SHOWN?"consume":"ignore":t===Qi.SHOWN?"persist":t===Qi.DISMISSED||t===Qi.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var Sd="SDK is not enabled or survey functionality is not yet loaded",o_="Disabled. Not loading surveys.",pE=re!=null&&re.location?pf(re.location.hash,"__posthog")||pf(location.hash,"state"):null,c_="_postHogToolbarParams",u_=Vt("[Toolbar]"),d_=Vt("[FeatureFlags]");class mE{constructor(t,n){n===void 0&&(n=!1),this.Sa=!1,this.update(t,n)}update(t,n){this.Ca=((r,a)=>{var o,u,f,h;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,requestTimeoutMs:r.feature_flag_request_timeout_ms,compression:r.disable_compression?"none":"base64",evaluationContexts:(f=(h=r.evaluation_contexts)!==null&&h!==void 0?h:r.evaluation_environments)!==null&&f!==void 0?f:[],flagKeys:Ie(r.flag_keys)?r.flag_keys:void 0}})(t,n),!t.evaluation_environments||t.evaluation_contexts||this.Sa||(d_.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Sa=!0),ge(t.flag_keys)||Ie(t.flag_keys)||d_.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.Ca}}var f_=Vt("[FeatureFlags]"),ma=Vt("[FeatureFlags]",{debugEnabled:!0}),jm=`" failed. Feature flags didn't load in time.`,h_="connection_error",p_=e=>{for(var t={},n=0;e.length>n;n++)t[e[n]]=!0;return t},m_=e=>{var t={};for(var n of $d(e||{})){var r=n[1];r&&(t[n[0]]=r)}return t},fi=Vt("[Error tracking]"),g_="Refusing to render web experiment since the viewer is a likely bot",gE={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>xf(t,e),not_regex:(e,t)=>!xf(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e};class On{get qe(){return this._instance.config}constructor(t){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(r){r===void 0&&(r=!1),n.getWebExperiments((a=>{On.Ma("retrieved web experiments from the server"),n.Ta=new Map,a.forEach((o=>{if(o.feature_flag_key){var u;n.Ta&&(On.Ma("setting flag key ",o.feature_flag_key," to web experiment ",o),(u=n.Ta)==null||u.set(o.feature_flag_key,o));var f=n._instance.getFeatureFlag(o.feature_flag_key);gt(f)&&o.variants[f]&&n.Ea(o.name,f,o.variants[f].transforms)}else if(o.variants)for(var h in o.variants){var p=o.variants[h];On.Ia(p,n._instance)&&n.Ea(o.name,h,p.transforms)}}))}),r)},this._instance=t,this._instance.onFeatureFlags((r=>{this.onFeatureFlags(r)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())On.Ma(g_);else if(!this.qe.disable_web_experiments){if(Ge(this.Ta))return this.Ta=new Map,this.loadIfEnabled(),void this.previewWebExperiment();On.Ma("applying feature flags",t),t.forEach((n=>{var r;if(this.Ta&&(r=this.Ta)!=null&&r.has(n)){var a,o=this._instance.getFeatureFlag(n),u=(a=this.Ta)==null?void 0:a.get(n);o&&u!=null&&u.variants[o]&&this.Ea(u.name,o,u.variants[o].transforms)}}))}}previewWebExperiment(){var t=On.getWindowLocation();if(t!=null&&t.search){var n=Ul(t==null?void 0:t.search,"__experiment_id"),r=Ul(t==null?void 0:t.search,"__experiment_variant");n&&r&&(On.Ma("previewing web experiments "+n+" && "+r),this.getWebExperiments((a=>{this.Pa(parseInt(n),r,a)}),!1,!0))}}loadIfEnabled(){this.qe.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,n,r){if(this.qe.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.qe.token),method:"GET",timestampMode:"query",callback:o=>t(o.statusCode===200&&o.json&&o.json.experiments||[])})}Pa(t,n,r){var a=r.filter((o=>o.id===t));a&&a.length>0&&(On.Ma("Previewing web experiment ["+a[0].name+"] with variant ["+n+"]"),this.Ea(a[0].name,n,a[0].variants[n].transforms))}static Ia(t,n){return!Ge(t.conditions)&&On.Ra(t,n)&&On.Aa(t)}static Ra(t,n){var r;if(Ge(t.conditions)||Ge((r=t.conditions)==null?void 0:r.url))return!0;var a=On.getWindowLocation();if(a){var o,u,f,h=Gw(n,a.href);return(o=t.conditions)==null||!o.url||gE[(u=(f=t.conditions)==null?void 0:f.urlMatchType)!==null&&u!==void 0?u:"icontains"](t.conditions.url,h)}return!1}static getWindowLocation(){return re==null?void 0:re.location}static Aa(t){var n;if(Ge(t.conditions)||Ge((n=t.conditions)==null?void 0:n.utm))return!0;var r=l2();if(r.utm_source){var a,o,u,f,h,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||((f=t.conditions)==null||(f=f.utm)==null?void 0:f.utm_source)==r.utm_source,_=(h=t.conditions)==null||(h=h.utm)==null||!h.utm_medium||((p=t.conditions)==null||(p=p.utm)==null?void 0:p.utm_medium)==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 Ma(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)}Ea(t,n,r){this._is_bot()?On.Ma(g_):n!=="control"?r.forEach((a=>{if(a.selector){var o;On.Ma("applying transform of variant "+n+" for experiment "+t+" ",a);var u=(o=document)==null?void 0:o.querySelectorAll(a.selector);u==null||u.forEach((f=>{var h=f;a.html&&(h.innerHTML=a.html),a.css&&h.setAttribute("style",a.css)}))}})):On.Ma("Control variants leave the page unmodified.")}_is_bot(){return Qn&&this._instance?N2(Qn,this.qe.custom_blocked_useragents):void 0}}var Pr=Vt("[Conversations]"),ga="Conversations not available yet.",x_="console",z2="__posthogHandledLogsRequestError",Nm=(e,t)=>{var n=e instanceof Error?e:new Error(t);return n[z2]=!0,n},v_=e=>!!e&&typeof e=="object"&&e[z2]===!0,Af={featureFlags:class{constructor(e){this.name="featureFlags",this.Fa=!1,this.featureFlagEventHandlers=[],this.st=f_,this.Oa={},this.La={},this.Da=[],this.$a=!1,this.Na=!1,this.qa=0,this.ja=!1,this.Ba=!1,this.Ha=!1,this.Ua=!1,this.za=0,this.Wa=()=>{var t=this.Va();this.za=0,t&&this.reloadFeatureFlags()},"get"in e?this.Za=e:(this.Ga=new mE(e.config,e.hr()),this.Za=this.Ga)}updateConfig(e,t){var n;(n=this.Ga)==null||n.update(e,t)}setup(e){return this.Qa=e,this.st=e.logger.createLogger("[FeatureFlags]"),n=()=>{this.Qa===e&&(this.Qa=void 0,this.Sn=e,this.Ja(e))},(t=e.kv.initialize())!=null&&t.then?t.then(n):n();var t,n}Ja(e){if(this.Sn===e)return re&&Xt(re,"online",this.Wa),this.Ka=e.registerDynamicEventProperties((()=>this.Ya()?this.Oa:this.La)),this.Xa(),this.initialize()}destroy(){re==null||re.removeEventListener("online",this.Wa)}dispose(){var e;this.qa++,this.Ba=!1,this.Qa=void 0,this.Sn&&(this.eo(),(e=this.Ka)==null||e.dispose(),this.Ka=void 0,this.Da=[],re==null||re.removeEventListener("online",this.Wa),this.Sn=void 0)}get qe(){return this.Za.get()}io(e){var t;return(t=this.Sn)==null?void 0:t.kv.get(e)}F(e){this.ro((()=>{var t;return(t=this.Sn)==null?void 0:t.kv.set(e)}))}q(e){this.ro((()=>{var t;return(t=this.Sn)==null?void 0:t.kv.remove(e)}))}ro(e){try{e()}catch(t){this.st.error("Failed to update feature flag persistence",t)}}Xa(){var e={};for(var t of[ja,Na,Dl,pi]){var n=this.io(t);ge(n)||(e[t]=n)}this.Oa=e;var r=de({},e),a=this.io(Vi);if(a)for(var o of Object.entries(a))r["$feature/"+o[0]]=o[1];this.La=r}Ya(){var e=this.qe.cacheTtlMs;if(!e||0>=e)return!1;var t=this.io(Ea);return typeof t!="number"||Date.now()-t>e}no(){return!!this.Ya()&&(this.Ua||this.Na||(this.Ua=!0,this.st.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}so(){var e=this.qe.evaluationContexts;return e!=null&&e.length?e.filter((t=>{var n=t&&typeof t=="string"&&t.trim().length>0;return n||this.st.error("Invalid evaluation context found:",t,"Expected non-empty string"),n})):[]}ao(){var e=this.qe.flagKeys;if(!ge(e))return e.filter((t=>{var n=t&&typeof t=="string"&&t.trim().length>0;return n||this.st.error("Invalid flag key found:",t,"Expected non-empty string"),n}))}initialize(){var e,t,n=this.qe,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:{},f=Object.keys(r).filter((p=>!!r[p])).reduce(((p,m)=>(p[m]=r[m]||!1,p)),{}),h=Object.keys(u).filter((p=>f[p])).reduce(((p,m)=>(p[m]=u[m],p)),{});return this.oo({featureFlags:f,featureFlagPayloads:h})}}updateFlags(e,t,n){var r,a,o=n!=null&&n.merge&&(r=this.io(Vi))!==null&&r!==void 0?r:{},u=n!=null&&n.merge&&(a=this.io(Na))!==null&&a!==void 0?a:{},f=de({},o,e),h=de({},u,t),p={};for(var m of Object.entries(f)){var x=m[0],b=m[1];p[x]={key:x,enabled:sy(b),variant:ay(b),reason:void 0,metadata:ge(h==null?void 0:h[x])?void 0:{id:0,version:void 0,description:void 0,payload:h[x]}}}this.oo({flags:p})}get hasLoadedFlags(){return this.$a}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this.io(Mc),t=this.io(pi),n=this.io(ya);if(!n&&!t)return e||{};var r=Rt({},e||{}),a=[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])];for(var o of a){var u,f,h=r[o],p=t==null?void 0:t[o],m=ge(p)?(u=h==null?void 0:h.enabled)!==null&&u!==void 0&&u:!!p,x=ge(p)?h==null?void 0:h.variant:typeof p=="string"?p:void 0,b=n==null?void 0:n[o],y=de({},h,{enabled:m,variant:m?x??(h==null?void 0:h.variant):void 0});m!==(h==null?void 0:h.enabled)&&(y.original_enabled=h==null?void 0:h.enabled),x!==(h==null?void 0:h.variant)&&(y.original_variant=h==null?void 0:h.variant),b&&(y.metadata=de({},h==null?void 0:h.metadata,{payload:b,original_payload:h==null||(f=h.metadata)==null?void 0:f.payload})),r[o]=y}return this.Fa||(this.st.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:r}),this.Fa=!0),r}getAllFeatureFlags(){var e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map((n=>{var r=e[n];return{key:n,enabled:sy(r),variant:ay(r),payload:iy(t[n])}}))}getFlagVariants(){var e=this.io(Vi),t=this.io(pi);if(!t)return e||{};for(var n=Rt({},e||{}),r=Object.keys(t),a=0;r.length>a;a++)n[r[a]]=t[r[a]];return this.Fa||(this.st.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.Fa=!0),n}getFlagPayloads(){var e=this.io(Na),t=this.io(ya);if(!t)return e||{};for(var n=Rt({},e||{}),r=Object.keys(t),a=0;r.length>a;a++)n[r[a]]=t[r[a]];return this.Fa||(this.st.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),this.Fa=!0),n}reloadFeatureFlags(){this.ja||this.qe.featureFlagsDisabled||this.Va()||this.lo||(this.Da.slice().forEach((e=>{try{e()}catch(t){this.st.error("Error while running feature flags reloading callback",t)}})),this.lo=setTimeout((()=>{this.uo()}),5))}eo(){clearTimeout(this.lo),this.lo=void 0}onReloading(e){return this.Da.push(e),()=>{this.Da=this.Da.filter((t=>t!==e))}}ensureFlagsLoaded(){this.$a||this.Na||this.lo||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.ja=e}resetFlagCallReported(){this.q(Yi)}uo(e){this.eo();var t=this.Sn;if(t&&!this.qe.remoteRequestsDisabled&&!this.Va())if(this.Na)this.Ba=!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.io(Kr)||{},{$lib:t.library.name,$lib_version:t.library.version}),group_properties:this.io(xi),timezone:h2()};ge(t.deviceId)||(n.$device_id=t.deviceId),(e!=null&&e.disableFlags||this.qe.featureFlagsDisabled)&&(n.disable_flags=!0);var r=this.so();r.length&&(n.evaluation_contexts=r);var a=this.ao();ge(a)||(n.flag_keys=a);var o=this.qe.onlyEvaluateSurveyFeatureFlags,u="/flags/?v=2"+(o?"&only_evaluate_survey_feature_flags=true":""),f=this.qa;this.Na=!0;var h=()=>{this.Ba&&(this.Ba=!1,this.uo())},p=m=>{this.Na=!1,f===this.qa&&(this.F({[zl]:[h_]}),this.st.error("Feature flag request failed",m)),h()};try{t.sendRequest(u,{target:"flags",method:"POST",body:n,compression:this.qe.compression==="base64"?Yn.Base64:void 0,sentAt:"body",timeoutMs:this.qe.requestTimeoutMs}).then((m=>{var x,b,y=(x=m.json)!==null&&x!==void 0?x:{},_=m.statusCode!==200;if(this.Na=!1,f===this.qa){if(this.ho(m.statusCode),_||this.Ba||(this.$anon_distinct_id=void 0),!n.disable_flags||this.Ba){this.Ha=!_;var j=[];m.error?j.push(m.error instanceof Error&&m.error.name==="AbortError"?"timeout":m.error instanceof Error?h_:"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.F({[zl]:j}),N?this.st.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.oo(y,_,{partialResponse:o}),h()}}else h()})).catch(p)}catch(m){p(m)}}}Va(){return s2(this.za,3)}ho(e){this.za=a2(e,this.za,3,(()=>this.st.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.Ha)if(this.$a||this.getFlags()&&this.getFlags().length>0){if(!this.no()){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.st.warn('getFeatureFlag for key "'+e+jm)}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.Ha)if(this.$a||this.getFlags()&&this.getFlags().length>0){if(!this.no()){var n,r=this.getFlagVariants(),a=e in r,o=r[e],u=this.getFlagPayloads()[e],f=String(o),h=this.io(Dl)||void 0,p=this.io(Ea)||void 0,m=this.io(Yi)||{};if(this.qe.deduplicateCallsPerSession){var x,b=(x=this.Sn)==null?void 0:x.session.sessionId,y=this.io(fc);b&&b!==y&&(m={},n=b)}if(t.send_event||!("send_event"in t))if(e in m&&m[e].includes(f))n&&this.F({[Yi]:m,[fc]:n});else{var _,j,N,S,E,C,O,D,L,I,F,W;Ie(m[e])?m[e].push(f):m[e]=[f],this.F(de({[Yi]:m},n?{[fc]:n}:{}));var z=this.getFeatureFlagDetails(e),q=[...(_=this.io(zl))!==null&&_!==void 0?_:[]];ge(o)&&q.push("flag_missing");var A={$feature_flag:e,$feature_flag_response:o,$feature_flag_payload:u??null,$feature_flag_request_id:h,$feature_flag_evaluated_at:p,$feature_flag_bootstrapped_response:(j=(N=this.qe.bootstrap)==null||(N=N.featureFlags)==null?void 0:N[e])!==null&&j!==void 0?j:null,$feature_flag_bootstrapped_payload:(S=(E=this.qe.bootstrap)==null||(E=E.featureFlagPayloads)==null?void 0:E[e])!==null&&S!==void 0?S:null,$used_bootstrap_value:!this.Ha};ge(z==null||(C=z.metadata)==null?void 0:C.has_experiment)||(A.$feature_flag_has_experiment=z.metadata.has_experiment),ge(z==null||(O=z.metadata)==null?void 0:O.version)||(A.$feature_flag_version=z.metadata.version);var ie,K=(D=z==null||(L=z.reason)==null?void 0:L.description)!==null&&D!==void 0?D:z==null||(I=z.reason)==null?void 0:I.code;K&&(A.$feature_flag_reason=K),z!=null&&(F=z.metadata)!=null&&F.id&&(A.$feature_flag_id=z.metadata.id),ge(z==null?void 0:z.original_variant)&&ge(z==null?void 0:z.original_enabled)||(A.$feature_flag_original_response=ge(z.original_variant)?z.original_enabled:z.original_variant),z!=null&&(W=z.metadata)!=null&&W.original_payload&&(A.$feature_flag_original_payload=z==null||(ie=z.metadata)==null?void 0:ie.original_payload),q.length&&(A.$feature_flag_error=q.join(",")),this.do(A)}else n&&this.F({[Yi]:m,[fc]:n});if(a)return{key:e,enabled:!!o,variant:typeof o=="string"?o:void 0,payload:iy(u)}}}else this.st.warn('getFeatureFlagResult for key "'+e+jm)}do(e){try{var t;(t=this.Sn)==null||t.capture("$feature_flag_called",e).catch((n=>{this.st.error("Failed to capture feature flag call",n)}))}catch(n){this.st.error("Failed to capture feature flag call",n)}}getRemoteConfigPayload(e,t){this.vo(e,t)}vo(e,t){var n=this;return Pt((function*(){var r=n.Sn;if(r){var a={distinct_id:r.distinctId,token:r.projectToken,person_properties:{$lib:r.library.name,$lib_version:r.library.version}},o=n.so();o.length&&(a.evaluation_contexts=o);var u,f=n.ao();ge(f)||(a.flag_keys=f);try{var h,p=(h=(yield r.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:a,compression:n.qe.compression==="base64"?Yn.Base64:void 0,sentAt:"body",timeoutMs:n.qe.requestTimeoutMs})).json)==null?void 0:h.featureFlagPayloads;u=(p==null?void 0:p[e])||void 0}catch(m){return void n.st.error("Remote config feature flag request failed",m)}try{t(u)}catch(m){n.st.error("Remote config feature flag callback failed",m)}}}))()}isFeatureEnabled(e,t){if(t===void 0&&(t={}),t.fresh&&!this.Ha)return t.defaultValue;if(!(this.$a||this.getFlags()&&this.getFlags().length>0))return this.st.warn('isFeatureEnabled for key "'+e+jm),t.defaultValue;var n=this.getFeatureFlag(e,t);return ge(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.oo(e,t,n)}oo(e,t,n){if(this.Sn){this.$a=!0;var r=(function(a,o,u,f,h,p){o===void 0&&(o={}),u===void 0&&(u={}),f===void 0&&(f={}),p===void 0&&(p=f_);var m=((L,I)=>{var F=L.flags;return F?de({},L,{featureFlags:Object.fromEntries(Object.keys(F).map((W=>{var z;return[W,(z=F[W].variant)!==null&&z!==void 0?z:F[W].enabled]}))),featureFlagPayloads:Object.fromEntries(Object.keys(F).filter((W=>F[W].enabled)).filter((W=>{var z;return(z=F[W].metadata)==null?void 0:z.payload})).map((W=>{var z;return[W,(z=F[W].metadata)==null?void 0:z.payload]})))}):(L.featureFlags&&I.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),L)})(a,p),x=m.flags,b=m.featureFlags,y=m.featureFlagPayloads;if(b){var _=a.requestId,j=a.evaluatedAt;if(Ie(b)){p.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var N={};if(b)for(var S=0;b.length>S;S++)N[b[S]]=!0;return{[ja]:b,[Vi]:N,[sf]:!1}}var E=b,C=y,O=x;if(h!=null&&h.partialResponse)E=de({},o,E),C=de({},u,C),O=de({},f,O);else if(a.errorsWhileComputingFlags)if(x){var D=new Set(Object.keys(x).filter((L=>{var I;return!((I=x[L])!=null&&I.failed)})));E=de({},o,Object.fromEntries(Object.entries(E).filter((L=>D.has(L[0]))))),C=de({},u,Object.fromEntries(Object.entries(C||{}).filter((L=>D.has(L[0]))))),O=de({},f,Object.fromEntries(Object.entries(O||{}).filter((L=>D.has(L[0])))))}else E=de({},o,E),C=de({},u,C),O=de({},f,O);return de({[ja]:Object.keys(m_(E)),[Vi]:E||{},[Na]:C||{},[Mc]:O||{},[sf]:a.minimalFlagCalledEvents===!0},_?{[Dl]:_}:{},j?{[Ea]:j}:{})}})(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),n,this.st);r&&this.F(r),t||(this.Ua=!1),this.co(t)}}override(e,t){t===void 0&&(t=!1),this.st.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){this.fo(e)}fo(e){if(this.Sn){if(e===!1)return this.q([pi,ya]),this.co(),void ma.info("All overrides cleared");if(Ie(e))return this.F({[pi]:p_(e)}),this.co(),void ma.info("Flag overrides set",{flags:e});if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var t,n=e;this.Fa=!!((t=n.suppressWarning)!==null&&t!==void 0&&t);var r={},a=n.flags,o=n.payloads;return a&&(r[pi]=Ie(a)?p_(a):a),o&&(r[ya]=o),Object.keys(r).length&&this.F(r),a===!1&&o===!1?this.q([pi,ya]):a===!1?this.q(pi):o===!1&&this.q(ya),this.co(),a===!1?ma.info("Flag overrides cleared"):a&&ma.info("Flag overrides set",{flags:a}),void(o===!1?ma.info("Payload overrides cleared"):o&&ma.info("Payload overrides set",{payloads:o}))}if(e&&typeof e=="object")return this.F({[pi]:e}),this.co(),void ma.info("Flag overrides set",{flags:e});this.st.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}else this.st.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.$a){var t=this.po(),n=t.flags,r=t.flagVariants;try{e(n,r)}catch(a){this.st.error("Error while running feature flags callback",a)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,n){var r=(this.io(Od)||[]).find((h=>h.flagKey===e)),a={["$feature_enrollment/"+e]:t},o={$feature_flag:e,$feature_enrollment:t,$set:a};r&&(o.$early_access_feature_name=r.name),n&&(o.$feature_enrollment_stage=n);var u=de({},this.getFlagVariants(),{[e]:t});this.F({[ja]:Object.keys(m_(u)),[Vi]:u,[Kr]:de({},this.io(Kr)||{},a)}),this.co();try{var f;(f=this.Sn)==null||f.capture("$feature_enrollment_update",o).catch((h=>{this.st.error("Failed to capture early access feature enrollment",h)}))}catch(h){this.st.error("Failed to capture early access feature enrollment",h)}}getEarlyAccessFeatures(e,t,n){t===void 0&&(t=!1);var r=this.io(Od);!r||t?this.mo(e,n):e(r)}mo(e,t){var n=this;return Pt((function*(){var r=n.Sn;if(r){var a,o=t?"&"+t.map((f=>"stage="+f)).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.F({[Od]:a=u.json.earlyAccessFeatures})}catch(f){return void n.st.error("Early access feature request failed",f)}try{e(a)}catch(f){n.st.error("Early access feature callback failed",f)}}}))()}po(){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)),{})}}co(e){this.Xa();var t=this.po(),n=t.flags,r=t.flagVariants;this.featureFlagEventHandlers.forEach((a=>{try{a(n,r,{errorsLoading:e})}catch(o){this.st.error("Error while running feature flags callback",o)}}))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0),this.yo(e,t)}yo(e,t){t===void 0&&(t=!0);var n=this.io(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.F({[Kr]:de({},n,o,r)}),t&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=de({},this.io(Kr)||{});e.forEach((r=>{delete n[r]})),this.F({[Kr]:n}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e){e===void 0&&(e=!0),this.q(Kr),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this.io(xi)||{},r=de({},n);for(var a of Object.keys(e))r[a]=de({},n[a],e[a]);this.F({[xi]:r}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.io(xi)||{};this.F({[xi]:de({},t,{[e]:{}})})}else this.q(xi)}reset(){this.qa++,this.Ba=!1,this.Oa={},this.La={},this.$a=!1,this.ja=!1,this.Ha=!1,this.$anon_distinct_id=void 0,this.eo(),this.Fa=!1,this.za=0}}},xE={sessionRecording:class{get qe(){return this._instance.config}get jr(){return this._instance.persistence}get started(){var e;return!((e=this.bo)==null||!e.isStarted)}get status(){var e,t;return this._o===nc||this._o===wd?this._o:(e=(t=this.bo)==null?void 0:t.status)!==null&&e!==void 0?e:this._o}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this._o=s_,this.wo=void 0,this.ko=!1,this.xo=(()=>{var t;if(Se==null||!Se.visibilityState||Se.visibilityState==="visible")return!0;var n=re==null||(t=re.performance)==null||t.getEntriesByType==null?void 0:t.getEntriesByType("visibility-state");return!(n!=null&&n.length)||n.some((r=>r.name==="visible"))})(),this.Ee=()=>{var t;(Se==null?void 0:Se.visibilityState)==="visible"&&(this.xo=!0,(t=this.bo)==null||t.setDocumentWasEverVisible==null||t.setDocumentWasEverVisible(!0))},this._instance=e,!this._instance.sessionManager)throw Fi.error("started without valid sessionManager"),new Error(Bg+" started without valid sessionManager. This is a bug.");if(this.qe.cookieless_mode===Wi)throw new Error(Bg+' cannot be used with cookieless_mode="always"');Se!=null&&Se.addEventListener&&Xt(Se,"visibilitychange",this.Ee)}initialize(){this.startIfEnabledOrStop()}dispose(){this.ko=!0,Se==null||Se.removeEventListener==null||Se.removeEventListener("visibilitychange",this.Ee),this.stopRecording()}get So(){var e,t=!((e=this._instance.get_property(Sa))==null||!e.enabled),n=!this.qe.disable_session_recording,r=this.qe.disable_session_recording||this._instance.consent.isOptedOut();return re&&t&&n&&!r}startIfEnabledOrStop(e){var t;if(!(this.ko||this.So&&(t=this.bo)!=null&&t.isStarted)){var n=!ge(Object.assign)&&!ge(Array.from);this.So&&n?(this.Co(e),Fi.info("starting")):(this._o=s_,this.stopRecording())}}Co(e){var t,n,r;this.So&&(this._o!==nc&&this._o!==wd&&(this._o=a_),Oe!=null&&(t=Oe.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(n=Oe.__PosthogExtensions__)!=null&&n.initSessionRecording?this.Mo(e):(r=Oe.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,this.To,(a=>{if(a)return Fi.error("could not load recorder",a);this.Mo(e)})))}stopRecording(){var e,t;(e=this.wo)==null||e.call(this),this.wo=void 0,(t=this.bo)==null||t.stop()}Eo(){var e,t;(e=this.wo)==null||e.call(this),this.wo=void 0,(t=this.bo)==null||t.discard()}Io(){var e,t;(e=this.jr)==null||e.unregister(dx),(t=this.jr)==null||t.unregister(Lw)}Po(e,t){if(Ge(e))return null;var n,r=ln(e)?e:parseFloat(e);return typeof(n=r)!="number"||!Number.isFinite(n)||0>n||n>1?(Fi.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):r}Ro(e){if(this.jr){var t,n,r=this.jr,a=()=>{var o,u=e.sessionRecording===!1?void 0:e.sessionRecording,f=this.Po((o=this.qe.session_recording)==null?void 0:o.sampleRate,"session_recording.sampleRate"),h=this.Po(u==null?void 0:u.sampleRate,"remote config sampleRate"),p=f??h;Ge(p)&&this.Io();var m=u==null?void 0:u.minimumDurationMilliseconds;r.register({[Sa]: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:ge(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.wo)==null||t.call(this),this.wo=(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.Ro(t),void this.Eo()):(this.Ro(t),void this.startIfEnabledOrStop()):(this._o===nc&&(this._o=wd,Fi.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.bo)!=null&&n.log?this.bo.log(e,t):Fi.warn("log called before recorder was ready")}get To(){var e,t,n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(Sa);return(n==null||(t=n.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}Ao(){var e,t=this._instance.get_property(Sa);if(!t)return!1;try{e=typeof t=="object"?t:JSON.parse(t)}catch(n){return Fi.warn("persisted remote config for session recording is invalid and will be ignored",n),!1}return!Ge(e.cache_timestamp)&&36e5>=Date.now()-e.cache_timestamp}Mo(e){var t,n,r;if(!this.ko){if((t=Oe.__PosthogExtensions__)==null||!t.initSessionRecording)return Fi.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[qw]:!0});var a;if(this.bo||(this.bo=(a=Oe.__PosthogExtensions__)==null?void 0:a.initSessionRecording(this._instance,this.xo),this.bo._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Ao())return this._o===wd||this._o===nc?void 0:(this._o=nc,Fi.info("persisted remote config is stale, requesting fresh config before starting"),void new p2(this._instance).load());this._o=a_,(n=(r=this.bo).setDocumentWasEverVisible)==null||n.call(r,this.xo),this.bo.start(e)}}onRRwebEmit(e){var t;(t=this.bo)==null||t.onRRwebEmit==null||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.bo||(t=this.jr)==null||t.register({[zw]:!0}),(e=this.bo)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.bo||(t=this.jr)==null||t.register({[Dw]:!0}),(e=this.bo)==null||e.overrideSampling()}overrideTrigger(e){var t,n;this.bo||(n=this.jr)==null||n.register({[e==="url"?Ow:Bw]:!0}),(t=this.bo)==null||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.bo)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var n;return!((n=this.bo)==null||!n.tryAddCustomEvent(e,t))}}},vE={autocapture:class{constructor(e){this.Fo=!1,this.Oo=null,this.Lo=!1,this.Do=!1,this.instance=e,this.rageclicks=new n_(e.config.rageclick),this.$o=null}initialize(){this.startIfEnabled()}get qe(){var e,t,n=Ut(this.instance.config.autocapture)?this.instance.config.autocapture:{};return n.url_allowlist=(e=n.url_allowlist)==null?void 0:e.map((r=>new RegExp(r))),n.url_ignorelist=(t=n.url_ignorelist)==null?void 0:t.map((r=>new RegExp(r))),n}No(){if(this.isBrowserSupported()){if(re&&Se){var e=n=>{n=n||(re==null?void 0:re.event);try{this.qo(n)}catch(r){_m.error("Failed to capture event",r)}};if(Xt(Se,"submit",e,{capture:!0}),Xt(Se,"change",e,{capture:!0}),Xt(Se,"click",e,{capture:!0}),this.qe.capture_copied_text){var t=n=>{n=n||(re==null?void 0:re.event);try{this.qo(n,ym)}catch(r){_m.error("Failed to capture copy/cut event",r)}};Xt(Se,"copy",t,{capture:!0}),Xt(Se,"cut",t,{capture:!0})}}}else _m.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.Fo&&(this.No(),this.Fo=!0)}onRemoteConfig(e){if(this.Lo=!0,e.ok){var t=e.config;t.elementsChainAsString&&(this.Do=t.elementsChainAsString);var n=t.autocapture_opt_out;yr(n)&&(this.instance.persistence&&this.instance.persistence.register({[hg]:n}),this.Oo=n),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(e){this.$o=e}getElementSelectors(e){var t,n=[];return(t=this.$o)==null||t.forEach((r=>{var a=Se==null?void 0:Se.querySelectorAll(r);a==null||a.forEach((o=>{e===o&&n.push(r)}))})),n}get isEnabled(){var e,t,n=(e=this.instance.persistence)==null?void 0:e.props[hg],r=this.Oo,a=this.instance.hr()&&!this.Lo;if(jn(r)&&!yr(n)&&!a)return!1;var o=(t=this.Oo)!==null&&t!==void 0?t:!!n;return!!this.instance.config.autocapture&&!o}qo(e,t){if(t===void 0&&(t="$autocapture"),this.isEnabled){var n,r=om(e);Ww(r)&&(r=r.parentNode||null),t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&this.instance.config.rageclick&&(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime())&&Ay(r,this.instance.config.rageclick)&&this.qo(e,"$rageclick");var a=t===ym;if(r&&(function(x,b,y,_,j,N){var S;if(!re||gx(x)||y!=null&&y.url_allowlist&&!Cy(y.url_allowlist,N)||y!=null&&y.url_ignorelist&&Cy(y.url_ignorelist,N))return!1;if(y!=null&&y.dom_event_allowlist){var E=y.dom_event_allowlist;if(E&&!E.some((F=>b.type===F)))return!1}var C=e2(x,_),O=C.parentIsUsefulElement,D=C.targetElementList;if(!(function(F,W){var z=W==null?void 0:W.element_allowlist;if(ge(z))return!0;var q,A=function(K){if(z.some((G=>K.tagName.toLowerCase()===G)))return{v:!0}};for(var ie of F)if(q=A(ie))return q.v;return!1})(D,y)||!Eg(D,y==null?void 0:y.css_selector_allowlist)||Eg(D,(S=y==null?void 0:y.css_selector_ignorelist)!==null&&S!==void 0?S:p4))return!1;try{var L=re.getComputedStyle(x);if(L&&L.getPropertyValue("cursor")==="pointer"&&b.type==="click")return!0}catch{}var I=x.tagName.toLowerCase();switch(I){case"html":return!1;case"form":return(j||["submit"]).indexOf(b.type)>=0;case"input":case"select":case"textarea":return(j||["change","click"]).indexOf(b.type)>=0;default:return O?(j||["click"]).indexOf(b.type)>=0:(j||["click"]).indexOf(b.type)>=0&&(mx.indexOf(I)>-1||x.getAttribute("contenteditable")==="true")}})(r,e,this.qe,a,a?["copy","cut"]:void 0,this.instance)){var o=lE(r,{e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.qe.element_attribute_ignorelist,elementsChainAsString:this.Do,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}),u=o.props;if(o.explicitNoCapture)return!1;var f=this.getElementSelectors(r);if(f&&f.length>0&&(u.$element_selectors=f),t===ym){var h,p=Kw(re==null||(h=re.getSelection())==null?void 0:h.toString()),m=e.type||"clipboard";if(!p)return!1;u.$selected_content=p,u.$copy_type=m}return this.instance.capture(t,u),!0}}}isBrowserSupported(){return Gn(Se==null?void 0:Se.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this.jo=(re==null||(t=re.location)==null?void 0:t.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(ye.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.Bo&&this.Bo(),this.Bo=void 0,ye.info("History API monitoring stopped")}monitorHistoryChanges(){re&&re.history&&(this.Ho("pushState"),this.Ho("replaceState"),this.Uo())}Ho(e){var t;if(re&&((t=re.history[e])==null||!t.__posthog_wrapped__)){var n=this;(function(r,a,o){try{if(!(a in r))return r_;var u={next:r[a]},f=o((function(){for(var h=arguments.length,p=new Array(h),m=0;h>m;m++)p[m]=arguments[m];return u.next.apply(this,p)}));return Gn(f)&&(f.prototype=f.prototype||{},Object.defineProperties(f,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:u}})),r[a]=f,()=>{if(r[a]!==f)for(var h=r[a];Gn(h)&&h.__posthog_layer__;){var p=h.__posthog_layer__;if(p.next===f)return void(p.next=u.next);h=p.next}else r[a]=u.next}}catch{return r_}})(re.history,e,(r=>function(a,o,u){r.call(this,a,o,u),n.zo(e)}))}}zo(e){try{var t,n=re==null||(t=re.location)==null?void 0:t.pathname;if(!n)return;n!==this.jo&&this.isEnabled&&this._instance.capture(Nl,{navigation_type:e}),this.jo=n}catch(r){ye.error("Error capturing "+e+" pageview",r)}}Uo(){if(!this.Bo){var e=()=>{this.zo("popstate")};Xt(re,"popstate",e),this.Bo=()=>{re&&re.removeEventListener("popstate",e)}}}},heatmaps:class{get qe(){return this.instance.config}constructor(e){var t;this.Wo=!1,this.Fo=!1,this.Vo=null,this.instance=e,this.Wo=!((t=this.instance.persistence)==null||!t.props[pg]),this.rageclicks=new n_(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return Ut(this.qe.capture_heatmaps)&&this.qe.capture_heatmaps.flush_interval_milliseconds&&(e=this.qe.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return Ge(this.qe.capture_heatmaps)?Ge(this.qe.enable_heatmaps)?this.Wo:this.qe.enable_heatmaps:this.qe.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.Fo)return;cE.info("starting..."),this.Zo(),this.Ee()}else{var e;clearInterval((e=this.Vo)!==null&&e!==void 0?e:void 0),this.Go(),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({[pg]:n}),this.Wo=n,this.startIfEnabled()}}}getAndClearBuffer(){var e=this.R;return this.R=void 0,e}Qo(e){km(e.originalEvent)&&this.ke(e.originalEvent,"deadclick")}Ee(){this.Vo&&clearInterval(this.Vo),this.Vo=(Se==null?void 0:Se.visibilityState)==="visible"?setInterval(this.Ir.bind(this),this.flushIntervalMilliseconds):null}Zo(){re&&Se&&(this.Jo=this.Ir.bind(this),Xt(re,uf,this.Jo),this.Ko=e=>this.ke(e||(re==null?void 0:re.event)),Xt(Se,"click",this.Ko,{capture:!0}),this.Yo=e=>this.Xo(e||(re==null?void 0:re.event)),Xt(Se,"mousemove",this.Yo,{capture:!0}),this.tl=new By(this.instance,_4,this.Qo.bind(this)),this.tl.startIfEnabledOrStop(),this.el=this.Ee.bind(this),Xt(Se,cf,this.el),this.Fo=!0)}Go(){var e;re&&Se&&(this.Jo&&re.removeEventListener(uf,this.Jo),this.Ko&&Se.removeEventListener("click",this.Ko,{capture:!0}),this.Yo&&Se.removeEventListener("mousemove",this.Yo,{capture:!0}),this.el&&Se.removeEventListener(cf,this.el),clearTimeout(this.il),(e=this.tl)==null||e.stop(),this.Fo=!1)}rl(e,t){var n=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),a=this.instance.scrollManager.scrollElement(),o=(function(u,f,h){for(var p=u;p&&$s(p)&&!_r(p,"body");){if(p===h)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:re)==null?void 0:x.getComputedStyle(p).position}catch{return!1}if(Ve(f,m))return!0;p=Zw(p)}return!1})(om(e),["fixed","sticky"],a);return{x:e.clientX+(o?0:r),y:e.clientY+(o?0:n),target_fixed:o,type:t}}ke(e,t){var n;if(t===void 0&&(t="click"),!Ny(e.target)&&km(e)){var r=this.rl(e,t);(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&Ay(om(e),this.instance.config.rageclick)&&this.Gt(de({},r,{type:"rageclick"})),this.Gt(r)}}Xo(e){!Ny(e.target)&&km(e)&&(clearTimeout(this.il),this.il=setTimeout((()=>{this.Gt(this.rl(e,"mousemove"))}),500))}Gt(e){if(re){var t=this.qe.disable_capture_url_hashes?Ps(re.location.href):re.location.href,n=this.qe.custom_personal_data_properties,r=this.qe.mask_personal_data_properties?[...ql,...n||[]]:[],a=Lc(t,r,Dc);this.R=this.R||{},this.R[a]||(this.R[a]=[]),this.R[a].push(e)}}Ir(){this.R&&!Jr(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:By,webVitalsAutocapture:class{constructor(e){var t;this.Wo=!1,this.Fo=!1,this.R={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.nl=()=>{clearTimeout(this.sl),this.sl=void 0,this.R.metrics.length!==0&&(this._instance.capture("$web_vitals",de({$current_url:this.R.url},this.R.metrics.reduce(((n,r)=>de({},n,{["$web_vitals_"+r.name+"_event"]:de({},r),["$web_vitals_"+r.name+"_value"]:r.value})),{}))),this.R={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.al=n=>{var r;if(this.R=this.R||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},Ge(n==null?void 0:n.name)||Ge(n==null?void 0:n.value))pa.error("Invalid metric received",n);else{var a=typeof n.navigationURL=="string"?n.navigationURL:void 0,o=this.ol(a);if(!ge(o)){var u=ln(n.navigationId)||typeof n.navigationId=="string"?"navigation:"+n.navigationId:"url:"+o;if(!this.ll||this.ll>n.value){this.R.navigationKey!==u&&(this.nl(),this.sl=setTimeout(this.nl,this.flushToCaptureTimeoutMs)),ge(this.R.navigationKey)&&(this.R.navigationKey=u,this.R.url=o),this.R.firstMetricTimestamp=ge(this.R.firstMetricTimestamp)?Date.now():this.R.firstMetricTimestamp,n.attribution&&n.attribution.interactionTargetElement&&(n.attribution.interactionTargetElement=void 0);var f=(r=this._instance.sessionManager)==null?void 0:r.checkAndGetSessionAndWindowId(!0),h=de({},n,a?{navigationURL:o}:{},{$current_url:o,timestamp:Date.now()});ge(f)||(h.$session_id=f.sessionId,h.$window_id=f.windowId),this.R.metrics.push(h),this.R.metrics.length===this.allowedMetrics.length&&this.nl()}else pa.error("Ignoring metric with value >= "+this.ll,n)}}},this.ul=()=>{if(!this.Fo){var n,r,a,o,u=Oe.__PosthogExtensions__,f=u==null?void 0:u.postHogWebVitalsCallbacksByFlavor,h=(f==null?void 0:f[this.hl])||(this.hl==="web-vitals"&&ge(f)?u==null?void 0:u.postHogWebVitalsCallbacks:void 0);if(ge(h)||(n=h.onLCP,r=h.onCLS,a=h.onFCP,o=h.onINP),n&&r&&a&&o){var p={reportSoftNavs:this.useSoftNavs};this.allowedMetrics.indexOf("LCP")>-1&&n(this.al.bind(this),p),this.allowedMetrics.indexOf("CLS")>-1&&r(this.al.bind(this),p),this.allowedMetrics.indexOf("FCP")>-1&&a(this.al.bind(this),p),this.allowedMetrics.indexOf("INP")>-1&&o(this.al.bind(this),p),this.Fo=!0}else pa.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.Wo=!((t=this._instance.persistence)==null||!t.props[vg]),this.startIfEnabled()}get dl(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,n=Ut(this.dl)?(e=this.dl)==null?void 0:e.web_vitals_allowed_metrics:void 0;return Ge(n)?((t=this._instance.persistence)==null?void 0:t.props[bg])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return(Ut(this.dl)?this.dl.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=Ut(this.dl)?this.dl.web_vitals_attribution:void 0;return e!=null&&e}get useSoftNavs(){var e=Ut(this.dl)?this.dl.__preview_web_vitals_soft_navs:void 0;return e!=null&&e}get ll(){var e=Ut(this.dl)&&ln(this.dl.__web_vitals_max_value)?this.dl.__web_vitals_max_value:i_;return e>0&&6e4>=e?i_:e}get isEnabled(){var e=Qt==null?void 0:Qt.protocol;if(e!=="http:"&&e!=="https:")return pa.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=Ut(this.dl)?this.dl.web_vitals:yr(this.dl)?this.dl:void 0;return yr(t)?t:this.Wo}startIfEnabled(){this.isEnabled&&!this.Fo&&(pa.info("enabled, starting..."),this.di(this.ul))}onRemoteConfig(e){if(e.ok){var t=e.config;if("capturePerformance"in t){var n=Ut(t.capturePerformance)&&!!t.capturePerformance.web_vitals,r=Ut(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[vg]:n}),this._instance.persistence.register({[bg]:r})),this.Wo=n,this.startIfEnabled()}}}get hl(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}di(e){var t=Oe.__PosthogExtensions__,n=this.hl,r=t==null?void 0:t.postHogWebVitalsCallbacksByFlavor;r!=null&&r[n]||n==="web-vitals"&&ge(r)&&t!=null&&t.postHogWebVitalsCallbacks?e():t==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,n,(a=>{a?pa.error("failed to load script",a):e()}))}ol(e){var t=e||(re==null?void 0:re.location.href);if(t){var n=this._instance.config.disable_capture_url_hashes?Ps(t):t,r=this._instance.config.custom_personal_data_properties,a=this._instance.config.mask_personal_data_properties?[...ql,...r||[]]:[];return Lc(n,a,Dc)}pa.error("Could not determine current URL")}}},bE={exceptionObserver:class{constructor(e){var t;this.ul=()=>{var n;if(re&&this.isEnabled&&(n=Oe.__PosthogExtensions__)!=null&&n.errorWrappingFunctions){var r=Oe.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,a=Oe.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,o=Oe.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.vl&&this.qe.capture_unhandled_errors&&(this.vl=r(this.captureException.bind(this))),!this.cl&&this.qe.capture_unhandled_rejections&&(this.cl=a(this.captureException.bind(this))),!this.fl&&this.qe.capture_console_errors&&(this.fl=o(this.captureException.bind(this)))}catch(u){tc.error("failed to start",u),this.pl()}}},this._instance=e,this.gl=!((t=this._instance.persistence)==null||!t.props[mg]),this.ml=new x3(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,st:tc})),this.qe=this.yl(),this.startIfEnabledOrStop()}yl(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Ut(e)?t=de({},t,e):(ge(e)?this.gl:e)&&(t=de({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.qe.capture_console_errors||this.qe.capture_unhandled_errors||this.qe.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(tc.info("enabled"),this.pl(),this.di(this.ul)):this.pl()}di(e){var t,n;(t=Oe.__PosthogExtensions__)!=null&&t.errorWrappingFunctions?e():(n=Oe.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",(r=>{if(r)return tc.error("failed to load script",r);e()}))}pl(){var e,t,n;(e=this.vl)==null||e.call(this),this.vl=void 0,(t=this.cl)==null||t.call(this),this.cl=void 0,(n=this.fl)==null||n.call(this),this.fl=void 0}onRemoteConfig(e){if(e.ok){var t=e.config;"autocaptureExceptions"in t&&(this.gl=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[mg]:this.gl}),this.qe=this.yl(),this.startIfEnabledOrStop())}}onConfigChange(){this.qe=this.yl()}captureException(e){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";this.ml.consumeRateLimit(a)?tc.info("Skipping exception capture because of client rate limiting.",{exception:a}):(r=this._instance.exceptions)==null||r.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,n;this.bl=[],this._l=new L3([new U3,new X3,new H3,new q3,new W3,new Y3,new V3,new Q3],(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(f,h){h===void 0&&(h=0);for(var p=[],m=f.split(`
68
- `),x=h;m.length>x;x++){var b=m[x];if(1024>=b.length){var y=by.test(b)?b.replace(by,"$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 S=Array.from(N);return S.reverse(),S.slice(0,50).map((E=>{return de({},E,{filename:E.filename||(C=S,C[C.length-1]||{}).filename,function:E.function||$l});var C}))})(p)}})("web:javascript",B3,F3)),this._instance=e,this.bl=(t=(n=this._instance.persistence)==null?void 0:n.get_property(gg))!==null&&t!==void 0?t:[],this.wl=nf(this.kl()),this.xl=new Z3(this.wl)}onConfigChange(){this.wl=nf(this.kl()),this.xl.setConfig(this.wl)}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.bl=o,this._instance.persistence&&this._instance.persistence.register({[gg]:this.bl,[xg]:u})}}}get Sl(){var e,t=!!this._instance.get_property(xg),n=this._instance.config.error_tracking.captureExtensionExceptions;return(e=n??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this._l.buildFromUnknown(e,{syntheticException:t==null?void 0:t.syntheticException,mechanism:{handled:t==null?void 0:t.handled}})}addExceptionStep(e,t){if(this.wl.enabled)try{if(!gt(e)||e.trim().length===0)return void fi.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(((f,h)=>K3.has(h)?(u.push(h),f):(f[h]=o[h],f)),{}),droppedKeys:u}})(this.Cl(t)),r=n.sanitizedProperties,a=n.droppedKeys;a.length>0&&fi.warn("Ignoring reserved exception step fields",{droppedKeys:a}),this.xl.add(de({[ef]:e,[tf]:new Date().toISOString()},r))}catch(o){fi.error("Failed to add exception step. Ignoring breadcrumb.",o)}}sendExceptionEvent(e){try{var t=e.$exception_list;if(this.Ml(t)){if(this.Tl(t))return this.El("Exception dropped: matched a suppression rule"),void fi.info("Skipping exception capture because a suppression rule matched");if(!this.Sl&&this.Il(t))return this.El("Exception dropped: thrown by a browser extension"),void fi.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Pl(t))return this.El("Exception dropped: thrown by the PostHog SDK"),void fi.info("Skipping exception capture because it was thrown by the PostHog SDK")}var n=this.wl.enabled&&Ge(e.$exception_steps)?this.Rl(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",vs:!0});return a&&this.xl.clear(),a}catch(u){return fi.error("Failed to capture exception event. Dropping this exception.",u),void this.xl.clear()}}catch(u){return void fi.error("Failed to process exception event. Ignoring this exception.",u)}var o}Rl(e){try{var t=this.xl.getAttachable();return t.length===0?e:de({},e,{$exception_steps:t})}catch(n){return fi.error("Failed to read buffered exception steps. Capturing exception without steps.",n),e}}El(e){this.wl.enabled&&this.xl.add({[ef]:e,[tf]:new Date().toISOString()})}Cl(e){return Ut(e)?de({},e):{}}kl(){var e,t;return(e=(t=this._instance.config.error_tracking)==null?void 0:t.exception_steps)!==null&&e!==void 0?e:{}}Tl(e){if(e.length===0)return!1;try{var t=e.reduce(((n,r)=>{var a=r.type,o=r.value;return gt(a)&&a.length>0&&n.$exception_types.push(a),gt(o)&&o.length>0&&n.$exception_values.push(o),n}),{$exception_types:[],$exception_values:[]});return this.bl.some((n=>{var r=n.values.map((a=>{var o=E2[a.operator],u=t[a.key];if(!o||!u)return!1;var f=Ie(a.value)?a.value:[a.value];return f.length>0&&o(f,u)}));return n.type==="OR"?r.some(Boolean):r.every(Boolean)}))}catch(n){return fi.warn("Failed to evaluate suppression rules. Capturing the exception.",n),!1}}Il(e){return e.flatMap((t=>{var n,r;return(n=(r=t.stacktrace)==null?void 0:r.frames)!==null&&n!==void 0?n:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}Pl(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}Ml(e){return!Ge(e)&&Ie(e)}}},yE=de({productTours:class{get jr(){return this._instance.persistence}constructor(e){this.Al=null,this.Fl=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.jr&&this.jr.register({[ux]:!!t.productTours}),!Sm(this._instance))return!this.Al&&Ge((n=this.jr)==null?void 0:n.props[dc])||kd.info("product tours disabled; stopping and clearing cached tours"),(r=this.Al)==null||r.stop(),this.Al=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.Al&&Sm(this._instance)&&this.di((()=>this.Ol()))}di(e){var t,n;(t=Oe.__PosthogExtensions__)!=null&&t.generateProductTours?e():(n=Oe.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"product-tours",(r=>{r?kd.error("Could not load product tours script",r):e()}))}Ol(){var e;!this.Al&&(e=Oe.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.Al=Oe.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(t===void 0&&(t=!1),!Ie(this.Fl)||t){var n=this.jr;if(n){var r=n.props[dc];if(Ie(r)&&!t)return this.Fl=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(Sm(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||kd.warn(u):kd.error(u),void e([],{isLoaded:!1,error:u})}var f=Ie(a.json.product_tours)?a.json.product_tours:[];this.Fl=f,n&&n.register({[dc]:f}),e(f,{isLoaded:!0})}else e([],{isLoaded:!0})}})}else e(this.Fl,{isLoaded:!0})}getActiveProductTours(e){Ge(this.Al)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.Al.getActiveProductTours(e)}showProductTour(e){var t;(t=this.Al)==null||t.showTourById(e)}previewTour(e){this.Al?this.Al.previewTour(e):this.di((()=>{var t;this.Ol(),(t=this.Al)==null||t.previewTour(e)}))}dismissProductTour(){var e;(e=this.Al)==null||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.Al)==null||e.nextStep()}previousStep(){var e;(e=this.Al)==null||e.previousStep()}clearCache(){var e;this.Fl=null,(e=this.jr)==null||e.unregister(dc)}resetTour(e){var t;(t=this.Al)==null||t.resetTour(e)}resetAllTours(){var e;(e=this.Al)==null||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.Al)==null||t.cancelPendingTour(e)}}},Af),_E={siteApps:class{constructor(e){this.Ll=0,this._instance=e,this.Dl=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}$l(e,t){if(t){var n=this.globalsForEvent(t);this.Dl.push(n),this.Dl.length>1e3&&(this.Dl=this.Dl.slice(10))}}get siteAppLoaders(){var e;return(e=Oe._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.$l.bind(this));this.Nl=()=>{e(),this.Dl=[],this.Nl=void 0}}}globalsForEvent(e){var t,n,r,a,o,u,f;if(!e)throw new Error("Event payload is required");var h={},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];h[b]={id:p[b],type:b,properties:x[1]}}var y=e.$set_once,_=e.$set;return{event:de({},X5(e,uE),{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:(f=e.properties)==null?void 0:f.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:h}}ql(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)||(di.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)||(di.error("prepare_external_dependency_script returned null"),null):e}jl(){var e,t,n,r,a,o,u,f;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var h=Se==null?void 0:Se.defaultView,p=h==null||(e=h.Node)==null?void 0:e.prototype;if(!h||!p)return()=>{};if(this.Ll++,this.Bl)return this.Hl();var m=[],x=this,b=new WeakSet,y=(N,S,E)=>{if(N!=null&&N[S]){var C=N[S];N[S]=E(C),m.push((()=>{N[S]=C}))}},_=N=>{if(b.has(N))return N;var S=x.ql(N);return S&&b.add(S),S},j=N=>N.map((S=>typeof S=="string"?S:_(S))).filter((S=>!jn(S)));return y(p,"appendChild",(N=>function(S){var E=_(S);return E?N.call(this,E):S})),y(p,"insertBefore",(N=>function(S,E){var C=_(S);return C?N.call(this,C,E):S})),y(p,"replaceChild",(N=>function(S,E){var C=_(S);return C?N.call(this,C,E):E})),[(t=h.Element)==null?void 0:t.prototype,(n=h.Document)==null?void 0:n.prototype,(r=h.DocumentFragment)==null?void 0:r.prototype].forEach((N=>{y(N,"append",(S=>function(){for(var E=arguments.length,C=new Array(E),O=0;E>O;O++)C[O]=arguments[O];return S.apply(this,j(C))})),y(N,"prepend",(S=>function(){for(var E=arguments.length,C=new Array(E),O=0;E>O;O++)C[O]=arguments[O];return S.apply(this,j(C))}))})),[(a=h.Element)==null?void 0:a.prototype,(o=h.CharacterData)==null?void 0:o.prototype,(u=h.DocumentType)==null?void 0:u.prototype].forEach((N=>{y(N,"before",(S=>function(){for(var E=arguments.length,C=new Array(E),O=0;E>O;O++)C[O]=arguments[O];return S.apply(this,j(C))})),y(N,"after",(S=>function(){for(var E=arguments.length,C=new Array(E),O=0;E>O;O++)C[O]=arguments[O];return S.apply(this,j(C))})),y(N,"replaceWith",(S=>function(){for(var E=arguments.length,C=new Array(E),O=0;E>O;O++)C[O]=arguments[O];var D=j(C);return C.length&&!D.length?void 0:S.apply(this,D)}))})),y((f=h.Element)==null?void 0:f.prototype,"insertAdjacentElement",(N=>function(S,E){var C=_(E);return C?N.call(this,S,C):null})),this.Bl=()=>{m.forEach((N=>N())),this.Bl=void 0},this.Hl()}Hl(){var e=!1;return()=>{var t;e||(e=!0,this.Ll--,this.Ll===0&&((t=this.Bl)==null||t.call(this)))}}Ul(e,t){t===void 0&&(t=!0);var n=this.jl();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.Dl.length&&(di.info("Processing "+this.Dl.length+" events for site app with id "+e.id),this.Dl.forEach((f=>this.Ul((()=>t.processEvent==null?void 0:t.processEvent(f))))),t.processedBuffer=!0),Object.values(this.apps).every((f=>f.processedBuffer||f.errored))&&((u=this.Nl)==null||u.call(this))},r=!1,a=u=>{t.errored=!u,t.loaded=!0,di.info("Site app with id "+e.id+" "+(u?"loaded":"errored")),r&&n()};try{var o=this.Ul((u=>e.init({posthog:this._instance,callback(f){u(),a(f)}})),!1).processEvent;o&&(t.processEvent=o),r=!0}catch(u){di.error(l_+e.id,u),a(!1)}if(r&&t.loaded)try{n()}catch(u){di.error("Error while processing buffered events PostHog app with config id "+e.id,u),t.errored=!0}}zl(){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)}Wl(e){var t=this;if(Object.keys(this.apps).length!==0){var n=this.globalsForEvent(e),r=function(o){try{t.Ul((()=>o.processEvent==null?void 0:o.processEvent(n)))}catch(u){di.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.zl(),void this._instance.on("eventCaptured",(h=>this.Wl(h)))):void di.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.Nl)==null||n.call(this),e.ok){var o=e.config;if((r=o.siteApps)!=null&&r.length)if(this.isEnabled){var u=function(){var h,p=f.id,m=f.url;Oe["__$$ph_site_app_"+p]=a._instance,(h=Oe.__PosthogExtensions__)==null||h.loadSiteApp==null||h.loadSiteApp(a._instance,m,(x=>{if(x)return di.error(l_+p,x)}))};for(var f of o.siteApps)u()}else di.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},wE={tracingHeaders:class{constructor(e){this.Vl=void 0,this.Zl=void 0,this.Gl=void 0,this.ul=()=>{var t,n,r=this.Ql();r?(ge(this.Vl)&&(this.Vl=(t=Oe.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null?void 0:t._patchXHR(r,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),ge(this.Zl)&&(this.Zl=(n=Oe.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null?void 0:n._patchFetch(r,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.pl()},this._instance=e}initialize(){this.startIfEnabledOrStop()}di(e){var t,n;(t=Oe.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns?e():(n=Oe.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",(r=>{if(r)return oE.error("failed to load script",r);e()}))}Jl(){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}Ql(){var e=this.Jl();return Ie(e)?(Ie(this.Gl)?this.Gl.splice(0,this.Gl.length,...e):this.Gl=[...e],e.length>0?this.Gl:void 0):(Ie(this.Gl)&&this.Gl.splice(0),this.Gl=e||void 0,this.Gl)}pl(){var e,t;(e=this.Vl)==null||e.call(this),(t=this.Zl)==null||t.call(this),this.Vl=void 0,this.Zl=void 0}startIfEnabledOrStop(){this.Ql()?this.di(this.ul):this.pl()}}},kE=de({surveys:class{get qe(){return this._instance.config}constructor(e){this.Kl=void 0,this._surveyManager=null,this.Yl=!1,this.Xl=[],this.tu=null,this.eu=null,this._instance=e,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this.qe.disable_surveys){if(!e.ok)return Nt.warn("Remote config unavailable. Not loading surveys.");var t=e.config.surveys;if(Ge(t))return Nt.warn("Flags not loaded yet. Not loading surveys.");var n=Ie(t);this.Kl=n?t.length>0:t,Nt.info("flags response received, isSurveysEnabled: "+this.Kl),this.loadIfEnabled()}}reset(){try{var e;(e=this._surveyEventReceiver)==null||e.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var t=[],n=0;n<localStorage.length;n++){var r=localStorage.key(n);(r!=null&&r.startsWith(M2)||r!=null&&r.startsWith("inProgressSurvey_"))&&t.push(r)}t.forEach((a=>localStorage.removeItem(a)))}catch{}}loadIfEnabled(){if(!this._surveyManager)if(this.Yl)Nt.info("Already initializing surveys, skipping...");else if(this.qe.disable_surveys)Nt.info(o_);else if(this.qe.cookieless_mode&&this._instance.consent.isOptedOut())Nt.info("Not loading surveys in cookieless mode without consent.");else{var e=Oe==null?void 0:Oe.__PosthogExtensions__;if(e){if(!ge(this.Kl)||this.qe.advanced_enable_surveys){var t=this.Kl||this.qe.advanced_enable_surveys;this.Yl=!0;try{var n=e.generateSurveys;if(n)return void this.iu(n,t);var r=e.loadExternalDependency;if(!r)return void this.ru(fx);r(this._instance,"surveys",(a=>{a||!e.generateSurveys?this.ru("Could not load surveys script",a):this.iu(e.generateSurveys,t)}))}catch(a){throw this.ru("Error initializing surveys",a),a}finally{this.Yl=!1}}}else Nt.error("PostHog Extensions not found.")}}iu(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new hE(this._instance),Nt.info("Surveys loaded successfully"),this.nu({isLoaded:!0})}ru(e,t){Nt.error(e,t),this.nu({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Xl.push(e),this._surveyManager&&this.nu({isLoaded:!0}),()=>{this.Xl=this.Xl.filter((t=>t!==e))}}getSurveys(e,t){if(t===void 0&&(t=!1),this.qe.disable_surveys)return Nt.info(o_),e([]);var n,r=this._instance.get_property(yg);if(r&&!t)return e(r,{isLoaded:!0}),void(this.su()&&this.getSurveys((()=>{}),!0));typeof Promise<"u"&&this.tu?this.tu.then((a=>e(a.surveys,a.context))):(typeof Promise<"u"&&(this.tu=new Promise((a=>{n=a}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.qe.token),method:"GET",timestampMode:"query",timeout:this.qe.surveys_request_timeout_ms,callback:a=>{var o;this.tu=null;var u=a.statusCode;if(u!==200||!a.json){var f="Surveys API could not be loaded, status: "+u;u!==0?Nt.error(f):a.error||Nt.warn(f),this.eu=Date.now();var h={isLoaded:!1,error:f};return e([],h),void(n==null||n({surveys:[],context:h}))}this.eu=null;var p,m=a.json.surveys||[],x=m.filter((y=>(function(_){return!(!_.start_date||_.end_date)})(y)&&(A2(y)||(function(_){var j;return!((j=_.conditions)==null||(j=j.actions)==null||(j=j.values)==null||!j.length)})(y))));x.length>0&&((p=this._surveyEventReceiver)==null||p.register(x)),(o=this._instance.persistence)==null||o.register({[yg]:m,[af]:Date.now()});var b={isLoaded:!0};e(m,b),n==null||n({surveys:m,context:b})}}))}su(){return this.au()&&!this.tu&&!this.ou()}au(){var e=this._instance.get_property(af);return ln(e)&&Date.now()-e>3e5}ou(){return ln(this.eu)&&3e5>Date.now()-this.eu}markSurveyAsSeen(e,t){var n,r={id:e,current_iteration:(n=t==null?void 0:t.iteration)!==null&&n!==void 0?n:null};R2(r);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}}nu(e){for(var t of this.Xl)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(n){Nt.error("Error in survey callback",n)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!Ge(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);Nt.warn("init was not called")}lu(e){var t=null;return this.getSurveys((n=>{var r;t=(r=n.find((a=>a.id===e)))!==null&&r!==void 0?r:null})),t}uu(e){if(Ge(this._surveyManager))return{eligible:!1,reason:Sd};var t=typeof e=="string"?this.lu(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}hu(e){if(Ge(this._surveyManager))return{eligible:!1,reason:Sd};var t=typeof e=="string"?this.lu(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(Ge(this._surveyManager))return Nt.warn("init was not called"),{visible:!1,disabledReason:Sd};var t=this.hu(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return Ge(this._surveyManager)?(Nt.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Sd})):new Promise((n=>{this.getSurveys((r=>{var a,o=(a=r.find((f=>f.id===e)))!==null&&a!==void 0?a:null;if(o){var u=this.hu(o);n({visible:u.eligible,disabledReason:u.reason})}else n({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t,n){var r;if(Ge(this._surveyManager))Nt.warn("init was not called");else{var a=typeof e=="string"?this.lu(e):e;if(a!=null&&a.id)if(Q4.includes(a.type)){var o=Se==null?void 0:Se.querySelector(t);if(o)return(r=a.appearance)!=null&&r.surveyPopupDelaySeconds?(Nt.info("Rendering survey "+a.id+" with delay of "+a.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var u,f;Nt.info("Rendering survey "+a.id+" with delay of "+((u=a.appearance)==null?void 0:u.surveyPopupDelaySeconds)+" seconds"),(f=this._surveyManager)==null||f.renderSurvey(a,o,n),Nt.info("Survey "+a.id+" rendered")}),1e3*a.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(a,o,n);Nt.warn("Survey element not found")}else Nt.warn("Surveys of type "+a.type+" cannot be rendered in the app");else Nt.warn("Survey not found")}}displaySurvey(e,t){var n;if(Ge(this._surveyManager))Nt.warn("init was not called");else{var r=this.lu(e);if(r){var a=r;if((n=r.appearance)!=null&&n.surveyPopupDelaySeconds&&t.ignoreDelay&&(a=de({},r,{appearance:de({},r.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==Ag.Popover&&t.initialResponses&&Nt.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){var o=this.uu(r);if(!o.eligible)return void Nt.warn("Survey is not eligible to be displayed: ",o.reason)}t.displayType!==Ag.Inline?this._surveyManager.handlePopoverSurvey(a,t):this.renderSurvey(a,t.selector,t.properties)}else Nt.warn("Survey not found")}}cancelPendingSurvey(e){Ge(this._surveyManager)?Nt.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload==null||e.handlePageUnload()}}},Af),SE={toolbar:class{constructor(e){this.instance=e}du(e){Oe.ph_toolbar_state=e}vu(){var e;return(e=Oe.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),Cg(this.instance.config)||!re||!Se)return!1;e=e??re.location,n=n??re.history;try{if(!t){try{re.localStorage.setItem("test","test"),re.localStorage.removeItem("test")}catch{return!1}t=re==null?void 0:re.localStorage}var r,a=pE||pf(e.hash,"__posthog")||pf(e.hash,"state"),o=a?wy((()=>JSON.parse(atob(decodeURIComponent(a)))))||wy((()=>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(c_)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch{return!1}}cu(e){var t=Oe.ph_load_toolbar||Oe.ph_load_editor;!Ge(t)&&Gn(t)?t(e,this.instance):u_.warn("No toolbar load function found")}loadToolbar(e){var t=!(Se==null||!Se.getElementById(Yw));if(!re||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(re.localStorage.setItem(c_,JSON.stringify(de({},r,{source:void 0}))),this.vu()===2)this.cu(r);else if(this.vu()===0){var a;this.du(1),(a=Oe.__PosthogExtensions__)==null||a.loadExternalDependency==null||a.loadExternalDependency(this.instance,"toolbar",(o=>{if(o)return u_.error("[Toolbar] Failed to load",o),void this.du(0);this.du(2),this.cu(r)})),Xt(re,"turbolinks:load",(()=>{this.du(0),this.loadToolbar(r)}))}return!0}fu(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)}}},jE=de({experiments:On},Af),NE={conversations:class{constructor(e){this.pu=void 0,this._conversationsManager=null,this.gu=!1,this.mu=null,this.yu=!1,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations&&(this.bu=e.ok,e.ok)){var t=e.config.conversations;Ge(t)||(yr(t)?this.pu=t:(this.pu=t.enabled,this.mu=t),this.loadIfEnabled())}}reset(){var e;(e=this._conversationsManager)==null||e.reset(),this._conversationsManager=null,this.pu=void 0,this.mu=null,this.bu=void 0,this.yu=!1}loadIfEnabled(){if(!(this._conversationsManager||this.gu||this._instance.config.disable_conversations||Cg(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=Oe==null?void 0:Oe.__PosthogExtensions__;if(e&&!ge(this.pu)&&this.pu)if(this.mu&&this.mu.token){this.gu=!0;try{var t=e.initConversations;if(t)return this._u(t),void(this.gu=!1);var n=e.loadExternalDependency;if(!n)return void this.wu(fx);n(this._instance,"conversations",(r=>{r||!e.initConversations?this.wu("Could not load conversations script",r):this._u(e.initConversations),this.gu=!1}))}catch(r){this.wu("Error initializing conversations",r),this.gu=!1}}else Pr.error("Conversations enabled but missing token in remote config.")}}_u(e){if(this.mu)try{this._conversationsManager=e(this.mu,this._instance),this.yu=!1,Pr.info("Conversations loaded successfully")}catch(t){this.wu("Error completing conversations initialization",t)}else Pr.error("Cannot complete initialization: remote config is null")}wu(e,t){Pr.error(e,t),this._conversationsManager=null,this.gu=!1,this.yu=!0}show(){this._conversationsManager?this._conversationsManager.show():Pr.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.pu===!0&&!jn(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":Cg(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":this.bu===!1?"remote_config_failed":ge(this.pu)?this.bu?"disabled_in_project":"remote_config_pending":this.pu?Ge(this.mu)||!this.mu.token?"missing_token":Oe!=null&&Oe.__PosthogExtensions__?this.gu?"initializing":this.yu?"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 Pt((function*(){return r._conversationsManager?r._conversationsManager.sendMessage(e,t,n):(Pr.warn(ga),null)}))()}getMessages(e,t){var n=this;return Pt((function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(Pr.warn(ga),null)}))()}markAsRead(e){var t=this;return Pt((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(Pr.warn(ga),null)}))()}getTickets(e){var t=this;return Pt((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(Pr.warn(ga),null)}))()}requestRestoreLink(e){var t=this;return Pt((function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(Pr.warn(ga),null)}))()}restoreFromToken(e){var t=this;return Pt((function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(Pr.warn(ga),null)}))()}restoreFromUrlToken(){var e=this;return Pt((function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(Pr.warn(ga),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}ks(){var e;(e=this._conversationsManager)==null||e.setIdentity()}xs(){var e;(e=this._conversationsManager)==null||e.clearIdentity()}}},CE={logs:class{constructor(e){var t,n=this;this.ku=!1,this.xu=!1,this.st=Vt("[logs]"),this.Su=de({},this.st,{error(){for(var r=arguments.length,a=new Array(r),o=0;r>o;o++)a[o]=arguments[o];a.some(v_)||n.st.error(...a)}}),this.gr=[],this.Cu=[],this.za=0,this.Mu=()=>{var r,a;this.za=0,(r=this.Tu)==null||r.onReconnect(),(a=this.Eu)==null||a.onReconnect()},this._instance=e,this._instance&&(t=this._instance.config.logs)!=null&&t.captureConsoleLogs&&(this.ku=!0),re&&Xt(re,"online",this.Mu)}Iu(e,t,n,r){var a,o=(function(u,f){var h,p,m,x,b,y,_,j=(h=u==null?void 0:u.flushIntervalMs)!==null&&h!==void 0?h:3e3,N=(p=u==null?void 0:u.maxBufferSize)!==null&&p!==void 0?p:100,S=f!=null&&f.consoleCapture?void 0:(m=u==null?void 0:u.maxLogsPerInterval)!==null&&m!==void 0?m:1e3,E=ge(S)?Math.max(N,2048):Math.max(N,S),C=u==null?void 0:u.resourceAttributes;return{serviceName:(x=(b=C==null?void 0:C["service.name"])!==null&&b!==void 0?b:u==null?void 0:u.serviceName)!==null&&x!==void 0?x:f==null?void 0:f.serviceNameDefault,serviceVersion:(y=C==null?void 0:C["service.version"])!==null&&y!==void 0?y:u==null?void 0:u.serviceVersion,environment:(_=C==null?void 0:C["deployment.environment"])!==null&&_!==void 0?_:u==null?void 0:u.environment,resourceAttributes:C,beforeSend:u==null?void 0:u.beforeSend,flushIntervalMs:j,maxBufferSize:N,maxQueueSize:E,maxBatchRecordsPerPost:100,rateCapWindowMs:j,maxLogsPerInterval:S,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}})((a=this._instance)==null||(a=a.config)==null?void 0:a.logs,n);return[new A3(this.Pu(e,t),o,this.Su,(()=>this.Ru()),(u=>u()),void 0,r),o]}Au(){var e,t=(e=this._instance)==null||(e=e.config)==null?void 0:e.logs;if(!this.Tu||this.Fu!==t){var n;(n=this.Tu)==null||n.reset(),this.Fu=t;var r=this.Iu((()=>this.gr),(a=>{this.gr=a}));this.Tu=r[0],this.Ou=r[1]}return this.Tu}Lu(){var e,t=(e=this._instance)==null||(e=e.config)==null?void 0:e.logs;if(!this.Eu||this.Du!==t){var n;(n=this.Eu)==null||n.reset(),this.Du=t;var r=this.Iu((()=>this.Cu),(a=>{this.Cu=a}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},x_);this.Eu=r[0],this.$u=r[1]}return this.Eu}initialize(){this.loadIfEnabled()}onRemoteConfig(e){var t;if(e.ok){var n=(t=e.config.logs)==null?void 0:t.captureConsoleLogs;!Ge(n)&&n&&(this.ku=!0,this.loadIfEnabled())}}reset(){var e,t;this.gr=[],(e=this.Tu)==null||e.reset(),this.Cu=[],(t=this.Eu)==null||t.reset(),this.za=0}captureLog(e){this.Au().captureLog(e)}he(e){this.Lu().captureLog(e)}get logger(){return this.Nu||(this.Nu={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.Nu}flushLogs(e){e?this.qu(e):(this.Tu&&this.Tu.flush().catch((t=>this.ju(t))),this.Eu&&this.Eu.flush().catch((t=>this.ju(t))))}ju(e){v_(e)||this.st.error("PostHog logs flush failed:",e)}loadIfEnabled(){if(this.ku&&!this.xu){var e=Oe==null?void 0:Oe.__PosthogExtensions__;if(e){var t=e.loadExternalDependency;t?t(this._instance,"logs",(n=>{var r;n||(r=e.logs)==null||!r.initializeLogs?this.st.error("Could not load logs script",n):(e.logs.initializeLogs(this._instance),this.xu=!0)})):this.st.error(fx)}else this.st.error("PostHog Extensions not found.")}}Pu(e,t){var n=this._instance;return{get isDisabled(){return!1},get optedOut(){return!n.is_capturing()},getPersistedProperty:r=>r===Ii.LogsQueue?e():void 0,setPersistedProperty(r,a){var o;r===Ii.LogsQueue&&t((o=a)!==null&&o!==void 0?o:[])},$t:r=>this.$t(r),getLibraryId:()=>Bt.LIB_NAME,getLibraryVersion:()=>Bt.LIB_VERSION}}$t(e){return new Promise((t=>{if(s2(this.za,3))t({kind:"fatal",error:Nm(void 0,"logs endpoint is unreachable, dropping batch")});else{var n=!1,r=o=>{n||(n=!0,clearTimeout(a),t(o))},a=setTimeout((()=>{this.st.warn("Logs request timed out before receiving a response"),r({kind:"retry-later",error:Nm(void 0,"logs request timed out")})}),9e4);this._instance._send_request({method:"POST",url:this.Bu(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:o=>{var u=o.statusCode;if(this.Hu(u),u>=200&&300>u)r({kind:"ok"});else if(u===413)r({kind:"too-large"});else if(u!==0&&u!==429&&500>u)r({kind:"fatal",error:new Error("logs request failed with status "+u)});else{var f;u===0?(o.error||this.st.warn("Logs request failed before receiving an HTTP response"),r({kind:"retry-later",error:Nm(o.error,"logs request failed before receiving an HTTP response")})):r({kind:"retry-later",error:(f=o.error)!==null&&f!==void 0?f:new Error("logs request failed with status "+u)})}}})}}))}Hu(e){(e!==0||this._instance.__loaded)&&(this.za=a2(e,this.za,3,(()=>this.st.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."))))}qu(e){this.gr.length>0&&this.Uu(e,this.gr,this.Ou,Bt.LIB_NAME,(t=>{this.gr=t})),this.Cu.length>0&&this.Uu(e,this.Cu,this.$u,x_,(t=>{this.Cu=t}))}Uu(e,t,n,r,a){if(t.length!==0){var o=t.map((f=>f.record));a([]);var u=Ew(o,Cw(n,Bt.LIB_NAME,Bt.LIB_VERSION),r,Bt.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Bu(),data:u,compression:"best-available",batchKey:"logs",transport:e})}}Bu(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}Ru(){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,Ge(a)||(t.sessionStartTimestamp=a),Ge(o)||(t.lastActivityTimestamp=o)}if(Oe!=null&&(e=Oe.location)!=null&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?Ps(Oe.location.href):Oe.location.href),this._instance.featureFlags){var u=this._instance.featureFlags.getFlags();u&&u.length>0&&(t.activeFeatureFlags=u)}return t}}},EE={metrics:class{constructor(e){this.st=Vt("[metrics]"),this._instance=e}initialize(){}Au(){var e,t,n=(e=this._instance)==null||(e=e.config)==null?void 0:e.metrics;return this.Tu&&this.Fu===n||((t=this.Tu)==null||t.reset(),this.Fu=n,this.Tu=new M3(this.Pu(),(function(r){var a,o,u,f,h,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:(f=r==null?void 0:r.flushIntervalMs)!==null&&f!==void 0?f:1e4,maxSeriesPerFlush:(h=r==null?void 0:r.maxSeriesPerFlush)!==null&&h!==void 0?h:1e3}})(n),this.st)),this.Tu}count(e,t,n){t===void 0&&(t=1),this.Au().count(e,t,n)}gauge(e,t,n){this.Au().gauge(e,t,n)}histogram(e,t,n){this.Au().histogram(e,t,n)}flush(e){if(!this.Tu)return Promise.resolve();if(e){var t=this.Tu.drainWindow();return t&&this.Xt(t,e),Promise.resolve()}return this.Tu.flush().catch((n=>this.st.error("PostHog metrics flush failed:",n)))}reset(){var e;(e=this.Tu)==null||e.reset()}Pu(){var e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},Xt:n=>t.Xt(n),getLibraryId:()=>Bt.LIB_NAME,getLibraryVersion:()=>Bt.LIB_VERSION}}Xt(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.zu(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t},{fireCallbackOnDrop:!0,callback(u){var f=u.statusCode;if(f>=200&&300>f)a({kind:"ok"});else if(f===413)a({kind:"too-large"});else if(f!==0&&f!==429&&500>f)a({kind:"fatal",error:new Error("metrics request failed with status "+f)});else{var h;a({kind:"retry-later",error:(h=u.error)!==null&&h!==void 0?h:new Error("metrics request failed with status "+f)})}}}))}))}zu(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},TE=de({},Af,xE,vE,bE,yE,_E,kE,wE,SE,jE,NE,CE,EE);br.__defaultExtensionClasses=de({},TE);var zc=(function(){Bt.SDK_DIST_CHANNEL="npm";var e=yc[Cl]=new br;return(function(){function t(){t.done||(t.done=!0,D2=!1,St(yc,(function(n){n._dom_loaded()})))}Se!=null&&Se.addEventListener?Se.readyState==="complete"?t():Xt(Se,"DOMContentLoaded",t,{capture:!1}):re&&ye.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),e})();const AE="https://us.i.posthog.com",O2="cc-telemetry-enabled";let Pg=!1,Oc=!1;function ME(){return AE}function RE(){if(typeof localStorage>"u")return!0;const e=localStorage.getItem(O2);return e===null?!0:e==="true"}function B2(e){Pg&&(e?(zc.opt_in_capturing({captureEventName:null}),Oc=!0):(zc.opt_out_capturing(),Oc=!1))}function _z(e){typeof localStorage<"u"&&localStorage.setItem(O2,String(e)),B2(e)}function LE(){const e=void 0;return e?(zc.init(e,{api_host:ME(),defaults:"2026-01-30",capture_pageview:!1,capture_pageleave:!0,capture_exceptions:!0,autocapture:!0,respect_dnt:!0}),Pg=!0,B2(RE()),!0):(Pg=!1,Oc=!1,!1)}function yx(e,t){Oc&&zc.capture(e,t)}function Fs(e,t){Oc&&zc.captureException(e,t)}function DE(e){yx("$pageview",{$current_url:e})}const bi="/api",P2="companion_auth_token";function Us(){if(typeof window>"u")return{};const e=localStorage.getItem(P2);return e?{Authorization:`Bearer ${e}`}:{}}function Ma(e){e===401&&typeof window<"u"&&(localStorage.removeItem(P2),$n(async()=>{const{useStore:t}=await Promise.resolve().then(()=>KN);return{useStore:t}},void 0).then(({useStore:t})=>{t.getState().logout()}).catch(()=>{}))}function bn(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}function Uc(e,t,n,r){yx("api_request_succeeded",{method:e,path:t,status:r,duration_ms:Math.round(n)})}function yi(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)}),Fs(r,{method:e,path:t,status:a})}async function qe(e,t){const n=bn();let r=!1;try{const a=await fetch(`${bi}${e}`,{method:"POST",headers:{"Content-Type":"application/json",...Us()},body:t?JSON.stringify(t):void 0});if(!a.ok){Ma(a.status);const o=await a.json().catch(()=>({error:a.statusText})),u=new Error(o.error||a.statusText);throw yi("POST",e,bn()-n,u,a.status),r=!0,u}return Uc("POST",e,bn()-n,a.status),a.json()}catch(a){throw r||yi("POST",e,bn()-n,a),a}}async function Me(e){const t=bn();let n=!1;try{const r=await fetch(`${bi}${e}`,{headers:{...Us()}});if(!r.ok){Ma(r.status);const a=await r.json().catch(()=>({error:r.statusText})),o=new Error(a.error||r.statusText);throw yi("GET",e,bn()-t,o,r.status),n=!0,o}return Uc("GET",e,bn()-t,r.status),r.json()}catch(r){throw n||yi("GET",e,bn()-t,r),r}}async function $r(e,t){const n=bn();let r=!1;try{const a=await fetch(`${bi}${e}`,{method:"PUT",headers:{"Content-Type":"application/json",...Us()},body:t?JSON.stringify(t):void 0});if(!a.ok){Ma(a.status);const o=await a.json().catch(()=>({error:a.statusText})),u=new Error(o.error||a.statusText);throw yi("PUT",e,bn()-n,u,a.status),r=!0,u}return Uc("PUT",e,bn()-n,a.status),a.json()}catch(a){throw r||yi("PUT",e,bn()-n,a),a}}async function zE(e,t){const n=bn();let r=!1;try{const a=await fetch(`${bi}${e}`,{method:"PATCH",headers:{"Content-Type":"application/json",...Us()},body:t?JSON.stringify(t):void 0});if(!a.ok){Ma(a.status);const o=await a.json().catch(()=>({error:a.statusText})),u=new Error(o.error||a.statusText);throw yi("PATCH",e,bn()-n,u,a.status),r=!0,u}return Uc("PATCH",e,bn()-n,a.status),a.json()}catch(a){throw r||yi("PATCH",e,bn()-n,a),a}}async function Fr(e,t){const n=bn();let r=!1;try{const a=await fetch(`${bi}${e}`,{method:"DELETE",headers:{...t?{"Content-Type":"application/json"}:{},...Us()},body:t?JSON.stringify(t):void 0});if(!a.ok){Ma(a.status);const o=await a.json().catch(()=>({error:a.statusText})),u=new Error(o.error||a.statusText);throw yi("DELETE",e,bn()-n,u,a.status),r=!0,u}return Uc("DELETE",e,bn()-n,a.status),a.json()}catch(a){throw r||yi("DELETE",e,bn()-n,a),a}}async function OE(e,t){const n=await fetch(`${bi}/sessions/create-stream`,{method:"POST",headers:{"Content-Type":"application/json",...Us()},body:JSON.stringify(e??{})});if(!n.ok||!n.body){const f=await n.json().catch(()=>({error:n.statusText}));throw new Error(f.error||n.statusText)}const r=n.body.getReader(),a=new TextDecoder;let o="",u=null;for(;;){const{done:f,value:h}=await r.read();if(f)break;o+=a.decode(h,{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 BE(){try{const e=await fetch(`${bi}/auth/auto`);if(e.ok){const t=await e.json();if(t.ok&&t.token)return t.token}return null}catch{return null}}async function b_(e){try{const t=await fetch(`${bi}/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 Ne={getAuthQr:()=>Me("/auth/qr"),getAuthToken:()=>Me("/auth/token"),regenerateAuthToken:()=>qe("/auth/regenerate"),createSession:e=>qe("/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=>qe(`/sessions/${encodeURIComponent(e)}/kill`),deleteSession:e=>Fr(`/sessions/${encodeURIComponent(e)}`),relaunchSession:e=>qe(`/sessions/${encodeURIComponent(e)}/relaunch`),exportSession:async(e,t)=>{const n=await fetch(`${bi}/sessions/${encodeURIComponent(e)}/export?format=${t}`,{headers:{...Us()}});if(!n.ok)throw Ma(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)=>qe(`/sessions/${encodeURIComponent(e)}/archive`,t),getArchiveInfo:e=>Me(`/sessions/${encodeURIComponent(e)}/archive-info`),unarchiveSession:e=>qe(`/sessions/${encodeURIComponent(e)}/unarchive`),renameSession:(e,t)=>zE(`/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)=>qe("/envs",{name:e,variables:t}),updateEnv:(e,t)=>$r(`/envs/${encodeURIComponent(e)}`,t),deleteEnv:e=>Fr(`/envs/${encodeURIComponent(e)}`),listSandboxes:()=>Me("/sandboxes"),getSandbox:e=>Me(`/sandboxes/${encodeURIComponent(e)}`),createSandbox:(e,t)=>qe("/sandboxes",{name:e,...t}),updateSandbox:(e,t)=>$r(`/sandboxes/${encodeURIComponent(e)}`,t),deleteSandbox:e=>Fr(`/sandboxes/${encodeURIComponent(e)}`),testInitScript:(e,t,n)=>qe(`/sandboxes/${encodeURIComponent(e)}/test-init`,{cwd:t,initScript:n}),buildBaseImage:()=>qe("/docker/build-base"),getBaseImageStatus:()=>Me("/docker/base-image"),getSettings:()=>Me("/settings"),updateSettings:e=>$r("/settings",e),verifyAnthropicKey:e=>qe("/settings/anthropic/verify",{apiKey:e}),getDashboard:()=>Me("/dashboard"),runDashboardUpdate:()=>qe("/dashboard/run"),getDashboardRunStatus:()=>Me("/dashboard/run/status"),getTailscaleStatus:()=>Me("/tailscale/status"),startTailscaleFunnel:()=>qe("/tailscale/funnel/start"),stopTailscaleFunnel:()=>qe("/tailscale/funnel/stop"),listLinearConnections:()=>Me("/linear/connections"),createLinearConnection:e=>qe("/linear/connections",e),updateLinearConnection:(e,t)=>$r(`/linear/connections/${encodeURIComponent(e)}`,t),deleteLinearConnection:e=>Fr(`/linear/connections/${encodeURIComponent(e)}`),verifyLinearConnection:e=>qe(`/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)=>qe(`/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=>$r("/linear/project-mappings",e),removeLinearProjectMapping:e=>Fr("/linear/project-mappings",{repoRoot:e}),linkLinearIssue:(e,t,n)=>$r(`/sessions/${encodeURIComponent(e)}/linear-issue`,{...t,...n!==void 0?{connectionId:n}:{}}),unlinkLinearIssue:e=>Fr(`/sessions/${encodeURIComponent(e)}/linear-issue`),getLinkedLinearIssue:(e,t=!1)=>Me(`/sessions/${encodeURIComponent(e)}/linear-issue${t?"?refresh=true":""}`),createLinearIssue:e=>qe("/linear/issues",e),addLinearComment:(e,t,n)=>qe(`/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=>qe("/git/fetch",{repoRoot:e}),gitPull:e=>qe("/git/pull",{cwd:e}),listWorktrees:e=>Me(`/git/worktrees?repoRoot=${encodeURIComponent(e)}`),createWorktree:(e,t,n)=>qe("/git/worktree",{repoRoot:e,branch:t,...n}),removeWorktree:(e,t,n)=>Fr("/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=>qe(`/images/${encodeURIComponent(e)}/pull`),getCloudProviderPlan:(e,t,n)=>Me(`/cloud/providers/${encodeURIComponent(e)}/plan?cwd=${encodeURIComponent(t)}&sessionId=${encodeURIComponent(n)}`),startEditor:e=>qe(`/sessions/${encodeURIComponent(e)}/editor/start`),startBrowser:(e,t)=>qe(`/sessions/${encodeURIComponent(e)}/browser/start`,t?{url:t}:void 0),navigateBrowser:(e,t)=>qe(`/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(`${bi}/fs/raw?path=${encodeURIComponent(e)}`,{headers:{...Us()}});if(!t.ok){Ma(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)=>$r("/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)=>$r("/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)=>qe("/terminal/spawn",{cwd:e,cols:t,rows:n,containerId:r==null?void 0:r.containerId}),killTerminal:e=>qe("/terminal/kill",{terminalId:e}),getTerminal:e=>Me(e?`/terminal?terminalId=${encodeURIComponent(e)}`:"/terminal"),checkForUpdate:()=>Me("/update-check"),forceCheckForUpdate:()=>qe("/update-check"),triggerUpdate:()=>qe("/update"),getClaudeCompat:()=>Me("/claude-compat"),refreshClaudeCompat:()=>qe("/claude-compat/refresh"),pinClaudeVersion:e=>qe("/claude-compat/pin",e?{version:e}:{}),patchClaudeBinary:()=>qe("/claude-compat/patch"),unpatchClaudeBinary:()=>qe("/claude-compat/unpatch"),dismissClaudeCompatBanner:e=>qe("/claude-compat/dismiss-banner",{version:e}),listCronJobs:()=>Me("/cron/jobs"),getCronJob:e=>Me(`/cron/jobs/${encodeURIComponent(e)}`),createCronJob:e=>qe("/cron/jobs",e),updateCronJob:(e,t)=>$r(`/cron/jobs/${encodeURIComponent(e)}`,t),deleteCronJob:e=>Fr(`/cron/jobs/${encodeURIComponent(e)}`),toggleCronJob:e=>qe(`/cron/jobs/${encodeURIComponent(e)}/toggle`),runCronJob:e=>qe(`/cron/jobs/${encodeURIComponent(e)}/run`),getCronJobExecutions:e=>Me(`/cron/jobs/${encodeURIComponent(e)}/executions`),killProcess:(e,t)=>qe(`/sessions/${encodeURIComponent(e)}/processes/${encodeURIComponent(t)}/kill`),killAllProcesses:(e,t)=>qe(`/sessions/${encodeURIComponent(e)}/processes/kill-all`,{taskIds:t}),getSystemProcesses:e=>Me(`/sessions/${encodeURIComponent(e)}/processes/system`),killSystemProcess:(e,t)=>qe(`/sessions/${encodeURIComponent(e)}/processes/system/${t}/kill`),listAgents:()=>Me("/agents"),getAgent:e=>Me(`/agents/${encodeURIComponent(e)}`),createAgent:e=>qe("/agents",e),updateAgent:(e,t)=>$r(`/agents/${encodeURIComponent(e)}`,t),deleteAgent:e=>Fr(`/agents/${encodeURIComponent(e)}`),toggleAgent:e=>qe(`/agents/${encodeURIComponent(e)}/toggle`),runAgent:(e,t)=>qe(`/agents/${encodeURIComponent(e)}/run`,{input:t}),getAgentExecutions:e=>Me(`/agents/${encodeURIComponent(e)}/executions`),importAgent:e=>qe("/agents/import",e),exportAgent:e=>Me(`/agents/${encodeURIComponent(e)}/export`),regenerateAgentWebhookSecret:e=>qe(`/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:()=>qe("/linear/oauth/disconnect"),createLinearStaging:e=>qe("/linear/oauth/staging",e),getLinearStagingStatus:e=>Me(`/linear/oauth/staging/${encodeURIComponent(e)}/status`),deleteLinearStaging:e=>Fr(`/linear/oauth/staging/${encodeURIComponent(e)}`),listLinearOAuthConnections:()=>Me("/linear/oauth-connections"),createLinearOAuthConnection:e=>qe("/linear/oauth-connections",e),updateLinearOAuthConnection:(e,t)=>$r(`/linear/oauth-connections/${encodeURIComponent(e)}`,t),deleteLinearOAuthConnection:e=>Fr(`/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)=>qe(`/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=>qe("/prompts",e),updatePrompt:(e,t)=>$r(`/prompts/${encodeURIComponent(e)}`,t),deletePrompt:e=>Fr(`/prompts/${encodeURIComponent(e)}`)};let y_=!1;function __(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 w_(){return new Promise(()=>{})}function PE(){if(y_||typeof window>"u")return;y_=!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 __(r)}catch{return w_()}}}}catch{}return}try{Object.defineProperty(e,"clipboard",{configurable:!0,value:{writeText:async n=>{try{await __(n)}catch{return w_()}}}})}catch{}}const k_="#/session/",S_="#/agents/";let j_=!1;function _x(){j_||(PE(),j_=!0)}function wx(e){if(_x(),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(S_)){const n=e.slice(S_.length);if(n)return{page:"agent-detail",agentId:n}}if(e.startsWith(k_)){const n=e.slice(k_.length);if(n)return{page:"session",sessionId:n}}return{page:"home"}}function $E(e){return`#/session/${e}`}function kx(e,t=!1){_x();const n=$E(e);t?(history.replaceState(null,"",n),window.dispatchEvent(new HashChangeEvent("hashchange"))):window.location.hash=`/session/${e}`}function Cm(e=!1){_x(),e?(history.replaceState(null,"",window.location.pathname+window.location.search),window.dispatchEvent(new HashChangeEvent("hashchange"))):window.location.hash=""}function FE(){const[e,t]=k.useState(""),[n,r]=k.useState(null),[a,o]=k.useState(!1),u=Y(m=>m.setAuthToken),f=k.useCallback(async m=>{m.preventDefault();const x=e.trim();if(!x){r("Please enter a token");return}o(!0),r(null),await b_(x)?u(x):r("Invalid token"),o(!1)},[e,u]);k.useEffect(()=>{BE().then(m=>{if(m){u(m);return}const b=new URLSearchParams(window.location.search).get("token");b&&(o(!0),b_(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[h,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:f,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:h?"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(!h),className:"absolute right-2 top-1/2 -translate-y-1/2 text-[11px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer px-1.5 py-0.5 rounded hover:bg-cc-hover",tabIndex:-1,children:h?"Hide":"Show"})]})]}),n&&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 Yl=D5();function UE({issueIdentifier:e,issueStateName:t,isContainerized:n,archiveTransitionConfigured:r,archiveTransitionStateName:a,hasBacklogState:o,onConfirm:u,onCancel:f}){const[h,p]=k.useState("none");return Yl.createPortal(l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:f,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:f,className:"inline-flex h-6 w-6 items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children: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:h==="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:h==="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:h==="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:f,className:"px-3 py-1.5 text-xs font-medium rounded-md bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),l.jsx("button",{type:"button",onClick:()=>u(h,n||void 0),className:"px-3 py-1.5 text-xs font-medium rounded-md bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Archive"})]})]})}),document.body)}function qE(e,t){return t>0?"awaiting":(e.status==="running"||e.status==="compacting")&&e.isConnected?"running":e.isReconnecting?"reconnecting":e.isConnected?"idle":"exited"}function HE({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 IE({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 qd({session:e,isActive:t,isArchived:n,sessionName:r,permCount:a,isRecentlyRenamed:o,onSelect:u,onStartRename:f,onArchive:h,onUnarchive:p,onDelete:m,onClearRecentlyRenamed:x,editingSessionId:b,editingName:y,setEditingName:_,onConfirmRename:j,onCancelRename:N,editInputRef:S}){const E=e.id.slice(0,8),C=r||e.model||E,O=b===e.id,[D,L]=k.useState(!1),I=k.useRef(null),F=k.useRef(null),W=n?"exited":qE(e,a),z=e.cwd||"";k.useEffect(()=>{if(!D)return;function A(K){var G;I.current&&!I.current.contains(K.target)&&F.current&&!F.current.contains(K.target)&&(L(!1),(G=F.current)==null||G.focus())}function ie(K){var G,P,$;if(K.key==="Escape"){L(!1),(G=F.current)==null||G.focus();return}if(K.key==="Tab"){L(!1);return}if((K.key==="ArrowDown"||K.key==="ArrowUp")&&((P=I.current)!=null&&P.contains(document.activeElement)||F.current===document.activeElement)){K.preventDefault();const se=($=I.current)==null?void 0:$.querySelectorAll("[role='menuitem']");if(!se||se.length===0)return;const ae=document.activeElement,R=Array.from(se).indexOf(ae);K.key==="ArrowDown"?se[R<se.length-1?R+1:0].focus():se[R>0?R-1:se.length-1].focus()}}return document.addEventListener("mousedown",A),document.addEventListener("touchstart",A),document.addEventListener("keydown",ie),()=>{document.removeEventListener("mousedown",A),document.removeEventListener("touchstart",A),document.removeEventListener("keydown",ie)}},[D]),k.useEffect(()=>{D&&requestAnimationFrame(()=>{var A,ie;(ie=(A=I.current)==null?void 0:A.querySelector("[role='menuitem']"))==null||ie.focus()})},[D]);const q=k.useCallback(A=>{L(!1),A()},[]);return l.jsxs("div",{className:"relative group",children:[l.jsxs("button",{onClick:()=>u(e.id),onDoubleClick:A=>{A.preventDefault(),f(e.id,C)},onKeyDown:A=>{A.key==="F2"&&!O&&(A.preventDefault(),f(e.id,C))},className:`w-full flex items-center gap-2 py-2 pl-2.5 pr-12 min-h-[44px] rounded-lg transition-all duration-100 cursor-pointer relative ${t?"bg-cc-active":"hover:bg-cc-hover"}`,children:[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"}`}),!O&&l.jsx(HE,{status:W}),O?l.jsx("input",{ref:S,value:y,onChange:A=>_(A.target.value),onKeyDown:A=>{A.key==="Enter"?(A.preventDefault(),j()):A.key==="Escape"&&(A.preventDefault(),N()),A.stopPropagation()},onBlur:j,onClick:A=>A.stopPropagation(),onDoubleClick:A=>A.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}),z&&l.jsx("span",{className:"text-[10px] text-cc-muted/70 truncate block leading-tight mt-px",children:z})]}),!O&&l.jsxs("span",{className:"flex items-center gap-1 shrink-0",children:[l.jsx(IE,{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&&!O&&!D&&l.jsx("button",{onClick:A=>{A.stopPropagation(),h(A,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:F,onClick:A=>{A.stopPropagation(),L(!D)},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":D,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"})]})}),D&&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(()=>f(e.id,C)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2",children:[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:A=>q(()=>p(A,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:A=>q(()=>m(A,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:A=>q(()=>h(A,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 VE({group:e,isCollapsed:t,onToggleCollapse:n,currentSessionId:r,sessionNames:a,pendingPermissions:o,recentlyRenamed:u,onSelect:f,onStartRename:h,onArchive:p,onUnarchive:m,onDelete:x,onClearRecentlyRenamed:b,editingSessionId:y,editingName:_,setEditingName:j,onConfirmRename:N,onCancelRename:S,editInputRef:E,isFirst:C}){const O=t?e.sessions.slice(0,2).map(D=>a.get(D.id)||D.model||D.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&&O&&l.jsx("div",{className:"text-[10px] text-cc-muted/70 truncate pl-5 pb-0.5",children:O}),!t&&l.jsx("div",{className:"mt-0.5",children:e.sessions.map(D=>{var I;const L=((I=o.get(D.id))==null?void 0:I.size)??0;return l.jsx(qd,{session:D,isActive:r===D.id,sessionName:a.get(D.id),permCount:L,isRecentlyRenamed:u.has(D.id),onSelect:f,onStartRename:h,onArchive:p,onUnarchive:m,onDelete:x,onClearRecentlyRenamed:b,editingSessionId:y,editingName:_,setEditingName:j,onConfirmRename:N,onCancelRename:S,editInputRef:E},D.id)})})]})}function GE(e,t,n=!1){return(n&&!!t&&(t==="/workspace"||t.startsWith("/workspace/"))?e:t||e).replace(/\/+$/,"")||"/"}function YE(e){if(e==="/")return"/";const t=e.split("/").filter(Boolean);return t.length===0?"/":t[t.length-1]}function WE(e){const t=new Map;for(const r of e){const a=GE(r.cwd,r.repoRoot||void 0,r.isContainerized),o=YE(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 QE=[{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"}],XE=[{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"}],KE=[{id:"workbench",label:"Workbench",itemIds:["dashboard","prompts","integrations"]},{id:"workspace",label:"Workspace",itemIds:["environments","sandboxes","agents","settings"]}],ZE=new Map(XE.map(e=>[e.id,e]));function JE(){var Ir,Vr;const[e,t]=k.useState(null),[n,r]=k.useState(""),[a,o]=k.useState(!1),[u,f]=k.useState(null),[h,p]=k.useState(null),[m,x]=k.useState(null),[b,y]=k.useState(!1),[_,j]=k.useState(null),[N,S]=k.useState(!1),[E,C]=k.useState(()=>typeof window<"u"?window.location.hash:""),O=k.useRef(null),D=k.useRef(null),L=Y(te=>te.sessions),I=Y(te=>te.sdkSessions),F=Y(te=>te.currentSessionId),W=Y(te=>te.cliConnected),z=Y(te=>te.cliReconnecting),q=Y(te=>te.sessionStatus),A=Y(te=>te.removeSession),ie=Y(te=>te.sessionNames),K=Y(te=>te.recentlyRenamed),G=Y(te=>te.clearRecentlyRenamed),P=Y(te=>te.pendingPermissions),$=Y(te=>te.linkedLinearIssues),se=Y(te=>te.collapsedProjects),ae=Y(te=>te.toggleProjectCollapse),R=wx(E);k.useEffect(()=>{let te=!0;async function xe(){try{const Xe=await Ne.listSessions();if(te){const Ht=Y.getState();Ht.setSdkSessions(Xe);const hn=Y.getState(),Dn=new Set(Xe.map(It=>It.sessionId));for(const It of hn.sessions.keys())!Dn.has(It)&&hn.connectionStatus.get(It)!=="connected"&&hn.removeSession(It);e3(Xe);for(const It of Xe)if(It.name&&(!Ht.sessionNames.has(It.sessionId)||/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(Ht.sessionNames.get(It.sessionId)))){const Un=Ht.sessionNames.get(It.sessionId),Sr=!!Un&&/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(Un);Un!==It.name&&(Ht.setSessionName(It.sessionId,It.name),Sr&&Ht.markRecentlyRenamed(It.sessionId))}}}catch{}}xe();const be=setInterval(xe,5e3);return()=>{te=!1,clearInterval(be)}},[]),k.useEffect(()=>{const te=()=>C(window.location.hash);return window.addEventListener("hashchange",te),()=>window.removeEventListener("hashchange",te)},[]);function B(te){kx(te),window.innerWidth<768&&Y.getState().setSidebarOpen(!1)}function Z(){Cm(),Y.getState().newSession(),window.innerWidth<768&&Y.getState().setSidebarOpen(!1)}k.useEffect(()=>{e&&O.current&&(O.current.focus(),O.current.select())},[e]);function M(){e&&n.trim()&&(Y.getState().setSessionName(e,n.trim()),Ne.renameSession(e,n.trim()).catch(()=>{})),t(null),r("")}function pe(){t(null),r("")}function _e(te,xe){t(te),r(xe)}const Ce=k.useCallback((te,xe)=>{te.stopPropagation(),j(xe)},[]),De=k.useCallback(async te=>{try{rg(te),await Ne.deleteSession(te)}catch{}Y.getState().currentSessionId===te&&Cm(),A(te)},[A]),Ee=k.useCallback(()=>{_&&(De(_),j(null))},[_,De]),Be=k.useCallback(()=>{j(null)},[]),Je=k.useCallback(()=>{S(!0)},[]),Et=k.useCallback(async()=>{S(!1);const te=Y.getState(),xe=new Set;for(const Xe of te.sessions.keys())xe.add(Xe);for(const Xe of te.sdkSessions)xe.add(Xe.sessionId);const be=Array.from(xe).filter(Xe=>{const Ht=te.sdkSessions.find(hn=>hn.sessionId===Xe);return(Ht==null?void 0:Ht.archived)??!1});for(const Xe of be)await De(Xe)},[De]),ft=k.useCallback(()=>{S(!1)},[]);k.useEffect(()=>{if(!_&&!N)return;requestAnimationFrame(()=>{var xe,be;(be=(xe=D.current)==null?void 0:xe.querySelector("button"))==null||be.focus()});function te(xe){var hn;if(xe.key==="Escape"){N?ft():Be();return}if(xe.key!=="Tab")return;const be=(hn=D.current)==null?void 0:hn.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(!be||be.length===0)return;const Xe=be[0],Ht=be[be.length-1];xe.shiftKey&&document.activeElement===Xe?(xe.preventDefault(),Ht.focus()):!xe.shiftKey&&document.activeElement===Ht&&(xe.preventDefault(),Xe.focus())}return document.addEventListener("keydown",te),()=>document.removeEventListener("keydown",te)},[_,N,Be,ft]);const vt=k.useCallback(async(te,xe)=>{te.stopPropagation();const be=I.find(Un=>Un.sessionId===xe),Xe=L.get(xe),Ht=(Xe==null?void 0:Xe.is_containerized)||!!(be!=null&&be.containerId)||!1,hn=$.get(xe),Dn=((hn==null?void 0:hn.stateType)||"").toLowerCase();if(hn&&!(Dn==="completed"||Dn==="canceled"||Dn==="cancelled"))try{const Un=await Ne.getArchiveInfo(xe);if(Un.issueNotDone){p(xe),x(Un),y(Ht);return}}catch{}if(Ht){f(xe);return}bt(xe)},[I,L,$]),bt=k.useCallback(async(te,xe,be)=>{try{rg(te);const Xe={};xe&&(Xe.force=!0),be&&be!=="none"&&(Xe.linearTransition=be),await Ne.archiveSession(te,Object.keys(Xe).length>0?Xe:void 0)}catch{}Y.getState().currentSessionId===te&&(Cm(),Y.getState().newSession());try{const Xe=await Ne.listSessions();Y.getState().setSdkSessions(Xe)}catch{}},[]),wt=k.useCallback(()=>{u&&(bt(u,!0),f(null))},[u,bt]),Tt=k.useCallback(()=>{f(null)},[]),ve=k.useCallback((te,xe)=>{h&&(bt(h,xe,te),p(null),x(null))},[h,bt]),$e=k.useCallback(()=>{p(null),x(null)},[]),rt=k.useCallback(async(te,xe)=>{te.stopPropagation();try{await Ne.unarchiveSession(xe)}catch{}try{const be=await Ne.listSessions();Y.getState().setSdkSessions(be)}catch{}},[]),rn=new Set;for(const te of L.keys())rn.add(te);for(const te of I)rn.add(te.sessionId);const je=Array.from(rn).map(te=>{var Xe;const xe=L.get(te),be=I.find(Ht=>Ht.sessionId===te);return{id:te,model:(xe==null?void 0:xe.model)||(be==null?void 0:be.model)||"",cwd:(xe==null?void 0:xe.cwd)||(be==null?void 0:be.cwd)||"",gitBranch:(xe==null?void 0:xe.git_branch)||(be==null?void 0:be.gitBranch)||"",isContainerized:(xe==null?void 0:xe.is_containerized)||!!(be!=null&&be.containerId)||!1,gitAhead:(xe==null?void 0:xe.git_ahead)||(be==null?void 0:be.gitAhead)||0,gitBehind:(xe==null?void 0:xe.git_behind)||(be==null?void 0:be.gitBehind)||0,linesAdded:(xe==null?void 0:xe.total_lines_added)||(be==null?void 0:be.totalLinesAdded)||0,linesRemoved:(xe==null?void 0:xe.total_lines_removed)||(be==null?void 0:be.totalLinesRemoved)||0,isConnected:W.get(te)??!1,isReconnecting:z.get(te)??!1,status:q.get(te)??null,sdkState:(be==null?void 0:be.state)??null,createdAt:(be==null?void 0:be.createdAt)??0,archived:(be==null?void 0:be.archived)??!1,backendType:(xe==null?void 0:xe.backend_type)||(be==null?void 0:be.backendType)||"claude",repoRoot:(xe==null?void 0:xe.repo_root)||"",permCount:((Xe=P.get(te))==null?void 0:Xe.size)??0,cronJobId:(xe==null?void 0:xe.cronJobId)||(be==null?void 0:be.cronJobId),cronJobName:(xe==null?void 0:xe.cronJobName)||(be==null?void 0:be.cronJobName),agentId:(xe==null?void 0:xe.agentId)||(be==null?void 0:be.agentId),agentName:(xe==null?void 0:xe.agentName)||(be==null?void 0:be.agentName),userName:be==null?void 0:be.userName}}).sort((te,xe)=>xe.createdAt-te.createdAt),ze=k.useMemo(()=>Array.from(new Set(je.map(te=>te.userName).filter(te=>!!te))).sort(),[je]),[pt,Te]=k.useState("__all__"),Hr=te=>pt==="__all__"?!0:pt==="__none__"?!te.userName:te.userName===pt,oe=je.some(te=>!te.userName),we=je.filter(Hr),Q=we.filter(te=>!te.archived&&!te.cronJobId&&!te.agentId),me=we.filter(te=>!te.archived&&!!te.cronJobId),Re=we.filter(te=>!te.archived&&!!te.agentId),Qe=we.filter(te=>te.archived),it=F?je.find(te=>te.id===F):null,st=(it==null?void 0:it.backendType)==="codex"?"/logo-codex.svg":"/logo.svg",[jt,yn]=k.useState(!0),[et,cr]=k.useState(!0),Ln=k.useMemo(()=>WE(Q),[Q]),ti={onSelect:B,onStartRename:_e,onArchive:vt,onUnarchive:rt,onDelete:Ce,onClearRecentlyRenamed:G,editingSessionId:e,editingName:n,setEditingName:r,onConfirmRename:M,onCancelRename:pe,editInputRef:O};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:st,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:Z,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:()=>Y.getState().setSidebarOpen(!1),"aria-label":"Close sidebar",className:"md:hidden ml-auto w-8 h-8 rounded-lg flex items-center justify-center text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children: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"})})})]})}),ze.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:pt,onChange:te=>Te(te.target.value),"aria-label":"Filter sessions by user",className:"w-full px-2 py-1.5 text-[12px] bg-cc-card border border-cc-border rounded-lg text-cc-fg focus:outline-none focus:border-cc-primary cursor-pointer",children:[l.jsx("option",{value:"__all__",children:"All users"}),ze.map(te=>l.jsx("option",{value:te,children:te},te)),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:Tt,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:wt,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:Q.length===0&&me.length===0&&Qe.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:[Ln.map((te,xe)=>l.jsx(VE,{group:te,isCollapsed:se.has(te.key),onToggleCollapse:ae,currentSessionId:F,sessionNames:ie,pendingPermissions:P,recentlyRenamed:K,isFirst:xe===0,...ti},te.key)),me.length>0&&l.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[l.jsxs("button",{onClick:()=>yn(!jt),"aria-expanded":jt,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 ${jt?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),"Scheduled Runs (",me.length,")"]}),jt&&l.jsx("div",{className:"mt-0.5",children:me.map(te=>{var xe;return l.jsx(qd,{session:te,isActive:F===te.id,sessionName:ie.get(te.id),permCount:((xe=P.get(te.id))==null?void 0:xe.size)??0,isRecentlyRenamed:K.has(te.id),...ti},te.id)})})]}),Re.length>0&&l.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[l.jsxs("button",{onClick:()=>cr(!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"})}),"Agent Runs (",Re.length,")"]}),et&&l.jsx("div",{className:"mt-0.5",children:Re.map(te=>{var xe;return l.jsx(qd,{session:te,isActive:F===te.id,sessionName:ie.get(te.id),permCount:((xe=P.get(te.id))==null?void 0:xe.size)??0,isRecentlyRenamed:K.has(te.id),...ti},te.id)})})]}),Qe.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 (",Qe.length,")"]}),a&&Qe.length>1&&l.jsx("button",{onClick:Je,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:Qe.map(te=>{var xe;return l.jsx(qd,{session:te,isActive:F===te.id,isArchived:!0,sessionName:ie.get(te.id),permCount:((xe=P.get(te.id))==null?void 0:xe.size)??0,isRecentlyRenamed:K.has(te.id),...ti},te.id)})})]})]})}),l.jsx("div",{className:"md:hidden flex justify-end px-4 pb-2",children:l.jsx("button",{onClick:Z,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:KE.map(te=>l.jsxs("section",{className:"rounded-lg border border-cc-border/30 bg-cc-card/20 p-0.5",children:[l.jsx("span",{className:"px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.14em] text-cc-muted/75 block",children:te.label}),l.jsx("div",{className:"flex flex-col",children:te.itemIds.map(xe=>{const be=ZE.get(xe);if(!be)return null;const Xe=be.activePages?be.activePages.some(Ht=>R.page===Ht):R.page===be.id;return l.jsxs("button",{onClick:()=>{window.location.hash=be.hash,window.innerWidth<768&&Y.getState().setSidebarOpen(!1)},title:be.label,"aria-current":Xe?"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 ${Xe?"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 ${Xe?"bg-cc-primary":"bg-transparent group-hover:bg-cc-border"}`}),l.jsx("svg",{viewBox:be.viewBox,fill:"currentColor",className:"w-3.5 h-3.5 shrink-0",children:l.jsx("path",{d:be.iconPath,fillRule:be.fillRule,clipRule:be.clipRule})}),l.jsx("span",{className:"min-w-0 flex-1 text-[12px] font-medium leading-tight",children:be.label})]},be.id)})})]},te.id))}),l.jsx("div",{className:"mt-1.5 rounded-lg border border-cc-border/30 bg-cc-card/20 px-1.5 py-0.5",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"px-1 text-[10px] font-semibold uppercase tracking-[0.14em] text-cc-muted/75",children:"Resources"}),l.jsx("div",{className:"flex items-center gap-0.5",children:QE.map(te=>l.jsx("a",{href:te.url,target:"_blank",rel:"noopener noreferrer",title:te.label,"aria-label":`Open ${te.label.toLowerCase()}`,className:"w-9 h-9 md:w-7 md:h-7 rounded-md flex items-center justify-center text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors",children:l.jsx("svg",{viewBox:te.viewBox,fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:te.iconPath})})},te.label))})]})})]}),(_||N)&&l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm animate-[fadeIn_150ms_ease-out]",onClick:N?ft:Be,children:l.jsxs("div",{ref:D,role:"alertdialog","aria-modal":"true","aria-labelledby":"delete-dialog-title","aria-describedby":"delete-dialog-desc",className:"mx-4 w-full max-w-[280px] bg-cc-card border border-cc-border rounded-xl shadow-2xl p-5 animate-[menu-appear_150ms_ease-out]",onClick:te=>te.stopPropagation(),children:[l.jsx("div",{className:"flex justify-center mb-3",children:l.jsx("div",{className:"w-10 h-10 rounded-full bg-cc-error/10 flex items-center justify-center",children:l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-5 h-5 text-cc-error",children:[l.jsx("path",{d:"M5.5 5.5A.5.5 0 016 6v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm2.5 0a.5.5 0 01.5.5v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm3 .5a.5.5 0 00-1 0v6a.5.5 0 001 0V6z"}),l.jsx("path",{fillRule:"evenodd",d:"M14.5 3a1 1 0 01-1 1H13v9a2 2 0 01-2 2H5a2 2 0 01-2-2V4h-.5a1 1 0 010-2H6a1 1 0 011-1h2a1 1 0 011 1h3.5a1 1 0 011 1zM4.118 4L4 4.059V13a1 1 0 001 1h6a1 1 0 001-1V4.059L11.882 4H4.118zM6 2h4v1H6V2z",clipRule:"evenodd"})]})})}),l.jsx("p",{id:"delete-dialog-title",className:"text-[13px] font-semibold text-cc-fg text-center",children:N?"Delete all archived?":"Delete session?"}),l.jsx("p",{id:"delete-dialog-desc",className:"text-[12px] text-cc-muted text-center mt-1.5 leading-relaxed",children:N?`This will permanently delete ${Qe.length} archived session${Qe.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?ft:Be,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?Et: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"})]})]})}),h&&m&&l.jsx(UE,{issueIdentifier:((Ir=m.issue)==null?void 0:Ir.identifier)||"",issueStateName:((Vr=m.issue)==null?void 0:Vr.stateName)||"",isContainerized:b,archiveTransitionConfigured:m.archiveTransitionConfigured||!1,archiveTransitionStateName:m.archiveTransitionStateName,hasBacklogState:m.hasBacklogState||!1,onConfirm:ve,onCancel:$e})]})}function e6(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const t6=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,n6=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,r6={};function N_(e,t){return(r6.jsx?n6:t6).test(e)}const i6=/[ \t\n\f\r]/g;function s6(e){return typeof e=="object"?e.type==="text"?C_(e.value):!1:C_(e)}function C_(e){return e.replace(i6,"")===""}class qc{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}qc.prototype.normal={};qc.prototype.property={};qc.prototype.space=void 0;function $2(e,t){const n={},r={};for(const a of e)Object.assign(n,a.property),Object.assign(r,a.normal);return new qc(n,r,t)}function $g(e){return e.toLowerCase()}class or{constructor(t,n){this.attribute=n,this.property=t}}or.prototype.attribute="";or.prototype.booleanish=!1;or.prototype.boolean=!1;or.prototype.commaOrSpaceSeparated=!1;or.prototype.commaSeparated=!1;or.prototype.defined=!1;or.prototype.mustUseProperty=!1;or.prototype.number=!1;or.prototype.overloadedBoolean=!1;or.prototype.property="";or.prototype.spaceSeparated=!1;or.prototype.space=void 0;let a6=0;const Ye=La(),vn=La(),Fg=La(),ke=La(),Ft=La(),Ta=La(),vr=La();function La(){return 2**++a6}const Ug=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ye,booleanish:vn,commaOrSpaceSeparated:vr,commaSeparated:Ta,number:ke,overloadedBoolean:Fg,spaceSeparated:Ft},Symbol.toStringTag,{value:"Module"})),Em=Object.keys(Ug);class Sx extends or{constructor(t,n,r,a){let o=-1;if(super(t,n),E_(this,"space",a),typeof r=="number")for(;++o<Em.length;){const u=Em[o];E_(this,Em[o],(r&Ug[u])===Ug[u])}}}Sx.prototype.defined=!0;function E_(e,t,n){n&&(e[t]=n)}function Wl(e){const t={},n={};for(const[r,a]of Object.entries(e.properties)){const o=new Sx(r,e.transform(e.attributes||{},r),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[$g(r)]=r,n[$g(o.attribute)]=r}return new qc(t,n,e.space)}const F2=Wl({properties:{ariaActiveDescendant:null,ariaAtomic:vn,ariaAutoComplete:null,ariaBusy:vn,ariaChecked:vn,ariaColCount:ke,ariaColIndex:ke,ariaColSpan:ke,ariaControls:Ft,ariaCurrent:null,ariaDescribedBy:Ft,ariaDetails:null,ariaDisabled:vn,ariaDropEffect:Ft,ariaErrorMessage:null,ariaExpanded:vn,ariaFlowTo:Ft,ariaGrabbed:vn,ariaHasPopup:null,ariaHidden:vn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ft,ariaLevel:ke,ariaLive:null,ariaModal:vn,ariaMultiLine:vn,ariaMultiSelectable:vn,ariaOrientation:null,ariaOwns:Ft,ariaPlaceholder:null,ariaPosInSet:ke,ariaPressed:vn,ariaReadOnly:vn,ariaRelevant:null,ariaRequired:vn,ariaRoleDescription:Ft,ariaRowCount:ke,ariaRowIndex:ke,ariaRowSpan:ke,ariaSelected:vn,ariaSetSize:ke,ariaSort:null,ariaValueMax:ke,ariaValueMin:ke,ariaValueNow:ke,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function U2(e,t){return t in e?e[t]:t}function q2(e,t){return U2(e,t.toLowerCase())}const l6=Wl({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ta,acceptCharset:Ft,accessKey:Ft,action:null,allow:null,allowFullScreen:Ye,allowPaymentRequest:Ye,allowUserMedia:Ye,alpha:Ye,alt:null,as:null,async:Ye,autoCapitalize:null,autoComplete:Ft,autoFocus:Ye,autoPlay:Ye,blocking:Ft,capture:null,charSet:null,checked:Ye,cite:null,className:Ft,closedBy:null,colorSpace:null,cols:ke,colSpan:ke,command:null,commandFor:null,content:null,contentEditable:vn,controls:Ye,controlsList:Ft,coords:ke|Ta,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ye,defer:Ye,dir:null,dirName:null,disabled:Ye,download:Fg,draggable:vn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ye,formTarget:null,headers:Ft,height:ke,hidden:Fg,high:ke,href:null,hrefLang:null,htmlFor:Ft,httpEquiv:Ft,id:null,imageSizes:null,imageSrcSet:null,inert:Ye,inputMode:null,integrity:null,is:null,isMap:Ye,itemId:null,itemProp:Ft,itemRef:Ft,itemScope:Ye,itemType:Ft,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ye,low:ke,manifest:null,max:null,maxLength:ke,media:null,method:null,min:null,minLength:ke,multiple:Ye,muted:Ye,name:null,nonce:null,noModule:Ye,noValidate:Ye,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:Ye,optimum:ke,pattern:null,ping:Ft,placeholder:null,playsInline:Ye,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ye,referrerPolicy:null,rel:Ft,required:Ye,reversed:Ye,rows:ke,rowSpan:ke,sandbox:Ft,scope:null,scoped:Ye,seamless:Ye,selected:Ye,shadowRootClonable:Ye,shadowRootCustomElementRegistry:Ye,shadowRootDelegatesFocus:Ye,shadowRootMode:null,shadowRootSerializable:Ye,shape:null,size:ke,sizes:null,slot:null,span:ke,spellCheck:vn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ke,step:null,style:null,tabIndex:ke,target:null,title:null,translate:null,type:null,typeMustMatch:Ye,useMap:null,value:vn,width:ke,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ft,axis:null,background:null,bgColor:null,border:ke,borderColor:null,bottomMargin:ke,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ye,declare:Ye,event:null,face:null,frame:null,frameBorder:null,hSpace:ke,leftMargin:ke,link:null,longDesc:null,lowSrc:null,marginHeight:ke,marginWidth:ke,noResize:Ye,noHref:Ye,noShade:Ye,noWrap:Ye,object:null,profile:null,prompt:null,rev:null,rightMargin:ke,rules:null,scheme:null,scrolling:vn,standby:null,summary:null,text:null,topMargin:ke,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ke,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Ye,disablePictureInPicture:Ye,disableRemotePlayback:Ye,exportParts:Ta,part:Ft,prefix:null,property:null,results:ke,security:null,unselectable:null},space:"html",transform:q2}),o6=Wl({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:vr,accentHeight:ke,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ke,amplitude:ke,arabicForm:null,ascent:ke,attributeName:null,attributeType:null,azimuth:ke,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ke,by:null,calcMode:null,capHeight:ke,className:Ft,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ke,diffuseConstant:ke,direction:null,display:null,dur:null,divisor:ke,dominantBaseline:null,download:Ye,dx:null,dy:null,edgeMode:null,editable:null,elevation:ke,enableBackground:null,end:null,event:null,exponent:ke,externalResourcesRequired:null,fill:null,fillOpacity:ke,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Ta,g2:Ta,glyphName:Ta,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ke,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ke,horizOriginX:ke,horizOriginY:ke,id:null,ideographic:ke,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ke,k:ke,k1:ke,k2:ke,k3:ke,k4:ke,kernelMatrix:vr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ke,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ke,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ke,overlineThickness:ke,paintOrder:null,panose1:null,path:null,pathLength:ke,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ft,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ke,pointsAtY:ke,pointsAtZ:ke,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:vr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:vr,rev:vr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:vr,requiredFeatures:vr,requiredFonts:vr,requiredFormats:vr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ke,specularExponent:ke,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ke,strikethroughThickness:ke,string:null,stroke:null,strokeDashArray:vr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ke,strokeOpacity:ke,strokeWidth:null,style:null,surfaceScale:ke,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:vr,tabIndex:ke,tableValues:null,target:null,targetX:ke,targetY:ke,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:vr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ke,underlineThickness:ke,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ke,values:null,vAlphabetic:ke,vMathematical:ke,vectorEffect:null,vHanging:ke,vIdeographic:ke,version:null,vertAdvY:ke,vertOriginX:ke,vertOriginY:ke,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ke,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:U2}),H2=Wl({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()}}),I2=Wl({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:q2}),V2=Wl({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),c6={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"},u6=/[A-Z]/g,T_=/-[a-z]/g,d6=/^data[-\w.:]+$/i;function f6(e,t){const n=$g(t);let r=t,a=or;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&d6.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(T_,p6);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!T_.test(o)){let u=o.replace(u6,h6);u.charAt(0)!=="-"&&(u="-"+u),t="data"+u}}a=Sx}return new a(r,t)}function h6(e){return"-"+e.toLowerCase()}function p6(e){return e.charAt(1).toUpperCase()}const m6=$2([F2,l6,H2,I2,V2],"html"),jx=$2([F2,o6,H2,I2,V2],"svg");function g6(e){return e.join(" ").trim()}var Sl={},Tm,A_;function x6(){if(A_)return Tm;A_=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,f=/^\s+|\s+$/g,h=`
72
- `,p="/",m="*",x="",b="comment",y="declaration";function _(N,S){if(typeof N!="string")throw new TypeError("First argument must be a string");if(!N)return[];S=S||{};var E=1,C=1;function O(K){var G=K.match(t);G&&(E+=G.length);var P=K.lastIndexOf(h);C=~P?K.length-P:C+K.length}function D(){var K={line:E,column:C};return function(G){return G.position=new L(K),W(),G}}function L(K){this.start=K,this.end={line:E,column:C},this.source=S.source}L.prototype.content=N;function I(K){var G=new Error(S.source+":"+E+":"+C+": "+K);if(G.reason=K,G.filename=S.source,G.line=E,G.column=C,G.source=N,!S.silent)throw G}function F(K){var G=K.exec(N);if(G){var P=G[0];return O(P),N=N.slice(P.length),G}}function W(){F(n)}function z(K){var G;for(K=K||[];G=q();)G!==!1&&K.push(G);return K}function q(){var K=D();if(!(p!=N.charAt(0)||m!=N.charAt(1))){for(var G=2;x!=N.charAt(G)&&(m!=N.charAt(G)||p!=N.charAt(G+1));)++G;if(G+=2,x===N.charAt(G-1))return I("End of comment missing");var P=N.slice(2,G-2);return C+=2,O(P),N=N.slice(G),C+=2,K({type:b,comment:P})}}function A(){var K=D(),G=F(r);if(G){if(q(),!F(a))return I("property missing ':'");var P=F(o),$=K({type:y,property:j(G[0].replace(e,x)),value:P?j(P[0].replace(e,x)):x});return F(u),$}}function ie(){var K=[];z(K);for(var G;G=A();)G!==!1&&(K.push(G),z(K));return K}return W(),ie()}function j(N){return N?N.replace(f,x):x}return Tm=_,Tm}var M_;function v6(){if(M_)return Sl;M_=1;var e=Sl&&Sl.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Sl,"__esModule",{value:!0}),Sl.default=n;const t=e(x6());function n(r,a){let o=null;if(!r||typeof r!="string")return o;const u=(0,t.default)(r),f=typeof a=="function";return u.forEach(h=>{if(h.type!=="declaration")return;const{property:p,value:m}=h;f?a(p,m,h):m&&(o=o||{},o[p]=m)}),o}return Sl}var rc={},R_;function b6(){if(R_)return rc;R_=1,Object.defineProperty(rc,"__esModule",{value:!0}),rc.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()},f=function(p,m){return"".concat(m,"-")},h=function(p,m){return m===void 0&&(m={}),o(p)?p:(p=p.toLowerCase(),m.reactCompat?p=p.replace(a,f):p=p.replace(r,f),p.replace(t,u))};return rc.camelCase=h,rc}var ic,L_;function y6(){if(L_)return ic;L_=1;var e=ic&&ic.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(v6()),n=b6();function r(a,o){var u={};return!a||typeof a!="string"||(0,t.default)(a,function(f,h){f&&h&&(u[(0,n.camelCase)(f,o)]=h)}),u}return r.default=r,ic=r,ic}var _6=y6();const w6=ex(_6),G2=Y2("end"),Nx=Y2("start");function Y2(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 k6(e){const t=Nx(e),n=G2(e);if(t&&n)return{start:t,end:n}}function _c(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?D_(e.position):"start"in e||"end"in e?D_(e):"line"in e||"column"in e?qg(e):""}function qg(e){return z_(e&&e.line)+":"+z_(e&&e.column)}function D_(e){return qg(e&&e.start)+"-"+qg(e&&e.end)}function z_(e){return e&&typeof e=="number"?e:1}class Fn 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 h=r.indexOf(":");h===-1?o.ruleId=r:(o.source=r.slice(0,h),o.ruleId=r.slice(h+1))}if(!o.place&&o.ancestors&&o.ancestors){const h=o.ancestors[o.ancestors.length-1];h&&(o.place=h.position)}const f=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=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=f?f.line:void 0,this.name=_c(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}}Fn.prototype.file="";Fn.prototype.name="";Fn.prototype.reason="";Fn.prototype.message="";Fn.prototype.stack="";Fn.prototype.column=void 0;Fn.prototype.line=void 0;Fn.prototype.ancestors=void 0;Fn.prototype.cause=void 0;Fn.prototype.fatal=void 0;Fn.prototype.place=void 0;Fn.prototype.ruleId=void 0;Fn.prototype.source=void 0;const Cx={}.hasOwnProperty,S6=new Map,j6=/[A-Z]/g,N6=new Set(["table","tbody","thead","tfoot","tr"]),C6=new Set(["td","th"]),W2="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function E6(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=O6(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=z6(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"?jx:m6,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=Q2(a,e,void 0);return o&&typeof o!="string"?o:a.create(e,a.Fragment,{children:o||void 0},void 0)}function Q2(e,t,n){if(t.type==="element")return T6(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return A6(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return R6(e,t,n);if(t.type==="mdxjsEsm")return M6(e,t);if(t.type==="root")return L6(e,t,n);if(t.type==="text")return D6(e,t)}function T6(e,t,n){const r=e.schema;let a=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(a=jx,e.schema=a),e.ancestors.push(t);const o=K2(e,t.tagName,!1),u=B6(e,t);let f=Tx(e,t);return N6.has(t.tagName)&&(f=f.filter(function(h){return typeof h=="string"?!s6(h):!0})),X2(e,u,o,t),Ex(u,f),e.ancestors.pop(),e.schema=r,e.create(t,o,u,n)}function A6(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)}Bc(e,t.position)}function M6(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Bc(e,t.position)}function R6(e,t,n){const r=e.schema;let a=r;t.name==="svg"&&r.space==="html"&&(a=jx,e.schema=a),e.ancestors.push(t);const o=t.name===null?e.Fragment:K2(e,t.name,!0),u=P6(e,t),f=Tx(e,t);return X2(e,u,o,t),Ex(u,f),e.ancestors.pop(),e.schema=r,e.create(t,o,u,n)}function L6(e,t,n){const r={};return Ex(r,Tx(e,t)),e.create(t,e.Fragment,r,n)}function D6(e,t){return t.value}function X2(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Ex(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function z6(e,t,n){return r;function r(a,o,u,f){const p=Array.isArray(u.children)?n:t;return f?p(o,u,f):p(o,u)}}function O6(e,t){return n;function n(r,a,o,u){const f=Array.isArray(o.children),h=Nx(r);return t(a,o,u,f,{columnNumber:h?h.column-1:void 0,fileName:e,lineNumber:h?h.line:void 0},void 0)}}function B6(e,t){const n={};let r,a;for(a in t.properties)if(a!=="children"&&Cx.call(t.properties,a)){const o=$6(e,a,t.properties[a]);if(o){const[u,f]=o;e.tableCellAlignToStyle&&u==="align"&&typeof f=="string"&&C6.has(t.tagName)?r=f:n[u]=f}}if(r){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function P6(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 f=u.properties[0];f.type,Object.assign(n,e.evaluater.evaluateExpression(f.argument))}else Bc(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 f=r.value.data.estree.body[0];f.type,o=e.evaluater.evaluateExpression(f.expression)}else Bc(e,t.position);else o=r.value===null?!0:r.value;n[a]=o}return n}function Tx(e,t){const n=[];let r=-1;const a=e.passKeys?new Map:S6;for(;++r<t.children.length;){const o=t.children[r];let u;if(e.passKeys){const h=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(h){const p=a.get(h)||0;u=h+"-"+p,a.set(h,p+1)}}const f=Q2(e,o,u);f!==void 0&&n.push(f)}return n}function $6(e,t,n){const r=f6(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?e6(n):g6(n)),r.property==="style"){let a=typeof n=="object"?n:F6(e,String(n));return e.stylePropertyNameCase==="css"&&(a=U6(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&r.space?c6[r.property]||r.property:r.attribute,n]}}function F6(e,t){try{return w6(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,a=new Fn("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=W2+"#cannot-parse-style-attribute",a}}function K2(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 f=N_(a[o])?{type:"Identifier",name:a[o]}:{type:"Literal",value:a[o]};u=u?{type:"MemberExpression",object:u,property:f,computed:!!(o&&f.type==="Literal"),optional:!1}:f}r=u}else r=N_(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const a=r.value;return Cx.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(r);Bc(e)}function Bc(e,t){const n=new Fn("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=W2+"#cannot-handle-mdx-estrees-without-createevaluater",n}function U6(e){const t={};let n;for(n in e)Cx.call(e,n)&&(t[q6(n)]=e[n]);return t}function q6(e){let t=e.replace(j6,H6);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function H6(e){return"-"+e.toLowerCase()}const Am={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"]},I6={};function Ax(e,t){const n=I6,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Z2(e,r,a)}function Z2(e,t,n){if(V6(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 O_(e.children,t,n)}return Array.isArray(e)?O_(e,t,n):""}function O_(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=Z2(e[a],t,n);return r.join("")}function V6(e){return!!(e&&typeof e=="object")}const B_=document.createElement("i");function Mx(e){const t="&"+e+";";B_.innerHTML=t;const n=B_.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function kr(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 Ur(e,t){return e.length>0?(kr(e,e.length,0,t),e):t}const P_={}.hasOwnProperty;function J2(e){const t={};let n=-1;for(;++n<e.length;)G6(t,e[n]);return t}function G6(e,t){let n;for(n in t){const a=(P_.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let u;if(o)for(u in o){P_.call(a,u)||(a[u]=[]);const f=o[u];Y6(a[u],Array.isArray(f)?f:f?[f]:[])}}}function Y6(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);kr(e,0,0,r)}function ek(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 ei(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Wn=qs(/[A-Za-z]/),Pn=qs(/[\dA-Za-z]/),W6=qs(/[#-'*+\--9=?A-Z^-~]/);function bf(e){return e!==null&&(e<32||e===127)}const Hg=qs(/\d/),Q6=qs(/[\dA-Fa-f]/),X6=qs(/[!-/:-@[-`{-~]/);function Fe(e){return e!==null&&e<-2}function qt(e){return e!==null&&(e<0||e===32)}function ct(e){return e===-2||e===-1||e===32}const Mf=qs(new RegExp("\\p{P}|\\p{S}","u")),Ra=qs(/\s/);function qs(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Ql(e){const t=[];let n=-1,r=0,a=0;for(;++n<e.length;){const o=e.charCodeAt(n);let u="";if(o===37&&Pn(e.charCodeAt(n+1))&&Pn(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 f=e.charCodeAt(n+1);o<56320&&f>56319&&f<57344?(u=String.fromCharCode(o,f),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 xt(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let o=0;return u;function u(h){return ct(h)?(e.enter(n),f(h)):t(h)}function f(h){return ct(h)&&o++<a?(e.consume(h),f):(e.exit(n),t(h))}}const K6={tokenize:Z6};function Z6(e){const t=e.attempt(this.parser.constructs.contentInitial,r,a);let n;return t;function r(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),xt(e,t,"linePrefix")}function a(f){return e.enter("paragraph"),o(f)}function o(f){const h=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=h),n=h,u(f)}function u(f){if(f===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(f);return}return Fe(f)?(e.consume(f),e.exit("chunkText"),o):(e.consume(f),u)}}const J6={tokenize:eT},$_={tokenize:tT};function eT(e){const t=this,n=[];let r=0,a,o,u;return f;function f(C){if(r<n.length){const O=n[r];return t.containerState=O[1],e.attempt(O[0].continuation,h,p)(C)}return p(C)}function h(C){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&E();const O=t.events.length;let D=O,L;for(;D--;)if(t.events[D][0]==="exit"&&t.events[D][1].type==="chunkFlow"){L=t.events[D][1].end;break}S(r);let I=O;for(;I<t.events.length;)t.events[I][1].end={...L},I++;return kr(t.events,D+1,0,t.events.slice(O)),t.events.length=I,p(C)}return f(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($_,m,x)(C)}function m(C){return a&&E(),S(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($_,y,_)(C)}function y(C){return r++,n.push([t.currentConstruct,t.containerState]),b(C)}function _(C){if(C===null){a&&E(),S(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),S(0),e.consume(C);return}return Fe(C)?(e.consume(C),N(e.exit("chunkFlow")),r=0,t.interrupt=void 0,f):(e.consume(C),j)}function N(C,O){const D=t.sliceStream(C);if(O&&D.push(null),C.previous=o,o&&(o.next=C),o=C,a.defineSkip(C.start),a.write(D),t.parser.lazy[C.start.line]){let L=a.events.length;for(;L--;)if(a.events[L][1].start.offset<u&&(!a.events[L][1].end||a.events[L][1].end.offset>u))return;const I=t.events.length;let F=I,W,z;for(;F--;)if(t.events[F][0]==="exit"&&t.events[F][1].type==="chunkFlow"){if(W){z=t.events[F][1].end;break}W=!0}for(S(r),L=I;L<t.events.length;)t.events[L][1].end={...z},L++;kr(t.events,F+1,0,t.events.slice(I)),t.events.length=L}}function S(C){let O=n.length;for(;O-- >C;){const D=n[O];t.containerState=D[1],D[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 tT(e,t,n){return xt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Il(e){if(e===null||qt(e)||Ra(e))return 1;if(Mf(e))return 2}function Rf(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 Ig={name:"attention",resolveAll:nT,tokenize:rT};function nT(e,t){let n=-1,r,a,o,u,f,h,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;h=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};F_(x,-h),F_(b,h),u={type:h>1?"strongSequence":"emphasisSequence",start:x,end:{...e[r][1].end}},f={type:h>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:b},o={type:h>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},a={type:h>1?"strong":"emphasis",start:{...u.start},end:{...f.end}},e[r][1].end={...u.start},e[n][1].start={...f.end},p=[],e[r][1].end.offset-e[r][1].start.offset&&(p=Ur(p,[["enter",e[r][1],t],["exit",e[r][1],t]])),p=Ur(p,[["enter",a,t],["enter",u,t],["exit",u,t],["enter",o,t]]),p=Ur(p,Rf(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),p=Ur(p,[["exit",o,t],["enter",f,t],["exit",f,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(m=2,p=Ur(p,[["enter",e[n][1],t],["exit",e[n][1],t]])):m=0,kr(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 rT(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=Il(r);let o;return u;function u(h){return o=h,e.enter("attentionSequence"),f(h)}function f(h){if(h===o)return e.consume(h),f;const p=e.exit("attentionSequence"),m=Il(h),x=!m||m===2&&a||n.includes(h),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(h)}}function F_(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const iT={name:"autolink",tokenize:sT};function sT(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 Wn(y)?(e.consume(y),u):y===64?n(y):p(y)}function u(y){return y===43||y===45||y===46||Pn(y)?(r=1,f(y)):p(y)}function f(y){return y===58?(e.consume(y),r=0,h):(y===43||y===45||y===46||Pn(y))&&r++<32?(e.consume(y),f):(r=0,p(y))}function h(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||bf(y)?n(y):(e.consume(y),h)}function p(y){return y===64?(e.consume(y),m):W6(y)?(e.consume(y),p):n(y)}function m(y){return Pn(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||Pn(y))&&r++<63){const _=y===45?b:x;return e.consume(y),_}return n(y)}}const Hc={partial:!0,tokenize:aT};function aT(e,t,n){return r;function r(o){return ct(o)?xt(e,a,"linePrefix")(o):a(o)}function a(o){return o===null||Fe(o)?t(o):n(o)}}const tk={continuation:{tokenize:oT},exit:cT,name:"blockQuote",tokenize:lT};function lT(e,t,n){const r=this;return a;function a(u){if(u===62){const f=r.containerState;return f.open||(e.enter("blockQuote",{_container:!0}),f.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(u),e.exit("blockQuoteMarker"),o}return n(u)}function o(u){return ct(u)?(e.enter("blockQuotePrefixWhitespace"),e.consume(u),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(u))}}function oT(e,t,n){const r=this;return a;function a(u){return ct(u)?xt(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u):o(u)}function o(u){return e.attempt(tk,t,n)(u)}}function cT(e){e.exit("blockQuote")}const nk={name:"characterEscape",tokenize:uT};function uT(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 X6(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const rk={name:"characterReference",tokenize:dT};function dT(e,t,n){const r=this;let a=0,o,u;return f;function f(x){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(x),e.exit("characterReferenceMarker"),h}function h(x){return x===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(x),e.exit("characterReferenceMarkerNumeric"),p):(e.enter("characterReferenceValue"),o=31,u=Pn,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=Q6,m):(e.enter("characterReferenceValue"),o=7,u=Hg,m(x))}function m(x){if(x===59&&a){const b=e.exit("characterReferenceValue");return u===Pn&&!Mx(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 U_={partial:!0,tokenize:hT},q_={concrete:!0,name:"codeFenced",tokenize:fT};function fT(e,t,n){const r=this,a={partial:!0,tokenize:D};let o=0,u=0,f;return h;function h(L){return p(L)}function p(L){const I=r.events[r.events.length-1];return o=I&&I[1].type==="linePrefix"?I[2].sliceSerialize(I[1],!0).length:0,f=L,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),m(L)}function m(L){return L===f?(u++,e.consume(L),m):u<3?n(L):(e.exit("codeFencedFenceSequence"),ct(L)?xt(e,x,"whitespace")(L):x(L))}function x(L){return L===null||Fe(L)?(e.exit("codeFencedFence"),r.interrupt?t(L):e.check(U_,j,O)(L)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),b(L))}function b(L){return L===null||Fe(L)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),x(L)):ct(L)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),xt(e,y,"whitespace")(L)):L===96&&L===f?n(L):(e.consume(L),b)}function y(L){return L===null||Fe(L)?x(L):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),_(L))}function _(L){return L===null||Fe(L)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),x(L)):L===96&&L===f?n(L):(e.consume(L),_)}function j(L){return e.attempt(a,O,N)(L)}function N(L){return e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),S}function S(L){return o>0&&ct(L)?xt(e,E,"linePrefix",o+1)(L):E(L)}function E(L){return L===null||Fe(L)?e.check(U_,j,O)(L):(e.enter("codeFlowValue"),C(L))}function C(L){return L===null||Fe(L)?(e.exit("codeFlowValue"),E(L)):(e.consume(L),C)}function O(L){return e.exit("codeFenced"),t(L)}function D(L,I,F){let W=0;return z;function z(G){return L.enter("lineEnding"),L.consume(G),L.exit("lineEnding"),q}function q(G){return L.enter("codeFencedFence"),ct(G)?xt(L,A,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(G):A(G)}function A(G){return G===f?(L.enter("codeFencedFenceSequence"),ie(G)):F(G)}function ie(G){return G===f?(W++,L.consume(G),ie):W>=u?(L.exit("codeFencedFenceSequence"),ct(G)?xt(L,K,"whitespace")(G):K(G)):F(G)}function K(G){return G===null||Fe(G)?(L.exit("codeFencedFence"),I(G)):F(G)}}}function hT(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 Mm={name:"codeIndented",tokenize:mT},pT={partial:!0,tokenize:gT};function mT(e,t,n){const r=this;return a;function a(p){return e.enter("codeIndented"),xt(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?h(p):Fe(p)?e.attempt(pT,u,h)(p):(e.enter("codeFlowValue"),f(p))}function f(p){return p===null||Fe(p)?(e.exit("codeFlowValue"),u(p)):(e.consume(p),f)}function h(p){return e.exit("codeIndented"),t(p)}}function gT(e,t,n){const r=this;return a;function a(u){return r.parser.lazy[r.now().line]?n(u):Fe(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),a):xt(e,o,"linePrefix",5)(u)}function o(u){const f=r.events[r.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(u):Fe(u)?a(u):n(u)}}const xT={name:"codeText",previous:bT,resolve:vT,tokenize:yT};function vT(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 bT(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function yT(e,t,n){let r=0,a,o;return u;function u(x){return e.enter("codeText"),e.enter("codeTextSequence"),f(x)}function f(x){return x===96?(e.consume(x),r++,f):(e.exit("codeTextSequence"),h(x))}function h(x){return x===null?n(x):x===32?(e.enter("space"),e.consume(x),e.exit("space"),h):x===96?(o=e.enter("codeTextSequence"),a=0,m(x)):Fe(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),h):(e.enter("codeTextData"),p(x))}function p(x){return x===null||x===32||x===96||Fe(x)?(e.exit("codeTextData"),h(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 _T{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&&sc(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),sc(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),sc(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);sc(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);sc(this.left,n.reverse())}}}function sc(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 ik(e){const t={};let n=-1,r,a,o,u,f,h,p;const m=new _T(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"&&(h=r[1]._tokenizer.events,o=0,o<h.length&&h[o][1].type==="lineEndingBlank"&&(o+=2),o<h.length&&h[o][1].type==="content"))for(;++o<h.length&&h[o][1].type!=="content";)h[o][1].type==="chunkText"&&(h[o][1]._isInFirstContentOfListItem=!0,o++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,wT(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},f=m.slice(a,n),f.unshift(r),m.splice(a,n-a+1,f))}}return kr(e,0,Number.POSITIVE_INFINITY,m.slice(0)),!p}function wT(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 f=u.events,h=[],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<f.length;)f[b][0]==="exit"&&f[b-1][0]==="enter"&&f[b][1].type===f[b-1][1].type&&f[b][1].start.line!==f[b][1].end.line&&(j=b+1,N.push(j),y._tokenizer=void 0,y.previous=void 0,y=y.next);for(u.events=[],y?(y._tokenizer=void 0,y.previous=void 0):N.pop(),b=N.length;b--;){const S=f.slice(N[b],N[b+1]),E=o.pop();h.push([E,E+S.length-1]),e.splice(E,2,S)}for(h.reverse(),b=-1;++b<h.length;)p[_+h[b][0]]=_+h[b][1],_+=h[b][1]-h[b][0]-1;return p}const kT={resolve:jT,tokenize:NT},ST={partial:!0,tokenize:CT};function jT(e){return ik(e),e}function NT(e,t){let n;return r;function r(f){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(f)}function a(f){return f===null?o(f):Fe(f)?e.check(ST,u,o)(f):(e.consume(f),a)}function o(f){return e.exit("chunkContent"),e.exit("content"),t(f)}function u(f){return e.consume(f),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function CT(e,t,n){const r=this;return a;function a(u){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),xt(e,o,"linePrefix")}function o(u){if(u===null||Fe(u))return n(u);const f=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(u):e.interrupt(r.parser.constructs.flow,n,t)(u)}}function sk(e,t,n,r,a,o,u,f,h){const p=h||Number.POSITIVE_INFINITY;let m=0;return x;function x(S){return S===60?(e.enter(r),e.enter(a),e.enter(o),e.consume(S),e.exit(o),b):S===null||S===32||S===41||bf(S)?n(S):(e.enter(r),e.enter(u),e.enter(f),e.enter("chunkString",{contentType:"string"}),j(S))}function b(S){return S===62?(e.enter(o),e.consume(S),e.exit(o),e.exit(a),e.exit(r),t):(e.enter(f),e.enter("chunkString",{contentType:"string"}),y(S))}function y(S){return S===62?(e.exit("chunkString"),e.exit(f),b(S)):S===null||S===60||Fe(S)?n(S):(e.consume(S),S===92?_:y)}function _(S){return S===60||S===62||S===92?(e.consume(S),y):y(S)}function j(S){return!m&&(S===null||S===41||qt(S))?(e.exit("chunkString"),e.exit(f),e.exit(u),e.exit(r),t(S)):m<p&&S===40?(e.consume(S),m++,j):S===41?(e.consume(S),m--,j):S===null||S===32||S===40||bf(S)?n(S):(e.consume(S),S===92?N:j)}function N(S){return S===40||S===41||S===92?(e.consume(S),j):j(S)}}function ak(e,t,n,r,a,o){const u=this;let f=0,h;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 f>999||y===null||y===91||y===93&&!h||y===94&&!f&&"_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):Fe(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||Fe(y)||f++>999?(e.exit("chunkString"),m(y)):(e.consume(y),h||(h=!ct(y)),y===92?b:x)}function b(y){return y===91||y===92||y===93?(e.consume(y),f++,x):x(y)}}function lk(e,t,n,r,a,o){let u;return f;function f(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,h):n(b)}function h(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),h(u)):b===null?n(b):Fe(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),xt(e,p,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),m(b))}function m(b){return b===u||b===null||Fe(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 wc(e,t){let n;return r;function r(a){return Fe(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):ct(a)?xt(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const ET={name:"definition",tokenize:AT},TT={partial:!0,tokenize:MT};function AT(e,t,n){const r=this;let a;return o;function o(y){return e.enter("definition"),u(y)}function u(y){return ak.call(r,e,f,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function f(y){return a=ei(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),h):n(y)}function h(y){return qt(y)?wc(e,p)(y):p(y)}function p(y){return sk(e,m,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function m(y){return e.attempt(TT,x,x)(y)}function x(y){return ct(y)?xt(e,b,"whitespace")(y):b(y)}function b(y){return y===null||Fe(y)?(e.exit("definition"),r.parser.defined.push(a),t(y)):n(y)}}function MT(e,t,n){return r;function r(f){return qt(f)?wc(e,a)(f):n(f)}function a(f){return lk(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function o(f){return ct(f)?xt(e,u,"whitespace")(f):u(f)}function u(f){return f===null||Fe(f)?t(f):n(f)}}const RT={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 Fe(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const DT={name:"headingAtx",resolve:zT,tokenize:OT};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"},kr(e,r,n-r+1,[["enter",a,t],["enter",o,t],["exit",o,t],["exit",a,t]])),e}function OT(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||qt(m)?(e.exit("atxHeadingSequence"),f(m)):n(m)}function f(m){return m===35?(e.enter("atxHeadingSequence"),h(m)):m===null||Fe(m)?(e.exit("atxHeading"),t(m)):ct(m)?xt(e,f,"whitespace")(m):(e.enter("atxHeadingText"),p(m))}function h(m){return m===35?(e.consume(m),h):(e.exit("atxHeadingSequence"),f(m))}function p(m){return m===null||m===35||qt(m)?(e.exit("atxHeadingText"),f(m)):(e.consume(m),p)}}const BT=["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"],H_=["pre","script","style","textarea"],PT={concrete:!0,name:"htmlFlow",resolveTo:UT,tokenize:qT},$T={partial:!0,tokenize:IT},FT={partial:!0,tokenize:HT};function UT(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 qT(e,t,n){const r=this;let a,o,u,f,h;return p;function p(M){return m(M)}function m(M){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(M),x}function x(M){return M===33?(e.consume(M),b):M===47?(e.consume(M),o=!0,j):M===63?(e.consume(M),a=3,r.interrupt?t:R):Wn(M)?(e.consume(M),u=String.fromCharCode(M),N):n(M)}function b(M){return M===45?(e.consume(M),a=2,y):M===91?(e.consume(M),a=5,f=0,_):Wn(M)?(e.consume(M),a=4,r.interrupt?t:R):n(M)}function y(M){return M===45?(e.consume(M),r.interrupt?t:R):n(M)}function _(M){const pe="CDATA[";return M===pe.charCodeAt(f++)?(e.consume(M),f===pe.length?r.interrupt?t:A:_):n(M)}function j(M){return Wn(M)?(e.consume(M),u=String.fromCharCode(M),N):n(M)}function N(M){if(M===null||M===47||M===62||qt(M)){const pe=M===47,_e=u.toLowerCase();return!pe&&!o&&H_.includes(_e)?(a=1,r.interrupt?t(M):A(M)):BT.includes(u.toLowerCase())?(a=6,pe?(e.consume(M),S):r.interrupt?t(M):A(M)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(M):o?E(M):C(M))}return M===45||Pn(M)?(e.consume(M),u+=String.fromCharCode(M),N):n(M)}function S(M){return M===62?(e.consume(M),r.interrupt?t:A):n(M)}function E(M){return ct(M)?(e.consume(M),E):z(M)}function C(M){return M===47?(e.consume(M),z):M===58||M===95||Wn(M)?(e.consume(M),O):ct(M)?(e.consume(M),C):z(M)}function O(M){return M===45||M===46||M===58||M===95||Pn(M)?(e.consume(M),O):D(M)}function D(M){return M===61?(e.consume(M),L):ct(M)?(e.consume(M),D):C(M)}function L(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),h=M,I):ct(M)?(e.consume(M),L):F(M)}function I(M){return M===h?(e.consume(M),h=null,W):M===null||Fe(M)?n(M):(e.consume(M),I)}function F(M){return M===null||M===34||M===39||M===47||M===60||M===61||M===62||M===96||qt(M)?D(M):(e.consume(M),F)}function W(M){return M===47||M===62||ct(M)?C(M):n(M)}function z(M){return M===62?(e.consume(M),q):n(M)}function q(M){return M===null||Fe(M)?A(M):ct(M)?(e.consume(M),q):n(M)}function A(M){return M===45&&a===2?(e.consume(M),P):M===60&&a===1?(e.consume(M),$):M===62&&a===4?(e.consume(M),B):M===63&&a===3?(e.consume(M),R):M===93&&a===5?(e.consume(M),ae):Fe(M)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check($T,Z,ie)(M)):M===null||Fe(M)?(e.exit("htmlFlowData"),ie(M)):(e.consume(M),A)}function ie(M){return e.check(FT,K,Z)(M)}function K(M){return e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),G}function G(M){return M===null||Fe(M)?ie(M):(e.enter("htmlFlowData"),A(M))}function P(M){return M===45?(e.consume(M),R):A(M)}function $(M){return M===47?(e.consume(M),u="",se):A(M)}function se(M){if(M===62){const pe=u.toLowerCase();return H_.includes(pe)?(e.consume(M),B):A(M)}return Wn(M)&&u.length<8?(e.consume(M),u+=String.fromCharCode(M),se):A(M)}function ae(M){return M===93?(e.consume(M),R):A(M)}function R(M){return M===62?(e.consume(M),B):M===45&&a===2?(e.consume(M),R):A(M)}function B(M){return M===null||Fe(M)?(e.exit("htmlFlowData"),Z(M)):(e.consume(M),B)}function Z(M){return e.exit("htmlFlow"),t(M)}}function HT(e,t,n){const r=this;return a;function a(u){return Fe(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 IT(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(Hc,t,n)}}const VT={name:"htmlText",tokenize:GT};function GT(e,t,n){const r=this;let a,o,u;return f;function f(R){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(R),h}function h(R){return R===33?(e.consume(R),p):R===47?(e.consume(R),D):R===63?(e.consume(R),C):Wn(R)?(e.consume(R),F):n(R)}function p(R){return R===45?(e.consume(R),m):R===91?(e.consume(R),o=0,_):Wn(R)?(e.consume(R),E):n(R)}function m(R){return R===45?(e.consume(R),y):n(R)}function x(R){return R===null?n(R):R===45?(e.consume(R),b):Fe(R)?(u=x,$(R)):(e.consume(R),x)}function b(R){return R===45?(e.consume(R),y):x(R)}function y(R){return R===62?P(R):R===45?b(R):x(R)}function _(R){const B="CDATA[";return R===B.charCodeAt(o++)?(e.consume(R),o===B.length?j:_):n(R)}function j(R){return R===null?n(R):R===93?(e.consume(R),N):Fe(R)?(u=j,$(R)):(e.consume(R),j)}function N(R){return R===93?(e.consume(R),S):j(R)}function S(R){return R===62?P(R):R===93?(e.consume(R),S):j(R)}function E(R){return R===null||R===62?P(R):Fe(R)?(u=E,$(R)):(e.consume(R),E)}function C(R){return R===null?n(R):R===63?(e.consume(R),O):Fe(R)?(u=C,$(R)):(e.consume(R),C)}function O(R){return R===62?P(R):C(R)}function D(R){return Wn(R)?(e.consume(R),L):n(R)}function L(R){return R===45||Pn(R)?(e.consume(R),L):I(R)}function I(R){return Fe(R)?(u=I,$(R)):ct(R)?(e.consume(R),I):P(R)}function F(R){return R===45||Pn(R)?(e.consume(R),F):R===47||R===62||qt(R)?W(R):n(R)}function W(R){return R===47?(e.consume(R),P):R===58||R===95||Wn(R)?(e.consume(R),z):Fe(R)?(u=W,$(R)):ct(R)?(e.consume(R),W):P(R)}function z(R){return R===45||R===46||R===58||R===95||Pn(R)?(e.consume(R),z):q(R)}function q(R){return R===61?(e.consume(R),A):Fe(R)?(u=q,$(R)):ct(R)?(e.consume(R),q):W(R)}function A(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(e.consume(R),a=R,ie):Fe(R)?(u=A,$(R)):ct(R)?(e.consume(R),A):(e.consume(R),K)}function ie(R){return R===a?(e.consume(R),a=void 0,G):R===null?n(R):Fe(R)?(u=ie,$(R)):(e.consume(R),ie)}function K(R){return R===null||R===34||R===39||R===60||R===61||R===96?n(R):R===47||R===62||qt(R)?W(R):(e.consume(R),K)}function G(R){return R===47||R===62||qt(R)?W(R):n(R)}function P(R){return R===62?(e.consume(R),e.exit("htmlTextData"),e.exit("htmlText"),t):n(R)}function $(R){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),se}function se(R){return ct(R)?xt(e,ae,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):ae(R)}function ae(R){return e.enter("htmlTextData"),u(R)}}const Rx={name:"labelEnd",resolveAll:XT,resolveTo:KT,tokenize:ZT},YT={tokenize:JT},WT={tokenize:eA},QT={tokenize:tA};function XT(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&&kr(e,0,e.length,n),e}function KT(e,t){let n=e.length,r=0,a,o,u,f;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 h={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 f=[["enter",h,t],["enter",p,t]],f=Ur(f,e.slice(o+1,o+r+3)),f=Ur(f,[["enter",m,t]]),f=Ur(f,Rf(t.parser.constructs.insideSpan.null,e.slice(o+r+4,u-3),t)),f=Ur(f,[["exit",m,t],e[u-2],e[u-1],["exit",p,t]]),f=Ur(f,e.slice(u+1)),f=Ur(f,[["exit",h,t]]),kr(e,o,e.length,f),e}function ZT(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 f;function f(b){return o?o._inactive?x(b):(u=r.parser.defined.includes(ei(r.sliceSerialize({start:o.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(b),e.exit("labelMarker"),e.exit("labelEnd"),h):n(b)}function h(b){return b===40?e.attempt(YT,m,u?m:x)(b):b===91?e.attempt(WT,m,u?p:x)(b):u?m(b):x(b)}function p(b){return e.attempt(QT,m,x)(b)}function m(b){return t(b)}function x(b){return o._balanced=!0,n(b)}}function JT(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 qt(x)?wc(e,o)(x):o(x)}function o(x){return x===41?m(x):sk(e,u,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(x)}function u(x){return qt(x)?wc(e,h)(x):m(x)}function f(x){return n(x)}function h(x){return x===34||x===39||x===40?lk(e,p,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(x):m(x)}function p(x){return qt(x)?wc(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 eA(e,t,n){const r=this;return a;function a(f){return ak.call(r,e,o,u,"reference","referenceMarker","referenceString")(f)}function o(f){return r.parser.defined.includes(ei(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(f):n(f)}function u(f){return n(f)}}function tA(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 nA={name:"labelStartImage",resolveAll:Rx.resolveAll,tokenize:rA};function rA(e,t,n){const r=this;return a;function a(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),o}function o(f){return f===91?(e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelImage"),u):n(f)}function u(f){return f===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(f):t(f)}}const iA={name:"labelStartLink",resolveAll:Rx.resolveAll,tokenize:sA};function sA(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 Rm={name:"lineEnding",tokenize:aA};function aA(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),xt(e,t,"linePrefix")}}const Hd={name:"thematicBreak",tokenize:lA};function lA(e,t,n){let r=0,a;return o;function o(p){return e.enter("thematicBreak"),u(p)}function u(p){return a=p,f(p)}function f(p){return p===a?(e.enter("thematicBreakSequence"),h(p)):r>=3&&(p===null||Fe(p))?(e.exit("thematicBreak"),t(p)):n(p)}function h(p){return p===a?(e.consume(p),r++,h):(e.exit("thematicBreakSequence"),ct(p)?xt(e,f,"whitespace")(p):f(p))}}const sr={continuation:{tokenize:dA},exit:hA,name:"list",tokenize:uA},oA={partial:!0,tokenize:pA},cA={partial:!0,tokenize:fA};function uA(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 f;function f(y){const _=r.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(_==="listUnordered"?!r.containerState.marker||y===r.containerState.marker:Hg(y)){if(r.containerState.type||(r.containerState.type=_,e.enter(_,{_container:!0})),_==="listUnordered")return e.enter("listItemPrefix"),y===42||y===45?e.check(Hd,n,p)(y):p(y);if(!r.interrupt||y===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),h(y)}return n(y)}function h(y){return Hg(y)&&++u<10?(e.consume(y),h):(!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(Hc,r.interrupt?n:m,e.attempt(oA,b,x))}function m(y){return r.containerState.initialBlankLine=!0,o++,b(y)}function x(y){return ct(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 dA(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Hc,a,o);function a(f){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,xt(e,t,"listItemIndent",r.containerState.size+1)(f)}function o(f){return r.containerState.furtherBlankLines||!ct(f)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,u(f)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(cA,t,u)(f))}function u(f){return r.containerState._closeFlow=!0,r.interrupt=void 0,xt(e,e.attempt(sr,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function fA(e,t,n){const r=this;return xt(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 hA(e){e.exit(this.containerState.type)}function pA(e,t,n){const r=this;return xt(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!ct(o)&&u&&u[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const I_={name:"setextUnderline",resolveTo:mA,tokenize:gA};function mA(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 gA(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"),f(p)}function f(p){return p===a?(e.consume(p),f):(e.exit("setextHeadingLineSequence"),ct(p)?xt(e,h,"lineSuffix")(p):h(p))}function h(p){return p===null||Fe(p)?(e.exit("setextHeadingLine"),t(p)):n(p)}}const xA={tokenize:vA};function vA(e){const t=this,n=e.attempt(Hc,r,e.attempt(this.parser.constructs.flowInitial,a,xt(e,e.attempt(this.parser.constructs.flow,a,e.attempt(kT,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 bA={resolveAll:ck()},yA=ok("string"),_A=ok("text");function ok(e){return{resolveAll:ck(e==="text"?wA:void 0),tokenize:t};function t(n){const r=this,a=this.parser.constructs[e],o=n.attempt(a,u,f);return u;function u(m){return p(m)?o(m):f(m)}function f(m){if(m===null){n.consume(m);return}return n.enter("data"),n.consume(m),h}function h(m){return p(m)?(n.exit("data"),o(m)):(n.consume(m),h)}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 ck(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 wA(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,f=0,h;for(;o--;){const p=a[o];if(typeof p=="string"){for(u=p.length;p.charCodeAt(u-1)===32;)f++,u--;if(u)break;u=-1}else if(p===-2)h=!0,f++;else if(p!==-1){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(f=0),f){const p={type:n===e.length||h||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?u:r.start._bufferIndex+u,_index:r.start._index+o,line:r.end.line,column:r.end.column-f,offset:r.end.offset-f},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 kA={42:sr,43:sr,45:sr,48:sr,49:sr,50:sr,51:sr,52:sr,53:sr,54:sr,55:sr,56:sr,57:sr,62:tk},SA={91:ET},jA={[-2]:Mm,[-1]:Mm,32:Mm},NA={35:DT,42:Hd,45:[I_,Hd],60:PT,61:I_,95:Hd,96:q_,126:q_},CA={38:rk,92:nk},EA={[-5]:Rm,[-4]:Rm,[-3]:Rm,33:nA,38:rk,42:Ig,60:[iT,VT],91:iA,92:[RT,nk],93:Rx,95:Ig,96:xT},TA={null:[Ig,bA]},AA={null:[42,95]},MA={null:[]},RA=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:AA,contentInitial:SA,disable:MA,document:kA,flow:NA,flowInitial:jA,insideSpan:TA,string:CA,text:EA},Symbol.toStringTag,{value:"Module"}));function LA(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=[],f=[];const h={attempt:I(D),check:I(L),consume:E,enter:C,exit:O,interrupt:I(L,{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,h);return t.resolveAll&&o.push(t),p;function x(q){return u=Ur(u,q),N(),u[u.length-1]!==null?[]:(F(t,0),p.events=Rf(o,p.events,p),p.events)}function b(q,A){return zA(y(q),A)}function y(q){return DA(u,q)}function _(){const{_bufferIndex:q,_index:A,line:ie,column:K,offset:G}=r;return{_bufferIndex:q,_index:A,line:ie,column:K,offset:G}}function j(q){a[q.line]=q.column,z()}function N(){let q;for(;r._index<u.length;){const A=u[r._index];if(typeof A=="string")for(q=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===q&&r._bufferIndex<A.length;)S(A.charCodeAt(r._bufferIndex));else S(A)}}function S(q){m=m(q)}function E(q){Fe(q)?(r.line++,r.column=1,r.offset+=q===-3?2:1,z()):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,A){const ie=A||{};return ie.type=q,ie.start=_(),p.events.push(["enter",ie,p]),f.push(ie),ie}function O(q){const A=f.pop();return A.end=_(),p.events.push(["exit",A,p]),A}function D(q,A){F(q,A.from)}function L(q,A){A.restore()}function I(q,A){return ie;function ie(K,G,P){let $,se,ae,R;return Array.isArray(K)?Z(K):"tokenize"in K?Z([K]):B(K);function B(Ce){return De;function De(Ee){const Be=Ee!==null&&Ce[Ee],Je=Ee!==null&&Ce.null,Et=[...Array.isArray(Be)?Be:Be?[Be]:[],...Array.isArray(Je)?Je:Je?[Je]:[]];return Z(Et)(Ee)}}function Z(Ce){return $=Ce,se=0,Ce.length===0?P:M(Ce[se])}function M(Ce){return De;function De(Ee){return R=W(),ae=Ce,Ce.partial||(p.currentConstruct=Ce),Ce.name&&p.parser.constructs.disable.null.includes(Ce.name)?_e():Ce.tokenize.call(A?Object.assign(Object.create(p),A):p,h,pe,_e)(Ee)}}function pe(Ce){return q(ae,R),G}function _e(Ce){return R.restore(),++se<$.length?M($[se]):P}}}function F(q,A){q.resolveAll&&!o.includes(q)&&o.push(q),q.resolve&&kr(p.events,A,p.events.length-A,q.resolve(p.events.slice(A),p)),q.resolveTo&&(p.events=q.resolveTo(p.events,p))}function W(){const q=_(),A=p.previous,ie=p.currentConstruct,K=p.events.length,G=Array.from(f);return{from:K,restore:P};function P(){r=q,p.previous=A,p.currentConstruct=ie,p.events.length=K,f=G,z()}}function z(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function DA(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 f=u[0];typeof f=="string"?u[0]=f.slice(r):u.shift()}o>0&&u.push(e[a].slice(0,o))}return u}function zA(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 OA(e){const r={constructs:J2([RA,...(e||{}).extensions||[]]),content:a(K6),defined:[],document:a(J6),flow:a(xA),lazy:{},string:a(yA),text:a(_A)};return r;function a(o){return u;function u(f){return LA(r,o,f)}}}function BA(e){for(;!ik(e););return e}const V_=/[\0\t\n\r]/g;function PA(){let e=1,t="",n=!0,r;return a;function a(o,u,f){const h=[];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(V_.lastIndex=x,p=V_.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)h.push(-3),r=void 0;else switch(r&&(h.push(-5),r=void 0),x<b&&(h.push(o.slice(x,b)),e+=b-x),y){case 0:{h.push(65533),e++;break}case 9:{for(m=Math.ceil(e/4)*4,h.push(-2);e++<m;)h.push(-1);break}case 10:{h.push(-4),e=1;break}default:r=!0,e=1}x=b+1}return f&&(r&&h.push(-5),t&&h.push(t),h.push(null)),h}}const $A=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function FA(e){return e.replace($A,UA)}function UA(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),o=a===120||a===88;return ek(n.slice(o?2:1),o?16:10)}return Mx(n)||e}const uk={}.hasOwnProperty;function qA(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),HA(n)(BA(OA(n).document().write(PA()(e,t,!0))))}function HA(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(rt),autolinkProtocol:W,autolinkEmail:W,atxHeading:o(wt),blockQuote:o(Je),characterEscape:W,characterReference:W,codeFenced:o(Et),codeFencedFenceInfo:u,codeFencedFenceMeta:u,codeIndented:o(Et,u),codeText:o(ft,u),codeTextData:W,data:W,codeFlowValue:W,definition:o(vt),definitionDestinationString:u,definitionLabelString:u,definitionTitleString:u,emphasis:o(bt),hardBreakEscape:o(Tt),hardBreakTrailing:o(Tt),htmlFlow:o(ve,u),htmlFlowData:W,htmlText:o(ve,u),htmlTextData:W,image:o($e),label:u,link:o(rt),listItem:o(je),listItemValue:b,listOrdered:o(rn,x),listUnordered:o(rn),paragraph:o(ze),reference:M,referenceString:u,resourceDestinationString:u,resourceTitleString:u,setextHeading:o(wt),strong:o(pt),thematicBreak:o(Hr)},exit:{atxHeading:h(),atxHeadingSequence:D,autolink:h(),autolinkEmail:Be,autolinkProtocol:Ee,blockQuote:h(),characterEscapeValue:z,characterReferenceMarkerHexadecimal:_e,characterReferenceMarkerNumeric:_e,characterReferenceValue:Ce,characterReference:De,codeFenced:h(N),codeFencedFence:j,codeFencedFenceInfo:y,codeFencedFenceMeta:_,codeFlowValue:z,codeIndented:h(S),codeText:h(G),codeTextData:z,data:z,definition:h(),definitionDestinationString:O,definitionLabelString:E,definitionTitleString:C,emphasis:h(),hardBreakEscape:h(A),hardBreakTrailing:h(A),htmlFlow:h(ie),htmlFlowData:z,htmlText:h(K),htmlTextData:z,image:h($),label:ae,labelText:se,lineEnding:q,link:h(P),listItem:h(),listOrdered:h(),listUnordered:h(),paragraph:h(),referenceString:pe,resourceDestinationString:R,resourceTitleString:B,resource:Z,setextHeading:h(F),setextHeadingLineSequence:I,setextHeadingText:L,strong:h(),thematicBreak:h()}};dk(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(oe){let we={type:"root",children:[]};const Q={stack:[we],tokenStack:[],config:t,enter:f,exit:p,buffer:u,resume:m,data:n},me=[];let Re=-1;for(;++Re<oe.length;)if(oe[Re][1].type==="listOrdered"||oe[Re][1].type==="listUnordered")if(oe[Re][0]==="enter")me.push(Re);else{const Qe=me.pop();Re=a(oe,Qe,Re)}for(Re=-1;++Re<oe.length;){const Qe=t[oe[Re][0]];uk.call(Qe,oe[Re][1].type)&&Qe[oe[Re][1].type].call(Object.assign({sliceSerialize:oe[Re][2].sliceSerialize},Q),oe[Re][1])}if(Q.tokenStack.length>0){const Qe=Q.tokenStack[Q.tokenStack.length-1];(Qe[1]||G_).call(Q,void 0,Qe[0])}for(we.position={start:Ds(oe.length>0?oe[0][1].start:{line:1,column:1,offset:0}),end:Ds(oe.length>0?oe[oe.length-2][1].end:{line:1,column:1,offset:0})},Re=-1;++Re<t.transforms.length;)we=t.transforms[Re](we)||we;return we}function a(oe,we,Q){let me=we-1,Re=-1,Qe=!1,it,st,jt,yn;for(;++me<=Q;){const et=oe[me];switch(et[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{et[0]==="enter"?Re++:Re--,yn=void 0;break}case"lineEndingBlank":{et[0]==="enter"&&(it&&!yn&&!Re&&!jt&&(jt=me),yn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:yn=void 0}if(!Re&&et[0]==="enter"&&et[1].type==="listItemPrefix"||Re===-1&&et[0]==="exit"&&(et[1].type==="listUnordered"||et[1].type==="listOrdered")){if(it){let cr=me;for(st=void 0;cr--;){const Ln=oe[cr];if(Ln[1].type==="lineEnding"||Ln[1].type==="lineEndingBlank"){if(Ln[0]==="exit")continue;st&&(oe[st][1].type="lineEndingBlank",Qe=!0),Ln[1].type="lineEnding",st=cr}else if(!(Ln[1].type==="linePrefix"||Ln[1].type==="blockQuotePrefix"||Ln[1].type==="blockQuotePrefixWhitespace"||Ln[1].type==="blockQuoteMarker"||Ln[1].type==="listItemIndent"))break}jt&&(!st||jt<st)&&(it._spread=!0),it.end=Object.assign({},st?oe[st][1].start:et[1].end),oe.splice(st||me,0,["exit",it,et[2]]),me++,Q++}if(et[1].type==="listItemPrefix"){const cr={type:"listItem",_spread:!1,start:Object.assign({},et[1].start),end:void 0};it=cr,oe.splice(me,0,["enter",cr,et[2]]),me++,Q++,jt=void 0,yn=!0}}}return oe[we][1]._spread=Qe,Q}function o(oe,we){return Q;function Q(me){f.call(this,oe(me),me),we&&we.call(this,me)}}function u(){this.stack.push({type:"fragment",children:[]})}function f(oe,we,Q){this.stack[this.stack.length-1].children.push(oe),this.stack.push(oe),this.tokenStack.push([we,Q||void 0]),oe.position={start:Ds(we.start),end:void 0}}function h(oe){return we;function we(Q){oe&&oe.call(this,Q),p.call(this,Q)}}function p(oe,we){const Q=this.stack.pop(),me=this.tokenStack.pop();if(me)me[0].type!==oe.type&&(we?we.call(this,oe,me[0]):(me[1]||G_).call(this,oe,me[0]));else throw new Error("Cannot close `"+oe.type+"` ("+_c({start:oe.start,end:oe.end})+"): it’s not open");Q.position.end=Ds(oe.end)}function m(){return Ax(this.stack.pop())}function x(){this.data.expectingFirstListItemValue=!0}function b(oe){if(this.data.expectingFirstListItemValue){const we=this.stack[this.stack.length-2];we.start=Number.parseInt(this.sliceSerialize(oe),10),this.data.expectingFirstListItemValue=void 0}}function y(){const oe=this.resume(),we=this.stack[this.stack.length-1];we.lang=oe}function _(){const oe=this.resume(),we=this.stack[this.stack.length-1];we.meta=oe}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function N(){const oe=this.resume(),we=this.stack[this.stack.length-1];we.value=oe.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function S(){const oe=this.resume(),we=this.stack[this.stack.length-1];we.value=oe.replace(/(\r?\n|\r)$/g,"")}function E(oe){const we=this.resume(),Q=this.stack[this.stack.length-1];Q.label=we,Q.identifier=ei(this.sliceSerialize(oe)).toLowerCase()}function C(){const oe=this.resume(),we=this.stack[this.stack.length-1];we.title=oe}function O(){const oe=this.resume(),we=this.stack[this.stack.length-1];we.url=oe}function D(oe){const we=this.stack[this.stack.length-1];if(!we.depth){const Q=this.sliceSerialize(oe).length;we.depth=Q}}function L(){this.data.setextHeadingSlurpLineEnding=!0}function I(oe){const we=this.stack[this.stack.length-1];we.depth=this.sliceSerialize(oe).codePointAt(0)===61?1:2}function F(){this.data.setextHeadingSlurpLineEnding=void 0}function W(oe){const Q=this.stack[this.stack.length-1].children;let me=Q[Q.length-1];(!me||me.type!=="text")&&(me=Te(),me.position={start:Ds(oe.start),end:void 0},Q.push(me)),this.stack.push(me)}function z(oe){const we=this.stack.pop();we.value+=this.sliceSerialize(oe),we.position.end=Ds(oe.end)}function q(oe){const we=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Q=we.children[we.children.length-1];Q.position.end=Ds(oe.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(we.type)&&(W.call(this,oe),z.call(this,oe))}function A(){this.data.atHardBreak=!0}function ie(){const oe=this.resume(),we=this.stack[this.stack.length-1];we.value=oe}function K(){const oe=this.resume(),we=this.stack[this.stack.length-1];we.value=oe}function G(){const oe=this.resume(),we=this.stack[this.stack.length-1];we.value=oe}function P(){const oe=this.stack[this.stack.length-1];if(this.data.inReference){const we=this.data.referenceType||"shortcut";oe.type+="Reference",oe.referenceType=we,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 we=this.data.referenceType||"shortcut";oe.type+="Reference",oe.referenceType=we,delete oe.url,delete oe.title}else delete oe.identifier,delete oe.label;this.data.referenceType=void 0}function se(oe){const we=this.sliceSerialize(oe),Q=this.stack[this.stack.length-2];Q.label=FA(we),Q.identifier=ei(we).toLowerCase()}function ae(){const oe=this.stack[this.stack.length-1],we=this.resume(),Q=this.stack[this.stack.length-1];if(this.data.inReference=!0,Q.type==="link"){const me=oe.children;Q.children=me}else Q.alt=we}function R(){const oe=this.resume(),we=this.stack[this.stack.length-1];we.url=oe}function B(){const oe=this.resume(),we=this.stack[this.stack.length-1];we.title=oe}function Z(){this.data.inReference=void 0}function M(){this.data.referenceType="collapsed"}function pe(oe){const we=this.resume(),Q=this.stack[this.stack.length-1];Q.label=we,Q.identifier=ei(this.sliceSerialize(oe)).toLowerCase(),this.data.referenceType="full"}function _e(oe){this.data.characterReferenceType=oe.type}function Ce(oe){const we=this.sliceSerialize(oe),Q=this.data.characterReferenceType;let me;Q?(me=ek(we,Q==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):me=Mx(we);const Re=this.stack[this.stack.length-1];Re.value+=me}function De(oe){const we=this.stack.pop();we.position.end=Ds(oe.end)}function Ee(oe){z.call(this,oe);const we=this.stack[this.stack.length-1];we.url=this.sliceSerialize(oe)}function Be(oe){z.call(this,oe);const we=this.stack[this.stack.length-1];we.url="mailto:"+this.sliceSerialize(oe)}function Je(){return{type:"blockquote",children:[]}}function Et(){return{type:"code",lang:null,meta:null,value:""}}function ft(){return{type:"inlineCode",value:""}}function vt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function bt(){return{type:"emphasis",children:[]}}function wt(){return{type:"heading",depth:0,children:[]}}function Tt(){return{type:"break"}}function ve(){return{type:"html",value:""}}function $e(){return{type:"image",title:null,url:"",alt:null}}function rt(){return{type:"link",title:null,url:"",children:[]}}function rn(oe){return{type:"list",ordered:oe.type==="listOrdered",start:null,spread:oe._spread,children:[]}}function je(oe){return{type:"listItem",spread:oe._spread,checked:null,children:[]}}function ze(){return{type:"paragraph",children:[]}}function pt(){return{type:"strong",children:[]}}function Te(){return{type:"text",value:""}}function Hr(){return{type:"thematicBreak"}}}function Ds(e){return{line:e.line,column:e.column,offset:e.offset}}function dk(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?dk(e,r):IA(e,r)}}function IA(e,t){let n;for(n in t)if(uk.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 G_(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+_c({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+_c({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+_c({start:t.start,end:t.end})+") is still open")}function VA(e){const t=this;t.parser=n;function n(r){return qA(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function GA(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 YA(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
75
- `}]}function WA(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 QA(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function XA(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function KA(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),a=Ql(r.toLowerCase()),o=e.footnoteOrder.indexOf(r);let u,f=e.footnoteCounts.get(r);f===void 0?(f=0,e.footnoteOrder.push(r),u=e.footnoteOrder.length):u=o+1,f+=1,e.footnoteCounts.set(r,f);const h={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(f>1?"-"+f:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(u)}]};e.patch(t,h);const p={type:"element",tagName:"sup",properties:{},children:[h]};return e.patch(t,p),e.applyData(t,p)}function ZA(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 JA(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function fk(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 eM(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return fk(e,t);const a={src:Ql(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 tM(e,t){const n={src:Ql(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 nM(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 rM(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return fk(e,t);const a={href:Ql(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 iM(e,t){const n={href:Ql(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 sM(e,t,n){const r=e.all(t),a=n?aM(n):hk(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 f=-1;for(;++f<r.length;){const m=r[f];(a||f!==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 h=r[r.length-1];h&&(a||h.type!=="element"||h.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 aM(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=hk(n[r])}return t}function hk(e){const t=e.spread;return t??e.children.length>1}function lM(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 oM(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function cM(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function uM(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function dM(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)},f=Nx(t.children[1]),h=G2(t.children[t.children.length-1]);f&&h&&(u.position={start:f,end:h}),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 fM(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,f=u?u.length:t.children.length;let h=-1;const p=[];for(;++h<f;){const x=t.children[h],b={},y=u?u[h]: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 hM(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Y_=9,W_=32;function pM(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),a=0;const o=[];for(;r;)o.push(Q_(t.slice(a,r.index),a>0,!0),r[0]),a=r.index+r[0].length,r=n.exec(t);return o.push(Q_(t.slice(a),a>0,!1)),o.join("")}function Q_(e,t,n){let r=0,a=e.length;if(t){let o=e.codePointAt(r);for(;o===Y_||o===W_;)r++,o=e.codePointAt(r)}if(n){let o=e.codePointAt(a-1);for(;o===Y_||o===W_;)a--,o=e.codePointAt(a-1)}return a>r?e.slice(r,a):""}function mM(e,t){const n={type:"text",value:pM(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function gM(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const xM={blockquote:GA,break:YA,code:WA,delete:QA,emphasis:XA,footnoteReference:KA,heading:ZA,html:JA,imageReference:eM,image:tM,inlineCode:nM,linkReference:rM,link:iM,listItem:sM,list:lM,paragraph:oM,root:cM,strong:uM,table:dM,tableCell:hM,tableRow:fM,text:mM,thematicBreak:gM,toml:jd,yaml:jd,definition:jd,footnoteDefinition:jd};function jd(){}const pk=-1,Lf=0,kc=1,yf=2,Lx=3,Dx=4,zx=5,Ox=6,mk=7,gk=8,xk=typeof self=="object"?self:globalThis,X_=(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 xk[e](t)},vM=(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 Lf:case pk:return n(u,a);case kc:{const f=n([],a);for(const h of u)f.push(r(h));return f}case yf:{const f=n({},a);for(const[h,p]of u)f[r(h)]=r(p);return f}case Lx:return n(new Date(u),a);case Dx:{const{source:f,flags:h}=u;return n(new RegExp(f,h),a)}case zx:{const f=n(new Map,a);for(const[h,p]of u)f.set(r(h),r(p));return f}case Ox:{const f=n(new Set,a);for(const h of u)f.add(r(h));return f}case mk:{const{name:f,message:h}=u;return n(typeof xk[f]=="function"?X_(f,h):new Error(h),a)}case gk: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:f}=new Uint8Array(u);return n(new DataView(f),u)}}return n(X_(o,u),a)};return r},K_=e=>vM(new Map,e)(0),ka="",{toString:bM}={},{keys:yM}=Object,ac=e=>{const t=typeof e;if(t!=="object"||!e)return[Lf,t];const n=bM.call(e).slice(8,-1);switch(n){case"Array":return[kc,ka];case"Object":return[yf,ka];case"Date":return[Lx,ka];case"RegExp":return[Dx,ka];case"Map":return[zx,ka];case"Set":return[Ox,ka];case"DataView":return[kc,n]}return n.includes("Array")?[kc,n]:e instanceof Error?[mk,e.name||"Error"]:[yf,n]},Nd=([e,t])=>e===Lf&&(t==="function"||t==="symbol"),_M=(e,t,n,r)=>{const a=(u,f)=>{const h=r.push(u)-1;return n.set(f,h),h},o=u=>{if(n.has(u))return n.get(u);let[f,h]=ac(u);switch(f){case Lf:{let m=u;switch(h){case"bigint":f=gk,m=u.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+h);m=null;break;case"undefined":return a([pk],u)}return a([f,m],u)}case kc:{if(h){let b=u;return h==="DataView"?b=new Uint8Array(u.buffer):h==="ArrayBuffer"&&(b=new Uint8Array(u)),a([h,[...b]],u)}const m=[],x=a([f,m],u);for(const b of u)m.push(o(b));return x}case yf:{if(h)switch(h){case"BigInt":return a([h,u.toString()],u);case"Boolean":case"Number":case"String":return a([h,u.valueOf()],u)}if(t&&"toJSON"in u)return o(u.toJSON());const m=[],x=a([f,m],u);for(const b of yM(u))(e||!Nd(ac(u[b])))&&m.push([o(b),o(u[b])]);return x}case Lx:return a([f,isNaN(u.getTime())?ka:u.toISOString()],u);case Dx:{const{source:m,flags:x}=u;return a([f,{source:m,flags:x}],u)}case zx:{const m=[],x=a([f,m],u);for(const[b,y]of u)(e||!(Nd(ac(b))||Nd(ac(y))))&&m.push([o(b),o(y)]);return x}case Ox:{const m=[],x=a([f,m],u);for(const b of u)(e||!Nd(ac(b)))&&m.push(o(b));return x}}const{message:p}=u;return a([f,{name:h,message:p}],u)};return o},Z_=(e,{json:t,lossy:n}={})=>{const r=[];return _M(!(t||n),!!t,new Map,r)(e),r},_f=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?K_(Z_(e,t)):structuredClone(e):(e,t)=>K_(Z_(e,t));function wM(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 kM(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function SM(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||wM,r=e.options.footnoteBackLabel||kM,a=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",u=e.options.footnoteLabelProperties||{className:["sr-only"]},f=[];let h=-1;for(;++h<e.footnoteOrder.length;){const p=e.footnoteById.get(e.footnoteOrder[h]);if(!p)continue;const m=e.all(p),x=String(p.identifier).toUpperCase(),b=Ql(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(h,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(h,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 S={type:"element",tagName:"li",properties:{id:t+"fn-"+b},children:e.wrap(m,!0)};e.patch(p,S),f.push(S)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{..._f(u),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:`
79
- `},{type:"element",tagName:"ol",properties:{},children:e.wrap(f,!0)},{type:"text",value:`
80
- `}]}}const Df=(function(e){if(e==null)return EM;if(typeof e=="function")return zf(e);if(typeof e=="object")return Array.isArray(e)?jM(e):NM(e);if(typeof e=="string")return CM(e);throw new Error("Expected function, string, or object as test")});function jM(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Df(e[n]);return zf(r);function r(...a){let o=-1;for(;++o<t.length;)if(t[o].apply(this,a))return!0;return!1}}function NM(e){const t=e;return zf(n);function n(r){const a=r;let o;for(o in e)if(a[o]!==t[o])return!1;return!0}}function CM(e){return zf(t);function t(n){return n&&n.type===e}}function zf(e){return t;function t(n,r,a){return!!(TM(n)&&e.call(this,n,typeof r=="number"?r:void 0,a||void 0))}}function EM(){return!0}function TM(e){return e!==null&&typeof e=="object"&&"type"in e}const vk=[],AM=!0,Vg=!1,MM="skip";function bk(e,t,n,r){let a;typeof t=="function"&&typeof n!="function"?(r=n,n=t):a=t;const o=Df(a),u=r?-1:1;f(e,void 0,[])();function f(h,p,m){const x=h&&typeof h=="object"?h:{};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 ("+(h.type+(y?"<"+y+">":""))+")"})}return b;function b(){let y=vk,_,j,N;if((!t||o(h,p,m[m.length-1]||void 0))&&(y=RM(n(h,m)),y[0]===Vg))return y;if("children"in h&&h.children){const S=h;if(S.children&&y[0]!==MM)for(j=(r?S.children.length:-1)+u,N=m.concat(S);j>-1&&j<S.children.length;){const E=S.children[j];if(_=f(E,j,N)(),_[0]===Vg)return _;j=typeof _[1]=="number"?_[1]:j+u}}return y}}}function RM(e){return Array.isArray(e)?e:typeof e=="number"?[AM,e]:e==null?vk:[e]}function Bx(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),bk(e,o,f,a);function f(h,p){const m=p[p.length-1],x=m?m.children.indexOf(h):void 0;return u(h,x,m)}}const Gg={}.hasOwnProperty,LM={};function DM(e,t){const n=t||LM,r=new Map,a=new Map,o=new Map,u={...xM,...n.handlers},f={all:p,applyData:OM,definitionById:r,footnoteById:a,footnoteCounts:o,footnoteOrder:[],handlers:u,one:h,options:n,patch:zM,wrap:PM};return Bx(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)}}),f;function h(m,x){const b=m.type,y=f.handlers[b];if(Gg.call(f.handlers,b)&&y)return y(f,m,x);if(f.options.passThrough&&f.options.passThrough.includes(b)){if("children"in m){const{children:j,...N}=m,S=_f(N);return S.children=f.all(m),S}return _f(m)}return(f.options.unknownHandler||BM)(f,m,x)}function p(m){const x=[];if("children"in m){const b=m.children;let y=-1;for(;++y<b.length;){const _=f.one(b[y],m);if(_){if(y&&b[y-1].type==="break"&&(!Array.isArray(_)&&_.type==="text"&&(_.value=J_(_.value)),!Array.isArray(_)&&_.type==="element")){const j=_.children[0];j&&j.type==="text"&&(j.value=J_(j.value))}Array.isArray(_)?x.push(..._):x.push(_)}}}return x}}function zM(e,t){e.position&&(t.position=k6(e))}function OM(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,_f(o)),"children"in n&&n.children&&a!==null&&a!==void 0&&(n.children=a)}return n}function BM(e,t){const n=t.data||{},r="value"in t&&!(Gg.call(n,"hProperties")||Gg.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 PM(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 J_(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function e5(e,t){const n=DM(e,t),r=n.one(e,void 0),a=SM(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 $M(e,t){return e&&"run"in e?async function(n,r){const a=e5(n,{file:r,...t});await e.run(a,r)}:function(n,r){return e5(n,{file:r,...e||t})}}function t5(e){if(e)throw e}var Lm,n5;function FM(){if(n5)return Lm;n5=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},f=function(p,m){if(m==="__proto__")if(e.call(p,m)){if(r)return r(p,m).value}else return;return p[m]};return Lm=function h(){var p,m,x,b,y,_,j=arguments[0],N=1,S=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<S;++N)if(p=arguments[N],p!=null)for(m in p)x=f(j,m),b=f(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:h(E,_,b)})):typeof b<"u"&&u(j,{name:m,newValue:b}));return j},Lm}var UM=FM();const Dm=ex(UM);function Yg(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 qM(){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);f(null,...a);function f(h,...p){const m=e[++o];let x=-1;if(h){u(h);return}for(;++x<a.length;)(p[x]===null||p[x]===void 0)&&(p[x]=a[x]);a=p,m?HM(m,f)(...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 HM(e,t){let n;return r;function r(...u){const f=e.length>u.length;let h;f&&u.push(a);try{h=e.apply(this,u)}catch(p){const m=p;if(f&&n)throw m;return a(m)}f||(h&&h.then&&typeof h.then=="function"?h.then(o,a):h instanceof Error?a(h):o(h))}function a(u,...f){n||(n=!0,t(u,...f))}function o(u){a(null,u)}}const gi={basename:IM,dirname:VM,extname:GM,join:YM,sep:"/"};function IM(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Ic(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,f=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(o){n=a+1;break}}else u<0&&(o=!0,u=a+1),f>-1&&(e.codePointAt(a)===t.codePointAt(f--)?f<0&&(r=a):(f=-1,r=u));return n===r?r=u:r<0&&(r=e.length),e.slice(n,r)}function VM(e){if(Ic(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 GM(e){Ic(e);let t=e.length,n=-1,r=0,a=-1,o=0,u;for(;t--;){const f=e.codePointAt(t);if(f===47){if(u){r=t+1;break}continue}n<0&&(u=!0,n=t+1),f===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 YM(...e){let t=-1,n;for(;++t<e.length;)Ic(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":WM(n)}function WM(e){Ic(e);const t=e.codePointAt(0)===47;let n=QM(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function QM(e,t){let n="",r=0,a=-1,o=0,u=-1,f,h;for(;++u<=e.length;){if(u<e.length)f=e.codePointAt(u);else{if(f===47)break;f=47}if(f===47){if(!(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(h=n.lastIndexOf("/"),h!==n.length-1){h<0?(n="",r=0):(n=n.slice(0,h),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 f===46&&o>-1?o++:o=-1}return n}function Ic(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const XM={cwd:KM};function KM(){return"/"}function Wg(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function ZM(e){if(typeof e=="string")e=new URL(e);else if(!Wg(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 JM(e)}function JM(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 yk{constructor(t){let n;t?Wg(t)?n={path:t}:typeof t=="string"||e8(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":XM.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"?gi.basename(this.path):void 0}set basename(t){Bm(t,"basename"),Om(t,"basename"),this.path=gi.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?gi.dirname(this.path):void 0}set dirname(t){r5(this.basename,"dirname"),this.path=gi.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?gi.extname(this.path):void 0}set extname(t){if(Om(t,"extname"),r5(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=gi.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Wg(t)&&(t=ZM(t)),Bm(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?gi.basename(this.path,this.extname):void 0}set stem(t){Bm(t,"stem"),Om(t,"stem"),this.path=gi.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 Fn(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 Om(e,t){if(e&&e.includes(gi.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+gi.sep+"`")}function Bm(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function r5(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function e8(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const t8=(function(e){const r=this.constructor.prototype,a=r[e],o=function(){return a.apply(o,arguments)};return Object.setPrototypeOf(o,r),o}),n8={}.hasOwnProperty;class Px extends t8{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=qM()}copy(){const t=new Px;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Dm(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Fm("data",this.frozen),this.namespace[t]=n,this):n8.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Fm("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=Cd(t),r=this.parser||this.Parser;return Pm("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Pm("process",this.parser||this.Parser),$m("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(o,u){const f=Cd(t),h=r.parse(f);r.run(h,f,function(m,x,b){if(m||!x||!b)return p(m);const y=x,_=r.stringify(y,b);s8(_)?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(),Pm("processSync",this.parser||this.Parser),$m("processSync",this.compiler||this.Compiler),this.process(t,a),s5("processSync","process",n),r;function a(o,u){n=!0,t5(o),r=u}}run(t,n,r){i5(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,f){const h=Cd(n);a.run(t,h,p);function p(m,x,b){const y=x||t;m?f(m):u?u(y):r(void 0,y,b)}}}runSync(t,n){let r=!1,a;return this.run(t,n,o),s5("runSync","run",r),a;function o(u,f){t5(u),a=f,r=!0}}stringify(t,n){this.freeze();const r=Cd(n),a=this.compiler||this.Compiler;return $m("stringify",a),i5(t),a(t,r)}use(t,...n){const r=this.attachers,a=this.namespace;if(Fm("use",this.frozen),t!=null)if(typeof t=="function")h(t,n);else if(typeof t=="object")Array.isArray(t)?f(t):u(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function o(p){if(typeof p=="function")h(p,[]);else if(typeof p=="object")if(Array.isArray(p)){const[m,...x]=p;h(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");f(p.plugins),p.settings&&(a.settings=Dm(!0,a.settings,p.settings))}function f(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 h(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];Yg(j)&&Yg(y)&&(y=Dm(!0,j,y)),r[b]=[p,y,..._]}}}}const r8=new Px().freeze();function Pm(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function $m(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Fm(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 i5(e){if(!Yg(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function s5(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Cd(e){return i8(e)?e:new yk(e)}function i8(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function s8(e){return typeof e=="string"||a8(e)}function a8(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const l8="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",a5=[],l5={allowDangerousHtml:!0},o8=/^(https?|ircs?|mailto|xmpp)$/i,c8=[{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 $x(e){const t=u8(e),n=d8(e);return f8(t.runSync(t.parse(n),n),e)}function u8(e){const t=e.rehypePlugins||a5,n=e.remarkPlugins||a5,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...l5}:l5;return r8().use(VA).use(n).use($M,r).use(t)}function d8(e){const t=e.children||"",n=new yk;return typeof t=="string"&&(n.value=t),n}function f8(e,t){const n=t.allowedElements,r=t.allowElement,a=t.components,o=t.disallowedElements,u=t.skipHtml,f=t.unwrapDisallowed,h=t.urlTransform||h8;for(const m of c8)Object.hasOwn(t,m.from)&&(""+m.from+(m.to?"use `"+m.to+"` instead":"remove it")+l8+m.id,void 0);return Bx(e,p),E6(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 Am)if(Object.hasOwn(Am,y)&&Object.hasOwn(m.properties,y)){const _=m.properties[y],j=Am[y];(j===null||j.includes(m.tagName))&&(m.properties[y]=h(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 f&&m.children?b.children.splice(x,1,...m.children):b.children.splice(x,1),x}}}function h8(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||o8.test(e.slice(0,t))?e:""}function o5(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 p8(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function m8(e,t,n){const a=Df((n||{}).ignore||[]),o=g8(t);let u=-1;for(;++u<o.length;)bk(e,"text",f);function f(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 h(p,m)}function h(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 S=!1,E=[];b.lastIndex=0;let C=b.exec(p.value);for(;C;){const O=C.index,D={index:C.index,input:C.input,stack:[...m,p]};let L=y(...C,D);if(typeof L=="string"&&(L=L.length>0?{type:"text",value:L}:void 0),L===!1?b.lastIndex=O+1:(_!==O&&E.push({type:"text",value:p.value.slice(_,O)}),Array.isArray(L)?E.push(...L):L&&E.push(L),_=O+C[0].length,S=!0),!b.global)break;C=b.exec(p.value)}return S?(_<p.value.length&&E.push({type:"text",value:p.value.slice(_)}),x.children.splice(N,1,...E)):E=[p],N+E.length}}function g8(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([x8(a[0]),v8(a[1])])}return t}function x8(e){return typeof e=="string"?new RegExp(p8(e),"g"):e}function v8(e){return typeof e=="function"?e:function(){return e}}const Um="phrasing",qm=["autolink","link","image","label"];function b8(){return{transforms:[N8],enter:{literalAutolink:_8,literalAutolinkEmail:Hm,literalAutolinkHttp:Hm,literalAutolinkWww:Hm},exit:{literalAutolink:j8,literalAutolinkEmail:S8,literalAutolinkHttp:w8,literalAutolinkWww:k8}}}function y8(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Um,notInConstruct:qm},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Um,notInConstruct:qm},{character:":",before:"[ps]",after:"\\/",inConstruct:Um,notInConstruct:qm}]}}function _8(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Hm(e){this.config.enter.autolinkProtocol.call(this,e)}function w8(e){this.config.exit.autolinkProtocol.call(this,e)}function k8(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 S8(e){this.config.exit.autolinkEmail.call(this,e)}function j8(e){this.exit(e)}function N8(e){m8(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,C8],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),E8]],{ignore:["link","linkReference"]})}function C8(e,t,n,r,a){let o="";if(!_k(a)||(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!T8(n)))return!1;const u=A8(n+r);if(!u[0])return!1;const f={type:"link",title:null,url:o+t+u[0],children:[{type:"text",value:t+u[0]}]};return u[1]?[f,{type:"text",value:u[1]}]:f}function E8(e,t,n,r){return!_k(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function T8(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 A8(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=o5(e,"(");let o=o5(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 _k(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Ra(n)||Mf(n))&&(!t||n!==47)}wk.peek=$8;function M8(){this.buffer()}function R8(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function L8(){this.buffer()}function D8(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function z8(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ei(this.sliceSerialize(e)).toLowerCase(),n.label=t}function O8(e){this.exit(e)}function B8(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ei(this.sliceSerialize(e)).toLowerCase(),n.label=t}function P8(e){this.exit(e)}function $8(){return"["}function wk(e,t,n,r){const a=n.createTracker(r);let o=a.move("[^");const u=n.enter("footnoteReference"),f=n.enter("reference");return o+=a.move(n.safe(n.associationId(e),{after:"]",before:o})),f(),u(),o+=a.move("]"),o}function F8(){return{enter:{gfmFootnoteCallString:M8,gfmFootnoteCall:R8,gfmFootnoteDefinitionLabelString:L8,gfmFootnoteDefinition:D8},exit:{gfmFootnoteCallString:z8,gfmFootnoteCall:O8,gfmFootnoteDefinitionLabelString:B8,gfmFootnoteDefinition:P8}}}function U8(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:wk},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,a,o,u){const f=o.createTracker(u);let h=f.move("[^");const p=o.enter("footnoteDefinition"),m=o.enter("label");return h+=f.move(o.safe(o.associationId(r),{before:h,after:"]"})),m(),h+=f.move("]:"),r.children&&r.children.length>0&&(f.shift(4),h+=f.move((t?`
85
- `:" ")+o.indentLines(o.containerFlow(r,f.current()),t?kk:q8))),p(),h}}function q8(e,t,n){return t===0?e:kk(e,t,n)}function kk(e,t,n){return(n?"":" ")+e}const H8=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Sk.peek=W8;function I8(){return{canContainEols:["delete"],enter:{strikethrough:G8},exit:{strikethrough:Y8}}}function V8(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:H8}],handlers:{delete:Sk}}}function G8(e){this.enter({type:"delete",children:[]},e)}function Y8(e){this.exit(e)}function Sk(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 W8(){return"~"}function Q8(e){return e.length}function X8(e,t){const n=t||{},r=(n.align||[]).concat(),a=n.stringLength||Q8,o=[],u=[],f=[],h=[];let p=0,m=-1;for(;++m<e.length;){const j=[],N=[];let S=-1;for(e[m].length>p&&(p=e[m].length);++S<e[m].length;){const E=K8(e[m][S]);if(n.alignDelimiters!==!1){const C=a(E);N[S]=C,(h[S]===void 0||C>h[S])&&(h[S]=C)}j.push(E)}u[m]=j,f[m]=N}let x=-1;if(typeof r=="object"&&"length"in r)for(;++x<p;)o[x]=c5(r[x]);else{const j=c5(r);for(;++x<p;)o[x]=j}x=-1;const b=[],y=[];for(;++x<p;){const j=o[x];let N="",S="";j===99?(N=":",S=":"):j===108?N=":":j===114&&(S=":");let E=n.alignDelimiters===!1?1:Math.max(1,h[x]-N.length-S.length);const C=N+"-".repeat(E)+S;n.alignDelimiters!==!1&&(E=N.length+E+S.length,E>h[x]&&(h[x]=E),y[x]=E),b[x]=C}u.splice(1,0,b),f.splice(1,0,y),m=-1;const _=[];for(;++m<u.length;){const j=u[m],N=f[m];x=-1;const S=[];for(;++x<p;){const E=j[x]||"";let C="",O="";if(n.alignDelimiters!==!1){const D=h[x]-(N[x]||0),L=o[x];L===114?C=" ".repeat(D):L===99?D%2?(C=" ".repeat(D/2+.5),O=" ".repeat(D/2-.5)):(C=" ".repeat(D/2),O=C):O=" ".repeat(D)}n.delimiterStart!==!1&&!x&&S.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&E==="")&&(n.delimiterStart!==!1||x)&&S.push(" "),n.alignDelimiters!==!1&&S.push(C),S.push(E),n.alignDelimiters!==!1&&S.push(O),n.padding!==!1&&S.push(" "),(n.delimiterEnd!==!1||x!==p-1)&&S.push("|")}_.push(n.delimiterEnd===!1?S.join("").replace(/ +$/,""):S.join(""))}return _.join(`
86
- `)}function K8(e){return e==null?"":String(e)}function c5(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 Z8(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()),J8);return a(),u}function J8(e,t,n){return">"+(n?"":" ")+e}function e7(e,t){return u5(e,t.inConstruct,!0)&&!u5(e,t.notInConstruct,!1)}function u5(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 d5(e,t,n,r){let a=-1;for(;++a<n.unsafe.length;)if(n.unsafe[a].character===`
87
- `&&e7(n.stack,n.unsafe[a]))return/[ \t]/.test(r.before)?"":" ";return`\\
88
- `}function t7(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 n7(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 r7(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 i7(e,t,n,r){const a=r7(n),o=e.value||"",u=a==="`"?"GraveAccent":"Tilde";if(n7(e,n)){const x=n.enter("codeIndented"),b=n.indentLines(o,s7);return x(),b}const f=n.createTracker(r),h=a.repeat(Math.max(t7(o,a)+1,3)),p=n.enter("codeFenced");let m=f.move(h);if(e.lang){const x=n.enter(`codeFencedLang${u}`);m+=f.move(n.safe(e.lang,{before:m,after:" ",encode:["`"],...f.current()})),x()}if(e.lang&&e.meta){const x=n.enter(`codeFencedMeta${u}`);m+=f.move(" "),m+=f.move(n.safe(e.meta,{before:m,after:`
89
- `,encode:["`"],...f.current()})),x()}return m+=f.move(`
90
- `),o&&(m+=f.move(o+`
91
- `)),m+=f.move(h),p(),m}function s7(e,t,n){return(n?"":" ")+e}function Fx(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 a7(e,t,n,r){const a=Fx(n),o=a==='"'?"Quote":"Apostrophe",u=n.enter("definition");let f=n.enter("label");const h=n.createTracker(r);let p=h.move("[");return p+=h.move(n.safe(n.associationId(e),{before:p,after:"]",...h.current()})),p+=h.move("]: "),f(),!e.url||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),p+=h.move("<"),p+=h.move(n.safe(e.url,{before:p,after:">",...h.current()})),p+=h.move(">")):(f=n.enter("destinationRaw"),p+=h.move(n.safe(e.url,{before:p,after:e.title?" ":`
92
- `,...h.current()}))),f(),e.title&&(f=n.enter(`title${o}`),p+=h.move(" "+a),p+=h.move(n.safe(e.title,{before:p,after:a,...h.current()})),p+=h.move(a),f()),u(),p}function l7(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 Pc(e){return"&#x"+e.toString(16).toUpperCase()+";"}function wf(e,t,n){const r=Il(e),a=Il(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}}jk.peek=o7;function jk(e,t,n,r){const a=l7(n),o=n.enter("emphasis"),u=n.createTracker(r),f=u.move(a);let h=u.move(n.containerPhrasing(e,{after:a,before:f,...u.current()}));const p=h.charCodeAt(0),m=wf(r.before.charCodeAt(r.before.length-1),p,a);m.inside&&(h=Pc(p)+h.slice(1));const x=h.charCodeAt(h.length-1),b=wf(r.after.charCodeAt(0),x,a);b.inside&&(h=h.slice(0,-1)+Pc(x));const y=u.move(a);return o(),n.attentionEncodeSurroundingInfo={after:b.outside,before:m.outside},f+h+y}function o7(e,t,n){return n.options.emphasis||"*"}function c7(e,t){let n=!1;return Bx(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,Vg}),!!((!e.depth||e.depth<3)&&Ax(e)&&(t.options.setext||n))}function u7(e,t,n,r){const a=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(r);if(c7(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),f=n.enter("headingAtx"),h=n.enter("phrasing");o.move(u+" ");let p=n.containerPhrasing(e,{before:"# ",after:`
97
- `,...o.current()});return/^[\t ]/.test(p)&&(p=Pc(p.charCodeAt(0))+p.slice(1)),p=p?u+" "+p:u,n.options.closeAtx&&(p+=" "+u),h(),f(),p}Nk.peek=d7;function Nk(e){return e.value||""}function d7(){return"<"}Ck.peek=f7;function Ck(e,t,n,r){const a=Fx(n),o=a==='"'?"Quote":"Apostrophe",u=n.enter("image");let f=n.enter("label");const h=n.createTracker(r);let p=h.move("![");return p+=h.move(n.safe(e.alt,{before:p,after:"]",...h.current()})),p+=h.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),p+=h.move("<"),p+=h.move(n.safe(e.url,{before:p,after:">",...h.current()})),p+=h.move(">")):(f=n.enter("destinationRaw"),p+=h.move(n.safe(e.url,{before:p,after:e.title?" ":")",...h.current()}))),f(),e.title&&(f=n.enter(`title${o}`),p+=h.move(" "+a),p+=h.move(n.safe(e.title,{before:p,after:a,...h.current()})),p+=h.move(a),f()),p+=h.move(")"),u(),p}function f7(){return"!"}Ek.peek=h7;function Ek(e,t,n,r){const a=e.referenceType,o=n.enter("imageReference");let u=n.enter("label");const f=n.createTracker(r);let h=f.move("![");const p=n.safe(e.alt,{before:h,after:"]",...f.current()});h+=f.move(p+"]["),u();const m=n.stack;n.stack=[],u=n.enter("reference");const x=n.safe(n.associationId(e),{before:h,after:"]",...f.current()});return u(),n.stack=m,o(),a==="full"||!p||p!==x?h+=f.move(x+"]"):a==="shortcut"?h=h.slice(0,-1):h+=f.move("]"),h}function h7(){return"!"}Tk.peek=p7;function Tk(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],f=n.compilePattern(u);let h;if(u.atBreak)for(;h=f.exec(r);){let p=h.index;r.charCodeAt(p)===10&&r.charCodeAt(p-1)===13&&p--,r=r.slice(0,p)+" "+r.slice(h.index+1)}}return a+r+a}function p7(){return"`"}function Ak(e,t){const n=Ax(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))}Mk.peek=m7;function Mk(e,t,n,r){const a=Fx(n),o=a==='"'?"Quote":"Apostrophe",u=n.createTracker(r);let f,h;if(Ak(e,n)){const m=n.stack;n.stack=[],f=n.enter("autolink");let x=u.move("<");return x+=u.move(n.containerPhrasing(e,{before:x,after:">",...u.current()})),x+=u.move(">"),f(),n.stack=m,x}f=n.enter("link"),h=n.enter("label");let p=u.move("[");return p+=u.move(n.containerPhrasing(e,{before:p,after:"](",...u.current()})),p+=u.move("]("),h(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(h=n.enter("destinationLiteral"),p+=u.move("<"),p+=u.move(n.safe(e.url,{before:p,after:">",...u.current()})),p+=u.move(">")):(h=n.enter("destinationRaw"),p+=u.move(n.safe(e.url,{before:p,after:e.title?" ":")",...u.current()}))),h(),e.title&&(h=n.enter(`title${o}`),p+=u.move(" "+a),p+=u.move(n.safe(e.title,{before:p,after:a,...u.current()})),p+=u.move(a),h()),p+=u.move(")"),f(),p}function m7(e,t,n){return Ak(e,n)?"<":"["}Rk.peek=g7;function Rk(e,t,n,r){const a=e.referenceType,o=n.enter("linkReference");let u=n.enter("label");const f=n.createTracker(r);let h=f.move("[");const p=n.containerPhrasing(e,{before:h,after:"]",...f.current()});h+=f.move(p+"]["),u();const m=n.stack;n.stack=[],u=n.enter("reference");const x=n.safe(n.associationId(e),{before:h,after:"]",...f.current()});return u(),n.stack=m,o(),a==="full"||!p||p!==x?h+=f.move(x+"]"):a==="shortcut"?h=h.slice(0,-1):h+=f.move("]"),h}function g7(){return"["}function Ux(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 x7(e){const t=Ux(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 v7(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 Lk(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 b7(e,t,n,r){const a=n.enter("list"),o=n.bulletCurrent;let u=e.ordered?v7(n):Ux(n);const f=e.ordered?u==="."?")":".":x7(n);let h=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&&(h=!0),Lk(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"){h=!0;break}}}}h&&(u=f),n.bulletCurrent=u;const p=n.containerFlow(e,r);return n.bulletLastUsed=u,n.bulletCurrent=o,a(),p}function y7(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 _7(e,t,n,r){const a=y7(n);let o=n.bulletCurrent||Ux(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 f=n.createTracker(r);f.move(o+" ".repeat(u-o.length)),f.shift(u);const h=n.enter("listItem"),p=n.indentLines(n.containerFlow(e,f.current()),m);return h(),p;function m(x,b,y){return b?(y?"":" ".repeat(u))+x:(y?o:o+" ".repeat(u-o.length))+x}}function w7(e,t,n,r){const a=n.enter("paragraph"),o=n.enter("phrasing"),u=n.containerPhrasing(e,r);return o(),a(),u}const k7=Df(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function S7(e,t,n,r){return(e.children.some(function(u){return k7(u)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function j7(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Dk.peek=N7;function Dk(e,t,n,r){const a=j7(n),o=n.enter("strong"),u=n.createTracker(r),f=u.move(a+a);let h=u.move(n.containerPhrasing(e,{after:a,before:f,...u.current()}));const p=h.charCodeAt(0),m=wf(r.before.charCodeAt(r.before.length-1),p,a);m.inside&&(h=Pc(p)+h.slice(1));const x=h.charCodeAt(h.length-1),b=wf(r.after.charCodeAt(0),x,a);b.inside&&(h=h.slice(0,-1)+Pc(x));const y=u.move(a+a);return o(),n.attentionEncodeSurroundingInfo={after:b.outside,before:m.outside},f+h+y}function N7(e,t,n){return n.options.strong||"*"}function C7(e,t,n,r){return n.safe(e.value,r)}function E7(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 T7(e,t,n){const r=(Lk(n)+(n.options.ruleSpaces?" ":"")).repeat(E7(n));return n.options.ruleSpaces?r.slice(0,-1):r}const zk={blockquote:Z8,break:d5,code:i7,definition:a7,emphasis:jk,hardBreak:d5,heading:u7,html:Nk,image:Ck,imageReference:Ek,inlineCode:Tk,link:Mk,linkReference:Rk,list:b7,listItem:_7,paragraph:w7,root:S7,strong:Dk,text:C7,thematicBreak:T7};function A7(){return{enter:{table:M7,tableData:f5,tableHeader:f5,tableRow:L7},exit:{codeText:D7,table:R7,tableData:Im,tableHeader:Im,tableRow:Im}}}function M7(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 R7(e){this.exit(e),this.data.inTable=void 0}function L7(e){this.enter({type:"tableRow",children:[]},e)}function Im(e){this.exit(e)}function f5(e){this.enter({type:"tableCell",children:[]},e)}function D7(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,z7));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function z7(e,t){return t==="|"?t:e}function O7(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:h,tableRow:f}};function u(y,_,j,N){return p(m(y,j,N),y.align)}function f(y,_,j,N){const S=x(y,j,N),E=p([S]);return E.slice(0,E.indexOf(`
99
- `))}function h(y,_,j,N){const S=j.enter("tableCell"),E=j.enter("phrasing"),C=j.containerPhrasing(y,{...N,before:o,after:o});return E(),S(),C}function p(y,_){return X8(y,{align:_,alignDelimiters:r,padding:n,stringLength:a})}function m(y,_,j){const N=y.children;let S=-1;const E=[],C=_.enter("table");for(;++S<N.length;)E[S]=x(N[S],_,j);return C(),E}function x(y,_,j){const N=y.children;let S=-1;const E=[],C=_.enter("tableRow");for(;++S<N.length;)E[S]=h(N[S],y,_,j);return C(),E}function b(y,_,j){let N=zk.inlineCode(y,_,j);return j.stack.includes("tableCell")&&(N=N.replace(/\|/g,"\\$&")),N}}function B7(){return{exit:{taskListCheckValueChecked:h5,taskListCheckValueUnchecked:h5,paragraph:$7}}}function P7(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:F7}}}function h5(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function $7(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 f=a[o];if(f.type==="paragraph"){u=f;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 F7(e,t,n,r){const a=e.children[0],o=typeof e.checked=="boolean"&&a&&a.type==="paragraph",u="["+(e.checked?"x":" ")+"] ",f=n.createTracker(r);o&&f.move(u);let h=zk.listItem(e,t,n,{...r,...f.current()});return o&&(h=h.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,p)),h;function p(m){return m+u}}function U7(){return[b8(),F8(),I8(),A7(),B7()]}function q7(e){return{extensions:[y8(),U8(e),V8(),O7(e),P7()]}}const H7={tokenize:Q7,partial:!0},Ok={tokenize:X7,partial:!0},Bk={tokenize:K7,partial:!0},Pk={tokenize:Z7,partial:!0},I7={tokenize:J7,partial:!0},$k={name:"wwwAutolink",tokenize:Y7,previous:Uk},Fk={name:"protocolAutolink",tokenize:W7,previous:qk},es={name:"emailAutolink",tokenize:G7,previous:Hk},_i={};function V7(){return{text:_i}}let xa=48;for(;xa<123;)_i[xa]=es,xa++,xa===58?xa=65:xa===91&&(xa=97);_i[43]=es;_i[45]=es;_i[46]=es;_i[95]=es;_i[72]=[es,Fk];_i[104]=[es,Fk];_i[87]=[es,$k];_i[119]=[es,$k];function G7(e,t,n){const r=this;let a,o;return u;function u(x){return!Qg(x)||!Hk.call(r,r.previous)||qx(r.events)?n(x):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(x))}function f(x){return Qg(x)?(e.consume(x),f):x===64?(e.consume(x),h):n(x)}function h(x){return x===46?e.check(I7,m,p)(x):x===45||x===95||Pn(x)?(o=!0,e.consume(x),h):m(x)}function p(x){return e.consume(x),a=!0,h}function m(x){return o&&a&&Wn(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(x)):n(x)}}function Y7(e,t,n){const r=this;return a;function a(u){return u!==87&&u!==119||!Uk.call(r,r.previous)||qx(r.events)?n(u):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(H7,e.attempt(Ok,e.attempt(Bk,o),n),n)(u))}function o(u){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(u)}}function W7(e,t,n){const r=this;let a="",o=!1;return u;function u(x){return(x===72||x===104)&&qk.call(r,r.previous)&&!qx(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(x),e.consume(x),f):n(x)}function f(x){if(Wn(x)&&a.length<5)return a+=String.fromCodePoint(x),e.consume(x),f;if(x===58){const b=a.toLowerCase();if(b==="http"||b==="https")return e.consume(x),h}return n(x)}function h(x){return x===47?(e.consume(x),o?p:(o=!0,h)):n(x)}function p(x){return x===null||bf(x)||qt(x)||Ra(x)||Mf(x)?n(x):e.attempt(Ok,e.attempt(Bk,m),n)(x)}function m(x){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(x)}}function Q7(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 X7(e,t,n){let r,a,o;return u;function u(p){return p===46||p===95?e.check(Pk,h,f)(p):p===null||qt(p)||Ra(p)||p!==45&&Mf(p)?h(p):(o=!0,e.consume(p),u)}function f(p){return p===95?r=!0:(a=r,r=void 0),e.consume(p),u}function h(p){return a||r||!o?n(p):t(p)}}function K7(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(Pk,t,o)(u):u===null||qt(u)||Ra(u)?t(u):(e.consume(u),a)}function o(u){return u===41&&r++,e.consume(u),a}}function Z7(e,t,n){return r;function r(f){return f===33||f===34||f===39||f===41||f===42||f===44||f===46||f===58||f===59||f===63||f===95||f===126?(e.consume(f),r):f===38?(e.consume(f),o):f===93?(e.consume(f),a):f===60||f===null||qt(f)||Ra(f)?t(f):n(f)}function a(f){return f===null||f===40||f===91||qt(f)||Ra(f)?t(f):r(f)}function o(f){return Wn(f)?u(f):n(f)}function u(f){return f===59?(e.consume(f),r):Wn(f)?(e.consume(f),u):n(f)}}function J7(e,t,n){return r;function r(o){return e.consume(o),a}function a(o){return Pn(o)?n(o):t(o)}}function Uk(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||qt(e)}function qk(e){return!Wn(e)}function Hk(e){return!(e===47||Qg(e))}function Qg(e){return e===43||e===45||e===46||e===95||Pn(e)}function qx(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 eR={tokenize:oR,partial:!0};function tR(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:sR,continuation:{tokenize:aR},exit:lR}},text:{91:{name:"gfmFootnoteCall",tokenize:iR},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:nR,resolveTo:rR}}}}function nR(e,t,n){const r=this;let a=r.events.length;const o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let u;for(;a--;){const h=r.events[a][1];if(h.type==="labelImage"){u=h;break}if(h.type==="gfmFootnoteCall"||h.type==="labelLink"||h.type==="label"||h.type==="image"||h.type==="link")break}return f;function f(h){if(!u||!u._balanced)return n(h);const p=ei(r.sliceSerialize({start:u.end,end:r.now()}));return p.codePointAt(0)!==94||!o.includes(p.slice(1))?n(h):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),t(h))}}function rR(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)},f=[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,...f),e}function iR(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o=0,u;return f;function f(x){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(x),e.exit("gfmFootnoteCallLabelMarker"),h}function h(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||qt(x))return n(x);if(x===93){e.exit("chunkString");const b=e.exit("gfmFootnoteCallString");return a.includes(ei(r.sliceSerialize(b)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(x),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(x)}return qt(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 sR(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,u=0,f;return h;function h(_){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(_),e.exit("gfmFootnoteDefinitionLabelMarker"),p}function p(_){return _===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(_),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",m):n(_)}function m(_){if(u>999||_===93&&!f||_===null||_===91||qt(_))return n(_);if(_===93){e.exit("chunkString");const j=e.exit("gfmFootnoteDefinitionLabelString");return o=ei(r.sliceSerialize(j)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(_),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),b}return qt(_)||(f=!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),xt(e,y,"gfmFootnoteDefinitionWhitespace")):n(_)}function y(_){return t(_)}}function aR(e,t,n){return e.check(Hc,t,e.attempt(eR,t,n))}function lR(e){e.exit("gfmFootnoteDefinition")}function oR(e,t,n){const r=this;return xt(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 cR(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,f){let h=-1;for(;++h<u.length;)if(u[h][0]==="enter"&&u[h][1].type==="strikethroughSequenceTemporary"&&u[h][1]._close){let p=h;for(;p--;)if(u[p][0]==="exit"&&u[p][1].type==="strikethroughSequenceTemporary"&&u[p][1]._open&&u[h][1].end.offset-u[h][1].start.offset===u[p][1].end.offset-u[p][1].start.offset){u[h][1].type="strikethroughSequence",u[p][1].type="strikethroughSequence";const m={type:"strikethrough",start:Object.assign({},u[p][1].start),end:Object.assign({},u[h][1].end)},x={type:"strikethroughText",start:Object.assign({},u[p][1].end),end:Object.assign({},u[h][1].start)},b=[["enter",m,f],["enter",u[p][1],f],["exit",u[p][1],f],["enter",x,f]],y=f.parser.constructs.insideSpan.null;y&&kr(b,b.length,0,Rf(y,u.slice(p+1,h),f)),kr(b,b.length,0,[["exit",x,f],["enter",u[h][1],f],["exit",u[h][1],f],["exit",m,f]]),kr(u,p-1,h-p+3,b),h=p+b.length-2;break}}for(h=-1;++h<u.length;)u[h][1].type==="strikethroughSequenceTemporary"&&(u[h][1].type="data");return u}function o(u,f,h){const p=this.previous,m=this.events;let x=0;return b;function b(_){return p===126&&m[m.length-1][1].type!=="characterEscape"?h(_):(u.enter("strikethroughSequenceTemporary"),y(_))}function y(_){const j=Il(p);if(_===126)return x>1?h(_):(u.consume(_),x++,y);if(x<2&&!n)return h(_);const N=u.exit("strikethroughSequenceTemporary"),S=Il(_);return N._open=!S||S===2&&!!j,N._close=!j||j===2&&!!S,f(_)}}}class uR{constructor(){this.map=[]}add(t,n,r){dR(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 dR(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 fR(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 hR(){return{flow:{null:{name:"table",tokenize:pR,resolveAll:mR}}}}function pR(e,t,n){const r=this;let a=0,o=0,u;return f;function f(z){let q=r.events.length-1;for(;q>-1;){const K=r.events[q][1].type;if(K==="lineEnding"||K==="linePrefix")q--;else break}const A=q>-1?r.events[q][1].type:null,ie=A==="tableHead"||A==="tableRow"?L:h;return ie===L&&r.parser.lazy[r.now().line]?n(z):ie(z)}function h(z){return e.enter("tableHead"),e.enter("tableRow"),p(z)}function p(z){return z===124||(u=!0,o+=1),m(z)}function m(z){return z===null?n(z):Fe(z)?o>1?(o=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),y):n(z):ct(z)?xt(e,m,"whitespace")(z):(o+=1,u&&(u=!1,a+=1),z===124?(e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),u=!0,m):(e.enter("data"),x(z)))}function x(z){return z===null||z===124||qt(z)?(e.exit("data"),m(z)):(e.consume(z),z===92?b:x)}function b(z){return z===92||z===124?(e.consume(z),x):x(z)}function y(z){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(z):(e.enter("tableDelimiterRow"),u=!1,ct(z)?xt(e,_,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):_(z))}function _(z){return z===45||z===58?N(z):z===124?(u=!0,e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),j):D(z)}function j(z){return ct(z)?xt(e,N,"whitespace")(z):N(z)}function N(z){return z===58?(o+=1,u=!0,e.enter("tableDelimiterMarker"),e.consume(z),e.exit("tableDelimiterMarker"),S):z===45?(o+=1,S(z)):z===null||Fe(z)?O(z):D(z)}function S(z){return z===45?(e.enter("tableDelimiterFiller"),E(z)):D(z)}function E(z){return z===45?(e.consume(z),E):z===58?(u=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(z),e.exit("tableDelimiterMarker"),C):(e.exit("tableDelimiterFiller"),C(z))}function C(z){return ct(z)?xt(e,O,"whitespace")(z):O(z)}function O(z){return z===124?_(z):z===null||Fe(z)?!u||a!==o?D(z):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(z)):D(z)}function D(z){return n(z)}function L(z){return e.enter("tableRow"),I(z)}function I(z){return z===124?(e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),I):z===null||Fe(z)?(e.exit("tableRow"),t(z)):ct(z)?xt(e,I,"whitespace")(z):(e.enter("data"),F(z))}function F(z){return z===null||z===124||qt(z)?(e.exit("data"),I(z)):(e.consume(z),z===92?W:F)}function W(z){return z===92||z===124?(e.consume(z),F):F(z)}}function mR(e,t){let n=-1,r=!0,a=0,o=[0,0,0,0],u=[0,0,0,0],f=!1,h=0,p,m,x;const b=new uR;for(;++n<e.length;){const y=e[n],_=y[1];y[0]==="enter"?_.type==="tableHead"?(f=!1,h!==0&&(p5(b,t,h,p,m),m=void 0,h=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],f&&(f=!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=Ed(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=Ed(b,t,o,a,void 0,x)),o=u,u=[o[1],n,0,0])):_.type==="tableHead"?(f=!0,h=n):_.type==="tableRow"||_.type==="tableDelimiterRow"?(h=n,o[1]!==0?(u[0]=u[1],x=Ed(b,t,o,a,n,x)):u[1]!==0&&(x=Ed(b,t,u,a,n,x)),a=0):a&&(_.type==="data"||_.type==="tableDelimiterMarker"||_.type==="tableDelimiterFiller")&&(u[3]=n)}for(h!==0&&p5(b,t,h,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=fR(t.events,n))}return e}function Ed(e,t,n,r,a,o){const u=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",f="tableContent";n[0]!==0&&(o.end=Object.assign({},El(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const h=El(t.events,n[1]);if(o={type:u,start:Object.assign({},h),end:Object.assign({},h)},e.add(n[1],0,[["enter",o,t]]),n[2]!==0){const p=El(t.events,n[2]),m=El(t.events,n[3]),x={type:f,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({},El(t.events,a)),e.add(a,0,[["exit",o,t]]),o=void 0),o}function p5(e,t,n,r,a){const o=[],u=El(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 El(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const gR={name:"tasklistCheck",tokenize:vR};function xR(){return{text:{91:gR}}}function vR(e,t,n){const r=this;return a;function a(h){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(h):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(h),e.exit("taskListCheckMarker"),o)}function o(h){return qt(h)?(e.enter("taskListCheckValueUnchecked"),e.consume(h),e.exit("taskListCheckValueUnchecked"),u):h===88||h===120?(e.enter("taskListCheckValueChecked"),e.consume(h),e.exit("taskListCheckValueChecked"),u):n(h)}function u(h){return h===93?(e.enter("taskListCheckMarker"),e.consume(h),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),f):n(h)}function f(h){return Fe(h)?t(h):ct(h)?e.check({tokenize:bR},t,n)(h):n(h)}}function bR(e,t,n){return xt(e,r,"whitespace");function r(a){return a===null?n(a):t(a)}}function yR(e){return J2([V7(),tR(),cR(e),hR(),xR()])}const _R={};function Hx(e){const t=this,n=e||_R,r=t.data(),a=r.micromarkExtensions||(r.micromarkExtensions=[]),o=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),u=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);a.push(yR(n)),o.push(U7()),u.push(q7(n))}const wR=1500;async function kR(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 Ix({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 kR(e)&&(a(!0),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>a(!1),wR))},f=r?"Copied":t;return l.jsx("button",{type:"button",onClick:u,"aria-label":f,title:f,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"})]})})}const kf=25*1024*1024,Sf=100*1024*1024;function Ik(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 Os(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 Vk(e){return e.startsWith("image/")}function Gk({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 Yk({name:e,mediaType:t,base64:n,size:r,onRemove:a,className:o="w-12 h-12"}){const u=Vk(t);return l.jsxs("div",{className:"relative group",title:`${e} (${Os(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(Gk,{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 SR({name:e,mediaType:t,data:n,size:r}){return Vk(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(Gk,{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:Os(r)})]})]})}function Xg(e){var t;return e==null||typeof e=="boolean"?"":typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(Xg).join(""):typeof e=="object"&&e!==null&&"props"in e?Xg((t=e.props)==null?void 0:t.children):""}function jR({message:e}){return e.role==="system"?l.jsxs("div",{className:"flex items-center gap-3 py-1 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}),l.jsx("div",{className:"shrink-0 flex-1 h-px bg-cc-border"})]}):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(SR,{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(Vx,{text:e.content})})]})}):l.jsx("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]",children:l.jsx(AR,{message:e})})}function NR(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 CR(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 ER(e){return e.kind==="content"&&e.block.type==="thinking"&&!e.block.thinking.trim()}function TR({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 AR({message:e}){var u;const t=e.contentBlocks||[],n=Gl(),r=k.useMemo(()=>NR(t),[t]),a=k.useMemo(()=>CR(t),[t]),o=k.useMemo(()=>n?r.filter(f=>!ER(f)):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(Vm,{}),l.jsx("div",{className:"flex-1 min-w-0",children:l.jsx(TR,{streaming:e.isStreaming})})]});if(t.length===0&&e.content){const f=e.isStreaming&&e.streamingPhase==="thinking";return l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(Vm,{}),l.jsx("div",{className:"flex-1 min-w-0",children:f?l.jsx(Qk,{text:e.content}):l.jsx(Vx,{text:e.content,showCursor:!!e.isStreaming})})]})}return l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(Vm,{}),l.jsx("div",{className:`flex-1 min-w-0 ${n?"space-y-1.5":"space-y-3"}`,children:o.map((f,h)=>{if(f.kind==="content")return l.jsx(MR,{block:f.block,toolUseById:a},h);if(f.items.length===1){const p=f.items[0];return l.jsx(H5,{name:p.name,input:p.input,toolUseId:p.id},h)}return l.jsx(DR,{name:f.name,items:f.items},h)})})]})}function Vm(){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 Vx({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($x,{remarkPlugins:[Hx],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 f=(o==null?void 0:o[1])||"",h=Xg(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"})]}),f&&l.jsx("span",{className:"text-[10px] text-cc-muted/70 font-mono-code uppercase tracking-wider",children:f}),l.jsx(Ix,{text:h,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("code",{className:"px-1.5 py-0.5 rounded-md bg-cc-fg/[0.06] text-[12.5px] font-mono-code text-cc-fg/80 border border-cc-border/40",children: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 MR({block:e,toolUseById:t}){if(e.type==="text")return l.jsx(Vx,{text:e.text});if(e.type==="thinking")return l.jsx(Qk,{text:e.thinking});if(e.type==="tool_use")return l.jsx(H5,{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(RR,{text:n,isError:o}):l.jsx(LR,{content:n,isError:o})}return null}function Wk(e){return`${e} ${e===1?"line":"lines"}`}function RR({text:e,isError:t}){const n=e.split(/\r?\n/),r=n.length>20,[a,o]=k.useState(!1),u=Gl(),[f,h]=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(Ix,{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(Nf,{open:f,onToggle:()=>h(!f),marker:"›",label:t?"Error output":"Output",meta:Wk(n.length),labelClassName:t?"text-cc-error/70":""}),f&&l.jsx("div",{className:"mt-1",children:m})]}):m}function LR({content:e,isError:t}){const n=Gl(),[r,a]=k.useState(!1),o=l.jsxs("div",{className:"relative rounded-lg bg-cc-code-bg overflow-hidden",children:[l.jsx(Ix,{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(Nf,{open:r,onToggle:()=>a(!r),marker:"›",label:t?"Error result":"Result",meta:Wk(e.split(/\r?\n/).length),labelClassName:t?"text-cc-error/70":""}),r&&l.jsx("div",{className:"mt-1",children:o})]}):o}function DR({name:e,items:t}){const[n,r]=k.useState(!1),a=$c(e),o=Bs(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(Ol,{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,f)=>{const h=jc(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:h||JSON.stringify(u.input).slice(0,80)})]},u.id||f)})})]})}function Qk({text:e}){const t=e.trim(),n=Gl(),[r,a]=k.useState(!1),o=t.split(`
102
- `),u=n?2:8,f=n?200:600,h=o.length>u||t.length>f,p=h&&!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($x,{remarkPlugins:[Hx],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."})}),h&&!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 hc(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function lc(e){const t=Math.floor(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function m5(e){try{const t=new Date(e).getTime()-Date.now();return Number.isFinite(t)?t<=0?"now":zR(t):"N/A"}catch{return"N/A"}}function Kg(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 g5(e){return e>=1440?`${Math.round(e/1440)}d`:e>=60?`${Math.round(e/60)}h`:`${e}m`}function zR(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 OR({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(Ol,{type:$c(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:Bs(t.toolName)}),l.jsxs("span",{className:"text-cc-muted/50 tabular-nums",children:[t.elapsedSeconds,"s"]})]},n))})}function BR({entries:e}){const[t,n]=k.useState(!1),r=k.useMemo(()=>{const a=e.reduce((h,p)=>h+p.elapsedSeconds,0),o=Math.max(...e.map(h=>h.elapsedSeconds),.1),u=e.filter(h=>h.isError).length,f=e.filter(h=>!h.completedAt).length;return{totalTime:a,maxTime:o,errorCount:u,running:f}},[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:`${Bs(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(PR,{entry:a,maxTime:r.maxTime},a.toolUseId))})]})}function PR({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(Ol,{type:$c(e.toolName)}),l.jsx("span",{className:"text-cc-fg/70 truncate",children:Bs(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 Td=100,$R=40,FR=120,x5=1e4,UR=15*6e4,Gm=new Map,qR=[],HR=[];function IR(e){const t=e.split("/").filter(Boolean);return t.length===0?e:t.slice(-2).join("/")}function VR(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 v5(e){return(e.contentBlocks||[]).filter(n=>n.type==="tool_use").map(n=>({id:n.id,name:n.name,input:n.input}))}function GR(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 Xk(e){const t=[];for(const n of e){const r=VR(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(...v5(n));continue}t.push({kind:"tool_msg_group",toolName:r,items:v5(n),firstId:n.id})}else t.push({kind:"message",msg:n})}return t}function Kk(e,t,n){const r=Xk(e),a=[];for(const o of r){a.push(o);const u=GR(o);for(const f of u){const h=n.get(f);if(h&&h.length>0){const p=t.get(f)||{description:"Subagent",agentType:""},m=Kk(h,t,n);a.push({kind:"subagent",taskToolUseId:f,description:p.description,agentType:p.agentType,backend:p.backend,status:p.status,receiverCount:p.receiverCount,senderThreadId:p.senderThreadId,receiverThreadIds:p.receiverThreadIds,children:m})}}}return a}function YR(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:f}=o,h=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=h&&h.length>0?h.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(f,{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:h})}}if(t.size===0)return Xk(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 Kk(r,t,n)}function WR({group:e}){const[t,n]=k.useState(!1),r=$c(e.toolName),a=Bs(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(b5,{}),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(Ol,{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:jc(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(b5,{}),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(Ol,{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,f)=>{const h=jc(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:h||JSON.stringify(u.input).slice(0,80)})]},u.id||f)})})]})})]})})}function Zk({entries:e,toolActivity:t}){return l.jsx(l.Fragment,{children:e.map((n,r)=>{if(n.kind==="tool_msg_group")return l.jsx(WR,{group:n},n.firstId||r);if(n.kind==="subagent")return l.jsx(KR,{group:n},n.taskToolUseId);const a=n.msg,o=QR(a),u=t&&o.length>0?t.filter(h=>o.includes(h.toolUseId)):[],f=u.length>0&&u.every(h=>h.completedAt);return l.jsxs("div",{children:[l.jsx(jR,{message:a}),f&&l.jsx(BR,{entries:u})]},a.id)})})}function QR(e){var t;return(t=e.contentBlocks)!=null&&t.length?e.contentBlocks.filter(n=>n.type==="tool_use").map(n=>n.id):[]}function XR(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 KR({group:e}){const[t,n]=k.useState(!1),r=e.description||"Subagent",a=e.agentType,o=e.children.length,u=XR(e.status),f=e.receiverCount,h=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`${Bs(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(S=>S.type==="tool_use");if(N)return Bs(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}),f!==void 0&&l.jsxs("span",{className:"text-[10px] text-cc-muted/40",children:[f," agent",f===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:[(h||p.length>0)&&l.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[10px] text-cc-muted/50 pl-4",children:[h&&l.jsxs("span",{className:"font-mono-code",children:["sender: ",h]}),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(Zk,{entries:e.children})]})]})})}function b5(){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 ZR({sessionId:e}){var Tt;const t=Y(ve=>ve.messages.get(e)??qR),n=Y(ve=>(ve.sdkSessions||HR).find($e=>$e.sessionId===e)),r=Y(ve=>ve.streamingStartedAt.get(e)),a=Y(ve=>ve.streamingOutputTokens.get(e)),o=Y(ve=>ve.sessionStatus.get(e)),u=Y(ve=>ve.lastActivityAt.get(e)),f=Y(ve=>ve.sessionProcesses.get(e)),h=Y(ve=>ve.toolProgress.get(e)),p=Y(ve=>ve.toolActivity.get(e)),m=k.useRef(null),x=k.useRef(null),b=k.useRef(!0),[y,_]=k.useState(0),[j,N]=k.useState(Td),[S,E]=k.useState([]),[C,O]=k.useState(0),[D,L]=k.useState(!1),[I,F]=k.useState(!1),[W,z]=k.useState(!1),[q,A]=k.useState(""),ie=k.useRef(new Set),K=Y(ve=>ve.chatTabReentryTickBySession.get(e)??0),G=k.useMemo(()=>t.some(ve=>ve.role==="assistant"&&ve.isStreaming),[t]),P=k.useMemo(()=>(f??[]).filter(ve=>ve.status==="running"),[f]),$=P.length>0,se=k.useMemo(()=>{const ve=p??[];for(let $e=ve.length-1;$e>=0;$e--)if(!ve[$e].completedAt)return ve[$e]},[p]),ae=k.useMemo(()=>P.length>0?Math.min(...P.map(ve=>ve.startedAt)):null,[P]),R=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=R.length>0,Z=n!=null&&n.forkSession?"Forked from":"Continuing from",M=k.useMemo(()=>{if(S.length===0)return t;const ve=[],$e=new Set;for(const rt of S)$e.has(rt.id)||($e.add(rt.id),ve.push(rt));for(const rt of t)$e.has(rt.id)||($e.add(rt.id),ve.push(rt));return ve},[S,t]),pe=k.useMemo(()=>YR(M),[M]);k.useEffect(()=>{N(Td),E([]),O(0),L(!1),F(!1),z(!1),A(""),ie.current=new Set},[e,R]);const _e=pe.length,Ce=_e>j,De=Ce?pe.slice(_e-j):pe,Ee=_e-De.length,Be=k.useCallback(()=>{const ve=x.current,$e=(ve==null?void 0:ve.scrollHeight)??0;N(rt=>rt+Td),requestAnimationFrame(()=>{if(ve){const rt=ve.scrollHeight;ve.scrollTop+=rt-$e}})},[]),Je=k.useCallback(async(ve={})=>{if(!B||!R||W)return;const $e=x.current,rt=($e==null?void 0:$e.scrollHeight)??0,rn=I?C:0;z(!0),A("");try{const je=await Ne.getClaudeSessionHistory(R,{cursor:rn,limit:$R}),ze=je.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})),pt=[];for(const Te of ze)ie.current.has(Te.id)||(ie.current.add(Te.id),pt.push(Te));E(Te=>[...pt,...Te]),O(je.nextCursor),L(je.hasMore),F(!0),pt.length>0&&N(Te=>Te+pt.length),ve.preserveScroll!==!1&&$e&&requestAnimationFrame(()=>{const Te=$e.scrollHeight;$e.scrollTop+=Te-rt})}catch(je){const ze=je instanceof Error?je.message:String(je);A(ze||"Failed to load previous history"),I||(E([]),O(0),L(!1))}finally{z(!1)}},[B,R,W,I,C]);k.useEffect(()=>{if(!r&&o!=="running"&&!$){_(0);return}const ve=r||Date.now();_(Date.now()-ve);const $e=setInterval(()=>_(Date.now()-ve),1e3);return()=>clearInterval($e)},[r,o,$]);function Et(){const ve=x.current;if(!ve)return;b.current=ve.scrollHeight-ve.scrollTop-ve.clientHeight<120;const $e=Math.max(0,ve.scrollHeight-ve.clientHeight-ve.scrollTop);Gm.set(e,$e),B&&I&&D&&!W&&ve.scrollTop<=FR&&Je({preserveScroll:!0})}const ft=k.useCallback(()=>{const ve=x.current;if(!ve)return;const $e=ve.style.scrollBehavior;ve.style.scrollBehavior="auto",ve.scrollTop=ve.scrollHeight,ve.style.scrollBehavior=$e},[]),vt=k.useCallback(()=>{const ve=x.current;if(!ve)return;const $e=ve.style.scrollBehavior;ve.style.scrollBehavior="auto";const rt=Gm.get(e);typeof rt=="number"?ve.scrollTop=Math.max(0,ve.scrollHeight-ve.clientHeight-rt):ve.scrollTop=ve.scrollHeight,ve.style.scrollBehavior=$e},[e]);if(k.useEffect(()=>{requestAnimationFrame(()=>vt())},[e,vt]),k.useEffect(()=>()=>{const ve=x.current;if(!ve)return;const $e=Math.max(0,ve.scrollHeight-ve.clientHeight-ve.scrollTop);Gm.set(e,$e)},[e]),k.useEffect(()=>{K&&requestAnimationFrame(()=>ft())},[K,ft]),k.useEffect(()=>{var ve;b.current&&((ve=m.current)==null||ve.scrollIntoView({behavior:"smooth"}))},[t]),M.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:[Z," ",l.jsx("span",{className:"font-mono-code text-cc-fg/70",children:R.slice(0,8)}),". Load earlier messages when needed."]}),l.jsxs("button",{onClick:()=>void Je({preserveScroll:!1}),disabled:W,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"})}),W?"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 bt=o==="running"&&u!=null?Math.max(0,Date.now()-u):0,wt=$&&(o!=="running"||bt>=x5)?"background":bt>=UR&&!se?"stalled":bt>=x5?"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:Et,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:[Z," existing Claude thread"]}),l.jsxs("p",{className:"text-[11px] text-cc-muted mt-1",children:[R," ",n!=null&&n.cwd?`· ${IR(n.cwd)}`:""]})]}),l.jsx("button",{onClick:()=>void Je({preserveScroll:!0}),disabled:W,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:W?"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:D?W?"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:Be,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(Td,Ee)," more",l.jsxs("span",{className:"text-cc-muted/50 tabular-nums",children:["(",Ee," hidden)"]})]})}),l.jsx(Zk,{entries:De,toolActivity:p}),h&&h.size>0&&!G&&l.jsx(OR,{tools:Array.from(h.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":wt,className:`flex items-center gap-2 text-[11px] font-mono-code pl-10 stats-glow py-1 ${wt==="stalled"?"text-cc-warning":"text-cc-muted"}`,children:[l.jsx("span",{className:`inline-block w-2 h-2 rounded-full ${wt==="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]"}`}),wt==="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:lc(Math.max(0,Date.now()-ae))})]}),((Tt=P[0])==null?void 0:Tt.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})]})]}):wt==="stalled"?l.jsxs("span",{children:["No activity for ",lc(bt)," — the agent may be stuck"]}):wt==="quiet"?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-fg/70",children:se?`Running ${se.toolName}`:"Still working…"}),l.jsx("span",{className:"text-cc-muted/30",children:"|"}),l.jsx("span",{className:"tabular-nums",children:se?lc(Math.max(0,Date.now()-se.startedAt)):`no update for ${lc(bt)}`}),(se==null?void 0:se.preview)&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/30",children:"|"}),l.jsx("span",{className:"truncate max-w-[32ch]",children:se.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:lc(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:[hc(a)," tokens"]})]})]})]}),l.jsx("div",{ref:m})]})})]})}const JR={codex:"✳",xhigh:"★",max:"■",mini:"⚡"};function eL(e,t){for(const[r,a]of Object.entries(JR))if(e.includes(r))return a;const n=["◆","●","◕","✦"];return n[t%n.length]}function tL(e){return e.map((t,n)=>({value:t.value,label:t.label||t.value,icon:eL(t.value,n)}))}const Jk=[{value:"claude-opus-5",label:"Opus 5",icon:""},{value:"claude-opus-4-8",label:"Opus 4.8",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:""}],eS=[{value:"gpt-5.5",label:"GPT-5.5",icon:"■"},{value:"gpt-5.4",label:"GPT-5.4",icon:"✳"},{value:"gpt-5.4-mini",label:"GPT-5.4 Mini",icon:"⚡"},{value:"gpt-5.3-codex",label:"GPT-5.3 Codex",icon:"◆"},{value:"gpt-5.2",label:"GPT-5.2",icon:"●"}],Gx=[{value:"bypassPermissions",label:"Agent"},{value:"plan",label:"Plan"}],Yx=[{value:"bypassPermissions",label:"Auto"},{value:"plan",label:"Plan"}],nL=[{value:"",label:"Default"},{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"xhigh",label:"xHigh"},{value:"max",label:"Max"}],tS=[{value:"bypassPermissions",label:"Full Auto"},{value:"acceptEdits",label:"Auto-Edit"},{value:"default",label:"Supervised"}],nS=[{value:"bypassPermissions",label:"Full Auto"},{value:"default",label:"Supervised"}];function rS(e){return e==="codex"?eS:Jk}function y5(e){return e==="codex"?Yx:Gx}function wz(e){return e==="codex"?nS:tS}function _5(e){return e==="codex"?eS[0].value:Jk[0].value}function w5(e){return e==="codex"?Yx[0].value:Gx[0].value}function kz(e){return e==="codex"?nS[0].value:tS[0].value}function rL(e){return e==="codex"?[]:nL}function k5({sessionId:e}){const[t,n]=k.useState(!1),r=k.useRef(null),a=Y(b=>b.sdkSessions.find(y=>y.sessionId===e)||null),o=Y(b=>b.sessions.get(e)),u=Y(b=>b.cliConnected.get(e)??!1),f=(a==null?void 0:a.backendType)??(o==null?void 0:o.backend_type)??"claude",h=(o==null?void 0:o.model)??(a==null?void 0:a.model)??"",p=rS(f),m=p.find(b=>b.value===h)||(h?{label:h,icon:"?"}:null),x=k.useCallback(b=>{if(n(!1),b===h)return;Rn(e,{type:"set_model",model:b});const{sdkSessions:y,setSdkSessions:_}=Y.getState();_(y.map(j=>j.sessionId===e?{...j,model:b}:j))},[e,h]);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]),f==="codex"||!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===h?"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===h,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===h&&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 iS({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((f,h)=>l.jsxs("button",{"data-prompt-index":h,onClick:()=>a(f),className:`w-full px-3 py-2 text-left flex items-center gap-2.5 transition-colors cursor-pointer ${h===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:["@",f.name]}),l.jsx("div",{className:"text-[11px] text-cc-muted truncate",children:f.content})]}),l.jsx("span",{className:"text-[10px] text-cc-muted shrink-0",children:f.scope})]},f.id)):l.jsx("div",{className:"px-3 py-2 text-[12px] text-cc-muted",children:"No prompts found."})}):null}function sS({text:e,caretPos:t,cwd:n,enabled:r=!0}){const[a,o]=k.useState(!1),[u,f]=k.useState(0),[h,p]=k.useState([]),[m,x]=k.useState(!1),b=k.useRef(null),y=k.useCallback(async()=>{x(!0);try{const S=await Ne.listPrompts(n);p(S.filter(E=>!!E.name.trim()))}catch{p([])}finally{x(!1)}},[n]);k.useEffect(()=>{y()},[y]);const _=k.useMemo(()=>{const S=e.slice(0,t),E=S.match(/(^|\s)@([^\s@]*)$/);if(!E||E.index===void 0)return null;const C=S.length-E[0].length+E[1].length;return{query:E[2]||"",start:C,end:t}},[e,t]),j=k.useMemo(()=>{if(!a||!_)return[];const S=_.query.toLowerCase();if(!S)return h;const E=h.filter(O=>O.name.toLowerCase().startsWith(S)),C=h.filter(O=>!O.name.toLowerCase().startsWith(S)&&O.name.toLowerCase().includes(S));return[...E,...C]},[a,_,h]);k.useEffect(()=>{const S=r&&!!_;S&&!a?(o(!0),f(0)):!S&&a&&o(!1)},[r,_,a]),k.useEffect(()=>{u>=j.length&&f(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(S=>{if(!_)return{nextText:e,nextCursor:t};const E=`${S.content} `,C=`${e.slice(0,_.start)}${E}${e.slice(_.end)}`,O=_.start+E.length;return{nextText:C,nextCursor:O}},[_,e,t]);return{mentionMenuOpen:a,setMentionMenuOpen:o,mentionMenuIndex:u,setMentionMenuIndex:f,mentionContext:_,filteredPrompts:j,promptsLoading:m,savedPrompts:h,selectPrompt:N,refreshPrompts:y,mentionMenuRef:b}}const iL=[];function S5({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",f=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",h=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?f:h:"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 Ad({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 j5(){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 N5({isRunning:e,canSend:t,onSend:n,onInterrupt:r,size:a}){const o=a==="desktop",u=o?"w-9 h-9":"w-10 h-10",f=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?f:"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 sL({sessionId:e}){var oe,we;const[t,n]=k.useState(""),[r,a]=k.useState([]),[o,u]=k.useState(null),[f,h]=k.useState(!1),[p,m]=k.useState(!1),[x,b]=k.useState(0),[y,_]=k.useState(!1),[j,N]=k.useState(""),[S,E]=k.useState("global"),[C,O]=k.useState(null),[D,L]=k.useState(0),I=k.useRef(null),F=k.useRef(null),W=k.useRef(null),z=k.useRef(null),q=Y(Q=>Q.cliConnected),A=Y(Q=>Q.sessions.get(e)),ie=Y(Q=>Q.previousPermissionMode.get(e)||"acceptEdits"),K=q.get(e)??!1,G=(A==null?void 0:A.permissionMode)||"acceptEdits",P=G==="plan",$=(A==null?void 0:A.backend_type)==="codex",ae=((we=(oe=($?Yx:Gx).find(Q=>Q.value===G))==null?void 0:oe.label)==null?void 0:we.toLowerCase())||G,R=sS({text:t,caretPos:D,cwd:A==null?void 0:A.cwd,enabled:!p}),B=k.useMemo(()=>{const Q=[];if(A!=null&&A.slash_commands)for(const me of A.slash_commands)Q.push({name:me,type:"command"});if(A!=null&&A.skills)for(const me of A.skills)Q.push({name:me,type:"skill"});return Q},[A==null?void 0:A.slash_commands,A==null?void 0:A.skills]),Z=k.useMemo(()=>{if(!p)return[];const Q=t.match(/^\/(\S*)$/);if(!Q)return[];const me=Q[1].toLowerCase();return me===""?B:B.filter(Re=>Re.name.toLowerCase().includes(me))},[t,p,B]);k.useEffect(()=>{const Q=t.startsWith("/")&&/^\/\S*$/.test(t)&&B.length>0;Q&&!p?(m(!0),b(0)):!Q&&p&&m(!1)},[t,B.length,p]),k.useEffect(()=>{x>=Z.length&&b(Math.max(0,Z.length-1))},[Z.length,x]),k.useEffect(()=>{if(!W.current||!p)return;const me=W.current.querySelectorAll("[data-cmd-index]")[x];me&&me.scrollIntoView({block:"nearest"})},[x,p]),k.useEffect(()=>{if(z.current===null||!I.current)return;const Q=z.current;I.current.setSelectionRange(Q,Q),z.current=null},[t]);const M=k.useCallback(Q=>{var me;n(`/${Q.name} `),m(!1),(me=I.current)==null||me.focus()},[]),pe=k.useCallback(Q=>{var Re;const me=R.selectPrompt(Q);z.current=me.nextCursor,n(me.nextText),R.setMentionMenuOpen(!1),L(me.nextCursor),(Re=I.current)==null||Re.focus(),I.current&&(I.current.style.height="auto",I.current.style.height=Math.min(I.current.scrollHeight,200)+"px")},[R]);function _e(){var it;const Q=t.trim();if(!Q||!K)return;const me=eg(),Re=r.length>0?r.map(st=>({name:st.name,media_type:st.mediaType,data:st.base64,size:st.size})):void 0;Rn(e,{type:"user_message",content:Q,session_id:e,attachments:Re,client_msg_id:me});const Qe=Y.getState();Qe.appendMessage(e,{id:me,role:"user",content:Q,attachments:Re,timestamp:Date.now()}),Qe.setSessionStatus(e,"running"),Qe.setLastActivity(e,Date.now()),Qe.streamingStartedAt.has(e)||Qe.setStreamingStats(e,{startedAt:Date.now()}),n(""),a([]),u(null),m(!1),R.setMentionMenuOpen(!1),I.current&&(I.current.style.height="auto"),(it=I.current)==null||it.focus()}function Ce(Q){if(p&&Z.length>0){if(Q.key==="ArrowDown"){Q.preventDefault(),b(me=>(me+1)%Z.length);return}if(Q.key==="ArrowUp"){Q.preventDefault(),b(me=>(me-1+Z.length)%Z.length);return}if(Q.key==="Tab"&&!Q.shiftKey){Q.preventDefault(),M(Z[x]);return}if(Q.key==="Enter"&&!Q.shiftKey){Q.preventDefault(),M(Z[x]);return}if(Q.key==="Escape"){Q.preventDefault(),m(!1);return}}if(R.mentionMenuOpen&&Q.key==="Escape"){Q.preventDefault(),R.setMentionMenuOpen(!1);return}if(R.mentionMenuOpen&&R.filteredPrompts.length>0){if(Q.key==="ArrowDown"){Q.preventDefault(),R.setMentionMenuIndex(me=>(me+1)%R.filteredPrompts.length);return}if(Q.key==="ArrowUp"){Q.preventDefault(),R.setMentionMenuIndex(me=>(me-1+R.filteredPrompts.length)%R.filteredPrompts.length);return}if(Q.key==="Tab"&&!Q.shiftKey||Q.key==="Enter"&&!Q.shiftKey){Q.preventDefault(),pe(R.filteredPrompts[R.mentionMenuIndex]);return}}if(R.mentionMenuOpen&&R.filteredPrompts.length===0&&(Q.key==="Enter"&&!Q.shiftKey||Q.key==="Tab"&&!Q.shiftKey)){Q.preventDefault();return}if(Q.key==="Tab"&&Q.shiftKey){Q.preventDefault(),$e();return}Q.key==="Enter"&&!Q.shiftKey&&(Q.preventDefault(),_e())}function De(Q){n(Q.target.value),L(Q.target.selectionStart??Q.target.value.length);const me=Q.target;me.style.height="auto",me.style.height=Math.min(me.scrollHeight,200)+"px"}function Ee(){I.current&&L(I.current.selectionStart??0)}function Be(){Rn(e,{type:"interrupt"})}async function Je(Q){if(Q.length===0)return;const me=[],Re=[];let Qe=r.reduce((it,st)=>it+st.size,0);for(const it of Q){if(it.size>kf){Re.push(`${it.name} is too large (${Os(it.size)}, max ${Os(kf)})`);continue}if(Qe+it.size>Sf){Re.push(`${it.name} would exceed the per-message limit (${Os(Sf)})`);continue}const{base64:st,mediaType:jt}=await Ik(it);me.push({name:it.name,base64:st,mediaType:jt,size:it.size}),Qe+=it.size}me.length>0&&a(it=>[...it,...me]),u(Re.length>0?Re.join("; "):null)}async function Et(Q){const me=Q.target.files;me&&(await Je(Array.from(me)),Q.target.value="")}function ft(Q){a(me=>me.filter((Re,Qe)=>Qe!==Q))}async function vt(Q){var Qe;const me=(Qe=Q.clipboardData)==null?void 0:Qe.items;if(!me)return;const Re=[];for(const it of Array.from(me)){if(it.kind!=="file")continue;const st=it.getAsFile();if(!st)continue;const jt=st.name&&st.name.length>0?st.name:`pasted-${Date.now()}.${(st.type.split("/")[1]||"bin").replace(/[^a-zA-Z0-9]/g,"")}`;Re.push(new File([st],jt,{type:st.type,lastModified:st.lastModified}))}Re.length>0&&(Q.preventDefault(),await Je(Re))}function bt(Q){Q.dataTransfer.types.includes("Files")&&(Q.preventDefault(),Q.stopPropagation(),h(!0))}function wt(Q){Q.currentTarget===Q.target&&h(!1)}async function Tt(Q){if(!Q.dataTransfer.types.includes("Files"))return;Q.preventDefault(),Q.stopPropagation(),h(!1);const me=Array.from(Q.dataTransfer.files);me.length>0&&await Je(me)}function ve(){const Q=t.trim().slice(0,32);N(Q||""),O(null),_(me=>!me)}function $e(){if(!K)return;const Q=Y.getState();if(!P)Q.setPreviousPermissionMode(e,G),Rn(e,{type:"set_permission_mode",mode:"plan"}),Q.updateSession(e,{permissionMode:"plan"});else{const me=ie||($?"bypassPermissions":"acceptEdits");Rn(e,{type:"set_permission_mode",mode:me}),Q.updateSession(e,{permissionMode:me})}}async function rt(){const Q=t.trim(),me=j.trim();if(!Q||!me)return;if(S==="project"&&!(A!=null&&A.cwd)){O("No project folder available for this session");return}const Re={name:me,content:Q,scope:S};S==="project"&&(Re.projectPaths=[A.cwd]);try{await Ne.createPrompt(Re),await R.refreshPrompts(),_(!1),N(""),E("global"),O(null)}catch(Qe){const it=Qe instanceof Error&&Qe.message?Qe.message:"Could not save prompt.";O(it)}}const je=Y(Q=>Q.promptSuggestions.get(e))??iL,ze=Y(Q=>Q.clearPromptSuggestions),Te=Y(Q=>Q.sessionStatus).get(e)==="running",Hr=t.trim().length>0&&K;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 ${f?"ring-2 ring-cc-primary/40 rounded-2xl":""}`,onDragOver:bt,onDragLeave:wt,onDrop:Tt,children:l.jsxs("div",{className:"max-w-3xl mx-auto",children:[f&&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((Q,me)=>l.jsx(Yk,{name:Q.name,mediaType:Q.mediaType,base64:Q.base64,size:Q.size,onRemove:()=>ft(me)},me))}),o&&l.jsx("div",{className:"mb-2 px-3 sm:px-0 text-[11px] text-cc-error",children:o}),l.jsx("input",{ref:F,type:"file",multiple:!0,onChange:Et,className:"hidden","aria-label":"Attach files"}),je.length>0&&l.jsx("div",{className:"flex flex-wrap gap-1.5 px-2 sm:px-4 pb-2",children:je.map((Q,me)=>l.jsx("button",{onClick:()=>{if(!K||Te)return;const Re=eg();Rn(e,{type:"user_message",content:Q,session_id:e,client_msg_id:Re}),Y.getState().appendMessage(e,{id:Re,role:"user",content:Q,timestamp:Date.now()}),ze(e)},disabled:!K||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:Q,children:Q},me))}),l.jsxs("div",{className:`relative overflow-visible transition-all duration-200 border-t border-cc-separator sm:border sm:border-cc-border sm:bg-cc-input-bg/95 sm:rounded-[16px] sm:backdrop-blur-sm composer-card ${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&&Z.length>0&&l.jsx("div",{ref:W,className:"absolute left-2 right-2 bottom-full mb-1 max-h-[240px] overflow-y-auto bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-20 py-1",children:Z.map((Q,me)=>l.jsxs("button",{"data-cmd-index":me,onClick:()=>M(Q),className:`w-full px-3 py-2 text-left flex items-center gap-2.5 transition-colors cursor-pointer ${me===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:Q.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:["/",Q.name]}),l.jsx("span",{className:"ml-2 text-[11px] text-cc-muted",children:Q.type})]})]},`${Q.type}-${Q.name}`))}),l.jsx(iS,{open:R.mentionMenuOpen,loading:R.promptsLoading,prompts:R.filteredPrompts,selectedIndex:R.mentionMenuIndex,onSelect:pe,menuRef:R.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:Q=>{N(Q.target.value),C&&O(null)},placeholder:"Prompt title","aria-label":"Prompt title",className:"w-full px-2 py-1.5 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg focus:outline-none focus:border-cc-primary/40"}),l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx("button",{type:"button","aria-pressed":S==="global",onClick:()=>E("global"),className:`px-2 py-0.5 text-[11px] rounded border transition-colors cursor-pointer ${S==="global"?"border-cc-primary/40 text-cc-primary bg-cc-primary/8":"border-cc-border text-cc-muted hover:text-cc-fg"}`,children:"Global"}),l.jsx("button",{type:"button","aria-pressed":S==="project",onClick:()=>E("project"),className:`px-2 py-0.5 text-[11px] rounded border transition-colors cursor-pointer ${S==="project"?"border-cc-primary/40 text-cc-primary bg-cc-primary/8":"border-cc-border text-cc-muted hover:text-cc-fg"}`,children:"This project"})]}),S==="project"&&(A==null?void 0:A.cwd)&&l.jsx("div",{className:"text-[10px] text-cc-muted font-mono-code truncate",title:A.cwd,children:A.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"),O(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:rt,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(S5,{isPlan:P,isConnected:K,onToggle:$e,modeLabel:ae,size:"mobile"}),l.jsx(k5,{sessionId:e}),l.jsx("div",{className:"flex-1"}),l.jsx(Ad,{onClick:ve,disabled:!K||!t.trim(),active:K&&!!t.trim(),title:"Save as prompt",children:l.jsx(j5,{})}),l.jsx(Ad,{onClick:()=>{var Q;return(Q=F.current)==null?void 0:Q.click()},disabled:!K,active:K,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:De,onKeyDown:Ce,onClick:Ee,onKeyUp:Ee,onPaste:vt,"aria-label":"Message input",placeholder:K?"Type a message... (/ + @)":"Waiting for CLI connection...",disabled:!K,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(N5,{isRunning:Te,canSend:Hr,onSend:_e,onInterrupt:Be,size:"mobile"})}),l.jsxs("div",{className:"hidden sm:flex items-center gap-1.5 px-2.5 pb-2",children:[l.jsx(Ad,{onClick:()=>{var Q;return(Q=F.current)==null?void 0:Q.click()},disabled:!K,active:K,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(Ad,{onClick:ve,disabled:!K||!t.trim(),active:K&&!!t.trim(),title:"Save as prompt",children:l.jsx(j5,{})}),l.jsx(S5,{isPlan:P,isConnected:K,onToggle:$e,modeLabel:ae,size:"desktop"}),l.jsx("div",{className:"flex-1"}),l.jsx(k5,{sessionId:e}),l.jsx(N5,{isRunning:Te,canSend:Hr,onSend:_e,onInterrupt:Be,size:"desktop"})]})]})]})})}function aL(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 lL(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 oL({permission:e,sessionId:t}){const[n,r]=k.useState(!1),a=Y(p=>p.removePermission);function o(p,m){r(!0),Rn(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),Rn(t,{type:"permission_response",request_id:e.request_id,behavior:"deny",message:"Denied by user"}),a(t,e.request_id)}const f=e.tool_name==="AskUserQuestion",h=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 ${f?"bg-cc-primary/10 border border-cc-primary/20":"bg-cc-warning/10 border border-cc-warning/20"}`,children:f?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 ${f?"text-cc-primary":"text-cc-warning"}`,children:f?"Question":"Permission Request"}),!f&&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})]}),f?l.jsx(hL,{input:e.input,onSelect:p=>o({...e.input,answers:p}),disabled:n}):l.jsx(dL,{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&&!f&&l.jsx(uL,{validation:e.ai_validation}),!f&&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"]}),h==null?void 0:h.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"})}),aL(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 cL(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 uL({validation:e}){const t=e.verdict==="uncertain"&&cL(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 dL({toolName:e,input:t,description:n}){return e==="Bash"?l.jsx(fL,{input:t}):e==="Edit"?l.jsx(pL,{input:t}):e==="Write"?l.jsx(mL,{input:t}):e==="Read"?l.jsx(gL,{input:t}):e==="Glob"?l.jsx(xL,{input:t}):e==="Grep"?l.jsx(vL,{input:t}):e==="ExitPlanMode"?l.jsx(bL,{input:t}):l.jsx(aS,{input:t,description:n})}function fL({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 hL({input:e,onSelect:t,disabled:n}){const r=Array.isArray(e.questions)?e.questions:[],[a,o]=k.useState({}),[u,f]=k.useState({}),[h,p]=k.useState({});function m(N){return lL(r,N)}function x(N,S){const E=String(N);o(C=>({...C,[E]:S})),p(C=>({...C,[E]:!1})),r.length<=1&&t(m({[E]:S}))}function b(N){var C;const S=String(N),E=(C=u[S])==null?void 0:C.trim();E&&(o(O=>({...O,[S]:E})),r.length<=1&&t(m({[S]:E})))}function y(N,S){const E=String(N);f(O=>({...O,[E]:S}));const C=S.trim();o(O=>{if(!C){const D={...O};return delete D[E],D}return{...O,[E]:C}})}function _(N){const S=String(N);p(E=>{const C=!!E[S],O={...E,[S]:!C};return C&&(o(D=>{const L={...D};return delete L[S],L}),f(D=>{const L={...D};return delete L[S],L})),O})}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(aS,{input:e})}return l.jsxs("div",{className:"space-y-3",children:[r.map((N,S)=>{const E=typeof N.header=="string"?N.header:"",C=typeof N.question=="string"?N.question:"",O=Array.isArray(N.options)?N.options:[],D=String(S),L=a[D],I=h[D];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}),O.length>0&&l.jsxs("div",{className:"space-y-1.5",children:[O.map((F,W)=>{const z=typeof F.label=="string"?F.label:String(F),q=typeof F.description=="string"?F.description:"",A=L===z;return l.jsx("button",{onClick:()=>x(S,z),disabled:n,className:`w-full text-left px-3 py-2 rounded-lg border transition-all cursor-pointer disabled:opacity-50 ${A?"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 ${A?"border-cc-primary":"border-cc-muted/40"}`,children:A&&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:z}),q&&l.jsx("p",{className:"text-[11px] text-cc-muted mt-0.5 leading-snug",children:q})]})]})},W)}),l.jsx("button",{onClick:()=>_(S),disabled:n,className:`w-full text-left px-3 py-2 rounded-lg border transition-all cursor-pointer disabled:opacity-50 ${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[D]||"",onChange:F=>y(S,F.target.value),onKeyDown:F=>{F.key==="Enter"&&b(S)},placeholder:"Type your answer...",className:"w-full px-2.5 py-1.5 text-xs bg-cc-input-bg border border-cc-border rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/50",autoFocus:!0}),r.length<=1&&l.jsx("p",{className:"mt-1 text-[10px] text-cc-muted",children:"Press Enter to submit"})]})]})]},S)}),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 pL({input:e}){const t=String(e.file_path||""),n=String(e.old_string||""),r=String(e.new_string||"");return l.jsx(Vl,{oldText:n,newText:r,fileName:t,mode:"compact"})}function mL({input:e}){const t=String(e.file_path||""),n=String(e.content||"");return l.jsx(Vl,{newText:n,fileName:t,mode:"compact"})}function gL({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 xL({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 vL({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 bL({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($x,{remarkPlugins:[Hx],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("code",{className:"px-1.5 py-0.5 rounded-md bg-cc-fg/[0.06] text-cc-code-fg font-mono-code text-[12px]",children: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 aS({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 yL({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 f=n.input.command;u=f.length>60?f.slice(0,60)+"...":f}else(n.tool_name==="Read"||n.tool_name==="Write"||n.tool_name==="Edit")&&typeof n.input.file_path=="string"?u=`${n.tool_name} ${n.input.file_path}`:n.tool_name==="Glob"&&typeof n.input.pattern=="string"?u=`Glob ${n.input.pattern}`:n.tool_name==="Grep"&&typeof n.input.pattern=="string"&&(u=`Grep ${n.input.pattern}`);return 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 _L=[],wL=[],C5="activity-tray-panel";function kL(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 SL(e,t,n=4e3){const[r,a]=k.useState(!1),o=k.useRef(void 0),u=e.length+t.length,f=u>0&&e.every(h=>h.status==="completed")&&t.every(h=>h.status!=="running");return k.useEffect(()=>(clearTimeout(o.current),f?o.current=setTimeout(()=>a(!0),n):a(!1),()=>clearTimeout(o.current)),[f,n]),k.useEffect(()=>{a(!1)},[u]),r}function jL(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 NL({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 CL({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(NL,{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:kL(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 EL({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 TL({sessionId:e}){const[t,n]=k.useState(!1),r=k.useRef(null),a=k.useRef(null),o=Y(C=>C.sessionTasks.get(e)??_L),u=Y(C=>C.sessionBackgroundAgents.get(e)??wL),f=SL(o,u),h=u.some(C=>C.status==="running"),p=jL(h),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=O=>{O.key==="Escape"&&(O.stopPropagation(),N())};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[t,N]),k.useEffect(()=>{if(!t)return;const C=O=>{r.current&&!r.current.contains(O.target)&&N()};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[t,N]),k.useEffect(()=>{t&&a.current&&a.current.focus()},[t]);const[S,E]=k.useState(!1);return k.useEffect(()=>{_&&E(!1)},[_,o.length,u.length]),!_||S?null:l.jsxs("div",{ref:r,className:`absolute bottom-3 right-3 z-20 transition-opacity duration-500 ${f?"opacity-0 pointer-events-none":"opacity-100"}`,style:f?void 0:{animation:"fadeSlideIn 0.3s ease-out"},onTransitionEnd:()=>{f&&E(!0)},children:[t&&l.jsxs("div",{ref:a,id:C5,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(CL,{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(EL,{task:C},C.id))]})]}),l.jsxs("button",{type:"button",onClick:()=>n(!t),"aria-expanded":t,"aria-controls":C5,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 AL({sessionId:e}){const t=Y(_=>_.pendingPermissions.get(e)),n=Y(_=>_.aiResolvedPermissions.get(e)),r=Y(_=>_.clearAiResolvedPermissions),a=Y(_=>_.connectionStatus.get(e)??"disconnected"),o=Y(_=>_.cliConnected.get(e)??!1),u=Y(_=>_.cliReconnecting.get(e)??!1),f=Y(_=>_.setCliReconnecting),[h,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),f(e,!0);try{await Ne.relaunchSession(e)}catch(_){Fs(_),f(e,!1);const j=_ instanceof Error?_.message:"Reconnection failed";p(j),m.current=setTimeout(()=>p(null),4e3)}},[e,f]),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:h?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:h}),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(ZR,{sessionId:e}),l.jsx(TL,{sessionId:e})]}),n&&n.length>0&&l.jsx("div",{className:"shrink-0 border-t border-cc-border bg-cc-card",children:l.jsx(yL,{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(oL,{permission:_,sessionId:e},_.request_id))}),l.jsx(sL,{sessionId:e})]})}function ML({sessionId:e}){const[t,n]=k.useState(!1),r=k.useRef(null),a=Y(p=>p.sessions.get(e)),o=(a==null?void 0:a.aiValidationEnabled)??!1,u=(a==null?void 0:a.aiValidationAutoApprove)??!0,f=(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 h(p,m){const x=!m,b={[p]:x};Y.getState().setSessionAiValidation(e,b),s3(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:()=>h("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:()=>h("aiValidationAutoApprove",u),className:"w-full flex items-center justify-between px-2 py-1.5 rounded-md hover:bg-cc-hover text-cc-fg transition-colors cursor-pointer","aria-label":"Toggle auto-approve safe tools",children:[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:()=>h("aiValidationAutoDeny",f),className:"w-full flex items-center justify-between px-2 py-1.5 rounded-md hover:bg-cc-hover text-cc-fg transition-colors cursor-pointer","aria-label":"Toggle auto-deny dangerous tools",children:[l.jsx("span",{className:"text-xs",children:"Auto-deny dangerous"}),l.jsx("span",{className:`text-[10px] font-medium ${f?"text-cc-success":"text-cc-muted"}`,children:f?"On":"Off"})]})]})]})]})}function RL({sessionId:e}){const[t,n]=k.useState(!1),[r,a]=k.useState(null),[o,u]=k.useState(!1),f=k.useRef(null);k.useEffect(()=>{if(!t)return;const p=x=>{f.current&&!f.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 h=k.useCallback(async p=>{a(p),u(!1);try{const{blob:m,filename:x}=await Ne.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){Fs(m),u(!0)}finally{a(null)}},[e]);return l.jsxs("div",{ref:f,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:()=>h("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:()=>h("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 LL({sessionId:e}){const t=Y(m=>m.density),n=Y(m=>m.magicUiAvailable),r=Y(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=Y.getState();((x=m.sessions.get(e))==null?void 0:x.magicUiActive)===!0&&(m.setSessionMagicUi(e,!1),ty(e,!1))},[e]),o=k.useCallback(()=>{Y.getState().setDensity("standard"),a()},[a]),u=k.useCallback(()=>{Y.getState().setDensity("compact"),a()},[a]),f=k.useCallback(()=>{e&&(Y.getState().setSessionMagicUi(e,!0),ty(e,!0))},[e]);if(!n||!e)return l.jsx(DL,{});const h=t==="compact",p=[{key:"standard",label:"Standard view",active:!r&&!h,onClick:o,icon:l.jsx(lS,{})},{key:"compact",label:"Compact view",active:!r&&h,onClick:u,icon:l.jsx(oS,{})},{key:"magic",label:"Magic dashboard view",active:r,onClick:f,icon:l.jsx(zL,{})}];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 DL(){const e=Y(a=>a.density),t=k.useCallback(()=>Y.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(oS,{}):l.jsx(lS,{})})}function lS(){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 oS(){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 zL(){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 OL(){var I;const e=k.useSyncExternalStore(F=>(window.addEventListener("hashchange",F),()=>window.removeEventListener("hashchange",F)),()=>window.location.hash),t=k.useMemo(()=>wx(e),[e]),n=t.page==="session"||t.page==="home",r=Y(F=>F.currentSessionId),a=Y(F=>F.cliConnected),o=Y(F=>F.sessionStatus),u=Y(F=>F.sessionNames),f=Y(F=>F.sdkSessions),h=Y(F=>F.sidebarOpen),p=Y(F=>F.setSidebarOpen),m=Y(F=>F.taskPanelOpen),x=Y(F=>F.setTaskPanelOpen),b=Y(F=>F.activeTab),y=Y(F=>F.setActiveTab),_=Y(F=>F.markChatTabReentry),j=Y(F=>r?F.gitChangedFilesCount.get(r)??0:0),N=r?o.get(r)??null:null,S=r?a.get(r)??!1:!1,E=r?(u==null?void 0:u.get(r))||((I=f.find(F=>F.sessionId===r))==null?void 0:I.name)||`Session ${r.slice(0,8)}`:null,C=!!(r&&n),O=t.page==="session"&&!!r,D=["chat","diff"],L=F=>{F==="chat"&&b!=="chat"&&r&&_(r),y(F)};return k.useEffect(()=>{const F=W=>{if(!(W.metaKey||W.ctrlKey)||W.key.toLowerCase()!=="j"||!C)return;const z=W.target;if(z&&(z.tagName==="TEXTAREA"||z.tagName==="INPUT"||z.isContentEditable))return;W.preventDefault();const q=Math.max(0,D.indexOf(b)),A=W.shiftKey?-1:1,ie=(q+A+D.length)%D.length;L(D[ie])};return window.addEventListener("keydown",F),()=>window.removeEventListener("keydown",F)},[C,D,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(!h),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer shrink-0 ${h?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,"aria-label":"Toggle sidebar",children: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:()=>L("chat"),className:`h-full px-3 text-[12px] font-medium transition-colors cursor-pointer flex items-center gap-1.5 border-b-[1.5px] shrink-0 ${b==="chat"?"text-cc-fg border-cc-primary":"text-cc-muted hover:text-cc-fg border-transparent"}`,title:E||"Session","aria-label":"Session tab",children:[l.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${S?N==="running"?"bg-cc-primary":N==="compacting"?"bg-cc-warning":"bg-cc-success":"bg-cc-muted opacity-45"}`}),"Session"]}),l.jsxs("button",{onClick:()=>L("diff"),className:`h-full px-3 text-[12px] font-medium transition-colors cursor-pointer flex items-center gap-1.5 border-b-[1.5px] shrink-0 ${b==="diff"?"text-cc-fg border-cc-primary":"text-cc-muted hover:text-cc-fg border-transparent"}`,"aria-label":"Diffs tab",children:["Diffs",j>0&&l.jsx("span",{className:"text-[9px] rounded-full min-w-[15px] h-[15px] px-1 flex items-center justify-center font-semibold leading-none bg-amber-100 text-amber-700 dark:bg-amber-900/60 dark:text-amber-300",children:j})]})]}),l.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[C&&r&&l.jsx(ML,{sessionId:r}),C&&r&&l.jsx(RL,{sessionId:r}),C&&l.jsx(LL,{sessionId:r??null}),l.jsx(BL,{}),O&&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 BL(){const e=Y(n=>n.darkMode),t=k.useCallback(()=>Y.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 cS="cc-recent-dirs";function jf(){try{return JSON.parse(localStorage.getItem(cS)||"[]")}catch{return[]}}function uS(e){const t=jf().filter(n=>n!==e);t.unshift(e),localStorage.setItem(cS,JSON.stringify(t.slice(0,5)))}function PL(){return!1}function dS({onClose:e,embedded:t=!1}){const[n,r]=k.useState([]),[a,o]=k.useState(!0),[u,f]=k.useState(null),[h,p]=k.useState(""),[m,x]=k.useState([]),[b,y]=k.useState(""),[_,j]=k.useState(!1),[N,S]=k.useState(""),[E,C]=k.useState([{key:"",value:""}]),[O,D]=k.useState(!1),L=k.useCallback(()=>{Ne.listEnvs().then(r).catch(()=>{}).finally(()=>o(!1))},[]);k.useEffect(()=>{L()},[L]);function I(G){f(G.slug),p(G.name);const P=Object.entries(G.variables).map(([$,se])=>({key:$,value:se}));P.length===0&&P.push({key:"",value:""}),x(P),y("")}function F(){f(null),y("")}async function W(){if(!u)return;const G={};for(const P of m){const $=P.key.trim();$&&(G[$]=P.value)}try{await Ne.updateEnv(u,{name:h.trim()||void 0,variables:G}),f(null),y(""),L()}catch(P){y(P instanceof Error?P.message:String(P))}}async function z(G){try{await Ne.deleteEnv(G),u===G&&f(null),L()}catch(P){y(P instanceof Error?P.message:String(P))}}async function q(){const G=N.trim();if(!G)return;D(!0);const P={};for(const $ of E){const se=$.key.trim();se&&(P[se]=$.value)}try{await Ne.createEnv(G,P),S(""),C([{key:"",value:""}]),j(!1),y(""),L()}catch($){y($ instanceof Error?$.message:String($))}finally{D(!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:G=>S(G.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:G=>{G.key==="Enter"&&N.trim()&&q()}}),l.jsx(Md,{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()||O,className:`px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${N.trim()&&!O?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:O?"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(G=>{const P=u===G.slug,$=Object.keys(G.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:h,onChange:se=>p(se.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(Md,{rows:m,onChange:x})]})}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("button",{onClick:F,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 W(),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"})]})]},G.slug):l.jsx($L,{env:G,varCount:$,onStartEdit:()=>I(G),onDelete:()=>void z(G.slug)},G.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 A=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:G=>S(G.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:G=>{G.key==="Enter"&&N.trim()&&q()}}),l.jsx(Md,{rows:E,onChange:C}),l.jsx("button",{onClick:q,disabled:!N.trim()||O,className:`px-4 py-2.5 min-h-[44px] text-sm font-medium rounded-lg transition-colors ${N.trim()&&!O?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:O?"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(G=>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:G.name}),l.jsxs("span",{className:"text-xs text-cc-muted",children:[Object.keys(G.variables).length," var",Object.keys(G.variables).length!==1?"s":""]}),u===G.slug?l.jsx("button",{onClick:F,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(G),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:()=>z(G.slug),className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-error cursor-pointer",children:"Delete"})]})]}),u===G.slug&&l.jsxs("div",{className:"px-3 py-3 space-y-2",children:[l.jsx("input",{type:"text",value:h,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(Md,{rows:m,onChange:x})]})}),l.jsx("button",{onClick:W,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!==G.slug&&Object.keys(G.variables).length>0&&l.jsx("div",{className:"px-3 py-2.5 space-y-1",children:Object.entries(G.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))})]},G.slug))}),K=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:G=>G.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,A]})]});return Yl.createPortal(l.jsx("div",{className:"fixed inset-0 z-50 flex items-end sm:items-center justify-center bg-black/50",onClick:e,children:K}),document.body)}function $L({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 Md({rows:e,onChange:t}){function n(o,u,f){const h=[...e];h[o]={...h[o],[u]:f},t(h)}function r(o){const u=e.filter((f,h)=>h!==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:f=>n(u,"key",f.target.value),placeholder:"KEY",className:"flex-1 min-w-0 px-3 py-2.5 min-h-[44px] text-xs font-mono-code bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),l.jsx("span",{className:"text-[10px] text-cc-muted",children:"="}),l.jsx("input",{type:"text",value:o.value,onChange:f=>n(u,"value",f.target.value),placeholder:"value",className:"flex-1 min-w-0 px-3 py-2.5 min-h-[44px] text-xs font-mono-code bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),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 FL=Object.freeze(Object.defineProperty({__proto__:null,EnvManager:dS},Symbol.toStringTag,{value:"Module"}));function UL(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 qL({initialPath:e,onSelect:t,onClose:n}){const[r,a]=k.useState(""),[o,u]=k.useState([]),[f,h]=k.useState(!0),[p,m]=k.useState(""),[x,b]=k.useState(""),[y,_]=k.useState(!1),[j,N]=k.useState(""),[S,E]=k.useState(-1),[C,O]=k.useState(!1),[D,L]=k.useState(()=>jf()),I=k.useRef(null),F=k.useRef(null),W=k.useRef(null),z=k.useRef(new Map),q=k.useMemo(()=>{if(!j)return o;const $=j.toLowerCase();return o.filter(se=>se.name.toLowerCase().includes($))},[o,j]),A=k.useCallback(async $=>{h(!0),m(""),N(""),E(-1);try{const se=await Ne.listDirs($);a(se.path),u(se.dirs)}catch{m("Could not load directory"),u([])}finally{h(!1)}},[]);k.useEffect(()=>{A(e||void 0)},[]),k.useEffect(()=>{const $=I.current;if(!$)return;function se(R){if(R.key!=="Tab")return;const B=$.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(B.length===0)return;const Z=B[0],M=B[B.length-1];R.shiftKey&&document.activeElement===Z?(R.preventDefault(),M.focus()):!R.shiftKey&&document.activeElement===M&&(R.preventDefault(),Z.focus())}document.addEventListener("keydown",se);const ae=setTimeout(()=>{var R;(R=W.current)==null||R.focus()},80);return()=>{document.removeEventListener("keydown",se),clearTimeout(ae)}},[]);const ie=k.useCallback(()=>{C||(O(!0),setTimeout(n,150))},[n,C]);k.useEffect(()=>{function $(se){if(se.key==="Escape"){if(y)return;ie()}}return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[y,ie]),k.useEffect(()=>{function $(se){var R,B;if(y)return;if(se.key==="Backspace"&&document.activeElement!==W.current){if(r&&r!=="/"){se.preventDefault();const Z=r.split("/").slice(0,-1).join("/")||"/";A(Z)}return}const ae=q.length;if(ae!==0){if(se.key==="ArrowDown"){se.preventDefault();const Z=S<ae-1?S+1:0;E(Z),(R=z.current.get(Z))==null||R.focus()}else if(se.key==="ArrowUp"){se.preventDefault();const Z=S>0?S-1:ae-1;E(Z),(B=z.current.get(Z))==null||B.focus()}}}return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[y,q.length,S,r,A]),k.useEffect(()=>{var $;S>=0&&(($=z.current.get(S))==null||$.scrollIntoView({block:"nearest"}))},[S]);function K($){uS($),L(jf()),t($),n()}const G=UL(r),P=r.split("/").pop()||"/";return Yl.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"})})})]}),D.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:D.map($=>l.jsx("li",{children:l.jsxs("button",{type:"button",onClick:()=>K($),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()&&K(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:G.map(($,se)=>{const ae=se===G.length-1;return l.jsxs("span",{className:"flex items-center gap-0.5 shrink-0",children:[se>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||A($.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:W,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:()=>K(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:F,className:"flex-1 min-h-0 overflow-y-auto","aria-label":"Subdirectories",children:f?l.jsx("div",{className:"px-4 py-2 space-y-1","aria-busy":"true","aria-label":"Loading directories",children:Array.from({length:6}).map(($,se)=>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+se*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 ${se*.1}s infinite`}})]},se))}):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:()=>A(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(($,se)=>l.jsxs("li",{className:`flex items-center transition-colors ${S===se?"bg-cc-hover":"hover:bg-cc-hover"}`,children:[l.jsxs("button",{type:"button",ref:ae=>{ae?z.current.set(se,ae):z.current.delete(se)},onClick:()=>A($.path),onKeyDown:ae=>{ae.key==="Enter"&&(ae.preventDefault(),K($.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:()=>K($.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 HL(e,t){const n=t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,60);return`${e.toLowerCase()}-${n}`}function IL(e){return e.branchName&&e.branchName.trim()?e.branchName.trim():HL(e.identifier,e.title)}function Sc({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 VL({defaultProjectId:e,connectionId:t,onCreated:n,onClose:r}){const[a,o]=k.useState(""),[u,f]=k.useState(""),[h,p]=k.useState(""),[m,x]=k.useState(0),[b,y]=k.useState(!0),[_,j]=k.useState([]),[N,S]=k.useState(""),[E,C]=k.useState(""),[O,D]=k.useState(!0),[L,I]=k.useState(!1),[F,W]=k.useState("");k.useEffect(()=>{let q=!0;return Promise.all([Ne.getLinearStates(t),Ne.getLinearConnection(t)]).then(([A,ie])=>{var G;if(!q)return;j(A.teams),S(ie.viewerId);const K=((G=A.teams[0])==null?void 0:G.id)||"";p(K)}).catch(A=>{q&&W(A instanceof Error?A.message:"Failed to load teams")}).finally(()=>{q&&D(!1)}),()=>{q=!1}},[t]),k.useEffect(()=>{if(!h||_.length===0){C("");return}const q=_.find(ie=>ie.id===h),A=q==null?void 0:q.states.find(ie=>ie.type==="backlog");C((A==null?void 0:A.id)||"")},[h,_]);async function z(){if(!(!a.trim()||!h)){I(!0),W("");try{const q=await Ne.createLinearIssue({title:a.trim(),description:u.trim()||void 0,teamId:h,priority:m,projectId:e||void 0,assigneeId:b&&N?N:void 0,stateId:E||void 0,connectionId:t});n(q.issue)}catch(q){W(q instanceof Error?q.message:"Failed to create issue")}finally{I(!1)}}}return Yl.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"})})})]}),F&&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:F}),O?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()&&h&&!L&&z()},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=>f(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:h,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:z,disabled:!a.trim()||!h||L,className:"flex-1 px-3 py-2 text-xs font-medium rounded-lg bg-cc-primary text-white hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors cursor-pointer",children:L?"Creating...":"Create Issue"})]})]})]})}),document.body)}function GL({cwd:e,gitRepoInfo:t,linearConfigured:n,selectedLinearIssue:r,onIssueSelect:a,onBranchFromIssue:o,onConnectionSelect:u}){const[f,h]=k.useState([]),[p,m]=k.useState(null),[x,b]=k.useState(!1),[y,_]=k.useState(""),[j,N]=k.useState([]),[S,E]=k.useState(!1),[C,O]=k.useState(!1),[D,L]=k.useState(""),[I,F]=k.useState(!1),[W,z]=k.useState(null),[q,A]=k.useState([]),[ie,K]=k.useState(!1),[G,P]=k.useState(""),[$,se]=k.useState(!1),[ae,R]=k.useState([]),[B,Z]=k.useState(!1),[M,pe]=k.useState(""),[_e,Ce]=k.useState(!1),[De,Ee]=k.useState([]),[Be,Je]=k.useState(!1),[Et,ft]=k.useState(!1),vt=k.useRef(null);k.useEffect(()=>{function je(ze){vt.current&&!vt.current.contains(ze.target)&&(E(!1),se(!1))}return document.addEventListener("pointerdown",je),()=>document.removeEventListener("pointerdown",je)},[]),k.useEffect(()=>{if(!n){h([]),m(null),b(!1),u(null);return}let je=!0;return Ne.listLinearConnections().then(({connections:ze})=>{je&&(h(ze),b(!0),ze.length>0?(m(ze[0].id),u(ze[0].id)):(m(null),u(null)))}).catch(()=>{je&&b(!0)}),()=>{je=!1}},[n]);const bt=k.useCallback(je=>{m(je),u(je),a(null),N([]),_(""),L(""),Ee([]),pe(""),R([]),W&&(K(!0),P(""),Ne.getLinearProjectIssues(W.projectId,10,je).then(({issues:ze})=>{A(ze)}).catch(ze=>{P(ze instanceof Error?ze.message:String(ze))}).finally(()=>{K(!1)}))},[W,u,a]);k.useEffect(()=>{if(!t||!n){z(null),A([]);return}let je=!0;return K(!0),P(""),(async()=>{try{const{mapping:ze}=await Ne.getLinearProjectMapping(t.repoRoot);if(!je)return;if(z(ze),ze){const{issues:pt}=await Ne.getLinearProjectIssues(ze.projectId,10,p??void 0);if(!je)return;A(pt)}else A([])}catch(ze){if(!je)return;P(ze instanceof Error?ze.message:String(ze))}finally{je&&K(!1)}})(),()=>{je=!1}},[t,n,p]),k.useEffect(()=>{if(!n)return;const je=y.trim();if(je.length<2){N([]),L(""),O(!1);return}let ze=!0;O(!0),L("");const pt=setTimeout(()=>{Ne.searchLinearIssues(je,8,p??void 0).then(Te=>{ze&&N(Te.issues)}).catch(Te=>{ze&&(N([]),L(Te instanceof Error?Te.message:String(Te)))}).finally(()=>{ze&&O(!1)})},400);return()=>{ze=!1,clearTimeout(pt)}},[n,y,p]),k.useEffect(()=>{if(!n||!_e){Ee([]),Je(!1);return}const je=M.trim();if(je.length<2){Ee([]),Je(!1);return}let ze=!0;Je(!0);const pt=setTimeout(()=>{Ne.searchLinearIssues(je,10,p??void 0).then(Te=>{ze&&Ee(Te.issues)}).catch(()=>{ze&&Ee([])}).finally(()=>{ze&&Je(!1)})},400);return()=>{ze=!1,clearTimeout(pt)}},[n,_e,M,p]);function wt(je,ze=!1){a(je),_(`${je.identifier} - ${je.title}`);const pt=IL(je);o(pt,!0),ze&&E(!1)}function Tt(){a(null),_(""),N([]),L("")}async function ve(je){if(t)try{const{mapping:ze}=await Ne.upsertLinearProjectMapping({repoRoot:t.repoRoot,projectId:je.id,projectName:je.name});z(ze),se(!1),K(!0),P("");const{issues:pt}=await Ne.getLinearProjectIssues(je.id,10,p??void 0);A(pt)}catch(ze){P(ze instanceof Error?ze.message:String(ze))}finally{K(!1)}}async function $e(){if(t){try{await Ne.removeLinearProjectMapping(t.repoRoot)}catch{}z(null),A([]),a(null),_("")}}function rt(){if(!n){window.location.hash="#/integrations/linear";return}se(!0),ae.length===0&&(Z(!0),Ne.listLinearProjects(p??void 0).then(({projects:je})=>R(je)).catch(()=>{}).finally(()=>Z(!1)))}function rn(je){ft(!1),wt(je),W&&(K(!0),Ne.getLinearProjectIssues(W.projectId,10,p??void 0).then(({issues:ze})=>A(ze)).catch(()=>{}).finally(()=>K(!1)))}return n?l.jsxs("aside",{className:"space-y-2 mt-0.5",ref:vt,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&&f.length>1&&l.jsx("select",{value:p??"",onChange:je=>bt(je.target.value),className:"px-1.5 py-1 rounded-md text-[11px] bg-cc-input-bg border border-cc-border text-cc-fg focus:outline-none focus:border-cc-primary/60 cursor-pointer max-w-[140px] truncate",title:"Select Linear workspace",children:f.map(je=>l.jsx("option",{value:je.id,children:je.workspaceName||je.name},je.id))}),W?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(Sc,{className:"w-3.5 h-3.5"}),l.jsx("span",{children:W.projectName}),l.jsx("button",{type:"button",onClick:$e,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:()=>ft(!0),className:"inline-flex items-center gap-1 px-2 py-1.5 rounded-lg text-[11px] border border-dashed border-cc-border text-cc-muted hover:text-cc-fg hover:border-cc-primary/40 transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),l.jsx("span",{children:"Create issue"})]})]}):l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button","aria-expanded":S,onClick:()=>{if(!n){window.location.hash="#/integrations/linear";return}E(!S)},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(Sc,{className:"w-3.5 h-3.5"}),l.jsx("span",{children:"Linear"})]}),n&&t&&l.jsxs("button",{type:"button",onClick:rt,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:()=>ft(!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."})]})]}),W&&(()=>{const je=M.trim().toLowerCase(),ze=!_e&&je?q.filter(Te=>Te.identifier.toLowerCase().includes(je)||Te.title.toLowerCase().includes(je)):_e?[]:q,pt=_e?De:ze;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:Tt,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:M,onChange:Te=>pe(Te.target.value),placeholder:_e?"Search all projects...":"Filter issues...",className:"w-full px-2 py-1.5 text-xs bg-cc-input-bg border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60"}),ie?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Loading recent issues..."}):G?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-error",children:G}):Be?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Searching..."}):_e&&je.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..."}):pt.length===0?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:je?"No matching issues":"No active issues found"}):l.jsx("div",{className:"max-h-56 overflow-y-auto -mx-0.5 mt-1",children:pt.map(Te=>l.jsxs("button",{type:"button",onClick:()=>wt(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:_e,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:()=>se(!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(je=>l.jsx("button",{type:"button",onClick:()=>ve(je),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:je.name})},je.id))})]}),S&&n&&l.jsxs("div",{className:"absolute left-2.5 right-2.5 top-[44px] bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-20 overflow-hidden",children:[l.jsxs("div",{className:"p-2 border-b border-cc-border",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("input",{type:"text",value:y,onChange:je=>{_(je.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&&D&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-error",children:D}),y.trim().length>=2&&!C&&!D&&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&&!D&&l.jsx("div",{className:"max-h-56 overflow-y-auto",children:j.map(je=>l.jsxs("button",{type:"button",onClick:()=>wt(je,!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:je.identifier})," - ",je.title]}),l.jsx("div",{className:"text-[10px] text-cc-muted truncate",children:[je.stateName,je.teamName].filter(Boolean).join(" • ")})]},je.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:()=>{F(!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"})})]}),Et&&l.jsx(VL,{defaultProjectId:W==null?void 0:W.projectId,connectionId:p??void 0,onCreated:rn,onClose:()=>ft(!1)})]}):null}function YL({cwd:e,gitRepoInfo:t,selectedBranch:n,isNewBranch:r,useWorktree:a,onBranchChange:o,onWorktreeChange:u,onBranchesLoaded:f}){const[h,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?Ne.listBranches(t.repoRoot).then(j=>{p(j),f(j)}).catch(()=>{p([]),f([])}):(p([]),f([]))},[t]),t?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"relative",ref:_,children:[l.jsxs("button",{"aria-expanded":m,onClick:()=>{!m&&t&&Ne.gitFetch(t.repoRoot).catch(()=>{}).finally(()=>{Ne.listBranches(t.repoRoot).then(j=>{p(j),f(j)}).catch(()=>{p([]),f([])})}),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=h.filter(O=>!O.isRemote&&(!j||O.name.toLowerCase().includes(j))),S=h.filter(O=>O.isRemote&&(!j||O.name.toLowerCase().includes(j))),E=h.some(O=>O.name.toLowerCase()===j),C=N.length>0||S.length>0;return l.jsxs(l.Fragment,{children:[N.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"px-3 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:"Local"}),N.map(O=>l.jsxs("button",{onClick:()=>{o(O.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 ${O.name===n?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{className:"truncate font-mono-code",children:O.name}),l.jsxs("span",{className:"ml-auto flex items-center gap-1.5 shrink-0",children:[O.ahead>0&&l.jsxs("span",{className:"text-[9px] text-green-500",children:[O.ahead,"↑"]}),O.behind>0&&l.jsxs("span",{className:"text-[9px] text-amber-500",children:[O.behind,"↓"]}),O.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"}),O.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"})]})]},O.name))]}),S.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"px-3 py-1 text-[10px] text-cc-muted uppercase tracking-wider mt-1",children:"Remote"}),S.map(O=>l.jsxs("button",{onClick:()=>{o(O.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 ${O.name===n?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{className:"truncate font-mono-code",children:O.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-${O.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 WL=336*60*60*1e3,va=12,QL=24;function Zg(e){return e.split("/").filter(Boolean).pop()||e}function E5(e){var t,n;return((t=e.name)==null?void 0:t.trim())||((n=e.slug)==null?void 0:n.trim())||Zg(e.cwd)}function XL(e){return e.length>8?e.slice(0,8):e}function KL(e,t=2){const n=e.split("/").filter(Boolean);return n.length<=t?e:`.../${n.slice(-t).join("/")}`}function ZL(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 JL(){var os;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")||""),[f,h]=k.useState(""),[p,m]=k.useState(()=>localStorage.getItem("cc-backend")||"claude"),[x,b]=k.useState([]),[y,_]=k.useState(()=>_5(localStorage.getItem("cc-backend")||"claude")),[j,N]=k.useState(()=>w5(localStorage.getItem("cc-backend")||"claude")),[S,E]=k.useState(()=>localStorage.getItem("cc-effort")||""),[C,O]=k.useState(()=>jf()[0]||""),[D,L]=k.useState([]),[I,F]=k.useState(null),[W,z]=k.useState(!1),[q,A]=k.useState(""),[ie,K]=k.useState(null),[G,P]=k.useState(!1),[$,se]=k.useState(null),[ae,R]=k.useState(null),[B,Z]=k.useState(()=>localStorage.getItem("cc-onboarding-dismissed")!=="true"),M=ie||rS(p),pe=y5(p),_e=rL(p),[Ce,De]=k.useState([]),[Ee,Be]=k.useState(()=>localStorage.getItem("cc-selected-env")||""),[Je,Et]=k.useState(!1),[ft,vt]=k.useState(!1),bt=PL(),[wt,Tt]=k.useState(()=>bt),[ve,$e]=k.useState([]),[rt,rn]=k.useState(()=>localStorage.getItem("cc-selected-sandbox")||""),[je,ze]=k.useState(!1),pt=k.useRef(null),[Te,Hr]=k.useState(null),oe=k.useRef(null),we=k.useRef(null),[Q,me]=k.useState(!1),[Re,Qe]=k.useState(!1),[it,st]=k.useState(!1),[jt,yn]=k.useState(!1),[et,cr]=k.useState(!1),[Ln,ti]=k.useState(""),[Ir,Vr]=k.useState(!0),[te,xe]=k.useState([]),[be,Xe]=k.useState(!1),[Ht,hn]=k.useState(""),[Dn,It]=k.useState(!1),[Un,Sr]=k.useState(va),[Da,Xl]=k.useState(""),[qn,Hs]=k.useState(null),[Kl,Zl]=k.useState(!1),[jr,Zt]=k.useState(""),[Nn,ur]=k.useState(!1),[Jl,Of]=k.useState([]),[Is,Vs]=k.useState(null),[ni,ts]=k.useState(!1),[wi,Xn]=k.useState(""),[Gs,ri]=k.useState(0),tn=k.useRef(null),Kn=k.useRef(null),za=k.useRef(null),Gr=k.useRef(null),ii=k.useRef(null),eo=k.useRef(null),to=Y(H=>H.currentSessionId),nn=sS({text:e,caretPos:Gs,cwd:C||void 0});k.useEffect(()=>{if(tn.current===null||!Kn.current)return;const H=tn.current;Kn.current.setSelectionRange(H,H),tn.current=null},[e]),k.useEffect(()=>{var he;window.matchMedia("(min-width: 640px)").matches&&((he=Kn.current)==null||he.focus())},[]),k.useEffect(()=>{Ne.getHome().then(({home:H,cwd:he})=>{C||O(he||H)}).catch(()=>{}),Ne.listEnvs().then(De).catch(()=>{}),Ne.listSandboxes().then($e).catch(()=>{}),Ne.getBackends().then(b).catch(()=>{}),Ne.getSettings().then(H=>{P(H.linearApiKeyConfigured)}).catch(()=>{})},[]);function Bf(H){m(H),localStorage.setItem("cc-backend",H),K(null),_(_5(H)),N(w5(H)),H!=="claude"&&(cr(!1),xe([]),hn(""),Xe(!1),It(!1),Sr(va),Xl(""))}k.useEffect(()=>{if(p!=="codex"){K(null);return}Ne.getBackendModels(p).then(H=>{if(H.length>0){const he=tL(H);K(he),he.some(Ke=>Ke.value===y)||_(he[0].value)}}).catch(()=>{})},[p]),k.useEffect(()=>{if(oe.current&&(clearInterval(oe.current),oe.current=null),Hr(null),!wt)return;const H="the-companion:latest",he=()=>{Ne.getImageStatus(H).then(Ke=>{Hr(Ke),Ke.status==="idle"&&Ne.pullImage(H).catch(()=>{}),(Ke.status==="ready"||Ke.status==="error")&&oe.current&&(clearInterval(oe.current),oe.current=null)}).catch(()=>{})};return he(),oe.current=setInterval(he,2e3),()=>{oe.current&&(clearInterval(oe.current),oe.current=null)}},[wt]),k.useEffect(()=>{function H(he){za.current&&!za.current.contains(he.target)&&me(!1),Gr.current&&!Gr.current.contains(he.target)&&Qe(!1),ii.current&&!ii.current.contains(he.target)&&st(!1),eo.current&&!eo.current.contains(he.target)&&Et(!1),pt.current&&!pt.current.contains(he.target)&&ze(!1)}return document.addEventListener("pointerdown",H),()=>document.removeEventListener("pointerdown",H)},[]),k.useEffect(()=>{if(!C){Hs(null);return}Ne.getRepoInfo(C).then(H=>{Hs(H),Zt(H.currentBranch),ur(!1)}).catch(()=>{Hs(null),Zt(""),ur(!1)})},[C]);const Ys=M.find(H=>H.value===y)||M[0],Oa=pe.find(H=>H.value===j)||pe[0],Yr=_e.find(H=>H.value===S)||_e[0],Zn=p==="codex"?"/logo-codex.svg":"/logo.svg",Gc=C?C.split("/").pop()||C:"Select folder",no=k.useMemo(()=>Ln.trim(),[Ln]),Ba=p==="claude"&&et&&no.length>0,si=k.useMemo(()=>{const H=Date.now()-WL;return te.filter(he=>he.createdAt>=H)},[te]),ns=k.useMemo(()=>Dn?te:si.length>0?si:te,[Dn,si,te]),Nr=k.useMemo(()=>Da.trim().toLowerCase(),[Da]),on=k.useMemo(()=>Nr?ns.filter(H=>{const he=E5(H).toLowerCase(),Ke=Zg(H.cwd).toLowerCase(),mt=(H.gitBranch||"").toLowerCase(),at=H.cwd.toLowerCase(),He=H.resumeSessionId.toLowerCase();return he.includes(Nr)||Ke.includes(Nr)||mt.includes(Nr)||at.includes(Nr)||He.includes(Nr)}):ns,[ns,Nr]),Ws=k.useMemo(()=>on.slice(0,Un),[on,Un]),Yc=Un<on.length,Pa=Math.max(0,te.length-si.length),rs=!Dn&&si.length>0,$a=k.useCallback(async()=>{if(p==="claude"){Xe(!0),hn("");try{const[H,he]=await Promise.all([Ne.listSessions(),Ne.discoverClaudeSessions(400).then(He=>He.sessions)]),Ke=new Map,mt=He=>{const Hn=Ke.get(He.resumeSessionId);(!Hn||He.createdAt>Hn.createdAt)&&Ke.set(He.resumeSessionId,He)};for(const He of H)He.backendType!=="codex"&&He.cliSessionId&&mt({resumeSessionId:He.cliSessionId,sessionId:He.sessionId,name:He.name,model:He.model,createdAt:He.createdAt,cwd:He.cwd,gitBranch:He.gitBranch,source:"companion"});for(const He of he)mt({resumeSessionId:He.sessionId,sessionId:He.sessionId,slug:He.slug,createdAt:He.lastActivityAt,cwd:He.cwd,gitBranch:He.gitBranch,source:"claude_disk"});const at=Array.from(Ke.values()).sort((He,Hn)=>{const _n=C&&He.cwd===C?0:1,Tr=C&&Hn.cwd===C?0:1;return _n!==Tr?_n-Tr:Hn.createdAt-He.createdAt});xe(at),It(!1),Sr(va)}catch(H){const he=H instanceof Error?H.message:String(H);hn(he||"Failed to load existing sessions"),xe([]),Sr(va)}finally{Xe(!1)}}},[p,C]);k.useEffect(()=>{p==="claude"&&et&&$a()},[p,et,$a]),k.useEffect(()=>{Sr(va)},[Nr,Dn]);async function ro(H){if(H.length===0)return;const he=[],Ke=[];let mt=D.reduce((at,He)=>at+He.size,0);for(const at of H){if(at.size>kf){Ke.push(`${at.name} is too large (${Os(at.size)}, max ${Os(kf)})`);continue}if(mt+at.size>Sf){Ke.push(`${at.name} would exceed the per-message limit (${Os(Sf)})`);continue}const{base64:He,mediaType:Hn}=await Ik(at);he.push({name:at.name,base64:He,mediaType:Hn,size:at.size}),mt+=at.size}he.length>0&&L(at=>[...at,...he]),F(Ke.length>0?Ke.join("; "):null)}async function is(H){const he=H.target.files;he&&(await ro(Array.from(he)),H.target.value="")}function Pf(H){L(he=>he.filter((Ke,mt)=>mt!==H))}async function Wc(H){var mt;const he=(mt=H.clipboardData)==null?void 0:mt.items;if(!he)return;const Ke=[];for(const at of Array.from(he)){if(at.kind!=="file")continue;const He=at.getAsFile();if(!He)continue;const Hn=He.name&&He.name.length>0?He.name:`pasted-${Date.now()}.${(He.type.split("/")[1]||"bin").replace(/[^a-zA-Z0-9]/g,"")}`;Ke.push(new File([He],Hn,{type:He.type,lastModified:He.lastModified}))}Ke.length>0&&(H.preventDefault(),await ro(Ke))}function Qc(H){t(H.target.value),ri(H.target.selectionStart??H.target.value.length);const he=H.target;he.style.height="auto",he.style.height=Math.min(he.scrollHeight,200)+"px"}function Fa(){Kn.current&&ri(Kn.current.selectionStart??0)}function Xc(H){var Ke;const he=nn.selectPrompt(H);tn.current=he.nextCursor,t(he.nextText),nn.setMentionMenuOpen(!1),ri(he.nextCursor),(Ke=Kn.current)==null||Ke.focus(),Kn.current&&(Kn.current.style.height="auto",Kn.current.style.height=Math.min(Kn.current.scrollHeight,200)+"px")}function $f(H){if(nn.mentionMenuOpen&&H.key==="Escape"){H.preventDefault(),nn.setMentionMenuOpen(!1);return}if(nn.mentionMenuOpen&&nn.filteredPrompts.length>0){if(H.key==="ArrowDown"){H.preventDefault(),nn.setMentionMenuIndex(he=>(he+1)%nn.filteredPrompts.length);return}if(H.key==="ArrowUp"){H.preventDefault(),nn.setMentionMenuIndex(he=>(he-1+nn.filteredPrompts.length)%nn.filteredPrompts.length);return}if(H.key==="Tab"&&!H.shiftKey||H.key==="Enter"&&!H.shiftKey){H.preventDefault(),Xc(nn.filteredPrompts[nn.mentionMenuIndex]);return}}if(nn.mentionMenuOpen&&nn.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 he=y5(p),mt=(he.findIndex(at=>at.value===j)+1)%he.length;N(he[mt].value);return}H.key==="Enter"&&!H.shiftKey&&(H.preventDefault(),Cr())}function Ua(H){const he=r.trim(),Ke=he?`[${he}]: ${H}`:H;if(!$)return Ke;const mt=($.description??"").trim();return`${["Linear issue context:",`- Identifier: ${$.identifier}`,`- Title: ${$.title}`,$.stateName?`- State: ${$.stateName}`:"",$.priorityLabel?`- Priority: ${$.priorityLabel}`:"",$.teamName?`- Team: ${$.teamName}`:"",`- URL: ${$.url}`,mt?`- Description:
112
- ${mt}`:""].filter(Boolean).join(`
113
- `)}
114
-
115
- User request:
116
- ${Ke}`}async function Cr(){const H=e.trim();if(!(!H||W)){if(n&&!r.trim()){A("Please enter your name before starting a session.");return}if(z(!0),A(""),Xn(""),qn){const he=jr||qn.currentBranch;if(he&&he===qn.currentBranch){const Ke=Jl.find(mt=>mt.name===he&&!mt.isRemote);if(Ke&&Ke.behind>0){Vs({behind:Ke.behind,branchName:he});return}}}await ss(H)}}async function ss(H,he){const Ke=Y.getState();Ke.clearCreation(),Ke.setSessionCreating(!0,p);try{to&&rg(to);const mt=(he==null?void 0:he.resumeSessionAt)||(Ba?no:void 0),at=mt?(he==null?void 0:he.forkSession)??(Ba?Ir:void 0):void 0,He=(he==null?void 0:he.cwd)||C,Hn=(he==null?void 0:he.branch)!==void 0?he.branch.trim()||void 0:jr.trim()||void 0,_n=(he==null?void 0:he.useWorktree)!==void 0?he.useWorktree:Kl,Tr=(he==null?void 0:he.createBranch)!==void 0?he.createBranch:!!(Hn&&Nn),ki=await OE({model:y,permissionMode:j,effort:p==="claude"&&S?S:void 0,cwd:He||void 0,envSlug:Ee||void 0,sandboxEnabled:wt?!0:void 0,sandboxSlug:wt&&rt?rt:void 0,branch:Hn,createBranch:Tr?!0:void 0,useWorktree:_n?!0:void 0,backend:p,codexInternetAccess:p==="codex"?!0:void 0,resumeSessionAt:mt,forkSession:at,userName:r.trim()||void 0,linearConnectionId:$&&ae||void 0,linearIssue:$?{identifier:$.identifier,title:$.title,stateName:$.stateName,teamName:$.teamName,url:$.url}:void 0},ai=>{Y.getState().addCreationProgress(ai)}),wn=ki.sessionId,Jc=Y.getState(),so=Jc.sdkSessions.filter(ai=>ai.sessionId!==wn);Jc.setSdkSessions([...so,{sessionId:wn,state:ki.state,cwd:ki.cwd,createdAt:Date.now(),backendType:ki.backendType||p,model:y,permissionMode:j,userName:r.trim()||void 0,resumeSessionAt:mt,forkSession:mt?at===!0:void 0}]);const ao=new Set(Y.getState().sessionNames.values()),Xs=P5(ao),Ks=o.trim()||r.trim(),eu=f.trim()||Xs,tu=Ks?`${Ks}_${eu}`:eu;Y.getState().setSessionName(wn,tu),Ne.renameSession(wn,tu).catch(()=>{}),h(""),He&&uS(He),Y.getState().setPreviousPermissionMode(wn,j),kx(wn,!0),Fc(wn),await t3(wn);const nu=H.trim();if(nu.length>0){const ai=Ua(nu),ru=eg(),iu=D.length>0?D.map(Ia=>({name:Ia.name,media_type:Ia.mediaType,data:Ia.base64,size:Ia.size})):void 0;Rn(wn,{type:"user_message",content:ai,session_id:wn,attachments:iu,client_msg_id:ru}),Y.getState().appendMessage(wn,{id:ru,role:"user",content:ai,attachments:iu,timestamp:Date.now()})}$&&(Ne.linkLinearIssue(wn,$,ae||void 0).then(()=>Y.getState().setLinkedLinearIssue(wn,$)).catch(()=>{}),Ne.transitionLinearIssue($.id,ae||void 0).catch(()=>{})),Y.getState().clearCreation()}catch(mt){const at=mt instanceof Error?mt.message:String(mt);A(at),Y.getState().setCreationError(at),z(!1)}}async function qa(H,he){W||(z(!0),A(""),Xn(""),O(H.cwd),Zl(!1),ur(!1),Zt(H.gitBranch||""),ti(H.resumeSessionId),Vr(he),await ss("",{resumeSessionAt:H.resumeSessionId,forkSession:he,cwd:H.cwd,branch:H.gitBranch,useWorktree:!1,createBranch:!1}))}async function as(){if(Is){ts(!0),Xn("");try{const H=C||(qn==null?void 0:qn.repoRoot);if(!H)throw new Error("No working directory");const he=await Ne.gitPull(H);if(!he.success){Xn(he.output||"Pull failed"),ts(!1),z(!1);return}Vs(null),ts(!1),await ss(e.trim())}catch(H){Xn(H instanceof Error?H.message:String(H)),ts(!1)}}}function ls(){const H=e.trim();Vs(null),Xn(""),ss(H)}function Kc(){Vs(null),Xn(""),z(!1)}const io=k.useCallback((H,he)=>{Zt(H),ur(he)},[]),Zc=k.useCallback((H,he)=>{Zt(H),ur(he)},[]),Qs=k.useCallback(H=>{Of(H)},[]),Er=k.useCallback(H=>{se(H),!H&&qn&&(Zt(qn.currentBranch),ur(!1))},[qn]),Ha=e.trim().length>0&&!W&&(!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:Zn,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 he=H.target.value;a(he),localStorage.setItem("cc-user-name",he)},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 he=H.target.value;u(he),localStorage.setItem("cc-session-prefix",he)},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:f,onChange:H=>h(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","_",f.trim()||"InvoicePdf"]}),"."]})]}),l.jsx("input",{ref:we,type:"file",multiple:!0,onChange:is,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(iS,{open:nn.mentionMenuOpen,loading:nn.promptsLoading,prompts:nn.filteredPrompts,selectedIndex:nn.mentionMenuIndex,onSelect:Xc,menuRef:nn.mentionMenuRef,className:"absolute left-2 right-2 bottom-full mb-1"}),($||D.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:()=>Er(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:"×"})]}),D.map((H,he)=>l.jsx(Yk,{name:H.name,mediaType:H.mediaType,base64:H.base64,size:H.size,onRemove:()=>Pf(he),className:"w-10 h-10"},he))]}),I&&l.jsx("div",{className:"px-4 pt-2 text-[11px] text-cc-error",children:I}),l.jsx("textarea",{ref:Kn,value:e,onChange:Qc,onKeyDown:$f,onClick:Fa,onKeyUp:Fa,onPaste:Wc,"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:za,children:[l.jsxs("button",{onClick:()=>me(!Q),"aria-expanded":Q,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:Ys.icon}),l.jsx("span",{children:Ys.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"})})]}),Q&&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:M.map(H=>l.jsxs("button",{onClick:()=>{_(H.value),me(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 ${H.value===y?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{children:H.icon}),H.label]},H.value))})]}),_e.length>0&&l.jsxs("div",{className:"relative",ref:ii,children:[l.jsxs("button",{onClick:()=>st(!it),"aria-expanded":it,"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:Yr.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"})})]}),it&&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:_e.map(H=>l.jsx("button",{onClick:()=>{E(H.value),localStorage.setItem("cc-effort",H.value),st(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${H.value===S?"text-cc-primary font-medium":"text-cc-fg"}`,children:H.label},H.value||"default"))})]}),l.jsxs("div",{className:"relative",ref:Gr,children:[l.jsxs("button",{onClick:()=>Qe(!Re),"aria-expanded":Re,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"})}),Oa.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"})})]}),Re&&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:pe.map(H=>l.jsx("button",{onClick:()=>{N(H.value),Qe(!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:()=>yn(!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:Gc})]}),jt&&l.jsx(qL,{initialPath:C||"",onSelect:H=>{O(H)},onClose:()=>yn(!1)})]}),l.jsx(YL,{cwd:C,gitRepoInfo:qn,selectedBranch:jr,isNewBranch:Nn,useWorktree:Kl,onBranchChange:io,onWorktreeChange:Zl,onBranchesLoaded:Qs}),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:eo,children:[l.jsxs("button",{onClick:()=>{Je||Ne.listEnvs().then(De).catch(()=>{}),Et(!Je)},"aria-expanded":Je,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?((os=Ce.find(H=>H.slug===Ee))==null?void 0:os.name)||"Env":"No env"})]}),Je&&l.jsxs("div",{className:"absolute left-0 bottom-full mb-1 w-56 bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 py-1 overflow-hidden",children:[l.jsx("button",{onClick:()=>{Be(""),localStorage.setItem("cc-selected-env",""),Et(!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:()=>{Be(H.slug),localStorage.setItem("cc-selected-env",H.slug),Et(!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:()=>{vt(!0),Et(!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..."})})]})]}),bt,l.jsx("div",{className:"flex-1"}),l.jsx("button",{onClick:()=>{var H;return(H=we.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:Cr,disabled:!Ha,className:`flex items-center justify-center w-8 h-8 sm:w-9 sm:h-9 rounded-full transition-colors ${Ha?"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&&Bf(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:()=>cr(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 ${et?"text-cc-primary":"text-cc-muted hover:text-cc-fg"}`,"aria-expanded":et,"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 ${et?"rotate-180":""}`,children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]}),l.jsx("div",{className:"accordion-panel","data-open":et?"true":"false",children:l.jsx("div",{className:"accordion-inner",inert:!et||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 $a(),disabled:be,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:be?"Refreshing...":"Refresh detected sessions"}),te.length>0&&l.jsxs("span",{className:"text-[11px] text-cc-muted",children:["Showing ",Ws.length," of ",on.length," ",Nr?"matching":rs?"recent":"detected"," Claude session",on.length!==1?"s":"","."]}),!Dn&&Pa>0&&si.length>0&&l.jsxs("button",{type:"button",onClick:()=>{It(!0),Sr(va)},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 (",Pa,")"]}),Dn&&si.length>0&&l.jsx("button",{type:"button",onClick:()=>{It(!1),Sr(va)},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:Da,onChange:H=>Xl(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."]}),Ht&&l.jsx("p",{className:"text-[11px] text-cc-error",children:Ht}),!be&&!Ht&&on.length===0&&l.jsx("p",{className:"text-[11px] text-cc-muted",children:Nr?"No sessions match this search.":"No Claude sessions detected yet."}),Ws.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:Ws.map(H=>{const he=E5(H),Ke=Zg(H.cwd),mt=H.source==="companion"?"Companion":"Claude",at=no===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 ${at?"text-cc-primary font-medium":"text-cc-fg"}`,children:he}),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:XL(H.resumeSessionId)}),l.jsx("span",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted",children:mt})]})]}),l.jsxs("div",{className:"min-w-0 text-[11px] text-cc-muted sm:font-mono-code truncate",title:H.cwd,children:[l.jsx("div",{className:"truncate",children:Ke}),l.jsx("div",{className:"mt-0.5 text-[10px] text-cc-muted/70 truncate",title:H.cwd,children:KL(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:ZL(H.createdAt)}),l.jsxs("div",{className:"sm:text-right flex gap-1.5 sm:justify-end",children:[l.jsx("button",{type:"button",onClick:()=>{ti(H.resumeSessionId),Vr(!0),qa(H,!0)},"aria-label":`Fork and open ${he}`,className:`px-2 py-1 rounded-md text-[11px] border transition-colors cursor-pointer ${at&&Ir?"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:()=>{ti(H.resumeSessionId),Vr(!1),qa(H,!1)},"aria-label":`Continue and open ${he}`,className:`px-2 py-1 rounded-md text-[11px] border transition-colors cursor-pointer ${at&&!Ir?"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}`)})}),Yc&&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:()=>Sr(H=>Math.min(H+QL,on.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 (",on.length-Un," 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:()=>{Z(!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(GL,{cwd:C,gitRepoInfo:qn,linearConfigured:G,selectedLinearIssue:$,onIssueSelect:Er,onBranchFromIssue:Zc,onConnectionSelect:R})]}),Is&&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:Is.branchName})," is"," ",l.jsxs("span",{className:"font-semibold text-amber-500",children:[Is.behind," commit",Is.behind!==1?"s":""," behind"]})," ","remote. Pull before starting?"]}),wi&&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:wi}),l.jsxs("div",{className:"flex flex-wrap gap-2 mt-2.5",children:[l.jsx("button",{onClick:Kc,disabled:ni,className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),l.jsx("button",{onClick:ls,disabled:ni,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:as,disabled:ni,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:ni?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})]})]}),ft&&l.jsx(dS,{onClose:()=>{vt(!1),Ne.listEnvs().then(De).catch(()=>{})}})]})}const eD=[],tD=[],nD={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"}},rD={label:"Unknown",badge:"text-cc-muted bg-cc-hover",dot:"bg-cc-muted opacity-40"};function iD({server:e,sessionId:t}){var f,h;const[n,r]=k.useState(!1),a=nD[e.status]||rD,o=e.status!=="disabled",u=((f=e.tools)==null?void 0:f.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:()=>n3(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:()=>r3(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,(h=e.config.args)!=null&&h.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 sD({sessionId:e,onDone:t}){const[n,r]=k.useState(""),[a,o]=k.useState("stdio"),[u,f]=k.useState(""),[h,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(),h.trim()&&(j.args=h.trim().split(/\s+/))):j.url=m.trim(),i3(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:_=>f(_.target.value),placeholder:"npx -y @modelcontextprotocol/server-memory",className:"w-full text-[12px] bg-cc-input-bg border border-cc-border rounded px-2 py-1.5 text-cc-fg placeholder:text-cc-muted/40 font-mono focus:outline-none focus:border-cc-primary"})]}),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:h,onChange:_=>p(_.target.value),placeholder:"--port 3000",className:"w-full text-[12px] bg-cc-input-bg border border-cc-border rounded px-2 py-1.5 text-cc-fg placeholder:text-cc-muted/40 font-mono focus:outline-none focus:border-cc-primary"})]})]}),(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 aD({sessionId:e}){const t=Y(f=>f.mcpServers.get(e)||eD),n=Y(f=>f.cliConnected.get(e)??!1),[r,a]=k.useState(!1),o=Y(f=>{var h;return((h=f.sessions.get(e))==null?void 0:h.mcp_servers)??tD});k.useEffect(()=>{n&&ey(e)},[e,n]);const u=t.length>0?t:o.map(f=>({name:f.name,status:f.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:()=>ey(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(sD,{sessionId:e,onDone:()=>a(!1)})}),u.length>0&&l.jsx("div",{className:"px-3 py-2 space-y-1.5",children:u.map(f=>l.jsx(iD,{server:f,sessionId:e},f.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 lD({cwd:e,open:t,onClose:n}){var q;const[r,a]=k.useState([]),[o,u]=k.useState(!0),[f,h]=k.useState(0),[p,m]=k.useState(""),[x,b]=k.useState(!1),[y,_]=k.useState(!1),[j,N]=k.useState(null),[S,E]=k.useState(null),C=k.useCallback(()=>{u(!0),N(null),Ne.getClaudeMdFiles(e).then(A=>{a(A.files),A.files.length>0&&(h(0),m(A.files[0].content)),E(null),b(!1),u(!1)}).catch(A=>{N(A.message),u(!1)})},[e]);k.useEffect(()=>{t&&C()},[t,C]);const O=A=>{x&&!confirm("Discard unsaved changes?")||(h(A),m(r[A].content),b(!1),E(null))},D=async()=>{var ie;const A=S||((ie=r[f])==null?void 0:ie.path);if(A){_(!0),N(null);try{await Ne.saveClaudeMd(A,p),b(!1),S?C():a(K=>K.map((G,P)=>P===f?{...G,content:p}:G))}catch(K){N(K instanceof Error?K.message:"Failed to save")}finally{_(!1)}}},L=A=>{const ie=A==="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 F=A=>A.startsWith(e+"/")?A.slice(e.length+1):A,W=r.some(A=>A.path===`${e}/CLAUDE.md`),z=r.some(A=>A.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((A,ie)=>l.jsxs("button",{onClick:()=>O(ie),className:`flex items-center gap-2 w-full px-3 py-2 text-left text-[12px] transition-colors cursor-pointer ${!S&&f===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:F(A.path)})]},A.path)),S&&l.jsxs("div",{className:"flex items-center gap-2 w-full px-3 py-2 text-[12px] bg-cc-active text-cc-fg",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-success shrink-0",children:l.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),l.jsx("span",{className:"truncate font-mono-code",children:F(S)})]})]}),(!W||!z)&&!S&&l.jsxs("div",{className:"shrink-0 border-t border-cc-border p-2",children:[l.jsx("div",{className:"text-[10px] text-cc-muted uppercase tracking-wider px-1 mb-1",children:"Create new"}),!W&&l.jsxs("button",{onClick:()=>L("root"),className:"flex items-center gap-1.5 w-full px-2 py-1.5 text-[11px] text-cc-fg/70 hover:bg-cc-hover rounded-md transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-success shrink-0",children:l.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),l.jsx("span",{className:"font-mono-code",children:"CLAUDE.md"})]}),!z&&l.jsxs("button",{onClick:()=>L("dotclaude"),className:"flex items-center gap-1.5 w-full px-2 py-1.5 text-[11px] text-cc-fg/70 hover:bg-cc-hover rounded-md transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-success shrink-0",children:l.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),l.jsx("span",{className:"font-mono-code",children:".claude/CLAUDE.md"})]})]})]}),l.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[r.length===0&&!S?l.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-4 px-6",children:[l.jsx("div",{className:"w-14 h-14 rounded-2xl bg-cc-card border border-cc-border flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-6 h-6 text-cc-muted",children:l.jsx("path",{d:"M4 1.5a.5.5 0 01.5-.5h7a.5.5 0 01.354.146l2 2A.5.5 0 0114 3.5v11a.5.5 0 01-.5.5h-11a.5.5 0 01-.5-.5v-13z"})})}),l.jsxs("div",{className:"text-center",children:[l.jsx("p",{className:"text-sm text-cc-fg font-medium mb-1",children:"No CLAUDE.md found"}),l.jsx("p",{className:"text-xs text-cc-muted leading-relaxed max-w-[280px]",children:"Create a CLAUDE.md file to give Claude Code project-specific instructions, coding conventions, and context."})]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{onClick:()=>L("root"),className:"px-3 py-1.5 text-xs font-medium rounded-lg bg-cc-primary text-white hover:bg-cc-primary/90 transition-colors cursor-pointer",children:"Create CLAUDE.md"}),l.jsx("button",{onClick:()=>L("dotclaude"),className:"px-3 py-1.5 text-xs font-medium rounded-lg bg-cc-hover text-cc-fg border border-cc-border hover:bg-cc-active transition-colors cursor-pointer",children:"Create .claude/CLAUDE.md"})]})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"shrink-0 flex items-center justify-between px-4 py-2 bg-cc-card border-b border-cc-border",children:[l.jsx("span",{className:"text-[12px] text-cc-muted font-mono-code truncate",children:F(S||(((q=r[f])==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:D,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:A=>{m(A.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 T5({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 Ui({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 oD({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 cD({path:e,label:t,onClose:n}){const[r,a]=k.useState(""),[o,u]=k.useState(!0),[f,h]=k.useState(!1),[p,m]=k.useState(!1),[x,b]=k.useState(null);k.useEffect(()=>{Ne.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 Ne.writeFile(e,r),h(!1)}catch(j){b(j instanceof Error?j.message:"Failed to save")}finally{m(!1)}},_=()=>{f&&!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:[f&&l.jsx("span",{className:"text-[10px] text-cc-warning font-medium",children:"Unsaved"}),l.jsx("button",{onClick:y,disabled:!f||p,className:`px-3 py-1 text-[11px] font-medium rounded-md transition-colors cursor-pointer ${f&&!p?"bg-cc-primary text-white hover:bg-cc-primary/90":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:p?"Saving...":"Save"})]})]}),l.jsx("textarea",{value:r,onChange:j=>{a(j.target.value),h(!0)},spellCheck:!1,className:"flex-1 w-full p-4 bg-cc-bg text-cc-fg text-[13px] font-mono-code leading-relaxed resize-none focus:outline-none",placeholder:"File contents..."})]}),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 uD({item:e,cwd:t,onClose:n}){if(e.kind==="json"){const[r,a]=k.useState(null),[o,u]=k.useState(!0);return k.useEffect(()=>{Ne.readFile(e.path).then(f=>{a(f.content),u(!1)}).catch(()=>{a("Failed to read file"),u(!1)})},[e.path]),o?null:l.jsx(oD,{path:e.path,content:r||"",onClose:n})}return e.kind==="claude-md"?l.jsx(lD,{cwd:e.editorCwd||t,open:!0,onClose:n}):l.jsx(cD,{path:e.path,label:e.label,onClose:n})}function dD({sessionId:e}){const t=Y(S=>S.sessions.get(e)),n=Y(S=>S.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,f]=k.useState(!0),[h,p]=k.useState(!1),[m,x]=k.useState(!1),[b,y]=k.useState(null),_=k.useCallback(async()=>{if(r)try{const S=await Ne.getClaudeConfig(r);o(S)}catch{}finally{f(!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(T5,{icon:"project",title:`Project (${j})`,expanded:h,onToggle:()=>p(S=>!S)}),h&&l.jsxs("div",{className:"pb-1",children:[a.project.claudeMd.map(S=>l.jsx(Ui,{label:S.path.includes(".claude/")?".claude/CLAUDE.md":"CLAUDE.md",onClick:()=>y({label:"CLAUDE.md",path:S.path,kind:"claude-md"})},S.path)),a.project.settings&&l.jsx(Ui,{label:"settings.json",onClick:()=>y({label:"settings.json",path:a.project.settings.path,kind:"json"})}),a.project.settingsLocal&&l.jsx(Ui,{label:"settings.local.json",onClick:()=>y({label:"settings.local.json",path:a.project.settingsLocal.path,kind:"json"})}),a.project.commands.length>0&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"px-4 pl-10 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:["Commands (",a.project.commands.length,")"]}),a.project.commands.map(S=>l.jsx(Ui,{label:`/${S.name}`,onClick:()=>y({label:S.name,path:S.path,kind:"md"})},S.path))]}),j===0&&l.jsx("p",{className:"px-4 pl-10 py-1.5 text-[11px] text-cc-muted",children:"No .claude config found"})]}),l.jsx(T5,{icon:"user",title:`User (${N})`,expanded:m,onToggle:()=>x(S=>!S)}),m&&l.jsxs("div",{className:"pb-1",children:[a.user.claudeMd&&l.jsx(Ui,{label:"CLAUDE.md",onClick:()=>y({label:"CLAUDE.md",path:a.user.claudeMd.path,kind:"claude-md",editorCwd:a.user.root})}),a.user.skills.length>0&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"px-4 pl-10 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:["Skills (",a.user.skills.length,")"]}),a.user.skills.map(S=>l.jsx(Ui,{label:S.name,sublabel:S.description?S.description.slice(0,40):void 0,onClick:()=>y({label:S.name,path:S.path,kind:"md"})},S.path))]}),a.user.agents.length>0&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"px-4 pl-10 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:["Agents (",a.user.agents.length,")"]}),a.user.agents.map(S=>l.jsx(Ui,{label:S.name,onClick:()=>y({label:S.name,path:S.path,kind:"md"})},S.path))]}),a.user.settings&&l.jsx(Ui,{label:"settings.json",onClick:()=>y({label:"settings.json",path:a.user.settings.path,kind:"json"})}),a.user.commands.length>0&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"px-4 pl-10 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:["Commands (",a.user.commands.length,")"]}),a.user.commands.map(S=>l.jsx(Ui,{label:`/${S.name}`,onClick:()=>y({label:S.name,path:S.path,kind:"md"})},S.path))]}),N===0&&l.jsx("p",{className:"px-4 pl-10 py-1.5 text-[11px] text-cc-muted",children:"No user config found"})]}),b&&Yl.createPortal(l.jsx(uD,{item:b,cwd:r,onClose:()=>y(null)}),document.body)]})}function fD(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 hD extends k.Component{constructor(){super(...arguments);wb(this,"state",{hasError:!1})}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(n){Fs(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 fS=[],Wx=3e4,pD=6e4,mD=5*6e4;let A5=null,M5=new Map;function gD(e){return e!==A5&&(A5=e,M5=new Map(e.map(t=>[t.sessionId,t]))),M5}function Vc(e){return Y(k.useCallback(t=>gD(t.sdkSessions).get(e),[e]))}const hS="cc-panel-collapsed";function R5(){try{const e=localStorage.getItem(hS);if(e)return new Set(JSON.parse(e))}catch{}return new Set}function xD(e){try{localStorage.setItem(hS,JSON.stringify([...e]))}catch{}}function pS({id:e,label:t,badge:n,defaultOpen:r=!0,children:a}){const[o,u]=k.useState(()=>R5().has(e)?!0:!r),f=k.useRef(!0);k.useEffect(()=>{if(f.current){f.current=!1;return}const p=R5();o?p.add(e):p.delete(e),xD(p)},[o,e]);const h=k.useCallback(()=>{u(p=>!p)},[]);return l.jsxs("div",{className:"border-t border-cc-separator first:border-t-0",children:[l.jsxs("button",{onClick:h,"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 vD(){const[e,t]=k.useState(()=>localStorage.getItem("cc-user-name")||""),[n,r]=k.useState(()=>localStorage.getItem("cc-session-prefix")||"");return l.jsx(pS,{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 mS(e){return e>80?"bg-cc-error":e>50?"bg-cc-warning":"bg-cc-primary"}function gS(e){return e>80?"critical":e>50?"elevated":"normal"}function Ji({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 — ${gS(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 ${mS(t)}`,style:{width:`${Math.min(t,100)}%`}})})]})}function bD({sessionId:e}){var h;const[t,n]=k.useState(null),r=k.useCallback(async()=>{try{const p=await Ne.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)},Wx);return()=>clearInterval(p)},[r]),!t)return null;const o=t.five_hour!==null,u=t.seven_day!==null,f=!o&&!u&&((h=t.extra_usage)==null?void 0:h.is_enabled);return!o&&!u&&!f?null:l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2",children:[t.five_hour&&l.jsx(Ji,{label:"5h Limit",pct:t.five_hour.utilization,detail:t.five_hour.resets_at?m5(t.five_hour.resets_at):void 0}),t.seven_day&&l.jsx(Ji,{label:"7d Limit",pct:t.seven_day.utilization,detail:t.seven_day.resets_at?m5(t.seven_day.resets_at):void 0}),f&&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 — ${gS(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 ${mS(t.extra_usage.utilization)}`,style:{width:`${Math.min(t.extra_usage.utilization,100)}%`}})})]})]})}function Rd(e){const t=e/1073741824;return t>=1?`${t.toFixed(1)} GB`:`${Math.round(e/1024**2)} MB`}function yD(e){const[t,n]=k.useState(null);return k.useEffect(()=>{let r=!1;const a=async()=>{try{const u=await Ne.getSystemMemory();r||n(u)}catch{}};a();const o=setInterval(a,pD);return()=>{r=!0,clearInterval(o)}},[]),t?l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2",children:[l.jsx(Ji,{label:"Memory",pct:t.used_percent,detail:`${Rd(t.used_bytes)} / ${Rd(t.total_bytes)}`}),t.swap_total_bytes>0&&l.jsx(Ji,{label:"Swap",pct:t.swap_used_percent,detail:`${Rd(t.swap_used_bytes)} / ${Rd(t.swap_total_bytes)}`})]}):null}function _D(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 wD(e){const[t,n]=k.useState(null);return k.useEffect(()=>{let r=!1;const a=async()=>{try{const u=await Ne.getSystemDisk();r||n(u)}catch{}};a();const o=setInterval(a,mD);return()=>{r=!0,clearInterval(o)}},[]),t?l.jsx("div",{className:"shrink-0 px-4 py-2.5",children:l.jsx(Ji,{label:"Disk",pct:t.used_percent,detail:`${_D(t.available_bytes)} free`})}):null}function kD({sessionId:e}){const t=Y(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),Wx);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(Ji,{label:`${g5(r.windowDurationMins)} Limit`,pct:r.usedPercent,detail:r.resetsAt>0?Kg(r.resetsAt):void 0}),a&&l.jsx(Ji,{label:`${g5(a.windowDurationMins)} Limit`,pct:a.usedPercent,detail:a.resetsAt>0?Kg(a.resetsAt):void 0})]})}function SD({sessionId:e}){const t=Y(r=>{var a;return(a=r.sessions.get(e))==null?void 0:a.codex_token_details}),n=Y(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:hc(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:hc(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:hc(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:hc(t.reasoningOutputTokens)})]})]}),t.modelContextWindow>0&&l.jsx(Ji,{label:"Context",pct:n})]}):null}function jD(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 ND({pr:e}){const t=jD(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 CD({sessionId:e}){const t=Y(u=>u.sessions.get(e)),n=Vc(e),r=Y(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||Ne.getPRStatus(a,o).then(u=>{Y.getState().setPRStatus(e,u)}).catch(()=>{})},[e,a,o,r]),!(r!=null&&r.available)||!r.pr?null:l.jsx(ND,{pr:r.pr})}const ED=6e4;function Ym(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 TD({sessionId:e}){const t=Y(A=>A.linkedLinearIssues.get(e)),[n,r]=k.useState([]),[a,o]=k.useState(null),[u,f]=k.useState([]),[h,p]=k.useState(""),[m,x]=k.useState(!1),[b,y]=k.useState(!1),[_,j]=k.useState(!1),[N,S]=k.useState(""),[E,C]=k.useState([]),[O,D]=k.useState(!1),L=k.useRef(null);k.useEffect(()=>{Ne.getLinkedLinearIssue(e).then(A=>{A.issue&&Y.getState().setLinkedLinearIssue(e,A.issue)}).catch(()=>{})},[e]);const I=k.useCallback(async()=>{if(t)try{const A=await Ne.getLinkedLinearIssue(e,!0);A.issue&&(Y.getState().setLinkedLinearIssue(e,A.issue),A.issue.stateType==="completed"&&y(!0)),A.comments&&r(A.comments),A.assignee!==void 0&&o(A.assignee??null),A.labels&&f(A.labels)}catch{}},[e,t]);k.useEffect(()=>{if(!t)return;I();const A=setInterval(I,ED);return()=>clearInterval(A)},[I,t]),k.useEffect(()=>{if(!_)return;const A=N.trim();if(A.length<2){C([]);return}let ie=!0;D(!0);const K=setTimeout(()=>{Ne.searchLinearIssues(A,6).then(G=>{ie&&C(G.issues)}).catch(()=>{ie&&C([])}).finally(()=>{ie&&D(!1)})},400);return()=>{ie=!1,clearTimeout(K)}},[N,_]),k.useEffect(()=>{_&&setTimeout(()=>{var A;return(A=L.current)==null?void 0:A.focus()},50)},[_]);async function F(){if(!(!t||!h.trim()||m)){x(!0);try{const A=await Ne.addLinearComment(t.id,h.trim());r(ie=>[...ie,A.comment]),p("")}catch{}finally{x(!1)}}}async function W(){try{await Ne.unlinkLinearIssue(e),Y.getState().setLinkedLinearIssue(e,null),r([]),o(null),f([]),y(!1)}catch{}}async function z(A){try{await Ne.linkLinearIssue(e,A),Y.getState().setLinkedLinearIssue(e,A),j(!1),S(""),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(Sc,{className:"w-3.5 h-3.5 text-cc-muted shrink-0"}),l.jsx("input",{ref:L,type:"text",value:N,onChange:A=>S(A.target.value),placeholder:"Search issues...","aria-label":"Search Linear issues",className:"flex-1 text-[11px] bg-transparent border border-cc-border rounded-md px-2 py-1.5 text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/50"}),l.jsx("button",{onClick:()=>{j(!1),S(""),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"})})})]}),O&&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(A=>l.jsxs("button",{onClick:()=>z(A),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:A.identifier}),l.jsx("span",{className:`text-[9px] font-medium px-1 rounded-full leading-[14px] ${Ym(A.stateType,A.stateName).cls}`,children:Ym(A.stateType,A.stateName).label})]}),l.jsx("p",{className:"text-[11px] text-cc-muted truncate mt-0.5",children:A.title})]},A.id))}),N.trim().length>=2&&!O&&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(Sc,{className:"w-3.5 h-3.5"}),"Link Linear issue"]})});const q=Ym(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(Sc,{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:W,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(A=>l.jsx("span",{className:"text-[9px] px-1.5 py-0.5 rounded-full",style:{backgroundColor:`${A.color}20`,color:A.color},children:A.name},A.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 Ne.archiveSession(e),Y.getState().newSession()}catch{}},className:"text-[10px] text-cc-success font-medium px-2 py-0.5 rounded bg-cc-success/20 hover:bg-cc-success/30 cursor-pointer",children:"Close session"})]})]}),n.length>0&&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(A=>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:A.userName}),l.jsx("span",{className:"text-[9px] text-cc-muted",children:fD(new Date(A.createdAt).getTime())})]}),l.jsx("p",{className:"text-cc-muted line-clamp-2",children:A.body})]},A.id))]}),l.jsxs("div",{className:"px-4 py-2 flex items-center gap-1.5",children:[l.jsx("input",{type:"text",value:h,onChange:A=>p(A.target.value),onKeyDown:A=>{A.key==="Enter"&&!A.shiftKey&&(A.preventDefault(),F())},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:F,disabled:!h.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 AD({sessionId:e}){const t=Y(u=>u.rateLimit.get(e)),[,n]=k.useState(0);if(k.useEffect(()=>{if(!t)return;const u=setInterval(()=>n(f=>f+1),Wx);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?Kg(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(Ji,{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 MD({sessionId:e}){const t=Y(a=>a.sessions.get(e)),n=Vc(e);return((t==null?void 0:t.backend_type)||(n==null?void 0:n.backendType))==="codex"?l.jsxs(l.Fragment,{children:[l.jsx(kD,{sessionId:e}),l.jsx(SD,{sessionId:e})]}):l.jsxs(l.Fragment,{children:[l.jsx(AD,{sessionId:e}),l.jsx(bD,{sessionId:e})]})}function RD({sessionId:e}){const t=Y(p=>p.sessions.get(e)),n=Vc(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,f=(t==null?void 0:t.total_lines_removed)||0,h=(t==null?void 0:t.repo_root)||(t==null?void 0:t.cwd)||(n==null?void 0:n.cwd);return 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||f>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"})]}),f>0&&l.jsxs("span",{className:"text-cc-error",children:["-",f,l.jsx("span",{className:"sr-only",children:" lines removed"})]})]}),o>0&&h&&l.jsx("button",{type:"button",className:"text-[11px] font-medium text-cc-warning hover:text-cc-warning/80 transition-colors cursor-pointer",onClick:()=>{Ne.gitPull(h).then(p=>{Y.getState().updateSession(e,{git_ahead:p.git_ahead,git_behind:p.git_behind}),p.success||Fs(new Error(`git pull failed: ${p.output}`))}).catch(p=>Fs(p))},title:"Pull latest changes",children:"Pull"})]})]}):null}function LD({sessionId:e}){const t=Y(o=>o.sessionTasks.get(e)||fS),n=Y(o=>o.sessions.get(e)),r=Vc(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($D,{task:o},o.id))})})}const DD={"usage-limits":MD,"server-memory":yD,"server-disk":wD,"git-branch":RD,"github-pr":CD,"linear-issue":TD,"mcp-servers":aD,tasks:LD};function zD(e,t){const n=Y(r=>r.sessionTasks.get(t)||fS);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 OD({isCodex:e}){const t=Y(p=>p.taskPanelConfig),n=Y(p=>p.toggleSectionEnabled),r=Y(p=>p.moveSectionUp),a=Y(p=>p.moveSectionDown),o=Y(p=>p.resetTaskPanelConfig),u=Y(p=>p.setTaskPanelConfigMode),f=e?"codex":"claude",h=t.order.filter(p=>{const m=Zi.find(x=>x.id===p);return!(!m||m.backends&&!m.backends.includes(f))});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:h.map((p,m)=>{const x=Zi.find(j=>j.id===p),b=t.enabled[p]??!0,y=m===0,_=m===h.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 BD({sectionId:e,sessionId:t,children:n}){var o;const r=((o=Zi.find(u=>u.id===e))==null?void 0:o.label)??e,a=zD(e,t);return l.jsx(pS,{id:e,label:r,badge:a,children:n})}function PD({sessionId:e}){const t=Y(m=>m.sessions.get(e)),n=Vc(e),r=Y(m=>m.taskPanelOpen),a=Y(m=>m.setTaskPanelOpen),o=Y(m=>m.taskPanelConfigMode),u=Y(m=>m.taskPanelConfig);if(!r)return null;const f=((t==null?void 0:t.backend_type)||(n==null?void 0:n.backendType))==="codex",h=f?"codex":"claude",p=u.order.filter(m=>{const x=Zi.find(b=>b.id===m);return!(!x||x.backends&&!x.backends.includes(h))});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?Y.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(OD,{isCodex:f}):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(vD,{}),l.jsx(dD,{sessionId:e}),p.filter(m=>u.enabled[m]!==!1).map(m=>{var b;const x=DD[m];return x?l.jsx(BD,{sectionId:m,sessionId:e,children:l.jsx(hD,{label:(b=Zi.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:()=>Y.getState().setTaskPanelConfigMode(!0),className:"flex items-center gap-1.5 text-[11px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",title:"Configure panel sections","data-testid":"customize-panel-btn",children:[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 $D({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 FD({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 UD({sessionId:e}){const t=Y(D=>D.sessions.get(e)),n=Y(D=>D.sdkSessions.find(L=>L.sessionId===e)),r=Y(D=>D.diffPanelSelectedFile.get(e)??null),a=Y(D=>D.setDiffPanelSelectedFile),o=Y(D=>D.diffBase),u=Y(D=>D.setDiffBase),f=Y(D=>D.changedFilesTick.get(e)??0),h=(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([]),S=Y(D=>D.setGitChangedFilesCount);k.useEffect(()=>{if(!h)return;let D=!1;return Ne.getChangedFiles(h,o).then(({files:L})=>{if(D)return;const I=`${h}/`,F=L.filter(W=>W.path===h||W.path.startsWith(I)).map(W=>({abs:W.path,rel:W.path.startsWith(I)?W.path.slice(I.length):W.path,status:W.status==="A"||W.status==="?"?"created":W.status==="D"?"deleted":"updated"})).sort((W,z)=>W.rel.localeCompare(z.rel));N(F),S(e,F.length)}).catch(()=>{D||(N([]),S(e,0))}),()=>{D=!0}},[h,o,f,e,S]);const E=j;k.useEffect(()=>{!r&&E.length>0&&a(e,E[0].abs)},[r,E,e,a]),k.useEffect(()=>{var D;r&&(E.some(L=>L.abs===r)||a(e,((D=E[0])==null?void 0:D.abs)??null))},[r,E,e,a]),k.useEffect(()=>{if(!r){m("");return}let D=!1;return b(!0),Ne.getFileDiff(r,o).then(L=>{D||(m(L.diff),b(!1))}).catch(()=>{D||(m(""),b(!1))}),()=>{D=!0}},[r,o]);const C=k.useCallback(D=>{a(e,D),typeof window<"u"&&window.innerWidth<640&&_(!1)},[e,a]),O=k.useMemo(()=>!r||!h?r:r.startsWith(h+"/")?r.slice(h.length+1):r,[r,h]);return h?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:D,rel:L,status:I})=>l.jsxs("button",{onClick:()=>C(D),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 ${D===r?"bg-cc-active text-cc-fg":"text-cc-fg/70"}`,style:{width:"calc(100% - 8px)"},children:[l.jsx(FD,{status:I}),l.jsx("span",{className:"truncate leading-snug",children:L})]},D))})]}),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:O==null?void 0:O.split("/").pop()}),l.jsx("span",{className:"text-cc-muted truncate text-[11px] hidden sm:block font-mono-code",children:O})]}),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(Vl,{unifiedDiff:p,fileName:O||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 qD(){const e=Y(h=>h.updateInfo),t=Y(h=>h.updateDismissedVersion),n=Y(h=>h.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 Ne.triggerUpdate(),Y.getState().setUpdateOverlayActive(!0)}catch(h){localStorage.removeItem("companion_docker_prompt_pending"),Fs(h),a(!1)}},u=()=>{n(e.latestVersion)},f=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:f,className:"text-xs font-medium px-2.5 py-0.5 rounded-md bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",children:f?"Updating...":"Update & Restart"}):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 HD({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"),f=e.some(x=>x.status==="error")||!!t,h=[...e].reverse().find(x=>x.status==="in_progress"),p=[...e].reverse().find(x=>x.status==="done"),m=f?"Something went wrong":u?"Launching session...":(h==null?void 0:h.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&&!f&&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&&!f?"scale-110":""} ${f?"opacity-40 grayscale":""}`}),o&&!f&&l.jsx("div",{className:"absolute -inset-3 z-0",children:l.jsx("svg",{className:"w-full h-full animate-spin-slow",viewBox:"0 0 100 100",children:l.jsx("circle",{cx:"50",cy:"50",r:"46",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"60 230",strokeLinecap:"round",className:"text-cc-primary/40"})})}),u&&!f&&l.jsx("div",{className:"absolute -inset-3 z-0 rounded-full border-2 border-cc-success/30"})]}),l.jsx("p",{className:`text-sm font-medium mb-6 transition-colors ${f?"text-cc-error":"text-cc-fg"}`,children: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})})}),(f||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:f?"Dismiss":"Cancel"}),!f&&e.length>0&&l.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-cc-border/30",children:l.jsx("div",{className:"h-full bg-cc-primary/60 transition-all duration-500 ease-out",style:{width:`${Math.round(e.filter(x=>x.status==="done").length/Math.max(e.length,1)*100)}%`}})})]})}function ID(){const e=localStorage.getItem("companion_auth_token");return e?{Authorization:`Bearer ${e}`}:{}}const VD={installing:"Installing update...",restarting:"Restarting server...",waiting:"Waiting for server...",ready:"Update complete!"};function GD(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"),f()},5e3);function f(){a.current&&fetch("/api/update-check",{signal:AbortSignal.timeout(3e3),headers:ID()}).then(h=>{if(!h.ok)throw new Error("not ready");return h.json()}).then(()=>{a.current&&(n("ready"),setTimeout(()=>{a.current&&window.location.reload()},800))}).catch(()=>{r.current=setTimeout(f,1500)})}return()=>{clearTimeout(o),clearTimeout(u),r.current&&clearTimeout(r.current)}},[e]),t}function xS({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:VD[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 YD({active:e}){const t=GD(e);return e?l.jsx(xS,{phase:t,className:"fixed inset-0 z-[100]"}):null}function Sz({phase:e}){return l.jsx(xS,{phase:e,className:"absolute inset-0"})}function WD(){const e=Y(j=>j.dockerUpdateDialogOpen),t=Y(j=>j.setDockerUpdateDialogOpen),[n,r]=k.useState("prompt"),[a,o]=k.useState(!1),[u,f]=k.useState(null),h=k.useRef(null);if(k.useEffect(()=>{e&&Ne.getSettings().then(j=>{o(j.dockerAutoUpdate),j.dockerAutoUpdate&&p()}).catch(()=>{})},[e]),k.useEffect(()=>{if(n!=="pulling"){h.current&&(clearInterval(h.current),h.current=null);return}return h.current=setInterval(()=>{Ne.getImageStatus("the-companion:latest").then(j=>{f(j),j.status==="ready"?r("done"):j.status==="error"&&r("error")}).catch(()=>{})},2e3),()=>{h.current&&(clearInterval(h.current),h.current=null)}},[n]),!e)return null;function p(){r("pulling"),Ne.pullImage("the-companion:latest").then(j=>{j.state&&f(j.state)}).catch(()=>{r(j=>j==="pulling"?"error":j)})}function m(){p()}function x(){y()}function b(){y()}function y(){r("prompt"),f(null),t(!1)}async function _(){const j=!a;o(j);try{await Ne.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 jz({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 Wm=["welcome","claude","codex","done"],L5='button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])';function Jg(){return typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function QD({onComplete:e}){const[t,n]=k.useState("welcome"),[r,a]=k.useState(""),[o,u]=k.useState(""),[f,h]=k.useState(!1),[p,m]=k.useState(""),[x,b]=k.useState(!1),[y,_]=k.useState(!1),[j,N]=k.useState(Jg),S=k.useRef(null);k.useEffect(()=>{j||requestAnimationFrame(()=>N(!0))},[j]),k.useEffect(()=>{const q=S.current;if(!q)return;function A(K){if(K.key==="Escape"){K.preventDefault();return}if(K.key!=="Tab")return;const G=q.querySelectorAll(L5);if(G.length===0)return;const P=G[0],$=G[G.length-1];K.shiftKey?document.activeElement===P&&(K.preventDefault(),$.focus()):document.activeElement===$&&(K.preventDefault(),P.focus())}document.addEventListener("keydown",A);const ie=q.querySelector(L5);return ie==null||ie.focus(),()=>document.removeEventListener("keydown",A)},[t]);const E=k.useCallback(async()=>{if(!r.trim()){n("codex");return}h(!0),m("");try{await Ne.updateSettings({claudeCodeOAuthToken:r.trim()}),b(!0),n("codex")}catch(q){m(q instanceof Error?q.message:"Failed to save token")}finally{h(!1)}},[r]),C=k.useCallback(async()=>{h(!0),m("");try{(await Ne.getSettings()).codexDeviceAuthConfigured?(_(!0),await D()):m("No Codex auth found. Run codex --login in your terminal first.")}catch(q){m(q instanceof Error?q.message:"Failed to check auth status")}finally{h(!1)}},[]),O=k.useCallback(async()=>{h(!0),m("");try{await Ne.updateSettings({openaiApiKey:o.trim()}),_(!0),await D()}catch(q){m(q instanceof Error?q.message:"Failed to save API key")}finally{h(!1)}},[o]),D=k.useCallback(async()=>{try{await Ne.updateSettings({onboardingCompleted:!0})}catch{}n("done")},[]),L=k.useCallback(()=>{e()},[e]),I=k.useCallback(async()=>{await D(),e()},[D,e]),F=k.useCallback(q=>{m(""),n(q)},[]),W=Wm.indexOf(t),z=Jg();return Yl.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:z?"none":"opacity 400ms cubic-bezier(0.16, 1, 0.3, 1)"},children:[l.jsx("div",{className:"absolute top-0 left-0 right-0 h-[2px]",style:{background:"linear-gradient(90deg, transparent 0%, var(--color-cc-primary) 30%, var(--color-cc-primary) 70%, transparent 100%)",opacity:.6}}),l.jsxs("div",{ref:S,role:"dialog","aria-modal":"true","aria-label":"Provider setup",className:"w-full max-w-[520px] mx-6",style:{transform:j?"translateY(0)":"translateY(12px)",opacity:j?1:0,transition:z?"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 ${W+1} of ${Wm.length-1}`,children:Wm.slice(0,3).map((q,A)=>l.jsx("div",{className:"h-[3px] rounded-full transition-[transform,background,opacity] duration-300",style:{width:32,transform:A===W?"scaleX(1)":"scaleX(0.375)",transformOrigin:"center",background:A<=W?"var(--color-cc-primary)":"var(--color-cc-border)",opacity:A<=W?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(XD,{onSetupClaude:()=>F("claude"),onSetupCodex:()=>F("codex")}),t==="claude"&&l.jsx(KD,{token:r,onTokenChange:a,onSave:E,onSkip:()=>F("codex"),saving:f,error:p}),t==="codex"&&l.jsx(ZD,{apiKey:o,onApiKeyChange:u,onCheckAuth:C,onSaveApiKey:O,onSkip:()=>D(),onBack:()=>F("claude"),saving:f,error:p}),t==="done"&&l.jsx(JD,{claudeConfigured:x,codexConfigured:y,onDone:L})]}),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 XD({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 KD({token:e,onTokenChange:t,onSave:n,onSkip:r,saving:a,error:o}){const u=k.useRef(null);k.useEffect(()=>{var h;(h=u.current)==null||h.focus()},[]);const f="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(vS,{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:h=>t(h.target.value),placeholder:"Paste the token from your terminal...","aria-describedby":o?f: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:f,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 ZD({apiKey:e,onApiKeyChange:t,onCheckAuth:n,onSaveApiKey:r,onSkip:a,onBack:o,saving:u,error:f}){const[h,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:"Log in with your ChatGPT account 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(vS,{text:"codex --login"})]}),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:"codex --login"})]})})]}),f&&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:f})]}),l.jsxs("div",{className:"mb-4",children:[l.jsxs("button",{onClick:()=>p(!h),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:h?"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":h?"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":f?m:void 0,"aria-invalid":f?!0:void 0,className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg border border-cc-border text-cc-fg placeholder:text-cc-muted/60 focus:outline-none focus:ring-1 focus:ring-cc-codex focus:border-cc-codex font-mono-code transition-shadow duration-150"})]})})})]}),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 JD({claudeConfigured:e,codexConfigured:t,onDone:n}){const r=!e&&!t,a=Jg(),[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 vS({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 ez(e){return Y(t=>{var n;return!e||!t.magicUiAvailable?!1:((n=t.sessions.get(e))==null?void 0:n.magicUiActive)===!0})}const tz=k.lazy(()=>$n(()=>import("./Playground-By2aXWQF.js"),__vite__mapDeps([0,1])).then(e=>({default:e.Playground}))),nz=k.lazy(()=>$n(()=>import("./SettingsPage-D0v_BZTU.js"),[]).then(e=>({default:e.SettingsPage}))),rz=k.lazy(()=>$n(()=>import("./IntegrationsPage-BSY0-fsO.js"),[]).then(e=>({default:e.IntegrationsPage}))),iz=k.lazy(()=>$n(()=>import("./LinearSettingsPage-dwMpnpxL.js"),[]).then(e=>({default:e.LinearSettingsPage}))),sz=k.lazy(()=>$n(()=>import("./LinearOAuthSettingsPage-Cl5dP05g.js"),[]).then(e=>({default:e.LinearOAuthSettingsPage}))),az=k.lazy(()=>$n(()=>import("./TailscalePage-B8SJQpMF.js"),[]).then(e=>({default:e.TailscalePage}))),lz=k.lazy(()=>$n(()=>import("./PromptsPage-DVv0Qn3d.js"),[]).then(e=>({default:e.PromptsPage}))),oz=k.lazy(()=>$n(()=>Promise.resolve().then(()=>FL),void 0).then(e=>({default:e.EnvManager}))),cz=k.lazy(()=>$n(()=>import("./SandboxManager-CDjGbD5N.js"),[]).then(e=>({default:e.SandboxManager}))),uz=k.lazy(()=>$n(()=>import("./CronManager-D7aAMVgs.js"),[]).then(e=>({default:e.CronManager}))),dz=k.lazy(()=>$n(()=>import("./AgentsPage-DJIGGU86.js"),[]).then(e=>({default:e.AgentsPage}))),fz=k.lazy(()=>$n(()=>import("./RunsPage-bu3TZ6ai.js"),[]).then(e=>({default:e.RunsPage}))),hz=k.lazy(()=>$n(()=>import("./DashboardPage-Bporj7Vr.js"),[]).then(e=>({default:e.DashboardPage}))),pz=k.lazy(()=>$n(()=>import("./MagicUIView-BoHMBELi.js"),__vite__mapDeps([2,1])).then(e=>({default:e.MagicUIView})));function ir(){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 mz(){return k.useSyncExternalStore(e=>(window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)),()=>window.location.hash)}function gz(){const e=Y(ae=>ae.isAuthenticated),t=Y(ae=>ae.darkMode),n=Y(ae=>ae.currentSessionId),r=Y(ae=>ae.sidebarOpen),a=Y(ae=>ae.taskPanelOpen),o=Y(ae=>ae.homeResetKey),u=Y(ae=>ae.activeTab),f=ez(n),h=Y(ae=>ae.sessionCreating),p=Y(ae=>ae.sessionCreatingBackend),m=Y(ae=>ae.creationProgress),x=Y(ae=>ae.creationError),b=Y(ae=>ae.updateOverlayActive),y=mz(),_=k.useMemo(()=>wx(y),[y]),j=_.page==="settings",N=_.page==="prompts",S=_.page==="integrations",E=_.page==="integration-linear",C=_.page==="integration-linear-oauth",O=_.page==="integration-tailscale",D=_.page==="environments",L=_.page==="sandboxes",I=_.page==="scheduled",F=_.page==="agents"||_.page==="agent-detail",W=_.page==="runs",z=_.page==="dashboard",q=_.page==="session"||_.page==="home";k.useEffect(()=>{DE(y||"#/")},[y]),k.useEffect(()=>{document.documentElement.classList.toggle("dark",t)},[t]);const A=k.useRef(Y.getState().currentSessionId);k.useEffect(()=>{if(A.current!==null&&_.page==="home"){kx(A.current,!0),A.current=null;return}if(A.current=null,_.page==="session"){const ae=Y.getState();ae.currentSessionId!==_.sessionId&&ae.setCurrentSession(_.sessionId),Fc(_.sessionId)}else if(_.page==="home"){const ae=Y.getState();ae.currentSessionId!==null&&ae.setCurrentSession(null)}},[_]);const ie=Y(ae=>n?ae.changedFilesTick.get(n)??0:0),K=Y(ae=>ae.diffBase),G=Y(ae=>ae.setGitChangedFilesCount),P=Y(ae=>{var R,B;return n&&(((R=ae.sessions.get(n))==null?void 0:R.cwd)||((B=ae.sdkSessions.find(Z=>Z.sessionId===n))==null?void 0:B.cwd))||null});k.useEffect(()=>{if(!n||!P)return;let ae=!1;return Ne.getChangedFiles(P,K).then(({files:R})=>{if(ae)return;const B=`${P}/`,Z=R.filter(M=>M.path===P||M.path.startsWith(B)).length;G(n,Z)}).catch(()=>{}),()=>{ae=!0}},[n,P,K,ie,G]),k.useEffect(()=>{const ae=()=>{Ne.checkForUpdate().then(B=>{Y.getState().setUpdateInfo(B)}).catch(()=>{})};ae();const R=setInterval(ae,300*1e3);return()=>clearInterval(R)},[]),k.useEffect(()=>{const ae=()=>{Ne.getClaudeCompat().then(B=>{Y.getState().setClaudeCompatInfo(B)}).catch(()=>{})};ae();const R=setInterval(ae,300*1e3);return()=>clearInterval(R)},[]);const[$,se]=k.useState(!1);return k.useEffect(()=>{e&&Ne.getSettings().then(ae=>{ae.publicUrl&&Y.getState().setPublicUrl(ae.publicUrl),Y.getState().setMagicUiAvailable(!!ae.magicUiEnabled&&!!ae.claudeCliAvailable),ae.onboardingCompleted||se(!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(ir,{}),children:l.jsx(tz,{})}):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:()=>Y.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(JE,{})}),l.jsxs("div",{className:"flex-1 flex flex-col min-w-0 overflow-hidden",children:[l.jsx(OL,{}),l.jsx(qD,{}),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(ir,{}),children:l.jsx(nz,{embedded:!0})})}),N&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(ir,{}),children:l.jsx(lz,{embedded:!0})})}),S&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(ir,{}),children:l.jsx(rz,{embedded:!0})})}),E&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(ir,{}),children:l.jsx(iz,{embedded:!0})})}),C&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(ir,{}),children:l.jsx(sz,{embedded:!0})})}),O&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(ir,{}),children:l.jsx(az,{embedded:!0})})}),D&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(ir,{}),children:l.jsx(oz,{embedded:!0})})}),L&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(ir,{}),children:l.jsx(cz,{embedded:!0})})}),I&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(ir,{}),children:l.jsx(uz,{embedded:!0})})}),F&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(ir,{}),children:l.jsx(dz,{route:_})})}),W&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(ir,{}),children:l.jsx(fz,{})})}),z&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(ir,{}),children:l.jsx(hz,{})})}),q&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"absolute inset-0",children:n?u==="diff"?l.jsx(UD,{sessionId:n}):f?l.jsx(k.Suspense,{fallback:l.jsx(ir,{}),children:l.jsx(pz,{sessionId:n})}):l.jsx(AL,{sessionId:n}):l.jsx(JL,{},o)}),h&&m&&m.length>0&&l.jsx(HD,{steps:m,error:x,backend:p??void 0,onCancel:()=>Y.getState().clearCreation()})]})]})]}),n&&q&&l.jsxs(l.Fragment,{children:[!a&&l.jsxs("button",{type:"button",onClick:()=>Y.getState().setTaskPanelOpen(!0),className:"hidden lg:flex fixed right-0 top-1/2 -translate-y-1/2 z-30 items-center gap-1 rounded-l-lg border border-r-0 border-cc-border bg-cc-card/95 backdrop-blur px-2 py-2 text-[11px] text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:"Open context panel",children:[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:()=>Y.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(PD,{sessionId:n})})]}),l.jsx(YD,{active:b}),l.jsx(WD,{}),$&&l.jsx(QD,{onComplete:()=>se(!1)})]}):l.jsx(FE,{})}class xz extends k.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,n){Fs(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}}LE();NN.createRoot(document.getElementById("root")).render(l.jsx(k.StrictMode,{children:l.jsx(xz,{children:l.jsx(gz,{})})}));$n(()=>import("./sw-register-CvyRJNug.js"),[]).catch(()=>{});export{yL as A,qd as B,sL as C,bz as D,$c as E,qL as F,ND as G,Yl as H,_5 as I,rS as J,tL as K,Sc as L,ZR as M,lL as N,aL as O,oL as P,yz as Q,kz as R,HD as S,H5 as T,qD as U,wz as V,$n as _,Ne as a,Cm as b,Rn as c,AL as d,YE as e,jR as f,RE as g,Vl as h,PL as i,l as j,Sz as k,jz as l,OR as m,kx as n,BR as o,ML as p,kD as q,k as r,_z as s,fD as t,Y as u,SD as v,Bs as w,Ol as x,jc as y,lD as z};