@hellcoder/companion 0.99.1 → 0.99.2-preview.20260610105829.5d5d2f3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AgentsPage-DUtusa3N.js → AgentsPage-tWiu1_AT.js} +1 -1
- package/dist/assets/{CronManager-Cw8OcnzF.js → CronManager-BFVFYGxc.js} +1 -1
- package/dist/assets/IntegrationsPage-DRbbUsum.js +1 -0
- package/dist/assets/LinearOAuthSettingsPage-DbqiQRYU.js +1 -0
- package/dist/assets/{LinearSettingsPage-BONvvBRX.js → LinearSettingsPage-C9QVub6_.js} +1 -1
- package/dist/assets/{Playground-B67oLDsO.js → Playground-BYihPEC9.js} +1 -1
- package/dist/assets/{PromptsPage-DGVNZ4EK.js → PromptsPage-Cnhv4Der.js} +2 -2
- package/dist/assets/RunsPage-NVlYvNqV.js +1 -0
- package/dist/assets/{SandboxManager-DvqoPHRO.js → SandboxManager-BKkKy3p4.js} +3 -3
- package/dist/assets/{SettingsPage-BnilFAKh.js → SettingsPage-B9jbUi7A.js} +1 -1
- package/dist/assets/{TailscalePage-B5CjZmMq.js → TailscalePage-Dj5FOGz6.js} +1 -1
- package/dist/assets/index-DOmk_hhI.js +134 -0
- package/dist/assets/{sw-register-8kM_U9f_.js → sw-register-exbRbynw.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/sw.js +1 -1
- package/package.json +1 -1
- package/dist/assets/IntegrationsPage-B46jSjJS.js +0 -1
- package/dist/assets/LinearOAuthSettingsPage-wRchRw3P.js +0 -1
- package/dist/assets/RunsPage-C3gbsT0X.js +0 -1
- package/dist/assets/index-r7sVmMcw.js +0 -134
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
var FS=Object.defineProperty;var HS=(e,t,n)=>t in e?FS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var z1=(e,t,n)=>HS(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))i(l);new MutationObserver(l=>{for(const c of l)if(c.type==="childList")for(const u of c.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&i(u)}).observe(document,{childList:!0,subtree:!0});function n(l){const c={};return l.integrity&&(c.integrity=l.integrity),l.referrerPolicy&&(c.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?c.credentials="include":l.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function i(l){if(l.ep)return;l.ep=!0;const c=n(l);fetch(l.href,c)}})();const qS="modulepreload",IS=function(e){return"/"+e},L1={},Xn=function(t,n,i){let l=Promise.resolve();if(n&&n.length>0){let u=function(p){return Promise.all(p.map(g=>Promise.resolve(g).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),h=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));l=u(n.map(p=>{if(p=IS(p),p in L1)return;L1[p]=!0;const g=p.endsWith(".css"),v=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${v}`))return;const y=document.createElement("link");if(y.rel=g?"stylesheet":qS,g||(y.as="script"),y.crossOrigin="",y.href=p,h&&y.setAttribute("nonce",h),document.head.appendChild(y),g)return new Promise((b,_)=>{y.addEventListener("load",b),y.addEventListener("error",()=>_(new Error(`Unable to preload CSS for ${p}`)))})}))}function c(u){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=u,window.dispatchEvent(f),!f.defaultPrevented)throw u}return l.then(u=>{for(const f of u||[])f.status==="rejected"&&c(f.reason);return t().catch(c)})};function hg(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Jh={exports:{}},go={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var O1;function VS(){if(O1)return go;O1=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(i,l,c){var u=null;if(c!==void 0&&(u=""+c),l.key!==void 0&&(u=""+l.key),"key"in l){c={};for(var f in l)f!=="key"&&(c[f]=l[f])}else c=l;return l=c.ref,{$$typeof:e,type:i,key:u,ref:l!==void 0?l:null,props:c}}return go.Fragment=t,go.jsx=n,go.jsxs=n,go}var B1;function GS(){return B1||(B1=1,Jh.exports=VS()),Jh.exports}var a=GS(),ep={exports:{}},Ye={};/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react.production.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var $1;function YS(){if($1)return Ye;$1=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),c=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"),g=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),y=Symbol.iterator;function b(O){return O===null||typeof O!="object"?null:(O=y&&O[y]||O["@@iterator"],typeof O=="function"?O:null)}var _={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,T={};function j(O,Z,A){this.props=O,this.context=Z,this.refs=T,this.updater=A||_}j.prototype.isReactComponent={},j.prototype.setState=function(O,Z){if(typeof O!="object"&&typeof O!="function"&&O!=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,O,Z,"setState")},j.prototype.forceUpdate=function(O){this.updater.enqueueForceUpdate(this,O,"forceUpdate")};function R(){}R.prototype=j.prototype;function C(O,Z,A){this.props=O,this.context=Z,this.refs=T,this.updater=A||_}var P=C.prototype=new R;P.constructor=C,S(P,j.prototype),P.isPureReactComponent=!0;var z=Array.isArray;function D(){}var F={H:null,A:null,T:null,S:null},B=Object.prototype.hasOwnProperty;function I(O,Z,A){var fe=A.ref;return{$$typeof:e,type:O,key:Z,ref:fe!==void 0?fe:null,props:A}}function L(O,Z){return I(O.type,Z,O.props)}function q(O){return typeof O=="object"&&O!==null&&O.$$typeof===e}function E(O){var Z={"=":"=0",":":"=2"};return"$"+O.replace(/[=:]/g,function(A){return Z[A]})}var ae=/\/+/g;function K(O,Z){return typeof O=="object"&&O!==null&&O.key!=null?E(""+O.key):Z.toString(36)}function Y(O){switch(O.status){case"fulfilled":return O.value;case"rejected":throw O.reason;default:switch(typeof O.status=="string"?O.then(D,D):(O.status="pending",O.then(function(Z){O.status==="pending"&&(O.status="fulfilled",O.value=Z)},function(Z){O.status==="pending"&&(O.status="rejected",O.reason=Z)})),O.status){case"fulfilled":return O.value;case"rejected":throw O.reason}}throw O}function U(O,Z,A,fe,_e){var je=typeof O;(je==="undefined"||je==="boolean")&&(O=null);var De=!1;if(O===null)De=!0;else switch(je){case"bigint":case"string":case"number":De=!0;break;case"object":switch(O.$$typeof){case e:case t:De=!0;break;case g:return De=O._init,U(De(O._payload),Z,A,fe,_e)}}if(De)return _e=_e(O),De=fe===""?"."+K(O,0):fe,z(_e)?(A="",De!=null&&(A=De.replace(ae,"$&/")+"/"),U(_e,Z,A,"",function(Fe){return Fe})):_e!=null&&(q(_e)&&(_e=L(_e,A+(_e.key==null||O&&O.key===_e.key?"":(""+_e.key).replace(ae,"$&/")+"/")+De)),Z.push(_e)),1;De=0;var oe=fe===""?".":fe+":";if(z(O))for(var Ee=0;Ee<O.length;Ee++)fe=O[Ee],je=oe+K(fe,Ee),De+=U(fe,Z,A,je,_e);else if(Ee=b(O),typeof Ee=="function")for(O=Ee.call(O),Ee=0;!(fe=O.next()).done;)fe=fe.value,je=oe+K(fe,Ee++),De+=U(fe,Z,A,je,_e);else if(je==="object"){if(typeof O.then=="function")return U(Y(O),Z,A,fe,_e);throw Z=String(O),Error("Objects are not valid as a React child (found: "+(Z==="[object Object]"?"object with keys {"+Object.keys(O).join(", ")+"}":Z)+"). If you meant to render a collection of children, use an array instead.")}return De}function $(O,Z,A){if(O==null)return O;var fe=[],_e=0;return U(O,fe,"","",function(je){return Z.call(A,je,_e++)}),fe}function re(O){if(O._status===-1){var Z=O._result;Z=Z(),Z.then(function(A){(O._status===0||O._status===-1)&&(O._status=1,O._result=A)},function(A){(O._status===0||O._status===-1)&&(O._status=2,O._result=A)}),O._status===-1&&(O._status=0,O._result=Z)}if(O._status===1)return O._result.default;throw O._result}var xe=typeof reportError=="function"?reportError:function(O){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Z=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof O=="object"&&O!==null&&typeof O.message=="string"?String(O.message):String(O),error:O});if(!window.dispatchEvent(Z))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",O);return}console.error(O)},M={map:$,forEach:function(O,Z,A){$(O,function(){Z.apply(this,arguments)},A)},count:function(O){var Z=0;return $(O,function(){Z++}),Z},toArray:function(O){return $(O,function(Z){return Z})||[]},only:function(O){if(!q(O))throw Error("React.Children.only expected to receive a single React element child.");return O}};return Ye.Activity=v,Ye.Children=M,Ye.Component=j,Ye.Fragment=n,Ye.Profiler=l,Ye.PureComponent=C,Ye.StrictMode=i,Ye.Suspense=h,Ye.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=F,Ye.__COMPILER_RUNTIME={__proto__:null,c:function(O){return F.H.useMemoCache(O)}},Ye.cache=function(O){return function(){return O.apply(null,arguments)}},Ye.cacheSignal=function(){return null},Ye.cloneElement=function(O,Z,A){if(O==null)throw Error("The argument must be a React element, but you passed "+O+".");var fe=S({},O.props),_e=O.key;if(Z!=null)for(je in Z.key!==void 0&&(_e=""+Z.key),Z)!B.call(Z,je)||je==="key"||je==="__self"||je==="__source"||je==="ref"&&Z.ref===void 0||(fe[je]=Z[je]);var je=arguments.length-2;if(je===1)fe.children=A;else if(1<je){for(var De=Array(je),oe=0;oe<je;oe++)De[oe]=arguments[oe+2];fe.children=De}return I(O.type,_e,fe)},Ye.createContext=function(O){return O={$$typeof:u,_currentValue:O,_currentValue2:O,_threadCount:0,Provider:null,Consumer:null},O.Provider=O,O.Consumer={$$typeof:c,_context:O},O},Ye.createElement=function(O,Z,A){var fe,_e={},je=null;if(Z!=null)for(fe in Z.key!==void 0&&(je=""+Z.key),Z)B.call(Z,fe)&&fe!=="key"&&fe!=="__self"&&fe!=="__source"&&(_e[fe]=Z[fe]);var De=arguments.length-2;if(De===1)_e.children=A;else if(1<De){for(var oe=Array(De),Ee=0;Ee<De;Ee++)oe[Ee]=arguments[Ee+2];_e.children=oe}if(O&&O.defaultProps)for(fe in De=O.defaultProps,De)_e[fe]===void 0&&(_e[fe]=De[fe]);return I(O,je,_e)},Ye.createRef=function(){return{current:null}},Ye.forwardRef=function(O){return{$$typeof:f,render:O}},Ye.isValidElement=q,Ye.lazy=function(O){return{$$typeof:g,_payload:{_status:-1,_result:O},_init:re}},Ye.memo=function(O,Z){return{$$typeof:p,type:O,compare:Z===void 0?null:Z}},Ye.startTransition=function(O){var Z=F.T,A={};F.T=A;try{var fe=O(),_e=F.S;_e!==null&&_e(A,fe),typeof fe=="object"&&fe!==null&&typeof fe.then=="function"&&fe.then(D,xe)}catch(je){xe(je)}finally{Z!==null&&A.types!==null&&(Z.types=A.types),F.T=Z}},Ye.unstable_useCacheRefresh=function(){return F.H.useCacheRefresh()},Ye.use=function(O){return F.H.use(O)},Ye.useActionState=function(O,Z,A){return F.H.useActionState(O,Z,A)},Ye.useCallback=function(O,Z){return F.H.useCallback(O,Z)},Ye.useContext=function(O){return F.H.useContext(O)},Ye.useDebugValue=function(){},Ye.useDeferredValue=function(O,Z){return F.H.useDeferredValue(O,Z)},Ye.useEffect=function(O,Z){return F.H.useEffect(O,Z)},Ye.useEffectEvent=function(O){return F.H.useEffectEvent(O)},Ye.useId=function(){return F.H.useId()},Ye.useImperativeHandle=function(O,Z,A){return F.H.useImperativeHandle(O,Z,A)},Ye.useInsertionEffect=function(O,Z){return F.H.useInsertionEffect(O,Z)},Ye.useLayoutEffect=function(O,Z){return F.H.useLayoutEffect(O,Z)},Ye.useMemo=function(O,Z){return F.H.useMemo(O,Z)},Ye.useOptimistic=function(O,Z){return F.H.useOptimistic(O,Z)},Ye.useReducer=function(O,Z,A){return F.H.useReducer(O,Z,A)},Ye.useRef=function(O){return F.H.useRef(O)},Ye.useState=function(O){return F.H.useState(O)},Ye.useSyncExternalStore=function(O,Z,A){return F.H.useSyncExternalStore(O,Z,A)},Ye.useTransition=function(){return F.H.useTransition()},Ye.version="19.2.7",Ye}var P1;function pg(){return P1||(P1=1,ep.exports=YS()),ep.exports}var k=pg();const Du=hg(k);var tp={exports:{}},xo={},np={exports:{}},rp={};/**
|
|
18
|
+
* @license React
|
|
19
|
+
* scheduler.production.js
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the MIT license found in the
|
|
24
|
+
* LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/var U1;function WS(){return U1||(U1=1,(function(e){function t(U,$){var re=U.length;U.push($);e:for(;0<re;){var xe=re-1>>>1,M=U[xe];if(0<l(M,$))U[xe]=$,U[re]=M,re=xe;else break e}}function n(U){return U.length===0?null:U[0]}function i(U){if(U.length===0)return null;var $=U[0],re=U.pop();if(re!==$){U[0]=re;e:for(var xe=0,M=U.length,O=M>>>1;xe<O;){var Z=2*(xe+1)-1,A=U[Z],fe=Z+1,_e=U[fe];if(0>l(A,re))fe<M&&0>l(_e,A)?(U[xe]=_e,U[fe]=re,xe=fe):(U[xe]=A,U[Z]=re,xe=Z);else if(fe<M&&0>l(_e,re))U[xe]=_e,U[fe]=re,xe=fe;else break e}}return $}function l(U,$){var re=U.sortIndex-$.sortIndex;return re!==0?re:U.id-$.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var u=Date,f=u.now();e.unstable_now=function(){return u.now()-f}}var h=[],p=[],g=1,v=null,y=3,b=!1,_=!1,S=!1,T=!1,j=typeof setTimeout=="function"?setTimeout:null,R=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;function P(U){for(var $=n(p);$!==null;){if($.callback===null)i(p);else if($.startTime<=U)i(p),$.sortIndex=$.expirationTime,t(h,$);else break;$=n(p)}}function z(U){if(S=!1,P(U),!_)if(n(h)!==null)_=!0,D||(D=!0,E());else{var $=n(p);$!==null&&Y(z,$.startTime-U)}}var D=!1,F=-1,B=5,I=-1;function L(){return T?!0:!(e.unstable_now()-I<B)}function q(){if(T=!1,D){var U=e.unstable_now();I=U;var $=!0;try{e:{_=!1,S&&(S=!1,R(F),F=-1),b=!0;var re=y;try{t:{for(P(U),v=n(h);v!==null&&!(v.expirationTime>U&&L());){var xe=v.callback;if(typeof xe=="function"){v.callback=null,y=v.priorityLevel;var M=xe(v.expirationTime<=U);if(U=e.unstable_now(),typeof M=="function"){v.callback=M,P(U),$=!0;break t}v===n(h)&&i(h),P(U)}else i(h);v=n(h)}if(v!==null)$=!0;else{var O=n(p);O!==null&&Y(z,O.startTime-U),$=!1}}break e}finally{v=null,y=re,b=!1}$=void 0}}finally{$?E():D=!1}}}var E;if(typeof C=="function")E=function(){C(q)};else if(typeof MessageChannel<"u"){var ae=new MessageChannel,K=ae.port2;ae.port1.onmessage=q,E=function(){K.postMessage(null)}}else E=function(){j(q,0)};function Y(U,$){F=j(function(){U(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(U){U.callback=null},e.unstable_forceFrameRate=function(U){0>U||125<U?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):B=0<U?Math.floor(1e3/U):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_next=function(U){switch(y){case 1:case 2:case 3:var $=3;break;default:$=y}var re=y;y=$;try{return U()}finally{y=re}},e.unstable_requestPaint=function(){T=!0},e.unstable_runWithPriority=function(U,$){switch(U){case 1:case 2:case 3:case 4:case 5:break;default:U=3}var re=y;y=U;try{return $()}finally{y=re}},e.unstable_scheduleCallback=function(U,$,re){var xe=e.unstable_now();switch(typeof re=="object"&&re!==null?(re=re.delay,re=typeof re=="number"&&0<re?xe+re:xe):re=xe,U){case 1:var M=-1;break;case 2:M=250;break;case 5:M=1073741823;break;case 4:M=1e4;break;default:M=5e3}return M=re+M,U={id:g++,callback:$,priorityLevel:U,startTime:re,expirationTime:M,sortIndex:-1},re>xe?(U.sortIndex=re,t(p,U),n(h)===null&&U===n(p)&&(S?(R(F),F=-1):S=!0,Y(z,re-xe))):(U.sortIndex=M,t(h,U),_||b||(_=!0,D||(D=!0,E()))),U},e.unstable_shouldYield=L,e.unstable_wrapCallback=function(U){var $=y;return function(){var re=y;y=$;try{return U.apply(this,arguments)}finally{y=re}}}})(rp)),rp}var F1;function XS(){return F1||(F1=1,np.exports=WS()),np.exports}var ip={exports:{}},En={};/**
|
|
26
|
+
* @license React
|
|
27
|
+
* react-dom.production.js
|
|
28
|
+
*
|
|
29
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the MIT license found in the
|
|
32
|
+
* LICENSE file in the root directory of this source tree.
|
|
33
|
+
*/var H1;function QS(){if(H1)return En;H1=1;var e=pg();function t(h){var p="https://react.dev/errors/"+h;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)p+="&args[]="+encodeURIComponent(arguments[g])}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 i={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},l=Symbol.for("react.portal");function c(h,p,g){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:l,key:v==null?null:""+v,children:h,containerInfo:p,implementation:g}}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 En.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,En.createPortal=function(h,p){var g=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 c(h,p,null,g)},En.flushSync=function(h){var p=u.T,g=i.p;try{if(u.T=null,i.p=2,h)return h()}finally{u.T=p,i.p=g,i.d.f()}},En.preconnect=function(h,p){typeof h=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,i.d.C(h,p))},En.prefetchDNS=function(h){typeof h=="string"&&i.d.D(h)},En.preinit=function(h,p){if(typeof h=="string"&&p&&typeof p.as=="string"){var g=p.as,v=f(g,p.crossOrigin),y=typeof p.integrity=="string"?p.integrity:void 0,b=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;g==="style"?i.d.S(h,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:v,integrity:y,fetchPriority:b}):g==="script"&&i.d.X(h,{crossOrigin:v,integrity:y,fetchPriority:b,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},En.preinitModule=function(h,p){if(typeof h=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var g=f(p.as,p.crossOrigin);i.d.M(h,{crossOrigin:g,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&i.d.M(h)},En.preload=function(h,p){if(typeof h=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var g=p.as,v=f(g,p.crossOrigin);i.d.L(h,g,{crossOrigin:v,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})}},En.preloadModule=function(h,p){if(typeof h=="string")if(p){var g=f(p.as,p.crossOrigin);i.d.m(h,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:g,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else i.d.m(h)},En.requestFormReset=function(h){i.d.r(h)},En.unstable_batchedUpdates=function(h,p){return h(p)},En.useFormState=function(h,p,g){return u.H.useFormState(h,p,g)},En.useFormStatus=function(){return u.H.useHostTransitionStatus()},En.version="19.2.7",En}var q1;function C5(){if(q1)return ip.exports;q1=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(),ip.exports=QS(),ip.exports}/**
|
|
34
|
+
* @license React
|
|
35
|
+
* react-dom-client.production.js
|
|
36
|
+
*
|
|
37
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
38
|
+
*
|
|
39
|
+
* This source code is licensed under the MIT license found in the
|
|
40
|
+
* LICENSE file in the root directory of this source tree.
|
|
41
|
+
*/var I1;function KS(){if(I1)return xo;I1=1;var e=XS(),t=pg(),n=C5();function i(r){var s="https://react.dev/errors/"+r;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var o=2;o<arguments.length;o++)s+="&args[]="+encodeURIComponent(arguments[o])}return"Minified React error #"+r+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function c(r){var s=r,o=r;if(r.alternate)for(;s.return;)s=s.return;else{r=s;do s=r,(s.flags&4098)!==0&&(o=s.return),r=s.return;while(r)}return s.tag===3?o:null}function u(r){if(r.tag===13){var s=r.memoizedState;if(s===null&&(r=r.alternate,r!==null&&(s=r.memoizedState)),s!==null)return s.dehydrated}return null}function f(r){if(r.tag===31){var s=r.memoizedState;if(s===null&&(r=r.alternate,r!==null&&(s=r.memoizedState)),s!==null)return s.dehydrated}return null}function h(r){if(c(r)!==r)throw Error(i(188))}function p(r){var s=r.alternate;if(!s){if(s=c(r),s===null)throw Error(i(188));return s!==r?null:r}for(var o=r,d=s;;){var m=o.return;if(m===null)break;var x=m.alternate;if(x===null){if(d=m.return,d!==null){o=d;continue}break}if(m.child===x.child){for(x=m.child;x;){if(x===o)return h(m),r;if(x===d)return h(m),s;x=x.sibling}throw Error(i(188))}if(o.return!==d.return)o=m,d=x;else{for(var w=!1,N=m.child;N;){if(N===o){w=!0,o=m,d=x;break}if(N===d){w=!0,d=m,o=x;break}N=N.sibling}if(!w){for(N=x.child;N;){if(N===o){w=!0,o=x,d=m;break}if(N===d){w=!0,d=x,o=m;break}N=N.sibling}if(!w)throw Error(i(189))}}if(o.alternate!==d)throw Error(i(190))}if(o.tag!==3)throw Error(i(188));return o.stateNode.current===o?r:s}function g(r){var s=r.tag;if(s===5||s===26||s===27||s===6)return r;for(r=r.child;r!==null;){if(s=g(r),s!==null)return s;r=r.sibling}return null}var v=Object.assign,y=Symbol.for("react.element"),b=Symbol.for("react.transitional.element"),_=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),j=Symbol.for("react.profiler"),R=Symbol.for("react.consumer"),C=Symbol.for("react.context"),P=Symbol.for("react.forward_ref"),z=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),F=Symbol.for("react.memo"),B=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),L=Symbol.for("react.memo_cache_sentinel"),q=Symbol.iterator;function E(r){return r===null||typeof r!="object"?null:(r=q&&r[q]||r["@@iterator"],typeof r=="function"?r:null)}var ae=Symbol.for("react.client.reference");function K(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===ae?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case S:return"Fragment";case j:return"Profiler";case T:return"StrictMode";case z:return"Suspense";case D:return"SuspenseList";case I:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case _:return"Portal";case C:return r.displayName||"Context";case R:return(r._context.displayName||"Context")+".Consumer";case P:var s=r.render;return r=r.displayName,r||(r=s.displayName||s.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case F:return s=r.displayName||null,s!==null?s:K(r.type)||"Memo";case B:s=r._payload,r=r._init;try{return K(r(s))}catch{}}return null}var Y=Array.isArray,U=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,re={pending:!1,data:null,method:null,action:null},xe=[],M=-1;function O(r){return{current:r}}function Z(r){0>M||(r.current=xe[M],xe[M]=null,M--)}function A(r,s){M++,xe[M]=r.current,r.current=s}var fe=O(null),_e=O(null),je=O(null),De=O(null);function oe(r,s){switch(A(je,s),A(_e,r),A(fe,null),s.nodeType){case 9:case 11:r=(r=s.documentElement)&&(r=r.namespaceURI)?r1(r):0;break;default:if(r=s.tagName,s=s.namespaceURI)s=r1(s),r=i1(s,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}Z(fe),A(fe,r)}function Ee(){Z(fe),Z(_e),Z(je)}function Fe(r){r.memoizedState!==null&&A(De,r);var s=fe.current,o=i1(s,r.type);s!==o&&(A(_e,r),A(fe,o))}function At(r){_e.current===r&&(Z(fe),Z(_e)),De.current===r&&(Z(De),fo._currentValue=re)}var Ze,Mt;function vt(r){if(Ze===void 0)try{throw Error()}catch(o){var s=o.stack.trim().match(/\n( *(at )?)/);Ze=s&&s[1]||"",Mt=-1<o.stack.indexOf(`
|
|
42
|
+
at`)?" (<anonymous>)":-1<o.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
+
`+Ze+r+Mt}var qe=!1;function Pt(r,s){if(!r||qe)return"";qe=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(s){var de=function(){throw Error()};if(Object.defineProperty(de.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(de,[])}catch(se){var ne=se}Reflect.construct(r,[],de)}else{try{de.call()}catch(se){ne=se}r.call(de.prototype)}}else{try{throw Error()}catch(se){ne=se}(de=r())&&typeof de.catch=="function"&&de.catch(function(){})}}catch(se){if(se&&ne&&typeof se.stack=="string")return[se.stack,ne.stack]}return[null,null]}};d.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var m=Object.getOwnPropertyDescriptor(d.DetermineComponentFrameRoot,"name");m&&m.configurable&&Object.defineProperty(d.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var x=d.DetermineComponentFrameRoot(),w=x[0],N=x[1];if(w&&N){var H=w.split(`
|
|
44
|
+
`),te=N.split(`
|
|
45
|
+
`);for(m=d=0;d<H.length&&!H[d].includes("DetermineComponentFrameRoot");)d++;for(;m<te.length&&!te[m].includes("DetermineComponentFrameRoot");)m++;if(d===H.length||m===te.length)for(d=H.length-1,m=te.length-1;1<=d&&0<=m&&H[d]!==te[m];)m--;for(;1<=d&&0<=m;d--,m--)if(H[d]!==te[m]){if(d!==1||m!==1)do if(d--,m--,0>m||H[d]!==te[m]){var ce=`
|
|
46
|
+
`+H[d].replace(" at new "," at ");return r.displayName&&ce.includes("<anonymous>")&&(ce=ce.replace("<anonymous>",r.displayName)),ce}while(1<=d&&0<=m);break}}}finally{qe=!1,Error.prepareStackTrace=o}return(o=r?r.displayName||r.name:"")?vt(o):""}function vn(r,s){switch(r.tag){case 26:case 27:case 5:return vt(r.type);case 16:return vt("Lazy");case 13:return r.child!==s&&s!==null?vt("Suspense Fallback"):vt("Suspense");case 19:return vt("SuspenseList");case 0:case 15:return Pt(r.type,!1);case 11:return Pt(r.type.render,!1);case 1:return Pt(r.type,!0);case 31:return vt("Activity");default:return""}}function un(r){try{var s="",o=null;do s+=vn(r,o),o=r,r=r.return;while(r);return s}catch(d){return`
|
|
47
|
+
Error generating stack: `+d.message+`
|
|
48
|
+
`+d.stack}}var tn=Object.prototype.hasOwnProperty,nn=e.unstable_scheduleCallback,ke=e.unstable_cancelCallback,ze=e.unstable_shouldYield,ot=e.unstable_requestPaint,Pe=e.unstable_now,bn=e.unstable_getCurrentPriorityLevel,le=e.unstable_ImmediatePriority,be=e.unstable_UserBlockingPriority,W=e.unstable_NormalPriority,he=e.unstable_LowPriority,Ae=e.unstable_IdlePriority,ut=e.log,Qe=e.unstable_setDisableYieldValue,Je=null,gt=null;function Ut(r){if(typeof ut=="function"&&Qe(r),gt&&typeof gt.setStrictMode=="function")try{gt.setStrictMode(Je,r)}catch{}}var J=Math.clz32?Math.clz32:Ke,pe=Math.log,me=Math.LN2;function Ke(r){return r>>>=0,r===0?32:31-(pe(r)/me|0)|0}var _t=256,xt=262144,$n=4194304;function Rt(r){var s=r&42;if(s!==0)return s;switch(r&-r){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 r&261888;case 262144:case 524288:case 1048576:case 2097152:return r&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return r&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return r}}function Cn(r,s,o){var d=r.pendingLanes;if(d===0)return 0;var m=0,x=r.suspendedLanes,w=r.pingedLanes;r=r.warmLanes;var N=d&134217727;return N!==0?(d=N&~x,d!==0?m=Rt(d):(w&=N,w!==0?m=Rt(w):o||(o=N&~r,o!==0&&(m=Rt(o))))):(N=d&~x,N!==0?m=Rt(N):w!==0?m=Rt(w):o||(o=d&~r,o!==0&&(m=Rt(o)))),m===0?0:s!==0&&s!==m&&(s&x)===0&&(x=m&-m,o=s&-s,x>=o||x===32&&(o&4194048)!==0)?s:m}function Er(r,s){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&s)===0}function Ri(r,s){switch(r){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 bl(){var r=$n;return $n<<=1,($n&62914560)===0&&($n=4194304),r}function Br(r){for(var s=[],o=0;31>o;o++)s.push(r);return s}function bs(r,s){r.pendingLanes|=s,s!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function Xd(r,s,o,d,m,x){var w=r.pendingLanes;r.pendingLanes=o,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=o,r.entangledLanes&=o,r.errorRecoveryDisabledLanes&=o,r.shellSuspendCounter=0;var N=r.entanglements,H=r.expirationTimes,te=r.hiddenUpdates;for(o=w&~o;0<o;){var ce=31-J(o),de=1<<ce;N[ce]=0,H[ce]=-1;var ne=te[ce];if(ne!==null)for(te[ce]=null,ce=0;ce<ne.length;ce++){var se=ne[ce];se!==null&&(se.lane&=-536870913)}o&=~de}d!==0&&Di(r,d,0),x!==0&&m===0&&r.tag!==0&&(r.suspendedLanes|=x&~(w&~s))}function Di(r,s,o){r.pendingLanes|=s,r.suspendedLanes&=~s;var d=31-J(s);r.entangledLanes|=s,r.entanglements[d]=r.entanglements[d]|1073741824|o&261930}function ys(r,s){var o=r.entangledLanes|=s;for(r=r.entanglements;o;){var d=31-J(o),m=1<<d;m&s|r[d]&s&&(r[d]|=s),o&=~m}}function _s(r,s){var o=s&-s;return o=(o&42)!==0?1:zi(o),(o&(r.suspendedLanes|s))!==0?0:o}function zi(r){switch(r){case 2:r=1;break;case 8:r=4;break;case 32:r=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:r=128;break;case 268435456:r=134217728;break;default:r=0}return r}function la(r){return r&=-r,2<r?8<r?(r&134217727)!==0?32:268435456:8:2}function $r(){var r=$.p;return r!==0?r:(r=window.event,r===void 0?32:C1(r.type))}function _c(r,s){var o=$.p;try{return $.p=r,s()}finally{$.p=o}}var dr=Math.random().toString(36).slice(2),Wt="__reactFiber$"+dr,Dt="__reactProps$"+dr,Pr="__reactContainer$"+dr,ws="__reactEvents$"+dr,yl="__reactListeners$"+dr,wc="__reactHandles$"+dr,Gt="__reactResources$"+dr,ks="__reactMarker$"+dr;function oa(r){delete r[Wt],delete r[Dt],delete r[ws],delete r[yl],delete r[wc]}function Li(r){var s=r[Wt];if(s)return s;for(var o=r.parentNode;o;){if(s=o[Pr]||o[Wt]){if(o=s.alternate,s.child!==null||o!==null&&o.child!==null)for(r=d1(r);r!==null;){if(o=r[Wt])return o;r=d1(r)}return s}r=o,o=r.parentNode}return null}function Oi(r){if(r=r[Wt]||r[Pr]){var s=r.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return r}return null}function Ss(r){var s=r.tag;if(s===5||s===26||s===27||s===6)return r.stateNode;throw Error(i(33))}function Ur(r){var s=r[Gt];return s||(s=r[Gt]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function Zt(r){r[ks]=!0}var Fr=new Set,ca={};function pn(r,s){Rn(r,s),Rn(r+"Capture",s)}function Rn(r,s){for(ca[r]=s,r=0;r<s.length;r++)Fr.add(s[r])}var _l=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]*$"),kc={},wl={};function Qd(r){return tn.call(wl,r)?!0:tn.call(kc,r)?!1:_l.test(r)?wl[r]=!0:(kc[r]=!0,!1)}function Bi(r,s,o){if(Qd(s))if(o===null)r.removeAttribute(s);else{switch(typeof o){case"undefined":case"function":case"symbol":r.removeAttribute(s);return;case"boolean":var d=s.toLowerCase().slice(0,5);if(d!=="data-"&&d!=="aria-"){r.removeAttribute(s);return}}r.setAttribute(s,""+o)}}function js(r,s,o){if(o===null)r.removeAttribute(s);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(s);return}r.setAttribute(s,""+o)}}function Tr(r,s,o,d){if(d===null)r.removeAttribute(o);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(o);return}r.setAttributeNS(s,o,""+d)}}function Pn(r){switch(typeof r){case"bigint":case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function Sc(r){var s=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function Kd(r,s,o){var d=Object.getOwnPropertyDescriptor(r.constructor.prototype,s);if(!r.hasOwnProperty(s)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var m=d.get,x=d.set;return Object.defineProperty(r,s,{configurable:!0,get:function(){return m.call(this)},set:function(w){o=""+w,x.call(this,w)}}),Object.defineProperty(r,s,{enumerable:d.enumerable}),{getValue:function(){return o},setValue:function(w){o=""+w},stopTracking:function(){r._valueTracker=null,delete r[s]}}}}function ua(r){if(!r._valueTracker){var s=Sc(r)?"checked":"value";r._valueTracker=Kd(r,s,""+r[s])}}function kl(r){if(!r)return!1;var s=r._valueTracker;if(!s)return!0;var o=s.getValue(),d="";return r&&(d=Sc(r)?r.checked?"true":"false":r.value),r=d,r!==o?(s.setValue(r),!0):!1}function da(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}var Zd=/[\n"\\]/g;function Dn(r){return r.replace(Zd,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function $i(r,s,o,d,m,x,w,N){r.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?r.type=w:r.removeAttribute("type"),s!=null?w==="number"?(s===0&&r.value===""||r.value!=s)&&(r.value=""+Pn(s)):r.value!==""+Pn(s)&&(r.value=""+Pn(s)):w!=="submit"&&w!=="reset"||r.removeAttribute("value"),s!=null?jl(r,w,Pn(s)):o!=null?jl(r,w,Pn(o)):d!=null&&r.removeAttribute("value"),m==null&&x!=null&&(r.defaultChecked=!!x),m!=null&&(r.checked=m&&typeof m!="function"&&typeof m!="symbol"),N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?r.name=""+Pn(N):r.removeAttribute("name")}function Sl(r,s,o,d,m,x,w,N){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(r.type=x),s!=null||o!=null){if(!(x!=="submit"&&x!=="reset"||s!=null)){ua(r);return}o=o!=null?""+Pn(o):"",s=s!=null?""+Pn(s):o,N||s===r.value||(r.value=s),r.defaultValue=s}d=d??m,d=typeof d!="function"&&typeof d!="symbol"&&!!d,r.checked=N?r.checked:!!d,r.defaultChecked=!!d,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(r.name=w),ua(r)}function jl(r,s,o){s==="number"&&da(r.ownerDocument)===r||r.defaultValue===""+o||(r.defaultValue=""+o)}function Pi(r,s,o,d){if(r=r.options,s){s={};for(var m=0;m<o.length;m++)s["$"+o[m]]=!0;for(o=0;o<r.length;o++)m=s.hasOwnProperty("$"+r[o].value),r[o].selected!==m&&(r[o].selected=m),m&&d&&(r[o].defaultSelected=!0)}else{for(o=""+Pn(o),s=null,m=0;m<r.length;m++){if(r[m].value===o){r[m].selected=!0,d&&(r[m].defaultSelected=!0);return}s!==null||r[m].disabled||(s=r[m])}s!==null&&(s.selected=!0)}}function jc(r,s,o){if(s!=null&&(s=""+Pn(s),s!==r.value&&(r.value=s),o==null)){r.defaultValue!==s&&(r.defaultValue=s);return}r.defaultValue=o!=null?""+Pn(o):""}function Nc(r,s,o,d){if(s==null){if(d!=null){if(o!=null)throw Error(i(92));if(Y(d)){if(1<d.length)throw Error(i(93));d=d[0]}o=d}o==null&&(o=""),s=o}o=Pn(s),r.defaultValue=o,d=r.textContent,d===o&&d!==""&&d!==null&&(r.value=d),ua(r)}function Ui(r,s){if(s){var o=r.firstChild;if(o&&o===r.lastChild&&o.nodeType===3){o.nodeValue=s;return}}r.textContent=s}var Jd=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 Nl(r,s,o){var d=s.indexOf("--")===0;o==null||typeof o=="boolean"||o===""?d?r.setProperty(s,""):s==="float"?r.cssFloat="":r[s]="":d?r.setProperty(s,o):typeof o!="number"||o===0||Jd.has(s)?s==="float"?r.cssFloat=o:r[s]=(""+o).trim():r[s]=o+"px"}function Cl(r,s,o){if(s!=null&&typeof s!="object")throw Error(i(62));if(r=r.style,o!=null){for(var d in o)!o.hasOwnProperty(d)||s!=null&&s.hasOwnProperty(d)||(d.indexOf("--")===0?r.setProperty(d,""):d==="float"?r.cssFloat="":r[d]="");for(var m in s)d=s[m],s.hasOwnProperty(m)&&o[m]!==d&&Nl(r,m,d)}else for(var x in s)s.hasOwnProperty(x)&&Nl(r,x,s[x])}function fa(r){if(r.indexOf("-")===-1)return!1;switch(r){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 Cc=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"]]),G=/^[\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 ge(r){return G.test(""+r)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":r}function Ve(){}var ft=null;function st(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var Be=null,dn=null;function Ns(r){var s=Oi(r);if(s&&(r=s.stateNode)){var o=r[Dt]||null;e:switch(r=s.stateNode,s.type){case"input":if($i(r,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name),s=o.name,o.type==="radio"&&s!=null){for(o=r;o.parentNode;)o=o.parentNode;for(o=o.querySelectorAll('input[name="'+Dn(""+s)+'"][type="radio"]'),s=0;s<o.length;s++){var d=o[s];if(d!==r&&d.form===r.form){var m=d[Dt]||null;if(!m)throw Error(i(90));$i(d,m.value,m.defaultValue,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name)}}for(s=0;s<o.length;s++)d=o[s],d.form===r.form&&kl(d)}break e;case"textarea":jc(r,o.value,o.defaultValue);break e;case"select":s=o.value,s!=null&&Pi(r,!!o.multiple,s,!1)}}}var Fi=!1;function Cs(r,s,o){if(Fi)return r(s,o);Fi=!0;try{var d=r(s);return d}finally{if(Fi=!1,(Be!==null||dn!==null)&&(du(),Be&&(s=Be,r=dn,dn=Be=null,Ns(s),r)))for(s=0;s<r.length;s++)Ns(r[s])}}function mn(r,s){var o=r.stateNode;if(o===null)return null;var d=o[Dt]||null;if(d===null)return null;o=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)||(r=r.type,d=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!d;break e;default:r=!1}if(r)return null;if(o&&typeof o!="function")throw Error(i(231,s,typeof o));return o}var fr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),El=!1;if(fr)try{var Es={};Object.defineProperty(Es,"passive",{get:function(){El=!0}}),window.addEventListener("test",Es,Es),window.removeEventListener("test",Es,Es)}catch{El=!1}var Hr=null,ha=null,Ar=null;function Tl(){if(Ar)return Ar;var r,s=ha,o=s.length,d,m="value"in Hr?Hr.value:Hr.textContent,x=m.length;for(r=0;r<o&&s[r]===m[r];r++);var w=o-r;for(d=1;d<=w&&s[o-d]===m[x-d];d++);return Ar=m.slice(r,1<d?1-d:void 0)}function Ts(r){var s=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&s===13&&(r=13)):r=s,r===10&&(r=13),32<=r||r===13?r:0}function ni(){return!0}function sx(){return!1}function Un(r){function s(o,d,m,x,w){this._reactName=o,this._targetInst=m,this.type=d,this.nativeEvent=x,this.target=w,this.currentTarget=null;for(var N in r)r.hasOwnProperty(N)&&(o=r[N],this[N]=o?o(x):x[N]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?ni:sx,this.isPropagationStopped=sx,this}return v(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var o=this.nativeEvent;o&&(o.preventDefault?o.preventDefault():typeof o.returnValue!="unknown"&&(o.returnValue=!1),this.isDefaultPrevented=ni)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=ni)},persist:function(){},isPersistent:ni}),s}var As={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ec=Un(As),Al=v({},As,{view:0,detail:0}),P2=Un(Al),ef,tf,Ml,Tc=v({},Al,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:rf,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==Ml&&(Ml&&r.type==="mousemove"?(ef=r.screenX-Ml.screenX,tf=r.screenY-Ml.screenY):tf=ef=0,Ml=r),ef)},movementY:function(r){return"movementY"in r?r.movementY:tf}}),ax=Un(Tc),U2=v({},Tc,{dataTransfer:0}),F2=Un(U2),H2=v({},Al,{relatedTarget:0}),nf=Un(H2),q2=v({},As,{animationName:0,elapsedTime:0,pseudoElement:0}),I2=Un(q2),V2=v({},As,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),G2=Un(V2),Y2=v({},As,{data:0}),lx=Un(Y2),W2={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},X2={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"},Q2={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function K2(r){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(r):(r=Q2[r])?!!s[r]:!1}function rf(){return K2}var Z2=v({},Al,{key:function(r){if(r.key){var s=W2[r.key]||r.key;if(s!=="Unidentified")return s}return r.type==="keypress"?(r=Ts(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?X2[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:rf,charCode:function(r){return r.type==="keypress"?Ts(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?Ts(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),J2=Un(Z2),ek=v({},Tc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ox=Un(ek),tk=v({},Al,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:rf}),nk=Un(tk),rk=v({},As,{propertyName:0,elapsedTime:0,pseudoElement:0}),ik=Un(rk),sk=v({},Tc,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),ak=Un(sk),lk=v({},As,{newState:0,oldState:0}),ok=Un(lk),ck=[9,13,27,32],sf=fr&&"CompositionEvent"in window,Rl=null;fr&&"documentMode"in document&&(Rl=document.documentMode);var uk=fr&&"TextEvent"in window&&!Rl,cx=fr&&(!sf||Rl&&8<Rl&&11>=Rl),ux=" ",dx=!1;function fx(r,s){switch(r){case"keyup":return ck.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function hx(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var pa=!1;function dk(r,s){switch(r){case"compositionend":return hx(s);case"keypress":return s.which!==32?null:(dx=!0,ux);case"textInput":return r=s.data,r===ux&&dx?null:r;default:return null}}function fk(r,s){if(pa)return r==="compositionend"||!sf&&fx(r,s)?(r=Tl(),Ar=ha=Hr=null,pa=!1,r):null;switch(r){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 cx&&s.locale!=="ko"?null:s.data;default:return null}}var hk={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 px(r){var s=r&&r.nodeName&&r.nodeName.toLowerCase();return s==="input"?!!hk[r.type]:s==="textarea"}function mx(r,s,o,d){Be?dn?dn.push(d):dn=[d]:Be=d,s=vu(s,"onChange"),0<s.length&&(o=new Ec("onChange","change",null,o,d),r.push({event:o,listeners:s}))}var Dl=null,zl=null;function pk(r){Kv(r,0)}function Ac(r){var s=Ss(r);if(kl(s))return r}function gx(r,s){if(r==="change")return s}var xx=!1;if(fr){var af;if(fr){var lf="oninput"in document;if(!lf){var vx=document.createElement("div");vx.setAttribute("oninput","return;"),lf=typeof vx.oninput=="function"}af=lf}else af=!1;xx=af&&(!document.documentMode||9<document.documentMode)}function bx(){Dl&&(Dl.detachEvent("onpropertychange",yx),zl=Dl=null)}function yx(r){if(r.propertyName==="value"&&Ac(zl)){var s=[];mx(s,zl,r,st(r)),Cs(pk,s)}}function mk(r,s,o){r==="focusin"?(bx(),Dl=s,zl=o,Dl.attachEvent("onpropertychange",yx)):r==="focusout"&&bx()}function gk(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return Ac(zl)}function xk(r,s){if(r==="click")return Ac(s)}function vk(r,s){if(r==="input"||r==="change")return Ac(s)}function bk(r,s){return r===s&&(r!==0||1/r===1/s)||r!==r&&s!==s}var Kn=typeof Object.is=="function"?Object.is:bk;function Ll(r,s){if(Kn(r,s))return!0;if(typeof r!="object"||r===null||typeof s!="object"||s===null)return!1;var o=Object.keys(r),d=Object.keys(s);if(o.length!==d.length)return!1;for(d=0;d<o.length;d++){var m=o[d];if(!tn.call(s,m)||!Kn(r[m],s[m]))return!1}return!0}function _x(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function wx(r,s){var o=_x(r);r=0;for(var d;o;){if(o.nodeType===3){if(d=r+o.textContent.length,r<=s&&d>=s)return{node:o,offset:s-r};r=d}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=_x(o)}}function kx(r,s){return r&&s?r===s?!0:r&&r.nodeType===3?!1:s&&s.nodeType===3?kx(r,s.parentNode):"contains"in r?r.contains(s):r.compareDocumentPosition?!!(r.compareDocumentPosition(s)&16):!1:!1}function Sx(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var s=da(r.document);s instanceof r.HTMLIFrameElement;){try{var o=typeof s.contentWindow.location.href=="string"}catch{o=!1}if(o)r=s.contentWindow;else break;s=da(r.document)}return s}function of(r){var s=r&&r.nodeName&&r.nodeName.toLowerCase();return s&&(s==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||s==="textarea"||r.contentEditable==="true")}var yk=fr&&"documentMode"in document&&11>=document.documentMode,ma=null,cf=null,Ol=null,uf=!1;function jx(r,s,o){var d=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;uf||ma==null||ma!==da(d)||(d=ma,"selectionStart"in d&&of(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}),Ol&&Ll(Ol,d)||(Ol=d,d=vu(cf,"onSelect"),0<d.length&&(s=new Ec("onSelect","select",null,s,o),r.push({event:s,listeners:d}),s.target=ma)))}function Ms(r,s){var o={};return o[r.toLowerCase()]=s.toLowerCase(),o["Webkit"+r]="webkit"+s,o["Moz"+r]="moz"+s,o}var ga={animationend:Ms("Animation","AnimationEnd"),animationiteration:Ms("Animation","AnimationIteration"),animationstart:Ms("Animation","AnimationStart"),transitionrun:Ms("Transition","TransitionRun"),transitionstart:Ms("Transition","TransitionStart"),transitioncancel:Ms("Transition","TransitionCancel"),transitionend:Ms("Transition","TransitionEnd")},df={},Nx={};fr&&(Nx=document.createElement("div").style,"AnimationEvent"in window||(delete ga.animationend.animation,delete ga.animationiteration.animation,delete ga.animationstart.animation),"TransitionEvent"in window||delete ga.transitionend.transition);function Rs(r){if(df[r])return df[r];if(!ga[r])return r;var s=ga[r],o;for(o in s)if(s.hasOwnProperty(o)&&o in Nx)return df[r]=s[o];return r}var Cx=Rs("animationend"),Ex=Rs("animationiteration"),Tx=Rs("animationstart"),_k=Rs("transitionrun"),wk=Rs("transitionstart"),kk=Rs("transitioncancel"),Ax=Rs("transitionend"),Mx=new Map,ff="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(" ");ff.push("scrollEnd");function Mr(r,s){Mx.set(r,s),pn(s,[r])}var Mc=typeof reportError=="function"?reportError:function(r){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof r=="object"&&r!==null&&typeof r.message=="string"?String(r.message):String(r),error:r});if(!window.dispatchEvent(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",r);return}console.error(r)},hr=[],xa=0,hf=0;function Rc(){for(var r=xa,s=hf=xa=0;s<r;){var o=hr[s];hr[s++]=null;var d=hr[s];hr[s++]=null;var m=hr[s];hr[s++]=null;var x=hr[s];if(hr[s++]=null,d!==null&&m!==null){var w=d.pending;w===null?m.next=m:(m.next=w.next,w.next=m),d.pending=m}x!==0&&Rx(o,m,x)}}function Dc(r,s,o,d){hr[xa++]=r,hr[xa++]=s,hr[xa++]=o,hr[xa++]=d,hf|=d,r.lanes|=d,r=r.alternate,r!==null&&(r.lanes|=d)}function pf(r,s,o,d){return Dc(r,s,o,d),zc(r)}function Ds(r,s){return Dc(r,null,null,s),zc(r)}function Rx(r,s,o){r.lanes|=o;var d=r.alternate;d!==null&&(d.lanes|=o);for(var m=!1,x=r.return;x!==null;)x.childLanes|=o,d=x.alternate,d!==null&&(d.childLanes|=o),x.tag===22&&(r=x.stateNode,r===null||r._visibility&1||(m=!0)),r=x,x=x.return;return r.tag===3?(x=r.stateNode,m&&s!==null&&(m=31-J(o),r=x.hiddenUpdates,d=r[m],d===null?r[m]=[s]:d.push(s),s.lane=o|536870912),x):null}function zc(r){if(50<io)throw io=0,kh=null,Error(i(185));for(var s=r.return;s!==null;)r=s,s=r.return;return r.tag===3?r.stateNode:null}var va={};function Sk(r,s,o,d){this.tag=r,this.key=o,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=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 Zn(r,s,o,d){return new Sk(r,s,o,d)}function mf(r){return r=r.prototype,!(!r||!r.isReactComponent)}function ri(r,s){var o=r.alternate;return o===null?(o=Zn(r.tag,s,r.key,r.mode),o.elementType=r.elementType,o.type=r.type,o.stateNode=r.stateNode,o.alternate=r,r.alternate=o):(o.pendingProps=s,o.type=r.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=r.flags&65011712,o.childLanes=r.childLanes,o.lanes=r.lanes,o.child=r.child,o.memoizedProps=r.memoizedProps,o.memoizedState=r.memoizedState,o.updateQueue=r.updateQueue,s=r.dependencies,o.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},o.sibling=r.sibling,o.index=r.index,o.ref=r.ref,o.refCleanup=r.refCleanup,o}function Dx(r,s){r.flags&=65011714;var o=r.alternate;return o===null?(r.childLanes=0,r.lanes=s,r.child=null,r.subtreeFlags=0,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null,r.stateNode=null):(r.childLanes=o.childLanes,r.lanes=o.lanes,r.child=o.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=o.memoizedProps,r.memoizedState=o.memoizedState,r.updateQueue=o.updateQueue,r.type=o.type,s=o.dependencies,r.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),r}function Lc(r,s,o,d,m,x){var w=0;if(d=r,typeof r=="function")mf(r)&&(w=1);else if(typeof r=="string")w=TS(r,o,fe.current)?26:r==="html"||r==="head"||r==="body"?27:5;else e:switch(r){case I:return r=Zn(31,o,s,m),r.elementType=I,r.lanes=x,r;case S:return zs(o.children,m,x,s);case T:w=8,m|=24;break;case j:return r=Zn(12,o,s,m|2),r.elementType=j,r.lanes=x,r;case z:return r=Zn(13,o,s,m),r.elementType=z,r.lanes=x,r;case D:return r=Zn(19,o,s,m),r.elementType=D,r.lanes=x,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case C:w=10;break e;case R:w=9;break e;case P:w=11;break e;case F:w=14;break e;case B:w=16,d=null;break e}w=29,o=Error(i(130,r===null?"null":typeof r,"")),d=null}return s=Zn(w,o,s,m),s.elementType=r,s.type=d,s.lanes=x,s}function zs(r,s,o,d){return r=Zn(7,r,d,s),r.lanes=o,r}function gf(r,s,o){return r=Zn(6,r,null,s),r.lanes=o,r}function zx(r){var s=Zn(18,null,null,0);return s.stateNode=r,s}function xf(r,s,o){return s=Zn(4,r.children!==null?r.children:[],r.key,s),s.lanes=o,s.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},s}var Lx=new WeakMap;function pr(r,s){if(typeof r=="object"&&r!==null){var o=Lx.get(r);return o!==void 0?o:(s={value:r,source:s,stack:un(s)},Lx.set(r,s),s)}return{value:r,source:s,stack:un(s)}}var ba=[],ya=0,Oc=null,Bl=0,mr=[],gr=0,Hi=null,qr=1,Ir="";function ii(r,s){ba[ya++]=Bl,ba[ya++]=Oc,Oc=r,Bl=s}function Ox(r,s,o){mr[gr++]=qr,mr[gr++]=Ir,mr[gr++]=Hi,Hi=r;var d=qr;r=Ir;var m=32-J(d)-1;d&=~(1<<m),o+=1;var x=32-J(s)+m;if(30<x){var w=m-m%5;x=(d&(1<<w)-1).toString(32),d>>=w,m-=w,qr=1<<32-J(s)+m|o<<m|d,Ir=x+r}else qr=1<<x|o<<m|d,Ir=r}function vf(r){r.return!==null&&(ii(r,1),Ox(r,1,0))}function bf(r){for(;r===Oc;)Oc=ba[--ya],ba[ya]=null,Bl=ba[--ya],ba[ya]=null;for(;r===Hi;)Hi=mr[--gr],mr[gr]=null,Ir=mr[--gr],mr[gr]=null,qr=mr[--gr],mr[gr]=null}function Bx(r,s){mr[gr++]=qr,mr[gr++]=Ir,mr[gr++]=Hi,qr=s.id,Ir=s.overflow,Hi=r}var yn=null,Lt=null,ct=!1,qi=null,xr=!1,yf=Error(i(519));function Ii(r){var s=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw $l(pr(s,r)),yf}function $x(r){var s=r.stateNode,o=r.type,d=r.memoizedProps;switch(s[Wt]=r,s[Dt]=d,o){case"dialog":tt("cancel",s),tt("close",s);break;case"iframe":case"object":case"embed":tt("load",s);break;case"video":case"audio":for(o=0;o<ao.length;o++)tt(ao[o],s);break;case"source":tt("error",s);break;case"img":case"image":case"link":tt("error",s),tt("load",s);break;case"details":tt("toggle",s);break;case"input":tt("invalid",s),Sl(s,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":tt("invalid",s);break;case"textarea":tt("invalid",s),Nc(s,d.value,d.defaultValue,d.children)}o=d.children,typeof o!="string"&&typeof o!="number"&&typeof o!="bigint"||s.textContent===""+o||d.suppressHydrationWarning===!0||t1(s.textContent,o)?(d.popover!=null&&(tt("beforetoggle",s),tt("toggle",s)),d.onScroll!=null&&tt("scroll",s),d.onScrollEnd!=null&&tt("scrollend",s),d.onClick!=null&&(s.onclick=Ve),s=!0):s=!1,s||Ii(r,!0)}function Px(r){for(yn=r.return;yn;)switch(yn.tag){case 5:case 31:case 13:xr=!1;return;case 27:case 3:xr=!0;return;default:yn=yn.return}}function _a(r){if(r!==yn)return!1;if(!ct)return Px(r),ct=!0,!1;var s=r.tag,o;if((o=s!==3&&s!==27)&&((o=s===5)&&(o=r.type,o=!(o!=="form"&&o!=="button")||$h(r.type,r.memoizedProps)),o=!o),o&&Lt&&Ii(r),Px(r),s===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(317));Lt=u1(r)}else if(s===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(317));Lt=u1(r)}else s===27?(s=Lt,is(r.type)?(r=qh,qh=null,Lt=r):Lt=s):Lt=yn?br(r.stateNode.nextSibling):null;return!0}function Ls(){Lt=yn=null,ct=!1}function _f(){var r=qi;return r!==null&&(In===null?In=r:In.push.apply(In,r),qi=null),r}function $l(r){qi===null?qi=[r]:qi.push(r)}var wf=O(null),Os=null,si=null;function Vi(r,s,o){A(wf,s._currentValue),s._currentValue=o}function ai(r){r._currentValue=wf.current,Z(wf)}function kf(r,s,o){for(;r!==null;){var d=r.alternate;if((r.childLanes&s)!==s?(r.childLanes|=s,d!==null&&(d.childLanes|=s)):d!==null&&(d.childLanes&s)!==s&&(d.childLanes|=s),r===o)break;r=r.return}}function Sf(r,s,o,d){var m=r.child;for(m!==null&&(m.return=r);m!==null;){var x=m.dependencies;if(x!==null){var w=m.child;x=x.firstContext;e:for(;x!==null;){var N=x;x=m;for(var H=0;H<s.length;H++)if(N.context===s[H]){x.lanes|=o,N=x.alternate,N!==null&&(N.lanes|=o),kf(x.return,o,r),d||(w=null);break e}x=N.next}}else if(m.tag===18){if(w=m.return,w===null)throw Error(i(341));w.lanes|=o,x=w.alternate,x!==null&&(x.lanes|=o),kf(w,o,r),w=null}else w=m.child;if(w!==null)w.return=m;else for(w=m;w!==null;){if(w===r){w=null;break}if(m=w.sibling,m!==null){m.return=w.return,w=m;break}w=w.return}m=w}}function wa(r,s,o,d){r=null;for(var m=s,x=!1;m!==null;){if(!x){if((m.flags&524288)!==0)x=!0;else if((m.flags&262144)!==0)break}if(m.tag===10){var w=m.alternate;if(w===null)throw Error(i(387));if(w=w.memoizedProps,w!==null){var N=m.type;Kn(m.pendingProps.value,w.value)||(r!==null?r.push(N):r=[N])}}else if(m===De.current){if(w=m.alternate,w===null)throw Error(i(387));w.memoizedState.memoizedState!==m.memoizedState.memoizedState&&(r!==null?r.push(fo):r=[fo])}m=m.return}r!==null&&Sf(s,r,o,d),s.flags|=262144}function Bc(r){for(r=r.firstContext;r!==null;){if(!Kn(r.context._currentValue,r.memoizedValue))return!0;r=r.next}return!1}function Bs(r){Os=r,si=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function _n(r){return Ux(Os,r)}function $c(r,s){return Os===null&&Bs(r),Ux(r,s)}function Ux(r,s){var o=s._currentValue;if(s={context:s,memoizedValue:o,next:null},si===null){if(r===null)throw Error(i(308));si=s,r.dependencies={lanes:0,firstContext:s},r.flags|=524288}else si=si.next=s;return o}var jk=typeof AbortController<"u"?AbortController:function(){var r=[],s=this.signal={aborted:!1,addEventListener:function(o,d){r.push(d)}};this.abort=function(){s.aborted=!0,r.forEach(function(o){return o()})}},Nk=e.unstable_scheduleCallback,Ck=e.unstable_NormalPriority,rn={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function jf(){return{controller:new jk,data:new Map,refCount:0}}function Pl(r){r.refCount--,r.refCount===0&&Nk(Ck,function(){r.controller.abort()})}var Ul=null,Nf=0,ka=0,Sa=null;function Ek(r,s){if(Ul===null){var o=Ul=[];Nf=0,ka=Th(),Sa={status:"pending",value:void 0,then:function(d){o.push(d)}}}return Nf++,s.then(Fx,Fx),s}function Fx(){if(--Nf===0&&Ul!==null){Sa!==null&&(Sa.status="fulfilled");var r=Ul;Ul=null,ka=0,Sa=null;for(var s=0;s<r.length;s++)(0,r[s])()}}function Tk(r,s){var o=[],d={status:"pending",value:null,reason:null,then:function(m){o.push(m)}};return r.then(function(){d.status="fulfilled",d.value=s;for(var m=0;m<o.length;m++)(0,o[m])(s)},function(m){for(d.status="rejected",d.reason=m,m=0;m<o.length;m++)(0,o[m])(void 0)}),d}var Hx=U.S;U.S=function(r,s){jv=Pe(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&Ek(r,s),Hx!==null&&Hx(r,s)};var $s=O(null);function Cf(){var r=$s.current;return r!==null?r:Nt.pooledCache}function Pc(r,s){s===null?A($s,$s.current):A($s,s.pool)}function qx(){var r=Cf();return r===null?null:{parent:rn._currentValue,pool:r}}var ja=Error(i(460)),Ef=Error(i(474)),Uc=Error(i(542)),Fc={then:function(){}};function Ix(r){return r=r.status,r==="fulfilled"||r==="rejected"}function Vx(r,s,o){switch(o=r[o],o===void 0?r.push(s):o!==s&&(s.then(Ve,Ve),s=o),s.status){case"fulfilled":return s.value;case"rejected":throw r=s.reason,Yx(r),r;default:if(typeof s.status=="string")s.then(Ve,Ve);else{if(r=Nt,r!==null&&100<r.shellSuspendCounter)throw Error(i(482));r=s,r.status="pending",r.then(function(d){if(s.status==="pending"){var m=s;m.status="fulfilled",m.value=d}},function(d){if(s.status==="pending"){var m=s;m.status="rejected",m.reason=d}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw r=s.reason,Yx(r),r}throw Us=s,ja}}function Ps(r){try{var s=r._init;return s(r._payload)}catch(o){throw o!==null&&typeof o=="object"&&typeof o.then=="function"?(Us=o,ja):o}}var Us=null;function Gx(){if(Us===null)throw Error(i(459));var r=Us;return Us=null,r}function Yx(r){if(r===ja||r===Uc)throw Error(i(483))}var Na=null,Fl=0;function Hc(r){var s=Fl;return Fl+=1,Na===null&&(Na=[]),Vx(Na,r,s)}function Hl(r,s){s=s.props.ref,r.ref=s!==void 0?s:null}function qc(r,s){throw s.$$typeof===y?Error(i(525)):(r=Object.prototype.toString.call(s),Error(i(31,r==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":r)))}function Wx(r){function s(Q,V){if(r){var ee=Q.deletions;ee===null?(Q.deletions=[V],Q.flags|=16):ee.push(V)}}function o(Q,V){if(!r)return null;for(;V!==null;)s(Q,V),V=V.sibling;return null}function d(Q){for(var V=new Map;Q!==null;)Q.key!==null?V.set(Q.key,Q):V.set(Q.index,Q),Q=Q.sibling;return V}function m(Q,V){return Q=ri(Q,V),Q.index=0,Q.sibling=null,Q}function x(Q,V,ee){return Q.index=ee,r?(ee=Q.alternate,ee!==null?(ee=ee.index,ee<V?(Q.flags|=67108866,V):ee):(Q.flags|=67108866,V)):(Q.flags|=1048576,V)}function w(Q){return r&&Q.alternate===null&&(Q.flags|=67108866),Q}function N(Q,V,ee,ue){return V===null||V.tag!==6?(V=gf(ee,Q.mode,ue),V.return=Q,V):(V=m(V,ee),V.return=Q,V)}function H(Q,V,ee,ue){var Oe=ee.type;return Oe===S?ce(Q,V,ee.props.children,ue,ee.key):V!==null&&(V.elementType===Oe||typeof Oe=="object"&&Oe!==null&&Oe.$$typeof===B&&Ps(Oe)===V.type)?(V=m(V,ee.props),Hl(V,ee),V.return=Q,V):(V=Lc(ee.type,ee.key,ee.props,null,Q.mode,ue),Hl(V,ee),V.return=Q,V)}function te(Q,V,ee,ue){return V===null||V.tag!==4||V.stateNode.containerInfo!==ee.containerInfo||V.stateNode.implementation!==ee.implementation?(V=xf(ee,Q.mode,ue),V.return=Q,V):(V=m(V,ee.children||[]),V.return=Q,V)}function ce(Q,V,ee,ue,Oe){return V===null||V.tag!==7?(V=zs(ee,Q.mode,ue,Oe),V.return=Q,V):(V=m(V,ee),V.return=Q,V)}function de(Q,V,ee){if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return V=gf(""+V,Q.mode,ee),V.return=Q,V;if(typeof V=="object"&&V!==null){switch(V.$$typeof){case b:return ee=Lc(V.type,V.key,V.props,null,Q.mode,ee),Hl(ee,V),ee.return=Q,ee;case _:return V=xf(V,Q.mode,ee),V.return=Q,V;case B:return V=Ps(V),de(Q,V,ee)}if(Y(V)||E(V))return V=zs(V,Q.mode,ee,null),V.return=Q,V;if(typeof V.then=="function")return de(Q,Hc(V),ee);if(V.$$typeof===C)return de(Q,$c(Q,V),ee);qc(Q,V)}return null}function ne(Q,V,ee,ue){var Oe=V!==null?V.key:null;if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return Oe!==null?null:N(Q,V,""+ee,ue);if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case b:return ee.key===Oe?H(Q,V,ee,ue):null;case _:return ee.key===Oe?te(Q,V,ee,ue):null;case B:return ee=Ps(ee),ne(Q,V,ee,ue)}if(Y(ee)||E(ee))return Oe!==null?null:ce(Q,V,ee,ue,null);if(typeof ee.then=="function")return ne(Q,V,Hc(ee),ue);if(ee.$$typeof===C)return ne(Q,V,$c(Q,ee),ue);qc(Q,ee)}return null}function se(Q,V,ee,ue,Oe){if(typeof ue=="string"&&ue!==""||typeof ue=="number"||typeof ue=="bigint")return Q=Q.get(ee)||null,N(V,Q,""+ue,Oe);if(typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case b:return Q=Q.get(ue.key===null?ee:ue.key)||null,H(V,Q,ue,Oe);case _:return Q=Q.get(ue.key===null?ee:ue.key)||null,te(V,Q,ue,Oe);case B:return ue=Ps(ue),se(Q,V,ee,ue,Oe)}if(Y(ue)||E(ue))return Q=Q.get(ee)||null,ce(V,Q,ue,Oe,null);if(typeof ue.then=="function")return se(Q,V,ee,Hc(ue),Oe);if(ue.$$typeof===C)return se(Q,V,ee,$c(V,ue),Oe);qc(V,ue)}return null}function Te(Q,V,ee,ue){for(var Oe=null,ht=null,Me=V,Xe=V=0,lt=null;Me!==null&&Xe<ee.length;Xe++){Me.index>Xe?(lt=Me,Me=null):lt=Me.sibling;var pt=ne(Q,Me,ee[Xe],ue);if(pt===null){Me===null&&(Me=lt);break}r&&Me&&pt.alternate===null&&s(Q,Me),V=x(pt,V,Xe),ht===null?Oe=pt:ht.sibling=pt,ht=pt,Me=lt}if(Xe===ee.length)return o(Q,Me),ct&&ii(Q,Xe),Oe;if(Me===null){for(;Xe<ee.length;Xe++)Me=de(Q,ee[Xe],ue),Me!==null&&(V=x(Me,V,Xe),ht===null?Oe=Me:ht.sibling=Me,ht=Me);return ct&&ii(Q,Xe),Oe}for(Me=d(Me);Xe<ee.length;Xe++)lt=se(Me,Q,Xe,ee[Xe],ue),lt!==null&&(r&<.alternate!==null&&Me.delete(lt.key===null?Xe:lt.key),V=x(lt,V,Xe),ht===null?Oe=lt:ht.sibling=lt,ht=lt);return r&&Me.forEach(function(cs){return s(Q,cs)}),ct&&ii(Q,Xe),Oe}function Ue(Q,V,ee,ue){if(ee==null)throw Error(i(151));for(var Oe=null,ht=null,Me=V,Xe=V=0,lt=null,pt=ee.next();Me!==null&&!pt.done;Xe++,pt=ee.next()){Me.index>Xe?(lt=Me,Me=null):lt=Me.sibling;var cs=ne(Q,Me,pt.value,ue);if(cs===null){Me===null&&(Me=lt);break}r&&Me&&cs.alternate===null&&s(Q,Me),V=x(cs,V,Xe),ht===null?Oe=cs:ht.sibling=cs,ht=cs,Me=lt}if(pt.done)return o(Q,Me),ct&&ii(Q,Xe),Oe;if(Me===null){for(;!pt.done;Xe++,pt=ee.next())pt=de(Q,pt.value,ue),pt!==null&&(V=x(pt,V,Xe),ht===null?Oe=pt:ht.sibling=pt,ht=pt);return ct&&ii(Q,Xe),Oe}for(Me=d(Me);!pt.done;Xe++,pt=ee.next())pt=se(Me,Q,Xe,pt.value,ue),pt!==null&&(r&&pt.alternate!==null&&Me.delete(pt.key===null?Xe:pt.key),V=x(pt,V,Xe),ht===null?Oe=pt:ht.sibling=pt,ht=pt);return r&&Me.forEach(function(US){return s(Q,US)}),ct&&ii(Q,Xe),Oe}function St(Q,V,ee,ue){if(typeof ee=="object"&&ee!==null&&ee.type===S&&ee.key===null&&(ee=ee.props.children),typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case b:e:{for(var Oe=ee.key;V!==null;){if(V.key===Oe){if(Oe=ee.type,Oe===S){if(V.tag===7){o(Q,V.sibling),ue=m(V,ee.props.children),ue.return=Q,Q=ue;break e}}else if(V.elementType===Oe||typeof Oe=="object"&&Oe!==null&&Oe.$$typeof===B&&Ps(Oe)===V.type){o(Q,V.sibling),ue=m(V,ee.props),Hl(ue,ee),ue.return=Q,Q=ue;break e}o(Q,V);break}else s(Q,V);V=V.sibling}ee.type===S?(ue=zs(ee.props.children,Q.mode,ue,ee.key),ue.return=Q,Q=ue):(ue=Lc(ee.type,ee.key,ee.props,null,Q.mode,ue),Hl(ue,ee),ue.return=Q,Q=ue)}return w(Q);case _:e:{for(Oe=ee.key;V!==null;){if(V.key===Oe)if(V.tag===4&&V.stateNode.containerInfo===ee.containerInfo&&V.stateNode.implementation===ee.implementation){o(Q,V.sibling),ue=m(V,ee.children||[]),ue.return=Q,Q=ue;break e}else{o(Q,V);break}else s(Q,V);V=V.sibling}ue=xf(ee,Q.mode,ue),ue.return=Q,Q=ue}return w(Q);case B:return ee=Ps(ee),St(Q,V,ee,ue)}if(Y(ee))return Te(Q,V,ee,ue);if(E(ee)){if(Oe=E(ee),typeof Oe!="function")throw Error(i(150));return ee=Oe.call(ee),Ue(Q,V,ee,ue)}if(typeof ee.then=="function")return St(Q,V,Hc(ee),ue);if(ee.$$typeof===C)return St(Q,V,$c(Q,ee),ue);qc(Q,ee)}return typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint"?(ee=""+ee,V!==null&&V.tag===6?(o(Q,V.sibling),ue=m(V,ee),ue.return=Q,Q=ue):(o(Q,V),ue=gf(ee,Q.mode,ue),ue.return=Q,Q=ue),w(Q)):o(Q,V)}return function(Q,V,ee,ue){try{Fl=0;var Oe=St(Q,V,ee,ue);return Na=null,Oe}catch(Me){if(Me===ja||Me===Uc)throw Me;var ht=Zn(29,Me,null,Q.mode);return ht.lanes=ue,ht.return=Q,ht}finally{}}}var Fs=Wx(!0),Xx=Wx(!1),Gi=!1;function Tf(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Af(r,s){r=r.updateQueue,s.updateQueue===r&&(s.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function Yi(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function Wi(r,s,o){var d=r.updateQueue;if(d===null)return null;if(d=d.shared,(mt&2)!==0){var m=d.pending;return m===null?s.next=s:(s.next=m.next,m.next=s),d.pending=s,s=zc(r),Rx(r,null,o),s}return Dc(r,d,s,o),zc(r)}function ql(r,s,o){if(s=s.updateQueue,s!==null&&(s=s.shared,(o&4194048)!==0)){var d=s.lanes;d&=r.pendingLanes,o|=d,s.lanes=o,ys(r,o)}}function Mf(r,s){var o=r.updateQueue,d=r.alternate;if(d!==null&&(d=d.updateQueue,o===d)){var m=null,x=null;if(o=o.firstBaseUpdate,o!==null){do{var w={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};x===null?m=x=w:x=x.next=w,o=o.next}while(o!==null);x===null?m=x=s:x=x.next=s}else m=x=s;o={baseState:d.baseState,firstBaseUpdate:m,lastBaseUpdate:x,shared:d.shared,callbacks:d.callbacks},r.updateQueue=o;return}r=o.lastBaseUpdate,r===null?o.firstBaseUpdate=s:r.next=s,o.lastBaseUpdate=s}var Rf=!1;function Il(){if(Rf){var r=Sa;if(r!==null)throw r}}function Vl(r,s,o,d){Rf=!1;var m=r.updateQueue;Gi=!1;var x=m.firstBaseUpdate,w=m.lastBaseUpdate,N=m.shared.pending;if(N!==null){m.shared.pending=null;var H=N,te=H.next;H.next=null,w===null?x=te:w.next=te,w=H;var ce=r.alternate;ce!==null&&(ce=ce.updateQueue,N=ce.lastBaseUpdate,N!==w&&(N===null?ce.firstBaseUpdate=te:N.next=te,ce.lastBaseUpdate=H))}if(x!==null){var de=m.baseState;w=0,ce=te=H=null,N=x;do{var ne=N.lane&-536870913,se=ne!==N.lane;if(se?(at&ne)===ne:(d&ne)===ne){ne!==0&&ne===ka&&(Rf=!0),ce!==null&&(ce=ce.next={lane:0,tag:N.tag,payload:N.payload,callback:null,next:null});e:{var Te=r,Ue=N;ne=s;var St=o;switch(Ue.tag){case 1:if(Te=Ue.payload,typeof Te=="function"){de=Te.call(St,de,ne);break e}de=Te;break e;case 3:Te.flags=Te.flags&-65537|128;case 0:if(Te=Ue.payload,ne=typeof Te=="function"?Te.call(St,de,ne):Te,ne==null)break e;de=v({},de,ne);break e;case 2:Gi=!0}}ne=N.callback,ne!==null&&(r.flags|=64,se&&(r.flags|=8192),se=m.callbacks,se===null?m.callbacks=[ne]:se.push(ne))}else se={lane:ne,tag:N.tag,payload:N.payload,callback:N.callback,next:null},ce===null?(te=ce=se,H=de):ce=ce.next=se,w|=ne;if(N=N.next,N===null){if(N=m.shared.pending,N===null)break;se=N,N=se.next,se.next=null,m.lastBaseUpdate=se,m.shared.pending=null}}while(!0);ce===null&&(H=de),m.baseState=H,m.firstBaseUpdate=te,m.lastBaseUpdate=ce,x===null&&(m.shared.lanes=0),Ji|=w,r.lanes=w,r.memoizedState=de}}function Qx(r,s){if(typeof r!="function")throw Error(i(191,r));r.call(s)}function Kx(r,s){var o=r.callbacks;if(o!==null)for(r.callbacks=null,r=0;r<o.length;r++)Qx(o[r],s)}var Ca=O(null),Ic=O(0);function Zx(r,s){r=mi,A(Ic,r),A(Ca,s),mi=r|s.baseLanes}function Df(){A(Ic,mi),A(Ca,Ca.current)}function zf(){mi=Ic.current,Z(Ca),Z(Ic)}var Jn=O(null),vr=null;function Xi(r){var s=r.alternate;A(Jt,Jt.current&1),A(Jn,r),vr===null&&(s===null||Ca.current!==null||s.memoizedState!==null)&&(vr=r)}function Lf(r){A(Jt,Jt.current),A(Jn,r),vr===null&&(vr=r)}function Jx(r){r.tag===22?(A(Jt,Jt.current),A(Jn,r),vr===null&&(vr=r)):Qi()}function Qi(){A(Jt,Jt.current),A(Jn,Jn.current)}function er(r){Z(Jn),vr===r&&(vr=null),Z(Jt)}var Jt=O(0);function Vc(r){for(var s=r;s!==null;){if(s.tag===13){var o=s.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||Fh(o)||Hh(o)))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===r)break;for(;s.sibling===null;){if(s.return===null||s.return===r)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var li=0,We=null,wt=null,sn=null,Gc=!1,Ea=!1,Hs=!1,Yc=0,Gl=0,Ta=null,Ak=0;function Xt(){throw Error(i(321))}function Of(r,s){if(s===null)return!1;for(var o=0;o<s.length&&o<r.length;o++)if(!Kn(r[o],s[o]))return!1;return!0}function Bf(r,s,o,d,m,x){return li=x,We=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,U.H=r===null||r.memoizedState===null?O0:Zf,Hs=!1,x=o(d,m),Hs=!1,Ea&&(x=t0(s,o,d,m)),e0(r),x}function e0(r){U.H=Xl;var s=wt!==null&&wt.next!==null;if(li=0,sn=wt=We=null,Gc=!1,Gl=0,Ta=null,s)throw Error(i(300));r===null||an||(r=r.dependencies,r!==null&&Bc(r)&&(an=!0))}function t0(r,s,o,d){We=r;var m=0;do{if(Ea&&(Ta=null),Gl=0,Ea=!1,25<=m)throw Error(i(301));if(m+=1,sn=wt=null,r.updateQueue!=null){var x=r.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}U.H=B0,x=s(o,d)}while(Ea);return x}function Mk(){var r=U.H,s=r.useState()[0];return s=typeof s.then=="function"?Yl(s):s,r=r.useState()[0],(wt!==null?wt.memoizedState:null)!==r&&(We.flags|=1024),s}function $f(){var r=Yc!==0;return Yc=0,r}function Pf(r,s,o){s.updateQueue=r.updateQueue,s.flags&=-2053,r.lanes&=~o}function Uf(r){if(Gc){for(r=r.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}Gc=!1}li=0,sn=wt=We=null,Ea=!1,Gl=Yc=0,Ta=null}function zn(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return sn===null?We.memoizedState=sn=r:sn=sn.next=r,sn}function en(){if(wt===null){var r=We.alternate;r=r!==null?r.memoizedState:null}else r=wt.next;var s=sn===null?We.memoizedState:sn.next;if(s!==null)sn=s,wt=r;else{if(r===null)throw We.alternate===null?Error(i(467)):Error(i(310));wt=r,r={memoizedState:wt.memoizedState,baseState:wt.baseState,baseQueue:wt.baseQueue,queue:wt.queue,next:null},sn===null?We.memoizedState=sn=r:sn=sn.next=r}return sn}function Wc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Yl(r){var s=Gl;return Gl+=1,Ta===null&&(Ta=[]),r=Vx(Ta,r,s),s=We,(sn===null?s.memoizedState:sn.next)===null&&(s=s.alternate,U.H=s===null||s.memoizedState===null?O0:Zf),r}function Xc(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return Yl(r);if(r.$$typeof===C)return _n(r)}throw Error(i(438,String(r)))}function Ff(r){var s=null,o=We.updateQueue;if(o!==null&&(s=o.memoCache),s==null){var d=We.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(s={data:d.data.map(function(m){return m.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),o===null&&(o=Wc(),We.updateQueue=o),o.memoCache=s,o=s.data[s.index],o===void 0)for(o=s.data[s.index]=Array(r),d=0;d<r;d++)o[d]=L;return s.index++,o}function oi(r,s){return typeof s=="function"?s(r):s}function Qc(r){var s=en();return Hf(s,wt,r)}function Hf(r,s,o){var d=r.queue;if(d===null)throw Error(i(311));d.lastRenderedReducer=o;var m=r.baseQueue,x=d.pending;if(x!==null){if(m!==null){var w=m.next;m.next=x.next,x.next=w}s.baseQueue=m=x,d.pending=null}if(x=r.baseState,m===null)r.memoizedState=x;else{s=m.next;var N=w=null,H=null,te=s,ce=!1;do{var de=te.lane&-536870913;if(de!==te.lane?(at&de)===de:(li&de)===de){var ne=te.revertLane;if(ne===0)H!==null&&(H=H.next={lane:0,revertLane:0,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null}),de===ka&&(ce=!0);else if((li&ne)===ne){te=te.next,ne===ka&&(ce=!0);continue}else de={lane:0,revertLane:te.revertLane,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},H===null?(N=H=de,w=x):H=H.next=de,We.lanes|=ne,Ji|=ne;de=te.action,Hs&&o(x,de),x=te.hasEagerState?te.eagerState:o(x,de)}else ne={lane:de,revertLane:te.revertLane,gesture:te.gesture,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},H===null?(N=H=ne,w=x):H=H.next=ne,We.lanes|=de,Ji|=de;te=te.next}while(te!==null&&te!==s);if(H===null?w=x:H.next=N,!Kn(x,r.memoizedState)&&(an=!0,ce&&(o=Sa,o!==null)))throw o;r.memoizedState=x,r.baseState=w,r.baseQueue=H,d.lastRenderedState=x}return m===null&&(d.lanes=0),[r.memoizedState,d.dispatch]}function qf(r){var s=en(),o=s.queue;if(o===null)throw Error(i(311));o.lastRenderedReducer=r;var d=o.dispatch,m=o.pending,x=s.memoizedState;if(m!==null){o.pending=null;var w=m=m.next;do x=r(x,w.action),w=w.next;while(w!==m);Kn(x,s.memoizedState)||(an=!0),s.memoizedState=x,s.baseQueue===null&&(s.baseState=x),o.lastRenderedState=x}return[x,d]}function n0(r,s,o){var d=We,m=en(),x=ct;if(x){if(o===void 0)throw Error(i(407));o=o()}else o=s();var w=!Kn((wt||m).memoizedState,o);if(w&&(m.memoizedState=o,an=!0),m=m.queue,Gf(s0.bind(null,d,m,r),[r]),m.getSnapshot!==s||w||sn!==null&&sn.memoizedState.tag&1){if(d.flags|=2048,Aa(9,{destroy:void 0},i0.bind(null,d,m,o,s),null),Nt===null)throw Error(i(349));x||(li&127)!==0||r0(d,s,o)}return o}function r0(r,s,o){r.flags|=16384,r={getSnapshot:s,value:o},s=We.updateQueue,s===null?(s=Wc(),We.updateQueue=s,s.stores=[r]):(o=s.stores,o===null?s.stores=[r]:o.push(r))}function i0(r,s,o,d){s.value=o,s.getSnapshot=d,a0(s)&&l0(r)}function s0(r,s,o){return o(function(){a0(s)&&l0(r)})}function a0(r){var s=r.getSnapshot;r=r.value;try{var o=s();return!Kn(r,o)}catch{return!0}}function l0(r){var s=Ds(r,2);s!==null&&Vn(s,r,2)}function If(r){var s=zn();if(typeof r=="function"){var o=r;if(r=o(),Hs){Ut(!0);try{o()}finally{Ut(!1)}}}return s.memoizedState=s.baseState=r,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:oi,lastRenderedState:r},s}function o0(r,s,o,d){return r.baseState=o,Hf(r,wt,typeof d=="function"?d:oi)}function Rk(r,s,o,d,m){if(Jc(r))throw Error(i(485));if(r=s.action,r!==null){var x={payload:m,action:r,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){x.listeners.push(w)}};U.T!==null?o(!0):x.isTransition=!1,d(x),o=s.pending,o===null?(x.next=s.pending=x,c0(s,x)):(x.next=o.next,s.pending=o.next=x)}}function c0(r,s){var o=s.action,d=s.payload,m=r.state;if(s.isTransition){var x=U.T,w={};U.T=w;try{var N=o(m,d),H=U.S;H!==null&&H(w,N),u0(r,s,N)}catch(te){Vf(r,s,te)}finally{x!==null&&w.types!==null&&(x.types=w.types),U.T=x}}else try{x=o(m,d),u0(r,s,x)}catch(te){Vf(r,s,te)}}function u0(r,s,o){o!==null&&typeof o=="object"&&typeof o.then=="function"?o.then(function(d){d0(r,s,d)},function(d){return Vf(r,s,d)}):d0(r,s,o)}function d0(r,s,o){s.status="fulfilled",s.value=o,f0(s),r.state=o,s=r.pending,s!==null&&(o=s.next,o===s?r.pending=null:(o=o.next,s.next=o,c0(r,o)))}function Vf(r,s,o){var d=r.pending;if(r.pending=null,d!==null){d=d.next;do s.status="rejected",s.reason=o,f0(s),s=s.next;while(s!==d)}r.action=null}function f0(r){r=r.listeners;for(var s=0;s<r.length;s++)(0,r[s])()}function h0(r,s){return s}function p0(r,s){if(ct){var o=Nt.formState;if(o!==null){e:{var d=We;if(ct){if(Lt){t:{for(var m=Lt,x=xr;m.nodeType!==8;){if(!x){m=null;break t}if(m=br(m.nextSibling),m===null){m=null;break t}}x=m.data,m=x==="F!"||x==="F"?m:null}if(m){Lt=br(m.nextSibling),d=m.data==="F!";break e}}Ii(d)}d=!1}d&&(s=o[0])}}return o=zn(),o.memoizedState=o.baseState=s,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:h0,lastRenderedState:s},o.queue=d,o=D0.bind(null,We,d),d.dispatch=o,d=If(!1),x=Kf.bind(null,We,!1,d.queue),d=zn(),m={state:s,dispatch:null,action:r,pending:null},d.queue=m,o=Rk.bind(null,We,m,x,o),m.dispatch=o,d.memoizedState=r,[s,o,!1]}function m0(r){var s=en();return g0(s,wt,r)}function g0(r,s,o){if(s=Hf(r,s,h0)[0],r=Qc(oi)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var d=Yl(s)}catch(w){throw w===ja?Uc:w}else d=s;s=en();var m=s.queue,x=m.dispatch;return o!==s.memoizedState&&(We.flags|=2048,Aa(9,{destroy:void 0},Dk.bind(null,m,o),null)),[d,x,r]}function Dk(r,s){r.action=s}function x0(r){var s=en(),o=wt;if(o!==null)return g0(s,o,r);en(),s=s.memoizedState,o=en();var d=o.queue.dispatch;return o.memoizedState=r,[s,d,!1]}function Aa(r,s,o,d){return r={tag:r,create:o,deps:d,inst:s,next:null},s=We.updateQueue,s===null&&(s=Wc(),We.updateQueue=s),o=s.lastEffect,o===null?s.lastEffect=r.next=r:(d=o.next,o.next=r,r.next=d,s.lastEffect=r),r}function v0(){return en().memoizedState}function Kc(r,s,o,d){var m=zn();We.flags|=r,m.memoizedState=Aa(1|s,{destroy:void 0},o,d===void 0?null:d)}function Zc(r,s,o,d){var m=en();d=d===void 0?null:d;var x=m.memoizedState.inst;wt!==null&&d!==null&&Of(d,wt.memoizedState.deps)?m.memoizedState=Aa(s,x,o,d):(We.flags|=r,m.memoizedState=Aa(1|s,x,o,d))}function b0(r,s){Kc(8390656,8,r,s)}function Gf(r,s){Zc(2048,8,r,s)}function zk(r){We.flags|=4;var s=We.updateQueue;if(s===null)s=Wc(),We.updateQueue=s,s.events=[r];else{var o=s.events;o===null?s.events=[r]:o.push(r)}}function y0(r){var s=en().memoizedState;return zk({ref:s,nextImpl:r}),function(){if((mt&2)!==0)throw Error(i(440));return s.impl.apply(void 0,arguments)}}function _0(r,s){return Zc(4,2,r,s)}function w0(r,s){return Zc(4,4,r,s)}function k0(r,s){if(typeof s=="function"){r=r();var o=s(r);return function(){typeof o=="function"?o():s(null)}}if(s!=null)return r=r(),s.current=r,function(){s.current=null}}function S0(r,s,o){o=o!=null?o.concat([r]):null,Zc(4,4,k0.bind(null,s,r),o)}function Yf(){}function j0(r,s){var o=en();s=s===void 0?null:s;var d=o.memoizedState;return s!==null&&Of(s,d[1])?d[0]:(o.memoizedState=[r,s],r)}function N0(r,s){var o=en();s=s===void 0?null:s;var d=o.memoizedState;if(s!==null&&Of(s,d[1]))return d[0];if(d=r(),Hs){Ut(!0);try{r()}finally{Ut(!1)}}return o.memoizedState=[d,s],d}function Wf(r,s,o){return o===void 0||(li&1073741824)!==0&&(at&261930)===0?r.memoizedState=s:(r.memoizedState=o,r=Cv(),We.lanes|=r,Ji|=r,o)}function C0(r,s,o,d){return Kn(o,s)?o:Ca.current!==null?(r=Wf(r,o,d),Kn(r,s)||(an=!0),r):(li&42)===0||(li&1073741824)!==0&&(at&261930)===0?(an=!0,r.memoizedState=o):(r=Cv(),We.lanes|=r,Ji|=r,s)}function E0(r,s,o,d,m){var x=$.p;$.p=x!==0&&8>x?x:8;var w=U.T,N={};U.T=N,Kf(r,!1,s,o);try{var H=m(),te=U.S;if(te!==null&&te(N,H),H!==null&&typeof H=="object"&&typeof H.then=="function"){var ce=Tk(H,d);Wl(r,s,ce,rr(r))}else Wl(r,s,d,rr(r))}catch(de){Wl(r,s,{then:function(){},status:"rejected",reason:de},rr())}finally{$.p=x,w!==null&&N.types!==null&&(w.types=N.types),U.T=w}}function Lk(){}function Xf(r,s,o,d){if(r.tag!==5)throw Error(i(476));var m=T0(r).queue;E0(r,m,s,re,o===null?Lk:function(){return A0(r),o(d)})}function T0(r){var s=r.memoizedState;if(s!==null)return s;s={memoizedState:re,baseState:re,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:oi,lastRenderedState:re},next:null};var o={};return s.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:oi,lastRenderedState:o},next:null},r.memoizedState=s,r=r.alternate,r!==null&&(r.memoizedState=s),s}function A0(r){var s=T0(r);s.next===null&&(s=r.alternate.memoizedState),Wl(r,s.next.queue,{},rr())}function Qf(){return _n(fo)}function M0(){return en().memoizedState}function R0(){return en().memoizedState}function Ok(r){for(var s=r.return;s!==null;){switch(s.tag){case 24:case 3:var o=rr();r=Yi(o);var d=Wi(s,r,o);d!==null&&(Vn(d,s,o),ql(d,s,o)),s={cache:jf()},r.payload=s;return}s=s.return}}function Bk(r,s,o){var d=rr();o={lane:d,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},Jc(r)?z0(s,o):(o=pf(r,s,o,d),o!==null&&(Vn(o,r,d),L0(o,s,d)))}function D0(r,s,o){var d=rr();Wl(r,s,o,d)}function Wl(r,s,o,d){var m={lane:d,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(Jc(r))z0(s,m);else{var x=r.alternate;if(r.lanes===0&&(x===null||x.lanes===0)&&(x=s.lastRenderedReducer,x!==null))try{var w=s.lastRenderedState,N=x(w,o);if(m.hasEagerState=!0,m.eagerState=N,Kn(N,w))return Dc(r,s,m,0),Nt===null&&Rc(),!1}catch{}finally{}if(o=pf(r,s,m,d),o!==null)return Vn(o,r,d),L0(o,s,d),!0}return!1}function Kf(r,s,o,d){if(d={lane:2,revertLane:Th(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},Jc(r)){if(s)throw Error(i(479))}else s=pf(r,o,d,2),s!==null&&Vn(s,r,2)}function Jc(r){var s=r.alternate;return r===We||s!==null&&s===We}function z0(r,s){Ea=Gc=!0;var o=r.pending;o===null?s.next=s:(s.next=o.next,o.next=s),r.pending=s}function L0(r,s,o){if((o&4194048)!==0){var d=s.lanes;d&=r.pendingLanes,o|=d,s.lanes=o,ys(r,o)}}var Xl={readContext:_n,use:Xc,useCallback:Xt,useContext:Xt,useEffect:Xt,useImperativeHandle:Xt,useLayoutEffect:Xt,useInsertionEffect:Xt,useMemo:Xt,useReducer:Xt,useRef:Xt,useState:Xt,useDebugValue:Xt,useDeferredValue:Xt,useTransition:Xt,useSyncExternalStore:Xt,useId:Xt,useHostTransitionStatus:Xt,useFormState:Xt,useActionState:Xt,useOptimistic:Xt,useMemoCache:Xt,useCacheRefresh:Xt};Xl.useEffectEvent=Xt;var O0={readContext:_n,use:Xc,useCallback:function(r,s){return zn().memoizedState=[r,s===void 0?null:s],r},useContext:_n,useEffect:b0,useImperativeHandle:function(r,s,o){o=o!=null?o.concat([r]):null,Kc(4194308,4,k0.bind(null,s,r),o)},useLayoutEffect:function(r,s){return Kc(4194308,4,r,s)},useInsertionEffect:function(r,s){Kc(4,2,r,s)},useMemo:function(r,s){var o=zn();s=s===void 0?null:s;var d=r();if(Hs){Ut(!0);try{r()}finally{Ut(!1)}}return o.memoizedState=[d,s],d},useReducer:function(r,s,o){var d=zn();if(o!==void 0){var m=o(s);if(Hs){Ut(!0);try{o(s)}finally{Ut(!1)}}}else m=s;return d.memoizedState=d.baseState=m,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:m},d.queue=r,r=r.dispatch=Bk.bind(null,We,r),[d.memoizedState,r]},useRef:function(r){var s=zn();return r={current:r},s.memoizedState=r},useState:function(r){r=If(r);var s=r.queue,o=D0.bind(null,We,s);return s.dispatch=o,[r.memoizedState,o]},useDebugValue:Yf,useDeferredValue:function(r,s){var o=zn();return Wf(o,r,s)},useTransition:function(){var r=If(!1);return r=E0.bind(null,We,r.queue,!0,!1),zn().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,s,o){var d=We,m=zn();if(ct){if(o===void 0)throw Error(i(407));o=o()}else{if(o=s(),Nt===null)throw Error(i(349));(at&127)!==0||r0(d,s,o)}m.memoizedState=o;var x={value:o,getSnapshot:s};return m.queue=x,b0(s0.bind(null,d,x,r),[r]),d.flags|=2048,Aa(9,{destroy:void 0},i0.bind(null,d,x,o,s),null),o},useId:function(){var r=zn(),s=Nt.identifierPrefix;if(ct){var o=Ir,d=qr;o=(d&~(1<<32-J(d)-1)).toString(32)+o,s="_"+s+"R_"+o,o=Yc++,0<o&&(s+="H"+o.toString(32)),s+="_"}else o=Ak++,s="_"+s+"r_"+o.toString(32)+"_";return r.memoizedState=s},useHostTransitionStatus:Qf,useFormState:p0,useActionState:p0,useOptimistic:function(r){var s=zn();s.memoizedState=s.baseState=r;var o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=o,s=Kf.bind(null,We,!0,o),o.dispatch=s,[r,s]},useMemoCache:Ff,useCacheRefresh:function(){return zn().memoizedState=Ok.bind(null,We)},useEffectEvent:function(r){var s=zn(),o={impl:r};return s.memoizedState=o,function(){if((mt&2)!==0)throw Error(i(440));return o.impl.apply(void 0,arguments)}}},Zf={readContext:_n,use:Xc,useCallback:j0,useContext:_n,useEffect:Gf,useImperativeHandle:S0,useInsertionEffect:_0,useLayoutEffect:w0,useMemo:N0,useReducer:Qc,useRef:v0,useState:function(){return Qc(oi)},useDebugValue:Yf,useDeferredValue:function(r,s){var o=en();return C0(o,wt.memoizedState,r,s)},useTransition:function(){var r=Qc(oi)[0],s=en().memoizedState;return[typeof r=="boolean"?r:Yl(r),s]},useSyncExternalStore:n0,useId:M0,useHostTransitionStatus:Qf,useFormState:m0,useActionState:m0,useOptimistic:function(r,s){var o=en();return o0(o,wt,r,s)},useMemoCache:Ff,useCacheRefresh:R0};Zf.useEffectEvent=y0;var B0={readContext:_n,use:Xc,useCallback:j0,useContext:_n,useEffect:Gf,useImperativeHandle:S0,useInsertionEffect:_0,useLayoutEffect:w0,useMemo:N0,useReducer:qf,useRef:v0,useState:function(){return qf(oi)},useDebugValue:Yf,useDeferredValue:function(r,s){var o=en();return wt===null?Wf(o,r,s):C0(o,wt.memoizedState,r,s)},useTransition:function(){var r=qf(oi)[0],s=en().memoizedState;return[typeof r=="boolean"?r:Yl(r),s]},useSyncExternalStore:n0,useId:M0,useHostTransitionStatus:Qf,useFormState:x0,useActionState:x0,useOptimistic:function(r,s){var o=en();return wt!==null?o0(o,wt,r,s):(o.baseState=r,[r,o.queue.dispatch])},useMemoCache:Ff,useCacheRefresh:R0};B0.useEffectEvent=y0;function Jf(r,s,o,d){s=r.memoizedState,o=o(d,s),o=o==null?s:v({},s,o),r.memoizedState=o,r.lanes===0&&(r.updateQueue.baseState=o)}var eh={enqueueSetState:function(r,s,o){r=r._reactInternals;var d=rr(),m=Yi(d);m.payload=s,o!=null&&(m.callback=o),s=Wi(r,m,d),s!==null&&(Vn(s,r,d),ql(s,r,d))},enqueueReplaceState:function(r,s,o){r=r._reactInternals;var d=rr(),m=Yi(d);m.tag=1,m.payload=s,o!=null&&(m.callback=o),s=Wi(r,m,d),s!==null&&(Vn(s,r,d),ql(s,r,d))},enqueueForceUpdate:function(r,s){r=r._reactInternals;var o=rr(),d=Yi(o);d.tag=2,s!=null&&(d.callback=s),s=Wi(r,d,o),s!==null&&(Vn(s,r,o),ql(s,r,o))}};function $0(r,s,o,d,m,x,w){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(d,x,w):s.prototype&&s.prototype.isPureReactComponent?!Ll(o,d)||!Ll(m,x):!0}function P0(r,s,o,d){r=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(o,d),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(o,d),s.state!==r&&eh.enqueueReplaceState(s,s.state,null)}function qs(r,s){var o=s;if("ref"in s){o={};for(var d in s)d!=="ref"&&(o[d]=s[d])}if(r=r.defaultProps){o===s&&(o=v({},o));for(var m in r)o[m]===void 0&&(o[m]=r[m])}return o}function U0(r){Mc(r)}function F0(r){console.error(r)}function H0(r){Mc(r)}function eu(r,s){try{var o=r.onUncaughtError;o(s.value,{componentStack:s.stack})}catch(d){setTimeout(function(){throw d})}}function q0(r,s,o){try{var d=r.onCaughtError;d(o.value,{componentStack:o.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(m){setTimeout(function(){throw m})}}function th(r,s,o){return o=Yi(o),o.tag=3,o.payload={element:null},o.callback=function(){eu(r,s)},o}function I0(r){return r=Yi(r),r.tag=3,r}function V0(r,s,o,d){var m=o.type.getDerivedStateFromError;if(typeof m=="function"){var x=d.value;r.payload=function(){return m(x)},r.callback=function(){q0(s,o,d)}}var w=o.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(r.callback=function(){q0(s,o,d),typeof m!="function"&&(es===null?es=new Set([this]):es.add(this));var N=d.stack;this.componentDidCatch(d.value,{componentStack:N!==null?N:""})})}function $k(r,s,o,d,m){if(o.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(s=o.alternate,s!==null&&wa(s,o,m,!0),o=Jn.current,o!==null){switch(o.tag){case 31:case 13:return vr===null?fu():o.alternate===null&&Qt===0&&(Qt=3),o.flags&=-257,o.flags|=65536,o.lanes=m,d===Fc?o.flags|=16384:(s=o.updateQueue,s===null?o.updateQueue=new Set([d]):s.add(d),Nh(r,d,m)),!1;case 22:return o.flags|=65536,d===Fc?o.flags|=16384:(s=o.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([d])},o.updateQueue=s):(o=s.retryQueue,o===null?s.retryQueue=new Set([d]):o.add(d)),Nh(r,d,m)),!1}throw Error(i(435,o.tag))}return Nh(r,d,m),fu(),!1}if(ct)return s=Jn.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=m,d!==yf&&(r=Error(i(422),{cause:d}),$l(pr(r,o)))):(d!==yf&&(s=Error(i(423),{cause:d}),$l(pr(s,o))),r=r.current.alternate,r.flags|=65536,m&=-m,r.lanes|=m,d=pr(d,o),m=th(r.stateNode,d,m),Mf(r,m),Qt!==4&&(Qt=2)),!1;var x=Error(i(520),{cause:d});if(x=pr(x,o),ro===null?ro=[x]:ro.push(x),Qt!==4&&(Qt=2),s===null)return!0;d=pr(d,o),o=s;do{switch(o.tag){case 3:return o.flags|=65536,r=m&-m,o.lanes|=r,r=th(o.stateNode,d,r),Mf(o,r),!1;case 1:if(s=o.type,x=o.stateNode,(o.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(es===null||!es.has(x))))return o.flags|=65536,m&=-m,o.lanes|=m,m=I0(m),V0(m,r,o,d),Mf(o,m),!1}o=o.return}while(o!==null);return!1}var nh=Error(i(461)),an=!1;function wn(r,s,o,d){s.child=r===null?Xx(s,null,o,d):Fs(s,r.child,o,d)}function G0(r,s,o,d,m){o=o.render;var x=s.ref;if("ref"in d){var w={};for(var N in d)N!=="ref"&&(w[N]=d[N])}else w=d;return Bs(s),d=Bf(r,s,o,w,x,m),N=$f(),r!==null&&!an?(Pf(r,s,m),ci(r,s,m)):(ct&&N&&vf(s),s.flags|=1,wn(r,s,d,m),s.child)}function Y0(r,s,o,d,m){if(r===null){var x=o.type;return typeof x=="function"&&!mf(x)&&x.defaultProps===void 0&&o.compare===null?(s.tag=15,s.type=x,W0(r,s,x,d,m)):(r=Lc(o.type,null,d,s,s.mode,m),r.ref=s.ref,r.return=s,s.child=r)}if(x=r.child,!uh(r,m)){var w=x.memoizedProps;if(o=o.compare,o=o!==null?o:Ll,o(w,d)&&r.ref===s.ref)return ci(r,s,m)}return s.flags|=1,r=ri(x,d),r.ref=s.ref,r.return=s,s.child=r}function W0(r,s,o,d,m){if(r!==null){var x=r.memoizedProps;if(Ll(x,d)&&r.ref===s.ref)if(an=!1,s.pendingProps=d=x,uh(r,m))(r.flags&131072)!==0&&(an=!0);else return s.lanes=r.lanes,ci(r,s,m)}return rh(r,s,o,d,m)}function X0(r,s,o,d){var m=d.children,x=r!==null?r.memoizedState:null;if(r===null&&s.stateNode===null&&(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((s.flags&128)!==0){if(x=x!==null?x.baseLanes|o:o,r!==null){for(d=s.child=r.child,m=0;d!==null;)m=m|d.lanes|d.childLanes,d=d.sibling;d=m&~x}else d=0,s.child=null;return Q0(r,s,x,o,d)}if((o&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},r!==null&&Pc(s,x!==null?x.cachePool:null),x!==null?Zx(s,x):Df(),Jx(s);else return d=s.lanes=536870912,Q0(r,s,x!==null?x.baseLanes|o:o,o,d)}else x!==null?(Pc(s,x.cachePool),Zx(s,x),Qi(),s.memoizedState=null):(r!==null&&Pc(s,null),Df(),Qi());return wn(r,s,m,o),s.child}function Ql(r,s){return r!==null&&r.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function Q0(r,s,o,d,m){var x=Cf();return x=x===null?null:{parent:rn._currentValue,pool:x},s.memoizedState={baseLanes:o,cachePool:x},r!==null&&Pc(s,null),Df(),Jx(s),r!==null&&wa(r,s,d,!0),s.childLanes=m,null}function tu(r,s){return s=ru({mode:s.mode,children:s.children},r.mode),s.ref=r.ref,r.child=s,s.return=r,s}function K0(r,s,o){return Fs(s,r.child,null,o),r=tu(s,s.pendingProps),r.flags|=2,er(s),s.memoizedState=null,r}function Pk(r,s,o){var d=s.pendingProps,m=(s.flags&128)!==0;if(s.flags&=-129,r===null){if(ct){if(d.mode==="hidden")return r=tu(s,d),s.lanes=536870912,Ql(null,r);if(Lf(s),(r=Lt)?(r=c1(r,xr),r=r!==null&&r.data==="&"?r:null,r!==null&&(s.memoizedState={dehydrated:r,treeContext:Hi!==null?{id:qr,overflow:Ir}:null,retryLane:536870912,hydrationErrors:null},o=zx(r),o.return=s,s.child=o,yn=s,Lt=null)):r=null,r===null)throw Ii(s);return s.lanes=536870912,null}return tu(s,d)}var x=r.memoizedState;if(x!==null){var w=x.dehydrated;if(Lf(s),m)if(s.flags&256)s.flags&=-257,s=K0(r,s,o);else if(s.memoizedState!==null)s.child=r.child,s.flags|=128,s=null;else throw Error(i(558));else if(an||wa(r,s,o,!1),m=(o&r.childLanes)!==0,an||m){if(d=Nt,d!==null&&(w=_s(d,o),w!==0&&w!==x.retryLane))throw x.retryLane=w,Ds(r,w),Vn(d,r,w),nh;fu(),s=K0(r,s,o)}else r=x.treeContext,Lt=br(w.nextSibling),yn=s,ct=!0,qi=null,xr=!1,r!==null&&Bx(s,r),s=tu(s,d),s.flags|=4096;return s}return r=ri(r.child,{mode:d.mode,children:d.children}),r.ref=s.ref,s.child=r,r.return=s,r}function nu(r,s){var o=s.ref;if(o===null)r!==null&&r.ref!==null&&(s.flags|=4194816);else{if(typeof o!="function"&&typeof o!="object")throw Error(i(284));(r===null||r.ref!==o)&&(s.flags|=4194816)}}function rh(r,s,o,d,m){return Bs(s),o=Bf(r,s,o,d,void 0,m),d=$f(),r!==null&&!an?(Pf(r,s,m),ci(r,s,m)):(ct&&d&&vf(s),s.flags|=1,wn(r,s,o,m),s.child)}function Z0(r,s,o,d,m,x){return Bs(s),s.updateQueue=null,o=t0(s,d,o,m),e0(r),d=$f(),r!==null&&!an?(Pf(r,s,x),ci(r,s,x)):(ct&&d&&vf(s),s.flags|=1,wn(r,s,o,x),s.child)}function J0(r,s,o,d,m){if(Bs(s),s.stateNode===null){var x=va,w=o.contextType;typeof w=="object"&&w!==null&&(x=_n(w)),x=new o(d,x),s.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=eh,s.stateNode=x,x._reactInternals=s,x=s.stateNode,x.props=d,x.state=s.memoizedState,x.refs={},Tf(s),w=o.contextType,x.context=typeof w=="object"&&w!==null?_n(w):va,x.state=s.memoizedState,w=o.getDerivedStateFromProps,typeof w=="function"&&(Jf(s,o,w,d),x.state=s.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(w=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),w!==x.state&&eh.enqueueReplaceState(x,x.state,null),Vl(s,d,x,m),Il(),x.state=s.memoizedState),typeof x.componentDidMount=="function"&&(s.flags|=4194308),d=!0}else if(r===null){x=s.stateNode;var N=s.memoizedProps,H=qs(o,N);x.props=H;var te=x.context,ce=o.contextType;w=va,typeof ce=="object"&&ce!==null&&(w=_n(ce));var de=o.getDerivedStateFromProps;ce=typeof de=="function"||typeof x.getSnapshotBeforeUpdate=="function",N=s.pendingProps!==N,ce||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(N||te!==w)&&P0(s,x,d,w),Gi=!1;var ne=s.memoizedState;x.state=ne,Vl(s,d,x,m),Il(),te=s.memoizedState,N||ne!==te||Gi?(typeof de=="function"&&(Jf(s,o,de,d),te=s.memoizedState),(H=Gi||$0(s,o,H,d,ne,te,w))?(ce||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount()),typeof x.componentDidMount=="function"&&(s.flags|=4194308)):(typeof x.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=d,s.memoizedState=te),x.props=d,x.state=te,x.context=w,d=H):(typeof x.componentDidMount=="function"&&(s.flags|=4194308),d=!1)}else{x=s.stateNode,Af(r,s),w=s.memoizedProps,ce=qs(o,w),x.props=ce,de=s.pendingProps,ne=x.context,te=o.contextType,H=va,typeof te=="object"&&te!==null&&(H=_n(te)),N=o.getDerivedStateFromProps,(te=typeof N=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(w!==de||ne!==H)&&P0(s,x,d,H),Gi=!1,ne=s.memoizedState,x.state=ne,Vl(s,d,x,m),Il();var se=s.memoizedState;w!==de||ne!==se||Gi||r!==null&&r.dependencies!==null&&Bc(r.dependencies)?(typeof N=="function"&&(Jf(s,o,N,d),se=s.memoizedState),(ce=Gi||$0(s,o,ce,d,ne,se,H)||r!==null&&r.dependencies!==null&&Bc(r.dependencies))?(te||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(d,se,H),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(d,se,H)),typeof x.componentDidUpdate=="function"&&(s.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof x.componentDidUpdate!="function"||w===r.memoizedProps&&ne===r.memoizedState||(s.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||w===r.memoizedProps&&ne===r.memoizedState||(s.flags|=1024),s.memoizedProps=d,s.memoizedState=se),x.props=d,x.state=se,x.context=H,d=ce):(typeof x.componentDidUpdate!="function"||w===r.memoizedProps&&ne===r.memoizedState||(s.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||w===r.memoizedProps&&ne===r.memoizedState||(s.flags|=1024),d=!1)}return x=d,nu(r,s),d=(s.flags&128)!==0,x||d?(x=s.stateNode,o=d&&typeof o.getDerivedStateFromError!="function"?null:x.render(),s.flags|=1,r!==null&&d?(s.child=Fs(s,r.child,null,m),s.child=Fs(s,null,o,m)):wn(r,s,o,m),s.memoizedState=x.state,r=s.child):r=ci(r,s,m),r}function ev(r,s,o,d){return Ls(),s.flags|=256,wn(r,s,o,d),s.child}var ih={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function sh(r){return{baseLanes:r,cachePool:qx()}}function ah(r,s,o){return r=r!==null?r.childLanes&~o:0,s&&(r|=nr),r}function tv(r,s,o){var d=s.pendingProps,m=!1,x=(s.flags&128)!==0,w;if((w=x)||(w=r!==null&&r.memoizedState===null?!1:(Jt.current&2)!==0),w&&(m=!0,s.flags&=-129),w=(s.flags&32)!==0,s.flags&=-33,r===null){if(ct){if(m?Xi(s):Qi(),(r=Lt)?(r=c1(r,xr),r=r!==null&&r.data!=="&"?r:null,r!==null&&(s.memoizedState={dehydrated:r,treeContext:Hi!==null?{id:qr,overflow:Ir}:null,retryLane:536870912,hydrationErrors:null},o=zx(r),o.return=s,s.child=o,yn=s,Lt=null)):r=null,r===null)throw Ii(s);return Hh(r)?s.lanes=32:s.lanes=536870912,null}var N=d.children;return d=d.fallback,m?(Qi(),m=s.mode,N=ru({mode:"hidden",children:N},m),d=zs(d,m,o,null),N.return=s,d.return=s,N.sibling=d,s.child=N,d=s.child,d.memoizedState=sh(o),d.childLanes=ah(r,w,o),s.memoizedState=ih,Ql(null,d)):(Xi(s),lh(s,N))}var H=r.memoizedState;if(H!==null&&(N=H.dehydrated,N!==null)){if(x)s.flags&256?(Xi(s),s.flags&=-257,s=oh(r,s,o)):s.memoizedState!==null?(Qi(),s.child=r.child,s.flags|=128,s=null):(Qi(),N=d.fallback,m=s.mode,d=ru({mode:"visible",children:d.children},m),N=zs(N,m,o,null),N.flags|=2,d.return=s,N.return=s,d.sibling=N,s.child=d,Fs(s,r.child,null,o),d=s.child,d.memoizedState=sh(o),d.childLanes=ah(r,w,o),s.memoizedState=ih,s=Ql(null,d));else if(Xi(s),Hh(N)){if(w=N.nextSibling&&N.nextSibling.dataset,w)var te=w.dgst;w=te,d=Error(i(419)),d.stack="",d.digest=w,$l({value:d,source:null,stack:null}),s=oh(r,s,o)}else if(an||wa(r,s,o,!1),w=(o&r.childLanes)!==0,an||w){if(w=Nt,w!==null&&(d=_s(w,o),d!==0&&d!==H.retryLane))throw H.retryLane=d,Ds(r,d),Vn(w,r,d),nh;Fh(N)||fu(),s=oh(r,s,o)}else Fh(N)?(s.flags|=192,s.child=r.child,s=null):(r=H.treeContext,Lt=br(N.nextSibling),yn=s,ct=!0,qi=null,xr=!1,r!==null&&Bx(s,r),s=lh(s,d.children),s.flags|=4096);return s}return m?(Qi(),N=d.fallback,m=s.mode,H=r.child,te=H.sibling,d=ri(H,{mode:"hidden",children:d.children}),d.subtreeFlags=H.subtreeFlags&65011712,te!==null?N=ri(te,N):(N=zs(N,m,o,null),N.flags|=2),N.return=s,d.return=s,d.sibling=N,s.child=d,Ql(null,d),d=s.child,N=r.child.memoizedState,N===null?N=sh(o):(m=N.cachePool,m!==null?(H=rn._currentValue,m=m.parent!==H?{parent:H,pool:H}:m):m=qx(),N={baseLanes:N.baseLanes|o,cachePool:m}),d.memoizedState=N,d.childLanes=ah(r,w,o),s.memoizedState=ih,Ql(r.child,d)):(Xi(s),o=r.child,r=o.sibling,o=ri(o,{mode:"visible",children:d.children}),o.return=s,o.sibling=null,r!==null&&(w=s.deletions,w===null?(s.deletions=[r],s.flags|=16):w.push(r)),s.child=o,s.memoizedState=null,o)}function lh(r,s){return s=ru({mode:"visible",children:s},r.mode),s.return=r,r.child=s}function ru(r,s){return r=Zn(22,r,null,s),r.lanes=0,r}function oh(r,s,o){return Fs(s,r.child,null,o),r=lh(s,s.pendingProps.children),r.flags|=2,s.memoizedState=null,r}function nv(r,s,o){r.lanes|=s;var d=r.alternate;d!==null&&(d.lanes|=s),kf(r.return,s,o)}function ch(r,s,o,d,m,x){var w=r.memoizedState;w===null?r.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:d,tail:o,tailMode:m,treeForkCount:x}:(w.isBackwards=s,w.rendering=null,w.renderingStartTime=0,w.last=d,w.tail=o,w.tailMode=m,w.treeForkCount=x)}function rv(r,s,o){var d=s.pendingProps,m=d.revealOrder,x=d.tail;d=d.children;var w=Jt.current,N=(w&2)!==0;if(N?(w=w&1|2,s.flags|=128):w&=1,A(Jt,w),wn(r,s,d,o),d=ct?Bl:0,!N&&r!==null&&(r.flags&128)!==0)e:for(r=s.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&nv(r,o,s);else if(r.tag===19)nv(r,o,s);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===s)break e;for(;r.sibling===null;){if(r.return===null||r.return===s)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}switch(m){case"forwards":for(o=s.child,m=null;o!==null;)r=o.alternate,r!==null&&Vc(r)===null&&(m=o),o=o.sibling;o=m,o===null?(m=s.child,s.child=null):(m=o.sibling,o.sibling=null),ch(s,!1,m,o,x,d);break;case"backwards":case"unstable_legacy-backwards":for(o=null,m=s.child,s.child=null;m!==null;){if(r=m.alternate,r!==null&&Vc(r)===null){s.child=m;break}r=m.sibling,m.sibling=o,o=m,m=r}ch(s,!0,o,null,x,d);break;case"together":ch(s,!1,null,null,void 0,d);break;default:s.memoizedState=null}return s.child}function ci(r,s,o){if(r!==null&&(s.dependencies=r.dependencies),Ji|=s.lanes,(o&s.childLanes)===0)if(r!==null){if(wa(r,s,o,!1),(o&s.childLanes)===0)return null}else return null;if(r!==null&&s.child!==r.child)throw Error(i(153));if(s.child!==null){for(r=s.child,o=ri(r,r.pendingProps),s.child=o,o.return=s;r.sibling!==null;)r=r.sibling,o=o.sibling=ri(r,r.pendingProps),o.return=s;o.sibling=null}return s.child}function uh(r,s){return(r.lanes&s)!==0?!0:(r=r.dependencies,!!(r!==null&&Bc(r)))}function Uk(r,s,o){switch(s.tag){case 3:oe(s,s.stateNode.containerInfo),Vi(s,rn,r.memoizedState.cache),Ls();break;case 27:case 5:Fe(s);break;case 4:oe(s,s.stateNode.containerInfo);break;case 10:Vi(s,s.type,s.memoizedProps.value);break;case 31:if(s.memoizedState!==null)return s.flags|=128,Lf(s),null;break;case 13:var d=s.memoizedState;if(d!==null)return d.dehydrated!==null?(Xi(s),s.flags|=128,null):(o&s.child.childLanes)!==0?tv(r,s,o):(Xi(s),r=ci(r,s,o),r!==null?r.sibling:null);Xi(s);break;case 19:var m=(r.flags&128)!==0;if(d=(o&s.childLanes)!==0,d||(wa(r,s,o,!1),d=(o&s.childLanes)!==0),m){if(d)return rv(r,s,o);s.flags|=128}if(m=s.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),A(Jt,Jt.current),d)break;return null;case 22:return s.lanes=0,X0(r,s,o,s.pendingProps);case 24:Vi(s,rn,r.memoizedState.cache)}return ci(r,s,o)}function iv(r,s,o){if(r!==null)if(r.memoizedProps!==s.pendingProps)an=!0;else{if(!uh(r,o)&&(s.flags&128)===0)return an=!1,Uk(r,s,o);an=(r.flags&131072)!==0}else an=!1,ct&&(s.flags&1048576)!==0&&Ox(s,Bl,s.index);switch(s.lanes=0,s.tag){case 16:e:{var d=s.pendingProps;if(r=Ps(s.elementType),s.type=r,typeof r=="function")mf(r)?(d=qs(r,d),s.tag=1,s=J0(null,s,r,d,o)):(s.tag=0,s=rh(null,s,r,d,o));else{if(r!=null){var m=r.$$typeof;if(m===P){s.tag=11,s=G0(null,s,r,d,o);break e}else if(m===F){s.tag=14,s=Y0(null,s,r,d,o);break e}}throw s=K(r)||r,Error(i(306,s,""))}}return s;case 0:return rh(r,s,s.type,s.pendingProps,o);case 1:return d=s.type,m=qs(d,s.pendingProps),J0(r,s,d,m,o);case 3:e:{if(oe(s,s.stateNode.containerInfo),r===null)throw Error(i(387));d=s.pendingProps;var x=s.memoizedState;m=x.element,Af(r,s),Vl(s,d,null,o);var w=s.memoizedState;if(d=w.cache,Vi(s,rn,d),d!==x.cache&&Sf(s,[rn],o,!0),Il(),d=w.element,x.isDehydrated)if(x={element:d,isDehydrated:!1,cache:w.cache},s.updateQueue.baseState=x,s.memoizedState=x,s.flags&256){s=ev(r,s,d,o);break e}else if(d!==m){m=pr(Error(i(424)),s),$l(m),s=ev(r,s,d,o);break e}else{switch(r=s.stateNode.containerInfo,r.nodeType){case 9:r=r.body;break;default:r=r.nodeName==="HTML"?r.ownerDocument.body:r}for(Lt=br(r.firstChild),yn=s,ct=!0,qi=null,xr=!0,o=Xx(s,null,d,o),s.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling}else{if(Ls(),d===m){s=ci(r,s,o);break e}wn(r,s,d,o)}s=s.child}return s;case 26:return nu(r,s),r===null?(o=m1(s.type,null,s.pendingProps,null))?s.memoizedState=o:ct||(o=s.type,r=s.pendingProps,d=bu(je.current).createElement(o),d[Wt]=s,d[Dt]=r,kn(d,o,r),Zt(d),s.stateNode=d):s.memoizedState=m1(s.type,r.memoizedProps,s.pendingProps,r.memoizedState),null;case 27:return Fe(s),r===null&&ct&&(d=s.stateNode=f1(s.type,s.pendingProps,je.current),yn=s,xr=!0,m=Lt,is(s.type)?(qh=m,Lt=br(d.firstChild)):Lt=m),wn(r,s,s.pendingProps.children,o),nu(r,s),r===null&&(s.flags|=4194304),s.child;case 5:return r===null&&ct&&((m=d=Lt)&&(d=gS(d,s.type,s.pendingProps,xr),d!==null?(s.stateNode=d,yn=s,Lt=br(d.firstChild),xr=!1,m=!0):m=!1),m||Ii(s)),Fe(s),m=s.type,x=s.pendingProps,w=r!==null?r.memoizedProps:null,d=x.children,$h(m,x)?d=null:w!==null&&$h(m,w)&&(s.flags|=32),s.memoizedState!==null&&(m=Bf(r,s,Mk,null,null,o),fo._currentValue=m),nu(r,s),wn(r,s,d,o),s.child;case 6:return r===null&&ct&&((r=o=Lt)&&(o=xS(o,s.pendingProps,xr),o!==null?(s.stateNode=o,yn=s,Lt=null,r=!0):r=!1),r||Ii(s)),null;case 13:return tv(r,s,o);case 4:return oe(s,s.stateNode.containerInfo),d=s.pendingProps,r===null?s.child=Fs(s,null,d,o):wn(r,s,d,o),s.child;case 11:return G0(r,s,s.type,s.pendingProps,o);case 7:return wn(r,s,s.pendingProps,o),s.child;case 8:return wn(r,s,s.pendingProps.children,o),s.child;case 12:return wn(r,s,s.pendingProps.children,o),s.child;case 10:return d=s.pendingProps,Vi(s,s.type,d.value),wn(r,s,d.children,o),s.child;case 9:return m=s.type._context,d=s.pendingProps.children,Bs(s),m=_n(m),d=d(m),s.flags|=1,wn(r,s,d,o),s.child;case 14:return Y0(r,s,s.type,s.pendingProps,o);case 15:return W0(r,s,s.type,s.pendingProps,o);case 19:return rv(r,s,o);case 31:return Pk(r,s,o);case 22:return X0(r,s,o,s.pendingProps);case 24:return Bs(s),d=_n(rn),r===null?(m=Cf(),m===null&&(m=Nt,x=jf(),m.pooledCache=x,x.refCount++,x!==null&&(m.pooledCacheLanes|=o),m=x),s.memoizedState={parent:d,cache:m},Tf(s),Vi(s,rn,m)):((r.lanes&o)!==0&&(Af(r,s),Vl(s,null,null,o),Il()),m=r.memoizedState,x=s.memoizedState,m.parent!==d?(m={parent:d,cache:d},s.memoizedState=m,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=m),Vi(s,rn,d)):(d=x.cache,Vi(s,rn,d),d!==m.cache&&Sf(s,[rn],o,!0))),wn(r,s,s.pendingProps.children,o),s.child;case 29:throw s.pendingProps}throw Error(i(156,s.tag))}function ui(r){r.flags|=4}function dh(r,s,o,d,m){if((s=(r.mode&32)!==0)&&(s=!1),s){if(r.flags|=16777216,(m&335544128)===m)if(r.stateNode.complete)r.flags|=8192;else if(Mv())r.flags|=8192;else throw Us=Fc,Ef}else r.flags&=-16777217}function sv(r,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)r.flags&=-16777217;else if(r.flags|=16777216,!y1(s))if(Mv())r.flags|=8192;else throw Us=Fc,Ef}function iu(r,s){s!==null&&(r.flags|=4),r.flags&16384&&(s=r.tag!==22?bl():536870912,r.lanes|=s,za|=s)}function Kl(r,s){if(!ct)switch(r.tailMode){case"hidden":s=r.tail;for(var o=null;s!==null;)s.alternate!==null&&(o=s),s=s.sibling;o===null?r.tail=null:o.sibling=null;break;case"collapsed":o=r.tail;for(var d=null;o!==null;)o.alternate!==null&&(d=o),o=o.sibling;d===null?s||r.tail===null?r.tail=null:r.tail.sibling=null:d.sibling=null}}function Ot(r){var s=r.alternate!==null&&r.alternate.child===r.child,o=0,d=0;if(s)for(var m=r.child;m!==null;)o|=m.lanes|m.childLanes,d|=m.subtreeFlags&65011712,d|=m.flags&65011712,m.return=r,m=m.sibling;else for(m=r.child;m!==null;)o|=m.lanes|m.childLanes,d|=m.subtreeFlags,d|=m.flags,m.return=r,m=m.sibling;return r.subtreeFlags|=d,r.childLanes=o,s}function Fk(r,s,o){var d=s.pendingProps;switch(bf(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ot(s),null;case 1:return Ot(s),null;case 3:return o=s.stateNode,d=null,r!==null&&(d=r.memoizedState.cache),s.memoizedState.cache!==d&&(s.flags|=2048),ai(rn),Ee(),o.pendingContext&&(o.context=o.pendingContext,o.pendingContext=null),(r===null||r.child===null)&&(_a(s)?ui(s):r===null||r.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,_f())),Ot(s),null;case 26:var m=s.type,x=s.memoizedState;return r===null?(ui(s),x!==null?(Ot(s),sv(s,x)):(Ot(s),dh(s,m,null,d,o))):x?x!==r.memoizedState?(ui(s),Ot(s),sv(s,x)):(Ot(s),s.flags&=-16777217):(r=r.memoizedProps,r!==d&&ui(s),Ot(s),dh(s,m,r,d,o)),null;case 27:if(At(s),o=je.current,m=s.type,r!==null&&s.stateNode!=null)r.memoizedProps!==d&&ui(s);else{if(!d){if(s.stateNode===null)throw Error(i(166));return Ot(s),null}r=fe.current,_a(s)?$x(s):(r=f1(m,d,o),s.stateNode=r,ui(s))}return Ot(s),null;case 5:if(At(s),m=s.type,r!==null&&s.stateNode!=null)r.memoizedProps!==d&&ui(s);else{if(!d){if(s.stateNode===null)throw Error(i(166));return Ot(s),null}if(x=fe.current,_a(s))$x(s);else{var w=bu(je.current);switch(x){case 1:x=w.createElementNS("http://www.w3.org/2000/svg",m);break;case 2:x=w.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;default:switch(m){case"svg":x=w.createElementNS("http://www.w3.org/2000/svg",m);break;case"math":x=w.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;case"script":x=w.createElement("div"),x.innerHTML="<script><\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof d.is=="string"?w.createElement("select",{is:d.is}):w.createElement("select"),d.multiple?x.multiple=!0:d.size&&(x.size=d.size);break;default:x=typeof d.is=="string"?w.createElement(m,{is:d.is}):w.createElement(m)}}x[Wt]=s,x[Dt]=d;e:for(w=s.child;w!==null;){if(w.tag===5||w.tag===6)x.appendChild(w.stateNode);else if(w.tag!==4&&w.tag!==27&&w.child!==null){w.child.return=w,w=w.child;continue}if(w===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=x;e:switch(kn(x,m,d),m){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}d&&ui(s)}}return Ot(s),dh(s,s.type,r===null?null:r.memoizedProps,s.pendingProps,o),null;case 6:if(r&&s.stateNode!=null)r.memoizedProps!==d&&ui(s);else{if(typeof d!="string"&&s.stateNode===null)throw Error(i(166));if(r=je.current,_a(s)){if(r=s.stateNode,o=s.memoizedProps,d=null,m=yn,m!==null)switch(m.tag){case 27:case 5:d=m.memoizedProps}r[Wt]=s,r=!!(r.nodeValue===o||d!==null&&d.suppressHydrationWarning===!0||t1(r.nodeValue,o)),r||Ii(s,!0)}else r=bu(r).createTextNode(d),r[Wt]=s,s.stateNode=r}return Ot(s),null;case 31:if(o=s.memoizedState,r===null||r.memoizedState!==null){if(d=_a(s),o!==null){if(r===null){if(!d)throw Error(i(318));if(r=s.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(557));r[Wt]=s}else Ls(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Ot(s),r=!1}else o=_f(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=o),r=!0;if(!r)return s.flags&256?(er(s),s):(er(s),null);if((s.flags&128)!==0)throw Error(i(558))}return Ot(s),null;case 13:if(d=s.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(m=_a(s),d!==null&&d.dehydrated!==null){if(r===null){if(!m)throw Error(i(318));if(m=s.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(i(317));m[Wt]=s}else Ls(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Ot(s),m=!1}else m=_f(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=m),m=!0;if(!m)return s.flags&256?(er(s),s):(er(s),null)}return er(s),(s.flags&128)!==0?(s.lanes=o,s):(o=d!==null,r=r!==null&&r.memoizedState!==null,o&&(d=s.child,m=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(m=d.alternate.memoizedState.cachePool.pool),x=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(x=d.memoizedState.cachePool.pool),x!==m&&(d.flags|=2048)),o!==r&&o&&(s.child.flags|=8192),iu(s,s.updateQueue),Ot(s),null);case 4:return Ee(),r===null&&Dh(s.stateNode.containerInfo),Ot(s),null;case 10:return ai(s.type),Ot(s),null;case 19:if(Z(Jt),d=s.memoizedState,d===null)return Ot(s),null;if(m=(s.flags&128)!==0,x=d.rendering,x===null)if(m)Kl(d,!1);else{if(Qt!==0||r!==null&&(r.flags&128)!==0)for(r=s.child;r!==null;){if(x=Vc(r),x!==null){for(s.flags|=128,Kl(d,!1),r=x.updateQueue,s.updateQueue=r,iu(s,r),s.subtreeFlags=0,r=o,o=s.child;o!==null;)Dx(o,r),o=o.sibling;return A(Jt,Jt.current&1|2),ct&&ii(s,d.treeForkCount),s.child}r=r.sibling}d.tail!==null&&Pe()>cu&&(s.flags|=128,m=!0,Kl(d,!1),s.lanes=4194304)}else{if(!m)if(r=Vc(x),r!==null){if(s.flags|=128,m=!0,r=r.updateQueue,s.updateQueue=r,iu(s,r),Kl(d,!0),d.tail===null&&d.tailMode==="hidden"&&!x.alternate&&!ct)return Ot(s),null}else 2*Pe()-d.renderingStartTime>cu&&o!==536870912&&(s.flags|=128,m=!0,Kl(d,!1),s.lanes=4194304);d.isBackwards?(x.sibling=s.child,s.child=x):(r=d.last,r!==null?r.sibling=x:s.child=x,d.last=x)}return d.tail!==null?(r=d.tail,d.rendering=r,d.tail=r.sibling,d.renderingStartTime=Pe(),r.sibling=null,o=Jt.current,A(Jt,m?o&1|2:o&1),ct&&ii(s,d.treeForkCount),r):(Ot(s),null);case 22:case 23:return er(s),zf(),d=s.memoizedState!==null,r!==null?r.memoizedState!==null!==d&&(s.flags|=8192):d&&(s.flags|=8192),d?(o&536870912)!==0&&(s.flags&128)===0&&(Ot(s),s.subtreeFlags&6&&(s.flags|=8192)):Ot(s),o=s.updateQueue,o!==null&&iu(s,o.retryQueue),o=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),d=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(d=s.memoizedState.cachePool.pool),d!==o&&(s.flags|=2048),r!==null&&Z($s),null;case 24:return o=null,r!==null&&(o=r.memoizedState.cache),s.memoizedState.cache!==o&&(s.flags|=2048),ai(rn),Ot(s),null;case 25:return null;case 30:return null}throw Error(i(156,s.tag))}function Hk(r,s){switch(bf(s),s.tag){case 1:return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 3:return ai(rn),Ee(),r=s.flags,(r&65536)!==0&&(r&128)===0?(s.flags=r&-65537|128,s):null;case 26:case 27:case 5:return At(s),null;case 31:if(s.memoizedState!==null){if(er(s),s.alternate===null)throw Error(i(340));Ls()}return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 13:if(er(s),r=s.memoizedState,r!==null&&r.dehydrated!==null){if(s.alternate===null)throw Error(i(340));Ls()}return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 19:return Z(Jt),null;case 4:return Ee(),null;case 10:return ai(s.type),null;case 22:case 23:return er(s),zf(),r!==null&&Z($s),r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 24:return ai(rn),null;case 25:return null;default:return null}}function av(r,s){switch(bf(s),s.tag){case 3:ai(rn),Ee();break;case 26:case 27:case 5:At(s);break;case 4:Ee();break;case 31:s.memoizedState!==null&&er(s);break;case 13:er(s);break;case 19:Z(Jt);break;case 10:ai(s.type);break;case 22:case 23:er(s),zf(),r!==null&&Z($s);break;case 24:ai(rn)}}function Zl(r,s){try{var o=s.updateQueue,d=o!==null?o.lastEffect:null;if(d!==null){var m=d.next;o=m;do{if((o.tag&r)===r){d=void 0;var x=o.create,w=o.inst;d=x(),w.destroy=d}o=o.next}while(o!==m)}}catch(N){yt(s,s.return,N)}}function Ki(r,s,o){try{var d=s.updateQueue,m=d!==null?d.lastEffect:null;if(m!==null){var x=m.next;d=x;do{if((d.tag&r)===r){var w=d.inst,N=w.destroy;if(N!==void 0){w.destroy=void 0,m=s;var H=o,te=N;try{te()}catch(ce){yt(m,H,ce)}}}d=d.next}while(d!==x)}}catch(ce){yt(s,s.return,ce)}}function lv(r){var s=r.updateQueue;if(s!==null){var o=r.stateNode;try{Kx(s,o)}catch(d){yt(r,r.return,d)}}}function ov(r,s,o){o.props=qs(r.type,r.memoizedProps),o.state=r.memoizedState;try{o.componentWillUnmount()}catch(d){yt(r,s,d)}}function Jl(r,s){try{var o=r.ref;if(o!==null){switch(r.tag){case 26:case 27:case 5:var d=r.stateNode;break;case 30:d=r.stateNode;break;default:d=r.stateNode}typeof o=="function"?r.refCleanup=o(d):o.current=d}}catch(m){yt(r,s,m)}}function Vr(r,s){var o=r.ref,d=r.refCleanup;if(o!==null)if(typeof d=="function")try{d()}catch(m){yt(r,s,m)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof o=="function")try{o(null)}catch(m){yt(r,s,m)}else o.current=null}function cv(r){var s=r.type,o=r.memoizedProps,d=r.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":o.autoFocus&&d.focus();break e;case"img":o.src?d.src=o.src:o.srcSet&&(d.srcset=o.srcSet)}}catch(m){yt(r,r.return,m)}}function fh(r,s,o){try{var d=r.stateNode;uS(d,r.type,o,s),d[Dt]=s}catch(m){yt(r,r.return,m)}}function uv(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&is(r.type)||r.tag===4}function hh(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||uv(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.tag===27&&is(r.type)||r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function ph(r,s,o){var d=r.tag;if(d===5||d===6)r=r.stateNode,s?(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o).insertBefore(r,s):(s=o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,s.appendChild(r),o=o._reactRootContainer,o!=null||s.onclick!==null||(s.onclick=Ve));else if(d!==4&&(d===27&&is(r.type)&&(o=r.stateNode,s=null),r=r.child,r!==null))for(ph(r,s,o),r=r.sibling;r!==null;)ph(r,s,o),r=r.sibling}function su(r,s,o){var d=r.tag;if(d===5||d===6)r=r.stateNode,s?o.insertBefore(r,s):o.appendChild(r);else if(d!==4&&(d===27&&is(r.type)&&(o=r.stateNode),r=r.child,r!==null))for(su(r,s,o),r=r.sibling;r!==null;)su(r,s,o),r=r.sibling}function dv(r){var s=r.stateNode,o=r.memoizedProps;try{for(var d=r.type,m=s.attributes;m.length;)s.removeAttributeNode(m[0]);kn(s,d,o),s[Wt]=r,s[Dt]=o}catch(x){yt(r,r.return,x)}}var di=!1,ln=!1,mh=!1,fv=typeof WeakSet=="function"?WeakSet:Set,gn=null;function qk(r,s){if(r=r.containerInfo,Oh=Nu,r=Sx(r),of(r)){if("selectionStart"in r)var o={start:r.selectionStart,end:r.selectionEnd};else e:{o=(o=r.ownerDocument)&&o.defaultView||window;var d=o.getSelection&&o.getSelection();if(d&&d.rangeCount!==0){o=d.anchorNode;var m=d.anchorOffset,x=d.focusNode;d=d.focusOffset;try{o.nodeType,x.nodeType}catch{o=null;break e}var w=0,N=-1,H=-1,te=0,ce=0,de=r,ne=null;t:for(;;){for(var se;de!==o||m!==0&&de.nodeType!==3||(N=w+m),de!==x||d!==0&&de.nodeType!==3||(H=w+d),de.nodeType===3&&(w+=de.nodeValue.length),(se=de.firstChild)!==null;)ne=de,de=se;for(;;){if(de===r)break t;if(ne===o&&++te===m&&(N=w),ne===x&&++ce===d&&(H=w),(se=de.nextSibling)!==null)break;de=ne,ne=de.parentNode}de=se}o=N===-1||H===-1?null:{start:N,end:H}}else o=null}o=o||{start:0,end:0}}else o=null;for(Bh={focusedElem:r,selectionRange:o},Nu=!1,gn=s;gn!==null;)if(s=gn,r=s.child,(s.subtreeFlags&1028)!==0&&r!==null)r.return=s,gn=r;else for(;gn!==null;){switch(s=gn,x=s.alternate,r=s.flags,s.tag){case 0:if((r&4)!==0&&(r=s.updateQueue,r=r!==null?r.events:null,r!==null))for(o=0;o<r.length;o++)m=r[o],m.ref.impl=m.nextImpl;break;case 11:case 15:break;case 1:if((r&1024)!==0&&x!==null){r=void 0,o=s,m=x.memoizedProps,x=x.memoizedState,d=o.stateNode;try{var Te=qs(o.type,m);r=d.getSnapshotBeforeUpdate(Te,x),d.__reactInternalSnapshotBeforeUpdate=r}catch(Ue){yt(o,o.return,Ue)}}break;case 3:if((r&1024)!==0){if(r=s.stateNode.containerInfo,o=r.nodeType,o===9)Uh(r);else if(o===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":Uh(r);break;default:r.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((r&1024)!==0)throw Error(i(163))}if(r=s.sibling,r!==null){r.return=s.return,gn=r;break}gn=s.return}}function hv(r,s,o){var d=o.flags;switch(o.tag){case 0:case 11:case 15:hi(r,o),d&4&&Zl(5,o);break;case 1:if(hi(r,o),d&4)if(r=o.stateNode,s===null)try{r.componentDidMount()}catch(w){yt(o,o.return,w)}else{var m=qs(o.type,s.memoizedProps);s=s.memoizedState;try{r.componentDidUpdate(m,s,r.__reactInternalSnapshotBeforeUpdate)}catch(w){yt(o,o.return,w)}}d&64&&lv(o),d&512&&Jl(o,o.return);break;case 3:if(hi(r,o),d&64&&(r=o.updateQueue,r!==null)){if(s=null,o.child!==null)switch(o.child.tag){case 27:case 5:s=o.child.stateNode;break;case 1:s=o.child.stateNode}try{Kx(r,s)}catch(w){yt(o,o.return,w)}}break;case 27:s===null&&d&4&&dv(o);case 26:case 5:hi(r,o),s===null&&d&4&&cv(o),d&512&&Jl(o,o.return);break;case 12:hi(r,o);break;case 31:hi(r,o),d&4&&gv(r,o);break;case 13:hi(r,o),d&4&&xv(r,o),d&64&&(r=o.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(o=Zk.bind(null,o),vS(r,o))));break;case 22:if(d=o.memoizedState!==null||di,!d){s=s!==null&&s.memoizedState!==null||ln,m=di;var x=ln;di=d,(ln=s)&&!x?pi(r,o,(o.subtreeFlags&8772)!==0):hi(r,o),di=m,ln=x}break;case 30:break;default:hi(r,o)}}function pv(r){var s=r.alternate;s!==null&&(r.alternate=null,pv(s)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(s=r.stateNode,s!==null&&oa(s)),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}var Ft=null,Fn=!1;function fi(r,s,o){for(o=o.child;o!==null;)mv(r,s,o),o=o.sibling}function mv(r,s,o){if(gt&&typeof gt.onCommitFiberUnmount=="function")try{gt.onCommitFiberUnmount(Je,o)}catch{}switch(o.tag){case 26:ln||Vr(o,s),fi(r,s,o),o.memoizedState?o.memoizedState.count--:o.stateNode&&(o=o.stateNode,o.parentNode.removeChild(o));break;case 27:ln||Vr(o,s);var d=Ft,m=Fn;is(o.type)&&(Ft=o.stateNode,Fn=!1),fi(r,s,o),oo(o.stateNode),Ft=d,Fn=m;break;case 5:ln||Vr(o,s);case 6:if(d=Ft,m=Fn,Ft=null,fi(r,s,o),Ft=d,Fn=m,Ft!==null)if(Fn)try{(Ft.nodeType===9?Ft.body:Ft.nodeName==="HTML"?Ft.ownerDocument.body:Ft).removeChild(o.stateNode)}catch(x){yt(o,s,x)}else try{Ft.removeChild(o.stateNode)}catch(x){yt(o,s,x)}break;case 18:Ft!==null&&(Fn?(r=Ft,l1(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,o.stateNode),Ha(r)):l1(Ft,o.stateNode));break;case 4:d=Ft,m=Fn,Ft=o.stateNode.containerInfo,Fn=!0,fi(r,s,o),Ft=d,Fn=m;break;case 0:case 11:case 14:case 15:Ki(2,o,s),ln||Ki(4,o,s),fi(r,s,o);break;case 1:ln||(Vr(o,s),d=o.stateNode,typeof d.componentWillUnmount=="function"&&ov(o,s,d)),fi(r,s,o);break;case 21:fi(r,s,o);break;case 22:ln=(d=ln)||o.memoizedState!==null,fi(r,s,o),ln=d;break;default:fi(r,s,o)}}function gv(r,s){if(s.memoizedState===null&&(r=s.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{Ha(r)}catch(o){yt(s,s.return,o)}}}function xv(r,s){if(s.memoizedState===null&&(r=s.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{Ha(r)}catch(o){yt(s,s.return,o)}}function Ik(r){switch(r.tag){case 31:case 13:case 19:var s=r.stateNode;return s===null&&(s=r.stateNode=new fv),s;case 22:return r=r.stateNode,s=r._retryCache,s===null&&(s=r._retryCache=new fv),s;default:throw Error(i(435,r.tag))}}function au(r,s){var o=Ik(r);s.forEach(function(d){if(!o.has(d)){o.add(d);var m=Jk.bind(null,r,d);d.then(m,m)}})}function Hn(r,s){var o=s.deletions;if(o!==null)for(var d=0;d<o.length;d++){var m=o[d],x=r,w=s,N=w;e:for(;N!==null;){switch(N.tag){case 27:if(is(N.type)){Ft=N.stateNode,Fn=!1;break e}break;case 5:Ft=N.stateNode,Fn=!1;break e;case 3:case 4:Ft=N.stateNode.containerInfo,Fn=!0;break e}N=N.return}if(Ft===null)throw Error(i(160));mv(x,w,m),Ft=null,Fn=!1,x=m.alternate,x!==null&&(x.return=null),m.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)vv(s,r),s=s.sibling}var Rr=null;function vv(r,s){var o=r.alternate,d=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:Hn(s,r),qn(r),d&4&&(Ki(3,r,r.return),Zl(3,r),Ki(5,r,r.return));break;case 1:Hn(s,r),qn(r),d&512&&(ln||o===null||Vr(o,o.return)),d&64&&di&&(r=r.updateQueue,r!==null&&(d=r.callbacks,d!==null&&(o=r.shared.hiddenCallbacks,r.shared.hiddenCallbacks=o===null?d:o.concat(d))));break;case 26:var m=Rr;if(Hn(s,r),qn(r),d&512&&(ln||o===null||Vr(o,o.return)),d&4){var x=o!==null?o.memoizedState:null;if(d=r.memoizedState,o===null)if(d===null)if(r.stateNode===null){e:{d=r.type,o=r.memoizedProps,m=m.ownerDocument||m;t:switch(d){case"title":x=m.getElementsByTagName("title")[0],(!x||x[ks]||x[Wt]||x.namespaceURI==="http://www.w3.org/2000/svg"||x.hasAttribute("itemprop"))&&(x=m.createElement(d),m.head.insertBefore(x,m.querySelector("head > title"))),kn(x,d,o),x[Wt]=r,Zt(x),d=x;break e;case"link":var w=v1("link","href",m).get(d+(o.href||""));if(w){for(var N=0;N<w.length;N++)if(x=w[N],x.getAttribute("href")===(o.href==null||o.href===""?null:o.href)&&x.getAttribute("rel")===(o.rel==null?null:o.rel)&&x.getAttribute("title")===(o.title==null?null:o.title)&&x.getAttribute("crossorigin")===(o.crossOrigin==null?null:o.crossOrigin)){w.splice(N,1);break t}}x=m.createElement(d),kn(x,d,o),m.head.appendChild(x);break;case"meta":if(w=v1("meta","content",m).get(d+(o.content||""))){for(N=0;N<w.length;N++)if(x=w[N],x.getAttribute("content")===(o.content==null?null:""+o.content)&&x.getAttribute("name")===(o.name==null?null:o.name)&&x.getAttribute("property")===(o.property==null?null:o.property)&&x.getAttribute("http-equiv")===(o.httpEquiv==null?null:o.httpEquiv)&&x.getAttribute("charset")===(o.charSet==null?null:o.charSet)){w.splice(N,1);break t}}x=m.createElement(d),kn(x,d,o),m.head.appendChild(x);break;default:throw Error(i(468,d))}x[Wt]=r,Zt(x),d=x}r.stateNode=d}else b1(m,r.type,r.stateNode);else r.stateNode=x1(m,d,r.memoizedProps);else x!==d?(x===null?o.stateNode!==null&&(o=o.stateNode,o.parentNode.removeChild(o)):x.count--,d===null?b1(m,r.type,r.stateNode):x1(m,d,r.memoizedProps)):d===null&&r.stateNode!==null&&fh(r,r.memoizedProps,o.memoizedProps)}break;case 27:Hn(s,r),qn(r),d&512&&(ln||o===null||Vr(o,o.return)),o!==null&&d&4&&fh(r,r.memoizedProps,o.memoizedProps);break;case 5:if(Hn(s,r),qn(r),d&512&&(ln||o===null||Vr(o,o.return)),r.flags&32){m=r.stateNode;try{Ui(m,"")}catch(Te){yt(r,r.return,Te)}}d&4&&r.stateNode!=null&&(m=r.memoizedProps,fh(r,m,o!==null?o.memoizedProps:m)),d&1024&&(mh=!0);break;case 6:if(Hn(s,r),qn(r),d&4){if(r.stateNode===null)throw Error(i(162));d=r.memoizedProps,o=r.stateNode;try{o.nodeValue=d}catch(Te){yt(r,r.return,Te)}}break;case 3:if(wu=null,m=Rr,Rr=yu(s.containerInfo),Hn(s,r),Rr=m,qn(r),d&4&&o!==null&&o.memoizedState.isDehydrated)try{Ha(s.containerInfo)}catch(Te){yt(r,r.return,Te)}mh&&(mh=!1,bv(r));break;case 4:d=Rr,Rr=yu(r.stateNode.containerInfo),Hn(s,r),qn(r),Rr=d;break;case 12:Hn(s,r),qn(r);break;case 31:Hn(s,r),qn(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,au(r,d)));break;case 13:Hn(s,r),qn(r),r.child.flags&8192&&r.memoizedState!==null!=(o!==null&&o.memoizedState!==null)&&(ou=Pe()),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,au(r,d)));break;case 22:m=r.memoizedState!==null;var H=o!==null&&o.memoizedState!==null,te=di,ce=ln;if(di=te||m,ln=ce||H,Hn(s,r),ln=ce,di=te,qn(r),d&8192)e:for(s=r.stateNode,s._visibility=m?s._visibility&-2:s._visibility|1,m&&(o===null||H||di||ln||Is(r)),o=null,s=r;;){if(s.tag===5||s.tag===26){if(o===null){H=o=s;try{if(x=H.stateNode,m)w=x.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{N=H.stateNode;var de=H.memoizedProps.style,ne=de!=null&&de.hasOwnProperty("display")?de.display:null;N.style.display=ne==null||typeof ne=="boolean"?"":(""+ne).trim()}}catch(Te){yt(H,H.return,Te)}}}else if(s.tag===6){if(o===null){H=s;try{H.stateNode.nodeValue=m?"":H.memoizedProps}catch(Te){yt(H,H.return,Te)}}}else if(s.tag===18){if(o===null){H=s;try{var se=H.stateNode;m?o1(se,!0):o1(H.stateNode,!1)}catch(Te){yt(H,H.return,Te)}}}else if((s.tag!==22&&s.tag!==23||s.memoizedState===null||s===r)&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===r)break e;for(;s.sibling===null;){if(s.return===null||s.return===r)break e;o===s&&(o=null),s=s.return}o===s&&(o=null),s.sibling.return=s.return,s=s.sibling}d&4&&(d=r.updateQueue,d!==null&&(o=d.retryQueue,o!==null&&(d.retryQueue=null,au(r,o))));break;case 19:Hn(s,r),qn(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,au(r,d)));break;case 30:break;case 21:break;default:Hn(s,r),qn(r)}}function qn(r){var s=r.flags;if(s&2){try{for(var o,d=r.return;d!==null;){if(uv(d)){o=d;break}d=d.return}if(o==null)throw Error(i(160));switch(o.tag){case 27:var m=o.stateNode,x=hh(r);su(r,x,m);break;case 5:var w=o.stateNode;o.flags&32&&(Ui(w,""),o.flags&=-33);var N=hh(r);su(r,N,w);break;case 3:case 4:var H=o.stateNode.containerInfo,te=hh(r);ph(r,te,H);break;default:throw Error(i(161))}}catch(ce){yt(r,r.return,ce)}r.flags&=-3}s&4096&&(r.flags&=-4097)}function bv(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var s=r;bv(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),r=r.sibling}}function hi(r,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)hv(r,s.alternate,s),s=s.sibling}function Is(r){for(r=r.child;r!==null;){var s=r;switch(s.tag){case 0:case 11:case 14:case 15:Ki(4,s,s.return),Is(s);break;case 1:Vr(s,s.return);var o=s.stateNode;typeof o.componentWillUnmount=="function"&&ov(s,s.return,o),Is(s);break;case 27:oo(s.stateNode);case 26:case 5:Vr(s,s.return),Is(s);break;case 22:s.memoizedState===null&&Is(s);break;case 30:Is(s);break;default:Is(s)}r=r.sibling}}function pi(r,s,o){for(o=o&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var d=s.alternate,m=r,x=s,w=x.flags;switch(x.tag){case 0:case 11:case 15:pi(m,x,o),Zl(4,x);break;case 1:if(pi(m,x,o),d=x,m=d.stateNode,typeof m.componentDidMount=="function")try{m.componentDidMount()}catch(te){yt(d,d.return,te)}if(d=x,m=d.updateQueue,m!==null){var N=d.stateNode;try{var H=m.shared.hiddenCallbacks;if(H!==null)for(m.shared.hiddenCallbacks=null,m=0;m<H.length;m++)Qx(H[m],N)}catch(te){yt(d,d.return,te)}}o&&w&64&&lv(x),Jl(x,x.return);break;case 27:dv(x);case 26:case 5:pi(m,x,o),o&&d===null&&w&4&&cv(x),Jl(x,x.return);break;case 12:pi(m,x,o);break;case 31:pi(m,x,o),o&&w&4&&gv(m,x);break;case 13:pi(m,x,o),o&&w&4&&xv(m,x);break;case 22:x.memoizedState===null&&pi(m,x,o),Jl(x,x.return);break;case 30:break;default:pi(m,x,o)}s=s.sibling}}function gh(r,s){var o=null;r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),r=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(r=s.memoizedState.cachePool.pool),r!==o&&(r!=null&&r.refCount++,o!=null&&Pl(o))}function xh(r,s){r=null,s.alternate!==null&&(r=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==r&&(s.refCount++,r!=null&&Pl(r))}function Dr(r,s,o,d){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)yv(r,s,o,d),s=s.sibling}function yv(r,s,o,d){var m=s.flags;switch(s.tag){case 0:case 11:case 15:Dr(r,s,o,d),m&2048&&Zl(9,s);break;case 1:Dr(r,s,o,d);break;case 3:Dr(r,s,o,d),m&2048&&(r=null,s.alternate!==null&&(r=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==r&&(s.refCount++,r!=null&&Pl(r)));break;case 12:if(m&2048){Dr(r,s,o,d),r=s.stateNode;try{var x=s.memoizedProps,w=x.id,N=x.onPostCommit;typeof N=="function"&&N(w,s.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(H){yt(s,s.return,H)}}else Dr(r,s,o,d);break;case 31:Dr(r,s,o,d);break;case 13:Dr(r,s,o,d);break;case 23:break;case 22:x=s.stateNode,w=s.alternate,s.memoizedState!==null?x._visibility&2?Dr(r,s,o,d):eo(r,s):x._visibility&2?Dr(r,s,o,d):(x._visibility|=2,Ma(r,s,o,d,(s.subtreeFlags&10256)!==0||!1)),m&2048&&gh(w,s);break;case 24:Dr(r,s,o,d),m&2048&&xh(s.alternate,s);break;default:Dr(r,s,o,d)}}function Ma(r,s,o,d,m){for(m=m&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var x=r,w=s,N=o,H=d,te=w.flags;switch(w.tag){case 0:case 11:case 15:Ma(x,w,N,H,m),Zl(8,w);break;case 23:break;case 22:var ce=w.stateNode;w.memoizedState!==null?ce._visibility&2?Ma(x,w,N,H,m):eo(x,w):(ce._visibility|=2,Ma(x,w,N,H,m)),m&&te&2048&&gh(w.alternate,w);break;case 24:Ma(x,w,N,H,m),m&&te&2048&&xh(w.alternate,w);break;default:Ma(x,w,N,H,m)}s=s.sibling}}function eo(r,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var o=r,d=s,m=d.flags;switch(d.tag){case 22:eo(o,d),m&2048&&gh(d.alternate,d);break;case 24:eo(o,d),m&2048&&xh(d.alternate,d);break;default:eo(o,d)}s=s.sibling}}var to=8192;function Ra(r,s,o){if(r.subtreeFlags&to)for(r=r.child;r!==null;)_v(r,s,o),r=r.sibling}function _v(r,s,o){switch(r.tag){case 26:Ra(r,s,o),r.flags&to&&r.memoizedState!==null&&AS(o,Rr,r.memoizedState,r.memoizedProps);break;case 5:Ra(r,s,o);break;case 3:case 4:var d=Rr;Rr=yu(r.stateNode.containerInfo),Ra(r,s,o),Rr=d;break;case 22:r.memoizedState===null&&(d=r.alternate,d!==null&&d.memoizedState!==null?(d=to,to=16777216,Ra(r,s,o),to=d):Ra(r,s,o));break;default:Ra(r,s,o)}}function wv(r){var s=r.alternate;if(s!==null&&(r=s.child,r!==null)){s.child=null;do s=r.sibling,r.sibling=null,r=s;while(r!==null)}}function no(r){var s=r.deletions;if((r.flags&16)!==0){if(s!==null)for(var o=0;o<s.length;o++){var d=s[o];gn=d,Sv(d,r)}wv(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)kv(r),r=r.sibling}function kv(r){switch(r.tag){case 0:case 11:case 15:no(r),r.flags&2048&&Ki(9,r,r.return);break;case 3:no(r);break;case 12:no(r);break;case 22:var s=r.stateNode;r.memoizedState!==null&&s._visibility&2&&(r.return===null||r.return.tag!==13)?(s._visibility&=-3,lu(r)):no(r);break;default:no(r)}}function lu(r){var s=r.deletions;if((r.flags&16)!==0){if(s!==null)for(var o=0;o<s.length;o++){var d=s[o];gn=d,Sv(d,r)}wv(r)}for(r=r.child;r!==null;){switch(s=r,s.tag){case 0:case 11:case 15:Ki(8,s,s.return),lu(s);break;case 22:o=s.stateNode,o._visibility&2&&(o._visibility&=-3,lu(s));break;default:lu(s)}r=r.sibling}}function Sv(r,s){for(;gn!==null;){var o=gn;switch(o.tag){case 0:case 11:case 15:Ki(8,o,s);break;case 23:case 22:if(o.memoizedState!==null&&o.memoizedState.cachePool!==null){var d=o.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:Pl(o.memoizedState.cache)}if(d=o.child,d!==null)d.return=o,gn=d;else e:for(o=r;gn!==null;){d=gn;var m=d.sibling,x=d.return;if(pv(d),d===o){gn=null;break e}if(m!==null){m.return=x,gn=m;break e}gn=x}}}var Vk={getCacheForType:function(r){var s=_n(rn),o=s.data.get(r);return o===void 0&&(o=r(),s.data.set(r,o)),o},cacheSignal:function(){return _n(rn).controller.signal}},Gk=typeof WeakMap=="function"?WeakMap:Map,mt=0,Nt=null,et=null,at=0,bt=0,tr=null,Zi=!1,Da=!1,vh=!1,mi=0,Qt=0,Ji=0,Vs=0,bh=0,nr=0,za=0,ro=null,In=null,yh=!1,ou=0,jv=0,cu=1/0,uu=null,es=null,fn=0,ts=null,La=null,gi=0,_h=0,wh=null,Nv=null,io=0,kh=null;function rr(){return(mt&2)!==0&&at!==0?at&-at:U.T!==null?Th():$r()}function Cv(){if(nr===0)if((at&536870912)===0||ct){var r=xt;xt<<=1,(xt&3932160)===0&&(xt=262144),nr=r}else nr=536870912;return r=Jn.current,r!==null&&(r.flags|=32),nr}function Vn(r,s,o){(r===Nt&&(bt===2||bt===9)||r.cancelPendingCommit!==null)&&(Oa(r,0),ns(r,at,nr,!1)),bs(r,o),((mt&2)===0||r!==Nt)&&(r===Nt&&((mt&2)===0&&(Vs|=o),Qt===4&&ns(r,at,nr,!1)),Gr(r))}function Ev(r,s,o){if((mt&6)!==0)throw Error(i(327));var d=!o&&(s&127)===0&&(s&r.expiredLanes)===0||Er(r,s),m=d?Xk(r,s):jh(r,s,!0),x=d;do{if(m===0){Da&&!d&&ns(r,s,0,!1);break}else{if(o=r.current.alternate,x&&!Yk(o)){m=jh(r,s,!1),x=!1;continue}if(m===2){if(x=s,r.errorRecoveryDisabledLanes&x)var w=0;else w=r.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){s=w;e:{var N=r;m=ro;var H=N.current.memoizedState.isDehydrated;if(H&&(Oa(N,w).flags|=256),w=jh(N,w,!1),w!==2){if(vh&&!H){N.errorRecoveryDisabledLanes|=x,Vs|=x,m=4;break e}x=In,In=m,x!==null&&(In===null?In=x:In.push.apply(In,x))}m=w}if(x=!1,m!==2)continue}}if(m===1){Oa(r,0),ns(r,s,0,!0);break}e:{switch(d=r,x=m,x){case 0:case 1:throw Error(i(345));case 4:if((s&4194048)!==s)break;case 6:ns(d,s,nr,!Zi);break e;case 2:In=null;break;case 3:case 5:break;default:throw Error(i(329))}if((s&62914560)===s&&(m=ou+300-Pe(),10<m)){if(ns(d,s,nr,!Zi),Cn(d,0,!0)!==0)break e;gi=s,d.timeoutHandle=s1(Tv.bind(null,d,o,In,uu,yh,s,nr,Vs,za,Zi,x,"Throttled",-0,0),m);break e}Tv(d,o,In,uu,yh,s,nr,Vs,za,Zi,x,null,-0,0)}}break}while(!0);Gr(r)}function Tv(r,s,o,d,m,x,w,N,H,te,ce,de,ne,se){if(r.timeoutHandle=-1,de=s.subtreeFlags,de&8192||(de&16785408)===16785408){de={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ve},_v(s,x,de);var Te=(x&62914560)===x?ou-Pe():(x&4194048)===x?jv-Pe():0;if(Te=MS(de,Te),Te!==null){gi=x,r.cancelPendingCommit=Te(Bv.bind(null,r,s,x,o,d,m,w,N,H,ce,de,null,ne,se)),ns(r,x,w,!te);return}}Bv(r,s,x,o,d,m,w,N,H)}function Yk(r){for(var s=r;;){var o=s.tag;if((o===0||o===11||o===15)&&s.flags&16384&&(o=s.updateQueue,o!==null&&(o=o.stores,o!==null)))for(var d=0;d<o.length;d++){var m=o[d],x=m.getSnapshot;m=m.value;try{if(!Kn(x(),m))return!1}catch{return!1}}if(o=s.child,s.subtreeFlags&16384&&o!==null)o.return=s,s=o;else{if(s===r)break;for(;s.sibling===null;){if(s.return===null||s.return===r)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function ns(r,s,o,d){s&=~bh,s&=~Vs,r.suspendedLanes|=s,r.pingedLanes&=~s,d&&(r.warmLanes|=s),d=r.expirationTimes;for(var m=s;0<m;){var x=31-J(m),w=1<<x;d[x]=-1,m&=~w}o!==0&&Di(r,o,s)}function du(){return(mt&6)===0?(so(0),!1):!0}function Sh(){if(et!==null){if(bt===0)var r=et.return;else r=et,si=Os=null,Uf(r),Na=null,Fl=0,r=et;for(;r!==null;)av(r.alternate,r),r=r.return;et=null}}function Oa(r,s){var o=r.timeoutHandle;o!==-1&&(r.timeoutHandle=-1,hS(o)),o=r.cancelPendingCommit,o!==null&&(r.cancelPendingCommit=null,o()),gi=0,Sh(),Nt=r,et=o=ri(r.current,null),at=s,bt=0,tr=null,Zi=!1,Da=Er(r,s),vh=!1,za=nr=bh=Vs=Ji=Qt=0,In=ro=null,yh=!1,(s&8)!==0&&(s|=s&32);var d=r.entangledLanes;if(d!==0)for(r=r.entanglements,d&=s;0<d;){var m=31-J(d),x=1<<m;s|=r[m],d&=~x}return mi=s,Rc(),o}function Av(r,s){We=null,U.H=Xl,s===ja||s===Uc?(s=Gx(),bt=3):s===Ef?(s=Gx(),bt=4):bt=s===nh?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,tr=s,et===null&&(Qt=1,eu(r,pr(s,r.current)))}function Mv(){var r=Jn.current;return r===null?!0:(at&4194048)===at?vr===null:(at&62914560)===at||(at&536870912)!==0?r===vr:!1}function Rv(){var r=U.H;return U.H=Xl,r===null?Xl:r}function Dv(){var r=U.A;return U.A=Vk,r}function fu(){Qt=4,Zi||(at&4194048)!==at&&Jn.current!==null||(Da=!0),(Ji&134217727)===0&&(Vs&134217727)===0||Nt===null||ns(Nt,at,nr,!1)}function jh(r,s,o){var d=mt;mt|=2;var m=Rv(),x=Dv();(Nt!==r||at!==s)&&(uu=null,Oa(r,s)),s=!1;var w=Qt;e:do try{if(bt!==0&&et!==null){var N=et,H=tr;switch(bt){case 8:Sh(),w=6;break e;case 3:case 2:case 9:case 6:Jn.current===null&&(s=!0);var te=bt;if(bt=0,tr=null,Ba(r,N,H,te),o&&Da){w=0;break e}break;default:te=bt,bt=0,tr=null,Ba(r,N,H,te)}}Wk(),w=Qt;break}catch(ce){Av(r,ce)}while(!0);return s&&r.shellSuspendCounter++,si=Os=null,mt=d,U.H=m,U.A=x,et===null&&(Nt=null,at=0,Rc()),w}function Wk(){for(;et!==null;)zv(et)}function Xk(r,s){var o=mt;mt|=2;var d=Rv(),m=Dv();Nt!==r||at!==s?(uu=null,cu=Pe()+500,Oa(r,s)):Da=Er(r,s);e:do try{if(bt!==0&&et!==null){s=et;var x=tr;t:switch(bt){case 1:bt=0,tr=null,Ba(r,s,x,1);break;case 2:case 9:if(Ix(x)){bt=0,tr=null,Lv(s);break}s=function(){bt!==2&&bt!==9||Nt!==r||(bt=7),Gr(r)},x.then(s,s);break e;case 3:bt=7;break e;case 4:bt=5;break e;case 7:Ix(x)?(bt=0,tr=null,Lv(s)):(bt=0,tr=null,Ba(r,s,x,7));break;case 5:var w=null;switch(et.tag){case 26:w=et.memoizedState;case 5:case 27:var N=et;if(w?y1(w):N.stateNode.complete){bt=0,tr=null;var H=N.sibling;if(H!==null)et=H;else{var te=N.return;te!==null?(et=te,hu(te)):et=null}break t}}bt=0,tr=null,Ba(r,s,x,5);break;case 6:bt=0,tr=null,Ba(r,s,x,6);break;case 8:Sh(),Qt=6;break e;default:throw Error(i(462))}}Qk();break}catch(ce){Av(r,ce)}while(!0);return si=Os=null,U.H=d,U.A=m,mt=o,et!==null?0:(Nt=null,at=0,Rc(),Qt)}function Qk(){for(;et!==null&&!ze();)zv(et)}function zv(r){var s=iv(r.alternate,r,mi);r.memoizedProps=r.pendingProps,s===null?hu(r):et=s}function Lv(r){var s=r,o=s.alternate;switch(s.tag){case 15:case 0:s=Z0(o,s,s.pendingProps,s.type,void 0,at);break;case 11:s=Z0(o,s,s.pendingProps,s.type.render,s.ref,at);break;case 5:Uf(s);default:av(o,s),s=et=Dx(s,mi),s=iv(o,s,mi)}r.memoizedProps=r.pendingProps,s===null?hu(r):et=s}function Ba(r,s,o,d){si=Os=null,Uf(s),Na=null,Fl=0;var m=s.return;try{if($k(r,m,s,o,at)){Qt=1,eu(r,pr(o,r.current)),et=null;return}}catch(x){if(m!==null)throw et=m,x;Qt=1,eu(r,pr(o,r.current)),et=null;return}s.flags&32768?(ct||d===1?r=!0:Da||(at&536870912)!==0?r=!1:(Zi=r=!0,(d===2||d===9||d===3||d===6)&&(d=Jn.current,d!==null&&d.tag===13&&(d.flags|=16384))),Ov(s,r)):hu(s)}function hu(r){var s=r;do{if((s.flags&32768)!==0){Ov(s,Zi);return}r=s.return;var o=Fk(s.alternate,s,mi);if(o!==null){et=o;return}if(s=s.sibling,s!==null){et=s;return}et=s=r}while(s!==null);Qt===0&&(Qt=5)}function Ov(r,s){do{var o=Hk(r.alternate,r);if(o!==null){o.flags&=32767,et=o;return}if(o=r.return,o!==null&&(o.flags|=32768,o.subtreeFlags=0,o.deletions=null),!s&&(r=r.sibling,r!==null)){et=r;return}et=r=o}while(r!==null);Qt=6,et=null}function Bv(r,s,o,d,m,x,w,N,H){r.cancelPendingCommit=null;do pu();while(fn!==0);if((mt&6)!==0)throw Error(i(327));if(s!==null){if(s===r.current)throw Error(i(177));if(x=s.lanes|s.childLanes,x|=hf,Xd(r,o,x,w,N,H),r===Nt&&(et=Nt=null,at=0),La=s,ts=r,gi=o,_h=x,wh=m,Nv=d,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(r.callbackNode=null,r.callbackPriority=0,eS(W,function(){return Hv(),null})):(r.callbackNode=null,r.callbackPriority=0),d=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||d){d=U.T,U.T=null,m=$.p,$.p=2,w=mt,mt|=4;try{qk(r,s,o)}finally{mt=w,$.p=m,U.T=d}}fn=1,$v(),Pv(),Uv()}}function $v(){if(fn===1){fn=0;var r=ts,s=La,o=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||o){o=U.T,U.T=null;var d=$.p;$.p=2;var m=mt;mt|=4;try{vv(s,r);var x=Bh,w=Sx(r.containerInfo),N=x.focusedElem,H=x.selectionRange;if(w!==N&&N&&N.ownerDocument&&kx(N.ownerDocument.documentElement,N)){if(H!==null&&of(N)){var te=H.start,ce=H.end;if(ce===void 0&&(ce=te),"selectionStart"in N)N.selectionStart=te,N.selectionEnd=Math.min(ce,N.value.length);else{var de=N.ownerDocument||document,ne=de&&de.defaultView||window;if(ne.getSelection){var se=ne.getSelection(),Te=N.textContent.length,Ue=Math.min(H.start,Te),St=H.end===void 0?Ue:Math.min(H.end,Te);!se.extend&&Ue>St&&(w=St,St=Ue,Ue=w);var Q=wx(N,Ue),V=wx(N,St);if(Q&&V&&(se.rangeCount!==1||se.anchorNode!==Q.node||se.anchorOffset!==Q.offset||se.focusNode!==V.node||se.focusOffset!==V.offset)){var ee=de.createRange();ee.setStart(Q.node,Q.offset),se.removeAllRanges(),Ue>St?(se.addRange(ee),se.extend(V.node,V.offset)):(ee.setEnd(V.node,V.offset),se.addRange(ee))}}}}for(de=[],se=N;se=se.parentNode;)se.nodeType===1&&de.push({element:se,left:se.scrollLeft,top:se.scrollTop});for(typeof N.focus=="function"&&N.focus(),N=0;N<de.length;N++){var ue=de[N];ue.element.scrollLeft=ue.left,ue.element.scrollTop=ue.top}}Nu=!!Oh,Bh=Oh=null}finally{mt=m,$.p=d,U.T=o}}r.current=s,fn=2}}function Pv(){if(fn===2){fn=0;var r=ts,s=La,o=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||o){o=U.T,U.T=null;var d=$.p;$.p=2;var m=mt;mt|=4;try{hv(r,s.alternate,s)}finally{mt=m,$.p=d,U.T=o}}fn=3}}function Uv(){if(fn===4||fn===3){fn=0,ot();var r=ts,s=La,o=gi,d=Nv;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?fn=5:(fn=0,La=ts=null,Fv(r,r.pendingLanes));var m=r.pendingLanes;if(m===0&&(es=null),la(o),s=s.stateNode,gt&&typeof gt.onCommitFiberRoot=="function")try{gt.onCommitFiberRoot(Je,s,void 0,(s.current.flags&128)===128)}catch{}if(d!==null){s=U.T,m=$.p,$.p=2,U.T=null;try{for(var x=r.onRecoverableError,w=0;w<d.length;w++){var N=d[w];x(N.value,{componentStack:N.stack})}}finally{U.T=s,$.p=m}}(gi&3)!==0&&pu(),Gr(r),m=r.pendingLanes,(o&261930)!==0&&(m&42)!==0?r===kh?io++:(io=0,kh=r):io=0,so(0)}}function Fv(r,s){(r.pooledCacheLanes&=s)===0&&(s=r.pooledCache,s!=null&&(r.pooledCache=null,Pl(s)))}function pu(){return $v(),Pv(),Uv(),Hv()}function Hv(){if(fn!==5)return!1;var r=ts,s=_h;_h=0;var o=la(gi),d=U.T,m=$.p;try{$.p=32>o?32:o,U.T=null,o=wh,wh=null;var x=ts,w=gi;if(fn=0,La=ts=null,gi=0,(mt&6)!==0)throw Error(i(331));var N=mt;if(mt|=4,kv(x.current),yv(x,x.current,w,o),mt=N,so(0,!1),gt&&typeof gt.onPostCommitFiberRoot=="function")try{gt.onPostCommitFiberRoot(Je,x)}catch{}return!0}finally{$.p=m,U.T=d,Fv(r,s)}}function qv(r,s,o){s=pr(o,s),s=th(r.stateNode,s,2),r=Wi(r,s,2),r!==null&&(bs(r,2),Gr(r))}function yt(r,s,o){if(r.tag===3)qv(r,r,o);else for(;s!==null;){if(s.tag===3){qv(s,r,o);break}else if(s.tag===1){var d=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(es===null||!es.has(d))){r=pr(o,r),o=I0(2),d=Wi(s,o,2),d!==null&&(V0(o,d,s,r),bs(d,2),Gr(d));break}}s=s.return}}function Nh(r,s,o){var d=r.pingCache;if(d===null){d=r.pingCache=new Gk;var m=new Set;d.set(s,m)}else m=d.get(s),m===void 0&&(m=new Set,d.set(s,m));m.has(o)||(vh=!0,m.add(o),r=Kk.bind(null,r,s,o),s.then(r,r))}function Kk(r,s,o){var d=r.pingCache;d!==null&&d.delete(s),r.pingedLanes|=r.suspendedLanes&o,r.warmLanes&=~o,Nt===r&&(at&o)===o&&(Qt===4||Qt===3&&(at&62914560)===at&&300>Pe()-ou?(mt&2)===0&&Oa(r,0):bh|=o,za===at&&(za=0)),Gr(r)}function Iv(r,s){s===0&&(s=bl()),r=Ds(r,s),r!==null&&(bs(r,s),Gr(r))}function Zk(r){var s=r.memoizedState,o=0;s!==null&&(o=s.retryLane),Iv(r,o)}function Jk(r,s){var o=0;switch(r.tag){case 31:case 13:var d=r.stateNode,m=r.memoizedState;m!==null&&(o=m.retryLane);break;case 19:d=r.stateNode;break;case 22:d=r.stateNode._retryCache;break;default:throw Error(i(314))}d!==null&&d.delete(s),Iv(r,o)}function eS(r,s){return nn(r,s)}var mu=null,$a=null,Ch=!1,gu=!1,Eh=!1,rs=0;function Gr(r){r!==$a&&r.next===null&&($a===null?mu=$a=r:$a=$a.next=r),gu=!0,Ch||(Ch=!0,nS())}function so(r,s){if(!Eh&&gu){Eh=!0;do for(var o=!1,d=mu;d!==null;){if(r!==0){var m=d.pendingLanes;if(m===0)var x=0;else{var w=d.suspendedLanes,N=d.pingedLanes;x=(1<<31-J(42|r)+1)-1,x&=m&~(w&~N),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(o=!0,Wv(d,x))}else x=at,x=Cn(d,d===Nt?x:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(x&3)===0||Er(d,x)||(o=!0,Wv(d,x));d=d.next}while(o);Eh=!1}}function tS(){Vv()}function Vv(){gu=Ch=!1;var r=0;rs!==0&&fS()&&(r=rs);for(var s=Pe(),o=null,d=mu;d!==null;){var m=d.next,x=Gv(d,s);x===0?(d.next=null,o===null?mu=m:o.next=m,m===null&&($a=o)):(o=d,(r!==0||(x&3)!==0)&&(gu=!0)),d=m}fn!==0&&fn!==5||so(r),rs!==0&&(rs=0)}function Gv(r,s){for(var o=r.suspendedLanes,d=r.pingedLanes,m=r.expirationTimes,x=r.pendingLanes&-62914561;0<x;){var w=31-J(x),N=1<<w,H=m[w];H===-1?((N&o)===0||(N&d)!==0)&&(m[w]=Ri(N,s)):H<=s&&(r.expiredLanes|=N),x&=~N}if(s=Nt,o=at,o=Cn(r,r===s?o:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d=r.callbackNode,o===0||r===s&&(bt===2||bt===9)||r.cancelPendingCommit!==null)return d!==null&&d!==null&&ke(d),r.callbackNode=null,r.callbackPriority=0;if((o&3)===0||Er(r,o)){if(s=o&-o,s===r.callbackPriority)return s;switch(d!==null&&ke(d),la(o)){case 2:case 8:o=be;break;case 32:o=W;break;case 268435456:o=Ae;break;default:o=W}return d=Yv.bind(null,r),o=nn(o,d),r.callbackPriority=s,r.callbackNode=o,s}return d!==null&&d!==null&&ke(d),r.callbackPriority=2,r.callbackNode=null,2}function Yv(r,s){if(fn!==0&&fn!==5)return r.callbackNode=null,r.callbackPriority=0,null;var o=r.callbackNode;if(pu()&&r.callbackNode!==o)return null;var d=at;return d=Cn(r,r===Nt?d:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d===0?null:(Ev(r,d,s),Gv(r,Pe()),r.callbackNode!=null&&r.callbackNode===o?Yv.bind(null,r):null)}function Wv(r,s){if(pu())return null;Ev(r,s,!0)}function nS(){pS(function(){(mt&6)!==0?nn(le,tS):Vv()})}function Th(){if(rs===0){var r=ka;r===0&&(r=_t,_t<<=1,(_t&261888)===0&&(_t=256)),rs=r}return rs}function Xv(r){return r==null||typeof r=="symbol"||typeof r=="boolean"?null:typeof r=="function"?r:ge(""+r)}function Qv(r,s){var o=s.ownerDocument.createElement("input");return o.name=s.name,o.value=s.value,r.id&&o.setAttribute("form",r.id),s.parentNode.insertBefore(o,s),r=new FormData(r),o.parentNode.removeChild(o),r}function rS(r,s,o,d,m){if(s==="submit"&&o&&o.stateNode===m){var x=Xv((m[Dt]||null).action),w=d.submitter;w&&(s=(s=w[Dt]||null)?Xv(s.formAction):w.getAttribute("formAction"),s!==null&&(x=s,w=null));var N=new Ec("action","action",null,d,m);r.push({event:N,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(rs!==0){var H=w?Qv(m,w):new FormData(m);Xf(o,{pending:!0,data:H,method:m.method,action:x},null,H)}}else typeof x=="function"&&(N.preventDefault(),H=w?Qv(m,w):new FormData(m),Xf(o,{pending:!0,data:H,method:m.method,action:x},x,H))},currentTarget:m}]})}}for(var Ah=0;Ah<ff.length;Ah++){var Mh=ff[Ah],iS=Mh.toLowerCase(),sS=Mh[0].toUpperCase()+Mh.slice(1);Mr(iS,"on"+sS)}Mr(Cx,"onAnimationEnd"),Mr(Ex,"onAnimationIteration"),Mr(Tx,"onAnimationStart"),Mr("dblclick","onDoubleClick"),Mr("focusin","onFocus"),Mr("focusout","onBlur"),Mr(_k,"onTransitionRun"),Mr(wk,"onTransitionStart"),Mr(kk,"onTransitionCancel"),Mr(Ax,"onTransitionEnd"),Rn("onMouseEnter",["mouseout","mouseover"]),Rn("onMouseLeave",["mouseout","mouseover"]),Rn("onPointerEnter",["pointerout","pointerover"]),Rn("onPointerLeave",["pointerout","pointerover"]),pn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),pn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),pn("onBeforeInput",["compositionend","keypress","textInput","paste"]),pn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),pn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),pn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ao="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(" "),aS=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ao));function Kv(r,s){s=(s&4)!==0;for(var o=0;o<r.length;o++){var d=r[o],m=d.event;d=d.listeners;e:{var x=void 0;if(s)for(var w=d.length-1;0<=w;w--){var N=d[w],H=N.instance,te=N.currentTarget;if(N=N.listener,H!==x&&m.isPropagationStopped())break e;x=N,m.currentTarget=te;try{x(m)}catch(ce){Mc(ce)}m.currentTarget=null,x=H}else for(w=0;w<d.length;w++){if(N=d[w],H=N.instance,te=N.currentTarget,N=N.listener,H!==x&&m.isPropagationStopped())break e;x=N,m.currentTarget=te;try{x(m)}catch(ce){Mc(ce)}m.currentTarget=null,x=H}}}}function tt(r,s){var o=s[ws];o===void 0&&(o=s[ws]=new Set);var d=r+"__bubble";o.has(d)||(Zv(s,r,2,!1),o.add(d))}function Rh(r,s,o){var d=0;s&&(d|=4),Zv(o,r,d,s)}var xu="_reactListening"+Math.random().toString(36).slice(2);function Dh(r){if(!r[xu]){r[xu]=!0,Fr.forEach(function(o){o!=="selectionchange"&&(aS.has(o)||Rh(o,!1,r),Rh(o,!0,r))});var s=r.nodeType===9?r:r.ownerDocument;s===null||s[xu]||(s[xu]=!0,Rh("selectionchange",!1,s))}}function Zv(r,s,o,d){switch(C1(s)){case 2:var m=zS;break;case 8:m=LS;break;default:m=Wh}o=m.bind(null,s,o,r),m=void 0,!El||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(m=!0),d?m!==void 0?r.addEventListener(s,o,{capture:!0,passive:m}):r.addEventListener(s,o,!0):m!==void 0?r.addEventListener(s,o,{passive:m}):r.addEventListener(s,o,!1)}function zh(r,s,o,d,m){var x=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 N=d.stateNode.containerInfo;if(N===m)break;if(w===4)for(w=d.return;w!==null;){var H=w.tag;if((H===3||H===4)&&w.stateNode.containerInfo===m)return;w=w.return}for(;N!==null;){if(w=Li(N),w===null)return;if(H=w.tag,H===5||H===6||H===26||H===27){d=x=w;continue e}N=N.parentNode}}d=d.return}Cs(function(){var te=x,ce=st(o),de=[];e:{var ne=Mx.get(r);if(ne!==void 0){var se=Ec,Te=r;switch(r){case"keypress":if(Ts(o)===0)break e;case"keydown":case"keyup":se=J2;break;case"focusin":Te="focus",se=nf;break;case"focusout":Te="blur",se=nf;break;case"beforeblur":case"afterblur":se=nf;break;case"click":if(o.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":se=ax;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":se=F2;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":se=nk;break;case Cx:case Ex:case Tx:se=I2;break;case Ax:se=ik;break;case"scroll":case"scrollend":se=P2;break;case"wheel":se=ak;break;case"copy":case"cut":case"paste":se=G2;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":se=ox;break;case"toggle":case"beforetoggle":se=ok}var Ue=(s&4)!==0,St=!Ue&&(r==="scroll"||r==="scrollend"),Q=Ue?ne!==null?ne+"Capture":null:ne;Ue=[];for(var V=te,ee;V!==null;){var ue=V;if(ee=ue.stateNode,ue=ue.tag,ue!==5&&ue!==26&&ue!==27||ee===null||Q===null||(ue=mn(V,Q),ue!=null&&Ue.push(lo(V,ue,ee))),St)break;V=V.return}0<Ue.length&&(ne=new se(ne,Te,null,o,ce),de.push({event:ne,listeners:Ue}))}}if((s&7)===0){e:{if(ne=r==="mouseover"||r==="pointerover",se=r==="mouseout"||r==="pointerout",ne&&o!==ft&&(Te=o.relatedTarget||o.fromElement)&&(Li(Te)||Te[Pr]))break e;if((se||ne)&&(ne=ce.window===ce?ce:(ne=ce.ownerDocument)?ne.defaultView||ne.parentWindow:window,se?(Te=o.relatedTarget||o.toElement,se=te,Te=Te?Li(Te):null,Te!==null&&(St=c(Te),Ue=Te.tag,Te!==St||Ue!==5&&Ue!==27&&Ue!==6)&&(Te=null)):(se=null,Te=te),se!==Te)){if(Ue=ax,ue="onMouseLeave",Q="onMouseEnter",V="mouse",(r==="pointerout"||r==="pointerover")&&(Ue=ox,ue="onPointerLeave",Q="onPointerEnter",V="pointer"),St=se==null?ne:Ss(se),ee=Te==null?ne:Ss(Te),ne=new Ue(ue,V+"leave",se,o,ce),ne.target=St,ne.relatedTarget=ee,ue=null,Li(ce)===te&&(Ue=new Ue(Q,V+"enter",Te,o,ce),Ue.target=ee,Ue.relatedTarget=St,ue=Ue),St=ue,se&&Te)t:{for(Ue=lS,Q=se,V=Te,ee=0,ue=Q;ue;ue=Ue(ue))ee++;ue=0;for(var Oe=V;Oe;Oe=Ue(Oe))ue++;for(;0<ee-ue;)Q=Ue(Q),ee--;for(;0<ue-ee;)V=Ue(V),ue--;for(;ee--;){if(Q===V||V!==null&&Q===V.alternate){Ue=Q;break t}Q=Ue(Q),V=Ue(V)}Ue=null}else Ue=null;se!==null&&Jv(de,ne,se,Ue,!1),Te!==null&&St!==null&&Jv(de,St,Te,Ue,!0)}}e:{if(ne=te?Ss(te):window,se=ne.nodeName&&ne.nodeName.toLowerCase(),se==="select"||se==="input"&&ne.type==="file")var ht=gx;else if(px(ne))if(xx)ht=vk;else{ht=gk;var Me=mk}else se=ne.nodeName,!se||se.toLowerCase()!=="input"||ne.type!=="checkbox"&&ne.type!=="radio"?te&&fa(te.elementType)&&(ht=gx):ht=xk;if(ht&&(ht=ht(r,te))){mx(de,ht,o,ce);break e}Me&&Me(r,ne,te),r==="focusout"&&te&&ne.type==="number"&&te.memoizedProps.value!=null&&jl(ne,"number",ne.value)}switch(Me=te?Ss(te):window,r){case"focusin":(px(Me)||Me.contentEditable==="true")&&(ma=Me,cf=te,Ol=null);break;case"focusout":Ol=cf=ma=null;break;case"mousedown":uf=!0;break;case"contextmenu":case"mouseup":case"dragend":uf=!1,jx(de,o,ce);break;case"selectionchange":if(yk)break;case"keydown":case"keyup":jx(de,o,ce)}var Xe;if(sf)e:{switch(r){case"compositionstart":var lt="onCompositionStart";break e;case"compositionend":lt="onCompositionEnd";break e;case"compositionupdate":lt="onCompositionUpdate";break e}lt=void 0}else pa?fx(r,o)&&(lt="onCompositionEnd"):r==="keydown"&&o.keyCode===229&&(lt="onCompositionStart");lt&&(cx&&o.locale!=="ko"&&(pa||lt!=="onCompositionStart"?lt==="onCompositionEnd"&&pa&&(Xe=Tl()):(Hr=ce,ha="value"in Hr?Hr.value:Hr.textContent,pa=!0)),Me=vu(te,lt),0<Me.length&&(lt=new lx(lt,r,null,o,ce),de.push({event:lt,listeners:Me}),Xe?lt.data=Xe:(Xe=hx(o),Xe!==null&&(lt.data=Xe)))),(Xe=uk?dk(r,o):fk(r,o))&&(lt=vu(te,"onBeforeInput"),0<lt.length&&(Me=new lx("onBeforeInput","beforeinput",null,o,ce),de.push({event:Me,listeners:lt}),Me.data=Xe)),rS(de,r,te,o,ce)}Kv(de,s)})}function lo(r,s,o){return{instance:r,listener:s,currentTarget:o}}function vu(r,s){for(var o=s+"Capture",d=[];r!==null;){var m=r,x=m.stateNode;if(m=m.tag,m!==5&&m!==26&&m!==27||x===null||(m=mn(r,o),m!=null&&d.unshift(lo(r,m,x)),m=mn(r,s),m!=null&&d.push(lo(r,m,x))),r.tag===3)return d;r=r.return}return[]}function lS(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5&&r.tag!==27);return r||null}function Jv(r,s,o,d,m){for(var x=s._reactName,w=[];o!==null&&o!==d;){var N=o,H=N.alternate,te=N.stateNode;if(N=N.tag,H!==null&&H===d)break;N!==5&&N!==26&&N!==27||te===null||(H=te,m?(te=mn(o,x),te!=null&&w.unshift(lo(o,te,H))):m||(te=mn(o,x),te!=null&&w.push(lo(o,te,H)))),o=o.return}w.length!==0&&r.push({event:s,listeners:w})}var oS=/\r\n?/g,cS=/\u0000|\uFFFD/g;function e1(r){return(typeof r=="string"?r:""+r).replace(oS,`
|
|
49
|
+
`).replace(cS,"")}function t1(r,s){return s=e1(s),e1(r)===s}function kt(r,s,o,d,m,x){switch(o){case"children":typeof d=="string"?s==="body"||s==="textarea"&&d===""||Ui(r,d):(typeof d=="number"||typeof d=="bigint")&&s!=="body"&&Ui(r,""+d);break;case"className":js(r,"class",d);break;case"tabIndex":js(r,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":js(r,o,d);break;case"style":Cl(r,d,x);break;case"data":if(s!=="object"){js(r,"data",d);break}case"src":case"href":if(d===""&&(s!=="a"||o!=="href")){r.removeAttribute(o);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(o);break}d=ge(""+d),r.setAttribute(o,d);break;case"action":case"formAction":if(typeof d=="function"){r.setAttribute(o,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof x=="function"&&(o==="formAction"?(s!=="input"&&kt(r,s,"name",m.name,m,null),kt(r,s,"formEncType",m.formEncType,m,null),kt(r,s,"formMethod",m.formMethod,m,null),kt(r,s,"formTarget",m.formTarget,m,null)):(kt(r,s,"encType",m.encType,m,null),kt(r,s,"method",m.method,m,null),kt(r,s,"target",m.target,m,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(o);break}d=ge(""+d),r.setAttribute(o,d);break;case"onClick":d!=null&&(r.onclick=Ve);break;case"onScroll":d!=null&&tt("scroll",r);break;case"onScrollEnd":d!=null&&tt("scrollend",r);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(i(61));if(o=d.__html,o!=null){if(m.children!=null)throw Error(i(60));r.innerHTML=o}}break;case"multiple":r.multiple=d&&typeof d!="function"&&typeof d!="symbol";break;case"muted":r.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"){r.removeAttribute("xlink:href");break}o=ge(""+d),r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":d!=null&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(o,""+d):r.removeAttribute(o);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"?r.setAttribute(o,""):r.removeAttribute(o);break;case"capture":case"download":d===!0?r.setAttribute(o,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(o,d):r.removeAttribute(o);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?r.setAttribute(o,d):r.removeAttribute(o);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?r.removeAttribute(o):r.setAttribute(o,d);break;case"popover":tt("beforetoggle",r),tt("toggle",r),Bi(r,"popover",d);break;case"xlinkActuate":Tr(r,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":Tr(r,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":Tr(r,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":Tr(r,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":Tr(r,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":Tr(r,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":Tr(r,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":Tr(r,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":Tr(r,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":Bi(r,"is",d);break;case"innerText":case"textContent":break;default:(!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(o=Cc.get(o)||o,Bi(r,o,d))}}function Lh(r,s,o,d,m,x){switch(o){case"style":Cl(r,d,x);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(i(61));if(o=d.__html,o!=null){if(m.children!=null)throw Error(i(60));r.innerHTML=o}}break;case"children":typeof d=="string"?Ui(r,d):(typeof d=="number"||typeof d=="bigint")&&Ui(r,""+d);break;case"onScroll":d!=null&&tt("scroll",r);break;case"onScrollEnd":d!=null&&tt("scrollend",r);break;case"onClick":d!=null&&(r.onclick=Ve);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ca.hasOwnProperty(o))e:{if(o[0]==="o"&&o[1]==="n"&&(m=o.endsWith("Capture"),s=o.slice(2,m?o.length-7:void 0),x=r[Dt]||null,x=x!=null?x[o]:null,typeof x=="function"&&r.removeEventListener(s,x,m),typeof d=="function")){typeof x!="function"&&x!==null&&(o in r?r[o]=null:r.hasAttribute(o)&&r.removeAttribute(o)),r.addEventListener(s,d,m);break e}o in r?r[o]=d:d===!0?r.setAttribute(o,""):Bi(r,o,d)}}}function kn(r,s,o){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":tt("error",r),tt("load",r);var d=!1,m=!1,x;for(x in o)if(o.hasOwnProperty(x)){var w=o[x];if(w!=null)switch(x){case"src":d=!0;break;case"srcSet":m=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,s));default:kt(r,s,x,w,o,null)}}m&&kt(r,s,"srcSet",o.srcSet,o,null),d&&kt(r,s,"src",o.src,o,null);return;case"input":tt("invalid",r);var N=x=w=m=null,H=null,te=null;for(d in o)if(o.hasOwnProperty(d)){var ce=o[d];if(ce!=null)switch(d){case"name":m=ce;break;case"type":w=ce;break;case"checked":H=ce;break;case"defaultChecked":te=ce;break;case"value":x=ce;break;case"defaultValue":N=ce;break;case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(i(137,s));break;default:kt(r,s,d,ce,o,null)}}Sl(r,x,N,H,te,w,m,!1);return;case"select":tt("invalid",r),d=w=x=null;for(m in o)if(o.hasOwnProperty(m)&&(N=o[m],N!=null))switch(m){case"value":x=N;break;case"defaultValue":w=N;break;case"multiple":d=N;default:kt(r,s,m,N,o,null)}s=x,o=w,r.multiple=!!d,s!=null?Pi(r,!!d,s,!1):o!=null&&Pi(r,!!d,o,!0);return;case"textarea":tt("invalid",r),x=m=d=null;for(w in o)if(o.hasOwnProperty(w)&&(N=o[w],N!=null))switch(w){case"value":d=N;break;case"defaultValue":m=N;break;case"children":x=N;break;case"dangerouslySetInnerHTML":if(N!=null)throw Error(i(91));break;default:kt(r,s,w,N,o,null)}Nc(r,d,m,x);return;case"option":for(H in o)if(o.hasOwnProperty(H)&&(d=o[H],d!=null))switch(H){case"selected":r.selected=d&&typeof d!="function"&&typeof d!="symbol";break;default:kt(r,s,H,d,o,null)}return;case"dialog":tt("beforetoggle",r),tt("toggle",r),tt("cancel",r),tt("close",r);break;case"iframe":case"object":tt("load",r);break;case"video":case"audio":for(d=0;d<ao.length;d++)tt(ao[d],r);break;case"image":tt("error",r),tt("load",r);break;case"details":tt("toggle",r);break;case"embed":case"source":case"link":tt("error",r),tt("load",r);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(te in o)if(o.hasOwnProperty(te)&&(d=o[te],d!=null))switch(te){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,s));default:kt(r,s,te,d,o,null)}return;default:if(fa(s)){for(ce in o)o.hasOwnProperty(ce)&&(d=o[ce],d!==void 0&&Lh(r,s,ce,d,o,void 0));return}}for(N in o)o.hasOwnProperty(N)&&(d=o[N],d!=null&&kt(r,s,N,d,o,null))}function uS(r,s,o,d){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var m=null,x=null,w=null,N=null,H=null,te=null,ce=null;for(se in o){var de=o[se];if(o.hasOwnProperty(se)&&de!=null)switch(se){case"checked":break;case"value":break;case"defaultValue":H=de;default:d.hasOwnProperty(se)||kt(r,s,se,null,d,de)}}for(var ne in d){var se=d[ne];if(de=o[ne],d.hasOwnProperty(ne)&&(se!=null||de!=null))switch(ne){case"type":x=se;break;case"name":m=se;break;case"checked":te=se;break;case"defaultChecked":ce=se;break;case"value":w=se;break;case"defaultValue":N=se;break;case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(i(137,s));break;default:se!==de&&kt(r,s,ne,se,d,de)}}$i(r,w,N,H,te,ce,x,m);return;case"select":se=w=N=ne=null;for(x in o)if(H=o[x],o.hasOwnProperty(x)&&H!=null)switch(x){case"value":break;case"multiple":se=H;default:d.hasOwnProperty(x)||kt(r,s,x,null,d,H)}for(m in d)if(x=d[m],H=o[m],d.hasOwnProperty(m)&&(x!=null||H!=null))switch(m){case"value":ne=x;break;case"defaultValue":N=x;break;case"multiple":w=x;default:x!==H&&kt(r,s,m,x,d,H)}s=N,o=w,d=se,ne!=null?Pi(r,!!o,ne,!1):!!d!=!!o&&(s!=null?Pi(r,!!o,s,!0):Pi(r,!!o,o?[]:"",!1));return;case"textarea":se=ne=null;for(N in o)if(m=o[N],o.hasOwnProperty(N)&&m!=null&&!d.hasOwnProperty(N))switch(N){case"value":break;case"children":break;default:kt(r,s,N,null,d,m)}for(w in d)if(m=d[w],x=o[w],d.hasOwnProperty(w)&&(m!=null||x!=null))switch(w){case"value":ne=m;break;case"defaultValue":se=m;break;case"children":break;case"dangerouslySetInnerHTML":if(m!=null)throw Error(i(91));break;default:m!==x&&kt(r,s,w,m,d,x)}jc(r,ne,se);return;case"option":for(var Te in o)if(ne=o[Te],o.hasOwnProperty(Te)&&ne!=null&&!d.hasOwnProperty(Te))switch(Te){case"selected":r.selected=!1;break;default:kt(r,s,Te,null,d,ne)}for(H in d)if(ne=d[H],se=o[H],d.hasOwnProperty(H)&&ne!==se&&(ne!=null||se!=null))switch(H){case"selected":r.selected=ne&&typeof ne!="function"&&typeof ne!="symbol";break;default:kt(r,s,H,ne,d,se)}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 o)ne=o[Ue],o.hasOwnProperty(Ue)&&ne!=null&&!d.hasOwnProperty(Ue)&&kt(r,s,Ue,null,d,ne);for(te in d)if(ne=d[te],se=o[te],d.hasOwnProperty(te)&&ne!==se&&(ne!=null||se!=null))switch(te){case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(i(137,s));break;default:kt(r,s,te,ne,d,se)}return;default:if(fa(s)){for(var St in o)ne=o[St],o.hasOwnProperty(St)&&ne!==void 0&&!d.hasOwnProperty(St)&&Lh(r,s,St,void 0,d,ne);for(ce in d)ne=d[ce],se=o[ce],!d.hasOwnProperty(ce)||ne===se||ne===void 0&&se===void 0||Lh(r,s,ce,ne,d,se);return}}for(var Q in o)ne=o[Q],o.hasOwnProperty(Q)&&ne!=null&&!d.hasOwnProperty(Q)&&kt(r,s,Q,null,d,ne);for(de in d)ne=d[de],se=o[de],!d.hasOwnProperty(de)||ne===se||ne==null&&se==null||kt(r,s,de,ne,d,se)}function n1(r){switch(r){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function dS(){if(typeof performance.getEntriesByType=="function"){for(var r=0,s=0,o=performance.getEntriesByType("resource"),d=0;d<o.length;d++){var m=o[d],x=m.transferSize,w=m.initiatorType,N=m.duration;if(x&&N&&n1(w)){for(w=0,N=m.responseEnd,d+=1;d<o.length;d++){var H=o[d],te=H.startTime;if(te>N)break;var ce=H.transferSize,de=H.initiatorType;ce&&n1(de)&&(H=H.responseEnd,w+=ce*(H<N?1:(N-te)/(H-te)))}if(--d,s+=8*(x+w)/(m.duration/1e3),r++,10<r)break}}if(0<r)return s/r/1e6}return navigator.connection&&(r=navigator.connection.downlink,typeof r=="number")?r:5}var Oh=null,Bh=null;function bu(r){return r.nodeType===9?r:r.ownerDocument}function r1(r){switch(r){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function i1(r,s){if(r===0)switch(s){case"svg":return 1;case"math":return 2;default:return 0}return r===1&&s==="foreignObject"?0:r}function $h(r,s){return r==="textarea"||r==="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 Ph=null;function fS(){var r=window.event;return r&&r.type==="popstate"?r===Ph?!1:(Ph=r,!0):(Ph=null,!1)}var s1=typeof setTimeout=="function"?setTimeout:void 0,hS=typeof clearTimeout=="function"?clearTimeout:void 0,a1=typeof Promise=="function"?Promise:void 0,pS=typeof queueMicrotask=="function"?queueMicrotask:typeof a1<"u"?function(r){return a1.resolve(null).then(r).catch(mS)}:s1;function mS(r){setTimeout(function(){throw r})}function is(r){return r==="head"}function l1(r,s){var o=s,d=0;do{var m=o.nextSibling;if(r.removeChild(o),m&&m.nodeType===8)if(o=m.data,o==="/$"||o==="/&"){if(d===0){r.removeChild(m),Ha(s);return}d--}else if(o==="$"||o==="$?"||o==="$~"||o==="$!"||o==="&")d++;else if(o==="html")oo(r.ownerDocument.documentElement);else if(o==="head"){o=r.ownerDocument.head,oo(o);for(var x=o.firstChild;x;){var w=x.nextSibling,N=x.nodeName;x[ks]||N==="SCRIPT"||N==="STYLE"||N==="LINK"&&x.rel.toLowerCase()==="stylesheet"||o.removeChild(x),x=w}}else o==="body"&&oo(r.ownerDocument.body);o=m}while(o);Ha(s)}function o1(r,s){var o=r;r=0;do{var d=o.nextSibling;if(o.nodeType===1?s?(o._stashedDisplay=o.style.display,o.style.display="none"):(o.style.display=o._stashedDisplay||"",o.getAttribute("style")===""&&o.removeAttribute("style")):o.nodeType===3&&(s?(o._stashedText=o.nodeValue,o.nodeValue=""):o.nodeValue=o._stashedText||""),d&&d.nodeType===8)if(o=d.data,o==="/$"){if(r===0)break;r--}else o!=="$"&&o!=="$?"&&o!=="$~"&&o!=="$!"||r++;o=d}while(o)}function Uh(r){var s=r.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var o=s;switch(s=s.nextSibling,o.nodeName){case"HTML":case"HEAD":case"BODY":Uh(o),oa(o);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(o.rel.toLowerCase()==="stylesheet")continue}r.removeChild(o)}}function gS(r,s,o,d){for(;r.nodeType===1;){var m=o;if(r.nodeName.toLowerCase()!==s.toLowerCase()){if(!d&&(r.nodeName!=="INPUT"||r.type!=="hidden"))break}else if(d){if(!r[ks])switch(s){case"meta":if(!r.hasAttribute("itemprop"))break;return r;case"link":if(x=r.getAttribute("rel"),x==="stylesheet"&&r.hasAttribute("data-precedence"))break;if(x!==m.rel||r.getAttribute("href")!==(m.href==null||m.href===""?null:m.href)||r.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin)||r.getAttribute("title")!==(m.title==null?null:m.title))break;return r;case"style":if(r.hasAttribute("data-precedence"))break;return r;case"script":if(x=r.getAttribute("src"),(x!==(m.src==null?null:m.src)||r.getAttribute("type")!==(m.type==null?null:m.type)||r.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin))&&x&&r.hasAttribute("async")&&!r.hasAttribute("itemprop"))break;return r;default:return r}}else if(s==="input"&&r.type==="hidden"){var x=m.name==null?null:""+m.name;if(m.type==="hidden"&&r.getAttribute("name")===x)return r}else return r;if(r=br(r.nextSibling),r===null)break}return null}function xS(r,s,o){if(s==="")return null;for(;r.nodeType!==3;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!o||(r=br(r.nextSibling),r===null))return null;return r}function c1(r,s){for(;r.nodeType!==8;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!s||(r=br(r.nextSibling),r===null))return null;return r}function Fh(r){return r.data==="$?"||r.data==="$~"}function Hh(r){return r.data==="$!"||r.data==="$?"&&r.ownerDocument.readyState!=="loading"}function vS(r,s){var o=r.ownerDocument;if(r.data==="$~")r._reactRetry=s;else if(r.data!=="$?"||o.readyState!=="loading")s();else{var d=function(){s(),o.removeEventListener("DOMContentLoaded",d)};o.addEventListener("DOMContentLoaded",d),r._reactRetry=d}}function br(r){for(;r!=null;r=r.nextSibling){var s=r.nodeType;if(s===1||s===3)break;if(s===8){if(s=r.data,s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"||s==="F!"||s==="F")break;if(s==="/$"||s==="/&")return null}}return r}var qh=null;function u1(r){r=r.nextSibling;for(var s=0;r;){if(r.nodeType===8){var o=r.data;if(o==="/$"||o==="/&"){if(s===0)return br(r.nextSibling);s--}else o!=="$"&&o!=="$!"&&o!=="$?"&&o!=="$~"&&o!=="&"||s++}r=r.nextSibling}return null}function d1(r){r=r.previousSibling;for(var s=0;r;){if(r.nodeType===8){var o=r.data;if(o==="$"||o==="$!"||o==="$?"||o==="$~"||o==="&"){if(s===0)return r;s--}else o!=="/$"&&o!=="/&"||s++}r=r.previousSibling}return null}function f1(r,s,o){switch(s=bu(o),r){case"html":if(r=s.documentElement,!r)throw Error(i(452));return r;case"head":if(r=s.head,!r)throw Error(i(453));return r;case"body":if(r=s.body,!r)throw Error(i(454));return r;default:throw Error(i(451))}}function oo(r){for(var s=r.attributes;s.length;)r.removeAttributeNode(s[0]);oa(r)}var yr=new Map,h1=new Set;function yu(r){return typeof r.getRootNode=="function"?r.getRootNode():r.nodeType===9?r:r.ownerDocument}var xi=$.d;$.d={f:bS,r:yS,D:_S,C:wS,L:kS,m:SS,X:NS,S:jS,M:CS};function bS(){var r=xi.f(),s=du();return r||s}function yS(r){var s=Oi(r);s!==null&&s.tag===5&&s.type==="form"?A0(s):xi.r(r)}var Pa=typeof document>"u"?null:document;function p1(r,s,o){var d=Pa;if(d&&typeof s=="string"&&s){var m=Dn(s);m='link[rel="'+r+'"][href="'+m+'"]',typeof o=="string"&&(m+='[crossorigin="'+o+'"]'),h1.has(m)||(h1.add(m),r={rel:r,crossOrigin:o,href:s},d.querySelector(m)===null&&(s=d.createElement("link"),kn(s,"link",r),Zt(s),d.head.appendChild(s)))}}function _S(r){xi.D(r),p1("dns-prefetch",r,null)}function wS(r,s){xi.C(r,s),p1("preconnect",r,s)}function kS(r,s,o){xi.L(r,s,o);var d=Pa;if(d&&r&&s){var m='link[rel="preload"][as="'+Dn(s)+'"]';s==="image"&&o&&o.imageSrcSet?(m+='[imagesrcset="'+Dn(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(m+='[imagesizes="'+Dn(o.imageSizes)+'"]')):m+='[href="'+Dn(r)+'"]';var x=m;switch(s){case"style":x=Ua(r);break;case"script":x=Fa(r)}yr.has(x)||(r=v({rel:"preload",href:s==="image"&&o&&o.imageSrcSet?void 0:r,as:s},o),yr.set(x,r),d.querySelector(m)!==null||s==="style"&&d.querySelector(co(x))||s==="script"&&d.querySelector(uo(x))||(s=d.createElement("link"),kn(s,"link",r),Zt(s),d.head.appendChild(s)))}}function SS(r,s){xi.m(r,s);var o=Pa;if(o&&r){var d=s&&typeof s.as=="string"?s.as:"script",m='link[rel="modulepreload"][as="'+Dn(d)+'"][href="'+Dn(r)+'"]',x=m;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=Fa(r)}if(!yr.has(x)&&(r=v({rel:"modulepreload",href:r},s),yr.set(x,r),o.querySelector(m)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(uo(x)))return}d=o.createElement("link"),kn(d,"link",r),Zt(d),o.head.appendChild(d)}}}function jS(r,s,o){xi.S(r,s,o);var d=Pa;if(d&&r){var m=Ur(d).hoistableStyles,x=Ua(r);s=s||"default";var w=m.get(x);if(!w){var N={loading:0,preload:null};if(w=d.querySelector(co(x)))N.loading=5;else{r=v({rel:"stylesheet",href:r,"data-precedence":s},o),(o=yr.get(x))&&Ih(r,o);var H=w=d.createElement("link");Zt(H),kn(H,"link",r),H._p=new Promise(function(te,ce){H.onload=te,H.onerror=ce}),H.addEventListener("load",function(){N.loading|=1}),H.addEventListener("error",function(){N.loading|=2}),N.loading|=4,_u(w,s,d)}w={type:"stylesheet",instance:w,count:1,state:N},m.set(x,w)}}}function NS(r,s){xi.X(r,s);var o=Pa;if(o&&r){var d=Ur(o).hoistableScripts,m=Fa(r),x=d.get(m);x||(x=o.querySelector(uo(m)),x||(r=v({src:r,async:!0},s),(s=yr.get(m))&&Vh(r,s),x=o.createElement("script"),Zt(x),kn(x,"link",r),o.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},d.set(m,x))}}function CS(r,s){xi.M(r,s);var o=Pa;if(o&&r){var d=Ur(o).hoistableScripts,m=Fa(r),x=d.get(m);x||(x=o.querySelector(uo(m)),x||(r=v({src:r,async:!0,type:"module"},s),(s=yr.get(m))&&Vh(r,s),x=o.createElement("script"),Zt(x),kn(x,"link",r),o.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},d.set(m,x))}}function m1(r,s,o,d){var m=(m=je.current)?yu(m):null;if(!m)throw Error(i(446));switch(r){case"meta":case"title":return null;case"style":return typeof o.precedence=="string"&&typeof o.href=="string"?(s=Ua(o.href),o=Ur(m).hoistableStyles,d=o.get(s),d||(d={type:"style",instance:null,count:0,state:null},o.set(s,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(o.rel==="stylesheet"&&typeof o.href=="string"&&typeof o.precedence=="string"){r=Ua(o.href);var x=Ur(m).hoistableStyles,w=x.get(r);if(w||(m=m.ownerDocument||m,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(r,w),(x=m.querySelector(co(r)))&&!x._p&&(w.instance=x,w.state.loading=5),yr.has(r)||(o={rel:"preload",as:"style",href:o.href,crossOrigin:o.crossOrigin,integrity:o.integrity,media:o.media,hrefLang:o.hrefLang,referrerPolicy:o.referrerPolicy},yr.set(r,o),x||ES(m,r,o,w.state))),s&&d===null)throw Error(i(528,""));return w}if(s&&d!==null)throw Error(i(529,""));return null;case"script":return s=o.async,o=o.src,typeof o=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=Fa(o),o=Ur(m).hoistableScripts,d=o.get(s),d||(d={type:"script",instance:null,count:0,state:null},o.set(s,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,r))}}function Ua(r){return'href="'+Dn(r)+'"'}function co(r){return'link[rel="stylesheet"]['+r+"]"}function g1(r){return v({},r,{"data-precedence":r.precedence,precedence:null})}function ES(r,s,o,d){r.querySelector('link[rel="preload"][as="style"]['+s+"]")?d.loading=1:(s=r.createElement("link"),d.preload=s,s.addEventListener("load",function(){return d.loading|=1}),s.addEventListener("error",function(){return d.loading|=2}),kn(s,"link",o),Zt(s),r.head.appendChild(s))}function Fa(r){return'[src="'+Dn(r)+'"]'}function uo(r){return"script[async]"+r}function x1(r,s,o){if(s.count++,s.instance===null)switch(s.type){case"style":var d=r.querySelector('style[data-href~="'+Dn(o.href)+'"]');if(d)return s.instance=d,Zt(d),d;var m=v({},o,{"data-href":o.href,"data-precedence":o.precedence,href:null,precedence:null});return d=(r.ownerDocument||r).createElement("style"),Zt(d),kn(d,"style",m),_u(d,o.precedence,r),s.instance=d;case"stylesheet":m=Ua(o.href);var x=r.querySelector(co(m));if(x)return s.state.loading|=4,s.instance=x,Zt(x),x;d=g1(o),(m=yr.get(m))&&Ih(d,m),x=(r.ownerDocument||r).createElement("link"),Zt(x);var w=x;return w._p=new Promise(function(N,H){w.onload=N,w.onerror=H}),kn(x,"link",d),s.state.loading|=4,_u(x,o.precedence,r),s.instance=x;case"script":return x=Fa(o.src),(m=r.querySelector(uo(x)))?(s.instance=m,Zt(m),m):(d=o,(m=yr.get(x))&&(d=v({},o),Vh(d,m)),r=r.ownerDocument||r,m=r.createElement("script"),Zt(m),kn(m,"link",d),r.head.appendChild(m),s.instance=m);case"void":return null;default:throw Error(i(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(d=s.instance,s.state.loading|=4,_u(d,o.precedence,r));return s.instance}function _u(r,s,o){for(var d=o.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),m=d.length?d[d.length-1]:null,x=m,w=0;w<d.length;w++){var N=d[w];if(N.dataset.precedence===s)x=N;else if(x!==m)break}x?x.parentNode.insertBefore(r,x.nextSibling):(s=o.nodeType===9?o.head:o,s.insertBefore(r,s.firstChild))}function Ih(r,s){r.crossOrigin==null&&(r.crossOrigin=s.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=s.referrerPolicy),r.title==null&&(r.title=s.title)}function Vh(r,s){r.crossOrigin==null&&(r.crossOrigin=s.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=s.referrerPolicy),r.integrity==null&&(r.integrity=s.integrity)}var wu=null;function v1(r,s,o){if(wu===null){var d=new Map,m=wu=new Map;m.set(o,d)}else m=wu,d=m.get(o),d||(d=new Map,m.set(o,d));if(d.has(r))return d;for(d.set(r,null),o=o.getElementsByTagName(r),m=0;m<o.length;m++){var x=o[m];if(!(x[ks]||x[Wt]||r==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var w=x.getAttribute(s)||"";w=r+w;var N=d.get(w);N?N.push(x):d.set(w,[x])}}return d}function b1(r,s,o){r=r.ownerDocument||r,r.head.insertBefore(o,s==="title"?r.querySelector("head > title"):null)}function TS(r,s,o){if(o===1||s.itemProp!=null)return!1;switch(r){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 r=s.disabled,typeof s.precedence=="string"&&r==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 y1(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function AS(r,s,o,d){if(o.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(o.state.loading&4)===0){if(o.instance===null){var m=Ua(d.href),x=s.querySelector(co(m));if(x){s=x._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(r.count++,r=ku.bind(r),s.then(r,r)),o.state.loading|=4,o.instance=x,Zt(x);return}x=s.ownerDocument||s,d=g1(d),(m=yr.get(m))&&Ih(d,m),x=x.createElement("link"),Zt(x);var w=x;w._p=new Promise(function(N,H){w.onload=N,w.onerror=H}),kn(x,"link",d),o.instance=x}r.stylesheets===null&&(r.stylesheets=new Map),r.stylesheets.set(o,s),(s=o.state.preload)&&(o.state.loading&3)===0&&(r.count++,o=ku.bind(r),s.addEventListener("load",o),s.addEventListener("error",o))}}var Gh=0;function MS(r,s){return r.stylesheets&&r.count===0&&ju(r,r.stylesheets),0<r.count||0<r.imgCount?function(o){var d=setTimeout(function(){if(r.stylesheets&&ju(r,r.stylesheets),r.unsuspend){var x=r.unsuspend;r.unsuspend=null,x()}},6e4+s);0<r.imgBytes&&Gh===0&&(Gh=62500*dS());var m=setTimeout(function(){if(r.waitingForImages=!1,r.count===0&&(r.stylesheets&&ju(r,r.stylesheets),r.unsuspend)){var x=r.unsuspend;r.unsuspend=null,x()}},(r.imgBytes>Gh?50:800)+s);return r.unsuspend=o,function(){r.unsuspend=null,clearTimeout(d),clearTimeout(m)}}:null}function ku(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ju(this,this.stylesheets);else if(this.unsuspend){var r=this.unsuspend;this.unsuspend=null,r()}}}var Su=null;function ju(r,s){r.stylesheets=null,r.unsuspend!==null&&(r.count++,Su=new Map,s.forEach(RS,r),Su=null,ku.call(r))}function RS(r,s){if(!(s.state.loading&4)){var o=Su.get(r);if(o)var d=o.get(null);else{o=new Map,Su.set(r,o);for(var m=r.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x<m.length;x++){var w=m[x];(w.nodeName==="LINK"||w.getAttribute("media")!=="not all")&&(o.set(w.dataset.precedence,w),d=w)}d&&o.set(null,d)}m=s.instance,w=m.getAttribute("data-precedence"),x=o.get(w)||d,x===d&&o.set(null,m),o.set(w,m),this.count++,d=ku.bind(this),m.addEventListener("load",d),m.addEventListener("error",d),x?x.parentNode.insertBefore(m,x.nextSibling):(r=r.nodeType===9?r.head:r,r.insertBefore(m,r.firstChild)),s.state.loading|=4}}var fo={$$typeof:C,Provider:null,Consumer:null,_currentValue:re,_currentValue2:re,_threadCount:0};function DS(r,s,o,d,m,x,w,N,H){this.tag=1,this.containerInfo=r,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=Br(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Br(0),this.hiddenUpdates=Br(null),this.identifierPrefix=d,this.onUncaughtError=m,this.onCaughtError=x,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=H,this.incompleteTransitions=new Map}function _1(r,s,o,d,m,x,w,N,H,te,ce,de){return r=new DS(r,s,o,w,H,te,ce,de,N),s=1,x===!0&&(s|=24),x=Zn(3,null,null,s),r.current=x,x.stateNode=r,s=jf(),s.refCount++,r.pooledCache=s,s.refCount++,x.memoizedState={element:d,isDehydrated:o,cache:s},Tf(x),r}function w1(r){return r?(r=va,r):va}function k1(r,s,o,d,m,x){m=w1(m),d.context===null?d.context=m:d.pendingContext=m,d=Yi(s),d.payload={element:o},x=x===void 0?null:x,x!==null&&(d.callback=x),o=Wi(r,d,s),o!==null&&(Vn(o,r,s),ql(o,r,s))}function S1(r,s){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var o=r.retryLane;r.retryLane=o!==0&&o<s?o:s}}function Yh(r,s){S1(r,s),(r=r.alternate)&&S1(r,s)}function j1(r){if(r.tag===13||r.tag===31){var s=Ds(r,67108864);s!==null&&Vn(s,r,67108864),Yh(r,67108864)}}function N1(r){if(r.tag===13||r.tag===31){var s=rr();s=zi(s);var o=Ds(r,s);o!==null&&Vn(o,r,s),Yh(r,s)}}var Nu=!0;function zS(r,s,o,d){var m=U.T;U.T=null;var x=$.p;try{$.p=2,Wh(r,s,o,d)}finally{$.p=x,U.T=m}}function LS(r,s,o,d){var m=U.T;U.T=null;var x=$.p;try{$.p=8,Wh(r,s,o,d)}finally{$.p=x,U.T=m}}function Wh(r,s,o,d){if(Nu){var m=Xh(d);if(m===null)zh(r,s,d,Cu,o),E1(r,d);else if(BS(m,r,s,o,d))d.stopPropagation();else if(E1(r,d),s&4&&-1<OS.indexOf(r)){for(;m!==null;){var x=Oi(m);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var w=Rt(x.pendingLanes);if(w!==0){var N=x;for(N.pendingLanes|=2,N.entangledLanes|=2;w;){var H=1<<31-J(w);N.entanglements[1]|=H,w&=~H}Gr(x),(mt&6)===0&&(cu=Pe()+500,so(0))}}break;case 31:case 13:N=Ds(x,2),N!==null&&Vn(N,x,2),du(),Yh(x,2)}if(x=Xh(d),x===null&&zh(r,s,d,Cu,o),x===m)break;m=x}m!==null&&d.stopPropagation()}else zh(r,s,d,null,o)}}function Xh(r){return r=st(r),Qh(r)}var Cu=null;function Qh(r){if(Cu=null,r=Li(r),r!==null){var s=c(r);if(s===null)r=null;else{var o=s.tag;if(o===13){if(r=u(s),r!==null)return r;r=null}else if(o===31){if(r=f(s),r!==null)return r;r=null}else if(o===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;r=null}else s!==r&&(r=null)}}return Cu=r,null}function C1(r){switch(r){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(bn()){case le:return 2;case be:return 8;case W:case he:return 32;case Ae:return 268435456;default:return 32}default:return 32}}var Kh=!1,ss=null,as=null,ls=null,ho=new Map,po=new Map,os=[],OS="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 E1(r,s){switch(r){case"focusin":case"focusout":ss=null;break;case"dragenter":case"dragleave":as=null;break;case"mouseover":case"mouseout":ls=null;break;case"pointerover":case"pointerout":ho.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":po.delete(s.pointerId)}}function mo(r,s,o,d,m,x){return r===null||r.nativeEvent!==x?(r={blockedOn:s,domEventName:o,eventSystemFlags:d,nativeEvent:x,targetContainers:[m]},s!==null&&(s=Oi(s),s!==null&&j1(s)),r):(r.eventSystemFlags|=d,s=r.targetContainers,m!==null&&s.indexOf(m)===-1&&s.push(m),r)}function BS(r,s,o,d,m){switch(s){case"focusin":return ss=mo(ss,r,s,o,d,m),!0;case"dragenter":return as=mo(as,r,s,o,d,m),!0;case"mouseover":return ls=mo(ls,r,s,o,d,m),!0;case"pointerover":var x=m.pointerId;return ho.set(x,mo(ho.get(x)||null,r,s,o,d,m)),!0;case"gotpointercapture":return x=m.pointerId,po.set(x,mo(po.get(x)||null,r,s,o,d,m)),!0}return!1}function T1(r){var s=Li(r.target);if(s!==null){var o=c(s);if(o!==null){if(s=o.tag,s===13){if(s=u(o),s!==null){r.blockedOn=s,_c(r.priority,function(){N1(o)});return}}else if(s===31){if(s=f(o),s!==null){r.blockedOn=s,_c(r.priority,function(){N1(o)});return}}else if(s===3&&o.stateNode.current.memoizedState.isDehydrated){r.blockedOn=o.tag===3?o.stateNode.containerInfo:null;return}}}r.blockedOn=null}function Eu(r){if(r.blockedOn!==null)return!1;for(var s=r.targetContainers;0<s.length;){var o=Xh(r.nativeEvent);if(o===null){o=r.nativeEvent;var d=new o.constructor(o.type,o);ft=d,o.target.dispatchEvent(d),ft=null}else return s=Oi(o),s!==null&&j1(s),r.blockedOn=o,!1;s.shift()}return!0}function A1(r,s,o){Eu(r)&&o.delete(s)}function $S(){Kh=!1,ss!==null&&Eu(ss)&&(ss=null),as!==null&&Eu(as)&&(as=null),ls!==null&&Eu(ls)&&(ls=null),ho.forEach(A1),po.forEach(A1)}function Tu(r,s){r.blockedOn===s&&(r.blockedOn=null,Kh||(Kh=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,$S)))}var Au=null;function M1(r){Au!==r&&(Au=r,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Au===r&&(Au=null);for(var s=0;s<r.length;s+=3){var o=r[s],d=r[s+1],m=r[s+2];if(typeof d!="function"){if(Qh(d||o)===null)continue;break}var x=Oi(o);x!==null&&(r.splice(s,3),s-=3,Xf(x,{pending:!0,data:m,method:o.method,action:d},d,m))}}))}function Ha(r){function s(H){return Tu(H,r)}ss!==null&&Tu(ss,r),as!==null&&Tu(as,r),ls!==null&&Tu(ls,r),ho.forEach(s),po.forEach(s);for(var o=0;o<os.length;o++){var d=os[o];d.blockedOn===r&&(d.blockedOn=null)}for(;0<os.length&&(o=os[0],o.blockedOn===null);)T1(o),o.blockedOn===null&&os.shift();if(o=(r.ownerDocument||r).$$reactFormReplay,o!=null)for(d=0;d<o.length;d+=3){var m=o[d],x=o[d+1],w=m[Dt]||null;if(typeof x=="function")w||M1(o);else if(w){var N=null;if(x&&x.hasAttribute("formAction")){if(m=x,w=x[Dt]||null)N=w.formAction;else if(Qh(m)!==null)continue}else N=w.action;typeof N=="function"?o[d+1]=N:(o.splice(d,3),d-=3),M1(o)}}}function R1(){function r(x){x.canIntercept&&x.info==="react-transition"&&x.intercept({handler:function(){return new Promise(function(w){return m=w})},focusReset:"manual",scroll:"manual"})}function s(){m!==null&&(m(),m=null),d||setTimeout(o,20)}function o(){if(!d&&!navigation.transition){var x=navigation.currentEntry;x&&x.url!=null&&navigation.navigate(x.url,{state:x.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var d=!1,m=null;return navigation.addEventListener("navigate",r),navigation.addEventListener("navigatesuccess",s),navigation.addEventListener("navigateerror",s),setTimeout(o,100),function(){d=!0,navigation.removeEventListener("navigate",r),navigation.removeEventListener("navigatesuccess",s),navigation.removeEventListener("navigateerror",s),m!==null&&(m(),m=null)}}}function Zh(r){this._internalRoot=r}Mu.prototype.render=Zh.prototype.render=function(r){var s=this._internalRoot;if(s===null)throw Error(i(409));var o=s.current,d=rr();k1(o,d,r,s,null,null)},Mu.prototype.unmount=Zh.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var s=r.containerInfo;k1(r.current,2,null,r,null,null),du(),s[Pr]=null}};function Mu(r){this._internalRoot=r}Mu.prototype.unstable_scheduleHydration=function(r){if(r){var s=$r();r={blockedOn:null,target:r,priority:s};for(var o=0;o<os.length&&s!==0&&s<os[o].priority;o++);os.splice(o,0,r),o===0&&T1(r)}};var D1=t.version;if(D1!=="19.2.7")throw Error(i(527,D1,"19.2.7"));$.findDOMNode=function(r){var s=r._reactInternals;if(s===void 0)throw typeof r.render=="function"?Error(i(188)):(r=Object.keys(r).join(","),Error(i(268,r)));return r=p(s),r=r!==null?g(r):null,r=r===null?null:r.stateNode,r};var PS={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:U,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ru=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ru.isDisabled&&Ru.supportsFiber)try{Je=Ru.inject(PS),gt=Ru}catch{}}return xo.createRoot=function(r,s){if(!l(r))throw Error(i(299));var o=!1,d="",m=U0,x=F0,w=H0;return s!=null&&(s.unstable_strictMode===!0&&(o=!0),s.identifierPrefix!==void 0&&(d=s.identifierPrefix),s.onUncaughtError!==void 0&&(m=s.onUncaughtError),s.onCaughtError!==void 0&&(x=s.onCaughtError),s.onRecoverableError!==void 0&&(w=s.onRecoverableError)),s=_1(r,1,!1,null,null,o,d,null,m,x,w,R1),r[Pr]=s.current,Dh(r),new Zh(s)},xo.hydrateRoot=function(r,s,o){if(!l(r))throw Error(i(299));var d=!1,m="",x=U0,w=F0,N=H0,H=null;return o!=null&&(o.unstable_strictMode===!0&&(d=!0),o.identifierPrefix!==void 0&&(m=o.identifierPrefix),o.onUncaughtError!==void 0&&(x=o.onUncaughtError),o.onCaughtError!==void 0&&(w=o.onCaughtError),o.onRecoverableError!==void 0&&(N=o.onRecoverableError),o.formState!==void 0&&(H=o.formState)),s=_1(r,1,!0,s,o??null,d,m,H,x,w,N,R1),s.context=w1(null),o=s.current,d=rr(),d=zi(d),m=Yi(d),m.callback=null,Wi(o,m,d),o=d,s.current.lanes=o,bs(s,o),Gr(s),r[Pr]=s.current,Dh(r),new Mu(s)},xo.version="19.2.7",xo}var V1;function ZS(){if(V1)return tp.exports;V1=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(),tp.exports=KS(),tp.exports}var JS=ZS();const G1=e=>{let t;const n=new Set,i=(p,g)=>{const v=typeof p=="function"?p(t):p;if(!Object.is(v,t)){const y=t;t=g??(typeof v!="object"||v===null)?v:Object.assign({},t,v),n.forEach(b=>b(t,y))}},l=()=>t,f={setState:i,getState:l,getInitialState:()=>h,subscribe:p=>(n.add(p),()=>n.delete(p))},h=t=e(i,l,f);return f},ej=(e=>e?G1(e):G1),tj=e=>e;function nj(e,t=tj){const n=Du.useSyncExternalStore(e.subscribe,Du.useCallback(()=>t(e.getState()),[e,t]),Du.useCallback(()=>t(e.getInitialState()),[e,t]));return Du.useDebugValue(n),n}const Y1=e=>{const t=ej(e),n=i=>nj(t,i);return Object.assign(n,t),n},rj=(e=>e?Y1(e):Y1),tm="companion_auth_token";function W1(){return typeof window>"u"?null:localStorage.getItem(tm)||null}const ij=e=>({authToken:W1(),isAuthenticated:W1()!==null,setAuthToken:t=>{localStorage.setItem(tm,t),e({authToken:t,isAuthenticated:!0})},logout:()=>{localStorage.removeItem(tm),e({authToken:null,isAuthenticated:!1})}});function Ht(e,t){if(!e.has(t))return e;const n=new Map(e);return n.delete(t),n}function sj(e,t){if(!e.has(t))return e;const n=new Set(e);return n.delete(t),n}function aj(){if(typeof window>"u")return new Map;try{return new Map(JSON.parse(localStorage.getItem("cc-session-names")||"[]"))}catch{return new Map}}function lj(){return typeof window>"u"?null:localStorage.getItem("cc-current-session")||null}function oj(){if(typeof window>"u")return new Set;try{return new Set(JSON.parse(localStorage.getItem("cc-collapsed-projects")||"[]"))}catch{return new Set}}const cj=e=>({sessions:new Map,sdkSessions:[],currentSessionId:lj(),connectionStatus:new Map,cliConnected:new Map,cliReconnecting:new Map,sessionStatus:new Map,previousPermissionMode:new Map,sessionNames:aj(),recentlyRenamed:new Set,prStatus:new Map,linkedLinearIssues:new Map,mcpServers:new Map,collapsedProjects:oj(),setCurrentSession:t=>{t?localStorage.setItem("cc-current-session",t):localStorage.removeItem("cc-current-session"),e({currentSessionId:t})},addSession:t=>e(n=>{const i=new Map(n.sessions);i.set(t.session_id,t);const l=new Map(n.messages);return l.has(t.session_id)||l.set(t.session_id,[]),{sessions:i,messages:l}}),updateSession:(t,n)=>e(i=>{const l=new Map(i.sessions),c=l.get(t);return c&&l.set(t,{...c,...n}),{sessions:l}}),removeSession:t=>e(n=>{const i=Ht(n.sessionNames,t);return localStorage.setItem("cc-session-names",JSON.stringify(Array.from(i.entries()))),n.currentSessionId===t&&localStorage.removeItem("cc-current-session"),{sessions:Ht(n.sessions,t),connectionStatus:Ht(n.connectionStatus,t),cliConnected:Ht(n.cliConnected,t),cliReconnecting:Ht(n.cliReconnecting,t),sessionStatus:Ht(n.sessionStatus,t),previousPermissionMode:Ht(n.previousPermissionMode,t),sessionNames:i,recentlyRenamed:sj(n.recentlyRenamed,t),mcpServers:Ht(n.mcpServers,t),prStatus:Ht(n.prStatus,t),linkedLinearIssues:Ht(n.linkedLinearIssues,t),sdkSessions:n.sdkSessions.filter(l=>l.sessionId!==t),currentSessionId:n.currentSessionId===t?null:n.currentSessionId,messages:Ht(n.messages,t),streaming:Ht(n.streaming,t),streamingStartedAt:Ht(n.streamingStartedAt,t),streamingOutputTokens:Ht(n.streamingOutputTokens,t),pendingPermissions:Ht(n.pendingPermissions,t),aiResolvedPermissions:Ht(n.aiResolvedPermissions,t),sessionTasks:Ht(n.sessionTasks,t),changedFilesTick:Ht(n.changedFilesTick,t),gitChangedFilesCount:Ht(n.gitChangedFilesCount,t),sessionProcesses:Ht(n.sessionProcesses,t),toolProgress:Ht(n.toolProgress,t),toolActivity:Ht(n.toolActivity,t),diffPanelSelectedFile:Ht(n.diffPanelSelectedFile,t),chatTabReentryTickBySession:Ht(n.chatTabReentryTickBySession,t)}}),setSdkSessions:t=>e({sdkSessions:t}),setConnectionStatus:(t,n)=>e(i=>{const l=new Map(i.connectionStatus);return l.set(t,n),{connectionStatus:l}}),setCliConnected:(t,n)=>e(i=>{const l=new Map(i.cliConnected);return l.set(t,n),{cliConnected:l}}),setCliReconnecting:(t,n)=>e(i=>{const l=new Map(i.cliReconnecting);return n?l.set(t,!0):l.delete(t),{cliReconnecting:l}}),setSessionStatus:(t,n)=>e(i=>{const l=new Map(i.sessionStatus);return l.set(t,n),{sessionStatus:l}}),setPreviousPermissionMode:(t,n)=>e(i=>{const l=new Map(i.previousPermissionMode);return l.set(t,n),{previousPermissionMode:l}}),setSessionName:(t,n)=>e(i=>{const l=new Map(i.sessionNames);return l.set(t,n),localStorage.setItem("cc-session-names",JSON.stringify(Array.from(l.entries()))),{sessionNames:l}}),markRecentlyRenamed:t=>e(n=>{const i=new Set(n.recentlyRenamed);return i.add(t),{recentlyRenamed:i}}),clearRecentlyRenamed:t=>e(n=>{const i=new Set(n.recentlyRenamed);return i.delete(t),{recentlyRenamed:i}}),setPRStatus:(t,n)=>e(i=>{const l=new Map(i.prStatus);return l.set(t,n),{prStatus:l}}),setLinkedLinearIssue:(t,n)=>e(i=>{const l=new Map(i.linkedLinearIssues);return n?l.set(t,n):l.delete(t),{linkedLinearIssues:l}}),setMcpServers:(t,n)=>e(i=>{const l=new Map(i.mcpServers);return l.set(t,n),{mcpServers:l}}),toggleProjectCollapse:t=>e(n=>{const i=new Set(n.collapsedProjects);return i.has(t)?i.delete(t):i.add(t),localStorage.setItem("cc-collapsed-projects",JSON.stringify(Array.from(i))),{collapsedProjects:i}}),setSessionAiValidation:(t,n)=>e(i=>{const l=new Map(i.sessions),c=l.get(t);return c?(l.set(t,{...c,...n}),{sessions:l}):{}})}),uj=e=>({messages:new Map,streaming:new Map,streamingStartedAt:new Map,streamingOutputTokens:new Map,appendMessage:(t,n)=>e(i=>{const l=i.messages.get(t)||[];if(n.id&&l.some(u=>u.id===n.id))return i;const c=new Map(i.messages);return c.set(t,[...l,n]),{messages:c}}),setMessages:(t,n)=>e(i=>{const l=new Map(i.messages);return l.set(t,n),{messages:l}}),updateLastAssistantMessage:(t,n)=>e(i=>{const l=new Map(i.messages),c=[...l.get(t)||[]];for(let u=c.length-1;u>=0;u--)if(c[u].role==="assistant"){c[u]=n(c[u]);break}return l.set(t,c),{messages:l}}),setStreaming:(t,n)=>e(i=>{const l=new Map(i.streaming);return n===null?l.delete(t):l.set(t,n),{streaming:l}}),setStreamingStats:(t,n)=>e(i=>{const l=new Map(i.streamingStartedAt),c=new Map(i.streamingOutputTokens);return n===null?(l.delete(t),c.delete(t)):(n.startedAt!==void 0&&l.set(t,n.startedAt),n.outputTokens!==void 0&&c.set(t,n.outputTokens)),{streamingStartedAt:l,streamingOutputTokens:c}}),promptSuggestions:new Map,setPromptSuggestions:(t,n)=>e(i=>{const l=new Map(i.promptSuggestions);return l.set(t,n),{promptSuggestions:l}}),clearPromptSuggestions:t=>e(n=>{const i=new Map(n.promptSuggestions);return i.delete(t),{promptSuggestions:i}})}),dj=e=>({pendingPermissions:new Map,aiResolvedPermissions:new Map,addPermission:(t,n)=>e(i=>{const l=new Map(i.pendingPermissions),c=new Map(l.get(t)||[]);return c.set(n.request_id,n),l.set(t,c),{pendingPermissions:l}}),removePermission:(t,n)=>e(i=>{const l=new Map(i.pendingPermissions),c=l.get(t);if(c){const u=new Map(c);u.delete(n),l.set(t,u)}return{pendingPermissions:l}}),addAiResolvedPermission:(t,n)=>e(i=>{const l=new Map(i.aiResolvedPermissions),c=[...l.get(t)||[],n];return c.length>50&&c.splice(0,c.length-50),l.set(t,c),{aiResolvedPermissions:l}}),clearAiResolvedPermissions:t=>e(n=>{const i=new Map(n.aiResolvedPermissions);return i.delete(t),{aiResolvedPermissions:i}})}),fj=e=>({sessionTasks:new Map,sessionProcesses:new Map,sessionBackgroundAgents:new Map,changedFilesTick:new Map,gitChangedFilesCount:new Map,toolProgress:new Map,toolActivity:new Map,addTask:(t,n)=>e(i=>{const l=new Map(i.sessionTasks),c=[...l.get(t)||[],n];return l.set(t,c),{sessionTasks:l}}),setTasks:(t,n)=>e(i=>{const l=new Map(i.sessionTasks);return l.set(t,n),{sessionTasks:l}}),updateTask:(t,n,i)=>e(l=>{const c=new Map(l.sessionTasks),u=c.get(t);return u&&c.set(t,u.map(f=>f.id===n?{...f,...i}:f)),{sessionTasks:c}}),addProcess:(t,n)=>e(i=>{const l=new Map(i.sessionProcesses),c=[...l.get(t)||[],n];return l.set(t,c),{sessionProcesses:l}}),updateProcess:(t,n,i)=>e(l=>{const c=new Map(l.sessionProcesses),u=c.get(t);return u&&c.set(t,u.map(f=>f.taskId===n?{...f,...i}:f)),{sessionProcesses:c}}),updateProcessByToolUseId:(t,n,i)=>e(l=>{const c=new Map(l.sessionProcesses),u=c.get(t);return u&&c.set(t,u.map(f=>f.toolUseId===n?{...f,...i}:f)),{sessionProcesses:c}}),addBackgroundAgent:(t,n)=>e(i=>{const l=new Map(i.sessionBackgroundAgents),c=[...l.get(t)||[],n];return l.set(t,c),{sessionBackgroundAgents:l}}),updateBackgroundAgent:(t,n,i)=>e(l=>{const c=new Map(l.sessionBackgroundAgents),u=c.get(t);return u&&c.set(t,u.map(f=>f.toolUseId===n?{...f,...i}:f)),{sessionBackgroundAgents:c}}),bumpChangedFilesTick:t=>e(n=>{const i=new Map(n.changedFilesTick);return i.set(t,(i.get(t)??0)+1),{changedFilesTick:i}}),setGitChangedFilesCount:(t,n)=>e(i=>{const l=new Map(i.gitChangedFilesCount);return l.set(t,n),{gitChangedFilesCount:l}}),setToolProgress:(t,n,i)=>e(l=>{const c=new Map(l.toolProgress),u=new Map(c.get(t)||[]);return u.set(n,i),c.set(t,u),{toolProgress:c}}),clearToolProgress:(t,n)=>e(i=>{const l=new Map(i.toolProgress);if(n){const c=l.get(t);if(c){const u=new Map(c);u.delete(n),l.set(t,u)}}else l.delete(t);return{toolProgress:l}}),setToolActivity:(t,n)=>e(i=>{const l=new Map(i.toolActivity);return n.length===0?l.delete(t):l.set(t,n),{toolActivity:l}}),addToolActivity:(t,n)=>e(i=>{const l=new Map(i.toolActivity),c=[...l.get(t)||[]],u=c.findIndex(f=>f.toolUseId===n.toolUseId);if(u>=0){const f=c[u];c[u]={...f,...n,startedAt:f.startedAt,completedAt:n.completedAt??f.completedAt,elapsedSeconds:Math.max(f.elapsedSeconds,n.elapsedSeconds),isError:f.isError||n.isError}}else c.push(n);return l.set(t,c),{toolActivity:l}}),updateToolActivity:(t,n,i)=>e(l=>{const c=new Map(l.toolActivity),u=c.get(t);return u&&c.set(t,u.map(f=>f.toolUseId===n?{...f,...i}:f)),{toolActivity:c}})}),Ti=[{id:"usage-limits",label:"Usage Limits",description:"API usage and rate limit meters",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"]}],hj=Ti.map(e=>e.id),E5="cc-task-panel-config";function nm(){return{order:[...hj],enabled:Object.fromEntries(Ti.map(e=>[e.id,!0]))}}function pj(){if(typeof window>"u")return nm();try{const e=localStorage.getItem(E5);if(e){const t=JSON.parse(e),n=new Set(t.order);for(const l of Ti)n.has(l.id)||(t.order.push(l.id),t.enabled[l.id]=!0);const i=new Set(Ti.map(l=>l.id));return t.order=t.order.filter(l=>i.has(l)),t}}catch{}return nm()}function zu(e){try{localStorage.setItem(E5,JSON.stringify(e))}catch{}}function mj(){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 gj(){if(typeof window>"u")return!0;const e=localStorage.getItem("cc-notification-sound");return e!==null?e==="true":!0}function xj(){if(typeof window>"u")return!1;const e=localStorage.getItem("cc-notification-desktop");return e!==null?e==="true":!1}function T5(){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"}const vj=e=>({darkMode:mj(),notificationSound:gj(),notificationDesktop:xj(),sidebarOpen:typeof window<"u"?window.innerWidth>=768:!0,taskPanelOpen:typeof window<"u"?window.innerWidth>=1024:!0,taskPanelConfig:pj(),taskPanelConfigMode:!1,homeResetKey:0,publicUrl:"",activeTab:"chat",chatTabReentryTickBySession:new Map,diffPanelSelectedFile:new Map,diffBase:T5(),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}),setSidebarOpen:t=>e({sidebarOpen:t}),setTaskPanelOpen:t=>e({taskPanelOpen:t}),setTaskPanelConfigMode:t=>e({taskPanelConfigMode:t}),toggleSectionEnabled:t=>e(n=>{const i={order:[...n.taskPanelConfig.order],enabled:{...n.taskPanelConfig.enabled,[t]:!n.taskPanelConfig.enabled[t]}};return zu(i),{taskPanelConfig:i}}),moveSectionUp:t=>e(n=>{const i=[...n.taskPanelConfig.order],l=i.indexOf(t);if(l<=0)return n;[i[l-1],i[l]]=[i[l],i[l-1]];const c={...n.taskPanelConfig,order:i};return zu(c),{taskPanelConfig:c}}),moveSectionDown:t=>e(n=>{const i=[...n.taskPanelConfig.order],l=i.indexOf(t);if(l<0||l>=i.length-1)return n;[i[l],i[l+1]]=[i[l+1],i[l]];const c={...n.taskPanelConfig,order:i};return zu(c),{taskPanelConfig:c}}),resetTaskPanelConfig:()=>{const t=nm();zu(t),e({taskPanelConfig:t})},newSession:()=>{localStorage.removeItem("cc-current-session"),e(t=>({currentSessionId:null,homeResetKey:t.homeResetKey+1}))},setActiveTab:t=>e({activeTab:t}),markChatTabReentry:t=>e(n=>{const i=new Map(n.chatTabReentryTickBySession),l=(i.get(t)??0)+1;return i.set(t,l),{chatTabReentryTickBySession:i}}),setDiffPanelSelectedFile:(t,n)=>e(i=>{const l=new Map(i.diffPanelSelectedFile);return n?l.set(t,n):l.delete(t),{diffPanelSelectedFile:l}}),setDiffBase:t=>{typeof window<"u"&&localStorage.setItem("cc-diff-base",t),e({diffBase:t})}});function A5(){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 bj=e=>({quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalPlacement:A5(),quickTerminalNextHostIndex:1,quickTerminalNextDockerIndex:1,terminalOpen:!1,terminalCwd:null,terminalId:null,setQuickTerminalOpen:t=>e({quickTerminalOpen:t}),openQuickTerminal:t=>e(n=>{if(t.reuseIfExists){const p=n.quickTerminalTabs.find(g=>g.cwd===t.cwd&&g.containerId===t.containerId);if(p)return{quickTerminalOpen:!0,activeQuickTerminalTabId:p.id}}const i=t.target==="docker",l=n.quickTerminalNextHostIndex,c=n.quickTerminalNextDockerIndex,u=i?l:l+1,f=i?c+1:c,h={id:`${t.target}-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,label:i?`Docker ${c}`:l===1?"Terminal":`Terminal ${l}`,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 c;const i=n.quickTerminalTabs.filter(u=>u.id!==t),l=n.activeQuickTerminalTabId===t?((c=i[0])==null?void 0:c.id)||null:n.activeQuickTerminalTabId;return{quickTerminalTabs:i,activeQuickTerminalTabId:l,quickTerminalOpen:i.length>0?n.quickTerminalOpen:!1}}),setActiveQuickTerminalTabId:t=>e({activeQuickTerminalTabId:t}),resetQuickTerminal:()=>e({quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalNextHostIndex:1,quickTerminalNextDockerIndex:1}),setTerminalOpen:t=>e({terminalOpen:t}),setTerminalCwd:t=>e({terminalCwd:t}),setTerminalId:t=>e({terminalId:t}),openTerminal:t=>e({terminalOpen:!0,terminalCwd:t}),closeTerminal:()=>e({terminalOpen:!1,terminalCwd:null,terminalId:null})});function yj(){return typeof window>"u"?null:localStorage.getItem("cc-update-dismissed")||null}const _j=e=>({updateInfo:null,updateDismissedVersion:yj(),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 i=n.creationProgress||[],l=i.findIndex(c=>c.step===t.step);if(l>=0){const c=[...i];return c[l]=t,{creationProgress:c}}return{creationProgress:[...i,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})}),X=rj((...e)=>({...ij(...e),...cj(...e),...uj(...e),...dj(...e),...fj(...e),...vj(...e),...bj(...e),..._j(...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,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:T5(),quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalPlacement:A5(),quickTerminalNextHostIndex:1,quickTerminalNextDockerIndex:1,terminalOpen:!1,terminalCwd:null,terminalId:null})}})),wj=Object.freeze(Object.defineProperty({__proto__:null,useStore:X},Symbol.toStringTag,{value:"Module"})),X1=["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"],Q1=["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 K1(){const e=X1[Math.floor(Math.random()*X1.length)],t=Q1[Math.floor(Math.random()*Q1.length)];return`${e} ${t}`}function M5(e){for(let t=0;t<100;t++){const n=K1();if(!e.has(n))return n}return K1()}let sp=null;function kj(){return sp||(sp=new AudioContext),sp}function Sj(){try{const e=kj();e.state==="suspended"&&e.resume();const t=e.currentTime,n=e.createOscillator(),i=e.createGain();n.type="sine",n.frequency.setValueAtTime(659.25,t),i.gain.setValueAtTime(.3,t),i.gain.exponentialRampToValueAtTime(.001,t+.3),n.connect(i),i.connect(e.destination),n.start(t),n.stop(t+.3);const l=e.createOscillator(),c=e.createGain();l.type="sine",l.frequency.setValueAtTime(783.99,t+.15),c.gain.setValueAtTime(.001,t),c.gain.setValueAtTime(.3,t+.15),c.gain.exponentialRampToValueAtTime(.001,t+.5),l.connect(c),c.connect(e.destination),l.start(t+.15),l.stop(t+.5)}catch{}}class R5{diff(t,n,i={}){let l;typeof i=="function"?(l=i,i={}):"callback"in i&&(l=i.callback);const c=this.castInput(t,i),u=this.castInput(n,i),f=this.removeEmpty(this.tokenize(c,i)),h=this.removeEmpty(this.tokenize(u,i));return this.diffWithOptionsObj(f,h,i,l)}diffWithOptionsObj(t,n,i,l){var c;const u=R=>{if(R=this.postProcess(R,i),l){setTimeout(function(){l(R)},0);return}else return R},f=n.length,h=t.length;let p=1,g=f+h;i.maxEditLength!=null&&(g=Math.min(g,i.maxEditLength));const v=(c=i.timeout)!==null&&c!==void 0?c:1/0,y=Date.now()+v,b=[{oldPos:-1,lastComponent:void 0}];let _=this.extractCommon(b[0],n,t,0,i);if(b[0].oldPos+1>=h&&_+1>=f)return u(this.buildValues(b[0].lastComponent,n,t));let S=-1/0,T=1/0;const j=()=>{for(let R=Math.max(S,-p);R<=Math.min(T,p);R+=2){let C;const P=b[R-1],z=b[R+1];P&&(b[R-1]=void 0);let D=!1;if(z){const B=z.oldPos-R;D=z&&0<=B&&B<f}const F=P&&P.oldPos+1<h;if(!D&&!F){b[R]=void 0;continue}if(!F||D&&P.oldPos<z.oldPos?C=this.addToPath(z,!0,!1,0,i):C=this.addToPath(P,!1,!0,1,i),_=this.extractCommon(C,n,t,R,i),C.oldPos+1>=h&&_+1>=f)return u(this.buildValues(C.lastComponent,n,t))||!0;b[R]=C,C.oldPos+1>=h&&(T=Math.min(T,R-1)),_+1>=f&&(S=Math.max(S,R+1))}p++};if(l)(function R(){setTimeout(function(){if(p>g||Date.now()>y)return l(void 0);j()||R()},0)})();else for(;p<=g&&Date.now()<=y;){const R=j();if(R)return R}}addToPath(t,n,i,l,c){const u=t.lastComponent;return u&&!c.oneChangePerToken&&u.added===n&&u.removed===i?{oldPos:t.oldPos+l,lastComponent:{count:u.count+1,added:n,removed:i,previousComponent:u.previousComponent}}:{oldPos:t.oldPos+l,lastComponent:{count:1,added:n,removed:i,previousComponent:u}}}extractCommon(t,n,i,l,c){const u=n.length,f=i.length;let h=t.oldPos,p=h-l,g=0;for(;p+1<u&&h+1<f&&this.equals(i[h+1],n[p+1],c);)p++,h++,g++,c.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return g&&!c.oneChangePerToken&&(t.lastComponent={count:g,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=h,p}equals(t,n,i){return i.comparator?i.comparator(t,n):t===n||!!i.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){const n=[];for(let i=0;i<t.length;i++)t[i]&&n.push(t[i]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,i){const l=[];let c;for(;t;)l.push(t),c=t.previousComponent,delete t.previousComponent,t=c;l.reverse();const u=l.length;let f=0,h=0,p=0;for(;f<u;f++){const g=l[f];if(g.removed)g.value=this.join(i.slice(p,p+g.count)),p+=g.count;else{if(!g.added&&this.useLongestToken){let v=n.slice(h,h+g.count);v=v.map(function(y,b){const _=i[p+b];return _.length>y.length?_:y}),g.value=this.join(v)}else g.value=this.join(n.slice(h,h+g.count));h+=g.count,g.added||(p+=g.count)}}return l}}function Z1(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 J1(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 rm(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 im(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 vo(e,t){return rm(e,t,"")}function Lu(e,t){return im(e,t,"")}function eb(e,t){return t.slice(0,jj(e,t))}function jj(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let i=t.length;e.length<t.length&&(i=e.length);const l=Array(i);let c=0;l[0]=0;for(let u=1;u<i;u++){for(t[u]==t[c]?l[u]=l[c]:l[u]=c;c>0&&t[u]!=t[c];)c=l[c];t[u]==t[c]&&c++}c=0;for(let u=n;u<e.length;u++){for(;c>0&&e[u]!=t[c];)c=l[c];e[u]==t[c]&&c++}return c}function D5(e,t){const n=[];for(const i of Array.from(t.segment(e))){const l=i.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(l)?n[n.length-1]+=l:n.push(l)}return n}function sm(e,t){if(t)return Fo(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function Ka(e,t){if(t)return Fo(e,t)[0];const n=e.match(/^\s*/);return n?n[0]:""}function Fo(e,t){if(!t)return[Ka(e),sm(e)];if(t.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');const n=D5(e,t),i=n[0],l=n[n.length-1],c=/\s/.test(i)?i:"",u=/\s/.test(l)?l:"";return[c,u]}const tb="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}",Nj=new RegExp(`[${tb}]+|\\s+|[^${tb}]`,"ug");class Cj extends R5{equals(t,n,i){return i.ignoreCase&&(t=t.toLowerCase(),n=n.toLowerCase()),t.trim()===n.trim()}tokenize(t,n={}){let i;if(n.intlSegmenter){const u=n.intlSegmenter;if(u.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');i=D5(t,u)}else i=t.match(Nj)||[];const l=[];let c=null;return i.forEach(u=>{/\s/.test(u)?c==null?l.push(u):l.push(l.pop()+u):c!=null&&/\s/.test(c)?l[l.length-1]==c?l.push(l.pop()+u):l.push(c+u):l.push(u),c=u}),l}join(t){return t.map((n,i)=>i==0?n:n.replace(/^\s+/,"")).join("")}postProcess(t,n){if(!t||n.oneChangePerToken)return t;let i=null,l=null,c=null;return t.forEach(u=>{u.added?l=u:u.removed?c=u:((l||c)&&nb(i,c,l,u,n.intlSegmenter),i=u,l=null,c=null)}),(l||c)&&nb(i,c,l,null,n.intlSegmenter),t}}const Ej=new Cj;function Tj(e,t,n){return Ej.diff(e,t,n)}function nb(e,t,n,i,l){if(t&&n){const[c,u]=Fo(t.value,l),[f,h]=Fo(n.value,l);if(e){const p=Z1(c,f);e.value=im(e.value,f,p),t.value=vo(t.value,p),n.value=vo(n.value,p)}if(i){const p=J1(u,h);i.value=rm(i.value,h,p),t.value=Lu(t.value,p),n.value=Lu(n.value,p)}}else if(n){if(e){const c=Ka(n.value,l);n.value=n.value.substring(c.length)}if(i){const c=Ka(i.value,l);i.value=i.value.substring(c.length)}}else if(e&&i){const c=Ka(i.value,l),[u,f]=Fo(t.value,l),h=Z1(c,u);t.value=vo(t.value,h);const p=J1(vo(c,h),f);t.value=Lu(t.value,p),i.value=rm(i.value,c,p),e.value=im(e.value,c,c.slice(0,c.length-p.length))}else if(i){const c=Ka(i.value,l),u=sm(t.value,l),f=eb(u,c);t.value=Lu(t.value,f)}else if(e){const c=sm(e.value,l),u=Ka(t.value,l),f=eb(c,u);t.value=vo(t.value,f)}}class Aj extends R5{constructor(){super(...arguments),this.tokenize=Rj}equals(t,n,i){return i.ignoreWhitespace?((!i.newlineIsToken||!t.includes(`
|
|
50
|
+
`))&&(t=t.trim()),(!i.newlineIsToken||!n.includes(`
|
|
51
|
+
`))&&(n=n.trim())):i.ignoreNewlineAtEof&&!i.newlineIsToken&&(t.endsWith(`
|
|
52
|
+
`)&&(t=t.slice(0,-1)),n.endsWith(`
|
|
53
|
+
`)&&(n=n.slice(0,-1))),super.equals(t,n,i)}}const Mj=new Aj;function rb(e,t,n){return Mj.diff(e,t,n)}function Rj(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
|
|
54
|
+
`));const n=[],i=e.split(/(\n|\r\n)/);i[i.length-1]||i.pop();for(let l=0;l<i.length;l++){const c=i[l];l%2&&!t.newlineIsToken?n[n.length-1]+=c:n.push(c)}return n}function Dj(e,t,n,i,l,c,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:g}=f;rb(n,i,Object.assign(Object.assign({},f),{callback:v=>{const y=p(v);g(y)}}))}else return p(rb(n,i,f));function p(g){if(!g)return;g.push({value:"",lines:[]});function v(R){return R.map(function(C){return" "+C})}const y=[];let b=0,_=0,S=[],T=1,j=1;for(let R=0;R<g.length;R++){const C=g[R],P=C.lines||zj(C.value);if(C.lines=P,C.added||C.removed){if(!b){const z=g[R-1];b=T,_=j,z&&(S=h>0?v(z.lines.slice(-h)):[],b-=S.length,_-=S.length)}for(const z of P)S.push((C.added?"+":"-")+z);C.added?j+=P.length:T+=P.length}else{if(b)if(P.length<=h*2&&R<g.length-2)for(const z of v(P))S.push(z);else{const z=Math.min(P.length,h);for(const F of v(P.slice(0,z)))S.push(F);const D={oldStart:b,oldLines:T-b+z,newStart:_,newLines:j-_+z,lines:S};y.push(D),b=0,_=0,S=[]}T+=P.length,j+=P.length}}for(const R of y)for(let C=0;C<R.lines.length;C++)R.lines[C].endsWith(`
|
|
55
|
+
`)?R.lines[C]=R.lines[C].slice(0,-1):(R.lines.splice(C+1,0,"\"),C++);return{oldFileName:e,newFileName:t,oldHeader:l,newHeader:c,hunks:y}}}function zj(e){const t=e.endsWith(`
|
|
56
|
+
`),n=e.split(`
|
|
57
|
+
`).map(i=>i+`
|
|
58
|
+
`);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function Lj(e,t){return Dj("","",e,t,"","",{context:3}).hunks.map(i=>{const l=`@@ -${i.oldStart},${i.oldLines} +${i.newStart},${i.newLines} @@`,c=[];let u=i.oldStart,f=i.newStart;for(const h of i.lines){const p=h[0],g=h.slice(1);p==="-"?c.push({type:"del",content:g,oldLineNo:u++}):p==="+"?c.push({type:"add",content:g,newLineNo:f++}):c.push({type:"context",content:g,oldLineNo:u++,newLineNo:f++})}return z5(c),{header:l,lines:c}})}function Oj(e){const t=[],n=e.split(`
|
|
59
|
+
`);let i=null,l=null,c=0,u=0;for(const f of n){if(f.startsWith("diff --git")||f.startsWith("diff --cc")){l&&i&&i.hunks.push(l),i&&t.push(i),i={fileName:"",hunks:[]},l=null;continue}if(f.startsWith("--- a/")||f.startsWith("--- /dev/null"))continue;if(f.startsWith("+++ b/")){i&&(i.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){l&&i&&i.hunks.push(l),c=parseInt(h[1],10),u=parseInt(h[2],10),l={header:f,lines:[]};continue}l&&(f.startsWith("+")?l.lines.push({type:"add",content:f.slice(1),newLineNo:u++}):f.startsWith("-")?l.lines.push({type:"del",content:f.slice(1),oldLineNo:c++}):f.startsWith(" ")&&l.lines.push({type:"context",content:f.slice(1),oldLineNo:c++,newLineNo:u++}))}l&&i&&i.hunks.push(l),i&&t.push(i);for(const f of t)for(const h of f.hunks)z5(h.lines);return t}function z5(e){let t=0;for(;t<e.length;){const n=t;for(;t<e.length&&e[t].type==="del";)t++;const i=t,l=t;for(;t<e.length&&e[t].type==="add";)t++;const c=t,u=i-n,f=c-l;if(u>0&&f>0){const h=Math.min(u,f);for(let p=0;p<h;p++){const g=e[n+p],v=e[l+p],y=Tj(g.content,v.content);g.wordChanges=y.filter(b=>!b.added).map(b=>({value:b.value,removed:b.removed})),v.wordChanges=y.filter(b=>!b.removed).map(b=>({value:b.value,added:b.added}))}}t===n&&t++}}function Bj({line:e}){return e.wordChanges?a.jsx(a.Fragment,{children:e.wordChanges.map((t,n)=>t.added?a.jsx("span",{className:"diff-word-add",children:t.value},n):t.removed?a.jsx("span",{className:"diff-word-del",children:t.value},n):a.jsx("span",{children:t.value},n))}):a.jsx(a.Fragment,{children:e.content})}function $j({hunk:e,showLineNumbers:t}){return a.jsxs("div",{className:"diff-hunk",children:[a.jsx("div",{className:"diff-hunk-header",children:e.header}),e.lines.map((n,i)=>a.jsxs("div",{className:`diff-line diff-line-${n.type}`,children:[t&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"diff-gutter diff-gutter-old",children:n.oldLineNo??""}),a.jsx("span",{className:"diff-gutter diff-gutter-new",children:n.newLineNo??""})]}),a.jsx("span",{className:"diff-marker",children:n.type==="add"?"+":n.type==="del"?"-":" "}),a.jsxs("span",{className:"diff-content",children:[a.jsx(Bj,{line:n}),!n.content&&" "]})]},i))]})}function Pj({fileName:e}){const t=e.split("/"),n=t.pop()||e,i=t.join("/");return a.jsxs("div",{className:"diff-file-header",children:[a.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:[a.jsx("path",{d:"M9 1H4a1 1 0 00-1 1v12a1 1 0 001 1h8a1 1 0 001-1V5L9 1z"}),a.jsx("polyline",{points:"9 1 9 5 13 5"})]}),i&&a.jsxs("span",{className:"text-cc-muted",children:[i,"/"]}),a.jsx("span",{className:"font-semibold text-cc-fg",children:n})]})}function pl({oldText:e,newText:t,unifiedDiff:n,fileName:i,mode:l="compact"}){const c=l==="compact",u=!c,f=k.useMemo(()=>{if(n)return Oj(n);const h=e??"",p=t??"";if(!h&&!p)return[];const g=Lj(h,p);return[{fileName:i||"",hunks:g}]},[e,t,n,i]);return f.length===0||f.every(h=>h.hunks.length===0)?a.jsx("div",{className:"diff-viewer diff-empty",children:a.jsx("span",{className:"text-cc-muted text-xs",children:"No changes"})}):a.jsx("div",{className:`diff-viewer ${c?"diff-compact":"diff-full"}`,children:f.map((h,p)=>a.jsxs("div",{className:"diff-file",children:[(h.fileName||i)&&a.jsx(Pj,{fileName:h.fileName||i||""}),h.hunks.map((g,v)=>a.jsx($j,{hunk:g,showLineNumbers:u},v))]},p))})}const Uj={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 pc(e){return Uj[e]||"tool"}function gs(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 L5({name:e,input:t,toolUseId:n}){const[i,l]=k.useState(e==="Edit"),c=pc(e),u=gs(e),f=Jo(e,t);return e==="Edit"?a.jsx(Fj,{input:t,toolUseId:n}):e==="Bash"?a.jsx(Hj,{input:t,toolUseId:n}):a.jsxs("div",{className:"border border-cc-border rounded-[10px] overflow-hidden bg-cc-card tool-card","data-tool-use-id":n,children:[a.jsxs("button",{onClick:()=>l(!i),className:"w-full flex items-center gap-2.5 px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-3 h-3 text-cc-muted transition-transform duration-200 shrink-0 ${i?"rotate-90":""}`,children:a.jsx("path",{d:"M6 4l4 4-4 4"})}),a.jsx(ll,{type:c}),a.jsx("span",{className:"text-xs font-medium text-cc-fg",children:u}),f&&a.jsx("span",{className:"text-xs text-cc-muted truncate flex-1 font-mono-code",children:f})]}),i&&a.jsx("div",{className:"px-3 pb-3 pt-0 border-t border-cc-border/60",children:a.jsx("div",{className:"mt-2",children:a.jsx(qj,{name:e,input:t})})})]})}function Fj({input:e,toolUseId:t}){const n=String(e.file_path||""),i=n?n.split("/").pop()||n:"",l=String(e.old_string||""),c=String(e.new_string||""),u=!!(l||c),f=!!e.replace_all,[h,p]=k.useState(!1),v=(Array.isArray(e.changes)?e.changes:[]).map(_=>({path:typeof _.path=="string"?_.path:"",kind:typeof _.kind=="string"?_.kind:"update"})).filter(_=>_.path),y=(l+c).split(`
|
|
60
|
+
`).length,b=y>15;return a.jsxs("div",{"data-tool-use-id":t,children:[a.jsxs("div",{className:"flex items-center gap-1.5 py-0.5",children:[a.jsx("span",{className:"text-[11px] font-medium text-emerald-600/70 dark:text-emerald-400/70",children:"Edit"}),i&&a.jsx("span",{className:"text-[11px] font-mono-code text-cc-fg/70",children:i}),f&&a.jsx("span",{className:"text-[9px] uppercase tracking-wider font-semibold text-amber-600/70 dark:text-amber-400/70",children:"all"})]}),u?a.jsxs("div",{className:"relative mt-1",children:[a.jsx("div",{className:`overflow-hidden ${b&&!h?"max-h-[240px]":""}`,children:a.jsx(pl,{oldText:l,newText:c,mode:"compact"})}),b&&!h&&a.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-10 bg-gradient-to-t from-cc-bg to-transparent pointer-events-none"}),b&&a.jsx("button",{type:"button",onClick:()=>p(!h),className:"relative z-10 mt-1 text-[11px] text-cc-muted/40 hover:text-cc-muted/70 cursor-pointer transition-colors",children:h?"Show less":`Show all ${y} lines`})]}):v.length>0?a.jsx("div",{className:"mt-1 space-y-1",children:v.map((_,S)=>{const T=_.path.split("/").pop()||_.path;return a.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[a.jsx("span",{className:`text-[9px] font-semibold uppercase ${_.kind==="create"?"text-emerald-600/70 dark:text-emerald-400/70":_.kind==="delete"?"text-cc-error/70":"text-amber-600/70 dark:text-amber-400/70"}`,children:_.kind}),a.jsx("span",{className:"font-mono-code text-cc-fg/60 truncate",children:T})]},`${_.path}-${S}`)})}):a.jsx("pre",{className:"mt-1 text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap leading-relaxed",children:JSON.stringify(e,null,2)})]})}function Hj({input:e,toolUseId:t}){const n=typeof e.command=="string"?e.command:"",i=typeof e.description=="string"?e.description:"";return a.jsxs("div",{"data-tool-use-id":t,children:[i&&a.jsx("div",{className:"text-[11px] text-cc-muted/50 mb-1 italic",children:i}),a.jsx("div",{className:"rounded-lg bg-cc-code-bg px-3 py-2 overflow-x-auto",children:a.jsxs("pre",{className:"text-[12px] font-mono-code text-cc-code-fg leading-relaxed whitespace-pre-wrap break-words",children:[a.jsx("span",{className:"text-cc-muted/40 select-none",children:"$ "}),n]})})]})}function qj({name:e,input:t}){switch(e){case"Bash":return a.jsx(Ij,{input:t});case"Edit":return a.jsx(Vj,{input:t});case"Write":return a.jsx(Gj,{input:t});case"Read":return a.jsx(Yj,{input:t});case"Glob":return a.jsx(Wj,{input:t});case"Grep":return a.jsx(Xj,{input:t});case"WebSearch":case"web_search":return a.jsx(Qj,{input:t});case"WebFetch":return a.jsx(Kj,{input:t});case"Task":return a.jsx(Zj,{input:t});case"TodoWrite":return a.jsx(Jj,{input:t});case"NotebookEdit":return a.jsx(eN,{input:t});case"SendMessage":return a.jsx(tN,{input:t});default:return a.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 Ij({input:e}){return a.jsxs("div",{className:"space-y-1.5",children:[!!e.description&&a.jsx("div",{className:"text-[11px] text-cc-muted italic",children:String(e.description)}),a.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:[a.jsx("span",{className:"text-cc-muted select-none",children:"$ "}),String(e.command||"")]}),!!e.timeout&&a.jsxs("div",{className:"text-[10px] text-cc-muted",children:["timeout: ",String(e.timeout),"ms"]})]})}function Vj({input:e}){const t=String(e.file_path||""),n=String(e.old_string||""),i=String(e.new_string||""),c=(Array.isArray(e.changes)?e.changes:[]).map(u=>({path:typeof u.path=="string"?u.path:"",kind:typeof u.kind=="string"?u.kind:"update"})).filter(u=>u.path);return a.jsxs("div",{className:"space-y-1.5",children:[!!e.replace_all&&a.jsx("span",{className:"inline-block text-[10px] font-medium px-1.5 py-0.5 rounded bg-cc-warning/10 text-cc-warning",children:"replace all"}),n||i?a.jsx(pl,{oldText:n,newText:i,fileName:t,mode:"compact"}):c.length>0?a.jsxs("div",{className:"space-y-1.5",children:[!!t&&a.jsx("div",{className:"text-xs text-cc-muted font-mono-code",children:t}),c.map((u,f)=>a.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-cc-fg",children:[a.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}),a.jsx("span",{className:"font-mono-code truncate",children:u.path})]},`${u.path}-${f}`))]}):a.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 Gj({input:e}){const t=String(e.file_path||""),n=String(e.content||"");return a.jsx(pl,{newText:n,fileName:t,mode:"compact"})}function Yj({input:e}){const t=String(e.file_path||e.path||""),n=e.offset,i=e.limit;return a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"text-xs text-cc-muted font-mono-code",children:t}),(n!=null||i!=null)&&a.jsxs("div",{className:"flex gap-2 text-[10px] text-cc-muted",children:[n!=null&&a.jsxs("span",{children:["offset: ",n]}),i!=null&&a.jsxs("span",{children:["limit: ",i]})]})]})}function Wj({input:e}){return a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"text-xs font-mono-code text-cc-code-fg",children:String(e.pattern||"")}),!!e.path&&a.jsxs("div",{className:"text-[10px] text-cc-muted",children:["in: ",a.jsx("span",{className:"font-mono-code",children:String(e.path)})]})]})}function Xj({input:e}){return a.jsxs("div",{className:"space-y-1",children:[a.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||"")}),a.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-0.5 text-[10px] text-cc-muted",children:[!!e.path&&a.jsxs("span",{children:["path: ",a.jsx("span",{className:"font-mono-code",children:String(e.path)})]}),!!e.glob&&a.jsxs("span",{children:["glob: ",a.jsx("span",{className:"font-mono-code",children:String(e.glob)})]}),!!e.output_mode&&a.jsxs("span",{children:["mode: ",String(e.output_mode)]}),!!e.context&&a.jsxs("span",{children:["context: ",String(e.context)]}),!!e.head_limit&&a.jsxs("span",{children:["limit: ",String(e.head_limit)]})]})]})}function Qj({input:e}){return a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"text-xs text-cc-fg font-medium",children:String(e.query||"")}),Array.isArray(e.allowed_domains)&&e.allowed_domains.length>0&&a.jsxs("div",{className:"text-[10px] text-cc-muted",children:["domains: ",e.allowed_domains.join(", ")]})]})}function Kj({input:e}){return a.jsxs("div",{className:"space-y-1",children:[!!e.url&&a.jsx("div",{className:"text-xs font-mono-code text-cc-primary truncate",children:String(e.url)}),!!e.prompt&&a.jsx("div",{className:"text-[11px] text-cc-muted italic line-clamp-2",children:String(e.prompt)})]})}function Zj({input:e}){return a.jsxs("div",{className:"space-y-1.5",children:[!!e.description&&a.jsx("div",{className:"text-xs text-cc-fg font-medium",children:String(e.description)}),!!e.subagent_type&&a.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&&a.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 Jj({input:e}){const t=e.todos;return Array.isArray(t)?a.jsx("div",{className:"space-y-0.5",children:t.map((n,i)=>{const l=n.status||"pending";return a.jsxs("div",{className:"flex items-start gap-2 py-0.5",children:[a.jsx("span",{className:"shrink-0 mt-0.5",children:l==="completed"?a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-success",children:a.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==="in_progress"?a.jsx("svg",{className:"w-3.5 h-3.5 text-cc-primary animate-spin",viewBox:"0 0 16 16",fill:"none",children:a.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"28",strokeDashoffset:"8",strokeLinecap:"round"})}):a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3.5 h-3.5 text-cc-muted",children:a.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"})})}),a.jsx("span",{className:`text-[11px] leading-snug ${l==="completed"?"text-cc-muted line-through":"text-cc-fg"}`,children:n.content||"Task"})]},i)})}):a.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 eN({input:e}){const t=String(e.notebook_path||""),n=e.cell_type,i=e.edit_mode;return a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"text-xs font-mono-code text-cc-muted",children:t}),a.jsxs("div",{className:"flex gap-2 text-[10px] text-cc-muted",children:[n&&a.jsxs("span",{children:["type: ",n]}),i&&a.jsxs("span",{children:["mode: ",i]}),e.cell_number!=null&&a.jsxs("span",{children:["cell: ",String(e.cell_number)]})]}),!!e.new_source&&a.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 tN({input:e}){return a.jsxs("div",{className:"space-y-1",children:[!!e.recipient&&a.jsxs("div",{className:"text-[11px] text-cc-muted",children:["to: ",a.jsx("span",{className:"font-medium text-cc-fg",children:String(e.recipient)})]}),!!e.content&&a.jsx("div",{className:"text-xs text-cc-fg whitespace-pre-wrap",children:String(e.content)})]})}function Jo(e,t){if(e==="Bash"&&typeof t.command=="string")return t.description&&typeof t.description=="string"&&t.description.length<=60?t.description:t.command.length>60?t.command.slice(0,60)+"...":t.command;if((e==="Read"||e==="Write"||e==="Edit")&&t.file_path)return String(t.file_path).split("/").slice(-2).join("/");if(e==="Edit"&&Array.isArray(t.changes)&&t.changes.length>0){const n=t.changes[0];if(n!=null&&n.path)return String(n.path).split("/").slice(-2).join("/")}if(e==="Glob"&&t.pattern)return String(t.pattern);if(e==="Grep"&&t.pattern){const n=String(t.pattern),i=t.path?` in ${String(t.path).split("/").slice(-2).join("/")}`:"",l=n+i;return l.length>60?l.slice(0,60)+"...":l}if((e==="WebSearch"||e==="web_search")&&t.query)return String(t.query);if(e==="WebFetch"&&t.url)try{const n=new URL(String(t.url));return n.hostname+n.pathname}catch{return String(t.url).slice(0,60)}return e==="Task"&&t.description?String(t.description):e==="TodoWrite"&&Array.isArray(t.todos)?`${t.todos.length} task${t.todos.length!==1?"s":""}`:e==="NotebookEdit"&&t.notebook_path?String(t.notebook_path).split("/").pop()||"":e==="SendMessage"&&t.recipient?`→ ${String(t.recipient)}`:""}function ll({type:e}){const t="w-3.5 h-3.5 text-cc-primary shrink-0";return e==="terminal"?a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[a.jsx("polyline",{points:"3 11 6 8 3 5"}),a.jsx("line",{x1:"8",y1:"11",x2:"13",y2:"11"})]}):e==="file"||e==="file-plus"||e==="file-edit"?a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[a.jsx("path",{d:"M9 1H4a1 1 0 00-1 1v12a1 1 0 001 1h8a1 1 0 001-1V5L9 1z"}),a.jsx("polyline",{points:"9 1 9 5 13 5"})]}):e==="search"?a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[a.jsx("circle",{cx:"7",cy:"7",r:"4"}),a.jsx("path",{d:"M13 13l-3-3"})]}):e==="globe"?a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[a.jsx("circle",{cx:"8",cy:"8",r:"6"}),a.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"?a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:a.jsx("path",{d:"M14 10a1 1 0 01-1 1H5l-3 3V3a1 1 0 011-1h10a1 1 0 011 1v7z"})}):e==="list"?a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:a.jsx("path",{d:"M3 4h10M3 8h10M3 12h6"})}):e==="agent"?a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[a.jsx("circle",{cx:"8",cy:"5",r:"3"}),a.jsx("path",{d:"M3 14c0-2.8 2.2-5 5-5s5 2.2 5 5",strokeLinecap:"round"})]}):e==="checklist"?a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[a.jsx("path",{d:"M3 4l1.5 1.5L7 3M3 8l1.5 1.5L7 7M3 12l1.5 1.5L7 11",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("path",{d:"M9 4h4M9 8h4M9 12h4"})]}):e==="notebook"?a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[a.jsx("rect",{x:"3",y:"1",width:"10",height:"14",rx:"1"}),a.jsx("path",{d:"M6 1v14M3 5h3M3 9h3M3 13h3"})]}):a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:a.jsx("path",{d:"M10.5 2.5l3 3-8 8H2.5v-3l8-8z"})})}const nN=2e3,Lr=new Map,Ei=new Map,ud=new Map,td=new Map,fs=new Map,Ho=new Map,ec=new Map,dd=new Map;function O5(e){return!!e&&(e.readyState===WebSocket.OPEN||e.readyState===WebSocket.CONNECTING)}function B5(e){const t=X.getState(),n=t.sdkSessions.find(i=>i.sessionId===e);return n?!n.archived:t.currentSessionId===e}function rN(){const e=X.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 tc=typeof document<"u"?document.hidden:!1;typeof document<"u"&&document.addEventListener("visibilitychange",()=>{if(document.hidden){tc=!0;for(const[e,t]of Ei)clearTimeout(t),Ei.delete(e)}else{tc=!1;for(const e of rN()){if(!B5(e))continue;const t=Lr.get(e);if(!O5(t)){if(t){try{t.close()}catch{}Lr.delete(e)}mc(e)}}}});function nd(e){const t=e.startsWith("/"),n=e.split("/"),i=[];for(const l of n)if(!(!l||l===".")){if(l===".."){i.length>0&&i.pop();continue}i.push(l)}return`${t?"/":""}${i.join("/")}`}function iN(e,t){return e.startsWith("/")||!t?nd(e):nd(`${t}/${e}`)}function sN(e,t){if(!t)return!0;const n=nd(t);return e===n||e.startsWith(`${n}/`)}function aN(e){let t=dd.get(e);return t||(t=new Set,dd.set(e,t)),t}function ap(e,t){const n=X.getState(),i=aN(e);for(const l of t){if(l.type!=="tool_use")continue;const{name:c,input:u,id:f}=l;if(f){if(i.has(f))continue;i.add(f)}if(c==="TodoWrite"){const h=u.todos;if(Array.isArray(h)){const p=h.map((g,v)=>({id:String(v+1),subject:g.content||"Task",description:"",activeForm:g.activeForm,status:g.status||"pending"}));n.setTasks(e,p),td.set(e,p.length)}continue}if(c==="TaskCreate"){const h=(td.get(e)||0)+1;td.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(c==="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 lp(e,t){var c,u;const n=X.getState(),i=((c=n.sessions.get(e))==null?void 0:c.cwd)||((u=n.sdkSessions.find(f=>f.sessionId===e))==null?void 0:u.cwd);let l=!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 g=iN(p.file_path,i);sN(g,i)&&(l=!0)}}l&&n.bumpChangedFilesTick(e)}const Do=new Map,lN=/Command running in background with ID:\s*(\S+)\.\s*Output is being written to:\s*(\S+)/;function op(e,t){const n=X.getState();for(const i of t){if(i.type==="tool_use"&&i.name==="Bash"){const l=i.input;if(l.run_in_background===!0){let c=Do.get(e);c||(c=new Map,Do.set(e,c)),c.set(i.id,{command:l.command||"",description:l.description||"",startedAt:Date.now()})}}if(i.type==="tool_result"){const l=i.tool_use_id,c=Do.get(e),u=c==null?void 0:c.get(l);if(c&&u){const h=(typeof i.content=="string"?i.content:Array.isArray(i.content)?i.content.map(p=>"text"in p?p.text:"").join(""):"").match(lN);if(h){const p={taskId:h[1],toolUseId:l,command:u.command,description:u.description,outputFile:h[2],status:"running",startedAt:u.startedAt};n.addProcess(e,p)}c.delete(l),c.size===0&&Do.delete(e)}}}}const Ou=new Map,fd=new Map;function cp(e,t){const n=X.getState();let i=fd.get(e);i||(i=new Set,fd.set(e,i));for(const l of t){if(l.type==="tool_use"&&l.name==="Agent"){if(l.id&&i.has(l.id))continue;const c=l.input;if(c.run_in_background===!0){l.id&&i.add(l.id);let u=Ou.get(e);u||(u=new Map,Ou.set(e,u));const f={toolUseId:l.id,name:c.name||c.description||"Background agent",description:c.description||"",agentType:c.subagent_type||"general-purpose",status:"running",startedAt:Date.now()};u.set(l.id,{name:f.name,description:f.description,agentType:f.agentType,startedAt:f.startedAt}),n.addBackgroundAgent(e,f)}}if(l.type==="tool_result"){const c=l.tool_use_id,u=Ou.get(e),f=u==null?void 0:u.get(c);if(u&&f){const h=typeof l.content=="string"?l.content:Array.isArray(l.content)?l.content.map(g=>"text"in g?g.text:"").join(""):"",p=l.is_error===!0;n.updateBackgroundAgent(e,c,{status:p?"failed":"completed",completedAt:Date.now(),summary:h.length>200?h.slice(0,200)+"...":h}),u.delete(c),u.size===0&&Ou.delete(e)}}}}function ib(e,t,n){typeof Notification>"u"||Notification.permission==="granted"&&new Notification(e,{body:t,tag:n})}function sb(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 oN=0,cN=0;function Yr(){return`msg-${Date.now()}-${++oN}`}function uN(e,t){const n=ec.get(e)||[];n.push(t),ec.set(e,n)}function dN(e,t){const n=ec.get(e);if(!(!(n!=null&&n.length)||t.readyState!==WebSocket.OPEN)){ec.delete(e);for(const i of n)t.send(JSON.stringify(i))}}const wi=new Map;function ab(e,t,n){const i=X.getState(),l=i.messages.get(e)||[],c=Ho.get(e);let u=l.filter(h=>!h.isStreaming||h.id===c),f=-1;if(c&&(f=u.findIndex(h=>h.id===c),f===-1&&Ho.delete(e)),f===-1){const h=`stream-${e}-${Yr()}`;Ho.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}}i.setMessages(e,u)}function Bu(e){Ho.delete(e);const t=X.getState(),n=t.messages.get(e)||[],i=n.filter(l=>!l.isStreaming);i.length!==n.length&&t.setMessages(e,i)}function $5(){return`cmsg-${Date.now()}-${++cN}`}function am(){return $5()}const fN=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"]);function hN(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 P5(e){return`companion:last-seq:${e}`}function lm(e){const t=ud.get(e);if(typeof t=="number")return t;try{const n=localStorage.getItem(P5(e)),i=n?Number(n):0,l=Number.isFinite(i)?Math.max(0,Math.floor(i)):0;return ud.set(e,l),l}catch{return 0}}function lb(e,t){const n=Math.max(0,Math.floor(t));ud.set(e,n);try{localStorage.setItem(P5(e),String(n))}catch{}}function ob(e,t){Ln(e,{type:"session_ack",last_seq:t})}function om(e){return e.map(t=>t.type==="text"?t.text:t.type==="thinking"?t.thinking:"").filter(Boolean).join(`
|
|
61
|
+
`)}function up(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 pN(e,t){const n=e||[],i=t||[];if(n.length===0&&i.length===0)return;const l=new Map;for(const f of i)l.set(up(f),f);const c=[],u=new Set;for(const f of n){const h=up(f);u.has(h)||(u.add(h),c.push(l.get(h)||f))}for(const f of i){const h=up(f);u.has(h)||(u.add(h),c.push(f))}return c}function cb(e,t,n,i,l){return{toolUseId:e,toolName:t,preview:Jo(t,n),startedAt:i,elapsedSeconds:0,isError:!1,parentToolUseId:l||void 0}}function cm(e,t){const n=pN(e.contentBlocks,t.contentBlocks),i=n&&n.length>0?om(n):t.content||e.content;return{...e,...t,content:i,contentBlocks:n,timestamp:e.timestamp??t.timestamp,isStreaming:t.isStreaming}}function mN(e,t){const n=X.getState(),i=n.messages.get(e)||[],l=i.findIndex(u=>u.role==="assistant"&&u.id===t.id);if(l===-1){n.appendMessage(e,t);return}const c=[...i];c[l]=cm(c[l],t),n.setMessages(e,c)}function gN(e,t){var l,c;let n;try{n=JSON.parse(t.data)}catch{console.warn(`[ws] Failed to parse incoming message for session ${e}:`,(c=(l=t.data)==null?void 0:l.substring)==null?void 0:c.call(l,0,120));return}const i=X.getState();i.connectionStatus.get(e)==="connecting"&&i.setConnectionStatus(e,"connected"),U5(e,n)}function U5(e,t,n={}){var u,f,h,p,g,v,y,b;const{processSeq:i=!0,ackSeqMessage:l=!0}=n,c=X.getState();if(i&&typeof t.seq=="number"){const _=lm(e);if(t.seq<=_)return;lb(e,t.seq),l&&ob(e,t.seq)}switch(t.type){case"session_init":{const _=c.sessions.get(e);if(c.addSession(t.session),c.setCliConnected(e,!0),c.setCliReconnecting(e,!1),_||c.setSessionStatus(e,"idle"),!c.sessionNames.has(e)){const S=new Set(c.sessionNames.values()),T=M5(S);c.setSessionName(e,T)}break}case"session_update":{c.updateSession(e,t.session);break}case"assistant":{const _=t.message,S=om(_.content),T={id:_.id,role:"assistant",content:S,contentBlocks:_.content,timestamp:t.timestamp||Date.now(),parentToolUseId:t.parent_tool_use_id,model:_.model,stopReason:_.stop_reason};if(Bu(e),mN(e,T),c.setStreaming(e,null),fs.delete(e),wi.delete(e),(u=_.content)!=null&&u.length)for(const j of _.content)j.type==="tool_result"&&c.clearToolProgress(e,j.tool_use_id);if(c.setSessionStatus(e,"running"),c.streamingStartedAt.has(e)||c.setStreamingStats(e,{startedAt:Date.now()}),(f=_.content)!=null&&f.length)for(const j of _.content){if(j.type==="tool_use"){const R=j.input||{};c.addToolActivity(e,cb(j.id,j.name,R,t.timestamp||Date.now(),t.parent_tool_use_id))}j.type==="tool_result"&&c.updateToolActivity(e,j.tool_use_id,{completedAt:Date.now(),isError:!!j.is_error})}(h=_.content)!=null&&h.length&&(ap(e,_.content),lp(e,_.content),op(e,_.content),cp(e,_.content));break}case"stream_event":{const _=t.event;if(_&&typeof _=="object"){if(_.type==="message_start"&&(fs.delete(e),wi.delete(e),Bu(e),c.streamingStartedAt.has(e)||c.setStreamingStats(e,{startedAt:Date.now(),outputTokens:0})),_.type==="content_block_delta"){const S=_.delta;if((S==null?void 0:S.type)==="text_delta"&&typeof S.text=="string"){const T=wi.get(e)||{thinking:"",text:""};fs.get(e)==="thinking"&&(T.thinking=""),T.text+=S.text,wi.set(e,T),fs.set(e,"text"),c.setStreaming(e,T.text),ab(e,T.text,"text")}if((S==null?void 0:S.type)==="thinking_delta"&&typeof S.thinking=="string"){const T=wi.get(e)||{thinking:"",text:""};T.thinking+=S.thinking,wi.set(e,T),fs.set(e,"thinking"),c.setStreaming(e,T.thinking),ab(e,T.thinking,"thinking")}}if(_.type==="message_delta"){const S=_.usage;S!=null&&S.output_tokens&&c.setStreamingStats(e,{outputTokens:S.output_tokens})}}break}case"result":{dd.delete(e),fd.delete(e);const _=t.data,S={total_cost_usd:_.total_cost_usd,num_turns:_.num_turns};if(typeof _.total_lines_added=="number"&&(S.total_lines_added=_.total_lines_added),typeof _.total_lines_removed=="number"&&(S.total_lines_removed=_.total_lines_removed),_.modelUsage){for(const T of Object.values(_.modelUsage))if(T.contextWindow>0){const j=Math.round((T.inputTokens+T.outputTokens)/T.contextWindow*100);S.context_used_percent=Math.max(0,Math.min(j,100))}}c.updateSession(e,S),Bu(e),c.setStreaming(e,null),fs.delete(e),wi.delete(e),c.setStreamingStats(e,null),c.clearToolProgress(e),c.setSessionStatus(e,"idle"),!document.hasFocus()&&c.notificationSound&&Sj(),!document.hasFocus()&&c.notificationDesktop&&ib("Session completed","Claude finished the task",e),_.is_error&&((p=_.errors)!=null&&p.length)&&c.appendMessage(e,{id:Yr(),role:"system",content:`Error: ${_.errors.join(", ")}`,timestamp:Date.now()});break}case"permission_request":{if(c.addPermission(e,t.request),!document.hasFocus()&&c.notificationDesktop){const S=t.request;ib("Permission needed",`${S.tool_name}: approve or deny`,S.request_id)}const _=t.request;if(_.tool_name&&_.input){const S=[{type:"tool_use",id:_.tool_use_id,name:_.tool_name,input:_.input}];ap(e,S),lp(e,S),op(e,S),cp(e,S)}break}case"permission_cancelled":{c.removePermission(e,t.request_id);break}case"permission_auto_resolved":{c.addAiResolvedPermission(e,{request:t.request,behavior:t.behavior,reason:t.reason,timestamp:Date.now()});break}case"tool_progress":{c.setToolProgress(e,t.tool_use_id,{toolName:t.tool_name,elapsedSeconds:t.elapsed_time_seconds}),c.updateToolActivity(e,t.tool_use_id,{elapsedSeconds:t.elapsed_time_seconds});break}case"tool_use_summary":{((g=c.sdkSessions.find(S=>S.sessionId===e))==null?void 0:g.backendType)==="codex"&&c.appendMessage(e,{id:Yr(),role:"system",content:t.summary,timestamp:Date.now()});break}case"user_message":{c.appendMessage(e,{id:t.id||Yr(),role:"user",content:t.content,timestamp:t.timestamp||Date.now()}),c.clearPromptSuggestions(e);break}case"system_event":{if(((v=t.event)==null?void 0:v.subtype)==="task_notification"){const{task_id:S,status:T,summary:j}=t.event;S&&T&&c.updateProcess(e,S,{status:T,completedAt:Date.now(),summary:j||void 0})}const _=sb(t.event);if(!_)break;c.appendMessage(e,{id:Yr(),role:"system",content:_,timestamp:t.timestamp||Date.now()});break}case"status_change":{t.status==="compacting"?c.setSessionStatus(e,"compacting"):c.setSessionStatus(e,t.status);break}case"auth_status":{t.error&&c.appendMessage(e,{id:Yr(),role:"system",content:`Auth error: ${t.error}`,timestamp:Date.now()});break}case"error":{c.appendMessage(e,{id:Yr(),role:"system",content:t.message,timestamp:Date.now()});break}case"session_phase":{const _=t.phase;_==="terminated"?(c.setCliConnected(e,!1),c.setCliReconnecting(e,!1),c.setSessionStatus(e,null)):_==="reconnecting"?(c.setCliConnected(e,!1),c.setCliReconnecting(e,!0),c.setSessionStatus(e,null)):_==="starting"||_==="initializing"?(c.setCliConnected(e,!1),c.setCliReconnecting(e,!0)):(c.setCliConnected(e,!0),c.setCliReconnecting(e,!1),_==="ready"?c.setSessionStatus(e,"idle"):_==="streaming"?c.setSessionStatus(e,"running"):_==="compacting"?c.setSessionStatus(e,"compacting"):_==="awaiting_permission"&&c.setSessionStatus(e,"running"));break}case"cli_disconnected":{c.setCliConnected(e,!1),c.setCliReconnecting(e,!1),c.setSessionStatus(e,null);break}case"cli_connected":{c.setCliConnected(e,!0),c.setCliReconnecting(e,!1);break}case"session_name_update":{const _=c.sessionNames.get(e),S=_&&/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(_);(!_||S)&&(c.setSessionName(e,t.name),c.markRecentlyRenamed(e));break}case"pr_status_update":{c.setPRStatus(e,{available:t.available,pr:t.pr});break}case"mcp_status":{c.setMcpServers(e,t.servers);break}case"message_history":{const _=[],S=new Map;for(let j=0;j<t.messages.length;j++){const R=t.messages[j];if(R.type==="user_message")_.push({id:R.id||Yr(),role:"user",content:R.content,timestamp:R.timestamp});else if(R.type==="assistant"){const C=R.message,P=om(C.content),z={id:C.id,role:"assistant",content:P,contentBlocks:C.content,timestamp:R.timestamp||Date.now(),parentToolUseId:R.parent_tool_use_id,model:C.model,stopReason:C.stop_reason},D=_.findIndex(F=>F.role==="assistant"&&F.id===z.id);if(D===-1?_.push(z):_[D]=cm(_[D],z),(y=C.content)!=null&&y.length){ap(e,C.content),lp(e,C.content),op(e,C.content),cp(e,C.content);const F=R.timestamp||Date.now();for(const B of C.content){if(B.type==="tool_use"){const I=B.input||{},L=S.get(B.id);S.set(B.id,L??cb(B.id,B.name,I,F,R.parent_tool_use_id))}if(B.type==="tool_result"){const I=S.get(B.tool_use_id);I&&S.set(B.tool_use_id,{...I,completedAt:F,isError:I.isError||!!B.is_error,elapsedSeconds:Math.max(I.elapsedSeconds,I.completedAt?I.elapsedSeconds:Math.max(0,(F-I.startedAt)/1e3))})}}}}else if(R.type==="result"){const C=R.data;C.is_error&&((b=C.errors)!=null&&b.length)&&_.push({id:`hist-error-${j}`,role:"system",content:`Error: ${C.errors.join(", ")}`,timestamp:Date.now()});const P={total_cost_usd:C.total_cost_usd,num_turns:C.num_turns};if(typeof C.total_lines_added=="number"&&(P.total_lines_added=C.total_lines_added),typeof C.total_lines_removed=="number"&&(P.total_lines_removed=C.total_lines_removed),C.modelUsage){for(const z of Object.values(C.modelUsage))if(z.contextWindow>0){const D=z,F=Math.round((D.inputTokens+D.outputTokens)/D.contextWindow*100);P.context_used_percent=Math.max(0,Math.min(F,100))}}c.updateSession(e,P)}else if(R.type==="system_event"){const C=sb(R.event);if(!C)continue;_.push({id:`hist-system-event-${j}`,role:"system",content:C,timestamp:R.timestamp||Date.now()})}}if(_.length>0){const j=c.messages.get(e)||[];if(j.length===0)c.setMessages(e,_);else{const R=[...j];for(const C of _){const P=R.findIndex(D=>D.id===C.id);if(P===-1){R.push(C);continue}const z=R[P];z.role==="assistant"&&C.role==="assistant"?R[P]=cm(z,C):R[P]=C}R.sort((C,P)=>(C.timestamp??0)-(P.timestamp??0)),c.setMessages(e,R)}}c.setToolActivity(e,Array.from(S.values()).sort((j,R)=>j.startedAt-R.startedAt));const T=t.messages[t.messages.length-1];(T==null?void 0:T.type)==="result"&&(Bu(e),c.setStreaming(e,null),fs.delete(e),wi.delete(e),c.setStreamingStats(e,null),c.clearToolProgress(e),c.setSessionStatus(e,"idle"));break}case"event_replay":{let _;for(const S of t.events){const T=lm(e);S.seq<=T||(lb(e,S.seq),_=S.seq,U5(e,S.message,{processSeq:!1,ackSeqMessage:!1}))}typeof _=="number"&&ob(e,_);break}case"prompt_suggestion":{const _=t.suggestions;c.setPromptSuggestions(e,_);break}case"streamlined_text":{c.appendMessage(e,{id:Yr(),role:"assistant",content:t.text,timestamp:Date.now()});break}case"streamlined_tool_use_summary":{c.appendMessage(e,{id:Yr(),role:"system",content:t.tool_summary,timestamp:Date.now()});break}default:{console.debug("[ws] Unhandled message type:",t.type);break}}}function mc(e){const t=Lr.get(e);if(O5(t))return;if(t){try{t.close()}catch{}Lr.delete(e)}X.getState().setConnectionStatus(e,"connecting");const i=new WebSocket(hN(e));Lr.set(e,i),i.onopen=()=>{const l=lm(e);i.send(JSON.stringify({type:"session_subscribe",last_seq:l})),dN(e,i);const c=Ei.get(e);c&&(clearTimeout(c),Ei.delete(e))},i.onmessage=l=>gN(e,l),i.onclose=()=>{Lr.get(e)===i&&(Lr.delete(e),X.getState().setConnectionStatus(e,"disconnected"),xN(e))},i.onerror=()=>{i.close()}}function xN(e){if(Ei.has(e)||tc)return;const t=setTimeout(()=>{Ei.delete(e),!tc&&B5(e)&&mc(e)},nN);Ei.set(e,t)}function um(e){const t=Ei.get(e);t&&(clearTimeout(t),Ei.delete(e));const n=Lr.get(e);n&&(n.close(),Lr.delete(e)),X.getState().setConnectionStatus(e,"disconnected"),dd.delete(e),fd.delete(e),Do.delete(e),td.delete(e),fs.delete(e),Ho.delete(e),wi.delete(e),ud.delete(e),ec.delete(e)}function vN(e){if(!tc)for(const t of e)t.archived||mc(t.sessionId)}function bN(e){return new Promise((t,n)=>{const i=setInterval(()=>{const c=Lr.get(e);(c==null?void 0:c.readyState)===WebSocket.OPEN&&(clearInterval(i),clearTimeout(l),t())},50),l=setTimeout(()=>{clearInterval(i),n(new Error("Connection timeout"))},1e4)})}function Ln(e,t){const n=Lr.get(e);let i=t;const l=fN.has(t.type);if(l)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":t.client_msg_id||(i={...t,client_msg_id:$5()});break}if((n==null?void 0:n.readyState)===WebSocket.OPEN){n.send(JSON.stringify(i));return}l&&uN(e,i)}function ub(e){Ln(e,{type:"mcp_get_status"})}function yN(e,t,n){Ln(e,{type:"mcp_toggle",serverName:t,enabled:n})}function _N(e,t){Ln(e,{type:"mcp_reconnect",serverName:t})}function wN(e,t){Ln(e,{type:"mcp_set_servers",servers:t})}function kN(e,t){Ln(e,{type:"set_ai_validation",...t})}var ie=typeof window<"u"?window:void 0,hn=typeof globalThis<"u"?globalThis:ie;typeof self>"u"&&(hn.self=hn),typeof File>"u"&&(hn.File=function(){});var ar=hn==null?void 0:hn.navigator,Ce=hn==null?void 0:hn.document,jn=hn==null?void 0:hn.location,dm=hn==null?void 0:hn.fetch,fm=hn!=null&&hn.XMLHttpRequest&&"withCredentials"in new hn.XMLHttpRequest?hn.XMLHttpRequest:void 0,db=hn==null?void 0:hn.AbortController,SN=hn==null?void 0:hn.CompressionStream,Yn=ar==null?void 0:ar.userAgent,Le=ie??{},fb="1.384.1",xn={DEBUG:!1,LIB_VERSION:fb,LIB_NAME:"web",JS_SDK_VERSION:fb};function hb(e,t,n,i,l,c,u){try{var f=e[c](u),h=f.value}catch(p){return void n(p)}f.done?t(h):Promise.resolve(h).then(i,l)}function sr(e){return function(){var t=this,n=arguments;return new Promise((function(i,l){var c=e.apply(t,n);function u(h){hb(c,i,l,u,f,"next",h)}function f(h){hb(c,i,l,u,f,"throw",h)}u(void 0)}))}}function ye(){return ye=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},ye.apply(null,arguments)}function F5(e,t){if(e==null)return{};var n={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(t.indexOf(i)!==-1)continue;n[i]=e[i]}return n}var bo,pb=(function(e){return e.GZipJS="gzip-js",e.Base64="base64",e})({}),jN=["$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"],H5="NativeGzipValidationError",hm=e=>e.length>=2&&e[0]===31&&e[1]===139,mb=e=>!(!e||typeof e!="object")&&("name"in e?String(e.name):"")==="NotReadableError",$u=e=>{var t=new Error("Native gzip produced invalid output: "+e);throw t.name=H5,t},NN=(function(){var e=sr((function*(t,n){18>t.size&&$u("too-short");var i=new Uint8Array(yield t.slice(0,10).arrayBuffer());hm(i)&&i[2]===8||$u("invalid-header");var l=new DataView(yield t.slice(t.size-8).arrayBuffer());l.getUint32(0,!0)!==(u=>{for(var f=(()=>{if(bo)return bo;bo=[];for(var g=0;256>g;g++){for(var v=g,y=0;8>y;y++)v=1&v?3988292384^v>>>1:v>>>1;bo[g]=v>>>0}return bo})(),h=4294967295,p=0;u.length>p;p++)h=f[255&(h^u[p])]^h>>>8;return(4294967295^h)>>>0})(n)&&$u("invalid-crc");var c=n.length>>>0;l.getUint32(4,!0)!==c&&$u("invalid-size")}));return function(t,n){return e.apply(this,arguments)}})();function pm(){return pm=sr((function*(e,t,n){t===void 0&&(t=!0);try{var i=new TextEncoder().encode(e),l=new CompressionStream("gzip"),c=l.writable.getWriter(),u=c.write(i).then((()=>c.close())).catch((function(){var p=sr((function*(g){try{yield c.abort(g)}catch{}throw g}));return function(g){return p.apply(this,arguments)}})()),f=new Response(l.readable).blob(),[h]=yield Promise.all([f,u]);return yield NN(h,i),h}catch(p){if(n!=null&&n.rethrow)throw p;return t&&console.error("Failed to gzip compress data",p),null}})),pm.apply(this,arguments)}var CN=["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"],gb=function(e,t){if(t===void 0&&(t=[]),!e)return!1;var n=e.toLowerCase();return CN.concat(t).some((i=>{var l=i.toLowerCase();return n.indexOf(l)!==-1}))};function Ie(e,t){return e.indexOf(t)!==-1}var Ud=function(e){return e.trim()},mm=function(e){return e.replace(/^\$/,"")},q5=Object.prototype,I5=q5.hasOwnProperty,Fd=q5.toString,nt=Array.isArray||function(e){return Fd.call(e)==="[object Array]"},ji=e=>typeof e=="function",Yt=e=>e===Object(e)&&!nt(e),ps=e=>{if(Yt(e)){for(var t in e)if(I5.call(e,t))return!1;return!0}return!1},Se=e=>e===void 0,It=e=>Fd.call(e)=="[object String]",gm=e=>It(e)&&e.trim().length===0,or=e=>e===null,rt=e=>Se(e)||or(e),Bn=e=>Fd.call(e)=="[object Number]"&&e==e,ki=e=>Bn(e)&&e>0,Zr=e=>Fd.call(e)==="[object Boolean]",EN=e=>e instanceof FormData,TN=e=>Ie(jN,e);function V5(e){return e===null||typeof e!="object"}function hd(e,t){return{}.toString.call(e)==="[object "+t+"]"}function mg(e){return typeof Event<"u"&&(function(t,n){try{return t instanceof n}catch{return!1}})(e,Event)}var AN=[!0,"true",1,"1","yes"],dp=e=>Ie(AN,e),MN=[!1,"false",0,"0","no"];function Kr(e,t,n,i,l){return t>n&&(i.warn("min cannot be greater than max."),t=n),Bn(e)?e>n?(i.warn(" cannot be greater than max: "+n+". Using max value instead."),n):t>e?(i.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(i.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+l),Kr(l||n,t,n,i))}class RN{constructor(t){this.$t={},this.zt=t.zt,this.Zt=Kr(t.bucketSize,0,100,t.Gt),this.Qt=Kr(t.refillRate,0,this.Zt,t.Gt),this.Jt=Kr(t.refillInterval,0,864e5,t.Gt)}Kt(t,n){var i=Math.floor((n-t.lastAccess)/this.Jt);i>0&&(t.tokens=Math.min(t.tokens+i*this.Qt,this.Zt),t.lastAccess=t.lastAccess+i*this.Jt)}consumeRateLimit(t){var n,i=Date.now(),l=String(t),c=this.$t[l];return c?this.Kt(c,i):this.$t[l]=c={tokens:this.Zt,lastAccess:i},c.tokens===0||(c.tokens--,c.tokens===0&&((n=this.zt)==null||n.call(this,t)),c.tokens===0)}stop(){this.$t={}}}var Pu,xb,fp,cr="Mobile",pd="iOS",Ci="Android",ol="Tablet",G5=Ci+" "+ol,Y5="iPad",W5="Apple",X5=W5+" Watch",qo="Safari",cl="BlackBerry",Q5="Samsung",K5=Q5+"Browser",Z5=Q5+" Internet",ta="Chrome",DN=ta+" OS",J5=ta+" "+pd,gg="Internet Explorer",e_=gg+" "+cr,xg="Opera",zN=xg+" Mini",vg="Edge",t_="Microsoft "+vg,sl="Firefox",n_=sl+" "+pd,nc="Nintendo",rc="PlayStation",al="Xbox",r_=Ci+" "+cr,i_=cr+" "+qo,zo="Windows",xm=zo+" Phone",vb="Nokia",vm="Ouya",s_="Generic",LN=s_+" "+cr.toLowerCase(),a_=s_+" "+ol.toLowerCase(),bm="Konqueror",l_="Oculus Browser",md="Vivaldi",o_="Yandex",gd="Whale",ym="DuckDuckGo",c_="Pale Moon",xd="Waterfox",Io="Brave",u_="Google Search App",qt="(\\d+(\\.\\d+)?)",hp=new RegExp("Version/"+qt),ON=new RegExp(al,"i"),BN=new RegExp(rc+" \\w+","i"),$N=new RegExp(nc+" \\w+","i"),bg=new RegExp(cl+"|PlayBook|BB10","i"),PN={"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"},d_=function(e,t,n,i){t=t||"";var l=(function(c){return c!=null&&c.brave?Io:null})(n);return l||(i!=null&&i.detectGoogleSearchApp&&Ie(e,"GSA/")?u_:Ie(e," OPR/")&&Ie(e,"Mini")?zN:Ie(e," OPR/")?xg:bg.test(e)?cl:Ie(e,"IE"+cr)||Ie(e,"WPDesktop")?e_:Ie(e,"OculusBrowser")?l_:Ie(e,K5)?Z5:Ie(e,vg)||Ie(e,"Edg/")?t_:Ie(e,md+"/")?md:Ie(e,"YaBrowser/")?o_:Ie(e,gd+"/")?gd:Ie(e,ym+"/")||Ie(e,"Ddg/")?ym:Ie(e,"FBIOS")?"Facebook "+cr:Ie(e,"UCWEB")||Ie(e,"UCBrowser")?"UC Browser":Ie(e,"CriOS")?J5:Ie(e,"CrMo")||Ie(e,ta)?ta:Ie(e,Ci)&&Ie(e,qo)?r_:Ie(e,"FxiOS")?n_:Ie(e.toLowerCase(),bm.toLowerCase())?bm:Ie(e,Io+"/")?Io:((c,u)=>u&&Ie(u,W5)||(function(f){return Ie(f,qo)&&!Ie(f,ta)&&!Ie(f,Ci)})(c))(e,t)?Ie(e,cr)?i_:qo:Ie(e,"PaleMoon/")?c_:Ie(e,xd+"/")?xd:Ie(e,sl)?sl:Ie(e,"MSIE")||Ie(e,"Trident/")?gg:Ie(e,"Gecko")?sl:"")},UN={[e_]:[new RegExp("rv:"+qt)],[t_]:[new RegExp(vg+"?\\/"+qt)],[ta]:[new RegExp("("+ta+"|CrMo)\\/"+qt)],[J5]:[new RegExp("CriOS\\/"+qt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+qt)],[qo]:[hp],[i_]:[hp],[xg]:[new RegExp("(Opera|OPR)\\/"+qt)],[sl]:[new RegExp(sl+"\\/"+qt)],[n_]:[new RegExp("FxiOS\\/"+qt)],[bm]:[new RegExp("Konqueror[:/]?"+qt,"i")],[cl]:[new RegExp(cl+" "+qt),hp],[r_]:[new RegExp("android\\s"+qt,"i")],[Z5]:[new RegExp(K5+"\\/"+qt)],[l_]:[new RegExp("OculusBrowser\\/"+qt)],[md]:[new RegExp(md+"\\/"+qt)],[o_]:[new RegExp("YaBrowser\\/"+qt)],[gd]:[new RegExp(gd+"\\/"+qt)],[Io]:[new RegExp(Io+"\\/"+qt)],[ym]:[new RegExp("(DuckDuckGo|Ddg)\\/"+qt)],[c_]:[new RegExp("PaleMoon\\/"+qt)],[xd]:[new RegExp(xd+"\\/"+qt)],[u_]:[new RegExp("GSA\\/"+qt)],[gg]:[new RegExp("(rv:|MSIE )"+qt)],Mozilla:[new RegExp("rv:"+qt)]},FN=function(e,t,n,i){var l=d_(e,t,n,i),c=UN[l];if(Se(c))return null;for(var u=0;c.length>u;u++){var f=e.match(c[u]);if(f)return parseFloat(f[f.length-2])}return null},bb=[[new RegExp(al+"; "+al+" (.*?)[);]","i"),e=>[al,e&&e[1]||""]],[new RegExp(nc,"i"),[nc,""]],[new RegExp(rc,"i"),[rc,""]],[bg,[cl,""]],[new RegExp(zo,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[xm,""];if(new RegExp(cr).test(t)&&!/IEMobile\b/.test(t))return[zo+" "+cr,""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var i=PN[n[1]]||"";return/arm/i.test(t)&&(i="RT"),[zo,i]}return[zo,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[pd,[e[3],e[4],e[5]||"0"].join(".")]:[pd,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=Se(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+Ci+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Ci+")","i"),e=>e&&e[2]?[Ci,[e[2],e[3],e[4]||"0"].join(".")]:[Ci,""]],[/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/,[DN,""]],[/Linux|debian/i,["Linux",""]]],yb=function(e){return $N.test(e)?nc:BN.test(e)?rc:ON.test(e)?al:new RegExp(vm,"i").test(e)?vm:new RegExp("("+xm+"|WPDesktop)","i").test(e)?xm:/iPad/.test(e)?Y5:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?X5:bg.test(e)?cl:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(vb,"i").test(e)?vb:/(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(cr).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)?Ci:G5:new RegExp("(pda|"+cr+")","i").test(e)?LN:new RegExp(ol,"i").test(e)&&!new RegExp(ol+" pc","i").test(e)?a_:""},HN=e=>e instanceof Error,f_={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}},qN=f_.info;function h_(e){if(Zr(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(nt(e))return{arrayValue:{values:e.map((t=>h_(t)))}};try{return{stringValue:JSON.stringify(e)}}catch{return{stringValue:String(e)}}}function _b(e){var t=[];for(var n in e){var i=e[n];or(i)||Se(i)||t.push({key:n,value:h_(i)})}return t}function IN(e){var t=globalThis._posthogChunkIds;if(t){var n=Object.keys(t);return fp&&n.length===xb||(xb=n.length,fp=n.reduce(((i,l)=>{Pu||(Pu={});var c=Pu[l];if(c)i[c[0]]=c[1];else for(var u=e(l),f=u.length-1;f>=0;f--){var h=u[f],p=h==null?void 0:h.filename,g=t[l];if(p&&g){i[p]=g,Pu[l]=[p,g];break}}return i}),{})),fp}}class VN{constructor(t,n,i){i===void 0&&(i=[]),this.coercers=t,this.stackParser=n,this.modifiers=i}buildFromUnknown(t,n){n===void 0&&(n={});var i=n&&n.mechanism||{handled:!0,type:"generic"},l=this.buildCoercingContext(i,n,0).apply(t),c=this.buildParsingContext(n),u=this.parseStacktrace(l,c);return{$exception_list:this.convertToExceptionList(u,i),$exception_level:"error"}}modifyFrames(t){var n=this;return sr((function*(){for(var i of t)i.stacktrace&&i.stacktrace.frames&&nt(i.stacktrace.frames)&&(i.stacktrace.frames=yield n.applyModifiers(i.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 i,l;return t.cause!=null&&(i=this.parseStacktrace(t.cause,n)),t.stack!=""&&t.stack!=null&&(l=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?n.skipFirstLines:0),n.chunkIdMap)),ye({},t,{cause:i,stack:l})}applyChunkIds(t,n){return t.map((i=>(i.filename&&n&&(i.chunk_id=n[i.filename]),i)))}applyCoercers(t,n){for(var i of this.coercers)if(i.match(t))return i.coerce(t,n);return this.coerceFallback(n)}applyModifiers(t){var n=this;return sr((function*(){var i=t;for(var l of n.modifiers)i=yield l(i);return i}))()}convertToExceptionList(t,n){var i,l,c,u={type:t.type,value:t.value,mechanism:{type:(i=n.type)!==null&&i!==void 0?i:"generic",handled:(l=n.handled)===null||l===void 0||l,synthetic:(c=t.synthetic)!==null&&c!==void 0&&c}};t.stack&&(u.stacktrace={type:"raw",frames:t.stack});var f=[u];return t.cause!=null&&f.push(...this.convertToExceptionList(t.cause,ye({},n,{handled:!0}))),f}buildParsingContext(t){var n;return{chunkIdMap:IN(this.stackParser),skipFirstLines:(n=t.skipFirstLines)!==null&&n!==void 0?n:1}}buildCoercingContext(t,n,i){i===void 0&&(i=0);var l=(c,u)=>{if(4>=u){var f=this.buildCoercingContext(t,n,u);return this.applyCoercers(c,f)}};return ye({},n,{syntheticException:i==0?n.syntheticException:void 0,mechanism:t,apply:c=>l(c,i),next:c=>l(c,i+1)})}}var ul="?";function _m(e,t,n,i,l){var c={platform:e,filename:t,function:n==="<anonymous>"?ul:n,in_app:!0};return Se(i)||(c.lineno=i),Se(l)||(c.colno=l),c}var p_=(e,t)=>{var n=e.indexOf("safari-extension")!==-1,i=e.indexOf("safari-web-extension")!==-1;return n||i?[e.indexOf("@")!==-1?e.split("@")[0]:ul,n?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},GN=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,YN=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,WN=/\((\S*)(?::(\d+))(?::(\d+))\)/,XN=(e,t)=>{var n=GN.exec(e);if(n){var[,i,l,c]=n;return _m(t,i,ul,+l,+c)}var u=YN.exec(e);if(u){if(u[2]&&u[2].indexOf("eval")===0){var f=WN.exec(u[2]);f&&(u[2]=f[1],u[3]=f[2],u[4]=f[3])}var[h,p]=p_(u[1]||ul,u[2]);return _m(t,p,h,u[3]?+u[3]:void 0,u[4]?+u[4]:void 0)}},QN=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,KN=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,ZN=(e,t)=>{var n=QN.exec(e);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){var i=KN.exec(n[3]);i&&(n[1]=n[1]||"eval",n[3]=i[1],n[4]=i[2],n[5]="")}var l=n[3],c=n[1]||ul;return[c,l]=p_(c,l),_m(t,l,c,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},wb=/\(error: (.*)\)/;class JN{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,n){var i=It(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:i?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 hd(t,"DOMException")}isDOMError(t){return hd(t,"DOMError")}}class e3{match(t){return(n=>n instanceof Error)(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 i=t.message;return String(i.error&&typeof i.error.message=="string"?i.error.message:i)}getStack(t){return t.stacktrace||t.stack||void 0}}class t3{constructor(){}match(t){return hd(t,"ErrorEvent")&&t.error!=null}coerce(t,n){var i;return n.apply(t.error)||{type:"ErrorEvent",value:t.message,stack:(i=n.syntheticException)==null?void 0:i.stack,synthetic:!0}}}var n3=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class r3{match(t){return typeof t=="string"}coerce(t,n){var i,[l,c]=this.getInfos(t);return{type:l??"Error",value:c??t,stack:(i=n.syntheticException)==null?void 0:i.stack,synthetic:!0}}getInfos(t){var n="Error",i=t,l=t.match(n3);return l&&(n=l[1],i=l[2]),[n,i]}}var i3=["fatal","error","warning","log","info","debug"];function m_(e,t){t===void 0&&(t=40);var n=Object.keys(e);if(n.sort(),!n.length)return"[object has no keys]";for(var i=n.length;i>0;i--){var l=n.slice(0,i).join(", ");if(t>=l.length)return i===n.length?l:l.length>t?l.slice(0,t)+"...":l}return""}class s3{match(t){return typeof t=="object"&&t!==null}coerce(t,n){var i,l=this.getErrorPropertyFromObject(t);return l?n.apply(l):{type:this.getType(t),value:this.getValue(t),stack:(i=n.syntheticException)==null?void 0:i.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return mg(t)?t.constructor.name:"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 i=this.getObjectClassName(t);return(i&&i!=="Object"?"'"+i+"'":"Object")+" captured as exception with keys: "+m_(t)}isSeverityLevel(t){return It(t)&&!gm(t)&&i3.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var n in t)if({}.hasOwnProperty.call(t,n)){var i=t[n];if(HN(i))return i}}getObjectClassName(t){try{var n=Object.getPrototypeOf(t);return n?n.constructor.name:void 0}catch{return}}}class a3{match(t){return mg(t)}coerce(t,n){var i,l=t.constructor.name;return{type:l,value:l+" captured as exception with keys: "+m_(t),stack:(i=n.syntheticException)==null?void 0:i.stack,synthetic:!0}}}class l3{match(t){return V5(t)}coerce(t,n){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:(i=n.syntheticException)==null?void 0:i.stack,synthetic:!0}}}class o3{match(t){return hd(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!mg(t))return!1;try{var n=t.detail;return n!=null&&typeof n=="object"&&"reason"in n}catch{return!1}}coerce(t,n){var i,l=this.getUnhandledRejectionReason(t);return V5(l)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(l),stack:(i=n.syntheticException)==null?void 0:i.stack,synthetic:!0}:n.apply(l)}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 vd="$message",bd="$timestamp",c3=new Set([vd,bd]),pp={enabled:!0,max_bytes:32768};function yd(e){var t;return e?{enabled:(t=e.enabled)!==null&&t!==void 0?t:pp.enabled,max_bytes:d3(e.max_bytes,pp.max_bytes)}:ye({},pp)}class u3{constructor(t){this.Yt=[],this.Xt=0,this.qt=yd(t)}setConfig(t){this.qt=yd(t),this.er()}add(t){var n=(function(l){var c=(function(g){var v=new WeakSet;try{return JSON.stringify(g,((y,b)=>{if(typeof b=="bigint")return b.toString();if(typeof b!="function"&&typeof b!="symbol"){if(b instanceof Date)return b.toISOString();if(b instanceof Error)return{name:b.name,message:b.message,stack:b.stack};if(b&&typeof b=="object"){if(v.has(b))return"[Circular]";v.add(b)}return b}}))}catch{return}})(l);if(c)try{var u=JSON.parse(c);if(!Yt(u))return;var f=u,h=f[vd],p=f[bd];return!It(h)||h.trim().length===0||!It(p)&&!Bn(p)?void 0:{step:f,json:c}}catch{return}})(t);if(n){var i=(function(l){if(typeof TextEncoder<"u")return new TextEncoder().encode(l).length;for(var c=encodeURIComponent(l),u=0,f=0;c.length>f;f++)c[f]==="%"?(u+=1,f+=2):u+=1;return u})(n.json);i>this.qt.max_bytes||(this.Yt.push({step:n.step,bytes:i}),this.Xt+=i,this.er())}}getAttachable(){return this.Yt.map((t=>t.step))}clear(){this.Yt=[],this.Xt=0}size(){return this.Yt.length}er(){for(;this.Xt>this.qt.max_bytes&&this.Yt.length>0;){var t=this.Yt.shift();t&&(this.Xt-=t.bytes)}}}function d3(e,t){if(!Bn(e)||e===1/0||e===-1/0)return t;var n=Math.floor(e);return 0>n?t:n}var g_=function(e,t){var{debugEnabled:n}=t===void 0?{}:t,i={k(l){if(ie&&(xn.DEBUG||Le.POSTHOG_DEBUG||n)&&!Se(ie.console)&&ie.console){for(var c=("__rrweb_original__"in ie.console[l])?ie.console[l].__rrweb_original__:ie.console[l],u=arguments.length,f=new Array(u>1?u-1:0),h=1;u>h;h++)f[h-1]=arguments[h];c(e,...f)}},debug(){for(var l=arguments.length,c=new Array(l),u=0;l>u;u++)c[u]=arguments[u];i.k("debug",...c)},info(){for(var l=arguments.length,c=new Array(l),u=0;l>u;u++)c[u]=arguments[u];i.k("log",...c)},warn(){for(var l=arguments.length,c=new Array(l),u=0;l>u;u++)c[u]=arguments[u];i.k("warn",...c)},error(){for(var l=arguments.length,c=new Array(l),u=0;l>u;u++)c[u]=arguments[u];i.k("error",...c)},critical(){for(var l=arguments.length,c=new Array(l),u=0;l>u;u++)c[u]=arguments[u];console.error(e,...c)},uninitializedWarning(l){i.error("You must initialize PostHog before calling "+l)},createLogger:(l,c)=>g_(e+" "+l,c)};return i},Ne=g_("[PostHog.js]"),Vt=Ne.createLogger,f3=Vt("[ExternalScriptsLoader]"),mp=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return f3.warn(t+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var i=Ce==null?void 0:Ce.querySelectorAll("script");if(i){for(var l,c=function(){if(i[u].src===t){var h=i[u];return h.__posthog_loading_callback_fired?{v:n()}:(h.addEventListener("load",(p=>{h.__posthog_loading_callback_fired=!0,n(void 0,p)})),h.onerror=p=>n(p),{v:void 0})}},u=0;i.length>u;u++)if(l=c())return l.v}var f=()=>{if(!Ce)return n("document not found");var h=Ce.createElement("script");if(h.type="text/javascript",h.crossOrigin="anonymous",h.src=t,h.onload=v=>{h.__posthog_loading_callback_fired=!0,n(void 0,v)},h.onerror=v=>n(v),e.config.prepare_external_dependency_script&&(h=e.config.prepare_external_dependency_script(h)),!h)return n("prepare_external_dependency_script returned null");if(e.config.external_scripts_inject_target==="head")Ce.head.appendChild(h);else{var p,g=Ce.querySelectorAll("body > script");g.length>0?(p=g[0].parentNode)==null||p.insertBefore(h,g[0]):Ce.body.appendChild(h)}};Ce!=null&&Ce.body?f():Ce==null||Ce.addEventListener("DOMContentLoaded",f)};Le.__PosthogExtensions__=Le.__PosthogExtensions__||{},Le.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{if(t!=="remote-config"){var i;if(e.config.__preview_external_dependency_versioned_paths)i=e.requestRouter.endpointFor("assets","/static/"+e.version+"/"+t+".js");else{var l="/static/"+t+".js?v="+e.version;if(t==="toolbar"){var c=3e5;l=l+"&t="+Math.floor(Date.now()/c)*c}i=e.requestRouter.endpointFor("assets",l)}mp(e,i,n)}else{var u=e.requestRouter.endpointFor("assets","/array/"+e.config.token+"/config.js");mp(e,u,n)}},Le.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{var i=e.requestRouter.endpointFor("api",t);mp(e,i,n)};var x_="$people_distinct_id",_d="$device_id",Lo="__alias",Oo="__timers",wm="$autocapture_disabled_server_side",km="$heatmaps_enabled_server_side",Sm="$exception_capture_enabled_server_side",jm="$error_tracking_suppression_rules",Nm="$error_tracking_capture_extension_exceptions",Cm="$web_vitals_enabled_server_side",yg="$dead_clicks_enabled_server_side",Em="$product_tours_enabled_server_side",Tm="$web_vitals_allowed_metrics",ea="$session_recording_remote_config",v_="$replay_override_sampling",b_="$replay_override_linked_flag",y_="$replay_override_url_trigger",__="$replay_override_event_trigger",nl="$sesid",_g="$session_is_sampled",rl="$enabled_feature_flags",rd="$active_feature_flags",Bo="$early_access_features",Am="$feature_flag_details",Mm="$feature_flag_payloads",Rm="$feature_flag_request_id",Si="$override_feature_flags",Za="$override_feature_flag_payloads",$o="$stored_person_properties",Zs="$stored_group_properties",Dm="$surveys",wg="$surveys_loaded_at",zm="$surveys_activated",id="ph_product_tours",Vo="$flag_call_reported",Lm="$flag_call_reported_session_id",Om="$feature_flag_errors",ic="$feature_flag_evaluated_at",zr="$user_state",Bm="$client_session_props",$m="$capture_rate_limit",Pm="$initial_campaign_params",Um="$initial_referrer_info",wd="$initial_person_info",kd="$epp",w_="__POSTHOG_TOOLBAR__",Uu="$posthog_cookieless",k_="$sdk_debug_extensions_init_method",S_="$sdk_debug_extensions_init_time_ms",j_="$sdk_debug_recording_script_not_loaded",kg="PostHog loadExternalDependency extension not found.",Js="on_reject",Ni="always",qa="anonymous",Ia="identified",Fm="identified_only",Sd="visibilitychange",jd="beforeunload",Ja="$pageview",gp="$pageleave",xp="$identify",kb="$groupidentify";function Fu(e,t){nt(e)&&e.forEach(t)}function zt(e,t){if(!rt(e))if(nt(e))e.forEach(t);else if(EN(e))e.forEach(((i,l)=>t(i,l)));else for(var n in e)I5.call(e,n)&&t(e[n],n)}var Bt=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;t>i;i++)n[i-1]=arguments[i];for(var l of n)for(var c in l)l[c]!==void 0&&(e[c]=l[c]);return e};function sd(e){for(var t=Object.keys(e),n=t.length,i=new Array(n);n--;)i[n]=[t[n],e[t[n]]];return i}var Sb=function(e){try{return e()}catch{return}},h3=function(e){return function(){try{for(var t=arguments.length,n=new Array(t),i=0;t>i;i++)n[i]=arguments[i];return e.apply(this,n)}catch(l){Ne.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Ne.critical(l)}}},Sg=function(e){var t={};return zt(e,(function(n,i){(It(n)&&n.length>0||Bn(n))&&(t[i]=n)})),t},p3=["herokuapp.com","vercel.app","netlify.app"];function m3(e){var t=e==null?void 0:e.hostname;if(!It(t))return!1;var n=t.split(".").slice(-2).join(".");for(var i of p3)if(n===i)return!1;return!0}function Kt(e,t,n,i){var{capture:l=!1,passive:c=!0}=i??{};e==null||e.addEventListener(t,n,{capture:l,passive:c})}function N_(e){return e.name==="ph_toolbar_internal"}Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Bn(e)&&isFinite(e)&&Math.floor(e)===e});class Nd{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,n,i,l){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(i)||!Number.isInteger(l)||0>t||0>n||0>i||0>l||t>0xffffffffffff||n>4095||i>1073741823||l>4294967295)throw new RangeError("invalid field value");var c=new Uint8Array(16);return c[0]=t/Math.pow(2,40),c[1]=t/Math.pow(2,32),c[2]=t/Math.pow(2,24),c[3]=t/Math.pow(2,16),c[4]=t/Math.pow(2,8),c[5]=t,c[6]=112|n>>>8,c[7]=n,c[8]=128|i>>>24,c[9]=i>>>16,c[10]=i>>>8,c[11]=i,c[12]=l>>>24,c[13]=l>>>16,c[14]=l>>>8,c[15]=l,new Nd(c)}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 Nd(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(var n=0;16>n;n++){var i=this.bytes[n]-t.bytes[n];if(i!==0)return Math.sign(i)}return 0}}class g3{constructor(){this.S=0,this.C=0,this.I=new x3}generate(){var t=this.generateOrAbort();if(Se(t)){this.S=0;var n=this.generateOrAbort();if(Se(n))throw new Error("Could not generate UUID after timestamp reset");return n}return t}generateOrAbort(){var t=Date.now();if(t>this.S)this.S=t,this.T();else{if(this.S>=t+1e4)return;this.C++,this.C>4398046511103&&(this.S++,this.T())}return Nd.fromFieldsV7(this.S,Math.trunc(this.C/Math.pow(2,30)),this.C&Math.pow(2,30)-1,this.I.nextUint32())}T(){this.C=1024*this.I.nextUint32()+(1023&this.I.nextUint32())}}var jb,C_=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};ie&&!Se(ie.crypto)&&crypto.getRandomValues&&(C_=e=>crypto.getRandomValues(e));class x3{constructor(){this.M=new Uint32Array(8),this.R=1/0}nextUint32(){return this.M.length>this.R||(C_(this.M),this.R=0),this.M[this.R++]}}var hs=()=>v3().toString(),v3=()=>(jb||(jb=new g3)).generate(),yo="",b3=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,Qr={O:()=>!!Ce,D(e){Ne.error("cookieStore error: "+e)},A(e){if(Ce){try{for(var t=e+"=",n=Ce.cookie.split(";").filter((c=>c.length)),i=0;n.length>i;i++){for(var l=n[i];l.charAt(0)==" ";)l=l.substring(1,l.length);if(l.indexOf(t)===0)return decodeURIComponent(l.substring(t.length,l.length))}}catch{}return null}},F(e){var t;try{t=JSON.parse(Qr.A(e))||{}}catch{}return t},N(e,t,n,i,l){if(!Ce)return!1;try{var c="",u="",f=(function(g,v){if(v){var y=(function(_,S){if(S===void 0&&(S=Ce),yo)return yo;if(!S||["localhost","127.0.0.1"].includes(_))return"";for(var T=_.split("."),j=Math.min(T.length,8),R="dmn_chk_"+hs();!yo&&j--;){var C=T.slice(j).join("."),P=R+"=1;domain=."+C+";path=/";S.cookie=P+";max-age=3",S.cookie.includes(R)&&(S.cookie=P+";max-age=0",yo=C)}return yo})(g);if(!y){var b=(_=>{var S=_.match(b3);return S?S[0]:""})(g);b!==y&&Ne.info("Warning: cookie subdomain discovery mismatch",b,y),y=b}return y?"; domain=."+y:""}return""})(Ce.location.hostname,i);if(n){var h=new Date;h.setTime(h.getTime()+864e5*n),c="; expires="+h.toUTCString()}l&&(u="; secure");var p=e+"="+encodeURIComponent(JSON.stringify(t))+c+"; SameSite=Lax; path=/"+f+u;return p.length>3686.4&&Ne.warn("cookieStore warning: large cookie, len="+p.length),Ce.cookie=p,!0}catch{return!1}},q(e,t){if(Ce!=null&&Ce.cookie)try{Qr.N(e,"",-1,t)}catch{return}}},vp=null,Et={O(){if(!or(vp))return vp;var e=!0;if(Se(ie))e=!1;else try{var t="__mplssupport__";Et.N(t,"xyz"),Et.A(t)!=='"xyz"'&&(e=!1),Et.q(t)}catch{e=!1}return e||Ne.error("localStorage unsupported; falling back to cookie store"),vp=e,e},D(e){Ne.error("localStorage error: "+e)},A(e){try{return ie==null?void 0:ie.localStorage.getItem(e)}catch(t){Et.D(t)}return null},F(e){try{return JSON.parse(Et.A(e))||{}}catch{}return null},N(e,t){try{return ie==null||ie.localStorage.setItem(e,JSON.stringify(t)),!0}catch(n){Et.D(n)}return!1},q(e){try{ie==null||ie.localStorage.removeItem(e)}catch(t){Et.D(t)}}},y3=[_d,"distinct_id",nl,_g,kd,wd,zr],Hu={},_3={O:()=>!0,D(e){Ne.error("memoryStorage error: "+e)},A:e=>Hu[e]||null,F:e=>Hu[e]||null,N:(e,t)=>(Hu[e]=t,!0),q(e){delete Hu[e]}},Gs=null,Nn={O(){if(!or(Gs))return Gs;if(Gs=!0,Se(ie))Gs=!1;else try{var e="__support__";Nn.N(e,"xyz"),Nn.A(e)!=='"xyz"'&&(Gs=!1),Nn.q(e)}catch{Gs=!1}return Gs},D(e){Ne.error("sessionStorage error: ",e)},A(e){try{return ie==null?void 0:ie.sessionStorage.getItem(e)}catch(t){Nn.D(t)}return null},F(e){try{return JSON.parse(Nn.A(e))||null}catch{}return null},N(e,t){try{return ie==null||ie.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(n){Nn.D(n)}return!1},q(e){try{ie==null||ie.sessionStorage.removeItem(e)}catch(t){Nn.D(t)}}};class w3{constructor(t){this._instance=t}get qt(){return this._instance.config}get consent(){return this.rr()?0:this.ir}isOptedOut(){return this.qt.cookieless_mode===Ni||this.isRejected()||this.consent===-1&&this.qt.cookieless_mode===Js}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.qt.opt_out_capturing_by_default}optInOut(t){this.nr.N(this.sr,t?1:0,this.qt.cookie_expiration,this.qt.cross_subdomain_cookie,this.qt.secure_cookie)}reset(){this.nr.q(this.sr,this.qt.cross_subdomain_cookie)}get sr(){var{token:t,opt_out_capturing_cookie_prefix:n,consent_persistence_name:i}=this._instance.config;return i||(n?n+t:"__ph_opt_in_out_"+t)}get ir(){var t=this.nr.A(this.sr);return dp(t)?1:Ie(MN,t)?0:-1}get nr(){var t=this.qt.opt_out_capturing_persistence_type,n=t==="localStorage"?Et:Qr;if(!this.ar||this.ar!==n){this.ar=n;var i=t==="localStorage"?Qr:Et;i.A(this.sr)&&(this.ar.A(this.sr)||this.optInOut(dp(i.A(this.sr))),i.q(this.sr,this.qt.cross_subdomain_cookie))}return this.ar}rr(){return!!this.qt.respect_dnt&&[ar==null?void 0:ar.doNotTrack,ar==null?void 0:ar.msDoNotTrack,Le.doNotTrack].some((t=>dp(t)))}}var k3=1,S3=3,j3=11;function Nb(e){return e instanceof Element&&(e.id===w_||!(e.closest==null||!e.closest(".toolbar-global-fade-container")))}function xs(e){return!!e&&e.nodeType===k3}function lr(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function E_(e){return!!e&&e.nodeType===S3}function T_(e){return!!e&&e.nodeType===j3&&xs(e.host)}function jg(e){return e?Ud(e).split(/\s+/):[]}function Cb(e){var t=ie==null?void 0:ie.location.href;return!!(t&&e&&e.some((n=>t.match(n))))}function Cd(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 jg(t)}function A_(e){return rt(e)?null:Ud(e).split(/(\s+)/).filter((t=>Go(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function sc(e){var t="";return Hm(e)&&!L_(e)&&e.childNodes&&e.childNodes.length&&zt(e.childNodes,(function(n){var i;E_(n)&&n.textContent&&(t+=(i=A_(n.textContent))!==null&&i!==void 0?i:"")})),Ud(t)}function bp(e){return Se(e.target)?e.srcElement||null:(t=e.target)!=null&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var Ng=["a","button","form","input","select","textarea","label"];function M_(e,t){if(Se(t))return!0;var n,i=function(c){if(t.some((u=>c.matches(u))))return{v:!0}};for(var l of e)if(n=i(l))return n.v;return!1}function R_(e){var t=e.parentNode;return!(!t||!xs(t))&&t}var D_=["next","previous","prev",">","<"],N3=[...D_,"+","-","−","–"],Eb=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,Tb=[".ph-no-rageclick",".ph-no-capture"],C3=["","text","search","email","password","url","tel","number"];function Ab(e,t){if(!ie||Cg(e))return!1;var n,i,l,c,u;if(Zr(t)?(n=!!t&&Tb,i=void 0,l=!1):(n=(c=t==null?void 0:t.css_selector_ignorelist)!==null&&c!==void 0?c:Tb,i=t==null?void 0:t.content_ignorelist,l=(u=t==null?void 0:t.ignore_text_selection)!==null&&u!==void 0&&u),n===!1||l&&(function(h){return!(!h||!xs(h))&&(!!lr(h,"textarea")||(lr(h,"input")?Ie(C3,(h.getAttribute("type")||"").toLowerCase()):(function(p){if(p.isContentEditable)return!0;var g=p.getAttribute==null?void 0:p.getAttribute("contenteditable");return g==="true"||g===""})(h)))})(e))return!1;var{targetElementList:f}=z_(e,!1);return!(function(h,p){if(h===!1||Se(h))return!1;var g;if(h===!0)g=D_;else{if(!nt(h))return!1;if(h.length>10)return Ne.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;g=h.map((v=>v.toLowerCase()))}return p.some((v=>{var{safeText:y,ariaLabel:b}=v;return g.some((_=>Eb(y,_)||Eb(b,_)))}))})(i,f.map((h=>{var p;return{safeText:sc(h).toLowerCase(),ariaLabel:((p=h.getAttribute("aria-label"))==null?void 0:p.toLowerCase().trim())||""}})))&&!M_(f,n)}var Cg=e=>!e||lr(e,"html")||!xs(e),z_=(e,t)=>{if(!ie||Cg(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,i=[e],l=e;l.parentNode&&!lr(l,"body");)if(T_(l.parentNode))i.push(l.parentNode.host),l=l.parentNode.host;else{var c=R_(l);if(!c)break;if(t||Ng.indexOf(c.tagName.toLowerCase())>-1)n=!0;else{var u=ie.getComputedStyle(c);u&&u.getPropertyValue("cursor")==="pointer"&&(n=!0)}i.push(c),l=c}return{parentIsUsefulElement:n,targetElementList:i}};function Hm(e){for(var t=e;t.parentNode&&!lr(t,"body");t=t.parentNode){var n=Cd(t);if(Ie(n,"ph-sensitive")||Ie(n,"ph-no-capture"))return!1}if(Ie(Cd(e),"ph-include"))return!0;var i=e.type||"";if(It(i))switch(i.toLowerCase()){case"hidden":case"password":return!1}var l=e.name||e.id||"";return!It(l)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(l.replace(/[^a-zA-Z0-9]/g,""))}function L_(e){return!!(lr(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||lr(e,"select")||lr(e,"textarea")||e.getAttribute("contenteditable")==="true")}var O_="(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})",E3=new RegExp("^(?:"+O_+")$"),T3=new RegExp(O_),B_="\\d{3}-?\\d{2}-?\\d{4}",A3=new RegExp("^("+B_+")$"),M3=new RegExp("("+B_+")");function Go(e,t){return t===void 0&&(t=!0),!(rt(e)||It(e)&&(e=Ud(e),(t?E3:T3).test((e||"").replace(/[- ]/g,""))||(t?A3:M3).test(e)))}function Mb(e){var t=sc(e);return Go(t=(t+" "+$_(e)).trim())?t:""}function $_(e){var t="";return e&&e.childNodes&&e.childNodes.length&&zt(e.childNodes,(function(n){var i;if(n&&((i=n.tagName)==null?void 0:i.toLowerCase())==="span")try{var l=sc(n);t=(t+" "+l).trim(),n.childNodes&&n.childNodes.length&&(t=(t+" "+$_(n)).trim())}catch(c){Ne.error("[AutoCapture]",c)}})),t}function Rb(e){return e.replace(/"|\\"/g,'\\"')}function R3(e){var t=e.attr__class;return t?nt(t)?t:jg(t):void 0}var qu=Vt("[Dead Clicks]"),D3=()=>!0,z3=e=>{var t,n=!((t=e.instance.persistence)==null||!t.get_property(yg)),i=e.instance.config.capture_dead_clicks;return Zr(i)?i:!!Yt(i)||n};class Db{get lazyLoadedDeadClicksAutocapture(){return this.ur}constructor(t,n,i){this.instance=t,this.isEnabled=n,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(t){"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[yg]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.lr((()=>{this.hr()})):this.stop()}lr(t){var n,i;(n=Le.__PosthogExtensions__)!=null&&n.initDeadClicksAutocapture&&t(),(i=Le.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(l=>{l?qu.error("failed to load script",l):t()}))}hr(){var t;if(Ce){if(!this.ur&&(t=Le.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture){var n=Yt(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};n.__onCapture=this.onCapture,this.ur=Le.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.ur.start(Ce),qu.info("starting...")}}else qu.error("`document` not found. Cannot start.")}stop(){this.ur&&(this.ur.stop(),this.ur=void 0,qu.info("stopping..."))}}var yp=Vt("[SegmentIntegration]"),P_="posthog-js";function U_(e,t){var{organization:n,projectId:i,prefix:l,severityAllowList:c=["error"],sendExceptionsToPostHog:u=!0}=t===void 0?{}:t;return f=>{var h,p,g,v,y;if(c!=="*"&&!c.includes(f.level)||!e.__loaded)return f;f.tags||(f.tags={});var b=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());f.tags["PostHog Person URL"]=b,e.sessionRecordingStarted()&&(f.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var _,S=((h=f.exception)==null?void 0:h.values)||[],T=S.map((R=>ye({},R,{stacktrace:R.stacktrace?ye({},R.stacktrace,{type:"raw",frames:(R.stacktrace.frames||[]).map((C=>ye({},C,{platform:"web:javascript"})))}):void 0}))),j={$exception_message:((p=S[0])==null?void 0:p.value)||f.message,$exception_type:(g=S[0])==null?void 0:g.type,$exception_level:f.level,$exception_list:T,$sentry_event_id:f.event_id,$sentry_exception:f.exception,$sentry_exception_message:((v=S[0])==null?void 0:v.value)||f.message,$sentry_exception_type:(y=S[0])==null?void 0:y.type,$sentry_tags:f.tags};return n&&i&&(j.$sentry_url=(l||"https://sentry.io/organizations/")+n+"/issues/?project="+i+"&query="+f.event_id),u&&((_=e.exceptions)==null||_.sendExceptionEvent(j)),f}}class L3{constructor(t,n,i,l,c,u){this.name=P_,this.setupOnce=function(f){f(U_(t,{organization:n,projectId:i,prefix:l,severityAllowList:c,sendExceptionsToPostHog:u==null||u}))}}}class zb{constructor(t){this.cr=(n,i,l)=>{l&&(l.noSessionId||l.activityTimeout||l.sessionPastMaximumLength)&&(Ne.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:n,changeReason:l}),this.dr=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.vr()}vr(){var t;this.pr=(t=this._instance.sessionManager)==null?void 0:t.onSessionId(this.cr)}destroy(){var t;(t=this.pr)==null||t.call(this),this.pr=void 0}doPageView(t,n){var i,l=this.gr(t,n);return this.dr={pathname:(i=ie==null?void 0:ie.location.pathname)!==null&&i!==void 0?i:"",pageViewId:n,timestamp:t},this._instance.scrollManager.resetContext(),l}doPageLeave(t){var n;return this.gr(t,(n=this.dr)==null?void 0:n.pageViewId)}doEvent(){var t;return{$pageview_id:(t=this.dr)==null?void 0:t.pageViewId}}gr(t,n){var i=this.dr;if(!i)return{$pageview_id:n};var l={$pageview_id:n,$prev_pageview_id:i.pageViewId},c=this._instance.scrollManager.getContext();if(c&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:u,lastScrollY:f,maxScrollY:h,maxContentHeight:p,lastContentY:g,maxContentY:v}=c;if(!(Se(u)||Se(f)||Se(h)||Se(p)||Se(g)||Se(v))){u=Math.ceil(u),f=Math.ceil(f),h=Math.ceil(h),p=Math.ceil(p),g=Math.ceil(g),v=Math.ceil(v);var y=u>1?Kr(f/u,0,1,Ne):1,b=u>1?Kr(h/u,0,1,Ne):1,_=p>1?Kr(g/p,0,1,Ne):1,S=p>1?Kr(v/p,0,1,Ne):1;l=Bt(l,{$prev_pageview_last_scroll:f,$prev_pageview_last_scroll_percentage:y,$prev_pageview_max_scroll:h,$prev_pageview_max_scroll_percentage:b,$prev_pageview_last_content:g,$prev_pageview_last_content_percentage:_,$prev_pageview_max_content:v,$prev_pageview_max_content_percentage:S})}}return i.pathname&&(l.$prev_pageview_pathname=i.pathname),i.timestamp&&(l.$prev_pageview_duration=(t.getTime()-i.timestamp.getTime())/1e3),l}}var Iu=["flags","surveys"],O3={[x_]:{exposure:"hidden"},[Lo]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[Oo]:{exposure:"hidden"},[wm]:{exposure:"event"},[km]:{exposure:"hidden"},[Sm]:{exposure:"event"},[jm]:{exposure:"hidden"},[Nm]:{exposure:"event"},[Cm]:{exposure:"event"},[yg]:{exposure:"event"},[Em]:{exposure:"hidden"},[Tm]:{exposure:"event"},[ea]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[nl]:{exposure:"hidden"},[_g]:{exposure:"event"},$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"},[rl]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(e,t)=>t(),transformToEventProperties(e){if(!Yt(e))return{};for(var t={},n=Object.keys(e),i=0;n.length>i;i++)t["$feature/"+n[i]]=e[n[i]];return t}},[rd]:{exposure:"event",storageGroup:"flags"},[Bo]:{exposure:"hidden"},[Am]:{exposure:"hidden",storageGroup:"flags"},[Mm]:{exposure:"event",storageGroup:"flags"},[Rm]:{exposure:"event",storageGroup:"flags"},[Si]:{exposure:"event"},[Za]:{exposure:"hidden"},[$o]:{exposure:"hidden"},[Zs]:{exposure:"hidden"},[Dm]:{exposure:"hidden",storageGroup:"surveys"},[wg]:{exposure:"hidden",storageGroup:"surveys"},[zm]:{exposure:"event"},[id]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[Vo]:{exposure:"hidden"},[Lm]:{exposure:"hidden"},[Om]:{exposure:"hidden"},[ic]:{exposure:"hidden",storageGroup:"flags"},[zr]:{exposure:"hidden"},[Bm]:{exposure:"hidden"},[$m]:{exposure:"hidden"},[Pm]:{exposure:"hidden"},[Um]:{exposure:"hidden"},[wd]:{exposure:"hidden"},[kd]:{exposure:"hidden"},[v_]:{exposure:"event"},[b_]:{exposure:"event"},[y_]:{exposure:"event"},[__]:{exposure:"event"},[k_]:{exposure:"event"},[S_]:{exposure:"event"},[j_]:{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"}},B3=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],_o=e=>{var t=O3[e];if(t)return t;for(var[n,i]of B3)if(e.indexOf(n)===0)return i},Ed=e=>{var t=Ce==null?void 0:Ce.createElement("a");return Se(t)?null:(t.href=e,t)},ac=function(e,t){for(var n,i=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),l=0;i.length>l;l++){var c=i[l].split("=");if(c[0]===t){n=c;break}}if(!nt(n)||2>n.length)return"";var u=n[1];try{u=decodeURIComponent(u)}catch{Ne.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 i=e.split("#"),l=i[1],c=(i[0]||"").split("?"),u=c[1],f=c[0],h=(u||"").split("&"),p=[],g=0;h.length>g;g++){var v=h[g].split("=");nt(v)&&(t.includes(v[0])?p.push(v[0]+"="+n):p.push(h[g]))}var y=f;return u!=null&&(y+="?"+p.join("&")),l!=null&&(y+="#"+l),y},Td=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},Vu="https?://(.*)",dl=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],$3=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...dl],oc="<masked>",P3=["li_fat_id"];function F_(e,t,n){if(!Ce)return{};var i,l=t?[...dl,...n||[]]:[],c=H_(lc(Ce.URL,l,oc),e),u=(i={},zt(P3,(function(f){var h=Qr.A(f);i[f]=h||null})),i);return Bt(u,c)}function H_(e,t){var n=$3.concat(t||[]),i={};return zt(n,(function(l){var c=ac(e,l);i[l]=c||null})),i}function q_(e){var t=(function(c){return c?c.search(Vu+"google.([^/?]*)")===0?"google":c.search(Vu+"bing.com")===0?"bing":c.search(Vu+"yahoo.com")===0?"yahoo":c.search(Vu+"duckduckgo.com")===0?"duckduckgo":null:null})(e),n=t!="yahoo"?"q":"p",i={};if(!or(t)){i.$search_engine=t;var l=Ce?ac(Ce.referrer,n):"";l.length&&(i.ph_keyword=l)}return i}function Lb(){return navigator.language||navigator.userLanguage}var Ad="$direct";function I_(){return(Ce==null?void 0:Ce.referrer)||Ad}function V_(e,t){var n=e?[...dl,...t||[]]:[],i=jn==null?void 0:jn.href.substring(0,1e3);return{r:I_().substring(0,1e3),u:i?lc(i,n,oc):void 0}}function G_(e){var t,{r:n,u:i}=e,l={$referrer:n,$referring_domain:n==null?void 0:n==Ad?Ad:(t=Ed(n))==null?void 0:t.host};if(i){l.$current_url=i;var c=Ed(i);l.$host=c==null?void 0:c.host,l.$pathname=c==null?void 0:c.pathname;var u=H_(i);Bt(l,u)}if(n){var f=q_(n);Bt(l,f)}return l}function Y_(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function U3(){try{return new Date().getTimezoneOffset()}catch{return}}var F3={flags:ic,surveys:wg},H3=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Va="main";class _p{constructor(t,n,i){if(i===void 0&&(i=!0),this.mr={},this.yr=!1,this.br=!1,this.qt=t,this._r=i,this.props={},this.wr=!1,this.Sr=(c=>{var u="";return c.token&&(u=c.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),c.persistence_name?"ph_"+c.persistence_name:"ph_"+u+"_posthog"})(t),this.nr=this.kr(t),this.br=this.Cr(t),this.load(),t.debug&&Ne.info("Persistence loaded",t.persistence,ye({},this.props)),this.update_config(t,t,n),this.save(),ie){var l=()=>this.flush();Kt(ie,"beforeunload",l,{capture:!1}),Kt(ie,"pagehide",l,{capture:!1})}}Ir(){var t,n=(t=this.qt)==null?void 0:t.persistence_save_debounce_ms;return Bn(n)&&n>0?n:0}isDisabled(){return!!this.Tr}kr(t){H3.indexOf(t.persistence.toLowerCase())===-1&&(Ne.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var n,i=(function(u,f){u===void 0&&(u=[]),f===void 0&&(f=!1);var h=[...y3,...u];return ye({},Et,{F(p){try{var g={};try{g=Qr.F(p)||{}}catch{}var v,y=JSON.parse(Et.A(p)||"{}");if(f){var b={};for(var _ in g){var S=g[_];or(S)||S===""||(b[_]=S)}v=Bt(y,b)}else v=Bt(g,y);return Et.N(p,v),v}catch{}return null},N(p,g,v,y,b,_){var S=Et.N(p,g,void 0,void 0,_);try{var T={};h.forEach((j=>{g[j]&&(T[j]=g[j])})),Object.keys(T).length&&Qr.N(p,T,v,y,b,_)}catch(j){Et.D(j)}return S},q(p,g){try{ie==null||ie.localStorage.removeItem(p),Qr.q(p,g)}catch(v){Et.D(v)}}})})(t.cookie_persisted_properties||[],t.__preview_cookie_wins_on_conflict||!1),l=!1,c=t.persistence.toLowerCase();return c==="localstorage"&&Et.O()?(n=Et,l=!0):c==="localstorage+cookie"&&i.O()?(n=i,l=!0):c==="sessionstorage"&&Nn.O()?n=Nn:c==="memory"?n=_3:c==="cookie"?n=Qr:i.O()?(n=i,l=!0):n=Qr,this.yr=l,n}Er(t){return this.Sr+"__"+t}Cr(t){return this.yr&&!!t.split_storage}Mr(t){var n=t??this.qt.feature_flag_cache_ttl_ms;if(!n||0>=n)return!1;var i=this.props[ic];return!i||typeof i!="number"||Date.now()-i>n}properties(){var t={};return zt(this.props,((n,i)=>{var l=_o(i);if((l==null?void 0:l.exposure)==="derived"){if(l.shouldSkipFromEventProperties!=null&&l.shouldSkipFromEventProperties(n,i===rl?()=>this.Mr():()=>!1))return;l.transformToEventProperties&&Bt(t,l.transformToEventProperties(n))}else l&&l.exposure!=="event"||(t[i]=n)})),t}load(){if(!this.Tr){var t=this.nr.F(this.Sr);t&&(this.props=Bt({},t)),this.br&&this.Rr()}}Rr(){for(var t of Iu){var n=Et.F(this.Er(t));if(n&&!ps(n)){var i=this.Pr(t);i.persisted=!0,this.Or(t)||(i.fingerprint=this.Lr(n,t)),this.Ar(t,n)||Bt(this.props,n)}}}Or(t){return Object.keys(this.props).some((n=>{var i;return((i=_o(n))==null?void 0:i.storageGroup)===t}))}Ar(t,n){var i=F3[t];if(!i)return!1;var l=n[i],c=this.props[i];return Bn(l)&&Bn(c)&&c>l}refreshKey(t){var n;if(!this.Tr){var i=this.br?(n=_o(t))==null?void 0:n.storageGroup:void 0,l=i?Et.F(this.Er(i)):this.nr.F(this.Sr);if(l&&t in l)this.Fr(t,l[t]);else{if(i){var c=this.nr.F(this.Sr);if(c&&t in c)return void this.Fr(t,c[t])}this.Nr(t)}}}save(){if(!this.Tr){var t=this.Ir();t>0?Se(this.Dr)&&(this.Dr=setTimeout((()=>{this.Dr=void 0,this.$r()}),t)):this.$r()}}flush(){Se(this.Dr)||(clearTimeout(this.Dr),this.Dr=void 0,this.$r())}$r(){this.Tr||(this.br?this.qr():this.jr(this.nr,this.Sr,this.props,Va))}qr(){var{main:t,groups:n}=this.Hr();for(var i of(this.jr(this.nr,this.Sr,t,Va),Iu)){var l,c=n[i];(!ps(c)||(l=this.mr[i])!=null&&l.persisted)&&this.jr(Et,this.Er(i),c,i)}}Hr(){var t={},n={};for(var i of Iu)n[i]={};return zt(this.props,((l,c)=>{var u,f=(u=_o(c))==null?void 0:u.storageGroup;f?n[f][c]=l:t[c]=l})),{main:t,groups:n}}Lr(t,n){var i=JSON.stringify(t);return n===Va?i+"|"+this.Ur+"|"+this.Br+"|"+this.zr:i}jr(t,n,i,l){var c=this.Pr(l);if(l===Va||c.dirty||Se(c.fingerprint)){var u;try{if((u=this.Lr(i,l))===c.fingerprint)return void(c.dirty=!1)}catch{u=void 0}t.N(n,i,this.Ur,this.Br,this.zr,this.qt.debug)?(c.dirty=!1,l!==Va&&(c.persisted=!0),Se(u)||(c.fingerprint=u)):this.qt.debug&&Ne.warn('failed to persist storage entry "'+n+'"; will retry on next save')}}remove(t){var{keepGroupEntries:n=!1}=t===void 0?{}:t;if(Se(this.Dr)||(clearTimeout(this.Dr),this.Dr=void 0),this.nr.q(this.Sr,!1),this.nr.q(this.Sr,!0),!n&&this._r)for(var i of Iu)Et.q(this.Er(i));n?delete this.mr[Va]:this.mr={}}clear(){this.remove(),this.props={}}register_once(t,n,i){if(Yt(t)){Se(n)&&(n="None"),this.Ur=Se(i)?this.Vr:i;var l=!1;if(zt(t,((c,u)=>{this.props.hasOwnProperty(u)&&this.props[u]!==n||(this.Fr(u,c),l=!0)})),l)return this.save(),!0}return!1}register(t,n){if(Yt(t)){this.Ur=Se(n)?this.Vr:n;var i=!1;if(zt(t,((l,c)=>{t.hasOwnProperty(c)&&this.props[c]!==l&&(this.Fr(c,l),i=!0)})),i)return this.save(),!0}return!1}unregister(t){t in this.props&&(this.Nr(t),this.save())}update_campaign_params(){if(!this.wr){var t=F_(this.qt.custom_campaign_params,this.qt.mask_personal_data_properties,this.qt.custom_personal_data_properties);ps(Sg(t))||this.register(t),this.wr=!0}}update_search_keyword(){var t;this.register((t=Ce==null?void 0:Ce.referrer)?q_(t):{})}update_referrer_info(){var t;this.register_once({$referrer:I_(),$referring_domain:Ce!=null&&Ce.referrer&&((t=Ed(Ce.referrer))==null?void 0:t.host)||Ad},void 0)}set_initial_person_info(){this.props[Pm]||this.props[Um]||this.register_once({[wd]:V_(this.qt.mask_personal_data_properties,this.qt.custom_personal_data_properties)},void 0)}get_initial_props(){var t={};zt([Um,Pm],(u=>{var f=this.props[u];f&&zt(f,(function(h,p){t["$initial_"+mm(p)]=h}))}));var n,i,l=this.props[wd];if(l){var c=(n=G_(l),i={},zt(n,(function(u,f){i["$initial_"+mm(f)]=u})),i);Bt(t,c)}return t}safe_merge(t){return zt(this.props,(function(n,i){i in t||(t[i]=n)})),t}update_config(t,n,i){this.Vr=this.Ur=t.cookie_expiration,this.set_disabled(t.disable_persistence||!!i),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie);var l=t.persistence!==n.persistence||!((h,p)=>{if(h.length!==p.length)return!1;var g=[...h].sort(),v=[...p].sort();return g.every(((y,b)=>y===v[b]))})(t.cookie_persisted_properties||[],n.cookie_persisted_properties||[]),c=l?this.kr(t):this.nr,u=this.Cr(t);if(l||u!==this.br){var f=this.props;this.clear(),this.nr=c,this.br=u,this.props=f,this.save()}}set_disabled(t){this.Tr=t,this.Tr?this.remove():this.save()}set_cross_subdomain(t){t!==this.Br&&(this.Br=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.zr&&(this.zr=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,n){var i=this.props[Oo]||{};i[t]=n,this.Fr(Oo,i),this.save()}remove_event_timer(t){var n=this.props[Oo]||{},i=n[t];return Se(i)||(delete n[t],this.Fr(Oo,n),this.save()),i}get_property(t){return this.props[t]}set_property(t,n){this.Fr(t,n),this.save()}Fr(t,n){this.props[t]=n,this.Wr(t)}Nr(t){delete this.props[t],this.Wr(t)}Wr(t){var n,i=(n=_o(t))==null?void 0:n.storageGroup;i&&(this.Pr(i).dirty=!0)}Pr(t){return this.mr[t]||(this.mr[t]={})}}var wo={Activation:"events",Cancellation:"cancelEvents"},wp={Popover:"popover",API:"api",Widget:"widget"},Po={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},kp={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},qm={Popover:"popover",Inline:"inline"},q3={SHOWN:"product tour shown"},Ob={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},Bb=Vt("[RateLimiter]");class I3{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=n=>{var i=n.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach((l=>{Bb.info((l||"events")+" is quota limited."),this.serverLimits[l]=new Date().getTime()+6e4}))}catch(l){return void Bb.warn('could not rate limit - continuing. Error: "'+(l==null?void 0:l.message)+'"',{text:i})}},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,i,l;t===void 0&&(t=!1);var{captureEventsBurstLimit:c,captureEventsPerSecond:u}=this,f=new Date().getTime(),h=(n=(i=this.instance.persistence)==null?void 0:i.get_property($m))!==null&&n!==void 0?n:{tokens:c,last:f};h.tokens+=(f-h.last)/1e3*u,h.last=f,h.tokens>c&&(h.tokens=c);var p=1>h.tokens;return p||t||(h.tokens=Math.max(0,h.tokens-1)),!p||this.lastEventRateLimited||t||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+u+" events per second and "+c+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=p,(l=this.instance.persistence)==null||l.set_property($m,h),{isRateLimited:p,remainingTokens:h.tokens}}isServerRateLimited(t){var n=this.serverLimits[t||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var ko=Vt("[RemoteConfig]");class W_{constructor(t){this._instance=t}get remoteConfig(){var t;return(t=Le._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.config}Zr(t){var n,i;(n=Le.__PosthogExtensions__)!=null&&n.loadExternalDependency?(i=Le.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}Gr(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(n){t(n.json)}})}load(){try{if(this.remoteConfig)return ko.info("Using preloaded remote config",this.remoteConfig),this.Qr(this.remoteConfig),void this.Jr();if(this._instance.Kr())return void ko.warn("Remote config is disabled. Falling back to local config.");this.Zr((t=>{if(!t)return ko.info("No config found after loading remote JS config. Falling back to JSON."),void this.Gr((n=>{this.Qr(n),this.Jr()}));this.Qr(t),this.Jr()}))}catch(t){ko.error("Error loading remote config",t)}}stop(){this.Yr&&(clearInterval(this.Yr),this.Yr=void 0)}refresh(){!this._instance.Kr()&&Ce&&Ce.visibilityState!=="hidden"&&this._instance.reloadFeatureFlags()}Jr(){var t;if(!this.Yr){var n=(t=this._instance.config.remote_config_refresh_interval_ms)!==null&&t!==void 0?t:3e5;n!==0&&(this.Yr=setInterval((()=>{this.refresh()}),n))}}Qr(t){var n;t||ko.error("Failed to fetch remote config from PostHog."),this._instance.Qr(t??{}),(t==null?void 0:t.hasFeatureFlags)!==!1&&(this._instance.config.advanced_disable_feature_flags_on_first_load||(n=this._instance.featureFlags)==null||n.ensureFlagsLoaded())}}var Xr={GZipJS:"gzip-js",Base64:"base64"},Cr=Uint8Array,Wn=Uint16Array,fl=Uint32Array,Eg=new Cr([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]),Tg=new Cr([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]),$b=new Cr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),X_=function(e,t){for(var n=new Wn(31),i=0;31>i;++i)n[i]=t+=1<<e[i-1];var l=new fl(n[30]);for(i=1;30>i;++i)for(var c=n[i];n[i+1]>c;++c)l[c]=c-n[i]<<5|i;return[n,l]},Q_=X_(Eg,2),Im=Q_[1];Q_[0][28]=258,Im[258]=28;for(var Pb=X_(Tg,0)[1],K_=new Wn(32768),$t=0;32768>$t;++$t){var Ga=(43690&$t)>>>1|(21845&$t)<<1;K_[$t]=((65280&(Ga=(61680&(Ga=(52428&Ga)>>>2|(13107&Ga)<<2))>>>4|(3855&Ga)<<4))>>>8|(255&Ga)<<8)>>>1}var Yo=function(e,t,n){for(var i=e.length,l=0,c=new Wn(t);i>l;++l)++c[e[l]-1];var u,f=new Wn(t);for(l=0;t>l;++l)f[l]=f[l-1]+c[l-1]<<1;for(u=new Wn(i),l=0;i>l;++l)u[l]=K_[f[e[l]-1]++]>>>15-e[l];return u},ra=new Cr(288);for($t=0;144>$t;++$t)ra[$t]=8;for($t=144;256>$t;++$t)ra[$t]=9;for($t=256;280>$t;++$t)ra[$t]=7;for($t=280;288>$t;++$t)ra[$t]=8;var Md=new Cr(32);for($t=0;32>$t;++$t)Md[$t]=5;var V3=Yo(ra,9),G3=Yo(Md,5),Z_=function(e){return(e/8>>0)+(7&e&&1)},J_=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var i=new(e instanceof Wn?Wn:e instanceof fl?fl:Cr)(n-t);return i.set(e.subarray(t,n)),i},vi=function(e,t,n){var i=t/8>>0;e[i]|=n<<=7&t,e[i+1]|=n>>>8},So=function(e,t,n){var i=t/8>>0;e[i]|=n<<=7&t,e[i+1]|=n>>>8,e[i+2]|=n>>>16},Sp=function(e,t){for(var n=[],i=0;e.length>i;++i)e[i]&&n.push({s:i,f:e[i]});var l=n.length,c=n.slice();if(!l)return[new Cr(0),0];if(l==1){var u=new Cr(n[0].s+1);return u[n[0].s]=1,[u,1]}n.sort((function(z,D){return z.f-D.f})),n.push({s:-1,f:25001});var f=n[0],h=n[1],p=0,g=1,v=2;for(n[0]={s:-1,f:f.f+h.f,l:f,r:h};g!=l-1;)f=n[n[v].f>n[p].f?p++:v++],h=n[p!=g&&n[v].f>n[p].f?p++:v++],n[g++]={s:-1,f:f.f+h.f,l:f,r:h};var y=c[0].s;for(i=1;l>i;++i)c[i].s>y&&(y=c[i].s);var b=new Wn(y+1),_=Vm(n[g-1],b,0);if(_>t){i=0;var S=0,T=_-t,j=1<<T;for(c.sort((function(z,D){return b[D.s]-b[z.s]||z.f-D.f}));l>i;++i){var R=c[i].s;if(t>=b[R])break;S+=j-(1<<_-b[R]),b[R]=t}for(S>>>=T;S>0;){var C=c[i].s;t>b[C]?S-=1<<t-b[C]++-1:++i}for(;i>=0&&S;--i){var P=c[i].s;b[P]==t&&(--b[P],++S)}_=t}return[new Cr(b),_]},Vm=function(e,t,n){return e.s==-1?Math.max(Vm(e.l,t,n+1),Vm(e.r,t,n+1)):t[e.s]=n},Ub=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Wn(++t),i=0,l=e[0],c=1,u=function(h){n[i++]=h},f=1;t>=f;++f)if(e[f]==l&&f!=t)++c;else{if(!l&&c>2){for(;c>138;c-=138)u(32754);c>2&&(u(c>10?c-11<<5|28690:c-3<<5|12305),c=0)}else if(c>3){for(u(l),--c;c>6;c-=6)u(8304);c>2&&(u(c-3<<5|8208),c=0)}for(;c--;)u(l);c=1,l=e[f]}return[n.subarray(0,i),t]},jo=function(e,t){for(var n=0,i=0;t.length>i;++i)n+=e[i]*t[i];return n},Gm=function(e,t,n){var i=n.length,l=Z_(t+2);e[l]=255&i,e[l+1]=i>>>8,e[l+2]=255^e[l],e[l+3]=255^e[l+1];for(var c=0;i>c;++c)e[l+c+4]=n[c];return 8*(l+4+i)},Fb=function(e,t,n,i,l,c,u,f,h,p,g){vi(t,g++,n),++l[256];for(var v=Sp(l,15),y=v[0],b=v[1],_=Sp(c,15),S=_[0],T=_[1],j=Ub(y),R=j[0],C=j[1],P=Ub(S),z=P[0],D=P[1],F=new Wn(19),B=0;R.length>B;++B)F[31&R[B]]++;for(B=0;z.length>B;++B)F[31&z[B]]++;for(var I=Sp(F,7),L=I[0],q=I[1],E=19;E>4&&!L[$b[E-1]];--E);var ae,K,Y,U,$=p+5<<3,re=jo(l,ra)+jo(c,Md)+u,xe=jo(l,y)+jo(c,S)+u+14+3*E+jo(F,L)+(2*F[16]+3*F[17]+7*F[18]);if(re>=$&&xe>=$)return Gm(t,g,e.subarray(h,h+p));if(vi(t,g,1+(re>xe)),g+=2,re>xe){ae=Yo(y,b),K=y,Y=Yo(S,T),U=S;var M=Yo(L,q);for(vi(t,g,C-257),vi(t,g+5,D-1),vi(t,g+10,E-4),g+=14,B=0;E>B;++B)vi(t,g+3*B,L[$b[B]]);g+=3*E;for(var O=[R,z],Z=0;2>Z;++Z){var A=O[Z];for(B=0;A.length>B;++B)vi(t,g,M[fe=31&A[B]]),g+=L[fe],fe>15&&(vi(t,g,A[B]>>>5&127),g+=A[B]>>>12)}}else ae=V3,K=ra,Y=G3,U=Md;for(B=0;f>B;++B)if(i[B]>255){var fe;So(t,g,ae[257+(fe=i[B]>>>18&31)]),g+=K[fe+257],fe>7&&(vi(t,g,i[B]>>>23&31),g+=Eg[fe]);var _e=31&i[B];So(t,g,Y[_e]),g+=U[_e],_e>3&&(So(t,g,i[B]>>>5&8191),g+=Tg[_e])}else So(t,g,ae[i[B]]),g+=K[i[B]];return So(t,g,ae[256]),g+K[256]},Y3=new fl([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),W3=(function(){for(var e=new fl(256),t=0;256>t;++t){for(var n=t,i=9;--i;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e})(),jp=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function X3(e,t){t===void 0&&(t={});var n=(function(){var v=4294967295;return{p(y){for(var b=v,_=0;y.length>_;++_)b=W3[255&b^y[_]]^b>>>8;v=b},d(){return 4294967295^v}}})(),i=e.length;n.p(e);var l,c,u,f,h,p=(f=10+((l=t).filename&&l.filename.length+1||0),h=8,(function(v,y,b,_,S,T){var j=v.length,R=new Cr(_+j+5*(1+Math.floor(j/7e3))+S),C=R.subarray(_,R.length-S),P=0;if(!y||8>j)for(var z=0;j>=z;z+=65535){var D=z+65535;j>D?P=Gm(C,P,v.subarray(z,D)):(C[z]=!0,P=Gm(C,P,v.subarray(z,j)))}else{for(var F=Y3[y-1],B=F>>>13,I=8191&F,L=(1<<b)-1,q=new Wn(32768),E=new Wn(L+1),ae=Math.ceil(b/3),K=2*ae,Y=function(ot){return(v[ot]^v[ot+1]<<ae^v[ot+2]<<K)&L},U=new fl(25e3),$=new Wn(288),re=new Wn(32),xe=0,M=0,O=(z=0,0),Z=0,A=0;j>z;++z){var fe=Y(z),_e=32767&z,je=E[fe];if(q[_e]=je,E[fe]=_e,z>=Z){var De=j-z;if((xe>7e3||O>24576)&&De>423){P=Fb(v,C,0,U,$,re,M,O,A,z-A,P),O=xe=M=0,A=z;for(var oe=0;286>oe;++oe)$[oe]=0;for(oe=0;30>oe;++oe)re[oe]=0}var Ee=2,Fe=0,At=I,Ze=_e-je&32767;if(De>2&&fe==Y(z-Ze))for(var Mt=Math.min(B,De)-1,vt=Math.min(32767,z),qe=Math.min(258,De);vt>=Ze&&--At&&_e!=je;){if(v[z+Ee]==v[z+Ee-Ze]){for(var Pt=0;qe>Pt&&v[z+Pt]==v[z+Pt-Ze];++Pt);if(Pt>Ee){if(Ee=Pt,Fe=Ze,Pt>Mt)break;var vn=Math.min(Ze,Pt-2),un=0;for(oe=0;vn>oe;++oe){var tn=z-Ze+oe+32768&32767,nn=tn-q[tn]+32768&32767;nn>un&&(un=nn,je=tn)}}}Ze+=(_e=je)-(je=q[_e])+32768&32767}if(Fe){U[O++]=268435456|Im[Ee]<<18|Pb[Fe];var ke=31&Im[Ee],ze=31&Pb[Fe];M+=Eg[ke]+Tg[ze],++$[257+ke],++re[ze],Z=z+Ee,++xe}else U[O++]=v[z],++$[v[z]]}}P=Fb(v,C,!0,U,$,re,M,O,A,z-A,P)}return J_(R,0,_+Z_(P)+S)})(c=e,(u=t).level==null?6:u.level,u.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(c.length)))):12+u.mem,f,h)),g=p.length;return(function(v,y){var b=y.filename;if(v[0]=31,v[1]=139,v[2]=8,v[8]=2>y.level?4:y.level==9?2:0,v[9]=3,y.mtime!=0&&jp(v,4,Math.floor(new Date(y.mtime||Date.now())/1e3)),b){v[3]=8;for(var _=0;b.length>=_;++_)v[_+10]=b.charCodeAt(_)}})(p,t),jp(p,g-8,n.d()),jp(p,g-4,i),p}var Q3=!!fm||!!dm,ew="text/plain",ad=!1,K3=(e,t)=>{var[n,i]=e.split("#"),[l,c]=n.split("?");if(!c)return e;var u=c.split("&").filter((f=>f.split("=")[0]!==t)).join("&");return l+(u?"?"+u:"")+(i?"#"+i:"")},Hd=function(e,t,n){var i;n===void 0&&(n=!0);var[l,c]=e.split("?"),u=ye({},t),f=(i=c==null?void 0:c.split("&").map((p=>{var g,[v,y]=p.split("="),b=n&&(g=u[v])!==null&&g!==void 0?g:y;return delete u[v],v+"="+b})))!==null&&i!==void 0?i:[],h=(function(p,g){var v,y;g===void 0&&(g="&");var b=[];return zt(p,(function(_,S){Se(_)||Se(S)||S==="undefined"||(v=encodeURIComponent((T=>T instanceof File)(_)?_.name:_.toString()),y=encodeURIComponent(S),b[b.length]=y+"="+v)})),b.join(g)})(u);return h&&f.push(h),l+"?"+f.join("&")},il=(e,t)=>JSON.stringify(e,((n,i)=>typeof i=="bigint"?i.toString():i),t),Hb=e=>{if(e.tr)return e.tr;var{data:t,compression:n}=e;if(t){if(n===Xr.GZipJS){var i=X3((function(f,h){var p=f.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(f);for(var g=new Cr(f.length+(f.length>>>1)),v=0,y=function(T){g[v++]=T},b=0;p>b;++b){if(v+5>g.length){var _=new Cr(v+8+(p-b<<1));_.set(g),g=_}var S=f.charCodeAt(b);128>S?y(S):2048>S?(y(192|S>>>6),y(128|63&S)):S>55295&&57344>S?(y(240|(S=65536+(1047552&S)|1023&f.charCodeAt(++b))>>>18),y(128|S>>>12&63),y(128|S>>>6&63),y(128|63&S)):(y(224|S>>>12),y(128|S>>>6&63),y(128|63&S))}return J_(g,0,v)})(il(t)),{mtime:0});return{contentType:ew,body:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength),estimatedSize:i.byteLength}}if(n===Xr.Base64){var l=(function(f){return f&&btoa(encodeURIComponent(f).replace(/%([0-9A-F]{2})/g,((h,p)=>String.fromCharCode(parseInt(p,16)))))})(il(t)),c=(f=>"data="+encodeURIComponent(typeof f=="string"?f:il(f)))(l);return{contentType:"application/x-www-form-urlencoded",body:c,estimatedSize:new Blob([c]).size}}var u=il(t);return{contentType:"application/json",body:u,estimatedSize:new Blob([u]).size}}},Np=e=>{var t,n,i,l=Hb(e);return!l||(n=e.compression,i=ac(e.url,"compression"),n!==pb.GZipJS&&i!==pb.GZipJS&&i!=="gzip")||((t=l.body)instanceof ArrayBuffer?hm(new Uint8Array(t)):ArrayBuffer.isView(t)&&hm(new Uint8Array(t.buffer,t.byteOffset,t.byteLength)))?{url:e.url,encodedBody:l}:(ad=!0,{url:K3(e.url,"compression"),encodedBody:Hb(ye({},e,{compression:void 0,tr:void 0}))})},Z3=(function(){var e=sr((function*(t){var n=il(t.data),i=yield(function(c,u,f){return pm.apply(this,arguments)})(n,xn.DEBUG,{rethrow:!0});if(!i)return t;var l=yield i.arrayBuffer();return ye({},t,{tr:{contentType:ew,body:l,estimatedSize:l.byteLength}})}));return function(t){return e.apply(this,arguments)}})(),qb=(e,t)=>Hd(e,{_:new Date().getTime().toString(),ver:xn.JS_SDK_VERSION,compression:t}),ld=[];dm&&ld.push({transport:"fetch",method(e){var t,{url:n,encodedBody:i}=Np(e),{contentType:l,body:c,estimatedSize:u}=i??{},f=new Headers;zt(e.headers,(function(g,v){f.append(v,g)})),l&&f.append("Content-Type",l);var h=null;if(db){var p=new db;h={signal:p.signal,timeout:setTimeout((()=>p.abort()),e.timeout)}}dm(n,ye({method:(e==null?void 0:e.method)||"GET",headers:f,keepalive:e.method==="POST"&&52428.8>(u||0),body:c,signal:(t=h)==null?void 0:t.signal},e.fetchOptions)).then((g=>g.text().then((v=>{var y={statusCode:g.status,text:v};if(g.status===200)try{y.json=JSON.parse(v)}catch(b){Ne.error(b)}e.callback==null||e.callback(y)})))).catch((g=>{Ne.error(g),e.callback==null||e.callback({statusCode:0,error:g})})).finally((()=>h?clearTimeout(h.timeout):null))}}),fm&&ld.push({transport:"XHR",method(e){var t=new fm,{url:n,encodedBody:i}=Np(e);t.open(e.method||"GET",n,!0);var{contentType:l,body:c}=i??{};zt(e.headers,(function(u,f){t.setRequestHeader(f,u)})),l&&t.setRequestHeader("Content-Type",l),e.timeout&&(t.timeout=e.timeout),e.disableXHRCredentials||(t.withCredentials=!0),t.onreadystatechange=()=>{if(t.readyState===4){var u={statusCode:t.status,text:t.responseText};if(t.status===200)try{u.json=JSON.parse(t.responseText)}catch{}e.callback==null||e.callback(u)}},t.send(c)}}),ar!=null&&ar.sendBeacon&&ld.push({transport:"sendBeacon",method(e){try{var{url:t,encodedBody:n}=Np(e),i=Hd(t,{beacon:"1"}),{contentType:l,body:c}=n??{};if(!c)return;var u=c instanceof Blob?c:new Blob([c],{type:l});ar.sendBeacon(i,u)}catch{}}});var Ym=3e3;class J3{constructor(t,n){this.Xr=!0,this.ei=[],this.ti=Kr((n==null?void 0:n.flush_interval_ms)||Ym,250,5e3,Ne.createLogger("flush interval"),Ym),this.ri=t}enqueue(t){this.ei.push(t),this.ii||this.ni()}unload(){this.si();var t=this.ei.length>0?this.oi():{},n=Object.values(t);[...n.filter((i=>i.url.indexOf("/e")===0)),...n.filter((i=>i.url.indexOf("/e")!==0))].map((i=>{this.ri(ye({},i,{transport:"sendBeacon"}))}))}enable(){this.Xr=!1,this.ni()}ni(){var t=this;this.Xr||(this.ii=setTimeout((()=>{if(this.si(),this.ei.length>0){var n=this.oi(),i=function(){var c=n[l],u=new Date().getTime();c.data&&nt(c.data)&&zt(c.data,(f=>{f.offset=Math.abs(f.timestamp-u),delete f.timestamp})),t.ri(c)};for(var l in n)i()}}),this.ti))}si(){clearTimeout(this.ii),this.ii=void 0}oi(){var t={};return zt(this.ei,(n=>{var i,l=n,c=(l?l.batchKey:null)||l.url;Se(t[c])&&(t[c]=ye({},l,{data:[]})),(i=t[c].data)==null||i.push(l.data)})),this.ei=[],t}}var eC=["retriesPerformedSoFar"];class tC{constructor(t){this.ai=!1,this.ui=3e3,this.ei=[],this._instance=t,this.ei=[],this.li=!0,!Se(ie)&&"onLine"in ie.navigator&&(this.li=ie.navigator.onLine,this.hi=()=>{this.li=!0,this.ci()},this.di=()=>{this.li=!1},Kt(ie,"online",this.hi),Kt(ie,"offline",this.di))}get length(){return this.ei.length}retriableRequest(t){var{retriesPerformedSoFar:n}=t,i=F5(t,eC);ki(n)&&(i.url=Hd(i.url,{retry_count:n})),this._instance._send_request(ye({},i,{callback:l=>{l.statusCode===200||l.statusCode>=400&&500>l.statusCode||(n??0)>=10?i.callback==null||i.callback(l):this.vi(ye({retriesPerformedSoFar:n},i))}}))}vi(t){var n=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=n+1;var i=(function(u){var f=3e3*Math.pow(2,u),h=f/2,p=Math.min(18e5,f),g=Math.random()-.5;return Math.ceil(p+g*(p-h))})(n),l=Date.now()+i;this.ei.push({retryAt:l,requestOptions:t});var c="Enqueued failed request for retry in "+i;navigator.onLine||(c+=" (Browser is offline)"),Ne.warn(c),this.ai||(this.ai=!0,this.fi())}fi(){if(this.pi&&clearTimeout(this.pi),this.ei.length===0)return this.ai=!1,void(this.pi=void 0);this.pi=setTimeout((()=>{this.li&&this.ei.length>0&&this.ci(),this.fi()}),this.ui)}ci(){var t=Date.now(),n=[],i=this.ei.filter((c=>t>c.retryAt||(n.push(c),!1)));if(this.ei=n,i.length>0)for(var{requestOptions:l}of i)this.retriableRequest(l)}unload(){for(var{requestOptions:t}of(this.pi&&(clearTimeout(this.pi),this.pi=void 0),this.ai=!1,Se(ie)||(this.hi&&(ie.removeEventListener("online",this.hi),this.hi=void 0),this.di&&(ie.removeEventListener("offline",this.di),this.di=void 0)),this.ei))try{this._instance._send_request(ye({},t,{transport:"sendBeacon"}))}catch(n){Ne.error(n)}this.ei=[]}}class nC{constructor(t){this.gi=()=>{var n,i,l,c;this.mi||(this.mi={});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),g=(u==null?void 0:u.scrollHeight)||0;this.mi.lastScrollY=Math.ceil(f),this.mi.maxScrollY=Math.max(f,(n=this.mi.maxScrollY)!==null&&n!==void 0?n:0),this.mi.maxScrollHeight=Math.max(h,(i=this.mi.maxScrollHeight)!==null&&i!==void 0?i:0),this.mi.lastContentY=p,this.mi.maxContentY=Math.max(p,(l=this.mi.maxContentY)!==null&&l!==void 0?l:0),this.mi.maxContentHeight=Math.max(g,(c=this.mi.maxContentHeight)!==null&&c!==void 0?c:0)},this._instance=t}get yi(){return this._instance.config.scroll_root_selector}getContext(){return this.mi}resetContext(){var t=this.mi;return setTimeout(this.gi,0),t}startMeasuringScrollPosition(){Kt(ie,"scroll",this.gi,{capture:!0}),Kt(ie,"scrollend",this.gi,{capture:!0}),Kt(ie,"resize",this.gi)}scrollElement(){if(!this.yi)return ie==null?void 0:ie.document.documentElement;var t=nt(this.yi)?this.yi:[this.yi];for(var n of t){var i=ie==null?void 0:ie.document.querySelector(n);if(i)return i}}bi(t){var n=t==="y"?"scrollTop":"scrollLeft";if(this.yi){var i=this.scrollElement();return i&&i[n]||0}return ie?t==="y"?ie.scrollY||ie.pageYOffset||ie.document.documentElement.scrollTop||0:ie.scrollX||ie.pageXOffset||ie.document.documentElement.scrollLeft||0:0}scrollY(){return this.bi("y")}scrollX(){return this.bi("x")}}var rC=e=>V_(e==null?void 0:e.config.mask_personal_data_properties,e==null?void 0:e.config.custom_personal_data_properties);class Ib{constructor(t,n,i,l){this.wi=c=>{var u=this.xi();if(!u||u.sessionId!==c){var f={sessionId:c,props:this.Si(this._instance)};this.ki.register({[Bm]:f})}},this._instance=t,this.Ci=n,this.ki=i,this.Si=l||rC,this.Ci.onSessionId(this.wi)}xi(){return this.ki.props[Bm]}getSetOnceProps(){var t,n=(t=this.xi())==null?void 0:t.props;return n?"r"in n?G_(n):{$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 zt(Sg(this.getSetOnceProps()),((n,i)=>{i==="$current_url"&&(i="url"),t["$session_entry_"+mm(i)]=n})),t}}class Ag{constructor(){this.Ii={}}on(t,n){return this.Ii[t]||(this.Ii[t]=[]),this.Ii[t].push(n),()=>{this.Ii[t]=this.Ii[t].filter((i=>i!==n))}}emit(t,n){for(var i of this.Ii[t]||[])i(n);for(var l of this.Ii["*"]||[])l(t,n)}}var Cp=Vt("[SessionId]");class Vb{on(t,n){return this.Ti.on(t,n)}constructor(t,n,i){var l;if(this.Ei=null,this.Mi=[],this.Ri=void 0,this.Ti=new Ag,this.Pi=(p,g)=>!(!ki(p)||!ki(g))&&Math.abs(p-g)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===Ni)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.qt=t.config,this.ki=t.persistence,this.Oi=void 0,this.Li=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Ai=n||hs,this.Fi=i||hs;var c=this.qt.persistence_name||this.qt.token;if(this._sessionTimeoutMs=1e3*Kr(this.qt.session_idle_timeout_seconds||1800,60,36e3,Cp.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Ni(),this.Di="ph_"+c+"_window_id",this.$i="ph_"+c+"_primary_window_exists",this.qi()){var u=Nn.F(this.Di),f=Nn.F(this.$i);u&&!f?this.Oi=u:Nn.q(this.Di),Nn.N(this.$i,!0)}if((l=this.qt.bootstrap)!=null&&l.sessionID)try{var h=(p=>{var g=this.qt.bootstrap.sessionID.replace(/-/g,"");if(g.length!==32)throw new Error("Not a valid UUID");if(g[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(g.substring(0,12),16)})();this.ji(this.qt.bootstrap.sessionID,new Date().getTime(),h)}catch(p){Cp.error("Invalid sessionID in bootstrap",p)}this.Hi()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return Se(this.Mi)&&(this.Mi=[]),this.Mi.push(t),this.Li&&t(this.Li,this.Oi),()=>{this.Mi=this.Mi.filter((n=>n!==t))}}qi(){return this.qt.persistence!=="memory"&&!this.ki.Tr&&Nn.O()}Ui(t){t!==this.Oi&&(this.Oi=t,this.qi()&&Nn.N(this.Di,t))}Bi(){return this.Oi?this.Oi:this.qi()?Nn.F(this.Di):null}zi(t){var n=this.Ei;return!or(n)&&!or(t)&&5e3>Math.abs(t-n)}ji(t,n,i){var l=n!==this._sessionActivityTimestamp,c=!(t!==this.Li||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=n,this.Li=t,c&&!l||c&&this.zi(n)||(this.Ei=n,this.ki.register({[nl]:[n,t,i]}))}Vi(){var t,n=(t=this.qt)==null?void 0:t.persistence_save_debounce_ms;return ki(n)&&n>0}Wi(){var t;if(!or(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Ei){this.Vi()?this.ki.refreshKey(nl):(this.ki.flush(),this.ki.load());var[,n,i]=this.Zi();n===this.Li&&i===this._sessionStartTimestamp&&(this.Ei=this._sessionActivityTimestamp,this.ki.register({[nl]:[this._sessionActivityTimestamp,(t=this.Li)!==null&&t!==void 0?t:null,this._sessionStartTimestamp]}),this.ki.flush())}}Gi(){var[t]=this.Zi(),n=ki(t)?t:0,i=ki(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(n,i)}Zi(){var t=this.ki.props[nl];return nt(t)&&t.length===2&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Ei=null,clearTimeout(this.Qi),this.Qi=void 0,this.ji(null,null,null)}destroy(){this.Wi(),clearTimeout(this.Qi),this.Qi=void 0,this.Ri&&ie&&(ie.removeEventListener(jd,this.Ri,{capture:!1}),this.Ri=void 0),this.Mi=[]}Hi(){this.Ri=()=>{this.Wi(),this.qi()&&Nn.q(this.$i)},Kt(ie,jd,this.Ri,{capture:!1})}checkAndGetSessionAndWindowId(t,n){if(t===void 0&&(t=!1),n===void 0&&(n=null),this.qt.cookieless_mode===Ni)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=n||new Date().getTime(),[,l,c]=this.Zi(),u=this.Gi(),f=this.Bi(),h=ki(c)&&Math.abs(i-c)>864e5,p=!1,g=!l,v=!g&&!t&&this.Pi(i,u);g||v||h?(l=this.Ai(),f=this.Fi(),Cp.info("new session ID generated",{sessionId:l,windowId:f,changeReason:{noSessionId:g,activityTimeout:v,sessionPastMaximumLength:h}}),c=i,p=!0):f||(f=this.Fi(),p=!0);var y=ki(u)&&t&&!h?u:i,b=ki(c)?c:new Date().getTime();return this.Ui(f),this.ji(l,y,b),t||this.Ni(),p&&this.Mi.forEach((_=>_(l,f,p?{noSessionId:g,activityTimeout:v,sessionPastMaximumLength:h}:void 0))),{sessionId:l,windowId:f,sessionStartTimestamp:b,changeReason:p?{noSessionId:g,activityTimeout:v,sessionPastMaximumLength:h}:void 0,lastActivityTimestamp:u}}Ni(){clearTimeout(this.Qi),this.Qi=setTimeout((()=>{var t=this.Gi();if(this.Pi(new Date().getTime(),t)){var n=this.Li;this.resetSessionId(),this.Ti.emit("forcedIdleReset",{idleSessionId:n})}}),1.1*this.sessionTimeoutMs)}}var tw=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&gb(n,t))return!0;try{var i=e==null?void 0:e.userAgentData;if(i!=null&&i.brands&&i.brands.some((l=>gb(l==null?void 0:l.brand,t))))return!0}catch{}return!!e.webdriver},Rd=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 Gb(e,t,n){return il({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}var nw={exact:(e,t)=>t.some((n=>e.some((i=>n===i)))),is_not:(e,t)=>t.every((n=>e.every((i=>n!==i)))),regex:(e,t)=>t.some((n=>e.some((i=>Rd(n,i))))),not_regex:(e,t)=>t.every((n=>e.every((i=>!Rd(n,i))))),icontains:(e,t)=>t.map(Gu).some((n=>e.map(Gu).some((i=>n.includes(i))))),not_icontains:(e,t)=>t.map(Gu).every((n=>e.map(Gu).every((i=>!n.includes(i))))),gt:(e,t)=>t.some((n=>{var i=parseFloat(n);return!isNaN(i)&&e.some((l=>i>parseFloat(l)))})),lt:(e,t)=>t.some((n=>{var i=parseFloat(n);return!isNaN(i)&&e.some((l=>i<parseFloat(l)))}))},Gu=e=>e.toLowerCase();function rw(e,t){return!e||Object.entries(e).every((n=>{var[i,l]=n,c=t==null?void 0:t[i];if(Se(c)||or(c))return!1;var u=[String(c)],f=nw[l.operator];return!!f&&f(l.values,u)}))}var Wm="custom",Yb="i.posthog.com",iC=/^\/static\//;class sC{constructor(t){this.Ji={},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("."+Yb,".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this.Ji[this.apiHost]||(this.Ji[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":Wm),this.Ji[this.apiHost]}Ki(t){var n=this.instance.config.__preview_external_dependency_versioned_paths;if(typeof n=="string"&&iC.test(t))return n.trim().replace(/\/$/,"")||void 0}endpointFor(t,n){if(n===void 0&&(n=""),n&&(n=n[0]==="/"?n:"/"+n),t==="ui")return this.uiHost+n;if(t==="flags")return this.flagsApiHost+n;if(t==="assets"){var i=this.Ki(n);if(i)return""+i+n}if(this.region===Wm)return this.apiHost+n;var l=Yb+n;switch(t){case"assets":return"https://"+this.region+"-assets."+l;case"api":return"https://"+this.region+"."+l}}}var jt=Vt("[Surveys]"),Xm="seenSurvey_",aC=[wp.Popover,wp.Widget,wp.API],lC={ignoreConditions:!1,ignoreDelay:!1,displayType:qm.Popover},oC=Vt("[PostHog ExternalIntegrations]"),cC={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class uC{constructor(t){this._instance=t}lr(t,n){var i;(i=Le.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,t,(l=>{if(l)return oC.error("failed to load script",l);n()}))}startIfEnabledOrStop(){var t=this,n=function(u){var f,h,p;!l||(f=Le.__PosthogExtensions__)!=null&&(f=f.integrations)!=null&&f[u]||t.lr(cC[u],(()=>{var g;(g=Le.__PosthogExtensions__)==null||(g=g.integrations)==null||(g=g[u])==null||g.start(t._instance)})),!l&&(h=Le.__PosthogExtensions__)!=null&&(h=h.integrations)!=null&&h[u]&&((p=Le.__PosthogExtensions__)==null||(p=p.integrations)==null||(p=p[u])==null||p.stop())};for(var[i,l]of Object.entries((c=this._instance.config.integrations)!==null&&c!==void 0?c:{})){var c;n(i)}}}var Ya,Wo={},Ep=0,Qm=()=>{},Wb='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',No="Surveys module not available",Xb="sanitize_properties is deprecated. Use before_send instead",iw="Invalid value for property_denylist config: ",el="posthog",sw=!Q3&&(Yn==null?void 0:Yn.indexOf("MSIE"))===-1&&(Yn==null?void 0:Yn.indexOf("Mozilla"))===-1,Qb=e=>{var t;return ye({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:m3(Ce==null?void 0:Ce.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Qm,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:jn&&It(jn==null?void 0:jn.search)&&jn.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,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(ie==null||(t=ie.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){Ne.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:Fm,before_send:void 0,request_queue_config:{flush_interval_ms:Ym},error_tracking:{},_onCapture:Qm,__preview_eager_load_replay:!1},(n=>({rageclick:n&&n>="2026-05-30"?{content_ignorelist:N3,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>="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)}))(e))},dC=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["store_google","save_campaign_params"],["verbose","debug"]],Kb=e=>{var t={};for(var[n,i]of dC)Se(e[n])||(t[i]=e[n]);var l=Bt({},t,e);return nt(e.property_blacklist)&&(Se(e.property_denylist)?l.property_denylist=e.property_blacklist:nt(e.property_denylist)?l.property_denylist=[...e.property_blacklist,...e.property_denylist]:Ne.error(iw+e.property_denylist)),l};class fC{constructor(){this.__forceAllowLocalhost=!1}get Yi(){return this.__forceAllowLocalhost}set Yi(t){Ne.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class jr{Xi(t,n){if(t){var i=this.en.indexOf(t);i!==-1&&this.en.splice(i,1)}return this.en.push(n),n.initialize==null||n.initialize(),n}tn(){return this.config.cookieless_mode===Ni||this.config.cookieless_mode===Js&&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 fC,this.rn=!1,this.version=xn.LIB_VERSION,this.nn=new Ag,this.en=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Qb(),this.SentryIntegration=L3,this.sentryIntegration=i=>(function(l,c){var u=U_(l,c);return{name:P_,processEvent:f=>u(f)}})(this,i),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.sn=!1,this.an=null,this.un=null,this.ln=null,this.scrollManager=new nC(this),this.pageViewManager=new zb(this),this.rateLimiter=new I3(this),this.requestRouter=new sC(this),this.consent=new w3(this),this.externalIntegrations=new uC(this);var n=(t=jr.__defaultExtensionClasses)!==null&&t!==void 0?t:{};this.featureFlags=n.featureFlags&&new n.featureFlags(this),this.toolbar=n.toolbar&&new n.toolbar(this),this.surveys=n.surveys&&new n.surveys(this),this.conversations=n.conversations&&new n.conversations(this),this.logs=n.logs&&new n.logs(this),this.experiments=n.experiments&&new n.experiments(this),this.exceptions=n.exceptions&&new n.exceptions(this),this.people={set:(i,l,c)=>{var u=It(i)?{[i]:l}:i;this.setPersonProperties(u),c==null||c({})},set_once:(i,l,c)=>{var u=It(i)?{[i]:l}:i;this.setPersonProperties(void 0,u),c==null||c({})}},this.on("eventCaptured",(i=>Ne.info('send "'+(i==null?void 0:i.event)+'"',i)))}init(t,n,i){if(i&&i!==el){var l,c=(l=Wo[i])!==null&&l!==void 0?l:new jr;return c._init(t,n,i),Wo[i]=c,Wo[el][i]=c,c}return this._init(t,n,i)}_init(t,n,i){var l,c;n===void 0&&(n={});var u=It(t)?t.trim():"";if(!u)return Ne.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 console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},n.debug=this.hn(n.debug),this.cn=n,this.dn=[],n.person_profiles?this.un=n.person_profiles:n.process_person&&(this.un=n.process_person);var f=Qb(n.defaults),h=Kb(n),p=Bt({},f,h,{name:i,token:u});Yt(f.rageclick)&&Yt(h.rageclick)&&(p.rageclick=Bt({},f.rageclick,h.rageclick)),this.set_config(p),this.config.on_xhr_error&&Ne.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:Xr.GZipJS;var g=this.vn();this.persistence=new _p(this.config,g),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new _p(ye({},this.config,{persistence:"sessionStorage"}),g,!1);var v=ye({},this.persistence.props),y=ye({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.fn=new J3((P=>this.pn(P)),this.config.request_queue_config),this.gn=new tC(this),this.__request_queue=[];var b=this.tn();if(b||(this.sessionManager=new Vb(this),this.sessionPropsManager=new Ib(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(Ne.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.mn(b)}),0)):(Ne.info("Initializing extensions synchronously"),this.mn(b)),xn.DEBUG=xn.DEBUG||this.config.debug,xn.DEBUG&&Ne.info("Starting in debug mode",{this:this,config:n,thisC:ye({},this.config),p:v,s:y}),!this.config.identity_distinct_id||(l=n.bootstrap)!=null&&l.distinctID||(n.bootstrap=ye({},n.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((c=n.bootstrap)==null?void 0:c.distinctID)!==void 0){var _=n.bootstrap.distinctID,S=this.get_distinct_id(),T=this.persistence.get_property(zr);if(n.bootstrap.isIdentifiedID&&S!=null&&S!==_&&T===qa)this.identify(_);else if(n.bootstrap.isIdentifiedID&&S!=null&&S!==_&&T===Ia)Ne.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 j=this.config.get_device_id(hs()),R=n.bootstrap.isIdentifiedID?j:_;this.persistence.set_property(zr,n.bootstrap.isIdentifiedID?Ia:qa),this.register({distinct_id:_,$device_id:R})}}if(b)this.register_once({distinct_id:Uu,$device_id:null},"");else if(!this.get_distinct_id()){var C=this.config.get_device_id(hs());this.register_once({distinct_id:C,$device_id:C},""),this.persistence.set_property(zr,qa)}return Kt(ie,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),n.segment?(function(P,z){var D=P.config.segment;if(!D)return z();(function(F,B){var I=F.config.segment;if(!I)return B();var L=E=>{var ae=()=>E.anonymousId()||hs();F.config.get_device_id=ae,E.id()&&(F.register({distinct_id:E.id(),$device_id:ae()}),F.persistence.set_property(zr,Ia)),B()},q=I.user();"then"in q&&ji(q.then)?q.then(L):L(q)})(P,(()=>{D.register((F=>{Promise&&Promise.resolve||yp.warn("This browser does not have Promise support, and can not use the segment integration");var B=(I,L)=>{if(!L)return I;I.event.userId||I.event.anonymousId===F.get_distinct_id()||(yp.info("No userId set, resetting PostHog"),F.reset()),I.event.userId&&I.event.userId!==F.get_distinct_id()&&(yp.info("UserId set, identifying with PostHog"),F.identify(I.event.userId));var q=F.calculateEventProperties(L,I.event.properties);return I.event.properties=Object.assign({},q,I.event.properties),I};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:I=>B(I,I.event.event),page:I=>B(I,Ja),identify:I=>B(I,xp),screen:I=>B(I,"$screen")}})(P)).then((()=>{z()}))}))})(this,(()=>this.yn())):this.yn(),ji(this.config._onCapture)&&this.config._onCapture!==Qm&&(Ne.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(P=>this.config._onCapture(P.event,P)))),this.config.ip&&Ne.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}mn(t){var n,i,l,c,u,f,h,p=performance.now(),g=ye({},jr.__defaultExtensionClasses,this.config.__extensionClasses),v=[];g.featureFlags&&this.en.push(this.featureFlags=(n=this.featureFlags)!==null&&n!==void 0?n:new g.featureFlags(this)),g.exceptions&&this.en.push(this.exceptions=(i=this.exceptions)!==null&&i!==void 0?i:new g.exceptions(this)),g.historyAutocapture&&this.en.push(this.historyAutocapture=new g.historyAutocapture(this)),g.tracingHeaders&&this.en.push(this.tracingHeaders=new g.tracingHeaders(this)),g.siteApps&&this.en.push(this.siteApps=new g.siteApps(this)),g.sessionRecording&&!t&&this.en.push(this.sessionRecording=new g.sessionRecording(this)),this.config.disable_scroll_properties||v.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),g.autocapture&&this.en.push(this.autocapture=new g.autocapture(this)),g.surveys&&this.en.push(this.surveys=(l=this.surveys)!==null&&l!==void 0?l:new g.surveys(this)),g.logs&&this.en.push(this.logs=(c=this.logs)!==null&&c!==void 0?c:new g.logs(this)),g.conversations&&this.en.push(this.conversations=(u=this.conversations)!==null&&u!==void 0?u:new g.conversations(this)),g.productTours&&this.en.push(this.productTours=new g.productTours(this)),g.heatmaps&&this.en.push(this.heatmaps=new g.heatmaps(this)),g.webVitalsAutocapture&&this.en.push(this.webVitalsAutocapture=new g.webVitalsAutocapture(this)),g.exceptionObserver&&this.en.push(this.exceptionObserver=new g.exceptionObserver(this)),g.deadClicksAutocapture&&this.en.push(this.deadClicksAutocapture=new g.deadClicksAutocapture(this,z3)),g.toolbar&&this.en.push(this.toolbar=(f=this.toolbar)!==null&&f!==void 0?f:new g.toolbar(this)),g.experiments&&this.en.push(this.experiments=(h=this.experiments)!==null&&h!==void 0?h:new g.experiments(this)),this.en.forEach((y=>{y.initialize&&v.push((()=>{y.initialize==null||y.initialize()}))})),v.push((()=>{if(this.bn){var y=this.bn;this.bn=void 0,this.Qr(y)}})),this._n(v,p)}_n(t,n){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-n>=30&&t.length>0)return void setTimeout((()=>{this._n(t,n)}),0);var i=t.shift();if(i)try{i()}catch(c){Ne.error("Error initializing extension:",c)}}var l=Math.round(performance.now()-n);this.register_for_session({[k_]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[S_]:l}),this.config.__preview_deferred_init_extensions&&Ne.info("PostHog extensions initialized ("+l+"ms)")}Qr(t){var n;if(!Ce||!Ce.body)return Ne.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Qr(t)}),500);this.config.__preview_deferred_init_extensions&&(this.bn=t),this.wn=t,this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=Ie(t.supportedCompression,Xr.GZipJS)?Xr.GZipJS:Ie(t.supportedCompression,Xr.Base64)?Xr.Base64:void 0),(n=t.analytics)!=null&&n.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this.un?this.un:Fm}),this.en.forEach((i=>i.onRemoteConfig==null?void 0:i.onRemoteConfig(t)))}yn(){try{this.config.loaded(this)}catch(i){Ne.critical("`loaded` function failed",i)}if(this.xn(),this.config.internal_or_test_user_hostname&&jn!=null&&jn.hostname){var t=jn.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.tn())&&this.Sn()}),1),this.kn=new W_(this),this.kn.load()}xn(){var t;this.is_capturing()&&this.config.request_batching&&((t=this.fn)==null||t.enable())}_dom_loaded(){this.is_capturing()&&Fu(this.__request_queue,(t=>this.pn(t))),this.__request_queue=[],this.xn()}_handle_unload(){var t,n,i,l;(t=this.surveys)==null||t.handlePageUnload(),this.config.request_batching?(this.Cn()&&this.capture(gp),(n=this.logs)==null||n.flushLogs("sendBeacon"),(i=this.fn)==null||i.unload(),(l=this.gn)==null||l.unload()):this.Cn()&&this.capture(gp,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded&&(sw?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)||(t.transport=t.transport||this.config.api_transport,t.url=Hd(t.url,{ip:this.config.ip?1:0}),t.headers=ye({},this.config.request_headers,t.headers),t.compression=t.compression==="best-available"?this.compression:t.compression,t.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(n=>{var i,l,c,u=ye({},n);u.timeout=u.timeout||6e4,u.url=qb(u.url,u.compression);var f=(i=u.transport)!==null&&i!==void 0?i:"fetch",h=ld.filter((g=>!u.disableTransport||!g.transport||!u.disableTransport.includes(g.transport))),p=(l=(c=(function(g,v){for(var y=0;g.length>y;y++)if(g[y].transport===f)return g[y]})(h))==null?void 0:c.method)!==null&&l!==void 0?l:h[0].method;if(!p)throw new Error("No available transport method");f!=="sendBeacon"&&u.data&&u.compression===Xr.GZipJS&&SN&&!ad?Z3(u).then((g=>{p(g)})).catch((g=>{if(mb(g))return ad=!0,void p(ye({},u,{compression:void 0,url:qb(n.url,void 0)}));(v=>{if(!v||typeof v!="object")return!1;var y="name"in v?String(v.name):"";return mb(v)||y===H5})(g)&&(ad=!0),p(u)})):p(u)})(ye({},t,{callback:n=>{var i,l;this.rateLimiter.checkForLimiting(n),400>n.statusCode||(i=(l=this.config).on_request_error)==null||i.call(l,n),t.callback==null||t.callback(n)}}))))}pn(t){this.gn?this.gn.retriableRequest(t):this._send_request(t)}_execute_array(t){Ep++;try{var n,i=[],l=[],c=[];Fu(t,(f=>{if(f)if(nt(n=f[0]))c.push(f);else if(ji(f))try{f.call(this)}catch(h){Ne.error("Error executing queued PostHog call",f,h)}else nt(f)&&n==="alias"?i.push(f):nt(f)&&n.indexOf("capture")!==-1&&ji(this[n])?c.push(f):l.push(f)}));var u=function(f,h){Fu(f,(function(p){try{if(nt(p[0])){var g=h;zt(p,(function(v){g=g[v[0]].apply(g,v.slice(1))}))}else h[p[0]].apply(h,p.slice(1))}catch(v){Ne.error("Error executing queued PostHog call",p,v)}}))};u(i,this),u(l,this),u(c,this)}finally{Ep--}}push(t){if(Ep>0&&nt(t)&&It(t[0])){var n=jr.prototype[t[0]];ji(n)&&n.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,n,i){var l,c,u,f,h;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.fn){if(this.is_capturing())if(!Se(t)&&It(t)){var p=!this.config.opt_out_useragent_filter&&this._is_bot();if(!p||this.config.__preview_capture_bot_pageviews){var g=i!=null&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(g==null||!g.isRateLimited){n!=null&&n.$current_url&&!It(n==null?void 0:n.$current_url)&&(Ne.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),n==null||delete n.$current_url),t!=="$exception"||i!=null&&i.In||Ne.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 v=new Date,y=(i==null?void 0:i.timestamp)||v,b=(i==null?void 0:i.uuid)||hs(),_={uuid:b,event:t,properties:this.calculateEventProperties(t,n||{},y,b)};t===Ja&&this.config.__preview_capture_bot_pageviews&&p&&(_.event="$bot_pageview",_.properties.$browser_type="bot"),g&&(_.properties.$lib_rate_limit_remaining_tokens=g.remainingTokens),i!=null&&i.$set&&(_.$set=i==null?void 0:i.$set);var S,T,j,R=this.Tn(i==null?void 0:i.$set_once,t!==kb,t===xp);if(R&&(_.$set_once=R),i!=null&&i._noTruncate||(c=this.config.properties_string_max_length,u=_,f=I=>It(I)?I.slice(0,c):I,h=new Set,_=(function I(L,q){return L!==Object(L)?f?f(L):L:h.has(L)?void 0:(h.add(L),nt(L)?(E=[],Fu(L,(ae=>{E.push(I(ae))}))):(E={},zt(L,((ae,K)=>{h.has(ae)||(E[K]=I(ae))}))),E);var E})(u)),_.timestamp=y,Se(i==null?void 0:i.timestamp)||(_.properties.$event_time_override_provided=!0,_.properties.$event_time_override_system_time=v),t===Po.DISMISSED||t===Po.SENT){var C=n==null?void 0:n[kp.SURVEY_ID],P=n==null?void 0:n[kp.SURVEY_ITERATION];(I=>{try{var L=(q=>((E,ae)=>{var K=""+Xm+ae.id;return ae.current_iteration&&ae.current_iteration>0&&(K=""+Xm+ae.id+"_"+ae.current_iteration),K})(0,q))(I);if(localStorage.getItem(L))return;localStorage.setItem(L,"true")}catch(q){jt.error("Failed to persist survey seen state",q)}})({id:C,current_iteration:P}),_.$set=ye({},_.$set,{[(S={id:C,current_iteration:P},T=t===Po.SENT?"responded":"dismissed",j="$survey_"+T+"/"+S.id,S.current_iteration&&S.current_iteration>0&&(j="$survey_"+T+"/"+S.id+"/"+S.current_iteration),j)]:!0})}else t===Po.SHOWN&&(_.$set=ye({},_.$set,{[kp.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(t===q3.SHOWN){var z=n==null?void 0:n[Ob.TOUR_TYPE];z&&(_.$set=ye({},_.$set,{[Ob.TOUR_LAST_SEEN_DATE+"/"+z]:new Date().toISOString()}))}var D=ye({},_.properties.$set,_.$set);if(ps(D)||this.setPersonPropertiesForFlags(D),!rt(this.config.before_send)){var F=this.En(_);if(!F)return;_=F}this.nn.emit("eventCaptured",_);var B={method:"POST",url:(l=i==null?void 0:i._url)!==null&&l!==void 0?l:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:_,compression:"best-available",batchKey:i==null?void 0:i._batchKey,transport:i==null?void 0:i.transport};return!this.config.request_batching||i&&(i==null||!i._batchKey)||i!=null&&i.send_instantly?this.pn(B):this.fn.enqueue(B),_}Ne.critical("This capture call is ignored due to client rate limiting.")}}else Ne.error("No event name provided to posthog.capture")}else Ne.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(n=>t(n.event,n)))}calculateEventProperties(t,n,i,l,c){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return n;var u=c?void 0:this.persistence.remove_event_timer(t),f=ye({},n);if(f.token=this.config.token,f.$config_defaults=this.config.defaults,this.tn()&&(f.$cookieless_mode=!0),t==="$snapshot"){var h=ye({},this.persistence.properties(),this.sessionPersistence.properties());return f.distinct_id=h.distinct_id,(!It(f.distinct_id)&&!Bn(f.distinct_id)||gm(f.distinct_id))&&Ne.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),f}var p,g=(function(j,R,C){var P,z,D,F;if(!Yn)return{};var B,I,L,q,E,ae,K,Y,U,$=j?[...dl,...R||[]]:[],[re,xe]=(function(A){for(var fe=0;bb.length>fe;fe++){var[_e,je]=bb[fe],De=_e.exec(A),oe=De&&(ji(je)?je(De,A):je);if(oe)return oe}return["",""]})(Yn),M=(B=typeof navigator<"u"?navigator:void 0)!=null&&B.brave?{brave:!0}:{},O={detectGoogleSearchApp:C},Z=Bt(Sg({$os:re,$os_version:xe,$browser:d_(Yn,navigator.vendor,M,O),$device:yb(Yn),$device_type:(L=Yn,q={userAgentDataPlatform:(P=navigator)==null||(P=P.userAgentData)==null?void 0:P.platform,maxTouchPoints:(z=navigator)==null?void 0:z.maxTouchPoints,screenWidth:ie==null||(D=ie.screen)==null?void 0:D.width,screenHeight:ie==null||(F=ie.screen)==null?void 0:F.height,devicePixelRatio:ie==null?void 0:ie.devicePixelRatio},U=yb(L),U===Y5||U===G5||U==="Kobo"||U==="Kindle Fire"||U===a_?ol:U===nc||U===al||U===rc||U===vm?"Console":U===X5?"Wearable":U?cr:(q==null?void 0:q.userAgentDataPlatform)==="Android"&&((E=q==null?void 0:q.maxTouchPoints)!==null&&E!==void 0?E:0)>0?600>Math.min((ae=q==null?void 0:q.screenWidth)!==null&&ae!==void 0?ae:0,(K=q==null?void 0:q.screenHeight)!==null&&K!==void 0?K:0)/((Y=q==null?void 0:q.devicePixelRatio)!==null&&Y!==void 0?Y:1)?cr:ol:"Desktop"),$timezone:Y_(),$timezone_offset:U3()}),{$current_url:lc(jn==null?void 0:jn.href,$,oc),$host:jn==null?void 0:jn.host,$pathname:jn==null?void 0:jn.pathname,$raw_user_agent:Yn.length>1e3?Yn.substring(0,997)+"...":Yn,$browser_version:FN(Yn,navigator.vendor,M,O),$browser_language:Lb(),$browser_language_prefix:(I=Lb(),typeof I=="string"?I.split("-")[0]:void 0),$screen_height:ie==null?void 0:ie.screen.height,$screen_width:ie==null?void 0:ie.screen.width,$viewport_height:ie==null?void 0:ie.innerHeight,$viewport_width:ie==null?void 0:ie.innerWidth,$lib:xn.LIB_NAME,$lib_version:xn.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return xn.SDK_DIST_CHANNEL&&(Z.$sdk_dist_channel=xn.SDK_DIST_CHANNEL),Z})(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app);if(this.sessionManager){var{sessionId:v,windowId:y}=this.sessionManager.checkAndGetSessionAndWindowId(c,i.getTime());f.$session_id=v,f.$window_id=y}this.sessionPropsManager&&Bt(f,this.sessionPropsManager.getSessionProps());try{var b;this.sessionRecording&&Bt(f,this.sessionRecording.sdkDebugProperties),f.$sdk_debug_retry_queue_size=(b=this.gn)==null?void 0:b.length}catch(j){f.$sdk_debug_error_capturing_properties=String(j)}if(this.requestRouter.region===Wm&&(f.$lib_custom_api_host=this.config.api_host),p=t!==Ja||c?t!==gp||c?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,l),f=Bt(f,p),t===Ja&&Ce&&(f.title=Ce.title),!Se(u)){var _=i.getTime()-u;f.$duration=parseFloat((_/1e3).toFixed(3))}Yn&&this.config.opt_out_useragent_filter&&(f.$browser_type=this._is_bot()?"bot":"browser"),(f=Bt({},g,this.persistence.properties(),this.sessionPersistence.properties(),f)).$is_identified=this._isIdentified(),nt(this.config.property_denylist)?zt(this.config.property_denylist,(function(j){delete f[j]})):Ne.error(iw+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var S=this.config.sanitize_properties;S&&(Ne.error(Xb),f=S(f,t));var T=this.Mn();return f.$process_person_profile=T,T&&!c&&this.Rn("_calculate_event_properties"),f}Tn(t,n,i){var l;if(n===void 0&&(n=!0),i===void 0&&(i=!1),!this.persistence||!this.Mn()||this.rn&&!i)return t;var c=this.persistence.get_initial_props(),u=(l=this.sessionPropsManager)==null?void 0:l.getSetOnceProps(),f=Bt({},c,u||{},t||{}),h=this.config.sanitize_properties;return h&&(Ne.error(Xb),f=h(f,"$set_once")),n&&(this.rn=!0),ps(f)?void 0:f}register(t,n){var i;(i=this.persistence)==null||i.register(t,n)}register_once(t,n,i){var l;(l=this.persistence)==null||l.register_once(t,n,i)}register_for_session(t){var n;(n=this.sessionPersistence)==null||n.register(t)}unregister(t){var n;(n=this.persistence)==null||n.unregister(t)}unregister_for_session(t){var n;(n=this.sessionPersistence)==null||n.unregister(t)}Pn(t,n){this.register({[t]:n})}getFeatureFlag(t,n){var i;return(i=this.featureFlags)==null?void 0:i.getFeatureFlag(t,n)}getFeatureFlagPayload(t){var n;return(n=this.featureFlags)==null?void 0:n.getFeatureFlagPayload(t)}getFeatureFlagResult(t,n){var i;return(i=this.featureFlags)==null?void 0:i.getFeatureFlagResult(t,n)}isFeatureEnabled(t,n){var i;return(i=this.featureFlags)==null?void 0:i.isFeatureEnabled(t,n)}reloadFeatureFlags(){var t;(t=this.featureFlags)==null||t.reloadFeatureFlags()}updateFlags(t,n,i){var l;(l=this.featureFlags)==null||l.updateFlags(t,n,i)}updateEarlyAccessFeatureEnrollment(t,n,i){var l;(l=this.featureFlags)==null||l.updateEarlyAccessFeatureEnrollment(t,n,i)}getEarlyAccessFeatures(t,n,i){var l;return n===void 0&&(n=!1),(l=this.featureFlags)==null?void 0:l.getEarlyAccessFeatures(t,n,i)}on(t,n){return this.nn.on(t,n)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:No}),()=>{})}onSessionId(t){var n,i;return(n=(i=this.sessionManager)==null?void 0:i.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:No})}getActiveMatchingSurveys(t,n){n===void 0&&(n=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,n):t([],{isLoaded:!1,error:No})}renderSurvey(t,n){var i;(i=this.surveys)==null||i.renderSurvey(t,n)}displaySurvey(t,n){var i;n===void 0&&(n=lC),(i=this.surveys)==null||i.displaySurvey(t,n)}cancelPendingSurvey(t){var n;(n=this.surveys)==null||n.cancelPendingSurvey(t)}canRenderSurvey(t){var n,i;return(n=(i=this.surveys)==null?void 0:i.canRenderSurvey(t))!==null&&n!==void 0?n:{visible:!1,disabledReason:No}}canRenderSurveyAsync(t,n){var i,l;return n===void 0&&(n=!1),(i=(l=this.surveys)==null?void 0:l.canRenderSurveyAsync(t,n))!==null&&i!==void 0?i:Promise.resolve({visible:!1,disabledReason:No})}On(t){return!t||gm(t)?(Ne.critical("Unique user id has not been set in posthog.identify"),!1):t===Uu?(Ne.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())||(Ne.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(t,n,i){if(!this.__loaded||!this.persistence)return Ne.uninitializedWarning("posthog.identify");if(Bn(t)&&(t=t.toString(),Ne.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.On(t)&&this.Rn("posthog.identify")){var l=this.get_distinct_id();this.register({$user_id:t}),this.get_property(_d)||this.register_once({$had_persisted_distinct_id:!0,$device_id:l},""),t!==l&&t!==this.get_property(Lo)&&(this.unregister(Lo),this.register({distinct_id:t}));var c,u=(this.persistence.get_property(zr)||qa)===qa;t!==l&&u?(this.persistence.set_property(zr,Ia),this.setPersonPropertiesForFlags({$set:n||{},$set_once:i||{}},!1),this.capture(xp,{distinct_id:t,$anon_distinct_id:l},{$set:n||{},$set_once:i||{}}),this.ln=Gb(t,n,i),(c=this.featureFlags)==null||c.setAnonymousDistinctId(l)):(n||i)&&this.setPersonProperties(n,i),t!==l&&(this.reloadFeatureFlags(),this.unregister(Vo))}}setPersonProperties(t,n){if((t||n)&&this.Rn("posthog.setPersonProperties")){var i=Gb(this.get_distinct_id(),t,n);this.ln!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:n||{}},!0),this.capture("$set",{$set:t||{},$set_once:n||{}}),this.ln=i):Ne.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(t,n,i){if(t&&n){var l=this.getGroups(),c=l[t]!==n;if(c&&this.resetGroupPropertiesForFlags(t),this.register({$groups:ye({},l,{[t]:n})}),c||i){var u={$group_type:t,$group_key:n};i&&(u.$group_set=i),this.capture(kb,u)}i&&this.setGroupPropertiesForFlags({[t]:i}),c&&!i&&this.reloadFeatureFlags()}else Ne.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,n){var i;n===void 0&&(n=!0),(i=this.featureFlags)==null||i.setPersonPropertiesForFlags(t,n)}resetPersonPropertiesForFlags(){var t;(t=this.featureFlags)==null||t.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(t,n){var i;n===void 0&&(n=!0),this.Rn("posthog.setGroupPropertiesForFlags")&&((i=this.featureFlags)==null||i.setGroupPropertiesForFlags(t,n))}resetGroupPropertiesForFlags(t){var n;(n=this.featureFlags)==null||n.resetGroupPropertiesForFlags(t)}reset(t){var n,i,l,c,u,f,h,p;if(Ne.info("reset"),!this.__loaded)return Ne.uninitializedWarning("posthog.reset");var g,v=this.get_property(_d),y=this.get_property(ea);if(this.consent.reset(),(n=this.persistence)==null||n.clear(),(i=this.sessionPersistence)==null||i.clear(),Se(y)||(g=this.persistence)==null||g.register({[ea]:y}),(l=this.surveys)==null||l.reset(),(c=this.kn)==null||c.stop(),(u=this.featureFlags)==null||u.reset(),(f=this.conversations)==null||f.reset(),(h=this.persistence)==null||h.set_property(zr,qa),(p=this.sessionManager)==null||p.resetSessionId(),this.ln=null,this.config.cookieless_mode===Ni)this.register_once({distinct_id:Uu,$device_id:null},"");else{var b=this.config.get_device_id(hs());this.register_once({distinct_id:b,$device_id:t?b:v},"")}this.register({$last_posthog_reset:new Date().toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}setIdentity(t,n){var i;this.config.identity_distinct_id=t,this.config.identity_hash=n,this.alias(t),(i=this.conversations)==null||i.Ln()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,(t=this.conversations)==null||t.An()}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{sessionId:n,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),l=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+n);if(t!=null&&t.withTimestamp&&i){var c,u=(c=t.timestampLookBack)!==null&&c!==void 0?c:10;if(!i)return l;l+="?t="+Math.max(Math.floor((new Date().getTime()-i)/1e3)-u,0)}return l}alias(t,n){return t===this.get_property(x_)?(Ne.critical("Attempting to create alias for existing People user - aborting."),-2):this.Rn("posthog.alias")?(Se(n)&&(n=this.get_distinct_id()),t!==n?(this.Pn(Lo,t),this.capture("$create_alias",{alias:t,distinct_id:n})):(Ne.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var n=ye({},this.config);if(Yt(t)){var i,l,c,u,f,h,p,g,v,y,b;Bt(this.config,Kb(t));var _=this.vn();(i=this.persistence)==null||i.update_config(this.config,n,_),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new _p(ye({},this.config,{persistence:"sessionStorage"}),_,!1);var S=this.hn(this.config.debug);Zr(S)&&(this.config.debug=S),Zr(this.config.debug)&&(this.config.debug?(xn.DEBUG=!0,Et.O()&&Et.N("ph_debug",!0),Ne.info("set_config",{config:t,oldConfig:n,newConfig:ye({},this.config)})):(xn.DEBUG=!1,Et.O()&&Et.q("ph_debug"))),(l=this.exceptionObserver)==null||l.onConfigChange(),(c=this.exceptions)==null||c.onConfigChange(),(u=this.sessionRecording)==null||u.startIfEnabledOrStop(),(f=this.tracingHeaders)==null||f.startIfEnabledOrStop(),(h=this.autocapture)==null||h.startIfEnabled(),(p=this.heatmaps)==null||p.startIfEnabled(),(g=this.exceptionObserver)==null||g.startIfEnabledOrStop(),(v=this.deadClicksAutocapture)==null||v.startIfEnabledOrStop(),(y=this.surveys)==null||y.loadIfEnabled(),this.Fn(),(b=this.externalIntegrations)==null||b.startIfEnabledOrStop()}}_overrideSDKInfo(t,n){xn.LIB_NAME=t,xn.LIB_VERSION=n}startSessionRecording(t){var n,i,l,c,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&&((i=this.sessionRecording)==null||i.overrideSampling()),h.linked_flag&&((l=this.sessionRecording)==null||l.overrideLinkedFlag()),h.url_trigger&&((c=this.sessionRecording)==null||c.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 i=new Error("PostHog syntheticException"),l=this.exceptions.buildProperties(t,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(ye({},l,n))}}addExceptionStep(t,n){var i;(i=this.exceptions)==null||i.addExceptionStep(t,n)}captureLog(t){var n;(n=this.logs)==null||n.captureLog(t)}get logger(){var t,n;return(t=(n=this.logs)==null?void 0:n.logger)!==null&&t!==void 0?t:jr.Nn}startExceptionAutocapture(t){this.set_config({capture_exceptions:t==null||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var n,i;return(n=(i=this.toolbar)==null?void 0:i.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:el;return n!==el&&(n=el+"."+n),n}_isIdentified(){var t,n;return((t=this.persistence)==null?void 0:t.get_property(zr))===Ia||((n=this.sessionPersistence)==null?void 0:n.get_property(zr))===Ia}Mn(){var t,n;return!(this.config.person_profiles==="never"||this.config.person_profiles===Fm&&!this._isIdentified()&&ps(this.getGroups())&&((t=this.persistence)==null||(t=t.props)==null||!t[Lo])&&((n=this.persistence)==null||(n=n.props)==null||!n[kd]))}Cn(){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.Mn()||this.Rn("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Rn("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Rn(t){return this.config.person_profiles==="never"?(Ne.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Pn(kd,!0),!0)}vn(){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!==Js)}Fn(){var t,n,i,l,c=this.vn();return((t=this.persistence)==null?void 0:t.Tr)!==c&&((i=this.persistence)==null||i.set_disabled(c)),((n=this.sessionPersistence)==null?void 0:n.Tr)!==c&&((l=this.sessionPersistence)==null||l.set_disabled(c)),c}opt_in_capturing(t){var n;if(this.config.cookieless_mode!==Ni){if(this.tn()){var i,l,c,u,f;this.reset(!0),(i=this.sessionManager)==null||i.destroy(),(l=this.pageViewManager)==null||l.destroy(),this.sessionManager=new Vb(this),this.pageViewManager=new zb(this),this.persistence&&(this.sessionPropsManager=new Ib(this,this.sessionManager,this.persistence));var h,p=(c=(u=this.config.__extensionClasses)==null?void 0:u.sessionRecording)!==null&&c!==void 0?c:(f=jr.__defaultExtensionClasses)==null?void 0:f.sessionRecording;p&&(this.sessionRecording=this.Xi(this.sessionRecording,new p(this)),this.wn&&((h=this.sessionRecording)==null||h.onRemoteConfig==null||h.onRemoteConfig(this.wn)))}var g,v;this.consent.optInOut(!0),this.Fn(),this.xn(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),this.config.cookieless_mode==Js&&((g=this.surveys)==null||g.loadIfEnabled()),(Se(t==null?void 0:t.captureEventName)||t!=null&&t.captureEventName)&&this.capture((v=t==null?void 0:t.captureEventName)!==null&&v!==void 0?v:"$opt_in",t==null?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Sn()}else Ne.warn(Wb)}opt_out_capturing(){var t,n,i;this.config.cookieless_mode!==Ni?(this.config.cookieless_mode===Js&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.Fn(),this.config.cookieless_mode===Js&&(this.register({distinct_id:Uu,$device_id:null}),(t=this.sessionRecording)==null||t.stopRecording(),this.sessionRecording=void 0,(n=this.sessionManager)==null||n.destroy(),(i=this.pageViewManager)==null||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.Sn(),this.xn())):Ne.warn(Wb)}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===Ni||(this.config.cookieless_mode===Js?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Fn()}_is_bot(){return ar?tw(ar,this.config.custom_blocked_useragents):void 0}Sn(){Ce&&(Ce.visibilityState==="visible"?this.sn||(this.sn=!0,this.capture(Ja,{title:Ce.title},{send_instantly:!0}),this.an&&(Ce.removeEventListener(Sd,this.an),this.an=null)):this.an||(this.an=this.Sn.bind(this),Kt(Ce,Sd,this.an)))}debug(t){t===!1?(ie==null||ie.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(ie==null||ie.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}))}Kr(){var t,n,i,l,c,u,f=this.cn||{};return"advanced_disable_flags"in f?!!f.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(Ne.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):(i="advanced_disable_decide",l=Ne,c=(n="advanced_disable_flags")in(t=f)&&!rt(t[n]),u=i in t&&!rt(t[i]),c?t[n]:!!u&&(l&&l.warn("Config field '"+i+"' is deprecated. Please use '"+n+"' instead. The old field will be removed in a future major version."),t[i]))}En(t){if(rt(this.config.before_send))return t;var n=nt(this.config.before_send)?this.config.before_send:[this.config.before_send],i=t;for(var l of n){if(i=l(i),rt(i)){var c="Event '"+t.event+"' was rejected in beforeSend function";return TN(t.event)?Ne.warn(c+". This can cause unexpected behavior."):Ne.info(c),null}i.properties&&!ps(i.properties)||Ne.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}return i}getPageViewId(){var t;return(t=this.pageViewManager.dr)==null?void 0:t.pageViewId}captureTraceFeedback(t,n){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:n})}captureTraceMetric(t,n,i){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:n,$ai_metric_value:String(i)})}hn(t){var n=Zr(t)&&!t,i=Et.O()&&Et.A("ph_debug")==="true";return!n&&(!!i||t)}}jr.__defaultExtensionClasses={},jr.Nn={trace:Ya=()=>{},debug:Ya,info:Ya,warn:Ya,error:Ya,fatal:Ya},(function(e,t){for(var n=0;t.length>n;n++)e.prototype[t[n]]=h3(e.prototype[t[n]])})(jr,["identify"]);class Zb{constructor(t){this.disabled=t===!1;var n=Yt(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,i){if(this.disabled)return!1;var l=this.clicks[this.clicks.length-1];if(l&&Math.abs(t-l.x)+Math.abs(n-l.y)<this.thresholdPx&&this.timeoutMs>i-l.timestamp){if(this.clicks.push({x:t,y:n,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:n,timestamp:i}];return!1}}var Tp="$copy_autocapture",Ap=Vt("[AutoCapture]");function Mp(e,t){return t.length>e?t.slice(0,e)+"...":t}function hC(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!xs(t));return t}function pC(e,t){var n,i,{e:l,maskAllElementAttributes:c,maskAllText:u,elementAttributeIgnoreList:f,elementsChainAsString:h}=t;if(!xs(e))return{props:{}};for(var p=[e],g=e;g.parentNode&&!lr(g,"body");)if(T_(g.parentNode))p.push(g.parentNode.host),g=g.parentNode.host;else{if(!xs(g.parentNode))break;p.push(g.parentNode),g=g.parentNode}var v,y,b=[],_={},S=!1,T=!1;if(zt(p,(z=>{var D=Hm(z);if(lr(z,"a")){var F=z.getAttribute("href");S=D&&!!F&&Go(F)&&F}Ie(Cd(z),"ph-no-capture")&&(T=!0),b.push((function(I,L,q,E){var ae=I.tagName.toLowerCase(),K={tag_name:ae};Ng.indexOf(ae)>-1&&!q&&(K.$el_text=ae.toLowerCase()==="a"||ae.toLowerCase()==="button"?Mp(1024,Mb(I)):Mp(1024,sc(I)));var Y=Cd(I);Y.length>0&&(K.classes=Y.filter((function(xe){return xe!==""}))),zt(I.attributes,(function(xe){var M;if((!L_(I)||["name","id","class","aria-label"].indexOf(xe.name)!==-1)&&(E==null||!E.includes(xe.name))&&!L&&Go(xe.value)&&(!It(M=xe.name)||M.substring(0,10)!=="_ngcontent"&&M.substring(0,7)!=="_nghost")){var O=xe.value;xe.name==="class"&&(O=jg(O).join(" ")),K["attr__"+xe.name]=Mp(1024,O)}}));for(var U=1,$=1,re=I;re=hC(re);)U++,re.tagName===I.tagName&&$++;return K.nth_child=U,K.nth_of_type=$,K})(z,c,u,f));var B=(function(I){if(!Hm(I))return{};var L={};return zt(I.attributes,(function(q){if(q.name&&q.name.indexOf("data-ph-capture-attribute")===0){var E=q.name.replace("data-ph-capture-attribute-",""),ae=q.value;E&&ae&&Go(ae)&&(L[E]=ae)}})),L})(z);Bt(_,B)})),T)return{props:{},explicitNoCapture:T};if(u||(b[0].$el_text=lr(e,"a")||lr(e,"button")?Mb(e):sc(e)),S){var j,R;b[0].attr__href=S;var C=(j=Ed(S))==null?void 0:j.host,P=ie==null||(R=ie.location)==null?void 0:R.host;C&&P&&C!==P&&(v=S)}return{props:Bt({$event_type:l.type,$ce_version:1},h?{}:{$elements:b},{$elements_chain:(y=b,(function(z){return z.map((D=>{var F,B,I="";if(D.tag_name&&(I+=D.tag_name),D.attr_class)for(var L of(D.attr_class.sort(),D.attr_class))I+="."+L.replace(/"/g,"");var q=ye({},D.text?{text:D.text}:{},{"nth-child":(F=D.nth_child)!==null&&F!==void 0?F:0,"nth-of-type":(B=D.nth_of_type)!==null&&B!==void 0?B:0},D.href?{href:D.href}:{},D.attr_id?{attr_id:D.attr_id}:{},D.attributes),E={};return sd(q).sort(((ae,K)=>{var[Y]=ae,[U]=K;return Y.localeCompare(U)})).forEach((ae=>{var[K,Y]=ae;return E[Rb(K.toString())]=Rb(Y.toString())})),(I+=":")+sd(E).map((ae=>{var[K,Y]=ae;return K+'="'+Y+'"'})).join("")})).join(";")})((function(z){return z.map((D=>{var F,B,I={text:(F=D.$el_text)==null?void 0:F.slice(0,400),tag_name:D.tag_name,href:(B=D.attr__href)==null?void 0:B.slice(0,2048),attr_class:R3(D),attr_id:D.attr__id,nth_child:D.nth_child,nth_of_type:D.nth_of_type,attributes:{}};return sd(D).filter((L=>{var[q]=L;return q.indexOf("attr__")===0})).forEach((L=>{var[q,E]=L;return I.attributes[q]=E})),I}))})(y)))},(n=b[0])!=null&&n.$el_text?{$el_text:(i=b[0])==null?void 0:i.$el_text}:{},v&&l.type==="click"?{$external_click_url:v}:{},_)}}var Co=Vt("[ExceptionAutocapture]"),mC=Vt("[TracingHeaders]"),Ys=Vt("[Web Vitals]"),Jb=9e5,ey="disabled",ty="lazy_loading",Eo="awaiting_config",Yu="missing_config";Vt("[SessionRecording]"),Vt("[SessionRecording]");var Km="[SessionRecording]",bi=Vt(Km),gC=Vt("[Heatmaps]");function ny(e){return Yt(e)&&"clientX"in e&&"clientY"in e&&Bn(e.clientX)&&Bn(e.clientY)}var ry=Vt("[Product Tours]"),xC=["$set_once","$set"],us=Vt("[SiteApps]"),iy="Error while initializing PostHog app with config id ";function Wa(e,t,n){if(rt(e))return!1;switch(n){case"exact":return e===t;case"contains":var i=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(i,"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch{return!1}default:return!1}}class vC{constructor(t){this.Dn=new Ag,this.$n=(n,i)=>this.qn(n,i)&&this.jn(n,i)&&this.Hn(n,i)&&this.Un(n,i),this.qn=(n,i)=>i==null||!i.event||(n==null?void 0:n.event)===(i==null?void 0:i.event),this._instance=t,this.Bn=new Set,this.zn=new Set}init(){var t,n;Se((t=this._instance)==null?void 0:t._addCaptureHook)||(n=this._instance)==null||n._addCaptureHook(((i,l)=>{this.on(i,l)}))}register(t){var n,i;if(!Se((n=this._instance)==null?void 0:n._addCaptureHook)&&(t.forEach((u=>{var f,h;(f=this.zn)==null||f.add(u),(h=u.steps)==null||h.forEach((p=>{var g;(g=this.Bn)==null||g.add((p==null?void 0:p.event)||"")}))})),(i=this._instance)!=null&&i.autocapture)){var l,c=new Set;t.forEach((u=>{var f;(f=u.steps)==null||f.forEach((h=>{h!=null&&h.selector&&c.add(h==null?void 0:h.selector)}))})),(l=this._instance)==null||l.autocapture.setElementSelectors(c)}}on(t,n){var i;n!=null&&t.length!=0&&(this.Bn.has(t)||this.Bn.has(n==null?void 0:n.event))&&this.zn&&((i=this.zn)==null?void 0:i.size)>0&&this.zn.forEach((l=>{this.Vn(n,l)&&this.Dn.emit("actionCaptured",l.name)}))}Wn(t){this.onAction("actionCaptured",(n=>t(n)))}Vn(t,n){if((n==null?void 0:n.steps)==null)return!1;for(var i of n.steps)if(this.$n(t,i))return!0;return!1}onAction(t,n){return this.Dn.on(t,n)}jn(t,n){if(n!=null&&n.url){var i,l=t==null||(i=t.properties)==null?void 0:i.$current_url;if(!l||typeof l!="string"||!Wa(l,n.url,n.url_matching||"contains"))return!1}return!0}Hn(t,n){return!!this.Zn(t,n)&&!!this.Gn(t,n)&&!!this.Qn(t,n)}Zn(t,n){var i;if(n==null||!n.href)return!0;var l=this.Jn(t);if(l.length>0)return l.some((f=>Wa(f.href,n.href,n.href_matching||"exact")));var c,u=(t==null||(i=t.properties)==null?void 0:i.$elements_chain)||"";return!!u&&Wa((c=u.match(/(?::|")href="(.*?)"/))?c[1]:"",n.href,n.href_matching||"exact")}Gn(t,n){var i;if(n==null||!n.text)return!0;var l=this.Jn(t);if(l.length>0)return l.some((p=>Wa(p.text,n.text,n.text_matching||"exact")||Wa(p.$el_text,n.text,n.text_matching||"exact")));var c,u,f,h=(t==null||(i=t.properties)==null?void 0:i.$elements_chain)||"";return!!h&&(c=(function(p){for(var g,v=[],y=/(?::|")text="(.*?)"/g;!rt(g=y.exec(p));)v.includes(g[1])||v.push(g[1]);return v})(h),u=n.text,f=n.text_matching||"exact",c.some((p=>Wa(p,u,f))))}Qn(t,n){var i,l;if(n==null||!n.selector)return!0;var c=t==null||(i=t.properties)==null?void 0:i.$element_selectors;if(c!=null&&c.includes(n.selector))return!0;var u=(t==null||(l=t.properties)==null?void 0:l.$elements_chain)||"";if(n.selector_regex&&u)try{return new RegExp(n.selector_regex).test(u)}catch{return!1}return!1}Jn(t){var n;return(t==null||(n=t.properties)==null?void 0:n.$elements)==null?[]:t==null?void 0:t.properties.$elements}Un(t,n){return n==null||!n.properties||n.properties.length===0||rw(n.properties.reduce(((i,l)=>{var c=nt(l.value)?l.value.map(String):l.value!=null?[String(l.value)]:[];return i[l.key]={values:c,operator:l.operator||"exact"},i}),{}),t==null?void 0:t.properties)}}class bC{constructor(t){this._instance=t,this.Kn=new Map,this.Yn=new Map,this.Xn=new Map}es(t,n){return!!t&&rw(t.propertyFilters,n==null?void 0:n.properties)}ts(t,n){var i=new Map;return t.forEach((l=>{var c;(c=l.conditions)==null||(c=c[n])==null||(c=c.values)==null||c.forEach((u=>{if(u!=null&&u.name){var f=i.get(u.name)||[];f.push(l.id),i.set(u.name,f)}}))})),i}rs(t,n,i){var l=(i===wo.Activation?this.Kn:this.Yn).get(t),c=[];return this.ns((u=>{c=u.filter((f=>l==null?void 0:l.includes(f.id)))})),c.filter((u=>{var f,h=(f=u.conditions)==null||(f=f[i])==null||(f=f.values)==null?void 0:f.find((p=>p.name===t));return this.es(h,n)}))}register(t){var n;Se((n=this._instance)==null?void 0:n._addCaptureHook)||(this.ss(t),this.os(t))}os(t){var n=t.filter((i=>{var l,c;return((l=i.conditions)==null?void 0:l.actions)&&((c=i.conditions)==null||(c=c.actions)==null||(c=c.values)==null?void 0:c.length)>0}));n.length!==0&&(this.us==null&&(this.us=new vC(this._instance),this.us.init(),this.us.Wn((i=>{this.onAction(i)}))),n.forEach((i=>{var l,c,u,f,h;i.conditions&&(l=i.conditions)!=null&&l.actions&&(c=i.conditions)!=null&&(c=c.actions)!=null&&c.values&&((u=i.conditions)==null||(u=u.actions)==null||(u=u.values)==null?void 0:u.length)>0&&((f=this.us)==null||f.register(i.conditions.actions.values),(h=i.conditions)==null||(h=h.actions)==null||(h=h.values)==null||h.forEach((p=>{if(p&&p.name){var g=this.Xn.get(p.name);g&&g.push(i.id),this.Xn.set(p.name,g||[i.id])}})))})))}ss(t){var n,i=t.filter((c=>{var u,f;return((u=c.conditions)==null?void 0:u.events)&&((f=c.conditions)==null||(f=f.events)==null||(f=f.values)==null?void 0:f.length)>0})),l=t.filter((c=>{var u,f;return((u=c.conditions)==null?void 0:u.cancelEvents)&&((f=c.conditions)==null||(f=f.cancelEvents)==null||(f=f.values)==null?void 0:f.length)>0}));i.length===0&&l.length===0||((n=this._instance)==null||n._addCaptureHook(((c,u)=>{this.onEvent(c,u)})),this.Kn=this.ts(t,wo.Activation),this.Yn=this.ts(t,wo.Cancellation))}onEvent(t,n){var i,l=this.le(),c=this.ls(),u=this.hs(),f=((i=this._instance)==null||(i=i.persistence)==null?void 0:i.props[c])||[];if(u===t&&n&&f.length>0){var h,p;l.info("event matched, removing item from activated items",{event:t,eventPayload:n,existingActivatedItems:f});var g=(n==null||(h=n.properties)==null?void 0:h.$survey_id)||(n==null||(p=n.properties)==null?void 0:p.$product_tour_id);if(g){var v=f.indexOf(g);0>v||(f.splice(v,1),this.cs(f))}}else{if(this.Yn.has(t)){var y=this.rs(t,n,wo.Cancellation);y.length>0&&(l.info("cancel event matched, cancelling items",{event:t,itemsToCancel:y.map((_=>_.id))}),y.forEach((_=>{var S=f.indexOf(_.id);0>S||f.splice(S,1),this.ds(_.id)})),this.cs(f))}if(this.Kn.has(t)){l.info("event name matched",{event:t,eventPayload:n,items:this.Kn.get(t)});var b=this.rs(t,n,wo.Activation);this.cs(f.concat(b.map((_=>_.id))||[]))}}}onAction(t){var n,i=this.ls(),l=((n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[i])||[];this.Xn.has(t)&&this.cs(l.concat(this.Xn.get(t)||[]))}cs(t){var n=this.le(),i=[...new Set(t)].filter((l=>!this.vs(l)));n.info("updating activated items",{activatedItems:i}),this.fs(i)}getActivatedIds(){var t,n=this.ls();return((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[n])||[]}getEventToItemsMap(){return this.Kn}ps(){return this.us}}class yC extends bC{constructor(t){super(t)}ls(){return zm}hs(){return Po.SHOWN}ns(t){var n;(n=this._instance)==null||n.getSurveys(t)}ds(t){var n;(n=this._instance)==null||n.cancelPendingSurvey(t)}le(){return jt}fs(t){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[zm]:t})}vs(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var Rp="SDK is not enabled or survey functionality is not yet loaded",sy="Disabled. Not loading surveys.",_C=ie!=null&&ie.location?Td(ie.location.hash,"__posthog")||Td(location.hash,"state"):null,ay="_postHogToolbarParams",ly=Vt("[Toolbar]"),Sn=Vt("[FeatureFlags]"),Ws=Vt("[FeatureFlags]",{debugEnabled:!0}),Dp=`" failed. Feature flags didn't load in time.`,oy=e=>{for(var t={},n=0;e.length>n;n++)t[e[n]]=!0;return t},cy=e=>{var t={};for(var[n,i]of sd(e||{}))i&&(t[n]=i);return t},yi=Vt("[Error tracking]"),uy="Refusing to render web experiment since the viewer is a likely bot",wC={icontains:(e,t)=>!!ie&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!ie&&t.href.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>!!ie&&Rd(t.href,e),not_regex:(e,t)=>!!ie&&!Rd(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};class Tn{get qt(){return this._instance.config}constructor(t){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(i){i===void 0&&(i=!1),n.getWebExperiments((l=>{Tn.gs("retrieved web experiments from the server"),n.ys=new Map,l.forEach((c=>{if(c.feature_flag_key){var u;n.ys&&(Tn.gs("setting flag key ",c.feature_flag_key," to web experiment ",c),(u=n.ys)==null||u.set(c.feature_flag_key,c));var f=n._instance.getFeatureFlag(c.feature_flag_key);It(f)&&c.variants[f]&&n.bs(c.name,f,c.variants[f].transforms)}else if(c.variants)for(var h in c.variants){var p=c.variants[h];Tn._s(p)&&n.bs(c.name,h,p.transforms)}}))}),i)},this._instance=t,this._instance.onFeatureFlags((i=>{this.onFeatureFlags(i)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())Tn.gs(uy);else if(!this.qt.disable_web_experiments){if(rt(this.ys))return this.ys=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Tn.gs("applying feature flags",t),t.forEach((n=>{var i;if(this.ys&&(i=this.ys)!=null&&i.has(n)){var l,c=this._instance.getFeatureFlag(n),u=(l=this.ys)==null?void 0:l.get(n);c&&u!=null&&u.variants[c]&&this.bs(u.name,c,u.variants[c].transforms)}}))}}previewWebExperiment(){var t=Tn.getWindowLocation();if(t!=null&&t.search){var n=ac(t==null?void 0:t.search,"__experiment_id"),i=ac(t==null?void 0:t.search,"__experiment_variant");n&&i&&(Tn.gs("previewing web experiments "+n+" && "+i),this.getWebExperiments((l=>{this.ws(parseInt(n),i,l)}),!1,!0))}}loadIfEnabled(){this.qt.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,n,i){if(this.qt.disable_web_experiments&&!i)return t([]);var l=this._instance.get_property("$web_experiments");if(l&&!n)return t(l);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.qt.token),method:"GET",callback:c=>t(c.statusCode===200&&c.json&&c.json.experiments||[])})}ws(t,n,i){var l=i.filter((c=>c.id===t));l&&l.length>0&&(Tn.gs("Previewing web experiment ["+l[0].name+"] with variant ["+n+"]"),this.bs(l[0].name,n,l[0].variants[n].transforms))}static _s(t){return!rt(t.conditions)&&Tn.xs(t)&&Tn.Ss(t)}static xs(t){var n;if(rt(t.conditions)||rt((n=t.conditions)==null?void 0:n.url))return!0;var i,l,c,u=Tn.getWindowLocation();return!!u&&((i=t.conditions)==null||!i.url||wC[(l=(c=t.conditions)==null?void 0:c.urlMatchType)!==null&&l!==void 0?l:"icontains"](t.conditions.url,u))}static getWindowLocation(){return ie==null?void 0:ie.location}static Ss(t){var n;if(rt(t.conditions)||rt((n=t.conditions)==null?void 0:n.utm))return!0;var i=F_();if(i.utm_source){var l,c,u,f,h,p,g,v,y=(l=t.conditions)==null||(l=l.utm)==null||!l.utm_campaign||((c=t.conditions)==null||(c=c.utm)==null?void 0:c.utm_campaign)==i.utm_campaign,b=(u=t.conditions)==null||(u=u.utm)==null||!u.utm_source||((f=t.conditions)==null||(f=f.utm)==null?void 0:f.utm_source)==i.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)==i.utm_medium,S=(g=t.conditions)==null||(g=g.utm)==null||!g.utm_term||((v=t.conditions)==null||(v=v.utm)==null?void 0:v.utm_term)==i.utm_term;return y&&_&&S&&b}return!1}static gs(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),l=1;n>l;l++)i[l-1]=arguments[l];Ne.info("[WebExperiments] "+t,i)}bs(t,n,i){this._is_bot()?Tn.gs(uy):n!=="control"?i.forEach((l=>{if(l.selector){var c;Tn.gs("applying transform of variant "+n+" for experiment "+t+" ",l);var u=(c=document)==null?void 0:c.querySelectorAll(l.selector);u==null||u.forEach((f=>{var h=f;l.html&&(h.innerHTML=l.html),l.css&&h.setAttribute("style",l.css)}))}})):Tn.gs("Control variants leave the page unmodified.")}_is_bot(){return ar&&this._instance?tw(ar,this.qt.custom_blocked_useragents):void 0}}var _r=Vt("[Conversations]"),Xs="Conversations not available yet.",qd={featureFlags:class{constructor(e){this.ks=!1,this.Cs=!1,this.Is=!1,this.Ts=!1,this.Es=!1,this.Ms=!1,this.Rs=!1,this.Ps=!1,this._instance=e,this.featureFlagEventHandlers=[]}get qt(){return this._instance.config}get ki(){return this._instance.persistence}Os(e){return this._instance.get_property(e)}Ls(){var e,t;return(e=(t=this.ki)==null?void 0:t.Mr(this.qt.feature_flag_cache_ttl_ms))!==null&&e!==void 0&&e}As(){return!!this.Ls()&&(this.Ps||this.Is||(this.Ps=!0,Sn.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Fs(){var e,t=(e=this.qt.evaluation_contexts)!==null&&e!==void 0?e:this.qt.evaluation_environments;return!this.qt.evaluation_environments||this.qt.evaluation_contexts||this.Rs||(Sn.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Rs=!0),t!=null&&t.length?t.filter((n=>{var i=n&&typeof n=="string"&&n.trim().length>0;return i||Sn.error("Invalid evaluation context found:",n,"Expected non-empty string"),i})):[]}Ns(){return this.Fs().length>0}Ds(){var e=this.qt.flag_keys;if(!Se(e)){if(nt(e))return e.filter((t=>{var n=t&&typeof t=="string"&&t.trim().length>0;return n||Sn.error("Invalid flag key found:",t,"Expected non-empty string"),n}));Sn.error("Invalid flag_keys found:",e,"Expected array of non-empty strings")}}initialize(){var e,t,{config:n}=this._instance,i=(e=(t=n.bootstrap)==null?void 0:t.featureFlags)!==null&&e!==void 0?e:{};if(Object.keys(i).length){var l,c,u=(l=(c=n.bootstrap)==null?void 0:c.featureFlagPayloads)!==null&&l!==void 0?l:{},f=Object.keys(i).filter((p=>!!i[p])).reduce(((p,g)=>(p[g]=i[g]||!1,p)),{}),h=Object.keys(u).filter((p=>f[p])).reduce(((p,g)=>(u[g]&&(p[g]=u[g]),p)),{});this.receivedFeatureFlags({featureFlags:f,featureFlagPayloads:h})}}updateFlags(e,t,n){var i=n!=null&&n.merge?this.getFlagVariants():{},l=n!=null&&n.merge?this.getFlagPayloads():{},c=ye({},i,e),u=ye({},l,t),f={};for(var[h,p]of Object.entries(c)){var g=typeof p=="string";f[h]={key:h,enabled:!!g||!!p,variant:g?p:void 0,reason:void 0,metadata:Se(u==null?void 0:u[h])?void 0:{id:0,version:void 0,description:void 0,payload:u[h]}}}this.receivedFeatureFlags({flags:f})}get hasLoadedFlags(){return this.Cs}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this.Os(Am),t=this.Os(Si),n=this.Os(Za);if(!n&&!t)return e||{};var i=Bt({},e||{}),l=[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])];for(var c of l){var u,f,h=i[c],p=t==null?void 0:t[c],g=Se(p)?(u=h==null?void 0:h.enabled)!==null&&u!==void 0&&u:!!p,v=Se(p)?h.variant:typeof p=="string"?p:void 0,y=n==null?void 0:n[c],b=ye({},h,{enabled:g,variant:g?v??(h==null?void 0:h.variant):void 0});g!==(h==null?void 0:h.enabled)&&(b.original_enabled=h==null?void 0:h.enabled),v!==(h==null?void 0:h.variant)&&(b.original_variant=h==null?void 0:h.variant),y&&(b.metadata=ye({},h==null?void 0:h.metadata,{payload:y,original_payload:h==null||(f=h.metadata)==null?void 0:f.payload})),i[c]=b}return this.ks||(Sn.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:i}),this.ks=!0),i}getFlagVariants(){var e=this.Os(rl),t=this.Os(Si);if(!t)return e||{};for(var n=Bt({},e),i=Object.keys(t),l=0;i.length>l;l++)n[i[l]]=t[i[l]];return this.ks||(Sn.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.ks=!0),n}getFlagPayloads(){var e=this.Os(Mm),t=this.Os(Za);if(!t)return e||{};for(var n=Bt({},e||{}),i=Object.keys(t),l=0;i.length>l;l++)n[i[l]]=t[i[l]];return this.ks||(Sn.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),this.ks=!0),n}reloadFeatureFlags(){this.Ts||this.qt.advanced_disable_feature_flags||this.$s||(this._instance.nn.emit("featureFlagsReloading",!0),this.$s=setTimeout((()=>{this.qs()}),5))}js(){clearTimeout(this.$s),this.$s=void 0}ensureFlagsLoaded(){this.Cs||this.Is||this.$s||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.Ts=e}qs(e){var t;if(this.js(),!this._instance.Kr())if(this.Is)this.Es=!0;else{var n=this.qt.token,i=this.Os(_d),l={token:n,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:ye({},((t=this.ki)==null?void 0:t.get_initial_props())||{},this.Os($o)||{}),group_properties:this.Os(Zs),timezone:Y_()};or(i)||Se(i)||(l.$device_id=i),(e!=null&&e.disableFlags||this.qt.advanced_disable_feature_flags)&&(l.disable_flags=!0),this.Ns()&&(l.evaluation_contexts=this.Fs());var c=this.Ds();Se(c)||(l.flag_keys=c);var u=!!this.qt.advanced_only_evaluate_survey_feature_flags,f=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.qt.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.Is=!0,this._instance._send_request({method:"POST",url:f,data:l,compression:this.qt.disable_compression?void 0:Xr.Base64,timeout:this.qt.feature_flag_request_timeout_ms,callback:h=>{var p,g,v,y=!0;if(h.statusCode===200&&(this.Es||(this.$anon_distinct_id=void 0),y=!1),this.Is=!1,!l.disable_flags||this.Es){this.Ms=!y;var b=[];h.error?h.error instanceof Error?b.push(h.error.name==="AbortError"?"timeout":"connection_error"):b.push("unknown_error"):h.statusCode!==200&&b.push("api_error_"+h.statusCode),(p=h.json)!=null&&p.errorsWhileComputingFlags&&b.push("errors_while_computing_flags");var _,S=!((g=h.json)==null||(g=g.quotaLimited)==null||!g.includes("feature_flags"));S&&b.push("quota_limited"),(v=this.ki)==null||v.register({[Om]:b}),S?Sn.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."):(l.disable_flags||this.receivedFeatureFlags((_=h.json)!==null&&_!==void 0?_:{},y,{partialResponse:u}),this.Es&&(this.Es=!1,this.qs()))}}})}}getFeatureFlag(e,t){var n;if(t===void 0&&(t={}),!t.fresh||this.Ms)if(this.Cs||this.getFlags()&&this.getFlags().length>0){if(!this.As()){var i=this.getFeatureFlagResult(e,t);return(n=i==null?void 0:i.variant)!==null&&n!==void 0?n:i==null?void 0:i.enabled}}else Sn.warn('getFeatureFlag for key "'+e+Dp)}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.Ms)if(this.Cs||this.getFlags()&&this.getFlags().length>0){if(!this.As()){var n=this.getFlagVariants(),i=e in n,l=n[e],c=this.getFlagPayloads()[e],u=String(l),f=this.Os(Rm)||void 0,h=this.Os(ic)||void 0,p=this.Os(Vo)||{};if(this.qt.advanced_feature_flags_dedup_per_session){var g,v=this._instance.get_session_id(),y=this.Os(Lm);v&&v!==y&&(p={},(g=this.ki)==null||g.register({[Vo]:p,[Lm]:v}))}if((t.send_event||!("send_event"in t))&&(!(e in p)||!p[e].includes(u))){var b,_,S,T,j,R,C,P,z,D;nt(p[e])?p[e].push(u):p[e]=[u],(b=this.ki)==null||b.register({[Vo]:p});var F=this.getFeatureFlagDetails(e),B=[...(_=this.Os(Om))!==null&&_!==void 0?_:[]];Se(l)&&B.push("flag_missing");var I={$feature_flag:e,$feature_flag_response:l,$feature_flag_payload:c||null,$feature_flag_request_id:f,$feature_flag_evaluated_at:h,$feature_flag_bootstrapped_response:((S=this.qt.bootstrap)==null||(S=S.featureFlags)==null?void 0:S[e])||null,$feature_flag_bootstrapped_payload:((T=this.qt.bootstrap)==null||(T=T.featureFlagPayloads)==null?void 0:T[e])||null,$used_bootstrap_value:!this.Ms};Se(F==null||(j=F.metadata)==null?void 0:j.version)||(I.$feature_flag_version=F.metadata.version);var L,q=(R=F==null||(C=F.reason)==null?void 0:C.description)!==null&&R!==void 0?R:F==null||(P=F.reason)==null?void 0:P.code;q&&(I.$feature_flag_reason=q),F!=null&&(z=F.metadata)!=null&&z.id&&(I.$feature_flag_id=F.metadata.id),Se(F==null?void 0:F.original_variant)&&Se(F==null?void 0:F.original_enabled)||(I.$feature_flag_original_response=Se(F.original_variant)?F.original_enabled:F.original_variant),F!=null&&(D=F.metadata)!=null&&D.original_payload&&(I.$feature_flag_original_payload=F==null||(L=F.metadata)==null?void 0:L.original_payload),B.length&&(I.$feature_flag_error=B.join(",")),this._instance.capture("$feature_flag_called",I)}if(i){var E=c;if(!Se(c))try{E=JSON.parse(c)}catch{}return{key:e,enabled:!!l,variant:typeof l=="string"?l:void 0,payload:E}}}}else Sn.warn('getFeatureFlagResult for key "'+e+Dp)}getRemoteConfigPayload(e,t){var n=this.qt.token,i={distinct_id:this._instance.get_distinct_id(),token:n};this.Ns()&&(i.evaluation_contexts=this.Fs());var l=this.Ds();Se(l)||(i.flag_keys=l),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:i,compression:this.qt.disable_compression?void 0:Xr.Base64,timeout:this.qt.feature_flag_request_timeout_ms,callback(c){var u,f=(u=c.json)==null?void 0:u.featureFlagPayloads;t((f==null?void 0:f[e])||void 0)}})}isFeatureEnabled(e,t){if(t===void 0&&(t={}),!t.fresh||this.Ms){if(this.Cs||this.getFlags()&&this.getFlags().length>0){var n=this.getFeatureFlag(e,t);return Se(n)?void 0:!!n}Sn.warn('isFeatureEnabled for key "'+e+Dp)}}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t,n){if(this.ki){this.Cs=!0;var i=this.getFlagVariants(),l=this.getFlagPayloads(),c=this.getFlagsWithDetails();(function(u,f,h,p,g,v){h===void 0&&(h={}),p===void 0&&(p={}),g===void 0&&(g={});var y=(B=>{var I=B.flags;return I?(B.featureFlags=Object.fromEntries(Object.keys(I).map((L=>{var q;return[L,(q=I[L].variant)!==null&&q!==void 0?q:I[L].enabled]}))),B.featureFlagPayloads=Object.fromEntries(Object.keys(I).filter((L=>I[L].enabled)).filter((L=>{var q;return(q=I[L].metadata)==null?void 0:q.payload})).map((L=>{var q;return[L,(q=I[L].metadata)==null?void 0:q.payload]})))):Sn.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),B})(u),b=y.flags,_=y.featureFlags,S=y.featureFlagPayloads;if(_){var T=u.requestId,j=u.evaluatedAt;if(nt(_)){Sn.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var R={};if(_)for(var C=0;_.length>C;C++)R[_[C]]=!0;f&&f.register({[rd]:_,[rl]:R})}else{var P=_,z=S,D=b;if(v!=null&&v.partialResponse)P=ye({},h,P),z=ye({},p,z),D=ye({},g,D);else if(u.errorsWhileComputingFlags)if(b){var F=new Set(Object.keys(b).filter((B=>{var I;return!((I=b[B])!=null&&I.failed)})));P=ye({},h,Object.fromEntries(Object.entries(P).filter((B=>{var[I]=B;return F.has(I)})))),z=ye({},p,Object.fromEntries(Object.entries(z||{}).filter((B=>{var[I]=B;return F.has(I)})))),D=ye({},g,Object.fromEntries(Object.entries(D||{}).filter((B=>{var[I]=B;return F.has(I)}))))}else P=ye({},h,P),z=ye({},p,z),D=ye({},g,D);f&&f.register(ye({[rd]:Object.keys(cy(P)),[rl]:P||{},[Mm]:z||{},[Am]:D||{}},T?{[Rm]:T}:{},j?{[ic]:j}:{}))}}})(e,this.ki,i,l,c,n),t||(this.Ps=!1),this.Hs(t)}}override(e,t){t===void 0&&(t=!1),Sn.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this.ki)return Sn.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this.ki.unregister(Si),this.ki.unregister(Za),this.Hs(),Ws.info("All overrides cleared");if(nt(e)){var t=oy(e);return this.ki.register({[Si]:t}),this.Hs(),Ws.info("Flag overrides set",{flags:e})}if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var n,i=e;if(this.ks=!!((n=i.suppressWarning)!==null&&n!==void 0&&n),"flags"in i){if(i.flags===!1)this.ki.unregister(Si),Ws.info("Flag overrides cleared");else if(i.flags){if(nt(i.flags)){var l=oy(i.flags);this.ki.register({[Si]:l})}else this.ki.register({[Si]:i.flags});Ws.info("Flag overrides set",{flags:i.flags})}}return"payloads"in i&&(i.payloads===!1?(this.ki.unregister(Za),Ws.info("Payload overrides cleared")):i.payloads&&(this.ki.register({[Za]:i.payloads}),Ws.info("Payload overrides set",{payloads:i.payloads}))),void this.Hs()}if(e&&typeof e=="object")return this.ki.register({[Si]:e}),this.Hs(),Ws.info("Flag overrides set",{flags:e});Sn.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.Cs){var{flags:t,flagVariants:n}=this.Us();e(t,n)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,n){var i,l=(this.Os(Bo)||[]).find((h=>h.flagKey===e)),c={["$feature_enrollment/"+e]:t},u={$feature_flag:e,$feature_enrollment:t,$set:c};l&&(u.$early_access_feature_name=l.name),n&&(u.$feature_enrollment_stage=n),this._instance.capture("$feature_enrollment_update",u),this.setPersonPropertiesForFlags(c,!1);var f=ye({},this.getFlagVariants(),{[e]:t});(i=this.ki)==null||i.register({[rd]:Object.keys(cy(f)),[rl]:f}),this.Hs()}getEarlyAccessFeatures(e,t,n){t===void 0&&(t=!1);var i=this.Os(Bo),l=n?"&"+n.map((c=>"stage="+c)).join("&"):"";if(i&&!t)return e(i);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.qt.token+l),method:"GET",callback:c=>{var u,f;if(c.json){var h=c.json.earlyAccessFeatures;return(u=this.ki)==null||u.unregister(Bo),(f=this.ki)==null||f.register({[Bo]:h}),e(h)}}})}Us(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((n=>t[n])),flagVariants:Object.keys(t).filter((n=>t[n])).reduce(((n,i)=>(n[i]=t[i],n)),{})}}Hs(e){var{flags:t,flagVariants:n}=this.Us();this.featureFlagEventHandlers.forEach((i=>i(t,n,{errorsLoading:e})))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this.Os($o)||{},i=(e==null?void 0:e.$set)||(e!=null&&e.$set_once?{}:e),l=e==null?void 0:e.$set_once,c={};if(l)for(var u in l)({}).hasOwnProperty.call(l,u)&&(u in n||(c[u]=l[u]));this._instance.register({[$o]:ye({},n,c,i)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister($o)}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this.Os(Zs)||{};Object.keys(n).length!==0&&Object.keys(n).forEach((i=>{n[i]=ye({},n[i],e[i]),delete e[i]})),this._instance.register({[Zs]:ye({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.Os(Zs)||{};this._instance.register({[Zs]:ye({},t,{[e]:{}})})}else this._instance.unregister(Zs)}reset(){this.Cs=!1,this.Is=!1,this.Ts=!1,this.Es=!1,this.Ms=!1,this.$anon_distinct_id=void 0,this.js(),this.ks=!1}}},kC={sessionRecording:class{get qt(){return this._instance.config}get ki(){return this._instance.persistence}get started(){var e;return!((e=this.Bs)==null||!e.isStarted)}get status(){var e,t;return this.zs===Eo||this.zs===Yu?this.zs:(e=(t=this.Bs)==null?void 0:t.status)!==null&&e!==void 0?e:this.zs}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.zs=ey,this.Vs=void 0,this._instance=e,!this._instance.sessionManager)throw bi.error("started without valid sessionManager"),new Error(Km+" started without valid sessionManager. This is a bug.");if(this.qt.cookieless_mode===Ni)throw new Error(Km+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get Ws(){var e,t=!((e=this._instance.get_property(ea))==null||!e.enabled),n=!this.qt.disable_session_recording,i=this.qt.disable_session_recording||this._instance.consent.isOptedOut();return ie&&t&&n&&!i}startIfEnabledOrStop(e){var t;if(!this.Ws||(t=this.Bs)==null||!t.isStarted){var n=!Se(Object.assign)&&!Se(Array.from);this.Ws&&n?(this.Zs(e),bi.info("starting")):(this.zs=ey,this.stopRecording())}}Zs(e){var t,n,i;this.Ws&&(this.zs!==Eo&&this.zs!==Yu&&(this.zs=ty),Le!=null&&(t=Le.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(n=Le.__PosthogExtensions__)!=null&&n.initSessionRecording?this.Gs(e):(i=Le.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,this.Qs,(l=>{if(l)return bi.error("could not load recorder",l);this.Gs(e)})))}stopRecording(){var e,t;(e=this.Vs)==null||e.call(this),this.Vs=void 0,(t=this.Bs)==null||t.stop()}Js(){var e,t;(e=this.Vs)==null||e.call(this),this.Vs=void 0,(t=this.Bs)==null||t.discard()}Ks(){var e;(e=this.ki)==null||e.unregister(_g)}Ys(e,t){if(rt(e))return null;var n,i=Bn(e)?e:parseFloat(e);return typeof(n=i)!="number"||!Number.isFinite(n)||0>n||n>1?(bi.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):i}Xs(e){if(this.ki){var t,n,i=this.ki,l=()=>{var c,u=e.sessionRecording===!1?void 0:e.sessionRecording,f=this.Ys((c=this.qt.session_recording)==null?void 0:c.sampleRate,"session_recording.sampleRate"),h=this.Ys(u==null?void 0:u.sampleRate,"remote config sampleRate"),p=f??h;rt(p)&&this.Ks();var g=u==null?void 0:u.minimumDurationMilliseconds;i.register({[ea]:ye({cache_timestamp:Date.now(),enabled:!!u},u,{networkPayloadCapture:ye({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:Se(g)?null:g,endpoint:u==null?void 0:u.endpoint,triggerMatchType:u==null?void 0:u.triggerMatchType,masking:u==null?void 0:u.masking,urlTriggers:u==null?void 0:u.urlTriggers,version:u==null?void 0:u.version,triggerGroups:u==null?void 0:u.triggerGroups})})};l(),(t=this.Vs)==null||t.call(this),this.Vs=(n=this._instance.sessionManager)==null?void 0:n.onSessionId(l)}}onRemoteConfig(e){return"sessionRecording"in e?e.sessionRecording===!1?(this.Xs(e),void this.Js()):(this.Xs(e),void this.startIfEnabledOrStop()):(this.zs===Eo&&(this.zs=Yu,bi.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.Bs)!=null&&n.log?this.Bs.log(e,t):bi.warn("log called before recorder was ready")}get Qs(){var e,t,n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(ea);return(n==null||(t=n.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}eo(){var e,t,n=this._instance.get_property(ea);if(!n)return!1;try{t=typeof n=="object"?n:JSON.parse(n)}catch(l){return bi.warn("persisted remote config for session recording is invalid and will be ignored",l),!1}var i=(e=t.cache_timestamp)!==null&&e!==void 0?e:Date.now();return 36e5>=Date.now()-i}Gs(e){var t,n;if((t=Le.__PosthogExtensions__)==null||!t.initSessionRecording)return bi.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[j_]:!0});if(this.Bs||(this.Bs=(n=Le.__PosthogExtensions__)==null?void 0:n.initSessionRecording(this._instance),this.Bs._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.eo())return this.zs===Yu||this.zs===Eo?void 0:(this.zs=Eo,bi.info("persisted remote config is stale, requesting fresh config before starting"),void new W_(this._instance).load());this.zs=ty,this.Bs.start(e)}onRRwebEmit(e){var t;(t=this.Bs)==null||t.onRRwebEmit==null||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.Bs||(t=this.ki)==null||t.register({[b_]:!0}),(e=this.Bs)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.Bs||(t=this.ki)==null||t.register({[v_]:!0}),(e=this.Bs)==null||e.overrideSampling()}overrideTrigger(e){var t,n;this.Bs||(n=this.ki)==null||n.register({[e==="url"?y_:__]:!0}),(t=this.Bs)==null||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.Bs)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var n;return!((n=this.Bs)==null||!n.tryAddCustomEvent(e,t))}}},SC={autocapture:class{constructor(e){this.ro=!1,this.io=null,this.no=!1,this.instance=e,this.rageclicks=new Zb(e.config.rageclick),this.so=null}initialize(){this.startIfEnabled()}get qt(){var e,t,n=Yt(this.instance.config.autocapture)?this.instance.config.autocapture:{};return n.url_allowlist=(e=n.url_allowlist)==null?void 0:e.map((i=>new RegExp(i))),n.url_ignorelist=(t=n.url_ignorelist)==null?void 0:t.map((i=>new RegExp(i))),n}oo(){if(this.isBrowserSupported()){if(ie&&Ce){var e=n=>{n=n||(ie==null?void 0:ie.event);try{this.ao(n)}catch(i){Ap.error("Failed to capture event",i)}};if(Kt(Ce,"submit",e,{capture:!0}),Kt(Ce,"change",e,{capture:!0}),Kt(Ce,"click",e,{capture:!0}),this.qt.capture_copied_text){var t=n=>{n=n||(ie==null?void 0:ie.event);try{this.ao(n,Tp)}catch(i){Ap.error("Failed to capture copy/cut event",i)}};Kt(Ce,"copy",t,{capture:!0}),Kt(Ce,"cut",t,{capture:!0})}}}else Ap.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.ro&&(this.oo(),this.ro=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.no=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[wm]:!!e.autocapture_opt_out}),this.io=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.so=e}getElementSelectors(e){var t,n=[];return(t=this.so)==null||t.forEach((i=>{var l=Ce==null?void 0:Ce.querySelectorAll(i);l==null||l.forEach((c=>{e===c&&n.push(i)}))})),n}get isEnabled(){var e,t,n=(e=this.instance.persistence)==null?void 0:e.props[wm];if(or(this.io)&&!Zr(n)&&!this.instance.Kr())return!1;var i=(t=this.io)!==null&&t!==void 0?t:!!n;return!!this.instance.config.autocapture&&!i}ao(e,t){if(t===void 0&&(t="$autocapture"),this.isEnabled){var n,i=bp(e);E_(i)&&(i=i.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())&&Ab(i,this.instance.config.rageclick)&&this.ao(e,"$rageclick");var l=t===Tp;if(i&&(function(v,y,b,_,S){var T,j,R,C;if(b===void 0&&(b=void 0),!ie||Cg(v)||(T=b)!=null&&T.url_allowlist&&!Cb(b.url_allowlist)||(j=b)!=null&&j.url_ignorelist&&Cb(b.url_ignorelist))return!1;if((R=b)!=null&&R.dom_event_allowlist){var P=b.dom_event_allowlist;if(P&&!P.some((I=>y.type===I)))return!1}var{parentIsUsefulElement:z,targetElementList:D}=z_(v,_);if(!(function(I,L){var q=L==null?void 0:L.element_allowlist;if(Se(q))return!0;var E,ae=function(Y){if(q.some((U=>Y.tagName.toLowerCase()===U)))return{v:!0}};for(var K of I)if(E=ae(K))return E.v;return!1})(D,b)||!M_(D,(C=b)==null?void 0:C.css_selector_allowlist))return!1;var F=ie.getComputedStyle(v);if(F&&F.getPropertyValue("cursor")==="pointer"&&y.type==="click")return!0;var B=v.tagName.toLowerCase();switch(B){case"html":return!1;case"form":return(S||["submit"]).indexOf(y.type)>=0;case"input":case"select":case"textarea":return(S||["change","click"]).indexOf(y.type)>=0;default:return z?(S||["click"]).indexOf(y.type)>=0:(S||["click"]).indexOf(y.type)>=0&&(Ng.indexOf(B)>-1||v.getAttribute("contenteditable")==="true")}})(i,e,this.qt,l,l?["copy","cut"]:void 0)){var{props:c,explicitNoCapture:u}=pC(i,{e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.qt.element_attribute_ignorelist,elementsChainAsString:this.no});if(u)return!1;var f=this.getElementSelectors(i);if(f&&f.length>0&&(c.$element_selectors=f),t===Tp){var h,p=A_(ie==null||(h=ie.getSelection())==null?void 0:h.toString()),g=e.type||"clipboard";if(!p)return!1;c.$selected_content=p,c.$copy_type=g}return this.instance.capture(t,c),!0}}}isBrowserSupported(){return ji(Ce==null?void 0:Ce.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this.uo=(ie==null||(t=ie.location)==null?void 0:t.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(Ne.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.lo&&this.lo(),this.lo=void 0,Ne.info("History API monitoring stopped")}monitorHistoryChanges(){ie&&ie.history&&(this.ho("pushState"),this.ho("replaceState"),this.co())}ho(e){var t;if(ie&&((t=ie.history[e])==null||!t.__posthog_wrapped__)){var n=this;(function(i,l,c){try{if(!(l in i))return()=>{};var u=i[l],f=c(u);return ji(f)&&(f.prototype=f.prototype||{},Object.defineProperties(f,{__posthog_wrapped__:{enumerable:!1,value:!0}})),i[l]=f,()=>{i[l]===f&&(i[l]=u)}}catch{return()=>{}}})(ie.history,e,(i=>function(l,c,u){i.call(this,l,c,u),n.do(e)}))}}do(e){try{var t,n=ie==null||(t=ie.location)==null?void 0:t.pathname;if(!n)return;n!==this.uo&&this.isEnabled&&this._instance.capture(Ja,{navigation_type:e}),this.uo=n}catch(i){Ne.error("Error capturing "+e+" pageview",i)}}co(){if(!this.lo){var e=()=>{this.do("popstate")};Kt(ie,"popstate",e),this.lo=()=>{ie&&ie.removeEventListener("popstate",e)}}}},heatmaps:class{get qt(){return this.instance.config}constructor(e){var t;this.vo=!1,this.ro=!1,this.fo=null,this.instance=e,this.vo=!((t=this.instance.persistence)==null||!t.props[km]),this.rageclicks=new Zb(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return Yt(this.qt.capture_heatmaps)&&this.qt.capture_heatmaps.flush_interval_milliseconds&&(e=this.qt.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return rt(this.qt.capture_heatmaps)?rt(this.qt.enable_heatmaps)?this.vo:this.qt.enable_heatmaps:this.qt.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.ro)return;gC.info("starting..."),this.po(),this.At()}else{var e;clearInterval((e=this.fo)!==null&&e!==void 0?e:void 0),this.mo(),this.getAndClearBuffer()}}onRemoteConfig(e){if("heatmaps"in e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[km]:t}),this.vo=t,this.startIfEnabled()}}getAndClearBuffer(){var e=this.M;return this.M=void 0,e}yo(e){this.Mt(e.originalEvent,"deadclick")}At(){this.fo&&clearInterval(this.fo),this.fo=(Ce==null?void 0:Ce.visibilityState)==="visible"?setInterval(this.ci.bind(this),this.flushIntervalMilliseconds):null}po(){ie&&Ce&&(this.bo=this.ci.bind(this),Kt(ie,jd,this.bo),this._o=e=>this.Mt(e||(ie==null?void 0:ie.event)),Kt(Ce,"click",this._o,{capture:!0}),this.wo=e=>this.xo(e||(ie==null?void 0:ie.event)),Kt(Ce,"mousemove",this.wo,{capture:!0}),this.So=new Db(this.instance,D3,this.yo.bind(this)),this.So.startIfEnabledOrStop(),this.ko=this.At.bind(this),Kt(Ce,Sd,this.ko),this.ro=!0)}mo(){var e;ie&&Ce&&(this.bo&&ie.removeEventListener(jd,this.bo),this._o&&Ce.removeEventListener("click",this._o,{capture:!0}),this.wo&&Ce.removeEventListener("mousemove",this.wo,{capture:!0}),this.ko&&Ce.removeEventListener(Sd,this.ko),clearTimeout(this.Co),(e=this.So)==null||e.stop(),this.ro=!1)}Io(e,t){var n=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),l=this.instance.scrollManager.scrollElement(),c=(function(u,f,h){for(var p=u;p&&xs(p)&&!lr(p,"body");){if(p===h)return!1;if(Ie(f,ie==null?void 0:ie.getComputedStyle(p).position))return!0;p=R_(p)}return!1})(bp(e),["fixed","sticky"],l);return{x:e.clientX+(c?0:i),y:e.clientY+(c?0:n),target_fixed:c,type:t}}Mt(e,t){var n;if(t===void 0&&(t="click"),!Nb(e.target)&&ny(e)){var i=this.Io(e,t);(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&Ab(bp(e),this.instance.config.rageclick)&&this.To(ye({},i,{type:"rageclick"})),this.To(i)}}xo(e){!Nb(e.target)&&ny(e)&&(clearTimeout(this.Co),this.Co=setTimeout((()=>{this.To(this.Io(e,"mousemove"))}),500))}To(e){if(ie){var t=ie.location.href,n=this.qt.custom_personal_data_properties,i=this.qt.mask_personal_data_properties?[...dl,...n||[]]:[],l=lc(t,i,oc);this.M=this.M||{},this.M[l]||(this.M[l]=[]),this.M[l].push(e)}}ci(){this.M&&!ps(this.M)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Db,webVitalsAutocapture:class{constructor(e){var t;this.vo=!1,this.ro=!1,this.M={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Eo=()=>{clearTimeout(this.Mo),this.M.metrics.length!==0&&(this._instance.capture("$web_vitals",this.M.metrics.reduce(((n,i)=>ye({},n,{["$web_vitals_"+i.name+"_event"]:ye({},i),["$web_vitals_"+i.name+"_value"]:i.value})),{})),this.M={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.dt=n=>{var i;this.M=this.M||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var l=this.Ro();if(!Se(l))if(rt(n==null?void 0:n.name)||rt(n==null?void 0:n.value))Ys.error("Invalid metric received",n);else if(!this.Po||this.Po>n.value){this.M.url!==l&&(this.Eo(),this.Mo=setTimeout(this.Eo,this.flushToCaptureTimeoutMs)),Se(this.M.url)&&(this.M.url=l),this.M.firstMetricTimestamp=Se(this.M.firstMetricTimestamp)?Date.now():this.M.firstMetricTimestamp,n.attribution&&n.attribution.interactionTargetElement&&(n.attribution.interactionTargetElement=void 0);var c=(i=this._instance.sessionManager)==null?void 0:i.checkAndGetSessionAndWindowId(!0),u=ye({},n,{$current_url:l,timestamp:Date.now()});Se(c)||(u.$session_id=c.sessionId,u.$window_id=c.windowId),this.M.metrics.push(u),this.M.metrics.length===this.allowedMetrics.length&&this.Eo()}else Ys.error("Ignoring metric with value >= "+this.Po,n)},this.Oo=()=>{if(!this.ro){var n,i,l,c,u=Le.__PosthogExtensions__;Se(u)||Se(u.postHogWebVitalsCallbacks)||({onLCP:n,onCLS:i,onFCP:l,onINP:c}=u.postHogWebVitalsCallbacks),n&&i&&l&&c?(this.allowedMetrics.indexOf("LCP")>-1&&n(this.dt.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&i(this.dt.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&l(this.dt.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&c(this.dt.bind(this)),this.ro=!0):Ys.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.vo=!((t=this._instance.persistence)==null||!t.props[Cm]),this.startIfEnabled()}get Lo(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,n=Yt(this.Lo)?(e=this.Lo)==null?void 0:e.web_vitals_allowed_metrics:void 0;return rt(n)?((t=this._instance.persistence)==null?void 0:t.props[Tm])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return(Yt(this.Lo)?this.Lo.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=Yt(this.Lo)?this.Lo.web_vitals_attribution:void 0;return e!=null&&e}get Po(){var e=Yt(this.Lo)&&Bn(this.Lo.__web_vitals_max_value)?this.Lo.__web_vitals_max_value:Jb;return e>0&&6e4>=e?Jb:e}get isEnabled(){var e=jn==null?void 0:jn.protocol;if(e!=="http:"&&e!=="https:")return Ys.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=Yt(this.Lo)?this.Lo.web_vitals:Zr(this.Lo)?this.Lo:void 0;return Zr(t)?t:this.vo}startIfEnabled(){this.isEnabled&&!this.ro&&(Ys.info("enabled, starting..."),this.lr(this.Oo))}onRemoteConfig(e){if("capturePerformance"in e){var t=Yt(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=Yt(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Cm]:t}),this._instance.persistence.register({[Tm]:n})),this.vo=t,this.startIfEnabled()}}lr(e){var t,n;(t=Le.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks?e():(n=Le.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(i=>{i?Ys.error("failed to load script",i):e()}))}Ro(){var e=ie?ie.location.href:void 0;if(e){var t=this._instance.config.custom_personal_data_properties,n=this._instance.config.mask_personal_data_properties?[...dl,...t||[]]:[];return lc(e,n,oc)}Ys.error("Could not determine current URL")}}},jC={exceptionObserver:class{constructor(e){var t,n,i;this.Oo=()=>{var l;if(ie&&this.isEnabled&&(l=Le.__PosthogExtensions__)!=null&&l.errorWrappingFunctions){var c=Le.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,u=Le.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,f=Le.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Ao&&this.qt.capture_unhandled_errors&&(this.Ao=c(this.captureException.bind(this))),!this.Fo&&this.qt.capture_unhandled_rejections&&(this.Fo=u(this.captureException.bind(this))),!this.No&&this.qt.capture_console_errors&&(this.No=f(this.captureException.bind(this)))}catch(h){Co.error("failed to start",h),this.Do()}}},this._instance=e,this.$o=!((t=this._instance.persistence)==null||!t.props[Sm]),this.qo=new RN({refillRate:(n=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&n!==void 0?n:1,bucketSize:(i=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&i!==void 0?i:10,refillInterval:1e4,Gt:Co}),this.qt=this.jo(),this.startIfEnabledOrStop()}jo(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Yt(e)?t=ye({},t,e):(Se(e)?this.$o:e)&&(t=ye({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.qt.capture_console_errors||this.qt.capture_unhandled_errors||this.qt.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Co.info("enabled"),this.Do(),this.lr(this.Oo)):this.Do()}lr(e){var t,n;(t=Le.__PosthogExtensions__)!=null&&t.errorWrappingFunctions&&e(),(n=Le.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",(i=>{if(i)return Co.error("failed to load script",i);e()}))}Do(){var e,t,n;(e=this.Ao)==null||e.call(this),this.Ao=void 0,(t=this.Fo)==null||t.call(this),this.Fo=void 0,(n=this.No)==null||n.call(this),this.No=void 0}onRemoteConfig(e){"autocaptureExceptions"in e&&(this.$o=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Sm]:this.$o}),this.qt=this.jo(),this.startIfEnabledOrStop())}onConfigChange(){this.qt=this.jo()}captureException(e){var t,n,i,l=(t=e==null||(n=e.$exception_list)==null||(n=n[0])==null?void 0:n.type)!==null&&t!==void 0?t:"Exception";this.qo.consumeRateLimit(l)?Co.info("Skipping exception capture because of client rate limiting.",{exception:l}):(i=this._instance.exceptions)==null||i.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,n;this.Ho=[],this.Uo=new VN([new JN,new o3,new t3,new e3,new a3,new s3,new r3,new l3],(function(i){for(var l=arguments.length,c=new Array(l>1?l-1:0),u=1;l>u;u++)c[u-1]=arguments[u];return function(f,h){h===void 0&&(h=0);for(var p=[],g=f.split(`
|
|
62
|
+
`),v=h;g.length>v;v++){var y=g[v];if(1024>=y.length){var b=wb.test(y)?y.replace(wb,"$1"):y;if(!b.match(/\S*Error: /)){for(var _ of c){var S=_(b,i);if(S){p.push(S);break}}if(p.length>=50)break}}}return(function(T){if(!T.length)return[];var j=Array.from(T);return j.reverse(),j.slice(0,50).map((R=>{return ye({},R,{filename:R.filename||(C=j,C[C.length-1]||{}).filename,function:R.function||ul});var C}))})(p)}})("web:javascript",XN,ZN)),this._instance=e,this.Ho=(t=(n=this._instance.persistence)==null?void 0:n.get_property(jm))!==null&&t!==void 0?t:[],this.Bo=yd(this.zo()),this.Vo=new u3(this.Bo)}onConfigChange(){this.Bo=yd(this.zo()),this.Vo.setConfig(this.Bo)}onRemoteConfig(e){var t,n,i;if("errorTracking"in e){var l=(t=(n=e.errorTracking)==null?void 0:n.suppressionRules)!==null&&t!==void 0?t:[],c=(i=e.errorTracking)==null?void 0:i.captureExtensionExceptions;this.Ho=l,this._instance.persistence&&this._instance.persistence.register({[jm]:this.Ho,[Nm]:c})}}get Wo(){var e,t=!!this._instance.get_property(Nm),n=this._instance.config.error_tracking.captureExtensionExceptions;return(e=n??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.Uo.buildFromUnknown(e,{syntheticException:t==null?void 0:t.syntheticException,mechanism:{handled:t==null?void 0:t.handled}})}addExceptionStep(e,t){if(this.Bo.enabled)try{if(!It(e)||e.trim().length===0)return void yi.warn("Ignoring exception step because message must be a non-empty string");var n=this.Zo(t),{sanitizedProperties:i,droppedKeys:l}=(function(c){if(!c)return{sanitizedProperties:{},droppedKeys:[]};var u=[];return{sanitizedProperties:Object.keys(c).reduce(((f,h)=>c3.has(h)?(u.push(h),f):(f[h]=c[h],f)),{}),droppedKeys:u}})(n);l.length>0&&yi.warn("Ignoring reserved exception step fields",{droppedKeys:l}),this.Vo.add(ye({[vd]:e,[bd]:new Date().toISOString()},i))}catch(c){yi.error("Failed to add exception step. Ignoring breadcrumb.",c)}}sendExceptionEvent(e){try{var t=e.$exception_list;if(this.Go(t)){if(this.Qo(t))return this.Jo("Exception dropped: matched a suppression rule"),void yi.info("Skipping exception capture because a suppression rule matched");if(!this.Wo&&this.Ko(t))return this.Jo("Exception dropped: thrown by a browser extension"),void yi.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Yo(t))return this.Jo("Exception dropped: thrown by the PostHog SDK"),void yi.info("Skipping exception capture because it was thrown by the PostHog SDK")}var n=this.Bo.enabled&&rt(e.$exception_steps)?this.Xo(e):e;try{var i=this._instance.capture("$exception",n,{_noTruncate:!0,_batchKey:"exceptionEvent",In:!0});return i&&this.Vo.clear(),i}catch(l){return yi.error("Failed to capture exception event. Dropping this exception.",l),void this.Vo.clear()}}catch(l){return void yi.error("Failed to process exception event. Ignoring this exception.",l)}}Xo(e){try{var t=this.Vo.getAttachable();return t.length===0?e:ye({},e,{$exception_steps:t})}catch(n){return yi.error("Failed to read buffered exception steps. Capturing exception without steps.",n),e}}Jo(e){this.Bo.enabled&&this.Vo.add({[vd]:e,[bd]:new Date().toISOString()})}Zo(e){return Yt(e)?ye({},e):{}}zo(){var e,t;return(e=(t=this._instance.config.error_tracking)==null?void 0:t.exception_steps)!==null&&e!==void 0?e:{}}Qo(e){if(e.length===0)return!1;var t=e.reduce(((n,i)=>{var{type:l,value:c}=i;return It(l)&&l.length>0&&n.$exception_types.push(l),It(c)&&c.length>0&&n.$exception_values.push(c),n}),{$exception_types:[],$exception_values:[]});return this.Ho.some((n=>{var i=n.values.map((l=>{var c,u=nw[l.operator],f=nt(l.value)?l.value:[l.value],h=(c=t[l.key])!==null&&c!==void 0?c:[];return f.length>0&&u(f,h)}));return n.type==="OR"?i.some(Boolean):i.every(Boolean)}))}Ko(e){return e.flatMap((t=>{var n,i;return(n=(i=t.stacktrace)==null?void 0:i.frames)!==null&&n!==void 0?n:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}Yo(e){if(e.length>0){var t,n,i,l,c=(t=(n=e[0].stacktrace)==null?void 0:n.frames)!==null&&t!==void 0?t:[],u=c[c.length-1];return(i=u==null||(l=u.filename)==null?void 0:l.includes("posthog.com/static"))!==null&&i!==void 0&&i}return!1}Go(e){return!rt(e)&&nt(e)}}},NC=ye({productTours:class{get ki(){return this._instance.persistence}constructor(e){this.ea=null,this.ta=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){"productTours"in e&&(this.ki&&this.ki.register({[Em]:!!e.productTours}),this.loadIfEnabled())}loadIfEnabled(){var e,t;this.ea||(e=this._instance).config.disable_product_tours||(t=e.persistence)==null||!t.get_property(Em)||this.lr((()=>this.ra()))}lr(e){var t,n;(t=Le.__PosthogExtensions__)!=null&&t.generateProductTours?e():(n=Le.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"product-tours",(i=>{i?ry.error("Could not load product tours script",i):e()}))}ra(){var e;!this.ea&&(e=Le.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.ea=Le.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(t===void 0&&(t=!1),!nt(this.ta)||t){var n=this.ki;if(n){var i=n.props[id];if(nt(i)&&!t)return this.ta=i,void e(i,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:l=>{var c=l.statusCode;if(c!==200||!l.json){var u="Product Tours API could not be loaded, status: "+c;return ry.error(u),void e([],{isLoaded:!1,error:u})}var f=nt(l.json.product_tours)?l.json.product_tours:[];this.ta=f,n&&n.register({[id]:f}),e(f,{isLoaded:!0})}})}else e(this.ta,{isLoaded:!0})}getActiveProductTours(e){rt(this.ea)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.ea.getActiveProductTours(e)}showProductTour(e){var t;(t=this.ea)==null||t.showTourById(e)}previewTour(e){this.ea?this.ea.previewTour(e):this.lr((()=>{var t;this.ra(),(t=this.ea)==null||t.previewTour(e)}))}dismissProductTour(){var e;(e=this.ea)==null||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.ea)==null||e.nextStep()}previousStep(){var e;(e=this.ea)==null||e.previousStep()}clearCache(){var e;this.ta=null,(e=this.ki)==null||e.unregister(id)}resetTour(e){var t;(t=this.ea)==null||t.resetTour(e)}resetAllTours(){var e;(e=this.ea)==null||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.ea)==null||t.cancelPendingTour(e)}}},qd),CC={siteApps:class{constructor(e){this._instance=e,this.ia=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}na(e,t){if(t){var n=this.globalsForEvent(t);this.ia.push(n),this.ia.length>1e3&&(this.ia=this.ia.slice(10))}}get siteAppLoaders(){var e;return(e=Le._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.na.bind(this));this.sa=()=>{e(),this.ia=[],this.sa=void 0}}}globalsForEvent(e){var t,n,i,l,c,u,f;if(!e)throw new Error("Event payload is required");var h={},p=this._instance.get_property("$groups")||[],g=this._instance.get_property("$stored_group_properties")||{};for(var[v,y]of Object.entries(g))h[v]={id:p[v],type:v,properties:y};var{$set_once:b,$set:_}=e;return{event:ye({},F5(e,xC),{properties:ye({},e.properties,_?{$set:ye({},(t=(n=e.properties)==null?void 0:n.$set)!==null&&t!==void 0?t:{},_)}:{},b?{$set_once:ye({},(i=(l=e.properties)==null?void 0:l.$set_once)!==null&&i!==void 0?i:{},b)}:{}),elements_chain:(c=(u=e.properties)==null?void 0:u.$elements_chain)!==null&&c!==void 0?c:"",distinct_id:(f=e.properties)==null?void 0:f.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:h}}setupSiteApp(e){var t=this.apps[e.id],n=()=>{var u;!t.errored&&this.ia.length&&(us.info("Processing "+this.ia.length+" events for site app with id "+e.id),this.ia.forEach((f=>t.processEvent==null?void 0:t.processEvent(f))),t.processedBuffer=!0),Object.values(this.apps).every((f=>f.processedBuffer||f.errored))&&((u=this.sa)==null||u.call(this))},i=!1,l=u=>{t.errored=!u,t.loaded=!0,us.info("Site app with id "+e.id+" "+(u?"loaded":"errored")),i&&n()};try{var{processEvent:c}=e.init({posthog:this._instance,callback(u){l(u)}});c&&(t.processEvent=c),i=!0}catch(u){us.error(iy+e.id,u),l(!1)}if(i&&t.loaded)try{n()}catch(u){us.error("Error while processing buffered events PostHog app with config id "+e.id,u),t.errored=!0}}oa(){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)}aa(e){if(Object.keys(this.apps).length!==0){var t=this.globalsForEvent(e);for(var n of Object.values(this.apps))try{n.processEvent==null||n.processEvent(t)}catch(i){us.error("Error while processing event "+e.event+" for site app "+n.id,i)}}}onRemoteConfig(e){var t,n,i,l=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.oa(),void this._instance.on("eventCaptured",(h=>this.aa(h)))):void us.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.sa)==null||n.call(this),(i=e.siteApps)!=null&&i.length)if(this.isEnabled){var c=function(h){var p;Le["__$$ph_site_app_"+h]=l._instance,(p=Le.__PosthogExtensions__)==null||p.loadSiteApp==null||p.loadSiteApp(l._instance,f,(g=>{if(g)return us.error(iy+h,g)}))};for(var{id:u,url:f}of e.siteApps)c(u)}else us.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},EC={tracingHeaders:class{constructor(e){this.ua=void 0,this.la=void 0,this.ha=void 0,this.Oo=()=>{var t,n,i=this.ca();i?(Se(this.ua)&&(this.ua=(t=Le.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null?void 0:t._patchXHR(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),Se(this.la)&&(this.la=(n=Le.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null?void 0:n._patchFetch(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.Do()},this._instance=e}initialize(){this.startIfEnabledOrStop()}lr(e){var t,n;(t=Le.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns?e():(n=Le.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",(i=>{if(i)return mC.error("failed to load script",i);e()}))}da(){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}ca(){var e=this.da();return nt(e)?(nt(this.ha)?this.ha.splice(0,this.ha.length,...e):this.ha=[...e],e.length>0?this.ha:void 0):(nt(this.ha)&&this.ha.splice(0),this.ha=e||void 0,this.ha)}Do(){var e,t;(e=this.ua)==null||e.call(this),(t=this.la)==null||t.call(this),this.ua=void 0,this.la=void 0}startIfEnabledOrStop(){this.ca()?this.lr(this.Oo):this.Do()}}},TC=ye({surveys:class{get qt(){return this._instance.config}constructor(e){this.va=void 0,this._surveyManager=null,this.fa=!1,this.pa=[],this.ga=null,this._instance=e,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this.qt.disable_surveys){var t=e.surveys;if(rt(t))return jt.warn("Flags not loaded yet. Not loading surveys.");var n=nt(t);this.va=n?t.length>0:t,jt.info("flags response received, isSurveysEnabled: "+this.va),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var n=localStorage.key(t);(n!=null&&n.startsWith(Xm)||n!=null&&n.startsWith("inProgressSurvey_"))&&e.push(n)}e.forEach((i=>localStorage.removeItem(i)))}loadIfEnabled(){if(!this._surveyManager)if(this.fa)jt.info("Already initializing surveys, skipping...");else if(this.qt.disable_surveys)jt.info(sy);else if(this.qt.cookieless_mode&&this._instance.consent.isOptedOut())jt.info("Not loading surveys in cookieless mode without consent.");else{var e=Le==null?void 0:Le.__PosthogExtensions__;if(e){if(!Se(this.va)||this.qt.advanced_enable_surveys){var t=this.va||this.qt.advanced_enable_surveys;this.fa=!0;try{var n=e.generateSurveys;if(n)return void this.ma(n,t);var i=e.loadExternalDependency;if(!i)return void this.ya(kg);i(this._instance,"surveys",(l=>{l||!e.generateSurveys?this.ya("Could not load surveys script",l):this.ma(e.generateSurveys,t)}))}catch(l){throw this.ya("Error initializing surveys",l),l}finally{this.fa=!1}}}else jt.error("PostHog Extensions not found.")}}ma(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new yC(this._instance),jt.info("Surveys loaded successfully"),this.ba({isLoaded:!0})}ya(e,t){jt.error(e,t),this.ba({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.pa.push(e),this._surveyManager&&this.ba({isLoaded:!0}),()=>{this.pa=this.pa.filter((t=>t!==e))}}getSurveys(e,t){if(t===void 0&&(t=!1),this.qt.disable_surveys)return jt.info(sy),e([]);var n,i=this._instance.get_property(Dm);if(i&&!t)return e(i,{isLoaded:!0});typeof Promise<"u"&&this.ga?this.ga.then((l=>{var{surveys:c,context:u}=l;return e(c,u)})):(typeof Promise<"u"&&(this.ga=new Promise((l=>{n=l}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.qt.token),method:"GET",timeout:this.qt.surveys_request_timeout_ms,callback:l=>{var c;this.ga=null;var u=l.statusCode;if(u!==200||!l.json){var f="Surveys API could not be loaded, status: "+u;jt.error(f);var h={isLoaded:!1,error:f};return e([],h),void(n==null||n({surveys:[],context:h}))}var p,g=l.json.surveys||[],v=g.filter((b=>(function(_){return!(!_.start_date||_.end_date)})(b)&&((function(_){var S;return!((S=_.conditions)==null||(S=S.events)==null||(S=S.values)==null||!S.length)})(b)||(function(_){var S;return!((S=_.conditions)==null||(S=S.actions)==null||(S=S.values)==null||!S.length)})(b))));v.length>0&&((p=this._surveyEventReceiver)==null||p.register(v)),(c=this._instance.persistence)==null||c.register({[Dm]:g,[wg]:Date.now()});var y={isLoaded:!0};e(g,y),n==null||n({surveys:g,context:y})}}))}ba(e){for(var t of this.pa)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(n){jt.error("Error in survey callback",n)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!rt(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);jt.warn("init was not called")}_a(e){var t=null;return this.getSurveys((n=>{var i;t=(i=n.find((l=>l.id===e)))!==null&&i!==void 0?i:null})),t}wa(e){if(rt(this._surveyManager))return{eligible:!1,reason:Rp};var t=typeof e=="string"?this._a(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(rt(this._surveyManager))return jt.warn("init was not called"),{visible:!1,disabledReason:Rp};var t=this.wa(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return rt(this._surveyManager)?(jt.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Rp})):new Promise((n=>{this.getSurveys((i=>{var l,c=(l=i.find((f=>f.id===e)))!==null&&l!==void 0?l:null;if(c){var u=this.wa(c);n({visible:u.eligible,disabledReason:u.reason})}else n({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t,n){var i;if(rt(this._surveyManager))jt.warn("init was not called");else{var l=typeof e=="string"?this._a(e):e;if(l!=null&&l.id)if(aC.includes(l.type)){var c=Ce==null?void 0:Ce.querySelector(t);if(c)return(i=l.appearance)!=null&&i.surveyPopupDelaySeconds?(jt.info("Rendering survey "+l.id+" with delay of "+l.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var u,f;jt.info("Rendering survey "+l.id+" with delay of "+((u=l.appearance)==null?void 0:u.surveyPopupDelaySeconds)+" seconds"),(f=this._surveyManager)==null||f.renderSurvey(l,c,n),jt.info("Survey "+l.id+" rendered")}),1e3*l.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(l,c,n);jt.warn("Survey element not found")}else jt.warn("Surveys of type "+l.type+" cannot be rendered in the app");else jt.warn("Survey not found")}}displaySurvey(e,t){var n;if(rt(this._surveyManager))jt.warn("init was not called");else{var i=this._a(e);if(i){var l=i;if((n=i.appearance)!=null&&n.surveyPopupDelaySeconds&&t.ignoreDelay&&(l=ye({},i,{appearance:ye({},i.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==qm.Popover&&t.initialResponses&&jt.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){var c=this.canRenderSurvey(i);if(!c.visible)return void jt.warn("Survey is not eligible to be displayed: ",c.disabledReason)}t.displayType!==qm.Inline?this._surveyManager.handlePopoverSurvey(l,t):this.renderSurvey(l,t.selector,t.properties)}else jt.warn("Survey not found")}}cancelPendingSurvey(e){rt(this._surveyManager)?jt.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload()}}},qd),AC={toolbar:class{constructor(e){this.instance=e}xa(e){Le.ph_toolbar_state=e}Sa(){var e;return(e=Le.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),N_(this.instance.config)||!ie||!Ce)return!1;e=e??ie.location,n=n??ie.history;try{if(!t){try{ie.localStorage.setItem("test","test"),ie.localStorage.removeItem("test")}catch{return!1}t=ie==null?void 0:ie.localStorage}var i,l=_C||Td(e.hash,"__posthog")||Td(e.hash,"state"),c=l?Sb((()=>JSON.parse(atob(decodeURIComponent(l)))))||Sb((()=>JSON.parse(decodeURIComponent(l)))):null;return c&&c.action==="ph_authorize"?((i=c).source="url",i&&Object.keys(i).length>0&&(c.desiredHash?e.hash=c.desiredHash:n?n.replaceState(n.state,"",e.pathname+e.search):e.hash="")):((i=JSON.parse(t.getItem(ay)||"{}")).source="localstorage",delete i.userIntent),!(!i.token||this.instance.config.token!==i.token||(this.loadToolbar(i),0))}catch{return!1}}ka(e){var t=Le.ph_load_toolbar||Le.ph_load_editor;!rt(t)&&ji(t)?t(e,this.instance):ly.warn("No toolbar load function found")}loadToolbar(e){var t=!(Ce==null||!Ce.getElementById(w_));if(!ie||t)return!1;var n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,i=ye({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(ie.localStorage.setItem(ay,JSON.stringify(ye({},i,{source:void 0}))),this.Sa()===2)this.ka(i);else if(this.Sa()===0){var l;this.xa(1),(l=Le.__PosthogExtensions__)==null||l.loadExternalDependency==null||l.loadExternalDependency(this.instance,"toolbar",(c=>{if(c)return ly.error("[Toolbar] Failed to load",c),void this.xa(0);this.xa(2),this.ka(i)})),Kt(ie,"turbolinks:load",(()=>{this.xa(0),this.loadToolbar(i)}))}return!0}Ca(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)}}},MC=ye({experiments:Tn},qd),RC={conversations:class{constructor(e){this.Ia=void 0,this._conversationsManager=null,this.Ta=!1,this.Ea=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var t=e.conversations;rt(t)||(Zr(t)?this.Ia=t:(this.Ia=t.enabled,this.Ea=t),this.loadIfEnabled())}}reset(){var e;(e=this._conversationsManager)==null||e.reset(),this._conversationsManager=null,this.Ia=void 0,this.Ea=null}loadIfEnabled(){if(!(this._conversationsManager||this.Ta||this._instance.config.disable_conversations||N_(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=Le==null?void 0:Le.__PosthogExtensions__;if(e&&!Se(this.Ia)&&this.Ia)if(this.Ea&&this.Ea.token){this.Ta=!0;try{var t=e.initConversations;if(t)return this.Ma(t),void(this.Ta=!1);var n=e.loadExternalDependency;if(!n)return void this.Ra(kg);n(this._instance,"conversations",(i=>{i||!e.initConversations?this.Ra("Could not load conversations script",i):this.Ma(e.initConversations),this.Ta=!1}))}catch(i){this.Ra("Error initializing conversations",i),this.Ta=!1}}else _r.error("Conversations enabled but missing token in remote config.")}}Ma(e){if(this.Ea)try{this._conversationsManager=e(this.Ea,this._instance),_r.info("Conversations loaded successfully")}catch(t){this.Ra("Error completing conversations initialization",t)}else _r.error("Cannot complete initialization: remote config is null")}Ra(e,t){_r.error(e,t),this._conversationsManager=null,this.Ta=!1}show(){this._conversationsManager?this._conversationsManager.show():_r.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Ia===!0&&!or(this._conversationsManager)}isVisible(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.isVisible())!==null&&e!==void 0&&e}sendMessage(e,t,n){var i=this;return sr((function*(){return i._conversationsManager?i._conversationsManager.sendMessage(e,t,n):(_r.warn(Xs),null)}))()}getMessages(e,t){var n=this;return sr((function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(_r.warn(Xs),null)}))()}markAsRead(e){var t=this;return sr((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(_r.warn(Xs),null)}))()}getTickets(e){var t=this;return sr((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(_r.warn(Xs),null)}))()}requestRestoreLink(e){var t=this;return sr((function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(_r.warn(Xs),null)}))()}restoreFromToken(e){var t=this;return sr((function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(_r.warn(Xs),null)}))()}restoreFromUrlToken(){var e=this;return sr((function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(_r.warn(Xs),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}Ln(){var e;(e=this._conversationsManager)==null||e.setIdentity()}An(){var e;(e=this._conversationsManager)==null||e.clearIdentity()}}},DC={logs:class{constructor(e){var t;this.Pa=!1,this.Oa=!1,this.Gt=Vt("[logs]"),this.La=[],this.Aa=0,this.Fa=0,this.Na=!1,this._instance=e,this._instance&&(t=this._instance.config.logs)!=null&&t.captureConsoleLogs&&(this.Pa=!0)}initialize(){this.loadIfEnabled()}onRemoteConfig(e){var t,n=(t=e.logs)==null?void 0:t.captureConsoleLogs;!rt(n)&&n&&(this.Pa=!0,this.loadIfEnabled())}reset(){this.La=[],this.ii&&(clearTimeout(this.ii),this.ii=void 0),this.Aa=0,this.Fa=0,this.Na=!1}loadIfEnabled(){if(this.Pa&&!this.Oa){var e=Le==null?void 0:Le.__PosthogExtensions__;if(e){var t=e.loadExternalDependency;t?t(this._instance,"logs",(n=>{var i;n||(i=e.logs)==null||!i.initializeLogs?this.Gt.error("Could not load logs script",n):(e.logs.initializeLogs(this._instance),this.Oa=!0)})):this.Gt.error(kg)}else this.Gt.error("PostHog Extensions not found.")}}captureLog(e){var t,n,i,l,c,u;if(this._instance.is_capturing())if(e&&e.body){var f=(t=(n=this._instance.config.logs)==null?void 0:n.flushIntervalMs)!==null&&t!==void 0?t:3e3,h=(i=(l=this._instance.config.logs)==null?void 0:l.maxLogsPerInterval)!==null&&i!==void 0?i:1e3,p=Date.now();if(f>p-this.Fa||(this.Fa=p,this.Aa=0,this.Na=!1),h>this.Aa){this.Aa++;var g=(function(v,y){var b=v.level||"info",{text:_,number:S}=f_[b]||qN,T=String(Date.now())+"000000",j={};y.distinctId&&(j.posthogDistinctId=y.distinctId),y.sessionId&&(j.sessionId=y.sessionId),y.currentUrl&&(j["url.full"]=y.currentUrl),y.screenName&&(j["screen.name"]=y.screenName),y.appState&&(j["app.state"]=y.appState),y.activeFeatureFlags&&y.activeFeatureFlags.length>0&&(j.feature_flags=y.activeFeatureFlags);var R=ye({},j,v.attributes||{}),C={timeUnixNano:T,observedTimeUnixNano:T,severityNumber:S,severityText:_,body:{stringValue:v.body},attributes:_b(R)};return v.trace_id&&(C.traceId=v.trace_id),v.span_id&&(C.spanId=v.span_id),Se(v.trace_flags)||(C.flags=v.trace_flags),C})(e,this.Da());this.La.push({record:g}),((c=(u=this._instance.config.logs)==null?void 0:u.maxBufferSize)!==null&&c!==void 0?c:100)>this.La.length?this.$a():this.flushLogs()}else this.Na||(this.Gt.warn("captureLog dropping logs: exceeded "+h+" logs per "+f+"ms"),this.Na=!0)}else this.Gt.warn("captureLog requires a body")}get logger(){return this.qa||(this.qa={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.qa}flushLogs(e){if(this.ii&&(clearTimeout(this.ii),this.ii=void 0),this.La.length!==0){var t=this.La;this.La=[];var n=this._instance.config.logs,i=ye({"service.name":(n==null?void 0:n.serviceName)||"unknown_service"},(n==null?void 0:n.environment)&&{"deployment.environment":n.environment},(n==null?void 0:n.serviceVersion)&&{"service.version":n.serviceVersion},n==null?void 0:n.resourceAttributes),l=(function(u,f,h,p){return{resourceLogs:[{resource:{attributes:_b(f)},scopeLogs:[{scope:{name:h,version:p},logRecords:u}]}]}})(t.map((u=>u.record)),i,xn.LIB_NAME,xn.LIB_VERSION),c=this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token);this._instance.pn({method:"POST",url:c,data:l,compression:"best-available",batchKey:"logs",transport:e})}}$a(){var e,t;this.ii||(this.ii=setTimeout((()=>{this.ii=void 0,this.flushLogs()}),(e=(t=this._instance.config.logs)==null?void 0:t.flushIntervalMs)!==null&&e!==void 0?e:3e3))}Da(){var e,t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var{sessionId:n}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=n}if(Le!=null&&(e=Le.location)!=null&&e.href&&(t.currentUrl=Le.location.href),this._instance.featureFlags){var i=this._instance.featureFlags.getFlags();i&&i.length>0&&(t.activeFeatureFlags=i)}return t}}},zC=ye({},qd,kC,SC,jC,NC,CC,TC,EC,AC,MC,RC,DC);jr.__defaultExtensionClasses=ye({},zC);var cc=(function(){xn.SDK_DIST_CHANNEL="npm";var e=Wo[el]=new jr;return(function(){function t(){t.done||(t.done=!0,sw=!1,zt(Wo,(function(n){n._dom_loaded()})))}Ce!=null&&Ce.addEventListener?Ce.readyState==="complete"?t():Kt(Ce,"DOMContentLoaded",t,{capture:!1}):ie&&Ne.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),e})();const LC="https://us.i.posthog.com",aw="cc-telemetry-enabled";let Zm=!1,uc=!1;function OC(){return LC}function BC(){if(typeof localStorage>"u")return!0;const e=localStorage.getItem(aw);return e===null?!0:e==="true"}function lw(e){Zm&&(e?(cc.opt_in_capturing({captureEventName:null}),uc=!0):(cc.opt_out_capturing(),uc=!1))}function aD(e){typeof localStorage<"u"&&localStorage.setItem(aw,String(e)),lw(e)}function $C(){const e=void 0;return e?(cc.init(e,{api_host:OC(),defaults:"2026-01-30",capture_pageview:!1,capture_pageleave:!0,capture_exceptions:!0,autocapture:!0,respect_dnt:!0}),Zm=!0,lw(BC()),!0):(Zm=!1,uc=!1,!1)}function Mg(e,t){uc&&cc.capture(e,t)}function Jr(e,t){uc&&cc.captureException(e,t)}function PC(e){Mg("$pageview",{$current_url:e})}const Ai="/api",ow="companion_auth_token";function sa(){if(typeof window>"u")return{};const e=localStorage.getItem(ow);return e?{Authorization:`Bearer ${e}`}:{}}function ml(e){e===401&&typeof window<"u"&&(localStorage.removeItem(ow),Xn(async()=>{const{useStore:t}=await Promise.resolve().then(()=>wj);return{useStore:t}},void 0).then(({useStore:t})=>{t.getState().logout()}).catch(()=>{}))}function cn(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}function gc(e,t,n,i){Mg("api_request_succeeded",{method:e,path:t,status:i,duration_ms:Math.round(n)})}function ei(e,t,n,i,l){Mg("api_request_failed",{method:e,path:t,status:l,duration_ms:Math.round(n),error:i instanceof Error?i.message:String(i)}),Jr(i,{method:e,path:t,status:l})}async function He(e,t){const n=cn();let i=!1;try{const l=await fetch(`${Ai}${e}`,{method:"POST",headers:{"Content-Type":"application/json",...sa()},body:t?JSON.stringify(t):void 0});if(!l.ok){ml(l.status);const c=await l.json().catch(()=>({error:l.statusText})),u=new Error(c.error||l.statusText);throw ei("POST",e,cn()-n,u,l.status),i=!0,u}return gc("POST",e,cn()-n,l.status),l.json()}catch(l){throw i||ei("POST",e,cn()-n,l),l}}async function Re(e){const t=cn();let n=!1;try{const i=await fetch(`${Ai}${e}`,{headers:{...sa()}});if(!i.ok){ml(i.status);const l=await i.json().catch(()=>({error:i.statusText})),c=new Error(l.error||i.statusText);throw ei("GET",e,cn()-t,c,i.status),n=!0,c}return gc("GET",e,cn()-t,i.status),i.json()}catch(i){throw n||ei("GET",e,cn()-t,i),i}}async function wr(e,t){const n=cn();let i=!1;try{const l=await fetch(`${Ai}${e}`,{method:"PUT",headers:{"Content-Type":"application/json",...sa()},body:t?JSON.stringify(t):void 0});if(!l.ok){ml(l.status);const c=await l.json().catch(()=>({error:l.statusText})),u=new Error(c.error||l.statusText);throw ei("PUT",e,cn()-n,u,l.status),i=!0,u}return gc("PUT",e,cn()-n,l.status),l.json()}catch(l){throw i||ei("PUT",e,cn()-n,l),l}}async function UC(e,t){const n=cn();let i=!1;try{const l=await fetch(`${Ai}${e}`,{method:"PATCH",headers:{"Content-Type":"application/json",...sa()},body:t?JSON.stringify(t):void 0});if(!l.ok){ml(l.status);const c=await l.json().catch(()=>({error:l.statusText})),u=new Error(c.error||l.statusText);throw ei("PATCH",e,cn()-n,u,l.status),i=!0,u}return gc("PATCH",e,cn()-n,l.status),l.json()}catch(l){throw i||ei("PATCH",e,cn()-n,l),l}}async function kr(e,t){const n=cn();let i=!1;try{const l=await fetch(`${Ai}${e}`,{method:"DELETE",headers:{...t?{"Content-Type":"application/json"}:{},...sa()},body:t?JSON.stringify(t):void 0});if(!l.ok){ml(l.status);const c=await l.json().catch(()=>({error:l.statusText})),u=new Error(c.error||l.statusText);throw ei("DELETE",e,cn()-n,u,l.status),i=!0,u}return gc("DELETE",e,cn()-n,l.status),l.json()}catch(l){throw i||ei("DELETE",e,cn()-n,l),l}}async function FC(e,t){const n=await fetch(`${Ai}/sessions/create-stream`,{method:"POST",headers:{"Content-Type":"application/json",...sa()},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 i=n.body.getReader(),l=new TextDecoder;let c="",u=null;for(;;){const{done:f,value:h}=await i.read();if(f)break;c+=l.decode(h,{stream:!0});const p=c.split(`
|
|
63
|
+
|
|
64
|
+
`);c=p.pop()||"";for(const g of p){if(!g.trim())continue;let v="",y="";for(const _ of g.split(`
|
|
65
|
+
`))_.startsWith("event:")?v=_.slice(6).trim():_.startsWith("data:")&&(y=_.slice(5).trim());if(!y)continue;const b=JSON.parse(y);if(v==="progress")t(b);else if(v==="done")u=b;else if(v==="error")throw new Error(b.error||"Session creation failed")}}if(!u)throw new Error("Stream ended without session creation result");return u}async function HC(){try{const e=await fetch(`${Ai}/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 dy(e){try{const t=await fetch(`${Ai}/auth/verify`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e})});return t.ok?!!(await t.json()).ok:!1}catch{return!1}}const we={getAuthQr:()=>Re("/auth/qr"),getAuthToken:()=>Re("/auth/token"),regenerateAuthToken:()=>He("/auth/regenerate"),createSession:e=>He("/sessions/create",e),listSessions:()=>Re("/sessions"),discoverClaudeSessions:(e=200)=>Re(`/claude/sessions/discover?limit=${encodeURIComponent(String(e))}`),getClaudeSessionHistory:(e,t)=>{const n=Math.max(0,Math.floor((t==null?void 0:t.cursor)??0)),i=Math.max(1,Math.floor((t==null?void 0:t.limit)??40));return Re(`/claude/sessions/${encodeURIComponent(e)}/history?cursor=${encodeURIComponent(String(n))}&limit=${encodeURIComponent(String(i))}`)},killSession:e=>He(`/sessions/${encodeURIComponent(e)}/kill`),deleteSession:e=>kr(`/sessions/${encodeURIComponent(e)}`),relaunchSession:e=>He(`/sessions/${encodeURIComponent(e)}/relaunch`),archiveSession:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/archive`,t),getArchiveInfo:e=>Re(`/sessions/${encodeURIComponent(e)}/archive-info`),unarchiveSession:e=>He(`/sessions/${encodeURIComponent(e)}/unarchive`),renameSession:(e,t)=>UC(`/sessions/${encodeURIComponent(e)}/name`,{name:t}),listDirs:e=>Re(`/fs/list${e?`?path=${encodeURIComponent(e)}`:""}`),getHome:()=>Re("/fs/home"),listEnvs:()=>Re("/envs"),getEnv:e=>Re(`/envs/${encodeURIComponent(e)}`),createEnv:(e,t)=>He("/envs",{name:e,variables:t}),updateEnv:(e,t)=>wr(`/envs/${encodeURIComponent(e)}`,t),deleteEnv:e=>kr(`/envs/${encodeURIComponent(e)}`),listSandboxes:()=>Re("/sandboxes"),getSandbox:e=>Re(`/sandboxes/${encodeURIComponent(e)}`),createSandbox:(e,t)=>He("/sandboxes",{name:e,...t}),updateSandbox:(e,t)=>wr(`/sandboxes/${encodeURIComponent(e)}`,t),deleteSandbox:e=>kr(`/sandboxes/${encodeURIComponent(e)}`),testInitScript:(e,t,n)=>He(`/sandboxes/${encodeURIComponent(e)}/test-init`,{cwd:t,initScript:n}),buildBaseImage:()=>He("/docker/build-base"),getBaseImageStatus:()=>Re("/docker/base-image"),getSettings:()=>Re("/settings"),updateSettings:e=>wr("/settings",e),verifyAnthropicKey:e=>He("/settings/anthropic/verify",{apiKey:e}),getTailscaleStatus:()=>Re("/tailscale/status"),startTailscaleFunnel:()=>He("/tailscale/funnel/start"),stopTailscaleFunnel:()=>He("/tailscale/funnel/stop"),listLinearConnections:()=>Re("/linear/connections"),createLinearConnection:e=>He("/linear/connections",e),updateLinearConnection:(e,t)=>wr(`/linear/connections/${encodeURIComponent(e)}`,t),deleteLinearConnection:e=>kr(`/linear/connections/${encodeURIComponent(e)}`),verifyLinearConnection:e=>He(`/linear/connections/${encodeURIComponent(e)}/verify`,{}),searchLinearIssues:(e,t=8,n)=>Re(`/linear/issues?query=${encodeURIComponent(e)}&limit=${encodeURIComponent(String(t))}${n?`&connectionId=${encodeURIComponent(n)}`:""}`),getLinearConnection:e=>Re(`/linear/connection${e?`?connectionId=${encodeURIComponent(e)}`:""}`),getLinearStates:e=>Re(`/linear/states${e?`?connectionId=${encodeURIComponent(e)}`:""}`),transitionLinearIssue:(e,t)=>He(`/linear/issues/${encodeURIComponent(e)}/transition${t?`?connectionId=${encodeURIComponent(t)}`:""}`,{}),listLinearProjects:e=>Re(`/linear/projects${e?`?connectionId=${encodeURIComponent(e)}`:""}`),getLinearProjectIssues:(e,t=15,n)=>Re(`/linear/project-issues?projectId=${encodeURIComponent(e)}&limit=${encodeURIComponent(String(t))}${n?`&connectionId=${encodeURIComponent(n)}`:""}`),getLinearProjectMapping:e=>Re(`/linear/project-mappings?repoRoot=${encodeURIComponent(e)}`),upsertLinearProjectMapping:e=>wr("/linear/project-mappings",e),removeLinearProjectMapping:e=>kr("/linear/project-mappings",{repoRoot:e}),linkLinearIssue:(e,t,n)=>wr(`/sessions/${encodeURIComponent(e)}/linear-issue`,{...t,...n!==void 0?{connectionId:n}:{}}),unlinkLinearIssue:e=>kr(`/sessions/${encodeURIComponent(e)}/linear-issue`),getLinkedLinearIssue:(e,t=!1)=>Re(`/sessions/${encodeURIComponent(e)}/linear-issue${t?"?refresh=true":""}`),createLinearIssue:e=>He("/linear/issues",e),addLinearComment:(e,t,n)=>He(`/linear/issues/${encodeURIComponent(e)}/comments`,{body:t,connectionId:n}),getRepoInfo:e=>Re(`/git/repo-info?path=${encodeURIComponent(e)}`),listBranches:e=>Re(`/git/branches?repoRoot=${encodeURIComponent(e)}`),gitFetch:e=>He("/git/fetch",{repoRoot:e}),gitPull:e=>He("/git/pull",{cwd:e}),listWorktrees:e=>Re(`/git/worktrees?repoRoot=${encodeURIComponent(e)}`),createWorktree:(e,t,n)=>He("/git/worktree",{repoRoot:e,branch:t,...n}),removeWorktree:(e,t,n)=>kr("/git/worktree",{repoRoot:e,worktreePath:t,force:n}),getPRStatus:(e,t)=>Re(`/git/pr-status?cwd=${encodeURIComponent(e)}&branch=${encodeURIComponent(t)}`),getBackends:()=>Re("/backends"),getBackendModels:e=>Re(`/backends/${encodeURIComponent(e)}/models`),getContainerStatus:()=>Re("/containers/status"),getContainerImages:()=>Re("/containers/images"),getImageStatus:e=>Re(`/images/${encodeURIComponent(e)}/status`),pullImage:e=>He(`/images/${encodeURIComponent(e)}/pull`),getCloudProviderPlan:(e,t,n)=>Re(`/cloud/providers/${encodeURIComponent(e)}/plan?cwd=${encodeURIComponent(t)}&sessionId=${encodeURIComponent(n)}`),startEditor:e=>He(`/sessions/${encodeURIComponent(e)}/editor/start`),startBrowser:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/browser/start`,t?{url:t}:void 0),navigateBrowser:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/browser/navigate`,{url:t}),getFileTree:e=>Re(`/fs/tree?path=${encodeURIComponent(e)}`),readFile:e=>Re(`/fs/read?path=${encodeURIComponent(e)}`),getFileBlob:async e=>{const t=await fetch(`${Ai}/fs/raw?path=${encodeURIComponent(e)}`,{headers:{...sa()}});if(!t.ok){ml(t.status);const i=await t.json().catch(()=>({error:t.statusText}));throw new Error(i.error||t.statusText)}const n=await t.blob();return URL.createObjectURL(n)},writeFile:(e,t)=>wr("/fs/write",{path:e,content:t}),getFileDiff:(e,t)=>Re(`/fs/diff?path=${encodeURIComponent(e)}${t?`&base=${encodeURIComponent(t)}`:""}`),getChangedFiles:(e,t)=>Re(`/fs/changed-files?cwd=${encodeURIComponent(e)}${t?`&base=${encodeURIComponent(t)}`:""}`),getClaudeMdFiles:e=>Re(`/fs/claude-md?cwd=${encodeURIComponent(e)}`),saveClaudeMd:(e,t)=>wr("/fs/claude-md",{path:e,content:t}),getClaudeConfig:e=>Re(`/fs/claude-config?cwd=${encodeURIComponent(e)}`),getUsageLimits:()=>Re("/usage-limits"),getSessionUsageLimits:e=>Re(`/sessions/${encodeURIComponent(e)}/usage-limits`),spawnTerminal:(e,t,n,i)=>He("/terminal/spawn",{cwd:e,cols:t,rows:n,containerId:i==null?void 0:i.containerId}),killTerminal:e=>He("/terminal/kill",{terminalId:e}),getTerminal:e=>Re(e?`/terminal?terminalId=${encodeURIComponent(e)}`:"/terminal"),checkForUpdate:()=>Re("/update-check"),forceCheckForUpdate:()=>He("/update-check"),triggerUpdate:()=>He("/update"),getClaudeCompat:()=>Re("/claude-compat"),refreshClaudeCompat:()=>He("/claude-compat/refresh"),pinClaudeVersion:e=>He("/claude-compat/pin",e?{version:e}:{}),patchClaudeBinary:()=>He("/claude-compat/patch"),unpatchClaudeBinary:()=>He("/claude-compat/unpatch"),dismissClaudeCompatBanner:e=>He("/claude-compat/dismiss-banner",{version:e}),listCronJobs:()=>Re("/cron/jobs"),getCronJob:e=>Re(`/cron/jobs/${encodeURIComponent(e)}`),createCronJob:e=>He("/cron/jobs",e),updateCronJob:(e,t)=>wr(`/cron/jobs/${encodeURIComponent(e)}`,t),deleteCronJob:e=>kr(`/cron/jobs/${encodeURIComponent(e)}`),toggleCronJob:e=>He(`/cron/jobs/${encodeURIComponent(e)}/toggle`),runCronJob:e=>He(`/cron/jobs/${encodeURIComponent(e)}/run`),getCronJobExecutions:e=>Re(`/cron/jobs/${encodeURIComponent(e)}/executions`),killProcess:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/processes/${encodeURIComponent(t)}/kill`),killAllProcesses:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/processes/kill-all`,{taskIds:t}),getSystemProcesses:e=>Re(`/sessions/${encodeURIComponent(e)}/processes/system`),killSystemProcess:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/processes/system/${t}/kill`),listAgents:()=>Re("/agents"),getAgent:e=>Re(`/agents/${encodeURIComponent(e)}`),createAgent:e=>He("/agents",e),updateAgent:(e,t)=>wr(`/agents/${encodeURIComponent(e)}`,t),deleteAgent:e=>kr(`/agents/${encodeURIComponent(e)}`),toggleAgent:e=>He(`/agents/${encodeURIComponent(e)}/toggle`),runAgent:(e,t)=>He(`/agents/${encodeURIComponent(e)}/run`,{input:t}),getAgentExecutions:e=>Re(`/agents/${encodeURIComponent(e)}/executions`),importAgent:e=>He("/agents/import",e),exportAgent:e=>Re(`/agents/${encodeURIComponent(e)}/export`),regenerateAgentWebhookSecret:e=>He(`/agents/${encodeURIComponent(e)}/regenerate-secret`),listExecutions:e=>{const t=new URLSearchParams;e!=null&&e.agentId&&t.set("agentId",e.agentId),e!=null&&e.triggerType&&t.set("triggerType",e.triggerType),e!=null&&e.status&&t.set("status",e.status),e!=null&&e.limit&&t.set("limit",String(e.limit)),e!=null&&e.offset&&t.set("offset",String(e.offset));const n=t.toString();return Re(`/executions${n?`?${n}`:""}`)},getLinearOAuthStatus:e=>{const t=new URLSearchParams;e&&t.set("stagingId",e);const n=t.toString();return Re(`/linear/oauth/status${n?`?${n}`:""}`)},getLinearOAuthAuthorizeUrl:(e,t)=>{const n=new URLSearchParams;e&&n.set("returnTo",e),t&&n.set("stagingId",t);const i=n.toString();return Re(`/linear/oauth/authorize-url${i?`?${i}`:""}`)},disconnectLinearOAuth:()=>He("/linear/oauth/disconnect"),createLinearStaging:e=>He("/linear/oauth/staging",e),getLinearStagingStatus:e=>Re(`/linear/oauth/staging/${encodeURIComponent(e)}/status`),deleteLinearStaging:e=>kr(`/linear/oauth/staging/${encodeURIComponent(e)}`),listLinearOAuthConnections:()=>Re("/linear/oauth-connections"),createLinearOAuthConnection:e=>He("/linear/oauth-connections",e),updateLinearOAuthConnection:(e,t)=>wr(`/linear/oauth-connections/${encodeURIComponent(e)}`,t),deleteLinearOAuthConnection:e=>kr(`/linear/oauth-connections/${encodeURIComponent(e)}`),getLinearOAuthConnectionAuthorizeUrl:(e,t)=>Re(`/linear/oauth-connections/${encodeURIComponent(e)}/authorize-url${t?`?returnTo=${encodeURIComponent(t)}`:""}`),listSkills:()=>Re("/skills"),sendSessionMessage:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/message`,{content:t}),listPrompts:(e,t)=>{const n=new URLSearchParams;e&&n.set("cwd",e),t&&n.set("scope",t);const i=n.toString();return Re(`/prompts${i?`?${i}`:""}`)},createPrompt:e=>He("/prompts",e),updatePrompt:(e,t)=>wr(`/prompts/${encodeURIComponent(e)}`,t),deletePrompt:e=>kr(`/prompts/${encodeURIComponent(e)}`)};let fy=!1;function hy(e){return new Promise((t,n)=>{if(typeof document>"u"||typeof document.execCommand!="function"){n(new Error("Clipboard fallback is unavailable"));return}try{const i=document.createElement("textarea");i.value=e,i.setAttribute("readonly",""),i.style.position="fixed",i.style.left="-9999px",document.body.appendChild(i),i.select();const l=document.execCommand("copy");if(document.body.removeChild(i),!l){n(new Error("Copy command was rejected"));return}t()}catch(i){n(i instanceof Error?i:new Error("Clipboard copy failed"))}})}function py(){return new Promise(()=>{})}function qC(){if(fy||typeof window>"u")return;fy=!0;const e=window.navigator,t=e.clipboard;if(t!=null&&t.writeText){const n=t.writeText.bind(t);try{t.writeText=async i=>{try{await n(i)}catch{try{await hy(i)}catch{return py()}}}}catch{}return}try{Object.defineProperty(e,"clipboard",{configurable:!0,value:{writeText:async n=>{try{await hy(n)}catch{return py()}}}})}catch{}}const my="#/session/",gy="#/agents/";let xy=!1;function Rg(){xy||(qC(),xy=!0)}function Dg(e){if(Rg(),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(gy)){const n=e.slice(gy.length);if(n)return{page:"agent-detail",agentId:n}}if(e.startsWith(my)){const n=e.slice(my.length);if(n)return{page:"session",sessionId:n}}return{page:"home"}}function IC(e){return`#/session/${e}`}function zg(e,t=!1){Rg();const n=IC(e);t?(history.replaceState(null,"",n),window.dispatchEvent(new HashChangeEvent("hashchange"))):window.location.hash=`/session/${e}`}function zp(e=!1){Rg(),e?(history.replaceState(null,"",window.location.pathname+window.location.search),window.dispatchEvent(new HashChangeEvent("hashchange"))):window.location.hash=""}function VC(){const[e,t]=k.useState(""),[n,i]=k.useState(null),[l,c]=k.useState(!1),u=X(g=>g.setAuthToken),f=k.useCallback(async g=>{g.preventDefault();const v=e.trim();if(!v){i("Please enter a token");return}c(!0),i(null),await dy(v)?u(v):i("Invalid token"),c(!1)},[e,u]);k.useEffect(()=>{HC().then(g=>{if(g){u(g);return}const y=new URLSearchParams(window.location.search).get("token");y&&(c(!0),dy(y).then(b=>{if(b){u(y);const _=new URL(window.location.href);_.searchParams.delete("token"),window.history.replaceState({},"",_.toString())}else i("Invalid token from URL"),c(!1)}))})},[u]);const[h,p]=k.useState(!1);return a.jsx("div",{className:"h-[100dvh] flex items-center justify-center bg-cc-bg text-cc-fg font-sans-ui antialiased",children:a.jsxs("div",{className:"w-full max-w-sm px-6",children:[a.jsxs("div",{className:"text-center mb-8",children:[a.jsx("h1",{className:"text-xl font-semibold text-cc-fg mb-2",children:"The Companion"}),a.jsx("p",{className:"text-sm text-cc-muted",children:"Enter your auth token to continue"})]}),a.jsxs("form",{onSubmit:f,className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"auth-token",className:"block text-xs text-cc-muted mb-1.5",children:"Auth Token"}),a.jsxs("div",{className:"relative",children:[a.jsx("input",{id:"auth-token",type:h?"text":"password",value:e,onChange:g=>{t(g.target.value),i(null)},placeholder:"Paste your token here",className:"w-full px-3 py-2 pr-16 text-sm bg-cc-hover border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted/50 focus:outline-none focus:ring-1 focus:ring-cc-primary focus:border-cc-primary font-mono",autoComplete:"off",disabled:l}),a.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&&a.jsx("p",{className:"text-xs text-cc-error",role:"alert",children:n}),a.jsx("button",{type:"submit",disabled:l||!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:l?"Verifying...":"Login"})]}),a.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 gl=C5();function GC({issueIdentifier:e,issueStateName:t,isContainerized:n,archiveTransitionConfigured:i,archiveTransitionStateName:l,hasBacklogState:c,onConfirm:u,onCancel:f}){const[h,p]=k.useState("none");return gl.createPortal(a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:f,children:a.jsxs("div",{role:"dialog","aria-label":"Archive session",className:"mx-4 w-full max-w-sm bg-cc-card border border-cc-border rounded-xl shadow-2xl p-5",onClick:g=>g.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsx("h3",{className:"text-sm font-semibold text-cc-fg",children:"Archive session"}),a.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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.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&&a.jsx("div",{className:"mb-3 p-2.5 rounded-lg bg-amber-500/10 border border-amber-500/20",children:a.jsxs("div",{className:"flex items-start gap-2",children:[a.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:a.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"})}),a.jsxs("p",{className:"text-[11px] text-cc-fg leading-snug",children:["Archiving will ",a.jsx("strong",{children:"remove the container"})," and any uncommitted changes."]})]})}),a.jsxs("p",{className:"text-xs text-cc-muted mb-3",children:["This session is linked to ",a.jsx("strong",{className:"text-cc-fg",children:e})," ",a.jsxs("span",{className:"text-cc-muted",children:["(",t,")"]}),". What should happen to the issue?"]}),a.jsxs("fieldset",{className:"space-y-2 mb-4",children:[a.jsx("legend",{className:"sr-only",children:"Linear issue transition choice"}),a.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:[a.jsx("input",{type:"radio",name:"archive-linear-choice",value:"none",checked:h==="none",onChange:()=>p("none"),className:"accent-cc-primary"}),a.jsx("span",{className:"text-xs text-cc-fg",children:"Keep current status"})]}),a.jsxs("label",{className:`flex items-center gap-2.5 px-2.5 py-2 rounded-lg border border-cc-border transition-colors ${c?"hover:bg-cc-hover/50 cursor-pointer":"opacity-50 cursor-not-allowed"}`,children:[a.jsx("input",{type:"radio",name:"archive-linear-choice",value:"backlog",checked:h==="backlog",onChange:()=>p("backlog"),disabled:!c,className:"accent-cc-primary"}),a.jsx("span",{className:"text-xs text-cc-fg",children:"Move to Backlog"})]}),i&&l&&a.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:[a.jsx("input",{type:"radio",name:"archive-linear-choice",value:"configured",checked:h==="configured",onChange:()=>p("configured"),className:"accent-cc-primary"}),a.jsxs("span",{className:"text-xs text-cc-fg",children:["Move to ",l]})]})]}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.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"}),a.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 YC(e,t){return t>0?"awaiting":(e.status==="running"||e.status==="compacting")&&e.isConnected?"running":e.isReconnecting?"reconnecting":e.isConnected?"idle":"exited"}function WC({status:e}){switch(e){case"running":return a.jsxs("span",{className:"relative shrink-0 w-2 h-2",children:[a.jsx("span",{className:"absolute inset-0 rounded-full bg-cc-success animate-[pulse-dot_1.5s_ease-in-out_infinite]"}),a.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-success block"})]});case"awaiting":return a.jsx("span",{className:"relative shrink-0 w-2 h-2",children:a.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-warning block animate-[ring-pulse_1.5s_ease-out_infinite]"})});case"reconnecting":return a.jsx("span",{className:"relative shrink-0 w-2 h-2",children:a.jsx("span",{className:"w-2 h-2 rounded-full border border-cc-warning/40 border-t-cc-warning block animate-spin"})});case"idle":return a.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-muted/40 shrink-0"});case"exited":return a.jsx("span",{className:"w-2 h-2 rounded-full border border-cc-muted/25 shrink-0"})}}function XC({type:e}){return e==="codex"?a.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"}):a.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 od({session:e,isActive:t,isArchived:n,sessionName:i,permCount:l,isRecentlyRenamed:c,onSelect:u,onStartRename:f,onArchive:h,onUnarchive:p,onDelete:g,onClearRecentlyRenamed:v,editingSessionId:y,editingName:b,setEditingName:_,onConfirmRename:S,onCancelRename:T,editInputRef:j}){const R=e.id.slice(0,8),C=i||e.model||R,P=y===e.id,[z,D]=k.useState(!1),F=k.useRef(null),B=k.useRef(null),I=n?"exited":YC(e,l),L=e.cwd||"";k.useEffect(()=>{if(!z)return;function E(K){var Y;F.current&&!F.current.contains(K.target)&&B.current&&!B.current.contains(K.target)&&(D(!1),(Y=B.current)==null||Y.focus())}function ae(K){var Y,U,$;if(K.key==="Escape"){D(!1),(Y=B.current)==null||Y.focus();return}if(K.key==="Tab"){D(!1);return}if((K.key==="ArrowDown"||K.key==="ArrowUp")&&((U=F.current)!=null&&U.contains(document.activeElement)||B.current===document.activeElement)){K.preventDefault();const re=($=F.current)==null?void 0:$.querySelectorAll("[role='menuitem']");if(!re||re.length===0)return;const xe=document.activeElement,M=Array.from(re).indexOf(xe);K.key==="ArrowDown"?re[M<re.length-1?M+1:0].focus():re[M>0?M-1:re.length-1].focus()}}return document.addEventListener("mousedown",E),document.addEventListener("touchstart",E),document.addEventListener("keydown",ae),()=>{document.removeEventListener("mousedown",E),document.removeEventListener("touchstart",E),document.removeEventListener("keydown",ae)}},[z]),k.useEffect(()=>{z&&requestAnimationFrame(()=>{var E,ae;(ae=(E=F.current)==null?void 0:E.querySelector("[role='menuitem']"))==null||ae.focus()})},[z]);const q=k.useCallback(E=>{D(!1),E()},[]);return a.jsxs("div",{className:"relative group",children:[a.jsxs("button",{onClick:()=>u(e.id),onDoubleClick:E=>{E.preventDefault(),f(e.id,C)},onKeyDown:E=>{E.key==="F2"&&!P&&(E.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:[a.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"}`}),!P&&a.jsx(WC,{status:I}),P?a.jsx("input",{ref:j,value:b,onChange:E=>_(E.target.value),onKeyDown:E=>{E.key==="Enter"?(E.preventDefault(),S()):E.key==="Escape"&&(E.preventDefault(),T()),E.stopPropagation()},onBlur:S,onClick:E=>E.stopPropagation(),onDoubleClick:E=>E.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"}):a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("span",{className:`text-[12.5px] font-medium truncate block leading-snug ${t?"text-cc-fg":"text-cc-fg/90"} ${c?"animate-name-appear":""}`,onAnimationEnd:()=>v(e.id),children:C}),L&&a.jsx("span",{className:"text-[10px] text-cc-muted/70 truncate block leading-tight mt-px",children:L})]}),!P&&a.jsxs("span",{className:"flex items-center gap-1 shrink-0",children:[a.jsx(XC,{type:e.backendType}),e.isContainerized&&a.jsx("span",{className:"flex items-center px-1 py-0.5 rounded bg-blue-400/10",title:"Docker",children:a.jsx("img",{src:"/logo-docker.svg",alt:"Docker logo",className:"w-3 h-3"})}),e.cronJobId&&a.jsx("span",{className:"flex items-center px-1 py-0.5 rounded bg-cc-primary/10",title:"Scheduled",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 text-cc-primary",children:a.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&&!P&&!z&&a.jsx("button",{onClick:E=>{E.stopPropagation(),h(E,e.id)},className:"absolute right-7 top-1/2 -translate-y-1/2 p-1 rounded-md opacity-0 pointer-events-none sm:group-hover:opacity-100 sm:group-hover:pointer-events-auto hover:bg-cc-border text-cc-muted hover:text-cc-fg transition-all cursor-pointer",title:"Archive","aria-label":"Archive session",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.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"})})}),a.jsx("button",{ref:B,onClick:E=>{E.stopPropagation(),D(!z)},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":z,children:a.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:[a.jsx("circle",{cx:"8",cy:"3",r:"1.5"}),a.jsx("circle",{cx:"8",cy:"8",r:"1.5"}),a.jsx("circle",{cx:"8",cy:"13",r:"1.5"})]})}),z&&a.jsxs("div",{ref:F,role:"menu","aria-label":"Session actions",className:"absolute right-0 top-full mt-1 w-40 py-1 bg-cc-card border border-cc-border/80 rounded-lg shadow-xl z-10 animate-[menu-appear_150ms_ease-out]",children:[!n&&a.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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted",children:a.jsx("path",{d:"M12.146.854a.5.5 0 00-.707 0L3.714 8.579a.5.5 0 00-.138.242l-.777 3.11a.5.5 0 00.607.607l3.11-.777a.5.5 0 00.242-.138L14.573 3.854a.5.5 0 000-.708L12.146.854z"})}),"Rename"]}),n?a.jsxs(a.Fragment,{children:[a.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:E=>q(()=>p(E,e.id)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2",children:[a.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted",children:[a.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"}),a.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"]}),a.jsx("div",{className:"my-1 mx-2 border-t border-cc-border/50"}),a.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:E=>q(()=>g(E,e.id)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-error hover:bg-cc-error/5 transition-colors cursor-pointer flex items-center gap-2",children:[a.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:[a.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"}),a.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"]})]}):a.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:E=>q(()=>h(E,e.id)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted",children:a.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 QC({group:e,isCollapsed:t,onToggleCollapse:n,currentSessionId:i,sessionNames:l,pendingPermissions:c,recentlyRenamed:u,onSelect:f,onStartRename:h,onArchive:p,onUnarchive:g,onDelete:v,onClearRecentlyRenamed:y,editingSessionId:b,editingName:_,setEditingName:S,onConfirmRename:T,onCancelRename:j,editInputRef:R,isFirst:C}){const P=t?e.sessions.slice(0,2).map(z=>l.get(z.id)||z.model||z.id.slice(0,8)).join(", ")+(e.sessions.length>2?", ...":""):"";return a.jsxs("div",{className:C?"":"mt-3 pt-3 border-t border-cc-separator",children:[a.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:[a.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:a.jsx("path",{d:"M6 4l4 4-4 4"})}),a.jsx("span",{className:"text-[11px] font-semibold text-cc-fg/60 truncate uppercase tracking-wide",children:e.label}),a.jsxs("span",{className:"flex items-center gap-1 ml-auto shrink-0",children:[e.runningCount>0&&a.jsx("span",{className:"w-1 h-1 rounded-full bg-cc-success",title:`${e.runningCount} running`}),e.permCount>0&&a.jsx("span",{className:"w-1 h-1 rounded-full bg-cc-warning",title:`${e.permCount} waiting`})]}),a.jsx("span",{className:"text-[10px] text-cc-muted/50 tabular-nums shrink-0",children:e.sessions.length})]}),t&&P&&a.jsx("div",{className:"text-[10px] text-cc-muted/70 truncate pl-5 pb-0.5",children:P}),!t&&a.jsx("div",{className:"mt-0.5",children:e.sessions.map(z=>{var F;const D=((F=c.get(z.id))==null?void 0:F.size)??0;return a.jsx(od,{session:z,isActive:i===z.id,sessionName:l.get(z.id),permCount:D,isRecentlyRenamed:u.has(z.id),onSelect:f,onStartRename:h,onArchive:p,onUnarchive:g,onDelete:v,onClearRecentlyRenamed:y,editingSessionId:b,editingName:_,setEditingName:S,onConfirmRename:T,onCancelRename:j,editInputRef:R},z.id)})})]})}function KC(e,t,n=!1){return(n&&!!t&&(t==="/workspace"||t.startsWith("/workspace/"))?e:t||e).replace(/\/+$/,"")||"/"}function ZC(e){if(e==="/")return"/";const t=e.split("/").filter(Boolean);return t.length===0?"/":t[t.length-1]}function JC(e){const t=new Map;for(const i of e){const l=KC(i.cwd,i.repoRoot||void 0,i.isContainerized),c=ZC(l);t.has(l)||t.set(l,{key:l,label:c,sessions:[],runningCount:0,permCount:0,mostRecentActivity:0});const u=t.get(l);u.sessions.push(i),i.status==="running"&&u.runningCount++,u.permCount+=i.permCount,u.mostRecentActivity=Math.max(u.mostRecentActivity,i.createdAt)}const n=Array.from(t.values()).sort((i,l)=>i.label.localeCompare(l.label));for(const i of n)i.sessions.sort((l,c)=>c.createdAt-l.createdAt);return n}const e4=[{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"}],t4=[{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"}],n4=[{id:"workbench",label:"Workbench",itemIds:["prompts","integrations"]},{id:"workspace",label:"Workspace",itemIds:["environments","sandboxes","agents","settings"]}],r4=new Map(t4.map(e=>[e.id,e]));function i4(){var gt,Ut;const[e,t]=k.useState(null),[n,i]=k.useState(""),[l,c]=k.useState(!1),[u,f]=k.useState(null),[h,p]=k.useState(null),[g,v]=k.useState(null),[y,b]=k.useState(!1),[_,S]=k.useState(null),[T,j]=k.useState(!1),[R,C]=k.useState(()=>typeof window<"u"?window.location.hash:""),P=k.useRef(null),z=k.useRef(null),D=X(J=>J.sessions),F=X(J=>J.sdkSessions),B=X(J=>J.currentSessionId),I=X(J=>J.cliConnected),L=X(J=>J.cliReconnecting),q=X(J=>J.sessionStatus),E=X(J=>J.removeSession),ae=X(J=>J.sessionNames),K=X(J=>J.recentlyRenamed),Y=X(J=>J.clearRecentlyRenamed),U=X(J=>J.pendingPermissions),$=X(J=>J.linkedLinearIssues),re=X(J=>J.collapsedProjects),xe=X(J=>J.toggleProjectCollapse),M=Dg(R);k.useEffect(()=>{let J=!0;async function pe(){try{const Ke=await we.listSessions();if(J){const _t=X.getState();_t.setSdkSessions(Ke);const xt=X.getState(),$n=new Set(Ke.map(Rt=>Rt.sessionId));for(const Rt of xt.sessions.keys())!$n.has(Rt)&&xt.connectionStatus.get(Rt)!=="connected"&&xt.removeSession(Rt);vN(Ke);for(const Rt of Ke)if(Rt.name&&(!_t.sessionNames.has(Rt.sessionId)||/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(_t.sessionNames.get(Rt.sessionId)))){const Cn=_t.sessionNames.get(Rt.sessionId),Er=!!Cn&&/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(Cn);Cn!==Rt.name&&(_t.setSessionName(Rt.sessionId,Rt.name),Er&&_t.markRecentlyRenamed(Rt.sessionId))}}}catch{}}pe();const me=setInterval(pe,5e3);return()=>{J=!1,clearInterval(me)}},[]),k.useEffect(()=>{const J=()=>C(window.location.hash);return window.addEventListener("hashchange",J),()=>window.removeEventListener("hashchange",J)},[]);function O(J){zg(J),window.innerWidth<768&&X.getState().setSidebarOpen(!1)}function Z(){zp(),X.getState().newSession(),window.innerWidth<768&&X.getState().setSidebarOpen(!1)}k.useEffect(()=>{e&&P.current&&(P.current.focus(),P.current.select())},[e]);function A(){e&&n.trim()&&(X.getState().setSessionName(e,n.trim()),we.renameSession(e,n.trim()).catch(()=>{})),t(null),i("")}function fe(){t(null),i("")}function _e(J,pe){t(J),i(pe)}const je=k.useCallback((J,pe)=>{J.stopPropagation(),S(pe)},[]),De=k.useCallback(async J=>{try{um(J),await we.deleteSession(J)}catch{}X.getState().currentSessionId===J&&zp(),E(J)},[E]),oe=k.useCallback(()=>{_&&(De(_),S(null))},[_,De]),Ee=k.useCallback(()=>{S(null)},[]),Fe=k.useCallback(()=>{j(!0)},[]),At=k.useCallback(async()=>{j(!1);const J=X.getState(),pe=new Set;for(const Ke of J.sessions.keys())pe.add(Ke);for(const Ke of J.sdkSessions)pe.add(Ke.sessionId);const me=Array.from(pe).filter(Ke=>{const _t=J.sdkSessions.find(xt=>xt.sessionId===Ke);return(_t==null?void 0:_t.archived)??!1});for(const Ke of me)await De(Ke)},[De]),Ze=k.useCallback(()=>{j(!1)},[]);k.useEffect(()=>{if(!_&&!T)return;requestAnimationFrame(()=>{var pe,me;(me=(pe=z.current)==null?void 0:pe.querySelector("button"))==null||me.focus()});function J(pe){var xt;if(pe.key==="Escape"){T?Ze():Ee();return}if(pe.key!=="Tab")return;const me=(xt=z.current)==null?void 0:xt.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(!me||me.length===0)return;const Ke=me[0],_t=me[me.length-1];pe.shiftKey&&document.activeElement===Ke?(pe.preventDefault(),_t.focus()):!pe.shiftKey&&document.activeElement===_t&&(pe.preventDefault(),Ke.focus())}return document.addEventListener("keydown",J),()=>document.removeEventListener("keydown",J)},[_,T,Ee,Ze]);const Mt=k.useCallback(async(J,pe)=>{J.stopPropagation();const me=F.find(Cn=>Cn.sessionId===pe),Ke=D.get(pe),_t=(Ke==null?void 0:Ke.is_containerized)||!!(me!=null&&me.containerId)||!1,xt=$.get(pe),$n=((xt==null?void 0:xt.stateType)||"").toLowerCase();if(xt&&!($n==="completed"||$n==="canceled"||$n==="cancelled"))try{const Cn=await we.getArchiveInfo(pe);if(Cn.issueNotDone){p(pe),v(Cn),b(_t);return}}catch{}if(_t){f(pe);return}vt(pe)},[F,D,$]),vt=k.useCallback(async(J,pe,me)=>{try{um(J);const Ke={};pe&&(Ke.force=!0),me&&me!=="none"&&(Ke.linearTransition=me),await we.archiveSession(J,Object.keys(Ke).length>0?Ke:void 0)}catch{}X.getState().currentSessionId===J&&(zp(),X.getState().newSession());try{const Ke=await we.listSessions();X.getState().setSdkSessions(Ke)}catch{}},[]),qe=k.useCallback(()=>{u&&(vt(u,!0),f(null))},[u,vt]),Pt=k.useCallback(()=>{f(null)},[]),vn=k.useCallback((J,pe)=>{h&&(vt(h,pe,J),p(null),v(null))},[h,vt]),un=k.useCallback(()=>{p(null),v(null)},[]),tn=k.useCallback(async(J,pe)=>{J.stopPropagation();try{await we.unarchiveSession(pe)}catch{}try{const me=await we.listSessions();X.getState().setSdkSessions(me)}catch{}},[]),nn=new Set;for(const J of D.keys())nn.add(J);for(const J of F)nn.add(J.sessionId);const ke=Array.from(nn).map(J=>{var Ke;const pe=D.get(J),me=F.find(_t=>_t.sessionId===J);return{id:J,model:(pe==null?void 0:pe.model)||(me==null?void 0:me.model)||"",cwd:(pe==null?void 0:pe.cwd)||(me==null?void 0:me.cwd)||"",gitBranch:(pe==null?void 0:pe.git_branch)||(me==null?void 0:me.gitBranch)||"",isContainerized:(pe==null?void 0:pe.is_containerized)||!!(me!=null&&me.containerId)||!1,gitAhead:(pe==null?void 0:pe.git_ahead)||(me==null?void 0:me.gitAhead)||0,gitBehind:(pe==null?void 0:pe.git_behind)||(me==null?void 0:me.gitBehind)||0,linesAdded:(pe==null?void 0:pe.total_lines_added)||(me==null?void 0:me.totalLinesAdded)||0,linesRemoved:(pe==null?void 0:pe.total_lines_removed)||(me==null?void 0:me.totalLinesRemoved)||0,isConnected:I.get(J)??!1,isReconnecting:L.get(J)??!1,status:q.get(J)??null,sdkState:(me==null?void 0:me.state)??null,createdAt:(me==null?void 0:me.createdAt)??0,archived:(me==null?void 0:me.archived)??!1,backendType:(pe==null?void 0:pe.backend_type)||(me==null?void 0:me.backendType)||"claude",repoRoot:(pe==null?void 0:pe.repo_root)||"",permCount:((Ke=U.get(J))==null?void 0:Ke.size)??0,cronJobId:(pe==null?void 0:pe.cronJobId)||(me==null?void 0:me.cronJobId),cronJobName:(pe==null?void 0:pe.cronJobName)||(me==null?void 0:me.cronJobName),agentId:(pe==null?void 0:pe.agentId)||(me==null?void 0:me.agentId),agentName:(pe==null?void 0:pe.agentName)||(me==null?void 0:me.agentName)}}).sort((J,pe)=>pe.createdAt-J.createdAt),ze=ke.filter(J=>!J.archived&&!J.cronJobId&&!J.agentId),ot=ke.filter(J=>!J.archived&&!!J.cronJobId),Pe=ke.filter(J=>!J.archived&&!!J.agentId),bn=ke.filter(J=>J.archived),le=B?ke.find(J=>J.id===B):null,be=(le==null?void 0:le.backendType)==="codex"?"/logo-codex.svg":"/logo.svg",[W,he]=k.useState(!0),[Ae,ut]=k.useState(!0),Qe=k.useMemo(()=>JC(ze),[ze]),Je={onSelect:O,onStartRename:_e,onArchive:Mt,onUnarchive:tn,onDelete:je,onClearRecentlyRenamed:Y,editingSessionId:e,editingName:n,setEditingName:i,onConfirmRename:A,onCancelRename:fe,editInputRef:P};return a.jsxs("aside",{"aria-label":"Session sidebar",className:"w-full md:w-[260px] h-full flex flex-col bg-cc-sidebar",children:[a.jsx("div",{className:"p-3.5 pb-2",children:a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("img",{src:be,alt:"",className:"w-6 h-6"}),a.jsx("span",{className:"text-[13px] font-semibold text-cc-fg tracking-tight",children:"The Companion"}),a.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"}),a.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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M8 3v10M3 8h10"})})}),a.jsx("button",{onClick:()=>X.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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4",children:a.jsx("path",{d:"M3.72 3.72a.75.75 0 011.06 0L8 6.94l3.22-3.22a.75.75 0 111.06 1.06L9.06 8l3.22 3.22a.75.75 0 11-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 01-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 010-1.06z"})})})]})}),u&&a.jsx("div",{className:"mx-2 mb-1 p-2.5 rounded-[10px] bg-cc-warning/10 border border-cc-warning/20",children:a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-cc-warning shrink-0 mt-0.5",children:a.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"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("p",{className:"text-[11px] text-cc-fg leading-snug",children:["Archiving will ",a.jsx("strong",{children:"remove the container"})," and any uncommitted changes."]}),a.jsxs("div",{className:"flex gap-2 mt-2",children:[a.jsx("button",{onClick:Pt,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"}),a.jsx("button",{onClick:qe,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"})]})]})]})}),a.jsx("div",{className:"flex-1 overflow-y-auto px-2.5 pb-2",children:ze.length===0&&ot.length===0&&bn.length===0?a.jsx("p",{className:"px-3 py-8 text-xs text-cc-muted text-center leading-relaxed",children:"No sessions yet."}):a.jsxs(a.Fragment,{children:[Qe.map((J,pe)=>a.jsx(QC,{group:J,isCollapsed:re.has(J.key),onToggleCollapse:xe,currentSessionId:B,sessionNames:ae,pendingPermissions:U,recentlyRenamed:K,isFirst:pe===0,...Je},J.key)),ot.length>0&&a.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[a.jsxs("button",{onClick:()=>he(!W),"aria-expanded":W,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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${W?"rotate-90":""}`,children:a.jsx("path",{d:"M6 4l4 4-4 4"})}),"Scheduled Runs (",ot.length,")"]}),W&&a.jsx("div",{className:"mt-0.5",children:ot.map(J=>{var pe;return a.jsx(od,{session:J,isActive:B===J.id,sessionName:ae.get(J.id),permCount:((pe=U.get(J.id))==null?void 0:pe.size)??0,isRecentlyRenamed:K.has(J.id),...Je},J.id)})})]}),Pe.length>0&&a.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[a.jsxs("button",{onClick:()=>ut(!Ae),"aria-expanded":Ae,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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${Ae?"rotate-90":""}`,children:a.jsx("path",{d:"M6 4l4 4-4 4"})}),"Agent Runs (",Pe.length,")"]}),Ae&&a.jsx("div",{className:"mt-0.5",children:Pe.map(J=>{var pe;return a.jsx(od,{session:J,isActive:B===J.id,sessionName:ae.get(J.id),permCount:((pe=U.get(J.id))==null?void 0:pe.size)??0,isRecentlyRenamed:K.has(J.id),...Je},J.id)})})]}),bn.length>0&&a.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsxs("button",{onClick:()=>c(!l),"aria-expanded":l,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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${l?"rotate-90":""}`,children:a.jsx("path",{d:"M6 4l4 4-4 4"})}),"Archived (",bn.length,")"]}),l&&bn.length>1&&a.jsx("button",{onClick:Fe,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"})]}),l&&a.jsx("div",{className:"mt-0.5",children:bn.map(J=>{var pe;return a.jsx(od,{session:J,isActive:B===J.id,isArchived:!0,sessionName:ae.get(J.id),permCount:((pe=U.get(J.id))==null?void 0:pe.size)??0,isRecentlyRenamed:K.has(J.id),...Je},J.id)})})]})]})}),a.jsx("div",{className:"md:hidden flex justify-end px-4 pb-2",children:a.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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-5 h-5",children:a.jsx("path",{d:"M8 3v10M3 8h10"})})})}),a.jsxs("div",{className:"px-2 py-1.5 pb-safe bg-cc-sidebar-footer border-t border-cc-border/30",children:[a.jsx("nav",{className:"flex flex-col gap-1.5","aria-label":"Navigation",children:n4.map(J=>a.jsxs("section",{className:"rounded-lg border border-cc-border/30 bg-cc-card/20 p-0.5",children:[a.jsx("span",{className:"px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.14em] text-cc-muted/75 block",children:J.label}),a.jsx("div",{className:"flex flex-col",children:J.itemIds.map(pe=>{const me=r4.get(pe);if(!me)return null;const Ke=me.activePages?me.activePages.some(_t=>M.page===_t):M.page===me.id;return a.jsxs("button",{onClick:()=>{window.location.hash=me.hash,window.innerWidth<768&&X.getState().setSidebarOpen(!1)},title:me.label,"aria-current":Ke?"page":void 0,className:`group flex min-h-[44px] md:min-h-[34px] w-full items-center gap-2 rounded-md px-2 py-1 md:py-0.5 text-left transition-colors duration-150 cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cc-primary/60 ${Ke?"bg-cc-active text-cc-fg":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,children:[a.jsx("span",{"aria-hidden":!0,className:`h-4 w-0.5 shrink-0 rounded-full transition-colors ${Ke?"bg-cc-primary":"bg-transparent group-hover:bg-cc-border"}`}),a.jsx("svg",{viewBox:me.viewBox,fill:"currentColor",className:"w-3.5 h-3.5 shrink-0",children:a.jsx("path",{d:me.iconPath,fillRule:me.fillRule,clipRule:me.clipRule})}),a.jsx("span",{className:"min-w-0 flex-1 text-[12px] font-medium leading-tight",children:me.label})]},me.id)})})]},J.id))}),a.jsx("div",{className:"mt-1.5 rounded-lg border border-cc-border/30 bg-cc-card/20 px-1.5 py-0.5",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"px-1 text-[10px] font-semibold uppercase tracking-[0.14em] text-cc-muted/75",children:"Resources"}),a.jsx("div",{className:"flex items-center gap-0.5",children:e4.map(J=>a.jsx("a",{href:J.url,target:"_blank",rel:"noopener noreferrer",title:J.label,"aria-label":`Open ${J.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:a.jsx("svg",{viewBox:J.viewBox,fill:"currentColor",className:"w-3.5 h-3.5",children:a.jsx("path",{d:J.iconPath})})},J.label))})]})})]}),(_||T)&&a.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:T?Ze:Ee,children:a.jsxs("div",{ref:z,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:J=>J.stopPropagation(),children:[a.jsx("div",{className:"flex justify-center mb-3",children:a.jsx("div",{className:"w-10 h-10 rounded-full bg-cc-error/10 flex items-center justify-center",children:a.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-5 h-5 text-cc-error",children:[a.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"}),a.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"})]})})}),a.jsx("p",{id:"delete-dialog-title",className:"text-[13px] font-semibold text-cc-fg text-center",children:T?"Delete all archived?":"Delete session?"}),a.jsx("p",{id:"delete-dialog-desc",className:"text-[12px] text-cc-muted text-center mt-1.5 leading-relaxed",children:T?`This will permanently delete ${bn.length} archived session${bn.length===1?"":"s"}. This cannot be undone.`:"This will permanently delete this session and its history. This cannot be undone."}),a.jsxs("div",{className:"flex gap-2.5 mt-4",children:[a.jsx("button",{onClick:T?Ze:Ee,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"}),a.jsx("button",{onClick:T?At:oe,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:T?"Delete all":"Delete"})]})]})}),h&&g&&a.jsx(GC,{issueIdentifier:((gt=g.issue)==null?void 0:gt.identifier)||"",issueStateName:((Ut=g.issue)==null?void 0:Ut.stateName)||"",isContainerized:y,archiveTransitionConfigured:g.archiveTransitionConfigured||!1,archiveTransitionStateName:g.archiveTransitionStateName,hasBacklogState:g.hasBacklogState||!1,onConfirm:vn,onCancel:un})]})}function s4(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const a4=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,l4=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,o4={};function vy(e,t){return(o4.jsx?l4:a4).test(e)}const c4=/[ \t\n\f\r]/g;function u4(e){return typeof e=="object"?e.type==="text"?by(e.value):!1:by(e)}function by(e){return e.replace(c4,"")===""}class xc{constructor(t,n,i){this.normal=n,this.property=t,i&&(this.space=i)}}xc.prototype.normal={};xc.prototype.property={};xc.prototype.space=void 0;function cw(e,t){const n={},i={};for(const l of e)Object.assign(n,l.property),Object.assign(i,l.normal);return new xc(n,i,t)}function Jm(e){return e.toLowerCase()}class Qn{constructor(t,n){this.attribute=n,this.property=t}}Qn.prototype.attribute="";Qn.prototype.booleanish=!1;Qn.prototype.boolean=!1;Qn.prototype.commaOrSpaceSeparated=!1;Qn.prototype.commaSeparated=!1;Qn.prototype.defined=!1;Qn.prototype.mustUseProperty=!1;Qn.prototype.number=!1;Qn.prototype.overloadedBoolean=!1;Qn.prototype.property="";Qn.prototype.spaceSeparated=!1;Qn.prototype.space=void 0;let d4=0;const Ge=aa(),on=aa(),eg=aa(),ve=aa(),Ct=aa(),na=aa(),ir=aa();function aa(){return 2**++d4}const tg=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ge,booleanish:on,commaOrSpaceSeparated:ir,commaSeparated:na,number:ve,overloadedBoolean:eg,spaceSeparated:Ct},Symbol.toStringTag,{value:"Module"})),Lp=Object.keys(tg);class Lg extends Qn{constructor(t,n,i,l){let c=-1;if(super(t,n),yy(this,"space",l),typeof i=="number")for(;++c<Lp.length;){const u=Lp[c];yy(this,Lp[c],(i&tg[u])===tg[u])}}}Lg.prototype.defined=!0;function yy(e,t,n){n&&(e[t]=n)}function xl(e){const t={},n={};for(const[i,l]of Object.entries(e.properties)){const c=new Lg(i,e.transform(e.attributes||{},i),l,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(c.mustUseProperty=!0),t[i]=c,n[Jm(i)]=i,n[Jm(c.attribute)]=i}return new xc(t,n,e.space)}const uw=xl({properties:{ariaActiveDescendant:null,ariaAtomic:on,ariaAutoComplete:null,ariaBusy:on,ariaChecked:on,ariaColCount:ve,ariaColIndex:ve,ariaColSpan:ve,ariaControls:Ct,ariaCurrent:null,ariaDescribedBy:Ct,ariaDetails:null,ariaDisabled:on,ariaDropEffect:Ct,ariaErrorMessage:null,ariaExpanded:on,ariaFlowTo:Ct,ariaGrabbed:on,ariaHasPopup:null,ariaHidden:on,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ct,ariaLevel:ve,ariaLive:null,ariaModal:on,ariaMultiLine:on,ariaMultiSelectable:on,ariaOrientation:null,ariaOwns:Ct,ariaPlaceholder:null,ariaPosInSet:ve,ariaPressed:on,ariaReadOnly:on,ariaRelevant:null,ariaRequired:on,ariaRoleDescription:Ct,ariaRowCount:ve,ariaRowIndex:ve,ariaRowSpan:ve,ariaSelected:on,ariaSetSize:ve,ariaSort:null,ariaValueMax:ve,ariaValueMin:ve,ariaValueNow:ve,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function dw(e,t){return t in e?e[t]:t}function fw(e,t){return dw(e,t.toLowerCase())}const f4=xl({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:na,acceptCharset:Ct,accessKey:Ct,action:null,allow:null,allowFullScreen:Ge,allowPaymentRequest:Ge,allowUserMedia:Ge,alpha:Ge,alt:null,as:null,async:Ge,autoCapitalize:null,autoComplete:Ct,autoFocus:Ge,autoPlay:Ge,blocking:Ct,capture:null,charSet:null,checked:Ge,cite:null,className:Ct,closedBy:null,colorSpace:null,cols:ve,colSpan:ve,command:null,commandFor:null,content:null,contentEditable:on,controls:Ge,controlsList:Ct,coords:ve|na,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ge,defer:Ge,dir:null,dirName:null,disabled:Ge,download:eg,draggable:on,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ge,formTarget:null,headers:Ct,height:ve,hidden:eg,high:ve,href:null,hrefLang:null,htmlFor:Ct,httpEquiv:Ct,id:null,imageSizes:null,imageSrcSet:null,inert:Ge,inputMode:null,integrity:null,is:null,isMap:Ge,itemId:null,itemProp:Ct,itemRef:Ct,itemScope:Ge,itemType:Ct,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ge,low:ve,manifest:null,max:null,maxLength:ve,media:null,method:null,min:null,minLength:ve,multiple:Ge,muted:Ge,name:null,nonce:null,noModule:Ge,noValidate:Ge,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:Ge,optimum:ve,pattern:null,ping:Ct,placeholder:null,playsInline:Ge,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ge,referrerPolicy:null,rel:Ct,required:Ge,reversed:Ge,rows:ve,rowSpan:ve,sandbox:Ct,scope:null,scoped:Ge,seamless:Ge,selected:Ge,shadowRootClonable:Ge,shadowRootCustomElementRegistry:Ge,shadowRootDelegatesFocus:Ge,shadowRootMode:null,shadowRootSerializable:Ge,shape:null,size:ve,sizes:null,slot:null,span:ve,spellCheck:on,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ve,step:null,style:null,tabIndex:ve,target:null,title:null,translate:null,type:null,typeMustMatch:Ge,useMap:null,value:on,width:ve,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ct,axis:null,background:null,bgColor:null,border:ve,borderColor:null,bottomMargin:ve,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ge,declare:Ge,event:null,face:null,frame:null,frameBorder:null,hSpace:ve,leftMargin:ve,link:null,longDesc:null,lowSrc:null,marginHeight:ve,marginWidth:ve,noResize:Ge,noHref:Ge,noShade:Ge,noWrap:Ge,object:null,profile:null,prompt:null,rev:null,rightMargin:ve,rules:null,scheme:null,scrolling:on,standby:null,summary:null,text:null,topMargin:ve,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ve,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Ge,disablePictureInPicture:Ge,disableRemotePlayback:Ge,exportParts:na,part:Ct,prefix:null,property:null,results:ve,security:null,unselectable:null},space:"html",transform:fw}),h4=xl({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:ir,accentHeight:ve,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ve,amplitude:ve,arabicForm:null,ascent:ve,attributeName:null,attributeType:null,azimuth:ve,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ve,by:null,calcMode:null,capHeight:ve,className:Ct,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:ve,diffuseConstant:ve,direction:null,display:null,dur:null,divisor:ve,dominantBaseline:null,download:Ge,dx:null,dy:null,edgeMode:null,editable:null,elevation:ve,enableBackground:null,end:null,event:null,exponent:ve,externalResourcesRequired:null,fill:null,fillOpacity:ve,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:na,g2:na,glyphName:na,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ve,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ve,horizOriginX:ve,horizOriginY:ve,id:null,ideographic:ve,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ve,k:ve,k1:ve,k2:ve,k3:ve,k4:ve,kernelMatrix:ir,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ve,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:ve,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:ve,overlineThickness:ve,paintOrder:null,panose1:null,path:null,pathLength:ve,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ct,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ve,pointsAtY:ve,pointsAtZ:ve,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ir,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ir,rev:ir,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ir,requiredFeatures:ir,requiredFonts:ir,requiredFormats:ir,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:ve,specularExponent:ve,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ve,strikethroughThickness:ve,string:null,stroke:null,strokeDashArray:ir,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ve,strokeOpacity:ve,strokeWidth:null,style:null,surfaceScale:ve,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ir,tabIndex:ve,tableValues:null,target:null,targetX:ve,targetY:ve,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ir,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ve,underlineThickness:ve,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ve,values:null,vAlphabetic:ve,vMathematical:ve,vectorEffect:null,vHanging:ve,vIdeographic:ve,version:null,vertAdvY:ve,vertOriginX:ve,vertOriginY:ve,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ve,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:dw}),hw=xl({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()}}),pw=xl({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:fw}),mw=xl({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),p4={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"},m4=/[A-Z]/g,_y=/-[a-z]/g,g4=/^data[-\w.:]+$/i;function x4(e,t){const n=Jm(t);let i=t,l=Qn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&g4.test(t)){if(t.charAt(4)==="-"){const c=t.slice(5).replace(_y,b4);i="data"+c.charAt(0).toUpperCase()+c.slice(1)}else{const c=t.slice(4);if(!_y.test(c)){let u=c.replace(m4,v4);u.charAt(0)!=="-"&&(u="-"+u),t="data"+u}}l=Lg}return new l(i,t)}function v4(e){return"-"+e.toLowerCase()}function b4(e){return e.charAt(1).toUpperCase()}const y4=cw([uw,f4,hw,pw,mw],"html"),Og=cw([uw,h4,hw,pw,mw],"svg");function _4(e){return e.join(" ").trim()}var Xa={},Op,wy;function w4(){if(wy)return Op;wy=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l=/^:\s*/,c=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,f=/^\s+|\s+$/g,h=`
|
|
66
|
+
`,p="/",g="*",v="",y="comment",b="declaration";function _(T,j){if(typeof T!="string")throw new TypeError("First argument must be a string");if(!T)return[];j=j||{};var R=1,C=1;function P(K){var Y=K.match(t);Y&&(R+=Y.length);var U=K.lastIndexOf(h);C=~U?K.length-U:C+K.length}function z(){var K={line:R,column:C};return function(Y){return Y.position=new D(K),I(),Y}}function D(K){this.start=K,this.end={line:R,column:C},this.source=j.source}D.prototype.content=T;function F(K){var Y=new Error(j.source+":"+R+":"+C+": "+K);if(Y.reason=K,Y.filename=j.source,Y.line=R,Y.column=C,Y.source=T,!j.silent)throw Y}function B(K){var Y=K.exec(T);if(Y){var U=Y[0];return P(U),T=T.slice(U.length),Y}}function I(){B(n)}function L(K){var Y;for(K=K||[];Y=q();)Y!==!1&&K.push(Y);return K}function q(){var K=z();if(!(p!=T.charAt(0)||g!=T.charAt(1))){for(var Y=2;v!=T.charAt(Y)&&(g!=T.charAt(Y)||p!=T.charAt(Y+1));)++Y;if(Y+=2,v===T.charAt(Y-1))return F("End of comment missing");var U=T.slice(2,Y-2);return C+=2,P(U),T=T.slice(Y),C+=2,K({type:y,comment:U})}}function E(){var K=z(),Y=B(i);if(Y){if(q(),!B(l))return F("property missing ':'");var U=B(c),$=K({type:b,property:S(Y[0].replace(e,v)),value:U?S(U[0].replace(e,v)):v});return B(u),$}}function ae(){var K=[];L(K);for(var Y;Y=E();)Y!==!1&&(K.push(Y),L(K));return K}return I(),ae()}function S(T){return T?T.replace(f,v):v}return Op=_,Op}var ky;function k4(){if(ky)return Xa;ky=1;var e=Xa&&Xa.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Xa,"__esModule",{value:!0}),Xa.default=n;const t=e(w4());function n(i,l){let c=null;if(!i||typeof i!="string")return c;const u=(0,t.default)(i),f=typeof l=="function";return u.forEach(h=>{if(h.type!=="declaration")return;const{property:p,value:g}=h;f?l(p,g,h):g&&(c=c||{},c[p]=g)}),c}return Xa}var To={},Sy;function S4(){if(Sy)return To;Sy=1,Object.defineProperty(To,"__esModule",{value:!0}),To.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,l=/^-(ms)-/,c=function(p){return!p||n.test(p)||e.test(p)},u=function(p,g){return g.toUpperCase()},f=function(p,g){return"".concat(g,"-")},h=function(p,g){return g===void 0&&(g={}),c(p)?p:(p=p.toLowerCase(),g.reactCompat?p=p.replace(l,f):p=p.replace(i,f),p.replace(t,u))};return To.camelCase=h,To}var Ao,jy;function j4(){if(jy)return Ao;jy=1;var e=Ao&&Ao.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},t=e(k4()),n=S4();function i(l,c){var u={};return!l||typeof l!="string"||(0,t.default)(l,function(f,h){f&&h&&(u[(0,n.camelCase)(f,c)]=h)}),u}return i.default=i,Ao=i,Ao}var N4=j4();const C4=hg(N4),gw=xw("end"),Bg=xw("start");function xw(e){return t;function t(n){const i=n&&n.position&&n.position[e]||{};if(typeof i.line=="number"&&i.line>0&&typeof i.column=="number"&&i.column>0)return{line:i.line,column:i.column,offset:typeof i.offset=="number"&&i.offset>-1?i.offset:void 0}}}function E4(e){const t=Bg(e),n=gw(e);if(t&&n)return{start:t,end:n}}function Xo(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Ny(e.position):"start"in e||"end"in e?Ny(e):"line"in e||"column"in e?ng(e):""}function ng(e){return Cy(e&&e.line)+":"+Cy(e&&e.column)}function Ny(e){return ng(e&&e.start)+"-"+ng(e&&e.end)}function Cy(e){return e&&typeof e=="number"?e:1}class Mn extends Error{constructor(t,n,i){super(),typeof n=="string"&&(i=n,n=void 0);let l="",c={},u=!1;if(n&&("line"in n&&"column"in n?c={place:n}:"start"in n&&"end"in n?c={place:n}:"type"in n?c={ancestors:[n],place:n.position}:c={...n}),typeof t=="string"?l=t:!c.cause&&t&&(u=!0,l=t.message,c.cause=t),!c.ruleId&&!c.source&&typeof i=="string"){const h=i.indexOf(":");h===-1?c.ruleId=i:(c.source=i.slice(0,h),c.ruleId=i.slice(h+1))}if(!c.place&&c.ancestors&&c.ancestors){const h=c.ancestors[c.ancestors.length-1];h&&(c.place=h.position)}const f=c.place&&"start"in c.place?c.place.start:c.place;this.ancestors=c.ancestors||void 0,this.cause=c.cause||void 0,this.column=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=l,this.line=f?f.line:void 0,this.name=Xo(c.place)||"1:1",this.place=c.place||void 0,this.reason=this.message,this.ruleId=c.ruleId||void 0,this.source=c.source||void 0,this.stack=u&&c.cause&&typeof c.cause.stack=="string"?c.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Mn.prototype.file="";Mn.prototype.name="";Mn.prototype.reason="";Mn.prototype.message="";Mn.prototype.stack="";Mn.prototype.column=void 0;Mn.prototype.line=void 0;Mn.prototype.ancestors=void 0;Mn.prototype.cause=void 0;Mn.prototype.fatal=void 0;Mn.prototype.place=void 0;Mn.prototype.ruleId=void 0;Mn.prototype.source=void 0;const $g={}.hasOwnProperty,T4=new Map,A4=/[A-Z]/g,M4=new Set(["table","tbody","thead","tfoot","tr"]),R4=new Set(["td","th"]),vw="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function D4(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let i;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");i=F4(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");i=U4(n,t.jsx,t.jsxs)}const l={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:i,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Og:y4,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},c=bw(l,e,void 0);return c&&typeof c!="string"?c:l.create(e,l.Fragment,{children:c||void 0},void 0)}function bw(e,t,n){if(t.type==="element")return z4(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return L4(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return B4(e,t,n);if(t.type==="mdxjsEsm")return O4(e,t);if(t.type==="root")return $4(e,t,n);if(t.type==="text")return P4(e,t)}function z4(e,t,n){const i=e.schema;let l=i;t.tagName.toLowerCase()==="svg"&&i.space==="html"&&(l=Og,e.schema=l),e.ancestors.push(t);const c=_w(e,t.tagName,!1),u=H4(e,t);let f=Ug(e,t);return M4.has(t.tagName)&&(f=f.filter(function(h){return typeof h=="string"?!u4(h):!0})),yw(e,u,c,t),Pg(u,f),e.ancestors.pop(),e.schema=i,e.create(t,c,u,n)}function L4(e,t){if(t.data&&t.data.estree&&e.evaluater){const i=t.data.estree.body[0];return i.type,e.evaluater.evaluateExpression(i.expression)}dc(e,t.position)}function O4(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);dc(e,t.position)}function B4(e,t,n){const i=e.schema;let l=i;t.name==="svg"&&i.space==="html"&&(l=Og,e.schema=l),e.ancestors.push(t);const c=t.name===null?e.Fragment:_w(e,t.name,!0),u=q4(e,t),f=Ug(e,t);return yw(e,u,c,t),Pg(u,f),e.ancestors.pop(),e.schema=i,e.create(t,c,u,n)}function $4(e,t,n){const i={};return Pg(i,Ug(e,t)),e.create(t,e.Fragment,i,n)}function P4(e,t){return t.value}function yw(e,t,n,i){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=i)}function Pg(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function U4(e,t,n){return i;function i(l,c,u,f){const p=Array.isArray(u.children)?n:t;return f?p(c,u,f):p(c,u)}}function F4(e,t){return n;function n(i,l,c,u){const f=Array.isArray(c.children),h=Bg(i);return t(l,c,u,f,{columnNumber:h?h.column-1:void 0,fileName:e,lineNumber:h?h.line:void 0},void 0)}}function H4(e,t){const n={};let i,l;for(l in t.properties)if(l!=="children"&&$g.call(t.properties,l)){const c=I4(e,l,t.properties[l]);if(c){const[u,f]=c;e.tableCellAlignToStyle&&u==="align"&&typeof f=="string"&&R4.has(t.tagName)?i=f:n[u]=f}}if(i){const c=n.style||(n.style={});c[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return n}function q4(e,t){const n={};for(const i of t.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&e.evaluater){const c=i.data.estree.body[0];c.type;const u=c.expression;u.type;const f=u.properties[0];f.type,Object.assign(n,e.evaluater.evaluateExpression(f.argument))}else dc(e,t.position);else{const l=i.name;let c;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&e.evaluater){const f=i.value.data.estree.body[0];f.type,c=e.evaluater.evaluateExpression(f.expression)}else dc(e,t.position);else c=i.value===null?!0:i.value;n[l]=c}return n}function Ug(e,t){const n=[];let i=-1;const l=e.passKeys?new Map:T4;for(;++i<t.children.length;){const c=t.children[i];let u;if(e.passKeys){const h=c.type==="element"?c.tagName:c.type==="mdxJsxFlowElement"||c.type==="mdxJsxTextElement"?c.name:void 0;if(h){const p=l.get(h)||0;u=h+"-"+p,l.set(h,p+1)}}const f=bw(e,c,u);f!==void 0&&n.push(f)}return n}function I4(e,t,n){const i=x4(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=i.commaSeparated?s4(n):_4(n)),i.property==="style"){let l=typeof n=="object"?n:V4(e,String(n));return e.stylePropertyNameCase==="css"&&(l=G4(l)),["style",l]}return[e.elementAttributeNameCase==="react"&&i.space?p4[i.property]||i.property:i.attribute,n]}}function V4(e,t){try{return C4(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const i=n,l=new Mn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw l.file=e.filePath||void 0,l.url=vw+"#cannot-parse-style-attribute",l}}function _w(e,t,n){let i;if(!n)i={type:"Literal",value:t};else if(t.includes(".")){const l=t.split(".");let c=-1,u;for(;++c<l.length;){const f=vy(l[c])?{type:"Identifier",name:l[c]}:{type:"Literal",value:l[c]};u=u?{type:"MemberExpression",object:u,property:f,computed:!!(c&&f.type==="Literal"),optional:!1}:f}i=u}else i=vy(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(i.type==="Literal"){const l=i.value;return $g.call(e.components,l)?e.components[l]:l}if(e.evaluater)return e.evaluater.evaluateExpression(i);dc(e)}function dc(e,t){const n=new Mn("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=vw+"#cannot-handle-mdx-estrees-without-createevaluater",n}function G4(e){const t={};let n;for(n in e)$g.call(e,n)&&(t[Y4(n)]=e[n]);return t}function Y4(e){let t=e.replace(A4,W4);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function W4(e){return"-"+e.toLowerCase()}const Bp={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"]},X4={};function Fg(e,t){const n=X4,i=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,l=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return ww(e,i,l)}function ww(e,t,n){if(Q4(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 Ey(e.children,t,n)}return Array.isArray(e)?Ey(e,t,n):""}function Ey(e,t,n){const i=[];let l=-1;for(;++l<e.length;)i[l]=ww(e[l],t,n);return i.join("")}function Q4(e){return!!(e&&typeof e=="object")}const Ty=document.createElement("i");function Hg(e){const t="&"+e+";";Ty.innerHTML=t;const n=Ty.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function ur(e,t,n,i){const l=e.length;let c=0,u;if(t<0?t=-t>l?0:l+t:t=t>l?l:t,n=n>0?n:0,i.length<1e4)u=Array.from(i),u.unshift(t,n),e.splice(...u);else for(n&&e.splice(t,n);c<i.length;)u=i.slice(c,c+1e4),u.unshift(t,0),e.splice(...u),c+=1e4,t+=1e4}function Nr(e,t){return e.length>0?(ur(e,e.length,0,t),e):t}const Ay={}.hasOwnProperty;function kw(e){const t={};let n=-1;for(;++n<e.length;)K4(t,e[n]);return t}function K4(e,t){let n;for(n in t){const l=(Ay.call(e,n)?e[n]:void 0)||(e[n]={}),c=t[n];let u;if(c)for(u in c){Ay.call(l,u)||(l[u]=[]);const f=c[u];Z4(l[u],Array.isArray(f)?f:f?[f]:[])}}}function Z4(e,t){let n=-1;const i=[];for(;++n<t.length;)(t[n].add==="after"?e:i).push(t[n]);ur(e,0,0,i)}function Sw(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 Or(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const On=vs(/[A-Za-z]/),An=vs(/[\dA-Za-z]/),J4=vs(/[#-'*+\--9=?A-Z^-~]/);function Dd(e){return e!==null&&(e<32||e===127)}const rg=vs(/\d/),eE=vs(/[\dA-Fa-f]/),tE=vs(/[!-/:-@[-`{-~]/);function $e(e){return e!==null&&e<-2}function Tt(e){return e!==null&&(e<0||e===32)}function it(e){return e===-2||e===-1||e===32}const Id=vs(new RegExp("\\p{P}|\\p{S}","u")),ia=vs(/\s/);function vs(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function vl(e){const t=[];let n=-1,i=0,l=0;for(;++n<e.length;){const c=e.charCodeAt(n);let u="";if(c===37&&An(e.charCodeAt(n+1))&&An(e.charCodeAt(n+2)))l=2;else if(c<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(c))||(u=String.fromCharCode(c));else if(c>55295&&c<57344){const f=e.charCodeAt(n+1);c<56320&&f>56319&&f<57344?(u=String.fromCharCode(c,f),l=1):u="�"}else u=String.fromCharCode(c);u&&(t.push(e.slice(i,n),encodeURIComponent(u)),i=n+l+1,u=""),l&&(n+=l,l=0)}return t.join("")+e.slice(i)}function dt(e,t,n,i){const l=i?i-1:Number.POSITIVE_INFINITY;let c=0;return u;function u(h){return it(h)?(e.enter(n),f(h)):t(h)}function f(h){return it(h)&&c++<l?(e.consume(h),f):(e.exit(n),t(h))}}const nE={tokenize:rE};function rE(e){const t=e.attempt(this.parser.constructs.contentInitial,i,l);let n;return t;function i(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),dt(e,t,"linePrefix")}function l(f){return e.enter("paragraph"),c(f)}function c(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 $e(f)?(e.consume(f),e.exit("chunkText"),c):(e.consume(f),u)}}const iE={tokenize:sE},My={tokenize:aE};function sE(e){const t=this,n=[];let i=0,l,c,u;return f;function f(C){if(i<n.length){const P=n[i];return t.containerState=P[1],e.attempt(P[0].continuation,h,p)(C)}return p(C)}function h(C){if(i++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,l&&R();const P=t.events.length;let z=P,D;for(;z--;)if(t.events[z][0]==="exit"&&t.events[z][1].type==="chunkFlow"){D=t.events[z][1].end;break}j(i);let F=P;for(;F<t.events.length;)t.events[F][1].end={...D},F++;return ur(t.events,z+1,0,t.events.slice(P)),t.events.length=F,p(C)}return f(C)}function p(C){if(i===n.length){if(!l)return y(C);if(l.currentConstruct&&l.currentConstruct.concrete)return _(C);t.interrupt=!!(l.currentConstruct&&!l._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(My,g,v)(C)}function g(C){return l&&R(),j(i),y(C)}function v(C){return t.parser.lazy[t.now().line]=i!==n.length,u=t.now().offset,_(C)}function y(C){return t.containerState={},e.attempt(My,b,_)(C)}function b(C){return i++,n.push([t.currentConstruct,t.containerState]),y(C)}function _(C){if(C===null){l&&R(),j(0),e.consume(C);return}return l=l||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:l,contentType:"flow",previous:c}),S(C)}function S(C){if(C===null){T(e.exit("chunkFlow"),!0),j(0),e.consume(C);return}return $e(C)?(e.consume(C),T(e.exit("chunkFlow")),i=0,t.interrupt=void 0,f):(e.consume(C),S)}function T(C,P){const z=t.sliceStream(C);if(P&&z.push(null),C.previous=c,c&&(c.next=C),c=C,l.defineSkip(C.start),l.write(z),t.parser.lazy[C.start.line]){let D=l.events.length;for(;D--;)if(l.events[D][1].start.offset<u&&(!l.events[D][1].end||l.events[D][1].end.offset>u))return;const F=t.events.length;let B=F,I,L;for(;B--;)if(t.events[B][0]==="exit"&&t.events[B][1].type==="chunkFlow"){if(I){L=t.events[B][1].end;break}I=!0}for(j(i),D=F;D<t.events.length;)t.events[D][1].end={...L},D++;ur(t.events,B+1,0,t.events.slice(F)),t.events.length=D}}function j(C){let P=n.length;for(;P-- >C;){const z=n[P];t.containerState=z[1],z[0].exit.call(t,e)}n.length=C}function R(){l.write([null]),c=void 0,l=void 0,t.containerState._closeFlow=void 0}}function aE(e,t,n){return dt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function hl(e){if(e===null||Tt(e)||ia(e))return 1;if(Id(e))return 2}function Vd(e,t,n){const i=[];let l=-1;for(;++l<e.length;){const c=e[l].resolveAll;c&&!i.includes(c)&&(t=c(t,n),i.push(c))}return t}const ig={name:"attention",resolveAll:lE,tokenize:oE};function lE(e,t){let n=-1,i,l,c,u,f,h,p,g;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(i=n;i--;)if(e[i][0]==="exit"&&e[i][1].type==="attentionSequence"&&e[i][1]._open&&t.sliceSerialize(e[i][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[i][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;h=e[i][1].end.offset-e[i][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const v={...e[i][1].end},y={...e[n][1].start};Ry(v,-h),Ry(y,h),u={type:h>1?"strongSequence":"emphasisSequence",start:v,end:{...e[i][1].end}},f={type:h>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:y},c={type:h>1?"strongText":"emphasisText",start:{...e[i][1].end},end:{...e[n][1].start}},l={type:h>1?"strong":"emphasis",start:{...u.start},end:{...f.end}},e[i][1].end={...u.start},e[n][1].start={...f.end},p=[],e[i][1].end.offset-e[i][1].start.offset&&(p=Nr(p,[["enter",e[i][1],t],["exit",e[i][1],t]])),p=Nr(p,[["enter",l,t],["enter",u,t],["exit",u,t],["enter",c,t]]),p=Nr(p,Vd(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),p=Nr(p,[["exit",c,t],["enter",f,t],["exit",f,t],["exit",l,t]]),e[n][1].end.offset-e[n][1].start.offset?(g=2,p=Nr(p,[["enter",e[n][1],t],["exit",e[n][1],t]])):g=0,ur(e,i-1,n-i+3,p),n=i+p.length-g-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function oE(e,t){const n=this.parser.constructs.attentionMarkers.null,i=this.previous,l=hl(i);let c;return u;function u(h){return c=h,e.enter("attentionSequence"),f(h)}function f(h){if(h===c)return e.consume(h),f;const p=e.exit("attentionSequence"),g=hl(h),v=!g||g===2&&l||n.includes(h),y=!l||l===2&&g||n.includes(i);return p._open=!!(c===42?v:v&&(l||!y)),p._close=!!(c===42?y:y&&(g||!v)),t(h)}}function Ry(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const cE={name:"autolink",tokenize:uE};function uE(e,t,n){let i=0;return l;function l(b){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),c}function c(b){return On(b)?(e.consume(b),u):b===64?n(b):p(b)}function u(b){return b===43||b===45||b===46||An(b)?(i=1,f(b)):p(b)}function f(b){return b===58?(e.consume(b),i=0,h):(b===43||b===45||b===46||An(b))&&i++<32?(e.consume(b),f):(i=0,p(b))}function h(b){return b===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),t):b===null||b===32||b===60||Dd(b)?n(b):(e.consume(b),h)}function p(b){return b===64?(e.consume(b),g):J4(b)?(e.consume(b),p):n(b)}function g(b){return An(b)?v(b):n(b)}function v(b){return b===46?(e.consume(b),i=0,g):b===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),t):y(b)}function y(b){if((b===45||An(b))&&i++<63){const _=b===45?y:v;return e.consume(b),_}return n(b)}}const vc={partial:!0,tokenize:dE};function dE(e,t,n){return i;function i(c){return it(c)?dt(e,l,"linePrefix")(c):l(c)}function l(c){return c===null||$e(c)?t(c):n(c)}}const jw={continuation:{tokenize:hE},exit:pE,name:"blockQuote",tokenize:fE};function fE(e,t,n){const i=this;return l;function l(u){if(u===62){const f=i.containerState;return f.open||(e.enter("blockQuote",{_container:!0}),f.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(u),e.exit("blockQuoteMarker"),c}return n(u)}function c(u){return it(u)?(e.enter("blockQuotePrefixWhitespace"),e.consume(u),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(u))}}function hE(e,t,n){const i=this;return l;function l(u){return it(u)?dt(e,c,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u):c(u)}function c(u){return e.attempt(jw,t,n)(u)}}function pE(e){e.exit("blockQuote")}const Nw={name:"characterEscape",tokenize:mE};function mE(e,t,n){return i;function i(c){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(c),e.exit("escapeMarker"),l}function l(c){return tE(c)?(e.enter("characterEscapeValue"),e.consume(c),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(c)}}const Cw={name:"characterReference",tokenize:gE};function gE(e,t,n){const i=this;let l=0,c,u;return f;function f(v){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(v),e.exit("characterReferenceMarker"),h}function h(v){return v===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(v),e.exit("characterReferenceMarkerNumeric"),p):(e.enter("characterReferenceValue"),c=31,u=An,g(v))}function p(v){return v===88||v===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(v),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),c=6,u=eE,g):(e.enter("characterReferenceValue"),c=7,u=rg,g(v))}function g(v){if(v===59&&l){const y=e.exit("characterReferenceValue");return u===An&&!Hg(i.sliceSerialize(y))?n(v):(e.enter("characterReferenceMarker"),e.consume(v),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return u(v)&&l++<c?(e.consume(v),g):n(v)}}const Dy={partial:!0,tokenize:vE},zy={concrete:!0,name:"codeFenced",tokenize:xE};function xE(e,t,n){const i=this,l={partial:!0,tokenize:z};let c=0,u=0,f;return h;function h(D){return p(D)}function p(D){const F=i.events[i.events.length-1];return c=F&&F[1].type==="linePrefix"?F[2].sliceSerialize(F[1],!0).length:0,f=D,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(D)}function g(D){return D===f?(u++,e.consume(D),g):u<3?n(D):(e.exit("codeFencedFenceSequence"),it(D)?dt(e,v,"whitespace")(D):v(D))}function v(D){return D===null||$e(D)?(e.exit("codeFencedFence"),i.interrupt?t(D):e.check(Dy,S,P)(D)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),y(D))}function y(D){return D===null||$e(D)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),v(D)):it(D)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),dt(e,b,"whitespace")(D)):D===96&&D===f?n(D):(e.consume(D),y)}function b(D){return D===null||$e(D)?v(D):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),_(D))}function _(D){return D===null||$e(D)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),v(D)):D===96&&D===f?n(D):(e.consume(D),_)}function S(D){return e.attempt(l,P,T)(D)}function T(D){return e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),j}function j(D){return c>0&&it(D)?dt(e,R,"linePrefix",c+1)(D):R(D)}function R(D){return D===null||$e(D)?e.check(Dy,S,P)(D):(e.enter("codeFlowValue"),C(D))}function C(D){return D===null||$e(D)?(e.exit("codeFlowValue"),R(D)):(e.consume(D),C)}function P(D){return e.exit("codeFenced"),t(D)}function z(D,F,B){let I=0;return L;function L(Y){return D.enter("lineEnding"),D.consume(Y),D.exit("lineEnding"),q}function q(Y){return D.enter("codeFencedFence"),it(Y)?dt(D,E,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(Y):E(Y)}function E(Y){return Y===f?(D.enter("codeFencedFenceSequence"),ae(Y)):B(Y)}function ae(Y){return Y===f?(I++,D.consume(Y),ae):I>=u?(D.exit("codeFencedFenceSequence"),it(Y)?dt(D,K,"whitespace")(Y):K(Y)):B(Y)}function K(Y){return Y===null||$e(Y)?(D.exit("codeFencedFence"),F(Y)):B(Y)}}}function vE(e,t,n){const i=this;return l;function l(u){return u===null?n(u):(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),c)}function c(u){return i.parser.lazy[i.now().line]?n(u):t(u)}}const $p={name:"codeIndented",tokenize:yE},bE={partial:!0,tokenize:_E};function yE(e,t,n){const i=this;return l;function l(p){return e.enter("codeIndented"),dt(e,c,"linePrefix",5)(p)}function c(p){const g=i.events[i.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?u(p):n(p)}function u(p){return p===null?h(p):$e(p)?e.attempt(bE,u,h)(p):(e.enter("codeFlowValue"),f(p))}function f(p){return p===null||$e(p)?(e.exit("codeFlowValue"),u(p)):(e.consume(p),f)}function h(p){return e.exit("codeIndented"),t(p)}}function _E(e,t,n){const i=this;return l;function l(u){return i.parser.lazy[i.now().line]?n(u):$e(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),l):dt(e,c,"linePrefix",5)(u)}function c(u){const f=i.events[i.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(u):$e(u)?l(u):n(u)}}const wE={name:"codeText",previous:SE,resolve:kE,tokenize:jE};function kE(e){let t=e.length-4,n=3,i,l;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(i=n;++i<t;)if(e[i][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(i=n-1,t++;++i<=t;)l===void 0?i!==t&&e[i][1].type!=="lineEnding"&&(l=i):(i===t||e[i][1].type==="lineEnding")&&(e[l][1].type="codeTextData",i!==l+2&&(e[l][1].end=e[i-1][1].end,e.splice(l+2,i-l-2),t-=i-l-2,i=l+2),l=void 0);return e}function SE(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function jE(e,t,n){let i=0,l,c;return u;function u(v){return e.enter("codeText"),e.enter("codeTextSequence"),f(v)}function f(v){return v===96?(e.consume(v),i++,f):(e.exit("codeTextSequence"),h(v))}function h(v){return v===null?n(v):v===32?(e.enter("space"),e.consume(v),e.exit("space"),h):v===96?(c=e.enter("codeTextSequence"),l=0,g(v)):$e(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),h):(e.enter("codeTextData"),p(v))}function p(v){return v===null||v===32||v===96||$e(v)?(e.exit("codeTextData"),h(v)):(e.consume(v),p)}function g(v){return v===96?(e.consume(v),l++,g):l===i?(e.exit("codeTextSequence"),e.exit("codeText"),t(v)):(c.type="codeTextData",p(v))}}class NE{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const i=n??Number.POSITIVE_INFINITY;return i<this.left.length?this.left.slice(t,i):t>this.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(t,n,i){const l=n||0;this.setCursor(Math.trunc(t));const c=this.right.splice(this.right.length-l,Number.POSITIVE_INFINITY);return i&&Mo(this.left,i),c.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Mo(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Mo(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);Mo(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Mo(this.left,n.reverse())}}}function Mo(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 Ew(e){const t={};let n=-1,i,l,c,u,f,h,p;const g=new NE(e);for(;++n<g.length;){for(;n in t;)n=t[n];if(i=g.get(n),n&&i[1].type==="chunkFlow"&&g.get(n-1)[1].type==="listItemPrefix"&&(h=i[1]._tokenizer.events,c=0,c<h.length&&h[c][1].type==="lineEndingBlank"&&(c+=2),c<h.length&&h[c][1].type==="content"))for(;++c<h.length&&h[c][1].type!=="content";)h[c][1].type==="chunkText"&&(h[c][1]._isInFirstContentOfListItem=!0,c++);if(i[0]==="enter")i[1].contentType&&(Object.assign(t,CE(g,n)),n=t[n],p=!0);else if(i[1]._container){for(c=n,l=void 0;c--;)if(u=g.get(c),u[1].type==="lineEnding"||u[1].type==="lineEndingBlank")u[0]==="enter"&&(l&&(g.get(l)[1].type="lineEndingBlank"),u[1].type="lineEnding",l=c);else if(!(u[1].type==="linePrefix"||u[1].type==="listItemIndent"))break;l&&(i[1].end={...g.get(l)[1].start},f=g.slice(l,n),f.unshift(i),g.splice(l,n-l+1,f))}}return ur(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!p}function CE(e,t){const n=e.get(t)[1],i=e.get(t)[2];let l=t-1;const c=[];let u=n._tokenizer;u||(u=i.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(u._contentTypeTextTrailing=!0));const f=u.events,h=[],p={};let g,v,y=-1,b=n,_=0,S=0;const T=[S];for(;b;){for(;e.get(++l)[1]!==b;);c.push(l),b._tokenizer||(g=i.sliceStream(b),b.next||g.push(null),v&&u.defineSkip(b.start),b._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=!0),u.write(g),b._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=void 0)),v=b,b=b.next}for(b=n;++y<f.length;)f[y][0]==="exit"&&f[y-1][0]==="enter"&&f[y][1].type===f[y-1][1].type&&f[y][1].start.line!==f[y][1].end.line&&(S=y+1,T.push(S),b._tokenizer=void 0,b.previous=void 0,b=b.next);for(u.events=[],b?(b._tokenizer=void 0,b.previous=void 0):T.pop(),y=T.length;y--;){const j=f.slice(T[y],T[y+1]),R=c.pop();h.push([R,R+j.length-1]),e.splice(R,2,j)}for(h.reverse(),y=-1;++y<h.length;)p[_+h[y][0]]=_+h[y][1],_+=h[y][1]-h[y][0]-1;return p}const EE={resolve:AE,tokenize:ME},TE={partial:!0,tokenize:RE};function AE(e){return Ew(e),e}function ME(e,t){let n;return i;function i(f){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),l(f)}function l(f){return f===null?c(f):$e(f)?e.check(TE,u,c)(f):(e.consume(f),l)}function c(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,l}}function RE(e,t,n){const i=this;return l;function l(u){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),dt(e,c,"linePrefix")}function c(u){if(u===null||$e(u))return n(u);const f=i.events[i.events.length-1];return!i.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(u):e.interrupt(i.parser.constructs.flow,n,t)(u)}}function Tw(e,t,n,i,l,c,u,f,h){const p=h||Number.POSITIVE_INFINITY;let g=0;return v;function v(j){return j===60?(e.enter(i),e.enter(l),e.enter(c),e.consume(j),e.exit(c),y):j===null||j===32||j===41||Dd(j)?n(j):(e.enter(i),e.enter(u),e.enter(f),e.enter("chunkString",{contentType:"string"}),S(j))}function y(j){return j===62?(e.enter(c),e.consume(j),e.exit(c),e.exit(l),e.exit(i),t):(e.enter(f),e.enter("chunkString",{contentType:"string"}),b(j))}function b(j){return j===62?(e.exit("chunkString"),e.exit(f),y(j)):j===null||j===60||$e(j)?n(j):(e.consume(j),j===92?_:b)}function _(j){return j===60||j===62||j===92?(e.consume(j),b):b(j)}function S(j){return!g&&(j===null||j===41||Tt(j))?(e.exit("chunkString"),e.exit(f),e.exit(u),e.exit(i),t(j)):g<p&&j===40?(e.consume(j),g++,S):j===41?(e.consume(j),g--,S):j===null||j===32||j===40||Dd(j)?n(j):(e.consume(j),j===92?T:S)}function T(j){return j===40||j===41||j===92?(e.consume(j),S):S(j)}}function Aw(e,t,n,i,l,c){const u=this;let f=0,h;return p;function p(b){return e.enter(i),e.enter(l),e.consume(b),e.exit(l),e.enter(c),g}function g(b){return f>999||b===null||b===91||b===93&&!h||b===94&&!f&&"_hiddenFootnoteSupport"in u.parser.constructs?n(b):b===93?(e.exit(c),e.enter(l),e.consume(b),e.exit(l),e.exit(i),t):$e(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),v(b))}function v(b){return b===null||b===91||b===93||$e(b)||f++>999?(e.exit("chunkString"),g(b)):(e.consume(b),h||(h=!it(b)),b===92?y:v)}function y(b){return b===91||b===92||b===93?(e.consume(b),f++,v):v(b)}}function Mw(e,t,n,i,l,c){let u;return f;function f(y){return y===34||y===39||y===40?(e.enter(i),e.enter(l),e.consume(y),e.exit(l),u=y===40?41:y,h):n(y)}function h(y){return y===u?(e.enter(l),e.consume(y),e.exit(l),e.exit(i),t):(e.enter(c),p(y))}function p(y){return y===u?(e.exit(c),h(u)):y===null?n(y):$e(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),dt(e,p,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(y))}function g(y){return y===u||y===null||$e(y)?(e.exit("chunkString"),p(y)):(e.consume(y),y===92?v:g)}function v(y){return y===u||y===92?(e.consume(y),g):g(y)}}function Qo(e,t){let n;return i;function i(l){return $e(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),n=!0,i):it(l)?dt(e,i,n?"linePrefix":"lineSuffix")(l):t(l)}}const DE={name:"definition",tokenize:LE},zE={partial:!0,tokenize:OE};function LE(e,t,n){const i=this;let l;return c;function c(b){return e.enter("definition"),u(b)}function u(b){return Aw.call(i,e,f,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function f(b){return l=Or(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),h):n(b)}function h(b){return Tt(b)?Qo(e,p)(b):p(b)}function p(b){return Tw(e,g,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function g(b){return e.attempt(zE,v,v)(b)}function v(b){return it(b)?dt(e,y,"whitespace")(b):y(b)}function y(b){return b===null||$e(b)?(e.exit("definition"),i.parser.defined.push(l),t(b)):n(b)}}function OE(e,t,n){return i;function i(f){return Tt(f)?Qo(e,l)(f):n(f)}function l(f){return Mw(e,c,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function c(f){return it(f)?dt(e,u,"whitespace")(f):u(f)}function u(f){return f===null||$e(f)?t(f):n(f)}}const BE={name:"hardBreakEscape",tokenize:$E};function $E(e,t,n){return i;function i(c){return e.enter("hardBreakEscape"),e.consume(c),l}function l(c){return $e(c)?(e.exit("hardBreakEscape"),t(c)):n(c)}}const PE={name:"headingAtx",resolve:UE,tokenize:FE};function UE(e,t){let n=e.length-2,i=3,l,c;return e[i][1].type==="whitespace"&&(i+=2),n-2>i&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(i===n-1||n-4>i&&e[n-2][1].type==="whitespace")&&(n-=i+1===n?2:4),n>i&&(l={type:"atxHeadingText",start:e[i][1].start,end:e[n][1].end},c={type:"chunkText",start:e[i][1].start,end:e[n][1].end,contentType:"text"},ur(e,i,n-i+1,[["enter",l,t],["enter",c,t],["exit",c,t],["exit",l,t]])),e}function FE(e,t,n){let i=0;return l;function l(g){return e.enter("atxHeading"),c(g)}function c(g){return e.enter("atxHeadingSequence"),u(g)}function u(g){return g===35&&i++<6?(e.consume(g),u):g===null||Tt(g)?(e.exit("atxHeadingSequence"),f(g)):n(g)}function f(g){return g===35?(e.enter("atxHeadingSequence"),h(g)):g===null||$e(g)?(e.exit("atxHeading"),t(g)):it(g)?dt(e,f,"whitespace")(g):(e.enter("atxHeadingText"),p(g))}function h(g){return g===35?(e.consume(g),h):(e.exit("atxHeadingSequence"),f(g))}function p(g){return g===null||g===35||Tt(g)?(e.exit("atxHeadingText"),f(g)):(e.consume(g),p)}}const HE=["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"],Ly=["pre","script","style","textarea"],qE={concrete:!0,name:"htmlFlow",resolveTo:GE,tokenize:YE},IE={partial:!0,tokenize:XE},VE={partial:!0,tokenize:WE};function GE(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 YE(e,t,n){const i=this;let l,c,u,f,h;return p;function p(A){return g(A)}function g(A){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(A),v}function v(A){return A===33?(e.consume(A),y):A===47?(e.consume(A),c=!0,S):A===63?(e.consume(A),l=3,i.interrupt?t:M):On(A)?(e.consume(A),u=String.fromCharCode(A),T):n(A)}function y(A){return A===45?(e.consume(A),l=2,b):A===91?(e.consume(A),l=5,f=0,_):On(A)?(e.consume(A),l=4,i.interrupt?t:M):n(A)}function b(A){return A===45?(e.consume(A),i.interrupt?t:M):n(A)}function _(A){const fe="CDATA[";return A===fe.charCodeAt(f++)?(e.consume(A),f===fe.length?i.interrupt?t:E:_):n(A)}function S(A){return On(A)?(e.consume(A),u=String.fromCharCode(A),T):n(A)}function T(A){if(A===null||A===47||A===62||Tt(A)){const fe=A===47,_e=u.toLowerCase();return!fe&&!c&&Ly.includes(_e)?(l=1,i.interrupt?t(A):E(A)):HE.includes(u.toLowerCase())?(l=6,fe?(e.consume(A),j):i.interrupt?t(A):E(A)):(l=7,i.interrupt&&!i.parser.lazy[i.now().line]?n(A):c?R(A):C(A))}return A===45||An(A)?(e.consume(A),u+=String.fromCharCode(A),T):n(A)}function j(A){return A===62?(e.consume(A),i.interrupt?t:E):n(A)}function R(A){return it(A)?(e.consume(A),R):L(A)}function C(A){return A===47?(e.consume(A),L):A===58||A===95||On(A)?(e.consume(A),P):it(A)?(e.consume(A),C):L(A)}function P(A){return A===45||A===46||A===58||A===95||An(A)?(e.consume(A),P):z(A)}function z(A){return A===61?(e.consume(A),D):it(A)?(e.consume(A),z):C(A)}function D(A){return A===null||A===60||A===61||A===62||A===96?n(A):A===34||A===39?(e.consume(A),h=A,F):it(A)?(e.consume(A),D):B(A)}function F(A){return A===h?(e.consume(A),h=null,I):A===null||$e(A)?n(A):(e.consume(A),F)}function B(A){return A===null||A===34||A===39||A===47||A===60||A===61||A===62||A===96||Tt(A)?z(A):(e.consume(A),B)}function I(A){return A===47||A===62||it(A)?C(A):n(A)}function L(A){return A===62?(e.consume(A),q):n(A)}function q(A){return A===null||$e(A)?E(A):it(A)?(e.consume(A),q):n(A)}function E(A){return A===45&&l===2?(e.consume(A),U):A===60&&l===1?(e.consume(A),$):A===62&&l===4?(e.consume(A),O):A===63&&l===3?(e.consume(A),M):A===93&&l===5?(e.consume(A),xe):$e(A)&&(l===6||l===7)?(e.exit("htmlFlowData"),e.check(IE,Z,ae)(A)):A===null||$e(A)?(e.exit("htmlFlowData"),ae(A)):(e.consume(A),E)}function ae(A){return e.check(VE,K,Z)(A)}function K(A){return e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),Y}function Y(A){return A===null||$e(A)?ae(A):(e.enter("htmlFlowData"),E(A))}function U(A){return A===45?(e.consume(A),M):E(A)}function $(A){return A===47?(e.consume(A),u="",re):E(A)}function re(A){if(A===62){const fe=u.toLowerCase();return Ly.includes(fe)?(e.consume(A),O):E(A)}return On(A)&&u.length<8?(e.consume(A),u+=String.fromCharCode(A),re):E(A)}function xe(A){return A===93?(e.consume(A),M):E(A)}function M(A){return A===62?(e.consume(A),O):A===45&&l===2?(e.consume(A),M):E(A)}function O(A){return A===null||$e(A)?(e.exit("htmlFlowData"),Z(A)):(e.consume(A),O)}function Z(A){return e.exit("htmlFlow"),t(A)}}function WE(e,t,n){const i=this;return l;function l(u){return $e(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),c):n(u)}function c(u){return i.parser.lazy[i.now().line]?n(u):t(u)}}function XE(e,t,n){return i;function i(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),e.attempt(vc,t,n)}}const QE={name:"htmlText",tokenize:KE};function KE(e,t,n){const i=this;let l,c,u;return f;function f(M){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(M),h}function h(M){return M===33?(e.consume(M),p):M===47?(e.consume(M),z):M===63?(e.consume(M),C):On(M)?(e.consume(M),B):n(M)}function p(M){return M===45?(e.consume(M),g):M===91?(e.consume(M),c=0,_):On(M)?(e.consume(M),R):n(M)}function g(M){return M===45?(e.consume(M),b):n(M)}function v(M){return M===null?n(M):M===45?(e.consume(M),y):$e(M)?(u=v,$(M)):(e.consume(M),v)}function y(M){return M===45?(e.consume(M),b):v(M)}function b(M){return M===62?U(M):M===45?y(M):v(M)}function _(M){const O="CDATA[";return M===O.charCodeAt(c++)?(e.consume(M),c===O.length?S:_):n(M)}function S(M){return M===null?n(M):M===93?(e.consume(M),T):$e(M)?(u=S,$(M)):(e.consume(M),S)}function T(M){return M===93?(e.consume(M),j):S(M)}function j(M){return M===62?U(M):M===93?(e.consume(M),j):S(M)}function R(M){return M===null||M===62?U(M):$e(M)?(u=R,$(M)):(e.consume(M),R)}function C(M){return M===null?n(M):M===63?(e.consume(M),P):$e(M)?(u=C,$(M)):(e.consume(M),C)}function P(M){return M===62?U(M):C(M)}function z(M){return On(M)?(e.consume(M),D):n(M)}function D(M){return M===45||An(M)?(e.consume(M),D):F(M)}function F(M){return $e(M)?(u=F,$(M)):it(M)?(e.consume(M),F):U(M)}function B(M){return M===45||An(M)?(e.consume(M),B):M===47||M===62||Tt(M)?I(M):n(M)}function I(M){return M===47?(e.consume(M),U):M===58||M===95||On(M)?(e.consume(M),L):$e(M)?(u=I,$(M)):it(M)?(e.consume(M),I):U(M)}function L(M){return M===45||M===46||M===58||M===95||An(M)?(e.consume(M),L):q(M)}function q(M){return M===61?(e.consume(M),E):$e(M)?(u=q,$(M)):it(M)?(e.consume(M),q):I(M)}function E(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),l=M,ae):$e(M)?(u=E,$(M)):it(M)?(e.consume(M),E):(e.consume(M),K)}function ae(M){return M===l?(e.consume(M),l=void 0,Y):M===null?n(M):$e(M)?(u=ae,$(M)):(e.consume(M),ae)}function K(M){return M===null||M===34||M===39||M===60||M===61||M===96?n(M):M===47||M===62||Tt(M)?I(M):(e.consume(M),K)}function Y(M){return M===47||M===62||Tt(M)?I(M):n(M)}function U(M){return M===62?(e.consume(M),e.exit("htmlTextData"),e.exit("htmlText"),t):n(M)}function $(M){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),re}function re(M){return it(M)?dt(e,xe,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):xe(M)}function xe(M){return e.enter("htmlTextData"),u(M)}}const qg={name:"labelEnd",resolveAll:t6,resolveTo:n6,tokenize:r6},ZE={tokenize:i6},JE={tokenize:s6},e6={tokenize:a6};function t6(e){let t=-1;const n=[];for(;++t<e.length;){const i=e[t][1];if(n.push(e[t]),i.type==="labelImage"||i.type==="labelLink"||i.type==="labelEnd"){const l=i.type==="labelImage"?4:2;i.type="data",t+=l}}return e.length!==n.length&&ur(e,0,e.length,n),e}function n6(e,t){let n=e.length,i=0,l,c,u,f;for(;n--;)if(l=e[n][1],c){if(l.type==="link"||l.type==="labelLink"&&l._inactive)break;e[n][0]==="enter"&&l.type==="labelLink"&&(l._inactive=!0)}else if(u){if(e[n][0]==="enter"&&(l.type==="labelImage"||l.type==="labelLink")&&!l._balanced&&(c=n,l.type!=="labelLink")){i=2;break}}else l.type==="labelEnd"&&(u=n);const h={type:e[c][1].type==="labelLink"?"link":"image",start:{...e[c][1].start},end:{...e[e.length-1][1].end}},p={type:"label",start:{...e[c][1].start},end:{...e[u][1].end}},g={type:"labelText",start:{...e[c+i+2][1].end},end:{...e[u-2][1].start}};return f=[["enter",h,t],["enter",p,t]],f=Nr(f,e.slice(c+1,c+i+3)),f=Nr(f,[["enter",g,t]]),f=Nr(f,Vd(t.parser.constructs.insideSpan.null,e.slice(c+i+4,u-3),t)),f=Nr(f,[["exit",g,t],e[u-2],e[u-1],["exit",p,t]]),f=Nr(f,e.slice(u+1)),f=Nr(f,[["exit",h,t]]),ur(e,c,e.length,f),e}function r6(e,t,n){const i=this;let l=i.events.length,c,u;for(;l--;)if((i.events[l][1].type==="labelImage"||i.events[l][1].type==="labelLink")&&!i.events[l][1]._balanced){c=i.events[l][1];break}return f;function f(y){return c?c._inactive?v(y):(u=i.parser.defined.includes(Or(i.sliceSerialize({start:c.end,end:i.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(y),e.exit("labelMarker"),e.exit("labelEnd"),h):n(y)}function h(y){return y===40?e.attempt(ZE,g,u?g:v)(y):y===91?e.attempt(JE,g,u?p:v)(y):u?g(y):v(y)}function p(y){return e.attempt(e6,g,v)(y)}function g(y){return t(y)}function v(y){return c._balanced=!0,n(y)}}function i6(e,t,n){return i;function i(v){return e.enter("resource"),e.enter("resourceMarker"),e.consume(v),e.exit("resourceMarker"),l}function l(v){return Tt(v)?Qo(e,c)(v):c(v)}function c(v){return v===41?g(v):Tw(e,u,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(v)}function u(v){return Tt(v)?Qo(e,h)(v):g(v)}function f(v){return n(v)}function h(v){return v===34||v===39||v===40?Mw(e,p,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(v):g(v)}function p(v){return Tt(v)?Qo(e,g)(v):g(v)}function g(v){return v===41?(e.enter("resourceMarker"),e.consume(v),e.exit("resourceMarker"),e.exit("resource"),t):n(v)}}function s6(e,t,n){const i=this;return l;function l(f){return Aw.call(i,e,c,u,"reference","referenceMarker","referenceString")(f)}function c(f){return i.parser.defined.includes(Or(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?t(f):n(f)}function u(f){return n(f)}}function a6(e,t,n){return i;function i(c){return e.enter("reference"),e.enter("referenceMarker"),e.consume(c),e.exit("referenceMarker"),l}function l(c){return c===93?(e.enter("referenceMarker"),e.consume(c),e.exit("referenceMarker"),e.exit("reference"),t):n(c)}}const l6={name:"labelStartImage",resolveAll:qg.resolveAll,tokenize:o6};function o6(e,t,n){const i=this;return l;function l(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),c}function c(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 i.parser.constructs?n(f):t(f)}}const c6={name:"labelStartLink",resolveAll:qg.resolveAll,tokenize:u6};function u6(e,t,n){const i=this;return l;function l(u){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),e.exit("labelLink"),c}function c(u){return u===94&&"_hiddenFootnoteSupport"in i.parser.constructs?n(u):t(u)}}const Pp={name:"lineEnding",tokenize:d6};function d6(e,t){return n;function n(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),dt(e,t,"linePrefix")}}const cd={name:"thematicBreak",tokenize:f6};function f6(e,t,n){let i=0,l;return c;function c(p){return e.enter("thematicBreak"),u(p)}function u(p){return l=p,f(p)}function f(p){return p===l?(e.enter("thematicBreakSequence"),h(p)):i>=3&&(p===null||$e(p))?(e.exit("thematicBreak"),t(p)):n(p)}function h(p){return p===l?(e.consume(p),i++,h):(e.exit("thematicBreakSequence"),it(p)?dt(e,f,"whitespace")(p):f(p))}}const Gn={continuation:{tokenize:g6},exit:v6,name:"list",tokenize:m6},h6={partial:!0,tokenize:b6},p6={partial:!0,tokenize:x6};function m6(e,t,n){const i=this,l=i.events[i.events.length-1];let c=l&&l[1].type==="linePrefix"?l[2].sliceSerialize(l[1],!0).length:0,u=0;return f;function f(b){const _=i.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(_==="listUnordered"?!i.containerState.marker||b===i.containerState.marker:rg(b)){if(i.containerState.type||(i.containerState.type=_,e.enter(_,{_container:!0})),_==="listUnordered")return e.enter("listItemPrefix"),b===42||b===45?e.check(cd,n,p)(b):p(b);if(!i.interrupt||b===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),h(b)}return n(b)}function h(b){return rg(b)&&++u<10?(e.consume(b),h):(!i.interrupt||u<2)&&(i.containerState.marker?b===i.containerState.marker:b===41||b===46)?(e.exit("listItemValue"),p(b)):n(b)}function p(b){return e.enter("listItemMarker"),e.consume(b),e.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||b,e.check(vc,i.interrupt?n:g,e.attempt(h6,y,v))}function g(b){return i.containerState.initialBlankLine=!0,c++,y(b)}function v(b){return it(b)?(e.enter("listItemPrefixWhitespace"),e.consume(b),e.exit("listItemPrefixWhitespace"),y):n(b)}function y(b){return i.containerState.size=c+i.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(b)}}function g6(e,t,n){const i=this;return i.containerState._closeFlow=void 0,e.check(vc,l,c);function l(f){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,dt(e,t,"listItemIndent",i.containerState.size+1)(f)}function c(f){return i.containerState.furtherBlankLines||!it(f)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,u(f)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,e.attempt(p6,t,u)(f))}function u(f){return i.containerState._closeFlow=!0,i.interrupt=void 0,dt(e,e.attempt(Gn,t,n),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function x6(e,t,n){const i=this;return dt(e,l,"listItemIndent",i.containerState.size+1);function l(c){const u=i.events[i.events.length-1];return u&&u[1].type==="listItemIndent"&&u[2].sliceSerialize(u[1],!0).length===i.containerState.size?t(c):n(c)}}function v6(e){e.exit(this.containerState.type)}function b6(e,t,n){const i=this;return dt(e,l,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function l(c){const u=i.events[i.events.length-1];return!it(c)&&u&&u[1].type==="listItemPrefixWhitespace"?t(c):n(c)}}const Oy={name:"setextUnderline",resolveTo:y6,tokenize:_6};function y6(e,t){let n=e.length,i,l,c;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){i=n;break}e[n][1].type==="paragraph"&&(l=n)}else e[n][1].type==="content"&&e.splice(n,1),!c&&e[n][1].type==="definition"&&(c=n);const u={type:"setextHeading",start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[l][1].type="setextHeadingText",c?(e.splice(l,0,["enter",u,t]),e.splice(c+1,0,["exit",e[i][1],t]),e[i][1].end={...e[c][1].end}):e[i][1]=u,e.push(["exit",u,t]),e}function _6(e,t,n){const i=this;let l;return c;function c(p){let g=i.events.length,v;for(;g--;)if(i.events[g][1].type!=="lineEnding"&&i.events[g][1].type!=="linePrefix"&&i.events[g][1].type!=="content"){v=i.events[g][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||v)?(e.enter("setextHeadingLine"),l=p,u(p)):n(p)}function u(p){return e.enter("setextHeadingLineSequence"),f(p)}function f(p){return p===l?(e.consume(p),f):(e.exit("setextHeadingLineSequence"),it(p)?dt(e,h,"lineSuffix")(p):h(p))}function h(p){return p===null||$e(p)?(e.exit("setextHeadingLine"),t(p)):n(p)}}const w6={tokenize:k6};function k6(e){const t=this,n=e.attempt(vc,i,e.attempt(this.parser.constructs.flowInitial,l,dt(e,e.attempt(this.parser.constructs.flow,l,e.attempt(EE,l)),"linePrefix")));return n;function i(c){if(c===null){e.consume(c);return}return e.enter("lineEndingBlank"),e.consume(c),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function l(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const S6={resolveAll:Dw()},j6=Rw("string"),N6=Rw("text");function Rw(e){return{resolveAll:Dw(e==="text"?C6:void 0),tokenize:t};function t(n){const i=this,l=this.parser.constructs[e],c=n.attempt(l,u,f);return u;function u(g){return p(g)?c(g):f(g)}function f(g){if(g===null){n.consume(g);return}return n.enter("data"),n.consume(g),h}function h(g){return p(g)?(n.exit("data"),c(g)):(n.consume(g),h)}function p(g){if(g===null)return!0;const v=l[g];let y=-1;if(v)for(;++y<v.length;){const b=v[y];if(!b.previous||b.previous.call(i,i.previous))return!0}return!1}}}function Dw(e){return t;function t(n,i){let l=-1,c;for(;++l<=n.length;)c===void 0?n[l]&&n[l][1].type==="data"&&(c=l,l++):(!n[l]||n[l][1].type!=="data")&&(l!==c+2&&(n[c][1].end=n[l-1][1].end,n.splice(c+2,l-c-2),l=c+2),c=void 0);return e?e(n,i):n}}function C6(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const i=e[n-1][1],l=t.sliceStream(i);let c=l.length,u=-1,f=0,h;for(;c--;){const p=l[c];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){c++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(f=0),f){const p={type:n===e.length||h||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:c?u:i.start._bufferIndex+u,_index:i.start._index+c,line:i.end.line,column:i.end.column-f,offset:i.end.offset-f},end:{...i.end}};i.end={...p.start},i.start.offset===i.end.offset?Object.assign(i,p):(e.splice(n,0,["enter",p,t],["exit",p,t]),n+=2)}n++}return e}const E6={42:Gn,43:Gn,45:Gn,48:Gn,49:Gn,50:Gn,51:Gn,52:Gn,53:Gn,54:Gn,55:Gn,56:Gn,57:Gn,62:jw},T6={91:DE},A6={[-2]:$p,[-1]:$p,32:$p},M6={35:PE,42:cd,45:[Oy,cd],60:qE,61:Oy,95:cd,96:zy,126:zy},R6={38:Cw,92:Nw},D6={[-5]:Pp,[-4]:Pp,[-3]:Pp,33:l6,38:Cw,42:ig,60:[cE,QE],91:c6,92:[BE,Nw],93:qg,95:ig,96:wE},z6={null:[ig,S6]},L6={null:[42,95]},O6={null:[]},B6=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:L6,contentInitial:T6,disable:O6,document:E6,flow:M6,flowInitial:A6,insideSpan:z6,string:R6,text:D6},Symbol.toStringTag,{value:"Module"}));function $6(e,t,n){let i={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const l={},c=[];let u=[],f=[];const h={attempt:F(z),check:F(D),consume:R,enter:C,exit:P,interrupt:F(D,{interrupt:!0})},p={code:null,containerState:{},defineSkip:S,events:[],now:_,parser:e,previous:null,sliceSerialize:y,sliceStream:b,write:v};let g=t.tokenize.call(p,h);return t.resolveAll&&c.push(t),p;function v(q){return u=Nr(u,q),T(),u[u.length-1]!==null?[]:(B(t,0),p.events=Vd(c,p.events,p),p.events)}function y(q,E){return U6(b(q),E)}function b(q){return P6(u,q)}function _(){const{_bufferIndex:q,_index:E,line:ae,column:K,offset:Y}=i;return{_bufferIndex:q,_index:E,line:ae,column:K,offset:Y}}function S(q){l[q.line]=q.column,L()}function T(){let q;for(;i._index<u.length;){const E=u[i._index];if(typeof E=="string")for(q=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===q&&i._bufferIndex<E.length;)j(E.charCodeAt(i._bufferIndex));else j(E)}}function j(q){g=g(q)}function R(q){$e(q)?(i.line++,i.column=1,i.offset+=q===-3?2:1,L()):q!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===u[i._index].length&&(i._bufferIndex=-1,i._index++)),p.previous=q}function C(q,E){const ae=E||{};return ae.type=q,ae.start=_(),p.events.push(["enter",ae,p]),f.push(ae),ae}function P(q){const E=f.pop();return E.end=_(),p.events.push(["exit",E,p]),E}function z(q,E){B(q,E.from)}function D(q,E){E.restore()}function F(q,E){return ae;function ae(K,Y,U){let $,re,xe,M;return Array.isArray(K)?Z(K):"tokenize"in K?Z([K]):O(K);function O(je){return De;function De(oe){const Ee=oe!==null&&je[oe],Fe=oe!==null&&je.null,At=[...Array.isArray(Ee)?Ee:Ee?[Ee]:[],...Array.isArray(Fe)?Fe:Fe?[Fe]:[]];return Z(At)(oe)}}function Z(je){return $=je,re=0,je.length===0?U:A(je[re])}function A(je){return De;function De(oe){return M=I(),xe=je,je.partial||(p.currentConstruct=je),je.name&&p.parser.constructs.disable.null.includes(je.name)?_e():je.tokenize.call(E?Object.assign(Object.create(p),E):p,h,fe,_e)(oe)}}function fe(je){return q(xe,M),Y}function _e(je){return M.restore(),++re<$.length?A($[re]):U}}}function B(q,E){q.resolveAll&&!c.includes(q)&&c.push(q),q.resolve&&ur(p.events,E,p.events.length-E,q.resolve(p.events.slice(E),p)),q.resolveTo&&(p.events=q.resolveTo(p.events,p))}function I(){const q=_(),E=p.previous,ae=p.currentConstruct,K=p.events.length,Y=Array.from(f);return{from:K,restore:U};function U(){i=q,p.previous=E,p.currentConstruct=ae,p.events.length=K,f=Y,L()}}function L(){i.line in l&&i.column<2&&(i.column=l[i.line],i.offset+=l[i.line]-1)}}function P6(e,t){const n=t.start._index,i=t.start._bufferIndex,l=t.end._index,c=t.end._bufferIndex;let u;if(n===l)u=[e[n].slice(i,c)];else{if(u=e.slice(n,l),i>-1){const f=u[0];typeof f=="string"?u[0]=f.slice(i):u.shift()}c>0&&u.push(e[l].slice(0,c))}return u}function U6(e,t){let n=-1;const i=[];let l;for(;++n<e.length;){const c=e[n];let u;if(typeof c=="string")u=c;else switch(c){case-5:{u="\r";break}case-4:{u=`
|
|
67
|
+
`;break}case-3:{u=`\r
|
|
68
|
+
`;break}case-2:{u=t?" ":" ";break}case-1:{if(!t&&l)continue;u=" ";break}default:u=String.fromCharCode(c)}l=c===-2,i.push(u)}return i.join("")}function F6(e){const i={constructs:kw([B6,...(e||{}).extensions||[]]),content:l(nE),defined:[],document:l(iE),flow:l(w6),lazy:{},string:l(j6),text:l(N6)};return i;function l(c){return u;function u(f){return $6(i,c,f)}}}function H6(e){for(;!Ew(e););return e}const By=/[\0\t\n\r]/g;function q6(){let e=1,t="",n=!0,i;return l;function l(c,u,f){const h=[];let p,g,v,y,b;for(c=t+(typeof c=="string"?c.toString():new TextDecoder(u||void 0).decode(c)),v=0,t="",n&&(c.charCodeAt(0)===65279&&v++,n=void 0);v<c.length;){if(By.lastIndex=v,p=By.exec(c),y=p&&p.index!==void 0?p.index:c.length,b=c.charCodeAt(y),!p){t=c.slice(v);break}if(b===10&&v===y&&i)h.push(-3),i=void 0;else switch(i&&(h.push(-5),i=void 0),v<y&&(h.push(c.slice(v,y)),e+=y-v),b){case 0:{h.push(65533),e++;break}case 9:{for(g=Math.ceil(e/4)*4,h.push(-2);e++<g;)h.push(-1);break}case 10:{h.push(-4),e=1;break}default:i=!0,e=1}v=y+1}return f&&(i&&h.push(-5),t&&h.push(t),h.push(null)),h}}const I6=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function V6(e){return e.replace(I6,G6)}function G6(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const l=n.charCodeAt(1),c=l===120||l===88;return Sw(n.slice(c?2:1),c?16:10)}return Hg(n)||e}const zw={}.hasOwnProperty;function Y6(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),W6(n)(H6(F6(n).document().write(q6()(e,t,!0))))}function W6(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:c(tn),autolinkProtocol:I,autolinkEmail:I,atxHeading:c(qe),blockQuote:c(Fe),characterEscape:I,characterReference:I,codeFenced:c(At),codeFencedFenceInfo:u,codeFencedFenceMeta:u,codeIndented:c(At,u),codeText:c(Ze,u),codeTextData:I,data:I,codeFlowValue:I,definition:c(Mt),definitionDestinationString:u,definitionLabelString:u,definitionTitleString:u,emphasis:c(vt),hardBreakEscape:c(Pt),hardBreakTrailing:c(Pt),htmlFlow:c(vn,u),htmlFlowData:I,htmlText:c(vn,u),htmlTextData:I,image:c(un),label:u,link:c(tn),listItem:c(ke),listItemValue:y,listOrdered:c(nn,v),listUnordered:c(nn),paragraph:c(ze),reference:A,referenceString:u,resourceDestinationString:u,resourceTitleString:u,setextHeading:c(qe),strong:c(ot),thematicBreak:c(bn)},exit:{atxHeading:h(),atxHeadingSequence:z,autolink:h(),autolinkEmail:Ee,autolinkProtocol:oe,blockQuote:h(),characterEscapeValue:L,characterReferenceMarkerHexadecimal:_e,characterReferenceMarkerNumeric:_e,characterReferenceValue:je,characterReference:De,codeFenced:h(T),codeFencedFence:S,codeFencedFenceInfo:b,codeFencedFenceMeta:_,codeFlowValue:L,codeIndented:h(j),codeText:h(Y),codeTextData:L,data:L,definition:h(),definitionDestinationString:P,definitionLabelString:R,definitionTitleString:C,emphasis:h(),hardBreakEscape:h(E),hardBreakTrailing:h(E),htmlFlow:h(ae),htmlFlowData:L,htmlText:h(K),htmlTextData:L,image:h($),label:xe,labelText:re,lineEnding:q,link:h(U),listItem:h(),listOrdered:h(),listUnordered:h(),paragraph:h(),referenceString:fe,resourceDestinationString:M,resourceTitleString:O,resource:Z,setextHeading:h(B),setextHeadingLineSequence:F,setextHeadingText:D,strong:h(),thematicBreak:h()}};Lw(t,(e||{}).mdastExtensions||[]);const n={};return i;function i(le){let be={type:"root",children:[]};const W={stack:[be],tokenStack:[],config:t,enter:f,exit:p,buffer:u,resume:g,data:n},he=[];let Ae=-1;for(;++Ae<le.length;)if(le[Ae][1].type==="listOrdered"||le[Ae][1].type==="listUnordered")if(le[Ae][0]==="enter")he.push(Ae);else{const ut=he.pop();Ae=l(le,ut,Ae)}for(Ae=-1;++Ae<le.length;){const ut=t[le[Ae][0]];zw.call(ut,le[Ae][1].type)&&ut[le[Ae][1].type].call(Object.assign({sliceSerialize:le[Ae][2].sliceSerialize},W),le[Ae][1])}if(W.tokenStack.length>0){const ut=W.tokenStack[W.tokenStack.length-1];(ut[1]||$y).call(W,void 0,ut[0])}for(be.position={start:ds(le.length>0?le[0][1].start:{line:1,column:1,offset:0}),end:ds(le.length>0?le[le.length-2][1].end:{line:1,column:1,offset:0})},Ae=-1;++Ae<t.transforms.length;)be=t.transforms[Ae](be)||be;return be}function l(le,be,W){let he=be-1,Ae=-1,ut=!1,Qe,Je,gt,Ut;for(;++he<=W;){const J=le[he];switch(J[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{J[0]==="enter"?Ae++:Ae--,Ut=void 0;break}case"lineEndingBlank":{J[0]==="enter"&&(Qe&&!Ut&&!Ae&&!gt&&(gt=he),Ut=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ut=void 0}if(!Ae&&J[0]==="enter"&&J[1].type==="listItemPrefix"||Ae===-1&&J[0]==="exit"&&(J[1].type==="listUnordered"||J[1].type==="listOrdered")){if(Qe){let pe=he;for(Je=void 0;pe--;){const me=le[pe];if(me[1].type==="lineEnding"||me[1].type==="lineEndingBlank"){if(me[0]==="exit")continue;Je&&(le[Je][1].type="lineEndingBlank",ut=!0),me[1].type="lineEnding",Je=pe}else if(!(me[1].type==="linePrefix"||me[1].type==="blockQuotePrefix"||me[1].type==="blockQuotePrefixWhitespace"||me[1].type==="blockQuoteMarker"||me[1].type==="listItemIndent"))break}gt&&(!Je||gt<Je)&&(Qe._spread=!0),Qe.end=Object.assign({},Je?le[Je][1].start:J[1].end),le.splice(Je||he,0,["exit",Qe,J[2]]),he++,W++}if(J[1].type==="listItemPrefix"){const pe={type:"listItem",_spread:!1,start:Object.assign({},J[1].start),end:void 0};Qe=pe,le.splice(he,0,["enter",pe,J[2]]),he++,W++,gt=void 0,Ut=!0}}}return le[be][1]._spread=ut,W}function c(le,be){return W;function W(he){f.call(this,le(he),he),be&&be.call(this,he)}}function u(){this.stack.push({type:"fragment",children:[]})}function f(le,be,W){this.stack[this.stack.length-1].children.push(le),this.stack.push(le),this.tokenStack.push([be,W||void 0]),le.position={start:ds(be.start),end:void 0}}function h(le){return be;function be(W){le&&le.call(this,W),p.call(this,W)}}function p(le,be){const W=this.stack.pop(),he=this.tokenStack.pop();if(he)he[0].type!==le.type&&(be?be.call(this,le,he[0]):(he[1]||$y).call(this,le,he[0]));else throw new Error("Cannot close `"+le.type+"` ("+Xo({start:le.start,end:le.end})+"): it’s not open");W.position.end=ds(le.end)}function g(){return Fg(this.stack.pop())}function v(){this.data.expectingFirstListItemValue=!0}function y(le){if(this.data.expectingFirstListItemValue){const be=this.stack[this.stack.length-2];be.start=Number.parseInt(this.sliceSerialize(le),10),this.data.expectingFirstListItemValue=void 0}}function b(){const le=this.resume(),be=this.stack[this.stack.length-1];be.lang=le}function _(){const le=this.resume(),be=this.stack[this.stack.length-1];be.meta=le}function S(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function T(){const le=this.resume(),be=this.stack[this.stack.length-1];be.value=le.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function j(){const le=this.resume(),be=this.stack[this.stack.length-1];be.value=le.replace(/(\r?\n|\r)$/g,"")}function R(le){const be=this.resume(),W=this.stack[this.stack.length-1];W.label=be,W.identifier=Or(this.sliceSerialize(le)).toLowerCase()}function C(){const le=this.resume(),be=this.stack[this.stack.length-1];be.title=le}function P(){const le=this.resume(),be=this.stack[this.stack.length-1];be.url=le}function z(le){const be=this.stack[this.stack.length-1];if(!be.depth){const W=this.sliceSerialize(le).length;be.depth=W}}function D(){this.data.setextHeadingSlurpLineEnding=!0}function F(le){const be=this.stack[this.stack.length-1];be.depth=this.sliceSerialize(le).codePointAt(0)===61?1:2}function B(){this.data.setextHeadingSlurpLineEnding=void 0}function I(le){const W=this.stack[this.stack.length-1].children;let he=W[W.length-1];(!he||he.type!=="text")&&(he=Pe(),he.position={start:ds(le.start),end:void 0},W.push(he)),this.stack.push(he)}function L(le){const be=this.stack.pop();be.value+=this.sliceSerialize(le),be.position.end=ds(le.end)}function q(le){const be=this.stack[this.stack.length-1];if(this.data.atHardBreak){const W=be.children[be.children.length-1];W.position.end=ds(le.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(be.type)&&(I.call(this,le),L.call(this,le))}function E(){this.data.atHardBreak=!0}function ae(){const le=this.resume(),be=this.stack[this.stack.length-1];be.value=le}function K(){const le=this.resume(),be=this.stack[this.stack.length-1];be.value=le}function Y(){const le=this.resume(),be=this.stack[this.stack.length-1];be.value=le}function U(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const be=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=be,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function $(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const be=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=be,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function re(le){const be=this.sliceSerialize(le),W=this.stack[this.stack.length-2];W.label=V6(be),W.identifier=Or(be).toLowerCase()}function xe(){const le=this.stack[this.stack.length-1],be=this.resume(),W=this.stack[this.stack.length-1];if(this.data.inReference=!0,W.type==="link"){const he=le.children;W.children=he}else W.alt=be}function M(){const le=this.resume(),be=this.stack[this.stack.length-1];be.url=le}function O(){const le=this.resume(),be=this.stack[this.stack.length-1];be.title=le}function Z(){this.data.inReference=void 0}function A(){this.data.referenceType="collapsed"}function fe(le){const be=this.resume(),W=this.stack[this.stack.length-1];W.label=be,W.identifier=Or(this.sliceSerialize(le)).toLowerCase(),this.data.referenceType="full"}function _e(le){this.data.characterReferenceType=le.type}function je(le){const be=this.sliceSerialize(le),W=this.data.characterReferenceType;let he;W?(he=Sw(be,W==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):he=Hg(be);const Ae=this.stack[this.stack.length-1];Ae.value+=he}function De(le){const be=this.stack.pop();be.position.end=ds(le.end)}function oe(le){L.call(this,le);const be=this.stack[this.stack.length-1];be.url=this.sliceSerialize(le)}function Ee(le){L.call(this,le);const be=this.stack[this.stack.length-1];be.url="mailto:"+this.sliceSerialize(le)}function Fe(){return{type:"blockquote",children:[]}}function At(){return{type:"code",lang:null,meta:null,value:""}}function Ze(){return{type:"inlineCode",value:""}}function Mt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function vt(){return{type:"emphasis",children:[]}}function qe(){return{type:"heading",depth:0,children:[]}}function Pt(){return{type:"break"}}function vn(){return{type:"html",value:""}}function un(){return{type:"image",title:null,url:"",alt:null}}function tn(){return{type:"link",title:null,url:"",children:[]}}function nn(le){return{type:"list",ordered:le.type==="listOrdered",start:null,spread:le._spread,children:[]}}function ke(le){return{type:"listItem",spread:le._spread,checked:null,children:[]}}function ze(){return{type:"paragraph",children:[]}}function ot(){return{type:"strong",children:[]}}function Pe(){return{type:"text",value:""}}function bn(){return{type:"thematicBreak"}}}function ds(e){return{line:e.line,column:e.column,offset:e.offset}}function Lw(e,t){let n=-1;for(;++n<t.length;){const i=t[n];Array.isArray(i)?Lw(e,i):X6(e,i)}}function X6(e,t){let n;for(n in t)if(zw.call(t,n))switch(n){case"canContainEols":{const i=t[n];i&&e[n].push(...i);break}case"transforms":{const i=t[n];i&&e[n].push(...i);break}case"enter":case"exit":{const i=t[n];i&&Object.assign(e[n],i);break}}}function $y(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Xo({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Xo({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Xo({start:t.start,end:t.end})+") is still open")}function Q6(e){const t=this;t.parser=n;function n(i){return Y6(i,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function K6(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 Z6(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
69
|
+
`}]}function J6(e,t){const n=t.value?t.value+`
|
|
70
|
+
`:"",i={},l=t.lang?t.lang.split(/\s+/):[];l.length>0&&(i.className=["language-"+l[0]]);let c={type:"element",tagName:"code",properties:i,children:[{type:"text",value:n}]};return t.meta&&(c.data={meta:t.meta}),e.patch(t,c),c=e.applyData(t,c),c={type:"element",tagName:"pre",properties:{},children:[c]},e.patch(t,c),c}function eT(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function tT(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function nT(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=String(t.identifier).toUpperCase(),l=vl(i.toLowerCase()),c=e.footnoteOrder.indexOf(i);let u,f=e.footnoteCounts.get(i);f===void 0?(f=0,e.footnoteOrder.push(i),u=e.footnoteOrder.length):u=c+1,f+=1,e.footnoteCounts.set(i,f);const h={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+l,id:n+"fnref-"+l+(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 rT(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 iT(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Ow(e,t){const n=t.referenceType;let i="]";if(n==="collapsed"?i+="[]":n==="full"&&(i+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+i}];const l=e.all(t),c=l[0];c&&c.type==="text"?c.value="["+c.value:l.unshift({type:"text",value:"["});const u=l[l.length-1];return u&&u.type==="text"?u.value+=i:l.push({type:"text",value:i}),l}function sT(e,t){const n=String(t.identifier).toUpperCase(),i=e.definitionById.get(n);if(!i)return Ow(e,t);const l={src:vl(i.url||""),alt:t.alt};i.title!==null&&i.title!==void 0&&(l.title=i.title);const c={type:"element",tagName:"img",properties:l,children:[]};return e.patch(t,c),e.applyData(t,c)}function aT(e,t){const n={src:vl(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const i={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,i),e.applyData(t,i)}function lT(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const i={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,i),e.applyData(t,i)}function oT(e,t){const n=String(t.identifier).toUpperCase(),i=e.definitionById.get(n);if(!i)return Ow(e,t);const l={href:vl(i.url||"")};i.title!==null&&i.title!==void 0&&(l.title=i.title);const c={type:"element",tagName:"a",properties:l,children:e.all(t)};return e.patch(t,c),e.applyData(t,c)}function cT(e,t){const n={href:vl(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const i={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function uT(e,t,n){const i=e.all(t),l=n?dT(n):Bw(t),c={},u=[];if(typeof t.checked=="boolean"){const g=i[0];let v;g&&g.type==="element"&&g.tagName==="p"?v=g:(v={type:"element",tagName:"p",properties:{},children:[]},i.unshift(v)),v.children.length>0&&v.children.unshift({type:"text",value:" "}),v.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),c.className=["task-list-item"]}let f=-1;for(;++f<i.length;){const g=i[f];(l||f!==0||g.type!=="element"||g.tagName!=="p")&&u.push({type:"text",value:`
|
|
71
|
+
`}),g.type==="element"&&g.tagName==="p"&&!l?u.push(...g.children):u.push(g)}const h=i[i.length-1];h&&(l||h.type!=="element"||h.tagName!=="p")&&u.push({type:"text",value:`
|
|
72
|
+
`});const p={type:"element",tagName:"li",properties:c,children:u};return e.patch(t,p),e.applyData(t,p)}function dT(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let i=-1;for(;!t&&++i<n.length;)t=Bw(n[i])}return t}function Bw(e){const t=e.spread;return t??e.children.length>1}function fT(e,t){const n={},i=e.all(t);let l=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++l<i.length;){const u=i[l];if(u.type==="element"&&u.tagName==="li"&&u.properties&&Array.isArray(u.properties.className)&&u.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const c={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(i,!0)};return e.patch(t,c),e.applyData(t,c)}function hT(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function pT(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function mT(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function gT(e,t){const n=e.all(t),i=n.shift(),l=[];if(i){const u={type:"element",tagName:"thead",properties:{},children:e.wrap([i],!0)};e.patch(t.children[0],u),l.push(u)}if(n.length>0){const u={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},f=Bg(t.children[1]),h=gw(t.children[t.children.length-1]);f&&h&&(u.position={start:f,end:h}),l.push(u)}const c={type:"element",tagName:"table",properties:{},children:e.wrap(l,!0)};return e.patch(t,c),e.applyData(t,c)}function xT(e,t,n){const i=n?n.children:void 0,c=(i?i.indexOf(t):1)===0?"th":"td",u=n&&n.type==="table"?n.align:void 0,f=u?u.length:t.children.length;let h=-1;const p=[];for(;++h<f;){const v=t.children[h],y={},b=u?u[h]:void 0;b&&(y.align=b);let _={type:"element",tagName:c,properties:y,children:[]};v&&(_.children=e.all(v),e.patch(v,_),_=e.applyData(v,_)),p.push(_)}const g={type:"element",tagName:"tr",properties:{},children:e.wrap(p,!0)};return e.patch(t,g),e.applyData(t,g)}function vT(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Py=9,Uy=32;function bT(e){const t=String(e),n=/\r?\n|\r/g;let i=n.exec(t),l=0;const c=[];for(;i;)c.push(Fy(t.slice(l,i.index),l>0,!0),i[0]),l=i.index+i[0].length,i=n.exec(t);return c.push(Fy(t.slice(l),l>0,!1)),c.join("")}function Fy(e,t,n){let i=0,l=e.length;if(t){let c=e.codePointAt(i);for(;c===Py||c===Uy;)i++,c=e.codePointAt(i)}if(n){let c=e.codePointAt(l-1);for(;c===Py||c===Uy;)l--,c=e.codePointAt(l-1)}return l>i?e.slice(i,l):""}function yT(e,t){const n={type:"text",value:bT(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function _T(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const wT={blockquote:K6,break:Z6,code:J6,delete:eT,emphasis:tT,footnoteReference:nT,heading:rT,html:iT,imageReference:sT,image:aT,inlineCode:lT,linkReference:oT,link:cT,listItem:uT,list:fT,paragraph:hT,root:pT,strong:mT,table:gT,tableCell:vT,tableRow:xT,text:yT,thematicBreak:_T,toml:Wu,yaml:Wu,definition:Wu,footnoteDefinition:Wu};function Wu(){}const $w=-1,Gd=0,Ko=1,zd=2,Ig=3,Vg=4,Gg=5,Yg=6,Pw=7,Uw=8,kT=typeof self=="object"?self:globalThis,Hy=(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 kT[e](t)},ST=(e,t)=>{const n=(l,c)=>(e.set(c,l),l),i=l=>{if(e.has(l))return e.get(l);const[c,u]=t[l];switch(c){case Gd:case $w:return n(u,l);case Ko:{const f=n([],l);for(const h of u)f.push(i(h));return f}case zd:{const f=n({},l);for(const[h,p]of u)f[i(h)]=i(p);return f}case Ig:return n(new Date(u),l);case Vg:{const{source:f,flags:h}=u;return n(new RegExp(f,h),l)}case Gg:{const f=n(new Map,l);for(const[h,p]of u)f.set(i(h),i(p));return f}case Yg:{const f=n(new Set,l);for(const h of u)f.add(i(h));return f}case Pw:{const{name:f,message:h}=u;return n(Hy(f,h),l)}case Uw:return n(BigInt(u),l);case"BigInt":return n(Object(BigInt(u)),l);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(Hy(c,u),l)};return i},qy=e=>ST(new Map,e)(0),Qa="",{toString:jT}={},{keys:NT}=Object,Ro=e=>{const t=typeof e;if(t!=="object"||!e)return[Gd,t];const n=jT.call(e).slice(8,-1);switch(n){case"Array":return[Ko,Qa];case"Object":return[zd,Qa];case"Date":return[Ig,Qa];case"RegExp":return[Vg,Qa];case"Map":return[Gg,Qa];case"Set":return[Yg,Qa];case"DataView":return[Ko,n]}return n.includes("Array")?[Ko,n]:n.includes("Error")?[Pw,n]:[zd,n]},Xu=([e,t])=>e===Gd&&(t==="function"||t==="symbol"),CT=(e,t,n,i)=>{const l=(u,f)=>{const h=i.push(u)-1;return n.set(f,h),h},c=u=>{if(n.has(u))return n.get(u);let[f,h]=Ro(u);switch(f){case Gd:{let g=u;switch(h){case"bigint":f=Uw,g=u.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+h);g=null;break;case"undefined":return l([$w],u)}return l([f,g],u)}case Ko:{if(h){let y=u;return h==="DataView"?y=new Uint8Array(u.buffer):h==="ArrayBuffer"&&(y=new Uint8Array(u)),l([h,[...y]],u)}const g=[],v=l([f,g],u);for(const y of u)g.push(c(y));return v}case zd:{if(h)switch(h){case"BigInt":return l([h,u.toString()],u);case"Boolean":case"Number":case"String":return l([h,u.valueOf()],u)}if(t&&"toJSON"in u)return c(u.toJSON());const g=[],v=l([f,g],u);for(const y of NT(u))(e||!Xu(Ro(u[y])))&&g.push([c(y),c(u[y])]);return v}case Ig:return l([f,u.toISOString()],u);case Vg:{const{source:g,flags:v}=u;return l([f,{source:g,flags:v}],u)}case Gg:{const g=[],v=l([f,g],u);for(const[y,b]of u)(e||!(Xu(Ro(y))||Xu(Ro(b))))&&g.push([c(y),c(b)]);return v}case Yg:{const g=[],v=l([f,g],u);for(const y of u)(e||!Xu(Ro(y)))&&g.push(c(y));return v}}const{message:p}=u;return l([f,{name:h,message:p}],u)};return c},Iy=(e,{json:t,lossy:n}={})=>{const i=[];return CT(!(t||n),!!t,new Map,i)(e),i},Ld=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?qy(Iy(e,t)):structuredClone(e):(e,t)=>qy(Iy(e,t));function ET(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 TT(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function AT(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||ET,i=e.options.footnoteBackLabel||TT,l=e.options.footnoteLabel||"Footnotes",c=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 g=e.all(p),v=String(p.identifier).toUpperCase(),y=vl(v.toLowerCase());let b=0;const _=[],S=e.footnoteCounts.get(v);for(;S!==void 0&&++b<=S;){_.length>0&&_.push({type:"text",value:" "});let R=typeof n=="string"?n:n(h,b);typeof R=="string"&&(R={type:"text",value:R}),_.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+y+(b>1?"-"+b:""),dataFootnoteBackref:"",ariaLabel:typeof i=="string"?i:i(h,b),className:["data-footnote-backref"]},children:Array.isArray(R)?R:[R]})}const T=g[g.length-1];if(T&&T.type==="element"&&T.tagName==="p"){const R=T.children[T.children.length-1];R&&R.type==="text"?R.value+=" ":T.children.push({type:"text",value:" "}),T.children.push(..._)}else g.push(..._);const j={type:"element",tagName:"li",properties:{id:t+"fn-"+y},children:e.wrap(g,!0)};e.patch(p,j),f.push(j)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:c,properties:{...Ld(u),id:"footnote-label"},children:[{type:"text",value:l}]},{type:"text",value:`
|
|
73
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(f,!0)},{type:"text",value:`
|
|
74
|
+
`}]}}const Yd=(function(e){if(e==null)return zT;if(typeof e=="function")return Wd(e);if(typeof e=="object")return Array.isArray(e)?MT(e):RT(e);if(typeof e=="string")return DT(e);throw new Error("Expected function, string, or object as test")});function MT(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Yd(e[n]);return Wd(i);function i(...l){let c=-1;for(;++c<t.length;)if(t[c].apply(this,l))return!0;return!1}}function RT(e){const t=e;return Wd(n);function n(i){const l=i;let c;for(c in e)if(l[c]!==t[c])return!1;return!0}}function DT(e){return Wd(t);function t(n){return n&&n.type===e}}function Wd(e){return t;function t(n,i,l){return!!(LT(n)&&e.call(this,n,typeof i=="number"?i:void 0,l||void 0))}}function zT(){return!0}function LT(e){return e!==null&&typeof e=="object"&&"type"in e}const Fw=[],OT=!0,sg=!1,BT="skip";function Hw(e,t,n,i){let l;typeof t=="function"&&typeof n!="function"?(i=n,n=t):l=t;const c=Yd(l),u=i?-1:1;f(e,void 0,[])();function f(h,p,g){const v=h&&typeof h=="object"?h:{};if(typeof v.type=="string"){const b=typeof v.tagName=="string"?v.tagName:typeof v.name=="string"?v.name:void 0;Object.defineProperty(y,"name",{value:"node ("+(h.type+(b?"<"+b+">":""))+")"})}return y;function y(){let b=Fw,_,S,T;if((!t||c(h,p,g[g.length-1]||void 0))&&(b=$T(n(h,g)),b[0]===sg))return b;if("children"in h&&h.children){const j=h;if(j.children&&b[0]!==BT)for(S=(i?j.children.length:-1)+u,T=g.concat(j);S>-1&&S<j.children.length;){const R=j.children[S];if(_=f(R,S,T)(),_[0]===sg)return _;S=typeof _[1]=="number"?_[1]:S+u}}return b}}}function $T(e){return Array.isArray(e)?e:typeof e=="number"?[OT,e]:e==null?Fw:[e]}function Wg(e,t,n,i){let l,c,u;typeof t=="function"&&typeof n!="function"?(c=void 0,u=t,l=n):(c=t,u=n,l=i),Hw(e,c,f,l);function f(h,p){const g=p[p.length-1],v=g?g.children.indexOf(h):void 0;return u(h,v,g)}}const ag={}.hasOwnProperty,PT={};function UT(e,t){const n=t||PT,i=new Map,l=new Map,c=new Map,u={...wT,...n.handlers},f={all:p,applyData:HT,definitionById:i,footnoteById:l,footnoteCounts:c,footnoteOrder:[],handlers:u,one:h,options:n,patch:FT,wrap:IT};return Wg(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const v=g.type==="definition"?i:l,y=String(g.identifier).toUpperCase();v.has(y)||v.set(y,g)}}),f;function h(g,v){const y=g.type,b=f.handlers[y];if(ag.call(f.handlers,y)&&b)return b(f,g,v);if(f.options.passThrough&&f.options.passThrough.includes(y)){if("children"in g){const{children:S,...T}=g,j=Ld(T);return j.children=f.all(g),j}return Ld(g)}return(f.options.unknownHandler||qT)(f,g,v)}function p(g){const v=[];if("children"in g){const y=g.children;let b=-1;for(;++b<y.length;){const _=f.one(y[b],g);if(_){if(b&&y[b-1].type==="break"&&(!Array.isArray(_)&&_.type==="text"&&(_.value=Vy(_.value)),!Array.isArray(_)&&_.type==="element")){const S=_.children[0];S&&S.type==="text"&&(S.value=Vy(S.value))}Array.isArray(_)?v.push(..._):v.push(_)}}}return v}}function FT(e,t){e.position&&(t.position=E4(e))}function HT(e,t){let n=t;if(e&&e.data){const i=e.data.hName,l=e.data.hChildren,c=e.data.hProperties;if(typeof i=="string")if(n.type==="element")n.tagName=i;else{const u="children"in n?n.children:[n];n={type:"element",tagName:i,properties:{},children:u}}n.type==="element"&&c&&Object.assign(n.properties,Ld(c)),"children"in n&&n.children&&l!==null&&l!==void 0&&(n.children=l)}return n}function qT(e,t){const n=t.data||{},i="value"in t&&!(ag.call(n,"hProperties")||ag.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function IT(e,t){const n=[];let i=-1;for(t&&n.push({type:"text",value:`
|
|
75
|
+
`});++i<e.length;)i&&n.push({type:"text",value:`
|
|
76
|
+
`}),n.push(e[i]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
77
|
+
`}),n}function Vy(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Gy(e,t){const n=UT(e,t),i=n.one(e,void 0),l=AT(n),c=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return l&&c.children.push({type:"text",value:`
|
|
78
|
+
`},l),c}function VT(e,t){return e&&"run"in e?async function(n,i){const l=Gy(n,{file:i,...t});await e.run(l,i)}:function(n,i){return Gy(n,{file:i,...e||t})}}function Yy(e){if(e)throw e}var Up,Wy;function GT(){if(Wy)return Up;Wy=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,l=function(p){return typeof Array.isArray=="function"?Array.isArray(p):t.call(p)==="[object Array]"},c=function(p){if(!p||t.call(p)!=="[object Object]")return!1;var g=e.call(p,"constructor"),v=p.constructor&&p.constructor.prototype&&e.call(p.constructor.prototype,"isPrototypeOf");if(p.constructor&&!g&&!v)return!1;var y;for(y in p);return typeof y>"u"||e.call(p,y)},u=function(p,g){n&&g.name==="__proto__"?n(p,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):p[g.name]=g.newValue},f=function(p,g){if(g==="__proto__")if(e.call(p,g)){if(i)return i(p,g).value}else return;return p[g]};return Up=function h(){var p,g,v,y,b,_,S=arguments[0],T=1,j=arguments.length,R=!1;for(typeof S=="boolean"&&(R=S,S=arguments[1]||{},T=2),(S==null||typeof S!="object"&&typeof S!="function")&&(S={});T<j;++T)if(p=arguments[T],p!=null)for(g in p)v=f(S,g),y=f(p,g),S!==y&&(R&&y&&(c(y)||(b=l(y)))?(b?(b=!1,_=v&&l(v)?v:[]):_=v&&c(v)?v:{},u(S,{name:g,newValue:h(R,_,y)})):typeof y<"u"&&u(S,{name:g,newValue:y}));return S},Up}var YT=GT();const Fp=hg(YT);function lg(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 WT(){const e=[],t={run:n,use:i};return t;function n(...l){let c=-1;const u=l.pop();if(typeof u!="function")throw new TypeError("Expected function as last argument, not "+u);f(null,...l);function f(h,...p){const g=e[++c];let v=-1;if(h){u(h);return}for(;++v<l.length;)(p[v]===null||p[v]===void 0)&&(p[v]=l[v]);l=p,g?XT(g,f)(...p):u(null,...p)}}function i(l){if(typeof l!="function")throw new TypeError("Expected `middelware` to be a function, not "+l);return e.push(l),t}}function XT(e,t){let n;return i;function i(...u){const f=e.length>u.length;let h;f&&u.push(l);try{h=e.apply(this,u)}catch(p){const g=p;if(f&&n)throw g;return l(g)}f||(h&&h.then&&typeof h.then=="function"?h.then(c,l):h instanceof Error?l(h):c(h))}function l(u,...f){n||(n=!0,t(u,...f))}function c(u){l(null,u)}}const Wr={basename:QT,dirname:KT,extname:ZT,join:JT,sep:"/"};function QT(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');bc(e);let n=0,i=-1,l=e.length,c;if(t===void 0||t.length===0||t.length>e.length){for(;l--;)if(e.codePointAt(l)===47){if(c){n=l+1;break}}else i<0&&(c=!0,i=l+1);return i<0?"":e.slice(n,i)}if(t===e)return"";let u=-1,f=t.length-1;for(;l--;)if(e.codePointAt(l)===47){if(c){n=l+1;break}}else u<0&&(c=!0,u=l+1),f>-1&&(e.codePointAt(l)===t.codePointAt(f--)?f<0&&(i=l):(f=-1,i=u));return n===i?i=u:i<0&&(i=e.length),e.slice(n,i)}function KT(e){if(bc(e),e.length===0)return".";let t=-1,n=e.length,i;for(;--n;)if(e.codePointAt(n)===47){if(i){t=n;break}}else i||(i=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function ZT(e){bc(e);let t=e.length,n=-1,i=0,l=-1,c=0,u;for(;t--;){const f=e.codePointAt(t);if(f===47){if(u){i=t+1;break}continue}n<0&&(u=!0,n=t+1),f===46?l<0?l=t:c!==1&&(c=1):l>-1&&(c=-1)}return l<0||n<0||c===0||c===1&&l===n-1&&l===i+1?"":e.slice(l,n)}function JT(...e){let t=-1,n;for(;++t<e.length;)bc(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":eA(n)}function eA(e){bc(e);const t=e.codePointAt(0)===47;let n=tA(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function tA(e,t){let n="",i=0,l=-1,c=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(!(l===u-1||c===1))if(l!==u-1&&c===2){if(n.length<2||i!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(h=n.lastIndexOf("/"),h!==n.length-1){h<0?(n="",i=0):(n=n.slice(0,h),i=n.length-1-n.lastIndexOf("/")),l=u,c=0;continue}}else if(n.length>0){n="",i=0,l=u,c=0;continue}}t&&(n=n.length>0?n+"/..":"..",i=2)}else n.length>0?n+="/"+e.slice(l+1,u):n=e.slice(l+1,u),i=u-l-1;l=u,c=0}else f===46&&c>-1?c++:c=-1}return n}function bc(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const nA={cwd:rA};function rA(){return"/"}function og(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function iA(e){if(typeof e=="string")e=new URL(e);else if(!og(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 sA(e)}function sA(e){if(e.hostname!==""){const i=new TypeError('File URL host must be "localhost" or empty on darwin');throw i.code="ERR_INVALID_FILE_URL_HOST",i}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const i=t.codePointAt(n+2);if(i===70||i===102){const l=new TypeError("File URL path must not include encoded / characters");throw l.code="ERR_INVALID_FILE_URL_PATH",l}}return decodeURIComponent(t)}const Hp=["history","path","basename","stem","extname","dirname"];class qw{constructor(t){let n;t?og(t)?n={path:t}:typeof t=="string"||aA(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":nA.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<Hp.length;){const c=Hp[i];c in n&&n[c]!==void 0&&n[c]!==null&&(this[c]=c==="history"?[...n[c]]:n[c])}let l;for(l in n)Hp.includes(l)||(this[l]=n[l])}get basename(){return typeof this.path=="string"?Wr.basename(this.path):void 0}set basename(t){Ip(t,"basename"),qp(t,"basename"),this.path=Wr.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Wr.dirname(this.path):void 0}set dirname(t){Xy(this.basename,"dirname"),this.path=Wr.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Wr.extname(this.path):void 0}set extname(t){if(qp(t,"extname"),Xy(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=Wr.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){og(t)&&(t=iA(t)),Ip(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Wr.basename(this.path,this.extname):void 0}set stem(t){Ip(t,"stem"),qp(t,"stem"),this.path=Wr.join(this.dirname||"",t+(this.extname||""))}fail(t,n,i){const l=this.message(t,n,i);throw l.fatal=!0,l}info(t,n,i){const l=this.message(t,n,i);return l.fatal=void 0,l}message(t,n,i){const l=new Mn(t,n,i);return this.path&&(l.name=this.path+":"+l.name,l.file=this.path),l.fatal=!1,this.messages.push(l),l}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function qp(e,t){if(e&&e.includes(Wr.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Wr.sep+"`")}function Ip(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Xy(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function aA(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const lA=(function(e){const i=this.constructor.prototype,l=i[e],c=function(){return l.apply(c,arguments)};return Object.setPrototypeOf(c,i),c}),oA={}.hasOwnProperty;class Xg extends lA{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=WT()}copy(){const t=new Xg;let n=-1;for(;++n<this.attachers.length;){const i=this.attachers[n];t.use(...i)}return t.data(Fp(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Yp("data",this.frozen),this.namespace[t]=n,this):oA.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Yp("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...i]=this.attachers[this.freezeIndex];if(i[0]===!1)continue;i[0]===!0&&(i[0]=void 0);const l=n.call(t,...i);typeof l=="function"&&this.transformers.use(l)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Qu(t),i=this.parser||this.Parser;return Vp("parse",i),i(String(n),n)}process(t,n){const i=this;return this.freeze(),Vp("process",this.parser||this.Parser),Gp("process",this.compiler||this.Compiler),n?l(void 0,n):new Promise(l);function l(c,u){const f=Qu(t),h=i.parse(f);i.run(h,f,function(g,v,y){if(g||!v||!y)return p(g);const b=v,_=i.stringify(b,y);dA(_)?y.value=_:y.result=_,p(g,y)});function p(g,v){g||!v?u(g):c?c(v):n(void 0,v)}}}processSync(t){let n=!1,i;return this.freeze(),Vp("processSync",this.parser||this.Parser),Gp("processSync",this.compiler||this.Compiler),this.process(t,l),Ky("processSync","process",n),i;function l(c,u){n=!0,Yy(c),i=u}}run(t,n,i){Qy(t),this.freeze();const l=this.transformers;return!i&&typeof n=="function"&&(i=n,n=void 0),i?c(void 0,i):new Promise(c);function c(u,f){const h=Qu(n);l.run(t,h,p);function p(g,v,y){const b=v||t;g?f(g):u?u(b):i(void 0,b,y)}}}runSync(t,n){let i=!1,l;return this.run(t,n,c),Ky("runSync","run",i),l;function c(u,f){Yy(u),l=f,i=!0}}stringify(t,n){this.freeze();const i=Qu(n),l=this.compiler||this.Compiler;return Gp("stringify",l),Qy(t),l(t,i)}use(t,...n){const i=this.attachers,l=this.namespace;if(Yp("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 c(p){if(typeof p=="function")h(p,[]);else if(typeof p=="object")if(Array.isArray(p)){const[g,...v]=p;h(g,v)}else u(p);else throw new TypeError("Expected usable value, not `"+p+"`")}function u(p){if(!("plugins"in p)&&!("settings"in p))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");f(p.plugins),p.settings&&(l.settings=Fp(!0,l.settings,p.settings))}function f(p){let g=-1;if(p!=null)if(Array.isArray(p))for(;++g<p.length;){const v=p[g];c(v)}else throw new TypeError("Expected a list of plugins, not `"+p+"`")}function h(p,g){let v=-1,y=-1;for(;++v<i.length;)if(i[v][0]===p){y=v;break}if(y===-1)i.push([p,...g]);else if(g.length>0){let[b,..._]=g;const S=i[y][1];lg(S)&&lg(b)&&(b=Fp(!0,S,b)),i[y]=[p,b,..._]}}}}const cA=new Xg().freeze();function Vp(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Gp(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Yp(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 Qy(e){if(!lg(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Ky(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Qu(e){return uA(e)?e:new qw(e)}function uA(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function dA(e){return typeof e=="string"||fA(e)}function fA(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const hA="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Zy=[],Jy={allowDangerousHtml:!0},pA=/^(https?|ircs?|mailto|xmpp)$/i,mA=[{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 Qg(e){const t=gA(e),n=xA(e);return vA(t.runSync(t.parse(n),n),e)}function gA(e){const t=e.rehypePlugins||Zy,n=e.remarkPlugins||Zy,i=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Jy}:Jy;return cA().use(Q6).use(n).use(VT,i).use(t)}function xA(e){const t=e.children||"",n=new qw;return typeof t=="string"&&(n.value=t),n}function vA(e,t){const n=t.allowedElements,i=t.allowElement,l=t.components,c=t.disallowedElements,u=t.skipHtml,f=t.unwrapDisallowed,h=t.urlTransform||bA;for(const g of mA)Object.hasOwn(t,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+hA+g.id,void 0);return Wg(e,p),D4(e,{Fragment:a.Fragment,components:l,ignoreInvalidStyle:!0,jsx:a.jsx,jsxs:a.jsxs,passKeys:!0,passNode:!0});function p(g,v,y){if(g.type==="raw"&&y&&typeof v=="number")return u?y.children.splice(v,1):y.children[v]={type:"text",value:g.value},v;if(g.type==="element"){let b;for(b in Bp)if(Object.hasOwn(Bp,b)&&Object.hasOwn(g.properties,b)){const _=g.properties[b],S=Bp[b];(S===null||S.includes(g.tagName))&&(g.properties[b]=h(String(_||""),b,g))}}if(g.type==="element"){let b=n?!n.includes(g.tagName):c?c.includes(g.tagName):!1;if(!b&&i&&typeof v=="number"&&(b=!i(g,v,y)),b&&y&&typeof v=="number")return f&&g.children?y.children.splice(v,1,...g.children):y.children.splice(v,1),v}}}function bA(e){const t=e.indexOf(":"),n=e.indexOf("?"),i=e.indexOf("#"),l=e.indexOf("/");return t===-1||l!==-1&&t>l||n!==-1&&t>n||i!==-1&&t>i||pA.test(e.slice(0,t))?e:""}function e5(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let i=0,l=n.indexOf(t);for(;l!==-1;)i++,l=n.indexOf(t,l+t.length);return i}function yA(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function _A(e,t,n){const l=Yd((n||{}).ignore||[]),c=wA(t);let u=-1;for(;++u<c.length;)Hw(e,"text",f);function f(p,g){let v=-1,y;for(;++v<g.length;){const b=g[v],_=y?y.children:void 0;if(l(b,_?_.indexOf(b):void 0,y))return;y=b}if(y)return h(p,g)}function h(p,g){const v=g[g.length-1],y=c[u][0],b=c[u][1];let _=0;const T=v.children.indexOf(p);let j=!1,R=[];y.lastIndex=0;let C=y.exec(p.value);for(;C;){const P=C.index,z={index:C.index,input:C.input,stack:[...g,p]};let D=b(...C,z);if(typeof D=="string"&&(D=D.length>0?{type:"text",value:D}:void 0),D===!1?y.lastIndex=P+1:(_!==P&&R.push({type:"text",value:p.value.slice(_,P)}),Array.isArray(D)?R.push(...D):D&&R.push(D),_=P+C[0].length,j=!0),!y.global)break;C=y.exec(p.value)}return j?(_<p.value.length&&R.push({type:"text",value:p.value.slice(_)}),v.children.splice(T,1,...R)):R=[p],T+R.length}}function wA(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let i=-1;for(;++i<n.length;){const l=n[i];t.push([kA(l[0]),SA(l[1])])}return t}function kA(e){return typeof e=="string"?new RegExp(yA(e),"g"):e}function SA(e){return typeof e=="function"?e:function(){return e}}const Wp="phrasing",Xp=["autolink","link","image","label"];function jA(){return{transforms:[RA],enter:{literalAutolink:CA,literalAutolinkEmail:Qp,literalAutolinkHttp:Qp,literalAutolinkWww:Qp},exit:{literalAutolink:MA,literalAutolinkEmail:AA,literalAutolinkHttp:EA,literalAutolinkWww:TA}}}function NA(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Wp,notInConstruct:Xp},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Wp,notInConstruct:Xp},{character:":",before:"[ps]",after:"\\/",inConstruct:Wp,notInConstruct:Xp}]}}function CA(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Qp(e){this.config.enter.autolinkProtocol.call(this,e)}function EA(e){this.config.exit.autolinkProtocol.call(this,e)}function TA(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 AA(e){this.config.exit.autolinkEmail.call(this,e)}function MA(e){this.exit(e)}function RA(e){_A(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,DA],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),zA]],{ignore:["link","linkReference"]})}function DA(e,t,n,i,l){let c="";if(!Iw(l)||(/^w/i.test(t)&&(n=t+n,t="",c="http://"),!LA(n)))return!1;const u=OA(n+i);if(!u[0])return!1;const f={type:"link",title:null,url:c+t+u[0],children:[{type:"text",value:t+u[0]}]};return u[1]?[f,{type:"text",value:u[1]}]:f}function zA(e,t,n,i){return!Iw(i,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function LA(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 OA(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],i=n.indexOf(")");const l=e5(e,"(");let c=e5(e,")");for(;i!==-1&&l>c;)e+=n.slice(0,i+1),n=n.slice(i+1),i=n.indexOf(")"),c++;return[e,n]}function Iw(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||ia(n)||Id(n))&&(!t||n!==47)}Vw.peek=VA;function BA(){this.buffer()}function $A(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function PA(){this.buffer()}function UA(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function FA(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Or(this.sliceSerialize(e)).toLowerCase(),n.label=t}function HA(e){this.exit(e)}function qA(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Or(this.sliceSerialize(e)).toLowerCase(),n.label=t}function IA(e){this.exit(e)}function VA(){return"["}function Vw(e,t,n,i){const l=n.createTracker(i);let c=l.move("[^");const u=n.enter("footnoteReference"),f=n.enter("reference");return c+=l.move(n.safe(n.associationId(e),{after:"]",before:c})),f(),u(),c+=l.move("]"),c}function GA(){return{enter:{gfmFootnoteCallString:BA,gfmFootnoteCall:$A,gfmFootnoteDefinitionLabelString:PA,gfmFootnoteDefinition:UA},exit:{gfmFootnoteCallString:FA,gfmFootnoteCall:HA,gfmFootnoteDefinitionLabelString:qA,gfmFootnoteDefinition:IA}}}function YA(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Vw},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(i,l,c,u){const f=c.createTracker(u);let h=f.move("[^");const p=c.enter("footnoteDefinition"),g=c.enter("label");return h+=f.move(c.safe(c.associationId(i),{before:h,after:"]"})),g(),h+=f.move("]:"),i.children&&i.children.length>0&&(f.shift(4),h+=f.move((t?`
|
|
79
|
+
`:" ")+c.indentLines(c.containerFlow(i,f.current()),t?Gw:WA))),p(),h}}function WA(e,t,n){return t===0?e:Gw(e,t,n)}function Gw(e,t,n){return(n?"":" ")+e}const XA=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Yw.peek=eM;function QA(){return{canContainEols:["delete"],enter:{strikethrough:ZA},exit:{strikethrough:JA}}}function KA(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:XA}],handlers:{delete:Yw}}}function ZA(e){this.enter({type:"delete",children:[]},e)}function JA(e){this.exit(e)}function Yw(e,t,n,i){const l=n.createTracker(i),c=n.enter("strikethrough");let u=l.move("~~");return u+=n.containerPhrasing(e,{...l.current(),before:u,after:"~"}),u+=l.move("~~"),c(),u}function eM(){return"~"}function tM(e){return e.length}function nM(e,t){const n=t||{},i=(n.align||[]).concat(),l=n.stringLength||tM,c=[],u=[],f=[],h=[];let p=0,g=-1;for(;++g<e.length;){const S=[],T=[];let j=-1;for(e[g].length>p&&(p=e[g].length);++j<e[g].length;){const R=rM(e[g][j]);if(n.alignDelimiters!==!1){const C=l(R);T[j]=C,(h[j]===void 0||C>h[j])&&(h[j]=C)}S.push(R)}u[g]=S,f[g]=T}let v=-1;if(typeof i=="object"&&"length"in i)for(;++v<p;)c[v]=t5(i[v]);else{const S=t5(i);for(;++v<p;)c[v]=S}v=-1;const y=[],b=[];for(;++v<p;){const S=c[v];let T="",j="";S===99?(T=":",j=":"):S===108?T=":":S===114&&(j=":");let R=n.alignDelimiters===!1?1:Math.max(1,h[v]-T.length-j.length);const C=T+"-".repeat(R)+j;n.alignDelimiters!==!1&&(R=T.length+R+j.length,R>h[v]&&(h[v]=R),b[v]=R),y[v]=C}u.splice(1,0,y),f.splice(1,0,b),g=-1;const _=[];for(;++g<u.length;){const S=u[g],T=f[g];v=-1;const j=[];for(;++v<p;){const R=S[v]||"";let C="",P="";if(n.alignDelimiters!==!1){const z=h[v]-(T[v]||0),D=c[v];D===114?C=" ".repeat(z):D===99?z%2?(C=" ".repeat(z/2+.5),P=" ".repeat(z/2-.5)):(C=" ".repeat(z/2),P=C):P=" ".repeat(z)}n.delimiterStart!==!1&&!v&&j.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&R==="")&&(n.delimiterStart!==!1||v)&&j.push(" "),n.alignDelimiters!==!1&&j.push(C),j.push(R),n.alignDelimiters!==!1&&j.push(P),n.padding!==!1&&j.push(" "),(n.delimiterEnd!==!1||v!==p-1)&&j.push("|")}_.push(n.delimiterEnd===!1?j.join("").replace(/ +$/,""):j.join(""))}return _.join(`
|
|
80
|
+
`)}function rM(e){return e==null?"":String(e)}function t5(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 iM(e,t,n,i){const l=n.enter("blockquote"),c=n.createTracker(i);c.move("> "),c.shift(2);const u=n.indentLines(n.containerFlow(e,c.current()),sM);return l(),u}function sM(e,t,n){return">"+(n?"":" ")+e}function aM(e,t){return n5(e,t.inConstruct,!0)&&!n5(e,t.notInConstruct,!1)}function n5(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let i=-1;for(;++i<t.length;)if(e.includes(t[i]))return!0;return!1}function r5(e,t,n,i){let l=-1;for(;++l<n.unsafe.length;)if(n.unsafe[l].character===`
|
|
81
|
+
`&&aM(n.stack,n.unsafe[l]))return/[ \t]/.test(i.before)?"":" ";return`\\
|
|
82
|
+
`}function lM(e,t){const n=String(e);let i=n.indexOf(t),l=i,c=0,u=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;i!==-1;)i===l?++c>u&&(u=c):c=1,l=i+t.length,i=n.indexOf(t,l);return u}function oM(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 cM(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 uM(e,t,n,i){const l=cM(n),c=e.value||"",u=l==="`"?"GraveAccent":"Tilde";if(oM(e,n)){const v=n.enter("codeIndented"),y=n.indentLines(c,dM);return v(),y}const f=n.createTracker(i),h=l.repeat(Math.max(lM(c,l)+1,3)),p=n.enter("codeFenced");let g=f.move(h);if(e.lang){const v=n.enter(`codeFencedLang${u}`);g+=f.move(n.safe(e.lang,{before:g,after:" ",encode:["`"],...f.current()})),v()}if(e.lang&&e.meta){const v=n.enter(`codeFencedMeta${u}`);g+=f.move(" "),g+=f.move(n.safe(e.meta,{before:g,after:`
|
|
83
|
+
`,encode:["`"],...f.current()})),v()}return g+=f.move(`
|
|
84
|
+
`),c&&(g+=f.move(c+`
|
|
85
|
+
`)),g+=f.move(h),p(),g}function dM(e,t,n){return(n?"":" ")+e}function Kg(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 fM(e,t,n,i){const l=Kg(n),c=l==='"'?"Quote":"Apostrophe",u=n.enter("definition");let f=n.enter("label");const h=n.createTracker(i);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?" ":`
|
|
86
|
+
`,...h.current()}))),f(),e.title&&(f=n.enter(`title${c}`),p+=h.move(" "+l),p+=h.move(n.safe(e.title,{before:p,after:l,...h.current()})),p+=h.move(l),f()),u(),p}function hM(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 fc(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Od(e,t,n){const i=hl(e),l=hl(t);return i===void 0?l===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:l===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:i===1?l===void 0?{inside:!1,outside:!1}:l===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:l===void 0?{inside:!1,outside:!1}:l===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Ww.peek=pM;function Ww(e,t,n,i){const l=hM(n),c=n.enter("emphasis"),u=n.createTracker(i),f=u.move(l);let h=u.move(n.containerPhrasing(e,{after:l,before:f,...u.current()}));const p=h.charCodeAt(0),g=Od(i.before.charCodeAt(i.before.length-1),p,l);g.inside&&(h=fc(p)+h.slice(1));const v=h.charCodeAt(h.length-1),y=Od(i.after.charCodeAt(0),v,l);y.inside&&(h=h.slice(0,-1)+fc(v));const b=u.move(l);return c(),n.attentionEncodeSurroundingInfo={after:y.outside,before:g.outside},f+h+b}function pM(e,t,n){return n.options.emphasis||"*"}function mM(e,t){let n=!1;return Wg(e,function(i){if("value"in i&&/\r?\n|\r/.test(i.value)||i.type==="break")return n=!0,sg}),!!((!e.depth||e.depth<3)&&Fg(e)&&(t.options.setext||n))}function gM(e,t,n,i){const l=Math.max(Math.min(6,e.depth||1),1),c=n.createTracker(i);if(mM(e,n)){const g=n.enter("headingSetext"),v=n.enter("phrasing"),y=n.containerPhrasing(e,{...c.current(),before:`
|
|
87
|
+
`,after:`
|
|
88
|
+
`});return v(),g(),y+`
|
|
89
|
+
`+(l===1?"=":"-").repeat(y.length-(Math.max(y.lastIndexOf("\r"),y.lastIndexOf(`
|
|
90
|
+
`))+1))}const u="#".repeat(l),f=n.enter("headingAtx"),h=n.enter("phrasing");c.move(u+" ");let p=n.containerPhrasing(e,{before:"# ",after:`
|
|
91
|
+
`,...c.current()});return/^[\t ]/.test(p)&&(p=fc(p.charCodeAt(0))+p.slice(1)),p=p?u+" "+p:u,n.options.closeAtx&&(p+=" "+u),h(),f(),p}Xw.peek=xM;function Xw(e){return e.value||""}function xM(){return"<"}Qw.peek=vM;function Qw(e,t,n,i){const l=Kg(n),c=l==='"'?"Quote":"Apostrophe",u=n.enter("image");let f=n.enter("label");const h=n.createTracker(i);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${c}`),p+=h.move(" "+l),p+=h.move(n.safe(e.title,{before:p,after:l,...h.current()})),p+=h.move(l),f()),p+=h.move(")"),u(),p}function vM(){return"!"}Kw.peek=bM;function Kw(e,t,n,i){const l=e.referenceType,c=n.enter("imageReference");let u=n.enter("label");const f=n.createTracker(i);let h=f.move("![");const p=n.safe(e.alt,{before:h,after:"]",...f.current()});h+=f.move(p+"]["),u();const g=n.stack;n.stack=[],u=n.enter("reference");const v=n.safe(n.associationId(e),{before:h,after:"]",...f.current()});return u(),n.stack=g,c(),l==="full"||!p||p!==v?h+=f.move(v+"]"):l==="shortcut"?h=h.slice(0,-1):h+=f.move("]"),h}function bM(){return"!"}Zw.peek=yM;function Zw(e,t,n){let i=e.value||"",l="`",c=-1;for(;new RegExp("(^|[^`])"+l+"([^`]|$)").test(i);)l+="`";for(/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^`|`$/.test(i))&&(i=" "+i+" ");++c<n.unsafe.length;){const u=n.unsafe[c],f=n.compilePattern(u);let h;if(u.atBreak)for(;h=f.exec(i);){let p=h.index;i.charCodeAt(p)===10&&i.charCodeAt(p-1)===13&&p--,i=i.slice(0,p)+" "+i.slice(h.index+1)}}return l+i+l}function yM(){return"`"}function Jw(e,t){const n=Fg(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))}e2.peek=_M;function e2(e,t,n,i){const l=Kg(n),c=l==='"'?"Quote":"Apostrophe",u=n.createTracker(i);let f,h;if(Jw(e,n)){const g=n.stack;n.stack=[],f=n.enter("autolink");let v=u.move("<");return v+=u.move(n.containerPhrasing(e,{before:v,after:">",...u.current()})),v+=u.move(">"),f(),n.stack=g,v}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${c}`),p+=u.move(" "+l),p+=u.move(n.safe(e.title,{before:p,after:l,...u.current()})),p+=u.move(l),h()),p+=u.move(")"),f(),p}function _M(e,t,n){return Jw(e,n)?"<":"["}t2.peek=wM;function t2(e,t,n,i){const l=e.referenceType,c=n.enter("linkReference");let u=n.enter("label");const f=n.createTracker(i);let h=f.move("[");const p=n.containerPhrasing(e,{before:h,after:"]",...f.current()});h+=f.move(p+"]["),u();const g=n.stack;n.stack=[],u=n.enter("reference");const v=n.safe(n.associationId(e),{before:h,after:"]",...f.current()});return u(),n.stack=g,c(),l==="full"||!p||p!==v?h+=f.move(v+"]"):l==="shortcut"?h=h.slice(0,-1):h+=f.move("]"),h}function wM(){return"["}function Zg(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 kM(e){const t=Zg(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 SM(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 n2(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 jM(e,t,n,i){const l=n.enter("list"),c=n.bulletCurrent;let u=e.ordered?SM(n):Zg(n);const f=e.ordered?u==="."?")":".":kM(n);let h=t&&n.bulletLastUsed?u===n.bulletLastUsed:!1;if(!e.ordered){const g=e.children?e.children[0]:void 0;if((u==="*"||u==="-")&&g&&(!g.children||!g.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(h=!0),n2(n)===u&&g){let v=-1;for(;++v<e.children.length;){const y=e.children[v];if(y&&y.type==="listItem"&&y.children&&y.children[0]&&y.children[0].type==="thematicBreak"){h=!0;break}}}}h&&(u=f),n.bulletCurrent=u;const p=n.containerFlow(e,i);return n.bulletLastUsed=u,n.bulletCurrent=c,l(),p}function NM(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 CM(e,t,n,i){const l=NM(n);let c=n.bulletCurrent||Zg(n);t&&t.type==="list"&&t.ordered&&(c=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+c);let u=c.length+1;(l==="tab"||l==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(u=Math.ceil(u/4)*4);const f=n.createTracker(i);f.move(c+" ".repeat(u-c.length)),f.shift(u);const h=n.enter("listItem"),p=n.indentLines(n.containerFlow(e,f.current()),g);return h(),p;function g(v,y,b){return y?(b?"":" ".repeat(u))+v:(b?c:c+" ".repeat(u-c.length))+v}}function EM(e,t,n,i){const l=n.enter("paragraph"),c=n.enter("phrasing"),u=n.containerPhrasing(e,i);return c(),l(),u}const TM=Yd(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function AM(e,t,n,i){return(e.children.some(function(u){return TM(u)})?n.containerPhrasing:n.containerFlow).call(n,e,i)}function MM(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}r2.peek=RM;function r2(e,t,n,i){const l=MM(n),c=n.enter("strong"),u=n.createTracker(i),f=u.move(l+l);let h=u.move(n.containerPhrasing(e,{after:l,before:f,...u.current()}));const p=h.charCodeAt(0),g=Od(i.before.charCodeAt(i.before.length-1),p,l);g.inside&&(h=fc(p)+h.slice(1));const v=h.charCodeAt(h.length-1),y=Od(i.after.charCodeAt(0),v,l);y.inside&&(h=h.slice(0,-1)+fc(v));const b=u.move(l+l);return c(),n.attentionEncodeSurroundingInfo={after:y.outside,before:g.outside},f+h+b}function RM(e,t,n){return n.options.strong||"*"}function DM(e,t,n,i){return n.safe(e.value,i)}function zM(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 LM(e,t,n){const i=(n2(n)+(n.options.ruleSpaces?" ":"")).repeat(zM(n));return n.options.ruleSpaces?i.slice(0,-1):i}const i2={blockquote:iM,break:r5,code:uM,definition:fM,emphasis:Ww,hardBreak:r5,heading:gM,html:Xw,image:Qw,imageReference:Kw,inlineCode:Zw,link:e2,linkReference:t2,list:jM,listItem:CM,paragraph:EM,root:AM,strong:r2,text:DM,thematicBreak:LM};function OM(){return{enter:{table:BM,tableData:i5,tableHeader:i5,tableRow:PM},exit:{codeText:UM,table:$M,tableData:Kp,tableHeader:Kp,tableRow:Kp}}}function BM(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 $M(e){this.exit(e),this.data.inTable=void 0}function PM(e){this.enter({type:"tableRow",children:[]},e)}function Kp(e){this.exit(e)}function i5(e){this.enter({type:"tableCell",children:[]},e)}function UM(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,FM));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function FM(e,t){return t==="|"?t:e}function HM(e){const t=e||{},n=t.tableCellPadding,i=t.tablePipeAlign,l=t.stringLength,c=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
92
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:y,table:u,tableCell:h,tableRow:f}};function u(b,_,S,T){return p(g(b,S,T),b.align)}function f(b,_,S,T){const j=v(b,S,T),R=p([j]);return R.slice(0,R.indexOf(`
|
|
93
|
+
`))}function h(b,_,S,T){const j=S.enter("tableCell"),R=S.enter("phrasing"),C=S.containerPhrasing(b,{...T,before:c,after:c});return R(),j(),C}function p(b,_){return nM(b,{align:_,alignDelimiters:i,padding:n,stringLength:l})}function g(b,_,S){const T=b.children;let j=-1;const R=[],C=_.enter("table");for(;++j<T.length;)R[j]=v(T[j],_,S);return C(),R}function v(b,_,S){const T=b.children;let j=-1;const R=[],C=_.enter("tableRow");for(;++j<T.length;)R[j]=h(T[j],b,_,S);return C(),R}function y(b,_,S){let T=i2.inlineCode(b,_,S);return S.stack.includes("tableCell")&&(T=T.replace(/\|/g,"\\$&")),T}}function qM(){return{exit:{taskListCheckValueChecked:s5,taskListCheckValueUnchecked:s5,paragraph:VM}}}function IM(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:GM}}}function s5(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function VM(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const i=n.children[0];if(i&&i.type==="text"){const l=t.children;let c=-1,u;for(;++c<l.length;){const f=l[c];if(f.type==="paragraph"){u=f;break}}u===n&&(i.value=i.value.slice(1),i.value.length===0?n.children.shift():n.position&&i.position&&typeof i.position.start.offset=="number"&&(i.position.start.column++,i.position.start.offset++,n.position.start=Object.assign({},i.position.start)))}}this.exit(e)}function GM(e,t,n,i){const l=e.children[0],c=typeof e.checked=="boolean"&&l&&l.type==="paragraph",u="["+(e.checked?"x":" ")+"] ",f=n.createTracker(i);c&&f.move(u);let h=i2.listItem(e,t,n,{...i,...f.current()});return c&&(h=h.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,p)),h;function p(g){return g+u}}function YM(){return[jA(),GA(),QA(),OM(),qM()]}function WM(e){return{extensions:[NA(),YA(e),KA(),HM(e),IM()]}}const XM={tokenize:t8,partial:!0},s2={tokenize:n8,partial:!0},a2={tokenize:r8,partial:!0},l2={tokenize:i8,partial:!0},QM={tokenize:s8,partial:!0},o2={name:"wwwAutolink",tokenize:JM,previous:u2},c2={name:"protocolAutolink",tokenize:e8,previous:d2},Mi={name:"emailAutolink",tokenize:ZM,previous:f2},ti={};function KM(){return{text:ti}}let Qs=48;for(;Qs<123;)ti[Qs]=Mi,Qs++,Qs===58?Qs=65:Qs===91&&(Qs=97);ti[43]=Mi;ti[45]=Mi;ti[46]=Mi;ti[95]=Mi;ti[72]=[Mi,c2];ti[104]=[Mi,c2];ti[87]=[Mi,o2];ti[119]=[Mi,o2];function ZM(e,t,n){const i=this;let l,c;return u;function u(v){return!cg(v)||!f2.call(i,i.previous)||Jg(i.events)?n(v):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(v))}function f(v){return cg(v)?(e.consume(v),f):v===64?(e.consume(v),h):n(v)}function h(v){return v===46?e.check(QM,g,p)(v):v===45||v===95||An(v)?(c=!0,e.consume(v),h):g(v)}function p(v){return e.consume(v),l=!0,h}function g(v){return c&&l&&On(i.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(v)):n(v)}}function JM(e,t,n){const i=this;return l;function l(u){return u!==87&&u!==119||!u2.call(i,i.previous)||Jg(i.events)?n(u):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(XM,e.attempt(s2,e.attempt(a2,c),n),n)(u))}function c(u){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(u)}}function e8(e,t,n){const i=this;let l="",c=!1;return u;function u(v){return(v===72||v===104)&&d2.call(i,i.previous)&&!Jg(i.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),l+=String.fromCodePoint(v),e.consume(v),f):n(v)}function f(v){if(On(v)&&l.length<5)return l+=String.fromCodePoint(v),e.consume(v),f;if(v===58){const y=l.toLowerCase();if(y==="http"||y==="https")return e.consume(v),h}return n(v)}function h(v){return v===47?(e.consume(v),c?p:(c=!0,h)):n(v)}function p(v){return v===null||Dd(v)||Tt(v)||ia(v)||Id(v)?n(v):e.attempt(s2,e.attempt(a2,g),n)(v)}function g(v){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(v)}}function t8(e,t,n){let i=0;return l;function l(u){return(u===87||u===119)&&i<3?(i++,e.consume(u),l):u===46&&i===3?(e.consume(u),c):n(u)}function c(u){return u===null?n(u):t(u)}}function n8(e,t,n){let i,l,c;return u;function u(p){return p===46||p===95?e.check(l2,h,f)(p):p===null||Tt(p)||ia(p)||p!==45&&Id(p)?h(p):(c=!0,e.consume(p),u)}function f(p){return p===95?i=!0:(l=i,i=void 0),e.consume(p),u}function h(p){return l||i||!c?n(p):t(p)}}function r8(e,t){let n=0,i=0;return l;function l(u){return u===40?(n++,e.consume(u),l):u===41&&i<n?c(u):u===33||u===34||u===38||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===60||u===63||u===93||u===95||u===126?e.check(l2,t,c)(u):u===null||Tt(u)||ia(u)?t(u):(e.consume(u),l)}function c(u){return u===41&&i++,e.consume(u),l}}function i8(e,t,n){return i;function i(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),i):f===38?(e.consume(f),c):f===93?(e.consume(f),l):f===60||f===null||Tt(f)||ia(f)?t(f):n(f)}function l(f){return f===null||f===40||f===91||Tt(f)||ia(f)?t(f):i(f)}function c(f){return On(f)?u(f):n(f)}function u(f){return f===59?(e.consume(f),i):On(f)?(e.consume(f),u):n(f)}}function s8(e,t,n){return i;function i(c){return e.consume(c),l}function l(c){return An(c)?n(c):t(c)}}function u2(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Tt(e)}function d2(e){return!On(e)}function f2(e){return!(e===47||cg(e))}function cg(e){return e===43||e===45||e===46||e===95||An(e)}function Jg(e){let t=e.length,n=!1;for(;t--;){const i=e[t][1];if((i.type==="labelLink"||i.type==="labelImage")&&!i._balanced){n=!0;break}if(i._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const a8={tokenize:p8,partial:!0};function l8(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:d8,continuation:{tokenize:f8},exit:h8}},text:{91:{name:"gfmFootnoteCall",tokenize:u8},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:o8,resolveTo:c8}}}}function o8(e,t,n){const i=this;let l=i.events.length;const c=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let u;for(;l--;){const h=i.events[l][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=Or(i.sliceSerialize({start:u.end,end:i.now()}));return p.codePointAt(0)!==94||!c.includes(p.slice(1))?n(h):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),t(h))}}function c8(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const i={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},l={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};l.end.column++,l.end.offset++,l.end._bufferIndex++;const c={type:"gfmFootnoteCallString",start:Object.assign({},l.end),end:Object.assign({},e[e.length-1][1].start)},u={type:"chunkString",contentType:"string",start:Object.assign({},c.start),end:Object.assign({},c.end)},f=[e[n+1],e[n+2],["enter",i,t],e[n+3],e[n+4],["enter",l,t],["exit",l,t],["enter",c,t],["enter",u,t],["exit",u,t],["exit",c,t],e[e.length-2],e[e.length-1],["exit",i,t]];return e.splice(n,e.length-n+1,...f),e}function u8(e,t,n){const i=this,l=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let c=0,u;return f;function f(v){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(v),e.exit("gfmFootnoteCallLabelMarker"),h}function h(v){return v!==94?n(v):(e.enter("gfmFootnoteCallMarker"),e.consume(v),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",p)}function p(v){if(c>999||v===93&&!u||v===null||v===91||Tt(v))return n(v);if(v===93){e.exit("chunkString");const y=e.exit("gfmFootnoteCallString");return l.includes(Or(i.sliceSerialize(y)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(v),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(v)}return Tt(v)||(u=!0),c++,e.consume(v),v===92?g:p}function g(v){return v===91||v===92||v===93?(e.consume(v),c++,p):p(v)}}function d8(e,t,n){const i=this,l=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let c,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",g):n(_)}function g(_){if(u>999||_===93&&!f||_===null||_===91||Tt(_))return n(_);if(_===93){e.exit("chunkString");const S=e.exit("gfmFootnoteDefinitionLabelString");return c=Or(i.sliceSerialize(S)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(_),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),y}return Tt(_)||(f=!0),u++,e.consume(_),_===92?v:g}function v(_){return _===91||_===92||_===93?(e.consume(_),u++,g):g(_)}function y(_){return _===58?(e.enter("definitionMarker"),e.consume(_),e.exit("definitionMarker"),l.includes(c)||l.push(c),dt(e,b,"gfmFootnoteDefinitionWhitespace")):n(_)}function b(_){return t(_)}}function f8(e,t,n){return e.check(vc,t,e.attempt(a8,t,n))}function h8(e){e.exit("gfmFootnoteDefinition")}function p8(e,t,n){const i=this;return dt(e,l,"gfmFootnoteDefinitionIndent",5);function l(c){const u=i.events[i.events.length-1];return u&&u[1].type==="gfmFootnoteDefinitionIndent"&&u[2].sliceSerialize(u[1],!0).length===4?t(c):n(c)}}function m8(e){let n=(e||{}).singleTilde;const i={name:"strikethrough",tokenize:c,resolveAll:l};return n==null&&(n=!0),{text:{126:i},insideSpan:{null:[i]},attentionMarkers:{null:[126]}};function l(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 g={type:"strikethrough",start:Object.assign({},u[p][1].start),end:Object.assign({},u[h][1].end)},v={type:"strikethroughText",start:Object.assign({},u[p][1].end),end:Object.assign({},u[h][1].start)},y=[["enter",g,f],["enter",u[p][1],f],["exit",u[p][1],f],["enter",v,f]],b=f.parser.constructs.insideSpan.null;b&&ur(y,y.length,0,Vd(b,u.slice(p+1,h),f)),ur(y,y.length,0,[["exit",v,f],["enter",u[h][1],f],["exit",u[h][1],f],["exit",g,f]]),ur(u,p-1,h-p+3,y),h=p+y.length-2;break}}for(h=-1;++h<u.length;)u[h][1].type==="strikethroughSequenceTemporary"&&(u[h][1].type="data");return u}function c(u,f,h){const p=this.previous,g=this.events;let v=0;return y;function y(_){return p===126&&g[g.length-1][1].type!=="characterEscape"?h(_):(u.enter("strikethroughSequenceTemporary"),b(_))}function b(_){const S=hl(p);if(_===126)return v>1?h(_):(u.consume(_),v++,b);if(v<2&&!n)return h(_);const T=u.exit("strikethroughSequenceTemporary"),j=hl(_);return T._open=!j||j===2&&!!S,T._close=!S||S===2&&!!j,f(_)}}}class g8{constructor(){this.map=[]}add(t,n,i){x8(this,t,n,i)}consume(t){if(this.map.sort(function(c,u){return c[0]-u[0]}),this.map.length===0)return;let n=this.map.length;const i=[];for(;n>0;)n-=1,i.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];i.push(t.slice()),t.length=0;let l=i.pop();for(;l;){for(const c of l)t.push(c);l=i.pop()}this.map.length=0}}function x8(e,t,n,i){let l=0;if(!(n===0&&i.length===0)){for(;l<e.map.length;){if(e.map[l][0]===t){e.map[l][1]+=n,e.map[l][2].push(...i);return}l+=1}e.map.push([t,n,i])}}function v8(e,t){let n=!1;const i=[];for(;t<e.length;){const l=e[t];if(n){if(l[0]==="enter")l[1].type==="tableContent"&&i.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(l[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const c=i.length-1;i[c]=i[c]==="left"?"center":"right"}}else if(l[1].type==="tableDelimiterRow")break}else l[0]==="enter"&&l[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return i}function b8(){return{flow:{null:{name:"table",tokenize:y8,resolveAll:_8}}}}function y8(e,t,n){const i=this;let l=0,c=0,u;return f;function f(L){let q=i.events.length-1;for(;q>-1;){const K=i.events[q][1].type;if(K==="lineEnding"||K==="linePrefix")q--;else break}const E=q>-1?i.events[q][1].type:null,ae=E==="tableHead"||E==="tableRow"?D:h;return ae===D&&i.parser.lazy[i.now().line]?n(L):ae(L)}function h(L){return e.enter("tableHead"),e.enter("tableRow"),p(L)}function p(L){return L===124||(u=!0,c+=1),g(L)}function g(L){return L===null?n(L):$e(L)?c>1?(c=0,i.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),b):n(L):it(L)?dt(e,g,"whitespace")(L):(c+=1,u&&(u=!1,l+=1),L===124?(e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),u=!0,g):(e.enter("data"),v(L)))}function v(L){return L===null||L===124||Tt(L)?(e.exit("data"),g(L)):(e.consume(L),L===92?y:v)}function y(L){return L===92||L===124?(e.consume(L),v):v(L)}function b(L){return i.interrupt=!1,i.parser.lazy[i.now().line]?n(L):(e.enter("tableDelimiterRow"),u=!1,it(L)?dt(e,_,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):_(L))}function _(L){return L===45||L===58?T(L):L===124?(u=!0,e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),S):z(L)}function S(L){return it(L)?dt(e,T,"whitespace")(L):T(L)}function T(L){return L===58?(c+=1,u=!0,e.enter("tableDelimiterMarker"),e.consume(L),e.exit("tableDelimiterMarker"),j):L===45?(c+=1,j(L)):L===null||$e(L)?P(L):z(L)}function j(L){return L===45?(e.enter("tableDelimiterFiller"),R(L)):z(L)}function R(L){return L===45?(e.consume(L),R):L===58?(u=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(L),e.exit("tableDelimiterMarker"),C):(e.exit("tableDelimiterFiller"),C(L))}function C(L){return it(L)?dt(e,P,"whitespace")(L):P(L)}function P(L){return L===124?_(L):L===null||$e(L)?!u||l!==c?z(L):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(L)):z(L)}function z(L){return n(L)}function D(L){return e.enter("tableRow"),F(L)}function F(L){return L===124?(e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),F):L===null||$e(L)?(e.exit("tableRow"),t(L)):it(L)?dt(e,F,"whitespace")(L):(e.enter("data"),B(L))}function B(L){return L===null||L===124||Tt(L)?(e.exit("data"),F(L)):(e.consume(L),L===92?I:B)}function I(L){return L===92||L===124?(e.consume(L),B):B(L)}}function _8(e,t){let n=-1,i=!0,l=0,c=[0,0,0,0],u=[0,0,0,0],f=!1,h=0,p,g,v;const y=new g8;for(;++n<e.length;){const b=e[n],_=b[1];b[0]==="enter"?_.type==="tableHead"?(f=!1,h!==0&&(a5(y,t,h,p,g),g=void 0,h=0),p={type:"table",start:Object.assign({},_.start),end:Object.assign({},_.end)},y.add(n,0,[["enter",p,t]])):_.type==="tableRow"||_.type==="tableDelimiterRow"?(i=!0,v=void 0,c=[0,0,0,0],u=[0,n+1,0,0],f&&(f=!1,g={type:"tableBody",start:Object.assign({},_.start),end:Object.assign({},_.end)},y.add(n,0,[["enter",g,t]])),l=_.type==="tableDelimiterRow"?2:g?3:1):l&&(_.type==="data"||_.type==="tableDelimiterMarker"||_.type==="tableDelimiterFiller")?(i=!1,u[2]===0&&(c[1]!==0&&(u[0]=u[1],v=Ku(y,t,c,l,void 0,v),c=[0,0,0,0]),u[2]=n)):_.type==="tableCellDivider"&&(i?i=!1:(c[1]!==0&&(u[0]=u[1],v=Ku(y,t,c,l,void 0,v)),c=u,u=[c[1],n,0,0])):_.type==="tableHead"?(f=!0,h=n):_.type==="tableRow"||_.type==="tableDelimiterRow"?(h=n,c[1]!==0?(u[0]=u[1],v=Ku(y,t,c,l,n,v)):u[1]!==0&&(v=Ku(y,t,u,l,n,v)),l=0):l&&(_.type==="data"||_.type==="tableDelimiterMarker"||_.type==="tableDelimiterFiller")&&(u[3]=n)}for(h!==0&&a5(y,t,h,p,g),y.consume(t.events),n=-1;++n<t.events.length;){const b=t.events[n];b[0]==="enter"&&b[1].type==="table"&&(b[1]._align=v8(t.events,n))}return e}function Ku(e,t,n,i,l,c){const u=i===1?"tableHeader":i===2?"tableDelimiter":"tableData",f="tableContent";n[0]!==0&&(c.end=Object.assign({},tl(t.events,n[0])),e.add(n[0],0,[["exit",c,t]]));const h=tl(t.events,n[1]);if(c={type:u,start:Object.assign({},h),end:Object.assign({},h)},e.add(n[1],0,[["enter",c,t]]),n[2]!==0){const p=tl(t.events,n[2]),g=tl(t.events,n[3]),v={type:f,start:Object.assign({},p),end:Object.assign({},g)};if(e.add(n[2],0,[["enter",v,t]]),i!==2){const y=t.events[n[2]],b=t.events[n[3]];if(y[1].end=Object.assign({},b[1].end),y[1].type="chunkText",y[1].contentType="text",n[3]>n[2]+1){const _=n[2]+1,S=n[3]-n[2]-1;e.add(_,S,[])}}e.add(n[3]+1,0,[["exit",v,t]])}return l!==void 0&&(c.end=Object.assign({},tl(t.events,l)),e.add(l,0,[["exit",c,t]]),c=void 0),c}function a5(e,t,n,i,l){const c=[],u=tl(t.events,n);l&&(l.end=Object.assign({},u),c.push(["exit",l,t])),i.end=Object.assign({},u),c.push(["exit",i,t]),e.add(n+1,0,c)}function tl(e,t){const n=e[t],i=n[0]==="enter"?"start":"end";return n[1][i]}const w8={name:"tasklistCheck",tokenize:S8};function k8(){return{text:{91:w8}}}function S8(e,t,n){const i=this;return l;function l(h){return i.previous!==null||!i._gfmTasklistFirstContentOfListItem?n(h):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(h),e.exit("taskListCheckMarker"),c)}function c(h){return Tt(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 $e(h)?t(h):it(h)?e.check({tokenize:j8},t,n)(h):n(h)}}function j8(e,t,n){return dt(e,i,"whitespace");function i(l){return l===null?n(l):t(l)}}function N8(e){return kw([KM(),l8(),m8(e),b8(),k8()])}const C8={};function ex(e){const t=this,n=e||C8,i=t.data(),l=i.micromarkExtensions||(i.micromarkExtensions=[]),c=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),u=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);l.push(N8(n)),c.push(YM()),u.push(WM(n))}const E8=1500;async function T8(e){var i;try{if(typeof navigator<"u"&&((i=navigator.clipboard)!=null&&i.writeText))return await navigator.clipboard.writeText(e),!0}catch{}if(typeof document>"u")return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();let n=!1;try{n=document.execCommand("copy")}catch{n=!1}return document.body.removeChild(t),n}function tx({text:e,label:t="Copy",className:n=""}){const[i,l]=k.useState(!1),c=k.useRef(null);k.useEffect(()=>()=>{c.current&&clearTimeout(c.current)},[]);const u=async()=>{await T8(e)&&(l(!0),c.current&&clearTimeout(c.current),c.current=setTimeout(()=>l(!1),E8))},f=i?"Copied":t;return a.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:i?a.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:a.jsx("path",{d:"M3.5 8.5l3 3 6-7"})}):a.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:[a.jsx("rect",{x:"5",y:"5",width:"8",height:"9",rx:"1.25"}),a.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 Bd=25*1024*1024,$d=100*1024*1024;function h2(e){return new Promise((t,n)=>{const i=new FileReader;i.onload=()=>{const c=i.result.split(",")[1],u=e.type||"application/octet-stream";t({base64:c,mediaType:u})},i.onerror=n,i.readAsDataURL(e)})}function ms(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 p2(e){return e.startsWith("image/")}function m2({name:e,mediaType:t}){const n=(e.split(".").pop()||"").toLowerCase();let i="FILE";return t==="application/pdf"||n==="pdf"?i="PDF":["zip","tar","gz","tgz","bz2","xz","7z","rar"].includes(n)?i="ZIP":["csv","tsv"].includes(n)?i="CSV":["json","yaml","yml","toml","xml"].includes(n)?i="DATA":["md","txt","log"].includes(n)?i="TXT":["doc","docx","rtf","odt"].includes(n)?i="DOC":["xls","xlsx","ods"].includes(n)?i="XLS":["mp3","wav","ogg","flac","m4a"].includes(n)?i="AUD":["mp4","mov","webm","mkv","avi"].includes(n)?i="VID":n&&(i=n.slice(0,4).toUpperCase()),a.jsxs("div",{className:"flex flex-col items-center justify-center w-full h-full bg-cc-hover/60 text-cc-muted",children:[a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.2",className:"w-4 h-4 mb-0.5",children:[a.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"}),a.jsx("path",{d:"M9.5 1.75V5.25H13"})]}),a.jsx("span",{className:"text-[8px] font-mono-code tracking-tight",children:i})]})}function g2({name:e,mediaType:t,base64:n,size:i,onRemove:l,className:c="w-12 h-12"}){const u=p2(t);return a.jsxs("div",{className:"relative group",title:`${e} (${ms(i)})`,children:[a.jsx("div",{className:`${c} rounded-lg overflow-hidden border border-cc-border`,children:u?a.jsx("img",{src:`data:${t};base64,${n}`,alt:e,className:"w-full h-full object-cover"}):a.jsx(m2,{name:e,mediaType:t})}),l&&a.jsx("button",{onClick:l,"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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})})]})}function A8({name:e,mediaType:t,data:n,size:i}){return p2(t)?a.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"}):a.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:[a.jsx("div",{className:"w-8 h-8 shrink-0 rounded-md overflow-hidden",children:a.jsx(m2,{name:e,mediaType:t})}),a.jsxs("div",{className:"min-w-0 flex flex-col",children:[a.jsx("span",{className:"text-[12px] font-medium text-cc-fg truncate",children:e||"attachment"}),a.jsx("span",{className:"text-[10px] text-cc-muted",children:ms(i)})]})]})}function ug(e){var t;return e==null||typeof e=="boolean"?"":typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(ug).join(""):typeof e=="object"&&e!==null&&"props"in e?ug((t=e.props)==null?void 0:t.children):""}function M8({message:e}){return e.role==="system"?a.jsxs("div",{className:"flex items-center gap-3 py-1 min-w-0",children:[a.jsx("div",{className:"shrink-0 flex-1 h-px bg-cc-border"}),a.jsx("span",{className:"text-[11px] text-cc-muted italic font-mono-code px-1 min-w-0 break-words text-center",children:e.content}),a.jsx("div",{className:"shrink-0 flex-1 h-px bg-cc-border"})]}):e.role==="user"?a.jsx("div",{className:"flex justify-end animate-[userSlideIn_0.3s_ease-out]",children:a.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&&a.jsx("div",{className:"flex gap-2 flex-wrap mb-2",children:e.attachments.map((t,n)=>a.jsx(A8,{name:t.name,mediaType:t.media_type,data:t.data,size:t.size},n))}),a.jsx("div",{className:"text-[13px] sm:text-[14px] leading-relaxed break-words",children:a.jsx(nx,{text:e.content})})]})}):a.jsx("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]",children:a.jsx(z8,{message:e})})}function R8(e){const t=[];for(const n of e)if(n.type==="tool_use"){const i=t[t.length-1];(i==null?void 0:i.kind)==="tool_group"&&i.name===n.name?i.items.push({id:n.id,name:n.name,input:n.input}):t.push({kind:"tool_group",name:n.name,items:[{id:n.id,name:n.name,input:n.input}]})}else t.push({kind:"content",block:n});return t}function D8(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 z8({message:e}){const t=e.contentBlocks||[],n=k.useMemo(()=>R8(t),[t]),i=k.useMemo(()=>D8(t),[t]);if(t.length===0&&e.content){const l=e.isStreaming&&e.streamingPhase==="thinking";return a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(l5,{}),a.jsx("div",{className:"flex-1 min-w-0",children:l?a.jsx(x2,{text:e.content}):a.jsx(nx,{text:e.content,showCursor:!!e.isStreaming})})]})}return a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(l5,{}),a.jsx("div",{className:"flex-1 min-w-0 space-y-3",children:n.map((l,c)=>{if(l.kind==="content")return a.jsx(L8,{block:l.block,toolUseById:i},c);if(l.items.length===1){const u=l.items[0];return a.jsx(L5,{name:u.name,input:u.input,toolUseId:u.id},c)}return a.jsx(B8,{name:l.name,items:l.items},c)})})]})}function l5(){return a.jsx("div",{className:"w-6 h-6 rounded-full avatar-ring flex items-center justify-center shrink-0 mt-0.5",children:a.jsx("div",{className:"avatar-inner w-full h-full rounded-full flex items-center justify-center",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-primary",children:a.jsx("path",{d:"M8 2L10.5 6.5L15 8L10.5 9.5L8 14L5.5 9.5L1 8L5.5 6.5L8 2Z"})})})})}function nx({text:e,showCursor:t=!1}){return a.jsxs("div",{className:"markdown-body text-[14px] sm:text-[15px] text-cc-fg leading-relaxed overflow-hidden",children:[a.jsx(Qg,{remarkPlugins:[ex],components:{p:({children:n})=>a.jsx("p",{className:"mb-3 last:mb-0",children:n}),strong:({children:n})=>a.jsx("strong",{className:"font-semibold text-cc-fg",children:n}),em:({children:n})=>a.jsx("em",{className:"italic",children:n}),h1:({children:n})=>a.jsx("h1",{className:"text-xl font-bold text-cc-fg mt-4 mb-2",children:n}),h2:({children:n})=>a.jsx("h2",{className:"text-lg font-bold text-cc-fg mt-3 mb-2",children:n}),h3:({children:n})=>a.jsx("h3",{className:"text-base font-semibold text-cc-fg mt-3 mb-1",children:n}),ul:({children:n})=>a.jsx("ul",{className:"list-disc pl-5 mb-3 space-y-1",children:n}),ol:({children:n})=>a.jsx("ol",{className:"list-decimal pl-5 mb-3 space-y-1",children:n}),li:({children:n})=>a.jsx("li",{className:"text-cc-fg",children:n}),a:({href:n,children:i})=>a.jsx("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:"text-cc-primary hover:underline",children:i}),blockquote:({children:n})=>a.jsx("blockquote",{className:"border-l-2 border-cc-primary/30 pl-3 my-2 text-cc-muted italic",children:n}),hr:()=>a.jsx("hr",{className:"border-cc-border my-4"}),code:n=>{const{children:i,className:l}=n,c=/language-(\w+)/.exec(l||"");if(c||typeof i=="string"&&i.includes(`
|
|
94
|
+
`)){const f=(c==null?void 0:c[1])||"",h=ug(i);return a.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:[a.jsxs("div",{className:"px-3 py-1.5 bg-cc-code-bg border-b border-cc-border flex items-center gap-2",children:[a.jsxs("div",{className:"flex gap-1",children:[a.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-muted/20"}),a.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-muted/20"}),a.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-muted/20"})]}),f&&a.jsx("span",{className:"text-[10px] text-cc-muted/70 font-mono-code uppercase tracking-wider",children:f}),a.jsx(tx,{text:h,label:"Copy code",className:"ml-auto -mr-1"})]}),a.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:a.jsx("code",{children:i})})]})}return a.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:i})},pre:({children:n})=>a.jsx(a.Fragment,{children:n}),table:({children:n})=>a.jsx("div",{className:"overflow-x-auto my-2",children:a.jsx("table",{className:"min-w-full text-sm border border-cc-border rounded-lg overflow-hidden",children:n})}),thead:({children:n})=>a.jsx("thead",{className:"bg-cc-code-bg/50",children:n}),th:({children:n})=>a.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})=>a.jsx("td",{className:"px-3 py-1.5 text-xs text-cc-fg border-b border-cc-border",children:n})},children:e}),t&&a.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 L8({block:e,toolUseById:t}){if(e.type==="text")return a.jsx(nx,{text:e.text});if(e.type==="thinking")return a.jsx(x2,{text:e.thinking});if(e.type==="tool_use")return a.jsx(L5,{name:e.name,input:e.input,toolUseId:e.id});if(e.type==="tool_result"){const n=typeof e.content=="string"?e.content:JSON.stringify(e.content),i=t.get(e.tool_use_id),l=i==null?void 0:i.name,c=e.is_error??!1;return l==="Bash"?a.jsx(O8,{text:n,isError:c}):a.jsxs("div",{className:"relative rounded-lg bg-cc-code-bg overflow-hidden",children:[a.jsx(tx,{text:n,label:"Copy output",className:"absolute top-1 right-1 z-10 bg-cc-code-bg/80 backdrop-blur-sm"}),a.jsx("pre",{className:`text-[12px] font-mono-code px-3 py-2 whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto ${c?"text-cc-error":"text-cc-code-fg/60"}`,children:n})]})}return null}function O8({text:e,isError:t}){const n=e.split(/\r?\n/),i=n.length>20,[l,c]=k.useState(!1),u=l||!i?e:n.slice(-20).join(`
|
|
95
|
+
`);return a.jsxs("div",{className:"relative rounded-lg bg-cc-code-bg overflow-hidden",children:[a.jsx(tx,{text:e,label:"Copy output",className:"absolute top-1 right-1 z-10 bg-cc-code-bg/80 backdrop-blur-sm"}),a.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:u}),i&&a.jsxs("div",{className:"px-3 pb-1.5 flex items-center justify-between",children:[a.jsx("span",{className:`text-[10px] ${t?"text-cc-error/50":"text-cc-muted/40"}`,children:l?`${n.length} lines`:`last 20 of ${n.length}`}),a.jsx("button",{onClick:()=>c(!l),className:"text-[10px] text-cc-muted/40 hover:text-cc-muted/70 transition-colors cursor-pointer",children:l?"Show tail":"Show all"})]})]})}function B8({name:e,items:t}){const[n,i]=k.useState(!1),l=pc(e),c=gs(e);return a.jsxs("div",{className:"border border-cc-border rounded-[10px] overflow-hidden bg-cc-card tool-card",children:[a.jsxs("button",{onClick:()=>i(!n),className:"w-full flex items-center gap-2.5 px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:[a.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:a.jsx("path",{d:"M6 4l4 4-4 4"})}),a.jsx(ll,{type:l}),a.jsx("span",{className:"text-xs font-medium text-cc-fg",children:c}),a.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&&a.jsx("div",{className:"border-t border-cc-border px-3 py-1.5",children:t.map((u,f)=>{const h=Jo(u.name,u.input);return a.jsxs("div",{className:"flex items-center gap-2 py-1 text-xs text-cc-muted font-mono-code truncate",children:[a.jsx("span",{className:"w-1 h-1 rounded-full bg-cc-muted/40 shrink-0"}),a.jsx("span",{className:"truncate",children:h||JSON.stringify(u.input).slice(0,80)})]},u.id||f)})})]})}function x2({text:e}){const t=e.trim(),[n,i]=k.useState(!1),l=t.split(`
|
|
96
|
+
`),c=l.length>8||t.length>600,u=c&&!n?l.slice(0,8).join(`
|
|
97
|
+
`):t;return a.jsxs("div",{children:[a.jsx("div",{className:"markdown-body text-[13px] text-cc-fg/40 leading-relaxed italic",children:a.jsx(Qg,{remarkPlugins:[ex],components:{p:({children:f})=>a.jsx("p",{className:"mb-2 last:mb-0",children:f}),ul:({children:f})=>a.jsx("ul",{className:"list-disc pl-4 mb-2 space-y-0.5",children:f}),ol:({children:f})=>a.jsx("ol",{className:"list-decimal pl-4 mb-2 space-y-0.5",children:f}),li:({children:f})=>a.jsx("li",{children:f}),code:({children:f})=>a.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:f})},children:u||"No thinking text captured."})}),c&&!n&&a.jsx("button",{onClick:()=>i(!0),className:"text-[11px] text-cc-muted/40 hover:text-cc-muted/70 cursor-pointer transition-colors",children:"Show more"})]})}function Uo(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function $8(e){const t=Math.floor(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function o5(e){try{const t=new Date(e).getTime()-Date.now();return Number.isFinite(t)?t<=0?"now":P8(t):"N/A"}catch{return"N/A"}}function c5(e){const n=(e>0&&e<1e12?e*1e3:e)-Date.now();if(n<=0)return"now";const i=Math.floor(n/864e5),l=Math.floor(n%864e5/36e5),c=Math.floor(n%36e5/6e4);return i>0?`${i}d ${l}h`:l>0?`${l}h${c}m`:`${c}m`}function u5(e){return e>=1440?`${Math.round(e/1440)}d`:e>=60?`${Math.round(e/60)}h`:`${e}m`}function P8(e){const t=Math.floor(e/864e5),n=Math.floor(e%864e5/36e5),i=Math.floor(e%36e5/6e4);return t>0?`${t}d ${n}h${i}m`:n>0?`${n}h${i}m`:`${i}m`}function U8({tools:e}){return e.length===0?null:a.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)=>a.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[a.jsxs("span",{className:"relative flex items-center justify-center w-3.5 h-3.5",children:[a.jsx(ll,{type:pc(t.toolName)}),a.jsx("span",{className:"absolute inset-0 rounded-full bg-cc-primary/20 animate-[typing-breathe_1.5s_ease-in-out_infinite]"})]}),a.jsx("span",{className:"text-cc-fg/70",children:gs(t.toolName)}),a.jsxs("span",{className:"text-cc-muted/50 tabular-nums",children:[t.elapsedSeconds,"s"]})]},n))})}function F8({entries:e}){const[t,n]=k.useState(!1),i=k.useMemo(()=>{const l=e.reduce((h,p)=>h+p.elapsedSeconds,0),c=Math.max(...e.map(h=>h.elapsedSeconds),.1),u=e.filter(h=>h.isError).length,f=e.filter(h=>!h.completedAt).length;return{totalTime:l,maxTime:c,errorCount:u,running:f}},[e]);return e.length===0?null:a.jsxs("div",{className:"pl-10 pr-4 animate-[fadeSlideIn_0.3s_ease-out]",children:[a.jsxs("button",{onClick:()=>n(!t),className:"group flex items-center gap-2 text-[11px] text-cc-muted hover:text-cc-fg/80 transition-colors cursor-pointer py-1 w-full","aria-expanded":t,"aria-label":`${e.length} tools executed in ${i.totalTime.toFixed(1)}s`,children:[a.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:a.jsx("path",{d:"M6 4l4 4-4 4"})}),a.jsxs("span",{className:"font-mono-code flex items-center gap-1.5",children:[a.jsxs("span",{className:"text-cc-fg/60 font-medium",children:[e.length," tool",e.length>1?"s":""]}),a.jsx("span",{className:"text-cc-muted/40",children:"·"}),a.jsxs("span",{className:"tabular-nums",children:[i.totalTime.toFixed(1),"s"]}),i.errorCount>0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-cc-muted/40",children:"·"}),a.jsxs("span",{className:"text-cc-error",children:[i.errorCount," error",i.errorCount>1?"s":""]})]}),i.running>0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-cc-muted/40",children:"·"}),a.jsxs("span",{className:"text-cc-primary",children:[i.running," running"]})]})]}),!t&&e.length>1&&a.jsx("span",{className:"hidden sm:flex items-center gap-px ml-auto flex-shrink-0 h-1.5 max-w-[120px]",children:e.map(l=>a.jsx("span",{className:`h-full rounded-full ${l.isError?"bg-cc-error/40":l.completedAt?"bg-cc-success/30":"bg-cc-primary/40 animate-[typing-breathe_1.5s_ease-in-out_infinite]"}`,style:{width:`${Math.max(4,l.elapsedSeconds/i.maxTime*100)}%`,minWidth:"3px"},title:`${gs(l.toolName)} ${l.elapsedSeconds}s`},l.toolUseId))})]}),t&&a.jsx("div",{className:"mt-1 mb-2 space-y-1 animate-[fadeSlideIn_0.2s_ease-out]",children:e.map(l=>a.jsx(H8,{entry:l,maxTime:i.maxTime},l.toolUseId))})]})}function H8({entry:e,maxTime:t}){const n=Math.max(3,e.elapsedSeconds/t*100),i=!e.completedAt;return a.jsxs("div",{className:"flex items-center gap-2 text-[11px] font-mono-code group",children:[a.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${e.isError?"bg-cc-error":i?"bg-cc-primary animate-[typing-breathe_1.5s_ease-in-out_infinite]":"bg-cc-success/60"}`}),a.jsxs("span",{className:"flex items-center gap-1 shrink-0 w-[100px]",children:[a.jsx(ll,{type:pc(e.toolName)}),a.jsx("span",{className:"text-cc-fg/70 truncate",children:gs(e.toolName)})]}),a.jsx("span",{className:"flex-1 h-1 bg-cc-border/30 rounded-full overflow-hidden min-w-[40px]",children:a.jsx("span",{className:`block h-full rounded-full transition-all duration-500 ${e.isError?"bg-cc-error/50":i?"bg-cc-primary/50 animate-[typing-breathe_1.5s_ease-in-out_infinite]":"bg-cc-success/30"}`,style:{width:`${n}%`}})}),a.jsxs("span",{className:"text-cc-muted/60 tabular-nums shrink-0 w-[40px] text-right",children:[e.elapsedSeconds.toFixed(1),"s"]}),e.preview&&a.jsx("span",{className:"text-cc-muted/40 truncate max-w-[200px] hidden lg:inline",children:e.preview})]})}const Zu=100,q8=40,I8=120,Zp=new Map,V8=[],G8=[];function Y8(e){const t=e.split("/").filter(Boolean);return t.length===0?e:t.slice(-2).join("/")}function W8(e){if(e.role!=="assistant")return null;const t=e.contentBlocks;if(!t||t.length===0)return null;let n=null;for(const i of t){if(i.type==="text"&&i.text.trim()||i.type==="thinking")return null;if(i.type==="tool_use"){if(n===null)n=i.name;else if(n!==i.name)return null}}return n}function d5(e){return(e.contentBlocks||[]).filter(n=>n.type==="tool_use").map(n=>({id:n.id,name:n.name,input:n.input}))}function X8(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 v2(e){const t=[];for(const n of e){const i=W8(n);if(i){const l=t[t.length-1];if((l==null?void 0:l.kind)==="tool_msg_group"&&l.toolName===i){l.items.push(...d5(n));continue}t.push({kind:"tool_msg_group",toolName:i,items:d5(n),firstId:n.id})}else t.push({kind:"message",msg:n})}return t}function b2(e,t,n){const i=v2(e),l=[];for(const c of i){l.push(c);const u=X8(c);for(const f of u){const h=n.get(f);if(h&&h.length>0){const p=t.get(f)||{description:"Subagent",agentType:""},g=b2(h,t,n);l.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:g})}}}return l}function Q8(e){const t=new Map;for(const l of e)if(l.contentBlocks){for(const c of l.contentBlocks)if(c.type==="tool_use"&&c.name==="Task"){const{input:u,id:f}=c,h=Array.isArray(u==null?void 0:u.receiver_thread_ids)?u.receiver_thread_ids.filter(y=>typeof y=="string"&&y.length>0):void 0,p=h&&h.length>0?h.length:void 0,g=typeof(u==null?void 0:u.sender_thread_id)=="string"&&u.sender_thread_id.length>0?u.sender_thread_id:void 0,v=typeof(u==null?void 0:u.codex_status)=="string"||g!==void 0||p!==void 0;t.set(f,{description:String((u==null?void 0:u.description)||"Subagent"),agentType:String((u==null?void 0:u.subagent_type)||""),backend:v?"codex":"claude",status:typeof(u==null?void 0:u.codex_status)=="string"?u.codex_status:void 0,receiverCount:p,senderThreadId:g,receiverThreadIds:h})}}if(t.size===0)return v2(e);const n=new Map,i=[];for(const l of e)if(l.parentToolUseId&&t.has(l.parentToolUseId)){let c=n.get(l.parentToolUseId);c||(c=[],n.set(l.parentToolUseId,c)),c.push(l)}else i.push(l);return b2(i,t,n)}function K8({group:e}){const[t,n]=k.useState(!1),i=pc(e.toolName),l=gs(e.toolName),c=e.items.length;if(c===1){const u=e.items[0];return a.jsx("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(f5,{}),a.jsx("div",{className:"flex-1 min-w-0",children:a.jsxs("div",{className:"border border-cc-border rounded-[10px] overflow-hidden bg-cc-card tool-card",children:[a.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:[a.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:a.jsx("path",{d:"M6 4l4 4-4 4"})}),a.jsx(ll,{type:i}),a.jsx("span",{className:"text-xs font-medium text-cc-fg",children:l}),a.jsx("span",{className:"text-xs text-cc-muted truncate flex-1 font-mono-code",children:Jo(u.name,u.input)})]}),t&&a.jsx("div",{className:"px-3 pb-3 pt-0 border-t border-cc-border mt-0",children:a.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 a.jsx("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(f5,{}),a.jsx("div",{className:"flex-1 min-w-0",children:a.jsxs("div",{className:"border border-cc-border rounded-[10px] overflow-hidden bg-cc-card tool-card",children:[a.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:[a.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:a.jsx("path",{d:"M6 4l4 4-4 4"})}),a.jsx(ll,{type:i}),a.jsx("span",{className:"text-xs font-medium text-cc-fg",children:l}),a.jsx("span",{className:"text-[10px] text-cc-muted bg-cc-hover rounded-full px-1.5 py-0.5 tabular-nums font-medium",children:c})]}),t&&a.jsx("div",{className:"border-t border-cc-border px-3 py-1.5",children:e.items.map((u,f)=>{const h=Jo(u.name,u.input);return a.jsxs("div",{className:"flex items-center gap-2 py-1 text-xs text-cc-muted font-mono-code truncate",children:[a.jsx("span",{className:"w-1 h-1 rounded-full bg-cc-muted/40 shrink-0"}),a.jsx("span",{className:"truncate",children:h||JSON.stringify(u.input).slice(0,80)})]},u.id||f)})})]})})]})})}function y2({entries:e,toolActivity:t}){return a.jsx(a.Fragment,{children:e.map((n,i)=>{if(n.kind==="tool_msg_group")return a.jsx(K8,{group:n},n.firstId||i);if(n.kind==="subagent")return a.jsx(e7,{group:n},n.taskToolUseId);const l=n.msg,c=Z8(l),u=t&&c.length>0?t.filter(h=>c.includes(h.toolUseId)):[],f=u.length>0&&u.every(h=>h.completedAt);return a.jsxs("div",{children:[a.jsx(M8,{message:l}),f&&a.jsx(F8,{entries:u})]},l.id)})})}function Z8(e){var t;return(t=e.contentBlocks)!=null&&t.length?e.contentBlocks.filter(n=>n.type==="tool_use").map(n=>n.id):[]}function J8(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 e7({group:e}){const[t,n]=k.useState(!1),i=e.description||"Subagent",l=e.agentType,c=e.children.length,u=J8(e.status),f=e.receiverCount,h=e.senderThreadId,p=e.receiverThreadIds||[],g=e.backend||"claude",v=e.children[e.children.length-1],y=k.useMemo(()=>{var b,_;if(!v)return"";if(v.kind==="tool_msg_group")return`${gs(v.toolName)}${v.items.length>1?` ×${v.items.length}`:""}`;if(v.kind==="message"&&v.msg.role==="assistant"){const S=(b=v.msg.content)==null?void 0:b.trim();if(S)return S.length>60?S.slice(0,60)+"...":S;const T=(_=v.msg.contentBlocks)==null?void 0:_.find(j=>j.type==="tool_use");if(T)return gs(T.name)}return""},[v]);return a.jsx("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]",children:a.jsxs("div",{className:"ml-10 border-l border-cc-border/50 pl-4",children:[a.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:[a.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:a.jsx("path",{d:"M6 4l4 4-4 4"})}),a.jsx("span",{className:"text-[11px] font-medium text-cc-primary/70",children:i}),l&&a.jsx("span",{className:"text-[10px] text-cc-muted/50",children:l}),a.jsx("span",{className:"text-[10px] text-cc-muted/40",children:g==="codex"?"Codex":"Claude"}),u&&a.jsx("span",{className:`text-[10px] ${u.className}`,children:u.label}),f!==void 0&&a.jsxs("span",{className:"text-[10px] text-cc-muted/40",children:[f," agent",f===1?"":"s"]}),!t&&y&&a.jsx("span",{className:"text-[11px] text-cc-muted/40 truncate ml-1 font-mono-code",children:y}),a.jsx("span",{className:"text-[10px] text-cc-muted/40 tabular-nums shrink-0 ml-auto",children:c})]}),t&&a.jsxs("div",{className:"space-y-3 pb-2 mt-1",children:[(h||p.length>0)&&a.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[10px] text-cc-muted/50 pl-4",children:[h&&a.jsxs("span",{className:"font-mono-code",children:["sender: ",h]}),p.length>0&&a.jsxs("span",{children:["receivers: ",p.map(b=>a.jsx("span",{className:"font-mono-code ml-1",children:b},b))]})]}),a.jsx(y2,{entries:e.children})]})]})})}function f5(){return a.jsx("div",{className:"w-7 h-7 rounded-full avatar-ring flex items-center justify-center shrink-0 mt-0.5",children:a.jsx("div",{className:"avatar-inner w-full h-full rounded-full flex items-center justify-center",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:a.jsx("path",{d:"M8 2L10.5 6.5L15 8L10.5 9.5L8 14L5.5 9.5L1 8L5.5 6.5L8 2Z"})})})})}function t7({sessionId:e}){const t=X(oe=>oe.messages.get(e)??V8),n=X(oe=>(oe.sdkSessions||G8).find(Ee=>Ee.sessionId===e)),i=X(oe=>oe.streamingStartedAt.get(e)),l=X(oe=>oe.streamingOutputTokens.get(e)),c=X(oe=>oe.sessionStatus.get(e)),u=X(oe=>oe.toolProgress.get(e)),f=X(oe=>oe.toolActivity.get(e)),h=k.useRef(null),p=k.useRef(null),g=k.useRef(!0),[v,y]=k.useState(0),[b,_]=k.useState(Zu),[S,T]=k.useState([]),[j,R]=k.useState(0),[C,P]=k.useState(!1),[z,D]=k.useState(!1),[F,B]=k.useState(!1),[I,L]=k.useState(""),q=k.useRef(new Set),E=X(oe=>oe.chatTabReentryTickBySession.get(e)??0),ae=k.useMemo(()=>t.some(oe=>oe.role==="assistant"&&oe.isStreaming),[t]),K=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]),Y=K.length>0,U=n!=null&&n.forkSession?"Forked from":"Continuing from",$=k.useMemo(()=>{if(S.length===0)return t;const oe=[],Ee=new Set;for(const Fe of S)Ee.has(Fe.id)||(Ee.add(Fe.id),oe.push(Fe));for(const Fe of t)Ee.has(Fe.id)||(Ee.add(Fe.id),oe.push(Fe));return oe},[S,t]),re=k.useMemo(()=>Q8($),[$]);k.useEffect(()=>{_(Zu),T([]),R(0),P(!1),D(!1),B(!1),L(""),q.current=new Set},[e,K]);const xe=re.length,M=xe>b,O=M?re.slice(xe-b):re,Z=xe-O.length,A=k.useCallback(()=>{const oe=p.current,Ee=(oe==null?void 0:oe.scrollHeight)??0;_(Fe=>Fe+Zu),requestAnimationFrame(()=>{if(oe){const Fe=oe.scrollHeight;oe.scrollTop+=Fe-Ee}})},[]),fe=k.useCallback(async(oe={})=>{if(!Y||!K||F)return;const Ee=p.current,Fe=(Ee==null?void 0:Ee.scrollHeight)??0,At=z?j:0;B(!0),L("");try{const Ze=await we.getClaudeSessionHistory(K,{cursor:At,limit:q8}),Mt=Ze.messages.map(qe=>({id:qe.id,role:qe.role,content:qe.content,contentBlocks:qe.role==="assistant"?qe.contentBlocks:void 0,timestamp:qe.timestamp||Date.now(),model:qe.role==="assistant"?qe.model:void 0,stopReason:qe.role==="assistant"?qe.stopReason:void 0})),vt=[];for(const qe of Mt)q.current.has(qe.id)||(q.current.add(qe.id),vt.push(qe));T(qe=>[...vt,...qe]),R(Ze.nextCursor),P(Ze.hasMore),D(!0),vt.length>0&&_(qe=>qe+vt.length),oe.preserveScroll!==!1&&Ee&&requestAnimationFrame(()=>{const qe=Ee.scrollHeight;Ee.scrollTop+=qe-Fe})}catch(Ze){const Mt=Ze instanceof Error?Ze.message:String(Ze);L(Mt||"Failed to load previous history"),z||(T([]),R(0),P(!1))}finally{B(!1)}},[Y,K,F,z,j]);k.useEffect(()=>{if(!i&&c!=="running"){y(0);return}const oe=i||Date.now();y(Date.now()-oe);const Ee=setInterval(()=>y(Date.now()-oe),1e3);return()=>clearInterval(Ee)},[i,c]);function _e(){const oe=p.current;if(!oe)return;g.current=oe.scrollHeight-oe.scrollTop-oe.clientHeight<120;const Ee=Math.max(0,oe.scrollHeight-oe.clientHeight-oe.scrollTop);Zp.set(e,Ee),Y&&z&&C&&!F&&oe.scrollTop<=I8&&fe({preserveScroll:!0})}const je=k.useCallback(()=>{const oe=p.current;if(!oe)return;const Ee=oe.style.scrollBehavior;oe.style.scrollBehavior="auto",oe.scrollTop=oe.scrollHeight,oe.style.scrollBehavior=Ee},[]),De=k.useCallback(()=>{const oe=p.current;if(!oe)return;const Ee=oe.style.scrollBehavior;oe.style.scrollBehavior="auto";const Fe=Zp.get(e);typeof Fe=="number"?oe.scrollTop=Math.max(0,oe.scrollHeight-oe.clientHeight-Fe):oe.scrollTop=oe.scrollHeight,oe.style.scrollBehavior=Ee},[e]);return k.useEffect(()=>{requestAnimationFrame(()=>De())},[e,De]),k.useEffect(()=>()=>{const oe=p.current;if(!oe)return;const Ee=Math.max(0,oe.scrollHeight-oe.clientHeight-oe.scrollTop);Zp.set(e,Ee)},[e]),k.useEffect(()=>{E&&requestAnimationFrame(()=>je())},[E,je]),k.useEffect(()=>{var oe;g.current&&((oe=h.current)==null||oe.scrollIntoView({behavior:"smooth"}))},[t]),$.length===0?a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-5 select-none px-6",children:[a.jsxs("div",{className:"relative",children:[a.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:a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-7 h-7 text-cc-primary",children:[a.jsx("polyline",{points:"4 17 10 11 4 5"}),a.jsx("line",{x1:"12",y1:"19",x2:"20",y2:"19"})]})}),a.jsx("div",{className:"absolute -top-1 -right-1 w-3 h-3",children:a.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:a.jsx("path",{d:"M8 2L10.5 6.5L15 8L10.5 9.5L8 14L5.5 9.5L1 8L5.5 6.5L8 2Z"})})})]}),a.jsx("div",{className:"text-center max-w-xs",children:Y?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-sm text-cc-fg font-medium mb-1.5",children:"This session has prior context"}),a.jsxs("p",{className:"text-xs text-cc-muted leading-relaxed mb-4",children:[U," ",a.jsx("span",{className:"font-mono-code text-cc-fg/70",children:K.slice(0,8)}),". Load earlier messages when needed."]}),a.jsxs("button",{onClick:()=>void fe({preserveScroll:!1}),disabled:F,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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M8 2v12M3 9l5 5 5-5",strokeLinecap:"round",strokeLinejoin:"round"})}),F?"Loading...":"Load previous history"]}),I&&a.jsx("p",{className:"text-xs text-cc-error mt-2",children:I})]}):a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-[15px] text-cc-fg font-medium mb-1.5",children:"Start a conversation"}),a.jsx("p",{className:"text-xs text-cc-muted leading-relaxed",children:"Send a message to begin working with The Companion."})]})})]}):a.jsxs("div",{className:"flex-1 min-h-0 relative overflow-hidden",children:[a.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"}),a.jsx("div",{ref:p,onScroll:_e,className:"h-full overflow-y-auto overflow-x-hidden overscroll-y-contain px-4 sm:px-6 py-5 sm:py-8",children:a.jsxs("div",{className:"max-w-3xl mx-auto space-y-5 sm:space-y-7",children:[Y&&!z&&a.jsxs("div",{className:"rounded-xl border border-cc-border bg-cc-card p-3",children:[a.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a.jsxs("div",{children:[a.jsxs("p",{className:"text-xs font-medium text-cc-fg",children:[U," existing Claude thread"]}),a.jsxs("p",{className:"text-[11px] text-cc-muted mt-1",children:[K," ",n!=null&&n.cwd?`· ${Y8(n.cwd)}`:""]})]}),a.jsx("button",{onClick:()=>void fe({preserveScroll:!0}),disabled:F,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:F?"Loading...":"Load previous history"})]}),I&&a.jsx("p",{className:"text-xs text-cc-error mt-2",children:I})]}),Y&&z&&a.jsx("div",{className:"flex justify-center",children:a.jsx("p",{className:"text-[11px] text-cc-muted",children:C?F?"Loading older transcript...":"Scroll to top to load older transcript":"Loaded all available prior transcript"})}),M&&a.jsx("div",{className:"flex justify-center pb-3",children:a.jsxs("button",{onClick:A,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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M8 3v10M3 8l5-5 5 5",strokeLinecap:"round",strokeLinejoin:"round"})}),"Load ",Math.min(Zu,Z)," more",a.jsxs("span",{className:"text-cc-muted/50 tabular-nums",children:["(",Z," hidden)"]})]})}),a.jsx(y2,{entries:O,toolActivity:f}),u&&u.size>0&&!ae&&a.jsx(U8,{tools:Array.from(u.values())}),c==="compacting"&&a.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-cc-warning font-mono-code pl-10 py-1",children:[a.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:[a.jsx("circle",{cx:"8",cy:"8",r:"6",opacity:"0.2"}),a.jsx("path",{d:"M8 2a6 6 0 0 1 6 6",strokeLinecap:"round"})]}),a.jsx("span",{children:"Compacting context..."})]}),c==="running"&&v>0&&a.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-cc-muted font-mono-code pl-10 stats-glow py-1",children:[a.jsx("span",{className:"inline-block w-2 h-2 rounded-full bg-cc-primary animate-[typing-breathe_1.5s_ease-in-out_infinite]"}),a.jsx("span",{className:"text-cc-fg/70",children:"Generating"}),a.jsx("span",{className:"text-cc-muted/30",children:"|"}),a.jsx("span",{className:"tabular-nums",children:$8(v)}),(l??0)>0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-cc-muted/30",children:"|"}),a.jsxs("span",{className:"tabular-nums",children:[Uo(l)," tokens"]})]})]}),a.jsx("div",{ref:h})]})})]})}const n7={codex:"✳",xhigh:"★",max:"■",mini:"⚡"};function r7(e,t){for(const[i,l]of Object.entries(n7))if(e.includes(i))return l;const n=["◆","●","◕","✦"];return n[t%n.length]}function i7(e){return e.map((t,n)=>({value:t.value,label:t.label||t.value,icon:r7(t.value,n)}))}const _2=[{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-4-6",label:"Sonnet 4.6",icon:""},{value:"claude-haiku-4-5-20251001",label:"Haiku 4.5",icon:""}],w2=[{value:"gpt-5.3-codex-max",label:"GPT-5.3 Max",icon:"■"},{value:"gpt-5.3-codex-xhigh",label:"GPT-5.3 xHigh",icon:"★"},{value:"gpt-5.3-codex",label:"GPT-5.3 Codex",icon:"✳"},{value:"gpt-5.2-codex",label:"GPT-5.2 Codex",icon:"◆"},{value:"gpt-5.1-codex-max",label:"GPT-5.1 Max",icon:"■"},{value:"gpt-5.2",label:"GPT-5.2",icon:"●"},{value:"gpt-5.1-codex-mini",label:"GPT-5.1 Mini",icon:"⚡"}],rx=[{value:"bypassPermissions",label:"Agent"},{value:"plan",label:"Plan"}],ix=[{value:"bypassPermissions",label:"Auto"},{value:"plan",label:"Plan"}],k2=[{value:"bypassPermissions",label:"Full Auto"},{value:"acceptEdits",label:"Auto-Edit"},{value:"default",label:"Supervised"}],S2=[{value:"bypassPermissions",label:"Full Auto"},{value:"default",label:"Supervised"}];function j2(e){return e==="codex"?w2:_2}function h5(e){return e==="codex"?ix:rx}function lD(e){return e==="codex"?S2:k2}function p5(e){return e==="codex"?w2[0].value:_2[0].value}function m5(e){return e==="codex"?ix[0].value:rx[0].value}function oD(e){return e==="codex"?S2[0].value:k2[0].value}function g5({sessionId:e}){const[t,n]=k.useState(!1),i=k.useRef(null),l=X(y=>y.sdkSessions.find(b=>b.sessionId===e)||null),c=X(y=>y.sessions.get(e)),u=X(y=>y.cliConnected.get(e)??!1),f=(l==null?void 0:l.backendType)??(c==null?void 0:c.backend_type)??"claude",h=(c==null?void 0:c.model)??(l==null?void 0:l.model)??"",p=j2(f),g=p.find(y=>y.value===h)||(h?{label:h,icon:"?"}:null),v=k.useCallback(y=>{if(n(!1),y===h)return;Ln(e,{type:"set_model",model:y});const{sdkSessions:b,setSdkSessions:_}=X.getState();_(b.map(S=>S.sessionId===e?{...S,model:y}:S))},[e,h]);return k.useEffect(()=>{if(!t)return;const y=b=>{i.current&&!i.current.contains(b.target)&&n(!1)};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[t]),k.useEffect(()=>{if(!t)return;const y=b=>{b.key==="Escape"&&n(!1)};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[t]),f==="codex"||!u||!g?null:a.jsxs("div",{ref:i,className:"relative shrink-0",children:[a.jsxs("button",{onClick:()=>n(y=>!y),className:`flex items-center gap-1 h-8 px-2 rounded-md text-[12px] font-medium transition-colors cursor-pointer ${t?"text-cc-fg bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:`Current model: ${g.label}`,"aria-label":"Switch model","aria-expanded":t,"aria-haspopup":"listbox",children:[g.icon&&a.jsx("span",{className:"text-[13px] leading-none",children:g.icon}),a.jsx("span",{children:g.label}),a.jsx("svg",{viewBox:"0 0 12 12",fill:"currentColor",className:"w-2.5 h-2.5 opacity-50",children:a.jsx("path",{d:"M6 8L1.5 3.5h9L6 8z"})})]}),t&&a.jsx("div",{className:"absolute right-0 bottom-full mb-1 z-50 min-w-[160px] rounded-lg border border-cc-separator bg-cc-bg shadow-lg overflow-hidden",role:"listbox","aria-label":"Select model",children:p.map(y=>a.jsxs("button",{onClick:()=>v(y.value),className:`w-full flex items-center gap-2 px-3 min-h-[44px] text-[13px] transition-colors cursor-pointer ${y.value===h?"text-cc-fg bg-cc-active font-medium":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,role:"option","aria-selected":y.value===h,children:[y.icon&&a.jsx("span",{className:"text-[14px] leading-none w-5 text-center",children:y.icon}),a.jsx("span",{className:"flex-1 text-left",children:y.label}),y.value===h&&a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary shrink-0",children:a.jsx("path",{d:"M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"})})]},y.value))})]})}function N2({open:e,loading:t,prompts:n,selectedIndex:i,onSelect:l,menuRef:c,className:u=""}){return e?a.jsx("div",{ref:c,className:`max-h-[240px] overflow-y-auto bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-20 py-1 ${u}`,children:t?a.jsx("div",{className:"px-3 py-2 text-[12px] text-cc-muted",children:"Searching prompts..."}):n.length>0?n.map((f,h)=>a.jsxs("button",{"data-prompt-index":h,onClick:()=>l(f),className:`w-full px-3 py-2 text-left flex items-center gap-2.5 transition-colors cursor-pointer ${h===i?"bg-cc-hover":"hover:bg-cc-hover/50"}`,children:[a.jsx("span",{className:"flex items-center justify-center w-6 h-6 rounded-md bg-cc-hover text-cc-muted shrink-0",children:a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:[a.jsx("path",{d:"M2.5 8a5.5 5.5 0 1111 0v3a2.5 2.5 0 01-2.5 2.5h-1",strokeLinecap:"round"}),a.jsx("circle",{cx:"8",cy:"8",r:"1.75",fill:"currentColor",stroke:"none"})]})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"text-[13px] font-medium text-cc-fg truncate",children:["@",f.name]}),a.jsx("div",{className:"text-[11px] text-cc-muted truncate",children:f.content})]}),a.jsx("span",{className:"text-[10px] text-cc-muted shrink-0",children:f.scope})]},f.id)):a.jsx("div",{className:"px-3 py-2 text-[12px] text-cc-muted",children:"No prompts found."})}):null}function C2({text:e,caretPos:t,cwd:n,enabled:i=!0}){const[l,c]=k.useState(!1),[u,f]=k.useState(0),[h,p]=k.useState([]),[g,v]=k.useState(!1),y=k.useRef(null),b=k.useCallback(async()=>{v(!0);try{const j=await we.listPrompts(n);p(j.filter(R=>!!R.name.trim()))}catch{p([])}finally{v(!1)}},[n]);k.useEffect(()=>{b()},[b]);const _=k.useMemo(()=>{const j=e.slice(0,t),R=j.match(/(^|\s)@([^\s@]*)$/);if(!R||R.index===void 0)return null;const C=j.length-R[0].length+R[1].length;return{query:R[2]||"",start:C,end:t}},[e,t]),S=k.useMemo(()=>{if(!l||!_)return[];const j=_.query.toLowerCase();if(!j)return h;const R=h.filter(P=>P.name.toLowerCase().startsWith(j)),C=h.filter(P=>!P.name.toLowerCase().startsWith(j)&&P.name.toLowerCase().includes(j));return[...R,...C]},[l,_,h]);k.useEffect(()=>{const j=i&&!!_;j&&!l?(c(!0),f(0)):!j&&l&&c(!1)},[i,_,l]),k.useEffect(()=>{u>=S.length&&f(Math.max(0,S.length-1))},[S.length,u]),k.useEffect(()=>{if(!y.current||!l)return;const R=y.current.querySelectorAll("[data-prompt-index]")[u];R&&R.scrollIntoView({block:"nearest"})},[u,l]);const T=k.useCallback(j=>{if(!_)return{nextText:e,nextCursor:t};const R=`${j.content} `,C=`${e.slice(0,_.start)}${R}${e.slice(_.end)}`,P=_.start+R.length;return{nextText:C,nextCursor:P}},[_,e,t]);return{mentionMenuOpen:l,setMentionMenuOpen:c,mentionMenuIndex:u,setMentionMenuIndex:f,mentionContext:_,filteredPrompts:S,promptsLoading:g,savedPrompts:h,selectPrompt:T,refreshPrompts:b,mentionMenuRef:y}}const s7=[];function x5({isPlan:e,isConnected:t,onToggle:n,modeLabel:i,size:l}){const c=l==="desktop",u=c?"px-2.5 py-1.5":"px-2 py-1",f=c?"text-cc-primary border-cc-primary/30 bg-cc-primary/8 hover:bg-cc-primary/12 cursor-pointer":"text-cc-primary border-cc-primary/30 bg-cc-primary/8",h=c?"text-cc-muted border-cc-border hover:text-cc-fg hover:bg-cc-hover cursor-pointer":"text-cc-muted border-cc-border";return a.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?a.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:[a.jsx("rect",{x:"3",y:"3",width:"3.5",height:"10",rx:"0.75"}),a.jsx("rect",{x:"9.5",y:"3",width:"3.5",height:"10",rx:"0.75"})]}):a.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:[a.jsx("path",{d:"M2.5 4l4 4-4 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),a.jsx("path",{d:"M8.5 4l4 4-4 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]}),a.jsx("span",{children:i})]})}function Ju({onClick:e,disabled:t,active:n,title:i,children:l}){return a.jsx("button",{onClick:e,disabled:t,className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors ${n?"text-cc-muted hover:text-cc-fg hover:bg-cc-hover cursor-pointer":"text-cc-muted opacity-30 cursor-not-allowed"}`,title:i,children:l})}function v5(){return a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-4 h-4",children:a.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 b5({isRunning:e,canSend:t,onSend:n,onInterrupt:i,size:l}){const c=l==="desktop",u=c?"w-9 h-9":"w-10 h-10",f=c?"bg-cc-primary hover:bg-cc-primary-hover hover:scale-105 text-white cursor-pointer shadow-[0_4px_16px_rgba(217,119,87,0.25)]":"bg-cc-primary hover:bg-cc-primary-hover active:scale-95 text-white cursor-pointer shadow-[0_4px_16px_rgba(217,119,87,0.25)]";return e?a.jsx("button",{onClick:i,className:`flex items-center justify-center ${u} rounded-lg bg-cc-error/10 hover:bg-cc-error/20 text-cc-error transition-colors cursor-pointer`,title:"Stop generation",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1"})})}):a.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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M3 2l11 6-11 6V9.5l7-1.5-7-1.5V2z"})})})}function a7({sessionId:e}){var le,be;const[t,n]=k.useState(""),[i,l]=k.useState([]),[c,u]=k.useState(null),[f,h]=k.useState(!1),[p,g]=k.useState(!1),[v,y]=k.useState(0),[b,_]=k.useState(!1),[S,T]=k.useState(""),[j,R]=k.useState("global"),[C,P]=k.useState(null),[z,D]=k.useState(0),F=k.useRef(null),B=k.useRef(null),I=k.useRef(null),L=k.useRef(null),q=X(W=>W.cliConnected),E=X(W=>W.sessions.get(e)),ae=X(W=>W.previousPermissionMode.get(e)||"acceptEdits"),K=q.get(e)??!1,Y=(E==null?void 0:E.permissionMode)||"acceptEdits",U=Y==="plan",$=(E==null?void 0:E.backend_type)==="codex",xe=((be=(le=($?ix:rx).find(W=>W.value===Y))==null?void 0:le.label)==null?void 0:be.toLowerCase())||Y,M=C2({text:t,caretPos:z,cwd:E==null?void 0:E.cwd,enabled:!p}),O=k.useMemo(()=>{const W=[];if(E!=null&&E.slash_commands)for(const he of E.slash_commands)W.push({name:he,type:"command"});if(E!=null&&E.skills)for(const he of E.skills)W.push({name:he,type:"skill"});return W},[E==null?void 0:E.slash_commands,E==null?void 0:E.skills]),Z=k.useMemo(()=>{if(!p)return[];const W=t.match(/^\/(\S*)$/);if(!W)return[];const he=W[1].toLowerCase();return he===""?O:O.filter(Ae=>Ae.name.toLowerCase().includes(he))},[t,p,O]);k.useEffect(()=>{const W=t.startsWith("/")&&/^\/\S*$/.test(t)&&O.length>0;W&&!p?(g(!0),y(0)):!W&&p&&g(!1)},[t,O.length,p]),k.useEffect(()=>{v>=Z.length&&y(Math.max(0,Z.length-1))},[Z.length,v]),k.useEffect(()=>{if(!I.current||!p)return;const he=I.current.querySelectorAll("[data-cmd-index]")[v];he&&he.scrollIntoView({block:"nearest"})},[v,p]),k.useEffect(()=>{if(L.current===null||!F.current)return;const W=L.current;F.current.setSelectionRange(W,W),L.current=null},[t]);const A=k.useCallback(W=>{var he;n(`/${W.name} `),g(!1),(he=F.current)==null||he.focus()},[]),fe=k.useCallback(W=>{var Ae;const he=M.selectPrompt(W);L.current=he.nextCursor,n(he.nextText),M.setMentionMenuOpen(!1),D(he.nextCursor),(Ae=F.current)==null||Ae.focus(),F.current&&(F.current.style.height="auto",F.current.style.height=Math.min(F.current.scrollHeight,200)+"px")},[M]);function _e(){var ut;const W=t.trim();if(!W||!K)return;const he=am(),Ae=i.length>0?i.map(Qe=>({name:Qe.name,media_type:Qe.mediaType,data:Qe.base64,size:Qe.size})):void 0;Ln(e,{type:"user_message",content:W,session_id:e,attachments:Ae,client_msg_id:he}),X.getState().appendMessage(e,{id:he,role:"user",content:W,attachments:Ae,timestamp:Date.now()}),n(""),l([]),u(null),g(!1),M.setMentionMenuOpen(!1),F.current&&(F.current.style.height="auto"),(ut=F.current)==null||ut.focus()}function je(W){if(p&&Z.length>0){if(W.key==="ArrowDown"){W.preventDefault(),y(he=>(he+1)%Z.length);return}if(W.key==="ArrowUp"){W.preventDefault(),y(he=>(he-1+Z.length)%Z.length);return}if(W.key==="Tab"&&!W.shiftKey){W.preventDefault(),A(Z[v]);return}if(W.key==="Enter"&&!W.shiftKey){W.preventDefault(),A(Z[v]);return}if(W.key==="Escape"){W.preventDefault(),g(!1);return}}if(M.mentionMenuOpen&&W.key==="Escape"){W.preventDefault(),M.setMentionMenuOpen(!1);return}if(M.mentionMenuOpen&&M.filteredPrompts.length>0){if(W.key==="ArrowDown"){W.preventDefault(),M.setMentionMenuIndex(he=>(he+1)%M.filteredPrompts.length);return}if(W.key==="ArrowUp"){W.preventDefault(),M.setMentionMenuIndex(he=>(he-1+M.filteredPrompts.length)%M.filteredPrompts.length);return}if(W.key==="Tab"&&!W.shiftKey||W.key==="Enter"&&!W.shiftKey){W.preventDefault(),fe(M.filteredPrompts[M.mentionMenuIndex]);return}}if(M.mentionMenuOpen&&M.filteredPrompts.length===0&&(W.key==="Enter"&&!W.shiftKey||W.key==="Tab"&&!W.shiftKey)){W.preventDefault();return}if(W.key==="Tab"&&W.shiftKey){W.preventDefault(),un();return}W.key==="Enter"&&!W.shiftKey&&(W.preventDefault(),_e())}function De(W){n(W.target.value),D(W.target.selectionStart??W.target.value.length);const he=W.target;he.style.height="auto",he.style.height=Math.min(he.scrollHeight,200)+"px"}function oe(){F.current&&D(F.current.selectionStart??0)}function Ee(){Ln(e,{type:"interrupt"})}async function Fe(W){if(W.length===0)return;const he=[],Ae=[];let ut=i.reduce((Qe,Je)=>Qe+Je.size,0);for(const Qe of W){if(Qe.size>Bd){Ae.push(`${Qe.name} is too large (${ms(Qe.size)}, max ${ms(Bd)})`);continue}if(ut+Qe.size>$d){Ae.push(`${Qe.name} would exceed the per-message limit (${ms($d)})`);continue}const{base64:Je,mediaType:gt}=await h2(Qe);he.push({name:Qe.name,base64:Je,mediaType:gt,size:Qe.size}),ut+=Qe.size}he.length>0&&l(Qe=>[...Qe,...he]),u(Ae.length>0?Ae.join("; "):null)}async function At(W){const he=W.target.files;he&&(await Fe(Array.from(he)),W.target.value="")}function Ze(W){l(he=>he.filter((Ae,ut)=>ut!==W))}async function Mt(W){var ut;const he=(ut=W.clipboardData)==null?void 0:ut.items;if(!he)return;const Ae=[];for(const Qe of Array.from(he)){if(Qe.kind!=="file")continue;const Je=Qe.getAsFile();if(!Je)continue;const gt=Je.name&&Je.name.length>0?Je.name:`pasted-${Date.now()}.${(Je.type.split("/")[1]||"bin").replace(/[^a-zA-Z0-9]/g,"")}`;Ae.push(new File([Je],gt,{type:Je.type,lastModified:Je.lastModified}))}Ae.length>0&&(W.preventDefault(),await Fe(Ae))}function vt(W){W.dataTransfer.types.includes("Files")&&(W.preventDefault(),W.stopPropagation(),h(!0))}function qe(W){W.currentTarget===W.target&&h(!1)}async function Pt(W){if(!W.dataTransfer.types.includes("Files"))return;W.preventDefault(),W.stopPropagation(),h(!1);const he=Array.from(W.dataTransfer.files);he.length>0&&await Fe(he)}function vn(){const W=t.trim().slice(0,32);T(W||""),P(null),_(he=>!he)}function un(){if(!K)return;const W=X.getState();if(!U)W.setPreviousPermissionMode(e,Y),Ln(e,{type:"set_permission_mode",mode:"plan"}),W.updateSession(e,{permissionMode:"plan"});else{const he=ae||($?"bypassPermissions":"acceptEdits");Ln(e,{type:"set_permission_mode",mode:he}),W.updateSession(e,{permissionMode:he})}}async function tn(){const W=t.trim(),he=S.trim();if(!W||!he)return;if(j==="project"&&!(E!=null&&E.cwd)){P("No project folder available for this session");return}const Ae={name:he,content:W,scope:j};j==="project"&&(Ae.projectPaths=[E.cwd]);try{await we.createPrompt(Ae),await M.refreshPrompts(),_(!1),T(""),R("global"),P(null)}catch(ut){const Qe=ut instanceof Error&&ut.message?ut.message:"Could not save prompt.";P(Qe)}}const ke=X(W=>W.promptSuggestions.get(e))??s7,ze=X(W=>W.clearPromptSuggestions),Pe=X(W=>W.sessionStatus).get(e)==="running",bn=t.trim().length>0&&K;return a.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:vt,onDragLeave:qe,onDrop:Pt,children:a.jsxs("div",{className:"max-w-3xl mx-auto",children:[f&&a.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:a.jsx("span",{className:"text-sm text-cc-primary font-medium",children:"Drop files to attach"})}),i.length>0&&a.jsx("div",{className:"flex items-center gap-2 mb-2 px-3 sm:px-0 flex-wrap",children:i.map((W,he)=>a.jsx(g2,{name:W.name,mediaType:W.mediaType,base64:W.base64,size:W.size,onRemove:()=>Ze(he)},he))}),c&&a.jsx("div",{className:"mb-2 px-3 sm:px-0 text-[11px] text-cc-error",children:c}),a.jsx("input",{ref:B,type:"file",multiple:!0,onChange:At,className:"hidden","aria-label":"Attach files"}),ke.length>0&&a.jsx("div",{className:"flex flex-wrap gap-1.5 px-2 sm:px-4 pb-2",children:ke.map((W,he)=>a.jsx("button",{onClick:()=>{if(!K||Pe)return;const Ae=am();Ln(e,{type:"user_message",content:W,session_id:e,client_msg_id:Ae}),X.getState().appendMessage(e,{id:Ae,role:"user",content:W,timestamp:Date.now()}),ze(e)},disabled:!K||Pe,className:"text-xs px-2.5 py-1.5 rounded-lg bg-cc-hover hover:bg-cc-active text-cc-fg border border-cc-border transition-colors cursor-pointer truncate max-w-[280px]",title:W,children:W},he))}),a.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 ${U?"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&&a.jsx("div",{ref:I,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((W,he)=>a.jsxs("button",{"data-cmd-index":he,onClick:()=>A(W),className:`w-full px-3 py-2 text-left flex items-center gap-2.5 transition-colors cursor-pointer ${he===v?"bg-cc-hover":"hover:bg-cc-hover/50"}`,children:[a.jsx("span",{className:"flex items-center justify-center w-6 h-6 rounded-md bg-cc-hover text-cc-muted shrink-0",children:W.type==="skill"?a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.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"})}):a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M5 12L10 4",strokeLinecap:"round"})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("span",{className:"text-[13px] font-medium text-cc-fg",children:["/",W.name]}),a.jsx("span",{className:"ml-2 text-[11px] text-cc-muted",children:W.type})]})]},`${W.type}-${W.name}`))}),a.jsx(N2,{open:M.mentionMenuOpen,loading:M.promptsLoading,prompts:M.filteredPrompts,selectedIndex:M.mentionMenuIndex,onSelect:fe,menuRef:M.mentionMenuRef,className:"absolute left-2 right-2 bottom-full mb-1"}),b&&a.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:[a.jsx("div",{className:"text-xs font-semibold text-cc-fg",children:"Save prompt"}),a.jsx("input",{value:S,onChange:W=>{T(W.target.value),C&&P(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"}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("button",{type:"button","aria-pressed":j==="global",onClick:()=>R("global"),className:`px-2 py-0.5 text-[11px] rounded border transition-colors cursor-pointer ${j==="global"?"border-cc-primary/40 text-cc-primary bg-cc-primary/8":"border-cc-border text-cc-muted hover:text-cc-fg"}`,children:"Global"}),a.jsx("button",{type:"button","aria-pressed":j==="project",onClick:()=>R("project"),className:`px-2 py-0.5 text-[11px] rounded border transition-colors cursor-pointer ${j==="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"})]}),j==="project"&&(E==null?void 0:E.cwd)&&a.jsx("div",{className:"text-[10px] text-cc-muted font-mono-code truncate",title:E.cwd,children:E.cwd}),C?a.jsx("div",{className:"text-[11px] text-cc-error",children:C}):null,a.jsxs("div",{className:"flex items-center gap-1.5 justify-end",children:[a.jsx("button",{onClick:()=>{_(!1),R("global"),P(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"}),a.jsx("button",{onClick:tn,disabled:!S.trim()||!t.trim(),className:`px-2 py-1 text-[11px] rounded-md border ${S.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"})]})]}),a.jsxs("div",{className:"flex items-center gap-1.5 px-3 pt-1.5 pb-0.5 sm:hidden",children:[a.jsx(x5,{isPlan:U,isConnected:K,onToggle:un,modeLabel:xe,size:"mobile"}),a.jsx(g5,{sessionId:e}),a.jsx("div",{className:"flex-1"}),a.jsx(Ju,{onClick:vn,disabled:!K||!t.trim(),active:K&&!!t.trim(),title:"Save as prompt",children:a.jsx(v5,{})}),a.jsx(Ju,{onClick:()=>{var W;return(W=B.current)==null?void 0:W.click()},disabled:!K,active:K,title:"Attach file",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-4 h-4",children:a.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"})})})]}),a.jsx("div",{className:"px-3 sm:px-3 pt-1 sm:pt-2.5",children:a.jsx("textarea",{ref:F,value:t,onChange:De,onKeyDown:je,onClick:oe,onKeyUp:oe,onPaste:Mt,"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"}})}),a.jsx("div",{className:"flex items-center justify-end gap-1 px-3 pb-1 sm:hidden",children:a.jsx(b5,{isRunning:Pe,canSend:bn,onSend:_e,onInterrupt:Ee,size:"mobile"})}),a.jsxs("div",{className:"hidden sm:flex items-center gap-1.5 px-2.5 pb-2",children:[a.jsx(Ju,{onClick:()=>{var W;return(W=B.current)==null?void 0:W.click()},disabled:!K,active:K,title:"Attach file",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-4 h-4",children:a.jsx("path",{d:"M8 3v10M3 8h10",strokeLinecap:"round"})})}),a.jsx(Ju,{onClick:vn,disabled:!K||!t.trim(),active:K&&!!t.trim(),title:"Save as prompt",children:a.jsx(v5,{})}),a.jsx(x5,{isPlan:U,isConnected:K,onToggle:un,modeLabel:xe,size:"desktop"}),a.jsx("div",{className:"flex-1"}),a.jsx(g5,{sessionId:e}),a.jsx(b5,{isRunning:Pe,canSend:bn,onSend:_e,onInterrupt:Ee,size:"desktop"})]})]})]})})}function l7(e){if(e.type==="setMode")return`Set mode to "${e.mode}"`;const n=e.destination==="session"?"for session":"always";if(e.type==="addRules"||e.type==="replaceRules"){const i=e.rules[0];if(i!=null&&i.ruleContent)return`Allow "${i.ruleContent}" ${n}`;if(i!=null&&i.toolName)return`Allow ${i.toolName} ${n}`}return e.type==="addDirectories"?`Trust ${e.directories[0]||"directory"} ${n}`:`Allow ${n}`}function o7({permission:e,sessionId:t}){const[n,i]=k.useState(!1),l=X(p=>p.removePermission);function c(p,g){i(!0),Ln(t,{type:"permission_response",request_id:e.request_id,behavior:"allow",updated_input:p,...g!=null&&g.length?{updated_permissions:g}:{}}),l(t,e.request_id)}function u(){i(!0),Ln(t,{type:"permission_response",request_id:e.request_id,behavior:"deny",message:"Denied by user"}),l(t,e.request_id)}const f=e.tool_name==="AskUserQuestion",h=e.permission_suggestions;return a.jsx("div",{className:"px-2 sm:px-4 py-3 border-b border-cc-border animate-[fadeSlideIn_0.2s_ease-out]",children:a.jsx("div",{className:"max-w-3xl mx-auto",children:a.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[a.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?a.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-4 h-4 text-cc-primary",children:a.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"})}):a.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-4 h-4 text-cc-warning",children:a.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"})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[a.jsx("span",{className:`text-xs font-semibold ${f?"text-cc-primary":"text-cc-warning"}`,children:f?"Question":"Permission Request"}),!f&&a.jsx("span",{className:"text-[11px] text-cc-muted font-mono-code",children:e.display_name||e.tool_name}),e.title&&a.jsx("span",{className:"text-[11px] text-cc-muted",children:e.title})]}),f?a.jsx(h7,{input:e.input,onSelect:p=>c({...e.input,answers:p}),disabled:n}):a.jsx(d7,{toolName:e.tool_name,input:e.input,description:e.description}),e.decision_reason&&a.jsx("p",{className:"text-xs text-cc-muted mt-1 italic",children:e.decision_reason}),e.ai_validation&&!f&&a.jsx(u7,{validation:e.ai_validation}),!f&&a.jsxs("div",{className:"flex items-center gap-2 mt-3 flex-wrap",children:[a.jsxs("button",{onClick:()=>c(),disabled:n,className:"inline-flex items-center gap-1.5 px-3 py-2.5 text-xs font-medium rounded-lg bg-cc-success/90 hover:bg-cc-success text-white disabled:opacity-50 transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-3 h-3",children:a.jsx("path",{d:"M3 8.5l3.5 3.5 6.5-7"})}),"Allow"]}),h==null?void 0:h.map((p,g)=>a.jsxs("button",{onClick:()=>c(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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:a.jsx("path",{d:"M3 8.5l3.5 3.5 6.5-7"})}),l7(p)]},g)),a.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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-3 h-3",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})}),"Deny"]})]})]})]})})})}function c7(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 u7({validation:e}){const t=e.verdict==="uncertain"&&c7(e.reason),n=e.verdict==="safe"?"bg-cc-success/10 text-cc-success":e.verdict==="dangerous"?"bg-cc-error/10 text-cc-error":"bg-cc-warning/10 text-cc-warning",i=t?"AI analysis unavailable — manual review:":"AI analysis:";return a.jsxs("div",{className:`mt-2 flex items-center gap-1.5 text-[11px] px-2 py-1.5 rounded-md ${n}`,children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 shrink-0",children:a.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"})}),a.jsx("span",{className:"font-medium",children:i}),a.jsx("span",{children:e.reason})]})}function d7({toolName:e,input:t,description:n}){return e==="Bash"?a.jsx(f7,{input:t}):e==="Edit"?a.jsx(p7,{input:t}):e==="Write"?a.jsx(m7,{input:t}):e==="Read"?a.jsx(g7,{input:t}):e==="Glob"?a.jsx(x7,{input:t}):e==="Grep"?a.jsx(v7,{input:t}):e==="ExitPlanMode"?a.jsx(b7,{input:t}):a.jsx(E2,{input:t,description:n})}function f7({input:e}){const t=typeof e.command=="string"?e.command:"",n=typeof e.description=="string"?e.description:"";return a.jsxs("div",{className:"space-y-1.5",children:[n&&a.jsx("div",{className:"text-xs text-cc-muted",children:n}),a.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:[a.jsx("span",{className:"text-cc-muted select-none",children:"$ "}),t]})]})}function h7({input:e,onSelect:t,disabled:n}){const i=Array.isArray(e.questions)?e.questions:[],[l,c]=k.useState({}),[u,f]=k.useState({}),[h,p]=k.useState({});function g(S,T){const j=String(S);c(R=>({...R,[j]:T})),p(R=>({...R,[j]:!1})),i.length<=1&&t({[j]:T})}function v(S){var R;const T=String(S),j=(R=u[T])==null?void 0:R.trim();j&&(c(C=>({...C,[T]:j})),i.length<=1&&t({[T]:j}))}function y(S,T){const j=String(S);f(C=>({...C,[j]:T}));const R=T.trim();c(C=>{if(!R){const P={...C};return delete P[j],P}return{...C,[j]:R}})}function b(S){const T=String(S);p(j=>{const R=!!j[T],C={...j,[T]:!R};return R&&(c(P=>{const z={...P};return delete z[T],z}),f(P=>{const z={...P};return delete z[T],z})),C})}function _(){t(l)}if(i.length===0){const S=typeof e.question=="string"?e.question:"";return S?a.jsx("div",{className:"text-sm text-cc-fg bg-cc-code-bg/30 rounded-lg px-3 py-2",children:S}):a.jsx(E2,{input:e})}return a.jsxs("div",{className:"space-y-3",children:[i.map((S,T)=>{const j=typeof S.header=="string"?S.header:"",R=typeof S.question=="string"?S.question:"",C=Array.isArray(S.options)?S.options:[],P=String(T),z=l[P],D=h[P];return a.jsxs("div",{className:"space-y-2",children:[j&&a.jsx("span",{className:"inline-block text-[10px] font-semibold text-cc-primary bg-cc-primary/10 px-1.5 py-0.5 rounded",children:j}),R&&a.jsx("p",{className:"text-sm text-cc-fg leading-relaxed",children:R}),C.length>0&&a.jsxs("div",{className:"space-y-1.5",children:[C.map((F,B)=>{const I=typeof F.label=="string"?F.label:String(F),L=typeof F.description=="string"?F.description:"",q=z===I;return a.jsx("button",{onClick:()=>g(T,I),disabled:n,className:`w-full text-left px-3 py-2 rounded-lg border transition-all cursor-pointer disabled:opacity-50 ${q?"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:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`w-4 h-4 rounded-full border-2 flex items-center justify-center shrink-0 ${q?"border-cc-primary":"border-cc-muted/40"}`,children:q&&a.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-primary"})}),a.jsxs("div",{children:[a.jsx("span",{className:"text-xs font-medium text-cc-fg",children:I}),L&&a.jsx("p",{className:"text-[11px] text-cc-muted mt-0.5 leading-snug",children:L})]})]})},B)}),a.jsx("button",{onClick:()=>b(T),disabled:n,className:`w-full text-left px-3 py-2 rounded-lg border transition-all cursor-pointer disabled:opacity-50 ${D?"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:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`w-4 h-4 rounded-full border-2 flex items-center justify-center shrink-0 ${D?"border-cc-primary":"border-cc-muted/40"}`,children:D&&a.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-primary"})}),a.jsx("span",{className:"text-xs font-medium text-cc-muted",children:"Other..."})]})}),D&&a.jsxs("div",{className:"pl-6",children:[a.jsx("input",{type:"text",value:u[P]||"",onChange:F=>y(T,F.target.value),onKeyDown:F=>{F.key==="Enter"&&v(T)},placeholder:"Type your answer...",className:"w-full px-2.5 py-1.5 text-xs bg-cc-input-bg border border-cc-border rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/50",autoFocus:!0}),i.length<=1&&a.jsx("p",{className:"mt-1 text-[10px] text-cc-muted",children:"Press Enter to submit"})]})]})]},T)}),i.length>1&&Object.keys(l).length>0&&a.jsx("button",{onClick:_,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 p7({input:e}){const t=String(e.file_path||""),n=String(e.old_string||""),i=String(e.new_string||"");return a.jsx(pl,{oldText:n,newText:i,fileName:t,mode:"compact"})}function m7({input:e}){const t=String(e.file_path||""),n=String(e.content||"");return a.jsx(pl,{newText:n,fileName:t,mode:"compact"})}function g7({input:e}){const t=String(e.file_path||"");return a.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 x7({input:e}){const t=typeof e.pattern=="string"?e.pattern:"",n=typeof e.path=="string"?e.path:"";return a.jsxs("div",{className:"text-xs font-mono-code bg-cc-code-bg/30 rounded-lg px-3 py-2 space-y-0.5",children:[a.jsx("div",{className:"text-cc-fg",children:t}),n&&a.jsx("div",{className:"text-cc-muted",children:n})]})}function v7({input:e}){const t=typeof e.pattern=="string"?e.pattern:"",n=typeof e.path=="string"?e.path:"",i=typeof e.glob=="string"?e.glob:"";return a.jsxs("div",{className:"text-xs font-mono-code bg-cc-code-bg/30 rounded-lg px-3 py-2 space-y-0.5",children:[a.jsx("div",{className:"text-cc-fg",children:t}),n&&a.jsx("div",{className:"text-cc-muted",children:n}),i&&a.jsx("div",{className:"text-cc-muted",children:i})]})}function b7({input:e}){const t=typeof e.plan=="string"?e.plan:"",n=Array.isArray(e.allowedPrompts)?e.allowedPrompts:[];return a.jsxs("div",{className:"space-y-2",children:[t&&a.jsxs("div",{className:"rounded-xl border border-cc-border overflow-hidden bg-cc-card",children:[a.jsxs("div",{className:"px-3 py-2 border-b border-cc-border bg-cc-primary/[0.04] flex items-center gap-2",children:[a.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 rounded bg-cc-primary/15 text-cc-primary shrink-0",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:a.jsx("path",{d:"M3 3.5h10M3 8h10M3 12.5h6",strokeLinecap:"round"})})}),a.jsx("span",{className:"text-[11px] text-cc-primary font-semibold tracking-wide uppercase",children:"Plan"})]}),a.jsx("div",{className:"px-3 py-3 max-h-72 overflow-y-auto markdown-body text-[13px] text-cc-fg leading-relaxed",children:a.jsx(Qg,{remarkPlugins:[ex],components:{h1:({children:i})=>a.jsx("h1",{className:"text-base font-semibold text-cc-fg mb-2",children:i}),h2:({children:i})=>a.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-1.5 mt-3 first:mt-0",children:i}),h3:({children:i})=>a.jsx("h3",{className:"text-sm font-medium text-cc-fg mb-1.5 mt-2",children:i}),p:({children:i})=>a.jsx("p",{className:"mb-2 last:mb-0",children:i}),ul:({children:i})=>a.jsx("ul",{className:"list-disc pl-4 mb-2 space-y-0.5",children:i}),ol:({children:i})=>a.jsx("ol",{className:"list-decimal pl-4 mb-2 space-y-0.5",children:i}),li:({children:i})=>a.jsx("li",{children:i}),strong:({children:i})=>a.jsx("strong",{className:"font-semibold text-cc-fg",children:i}),a:({href:i,children:l})=>a.jsx("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"text-cc-primary hover:underline",children:l}),code:i=>{const{children:l,className:c}=i;return/language-(\w+)/.exec(c||"")||typeof l=="string"&&l.includes(`
|
|
98
|
+
`)?a.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:a.jsx("code",{children:l})}):a.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:l})},pre:({children:i})=>a.jsx(a.Fragment,{children:i}),blockquote:({children:i})=>a.jsx("blockquote",{className:"border-l-2 border-cc-primary/40 pl-2 text-cc-muted italic my-2",children:i})},children:t})})]}),n.length>0&&a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"text-[10px] text-cc-muted uppercase tracking-wider",children:"Requested permissions"}),a.jsx("div",{className:"space-y-1",children:n.map((i,l)=>a.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:[a.jsx("span",{className:"text-cc-muted shrink-0",children:String(i.tool||"")}),a.jsx("span",{className:"text-cc-fg",children:String(i.prompt||"")})]},l))})]}),!t&&n.length===0&&a.jsx("div",{className:"text-xs text-cc-muted",children:"Plan approval requested"})]})}function E2({input:e,description:t}){const n=Object.entries(e).filter(([,i])=>i!=null&&i!=="");return n.length===0&&t?a.jsx("div",{className:"text-xs text-cc-fg",children:t}):a.jsxs("div",{className:"space-y-1",children:[t&&a.jsx("div",{className:"text-xs text-cc-muted mb-1",children:t}),a.jsx("div",{className:"bg-cc-code-bg/30 rounded-lg px-3 py-2 space-y-1",children:n.map(([i,l])=>{const c=typeof l=="string"?l.length>200?l.slice(0,200)+"...":l:JSON.stringify(l);return a.jsxs("div",{className:"flex gap-2 text-[11px] font-mono-code",children:[a.jsxs("span",{className:"text-cc-muted shrink-0",children:[i,":"]}),a.jsx("span",{className:"text-cc-fg break-all",children:c})]},i)})})]})}function y7({entry:e,onDismiss:t}){const{request:n,behavior:i,reason:l}=e,c=i==="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 a.jsxs("div",{className:`flex items-center gap-2 px-3 py-1.5 text-[11px] ${c?"text-cc-success":"text-cc-error"}`,children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 shrink-0 opacity-70",children:a.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"})}),a.jsxs("span",{className:"flex-1",children:["AI auto-",c?"approved":"denied",":"," ",a.jsx("span",{className:"font-mono-code opacity-80",children:u}),l&&a.jsxs("span",{className:"text-cc-muted ml-1",children:["(",l,")"]})]}),t&&a.jsx("button",{onClick:t,className:"opacity-50 hover:opacity-100 transition-opacity cursor-pointer flex-shrink-0","aria-label":"Dismiss notification",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.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 _7=[],w7=[],y5="activity-tray-panel";function k7(e,t){const n=Math.round(((t||Date.now())-e)/1e3);if(n<60)return`${n}s`;const i=Math.floor(n/60),l=n%60;return`${i}m${l>0?` ${l}s`:""}`}function S7(e,t,n=4e3){const[i,l]=k.useState(!1),c=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(c.current),f?c.current=setTimeout(()=>l(!0),n):l(!1),()=>clearTimeout(c.current)),[f,n]),k.useEffect(()=>{l(!1)},[u]),i}function j7(e){const[t,n]=k.useState(0);return k.useEffect(()=>{if(!e)return;const i=setInterval(()=>n(l=>l+1),1e3);return()=>clearInterval(i)},[e]),t}function N7({status:e}){return e==="running"||e==="in_progress"?a.jsxs("span",{className:"relative flex h-1.5 w-1.5 shrink-0",children:[a.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-cc-warning opacity-75 animate-ping"}),a.jsx("span",{className:"relative inline-flex rounded-full h-1.5 w-1.5 bg-cc-warning"})]}):e==="completed"?a.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-cc-success shrink-0"}):e==="failed"?a.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-cc-error shrink-0"}):a.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-cc-muted/30 shrink-0"})}function C7({agent:e,tick:t}){const[n,i]=k.useState(!1),l=e.status!=="running",c=!!e.summary,u=a.jsxs(a.Fragment,{children:[a.jsx(N7,{status:e.status}),a.jsx("span",{className:"text-[11px] text-cc-fg/80 truncate flex-1 font-medium",children:e.name}),e.agentType&&a.jsx("span",{className:"text-[9px] text-cc-muted/50 uppercase tracking-wider shrink-0",children:e.agentType}),a.jsx("span",{className:"text-[10px] text-cc-muted/50 tabular-nums font-mono-code",children:k7(e.startedAt,e.completedAt)})]});return a.jsxs("div",{className:`transition-opacity duration-300 ${l?"opacity-60":""}`,children:[c?a.jsx("button",{type:"button",onClick:()=>i(!n),"aria-expanded":n,className:"w-full flex items-center gap-2 px-2.5 min-h-[36px] text-left hover:bg-cc-hover/50 rounded-md transition-colors cursor-pointer",children:u}):a.jsx("div",{className:"flex items-center gap-2 px-2.5 min-h-[36px]",children:u}),n&&e.summary&&a.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 E7({task:e}){const t=e.status==="completed",n=e.status==="in_progress";return a.jsxs("div",{className:`flex items-center gap-2 px-2.5 min-h-[32px] transition-opacity duration-300 ${t?"opacity-40":""}`,children:[a.jsx("span",{className:"shrink-0 flex items-center justify-center w-3.5 h-3.5",children:n?a.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:a.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"28",strokeDashoffset:"8",strokeLinecap:"round"})}):t?a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-success","aria-hidden":!0,children:a.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.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3.5 h-3.5 text-cc-muted/40","aria-hidden":!0,children:a.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"})})}),a.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&&a.jsx("span",{className:"text-[10px] text-cc-muted/50 italic truncate max-w-[120px] shrink-0",children:e.activeForm})]})}function T7({sessionId:e}){const[t,n]=k.useState(!1),i=k.useRef(null),l=k.useRef(null),c=X(C=>C.sessionTasks.get(e)??_7),u=X(C=>C.sessionBackgroundAgents.get(e)??w7),f=S7(c,u),h=u.some(C=>C.status==="running"),p=j7(h),g=u.filter(C=>C.status==="running").length,v=c.length,y=c.filter(C=>C.status==="completed").length,b=c.filter(C=>C.status==="in_progress").length,_=c.length>0||u.length>0,S=g>0||b>0,T=k.useCallback(()=>n(!1),[]);k.useEffect(()=>{if(!t)return;const C=P=>{P.key==="Escape"&&(P.stopPropagation(),T())};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[t,T]),k.useEffect(()=>{if(!t)return;const C=P=>{i.current&&!i.current.contains(P.target)&&T()};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[t,T]),k.useEffect(()=>{t&&l.current&&l.current.focus()},[t]);const[j,R]=k.useState(!1);return k.useEffect(()=>{_&&R(!1)},[_,c.length,u.length]),!_||j?null:a.jsxs("div",{ref:i,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&&R(!0)},children:[t&&a.jsxs("div",{ref:l,id:y5,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:[a.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-cc-border/40",children:[a.jsx("span",{className:"text-[11px] font-semibold text-cc-fg/70 uppercase tracking-wider",role:"heading","aria-level":3,children:"Activity"}),a.jsx("button",{type:"button",onClick:T,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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.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&&a.jsxs("div",{className:"py-1",children:[a.jsx("div",{className:"px-3 py-1",role:"heading","aria-level":4,children:a.jsx("span",{className:"text-[9px] text-cc-muted/40 uppercase tracking-widest font-semibold",children:"Agents"})}),u.map(C=>a.jsx(C7,{agent:C,tick:p},C.toolUseId))]}),u.length>0&&c.length>0&&a.jsx("div",{className:"border-t border-cc-border/30 mx-2",role:"separator"}),c.length>0&&a.jsxs("div",{className:"py-1",children:[a.jsx("div",{className:"px-3 py-1",role:"heading","aria-level":4,children:a.jsx("span",{className:"text-[9px] text-cc-muted/40 uppercase tracking-widest font-semibold",children:"Tasks"})}),c.map(C=>a.jsx(E7,{task:C},C.id))]})]}),a.jsxs("button",{type:"button",onClick:()=>n(!t),"aria-expanded":t,"aria-controls":y5,className:`
|
|
99
|
+
flex items-center gap-2 px-3 min-h-[36px] rounded-full
|
|
100
|
+
border border-cc-border/50 bg-cc-surface/90 backdrop-blur-lg
|
|
101
|
+
shadow-md shadow-black/15
|
|
102
|
+
hover:bg-cc-hover/80 hover:border-cc-border/70
|
|
103
|
+
transition-all duration-200 cursor-pointer
|
|
104
|
+
${t?"ring-1 ring-cc-primary/30":""}
|
|
105
|
+
`,"aria-label":`Activity: ${g} agents running, ${y}/${v} tasks`,children:[S?a.jsxs("span",{className:"relative flex h-2 w-2",children:[a.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-cc-warning opacity-75 animate-ping"}),a.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-cc-warning"})]}):a.jsx("span",{className:"h-2 w-2 rounded-full bg-cc-success"}),u.length>0&&a.jsx("span",{className:"text-[11px] text-cc-fg/70 font-medium tabular-nums",children:g>0?`${g} agent${g!==1?"s":""}`:`${u.length} done`}),u.length>0&&c.length>0&&a.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-cc-muted/30"}),c.length>0&&a.jsxs("span",{className:"text-[11px] text-cc-fg/70 tabular-nums",children:[y,"/",v]}),a.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:a.jsx("path",{d:"M4 6l4 4 4-4"})})]})]})}function A7({sessionId:e}){const t=X(_=>_.pendingPermissions.get(e)),n=X(_=>_.aiResolvedPermissions.get(e)),i=X(_=>_.clearAiResolvedPermissions),l=X(_=>_.connectionStatus.get(e)??"disconnected"),c=X(_=>_.cliConnected.get(e)??!1),u=X(_=>_.cliReconnecting.get(e)??!1),f=X(_=>_.setCliReconnecting),[h,p]=k.useState(null),g=k.useRef(void 0);k.useEffect(()=>{p(null),clearTimeout(g.current)},[e,c]),k.useEffect(()=>()=>clearTimeout(g.current),[]);const v=k.useCallback(async()=>{p(null),clearTimeout(g.current),f(e,!0);try{await we.relaunchSession(e)}catch(_){Jr(_),f(e,!1);const S=_ instanceof Error?_.message:"Reconnection failed";p(S),g.current=setTimeout(()=>p(null),4e3)}},[e,f]),y=k.useMemo(()=>t?Array.from(t.values()):[],[t]),b=l==="connected"&&!c;return a.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[b&&a.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?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cc-error shrink-0"}),a.jsx("span",{className:"text-xs text-cc-error font-medium",children:h}),a.jsx("button",{onClick:v,className:"text-xs font-medium px-3 py-1.5 rounded-lg bg-cc-error/12 hover:bg-cc-error/20 text-cc-error transition-all cursor-pointer",children:"Retry"})]}):u?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"w-3 h-3 rounded-full border-2 border-cc-warning/30 border-t-cc-warning animate-spin"}),a.jsx("span",{className:"text-xs text-cc-warning font-medium",children:"Reconnecting…"})]}):a.jsxs(a.Fragment,{children:[a.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"}),a.jsx("span",{className:"text-xs text-cc-warning font-medium",children:"CLI disconnected"}),a.jsx("button",{onClick:v,className:"text-xs font-medium px-3 py-1.5 rounded-lg bg-cc-warning/15 hover:bg-cc-warning/25 text-cc-warning transition-all cursor-pointer",children:"Reconnect"})]})}),l==="disconnected"&&a.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:[a.jsx("span",{className:"w-3 h-3 rounded-full border-2 border-cc-warning/30 border-t-cc-warning animate-spin"}),a.jsx("span",{className:"text-xs text-cc-warning font-medium",children:"Reconnecting to session..."})]}),a.jsxs("div",{className:"flex-1 flex flex-col min-h-0 relative",children:[a.jsx(t7,{sessionId:e}),a.jsx(T7,{sessionId:e})]}),n&&n.length>0&&a.jsx("div",{className:"shrink-0 border-t border-cc-border bg-cc-card",children:a.jsx(y7,{entry:n[n.length-1],onDismiss:()=>i(e)})}),y.length>0&&a.jsx("div",{className:"shrink-0 max-h-[60dvh] overflow-y-auto border-t border-cc-border bg-cc-card",children:y.map(_=>a.jsx(o7,{permission:_,sessionId:e},_.request_id))}),a.jsx(a7,{sessionId:e})]})}function M7({sessionId:e}){const[t,n]=k.useState(!1),i=k.useRef(null),l=X(p=>p.sessions.get(e)),c=(l==null?void 0:l.aiValidationEnabled)??!1,u=(l==null?void 0:l.aiValidationAutoApprove)??!0,f=(l==null?void 0:l.aiValidationAutoDeny)??!1;k.useEffect(()=>{if(!t)return;function p(g){i.current&&!i.current.contains(g.target)&&n(!1)}return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[t]);function h(p,g){const v=!g,y={[p]:v};X.getState().setSessionAiValidation(e,y),kN(e,y)}return a.jsxs("div",{ref:i,className:"relative",children:[a.jsx("button",{onClick:()=>n(!t),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer ${c?"text-cc-success hover:bg-cc-hover":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:c?"AI Validation: On":"AI Validation: Off","aria-label":"Toggle AI validation settings","aria-expanded":t,children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-[15px] h-[15px]",children:a.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&&a.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:[a.jsx("p",{className:"text-[10px] text-cc-muted px-2 pt-1 pb-1",children:"AI Validation for this session"}),a.jsxs("button",{type:"button",onClick:()=>h("aiValidationEnabled",c),className:"w-full flex items-center justify-between px-2 py-1.5 rounded-md hover:bg-cc-hover text-cc-fg transition-colors cursor-pointer","aria-label":"Toggle AI validation",children:[a.jsx("span",{className:"text-xs",children:"Enabled"}),a.jsx("span",{className:`text-[10px] font-medium ${c?"text-cc-success":"text-cc-muted"}`,children:c?"On":"Off"})]}),c&&a.jsxs(a.Fragment,{children:[a.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:[a.jsx("span",{className:"text-xs",children:"Auto-approve safe"}),a.jsx("span",{className:`text-[10px] font-medium ${u?"text-cc-success":"text-cc-muted"}`,children:u?"On":"Off"})]}),a.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:[a.jsx("span",{className:"text-xs",children:"Auto-deny dangerous"}),a.jsx("span",{className:`text-[10px] font-medium ${f?"text-cc-success":"text-cc-muted"}`,children:f?"On":"Off"})]})]})]})]})}function R7(){var F;const e=k.useSyncExternalStore(B=>(window.addEventListener("hashchange",B),()=>window.removeEventListener("hashchange",B)),()=>window.location.hash),t=k.useMemo(()=>Dg(e),[e]),n=t.page==="session"||t.page==="home",i=X(B=>B.currentSessionId),l=X(B=>B.cliConnected),c=X(B=>B.sessionStatus),u=X(B=>B.sessionNames),f=X(B=>B.sdkSessions),h=X(B=>B.sidebarOpen),p=X(B=>B.setSidebarOpen),g=X(B=>B.taskPanelOpen),v=X(B=>B.setTaskPanelOpen),y=X(B=>B.activeTab),b=X(B=>B.setActiveTab),_=X(B=>B.markChatTabReentry),S=X(B=>i?B.gitChangedFilesCount.get(i)??0:0),T=i?c.get(i)??null:null,j=i?l.get(i)??!1:!1,R=i?(u==null?void 0:u.get(i))||((F=f.find(B=>B.sessionId===i))==null?void 0:F.name)||`Session ${i.slice(0,8)}`:null,C=!!(i&&n),P=t.page==="session"&&!!i,z=["chat","diff"],D=B=>{B==="chat"&&y!=="chat"&&i&&_(i),b(B)};return k.useEffect(()=>{const B=I=>{if(!(I.metaKey||I.ctrlKey)||I.key.toLowerCase()!=="j"||!C)return;const L=I.target;if(L&&(L.tagName==="TEXTAREA"||L.tagName==="INPUT"||L.isContentEditable))return;I.preventDefault();const q=Math.max(0,z.indexOf(y)),E=I.shiftKey?-1:1,ae=(q+E+z.length)%z.length;D(z[ae])};return window.addEventListener("keydown",B),()=>window.removeEventListener("keydown",B)},[C,z,y,b,_,i]),a.jsx("header",{className:"relative shrink-0 h-11 px-4 bg-cc-bg",children:a.jsxs("div",{className:"h-full flex items-center gap-1 min-w-0",children:[a.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:a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 3h18v18H3V3z"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 3v18"})]})}),C&&a.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:[a.jsxs("button",{onClick:()=>D("chat"),className:`h-full px-3 text-[12px] font-medium transition-colors cursor-pointer flex items-center gap-1.5 border-b-[1.5px] shrink-0 ${y==="chat"?"text-cc-fg border-cc-primary":"text-cc-muted hover:text-cc-fg border-transparent"}`,title:R||"Session","aria-label":"Session tab",children:[a.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${j?T==="running"?"bg-cc-primary":T==="compacting"?"bg-cc-warning":"bg-cc-success":"bg-cc-muted opacity-45"}`}),"Session"]}),a.jsxs("button",{onClick:()=>D("diff"),className:`h-full px-3 text-[12px] font-medium transition-colors cursor-pointer flex items-center gap-1.5 border-b-[1.5px] shrink-0 ${y==="diff"?"text-cc-fg border-cc-primary":"text-cc-muted hover:text-cc-fg border-transparent"}`,"aria-label":"Diffs tab",children:["Diffs",S>0&&a.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:S})]})]}),a.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[C&&i&&a.jsx(M7,{sessionId:i}),a.jsx(D7,{}),P&&a.jsx("button",{onClick:()=>v(!g),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer ${g?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:"Toggle context panel","aria-label":"Toggle context panel",children:a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 3h18v18H3V3z"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 3v18"})]})})]})]})})}function D7(){const e=X(n=>n.darkMode),t=k.useCallback(()=>X.getState().toggleDarkMode(),[]);return a.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?a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[a.jsx("circle",{cx:"12",cy:"12",r:"4"}),a.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"})]}):a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:a.jsx("path",{d:"M21 12.79A9 9 0 1111.21 3a7 7 0 009.79 9.79z"})})})}const T2="cc-recent-dirs";function Pd(){try{return JSON.parse(localStorage.getItem(T2)||"[]")}catch{return[]}}function A2(e){const t=Pd().filter(n=>n!==e);t.unshift(e),localStorage.setItem(T2,JSON.stringify(t.slice(0,5)))}function M2({onClose:e,embedded:t=!1}){const[n,i]=k.useState([]),[l,c]=k.useState(!0),[u,f]=k.useState(null),[h,p]=k.useState(""),[g,v]=k.useState([]),[y,b]=k.useState(""),[_,S]=k.useState(!1),[T,j]=k.useState(""),[R,C]=k.useState([{key:"",value:""}]),[P,z]=k.useState(!1),D=k.useCallback(()=>{we.listEnvs().then(i).catch(()=>{}).finally(()=>c(!1))},[]);k.useEffect(()=>{D()},[D]);function F(Y){f(Y.slug),p(Y.name);const U=Object.entries(Y.variables).map(([$,re])=>({key:$,value:re}));U.length===0&&U.push({key:"",value:""}),v(U),b("")}function B(){f(null),b("")}async function I(){if(!u)return;const Y={};for(const U of g){const $=U.key.trim();$&&(Y[$]=U.value)}try{await we.updateEnv(u,{name:h.trim()||void 0,variables:Y}),f(null),b(""),D()}catch(U){b(U instanceof Error?U.message:String(U))}}async function L(Y){try{await we.deleteEnv(Y),u===Y&&f(null),D()}catch(U){b(U instanceof Error?U.message:String(U))}}async function q(){const Y=T.trim();if(!Y)return;z(!0);const U={};for(const $ of R){const re=$.key.trim();re&&(U[re]=$.value)}try{await we.createEnv(Y,U),j(""),C([{key:"",value:""}]),S(!1),b(""),D()}catch($){b($ instanceof Error?$.message:String($))}finally{z(!1)}}if(t)return a.jsx("div",{className:"h-full bg-cc-bg text-cc-fg font-sans-ui antialiased overflow-y-auto overflow-x-hidden",children:a.jsxs("div",{className:"max-w-2xl mx-auto px-4 sm:px-6 py-6 sm:py-10 pb-safe",children:[a.jsx("div",{className:"flex items-start justify-between gap-3 mb-2",children:a.jsxs("div",{className:"min-w-0",children:[a.jsx("h1",{className:"text-lg font-semibold text-cc-fg",children:"Environments"}),a.jsx("p",{className:"mt-0.5 text-[13px] text-cc-muted leading-relaxed",children:"Reusable runtime profiles."})]})}),a.jsxs("div",{className:"flex items-center gap-2 mt-4 mb-5",children:[a.jsx("div",{className:"flex-1"}),a.jsxs("button",{onClick:()=>S(!_),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:[a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:_?a.jsx("path",{d:"M18 6 6 18M6 6l12 12"}):a.jsx("path",{d:"M12 5v14M5 12h14"})}),a.jsx("span",{className:"hidden sm:inline",children:_?"Cancel":"New Environment"})]})]}),_&&a.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:[a.jsx("input",{type:"text",value:T,onChange:Y=>j(Y.target.value),placeholder:"Environment name (e.g. production)",className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow",onKeyDown:Y=>{Y.key==="Enter"&&T.trim()&&q()}}),a.jsx(ed,{rows:R,onChange:C}),y&&a.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:y}),a.jsxs("div",{className:"flex items-center justify-between pt-1",children:[a.jsxs("p",{className:"text-[11px] text-cc-muted",children:["Stored in ",a.jsx("code",{className:"text-[10px]",children:"~/.companion/envs/"})]}),a.jsx("button",{onClick:q,disabled:!T.trim()||P,className:`px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${T.trim()&&!P?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:P?"Creating...":"Create"})]})]}),a.jsx("div",{className:"flex items-center gap-2 mb-3 text-[12px] text-cc-muted",children:a.jsxs("span",{children:[n.length," environment",n.length!==1?"s":""]})}),l?a.jsx("div",{className:"py-12 text-center text-sm text-cc-muted",children:"Loading environments..."}):n.length===0?a.jsx("div",{className:"py-12 text-center text-sm text-cc-muted",children:"No environments yet."}):a.jsx("div",{className:"space-y-1",children:n.map(Y=>{const U=u===Y.slug,$=Object.keys(Y.variables).length;return U?a.jsxs("div",{className:"rounded-xl bg-cc-card p-4 space-y-3",style:{animation:"fadeSlideIn 150ms ease-out"},children:[a.jsx("input",{type:"text",value:h,onChange:re=>p(re.target.value),placeholder:"Environment name",className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),a.jsx("div",{className:"space-y-3",children:a.jsxs("div",{children:[a.jsx("div",{className:"text-[11px] font-medium text-cc-muted mb-1.5",children:"Variables"}),a.jsx(ed,{rows:g,onChange:v})]})}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx("button",{onClick:B,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"}),a.jsx("button",{onClick:()=>void I(),className:"px-4 py-2.5 min-h-[44px] text-sm rounded-lg font-medium bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Save"})]})]},Y.slug):a.jsx(z7,{env:Y,varCount:$,onStartEdit:()=>F(Y),onDelete:()=>void L(Y.slug)},Y.slug)})}),y&&!_&&a.jsx("div",{className:"mt-4 px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:y})]})});const E=a.jsxs("div",{className:"rounded-xl bg-cc-card p-4 space-y-2.5",children:[a.jsx("span",{className:"text-sm font-medium text-cc-fg",children:"New Environment"}),a.jsx("input",{type:"text",value:T,onChange:Y=>j(Y.target.value),placeholder:"Environment name (e.g. production)",className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow",onKeyDown:Y=>{Y.key==="Enter"&&T.trim()&&q()}}),a.jsx(ed,{rows:R,onChange:C}),a.jsx("button",{onClick:q,disabled:!T.trim()||P,className:`px-4 py-2.5 min-h-[44px] text-sm font-medium rounded-lg transition-colors ${T.trim()&&!P?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:P?"Creating...":"Create"})]}),ae=l?a.jsx("div",{className:"text-sm text-cc-muted text-center py-6",children:"Loading environments..."}):n.length===0?a.jsx("div",{className:"text-sm text-cc-muted text-center py-6",children:"No environments yet."}):a.jsx("div",{className:"space-y-3",children:n.map(Y=>a.jsxs("div",{className:"rounded-xl bg-cc-card overflow-hidden",children:[a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[a.jsx("span",{className:"text-sm font-medium text-cc-fg flex-1",children:Y.name}),a.jsxs("span",{className:"text-xs text-cc-muted",children:[Object.keys(Y.variables).length," var",Object.keys(Y.variables).length!==1?"s":""]}),u===Y.slug?a.jsx("button",{onClick:B,className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-fg cursor-pointer",children:"Cancel"}):a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>F(Y),className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-fg cursor-pointer",children:"Edit"}),a.jsx("button",{onClick:()=>L(Y.slug),className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-error cursor-pointer",children:"Delete"})]})]}),u===Y.slug&&a.jsxs("div",{className:"px-3 py-3 space-y-2",children:[a.jsx("input",{type:"text",value:h,onChange:U=>p(U.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"}),a.jsx("div",{className:"space-y-3",children:a.jsxs("div",{children:[a.jsx("div",{className:"text-[11px] font-medium text-cc-muted mb-1.5",children:"Variables"}),a.jsx(ed,{rows:g,onChange:v})]})}),a.jsx("button",{onClick:I,className:"px-4 py-2.5 min-h-[44px] text-sm font-medium bg-cc-primary hover:bg-cc-primary-hover text-white rounded-lg transition-colors cursor-pointer",children:"Save"})]}),u!==Y.slug&&Object.keys(Y.variables).length>0&&a.jsx("div",{className:"px-3 py-2.5 space-y-1",children:Object.entries(Y.variables).map(([U,$])=>a.jsxs("div",{className:"grid grid-cols-[auto_auto_minmax(0,1fr)] items-start gap-1.5 text-xs leading-5",children:[a.jsx("span",{className:"font-mono-code text-cc-fg break-all",children:U}),a.jsx("span",{className:"text-cc-muted",children:"="}),a.jsx("span",{className:"font-mono-code text-cc-muted break-all whitespace-pre-wrap",children:$})]},U))})]},Y.slug))}),K=a.jsxs("div",{className:"w-full max-w-lg max-h-[90dvh] sm:max-h-[80dvh] mx-0 sm:mx-4 flex flex-col bg-cc-bg rounded-t-[14px] sm:rounded-[14px] shadow-2xl overflow-hidden",onClick:Y=>Y.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between px-4 sm:px-5 py-3 sm:py-4",children:[a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("h2",{className:"text-sm font-semibold text-cc-fg",children:"Manage Environments"})}),e&&a.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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto px-3 sm:px-5 py-3 sm:py-4 pb-safe space-y-4",children:[y&&a.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:y}),ae,E]})]});return gl.createPortal(a.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 z7({env:e,varCount:t,onStartEdit:n,onDelete:i}){return a.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:[a.jsx("div",{className:"shrink-0 mt-0.5 w-7 h-7 rounded-md bg-cc-primary/10 flex items-center justify-center",children:a.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:a.jsx("path",{d:"M12 3v18M3 12h18M4.5 6.5l15 0M4.5 17.5h15M6.5 4.5v15M17.5 4.5v15"})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("span",{className:"text-sm font-medium text-cc-fg truncate",children:e.name})}),a.jsxs("p",{className:"mt-0.5 text-xs text-cc-muted",children:[t," variable",t!==1?"s":""]})]}),a.jsxs("div",{className:"shrink-0 flex items-center gap-0.5 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity",children:[a.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:a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:[a.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),a.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5Z"})]})}),a.jsx("button",{onClick:i,className:"p-2 min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0 sm:p-1.5 rounded-md text-cc-muted hover:text-cc-error hover:bg-cc-error/10 transition-colors cursor-pointer","aria-label":"Delete",children:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:a.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 ed({rows:e,onChange:t}){function n(c,u,f){const h=[...e];h[c]={...h[c],[u]:f},t(h)}function i(c){const u=e.filter((f,h)=>h!==c);u.length===0&&u.push({key:"",value:""}),t(u)}function l(){t([...e,{key:"",value:""}])}return a.jsxs("div",{className:"space-y-1.5",children:[e.map((c,u)=>a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("input",{type:"text",value:c.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"}),a.jsx("span",{className:"text-[10px] text-cc-muted",children:"="}),a.jsx("input",{type:"text",value:c.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"}),a.jsx("button",{onClick:()=>i(u),"aria-label":"Remove variable",className:"w-10 h-10 min-h-[44px] flex items-center justify-center rounded-lg text-cc-muted hover:text-cc-error hover:bg-cc-error/10 transition-colors cursor-pointer shrink-0",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]},u)),a.jsx("button",{onClick:l,className:"text-xs py-2 min-h-[44px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"+ Add variable"})]})}const L7=Object.freeze(Object.defineProperty({__proto__:null,EnvManager:M2},Symbol.toStringTag,{value:"Module"}));function O7(e){if(!e)return[];const t=e.split("/").filter(Boolean),n=[{label:"/",path:"/"}];let i="";for(const l of t)i+="/"+l,n.push({label:l,path:i});return n}function B7({initialPath:e,onSelect:t,onClose:n}){const[i,l]=k.useState(""),[c,u]=k.useState([]),[f,h]=k.useState(!0),[p,g]=k.useState(""),[v,y]=k.useState(""),[b,_]=k.useState(!1),[S,T]=k.useState(""),[j,R]=k.useState(-1),[C,P]=k.useState(!1),[z,D]=k.useState(()=>Pd()),F=k.useRef(null),B=k.useRef(null),I=k.useRef(null),L=k.useRef(new Map),q=k.useMemo(()=>{if(!S)return c;const $=S.toLowerCase();return c.filter(re=>re.name.toLowerCase().includes($))},[c,S]),E=k.useCallback(async $=>{h(!0),g(""),T(""),R(-1);try{const re=await we.listDirs($);l(re.path),u(re.dirs)}catch{g("Could not load directory"),u([])}finally{h(!1)}},[]);k.useEffect(()=>{E(e||void 0)},[]),k.useEffect(()=>{const $=F.current;if(!$)return;function re(M){if(M.key!=="Tab")return;const O=$.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(O.length===0)return;const Z=O[0],A=O[O.length-1];M.shiftKey&&document.activeElement===Z?(M.preventDefault(),A.focus()):!M.shiftKey&&document.activeElement===A&&(M.preventDefault(),Z.focus())}document.addEventListener("keydown",re);const xe=setTimeout(()=>{var M;(M=I.current)==null||M.focus()},80);return()=>{document.removeEventListener("keydown",re),clearTimeout(xe)}},[]);const ae=k.useCallback(()=>{C||(P(!0),setTimeout(n,150))},[n,C]);k.useEffect(()=>{function $(re){if(re.key==="Escape"){if(b)return;ae()}}return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[b,ae]),k.useEffect(()=>{function $(re){var M,O;if(b)return;if(re.key==="Backspace"&&document.activeElement!==I.current){if(i&&i!=="/"){re.preventDefault();const Z=i.split("/").slice(0,-1).join("/")||"/";E(Z)}return}const xe=q.length;if(xe!==0){if(re.key==="ArrowDown"){re.preventDefault();const Z=j<xe-1?j+1:0;R(Z),(M=L.current.get(Z))==null||M.focus()}else if(re.key==="ArrowUp"){re.preventDefault();const Z=j>0?j-1:xe-1;R(Z),(O=L.current.get(Z))==null||O.focus()}}}return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[b,q.length,j,i,E]),k.useEffect(()=>{var $;j>=0&&(($=L.current.get(j))==null||$.scrollIntoView({block:"nearest"}))},[j]);function K($){A2($),D(Pd()),t($),n()}const Y=O7(i),U=i.split("/").pop()||"/";return gl.createPortal(a.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:ae,children:a.jsxs("div",{ref:F,role:"dialog","aria-modal":"true","aria-label":"Select folder",className:`w-full max-w-lg h-[min(520px,90dvh)] mx-0 sm:mx-4 flex flex-col bg-cc-bg border border-cc-border rounded-t-[14px] sm:rounded-[14px] shadow-2xl overflow-hidden transition-transform duration-150 ${C?"translate-y-4 sm:translate-y-2 opacity-0":"translate-y-0 opacity-100"}`,style:{animation:"fadeSlideIn 200ms ease-out"},onClick:$=>$.stopPropagation(),children:[a.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:[a.jsx("h2",{className:"text-sm font-semibold text-cc-fg font-sans-ui",children:"Select Folder"}),a.jsx("button",{type:"button","aria-label":"Close",onClick:ae,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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),z.length>0&&a.jsxs("div",{className:"border-b border-cc-border shrink-0",role:"group","aria-label":"Recent directories",children:[a.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"}),a.jsx("ul",{className:"list-none m-0 p-0",children:z.map($=>a.jsx("li",{children:a.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:[a.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:[a.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"}),a.jsx("path",{fillRule:"evenodd",d:"M8 16A8 8 0 108 0a8 8 0 000 16zm7-8A7 7 0 111 8a7 7 0 0114 0z"})]}),a.jsx("span",{className:"font-medium truncate",children:$.split("/").pop()||$}),a.jsx("span",{className:"text-cc-muted font-mono-code text-[10px] truncate ml-auto",children:$})]})},$))})]}),a.jsx("div",{className:"px-4 py-2 border-b border-cc-border flex items-center gap-1.5 shrink-0 min-h-[40px]",children:b?a.jsx("input",{type:"text","aria-label":"Type a directory path",value:v,onChange:$=>y($.target.value),onKeyDown:$=>{$.key==="Enter"&&v.trim()&&K(v.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}):a.jsxs(a.Fragment,{children:[a.jsx("nav",{"aria-label":"Directory breadcrumb",className:"flex-1 min-w-0 flex items-center gap-0.5 overflow-x-auto",children:Y.map(($,re)=>{const xe=re===Y.length-1;return a.jsxs("span",{className:"flex items-center gap-0.5 shrink-0",children:[re>0&&a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 text-cc-muted opacity-40 shrink-0",children:a.jsx("path",{d:"M6 4l4 4-4 4"})}),a.jsx("button",{type:"button",onClick:()=>{xe||E($.path)},className:`text-[11px] font-mono-code px-1 py-0.5 rounded transition-colors whitespace-nowrap ${xe?"text-cc-fg font-medium cursor-default":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover cursor-pointer"}`,"aria-current":xe?"location":void 0,tabIndex:xe?-1:0,children:$.label})]},$.path)})}),a.jsx("button",{type:"button","aria-label":"Type path manually",onClick:()=>{_(!0),y(i)},className:"w-6 h-6 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer shrink-0",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.jsx("path",{d:"M11.013 1.427a1.75 1.75 0 012.474 0l1.086 1.086a1.75 1.75 0 010 2.474l-8.61 8.61c-.21.21-.47.364-.756.445l-3.251.93a.75.75 0 01-.927-.928l.929-3.25a1.75 1.75 0 01.445-.758l8.61-8.61zm1.414 1.06a.25.25 0 00-.354 0L3.463 11.098a.25.25 0 00-.064.108l-.563 1.97 1.971-.564a.25.25 0 00.108-.064l8.61-8.61a.25.25 0 000-.354l-1.098-1.097z"})})})]})}),!b&&a.jsxs("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:[a.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-cc-border shrink-0",children:[a.jsxs("div",{className:"flex-1 min-w-0 relative",children:[a.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:a.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"})}),a.jsx("input",{ref:I,type:"text","aria-label":"Filter directories",value:S,onChange:$=>{T($.target.value),R(-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"})]}),a.jsxs("button",{type:"button",onClick:()=>K(i),"aria-label":`Select ${U}`,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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 shrink-0","aria-hidden":"true",children:a.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"})}),a.jsx("span",{className:"hidden sm:inline","aria-hidden":"true",children:"Select"}),a.jsx("span",{className:"font-mono-code max-w-[100px] truncate","aria-hidden":"true",children:U})]})]}),a.jsx("div",{ref:B,className:"flex-1 min-h-0 overflow-y-auto","aria-label":"Subdirectories",children:f?a.jsx("div",{className:"px-4 py-2 space-y-1","aria-busy":"true","aria-label":"Loading directories",children:Array.from({length:6}).map(($,re)=>a.jsxs("div",{className:"flex items-center gap-2 py-1.5",children:[a.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"}}),a.jsx("div",{className:"h-3 rounded-sm flex-1",style:{maxWidth:`${50+re*17%40}%`,background:"linear-gradient(90deg, var(--color-cc-hover) 25%, var(--color-cc-active) 50%, var(--color-cc-hover) 75%)",backgroundSize:"200% 100%",animation:`shimmer 1.5s ease-in-out ${re*.1}s infinite`}})]},re))}):p?a.jsxs("div",{className:"px-4 py-8 flex flex-col items-center gap-2 text-center",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-5 h-5 text-cc-error/70",children:a.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"})}),a.jsx("p",{className:"text-xs text-cc-muted",children:p}),a.jsx("button",{type:"button",onClick:()=>E(i||void 0),className:"mt-1 text-xs text-cc-primary hover:text-cc-primary-hover transition-colors cursor-pointer font-medium",children:"Retry"})]}):q.length===0?a.jsxs("div",{className:"px-4 py-8 text-center",children:[a.jsx("p",{className:"text-xs text-cc-muted",children:S?"No matching directories":"No subdirectories"}),S&&a.jsx("button",{type:"button",onClick:()=>T(""),className:"mt-1 text-xs text-cc-primary hover:text-cc-primary-hover transition-colors cursor-pointer font-medium",children:"Clear filter"})]}):a.jsx("ul",{className:"list-none m-0 p-0",children:q.map(($,re)=>a.jsxs("li",{className:`flex items-center transition-colors ${j===re?"bg-cc-hover":"hover:bg-cc-hover"}`,children:[a.jsxs("button",{type:"button",ref:xe=>{xe?L.current.set(re,xe):L.current.delete(re)},onClick:()=>E($.path),onKeyDown:xe=>{xe.key==="Enter"&&(xe.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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-40 shrink-0",children:a.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"})}),a.jsx("span",{className:"truncate",children:$.name}),a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-25 shrink-0 ml-auto",children:a.jsx("path",{d:"M6 4l4 4-4 4"})})]}),a.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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.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))})}),a.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:[a.jsxs("span",{children:[a.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"↑↓"})," navigate"]}),a.jsxs("span",{children:[a.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"↵"})," select"]}),a.jsxs("span",{children:[a.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"⇐"})," parent"]}),a.jsxs("span",{className:"ml-auto",children:[a.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 $7(e,t){const n=t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,60);return`${e.toLowerCase()}-${n}`}function P7(e){return e.branchName&&e.branchName.trim()?e.branchName.trim():$7(e.identifier,e.title)}function Zo({className:e}){return a.jsxs("svg",{viewBox:"0 0 100 104",fill:"none","aria-hidden":"true",className:e,children:[a.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"}),a.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"}),a.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"}),a.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 U7({defaultProjectId:e,connectionId:t,onCreated:n,onClose:i}){const[l,c]=k.useState(""),[u,f]=k.useState(""),[h,p]=k.useState(""),[g,v]=k.useState(0),[y,b]=k.useState(!0),[_,S]=k.useState([]),[T,j]=k.useState(""),[R,C]=k.useState(""),[P,z]=k.useState(!0),[D,F]=k.useState(!1),[B,I]=k.useState("");k.useEffect(()=>{let q=!0;return Promise.all([we.getLinearStates(t),we.getLinearConnection(t)]).then(([E,ae])=>{var Y;if(!q)return;S(E.teams),j(ae.viewerId);const K=((Y=E.teams[0])==null?void 0:Y.id)||"";p(K)}).catch(E=>{q&&I(E instanceof Error?E.message:"Failed to load teams")}).finally(()=>{q&&z(!1)}),()=>{q=!1}},[t]),k.useEffect(()=>{if(!h||_.length===0){C("");return}const q=_.find(ae=>ae.id===h),E=q==null?void 0:q.states.find(ae=>ae.type==="backlog");C((E==null?void 0:E.id)||"")},[h,_]);async function L(){if(!(!l.trim()||!h)){F(!0),I("");try{const q=await we.createLinearIssue({title:l.trim(),description:u.trim()||void 0,teamId:h,priority:g,projectId:e||void 0,assigneeId:y&&T?T:void 0,stateId:R||void 0,connectionId:t});n(q.issue)}catch(q){I(q instanceof Error?q.message:"Failed to create issue")}finally{F(!1)}}}return gl.createPortal(a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:i,children:a.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:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-sm font-semibold text-cc-fg",children:"Create Linear Issue"}),a.jsx("button",{type:"button",onClick:i,className:"inline-flex h-6 w-6 items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.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"})})})]}),B&&a.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:B}),P?a.jsx("div",{className:"py-8 text-xs text-cc-muted text-center",children:"Loading teams..."}):a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"create-issue-title",className:"text-xs text-cc-muted block mb-1",children:"Title *"}),a.jsx("input",{id:"create-issue-title",type:"text",value:l,onChange:q=>c(q.target.value),onKeyDown:q=>{q.key==="Enter"&&l.trim()&&h&&!D&&L()},placeholder:"Issue title",autoFocus:!0,className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60"})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"create-issue-desc",className:"text-xs text-cc-muted block mb-1",children:"Description"}),a.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"})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"create-issue-team",className:"text-xs text-cc-muted block mb-1",children:"Team *"}),a.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=>a.jsxs("option",{value:q.id,children:[q.name," (",q.key,")"]},q.id))})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"create-issue-priority",className:"text-xs text-cc-muted block mb-1",children:"Priority"}),a.jsxs("select",{id:"create-issue-priority",value:g,onChange:q=>v(Number(q.target.value)),className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg cursor-pointer",children:[a.jsx("option",{value:0,children:"No priority"}),a.jsx("option",{value:1,children:"Urgent"}),a.jsx("option",{value:2,children:"High"}),a.jsx("option",{value:3,children:"Medium"}),a.jsx("option",{value:4,children:"Low"})]})]}),a.jsxs("label",{htmlFor:"create-issue-assign",className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("input",{id:"create-issue-assign",type:"checkbox",checked:y,onChange:q=>b(q.target.checked),className:"rounded border-cc-border text-cc-primary focus:ring-cc-primary/30 cursor-pointer"}),a.jsx("span",{className:"text-xs text-cc-muted",children:"Assign to me"})]}),a.jsxs("div",{className:"flex gap-2.5 pt-2",children:[a.jsx("button",{type:"button",onClick:i,className:"flex-1 px-3 py-2 text-xs font-medium rounded-lg bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),a.jsx("button",{type:"button",onClick:L,disabled:!l.trim()||!h||D,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:D?"Creating...":"Create Issue"})]})]})]})}),document.body)}function F7({cwd:e,gitRepoInfo:t,linearConfigured:n,selectedLinearIssue:i,onIssueSelect:l,onBranchFromIssue:c,onConnectionSelect:u}){const[f,h]=k.useState([]),[p,g]=k.useState(null),[v,y]=k.useState(!1),[b,_]=k.useState(""),[S,T]=k.useState([]),[j,R]=k.useState(!1),[C,P]=k.useState(!1),[z,D]=k.useState(""),[F,B]=k.useState(!1),[I,L]=k.useState(null),[q,E]=k.useState([]),[ae,K]=k.useState(!1),[Y,U]=k.useState(""),[$,re]=k.useState(!1),[xe,M]=k.useState([]),[O,Z]=k.useState(!1),[A,fe]=k.useState(""),[_e,je]=k.useState(!1),[De,oe]=k.useState([]),[Ee,Fe]=k.useState(!1),[At,Ze]=k.useState(!1),Mt=k.useRef(null);k.useEffect(()=>{function ke(ze){Mt.current&&!Mt.current.contains(ze.target)&&(R(!1),re(!1))}return document.addEventListener("pointerdown",ke),()=>document.removeEventListener("pointerdown",ke)},[]),k.useEffect(()=>{if(!n){h([]),g(null),y(!1),u(null);return}let ke=!0;return we.listLinearConnections().then(({connections:ze})=>{ke&&(h(ze),y(!0),ze.length>0?(g(ze[0].id),u(ze[0].id)):(g(null),u(null)))}).catch(()=>{ke&&y(!0)}),()=>{ke=!1}},[n]);const vt=k.useCallback(ke=>{g(ke),u(ke),l(null),T([]),_(""),D(""),oe([]),fe(""),M([]),I&&(K(!0),U(""),we.getLinearProjectIssues(I.projectId,10,ke).then(({issues:ze})=>{E(ze)}).catch(ze=>{U(ze instanceof Error?ze.message:String(ze))}).finally(()=>{K(!1)}))},[I,u,l]);k.useEffect(()=>{if(!t||!n){L(null),E([]);return}let ke=!0;return K(!0),U(""),(async()=>{try{const{mapping:ze}=await we.getLinearProjectMapping(t.repoRoot);if(!ke)return;if(L(ze),ze){const{issues:ot}=await we.getLinearProjectIssues(ze.projectId,10,p??void 0);if(!ke)return;E(ot)}else E([])}catch(ze){if(!ke)return;U(ze instanceof Error?ze.message:String(ze))}finally{ke&&K(!1)}})(),()=>{ke=!1}},[t,n,p]),k.useEffect(()=>{if(!n)return;const ke=b.trim();if(ke.length<2){T([]),D(""),P(!1);return}let ze=!0;P(!0),D("");const ot=setTimeout(()=>{we.searchLinearIssues(ke,8,p??void 0).then(Pe=>{ze&&T(Pe.issues)}).catch(Pe=>{ze&&(T([]),D(Pe instanceof Error?Pe.message:String(Pe)))}).finally(()=>{ze&&P(!1)})},400);return()=>{ze=!1,clearTimeout(ot)}},[n,b,p]),k.useEffect(()=>{if(!n||!_e){oe([]),Fe(!1);return}const ke=A.trim();if(ke.length<2){oe([]),Fe(!1);return}let ze=!0;Fe(!0);const ot=setTimeout(()=>{we.searchLinearIssues(ke,10,p??void 0).then(Pe=>{ze&&oe(Pe.issues)}).catch(()=>{ze&&oe([])}).finally(()=>{ze&&Fe(!1)})},400);return()=>{ze=!1,clearTimeout(ot)}},[n,_e,A,p]);function qe(ke,ze=!1){l(ke),_(`${ke.identifier} - ${ke.title}`);const ot=P7(ke);c(ot,!0),ze&&R(!1)}function Pt(){l(null),_(""),T([]),D("")}async function vn(ke){if(t)try{const{mapping:ze}=await we.upsertLinearProjectMapping({repoRoot:t.repoRoot,projectId:ke.id,projectName:ke.name});L(ze),re(!1),K(!0),U("");const{issues:ot}=await we.getLinearProjectIssues(ke.id,10,p??void 0);E(ot)}catch(ze){U(ze instanceof Error?ze.message:String(ze))}finally{K(!1)}}async function un(){if(t){try{await we.removeLinearProjectMapping(t.repoRoot)}catch{}L(null),E([]),l(null),_("")}}function tn(){if(!n){window.location.hash="#/integrations/linear";return}re(!0),xe.length===0&&(Z(!0),we.listLinearProjects(p??void 0).then(({projects:ke})=>M(ke)).catch(()=>{}).finally(()=>Z(!1)))}function nn(ke){Ze(!1),qe(ke),I&&(K(!0),we.getLinearProjectIssues(I.projectId,10,p??void 0).then(({issues:ze})=>E(ze)).catch(()=>{}).finally(()=>K(!1)))}return n?a.jsxs("aside",{className:"space-y-2 mt-0.5",ref:Mt,children:[a.jsxs("div",{className:"relative rounded-[12px] border border-cc-border bg-cc-card/90 px-2.5 py-2",title:`Repo: ${e}`,children:[a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsx("span",{className:"text-[11px] uppercase tracking-wide text-cc-muted",children:"Context"}),v&&f.length>1&&a.jsx("select",{value:p??"",onChange:ke=>vt(ke.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(ke=>a.jsx("option",{value:ke.id,children:ke.workspaceName||ke.name},ke.id))}),I?a.jsxs(a.Fragment,{children:[a.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:[a.jsx(Zo,{className:"w-3.5 h-3.5"}),a.jsx("span",{children:I.projectName}),a.jsx("button",{type:"button",onClick:un,className:"ml-0.5 hover:text-cc-error transition-colors cursor-pointer",title:"Detach Linear project",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.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"})})})]}),a.jsxs("button",{type:"button",onClick:()=>Ze(!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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.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"})}),a.jsx("span",{children:"Create issue"})]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button","aria-expanded":j,onClick:()=>{if(!n){window.location.hash="#/integrations/linear";return}R(!j)},className:`inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs border transition-colors cursor-pointer ${i?"border-cc-primary/35 bg-cc-primary/10 text-cc-primary":n?"border-cc-border bg-cc-hover/70 text-cc-fg hover:bg-cc-hover":"border-amber-500/25 bg-amber-500/10 text-amber-600 dark:text-amber-300"}`,children:[a.jsx(Zo,{className:"w-3.5 h-3.5"}),a.jsx("span",{children:"Linear"})]}),n&&t&&a.jsxs("button",{type:"button",onClick:tn,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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.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"})}),a.jsx("span",{children:"Attach project"})]}),n&&a.jsxs("button",{type:"button",onClick:()=>Ze(!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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.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"})}),a.jsx("span",{children:"Create issue"})]}),!n&&a.jsx("span",{className:"text-[11px] text-amber-600 dark:text-amber-300",children:"Configure Linear to attach an issue."})]})]}),I&&(()=>{const ke=A.trim().toLowerCase(),ze=!_e&&ke?q.filter(Pe=>Pe.identifier.toLowerCase().includes(ke)||Pe.title.toLowerCase().includes(ke)):_e?[]:q,ot=_e?De:ze;return a.jsxs("div",{className:"mt-2",children:[i&&a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsxs("div",{className:"flex-1 min-w-0 text-xs text-cc-primary truncate",children:[a.jsx("span",{className:"font-mono-code",children:i.identifier})," - ",i.title]}),a.jsx("button",{type:"button",onClick:Pt,className:"text-cc-muted hover:text-cc-fg transition-colors cursor-pointer shrink-0",title:"Remove issue",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.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"})})})]}),a.jsx("input",{type:"text",value:A,onChange:Pe=>fe(Pe.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"}),ae?a.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Loading recent issues..."}):Y?a.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-error",children:Y}):Ee?a.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Searching..."}):_e&&ke.length<2?a.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Type at least 2 characters to search all projects..."}):ot.length===0?a.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:ke?"No matching issues":"No active issues found"}):a.jsx("div",{className:"max-h-56 overflow-y-auto -mx-0.5 mt-1",children:ot.map(Pe=>a.jsxs("button",{type:"button",onClick:()=>qe(Pe),className:`w-full px-2 py-1.5 text-left rounded-md transition-colors cursor-pointer ${(i==null?void 0:i.id)===Pe.id?"bg-cc-primary/10 border border-cc-primary/30":"hover:bg-cc-hover"}`,children:[a.jsxs("div",{className:"text-xs text-cc-fg truncate",children:[a.jsx("span",{className:"font-mono-code",children:Pe.identifier})," ",Pe.title]}),a.jsx("div",{className:"text-[10px] text-cc-muted truncate",children:[Pe.stateName,Pe.priorityLabel].filter(Boolean).join(" - ")})]},Pe.id))}),a.jsxs("label",{className:"mt-1.5 flex items-center gap-1.5 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:_e,onChange:Pe=>{je(Pe.target.checked),Pe.target.checked||oe([])},className:"rounded border-cc-border text-cc-primary focus:ring-cc-primary/30 cursor-pointer"}),a.jsx("span",{className:"text-[11px] text-cc-muted",children:"Search all projects"})]})]})})(),$&&a.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:[a.jsx("div",{className:"p-2 border-b border-cc-border",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-xs text-cc-fg font-medium",children:"Attach a Linear project to this repo"}),a.jsx("button",{type:"button",onClick:()=>re(!1),className:"px-2 py-1 rounded-md text-xs bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Close"})]})}),O?a.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Loading projects..."}):xe.length===0?a.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"No projects found"}):a.jsx("div",{className:"max-h-48 overflow-y-auto",children:xe.map(ke=>a.jsx("button",{type:"button",onClick:()=>vn(ke),className:"w-full px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:a.jsx("div",{className:"text-xs text-cc-fg",children:ke.name})},ke.id))})]}),j&&n&&a.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:[a.jsxs("div",{className:"p-2 border-b border-cc-border",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{type:"text",value:b,onChange:ke=>{_(ke.target.value)},onFocus:()=>R(!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"}),a.jsx("button",{type:"button",onClick:()=>{R(!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"})]}),a.jsxs("div",{className:"mt-1.5 flex items-center justify-between text-[11px] text-cc-muted",children:[a.jsx("span",{children:"Attach an issue to this draft"}),a.jsx("button",{type:"button",onClick:()=>{window.location.hash="#/integrations/linear"},className:"hover:text-cc-fg underline underline-offset-2 cursor-pointer",children:"Settings"})]})]}),b.trim().length<2&&a.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Type at least 2 characters…"}),b.trim().length>=2&&C&&a.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Searching Linear..."}),b.trim().length>=2&&!C&&z&&a.jsx("div",{className:"px-3 py-2 text-xs text-cc-error",children:z}),b.trim().length>=2&&!C&&!z&&S.length===0&&a.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"No matching issues"}),b.trim().length>=2&&!C&&!z&&a.jsx("div",{className:"max-h-56 overflow-y-auto",children:S.map(ke=>a.jsxs("button",{type:"button",onClick:()=>qe(ke,!0),className:"w-full px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:[a.jsxs("div",{className:"text-xs text-cc-fg truncate",children:[a.jsx("span",{className:"font-mono-code",children:ke.identifier})," - ",ke.title]}),a.jsx("div",{className:"text-[10px] text-cc-muted truncate",children:[ke.stateName,ke.teamName].filter(Boolean).join(" • ")})]},ke.id))})]}),a.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:a.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-3.5 h-3.5",children:a.jsx("path",{fillRule:"evenodd",d:"M11.49 3.17c-.38-1.56-2.6-1.56-2.98 0a1.53 1.53 0 01-2.29.95c-1.35-.8-2.92.77-2.12 2.12.54.9.07 2.04-.95 2.29-1.56.38-1.56 2.6 0 2.98 1.02.25 1.49 1.39.95 2.29-.8 1.35.77 2.92 2.12 2.12.9-.54 2.04-.07 2.29.95.38 1.56 2.6 1.56 2.98 0 .25-1.02 1.39-1.49 2.29-.95 1.35.8 2.92-.77 2.12-2.12-.54-.9-.07-2.04.95-2.29 1.56-.38 1.56-2.6 0-2.98-1.02-.25-1.49-1.39-.95-2.29.8-1.35-.77-2.92-2.12-2.12-.9.54-2.04.07-2.29-.95zM10 13a3 3 0 100-6 3 3 0 000 6z",clipRule:"evenodd"})})})]}),F&&a.jsxs("div",{className:"p-3 rounded-[10px] bg-amber-500/10 border border-amber-500/20",children:[a.jsx("p",{className:"text-xs text-amber-700 dark:text-amber-300 leading-snug",children:"Warning: Linear is not configured. Continue anyway?"}),a.jsx("div",{className:"flex gap-2 mt-2.5",children:a.jsx("button",{type:"button",onClick:()=>{B(!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"})})]}),At&&a.jsx(U7,{defaultProjectId:I==null?void 0:I.projectId,connectionId:p??void 0,onCreated:nn,onClose:()=>Ze(!1)})]}):null}function H7({cwd:e,gitRepoInfo:t,selectedBranch:n,isNewBranch:i,useWorktree:l,onBranchChange:c,onWorktreeChange:u,onBranchesLoaded:f}){const[h,p]=k.useState([]),[g,v]=k.useState(!1),[y,b]=k.useState(""),_=k.useRef(null);return k.useEffect(()=>{function S(T){_.current&&!_.current.contains(T.target)&&v(!1)}return document.addEventListener("pointerdown",S),()=>document.removeEventListener("pointerdown",S)},[]),k.useEffect(()=>{t?we.listBranches(t.repoRoot).then(S=>{p(S),f(S)}).catch(()=>{p([]),f([])}):(p([]),f([]))},[t]),t?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"relative",ref:_,children:[a.jsxs("button",{"aria-expanded":g,onClick:()=>{!g&&t&&we.gitFetch(t.repoRoot).catch(()=>{}).finally(()=>{we.listBranches(t.repoRoot).then(S=>{p(S),f(S)}).catch(()=>{p([]),f([])})}),v(!g),b("")},className:"flex items-center gap-1.5 px-2 py-1 text-xs rounded-md transition-colors cursor-pointer text-cc-muted hover:text-cc-fg hover:bg-cc-hover",title:`Repository: ${e}`,"data-is-new-branch":i?"true":"false",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-60",children:a.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"})}),a.jsx("span",{className:"max-w-[100px] sm:max-w-[160px] truncate font-mono-code",children:n||t.currentBranch}),a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:a.jsx("path",{d:"M4 6l4 4 4-4"})})]}),g&&a.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:[a.jsx("div",{className:"px-2 py-2 border-b border-cc-border",children:a.jsx("input",{type:"text",value:y,onChange:S=>b(S.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:S=>{S.key==="Escape"&&v(!1)}})}),a.jsx("div",{className:"max-h-[240px] overflow-y-auto py-1",children:(()=>{const S=y.toLowerCase().trim(),T=h.filter(P=>!P.isRemote&&(!S||P.name.toLowerCase().includes(S))),j=h.filter(P=>P.isRemote&&(!S||P.name.toLowerCase().includes(S))),R=h.some(P=>P.name.toLowerCase()===S),C=T.length>0||j.length>0;return a.jsxs(a.Fragment,{children:[T.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"px-3 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:"Local"}),T.map(P=>a.jsxs("button",{onClick:()=>{c(P.name,!1),v(!1)},className:`w-full px-3 py-1.5 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 ${P.name===n?"text-cc-primary font-medium":"text-cc-fg"}`,children:[a.jsx("span",{className:"truncate font-mono-code",children:P.name}),a.jsxs("span",{className:"ml-auto flex items-center gap-1.5 shrink-0",children:[P.ahead>0&&a.jsxs("span",{className:"text-[9px] text-green-500",children:[P.ahead,"↑"]}),P.behind>0&&a.jsxs("span",{className:"text-[9px] text-amber-500",children:[P.behind,"↓"]}),P.worktreePath&&a.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-blue-500/15 text-blue-600 dark:text-blue-400",children:"wt"}),P.isCurrent&&a.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-green-500/15 text-green-600 dark:text-green-400",children:"current"})]})]},P.name))]}),j.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"px-3 py-1 text-[10px] text-cc-muted uppercase tracking-wider mt-1",children:"Remote"}),j.map(P=>a.jsxs("button",{onClick:()=>{c(P.name,!1),v(!1)},className:`w-full px-3 py-1.5 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 ${P.name===n?"text-cc-primary font-medium":"text-cc-fg"}`,children:[a.jsx("span",{className:"truncate font-mono-code",children:P.name}),a.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-cc-hover text-cc-muted ml-auto shrink-0",children:"remote"})]},`remote-${P.name}`))]}),!C&&S&&a.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted text-center",children:"No matching branches"}),S&&!R&&a.jsx("div",{className:"border-t border-cc-border mt-1 pt-1",children:a.jsxs("button",{onClick:()=>{c(y.trim(),!0),v(!1)},className:"w-full px-3 py-1.5 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 text-cc-primary",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 shrink-0",children:a.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"})}),a.jsxs("span",{children:["Create ",a.jsx("span",{className:"font-mono-code font-medium",children:y.trim()})]})]})})]})})()})]})]}),a.jsxs("button",{onClick:()=>u(!l),className:`flex items-center gap-1.5 px-2 py-1 text-xs rounded-md transition-colors cursor-pointer ${l?"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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 opacity-70",children:a.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"})}),a.jsx("span",{children:"Worktree"})]})]}):null}const q7=336*60*60*1e3,Ks=12,I7=24;function dg(e){return e.split("/").filter(Boolean).pop()||e}function _5(e){var t,n;return((t=e.name)==null?void 0:t.trim())||((n=e.slug)==null?void 0:n.trim())||dg(e.cwd)}function V7(e){return e.length>8?e.slice(0,8):e}function G7(e,t=2){const n=e.split("/").filter(Boolean);return n.length<=t?e:`.../${n.slice(-t).join("/")}`}function Y7(e){if(!Number.isFinite(e)||e<=0)return"Unknown";const t=Date.now()-e;if(t<6e4)return"Just now";const n=Math.floor(t/6e4);if(n<60)return`${n}m ago`;const i=Math.floor(n/60);if(i<24)return`${i}h ago`;const l=Math.floor(i/24);if(l<14)return`${l}d ago`;const c=Math.floor(l/7);if(c<8)return`${c}w ago`;const u=Math.floor(l/30);return`${Math.max(1,u)}mo ago`}function W7(){var fa,Cc;const[e,t]=k.useState(""),[n,i]=k.useState(()=>localStorage.getItem("cc-backend")||"claude"),[l,c]=k.useState([]),[u,f]=k.useState(()=>p5(localStorage.getItem("cc-backend")||"claude")),[h,p]=k.useState(()=>m5(localStorage.getItem("cc-backend")||"claude")),[g,v]=k.useState(()=>Pd()[0]||""),[y,b]=k.useState([]),[_,S]=k.useState(null),[T,j]=k.useState(!1),[R,C]=k.useState(""),[P,z]=k.useState(null),[D,F]=k.useState(!1),[B,I]=k.useState(null),[L,q]=k.useState(null),[E,ae]=k.useState(()=>localStorage.getItem("cc-onboarding-dismissed")!=="true"),K=P||j2(n),Y=h5(n),[U,$]=k.useState([]),[re,xe]=k.useState(()=>localStorage.getItem("cc-selected-env")||""),[M,O]=k.useState(!1),[Z,A]=k.useState(!1),[fe,_e]=k.useState(()=>localStorage.getItem("cc-sandbox-enabled")==="true"),[je,De]=k.useState([]),[oe,Ee]=k.useState(()=>localStorage.getItem("cc-selected-sandbox")||""),[Fe,At]=k.useState(!1),Ze=k.useRef(null),[Mt,vt]=k.useState(null),qe=k.useRef(null),Pt=k.useRef(null),[vn,un]=k.useState(!1),[tn,nn]=k.useState(!1),[ke,ze]=k.useState(!1),[ot,Pe]=k.useState(!1),[bn,le]=k.useState(""),[be,W]=k.useState(!0),[he,Ae]=k.useState([]),[ut,Qe]=k.useState(!1),[Je,gt]=k.useState(""),[Ut,J]=k.useState(!1),[pe,me]=k.useState(Ks),[Ke,_t]=k.useState(""),[xt,$n]=k.useState(null),[Rt,Cn]=k.useState(!1),[Er,Ri]=k.useState(""),[bl,Br]=k.useState(!1),[bs,Xd]=k.useState([]),[Di,ys]=k.useState(null),[_s,zi]=k.useState(!1),[la,$r]=k.useState(""),[_c,dr]=k.useState(0),Wt=k.useRef(null),Dt=k.useRef(null),Pr=k.useRef(null),ws=k.useRef(null),yl=k.useRef(null),wc=X(G=>G.currentSessionId),Gt=C2({text:e,caretPos:_c,cwd:g||void 0});k.useEffect(()=>{if(Wt.current===null||!Dt.current)return;const G=Wt.current;Dt.current.setSelectionRange(G,G),Wt.current=null},[e]),k.useEffect(()=>{var ge;window.matchMedia("(min-width: 640px)").matches&&((ge=Dt.current)==null||ge.focus())},[]),k.useEffect(()=>{we.getHome().then(({home:G,cwd:ge})=>{g||v(ge||G)}).catch(()=>{}),we.listEnvs().then($).catch(()=>{}),we.listSandboxes().then(De).catch(()=>{}),we.getBackends().then(c).catch(()=>{}),we.getSettings().then(G=>{F(G.linearApiKeyConfigured)}).catch(()=>{})},[]);function ks(G){i(G),localStorage.setItem("cc-backend",G),z(null),f(p5(G)),p(m5(G)),G!=="claude"&&(Pe(!1),Ae([]),gt(""),Qe(!1),J(!1),me(Ks),_t(""))}k.useEffect(()=>{if(n!=="codex"){z(null);return}we.getBackendModels(n).then(G=>{if(G.length>0){const ge=i7(G);z(ge),ge.some(Ve=>Ve.value===u)||f(ge[0].value)}}).catch(()=>{})},[n]),k.useEffect(()=>{if(qe.current&&(clearInterval(qe.current),qe.current=null),vt(null),!fe)return;const G="the-companion:latest",ge=()=>{we.getImageStatus(G).then(Ve=>{vt(Ve),Ve.status==="idle"&&we.pullImage(G).catch(()=>{}),(Ve.status==="ready"||Ve.status==="error")&&qe.current&&(clearInterval(qe.current),qe.current=null)}).catch(()=>{})};return ge(),qe.current=setInterval(ge,2e3),()=>{qe.current&&(clearInterval(qe.current),qe.current=null)}},[fe]),k.useEffect(()=>{function G(ge){Pr.current&&!Pr.current.contains(ge.target)&&un(!1),ws.current&&!ws.current.contains(ge.target)&&nn(!1),yl.current&&!yl.current.contains(ge.target)&&O(!1),Ze.current&&!Ze.current.contains(ge.target)&&At(!1)}return document.addEventListener("pointerdown",G),()=>document.removeEventListener("pointerdown",G)},[]),k.useEffect(()=>{if(!g){$n(null);return}we.getRepoInfo(g).then(G=>{$n(G),Ri(G.currentBranch),Br(!1)}).catch(()=>{$n(null),Ri(""),Br(!1)})},[g]);const oa=K.find(G=>G.value===u)||K[0],Li=Y.find(G=>G.value===h)||Y[0],Oi=n==="codex"?"/logo-codex.svg":"/logo.svg",Ss=g?g.split("/").pop()||g:"Select folder",Ur=k.useMemo(()=>bn.trim(),[bn]),Zt=n==="claude"&&ot&&Ur.length>0,Fr=k.useMemo(()=>{const G=Date.now()-q7;return he.filter(ge=>ge.createdAt>=G)},[he]),ca=k.useMemo(()=>Ut?he:Fr.length>0?Fr:he,[Ut,Fr,he]),pn=k.useMemo(()=>Ke.trim().toLowerCase(),[Ke]),Rn=k.useMemo(()=>pn?ca.filter(G=>{const ge=_5(G).toLowerCase(),Ve=dg(G.cwd).toLowerCase(),ft=(G.gitBranch||"").toLowerCase(),st=G.cwd.toLowerCase(),Be=G.resumeSessionId.toLowerCase();return ge.includes(pn)||Ve.includes(pn)||ft.includes(pn)||st.includes(pn)||Be.includes(pn)}):ca,[ca,pn]),_l=k.useMemo(()=>Rn.slice(0,pe),[Rn,pe]),kc=pe<Rn.length,wl=Math.max(0,he.length-Fr.length),Qd=!Ut&&Fr.length>0,Bi=k.useCallback(async()=>{if(n==="claude"){Qe(!0),gt("");try{const[G,ge]=await Promise.all([we.listSessions(),we.discoverClaudeSessions(400).then(Be=>Be.sessions)]),Ve=new Map,ft=Be=>{const dn=Ve.get(Be.resumeSessionId);(!dn||Be.createdAt>dn.createdAt)&&Ve.set(Be.resumeSessionId,Be)};for(const Be of G)Be.backendType!=="codex"&&Be.cliSessionId&&ft({resumeSessionId:Be.cliSessionId,sessionId:Be.sessionId,name:Be.name,model:Be.model,createdAt:Be.createdAt,cwd:Be.cwd,gitBranch:Be.gitBranch,source:"companion"});for(const Be of ge)ft({resumeSessionId:Be.sessionId,sessionId:Be.sessionId,slug:Be.slug,createdAt:Be.lastActivityAt,cwd:Be.cwd,gitBranch:Be.gitBranch,source:"claude_disk"});const st=Array.from(Ve.values()).sort((Be,dn)=>{const Ns=g&&Be.cwd===g?0:1,Fi=g&&dn.cwd===g?0:1;return Ns!==Fi?Ns-Fi:dn.createdAt-Be.createdAt});Ae(st),J(!1),me(Ks)}catch(G){const ge=G instanceof Error?G.message:String(G);gt(ge||"Failed to load existing sessions"),Ae([]),me(Ks)}finally{Qe(!1)}}},[n,g]);k.useEffect(()=>{n==="claude"&&ot&&Bi()},[n,ot,Bi]),k.useEffect(()=>{me(Ks)},[pn,Ut]);async function js(G){if(G.length===0)return;const ge=[],Ve=[];let ft=y.reduce((st,Be)=>st+Be.size,0);for(const st of G){if(st.size>Bd){Ve.push(`${st.name} is too large (${ms(st.size)}, max ${ms(Bd)})`);continue}if(ft+st.size>$d){Ve.push(`${st.name} would exceed the per-message limit (${ms($d)})`);continue}const{base64:Be,mediaType:dn}=await h2(st);ge.push({name:st.name,base64:Be,mediaType:dn,size:st.size}),ft+=st.size}ge.length>0&&b(st=>[...st,...ge]),S(Ve.length>0?Ve.join("; "):null)}async function Tr(G){const ge=G.target.files;ge&&(await js(Array.from(ge)),G.target.value="")}function Pn(G){b(ge=>ge.filter((Ve,ft)=>ft!==G))}async function Sc(G){var ft;const ge=(ft=G.clipboardData)==null?void 0:ft.items;if(!ge)return;const Ve=[];for(const st of Array.from(ge)){if(st.kind!=="file")continue;const Be=st.getAsFile();if(!Be)continue;const dn=Be.name&&Be.name.length>0?Be.name:`pasted-${Date.now()}.${(Be.type.split("/")[1]||"bin").replace(/[^a-zA-Z0-9]/g,"")}`;Ve.push(new File([Be],dn,{type:Be.type,lastModified:Be.lastModified}))}Ve.length>0&&(G.preventDefault(),await js(Ve))}function Kd(G){t(G.target.value),dr(G.target.selectionStart??G.target.value.length);const ge=G.target;ge.style.height="auto",ge.style.height=Math.min(ge.scrollHeight,200)+"px"}function ua(){Dt.current&&dr(Dt.current.selectionStart??0)}function kl(G){var Ve;const ge=Gt.selectPrompt(G);Wt.current=ge.nextCursor,t(ge.nextText),Gt.setMentionMenuOpen(!1),dr(ge.nextCursor),(Ve=Dt.current)==null||Ve.focus(),Dt.current&&(Dt.current.style.height="auto",Dt.current.style.height=Math.min(Dt.current.scrollHeight,200)+"px")}function da(G){if(Gt.mentionMenuOpen&&G.key==="Escape"){G.preventDefault(),Gt.setMentionMenuOpen(!1);return}if(Gt.mentionMenuOpen&&Gt.filteredPrompts.length>0){if(G.key==="ArrowDown"){G.preventDefault(),Gt.setMentionMenuIndex(ge=>(ge+1)%Gt.filteredPrompts.length);return}if(G.key==="ArrowUp"){G.preventDefault(),Gt.setMentionMenuIndex(ge=>(ge-1+Gt.filteredPrompts.length)%Gt.filteredPrompts.length);return}if(G.key==="Tab"&&!G.shiftKey||G.key==="Enter"&&!G.shiftKey){G.preventDefault(),kl(Gt.filteredPrompts[Gt.mentionMenuIndex]);return}}if(Gt.mentionMenuOpen&&Gt.filteredPrompts.length===0&&(G.key==="Enter"&&!G.shiftKey||G.key==="Tab"&&!G.shiftKey)){G.preventDefault();return}if(G.key==="Tab"&&G.shiftKey){G.preventDefault();const ge=h5(n),ft=(ge.findIndex(st=>st.value===h)+1)%ge.length;p(ge[ft].value);return}G.key==="Enter"&&!G.shiftKey&&(G.preventDefault(),Dn())}function Zd(G){if(!B)return G;const ge=(B.description??"").trim();return`${["Linear issue context:",`- Identifier: ${B.identifier}`,`- Title: ${B.title}`,B.stateName?`- State: ${B.stateName}`:"",B.priorityLabel?`- Priority: ${B.priorityLabel}`:"",B.teamName?`- Team: ${B.teamName}`:"",`- URL: ${B.url}`,ge?`- Description:
|
|
106
|
+
${ge}`:""].filter(Boolean).join(`
|
|
107
|
+
`)}
|
|
108
|
+
|
|
109
|
+
User request:
|
|
110
|
+
${G}`}async function Dn(){const G=e.trim();if(!(!G||T)){if(j(!0),C(""),$r(""),xt){const ge=Er||xt.currentBranch;if(ge&&ge===xt.currentBranch){const Ve=bs.find(ft=>ft.name===ge&&!ft.isRemote);if(Ve&&Ve.behind>0){ys({behind:Ve.behind,branchName:ge});return}}}await $i(G)}}async function $i(G,ge){const Ve=X.getState();Ve.clearCreation(),Ve.setSessionCreating(!0,n);try{wc&&um(wc);const ft=(ge==null?void 0:ge.resumeSessionAt)||(Zt?Ur:void 0),st=ft?(ge==null?void 0:ge.forkSession)??(Zt?be:void 0):void 0,Be=(ge==null?void 0:ge.cwd)||g,dn=(ge==null?void 0:ge.branch)!==void 0?ge.branch.trim()||void 0:Er.trim()||void 0,Ns=(ge==null?void 0:ge.useWorktree)!==void 0?ge.useWorktree:Rt,Fi=(ge==null?void 0:ge.createBranch)!==void 0?ge.createBranch:!!(dn&&bl),Cs=await FC({model:u,permissionMode:h,cwd:Be||void 0,envSlug:re||void 0,sandboxEnabled:fe?!0:void 0,sandboxSlug:fe&&oe?oe:void 0,branch:dn,createBranch:Fi?!0:void 0,useWorktree:Ns?!0:void 0,backend:n,codexInternetAccess:n==="codex"?!0:void 0,resumeSessionAt:ft,forkSession:st,linearConnectionId:B&&L||void 0,linearIssue:B?{identifier:B.identifier,title:B.title,stateName:B.stateName,teamName:B.teamName,url:B.url}:void 0},Ar=>{X.getState().addCreationProgress(Ar)}),mn=Cs.sessionId,fr=X.getState(),El=fr.sdkSessions.filter(Ar=>Ar.sessionId!==mn);fr.setSdkSessions([...El,{sessionId:mn,state:Cs.state,cwd:Cs.cwd,createdAt:Date.now(),backendType:Cs.backendType||n,model:u,permissionMode:h,resumeSessionAt:ft,forkSession:ft?st===!0:void 0}]);const Es=new Set(X.getState().sessionNames.values()),Hr=M5(Es);X.getState().setSessionName(mn,Hr),Be&&A2(Be),X.getState().setPreviousPermissionMode(mn,h),zg(mn,!0),mc(mn),await bN(mn);const ha=G.trim();if(ha.length>0){const Ar=Zd(ha),Tl=am(),Ts=y.length>0?y.map(ni=>({name:ni.name,media_type:ni.mediaType,data:ni.base64,size:ni.size})):void 0;Ln(mn,{type:"user_message",content:Ar,session_id:mn,attachments:Ts,client_msg_id:Tl}),X.getState().appendMessage(mn,{id:Tl,role:"user",content:Ar,attachments:Ts,timestamp:Date.now()})}B&&(we.linkLinearIssue(mn,B,L||void 0).then(()=>X.getState().setLinkedLinearIssue(mn,B)).catch(()=>{}),we.transitionLinearIssue(B.id,L||void 0).catch(()=>{})),X.getState().clearCreation()}catch(ft){const st=ft instanceof Error?ft.message:String(ft);C(st),X.getState().setCreationError(st),j(!1)}}async function Sl(G,ge){T||(j(!0),C(""),$r(""),v(G.cwd),Cn(!1),Br(!1),Ri(G.gitBranch||""),le(G.resumeSessionId),W(ge),await $i("",{resumeSessionAt:G.resumeSessionId,forkSession:ge,cwd:G.cwd,branch:G.gitBranch,useWorktree:!1,createBranch:!1}))}async function jl(){if(Di){zi(!0),$r("");try{const G=g||(xt==null?void 0:xt.repoRoot);if(!G)throw new Error("No working directory");const ge=await we.gitPull(G);if(!ge.success){$r(ge.output||"Pull failed"),zi(!1),j(!1);return}ys(null),zi(!1),await $i(e.trim())}catch(G){$r(G instanceof Error?G.message:String(G)),zi(!1)}}}function Pi(){const G=e.trim();ys(null),$r(""),$i(G)}function jc(){ys(null),$r(""),j(!1)}const Nc=k.useCallback((G,ge)=>{Ri(G),Br(ge)},[]),Ui=k.useCallback((G,ge)=>{Ri(G),Br(ge)},[]),Jd=k.useCallback(G=>{Xd(G)},[]),Nl=k.useCallback(G=>{I(G),!G&&xt&&(Ri(xt.currentBranch),Br(!1))},[xt]),Cl=e.trim().length>0&&!T;return a.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:[a.jsx("div",{className:"shrink-0 h-[12vh] sm:h-[18vh]"}),a.jsxs("div",{className:"w-full max-w-[720px]",children:[a.jsxs("div",{className:"flex flex-col items-center mb-6 sm:mb-10",children:[a.jsx("img",{src:Oi,alt:"The Companion",className:"w-10 h-10 sm:w-12 sm:h-12 mb-3"}),a.jsxs("h1",{className:"text-xl sm:text-2xl font-semibold tracking-tight text-cc-fg flex items-baseline gap-2",children:["The Companion",a.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"})]})]}),a.jsx("input",{ref:Pt,type:"file",multiple:!0,onChange:Tr,className:"hidden","aria-label":"Attach files"}),a.jsxs("div",{className:"relative bg-cc-card border border-cc-border rounded-2xl shadow-sm",children:[a.jsx(N2,{open:Gt.mentionMenuOpen,loading:Gt.promptsLoading,prompts:Gt.filteredPrompts,selectedIndex:Gt.mentionMenuIndex,onSelect:kl,menuRef:Gt.mentionMenuRef,className:"absolute left-2 right-2 bottom-full mb-1"}),(B||y.length>0)&&a.jsxs("div",{className:"flex items-center gap-2 px-4 pt-3 flex-wrap",children:[B&&a.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:[a.jsx("span",{className:"shrink-0",children:"Linear"}),a.jsx("span",{className:"font-mono-code shrink-0",children:B.identifier}),a.jsx("span",{className:"truncate",children:B.title}),a.jsx("button",{type:"button",onClick:()=>Nl(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:"×"})]}),y.map((G,ge)=>a.jsx(g2,{name:G.name,mediaType:G.mediaType,base64:G.base64,size:G.size,onRemove:()=>Pn(ge),className:"w-10 h-10"},ge))]}),_&&a.jsx("div",{className:"px-4 pt-2 text-[11px] text-cc-error",children:_}),a.jsx("textarea",{ref:Dt,value:e,onChange:Kd,onKeyDown:da,onClick:ua,onKeyUp:ua,onPaste:Sc,"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"}}),a.jsxs("div",{className:"flex items-center gap-1 px-2.5 sm:px-3 py-2 flex-wrap",children:[a.jsxs("div",{className:"relative",ref:Pr,children:[a.jsxs("button",{onClick:()=>un(!vn),"aria-expanded":vn,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:[a.jsx("span",{children:oa.icon}),a.jsx("span",{children:oa.label}),a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 opacity-40",children:a.jsx("path",{d:"M4 6l4 4 4-4"})})]}),vn&&a.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:K.map(G=>a.jsxs("button",{onClick:()=>{f(G.value),un(!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 ${G.value===u?"text-cc-primary font-medium":"text-cc-fg"}`,children:[a.jsx("span",{children:G.icon}),G.label]},G.value))})]}),a.jsxs("div",{className:"relative",ref:ws,children:[a.jsxs("button",{onClick:()=>nn(!tn),"aria-expanded":tn,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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:a.jsx("path",{d:"M2 4h12M2 8h8M2 12h10",strokeLinecap:"round"})}),Li.label,a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 opacity-40",children:a.jsx("path",{d:"M4 6l4 4 4-4"})})]}),tn&&a.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:Y.map(G=>a.jsx("button",{onClick:()=>{p(G.value),nn(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${G.value===h?"text-cc-primary font-medium":"text-cc-fg"}`,children:G.label},G.value))})]}),a.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-cc-muted/30 mx-0.5 hidden sm:block"}),a.jsxs("div",{children:[a.jsxs("button",{onClick:()=>ze(!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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:a.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"})}),a.jsx("span",{className:"max-w-[80px] sm:max-w-[140px] truncate font-mono-code",children:Ss})]}),ke&&a.jsx(B7,{initialPath:g||"",onSelect:G=>{v(G)},onClose:()=>ze(!1)})]}),a.jsx(H7,{cwd:g,gitRepoInfo:xt,selectedBranch:Er,isNewBranch:bl,useWorktree:Rt,onBranchChange:Nc,onWorktreeChange:Cn,onBranchesLoaded:Jd}),a.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-cc-muted/30 mx-0.5 hidden sm:block"}),a.jsxs("div",{className:"relative",ref:yl,children:[a.jsxs("button",{onClick:()=>{M||we.listEnvs().then($).catch(()=>{}),O(!M)},"aria-expanded":M,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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:a.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"})}),a.jsx("span",{className:"max-w-[80px] sm:max-w-[100px] truncate",children:re?((fa=U.find(G=>G.slug===re))==null?void 0:fa.name)||"Env":"No env"})]}),M&&a.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:[a.jsx("button",{onClick:()=>{xe(""),localStorage.setItem("cc-selected-env",""),O(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${re?"text-cc-fg":"text-cc-primary font-medium"}`,children:"No environment"}),U.map(G=>a.jsxs("button",{onClick:()=>{xe(G.slug),localStorage.setItem("cc-selected-env",G.slug),O(!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 ${G.slug===re?"text-cc-primary font-medium":"text-cc-fg"}`,children:[a.jsx("span",{className:"truncate",children:G.name}),a.jsxs("span",{className:"text-cc-muted ml-auto shrink-0",children:[Object.keys(G.variables).length," var",Object.keys(G.variables).length!==1?"s":""]})]},G.slug)),a.jsx("div",{className:"border-t border-cc-border mt-1 pt-1",children:a.jsx("button",{onClick:()=>{A(!0),O(!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..."})})]})]}),a.jsxs("div",{className:"relative",ref:Ze,children:[a.jsxs("button",{onClick:()=>{Fe||we.listSandboxes().then(De).catch(()=>{}),At(!Fe)},"aria-expanded":Fe,className:`flex items-center gap-1 px-2 py-1 text-[11px] sm:text-xs rounded-lg transition-colors cursor-pointer ${fe?"text-cc-primary bg-cc-primary/8 hover:bg-cc-primary/12":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,children:[a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3 opacity-60",children:[a.jsx("rect",{x:"2",y:"4",width:"12",height:"10",rx:"1.5"}),a.jsx("path",{d:"M5 4V2.5A1.5 1.5 0 016.5 1h3A1.5 1.5 0 0111 2.5V4"})]}),a.jsx("span",{className:"max-w-[80px] sm:max-w-[100px] truncate",children:fe&&oe&&((Cc=je.find(G=>G.slug===oe))==null?void 0:Cc.name)||"Sandbox"}),fe&&Mt&&Mt.status!=="idle"&&a.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${Mt.status==="ready"?"bg-green-500":Mt.status==="pulling"?"bg-amber-500 animate-pulse":"bg-cc-error"}`,title:Mt.status==="ready"?"Docker image ready":Mt.status==="pulling"?"Pulling Docker image...":`Image error: ${Mt.error||"unknown"}`})]}),Fe&&a.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:[a.jsx("button",{onClick:()=>{_e(!1),localStorage.setItem("cc-sandbox-enabled","false"),At(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${fe?"text-cc-fg":"text-cc-primary font-medium"}`,children:"Off"}),a.jsx("div",{className:"border-t border-cc-border my-0.5"}),a.jsx("button",{onClick:()=>{_e(!0),localStorage.setItem("cc-sandbox-enabled","true"),Ee(""),localStorage.setItem("cc-selected-sandbox",""),At(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${fe&&!oe?"text-cc-primary font-medium":"text-cc-fg"}`,children:"Default (the-companion:latest)"}),je.map(G=>a.jsx("button",{onClick:()=>{_e(!0),localStorage.setItem("cc-sandbox-enabled","true"),Ee(G.slug),localStorage.setItem("cc-selected-sandbox",G.slug),At(!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 ${fe&&G.slug===oe?"text-cc-primary font-medium":"text-cc-fg"}`,children:a.jsx("span",{className:"truncate",children:G.name})},G.slug)),a.jsx("div",{className:"border-t border-cc-border mt-1 pt-1",children:a.jsx("a",{href:"#/sandboxes",className:"block 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",onClick:()=>At(!1),children:"Manage sandboxes..."})})]})]}),a.jsx("div",{className:"flex-1"}),a.jsx("button",{onClick:()=>{var G;return(G=Pt.current)==null?void 0:G.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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:a.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"})})}),a.jsx("button",{onClick:Dn,disabled:!Cl,className:`flex items-center justify-center w-8 h-8 sm:w-9 sm:h-9 rounded-full transition-colors ${Cl?"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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M3 2l11 6-11 6V9.5l7-1.5-7-1.5V2z"})})})]})]}),a.jsxs("div",{className:"mt-3 sm:mt-4 space-y-2",children:[l.length>1&&a.jsx("div",{className:"flex items-center justify-center",children:a.jsx("div",{className:"flex items-center bg-cc-hover/50 rounded-lg p-0.5",children:l.map(G=>a.jsxs("button",{onClick:()=>G.available&&ks(G.id),disabled:!G.available,title:G.available?G.name:`${G.name} CLI not found in PATH`,className:`flex items-center gap-1 px-3 py-1.5 text-xs rounded-md transition-colors ${G.available?n===G.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:[G.name,!G.available&&a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3 text-cc-error/60",children:[a.jsx("circle",{cx:"8",cy:"8",r:"6"}),a.jsx("path",{d:"M5.5 5.5l5 5M10.5 5.5l-5 5"})]})]},G.id))})}),n==="claude"&&a.jsxs("div",{children:[a.jsxs("button",{type:"button",onClick:()=>Pe(G=>!G),className:`mx-auto flex items-center gap-1.5 px-2 py-1 text-[11px] sm:text-xs rounded-md transition-colors cursor-pointer ${ot?"text-cc-primary":"text-cc-muted hover:text-cc-fg"}`,"aria-expanded":ot,"aria-controls":"branch-from-session-panel",children:[a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5 opacity-60",children:[a.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"}),a.jsx("path",{d:"M7 5.5h2.5A1.5 1.5 0 0111 7v1",strokeLinecap:"round"})]}),"Branch from session",a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-3 h-3 opacity-40 transition-transform ${ot?"rotate-180":""}`,children:a.jsx("path",{d:"M4 6l4 4 4-4"})})]}),a.jsx("div",{className:"accordion-panel","data-open":ot?"true":"false",children:a.jsx("div",{className:"accordion-inner",inert:!ot||void 0,children:a.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:[a.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[a.jsx("button",{type:"button",onClick:()=>void Bi(),disabled:ut,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:ut?"Refreshing...":"Refresh detected sessions"}),he.length>0&&a.jsxs("span",{className:"text-[11px] text-cc-muted",children:["Showing ",_l.length," of ",Rn.length," ",pn?"matching":Qd?"recent":"detected"," Claude session",Rn.length!==1?"s":"","."]}),!Ut&&wl>0&&Fr.length>0&&a.jsxs("button",{type:"button",onClick:()=>{J(!0),me(Ks)},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 (",wl,")"]}),Ut&&Fr.length>0&&a.jsx("button",{type:"button",onClick:()=>{J(!1),me(Ks)},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"})]}),a.jsxs("label",{className:"block",children:[a.jsx("span",{className:"sr-only",children:"Search sessions"}),a.jsxs("div",{className:"relative",children:[a.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:[a.jsx("circle",{cx:"7",cy:"7",r:"4.25"}),a.jsx("path",{d:"M10.25 10.25L14 14",strokeLinecap:"round"})]}),a.jsx("input",{type:"text",value:Ke,onChange:G=>_t(G.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"})]})]}),a.jsxs("p",{className:"text-[11px] text-cc-muted",children:[a.jsx("span",{className:"font-medium text-cc-fg",children:"Fork"})," opens a new session that leaves the original untouched.",a.jsx("span",{className:"mx-1",children:"•"}),a.jsx("span",{className:"font-medium text-cc-fg",children:"Continue"})," opens from the same linear thread."]}),Je&&a.jsx("p",{className:"text-[11px] text-cc-error",children:Je}),!ut&&!Je&&Rn.length===0&&a.jsx("p",{className:"text-[11px] text-cc-muted",children:pn?"No sessions match this search.":"No Claude sessions detected yet."}),_l.length>0&&a.jsxs("div",{className:"rounded-md border border-cc-border overflow-hidden bg-cc-card/50",children:[a.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:[a.jsx("span",{children:"Session"}),a.jsx("span",{children:"Project"}),a.jsx("span",{children:"Branch"}),a.jsx("span",{children:"Last active"}),a.jsx("span",{className:"text-right",children:"Action"})]}),a.jsx("div",{className:"divide-y divide-cc-border/50",children:_l.map(G=>{const ge=_5(G),Ve=dg(G.cwd),ft=G.source==="companion"?"Companion":"Claude",st=Ur===G.resumeSessionId;return a.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:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:`text-xs truncate ${st?"text-cc-primary font-medium":"text-cc-fg"}`,children:ge}),a.jsxs("div",{className:"mt-0.5 flex items-center gap-1.5 text-[10px]",children:[a.jsx("span",{className:"font-mono-code text-cc-muted",children:V7(G.resumeSessionId)}),a.jsx("span",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted",children:ft})]})]}),a.jsxs("div",{className:"min-w-0 text-[11px] text-cc-muted sm:font-mono-code truncate",title:G.cwd,children:[a.jsx("div",{className:"truncate",children:Ve}),a.jsx("div",{className:"mt-0.5 text-[10px] text-cc-muted/70 truncate",title:G.cwd,children:G7(G.cwd)})]}),a.jsx("div",{className:"text-[11px] text-cc-muted sm:font-mono-code truncate",children:G.gitBranch||"—"}),a.jsx("div",{className:"text-[11px] text-cc-muted",children:Y7(G.createdAt)}),a.jsxs("div",{className:"sm:text-right flex gap-1.5 sm:justify-end",children:[a.jsx("button",{type:"button",onClick:()=>{le(G.resumeSessionId),W(!0),Sl(G,!0)},"aria-label":`Fork and open ${ge}`,className:`px-2 py-1 rounded-md text-[11px] border transition-colors cursor-pointer ${st&&be?"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
|
|
111
|
+
${G.cwd}${G.gitBranch?` (${G.gitBranch})`:""}
|
|
112
|
+
${G.resumeSessionId}`,children:"Fork"}),a.jsx("button",{type:"button",onClick:()=>{le(G.resumeSessionId),W(!1),Sl(G,!1)},"aria-label":`Continue and open ${ge}`,className:`px-2 py-1 rounded-md text-[11px] border transition-colors cursor-pointer ${st&&!be?"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
|
|
113
|
+
${G.resumeSessionId}`,children:"Continue"})]})]},`${G.resumeSessionId}-row-${G.sessionId}`)})}),kc&&a.jsx("div",{className:"px-2.5 py-2 border-t border-cc-border bg-cc-card/40",children:a.jsxs("button",{type:"button",onClick:()=>me(G=>Math.min(G+I7,Rn.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 (",Rn.length-pe," remaining)"]})})]}),a.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."})]})})})]}),E&&a.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:[a.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:a.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"})}),a.jsxs("span",{className:"flex-1",children:["The toolbar sets where your code lives, which model to use, and how the session runs.",n==="claude"&&a.jsxs(a.Fragment,{children:[" ",a.jsx("strong",{className:"text-cc-fg",children:"Branch from session"})," below lets you fork or continue a previous Claude session."]})]}),a.jsx("button",{onClick:()=>{ae(!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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),a.jsx(F7,{cwd:g,gitRepoInfo:xt,linearConfigured:D,selectedLinearIssue:B,onIssueSelect:Nl,onBranchFromIssue:Ui,onConnectionSelect:q})]}),Di&&a.jsx("div",{className:"mt-3 p-3 rounded-[10px] bg-amber-500/10 border border-amber-500/20",children:a.jsxs("div",{className:"flex items-start gap-2.5",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-amber-500 shrink-0 mt-0.5",children:a.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"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("p",{className:"text-xs text-cc-fg leading-snug",children:[a.jsx("span",{className:"font-mono-code font-medium",children:Di.branchName})," is"," ",a.jsxs("span",{className:"font-semibold text-amber-500",children:[Di.behind," commit",Di.behind!==1?"s":""," behind"]})," ","remote. Pull before starting?"]}),la&&a.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:la}),a.jsxs("div",{className:"flex flex-wrap gap-2 mt-2.5",children:[a.jsx("button",{onClick:jc,disabled:_s,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"}),a.jsx("button",{onClick:Pi,disabled:_s,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"}),a.jsx("button",{onClick:jl,disabled:_s,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:_s?a.jsxs(a.Fragment,{children:[a.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"})]})]})]})}),R&&a.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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-error shrink-0",children:a.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"})}),a.jsx("p",{className:"text-xs text-cc-error",children:R})]})]}),Z&&a.jsx(M2,{onClose:()=>{A(!1),we.listEnvs().then($).catch(()=>{})}})]})}const X7=[],Q7=[],K7={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"}},Z7={label:"Unknown",badge:"text-cc-muted bg-cc-hover",dot:"bg-cc-muted opacity-40"};function J7({server:e,sessionId:t}){var f,h;const[n,i]=k.useState(!1),l=K7[e.status]||Z7,c=e.status!=="disabled",u=((f=e.tools)==null?void 0:f.length)??0;return a.jsxs("div",{className:"rounded-lg border border-cc-border bg-cc-bg",children:[a.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-2",children:[a.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${l.dot}`}),a.jsx("button",{onClick:()=>i(!n),className:"flex-1 min-w-0 text-left cursor-pointer",children:a.jsx("span",{className:"text-[12px] font-medium text-cc-fg truncate block",children:e.name})}),a.jsx("span",{className:`text-[9px] font-medium px-1.5 rounded-full leading-[16px] shrink-0 ${l.badge}`,children:l.label}),a.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[a.jsx("button",{onClick:()=>yN(t,e.name,!c),className:`w-6 h-6 flex items-center justify-center rounded-md transition-colors cursor-pointer ${c?"text-cc-muted hover:text-cc-fg hover:bg-cc-hover":"text-cc-muted/50 hover:text-cc-success hover:bg-cc-success/10"}`,title:c?"Disable server":"Enable server",children:c?a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:[a.jsx("circle",{cx:"8",cy:"8",r:"6"}),a.jsx("path",{d:"M5 8h6",strokeLinecap:"round"})]}):a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:[a.jsx("circle",{cx:"8",cy:"8",r:"6"}),a.jsx("path",{d:"M8 5v6M5 8h6",strokeLinecap:"round"})]})}),(e.status==="failed"||e.status==="connected")&&a.jsx("button",{onClick:()=>_N(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:a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:[a.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"}),a.jsx("path",{d:"M12.5 2v3h-3M3.5 14v-3h3",strokeLinecap:"round",strokeLinejoin:"round"})]})})]})]}),n&&a.jsxs("div",{className:"px-2.5 pb-2.5 space-y-1.5 pt-2",children:[a.jsxs("div",{className:"text-[11px] text-cc-muted space-y-0.5",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"text-cc-muted/60",children:"Type:"}),a.jsx("span",{children:e.config.type})]}),e.config.command&&a.jsxs("div",{className:"flex items-start gap-1",children:[a.jsx("span",{className:"text-cc-muted/60 shrink-0",children:"Cmd:"}),a.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&&a.jsxs("div",{className:"flex items-start gap-1",children:[a.jsx("span",{className:"text-cc-muted/60 shrink-0",children:"URL:"}),a.jsx("span",{className:"font-mono text-[10px] break-all",children:e.config.url})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"text-cc-muted/60",children:"Scope:"}),a.jsx("span",{children:e.scope})]})]}),e.error&&a.jsx("div",{className:"text-[11px] text-cc-error bg-cc-error/5 rounded px-2 py-1",children:e.error}),u>0&&a.jsxs("div",{className:"space-y-1",children:[a.jsxs("span",{className:"text-[10px] text-cc-muted uppercase tracking-wider",children:["Tools (",u,")"]}),a.jsx("div",{className:"flex flex-wrap gap-1",children:e.tools.map(p=>a.jsx("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded bg-cc-hover text-cc-fg",title:p.annotations&&Object.entries(p.annotations).filter(([,g])=>g).map(([g])=>g).join(", ")||void 0,children:p.name},p.name))})]})]})]})}function eR({sessionId:e,onDone:t}){const[n,i]=k.useState(""),[l,c]=k.useState("stdio"),[u,f]=k.useState(""),[h,p]=k.useState(""),[g,v]=k.useState(""),y=n.trim()&&(l==="stdio"?u.trim():g.trim());function b(_){if(_.preventDefault(),!y)return;const S={type:l};l==="stdio"?(S.command=u.trim(),h.trim()&&(S.args=h.trim().split(/\s+/))):S.url=g.trim(),wN(e,{[n.trim()]:S}),t()}return a.jsxs("form",{onSubmit:b,className:"space-y-2 p-2.5 rounded-lg border border-cc-border bg-cc-bg",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Server Name"}),a.jsx("input",{type:"text",value:n,onChange:_=>i(_.target.value),placeholder:"my-mcp-server",className:"w-full text-[12px] bg-cc-input-bg border border-cc-border rounded px-2 py-1.5 text-cc-fg placeholder:text-cc-muted/40 focus:outline-none focus:border-cc-primary"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Type"}),a.jsx("div",{className:"flex gap-1",children:["stdio","sse","http"].map(_=>a.jsx("button",{type:"button",onClick:()=>c(_),className:`text-[11px] px-2 py-1 rounded-md border transition-colors cursor-pointer ${l===_?"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:_},_))})]}),l==="stdio"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Command"}),a.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"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Args (space-separated, optional)"}),a.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"})]})]}),(l==="sse"||l==="http")&&a.jsxs("div",{children:[a.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"URL"}),a.jsx("input",{type:"text",value:g,onChange:_=>v(_.target.value),placeholder:"http://localhost:3000/mcp",className:"w-full text-[12px] bg-cc-input-bg border border-cc-border rounded px-2 py-1.5 text-cc-fg placeholder:text-cc-muted/40 font-mono focus:outline-none focus:border-cc-primary"})]}),a.jsxs("div",{className:"flex gap-1.5 pt-1",children:[a.jsx("button",{type:"submit",disabled:!y,className:`flex-1 text-[11px] font-medium py-1.5 rounded-md transition-colors ${y?"bg-cc-primary text-white hover:bg-cc-primary-hover cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:"Add Server"}),a.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 tR({sessionId:e}){const t=X(f=>f.mcpServers.get(e)||X7),n=X(f=>f.cliConnected.get(e)??!1),[i,l]=k.useState(!1),c=X(f=>{var h;return((h=f.sessions.get(e))==null?void 0:h.mcp_servers)??Q7});k.useEffect(()=>{n&&ub(e)},[e,n]);const u=t.length>0?t:c.map(f=>({name:f.name,status:f.status,config:{type:"unknown"},scope:""}));return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"shrink-0 px-4 py-2.5 flex items-center justify-between",children:[a.jsxs("span",{className:"text-[13px] font-semibold text-cc-fg flex items-center gap-1.5",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-muted",children:a.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"]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{onClick:()=>l(!i),disabled:!n,className:`text-[11px] font-medium transition-colors ${n?"text-cc-muted hover:text-cc-fg cursor-pointer":"text-cc-muted/30 cursor-not-allowed"}`,title:"Add MCP server",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M8 3v10M3 8h10",strokeLinecap:"round"})})}),a.jsx("button",{onClick:()=>ub(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:a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:[a.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"}),a.jsx("path",{d:"M12.5 2v3h-3M3.5 14v-3h3",strokeLinecap:"round",strokeLinejoin:"round"})]})})]})]}),i&&a.jsx("div",{className:"px-3 py-2",children:a.jsx(eR,{sessionId:e,onDone:()=>l(!1)})}),u.length>0&&a.jsx("div",{className:"px-3 py-2 space-y-1.5",children:u.map(f=>a.jsx(J7,{server:f,sessionId:e},f.name))}),!i&&u.length===0&&a.jsx("div",{className:"px-3 py-3",children:a.jsxs("p",{className:"text-[11px] text-cc-muted text-center",children:["No MCP servers configured."," ",n&&a.jsx("button",{onClick:()=>l(!0),className:"text-cc-primary hover:underline cursor-pointer",children:"Add one"})]})})]})}function nR({cwd:e,open:t,onClose:n}){var q;const[i,l]=k.useState([]),[c,u]=k.useState(!0),[f,h]=k.useState(0),[p,g]=k.useState(""),[v,y]=k.useState(!1),[b,_]=k.useState(!1),[S,T]=k.useState(null),[j,R]=k.useState(null),C=k.useCallback(()=>{u(!0),T(null),we.getClaudeMdFiles(e).then(E=>{l(E.files),E.files.length>0&&(h(0),g(E.files[0].content)),R(null),y(!1),u(!1)}).catch(E=>{T(E.message),u(!1)})},[e]);k.useEffect(()=>{t&&C()},[t,C]);const P=E=>{v&&!confirm("Discard unsaved changes?")||(h(E),g(i[E].content),y(!1),R(null))},z=async()=>{var ae;const E=j||((ae=i[f])==null?void 0:ae.path);if(E){_(!0),T(null);try{await we.saveClaudeMd(E,p),y(!1),j?C():l(K=>K.map((Y,U)=>U===f?{...Y,content:p}:Y))}catch(K){T(K instanceof Error?K.message:"Failed to save")}finally{_(!1)}}},D=E=>{const ae=E==="root"?`${e}/CLAUDE.md`:`${e}/.claude/CLAUDE.md`;R(ae),g(`# CLAUDE.md
|
|
114
|
+
|
|
115
|
+
`),y(!0)},F=()=>{v&&!confirm("Discard unsaved changes?")||n()};if(!t)return null;const B=E=>E.startsWith(e+"/")?E.slice(e.length+1):E,I=i.some(E=>E.path===`${e}/CLAUDE.md`),L=i.some(E=>E.path===`${e}/.claude/CLAUDE.md`);return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 bg-black/40 z-50",onClick:F}),a.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:[a.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:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("div",{className:"w-7 h-7 rounded-lg bg-cc-primary/10 flex items-center justify-center",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:a.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"})})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-sm font-semibold text-cc-fg",children:"CLAUDE.md"}),a.jsx("p",{className:"text-[11px] text-cc-muted",children:"Project instructions for Claude Code"})]})]}),a.jsx("button",{onClick:F,className:"w-7 h-7 flex items-center justify-center rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),a.jsx("div",{className:"flex-1 flex min-h-0",children:c?a.jsx("div",{className:"flex-1 flex items-center justify-center",children:a.jsx("div",{className:"w-5 h-5 border-2 border-cc-primary border-t-transparent rounded-full animate-spin"})}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"shrink-0 w-[180px] sm:w-[200px] border-r border-cc-border bg-cc-sidebar flex flex-col",children:[a.jsx("div",{className:"px-3 py-2 text-[10px] font-semibold text-cc-muted uppercase tracking-wider border-b border-cc-border",children:"Files"}),a.jsxs("div",{className:"flex-1 overflow-y-auto py-1",children:[i.map((E,ae)=>a.jsxs("button",{onClick:()=>P(ae),className:`flex items-center gap-2 w-full px-3 py-2 text-left text-[12px] transition-colors cursor-pointer ${!j&&f===ae?"bg-cc-active text-cc-fg":"text-cc-fg/70 hover:bg-cc-hover"}`,children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-primary shrink-0",children:a.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"})}),a.jsx("span",{className:"truncate font-mono-code",children:B(E.path)})]},E.path)),j&&a.jsxs("div",{className:"flex items-center gap-2 w-full px-3 py-2 text-[12px] bg-cc-active text-cc-fg",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-success shrink-0",children:a.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"})}),a.jsx("span",{className:"truncate font-mono-code",children:B(j)})]})]}),(!I||!L)&&!j&&a.jsxs("div",{className:"shrink-0 border-t border-cc-border p-2",children:[a.jsx("div",{className:"text-[10px] text-cc-muted uppercase tracking-wider px-1 mb-1",children:"Create new"}),!I&&a.jsxs("button",{onClick:()=>D("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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-success shrink-0",children:a.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"})}),a.jsx("span",{className:"font-mono-code",children:"CLAUDE.md"})]}),!L&&a.jsxs("button",{onClick:()=>D("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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-success shrink-0",children:a.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"})}),a.jsx("span",{className:"font-mono-code",children:".claude/CLAUDE.md"})]})]})]}),a.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[i.length===0&&!j?a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-4 px-6",children:[a.jsx("div",{className:"w-14 h-14 rounded-2xl bg-cc-card border border-cc-border flex items-center justify-center",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-6 h-6 text-cc-muted",children:a.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"})})}),a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"text-sm text-cc-fg font-medium mb-1",children:"No CLAUDE.md found"}),a.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."})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>D("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"}),a.jsx("button",{onClick:()=>D("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"})]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"shrink-0 flex items-center justify-between px-4 py-2 bg-cc-card border-b border-cc-border",children:[a.jsx("span",{className:"text-[12px] text-cc-muted font-mono-code truncate",children:B(j||(((q=i[f])==null?void 0:q.path)??""))}),a.jsxs("div",{className:"flex items-center gap-2",children:[v&&a.jsx("span",{className:"text-[10px] text-cc-warning font-medium",children:"Unsaved"}),a.jsx("button",{onClick:z,disabled:!v||b,className:`px-3 py-1 text-[11px] font-medium rounded-md transition-colors cursor-pointer ${v&&!b?"bg-cc-primary text-white hover:bg-cc-primary/90":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:b?"Saving...":"Save"})]})]}),a.jsx("textarea",{value:p,onChange:E=>{g(E.target.value),y(!0)},spellCheck:!1,className:"flex-1 w-full p-4 bg-cc-bg text-cc-fg text-[13px] font-mono-code leading-relaxed resize-none focus:outline-none",placeholder:"Write your project instructions here..."})]}),S&&a.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:S})]})]})})]})]})}function w5({icon:e,title:t,expanded:n,onToggle:i}){return a.jsxs("button",{onClick:i,className:"w-full flex items-center gap-2 px-4 py-2 text-left hover:bg-cc-hover/50 transition-colors cursor-pointer","aria-expanded":n,children:[a.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:a.jsx("path",{d:"M6 4l4 4-4 4",strokeLinecap:"round",strokeLinejoin:"round"})}),a.jsx("div",{className:"w-4 h-4 flex items-center justify-center shrink-0",children:e==="project"?a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:a.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"})}):a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:a.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"})})}),a.jsx("span",{className:"text-[11px] font-semibold text-cc-muted uppercase tracking-wider flex-1",children:t})]})}function _i({label:e,sublabel:t,count:n,onClick:i}){return a.jsxs("button",{onClick:i,className:"w-full flex items-center gap-2 px-4 pl-10 py-1.5 text-left hover:bg-cc-hover/50 transition-colors cursor-pointer",children:[a.jsxs("span",{className:"text-[12px] text-cc-fg truncate flex-1",children:[e,n!==void 0&&n>0&&a.jsxs("span",{className:"ml-1 text-[10px] text-cc-muted",children:["(",n,")"]})]}),t&&a.jsx("span",{className:"text-[10px] text-cc-muted shrink-0",children:t}),a.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:a.jsx("path",{d:"M6 4l4 4-4 4",strokeLinecap:"round",strokeLinejoin:"round"})})]})}function rR({path:e,content:t,onClose:n}){let i;try{i=JSON.stringify(JSON.parse(t),null,2)}catch{i=t}return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 bg-black/40 z-50",onClick:n}),a.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:[a.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:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("div",{className:"w-7 h-7 rounded-lg bg-cc-primary/10 flex items-center justify-center",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:a.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"})})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("h2",{className:"text-sm font-semibold text-cc-fg truncate",children:e.split("/").pop()}),a.jsx("p",{className:"text-[11px] text-cc-muted truncate",children:e})]})]}),a.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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),a.jsx("div",{className:"flex-1 overflow-auto p-4",children:a.jsx("pre",{className:"text-[13px] font-mono-code text-cc-fg leading-relaxed whitespace-pre-wrap break-words",children:i})}),a.jsx("div",{className:"shrink-0 px-4 py-2 bg-cc-card border-t border-cc-border",children:a.jsx("span",{className:"text-[10px] text-cc-muted",children:"Read-only"})})]})]})}function iR({path:e,label:t,onClose:n}){const[i,l]=k.useState(""),[c,u]=k.useState(!0),[f,h]=k.useState(!1),[p,g]=k.useState(!1),[v,y]=k.useState(null);k.useEffect(()=>{we.readFile(e).then(S=>{l(S.content),u(!1)}).catch(S=>{y(S instanceof Error?S.message:"Failed to read file"),u(!1)})},[e]);const b=async()=>{g(!0),y(null);try{await we.writeFile(e,i),h(!1)}catch(S){y(S instanceof Error?S.message:"Failed to save")}finally{g(!1)}},_=()=>{f&&!confirm("Discard unsaved changes?")||n()};return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 bg-black/40 z-50",onClick:_}),a.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:[a.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:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("div",{className:"w-7 h-7 rounded-lg bg-cc-primary/10 flex items-center justify-center",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:a.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"})})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("h2",{className:"text-sm font-semibold text-cc-fg truncate",children:t}),a.jsx("p",{className:"text-[11px] text-cc-muted truncate",children:e})]})]}),a.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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),c?a.jsx("div",{className:"flex-1 flex items-center justify-center",children:a.jsx("div",{className:"w-5 h-5 border-2 border-cc-primary border-t-transparent rounded-full animate-spin"})}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"shrink-0 flex items-center justify-between px-4 py-2 bg-cc-card border-b border-cc-border",children:[a.jsx("span",{className:"text-[12px] text-cc-muted font-mono-code truncate",children:e.split("/").pop()}),a.jsxs("div",{className:"flex items-center gap-2",children:[f&&a.jsx("span",{className:"text-[10px] text-cc-warning font-medium",children:"Unsaved"}),a.jsx("button",{onClick:b,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"})]})]}),a.jsx("textarea",{value:i,onChange:S=>{l(S.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..."})]}),v&&a.jsx("div",{className:"shrink-0 px-4 py-2 bg-cc-error/10 border-t border-cc-error/20 text-xs text-cc-error",children:v})]})]})}function sR({item:e,cwd:t,onClose:n}){if(e.kind==="json"){const[i,l]=k.useState(null),[c,u]=k.useState(!0);return k.useEffect(()=>{we.readFile(e.path).then(f=>{l(f.content),u(!1)}).catch(()=>{l("Failed to read file"),u(!1)})},[e.path]),c?null:a.jsx(rR,{path:e.path,content:i||"",onClose:n})}return e.kind==="claude-md"?a.jsx(nR,{cwd:e.editorCwd||t,open:!0,onClose:n}):a.jsx(iR,{path:e.path,label:e.label,onClose:n})}function aR({sessionId:e}){const t=X(j=>j.sessions.get(e)),n=X(j=>j.sdkSessions.find(R=>R.sessionId===e)),i=(t==null?void 0:t.repo_root)||(t==null?void 0:t.cwd)||(n==null?void 0:n.cwd),[l,c]=k.useState(null),[u,f]=k.useState(!0),[h,p]=k.useState(!1),[g,v]=k.useState(!1),[y,b]=k.useState(null),_=k.useCallback(async()=>{if(i)try{const j=await we.getClaudeConfig(i);c(j)}catch{}finally{f(!1)}},[i]);if(k.useEffect(()=>{_()},[_]),!i)return null;if(u)return a.jsx("div",{className:"shrink-0 px-4 py-2.5",children:a.jsx("span",{className:"text-[11px] text-cc-muted",children:"Loading config..."})});if(!l)return null;const S=l.project.claudeMd.length+(l.project.settings?1:0)+(l.project.settingsLocal?1:0)+l.project.commands.length,T=(l.user.claudeMd?1:0)+l.user.skills.length+l.user.agents.length+(l.user.settings?1:0)+l.user.commands.length;return a.jsxs("div",{className:"shrink-0","data-testid":"claude-config-browser",children:[a.jsx(w5,{icon:"project",title:`Project (${S})`,expanded:h,onToggle:()=>p(j=>!j)}),h&&a.jsxs("div",{className:"pb-1",children:[l.project.claudeMd.map(j=>a.jsx(_i,{label:j.path.includes(".claude/")?".claude/CLAUDE.md":"CLAUDE.md",onClick:()=>b({label:"CLAUDE.md",path:j.path,kind:"claude-md"})},j.path)),l.project.settings&&a.jsx(_i,{label:"settings.json",onClick:()=>b({label:"settings.json",path:l.project.settings.path,kind:"json"})}),l.project.settingsLocal&&a.jsx(_i,{label:"settings.local.json",onClick:()=>b({label:"settings.local.json",path:l.project.settingsLocal.path,kind:"json"})}),l.project.commands.length>0&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"px-4 pl-10 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:["Commands (",l.project.commands.length,")"]}),l.project.commands.map(j=>a.jsx(_i,{label:`/${j.name}`,onClick:()=>b({label:j.name,path:j.path,kind:"md"})},j.path))]}),S===0&&a.jsx("p",{className:"px-4 pl-10 py-1.5 text-[11px] text-cc-muted",children:"No .claude config found"})]}),a.jsx(w5,{icon:"user",title:`User (${T})`,expanded:g,onToggle:()=>v(j=>!j)}),g&&a.jsxs("div",{className:"pb-1",children:[l.user.claudeMd&&a.jsx(_i,{label:"CLAUDE.md",onClick:()=>b({label:"CLAUDE.md",path:l.user.claudeMd.path,kind:"claude-md",editorCwd:l.user.root})}),l.user.skills.length>0&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"px-4 pl-10 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:["Skills (",l.user.skills.length,")"]}),l.user.skills.map(j=>a.jsx(_i,{label:j.name,sublabel:j.description?j.description.slice(0,40):void 0,onClick:()=>b({label:j.name,path:j.path,kind:"md"})},j.path))]}),l.user.agents.length>0&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"px-4 pl-10 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:["Agents (",l.user.agents.length,")"]}),l.user.agents.map(j=>a.jsx(_i,{label:j.name,onClick:()=>b({label:j.name,path:j.path,kind:"md"})},j.path))]}),l.user.settings&&a.jsx(_i,{label:"settings.json",onClick:()=>b({label:"settings.json",path:l.user.settings.path,kind:"json"})}),l.user.commands.length>0&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"px-4 pl-10 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:["Commands (",l.user.commands.length,")"]}),l.user.commands.map(j=>a.jsx(_i,{label:`/${j.name}`,onClick:()=>b({label:j.name,path:j.path,kind:"md"})},j.path))]}),T===0&&a.jsx("p",{className:"px-4 pl-10 py-1.5 text-[11px] text-cc-muted",children:"No user config found"})]}),y&&gl.createPortal(a.jsx(sR,{item:y,cwd:i,onClose:()=>b(null)}),document.body)]})}function lR(e){const t=Date.now()-e,n=Math.floor(t/6e4);if(n<1)return"just now";if(n<60)return`${n}m ago`;const i=Math.floor(n/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}class oR extends k.Component{constructor(){super(...arguments);z1(this,"state",{hasError:!1})}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(n){Jr(n,{section:this.props.label})}render(){return this.state.hasError?a.jsx("div",{className:"px-4 py-3 border-b border-cc-border",children:a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx("span",{className:"text-xs text-cc-error",children:this.props.label?`${this.props.label} failed to load`:"Section failed to load"}),a.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 R2=[],D2=3e4;let k5=null,S5=new Map;function cR(e){return e!==k5&&(k5=e,S5=new Map(e.map(t=>[t.sessionId,t]))),S5}function yc(e){return X(k.useCallback(t=>cR(t.sdkSessions).get(e),[e]))}const z2="cc-panel-collapsed";function j5(){try{const e=localStorage.getItem(z2);if(e)return new Set(JSON.parse(e))}catch{}return new Set}function uR(e){try{localStorage.setItem(z2,JSON.stringify([...e]))}catch{}}function dR({id:e,label:t,badge:n,defaultOpen:i=!0,children:l}){const[c,u]=k.useState(()=>j5().has(e)?!0:!i),f=k.useRef(!0);k.useEffect(()=>{if(f.current){f.current=!1;return}const p=j5();c?p.add(e):p.delete(e),uR(p)},[c,e]);const h=k.useCallback(()=>{u(p=>!p)},[]);return a.jsxs("div",{className:"border-t border-cc-separator first:border-t-0",children:[a.jsxs("button",{onClick:h,"aria-expanded":!c,className:"w-full flex items-center gap-1.5 px-4 py-2 text-left hover:bg-cc-hover/50 transition-colors cursor-pointer",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":!0,className:`w-2.5 h-2.5 text-cc-muted/60 shrink-0 transition-transform duration-150 ${c?"":"rotate-90"}`,children:a.jsx("path",{d:"M6 4l4 4-4 4"})}),a.jsx("span",{className:"text-[11px] font-semibold text-cc-muted uppercase tracking-wider flex-1 truncate",children:t}),n&&a.jsx("span",{className:"shrink-0",children:n})]}),a.jsx("div",{className:"accordion-panel","data-open":c?"false":"true",children:a.jsx("div",{className:"accordion-inner",children:l})})]})}function L2(e){return e>80?"bg-cc-error":e>50?"bg-cc-warning":"bg-cc-primary"}function O2(e){return e>80?"critical":e>50?"elevated":"normal"}function hc({label:e,pct:t,detail:n}){return a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[11px] text-cc-muted uppercase tracking-wider",children:e}),a.jsxs("span",{className:"text-[11px] text-cc-muted tabular-nums",children:[Math.round(t),"%",n&&a.jsxs("span",{className:"ml-1 text-cc-muted",children:["(",n,")"]})]})]}),a.jsx("div",{role:"meter","aria-label":`${e} usage — ${O2(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:a.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${L2(t)}`,style:{width:`${Math.min(t,100)}%`}})})]})}function fR({sessionId:e}){var h;const[t,n]=k.useState(null),i=k.useCallback(async()=>{try{const p=await we.getSessionUsageLimits(e);n(p)}catch{}},[e]),l=k.useRef(0);if(k.useEffect(()=>{i();const p=setInterval(()=>{l.current+=1,l.current%2===0?i():n(g=>g?{...g}:null)},D2);return()=>clearInterval(p)},[i]),!t)return null;const c=t.five_hour!==null,u=t.seven_day!==null,f=!c&&!u&&((h=t.extra_usage)==null?void 0:h.is_enabled);return!c&&!u&&!f?null:a.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2",children:[t.five_hour&&a.jsx(hc,{label:"5h Limit",pct:t.five_hour.utilization,detail:t.five_hour.resets_at?o5(t.five_hour.resets_at):void 0}),t.seven_day&&a.jsx(hc,{label:"7d Limit",pct:t.seven_day.utilization,detail:t.seven_day.resets_at?o5(t.seven_day.resets_at):void 0}),f&&t.extra_usage&&a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[11px] text-cc-muted uppercase tracking-wider",children:"Extra"}),a.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&&a.jsx("div",{role:"meter","aria-label":`Extra usage — ${O2(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:a.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${L2(t.extra_usage.utilization)}`,style:{width:`${Math.min(t.extra_usage.utilization,100)}%`}})})]})]})}function hR({sessionId:e}){const t=X(c=>{var u;return(u=c.sessions.get(e))==null?void 0:u.codex_rate_limits}),[,n]=k.useState(0);if(k.useEffect(()=>{if(!t)return;const c=setInterval(()=>n(u=>u+1),D2);return()=>clearInterval(c)},[t]),!t)return null;const{primary:i,secondary:l}=t;return!i&&!l?null:a.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2",children:[i&&a.jsx(hc,{label:`${u5(i.windowDurationMins)} Limit`,pct:i.usedPercent,detail:i.resetsAt>0?c5(i.resetsAt):void 0}),l&&a.jsx(hc,{label:`${u5(l.windowDurationMins)} Limit`,pct:l.usedPercent,detail:l.resetsAt>0?c5(l.resetsAt):void 0})]})}function pR({sessionId:e}){const t=X(i=>{var l;return(l=i.sessions.get(e))==null?void 0:l.codex_token_details}),n=X(i=>{var l;return((l=i.sessions.get(e))==null?void 0:l.context_used_percent)??0});return t?a.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2",children:[a.jsx("span",{className:"text-[11px] text-cc-muted uppercase tracking-wider",children:"Tokens"}),a.jsxs("div",{className:"grid grid-cols-2 gap-x-3 gap-y-1",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[11px] text-cc-muted",children:"Input"}),a.jsx("span",{className:"text-[11px] text-cc-fg tabular-nums font-medium",children:Uo(t.inputTokens)})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[11px] text-cc-muted",children:"Output"}),a.jsx("span",{className:"text-[11px] text-cc-fg tabular-nums font-medium",children:Uo(t.outputTokens)})]}),t.cachedInputTokens>0&&a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[11px] text-cc-muted",children:"Cached"}),a.jsx("span",{className:"text-[11px] text-cc-fg tabular-nums font-medium",children:Uo(t.cachedInputTokens)})]}),t.reasoningOutputTokens>0&&a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[11px] text-cc-muted",children:"Reasoning"}),a.jsx("span",{className:"text-[11px] text-cc-fg tabular-nums font-medium",children:Uo(t.reasoningOutputTokens)})]})]}),t.modelContextWindow>0&&a.jsx(hc,{label:"Context",pct:n})]}):null}function mR(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 gR({pr:e}){const t=mR(e.state,e.isDraft),{checksSummary:n,reviewThreads:i}=e;return a.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.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]}),a.jsx("span",{className:`text-[9px] font-medium px-1.5 rounded-full leading-[16px] ${t.cls}`,children:t.label})]}),a.jsx("p",{className:"text-[11px] text-cc-muted truncate",title:e.title,children:e.title}),n.total>0&&a.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?a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"flex items-center gap-1 text-cc-error",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.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&&a.jsxs("span",{className:"flex items-center gap-1 text-cc-success",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.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?a.jsxs("span",{className:"flex items-center gap-1 text-cc-warning",children:[a.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 animate-spin",children:[a.jsx("path",{d:"M8 2a6 6 0 100 12A6 6 0 008 2zM0 8a8 8 0 1116 0A8 8 0 010 8z",opacity:".2"}),a.jsx("path",{d:"M8 0a8 8 0 018 8h-2A6 6 0 008 2V0z"})]}),n.pending," pending",n.success>0&&a.jsxs("span",{className:"text-cc-success ml-1",children:[n.success," passed"]})]}):a.jsxs("span",{className:"flex items-center gap-1 text-cc-success",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.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"]})}),a.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[e.reviewDecision==="APPROVED"&&a.jsxs("span",{className:"flex items-center gap-1 text-cc-success",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.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"&&a.jsxs("span",{className:"flex items-center gap-1 text-cc-error",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.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"&&a.jsxs("span",{className:"flex items-center gap-1 text-cc-muted",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:a.jsx("circle",{cx:"8",cy:"8",r:"6"})}),"Review pending"]}),i.unresolved>0&&a.jsxs("span",{className:"flex items-center gap-1 text-cc-warning",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.jsx("path",{d:"M2.5 2A1.5 1.5 0 001 3.5v8A1.5 1.5 0 002.5 13h2v2.5l3.5-2.5h5.5a1.5 1.5 0 001.5-1.5v-8A1.5 1.5 0 0013.5 2h-11z"})}),i.unresolved," unresolved"]})]}),a.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-cc-muted",children:[a.jsxs("span",{className:"text-cc-success",children:["+",e.additions]}),a.jsxs("span",{className:"text-cc-error",children:["-",e.deletions]}),a.jsxs("span",{children:["· ",e.changedFiles," files"]})]})]})}function xR({sessionId:e}){const t=X(u=>u.sessions.get(e)),n=yc(e),i=X(u=>u.prStatus.get(e)),l=(t==null?void 0:t.cwd)||(n==null?void 0:n.cwd),c=(t==null?void 0:t.git_branch)||(n==null?void 0:n.gitBranch);return k.useEffect(()=>{i||!l||!c||we.getPRStatus(l,c).then(u=>{X.getState().setPRStatus(e,u)}).catch(()=>{})},[e,l,c,i]),!(i!=null&&i.available)||!i.pr?null:a.jsx(gR,{pr:i.pr})}const vR=6e4;function Jp(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 bR({sessionId:e}){const t=X(E=>E.linkedLinearIssues.get(e)),[n,i]=k.useState([]),[l,c]=k.useState(null),[u,f]=k.useState([]),[h,p]=k.useState(""),[g,v]=k.useState(!1),[y,b]=k.useState(!1),[_,S]=k.useState(!1),[T,j]=k.useState(""),[R,C]=k.useState([]),[P,z]=k.useState(!1),D=k.useRef(null);k.useEffect(()=>{we.getLinkedLinearIssue(e).then(E=>{E.issue&&X.getState().setLinkedLinearIssue(e,E.issue)}).catch(()=>{})},[e]);const F=k.useCallback(async()=>{if(t)try{const E=await we.getLinkedLinearIssue(e,!0);E.issue&&(X.getState().setLinkedLinearIssue(e,E.issue),E.issue.stateType==="completed"&&b(!0)),E.comments&&i(E.comments),E.assignee!==void 0&&c(E.assignee??null),E.labels&&f(E.labels)}catch{}},[e,t]);k.useEffect(()=>{if(!t)return;F();const E=setInterval(F,vR);return()=>clearInterval(E)},[F,t]),k.useEffect(()=>{if(!_)return;const E=T.trim();if(E.length<2){C([]);return}let ae=!0;z(!0);const K=setTimeout(()=>{we.searchLinearIssues(E,6).then(Y=>{ae&&C(Y.issues)}).catch(()=>{ae&&C([])}).finally(()=>{ae&&z(!1)})},400);return()=>{ae=!1,clearTimeout(K)}},[T,_]),k.useEffect(()=>{_&&setTimeout(()=>{var E;return(E=D.current)==null?void 0:E.focus()},50)},[_]);async function B(){if(!(!t||!h.trim()||g)){v(!0);try{const E=await we.addLinearComment(t.id,h.trim());i(ae=>[...ae,E.comment]),p("")}catch{}finally{v(!1)}}}async function I(){try{await we.unlinkLinearIssue(e),X.getState().setLinkedLinearIssue(e,null),i([]),c(null),f([]),b(!1)}catch{}}async function L(E){try{await we.linkLinearIssue(e,E),X.getState().setLinkedLinearIssue(e,E),S(!1),j(""),C([])}catch{}}if(!t)return a.jsx("div",{className:"shrink-0 px-4 py-2.5",children:_?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(Zo,{className:"w-3.5 h-3.5 text-cc-muted shrink-0"}),a.jsx("input",{ref:D,type:"text",value:T,onChange:E=>j(E.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"}),a.jsx("button",{onClick:()=>{S(!1),j(""),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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})})]}),P&&a.jsx("p",{className:"text-[10px] text-cc-muted",children:"Searching..."}),R.length>0&&a.jsx("div",{className:"space-y-0.5 max-h-48 overflow-y-auto",children:R.map(E=>a.jsxs("button",{onClick:()=>L(E),className:"w-full text-left px-2 py-1.5 rounded-md hover:bg-cc-hover transition-colors cursor-pointer",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("span",{className:"text-[11px] font-mono-code text-cc-primary shrink-0",children:E.identifier}),a.jsx("span",{className:`text-[9px] font-medium px-1 rounded-full leading-[14px] ${Jp(E.stateType,E.stateName).cls}`,children:Jp(E.stateType,E.stateName).label})]}),a.jsx("p",{className:"text-[11px] text-cc-muted truncate mt-0.5",children:E.title})]},E.id))}),T.trim().length>=2&&!P&&R.length===0&&a.jsx("p",{className:"text-[10px] text-cc-muted text-center py-2",children:"No issues found"})]}):a.jsxs("button",{onClick:()=>S(!0),className:"flex items-center gap-1.5 text-[11px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:[a.jsx(Zo,{className:"w-3.5 h-3.5"}),"Link Linear issue"]})});const q=Jp(t.stateType,t.stateName);return a.jsxs("div",{className:"shrink-0",children:[a.jsxs("div",{className:"px-4 py-2.5 space-y-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(Zo,{className:"w-3.5 h-3.5 text-cc-muted shrink-0"}),a.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}),a.jsx("span",{className:`text-[9px] font-medium px-1.5 rounded-full leading-[16px] ${q.cls}`,children:q.label}),a.jsx("button",{onClick:I,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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})})]}),a.jsx("p",{className:"text-[11px] text-cc-muted truncate",title:t.title,children:t.title}),a.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-cc-muted",children:[t.priorityLabel&&a.jsx("span",{children:t.priorityLabel}),t.teamName&&a.jsxs(a.Fragment,{children:[t.priorityLabel&&a.jsx("span",{children:"·"}),a.jsx("span",{children:t.teamName})]}),l&&a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"·"}),a.jsxs("span",{children:["@ ",l.name]})]})]}),u.length>0&&a.jsx("div",{className:"flex flex-wrap gap-1",children:u.map(E=>a.jsx("span",{className:"text-[9px] px-1.5 py-0.5 rounded-full",style:{backgroundColor:`${E.color}20`,color:E.color},children:E.name},E.id))})]}),y&&t.stateType==="completed"&&a.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:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-[11px] text-cc-success font-medium",children:"Issue completed"}),a.jsx("p",{className:"text-[10px] text-cc-success/80",children:"Ticket moved to done."})]}),a.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[a.jsx("button",{onClick:()=>b(!1),className:"text-[10px] text-cc-muted hover:text-cc-fg px-1.5 py-0.5 rounded cursor-pointer",children:"Dismiss"}),a.jsx("button",{onClick:async()=>{try{await we.archiveSession(e),X.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&&a.jsxs("div",{className:"px-4 py-2 space-y-1.5 max-h-36 overflow-y-auto",children:[a.jsx("span",{className:"text-[10px] text-cc-muted uppercase tracking-wider",children:"Comments"}),n.slice(-3).map(E=>a.jsxs("div",{className:"text-[11px]",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"font-medium text-cc-fg",children:E.userName}),a.jsx("span",{className:"text-[9px] text-cc-muted",children:lR(new Date(E.createdAt).getTime())})]}),a.jsx("p",{className:"text-cc-muted line-clamp-2",children:E.body})]},E.id))]}),a.jsxs("div",{className:"px-4 py-2 flex items-center gap-1.5",children:[a.jsx("input",{type:"text",value:h,onChange:E=>p(E.target.value),onKeyDown:E=>{E.key==="Enter"&&!E.shiftKey&&(E.preventDefault(),B())},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"}),a.jsx("button",{onClick:B,disabled:!h.trim()||g,"aria-label":"Send comment",className:"flex items-center justify-center w-7 h-7 rounded-md text-cc-primary disabled:text-cc-muted cursor-pointer disabled:cursor-not-allowed transition-colors",title:"Send comment",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.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 yR({sessionId:e}){const t=X(l=>l.sessions.get(e)),n=yc(e);return((t==null?void 0:t.backend_type)||(n==null?void 0:n.backendType))==="codex"?a.jsxs(a.Fragment,{children:[a.jsx(hR,{sessionId:e}),a.jsx(pR,{sessionId:e})]}):a.jsx(fR,{sessionId:e})}function _R({sessionId:e}){const t=X(p=>p.sessions.get(e)),n=yc(e),i=(t==null?void 0:t.git_branch)||(n==null?void 0:n.gitBranch),l=(t==null?void 0:t.git_ahead)||0,c=(t==null?void 0:t.git_behind)||0,u=(t==null?void 0:t.total_lines_added)||0,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 i?a.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-1.5",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("p",{className:"text-xs font-mono-code text-cc-fg truncate",title:i,children:i}),(t==null?void 0:t.is_containerized)&&a.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"})]}),(l>0||c>0||u>0||f>0)&&a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"flex items-center gap-1.5 text-[11px]",children:[l>0&&a.jsxs("span",{className:"text-cc-success",children:[l,"↑",a.jsx("span",{className:"sr-only",children:" commits ahead"})]}),c>0&&a.jsxs("span",{className:"text-cc-warning",children:[c,"↓",a.jsx("span",{className:"sr-only",children:" commits behind"})]}),u>0&&a.jsxs("span",{className:"text-cc-success",children:["+",u,a.jsx("span",{className:"sr-only",children:" lines added"})]}),f>0&&a.jsxs("span",{className:"text-cc-error",children:["-",f,a.jsx("span",{className:"sr-only",children:" lines removed"})]})]}),c>0&&h&&a.jsx("button",{type:"button",className:"text-[11px] font-medium text-cc-warning hover:text-cc-warning/80 transition-colors cursor-pointer",onClick:()=>{we.gitPull(h).then(p=>{X.getState().updateSession(e,{git_ahead:p.git_ahead,git_behind:p.git_behind}),p.success||Jr(new Error(`git pull failed: ${p.output}`))}).catch(p=>Jr(p))},title:"Pull latest changes",children:"Pull"})]})]}):null}function wR({sessionId:e}){const t=X(c=>c.sessionTasks.get(e)||R2),n=X(c=>c.sessions.get(e)),i=yc(e),l=((n==null?void 0:n.backend_type)||(i==null?void 0:i.backendType))==="codex";return!n||l?null:a.jsx("div",{className:"px-3 py-2",children:t.length===0?a.jsx("p",{className:"text-[11px] text-cc-muted text-center py-6",children:"Tasks will appear here as the agent works"}):a.jsx("div",{className:"space-y-0.5",children:t.map(c=>a.jsx(ER,{task:c},c.id))})})}const kR={"usage-limits":yR,"git-branch":_R,"github-pr":xR,"linear-issue":bR,"mcp-servers":tR,tasks:wR};function SR(e,t){const n=X(i=>i.sessionTasks.get(t)||R2);if(e==="tasks"&&n.length>0){const i=n.filter(l=>l.status==="completed").length;return a.jsxs("span",{className:"text-[10px] text-cc-muted tabular-nums",children:[i,"/",n.length]})}return null}function jR({isCodex:e}){const t=X(p=>p.taskPanelConfig),n=X(p=>p.toggleSectionEnabled),i=X(p=>p.moveSectionUp),l=X(p=>p.moveSectionDown),c=X(p=>p.resetTaskPanelConfig),u=X(p=>p.setTaskPanelConfigMode),f=e?"codex":"claude",h=t.order.filter(p=>{const g=Ti.find(v=>v.id===p);return!(!g||g.backends&&!g.backends.includes(f))});return a.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[a.jsx("div",{className:"flex-1 overflow-y-auto px-3 py-3 space-y-1",children:h.map((p,g)=>{const v=Ti.find(S=>S.id===p),y=t.enabled[p]??!0,b=g===0,_=g===h.length-1;return a.jsxs("div",{"data-testid":`config-section-${p}`,className:`flex items-center gap-2 px-2.5 py-2 rounded-lg border border-cc-border transition-opacity ${y?"bg-cc-bg":"bg-cc-hover/50 opacity-60"}`,children:[a.jsxs("div",{className:"flex flex-col gap-0.5 shrink-0",children:[a.jsx("button",{onClick:()=>i(p),disabled:b,className:"w-5 h-4 flex items-center justify-center text-cc-muted hover:text-cc-fg disabled:opacity-20 disabled:cursor-not-allowed cursor-pointer transition-colors",title:"Move up","data-testid":`move-up-${p}`,children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.jsx("path",{d:"M8 4l4 4H4l4-4z"})})}),a.jsx("button",{onClick:()=>l(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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.jsx("path",{d:"M8 12l4-4H4l4 4z"})})})]}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("span",{className:"text-[12px] font-medium text-cc-fg block",children:v.label}),a.jsx("span",{className:"text-[10px] text-cc-muted block truncate",children:v.description})]}),a.jsx("button",{onClick:()=>n(p),className:`shrink-0 w-8 h-[18px] rounded-full transition-colors cursor-pointer relative ${y?"bg-cc-primary":"bg-cc-hover"}`,title:y?"Hide section":"Show section",role:"switch","aria-checked":y,"data-testid":`toggle-${p}`,children:a.jsx("span",{className:`absolute top-[2px] left-0 w-[14px] h-[14px] rounded-full bg-white shadow transition-transform ${y?"translate-x-[16px]":"translate-x-[2px]"}`})})]},p)})}),a.jsxs("div",{className:"shrink-0 px-3 py-2.5 flex items-center justify-between border-t border-cc-separator",children:[a.jsx("button",{onClick:()=>c(),className:"text-[11px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer","data-testid":"reset-panel-config",children:"Reset to defaults"}),a.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 NR({sectionId:e,sessionId:t,children:n}){var c;const i=((c=Ti.find(u=>u.id===e))==null?void 0:c.label)??e,l=SR(e,t);return a.jsx(dR,{id:e,label:i,badge:l,children:n})}function CR({sessionId:e}){const t=X(g=>g.sessions.get(e)),n=yc(e),i=X(g=>g.taskPanelOpen),l=X(g=>g.setTaskPanelOpen),c=X(g=>g.taskPanelConfigMode),u=X(g=>g.taskPanelConfig);if(!i)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(g=>{const v=Ti.find(y=>y.id===g);return!(!v||v.backends&&!v.backends.includes(h))});return a.jsxs("aside",{"aria-label":"Session context",className:"w-full lg:w-[320px] h-full flex flex-col overflow-hidden bg-cc-card",children:[a.jsxs("div",{className:"shrink-0 h-11 flex items-center justify-between px-4 bg-cc-card border-b border-cc-separator",children:[a.jsx("h2",{className:"text-sm font-semibold text-cc-fg tracking-tight",children:c?"Panel Settings":"Context"}),a.jsx("button",{onClick:()=>{c?X.getState().setTaskPanelConfigMode(!1):l(!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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})})]}),c?a.jsx(jR,{isCodex:f}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{"data-testid":"task-panel-content",className:"min-h-0 flex-1 overflow-y-auto",children:[a.jsx(aR,{sessionId:e}),p.filter(g=>u.enabled[g]!==!1).map(g=>{var y;const v=kR[g];return v?a.jsx(NR,{sectionId:g,sessionId:e,children:a.jsx(oR,{label:(y=Ti.find(b=>b.id===g))==null?void 0:y.label,children:a.jsx(v,{sessionId:e})})},g):null})]}),a.jsx("div",{className:"shrink-0 px-4 py-2 pb-safe border-t border-cc-separator",children:a.jsxs("button",{onClick:()=>X.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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.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 ER({task:e}){const t=e.status==="completed",n=e.status==="in_progress";return a.jsxs("div",{className:`px-2.5 py-2 rounded-lg ${t?"opacity-50":""}`,children:[a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsxs("span",{className:"shrink-0 flex items-center justify-center w-4 h-4 mt-px",children:[n?a.jsx("svg",{className:"w-4 h-4 text-cc-primary animate-spin",viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:a.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"28",strokeDashoffset:"8",strokeLinecap:"round"})}):t?a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-cc-success","aria-hidden":!0,children:a.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.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-4 h-4 text-cc-muted","aria-hidden":!0,children:a.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"})}),a.jsx("span",{className:"sr-only",children:n?"In progress":t?"Completed":"Pending"})]}),a.jsx("span",{className:`text-[13px] leading-snug flex-1 ${t?"text-cc-muted line-through":"text-cc-fg"}`,children:e.subject})]}),n&&e.activeForm&&a.jsx("p",{className:"mt-1 ml-6 text-[11px] text-cc-muted italic truncate",children:e.activeForm}),e.blockedBy&&e.blockedBy.length>0&&a.jsxs("p",{className:"mt-1 ml-6 text-[11px] text-cc-muted flex items-center gap-1",children:[a.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3 h-3 shrink-0","aria-hidden":!0,children:[a.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),a.jsx("path",{d:"M5 8h6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),a.jsxs("span",{children:["blocked by ",e.blockedBy.map(i=>`#${i}`).join(", ")]})]})]})}function TR({status:e}){return e==="created"?a.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"?a.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"}):a.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 AR({sessionId:e}){const t=X(z=>z.sessions.get(e)),n=X(z=>z.sdkSessions.find(D=>D.sessionId===e)),i=X(z=>z.diffPanelSelectedFile.get(e)??null),l=X(z=>z.setDiffPanelSelectedFile),c=X(z=>z.diffBase),u=X(z=>z.setDiffBase),f=X(z=>z.changedFilesTick.get(e)??0),h=(t==null?void 0:t.cwd)||(n==null?void 0:n.cwd),[p,g]=k.useState(""),[v,y]=k.useState(!1),[b,_]=k.useState(()=>typeof window<"u"?window.innerWidth>=640:!0),[S,T]=k.useState([]),j=X(z=>z.setGitChangedFilesCount);k.useEffect(()=>{if(!h)return;let z=!1;return we.getChangedFiles(h,c).then(({files:D})=>{if(z)return;const F=`${h}/`,B=D.filter(I=>I.path===h||I.path.startsWith(F)).map(I=>({abs:I.path,rel:I.path.startsWith(F)?I.path.slice(F.length):I.path,status:I.status==="A"||I.status==="?"?"created":I.status==="D"?"deleted":"updated"})).sort((I,L)=>I.rel.localeCompare(L.rel));T(B),j(e,B.length)}).catch(()=>{z||(T([]),j(e,0))}),()=>{z=!0}},[h,c,f,e,j]);const R=S;k.useEffect(()=>{!i&&R.length>0&&l(e,R[0].abs)},[i,R,e,l]),k.useEffect(()=>{var z;i&&(R.some(D=>D.abs===i)||l(e,((z=R[0])==null?void 0:z.abs)??null))},[i,R,e,l]),k.useEffect(()=>{if(!i){g("");return}let z=!1;return y(!0),we.getFileDiff(i,c).then(D=>{z||(g(D.diff),y(!1))}).catch(()=>{z||(g(""),y(!1))}),()=>{z=!0}},[i,c]);const C=k.useCallback(z=>{l(e,z),typeof window<"u"&&window.innerWidth<640&&_(!1)},[e,l]),P=k.useMemo(()=>!i||!h?i:i.startsWith(h+"/")?i.slice(h.length+1):i,[i,h]);return h?R.length===0?a.jsxs("div",{className:"h-full flex flex-col items-center justify-center gap-4 select-none px-6",children:[a.jsx("div",{className:"w-14 h-14 rounded-2xl bg-cc-card border border-cc-border flex items-center justify-center",children:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-7 h-7 text-cc-muted",children:a.jsx("path",{d:"M12 3v18M3 12h18",strokeLinecap:"round"})})}),a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"text-sm text-cc-fg font-medium mb-1",children:"No changes yet"}),a.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."})]})]}):a.jsxs("div",{className:"h-full flex bg-cc-bg relative",children:[b&&a.jsx("div",{className:"fixed inset-0 bg-black/30 z-20 sm:hidden",onClick:()=>_(!1)}),a.jsxs("div",{className:`
|
|
116
|
+
${b?"w-[220px] translate-x-0":"w-0 -translate-x-full"}
|
|
117
|
+
fixed sm:relative z-30 sm:z-auto
|
|
118
|
+
${b?"sm:w-[220px]":"sm:w-0 sm:-translate-x-full"}
|
|
119
|
+
shrink-0 h-full flex flex-col bg-cc-sidebar border-r border-cc-border transition-all duration-200 overflow-hidden
|
|
120
|
+
`,children:[a.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:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-warning"}),a.jsxs("span",{children:["Changed (",R.length,")"]})]}),a.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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),a.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden py-1",children:R.map(({abs:z,rel:D,status:F})=>a.jsxs("button",{onClick:()=>C(z),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 ${z===i?"bg-cc-active text-cc-fg":"text-cc-fg/70"}`,style:{width:"calc(100% - 8px)"},children:[a.jsx(TR,{status:F}),a.jsx("span",{className:"truncate leading-snug",children:D})]},z))})]}),a.jsxs("div",{className:"flex-1 min-w-0 h-full flex flex-col",children:[i&&a.jsxs("div",{className:"shrink-0 flex items-center gap-2 sm:gap-2.5 px-2 sm:px-4 py-2.5 bg-cc-card border-b border-cc-border",children:[!b&&a.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:a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.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"})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("span",{className:"text-cc-fg text-[13px] font-medium truncate block",children:P==null?void 0:P.split("/").pop()}),a.jsx("span",{className:"text-cc-muted truncate text-[11px] hidden sm:block font-mono-code",children:P})]}),a.jsx("button",{onClick:()=>u(c==="last-commit"?"default-branch":"last-commit"),className:"text-cc-muted text-[11px] shrink-0 hidden sm:inline hover:text-cc-fg transition-colors cursor-pointer",title:`Switch to ${c==="last-commit"?"default branch":"last commit"} comparison`,children:c==="default-branch"?"vs default branch":"vs last commit"})]}),a.jsx("div",{className:"flex-1 overflow-auto",children:v?a.jsx("div",{className:"h-full flex items-center justify-center",children:a.jsx("div",{className:"w-5 h-5 border-2 border-cc-primary border-t-transparent rounded-full animate-spin"})}):i?a.jsx("div",{className:"p-4",children:a.jsx(pl,{unifiedDiff:p,fileName:P||void 0,mode:"full"})}):a.jsxs("div",{className:"h-full flex flex-col items-center justify-center",children:[!b&&a.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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:a.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"]}),a.jsx("p",{className:"text-cc-muted text-sm",children:"Select a file to view changes"})]})})]})]}):a.jsx("div",{className:"flex-1 flex items-center justify-center h-full",children:a.jsx("p",{className:"text-cc-muted text-sm",children:"Waiting for session to initialize..."})})}function MR(){const e=X(h=>h.updateInfo),t=X(h=>h.updateDismissedVersion),n=X(h=>h.dismissUpdate),[i,l]=k.useState(!1);if(!(e!=null&&e.updateAvailable)||!e.latestVersion||t===e.latestVersion)return null;const c=async()=>{l(!0);try{localStorage.setItem("companion_docker_prompt_pending","1"),await we.triggerUpdate(),X.getState().setUpdateOverlayActive(!0)}catch(h){localStorage.removeItem("companion_docker_prompt_pending"),Jr(h),l(!1)}},u=()=>{n(e.latestVersion)},f=i||e.updateInProgress;return a.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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary shrink-0",children:a.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"})}),a.jsxs("span",{className:"text-xs text-cc-fg",children:[a.jsxs("span",{className:"font-medium",children:["v",e.latestVersion]})," available",a.jsxs("span",{className:"text-cc-muted ml-1",children:["(current: v",e.currentVersion,")"]})]}),e.isServiceMode?a.jsx("button",{onClick:c,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"}):a.jsxs("span",{className:"text-xs text-cc-muted",children:["Run"," ",a.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"]}),a.jsx("button",{onClick:u,className:"text-cc-muted hover:text-cc-fg transition-colors cursor-pointer ml-auto",title:"Dismiss",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})})]})}function RR(){const e=X(v=>v.claudeCompatInfo),t=X(v=>v.setClaudeCompatInfo),[n,i]=k.useState(null),[l,c]=k.useState(null);if(!e||!e.isIncompatible||e.bannerDismissedVersion&&e.installedVersion===e.bannerDismissedVersion)return null;const u=async()=>{c(null),i("pin");try{const v=await we.pinClaudeVersion();t(v)}catch(v){const y=v instanceof Error?v.message:String(v);c(y),Jr(v)}finally{i(null)}},f=async()=>{c(null),i("patch");try{const v=await we.patchClaudeBinary();t(v)}catch(v){const y=v instanceof Error?v.message:String(v);c(y),Jr(v)}finally{i(null)}},h=async()=>{if(e.installedVersion){c(null),i("dismiss");try{await we.dismissClaudeCompatBanner(e.installedVersion),t({...e,bannerDismissedVersion:e.installedVersion})}catch(v){Jr(v)}finally{i(null)}}},p=e.suggestedPinTarget!==null,g=p?`Pin to v${e.suggestedPinTarget}`:"Pin (no cached known-good version)";return a.jsxs("div",{role:"alert","data-testid":"claude-compat-banner",className:"px-4 py-1.5 bg-red-500/10 border-b border-red-500/20 flex items-center justify-center gap-3 flex-wrap",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-red-500 shrink-0","aria-hidden":"true",children:a.jsx("path",{d:"M8 1a7 7 0 1 1 0 14A7 7 0 0 1 8 1zm.75 4a.75.75 0 0 0-1.5 0v4a.75.75 0 0 0 1.5 0V5zM8 11a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"})}),a.jsxs("span",{className:"text-xs text-cc-fg",children:[a.jsxs("span",{className:"font-medium",children:["Claude CLI v",e.installedVersion]})," rejects local"," ",a.jsx("code",{className:"font-mono-code bg-cc-code-bg px-1 py-0.5 rounded text-cc-code-fg",children:"--sdk-url"})," —",a.jsx("span",{className:"text-cc-muted ml-1",children:"companion sessions will fail until you pin or patch."})]}),a.jsx("button",{type:"button",onClick:u,disabled:n!==null||!p,className:"text-xs font-medium px-2.5 py-0.5 rounded-md bg-cc-elev hover:bg-cc-elev-hover text-cc-fg transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",title:p?`Re-symlinks ~/.local/bin/claude to the cached v${e.suggestedPinTarget} binary.`:"No known-good Claude version is cached under ~/.local/share/claude/versions/.",children:n==="pin"?"Pinning...":g}),a.jsx("button",{type:"button",onClick:f,disabled:n!==null,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",title:"Byte-patches this version so it accepts [::1] in --sdk-url, then routes session WS through a TLS listener on [::1].",children:n==="patch"?"Patching...":"Patch this version"}),a.jsx("button",{type:"button",onClick:h,disabled:n!==null,className:"text-cc-muted hover:text-cc-fg transition-colors cursor-pointer ml-auto disabled:opacity-50",title:"Dismiss until a new Claude version is installed","aria-label":"Dismiss compatibility banner",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3","aria-hidden":"true",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})}),l?a.jsx("div",{className:"basis-full text-xs text-red-500 text-center mt-1",children:l}):null]})}function DR({steps:e,error:t,backend:n,onCancel:i}){const l=n==="codex"?"/logo-codex.svg":"/logo.svg",c=e.some(v=>v.status==="in_progress"),u=e.length>0&&e.every(v=>v.status==="done"),f=e.some(v=>v.status==="error")||!!t,h=[...e].reverse().find(v=>v.status==="in_progress"),p=[...e].reverse().find(v=>v.status==="done"),g=f?"Something went wrong":u?"Launching session...":(h==null?void 0:h.label)||(p==null?void 0:p.label)||"Preparing...";return a.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:[a.jsxs("div",{className:"relative mb-8",children:[c&&!f&&a.jsx("div",{className:"absolute inset-0 -m-4 rounded-full bg-cc-primary/10 animate-pulse"}),a.jsx("img",{src:l,alt:"Launching",className:`w-20 h-20 relative z-10 transition-transform duration-500 ${c&&!f?"scale-110":""} ${f?"opacity-40 grayscale":""}`}),c&&!f&&a.jsx("div",{className:"absolute -inset-3 z-0",children:a.jsx("svg",{className:"w-full h-full animate-spin-slow",viewBox:"0 0 100 100",children:a.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&&a.jsx("div",{className:"absolute -inset-3 z-0 rounded-full border-2 border-cc-success/30"})]}),a.jsx("p",{className:`text-sm font-medium mb-6 transition-colors ${f?"text-cc-error":"text-cc-fg"}`,children:g}),a.jsx("div",{className:"w-full max-w-xs space-y-2 px-4",children:e.map((v,y)=>a.jsxs("div",{className:"flex items-center gap-3 transition-all duration-300",style:{animationDelay:`${y*60}ms`},children:[a.jsxs("div",{className:"w-5 h-5 flex items-center justify-center shrink-0",children:[v.status==="in_progress"&&a.jsx("span",{className:"w-4 h-4 border-2 border-cc-primary/30 border-t-cc-primary rounded-full animate-spin"}),v.status==="done"&&a.jsx("div",{className:"w-5 h-5 rounded-full bg-cc-success/15 flex items-center justify-center",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3 h-3 text-cc-success",children:a.jsx("path",{d:"M13.25 4.75L6 12 2.75 8.75",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),v.status==="error"&&a.jsx("div",{className:"w-5 h-5 rounded-full bg-cc-error/15 flex items-center justify-center",children:a.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3 h-3 text-cc-error",children:a.jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),a.jsx("span",{className:`text-xs transition-colors duration-200 ${v.status==="in_progress"?"text-cc-fg font-medium":v.status==="done"?"text-cc-muted":"text-cc-error font-medium"}`,children:v.label}),v.detail&&v.status==="in_progress"&&a.jsx("span",{className:"text-[10px] text-cc-muted truncate ml-auto max-w-[120px]",children:v.detail})]},v.step))}),t&&a.jsx("div",{className:"mt-5 w-full max-w-xs px-4",children:a.jsx("div",{className:"px-3 py-2.5 rounded-lg bg-cc-error/5 border border-cc-error/20",children:a.jsx("p",{className:"text-[11px] text-cc-error whitespace-pre-wrap font-mono-code leading-relaxed",children:t})})}),(f||c)&&i&&a.jsx("button",{onClick:i,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&&a.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-cc-border/30",children:a.jsx("div",{className:"h-full bg-cc-primary/60 transition-all duration-500 ease-out",style:{width:`${Math.round(e.filter(v=>v.status==="done").length/Math.max(e.length,1)*100)}%`}})})]})}function zR(){const e=localStorage.getItem("companion_auth_token");return e?{Authorization:`Bearer ${e}`}:{}}const LR={installing:"Installing update...",restarting:"Restarting server...",waiting:"Waiting for server...",ready:"Update complete!"};function OR(e){const[t,n]=k.useState("installing"),i=k.useRef(null),l=k.useRef(!0);return k.useEffect(()=>(l.current=!0,()=>{l.current=!1,i.current&&clearTimeout(i.current)}),[]),k.useEffect(()=>{if(!e)return;const c=setTimeout(()=>{l.current&&n("restarting")},3e3),u=setTimeout(()=>{l.current&&n("waiting"),f()},5e3);function f(){l.current&&fetch("/api/update-check",{signal:AbortSignal.timeout(3e3),headers:zR()}).then(h=>{if(!h.ok)throw new Error("not ready");return h.json()}).then(()=>{l.current&&(n("ready"),setTimeout(()=>{l.current&&window.location.reload()},800))}).catch(()=>{i.current=setTimeout(f,1500)})}return()=>{clearTimeout(c),clearTimeout(u),i.current&&clearTimeout(i.current)}},[e]),t}function B2({phase:e,className:t}){const n=e==="ready";return a.jsxs("div",{className:`flex flex-col items-center justify-center bg-cc-bg animate-fade-in ${t??""}`,children:[a.jsxs("div",{className:"relative mb-8",children:[!n&&a.jsx("div",{className:"absolute inset-0 -m-4 rounded-full bg-cc-primary/10 animate-pulse"}),a.jsx("img",{src:"/logo.svg",alt:"Updating",className:`w-20 h-20 relative z-10 transition-transform duration-500 ${n?"":"scale-110"}`}),!n&&a.jsx("div",{className:"absolute -inset-3 z-0",children:a.jsx("svg",{className:"w-full h-full animate-spin-slow",viewBox:"0 0 100 100",children:a.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&&a.jsx("div",{className:"absolute -inset-3 z-0 rounded-full border-2 border-cc-success/30 animate-fade-in"})]}),a.jsx("p",{className:`text-sm font-medium mb-2 transition-colors ${n?"text-cc-success":"text-cc-fg"}`,children:LR[e]}),a.jsx("p",{className:"text-xs text-cc-muted",children:n?"Reloading...":"This page will refresh automatically"}),!n&&a.jsx("div",{className:"flex gap-1.5 mt-6",children:[0,1,2].map(i=>a.jsx("span",{"data-testid":"progress-dot",className:"w-1.5 h-1.5 rounded-full bg-cc-primary/50",style:{animation:"pulse-dot 1.4s ease-in-out infinite",animationDelay:`${i*.2}s`}},i))}),a.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-cc-border/30",children:a.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 BR({active:e}){const t=OR(e);return e?a.jsx(B2,{phase:t,className:"fixed inset-0 z-[100]"}):null}function cD({phase:e}){return a.jsx(B2,{phase:e,className:"absolute inset-0"})}function $R(){const e=X(S=>S.dockerUpdateDialogOpen),t=X(S=>S.setDockerUpdateDialogOpen),[n,i]=k.useState("prompt"),[l,c]=k.useState(!1),[u,f]=k.useState(null),h=k.useRef(null);if(k.useEffect(()=>{e&&we.getSettings().then(S=>{c(S.dockerAutoUpdate),S.dockerAutoUpdate&&p()}).catch(()=>{})},[e]),k.useEffect(()=>{if(n!=="pulling"){h.current&&(clearInterval(h.current),h.current=null);return}return h.current=setInterval(()=>{we.getImageStatus("the-companion:latest").then(S=>{f(S),S.status==="ready"?i("done"):S.status==="error"&&i("error")}).catch(()=>{})},2e3),()=>{h.current&&(clearInterval(h.current),h.current=null)}},[n]),!e)return null;function p(){i("pulling"),we.pullImage("the-companion:latest").then(S=>{S.state&&f(S.state)}).catch(()=>{i(S=>S==="pulling"?"error":S)})}function g(){p()}function v(){b()}function y(){b()}function b(){i("prompt"),f(null),t(!1)}async function _(){const S=!l;c(S);try{await we.updateSettings({dockerAutoUpdate:S})}catch{c(!S)}}return a.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:a.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"&&a.jsxs("div",{className:"p-6",children:[a.jsx("h2",{className:"text-base font-semibold text-cc-fg mb-2",children:"Update Sandbox Image?"}),a.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?"}),a.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:[a.jsx("span",{children:"Always update Docker image automatically"}),a.jsx("span",{role:"switch","aria-checked":l,"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 ${l?"bg-cc-primary":"bg-cc-border"}`,children:a.jsx("span",{className:`pointer-events-none inline-block h-4 w-4 rounded-full bg-white shadow transform transition-transform ${l?"translate-x-4":"translate-x-0"}`})})]}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx("button",{type:"button",onClick:v,className:"px-4 py-2 min-h-[40px] rounded-lg text-sm font-medium bg-cc-hover hover:bg-cc-active text-cc-fg transition-colors cursor-pointer",children:"Skip"}),a.jsx("button",{type:"button",onClick:g,className:"px-4 py-2 min-h-[40px] rounded-lg text-sm font-medium bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Update"})]})]}),n==="pulling"&&a.jsxs("div",{className:"p-6",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.jsx("svg",{className:"w-4 h-4 animate-spin text-cc-primary",viewBox:"0 0 24 24",fill:"none",children:a.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2.5",strokeDasharray:"31.4 31.4",strokeLinecap:"round"})}),a.jsx("h2",{className:"text-base font-semibold text-cc-fg",children:"Updating Sandbox Image..."})]}),a.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&&a.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(`
|
|
121
|
+
`)})]}),n==="done"&&a.jsxs("div",{className:"p-6",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-cc-success",children:a.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"})}),a.jsx("h2",{className:"text-base font-semibold text-cc-success",children:"Sandbox Image Updated"})]}),a.jsx("p",{className:"text-sm text-cc-muted mb-5",children:"The Docker image has been updated successfully."}),a.jsx("div",{className:"flex justify-end",children:a.jsx("button",{type:"button",onClick:y,className:"px-4 py-2 min-h-[40px] rounded-lg text-sm font-medium bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Done"})})]}),n==="error"&&a.jsxs("div",{className:"p-6",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-cc-error",children:a.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"})}),a.jsx("h2",{className:"text-base font-semibold text-cc-error",children:"Image Update Failed"})]}),a.jsxs("p",{className:"text-sm text-cc-muted mb-2",children:["Failed to update the Docker image.",(u==null?void 0:u.error)&&a.jsx("span",{className:"block mt-1 text-xs text-cc-error",children:u.error})]}),(u==null?void 0:u.progress)&&u.progress.length>0&&a.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(`
|
|
122
|
+
`)}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx("button",{type:"button",onClick:b,className:"px-4 py-2 min-h-[40px] rounded-lg text-sm font-medium bg-cc-hover hover:bg-cc-active text-cc-fg transition-colors cursor-pointer",children:"Close"}),a.jsx("button",{type:"button",onClick:g,className:"px-4 py-2 min-h-[40px] rounded-lg text-sm font-medium bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Retry"})]})]})]})})}function uD({phase:e}){return a.jsx("div",{className:"relative bg-black/50 rounded-lg overflow-hidden h-[300px] flex items-center justify-center",children:a.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"&&a.jsxs("div",{className:"p-5",children:[a.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-1.5",children:"Update Sandbox Image?"}),a.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?"}),a.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:[a.jsx("span",{children:"Always update automatically"}),a.jsx("span",{className:"relative inline-flex h-4 w-7 rounded-full bg-cc-border",children:a.jsx("span",{className:"inline-block h-3 w-3 rounded-full bg-white shadow translate-x-0 mt-0.5 ml-0.5"})})]}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-hover text-cc-fg",children:"Skip"}),a.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-primary text-white",children:"Update"})]})]}),e==="pulling"&&a.jsxs("div",{className:"p-5",children:[a.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[a.jsx("svg",{className:"w-3.5 h-3.5 animate-spin text-cc-primary",viewBox:"0 0 24 24",fill:"none",children:a.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2.5",strokeDasharray:"31.4 31.4",strokeLinecap:"round"})}),a.jsx("h2",{className:"text-sm font-semibold text-cc-fg",children:"Updating Sandbox Image..."})]}),a.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...
|
|
123
|
+
Layer 1/5: abc123 downloading
|
|
124
|
+
Layer 2/5: def456 complete`})]}),e==="done"&&a.jsxs("div",{className:"p-5",children:[a.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-success",children:a.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"})}),a.jsx("h2",{className:"text-sm font-semibold text-cc-success",children:"Sandbox Image Updated"})]}),a.jsx("p",{className:"text-xs text-cc-muted mb-4",children:"The Docker image has been updated successfully."}),a.jsx("div",{className:"flex justify-end",children:a.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-primary text-white",children:"Done"})})]}),e==="error"&&a.jsxs("div",{className:"p-5",children:[a.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-error",children:a.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"})}),a.jsx("h2",{className:"text-sm font-semibold text-cc-error",children:"Image Update Failed"})]}),a.jsx("p",{className:"text-xs text-cc-muted mb-4",children:"Failed to update the Docker image."}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-hover text-cc-fg",children:"Close"}),a.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-primary text-white",children:"Retry"})]})]})]})})}const em=["welcome","claude","codex","done"],N5='button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])';function fg(){return typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function PR({onComplete:e}){const[t,n]=k.useState("welcome"),[i,l]=k.useState(""),[c,u]=k.useState(""),[f,h]=k.useState(!1),[p,g]=k.useState(""),[v,y]=k.useState(!1),[b,_]=k.useState(!1),[S,T]=k.useState(fg),j=k.useRef(null);k.useEffect(()=>{S||requestAnimationFrame(()=>T(!0))},[S]),k.useEffect(()=>{const q=j.current;if(!q)return;function E(K){if(K.key==="Escape"){K.preventDefault();return}if(K.key!=="Tab")return;const Y=q.querySelectorAll(N5);if(Y.length===0)return;const U=Y[0],$=Y[Y.length-1];K.shiftKey?document.activeElement===U&&(K.preventDefault(),$.focus()):document.activeElement===$&&(K.preventDefault(),U.focus())}document.addEventListener("keydown",E);const ae=q.querySelector(N5);return ae==null||ae.focus(),()=>document.removeEventListener("keydown",E)},[t]);const R=k.useCallback(async()=>{if(!i.trim()){n("codex");return}h(!0),g("");try{await we.updateSettings({claudeCodeOAuthToken:i.trim()}),y(!0),n("codex")}catch(q){g(q instanceof Error?q.message:"Failed to save token")}finally{h(!1)}},[i]),C=k.useCallback(async()=>{h(!0),g("");try{(await we.getSettings()).codexDeviceAuthConfigured?(_(!0),await z()):g("No Codex auth found. Run codex --login in your terminal first.")}catch(q){g(q instanceof Error?q.message:"Failed to check auth status")}finally{h(!1)}},[]),P=k.useCallback(async()=>{h(!0),g("");try{await we.updateSettings({openaiApiKey:c.trim()}),_(!0),await z()}catch(q){g(q instanceof Error?q.message:"Failed to save API key")}finally{h(!1)}},[c]),z=k.useCallback(async()=>{try{await we.updateSettings({onboardingCompleted:!0})}catch{}n("done")},[]),D=k.useCallback(()=>{e()},[e]),F=k.useCallback(async()=>{await z(),e()},[z,e]),B=k.useCallback(q=>{g(""),n(q)},[]),I=em.indexOf(t),L=fg();return gl.createPortal(a.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:S?1:0,transition:L?"none":"opacity 400ms cubic-bezier(0.16, 1, 0.3, 1)"},children:[a.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}}),a.jsxs("div",{ref:j,role:"dialog","aria-modal":"true","aria-label":"Provider setup",className:"w-full max-w-[520px] mx-6",style:{transform:S?"translateY(0)":"translateY(12px)",opacity:S?1:0,transition:L?"none":"transform 500ms cubic-bezier(0.16, 1, 0.3, 1) 100ms, opacity 400ms cubic-bezier(0.16, 1, 0.3, 1) 100ms"},children:[t!=="done"&&a.jsx("div",{className:"flex items-center gap-1.5 mb-6 justify-center",role:"status","aria-label":`Step ${I+1} of ${em.length-1}`,children:em.slice(0,3).map((q,E)=>a.jsx("div",{className:"h-[3px] rounded-full transition-[transform,background,opacity] duration-300",style:{width:32,transform:E===I?"scaleX(1)":"scaleX(0.375)",transformOrigin:"center",background:E<=I?"var(--color-cc-primary)":"var(--color-cc-border)",opacity:E<=I?1:.5}},q))}),a.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"&&a.jsx(UR,{onSetupClaude:()=>B("claude"),onSetupCodex:()=>B("codex")}),t==="claude"&&a.jsx(FR,{token:i,onTokenChange:l,onSave:R,onSkip:()=>B("codex"),saving:f,error:p}),t==="codex"&&a.jsx(HR,{apiKey:c,onApiKeyChange:u,onCheckAuth:C,onSaveApiKey:P,onSkip:()=>z(),onBack:()=>B("claude"),saving:f,error:p}),t==="done"&&a.jsx(qR,{claudeConfigured:v,codexConfigured:b,onDone:D})]}),t==="welcome"&&a.jsx("button",{onClick:F,className:"w-full text-center text-xs text-cc-muted hover:text-cc-fg transition-colors mt-4 min-h-[44px] flex items-center justify-center",children:"Skip setup — I'll configure this later in Settings"})]})]}),document.body)}function UR({onSetupClaude:e,onSetupCodex:t}){return a.jsxs("div",{className:"p-7 pb-6",children:[a.jsxs("div",{className:"mb-6",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-cc-muted font-medium mb-2",children:"First time setup"}),a.jsx("h2",{className:"text-xl font-semibold text-cc-fg leading-tight",children:"Welcome to The Companion"}),a.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."})]}),a.jsxs("div",{className:"space-y-2.5",children:[a.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:[a.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"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"text-[13px] font-medium text-cc-fg",children:"Claude Code"}),a.jsx("div",{className:"text-[11px] text-cc-muted leading-snug mt-0.5",children:"Anthropic's coding agent — requires an OAuth token"})]}),a.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:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),a.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:[a.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"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"text-[13px] font-medium text-cc-fg",children:"Codex"}),a.jsx("div",{className:"text-[11px] text-cc-muted leading-snug mt-0.5",children:"OpenAI's coding agent — log in via ChatGPT"})]}),a.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:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]})]})]})}function FR({token:e,onTokenChange:t,onSave:n,onSkip:i,saving:l,error:c}){const u=k.useRef(null);k.useEffect(()=>{var h;(h=u.current)==null||h.focus()},[]);const f="claude-token-error";return a.jsxs("div",{className:"p-7 pb-6",children:[a.jsxs("div",{className:"mb-5",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-cc-muted font-medium mb-2",children:"Step 1 of 2"}),a.jsx("h2",{className:"text-xl font-semibold text-cc-fg leading-tight",children:"Set up Claude Code"}),a.jsx("p",{className:"text-sm text-cc-muted mt-1.5 leading-relaxed",children:"Generate an OAuth token by running this in your terminal:"})]}),a.jsxs("div",{className:"rounded-lg overflow-hidden mb-4 border border-cc-border",style:{background:"var(--color-cc-code-bg)"},children:[a.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-cc-border",children:[a.jsxs("div",{className:"flex items-center gap-1.5","aria-hidden":"true",children:[a.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-error opacity-60"}),a.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-warning opacity-60"}),a.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-success opacity-60"})]}),a.jsx($2,{text:"claude setup-token"})]}),a.jsx("div",{className:"px-3.5 py-3",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-cc-muted text-xs font-mono-code select-none","aria-hidden":"true",children:"$"}),a.jsx("code",{className:"text-[13px] font-mono-code text-cc-fg select-all",children:"claude setup-token"})]})})]}),a.jsxs("div",{className:"mb-4",children:[a.jsx("label",{htmlFor:"claude-token",className:"text-xs text-cc-muted block mb-1.5",children:"OAuth Token"}),a.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":c?f:void 0,"aria-invalid":c?!0:void 0,className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg border border-cc-border text-cc-fg placeholder:text-cc-muted/60 focus:outline-none focus:ring-1 focus:ring-cc-primary focus:border-cc-primary font-mono-code transition-shadow duration-150"})]}),c&&a.jsxs("div",{id:f,role:"alert",className:"flex items-start gap-2 mb-4 text-xs text-cc-error",children:[a.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:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("path",{d:"M12 8v4m0 4h.01"})]}),a.jsx("span",{children:c})]}),a.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[a.jsx("button",{onClick:i,className:"flex-1 px-4 py-2.5 min-h-[44px] rounded-lg text-sm text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors",children:"Skip"}),a.jsx("button",{onClick:n,disabled:l,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:l?"none":"0 1px 3px var(--color-cc-primary-btn)"},children:l?"Saving...":e.trim()?"Save & Continue":"Continue"})]})]})}function HR({apiKey:e,onApiKeyChange:t,onCheckAuth:n,onSaveApiKey:i,onSkip:l,onBack:c,saving:u,error:f}){const[h,p]=k.useState(!1),g="codex-auth-error";return a.jsxs("div",{className:"p-7 pb-6",children:[a.jsxs("div",{className:"mb-5",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-cc-muted font-medium mb-2",children:"Step 2 of 2"}),a.jsx("h2",{className:"text-xl font-semibold text-cc-fg leading-tight",children:"Set up Codex"}),a.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:"})]}),a.jsxs("div",{className:"rounded-lg overflow-hidden mb-4 border border-cc-border",style:{background:"var(--color-cc-code-bg)"},children:[a.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-cc-border",children:[a.jsxs("div",{className:"flex items-center gap-1.5","aria-hidden":"true",children:[a.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-error opacity-60"}),a.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-warning opacity-60"}),a.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-success opacity-60"})]}),a.jsx($2,{text:"codex --login"})]}),a.jsx("div",{className:"px-3.5 py-3",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-cc-muted text-xs font-mono-code select-none","aria-hidden":"true",children:"$"}),a.jsx("code",{className:"text-[13px] font-mono-code text-cc-fg select-all",children:"codex --login"})]})})]}),f&&a.jsxs("div",{id:g,role:"alert",className:"flex items-start gap-2 mb-4 text-xs text-cc-error",children:[a.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:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("path",{d:"M12 8v4m0 4h.01"})]}),a.jsx("span",{children:f})]}),a.jsxs("div",{className:"mb-4",children:[a.jsxs("button",{onClick:()=>p(!h),className:"text-xs text-cc-muted hover:text-cc-fg transition-colors flex items-center gap-1",children:[a.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:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),"Or use an API key instead"]}),a.jsx("div",{className:"accordion-panel","data-open":h?"true":"false",children:a.jsx("div",{className:"accordion-inner",children:a.jsxs("div",{className:"mt-3",children:[a.jsx("label",{htmlFor:"openai-key",className:"text-xs text-cc-muted block mb-1.5",children:"OpenAI API Key"}),a.jsx("input",{id:"openai-key",type:"password",value:e,onChange:v=>t(v.target.value),placeholder:"sk-...","aria-describedby":f?g: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"})]})})})]}),a.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[a.jsxs("button",{onClick:c,className:"px-3 py-2.5 min-h-[44px] min-w-[44px] rounded-lg text-sm text-cc-muted hover:text-cc-fg transition-colors flex items-center gap-1",children:[a.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:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})}),"Back"]}),a.jsx("div",{className:"flex-1"}),a.jsx("button",{onClick:l,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"}),a.jsx("button",{onClick:e.trim()?i:n,disabled:u,className:"btn-codex-aa px-5 py-2.5 min-h-[44px] rounded-lg text-sm font-medium text-white transition-[background,opacity] duration-150 disabled:opacity-50",style:{boxShadow:u?"none":"0 1px 3px var(--color-cc-codex-btn)"},children:u?"Checking...":e.trim()?"Save & Finish":"I've logged in"})]})]})}function qR({claudeConfigured:e,codexConfigured:t,onDone:n}){const i=!e&&!t,l=fg(),[c,u]=k.useState(l);return k.useEffect(()=>{c||requestAnimationFrame(()=>u(!0))},[c]),a.jsxs("div",{className:"p-7 pb-6 text-center",style:{opacity:c?1:0,transform:c?"translateY(0)":"translateY(8px)",transition:l?"none":"opacity 400ms cubic-bezier(0.16, 1, 0.3, 1), transform 400ms cubic-bezier(0.16, 1, 0.3, 1)"},children:[a.jsx("div",{className:"w-14 h-14 mx-auto rounded-2xl flex items-center justify-center mb-5",style:{background:i?"var(--color-cc-hover)":"color-mix(in srgb, var(--color-cc-success) 12%, transparent)"},children:i?a.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:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}):a.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:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}),a.jsx("h2",{className:"text-xl font-semibold text-cc-fg mb-2",children:i?"Setup Skipped":"You're all set!"}),a.jsx("div",{className:"text-sm text-cc-muted leading-relaxed mb-6",children:i?"You can configure providers anytime in Settings.":a.jsxs(a.Fragment,{children:[e&&a.jsx("span",{className:"block",children:"Claude Code is ready."}),t&&a.jsx("span",{className:"block",children:"Codex is ready."}),a.jsx("span",{className:"block mt-1 text-xs",children:"You can update these anytime in Settings."})]})}),a.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 $2({text:e}){const[t,n]=k.useState(!1),i=k.useCallback(()=>{navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)}).catch(()=>{})},[e]);return a.jsx("button",{onClick:i,className:"text-[10px] text-cc-muted hover:text-cc-fg transition-colors flex items-center gap-1 min-h-[44px] min-w-[44px] justify-end","aria-label":"Copy command",children:t?a.jsxs(a.Fragment,{children:[a.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:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),"Copied!"]}):a.jsxs(a.Fragment,{children:[a.jsxs("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:[a.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),a.jsx("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})]}),"Copy"]})})}const IR=k.lazy(()=>Xn(()=>import("./Playground-BYihPEC9.js"),[]).then(e=>({default:e.Playground}))),VR=k.lazy(()=>Xn(()=>import("./SettingsPage-B9jbUi7A.js"),[]).then(e=>({default:e.SettingsPage}))),GR=k.lazy(()=>Xn(()=>import("./IntegrationsPage-DRbbUsum.js"),[]).then(e=>({default:e.IntegrationsPage}))),YR=k.lazy(()=>Xn(()=>import("./LinearSettingsPage-C9QVub6_.js"),[]).then(e=>({default:e.LinearSettingsPage}))),WR=k.lazy(()=>Xn(()=>import("./LinearOAuthSettingsPage-DbqiQRYU.js"),[]).then(e=>({default:e.LinearOAuthSettingsPage}))),XR=k.lazy(()=>Xn(()=>import("./TailscalePage-Dj5FOGz6.js"),[]).then(e=>({default:e.TailscalePage}))),QR=k.lazy(()=>Xn(()=>import("./PromptsPage-Cnhv4Der.js"),[]).then(e=>({default:e.PromptsPage}))),KR=k.lazy(()=>Xn(()=>Promise.resolve().then(()=>L7),void 0).then(e=>({default:e.EnvManager}))),ZR=k.lazy(()=>Xn(()=>import("./SandboxManager-BKkKy3p4.js"),[]).then(e=>({default:e.SandboxManager}))),JR=k.lazy(()=>Xn(()=>import("./CronManager-BFVFYGxc.js"),[]).then(e=>({default:e.CronManager}))),eD=k.lazy(()=>Xn(()=>import("./AgentsPage-tWiu1_AT.js"),[]).then(e=>({default:e.AgentsPage}))),tD=k.lazy(()=>Xn(()=>import("./RunsPage-NVlYvNqV.js"),[]).then(e=>({default:e.RunsPage})));function Sr(){return a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("div",{className:"text-sm text-cc-muted",children:"Loading..."})})}function nD(){return k.useSyncExternalStore(e=>(window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)),()=>window.location.hash)}function rD(){const e=X($=>$.isAuthenticated),t=X($=>$.darkMode),n=X($=>$.currentSessionId),i=X($=>$.sidebarOpen),l=X($=>$.taskPanelOpen),c=X($=>$.homeResetKey),u=X($=>$.activeTab),f=X($=>$.sessionCreating),h=X($=>$.sessionCreatingBackend),p=X($=>$.creationProgress),g=X($=>$.creationError),v=X($=>$.updateOverlayActive),y=nD(),b=k.useMemo(()=>Dg(y),[y]),_=b.page==="settings",S=b.page==="prompts",T=b.page==="integrations",j=b.page==="integration-linear",R=b.page==="integration-linear-oauth",C=b.page==="integration-tailscale",P=b.page==="environments",z=b.page==="sandboxes",D=b.page==="scheduled",F=b.page==="agents"||b.page==="agent-detail",B=b.page==="runs",I=b.page==="session"||b.page==="home";k.useEffect(()=>{PC(y||"#/")},[y]),k.useEffect(()=>{document.documentElement.classList.toggle("dark",t)},[t]);const L=k.useRef(X.getState().currentSessionId);k.useEffect(()=>{if(L.current!==null&&b.page==="home"){zg(L.current,!0),L.current=null;return}if(L.current=null,b.page==="session"){const $=X.getState();$.currentSessionId!==b.sessionId&&$.setCurrentSession(b.sessionId),mc(b.sessionId)}else if(b.page==="home"){const $=X.getState();$.currentSessionId!==null&&$.setCurrentSession(null)}},[b]);const q=X($=>n?$.changedFilesTick.get(n)??0:0),E=X($=>$.diffBase),ae=X($=>$.setGitChangedFilesCount),K=X($=>{var re,xe;return n&&(((re=$.sessions.get(n))==null?void 0:re.cwd)||((xe=$.sdkSessions.find(M=>M.sessionId===n))==null?void 0:xe.cwd))||null});k.useEffect(()=>{if(!n||!K)return;let $=!1;return we.getChangedFiles(K,E).then(({files:re})=>{if($)return;const xe=`${K}/`,M=re.filter(O=>O.path===K||O.path.startsWith(xe)).length;ae(n,M)}).catch(()=>{}),()=>{$=!0}},[n,K,E,q,ae]),k.useEffect(()=>{const $=()=>{we.checkForUpdate().then(xe=>{X.getState().setUpdateInfo(xe)}).catch(()=>{})};$();const re=setInterval($,300*1e3);return()=>clearInterval(re)},[]),k.useEffect(()=>{const $=()=>{we.getClaudeCompat().then(xe=>{X.getState().setClaudeCompatInfo(xe)}).catch(()=>{})};$();const re=setInterval($,300*1e3);return()=>clearInterval(re)},[]);const[Y,U]=k.useState(!1);return k.useEffect(()=>{e&&we.getSettings().then($=>{$.publicUrl&&X.getState().setPublicUrl($.publicUrl),$.onboardingCompleted||U(!0)}).catch(()=>{})},[e]),k.useEffect(()=>{localStorage.getItem("companion_docker_prompt_pending")==="1"&&(localStorage.removeItem("companion_docker_prompt_pending"),X.getState().setDockerUpdateDialogOpen(!0))},[]),e?b.page==="playground"?a.jsx(k.Suspense,{fallback:a.jsx(Sr,{}),children:a.jsx(IR,{})}):a.jsxs("div",{className:"fixed inset-0 flex font-sans-ui bg-cc-bg text-cc-fg antialiased pt-safe overflow-hidden overscroll-none",children:[i&&a.jsx("div",{className:"fixed inset-0 bg-black/30 z-30 md:hidden",onClick:()=>X.getState().setSidebarOpen(!1)}),a.jsx("div",{className:`
|
|
125
|
+
fixed inset-y-0 left-0 md:relative md:inset-auto z-40 md:z-auto
|
|
126
|
+
h-full shrink-0 transition-all duration-200 pt-safe md:pt-0
|
|
127
|
+
${i?"w-full md:w-[260px] translate-x-0":"w-0 -translate-x-full md:w-0 md:-translate-x-full"}
|
|
128
|
+
overflow-hidden
|
|
129
|
+
`,children:a.jsx(i4,{})}),a.jsxs("div",{className:"flex-1 flex flex-col min-w-0 overflow-hidden",children:[a.jsx(R7,{}),a.jsx(MR,{}),a.jsx(RR,{}),a.jsxs("div",{className:"flex-1 overflow-hidden relative",children:[_&&a.jsx("div",{className:"absolute inset-0",children:a.jsx(k.Suspense,{fallback:a.jsx(Sr,{}),children:a.jsx(VR,{embedded:!0})})}),S&&a.jsx("div",{className:"absolute inset-0",children:a.jsx(k.Suspense,{fallback:a.jsx(Sr,{}),children:a.jsx(QR,{embedded:!0})})}),T&&a.jsx("div",{className:"absolute inset-0",children:a.jsx(k.Suspense,{fallback:a.jsx(Sr,{}),children:a.jsx(GR,{embedded:!0})})}),j&&a.jsx("div",{className:"absolute inset-0",children:a.jsx(k.Suspense,{fallback:a.jsx(Sr,{}),children:a.jsx(YR,{embedded:!0})})}),R&&a.jsx("div",{className:"absolute inset-0",children:a.jsx(k.Suspense,{fallback:a.jsx(Sr,{}),children:a.jsx(WR,{embedded:!0})})}),C&&a.jsx("div",{className:"absolute inset-0",children:a.jsx(k.Suspense,{fallback:a.jsx(Sr,{}),children:a.jsx(XR,{embedded:!0})})}),P&&a.jsx("div",{className:"absolute inset-0",children:a.jsx(k.Suspense,{fallback:a.jsx(Sr,{}),children:a.jsx(KR,{embedded:!0})})}),z&&a.jsx("div",{className:"absolute inset-0",children:a.jsx(k.Suspense,{fallback:a.jsx(Sr,{}),children:a.jsx(ZR,{embedded:!0})})}),D&&a.jsx("div",{className:"absolute inset-0",children:a.jsx(k.Suspense,{fallback:a.jsx(Sr,{}),children:a.jsx(JR,{embedded:!0})})}),F&&a.jsx("div",{className:"absolute inset-0",children:a.jsx(k.Suspense,{fallback:a.jsx(Sr,{}),children:a.jsx(eD,{route:b})})}),B&&a.jsx("div",{className:"absolute inset-0",children:a.jsx(k.Suspense,{fallback:a.jsx(Sr,{}),children:a.jsx(tD,{})})}),I&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"absolute inset-0",children:n?u==="diff"?a.jsx(AR,{sessionId:n}):a.jsx(A7,{sessionId:n}):a.jsx(W7,{},c)}),f&&p&&p.length>0&&a.jsx(DR,{steps:p,error:g,backend:h??void 0,onCancel:()=>X.getState().clearCreation()})]})]})]}),n&&I&&a.jsxs(a.Fragment,{children:[!l&&a.jsxs("button",{type:"button",onClick:()=>X.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:[a.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:a.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"})}),a.jsx("span",{className:"[writing-mode:vertical-rl] rotate-180 tracking-wide",children:"Context"})]}),l&&a.jsx("div",{className:"fixed inset-0 bg-black/30 z-30 lg:hidden",onClick:()=>X.getState().setTaskPanelOpen(!1)}),a.jsx("div",{className:`
|
|
130
|
+
fixed inset-y-0 right-0 lg:relative lg:inset-auto z-40 lg:z-auto
|
|
131
|
+
h-full shrink-0 transition-all duration-200 pt-safe lg:pt-0
|
|
132
|
+
${l?"w-full lg:w-[320px] translate-x-0":"w-0 translate-x-full lg:w-0 lg:translate-x-full"}
|
|
133
|
+
overflow-hidden
|
|
134
|
+
`,children:a.jsx(CR,{sessionId:n})})]}),a.jsx(BR,{active:v}),a.jsx($R,{}),Y&&a.jsx(PR,{onComplete:()=>U(!1)})]}):a.jsx(VC,{})}class iD extends k.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,n){Jr(t,{source:"react_error_boundary",componentStack:n.componentStack})}render(){return this.state.hasError?a.jsx("div",{className:"h-[100dvh] flex items-center justify-center bg-cc-bg text-cc-fg px-4",children:a.jsxs("div",{className:"max-w-md w-full rounded-xl border border-cc-border bg-cc-card p-5 shadow-sm",children:[a.jsx("h1",{className:"text-base font-semibold",children:"A runtime error occurred"}),a.jsx("p",{className:"text-sm text-cc-muted mt-2",children:"Reload the page to recover. The error has been reported."}),a.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}}$C();JS.createRoot(document.getElementById("root")).render(a.jsx(k.StrictMode,{children:a.jsx(iD,{children:a.jsx(rD,{})})}));Xn(()=>import("./sw-register-exbRbynw.js"),[]).catch(()=>{});export{y7 as A,oD as B,A7 as C,pl as D,lD as E,B7 as F,gR as G,Zo as L,M8 as M,o7 as P,DR as S,L5 as T,MR as U,Xn as _,we as a,zp as b,cD as c,uD as d,U8 as e,F8 as f,BC as g,M7 as h,hR as i,a as j,pR as k,gs as l,ll as m,zg as n,Jo as o,nR as p,od as q,k as r,aD as s,lR as t,X as u,pc as v,gl as w,p5 as x,j2 as y,i7 as z};
|