@hellcoder/companion 0.117.0 → 0.118.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. package/dist/assets/{AgentsPage-DJIGGU86.js → AgentsPage-DkcwIsY1.js} +1 -1
  2. package/dist/assets/{CronManager-D7aAMVgs.js → CronManager-BrGSjzJz.js} +1 -1
  3. package/dist/assets/{DashboardPage-Bporj7Vr.js → DashboardPage-B2q0O3yD.js} +1 -1
  4. package/dist/assets/{IntegrationsPage-BSY0-fsO.js → IntegrationsPage-CRfvSp68.js} +1 -1
  5. package/dist/assets/{LinearOAuthSettingsPage-Cl5dP05g.js → LinearOAuthSettingsPage-DgzYg2kb.js} +1 -1
  6. package/dist/assets/{LinearSettingsPage-dwMpnpxL.js → LinearSettingsPage-BTQJFAj4.js} +1 -1
  7. package/dist/assets/{MagicUIDashboard-Bpa4AupX.js → MagicUIDashboard-BegKqU3e.js} +1 -1
  8. package/dist/assets/{MagicUIView-BoHMBELi.js → MagicUIView-D23itGQ5.js} +1 -1
  9. package/dist/assets/{Playground-By2aXWQF.js → Playground-BJAQWThl.js} +14 -6
  10. package/dist/assets/{PromptsPage-DVv0Qn3d.js → PromptsPage-BKEK_e8P.js} +1 -1
  11. package/dist/assets/{RunsPage-bu3TZ6ai.js → RunsPage-Biakia-J.js} +1 -1
  12. package/dist/assets/{SandboxManager-CDjGbD5N.js → SandboxManager-BZfEkHsb.js} +1 -1
  13. package/dist/assets/{SettingsPage-D0v_BZTU.js → SettingsPage-BwZoML1s.js} +1 -1
  14. package/dist/assets/{TailscalePage-B8SJQpMF.js → TailscalePage-B6eauJ__.js} +1 -1
  15. package/dist/assets/index-DB85gIpd.css +1 -0
  16. package/dist/assets/index-n6Tt3UFW.js +140 -0
  17. package/dist/assets/{sw-register-CvyRJNug.js → sw-register-fN5inCkx.js} +1 -1
  18. package/dist/index.html +2 -2
  19. package/dist/sw.js +1 -1
  20. package/package.json +1 -1
  21. package/dist/assets/index-BqOdTpct.css +0 -1
  22. package/dist/assets/index-DqIZ_Ol5.js +0 -140
@@ -0,0 +1,140 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Playground-BJAQWThl.js","assets/MagicUIDashboard-BegKqU3e.js","assets/MagicUIView-D23itGQ5.js"])))=>i.map(i=>d[i]);
2
+ var qN=Object.defineProperty;var VN=(e,t,n)=>t in e?qN(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Hb=(e,t,n)=>VN(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const o of a)if(o.type==="childList")for(const u of o.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&r(u)}).observe(document,{childList:!0,subtree:!0});function n(a){const o={};return a.integrity&&(o.integrity=a.integrity),a.referrerPolicy&&(o.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?o.credentials="include":a.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(a){if(a.ep)return;a.ep=!0;const o=n(a);fetch(a.href,o)}})();const GN="modulepreload",YN=function(e){return"/"+e},qb={},qn=function(t,n,r){let a=Promise.resolve();if(n&&n.length>0){let u=function(p){return Promise.all(p.map(m=>Promise.resolve(m).then(x=>({status:"fulfilled",value:x}),x=>({status:"rejected",reason:x}))))};document.getElementsByTagName("link");const h=document.querySelector("meta[property=csp-nonce]"),f=(h==null?void 0:h.nonce)||(h==null?void 0:h.getAttribute("nonce"));a=u(n.map(p=>{if(p=YN(p),p in qb)return;qb[p]=!0;const m=p.endsWith(".css"),x=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${x}`))return;const b=document.createElement("link");if(b.rel=m?"stylesheet":GN,m||(b.as="script"),b.crossOrigin="",b.href=p,f&&b.setAttribute("nonce",f),document.head.appendChild(b),m)return new Promise((y,_)=>{b.addEventListener("load",y),b.addEventListener("error",()=>_(new Error(`Unable to preload CSS for ${p}`)))})}))}function o(u){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=u,window.dispatchEvent(h),!h.defaultPrevented)throw u}return a.then(u=>{for(const h of u||[])h.status==="rejected"&&o(h.reason);return t().catch(o)})};function wx(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Kp={exports:{}},nc={};/**
3
+ * @license React
4
+ * react-jsx-runtime.production.js
5
+ *
6
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
7
+ *
8
+ * This source code is licensed under the MIT license found in the
9
+ * LICENSE file in the root directory of this source tree.
10
+ */var Vb;function WN(){if(Vb)return nc;Vb=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,a,o){var u=null;if(o!==void 0&&(u=""+o),a.key!==void 0&&(u=""+a.key),"key"in a){o={};for(var h in a)h!=="key"&&(o[h]=a[h])}else o=a;return a=o.ref,{$$typeof:e,type:r,key:u,ref:a!==void 0?a:null,props:o}}return nc.Fragment=t,nc.jsx=n,nc.jsxs=n,nc}var Gb;function QN(){return Gb||(Gb=1,Kp.exports=WN()),Kp.exports}var l=QN(),Zp={exports:{}},We={};/**
11
+ * @license React
12
+ * react.production.js
13
+ *
14
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
15
+ *
16
+ * This source code is licensed under the MIT license found in the
17
+ * LICENSE file in the root directory of this source tree.
18
+ */var Yb;function XN(){if(Yb)return We;Yb=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),u=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),x=Symbol.for("react.activity"),b=Symbol.iterator;function y(P){return P===null||typeof P!="object"?null:(P=b&&P[b]||P["@@iterator"],typeof P=="function"?P:null)}var _={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,N={};function w(P,J,M){this.props=P,this.context=J,this.refs=N,this.updater=M||_}w.prototype.isReactComponent={},w.prototype.setState=function(P,J){if(typeof P!="object"&&typeof P!="function"&&P!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,P,J,"setState")},w.prototype.forceUpdate=function(P){this.updater.enqueueForceUpdate(this,P,"forceUpdate")};function C(){}C.prototype=w.prototype;function E(P,J,M){this.props=P,this.context=J,this.refs=N,this.updater=M||_}var R=E.prototype=new C;R.constructor=E,j(R,w.prototype),R.isPureReactComponent=!0;var L=Array.isArray;function O(){}var q={H:null,A:null,T:null,S:null},F=Object.prototype.hasOwnProperty;function W(P,J,M){var ge=M.ref;return{$$typeof:e,type:P,key:J,ref:ge!==void 0?ge:null,props:M}}function z(P,J){return W(P.type,J,P.props)}function I(P){return typeof P=="object"&&P!==null&&P.$$typeof===e}function A(P){var J={"=":"=0",":":"=2"};return"$"+P.replace(/[=:]/g,function(M){return J[M]})}var X=/\/+/g;function Z(P,J){return typeof P=="object"&&P!==null&&P.key!=null?A(""+P.key):J.toString(36)}function G(P){switch(P.status){case"fulfilled":return P.value;case"rejected":throw P.reason;default:switch(typeof P.status=="string"?P.then(O,O):(P.status="pending",P.then(function(J){P.status==="pending"&&(P.status="fulfilled",P.value=J)},function(J){P.status==="pending"&&(P.status="rejected",P.reason=J)})),P.status){case"fulfilled":return P.value;case"rejected":throw P.reason}}throw P}function B(P,J,M,ge,we){var Ce=typeof P;(Ce==="undefined"||Ce==="boolean")&&(P=null);var ze=!1;if(P===null)ze=!0;else switch(Ce){case"bigint":case"string":case"number":ze=!0;break;case"object":switch(P.$$typeof){case e:case t:ze=!0;break;case m:return ze=P._init,B(ze(P._payload),J,M,ge,we)}}if(ze)return we=we(P),ze=ge===""?"."+Z(P,0):ge,L(we)?(M="",ze!=null&&(M=ze.replace(X,"$&/")+"/"),B(we,J,M,"",function(et){return et})):we!=null&&(I(we)&&(we=z(we,M+(we.key==null||P&&P.key===we.key?"":(""+we.key).replace(X,"$&/")+"/")+ze)),J.push(we)),1;ze=0;var Ee=ge===""?".":ge+":";if(L(P))for(var Pe=0;Pe<P.length;Pe++)ge=P[Pe],Ce=Ee+Z(ge,Pe),ze+=B(ge,J,M,Ce,we);else if(Pe=y(P),typeof Pe=="function")for(P=Pe.call(P),Pe=0;!(ge=P.next()).done;)ge=ge.value,Ce=Ee+Z(ge,Pe++),ze+=B(ge,J,M,Ce,we);else if(Ce==="object"){if(typeof P.then=="function")return B(G(P),J,M,ge,we);throw J=String(P),Error("Objects are not valid as a React child (found: "+(J==="[object Object]"?"object with keys {"+Object.keys(P).join(", ")+"}":J)+"). If you meant to render a collection of children, use an array instead.")}return ze}function $(P,J,M){if(P==null)return P;var ge=[],we=0;return B(P,ge,"","",function(Ce){return J.call(M,Ce,we++)}),ge}function se(P){if(P._status===-1){var J=P._result;J=J(),J.then(function(M){(P._status===0||P._status===-1)&&(P._status=1,P._result=M)},function(M){(P._status===0||P._status===-1)&&(P._status=2,P._result=M)}),P._status===-1&&(P._status=0,P._result=J)}if(P._status===1)return P._result.default;throw P._result}var ae=typeof reportError=="function"?reportError:function(P){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var J=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof P=="object"&&P!==null&&typeof P.message=="string"?String(P.message):String(P),error:P});if(!window.dispatchEvent(J))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",P);return}console.error(P)},D={map:$,forEach:function(P,J,M){$(P,function(){J.apply(this,arguments)},M)},count:function(P){var J=0;return $(P,function(){J++}),J},toArray:function(P){return $(P,function(J){return J})||[]},only:function(P){if(!I(P))throw Error("React.Children.only expected to receive a single React element child.");return P}};return We.Activity=x,We.Children=D,We.Component=w,We.Fragment=n,We.Profiler=a,We.PureComponent=E,We.StrictMode=r,We.Suspense=f,We.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=q,We.__COMPILER_RUNTIME={__proto__:null,c:function(P){return q.H.useMemoCache(P)}},We.cache=function(P){return function(){return P.apply(null,arguments)}},We.cacheSignal=function(){return null},We.cloneElement=function(P,J,M){if(P==null)throw Error("The argument must be a React element, but you passed "+P+".");var ge=j({},P.props),we=P.key;if(J!=null)for(Ce in J.key!==void 0&&(we=""+J.key),J)!F.call(J,Ce)||Ce==="key"||Ce==="__self"||Ce==="__source"||Ce==="ref"&&J.ref===void 0||(ge[Ce]=J[Ce]);var Ce=arguments.length-2;if(Ce===1)ge.children=M;else if(1<Ce){for(var ze=Array(Ce),Ee=0;Ee<Ce;Ee++)ze[Ee]=arguments[Ee+2];ge.children=ze}return W(P.type,we,ge)},We.createContext=function(P){return P={$$typeof:u,_currentValue:P,_currentValue2:P,_threadCount:0,Provider:null,Consumer:null},P.Provider=P,P.Consumer={$$typeof:o,_context:P},P},We.createElement=function(P,J,M){var ge,we={},Ce=null;if(J!=null)for(ge in J.key!==void 0&&(Ce=""+J.key),J)F.call(J,ge)&&ge!=="key"&&ge!=="__self"&&ge!=="__source"&&(we[ge]=J[ge]);var ze=arguments.length-2;if(ze===1)we.children=M;else if(1<ze){for(var Ee=Array(ze),Pe=0;Pe<ze;Pe++)Ee[Pe]=arguments[Pe+2];we.children=Ee}if(P&&P.defaultProps)for(ge in ze=P.defaultProps,ze)we[ge]===void 0&&(we[ge]=ze[ge]);return W(P,Ce,we)},We.createRef=function(){return{current:null}},We.forwardRef=function(P){return{$$typeof:h,render:P}},We.isValidElement=I,We.lazy=function(P){return{$$typeof:m,_payload:{_status:-1,_result:P},_init:se}},We.memo=function(P,J){return{$$typeof:p,type:P,compare:J===void 0?null:J}},We.startTransition=function(P){var J=q.T,M={};q.T=M;try{var ge=P(),we=q.S;we!==null&&we(M,ge),typeof ge=="object"&&ge!==null&&typeof ge.then=="function"&&ge.then(O,ae)}catch(Ce){ae(Ce)}finally{J!==null&&M.types!==null&&(J.types=M.types),q.T=J}},We.unstable_useCacheRefresh=function(){return q.H.useCacheRefresh()},We.use=function(P){return q.H.use(P)},We.useActionState=function(P,J,M){return q.H.useActionState(P,J,M)},We.useCallback=function(P,J){return q.H.useCallback(P,J)},We.useContext=function(P){return q.H.useContext(P)},We.useDebugValue=function(){},We.useDeferredValue=function(P,J){return q.H.useDeferredValue(P,J)},We.useEffect=function(P,J){return q.H.useEffect(P,J)},We.useEffectEvent=function(P){return q.H.useEffectEvent(P)},We.useId=function(){return q.H.useId()},We.useImperativeHandle=function(P,J,M){return q.H.useImperativeHandle(P,J,M)},We.useInsertionEffect=function(P,J){return q.H.useInsertionEffect(P,J)},We.useLayoutEffect=function(P,J){return q.H.useLayoutEffect(P,J)},We.useMemo=function(P,J){return q.H.useMemo(P,J)},We.useOptimistic=function(P,J){return q.H.useOptimistic(P,J)},We.useReducer=function(P,J,M){return q.H.useReducer(P,J,M)},We.useRef=function(P){return q.H.useRef(P)},We.useState=function(P){return q.H.useState(P)},We.useSyncExternalStore=function(P,J,M){return q.H.useSyncExternalStore(P,J,M)},We.useTransition=function(){return q.H.useTransition()},We.version="19.2.8",We}var Wb;function Sx(){return Wb||(Wb=1,Zp.exports=XN()),Zp.exports}var k=Sx();const _d=wx(k);var Jp={exports:{}},rc={},em={exports:{}},tm={};/**
19
+ * @license React
20
+ * scheduler.production.js
21
+ *
22
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
23
+ *
24
+ * This source code is licensed under the MIT license found in the
25
+ * LICENSE file in the root directory of this source tree.
26
+ */var Qb;function KN(){return Qb||(Qb=1,(function(e){function t(B,$){var se=B.length;B.push($);e:for(;0<se;){var ae=se-1>>>1,D=B[ae];if(0<a(D,$))B[ae]=$,B[se]=D,se=ae;else break e}}function n(B){return B.length===0?null:B[0]}function r(B){if(B.length===0)return null;var $=B[0],se=B.pop();if(se!==$){B[0]=se;e:for(var ae=0,D=B.length,P=D>>>1;ae<P;){var J=2*(ae+1)-1,M=B[J],ge=J+1,we=B[ge];if(0>a(M,se))ge<D&&0>a(we,M)?(B[ae]=we,B[ge]=se,ae=ge):(B[ae]=M,B[J]=se,ae=J);else if(ge<D&&0>a(we,se))B[ae]=we,B[ge]=se,ae=ge;else break e}}return $}function a(B,$){var se=B.sortIndex-$.sortIndex;return se!==0?se:B.id-$.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var u=Date,h=u.now();e.unstable_now=function(){return u.now()-h}}var f=[],p=[],m=1,x=null,b=3,y=!1,_=!1,j=!1,N=!1,w=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function R(B){for(var $=n(p);$!==null;){if($.callback===null)r(p);else if($.startTime<=B)r(p),$.sortIndex=$.expirationTime,t(f,$);else break;$=n(p)}}function L(B){if(j=!1,R(B),!_)if(n(f)!==null)_=!0,O||(O=!0,A());else{var $=n(p);$!==null&&G(L,$.startTime-B)}}var O=!1,q=-1,F=5,W=-1;function z(){return N?!0:!(e.unstable_now()-W<F)}function I(){if(N=!1,O){var B=e.unstable_now();W=B;var $=!0;try{e:{_=!1,j&&(j=!1,C(q),q=-1),y=!0;var se=b;try{t:{for(R(B),x=n(f);x!==null&&!(x.expirationTime>B&&z());){var ae=x.callback;if(typeof ae=="function"){x.callback=null,b=x.priorityLevel;var D=ae(x.expirationTime<=B);if(B=e.unstable_now(),typeof D=="function"){x.callback=D,R(B),$=!0;break t}x===n(f)&&r(f),R(B)}else r(f);x=n(f)}if(x!==null)$=!0;else{var P=n(p);P!==null&&G(L,P.startTime-B),$=!1}}break e}finally{x=null,b=se,y=!1}$=void 0}}finally{$?A():O=!1}}}var A;if(typeof E=="function")A=function(){E(I)};else if(typeof MessageChannel<"u"){var X=new MessageChannel,Z=X.port2;X.port1.onmessage=I,A=function(){Z.postMessage(null)}}else A=function(){w(I,0)};function G(B,$){q=w(function(){B(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(B){B.callback=null},e.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):F=0<B?Math.floor(1e3/B):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(B){switch(b){case 1:case 2:case 3:var $=3;break;default:$=b}var se=b;b=$;try{return B()}finally{b=se}},e.unstable_requestPaint=function(){N=!0},e.unstable_runWithPriority=function(B,$){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var se=b;b=B;try{return $()}finally{b=se}},e.unstable_scheduleCallback=function(B,$,se){var ae=e.unstable_now();switch(typeof se=="object"&&se!==null?(se=se.delay,se=typeof se=="number"&&0<se?ae+se:ae):se=ae,B){case 1:var D=-1;break;case 2:D=250;break;case 5:D=1073741823;break;case 4:D=1e4;break;default:D=5e3}return D=se+D,B={id:m++,callback:$,priorityLevel:B,startTime:se,expirationTime:D,sortIndex:-1},se>ae?(B.sortIndex=se,t(p,B),n(f)===null&&B===n(p)&&(j?(C(q),q=-1):j=!0,G(L,se-ae))):(B.sortIndex=D,t(f,B),_||y||(_=!0,O||(O=!0,A()))),B},e.unstable_shouldYield=z,e.unstable_wrapCallback=function(B){var $=b;return function(){var se=b;b=$;try{return B.apply(this,arguments)}finally{b=se}}}})(tm)),tm}var Xb;function ZN(){return Xb||(Xb=1,em.exports=KN()),em.exports}var nm={exports:{}},$n={};/**
27
+ * @license React
28
+ * react-dom.production.js
29
+ *
30
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
31
+ *
32
+ * This source code is licensed under the MIT license found in the
33
+ * LICENSE file in the root directory of this source tree.
34
+ */var Kb;function JN(){if(Kb)return $n;Kb=1;var e=Sx();function t(f){var p="https://react.dev/errors/"+f;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var m=2;m<arguments.length;m++)p+="&args[]="+encodeURIComponent(arguments[m])}return"Minified React error #"+f+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},a=Symbol.for("react.portal");function o(f,p,m){var x=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:x==null?null:""+x,children:f,containerInfo:p,implementation:m}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(f,p){if(f==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return $n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,$n.createPortal=function(f,p){var m=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(t(299));return o(f,p,null,m)},$n.flushSync=function(f){var p=u.T,m=r.p;try{if(u.T=null,r.p=2,f)return f()}finally{u.T=p,r.p=m,r.d.f()}},$n.preconnect=function(f,p){typeof f=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,r.d.C(f,p))},$n.prefetchDNS=function(f){typeof f=="string"&&r.d.D(f)},$n.preinit=function(f,p){if(typeof f=="string"&&p&&typeof p.as=="string"){var m=p.as,x=h(m,p.crossOrigin),b=typeof p.integrity=="string"?p.integrity:void 0,y=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;m==="style"?r.d.S(f,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:x,integrity:b,fetchPriority:y}):m==="script"&&r.d.X(f,{crossOrigin:x,integrity:b,fetchPriority:y,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},$n.preinitModule=function(f,p){if(typeof f=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var m=h(p.as,p.crossOrigin);r.d.M(f,{crossOrigin:m,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&r.d.M(f)},$n.preload=function(f,p){if(typeof f=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var m=p.as,x=h(m,p.crossOrigin);r.d.L(f,m,{crossOrigin:x,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},$n.preloadModule=function(f,p){if(typeof f=="string")if(p){var m=h(p.as,p.crossOrigin);r.d.m(f,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:m,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else r.d.m(f)},$n.requestFormReset=function(f){r.d.r(f)},$n.unstable_batchedUpdates=function(f,p){return f(p)},$n.useFormState=function(f,p,m){return u.H.useFormState(f,p,m)},$n.useFormStatus=function(){return u.H.useHostTransitionStatus()},$n.version="19.2.8",$n}var Zb;function rw(){if(Zb)return nm.exports;Zb=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(),nm.exports=JN(),nm.exports}/**
35
+ * @license React
36
+ * react-dom-client.production.js
37
+ *
38
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
39
+ *
40
+ * This source code is licensed under the MIT license found in the
41
+ * LICENSE file in the root directory of this source tree.
42
+ */var Jb;function eC(){if(Jb)return rc;Jb=1;var e=ZN(),t=Sx(),n=rw();function r(s){var i="https://react.dev/errors/"+s;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)i+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+s+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function o(s){var i=s,c=s;if(s.alternate)for(;i.return;)i=i.return;else{s=i;do i=s,(i.flags&4098)!==0&&(c=i.return),s=i.return;while(s)}return i.tag===3?c:null}function u(s){if(s.tag===13){var i=s.memoizedState;if(i===null&&(s=s.alternate,s!==null&&(i=s.memoizedState)),i!==null)return i.dehydrated}return null}function h(s){if(s.tag===31){var i=s.memoizedState;if(i===null&&(s=s.alternate,s!==null&&(i=s.memoizedState)),i!==null)return i.dehydrated}return null}function f(s){if(o(s)!==s)throw Error(r(188))}function p(s){var i=s.alternate;if(!i){if(i=o(s),i===null)throw Error(r(188));return i!==s?null:s}for(var c=s,d=i;;){var g=c.return;if(g===null)break;var v=g.alternate;if(v===null){if(d=g.return,d!==null){c=d;continue}break}if(g.child===v.child){for(v=g.child;v;){if(v===c)return f(g),s;if(v===d)return f(g),i;v=v.sibling}throw Error(r(188))}if(c.return!==d.return)c=g,d=v;else{for(var S=!1,T=g.child;T;){if(T===c){S=!0,c=g,d=v;break}if(T===d){S=!0,d=g,c=v;break}T=T.sibling}if(!S){for(T=v.child;T;){if(T===c){S=!0,c=v,d=g;break}if(T===d){S=!0,d=v,c=g;break}T=T.sibling}if(!S)throw Error(r(189))}}if(c.alternate!==d)throw Error(r(190))}if(c.tag!==3)throw Error(r(188));return c.stateNode.current===c?s:i}function m(s){var i=s.tag;if(i===5||i===26||i===27||i===6)return s;for(s=s.child;s!==null;){if(i=m(s),i!==null)return i;s=s.sibling}return null}var x=Object.assign,b=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),_=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),N=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),C=Symbol.for("react.consumer"),E=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),L=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),q=Symbol.for("react.memo"),F=Symbol.for("react.lazy"),W=Symbol.for("react.activity"),z=Symbol.for("react.memo_cache_sentinel"),I=Symbol.iterator;function A(s){return s===null||typeof s!="object"?null:(s=I&&s[I]||s["@@iterator"],typeof s=="function"?s:null)}var X=Symbol.for("react.client.reference");function Z(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===X?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case j:return"Fragment";case w:return"Profiler";case N:return"StrictMode";case L:return"Suspense";case O:return"SuspenseList";case W:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case _:return"Portal";case E:return s.displayName||"Context";case C:return(s._context.displayName||"Context")+".Consumer";case R:var i=s.render;return s=s.displayName,s||(s=i.displayName||i.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case q:return i=s.displayName||null,i!==null?i:Z(s.type)||"Memo";case F:i=s._payload,s=s._init;try{return Z(s(i))}catch{}}return null}var G=Array.isArray,B=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,se={pending:!1,data:null,method:null,action:null},ae=[],D=-1;function P(s){return{current:s}}function J(s){0>D||(s.current=ae[D],ae[D]=null,D--)}function M(s,i){D++,ae[D]=s.current,s.current=i}var ge=P(null),we=P(null),Ce=P(null),ze=P(null);function Ee(s,i){switch(M(Ce,i),M(we,s),M(ge,null),i.nodeType){case 9:case 11:s=(s=i.documentElement)&&(s=s.namespaceURI)?hb(s):0;break;default:if(s=i.tagName,i=i.namespaceURI)i=hb(i),s=fb(i,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}J(ge),M(ge,s)}function Pe(){J(ge),J(we),J(Ce)}function et(s){s.memoizedState!==null&&M(ze,s);var i=ge.current,c=fb(i,s.type);i!==c&&(M(we,s),M(ge,c))}function Et(s){we.current===s&&(J(ge),J(we)),ze.current===s&&(J(ze),Zo._currentValue=se)}var mt,yt;function _t(s){if(mt===void 0)try{throw Error()}catch(c){var i=c.stack.trim().match(/\n( *(at )?)/);mt=i&&i[1]||"",yt=-1<c.stack.indexOf(`
43
+ at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
44
+ `+mt+s+yt}var Lt=!1;function Gt(s,i){if(!s||Lt)return"";Lt=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(i){var fe=function(){throw Error()};if(Object.defineProperty(fe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(fe,[])}catch(le){var ie=le}Reflect.construct(s,[],fe)}else{try{fe.call()}catch(le){ie=le}s.call(fe.prototype)}}else{try{throw Error()}catch(le){ie=le}(fe=s())&&typeof fe.catch=="function"&&fe.catch(function(){})}}catch(le){if(le&&ie&&typeof le.stack=="string")return[le.stack,ie.stack]}return[null,null]}};d.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var g=Object.getOwnPropertyDescriptor(d.DetermineComponentFrameRoot,"name");g&&g.configurable&&Object.defineProperty(d.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var v=d.DetermineComponentFrameRoot(),S=v[0],T=v[1];if(S&&T){var U=S.split(`
45
+ `),te=T.split(`
46
+ `);for(g=d=0;d<U.length&&!U[d].includes("DetermineComponentFrameRoot");)d++;for(;g<te.length&&!te[g].includes("DetermineComponentFrameRoot");)g++;if(d===U.length||g===te.length)for(d=U.length-1,g=te.length-1;1<=d&&0<=g&&U[d]!==te[g];)g--;for(;1<=d&&0<=g;d--,g--)if(U[d]!==te[g]){if(d!==1||g!==1)do if(d--,g--,0>g||U[d]!==te[g]){var ce=`
47
+ `+U[d].replace(" at new "," at ");return s.displayName&&ce.includes("<anonymous>")&&(ce=ce.replace("<anonymous>",s.displayName)),ce}while(1<=d&&0<=g);break}}}finally{Lt=!1,Error.prepareStackTrace=c}return(c=s?s.displayName||s.name:"")?_t(c):""}function _e(s,i){switch(s.tag){case 26:case 27:case 5:return _t(s.type);case 16:return _t("Lazy");case 13:return s.child!==i&&i!==null?_t("Suspense Fallback"):_t("Suspense");case 19:return _t("SuspenseList");case 0:case 15:return Gt(s.type,!1);case 11:return Gt(s.type.render,!1);case 1:return Gt(s.type,!0);case 31:return _t("Activity");default:return""}}function Ve(s){try{var i="",c=null;do i+=_e(s,c),c=s,s=s.return;while(s);return i}catch(d){return`
48
+ Error generating stack: `+d.message+`
49
+ `+d.stack}}var dt=Object.prototype.hasOwnProperty,_n=e.unstable_scheduleCallback,je=e.unstable_cancelCallback,Oe=e.unstable_shouldYield,xt=e.unstable_requestPaint,Ae=e.unstable_now,Qr=e.unstable_getCurrentPriorityLevel,oe=e.unstable_ImmediatePriority,Se=e.unstable_UserBlockingPriority,Q=e.unstable_NormalPriority,xe=e.unstable_LowPriority,Le=e.unstable_IdlePriority,Qe=e.log,rt=e.unstable_setDisableYieldValue,st=null,Ct=null;function wn(s){if(typeof Qe=="function"&&rt(s),Ct&&typeof Ct.setStrictMode=="function")try{Ct.setStrictMode(st,s)}catch{}}var tt=Math.clz32?Math.clz32:os,hr=Math.log,Bn=Math.LN2;function os(s){return s>>>=0,s===0?32:31-(hr(s)/Bn|0)|0}var Xr=256,Kr=262144,re=4194304;function ve(s){var i=s&42;if(i!==0)return i;switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function ye(s,i,c){var d=s.pendingLanes;if(d===0)return 0;var g=0,v=s.suspendedLanes,S=s.pingedLanes;s=s.warmLanes;var T=d&134217727;return T!==0?(d=T&~v,d!==0?g=ve(d):(S&=T,S!==0?g=ve(S):c||(c=T&~s,c!==0&&(g=ve(c))))):(T=d&~v,T!==0?g=ve(T):S!==0?g=ve(S):c||(c=d&~s,c!==0&&(g=ve(c)))),g===0?0:i!==0&&i!==g&&(i&v)===0&&(v=g&-g,c=i&-i,v>=c||v===32&&(c&4194048)!==0)?i:g}function Xe(s,i){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&i)===0}function Ht(s,i){switch(s){case 1:case 2:case 4:case 8:case 64:return i+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return i+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function fn(){var s=re;return re<<=1,(re&62914560)===0&&(re=4194304),s}function Pn(s){for(var i=[],c=0;31>c;c++)i.push(s);return i}function qt(s,i){s.pendingLanes|=i,i!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function Gn(s,i,c,d,g,v){var S=s.pendingLanes;s.pendingLanes=c,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=c,s.entangledLanes&=c,s.errorRecoveryDisabledLanes&=c,s.shellSuspendCounter=0;var T=s.entanglements,U=s.expirationTimes,te=s.hiddenUpdates;for(c=S&~c;0<c;){var ce=31-tt(c),fe=1<<ce;T[ce]=0,U[ce]=-1;var ie=te[ce];if(ie!==null)for(te[ce]=null,ce=0;ce<ie.length;ce++){var le=ie[ce];le!==null&&(le.lane&=-536870913)}c&=~fe}d!==0&&Er(s,d,0),v!==0&&g===0&&s.tag!==0&&(s.suspendedLanes|=v&~(S&~i))}function Er(s,i,c){s.pendingLanes|=i,s.suspendedLanes&=~i;var d=31-tt(i);s.entangledLanes|=i,s.entanglements[d]=s.entanglements[d]|1073741824|c&261930}function Pa(s,i){var c=s.entangledLanes|=i;for(s=s.entanglements;c;){var d=31-tt(c),g=1<<d;g&i|s[d]&i&&(s[d]|=i),c&=~g}}function lo(s,i){var c=i&-i;return c=(c&42)!==0?1:Yn(c),(c&(s.suspendedLanes|i))!==0?0:c}function Yn(s){switch(s){case 2:s=1;break;case 8:s=4;break;case 32:s=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:s=128;break;case 268435456:s=134217728;break;default:s=0}return s}function Xi(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function oo(){var s=$.p;return s!==0?s:(s=window.event,s===void 0?32:Ob(s.type))}function co(s,i){var c=$.p;try{return $.p=s,i()}finally{$.p=c}}var Ar=Math.random().toString(36).slice(2),en="__reactFiber$"+Ar,Tn="__reactProps$"+Ar,fr="__reactContainer$"+Ar,uo="__reactEvents$"+Ar,Xh="__reactListeners$"+Ar,Ki="__reactHandles$"+Ar,Zi="__reactResources$"+Ar,cs="__reactMarker$"+Ar;function ai(s){delete s[en],delete s[Tn],delete s[uo],delete s[Xh],delete s[Ki]}function Es(s){var i=s[en];if(i)return i;for(var c=s.parentNode;c;){if(i=c[fr]||c[en]){if(c=i.alternate,i.child!==null||c!==null&&c.child!==null)for(s=yb(s);s!==null;){if(c=s[en])return c;s=yb(s)}return i}s=c,c=s.parentNode}return null}function Jn(s){if(s=s[en]||s[fr]){var i=s.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return s}return null}function Ji(s){var i=s.tag;if(i===5||i===26||i===27||i===6)return s.stateNode;throw Error(r(33))}function us(s){var i=s[Zi];return i||(i=s[Zi]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function nn(s){s[cs]=!0}var er=new Set,$a={};function Zr(s,i){ds(s,i),ds(s+"Capture",i)}function ds(s,i){for($a[s]=i,s=0;s<i.length;s++)er.add(i[s])}var ho=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]*$"),fo={},rn={};function Kh(s){return dt.call(rn,s)?!0:dt.call(fo,s)?!1:ho.test(s)?rn[s]=!0:(fo[s]=!0,!1)}function ea(s,i,c){if(Kh(i))if(c===null)s.removeAttribute(i);else{switch(typeof c){case"undefined":case"function":case"symbol":s.removeAttribute(i);return;case"boolean":var d=i.toLowerCase().slice(0,5);if(d!=="data-"&&d!=="aria-"){s.removeAttribute(i);return}}s.setAttribute(i,""+c)}}function Fa(s,i,c){if(c===null)s.removeAttribute(i);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(i);return}s.setAttribute(i,""+c)}}function Jr(s,i,c,d){if(d===null)s.removeAttribute(c);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(c);return}s.setAttributeNS(i,c,""+d)}}function tr(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function iu(s){var i=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function po(s,i,c){var d=Object.getOwnPropertyDescriptor(s.constructor.prototype,i);if(!s.hasOwnProperty(i)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var g=d.get,v=d.set;return Object.defineProperty(s,i,{configurable:!0,get:function(){return g.call(this)},set:function(S){c=""+S,v.call(this,S)}}),Object.defineProperty(s,i,{enumerable:d.enumerable}),{getValue:function(){return c},setValue:function(S){c=""+S},stopTracking:function(){s._valueTracker=null,delete s[i]}}}}function Ua(s){if(!s._valueTracker){var i=iu(s)?"checked":"value";s._valueTracker=po(s,i,""+s[i])}}function hs(s){if(!s)return!1;var i=s._valueTracker;if(!i)return!0;var c=i.getValue(),d="";return s&&(d=iu(s)?s.checked?"true":"false":s.value),s=d,s!==c?(i.setValue(s),!0):!1}function li(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var Tr=/[\n"\\]/g;function un(s){return s.replace(Tr,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function ta(s,i,c,d,g,v,S,T){s.name="",S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?s.type=S:s.removeAttribute("type"),i!=null?S==="number"?(i===0&&s.value===""||s.value!=i)&&(s.value=""+tr(i)):s.value!==""+tr(i)&&(s.value=""+tr(i)):S!=="submit"&&S!=="reset"||s.removeAttribute("value"),i!=null?Ia(s,S,tr(i)):c!=null?Ia(s,S,tr(c)):d!=null&&s.removeAttribute("value"),g==null&&v!=null&&(s.defaultChecked=!!v),g!=null&&(s.checked=g&&typeof g!="function"&&typeof g!="symbol"),T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"?s.name=""+tr(T):s.removeAttribute("name")}function au(s,i,c,d,g,v,S,T){if(v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(s.type=v),i!=null||c!=null){if(!(v!=="submit"&&v!=="reset"||i!=null)){Ua(s);return}c=c!=null?""+tr(c):"",i=i!=null?""+tr(i):c,T||i===s.value||(s.value=i),s.defaultValue=i}d=d??g,d=typeof d!="function"&&typeof d!="symbol"&&!!d,s.checked=T?s.checked:!!d,s.defaultChecked=!!d,S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"&&(s.name=S),Ua(s)}function Ia(s,i,c){i==="number"&&li(s.ownerDocument)===s||s.defaultValue===""+c||(s.defaultValue=""+c)}function oi(s,i,c,d){if(s=s.options,i){i={};for(var g=0;g<c.length;g++)i["$"+c[g]]=!0;for(c=0;c<s.length;c++)g=i.hasOwnProperty("$"+s[c].value),s[c].selected!==g&&(s[c].selected=g),g&&d&&(s[c].defaultSelected=!0)}else{for(c=""+tr(c),i=null,g=0;g<s.length;g++){if(s[g].value===c){s[g].selected=!0,d&&(s[g].defaultSelected=!0);return}i!==null||s[g].disabled||(i=s[g])}i!==null&&(i.selected=!0)}}function Ha(s,i,c){if(i!=null&&(i=""+tr(i),i!==s.value&&(s.value=i),c==null)){s.defaultValue!==i&&(s.defaultValue=i);return}s.defaultValue=c!=null?""+tr(c):""}function mo(s,i,c,d){if(i==null){if(d!=null){if(c!=null)throw Error(r(92));if(G(d)){if(1<d.length)throw Error(r(93));d=d[0]}c=d}c==null&&(c=""),i=c}c=tr(i),s.defaultValue=c,d=s.textContent,d===c&&d!==""&&d!==null&&(s.value=d),Ua(s)}function ci(s,i){if(i){var c=s.firstChild;if(c&&c===s.lastChild&&c.nodeType===3){c.nodeValue=i;return}}s.textContent=i}var Zh=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 lu(s,i,c){var d=i.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?d?s.setProperty(i,""):i==="float"?s.cssFloat="":s[i]="":d?s.setProperty(i,c):typeof c!="number"||c===0||Zh.has(i)?i==="float"?s.cssFloat=c:s[i]=(""+c).trim():s[i]=c+"px"}function ou(s,i,c){if(i!=null&&typeof i!="object")throw Error(r(62));if(s=s.style,c!=null){for(var d in c)!c.hasOwnProperty(d)||i!=null&&i.hasOwnProperty(d)||(d.indexOf("--")===0?s.setProperty(d,""):d==="float"?s.cssFloat="":s[d]="");for(var g in i)d=i[g],i.hasOwnProperty(g)&&c[g]!==d&&lu(s,g,d)}else for(var v in i)i.hasOwnProperty(v)&&lu(s,v,i[v])}function qa(s){if(s.indexOf("-")===-1)return!1;switch(s){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var cu=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"]]),Jh=/^[\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 Va(s){return Jh.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function Mr(){}var ui=null;function Ga(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var di=null,hi=null;function uu(s){var i=Jn(s);if(i&&(s=i.stateNode)){var c=s[Tn]||null;e:switch(s=i.stateNode,i.type){case"input":if(ta(s,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),i=c.name,c.type==="radio"&&i!=null){for(c=s;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+un(""+i)+'"][type="radio"]'),i=0;i<c.length;i++){var d=c[i];if(d!==s&&d.form===s.form){var g=d[Tn]||null;if(!g)throw Error(r(90));ta(d,g.value,g.defaultValue,g.defaultValue,g.checked,g.defaultChecked,g.type,g.name)}}for(i=0;i<c.length;i++)d=c[i],d.form===s.form&&hs(d)}break e;case"textarea":Ha(s,c.value,c.defaultValue);break e;case"select":i=c.value,i!=null&&oi(s,!!c.multiple,i,!1)}}}var go=!1;function du(s,i,c){if(go)return s(i,c);go=!0;try{var d=s(i);return d}finally{if(go=!1,(di!==null||hi!==null)&&(Ju(),di&&(i=di,s=hi,hi=di=null,uu(i),s)))for(i=0;i<s.length;i++)uu(s[i])}}function na(s,i){var c=s.stateNode;if(c===null)return null;var d=c[Tn]||null;if(d===null)return null;c=d[i];e:switch(i){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(d=!d.disabled)||(s=s.type,d=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!d;break e;default:s=!1}if(s)return null;if(c&&typeof c!="function")throw Error(r(231,i,typeof c));return c}var Dr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ya=!1;if(Dr)try{var fi={};Object.defineProperty(fi,"passive",{get:function(){Ya=!0}}),window.addEventListener("test",fi,fi),window.removeEventListener("test",fi,fi)}catch{Ya=!1}var H=null,me=null,Ke=null;function vt(){if(Ke)return Ke;var s,i=me,c=i.length,d,g="value"in H?H.value:H.textContent,v=g.length;for(s=0;s<c&&i[s]===g[s];s++);var S=c-s;for(d=1;d<=S&&i[c-d]===g[v-d];d++);return Ke=g.slice(s,1<d?1-d:void 0)}function it(s){var i=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&i===13&&(s=13)):s=i,s===10&&(s=13),32<=s||s===13?s:0}function qe(){return!0}function Wn(){return!1}function Sn(s){function i(c,d,g,v,S){this._reactName=c,this._targetInst=g,this.type=d,this.nativeEvent=v,this.target=S,this.currentTarget=null;for(var T in s)s.hasOwnProperty(T)&&(c=s[T],this[T]=c?c(v):v[T]);return this.isDefaultPrevented=(v.defaultPrevented!=null?v.defaultPrevented:v.returnValue===!1)?qe:Wn,this.isPropagationStopped=Wn,this}return x(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=qe)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=qe)},persist:function(){},isPersistent:qe}),i}var Lr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},As=Sn(Lr),kn=x({},Lr,{view:0,detail:0}),hu=Sn(kn),xo,vo,ra,sa=x({},kn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:tf,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==ra&&(ra&&s.type==="mousemove"?(xo=s.screenX-ra.screenX,vo=s.screenY-ra.screenY):vo=xo=0,ra=s),xo)},movementY:function(s){return"movementY"in s?s.movementY:vo}}),ef=Sn(sa),fu=x({},sa,{dataTransfer:0}),pu=Sn(fu),mu=x({},kn,{relatedTarget:0}),fs=Sn(mu),gu=x({},Lr,{animationName:0,elapsedTime:0,pseudoElement:0}),xu=Sn(gu),Wa=x({},Lr,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),Qk=Sn(Wa),Xk=x({},Lr,{data:0}),gv=Sn(Xk),Kk={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Zk={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"},Jk={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ej(s){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(s):(s=Jk[s])?!!i[s]:!1}function tf(){return ej}var tj=x({},kn,{key:function(s){if(s.key){var i=Kk[s.key]||s.key;if(i!=="Unidentified")return i}return s.type==="keypress"?(s=it(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?Zk[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:tf,charCode:function(s){return s.type==="keypress"?it(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?it(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),nj=Sn(tj),rj=x({},sa,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),xv=Sn(rj),sj=x({},kn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:tf}),ij=Sn(sj),aj=x({},Lr,{propertyName:0,elapsedTime:0,pseudoElement:0}),lj=Sn(aj),oj=x({},sa,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),cj=Sn(oj),uj=x({},Lr,{newState:0,oldState:0}),dj=Sn(uj),hj=[9,13,27,32],nf=Dr&&"CompositionEvent"in window,bo=null;Dr&&"documentMode"in document&&(bo=document.documentMode);var fj=Dr&&"TextEvent"in window&&!bo,vv=Dr&&(!nf||bo&&8<bo&&11>=bo),bv=" ",yv=!1;function _v(s,i){switch(s){case"keyup":return hj.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function wv(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var Qa=!1;function pj(s,i){switch(s){case"compositionend":return wv(i);case"keypress":return i.which!==32?null:(yv=!0,bv);case"textInput":return s=i.data,s===bv&&yv?null:s;default:return null}}function mj(s,i){if(Qa)return s==="compositionend"||!nf&&_v(s,i)?(s=vt(),Ke=me=H=null,Qa=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1<i.char.length)return i.char;if(i.which)return String.fromCharCode(i.which)}return null;case"compositionend":return vv&&i.locale!=="ko"?null:i.data;default:return null}}var gj={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 Sv(s){var i=s&&s.nodeName&&s.nodeName.toLowerCase();return i==="input"?!!gj[s.type]:i==="textarea"}function kv(s,i,c,d){di?hi?hi.push(d):hi=[d]:di=d,i=ad(i,"onChange"),0<i.length&&(c=new As("onChange","change",null,c,d),s.push({event:c,listeners:i}))}var yo=null,_o=null;function xj(s){ab(s,0)}function vu(s){var i=Ji(s);if(hs(i))return s}function jv(s,i){if(s==="change")return i}var Nv=!1;if(Dr){var rf;if(Dr){var sf="oninput"in document;if(!sf){var Cv=document.createElement("div");Cv.setAttribute("oninput","return;"),sf=typeof Cv.oninput=="function"}rf=sf}else rf=!1;Nv=rf&&(!document.documentMode||9<document.documentMode)}function Ev(){yo&&(yo.detachEvent("onpropertychange",Av),_o=yo=null)}function Av(s){if(s.propertyName==="value"&&vu(_o)){var i=[];kv(i,_o,s,Ga(s)),du(xj,i)}}function vj(s,i,c){s==="focusin"?(Ev(),yo=i,_o=c,yo.attachEvent("onpropertychange",Av)):s==="focusout"&&Ev()}function bj(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return vu(_o)}function yj(s,i){if(s==="click")return vu(i)}function _j(s,i){if(s==="input"||s==="change")return vu(i)}function wj(s,i){return s===i&&(s!==0||1/s===1/i)||s!==s&&i!==i}var pr=typeof Object.is=="function"?Object.is:wj;function wo(s,i){if(pr(s,i))return!0;if(typeof s!="object"||s===null||typeof i!="object"||i===null)return!1;var c=Object.keys(s),d=Object.keys(i);if(c.length!==d.length)return!1;for(d=0;d<c.length;d++){var g=c[d];if(!dt.call(i,g)||!pr(s[g],i[g]))return!1}return!0}function Tv(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function Mv(s,i){var c=Tv(s);s=0;for(var d;c;){if(c.nodeType===3){if(d=s+c.textContent.length,s<=i&&d>=i)return{node:c,offset:i-s};s=d}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=Tv(c)}}function Dv(s,i){return s&&i?s===i?!0:s&&s.nodeType===3?!1:i&&i.nodeType===3?Dv(s,i.parentNode):"contains"in s?s.contains(i):s.compareDocumentPosition?!!(s.compareDocumentPosition(i)&16):!1:!1}function Lv(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var i=li(s.document);i instanceof s.HTMLIFrameElement;){try{var c=typeof i.contentWindow.location.href=="string"}catch{c=!1}if(c)s=i.contentWindow;else break;i=li(s.document)}return i}function af(s){var i=s&&s.nodeName&&s.nodeName.toLowerCase();return i&&(i==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||i==="textarea"||s.contentEditable==="true")}var Sj=Dr&&"documentMode"in document&&11>=document.documentMode,Xa=null,lf=null,So=null,of=!1;function Rv(s,i,c){var d=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;of||Xa==null||Xa!==li(d)||(d=Xa,"selectionStart"in d&&af(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}),So&&wo(So,d)||(So=d,d=ad(lf,"onSelect"),0<d.length&&(i=new As("onSelect","select",null,i,c),s.push({event:i,listeners:d}),i.target=Xa)))}function ia(s,i){var c={};return c[s.toLowerCase()]=i.toLowerCase(),c["Webkit"+s]="webkit"+i,c["Moz"+s]="moz"+i,c}var Ka={animationend:ia("Animation","AnimationEnd"),animationiteration:ia("Animation","AnimationIteration"),animationstart:ia("Animation","AnimationStart"),transitionrun:ia("Transition","TransitionRun"),transitionstart:ia("Transition","TransitionStart"),transitioncancel:ia("Transition","TransitionCancel"),transitionend:ia("Transition","TransitionEnd")},cf={},zv={};Dr&&(zv=document.createElement("div").style,"AnimationEvent"in window||(delete Ka.animationend.animation,delete Ka.animationiteration.animation,delete Ka.animationstart.animation),"TransitionEvent"in window||delete Ka.transitionend.transition);function aa(s){if(cf[s])return cf[s];if(!Ka[s])return s;var i=Ka[s],c;for(c in i)if(i.hasOwnProperty(c)&&c in zv)return cf[s]=i[c];return s}var Ov=aa("animationend"),Bv=aa("animationiteration"),Pv=aa("animationstart"),kj=aa("transitionrun"),jj=aa("transitionstart"),Nj=aa("transitioncancel"),$v=aa("transitionend"),Fv=new Map,uf="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(" ");uf.push("scrollEnd");function es(s,i){Fv.set(s,i),Zr(i,[s])}var bu=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var i=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof s=="object"&&s!==null&&typeof s.message=="string"?String(s.message):String(s),error:s});if(!window.dispatchEvent(i))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)},Rr=[],Za=0,df=0;function yu(){for(var s=Za,i=df=Za=0;i<s;){var c=Rr[i];Rr[i++]=null;var d=Rr[i];Rr[i++]=null;var g=Rr[i];Rr[i++]=null;var v=Rr[i];if(Rr[i++]=null,d!==null&&g!==null){var S=d.pending;S===null?g.next=g:(g.next=S.next,S.next=g),d.pending=g}v!==0&&Uv(c,g,v)}}function _u(s,i,c,d){Rr[Za++]=s,Rr[Za++]=i,Rr[Za++]=c,Rr[Za++]=d,df|=d,s.lanes|=d,s=s.alternate,s!==null&&(s.lanes|=d)}function hf(s,i,c,d){return _u(s,i,c,d),wu(s)}function la(s,i){return _u(s,null,null,i),wu(s)}function Uv(s,i,c){s.lanes|=c;var d=s.alternate;d!==null&&(d.lanes|=c);for(var g=!1,v=s.return;v!==null;)v.childLanes|=c,d=v.alternate,d!==null&&(d.childLanes|=c),v.tag===22&&(s=v.stateNode,s===null||s._visibility&1||(g=!0)),s=v,v=v.return;return s.tag===3?(v=s.stateNode,g&&i!==null&&(g=31-tt(c),s=v.hiddenUpdates,d=s[g],d===null?s[g]=[i]:d.push(i),i.lane=c|536870912),v):null}function wu(s){if(50<Vo)throw Vo=0,_p=null,Error(r(185));for(var i=s.return;i!==null;)s=i,i=s.return;return s.tag===3?s.stateNode:null}var Ja={};function Cj(s,i,c,d){this.tag=s,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=i,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 mr(s,i,c,d){return new Cj(s,i,c,d)}function ff(s){return s=s.prototype,!(!s||!s.isReactComponent)}function Ts(s,i){var c=s.alternate;return c===null?(c=mr(s.tag,i,s.key,s.mode),c.elementType=s.elementType,c.type=s.type,c.stateNode=s.stateNode,c.alternate=s,s.alternate=c):(c.pendingProps=i,c.type=s.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=s.flags&65011712,c.childLanes=s.childLanes,c.lanes=s.lanes,c.child=s.child,c.memoizedProps=s.memoizedProps,c.memoizedState=s.memoizedState,c.updateQueue=s.updateQueue,i=s.dependencies,c.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},c.sibling=s.sibling,c.index=s.index,c.ref=s.ref,c.refCleanup=s.refCleanup,c}function Iv(s,i){s.flags&=65011714;var c=s.alternate;return c===null?(s.childLanes=0,s.lanes=i,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=c.childLanes,s.lanes=c.lanes,s.child=c.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=c.memoizedProps,s.memoizedState=c.memoizedState,s.updateQueue=c.updateQueue,s.type=c.type,i=c.dependencies,s.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),s}function Su(s,i,c,d,g,v){var S=0;if(d=s,typeof s=="function")ff(s)&&(S=1);else if(typeof s=="string")S=DN(s,c,ge.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case W:return s=mr(31,c,i,g),s.elementType=W,s.lanes=v,s;case j:return oa(c.children,g,v,i);case N:S=8,g|=24;break;case w:return s=mr(12,c,i,g|2),s.elementType=w,s.lanes=v,s;case L:return s=mr(13,c,i,g),s.elementType=L,s.lanes=v,s;case O:return s=mr(19,c,i,g),s.elementType=O,s.lanes=v,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case E:S=10;break e;case C:S=9;break e;case R:S=11;break e;case q:S=14;break e;case F:S=16,d=null;break e}S=29,c=Error(r(130,s===null?"null":typeof s,"")),d=null}return i=mr(S,c,i,g),i.elementType=s,i.type=d,i.lanes=v,i}function oa(s,i,c,d){return s=mr(7,s,d,i),s.lanes=c,s}function pf(s,i,c){return s=mr(6,s,null,i),s.lanes=c,s}function Hv(s){var i=mr(18,null,null,0);return i.stateNode=s,i}function mf(s,i,c){return i=mr(4,s.children!==null?s.children:[],s.key,i),i.lanes=c,i.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},i}var qv=new WeakMap;function zr(s,i){if(typeof s=="object"&&s!==null){var c=qv.get(s);return c!==void 0?c:(i={value:s,source:i,stack:Ve(i)},qv.set(s,i),i)}return{value:s,source:i,stack:Ve(i)}}var el=[],tl=0,ku=null,ko=0,Or=[],Br=0,pi=null,ps=1,ms="";function Ms(s,i){el[tl++]=ko,el[tl++]=ku,ku=s,ko=i}function Vv(s,i,c){Or[Br++]=ps,Or[Br++]=ms,Or[Br++]=pi,pi=s;var d=ps;s=ms;var g=32-tt(d)-1;d&=~(1<<g),c+=1;var v=32-tt(i)+g;if(30<v){var S=g-g%5;v=(d&(1<<S)-1).toString(32),d>>=S,g-=S,ps=1<<32-tt(i)+g|c<<g|d,ms=v+s}else ps=1<<v|c<<g|d,ms=s}function gf(s){s.return!==null&&(Ms(s,1),Vv(s,1,0))}function xf(s){for(;s===ku;)ku=el[--tl],el[tl]=null,ko=el[--tl],el[tl]=null;for(;s===pi;)pi=Or[--Br],Or[Br]=null,ms=Or[--Br],Or[Br]=null,ps=Or[--Br],Or[Br]=null}function Gv(s,i){Or[Br++]=ps,Or[Br++]=ms,Or[Br++]=pi,ps=i.id,ms=i.overflow,pi=s}var Mn=null,Yt=null,gt=!1,mi=null,Pr=!1,vf=Error(r(519));function gi(s){var i=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw jo(zr(i,s)),vf}function Yv(s){var i=s.stateNode,c=s.type,d=s.memoizedProps;switch(i[en]=s,i[Tn]=d,c){case"dialog":ot("cancel",i),ot("close",i);break;case"iframe":case"object":case"embed":ot("load",i);break;case"video":case"audio":for(c=0;c<Yo.length;c++)ot(Yo[c],i);break;case"source":ot("error",i);break;case"img":case"image":case"link":ot("error",i),ot("load",i);break;case"details":ot("toggle",i);break;case"input":ot("invalid",i),au(i,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":ot("invalid",i);break;case"textarea":ot("invalid",i),mo(i,d.value,d.defaultValue,d.children)}c=d.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||i.textContent===""+c||d.suppressHydrationWarning===!0||ub(i.textContent,c)?(d.popover!=null&&(ot("beforetoggle",i),ot("toggle",i)),d.onScroll!=null&&ot("scroll",i),d.onScrollEnd!=null&&ot("scrollend",i),d.onClick!=null&&(i.onclick=Mr),i=!0):i=!1,i||gi(s,!0)}function Wv(s){for(Mn=s.return;Mn;)switch(Mn.tag){case 5:case 31:case 13:Pr=!1;return;case 27:case 3:Pr=!0;return;default:Mn=Mn.return}}function nl(s){if(s!==Mn)return!1;if(!gt)return Wv(s),gt=!0,!1;var i=s.tag,c;if((c=i!==3&&i!==27)&&((c=i===5)&&(c=s.type,c=!(c!=="form"&&c!=="button")||Op(s.type,s.memoizedProps)),c=!c),c&&Yt&&gi(s),Wv(s),i===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(317));Yt=bb(s)}else if(i===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(317));Yt=bb(s)}else i===27?(i=Yt,Ti(s.type)?(s=Up,Up=null,Yt=s):Yt=i):Yt=Mn?Fr(s.stateNode.nextSibling):null;return!0}function ca(){Yt=Mn=null,gt=!1}function bf(){var s=mi;return s!==null&&(ir===null?ir=s:ir.push.apply(ir,s),mi=null),s}function jo(s){mi===null?mi=[s]:mi.push(s)}var yf=P(null),ua=null,Ds=null;function xi(s,i,c){M(yf,i._currentValue),i._currentValue=c}function Ls(s){s._currentValue=yf.current,J(yf)}function _f(s,i,c){for(;s!==null;){var d=s.alternate;if((s.childLanes&i)!==i?(s.childLanes|=i,d!==null&&(d.childLanes|=i)):d!==null&&(d.childLanes&i)!==i&&(d.childLanes|=i),s===c)break;s=s.return}}function wf(s,i,c,d){var g=s.child;for(g!==null&&(g.return=s);g!==null;){var v=g.dependencies;if(v!==null){var S=g.child;v=v.firstContext;e:for(;v!==null;){var T=v;v=g;for(var U=0;U<i.length;U++)if(T.context===i[U]){v.lanes|=c,T=v.alternate,T!==null&&(T.lanes|=c),_f(v.return,c,s),d||(S=null);break e}v=T.next}}else if(g.tag===18){if(S=g.return,S===null)throw Error(r(341));S.lanes|=c,v=S.alternate,v!==null&&(v.lanes|=c),_f(S,c,s),S=null}else S=g.child;if(S!==null)S.return=g;else for(S=g;S!==null;){if(S===s){S=null;break}if(g=S.sibling,g!==null){g.return=S.return,S=g;break}S=S.return}g=S}}function rl(s,i,c,d){s=null;for(var g=i,v=!1;g!==null;){if(!v){if((g.flags&524288)!==0)v=!0;else if((g.flags&262144)!==0)break}if(g.tag===10){var S=g.alternate;if(S===null)throw Error(r(387));if(S=S.memoizedProps,S!==null){var T=g.type;pr(g.pendingProps.value,S.value)||(s!==null?s.push(T):s=[T])}}else if(g===ze.current){if(S=g.alternate,S===null)throw Error(r(387));S.memoizedState.memoizedState!==g.memoizedState.memoizedState&&(s!==null?s.push(Zo):s=[Zo])}g=g.return}s!==null&&wf(i,s,c,d),i.flags|=262144}function ju(s){for(s=s.firstContext;s!==null;){if(!pr(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function da(s){ua=s,Ds=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function Dn(s){return Qv(ua,s)}function Nu(s,i){return ua===null&&da(s),Qv(s,i)}function Qv(s,i){var c=i._currentValue;if(i={context:i,memoizedValue:c,next:null},Ds===null){if(s===null)throw Error(r(308));Ds=i,s.dependencies={lanes:0,firstContext:i},s.flags|=524288}else Ds=Ds.next=i;return c}var Ej=typeof AbortController<"u"?AbortController:function(){var s=[],i=this.signal={aborted:!1,addEventListener:function(c,d){s.push(d)}};this.abort=function(){i.aborted=!0,s.forEach(function(c){return c()})}},Aj=e.unstable_scheduleCallback,Tj=e.unstable_NormalPriority,pn={$$typeof:E,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Sf(){return{controller:new Ej,data:new Map,refCount:0}}function No(s){s.refCount--,s.refCount===0&&Aj(Tj,function(){s.controller.abort()})}var Co=null,kf=0,sl=0,il=null;function Mj(s,i){if(Co===null){var c=Co=[];kf=0,sl=Cp(),il={status:"pending",value:void 0,then:function(d){c.push(d)}}}return kf++,i.then(Xv,Xv),i}function Xv(){if(--kf===0&&Co!==null){il!==null&&(il.status="fulfilled");var s=Co;Co=null,sl=0,il=null;for(var i=0;i<s.length;i++)(0,s[i])()}}function Dj(s,i){var c=[],d={status:"pending",value:null,reason:null,then:function(g){c.push(g)}};return s.then(function(){d.status="fulfilled",d.value=i;for(var g=0;g<c.length;g++)(0,c[g])(i)},function(g){for(d.status="rejected",d.reason=g,g=0;g<c.length;g++)(0,c[g])(void 0)}),d}var Kv=B.S;B.S=function(s,i){R1=Ae(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&Mj(s,i),Kv!==null&&Kv(s,i)};var ha=P(null);function jf(){var s=ha.current;return s!==null?s:Ft.pooledCache}function Cu(s,i){i===null?M(ha,ha.current):M(ha,i.pool)}function Zv(){var s=jf();return s===null?null:{parent:pn._currentValue,pool:s}}var al=Error(r(460)),Nf=Error(r(474)),Eu=Error(r(542)),Au={then:function(){}};function Jv(s){return s=s.status,s==="fulfilled"||s==="rejected"}function e0(s,i,c){switch(c=s[c],c===void 0?s.push(i):c!==i&&(i.then(Mr,Mr),i=c),i.status){case"fulfilled":return i.value;case"rejected":throw s=i.reason,n0(s),s;default:if(typeof i.status=="string")i.then(Mr,Mr);else{if(s=Ft,s!==null&&100<s.shellSuspendCounter)throw Error(r(482));s=i,s.status="pending",s.then(function(d){if(i.status==="pending"){var g=i;g.status="fulfilled",g.value=d}},function(d){if(i.status==="pending"){var g=i;g.status="rejected",g.reason=d}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw s=i.reason,n0(s),s}throw pa=i,al}}function fa(s){try{var i=s._init;return i(s._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(pa=c,al):c}}var pa=null;function t0(){if(pa===null)throw Error(r(459));var s=pa;return pa=null,s}function n0(s){if(s===al||s===Eu)throw Error(r(483))}var ll=null,Eo=0;function Tu(s){var i=Eo;return Eo+=1,ll===null&&(ll=[]),e0(ll,s,i)}function Ao(s,i){i=i.props.ref,s.ref=i!==void 0?i:null}function Mu(s,i){throw i.$$typeof===b?Error(r(525)):(s=Object.prototype.toString.call(i),Error(r(31,s==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":s)))}function r0(s){function i(K,V){if(s){var ee=K.deletions;ee===null?(K.deletions=[V],K.flags|=16):ee.push(V)}}function c(K,V){if(!s)return null;for(;V!==null;)i(K,V),V=V.sibling;return null}function d(K){for(var V=new Map;K!==null;)K.key!==null?V.set(K.key,K):V.set(K.index,K),K=K.sibling;return V}function g(K,V){return K=Ts(K,V),K.index=0,K.sibling=null,K}function v(K,V,ee){return K.index=ee,s?(ee=K.alternate,ee!==null?(ee=ee.index,ee<V?(K.flags|=67108866,V):ee):(K.flags|=67108866,V)):(K.flags|=1048576,V)}function S(K){return s&&K.alternate===null&&(K.flags|=67108866),K}function T(K,V,ee,he){return V===null||V.tag!==6?(V=pf(ee,K.mode,he),V.return=K,V):(V=g(V,ee),V.return=K,V)}function U(K,V,ee,he){var $e=ee.type;return $e===j?ce(K,V,ee.props.children,he,ee.key):V!==null&&(V.elementType===$e||typeof $e=="object"&&$e!==null&&$e.$$typeof===F&&fa($e)===V.type)?(V=g(V,ee.props),Ao(V,ee),V.return=K,V):(V=Su(ee.type,ee.key,ee.props,null,K.mode,he),Ao(V,ee),V.return=K,V)}function te(K,V,ee,he){return V===null||V.tag!==4||V.stateNode.containerInfo!==ee.containerInfo||V.stateNode.implementation!==ee.implementation?(V=mf(ee,K.mode,he),V.return=K,V):(V=g(V,ee.children||[]),V.return=K,V)}function ce(K,V,ee,he,$e){return V===null||V.tag!==7?(V=oa(ee,K.mode,he,$e),V.return=K,V):(V=g(V,ee),V.return=K,V)}function fe(K,V,ee){if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return V=pf(""+V,K.mode,ee),V.return=K,V;if(typeof V=="object"&&V!==null){switch(V.$$typeof){case y:return ee=Su(V.type,V.key,V.props,null,K.mode,ee),Ao(ee,V),ee.return=K,ee;case _:return V=mf(V,K.mode,ee),V.return=K,V;case F:return V=fa(V),fe(K,V,ee)}if(G(V)||A(V))return V=oa(V,K.mode,ee,null),V.return=K,V;if(typeof V.then=="function")return fe(K,Tu(V),ee);if(V.$$typeof===E)return fe(K,Nu(K,V),ee);Mu(K,V)}return null}function ie(K,V,ee,he){var $e=V!==null?V.key:null;if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return $e!==null?null:T(K,V,""+ee,he);if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case y:return ee.key===$e?U(K,V,ee,he):null;case _:return ee.key===$e?te(K,V,ee,he):null;case F:return ee=fa(ee),ie(K,V,ee,he)}if(G(ee)||A(ee))return $e!==null?null:ce(K,V,ee,he,null);if(typeof ee.then=="function")return ie(K,V,Tu(ee),he);if(ee.$$typeof===E)return ie(K,V,Nu(K,ee),he);Mu(K,ee)}return null}function le(K,V,ee,he,$e){if(typeof he=="string"&&he!==""||typeof he=="number"||typeof he=="bigint")return K=K.get(ee)||null,T(V,K,""+he,$e);if(typeof he=="object"&&he!==null){switch(he.$$typeof){case y:return K=K.get(he.key===null?ee:he.key)||null,U(V,K,he,$e);case _:return K=K.get(he.key===null?ee:he.key)||null,te(V,K,he,$e);case F:return he=fa(he),le(K,V,ee,he,$e)}if(G(he)||A(he))return K=K.get(ee)||null,ce(V,K,he,$e,null);if(typeof he.then=="function")return le(K,V,ee,Tu(he),$e);if(he.$$typeof===E)return le(K,V,ee,Nu(V,he),$e);Mu(V,he)}return null}function Te(K,V,ee,he){for(var $e=null,St=null,Re=V,nt=V=0,ft=null;Re!==null&&nt<ee.length;nt++){Re.index>nt?(ft=Re,Re=null):ft=Re.sibling;var kt=ie(K,Re,ee[nt],he);if(kt===null){Re===null&&(Re=ft);break}s&&Re&&kt.alternate===null&&i(K,Re),V=v(kt,V,nt),St===null?$e=kt:St.sibling=kt,St=kt,Re=ft}if(nt===ee.length)return c(K,Re),gt&&Ms(K,nt),$e;if(Re===null){for(;nt<ee.length;nt++)Re=fe(K,ee[nt],he),Re!==null&&(V=v(Re,V,nt),St===null?$e=Re:St.sibling=Re,St=Re);return gt&&Ms(K,nt),$e}for(Re=d(Re);nt<ee.length;nt++)ft=le(Re,K,nt,ee[nt],he),ft!==null&&(s&&ft.alternate!==null&&Re.delete(ft.key===null?nt:ft.key),V=v(ft,V,nt),St===null?$e=ft:St.sibling=ft,St=ft);return s&&Re.forEach(function(zi){return i(K,zi)}),gt&&Ms(K,nt),$e}function Ie(K,V,ee,he){if(ee==null)throw Error(r(151));for(var $e=null,St=null,Re=V,nt=V=0,ft=null,kt=ee.next();Re!==null&&!kt.done;nt++,kt=ee.next()){Re.index>nt?(ft=Re,Re=null):ft=Re.sibling;var zi=ie(K,Re,kt.value,he);if(zi===null){Re===null&&(Re=ft);break}s&&Re&&zi.alternate===null&&i(K,Re),V=v(zi,V,nt),St===null?$e=zi:St.sibling=zi,St=zi,Re=ft}if(kt.done)return c(K,Re),gt&&Ms(K,nt),$e;if(Re===null){for(;!kt.done;nt++,kt=ee.next())kt=fe(K,kt.value,he),kt!==null&&(V=v(kt,V,nt),St===null?$e=kt:St.sibling=kt,St=kt);return gt&&Ms(K,nt),$e}for(Re=d(Re);!kt.done;nt++,kt=ee.next())kt=le(Re,K,nt,kt.value,he),kt!==null&&(s&&kt.alternate!==null&&Re.delete(kt.key===null?nt:kt.key),V=v(kt,V,nt),St===null?$e=kt:St.sibling=kt,St=kt);return s&&Re.forEach(function(HN){return i(K,HN)}),gt&&Ms(K,nt),$e}function Ot(K,V,ee,he){if(typeof ee=="object"&&ee!==null&&ee.type===j&&ee.key===null&&(ee=ee.props.children),typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case y:e:{for(var $e=ee.key;V!==null;){if(V.key===$e){if($e=ee.type,$e===j){if(V.tag===7){c(K,V.sibling),he=g(V,ee.props.children),he.return=K,K=he;break e}}else if(V.elementType===$e||typeof $e=="object"&&$e!==null&&$e.$$typeof===F&&fa($e)===V.type){c(K,V.sibling),he=g(V,ee.props),Ao(he,ee),he.return=K,K=he;break e}c(K,V);break}else i(K,V);V=V.sibling}ee.type===j?(he=oa(ee.props.children,K.mode,he,ee.key),he.return=K,K=he):(he=Su(ee.type,ee.key,ee.props,null,K.mode,he),Ao(he,ee),he.return=K,K=he)}return S(K);case _:e:{for($e=ee.key;V!==null;){if(V.key===$e)if(V.tag===4&&V.stateNode.containerInfo===ee.containerInfo&&V.stateNode.implementation===ee.implementation){c(K,V.sibling),he=g(V,ee.children||[]),he.return=K,K=he;break e}else{c(K,V);break}else i(K,V);V=V.sibling}he=mf(ee,K.mode,he),he.return=K,K=he}return S(K);case F:return ee=fa(ee),Ot(K,V,ee,he)}if(G(ee))return Te(K,V,ee,he);if(A(ee)){if($e=A(ee),typeof $e!="function")throw Error(r(150));return ee=$e.call(ee),Ie(K,V,ee,he)}if(typeof ee.then=="function")return Ot(K,V,Tu(ee),he);if(ee.$$typeof===E)return Ot(K,V,Nu(K,ee),he);Mu(K,ee)}return typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint"?(ee=""+ee,V!==null&&V.tag===6?(c(K,V.sibling),he=g(V,ee),he.return=K,K=he):(c(K,V),he=pf(ee,K.mode,he),he.return=K,K=he),S(K)):c(K,V)}return function(K,V,ee,he){try{Eo=0;var $e=Ot(K,V,ee,he);return ll=null,$e}catch(Re){if(Re===al||Re===Eu)throw Re;var St=mr(29,Re,null,K.mode);return St.lanes=he,St.return=K,St}finally{}}}var ma=r0(!0),s0=r0(!1),vi=!1;function Cf(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ef(s,i){s=s.updateQueue,i.updateQueue===s&&(i.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function bi(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function yi(s,i,c){var d=s.updateQueue;if(d===null)return null;if(d=d.shared,(Nt&2)!==0){var g=d.pending;return g===null?i.next=i:(i.next=g.next,g.next=i),d.pending=i,i=wu(s),Uv(s,null,c),i}return _u(s,d,i,c),wu(s)}function To(s,i,c){if(i=i.updateQueue,i!==null&&(i=i.shared,(c&4194048)!==0)){var d=i.lanes;d&=s.pendingLanes,c|=d,i.lanes=c,Pa(s,c)}}function Af(s,i){var c=s.updateQueue,d=s.alternate;if(d!==null&&(d=d.updateQueue,c===d)){var g=null,v=null;if(c=c.firstBaseUpdate,c!==null){do{var S={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};v===null?g=v=S:v=v.next=S,c=c.next}while(c!==null);v===null?g=v=i:v=v.next=i}else g=v=i;c={baseState:d.baseState,firstBaseUpdate:g,lastBaseUpdate:v,shared:d.shared,callbacks:d.callbacks},s.updateQueue=c;return}s=c.lastBaseUpdate,s===null?c.firstBaseUpdate=i:s.next=i,c.lastBaseUpdate=i}var Tf=!1;function Mo(){if(Tf){var s=il;if(s!==null)throw s}}function Do(s,i,c,d){Tf=!1;var g=s.updateQueue;vi=!1;var v=g.firstBaseUpdate,S=g.lastBaseUpdate,T=g.shared.pending;if(T!==null){g.shared.pending=null;var U=T,te=U.next;U.next=null,S===null?v=te:S.next=te,S=U;var ce=s.alternate;ce!==null&&(ce=ce.updateQueue,T=ce.lastBaseUpdate,T!==S&&(T===null?ce.firstBaseUpdate=te:T.next=te,ce.lastBaseUpdate=U))}if(v!==null){var fe=g.baseState;S=0,ce=te=U=null,T=v;do{var ie=T.lane&-536870913,le=ie!==T.lane;if(le?(ht&ie)===ie:(d&ie)===ie){ie!==0&&ie===sl&&(Tf=!0),ce!==null&&(ce=ce.next={lane:0,tag:T.tag,payload:T.payload,callback:null,next:null});e:{var Te=s,Ie=T;ie=i;var Ot=c;switch(Ie.tag){case 1:if(Te=Ie.payload,typeof Te=="function"){fe=Te.call(Ot,fe,ie);break e}fe=Te;break e;case 3:Te.flags=Te.flags&-65537|128;case 0:if(Te=Ie.payload,ie=typeof Te=="function"?Te.call(Ot,fe,ie):Te,ie==null)break e;fe=x({},fe,ie);break e;case 2:vi=!0}}ie=T.callback,ie!==null&&(s.flags|=64,le&&(s.flags|=8192),le=g.callbacks,le===null?g.callbacks=[ie]:le.push(ie))}else le={lane:ie,tag:T.tag,payload:T.payload,callback:T.callback,next:null},ce===null?(te=ce=le,U=fe):ce=ce.next=le,S|=ie;if(T=T.next,T===null){if(T=g.shared.pending,T===null)break;le=T,T=le.next,le.next=null,g.lastBaseUpdate=le,g.shared.pending=null}}while(!0);ce===null&&(U=fe),g.baseState=U,g.firstBaseUpdate=te,g.lastBaseUpdate=ce,v===null&&(g.shared.lanes=0),ji|=S,s.lanes=S,s.memoizedState=fe}}function i0(s,i){if(typeof s!="function")throw Error(r(191,s));s.call(i)}function a0(s,i){var c=s.callbacks;if(c!==null)for(s.callbacks=null,s=0;s<c.length;s++)i0(c[s],i)}var ol=P(null),Du=P(0);function l0(s,i){s=Is,M(Du,s),M(ol,i),Is=s|i.baseLanes}function Mf(){M(Du,Is),M(ol,ol.current)}function Df(){Is=Du.current,J(ol),J(Du)}var gr=P(null),$r=null;function _i(s){var i=s.alternate;M(dn,dn.current&1),M(gr,s),$r===null&&(i===null||ol.current!==null||i.memoizedState!==null)&&($r=s)}function Lf(s){M(dn,dn.current),M(gr,s),$r===null&&($r=s)}function o0(s){s.tag===22?(M(dn,dn.current),M(gr,s),$r===null&&($r=s)):wi()}function wi(){M(dn,dn.current),M(gr,gr.current)}function xr(s){J(gr),$r===s&&($r=null),J(dn)}var dn=P(0);function Lu(s){for(var i=s;i!==null;){if(i.tag===13){var c=i.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||$p(c)||Fp(c)))return i}else if(i.tag===19&&(i.memoizedProps.revealOrder==="forwards"||i.memoizedProps.revealOrder==="backwards"||i.memoizedProps.revealOrder==="unstable_legacy-backwards"||i.memoizedProps.revealOrder==="together")){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===s)break;for(;i.sibling===null;){if(i.return===null||i.return===s)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var Rs=0,Ze=null,Rt=null,mn=null,Ru=!1,cl=!1,ga=!1,zu=0,Lo=0,ul=null,Lj=0;function ln(){throw Error(r(321))}function Rf(s,i){if(i===null)return!1;for(var c=0;c<i.length&&c<s.length;c++)if(!pr(s[c],i[c]))return!1;return!0}function zf(s,i,c,d,g,v){return Rs=v,Ze=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,B.H=s===null||s.memoizedState===null?V0:Xf,ga=!1,v=c(d,g),ga=!1,cl&&(v=u0(i,c,d,g)),c0(s),v}function c0(s){B.H=Oo;var i=Rt!==null&&Rt.next!==null;if(Rs=0,mn=Rt=Ze=null,Ru=!1,Lo=0,ul=null,i)throw Error(r(300));s===null||gn||(s=s.dependencies,s!==null&&ju(s)&&(gn=!0))}function u0(s,i,c,d){Ze=s;var g=0;do{if(cl&&(ul=null),Lo=0,cl=!1,25<=g)throw Error(r(301));if(g+=1,mn=Rt=null,s.updateQueue!=null){var v=s.updateQueue;v.lastEffect=null,v.events=null,v.stores=null,v.memoCache!=null&&(v.memoCache.index=0)}B.H=G0,v=i(c,d)}while(cl);return v}function Rj(){var s=B.H,i=s.useState()[0];return i=typeof i.then=="function"?Ro(i):i,s=s.useState()[0],(Rt!==null?Rt.memoizedState:null)!==s&&(Ze.flags|=1024),i}function Of(){var s=zu!==0;return zu=0,s}function Bf(s,i,c){i.updateQueue=s.updateQueue,i.flags&=-2053,s.lanes&=~c}function Pf(s){if(Ru){for(s=s.memoizedState;s!==null;){var i=s.queue;i!==null&&(i.pending=null),s=s.next}Ru=!1}Rs=0,mn=Rt=Ze=null,cl=!1,Lo=zu=0,ul=null}function Qn(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return mn===null?Ze.memoizedState=mn=s:mn=mn.next=s,mn}function hn(){if(Rt===null){var s=Ze.alternate;s=s!==null?s.memoizedState:null}else s=Rt.next;var i=mn===null?Ze.memoizedState:mn.next;if(i!==null)mn=i,Rt=s;else{if(s===null)throw Ze.alternate===null?Error(r(467)):Error(r(310));Rt=s,s={memoizedState:Rt.memoizedState,baseState:Rt.baseState,baseQueue:Rt.baseQueue,queue:Rt.queue,next:null},mn===null?Ze.memoizedState=mn=s:mn=mn.next=s}return mn}function Ou(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ro(s){var i=Lo;return Lo+=1,ul===null&&(ul=[]),s=e0(ul,s,i),i=Ze,(mn===null?i.memoizedState:mn.next)===null&&(i=i.alternate,B.H=i===null||i.memoizedState===null?V0:Xf),s}function Bu(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return Ro(s);if(s.$$typeof===E)return Dn(s)}throw Error(r(438,String(s)))}function $f(s){var i=null,c=Ze.updateQueue;if(c!==null&&(i=c.memoCache),i==null){var d=Ze.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(i={data:d.data.map(function(g){return g.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),c===null&&(c=Ou(),Ze.updateQueue=c),c.memoCache=i,c=i.data[i.index],c===void 0)for(c=i.data[i.index]=Array(s),d=0;d<s;d++)c[d]=z;return i.index++,c}function zs(s,i){return typeof i=="function"?i(s):i}function Pu(s){var i=hn();return Ff(i,Rt,s)}function Ff(s,i,c){var d=s.queue;if(d===null)throw Error(r(311));d.lastRenderedReducer=c;var g=s.baseQueue,v=d.pending;if(v!==null){if(g!==null){var S=g.next;g.next=v.next,v.next=S}i.baseQueue=g=v,d.pending=null}if(v=s.baseState,g===null)s.memoizedState=v;else{i=g.next;var T=S=null,U=null,te=i,ce=!1;do{var fe=te.lane&-536870913;if(fe!==te.lane?(ht&fe)===fe:(Rs&fe)===fe){var ie=te.revertLane;if(ie===0)U!==null&&(U=U.next={lane:0,revertLane:0,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null}),fe===sl&&(ce=!0);else if((Rs&ie)===ie){te=te.next,ie===sl&&(ce=!0);continue}else fe={lane:0,revertLane:te.revertLane,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},U===null?(T=U=fe,S=v):U=U.next=fe,Ze.lanes|=ie,ji|=ie;fe=te.action,ga&&c(v,fe),v=te.hasEagerState?te.eagerState:c(v,fe)}else ie={lane:fe,revertLane:te.revertLane,gesture:te.gesture,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},U===null?(T=U=ie,S=v):U=U.next=ie,Ze.lanes|=fe,ji|=fe;te=te.next}while(te!==null&&te!==i);if(U===null?S=v:U.next=T,!pr(v,s.memoizedState)&&(gn=!0,ce&&(c=il,c!==null)))throw c;s.memoizedState=v,s.baseState=S,s.baseQueue=U,d.lastRenderedState=v}return g===null&&(d.lanes=0),[s.memoizedState,d.dispatch]}function Uf(s){var i=hn(),c=i.queue;if(c===null)throw Error(r(311));c.lastRenderedReducer=s;var d=c.dispatch,g=c.pending,v=i.memoizedState;if(g!==null){c.pending=null;var S=g=g.next;do v=s(v,S.action),S=S.next;while(S!==g);pr(v,i.memoizedState)||(gn=!0),i.memoizedState=v,i.baseQueue===null&&(i.baseState=v),c.lastRenderedState=v}return[v,d]}function d0(s,i,c){var d=Ze,g=hn(),v=gt;if(v){if(c===void 0)throw Error(r(407));c=c()}else c=i();var S=!pr((Rt||g).memoizedState,c);if(S&&(g.memoizedState=c,gn=!0),g=g.queue,qf(p0.bind(null,d,g,s),[s]),g.getSnapshot!==i||S||mn!==null&&mn.memoizedState.tag&1){if(d.flags|=2048,dl(9,{destroy:void 0},f0.bind(null,d,g,c,i),null),Ft===null)throw Error(r(349));v||(Rs&127)!==0||h0(d,i,c)}return c}function h0(s,i,c){s.flags|=16384,s={getSnapshot:i,value:c},i=Ze.updateQueue,i===null?(i=Ou(),Ze.updateQueue=i,i.stores=[s]):(c=i.stores,c===null?i.stores=[s]:c.push(s))}function f0(s,i,c,d){i.value=c,i.getSnapshot=d,m0(i)&&g0(s)}function p0(s,i,c){return c(function(){m0(i)&&g0(s)})}function m0(s){var i=s.getSnapshot;s=s.value;try{var c=i();return!pr(s,c)}catch{return!0}}function g0(s){var i=la(s,2);i!==null&&ar(i,s,2)}function If(s){var i=Qn();if(typeof s=="function"){var c=s;if(s=c(),ga){wn(!0);try{c()}finally{wn(!1)}}}return i.memoizedState=i.baseState=s,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:zs,lastRenderedState:s},i}function x0(s,i,c,d){return s.baseState=c,Ff(s,Rt,typeof d=="function"?d:zs)}function zj(s,i,c,d,g){if(Uu(s))throw Error(r(485));if(s=i.action,s!==null){var v={payload:g,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(S){v.listeners.push(S)}};B.T!==null?c(!0):v.isTransition=!1,d(v),c=i.pending,c===null?(v.next=i.pending=v,v0(i,v)):(v.next=c.next,i.pending=c.next=v)}}function v0(s,i){var c=i.action,d=i.payload,g=s.state;if(i.isTransition){var v=B.T,S={};B.T=S;try{var T=c(g,d),U=B.S;U!==null&&U(S,T),b0(s,i,T)}catch(te){Hf(s,i,te)}finally{v!==null&&S.types!==null&&(v.types=S.types),B.T=v}}else try{v=c(g,d),b0(s,i,v)}catch(te){Hf(s,i,te)}}function b0(s,i,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(d){y0(s,i,d)},function(d){return Hf(s,i,d)}):y0(s,i,c)}function y0(s,i,c){i.status="fulfilled",i.value=c,_0(i),s.state=c,i=s.pending,i!==null&&(c=i.next,c===i?s.pending=null:(c=c.next,i.next=c,v0(s,c)))}function Hf(s,i,c){var d=s.pending;if(s.pending=null,d!==null){d=d.next;do i.status="rejected",i.reason=c,_0(i),i=i.next;while(i!==d)}s.action=null}function _0(s){s=s.listeners;for(var i=0;i<s.length;i++)(0,s[i])()}function w0(s,i){return i}function S0(s,i){if(gt){var c=Ft.formState;if(c!==null){e:{var d=Ze;if(gt){if(Yt){t:{for(var g=Yt,v=Pr;g.nodeType!==8;){if(!v){g=null;break t}if(g=Fr(g.nextSibling),g===null){g=null;break t}}v=g.data,g=v==="F!"||v==="F"?g:null}if(g){Yt=Fr(g.nextSibling),d=g.data==="F!";break e}}gi(d)}d=!1}d&&(i=c[0])}}return c=Qn(),c.memoizedState=c.baseState=i,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:w0,lastRenderedState:i},c.queue=d,c=I0.bind(null,Ze,d),d.dispatch=c,d=If(!1),v=Qf.bind(null,Ze,!1,d.queue),d=Qn(),g={state:i,dispatch:null,action:s,pending:null},d.queue=g,c=zj.bind(null,Ze,g,v,c),g.dispatch=c,d.memoizedState=s,[i,c,!1]}function k0(s){var i=hn();return j0(i,Rt,s)}function j0(s,i,c){if(i=Ff(s,i,w0)[0],s=Pu(zs)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var d=Ro(i)}catch(S){throw S===al?Eu:S}else d=i;i=hn();var g=i.queue,v=g.dispatch;return c!==i.memoizedState&&(Ze.flags|=2048,dl(9,{destroy:void 0},Oj.bind(null,g,c),null)),[d,v,s]}function Oj(s,i){s.action=i}function N0(s){var i=hn(),c=Rt;if(c!==null)return j0(i,c,s);hn(),i=i.memoizedState,c=hn();var d=c.queue.dispatch;return c.memoizedState=s,[i,d,!1]}function dl(s,i,c,d){return s={tag:s,create:c,deps:d,inst:i,next:null},i=Ze.updateQueue,i===null&&(i=Ou(),Ze.updateQueue=i),c=i.lastEffect,c===null?i.lastEffect=s.next=s:(d=c.next,c.next=s,s.next=d,i.lastEffect=s),s}function C0(){return hn().memoizedState}function $u(s,i,c,d){var g=Qn();Ze.flags|=s,g.memoizedState=dl(1|i,{destroy:void 0},c,d===void 0?null:d)}function Fu(s,i,c,d){var g=hn();d=d===void 0?null:d;var v=g.memoizedState.inst;Rt!==null&&d!==null&&Rf(d,Rt.memoizedState.deps)?g.memoizedState=dl(i,v,c,d):(Ze.flags|=s,g.memoizedState=dl(1|i,v,c,d))}function E0(s,i){$u(8390656,8,s,i)}function qf(s,i){Fu(2048,8,s,i)}function Bj(s){Ze.flags|=4;var i=Ze.updateQueue;if(i===null)i=Ou(),Ze.updateQueue=i,i.events=[s];else{var c=i.events;c===null?i.events=[s]:c.push(s)}}function A0(s){var i=hn().memoizedState;return Bj({ref:i,nextImpl:s}),function(){if((Nt&2)!==0)throw Error(r(440));return i.impl.apply(void 0,arguments)}}function T0(s,i){return Fu(4,2,s,i)}function M0(s,i){return Fu(4,4,s,i)}function D0(s,i){if(typeof i=="function"){s=s();var c=i(s);return function(){typeof c=="function"?c():i(null)}}if(i!=null)return s=s(),i.current=s,function(){i.current=null}}function L0(s,i,c){c=c!=null?c.concat([s]):null,Fu(4,4,D0.bind(null,i,s),c)}function Vf(){}function R0(s,i){var c=hn();i=i===void 0?null:i;var d=c.memoizedState;return i!==null&&Rf(i,d[1])?d[0]:(c.memoizedState=[s,i],s)}function z0(s,i){var c=hn();i=i===void 0?null:i;var d=c.memoizedState;if(i!==null&&Rf(i,d[1]))return d[0];if(d=s(),ga){wn(!0);try{s()}finally{wn(!1)}}return c.memoizedState=[d,i],d}function Gf(s,i,c){return c===void 0||(Rs&1073741824)!==0&&(ht&261930)===0?s.memoizedState=i:(s.memoizedState=c,s=O1(),Ze.lanes|=s,ji|=s,c)}function O0(s,i,c,d){return pr(c,i)?c:ol.current!==null?(s=Gf(s,c,d),pr(s,i)||(gn=!0),s):(Rs&42)===0||(Rs&1073741824)!==0&&(ht&261930)===0?(gn=!0,s.memoizedState=c):(s=O1(),Ze.lanes|=s,ji|=s,i)}function B0(s,i,c,d,g){var v=$.p;$.p=v!==0&&8>v?v:8;var S=B.T,T={};B.T=T,Qf(s,!1,i,c);try{var U=g(),te=B.S;if(te!==null&&te(T,U),U!==null&&typeof U=="object"&&typeof U.then=="function"){var ce=Dj(U,d);zo(s,i,ce,yr(s))}else zo(s,i,d,yr(s))}catch(fe){zo(s,i,{then:function(){},status:"rejected",reason:fe},yr())}finally{$.p=v,S!==null&&T.types!==null&&(S.types=T.types),B.T=S}}function Pj(){}function Yf(s,i,c,d){if(s.tag!==5)throw Error(r(476));var g=P0(s).queue;B0(s,g,i,se,c===null?Pj:function(){return $0(s),c(d)})}function P0(s){var i=s.memoizedState;if(i!==null)return i;i={memoizedState:se,baseState:se,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:zs,lastRenderedState:se},next:null};var c={};return i.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:zs,lastRenderedState:c},next:null},s.memoizedState=i,s=s.alternate,s!==null&&(s.memoizedState=i),i}function $0(s){var i=P0(s);i.next===null&&(i=s.alternate.memoizedState),zo(s,i.next.queue,{},yr())}function Wf(){return Dn(Zo)}function F0(){return hn().memoizedState}function U0(){return hn().memoizedState}function $j(s){for(var i=s.return;i!==null;){switch(i.tag){case 24:case 3:var c=yr();s=bi(c);var d=yi(i,s,c);d!==null&&(ar(d,i,c),To(d,i,c)),i={cache:Sf()},s.payload=i;return}i=i.return}}function Fj(s,i,c){var d=yr();c={lane:d,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Uu(s)?H0(i,c):(c=hf(s,i,c,d),c!==null&&(ar(c,s,d),q0(c,i,d)))}function I0(s,i,c){var d=yr();zo(s,i,c,d)}function zo(s,i,c,d){var g={lane:d,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(Uu(s))H0(i,g);else{var v=s.alternate;if(s.lanes===0&&(v===null||v.lanes===0)&&(v=i.lastRenderedReducer,v!==null))try{var S=i.lastRenderedState,T=v(S,c);if(g.hasEagerState=!0,g.eagerState=T,pr(T,S))return _u(s,i,g,0),Ft===null&&yu(),!1}catch{}finally{}if(c=hf(s,i,g,d),c!==null)return ar(c,s,d),q0(c,i,d),!0}return!1}function Qf(s,i,c,d){if(d={lane:2,revertLane:Cp(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},Uu(s)){if(i)throw Error(r(479))}else i=hf(s,c,d,2),i!==null&&ar(i,s,2)}function Uu(s){var i=s.alternate;return s===Ze||i!==null&&i===Ze}function H0(s,i){cl=Ru=!0;var c=s.pending;c===null?i.next=i:(i.next=c.next,c.next=i),s.pending=i}function q0(s,i,c){if((c&4194048)!==0){var d=i.lanes;d&=s.pendingLanes,c|=d,i.lanes=c,Pa(s,c)}}var Oo={readContext:Dn,use:Bu,useCallback:ln,useContext:ln,useEffect:ln,useImperativeHandle:ln,useLayoutEffect:ln,useInsertionEffect:ln,useMemo:ln,useReducer:ln,useRef:ln,useState:ln,useDebugValue:ln,useDeferredValue:ln,useTransition:ln,useSyncExternalStore:ln,useId:ln,useHostTransitionStatus:ln,useFormState:ln,useActionState:ln,useOptimistic:ln,useMemoCache:ln,useCacheRefresh:ln};Oo.useEffectEvent=ln;var V0={readContext:Dn,use:Bu,useCallback:function(s,i){return Qn().memoizedState=[s,i===void 0?null:i],s},useContext:Dn,useEffect:E0,useImperativeHandle:function(s,i,c){c=c!=null?c.concat([s]):null,$u(4194308,4,D0.bind(null,i,s),c)},useLayoutEffect:function(s,i){return $u(4194308,4,s,i)},useInsertionEffect:function(s,i){$u(4,2,s,i)},useMemo:function(s,i){var c=Qn();i=i===void 0?null:i;var d=s();if(ga){wn(!0);try{s()}finally{wn(!1)}}return c.memoizedState=[d,i],d},useReducer:function(s,i,c){var d=Qn();if(c!==void 0){var g=c(i);if(ga){wn(!0);try{c(i)}finally{wn(!1)}}}else g=i;return d.memoizedState=d.baseState=g,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:g},d.queue=s,s=s.dispatch=Fj.bind(null,Ze,s),[d.memoizedState,s]},useRef:function(s){var i=Qn();return s={current:s},i.memoizedState=s},useState:function(s){s=If(s);var i=s.queue,c=I0.bind(null,Ze,i);return i.dispatch=c,[s.memoizedState,c]},useDebugValue:Vf,useDeferredValue:function(s,i){var c=Qn();return Gf(c,s,i)},useTransition:function(){var s=If(!1);return s=B0.bind(null,Ze,s.queue,!0,!1),Qn().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,i,c){var d=Ze,g=Qn();if(gt){if(c===void 0)throw Error(r(407));c=c()}else{if(c=i(),Ft===null)throw Error(r(349));(ht&127)!==0||h0(d,i,c)}g.memoizedState=c;var v={value:c,getSnapshot:i};return g.queue=v,E0(p0.bind(null,d,v,s),[s]),d.flags|=2048,dl(9,{destroy:void 0},f0.bind(null,d,v,c,i),null),c},useId:function(){var s=Qn(),i=Ft.identifierPrefix;if(gt){var c=ms,d=ps;c=(d&~(1<<32-tt(d)-1)).toString(32)+c,i="_"+i+"R_"+c,c=zu++,0<c&&(i+="H"+c.toString(32)),i+="_"}else c=Lj++,i="_"+i+"r_"+c.toString(32)+"_";return s.memoizedState=i},useHostTransitionStatus:Wf,useFormState:S0,useActionState:S0,useOptimistic:function(s){var i=Qn();i.memoizedState=i.baseState=s;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=c,i=Qf.bind(null,Ze,!0,c),c.dispatch=i,[s,i]},useMemoCache:$f,useCacheRefresh:function(){return Qn().memoizedState=$j.bind(null,Ze)},useEffectEvent:function(s){var i=Qn(),c={impl:s};return i.memoizedState=c,function(){if((Nt&2)!==0)throw Error(r(440));return c.impl.apply(void 0,arguments)}}},Xf={readContext:Dn,use:Bu,useCallback:R0,useContext:Dn,useEffect:qf,useImperativeHandle:L0,useInsertionEffect:T0,useLayoutEffect:M0,useMemo:z0,useReducer:Pu,useRef:C0,useState:function(){return Pu(zs)},useDebugValue:Vf,useDeferredValue:function(s,i){var c=hn();return O0(c,Rt.memoizedState,s,i)},useTransition:function(){var s=Pu(zs)[0],i=hn().memoizedState;return[typeof s=="boolean"?s:Ro(s),i]},useSyncExternalStore:d0,useId:F0,useHostTransitionStatus:Wf,useFormState:k0,useActionState:k0,useOptimistic:function(s,i){var c=hn();return x0(c,Rt,s,i)},useMemoCache:$f,useCacheRefresh:U0};Xf.useEffectEvent=A0;var G0={readContext:Dn,use:Bu,useCallback:R0,useContext:Dn,useEffect:qf,useImperativeHandle:L0,useInsertionEffect:T0,useLayoutEffect:M0,useMemo:z0,useReducer:Uf,useRef:C0,useState:function(){return Uf(zs)},useDebugValue:Vf,useDeferredValue:function(s,i){var c=hn();return Rt===null?Gf(c,s,i):O0(c,Rt.memoizedState,s,i)},useTransition:function(){var s=Uf(zs)[0],i=hn().memoizedState;return[typeof s=="boolean"?s:Ro(s),i]},useSyncExternalStore:d0,useId:F0,useHostTransitionStatus:Wf,useFormState:N0,useActionState:N0,useOptimistic:function(s,i){var c=hn();return Rt!==null?x0(c,Rt,s,i):(c.baseState=s,[s,c.queue.dispatch])},useMemoCache:$f,useCacheRefresh:U0};G0.useEffectEvent=A0;function Kf(s,i,c,d){i=s.memoizedState,c=c(d,i),c=c==null?i:x({},i,c),s.memoizedState=c,s.lanes===0&&(s.updateQueue.baseState=c)}var Zf={enqueueSetState:function(s,i,c){s=s._reactInternals;var d=yr(),g=bi(d);g.payload=i,c!=null&&(g.callback=c),i=yi(s,g,d),i!==null&&(ar(i,s,d),To(i,s,d))},enqueueReplaceState:function(s,i,c){s=s._reactInternals;var d=yr(),g=bi(d);g.tag=1,g.payload=i,c!=null&&(g.callback=c),i=yi(s,g,d),i!==null&&(ar(i,s,d),To(i,s,d))},enqueueForceUpdate:function(s,i){s=s._reactInternals;var c=yr(),d=bi(c);d.tag=2,i!=null&&(d.callback=i),i=yi(s,d,c),i!==null&&(ar(i,s,c),To(i,s,c))}};function Y0(s,i,c,d,g,v,S){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(d,v,S):i.prototype&&i.prototype.isPureReactComponent?!wo(c,d)||!wo(g,v):!0}function W0(s,i,c,d){s=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(c,d),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(c,d),i.state!==s&&Zf.enqueueReplaceState(i,i.state,null)}function xa(s,i){var c=i;if("ref"in i){c={};for(var d in i)d!=="ref"&&(c[d]=i[d])}if(s=s.defaultProps){c===i&&(c=x({},c));for(var g in s)c[g]===void 0&&(c[g]=s[g])}return c}function Q0(s){bu(s)}function X0(s){console.error(s)}function K0(s){bu(s)}function Iu(s,i){try{var c=s.onUncaughtError;c(i.value,{componentStack:i.stack})}catch(d){setTimeout(function(){throw d})}}function Z0(s,i,c){try{var d=s.onCaughtError;d(c.value,{componentStack:c.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(g){setTimeout(function(){throw g})}}function Jf(s,i,c){return c=bi(c),c.tag=3,c.payload={element:null},c.callback=function(){Iu(s,i)},c}function J0(s){return s=bi(s),s.tag=3,s}function e1(s,i,c,d){var g=c.type.getDerivedStateFromError;if(typeof g=="function"){var v=d.value;s.payload=function(){return g(v)},s.callback=function(){Z0(i,c,d)}}var S=c.stateNode;S!==null&&typeof S.componentDidCatch=="function"&&(s.callback=function(){Z0(i,c,d),typeof g!="function"&&(Ni===null?Ni=new Set([this]):Ni.add(this));var T=d.stack;this.componentDidCatch(d.value,{componentStack:T!==null?T:""})})}function Uj(s,i,c,d,g){if(c.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(i=c.alternate,i!==null&&rl(i,c,g,!0),c=gr.current,c!==null){switch(c.tag){case 31:case 13:return $r===null?ed():c.alternate===null&&on===0&&(on=3),c.flags&=-257,c.flags|=65536,c.lanes=g,d===Au?c.flags|=16384:(i=c.updateQueue,i===null?c.updateQueue=new Set([d]):i.add(d),kp(s,d,g)),!1;case 22:return c.flags|=65536,d===Au?c.flags|=16384:(i=c.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([d])},c.updateQueue=i):(c=i.retryQueue,c===null?i.retryQueue=new Set([d]):c.add(d)),kp(s,d,g)),!1}throw Error(r(435,c.tag))}return kp(s,d,g),ed(),!1}if(gt)return i=gr.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=g,d!==vf&&(s=Error(r(422),{cause:d}),jo(zr(s,c)))):(d!==vf&&(i=Error(r(423),{cause:d}),jo(zr(i,c))),s=s.current.alternate,s.flags|=65536,g&=-g,s.lanes|=g,d=zr(d,c),g=Jf(s.stateNode,d,g),Af(s,g),on!==4&&(on=2)),!1;var v=Error(r(520),{cause:d});if(v=zr(v,c),qo===null?qo=[v]:qo.push(v),on!==4&&(on=2),i===null)return!0;d=zr(d,c),c=i;do{switch(c.tag){case 3:return c.flags|=65536,s=g&-g,c.lanes|=s,s=Jf(c.stateNode,d,s),Af(c,s),!1;case 1:if(i=c.type,v=c.stateNode,(c.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(Ni===null||!Ni.has(v))))return c.flags|=65536,g&=-g,c.lanes|=g,g=J0(g),e1(g,s,c,d),Af(c,g),!1}c=c.return}while(c!==null);return!1}var ep=Error(r(461)),gn=!1;function Ln(s,i,c,d){i.child=s===null?s0(i,null,c,d):ma(i,s.child,c,d)}function t1(s,i,c,d,g){c=c.render;var v=i.ref;if("ref"in d){var S={};for(var T in d)T!=="ref"&&(S[T]=d[T])}else S=d;return da(i),d=zf(s,i,c,S,v,g),T=Of(),s!==null&&!gn?(Bf(s,i,g),Os(s,i,g)):(gt&&T&&gf(i),i.flags|=1,Ln(s,i,d,g),i.child)}function n1(s,i,c,d,g){if(s===null){var v=c.type;return typeof v=="function"&&!ff(v)&&v.defaultProps===void 0&&c.compare===null?(i.tag=15,i.type=v,r1(s,i,v,d,g)):(s=Su(c.type,null,d,i,i.mode,g),s.ref=i.ref,s.return=i,i.child=s)}if(v=s.child,!op(s,g)){var S=v.memoizedProps;if(c=c.compare,c=c!==null?c:wo,c(S,d)&&s.ref===i.ref)return Os(s,i,g)}return i.flags|=1,s=Ts(v,d),s.ref=i.ref,s.return=i,i.child=s}function r1(s,i,c,d,g){if(s!==null){var v=s.memoizedProps;if(wo(v,d)&&s.ref===i.ref)if(gn=!1,i.pendingProps=d=v,op(s,g))(s.flags&131072)!==0&&(gn=!0);else return i.lanes=s.lanes,Os(s,i,g)}return tp(s,i,c,d,g)}function s1(s,i,c,d){var g=d.children,v=s!==null?s.memoizedState:null;if(s===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((i.flags&128)!==0){if(v=v!==null?v.baseLanes|c:c,s!==null){for(d=i.child=s.child,g=0;d!==null;)g=g|d.lanes|d.childLanes,d=d.sibling;d=g&~v}else d=0,i.child=null;return i1(s,i,v,c,d)}if((c&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},s!==null&&Cu(i,v!==null?v.cachePool:null),v!==null?l0(i,v):Mf(),o0(i);else return d=i.lanes=536870912,i1(s,i,v!==null?v.baseLanes|c:c,c,d)}else v!==null?(Cu(i,v.cachePool),l0(i,v),wi(),i.memoizedState=null):(s!==null&&Cu(i,null),Mf(),wi());return Ln(s,i,g,c),i.child}function Bo(s,i){return s!==null&&s.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function i1(s,i,c,d,g){var v=jf();return v=v===null?null:{parent:pn._currentValue,pool:v},i.memoizedState={baseLanes:c,cachePool:v},s!==null&&Cu(i,null),Mf(),o0(i),s!==null&&rl(s,i,d,!0),i.childLanes=g,null}function Hu(s,i){return i=Vu({mode:i.mode,children:i.children},s.mode),i.ref=s.ref,s.child=i,i.return=s,i}function a1(s,i,c){return ma(i,s.child,null,c),s=Hu(i,i.pendingProps),s.flags|=2,xr(i),i.memoizedState=null,s}function Ij(s,i,c){var d=i.pendingProps,g=(i.flags&128)!==0;if(i.flags&=-129,s===null){if(gt){if(d.mode==="hidden")return s=Hu(i,d),i.lanes=536870912,Bo(null,s);if(Lf(i),(s=Yt)?(s=vb(s,Pr),s=s!==null&&s.data==="&"?s:null,s!==null&&(i.memoizedState={dehydrated:s,treeContext:pi!==null?{id:ps,overflow:ms}:null,retryLane:536870912,hydrationErrors:null},c=Hv(s),c.return=i,i.child=c,Mn=i,Yt=null)):s=null,s===null)throw gi(i);return i.lanes=536870912,null}return Hu(i,d)}var v=s.memoizedState;if(v!==null){var S=v.dehydrated;if(Lf(i),g)if(i.flags&256)i.flags&=-257,i=a1(s,i,c);else if(i.memoizedState!==null)i.child=s.child,i.flags|=128,i=null;else throw Error(r(558));else if(gn||rl(s,i,c,!1),g=(c&s.childLanes)!==0,gn||g){if(d=Ft,d!==null&&(S=lo(d,c),S!==0&&S!==v.retryLane))throw v.retryLane=S,la(s,S),ar(d,s,S),ep;ed(),i=a1(s,i,c)}else s=v.treeContext,Yt=Fr(S.nextSibling),Mn=i,gt=!0,mi=null,Pr=!1,s!==null&&Gv(i,s),i=Hu(i,d),i.flags|=4096;return i}return s=Ts(s.child,{mode:d.mode,children:d.children}),s.ref=i.ref,i.child=s,s.return=i,s}function qu(s,i){var c=i.ref;if(c===null)s!==null&&s.ref!==null&&(i.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(r(284));(s===null||s.ref!==c)&&(i.flags|=4194816)}}function tp(s,i,c,d,g){return da(i),c=zf(s,i,c,d,void 0,g),d=Of(),s!==null&&!gn?(Bf(s,i,g),Os(s,i,g)):(gt&&d&&gf(i),i.flags|=1,Ln(s,i,c,g),i.child)}function l1(s,i,c,d,g,v){return da(i),i.updateQueue=null,c=u0(i,d,c,g),c0(s),d=Of(),s!==null&&!gn?(Bf(s,i,v),Os(s,i,v)):(gt&&d&&gf(i),i.flags|=1,Ln(s,i,c,v),i.child)}function o1(s,i,c,d,g){if(da(i),i.stateNode===null){var v=Ja,S=c.contextType;typeof S=="object"&&S!==null&&(v=Dn(S)),v=new c(d,v),i.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,v.updater=Zf,i.stateNode=v,v._reactInternals=i,v=i.stateNode,v.props=d,v.state=i.memoizedState,v.refs={},Cf(i),S=c.contextType,v.context=typeof S=="object"&&S!==null?Dn(S):Ja,v.state=i.memoizedState,S=c.getDerivedStateFromProps,typeof S=="function"&&(Kf(i,c,S,d),v.state=i.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(S=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),S!==v.state&&Zf.enqueueReplaceState(v,v.state,null),Do(i,d,v,g),Mo(),v.state=i.memoizedState),typeof v.componentDidMount=="function"&&(i.flags|=4194308),d=!0}else if(s===null){v=i.stateNode;var T=i.memoizedProps,U=xa(c,T);v.props=U;var te=v.context,ce=c.contextType;S=Ja,typeof ce=="object"&&ce!==null&&(S=Dn(ce));var fe=c.getDerivedStateFromProps;ce=typeof fe=="function"||typeof v.getSnapshotBeforeUpdate=="function",T=i.pendingProps!==T,ce||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(T||te!==S)&&W0(i,v,d,S),vi=!1;var ie=i.memoizedState;v.state=ie,Do(i,d,v,g),Mo(),te=i.memoizedState,T||ie!==te||vi?(typeof fe=="function"&&(Kf(i,c,fe,d),te=i.memoizedState),(U=vi||Y0(i,c,U,d,ie,te,S))?(ce||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount()),typeof v.componentDidMount=="function"&&(i.flags|=4194308)):(typeof v.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=d,i.memoizedState=te),v.props=d,v.state=te,v.context=S,d=U):(typeof v.componentDidMount=="function"&&(i.flags|=4194308),d=!1)}else{v=i.stateNode,Ef(s,i),S=i.memoizedProps,ce=xa(c,S),v.props=ce,fe=i.pendingProps,ie=v.context,te=c.contextType,U=Ja,typeof te=="object"&&te!==null&&(U=Dn(te)),T=c.getDerivedStateFromProps,(te=typeof T=="function"||typeof v.getSnapshotBeforeUpdate=="function")||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(S!==fe||ie!==U)&&W0(i,v,d,U),vi=!1,ie=i.memoizedState,v.state=ie,Do(i,d,v,g),Mo();var le=i.memoizedState;S!==fe||ie!==le||vi||s!==null&&s.dependencies!==null&&ju(s.dependencies)?(typeof T=="function"&&(Kf(i,c,T,d),le=i.memoizedState),(ce=vi||Y0(i,c,ce,d,ie,le,U)||s!==null&&s.dependencies!==null&&ju(s.dependencies))?(te||typeof v.UNSAFE_componentWillUpdate!="function"&&typeof v.componentWillUpdate!="function"||(typeof v.componentWillUpdate=="function"&&v.componentWillUpdate(d,le,U),typeof v.UNSAFE_componentWillUpdate=="function"&&v.UNSAFE_componentWillUpdate(d,le,U)),typeof v.componentDidUpdate=="function"&&(i.flags|=4),typeof v.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof v.componentDidUpdate!="function"||S===s.memoizedProps&&ie===s.memoizedState||(i.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||S===s.memoizedProps&&ie===s.memoizedState||(i.flags|=1024),i.memoizedProps=d,i.memoizedState=le),v.props=d,v.state=le,v.context=U,d=ce):(typeof v.componentDidUpdate!="function"||S===s.memoizedProps&&ie===s.memoizedState||(i.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||S===s.memoizedProps&&ie===s.memoizedState||(i.flags|=1024),d=!1)}return v=d,qu(s,i),d=(i.flags&128)!==0,v||d?(v=i.stateNode,c=d&&typeof c.getDerivedStateFromError!="function"?null:v.render(),i.flags|=1,s!==null&&d?(i.child=ma(i,s.child,null,g),i.child=ma(i,null,c,g)):Ln(s,i,c,g),i.memoizedState=v.state,s=i.child):s=Os(s,i,g),s}function c1(s,i,c,d){return ca(),i.flags|=256,Ln(s,i,c,d),i.child}var np={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function rp(s){return{baseLanes:s,cachePool:Zv()}}function sp(s,i,c){return s=s!==null?s.childLanes&~c:0,i&&(s|=br),s}function u1(s,i,c){var d=i.pendingProps,g=!1,v=(i.flags&128)!==0,S;if((S=v)||(S=s!==null&&s.memoizedState===null?!1:(dn.current&2)!==0),S&&(g=!0,i.flags&=-129),S=(i.flags&32)!==0,i.flags&=-33,s===null){if(gt){if(g?_i(i):wi(),(s=Yt)?(s=vb(s,Pr),s=s!==null&&s.data!=="&"?s:null,s!==null&&(i.memoizedState={dehydrated:s,treeContext:pi!==null?{id:ps,overflow:ms}:null,retryLane:536870912,hydrationErrors:null},c=Hv(s),c.return=i,i.child=c,Mn=i,Yt=null)):s=null,s===null)throw gi(i);return Fp(s)?i.lanes=32:i.lanes=536870912,null}var T=d.children;return d=d.fallback,g?(wi(),g=i.mode,T=Vu({mode:"hidden",children:T},g),d=oa(d,g,c,null),T.return=i,d.return=i,T.sibling=d,i.child=T,d=i.child,d.memoizedState=rp(c),d.childLanes=sp(s,S,c),i.memoizedState=np,Bo(null,d)):(_i(i),ip(i,T))}var U=s.memoizedState;if(U!==null&&(T=U.dehydrated,T!==null)){if(v)i.flags&256?(_i(i),i.flags&=-257,i=ap(s,i,c)):i.memoizedState!==null?(wi(),i.child=s.child,i.flags|=128,i=null):(wi(),T=d.fallback,g=i.mode,d=Vu({mode:"visible",children:d.children},g),T=oa(T,g,c,null),T.flags|=2,d.return=i,T.return=i,d.sibling=T,i.child=d,ma(i,s.child,null,c),d=i.child,d.memoizedState=rp(c),d.childLanes=sp(s,S,c),i.memoizedState=np,i=Bo(null,d));else if(_i(i),Fp(T)){if(S=T.nextSibling&&T.nextSibling.dataset,S)var te=S.dgst;S=te,d=Error(r(419)),d.stack="",d.digest=S,jo({value:d,source:null,stack:null}),i=ap(s,i,c)}else if(gn||rl(s,i,c,!1),S=(c&s.childLanes)!==0,gn||S){if(S=Ft,S!==null&&(d=lo(S,c),d!==0&&d!==U.retryLane))throw U.retryLane=d,la(s,d),ar(S,s,d),ep;$p(T)||ed(),i=ap(s,i,c)}else $p(T)?(i.flags|=192,i.child=s.child,i=null):(s=U.treeContext,Yt=Fr(T.nextSibling),Mn=i,gt=!0,mi=null,Pr=!1,s!==null&&Gv(i,s),i=ip(i,d.children),i.flags|=4096);return i}return g?(wi(),T=d.fallback,g=i.mode,U=s.child,te=U.sibling,d=Ts(U,{mode:"hidden",children:d.children}),d.subtreeFlags=U.subtreeFlags&65011712,te!==null?T=Ts(te,T):(T=oa(T,g,c,null),T.flags|=2),T.return=i,d.return=i,d.sibling=T,i.child=d,Bo(null,d),d=i.child,T=s.child.memoizedState,T===null?T=rp(c):(g=T.cachePool,g!==null?(U=pn._currentValue,g=g.parent!==U?{parent:U,pool:U}:g):g=Zv(),T={baseLanes:T.baseLanes|c,cachePool:g}),d.memoizedState=T,d.childLanes=sp(s,S,c),i.memoizedState=np,Bo(s.child,d)):(_i(i),c=s.child,s=c.sibling,c=Ts(c,{mode:"visible",children:d.children}),c.return=i,c.sibling=null,s!==null&&(S=i.deletions,S===null?(i.deletions=[s],i.flags|=16):S.push(s)),i.child=c,i.memoizedState=null,c)}function ip(s,i){return i=Vu({mode:"visible",children:i},s.mode),i.return=s,s.child=i}function Vu(s,i){return s=mr(22,s,null,i),s.lanes=0,s}function ap(s,i,c){return ma(i,s.child,null,c),s=ip(i,i.pendingProps.children),s.flags|=2,i.memoizedState=null,s}function d1(s,i,c){s.lanes|=i;var d=s.alternate;d!==null&&(d.lanes|=i),_f(s.return,i,c)}function lp(s,i,c,d,g,v){var S=s.memoizedState;S===null?s.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:d,tail:c,tailMode:g,treeForkCount:v}:(S.isBackwards=i,S.rendering=null,S.renderingStartTime=0,S.last=d,S.tail=c,S.tailMode=g,S.treeForkCount=v)}function h1(s,i,c){var d=i.pendingProps,g=d.revealOrder,v=d.tail;d=d.children;var S=dn.current,T=(S&2)!==0;if(T?(S=S&1|2,i.flags|=128):S&=1,M(dn,S),Ln(s,i,d,c),d=gt?ko:0,!T&&s!==null&&(s.flags&128)!==0)e:for(s=i.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&d1(s,c,i);else if(s.tag===19)d1(s,c,i);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===i)break e;for(;s.sibling===null;){if(s.return===null||s.return===i)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(g){case"forwards":for(c=i.child,g=null;c!==null;)s=c.alternate,s!==null&&Lu(s)===null&&(g=c),c=c.sibling;c=g,c===null?(g=i.child,i.child=null):(g=c.sibling,c.sibling=null),lp(i,!1,g,c,v,d);break;case"backwards":case"unstable_legacy-backwards":for(c=null,g=i.child,i.child=null;g!==null;){if(s=g.alternate,s!==null&&Lu(s)===null){i.child=g;break}s=g.sibling,g.sibling=c,c=g,g=s}lp(i,!0,c,null,v,d);break;case"together":lp(i,!1,null,null,void 0,d);break;default:i.memoizedState=null}return i.child}function Os(s,i,c){if(s!==null&&(i.dependencies=s.dependencies),ji|=i.lanes,(c&i.childLanes)===0)if(s!==null){if(rl(s,i,c,!1),(c&i.childLanes)===0)return null}else return null;if(s!==null&&i.child!==s.child)throw Error(r(153));if(i.child!==null){for(s=i.child,c=Ts(s,s.pendingProps),i.child=c,c.return=i;s.sibling!==null;)s=s.sibling,c=c.sibling=Ts(s,s.pendingProps),c.return=i;c.sibling=null}return i.child}function op(s,i){return(s.lanes&i)!==0?!0:(s=s.dependencies,!!(s!==null&&ju(s)))}function Hj(s,i,c){switch(i.tag){case 3:Ee(i,i.stateNode.containerInfo),xi(i,pn,s.memoizedState.cache),ca();break;case 27:case 5:et(i);break;case 4:Ee(i,i.stateNode.containerInfo);break;case 10:xi(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,Lf(i),null;break;case 13:var d=i.memoizedState;if(d!==null)return d.dehydrated!==null?(_i(i),i.flags|=128,null):(c&i.child.childLanes)!==0?u1(s,i,c):(_i(i),s=Os(s,i,c),s!==null?s.sibling:null);_i(i);break;case 19:var g=(s.flags&128)!==0;if(d=(c&i.childLanes)!==0,d||(rl(s,i,c,!1),d=(c&i.childLanes)!==0),g){if(d)return h1(s,i,c);i.flags|=128}if(g=i.memoizedState,g!==null&&(g.rendering=null,g.tail=null,g.lastEffect=null),M(dn,dn.current),d)break;return null;case 22:return i.lanes=0,s1(s,i,c,i.pendingProps);case 24:xi(i,pn,s.memoizedState.cache)}return Os(s,i,c)}function f1(s,i,c){if(s!==null)if(s.memoizedProps!==i.pendingProps)gn=!0;else{if(!op(s,c)&&(i.flags&128)===0)return gn=!1,Hj(s,i,c);gn=(s.flags&131072)!==0}else gn=!1,gt&&(i.flags&1048576)!==0&&Vv(i,ko,i.index);switch(i.lanes=0,i.tag){case 16:e:{var d=i.pendingProps;if(s=fa(i.elementType),i.type=s,typeof s=="function")ff(s)?(d=xa(s,d),i.tag=1,i=o1(null,i,s,d,c)):(i.tag=0,i=tp(null,i,s,d,c));else{if(s!=null){var g=s.$$typeof;if(g===R){i.tag=11,i=t1(null,i,s,d,c);break e}else if(g===q){i.tag=14,i=n1(null,i,s,d,c);break e}}throw i=Z(s)||s,Error(r(306,i,""))}}return i;case 0:return tp(s,i,i.type,i.pendingProps,c);case 1:return d=i.type,g=xa(d,i.pendingProps),o1(s,i,d,g,c);case 3:e:{if(Ee(i,i.stateNode.containerInfo),s===null)throw Error(r(387));d=i.pendingProps;var v=i.memoizedState;g=v.element,Ef(s,i),Do(i,d,null,c);var S=i.memoizedState;if(d=S.cache,xi(i,pn,d),d!==v.cache&&wf(i,[pn],c,!0),Mo(),d=S.element,v.isDehydrated)if(v={element:d,isDehydrated:!1,cache:S.cache},i.updateQueue.baseState=v,i.memoizedState=v,i.flags&256){i=c1(s,i,d,c);break e}else if(d!==g){g=zr(Error(r(424)),i),jo(g),i=c1(s,i,d,c);break e}else{switch(s=i.stateNode.containerInfo,s.nodeType){case 9:s=s.body;break;default:s=s.nodeName==="HTML"?s.ownerDocument.body:s}for(Yt=Fr(s.firstChild),Mn=i,gt=!0,mi=null,Pr=!0,c=s0(i,null,d,c),i.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling}else{if(ca(),d===g){i=Os(s,i,c);break e}Ln(s,i,d,c)}i=i.child}return i;case 26:return qu(s,i),s===null?(c=kb(i.type,null,i.pendingProps,null))?i.memoizedState=c:gt||(c=i.type,s=i.pendingProps,d=ld(Ce.current).createElement(c),d[en]=i,d[Tn]=s,Rn(d,c,s),nn(d),i.stateNode=d):i.memoizedState=kb(i.type,s.memoizedProps,i.pendingProps,s.memoizedState),null;case 27:return et(i),s===null&&gt&&(d=i.stateNode=_b(i.type,i.pendingProps,Ce.current),Mn=i,Pr=!0,g=Yt,Ti(i.type)?(Up=g,Yt=Fr(d.firstChild)):Yt=g),Ln(s,i,i.pendingProps.children,c),qu(s,i),s===null&&(i.flags|=4194304),i.child;case 5:return s===null&&gt&&((g=d=Yt)&&(d=bN(d,i.type,i.pendingProps,Pr),d!==null?(i.stateNode=d,Mn=i,Yt=Fr(d.firstChild),Pr=!1,g=!0):g=!1),g||gi(i)),et(i),g=i.type,v=i.pendingProps,S=s!==null?s.memoizedProps:null,d=v.children,Op(g,v)?d=null:S!==null&&Op(g,S)&&(i.flags|=32),i.memoizedState!==null&&(g=zf(s,i,Rj,null,null,c),Zo._currentValue=g),qu(s,i),Ln(s,i,d,c),i.child;case 6:return s===null&&gt&&((s=c=Yt)&&(c=yN(c,i.pendingProps,Pr),c!==null?(i.stateNode=c,Mn=i,Yt=null,s=!0):s=!1),s||gi(i)),null;case 13:return u1(s,i,c);case 4:return Ee(i,i.stateNode.containerInfo),d=i.pendingProps,s===null?i.child=ma(i,null,d,c):Ln(s,i,d,c),i.child;case 11:return t1(s,i,i.type,i.pendingProps,c);case 7:return Ln(s,i,i.pendingProps,c),i.child;case 8:return Ln(s,i,i.pendingProps.children,c),i.child;case 12:return Ln(s,i,i.pendingProps.children,c),i.child;case 10:return d=i.pendingProps,xi(i,i.type,d.value),Ln(s,i,d.children,c),i.child;case 9:return g=i.type._context,d=i.pendingProps.children,da(i),g=Dn(g),d=d(g),i.flags|=1,Ln(s,i,d,c),i.child;case 14:return n1(s,i,i.type,i.pendingProps,c);case 15:return r1(s,i,i.type,i.pendingProps,c);case 19:return h1(s,i,c);case 31:return Ij(s,i,c);case 22:return s1(s,i,c,i.pendingProps);case 24:return da(i),d=Dn(pn),s===null?(g=jf(),g===null&&(g=Ft,v=Sf(),g.pooledCache=v,v.refCount++,v!==null&&(g.pooledCacheLanes|=c),g=v),i.memoizedState={parent:d,cache:g},Cf(i),xi(i,pn,g)):((s.lanes&c)!==0&&(Ef(s,i),Do(i,null,null,c),Mo()),g=s.memoizedState,v=i.memoizedState,g.parent!==d?(g={parent:d,cache:d},i.memoizedState=g,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=g),xi(i,pn,d)):(d=v.cache,xi(i,pn,d),d!==g.cache&&wf(i,[pn],c,!0))),Ln(s,i,i.pendingProps.children,c),i.child;case 29:throw i.pendingProps}throw Error(r(156,i.tag))}function Bs(s){s.flags|=4}function cp(s,i,c,d,g){if((i=(s.mode&32)!==0)&&(i=!1),i){if(s.flags|=16777216,(g&335544128)===g)if(s.stateNode.complete)s.flags|=8192;else if(F1())s.flags|=8192;else throw pa=Au,Nf}else s.flags&=-16777217}function p1(s,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!Ab(i))if(F1())s.flags|=8192;else throw pa=Au,Nf}function Gu(s,i){i!==null&&(s.flags|=4),s.flags&16384&&(i=s.tag!==22?fn():536870912,s.lanes|=i,ml|=i)}function Po(s,i){if(!gt)switch(s.tailMode){case"hidden":i=s.tail;for(var c=null;i!==null;)i.alternate!==null&&(c=i),i=i.sibling;c===null?s.tail=null:c.sibling=null;break;case"collapsed":c=s.tail;for(var d=null;c!==null;)c.alternate!==null&&(d=c),c=c.sibling;d===null?i||s.tail===null?s.tail=null:s.tail.sibling=null:d.sibling=null}}function Wt(s){var i=s.alternate!==null&&s.alternate.child===s.child,c=0,d=0;if(i)for(var g=s.child;g!==null;)c|=g.lanes|g.childLanes,d|=g.subtreeFlags&65011712,d|=g.flags&65011712,g.return=s,g=g.sibling;else for(g=s.child;g!==null;)c|=g.lanes|g.childLanes,d|=g.subtreeFlags,d|=g.flags,g.return=s,g=g.sibling;return s.subtreeFlags|=d,s.childLanes=c,i}function qj(s,i,c){var d=i.pendingProps;switch(xf(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Wt(i),null;case 1:return Wt(i),null;case 3:return c=i.stateNode,d=null,s!==null&&(d=s.memoizedState.cache),i.memoizedState.cache!==d&&(i.flags|=2048),Ls(pn),Pe(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(s===null||s.child===null)&&(nl(i)?Bs(i):s===null||s.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,bf())),Wt(i),null;case 26:var g=i.type,v=i.memoizedState;return s===null?(Bs(i),v!==null?(Wt(i),p1(i,v)):(Wt(i),cp(i,g,null,d,c))):v?v!==s.memoizedState?(Bs(i),Wt(i),p1(i,v)):(Wt(i),i.flags&=-16777217):(s=s.memoizedProps,s!==d&&Bs(i),Wt(i),cp(i,g,s,d,c)),null;case 27:if(Et(i),c=Ce.current,g=i.type,s!==null&&i.stateNode!=null)s.memoizedProps!==d&&Bs(i);else{if(!d){if(i.stateNode===null)throw Error(r(166));return Wt(i),null}s=ge.current,nl(i)?Yv(i):(s=_b(g,d,c),i.stateNode=s,Bs(i))}return Wt(i),null;case 5:if(Et(i),g=i.type,s!==null&&i.stateNode!=null)s.memoizedProps!==d&&Bs(i);else{if(!d){if(i.stateNode===null)throw Error(r(166));return Wt(i),null}if(v=ge.current,nl(i))Yv(i);else{var S=ld(Ce.current);switch(v){case 1:v=S.createElementNS("http://www.w3.org/2000/svg",g);break;case 2:v=S.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;default:switch(g){case"svg":v=S.createElementNS("http://www.w3.org/2000/svg",g);break;case"math":v=S.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;case"script":v=S.createElement("div"),v.innerHTML="<script><\/script>",v=v.removeChild(v.firstChild);break;case"select":v=typeof d.is=="string"?S.createElement("select",{is:d.is}):S.createElement("select"),d.multiple?v.multiple=!0:d.size&&(v.size=d.size);break;default:v=typeof d.is=="string"?S.createElement(g,{is:d.is}):S.createElement(g)}}v[en]=i,v[Tn]=d;e:for(S=i.child;S!==null;){if(S.tag===5||S.tag===6)v.appendChild(S.stateNode);else if(S.tag!==4&&S.tag!==27&&S.child!==null){S.child.return=S,S=S.child;continue}if(S===i)break e;for(;S.sibling===null;){if(S.return===null||S.return===i)break e;S=S.return}S.sibling.return=S.return,S=S.sibling}i.stateNode=v;e:switch(Rn(v,g,d),g){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}d&&Bs(i)}}return Wt(i),cp(i,i.type,s===null?null:s.memoizedProps,i.pendingProps,c),null;case 6:if(s&&i.stateNode!=null)s.memoizedProps!==d&&Bs(i);else{if(typeof d!="string"&&i.stateNode===null)throw Error(r(166));if(s=Ce.current,nl(i)){if(s=i.stateNode,c=i.memoizedProps,d=null,g=Mn,g!==null)switch(g.tag){case 27:case 5:d=g.memoizedProps}s[en]=i,s=!!(s.nodeValue===c||d!==null&&d.suppressHydrationWarning===!0||ub(s.nodeValue,c)),s||gi(i,!0)}else s=ld(s).createTextNode(d),s[en]=i,i.stateNode=s}return Wt(i),null;case 31:if(c=i.memoizedState,s===null||s.memoizedState!==null){if(d=nl(i),c!==null){if(s===null){if(!d)throw Error(r(318));if(s=i.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(557));s[en]=i}else ca(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Wt(i),s=!1}else c=bf(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=c),s=!0;if(!s)return i.flags&256?(xr(i),i):(xr(i),null);if((i.flags&128)!==0)throw Error(r(558))}return Wt(i),null;case 13:if(d=i.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(g=nl(i),d!==null&&d.dehydrated!==null){if(s===null){if(!g)throw Error(r(318));if(g=i.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(r(317));g[en]=i}else ca(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Wt(i),g=!1}else g=bf(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=g),g=!0;if(!g)return i.flags&256?(xr(i),i):(xr(i),null)}return xr(i),(i.flags&128)!==0?(i.lanes=c,i):(c=d!==null,s=s!==null&&s.memoizedState!==null,c&&(d=i.child,g=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(g=d.alternate.memoizedState.cachePool.pool),v=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(v=d.memoizedState.cachePool.pool),v!==g&&(d.flags|=2048)),c!==s&&c&&(i.child.flags|=8192),Gu(i,i.updateQueue),Wt(i),null);case 4:return Pe(),s===null&&Mp(i.stateNode.containerInfo),Wt(i),null;case 10:return Ls(i.type),Wt(i),null;case 19:if(J(dn),d=i.memoizedState,d===null)return Wt(i),null;if(g=(i.flags&128)!==0,v=d.rendering,v===null)if(g)Po(d,!1);else{if(on!==0||s!==null&&(s.flags&128)!==0)for(s=i.child;s!==null;){if(v=Lu(s),v!==null){for(i.flags|=128,Po(d,!1),s=v.updateQueue,i.updateQueue=s,Gu(i,s),i.subtreeFlags=0,s=c,c=i.child;c!==null;)Iv(c,s),c=c.sibling;return M(dn,dn.current&1|2),gt&&Ms(i,d.treeForkCount),i.child}s=s.sibling}d.tail!==null&&Ae()>Ku&&(i.flags|=128,g=!0,Po(d,!1),i.lanes=4194304)}else{if(!g)if(s=Lu(v),s!==null){if(i.flags|=128,g=!0,s=s.updateQueue,i.updateQueue=s,Gu(i,s),Po(d,!0),d.tail===null&&d.tailMode==="hidden"&&!v.alternate&&!gt)return Wt(i),null}else 2*Ae()-d.renderingStartTime>Ku&&c!==536870912&&(i.flags|=128,g=!0,Po(d,!1),i.lanes=4194304);d.isBackwards?(v.sibling=i.child,i.child=v):(s=d.last,s!==null?s.sibling=v:i.child=v,d.last=v)}return d.tail!==null?(s=d.tail,d.rendering=s,d.tail=s.sibling,d.renderingStartTime=Ae(),s.sibling=null,c=dn.current,M(dn,g?c&1|2:c&1),gt&&Ms(i,d.treeForkCount),s):(Wt(i),null);case 22:case 23:return xr(i),Df(),d=i.memoizedState!==null,s!==null?s.memoizedState!==null!==d&&(i.flags|=8192):d&&(i.flags|=8192),d?(c&536870912)!==0&&(i.flags&128)===0&&(Wt(i),i.subtreeFlags&6&&(i.flags|=8192)):Wt(i),c=i.updateQueue,c!==null&&Gu(i,c.retryQueue),c=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(c=s.memoizedState.cachePool.pool),d=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(d=i.memoizedState.cachePool.pool),d!==c&&(i.flags|=2048),s!==null&&J(ha),null;case 24:return c=null,s!==null&&(c=s.memoizedState.cache),i.memoizedState.cache!==c&&(i.flags|=2048),Ls(pn),Wt(i),null;case 25:return null;case 30:return null}throw Error(r(156,i.tag))}function Vj(s,i){switch(xf(i),i.tag){case 1:return s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 3:return Ls(pn),Pe(),s=i.flags,(s&65536)!==0&&(s&128)===0?(i.flags=s&-65537|128,i):null;case 26:case 27:case 5:return Et(i),null;case 31:if(i.memoizedState!==null){if(xr(i),i.alternate===null)throw Error(r(340));ca()}return s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 13:if(xr(i),s=i.memoizedState,s!==null&&s.dehydrated!==null){if(i.alternate===null)throw Error(r(340));ca()}return s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 19:return J(dn),null;case 4:return Pe(),null;case 10:return Ls(i.type),null;case 22:case 23:return xr(i),Df(),s!==null&&J(ha),s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 24:return Ls(pn),null;case 25:return null;default:return null}}function m1(s,i){switch(xf(i),i.tag){case 3:Ls(pn),Pe();break;case 26:case 27:case 5:Et(i);break;case 4:Pe();break;case 31:i.memoizedState!==null&&xr(i);break;case 13:xr(i);break;case 19:J(dn);break;case 10:Ls(i.type);break;case 22:case 23:xr(i),Df(),s!==null&&J(ha);break;case 24:Ls(pn)}}function $o(s,i){try{var c=i.updateQueue,d=c!==null?c.lastEffect:null;if(d!==null){var g=d.next;c=g;do{if((c.tag&s)===s){d=void 0;var v=c.create,S=c.inst;d=v(),S.destroy=d}c=c.next}while(c!==g)}}catch(T){Tt(i,i.return,T)}}function Si(s,i,c){try{var d=i.updateQueue,g=d!==null?d.lastEffect:null;if(g!==null){var v=g.next;d=v;do{if((d.tag&s)===s){var S=d.inst,T=S.destroy;if(T!==void 0){S.destroy=void 0,g=i;var U=c,te=T;try{te()}catch(ce){Tt(g,U,ce)}}}d=d.next}while(d!==v)}}catch(ce){Tt(i,i.return,ce)}}function g1(s){var i=s.updateQueue;if(i!==null){var c=s.stateNode;try{a0(i,c)}catch(d){Tt(s,s.return,d)}}}function x1(s,i,c){c.props=xa(s.type,s.memoizedProps),c.state=s.memoizedState;try{c.componentWillUnmount()}catch(d){Tt(s,i,d)}}function Fo(s,i){try{var c=s.ref;if(c!==null){switch(s.tag){case 26:case 27:case 5:var d=s.stateNode;break;case 30:d=s.stateNode;break;default:d=s.stateNode}typeof c=="function"?s.refCleanup=c(d):c.current=d}}catch(g){Tt(s,i,g)}}function gs(s,i){var c=s.ref,d=s.refCleanup;if(c!==null)if(typeof d=="function")try{d()}catch(g){Tt(s,i,g)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(g){Tt(s,i,g)}else c.current=null}function v1(s){var i=s.type,c=s.memoizedProps,d=s.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":c.autoFocus&&d.focus();break e;case"img":c.src?d.src=c.src:c.srcSet&&(d.srcset=c.srcSet)}}catch(g){Tt(s,s.return,g)}}function up(s,i,c){try{var d=s.stateNode;fN(d,s.type,c,i),d[Tn]=i}catch(g){Tt(s,s.return,g)}}function b1(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&Ti(s.type)||s.tag===4}function dp(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||b1(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&Ti(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function hp(s,i,c){var d=s.tag;if(d===5||d===6)s=s.stateNode,i?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(s,i):(i=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,i.appendChild(s),c=c._reactRootContainer,c!=null||i.onclick!==null||(i.onclick=Mr));else if(d!==4&&(d===27&&Ti(s.type)&&(c=s.stateNode,i=null),s=s.child,s!==null))for(hp(s,i,c),s=s.sibling;s!==null;)hp(s,i,c),s=s.sibling}function Yu(s,i,c){var d=s.tag;if(d===5||d===6)s=s.stateNode,i?c.insertBefore(s,i):c.appendChild(s);else if(d!==4&&(d===27&&Ti(s.type)&&(c=s.stateNode),s=s.child,s!==null))for(Yu(s,i,c),s=s.sibling;s!==null;)Yu(s,i,c),s=s.sibling}function y1(s){var i=s.stateNode,c=s.memoizedProps;try{for(var d=s.type,g=i.attributes;g.length;)i.removeAttributeNode(g[0]);Rn(i,d,c),i[en]=s,i[Tn]=c}catch(v){Tt(s,s.return,v)}}var Ps=!1,xn=!1,fp=!1,_1=typeof WeakSet=="function"?WeakSet:Set,Cn=null;function Gj(s,i){if(s=s.containerInfo,Rp=pd,s=Lv(s),af(s)){if("selectionStart"in s)var c={start:s.selectionStart,end:s.selectionEnd};else e:{c=(c=s.ownerDocument)&&c.defaultView||window;var d=c.getSelection&&c.getSelection();if(d&&d.rangeCount!==0){c=d.anchorNode;var g=d.anchorOffset,v=d.focusNode;d=d.focusOffset;try{c.nodeType,v.nodeType}catch{c=null;break e}var S=0,T=-1,U=-1,te=0,ce=0,fe=s,ie=null;t:for(;;){for(var le;fe!==c||g!==0&&fe.nodeType!==3||(T=S+g),fe!==v||d!==0&&fe.nodeType!==3||(U=S+d),fe.nodeType===3&&(S+=fe.nodeValue.length),(le=fe.firstChild)!==null;)ie=fe,fe=le;for(;;){if(fe===s)break t;if(ie===c&&++te===g&&(T=S),ie===v&&++ce===d&&(U=S),(le=fe.nextSibling)!==null)break;fe=ie,ie=fe.parentNode}fe=le}c=T===-1||U===-1?null:{start:T,end:U}}else c=null}c=c||{start:0,end:0}}else c=null;for(zp={focusedElem:s,selectionRange:c},pd=!1,Cn=i;Cn!==null;)if(i=Cn,s=i.child,(i.subtreeFlags&1028)!==0&&s!==null)s.return=i,Cn=s;else for(;Cn!==null;){switch(i=Cn,v=i.alternate,s=i.flags,i.tag){case 0:if((s&4)!==0&&(s=i.updateQueue,s=s!==null?s.events:null,s!==null))for(c=0;c<s.length;c++)g=s[c],g.ref.impl=g.nextImpl;break;case 11:case 15:break;case 1:if((s&1024)!==0&&v!==null){s=void 0,c=i,g=v.memoizedProps,v=v.memoizedState,d=c.stateNode;try{var Te=xa(c.type,g);s=d.getSnapshotBeforeUpdate(Te,v),d.__reactInternalSnapshotBeforeUpdate=s}catch(Ie){Tt(c,c.return,Ie)}}break;case 3:if((s&1024)!==0){if(s=i.stateNode.containerInfo,c=s.nodeType,c===9)Pp(s);else if(c===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":Pp(s);break;default:s.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((s&1024)!==0)throw Error(r(163))}if(s=i.sibling,s!==null){s.return=i.return,Cn=s;break}Cn=i.return}}function w1(s,i,c){var d=c.flags;switch(c.tag){case 0:case 11:case 15:Fs(s,c),d&4&&$o(5,c);break;case 1:if(Fs(s,c),d&4)if(s=c.stateNode,i===null)try{s.componentDidMount()}catch(S){Tt(c,c.return,S)}else{var g=xa(c.type,i.memoizedProps);i=i.memoizedState;try{s.componentDidUpdate(g,i,s.__reactInternalSnapshotBeforeUpdate)}catch(S){Tt(c,c.return,S)}}d&64&&g1(c),d&512&&Fo(c,c.return);break;case 3:if(Fs(s,c),d&64&&(s=c.updateQueue,s!==null)){if(i=null,c.child!==null)switch(c.child.tag){case 27:case 5:i=c.child.stateNode;break;case 1:i=c.child.stateNode}try{a0(s,i)}catch(S){Tt(c,c.return,S)}}break;case 27:i===null&&d&4&&y1(c);case 26:case 5:Fs(s,c),i===null&&d&4&&v1(c),d&512&&Fo(c,c.return);break;case 12:Fs(s,c);break;case 31:Fs(s,c),d&4&&j1(s,c);break;case 13:Fs(s,c),d&4&&N1(s,c),d&64&&(s=c.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(c=tN.bind(null,c),_N(s,c))));break;case 22:if(d=c.memoizedState!==null||Ps,!d){i=i!==null&&i.memoizedState!==null||xn,g=Ps;var v=xn;Ps=d,(xn=i)&&!v?Us(s,c,(c.subtreeFlags&8772)!==0):Fs(s,c),Ps=g,xn=v}break;case 30:break;default:Fs(s,c)}}function S1(s){var i=s.alternate;i!==null&&(s.alternate=null,S1(i)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(i=s.stateNode,i!==null&&ai(i)),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}var tn=null,nr=!1;function $s(s,i,c){for(c=c.child;c!==null;)k1(s,i,c),c=c.sibling}function k1(s,i,c){if(Ct&&typeof Ct.onCommitFiberUnmount=="function")try{Ct.onCommitFiberUnmount(st,c)}catch{}switch(c.tag){case 26:xn||gs(c,i),$s(s,i,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:xn||gs(c,i);var d=tn,g=nr;Ti(c.type)&&(tn=c.stateNode,nr=!1),$s(s,i,c),Qo(c.stateNode),tn=d,nr=g;break;case 5:xn||gs(c,i);case 6:if(d=tn,g=nr,tn=null,$s(s,i,c),tn=d,nr=g,tn!==null)if(nr)try{(tn.nodeType===9?tn.body:tn.nodeName==="HTML"?tn.ownerDocument.body:tn).removeChild(c.stateNode)}catch(v){Tt(c,i,v)}else try{tn.removeChild(c.stateNode)}catch(v){Tt(c,i,v)}break;case 18:tn!==null&&(nr?(s=tn,gb(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,c.stateNode),Sl(s)):gb(tn,c.stateNode));break;case 4:d=tn,g=nr,tn=c.stateNode.containerInfo,nr=!0,$s(s,i,c),tn=d,nr=g;break;case 0:case 11:case 14:case 15:Si(2,c,i),xn||Si(4,c,i),$s(s,i,c);break;case 1:xn||(gs(c,i),d=c.stateNode,typeof d.componentWillUnmount=="function"&&x1(c,i,d)),$s(s,i,c);break;case 21:$s(s,i,c);break;case 22:xn=(d=xn)||c.memoizedState!==null,$s(s,i,c),xn=d;break;default:$s(s,i,c)}}function j1(s,i){if(i.memoizedState===null&&(s=i.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{Sl(s)}catch(c){Tt(i,i.return,c)}}}function N1(s,i){if(i.memoizedState===null&&(s=i.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{Sl(s)}catch(c){Tt(i,i.return,c)}}function Yj(s){switch(s.tag){case 31:case 13:case 19:var i=s.stateNode;return i===null&&(i=s.stateNode=new _1),i;case 22:return s=s.stateNode,i=s._retryCache,i===null&&(i=s._retryCache=new _1),i;default:throw Error(r(435,s.tag))}}function Wu(s,i){var c=Yj(s);i.forEach(function(d){if(!c.has(d)){c.add(d);var g=nN.bind(null,s,d);d.then(g,g)}})}function rr(s,i){var c=i.deletions;if(c!==null)for(var d=0;d<c.length;d++){var g=c[d],v=s,S=i,T=S;e:for(;T!==null;){switch(T.tag){case 27:if(Ti(T.type)){tn=T.stateNode,nr=!1;break e}break;case 5:tn=T.stateNode,nr=!1;break e;case 3:case 4:tn=T.stateNode.containerInfo,nr=!0;break e}T=T.return}if(tn===null)throw Error(r(160));k1(v,S,g),tn=null,nr=!1,v=g.alternate,v!==null&&(v.return=null),g.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)C1(i,s),i=i.sibling}var ts=null;function C1(s,i){var c=s.alternate,d=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:rr(i,s),sr(s),d&4&&(Si(3,s,s.return),$o(3,s),Si(5,s,s.return));break;case 1:rr(i,s),sr(s),d&512&&(xn||c===null||gs(c,c.return)),d&64&&Ps&&(s=s.updateQueue,s!==null&&(d=s.callbacks,d!==null&&(c=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=c===null?d:c.concat(d))));break;case 26:var g=ts;if(rr(i,s),sr(s),d&512&&(xn||c===null||gs(c,c.return)),d&4){var v=c!==null?c.memoizedState:null;if(d=s.memoizedState,c===null)if(d===null)if(s.stateNode===null){e:{d=s.type,c=s.memoizedProps,g=g.ownerDocument||g;t:switch(d){case"title":v=g.getElementsByTagName("title")[0],(!v||v[cs]||v[en]||v.namespaceURI==="http://www.w3.org/2000/svg"||v.hasAttribute("itemprop"))&&(v=g.createElement(d),g.head.insertBefore(v,g.querySelector("head > title"))),Rn(v,d,c),v[en]=s,nn(v),d=v;break e;case"link":var S=Cb("link","href",g).get(d+(c.href||""));if(S){for(var T=0;T<S.length;T++)if(v=S[T],v.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&v.getAttribute("rel")===(c.rel==null?null:c.rel)&&v.getAttribute("title")===(c.title==null?null:c.title)&&v.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){S.splice(T,1);break t}}v=g.createElement(d),Rn(v,d,c),g.head.appendChild(v);break;case"meta":if(S=Cb("meta","content",g).get(d+(c.content||""))){for(T=0;T<S.length;T++)if(v=S[T],v.getAttribute("content")===(c.content==null?null:""+c.content)&&v.getAttribute("name")===(c.name==null?null:c.name)&&v.getAttribute("property")===(c.property==null?null:c.property)&&v.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&v.getAttribute("charset")===(c.charSet==null?null:c.charSet)){S.splice(T,1);break t}}v=g.createElement(d),Rn(v,d,c),g.head.appendChild(v);break;default:throw Error(r(468,d))}v[en]=s,nn(v),d=v}s.stateNode=d}else Eb(g,s.type,s.stateNode);else s.stateNode=Nb(g,d,s.memoizedProps);else v!==d?(v===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):v.count--,d===null?Eb(g,s.type,s.stateNode):Nb(g,d,s.memoizedProps)):d===null&&s.stateNode!==null&&up(s,s.memoizedProps,c.memoizedProps)}break;case 27:rr(i,s),sr(s),d&512&&(xn||c===null||gs(c,c.return)),c!==null&&d&4&&up(s,s.memoizedProps,c.memoizedProps);break;case 5:if(rr(i,s),sr(s),d&512&&(xn||c===null||gs(c,c.return)),s.flags&32){g=s.stateNode;try{ci(g,"")}catch(Te){Tt(s,s.return,Te)}}d&4&&s.stateNode!=null&&(g=s.memoizedProps,up(s,g,c!==null?c.memoizedProps:g)),d&1024&&(fp=!0);break;case 6:if(rr(i,s),sr(s),d&4){if(s.stateNode===null)throw Error(r(162));d=s.memoizedProps,c=s.stateNode;try{c.nodeValue=d}catch(Te){Tt(s,s.return,Te)}}break;case 3:if(ud=null,g=ts,ts=od(i.containerInfo),rr(i,s),ts=g,sr(s),d&4&&c!==null&&c.memoizedState.isDehydrated)try{Sl(i.containerInfo)}catch(Te){Tt(s,s.return,Te)}fp&&(fp=!1,E1(s));break;case 4:d=ts,ts=od(s.stateNode.containerInfo),rr(i,s),sr(s),ts=d;break;case 12:rr(i,s),sr(s);break;case 31:rr(i,s),sr(s),d&4&&(d=s.updateQueue,d!==null&&(s.updateQueue=null,Wu(s,d)));break;case 13:rr(i,s),sr(s),s.child.flags&8192&&s.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(Xu=Ae()),d&4&&(d=s.updateQueue,d!==null&&(s.updateQueue=null,Wu(s,d)));break;case 22:g=s.memoizedState!==null;var U=c!==null&&c.memoizedState!==null,te=Ps,ce=xn;if(Ps=te||g,xn=ce||U,rr(i,s),xn=ce,Ps=te,sr(s),d&8192)e:for(i=s.stateNode,i._visibility=g?i._visibility&-2:i._visibility|1,g&&(c===null||U||Ps||xn||va(s)),c=null,i=s;;){if(i.tag===5||i.tag===26){if(c===null){U=c=i;try{if(v=U.stateNode,g)S=v.style,typeof S.setProperty=="function"?S.setProperty("display","none","important"):S.display="none";else{T=U.stateNode;var fe=U.memoizedProps.style,ie=fe!=null&&fe.hasOwnProperty("display")?fe.display:null;T.style.display=ie==null||typeof ie=="boolean"?"":(""+ie).trim()}}catch(Te){Tt(U,U.return,Te)}}}else if(i.tag===6){if(c===null){U=i;try{U.stateNode.nodeValue=g?"":U.memoizedProps}catch(Te){Tt(U,U.return,Te)}}}else if(i.tag===18){if(c===null){U=i;try{var le=U.stateNode;g?xb(le,!0):xb(U.stateNode,!1)}catch(Te){Tt(U,U.return,Te)}}}else if((i.tag!==22&&i.tag!==23||i.memoizedState===null||i===s)&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===s)break e;for(;i.sibling===null;){if(i.return===null||i.return===s)break e;c===i&&(c=null),i=i.return}c===i&&(c=null),i.sibling.return=i.return,i=i.sibling}d&4&&(d=s.updateQueue,d!==null&&(c=d.retryQueue,c!==null&&(d.retryQueue=null,Wu(s,c))));break;case 19:rr(i,s),sr(s),d&4&&(d=s.updateQueue,d!==null&&(s.updateQueue=null,Wu(s,d)));break;case 30:break;case 21:break;default:rr(i,s),sr(s)}}function sr(s){var i=s.flags;if(i&2){try{for(var c,d=s.return;d!==null;){if(b1(d)){c=d;break}d=d.return}if(c==null)throw Error(r(160));switch(c.tag){case 27:var g=c.stateNode,v=dp(s);Yu(s,v,g);break;case 5:var S=c.stateNode;c.flags&32&&(ci(S,""),c.flags&=-33);var T=dp(s);Yu(s,T,S);break;case 3:case 4:var U=c.stateNode.containerInfo,te=dp(s);hp(s,te,U);break;default:throw Error(r(161))}}catch(ce){Tt(s,s.return,ce)}s.flags&=-3}i&4096&&(s.flags&=-4097)}function E1(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var i=s;E1(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),s=s.sibling}}function Fs(s,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)w1(s,i.alternate,i),i=i.sibling}function va(s){for(s=s.child;s!==null;){var i=s;switch(i.tag){case 0:case 11:case 14:case 15:Si(4,i,i.return),va(i);break;case 1:gs(i,i.return);var c=i.stateNode;typeof c.componentWillUnmount=="function"&&x1(i,i.return,c),va(i);break;case 27:Qo(i.stateNode);case 26:case 5:gs(i,i.return),va(i);break;case 22:i.memoizedState===null&&va(i);break;case 30:va(i);break;default:va(i)}s=s.sibling}}function Us(s,i,c){for(c=c&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var d=i.alternate,g=s,v=i,S=v.flags;switch(v.tag){case 0:case 11:case 15:Us(g,v,c),$o(4,v);break;case 1:if(Us(g,v,c),d=v,g=d.stateNode,typeof g.componentDidMount=="function")try{g.componentDidMount()}catch(te){Tt(d,d.return,te)}if(d=v,g=d.updateQueue,g!==null){var T=d.stateNode;try{var U=g.shared.hiddenCallbacks;if(U!==null)for(g.shared.hiddenCallbacks=null,g=0;g<U.length;g++)i0(U[g],T)}catch(te){Tt(d,d.return,te)}}c&&S&64&&g1(v),Fo(v,v.return);break;case 27:y1(v);case 26:case 5:Us(g,v,c),c&&d===null&&S&4&&v1(v),Fo(v,v.return);break;case 12:Us(g,v,c);break;case 31:Us(g,v,c),c&&S&4&&j1(g,v);break;case 13:Us(g,v,c),c&&S&4&&N1(g,v);break;case 22:v.memoizedState===null&&Us(g,v,c),Fo(v,v.return);break;case 30:break;default:Us(g,v,c)}i=i.sibling}}function pp(s,i){var c=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(c=s.memoizedState.cachePool.pool),s=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(s=i.memoizedState.cachePool.pool),s!==c&&(s!=null&&s.refCount++,c!=null&&No(c))}function mp(s,i){s=null,i.alternate!==null&&(s=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==s&&(i.refCount++,s!=null&&No(s))}function ns(s,i,c,d){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)A1(s,i,c,d),i=i.sibling}function A1(s,i,c,d){var g=i.flags;switch(i.tag){case 0:case 11:case 15:ns(s,i,c,d),g&2048&&$o(9,i);break;case 1:ns(s,i,c,d);break;case 3:ns(s,i,c,d),g&2048&&(s=null,i.alternate!==null&&(s=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==s&&(i.refCount++,s!=null&&No(s)));break;case 12:if(g&2048){ns(s,i,c,d),s=i.stateNode;try{var v=i.memoizedProps,S=v.id,T=v.onPostCommit;typeof T=="function"&&T(S,i.alternate===null?"mount":"update",s.passiveEffectDuration,-0)}catch(U){Tt(i,i.return,U)}}else ns(s,i,c,d);break;case 31:ns(s,i,c,d);break;case 13:ns(s,i,c,d);break;case 23:break;case 22:v=i.stateNode,S=i.alternate,i.memoizedState!==null?v._visibility&2?ns(s,i,c,d):Uo(s,i):v._visibility&2?ns(s,i,c,d):(v._visibility|=2,hl(s,i,c,d,(i.subtreeFlags&10256)!==0||!1)),g&2048&&pp(S,i);break;case 24:ns(s,i,c,d),g&2048&&mp(i.alternate,i);break;default:ns(s,i,c,d)}}function hl(s,i,c,d,g){for(g=g&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var v=s,S=i,T=c,U=d,te=S.flags;switch(S.tag){case 0:case 11:case 15:hl(v,S,T,U,g),$o(8,S);break;case 23:break;case 22:var ce=S.stateNode;S.memoizedState!==null?ce._visibility&2?hl(v,S,T,U,g):Uo(v,S):(ce._visibility|=2,hl(v,S,T,U,g)),g&&te&2048&&pp(S.alternate,S);break;case 24:hl(v,S,T,U,g),g&&te&2048&&mp(S.alternate,S);break;default:hl(v,S,T,U,g)}i=i.sibling}}function Uo(s,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var c=s,d=i,g=d.flags;switch(d.tag){case 22:Uo(c,d),g&2048&&pp(d.alternate,d);break;case 24:Uo(c,d),g&2048&&mp(d.alternate,d);break;default:Uo(c,d)}i=i.sibling}}var Io=8192;function fl(s,i,c){if(s.subtreeFlags&Io)for(s=s.child;s!==null;)T1(s,i,c),s=s.sibling}function T1(s,i,c){switch(s.tag){case 26:fl(s,i,c),s.flags&Io&&s.memoizedState!==null&&LN(c,ts,s.memoizedState,s.memoizedProps);break;case 5:fl(s,i,c);break;case 3:case 4:var d=ts;ts=od(s.stateNode.containerInfo),fl(s,i,c),ts=d;break;case 22:s.memoizedState===null&&(d=s.alternate,d!==null&&d.memoizedState!==null?(d=Io,Io=16777216,fl(s,i,c),Io=d):fl(s,i,c));break;default:fl(s,i,c)}}function M1(s){var i=s.alternate;if(i!==null&&(s=i.child,s!==null)){i.child=null;do i=s.sibling,s.sibling=null,s=i;while(s!==null)}}function Ho(s){var i=s.deletions;if((s.flags&16)!==0){if(i!==null)for(var c=0;c<i.length;c++){var d=i[c];Cn=d,L1(d,s)}M1(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)D1(s),s=s.sibling}function D1(s){switch(s.tag){case 0:case 11:case 15:Ho(s),s.flags&2048&&Si(9,s,s.return);break;case 3:Ho(s);break;case 12:Ho(s);break;case 22:var i=s.stateNode;s.memoizedState!==null&&i._visibility&2&&(s.return===null||s.return.tag!==13)?(i._visibility&=-3,Qu(s)):Ho(s);break;default:Ho(s)}}function Qu(s){var i=s.deletions;if((s.flags&16)!==0){if(i!==null)for(var c=0;c<i.length;c++){var d=i[c];Cn=d,L1(d,s)}M1(s)}for(s=s.child;s!==null;){switch(i=s,i.tag){case 0:case 11:case 15:Si(8,i,i.return),Qu(i);break;case 22:c=i.stateNode,c._visibility&2&&(c._visibility&=-3,Qu(i));break;default:Qu(i)}s=s.sibling}}function L1(s,i){for(;Cn!==null;){var c=Cn;switch(c.tag){case 0:case 11:case 15:Si(8,c,i);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var d=c.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:No(c.memoizedState.cache)}if(d=c.child,d!==null)d.return=c,Cn=d;else e:for(c=s;Cn!==null;){d=Cn;var g=d.sibling,v=d.return;if(S1(d),d===c){Cn=null;break e}if(g!==null){g.return=v,Cn=g;break e}Cn=v}}}var Wj={getCacheForType:function(s){var i=Dn(pn),c=i.data.get(s);return c===void 0&&(c=s(),i.data.set(s,c)),c},cacheSignal:function(){return Dn(pn).controller.signal}},Qj=typeof WeakMap=="function"?WeakMap:Map,Nt=0,Ft=null,lt=null,ht=0,At=0,vr=null,ki=!1,pl=!1,gp=!1,Is=0,on=0,ji=0,ba=0,xp=0,br=0,ml=0,qo=null,ir=null,vp=!1,Xu=0,R1=0,Ku=1/0,Zu=null,Ni=null,jn=0,Ci=null,gl=null,Hs=0,bp=0,yp=null,z1=null,Vo=0,_p=null;function yr(){return(Nt&2)!==0&&ht!==0?ht&-ht:B.T!==null?Cp():oo()}function O1(){if(br===0)if((ht&536870912)===0||gt){var s=Kr;Kr<<=1,(Kr&3932160)===0&&(Kr=262144),br=s}else br=536870912;return s=gr.current,s!==null&&(s.flags|=32),br}function ar(s,i,c){(s===Ft&&(At===2||At===9)||s.cancelPendingCommit!==null)&&(xl(s,0),Ei(s,ht,br,!1)),qt(s,c),((Nt&2)===0||s!==Ft)&&(s===Ft&&((Nt&2)===0&&(ba|=c),on===4&&Ei(s,ht,br,!1)),xs(s))}function B1(s,i,c){if((Nt&6)!==0)throw Error(r(327));var d=!c&&(i&127)===0&&(i&s.expiredLanes)===0||Xe(s,i),g=d?Zj(s,i):Sp(s,i,!0),v=d;do{if(g===0){pl&&!d&&Ei(s,i,0,!1);break}else{if(c=s.current.alternate,v&&!Xj(c)){g=Sp(s,i,!1),v=!1;continue}if(g===2){if(v=i,s.errorRecoveryDisabledLanes&v)var S=0;else S=s.pendingLanes&-536870913,S=S!==0?S:S&536870912?536870912:0;if(S!==0){i=S;e:{var T=s;g=qo;var U=T.current.memoizedState.isDehydrated;if(U&&(xl(T,S).flags|=256),S=Sp(T,S,!1),S!==2){if(gp&&!U){T.errorRecoveryDisabledLanes|=v,ba|=v,g=4;break e}v=ir,ir=g,v!==null&&(ir===null?ir=v:ir.push.apply(ir,v))}g=S}if(v=!1,g!==2)continue}}if(g===1){xl(s,0),Ei(s,i,0,!0);break}e:{switch(d=s,v=g,v){case 0:case 1:throw Error(r(345));case 4:if((i&4194048)!==i)break;case 6:Ei(d,i,br,!ki);break e;case 2:ir=null;break;case 3:case 5:break;default:throw Error(r(329))}if((i&62914560)===i&&(g=Xu+300-Ae(),10<g)){if(Ei(d,i,br,!ki),ye(d,0,!0)!==0)break e;Hs=i,d.timeoutHandle=pb(P1.bind(null,d,c,ir,Zu,vp,i,br,ba,ml,ki,v,"Throttled",-0,0),g);break e}P1(d,c,ir,Zu,vp,i,br,ba,ml,ki,v,null,-0,0)}}break}while(!0);xs(s)}function P1(s,i,c,d,g,v,S,T,U,te,ce,fe,ie,le){if(s.timeoutHandle=-1,fe=i.subtreeFlags,fe&8192||(fe&16785408)===16785408){fe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Mr},T1(i,v,fe);var Te=(v&62914560)===v?Xu-Ae():(v&4194048)===v?R1-Ae():0;if(Te=RN(fe,Te),Te!==null){Hs=v,s.cancelPendingCommit=Te(G1.bind(null,s,i,v,c,d,g,S,T,U,ce,fe,null,ie,le)),Ei(s,v,S,!te);return}}G1(s,i,v,c,d,g,S,T,U)}function Xj(s){for(var i=s;;){var c=i.tag;if((c===0||c===11||c===15)&&i.flags&16384&&(c=i.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var d=0;d<c.length;d++){var g=c[d],v=g.getSnapshot;g=g.value;try{if(!pr(v(),g))return!1}catch{return!1}}if(c=i.child,i.subtreeFlags&16384&&c!==null)c.return=i,i=c;else{if(i===s)break;for(;i.sibling===null;){if(i.return===null||i.return===s)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function Ei(s,i,c,d){i&=~xp,i&=~ba,s.suspendedLanes|=i,s.pingedLanes&=~i,d&&(s.warmLanes|=i),d=s.expirationTimes;for(var g=i;0<g;){var v=31-tt(g),S=1<<v;d[v]=-1,g&=~S}c!==0&&Er(s,c,i)}function Ju(){return(Nt&6)===0?(Go(0),!1):!0}function wp(){if(lt!==null){if(At===0)var s=lt.return;else s=lt,Ds=ua=null,Pf(s),ll=null,Eo=0,s=lt;for(;s!==null;)m1(s.alternate,s),s=s.return;lt=null}}function xl(s,i){var c=s.timeoutHandle;c!==-1&&(s.timeoutHandle=-1,gN(c)),c=s.cancelPendingCommit,c!==null&&(s.cancelPendingCommit=null,c()),Hs=0,wp(),Ft=s,lt=c=Ts(s.current,null),ht=i,At=0,vr=null,ki=!1,pl=Xe(s,i),gp=!1,ml=br=xp=ba=ji=on=0,ir=qo=null,vp=!1,(i&8)!==0&&(i|=i&32);var d=s.entangledLanes;if(d!==0)for(s=s.entanglements,d&=i;0<d;){var g=31-tt(d),v=1<<g;i|=s[g],d&=~v}return Is=i,yu(),c}function $1(s,i){Ze=null,B.H=Oo,i===al||i===Eu?(i=t0(),At=3):i===Nf?(i=t0(),At=4):At=i===ep?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,vr=i,lt===null&&(on=1,Iu(s,zr(i,s.current)))}function F1(){var s=gr.current;return s===null?!0:(ht&4194048)===ht?$r===null:(ht&62914560)===ht||(ht&536870912)!==0?s===$r:!1}function U1(){var s=B.H;return B.H=Oo,s===null?Oo:s}function I1(){var s=B.A;return B.A=Wj,s}function ed(){on=4,ki||(ht&4194048)!==ht&&gr.current!==null||(pl=!0),(ji&134217727)===0&&(ba&134217727)===0||Ft===null||Ei(Ft,ht,br,!1)}function Sp(s,i,c){var d=Nt;Nt|=2;var g=U1(),v=I1();(Ft!==s||ht!==i)&&(Zu=null,xl(s,i)),i=!1;var S=on;e:do try{if(At!==0&&lt!==null){var T=lt,U=vr;switch(At){case 8:wp(),S=6;break e;case 3:case 2:case 9:case 6:gr.current===null&&(i=!0);var te=At;if(At=0,vr=null,vl(s,T,U,te),c&&pl){S=0;break e}break;default:te=At,At=0,vr=null,vl(s,T,U,te)}}Kj(),S=on;break}catch(ce){$1(s,ce)}while(!0);return i&&s.shellSuspendCounter++,Ds=ua=null,Nt=d,B.H=g,B.A=v,lt===null&&(Ft=null,ht=0,yu()),S}function Kj(){for(;lt!==null;)H1(lt)}function Zj(s,i){var c=Nt;Nt|=2;var d=U1(),g=I1();Ft!==s||ht!==i?(Zu=null,Ku=Ae()+500,xl(s,i)):pl=Xe(s,i);e:do try{if(At!==0&&lt!==null){i=lt;var v=vr;t:switch(At){case 1:At=0,vr=null,vl(s,i,v,1);break;case 2:case 9:if(Jv(v)){At=0,vr=null,q1(i);break}i=function(){At!==2&&At!==9||Ft!==s||(At=7),xs(s)},v.then(i,i);break e;case 3:At=7;break e;case 4:At=5;break e;case 7:Jv(v)?(At=0,vr=null,q1(i)):(At=0,vr=null,vl(s,i,v,7));break;case 5:var S=null;switch(lt.tag){case 26:S=lt.memoizedState;case 5:case 27:var T=lt;if(S?Ab(S):T.stateNode.complete){At=0,vr=null;var U=T.sibling;if(U!==null)lt=U;else{var te=T.return;te!==null?(lt=te,td(te)):lt=null}break t}}At=0,vr=null,vl(s,i,v,5);break;case 6:At=0,vr=null,vl(s,i,v,6);break;case 8:wp(),on=6;break e;default:throw Error(r(462))}}Jj();break}catch(ce){$1(s,ce)}while(!0);return Ds=ua=null,B.H=d,B.A=g,Nt=c,lt!==null?0:(Ft=null,ht=0,yu(),on)}function Jj(){for(;lt!==null&&!Oe();)H1(lt)}function H1(s){var i=f1(s.alternate,s,Is);s.memoizedProps=s.pendingProps,i===null?td(s):lt=i}function q1(s){var i=s,c=i.alternate;switch(i.tag){case 15:case 0:i=l1(c,i,i.pendingProps,i.type,void 0,ht);break;case 11:i=l1(c,i,i.pendingProps,i.type.render,i.ref,ht);break;case 5:Pf(i);default:m1(c,i),i=lt=Iv(i,Is),i=f1(c,i,Is)}s.memoizedProps=s.pendingProps,i===null?td(s):lt=i}function vl(s,i,c,d){Ds=ua=null,Pf(i),ll=null,Eo=0;var g=i.return;try{if(Uj(s,g,i,c,ht)){on=1,Iu(s,zr(c,s.current)),lt=null;return}}catch(v){if(g!==null)throw lt=g,v;on=1,Iu(s,zr(c,s.current)),lt=null;return}i.flags&32768?(gt||d===1?s=!0:pl||(ht&536870912)!==0?s=!1:(ki=s=!0,(d===2||d===9||d===3||d===6)&&(d=gr.current,d!==null&&d.tag===13&&(d.flags|=16384))),V1(i,s)):td(i)}function td(s){var i=s;do{if((i.flags&32768)!==0){V1(i,ki);return}s=i.return;var c=qj(i.alternate,i,Is);if(c!==null){lt=c;return}if(i=i.sibling,i!==null){lt=i;return}lt=i=s}while(i!==null);on===0&&(on=5)}function V1(s,i){do{var c=Vj(s.alternate,s);if(c!==null){c.flags&=32767,lt=c;return}if(c=s.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!i&&(s=s.sibling,s!==null)){lt=s;return}lt=s=c}while(s!==null);on=6,lt=null}function G1(s,i,c,d,g,v,S,T,U){s.cancelPendingCommit=null;do nd();while(jn!==0);if((Nt&6)!==0)throw Error(r(327));if(i!==null){if(i===s.current)throw Error(r(177));if(v=i.lanes|i.childLanes,v|=df,Gn(s,c,v,S,T,U),s===Ft&&(lt=Ft=null,ht=0),gl=i,Ci=s,Hs=c,bp=v,yp=g,z1=d,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,rN(Q,function(){return K1(),null})):(s.callbackNode=null,s.callbackPriority=0),d=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||d){d=B.T,B.T=null,g=$.p,$.p=2,S=Nt,Nt|=4;try{Gj(s,i,c)}finally{Nt=S,$.p=g,B.T=d}}jn=1,Y1(),W1(),Q1()}}function Y1(){if(jn===1){jn=0;var s=Ci,i=gl,c=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||c){c=B.T,B.T=null;var d=$.p;$.p=2;var g=Nt;Nt|=4;try{C1(i,s);var v=zp,S=Lv(s.containerInfo),T=v.focusedElem,U=v.selectionRange;if(S!==T&&T&&T.ownerDocument&&Dv(T.ownerDocument.documentElement,T)){if(U!==null&&af(T)){var te=U.start,ce=U.end;if(ce===void 0&&(ce=te),"selectionStart"in T)T.selectionStart=te,T.selectionEnd=Math.min(ce,T.value.length);else{var fe=T.ownerDocument||document,ie=fe&&fe.defaultView||window;if(ie.getSelection){var le=ie.getSelection(),Te=T.textContent.length,Ie=Math.min(U.start,Te),Ot=U.end===void 0?Ie:Math.min(U.end,Te);!le.extend&&Ie>Ot&&(S=Ot,Ot=Ie,Ie=S);var K=Mv(T,Ie),V=Mv(T,Ot);if(K&&V&&(le.rangeCount!==1||le.anchorNode!==K.node||le.anchorOffset!==K.offset||le.focusNode!==V.node||le.focusOffset!==V.offset)){var ee=fe.createRange();ee.setStart(K.node,K.offset),le.removeAllRanges(),Ie>Ot?(le.addRange(ee),le.extend(V.node,V.offset)):(ee.setEnd(V.node,V.offset),le.addRange(ee))}}}}for(fe=[],le=T;le=le.parentNode;)le.nodeType===1&&fe.push({element:le,left:le.scrollLeft,top:le.scrollTop});for(typeof T.focus=="function"&&T.focus(),T=0;T<fe.length;T++){var he=fe[T];he.element.scrollLeft=he.left,he.element.scrollTop=he.top}}pd=!!Rp,zp=Rp=null}finally{Nt=g,$.p=d,B.T=c}}s.current=i,jn=2}}function W1(){if(jn===2){jn=0;var s=Ci,i=gl,c=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||c){c=B.T,B.T=null;var d=$.p;$.p=2;var g=Nt;Nt|=4;try{w1(s,i.alternate,i)}finally{Nt=g,$.p=d,B.T=c}}jn=3}}function Q1(){if(jn===4||jn===3){jn=0,xt();var s=Ci,i=gl,c=Hs,d=z1;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?jn=5:(jn=0,gl=Ci=null,X1(s,s.pendingLanes));var g=s.pendingLanes;if(g===0&&(Ni=null),Xi(c),i=i.stateNode,Ct&&typeof Ct.onCommitFiberRoot=="function")try{Ct.onCommitFiberRoot(st,i,void 0,(i.current.flags&128)===128)}catch{}if(d!==null){i=B.T,g=$.p,$.p=2,B.T=null;try{for(var v=s.onRecoverableError,S=0;S<d.length;S++){var T=d[S];v(T.value,{componentStack:T.stack})}}finally{B.T=i,$.p=g}}(Hs&3)!==0&&nd(),xs(s),g=s.pendingLanes,(c&261930)!==0&&(g&42)!==0?s===_p?Vo++:(Vo=0,_p=s):Vo=0,Go(0)}}function X1(s,i){(s.pooledCacheLanes&=i)===0&&(i=s.pooledCache,i!=null&&(s.pooledCache=null,No(i)))}function nd(){return Y1(),W1(),Q1(),K1()}function K1(){if(jn!==5)return!1;var s=Ci,i=bp;bp=0;var c=Xi(Hs),d=B.T,g=$.p;try{$.p=32>c?32:c,B.T=null,c=yp,yp=null;var v=Ci,S=Hs;if(jn=0,gl=Ci=null,Hs=0,(Nt&6)!==0)throw Error(r(331));var T=Nt;if(Nt|=4,D1(v.current),A1(v,v.current,S,c),Nt=T,Go(0,!1),Ct&&typeof Ct.onPostCommitFiberRoot=="function")try{Ct.onPostCommitFiberRoot(st,v)}catch{}return!0}finally{$.p=g,B.T=d,X1(s,i)}}function Z1(s,i,c){i=zr(c,i),i=Jf(s.stateNode,i,2),s=yi(s,i,2),s!==null&&(qt(s,2),xs(s))}function Tt(s,i,c){if(s.tag===3)Z1(s,s,c);else for(;i!==null;){if(i.tag===3){Z1(i,s,c);break}else if(i.tag===1){var d=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(Ni===null||!Ni.has(d))){s=zr(c,s),c=J0(2),d=yi(i,c,2),d!==null&&(e1(c,d,i,s),qt(d,2),xs(d));break}}i=i.return}}function kp(s,i,c){var d=s.pingCache;if(d===null){d=s.pingCache=new Qj;var g=new Set;d.set(i,g)}else g=d.get(i),g===void 0&&(g=new Set,d.set(i,g));g.has(c)||(gp=!0,g.add(c),s=eN.bind(null,s,i,c),i.then(s,s))}function eN(s,i,c){var d=s.pingCache;d!==null&&d.delete(i),s.pingedLanes|=s.suspendedLanes&c,s.warmLanes&=~c,Ft===s&&(ht&c)===c&&(on===4||on===3&&(ht&62914560)===ht&&300>Ae()-Xu?(Nt&2)===0&&xl(s,0):xp|=c,ml===ht&&(ml=0)),xs(s)}function J1(s,i){i===0&&(i=fn()),s=la(s,i),s!==null&&(qt(s,i),xs(s))}function tN(s){var i=s.memoizedState,c=0;i!==null&&(c=i.retryLane),J1(s,c)}function nN(s,i){var c=0;switch(s.tag){case 31:case 13:var d=s.stateNode,g=s.memoizedState;g!==null&&(c=g.retryLane);break;case 19:d=s.stateNode;break;case 22:d=s.stateNode._retryCache;break;default:throw Error(r(314))}d!==null&&d.delete(i),J1(s,c)}function rN(s,i){return _n(s,i)}var rd=null,bl=null,jp=!1,sd=!1,Np=!1,Ai=0;function xs(s){s!==bl&&s.next===null&&(bl===null?rd=bl=s:bl=bl.next=s),sd=!0,jp||(jp=!0,iN())}function Go(s,i){if(!Np&&sd){Np=!0;do for(var c=!1,d=rd;d!==null;){if(s!==0){var g=d.pendingLanes;if(g===0)var v=0;else{var S=d.suspendedLanes,T=d.pingedLanes;v=(1<<31-tt(42|s)+1)-1,v&=g&~(S&~T),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(c=!0,rb(d,v))}else v=ht,v=ye(d,d===Ft?v:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(v&3)===0||Xe(d,v)||(c=!0,rb(d,v));d=d.next}while(c);Np=!1}}function sN(){eb()}function eb(){sd=jp=!1;var s=0;Ai!==0&&mN()&&(s=Ai);for(var i=Ae(),c=null,d=rd;d!==null;){var g=d.next,v=tb(d,i);v===0?(d.next=null,c===null?rd=g:c.next=g,g===null&&(bl=c)):(c=d,(s!==0||(v&3)!==0)&&(sd=!0)),d=g}jn!==0&&jn!==5||Go(s),Ai!==0&&(Ai=0)}function tb(s,i){for(var c=s.suspendedLanes,d=s.pingedLanes,g=s.expirationTimes,v=s.pendingLanes&-62914561;0<v;){var S=31-tt(v),T=1<<S,U=g[S];U===-1?((T&c)===0||(T&d)!==0)&&(g[S]=Ht(T,i)):U<=i&&(s.expiredLanes|=T),v&=~T}if(i=Ft,c=ht,c=ye(s,s===i?c:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),d=s.callbackNode,c===0||s===i&&(At===2||At===9)||s.cancelPendingCommit!==null)return d!==null&&d!==null&&je(d),s.callbackNode=null,s.callbackPriority=0;if((c&3)===0||Xe(s,c)){if(i=c&-c,i===s.callbackPriority)return i;switch(d!==null&&je(d),Xi(c)){case 2:case 8:c=Se;break;case 32:c=Q;break;case 268435456:c=Le;break;default:c=Q}return d=nb.bind(null,s),c=_n(c,d),s.callbackPriority=i,s.callbackNode=c,i}return d!==null&&d!==null&&je(d),s.callbackPriority=2,s.callbackNode=null,2}function nb(s,i){if(jn!==0&&jn!==5)return s.callbackNode=null,s.callbackPriority=0,null;var c=s.callbackNode;if(nd()&&s.callbackNode!==c)return null;var d=ht;return d=ye(s,s===Ft?d:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),d===0?null:(B1(s,d,i),tb(s,Ae()),s.callbackNode!=null&&s.callbackNode===c?nb.bind(null,s):null)}function rb(s,i){if(nd())return null;B1(s,i,!0)}function iN(){xN(function(){(Nt&6)!==0?_n(oe,sN):eb()})}function Cp(){if(Ai===0){var s=sl;s===0&&(s=Xr,Xr<<=1,(Xr&261888)===0&&(Xr=256)),Ai=s}return Ai}function sb(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:Va(""+s)}function ib(s,i){var c=i.ownerDocument.createElement("input");return c.name=i.name,c.value=i.value,s.id&&c.setAttribute("form",s.id),i.parentNode.insertBefore(c,i),s=new FormData(s),c.parentNode.removeChild(c),s}function aN(s,i,c,d,g){if(i==="submit"&&c&&c.stateNode===g){var v=sb((g[Tn]||null).action),S=d.submitter;S&&(i=(i=S[Tn]||null)?sb(i.formAction):S.getAttribute("formAction"),i!==null&&(v=i,S=null));var T=new As("action","action",null,d,g);s.push({event:T,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(Ai!==0){var U=S?ib(g,S):new FormData(g);Yf(c,{pending:!0,data:U,method:g.method,action:v},null,U)}}else typeof v=="function"&&(T.preventDefault(),U=S?ib(g,S):new FormData(g),Yf(c,{pending:!0,data:U,method:g.method,action:v},v,U))},currentTarget:g}]})}}for(var Ep=0;Ep<uf.length;Ep++){var Ap=uf[Ep],lN=Ap.toLowerCase(),oN=Ap[0].toUpperCase()+Ap.slice(1);es(lN,"on"+oN)}es(Ov,"onAnimationEnd"),es(Bv,"onAnimationIteration"),es(Pv,"onAnimationStart"),es("dblclick","onDoubleClick"),es("focusin","onFocus"),es("focusout","onBlur"),es(kj,"onTransitionRun"),es(jj,"onTransitionStart"),es(Nj,"onTransitionCancel"),es($v,"onTransitionEnd"),ds("onMouseEnter",["mouseout","mouseover"]),ds("onMouseLeave",["mouseout","mouseover"]),ds("onPointerEnter",["pointerout","pointerover"]),ds("onPointerLeave",["pointerout","pointerover"]),Zr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Zr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Zr("onBeforeInput",["compositionend","keypress","textInput","paste"]),Zr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Zr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Zr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Yo="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(" "),cN=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Yo));function ab(s,i){i=(i&4)!==0;for(var c=0;c<s.length;c++){var d=s[c],g=d.event;d=d.listeners;e:{var v=void 0;if(i)for(var S=d.length-1;0<=S;S--){var T=d[S],U=T.instance,te=T.currentTarget;if(T=T.listener,U!==v&&g.isPropagationStopped())break e;v=T,g.currentTarget=te;try{v(g)}catch(ce){bu(ce)}g.currentTarget=null,v=U}else for(S=0;S<d.length;S++){if(T=d[S],U=T.instance,te=T.currentTarget,T=T.listener,U!==v&&g.isPropagationStopped())break e;v=T,g.currentTarget=te;try{v(g)}catch(ce){bu(ce)}g.currentTarget=null,v=U}}}}function ot(s,i){var c=i[uo];c===void 0&&(c=i[uo]=new Set);var d=s+"__bubble";c.has(d)||(lb(i,s,2,!1),c.add(d))}function Tp(s,i,c){var d=0;i&&(d|=4),lb(c,s,d,i)}var id="_reactListening"+Math.random().toString(36).slice(2);function Mp(s){if(!s[id]){s[id]=!0,er.forEach(function(c){c!=="selectionchange"&&(cN.has(c)||Tp(c,!1,s),Tp(c,!0,s))});var i=s.nodeType===9?s:s.ownerDocument;i===null||i[id]||(i[id]=!0,Tp("selectionchange",!1,i))}}function lb(s,i,c,d){switch(Ob(i)){case 2:var g=BN;break;case 8:g=PN;break;default:g=Gp}c=g.bind(null,i,c,s),g=void 0,!Ya||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(g=!0),d?g!==void 0?s.addEventListener(i,c,{capture:!0,passive:g}):s.addEventListener(i,c,!0):g!==void 0?s.addEventListener(i,c,{passive:g}):s.addEventListener(i,c,!1)}function Dp(s,i,c,d,g){var v=d;if((i&1)===0&&(i&2)===0&&d!==null)e:for(;;){if(d===null)return;var S=d.tag;if(S===3||S===4){var T=d.stateNode.containerInfo;if(T===g)break;if(S===4)for(S=d.return;S!==null;){var U=S.tag;if((U===3||U===4)&&S.stateNode.containerInfo===g)return;S=S.return}for(;T!==null;){if(S=Es(T),S===null)return;if(U=S.tag,U===5||U===6||U===26||U===27){d=v=S;continue e}T=T.parentNode}}d=d.return}du(function(){var te=v,ce=Ga(c),fe=[];e:{var ie=Fv.get(s);if(ie!==void 0){var le=As,Te=s;switch(s){case"keypress":if(it(c)===0)break e;case"keydown":case"keyup":le=nj;break;case"focusin":Te="focus",le=fs;break;case"focusout":Te="blur",le=fs;break;case"beforeblur":case"afterblur":le=fs;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":le=ef;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":le=pu;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":le=ij;break;case Ov:case Bv:case Pv:le=xu;break;case $v:le=lj;break;case"scroll":case"scrollend":le=hu;break;case"wheel":le=cj;break;case"copy":case"cut":case"paste":le=Qk;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":le=xv;break;case"toggle":case"beforetoggle":le=dj}var Ie=(i&4)!==0,Ot=!Ie&&(s==="scroll"||s==="scrollend"),K=Ie?ie!==null?ie+"Capture":null:ie;Ie=[];for(var V=te,ee;V!==null;){var he=V;if(ee=he.stateNode,he=he.tag,he!==5&&he!==26&&he!==27||ee===null||K===null||(he=na(V,K),he!=null&&Ie.push(Wo(V,he,ee))),Ot)break;V=V.return}0<Ie.length&&(ie=new le(ie,Te,null,c,ce),fe.push({event:ie,listeners:Ie}))}}if((i&7)===0){e:{if(ie=s==="mouseover"||s==="pointerover",le=s==="mouseout"||s==="pointerout",ie&&c!==ui&&(Te=c.relatedTarget||c.fromElement)&&(Es(Te)||Te[fr]))break e;if((le||ie)&&(ie=ce.window===ce?ce:(ie=ce.ownerDocument)?ie.defaultView||ie.parentWindow:window,le?(Te=c.relatedTarget||c.toElement,le=te,Te=Te?Es(Te):null,Te!==null&&(Ot=o(Te),Ie=Te.tag,Te!==Ot||Ie!==5&&Ie!==27&&Ie!==6)&&(Te=null)):(le=null,Te=te),le!==Te)){if(Ie=ef,he="onMouseLeave",K="onMouseEnter",V="mouse",(s==="pointerout"||s==="pointerover")&&(Ie=xv,he="onPointerLeave",K="onPointerEnter",V="pointer"),Ot=le==null?ie:Ji(le),ee=Te==null?ie:Ji(Te),ie=new Ie(he,V+"leave",le,c,ce),ie.target=Ot,ie.relatedTarget=ee,he=null,Es(ce)===te&&(Ie=new Ie(K,V+"enter",Te,c,ce),Ie.target=ee,Ie.relatedTarget=Ot,he=Ie),Ot=he,le&&Te)t:{for(Ie=uN,K=le,V=Te,ee=0,he=K;he;he=Ie(he))ee++;he=0;for(var $e=V;$e;$e=Ie($e))he++;for(;0<ee-he;)K=Ie(K),ee--;for(;0<he-ee;)V=Ie(V),he--;for(;ee--;){if(K===V||V!==null&&K===V.alternate){Ie=K;break t}K=Ie(K),V=Ie(V)}Ie=null}else Ie=null;le!==null&&ob(fe,ie,le,Ie,!1),Te!==null&&Ot!==null&&ob(fe,Ot,Te,Ie,!0)}}e:{if(ie=te?Ji(te):window,le=ie.nodeName&&ie.nodeName.toLowerCase(),le==="select"||le==="input"&&ie.type==="file")var St=jv;else if(Sv(ie))if(Nv)St=_j;else{St=bj;var Re=vj}else le=ie.nodeName,!le||le.toLowerCase()!=="input"||ie.type!=="checkbox"&&ie.type!=="radio"?te&&qa(te.elementType)&&(St=jv):St=yj;if(St&&(St=St(s,te))){kv(fe,St,c,ce);break e}Re&&Re(s,ie,te),s==="focusout"&&te&&ie.type==="number"&&te.memoizedProps.value!=null&&Ia(ie,"number",ie.value)}switch(Re=te?Ji(te):window,s){case"focusin":(Sv(Re)||Re.contentEditable==="true")&&(Xa=Re,lf=te,So=null);break;case"focusout":So=lf=Xa=null;break;case"mousedown":of=!0;break;case"contextmenu":case"mouseup":case"dragend":of=!1,Rv(fe,c,ce);break;case"selectionchange":if(Sj)break;case"keydown":case"keyup":Rv(fe,c,ce)}var nt;if(nf)e:{switch(s){case"compositionstart":var ft="onCompositionStart";break e;case"compositionend":ft="onCompositionEnd";break e;case"compositionupdate":ft="onCompositionUpdate";break e}ft=void 0}else Qa?_v(s,c)&&(ft="onCompositionEnd"):s==="keydown"&&c.keyCode===229&&(ft="onCompositionStart");ft&&(vv&&c.locale!=="ko"&&(Qa||ft!=="onCompositionStart"?ft==="onCompositionEnd"&&Qa&&(nt=vt()):(H=ce,me="value"in H?H.value:H.textContent,Qa=!0)),Re=ad(te,ft),0<Re.length&&(ft=new gv(ft,s,null,c,ce),fe.push({event:ft,listeners:Re}),nt?ft.data=nt:(nt=wv(c),nt!==null&&(ft.data=nt)))),(nt=fj?pj(s,c):mj(s,c))&&(ft=ad(te,"onBeforeInput"),0<ft.length&&(Re=new gv("onBeforeInput","beforeinput",null,c,ce),fe.push({event:Re,listeners:ft}),Re.data=nt)),aN(fe,s,te,c,ce)}ab(fe,i)})}function Wo(s,i,c){return{instance:s,listener:i,currentTarget:c}}function ad(s,i){for(var c=i+"Capture",d=[];s!==null;){var g=s,v=g.stateNode;if(g=g.tag,g!==5&&g!==26&&g!==27||v===null||(g=na(s,c),g!=null&&d.unshift(Wo(s,g,v)),g=na(s,i),g!=null&&d.push(Wo(s,g,v))),s.tag===3)return d;s=s.return}return[]}function uN(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function ob(s,i,c,d,g){for(var v=i._reactName,S=[];c!==null&&c!==d;){var T=c,U=T.alternate,te=T.stateNode;if(T=T.tag,U!==null&&U===d)break;T!==5&&T!==26&&T!==27||te===null||(U=te,g?(te=na(c,v),te!=null&&S.unshift(Wo(c,te,U))):g||(te=na(c,v),te!=null&&S.push(Wo(c,te,U)))),c=c.return}S.length!==0&&s.push({event:i,listeners:S})}var dN=/\r\n?/g,hN=/\u0000|\uFFFD/g;function cb(s){return(typeof s=="string"?s:""+s).replace(dN,`
50
+ `).replace(hN,"")}function ub(s,i){return i=cb(i),cb(s)===i}function zt(s,i,c,d,g,v){switch(c){case"children":typeof d=="string"?i==="body"||i==="textarea"&&d===""||ci(s,d):(typeof d=="number"||typeof d=="bigint")&&i!=="body"&&ci(s,""+d);break;case"className":Fa(s,"class",d);break;case"tabIndex":Fa(s,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":Fa(s,c,d);break;case"style":ou(s,d,v);break;case"data":if(i!=="object"){Fa(s,"data",d);break}case"src":case"href":if(d===""&&(i!=="a"||c!=="href")){s.removeAttribute(c);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){s.removeAttribute(c);break}d=Va(""+d),s.setAttribute(c,d);break;case"action":case"formAction":if(typeof d=="function"){s.setAttribute(c,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof v=="function"&&(c==="formAction"?(i!=="input"&&zt(s,i,"name",g.name,g,null),zt(s,i,"formEncType",g.formEncType,g,null),zt(s,i,"formMethod",g.formMethod,g,null),zt(s,i,"formTarget",g.formTarget,g,null)):(zt(s,i,"encType",g.encType,g,null),zt(s,i,"method",g.method,g,null),zt(s,i,"target",g.target,g,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){s.removeAttribute(c);break}d=Va(""+d),s.setAttribute(c,d);break;case"onClick":d!=null&&(s.onclick=Mr);break;case"onScroll":d!=null&&ot("scroll",s);break;case"onScrollEnd":d!=null&&ot("scrollend",s);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(r(61));if(c=d.__html,c!=null){if(g.children!=null)throw Error(r(60));s.innerHTML=c}}break;case"multiple":s.multiple=d&&typeof d!="function"&&typeof d!="symbol";break;case"muted":s.muted=d&&typeof d!="function"&&typeof d!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(d==null||typeof d=="function"||typeof d=="boolean"||typeof d=="symbol"){s.removeAttribute("xlink:href");break}c=Va(""+d),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":d!=null&&typeof d!="function"&&typeof d!="symbol"?s.setAttribute(c,""+d):s.removeAttribute(c);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":d&&typeof d!="function"&&typeof d!="symbol"?s.setAttribute(c,""):s.removeAttribute(c);break;case"capture":case"download":d===!0?s.setAttribute(c,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?s.setAttribute(c,d):s.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?s.setAttribute(c,d):s.removeAttribute(c);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?s.removeAttribute(c):s.setAttribute(c,d);break;case"popover":ot("beforetoggle",s),ot("toggle",s),ea(s,"popover",d);break;case"xlinkActuate":Jr(s,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":Jr(s,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":Jr(s,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":Jr(s,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":Jr(s,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":Jr(s,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":Jr(s,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":Jr(s,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":Jr(s,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":ea(s,"is",d);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=cu.get(c)||c,ea(s,c,d))}}function Lp(s,i,c,d,g,v){switch(c){case"style":ou(s,d,v);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(r(61));if(c=d.__html,c!=null){if(g.children!=null)throw Error(r(60));s.innerHTML=c}}break;case"children":typeof d=="string"?ci(s,d):(typeof d=="number"||typeof d=="bigint")&&ci(s,""+d);break;case"onScroll":d!=null&&ot("scroll",s);break;case"onScrollEnd":d!=null&&ot("scrollend",s);break;case"onClick":d!=null&&(s.onclick=Mr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!$a.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(g=c.endsWith("Capture"),i=c.slice(2,g?c.length-7:void 0),v=s[Tn]||null,v=v!=null?v[c]:null,typeof v=="function"&&s.removeEventListener(i,v,g),typeof d=="function")){typeof v!="function"&&v!==null&&(c in s?s[c]=null:s.hasAttribute(c)&&s.removeAttribute(c)),s.addEventListener(i,d,g);break e}c in s?s[c]=d:d===!0?s.setAttribute(c,""):ea(s,c,d)}}}function Rn(s,i,c){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ot("error",s),ot("load",s);var d=!1,g=!1,v;for(v in c)if(c.hasOwnProperty(v)){var S=c[v];if(S!=null)switch(v){case"src":d=!0;break;case"srcSet":g=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,i));default:zt(s,i,v,S,c,null)}}g&&zt(s,i,"srcSet",c.srcSet,c,null),d&&zt(s,i,"src",c.src,c,null);return;case"input":ot("invalid",s);var T=v=S=g=null,U=null,te=null;for(d in c)if(c.hasOwnProperty(d)){var ce=c[d];if(ce!=null)switch(d){case"name":g=ce;break;case"type":S=ce;break;case"checked":U=ce;break;case"defaultChecked":te=ce;break;case"value":v=ce;break;case"defaultValue":T=ce;break;case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(r(137,i));break;default:zt(s,i,d,ce,c,null)}}au(s,v,T,U,te,S,g,!1);return;case"select":ot("invalid",s),d=S=v=null;for(g in c)if(c.hasOwnProperty(g)&&(T=c[g],T!=null))switch(g){case"value":v=T;break;case"defaultValue":S=T;break;case"multiple":d=T;default:zt(s,i,g,T,c,null)}i=v,c=S,s.multiple=!!d,i!=null?oi(s,!!d,i,!1):c!=null&&oi(s,!!d,c,!0);return;case"textarea":ot("invalid",s),v=g=d=null;for(S in c)if(c.hasOwnProperty(S)&&(T=c[S],T!=null))switch(S){case"value":d=T;break;case"defaultValue":g=T;break;case"children":v=T;break;case"dangerouslySetInnerHTML":if(T!=null)throw Error(r(91));break;default:zt(s,i,S,T,c,null)}mo(s,d,g,v);return;case"option":for(U in c)if(c.hasOwnProperty(U)&&(d=c[U],d!=null))switch(U){case"selected":s.selected=d&&typeof d!="function"&&typeof d!="symbol";break;default:zt(s,i,U,d,c,null)}return;case"dialog":ot("beforetoggle",s),ot("toggle",s),ot("cancel",s),ot("close",s);break;case"iframe":case"object":ot("load",s);break;case"video":case"audio":for(d=0;d<Yo.length;d++)ot(Yo[d],s);break;case"image":ot("error",s),ot("load",s);break;case"details":ot("toggle",s);break;case"embed":case"source":case"link":ot("error",s),ot("load",s);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(te in c)if(c.hasOwnProperty(te)&&(d=c[te],d!=null))switch(te){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,i));default:zt(s,i,te,d,c,null)}return;default:if(qa(i)){for(ce in c)c.hasOwnProperty(ce)&&(d=c[ce],d!==void 0&&Lp(s,i,ce,d,c,void 0));return}}for(T in c)c.hasOwnProperty(T)&&(d=c[T],d!=null&&zt(s,i,T,d,c,null))}function fN(s,i,c,d){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var g=null,v=null,S=null,T=null,U=null,te=null,ce=null;for(le in c){var fe=c[le];if(c.hasOwnProperty(le)&&fe!=null)switch(le){case"checked":break;case"value":break;case"defaultValue":U=fe;default:d.hasOwnProperty(le)||zt(s,i,le,null,d,fe)}}for(var ie in d){var le=d[ie];if(fe=c[ie],d.hasOwnProperty(ie)&&(le!=null||fe!=null))switch(ie){case"type":v=le;break;case"name":g=le;break;case"checked":te=le;break;case"defaultChecked":ce=le;break;case"value":S=le;break;case"defaultValue":T=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(r(137,i));break;default:le!==fe&&zt(s,i,ie,le,d,fe)}}ta(s,S,T,U,te,ce,v,g);return;case"select":le=S=T=ie=null;for(v in c)if(U=c[v],c.hasOwnProperty(v)&&U!=null)switch(v){case"value":break;case"multiple":le=U;default:d.hasOwnProperty(v)||zt(s,i,v,null,d,U)}for(g in d)if(v=d[g],U=c[g],d.hasOwnProperty(g)&&(v!=null||U!=null))switch(g){case"value":ie=v;break;case"defaultValue":T=v;break;case"multiple":S=v;default:v!==U&&zt(s,i,g,v,d,U)}i=T,c=S,d=le,ie!=null?oi(s,!!c,ie,!1):!!d!=!!c&&(i!=null?oi(s,!!c,i,!0):oi(s,!!c,c?[]:"",!1));return;case"textarea":le=ie=null;for(T in c)if(g=c[T],c.hasOwnProperty(T)&&g!=null&&!d.hasOwnProperty(T))switch(T){case"value":break;case"children":break;default:zt(s,i,T,null,d,g)}for(S in d)if(g=d[S],v=c[S],d.hasOwnProperty(S)&&(g!=null||v!=null))switch(S){case"value":ie=g;break;case"defaultValue":le=g;break;case"children":break;case"dangerouslySetInnerHTML":if(g!=null)throw Error(r(91));break;default:g!==v&&zt(s,i,S,g,d,v)}Ha(s,ie,le);return;case"option":for(var Te in c)if(ie=c[Te],c.hasOwnProperty(Te)&&ie!=null&&!d.hasOwnProperty(Te))switch(Te){case"selected":s.selected=!1;break;default:zt(s,i,Te,null,d,ie)}for(U in d)if(ie=d[U],le=c[U],d.hasOwnProperty(U)&&ie!==le&&(ie!=null||le!=null))switch(U){case"selected":s.selected=ie&&typeof ie!="function"&&typeof ie!="symbol";break;default:zt(s,i,U,ie,d,le)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ie in c)ie=c[Ie],c.hasOwnProperty(Ie)&&ie!=null&&!d.hasOwnProperty(Ie)&&zt(s,i,Ie,null,d,ie);for(te in d)if(ie=d[te],le=c[te],d.hasOwnProperty(te)&&ie!==le&&(ie!=null||le!=null))switch(te){case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(r(137,i));break;default:zt(s,i,te,ie,d,le)}return;default:if(qa(i)){for(var Ot in c)ie=c[Ot],c.hasOwnProperty(Ot)&&ie!==void 0&&!d.hasOwnProperty(Ot)&&Lp(s,i,Ot,void 0,d,ie);for(ce in d)ie=d[ce],le=c[ce],!d.hasOwnProperty(ce)||ie===le||ie===void 0&&le===void 0||Lp(s,i,ce,ie,d,le);return}}for(var K in c)ie=c[K],c.hasOwnProperty(K)&&ie!=null&&!d.hasOwnProperty(K)&&zt(s,i,K,null,d,ie);for(fe in d)ie=d[fe],le=c[fe],!d.hasOwnProperty(fe)||ie===le||ie==null&&le==null||zt(s,i,fe,ie,d,le)}function db(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function pN(){if(typeof performance.getEntriesByType=="function"){for(var s=0,i=0,c=performance.getEntriesByType("resource"),d=0;d<c.length;d++){var g=c[d],v=g.transferSize,S=g.initiatorType,T=g.duration;if(v&&T&&db(S)){for(S=0,T=g.responseEnd,d+=1;d<c.length;d++){var U=c[d],te=U.startTime;if(te>T)break;var ce=U.transferSize,fe=U.initiatorType;ce&&db(fe)&&(U=U.responseEnd,S+=ce*(U<T?1:(T-te)/(U-te)))}if(--d,i+=8*(v+S)/(g.duration/1e3),s++,10<s)break}}if(0<s)return i/s/1e6}return navigator.connection&&(s=navigator.connection.downlink,typeof s=="number")?s:5}var Rp=null,zp=null;function ld(s){return s.nodeType===9?s:s.ownerDocument}function hb(s){switch(s){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function fb(s,i){if(s===0)switch(i){case"svg":return 1;case"math":return 2;default:return 0}return s===1&&i==="foreignObject"?0:s}function Op(s,i){return s==="textarea"||s==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.children=="bigint"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var Bp=null;function mN(){var s=window.event;return s&&s.type==="popstate"?s===Bp?!1:(Bp=s,!0):(Bp=null,!1)}var pb=typeof setTimeout=="function"?setTimeout:void 0,gN=typeof clearTimeout=="function"?clearTimeout:void 0,mb=typeof Promise=="function"?Promise:void 0,xN=typeof queueMicrotask=="function"?queueMicrotask:typeof mb<"u"?function(s){return mb.resolve(null).then(s).catch(vN)}:pb;function vN(s){setTimeout(function(){throw s})}function Ti(s){return s==="head"}function gb(s,i){var c=i,d=0;do{var g=c.nextSibling;if(s.removeChild(c),g&&g.nodeType===8)if(c=g.data,c==="/$"||c==="/&"){if(d===0){s.removeChild(g),Sl(i);return}d--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")d++;else if(c==="html")Qo(s.ownerDocument.documentElement);else if(c==="head"){c=s.ownerDocument.head,Qo(c);for(var v=c.firstChild;v;){var S=v.nextSibling,T=v.nodeName;v[cs]||T==="SCRIPT"||T==="STYLE"||T==="LINK"&&v.rel.toLowerCase()==="stylesheet"||c.removeChild(v),v=S}}else c==="body"&&Qo(s.ownerDocument.body);c=g}while(c);Sl(i)}function xb(s,i){var c=s;s=0;do{var d=c.nextSibling;if(c.nodeType===1?i?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(i?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),d&&d.nodeType===8)if(c=d.data,c==="/$"){if(s===0)break;s--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||s++;c=d}while(c)}function Pp(s){var i=s.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var c=i;switch(i=i.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":Pp(c),ai(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}s.removeChild(c)}}function bN(s,i,c,d){for(;s.nodeType===1;){var g=c;if(s.nodeName.toLowerCase()!==i.toLowerCase()){if(!d&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(d){if(!s[cs])switch(i){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(v=s.getAttribute("rel"),v==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(v!==g.rel||s.getAttribute("href")!==(g.href==null||g.href===""?null:g.href)||s.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin)||s.getAttribute("title")!==(g.title==null?null:g.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(v=s.getAttribute("src"),(v!==(g.src==null?null:g.src)||s.getAttribute("type")!==(g.type==null?null:g.type)||s.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin))&&v&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(i==="input"&&s.type==="hidden"){var v=g.name==null?null:""+g.name;if(g.type==="hidden"&&s.getAttribute("name")===v)return s}else return s;if(s=Fr(s.nextSibling),s===null)break}return null}function yN(s,i,c){if(i==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!c||(s=Fr(s.nextSibling),s===null))return null;return s}function vb(s,i){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!i||(s=Fr(s.nextSibling),s===null))return null;return s}function $p(s){return s.data==="$?"||s.data==="$~"}function Fp(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function _N(s,i){var c=s.ownerDocument;if(s.data==="$~")s._reactRetry=i;else if(s.data!=="$?"||c.readyState!=="loading")i();else{var d=function(){i(),c.removeEventListener("DOMContentLoaded",d)};c.addEventListener("DOMContentLoaded",d),s._reactRetry=d}}function Fr(s){for(;s!=null;s=s.nextSibling){var i=s.nodeType;if(i===1||i===3)break;if(i===8){if(i=s.data,i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"||i==="F!"||i==="F")break;if(i==="/$"||i==="/&")return null}}return s}var Up=null;function bb(s){s=s.nextSibling;for(var i=0;s;){if(s.nodeType===8){var c=s.data;if(c==="/$"||c==="/&"){if(i===0)return Fr(s.nextSibling);i--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||i++}s=s.nextSibling}return null}function yb(s){s=s.previousSibling;for(var i=0;s;){if(s.nodeType===8){var c=s.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(i===0)return s;i--}else c!=="/$"&&c!=="/&"||i++}s=s.previousSibling}return null}function _b(s,i,c){switch(i=ld(c),s){case"html":if(s=i.documentElement,!s)throw Error(r(452));return s;case"head":if(s=i.head,!s)throw Error(r(453));return s;case"body":if(s=i.body,!s)throw Error(r(454));return s;default:throw Error(r(451))}}function Qo(s){for(var i=s.attributes;i.length;)s.removeAttributeNode(i[0]);ai(s)}var Ur=new Map,wb=new Set;function od(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var qs=$.d;$.d={f:wN,r:SN,D:kN,C:jN,L:NN,m:CN,X:AN,S:EN,M:TN};function wN(){var s=qs.f(),i=Ju();return s||i}function SN(s){var i=Jn(s);i!==null&&i.tag===5&&i.type==="form"?$0(i):qs.r(s)}var yl=typeof document>"u"?null:document;function Sb(s,i,c){var d=yl;if(d&&typeof i=="string"&&i){var g=un(i);g='link[rel="'+s+'"][href="'+g+'"]',typeof c=="string"&&(g+='[crossorigin="'+c+'"]'),wb.has(g)||(wb.add(g),s={rel:s,crossOrigin:c,href:i},d.querySelector(g)===null&&(i=d.createElement("link"),Rn(i,"link",s),nn(i),d.head.appendChild(i)))}}function kN(s){qs.D(s),Sb("dns-prefetch",s,null)}function jN(s,i){qs.C(s,i),Sb("preconnect",s,i)}function NN(s,i,c){qs.L(s,i,c);var d=yl;if(d&&s&&i){var g='link[rel="preload"][as="'+un(i)+'"]';i==="image"&&c&&c.imageSrcSet?(g+='[imagesrcset="'+un(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(g+='[imagesizes="'+un(c.imageSizes)+'"]')):g+='[href="'+un(s)+'"]';var v=g;switch(i){case"style":v=_l(s);break;case"script":v=wl(s)}Ur.has(v)||(s=x({rel:"preload",href:i==="image"&&c&&c.imageSrcSet?void 0:s,as:i},c),Ur.set(v,s),d.querySelector(g)!==null||i==="style"&&d.querySelector(Xo(v))||i==="script"&&d.querySelector(Ko(v))||(i=d.createElement("link"),Rn(i,"link",s),nn(i),d.head.appendChild(i)))}}function CN(s,i){qs.m(s,i);var c=yl;if(c&&s){var d=i&&typeof i.as=="string"?i.as:"script",g='link[rel="modulepreload"][as="'+un(d)+'"][href="'+un(s)+'"]',v=g;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=wl(s)}if(!Ur.has(v)&&(s=x({rel:"modulepreload",href:s},i),Ur.set(v,s),c.querySelector(g)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(Ko(v)))return}d=c.createElement("link"),Rn(d,"link",s),nn(d),c.head.appendChild(d)}}}function EN(s,i,c){qs.S(s,i,c);var d=yl;if(d&&s){var g=us(d).hoistableStyles,v=_l(s);i=i||"default";var S=g.get(v);if(!S){var T={loading:0,preload:null};if(S=d.querySelector(Xo(v)))T.loading=5;else{s=x({rel:"stylesheet",href:s,"data-precedence":i},c),(c=Ur.get(v))&&Ip(s,c);var U=S=d.createElement("link");nn(U),Rn(U,"link",s),U._p=new Promise(function(te,ce){U.onload=te,U.onerror=ce}),U.addEventListener("load",function(){T.loading|=1}),U.addEventListener("error",function(){T.loading|=2}),T.loading|=4,cd(S,i,d)}S={type:"stylesheet",instance:S,count:1,state:T},g.set(v,S)}}}function AN(s,i){qs.X(s,i);var c=yl;if(c&&s){var d=us(c).hoistableScripts,g=wl(s),v=d.get(g);v||(v=c.querySelector(Ko(g)),v||(s=x({src:s,async:!0},i),(i=Ur.get(g))&&Hp(s,i),v=c.createElement("script"),nn(v),Rn(v,"link",s),c.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},d.set(g,v))}}function TN(s,i){qs.M(s,i);var c=yl;if(c&&s){var d=us(c).hoistableScripts,g=wl(s),v=d.get(g);v||(v=c.querySelector(Ko(g)),v||(s=x({src:s,async:!0,type:"module"},i),(i=Ur.get(g))&&Hp(s,i),v=c.createElement("script"),nn(v),Rn(v,"link",s),c.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},d.set(g,v))}}function kb(s,i,c,d){var g=(g=Ce.current)?od(g):null;if(!g)throw Error(r(446));switch(s){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(i=_l(c.href),c=us(g).hoistableStyles,d=c.get(i),d||(d={type:"style",instance:null,count:0,state:null},c.set(i,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){s=_l(c.href);var v=us(g).hoistableStyles,S=v.get(s);if(S||(g=g.ownerDocument||g,S={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(s,S),(v=g.querySelector(Xo(s)))&&!v._p&&(S.instance=v,S.state.loading=5),Ur.has(s)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},Ur.set(s,c),v||MN(g,s,c,S.state))),i&&d===null)throw Error(r(528,""));return S}if(i&&d!==null)throw Error(r(529,""));return null;case"script":return i=c.async,c=c.src,typeof c=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=wl(c),c=us(g).hoistableScripts,d=c.get(i),d||(d={type:"script",instance:null,count:0,state:null},c.set(i,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,s))}}function _l(s){return'href="'+un(s)+'"'}function Xo(s){return'link[rel="stylesheet"]['+s+"]"}function jb(s){return x({},s,{"data-precedence":s.precedence,precedence:null})}function MN(s,i,c,d){s.querySelector('link[rel="preload"][as="style"]['+i+"]")?d.loading=1:(i=s.createElement("link"),d.preload=i,i.addEventListener("load",function(){return d.loading|=1}),i.addEventListener("error",function(){return d.loading|=2}),Rn(i,"link",c),nn(i),s.head.appendChild(i))}function wl(s){return'[src="'+un(s)+'"]'}function Ko(s){return"script[async]"+s}function Nb(s,i,c){if(i.count++,i.instance===null)switch(i.type){case"style":var d=s.querySelector('style[data-href~="'+un(c.href)+'"]');if(d)return i.instance=d,nn(d),d;var g=x({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return d=(s.ownerDocument||s).createElement("style"),nn(d),Rn(d,"style",g),cd(d,c.precedence,s),i.instance=d;case"stylesheet":g=_l(c.href);var v=s.querySelector(Xo(g));if(v)return i.state.loading|=4,i.instance=v,nn(v),v;d=jb(c),(g=Ur.get(g))&&Ip(d,g),v=(s.ownerDocument||s).createElement("link"),nn(v);var S=v;return S._p=new Promise(function(T,U){S.onload=T,S.onerror=U}),Rn(v,"link",d),i.state.loading|=4,cd(v,c.precedence,s),i.instance=v;case"script":return v=wl(c.src),(g=s.querySelector(Ko(v)))?(i.instance=g,nn(g),g):(d=c,(g=Ur.get(v))&&(d=x({},c),Hp(d,g)),s=s.ownerDocument||s,g=s.createElement("script"),nn(g),Rn(g,"link",d),s.head.appendChild(g),i.instance=g);case"void":return null;default:throw Error(r(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(d=i.instance,i.state.loading|=4,cd(d,c.precedence,s));return i.instance}function cd(s,i,c){for(var d=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),g=d.length?d[d.length-1]:null,v=g,S=0;S<d.length;S++){var T=d[S];if(T.dataset.precedence===i)v=T;else if(v!==g)break}v?v.parentNode.insertBefore(s,v.nextSibling):(i=c.nodeType===9?c.head:c,i.insertBefore(s,i.firstChild))}function Ip(s,i){s.crossOrigin==null&&(s.crossOrigin=i.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=i.referrerPolicy),s.title==null&&(s.title=i.title)}function Hp(s,i){s.crossOrigin==null&&(s.crossOrigin=i.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=i.referrerPolicy),s.integrity==null&&(s.integrity=i.integrity)}var ud=null;function Cb(s,i,c){if(ud===null){var d=new Map,g=ud=new Map;g.set(c,d)}else g=ud,d=g.get(c),d||(d=new Map,g.set(c,d));if(d.has(s))return d;for(d.set(s,null),c=c.getElementsByTagName(s),g=0;g<c.length;g++){var v=c[g];if(!(v[cs]||v[en]||s==="link"&&v.getAttribute("rel")==="stylesheet")&&v.namespaceURI!=="http://www.w3.org/2000/svg"){var S=v.getAttribute(i)||"";S=s+S;var T=d.get(S);T?T.push(v):d.set(S,[v])}}return d}function Eb(s,i,c){s=s.ownerDocument||s,s.head.insertBefore(c,i==="title"?s.querySelector("head > title"):null)}function DN(s,i,c){if(c===1||i.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;switch(i.rel){case"stylesheet":return s=i.disabled,typeof i.precedence=="string"&&s==null;default:return!0}case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function Ab(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function LN(s,i,c,d){if(c.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var g=_l(d.href),v=i.querySelector(Xo(g));if(v){i=v._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(s.count++,s=dd.bind(s),i.then(s,s)),c.state.loading|=4,c.instance=v,nn(v);return}v=i.ownerDocument||i,d=jb(d),(g=Ur.get(g))&&Ip(d,g),v=v.createElement("link"),nn(v);var S=v;S._p=new Promise(function(T,U){S.onload=T,S.onerror=U}),Rn(v,"link",d),c.instance=v}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(c,i),(i=c.state.preload)&&(c.state.loading&3)===0&&(s.count++,c=dd.bind(s),i.addEventListener("load",c),i.addEventListener("error",c))}}var qp=0;function RN(s,i){return s.stylesheets&&s.count===0&&fd(s,s.stylesheets),0<s.count||0<s.imgCount?function(c){var d=setTimeout(function(){if(s.stylesheets&&fd(s,s.stylesheets),s.unsuspend){var v=s.unsuspend;s.unsuspend=null,v()}},6e4+i);0<s.imgBytes&&qp===0&&(qp=62500*pN());var g=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&fd(s,s.stylesheets),s.unsuspend)){var v=s.unsuspend;s.unsuspend=null,v()}},(s.imgBytes>qp?50:800)+i);return s.unsuspend=c,function(){s.unsuspend=null,clearTimeout(d),clearTimeout(g)}}:null}function dd(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)fd(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var hd=null;function fd(s,i){s.stylesheets=null,s.unsuspend!==null&&(s.count++,hd=new Map,i.forEach(zN,s),hd=null,dd.call(s))}function zN(s,i){if(!(i.state.loading&4)){var c=hd.get(s);if(c)var d=c.get(null);else{c=new Map,hd.set(s,c);for(var g=s.querySelectorAll("link[data-precedence],style[data-precedence]"),v=0;v<g.length;v++){var S=g[v];(S.nodeName==="LINK"||S.getAttribute("media")!=="not all")&&(c.set(S.dataset.precedence,S),d=S)}d&&c.set(null,d)}g=i.instance,S=g.getAttribute("data-precedence"),v=c.get(S)||d,v===d&&c.set(null,g),c.set(S,g),this.count++,d=dd.bind(this),g.addEventListener("load",d),g.addEventListener("error",d),v?v.parentNode.insertBefore(g,v.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(g,s.firstChild)),i.state.loading|=4}}var Zo={$$typeof:E,Provider:null,Consumer:null,_currentValue:se,_currentValue2:se,_threadCount:0};function ON(s,i,c,d,g,v,S,T,U){this.tag=1,this.containerInfo=s,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Pn(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Pn(0),this.hiddenUpdates=Pn(null),this.identifierPrefix=d,this.onUncaughtError=g,this.onCaughtError=v,this.onRecoverableError=S,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=U,this.incompleteTransitions=new Map}function Tb(s,i,c,d,g,v,S,T,U,te,ce,fe){return s=new ON(s,i,c,S,U,te,ce,fe,T),i=1,v===!0&&(i|=24),v=mr(3,null,null,i),s.current=v,v.stateNode=s,i=Sf(),i.refCount++,s.pooledCache=i,i.refCount++,v.memoizedState={element:d,isDehydrated:c,cache:i},Cf(v),s}function Mb(s){return s?(s=Ja,s):Ja}function Db(s,i,c,d,g,v){g=Mb(g),d.context===null?d.context=g:d.pendingContext=g,d=bi(i),d.payload={element:c},v=v===void 0?null:v,v!==null&&(d.callback=v),c=yi(s,d,i),c!==null&&(ar(c,s,i),To(c,s,i))}function Lb(s,i){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var c=s.retryLane;s.retryLane=c!==0&&c<i?c:i}}function Vp(s,i){Lb(s,i),(s=s.alternate)&&Lb(s,i)}function Rb(s){if(s.tag===13||s.tag===31){var i=la(s,67108864);i!==null&&ar(i,s,67108864),Vp(s,67108864)}}function zb(s){if(s.tag===13||s.tag===31){var i=yr();i=Yn(i);var c=la(s,i);c!==null&&ar(c,s,i),Vp(s,i)}}var pd=!0;function BN(s,i,c,d){var g=B.T;B.T=null;var v=$.p;try{$.p=2,Gp(s,i,c,d)}finally{$.p=v,B.T=g}}function PN(s,i,c,d){var g=B.T;B.T=null;var v=$.p;try{$.p=8,Gp(s,i,c,d)}finally{$.p=v,B.T=g}}function Gp(s,i,c,d){if(pd){var g=Yp(d);if(g===null)Dp(s,i,d,md,c),Bb(s,d);else if(FN(g,s,i,c,d))d.stopPropagation();else if(Bb(s,d),i&4&&-1<$N.indexOf(s)){for(;g!==null;){var v=Jn(g);if(v!==null)switch(v.tag){case 3:if(v=v.stateNode,v.current.memoizedState.isDehydrated){var S=ve(v.pendingLanes);if(S!==0){var T=v;for(T.pendingLanes|=2,T.entangledLanes|=2;S;){var U=1<<31-tt(S);T.entanglements[1]|=U,S&=~U}xs(v),(Nt&6)===0&&(Ku=Ae()+500,Go(0))}}break;case 31:case 13:T=la(v,2),T!==null&&ar(T,v,2),Ju(),Vp(v,2)}if(v=Yp(d),v===null&&Dp(s,i,d,md,c),v===g)break;g=v}g!==null&&d.stopPropagation()}else Dp(s,i,d,null,c)}}function Yp(s){return s=Ga(s),Wp(s)}var md=null;function Wp(s){if(md=null,s=Es(s),s!==null){var i=o(s);if(i===null)s=null;else{var c=i.tag;if(c===13){if(s=u(i),s!==null)return s;s=null}else if(c===31){if(s=h(i),s!==null)return s;s=null}else if(c===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;s=null}else i!==s&&(s=null)}}return md=s,null}function Ob(s){switch(s){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Qr()){case oe:return 2;case Se:return 8;case Q:case xe:return 32;case Le:return 268435456;default:return 32}default:return 32}}var Qp=!1,Mi=null,Di=null,Li=null,Jo=new Map,ec=new Map,Ri=[],$N="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 Bb(s,i){switch(s){case"focusin":case"focusout":Mi=null;break;case"dragenter":case"dragleave":Di=null;break;case"mouseover":case"mouseout":Li=null;break;case"pointerover":case"pointerout":Jo.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":ec.delete(i.pointerId)}}function tc(s,i,c,d,g,v){return s===null||s.nativeEvent!==v?(s={blockedOn:i,domEventName:c,eventSystemFlags:d,nativeEvent:v,targetContainers:[g]},i!==null&&(i=Jn(i),i!==null&&Rb(i)),s):(s.eventSystemFlags|=d,i=s.targetContainers,g!==null&&i.indexOf(g)===-1&&i.push(g),s)}function FN(s,i,c,d,g){switch(i){case"focusin":return Mi=tc(Mi,s,i,c,d,g),!0;case"dragenter":return Di=tc(Di,s,i,c,d,g),!0;case"mouseover":return Li=tc(Li,s,i,c,d,g),!0;case"pointerover":var v=g.pointerId;return Jo.set(v,tc(Jo.get(v)||null,s,i,c,d,g)),!0;case"gotpointercapture":return v=g.pointerId,ec.set(v,tc(ec.get(v)||null,s,i,c,d,g)),!0}return!1}function Pb(s){var i=Es(s.target);if(i!==null){var c=o(i);if(c!==null){if(i=c.tag,i===13){if(i=u(c),i!==null){s.blockedOn=i,co(s.priority,function(){zb(c)});return}}else if(i===31){if(i=h(c),i!==null){s.blockedOn=i,co(s.priority,function(){zb(c)});return}}else if(i===3&&c.stateNode.current.memoizedState.isDehydrated){s.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}s.blockedOn=null}function gd(s){if(s.blockedOn!==null)return!1;for(var i=s.targetContainers;0<i.length;){var c=Yp(s.nativeEvent);if(c===null){c=s.nativeEvent;var d=new c.constructor(c.type,c);ui=d,c.target.dispatchEvent(d),ui=null}else return i=Jn(c),i!==null&&Rb(i),s.blockedOn=c,!1;i.shift()}return!0}function $b(s,i,c){gd(s)&&c.delete(i)}function UN(){Qp=!1,Mi!==null&&gd(Mi)&&(Mi=null),Di!==null&&gd(Di)&&(Di=null),Li!==null&&gd(Li)&&(Li=null),Jo.forEach($b),ec.forEach($b)}function xd(s,i){s.blockedOn===i&&(s.blockedOn=null,Qp||(Qp=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,UN)))}var vd=null;function Fb(s){vd!==s&&(vd=s,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){vd===s&&(vd=null);for(var i=0;i<s.length;i+=3){var c=s[i],d=s[i+1],g=s[i+2];if(typeof d!="function"){if(Wp(d||c)===null)continue;break}var v=Jn(c);v!==null&&(s.splice(i,3),i-=3,Yf(v,{pending:!0,data:g,method:c.method,action:d},d,g))}}))}function Sl(s){function i(U){return xd(U,s)}Mi!==null&&xd(Mi,s),Di!==null&&xd(Di,s),Li!==null&&xd(Li,s),Jo.forEach(i),ec.forEach(i);for(var c=0;c<Ri.length;c++){var d=Ri[c];d.blockedOn===s&&(d.blockedOn=null)}for(;0<Ri.length&&(c=Ri[0],c.blockedOn===null);)Pb(c),c.blockedOn===null&&Ri.shift();if(c=(s.ownerDocument||s).$$reactFormReplay,c!=null)for(d=0;d<c.length;d+=3){var g=c[d],v=c[d+1],S=g[Tn]||null;if(typeof v=="function")S||Fb(c);else if(S){var T=null;if(v&&v.hasAttribute("formAction")){if(g=v,S=v[Tn]||null)T=S.formAction;else if(Wp(g)!==null)continue}else T=S.action;typeof T=="function"?c[d+1]=T:(c.splice(d,3),d-=3),Fb(c)}}}function Ub(){function s(v){v.canIntercept&&v.info==="react-transition"&&v.intercept({handler:function(){return new Promise(function(S){return g=S})},focusReset:"manual",scroll:"manual"})}function i(){g!==null&&(g(),g=null),d||setTimeout(c,20)}function c(){if(!d&&!navigation.transition){var v=navigation.currentEntry;v&&v.url!=null&&navigation.navigate(v.url,{state:v.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var d=!1,g=null;return navigation.addEventListener("navigate",s),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(c,100),function(){d=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),g!==null&&(g(),g=null)}}}function Xp(s){this._internalRoot=s}bd.prototype.render=Xp.prototype.render=function(s){var i=this._internalRoot;if(i===null)throw Error(r(409));var c=i.current,d=yr();Db(c,d,s,i,null,null)},bd.prototype.unmount=Xp.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var i=s.containerInfo;Db(s.current,2,null,s,null,null),Ju(),i[fr]=null}};function bd(s){this._internalRoot=s}bd.prototype.unstable_scheduleHydration=function(s){if(s){var i=oo();s={blockedOn:null,target:s,priority:i};for(var c=0;c<Ri.length&&i!==0&&i<Ri[c].priority;c++);Ri.splice(c,0,s),c===0&&Pb(s)}};var Ib=t.version;if(Ib!=="19.2.8")throw Error(r(527,Ib,"19.2.8"));$.findDOMNode=function(s){var i=s._reactInternals;if(i===void 0)throw typeof s.render=="function"?Error(r(188)):(s=Object.keys(s).join(","),Error(r(268,s)));return s=p(i),s=s!==null?m(s):null,s=s===null?null:s.stateNode,s};var IN={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:B,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var yd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!yd.isDisabled&&yd.supportsFiber)try{st=yd.inject(IN),Ct=yd}catch{}}return rc.createRoot=function(s,i){if(!a(s))throw Error(r(299));var c=!1,d="",g=Q0,v=X0,S=K0;return i!=null&&(i.unstable_strictMode===!0&&(c=!0),i.identifierPrefix!==void 0&&(d=i.identifierPrefix),i.onUncaughtError!==void 0&&(g=i.onUncaughtError),i.onCaughtError!==void 0&&(v=i.onCaughtError),i.onRecoverableError!==void 0&&(S=i.onRecoverableError)),i=Tb(s,1,!1,null,null,c,d,null,g,v,S,Ub),s[fr]=i.current,Mp(s),new Xp(i)},rc.hydrateRoot=function(s,i,c){if(!a(s))throw Error(r(299));var d=!1,g="",v=Q0,S=X0,T=K0,U=null;return c!=null&&(c.unstable_strictMode===!0&&(d=!0),c.identifierPrefix!==void 0&&(g=c.identifierPrefix),c.onUncaughtError!==void 0&&(v=c.onUncaughtError),c.onCaughtError!==void 0&&(S=c.onCaughtError),c.onRecoverableError!==void 0&&(T=c.onRecoverableError),c.formState!==void 0&&(U=c.formState)),i=Tb(s,1,!0,i,c??null,d,g,U,v,S,T,Ub),i.context=Mb(null),c=i.current,d=yr(),d=Yn(d),g=bi(d),g.callback=null,yi(c,g,d),c=d,i.current.lanes=c,qt(i,c),xs(i),s[fr]=i.current,Mp(s),new bd(i)},rc.version="19.2.8",rc}var ey;function tC(){if(ey)return Jp.exports;ey=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(),Jp.exports=eC(),Jp.exports}var nC=tC();const ty=e=>{let t;const n=new Set,r=(p,m)=>{const x=typeof p=="function"?p(t):p;if(!Object.is(x,t)){const b=t;t=m??(typeof x!="object"||x===null)?x:Object.assign({},t,x),n.forEach(y=>y(t,b))}},a=()=>t,h={setState:r,getState:a,getInitialState:()=>f,subscribe:p=>(n.add(p),()=>n.delete(p))},f=t=e(r,a,h);return h},rC=(e=>e?ty(e):ty),sC=e=>e;function iC(e,t=sC){const n=_d.useSyncExternalStore(e.subscribe,_d.useCallback(()=>t(e.getState()),[e,t]),_d.useCallback(()=>t(e.getInitialState()),[e,t]));return _d.useDebugValue(n),n}const ny=e=>{const t=rC(e),n=r=>iC(t,r);return Object.assign(n,t),n},aC=(e=>e?ny(e):ny),ug="companion_auth_token";function ry(){return typeof window>"u"?null:localStorage.getItem(ug)||null}const lC=e=>({authToken:ry(),isAuthenticated:ry()!==null,setAuthToken:t=>{localStorage.setItem(ug,t),e({authToken:t,isAuthenticated:!0})},logout:()=>{localStorage.removeItem(ug),e({authToken:null,isAuthenticated:!1})}});function Qt(e,t){if(!e.has(t))return e;const n=new Map(e);return n.delete(t),n}function oC(e,t){if(!e.has(t))return e;const n=new Set(e);return n.delete(t),n}function cC(){if(typeof window>"u")return new Map;try{return new Map(JSON.parse(localStorage.getItem("cc-session-names")||"[]"))}catch{return new Map}}function uC(){return typeof window>"u"?null:localStorage.getItem("cc-current-session")||null}function dC(){if(typeof window>"u")return new Set;try{return new Set(JSON.parse(localStorage.getItem("cc-collapsed-projects")||"[]"))}catch{return new Set}}const hC=e=>({sessions:new Map,sdkSessions:[],currentSessionId:uC(),connectionStatus:new Map,cliConnected:new Map,cliReconnecting:new Map,sessionStatus:new Map,previousPermissionMode:new Map,sessionNames:cC(),recentlyRenamed:new Set,prStatus:new Map,linkedLinearIssues:new Map,mcpServers:new Map,rateLimit:new Map,collapsedProjects:dC(),setCurrentSession:t=>{t?localStorage.setItem("cc-current-session",t):localStorage.removeItem("cc-current-session"),e({currentSessionId:t})},addSession:t=>e(n=>{const r=new Map(n.sessions);r.set(t.session_id,t);const a=new Map(n.messages);return a.has(t.session_id)||a.set(t.session_id,[]),{sessions:r,messages:a}}),updateSession:(t,n)=>e(r=>{const a=new Map(r.sessions),o=a.get(t);return o&&a.set(t,{...o,...n}),{sessions:a}}),removeSession:t=>e(n=>{const r=Qt(n.sessionNames,t);return localStorage.setItem("cc-session-names",JSON.stringify(Array.from(r.entries()))),n.currentSessionId===t&&localStorage.removeItem("cc-current-session"),{sessions:Qt(n.sessions,t),connectionStatus:Qt(n.connectionStatus,t),cliConnected:Qt(n.cliConnected,t),cliReconnecting:Qt(n.cliReconnecting,t),sessionStatus:Qt(n.sessionStatus,t),previousPermissionMode:Qt(n.previousPermissionMode,t),sessionNames:r,recentlyRenamed:oC(n.recentlyRenamed,t),mcpServers:Qt(n.mcpServers,t),rateLimit:Qt(n.rateLimit,t),prStatus:Qt(n.prStatus,t),linkedLinearIssues:Qt(n.linkedLinearIssues,t),sdkSessions:n.sdkSessions.filter(a=>a.sessionId!==t),currentSessionId:n.currentSessionId===t?null:n.currentSessionId,messages:Qt(n.messages,t),streaming:Qt(n.streaming,t),streamingStartedAt:Qt(n.streamingStartedAt,t),streamingOutputTokens:Qt(n.streamingOutputTokens,t),pendingPermissions:Qt(n.pendingPermissions,t),aiResolvedPermissions:Qt(n.aiResolvedPermissions,t),sessionTasks:Qt(n.sessionTasks,t),changedFilesTick:Qt(n.changedFilesTick,t),gitChangedFilesCount:Qt(n.gitChangedFilesCount,t),sessionProcesses:Qt(n.sessionProcesses,t),toolProgress:Qt(n.toolProgress,t),toolActivity:Qt(n.toolActivity,t),diffPanelSelectedFile:Qt(n.diffPanelSelectedFile,t),chatTabReentryTickBySession:Qt(n.chatTabReentryTickBySession,t)}}),setSdkSessions:t=>e({sdkSessions:t}),setConnectionStatus:(t,n)=>e(r=>{const a=new Map(r.connectionStatus);return a.set(t,n),{connectionStatus:a}}),setCliConnected:(t,n)=>e(r=>{const a=new Map(r.cliConnected);return a.set(t,n),{cliConnected:a}}),setCliReconnecting:(t,n)=>e(r=>{const a=new Map(r.cliReconnecting);return n?a.set(t,!0):a.delete(t),{cliReconnecting:a}}),setSessionStatus:(t,n)=>e(r=>{const a=new Map(r.sessionStatus);return a.set(t,n),{sessionStatus:a}}),setPreviousPermissionMode:(t,n)=>e(r=>{const a=new Map(r.previousPermissionMode);return a.set(t,n),{previousPermissionMode:a}}),setSessionName:(t,n)=>e(r=>{const a=new Map(r.sessionNames);return a.set(t,n),localStorage.setItem("cc-session-names",JSON.stringify(Array.from(a.entries()))),{sessionNames:a}}),markRecentlyRenamed:t=>e(n=>{const r=new Set(n.recentlyRenamed);return r.add(t),{recentlyRenamed:r}}),clearRecentlyRenamed:t=>e(n=>{const r=new Set(n.recentlyRenamed);return r.delete(t),{recentlyRenamed:r}}),setPRStatus:(t,n)=>e(r=>{const a=new Map(r.prStatus);return a.set(t,n),{prStatus:a}}),setLinkedLinearIssue:(t,n)=>e(r=>{const a=new Map(r.linkedLinearIssues);return n?a.set(t,n):a.delete(t),{linkedLinearIssues:a}}),setMcpServers:(t,n)=>e(r=>{const a=new Map(r.mcpServers);return a.set(t,n),{mcpServers:a}}),setRateLimit:(t,n)=>e(r=>{const a=new Map(r.rateLimit);return a.set(t,n),{rateLimit:a}}),toggleProjectCollapse:t=>e(n=>{const r=new Set(n.collapsedProjects);return r.has(t)?r.delete(t):r.add(t),localStorage.setItem("cc-collapsed-projects",JSON.stringify(Array.from(r))),{collapsedProjects:r}}),setSessionAiValidation:(t,n)=>e(r=>{const a=new Map(r.sessions),o=a.get(t);return o?(a.set(t,{...o,...n}),{sessions:a}):{}}),setSessionMagicUi:(t,n)=>e(r=>{const a=new Map(r.sessions),o=a.get(t);return o?(a.set(t,{...o,magicUiActive:n}),{sessions:a}):{}})}),fC=e=>({messages:new Map,streaming:new Map,streamingStartedAt:new Map,streamingOutputTokens:new Map,lastActivityAt:new Map,appendMessage:(t,n)=>e(r=>{const a=r.messages.get(t)||[];if(n.id&&a.some(u=>u.id===n.id))return r;const o=new Map(r.messages);return o.set(t,[...a,n]),{messages:o}}),setMessages:(t,n)=>e(r=>{const a=new Map(r.messages);return a.set(t,n),{messages:a}}),updateLastAssistantMessage:(t,n)=>e(r=>{const a=new Map(r.messages),o=[...a.get(t)||[]];for(let u=o.length-1;u>=0;u--)if(o[u].role==="assistant"){o[u]=n(o[u]);break}return a.set(t,o),{messages:a}}),setStreaming:(t,n)=>e(r=>{const a=new Map(r.streaming);return n===null?a.delete(t):a.set(t,n),{streaming:a}}),setStreamingStats:(t,n)=>e(r=>{const a=new Map(r.streamingStartedAt),o=new Map(r.streamingOutputTokens);return n===null?(a.delete(t),o.delete(t)):(n.startedAt!==void 0&&a.set(t,n.startedAt),n.outputTokens!==void 0&&o.set(t,n.outputTokens)),{streamingStartedAt:a,streamingOutputTokens:o}}),setLastActivity:(t,n)=>e(r=>{const a=new Map(r.lastActivityAt);return a.set(t,n),{lastActivityAt:a}}),promptSuggestions:new Map,setPromptSuggestions:(t,n)=>e(r=>{const a=new Map(r.promptSuggestions);return a.set(t,n),{promptSuggestions:a}}),clearPromptSuggestions:t=>e(n=>{const r=new Map(n.promptSuggestions);return r.delete(t),{promptSuggestions:r}})}),pC=e=>({pendingPermissions:new Map,aiResolvedPermissions:new Map,addPermission:(t,n)=>e(r=>{const a=new Map(r.pendingPermissions),o=new Map(a.get(t)||[]);return o.set(n.request_id,n),a.set(t,o),{pendingPermissions:a}}),removePermission:(t,n)=>e(r=>{const a=new Map(r.pendingPermissions),o=a.get(t);if(o){const u=new Map(o);u.delete(n),a.set(t,u)}return{pendingPermissions:a}}),addAiResolvedPermission:(t,n)=>e(r=>{const a=new Map(r.aiResolvedPermissions),o=[...a.get(t)||[],n];return o.length>50&&o.splice(0,o.length-50),a.set(t,o),{aiResolvedPermissions:a}}),clearAiResolvedPermissions:t=>e(n=>{const r=new Map(n.aiResolvedPermissions);return r.delete(t),{aiResolvedPermissions:r}})}),mC=e=>({sessionTasks:new Map,sessionProcesses:new Map,sessionBackgroundAgents:new Map,changedFilesTick:new Map,gitChangedFilesCount:new Map,toolProgress:new Map,toolActivity:new Map,addTask:(t,n)=>e(r=>{const a=new Map(r.sessionTasks),o=[...a.get(t)||[],n];return a.set(t,o),{sessionTasks:a}}),setTasks:(t,n)=>e(r=>{const a=new Map(r.sessionTasks);return a.set(t,n),{sessionTasks:a}}),updateTask:(t,n,r)=>e(a=>{const o=new Map(a.sessionTasks),u=o.get(t);return u&&o.set(t,u.map(h=>h.id===n?{...h,...r}:h)),{sessionTasks:o}}),addProcess:(t,n)=>e(r=>{const a=new Map(r.sessionProcesses),o=[...a.get(t)||[],n];return a.set(t,o),{sessionProcesses:a}}),updateProcess:(t,n,r)=>e(a=>{const o=new Map(a.sessionProcesses),u=o.get(t);return u&&o.set(t,u.map(h=>h.taskId===n?{...h,...r}:h)),{sessionProcesses:o}}),updateProcessByToolUseId:(t,n,r)=>e(a=>{const o=new Map(a.sessionProcesses),u=o.get(t);return u&&o.set(t,u.map(h=>h.toolUseId===n?{...h,...r}:h)),{sessionProcesses:o}}),addBackgroundAgent:(t,n)=>e(r=>{const a=new Map(r.sessionBackgroundAgents),o=[...a.get(t)||[],n];return a.set(t,o),{sessionBackgroundAgents:a}}),updateBackgroundAgent:(t,n,r)=>e(a=>{const o=new Map(a.sessionBackgroundAgents),u=o.get(t);return u&&o.set(t,u.map(h=>h.toolUseId===n?{...h,...r}:h)),{sessionBackgroundAgents:o}}),bumpChangedFilesTick:t=>e(n=>{const r=new Map(n.changedFilesTick);return r.set(t,(r.get(t)??0)+1),{changedFilesTick:r}}),setGitChangedFilesCount:(t,n)=>e(r=>{const a=new Map(r.gitChangedFilesCount);return a.set(t,n),{gitChangedFilesCount:a}}),setToolProgress:(t,n,r)=>e(a=>{const o=new Map(a.toolProgress),u=new Map(o.get(t)||[]);return u.set(n,r),o.set(t,u),{toolProgress:o}}),clearToolProgress:(t,n)=>e(r=>{const a=new Map(r.toolProgress);if(n){const o=a.get(t);if(o){const u=new Map(o);u.delete(n),a.set(t,u)}}else a.delete(t);return{toolProgress:a}}),setToolActivity:(t,n)=>e(r=>{const a=new Map(r.toolActivity);return n.length===0?a.delete(t):a.set(t,n),{toolActivity:a}}),addToolActivity:(t,n)=>e(r=>{const a=new Map(r.toolActivity),o=[...a.get(t)||[]],u=o.findIndex(h=>h.toolUseId===n.toolUseId);if(u>=0){const h=o[u];o[u]={...h,...n,startedAt:h.startedAt,completedAt:n.completedAt??h.completedAt,elapsedSeconds:Math.max(h.elapsedSeconds,n.elapsedSeconds),isError:h.isError||n.isError}}else o.push(n);return a.set(t,o),{toolActivity:a}}),updateToolActivity:(t,n,r)=>e(a=>{const o=new Map(a.toolActivity),u=o.get(t);return u&&o.set(t,u.map(h=>h.toolUseId===n?{...h,...r}:h)),{toolActivity:o}})}),ri=[{id:"usage-limits",label:"Usage Limits",description:"API usage and rate limit meters",backends:null},{id:"server-memory",label:"Server Memory",description:"Host memory usage meter (out-of-memory awareness)",backends:null},{id:"server-disk",label:"Server Disk",description:"Free space on the Companion data volume",backends:null},{id:"git-branch",label:"Git Branch",description:"Current branch, ahead/behind, and line changes",backends:null},{id:"github-pr",label:"GitHub PR",description:"Pull request status, CI checks, and reviews",backends:null},{id:"linear-issue",label:"Linear Issue",description:"Linked Linear ticket and comments",backends:null},{id:"mcp-servers",label:"MCP Servers",description:"Model Context Protocol server connections",backends:null},{id:"tasks",label:"Tasks",description:"Agent task list and progress",backends:["claude"]}],gC=ri.map(e=>e.id),sw="cc-task-panel-config";function dg(){return{order:[...gC],enabled:Object.fromEntries(ri.map(e=>[e.id,!0]))}}function xC(){if(typeof window>"u")return dg();try{const e=localStorage.getItem(sw);if(e){const t=JSON.parse(e),n=new Set(t.order);for(const a of ri)n.has(a.id)||(t.order.push(a.id),t.enabled[a.id]=!0);const r=new Set(ri.map(a=>a.id));return t.order=t.order.filter(a=>r.has(a)),t}}catch{}return dg()}function wd(e){try{localStorage.setItem(sw,JSON.stringify(e))}catch{}}function vC(){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 bC(){if(typeof window>"u")return!0;const e=localStorage.getItem("cc-notification-sound");return e!==null?e==="true":!0}function yC(){if(typeof window>"u")return!1;const e=localStorage.getItem("cc-notification-desktop");return e!==null?e==="true":!1}function iw(){if(typeof window>"u")return"last-commit";const e=window.localStorage.getItem("cc-diff-base");return e==="last-commit"||e==="default-branch"?e:"last-commit"}function _C(){if(typeof window>"u")return"standard";const e=window.localStorage.getItem("cc-density");return e==="standard"||e==="compact"?e:"standard"}const wC=e=>({darkMode:vC(),notificationSound:bC(),notificationDesktop:yC(),sidebarOpen:typeof window<"u"?window.innerWidth>=768:!0,taskPanelOpen:typeof window<"u"?window.innerWidth>=1024:!0,taskPanelConfig:xC(),taskPanelConfigMode:!1,homeResetKey:0,publicUrl:"",magicUiAvailable:!1,activeTab:"chat",chatTabReentryTickBySession:new Map,diffPanelSelectedFile:new Map,diffBase:iw(),density:_C(),setDarkMode:t=>{localStorage.setItem("cc-dark-mode",String(t)),e({darkMode:t})},toggleDarkMode:()=>e(t=>{const n=!t.darkMode;return localStorage.setItem("cc-dark-mode",String(n)),{darkMode:n}}),setNotificationSound:t=>{localStorage.setItem("cc-notification-sound",String(t)),e({notificationSound:t})},toggleNotificationSound:()=>e(t=>{const n=!t.notificationSound;return localStorage.setItem("cc-notification-sound",String(n)),{notificationSound:n}}),setNotificationDesktop:t=>{localStorage.setItem("cc-notification-desktop",String(t)),e({notificationDesktop:t})},toggleNotificationDesktop:()=>e(t=>{const n=!t.notificationDesktop;return localStorage.setItem("cc-notification-desktop",String(n)),{notificationDesktop:n}}),setPublicUrl:t=>e({publicUrl:t}),setMagicUiAvailable:t=>e({magicUiAvailable:t}),setSidebarOpen:t=>e({sidebarOpen:t}),setTaskPanelOpen:t=>e({taskPanelOpen:t}),setTaskPanelConfigMode:t=>e({taskPanelConfigMode:t}),toggleSectionEnabled:t=>e(n=>{const r={order:[...n.taskPanelConfig.order],enabled:{...n.taskPanelConfig.enabled,[t]:!n.taskPanelConfig.enabled[t]}};return wd(r),{taskPanelConfig:r}}),moveSectionUp:t=>e(n=>{const r=[...n.taskPanelConfig.order],a=r.indexOf(t);if(a<=0)return n;[r[a-1],r[a]]=[r[a],r[a-1]];const o={...n.taskPanelConfig,order:r};return wd(o),{taskPanelConfig:o}}),moveSectionDown:t=>e(n=>{const r=[...n.taskPanelConfig.order],a=r.indexOf(t);if(a<0||a>=r.length-1)return n;[r[a],r[a+1]]=[r[a+1],r[a]];const o={...n.taskPanelConfig,order:r};return wd(o),{taskPanelConfig:o}}),resetTaskPanelConfig:()=>{const t=dg();wd(t),e({taskPanelConfig:t})},newSession:()=>{localStorage.removeItem("cc-current-session"),e(t=>({currentSessionId:null,homeResetKey:t.homeResetKey+1}))},setActiveTab:t=>e({activeTab:t}),markChatTabReentry:t=>e(n=>{const r=new Map(n.chatTabReentryTickBySession),a=(r.get(t)??0)+1;return r.set(t,a),{chatTabReentryTickBySession:r}}),setDiffPanelSelectedFile:(t,n)=>e(r=>{const a=new Map(r.diffPanelSelectedFile);return n?a.set(t,n):a.delete(t),{diffPanelSelectedFile:a}}),setDiffBase:t=>{typeof window<"u"&&localStorage.setItem("cc-diff-base",t),e({diffBase:t})},setDensity:t=>{typeof window<"u"&&localStorage.setItem("cc-density",t),e({density:t})},toggleDensity:()=>e(t=>{const n=t.density==="compact"?"standard":"compact";return typeof window<"u"&&localStorage.setItem("cc-density",n),{density:n}})});function aw(){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 SC=e=>({quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalPlacement:aw(),quickTerminalNextHostIndex:1,quickTerminalNextDockerIndex:1,terminalOpen:!1,terminalCwd:null,terminalId:null,setQuickTerminalOpen:t=>e({quickTerminalOpen:t}),openQuickTerminal:t=>e(n=>{if(t.reuseIfExists){const p=n.quickTerminalTabs.find(m=>m.cwd===t.cwd&&m.containerId===t.containerId);if(p)return{quickTerminalOpen:!0,activeQuickTerminalTabId:p.id}}const r=t.target==="docker",a=n.quickTerminalNextHostIndex,o=n.quickTerminalNextDockerIndex,u=r?a:a+1,h=r?o+1:o,f={id:`${t.target}-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,label:r?`Docker ${o}`:a===1?"Terminal":`Terminal ${a}`,cwd:t.cwd,containerId:t.containerId};return{quickTerminalOpen:!0,quickTerminalTabs:[...n.quickTerminalTabs,f],activeQuickTerminalTabId:f.id,quickTerminalNextHostIndex:u,quickTerminalNextDockerIndex:h}}),closeQuickTerminalTab:t=>e(n=>{var o;const r=n.quickTerminalTabs.filter(u=>u.id!==t),a=n.activeQuickTerminalTabId===t?((o=r[0])==null?void 0:o.id)||null:n.activeQuickTerminalTabId;return{quickTerminalTabs:r,activeQuickTerminalTabId:a,quickTerminalOpen:r.length>0?n.quickTerminalOpen:!1}}),setActiveQuickTerminalTabId:t=>e({activeQuickTerminalTabId:t}),resetQuickTerminal:()=>e({quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalNextHostIndex:1,quickTerminalNextDockerIndex:1}),setTerminalOpen:t=>e({terminalOpen:t}),setTerminalCwd:t=>e({terminalCwd:t}),setTerminalId:t=>e({terminalId:t}),openTerminal:t=>e({terminalOpen:!0,terminalCwd:t}),closeTerminal:()=>e({terminalOpen:!1,terminalCwd:null,terminalId:null})});function kC(){return typeof window>"u"?null:localStorage.getItem("cc-update-dismissed")||null}const jC=e=>({updateInfo:null,updateDismissedVersion:kC(),updateOverlayActive:!1,dockerUpdateDialogOpen:!1,creationProgress:null,creationError:null,sessionCreating:!1,sessionCreatingBackend:null,claudeCompatInfo:null,setUpdateInfo:t=>e({updateInfo:t}),dismissUpdate:t=>{localStorage.setItem("cc-update-dismissed",t),e({updateDismissedVersion:t})},setUpdateOverlayActive:t=>e({updateOverlayActive:t}),setDockerUpdateDialogOpen:t=>e({dockerUpdateDialogOpen:t}),addCreationProgress:t=>e(n=>{const r=n.creationProgress||[],a=r.findIndex(o=>o.step===t.step);if(a>=0){const o=[...r];return o[a]=t,{creationProgress:o}}return{creationProgress:[...r,t]}}),clearCreation:()=>e({creationProgress:null,creationError:null,sessionCreating:!1,sessionCreatingBackend:null}),setSessionCreating:(t,n)=>e({sessionCreating:t,sessionCreatingBackend:n??null}),setCreationError:t=>e({creationError:t}),setClaudeCompatInfo:t=>e({claudeCompatInfo:t})}),NC=e=>({magicUiState:new Map,setMagicUiState:(t,n)=>e(r=>{const a=r.magicUiState.get(t);if(a&&a.version>n.version)return{};const o=new Map(r.magicUiState);return o.set(t,n),{magicUiState:o}}),clearMagicUiState:t=>e(n=>{if(!n.magicUiState.has(t))return{};const r=new Map(n.magicUiState);return r.delete(t),{magicUiState:r}})}),Y=aC((...e)=>({...lC(...e),...hC(...e),...fC(...e),...pC(...e),...mC(...e),...wC(...e),...SC(...e),...jC(...e),...NC(...e),reset:()=>{const[t]=e;t({sessions:new Map,sdkSessions:[],currentSessionId:null,connectionStatus:new Map,cliConnected:new Map,sessionStatus:new Map,previousPermissionMode:new Map,sessionNames:new Map,recentlyRenamed:new Set,mcpServers:new Map,prStatus:new Map,linkedLinearIssues:new Map,messages:new Map,streaming:new Map,streamingStartedAt:new Map,streamingOutputTokens:new Map,pendingPermissions:new Map,aiResolvedPermissions:new Map,magicUiState:new Map,sessionTasks:new Map,changedFilesTick:new Map,gitChangedFilesCount:new Map,sessionProcesses:new Map,toolProgress:new Map,toolActivity:new Map,taskPanelConfigMode:!1,activeTab:"chat",chatTabReentryTickBySession:new Map,diffPanelSelectedFile:new Map,diffBase:iw(),quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalPlacement:aw(),quickTerminalNextHostIndex:1,quickTerminalNextDockerIndex:1,terminalOpen:!1,terminalCwd:null,terminalId:null})}})),CC=Object.freeze(Object.defineProperty({__proto__:null,useStore:Y},Symbol.toStringTag,{value:"Module"})),EC="Your Claude login has expired or is invalid — re-authenticate (run `claude login` in a terminal), then use Reconnect to resume this session.",AC=/invalid authentication credentials|authentication_failed|\b40[13]\s+(?:unauthorized|forbidden)\b|(?:unauthorized|forbidden)[^\n]{0,12}\b40[13]\b|please run\s+`?\/?login|claude login|credentials?\s+(?:expired|invalid|revoked)|oauth token|token\s+(?:expired|revoked)/i;function TC(e){return AC.test(e)}function MC(e){return e.is_error?e.api_error_status===401||e.api_error_status===403?!0:TC(`${e.result??""} ${(e.errors??[]).join(" ")}`):!1}const sy=["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"],iy=["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 ay(){const e=sy[Math.floor(Math.random()*sy.length)],t=iy[Math.floor(Math.random()*iy.length)];return`${e} ${t}`}function lw(e){for(let t=0;t<100;t++){const n=ay();if(!e.has(n))return n}return ay()}let rm=null;function DC(){return rm||(rm=new AudioContext),rm}function LC(){try{const e=DC();e.state==="suspended"&&e.resume();const t=e.currentTime,n=e.createOscillator(),r=e.createGain();n.type="sine",n.frequency.setValueAtTime(659.25,t),r.gain.setValueAtTime(.3,t),r.gain.exponentialRampToValueAtTime(.001,t+.3),n.connect(r),r.connect(e.destination),n.start(t),n.stop(t+.3);const a=e.createOscillator(),o=e.createGain();a.type="sine",a.frequency.setValueAtTime(783.99,t+.15),o.gain.setValueAtTime(.001,t),o.gain.setValueAtTime(.3,t+.15),o.gain.exponentialRampToValueAtTime(.001,t+.5),a.connect(o),o.connect(e.destination),a.start(t+.15),a.stop(t+.5)}catch{}}class ow{diff(t,n,r={}){let a;typeof r=="function"?(a=r,r={}):"callback"in r&&(a=r.callback);const o=this.castInput(t,r),u=this.castInput(n,r),h=this.removeEmpty(this.tokenize(o,r)),f=this.removeEmpty(this.tokenize(u,r));return this.diffWithOptionsObj(h,f,r,a)}diffWithOptionsObj(t,n,r,a){var o;const u=C=>{if(C=this.postProcess(C,r),a){setTimeout(function(){a(C)},0);return}else return C},h=n.length,f=t.length;let p=1,m=h+f;r.maxEditLength!=null&&(m=Math.min(m,r.maxEditLength));const x=(o=r.timeout)!==null&&o!==void 0?o:1/0,b=Date.now()+x,y=[{oldPos:-1,lastComponent:void 0}];let _=this.extractCommon(y[0],n,t,0,r);if(y[0].oldPos+1>=f&&_+1>=h)return u(this.buildValues(y[0].lastComponent,n,t));let j=-1/0,N=1/0;const w=()=>{for(let C=Math.max(j,-p);C<=Math.min(N,p);C+=2){let E;const R=y[C-1],L=y[C+1];R&&(y[C-1]=void 0);let O=!1;if(L){const F=L.oldPos-C;O=L&&0<=F&&F<h}const q=R&&R.oldPos+1<f;if(!O&&!q){y[C]=void 0;continue}if(!q||O&&R.oldPos<L.oldPos?E=this.addToPath(L,!0,!1,0,r):E=this.addToPath(R,!1,!0,1,r),_=this.extractCommon(E,n,t,C,r),E.oldPos+1>=f&&_+1>=h)return u(this.buildValues(E.lastComponent,n,t))||!0;y[C]=E,E.oldPos+1>=f&&(N=Math.min(N,C-1)),_+1>=h&&(j=Math.max(j,C+1))}p++};if(a)(function C(){setTimeout(function(){if(p>m||Date.now()>b)return a(void 0);w()||C()},0)})();else for(;p<=m&&Date.now()<=b;){const C=w();if(C)return C}}addToPath(t,n,r,a,o){const u=t.lastComponent;return u&&!o.oneChangePerToken&&u.added===n&&u.removed===r?{oldPos:t.oldPos+a,lastComponent:{count:u.count+1,added:n,removed:r,previousComponent:u.previousComponent}}:{oldPos:t.oldPos+a,lastComponent:{count:1,added:n,removed:r,previousComponent:u}}}extractCommon(t,n,r,a,o){const u=n.length,h=r.length;let f=t.oldPos,p=f-a,m=0;for(;p+1<u&&f+1<h&&this.equals(r[f+1],n[p+1],o);)p++,f++,m++,o.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return m&&!o.oneChangePerToken&&(t.lastComponent={count:m,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=f,p}equals(t,n,r){return r.comparator?r.comparator(t,n):t===n||!!r.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){const n=[];for(let r=0;r<t.length;r++)t[r]&&n.push(t[r]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,r){const a=[];let o;for(;t;)a.push(t),o=t.previousComponent,delete t.previousComponent,t=o;a.reverse();const u=a.length;let h=0,f=0,p=0;for(;h<u;h++){const m=a[h];if(m.removed)m.value=this.join(r.slice(p,p+m.count)),p+=m.count;else{if(!m.added&&this.useLongestToken){let x=n.slice(f,f+m.count);x=x.map(function(b,y){const _=r[p+y];return _.length>b.length?_:b}),m.value=this.join(x)}else m.value=this.join(n.slice(f,f+m.count));f+=m.count,m.added||(p+=m.count)}}return a}}function ly(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 oy(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 hg(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 fg(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 sc(e,t){return hg(e,t,"")}function Sd(e,t){return fg(e,t,"")}function cy(e,t){return t.slice(0,RC(e,t))}function RC(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);const a=Array(r);let o=0;a[0]=0;for(let u=1;u<r;u++){for(t[u]==t[o]?a[u]=a[o]:a[u]=o;o>0&&t[u]!=t[o];)o=a[o];t[u]==t[o]&&o++}o=0;for(let u=n;u<e.length;u++){for(;o>0&&e[u]!=t[o];)o=a[o];e[u]==t[o]&&o++}return o}function cw(e,t){const n=[];for(const r of Array.from(t.segment(e))){const a=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(a)?n[n.length-1]+=a:n.push(a)}return n}function pg(e,t){if(t)return Nc(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function Rl(e,t){if(t)return Nc(e,t)[0];const n=e.match(/^\s*/);return n?n[0]:""}function Nc(e,t){if(!t)return[Rl(e),pg(e)];if(t.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');const n=cw(e,t),r=n[0],a=n[n.length-1],o=/\s/.test(r)?r:"",u=/\s/.test(a)?a:"";return[o,u]}const uy="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}",zC=new RegExp(`[${uy}]+|\\s+|[^${uy}]`,"ug");class OC extends ow{equals(t,n,r){return r.ignoreCase&&(t=t.toLowerCase(),n=n.toLowerCase()),t.trim()===n.trim()}tokenize(t,n={}){let r;if(n.intlSegmenter){const u=n.intlSegmenter;if(u.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');r=cw(t,u)}else r=t.match(zC)||[];const a=[];let o=null;return r.forEach(u=>{/\s/.test(u)?o==null?a.push(u):a.push(a.pop()+u):o!=null&&/\s/.test(o)?a[a.length-1]==o?a.push(a.pop()+u):a.push(o+u):a.push(u),o=u}),a}join(t){return t.map((n,r)=>r==0?n:n.replace(/^\s+/,"")).join("")}postProcess(t,n){if(!t||n.oneChangePerToken)return t;let r=null,a=null,o=null;return t.forEach(u=>{u.added?a=u:u.removed?o=u:((a||o)&&dy(r,o,a,u,n.intlSegmenter),r=u,a=null,o=null)}),(a||o)&&dy(r,o,a,null,n.intlSegmenter),t}}const BC=new OC;function PC(e,t,n){return BC.diff(e,t,n)}function dy(e,t,n,r,a){if(t&&n){const[o,u]=Nc(t.value,a),[h,f]=Nc(n.value,a);if(e){const p=ly(o,h);e.value=fg(e.value,h,p),t.value=sc(t.value,p),n.value=sc(n.value,p)}if(r){const p=oy(u,f);r.value=hg(r.value,f,p),t.value=Sd(t.value,p),n.value=Sd(n.value,p)}}else if(n){if(e){const o=Rl(n.value,a);n.value=n.value.substring(o.length)}if(r){const o=Rl(r.value,a);r.value=r.value.substring(o.length)}}else if(e&&r){const o=Rl(r.value,a),[u,h]=Nc(t.value,a),f=ly(o,u);t.value=sc(t.value,f);const p=oy(sc(o,f),h);t.value=Sd(t.value,p),r.value=hg(r.value,o,p),e.value=fg(e.value,o,o.slice(0,o.length-p.length))}else if(r){const o=Rl(r.value,a),u=pg(t.value,a),h=cy(u,o);t.value=Sd(t.value,h)}else if(e){const o=pg(e.value,a),u=Rl(t.value,a),h=cy(o,u);t.value=sc(t.value,h)}}class $C extends ow{constructor(){super(...arguments),this.tokenize=UC}equals(t,n,r){return r.ignoreWhitespace?((!r.newlineIsToken||!t.includes(`
51
+ `))&&(t=t.trim()),(!r.newlineIsToken||!n.includes(`
52
+ `))&&(n=n.trim())):r.ignoreNewlineAtEof&&!r.newlineIsToken&&(t.endsWith(`
53
+ `)&&(t=t.slice(0,-1)),n.endsWith(`
54
+ `)&&(n=n.slice(0,-1))),super.equals(t,n,r)}}const FC=new $C;function hy(e,t,n){return FC.diff(e,t,n)}function UC(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
55
+ `));const n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let a=0;a<r.length;a++){const o=r[a];a%2&&!t.newlineIsToken?n[n.length-1]+=o:n.push(o)}return n}function IC(e,t,n,r,a,o,u){let h;u?typeof u=="function"?h={callback:u}:h=u:h={},typeof h.context>"u"&&(h.context=4);const f=h.context;if(h.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(h.callback){const{callback:m}=h;hy(n,r,Object.assign(Object.assign({},h),{callback:x=>{const b=p(x);m(b)}}))}else return p(hy(n,r,h));function p(m){if(!m)return;m.push({value:"",lines:[]});function x(C){return C.map(function(E){return" "+E})}const b=[];let y=0,_=0,j=[],N=1,w=1;for(let C=0;C<m.length;C++){const E=m[C],R=E.lines||HC(E.value);if(E.lines=R,E.added||E.removed){if(!y){const L=m[C-1];y=N,_=w,L&&(j=f>0?x(L.lines.slice(-f)):[],y-=j.length,_-=j.length)}for(const L of R)j.push((E.added?"+":"-")+L);E.added?w+=R.length:N+=R.length}else{if(y)if(R.length<=f*2&&C<m.length-2)for(const L of x(R))j.push(L);else{const L=Math.min(R.length,f);for(const q of x(R.slice(0,L)))j.push(q);const O={oldStart:y,oldLines:N-y+L,newStart:_,newLines:w-_+L,lines:j};b.push(O),y=0,_=0,j=[]}N+=R.length,w+=R.length}}for(const C of b)for(let E=0;E<C.lines.length;E++)C.lines[E].endsWith(`
56
+ `)?C.lines[E]=C.lines[E].slice(0,-1):(C.lines.splice(E+1,0,"\"),E++);return{oldFileName:e,newFileName:t,oldHeader:a,newHeader:o,hunks:b}}}function HC(e){const t=e.endsWith(`
57
+ `),n=e.split(`
58
+ `).map(r=>r+`
59
+ `);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function qC(e,t){return IC("","",e,t,"","",{context:3}).hunks.map(r=>{const a=`@@ -${r.oldStart},${r.oldLines} +${r.newStart},${r.newLines} @@`,o=[];let u=r.oldStart,h=r.newStart;for(const f of r.lines){const p=f[0],m=f.slice(1);p==="-"?o.push({type:"del",content:m,oldLineNo:u++}):p==="+"?o.push({type:"add",content:m,newLineNo:h++}):o.push({type:"context",content:m,oldLineNo:u++,newLineNo:h++})}return uw(o),{header:a,lines:o}})}function VC(e){const t=[],n=e.split(`
60
+ `);let r=null,a=null,o=0,u=0;for(const h of n){if(h.startsWith("diff --git")||h.startsWith("diff --cc")){a&&r&&r.hunks.push(a),r&&t.push(r),r={fileName:"",hunks:[]},a=null;continue}if(h.startsWith("--- a/")||h.startsWith("--- /dev/null"))continue;if(h.startsWith("+++ b/")){r&&(r.fileName=h.slice(6));continue}if(h.startsWith("+++ /dev/null")||h.startsWith("index ")||h.startsWith("new file")||h.startsWith("deleted file")||h.startsWith("old mode")||h.startsWith("new mode")||h.startsWith("rename from")||h.startsWith("rename to")||h.startsWith("similarity index")||h.startsWith("Binary files"))continue;const f=h.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@(.*)$/);if(f){a&&r&&r.hunks.push(a),o=parseInt(f[1],10),u=parseInt(f[2],10),a={header:h,lines:[]};continue}a&&(h.startsWith("+")?a.lines.push({type:"add",content:h.slice(1),newLineNo:u++}):h.startsWith("-")?a.lines.push({type:"del",content:h.slice(1),oldLineNo:o++}):h.startsWith(" ")&&a.lines.push({type:"context",content:h.slice(1),oldLineNo:o++,newLineNo:u++}))}a&&r&&r.hunks.push(a),r&&t.push(r);for(const h of t)for(const f of h.hunks)uw(f.lines);return t}function uw(e){let t=0;for(;t<e.length;){const n=t;for(;t<e.length&&e[t].type==="del";)t++;const r=t,a=t;for(;t<e.length&&e[t].type==="add";)t++;const o=t,u=r-n,h=o-a;if(u>0&&h>0){const f=Math.min(u,h);for(let p=0;p<f;p++){const m=e[n+p],x=e[a+p],b=PC(m.content,x.content);m.wordChanges=b.filter(y=>!y.added).map(y=>({value:y.value,removed:y.removed})),x.wordChanges=b.filter(y=>!y.removed).map(y=>({value:y.value,added:y.added}))}}t===n&&t++}}function GC({line:e}){return e.wordChanges?l.jsx(l.Fragment,{children:e.wordChanges.map((t,n)=>t.added?l.jsx("span",{className:"diff-word-add",children:t.value},n):t.removed?l.jsx("span",{className:"diff-word-del",children:t.value},n):l.jsx("span",{children:t.value},n))}):l.jsx(l.Fragment,{children:e.content})}function YC({hunk:e,showLineNumbers:t}){return l.jsxs("div",{className:"diff-hunk",children:[l.jsx("div",{className:"diff-hunk-header",children:e.header}),e.lines.map((n,r)=>l.jsxs("div",{className:`diff-line diff-line-${n.type}`,children:[t&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"diff-gutter diff-gutter-old",children:n.oldLineNo??""}),l.jsx("span",{className:"diff-gutter diff-gutter-new",children:n.newLineNo??""})]}),l.jsx("span",{className:"diff-marker",children:n.type==="add"?"+":n.type==="del"?"-":" "}),l.jsxs("span",{className:"diff-content",children:[l.jsx(GC,{line:n}),!n.content&&" "]})]},r))]})}function WC({fileName:e}){const t=e.split("/"),n=t.pop()||e,r=t.join("/");return l.jsxs("div",{className:"diff-file-header",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5 text-cc-primary shrink-0",children:[l.jsx("path",{d:"M9 1H4a1 1 0 00-1 1v12a1 1 0 001 1h8a1 1 0 001-1V5L9 1z"}),l.jsx("polyline",{points:"9 1 9 5 13 5"})]}),r&&l.jsxs("span",{className:"text-cc-muted",children:[r,"/"]}),l.jsx("span",{className:"font-semibold text-cc-fg",children:n})]})}function no({oldText:e,newText:t,unifiedDiff:n,fileName:r,mode:a="compact"}){const o=a==="compact",u=!o,h=k.useMemo(()=>{if(n)return VC(n);const f=e??"",p=t??"";if(!f&&!p)return[];const m=qC(f,p);return[{fileName:r||"",hunks:m}]},[e,t,n,r]);return h.length===0||h.every(f=>f.hunks.length===0)?l.jsx("div",{className:"diff-viewer diff-empty",children:l.jsx("span",{className:"text-cc-muted text-xs",children:"No changes"})}):l.jsx("div",{className:`diff-viewer ${o?"diff-compact":"diff-full"}`,children:h.map((f,p)=>l.jsxs("div",{className:"diff-file",children:[(f.fileName||r)&&l.jsx(WC,{fileName:f.fileName||r||""}),f.hunks.map((m,x)=>l.jsx(YC,{hunk:m,showLineNumbers:u},x))]},p))})}const dw=k.createContext(null);function yO({value:e,children:t}){return l.jsx(dw.Provider,{value:e,children:t})}function QC(){const e=k.useContext(dw),t=Y(n=>n.density);return e??t}function ro(){return QC()==="compact"}function $h({open:e,onToggle:t,marker:n,label:r,meta:a,labelClassName:o=""}){return l.jsxs("button",{type:"button",onClick:t,"aria-expanded":e,className:"w-full flex items-center gap-1.5 py-0.5 text-left group cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",className:`w-2.5 h-2.5 shrink-0 text-cc-muted/40 group-hover:text-cc-muted/70 transition-transform duration-200 ${e?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),n&&l.jsx("span",{className:"text-[11px] font-mono-code text-cc-muted/40 select-none shrink-0",children:n}),l.jsx("span",{className:`text-[11px] text-cc-muted/60 group-hover:text-cc-muted truncate min-w-0 ${o}`,children:r}),a&&l.jsx("span",{className:"text-[10px] text-cc-muted/35 shrink-0 ml-auto tabular-nums",children:a})]})}const XC={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 Kc(e){return XC[e]||"tool"}function qi(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 hw({name:e,input:t,toolUseId:n}){const[r,a]=k.useState(e==="Edit"),o=Kc(e),u=qi(e),h=Pc(e,t);return e==="Edit"?l.jsx(KC,{input:t,toolUseId:n}):e==="Bash"?l.jsx(ZC,{input:t,toolUseId:n}):l.jsxs("div",{className:"border border-cc-border rounded-[10px] overflow-hidden bg-cc-card tool-card","data-tool-use-id":n,children:[l.jsxs("button",{onClick:()=>a(!r),className:"w-full flex items-center gap-2.5 px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-3 h-3 text-cc-muted transition-transform duration-200 shrink-0 ${r?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx(Gl,{type:o}),l.jsx("span",{className:"text-xs font-medium text-cc-fg",children:u}),h&&l.jsx("span",{className:"text-xs text-cc-muted truncate flex-1 font-mono-code",children:h})]}),r&&l.jsx("div",{className:"px-3 pb-3 pt-0 border-t border-cc-border/60",children:l.jsx("div",{className:"mt-2",children:l.jsx(JC,{name:e,input:t})})})]})}function KC({input:e,toolUseId:t}){const n=ro(),[r,a]=k.useState(!1),o=String(e.file_path||""),u=o?o.split("/").pop()||o:"",h=String(e.old_string||""),f=String(e.new_string||""),p=!!(h||f),m=!!e.replace_all,[x,b]=k.useState(!1),_=(Array.isArray(e.changes)?e.changes:[]).map(C=>({path:typeof C.path=="string"?C.path:"",kind:typeof C.kind=="string"?C.kind:"update"})).filter(C=>C.path),j=(h+f).split(`
61
+ `).length,N=j>15,w=l.jsx(l.Fragment,{children:p?l.jsxs("div",{className:"relative mt-1",children:[l.jsx("div",{className:`overflow-hidden ${N&&!x?"max-h-[240px]":""}`,children:l.jsx(no,{oldText:h,newText:f,mode:"compact"})}),N&&!x&&l.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-10 bg-gradient-to-t from-cc-bg to-transparent pointer-events-none"}),N&&l.jsx("button",{type:"button",onClick:()=>b(!x),className:"relative z-10 mt-1 text-[11px] text-cc-muted/40 hover:text-cc-muted/70 cursor-pointer transition-colors",children:x?"Show less":`Show all ${j} lines`})]}):_.length>0?l.jsx("div",{className:"mt-1 space-y-1",children:_.map((C,E)=>{const R=C.path.split("/").pop()||C.path;return l.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[l.jsx("span",{className:`text-[9px] font-semibold uppercase ${C.kind==="create"?"text-emerald-600/70 dark:text-emerald-400/70":C.kind==="delete"?"text-cc-error/70":"text-amber-600/70 dark:text-amber-400/70"}`,children:C.kind}),l.jsx("span",{className:"font-mono-code text-cc-fg/60 truncate",children:R})]},`${C.path}-${E}`)})}):l.jsx("pre",{className:"mt-1 text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap leading-relaxed",children:JSON.stringify(e,null,2)})});return n?l.jsxs("div",{"data-tool-use-id":t,children:[l.jsx($h,{open:r,onToggle:()=>a(!r),marker:"±",label:`Edit ${u||"file"}${m?" (all)":""}`,meta:p?`${j} ${j===1?"line":"lines"}`:void 0,labelClassName:"font-mono-code"}),r&&l.jsx("div",{className:"mt-0.5",children:w})]}):l.jsxs("div",{"data-tool-use-id":t,children:[l.jsxs("div",{className:"flex items-center gap-1.5 py-0.5",children:[l.jsx("span",{className:"text-[11px] font-medium text-emerald-600/70 dark:text-emerald-400/70",children:"Edit"}),u&&l.jsx("span",{className:"text-[11px] font-mono-code text-cc-fg/70",children:u}),m&&l.jsx("span",{className:"text-[9px] uppercase tracking-wider font-semibold text-amber-600/70 dark:text-amber-400/70",children:"all"})]}),w]})}function ZC({input:e,toolUseId:t}){const n=typeof e.command=="string"?e.command:"",r=typeof e.description=="string"?e.description:"",a=ro(),[o,u]=k.useState(!1);if(a){const h=n.split(`
62
+ `)[0]||"",f=r||h||"Command",p=n?n.split(`
63
+ `).length-1:0;return l.jsxs("div",{"data-tool-use-id":t,children:[l.jsx($h,{open:o,onToggle:()=>u(!o),marker:"$",label:f,meta:!o&&p>0?`+${p}`:void 0,labelClassName:r?"italic":"font-mono-code"}),o&&l.jsx("div",{className:"rounded-lg bg-cc-code-bg px-3 py-2 mt-1 overflow-x-auto",children:l.jsxs("pre",{className:"text-[12px] font-mono-code text-cc-code-fg leading-relaxed whitespace-pre-wrap break-words",children:[l.jsx("span",{className:"text-cc-muted/40 select-none",children:"$ "}),n]})})]})}return l.jsxs("div",{"data-tool-use-id":t,children:[r&&l.jsx("div",{className:"text-[11px] text-cc-muted/50 mb-1 italic",children:r}),l.jsx("div",{className:"rounded-lg bg-cc-code-bg px-3 py-2 overflow-x-auto",children:l.jsxs("pre",{className:"text-[12px] font-mono-code text-cc-code-fg leading-relaxed whitespace-pre-wrap break-words",children:[l.jsx("span",{className:"text-cc-muted/40 select-none",children:"$ "}),n]})})]})}function JC({name:e,input:t}){switch(e){case"Bash":return l.jsx(e3,{input:t});case"Edit":return l.jsx(t3,{input:t});case"Write":return l.jsx(n3,{input:t});case"Read":return l.jsx(r3,{input:t});case"Glob":return l.jsx(s3,{input:t});case"Grep":return l.jsx(i3,{input:t});case"WebSearch":case"web_search":return l.jsx(a3,{input:t});case"WebFetch":return l.jsx(l3,{input:t});case"Task":return l.jsx(o3,{input:t});case"TodoWrite":return l.jsx(c3,{input:t});case"NotebookEdit":return l.jsx(u3,{input:t});case"SendMessage":return l.jsx(d3,{input:t});default:return l.jsx("pre",{className:"text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto",children:JSON.stringify(t,null,2)})}}function e3({input:e}){return l.jsxs("div",{className:"space-y-1.5",children:[!!e.description&&l.jsx("div",{className:"text-[11px] text-cc-muted italic",children:String(e.description)}),l.jsxs("pre",{className:"px-3 py-2 rounded-lg bg-cc-code-bg text-cc-code-fg text-[12px] font-mono-code leading-relaxed overflow-x-auto",children:[l.jsx("span",{className:"text-cc-muted select-none",children:"$ "}),String(e.command||"")]}),!!e.timeout&&l.jsxs("div",{className:"text-[10px] text-cc-muted",children:["timeout: ",String(e.timeout),"ms"]})]})}function t3({input:e}){const t=String(e.file_path||""),n=String(e.old_string||""),r=String(e.new_string||""),o=(Array.isArray(e.changes)?e.changes:[]).map(u=>({path:typeof u.path=="string"?u.path:"",kind:typeof u.kind=="string"?u.kind:"update"})).filter(u=>u.path);return l.jsxs("div",{className:"space-y-1.5",children:[!!e.replace_all&&l.jsx("span",{className:"inline-block text-[10px] font-medium px-1.5 py-0.5 rounded bg-cc-warning/10 text-cc-warning",children:"replace all"}),n||r?l.jsx(no,{oldText:n,newText:r,fileName:t,mode:"compact"}):o.length>0?l.jsxs("div",{className:"space-y-1.5",children:[!!t&&l.jsx("div",{className:"text-xs text-cc-muted font-mono-code",children:t}),o.map((u,h)=>l.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-cc-fg",children:[l.jsx("span",{className:"inline-block text-[10px] font-medium px-1.5 py-0.5 rounded bg-cc-primary/10 text-cc-primary min-w-[54px] text-center",children:u.kind}),l.jsx("span",{className:"font-mono-code truncate",children:u.path})]},`${u.path}-${h}`))]}):l.jsx("pre",{className:"text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto",children:JSON.stringify(e,null,2)})]})}function n3({input:e}){const t=String(e.file_path||""),n=String(e.content||"");return l.jsx(no,{newText:n,fileName:t,mode:"compact"})}function r3({input:e}){const t=String(e.file_path||e.path||""),n=e.offset,r=e.limit;return l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"text-xs text-cc-muted font-mono-code",children:t}),(n!=null||r!=null)&&l.jsxs("div",{className:"flex gap-2 text-[10px] text-cc-muted",children:[n!=null&&l.jsxs("span",{children:["offset: ",n]}),r!=null&&l.jsxs("span",{children:["limit: ",r]})]})]})}function s3({input:e}){return l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"text-xs font-mono-code text-cc-code-fg",children:String(e.pattern||"")}),!!e.path&&l.jsxs("div",{className:"text-[10px] text-cc-muted",children:["in: ",l.jsx("span",{className:"font-mono-code",children:String(e.path)})]})]})}function i3({input:e}){return l.jsxs("div",{className:"space-y-1",children:[l.jsx("pre",{className:"px-2 py-1.5 rounded bg-cc-code-bg text-cc-code-fg text-[12px] font-mono-code overflow-x-auto",children:String(e.pattern||"")}),l.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-0.5 text-[10px] text-cc-muted",children:[!!e.path&&l.jsxs("span",{children:["path: ",l.jsx("span",{className:"font-mono-code",children:String(e.path)})]}),!!e.glob&&l.jsxs("span",{children:["glob: ",l.jsx("span",{className:"font-mono-code",children:String(e.glob)})]}),!!e.output_mode&&l.jsxs("span",{children:["mode: ",String(e.output_mode)]}),!!e.context&&l.jsxs("span",{children:["context: ",String(e.context)]}),!!e.head_limit&&l.jsxs("span",{children:["limit: ",String(e.head_limit)]})]})]})}function a3({input:e}){return l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"text-xs text-cc-fg font-medium",children:String(e.query||"")}),Array.isArray(e.allowed_domains)&&e.allowed_domains.length>0&&l.jsxs("div",{className:"text-[10px] text-cc-muted",children:["domains: ",e.allowed_domains.join(", ")]})]})}function l3({input:e}){return l.jsxs("div",{className:"space-y-1",children:[!!e.url&&l.jsx("div",{className:"text-xs font-mono-code text-cc-primary truncate",children:String(e.url)}),!!e.prompt&&l.jsx("div",{className:"text-[11px] text-cc-muted italic line-clamp-2",children:String(e.prompt)})]})}function o3({input:e}){return l.jsxs("div",{className:"space-y-1.5",children:[!!e.description&&l.jsx("div",{className:"text-xs text-cc-fg font-medium",children:String(e.description)}),!!e.subagent_type&&l.jsx("span",{className:"inline-block text-[10px] font-medium px-1.5 py-0.5 rounded bg-cc-primary/10 text-cc-primary",children:String(e.subagent_type)}),!!e.prompt&&l.jsx("pre",{className:"text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap leading-relaxed max-h-40 overflow-y-auto",children:String(e.prompt)})]})}function c3({input:e}){const t=e.todos;return Array.isArray(t)?l.jsx("div",{className:"space-y-0.5",children:t.map((n,r)=>{const a=n.status||"pending";return l.jsxs("div",{className:"flex items-start gap-2 py-0.5",children:[l.jsx("span",{className:"shrink-0 mt-0.5",children:a==="completed"?l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-success",children:l.jsx("path",{fillRule:"evenodd",d:"M8 15A7 7 0 108 1a7 7 0 000 14zm3.354-9.354a.5.5 0 00-.708-.708L7 8.586 5.354 6.94a.5.5 0 10-.708.708l2 2a.5.5 0 00.708 0l4-4z",clipRule:"evenodd"})}):a==="in_progress"?l.jsx("svg",{className:"w-3.5 h-3.5 text-cc-primary animate-spin",viewBox:"0 0 16 16",fill:"none",children:l.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"28",strokeDashoffset:"8",strokeLinecap:"round"})}):l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3.5 h-3.5 text-cc-muted",children:l.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"})})}),l.jsx("span",{className:`text-[11px] leading-snug ${a==="completed"?"text-cc-muted line-through":"text-cc-fg"}`,children:n.content||"Task"})]},r)})}):l.jsx("pre",{className:"text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto",children:JSON.stringify(e,null,2)})}function u3({input:e}){const t=String(e.notebook_path||""),n=e.cell_type,r=e.edit_mode;return l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"text-xs font-mono-code text-cc-muted",children:t}),l.jsxs("div",{className:"flex gap-2 text-[10px] text-cc-muted",children:[n&&l.jsxs("span",{children:["type: ",n]}),r&&l.jsxs("span",{children:["mode: ",r]}),e.cell_number!=null&&l.jsxs("span",{children:["cell: ",String(e.cell_number)]})]}),!!e.new_source&&l.jsx("pre",{className:"px-2 py-1.5 rounded bg-cc-code-bg text-cc-code-fg text-[11px] font-mono-code leading-relaxed max-h-40 overflow-y-auto",children:String(e.new_source)})]})}function d3({input:e}){return l.jsxs("div",{className:"space-y-1",children:[!!e.recipient&&l.jsxs("div",{className:"text-[11px] text-cc-muted",children:["to: ",l.jsx("span",{className:"font-medium text-cc-fg",children:String(e.recipient)})]}),!!e.content&&l.jsx("div",{className:"text-xs text-cc-fg whitespace-pre-wrap",children:String(e.content)})]})}function Pc(e,t){if(e==="Bash"&&typeof t.command=="string")return t.description&&typeof t.description=="string"&&t.description.length<=60?t.description:t.command.length>60?t.command.slice(0,60)+"...":t.command;if((e==="Read"||e==="Write"||e==="Edit")&&t.file_path)return String(t.file_path).split("/").slice(-2).join("/");if(e==="Edit"&&Array.isArray(t.changes)&&t.changes.length>0){const n=t.changes[0];if(n!=null&&n.path)return String(n.path).split("/").slice(-2).join("/")}if(e==="Glob"&&t.pattern)return String(t.pattern);if(e==="Grep"&&t.pattern){const n=String(t.pattern),r=t.path?` in ${String(t.path).split("/").slice(-2).join("/")}`:"",a=n+r;return a.length>60?a.slice(0,60)+"...":a}if((e==="WebSearch"||e==="web_search")&&t.query)return String(t.query);if(e==="WebFetch"&&t.url)try{const n=new URL(String(t.url));return n.hostname+n.pathname}catch{return String(t.url).slice(0,60)}return e==="Task"&&t.description?String(t.description):e==="TodoWrite"&&Array.isArray(t.todos)?`${t.todos.length} task${t.todos.length!==1?"s":""}`:e==="NotebookEdit"&&t.notebook_path?String(t.notebook_path).split("/").pop()||"":e==="SendMessage"&&t.recipient?`→ ${String(t.recipient)}`:""}function Gl({type:e}){const t="w-3.5 h-3.5 text-cc-primary shrink-0";return e==="terminal"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("polyline",{points:"3 11 6 8 3 5"}),l.jsx("line",{x1:"8",y1:"11",x2:"13",y2:"11"})]}):e==="file"||e==="file-plus"||e==="file-edit"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("path",{d:"M9 1H4a1 1 0 00-1 1v12a1 1 0 001 1h8a1 1 0 001-1V5L9 1z"}),l.jsx("polyline",{points:"9 1 9 5 13 5"})]}):e==="search"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("circle",{cx:"7",cy:"7",r:"4"}),l.jsx("path",{d:"M13 13l-3-3"})]}):e==="globe"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("circle",{cx:"8",cy:"8",r:"6"}),l.jsx("path",{d:"M2 8h12M8 2c2 2 3 4 3 6s-1 4-3 6c-2-2-3-4-3-6s1-4 3-6z"})]}):e==="message"?l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:l.jsx("path",{d:"M14 10a1 1 0 01-1 1H5l-3 3V3a1 1 0 011-1h10a1 1 0 011 1v7z"})}):e==="list"?l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:l.jsx("path",{d:"M3 4h10M3 8h10M3 12h6"})}):e==="agent"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("circle",{cx:"8",cy:"5",r:"3"}),l.jsx("path",{d:"M3 14c0-2.8 2.2-5 5-5s5 2.2 5 5",strokeLinecap:"round"})]}):e==="checklist"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("path",{d:"M3 4l1.5 1.5L7 3M3 8l1.5 1.5L7 7M3 12l1.5 1.5L7 11",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M9 4h4M9 8h4M9 12h4"})]}):e==="notebook"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("rect",{x:"3",y:"1",width:"10",height:"14",rx:"1"}),l.jsx("path",{d:"M6 1v14M3 5h3M3 9h3M3 13h3"})]}):l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:l.jsx("path",{d:"M10.5 2.5l3 3-8 8H2.5v-3l8-8z"})})}const h3=2e3,f3=new Set(["assistant","stream_event","result","tool_progress","tool_use_summary","status_change","system_event","permission_request","permission_auto_resolved","streamlined_text","streamlined_tool_use_summary"]),as=new Map,ni=new Map,nh=new Map,Vd=new Map,$i=new Map,Cc=new Map,$c=new Map,rh=new Map;function fw(e){return!!e&&(e.readyState===WebSocket.OPEN||e.readyState===WebSocket.CONNECTING)}function pw(e){const t=Y.getState(),n=t.sdkSessions.find(r=>r.sessionId===e);return n?!n.archived:t.currentSessionId===e}function p3(){const e=Y.getState(),t=new Set;for(const n of e.sdkSessions)n.archived||t.add(n.sessionId);return e.currentSessionId&&t.add(e.currentSessionId),Array.from(t)}let Fc=typeof document<"u"?document.hidden:!1;typeof document<"u"&&document.addEventListener("visibilitychange",()=>{if(document.hidden){Fc=!0;for(const[e,t]of ni)clearTimeout(t),ni.delete(e)}else{Fc=!1;for(const e of p3()){if(!pw(e))continue;const t=as.get(e);if(!fw(t)){if(t){try{t.close()}catch{}as.delete(e)}Zc(e)}}}});function Gd(e){const t=e.startsWith("/"),n=e.split("/"),r=[];for(const a of n)if(!(!a||a===".")){if(a===".."){r.length>0&&r.pop();continue}r.push(a)}return`${t?"/":""}${r.join("/")}`}function m3(e,t){return e.startsWith("/")||!t?Gd(e):Gd(`${t}/${e}`)}function g3(e,t){if(!t)return!0;const n=Gd(t);return e===n||e.startsWith(`${n}/`)}function x3(e){let t=rh.get(e);return t||(t=new Set,rh.set(e,t)),t}function sm(e,t){const n=Y.getState(),r=x3(e);for(const a of t){if(a.type!=="tool_use")continue;const{name:o,input:u,id:h}=a;if(h){if(r.has(h))continue;r.add(h)}if(o==="TodoWrite"){const f=u.todos;if(Array.isArray(f)){const p=f.map((m,x)=>({id:String(x+1),subject:m.content||"Task",description:"",activeForm:m.activeForm,status:m.status||"pending"}));n.setTasks(e,p),Vd.set(e,p.length)}continue}if(o==="TaskCreate"){const f=(Vd.get(e)||0)+1;Vd.set(e,f);const p={id:String(f),subject:u.subject||"Task",description:u.description||"",activeForm:u.activeForm,status:"pending"};n.addTask(e,p);continue}if(o==="TaskUpdate"){const f=u.taskId;if(f){const p={};u.status&&(p.status=u.status),u.owner&&(p.owner=u.owner),u.activeForm!==void 0&&(p.activeForm=u.activeForm),u.addBlockedBy&&(p.blockedBy=u.addBlockedBy),n.updateTask(e,f,p)}}}}function im(e,t){var o,u;const n=Y.getState(),r=((o=n.sessions.get(e))==null?void 0:o.cwd)||((u=n.sdkSessions.find(h=>h.sessionId===e))==null?void 0:u.cwd);let a=!1;for(const h of t){if(h.type!=="tool_use")continue;const{name:f,input:p}=h;if((f==="Edit"||f==="Write")&&typeof p.file_path=="string"){const m=m3(p.file_path,r);g3(m,r)&&(a=!0)}}a&&n.bumpChangedFilesTick(e)}const yc=new Map,v3=/Command running in background with ID:\s*(\S+)\.\s*Output is being written to:\s*(\S+)/;function am(e,t){const n=Y.getState();for(const r of t){if(r.type==="tool_use"&&r.name==="Bash"){const a=r.input;if(a.run_in_background===!0){let o=yc.get(e);o||(o=new Map,yc.set(e,o)),o.set(r.id,{command:a.command||"",description:a.description||"",startedAt:Date.now()})}}if(r.type==="tool_result"){const a=r.tool_use_id,o=yc.get(e),u=o==null?void 0:o.get(a);if(o&&u){const f=(typeof r.content=="string"?r.content:Array.isArray(r.content)?r.content.map(p=>"text"in p?p.text:"").join(""):"").match(v3);if(f){const p={taskId:f[1],toolUseId:a,command:u.command,description:u.description,outputFile:f[2],status:"running",startedAt:u.startedAt};n.addProcess(e,p)}o.delete(a),o.size===0&&yc.delete(e)}}}}const kd=new Map,sh=new Map;function lm(e,t){const n=Y.getState();let r=sh.get(e);r||(r=new Set,sh.set(e,r));for(const a of t){if(a.type==="tool_use"&&a.name==="Agent"){if(a.id&&r.has(a.id))continue;const o=a.input;if(o.run_in_background===!0){a.id&&r.add(a.id);let u=kd.get(e);u||(u=new Map,kd.set(e,u));const h={toolUseId:a.id,name:o.name||o.description||"Background agent",description:o.description||"",agentType:o.subagent_type||"general-purpose",status:"running",startedAt:Date.now()};u.set(a.id,{name:h.name,description:h.description,agentType:h.agentType,startedAt:h.startedAt}),n.addBackgroundAgent(e,h)}}if(a.type==="tool_result"){const o=a.tool_use_id,u=kd.get(e),h=u==null?void 0:u.get(o);if(u&&h){const f=typeof a.content=="string"?a.content:Array.isArray(a.content)?a.content.map(m=>"text"in m?m.text:"").join(""):"",p=a.is_error===!0;n.updateBackgroundAgent(e,o,{status:p?"failed":"completed",completedAt:Date.now(),summary:f.length>200?f.slice(0,200)+"...":f}),u.delete(o),u.size===0&&kd.delete(e)}}}}function fy(e,t,n){typeof Notification>"u"||Notification.permission==="granted"&&new Notification(e,{body:t,tag:n})}function py(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 b3=0,y3=0;function bs(){return`msg-${Date.now()}-${++b3}`}function my(e){var n;const t=(n=e.errors)!=null&&n.length?e.errors.join(", "):e.result||(e.api_error_status?`API error ${e.api_error_status}`:"The turn ended with an error but no details were provided.");return MC(e)?`${EC}
64
+
65
+ Details: ${t}`:`Error: ${t}`}function _3(e,t){const n=$c.get(e)||[];n.push(t),$c.set(e,n)}function w3(e,t){const n=$c.get(e);if(!(!(n!=null&&n.length)||t.readyState!==WebSocket.OPEN)){$c.delete(e);for(const r of n)t.send(JSON.stringify(r))}}const Ws=new Map;function gy(e,t,n){const r=Y.getState(),a=r.messages.get(e)||[],o=Cc.get(e);let u=a.filter(f=>!f.isStreaming||f.id===o),h=-1;if(o&&(h=u.findIndex(f=>f.id===o),h===-1&&Cc.delete(e)),h===-1){const f=`stream-${e}-${bs()}`;Cc.set(e,f),u=[...u,{id:f,role:"assistant",content:t,timestamp:Date.now(),isStreaming:!0,streamingPhase:n}]}else{u=[...u];const f=u[h];u[h]={...f,role:"assistant",content:t,isStreaming:!0,streamingPhase:n}}r.setMessages(e,u)}function Oi(e){Cc.delete(e);const t=Y.getState(),n=t.messages.get(e)||[],r=n.filter(a=>!a.isStreaming);return r.length!==n.length?(t.setMessages(e,r),!0):!1}const xy=new Map,S3=8e3;function kl(e,t,n={}){if(console.warn(`[companion:session-event] ${t}`,{sessionId:e,...n.detail??{}}),!n.userText)return;const r=Date.now(),a=xy.get(e);a&&a.code===t&&r-a.at<S3||(xy.set(e,{code:t,at:r}),Y.getState().appendMessage(e,{id:`companion-notice-${t}-${r}`,role:"system",content:n.userText,timestamp:r,meta:!0,metaCode:t}))}function mw(){return`cmsg-${Date.now()}-${++y3}`}function mg(){return mw()}const k3=new Set(["user_message","permission_response","interrupt","set_model","set_permission_mode","mcp_get_status","mcp_toggle","mcp_reconnect","mcp_set_servers","set_ai_validation","set_magic_ui"]);function j3(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 gw(e){return`companion:last-seq:${e}`}function gg(e){const t=nh.get(e);if(typeof t=="number")return t;try{const n=localStorage.getItem(gw(e)),r=n?Number(n):0,a=Number.isFinite(r)?Math.max(0,Math.floor(r)):0;return nh.set(e,a),a}catch{return 0}}function vy(e,t){const n=Math.max(0,Math.floor(t));nh.set(e,n);try{localStorage.setItem(gw(e),String(n))}catch{}}function by(e,t){On(e,{type:"session_ack",last_seq:t})}function Yd(e){return e.map(t=>t.type==="text"?t.text:t.type==="thinking"?t.thinking:"").filter(Boolean).join(`
66
+ `)}function om(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 N3(e,t){const n=e||[],r=t||[];if(n.length===0&&r.length===0)return;const a=new Map;for(const h of r)a.set(om(h),h);const o=[],u=new Set;for(const h of n){const f=om(h);u.has(f)||(u.add(f),o.push(a.get(f)||h))}for(const h of r){const f=om(h);u.has(f)||(u.add(f),o.push(h))}return o}function yy(e,t,n,r,a){return{toolUseId:e,toolName:t,preview:Pc(t,n),startedAt:r,elapsedSeconds:0,isError:!1,parentToolUseId:a||void 0}}function xg(e,t){const n=N3(e.contentBlocks,t.contentBlocks),r=n&&n.length>0?Yd(n):t.content||e.content;return{...e,...t,content:r,contentBlocks:n,timestamp:e.timestamp??t.timestamp,isStreaming:t.isStreaming}}function C3(e,t){const n=Y.getState(),r=n.messages.get(e)||[],a=r.findIndex(u=>u.role==="assistant"&&u.id===t.id);if(a===-1){n.appendMessage(e,t);return}const o=[...r];o[a]=xg(o[a],t),n.setMessages(e,o)}function E3(e,t){var a,o;let n;try{n=JSON.parse(t.data)}catch{console.warn(`[ws] Failed to parse incoming message for session ${e}:`,(o=(a=t.data)==null?void 0:a.substring)==null?void 0:o.call(a,0,120));return}const r=Y.getState();r.connectionStatus.get(e)==="connecting"&&r.setConnectionStatus(e,"connected"),xw(e,n)}function xw(e,t,n={}){var u,h,f,p,m,x;const{processSeq:r=!0,ackSeqMessage:a=!0}=n,o=Y.getState();if(r&&typeof t.seq=="number"){const b=gg(e);if(t.seq<=b)return;vy(e,t.seq),a&&by(e,t.seq)}switch(f3.has(t.type)&&o.setLastActivity(e,Date.now()),t.type){case"session_init":{const b=o.sessions.get(e);if(o.addSession(t.session),o.setCliConnected(e,!0),o.setCliReconnecting(e,!1),b||o.setSessionStatus(e,"idle"),!o.sessionNames.has(e)){const y=new Set(o.sessionNames.values()),_=lw(y);o.setSessionName(e,_)}break}case"session_update":{o.updateSession(e,t.session);break}case"assistant":{const b=t.message;if(b.model==="<synthetic>"){Oi(e),o.setStreaming(e,null),kl(e,"synthetic_noop",{detail:{stopReason:b.stop_reason,text:Yd(b.content).slice(0,120)},userText:"The session resumed without generating a new response. If it seems stuck, resend your last message."});break}const y=Yd(b.content),_={id:b.id,role:"assistant",content:y,contentBlocks:b.content,timestamp:t.timestamp||Date.now(),parentToolUseId:t.parent_tool_use_id,model:b.model,stopReason:b.stop_reason};if(Oi(e),C3(e,_),o.setStreaming(e,null),$i.delete(e),Ws.delete(e),(u=b.content)!=null&&u.length)for(const j of b.content)j.type==="tool_result"&&o.clearToolProgress(e,j.tool_use_id);if(o.setSessionStatus(e,"running"),o.streamingStartedAt.has(e)||o.setStreamingStats(e,{startedAt:Date.now()}),(h=b.content)!=null&&h.length)for(const j of b.content){if(j.type==="tool_use"){const N=j.input||{};o.addToolActivity(e,yy(j.id,j.name,N,t.timestamp||Date.now(),t.parent_tool_use_id))}j.type==="tool_result"&&o.updateToolActivity(e,j.tool_use_id,{completedAt:Date.now(),isError:!!j.is_error})}(f=b.content)!=null&&f.length&&(sm(e,b.content),im(e,b.content),am(e,b.content),lm(e,b.content));break}case"stream_event":{const b=t.event;if(b&&typeof b=="object"){if(b.type==="message_start"&&($i.delete(e),Ws.delete(e),Oi(e),o.setSessionStatus(e,"running"),o.streamingStartedAt.has(e)||o.setStreamingStats(e,{startedAt:Date.now(),outputTokens:0})),b.type==="content_block_delta"){const y=b.delta;if((y==null?void 0:y.type)==="text_delta"&&typeof y.text=="string"){const _=Ws.get(e)||{thinking:"",text:""};$i.get(e)==="thinking"&&(_.thinking=""),_.text+=y.text,Ws.set(e,_),$i.set(e,"text"),o.setStreaming(e,_.text),gy(e,_.text,"text")}if((y==null?void 0:y.type)==="thinking_delta"&&typeof y.thinking=="string"){const _=Ws.get(e)||{thinking:"",text:""};_.thinking+=y.thinking,Ws.set(e,_),$i.set(e,"thinking"),o.setStreaming(e,_.thinking),gy(e,_.thinking,"thinking")}}if(b.type==="message_delta"){const y=b.usage;y!=null&&y.output_tokens&&o.setStreamingStats(e,{outputTokens:y.output_tokens})}}break}case"result":{rh.delete(e),sh.delete(e);const b=t.data,y={total_cost_usd:b.total_cost_usd,num_turns:b.num_turns};if(typeof b.total_lines_added=="number"&&(y.total_lines_added=b.total_lines_added),typeof b.total_lines_removed=="number"&&(y.total_lines_removed=b.total_lines_removed),b.modelUsage){for(const _ of Object.values(b.modelUsage))if(_.contextWindow>0){const j=Math.round((_.inputTokens+_.outputTokens)/_.contextWindow*100);y.context_used_percent=Math.max(0,Math.min(j,100))}}o.updateSession(e,y),Oi(e),o.setStreaming(e,null),$i.delete(e),Ws.delete(e),o.setStreamingStats(e,null),o.clearToolProgress(e),o.setSessionStatus(e,"idle"),!document.hasFocus()&&o.notificationSound&&LC(),!document.hasFocus()&&o.notificationDesktop&&fy("Session completed","Claude finished the task",e),b.is_error&&o.appendMessage(e,{id:bs(),role:"system",content:my(b),timestamp:Date.now()});break}case"permission_request":{if(o.addPermission(e,t.request),!document.hasFocus()&&o.notificationDesktop){const y=t.request;fy("Permission needed",`${y.tool_name}: approve or deny`,y.request_id)}const b=t.request;if(b.tool_name&&b.input){const y=[{type:"tool_use",id:b.tool_use_id,name:b.tool_name,input:b.input}];sm(e,y),im(e,y),am(e,y),lm(e,y)}break}case"permission_cancelled":{o.removePermission(e,t.request_id);break}case"permission_auto_resolved":{o.addAiResolvedPermission(e,{request:t.request,behavior:t.behavior,reason:t.reason,timestamp:Date.now()});break}case"tool_progress":{o.setToolProgress(e,t.tool_use_id,{toolName:t.tool_name,elapsedSeconds:t.elapsed_time_seconds}),o.updateToolActivity(e,t.tool_use_id,{elapsedSeconds:t.elapsed_time_seconds});break}case"tool_use_summary":{((p=o.sdkSessions.find(y=>y.sessionId===e))==null?void 0:p.backendType)==="codex"&&o.appendMessage(e,{id:bs(),role:"system",content:t.summary,timestamp:Date.now()});break}case"user_message":{o.appendMessage(e,{id:t.id||bs(),role:"user",content:t.content,timestamp:t.timestamp||Date.now()}),o.clearPromptSuggestions(e);break}case"system_event":{if(((m=t.event)==null?void 0:m.subtype)==="task_notification"){const{task_id:y,status:_,summary:j}=t.event;y&&_&&o.updateProcess(e,y,{status:_,completedAt:Date.now(),summary:j||void 0})}const b=py(t.event);if(!b)break;o.appendMessage(e,{id:bs(),role:"system",content:b,timestamp:t.timestamp||Date.now()});break}case"status_change":{t.status==="compacting"?o.setSessionStatus(e,"compacting"):o.setSessionStatus(e,t.status);break}case"auth_status":{t.error&&o.appendMessage(e,{id:bs(),role:"system",content:`Auth error: ${t.error}`,timestamp:Date.now()});break}case"error":{o.appendMessage(e,{id:bs(),role:"system",content:t.message,timestamp:Date.now()});break}case"session_phase":{const b=t.phase;b==="terminated"?(o.setCliConnected(e,!1),o.setCliReconnecting(e,!1),o.setSessionStatus(e,null),o.setStreaming(e,null),o.setStreamingStats(e,null),Oi(e)?kl(e,"interrupted_mid_stream",{detail:{trigger:"session_phase:terminated",previousPhase:t.previousPhase},userText:"Response interrupted — the session ended before the reply finished. It will resume automatically."}):kl(e,"session_terminated",{detail:{trigger:"session_phase:terminated",previousPhase:t.previousPhase,hadDraft:!1}})):b==="reconnecting"?(o.setCliConnected(e,!1),o.setCliReconnecting(e,!0),o.setSessionStatus(e,null),o.setStreaming(e,null),o.setStreamingStats(e,null),Oi(e)&&kl(e,"interrupted_mid_stream",{detail:{trigger:"session_phase:reconnecting",previousPhase:t.previousPhase},userText:"Response interrupted — reconnecting to the backend…"})):b==="starting"||b==="initializing"?(o.setCliConnected(e,!1),o.setCliReconnecting(e,!0)):(o.setCliConnected(e,!0),o.setCliReconnecting(e,!1),b==="ready"?o.setSessionStatus(e,"idle"):b==="streaming"?o.setSessionStatus(e,"running"):b==="compacting"?o.setSessionStatus(e,"compacting"):b==="awaiting_permission"&&o.setSessionStatus(e,"running"));break}case"cli_disconnected":{o.setCliConnected(e,!1),o.setCliReconnecting(e,!1),o.setSessionStatus(e,null),o.setStreaming(e,null),o.setStreamingStats(e,null),Oi(e)?kl(e,"interrupted_mid_stream",{detail:{trigger:"cli_disconnected"},userText:"Response interrupted — the backend disconnected before finishing. Trying to reconnect…"}):kl(e,"cli_disconnected",{detail:{trigger:"cli_disconnected",hadDraft:!1}});break}case"cli_connected":{o.setCliConnected(e,!0),o.setCliReconnecting(e,!1);break}case"session_name_update":{const b=o.sessionNames.get(e),y=b&&/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(b);(!b||y)&&(o.setSessionName(e,t.name),o.markRecentlyRenamed(e));break}case"pr_status_update":{o.setPRStatus(e,{available:t.available,pr:t.pr});break}case"mcp_status":{o.setMcpServers(e,t.servers);break}case"rate_limit":{o.setRateLimit(e,t.info);break}case"message_history":{const b=[],y=new Map;for(let j=0;j<t.messages.length;j++){const N=t.messages[j];if(N.type==="user_message")b.push({id:N.id||bs(),role:"user",content:N.content,timestamp:N.timestamp});else if(N.type==="assistant"){const w=N.message,C=Yd(w.content),E={id:w.id,role:"assistant",content:C,contentBlocks:w.content,timestamp:N.timestamp||Date.now(),parentToolUseId:N.parent_tool_use_id,model:w.model,stopReason:w.stop_reason},R=b.findIndex(L=>L.role==="assistant"&&L.id===E.id);if(R===-1?b.push(E):b[R]=xg(b[R],E),(x=w.content)!=null&&x.length){sm(e,w.content),im(e,w.content),am(e,w.content),lm(e,w.content);const L=N.timestamp||Date.now();for(const O of w.content){if(O.type==="tool_use"){const q=O.input||{},F=y.get(O.id);y.set(O.id,F??yy(O.id,O.name,q,L,N.parent_tool_use_id))}if(O.type==="tool_result"){const q=y.get(O.tool_use_id);q&&y.set(O.tool_use_id,{...q,completedAt:L,isError:q.isError||!!O.is_error,elapsedSeconds:Math.max(q.elapsedSeconds,q.completedAt?q.elapsedSeconds:Math.max(0,(L-q.startedAt)/1e3))})}}}}else if(N.type==="result"){const w=N.data;w.is_error&&b.push({id:`hist-error-${j}`,role:"system",content:my(w),timestamp:Date.now()});const C={total_cost_usd:w.total_cost_usd,num_turns:w.num_turns};if(typeof w.total_lines_added=="number"&&(C.total_lines_added=w.total_lines_added),typeof w.total_lines_removed=="number"&&(C.total_lines_removed=w.total_lines_removed),w.modelUsage){for(const E of Object.values(w.modelUsage))if(E.contextWindow>0){const R=E,L=Math.round((R.inputTokens+R.outputTokens)/R.contextWindow*100);C.context_used_percent=Math.max(0,Math.min(L,100))}}o.updateSession(e,C)}else if(N.type==="system_event"){const w=py(N.event);if(!w)continue;b.push({id:`hist-system-event-${j}`,role:"system",content:w,timestamp:N.timestamp||Date.now()})}}if(b.length>0){const j=o.messages.get(e)||[];if(j.length===0)o.setMessages(e,b);else{const N=[...j];for(const w of b){const C=N.findIndex(R=>R.id===w.id);if(C===-1){N.push(w);continue}const E=N[C];E.role==="assistant"&&w.role==="assistant"?N[C]=xg(E,w):N[C]=w}N.sort((w,C)=>(w.timestamp??0)-(C.timestamp??0)),o.setMessages(e,N)}}o.setToolActivity(e,Array.from(y.values()).sort((j,N)=>j.startedAt-N.startedAt));const _=t.messages[t.messages.length-1];(_==null?void 0:_.type)==="result"&&(Oi(e),o.setStreaming(e,null),$i.delete(e),Ws.delete(e),o.setStreamingStats(e,null),o.clearToolProgress(e),o.setSessionStatus(e,"idle"));break}case"event_replay":{let b;for(const y of t.events){const _=gg(e);y.seq<=_||(vy(e,y.seq),b=y.seq,xw(e,y.message,{processSeq:!1,ackSeqMessage:!1}))}typeof b=="number"&&by(e,b);break}case"prompt_suggestion":{const b=t.suggestions;o.setPromptSuggestions(e,b);break}case"streamlined_text":{o.appendMessage(e,{id:bs(),role:"assistant",content:t.text,timestamp:Date.now()});break}case"streamlined_tool_use_summary":{o.appendMessage(e,{id:bs(),role:"system",content:t.tool_summary,timestamp:Date.now()});break}case"magic_ui_state":{o.setMagicUiState(e,t.state);break}default:{console.debug("[ws] Unhandled message type:",t.type);break}}}function Zc(e){const t=as.get(e);if(fw(t))return;if(t){try{t.close()}catch{}as.delete(e)}Y.getState().setConnectionStatus(e,"connecting");const r=new WebSocket(j3(e));as.set(e,r),r.onopen=()=>{const a=gg(e);r.send(JSON.stringify({type:"session_subscribe",last_seq:a})),w3(e,r);const o=ni.get(e);o&&(clearTimeout(o),ni.delete(e))},r.onmessage=a=>E3(e,a),r.onclose=()=>{as.get(e)===r&&(as.delete(e),Y.getState().setConnectionStatus(e,"disconnected"),A3(e))},r.onerror=()=>{r.close()}}function A3(e){if(ni.has(e)||Fc)return;const t=setTimeout(()=>{ni.delete(e),!Fc&&pw(e)&&Zc(e)},h3);ni.set(e,t)}function vg(e){const t=ni.get(e);t&&(clearTimeout(t),ni.delete(e));const n=as.get(e);n&&(n.close(),as.delete(e)),Y.getState().setConnectionStatus(e,"disconnected"),rh.delete(e),sh.delete(e),yc.delete(e),Vd.delete(e),$i.delete(e),Cc.delete(e),Ws.delete(e),nh.delete(e),$c.delete(e)}function T3(e){if(!Fc)for(const t of e)t.archived||Zc(t.sessionId)}function M3(e){return new Promise((t,n)=>{const r=setInterval(()=>{const o=as.get(e);(o==null?void 0:o.readyState)===WebSocket.OPEN&&(clearInterval(r),clearTimeout(a),t())},50),a=setTimeout(()=>{clearInterval(r),n(new Error("Connection timeout"))},1e4)})}function On(e,t){const n=as.get(e);let r=t;const a=k3.has(t.type);if(a)switch(t.type){case"user_message":case"permission_response":case"interrupt":case"set_model":case"set_permission_mode":case"mcp_get_status":case"mcp_toggle":case"mcp_reconnect":case"mcp_set_servers":case"set_ai_validation":case"set_magic_ui":t.client_msg_id||(r={...t,client_msg_id:mw()});break}if((n==null?void 0:n.readyState)===WebSocket.OPEN){n.send(JSON.stringify(r));return}a&&_3(e,r)}function _y(e){On(e,{type:"mcp_get_status"})}function D3(e,t,n){On(e,{type:"mcp_toggle",serverName:t,enabled:n})}function L3(e,t){On(e,{type:"mcp_reconnect",serverName:t})}function R3(e,t){On(e,{type:"mcp_set_servers",servers:t})}function wy(e,t){On(e,{type:"set_magic_ui",magicUiActive:t})}function _O(e){On(e,{type:"magic_ui_sync"})}function z3(e,t){On(e,{type:"set_ai_validation",...t})}var ne=typeof window<"u"?window:void 0,In=typeof globalThis<"u"?globalThis:ne,Nn=In==null?void 0:In.navigator,pe=In==null?void 0:In.document,Zt=In==null?void 0:In.location,kx=In==null?void 0:In.fetch,bg=In!=null&&In.XMLHttpRequest&&"withCredentials"in new In.XMLHttpRequest?In.XMLHttpRequest:void 0,Sy=In==null?void 0:In.AbortController,O3=In==null?void 0:In.CompressionStream,cr=Nn==null?void 0:Nn.userAgent;function vw(){return!(!ne||ne.navigator.onLine===!1)}var ic=typeof globalThis<"u"?globalThis:ne;ic&&typeof self>"u"&&(ic.self=ic),ic&&typeof File>"u"&&(ic.File=function(){});var Me=ne??{},Bt={DEBUG:!1,LIB_VERSION:"0.7.1",LIB_NAME:"browser-common"};function ky(e,t,n,r,a,o,u){try{var h=e[o](u),f=h.value}catch(p){return void n(p)}h.done?t(f):Promise.resolve(f).then(r,a)}function $t(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function u(f){ky(o,r,a,u,h,"next",f)}function h(f){ky(o,r,a,u,h,"throw",f)}u(void 0)}))}}function de(){return de=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},de.apply(null,arguments)}function bw(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var jy=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}};function Ny(e){return typeof e=="string"||e}function Cy(e){return typeof e=="string"?e:void 0}var B3=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],_s=(function(e){return e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.EnablePersonProcessing="enable_person_processing",e.PersonMode="person_mode",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.AiQueue="ai_queue",e.AiCaptureQueue="ai_capture_queue",e.LogsQueue="logs_queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.PushRegistered="push_registered",e.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e.DeviceId="device_id",e})({}),yg=(function(e){return e.GZipJS="gzip-js",e.Base64="base64",e})({}),P3=["$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"],$3=["token"],F3=20,yw=1e3,U3=1e4,I3="[Circular]",_g="[Truncated]",Fh="[Unserializable]",H3="[Function]";function Ul(e){for(var t="",n=0;e.length>n;n++){var r=e.charCodeAt(n);if(55296>r||r>56319)t+=56320>r||r>57343?e[n]:"�";else{var a=e.charCodeAt(n+1);56320>a||a>57343?t+="�":(t+=e[n]+e[n+1],n++)}}return t}var q3=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterestbot","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],Ey=function(e,t){if(t===void 0&&(t=[]),!e)return!1;var n=e.toLowerCase();return q3.concat(t).some((r=>{var a=r.toLowerCase();return n.indexOf(a)!==-1}))};function Fe(e,t){return e.indexOf(t)!==-1}var Uh=function(e){return e.trim()},wg=function(e){return e.replace(/^\$/,"")};function _w(e){var t,n=[];return(t=JSON.stringify(e,(function(r,a){if(typeof a=="bigint")return a.toString();if(typeof a!="function"&&typeof a!="symbol"){if(a instanceof Error)return{name:a.name,message:a.message,stack:a.stack};if(a&&typeof a=="object"){for(;n.length>0&&n[n.length-1]!==this;)n.pop();if(n.includes(a))return"[Circular]";n.push(a)}return a}})))!==null&&t!==void 0?t:"null"}var ww=Object.prototype,Sw=ww.hasOwnProperty,Ih=ww.toString,Be=Array.isArray||function(e){return Ih.call(e)==="[object Array]"},Un=e=>typeof e=="function",pt=e=>e===Object(e)&&!Be(e),Vr=e=>{if(pt(e)){for(var t in e)if(Sw.call(e,t))return!1;return!0}return!1},ue=e=>e===void 0,ct=e=>Ih.call(e)=="[object String]",Ec=e=>ct(e)&&e.trim().length===0,sn=e=>e===null,Ge=e=>ue(e)||sn(e),an=e=>Ih.call(e)=="[object Number]"&&e==e,Qs=e=>an(e)&&e>0,Kn=e=>Ih.call(e)==="[object Boolean]",V3=e=>e instanceof FormData,G3=e=>Fe(P3,e),Y3=e=>Fe($3,e);function kw(e){return e===null||typeof e!="object"}function ih(e,t){return{}.toString.call(e)==="[object "+t+"]"}function jw(e){switch({}.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return Nw(e,Error)}}function jx(e){return typeof Event<"u"&&Nw(e,Event)}function Nw(e,t){try{return e instanceof t}catch{return!1}}var W3=[!0,"true",1,"1","yes"],cm=e=>Fe(W3,e),Q3=[!1,"false",0,"0","no"];function ks(e,t,n,r,a){return t>n&&(r.warn("min cannot be greater than max."),t=n),an(e)?e>n?(r.warn(" cannot be greater than max: "+n+". Using max value instead."),n):t>e?(r.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(r.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+a),ks(a||n,t,n,r))}class X3{constructor(t){this.C={},this.I=t.I,this.R=ks(t.bucketSize,0,100,t.A),this.O=ks(t.refillRate,0,this.R,t.A),this.N=ks(t.refillInterval,0,864e5,t.A)}F(t,n){var r=Math.floor((n-t.lastAccess)/this.N);r>0&&(t.tokens=Math.min(t.tokens+r*this.O,this.R),t.lastAccess=t.lastAccess+r*this.N)}consumeRateLimit(t){var n,r=Date.now(),a=String(t),o=this.C[a];return o?this.F(o,r):this.C[a]=o={tokens:this.R,lastAccess:r},o.tokens===0||(o.tokens--,o.tokens===0&&((n=this.I)==null||n.call(this,t)),o.tokens===0)}stop(){this.C={}}}var Nr="Mobile",ah="iOS",ei="Android",Yl="Tablet",Cw=ei+" "+Yl,Ew="iPad",Aw="Apple",Tw=Aw+" Watch",Ac="Safari",Wl="BlackBerry",Mw="Samsung",Dw=Mw+"Browser",Lw=Mw+" Internet",Da="Chrome",K3=Da+" OS",Rw=Da+" "+ah,Nx="Internet Explorer",zw=Nx+" "+Nr,Cx="Opera",Z3=Cx+" Mini",Ex="Edge",Ow="Microsoft "+Ex,Il="Firefox",Bw=Il+" "+ah,Uc="Nintendo",Ic="PlayStation",Hl="Xbox",Pw=ei+" "+Nr,$w=Nr+" "+Ac,_c="Windows",Sg=_c+" Phone",Ay="Nokia",kg="Ouya",Fw="Generic",J3=Fw+" "+Nr.toLowerCase(),Uw=Fw+" "+Yl.toLowerCase(),jg="Konqueror",Iw="Oculus Browser",lh="Vivaldi",Hw="Yandex",oh="Whale",Ng="DuckDuckGo",qw="Pale Moon",ch="Waterfox",Tc="Brave",uh="Claude",dh="Codex",hh="ChatGPT",Vw="Google Search App",Xt="(\\d+(\\.\\d+)?)",um=new RegExp("Version/"+Xt),dm=new RegExp("("+uh+"|"+dh+"|"+hh+")\\/"+Xt),e4=new RegExp(Hl,"i"),t4=new RegExp(Ic+" \\w+","i"),n4=new RegExp(Uc+" \\w+","i"),Ax=new RegExp(Wl+"|PlayBook|BB10","i"),r4={"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"},Gw=function(e,t,n,r){t=t||"";var a=(function(o){return o!=null&&o.brave?Tc:null})(n);return a||(r!=null&&r.detectGoogleSearchApp&&Fe(e,"GSA/")?Vw:Fe(e," OPR/")&&Fe(e,"Mini")?Z3:Fe(e," OPR/")?Cx:Ax.test(e)?Wl:Fe(e,"IE"+Nr)||Fe(e,"WPDesktop")?zw:Fe(e,"OculusBrowser")?Iw:Fe(e,Dw)?Lw:Fe(e,Ex)||Fe(e,"Edg/")?Ow:Fe(e,lh+"/")?lh:Fe(e,"YaBrowser/")?Hw:Fe(e,oh+"/")?oh:Fe(e,Ng+"/")||Fe(e,"Ddg/")?Ng:Fe(e,uh+"/")?uh:Fe(e,dh+"/")?dh:Fe(e,hh+"/")?hh:Fe(e,"FBIOS")?"Facebook "+Nr:Fe(e,"UCWEB")||Fe(e,"UCBrowser")?"UC Browser":Fe(e,"CriOS")?Rw:Fe(e,"CrMo")||Fe(e,Da)?Da:Fe(e,ei)&&Fe(e,Ac)?Pw:Fe(e,"FxiOS")?Bw:Fe(e.toLowerCase(),jg.toLowerCase())?jg:Fe(e,Tc+"/")?Tc:((o,u)=>u&&Fe(u,Aw)||(function(h){return Fe(h,Ac)&&!Fe(h,Da)&&!Fe(h,ei)})(o))(e,t)?Fe(e,Nr)?$w:Ac:Fe(e,"PaleMoon/")?qw:Fe(e,ch+"/")?ch:Fe(e,Il)?Il:Fe(e,"MSIE")||Fe(e,"Trident/")?Nx:Fe(e,"Gecko")?Il:"")},s4={[zw]:[new RegExp("rv:"+Xt)],[Ow]:[new RegExp(Ex+"?\\/"+Xt)],[Da]:[new RegExp("("+Da+"|CrMo)\\/"+Xt)],[Rw]:[new RegExp("CriOS\\/"+Xt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Xt)],[Ac]:[um],[$w]:[um],[Cx]:[new RegExp("(Opera|OPR)\\/"+Xt)],[Il]:[new RegExp(Il+"\\/"+Xt)],[Bw]:[new RegExp("FxiOS\\/"+Xt)],[jg]:[new RegExp("Konqueror[:/]?"+Xt,"i")],[Wl]:[new RegExp(Wl+" "+Xt),um],[Pw]:[new RegExp("android\\s"+Xt,"i")],[Lw]:[new RegExp(Dw+"\\/"+Xt)],[Iw]:[new RegExp("OculusBrowser\\/"+Xt)],[lh]:[new RegExp(lh+"\\/"+Xt)],[Hw]:[new RegExp("YaBrowser\\/"+Xt)],[oh]:[new RegExp(oh+"\\/"+Xt)],[Tc]:[new RegExp(Tc+"\\/"+Xt)],[uh]:[dm],[dh]:[dm],[hh]:[dm],[Ng]:[new RegExp("(DuckDuckGo|Ddg)\\/"+Xt)],[qw]:[new RegExp("PaleMoon\\/"+Xt)],[ch]:[new RegExp(ch+"\\/"+Xt)],[Vw]:[new RegExp("GSA\\/"+Xt)],[Nx]:[new RegExp("(rv:|MSIE )"+Xt)],Mozilla:[new RegExp("rv:"+Xt)]},i4=function(e,t,n,r){var a=Gw(e,t,n,r),o=s4[a];if(ue(o))return null;for(var u=0;o.length>u;u++){var h=e.match(o[u]);if(h)return parseFloat(h[h.length-2])}return null},Ty=[[new RegExp(Hl+"; "+Hl+" (.*?)[);]","i"),e=>[Hl,e&&e[1]||""]],[new RegExp(Uc,"i"),[Uc,""]],[new RegExp(Ic,"i"),[Ic,""]],[Ax,[Wl,""]],[new RegExp(_c,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Sg,""];if(new RegExp(Nr).test(t)&&!/IEMobile\b/.test(t))return[_c+" "+Nr,""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var r=r4[n[1]]||"";return/arm/i.test(t)&&(r="RT"),[_c,r]}return[_c,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[ah,[e[3],e[4],e[5]||"0"].join(".")]:[ah,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=ue(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+ei+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+ei+")","i"),e=>e&&e[2]?[ei,[e[2],e[3],e[4]||"0"].join(".")]:[ei,""]],[/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/,[K3,""]],[/Linux|debian/i,["Linux",""]]],Yw=function(e){for(var t=0;Ty.length>t;t++){var n=Ty[t],r=n[1],a=n[0].exec(e),o=a&&(Un(r)?r(a,e):r);if(o)return o}return["",""]},My=function(e){return n4.test(e)?Uc:t4.test(e)?Ic:e4.test(e)?Hl:new RegExp(kg,"i").test(e)?kg:new RegExp("("+Sg+"|WPDesktop)","i").test(e)?Sg:/iPad/.test(e)?Ew:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?Tw:Ax.test(e)?Wl:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Ay,"i").test(e)?Ay:/(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(Nr).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)?ei:Cw:new RegExp("(pda|"+Nr+")","i").test(e)?J3:new RegExp(Yl,"i").test(e)&&!new RegExp(Yl+" pc","i").test(e)?Uw:""},a4=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Dy(e,t){return typeof(n=e)=="string"&&a4.test(n)?e:t();var n}function Ww(e,t){var n=new Error(t);try{Object.defineProperty(n,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch{}return n}function Vi(e){return e&&e.split("#")[0]}function Tx(e,t){var n=setTimeout(e,t);return n!=null&&n.unref&&(n==null||n.unref()),n}function Ly(e,t,n){return Qw.apply(this,arguments)}function Qw(){return(Qw=$t((function*(e,t,n){var r;try{return yield Promise.race([e,new Promise(((a,o)=>{r=Tx((()=>{try{n==null||n(),a()}catch(u){o(u)}}),t)}))])}finally{clearTimeout(r)}}))).apply(this,arguments)}var ac,Xw="NativeGzipValidationError",Cg=e=>e.length>=2&&e[0]===31&&e[1]===139,Ry=(e,t)=>e===yg.GZipJS||t===yg.GZipJS||t==="gzip",zy=e=>!(!e||typeof e!="object")&&("name"in e?String(e.name):"")==="NotReadableError",jd=e=>{throw Ww(Xw,"Native gzip produced invalid output: "+e)},l4=(function(){var e=$t((function*(t,n){18>t.size&&jd("too-short");var r=new Uint8Array(yield t.slice(0,10).arrayBuffer());Cg(r)&&r[2]===8||jd("invalid-header");var a=new DataView(yield t.slice(t.size-8).arrayBuffer());a.getUint32(0,!0)!==(u=>{for(var h=(()=>{if(ac)return ac;ac=[];for(var m=0;256>m;m++){for(var x=m,b=0;8>b;b++)x=1&x?3988292384^x>>>1:x>>>1;ac[m]=x>>>0}return ac})(),f=4294967295,p=0;u.length>p;p++)f=h[255&(f^u[p])]^f>>>8;return(4294967295^f)>>>0})(n)&&jd("invalid-crc");var o=n.length>>>0;a.getUint32(4,!0)!==o&&jd("invalid-size")}));return function(t,n){return e.apply(this,arguments)}})();function Eg(){return Eg=$t((function*(e,t,n){t===void 0&&(t=!0);try{var r=new TextEncoder().encode(e),a=new globalThis.CompressionStream("gzip"),o=a.writable.getWriter(),u=o.write(r).then((()=>o.close())).catch((function(){var p=$t((function*(m){try{yield o.abort(m)}catch{}throw m}));return function(m){return p.apply(this,arguments)}})()),h=new Response(a.readable).blob(),f=(yield Promise.all([h,u]))[0];return yield l4(f,r),f}catch(p){if(n!=null&&n.rethrow)throw p;return t&&console.error("Failed to gzip compress data",p),null}})),Eg.apply(this,arguments)}var Oy=9223372036854776e3,o4="9223372036854775808",c4={}.propertyIsEnumerable;function fh(e,t){try{return Kw(e,t,{ancestors:new WeakSet,remainingNodes:U3},0)}catch{return[]}}function Mx(e,t,n,r){if(0>=n.remainingNodes)return{stringValue:_g};if(n.remainingNodes--,Kn(e))return{boolValue:e};if(typeof e=="bigint")return(function(f,p){var m=f.toString(),x=BigInt(o4);return f>=x||-x>f?(p==null||p.debug("Attribute "+m+" is outside the int64 range; encoding it as a string"),{stringValue:m}):{intValue:m}})(e,t);if(typeof e=="number"){if(!Number.isFinite(e))return{stringValue:String(e)};if(Number.isInteger(e)){if(Number.isSafeInteger(e))return{intValue:String(e)};if(typeof BigInt>"u")return{stringValue:String(e)};var a=BigInt(e).toString();return e>=Oy||-Oy>e?(t==null||t.debug("Attribute "+a+" is outside the int64 range; encoding it as a string"),{stringValue:a}):{intValue:a}}return{doubleValue:e}}if(typeof e=="string")return{stringValue:Ul(e)};if(typeof e=="function")return{stringValue:H3};if(typeof e=="symbol")return{stringValue:String(e)};if(typeof e=="object"&&e!==null){if(n.ancestors.has(e))return{stringValue:I3};if(r>=F3)return{stringValue:_g};if(e instanceof Date){var o=e.getTime(),u=Number.isFinite(o)?e.toISOString():String(e);return{stringValue:typeof u=="string"?Ul(u):String(u)}}n.ancestors.add(e);try{try{var h=e.toJSON;if(typeof h=="function")return Mx(h.call(e),t,n,r+1)}catch{}return Be(e)?{arrayValue:{values:u4(e,t,n,r+1)}}:{kvlistValue:{values:Kw(e,t,n,r+1)}}}finally{n.ancestors.delete(e)}}return{stringValue:Ul(String(e))}}function u4(e,t,n,r){for(var a=[],o=Math.min(e.length,yw),u=0;o>u&&n.remainingNodes>0;u++)try{var h=u in e?e[u]:void 0;if(Ge(h))continue;a.push(Mx(h,t,n,r))}catch{a.push({stringValue:Fh})}return e.length>u&&a.push({stringValue:_g}),a}function Kw(e,t,n,r){var a=[];for(var o in e)if(c4.call(e,o)){if(!o){t==null||t.debug("Dropping an attribute with an empty key");continue}if(a.length>=yw||0>=n.remainingNodes){t==null||t.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{var u=e[o];if(sn(u)||ue(u))continue;a.push({key:Ul(o),value:Mx(u,t,n,r)})}catch{a.push({key:Ul(o),value:{stringValue:Fh}})}}return a}function Zw(e,t,n){return de({},e.resourceAttributes,{"service.name":e.serviceName||"unknown_service"},e.environment&&{"deployment.environment":e.environment},e.serviceVersion&&{"service.version":e.serviceVersion},{"telemetry.sdk.name":t,"telemetry.sdk.version":n})}var By={darwin:"macOS",win32:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",aix:"AIX","Mac OS X":"macOS"},Jw={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},d4=Jw.info;function h4(e){try{return Ul(String(e))}catch{return Fh}}function f4(e,t,n,r){var a,o=Jw[e.level||"info"]||d4,u=o.text,h=o.number,f=((a=an(r)?r:void 0)===void 0&&(a=Date.now()),String(a)+"000000"),p={};t.distinctId&&(p.posthogDistinctId=t.distinctId),t.sessionId&&(p.sessionId=t.sessionId),t.windowId&&(p["window.id"]=t.windowId),Ge(t.sessionStartTimestamp)||(p.sessionStartTimestamp=String(t.sessionStartTimestamp)),Ge(t.lastActivityTimestamp)||(p.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(p["url.full"]=t.currentUrl),t.screenName&&(p["screen.name"]=t.screenName),t.appState&&(p["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(p.feature_flags=t.activeFeatureFlags);var m=de({},p),x=e.attributes;if(x){var b=[];try{b=Object.keys(x)}catch{b=[]}for(var y of b){var _=void 0;try{_=x[y]}catch{_=Fh}Object.defineProperty(m,y,{value:_,enumerable:!0,writable:!0,configurable:!0})}}var j={timeUnixNano:f,observedTimeUnixNano:f,severityNumber:h,severityText:u,body:{stringValue:h4(e.body)},attributes:fh(m,n)};return e.trace_id&&(j.traceId=e.trace_id),e.span_id&&(j.spanId=e.span_id),ue(e.trace_flags)||(j.flags=e.trace_flags),j}function e2(e,t,n){return Zw(e,t,n)}function t2(e,t,n,r){return{resourceLogs:[{resource:{attributes:fh(t)},scopeLogs:[{scope:{name:n,version:r},logRecords:e}]}]}}let p4=class{constructor(e,t,n,r,a,o,u){var h;o===void 0&&(o=()=>Promise.resolve()),this._instance=e,this.gn=t,this.A=n,this.Pn=r,this.Fn=a,this.Dn=o,this.$n=u,this.Nn=null,this.qn=0,this.jn=0,this.Bn=0,this.Hn=0,this.zn=0,this.Un=!1,this.Wn=t.maxBufferSize,this.Vn=Math.max((h=t.maxQueueSize)!==null&&h!==void 0?h:t.maxBufferSize,t.maxBufferSize),this.Gn=t.flushIntervalMs,this.Zn=t.maxBatchRecordsPerPost,this.Qn=t.rateCapWindowMs,this.Jn=t.maxLogsPerInterval}clearQueue(){this.jn++,this._instance.setPersistedProperty(_s.LogsQueue,[])}reset(){this.Kn(),this.Hn=0,this.zn=0,this.Un=!1,this.Bn=0,this.Zn=this.gn.maxBatchRecordsPerPost}onReconnect(){this.Bn=0,this.Yn()}captureLog(e,t){var n;if(!this._instance.isDisabled&&!this._instance.optedOut&&e!=null&&e.body){var r=this.Xn(e);if(r!==null)if(r.body){if(this.ts()){var a={record:f4(r,(n=t==null?void 0:t.context)!==null&&n!==void 0?n:this.Pn(),this.A,t==null?void 0:t.occurredAtMs)};this.Fn((()=>this.es(a)))}}else this.A.info("Log was rejected in beforeSend function")}}Xn(e){var t=this.gn.beforeSend;if(!t)return e;var n=Be(t)?t:[t],r=e;for(var a of n)try{var o=a(r);if(!o)return this.A.info("Log was rejected in beforeSend function"),null;r=o}catch(u){return this.A.error("Error in beforeSend function for log:",u),null}return r}ts(){if(this.Jn===void 0)return!0;var e=Date.now(),t=e-this.Hn;return this.Qn>t&&t>=0||(this.Hn=e,this.zn=0,this.Un=!1),this.Jn>this.zn?(this.zn++,!0):(this.Un||(this.A.warn("captureLog dropping logs: exceeded "+this.Jn+" logs per "+this.Qn+"ms"),this.Un=!0),!1)}flush(){var e=this;return $t((function*(){if(!e._instance.isDisabled)return e.Nn||(e.Nn=e.rs().finally((()=>{e.Nn=null}))),e.Nn}))()}rs(){var e=this;return $t((function*(){var t;e.Kn();var n=(t=e._instance.getPersistedProperty(_s.LogsQueue))!==null&&t!==void 0?t:[];if(n.length!==0)for(var r=n.length,a=0;n.length>0&&r>a;){var o,u,h=e.jn;e.qn=0;var f=Math.min(n.length,e.Zn),p=n.slice(0,f),m=t2(p.map((b=>b.record)),e.ns(),(o=e.$n)!==null&&o!==void 0?o:e._instance.getLibraryId(),e._instance.getLibraryVersion()),x=yield e._instance.ss(m);if(e.jn!==h)return;if(x.kind==="too-large"&&p.length>1)e.Zn=Math.max(1,Math.floor(p.length/2)),e.A.warn("Received 413 when sending logs batch of size "+p.length+", reducing batch size to "+e.Zn);else if(x.kind==="retry-later"||(x.kind==="too-large"?e.A.warn("Dropping a single log record after 413 with batch size 1 — the record is larger than the server cap and cannot be split further."):x.kind==="ok"&&e.gn.maxBatchRecordsPerPost>e.Zn&&(e.Zn=Math.min(e.gn.maxBatchRecordsPerPost,e.Zn+1)),yield e.os(p.length),n=(u=e._instance.getPersistedProperty(_s.LogsQueue))!==null&&u!==void 0?u:[],a+=p.length,x.kind==="fatal"))throw x.error}}))()}os(e){var t=this;return $t((function*(){var n,r=Math.max(0,e-t.qn),a=(n=t._instance.getPersistedProperty(_s.LogsQueue))!==null&&n!==void 0?n:[];t._instance.setPersistedProperty(_s.LogsQueue,a.slice(r)),yield t.Dn()}))()}ns(){return e2(this.gn,this._instance.getLibraryId(),this._instance.getLibraryVersion())}es(e){var t;if(!this._instance.optedOut){var n=(t=this._instance.getPersistedProperty(_s.LogsQueue))!==null&&t!==void 0?t:[];this.Vn>n.length||(n.shift(),this.qn++,this.A.info("Logs queue is full, dropping oldest record.")),n.push(e),this._instance.setPersistedProperty(_s.LogsQueue,n),this.Wn>n.length?this.ls():this.Yn()}}ls(e){e===void 0&&(e=this.Gn),this.us||(this.us=Tx((()=>{this.us=void 0,this.Yn()}),e))}hs(){var e=Math.min(Math.max(0,this.Bn-1),6);return this.Gn*Math.pow(2,e)}ds(){var e=this._instance.getPersistedProperty(_s.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return $t((function*(){t.Kn();var n=t.flush().catch((()=>{}));e!==void 0?yield Ly(n,e):yield n}))()}flushWithTimeout(e){var t=this;return $t((function*(){var n=t.flush();yield Ly(n,e,(()=>{n.catch((()=>{}))}))}))()}Yn(){this.flush().then((()=>{this.Bn=0}),(e=>{this.Bn++,this.A.error("PostHog logs flush failed:",e)})).finally((()=>{!this._instance.isDisabled&&this.ds()&&this.ls(this.hs())}))}Kn(){this.us&&(clearTimeout(this.us),this.us=void 0)}};var hm=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Py(e){return String(e)+"000000"}function $y(e,t,n,r){var a="";return r&&(a=Object.keys(r).sort().map((o=>JSON.stringify(o)+":"+JSON.stringify(r[o]))).join(",")),e+"\0"+t+"\0"+(n??"")+"\0"+a}let m4=class{constructor(e,t,n){this._instance=e,this.gn=t,this.A=n,this.vs=new Map,this.Nn=null,this.cs=!1,this.fs=new Map,this.ps=new Set,this.gs=0}count(e,t,n){t===void 0&&(t=1),this.ys({name:e,type:"count",value:t,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}gauge(e,t,n){this.ys({name:e,type:"gauge",value:t,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}histogram(e,t,n){this.ys({name:e,type:"histogram",value:t,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}flush(){var e=this,t=this.Nn,n=(function(){var a=$t((function*(){t&&(yield t.catch((()=>{}))),yield e.bs()}));return function(){return a.apply(this,arguments)}})(),r=n().finally((()=>{this.Nn===r&&(this.Nn=null)}));return this.Nn=r,r}drainWindow(){if(this.vs.size===0)return null;var e=this.vs;return this.vs=new Map,this.cs=!1,this.fs=new Map,this.ps=new Set,this._s(e)}reset(){this.gs++,this.Kn(),this.vs=new Map,this.Nn=null,this.cs=!1,this.fs=new Map,this.ps=new Set}ys(e){if(!this._instance.isDisabled&&!this._instance.optedOut){var t=this.Xn(e);if(t!==null)if(t.name&&typeof t.name=="string")if(typeof t.value=="number"&&Number.isFinite(t.value))if(t.type==="count"&&0>t.value)this.A.warn("Dropping count '"+t.name+"': counters are monotonic, value must be >= 0");else{var n,r;try{n=t.attributes?de({},t.attributes):void 0,r=$y(t.type,t.name,t.unit,n)}catch(u){return void this.A.warn("Dropping metric '"+t.name+"': attributes could not be serialized",u)}var a=this.vs.get(r);if(!a){if(!this.ws())return;a={name:t.name,type:t.type,unit:t.unit,attributes:n,windowStartMs:Date.now()},this.vs.set(r,a)}var o=this.fs.get(t.name);o===void 0?this.fs.set(t.name,t.type):o===t.type||this.ps.has(t.name)||(this.ps.add(t.name),this.A.warn("Metric name '"+t.name+"' is already used as a "+o+"; recording it as a "+t.type+" too will blend both series in charts. Use a distinct name.")),this.ks(a,t.value),this.ls()}else this.A.warn("Dropping metric '"+t.name+"': value must be a finite number");else this.A.warn("Dropping metric with empty name")}}ws(){return this.gn.maxSeriesPerFlush>this.vs.size||(this.cs||(this.cs=!0,this.A.warn("Metric series cap reached ("+this.gn.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}ks(e,t){var n;switch(e.type){case"count":e.total=((n=e.total)!==null&&n!==void 0?n:0)+t;break;case"gauge":e.last=t;break;case"histogram":e.hist||(e.hist={count:0,sum:0,min:t,max:t,bucketCounts:new Array(hm.length+1).fill(0)});var r=e.hist;r.count+=1,r.sum+=t,r.min=Math.min(r.min,t),r.max=Math.max(r.max,t),r.bucketCounts[(function(a,o){for(var u=0;o.length>u;u++)if(o[u]>=a)return u;return o.length})(t,hm)]+=1}}Xn(e){var t=this.gn.beforeSend;if(!t)return e;var n=Be(t)?t:[t],r=e;for(var a of n)try{var o=a(r);if(!o)return this.A.info("Metric was rejected in beforeSend function"),null;r=o}catch(u){return this.A.error("Error in beforeSend function for metric:",u),null}return r}ls(){this.us||(this.us=Tx((()=>{this.us=void 0,this.flush().catch((e=>{this.A.error("Metrics flush failed:",e)}))}),this.gn.flushIntervalMs))}Kn(){this.us&&(clearTimeout(this.us),this.us=void 0)}bs(){var e=this;return $t((function*(){if(e.vs.size!==0){var t=e.vs;e.vs=new Map,e.cs=!1,e.fs=new Map,e.ps=new Set;var n=e.gs,r=yield e._instance.Ss(e._s(t));if(n===e.gs)switch(r.kind){case"ok":return;case"retry-later":return e.xs(t),void e.ls();case"too-large":return void e.A.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e.A.error("Failed to send metrics batch:",r.error)}}}))()}_s(e){return t=this.Cs(e),n=(function(o,u,h){return Zw(o,u,h)})(this.gn,this._instance.getLibraryId(),this._instance.getLibraryVersion()),r=this._instance.getLibraryId(),a=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:fh(n)},scopeMetrics:[{scope:{name:r,version:a},metrics:t}]}]};var t,n,r,a}Cs(e){var t=Py(Date.now()),n=new Map;for(var r of e.values()){var a,o=$y(r.type,r.name,r.unit,void 0),u=n.get(o);u||(u=de({name:r.name},r.unit&&{unit:r.unit}),r.type==="count"?u.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:r.type==="gauge"?u.gauge={dataPoints:[]}:u.histogram={aggregationTemporality:1,dataPoints:[]},n.set(o,u));var h=fh((a=r.attributes)!==null&&a!==void 0?a:{},this.A),f=Py(r.windowStartMs);if(r.type==="count"){var p,m={attributes:h,startTimeUnixNano:f,timeUnixNano:t,asDouble:(p=r.total)!==null&&p!==void 0?p:0};u.sum.dataPoints.push(m)}else if(r.type==="gauge"){var x,b={attributes:h,timeUnixNano:t,asDouble:(x=r.last)!==null&&x!==void 0?x:0};u.gauge.dataPoints.push(b)}else r.hist&&u.histogram.dataPoints.push({attributes:h,startTimeUnixNano:f,timeUnixNano:t,count:r.hist.count,sum:r.hist.sum,min:r.hist.min,max:r.hist.max,bucketCounts:r.hist.bucketCounts,explicitBounds:hm})}return Array.from(n.values())}xs(e){var t,n;for(var r of e){var a=r[0],o=r[1],u=this.vs.get(a);if(u)switch(u.windowStartMs=Math.min(u.windowStartMs,o.windowStartMs),u.type){case"count":u.total=((t=u.total)!==null&&t!==void 0?t:0)+((n=o.total)!==null&&n!==void 0?n:0);break;case"gauge":break;case"histogram":if(o.hist)if(u.hist){u.hist.count+=o.hist.count,u.hist.sum+=o.hist.sum,u.hist.min=Math.min(u.hist.min,o.hist.min),u.hist.max=Math.max(u.hist.max,o.hist.max);for(var h=0;u.hist.bucketCounts.length>h;h++)u.hist.bucketCounts[h]+=o.hist.bucketCounts[h]}else u.hist=o.hist}else this.ws()&&this.vs.set(a,o)}}};var Nd,Fy,fm;function g4(e){var t=globalThis._posthogChunkIds;if(t){var n=Object.keys(t);return fm&&n.length===Fy||(Fy=n.length,fm=n.reduce(((r,a)=>{Nd||(Nd={});var o=Nd[a];if(o)r[o[0]]=o[1];else for(var u=e(a),h=u.length-1;h>=0;h--){var f=u[h],p=f==null?void 0:f.filename,m=t[a];if(p&&m){r[p]=m,Nd[a]=[p,m];break}}return r}),{})),fm}}class x4{constructor(t,n,r){r===void 0&&(r=[]),this.coercers=t,this.stackParser=n,this.modifiers=r}buildFromUnknown(t,n){n===void 0&&(n={});var r=n&&n.mechanism||{handled:!0,type:"generic"},a=this.buildCoercingContext(r,n,0).apply(t),o=this.buildParsingContext(n),u=this.parseStacktrace(a,o);return{$exception_list:this.convertToExceptionList(u,r),$exception_level:"error"}}modifyFrames(t){var n=this;return $t((function*(){for(var r of t)r.stacktrace&&r.stacktrace.frames&&Be(r.stacktrace.frames)&&(r.stacktrace.frames=yield n.applyModifiers(r.stacktrace.frames));return t}))()}coerceFallback(t){var n;return{type:"Error",value:"Unknown error",stack:(n=t.syntheticException)==null?void 0:n.stack,synthetic:!0}}parseStacktrace(t,n){var r,a;return t.cause!=null&&(r=this.parseStacktrace(t.cause,n)),t.stack!=""&&t.stack!=null&&(a=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?n.skipFirstLines:0),n.chunkIdMap)),de({},t,{cause:r,stack:a})}applyChunkIds(t,n){return t.map((r=>(r.filename&&n&&(r.chunk_id=n[r.filename]),r)))}applyCoercers(t,n){for(var r of this.coercers)if(r.match(t))return r.coerce(t,n);return this.coerceFallback(n)}applyModifiers(t){var n=this;return $t((function*(){var r=t;for(var a of n.modifiers)r=yield a(r);return r}))()}convertToExceptionList(t,n){var r,a,o,u={type:t.type,value:t.value,mechanism:{type:(r=n.type)!==null&&r!==void 0?r:"generic",handled:(a=n.handled)===null||a===void 0||a,synthetic:(o=t.synthetic)!==null&&o!==void 0&&o}};t.stack&&(u.stacktrace={type:"raw",frames:t.stack});var h=[u];return t.cause!=null&&h.push(...this.convertToExceptionList(t.cause,de({},n,{handled:!0}))),h}buildParsingContext(t){var n;return{chunkIdMap:g4(this.stackParser),skipFirstLines:(n=t.skipFirstLines)!==null&&n!==void 0?n:1}}buildCoercingContext(t,n,r){r===void 0&&(r=0);var a=(o,u)=>{if(4>=u){var h=this.buildCoercingContext(t,n,u);return this.applyCoercers(o,h)}};return de({},n,{syntheticException:r==0?n.syntheticException:void 0,mechanism:t,apply:o=>a(o,r),next:o=>a(o,r+1)})}}var Ql="?";function Ag(e,t,n,r,a){var o={platform:e,filename:t,function:n==="<anonymous>"?Ql:n,in_app:!(t!=null&&t.startsWith("webkit-masked-url://"))&&t!=="<anonymous>"};return ue(r)||(o.lineno=r),ue(a)||(o.colno=a),o}var n2=(e,t)=>{var n=e.indexOf("safari-extension")!==-1,r=e.indexOf("safari-web-extension")!==-1;return n||r?[e.indexOf("@")!==-1?e.split("@")[0]:Ql,n?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},v4=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,b4=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,y4=/\((\S*)(?::(\d+))(?::(\d+))\)/,_4=(e,t)=>{var n=v4.exec(e);if(n)return Ag(t,n[1],Ql,+n[2],+n[3]);var r=b4.exec(e);if(r){if(r[2]&&r[2].indexOf("eval")===0){var a=y4.exec(r[2]);a&&(r[2]=a[1],r[3]=a[2],r[4]=a[3])}var o=n2(r[1]||Ql,r[2]);return Ag(t,o[1],o[0],r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},w4=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,S4=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,k4=(e,t)=>{var n=w4.exec(e);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){var r=S4.exec(n[3]);r&&(n[1]=n[1]||"eval",n[3]=r[1],n[4]=r[2],n[5]="")}var a=n[3],o=n[1]||Ql,u=n2(o,a);return Ag(t,a=u[1],o=u[0],n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},Uy=/\(error: (.*)\)/;class j4{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,n){var r=ct(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:r?t.stack:void 0,cause:t.cause?n.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var n=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?n+": "+t.message:n}isDOMException(t){return ih(t,"DOMException")}isDOMError(t){return ih(t,"DOMError")}}class N4{match(t){return jw(t)}coerce(t,n){var r,a=this.getStack(t),o=a===void 0;return{type:this.getType(t),value:this.getMessage(t,n),stack:a??((r=n.syntheticException)==null?void 0:r.stack),cause:t.cause?n.next(t.cause):void 0,synthetic:o}}getType(t){return t.name||t.constructor.name}getMessage(t,n){var r=t.message;return String(r.error&&typeof r.error.message=="string"?r.error.message:r)}getStack(t){return t.stacktrace||t.stack||void 0}}class C4{constructor(){}match(t){return!!ih(t,"ErrorEvent")&&(t.error!=null||this.Wi(t))}coerce(t,n){var r;if(t.error!=null)return n.apply(t.error);var a=n.apply(t.message);return de({},a,{stack:(r=this.Vi(t))!==null&&r!==void 0?r:a.stack,synthetic:!0})}Wi(t){return ct(t.message)&&t.message.length>0}Vi(t){var n,r,a=t,o=(n=a.lineno)!==null&&n!==void 0?n:0,u=(r=a.colno)!==null&&r!==void 0?r:0;if(ct(a.filename)&&a.filename.length!==0&&o!==0)return`Error
67
+ at `+a.filename+":"+o+":"+u}}var E4=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class A4{match(t){return typeof t=="string"}coerce(t,n){var r,a=this.getInfos(t),o=a[0],u=a[1];return{type:o??"Error",value:u??t,stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}getInfos(t){var n="Error",r=t,a=t.match(E4);return a&&(n=a[1],r=a[2]),[n,r]}}var T4=["fatal","error","warning","log","info","debug"];function r2(e,t){t===void 0&&(t=40);var n=Object.keys(e);if(n.sort(),!n.length)return"[object has no keys]";for(var r=n.length;r>0;r--){var a=n.slice(0,r).join(", ");if(t>=a.length)return r===n.length?a:a.length>t?a.slice(0,t)+"...":a}return""}class M4{match(t){return typeof t=="object"&&t!==null}coerce(t,n){var r,a,o=this.getErrorPropertyFromObject(t);return o?n.apply(o):{type:this.getType(t),value:this.getValue(t),stack:(r=this.getStack(t))!==null&&r!==void 0?r:(a=n.syntheticException)==null?void 0:a.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){if(jx(t))return t.constructor.name;var n="name"in t?t.name:void 0;return ct(n)&&!Ec(n)?n:"Error"}getValue(t){if("name"in t&&typeof t.name=="string"){var n="'"+t.name+"' captured as exception";return"message"in t&&typeof t.message=="string"&&(n+=" with message: '"+t.message+"'"),n}if("message"in t&&typeof t.message=="string")return t.message;var r=this.getObjectClassName(t);return(r&&r!=="Object"?"'"+r+"'":"Object")+" captured as exception with keys: "+r2(t)}isSeverityLevel(t){return ct(t)&&!Ec(t)&&T4.indexOf(t)>=0}getStack(t){try{return ct(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:ct(t.stack)&&t.stack.length>0?t.stack:void 0}catch{return}}getErrorPropertyFromObject(t){for(var n in t)if({}.hasOwnProperty.call(t,n)){var r=t[n];if(jw(r))return r}}getObjectClassName(t){try{var n=Object.getPrototypeOf(t);return n?n.constructor.name:void 0}catch{return}}}class D4{match(t){return jx(t)}coerce(t,n){var r,a=t.constructor.name;return{type:a,value:a+" captured as exception with keys: "+r2(t),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class L4{match(t){return kw(t)}coerce(t,n){var r;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class R4{match(t){return ih(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!jx(t))return!1;try{var n=t.detail;return n!=null&&typeof n=="object"&&"reason"in n}catch{return!1}}coerce(t,n){var r,a=this.getUnhandledRejectionReason(t);return kw(a)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(a),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}:n.apply(a)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&t.detail!=null&&typeof t.detail=="object"&&"reason"in t.detail)return t.detail.reason}catch{}return t}}var ph="$message",mh="$timestamp",z4=new Set([ph,mh]),pm={enabled:!0,max_bytes:32768};function gh(e){var t;return e?{enabled:(t=e.enabled)!==null&&t!==void 0?t:pm.enabled,max_bytes:B4(e.max_bytes,pm.max_bytes)}:de({},pm)}class O4{constructor(t){this.Ts=[],this.Ms=0,this.gn=gh(t)}setConfig(t){this.gn=gh(t),this.Es()}add(t){var n=(function(a){var o;try{o=_w(a)}catch{return}try{var u=JSON.parse(o);if(!pt(u))return;var h=u,f=h[ph],p=h[mh];return!ct(f)||f.trim().length===0||!ct(p)&&!an(p)?void 0:{step:h,json:o}}catch{return}})(t);if(n){var r=(function(a){if(typeof TextEncoder<"u")return new TextEncoder().encode(a).length;for(var o=encodeURIComponent(a),u=0,h=0;o.length>h;h++)o[h]==="%"?(u+=1,h+=2):u+=1;return u})(n.json);r>this.gn.max_bytes||(this.Ts.push({step:n.step,bytes:r}),this.Ms+=r,this.Es())}}getAttachable(){return this.Ts.map((t=>t.step))}clear(){this.Ts=[],this.Ms=0}size(){return this.Ts.length}Es(){for(;this.Ms>this.gn.max_bytes&&this.Ts.length>0;){var t=this.Ts.shift();t&&(this.Ms-=t.bytes)}}}function B4(e,t){if(!an(e)||e===1/0||e===-1/0)return t;var n=Math.floor(e);return 0>n?t:n}var s2=function(e,t){var n=(t===void 0?{}:t).debugEnabled,r={q(a){if(ne&&(Bt.DEBUG||ne.POSTHOG_DEBUG||n)&&!ue(ne.console)&&ne.console){for(var o=("__rrweb_original__"in ne.console[a])?ne.console[a].__rrweb_original__:ne.console[a],u=arguments.length,h=new Array(u>1?u-1:0),f=1;u>f;f++)h[f-1]=arguments[f];o(e,...h)}},debug(){for(var a=arguments.length,o=new Array(a),u=0;a>u;u++)o[u]=arguments[u];r.q("debug",...o)},info(){for(var a=arguments.length,o=new Array(a),u=0;a>u;u++)o[u]=arguments[u];r.q("log",...o)},warn(){for(var a=arguments.length,o=new Array(a),u=0;a>u;u++)o[u]=arguments[u];r.q("warn",...o)},error(){for(var a=arguments.length,o=new Array(a),u=0;a>u;u++)o[u]=arguments[u];r.q("error",...o)},critical(){for(var a=arguments.length,o=new Array(a),u=0;a>u;u++)o[u]=arguments[u];console.error(e,...o)},uninitializedWarning(a){r.error("You must initialize PostHog before calling "+a)},createLogger:(a,o)=>s2(e+" "+a,o)};return r},be=s2("[PostHog.js]"),Vt=be.createLogger,P4=Vt("[ExternalScriptsLoader]"),xh=e=>{var t=pe==null?void 0:pe.querySelectorAll("script");if(t){for(var n=0;t.length>n;n++)if(t[n].src===e||t[n].getAttribute("src")===e)return t[n]}},Ca=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return P4.warn(t+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var r=xh(t);if(r){if(r.__posthog_loading_callback_fired)return n();var a=r.__posthog_loading_error;return a?n(a):(r.addEventListener("load",(u=>{r.__posthog_loading_callback_fired=!0,n(void 0,u)})),void r.addEventListener("error",(u=>{r.__posthog_loading_error=u,n(u)})))}var o=()=>{if(!pe)return n("document not found");if(xh(t))return Ca(e,t,n);var u=pe.createElement("script");if(u.type="text/javascript",u.crossOrigin="anonymous",u.src=t,u.onload=p=>{u.__posthog_loading_callback_fired=!0,n(void 0,p)},u.onerror=p=>{u.__posthog_loading_error=p,n(p)},e.config.prepare_external_dependency_script&&(u=e.config.prepare_external_dependency_script(u)),!u)return n("prepare_external_dependency_script returned null");if(e.config.external_scripts_inject_target==="head")pe.head.appendChild(u);else{var h,f=pe.querySelectorAll("body > script");f.length>0?(h=f[0].parentNode)==null||h.insertBefore(u,f[0]):pe.body.appendChild(u)}};pe!=null&&pe.body?o():pe==null||pe.addEventListener("DOMContentLoaded",o)},mm={},Iy=(e,t)=>{var n="/static/"+t+".js?v="+e.version;if(t==="toolbar"){var r=3e5;n=n+"&t="+Math.floor(Date.now()/r)*r}return e.requestRouter.endpointFor("assets",n)};Me.__PosthogExtensions__=Me.__PosthogExtensions__||{},Me.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{if(t!=="remote-config"){var r=e.config.strict_script_versioning;if(r){var a=e.requestRouter.endpointFor("assets","/static/"+e.version+"/"+t+".js"),o=mm[a];if(r==="fallback"&&o){if(xh(o))return void Ca(e,o,n);delete mm[a]}Ca(e,a,r==="fallback"?(h,f)=>{if(h)if(typeof h=="string")n(h);else{var p,m=Iy(e,t);mm[a]=m;var x=xh(a);x==null||(p=x.parentNode)==null||p.removeChild(x),Ca(e,m,n)}else n(void 0,f)}:n)}else Ca(e,Iy(e,t),n)}else{var u=e.requestRouter.endpointFor("assets","/array/"+e.config.token+"/config.js");Ca(e,u,n)}},Me.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{var r=e.requestRouter.endpointFor("api",t);Ca(e,r,n)};Bt.DEBUG=!1,Bt.LIB_VERSION="1.424.1",Bt.LIB_NAME="web";var i2="$people_distinct_id",En="distinct_id",Hc="$device_id",gm="$device_model",Pl="__alias",wc="__timers",Tg="$autocapture_disabled_server_side",Mg="$heatmaps_enabled_server_side",Dg="$exception_capture_enabled_server_side",Lg="$error_tracking_suppression_rules",Rg="$error_tracking_capture_extension_exceptions",zg="$web_vitals_enabled_server_side",Dx="$dead_clicks_enabled_server_side",Lx="$product_tours_enabled_server_side",Og="$logs_capture_enabled_server_side",Bg="$web_vitals_allowed_metrics",Ma="$session_recording_remote_config",a2="$replay_sample_rate",l2="$replay_override_sampling",o2="$replay_override_linked_flag",c2="$replay_override_url_trigger",u2="$replay_override_event_trigger",$l="$sesid",Rx="$session_is_sampled",Xn="$enabled_feature_flags",Gr="$active_feature_flags",Wd="$early_access_features",Ui="$feature_flag_details",ss="$feature_flag_payloads",Ii="$feature_flag_request_id",ql="$minimal_flag_called_events",ys="$override_feature_flags",Ea="$override_feature_flag_payloads",wr="$stored_person_properties",Ss="$stored_group_properties",d2="$groups",Pg="$surveys",vh="$surveys_loaded_at",$g="$surveys_activated",Qd="$surveys_activated_session",Xd="$surveys_activated_timestamps",Sc="ph_product_tours",Ks="$flag_call_reported",kc="$flag_call_reported_session_id",Vl="$feature_flag_errors",ti="$feature_flag_evaluated_at",Je="$user_state",Fg="$client_session_props",Ug="$capture_rate_limit",Ig="$initial_campaign_params",Hg="$initial_referrer_info",bh="$initial_person_info",yh="$epp",jl="$posthog_cookieless",h2="$cookieless_mode",f2="$sdk_debug_extensions_init_method",p2="$sdk_debug_extensions_init_time_ms",qg="$sdk_debug_recording_script_not_loaded",zx="PostHog loadExternalDependency extension not found.",Fi="on_reject",Zs="always",cn="anonymous",zn="identified",Vg="identified_only",Xl="visibilitychange",_h="beforeunload",zl="$pageview",xm="$pageleave",vm="$identify",Hy="$groupidentify";function Cd(e,t){Be(e)&&e.forEach(t)}function jt(e,t){if(!Ge(e))if(Be(e))e.forEach(t);else if(V3(e))e.forEach(((r,a)=>t(r,a)));else for(var n in e)Sw.call(e,n)&&t(e[n],n)}var Pt=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;t>r;r++)n[r-1]=arguments[r];for(var a of n)for(var o in a)a[o]!==void 0&&(e[o]=a[o]);return e};function Kd(e){for(var t=Object.keys(e),n=t.length,r=new Array(n);n--;)r[n]=[t[n],e[t[n]]];return r}var qy=function(e){try{return e()}catch{return}},$4=function(e){return function(){try{for(var t=arguments.length,n=new Array(t),r=0;t>r;r++)n[r]=arguments[r];return e.apply(this,n)}catch(a){be.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),be.critical(a)}}},Ox=function(e){var t={};return jt(e,(function(n,r){(ct(n)&&n.length>0||an(n))&&(t[r]=n)})),t},F4=["herokuapp.com","vercel.app","netlify.app"];function U4(e){var t=e==null?void 0:e.hostname;if(!ct(t))return!1;var n=t.split(".").slice(-2).join(".");for(var r of F4)if(n===r)return!1;return!0}function Dt(e,t,n,r){var a=r??{},o=a.capture,u=a.passive;e==null||e.addEventListener(t,n,{capture:o!==void 0&&o,passive:u===void 0||u})}function Gg(e){return e.name==="ph_toolbar_internal"}var Yg=e=>{if(pe){try{for(var t=e+"=",n=pe.cookie.split(";").filter((o=>o.length)),r=0;n.length>r;r++){for(var a=n[r];a.charAt(0)==" ";)a=a.substring(1,a.length);if(a.indexOf(t)===0)return decodeURIComponent(a.substring(t.length,a.length))}}catch{}return null}};Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return an(e)&&isFinite(e)&&Math.floor(e)===e});class wh{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,n,r,a){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(a)||0>t||0>n||0>r||0>a||t>0xffffffffffff||n>4095||r>1073741823||a>4294967295)throw new RangeError("invalid field value");var o=new Uint8Array(16);return o[0]=t/Math.pow(2,40),o[1]=t/Math.pow(2,32),o[2]=t/Math.pow(2,24),o[3]=t/Math.pow(2,16),o[4]=t/256,o[5]=t,o[6]=112|n>>>8,o[7]=n,o[8]=128|r>>>24,o[9]=r>>>16,o[10]=r>>>8,o[11]=r,o[12]=a>>>24,o[13]=a>>>16,o[14]=a>>>8,o[15]=a,new wh(o)}toString(){for(var t="",n=0;this.bytes.length>n;n++)t=t+(this.bytes[n]>>>4).toString(16)+(15&this.bytes[n]).toString(16),n!==3&&n!==5&&n!==7&&n!==9||(t+="-");if(t.length!==36)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new wh(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(var n=0;16>n;n++){var r=this.bytes[n]-t.bytes[n];if(r!==0)return Math.sign(r)}return 0}}class I4{generate(){var t=this.generateOrAbort();if(!ue(t))return t;this.Yr=0;var n=this.generateOrAbort();if(ue(n))throw new Error("Could not generate UUID after timestamp reset");return n}generateOrAbort(){var t=Date.now();if(t>this.Yr)this.Yr=t,this.Kr();else{if(this.Yr>=t+1e4)return;this.Xr++,this.Xr>4398046511103&&(this.Yr++,this.Kr())}return wh.fromFieldsV7(this.Yr,Math.trunc(this.Xr/Math.pow(2,30)),this.Xr&Math.pow(2,30)-1,this.ei.nextUint32())}Kr(){this.Xr=1024*this.ei.nextUint32()+(1023&this.ei.nextUint32())}constructor(){this.Yr=0,this.Xr=0,this.ei=new H4}}var Vy,m2=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};ne&&!ue(ne.crypto)&&crypto.getRandomValues&&(m2=e=>crypto.getRandomValues(e));class H4{nextUint32(){return this.Dt.length>this.ti||(m2(this.Dt),this.ti=0),this.Dt[this.ti++]}constructor(){this.Dt=new Uint32Array(8),this.ti=1/0}}var is=()=>q4().toString(),q4=()=>(Vy||(Vy=new I4)).generate(),lc="",V4=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,Nl=null,Kt={ri(){if(!sn(Nl))return Nl;if(Nl=!1,pe)try{var e="__ph_cookie_support_"+is();Kt.ii(e,"xyz"),Nl=Yg(e)==='"xyz"',Kt.ai(e)}catch{Nl=!1}return Nl},oi(e){be.error("cookieStore error: "+e)},ni:Yg,si(e){var t;try{t=JSON.parse(Kt.ni(e))||{}}catch{}return t},ii(e,t,n,r,a){if(!pe)return!1;try{var o="",u="",h=(function(m,x){if(x){var b=(function(_,j){if(j===void 0&&(j=pe),lc)return lc;if(!j||["localhost","127.0.0.1"].includes(_))return"";for(var N=_.split("."),w=Math.min(N.length,8),C="dmn_chk_"+is();!lc&&w--;){var E=N.slice(w).join("."),R=C+"=1;domain=."+E+";path=/";j.cookie=R+";max-age=3",j.cookie.includes(C)&&(j.cookie=R+";max-age=0",lc=E)}return lc})(m);if(!b){var y=(_=>{var j=_.match(V4);return j?j[0]:""})(m);y!==b&&be.info("Warning: cookie subdomain discovery mismatch",y,b),b=y}return b?"; domain=."+b:""}return""})(pe.location.hostname,r);if(n){var f=new Date;f.setTime(f.getTime()+864e5*n),o="; expires="+f.toUTCString()}a&&(u="; secure");var p=e+"="+encodeURIComponent(JSON.stringify(t))+o+"; SameSite=Lax; path=/"+h+u;return p.length>3686.4&&be.warn("cookieStore warning: large cookie, len="+p.length),pe.cookie=p,!0}catch{return!1}},ai(e,t){if(pe!=null&&pe.cookie)try{Kt.ii(e,"",-1,t)}catch{return}}},bm=null,at={ri(){if(!sn(bm))return bm;var e=!0;if(ue(ne))e=!1;else try{var t="__mplssupport__";at.ii(t,"xyz"),at.ni(t)!=='"xyz"'&&(e=!1),at.ai(t)}catch{e=!1}return e||be.error("localStorage unsupported; falling back to cookie store"),bm=e,e},oi(e){be.error("localStorage error: "+e)},ni(e){try{return ne==null?void 0:ne.localStorage.getItem(e)}catch(t){at.oi(t)}return null},si(e){try{return JSON.parse(at.ni(e))||{}}catch{}return null},ii(e,t){try{return ne==null||ne.localStorage.setItem(e,JSON.stringify(t)),!0}catch(n){at.oi(n)}return!1},ai(e){try{ne==null||ne.localStorage.removeItem(e)}catch(t){at.oi(t)}}},ym=[wr,Gr,Xn,Ui,ss,Ii,ti,Vl,Ks],Aa=[Hc,En,$l,Rx,yh,bh,Je],Sh=e=>e+"_cpm",G4=["__proto__","constructor","prototype"],_m=e=>{if(!pt(e))return{};var t={};return Object.keys(e).forEach((n=>{G4.indexOf(n)===-1&&(t[n]=e[n])})),t},wm=function(e,t){t===void 0&&(t=[]);var n={};return[...Aa,...t].forEach((r=>{var a=e[r];ue(a)||sn(a)||a===""||(n[r]=a)})),n},g2=e=>{for(var t=5381,n=2166136261,r=0;e.length>r;r++){var a=e.charCodeAt(r);t=33*t^a,n=Math.imul(n^a,16777619)}return e.length.toString(36)+"."+(t>>>0).toString(36)+"."+(n>>>0).toString(36)},Gy=(e,t)=>({p:t,f:g2(JSON.stringify(e))}),Yy=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{var n=Kt.si(Sh(e)),r=(n==null?void 0:n.f)===g2(t)&&Be(n.p);return{properties:r?n.p:[],isValid:r}}catch{return{properties:[],isValid:!1}}},Sm=(e,t)=>t+"|"+(Kt.ni(Sh(e))||""),Cl={},Wg={ri:()=>!0,oi(e){be.error("memoryStorage error: "+e)},ni:e=>e in Cl?Cl[e]:null,si:e=>e in Cl?Cl[e]:null,ii:(e,t)=>(Cl[e]=t,!0),ai(e){delete Cl[e]}},ya=null,Mt={ri(){if(!sn(ya))return ya;if(ya=!0,ue(ne))ya=!1;else try{var e="__support__";Mt.ii(e,"xyz"),Mt.ni(e)!=='"xyz"'&&(ya=!1),Mt.ai(e)}catch{ya=!1}return ya},oi(e){be.error("sessionStorage error: ",e)},ni(e){try{return ne==null?void 0:ne.sessionStorage.getItem(e)}catch(t){Mt.oi(t)}return null},si(e){try{return JSON.parse(Mt.ni(e))||null}catch{}return null},ii(e,t){try{return ne==null||ne.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(n){Mt.oi(n)}return!1},ai(e){try{ne==null||ne.sessionStorage.removeItem(e)}catch(t){Mt.oi(t)}}};class Y4{constructor(t){this._instance=t}get gn(){return this._instance.config}get consent(){return this.Ws()?0:this.Vs}isOptedOut(){return this.gn.cookieless_mode===Zs||this.isRejected()||this.consent===-1&&this.gn.cookieless_mode===Fi}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.gn.opt_out_capturing_by_default}optInOut(t){this.Gs.ii(this.Zs,t?1:0,this.gn.cookie_expiration,this.gn.cross_subdomain_cookie,this.gn.secure_cookie)}reset(){this.Gs.ai(this.Zs,this.gn.cross_subdomain_cookie)}get Zs(){var t=this._instance.config,n=t.token,r=t.opt_out_capturing_cookie_prefix;return t.consent_persistence_name||(r?r+n:"__ph_opt_in_out_"+n)}get Vs(){var t=this.Gs.ni(this.Zs);return cm(t)?1:Fe(Q3,t)?0:-1}get Gs(){var t=this.gn.opt_out_capturing_persistence_type,n=t==="localStorage"?at:Kt,r=n.ri()?n:Wg;if(!this.Qs||this.Qs!==r){this.Qs=r;var a=t==="localStorage"?Kt:at;a.ni(this.Zs)&&(this.Qs.ni(this.Zs)||this.optInOut(cm(a.ni(this.Zs))),a.ai(this.Zs,this.gn.cross_subdomain_cookie))}return this.Qs}Ws(){return!!this.gn.respect_dnt&&[Nn==null?void 0:Nn.doNotTrack,Nn==null?void 0:Nn.msDoNotTrack,Me.doNotTrack,Nn==null?void 0:Nn.globalPrivacyControl].some((t=>cm(t)))}}function x2(e,t){var n,r=e==null||(n=e.config)==null?void 0:n.get_current_url;if(!Un(r))return t;try{var a=r(t);return ct(a)&&a?a:t}catch(o){return be.error("Error in get_current_url, falling back to window.location.href",o),t}}var v2="__POSTHOG_TOOLBAR__",W4=1,Q4=3,X4=11;function Wy(e){return e instanceof Element&&(e.id===v2||!(e.closest==null||!e.closest(".toolbar-global-fade-container")))}function Gi(e){return!!e&&e.nodeType===W4}function jr(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function b2(e){return!!e&&e.nodeType===Q4}function y2(e){return!!e&&e.nodeType===X4&&Gi(e.host)}var _2=1e3;function Bx(e){return e?Uh(e).split(/\s+/):[]}function Qy(e,t){var n=(function(r){var a,o=ne==null||(a=ne.location)==null?void 0:a.href;return ue(o)?void 0:x2(r,o)})(t);return!!(n&&e&&e.some((r=>n.match(r))))}function kh(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 Bx(t)}function w2(e){return Ge(e)?null:Uh(e).split(/(\s+)/).filter((t=>Mc(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function qc(e){var t="";return Kg(e)&&!C2(e)&&e.childNodes&&e.childNodes.length&&jt(e.childNodes,(function(n){var r;b2(n)&&n.textContent&&(t+=(r=w2(n.textContent))!==null&&r!==void 0?r:"")})),Uh(t)}function Qg(e){var t;return ue(e.target)?e.srcElement||null:(t=e.target)!=null&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}var Px=["a","button","form","input","select","textarea","label"];function Xg(e,t){if(ue(t))return!0;var n,r=function(o){if(t.some((u=>(function(h,f){var p=h.matches||h.matchesSelector||h.msMatchesSelector||h.mozMatchesSelector||h.webkitMatchesSelector||h.oMatchesSelector;try{return!!p&&p.call(h,f)}catch{return!1}})(o,u))))return{v:!0}};for(var a of e)if(n=r(a))return n.v;return!1}function S2(e){var t=e.parentNode;return!(!t||!Gi(t))&&t}var K4=[".ph-no-autocapture","[data-ph-no-autocapture]"],k2=["next","previous","prev",">","<"],Z4=[...k2,"+","-","−","–"],Xy=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,Ky=[".ph-no-rageclick",".ph-no-capture"],J4=["","text","search","email","password","url","tel","number"];function j2(e,t){if(!ne||$x(e))return!1;var n,r,a,o,u;if(Kn(t)?(n=!!t&&Ky,r=void 0,a=!1):(n=(o=t==null?void 0:t.css_selector_ignorelist)!==null&&o!==void 0?o:Ky,r=t==null?void 0:t.content_ignorelist,a=(u=t==null?void 0:t.ignore_text_selection)!==null&&u!==void 0&&u),n===!1||a&&(function(f){return!(!f||!Gi(f))&&(!!jr(f,"textarea")||(jr(f,"input")?Fe(J4,(f.getAttribute("type")||"").toLowerCase()):(function(p){if(p.isContentEditable)return!0;var m=p.getAttribute==null?void 0:p.getAttribute("contenteditable");return m==="true"||m===""})(f)))})(e))return!1;var h=N2(e,!1).targetElementList;return!(function(f,p){if(f===!1||ue(f))return!1;var m;if(f===!0)m=k2;else{if(!Be(f))return!1;if(f.length>10)return be.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;m=f.map((x=>x.toLowerCase()))}return p.some((x=>{var b=x.safeText,y=x.ariaLabel;return m.some((_=>Xy(b,_)||Xy(y,_)))}))})(r,h.map((f=>{var p;return{safeText:qc(f).toLowerCase(),ariaLabel:((p=f.getAttribute("aria-label"))==null?void 0:p.toLowerCase().trim())||""}})))&&!Xg(h,n)}var $x=e=>!e||jr(e,"html")||!Gi(e),N2=(e,t)=>{if(!ne||$x(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,r=[e],a=e;a.parentNode&&!jr(a,"body");)if(y2(a.parentNode))r.push(a.parentNode.host),a=a.parentNode.host;else{var o=S2(a);if(!o)break;if(t||Px.indexOf(o.tagName.toLowerCase())>-1)n=!0;else try{var u=ne.getComputedStyle(o);u&&u.getPropertyValue("cursor")==="pointer"&&(n=!0)}catch{}r.push(o),a=o}return{parentIsUsefulElement:n,targetElementList:r}};function Kg(e){for(var t=new Set,n=0,r=e;r.parentNode&&!jr(r,"body");r=r.parentNode){if(n++>=_2||t.has(r))return!1;t.add(r);var a=kh(r);if(Fe(a,"ph-sensitive")||Fe(a,"ph-no-capture"))return!1}if(Fe(kh(e),"ph-include"))return!0;var o=e.type||"";if(ct(o))switch(o.toLowerCase()){case"hidden":case"password":return!1}var u=e.name||e.id||"";return!ct(u)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(u.replace(/[^a-zA-Z0-9]/g,""))}function C2(e){return!!(jr(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||jr(e,"select")||jr(e,"textarea")||e.getAttribute("contenteditable")==="true")}var Zy=new RegExp("^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$"),Jy=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,eE=[16,15,14,13],tE=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),e_=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),t_=/[0-9A-Za-z_]/;function nE(e){for(var t=0,n=!1,r=e.length-1;r>=0;r--){var a=e.charCodeAt(r)-48;n&&(a*=2)>9&&(a-=9),t+=a,n=!n}return t%10==0}function Mc(e,t){if(t===void 0&&(t=!0),Ge(e))return!1;if(ct(e)){e=Uh(e);var n=t?Zy.test((e||"").replace(/[- ]/g,"")):(function(a){var o;for(Jy.lastIndex=0;o=Jy.exec(a);){var u=o[2];if(u)for(var h=u.replace(/[- ]/g,""),f=0;h.length>f;f++)for(var p of eE){var m=f+p;if(h.length>=m){var x=h.slice(f,m);if(Zy.test(x)&&nE(x))return!0}}}return!1})(e);if(n)return!1;var r=t?tE.test(e):(function(a){var o;for(e_.lastIndex=0;o=e_.exec(a);){var u=o[1],h=o[3];if(!(u&&h&&t_.test(u)&&t_.test(h)))return!0}return!1})(e);if(r)return!1}return!0}function n_(e){var t=qc(e);return Mc(t=(t+" "+E2(e)).trim())?t:""}function E2(e){var t="";return e&&e.childNodes&&e.childNodes.length&&jt(e.childNodes,(function(n){var r;if(n&&((r=n.tagName)==null?void 0:r.toLowerCase())==="span")try{var a=qc(n);t=(t+" "+a).trim(),n.childNodes&&n.childNodes.length&&(t=(t+" "+E2(n)).trim())}catch(o){be.error("[AutoCapture]",o)}})),t}function r_(e){return e.replace(/"|\\"/g,'\\"')}function rE(e){var t=e.attr__class;if(t)return Be(t)?t:Bx(t)}var Ed=Vt("[Dead Clicks]"),sE=()=>!0,iE=e=>{var t,n=!((t=e.instance.persistence)==null||!t.get_property(Dx)),r=e.instance.config.capture_dead_clicks;return Kn(r)?r:!!pt(r)||n};class s_{get lazyLoadedDeadClicksAutocapture(){return this.Js}constructor(t,n,r){this.instance=t,this.isEnabled=n,this.onCapture=r,this.startIfEnabledOrStop()}onRemoteConfig(t){if(t.ok){var n=t.config;"captureDeadClicks"in n&&(this.instance.persistence&&this.instance.persistence.register({[Dx]:n.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.Ks((()=>{this.Ys()})):this.stop()}Ks(t){var n,r;(n=Me.__PosthogExtensions__)!=null&&n.initDeadClicksAutocapture?t():(r=Me.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this.instance,"dead-clicks-autocapture",(a=>{a?Ed.error("failed to load script",a):t()}))}Ys(){var t;if(pe){if(!this.Js&&(t=Me.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture){var n=pt(this.instance.config.capture_dead_clicks)?de({},this.instance.config.capture_dead_clicks):{};n.__onCapture=this.onCapture,this.onCapture&&(n.capture_dead_swipes=!1),this.Js=Me.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.Js.start(pe),Ed.info("starting...")}}else Ed.error("`document` not found. Cannot start.")}stop(){this.Js&&(this.Js.stop(),this.Js=void 0,Ed.info("stopping..."))}}var km=Vt("[SegmentIntegration]"),A2="posthog-js";function T2(e,t){var n=t===void 0?{}:t,r=n.organization,a=n.projectId,o=n.prefix,u=n.severityAllowList,h=u===void 0?["error"]:u,f=n.sendExceptionsToPostHog,p=f===void 0||f;return m=>{var x,b,y,_,j;if(h!=="*"&&!h.includes(m.level)||!e.__loaded)return m;m.tags||(m.tags={});var N=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());m.tags["PostHog Person URL"]=N,e.sessionRecordingStarted()&&(m.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var w,C=((x=m.exception)==null?void 0:x.values)||[],E=C.map((L=>de({},L,{stacktrace:L.stacktrace?de({},L.stacktrace,{type:"raw",frames:(L.stacktrace.frames||[]).map((O=>de({},O,{platform:"web:javascript"})))}):void 0}))),R={$exception_message:((b=C[0])==null?void 0:b.value)||m.message,$exception_type:(y=C[0])==null?void 0:y.type,$exception_level:m.level,$exception_list:E,$sentry_event_id:m.event_id,$sentry_exception:m.exception,$sentry_exception_message:((_=C[0])==null?void 0:_.value)||m.message,$sentry_exception_type:(j=C[0])==null?void 0:j.type,$sentry_tags:m.tags};return r&&a&&(R.$sentry_url=(o||"https://sentry.io/organizations/")+r+"/issues/?project="+a+"&query="+m.event_id),p&&((w=e.exceptions)==null||w.sendExceptionEvent(R)),m}}class aE{constructor(t,n,r,a,o,u){this.name=A2,this.setupOnce=function(h){h(T2(t,{organization:n,projectId:r,prefix:a,severityAllowList:o,sendExceptionsToPostHog:u==null||u}))}}}class i_{constructor(t){this.Xs=(n,r,a)=>{a&&(a.noSessionId||a.activityTimeout||a.sessionPastMaximumLength||a.crossTabAdoption)&&(be.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:n,changeReason:a}),this.ta=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.ea()}ea(){var t;this.ia=(t=this._instance.sessionManager)==null?void 0:t.onSessionId(this.Xs)}destroy(){var t;(t=this.ia)==null||t.call(this),this.ia=void 0}doPageView(t,n){var r,a=this.ra(t,n);return this.ta={pathname:(r=ne==null?void 0:ne.location.pathname)!==null&&r!==void 0?r:"",pageViewId:n,timestamp:t},this._instance.scrollManager.resetContext(),a}doPageLeave(t){var n;return this.ra(t,(n=this.ta)==null?void 0:n.pageViewId)}doEvent(){var t;return{$pageview_id:(t=this.ta)==null?void 0:t.pageViewId}}ra(t,n){var r=this.ta;if(!r)return{$pageview_id:n};var a={$pageview_id:n,$prev_pageview_id:r.pageViewId},o=this._instance.scrollManager.getContext();if(o&&!this._instance.config.disable_scroll_properties){var u=o.maxScrollHeight,h=o.lastScrollY,f=o.maxScrollY,p=o.maxContentHeight,m=o.lastContentY,x=o.maxContentY;if(!(ue(u)||ue(h)||ue(f)||ue(p)||ue(m)||ue(x))){u=Math.ceil(u),h=Math.ceil(h),f=Math.ceil(f),p=Math.ceil(p),m=Math.ceil(m),x=Math.ceil(x);var b=u>1?ks(h/u,0,1,be):1,y=u>1?ks(f/u,0,1,be):1,_=p>1?ks(m/p,0,1,be):1,j=p>1?ks(x/p,0,1,be):1;a=Pt(a,{$prev_pageview_last_scroll:h,$prev_pageview_last_scroll_percentage:b,$prev_pageview_max_scroll:f,$prev_pageview_max_scroll_percentage:y,$prev_pageview_last_content:m,$prev_pageview_last_content_percentage:_,$prev_pageview_max_content:x,$prev_pageview_max_content_percentage:j})}}return r.pathname&&(a.$prev_pageview_pathname=r.pathname),r.timestamp&&(a.$prev_pageview_duration=(t.getTime()-r.timestamp.getTime())/1e3),a}}var oc=["flags","surveys"],lE={[i2]:{exposure:"hidden"},[Pl]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[wc]:{exposure:"hidden"},[Tg]:{exposure:"event"},[Mg]:{exposure:"hidden"},[Og]:{exposure:"hidden"},[Dg]:{exposure:"event"},[Lg]:{exposure:"hidden"},[Rg]:{exposure:"event"},[zg]:{exposure:"event"},[Dx]:{exposure:"event"},[Lx]:{exposure:"hidden"},[Bg]:{exposure:"event"},[Ma]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[$l]:{exposure:"hidden"},[Rx]:{exposure:"event"},[a2]:{exposure:"event",shouldSkipFromEventProperties:e=>sn(e)},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},$sess_rec_flush_size:{exposure:"hidden"},[Xn]:{exposure:"hidden",storageGroup:"flags"},[Gr]:{exposure:"hidden",storageGroup:"flags"},[Wd]:{exposure:"hidden"},[Ui]:{exposure:"hidden",storageGroup:"flags"},[ss]:{exposure:"hidden",storageGroup:"flags"},[Ii]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[ql]:{exposure:"hidden",storageGroup:"flags"},[ys]:{exposure:"hidden"},[Ea]:{exposure:"hidden"},[wr]:{exposure:"hidden"},[Ss]:{exposure:"hidden"},[Pg]:{exposure:"hidden",storageGroup:"surveys"},[vh]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[$g]:{exposure:"event"},[Qd]:{exposure:"hidden"},[Xd]:{exposure:"hidden"},[Sc]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$product_tours_activated_session:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[Ks]:{exposure:"hidden"},[kc]:{exposure:"hidden"},[d2]:{exposure:"event"},[Vl]:{exposure:"hidden"},[ti]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Je]:{exposure:"hidden"},[Fg]:{exposure:"hidden"},[Ug]:{exposure:"hidden"},[Ig]:{exposure:"hidden"},[Hg]:{exposure:"hidden"},[bh]:{exposure:"hidden"},[yh]:{exposure:"hidden"},[l2]:{exposure:"event"},[o2]:{exposure:"event"},[c2]:{exposure:"event"},[u2]:{exposure:"event"},[f2]:{exposure:"event"},[p2]:{exposure:"event"},[qg]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_pending_trigger_conditions:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},oE=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],An=e=>{var t=lE[e];if(t)return t;for(var n of oE){var r=n[1];if(e.indexOf(n[0])===0)return r}},Fl=(e,t)=>{try{return JSON.stringify(e,((n,r)=>typeof r=="bigint"?r.toString():r),t)}catch{return _w(e)}},Kl=e=>{var t=pe==null?void 0:pe.createElement("a");return ue(t)?null:(t.href=e,t)},Zl=function(e,t){for(var n,r=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),a=0;r.length>a;a++){var o=r[a].split("=");if(o[0]===t){n=o;break}}if(!Be(n)||2>n.length)return"";var u=n[1];try{u=decodeURIComponent(u)}catch{be.error("Skipping decoding for malformed query param: "+u)}return u.replace(/\+/g," ")},Vc=function(e,t,n){if(!e||!t||!t.length)return e;for(var r=e.split("#"),a=r[1],o=(r[0]||"").split("?"),u=o[1],h=o[0],f=(u||"").split("&"),p=[],m=0;f.length>m;m++){var x=f[m].split("=");Be(x)&&(t.includes(x[0])?p.push(x[0]+"="+n):p.push(f[m]))}var b=h;return u!=null&&(b+="?"+p.join("&")),a!=null&&(b+="#"+a),b},jh=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},M2=(e,t)=>e>=t&&vw(),D2=(e,t,n,r)=>{if(e===0){if(vw()){var a=t+1;return a===n&&r(),a}return t}return 0},Ad="https?://(.*)",Jl=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],cE=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Jl],Gc="<masked>",uE=["li_fat_id"];function L2(e,t,n){if(!pe)return{};var r,a=t?[...Jl,...n||[]]:[],o=R2(Vc(pe.URL,a,Gc),e),u=(r={},jt(uE,(function(h){var f=Yg(h);r[h]=f||null})),r);return Pt(u,o)}function R2(e,t){var n=cE.concat(t||[]),r={};return jt(n,(function(a){var o=Zl(e,a);r[a]=o||null})),r}function z2(e){var t=(function(o){return o?o.search(Ad+"google.([^/?]*)")===0?"google":o.search(Ad+"bing.com")===0?"bing":o.search(Ad+"yahoo.com")===0?"yahoo":o.search(Ad+"duckduckgo.com")===0?"duckduckgo":null:null})(e),n=t!="yahoo"?"q":"p",r={};if(!sn(t)){r.$search_engine=t;var a=pe?Zl(pe.referrer,n):"";a.length&&(r.ph_keyword=a)}return r}function a_(){return navigator.language||navigator.userLanguage}var Nh="$direct";function O2(){return(pe==null?void 0:pe.referrer)||Nh}function B2(e,t,n){n===void 0&&(n=!1);var r=e?[...Jl,...t||[]]:[],a=n?Vi(Zt==null?void 0:Zt.href):Zt==null?void 0:Zt.href,o=a==null?void 0:a.substring(0,1e3);return{r:O2().substring(0,1e3),u:o?Vc(o,r,Gc):void 0}}function P2(e,t){var n;t===void 0&&(t=!1);var r=e.r,a=e.u,o=t?Vi(a):a,u={$referrer:r,$referring_domain:r==null?void 0:r==Nh?Nh:(n=Kl(r))==null?void 0:n.host};if(o){u.$current_url=o;var h=Kl(o);u.$host=h==null?void 0:h.host,u.$pathname=h==null?void 0:h.pathname;var f=R2(o);Pt(u,f)}if(r){var p=z2(r);Pt(u,p)}return u}function $2(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function dE(){try{return new Date().getTimezoneOffset()}catch{return}}var hE={flags:ti,surveys:vh},fE=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Td=e=>e+"_cookie_identity_change_pending",vn="main",Xs=[Xn,Gr,Ui,ss,Ii,ti,ql,wr],jm=e=>Xs.indexOf(e)!==-1,_a=(e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch{return e===t}},El=e=>{if(!e)return{};var t=JSON.parse(e);return pt(t)?t:{}},l_=(e,t)=>{jt(e,((n,r)=>{var a=An(r);a&&a.exposure!=="event"||{}.hasOwnProperty.call(t,r)||delete e[r]}))};class Nm{constructor(t,n,r){if(r===void 0&&(r=!0),this.na={},this.sa=!1,this.aa=!1,this.oa=!1,this.la=!1,this.ua=new Map,this.ha=!1,this.da=!1,this.va=!1,this.ca=new Set,this.gn=t,this.fa=r,this.props={},this.pa=void 0,this.ga=(o=>{var u="";return o.token&&(u=o.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),o.persistence_name?"ph_"+o.persistence_name:"ph_"+u+"_posthog"})(t),this.Gs=this.ma(t),this.aa=this.ya(t),this.load(),this.ba(),t.debug&&be.info("Persistence loaded",t.persistence,de({},this.props)),this.update_config(t,t,n),this.save(),ne){var a=()=>this.flush();Dt(ne,"beforeunload",a,{capture:!1}),Dt(ne,"pagehide",a,{capture:!1}),this._a=o=>{if(this.sa&&(!o.storageArea||o.storageArea===(ne==null?void 0:ne.localStorage))&&o.key)if(o.key!==this.ga){if(this.aa){var u=oc.find((h=>o.key===this.wa(h)));u&&this.ka(o.key,u)}}else this.ka(o.key,vn)},Dt(ne,"storage",this._a)}}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach((n=>{var r=n[0],a=n[1],o=this.ua.get(r);if(jm(r)&&o!==!0)if(a!==!0){var u=new Set(o||[]);a.forEach((h=>u.add(h))),u.size&&this.Sa(r,u)}else this.Sa(r,!0)}))}onCrossTabFeatureFlagChange(t){return this.ca.add(t),()=>this.ca.delete(t)}destroy(){this._a&&ne&&(ne.removeEventListener("storage",this._a),this._a=void 0),this.ca.clear()}ka(t,n,r){if(r===void 0&&(r=!0),this.xa)return!1;var a,o;try{if(o=at.ni(t),sn(o)){var u=this.Ca(n);return u.storageValue=null,n!==vn&&(u.persisted=!1),!1}a=El(o)}catch{return!1}var h=n===vn?a:at.si(this.ga);if(h&&this.Ta(h))return!1;var f=this.Ma(a,n,r);return n===vn&&this.aa&&!_a(this.Ea().main,a)||this.Ia(a,n,!0,o),f}Ta(t){var n=this.props[En],r=t[En];return!ue(n)&&!ue(r)&&n!==r}Ia(t,n,r,a){var o=this.Ca(n);o.storageValue=a,n!==vn&&(o.persisted=r);try{o.fingerprint=this.Ra(t,n)}catch{o.fingerprint=void 0}}Ma(t,n,r){var a=!1;return Xs.forEach((o=>{var u,h=(u=An(o))==null?void 0:u.storageGroup;if(!(n===vn&&this.aa&&h||n!==vn&&h!==n)){var f=o in t,p=this.Pa(o,f?t[o]:void 0),m=this.ua.has(o)?o in this.props:f;m===o in this.props&&_a(p,this.props[o])||(m?this.Aa(o,p,!1):this.Fa(o,!1),a=!0)}})),a&&r&&this.ca.forEach((o=>o())),a}Oa(){if(!this.sa)return!1;try{this.va=!1;var t,n=at.ni(this.ga),r=this.Ca(vn),a=!1,o=!1;if(n!==r.storageValue)if(sn(n))r.storageValue=null;else{if(t=El(n),this.va=!this.da&&this.Ta(t),this.va)return!1;o=this.Ma(t,vn,!1),!this.aa||_a(this.Ea().main,t)?this.Ia(t,vn,!0,n):r.storageValue=n,a=!0}return this.aa&&oc.forEach((u=>{var h=at.ni(this.wa(u)),f=this.Ca(u),p=t||{},m=a&&Xs.some((b=>{var y;return((y=An(b))==null?void 0:y.storageGroup)===u&&b in p}));if(h!==f.storageValue||m){if(sn(h))return f.storageValue=null,f.persisted=!1,void(m&&(o=this.Ma(p,u,!1)||o));var x=El(h);o=this.Ma(x,u,!1)||o,this.Ia(x,u,!0,h)}})),o}catch{return!1}}Sa(t,n){this.ua.set(t,n);var r=An(t);r!=null&&r.volatile||(this.Ca((this.aa?r==null?void 0:r.storageGroup:void 0)||vn).fingerprint=void 0,this.La(t))}Da(){Xs.forEach((t=>this.ua.set(t,!0)))}ba(){if(this.sa)try{var t=at.ni(this.ga),n=El(t);this.Ca(vn).storageValue=t,Xs.forEach((r=>{var a,o=this.aa?(a=An(r))==null?void 0:a.storageGroup:void 0,u=o?at.ni(this.wa(o)):null;if(o){var h=this.Ca(o);h.storageValue=u,h.persisted=!sn(u)}var f=o&&!sn(u)?El(u):n;r in this.props?this.$a(r,f[r],this.props[r]):r in f&&this.Sa(r,!0)}))}catch{}}Pa(t,n){var r=this.ua.get(t);if(!r)return n;if(r===!0)return this.props[t];if(t===Gr){var a=new Set(Be(n)?n:[]),o=new Set(Be(this.props[t])?this.props[t]:[]);return r.forEach((f=>o.has(f)?a.add(f):a.delete(f))),Array.from(a)}var u=pt(n)?de({},n):{},h=pt(this.props[t])?this.props[t]:{};return r.forEach((f=>{f in h?u[f]=h[f]:delete u[f]})),u}$a(t,n,r){if(jm(t)){var a=this.ua.get(t);if(a!==!0){var o=n;if(this.sa)try{var u,h=this.aa?(u=An(t))==null?void 0:u.storageGroup:void 0,f=h?this.wa(h):this.ga;o=El(at.ni(f))[t]}catch{}var p=new Set(a||[]);if(t===Gr){if(!ue(n)&&!Be(n)||!ue(o)&&!Be(o)||!Be(r))return void this.Sa(t,!0);var m=new Set(n||[]),x=new Set(o||[]),b=new Set(r);new Set([...m,...b]).forEach((j=>{m.has(j)!==b.has(j)&&p.add(j)})),p.forEach((j=>{x.has(j)===b.has(j)&&p.delete(j)}))}else{if(!pt(r))return void(_a(o,r)?this.ua.delete(t):this.Sa(t,!0));if(!ue(n)&&!pt(n)||ue(n)&&Vr(r)&&ue(o))return void this.Sa(t,!0);var y=pt(n)?n:{},_=pt(o)?o:{};new Set([...Object.keys(y),...Object.keys(r)]).forEach((j=>{j in y==j in r&&_a(y[j],r[j])||p.add(j)})),p.forEach((j=>{j in _==j in r&&_a(_[j],r[j])&&p.delete(j)}))}p.size?this.Sa(t,p):this.ua.delete(t)}}}Na(){var t,n=(t=this.gn)==null?void 0:t.persistence_save_debounce_ms;return an(n)&&n>0?n:0}qa(t){if(this.gn.cookieWinsOnConflict&&this.gn.persistence.toLowerCase()==="localstorage+cookie")if(t)try{var n=wm(t,this.gn.cookie_persisted_properties||[]),r=Gy(n,this.gn.cookie_persisted_properties||[]),a=JSON.stringify(n)+"|"+JSON.stringify(r),o=Kt.ni(this.ga)||void 0;o&&Sm(this.ga,o)===a&&(this.ja=a,this.Ba=o)}catch{}else try{var u=Kt.ni(this.ga)||void 0;this.ja=u?Sm(this.ga,u):void 0,this.Ba=u}catch{}}syncCookieProperties(){return this.Ha(this.gn)}Ha(t,n){if(n===void 0&&(n=!1),this.xa&&!n||this.la||!t.cookieWinsOnConflict||t.persistence.toLowerCase()!=="localstorage+cookie")return!1;var r;try{r=Kt.ni(this.ga)||void 0}catch{}if(!r||r===this.Ba)return!1;var a,o=Sm(this.ga,r);try{a=_m(JSON.parse(r))}catch{return!1}if((Kt.ni(this.ga)||void 0)!==r)return!1;this.ja=o,this.Ba=r;var u=Yy(this.ga,r),h=[...Aa,...u.properties],f={};if(Object.keys(a).forEach((N=>{var w=a[N];(ue(w)||sn(w)||w===""||N===Je&&w!==cn&&w!==zn)&&(f[N]=!0,delete a[N])})),Vr(a))return!1;var p=En in a||a[Je]===cn||a[Je]===zn,m=this.props,x=m[En],b=m[Je],y=Pt({},m);[...Aa,...t.cookie_persisted_properties||[]].forEach((N=>{if(h.indexOf(N)!==-1&&!(N in a)&&!f[N]&&(p||N!==En&&N!==Je)){var w=y[N];!u.isValid&&Aa.indexOf(N)!==-1&&(w===!1||w===0)||delete y[N]}})),this.props=Pt(y,a),Xs.forEach((N=>{var w=N in this.props;N in m===w&&_a(m[N],this.props[N])||(w?this.$a(N,m[N],this.props[N]):this.Sa(N,!0))})),!p||Je in a||Je in this.props||this.Aa(Je,cn);var _=this.props[En],j=this.props[Je];return!p||_===x&&j===b||(this.da=!0,this.oa=!0,Mt.ii(Td(this.ga),!0),this.Fa(wr),this.Fa(Gr),this.Fa(Xn),this.Fa(Ui),this.Fa(ss),this.Fa(Ii),this.Fa(ti),this.Fa(Vl),this.Fa(Ks),j===cn&&(b===zn||a[Je]===cn||!ue(x)&&_!==x)&&(l_(this.props,a),this.Fa(Ss)),j===zn?this.props.$user_id=_:delete this.props.$user_id,this.Fa(Pl)),!0}consumeCookieIdentityChange(){var t=Td(this.ga),n=this.oa||!!Mt.ni(t);return this.oa=!1,n&&Mt.ai(t),n}za(t){return t===void 0&&(t=!1),!(this.la||this.xa&&!t||!this.gn.cookieWinsOnConflict||this.gn.persistence.toLowerCase()!=="localstorage+cookie"||(this.la=!0,0))}Ua(){this.la&&(ue(this.Wa)||(clearTimeout(this.Wa),this.Wa=void 0),delete this.na[vn],this.Va(!0))}Ga(t){if(t===void 0&&(t=!0),this.la)try{t?this.Ua():ue(this.Wa)||(clearTimeout(this.Wa),this.Wa=void 0)}finally{this.la=!1}}isDisabled(){return!!this.xa}ma(t){fE.indexOf(t.persistence.toLowerCase())===-1&&(be.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var n,r=(function(u,h){u===void 0&&(u=[]),h===void 0&&(h=!1);var f=[...Aa,...u];return de({},at,{si(p){try{var m,x={};try{m=Kt.ni(p)||void 0,x=m?_m(JSON.parse(m)):{}}catch{}var b,y=JSON.parse(at.ni(p)||"{}");if(h){var _=Yy(p,m),j=[...Aa,..._.properties],N={};Object.keys(x).forEach((L=>{var O=x[L];sn(O)||O===""||L===Je&&O!==cn&&O!==zn||(N[L]=O)}));var w=En in N||N[Je]===cn||N[Je]===zn;if(Object.keys(N).length>0){var C,E=y[En],R=(C=y[Je])!==null&&C!==void 0?C:cn;f.forEach((L=>{if(j.indexOf(L)!==-1&&!(L in x)&&(w||L!==En&&L!==Je)){var O=y[L];!_.isValid&&Aa.indexOf(L)!==-1&&(O===!1||O===0)||delete y[L]}})),!w||Je in x||Je in y||(y[Je]=cn),!w||(En in N?N[En]:y[En])===E&&(Je in N?N[Je]:y[Je])===R||(ym.forEach((L=>delete y[L])),N[Je]===zn&&En in N?y.$user_id=N[En]:delete y.$user_id,N[Je]!==zn&&(delete y[d2],delete y[Ss]),delete y.__alias)}b=Pt(y,N)}else b=Pt(x,y);return at.ii(p,b),b}catch{}return null},ii(p,m,x,b,y,_){var j=at.ii(p,m,void 0,void 0,_);try{var N=wm(m,u);if(Object.keys(N).length){if(h){var w=Sh(p),C=Gy(N,u);if(Kt.ii(w,C,x,b,y,_),Kt.ni(w)!==JSON.stringify(C)){Kt.ai(w,b);var E=wm(m);return Kt.ii(p,E,x,b,y,_),j}}Kt.ii(p,N,x,b,y,_)}}catch(R){at.oi(R)}return j},ai(p,m){try{ne==null||ne.localStorage.removeItem(p),Kt.ai(p,m),Kt.ai(Sh(p),m)}catch(x){at.oi(x)}}})})(t.cookie_persisted_properties||[],t.cookieWinsOnConflict),a=!1,o=t.persistence.toLowerCase();return o==="localstorage"&&at.ri()?(n=at,a=!0):o==="localstorage+cookie"&&r.ri()?(n=r,a=!0):o==="sessionstorage"&&Mt.ri()?n=Mt:o==="memory"?n=Wg:o==="cookie"&&Kt.ri()?n=Kt:r.ri()?(n=r,a=!0):n=Kt.ri()?Kt:Wg,this.sa=a,n}wa(t){return this.ga+"__"+t}ya(t){return this.sa&&!!t.split_storage}properties(){var t={};return jt(this.props,((n,r)=>{var a=An(r);if(!a||a.exposure==="event"){if(a!=null&&a.shouldSkipFromEventProperties!=null&&a.shouldSkipFromEventProperties(n))return;t[r]=n}})),t}load(t){if(t===void 0&&(t=!1),!this.xa||t){var n=this.gn.cookieWinsOnConflict&&this.gn.persistence.toLowerCase()==="localstorage+cookie",r=n?at.si(this.ga):null,a={};if(n)try{jt(a=_m(Kt.si(this.ga)),((_,j)=>{(ue(_)||sn(_)||_==="")&&delete a[j]}))}catch{}var o=this.Gs.si(this.ga);if(o&&(this.props=Pt({},o)),this.aa&&this.Za(),n&&o){var u,h,f=r==null?void 0:r[En],p=(u=r==null?void 0:r[Je])!==null&&u!==void 0?u:cn,m=o[En],x=(h=o[Je])!==null&&h!==void 0?h:cn;if(m!==f||x!==p){this.oa=!0,Mt.ii(Td(this.ga),!0);var b=Pt({},this.props);ym.forEach((_=>delete b[_])),x===cn&&(p===zn||a[Je]===cn||!ue(f)&&m!==f)&&(l_(b,a),delete b[Ss]),this.props=b;var y=new Set;ym.forEach((_=>{var j,N=(j=An(_))==null?void 0:j.storageGroup;N&&y.add(N)})),y.forEach((_=>{var j={};jt(this.props,((N,w)=>{var C;((C=An(w))==null?void 0:C.storageGroup)===_&&(j[w]=N)})),Vr(j)?(at.ai(this.wa(_)),this.na[_]={}):at.ii(this.wa(_),j)&&(this.na[_]={persisted:!0,fingerprint:this.Ra(j,_)})}))}}Mt.ni(Td(this.ga))&&(this.oa=!0)}}Za(){for(var t of oc){var n=at.si(this.wa(t));if(n&&!Vr(n)){var r=this.Ca(t);r.persisted=!0,this.Qa(t)||(r.fingerprint=this.Ra(n,t)),this.Ja(t,n)||Pt(this.props,n)}}}Qa(t){return Object.keys(this.props).some((n=>{var r;return((r=An(n))==null?void 0:r.storageGroup)===t}))}Ja(t,n){var r=hE[t];if(!r)return!1;var a=n[r],o=this.props[r];return an(a)&&an(o)&&o>a}refreshKey(t){var n;if(!this.xa){var r=this.aa?(n=An(t))==null?void 0:n.storageGroup:void 0,a=r?at.si(this.wa(r)):this.Gs.si(this.ga);if(a&&t in a)this.Aa(t,a[t]);else{if(r){var o=this.Gs.si(this.ga);if(o&&t in o)return void this.Aa(t,o[t])}this.Fa(t)}}}save(){if(!this.xa){var t=this.Na();t>0?ue(this.Wa)&&(this.Wa=setTimeout((()=>{this.Wa=void 0,this.Va()}),t)):this.Va()}}flush(){ue(this.Wa)||(clearTimeout(this.Wa),this.Wa=void 0,this.Va())}Va(t){if(t===void 0&&(t=!1),!(this.xa||this.la&&!t)){t||this.syncCookieProperties();var n=!t&&!this.ha;n||(this.va=!1);var r=!!n&&this.Oa();if(this.va)this.gn.debug&&be.warn("skipping persistence write because storage belongs to a different distinct ID");else{if(this.aa)return this.Ka(),void(r&&this.ca.forEach((o=>o())));var a=this.Ya(this.Gs,this.ga,this.props,vn);a==="written"&&this.qa(this.props),a!=="failed"&&(this.ua.clear(),this.da=!1),r&&this.ca.forEach((o=>o()))}}}Ka(){var t=this,n=this.Ea(),r=n.main,a=n.groups,o=this.Ya(this.Gs,this.ga,r,vn);o==="written"&&this.qa(r),o!=="failed"&&(this.da=!1,Xs.forEach((f=>{var p;(p=An(f))!=null&&p.storageGroup||this.ua.delete(f)})));var u=function(f){var p,m=a[f];if(Vr(m)&&((p=t.na[f])==null||!p.persisted))return Xs.forEach((b=>{var y;((y=An(b))==null?void 0:y.storageGroup)===f&&t.ua.delete(b)})),1;var x=t.Ya(at,t.wa(f),m,f);x!=="failed"&&Xs.forEach((b=>{var y=An(b);(y==null?void 0:y.storageGroup)!==f||x!=="written"&&y.volatile||t.ua.delete(b)}))};for(var h of oc)u(h)}Ea(){var t={},n={flags:{},surveys:{}};return jt(this.props,((r,a)=>{var o,u=(o=An(a))==null?void 0:o.storageGroup;u?n[u][a]=r:t[a]=r})),{main:t,groups:n}}Ra(t,n){if(n===vn)return JSON.stringify(t)+"|"+this.Xa+"|"+this.eo+"|"+this.io;var r={};return jt(t,((a,o)=>{var u;r[o]=(u=An(o))!=null&&u.volatile?"__volatile__":a})),JSON.stringify(r)}Ya(t,n,r,a){var o,u=this.Ca(a);if(a!==vn&&!u.dirty&&!ue(u.fingerprint))return"skipped";try{if((o=this.Ra(r,a))===u.fingerprint)return u.dirty=!1,"skipped"}catch{o=void 0}return t.ii(n,r,this.Xa,this.eo,this.io,this.gn.debug)?(u.dirty=!1,a!==vn&&(u.persisted=!0),ue(o)||(u.fingerprint=o),this.sa&&(u.storageValue=at.ni(n)),"written"):(this.gn.debug&&be.warn('failed to persist storage entry "'+n+'"; will retry on next save'),"failed")}remove(t){var n=(t===void 0?{}:t).keepGroupEntries,r=n!==void 0&&n;if(this.Da(),ue(this.Wa)||(clearTimeout(this.Wa),this.Wa=void 0),this.Gs.ai(this.ga,!1),this.Gs.ai(this.ga,!0),!r&&this.fa)for(var a of oc)at.ai(this.wa(a));r?delete this.na[vn]:this.na={},this.ja=void 0,this.Ba=void 0}clear(){this.remove(),this.props={}}register_once(t,n,r){if(pt(t)){this.syncCookieProperties(),ue(n)&&(n="None"),this.Xa=ue(r)?this.ro:r;var a=!1;if(jt(t,((o,u)=>{this.props.hasOwnProperty(u)&&this.props[u]!==n||(this.Aa(u,o),a=!0)})),a)return this.save(),!0}return!1}register(t,n){if(pt(t)){this.syncCookieProperties(),this.Xa=ue(n)?this.ro:n;var r=!1;if(jt(t,((a,o)=>{t.hasOwnProperty(o)&&(this.props[o]!==a||pt(a)||Be(a))&&(this.Aa(o,a),r=!0)})),r)return this.save(),!0}return!1}unregister(t){this.syncCookieProperties();var n=typeof t=="string"?[t]:t,r=!1;for(var a of n)a in this.props&&(this.Fa(a),r=!0);r&&this.save()}update_campaign_params(){var t=pe==null?void 0:pe.URL;if(t!==this.pa){var n=L2(this.gn.custom_campaign_params,this.gn.mask_personal_data_properties,this.gn.custom_personal_data_properties);Vr(Ox(n))||this.register(n),this.pa=t}}update_search_keyword(){var t;this.register((t=pe==null?void 0:pe.referrer)?z2(t):{})}update_referrer_info(){var t;this.register_once({$referrer:O2(),$referring_domain:pe!=null&&pe.referrer&&((t=Kl(pe.referrer))==null?void 0:t.host)||Nh},void 0)}set_initial_person_info(){this.props[Ig]||this.props[Hg]||this.register_once({[bh]:B2(this.gn.mask_personal_data_properties,this.gn.custom_personal_data_properties,this.gn.disable_capture_url_hashes)},void 0)}get_initial_props(){var t={};jt([Hg,Ig],(a=>{var o=this.props[a];o&&jt(o,(function(u,h){t["$initial_"+wg(h)]=u}))}));var n=this.props[bh];if(n){var r=(function(a,o){o===void 0&&(o=!1);var u=P2(a,o),h={};return jt(u,(function(f,p){h["$initial_"+wg(p)]=f})),h})(n,this.gn.disable_capture_url_hashes);Pt(t,r)}return t}safe_merge(t){return jt(this.props,(function(n,r){r in t||(t[r]=n)})),t}update_config(t,n,r){var a=t.persistence!==n.persistence,o=!((j,N)=>{if(j.length!==N.length)return!1;var w=[...j].sort(),C=[...N].sort();return w.every(((E,R)=>E===C[R]))})(t.cookie_persisted_properties||[],n.cookie_persisted_properties||[]),u=a||o,h=t.cookieWinsOnConflict!==n.cookieWinsOnConflict,f=t.disable_persistence||!!r,p=!!this.xa&&!f;f||this.Ha(n,p),this.gn=t,!f&&(a||o||h)&&(this.ja=void 0,this.Ba=void 0,this.Ha(de({},t,{cookie_persisted_properties:n.cookie_persisted_properties}),p));var m=u||h?this.ma(t):this.Gs,x=this.ya(t),b=u||x!==this.aa,y=!f&&(b||t.cross_subdomain_cookie!==this.eo||t.secure_cookie!==this.io)&&this.za(p);this.ha=b;try{if(this.ro=this.Xa=t.cookie_expiration,this.set_disabled(f),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),b){var _=this.props;this.clear(),this.Gs=m,this.aa=x,this.props=_,this.save()}else h&&(this.Gs=m,f||(delete this.na[vn],this.Va()))}finally{this.ha=!1,y&&this.Ga()}}set_disabled(t){this.xa=t,this.xa?this.remove():this.save()}set_cross_subdomain(t){t!==this.eo&&(this.eo=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.io&&(this.io=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,n){var r=this.props[wc]||{};r[t]=n,this.Aa(wc,r),this.save()}remove_event_timer(t){var n=this.props[wc]||{},r=n[t];return ue(r)||(delete n[t],this.Aa(wc,n),this.save()),r}get_property(t){return this.props[t]}set_property(t,n){this.Aa(t,n),this.save()}Aa(t,n,r){var a;r===void 0&&(r=!0);var o=this.props[t];this.props[t]=n,r&&(t!==En&&t!==Je||o===n||(this.da=!0),this.$a(t,o,n),(a=An(t))!=null&&a.volatile||this.La(t))}Fa(t,n){n===void 0&&(n=!0),delete this.props[t],n&&(jm(t)&&this.Sa(t,!0),this.La(t))}La(t){var n,r=(n=An(t))==null?void 0:n.storageGroup;r&&(this.Ca(r).dirty=!0)}Ca(t){return this.na[t]||(this.na[t]={})}}function Md(e){var t=!0;return{dispose(){if(t){t=!1;var n=e();n&&Un(n.then)&&n.then(void 0,(()=>{}))}}}}var Sr={GZipJS:"gzip-js",Base64:"base64"},cc={Activation:"events",Cancellation:"cancelEvents"},Cm={Popover:"popover",API:"api",Widget:"widget"},Js={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},Em={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},Zg={Popover:"popover",Inline:"inline"},pE={SHOWN:"product tour shown"},o_={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},c_=Vt("[RateLimiter]");class mE{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=n=>{var r=n.text;if(r&&r.length)try{(JSON.parse(r).quota_limited||[]).forEach((a=>{c_.info((a||"events")+" is quota limited."),this.serverLimits[a]=new Date().getTime()+6e4}))}catch(a){return void c_.warn('could not rate limit - continuing. Error: "'+(a==null?void 0:a.message)+'"',{text:r})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return((t=this.instance.config.rate_limiting)==null?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max(((t=this.instance.config.rate_limiting)==null?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var n,r,a;t===void 0&&(t=!1);var o=this.captureEventsBurstLimit,u=this.captureEventsPerSecond,h=new Date().getTime(),f=(n=(r=this.instance.persistence)==null?void 0:r.get_property(Ug))!==null&&n!==void 0?n:{tokens:o,last:h};f.tokens+=(h-f.last)/1e3*u,f.last=h,f.tokens>o&&(f.tokens=o);var p=1>f.tokens;if(p||t||(f.tokens=Math.max(0,f.tokens-1)),p&&!t){var m=(an(f.dropped)?f.dropped:0)+1;f.dropped=m,!this.lastEventRateLimited&&this.no(m)&&(f.dropped=0)}return this.lastEventRateLimited=p,(a=this.instance.persistence)==null||a.set_property(Ug,f),{isRateLimited:p,remainingTokens:f.tokens}}so(t){var n=this.instance.config.property_denylist;return!Be(n)||!n.includes(t)}ao(){var t;if(this.so("$current_url")&&this.so("$pathname")&&Zt!=null&&Zt.pathname)return""+((t=Zt.origin)!==null&&t!==void 0?t:"")+Zt.pathname}no(t){var n,r,a=this.captureEventsBurstLimit,o=this.captureEventsPerSecond,u=this.ao(),h=this.so("$session_id")?(n=(r=this.instance).get_session_id)==null?void 0:n.call(r):void 0,f=[t+" event(s) dropped since the last warning",u?"triggered on "+u:void 0,h?"session "+h:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited: "+f+". Config is set to "+o+" events per second and "+a+" events burst limit."},{skip_client_rate_limiting:!0})}isServerRateLimited(t){var n=this.serverLimits[t||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var Bi=Vt("[RemoteConfig]");class F2{constructor(t){this._instance=t}get remoteConfig(){var t;return(t=Me._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.config}oo(t){var n,r;(n=Me.__PosthogExtensions__)!=null&&n.loadExternalDependency?(r=Me.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}lo(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t})}load(){try{if(this.remoteConfig)return Bi.info("Using preloaded remote config",this.remoteConfig),void this.uo(this.remoteConfig);if(this._instance.ho())return void Bi.warn("Remote config is disabled. Falling back to local config.");this.oo((t=>{if(!t)return Bi.info("No config found after loading remote JS config. Falling back to JSON."),void this.lo((n=>{this.uo(n.json,n)}));this.uo(t)}))}catch(t){Bi.error("Error loading remote config",t),this.uo()}}uo(t,n){!t&&n&&(n.statusCode===0?n.error||Bi.warn("Failed to fetch remote config from PostHog."):Bi.error("Failed to fetch remote config from PostHog."));try{this._instance.uo(t?{ok:!0,config:t}:{ok:!1})}catch(a){Bi.error("Error applying remote config",a)}if((t==null?void 0:t.hasFeatureFlags)!==!1&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var r;(r=this._instance.featureFlags)==null||r.ensureFlagsLoaded()}catch(a){Bi.error("Error loading feature flags",a)}}}var Wr=Uint8Array,ur=Uint16Array,eo=Uint32Array,Fx=new Wr([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]),Ux=new Wr([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]),u_=new Wr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),U2=function(e,t){for(var n=new ur(31),r=0;31>r;++r)n[r]=t+=1<<e[r-1];var a=new eo(n[30]);for(r=1;30>r;++r)for(var o=n[r];n[r+1]>o;++o)a[o]=o-n[r]<<5|r;return[n,a]},I2=U2(Fx,2),Jg=I2[1];I2[0][28]=258,Jg[258]=28;for(var d_=U2(Ux,0)[1],H2=new ur(32768),Jt=0;32768>Jt;++Jt){var Al=(43690&Jt)>>>1|(21845&Jt)<<1;H2[Jt]=((65280&(Al=(61680&(Al=(52428&Al)>>>2|(13107&Al)<<2))>>>4|(3855&Al)<<4))>>>8|(255&Al)<<8)>>>1}var Dc=function(e,t,n){for(var r=e.length,a=0,o=new ur(t);r>a;++a)++o[e[a]-1];var u,h=new ur(t);for(a=0;t>a;++a)h[a]=h[a-1]+o[a-1]<<1;for(u=new ur(r),a=0;r>a;++a)u[a]=H2[h[e[a]-1]++]>>>15-e[a];return u},Ra=new Wr(288);for(Jt=0;144>Jt;++Jt)Ra[Jt]=8;for(Jt=144;256>Jt;++Jt)Ra[Jt]=9;for(Jt=256;280>Jt;++Jt)Ra[Jt]=7;for(Jt=280;288>Jt;++Jt)Ra[Jt]=8;var Ch=new Wr(32);for(Jt=0;32>Jt;++Jt)Ch[Jt]=5;var gE=Dc(Ra,9),xE=Dc(Ch,5),q2=function(e){return(e/8>>0)+(7&e&&1)},V2=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var r=new(e instanceof ur?ur:e instanceof eo?eo:Wr)(n-t);return r.set(e.subarray(t,n)),r},Vs=function(e,t,n){var r=t/8>>0;e[r]|=n<<=7&t,e[r+1]|=n>>>8},uc=function(e,t,n){var r=t/8>>0;e[r]|=n<<=7&t,e[r+1]|=n>>>8,e[r+2]|=n>>>16},Am=function(e,t){for(var n=[],r=0;e.length>r;++r)e[r]&&n.push({s:r,f:e[r]});var a=n.length,o=n.slice();if(!a)return[new Wr(0),0];if(a==1){var u=new Wr(n[0].s+1);return u[n[0].s]=1,[u,1]}n.sort((function(L,O){return L.f-O.f})),n.push({s:-1,f:25001});var h=n[0],f=n[1],p=0,m=1,x=2;for(n[0]={s:-1,f:h.f+f.f,l:h,r:f};m!=a-1;)h=n[n[x].f>n[p].f?p++:x++],f=n[p!=m&&n[x].f>n[p].f?p++:x++],n[m++]={s:-1,f:h.f+f.f,l:h,r:f};var b=o[0].s;for(r=1;a>r;++r)o[r].s>b&&(b=o[r].s);var y=new ur(b+1),_=ex(n[m-1],y,0);if(_>t){r=0;var j=0,N=_-t,w=1<<N;for(o.sort((function(L,O){return y[O.s]-y[L.s]||L.f-O.f}));a>r;++r){var C=o[r].s;if(t>=y[C])break;j+=w-(1<<_-y[C]),y[C]=t}for(j>>>=N;j>0;){var E=o[r].s;t>y[E]?j-=1<<t-y[E]++-1:++r}for(;r>=0&&j;--r){var R=o[r].s;y[R]==t&&(--y[R],++j)}_=t}return[new Wr(y),_]},ex=function(e,t,n){return e.s==-1?Math.max(ex(e.l,t,n+1),ex(e.r,t,n+1)):t[e.s]=n},h_=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new ur(++t),r=0,a=e[0],o=1,u=function(f){n[r++]=f},h=1;t>=h;++h)if(e[h]==a&&h!=t)++o;else{if(!a&&o>2){for(;o>138;o-=138)u(32754);o>2&&(u(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(u(a),--o;o>6;o-=6)u(8304);o>2&&(u(o-3<<5|8208),o=0)}for(;o--;)u(a);o=1,a=e[h]}return[n.subarray(0,r),t]},dc=function(e,t){for(var n=0,r=0;t.length>r;++r)n+=e[r]*t[r];return n},tx=function(e,t,n){var r=n.length,a=q2(t+2);e[a]=255&r,e[a+1]=r>>>8,e[a+2]=255^e[a],e[a+3]=255^e[a+1];for(var o=0;r>o;++o)e[a+o+4]=n[o];return 8*(a+4+r)},f_=function(e,t,n,r,a,o,u,h,f,p,m){Vs(t,m++,n),++a[256];for(var x=Am(a,15),b=x[0],y=x[1],_=Am(o,15),j=_[0],N=_[1],w=h_(b),C=w[0],E=w[1],R=h_(j),L=R[0],O=R[1],q=new ur(19),F=0;C.length>F;++F)q[31&C[F]]++;for(F=0;L.length>F;++F)q[31&L[F]]++;for(var W=Am(q,7),z=W[0],I=W[1],A=19;A>4&&!z[u_[A-1]];--A);var X,Z,G,B,$=p+5<<3,se=dc(a,Ra)+dc(o,Ch)+u,ae=dc(a,b)+dc(o,j)+u+14+3*A+dc(q,z)+(2*q[16]+3*q[17]+7*q[18]);if(se>=$&&ae>=$)return tx(t,m,e.subarray(f,f+p));if(Vs(t,m,1+(se>ae)),m+=2,se>ae){X=Dc(b,y),Z=b,G=Dc(j,N),B=j;var D=Dc(z,I);for(Vs(t,m,E-257),Vs(t,m+5,O-1),Vs(t,m+10,A-4),m+=14,F=0;A>F;++F)Vs(t,m+3*F,z[u_[F]]);m+=3*A;for(var P=[C,L],J=0;2>J;++J){var M=P[J];for(F=0;M.length>F;++F)Vs(t,m,D[ge=31&M[F]]),m+=z[ge],ge>15&&(Vs(t,m,M[F]>>>5&127),m+=M[F]>>>12)}}else X=gE,Z=Ra,G=xE,B=Ch;for(F=0;h>F;++F)if(r[F]>255){var ge;uc(t,m,X[257+(ge=r[F]>>>18&31)]),m+=Z[ge+257],ge>7&&(Vs(t,m,r[F]>>>23&31),m+=Fx[ge]);var we=31&r[F];uc(t,m,G[we]),m+=B[we],we>3&&(uc(t,m,r[F]>>>5&8191),m+=Ux[we])}else uc(t,m,X[r[F]]),m+=Z[r[F]];return uc(t,m,X[256]),m+Z[256]},vE=new eo([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),bE=(function(){for(var e=new eo(256),t=0;256>t;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e})(),Tm=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function yE(e,t){t===void 0&&(t={});var n=(function(){var x=4294967295;return{p(b){for(var y=x,_=0;b.length>_;++_)y=bE[255&y^b[_]]^y>>>8;x=y},d(){return 4294967295^x}}})(),r=e.length;n.p(e);var a,o,u,h,f,p=(h=10+((a=t).filename&&a.filename.length+1||0),f=8,(function(x,b,y,_,j,N){var w=x.length,C=new Wr(_+w+5*(1+Math.floor(w/7e3))+j),E=C.subarray(_,C.length-j),R=0;if(!b||8>w)for(var L=0;w>=L;L+=65535){var O=L+65535;w>O?R=tx(E,R,x.subarray(L,O)):(E[L]=!0,R=tx(E,R,x.subarray(L,w)))}else{for(var q=vE[b-1],F=q>>>13,W=8191&q,z=(1<<y)-1,I=new ur(32768),A=new ur(z+1),X=Math.ceil(y/3),Z=2*X,G=function(xt){return(x[xt]^x[xt+1]<<X^x[xt+2]<<Z)&z},B=new eo(25e3),$=new ur(288),se=new ur(32),ae=0,D=0,P=(L=0,0),J=0,M=0;w>L;++L){var ge=G(L),we=32767&L,Ce=A[ge];if(I[we]=Ce,A[ge]=we,L>=J){var ze=w-L;if((ae>7e3||P>24576)&&ze>423){R=f_(x,E,0,B,$,se,D,P,M,L-M,R),P=ae=D=0,M=L;for(var Ee=0;286>Ee;++Ee)$[Ee]=0;for(Ee=0;30>Ee;++Ee)se[Ee]=0}var Pe=2,et=0,Et=W,mt=we-Ce&32767;if(ze>2&&ge==G(L-mt))for(var yt=Math.min(F,ze)-1,_t=Math.min(32767,L),Lt=Math.min(258,ze);_t>=mt&&--Et&&we!=Ce;){if(x[L+Pe]==x[L+Pe-mt]){for(var Gt=0;Lt>Gt&&x[L+Gt]==x[L+Gt-mt];++Gt);if(Gt>Pe){if(Pe=Gt,et=mt,Gt>yt)break;var _e=Math.min(mt,Gt-2),Ve=0;for(Ee=0;_e>Ee;++Ee){var dt=L-mt+Ee+32768&32767,_n=dt-I[dt]+32768&32767;_n>Ve&&(Ve=_n,Ce=dt)}}}mt+=(we=Ce)-(Ce=I[we])+32768&32767}if(et){B[P++]=268435456|Jg[Pe]<<18|d_[et];var je=31&Jg[Pe],Oe=31&d_[et];D+=Fx[je]+Ux[Oe],++$[257+je],++se[Oe],J=L+Pe,++ae}else B[P++]=x[L],++$[x[L]]}}R=f_(x,E,!0,B,$,se,D,P,M,L-M,R)}return V2(C,0,_+q2(R)+j)})(o=e,(u=t).level==null?6:u.level,u.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(o.length)))):12+u.mem,h,f)),m=p.length;return(function(x,b){var y=b.filename;if(x[0]=31,x[1]=139,x[2]=8,x[8]=2>b.level?4:b.level==9?2:0,x[9]=3,b.mtime!=0&&Tm(x,4,Math.floor(new Date(b.mtime||Date.now())/1e3)),y){x[3]=8;for(var _=0;y.length>=_;++_)x[_+10]=y.charCodeAt(_)}})(p,t),Tm(p,m-8,n.d()),Tm(p,m-4,r),p}var _E=!!bg||!!kx,G2="text/plain",Zd=!1,Y2=(e,t)=>{var n=e.split("#"),r=n[1],a=n[0].split("?"),o=a[0],u=a[1];if(!u)return e;var h=u.split("&").filter((f=>f.split("=")[0]!==t)).join("&");return o+(h?"?"+h:"")+(r?"#"+r:"")},Jc=function(e,t,n){var r;n===void 0&&(n=!0);var a=e.split("?"),o=a[0],u=a[1],h=de({},t),f=(r=u==null?void 0:u.split("&").map((m=>{var x,b=m.split("="),y=b[0],_=n&&(x=h[y])!==null&&x!==void 0?x:b[1];return delete h[y],y+"="+_})))!==null&&r!==void 0?r:[],p=(function(m,x){var b,y;x===void 0&&(x="&");var _=[];return jt(m,(function(j,N){ue(j)||ue(N)||N==="undefined"||(b=encodeURIComponent((w=>w instanceof File)(j)?j.name:j.toString()),y=encodeURIComponent(N),_[_.length]=y+"="+b)})),_.join(x)})(h);return p&&f.push(p),f.length>0?o+"?"+f.join("&"):o},Mm=e=>{if(e.do)return e.do;var t=e.data,n=e.compression;if(t){if(n===Sr.GZipJS){var r=yE((function(h,f){var p=h.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(h);for(var m=new Wr(h.length+(h.length>>>1)),x=0,b=function(N){m[x++]=N},y=0;p>y;++y){if(x+5>m.length){var _=new Wr(x+8+(p-y<<1));_.set(m),m=_}var j=h.charCodeAt(y);128>j?b(j):2048>j?(b(192|j>>>6),b(128|63&j)):j>55295&&57344>j?(b(240|(j=65536+(1047552&j)|1023&h.charCodeAt(++y))>>>18),b(128|j>>>12&63),b(128|j>>>6&63),b(128|63&j)):(b(224|j>>>12),b(128|j>>>6&63),b(128|63&j))}return V2(m,0,x)})(Fl(t)),{mtime:0});return{contentType:G2,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(n===Sr.Base64){var a=(function(h){return h&&btoa(encodeURIComponent(h).replace(/%([0-9A-F]{2})/g,((f,p)=>String.fromCharCode(parseInt(p,16)))))})(Fl(t)),o=(h=>"data="+encodeURIComponent(typeof h=="string"?h:Fl(h)))(a);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var u=Fl(t);return{contentType:"application/json",body:u,estimatedSize:new Blob([u]).size}}},W2=e=>{var t,n,r=()=>e.transport==="sendBeacon"?{url:Jc(e.url,{compression:Sr.Base64}),encodedBody:Mm(de({},e,{compression:Sr.Base64,do:void 0}))}:{url:Y2(e.url,"compression"),encodedBody:Mm(de({},e,{compression:void 0,do:void 0}))};try{t=Mm(e)}catch(a){if(Ry(e.compression,Zl(e.url,"compression")))return be.error("Failed to gzip request body, sending uncompressed payload",a),r();throw a}return t&&Ry(e.compression,Zl(e.url,"compression"))&&!((n=t.body)instanceof ArrayBuffer?Cg(new Uint8Array(n)):ArrayBuffer.isView(n)&&Cg(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)))?(Zd=!0,r()):{url:e.url,encodedBody:t}},Q2=e=>{try{return W2(e)}catch(t){return be.error(t),void(e.callback==null||e.callback({statusCode:0,error:t}))}},wE=(function(){var e=$t((function*(t){var n=Fl(t.data),r=yield(function(o,u,h){return Eg.apply(this,arguments)})(n,Bt.DEBUG,{rethrow:!0});if(!r)return t;var a=yield r.arrayBuffer();return de({},t,{do:{contentType:G2,body:a,estimatedSize:a.byteLength}})}));return function(t){return e.apply(this,arguments)}})(),SE=/Failed to fetch|NetworkError|Load failed/i,X2=e=>(e==null?void 0:e.name)==="TypeError"&&SE.test((e==null?void 0:e.message)||""),K2=e=>{var t=Q2(e);if(t){var n=t.url,r=t.encodedBody,a=r??{},o=a.contentType,u=a.body,h=a.estimatedSize,f=new Headers;jt(e.headers,(function(_,j){f.append(j,_)})),o&&f.append("Content-Type",o);var p=null,m=!1;if(Sy){var x=new Sy;p={signal:x.signal,timeout:setTimeout((()=>{var _;m=!0,x.abort(Ww("AbortError","PostHog request timed out"+((_=e.timeout)?" after "+_+"ms":"")))}),e.timeout)}}var b=_=>{m&&(_==null?void 0:_.name)==="AbortError"||X2(_)?be.warn(_):be.error(_),e.callback==null||e.callback({statusCode:0,error:_})};try{var y;kx(n,de({method:(e==null?void 0:e.method)||"GET",headers:f,keepalive:e.method==="POST"&&!e.vo&&52428.8>(h||0),body:u,signal:(y=p)==null?void 0:y.signal},e.fetchOptions)).then((_=>_.text().then((j=>{var N={statusCode:_.status,text:j};if(_.status===200)try{N.json=JSON.parse(j)}catch(w){be.error(w)}e.callback==null||e.callback(N)})))).catch(b).finally((()=>p?clearTimeout(p.timeout):null))}catch(_){p&&clearTimeout(p.timeout),b(_)}}},nx=e=>{try{var t,n=W2(e),r=n.url,a=n.encodedBody,o=a??{},u=o.body,h=o.estimatedSize;if(!u)return;var f=u instanceof Blob?u:new Blob([u],{type:o.contentType});if(Nn.sendBeacon(r,f))return;var p=Be(e.data)?e.data:(t=e.data)==null?void 0:t.batch;if(Be(p)&&p.length>1&&(h??0)>16384){var m=Math.ceil(p.length/2),x=b=>Be(e.data)?b:de({},e.data,{batch:b});return nx(de({},e,{data:x(p.slice(0,m))})),void nx(de({},e,{data:x(p.slice(m))}))}be.warn("Beacon of ~"+(h??0)+" bytes was rejected by the browser, falling back to fetch"),K2(de({},e,{vo:!0}))}catch(b){be.warn("Beacon send failed",b)}},p_=(e,t,n,r)=>{var a=r==="query"?t==="POST"?"sent_at":"_":void 0;return Jc(n===Sr.GZipJS?Y2(e,"compression"):e,de({},a?{[a]:Date.now().toString()}:{},n===Sr.GZipJS?{}:{compression:n}))},Jd=[];kx&&Jd.push({transport:"fetch",method:K2}),bg&&Jd.push({transport:"XHR",method(e){var t=Q2(e);if(t){var n=new bg,r=t.encodedBody;n.open(e.method||"GET",t.url,!0);var a=r??{},o=a.contentType,u=a.body;jt(e.headers,(function(h,f){n.setRequestHeader(f,h)})),o&&n.setRequestHeader("Content-Type",o),e.timeout&&(n.timeout=e.timeout),n.onreadystatechange=()=>{if(n.readyState===4){var h={statusCode:n.status,text:n.responseText};if(n.status===200)try{h.json=JSON.parse(n.responseText)}catch{}e.callback==null||e.callback(h)}},n.send(u)}}}),Nn!=null&&Nn.sendBeacon&&Jd.push({transport:"sendBeacon",method:nx});var rx=3e3;class kE{constructor(t,n){this.co=!0,this.fo=[],this.po=ks((n==null?void 0:n.flush_interval_ms)||rx,250,5e3,be.createLogger("flush interval"),rx),this.mo=t}enqueue(t){this.fo.push(t),this.yo||this.bo()}unload(){this._o();var t=this.fo.length>0?this.wo():{},n=Object.values(t);[...n.filter((r=>r.url.indexOf("/e")===0)),...n.filter((r=>r.url.indexOf("/e")!==0))].map((r=>{this.ko(de({},r,{transport:"sendBeacon"}))}))}enable(){this.co=!1,this.bo()}bo(){var t=this;this.co||(this.yo=setTimeout((()=>{if(this._o(),this.fo.length>0){var n=this.wo(),r=function(){var o=n[a],u=new Date().getTime();o.data&&Be(o.data)&&jt(o.data,(h=>{h.offset=Math.abs(h.timestamp-u),delete h.timestamp})),t.ko(o)};for(var a in n)r()}}),this.po))}ko(t){try{this.mo(t)}catch(n){be.error(n)}}_o(){clearTimeout(this.yo),this.yo=void 0}wo(){var t={};return jt(this.fo,(n=>{var r,a=n,o=(a?a.batchKey:null)||a.url;ue(t[o])&&(t[o]=de({},a,{data:[]})),(r=t[o].data)==null||r.push(a.data)})),this.fo=[],t}}var jE=["retriesPerformedSoFar"];class NE{constructor(t){this.So=!1,this.xo=3e3,this.fo=[],this._instance=t,this.fo=[],this.Co=!0,!ue(ne)&&"onLine"in ne.navigator&&(this.Co=ne.navigator.onLine,this.To=()=>{this.Co=!0,this.Mo()},this.Eo=()=>{this.Co=!1},Dt(ne,"online",this.To),Dt(ne,"offline",this.Eo))}get length(){return this.fo.length}retriableRequest(t){var n=t.retriesPerformedSoFar,r=bw(t,jE);Qs(n)&&(r.url=Jc(r.url,{retry_count:n})),this._instance._send_request(de({},r,{callback:a=>{if(a.statusCode!==200&&(400>a.statusCode||a.statusCode>=500)){if((a.statusCode===0?3:10)>(n??0))return void this.es(de({retriesPerformedSoFar:n},r));a.statusCode===0&&be.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(n??0)+" retries.")}r.callback==null||r.callback(a)}}))}es(t){var n=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=n+1;var r=(function(u){var h=3e3*Math.pow(2,u),f=h/2,p=Math.min(18e5,h),m=Math.random()-.5;return Math.ceil(p+m*(p-f))})(n),a=Date.now()+r;this.fo.push({retryAt:a,requestOptions:t});var o="Enqueued failed request for retry in "+r;navigator.onLine||(o+=" (Browser is offline)"),be.warn(o),this.So||(this.So=!0,this.Io())}Io(){if(this.Ro&&clearTimeout(this.Ro),this.fo.length===0)return this.So=!1,void(this.Ro=void 0);this.Ro=setTimeout((()=>{this.Co&&this.fo.length>0&&this.Mo(),this.Io()}),this.xo)}Mo(){var t=Date.now(),n=[],r=this.fo.filter((o=>t>o.retryAt||(n.push(o),!1)));if(this.fo=n,r.length>0)for(var a of r)this.retriableRequest(a.requestOptions)}unload(){for(var t of(this.Ro&&(clearTimeout(this.Ro),this.Ro=void 0),this.So=!1,ue(ne)||(this.To&&(ne.removeEventListener("online",this.To),this.To=void 0),this.Eo&&(ne.removeEventListener("offline",this.Eo),this.Eo=void 0)),this.fo)){var n=t.requestOptions;try{this._instance._send_request(de({},n,{transport:"sendBeacon"}))}catch(r){be.error(r)}}this.fo=[]}}class CE{constructor(t){this.Po=()=>{var n,r,a,o;this.Ao||(this.Ao={});var u=this.scrollElement(),h=this.scrollY(),f=u?Math.max(0,u.scrollHeight-u.clientHeight):0,p=h+((u==null?void 0:u.clientHeight)||0),m=(u==null?void 0:u.scrollHeight)||0;this.Ao.lastScrollY=Math.ceil(h),this.Ao.maxScrollY=Math.max(h,(n=this.Ao.maxScrollY)!==null&&n!==void 0?n:0),this.Ao.maxScrollHeight=Math.max(f,(r=this.Ao.maxScrollHeight)!==null&&r!==void 0?r:0),this.Ao.lastContentY=p,this.Ao.maxContentY=Math.max(p,(a=this.Ao.maxContentY)!==null&&a!==void 0?a:0),this.Ao.maxContentHeight=Math.max(m,(o=this.Ao.maxContentHeight)!==null&&o!==void 0?o:0)},this._instance=t}get Fo(){return this._instance.config.scroll_root_selector}getContext(){return this.Ao}resetContext(){var t=this.Ao;return setTimeout(this.Po,0),t}startMeasuringScrollPosition(){Dt(ne,"scroll",this.Po,{capture:!0}),Dt(ne,"scrollend",this.Po,{capture:!0}),Dt(ne,"resize",this.Po)}scrollElement(){if(!this.Fo)return ne==null?void 0:ne.document.documentElement;var t=Be(this.Fo)?this.Fo:[this.Fo];for(var n of t){var r=ne==null?void 0:ne.document.querySelector(n);if(r)return r}}Oo(t){var n=t==="y"?"scrollTop":"scrollLeft";if(this.Fo){var r=this.scrollElement();return r&&r[n]||0}return ne?t==="y"?ne.scrollY||ne.pageYOffset||ne.document.documentElement.scrollTop||0:ne.scrollX||ne.pageXOffset||ne.document.documentElement.scrollLeft||0:0}scrollY(){return this.Oo("y")}scrollX(){return this.Oo("x")}}var EE=e=>B2(e==null?void 0:e.config.mask_personal_data_properties,e==null?void 0:e.config.custom_personal_data_properties,e==null?void 0:e.config.disable_capture_url_hashes);class m_{constructor(t,n,r,a){this.Tt=o=>{var u=this.Lo();if(!u||u.sessionId!==o){var h={sessionId:o,props:this.Do(this._instance)};this.$o.register({[Fg]:h})}},this._instance=t,this.No=n,this.$o=r,this.Do=a||EE,this.No.onSessionId(this.Tt)}Lo(){return this.$o.props[Fg]}getSetOnceProps(){var t,n=(t=this.Lo())==null?void 0:t.props;return n?"r"in n?P2(n,this._instance.config.disable_capture_url_hashes):{$referring_domain:n.referringDomain,$pathname:n.initialPathName,utm_source:n.utm_source,utm_campaign:n.utm_campaign,utm_medium:n.utm_medium,utm_content:n.utm_content,utm_term:n.utm_term}:{}}getSessionProps(){var t={};return jt(Ox(this.getSetOnceProps()),((n,r)=>{r==="$current_url"&&(r="url"),t["$session_entry_"+wg(r)]=n})),t}}class Eh{on(t,n){return this.qo[t]||(this.qo[t]=[]),this.qo[t].push(n),()=>{this.qo[t]=this.qo[t].filter((r=>r!==n))}}emit(t,n){for(var r of this.qo[t]||[])r(n);for(var a of this.qo["*"]||[])a(t,n)}constructor(){this.qo={}}}var Tl=Vt("[SessionId]"),g_=864e5;class x_{on(t,n){return this.jo.on(t,n)}constructor(t,n,r){var a;if(this.Bo=null,this.Ho=null,this.zo=[],this.Uo=void 0,this.Wo=!1,this.jo=new Eh,this.Vo=(f,p)=>!(!Qs(f)||!Qs(p))&&Math.abs(f-p)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===Zs)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.gn=t.config,this.$o=t.persistence,this.It=void 0,this.Pe=void 0,this._sessionStartTimestamp=null,this.Go=void 0,this._sessionActivityTimestamp=null,this.Zo=n||is,this.Qo=r||is;var o=this.gn.persistence_name||this.gn.token;if(this._sessionTimeoutMs=1e3*ks(this.gn.session_idle_timeout_seconds||1800,60,36e3,Tl.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Jo(),this.Ko="ph_"+o+"_window_id",this.Yo="ph_"+o+"_primary_window_exists",this.Xo()){var u=Mt.si(this.Ko),h=Mt.si(this.Yo);u&&!h?this.It=u:Mt.ai(this.Ko),Mt.ii(this.Yo,!0)}(a=this.gn.bootstrap)!=null&&a.sessionID&&this.setBootstrapSessionId(this.gn.bootstrap.sessionID),this.tl()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return ue(this.zo)&&(this.zo=[]),this.zo.push(t),this.Pe&&t(this.Pe,this.It),()=>{this.zo=this.zo.filter((n=>n!==t))}}Xo(){return this.gn.persistence!=="memory"&&!this.$o.xa&&Mt.ri()}el(t){t!==this.It&&(this.It=t,this.Xo()&&Mt.ii(this.Ko,t))}il(){return this.It?this.It:this.Xo()?Mt.si(this.Ko):null}rl(t){var n=this.Bo;return!sn(n)&&!sn(t)&&5e3>Math.abs(t-n)}nl(t,n,r){var a=n!==this._sessionActivityTimestamp,o=!(t!==this.Pe||r!==this._sessionStartTimestamp);this._sessionStartTimestamp=r,this._sessionActivityTimestamp=n,this.Pe=t,o&&!a||o&&this.rl(n)||(this.Bo=n,this.$o.register({[$l]:[n,t,r]}))}sl(){var t,n=(t=this.gn)==null?void 0:t.persistence_save_debounce_ms;return Qs(n)&&n>0}al(){this.sl()?this.$o.refreshKey($l):(this.$o.flush(),this.$o.load())}ol(){var t;if(!sn(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Bo){this.al();var n=this.ll();n[1]===this.Pe&&n[2]===this._sessionStartTimestamp&&(this.Bo=this._sessionActivityTimestamp,this.$o.register({[$l]:[this._sessionActivityTimestamp,(t=this.Pe)!==null&&t!==void 0?t:null,this._sessionStartTimestamp]}),this.$o.flush())}}ul(){var t=this.ll()[0],n=Qs(t)?t:0,r=Qs(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(n,r)}hl(t){return this.al(),this.Vo(t,this.ul())}ll(){var t=this.$o.props[$l];return Be(t)&&t.length===2&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Bo=null,this.Go=void 0,clearTimeout(this.dl),this.dl=void 0,this.nl(null,null,null)}setBootstrapSessionId(t,n){n===void 0&&(n=!1);var r=(function(a,o){o===void 0&&(o=new Date().getTime());try{var u=(h=>{var f=h.replace(/-/g,"");if(f.length!==32)throw new Error("Not a valid UUID");if(f[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(f.substring(0,12),16)})(a);return u>o+6e4?void Tl.error("Bootstrap sessionID cannot be in the future"):u}catch(h){return void Tl.error("Invalid sessionID in bootstrap",h)}})(t);return!ue(r)&&(n?this.Go={sessionId:t,sessionStartTimestamp:r}:this.nl(t,new Date().getTime(),r),!0)}destroy(){this.Wo=!0,this.ol(),clearTimeout(this.dl),this.dl=void 0,this.Uo&&ne&&(ne.removeEventListener(_h,this.Uo,{capture:!1}),this.Uo=void 0),this.zo=[]}tl(){this.Uo=()=>{this.ol(),this.Xo()&&Mt.ai(this.Yo)},Dt(ne,_h,this.Uo,{capture:!1})}checkAndGetSessionAndWindowId(t,n,r){if(t===void 0&&(t=!1),n===void 0&&(n=null),r===void 0&&(r=!1),this.gn.cookieless_mode===Zs)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var a=n||new Date().getTime(),o=this.Pe;if(r)this.Ho=a;else if(sn(this.Ho)||this.Ho>a||a-this.Ho>=1e3){var u,h;(u=(h=this.$o).syncCookieProperties)==null||u.call(h),this.Ho=a}var f=this.ll(),p=f[1],m=f[2],x=!ue(o)&&p!==o,b=this.ul(),y=this.il(),_=this.Go,j=!!_&&(_.sessionStartTimestamp>a+6e4||a-_.sessionStartTimestamp>g_),N=_?j:Qs(m)&&Math.abs(a-m)>g_,w=!1,C=x,E=!p||!!_,R=p,L=!E&&!t&&this.Vo(a,b);if(L){(L=this.hl(a))||Tl.info("cross-tab refresh kept the session alive",{sessionId:p});var O=this.ll();p=O[1],m=O[2]}if(E||L||N){C=!1;var q=_&&!j;p=q?_.sessionId:this.Zo(),y=this.Qo(),Tl.info("new session ID assigned",{sessionId:p,windowId:y,bootstrapped:!!q,changeReason:{noSessionId:E,activityTimeout:L,sessionPastMaximumLength:N}}),m=q?_.sessionStartTimestamp:a,this.Go=void 0,w=!0}else y||(y=this.Qo(),w=!0),(C=C||p!==R)&&(Tl.info("adopted cross-tab session id",{sessionId:p,windowId:y}),w=!0);var F=Qs(b)&&t&&!N?b:a,W=Qs(m)?m:new Date().getTime();this.el(y),this.nl(p,F,W),t||this.Jo();var z={noSessionId:E,activityTimeout:L,sessionPastMaximumLength:N,crossTabAdoption:C};return w&&this.zo.forEach((I=>I(p,y,z))),{sessionId:p,windowId:y,sessionStartTimestamp:W,changeReason:w?z:void 0,lastActivityTimestamp:b}}Jo(){this.Wo||(clearTimeout(this.dl),this.dl=setTimeout((()=>{if(!this.Wo)if(this.hl(new Date().getTime())){var t=this.Pe;this.resetSessionId(),this.jo.emit("forcedIdleReset",{idleSessionId:t})}else this.Jo()}),1.1*this.sessionTimeoutMs))}}var Z2=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&Ey(n,t))return!0;try{var r=e==null?void 0:e.userAgentData;if(r!=null&&r.brands&&r.brands.some((a=>Ey(a==null?void 0:a.brand,t))))return!0}catch{}return!!e.webdriver};function J2(){return(J2=$t((function*(){var e=Nn==null?void 0:Nn.userAgentData;if(e!=null&&e.getHighEntropyValues)try{var t=yield e.getHighEntropyValues(["model"]),n=t==null?void 0:t.model;return ct(n)&&n.length>0?n:void 0}catch(r){return void be.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",r)}}))).apply(this,arguments)}function eS(e){var t;return!((t=e.conditions)==null||(t=t.events)==null||(t=t.values)==null||!t.length)}var Ah=(e,t)=>{if(!(n=>{try{new RegExp(n)}catch{return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}},Dd=e=>e.toLowerCase(),tS={exact:(e,t)=>t.some((n=>e.some((r=>n===r)))),is_not:(e,t)=>t.every((n=>e.every((r=>n!==r)))),regex:(e,t)=>t.some((n=>e.some((r=>Ah(n,r))))),not_regex:(e,t)=>t.every((n=>e.every((r=>!Ah(n,r))))),icontains:(e,t)=>t.map(Dd).some((n=>e.map(Dd).some((r=>n.includes(r))))),not_icontains:(e,t)=>t.map(Dd).every((n=>e.map(Dd).every((r=>!n.includes(r))))),gt:(e,t)=>t.some((n=>{var r=parseFloat(n);return!isNaN(r)&&e.some((a=>r>parseFloat(a)))})),lt:(e,t)=>t.some((n=>{var r=parseFloat(n);return!isNaN(r)&&e.some((a=>r<parseFloat(a)))}))};function nS(e,t){return!e||Object.entries(e).every((n=>{var r=n[1],a=t==null?void 0:t[n[0]];if(a==null)return!1;var o=tS[r.operator];return!!o&&o(r.values,[String(a)])}))}function Dm(e,t,n){return Fl({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}var sx="custom",v_="i.posthog.com",AE=/^\/static\//,TE=["/s/","/e/","/i/"];class ME{constructor(t){this.vl={},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("."+v_,".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this.vl[this.apiHost]||(this.vl[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":sx),this.vl[this.apiHost]}cl(t){if(AE.test(t)){var n=this.instance.config.asset_host;if(typeof n=="string")return n.trim().replace(/\/$/,"")||void 0}}fl(t){var n=Kl(t);return n?n.protocol+"//"+n.host+n.pathname:void 0}pl(t,n,r){if(t==="ui")return r;var a=r,o=this.instance.config.rewriteRequestPath;if(o){var u,h=((u=Kl(r))==null?void 0:u.href)||r;a=o(new URL(h)).toString()}if(o&&t==="api"&&TE.some((b=>n.indexOf(b)===0))){var f=this.fl(a);if(f){var p,m=this.apiHost,x=this.gl;((p=x)==null?void 0:p.apiHost)===m&&x.rewriteRequestPath===o||(x={apiHost:m,rewriteRequestPath:o,urls:new Set},this.gl=x),x.urls.add(f)}}return a}isIngestionEndpoint(t){var n=this.gl,r=this.fl(t);return(n==null?void 0:n.apiHost)===this.apiHost&&n.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!r&&n.urls.has(r)}endpointFor(t,n){if(n===void 0&&(n=""),n&&(n=n[0]==="/"?n:"/"+n),t==="ui")return this.pl(t,n,this.uiHost+n);if(t==="flags")return this.pl(t,n,this.flagsApiHost+n);if(t==="assets"){var r=this.cl(n);if(r)return this.pl(t,n,""+r+n)}if(this.region===sx)return this.pl(t,n,this.apiHost+n);var a=v_+n;switch(t){case"assets":return this.pl(t,n,"https://"+this.region+"-assets."+a);case"api":return this.pl(t,n,"https://"+this.region+"."+a)}}}var wt=Vt("[Surveys]"),rS="seenSurvey_",sS=e=>{try{var t=(n=>((r,a)=>""+rS+(function(o){return o.current_iteration&&o.current_iteration>0?o.id+"_"+o.current_iteration:o.id})(a))(0,n))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(n){wt.error("Failed to persist survey seen state",n)}},DE=[Cm.Popover,Cm.Widget,Cm.API],LE={ignoreConditions:!1,ignoreDelay:!1,displayType:Zg.Popover},RE=Vt("[PostHog ExternalIntegrations]"),zE={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class OE{constructor(t){this._instance=t}Ks(t,n){var r;(r=Me.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,t,(a=>{if(a)return RE.error("failed to load script",a);n()}))}startIfEnabledOrStop(){var t=this,n=function(){var o,u,h,f=r[0],p=r[1];!p||(o=Me.__PosthogExtensions__)!=null&&(o=o.integrations)!=null&&o[f]||t.Ks(zE[f],(()=>{var m;(m=Me.__PosthogExtensions__)==null||(m=m.integrations)==null||(m=m[f])==null||m.start(t._instance)})),!p&&(u=Me.__PosthogExtensions__)!=null&&(u=u.integrations)!=null&&u[f]&&((h=Me.__PosthogExtensions__)==null||(h=h.integrations)==null||(h=h[f])==null||h.stop())};for(var r of Object.entries((a=this._instance.config.integrations)!==null&&a!==void 0?a:{})){var a;n()}}}class BE{constructor(t,n){this.A=t,this.$s=n,this.ml=new Map,this.Fs=!1}add(t){var n=this;return $t((function*(){if(n.Fs)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(n.ml.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');n.ml.set(t.name,t);try{var r=t.setup(n.$s);r&&(yield r)}catch(o){var a=n.ml.get(t.name)===t;a&&n.ml.delete(t.name),n.A.error('Failed to set up browser extension "'+t.name+'"',o),a&&n.yl(t)}}))()}getExtension(t){return this.ml.get(t)}dispose(){if(!this.Fs){this.Fs=!0;var t=Array.from(this.ml.values()).reverse();for(var n of(this.ml.clear(),t))this.yl(n)}}yl(t){try{var n=t.dispose==null?void 0:t.dispose();n&&Un(n.then)&&n.then(void 0,(r=>{this.A.error('Failed to dispose browser extension "'+t.name+'"',r)}))}catch(r){this.A.error('Failed to dispose browser extension "'+t.name+'"',r)}}}class PE{constructor(t){this._instance=t}initialize(){}get(t){var n=this._instance.persistence;if(typeof t=="string")return n==null?void 0:n.get_property(t);var r={};for(var a of t){var o=n==null?void 0:n.get_property(a);ue(o)||(r[a]=o)}return r}set(t,n){var r;(r=this._instance.persistence)==null||r.register(typeof t=="string"?{[t]:n}:t)}remove(t){var n;(n=this._instance.persistence)==null||n.unregister(t)}}var b_="extensionsRemoteConfig";class $E{constructor(t){this.Fs=!1,this.instance=t,this.A=be,this.bl=t._l,this.kv=new PE(t),this.onEvent=n=>Md(this.instance.on("eventCaptured",(r=>{try{n({event:r.event,properties:r.properties})}catch(a){this.A.error("Browser extension event listener failed",a)}}))),this.onRemoteConfig=n=>{if(this.Fs)return Md((()=>{}));var r=o=>{try{n(o)}catch(u){this.A.error("Browser extension remote config listener failed",u)}},a=this.instance.wl.on(b_,r);return this.bl&&r(this.bl),Md(a)},this.kl=new BE(be.createLogger("[BrowserExtensions]"),this)}get logger(){return this.A}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return(t=this.instance.get_property(Hc))!==null&&t!==void 0?t:this.distinctId}get deviceId(){var t=this.instance.get_property(Hc);return typeof t=="string"?t:void 0}get library(){return{name:Bt.LIB_NAME,version:Bt.LIB_VERSION}}get initialPersonProperties(){var t,n;return(t=(n=this.instance.persistence)==null?void 0:n.get_initial_props())!==null&&t!==void 0?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,n,r,a,o=(t=this.instance.sessionManager)==null?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:(n=o==null?void 0:o.sessionId)!==null&&n!==void 0?n:"",windowId:(r=o==null?void 0:o.windowId)!==null&&r!==void 0?r:"",sessionStartTimestamp:(a=o==null?void 0:o.sessionStartTimestamp)!==null&&a!==void 0?a:0}}catch{return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(t){return this.kl.add(t)}getExtension(t){return this.kl.getExtension(t)}capture(t,n,r){var a=this;return $t((function*(){r?a.instance.capture(t,n,{timestamp:r.timestamp,uuid:r.uuid,$set:r.set,$set_once:r.setOnce}):a.instance.capture(t,n)}))()}registerDynamicEventProperties(t){return Md(this.instance.Sl(t))}handleRemoteConfig(t){this.Fs||(this.bl=t,this.instance.wl.emit(b_,t))}sendRequest(t,n){var r=this;return $t((function*(){var a;n===void 0&&(n={});var o=r.instance.requestRouter.endpointFor((a=n.target)!==null&&a!==void 0?a:"api",t),u={method:n.method,url:n.query?Jc(o,n.query):o,data:n.body,headers:n.headers,timeout:n.timeoutMs,fireCallbackOnDrop:!0,transport:n.transport,compression:n.compression,compressionFallback:n.target==="flags"&&n.compression==="best-available"?yg.Base64:void 0,timestampMode:n.sentAt};return n.transport==="sendBeacon"?(r.instance._send_request(u),{statusCode:202}):new Promise((h=>{u.callback=h,r.instance._send_request(u)}))}))()}dispose(){this.Fs||(this.Fs=!0,this.kl.dispose())}}var Lc={},Lm=0,Th=()=>{},y_='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',hc="Surveys module not available",__="sanitize_properties is deprecated. Use before_send instead",iS="Invalid value for property_denylist config: ",FE=["token","distinct_id",h2],Ol="posthog",aS=!_E&&(cr==null?void 0:cr.indexOf("MSIE"))===-1&&(cr==null?void 0:cr.indexOf("Mozilla"))===-1,UE=e=>{var t={};return e&&e!=="unset"&&("2025-11-30">e||(t.strictMinimumDuration=!0),"2026-05-30">e||(t.canvasCapture={resolutionScale:.6}),"2026-06-25">e||(t.streamNetworkBody=!0),"2026-08-30">e||(t.captureJsonLd=!0)),t},Rm=e=>{var t;return de({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:U4(pe==null?void 0:pe.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Th,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:e??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:Zt&&ct(Zt==null?void 0:Zt.search)&&Zt.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:(ne==null||(t=ne.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){be.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:Vg,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:rx},error_tracking:{},_onCapture:Th},(n=>({rageclick:n&&n>="2026-05-30"?{content_ignorelist:Z4,ignore_text_selection:!0}:!n||"2025-11-30">n||{content_ignorelist:!0},capture_pageview:!n||"2025-05-24">n||"history_change",session_recording:UE(n),external_scripts_inject_target:n&&n>="2026-01-30"?"head":"body",internal_or_test_user_hostname:n&&n>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:n&&n>="2026-05-30"?250:0,split_storage:!(!n||"2026-05-30">n),detect_google_search_app:!(!n||"2026-05-30">n),disable_capture_url_hashes:!(!n||"2026-06-25">n),cookieWinsOnConflict:!(!n||n==="unset"||"2026-08-29">n)}))(e))},IE=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"],["__preview_cookie_wins_on_conflict","cookieWinsOnConflict"]],w_=e=>{var t={};for(var n of IE){var r=n[0],a=n[1];ue(e[r])||(t[a]=e[r])}var o=Pt({},t,e),u=e.__preview_external_dependency_versioned_paths;return ue(u)||(ue(e.strict_script_versioning)&&(o.strict_script_versioning=!!u),ct(u)&&ue(e.asset_host)&&(o.asset_host=u)),Be(e.property_blacklist)&&(ue(e.property_denylist)?o.property_denylist=e.property_blacklist:Be(e.property_denylist)?o.property_denylist=[...e.property_blacklist,...e.property_denylist]:be.error(iS+e.property_denylist)),o};class HE{constructor(){this.__forceAllowLocalhost=!1}get xl(){return this.__forceAllowLocalhost}set xl(t){be.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class kr{Cl(t){if(t){var n=this.ml.indexOf(t);n!==-1&&this.ml.splice(n,1)}}Tl(t,n){return this.Cl(t),this.ml.push(n),n.initialize==null||n.initialize(),n}Ml(){return this.config.cookieless_mode===Zs||this.config.cookieless_mode===Fi&&this.consent.isRejected()}El(){if(!this.Il&&!this.config.segment&&!this.Ml()){var t,n,r,a=this.config.persistence==="memory"||this.config.persistence==="sessionStorage";(a||this.config.disable_persistence)&&(this.Rl||(a?(t="persistence is set to '"+this.config.persistence+"'",n=this.config.persistence==="memory"?"on every page load":"for every new browser tab or window",r="Either set persistence to 'localStorage+cookie', or keep this persistence and pass a stable ID through bootstrap.distinctID."):(t="persistence is disabled (disable_persistence is true)",n="on every page load",r="Either set disable_persistence to false, or keep persistence disabled and pass a stable ID through bootstrap.distinctID."),this.Il=!0,console.warn("[PostHog.js]",t+" but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID "+n+", so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. "+r)))}}Pl(){if(!this.Ml()&&this.get_distinct_id()===jl){var t=this.persistence;if(t){this.Al()||t.load(!0);var n=this.get_distinct_id();if(!n||n===jl){var r=this.config.get_device_id(is());this.register({distinct_id:r,$device_id:r}),t.set_property(Je,cn)}this.Fl()}}}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 HE,this.Ol=!1,this.version=Bt.LIB_VERSION,this.Ll=new Set,this.Dl="",this.wl=new Eh,this.ml=[],this.$l=[],this.Rl=!1,this.Il=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Rm(),this.SentryIntegration=aE,this.sentryIntegration=r=>(function(a,o){var u=T2(a,o);return{name:A2,processEvent:h=>u(h)}})(this,r),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Nl=!1,this.ql=null,this.jl=null,this.Bl=null,this.scrollManager=new CE(this),this.pageViewManager=new i_(this),this.rateLimiter=new mE(this),this.requestRouter=new ME(this),this.consent=new Y4(this),this.externalIntegrations=new OE(this);var n=(t=kr.__defaultExtensionClasses)!==null&&t!==void 0?t:{};this.featureFlags=n.featureFlags&&new n.featureFlags(this),this.toolbar=n.toolbar&&new n.toolbar(this),this.surveys=n.surveys&&new n.surveys(this),this.conversations=n.conversations&&new n.conversations(this),this.logs=n.logs&&new n.logs(this),this.metrics=n.metrics&&new n.metrics(this),this.experiments=n.experiments&&new n.experiments(this),this.exceptions=n.exceptions&&new n.exceptions(this),this.people={set:(r,a,o)=>{var u=ct(r)?{[r]:a}:r;this.setPersonProperties(u),o==null||o({})},set_once:(r,a,o)=>{var u=ct(r)?{[r]:a}:r;this.setPersonProperties(void 0,u),o==null||o({})}},this.on("eventCaptured",(r=>be.info('send "'+(r==null?void 0:r.event)+'"',r)))}init(t,n,r){if(r&&r!==Ol){var a,o=(a=Lc[r])!==null&&a!==void 0?a:new kr;return o._init(t,n,r),Lc[r]=o,Lc[Ol][r]=o,o}return this._init(t,n,r)}_init(t,n,r){var a,o,u;n===void 0&&(n={});var h,f=ct(t)?t.trim():"";if(!f)return be.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return f!==((h=this.config)==null?void 0:h.token)?console.warn("[PostHog.js]","You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('"+f+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=Rm(n.defaults),n.debug=this.Hl(n.debug),this.zl=n,this.Ul=[],n.person_profiles?this.jl=n.person_profiles:n.process_person&&(this.jl=n.process_person);var p=Rm(n.defaults),m=w_(n),x=Pt({},p,m,{name:r,token:f});pt(p.rageclick)&&pt(m.rageclick)&&(x.rageclick=Pt({},p.rageclick,m.rageclick)),pt(p.session_recording)&&pt(m.session_recording)&&(x.session_recording=Pt({},p.session_recording,m.session_recording)),this.set_config(x),this.config.on_xhr_error&&be.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:Sr.GZipJS;var b=this.Al();if(this.persistence=new Nm(this.config,b),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Nm(de({},this.config,{persistence:"sessionStorage"}),b,!1),this.Dl="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties",this.config.persistence!=="memory"&&!b&&Mt.ri()){var y=Mt.si(this.Dl);Be(y)&&y.forEach((F=>{ct(F)&&this.Ll.add(F)}))}else Mt.ai(this.Dl);var _=de({},this.persistence.props),j=de({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Wl=new kE((F=>this.Vl(F)),this.config.request_queue_config),this.Gl=new NE(this),this.__request_queue=[];var N=this.Ml();N||(this.sessionManager=new x_(this),this.sessionPropsManager=new m_(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId(((F,W,z)=>{(z!=null&&z.activityTimeout||z!=null&&z.sessionPastMaximumLength||z!=null&&z.crossTabAdoption)&&this.Zl()}))),this.Ql(),this.config.__preview_deferred_init_extensions?(be.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Jl(N)}),0)):(be.info("Initializing extensions synchronously"),this.Jl(N)),Bt.DEBUG=Bt.DEBUG||this.config.debug,Bt.DEBUG&&be.info("Starting in debug mode",{this:this,config:n,thisC:de({},this.config),p:_,s:j}),!this.config.identity_distinct_id||(a=n.bootstrap)!=null&&a.distinctID||(n.bootstrap=de({},n.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));var w=(o=n.bootstrap)==null?void 0:o.distinctID;if(this.Rl=!!w&&!Ec(w),((u=n.bootstrap)==null?void 0:u.distinctID)!==void 0){var C=n.bootstrap.distinctID,E=this.get_distinct_id(),R=this.persistence.get_property(Je);if(n.bootstrap.isIdentifiedID&&E!=null&&E!==C&&R===cn)this.identify(C);else if(n.bootstrap.isIdentifiedID&&E!=null&&E!==C&&R===zn)be.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 L=this.config.get_device_id(is()),O=n.bootstrap.isIdentifiedID?L:C;this.persistence.set_property(Je,n.bootstrap.isIdentifiedID?zn:cn),this.register({distinct_id:C,$device_id:O})}}if(N)this.register_once({distinct_id:jl,$device_id:null},"");else if(!this.get_distinct_id()){var q=this.config.get_device_id(is());this.register_once({distinct_id:q,$device_id:q},""),this.persistence.set_property(Je,cn)}return Dt(ne,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),n.segment?(function(F,W){var z=F.config.segment;if(!z)return W();(function(I,A){var X=I.config.segment;if(!X)return A();var Z=B=>{var $=()=>B.anonymousId()||is();I.config.get_device_id=$,B.id()&&(I.register({distinct_id:B.id(),$device_id:$()}),I.persistence.set_property(Je,zn)),A()},G=X.user();"then"in G&&Un(G.then)?G.then(Z):Z(G)})(F,(()=>{z.register((I=>{typeof Promise<"u"&&Promise.resolve||km.warn("This browser does not have Promise support, and can not use the segment integration");var A=(X,Z)=>{if(!Z)return X;X.event.userId||X.event.anonymousId===I.get_distinct_id()||(km.info("No userId set, resetting PostHog"),I.reset()),X.event.userId&&X.event.userId!==I.get_distinct_id()&&(km.info("UserId set, identifying with PostHog"),I.identify(X.event.userId));var G=I.calculateEventProperties(Z,X.event.properties);return X.event.properties=Object.assign({},G,X.event.properties),X};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:X=>A(X,X.event.event),page:X=>A(X,zl),identify:X=>A(X,vm),screen:X=>A(X,"$screen")}})(F)).then((()=>{W()}))}))})(this,(()=>this.Kl())):this.Kl(),Un(this.config._onCapture)&&this.config._onCapture!==Th&&(be.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(F=>this.config._onCapture(F.event,F)))),this.config.ip&&be.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this.config.disableDeviceModel||(function(){return J2.apply(this,arguments)})().then((F=>{F&&this.register({[gm]:F})})).catch(Th),this}Yl(t){var n=t;return ct(n.name)&&Un(n.setup)}Xl(t,n){this.Yl(t)?n.push((()=>{this.tu().add(t).catch((()=>t.dispose==null?void 0:t.dispose())).catch((r=>{be.error('Failed to dispose browser extension "'+t.name+'"',r)}))})):this.ml.push(t)}Ql(){var t,n,r,a,o,u,h=(t=(n=this.config.__extensionClasses)==null?void 0:n.featureFlags)!==null&&t!==void 0?t:(r=kr.__defaultExtensionClasses)==null?void 0:r.featureFlags;h&&(this.featureFlags&&this.featureFlags instanceof h||((a=this.eu)==null||a.call(this),this.eu=void 0,this.featureFlags=new h(this)),Un(this.featureFlags.onReloading)&&Un(this.featureFlags.setup)?this.eu||(this.eu=this.featureFlags.onReloading((()=>{this.wl.emit("featureFlagsReloading",!0)})),this.tu().add(this.featureFlags)):(o=(u=this.featureFlags).initialize)==null||o.call(u))}Jl(t){var n,r,a,o,u,h,f,p=performance.now(),m=de({},kr.__defaultExtensionClasses,this.config.__extensionClasses),x=[];m.exceptions&&this.ml.push(this.exceptions=(n=this.exceptions)!==null&&n!==void 0?n:new m.exceptions(this)),m.historyAutocapture&&this.ml.push(this.historyAutocapture=new m.historyAutocapture(this)),m.tracingHeaders&&this.ml.push(this.tracingHeaders=new m.tracingHeaders(this)),m.siteApps&&this.ml.push(this.siteApps=new m.siteApps(this)),m.sessionRecording&&!t&&this.ml.push(this.sessionRecording=new m.sessionRecording(this)),this.config.disable_scroll_properties||x.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),m.autocapture&&this.Xl(this.autocapture=new m.autocapture(this),x),m.surveys&&this.Xl(this.surveys=(r=this.surveys)!==null&&r!==void 0?r:new m.surveys(this),x),m.logs&&this.Xl(this.logs=(a=this.logs)!==null&&a!==void 0?a:new m.logs(this),x),m.metrics&&this.ml.push(this.metrics=(o=this.metrics)!==null&&o!==void 0?o:new m.metrics(this)),m.conversations&&this.ml.push(this.conversations=(u=this.conversations)!==null&&u!==void 0?u:new m.conversations(this)),m.productTours&&this.ml.push(this.productTours=new m.productTours(this)),m.heatmaps&&this.ml.push(this.heatmaps=new m.heatmaps(this)),m.webVitalsAutocapture&&this.ml.push(this.webVitalsAutocapture=new m.webVitalsAutocapture(this)),m.exceptionObserver&&this.ml.push(this.exceptionObserver=new m.exceptionObserver(this)),m.deadClicksAutocapture&&this.ml.push(this.deadClicksAutocapture=new m.deadClicksAutocapture(this,iE)),m.toolbar&&this.ml.push(this.toolbar=(h=this.toolbar)!==null&&h!==void 0?h:new m.toolbar(this)),m.experiments&&this.ml.push(this.experiments=(f=this.experiments)!==null&&f!==void 0?f:new m.experiments(this)),this.ml.forEach((b=>{b.initialize&&x.push((()=>{b.initialize==null||b.initialize()}))})),x.push((()=>{if(this.iu){var b=this.iu;this.iu=void 0,this.ml.forEach((y=>y.onRemoteConfig==null?void 0:y.onRemoteConfig(b)))}})),this.ru(x,p)}ru(t,n){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-n>=30&&t.length>0)return void setTimeout((()=>{this.ru(t,n)}),0);var r=t.shift();if(r)try{r()}catch(o){be.error("Error initializing extension:",o)}}var a=Math.round(performance.now()-n);this.register_for_session({[f2]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[p2]:a}),this.config.__preview_deferred_init_extensions&&be.info("PostHog extensions initialized ("+a+"ms)")}uo(t){var n;if(!pe||!pe.body)return be.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.uo(t)}),500);if(this.config.__preview_deferred_init_extensions&&(this.iu=t),this._l=t,this.compression=void 0,t.ok){var r,a=t.config;a.supportedCompression&&!this.config.disable_compression&&(this.compression=Fe(a.supportedCompression,Sr.GZipJS)?Sr.GZipJS:Fe(a.supportedCompression,Sr.Base64)?Sr.Base64:void 0),(r=a.analytics)!=null&&r.endpoint&&(this.analyticsDefaultEndpoint=a.analytics.endpoint)}this.set_config({person_profiles:this.jl?this.jl:Vg}),(n=this.nu)==null||n.handleRemoteConfig(t),this.ml.forEach((o=>o.onRemoteConfig==null?void 0:o.onRemoteConfig(t)))}Kl(){try{this.config.loaded(this)}catch(r){be.critical("`loaded` function failed",r)}if(this.su(),this.config.internal_or_test_user_hostname&&Zt!=null&&Zt.hostname){var t=Zt.hostname,n=this.config.internal_or_test_user_hostname;(typeof n=="string"?t===n:n.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.Ml())&&this.au()}),1),this.ou=new F2(this),this.ou.load()}su(){var t;this.is_capturing()&&this.config.request_batching&&((t=this.Wl)==null||t.enable())}_dom_loaded(){this.is_capturing()&&Cd(this.__request_queue,(t=>this.Vl(t))),this.__request_queue=[],this.su()}_handle_unload(){var t,n,r,a,o;(t=this.surveys)==null||t.handlePageUnload==null||t.handlePageUnload(),(n=this.metrics)==null||n.flush("sendBeacon"),this.config.request_batching?(this.lu()&&this.capture(xm),(r=this.logs)==null||r.flushLogs("sendBeacon"),(a=this.Wl)==null||a.unload(),(o=this.Gl)==null||o.unload()):this.lu()&&this.capture(xm,null,{transport:"sendBeacon"})}_send_request(t){var n;this.__loaded?aS?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(t.callback==null||t.callback({statusCode:429})):(t.transport=t.transport||this.config.api_transport,t.headers=de({},this.config.request_headers,t.headers),t.compression=t.compression==="best-available"?(n=this.compression)!==null&&n!==void 0?n:t.compressionFallback:t.compression,(ue(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(r=>{var a,o,u,h=de({},r);h.timeout=h.timeout||6e4;var f,p,m,x,b,y=(a=h.transport)!==null&&a!==void 0?a:"fetch";y==="sendBeacon"&&ue(h.compression)&&h.data&&(h.compression=Sr.Base64),h.method==="POST"&&h.data&&(h.timestampMode==="capture-body"?h.data={api_key:(p=(b=(x=(Be(f=h.data)?f:[f]).map((w=>de({},w,w.timestamp instanceof Date&&!isNaN(w.timestamp.getTime())?{timestamp:w.timestamp.toISOString()}:{}))))[0])==null||(m=b.properties)==null?void 0:m.token)!==null&&p!==void 0?p:b==null?void 0:b.token,batch:x,sent_at:new Date().toISOString()}:h.timestampMode==="body"&&(h.data=(function(w,C){return C===void 0&&(C=new Date().toISOString()),Be(w)?w.map((E=>de({},E,{sent_at:C}))):de({},w,{sent_at:C})})(h.data))),h.url=p_(h.url,h.method,h.compression,h.timestampMode);var _=Jd.filter((w=>!h.disableTransport||!w.transport||!h.disableTransport.includes(w.transport))),j=(o=(u=(function(w,C){for(var E=0;w.length>E;E++)if(w[E].transport===y)return w[E]})(_))==null?void 0:u.method)!==null&&o!==void 0?o:_[0].method;if(!j)throw new Error("No available transport method");var N=w=>{try{j(w)}catch(C){X2(C)?be.warn(C):be.error(C),h.callback==null||h.callback({statusCode:0,error:C})}};y!=="sendBeacon"&&h.data&&h.compression===Sr.GZipJS&&O3&&typeof Promise<"u"&&!Zd?wE(h).then((w=>{N(w)})).catch((w=>{if(zy(w))return Zd=!0,void N(de({},h,{compression:void 0,url:p_(r.url,r.method,void 0,r.timestampMode)}));(C=>{if(!C||typeof C!="object")return!1;var E="name"in C?String(C.name):"";return zy(C)||E===Xw})(w)&&(Zd=!0),N(h)})):j(h)})(de({},t,{callback:r=>{var a,o;this.rateLimiter.checkForLimiting(r),400>r.statusCode||(a=(o=this.config).on_request_error)==null||a.call(o,r),t.callback==null||t.callback(r)}}))):t.fireCallbackOnDrop&&(t.callback==null||t.callback({statusCode:0}))}Vl(t){this.Gl?this.Gl.retriableRequest(t):this._send_request(t)}_execute_array(t){Lm++;try{var n,r=[],a=[],o=[];Cd(t,(h=>{if(h)if(Be(n=h[0]))o.push(h);else if(Un(h))try{h.call(this)}catch(f){be.error("Error executing queued PostHog call",h,f)}else Be(h)&&n==="alias"?r.push(h):Be(h)&&n.indexOf("capture")!==-1&&Un(this[n])?o.push(h):a.push(h)}));var u=function(h,f){Cd(h,(function(p){try{if(Be(p[0])){var m=f;jt(p,(function(x){m=m[x[0]].apply(m,x.slice(1))}))}else f[p[0]].apply(f,p.slice(1))}catch(x){be.error("Error executing queued PostHog call",p,x)}}))};u(r,this),u(a,this),u(o,this)}finally{Lm--}}push(t){if(Lm>0&&Be(t)&&ct(t[0])){var n=kr.prototype[t[0]];Un(n)&&n.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,n,r){var a,o,u,h,f;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Wl){if(this.is_capturing())if(!ue(t)&&ct(t)){this.Pl();var p=!this.config.opt_out_useragent_filter&&this._is_bot();if(!p||this.config.__preview_capture_bot_pageviews){var m=r!=null&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(m==null||!m.isRateLimited){n!=null&&n.$current_url&&!ct(n==null?void 0:n.$current_url)&&(be.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),n==null||delete n.$current_url),t!=="$exception"||r!=null&&r.uu||be.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var x=new Date,b=(r==null?void 0:r.timestamp)||x,y=Dy(r==null?void 0:r.uuid,is),_={uuid:y,event:t,properties:this.calculateEventProperties(t,n||{},b,y)};t===zl&&this.config.__preview_capture_bot_pageviews&&p&&(_.event="$bot_pageview",_.properties.$browser_type="bot"),m&&(_.properties.$lib_rate_limit_remaining_tokens=m.remainingTokens);var j=t==="$feature_flag_called"&&_.properties.$feature_flag_has_experiment===!1&&this.get_property(ql)===!0;r!=null&&r.$set&&!j&&(_.$set=r==null?void 0:r.$set);var N=r==null?void 0:r.$unset;N&&(_.$unset=N);var w,C,E,R=j?void 0:this.hu(r==null?void 0:r.$set_once,t!==Hy,t===vm);if(R&&(_.$set_once=R),r!=null&&r._noTruncate||(o=this.config.properties_string_max_length,u=_,h=A=>ct(A)?A.slice(0,o):A,f=new Set,_=(function A(X,Z){if(X!==Object(X))return h?h(X):X;if(!f.has(X)){var G;if(f.add(X),Be(X))G=[],Cd(X,($=>{G.push(A($))}));else{var B={};jt(X,(($,se)=>{f.has($)||(B[se]=A($))})),G=B}return G}})(u)),_.timestamp=b,ue(r==null?void 0:r.timestamp)||(_.properties.$event_time_override_provided=!0,_.properties.$event_time_override_system_time=x),j&&(_.properties=(function(A,X){X===void 0&&(X=[]);var Z={},G=B=>{A[B]!==void 0&&(Z[B]=A[B])};return B3.forEach(G),X.forEach(G),Z})(_.properties,FE)),t===Js.DISMISSED||t===Js.SENT){var L=n==null?void 0:n[Em.SURVEY_ID],O=n==null?void 0:n[Em.SURVEY_ITERATION];sS({id:L,current_iteration:O}),_.$set=de({},_.$set,{[(w={id:L,current_iteration:O},C=t===Js.SENT?"responded":"dismissed",E="$survey_"+C+"/"+w.id,w.current_iteration&&w.current_iteration>0&&(E="$survey_"+C+"/"+w.id+"/"+w.current_iteration),E)]:!0})}else t===Js.SHOWN&&(_.$set=de({},_.$set,{[Em.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(t===pE.SHOWN){var q=n==null?void 0:n[o_.TOUR_TYPE];q&&(_.$set=de({},_.$set,{[o_.TOUR_LAST_SEEN_DATE+"/"+q]:new Date().toISOString()}))}var F=de({},_.properties.$set,_.$set);if(Vr(F)||this.setPersonPropertiesForFlags(F),!Ge(this.config.before_send)){var W=this.Xn(_);if(!W)return;(_=W).uuid=Dy(_.uuid,is)}this.wl.emit("eventCaptured",_);var z=(a=r==null?void 0:r._url)!==null&&a!==void 0?a:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),I={method:"POST",url:z,data:_,compression:"best-available",timestampMode:(r==null?void 0:r._batchKey)==="recordings"||/\/s\/(?:\?|$)/.test(z)?"body":"capture-body",batchKey:r==null?void 0:r._batchKey,transport:r==null?void 0:r.transport};return!this.config.request_batching||r&&(r==null||!r._batchKey)||r!=null&&r.send_instantly?this.Vl(I):this.Wl.enqueue(I),_}be.critical("This capture call is ignored due to client rate limiting.")}}else be.error("No event name provided to posthog.capture")}else be.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(n=>t(n.event,n)))}getExtension(t){var n;return(n=this.nu)==null?void 0:n.getExtension(t)}tu(){var t;return(t=this.nu)!==null&&t!==void 0?t:this.nu=new $E(this)}Sl(t){this.$l.push(t);var n=!0;return()=>{if(n){n=!1;var r=this.$l.indexOf(t);r!==-1&&this.$l.splice(r,1)}}}du(t){var n,r,a;return t===void 0&&(t=!0),!((n=this.persistence)==null||!n.consumeCookieIdentityChange())&&(this.Bl=null,this.persistence.get_property(Je)===cn&&((a=this.sessionPersistence)==null||a.clear(),this.Ll.clear(),this.vu()),(r=this.featureFlags)==null||r.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,n,r,a,o){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return n;this.persistence.syncCookieProperties(),this.du();var u=o?void 0:this.persistence.remove_event_timer(t),h=de({},n);if(h.token=this.config.token,h.$config_defaults=this.config.defaults,this.Ml()&&(h[h2]=!0),t==="$snapshot"){var f=de({},this.persistence.properties(),this.sessionPersistence.properties());return h.distinct_id=f.distinct_id,(!ct(h.distinct_id)&&!an(h.distinct_id)||Ec(h.distinct_id))&&be.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),h}var p,m=(function(L,O,q,F){var W,z,I,A;if(F===void 0&&(F=!1),!cr)return{};var X,Z=L?[...Jl,...O||[]]:[],G=Yw(cr),B=G[0],$=G[1],se=(X=typeof navigator<"u"?navigator:void 0)!=null&&X.brave?{brave:!0}:{},ae={};ue(q)||(ae.detectGoogleSearchApp=q);var D={},P=(W=navigator)==null||(W=W.userAgentData)==null?void 0:W.platform,J=(z=navigator)==null?void 0:z.maxTouchPoints,M=ne==null||(I=ne.screen)==null?void 0:I.width,ge=ne==null||(A=ne.screen)==null?void 0:A.height,we=ne==null?void 0:ne.devicePixelRatio;ue(P)||(D.userAgentDataPlatform=P),ue(J)||(D.maxTouchPoints=J),ue(M)||(D.screenWidth=M),ue(ge)||(D.screenHeight=ge),ue(we)||(D.devicePixelRatio=we);var Ce,ze,Ee,Pe,et,Et,mt,yt,_t=Pt(Ox({$os:B,$os_version:$,$browser:Gw(cr,navigator.vendor,se,ae),$device:My(cr),$device_type:(ze=cr,Ee=D,yt=My(ze),yt===Ew||yt===Cw||yt==="Kobo"||yt==="Kindle Fire"||yt===Uw?Yl:yt===Uc||yt===Hl||yt===Ic||yt===kg?"Console":yt===Tw?"Wearable":yt?Nr:(Ee==null?void 0:Ee.userAgentDataPlatform)==="Android"&&((Pe=Ee==null?void 0:Ee.maxTouchPoints)!==null&&Pe!==void 0?Pe:0)>0?600>Math.min((et=Ee==null?void 0:Ee.screenWidth)!==null&&et!==void 0?et:0,(Et=Ee==null?void 0:Ee.screenHeight)!==null&&Et!==void 0?Et:0)/((mt=Ee==null?void 0:Ee.devicePixelRatio)!==null&&mt!==void 0?mt:1)?Nr:Yl:"Desktop"),$timezone:$2(),$timezone_offset:dE()}),{$current_url:Vc(F?Vi(Zt==null?void 0:Zt.href):Zt==null?void 0:Zt.href,Z,Gc),$host:Zt==null?void 0:Zt.host,$pathname:Zt==null?void 0:Zt.pathname,$raw_user_agent:cr.length>1e3?cr.substring(0,997)+"...":cr,$browser_version:i4(cr,navigator.vendor,se,ae),$browser_language:a_(),$browser_language_prefix:(Ce=a_(),typeof Ce=="string"?Ce.split("-")[0]:void 0),$screen_height:ne==null?void 0:ne.screen.height,$screen_width:ne==null?void 0:ne.screen.width,$viewport_height:ne==null?void 0:ne.innerHeight,$viewport_width:ne==null?void 0:ne.innerWidth,$lib:Bt.LIB_NAME,$lib_version:Bt.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Bt.SDK_DIST_CHANNEL&&(_t.$sdk_dist_channel=Bt.SDK_DIST_CHANNEL),_t})(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var x=this.sessionManager.checkAndGetSessionAndWindowId(o,r.getTime(),!0),b=x.windowId;h.$session_id=x.sessionId,h.$window_id=b}this.sessionPropsManager&&Pt(h,this.sessionPropsManager.getSessionProps());try{var y;this.sessionRecording&&Pt(h,this.sessionRecording.sdkDebugProperties),h.$sdk_debug_retry_queue_size=(y=this.Gl)==null?void 0:y.length}catch(L){h.$sdk_debug_error_capturing_properties=String(L)}if(this.requestRouter.region===sx&&(h.$lib_custom_api_host=this.config.api_host),p=t!==zl||o?t!==xm||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,a),h=Pt(h,p),t===zl&&pe&&(h.title=pe.title),!ue(u)){var _=r.getTime()-u;h.$duration=parseFloat((_/1e3).toFixed(3))}cr&&this.config.opt_out_useragent_filter&&(h.$browser_type=this._is_bot()?"bot":"browser");var j=this.persistence.properties(),N=this.sessionPersistence.properties();jt(["$referrer","$referring_domain"],(L=>{L in j&&delete N[L]}));var w={};if(this.$l.length>0)for(var C of this.$l.slice())try{Pt(w,C())}catch(L){be.error("Failed to produce browser extension event properties",L)}(h=Pt({},m,j,N,de({},w,h))).$is_identified=this._isIdentified(),Be(this.config.property_denylist)?jt(this.config.property_denylist,(function(L){delete h[L]})):be.error(iS+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var E=this.config.sanitize_properties;E&&(be.error(__),h=E(h,t));var R=this.cu();return h.$process_person_profile=R,R&&!o&&this.fu("_calculate_event_properties"),h}hu(t,n,r){var a;if(n===void 0&&(n=!0),r===void 0&&(r=!1),!this.persistence||!this.cu()||this.Ol&&!r)return t;var o=this.persistence.get_initial_props(),u=(a=this.sessionPropsManager)==null?void 0:a.getSetOnceProps(),h=Pt({},o,u||{},t||{}),f=this.config.sanitize_properties;return f&&(be.error(__),h=f(h,"$set_once")),n&&(this.Ol=!0),Vr(h)?void 0:h}register(t,n){var r;(r=this.persistence)==null||r.register(t,n)}register_once(t,n,r){var a;(a=this.persistence)==null||a.register_once(t,n,r)}register_for_session(t){var n,r;(n=this.persistence)==null||n.syncCookieProperties(),this.du(),(r=this.sessionPersistence)==null||r.register(t),Object.keys(t).forEach((a=>this.Ll.add(a))),this.vu()}unregister(t){var n;(n=this.persistence)==null||n.unregister(t)}unregister_for_session(t){var n;(n=this.sessionPersistence)==null||n.unregister(t),this.Ll.delete(t),this.vu()}pu(t,n){this.register({[t]:n})}Zl(){this.Ll.forEach((t=>{var n;(n=this.sessionPersistence)==null||n.unregister(t)})),this.Ll.clear(),this.vu()}vu(){var t;if(this.Dl)if(this.config.persistence==="memory"||(t=this.sessionPersistence)!=null&&t.xa||!Mt.ri())Mt.ai(this.Dl);else{var n=[];this.Ll.forEach((r=>n.push(r))),n.length>0?Mt.ii(this.Dl,n):Mt.ai(this.Dl)}}getFeatureFlag(t,n){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlag(t,n)}getFeatureFlagPayload(t){var n;return(n=this.featureFlags)==null?void 0:n.getFeatureFlagPayload(t)}getFeatureFlagResult(t,n){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlagResult(t,n)}getAllFeatureFlags(){var t,n;return(t=(n=this.featureFlags)==null?void 0:n.getAllFeatureFlags())!==null&&t!==void 0?t:[]}isFeatureEnabled(t,n){var r,a;return(r=(a=this.featureFlags)==null?void 0:a.isFeatureEnabled(t,n))!==null&&r!==void 0?r:n==null?void 0:n.defaultValue}reloadFeatureFlags(){var t;(t=this.featureFlags)==null||t.reloadFeatureFlags()}updateFlags(t,n,r){var a;(a=this.featureFlags)==null||a.updateFlags(t,n,r)}updateEarlyAccessFeatureEnrollment(t,n,r){var a;(a=this.featureFlags)==null||a.updateEarlyAccessFeatureEnrollment(t,n,r)}getEarlyAccessFeatures(t,n,r){var a;return n===void 0&&(n=!1),(a=this.featureFlags)==null?void 0:a.getEarlyAccessFeatures(t,n,r)}on(t,n){return this.wl.on(t,n)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:hc}),()=>{})}onSessionId(t){var n,r;return(n=(r=this.sessionManager)==null?void 0:r.onSessionId(t))!==null&&n!==void 0?n:()=>{}}getSurveys(t,n){n===void 0&&(n=!1),this.surveys?this.surveys.getSurveys(t,n):t([],{isLoaded:!1,error:hc})}getActiveMatchingSurveys(t,n){n===void 0&&(n=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,n):t([],{isLoaded:!1,error:hc})}renderSurvey(t,n){var r;(r=this.surveys)==null||r.renderSurvey(t,n)}displaySurvey(t,n){var r;n===void 0&&(n=LE),(r=this.surveys)==null||r.displaySurvey(t,n)}cancelPendingSurvey(t){var n;(n=this.surveys)==null||n.cancelPendingSurvey(t)}canRenderSurvey(t){var n,r;return(n=(r=this.surveys)==null?void 0:r.canRenderSurvey(t))!==null&&n!==void 0?n:{visible:!1,disabledReason:hc}}canRenderSurveyAsync(t,n){var r,a;return n===void 0&&(n=!1),(r=(a=this.surveys)==null?void 0:a.canRenderSurveyAsync(t,n))!==null&&r!==void 0?r:Promise.resolve({visible:!1,disabledReason:hc})}gu(t){return!t||Ec(t)?(be.critical("Unique user id has not been set in posthog.identify"),!1):t===jl?(be.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())||(be.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(t,n,r){if(!this.__loaded||!this.persistence)return be.uninitializedWarning("posthog.identify");if(an(t)&&(t=t.toString(),be.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.gu(t)&&this.fu("posthog.identify")){this.Pl();var a=this.get_distinct_id(),o=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==a,u=this.du(!1),h=this.persistence.za(),f=!1;try{var p=this.get_distinct_id();this.register({$user_id:t}),this.get_property(Hc)||this.register_once({$had_persisted_distinct_id:!0,$device_id:p},""),t!==p&&t!==this.get_property(Pl)&&(this.unregister(Pl),this.register({distinct_id:t}));var m,x=(this.persistence.get_property(Je)||cn)===cn,b=t!==p,y=!b&&x;if(b&&x)this.persistence.set_property(Je,zn),this.setPersonPropertiesForFlags({$set:n||{},$set_once:r||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Ua(),this.capture(vm,{distinct_id:t,$anon_distinct_id:p},{$set:n||{},$set_once:r||{}}),this.Bl=Dm(t,n,r),(m=this.featureFlags)==null||m.setAnonymousDistinctId(p);else if(y){this.persistence.set_property(Je,zn);var _=n||{},j=r||{};this.setPersonPropertiesForFlags({$set:_,$set_once:j},!1),this.config.cookieWinsOnConflict&&this.persistence.Ua(),this.capture("$set",{$set:_,$set_once:j}),this.Bl=Dm(t,n,r)}else(n||r)&&this.setPersonProperties(n,r);b||o||u?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(Ks)):y&&(n||r)&&this.reloadFeatureFlags(),f=!0}finally{h&&this.persistence.Ga(f)}}}setPersonProperties(t,n){if((t||n)&&this.fu("posthog.setPersonProperties")){var r=Dm(this.get_distinct_id(),t,n);this.Bl!==r?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:n||{}},!0),this.capture("$set",{$set:t||{},$set_once:n||{}}),this.Bl=r):be.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var n,r=(Be(t)?t:[t]).filter((a=>ct(a)&&a.length>0));r.length!==0&&this.fu("posthog.unsetPersonProperties")&&((n=this.featureFlags)==null||n.unsetPersonPropertiesForFlags(r,!0),this.capture("$set",{$unset:r}),this.Bl=null)}group(t,n,r){var a;if(t&&n){(a=this.persistence)==null||a.syncCookieProperties(),this.du();var o=this.getGroups(),u=o[t]!==n;if(u&&this.resetGroupPropertiesForFlags(t),this.register({$groups:de({},o,{[t]:n})}),u||r){var h={$group_type:t,$group_key:n};r&&(h.$group_set=r),this.capture(Hy,h)}r&&this.setGroupPropertiesForFlags({[t]:r}),u&&!r&&this.reloadFeatureFlags()}else be.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,n){var r;n===void 0&&(n=!0),(r=this.featureFlags)==null||r.setPersonPropertiesForFlags(t,n)}resetPersonPropertiesForFlags(t){var n;t===void 0&&(t=!0),(n=this.featureFlags)==null||n.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,n){var r;n===void 0&&(n=!0),this.fu("posthog.setGroupPropertiesForFlags")&&((r=this.featureFlags)==null||r.setGroupPropertiesForFlags(t,n))}resetGroupPropertiesForFlags(t){var n;(n=this.featureFlags)==null||n.resetGroupPropertiesForFlags(t)}reset(t){var n=Kn(t)?t:t==null?void 0:t.resetDeviceID,r=Kn(t)||t==null?void 0:t.bootstrap;this.mu(n,!1,r)}mu(t,n,r){var a,o,u;if(n===void 0&&(n=!1),be.info("reset"),!this.__loaded)return be.uninitializedWarning("posthog.reset");var h=r==null?void 0:r.sessionID;this.config.bootstrap=r||((a=this.zl)==null?void 0:a.bootstrap)||{},(o=this.featureFlags)==null||o.updateConfig==null||o.updateConfig(this.config,this.ho());var f=this.get_property(Hc),p=this.get_property(gm),m=this.get_property(Ma),x=this.is_capturing();this.consent.reset(),n||!x||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");var b=(u=this.persistence)==null||u.za==null?void 0:u.za(),y=!1;try{var _,j,N,w,C,E,R,L,O,q,F,W,z;if((_=this.persistence)==null||_.clear(),(j=this.sessionPersistence)==null||j.clear(),this.Ll.clear(),this.vu(),ue(m)||(q=this.persistence)==null||q.register({[Ma]:m}),(N=this.surveys)==null||N.reset(),(w=this.featureFlags)==null||w.reset(),(C=this.conversations)==null||C.reset(),(E=this.logs)==null||E.reset(),(R=this.metrics)==null||R.reset(),(L=this.persistence)==null||L.set_property(Je,cn),(O=this.sessionManager)==null||O.resetSessionId(),this.Bl=null,this.config.cookieless_mode===Zs)this.register_once({distinct_id:jl,$device_id:null},"");else{var I=this.config.get_device_id(is());this.register_once({distinct_id:I,$device_id:t?I:f},""),t||ue(p)||this.register({[gm]:p})}if(this.register({$last_posthog_reset:new Date().toISOString()},1),r&&(r.distinctID===void 0||this.Ml()||((z=this.persistence)==null||z.set_property(Je,r.isIdentifiedID?zn:cn),this.register({distinct_id:r.distinctID})),(F=this.featureFlags)==null||F.initialize(),!(ue(h)||(W=this.sessionManager)!=null&&W.setBootstrapSessionId(h,!0)))){var A=de({},r);delete A.sessionID,this.config.bootstrap=A}delete this.config.identity_distinct_id,delete this.config.identity_hash,y=!0}finally{var X;b&&((X=this.persistence)==null||X.Ga==null||X.Ga(y))}this.reloadFeatureFlags()}shutdown(t){var n=this;return $t((function*(){var r,a,o,u,h,f,p;if(n.__loaded){n.tu().dispose(),(r=n.sessionRecording)==null||r.dispose(),(a=n.logs)==null||a.flushLogs("sendBeacon"),(o=n.metrics)==null||o.flush("sendBeacon"),(u=n.Wl)==null||u.unload(),(h=n.Gl)==null||h.unload();try{var m;(m=n.featureFlags)==null||m.destroy()}catch(x){be.error("Error while destroying feature flags",x)}(f=n.persistence)==null||f.destroy(),(p=n.sessionPersistence)==null||p.destroy()}else be.uninitializedWarning("posthog.shutdown")}))()}setIdentity(t,n){var r;this.config.identity_distinct_id=t,this.config.identity_hash=n,this.alias(t),(r=this.conversations)==null||r.yu()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,(t=this.conversations)==null||t.bu()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,n;return(t=(n=this.sessionManager)==null?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&t!==void 0?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var n=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=n.sessionStartTimestamp,a=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+n.sessionId);if(t!=null&&t.withTimestamp&&r){var o,u=(o=t.timestampLookBack)!==null&&o!==void 0?o:10;if(!r)return a;a+="?t="+Math.max(Math.floor((new Date().getTime()-r)/1e3)-u,0)}return a}alias(t,n){return t===this.get_property(i2)?(be.critical("Attempting to create alias for existing People user - aborting."),-2):this.fu("posthog.alias")?(ue(n)&&(n=this.get_distinct_id()),t!==n?(this.pu(Pl,t),this.capture("$create_alias",{alias:t,distinct_id:n})):(be.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var n=de({},this.config);if(pt(t)){var r,a,o,u,h,f,p,m,x,b,y,_;Pt(this.config,w_(t));var j=this.Al();(r=this.persistence)==null||r.update_config(this.config,n,j),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Nm(de({},this.config,{persistence:"sessionStorage"}),j,!1);var N,w=this.Hl(this.config.debug);Kn(w)&&(this.config.debug=w),Kn(this.config.debug)&&(this.config.debug?(Bt.DEBUG=!0,at.ri()&&at.ii("ph_debug",!0),be.info("set_config",{config:t,oldConfig:n,newConfig:de({},this.config)})):(Bt.DEBUG=!1,at.ri()&&at.ai("ph_debug"))),(a=this.featureFlags)==null||a.updateConfig==null||a.updateConfig(this.config,this.ho()),(o=this.exceptionObserver)==null||o.onConfigChange(),(u=this.exceptions)==null||u.onConfigChange(),(h=this.sessionRecording)==null||h.startIfEnabledOrStop(),(f=this.tracingHeaders)==null||f.startIfEnabledOrStop(),(p=this.autocapture)==null||p.startIfEnabled(),(m=this.heatmaps)==null||m.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&((N=this.historyAutocapture)==null||N.startIfEnabledOrStop()),(x=this.exceptionObserver)==null||x.startIfEnabledOrStop(),(b=this.deadClicksAutocapture)==null||b.startIfEnabledOrStop(),(y=this.surveys)==null||y.loadIfEnabled(),this.Fl(),(_=this.externalIntegrations)==null||_.startIfEnabledOrStop()}}_overrideSDKInfo(t,n){Bt.LIB_NAME=t,Bt.LIB_VERSION=n}startSessionRecording(t){var n,r,a,o,u,h=t===!0,f={sampling:h||!(t==null||!t.sampling),linked_flag:h||!(t==null||!t.linked_flag),url_trigger:h||!(t==null||!t.url_trigger),event_trigger:h||!(t==null||!t.event_trigger)};Object.values(f).some(Boolean)&&((n=this.sessionManager)==null||n.checkAndGetSessionAndWindowId(),f.sampling&&((r=this.sessionRecording)==null||r.overrideSampling()),f.linked_flag&&((a=this.sessionRecording)==null||a.overrideLinkedFlag()),f.url_trigger&&((o=this.sessionRecording)==null||o.overrideTrigger("url")),f.event_trigger&&((u=this.sessionRecording)==null||u.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!((t=this.sessionRecording)==null||!t.started)}captureException(t,n){if(this.exceptions){var r=new Error("PostHog syntheticException"),a=this.exceptions.buildProperties(t,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(de({},a,n))}}addExceptionStep(t,n){var r;(r=this.exceptions)==null||r.addExceptionStep(t,n)}captureLog(t){var n;(n=this.logs)==null||n.captureLog(t)}get logger(){var t,n;return(t=(n=this.logs)==null?void 0:n.logger)!==null&&t!==void 0?t:kr._u}startExceptionAutocapture(t){this.set_config({capture_exceptions:t==null||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var n,r;return(n=(r=this.toolbar)==null?void 0:r.loadToolbar(t))!==null&&n!==void 0&&n}get_property(t){var n;return(n=this.persistence)==null?void 0:n.props[t]}getSessionProperty(t){var n;return(n=this.sessionPersistence)==null?void 0:n.props[t]}toString(){var t,n=(t=this.config.name)!==null&&t!==void 0?t:Ol;return n!==Ol&&(n=Ol+"."+n),n}_isIdentified(){var t,n;return((t=this.persistence)==null?void 0:t.get_property(Je))===zn||((n=this.sessionPersistence)==null?void 0:n.get_property(Je))===zn}cu(){var t,n;return!(this.config.person_profiles==="never"||this.config.person_profiles===Vg&&!this._isIdentified()&&Vr(this.getGroups())&&((t=this.persistence)==null||(t=t.props)==null||!t[Pl])&&((n=this.persistence)==null||(n=n.props)==null||!n[yh]))}lu(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&!!this.config.capture_pageview}createPersonProfile(){this.cu()||this.fu("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.fu("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}fu(t){return this.config.person_profiles==="never"?(be.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.El(),this.pu(yh,!0),!0)}Al(){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!==Fi)}Fl(){var t,n,r,a,o,u=this.Al();return this.is_capturing()||(r=this.logs)==null||r.wu(),((t=this.persistence)==null?void 0:t.xa)!==u&&((a=this.persistence)==null||a.set_disabled(u)),((n=this.sessionPersistence)==null?void 0:n.xa)!==u&&((o=this.sessionPersistence)==null||o.set_disabled(u)),u&&(this.Ll.clear(),this.vu()),u}opt_in_capturing(t){var n;if(this.config.cookieless_mode!==Zs){if(this.Ml()){var r,a,o,u,h,f;(r=this.sessionRecording)==null||r.dispose({discardBufferedEvents:!0}),this.mu(!0,!0),(a=this.sessionManager)==null||a.destroy(),(o=this.pageViewManager)==null||o.destroy(),this.sessionManager=new x_(this),this.pageViewManager=new i_(this),this.persistence&&(this.sessionPropsManager=new m_(this,this.sessionManager,this.persistence));var p,m=(u=(h=this.config.__extensionClasses)==null?void 0:h.sessionRecording)!==null&&u!==void 0?u:(f=kr.__defaultExtensionClasses)==null?void 0:f.sessionRecording;m&&(this.sessionRecording=this.Tl(this.sessionRecording,new m(this)),this._l&&((p=this.sessionRecording)==null||p.onRemoteConfig==null||p.onRemoteConfig(this._l)))}var x,b;this.consent.optInOut(!0),this.Fl(),this.su(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),this.config.cookieless_mode==Fi&&((x=this.surveys)==null||x.loadIfEnabled()),(ue(t==null?void 0:t.captureEventName)||t!=null&&t.captureEventName)&&this.capture((b=t==null?void 0:t.captureEventName)!==null&&b!==void 0?b:"$opt_in",t==null?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.au()}else be.warn(y_)}opt_out_capturing(){if(this.config.cookieless_mode!==Zs){var t,n,r=this.config.cookieless_mode===Fi?this.sessionRecording:void 0;r==null||r.dispose({discardBufferedEvents:!0}),this.config.cookieless_mode===Fi&&this.consent.isOptedIn()&&this.mu(!0,!0),this.consent.optInOut(!1),this.Fl(),this.config.cookieless_mode===Fi&&(this.register({distinct_id:jl,$device_id:null}),this.Cl(r),this.sessionRecording=void 0,(t=this.sessionManager)==null||t.destroy(),(n=this.pageViewManager)==null||n.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.au(),this.su())}else be.warn(y_)}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===Zs||(this.config.cookieless_mode===Fi?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Fl()}_is_bot(){return Nn?Z2(Nn,this.config.custom_blocked_useragents):void 0}au(){pe&&(pe.visibilityState==="visible"?this.Nl||(this.Nl=!0,this.capture(zl,{title:pe.title},{send_instantly:!0}),this.ql&&(pe.removeEventListener(Xl,this.ql),this.ql=null)):this.ql||(this.ql=this.au.bind(this),Dt(pe,Xl,this.ql)))}debug(t){t===!1?(ne==null||ne.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(ne==null||ne.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}))}ho(){var t=this.zl||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(be.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(function(n,r,a,o,u){var h=r in n&&!Ge(n[r]),f=a in n&&!Ge(n[a]);return h?n[r]:!!f&&(u&&u.warn("Config field '"+a+"' is deprecated. Please use '"+r+"' instead. The old field will be removed in a future major version."),n[a])})(t,"advanced_disable_flags","advanced_disable_decide",0,be)}Xn(t){var n;if(Ge(this.config.before_send))return t;var r=Object.keys((n=t.properties)!==null&&n!==void 0?n:{}).filter(Y3),a=Be(this.config.before_send)?this.config.before_send:[this.config.before_send],o=t;for(var u of a)try{if(o=u(o),Ge(o)){var h="Event '"+t.event+"' was rejected in beforeSend function";return G3(t.event)?be.warn(h+". This can cause unexpected behavior."):be.info(h),null}o.properties&&!Vr(o.properties)||be.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}catch(p){return be.error("Error in beforeSend function for event '"+t.event+"':",p),null}for(var f of r)if(o.properties&&Ge(o.properties[f]))return be.warn("Event '"+t.event+"' had its '"+f+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return o}getPageViewId(){var t;return(t=this.pageViewManager.ta)==null?void 0:t.pageViewId}captureTraceFeedback(t,n){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:n})}captureTraceMetric(t,n,r){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:n,$ai_metric_value:String(r)})}Hl(t){var n=Kn(t)&&!t,r=at.ri()&&at.ni("ph_debug")==="true";return!n&&(!!r||t)}}kr.__defaultExtensionClasses={},kr._u=(()=>{var e=()=>{};return{trace:e,debug:e,info:e,warn:e,error:e,fatal:e}})(),(function(e,t){for(var n=0;t.length>n;n++)e.prototype[t[n]]=$4(e.prototype[t[n]])})(kr,["identify"]);class lS{constructor(t){this.disabled=t===!1;var n=pt(t)?t:{};this.thresholdPx=n.threshold_px||30,this.timeoutMs=n.timeout_ms||1e3,this.clickCount=n.click_count||3,this.clicks=[]}isRageClick(t,n,r){if(this.disabled)return!1;var a=this.clicks[this.clicks.length-1];if(a&&Math.abs(t-a.x)+Math.abs(n-a.y)<this.thresholdPx&&this.timeoutMs>r-a.timestamp){if(this.clicks.push({x:t,y:n,timestamp:r}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:n,timestamp:r}];return!1}}var zm="$copy_autocapture",Ld=Vt("[AutoCapture]");function Om(e,t){return t.length>e?t.slice(0,e)+"...":t}function qE(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!Gi(t));return t}function VE(e,t){var n,r,a=t.e,o=t.maskAllElementAttributes,u=t.maskAllText,h=t.elementAttributeIgnoreList,f=t.elementsChainAsString,p=t.disableCaptureUrlHashes;if(!Gi(e))return{props:{}};for(var m=[e],x=new Set([e]),b=e;b.parentNode&&!jr(b,"body")&&_2>m.length;)if(y2(b.parentNode)){var y=b.parentNode.host;if(x.has(y))break;x.add(y),m.push(y),b=y}else{if(!Gi(b.parentNode)||x.has(b.parentNode))break;x.add(b.parentNode),m.push(b.parentNode),b=b.parentNode}var _,j,N=[],w={},C=!1,E=!1;if(jt(m,(F=>{var W=Kg(F);if(jr(F,"a")){var z=F.getAttribute("href");C=!!(W&&z&&Mc(z))&&(p?Vi(z):z)}Fe(kh(F),"ph-no-capture")&&(E=!0),N.push((function(A,X,Z,G,B){B===void 0&&(B=!1);var $=A.tagName.toLowerCase(),se={tag_name:$};Px.indexOf($)>-1&&!Z&&(se.$el_text=$.toLowerCase()==="a"||$.toLowerCase()==="button"?Om(1024,n_(A)):Om(1024,qc(A)));var ae=kh(A);ae.length>0&&(se.classes=ae.filter((function(M){return M!==""}))),jt(A.attributes,(function(M){var ge;if((!C2(A)||["name","id","class","aria-label"].indexOf(M.name)!==-1)&&(G==null||!G.includes(M.name))&&!X&&Mc(M.value)&&(!ct(ge=M.name)||ge.substring(0,10)!=="_ngcontent"&&ge.substring(0,7)!=="_nghost")){var we=M.value;M.name==="class"&&(we=Bx(we).join(" ")),se["attr__"+M.name]=Om(1024,M.name==="href"&&B?Vi(we):we)}}));for(var D=1,P=1,J=A;J=qE(J);)D++,J.tagName===A.tagName&&P++;return se.nth_child=D,se.nth_of_type=P,se})(F,o,u,h,p));var I=(function(A){if(!Kg(A))return{};var X={};return jt(A.attributes,(function(Z){if(Z.name&&Z.name.indexOf("data-ph-capture-attribute")===0){var G=Z.name.replace("data-ph-capture-attribute-",""),B=Z.value;G&&B&&Mc(B)&&(X[G]=B)}})),X})(F);jt(I,((A,X)=>{({}).hasOwnProperty.call(w,X)||(w[X]=A)}))})),E)return{props:{},explicitNoCapture:E};if(u||(N[0].$el_text=jr(e,"a")||jr(e,"button")?n_(e):qc(e)),C){var R,L;N[0].attr__href=C;var O=(R=Kl(C))==null?void 0:R.host,q=ne==null||(L=ne.location)==null?void 0:L.host;O&&q&&O!==q&&(_=C)}return{props:Pt({$event_type:a.type,$ce_version:1},f?{}:{$elements:N},{$elements_chain:(j=N,Be(j)?(function(F){return F.map((W=>{var z,I,A="";if(W.tag_name&&(A+=W.tag_name),W.attr_class)for(var X of(W.attr_class.sort(),W.attr_class))A+="."+X.replace(/"/g,"");var Z=de({},W.text?{text:W.text}:{},{"nth-child":(z=W.nth_child)!==null&&z!==void 0?z:0,"nth-of-type":(I=W.nth_of_type)!==null&&I!==void 0?I:0},W.href?{href:W.href}:{},W.attr_id?{attr_id:W.attr_id}:{},W.attributes),G={};return Kd(Z).sort(((B,$)=>{return(ae=$[0])>(se=B[0])?-1:se>ae?1:0;var se,ae})).forEach((B=>{var $=B[1];return G[r_(B[0].toString())]=r_($.toString())})),(A+=":")+Kd(G).map((B=>B[0]+'="'+B[1]+'"')).join("")})).join(";")})((function(F){return F.map((W=>{var z,I,A={text:(z=W.$el_text)==null?void 0:z.slice(0,400),tag_name:W.tag_name,href:(I=W.attr__href)==null?void 0:I.slice(0,2048),attr_class:rE(W),attr_id:W.attr__id,nth_child:W.nth_child,nth_of_type:W.nth_of_type,attributes:{}};return Kd(W).filter((X=>X[0].indexOf("attr__")===0)).forEach((X=>A.attributes[X[0]]=X[1])),A}))})(j)):"")},(n=N[0])!=null&&n.$el_text?{$el_text:(r=N[0])==null?void 0:r.$el_text}:{},_&&a.type==="click"?{$external_click_url:_}:{},w)}}class GE{constructor(t){this.name="autocapture",this.Is=!1,this.Rs=null,this.Ps=!1,this.As=!1,this.gn={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.Fs=!1,this.Os=t,this.Os.refresh(this.gn),this.rageclicks=new lS(this.gn.rageclick),this.Ls=null}setup(t){this.Ds(),this.$s=t;var n=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.Fs?n.dispose():(this.Ns=n,this.startIfEnabled())}dispose(){var t;this.Fs||(this.Fs=!0,this.$s=void 0,(t=this.Ns)==null||t.dispose(),this.Ns=void 0,this.qs())}js(){return this.Os.refresh(this.gn),this.gn}Ds(){var t,n;return this.js(),this.gn.url_allowlist=(t=this.gn.url_allowlist)==null?void 0:t.map((r=>new RegExp(r))),this.gn.url_ignorelist=(n=this.gn.url_ignorelist)==null?void 0:n.map((r=>new RegExp(r))),this.gn}Bs(){if(this.isBrowserSupported()){if(ne&&pe){var t=this.Hs=r=>{r=r||(ne==null?void 0:ne.event);try{this.zs(r)}catch(a){Ld.error("Failed to capture event",a)}};if(Dt(pe,"submit",t,{capture:!0}),Dt(pe,"change",t,{capture:!0}),Dt(pe,"click",t,{capture:!0}),this.js().capture_copied_text){var n=this.Us=r=>{r=r||(ne==null?void 0:ne.event);try{this.zs(r,zm)}catch(a){Ld.error("Failed to capture clipboard event",a)}};Dt(pe,"copy",n,{capture:!0}),Dt(pe,"cut",n,{capture:!0}),Dt(pe,"paste",n,{capture:!0})}}}else Ld.info("Disabling Automatic Event Collection because this browser is not supported")}qs(){this.Hs&&(pe==null||pe.removeEventListener("submit",this.Hs,!0),pe==null||pe.removeEventListener("change",this.Hs,!0),pe==null||pe.removeEventListener("click",this.Hs,!0),this.Hs=void 0),this.Us&&(pe==null||pe.removeEventListener("copy",this.Us,!0),pe==null||pe.removeEventListener("cut",this.Us,!0),pe==null||pe.removeEventListener("paste",this.Us,!0),this.Us=void 0),this.Is=!1}startIfEnabled(){!this.Fs&&this.$s&&this.isEnabled&&!this.Is&&(this.Bs(),this.Is=!0)}onRemoteConfig(t){if(!this.Fs)if(this.Ps=!0,t.ok){var n=t.config;n.elementsChainAsString&&(this.As=n.elementsChainAsString);var r,a=n.autocapture_opt_out;Kn(a)&&((r=this.$s)==null||r.kv.set(Tg,a),this.Rs=a),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(t){this.Ls=t}getElementSelectors(t){var n,r=[];return(n=this.Ls)==null||n.forEach((a=>{var o=pe==null?void 0:pe.querySelectorAll(a);o==null||o.forEach((u=>{t===u&&r.push(a)}))})),r}get isEnabled(){var t,n;if(this.Fs)return!1;var r=(t=this.$s)==null?void 0:t.kv.get(Tg),a=this.Rs,o=this.js(),u=o.remoteRequestsDisabled&&!this.Ps;if(sn(a)&&!Kn(r)&&!u)return!1;var h=(n=this.Rs)!==null&&n!==void 0?n:!!r;return!!o.enabled&&!h}zs(t,n){if(n===void 0&&(n="$autocapture"),this.isEnabled){var r=Qg(t);b2(r)&&(r=r.parentNode||null);var a,o=this.Ds();n==="$autocapture"&&t.type==="click"&&t instanceof MouseEvent&&o.rageclick&&(a=this.rageclicks)!=null&&a.isRageClick(t.clientX,t.clientY,t.timeStamp||new Date().getTime())&&j2(r,o.rageclick)&&this.zs(t,"$rageclick");var u=n===zm,h=u?de({},o,{dom_event_allowlist:void 0}):o;if(r&&(function(w,C,E,R,L,O){var q;if(!ne||$x(w)||E!=null&&E.url_allowlist&&!Qy(E.url_allowlist,O)||E!=null&&E.url_ignorelist&&Qy(E.url_ignorelist,O))return!1;if(E!=null&&E.dom_event_allowlist){var F=E.dom_event_allowlist;if(F&&!F.some((Z=>C.type===Z)))return!1}var W=N2(w,R),z=W.parentIsUsefulElement,I=W.targetElementList;if(!(function(Z,G){var B=G==null?void 0:G.element_allowlist;if(ue(B))return!0;var $,se=function(D){if(B.some((P=>D.tagName.toLowerCase()===P)))return{v:!0}};for(var ae of Z)if($=se(ae))return $.v;return!1})(I,E)||!Xg(I,E==null?void 0:E.css_selector_allowlist)||Xg(I,(q=E==null?void 0:E.css_selector_ignorelist)!==null&&q!==void 0?q:K4))return!1;try{var A=ne.getComputedStyle(w);if(A&&A.getPropertyValue("cursor")==="pointer"&&C.type==="click")return!0}catch{}var X=w.tagName.toLowerCase();switch(X){case"html":return!1;case"form":return(L||["submit"]).indexOf(C.type)>=0;case"input":case"select":case"textarea":return(L||["change","click"]).indexOf(C.type)>=0;default:return z?(L||["click"]).indexOf(C.type)>=0:(L||["click"]).indexOf(C.type)>=0&&(Px.indexOf(X)>-1||w.getAttribute("contenteditable")==="true")}})(r,t,h,u,u?["copy","cut","paste"]:void 0,{config:{get_current_url:o.getCurrentUrl}})){var f,p=VE(r,{e:t,maskAllElementAttributes:o.maskAllElementAttributes,maskAllText:o.maskAllText,elementAttributeIgnoreList:o.element_attribute_ignorelist,elementsChainAsString:this.As,disableCaptureUrlHashes:o.disableCaptureUrlHashes}),m=p.props;if(p.explicitNoCapture)return!1;var x=this.getElementSelectors(r);if(x&&x.length>0&&(m.$element_selectors=x),n===zm){var b=t.type||"clipboard";if(b!=="paste"){var y,_,j=ne==null||(y=ne.getSelection())==null?void 0:y.toString(),N=w2(j);if(!N)return!1;m.$selected_content=N,m.$clipboard_text_length=(_=j==null?void 0:j.length)!==null&&_!==void 0?_:0}m.$copy_type=b}return(f=this.$s)==null||f.capture(n,m).catch((w=>Ld.error("Failed to capture event",w))),!0}}}isBrowserSupported(){return Un(pe==null?void 0:pe.querySelectorAll)}}class YE{constructor(t){this._instance=t}refresh(t){var n=this._instance.config,r=pt(n.autocapture)?n.autocapture:void 0;t.enabled=!!n.autocapture,t.rageclick=n.rageclick,t.maskAllElementAttributes=n.mask_all_element_attributes,t.maskAllText=n.mask_all_text,t.disableCaptureUrlHashes=n.disable_capture_url_hashes,t.getCurrentUrl=n.get_current_url,t.remoteRequestsDisabled=this._instance.ho(),t.url_allowlist=r==null?void 0:r.url_allowlist,t.url_ignorelist=r==null?void 0:r.url_ignorelist,t.dom_event_allowlist=r==null?void 0:r.dom_event_allowlist,t.element_allowlist=r==null?void 0:r.element_allowlist,t.css_selector_allowlist=r==null?void 0:r.css_selector_allowlist,t.css_selector_ignorelist=r==null?void 0:r.css_selector_ignorelist,t.element_attribute_ignorelist=r==null?void 0:r.element_attribute_ignorelist,t.capture_copied_text=r==null?void 0:r.capture_copied_text}}var fc=Vt("[ExceptionAutocapture]"),S_=()=>{},k_=e=>{var t;if(Un(e))return(t=e.__posthog_layer__)!==null&&t!==void 0?t:e.__rrweb_layer__};function oS(e,t,n){try{if(!(t in e))return S_;var r={next:e[t]},a=n((function(){for(var o=arguments.length,u=new Array(o),h=0;o>h;h++)u[h]=arguments[h];return r.next.apply(this,u)}));return Un(a)&&(a.prototype=a.prototype||{},Object.defineProperties(a,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:r}})),e[t]=a,()=>{if(e[t]!==a)for(var o=e[t],u=k_(o);u;){if(u.next===a)return void(u.next=r.next);u=k_(o=u.next)}else e[t]=r.next}}catch{return S_}}var WE=Vt("[TracingHeaders]"),wa=Vt("[Web Vitals]"),j_=9e5,N_=["CLS","FCP","INP","LCP"],QE=["INP","LCP"],XE=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],Rd="disabled",C_="lazy_loading",pc="awaiting_config",zd="missing_config";Vt("[SessionRecording]"),Vt("[SessionRecording]");var ix="[SessionRecording]",Gs=Vt(ix),KE=Vt("[Heatmaps]");function Bm(e){return pt(e)&&"clientX"in e&&"clientY"in e&&an(e.clientX)&&an(e.clientY)}var Od=Vt("[Product Tours]"),Pm=e=>{var t;return!e.config.disable_product_tours&&!((t=e.persistence)==null||!t.get_property(Lx))},ZE=["$set_once","$set"],vs=Vt("[SiteApps]"),E_="Error while initializing PostHog app with config id ",cS=(e,t)=>e!=null&&e.then?e.then(t):t(e),Ml="SDK is not enabled or survey functionality is not yet loaded",A_="Disabled. Not loading surveys.";class JE{constructor(t,n){this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.ku=!1,this.Su=[],this.xu=null,this.Cu=null,this.Fs=!1,this.Tu=new Set,this.onRemoteConfig=r=>{if(!this.Fs&&!this.gn.disableSurveys){if(!r.ok)return wt.warn("Remote config unavailable. Not loading surveys.");var a=r.config.surveys;if(Ge(a))return wt.warn("Flags not loaded yet. Not loading surveys.");this.Mu=Kn(a)?a:a.length>0,wt.info("flags response received, isSurveysEnabled: "+this.Mu),this.loadIfEnabled()}},this.Os=t,this.Eu=n}setup(t){if(!this.Fs)return this.Iu=t,cS(t.kv.initialize(),(()=>{if(this.Iu===t&&!this.Fs){this.Iu=void 0,this.$s=t;var n=t.onRemoteConfig(this.onRemoteConfig);this.Fs?n.dispose():(this.Ns=n,this.loadIfEnabled())}}))}dispose(){var t,n,r;this.Fs||(this.Fs=!0,this.Iu=void 0,this.$s=void 0,(t=this.Ns)==null||t.dispose(),this.Ns=void 0,(n=this._surveyEventReceiver)==null||n.dispose(),this._surveyEventReceiver=null,(r=this._surveyManager)==null||r.dispose==null||r.dispose(),this._surveyManager=null,this.Su=[],this.xu=null,this.Tu.forEach((a=>clearTimeout(a))),this.Tu.clear())}get gn(){return this.Os.get()}initialize(){this.loadIfEnabled()}reset(){try{var t;(t=this._surveyEventReceiver)==null||t.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var n=[],r=0;r<localStorage.length;r++){var a=localStorage.key(r);(a!=null&&a.startsWith(rS)||a!=null&&a.startsWith("inProgressSurvey_"))&&n.push(a)}n.forEach((o=>localStorage.removeItem(o)))}catch{}}loadIfEnabled(){if(!this.Fs&&this.$s){var t=this.gn;if(!this._surveyManager)if(this.ku)wt.info("Already initializing surveys, skipping...");else if(t.disableSurveys)wt.info(A_);else if(t.cookielessMode&&this.Os.isOptedOut())wt.info("Not loading surveys in cookieless mode without consent.");else{var n=this.Os.getExtensions();if(n){if(!ue(this.Mu)||t.advancedEnableSurveys){var r=this.Mu||t.advancedEnableSurveys;this.ku=!0;try{var a=n.generateSurveys;if(a)return this.Ru(a,r),void(this.ku=!1);var o=n.loadExternalDependency;if(!o)return this.Pu(zx),void(this.ku=!1);o((u=>{try{if(this.Fs)return;var h=this.Os.getExtensions();u||h==null||!h.generateSurveys?this.Pu("Could not load surveys script",u):this.Ru(h.generateSurveys,r)}finally{this.ku=!1}}))}catch(u){throw this.ku=!1,this.Pu("Error initializing surveys",u),u}}}else wt.error("PostHog Extensions not found.")}}}Ru(t,n){this.Fs||(this._surveyManager=t(n),this._surveyEventReceiver=this.Os.createEventReceiver(),wt.info("Surveys loaded successfully"),this.Au({isLoaded:!0}))}Pu(t,n){wt.error(t,n),this.Au({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.Su.push(t),this._surveyManager&&this.Au({isLoaded:!0}),()=>{this.Su=this.Su.filter((n=>n!==t))}}getSurveys(t,n){var r;n===void 0&&(n=!1);var a=(r=this.$s)!==null&&r!==void 0?r:this.Eu;if(a&&!this.Fs){if(this.gn.disableSurveys)return wt.info(A_),t([]);var o=a.kv.get(Pg);if(o&&!n)return t(o,{isLoaded:!0}),void(this.Fu()&&this.getSurveys((()=>{}),!0));if(this.xu)this.xu.then((f=>{this.Fs||t(f.surveys,f.context)})).catch((f=>wt.error("Error in survey callback",f)));else{var u=this.Ou("/api/surveys/",{method:"GET",query:{token:a.projectToken},sentAt:"query",timeoutMs:this.gn.requestTimeoutMs}).then((f=>{try{return this.Lu(a,f)}catch(p){return wt.error("Error processing surveys response",p),this.Lu(a,{statusCode:0,error:p})}}),(f=>this.Lu(a,{statusCode:0,error:f})));this.xu=u;var h=()=>{this.xu===u&&(this.xu=null)};u.then((f=>{h(),this.Fs||t(f.surveys,f.context)}),h).catch((f=>wt.error("Error in survey callback",f)))}}}Ou(t,n){var r=this.$s;return r?r.sendRequest(t,n):new Promise((a=>a({statusCode:0,error:new Error(Ml)})))}Lu(t,n){if(this.Fs)return{surveys:[],context:{isLoaded:!1,error:Ml}};var r=n.statusCode;if(r!==200||!n.json){var a="Surveys API could not be loaded, status: "+r;return r!==0?wt.error(a):n.error||wt.warn(a),this.Cu=Date.now(),{surveys:[],context:{isLoaded:!1,error:a}}}this.Cu=null;var o,u=n.json.surveys||[],h=u.filter((f=>(function(p){return!(!p.start_date||p.end_date)})(f)&&(eS(f)||(function(p){var m;return!((m=p.conditions)==null||(m=m.actions)==null||(m=m.values)==null||!m.length)})(f))));return h.length>0&&((o=this._surveyEventReceiver)==null||o.register(h)),t.kv.set({[Pg]:u,[vh]:Date.now()}),{surveys:u,context:{isLoaded:!0}}}Fu(){return this.Du()&&!this.xu&&!this.$u()}Du(){var t,n,r=(t=(n=this.$s)!==null&&n!==void 0?n:this.Eu)==null?void 0:t.kv.get(vh);return an(r)&&Date.now()-r>3e5}$u(){return an(this.Cu)&&3e5>Date.now()-this.Cu}markSurveyAsSeen(t,n){var r,a={id:t,current_iteration:(r=n==null?void 0:n.iteration)!==null&&r!==void 0?r:null};sS(a);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}}Au(t){for(var n of this.Su)try{if(!t.isLoaded)return n([],t);this.getSurveys(n)}catch(r){wt.error("Error in survey callback",r)}}getActiveMatchingSurveys(t,n){if(n===void 0&&(n=!1),!Ge(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,n);wt.warn("init was not called")}Nu(t){var n=null;return this.getSurveys((r=>{var a;n=(a=r.find((o=>o.id===t)))!==null&&a!==void 0?a:null})),n}qu(t){if(Ge(this._surveyManager))return{eligible:!1,reason:Ml};var n=typeof t=="string"?this.Nu(t):t;return n?this._surveyManager.checkSurveyEligibility(n):{eligible:!1,reason:"Survey not found"}}ju(t){if(Ge(this._surveyManager))return{eligible:!1,reason:Ml};var n=typeof t=="string"?this.Nu(t):t;return n?this._surveyManager.checkSurveyRenderability(n):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(Ge(this._surveyManager))return wt.warn("init was not called"),{visible:!1,disabledReason:Ml};var n=this.ju(t);return{visible:n.eligible,disabledReason:n.reason}}canRenderSurveyAsync(t,n){return Ge(this._surveyManager)?(wt.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Ml})):new Promise((r=>{this.getSurveys((a=>{var o,u=(o=a.find((f=>f.id===t)))!==null&&o!==void 0?o:null;if(u){var h=this.ju(u);r({visible:h.eligible,disabledReason:h.reason})}else r({visible:!1,disabledReason:"Survey not found"})}),n)}))}renderSurvey(t,n,r){var a;if(Ge(this._surveyManager))wt.warn("init was not called");else{var o=typeof t=="string"?this.Nu(t):t;if(o!=null&&o.id)if(DE.includes(o.type)){var u=pe==null?void 0:pe.querySelector(n);if(u)if((a=o.appearance)!=null&&a.surveyPopupDelaySeconds){wt.info("Rendering survey "+o.id+" with delay of "+o.appearance.surveyPopupDelaySeconds+" seconds");var h=setTimeout((()=>{var f,p;this.Tu.delete(h),this.Fs||(wt.info("Rendering survey "+o.id+" with delay of "+((f=o.appearance)==null?void 0:f.surveyPopupDelaySeconds)+" seconds"),(p=this._surveyManager)==null||p.renderSurvey(o,u,r),wt.info("Survey "+o.id+" rendered"))}),1e3*o.appearance.surveyPopupDelaySeconds);this.Tu.add(h)}else this._surveyManager.renderSurvey(o,u,r);else wt.warn("Survey element not found")}else wt.warn("Surveys of type "+o.type+" cannot be rendered in the app");else wt.warn("Survey not found")}}displaySurvey(t,n){var r;if(Ge(this._surveyManager))wt.warn("init was not called");else{var a=this.Nu(t);if(a){var o=a;if((r=a.appearance)!=null&&r.surveyPopupDelaySeconds&&n.ignoreDelay&&(o=de({},a,{appearance:de({},a.appearance,{surveyPopupDelaySeconds:0})})),n.displayType!==Zg.Popover&&n.initialResponses&&wt.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),n.ignoreConditions===!1){var u=this.qu(a);if(!u.eligible)return void wt.warn("Survey is not eligible to be displayed: ",u.reason)}n.displayType!==Zg.Inline?this._surveyManager.handlePopoverSurvey(o,n):this.renderSurvey(o,n.selector,n.properties)}else wt.warn("Survey not found")}}cancelPendingSurvey(t){Ge(this._surveyManager)?wt.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;(t=this._surveyManager)==null||t.handlePageUnload==null||t.handlePageUnload()}}function Dl(e,t,n){if(Ge(e))return!1;switch(n){case"exact":return e===t;case"contains":var r=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch{return!1}default:return!1}}class e6{constructor(t){this.Bu=new Set,this.Hu=new Set,this.zu=new Eh,this.Uu=(n,r)=>this.Wu(n,r)&&this.Vu(n,r)&&this.Gu(n,r)&&this.Zu(n,r),this.Wu=(n,r)=>r==null||!r.event||(n==null?void 0:n.event)===(r==null?void 0:r.event),this._instance=t}init(){var t,n;ue((t=this._instance)==null?void 0:t._addCaptureHook)||(this.Qu=(n=this._instance)==null?void 0:n._addCaptureHook(((r,a)=>{this.on(r,a)})))}dispose(){var t;(t=this.Qu)==null||t.call(this),this.Qu=void 0,this.zu=new Eh}register(t){var n,r;if(!ue((n=this._instance)==null?void 0:n._addCaptureHook)&&(t.forEach((o=>{var u;this.Bu.add(o),(u=o.steps)==null||u.forEach((h=>{this.Hu.add((h==null?void 0:h.event)||"")}))})),(r=this._instance)!=null&&r.autocapture)){var a=new Set;this.Bu.forEach((o=>{var u;(u=o.steps)==null||u.forEach((h=>{h!=null&&h.selector&&a.add(h.selector)}))})),this._instance.autocapture.setElementSelectors(a)}}replace(t){this.Bu.clear(),this.Hu.clear(),this.register(t)}on(t,n){n!=null&&t.length!=0&&(this.Hu.has(t)||this.Hu.has(n.event))&&this.Bu.forEach((r=>{this.Ju(n,r)&&this.zu.emit("actionCaptured",r.name)}))}Ku(t){this.onAction("actionCaptured",(n=>t(n)))}Ju(t,n){if((n==null?void 0:n.steps)==null)return!1;for(var r of n.steps)if(this.Uu(t,r))return!0;return!1}onAction(t,n){return this.zu.on(t,n)}Vu(t,n){if(n!=null&&n.url){var r,a=t==null||(r=t.properties)==null?void 0:r.$current_url;if(!a||typeof a!="string"||!Dl(a,n.url,n.url_matching||"contains"))return!1}return!0}Gu(t,n){return!!this.Yu(t,n)&&!!this.Xu(t,n)&&!!this.th(t,n)}Yu(t,n){var r;if(n==null||!n.href)return!0;var a=this.eh(t);if(a.length>0)return a.some((h=>Dl(h.href,n.href,n.href_matching||"exact")));var o,u=(t==null||(r=t.properties)==null?void 0:r.$elements_chain)||"";return!!u&&Dl((o=u.match(/(?::|")href="(.*?)"/))?o[1]:"",n.href,n.href_matching||"exact")}Xu(t,n){var r;if(n==null||!n.text)return!0;var a=this.eh(t);if(a.length>0)return a.some((p=>Dl(p.text,n.text,n.text_matching||"exact")||Dl(p.$el_text,n.text,n.text_matching||"exact")));var o,u,h,f=(t==null||(r=t.properties)==null?void 0:r.$elements_chain)||"";return!!f&&(o=(function(p){for(var m,x=[],b=/(?::|")text="(.*?)"/g;!Ge(m=b.exec(p));)x.includes(m[1])||x.push(m[1]);return x})(f),u=n.text,h=n.text_matching||"exact",o.some((p=>Dl(p,u,h))))}th(t,n){var r,a;if(n==null||!n.selector)return!0;var o=t==null||(r=t.properties)==null?void 0:r.$element_selectors;if(o!=null&&o.includes(n.selector))return!0;var u=(t==null||(a=t.properties)==null?void 0:a.$elements_chain)||"";if(n.selector_regex&&u)try{return new RegExp(n.selector_regex).test(u)}catch{return!1}return!1}eh(t){var n;return(t==null||(n=t.properties)==null?void 0:n.$elements)==null?[]:t==null?void 0:t.properties.$elements}Zu(t,n){return n==null||!n.properties||n.properties.length===0||nS(n.properties.reduce(((r,a)=>{var o=Be(a.value)?a.value.map(String):a.value!=null?[String(a.value)]:[];return r[a.key]={values:o,operator:a.operator||"exact"},r}),{}),t==null?void 0:t.properties)}}class t6{constructor(t){var n;this.ih=[],this._instance=t,this.rh=new Map,this.nh=new Map,this.sh=new Map,this.ah=(n=this._instance)==null||n.onSessionId==null?void 0:n.onSessionId((r=>this.oh(r)))}lh(t){return!1}uh(){return null}hh(t){}dh(){}fh(t,n){return!!t&&nS(t.propertyFilters,n==null?void 0:n.properties)}ph(t,n){var r=new Map;return t.forEach((a=>{var o;(o=a.conditions)==null||(o=o[n])==null||(o=o.values)==null||o.forEach((u=>{if(u!=null&&u.name){var h=r.get(u.name)||[];h.push(a.id),r.set(u.name,h)}}))})),r}gh(t,n,r){var a=(r===cc.Activation?this.rh:this.nh).get(t),o=[];return this.mh((u=>{o=u.filter((h=>a==null?void 0:a.includes(h.id)))})),o.filter((u=>{var h,f=(h=u.conditions)==null||(h=h[r])==null||(h=h.values)==null?void 0:h.find((p=>p.name===t));return this.fh(f,n)}))}register(t){this.yh(t,!1)}replace(t){this.yh(t,!0)}yh(t,n){var r;ue((r=this._instance)==null?void 0:r._addCaptureHook)||(this.bh(t,n),this._h(t,n))}_h(t,n){var r=t.filter((u=>{var h;return(h=u.conditions)==null||(h=h.actions)==null||(h=h.values)==null?void 0:h.length}));if(n&&this.sh.clear(),r.length!==0){this.wh||(this.wh=new e6(this._instance),this.wh.init(),this.wh.Ku((u=>this.onAction(u))));var a=[];r.forEach((u=>{var h;(h=u.conditions)==null||(h=h.actions)==null||h.values.forEach((f=>{if(a.push(f),f.name){var p,m=(p=this.sh.get(f.name))!==null&&p!==void 0?p:[];m.includes(u.id)||m.push(u.id),this.sh.set(f.name,m)}}))})),n?this.wh.replace(a):this.wh.register(a)}else{var o;n&&((o=this.wh)==null||o.replace([]))}}kh(t,n){n.forEach(((r,a)=>{var o,u=(o=t.get(a))!==null&&o!==void 0?o:[];r.forEach((h=>{u.includes(h)||u.push(h)})),t.set(a,u)}))}bh(t,n){var r,a,o=t.filter((p=>{var m,x;return((m=p.conditions)==null?void 0:m.events)&&((x=p.conditions)==null||(x=x.events)==null||(x=x.values)==null?void 0:x.length)>0})),u=t.filter((p=>{var m,x;return((m=p.conditions)==null?void 0:m.cancelEvents)&&((x=p.conditions)==null||(x=x.cancelEvents)==null||(x=x.values)==null?void 0:x.length)>0})),h=this.ph(t,cc.Activation),f=this.ph(t,cc.Cancellation);n?(this.rh=h,this.nh=f):(this.kh(this.rh,h),this.kh(this.nh,f)),(o.length!==0||u.length!==0)&&((r=this.Qu)!==null&&r!==void 0||(this.Qu=(a=this._instance)==null?void 0:a._addCaptureHook(((p,m)=>{this.onEvent(p,m)}))))}onEvent(t,n){var r,a,o=this.Sh(),u=(n==null||(r=n.properties)==null?void 0:r.$survey_id)||(n==null||(a=n.properties)==null?void 0:a.$product_tour_id);if(u&&this.getActivatedIds().includes(u)){var h=this.xh(t,u);if(h==="consume")return o.info("event consumed activated item, removing it",{event:t,itemId:u}),void this.Ch([u]);if(h==="persist")return o.info("shown item promoted to persisted activation",{event:t,itemId:u}),this.Th(u),void this.Mh([u])}if(this.nh.has(t)){var f=this.gh(t,n,cc.Cancellation);f.length>0&&(o.info("cancel event matched, cancelling items",{event:t,itemsToCancel:f.map((m=>m.id))}),this.Ch(f.map((m=>m.id))),f.forEach((m=>this.Eh(m.id))))}if(this.rh.has(t)){o.info("event name matched",{event:t,eventPayload:n,items:this.rh.get(t)});var p=this.gh(t,n,cc.Activation);this.Ih(p.map((m=>m.id)))}}onAction(t){this.sh.has(t)&&this.Ih(this.sh.get(t)||[])}Ih(t){var n;if(t.length!==0){var r=!((n=this._instance)==null||n.get_session_id==null||!n.get_session_id()),a=[];for(var o of t)r&&this.lh(o)?this.Th(o)&&this.Rh(o):a.push(o);a.length>0&&(this.ih=[...new Set([...this.ih,...a])]),this.Sh().info("updating activated items",{activatedItems:this.getActivatedIds()})}}Th(t){this.ih=this.ih.filter((r=>r!==t));var n=this.Ph();return!n.includes(t)&&(this.Ah([...n,t]),this.Fh(),!0)}Ch(t){var n=new Set(t);this.ih=this.ih.filter((o=>!n.has(o)));var r=this.Oh(),a=r.filter((o=>!n.has(o)));a.length!==r.length&&(this.Ah(a),a.length===0&&this.Lh()),this.Mh(t)}Dh(){var t,n=this.uh();if(!n)return{};var r=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[n];return r&&typeof r=="object"?r:{}}Rh(t){if(this.uh()){var n=this.Dh();this.hh(de({},n,{[t]:Date.now()}))}}Mh(t){if(this.uh()){var n=this.Dh(),r={},a=!1;for(var o of Object.entries(n)){var u=o[0],h=o[1];t.includes(u)?a=!0:r[u]=h}a&&(Vr(r)?this.dh():this.hh(r))}}$h(){this.uh()&&this.dh()}getActivationTimestamp(t){if(this.Ph().includes(t)){var n=this.Dh()[t];return an(n)?n:void 0}}Oh(){var t,n=this.Nh();return((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[n])||[]}Ph(){var t,n,r=this.Oh();if(r.length===0)return[];var a=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[this.qh()],o=(n=this._instance)==null||n.get_session_id==null?void 0:n.get_session_id();return o&&a===o?r:[]}Fh(){var t,n=(t=this._instance)==null||t.get_session_id==null?void 0:t.get_session_id();n&&this.jh(n)}Lh(){this.Bh()}oh(t){var n,r=(n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[this.qh()];if(r&&r!==t){var a=this.Oh(),o=this.Dh();a.length>0&&(this.Ah([]),a.filter((u=>an(o[u]))).forEach((u=>this.Eh(u)))),this.Lh(),this.$h()}}getActivatedIds(){return[...new Set([...this.Ph(),...this.ih])].filter((t=>!this.Hh(t)))}dispose(){var t,n,r;(t=this.ah)==null||t.call(this),this.ah=void 0,(n=this.Qu)==null||n.call(this),this.Qu=void 0,(r=this.wh)==null||r.dispose(),this.wh=void 0}reset(){this.ih=[],this.Oh().length>0&&this.Ah([]),this.Lh(),this.$h()}getEventToItemsMap(){return this.rh}zh(){return this.wh}}class n6 extends t6{constructor(t){super(t)}Nh(){return $g}qh(){return Qd}uh(){return Xd}hh(t){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[Xd]:t})}dh(){var t;(t=this._instance)==null||(t=t.persistence)==null||t.unregister(Xd)}lh(t){var n,r;this.mh((o=>{r=o.find((u=>u.id===t))}));var a=(n=r)==null||(n=n.appearance)==null?void 0:n.surveyPopupDelaySeconds;return an(a)&&a>0}Uh(){return Js.SHOWN}mh(t){var n;(n=this._instance)==null||n.getSurveys(t)}Eh(t){var n;(n=this._instance)==null||n.cancelPendingSurvey(t)}Sh(){return wt}Ah(t){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[$g]:t})}jh(t){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[Qd]:t})}Bh(){var t;(t=this._instance)==null||(t=t.persistence)==null||t.unregister(Qd)}Hh(){return!1}xh(t,n){var r;this.mh((o=>{r=o.find((u=>u.id===n))}));var a=!r||(function(o){var u;return eS(o)&&!((u=o.conditions)==null||(u=u.events)==null||!u.repeatedActivation)||o.schedule==="always"})(r);return a?t===Js.SHOWN?"consume":"ignore":t===Js.SHOWN?"persist":t===Js.DISMISSED||t===Js.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}class r6{constructor(t){this._instance=t}initialize(){}get(t){if(typeof t=="string")return this._instance.get_property(t);var n={};for(var r of t){var a=this._instance.get_property(r);ue(a)||(n[r]=a)}return n}set(t,n){this._instance.register(typeof t=="string"?{[t]:n}:t)}remove(t){typeof t!="string"?t.forEach((n=>this._instance.unregister(n))):this._instance.unregister(t)}}class s6{constructor(t){this._instance=t}get(){var t=this._instance.config;return{disableSurveys:t.disable_surveys,cookielessMode:!!t.cookieless_mode,advancedEnableSurveys:t.advanced_enable_surveys,requestTimeoutMs:t.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}getExtensions(){var t=Me==null?void 0:Me.__PosthogExtensions__;if(t){var n=t.generateSurveys,r=t.loadExternalDependency;return{generateSurveys:n?a=>n(this._instance,a):void 0,loadExternalDependency:r?a=>r(this._instance,"surveys",a):void 0}}}createEventReceiver(){return new n6(this._instance)}}var i6=ne!=null&&ne.location?jh(ne.location.hash,"__posthog")||jh(location.hash,"state"):null,T_="_postHogToolbarParams",M_=Vt("[Toolbar]"),D_=Vt("[FeatureFlags]");class a6{constructor(t,n){n===void 0&&(n=!1),this.Wh=!1,this.update(t,n)}update(t,n){this.Vh=((r,a)=>{var o,u,h,f,p;return{bootstrap:{featureFlags:(o=r.bootstrap)==null?void 0:o.featureFlags,featureFlagPayloads:(u=r.bootstrap)==null?void 0:u.featureFlagPayloads},remoteRequestsDisabled:a,featureFlagsDisabled:!!r.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!r.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!r.advanced_feature_flags_dedup_per_session,cacheTtlMs:r.feature_flag_cache_ttl_ms,refreshIntervalMs:(h=r.remote_config_refresh_interval_ms)!==null&&h!==void 0?h:3e5,requestTimeoutMs:r.feature_flag_request_timeout_ms,compression:r.disable_compression?void 0:"best-available",evaluationContexts:(f=(p=r.evaluation_contexts)!==null&&p!==void 0?p:r.evaluation_environments)!==null&&f!==void 0?f:[],flagKeys:Be(r.flag_keys)?r.flag_keys:void 0}})(t,n),!t.evaluation_environments||t.evaluation_contexts||this.Wh||(D_.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Wh=!0),ue(t.flag_keys)||Be(t.flag_keys)||D_.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.Vh}}var L_=Vt("[FeatureFlags]"),Sa=Vt("[FeatureFlags]",{debugEnabled:!0}),$m=`" failed. Feature flags didn't load in time.`,R_="connection_error",z_=e=>{for(var t={},n=0;e.length>n;n++)t[e[n]]=!0;return t},O_=e=>{var t={};for(var n of Kd(e||{})){var r=n[1];r&&(t[n[0]]=r)}return t},rs=Vt("[Error tracking]"),ax="webkit-masked-url:",l6=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",ax],o6=["__firefox__","__gCrWeb"],B_="Refusing to render web experiment since the viewer is a likely bot",c6={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>Ah(t,e),not_regex:(e,t)=>!Ah(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e};class Fn{get gn(){return this._instance.config}constructor(t){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(r){r===void 0&&(r=!1),n.getWebExperiments((a=>{Fn.Gh("retrieved web experiments from the server"),n.Zh=new Map,a.forEach((o=>{if(o.feature_flag_key){var u;n.Zh&&(Fn.Gh("setting flag key ",o.feature_flag_key," to web experiment ",o),(u=n.Zh)==null||u.set(o.feature_flag_key,o));var h=n._instance.getFeatureFlag(o.feature_flag_key);ct(h)&&o.variants[h]&&n.Qh(o.name,h,o.variants[h].transforms)}else if(o.variants)for(var f in o.variants){var p=o.variants[f];Fn.Jh(p,n._instance)&&n.Qh(o.name,f,p.transforms)}}))}),r)},this._instance=t,this._instance.onFeatureFlags((r=>{this.onFeatureFlags(r)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())Fn.Gh(B_);else if(!this.gn.disable_web_experiments){if(Ge(this.Zh))return this.Zh=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Fn.Gh("applying feature flags",t),t.forEach((n=>{var r;if(this.Zh&&(r=this.Zh)!=null&&r.has(n)){var a,o=this._instance.getFeatureFlag(n),u=(a=this.Zh)==null?void 0:a.get(n);o&&u!=null&&u.variants[o]&&this.Qh(u.name,o,u.variants[o].transforms)}}))}}previewWebExperiment(){var t=Fn.getWindowLocation();if(t!=null&&t.search){var n=Zl(t==null?void 0:t.search,"__experiment_id"),r=Zl(t==null?void 0:t.search,"__experiment_variant");n&&r&&(Fn.Gh("previewing web experiments "+n+" && "+r),this.getWebExperiments((a=>{this.Kh(parseInt(n),r,a)}),!1,!0))}}loadIfEnabled(){this.gn.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,n,r){if(this.gn.disable_web_experiments&&!r)return t([]);var a=this._instance.get_property("$web_experiments");if(a&&!n)return t(a);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.gn.token),method:"GET",timestampMode:"query",callback:o=>t(o.statusCode===200&&o.json&&o.json.experiments||[])})}Kh(t,n,r){var a=r.filter((o=>o.id===t));a&&a.length>0&&(Fn.Gh("Previewing web experiment ["+a[0].name+"] with variant ["+n+"]"),this.Qh(a[0].name,n,a[0].variants[n].transforms))}static Jh(t,n){return!Ge(t.conditions)&&Fn.Yh(t,n)&&Fn.Xh(t)}static Yh(t,n){var r;if(Ge(t.conditions)||Ge((r=t.conditions)==null?void 0:r.url))return!0;var a=Fn.getWindowLocation();if(a){var o,u,h,f=x2(n,a.href);return(o=t.conditions)==null||!o.url||c6[(u=(h=t.conditions)==null?void 0:h.urlMatchType)!==null&&u!==void 0?u:"icontains"](t.conditions.url,f)}return!1}static getWindowLocation(){return ne==null?void 0:ne.location}static Xh(t){var n;if(Ge(t.conditions)||Ge((n=t.conditions)==null?void 0:n.utm))return!0;var r=L2();if(r.utm_source){var a,o,u,h,f,p,m,x,b=(a=t.conditions)==null||(a=a.utm)==null||!a.utm_campaign||((o=t.conditions)==null||(o=o.utm)==null?void 0:o.utm_campaign)==r.utm_campaign,y=(u=t.conditions)==null||(u=u.utm)==null||!u.utm_source||((h=t.conditions)==null||(h=h.utm)==null?void 0:h.utm_source)==r.utm_source,_=(f=t.conditions)==null||(f=f.utm)==null||!f.utm_medium||((p=t.conditions)==null||(p=p.utm)==null?void 0:p.utm_medium)==r.utm_medium,j=(m=t.conditions)==null||(m=m.utm)==null||!m.utm_term||((x=t.conditions)==null||(x=x.utm)==null?void 0:x.utm_term)==r.utm_term;return b&&_&&j&&y}return!1}static Gh(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;n>a;a++)r[a-1]=arguments[a];be.info("[WebExperiments] "+t,r)}Qh(t,n,r){this._is_bot()?Fn.Gh(B_):n!=="control"?r.forEach((a=>{if(a.selector){var o;Fn.Gh("applying transform of variant "+n+" for experiment "+t+" ",a);var u=(o=document)==null?void 0:o.querySelectorAll(a.selector);u==null||u.forEach((h=>{var f=h;a.html&&(f.innerHTML=a.html),a.css&&f.setAttribute("style",a.css)}))}})):Fn.Gh("Control variants leave the page unmodified.")}_is_bot(){return Nn&&this._instance?Z2(Nn,this.gn.custom_blocked_useragents):void 0}}var Ir=Vt("[Conversations]"),ka="Conversations not available yet.";function P_(e,t){var n,r,a,o,u,h,f,p=(n=e==null?void 0:e.flushIntervalMs)!==null&&n!==void 0?n:3e3,m=(r=e==null?void 0:e.maxBufferSize)!==null&&r!==void 0?r:100,x=t!=null&&t.consoleCapture?void 0:(a=e==null?void 0:e.maxLogsPerInterval)!==null&&a!==void 0?a:1e3,b=ue(x)?Math.max(m,2048):Math.max(m,x),y=de({},(function(){var _="",j="";try{var N=Nn==null?void 0:Nn.userAgent;if(N){var w=Yw(N);_=w[0],j=w[1]}}catch{}return(function(C,E){var R=(function(L){if(L)return{}.hasOwnProperty.call(By,L)?By[L]:L})(C);return de({},R?{"os.name":R}:{},E?{"os.version":E}:{})})(_,j)})(),e==null?void 0:e.resourceAttributes);return{serviceName:(o=(u=y==null?void 0:y["service.name"])!==null&&u!==void 0?u:e==null?void 0:e.serviceName)!==null&&o!==void 0?o:t==null?void 0:t.serviceNameDefault,serviceVersion:(h=y==null?void 0:y["service.version"])!==null&&h!==void 0?h:e==null?void 0:e.serviceVersion,environment:(f=y==null?void 0:y["deployment.environment"])!==null&&f!==void 0?f:e==null?void 0:e.environment,resourceAttributes:y,beforeSend:e==null?void 0:e.beforeSend,flushIntervalMs:p,maxBufferSize:m,maxQueueSize:b,maxBatchRecordsPerPost:100,rateCapWindowMs:p,maxLogsPerInterval:x,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}var u6=["debug","log","warn","error","info"],$_="console",uS="__posthogHandledLogsRequestError",Fm=(e,t)=>{var n=e instanceof Error?e:new Error(t);return n[uS]=!0,n},F_=e=>!!e&&typeof e=="object"&&e[uS]===!0,Hh={featureFlags:class{constructor(e){this.name="featureFlags",this.td=!1,this.featureFlagEventHandlers=[],this.A=L_,this.ed={},this.rd={},this.nd=[],this.sd=!1,this.ad=!1,this.od=0,this.ld=!1,this.ud=!1,this.hd=!1,this.dd=!1,this.vd=0,this.zt=()=>{var t=this.fd();this.vd=0,t&&this.reloadFeatureFlags()},this.pd=()=>{var t,n=this.gd;ue(n)||this.gn.remoteRequestsDisabled||!pe||pe.visibilityState==="hidden"||Date.now()-((t=this.md)!==null&&t!==void 0?t:0)<n||(this.reloadFeatureFlags(),this.yd())},this.Wt=()=>{(pe==null?void 0:pe.visibilityState)==="visible"&&this.pd()},"get"in e?this.Os=e:(this._instance=e,this.bd=new a6(e.config,e.ho()),this.Os=this.bd)}updateConfig(e,t){var n;(n=this.bd)==null||n.update(e,t),this.$s&&this._d()}setup(e){return this.Iu=e,this.A=e.logger.createLogger("[FeatureFlags]"),cS(e.kv.initialize(),(()=>{this.Iu===e&&(this.Iu=void 0,this.$s=e,this.wd(e))}))}wd(e){var t;if(this.$s===e)return ne&&Dt(ne,"online",this.zt),this._d(),this.kd=e.registerDynamicEventProperties((()=>this.Sd()?this.ed:this.rd)),this.xd=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.onCrossTabFeatureFlagChange((()=>{this.Cd(),this.Td()})),this.Cd(),this.initialize()}_d(){var e=this.gn.refreshIntervalMs,t=!this.gn.remoteRequestsDisabled&&pe&&!ue(e)&&e>0?e:void 0;t!==this.gd&&(this.Md(),ue(t)||(this.gd=t,this.yd(),pe!=null&&pe.addEventListener&&Dt(pe,Xl,this.Wt)))}yd(){ue(this.gd)||(ue(this.Ed)||clearInterval(this.Ed),this.md=Date.now(),this.Ed=setInterval(this.pd,this.gd))}Md(){ue(this.Ed)||(clearInterval(this.Ed),this.Ed=void 0,pe==null||pe.removeEventListener==null||pe.removeEventListener(Xl,this.Wt)),this.gd=void 0,this.md=void 0}destroy(){this.Id()}dispose(){this.Id()}Id(){var e,t;this.Md(),this.od++,this.ud=!1,this.Iu=void 0,this.$s&&(this.Rd(),(e=this.kd)==null||e.dispose(),this.kd=void 0,(t=this.xd)==null||t.call(this),this.xd=void 0,this.nd=[],ne==null||ne.removeEventListener("online",this.zt),this.$s=void 0)}get gn(){return this.Os.get()}Pd(e){var t;return(t=this.$s)==null?void 0:t.kv.get(e)}ii(e){this.Ad((()=>{var t;return(t=this.$s)==null?void 0:t.kv.set(e)}))}Fd(e,t,n){var r;if((r=this._instance)!=null&&r.persistence&&e[Xn]){var a=this.Pd(Xn)||{},o=e[Xn]||{},u=t.flags||t.featureFlags,h=t.flags?Object.entries(t.flags).filter((w=>{var C=w[1];return!(C!=null&&C.failed)})).map((w=>w[0])):[],f=!!t.errorsWhileComputingFlags&&!!t.flags,p=f?h:n&&!Be(u)?Object.keys(u||{}):Array.from(new Set([...Object.keys(a),...Object.keys(o)])),m=this.Pd(ss)||{},x=e[ss]||{},b=f||n?p:Array.from(new Set([...Object.keys(m),...Object.keys(x)])),y=!f&&!n,_=!!y||p,j={[Gr]:_,[Xn]:_,[ss]:!!y||b};for(var N of(e[Ui]&&(j[Ui]=_),[Ii,ti,ql]))ue(e[N])||(j[N]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(j)}}ai(e){this.Ad((()=>{var t;return(t=this.$s)==null?void 0:t.kv.remove(e)}))}Ad(e){try{e()}catch(t){this.A.error("Failed to update feature flag persistence",t)}}Cd(){var e={};for(var t of[Gr,ss,Ii,ys]){var n=this.Pd(t);ue(n)||(e[t]=n)}this.ed=e;var r=de({},e),a=this.Pd(Xn);if(a)for(var o of Object.entries(a))r["$feature/"+o[0]]=o[1];this.rd=r}Sd(){var e=this.gn.cacheTtlMs;if(!e||0>=e)return!1;var t=this.Pd(ti);return typeof t!="number"||Date.now()-t>e}Od(){return!!this.Sd()&&(this.dd||this.ad||(this.dd=!0,this.A.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Ld(){var e=this.gn.evaluationContexts;return e!=null&&e.length?e.filter((t=>{var n=t&&typeof t=="string"&&t.trim().length>0;return n||this.A.error("Invalid evaluation context found:",t,"Expected non-empty string"),n})):[]}Dd(){var e=this.gn.flagKeys;if(!ue(e))return e.filter((t=>{var n=t&&typeof t=="string"&&t.trim().length>0;return n||this.A.error("Invalid flag key found:",t,"Expected non-empty string"),n}))}initialize(){var e,t,n=this.gn,r=(e=(t=n.bootstrap)==null?void 0:t.featureFlags)!==null&&e!==void 0?e:{};if(Object.keys(r).length){var a,o,u=(a=(o=n.bootstrap)==null?void 0:o.featureFlagPayloads)!==null&&a!==void 0?a:{},h=Object.keys(r).filter((p=>!!r[p])).reduce(((p,m)=>(p[m]=r[m]||!1,p)),{}),f=Object.keys(u).filter((p=>h[p])).reduce(((p,m)=>(p[m]=u[m],p)),{});return this.$d({featureFlags:h,featureFlagPayloads:f})}}updateFlags(e,t,n){var r,a,o=n!=null&&n.merge&&(r=this.Pd(Xn))!==null&&r!==void 0?r:{},u=n!=null&&n.merge&&(a=this.Pd(ss))!==null&&a!==void 0?a:{},h=de({},o,e),f=de({},u,t),p={};for(var m of Object.entries(h)){var x=m[0],b=m[1];p[x]={key:x,enabled:Ny(b),variant:Cy(b),reason:void 0,metadata:ue(f==null?void 0:f[x])?void 0:{id:0,version:void 0,description:void 0,payload:f[x]}}}this.$d({flags:p})}get hasLoadedFlags(){return this.sd}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this.Pd(Ui),t=this.Pd(ys),n=this.Pd(Ea);if(!n&&!t)return e||{};var r=Pt({},e||{}),a=[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])];for(var o of a){var u,h,f=r[o],p=t==null?void 0:t[o],m=ue(p)?(u=f==null?void 0:f.enabled)!==null&&u!==void 0&&u:!!p,x=ue(p)?f==null?void 0:f.variant:typeof p=="string"?p:void 0,b=n==null?void 0:n[o],y=de({},f,{enabled:m,variant:m?x??(f==null?void 0:f.variant):void 0});m!==(f==null?void 0:f.enabled)&&(y.original_enabled=f==null?void 0:f.enabled),x!==(f==null?void 0:f.variant)&&(y.original_variant=f==null?void 0:f.variant),b&&(y.metadata=de({},f==null?void 0:f.metadata,{payload:b,original_payload:f==null||(h=f.metadata)==null?void 0:h.payload})),r[o]=y}return this.td||(this.A.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:r}),this.td=!0),r}getAllFeatureFlags(){var e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map((n=>{var r=e[n];return{key:n,enabled:Ny(r),variant:Cy(r),payload:jy(t[n])}}))}getFlagVariants(){var e=this.Pd(Xn),t=this.Pd(ys);if(!t)return e||{};for(var n=Pt({},e||{}),r=Object.keys(t),a=0;r.length>a;a++)n[r[a]]=t[r[a]];return this.td||(this.A.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.td=!0),n}getFlagPayloads(){var e=this.Pd(ss),t=this.Pd(Ea);if(!t)return e||{};for(var n=Pt({},e||{}),r=Object.keys(t),a=0;r.length>a;a++)n[r[a]]=t[r[a]];return this.td||(this.A.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),this.td=!0),n}reloadFeatureFlags(){this.ld||this.gn.featureFlagsDisabled||this.fd()||this.Nd||(this.nd.slice().forEach((e=>{try{e()}catch(t){this.A.error("Error while running feature flags reloading callback",t)}})),this.Nd=setTimeout((()=>{this.qd()}),5))}Rd(){clearTimeout(this.Nd),this.Nd=void 0}onReloading(e){return this.nd.push(e),()=>{this.nd=this.nd.filter((t=>t!==e))}}ensureFlagsLoaded(){this.sd||this.ad||this.Nd||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.ld=e}resetFlagCallReported(){this.ai(Ks)}qd(e){this.Rd();var t=this.$s;if(t&&!this.gn.remoteRequestsDisabled&&!this.fd())if(this.ad)this.ud=!0;else{var n={token:t.projectToken,distinct_id:t.distinctId,groups:t.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:de({},t.initialPersonProperties,this.Pd(wr)||{},{$lib:t.library.name,$lib_version:t.library.version}),group_properties:this.Pd(Ss),timezone:$2()};ue(t.deviceId)||(n.$device_id=t.deviceId),(e!=null&&e.disableFlags||this.gn.featureFlagsDisabled)&&(n.disable_flags=!0);var r=this.Ld();r.length&&(n.evaluation_contexts=r);var a=this.Dd();ue(a)||(n.flag_keys=a);var o=this.gn.onlyEvaluateSurveyFeatureFlags,u="/flags/?v=2"+(o?"&only_evaluate_survey_feature_flags=true":""),h=this.od;this.ad=!0;var f=()=>{this.ud&&(this.ud=!1,this.qd())},p=m=>{this.ad=!1,h===this.od&&(this.ii({[Vl]:[R_]}),this.A.error("Feature flag request failed",m)),f()};try{t.sendRequest(u,{target:"flags",method:"POST",body:n,compression:this.gn.compression,sentAt:"body",timeoutMs:this.gn.requestTimeoutMs}).then((m=>{var x,b,y=(x=m.json)!==null&&x!==void 0?x:{},_=m.statusCode!==200;if(this.ad=!1,h===this.od){if(this.jd(m.statusCode),_||this.ud||(this.$anon_distinct_id=void 0),!n.disable_flags||this.ud){this.hd=!_;var j=[];m.error?j.push(m.error instanceof Error&&m.error.name==="AbortError"?"timeout":m.error instanceof Error?R_:"unknown_error"):m.statusCode!==200&&j.push("api_error_"+m.statusCode),y.errorsWhileComputingFlags&&j.push("errors_while_computing_flags");var N=!((b=y.quotaLimited)==null||!b.includes("feature_flags"));N&&j.push("quota_limited"),this.ii({[Vl]:j}),N?this.A.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):n.disable_flags||this.$d(y,_,{partialResponse:o}),f()}}else f()})).catch(p)}catch(m){p(m)}}}fd(){return M2(this.vd,3)}jd(e){this.vd=D2(e,this.vd,3,(()=>this.A.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes.")))}getFeatureFlag(e,t){var n;if(t===void 0&&(t={}),!t.fresh||this.hd)if(this.sd||this.getFlags()&&this.getFlags().length>0){if(!this.Od()){var r=this.getFeatureFlagResult(e,t);return(n=r==null?void 0:r.variant)!==null&&n!==void 0?n:r==null?void 0:r.enabled}}else this.A.warn('getFeatureFlag for key "'+e+$m)}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.hd)if(this.sd||this.getFlags()&&this.getFlags().length>0){if(!this.Od()){var n,r=this.getFlagVariants(),a=e in r,o=r[e],u=this.getFlagPayloads()[e],h=String(o),f=this.Pd(Ii)||void 0,p=this.Pd(ti)||void 0,m=this.Pd(Ks)||{};if(this.gn.deduplicateCallsPerSession){var x,b=(x=this.$s)==null?void 0:x.session.sessionId,y=this.Pd(kc);b&&b!==y&&(m={},n=b)}if(t.send_event||!("send_event"in t))if(e in m&&m[e].includes(h))n&&this.ii({[Ks]:m,[kc]:n});else{var _,j,N,w,C,E,R,L,O,q,F,W;Be(m[e])?m[e].push(h):m[e]=[h],this.ii(de({[Ks]:m},n?{[kc]:n}:{}));var z=this.getFeatureFlagDetails(e),I=[...(_=this.Pd(Vl))!==null&&_!==void 0?_:[]];ue(o)&&I.push("flag_missing");var A={$feature_flag:e,$feature_flag_response:o,$feature_flag_payload:u??null,$feature_flag_request_id:f,$feature_flag_evaluated_at:p,$feature_flag_bootstrapped_response:(j=(N=this.gn.bootstrap)==null||(N=N.featureFlags)==null?void 0:N[e])!==null&&j!==void 0?j:null,$feature_flag_bootstrapped_payload:(w=(C=this.gn.bootstrap)==null||(C=C.featureFlagPayloads)==null?void 0:C[e])!==null&&w!==void 0?w:null,$used_bootstrap_value:!this.hd};ue(z==null||(E=z.metadata)==null?void 0:E.has_experiment)||(A.$feature_flag_has_experiment=z.metadata.has_experiment),ue(z==null||(R=z.metadata)==null?void 0:R.version)||(A.$feature_flag_version=z.metadata.version);var X,Z=(L=z==null||(O=z.reason)==null?void 0:O.description)!==null&&L!==void 0?L:z==null||(q=z.reason)==null?void 0:q.code;Z&&(A.$feature_flag_reason=Z),z!=null&&(F=z.metadata)!=null&&F.id&&(A.$feature_flag_id=z.metadata.id),ue(z==null?void 0:z.original_variant)&&ue(z==null?void 0:z.original_enabled)||(A.$feature_flag_original_response=ue(z.original_variant)?z.original_enabled:z.original_variant),z!=null&&(W=z.metadata)!=null&&W.original_payload&&(A.$feature_flag_original_payload=z==null||(X=z.metadata)==null?void 0:X.original_payload),I.length&&(A.$feature_flag_error=I.join(",")),this.Bd(A)}else n&&this.ii({[Ks]:m,[kc]:n});if(a)return{key:e,enabled:!!o,variant:typeof o=="string"?o:void 0,payload:jy(u)}}}else this.A.warn('getFeatureFlagResult for key "'+e+$m)}Bd(e){try{var t;(t=this.$s)==null||t.capture("$feature_flag_called",e).catch((n=>{this.A.error("Failed to capture feature flag call",n)}))}catch(n){this.A.error("Failed to capture feature flag call",n)}}getRemoteConfigPayload(e,t){this.Hd(e,t)}Hd(e,t){var n=this;return $t((function*(){var r=n.$s;if(r){var a={distinct_id:r.distinctId,token:r.projectToken,person_properties:{$lib:r.library.name,$lib_version:r.library.version}},o=n.Ld();o.length&&(a.evaluation_contexts=o);var u,h=n.Dd();ue(h)||(a.flag_keys=h);try{var f,p=(f=(yield r.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:a,compression:n.gn.compression,sentAt:"body",timeoutMs:n.gn.requestTimeoutMs})).json)==null?void 0:f.featureFlagPayloads;u=(p==null?void 0:p[e])||void 0}catch(m){return void n.A.error("Remote config feature flag request failed",m)}try{t(u)}catch(m){n.A.error("Remote config feature flag callback failed",m)}}}))()}isFeatureEnabled(e,t){if(t===void 0&&(t={}),t.fresh&&!this.hd)return t.defaultValue;if(!(this.sd||this.getFlags()&&this.getFlags().length>0))return this.A.warn('isFeatureEnabled for key "'+e+$m),t.defaultValue;var n=this.getFeatureFlag(e,t);return ue(n)?t.defaultValue:!!n}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t,n){this.$d(e,t,n)}$d(e,t,n){if(this.$s){this.sd=!0;var r=(function(a,o,u,h,f,p){o===void 0&&(o={}),u===void 0&&(u={}),h===void 0&&(h={}),p===void 0&&(p=L_);var m=((W,z)=>{var I=W.flags;return I?de({},W,{featureFlags:Object.fromEntries(Object.keys(I).map((A=>{var X;return[A,(X=I[A].variant)!==null&&X!==void 0?X:I[A].enabled]}))),featureFlagPayloads:Object.fromEntries(Object.keys(I).filter((A=>I[A].enabled)).filter((A=>{var X;return!ue((X=I[A].metadata)==null?void 0:X.payload)})).map((A=>{var X;return[A,(X=I[A].metadata)==null?void 0:X.payload]})))}):(W.featureFlags&&z.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),W)})(a,p),x=m.flags,b=m.featureFlags,y=m.featureFlagPayloads;if(b){var _=a.requestId,j=a.evaluatedAt;if(Be(b)){p.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var N={};if(b)for(var w=0;b.length>w;w++)N[b[w]]=!0;return{[Gr]:b,[Xn]:N,[ql]:!1}}var C=b,E=y,R=x;if(f!=null&&f.partialResponse){var L=Object.keys(C),O=E||{};C=de({},o,C),E=de({},u,O),L.forEach((W=>{var z;W in O||(z=E)==null||delete z[W]})),R=de({},h,R)}else if(a.errorsWhileComputingFlags)if(x){var q=new Set(Object.keys(x).filter((W=>{var z;return!((z=x[W])!=null&&z.failed)})));C=de({},o,Object.fromEntries(Object.entries(C).filter((W=>q.has(W[0])))));var F=Object.fromEntries(Object.entries(E||{}).filter((W=>q.has(W[0]))));E=de({},u,F),q.forEach((W=>{var z;W in F||(z=E)==null||delete z[W]})),R=de({},h,Object.fromEntries(Object.entries(R||{}).filter((W=>q.has(W[0])))))}else C=de({},o,C),E=de({},u,E),R=de({},h,R);return de({[Gr]:Object.keys(O_(C)),[Xn]:C||{},[ss]:E||{},[Ui]:R||{},[ql]:a.minimalFlagCalledEvents===!0},_?{[Ii]:_}:{},j?{[ti]:j}:{})}})(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),n,this.A);r&&(this.Fd(r,e,!(n==null||!n.partialResponse)),this.ii(r)),t||(this.dd=!1),this.Td(t)}}override(e,t){t===void 0&&(t=!1),this.A.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){this.zd(e)}zd(e){if(this.$s){if(e===!1)return this.ai([ys,Ea]),this.Td(),void Sa.info("All overrides cleared");if(Be(e))return this.ii({[ys]:z_(e)}),this.Td(),void Sa.info("Flag overrides set",{flags:e});if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var t,n=e;this.td=!!((t=n.suppressWarning)!==null&&t!==void 0&&t);var r={},a=n.flags,o=n.payloads;return a&&(r[ys]=Be(a)?z_(a):a),o&&(r[Ea]=o),Object.keys(r).length&&this.ii(r),a===!1&&o===!1?this.ai([ys,Ea]):a===!1?this.ai(ys):o===!1&&this.ai(Ea),this.Td(),a===!1?Sa.info("Flag overrides cleared"):a&&Sa.info("Flag overrides set",{flags:a}),void(o===!1?Sa.info("Payload overrides cleared"):o&&Sa.info("Payload overrides set",{payloads:o}))}if(e&&typeof e=="object")return this.ii({[ys]:e}),this.Td(),void Sa.info("Flag overrides set",{flags:e});this.A.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}else this.A.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.sd){var t=this.Ud(),n=t.flags,r=t.flagVariants;try{e(n,r)}catch(a){this.A.error("Error while running feature flags callback",a)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,n){var r,a=(this.Pd(Wd)||[]).find((p=>p.flagKey===e)),o={["$feature_enrollment/"+e]:t},u={$feature_flag:e,$feature_enrollment:t,$set:o};a&&(u.$early_access_feature_name=a.name),n&&(u.$feature_enrollment_stage=n);var h=de({},this.getFlagVariants(),{[e]:t});(r=this._instance)==null||(r=r.persistence)==null||r.markCrossTabFeatureFlagChanges({[Gr]:[e],[Xn]:[e],[wr]:Object.keys(o)}),this.ii({[Gr]:Object.keys(O_(h)),[Xn]:h,[wr]:de({},this.Pd(wr)||{},o)}),this.Td();try{var f;(f=this.$s)==null||f.capture("$feature_enrollment_update",u).catch((p=>{this.A.error("Failed to capture early access feature enrollment",p)}))}catch(p){this.A.error("Failed to capture early access feature enrollment",p)}}getEarlyAccessFeatures(e,t,n){t===void 0&&(t=!1);var r=this.Pd(Wd);!r||t?this.Wd(e,n):e(r)}Wd(e,t){var n=this;return $t((function*(){var r=n.$s;if(r){var a,o=t?"&"+t.map((h=>"stage="+h)).join("&"):"";try{var u=yield r.sendRequest("/api/early_access_features/?token="+r.projectToken+o,{target:"api",method:"GET",sentAt:"query"});if(!u.json)return;n.ii({[Wd]:a=u.json.earlyAccessFeatures})}catch(h){return void n.A.error("Early access feature request failed",h)}try{e(a)}catch(h){n.A.error("Early access feature callback failed",h)}}}))()}Ud(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((n=>t[n])),flagVariants:Object.keys(t).filter((n=>t[n])).reduce(((n,r)=>(n[r]=t[r],n)),{})}}Td(e){this.Cd();var t=this.Ud(),n=t.flags,r=t.flagVariants;this.featureFlagEventHandlers.forEach((a=>{try{a(n,r,{errorsLoading:e})}catch(o){this.A.error("Error while running feature flags callback",o)}}))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0),this.Vd(e,t)}Vd(e,t){t===void 0&&(t=!0);var n=this.Pd(wr)||{},r=(e==null?void 0:e.$set)||(e!=null&&e.$set_once?{}:e),a=e==null?void 0:e.$set_once,o={};if(a)for(var u in a)({}).hasOwnProperty.call(a,u)&&(u in n||(o[u]=a[u]));this.ii({[wr]:de({},n,o,r)}),t&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=de({},this.Pd(wr)||{});e.forEach((r=>{delete n[r]})),this.ii({[wr]:n}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e){e===void 0&&(e=!0),this.ai(wr),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this.Pd(Ss)||{},r=de({},n);for(var a of Object.keys(e))r[a]=de({},n[a],e[a]);this.ii({[Ss]:r}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.Pd(Ss)||{};this.ii({[Ss]:de({},t,{[e]:{}})})}else this.ai(Ss)}reset(){this.od++,this.ud=!1,this.ed={},this.rd={},this.sd=!1,this.ld=!1,this.hd=!1,this.$anon_distinct_id=void 0,this.Rd(),this.td=!1,this.vd=0}}},d6={sessionRecording:class{get gn(){return this._instance.config}get $o(){return this._instance.persistence}get started(){var e;return!((e=this.Gd)==null||!e.isStarted)}get status(){var e,t;return this.Zd===pc||this.Zd===zd?this.Zd:(e=(t=this.Gd)==null?void 0:t.status)!==null&&e!==void 0?e:this.Zd}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.Zd=Rd,this.Qd=void 0,this.Jd=!1,this.qt=(()=>{var t;if(pe==null||!pe.visibilityState||pe.visibilityState==="visible")return!0;var n=ne==null||(t=ne.performance)==null||t.getEntriesByType==null?void 0:t.getEntriesByType("visibility-state");return!(n!=null&&n.length)||n.some((r=>r.name==="visible"))})(),this.Wt=()=>{var t;(pe==null?void 0:pe.visibilityState)==="visible"&&(this.qt=!0,(t=this.Gd)==null||t.setDocumentWasEverVisible==null||t.setDocumentWasEverVisible(!0))},this._instance=e,!this._instance.sessionManager)throw Gs.error("started without valid sessionManager"),new Error(ix+" started without valid sessionManager. This is a bug.");if(this.gn.cookieless_mode===Zs)throw new Error(ix+' cannot be used with cookieless_mode="always"');pe!=null&&pe.addEventListener&&Dt(pe,"visibilitychange",this.Wt)}initialize(){this.startIfEnabledOrStop()}dispose(e){var t=(e===void 0?{}:e).discardBufferedEvents,n=t!==void 0&&t;this.Jd=!0,pe==null||pe.removeEventListener==null||pe.removeEventListener("visibilitychange",this.Wt),n?this.Kd(!0):this.stopRecording()}get Yd(){var e,t=!((e=this._instance.get_property(Ma))==null||!e.enabled),n=!this.gn.disable_session_recording,r=this.gn.disable_session_recording||this._instance.consent.isOptedOut();return ne&&t&&n&&!r}startIfEnabledOrStop(e){var t;if(!(this.Jd||this.Yd&&(t=this.Gd)!=null&&t.isStarted)){var n=!ue(Object.assign)&&!ue(Array.from);this.Yd&&n?(this.Xd(e),Gs.info("starting")):(this.Zd=Rd,this.stopRecording())}}Xd(e){var t,n;if(this.Yd)if(this.Zd!==pc&&this.Zd!==zd&&(this.Zd=C_),Me!=null&&(t=Me.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(n=Me.__PosthogExtensions__)!=null&&n.initSessionRecording)this.tv(e);else{var r,a=this._instance.sessionManager;(r=Me.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,this.ev,(o=>{if(!this.Jd&&this.Yd&&this._instance.sessionManager===a)return o?(this._instance.register_for_session({[qg]:!0}),Gs.error("could not load recorder",o)):void this.tv(e);this.Zd=Rd}))}}stopRecording(){var e,t;(e=this.Qd)==null||e.call(this),this.Qd=void 0,(t=this.Gd)==null||t.stop()}Kd(e){var t,n;e===void 0&&(e=!1),(t=this.Qd)==null||t.call(this),this.Qd=void 0,(n=this.Gd)==null||n.discard({discardProducerEvents:e})}iv(){var e,t;(e=this.$o)==null||e.unregister(Rx),(t=this.$o)==null||t.unregister(a2)}rv(e,t){if(Ge(e))return null;var n,r=an(e)?e:parseFloat(e);return typeof(n=r)!="number"||!Number.isFinite(n)||0>n||n>1?(Gs.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):r}nv(e){if(this.$o){var t,n,r=this.$o,a=()=>{var o,u=e.sessionRecording===!1?void 0:e.sessionRecording,h=this.rv((o=this.gn.session_recording)==null?void 0:o.sampleRate,"session_recording.sampleRate"),f=this.rv(u==null?void 0:u.sampleRate,"remote config sampleRate"),p=h??f;Ge(p)&&this.iv();var m=u==null?void 0:u.minimumDurationMilliseconds;r.register({[Ma]:de({cache_timestamp:Date.now(),enabled:!!u},u,{networkPayloadCapture:de({capturePerformance:e.capturePerformance},u==null?void 0:u.networkPayloadCapture),canvasRecording:{enabled:u==null?void 0:u.recordCanvas,fps:u==null?void 0:u.canvasFps,quality:u==null?void 0:u.canvasQuality},sampleRate:p,minimumDurationMilliseconds:ue(m)?null:m,endpoint:u==null?void 0:u.endpoint,triggerMatchType:u==null?void 0:u.triggerMatchType,masking:u==null?void 0:u.masking,urlTriggers:u==null?void 0:u.urlTriggers,version:u==null?void 0:u.version,triggerGroups:u==null?void 0:u.triggerGroups})})};a(),(t=this.Qd)==null||t.call(this),this.Qd=(n=this._instance.sessionManager)==null?void 0:n.onSessionId(a)}}onRemoteConfig(e){var t=e.ok?e.config:void 0;return t&&"sessionRecording"in t?t.sessionRecording===!1?(this.nv(t),void this.Kd()):(this.nv(t),void this.startIfEnabledOrStop()):(this.Zd===pc&&(this.Zd=zd,Gs.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.Gd)!=null&&n.log?this.Gd.log(e,t):Gs.warn("log called before recorder was ready")}get ev(){var e,t,n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(Ma);return(n==null||(t=n.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}sv(){var e,t=this._instance.get_property(Ma);if(!t)return!1;try{e=typeof t=="object"?t:JSON.parse(t)}catch(n){return Gs.warn("persisted remote config for session recording is invalid and will be ignored",n),!1}return!Ge(e.cache_timestamp)&&36e5>=Date.now()-e.cache_timestamp}tv(e){var t,n,r;if(!this.Jd&&this.Yd&&this._instance.sessionManager){if((t=Me.__PosthogExtensions__)==null||!t.initSessionRecording)return Gs.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[qg]:!0});var a;if(this.Gd||(this.Gd=(a=Me.__PosthogExtensions__)==null?void 0:a.initSessionRecording(this._instance,this.qt),this.Gd._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.sv())return this.Zd===zd||this.Zd===pc?void 0:(this.Zd=pc,Gs.info("persisted remote config is stale, requesting fresh config before starting"),void new F2(this._instance).load());this.Zd=C_,(n=(r=this.Gd).setDocumentWasEverVisible)==null||n.call(r,this.qt),this.Gd.start(e)}else this.Zd=Rd}onRRwebEmit(e){var t;(t=this.Gd)==null||t.onRRwebEmit==null||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.Gd||(t=this.$o)==null||t.register({[o2]:!0}),(e=this.Gd)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.Gd||(t=this.$o)==null||t.register({[l2]:!0}),(e=this.Gd)==null||e.overrideSampling()}overrideTrigger(e){var t,n;this.Gd||(n=this.$o)==null||n.register({[e==="url"?c2:u2]:!0}),(t=this.Gd)==null||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.Gd)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var n;return!((n=this.Gd)==null||!n.tryAddCustomEvent(e,t))}}},h6={autocapture:class extends GE{constructor(e){super(new YE(e)),this.instance=e}},historyAutocapture:class{constructor(e){this._instance=e,this.av=this.ov()}initialize(){this.startIfEnabled()}get isEnabled(){var e=this.lv();return!!(e.path||e.search||this.uv(e))}startIfEnabled(){this.isEnabled&&(be.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.av=this.ov(),this.startIfEnabled()}stop(){this.hv&&this.hv(),this.hv=void 0,this.dv&&this.dv(),this.dv=void 0,be.info("History API monitoring stopped")}monitorHistoryChanges(){ne&&ne.history&&(this.vv("pushState"),this.vv("replaceState"),this.fv(),this.uv()&&this.pv())}vv(e){var t;if(ne&&((t=ne.history[e])==null||!t.__posthog_wrapped__)){var n=this;oS(ne.history,e,(r=>function(a,o,u){r.call(this,a,o,u),n.gv(e)}))}}ov(){var e=ne==null?void 0:ne.location;if(e!=null&&e.pathname)return{pathname:e.pathname,search:e.search,hash:e.hash}}lv(){var e=this._instance.config.capture_pageview;return e==="history_change"?{path:!0}:pt(e)?e:{}}uv(e){return e===void 0&&(e=this.lv()),!!e.hash&&!this._instance.config.disable_capture_url_hashes}mv(e){var t=this.lv(),n=this.av;return!(!n||!(t.path&&e.pathname!==n.pathname||t.search&&e.search!==n.search||this.uv(t)&&e.hash!==n.hash))}gv(e){try{var t=this.ov();if(!t)return;this.mv(t)&&this._instance.capture(zl,{navigation_type:e}),this.av=t}catch(n){be.error("Error capturing "+e+" pageview",n)}}fv(){if(!this.hv){var e=()=>{this.gv("popstate")};Dt(ne,"popstate",e),this.hv=()=>{ne&&ne.removeEventListener("popstate",e)}}}pv(){if(!this.dv){var e=()=>{this.gv("hashchange")};Dt(ne,"hashchange",e),this.dv=()=>{ne&&ne.removeEventListener("hashchange",e)}}}},heatmaps:class{get gn(){return this.instance.config}constructor(e){var t;this.yv=!1,this.Is=!1,this.bv=null,this.instance=e,this.yv=!((t=this.instance.persistence)==null||!t.props[Mg]),this.rageclicks=new lS(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return pt(this.gn.capture_heatmaps)&&this.gn.capture_heatmaps.flush_interval_milliseconds&&(e=this.gn.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return Ge(this.gn.capture_heatmaps)?Ge(this.gn.enable_heatmaps)?this.yv:this.gn.enable_heatmaps:this.gn.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.Is)return;KE.info("starting..."),this._v(),this.Wt()}else{var e;clearInterval((e=this.bv)!==null&&e!==void 0?e:void 0),this.wv(),this.getAndClearBuffer()}}onRemoteConfig(e){if(e.ok){var t=e.config;if("heatmaps"in t){var n=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Mg]:n}),this.yv=n,this.startIfEnabled()}}}getAndClearBuffer(){var e=this.Dt;return this.Dt=void 0,e}Sv(e){Bm(e.originalEvent)&&this.Ki(e.originalEvent,"deadclick")}Wt(){this.bv&&clearInterval(this.bv),this.bv=(pe==null?void 0:pe.visibilityState)==="visible"?setInterval(this.Mo.bind(this),this.flushIntervalMilliseconds):null}_v(){ne&&pe&&(this.xv=this.Mo.bind(this),Dt(ne,_h,this.xv),this.Cv=e=>this.Ki(e||(ne==null?void 0:ne.event)),Dt(pe,"click",this.Cv,{capture:!0}),this.Tv=e=>this.Mv(e||(ne==null?void 0:ne.event)),Dt(pe,"mousemove",this.Tv,{capture:!0}),this.Ev=new s_(this.instance,sE,this.Sv.bind(this)),this.Ev.startIfEnabledOrStop(),this.Iv=this.Wt.bind(this),Dt(pe,Xl,this.Iv),this.Is=!0)}wv(){var e;ne&&pe&&(this.xv&&ne.removeEventListener(_h,this.xv),this.Cv&&pe.removeEventListener("click",this.Cv,{capture:!0}),this.Tv&&pe.removeEventListener("mousemove",this.Tv,{capture:!0}),this.Iv&&pe.removeEventListener(Xl,this.Iv),clearTimeout(this.Rv),(e=this.Ev)==null||e.stop(),this.Is=!1)}Pv(e,t){var n=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),a=this.instance.scrollManager.scrollElement(),o=(function(u,h,f){for(var p=u;p&&Gi(p)&&!jr(p,"body");){if(p===f)return!1;var m=void 0;try{var x,b,y;m=(x=(b=(y=p.ownerDocument)==null?void 0:y.defaultView)!==null&&b!==void 0?b:ne)==null?void 0:x.getComputedStyle(p).position}catch{return!1}if(Fe(h,m))return!0;p=S2(p)}return!1})(Qg(e),["fixed","sticky"],a);return{x:e.clientX+(o?0:r),y:e.clientY+(o?0:n),target_fixed:o,type:t}}Ki(e,t){var n;if(t===void 0&&(t="click"),!Wy(e.target)&&Bm(e)){var r=this.Pv(e,t);(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&j2(Qg(e),this.instance.config.rageclick)&&this.ys(de({},r,{type:"rageclick"})),this.ys(r)}}Mv(e){!Wy(e.target)&&Bm(e)&&(clearTimeout(this.Rv),this.Rv=setTimeout((()=>{this.ys(this.Pv(e,"mousemove"))}),500))}ys(e){if(ne){var t=this.gn.disable_capture_url_hashes?Vi(ne.location.href):ne.location.href,n=this.gn.custom_personal_data_properties,r=this.gn.mask_personal_data_properties?[...Jl,...n||[]]:[],a=Vc(t,r,Gc);this.Dt=this.Dt||{},this.Dt[a]||(this.Dt[a]=[]),this.Dt[a].push(e)}}Mo(){this.Dt&&!Vr(this.Dt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:s_,webVitalsAutocapture:class{constructor(e){var t;this.yv=!1,this.Is=!1,this.Dt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Av=()=>{clearTimeout(this.Fv),this.Fv=void 0,this.Dt.metrics.length!==0&&(this._instance.capture("$web_vitals",de({$current_url:this.Dt.url},this.Dt.metrics.reduce(((n,r)=>de({},n,{["$web_vitals_"+r.name+"_event"]:de({},r),["$web_vitals_"+r.name+"_value"]:r.value})),{}))),this.Dt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Ov=n=>{var r;if(this.Dt=this.Dt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},Ge(n==null?void 0:n.name)||Ge(n==null?void 0:n.value))wa.error("Invalid metric received",n);else{var a=typeof n.navigationURL=="string"?n.navigationURL:void 0,o=this.Lv(a);if(!ue(o)){var u=an(n.navigationId)||typeof n.navigationId=="string"?"navigation:"+n.navigationId:"url:"+o;if(!this.Dv||this.Dv>n.value){this.Dt.navigationKey!==u&&(this.Av(),this.Fv=setTimeout(this.Av,this.flushToCaptureTimeoutMs)),ue(this.Dt.navigationKey)&&(this.Dt.navigationKey=u,this.Dt.url=o),this.Dt.firstMetricTimestamp=ue(this.Dt.firstMetricTimestamp)?Date.now():this.Dt.firstMetricTimestamp;var h=(r=this._instance.sessionManager)==null?void 0:r.checkAndGetSessionAndWindowId(!0),f=de({},n,a?{navigationURL:o}:{},{$current_url:o,timestamp:Date.now()});if(delete f.entries,pt(n.attribution)&&this.attributionMetrics.indexOf(n.name)>-1){var p={};for(var m of XE){var x=m==="url"&&typeof n.attribution[m]=="string"?this.Lv(n.attribution[m]):n.attribution[m];ue(x)||(p[m]=x)}f.attribution=p}else delete f.attribution;ue(h)||(f.$session_id=h.sessionId,f.$window_id=h.windowId),this.Dt.metrics.push(f),this.Dt.metrics.length===this.allowedMetrics.length&&this.Av()}else wa.error("Ignoring metric with value >= "+this.Dv,n)}}},this.$v=()=>{if(!this.Is){var n,r,a,o,u=!1,h=Me.__PosthogExtensions__,f=h==null?void 0:h.postHogWebVitalsCallbacksByFlavor,p=(f==null?void 0:f[this.Nv])||(this.Nv==="web-vitals"&&ue(f)?h==null?void 0:h.postHogWebVitalsCallbacks:void 0);if(!ue(p)){var m=p.withoutAttribution,x=this.attributionMetrics;u=!ue(m),n=x.indexOf("LCP")>-1?p.onLCP:(m==null?void 0:m.onLCP)||p.onLCP,r=x.indexOf("CLS")>-1?p.onCLS:(m==null?void 0:m.onCLS)||p.onCLS,a=x.indexOf("FCP")>-1?p.onFCP:(m==null?void 0:m.onFCP)||p.onFCP,o=x.indexOf("INP")>-1?p.onINP:(m==null?void 0:m.onINP)||p.onINP}if(n&&r&&a&&o){var b={reportSoftNavs:this.useSoftNavs},y=u&&this.attributionMetrics.indexOf("INP")>-1?de({},b,{includeProcessedEventEntries:!1}):b;this.allowedMetrics.indexOf("LCP")>-1&&n(this.Ov.bind(this),b),this.allowedMetrics.indexOf("CLS")>-1&&r(this.Ov.bind(this),b),this.allowedMetrics.indexOf("FCP")>-1&&a(this.Ov.bind(this),b),this.allowedMetrics.indexOf("INP")>-1&&o(this.Ov.bind(this),y),this.Is=!0}else wa.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.yv=!((t=this._instance.persistence)==null||!t.props[zg]),this.startIfEnabled()}get qv(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,n=pt(this.qv)?(e=this.qv)==null?void 0:e.web_vitals_allowed_metrics:void 0;return Ge(n)?((t=this._instance.persistence)==null?void 0:t.props[Bg])||N_:n}get flushToCaptureTimeoutMs(){return(pt(this.qv)?this.qv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){var e=pt(this.qv)?this.qv.web_vitals_attribution:void 0;return Kn(e)?e?N_:[]:Be(e)?e:QE}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){var e=pt(this.qv)?this.qv.__preview_web_vitals_soft_navs:void 0;return e!=null&&e}get Dv(){var e=pt(this.qv)&&an(this.qv.__web_vitals_max_value)?this.qv.__web_vitals_max_value:j_;return e>0&&6e4>=e?j_:e}get isEnabled(){var e=Zt==null?void 0:Zt.protocol;if(e!=="http:"&&e!=="https:")return wa.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=pt(this.qv)?this.qv.web_vitals:Kn(this.qv)?this.qv:void 0;return Kn(t)?t:this.yv}startIfEnabled(){this.isEnabled&&!this.Is&&(wa.info("enabled, starting..."),this.Ks(this.$v))}onRemoteConfig(e){if(e.ok){var t=e.config;if("capturePerformance"in t){var n=pt(t.capturePerformance)&&!!t.capturePerformance.web_vitals,r=pt(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[zg]:n}),this._instance.persistence.register({[Bg]:r})),this.yv=n,this.startIfEnabled()}}}get Nv(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}Ks(e){var t=Me.__PosthogExtensions__,n=this.Nv,r=t==null?void 0:t.postHogWebVitalsCallbacksByFlavor;r!=null&&r[n]||n==="web-vitals"&&ue(r)&&t!=null&&t.postHogWebVitalsCallbacks?e():t==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,n,(a=>{a?wa.error("failed to load script",a):e()}))}Lv(e){var t=e||(ne==null?void 0:ne.location.href);if(t){var n=this._instance.config.disable_capture_url_hashes?Vi(t):t,r=this._instance.config.custom_personal_data_properties,a=this._instance.config.mask_personal_data_properties?[...Jl,...r||[]]:[];return Vc(n,a,Gc)}wa.error("Could not determine current URL")}}},f6={exceptionObserver:class{constructor(e){var t;this.$v=()=>{var n;if(ne&&this.isEnabled&&(n=Me.__PosthogExtensions__)!=null&&n.errorWrappingFunctions){var r=Me.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,a=Me.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,o=Me.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.jv&&this.gn.capture_unhandled_errors&&(this.jv=r(this.captureException.bind(this))),!this.Bv&&this.gn.capture_unhandled_rejections&&(this.Bv=a(this.captureException.bind(this))),!this.Hv&&this.gn.capture_console_errors&&(this.Hv=o(this.captureException.bind(this)))}catch(u){fc.error("failed to start",u),this.zv()}}},this._instance=e,this.Uv=!((t=this._instance.persistence)==null||!t.props[Dg]),this.pe=new X3(de({},(function(n){var r,a,o,u;return n===void 0&&(n={}),{refillRate:(r=(a=n.exceptionRateLimiterRefillRate)!==null&&a!==void 0?a:n.__exceptionRateLimiterRefillRate)!==null&&r!==void 0?r:1,bucketSize:(o=(u=n.exceptionRateLimiterBucketSize)!==null&&u!==void 0?u:n.__exceptionRateLimiterBucketSize)!==null&&o!==void 0?o:10}})(this._instance.config.error_tracking),{refillInterval:1e4,A:fc})),this.gn=this.Wv(),this.startIfEnabledOrStop()}Wv(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return pt(e)?t=de({},t,e):(ue(e)?this.Uv:e)&&(t=de({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.gn.capture_console_errors||this.gn.capture_unhandled_errors||this.gn.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(fc.info("enabled"),this.zv(),this.Ks(this.$v)):this.zv()}Ks(e){var t,n;(t=Me.__PosthogExtensions__)!=null&&t.errorWrappingFunctions?e():(n=Me.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",(r=>{if(r)return fc.error("failed to load script",r);e()}))}zv(){var e,t,n;(e=this.jv)==null||e.call(this),this.jv=void 0,(t=this.Bv)==null||t.call(this),this.Bv=void 0,(n=this.Hv)==null||n.call(this),this.Hv=void 0}onRemoteConfig(e){if(e.ok){var t=e.config;"autocaptureExceptions"in t&&(this.Uv=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Dg]:this.Uv}),this.gn=this.Wv(),this.startIfEnabledOrStop())}}onConfigChange(){this.gn=this.Wv()}captureException(e){var t,n,r,a=(t=e==null||(n=e.$exception_list)==null||(n=n[0])==null?void 0:n.type)!==null&&t!==void 0?t:"Exception";this.pe.consumeRateLimit(a)?fc.info("Skipping exception capture because of client rate limiting.",{exception:a}):(r=this._instance.exceptions)==null||r.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,n;this.Vv=[],this.Gv=new x4([new j4,new R4,new C4,new N4,new D4,new M4,new A4,new L4],(function(r){for(var a=arguments.length,o=new Array(a>1?a-1:0),u=1;a>u;u++)o[u-1]=arguments[u];return function(h,f){f===void 0&&(f=0);for(var p=[],m=h.split(`
68
+ `),x=f;m.length>x;x++){var b=m[x];if(1024>=b.length){var y=Uy.test(b)?b.replace(Uy,"$1"):b;if(!y.match(/\S*Error: /)){for(var _ of o){var j=_(y,r);if(j){p.push(j);break}}if(p.length>=50)break}}}return(function(N){if(!N.length)return[];var w=Array.from(N);return w.reverse(),w.slice(0,50).map((C=>{return de({},C,{filename:C.filename||(E=w,E[E.length-1]||{}).filename,function:C.function||Ql});var E}))})(p)}})("web:javascript",_4,k4)),this._instance=e,this.Vv=(t=(n=this._instance.persistence)==null?void 0:n.get_property(Lg))!==null&&t!==void 0?t:[],this.Zv=gh(this.Qv()),this.Jv=new O4(this.Zv)}onConfigChange(){this.Zv=gh(this.Qv()),this.Jv.setConfig(this.Zv)}onRemoteConfig(e){var t,n,r;if(e.ok){var a=e.config;if("errorTracking"in a){var o=(t=(n=a.errorTracking)==null?void 0:n.suppressionRules)!==null&&t!==void 0?t:[],u=(r=a.errorTracking)==null?void 0:r.captureExtensionExceptions;this.Vv=o,this._instance.persistence&&this._instance.persistence.register({[Lg]:this.Vv,[Rg]:u})}}}get Kv(){var e,t=!!this._instance.get_property(Rg),n=this._instance.config.error_tracking.captureExtensionExceptions;return(e=n??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.Gv.buildFromUnknown(e,{syntheticException:t==null?void 0:t.syntheticException,mechanism:{handled:t==null?void 0:t.handled}})}addExceptionStep(e,t){if(this.Zv.enabled)try{if(!ct(e)||e.trim().length===0)return void rs.warn("Ignoring exception step because message must be a non-empty string");var n=(function(o){if(!o)return{sanitizedProperties:{},droppedKeys:[]};var u=[];return{sanitizedProperties:Object.keys(o).reduce(((h,f)=>z4.has(f)?(u.push(f),h):(h[f]=o[f],h)),{}),droppedKeys:u}})(this.Yv(t)),r=n.sanitizedProperties,a=n.droppedKeys;a.length>0&&rs.warn("Ignoring reserved exception step fields",{droppedKeys:a}),this.Jv.add(de({[ph]:e,[mh]:new Date().toISOString()},r))}catch(o){rs.error("Failed to add exception step. Ignoring breadcrumb.",o)}}sendExceptionEvent(e){try{var t=e.$exception_list;if(this.Xv(t)){if(this.tc(t))return this.ec("Exception dropped: matched a suppression rule"),void rs.info("Skipping exception capture because a suppression rule matched");if(!this.Kv&&this.ic(t))return this.ec("Exception dropped: thrown by a browser extension"),void rs.info("Skipping exception capture because it was thrown by an extension");if(!this.Kv&&this.rc(t))return this.ec("Exception dropped: thrown by an injected browser script"),void rs.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.nc(t))return this.ec("Exception dropped: thrown by the PostHog SDK"),void rs.info("Skipping exception capture because it was thrown by the PostHog SDK")}var n=this.Zv.enabled&&Ge(e.$exception_steps)?this.sc(e):e,r=typeof(o=globalThis._posthogReleaseId)=="string"&&o.length>0?o:void 0;r&&(n.$release_id=r);try{var a=this._instance.capture("$exception",n,{_noTruncate:!0,_batchKey:"exceptionEvent",uu:!0});return a&&this.Jv.clear(),a}catch(u){return rs.error("Failed to capture exception event. Dropping this exception.",u),void this.Jv.clear()}}catch(u){return void rs.error("Failed to process exception event. Ignoring this exception.",u)}var o}sc(e){try{var t=this.Jv.getAttachable();return t.length===0?e:de({},e,{$exception_steps:t})}catch(n){return rs.error("Failed to read buffered exception steps. Capturing exception without steps.",n),e}}ec(e){this.Zv.enabled&&this.Jv.add({[ph]:e,[mh]:new Date().toISOString()})}Yv(e){return pt(e)?de({},e):{}}Qv(){var e,t;return(e=(t=this._instance.config.error_tracking)==null?void 0:t.exception_steps)!==null&&e!==void 0?e:{}}tc(e){if(e.length===0)return!1;try{var t=e.reduce(((n,r)=>{var a=r.type,o=r.value;return ct(a)&&a.length>0&&n.$exception_types.push(a),ct(o)&&o.length>0&&n.$exception_values.push(o),n}),{$exception_types:[],$exception_values:[]});return this.Vv.some((n=>{var r=n.values.map((a=>{var o=tS[a.operator],u=t[a.key];if(!o||!u)return!1;var h=Be(a.value)?a.value:[a.value];return h.length>0&&o(h,u)}));return n.type==="OR"?r.some(Boolean):r.every(Boolean)}))}catch(n){return rs.warn("Failed to evaluate suppression rules. Capturing the exception.",n),!1}}ic(e){var t=e.flatMap((r=>{var a,o;return(a=(o=r.stacktrace)==null?void 0:o.frames)!==null&&a!==void 0?a:[]})),n=t.filter((r=>{var a=r.filename;return!!a&&l6.some((o=>a.startsWith(o)))}));return n.length!==0&&(!n.every((r=>{var a=r.filename;return!!a&&a.startsWith(ax)}))||e.some((r=>{var a=r.value;return ct(a)&&a.includes("isolatedAPI.contexts.topHostname")}))&&!t.some((r=>{var a=r.filename;return r.in_app&&!(a!=null&&a.startsWith(ax))})))}rc(e){return e.some((t=>{var n=t.value;return ct(n)&&o6.some((r=>n.includes(r)))}))}nc(e){if(e.length>0){var t,n,r,a,o=(t=(n=e[0].stacktrace)==null?void 0:n.frames)!==null&&t!==void 0?t:[],u=o[o.length-1];return(r=u==null||(a=u.filename)==null?void 0:a.includes("posthog.com/static"))!==null&&r!==void 0&&r}return!1}Xv(e){return!Ge(e)&&Be(e)}}},p6=de({productTours:class{get $o(){return this._instance.persistence}constructor(e){this.ac=null,this.oc=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(e.ok){var t=e.config;if("productTours"in t){var n,r;if(this.$o&&this.$o.register({[Lx]:!!t.productTours}),!Pm(this._instance))return!this.ac&&Ge((n=this.$o)==null?void 0:n.props[Sc])||Od.info("product tours disabled; stopping and clearing cached tours"),(r=this.ac)==null||r.stop(),this.ac=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.ac&&Pm(this._instance)&&this.Ks((()=>this.lc()))}Ks(e){var t,n;(t=Me.__PosthogExtensions__)!=null&&t.generateProductTours?e():(n=Me.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"product-tours",(r=>{r?Od.error("Could not load product tours script",r):e()}))}lc(){var e;!this.ac&&(e=Me.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.ac=Me.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(t===void 0&&(t=!1),!Be(this.oc)||t){var n=this.$o;if(n){var r=n.props[Sc];if(Be(r)&&!t)return this.oc=r,void e(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",timestampMode:"query",callback:a=>{if(Pm(this._instance)){var o=a.statusCode;if(o!==200||!a.json){var u="Product Tours API could not be loaded, status: "+o;return o===0?a.error||Od.warn(u):Od.error(u),void e([],{isLoaded:!1,error:u})}var h=Be(a.json.product_tours)?a.json.product_tours:[];this.oc=h,n&&n.register({[Sc]:h}),e(h,{isLoaded:!0})}else e([],{isLoaded:!0})}})}else e(this.oc,{isLoaded:!0})}getActiveProductTours(e){Ge(this.ac)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.ac.getActiveProductTours(e)}showProductTour(e){var t;(t=this.ac)==null||t.showTourById(e)}previewTour(e){this.ac?this.ac.previewTour(e):this.Ks((()=>{var t;this.lc(),(t=this.ac)==null||t.previewTour(e)}))}dismissProductTour(){var e;(e=this.ac)==null||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.ac)==null||e.nextStep()}previousStep(){var e;(e=this.ac)==null||e.previousStep()}clearCache(){var e;this.oc=null,(e=this.$o)==null||e.unregister(Sc)}resetTour(e){var t;(t=this.ac)==null||t.resetTour(e)}resetAllTours(){var e;(e=this.ac)==null||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.ac)==null||t.cancelPendingTour(e)}}},Hh),m6={siteApps:class{constructor(e){this.uc=0,this._instance=e,this.hc=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}dc(e,t){if(t){var n=this.globalsForEvent(t);this.hc.push(n),this.hc.length>1e3&&(this.hc=this.hc.slice(10))}}get siteAppLoaders(){var e;return(e=Me._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.dc.bind(this));this.vc=()=>{e(),this.hc=[],this.vc=void 0}}}globalsForEvent(e){var t,n,r,a,o,u,h;if(!e)throw new Error("Event payload is required");var f={},p=this._instance.get_property("$groups")||[],m=this._instance.get_property("$stored_group_properties")||{};for(var x of Object.entries(m)){var b=x[0];f[b]={id:p[b],type:b,properties:x[1]}}var y=e.$set_once,_=e.$set;return{event:de({},bw(e,ZE),{properties:de({},e.properties,_?{$set:de({},(t=(n=e.properties)==null?void 0:n.$set)!==null&&t!==void 0?t:{},_)}:{},y?{$set_once:de({},(r=(a=e.properties)==null?void 0:a.$set_once)!==null&&r!==void 0?r:{},y)}:{}),elements_chain:(o=(u=e.properties)==null?void 0:u.$elements_chain)!==null&&o!==void 0?o:"",distinct_id:(h=e.properties)==null?void 0:h.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:f}}cc(e){var t,n=(t=e.tagName)==null?void 0:t.toLowerCase();return n==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||(vs.error("prepare_external_dependency_stylesheet returned null"),null):n==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(e)||(vs.error("prepare_external_dependency_script returned null"),null):e}fc(){var e,t,n,r,a,o,u,h;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var f=pe==null?void 0:pe.defaultView,p=f==null||(e=f.Node)==null?void 0:e.prototype;if(!f||!p)return()=>{};if(this.uc++,this.gc)return this.mc();var m=[],x=this,b=new WeakSet,y=(N,w,C)=>{if(N!=null&&N[w]){var E=N[w];N[w]=C(E),m.push((()=>{N[w]=E}))}},_=N=>{if(b.has(N))return N;var w=x.cc(N);return w&&b.add(w),w},j=N=>N.map((w=>typeof w=="string"?w:_(w))).filter((w=>!sn(w)));return y(p,"appendChild",(N=>function(w){var C=_(w);return C?N.call(this,C):w})),y(p,"insertBefore",(N=>function(w,C){var E=_(w);return E?N.call(this,E,C):w})),y(p,"replaceChild",(N=>function(w,C){var E=_(w);return E?N.call(this,E,C):C})),[(t=f.Element)==null?void 0:t.prototype,(n=f.Document)==null?void 0:n.prototype,(r=f.DocumentFragment)==null?void 0:r.prototype].forEach((N=>{y(N,"append",(w=>function(){for(var C=arguments.length,E=new Array(C),R=0;C>R;R++)E[R]=arguments[R];return w.apply(this,j(E))})),y(N,"prepend",(w=>function(){for(var C=arguments.length,E=new Array(C),R=0;C>R;R++)E[R]=arguments[R];return w.apply(this,j(E))}))})),[(a=f.Element)==null?void 0:a.prototype,(o=f.CharacterData)==null?void 0:o.prototype,(u=f.DocumentType)==null?void 0:u.prototype].forEach((N=>{y(N,"before",(w=>function(){for(var C=arguments.length,E=new Array(C),R=0;C>R;R++)E[R]=arguments[R];return w.apply(this,j(E))})),y(N,"after",(w=>function(){for(var C=arguments.length,E=new Array(C),R=0;C>R;R++)E[R]=arguments[R];return w.apply(this,j(E))})),y(N,"replaceWith",(w=>function(){for(var C=arguments.length,E=new Array(C),R=0;C>R;R++)E[R]=arguments[R];var L=j(E);return E.length&&!L.length?void 0:w.apply(this,L)}))})),y((h=f.Element)==null?void 0:h.prototype,"insertAdjacentElement",(N=>function(w,C){var E=_(C);return E?N.call(this,w,E):null})),this.gc=()=>{m.forEach((N=>N())),this.gc=void 0},this.mc()}mc(){var e=!1;return()=>{var t;e||(e=!0,this.uc--,this.uc===0&&((t=this.gc)==null||t.call(this)))}}yc(e,t){t===void 0&&(t=!0);var n=this.fc();try{var r=e(n);return t&&n(),r}catch(a){throw n(),a}}setupSiteApp(e){var t=this.apps[e.id],n=()=>{var u;!t.errored&&this.hc.length&&(vs.info("Processing "+this.hc.length+" events for site app with id "+e.id),this.hc.forEach((h=>this.yc((()=>t.processEvent==null?void 0:t.processEvent(h))))),t.processedBuffer=!0),Object.values(this.apps).every((h=>h.processedBuffer||h.errored))&&((u=this.vc)==null||u.call(this))},r=!1,a=u=>{t.errored=!u,t.loaded=!0,vs.info("Site app with id "+e.id+" "+(u?"loaded":"errored")),r&&n()};try{var o=this.yc((u=>e.init({posthog:this._instance,callback(h){u(),a(h)}})),!1).processEvent;o&&(t.processEvent=o),r=!0}catch(u){vs.error(E_+e.id,u),a(!1)}if(r&&t.loaded)try{n()}catch(u){vs.error("Error while processing buffered events PostHog app with config id "+e.id,u),t.errored=!0}}bc(){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)}_c(e){var t=this;if(Object.keys(this.apps).length!==0){var n=this.globalsForEvent(e),r=function(o){try{t.yc((()=>o.processEvent==null?void 0:o.processEvent(n)))}catch(u){vs.error("Error while processing event "+e.event+" for site app "+o.id,u)}};for(var a of Object.values(this.apps))r(a)}}onRemoteConfig(e){var t,n,r,a=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.bc(),void this._instance.on("eventCaptured",(f=>this._c(f)))):void vs.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.vc)==null||n.call(this),e.ok){var o=e.config;if((r=o.siteApps)!=null&&r.length)if(this.isEnabled){var u=function(){var f,p=h.id,m=h.url;Me["__$$ph_site_app_"+p]=a._instance,(f=Me.__PosthogExtensions__)==null||f.loadSiteApp==null||f.loadSiteApp(a._instance,m,(x=>{if(x)return vs.error(E_+p,x)}))};for(var h of o.siteApps)u()}else vs.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},g6={tracingHeaders:class{constructor(e){this.wc=void 0,this.kc=void 0,this.Sc=void 0,this.$v=()=>{var t,n,r=this.xc();r?(ue(this.wc)&&(this.wc=(t=Me.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null?void 0:t._patchXHR(r,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),ue(this.kc)&&(this.kc=(n=Me.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null?void 0:n._patchFetch(r,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.zv()},this._instance=e}initialize(){this.startIfEnabledOrStop()}Ks(e){var t,n;(t=Me.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns?e():(n=Me.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",(r=>{if(r)return WE.error("failed to load script",r);e()}))}Cc(){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}xc(){var e=this.Cc();return Be(e)?(Be(this.Sc)?this.Sc.splice(0,this.Sc.length,...e):this.Sc=[...e],e.length>0?this.Sc:void 0):(Be(this.Sc)&&this.Sc.splice(0),this.Sc=e||void 0,this.Sc)}zv(){var e,t;(e=this.wc)==null||e.call(this),(t=this.kc)==null||t.call(this),this.wc=void 0,this.kc=void 0}startIfEnabledOrStop(){this.xc()?this.Ks(this.$v):this.zv()}}},x6=de({surveys:class extends JE{constructor(e){var t;super(new s6(e),{get projectToken(){return t.config.token},kv:new r6(t=e)}),this._instance=e}Ou(e,t){var n=t.query?Jc(e,t.query):e;return new Promise((r=>{var a;this._instance._send_request({method:t.method,url:this._instance.requestRouter.endpointFor((a=t.target)!==null&&a!==void 0?a:"api",n),data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,timestampMode:t.sentAt,callback:r})}))}}},Hh),v6={toolbar:class{constructor(e){this.instance=e}Tc(e){Me.ph_toolbar_state=e}Mc(){var e;return(e=Me.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),Gg(this.instance.config)||!ne||!pe)return!1;e=e??ne.location,n=n??ne.history;try{if(!t){try{ne.localStorage.setItem("test","test"),ne.localStorage.removeItem("test")}catch{return!1}t=ne==null?void 0:ne.localStorage}var r,a=i6||jh(e.hash,"__posthog")||jh(e.hash,"state"),o=a?qy((()=>JSON.parse(atob(decodeURIComponent(a)))))||qy((()=>JSON.parse(decodeURIComponent(a)))):null;return o&&o.action==="ph_authorize"?((r=o).source="url",r&&Object.keys(r).length>0&&(o.desiredHash?e.hash=o.desiredHash:n?n.replaceState(n.state,"",e.pathname+e.search):e.hash="")):((r=JSON.parse(t.getItem(T_)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch{return!1}}Ec(e){var t=Me.ph_load_toolbar||Me.ph_load_editor;!Ge(t)&&Un(t)?t(e,this.instance):M_.warn("No toolbar load function found")}loadToolbar(e){var t=!(pe==null||!pe.getElementById(v2));if(!ne||t)return!1;var n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,r=de({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(ne.localStorage.setItem(T_,JSON.stringify(de({},r,{source:void 0}))),this.Mc()===2)this.Ec(r);else if(this.Mc()===0){var a;this.Tc(1),(a=Me.__PosthogExtensions__)==null||a.loadExternalDependency==null||a.loadExternalDependency(this.instance,"toolbar",(o=>{if(o)return M_.error("[Toolbar] Failed to load",o),void this.Tc(0);this.Tc(2),this.Ec(r)})),Dt(ne,"turbolinks:load",(()=>{this.Tc(0),this.loadToolbar(r)}))}return!0}Ic(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)}}},b6=de({experiments:Fn},Hh),y6={conversations:class{constructor(e){this.Rc=void 0,this._conversationsManager=null,this.Pc=!1,this.je=null,this.Ac=!1,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations&&(this.Fc=e.ok,e.ok)){var t=e.config.conversations;Ge(t)||(Kn(t)?this.Rc=t:(this.Rc=t.enabled,this.je=t),this.loadIfEnabled())}}reset(){var e;(e=this._conversationsManager)==null||e.reset(),this._conversationsManager=null,this.Rc=void 0,this.je=null,this.Fc=void 0,this.Ac=!1}loadIfEnabled(){if(!(this._conversationsManager||this.Pc||this._instance.config.disable_conversations||Gg(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=Me==null?void 0:Me.__PosthogExtensions__;if(e&&!ue(this.Rc)&&this.Rc)if(this.je&&this.je.token){this.Pc=!0;try{var t=e.initConversations;if(t)return this.Oc(t),void(this.Pc=!1);var n=e.loadExternalDependency;if(!n)return void this.Lc(zx);n(this._instance,"conversations",(r=>{r||!e.initConversations?this.Lc("Could not load conversations script",r):this.Oc(e.initConversations),this.Pc=!1}))}catch(r){this.Lc("Error initializing conversations",r),this.Pc=!1}}else Ir.error("Conversations enabled but missing token in remote config.")}}Oc(e){if(this.je)try{this._conversationsManager=e(this.je,this._instance),this.Ac=!1,Ir.info("Conversations loaded successfully")}catch(t){this.Lc("Error completing conversations initialization",t)}else Ir.error("Cannot complete initialization: remote config is null")}Lc(e,t){Ir.error(e,t),this._conversationsManager=null,this.Pc=!1,this.Ac=!0}show(){this._conversationsManager?this._conversationsManager.show():Ir.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Rc===!0&&!sn(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":Gg(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":this.Fc===!1?"remote_config_failed":ue(this.Rc)?this.Fc?"disabled_in_project":"remote_config_pending":this.Rc?Ge(this.je)||!this.je.token?"missing_token":Me!=null&&Me.__PosthogExtensions__?this.Pc?"initializing":this.Ac?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.isVisible())!==null&&e!==void 0&&e}sendMessage(e,t,n){var r=this;return $t((function*(){return r._conversationsManager?r._conversationsManager.sendMessage(e,t,n):(Ir.warn(ka),null)}))()}getMessages(e,t){var n=this;return $t((function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(Ir.warn(ka),null)}))()}markAsRead(e){var t=this;return $t((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(Ir.warn(ka),null)}))()}getTickets(e){var t=this;return $t((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(Ir.warn(ka),null)}))()}requestRestoreLink(e){var t=this;return $t((function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(Ir.warn(ka),null)}))()}restoreFromToken(e){var t=this;return $t((function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(Ir.warn(ka),null)}))()}restoreFromUrlToken(){var e=this;return $t((function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(Ir.warn(ka),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}yu(){var e;(e=this._conversationsManager)==null||e.setIdentity()}bu(){var e;(e=this._conversationsManager)==null||e.clearIdentity()}}},_6={logs:class{constructor(e){var t,n=this;this.name="logs",this.Dc=!1,this.$c=!1,this.Nc=!1,this.A=Vt("[logs]"),this.qc=de({},this.A,{error(){for(var r=arguments.length,a=new Array(r),o=0;r>o;o++)a[o]=arguments[o];a.some(F_)||n.A.error(...a)}}),this.fo=[],this.jc=[],this.vd=0,this.Fs=!1,this.Bc=[],this.Hc=[],this.zc=!1,this.Uc=!1,this.Wc=()=>{var r,a;this.Fs||(this.vd=0,(r=this.Vc)==null||r.onReconnect(),(a=this.Gc)==null||a.onReconnect())},this._instance=e,this._instance&&(t=this._instance.config.logs)!=null&&t.captureConsoleLogs&&(this.Dc=!0),ne&&Dt(ne,"online",this.Wc)}Zc(e,t,n,r){var a,o=P_((a=this._instance)==null||(a=a.config)==null?void 0:a.logs,n);return[new p4(this.Qc(e,t),o,this.qc,(()=>this.Jc()),(u=>u()),void 0,r),o]}Kc(){var e,t=(e=this._instance)==null||(e=e.config)==null?void 0:e.logs;if(!this.Vc||this.Yc!==t){var n;(n=this.Vc)==null||n.reset(),this.Yc=t;var r=this.Zc((()=>this.fo),(a=>{this.fo=a}));this.Vc=r[0],this.Xc=r[1]}return this.Vc}tf(){var e,t=(e=this._instance)==null||(e=e.config)==null?void 0:e.logs;if(!this.Gc||this.ef!==t){var n;(n=this.Gc)==null||n.reset(),this.ef=t;var r=this.Zc((()=>this.jc),(a=>{this.jc=a}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},$_);this.Gc=r[0],this.if=r[1]}return this.Gc}setup(e){var t;if(!this.Fs){this.$s=e,(t=this._instance)!=null&&(t=t.config)!=null&&(t=t.logs)!=null&&t.captureConsoleLogs&&(this.Dc=!0),(this.Dc||this.rf()&&this.nf())&&this.sf();var n=!1,r=e.onRemoteConfig((a=>{var o;n=a.ok&&((o=a.config.logs)==null?void 0:o.captureConsoleLogs)===!0,this.onRemoteConfig(a)}));this.Fs?r.dispose():(this.Ns=r,n||this.loadIfEnabled())}}dispose(){var e,t,n,r;this.Fs||(this.Fs=!0,this.af(),(e=this.Ns)==null||e.dispose(),this.Ns=void 0,this.$s=void 0,this.Nc=!1,ne==null||ne.removeEventListener("online",this.Wc),(t=this.lf)==null||t.call(this),this.lf=void 0,(n=this.Vc)==null||n.reset(),(r=this.Gc)==null||r.reset())}onRemoteConfig(e){var t,n;if(!this.Fs){var r=e.ok?(t=e.config.logs)==null?void 0:t.captureConsoleLogs:void 0;Ge(r)?this.uf():((n=this._instance)==null||(n=n.persistence)==null||n.register({[Og]:!!r}),r?(this.Dc=!0,this.$c||this.sf(),this.loadIfEnabled()):this.uf())}}reset(){var e,t,n,r;this.af(),(e=this.Vc)==null||e.clearQueue(),this.fo=[],(t=this.Vc)==null||t.reset(),(n=this.Gc)==null||n.clearQueue(),this.jc=[],(r=this.Gc)==null||r.reset(),this.vd=0}captureLog(e){this.Fs||this.Kc().captureLog(e)}captureConsoleLog(e){this.Fs||this.tf().captureLog(e)}captureBufferedConsoleLog(e,t,n){this.Fs||this.tf().captureLog(e,{context:t,occurredAtMs:n})}nf(){var e;return!((e=this._instance)==null||(e=e.persistence)==null||(e=e.props)==null||!e[Og])}rf(){var e,t;return(e=this._instance)==null||e.ho==null||!e.ho()||!((t=Me._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null||!t.config)}wu(){var e;this.af(),(e=this.Gc)==null||e.clearQueue(),this.jc=[]}uf(){this.Dc||this.af()}sf(){var e,t=this;if(!this.zc&&Me!=null&&Me.console){var n=P_((e=this._instance)==null||(e=e.config)==null?void 0:e.logs).maxBufferSize,r=function(o){var u;try{u=(h=>{for(;(f=h)!=null&&f.__rrweb_original__;){var f;h=h.__rrweb_original__}return h})(Me.console[o])}catch{return 0}if(!u)return 0;t.Hc.push(oS(Me.console,o,(h=>{var f=function(){for(var p=arguments.length,m=new Array(p),x=0;p>x;x++)m[x]=arguments[x];try{t.hf(o,m,n)}catch{}return h.apply(Me.console,m)};return f.__rrweb_original__=u,f})))};for(var a of u6)r(a);this.zc=!0,this.df=setTimeout((()=>{this.af()}),3e4)}}hf(e,t,n){var r;if(this.zc&&!this.Uc&&t.length!==0)if((r=this._instance)!=null&&r.is_capturing()){if(n>this.Bc.length){this.Uc=!0;try{this.Bc.push({level:e,args:t,occurredAtMs:Date.now(),context:this.Jc()})}finally{this.Uc=!1}}}else this.af()}af(){if(this.Bc=[],this.zc){for(var e of(this.zc=!1,this.df&&(clearTimeout(this.df),this.df=void 0),this.Hc))e();this.Hc=[]}}vf(){var e=this.Bc;return this.af(),e}get logger(){return this.cf||(this.cf={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.cf}flushLogs(e){e?this.ff(e):(this.Vc&&this.Vc.flush().catch((t=>this.pf(t))),this.Gc&&this.Gc.flush().catch((t=>this.pf(t))))}pf(e){F_(e)||this.A.error("PostHog logs flush failed:",e)}loadIfEnabled(){if(!this.Fs&&this.Dc&&!this.$c&&!this.Nc){var e=Me==null?void 0:Me.__PosthogExtensions__;if(!e)return this.A.error("PostHog Extensions not found."),void this.af();var t=e.loadExternalDependency;if(!t)return this.A.error(zx),void this.af();this.Nc=!0;try{t(this._instance,"logs",(n=>{if(this.Nc=!1,!this.Fs&&this.Dc){var r=e.logs;if(n||r==null||!r.initializeLogs)this.A.error("Could not load logs script",n),this.af();else{var a,o,u=this.vf();this.lf=r.initializeLogs((a=this.$s)!==null&&a!==void 0?a:this._instance),this.$c=!0,u.length>0&&(r.replayConsoleBuffer==null||r.replayConsoleBuffer((o=this.$s)!==null&&o!==void 0?o:this._instance,u))}}}))}catch(n){throw this.Nc=!1,n}}}Qc(e,t){var n=this._instance;return{get isDisabled(){return!1},get optedOut(){return!n.is_capturing()},getPersistedProperty:r=>r===_s.LogsQueue?e():void 0,setPersistedProperty(r,a){var o;r===_s.LogsQueue&&t((o=a)!==null&&o!==void 0?o:[])},ss:r=>this.ss(r),getLibraryId:()=>Bt.LIB_NAME,getLibraryVersion:()=>Bt.LIB_VERSION}}ss(e){return new Promise((t=>{if(M2(this.vd,3))t({kind:"fatal",error:Fm(void 0,"logs endpoint is unreachable, dropping batch")});else{var n=!1,r=o=>{n||(n=!0,clearTimeout(a),t(o))},a=setTimeout((()=>{this.A.warn("Logs request timed out before receiving a response"),r({kind:"retry-later",error:Fm(void 0,"logs request timed out")})}),9e4);this._instance._send_request({method:"POST",url:this.gf(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:o=>{var u=o.statusCode;if(this.mf(u),u>=200&&300>u)r({kind:"ok"});else if(u===413)r({kind:"too-large"});else if(u!==0&&u!==408&&u!==429&&500>u)r({kind:"fatal",error:new Error("logs request failed with status "+u)});else{var h;u===0?(o.error||this.A.warn("Logs request failed before receiving an HTTP response"),r({kind:"retry-later",error:Fm(o.error,"logs request failed before receiving an HTTP response")})):r({kind:"retry-later",error:(h=o.error)!==null&&h!==void 0?h:new Error("logs request failed with status "+u)})}}})}}))}mf(e){(e!==0||this._instance.__loaded)&&(this.vd=D2(e,this.vd,3,(()=>this.A.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes."))))}ff(e){this.fo.length>0&&this.yf(e,this.fo,this.Xc,Bt.LIB_NAME,(t=>{this.fo=t})),this.jc.length>0&&this.yf(e,this.jc,this.if,$_,(t=>{this.jc=t}))}yf(e,t,n,r,a){if(t.length!==0){var o=t.map((h=>h.record));a([]);var u=t2(o,e2(n,Bt.LIB_NAME,Bt.LIB_VERSION),r,Bt.LIB_VERSION);this._instance._send_request({method:"POST",url:this.gf(),data:u,compression:"best-available",batchKey:"logs",transport:e})}}gf(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}Jc(){var e,t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var n=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),r=n.windowId,a=n.sessionStartTimestamp,o=n.lastActivityTimestamp;t.sessionId=n.sessionId,t.windowId=r,Ge(a)||(t.sessionStartTimestamp=a),Ge(o)||(t.lastActivityTimestamp=o)}if(Me!=null&&(e=Me.location)!=null&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?Vi(Me.location.href):Me.location.href),this._instance.featureFlags){var u=this._instance.featureFlags.getFlags();u&&u.length>0&&(t.activeFeatureFlags=u)}return t}}},w6={metrics:class{constructor(e){this.A=Vt("[metrics]"),this._instance=e}initialize(){}Kc(){var e,t,n=(e=this._instance)==null||(e=e.config)==null?void 0:e.metrics;return this.Vc&&this.Yc===n||((t=this.Vc)==null||t.reset(),this.Yc=n,this.Vc=new m4(this.Qc(),(function(r){var a,o,u,h,f,p=r==null?void 0:r.resourceAttributes;return{serviceName:(a=p==null?void 0:p["service.name"])!==null&&a!==void 0?a:r==null?void 0:r.serviceName,serviceVersion:(o=p==null?void 0:p["service.version"])!==null&&o!==void 0?o:r==null?void 0:r.serviceVersion,environment:(u=p==null?void 0:p["deployment.environment"])!==null&&u!==void 0?u:r==null?void 0:r.environment,resourceAttributes:p,beforeSend:r==null?void 0:r.beforeSend,flushIntervalMs:(h=r==null?void 0:r.flushIntervalMs)!==null&&h!==void 0?h:1e4,maxSeriesPerFlush:(f=r==null?void 0:r.maxSeriesPerFlush)!==null&&f!==void 0?f:1e3}})(n),this.A)),this.Vc}count(e,t,n){t===void 0&&(t=1),this.Kc().count(e,t,n)}gauge(e,t,n){this.Kc().gauge(e,t,n)}histogram(e,t,n){this.Kc().histogram(e,t,n)}flush(e){if(!this.Vc)return Promise.resolve();if(e){var t=this.Vc.drainWindow();return t&&this.Ss(t,e),Promise.resolve()}return this.Vc.flush().catch((n=>this.A.error("PostHog metrics flush failed:",n)))}reset(){var e;(e=this.Vc)==null||e.reset()}Qc(){var e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},Ss:n=>t.Ss(n),getLibraryId:()=>Bt.LIB_NAME,getLibraryVersion:()=>Bt.LIB_VERSION}}Ss(e,t){return new Promise((n=>{var r=!1,a=u=>{r||(r=!0,clearTimeout(o),n(u))},o=setTimeout((()=>a({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(de({method:"POST",url:this.bf(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t},{fireCallbackOnDrop:!0,callback(u){var h=u.statusCode;if(h>=200&&300>h)a({kind:"ok"});else if(h===413)a({kind:"too-large"});else if(h!==0&&h!==408&&h!==429&&500>h)a({kind:"fatal",error:new Error("metrics request failed with status "+h)});else{var f;a({kind:"retry-later",error:(f=u.error)!==null&&f!==void 0?f:new Error("metrics request failed with status "+h)})}}}))}))}bf(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},S6=de({},Hh,d6,h6,f6,p6,m6,x6,g6,v6,b6,y6,_6,w6);kr.__defaultExtensionClasses=de({},S6);var Yc=(function(){Bt.SDK_DIST_CHANNEL="npm";var e=Lc[Ol]=new kr;return(function(){function t(){t.done||(t.done=!0,aS=!1,jt(Lc,(function(n){n._dom_loaded()})))}pe!=null&&pe.addEventListener?pe.readyState==="complete"?t():Dt(pe,"DOMContentLoaded",t,{capture:!1}):ne&&be.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),e})();const k6="https://us.i.posthog.com",dS="cc-telemetry-enabled";let lx=!1,Wc=!1;function j6(){return k6}function N6(){if(typeof localStorage>"u")return!0;const e=localStorage.getItem(dS);return e===null?!0:e==="true"}function hS(e){lx&&(e?(Yc.opt_in_capturing({captureEventName:null}),Wc=!0):(Yc.opt_out_capturing(),Wc=!1))}function wO(e){typeof localStorage<"u"&&localStorage.setItem(dS,String(e)),hS(e)}function C6(){const e=void 0;return e?(Yc.init(e,{api_host:j6(),defaults:"2026-01-30",capture_pageview:!1,capture_pageleave:!0,capture_exceptions:!0,autocapture:!0,respect_dnt:!0}),lx=!0,hS(N6()),!0):(lx=!1,Wc=!1,!1)}function Ix(e,t){Wc&&Yc.capture(e,t)}function Yi(e,t){Wc&&Yc.captureException(e,t)}function E6(e){Ix("$pageview",{$current_url:e})}const js="/api",fS="companion_auth_token";function Wi(){if(typeof window>"u")return{};const e=localStorage.getItem(fS);return e?{Authorization:`Bearer ${e}`}:{}}function za(e){e===401&&typeof window<"u"&&(localStorage.removeItem(fS),qn(async()=>{const{useStore:t}=await Promise.resolve().then(()=>CC);return{useStore:t}},void 0).then(({useStore:t})=>{t.getState().logout()}).catch(()=>{}))}function yn(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}function eu(e,t,n,r){Ix("api_request_succeeded",{method:e,path:t,status:r,duration_ms:Math.round(n)})}function Ns(e,t,n,r,a){Ix("api_request_failed",{method:e,path:t,status:a,duration_ms:Math.round(n),error:r instanceof Error?r.message:String(r)}),Yi(r,{method:e,path:t,status:a})}async function He(e,t){const n=yn();let r=!1;try{const a=await fetch(`${js}${e}`,{method:"POST",headers:{"Content-Type":"application/json",...Wi()},body:t?JSON.stringify(t):void 0});if(!a.ok){za(a.status);const o=await a.json().catch(()=>({error:a.statusText})),u=new Error(o.error||a.statusText);throw Ns("POST",e,yn()-n,u,a.status),r=!0,u}return eu("POST",e,yn()-n,a.status),a.json()}catch(a){throw r||Ns("POST",e,yn()-n,a),a}}async function De(e){const t=yn();let n=!1;try{const r=await fetch(`${js}${e}`,{headers:{...Wi()}});if(!r.ok){za(r.status);const a=await r.json().catch(()=>({error:r.statusText})),o=new Error(a.error||r.statusText);throw Ns("GET",e,yn()-t,o,r.status),n=!0,o}return eu("GET",e,yn()-t,r.status),r.json()}catch(r){throw n||Ns("GET",e,yn()-t,r),r}}async function Hr(e,t){const n=yn();let r=!1;try{const a=await fetch(`${js}${e}`,{method:"PUT",headers:{"Content-Type":"application/json",...Wi()},body:t?JSON.stringify(t):void 0});if(!a.ok){za(a.status);const o=await a.json().catch(()=>({error:a.statusText})),u=new Error(o.error||a.statusText);throw Ns("PUT",e,yn()-n,u,a.status),r=!0,u}return eu("PUT",e,yn()-n,a.status),a.json()}catch(a){throw r||Ns("PUT",e,yn()-n,a),a}}async function A6(e,t){const n=yn();let r=!1;try{const a=await fetch(`${js}${e}`,{method:"PATCH",headers:{"Content-Type":"application/json",...Wi()},body:t?JSON.stringify(t):void 0});if(!a.ok){za(a.status);const o=await a.json().catch(()=>({error:a.statusText})),u=new Error(o.error||a.statusText);throw Ns("PATCH",e,yn()-n,u,a.status),r=!0,u}return eu("PATCH",e,yn()-n,a.status),a.json()}catch(a){throw r||Ns("PATCH",e,yn()-n,a),a}}async function qr(e,t){const n=yn();let r=!1;try{const a=await fetch(`${js}${e}`,{method:"DELETE",headers:{...t?{"Content-Type":"application/json"}:{},...Wi()},body:t?JSON.stringify(t):void 0});if(!a.ok){za(a.status);const o=await a.json().catch(()=>({error:a.statusText})),u=new Error(o.error||a.statusText);throw Ns("DELETE",e,yn()-n,u,a.status),r=!0,u}return eu("DELETE",e,yn()-n,a.status),a.json()}catch(a){throw r||Ns("DELETE",e,yn()-n,a),a}}async function T6(e,t){const n=await fetch(`${js}/sessions/create-stream`,{method:"POST",headers:{"Content-Type":"application/json",...Wi()},body:JSON.stringify(e??{})});if(!n.ok||!n.body){const h=await n.json().catch(()=>({error:n.statusText}));throw new Error(h.error||n.statusText)}const r=n.body.getReader(),a=new TextDecoder;let o="",u=null;for(;;){const{done:h,value:f}=await r.read();if(h)break;o+=a.decode(f,{stream:!0});const p=o.split(`
69
+
70
+ `);o=p.pop()||"";for(const m of p){if(!m.trim())continue;let x="",b="";for(const _ of m.split(`
71
+ `))_.startsWith("event:")?x=_.slice(6).trim():_.startsWith("data:")&&(b=_.slice(5).trim());if(!b)continue;const y=JSON.parse(b);if(x==="progress")t(y);else if(x==="done")u=y;else if(x==="error")throw new Error(y.error||"Session creation failed")}}if(!u)throw new Error("Stream ended without session creation result");return u}async function M6(){try{const e=await fetch(`${js}/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 U_(e){try{const t=await fetch(`${js}/auth/verify`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e})});return t.ok?!!(await t.json()).ok:!1}catch{return!1}}const Ne={getAuthQr:()=>De("/auth/qr"),getAuthToken:()=>De("/auth/token"),regenerateAuthToken:()=>He("/auth/regenerate"),createSession:e=>He("/sessions/create",e),listSessions:()=>De("/sessions"),discoverClaudeSessions:(e=200)=>De(`/claude/sessions/discover?limit=${encodeURIComponent(String(e))}`),getClaudeSessionHistory:(e,t)=>{const n=Math.max(0,Math.floor((t==null?void 0:t.cursor)??0)),r=Math.max(1,Math.floor((t==null?void 0:t.limit)??40));return De(`/claude/sessions/${encodeURIComponent(e)}/history?cursor=${encodeURIComponent(String(n))}&limit=${encodeURIComponent(String(r))}`)},killSession:e=>He(`/sessions/${encodeURIComponent(e)}/kill`),deleteSession:e=>qr(`/sessions/${encodeURIComponent(e)}`),relaunchSession:e=>He(`/sessions/${encodeURIComponent(e)}/relaunch`),exportSession:async(e,t)=>{const n=await fetch(`${js}/sessions/${encodeURIComponent(e)}/export?format=${t}`,{headers:{...Wi()}});if(!n.ok)throw za(n.status),new Error(`Export failed (${n.status})`);const r=await n.blob(),o=(n.headers.get("Content-Disposition")||"").match(/filename="?([^"]+)"?/),u=(o==null?void 0:o[1])||`session.${t}`;return{blob:r,filename:u}},archiveSession:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/archive`,t),getArchiveInfo:e=>De(`/sessions/${encodeURIComponent(e)}/archive-info`),unarchiveSession:e=>He(`/sessions/${encodeURIComponent(e)}/unarchive`),renameSession:(e,t)=>A6(`/sessions/${encodeURIComponent(e)}/name`,{name:t}),listDirs:e=>De(`/fs/list${e?`?path=${encodeURIComponent(e)}`:""}`),getHome:()=>De("/fs/home"),listEnvs:()=>De("/envs"),getEnv:e=>De(`/envs/${encodeURIComponent(e)}`),createEnv:(e,t)=>He("/envs",{name:e,variables:t}),updateEnv:(e,t)=>Hr(`/envs/${encodeURIComponent(e)}`,t),deleteEnv:e=>qr(`/envs/${encodeURIComponent(e)}`),listSandboxes:()=>De("/sandboxes"),getSandbox:e=>De(`/sandboxes/${encodeURIComponent(e)}`),createSandbox:(e,t)=>He("/sandboxes",{name:e,...t}),updateSandbox:(e,t)=>Hr(`/sandboxes/${encodeURIComponent(e)}`,t),deleteSandbox:e=>qr(`/sandboxes/${encodeURIComponent(e)}`),testInitScript:(e,t,n)=>He(`/sandboxes/${encodeURIComponent(e)}/test-init`,{cwd:t,initScript:n}),buildBaseImage:()=>He("/docker/build-base"),getBaseImageStatus:()=>De("/docker/base-image"),getSettings:()=>De("/settings"),updateSettings:e=>Hr("/settings",e),verifyAnthropicKey:e=>He("/settings/anthropic/verify",{apiKey:e}),getDashboard:()=>De("/dashboard"),runDashboardUpdate:()=>He("/dashboard/run"),getDashboardRunStatus:()=>De("/dashboard/run/status"),getTailscaleStatus:()=>De("/tailscale/status"),startTailscaleFunnel:()=>He("/tailscale/funnel/start"),stopTailscaleFunnel:()=>He("/tailscale/funnel/stop"),listLinearConnections:()=>De("/linear/connections"),createLinearConnection:e=>He("/linear/connections",e),updateLinearConnection:(e,t)=>Hr(`/linear/connections/${encodeURIComponent(e)}`,t),deleteLinearConnection:e=>qr(`/linear/connections/${encodeURIComponent(e)}`),verifyLinearConnection:e=>He(`/linear/connections/${encodeURIComponent(e)}/verify`,{}),searchLinearIssues:(e,t=8,n)=>De(`/linear/issues?query=${encodeURIComponent(e)}&limit=${encodeURIComponent(String(t))}${n?`&connectionId=${encodeURIComponent(n)}`:""}`),getLinearConnection:e=>De(`/linear/connection${e?`?connectionId=${encodeURIComponent(e)}`:""}`),getLinearStates:e=>De(`/linear/states${e?`?connectionId=${encodeURIComponent(e)}`:""}`),transitionLinearIssue:(e,t)=>He(`/linear/issues/${encodeURIComponent(e)}/transition${t?`?connectionId=${encodeURIComponent(t)}`:""}`,{}),listLinearProjects:e=>De(`/linear/projects${e?`?connectionId=${encodeURIComponent(e)}`:""}`),getLinearProjectIssues:(e,t=15,n)=>De(`/linear/project-issues?projectId=${encodeURIComponent(e)}&limit=${encodeURIComponent(String(t))}${n?`&connectionId=${encodeURIComponent(n)}`:""}`),getLinearProjectMapping:e=>De(`/linear/project-mappings?repoRoot=${encodeURIComponent(e)}`),upsertLinearProjectMapping:e=>Hr("/linear/project-mappings",e),removeLinearProjectMapping:e=>qr("/linear/project-mappings",{repoRoot:e}),linkLinearIssue:(e,t,n)=>Hr(`/sessions/${encodeURIComponent(e)}/linear-issue`,{...t,...n!==void 0?{connectionId:n}:{}}),unlinkLinearIssue:e=>qr(`/sessions/${encodeURIComponent(e)}/linear-issue`),getLinkedLinearIssue:(e,t=!1)=>De(`/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=>De(`/git/repo-info?path=${encodeURIComponent(e)}`),listBranches:e=>De(`/git/branches?repoRoot=${encodeURIComponent(e)}`),gitFetch:e=>He("/git/fetch",{repoRoot:e}),gitPull:e=>He("/git/pull",{cwd:e}),listWorktrees:e=>De(`/git/worktrees?repoRoot=${encodeURIComponent(e)}`),createWorktree:(e,t,n)=>He("/git/worktree",{repoRoot:e,branch:t,...n}),removeWorktree:(e,t,n)=>qr("/git/worktree",{repoRoot:e,worktreePath:t,force:n}),getPRStatus:(e,t)=>De(`/git/pr-status?cwd=${encodeURIComponent(e)}&branch=${encodeURIComponent(t)}`),getBackends:()=>De("/backends"),getBackendModels:e=>De(`/backends/${encodeURIComponent(e)}/models`),getContainerStatus:()=>De("/containers/status"),getContainerImages:()=>De("/containers/images"),getImageStatus:e=>De(`/images/${encodeURIComponent(e)}/status`),pullImage:e=>He(`/images/${encodeURIComponent(e)}/pull`),getCloudProviderPlan:(e,t,n)=>De(`/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=>De(`/fs/tree?path=${encodeURIComponent(e)}`),readFile:e=>De(`/fs/read?path=${encodeURIComponent(e)}`),getFileBlob:async e=>{const t=await fetch(`${js}/fs/raw?path=${encodeURIComponent(e)}`,{headers:{...Wi()}});if(!t.ok){za(t.status);const r=await t.json().catch(()=>({error:t.statusText}));throw new Error(r.error||t.statusText)}const n=await t.blob();return URL.createObjectURL(n)},writeFile:(e,t)=>Hr("/fs/write",{path:e,content:t}),getFileDiff:(e,t)=>De(`/fs/diff?path=${encodeURIComponent(e)}${t?`&base=${encodeURIComponent(t)}`:""}`),getChangedFiles:(e,t)=>De(`/fs/changed-files?cwd=${encodeURIComponent(e)}${t?`&base=${encodeURIComponent(t)}`:""}`),getClaudeMdFiles:e=>De(`/fs/claude-md?cwd=${encodeURIComponent(e)}`),saveClaudeMd:(e,t)=>Hr("/fs/claude-md",{path:e,content:t}),getClaudeConfig:e=>De(`/fs/claude-config?cwd=${encodeURIComponent(e)}`),getUsageLimits:()=>De("/usage-limits"),getSessionUsageLimits:e=>De(`/sessions/${encodeURIComponent(e)}/usage-limits`),getSystemMemory:()=>De("/system/memory"),getSystemDisk:()=>De("/system/disk"),spawnTerminal:(e,t,n,r)=>He("/terminal/spawn",{cwd:e,cols:t,rows:n,containerId:r==null?void 0:r.containerId}),killTerminal:e=>He("/terminal/kill",{terminalId:e}),getTerminal:e=>De(e?`/terminal?terminalId=${encodeURIComponent(e)}`:"/terminal"),checkForUpdate:()=>De("/update-check"),forceCheckForUpdate:()=>He("/update-check"),triggerUpdate:()=>He("/update"),getClaudeCompat:()=>De("/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:()=>De("/cron/jobs"),getCronJob:e=>De(`/cron/jobs/${encodeURIComponent(e)}`),createCronJob:e=>He("/cron/jobs",e),updateCronJob:(e,t)=>Hr(`/cron/jobs/${encodeURIComponent(e)}`,t),deleteCronJob:e=>qr(`/cron/jobs/${encodeURIComponent(e)}`),toggleCronJob:e=>He(`/cron/jobs/${encodeURIComponent(e)}/toggle`),runCronJob:e=>He(`/cron/jobs/${encodeURIComponent(e)}/run`),getCronJobExecutions:e=>De(`/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=>De(`/sessions/${encodeURIComponent(e)}/processes/system`),killSystemProcess:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/processes/system/${t}/kill`),listAgents:()=>De("/agents"),getAgent:e=>De(`/agents/${encodeURIComponent(e)}`),createAgent:e=>He("/agents",e),updateAgent:(e,t)=>Hr(`/agents/${encodeURIComponent(e)}`,t),deleteAgent:e=>qr(`/agents/${encodeURIComponent(e)}`),toggleAgent:e=>He(`/agents/${encodeURIComponent(e)}/toggle`),runAgent:(e,t)=>He(`/agents/${encodeURIComponent(e)}/run`,{input:t}),getAgentExecutions:e=>De(`/agents/${encodeURIComponent(e)}/executions`),importAgent:e=>He("/agents/import",e),exportAgent:e=>De(`/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 De(`/executions${n?`?${n}`:""}`)},getLinearOAuthStatus:e=>{const t=new URLSearchParams;e&&t.set("stagingId",e);const n=t.toString();return De(`/linear/oauth/status${n?`?${n}`:""}`)},getLinearOAuthAuthorizeUrl:(e,t)=>{const n=new URLSearchParams;e&&n.set("returnTo",e),t&&n.set("stagingId",t);const r=n.toString();return De(`/linear/oauth/authorize-url${r?`?${r}`:""}`)},disconnectLinearOAuth:()=>He("/linear/oauth/disconnect"),createLinearStaging:e=>He("/linear/oauth/staging",e),getLinearStagingStatus:e=>De(`/linear/oauth/staging/${encodeURIComponent(e)}/status`),deleteLinearStaging:e=>qr(`/linear/oauth/staging/${encodeURIComponent(e)}`),listLinearOAuthConnections:()=>De("/linear/oauth-connections"),createLinearOAuthConnection:e=>He("/linear/oauth-connections",e),updateLinearOAuthConnection:(e,t)=>Hr(`/linear/oauth-connections/${encodeURIComponent(e)}`,t),deleteLinearOAuthConnection:e=>qr(`/linear/oauth-connections/${encodeURIComponent(e)}`),getLinearOAuthConnectionAuthorizeUrl:(e,t)=>De(`/linear/oauth-connections/${encodeURIComponent(e)}/authorize-url${t?`?returnTo=${encodeURIComponent(t)}`:""}`),listSkills:()=>De("/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 r=n.toString();return De(`/prompts${r?`?${r}`:""}`)},createPrompt:e=>He("/prompts",e),updatePrompt:(e,t)=>Hr(`/prompts/${encodeURIComponent(e)}`,t),deletePrompt:e=>qr(`/prompts/${encodeURIComponent(e)}`)};let I_=!1;function H_(e){return new Promise((t,n)=>{if(typeof document>"u"||typeof document.execCommand!="function"){n(new Error("Clipboard fallback is unavailable"));return}try{const r=document.createElement("textarea");r.value=e,r.setAttribute("readonly",""),r.style.position="fixed",r.style.left="-9999px",document.body.appendChild(r),r.select();const a=document.execCommand("copy");if(document.body.removeChild(r),!a){n(new Error("Copy command was rejected"));return}t()}catch(r){n(r instanceof Error?r:new Error("Clipboard copy failed"))}})}function q_(){return new Promise(()=>{})}function D6(){if(I_||typeof window>"u")return;I_=!0;const e=window.navigator,t=e.clipboard;if(t!=null&&t.writeText){const n=t.writeText.bind(t);try{t.writeText=async r=>{try{await n(r)}catch{try{await H_(r)}catch{return q_()}}}}catch{}return}try{Object.defineProperty(e,"clipboard",{configurable:!0,value:{writeText:async n=>{try{await H_(n)}catch{return q_()}}}})}catch{}}const V_="#/session/",G_="#/agents/";let Y_=!1;function Hx(){Y_||(D6(),Y_=!0)}function qx(e){if(Hx(),e==="#/dashboard")return{page:"dashboard"};if(e==="#/settings")return{page:"settings"};if(e==="#/integrations")return{page:"integrations"};if(e==="#/integrations/linear")return{page:"integration-linear"};if(e==="#/integrations/linear-oauth")return{page:"integration-linear-oauth"};if(e==="#/integrations/tailscale")return{page:"integration-tailscale"};if(e==="#/prompts")return{page:"prompts"};if(e==="#/environments")return{page:"environments"};if(e==="#/sandboxes")return{page:"sandboxes"};if(e==="#/scheduled")return{page:"agents"};if(e==="#/runs")return{page:"runs"};if(e==="#/playground")return{page:"playground"};if(e.split("?")[0]==="#/agents")return{page:"agents"};if(e.startsWith(G_)){const n=e.slice(G_.length);if(n)return{page:"agent-detail",agentId:n}}if(e.startsWith(V_)){const n=e.slice(V_.length);if(n)return{page:"session",sessionId:n}}return{page:"home"}}function L6(e){return`#/session/${e}`}function Vx(e,t=!1){Hx();const n=L6(e);t?(history.replaceState(null,"",n),window.dispatchEvent(new HashChangeEvent("hashchange"))):window.location.hash=`/session/${e}`}function Um(e=!1){Hx(),e?(history.replaceState(null,"",window.location.pathname+window.location.search),window.dispatchEvent(new HashChangeEvent("hashchange"))):window.location.hash=""}function R6(){const[e,t]=k.useState(""),[n,r]=k.useState(null),[a,o]=k.useState(!1),u=Y(m=>m.setAuthToken),h=k.useCallback(async m=>{m.preventDefault();const x=e.trim();if(!x){r("Please enter a token");return}o(!0),r(null),await U_(x)?u(x):r("Invalid token"),o(!1)},[e,u]);k.useEffect(()=>{M6().then(m=>{if(m){u(m);return}const b=new URLSearchParams(window.location.search).get("token");b&&(o(!0),U_(b).then(y=>{if(y){u(b);const _=new URL(window.location.href);_.searchParams.delete("token"),window.history.replaceState({},"",_.toString())}else r("Invalid token from URL"),o(!1)}))})},[u]);const[f,p]=k.useState(!1);return l.jsx("div",{className:"h-[100dvh] flex items-center justify-center bg-cc-bg text-cc-fg font-sans-ui antialiased",children:l.jsxs("div",{className:"w-full max-w-sm px-6",children:[l.jsxs("div",{className:"text-center mb-8",children:[l.jsx("h1",{className:"text-xl font-semibold text-cc-fg mb-2",children:"The Companion"}),l.jsx("p",{className:"text-sm text-cc-muted",children:"Enter your auth token to continue"})]}),l.jsxs("form",{onSubmit:h,className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("label",{htmlFor:"auth-token",className:"block text-xs text-cc-muted mb-1.5",children:"Auth Token"}),l.jsxs("div",{className:"relative",children:[l.jsx("input",{id:"auth-token",type:f?"text":"password",value:e,onChange:m=>{t(m.target.value),r(null)},placeholder:"Paste your token here",className:"w-full px-3 py-2 pr-16 text-sm bg-cc-hover border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted/50 focus:outline-none focus:ring-1 focus:ring-cc-primary focus:border-cc-primary font-mono",autoComplete:"off",disabled:a}),l.jsx("button",{type:"button",onClick:()=>p(!f),className:"absolute right-2 top-1/2 -translate-y-1/2 text-[11px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer px-1.5 py-0.5 rounded hover:bg-cc-hover",tabIndex:-1,children:f?"Hide":"Show"})]})]}),n&&l.jsx("p",{className:"text-xs text-cc-error",role:"alert",children:n}),l.jsx("button",{type:"submit",disabled:a||!e.trim(),className:"w-full py-2 px-4 text-sm font-medium bg-cc-primary text-white rounded-md hover:opacity-90 disabled:opacity-50 transition-opacity cursor-pointer disabled:cursor-not-allowed",children:a?"Verifying...":"Login"})]}),l.jsx("p",{className:"mt-6 text-[11px] text-cc-muted text-center leading-relaxed",children:"Scan the QR code in Settings with your phone camera to authenticate, or find your token in the server console."})]})})}var so=rw();function z6({issueIdentifier:e,issueStateName:t,isContainerized:n,archiveTransitionConfigured:r,archiveTransitionStateName:a,hasBacklogState:o,onConfirm:u,onCancel:h}){const[f,p]=k.useState("none");return so.createPortal(l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:h,children:l.jsxs("div",{role:"dialog","aria-label":"Archive session",className:"mx-4 w-full max-w-sm bg-cc-card border border-cc-border rounded-xl shadow-2xl p-5",onClick:m=>m.stopPropagation(),children:[l.jsxs("div",{className:"flex items-center justify-between mb-3",children:[l.jsx("h3",{className:"text-sm font-semibold text-cc-fg",children:"Archive session"}),l.jsx("button",{type:"button","aria-label":"Close",onClick:h,className:"inline-flex h-6 w-6 items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]}),n&&l.jsx("div",{className:"mb-3 p-2.5 rounded-lg bg-amber-500/10 border border-amber-500/20",children:l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-amber-500 shrink-0 mt-0.5",children:l.jsx("path",{d:"M8.982 1.566a1.13 1.13 0 00-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 01-1.1 0L7.1 5.995A.905.905 0 018 5zm.002 6a1 1 0 110 2 1 1 0 010-2z"})}),l.jsxs("p",{className:"text-[11px] text-cc-fg leading-snug",children:["Archiving will ",l.jsx("strong",{children:"remove the container"})," and any uncommitted changes."]})]})}),l.jsxs("p",{className:"text-xs text-cc-muted mb-3",children:["This session is linked to ",l.jsx("strong",{className:"text-cc-fg",children:e})," ",l.jsxs("span",{className:"text-cc-muted",children:["(",t,")"]}),". What should happen to the issue?"]}),l.jsxs("fieldset",{className:"space-y-2 mb-4",children:[l.jsx("legend",{className:"sr-only",children:"Linear issue transition choice"}),l.jsxs("label",{className:"flex items-center gap-2.5 px-2.5 py-2 rounded-lg border border-cc-border hover:bg-cc-hover/50 transition-colors cursor-pointer",children:[l.jsx("input",{type:"radio",name:"archive-linear-choice",value:"none",checked:f==="none",onChange:()=>p("none"),className:"accent-cc-primary"}),l.jsx("span",{className:"text-xs text-cc-fg",children:"Keep current status"})]}),l.jsxs("label",{className:`flex items-center gap-2.5 px-2.5 py-2 rounded-lg border border-cc-border transition-colors ${o?"hover:bg-cc-hover/50 cursor-pointer":"opacity-50 cursor-not-allowed"}`,children:[l.jsx("input",{type:"radio",name:"archive-linear-choice",value:"backlog",checked:f==="backlog",onChange:()=>p("backlog"),disabled:!o,className:"accent-cc-primary"}),l.jsx("span",{className:"text-xs text-cc-fg",children:"Move to Backlog"})]}),r&&a&&l.jsxs("label",{className:"flex items-center gap-2.5 px-2.5 py-2 rounded-lg border border-cc-border hover:bg-cc-hover/50 transition-colors cursor-pointer",children:[l.jsx("input",{type:"radio",name:"archive-linear-choice",value:"configured",checked:f==="configured",onChange:()=>p("configured"),className:"accent-cc-primary"}),l.jsxs("span",{className:"text-xs text-cc-fg",children:["Move to ",a]})]})]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("button",{type:"button",onClick:h,className:"px-3 py-1.5 text-xs font-medium rounded-md bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),l.jsx("button",{type:"button",onClick:()=>u(f,n||void 0),className:"px-3 py-1.5 text-xs font-medium rounded-md bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Archive"})]})]})}),document.body)}function O6(e,t){return t>0?"awaiting":(e.status==="running"||e.status==="compacting")&&e.isConnected?"running":e.isReconnecting?"reconnecting":e.isConnected?"idle":"exited"}function B6({status:e}){switch(e){case"running":return l.jsxs("span",{className:"relative shrink-0 w-2 h-2",children:[l.jsx("span",{className:"absolute inset-0 rounded-full bg-cc-success animate-[pulse-dot_1.5s_ease-in-out_infinite]"}),l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-success block"})]});case"awaiting":return l.jsx("span",{className:"relative shrink-0 w-2 h-2",children:l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-warning block animate-[ring-pulse_1.5s_ease-out_infinite]"})});case"reconnecting":return l.jsx("span",{className:"relative shrink-0 w-2 h-2",children:l.jsx("span",{className:"w-2 h-2 rounded-full border border-cc-warning/40 border-t-cc-warning block animate-spin"})});case"idle":return l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-muted/40 shrink-0"});case"exited":return l.jsx("span",{className:"w-2 h-2 rounded-full border border-cc-muted/25 shrink-0"})}}function P6({type:e}){return e==="codex"?l.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded bg-sky-500/15 text-sky-500 leading-none",children:"CX"}):l.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded bg-cc-success/15 text-cc-success leading-none",children:"CC"})}function eh({session:e,isActive:t,isArchived:n,sessionName:r,permCount:a,isRecentlyRenamed:o,onSelect:u,onStartRename:h,onArchive:f,onUnarchive:p,onDelete:m,onClearRecentlyRenamed:x,editingSessionId:b,editingName:y,setEditingName:_,onConfirmRename:j,onCancelRename:N,editInputRef:w}){const C=e.id.slice(0,8),E=r||e.model||C,R=b===e.id,[L,O]=k.useState(!1),q=k.useRef(null),F=k.useRef(null),W=n?"exited":O6(e,a),z=e.cwd||"";k.useEffect(()=>{if(!L)return;function A(Z){var G;q.current&&!q.current.contains(Z.target)&&F.current&&!F.current.contains(Z.target)&&(O(!1),(G=F.current)==null||G.focus())}function X(Z){var G,B,$;if(Z.key==="Escape"){O(!1),(G=F.current)==null||G.focus();return}if(Z.key==="Tab"){O(!1);return}if((Z.key==="ArrowDown"||Z.key==="ArrowUp")&&((B=q.current)!=null&&B.contains(document.activeElement)||F.current===document.activeElement)){Z.preventDefault();const se=($=q.current)==null?void 0:$.querySelectorAll("[role='menuitem']");if(!se||se.length===0)return;const ae=document.activeElement,D=Array.from(se).indexOf(ae);Z.key==="ArrowDown"?se[D<se.length-1?D+1:0].focus():se[D>0?D-1:se.length-1].focus()}}return document.addEventListener("mousedown",A),document.addEventListener("touchstart",A),document.addEventListener("keydown",X),()=>{document.removeEventListener("mousedown",A),document.removeEventListener("touchstart",A),document.removeEventListener("keydown",X)}},[L]),k.useEffect(()=>{L&&requestAnimationFrame(()=>{var A,X;(X=(A=q.current)==null?void 0:A.querySelector("[role='menuitem']"))==null||X.focus()})},[L]);const I=k.useCallback(A=>{O(!1),A()},[]);return l.jsxs("div",{className:"relative group",children:[l.jsxs("button",{onClick:()=>u(e.id),onDoubleClick:A=>{A.preventDefault(),h(e.id,E)},onKeyDown:A=>{A.key==="F2"&&!R&&(A.preventDefault(),h(e.id,E))},className:`w-full flex items-center gap-2 py-2 pl-2.5 pr-12 min-h-[44px] rounded-lg transition-all duration-100 cursor-pointer relative ${t?"bg-cc-active":"hover:bg-cc-hover"}`,children:[l.jsx("span",{"aria-hidden":!0,className:`absolute left-0 top-1/2 -translate-y-1/2 w-[3px] rounded-full transition-all duration-150 ${t?"h-5 bg-cc-primary":"h-0 bg-transparent"}`}),!R&&l.jsx(B6,{status:W}),R?l.jsx("input",{ref:w,value:y,onChange:A=>_(A.target.value),onKeyDown:A=>{A.key==="Enter"?(A.preventDefault(),j()):A.key==="Escape"&&(A.preventDefault(),N()),A.stopPropagation()},onBlur:j,onClick:A=>A.stopPropagation(),onDoubleClick:A=>A.stopPropagation(),className:"text-[12.5px] font-medium flex-1 min-w-0 text-cc-fg bg-transparent border border-cc-border rounded-md px-2 py-1 outline-none focus:border-cc-primary/50 focus:ring-1 focus:ring-cc-primary/20"}):l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("span",{className:`text-[12.5px] font-medium truncate block leading-snug ${t?"text-cc-fg":"text-cc-fg/90"} ${o?"animate-name-appear":""}`,onAnimationEnd:()=>x(e.id),children:E}),z&&l.jsx("span",{className:"text-[10px] text-cc-muted/70 truncate block leading-tight mt-px",children:z})]}),!R&&l.jsxs("span",{className:"flex items-center gap-1 shrink-0",children:[l.jsx(P6,{type:e.backendType}),e.isContainerized&&l.jsx("span",{className:"flex items-center px-1 py-0.5 rounded bg-blue-400/10",title:"Docker",children:l.jsx("img",{src:"/logo-docker.svg",alt:"Docker logo",className:"w-3 h-3"})}),e.cronJobId&&l.jsx("span",{className:"flex items-center px-1 py-0.5 rounded bg-cc-primary/10",title:"Scheduled",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 text-cc-primary",children:l.jsx("path",{d:"M8 2a6 6 0 100 12A6 6 0 008 2zM0 8a8 8 0 1116 0A8 8 0 010 8zm9-3a1 1 0 10-2 0v3a1 1 0 00.293.707l2 2a1 1 0 001.414-1.414L9 7.586V5z"})})})]})]}),!n&&!R&&!L&&l.jsx("button",{onClick:A=>{A.stopPropagation(),f(A,e.id)},className:"absolute right-7 top-1/2 -translate-y-1/2 p-1 rounded-md opacity-0 pointer-events-none sm:group-hover:opacity-100 sm:group-hover:pointer-events-auto hover:bg-cc-border text-cc-muted hover:text-cc-fg transition-all cursor-pointer",title:"Archive","aria-label":"Archive session",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M2 4a1 1 0 011-1h10a1 1 0 011 1v1H2V4zm1 2h10v6a1 1 0 01-1 1H4a1 1 0 01-1-1V6zm3 2a.5.5 0 000 1h4a.5.5 0 000-1H6z"})})}),l.jsx("button",{ref:F,onClick:A=>{A.stopPropagation(),O(!L)},className:"absolute right-1 top-1/2 -translate-y-1/2 p-1 rounded-md opacity-100 pointer-events-auto sm:opacity-0 sm:pointer-events-none sm:group-hover:opacity-100 sm:group-hover:pointer-events-auto hover:bg-cc-border text-cc-muted hover:text-cc-fg transition-all cursor-pointer",title:"Session actions","aria-label":"Session actions","aria-haspopup":"true","aria-expanded":L,children:l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:[l.jsx("circle",{cx:"8",cy:"3",r:"1.5"}),l.jsx("circle",{cx:"8",cy:"8",r:"1.5"}),l.jsx("circle",{cx:"8",cy:"13",r:"1.5"})]})}),L&&l.jsxs("div",{ref:q,role:"menu","aria-label":"Session actions",className:"absolute right-0 top-full mt-1 w-40 py-1 bg-cc-card border border-cc-border/80 rounded-lg shadow-xl z-10 animate-[menu-appear_150ms_ease-out]",children:[!n&&l.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:()=>I(()=>h(e.id,E)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted",children:l.jsx("path",{d:"M12.146.854a.5.5 0 00-.707 0L3.714 8.579a.5.5 0 00-.138.242l-.777 3.11a.5.5 0 00.607.607l3.11-.777a.5.5 0 00.242-.138L14.573 3.854a.5.5 0 000-.708L12.146.854z"})}),"Rename"]}),n?l.jsxs(l.Fragment,{children:[l.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:A=>I(()=>p(A,e.id)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted",children:[l.jsx("path",{d:"M8 4a.5.5 0 01.5.5v3.793l1.854-1.853a.5.5 0 01.707.707l-2.828 2.828a.5.5 0 01-.707 0L4.697 7.147a.5.5 0 01.707-.707L7.5 8.293V4.5A.5.5 0 018 4z"}),l.jsx("path",{d:"M2 12.5A1.5 1.5 0 003.5 14h9a1.5 1.5 0 001.5-1.5v-2a.5.5 0 00-1 0v2a.5.5 0 01-.5.5h-9a.5.5 0 01-.5-.5v-2a.5.5 0 00-1 0v2z"})]}),"Restore"]}),l.jsx("div",{className:"my-1 mx-2 border-t border-cc-border/50"}),l.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:A=>I(()=>m(A,e.id)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-error hover:bg-cc-error/5 transition-colors cursor-pointer flex items-center gap-2",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:[l.jsx("path",{d:"M5.5 5.5A.5.5 0 016 6v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm2.5 0a.5.5 0 01.5.5v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm3 .5a.5.5 0 00-1 0v6a.5.5 0 001 0V6z"}),l.jsx("path",{fillRule:"evenodd",d:"M14.5 3a1 1 0 01-1 1H13v9a2 2 0 01-2 2H5a2 2 0 01-2-2V4h-.5a1 1 0 010-2H6a1 1 0 011-1h2a1 1 0 011 1h3.5a1 1 0 011 1zM4.118 4L4 4.059V13a1 1 0 001 1h6a1 1 0 001-1V4.059L11.882 4H4.118zM6 2h4v1H6V2z",clipRule:"evenodd"})]}),"Delete"]})]}):l.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:A=>I(()=>f(A,e.id)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted",children:l.jsx("path",{d:"M2 4a1 1 0 011-1h10a1 1 0 011 1v1H2V4zm1 2h10v6a1 1 0 01-1 1H4a1 1 0 01-1-1V6zm3 2a.5.5 0 000 1h4a.5.5 0 000-1H6z"})}),"Archive"]})]})]})}function $6({group:e,isCollapsed:t,onToggleCollapse:n,currentSessionId:r,sessionNames:a,pendingPermissions:o,recentlyRenamed:u,onSelect:h,onStartRename:f,onArchive:p,onUnarchive:m,onDelete:x,onClearRecentlyRenamed:b,editingSessionId:y,editingName:_,setEditingName:j,onConfirmRename:N,onCancelRename:w,editInputRef:C,isFirst:E}){const R=t?e.sessions.slice(0,2).map(L=>a.get(L.id)||L.model||L.id.slice(0,8)).join(", ")+(e.sessions.length>2?", ...":""):"";return l.jsxs("div",{className:E?"":"mt-3 pt-3 border-t border-cc-separator",children:[l.jsxs("button",{onClick:()=>n(e.key),"aria-expanded":!t,className:"w-full px-2 py-1 flex items-center gap-1.5 hover:bg-cc-hover rounded-md transition-colors cursor-pointer group/header",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${t?"":"rotate-90"}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx("span",{className:"text-[11px] font-semibold text-cc-fg/60 truncate uppercase tracking-wide",children:e.label}),l.jsxs("span",{className:"flex items-center gap-1 ml-auto shrink-0",children:[e.runningCount>0&&l.jsx("span",{className:"w-1 h-1 rounded-full bg-cc-success",title:`${e.runningCount} running`}),e.permCount>0&&l.jsx("span",{className:"w-1 h-1 rounded-full bg-cc-warning",title:`${e.permCount} waiting`})]}),l.jsx("span",{className:"text-[10px] text-cc-muted/50 tabular-nums shrink-0",children:e.sessions.length})]}),t&&R&&l.jsx("div",{className:"text-[10px] text-cc-muted/70 truncate pl-5 pb-0.5",children:R}),!t&&l.jsx("div",{className:"mt-0.5",children:e.sessions.map(L=>{var q;const O=((q=o.get(L.id))==null?void 0:q.size)??0;return l.jsx(eh,{session:L,isActive:r===L.id,sessionName:a.get(L.id),permCount:O,isRecentlyRenamed:u.has(L.id),onSelect:h,onStartRename:f,onArchive:p,onUnarchive:m,onDelete:x,onClearRecentlyRenamed:b,editingSessionId:y,editingName:_,setEditingName:j,onConfirmRename:N,onCancelRename:w,editInputRef:C},L.id)})})]})}function F6(e,t,n=!1){return(n&&!!t&&(t==="/workspace"||t.startsWith("/workspace/"))?e:t||e).replace(/\/+$/,"")||"/"}function U6(e){if(e==="/")return"/";const t=e.split("/").filter(Boolean);return t.length===0?"/":t[t.length-1]}function I6(e){const t=new Map;for(const r of e){const a=F6(r.cwd,r.repoRoot||void 0,r.isContainerized),o=U6(a);t.has(a)||t.set(a,{key:a,label:o,sessions:[],runningCount:0,permCount:0,mostRecentActivity:0});const u=t.get(a);u.sessions.push(r),r.status==="running"&&u.runningCount++,u.permCount+=r.permCount,u.mostRecentActivity=Math.max(u.mostRecentActivity,r.createdAt)}const n=Array.from(t.values()).sort((r,a)=>r.label.localeCompare(a.label));for(const r of n)r.sessions.sort((a,o)=>o.createdAt-a.createdAt);return n}const H6=[{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"}],q6=[{id:"dashboard",label:"Dashboard",hash:"#/dashboard",activePages:["dashboard"],viewBox:"0 0 16 16",iconPath:"M1 2.5A1.5 1.5 0 012.5 1h3A1.5 1.5 0 017 2.5v3A1.5 1.5 0 015.5 7h-3A1.5 1.5 0 011 5.5v-3zm1.5-.5a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5h-3zM9 2.5A1.5 1.5 0 0110.5 1h3A1.5 1.5 0 0115 2.5v3A1.5 1.5 0 0113.5 7h-3A1.5 1.5 0 019 5.5v-3zm1.5-.5a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5h-3zM1 10.5A1.5 1.5 0 012.5 9h3A1.5 1.5 0 017 10.5v3A1.5 1.5 0 015.5 15h-3A1.5 1.5 0 011 13.5v-3zm1.5-.5a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5h-3zM9 10.5A1.5 1.5 0 0110.5 9h3a1.5 1.5 0 011.5 1.5v3a1.5 1.5 0 01-1.5 1.5h-3A1.5 1.5 0 019 13.5v-3zm1.5-.5a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5h-3z"},{id:"prompts",label:"Prompts",hash:"#/prompts",viewBox:"0 0 16 16",iconPath:"M3 2.5A1.5 1.5 0 014.5 1h5.879c.398 0 .779.158 1.06.44l1.621 1.62c.281.282.44.663.44 1.061V13.5A1.5 1.5 0 0112 15H4.5A1.5 1.5 0 013 13.5v-11zM4.5 2a.5.5 0 00-.5.5v11a.5.5 0 00.5.5H12a.5.5 0 00.5-.5V4.121a.5.5 0 00-.146-.353l-1.621-1.621A.5.5 0 0010.379 2H4.5zm1.25 4.25a.75.75 0 01.75-.75h3a.75.75 0 010 1.5h-3a.75.75 0 01-.75-.75zm0 3a.75.75 0 01.75-.75h3.5a.75.75 0 010 1.5H6.5a.75.75 0 01-.75-.75z"},{id:"integrations",label:"Integrations",hash:"#/integrations",activePages:["integrations","integration-linear","integration-linear-oauth","integration-tailscale"],viewBox:"0 0 16 16",iconPath:"M2.5 3A1.5 1.5 0 001 4.5v2A1.5 1.5 0 002.5 8h2A1.5 1.5 0 006 6.5v-2A1.5 1.5 0 004.5 3h-2zm0 1h2a.5.5 0 01.5.5v2a.5.5 0 01-.5.5h-2a.5.5 0 01-.5-.5v-2a.5.5 0 01.5-.5zm9 0A1.5 1.5 0 0010 5.5v2A1.5 1.5 0 0011.5 9h2A1.5 1.5 0 0015 7.5v-2A1.5 1.5 0 0013.5 4h-2zm0 1h2a.5.5 0 01.5.5v2a.5.5 0 01-.5.5h-2a.5.5 0 01-.5-.5v-2a.5.5 0 01.5-.5zM2.5 10A1.5 1.5 0 001 11.5v2A1.5 1.5 0 002.5 15h2A1.5 1.5 0 006 13.5v-2A1.5 1.5 0 004.5 10h-2zm0 1h2a.5.5 0 01.5.5v2a.5.5 0 01-.5.5h-2a.5.5 0 01-.5-.5v-2a.5.5 0 01.5-.5zM8.5 12a.5.5 0 100 1h5a.5.5 0 100-1h-5zm0-2a.5.5 0 100 1h2a.5.5 0 100-1h-2z"},{id:"environments",label:"Environments",hash:"#/environments",viewBox:"0 0 16 16",iconPath:"M8 1a2 2 0 012 2v1h2a2 2 0 012 2v6a2 2 0 01-2 2H4a2 2 0 01-2-2V6a2 2 0 012-2h2V3a2 2 0 012-2zm0 1.5a.5.5 0 00-.5.5v1h1V3a.5.5 0 00-.5-.5zM4 5.5a.5.5 0 00-.5.5v6a.5.5 0 00.5.5h8a.5.5 0 00.5-.5V6a.5.5 0 00-.5-.5H4z",activePages:["environments"]},{id:"sandboxes",label:"Sandboxes",hash:"#/sandboxes",viewBox:"0 0 16 16",iconPath:"M2 2a2 2 0 012-2h8a2 2 0 012 2v12a2 2 0 01-2 2H4a2 2 0 01-2-2V2zm2-.5a.5.5 0 00-.5.5v12a.5.5 0 00.5.5h8a.5.5 0 00.5-.5V2a.5.5 0 00-.5-.5H4zM6 4.5a.5.5 0 01.5-.5h3a.5.5 0 010 1h-3a.5.5 0 01-.5-.5zM6.5 7a.5.5 0 000 1h3a.5.5 0 000-1h-3z",activePages:["sandboxes"]},{id:"agents",label:"Agents",hash:"#/agents",activePages:["agents","agent-detail"],viewBox:"0 0 16 16",iconPath:"M8 1.5a2.5 2.5 0 00-2.5 2.5c0 1.38 1.12 2.5 2.5 2.5s2.5-1.12 2.5-2.5S9.38 1.5 8 1.5zM4 8a4 4 0 00-4 4v1.5a.5.5 0 00.5.5h15a.5.5 0 00.5-.5V12a4 4 0 00-4-4H4z"},{id:"runs",label:"Runs",hash:"#/runs",viewBox:"0 0 16 16",iconPath:"M8 1a7 7 0 100 14A7 7 0 008 1zm-.75 3.5a.75.75 0 011.5 0v3.19l2.03 2.03a.75.75 0 01-1.06 1.06l-2.25-2.25A.75.75 0 017.25 8V4.5z"},{id:"settings",label:"Settings",hash:"#/settings",viewBox:"0 0 20 20",iconPath:"M11.49 3.17c-.38-1.56-2.6-1.56-2.98 0a1.53 1.53 0 01-2.29.95c-1.35-.8-2.92.77-2.12 2.12.54.9.07 2.04-.95 2.29-1.56.38-1.56 2.6 0 2.98 1.02.25 1.49 1.39.95 2.29-.8 1.35.77 2.92 2.12 2.12.9-.54 2.04-.07 2.29.95.38 1.56 2.6 1.56 2.98 0 .25-1.02 1.39-1.49 2.29-.95 1.35.8 2.92-.77 2.12-2.12-.54-.9-.07-2.04.95-2.29 1.56-.38 1.56-2.6 0-2.98-1.02-.25-1.49-1.39-.95-2.29.8-1.35-.77-2.92-2.12-2.12-.9.54-2.04.07-2.29-.95zM10 13a3 3 0 100-6 3 3 0 000 6z",fillRule:"evenodd",clipRule:"evenodd"}],V6=[{id:"workbench",label:"Workbench",itemIds:["dashboard","prompts","integrations"]},{id:"workspace",label:"Workspace",itemIds:["environments","sandboxes","agents","settings"]}],G6=new Map(q6.map(e=>[e.id,e]));function Y6(){var Xr,Kr;const[e,t]=k.useState(null),[n,r]=k.useState(""),[a,o]=k.useState(!1),[u,h]=k.useState(null),[f,p]=k.useState(null),[m,x]=k.useState(null),[b,y]=k.useState(!1),[_,j]=k.useState(null),[N,w]=k.useState(!1),[C,E]=k.useState(()=>typeof window<"u"?window.location.hash:""),R=k.useRef(null),L=k.useRef(null),O=Y(re=>re.sessions),q=Y(re=>re.sdkSessions),F=Y(re=>re.currentSessionId),W=Y(re=>re.cliConnected),z=Y(re=>re.cliReconnecting),I=Y(re=>re.sessionStatus),A=Y(re=>re.removeSession),X=Y(re=>re.sessionNames),Z=Y(re=>re.recentlyRenamed),G=Y(re=>re.clearRecentlyRenamed),B=Y(re=>re.pendingPermissions),$=Y(re=>re.linkedLinearIssues),se=Y(re=>re.collapsedProjects),ae=Y(re=>re.toggleProjectCollapse),D=qx(C);k.useEffect(()=>{let re=!0;async function ve(){try{const Xe=await Ne.listSessions();if(re){const Ht=Y.getState();Ht.setSdkSessions(Xe);const fn=Y.getState(),Pn=new Set(Xe.map(qt=>qt.sessionId));for(const qt of fn.sessions.keys())!Pn.has(qt)&&fn.connectionStatus.get(qt)!=="connected"&&fn.removeSession(qt);T3(Xe);for(const qt of Xe)if(qt.name&&(!Ht.sessionNames.has(qt.sessionId)||/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(Ht.sessionNames.get(qt.sessionId)))){const Gn=Ht.sessionNames.get(qt.sessionId),Er=!!Gn&&/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(Gn);Gn!==qt.name&&(Ht.setSessionName(qt.sessionId,qt.name),Er&&Ht.markRecentlyRenamed(qt.sessionId))}}}catch{}}ve();const ye=setInterval(ve,5e3);return()=>{re=!1,clearInterval(ye)}},[]),k.useEffect(()=>{const re=()=>E(window.location.hash);return window.addEventListener("hashchange",re),()=>window.removeEventListener("hashchange",re)},[]);function P(re){Vx(re),window.innerWidth<768&&Y.getState().setSidebarOpen(!1)}function J(){Um(),Y.getState().newSession(),window.innerWidth<768&&Y.getState().setSidebarOpen(!1)}k.useEffect(()=>{e&&R.current&&(R.current.focus(),R.current.select())},[e]);function M(){e&&n.trim()&&(Y.getState().setSessionName(e,n.trim()),Ne.renameSession(e,n.trim()).catch(()=>{})),t(null),r("")}function ge(){t(null),r("")}function we(re,ve){t(re),r(ve)}const Ce=k.useCallback((re,ve)=>{re.stopPropagation(),j(ve)},[]),ze=k.useCallback(async re=>{try{vg(re),await Ne.deleteSession(re)}catch{}Y.getState().currentSessionId===re&&Um(),A(re)},[A]),Ee=k.useCallback(()=>{_&&(ze(_),j(null))},[_,ze]),Pe=k.useCallback(()=>{j(null)},[]),et=k.useCallback(()=>{w(!0)},[]),Et=k.useCallback(async()=>{w(!1);const re=Y.getState(),ve=new Set;for(const Xe of re.sessions.keys())ve.add(Xe);for(const Xe of re.sdkSessions)ve.add(Xe.sessionId);const ye=Array.from(ve).filter(Xe=>{const Ht=re.sdkSessions.find(fn=>fn.sessionId===Xe);return(Ht==null?void 0:Ht.archived)??!1});for(const Xe of ye)await ze(Xe)},[ze]),mt=k.useCallback(()=>{w(!1)},[]);k.useEffect(()=>{if(!_&&!N)return;requestAnimationFrame(()=>{var ve,ye;(ye=(ve=L.current)==null?void 0:ve.querySelector("button"))==null||ye.focus()});function re(ve){var fn;if(ve.key==="Escape"){N?mt():Pe();return}if(ve.key!=="Tab")return;const ye=(fn=L.current)==null?void 0:fn.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(!ye||ye.length===0)return;const Xe=ye[0],Ht=ye[ye.length-1];ve.shiftKey&&document.activeElement===Xe?(ve.preventDefault(),Ht.focus()):!ve.shiftKey&&document.activeElement===Ht&&(ve.preventDefault(),Xe.focus())}return document.addEventListener("keydown",re),()=>document.removeEventListener("keydown",re)},[_,N,Pe,mt]);const yt=k.useCallback(async(re,ve)=>{re.stopPropagation();const ye=q.find(Gn=>Gn.sessionId===ve),Xe=O.get(ve),Ht=(Xe==null?void 0:Xe.is_containerized)||!!(ye!=null&&ye.containerId)||!1,fn=$.get(ve),Pn=((fn==null?void 0:fn.stateType)||"").toLowerCase();if(fn&&!(Pn==="completed"||Pn==="canceled"||Pn==="cancelled"))try{const Gn=await Ne.getArchiveInfo(ve);if(Gn.issueNotDone){p(ve),x(Gn),y(Ht);return}}catch{}if(Ht){h(ve);return}_t(ve)},[q,O,$]),_t=k.useCallback(async(re,ve,ye)=>{try{vg(re);const Xe={};ve&&(Xe.force=!0),ye&&ye!=="none"&&(Xe.linearTransition=ye),await Ne.archiveSession(re,Object.keys(Xe).length>0?Xe:void 0)}catch{}Y.getState().currentSessionId===re&&(Um(),Y.getState().newSession());try{const Xe=await Ne.listSessions();Y.getState().setSdkSessions(Xe)}catch{}},[]),Lt=k.useCallback(()=>{u&&(_t(u,!0),h(null))},[u,_t]),Gt=k.useCallback(()=>{h(null)},[]),_e=k.useCallback((re,ve)=>{f&&(_t(f,ve,re),p(null),x(null))},[f,_t]),Ve=k.useCallback(()=>{p(null),x(null)},[]),dt=k.useCallback(async(re,ve)=>{re.stopPropagation();try{await Ne.unarchiveSession(ve)}catch{}try{const ye=await Ne.listSessions();Y.getState().setSdkSessions(ye)}catch{}},[]),_n=new Set;for(const re of O.keys())_n.add(re);for(const re of q)_n.add(re.sessionId);const je=Array.from(_n).map(re=>{var Xe;const ve=O.get(re),ye=q.find(Ht=>Ht.sessionId===re);return{id:re,model:(ve==null?void 0:ve.model)||(ye==null?void 0:ye.model)||"",cwd:(ve==null?void 0:ve.cwd)||(ye==null?void 0:ye.cwd)||"",gitBranch:(ve==null?void 0:ve.git_branch)||(ye==null?void 0:ye.gitBranch)||"",isContainerized:(ve==null?void 0:ve.is_containerized)||!!(ye!=null&&ye.containerId)||!1,gitAhead:(ve==null?void 0:ve.git_ahead)||(ye==null?void 0:ye.gitAhead)||0,gitBehind:(ve==null?void 0:ve.git_behind)||(ye==null?void 0:ye.gitBehind)||0,linesAdded:(ve==null?void 0:ve.total_lines_added)||(ye==null?void 0:ye.totalLinesAdded)||0,linesRemoved:(ve==null?void 0:ve.total_lines_removed)||(ye==null?void 0:ye.totalLinesRemoved)||0,isConnected:W.get(re)??!1,isReconnecting:z.get(re)??!1,status:I.get(re)??null,sdkState:(ye==null?void 0:ye.state)??null,createdAt:(ye==null?void 0:ye.createdAt)??0,archived:(ye==null?void 0:ye.archived)??!1,backendType:(ve==null?void 0:ve.backend_type)||(ye==null?void 0:ye.backendType)||"claude",repoRoot:(ve==null?void 0:ve.repo_root)||"",permCount:((Xe=B.get(re))==null?void 0:Xe.size)??0,cronJobId:(ve==null?void 0:ve.cronJobId)||(ye==null?void 0:ye.cronJobId),cronJobName:(ve==null?void 0:ve.cronJobName)||(ye==null?void 0:ye.cronJobName),agentId:(ve==null?void 0:ve.agentId)||(ye==null?void 0:ye.agentId),agentName:(ve==null?void 0:ve.agentName)||(ye==null?void 0:ye.agentName),userName:ye==null?void 0:ye.userName}}).sort((re,ve)=>ve.createdAt-re.createdAt),Oe=k.useMemo(()=>Array.from(new Set(je.map(re=>re.userName).filter(re=>!!re))).sort(),[je]),[xt,Ae]=k.useState("__all__"),Qr=re=>xt==="__all__"?!0:xt==="__none__"?!re.userName:re.userName===xt,oe=je.some(re=>!re.userName),Se=je.filter(Qr),Q=Se.filter(re=>!re.archived&&!re.cronJobId&&!re.agentId),xe=Se.filter(re=>!re.archived&&!!re.cronJobId),Le=Se.filter(re=>!re.archived&&!!re.agentId),Qe=Se.filter(re=>re.archived),rt=F?je.find(re=>re.id===F):null,st=(rt==null?void 0:rt.backendType)==="codex"?"/logo-codex.svg":"/logo.svg",[Ct,wn]=k.useState(!0),[tt,hr]=k.useState(!0),Bn=k.useMemo(()=>I6(Q),[Q]),os={onSelect:P,onStartRename:we,onArchive:yt,onUnarchive:dt,onDelete:Ce,onClearRecentlyRenamed:G,editingSessionId:e,editingName:n,setEditingName:r,onConfirmRename:M,onCancelRename:ge,editInputRef:R};return l.jsxs("aside",{"aria-label":"Session sidebar",className:"w-full md:w-[260px] h-full flex flex-col bg-cc-sidebar",children:[l.jsx("div",{className:"p-3.5 pb-2",children:l.jsxs("div",{className:"flex items-center gap-2.5",children:[l.jsx("img",{src:st,alt:"",className:"w-6 h-6"}),l.jsx("span",{className:"text-[13px] font-semibold text-cc-fg tracking-tight",children:"The Companion"}),l.jsx("span",{className:"text-[9px] font-medium uppercase tracking-[0.14em] rounded-full px-1.5 py-0.5 bg-cc-primary/10 text-cc-primary border border-cc-primary/20 leading-none","aria-label":"Moritz Edition fork",title:"Moritz Edition fork of the-companion",children:"ME"}),l.jsx("button",{onClick:J,title:"New Session","aria-label":"New Session",className:"ml-auto hidden md:flex w-8 h-8 rounded-lg bg-cc-primary hover:bg-cc-primary-hover text-white items-center justify-center transition-colors duration-150 cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M8 3v10M3 8h10"})})}),l.jsx("button",{onClick:()=>Y.getState().setSidebarOpen(!1),"aria-label":"Close sidebar",className:"md:hidden ml-auto w-8 h-8 rounded-lg flex items-center justify-center text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4",children:l.jsx("path",{d:"M3.72 3.72a.75.75 0 011.06 0L8 6.94l3.22-3.22a.75.75 0 111.06 1.06L9.06 8l3.22 3.22a.75.75 0 11-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 01-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 010-1.06z"})})})]})}),Oe.length>0&&l.jsxs("div",{className:"px-3.5 pb-2",children:[l.jsx("label",{className:"sr-only",htmlFor:"sidebar-user-filter",children:"Filter sessions by user"}),l.jsxs("select",{id:"sidebar-user-filter",value:xt,onChange:re=>Ae(re.target.value),"aria-label":"Filter sessions by user",className:"w-full px-2 py-1.5 text-[12px] bg-cc-card border border-cc-border rounded-lg text-cc-fg focus:outline-none focus:border-cc-primary cursor-pointer",children:[l.jsx("option",{value:"__all__",children:"All users"}),Oe.map(re=>l.jsx("option",{value:re,children:re},re)),oe&&l.jsx("option",{value:"__none__",children:"No user data"})]})]}),u&&l.jsx("div",{className:"mx-2 mb-1 p-2.5 rounded-[10px] bg-cc-warning/10 border border-cc-warning/20",children:l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-cc-warning shrink-0 mt-0.5",children:l.jsx("path",{d:"M8.982 1.566a1.13 1.13 0 00-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 01-1.1 0L7.1 5.995A.905.905 0 018 5zm.002 6a1 1 0 110 2 1 1 0 010-2z"})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("p",{className:"text-[11px] text-cc-fg leading-snug",children:["Archiving will ",l.jsx("strong",{children:"remove the container"})," and any uncommitted changes."]}),l.jsxs("div",{className:"flex gap-2 mt-2",children:[l.jsx("button",{onClick:Gt,className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),l.jsx("button",{onClick:Lt,className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-error/10 text-cc-error hover:bg-cc-error/20 transition-colors cursor-pointer",children:"Archive"})]})]})]})}),l.jsx("div",{className:"flex-1 overflow-y-auto px-2.5 pb-2",children:Q.length===0&&xe.length===0&&Qe.length===0?l.jsx("p",{className:"px-3 py-8 text-xs text-cc-muted text-center leading-relaxed",children:"No sessions yet."}):l.jsxs(l.Fragment,{children:[Bn.map((re,ve)=>l.jsx($6,{group:re,isCollapsed:se.has(re.key),onToggleCollapse:ae,currentSessionId:F,sessionNames:X,pendingPermissions:B,recentlyRenamed:Z,isFirst:ve===0,...os},re.key)),xe.length>0&&l.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[l.jsxs("button",{onClick:()=>wn(!Ct),"aria-expanded":Ct,className:"w-full px-2 py-1 text-[11px] font-semibold text-cc-fg/60 uppercase tracking-wide flex items-center gap-1.5 hover:bg-cc-hover rounded-md transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${Ct?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),"Scheduled Runs (",xe.length,")"]}),Ct&&l.jsx("div",{className:"mt-0.5",children:xe.map(re=>{var ve;return l.jsx(eh,{session:re,isActive:F===re.id,sessionName:X.get(re.id),permCount:((ve=B.get(re.id))==null?void 0:ve.size)??0,isRecentlyRenamed:Z.has(re.id),...os},re.id)})})]}),Le.length>0&&l.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[l.jsxs("button",{onClick:()=>hr(!tt),"aria-expanded":tt,className:"w-full px-2 py-1 text-[11px] font-semibold text-cc-fg/60 uppercase tracking-wide flex items-center gap-1.5 hover:bg-cc-hover rounded-md transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${tt?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),"Agent Runs (",Le.length,")"]}),tt&&l.jsx("div",{className:"mt-0.5",children:Le.map(re=>{var ve;return l.jsx(eh,{session:re,isActive:F===re.id,sessionName:X.get(re.id),permCount:((ve=B.get(re.id))==null?void 0:ve.size)??0,isRecentlyRenamed:Z.has(re.id),...os},re.id)})})]}),Qe.length>0&&l.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[l.jsxs("div",{className:"flex items-center",children:[l.jsxs("button",{onClick:()=>o(!a),"aria-expanded":a,className:"flex-1 px-2 py-1 text-[11px] font-semibold text-cc-fg/60 uppercase tracking-wide flex items-center gap-1.5 hover:bg-cc-hover rounded-md transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${a?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),"Archived (",Qe.length,")"]}),a&&Qe.length>1&&l.jsx("button",{onClick:et,className:"px-2 py-0.5 mr-1 text-[10px] text-cc-error/80 hover:text-cc-error hover:bg-cc-error/5 rounded-md transition-colors cursor-pointer",title:"Delete all archived sessions",children:"Delete all"})]}),a&&l.jsx("div",{className:"mt-0.5",children:Qe.map(re=>{var ve;return l.jsx(eh,{session:re,isActive:F===re.id,isArchived:!0,sessionName:X.get(re.id),permCount:((ve=B.get(re.id))==null?void 0:ve.size)??0,isRecentlyRenamed:Z.has(re.id),...os},re.id)})})]})]})}),l.jsx("div",{className:"md:hidden flex justify-end px-4 pb-2",children:l.jsx("button",{onClick:J,title:"New Session","aria-label":"New Session",className:"w-12 h-12 rounded-full bg-cc-primary hover:bg-cc-primary-hover text-white flex items-center justify-center shadow-lg transition-colors duration-150 cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-5 h-5",children:l.jsx("path",{d:"M8 3v10M3 8h10"})})})}),l.jsxs("div",{className:"px-2 py-1.5 pb-safe bg-cc-sidebar-footer border-t border-cc-border/30",children:[l.jsx("nav",{className:"flex flex-col gap-1.5","aria-label":"Navigation",children:V6.map(re=>l.jsxs("section",{className:"rounded-lg border border-cc-border/30 bg-cc-card/20 p-0.5",children:[l.jsx("span",{className:"px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.14em] text-cc-muted/75 block",children:re.label}),l.jsx("div",{className:"flex flex-col",children:re.itemIds.map(ve=>{const ye=G6.get(ve);if(!ye)return null;const Xe=ye.activePages?ye.activePages.some(Ht=>D.page===Ht):D.page===ye.id;return l.jsxs("button",{onClick:()=>{window.location.hash=ye.hash,window.innerWidth<768&&Y.getState().setSidebarOpen(!1)},title:ye.label,"aria-current":Xe?"page":void 0,className:`group flex min-h-[44px] md:min-h-[34px] w-full items-center gap-2 rounded-md px-2 py-1 md:py-0.5 text-left transition-colors duration-150 cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cc-primary/60 ${Xe?"bg-cc-active text-cc-fg":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,children:[l.jsx("span",{"aria-hidden":!0,className:`h-4 w-0.5 shrink-0 rounded-full transition-colors ${Xe?"bg-cc-primary":"bg-transparent group-hover:bg-cc-border"}`}),l.jsx("svg",{viewBox:ye.viewBox,fill:"currentColor",className:"w-3.5 h-3.5 shrink-0",children:l.jsx("path",{d:ye.iconPath,fillRule:ye.fillRule,clipRule:ye.clipRule})}),l.jsx("span",{className:"min-w-0 flex-1 text-[12px] font-medium leading-tight",children:ye.label})]},ye.id)})})]},re.id))}),l.jsx("div",{className:"mt-1.5 rounded-lg border border-cc-border/30 bg-cc-card/20 px-1.5 py-0.5",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"px-1 text-[10px] font-semibold uppercase tracking-[0.14em] text-cc-muted/75",children:"Resources"}),l.jsx("div",{className:"flex items-center gap-0.5",children:H6.map(re=>l.jsx("a",{href:re.url,target:"_blank",rel:"noopener noreferrer",title:re.label,"aria-label":`Open ${re.label.toLowerCase()}`,className:"w-9 h-9 md:w-7 md:h-7 rounded-md flex items-center justify-center text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors",children:l.jsx("svg",{viewBox:re.viewBox,fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:re.iconPath})})},re.label))})]})})]}),(_||N)&&l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm animate-[fadeIn_150ms_ease-out]",onClick:N?mt:Pe,children:l.jsxs("div",{ref:L,role:"alertdialog","aria-modal":"true","aria-labelledby":"delete-dialog-title","aria-describedby":"delete-dialog-desc",className:"mx-4 w-full max-w-[280px] bg-cc-card border border-cc-border rounded-xl shadow-2xl p-5 animate-[menu-appear_150ms_ease-out]",onClick:re=>re.stopPropagation(),children:[l.jsx("div",{className:"flex justify-center mb-3",children:l.jsx("div",{className:"w-10 h-10 rounded-full bg-cc-error/10 flex items-center justify-center",children:l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-5 h-5 text-cc-error",children:[l.jsx("path",{d:"M5.5 5.5A.5.5 0 016 6v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm2.5 0a.5.5 0 01.5.5v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm3 .5a.5.5 0 00-1 0v6a.5.5 0 001 0V6z"}),l.jsx("path",{fillRule:"evenodd",d:"M14.5 3a1 1 0 01-1 1H13v9a2 2 0 01-2 2H5a2 2 0 01-2-2V4h-.5a1 1 0 010-2H6a1 1 0 011-1h2a1 1 0 011 1h3.5a1 1 0 011 1zM4.118 4L4 4.059V13a1 1 0 001 1h6a1 1 0 001-1V4.059L11.882 4H4.118zM6 2h4v1H6V2z",clipRule:"evenodd"})]})})}),l.jsx("p",{id:"delete-dialog-title",className:"text-[13px] font-semibold text-cc-fg text-center",children:N?"Delete all archived?":"Delete session?"}),l.jsx("p",{id:"delete-dialog-desc",className:"text-[12px] text-cc-muted text-center mt-1.5 leading-relaxed",children:N?`This will permanently delete ${Qe.length} archived session${Qe.length===1?"":"s"}. This cannot be undone.`:"This will permanently delete this session and its history. This cannot be undone."}),l.jsxs("div",{className:"flex gap-2.5 mt-4",children:[l.jsx("button",{onClick:N?mt:Pe,className:"flex-1 px-3 py-2 text-[12px] font-medium rounded-lg bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),l.jsx("button",{onClick:N?Et:Ee,className:"flex-1 px-3 py-2 text-[12px] font-medium rounded-lg bg-cc-error/15 text-cc-error hover:bg-cc-error/25 transition-colors cursor-pointer",children:N?"Delete all":"Delete"})]})]})}),f&&m&&l.jsx(z6,{issueIdentifier:((Xr=m.issue)==null?void 0:Xr.identifier)||"",issueStateName:((Kr=m.issue)==null?void 0:Kr.stateName)||"",isContainerized:b,archiveTransitionConfigured:m.archiveTransitionConfigured||!1,archiveTransitionStateName:m.archiveTransitionStateName,hasBacklogState:m.hasBacklogState||!1,onConfirm:_e,onCancel:Ve})]})}function W6(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Q6=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,X6=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,K6={};function W_(e,t){return(K6.jsx?X6:Q6).test(e)}const Z6=/[ \t\n\f\r]/g;function J6(e){return typeof e=="object"?e.type==="text"?Q_(e.value):!1:Q_(e)}function Q_(e){return e.replace(Z6,"")===""}class tu{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}tu.prototype.normal={};tu.prototype.property={};tu.prototype.space=void 0;function pS(e,t){const n={},r={};for(const a of e)Object.assign(n,a.property),Object.assign(r,a.normal);return new tu(n,r,t)}function ox(e){return e.toLowerCase()}class dr{constructor(t,n){this.attribute=n,this.property=t}}dr.prototype.attribute="";dr.prototype.booleanish=!1;dr.prototype.boolean=!1;dr.prototype.commaOrSpaceSeparated=!1;dr.prototype.commaSeparated=!1;dr.prototype.defined=!1;dr.prototype.mustUseProperty=!1;dr.prototype.number=!1;dr.prototype.overloadedBoolean=!1;dr.prototype.property="";dr.prototype.spaceSeparated=!1;dr.prototype.space=void 0;let eA=0;const Ye=Ba(),bn=Ba(),cx=Ba(),ke=Ba(),Ut=Ba(),La=Ba(),_r=Ba();function Ba(){return 2**++eA}const ux=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ye,booleanish:bn,commaOrSpaceSeparated:_r,commaSeparated:La,number:ke,overloadedBoolean:cx,spaceSeparated:Ut},Symbol.toStringTag,{value:"Module"})),Im=Object.keys(ux);class Gx extends dr{constructor(t,n,r,a){let o=-1;if(super(t,n),X_(this,"space",a),typeof r=="number")for(;++o<Im.length;){const u=Im[o];X_(this,Im[o],(r&ux[u])===ux[u])}}}Gx.prototype.defined=!0;function X_(e,t,n){n&&(e[t]=n)}function io(e){const t={},n={};for(const[r,a]of Object.entries(e.properties)){const o=new Gx(r,e.transform(e.attributes||{},r),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[ox(r)]=r,n[ox(o.attribute)]=r}return new tu(t,n,e.space)}const mS=io({properties:{ariaActiveDescendant:null,ariaAtomic:bn,ariaAutoComplete:null,ariaBusy:bn,ariaChecked:bn,ariaColCount:ke,ariaColIndex:ke,ariaColSpan:ke,ariaControls:Ut,ariaCurrent:null,ariaDescribedBy:Ut,ariaDetails:null,ariaDisabled:bn,ariaDropEffect:Ut,ariaErrorMessage:null,ariaExpanded:bn,ariaFlowTo:Ut,ariaGrabbed:bn,ariaHasPopup:null,ariaHidden:bn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ut,ariaLevel:ke,ariaLive:null,ariaModal:bn,ariaMultiLine:bn,ariaMultiSelectable:bn,ariaOrientation:null,ariaOwns:Ut,ariaPlaceholder:null,ariaPosInSet:ke,ariaPressed:bn,ariaReadOnly:bn,ariaRelevant:null,ariaRequired:bn,ariaRoleDescription:Ut,ariaRowCount:ke,ariaRowIndex:ke,ariaRowSpan:ke,ariaSelected:bn,ariaSetSize:ke,ariaSort:null,ariaValueMax:ke,ariaValueMin:ke,ariaValueNow:ke,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function gS(e,t){return t in e?e[t]:t}function xS(e,t){return gS(e,t.toLowerCase())}const tA=io({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:La,acceptCharset:Ut,accessKey:Ut,action:null,allow:null,allowFullScreen:Ye,allowPaymentRequest:Ye,allowUserMedia:Ye,alpha:Ye,alt:null,as:null,async:Ye,autoCapitalize:null,autoComplete:Ut,autoFocus:Ye,autoPlay:Ye,blocking:Ut,capture:null,charSet:null,checked:Ye,cite:null,className:Ut,closedBy:null,colorSpace:null,cols:ke,colSpan:ke,command:null,commandFor:null,content:null,contentEditable:bn,controls:Ye,controlsList:Ut,coords:ke|La,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ye,defer:Ye,dir:null,dirName:null,disabled:Ye,download:cx,draggable:bn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ye,formTarget:null,headers:Ut,height:ke,hidden:cx,high:ke,href:null,hrefLang:null,htmlFor:Ut,httpEquiv:Ut,id:null,imageSizes:null,imageSrcSet:null,inert:Ye,inputMode:null,integrity:null,is:null,isMap:Ye,itemId:null,itemProp:Ut,itemRef:Ut,itemScope:Ye,itemType:Ut,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ye,low:ke,manifest:null,max:null,maxLength:ke,media:null,method:null,min:null,minLength:ke,multiple:Ye,muted:Ye,name:null,nonce:null,noModule:Ye,noValidate:Ye,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Ye,optimum:ke,pattern:null,ping:Ut,placeholder:null,playsInline:Ye,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ye,referrerPolicy:null,rel:Ut,required:Ye,reversed:Ye,rows:ke,rowSpan:ke,sandbox:Ut,scope:null,scoped:Ye,seamless:Ye,selected:Ye,shadowRootClonable:Ye,shadowRootCustomElementRegistry:Ye,shadowRootDelegatesFocus:Ye,shadowRootMode:null,shadowRootSerializable:Ye,shape:null,size:ke,sizes:null,slot:null,span:ke,spellCheck:bn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ke,step:null,style:null,tabIndex:ke,target:null,title:null,translate:null,type:null,typeMustMatch:Ye,useMap:null,value:bn,width:ke,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ut,axis:null,background:null,bgColor:null,border:ke,borderColor:null,bottomMargin:ke,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ye,declare:Ye,event:null,face:null,frame:null,frameBorder:null,hSpace:ke,leftMargin:ke,link:null,longDesc:null,lowSrc:null,marginHeight:ke,marginWidth:ke,noResize:Ye,noHref:Ye,noShade:Ye,noWrap:Ye,object:null,profile:null,prompt:null,rev:null,rightMargin:ke,rules:null,scheme:null,scrolling:bn,standby:null,summary:null,text:null,topMargin:ke,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ke,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Ye,disablePictureInPicture:Ye,disableRemotePlayback:Ye,exportParts:La,part:Ut,prefix:null,property:null,results:ke,security:null,unselectable:null},space:"html",transform:xS}),nA=io({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:_r,accentHeight:ke,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ke,amplitude:ke,arabicForm:null,ascent:ke,attributeName:null,attributeType:null,azimuth:ke,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ke,by:null,calcMode:null,capHeight:ke,className:Ut,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ke,diffuseConstant:ke,direction:null,display:null,dur:null,divisor:ke,dominantBaseline:null,download:Ye,dx:null,dy:null,edgeMode:null,editable:null,elevation:ke,enableBackground:null,end:null,event:null,exponent:ke,externalResourcesRequired:null,fill:null,fillOpacity:ke,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:La,g2:La,glyphName:La,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ke,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ke,horizOriginX:ke,horizOriginY:ke,id:null,ideographic:ke,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ke,k:ke,k1:ke,k2:ke,k3:ke,k4:ke,kernelMatrix:_r,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ke,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ke,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ke,overlineThickness:ke,paintOrder:null,panose1:null,path:null,pathLength:ke,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ut,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ke,pointsAtY:ke,pointsAtZ:ke,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:_r,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:_r,rev:_r,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:_r,requiredFeatures:_r,requiredFonts:_r,requiredFormats:_r,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ke,specularExponent:ke,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ke,strikethroughThickness:ke,string:null,stroke:null,strokeDashArray:_r,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ke,strokeOpacity:ke,strokeWidth:null,style:null,surfaceScale:ke,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:_r,tabIndex:ke,tableValues:null,target:null,targetX:ke,targetY:ke,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:_r,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ke,underlineThickness:ke,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ke,values:null,vAlphabetic:ke,vMathematical:ke,vectorEffect:null,vHanging:ke,vIdeographic:ke,version:null,vertAdvY:ke,vertOriginX:ke,vertOriginY:ke,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ke,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:gS}),vS=io({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()}}),bS=io({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:xS}),yS=io({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),rA={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"},sA=/[A-Z]/g,K_=/-[a-z]/g,iA=/^data[-\w.:]+$/i;function aA(e,t){const n=ox(t);let r=t,a=dr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&iA.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(K_,oA);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!K_.test(o)){let u=o.replace(sA,lA);u.charAt(0)!=="-"&&(u="-"+u),t="data"+u}}a=Gx}return new a(r,t)}function lA(e){return"-"+e.toLowerCase()}function oA(e){return e.charAt(1).toUpperCase()}const cA=pS([mS,tA,vS,bS,yS],"html"),Yx=pS([mS,nA,vS,bS,yS],"svg");function uA(e){return e.join(" ").trim()}var Ll={},Hm,Z_;function dA(){if(Z_)return Hm;Z_=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,h=/^\s+|\s+$/g,f=`
72
+ `,p="/",m="*",x="",b="comment",y="declaration";function _(N,w){if(typeof N!="string")throw new TypeError("First argument must be a string");if(!N)return[];w=w||{};var C=1,E=1;function R(Z){var G=Z.match(t);G&&(C+=G.length);var B=Z.lastIndexOf(f);E=~B?Z.length-B:E+Z.length}function L(){var Z={line:C,column:E};return function(G){return G.position=new O(Z),W(),G}}function O(Z){this.start=Z,this.end={line:C,column:E},this.source=w.source}O.prototype.content=N;function q(Z){var G=new Error(w.source+":"+C+":"+E+": "+Z);if(G.reason=Z,G.filename=w.source,G.line=C,G.column=E,G.source=N,!w.silent)throw G}function F(Z){var G=Z.exec(N);if(G){var B=G[0];return R(B),N=N.slice(B.length),G}}function W(){F(n)}function z(Z){var G;for(Z=Z||[];G=I();)G!==!1&&Z.push(G);return Z}function I(){var Z=L();if(!(p!=N.charAt(0)||m!=N.charAt(1))){for(var G=2;x!=N.charAt(G)&&(m!=N.charAt(G)||p!=N.charAt(G+1));)++G;if(G+=2,x===N.charAt(G-1))return q("End of comment missing");var B=N.slice(2,G-2);return E+=2,R(B),N=N.slice(G),E+=2,Z({type:b,comment:B})}}function A(){var Z=L(),G=F(r);if(G){if(I(),!F(a))return q("property missing ':'");var B=F(o),$=Z({type:y,property:j(G[0].replace(e,x)),value:B?j(B[0].replace(e,x)):x});return F(u),$}}function X(){var Z=[];z(Z);for(var G;G=A();)G!==!1&&(Z.push(G),z(Z));return Z}return W(),X()}function j(N){return N?N.replace(h,x):x}return Hm=_,Hm}var J_;function hA(){if(J_)return Ll;J_=1;var e=Ll&&Ll.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ll,"__esModule",{value:!0}),Ll.default=n;const t=e(dA());function n(r,a){let o=null;if(!r||typeof r!="string")return o;const u=(0,t.default)(r),h=typeof a=="function";return u.forEach(f=>{if(f.type!=="declaration")return;const{property:p,value:m}=f;h?a(p,m,f):m&&(o=o||{},o[p]=m)}),o}return Ll}var mc={},e5;function fA(){if(e5)return mc;e5=1,Object.defineProperty(mc,"__esModule",{value:!0}),mc.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(p){return!p||n.test(p)||e.test(p)},u=function(p,m){return m.toUpperCase()},h=function(p,m){return"".concat(m,"-")},f=function(p,m){return m===void 0&&(m={}),o(p)?p:(p=p.toLowerCase(),m.reactCompat?p=p.replace(a,h):p=p.replace(r,h),p.replace(t,u))};return mc.camelCase=f,mc}var gc,t5;function pA(){if(t5)return gc;t5=1;var e=gc&&gc.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(hA()),n=fA();function r(a,o){var u={};return!a||typeof a!="string"||(0,t.default)(a,function(h,f){h&&f&&(u[(0,n.camelCase)(h,o)]=f)}),u}return r.default=r,gc=r,gc}var mA=pA();const gA=wx(mA),_S=wS("end"),Wx=wS("start");function wS(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function xA(e){const t=Wx(e),n=_S(e);if(t&&n)return{start:t,end:n}}function Rc(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?n5(e.position):"start"in e||"end"in e?n5(e):"line"in e||"column"in e?dx(e):""}function dx(e){return r5(e&&e.line)+":"+r5(e&&e.column)}function n5(e){return dx(e&&e.start)+"-"+dx(e&&e.end)}function r5(e){return e&&typeof e=="number"?e:1}class Vn extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let a="",o={},u=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?a=t:!o.cause&&t&&(u=!0,a=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof r=="string"){const f=r.indexOf(":");f===-1?o.ruleId=r:(o.source=r.slice(0,f),o.ruleId=r.slice(f+1))}if(!o.place&&o.ancestors&&o.ancestors){const f=o.ancestors[o.ancestors.length-1];f&&(o.place=f.position)}const h=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=h?h.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=h?h.line:void 0,this.name=Rc(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=u&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Vn.prototype.file="";Vn.prototype.name="";Vn.prototype.reason="";Vn.prototype.message="";Vn.prototype.stack="";Vn.prototype.column=void 0;Vn.prototype.line=void 0;Vn.prototype.ancestors=void 0;Vn.prototype.cause=void 0;Vn.prototype.fatal=void 0;Vn.prototype.place=void 0;Vn.prototype.ruleId=void 0;Vn.prototype.source=void 0;const Qx={}.hasOwnProperty,vA=new Map,bA=/[A-Z]/g,yA=new Set(["table","tbody","thead","tfoot","tr"]),_A=new Set(["td","th"]),SS="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function wA(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=TA(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=AA(n,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Yx:cA,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=kS(a,e,void 0);return o&&typeof o!="string"?o:a.create(e,a.Fragment,{children:o||void 0},void 0)}function kS(e,t,n){if(t.type==="element")return SA(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return kA(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return NA(e,t,n);if(t.type==="mdxjsEsm")return jA(e,t);if(t.type==="root")return CA(e,t,n);if(t.type==="text")return EA(e,t)}function SA(e,t,n){const r=e.schema;let a=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(a=Yx,e.schema=a),e.ancestors.push(t);const o=NS(e,t.tagName,!1),u=MA(e,t);let h=Kx(e,t);return yA.has(t.tagName)&&(h=h.filter(function(f){return typeof f=="string"?!J6(f):!0})),jS(e,u,o,t),Xx(u,h),e.ancestors.pop(),e.schema=r,e.create(t,o,u,n)}function kA(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Qc(e,t.position)}function jA(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Qc(e,t.position)}function NA(e,t,n){const r=e.schema;let a=r;t.name==="svg"&&r.space==="html"&&(a=Yx,e.schema=a),e.ancestors.push(t);const o=t.name===null?e.Fragment:NS(e,t.name,!0),u=DA(e,t),h=Kx(e,t);return jS(e,u,o,t),Xx(u,h),e.ancestors.pop(),e.schema=r,e.create(t,o,u,n)}function CA(e,t,n){const r={};return Xx(r,Kx(e,t)),e.create(t,e.Fragment,r,n)}function EA(e,t){return t.value}function jS(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Xx(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function AA(e,t,n){return r;function r(a,o,u,h){const p=Array.isArray(u.children)?n:t;return h?p(o,u,h):p(o,u)}}function TA(e,t){return n;function n(r,a,o,u){const h=Array.isArray(o.children),f=Wx(r);return t(a,o,u,h,{columnNumber:f?f.column-1:void 0,fileName:e,lineNumber:f?f.line:void 0},void 0)}}function MA(e,t){const n={};let r,a;for(a in t.properties)if(a!=="children"&&Qx.call(t.properties,a)){const o=LA(e,a,t.properties[a]);if(o){const[u,h]=o;e.tableCellAlignToStyle&&u==="align"&&typeof h=="string"&&_A.has(t.tagName)?r=h:n[u]=h}}if(r){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function DA(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const o=r.data.estree.body[0];o.type;const u=o.expression;u.type;const h=u.properties[0];h.type,Object.assign(n,e.evaluater.evaluateExpression(h.argument))}else Qc(e,t.position);else{const a=r.name;let o;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const h=r.value.data.estree.body[0];h.type,o=e.evaluater.evaluateExpression(h.expression)}else Qc(e,t.position);else o=r.value===null?!0:r.value;n[a]=o}return n}function Kx(e,t){const n=[];let r=-1;const a=e.passKeys?new Map:vA;for(;++r<t.children.length;){const o=t.children[r];let u;if(e.passKeys){const f=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(f){const p=a.get(f)||0;u=f+"-"+p,a.set(f,p+1)}}const h=kS(e,o,u);h!==void 0&&n.push(h)}return n}function LA(e,t,n){const r=aA(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?W6(n):uA(n)),r.property==="style"){let a=typeof n=="object"?n:RA(e,String(n));return e.stylePropertyNameCase==="css"&&(a=zA(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&r.space?rA[r.property]||r.property:r.attribute,n]}}function RA(e,t){try{return gA(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,a=new Vn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=SS+"#cannot-parse-style-attribute",a}}function NS(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let o=-1,u;for(;++o<a.length;){const h=W_(a[o])?{type:"Identifier",name:a[o]}:{type:"Literal",value:a[o]};u=u?{type:"MemberExpression",object:u,property:h,computed:!!(o&&h.type==="Literal"),optional:!1}:h}r=u}else r=W_(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const a=r.value;return Qx.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(r);Qc(e)}function Qc(e,t){const n=new Vn("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=SS+"#cannot-handle-mdx-estrees-without-createevaluater",n}function zA(e){const t={};let n;for(n in e)Qx.call(e,n)&&(t[OA(n)]=e[n]);return t}function OA(e){let t=e.replace(bA,BA);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function BA(e){return"-"+e.toLowerCase()}const qm={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"]},PA={};function Zx(e,t){const n=PA,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return CS(e,r,a)}function CS(e,t,n){if($A(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 s5(e.children,t,n)}return Array.isArray(e)?s5(e,t,n):""}function s5(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=CS(e[a],t,n);return r.join("")}function $A(e){return!!(e&&typeof e=="object")}const i5=document.createElement("i");function Jx(e){const t="&"+e+";";i5.innerHTML=t;const n=i5.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Cr(e,t,n,r){const a=e.length;let o=0,u;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,r.length<1e4)u=Array.from(r),u.unshift(t,n),e.splice(...u);else for(n&&e.splice(t,n);o<r.length;)u=r.slice(o,o+1e4),u.unshift(t,0),e.splice(...u),o+=1e4,t+=1e4}function Yr(e,t){return e.length>0?(Cr(e,e.length,0,t),e):t}const a5={}.hasOwnProperty;function ES(e){const t={};let n=-1;for(;++n<e.length;)FA(t,e[n]);return t}function FA(e,t){let n;for(n in t){const a=(a5.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let u;if(o)for(u in o){a5.call(a,u)||(a[u]=[]);const h=o[u];UA(a[u],Array.isArray(h)?h:h?[h]:[])}}}function UA(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Cr(e,0,0,r)}function AS(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 ls(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Zn=Qi(/[A-Za-z]/),Hn=Qi(/[\dA-Za-z]/),IA=Qi(/[#-'*+\--9=?A-Z^-~]/);function Mh(e){return e!==null&&(e<32||e===127)}const hx=Qi(/\d/),HA=Qi(/[\dA-Fa-f]/),qA=Qi(/[!-/:-@[-`{-~]/);function Ue(e){return e!==null&&e<-2}function It(e){return e!==null&&(e<0||e===32)}function ut(e){return e===-2||e===-1||e===32}const qh=Qi(new RegExp("\\p{P}|\\p{S}","u")),Oa=Qi(/\s/);function Qi(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function ao(e){const t=[];let n=-1,r=0,a=0;for(;++n<e.length;){const o=e.charCodeAt(n);let u="";if(o===37&&Hn(e.charCodeAt(n+1))&&Hn(e.charCodeAt(n+2)))a=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(u=String.fromCharCode(o));else if(o>55295&&o<57344){const h=e.charCodeAt(n+1);o<56320&&h>56319&&h<57344?(u=String.fromCharCode(o,h),a=1):u="�"}else u=String.fromCharCode(o);u&&(t.push(e.slice(r,n),encodeURIComponent(u)),r=n+a+1,u=""),a&&(n+=a,a=0)}return t.join("")+e.slice(r)}function bt(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let o=0;return u;function u(f){return ut(f)?(e.enter(n),h(f)):t(f)}function h(f){return ut(f)&&o++<a?(e.consume(f),h):(e.exit(n),t(f))}}const VA={tokenize:GA};function GA(e){const t=e.attempt(this.parser.constructs.contentInitial,r,a);let n;return t;function r(h){if(h===null){e.consume(h);return}return e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),bt(e,t,"linePrefix")}function a(h){return e.enter("paragraph"),o(h)}function o(h){const f=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=f),n=f,u(h)}function u(h){if(h===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(h);return}return Ue(h)?(e.consume(h),e.exit("chunkText"),o):(e.consume(h),u)}}const YA={tokenize:WA},l5={tokenize:QA};function WA(e){const t=this,n=[];let r=0,a,o,u;return h;function h(E){if(r<n.length){const R=n[r];return t.containerState=R[1],e.attempt(R[0].continuation,f,p)(E)}return p(E)}function f(E){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&C();const R=t.events.length;let L=R,O;for(;L--;)if(t.events[L][0]==="exit"&&t.events[L][1].type==="chunkFlow"){O=t.events[L][1].end;break}w(r);let q=R;for(;q<t.events.length;)t.events[q][1].end={...O},q++;return Cr(t.events,L+1,0,t.events.slice(R)),t.events.length=q,p(E)}return h(E)}function p(E){if(r===n.length){if(!a)return b(E);if(a.currentConstruct&&a.currentConstruct.concrete)return _(E);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(l5,m,x)(E)}function m(E){return a&&C(),w(r),b(E)}function x(E){return t.parser.lazy[t.now().line]=r!==n.length,u=t.now().offset,_(E)}function b(E){return t.containerState={},e.attempt(l5,y,_)(E)}function y(E){return r++,n.push([t.currentConstruct,t.containerState]),b(E)}function _(E){if(E===null){a&&C(),w(0),e.consume(E);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:o}),j(E)}function j(E){if(E===null){N(e.exit("chunkFlow"),!0),w(0),e.consume(E);return}return Ue(E)?(e.consume(E),N(e.exit("chunkFlow")),r=0,t.interrupt=void 0,h):(e.consume(E),j)}function N(E,R){const L=t.sliceStream(E);if(R&&L.push(null),E.previous=o,o&&(o.next=E),o=E,a.defineSkip(E.start),a.write(L),t.parser.lazy[E.start.line]){let O=a.events.length;for(;O--;)if(a.events[O][1].start.offset<u&&(!a.events[O][1].end||a.events[O][1].end.offset>u))return;const q=t.events.length;let F=q,W,z;for(;F--;)if(t.events[F][0]==="exit"&&t.events[F][1].type==="chunkFlow"){if(W){z=t.events[F][1].end;break}W=!0}for(w(r),O=q;O<t.events.length;)t.events[O][1].end={...z},O++;Cr(t.events,F+1,0,t.events.slice(q)),t.events.length=O}}function w(E){let R=n.length;for(;R-- >E;){const L=n[R];t.containerState=L[1],L[0].exit.call(t,e)}n.length=E}function C(){a.write([null]),o=void 0,a=void 0,t.containerState._closeFlow=void 0}}function QA(e,t,n){return bt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function to(e){if(e===null||It(e)||Oa(e))return 1;if(qh(e))return 2}function Vh(e,t,n){const r=[];let a=-1;for(;++a<e.length;){const o=e[a].resolveAll;o&&!r.includes(o)&&(t=o(t,n),r.push(o))}return t}const fx={name:"attention",resolveAll:XA,tokenize:KA};function XA(e,t){let n=-1,r,a,o,u,h,f,p,m;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;f=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const x={...e[r][1].end},b={...e[n][1].start};o5(x,-f),o5(b,f),u={type:f>1?"strongSequence":"emphasisSequence",start:x,end:{...e[r][1].end}},h={type:f>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:b},o={type:f>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},a={type:f>1?"strong":"emphasis",start:{...u.start},end:{...h.end}},e[r][1].end={...u.start},e[n][1].start={...h.end},p=[],e[r][1].end.offset-e[r][1].start.offset&&(p=Yr(p,[["enter",e[r][1],t],["exit",e[r][1],t]])),p=Yr(p,[["enter",a,t],["enter",u,t],["exit",u,t],["enter",o,t]]),p=Yr(p,Vh(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),p=Yr(p,[["exit",o,t],["enter",h,t],["exit",h,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(m=2,p=Yr(p,[["enter",e[n][1],t],["exit",e[n][1],t]])):m=0,Cr(e,r-1,n-r+3,p),n=r+p.length-m-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function KA(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=to(r);let o;return u;function u(f){return o=f,e.enter("attentionSequence"),h(f)}function h(f){if(f===o)return e.consume(f),h;const p=e.exit("attentionSequence"),m=to(f),x=!m||m===2&&a||n.includes(f),b=!a||a===2&&m||n.includes(r);return p._open=!!(o===42?x:x&&(a||!b)),p._close=!!(o===42?b:b&&(m||!x)),t(f)}}function o5(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const ZA={name:"autolink",tokenize:JA};function JA(e,t,n){let r=0;return a;function a(y){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(y){return Zn(y)?(e.consume(y),u):y===64?n(y):p(y)}function u(y){return y===43||y===45||y===46||Hn(y)?(r=1,h(y)):p(y)}function h(y){return y===58?(e.consume(y),r=0,f):(y===43||y===45||y===46||Hn(y))&&r++<32?(e.consume(y),h):(r=0,p(y))}function f(y){return y===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):y===null||y===32||y===60||Mh(y)?n(y):(e.consume(y),f)}function p(y){return y===64?(e.consume(y),m):IA(y)?(e.consume(y),p):n(y)}function m(y){return Hn(y)?x(y):n(y)}function x(y){return y===46?(e.consume(y),r=0,m):y===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):b(y)}function b(y){if((y===45||Hn(y))&&r++<63){const _=y===45?b:x;return e.consume(y),_}return n(y)}}const nu={partial:!0,tokenize:eT};function eT(e,t,n){return r;function r(o){return ut(o)?bt(e,a,"linePrefix")(o):a(o)}function a(o){return o===null||Ue(o)?t(o):n(o)}}const TS={continuation:{tokenize:nT},exit:rT,name:"blockQuote",tokenize:tT};function tT(e,t,n){const r=this;return a;function a(u){if(u===62){const h=r.containerState;return h.open||(e.enter("blockQuote",{_container:!0}),h.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(u),e.exit("blockQuoteMarker"),o}return n(u)}function o(u){return ut(u)?(e.enter("blockQuotePrefixWhitespace"),e.consume(u),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(u))}}function nT(e,t,n){const r=this;return a;function a(u){return ut(u)?bt(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u):o(u)}function o(u){return e.attempt(TS,t,n)(u)}}function rT(e){e.exit("blockQuote")}const MS={name:"characterEscape",tokenize:sT};function sT(e,t,n){return r;function r(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),a}function a(o){return qA(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const DS={name:"characterReference",tokenize:iT};function iT(e,t,n){const r=this;let a=0,o,u;return h;function h(x){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(x),e.exit("characterReferenceMarker"),f}function f(x){return x===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(x),e.exit("characterReferenceMarkerNumeric"),p):(e.enter("characterReferenceValue"),o=31,u=Hn,m(x))}function p(x){return x===88||x===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(x),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,u=HA,m):(e.enter("characterReferenceValue"),o=7,u=hx,m(x))}function m(x){if(x===59&&a){const b=e.exit("characterReferenceValue");return u===Hn&&!Jx(r.sliceSerialize(b))?n(x):(e.enter("characterReferenceMarker"),e.consume(x),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return u(x)&&a++<o?(e.consume(x),m):n(x)}}const c5={partial:!0,tokenize:lT},u5={concrete:!0,name:"codeFenced",tokenize:aT};function aT(e,t,n){const r=this,a={partial:!0,tokenize:L};let o=0,u=0,h;return f;function f(O){return p(O)}function p(O){const q=r.events[r.events.length-1];return o=q&&q[1].type==="linePrefix"?q[2].sliceSerialize(q[1],!0).length:0,h=O,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),m(O)}function m(O){return O===h?(u++,e.consume(O),m):u<3?n(O):(e.exit("codeFencedFenceSequence"),ut(O)?bt(e,x,"whitespace")(O):x(O))}function x(O){return O===null||Ue(O)?(e.exit("codeFencedFence"),r.interrupt?t(O):e.check(c5,j,R)(O)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),b(O))}function b(O){return O===null||Ue(O)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),x(O)):ut(O)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),bt(e,y,"whitespace")(O)):O===96&&O===h?n(O):(e.consume(O),b)}function y(O){return O===null||Ue(O)?x(O):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),_(O))}function _(O){return O===null||Ue(O)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),x(O)):O===96&&O===h?n(O):(e.consume(O),_)}function j(O){return e.attempt(a,R,N)(O)}function N(O){return e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),w}function w(O){return o>0&&ut(O)?bt(e,C,"linePrefix",o+1)(O):C(O)}function C(O){return O===null||Ue(O)?e.check(c5,j,R)(O):(e.enter("codeFlowValue"),E(O))}function E(O){return O===null||Ue(O)?(e.exit("codeFlowValue"),C(O)):(e.consume(O),E)}function R(O){return e.exit("codeFenced"),t(O)}function L(O,q,F){let W=0;return z;function z(G){return O.enter("lineEnding"),O.consume(G),O.exit("lineEnding"),I}function I(G){return O.enter("codeFencedFence"),ut(G)?bt(O,A,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(G):A(G)}function A(G){return G===h?(O.enter("codeFencedFenceSequence"),X(G)):F(G)}function X(G){return G===h?(W++,O.consume(G),X):W>=u?(O.exit("codeFencedFenceSequence"),ut(G)?bt(O,Z,"whitespace")(G):Z(G)):F(G)}function Z(G){return G===null||Ue(G)?(O.exit("codeFencedFence"),q(G)):F(G)}}}function lT(e,t,n){const r=this;return a;function a(u){return u===null?n(u):(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),o)}function o(u){return r.parser.lazy[r.now().line]?n(u):t(u)}}const Vm={name:"codeIndented",tokenize:cT},oT={partial:!0,tokenize:uT};function cT(e,t,n){const r=this;return a;function a(p){return e.enter("codeIndented"),bt(e,o,"linePrefix",5)(p)}function o(p){const m=r.events[r.events.length-1];return m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?u(p):n(p)}function u(p){return p===null?f(p):Ue(p)?e.attempt(oT,u,f)(p):(e.enter("codeFlowValue"),h(p))}function h(p){return p===null||Ue(p)?(e.exit("codeFlowValue"),u(p)):(e.consume(p),h)}function f(p){return e.exit("codeIndented"),t(p)}}function uT(e,t,n){const r=this;return a;function a(u){return r.parser.lazy[r.now().line]?n(u):Ue(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),a):bt(e,o,"linePrefix",5)(u)}function o(u){const h=r.events[r.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?t(u):Ue(u)?a(u):n(u)}}const dT={name:"codeText",previous:fT,resolve:hT,tokenize:pT};function hT(e){let t=e.length-4,n=3,r,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)a===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(a=r):(r===t||e[r][1].type==="lineEnding")&&(e[a][1].type="codeTextData",r!==a+2&&(e[a][1].end=e[r-1][1].end,e.splice(a+2,r-a-2),t-=r-a-2,r=a+2),a=void 0);return e}function fT(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function pT(e,t,n){let r=0,a,o;return u;function u(x){return e.enter("codeText"),e.enter("codeTextSequence"),h(x)}function h(x){return x===96?(e.consume(x),r++,h):(e.exit("codeTextSequence"),f(x))}function f(x){return x===null?n(x):x===32?(e.enter("space"),e.consume(x),e.exit("space"),f):x===96?(o=e.enter("codeTextSequence"),a=0,m(x)):Ue(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),f):(e.enter("codeTextData"),p(x))}function p(x){return x===null||x===32||x===96||Ue(x)?(e.exit("codeTextData"),f(x)):(e.consume(x),p)}function m(x){return x===96?(e.consume(x),a++,m):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(x)):(o.type="codeTextData",p(x))}}class mT{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const a=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return r&&xc(this.left,r),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),xc(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),xc(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);xc(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);xc(this.left,n.reverse())}}}function xc(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 LS(e){const t={};let n=-1,r,a,o,u,h,f,p;const m=new mT(e);for(;++n<m.length;){for(;n in t;)n=t[n];if(r=m.get(n),n&&r[1].type==="chunkFlow"&&m.get(n-1)[1].type==="listItemPrefix"&&(f=r[1]._tokenizer.events,o=0,o<f.length&&f[o][1].type==="lineEndingBlank"&&(o+=2),o<f.length&&f[o][1].type==="content"))for(;++o<f.length&&f[o][1].type!=="content";)f[o][1].type==="chunkText"&&(f[o][1]._isInFirstContentOfListItem=!0,o++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,gT(m,n)),n=t[n],p=!0);else if(r[1]._container){for(o=n,a=void 0;o--;)if(u=m.get(o),u[1].type==="lineEnding"||u[1].type==="lineEndingBlank")u[0]==="enter"&&(a&&(m.get(a)[1].type="lineEndingBlank"),u[1].type="lineEnding",a=o);else if(!(u[1].type==="linePrefix"||u[1].type==="listItemIndent"))break;a&&(r[1].end={...m.get(a)[1].start},h=m.slice(a,n),h.unshift(r),m.splice(a,n-a+1,h))}}return Cr(e,0,Number.POSITIVE_INFINITY,m.slice(0)),!p}function gT(e,t){const n=e.get(t)[1],r=e.get(t)[2];let a=t-1;const o=[];let u=n._tokenizer;u||(u=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(u._contentTypeTextTrailing=!0));const h=u.events,f=[],p={};let m,x,b=-1,y=n,_=0,j=0;const N=[j];for(;y;){for(;e.get(++a)[1]!==y;);o.push(a),y._tokenizer||(m=r.sliceStream(y),y.next||m.push(null),x&&u.defineSkip(y.start),y._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=!0),u.write(m),y._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=void 0)),x=y,y=y.next}for(y=n;++b<h.length;)h[b][0]==="exit"&&h[b-1][0]==="enter"&&h[b][1].type===h[b-1][1].type&&h[b][1].start.line!==h[b][1].end.line&&(j=b+1,N.push(j),y._tokenizer=void 0,y.previous=void 0,y=y.next);for(u.events=[],y?(y._tokenizer=void 0,y.previous=void 0):N.pop(),b=N.length;b--;){const w=h.slice(N[b],N[b+1]),C=o.pop();f.push([C,C+w.length-1]),e.splice(C,2,w)}for(f.reverse(),b=-1;++b<f.length;)p[_+f[b][0]]=_+f[b][1],_+=f[b][1]-f[b][0]-1;return p}const xT={resolve:bT,tokenize:yT},vT={partial:!0,tokenize:_T};function bT(e){return LS(e),e}function yT(e,t){let n;return r;function r(h){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(h)}function a(h){return h===null?o(h):Ue(h)?e.check(vT,u,o)(h):(e.consume(h),a)}function o(h){return e.exit("chunkContent"),e.exit("content"),t(h)}function u(h){return e.consume(h),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function _T(e,t,n){const r=this;return a;function a(u){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),bt(e,o,"linePrefix")}function o(u){if(u===null||Ue(u))return n(u);const h=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?t(u):e.interrupt(r.parser.constructs.flow,n,t)(u)}}function RS(e,t,n,r,a,o,u,h,f){const p=f||Number.POSITIVE_INFINITY;let m=0;return x;function x(w){return w===60?(e.enter(r),e.enter(a),e.enter(o),e.consume(w),e.exit(o),b):w===null||w===32||w===41||Mh(w)?n(w):(e.enter(r),e.enter(u),e.enter(h),e.enter("chunkString",{contentType:"string"}),j(w))}function b(w){return w===62?(e.enter(o),e.consume(w),e.exit(o),e.exit(a),e.exit(r),t):(e.enter(h),e.enter("chunkString",{contentType:"string"}),y(w))}function y(w){return w===62?(e.exit("chunkString"),e.exit(h),b(w)):w===null||w===60||Ue(w)?n(w):(e.consume(w),w===92?_:y)}function _(w){return w===60||w===62||w===92?(e.consume(w),y):y(w)}function j(w){return!m&&(w===null||w===41||It(w))?(e.exit("chunkString"),e.exit(h),e.exit(u),e.exit(r),t(w)):m<p&&w===40?(e.consume(w),m++,j):w===41?(e.consume(w),m--,j):w===null||w===32||w===40||Mh(w)?n(w):(e.consume(w),w===92?N:j)}function N(w){return w===40||w===41||w===92?(e.consume(w),j):j(w)}}function zS(e,t,n,r,a,o){const u=this;let h=0,f;return p;function p(y){return e.enter(r),e.enter(a),e.consume(y),e.exit(a),e.enter(o),m}function m(y){return h>999||y===null||y===91||y===93&&!f||y===94&&!h&&"_hiddenFootnoteSupport"in u.parser.constructs?n(y):y===93?(e.exit(o),e.enter(a),e.consume(y),e.exit(a),e.exit(r),t):Ue(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),m):(e.enter("chunkString",{contentType:"string"}),x(y))}function x(y){return y===null||y===91||y===93||Ue(y)||h++>999?(e.exit("chunkString"),m(y)):(e.consume(y),f||(f=!ut(y)),y===92?b:x)}function b(y){return y===91||y===92||y===93?(e.consume(y),h++,x):x(y)}}function OS(e,t,n,r,a,o){let u;return h;function h(b){return b===34||b===39||b===40?(e.enter(r),e.enter(a),e.consume(b),e.exit(a),u=b===40?41:b,f):n(b)}function f(b){return b===u?(e.enter(a),e.consume(b),e.exit(a),e.exit(r),t):(e.enter(o),p(b))}function p(b){return b===u?(e.exit(o),f(u)):b===null?n(b):Ue(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),bt(e,p,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),m(b))}function m(b){return b===u||b===null||Ue(b)?(e.exit("chunkString"),p(b)):(e.consume(b),b===92?x:m)}function x(b){return b===u||b===92?(e.consume(b),m):m(b)}}function zc(e,t){let n;return r;function r(a){return Ue(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):ut(a)?bt(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const wT={name:"definition",tokenize:kT},ST={partial:!0,tokenize:jT};function kT(e,t,n){const r=this;let a;return o;function o(y){return e.enter("definition"),u(y)}function u(y){return zS.call(r,e,h,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function h(y){return a=ls(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),f):n(y)}function f(y){return It(y)?zc(e,p)(y):p(y)}function p(y){return RS(e,m,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function m(y){return e.attempt(ST,x,x)(y)}function x(y){return ut(y)?bt(e,b,"whitespace")(y):b(y)}function b(y){return y===null||Ue(y)?(e.exit("definition"),r.parser.defined.push(a),t(y)):n(y)}}function jT(e,t,n){return r;function r(h){return It(h)?zc(e,a)(h):n(h)}function a(h){return OS(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(h)}function o(h){return ut(h)?bt(e,u,"whitespace")(h):u(h)}function u(h){return h===null||Ue(h)?t(h):n(h)}}const NT={name:"hardBreakEscape",tokenize:CT};function CT(e,t,n){return r;function r(o){return e.enter("hardBreakEscape"),e.consume(o),a}function a(o){return Ue(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const ET={name:"headingAtx",resolve:AT,tokenize:TT};function AT(e,t){let n=e.length-2,r=3,a,o;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(a={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},o={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Cr(e,r,n-r+1,[["enter",a,t],["enter",o,t],["exit",o,t],["exit",a,t]])),e}function TT(e,t,n){let r=0;return a;function a(m){return e.enter("atxHeading"),o(m)}function o(m){return e.enter("atxHeadingSequence"),u(m)}function u(m){return m===35&&r++<6?(e.consume(m),u):m===null||It(m)?(e.exit("atxHeadingSequence"),h(m)):n(m)}function h(m){return m===35?(e.enter("atxHeadingSequence"),f(m)):m===null||Ue(m)?(e.exit("atxHeading"),t(m)):ut(m)?bt(e,h,"whitespace")(m):(e.enter("atxHeadingText"),p(m))}function f(m){return m===35?(e.consume(m),f):(e.exit("atxHeadingSequence"),h(m))}function p(m){return m===null||m===35||It(m)?(e.exit("atxHeadingText"),h(m)):(e.consume(m),p)}}const MT=["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"],d5=["pre","script","style","textarea"],DT={concrete:!0,name:"htmlFlow",resolveTo:zT,tokenize:OT},LT={partial:!0,tokenize:PT},RT={partial:!0,tokenize:BT};function zT(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 OT(e,t,n){const r=this;let a,o,u,h,f;return p;function p(M){return m(M)}function m(M){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(M),x}function x(M){return M===33?(e.consume(M),b):M===47?(e.consume(M),o=!0,j):M===63?(e.consume(M),a=3,r.interrupt?t:D):Zn(M)?(e.consume(M),u=String.fromCharCode(M),N):n(M)}function b(M){return M===45?(e.consume(M),a=2,y):M===91?(e.consume(M),a=5,h=0,_):Zn(M)?(e.consume(M),a=4,r.interrupt?t:D):n(M)}function y(M){return M===45?(e.consume(M),r.interrupt?t:D):n(M)}function _(M){const ge="CDATA[";return M===ge.charCodeAt(h++)?(e.consume(M),h===ge.length?r.interrupt?t:A:_):n(M)}function j(M){return Zn(M)?(e.consume(M),u=String.fromCharCode(M),N):n(M)}function N(M){if(M===null||M===47||M===62||It(M)){const ge=M===47,we=u.toLowerCase();return!ge&&!o&&d5.includes(we)?(a=1,r.interrupt?t(M):A(M)):MT.includes(u.toLowerCase())?(a=6,ge?(e.consume(M),w):r.interrupt?t(M):A(M)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(M):o?C(M):E(M))}return M===45||Hn(M)?(e.consume(M),u+=String.fromCharCode(M),N):n(M)}function w(M){return M===62?(e.consume(M),r.interrupt?t:A):n(M)}function C(M){return ut(M)?(e.consume(M),C):z(M)}function E(M){return M===47?(e.consume(M),z):M===58||M===95||Zn(M)?(e.consume(M),R):ut(M)?(e.consume(M),E):z(M)}function R(M){return M===45||M===46||M===58||M===95||Hn(M)?(e.consume(M),R):L(M)}function L(M){return M===61?(e.consume(M),O):ut(M)?(e.consume(M),L):E(M)}function O(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),f=M,q):ut(M)?(e.consume(M),O):F(M)}function q(M){return M===f?(e.consume(M),f=null,W):M===null||Ue(M)?n(M):(e.consume(M),q)}function F(M){return M===null||M===34||M===39||M===47||M===60||M===61||M===62||M===96||It(M)?L(M):(e.consume(M),F)}function W(M){return M===47||M===62||ut(M)?E(M):n(M)}function z(M){return M===62?(e.consume(M),I):n(M)}function I(M){return M===null||Ue(M)?A(M):ut(M)?(e.consume(M),I):n(M)}function A(M){return M===45&&a===2?(e.consume(M),B):M===60&&a===1?(e.consume(M),$):M===62&&a===4?(e.consume(M),P):M===63&&a===3?(e.consume(M),D):M===93&&a===5?(e.consume(M),ae):Ue(M)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(LT,J,X)(M)):M===null||Ue(M)?(e.exit("htmlFlowData"),X(M)):(e.consume(M),A)}function X(M){return e.check(RT,Z,J)(M)}function Z(M){return e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),G}function G(M){return M===null||Ue(M)?X(M):(e.enter("htmlFlowData"),A(M))}function B(M){return M===45?(e.consume(M),D):A(M)}function $(M){return M===47?(e.consume(M),u="",se):A(M)}function se(M){if(M===62){const ge=u.toLowerCase();return d5.includes(ge)?(e.consume(M),P):A(M)}return Zn(M)&&u.length<8?(e.consume(M),u+=String.fromCharCode(M),se):A(M)}function ae(M){return M===93?(e.consume(M),D):A(M)}function D(M){return M===62?(e.consume(M),P):M===45&&a===2?(e.consume(M),D):A(M)}function P(M){return M===null||Ue(M)?(e.exit("htmlFlowData"),J(M)):(e.consume(M),P)}function J(M){return e.exit("htmlFlow"),t(M)}}function BT(e,t,n){const r=this;return a;function a(u){return Ue(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),o):n(u)}function o(u){return r.parser.lazy[r.now().line]?n(u):t(u)}}function PT(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(nu,t,n)}}const $T={name:"htmlText",tokenize:FT};function FT(e,t,n){const r=this;let a,o,u;return h;function h(D){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(D),f}function f(D){return D===33?(e.consume(D),p):D===47?(e.consume(D),L):D===63?(e.consume(D),E):Zn(D)?(e.consume(D),F):n(D)}function p(D){return D===45?(e.consume(D),m):D===91?(e.consume(D),o=0,_):Zn(D)?(e.consume(D),C):n(D)}function m(D){return D===45?(e.consume(D),y):n(D)}function x(D){return D===null?n(D):D===45?(e.consume(D),b):Ue(D)?(u=x,$(D)):(e.consume(D),x)}function b(D){return D===45?(e.consume(D),y):x(D)}function y(D){return D===62?B(D):D===45?b(D):x(D)}function _(D){const P="CDATA[";return D===P.charCodeAt(o++)?(e.consume(D),o===P.length?j:_):n(D)}function j(D){return D===null?n(D):D===93?(e.consume(D),N):Ue(D)?(u=j,$(D)):(e.consume(D),j)}function N(D){return D===93?(e.consume(D),w):j(D)}function w(D){return D===62?B(D):D===93?(e.consume(D),w):j(D)}function C(D){return D===null||D===62?B(D):Ue(D)?(u=C,$(D)):(e.consume(D),C)}function E(D){return D===null?n(D):D===63?(e.consume(D),R):Ue(D)?(u=E,$(D)):(e.consume(D),E)}function R(D){return D===62?B(D):E(D)}function L(D){return Zn(D)?(e.consume(D),O):n(D)}function O(D){return D===45||Hn(D)?(e.consume(D),O):q(D)}function q(D){return Ue(D)?(u=q,$(D)):ut(D)?(e.consume(D),q):B(D)}function F(D){return D===45||Hn(D)?(e.consume(D),F):D===47||D===62||It(D)?W(D):n(D)}function W(D){return D===47?(e.consume(D),B):D===58||D===95||Zn(D)?(e.consume(D),z):Ue(D)?(u=W,$(D)):ut(D)?(e.consume(D),W):B(D)}function z(D){return D===45||D===46||D===58||D===95||Hn(D)?(e.consume(D),z):I(D)}function I(D){return D===61?(e.consume(D),A):Ue(D)?(u=I,$(D)):ut(D)?(e.consume(D),I):W(D)}function A(D){return D===null||D===60||D===61||D===62||D===96?n(D):D===34||D===39?(e.consume(D),a=D,X):Ue(D)?(u=A,$(D)):ut(D)?(e.consume(D),A):(e.consume(D),Z)}function X(D){return D===a?(e.consume(D),a=void 0,G):D===null?n(D):Ue(D)?(u=X,$(D)):(e.consume(D),X)}function Z(D){return D===null||D===34||D===39||D===60||D===61||D===96?n(D):D===47||D===62||It(D)?W(D):(e.consume(D),Z)}function G(D){return D===47||D===62||It(D)?W(D):n(D)}function B(D){return D===62?(e.consume(D),e.exit("htmlTextData"),e.exit("htmlText"),t):n(D)}function $(D){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),se}function se(D){return ut(D)?bt(e,ae,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):ae(D)}function ae(D){return e.enter("htmlTextData"),u(D)}}const ev={name:"labelEnd",resolveAll:qT,resolveTo:VT,tokenize:GT},UT={tokenize:YT},IT={tokenize:WT},HT={tokenize:QT};function qT(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const a=r.type==="labelImage"?4:2;r.type="data",t+=a}}return e.length!==n.length&&Cr(e,0,e.length,n),e}function VT(e,t){let n=e.length,r=0,a,o,u,h;for(;n--;)if(a=e[n][1],o){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(u){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(o=n,a.type!=="labelLink")){r=2;break}}else a.type==="labelEnd"&&(u=n);const f={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},p={type:"label",start:{...e[o][1].start},end:{...e[u][1].end}},m={type:"labelText",start:{...e[o+r+2][1].end},end:{...e[u-2][1].start}};return h=[["enter",f,t],["enter",p,t]],h=Yr(h,e.slice(o+1,o+r+3)),h=Yr(h,[["enter",m,t]]),h=Yr(h,Vh(t.parser.constructs.insideSpan.null,e.slice(o+r+4,u-3),t)),h=Yr(h,[["exit",m,t],e[u-2],e[u-1],["exit",p,t]]),h=Yr(h,e.slice(u+1)),h=Yr(h,[["exit",f,t]]),Cr(e,o,e.length,h),e}function GT(e,t,n){const r=this;let a=r.events.length,o,u;for(;a--;)if((r.events[a][1].type==="labelImage"||r.events[a][1].type==="labelLink")&&!r.events[a][1]._balanced){o=r.events[a][1];break}return h;function h(b){return o?o._inactive?x(b):(u=r.parser.defined.includes(ls(r.sliceSerialize({start:o.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(b),e.exit("labelMarker"),e.exit("labelEnd"),f):n(b)}function f(b){return b===40?e.attempt(UT,m,u?m:x)(b):b===91?e.attempt(IT,m,u?p:x)(b):u?m(b):x(b)}function p(b){return e.attempt(HT,m,x)(b)}function m(b){return t(b)}function x(b){return o._balanced=!0,n(b)}}function YT(e,t,n){return r;function r(x){return e.enter("resource"),e.enter("resourceMarker"),e.consume(x),e.exit("resourceMarker"),a}function a(x){return It(x)?zc(e,o)(x):o(x)}function o(x){return x===41?m(x):RS(e,u,h,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(x)}function u(x){return It(x)?zc(e,f)(x):m(x)}function h(x){return n(x)}function f(x){return x===34||x===39||x===40?OS(e,p,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(x):m(x)}function p(x){return It(x)?zc(e,m)(x):m(x)}function m(x){return x===41?(e.enter("resourceMarker"),e.consume(x),e.exit("resourceMarker"),e.exit("resource"),t):n(x)}}function WT(e,t,n){const r=this;return a;function a(h){return zS.call(r,e,o,u,"reference","referenceMarker","referenceString")(h)}function o(h){return r.parser.defined.includes(ls(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(h):n(h)}function u(h){return n(h)}}function QT(e,t,n){return r;function r(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),a}function a(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const XT={name:"labelStartImage",resolveAll:ev.resolveAll,tokenize:KT};function KT(e,t,n){const r=this;return a;function a(h){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(h),e.exit("labelImageMarker"),o}function o(h){return h===91?(e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),e.exit("labelImage"),u):n(h)}function u(h){return h===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(h):t(h)}}const ZT={name:"labelStartLink",resolveAll:ev.resolveAll,tokenize:JT};function JT(e,t,n){const r=this;return a;function a(u){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),e.exit("labelLink"),o}function o(u){return u===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(u):t(u)}}const Gm={name:"lineEnding",tokenize:eM};function eM(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),bt(e,t,"linePrefix")}}const th={name:"thematicBreak",tokenize:tM};function tM(e,t,n){let r=0,a;return o;function o(p){return e.enter("thematicBreak"),u(p)}function u(p){return a=p,h(p)}function h(p){return p===a?(e.enter("thematicBreakSequence"),f(p)):r>=3&&(p===null||Ue(p))?(e.exit("thematicBreak"),t(p)):n(p)}function f(p){return p===a?(e.consume(p),r++,f):(e.exit("thematicBreakSequence"),ut(p)?bt(e,h,"whitespace")(p):h(p))}}const or={continuation:{tokenize:iM},exit:lM,name:"list",tokenize:sM},nM={partial:!0,tokenize:oM},rM={partial:!0,tokenize:aM};function sM(e,t,n){const r=this,a=r.events[r.events.length-1];let o=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,u=0;return h;function h(y){const _=r.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(_==="listUnordered"?!r.containerState.marker||y===r.containerState.marker:hx(y)){if(r.containerState.type||(r.containerState.type=_,e.enter(_,{_container:!0})),_==="listUnordered")return e.enter("listItemPrefix"),y===42||y===45?e.check(th,n,p)(y):p(y);if(!r.interrupt||y===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),f(y)}return n(y)}function f(y){return hx(y)&&++u<10?(e.consume(y),f):(!r.interrupt||u<2)&&(r.containerState.marker?y===r.containerState.marker:y===41||y===46)?(e.exit("listItemValue"),p(y)):n(y)}function p(y){return e.enter("listItemMarker"),e.consume(y),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||y,e.check(nu,r.interrupt?n:m,e.attempt(nM,b,x))}function m(y){return r.containerState.initialBlankLine=!0,o++,b(y)}function x(y){return ut(y)?(e.enter("listItemPrefixWhitespace"),e.consume(y),e.exit("listItemPrefixWhitespace"),b):n(y)}function b(y){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(y)}}function iM(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(nu,a,o);function a(h){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,bt(e,t,"listItemIndent",r.containerState.size+1)(h)}function o(h){return r.containerState.furtherBlankLines||!ut(h)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,u(h)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(rM,t,u)(h))}function u(h){return r.containerState._closeFlow=!0,r.interrupt=void 0,bt(e,e.attempt(or,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(h)}}function aM(e,t,n){const r=this;return bt(e,a,"listItemIndent",r.containerState.size+1);function a(o){const u=r.events[r.events.length-1];return u&&u[1].type==="listItemIndent"&&u[2].sliceSerialize(u[1],!0).length===r.containerState.size?t(o):n(o)}}function lM(e){e.exit(this.containerState.type)}function oM(e,t,n){const r=this;return bt(e,a,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(o){const u=r.events[r.events.length-1];return!ut(o)&&u&&u[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const h5={name:"setextUnderline",resolveTo:cM,tokenize:uM};function cM(e,t){let n=e.length,r,a,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const u={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",o?(e.splice(a,0,["enter",u,t]),e.splice(o+1,0,["exit",e[r][1],t]),e[r][1].end={...e[o][1].end}):e[r][1]=u,e.push(["exit",u,t]),e}function uM(e,t,n){const r=this;let a;return o;function o(p){let m=r.events.length,x;for(;m--;)if(r.events[m][1].type!=="lineEnding"&&r.events[m][1].type!=="linePrefix"&&r.events[m][1].type!=="content"){x=r.events[m][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||x)?(e.enter("setextHeadingLine"),a=p,u(p)):n(p)}function u(p){return e.enter("setextHeadingLineSequence"),h(p)}function h(p){return p===a?(e.consume(p),h):(e.exit("setextHeadingLineSequence"),ut(p)?bt(e,f,"lineSuffix")(p):f(p))}function f(p){return p===null||Ue(p)?(e.exit("setextHeadingLine"),t(p)):n(p)}}const dM={tokenize:hM};function hM(e){const t=this,n=e.attempt(nu,r,e.attempt(this.parser.constructs.flowInitial,a,bt(e,e.attempt(this.parser.constructs.flow,a,e.attempt(xT,a)),"linePrefix")));return n;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const fM={resolveAll:PS()},pM=BS("string"),mM=BS("text");function BS(e){return{resolveAll:PS(e==="text"?gM:void 0),tokenize:t};function t(n){const r=this,a=this.parser.constructs[e],o=n.attempt(a,u,h);return u;function u(m){return p(m)?o(m):h(m)}function h(m){if(m===null){n.consume(m);return}return n.enter("data"),n.consume(m),f}function f(m){return p(m)?(n.exit("data"),o(m)):(n.consume(m),f)}function p(m){if(m===null)return!0;const x=a[m];let b=-1;if(x)for(;++b<x.length;){const y=x[b];if(!y.previous||y.previous.call(r,r.previous))return!0}return!1}}}function PS(e){return t;function t(n,r){let a=-1,o;for(;++a<=n.length;)o===void 0?n[a]&&n[a][1].type==="data"&&(o=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==o+2&&(n[o][1].end=n[a-1][1].end,n.splice(o+2,a-o-2),a=o+2),o=void 0);return e?e(n,r):n}}function gM(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],a=t.sliceStream(r);let o=a.length,u=-1,h=0,f;for(;o--;){const p=a[o];if(typeof p=="string"){for(u=p.length;p.charCodeAt(u-1)===32;)h++,u--;if(u)break;u=-1}else if(p===-2)f=!0,h++;else if(p!==-1){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(h=0),h){const p={type:n===e.length||f||h<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?u:r.start._bufferIndex+u,_index:r.start._index+o,line:r.end.line,column:r.end.column-h,offset:r.end.offset-h},end:{...r.end}};r.end={...p.start},r.start.offset===r.end.offset?Object.assign(r,p):(e.splice(n,0,["enter",p,t],["exit",p,t]),n+=2)}n++}return e}const xM={42:or,43:or,45:or,48:or,49:or,50:or,51:or,52:or,53:or,54:or,55:or,56:or,57:or,62:TS},vM={91:wT},bM={[-2]:Vm,[-1]:Vm,32:Vm},yM={35:ET,42:th,45:[h5,th],60:DT,61:h5,95:th,96:u5,126:u5},_M={38:DS,92:MS},wM={[-5]:Gm,[-4]:Gm,[-3]:Gm,33:XT,38:DS,42:fx,60:[ZA,$T],91:ZT,92:[NT,MS],93:ev,95:fx,96:dT},SM={null:[fx,fM]},kM={null:[42,95]},jM={null:[]},NM=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:kM,contentInitial:vM,disable:jM,document:xM,flow:yM,flowInitial:bM,insideSpan:SM,string:_M,text:wM},Symbol.toStringTag,{value:"Module"}));function CM(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},o=[];let u=[],h=[];const f={attempt:q(L),check:q(O),consume:C,enter:E,exit:R,interrupt:q(O,{interrupt:!0})},p={code:null,containerState:{},defineSkip:j,events:[],now:_,parser:e,previous:null,sliceSerialize:b,sliceStream:y,write:x};let m=t.tokenize.call(p,f);return t.resolveAll&&o.push(t),p;function x(I){return u=Yr(u,I),N(),u[u.length-1]!==null?[]:(F(t,0),p.events=Vh(o,p.events,p),p.events)}function b(I,A){return AM(y(I),A)}function y(I){return EM(u,I)}function _(){const{_bufferIndex:I,_index:A,line:X,column:Z,offset:G}=r;return{_bufferIndex:I,_index:A,line:X,column:Z,offset:G}}function j(I){a[I.line]=I.column,z()}function N(){let I;for(;r._index<u.length;){const A=u[r._index];if(typeof A=="string")for(I=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===I&&r._bufferIndex<A.length;)w(A.charCodeAt(r._bufferIndex));else w(A)}}function w(I){m=m(I)}function C(I){Ue(I)?(r.line++,r.column=1,r.offset+=I===-3?2:1,z()):I!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===u[r._index].length&&(r._bufferIndex=-1,r._index++)),p.previous=I}function E(I,A){const X=A||{};return X.type=I,X.start=_(),p.events.push(["enter",X,p]),h.push(X),X}function R(I){const A=h.pop();return A.end=_(),p.events.push(["exit",A,p]),A}function L(I,A){F(I,A.from)}function O(I,A){A.restore()}function q(I,A){return X;function X(Z,G,B){let $,se,ae,D;return Array.isArray(Z)?J(Z):"tokenize"in Z?J([Z]):P(Z);function P(Ce){return ze;function ze(Ee){const Pe=Ee!==null&&Ce[Ee],et=Ee!==null&&Ce.null,Et=[...Array.isArray(Pe)?Pe:Pe?[Pe]:[],...Array.isArray(et)?et:et?[et]:[]];return J(Et)(Ee)}}function J(Ce){return $=Ce,se=0,Ce.length===0?B:M(Ce[se])}function M(Ce){return ze;function ze(Ee){return D=W(),ae=Ce,Ce.partial||(p.currentConstruct=Ce),Ce.name&&p.parser.constructs.disable.null.includes(Ce.name)?we():Ce.tokenize.call(A?Object.assign(Object.create(p),A):p,f,ge,we)(Ee)}}function ge(Ce){return I(ae,D),G}function we(Ce){return D.restore(),++se<$.length?M($[se]):B}}}function F(I,A){I.resolveAll&&!o.includes(I)&&o.push(I),I.resolve&&Cr(p.events,A,p.events.length-A,I.resolve(p.events.slice(A),p)),I.resolveTo&&(p.events=I.resolveTo(p.events,p))}function W(){const I=_(),A=p.previous,X=p.currentConstruct,Z=p.events.length,G=Array.from(h);return{from:Z,restore:B};function B(){r=I,p.previous=A,p.currentConstruct=X,p.events.length=Z,h=G,z()}}function z(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function EM(e,t){const n=t.start._index,r=t.start._bufferIndex,a=t.end._index,o=t.end._bufferIndex;let u;if(n===a)u=[e[n].slice(r,o)];else{if(u=e.slice(n,a),r>-1){const h=u[0];typeof h=="string"?u[0]=h.slice(r):u.shift()}o>0&&u.push(e[a].slice(0,o))}return u}function AM(e,t){let n=-1;const r=[];let a;for(;++n<e.length;){const o=e[n];let u;if(typeof o=="string")u=o;else switch(o){case-5:{u="\r";break}case-4:{u=`
73
+ `;break}case-3:{u=`\r
74
+ `;break}case-2:{u=t?" ":" ";break}case-1:{if(!t&&a)continue;u=" ";break}default:u=String.fromCharCode(o)}a=o===-2,r.push(u)}return r.join("")}function TM(e){const r={constructs:ES([NM,...(e||{}).extensions||[]]),content:a(VA),defined:[],document:a(YA),flow:a(dM),lazy:{},string:a(pM),text:a(mM)};return r;function a(o){return u;function u(h){return CM(r,o,h)}}}function MM(e){for(;!LS(e););return e}const f5=/[\0\t\n\r]/g;function DM(){let e=1,t="",n=!0,r;return a;function a(o,u,h){const f=[];let p,m,x,b,y;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(u||void 0).decode(o)),x=0,t="",n&&(o.charCodeAt(0)===65279&&x++,n=void 0);x<o.length;){if(f5.lastIndex=x,p=f5.exec(o),b=p&&p.index!==void 0?p.index:o.length,y=o.charCodeAt(b),!p){t=o.slice(x);break}if(y===10&&x===b&&r)f.push(-3),r=void 0;else switch(r&&(f.push(-5),r=void 0),x<b&&(f.push(o.slice(x,b)),e+=b-x),y){case 0:{f.push(65533),e++;break}case 9:{for(m=Math.ceil(e/4)*4,f.push(-2);e++<m;)f.push(-1);break}case 10:{f.push(-4),e=1;break}default:r=!0,e=1}x=b+1}return h&&(r&&f.push(-5),t&&f.push(t),f.push(null)),f}}const LM=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function RM(e){return e.replace(LM,zM)}function zM(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),o=a===120||a===88;return AS(n.slice(o?2:1),o?16:10)}return Jx(n)||e}const $S={}.hasOwnProperty;function OM(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),BM(n)(MM(TM(n).document().write(DM()(e,t,!0))))}function BM(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(dt),autolinkProtocol:W,autolinkEmail:W,atxHeading:o(Lt),blockQuote:o(et),characterEscape:W,characterReference:W,codeFenced:o(Et),codeFencedFenceInfo:u,codeFencedFenceMeta:u,codeIndented:o(Et,u),codeText:o(mt,u),codeTextData:W,data:W,codeFlowValue:W,definition:o(yt),definitionDestinationString:u,definitionLabelString:u,definitionTitleString:u,emphasis:o(_t),hardBreakEscape:o(Gt),hardBreakTrailing:o(Gt),htmlFlow:o(_e,u),htmlFlowData:W,htmlText:o(_e,u),htmlTextData:W,image:o(Ve),label:u,link:o(dt),listItem:o(je),listItemValue:b,listOrdered:o(_n,x),listUnordered:o(_n),paragraph:o(Oe),reference:M,referenceString:u,resourceDestinationString:u,resourceTitleString:u,setextHeading:o(Lt),strong:o(xt),thematicBreak:o(Qr)},exit:{atxHeading:f(),atxHeadingSequence:L,autolink:f(),autolinkEmail:Pe,autolinkProtocol:Ee,blockQuote:f(),characterEscapeValue:z,characterReferenceMarkerHexadecimal:we,characterReferenceMarkerNumeric:we,characterReferenceValue:Ce,characterReference:ze,codeFenced:f(N),codeFencedFence:j,codeFencedFenceInfo:y,codeFencedFenceMeta:_,codeFlowValue:z,codeIndented:f(w),codeText:f(G),codeTextData:z,data:z,definition:f(),definitionDestinationString:R,definitionLabelString:C,definitionTitleString:E,emphasis:f(),hardBreakEscape:f(A),hardBreakTrailing:f(A),htmlFlow:f(X),htmlFlowData:z,htmlText:f(Z),htmlTextData:z,image:f($),label:ae,labelText:se,lineEnding:I,link:f(B),listItem:f(),listOrdered:f(),listUnordered:f(),paragraph:f(),referenceString:ge,resourceDestinationString:D,resourceTitleString:P,resource:J,setextHeading:f(F),setextHeadingLineSequence:q,setextHeadingText:O,strong:f(),thematicBreak:f()}};FS(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(oe){let Se={type:"root",children:[]};const Q={stack:[Se],tokenStack:[],config:t,enter:h,exit:p,buffer:u,resume:m,data:n},xe=[];let Le=-1;for(;++Le<oe.length;)if(oe[Le][1].type==="listOrdered"||oe[Le][1].type==="listUnordered")if(oe[Le][0]==="enter")xe.push(Le);else{const Qe=xe.pop();Le=a(oe,Qe,Le)}for(Le=-1;++Le<oe.length;){const Qe=t[oe[Le][0]];$S.call(Qe,oe[Le][1].type)&&Qe[oe[Le][1].type].call(Object.assign({sliceSerialize:oe[Le][2].sliceSerialize},Q),oe[Le][1])}if(Q.tokenStack.length>0){const Qe=Q.tokenStack[Q.tokenStack.length-1];(Qe[1]||p5).call(Q,void 0,Qe[0])}for(Se.position={start:Pi(oe.length>0?oe[0][1].start:{line:1,column:1,offset:0}),end:Pi(oe.length>0?oe[oe.length-2][1].end:{line:1,column:1,offset:0})},Le=-1;++Le<t.transforms.length;)Se=t.transforms[Le](Se)||Se;return Se}function a(oe,Se,Q){let xe=Se-1,Le=-1,Qe=!1,rt,st,Ct,wn;for(;++xe<=Q;){const tt=oe[xe];switch(tt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{tt[0]==="enter"?Le++:Le--,wn=void 0;break}case"lineEndingBlank":{tt[0]==="enter"&&(rt&&!wn&&!Le&&!Ct&&(Ct=xe),wn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:wn=void 0}if(!Le&&tt[0]==="enter"&&tt[1].type==="listItemPrefix"||Le===-1&&tt[0]==="exit"&&(tt[1].type==="listUnordered"||tt[1].type==="listOrdered")){if(rt){let hr=xe;for(st=void 0;hr--;){const Bn=oe[hr];if(Bn[1].type==="lineEnding"||Bn[1].type==="lineEndingBlank"){if(Bn[0]==="exit")continue;st&&(oe[st][1].type="lineEndingBlank",Qe=!0),Bn[1].type="lineEnding",st=hr}else if(!(Bn[1].type==="linePrefix"||Bn[1].type==="blockQuotePrefix"||Bn[1].type==="blockQuotePrefixWhitespace"||Bn[1].type==="blockQuoteMarker"||Bn[1].type==="listItemIndent"))break}Ct&&(!st||Ct<st)&&(rt._spread=!0),rt.end=Object.assign({},st?oe[st][1].start:tt[1].end),oe.splice(st||xe,0,["exit",rt,tt[2]]),xe++,Q++}if(tt[1].type==="listItemPrefix"){const hr={type:"listItem",_spread:!1,start:Object.assign({},tt[1].start),end:void 0};rt=hr,oe.splice(xe,0,["enter",hr,tt[2]]),xe++,Q++,Ct=void 0,wn=!0}}}return oe[Se][1]._spread=Qe,Q}function o(oe,Se){return Q;function Q(xe){h.call(this,oe(xe),xe),Se&&Se.call(this,xe)}}function u(){this.stack.push({type:"fragment",children:[]})}function h(oe,Se,Q){this.stack[this.stack.length-1].children.push(oe),this.stack.push(oe),this.tokenStack.push([Se,Q||void 0]),oe.position={start:Pi(Se.start),end:void 0}}function f(oe){return Se;function Se(Q){oe&&oe.call(this,Q),p.call(this,Q)}}function p(oe,Se){const Q=this.stack.pop(),xe=this.tokenStack.pop();if(xe)xe[0].type!==oe.type&&(Se?Se.call(this,oe,xe[0]):(xe[1]||p5).call(this,oe,xe[0]));else throw new Error("Cannot close `"+oe.type+"` ("+Rc({start:oe.start,end:oe.end})+"): it’s not open");Q.position.end=Pi(oe.end)}function m(){return Zx(this.stack.pop())}function x(){this.data.expectingFirstListItemValue=!0}function b(oe){if(this.data.expectingFirstListItemValue){const Se=this.stack[this.stack.length-2];Se.start=Number.parseInt(this.sliceSerialize(oe),10),this.data.expectingFirstListItemValue=void 0}}function y(){const oe=this.resume(),Se=this.stack[this.stack.length-1];Se.lang=oe}function _(){const oe=this.resume(),Se=this.stack[this.stack.length-1];Se.meta=oe}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function N(){const oe=this.resume(),Se=this.stack[this.stack.length-1];Se.value=oe.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function w(){const oe=this.resume(),Se=this.stack[this.stack.length-1];Se.value=oe.replace(/(\r?\n|\r)$/g,"")}function C(oe){const Se=this.resume(),Q=this.stack[this.stack.length-1];Q.label=Se,Q.identifier=ls(this.sliceSerialize(oe)).toLowerCase()}function E(){const oe=this.resume(),Se=this.stack[this.stack.length-1];Se.title=oe}function R(){const oe=this.resume(),Se=this.stack[this.stack.length-1];Se.url=oe}function L(oe){const Se=this.stack[this.stack.length-1];if(!Se.depth){const Q=this.sliceSerialize(oe).length;Se.depth=Q}}function O(){this.data.setextHeadingSlurpLineEnding=!0}function q(oe){const Se=this.stack[this.stack.length-1];Se.depth=this.sliceSerialize(oe).codePointAt(0)===61?1:2}function F(){this.data.setextHeadingSlurpLineEnding=void 0}function W(oe){const Q=this.stack[this.stack.length-1].children;let xe=Q[Q.length-1];(!xe||xe.type!=="text")&&(xe=Ae(),xe.position={start:Pi(oe.start),end:void 0},Q.push(xe)),this.stack.push(xe)}function z(oe){const Se=this.stack.pop();Se.value+=this.sliceSerialize(oe),Se.position.end=Pi(oe.end)}function I(oe){const Se=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Q=Se.children[Se.children.length-1];Q.position.end=Pi(oe.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Se.type)&&(W.call(this,oe),z.call(this,oe))}function A(){this.data.atHardBreak=!0}function X(){const oe=this.resume(),Se=this.stack[this.stack.length-1];Se.value=oe}function Z(){const oe=this.resume(),Se=this.stack[this.stack.length-1];Se.value=oe}function G(){const oe=this.resume(),Se=this.stack[this.stack.length-1];Se.value=oe}function B(){const oe=this.stack[this.stack.length-1];if(this.data.inReference){const Se=this.data.referenceType||"shortcut";oe.type+="Reference",oe.referenceType=Se,delete oe.url,delete oe.title}else delete oe.identifier,delete oe.label;this.data.referenceType=void 0}function $(){const oe=this.stack[this.stack.length-1];if(this.data.inReference){const Se=this.data.referenceType||"shortcut";oe.type+="Reference",oe.referenceType=Se,delete oe.url,delete oe.title}else delete oe.identifier,delete oe.label;this.data.referenceType=void 0}function se(oe){const Se=this.sliceSerialize(oe),Q=this.stack[this.stack.length-2];Q.label=RM(Se),Q.identifier=ls(Se).toLowerCase()}function ae(){const oe=this.stack[this.stack.length-1],Se=this.resume(),Q=this.stack[this.stack.length-1];if(this.data.inReference=!0,Q.type==="link"){const xe=oe.children;Q.children=xe}else Q.alt=Se}function D(){const oe=this.resume(),Se=this.stack[this.stack.length-1];Se.url=oe}function P(){const oe=this.resume(),Se=this.stack[this.stack.length-1];Se.title=oe}function J(){this.data.inReference=void 0}function M(){this.data.referenceType="collapsed"}function ge(oe){const Se=this.resume(),Q=this.stack[this.stack.length-1];Q.label=Se,Q.identifier=ls(this.sliceSerialize(oe)).toLowerCase(),this.data.referenceType="full"}function we(oe){this.data.characterReferenceType=oe.type}function Ce(oe){const Se=this.sliceSerialize(oe),Q=this.data.characterReferenceType;let xe;Q?(xe=AS(Se,Q==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):xe=Jx(Se);const Le=this.stack[this.stack.length-1];Le.value+=xe}function ze(oe){const Se=this.stack.pop();Se.position.end=Pi(oe.end)}function Ee(oe){z.call(this,oe);const Se=this.stack[this.stack.length-1];Se.url=this.sliceSerialize(oe)}function Pe(oe){z.call(this,oe);const Se=this.stack[this.stack.length-1];Se.url="mailto:"+this.sliceSerialize(oe)}function et(){return{type:"blockquote",children:[]}}function Et(){return{type:"code",lang:null,meta:null,value:""}}function mt(){return{type:"inlineCode",value:""}}function yt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function _t(){return{type:"emphasis",children:[]}}function Lt(){return{type:"heading",depth:0,children:[]}}function Gt(){return{type:"break"}}function _e(){return{type:"html",value:""}}function Ve(){return{type:"image",title:null,url:"",alt:null}}function dt(){return{type:"link",title:null,url:"",children:[]}}function _n(oe){return{type:"list",ordered:oe.type==="listOrdered",start:null,spread:oe._spread,children:[]}}function je(oe){return{type:"listItem",spread:oe._spread,checked:null,children:[]}}function Oe(){return{type:"paragraph",children:[]}}function xt(){return{type:"strong",children:[]}}function Ae(){return{type:"text",value:""}}function Qr(){return{type:"thematicBreak"}}}function Pi(e){return{line:e.line,column:e.column,offset:e.offset}}function FS(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?FS(e,r):PM(e,r)}}function PM(e,t){let n;for(n in t)if($S.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function p5(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Rc({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Rc({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Rc({start:t.start,end:t.end})+") is still open")}function $M(e){const t=this;t.parser=n;function n(r){return OM(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function FM(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 UM(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
75
+ `}]}function IM(e,t){const n=t.value?t.value+`
76
+ `:"",r={},a=t.lang?t.lang.split(/\s+/):[];a.length>0&&(r.className=["language-"+a[0]]);let o={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function HM(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function qM(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function VM(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),a=ao(r.toLowerCase()),o=e.footnoteOrder.indexOf(r);let u,h=e.footnoteCounts.get(r);h===void 0?(h=0,e.footnoteOrder.push(r),u=e.footnoteOrder.length):u=o+1,h+=1,e.footnoteCounts.set(r,h);const f={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(h>1?"-"+h:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(u)}]};e.patch(t,f);const p={type:"element",tagName:"sup",properties:{},children:[f]};return e.patch(t,p),e.applyData(t,p)}function GM(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 YM(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function US(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const a=e.all(t),o=a[0];o&&o.type==="text"?o.value="["+o.value:a.unshift({type:"text",value:"["});const u=a[a.length-1];return u&&u.type==="text"?u.value+=r:a.push({type:"text",value:r}),a}function WM(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return US(e,t);const a={src:ao(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(a.title=r.title);const o={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,o),e.applyData(t,o)}function QM(e,t){const n={src:ao(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function XM(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function KM(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return US(e,t);const a={href:ao(r.url||"")};r.title!==null&&r.title!==void 0&&(a.title=r.title);const o={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function ZM(e,t){const n={href:ao(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function JM(e,t,n){const r=e.all(t),a=n?e8(n):IS(t),o={},u=[];if(typeof t.checked=="boolean"){const m=r[0];let x;m&&m.type==="element"&&m.tagName==="p"?x=m:(x={type:"element",tagName:"p",properties:{},children:[]},r.unshift(x)),x.children.length>0&&x.children.unshift({type:"text",value:" "}),x.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let h=-1;for(;++h<r.length;){const m=r[h];(a||h!==0||m.type!=="element"||m.tagName!=="p")&&u.push({type:"text",value:`
77
+ `}),m.type==="element"&&m.tagName==="p"&&!a?u.push(...m.children):u.push(m)}const f=r[r.length-1];f&&(a||f.type!=="element"||f.tagName!=="p")&&u.push({type:"text",value:`
78
+ `});const p={type:"element",tagName:"li",properties:o,children:u};return e.patch(t,p),e.applyData(t,p)}function e8(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=IS(n[r])}return t}function IS(e){const t=e.spread;return t??e.children.length>1}function t8(e,t){const n={},r=e.all(t);let a=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++a<r.length;){const u=r[a];if(u.type==="element"&&u.tagName==="li"&&u.properties&&Array.isArray(u.properties.className)&&u.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,o),e.applyData(t,o)}function n8(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function r8(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function s8(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function i8(e,t){const n=e.all(t),r=n.shift(),a=[];if(r){const u={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],u),a.push(u)}if(n.length>0){const u={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},h=Wx(t.children[1]),f=_S(t.children[t.children.length-1]);h&&f&&(u.position={start:h,end:f}),a.push(u)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,o),e.applyData(t,o)}function a8(e,t,n){const r=n?n.children:void 0,o=(r?r.indexOf(t):1)===0?"th":"td",u=n&&n.type==="table"?n.align:void 0,h=u?u.length:t.children.length;let f=-1;const p=[];for(;++f<h;){const x=t.children[f],b={},y=u?u[f]:void 0;y&&(b.align=y);let _={type:"element",tagName:o,properties:b,children:[]};x&&(_.children=e.all(x),e.patch(x,_),_=e.applyData(x,_)),p.push(_)}const m={type:"element",tagName:"tr",properties:{},children:e.wrap(p,!0)};return e.patch(t,m),e.applyData(t,m)}function l8(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const m5=9,g5=32;function o8(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),a=0;const o=[];for(;r;)o.push(x5(t.slice(a,r.index),a>0,!0),r[0]),a=r.index+r[0].length,r=n.exec(t);return o.push(x5(t.slice(a),a>0,!1)),o.join("")}function x5(e,t,n){let r=0,a=e.length;if(t){let o=e.codePointAt(r);for(;o===m5||o===g5;)r++,o=e.codePointAt(r)}if(n){let o=e.codePointAt(a-1);for(;o===m5||o===g5;)a--,o=e.codePointAt(a-1)}return a>r?e.slice(r,a):""}function c8(e,t){const n={type:"text",value:o8(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function u8(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const d8={blockquote:FM,break:UM,code:IM,delete:HM,emphasis:qM,footnoteReference:VM,heading:GM,html:YM,imageReference:WM,image:QM,inlineCode:XM,linkReference:KM,link:ZM,listItem:JM,list:t8,paragraph:n8,root:r8,strong:s8,table:i8,tableCell:l8,tableRow:a8,text:c8,thematicBreak:u8,toml:Bd,yaml:Bd,definition:Bd,footnoteDefinition:Bd};function Bd(){}const HS=-1,Gh=0,Oc=1,Dh=2,tv=3,nv=4,rv=5,sv=6,qS=7,VS=8,{defineProperty:h8}=Object,GS=typeof self=="object"?self:globalThis,v5=(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 GS[e](t)},f8=(e,t)=>{const n=(a,o)=>(e.set(o,a),a),r=a=>{if(e.has(a))return e.get(a);const[o,u]=t[a];switch(o){case Gh:case HS:return n(u,a);case Oc:{const h=n([],a);for(const f of u)h.push(r(f));return h}case Dh:{const h=n({},a);for(const[f,p]of u){const m=r(f),x=r(p);m==="__proto__"?h8(h,m,{value:x,configurable:!0,enumerable:!0,writable:!0}):h[m]=x}return h}case tv:return n(new Date(u),a);case nv:{const{source:h,flags:f}=u;return n(new RegExp(h,f),a)}case rv:{const h=n(new Map,a);for(const[f,p]of u)h.set(r(f),r(p));return h}case sv:{const h=n(new Set,a);for(const f of u)h.add(r(f));return h}case qS:{const{name:h,message:f}=u;return n(typeof GS[h]=="function"?v5(h,f):new Error(f),a)}case VS:return n(BigInt(u),a);case"BigInt":return n(Object(BigInt(u)),a);case"ArrayBuffer":return n(new Uint8Array(u).buffer,u);case"DataView":{const{buffer:h}=new Uint8Array(u);return n(new DataView(h),u)}case"-0":return-0}return n(v5(o,u),a)};return r},b5=e=>f8(new Map,e)(0),Ta="",{toString:p8}={},{keys:m8,is:g8}=Object,vc=e=>{const t=typeof e;if(t!=="object"||!e)return[Gh,t];const n=p8.call(e).slice(8,-1);switch(n){case"Array":return[Oc,Ta];case"Object":return[Dh,Ta];case"Date":return[tv,Ta];case"RegExp":return[nv,Ta];case"Map":return[rv,Ta];case"Set":return[sv,Ta];case"DataView":return[Oc,n]}return n.includes("Array")?[Oc,n]:e instanceof Error?[qS,e.name||"Error"]:[Dh,n]},Pd=([e,t])=>e===Gh&&(t==="function"||t==="symbol"),x8=(e,t,n,r)=>{const a=(u,h)=>{const f=r.push(u)-1;return n.set(h,f),f},o=u=>{if(n.has(u))return n.get(u);let[h,f]=vc(u);switch(h){case Gh:{let m=u;switch(f){case"bigint":h=VS,m=u.toString();break;case"number":if(!u&&g8(u,-0))return r.push(["-0"])-1;break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+f);m=null;break;case"undefined":return a([HS],u)}return a([h,m],u)}case Oc:{if(f){let b=u;return f==="DataView"?b=new Uint8Array(u.buffer):f==="ArrayBuffer"&&(b=new Uint8Array(u)),a([f,[...b]],u)}const m=[],x=a([h,m],u);for(const b of u)m.push(o(b));return x}case Dh:{if(f)switch(f){case"BigInt":return a([f,u.toString()],u);case"Boolean":case"Number":case"String":return a([f,u.valueOf()],u)}if(t&&"toJSON"in u)return o(u.toJSON());const m=[],x=a([h,m],u);for(const b of m8(u))(e||!Pd(vc(u[b])))&&m.push([o(b),o(u[b])]);return x}case tv:return a([h,isNaN(u.getTime())?Ta:u.toISOString()],u);case nv:{const{source:m,flags:x}=u;return a([h,{source:m,flags:x}],u)}case rv:{const m=[],x=a([h,m],u);for(const[b,y]of u)(e||!(Pd(vc(b))||Pd(vc(y))))&&m.push([o(b),o(y)]);return x}case sv:{const m=[],x=a([h,m],u);for(const b of u)(e||!Pd(vc(b)))&&m.push(o(b));return x}}const{message:p}=u;return a([h,{name:f,message:p}],u)};return o},y5=(e,{json:t,lossy:n}={})=>{const r=[];return x8(!(t||n),!!t,new Map,r)(e),r},Lh=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?b5(y5(e,t)):structuredClone(e):(e,t)=>b5(y5(e,t));function v8(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 b8(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function y8(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||v8,r=e.options.footnoteBackLabel||b8,a=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",u=e.options.footnoteLabelProperties||{className:["sr-only"]},h=[];let f=-1;for(;++f<e.footnoteOrder.length;){const p=e.footnoteById.get(e.footnoteOrder[f]);if(!p)continue;const m=e.all(p),x=String(p.identifier).toUpperCase(),b=ao(x.toLowerCase());let y=0;const _=[],j=e.footnoteCounts.get(x);for(;j!==void 0&&++y<=j;){_.length>0&&_.push({type:"text",value:" "});let C=typeof n=="string"?n:n(f,y);typeof C=="string"&&(C={type:"text",value:C}),_.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+b+(y>1?"-"+y:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(f,y),className:["data-footnote-backref"]},children:Array.isArray(C)?C:[C]})}const N=m[m.length-1];if(N&&N.type==="element"&&N.tagName==="p"){const C=N.children[N.children.length-1];C&&C.type==="text"?C.value+=" ":N.children.push({type:"text",value:" "}),N.children.push(..._)}else m.push(..._);const w={type:"element",tagName:"li",properties:{id:t+"fn-"+b},children:e.wrap(m,!0)};e.patch(p,w),h.push(w)}if(h.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...Lh(u),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:`
79
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(h,!0)},{type:"text",value:`
80
+ `}]}}const Yh=(function(e){if(e==null)return k8;if(typeof e=="function")return Wh(e);if(typeof e=="object")return Array.isArray(e)?_8(e):w8(e);if(typeof e=="string")return S8(e);throw new Error("Expected function, string, or object as test")});function _8(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Yh(e[n]);return Wh(r);function r(...a){let o=-1;for(;++o<t.length;)if(t[o].apply(this,a))return!0;return!1}}function w8(e){const t=e;return Wh(n);function n(r){const a=r;let o;for(o in e)if(a[o]!==t[o])return!1;return!0}}function S8(e){return Wh(t);function t(n){return n&&n.type===e}}function Wh(e){return t;function t(n,r,a){return!!(j8(n)&&e.call(this,n,typeof r=="number"?r:void 0,a||void 0))}}function k8(){return!0}function j8(e){return e!==null&&typeof e=="object"&&"type"in e}const YS=[],N8=!0,px=!1,C8="skip";function WS(e,t,n,r){let a;typeof t=="function"&&typeof n!="function"?(r=n,n=t):a=t;const o=Yh(a),u=r?-1:1;h(e,void 0,[])();function h(f,p,m){const x=f&&typeof f=="object"?f:{};if(typeof x.type=="string"){const y=typeof x.tagName=="string"?x.tagName:typeof x.name=="string"?x.name:void 0;Object.defineProperty(b,"name",{value:"node ("+(f.type+(y?"<"+y+">":""))+")"})}return b;function b(){let y=YS,_,j,N;if((!t||o(f,p,m[m.length-1]||void 0))&&(y=E8(n(f,m)),y[0]===px))return y;if("children"in f&&f.children){const w=f;if(w.children&&y[0]!==C8)for(j=(r?w.children.length:-1)+u,N=m.concat(w);j>-1&&j<w.children.length;){const C=w.children[j];if(_=h(C,j,N)(),_[0]===px)return _;j=typeof _[1]=="number"?_[1]:j+u}}return y}}}function E8(e){return Array.isArray(e)?e:typeof e=="number"?[N8,e]:e==null?YS:[e]}function iv(e,t,n,r){let a,o,u;typeof t=="function"&&typeof n!="function"?(o=void 0,u=t,a=n):(o=t,u=n,a=r),WS(e,o,h,a);function h(f,p){const m=p[p.length-1],x=m?m.children.indexOf(f):void 0;return u(f,x,m)}}const mx={}.hasOwnProperty,A8={};function T8(e,t){const n=t||A8,r=new Map,a=new Map,o=new Map,u={...d8,...n.handlers},h={all:p,applyData:D8,definitionById:r,footnoteById:a,footnoteCounts:o,footnoteOrder:[],handlers:u,one:f,options:n,patch:M8,wrap:R8};return iv(e,function(m){if(m.type==="definition"||m.type==="footnoteDefinition"){const x=m.type==="definition"?r:a,b=String(m.identifier).toUpperCase();x.has(b)||x.set(b,m)}}),h;function f(m,x){const b=m.type,y=h.handlers[b];if(mx.call(h.handlers,b)&&y)return y(h,m,x);if(h.options.passThrough&&h.options.passThrough.includes(b)){if("children"in m){const{children:j,...N}=m,w=Lh(N);return w.children=h.all(m),w}return Lh(m)}return(h.options.unknownHandler||L8)(h,m,x)}function p(m){const x=[];if("children"in m){const b=m.children;let y=-1;for(;++y<b.length;){const _=h.one(b[y],m);if(_){if(y&&b[y-1].type==="break"&&(!Array.isArray(_)&&_.type==="text"&&(_.value=_5(_.value)),!Array.isArray(_)&&_.type==="element")){const j=_.children[0];j&&j.type==="text"&&(j.value=_5(j.value))}Array.isArray(_)?x.push(..._):x.push(_)}}}return x}}function M8(e,t){e.position&&(t.position=xA(e))}function D8(e,t){let n=t;if(e&&e.data){const r=e.data.hName,a=e.data.hChildren,o=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const u="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:u}}n.type==="element"&&o&&Object.assign(n.properties,Lh(o)),"children"in n&&n.children&&a!==null&&a!==void 0&&(n.children=a)}return n}function L8(e,t){const n=t.data||{},r="value"in t&&!(mx.call(n,"hProperties")||mx.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function R8(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
81
+ `});++r<e.length;)r&&n.push({type:"text",value:`
82
+ `}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
83
+ `}),n}function _5(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function w5(e,t){const n=T8(e,t),r=n.one(e,void 0),a=y8(n),o=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return a&&o.children.push({type:"text",value:`
84
+ `},a),o}function z8(e,t){return e&&"run"in e?async function(n,r){const a=w5(n,{file:r,...t});await e.run(a,r)}:function(n,r){return w5(n,{file:r,...e||t})}}function S5(e){if(e)throw e}var Ym,k5;function O8(){if(k5)return Ym;k5=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,a=function(p){return typeof Array.isArray=="function"?Array.isArray(p):t.call(p)==="[object Array]"},o=function(p){if(!p||t.call(p)!=="[object Object]")return!1;var m=e.call(p,"constructor"),x=p.constructor&&p.constructor.prototype&&e.call(p.constructor.prototype,"isPrototypeOf");if(p.constructor&&!m&&!x)return!1;var b;for(b in p);return typeof b>"u"||e.call(p,b)},u=function(p,m){n&&m.name==="__proto__"?n(p,m.name,{enumerable:!0,configurable:!0,value:m.newValue,writable:!0}):p[m.name]=m.newValue},h=function(p,m){if(m==="__proto__")if(e.call(p,m)){if(r)return r(p,m).value}else return;return p[m]};return Ym=function f(){var p,m,x,b,y,_,j=arguments[0],N=1,w=arguments.length,C=!1;for(typeof j=="boolean"&&(C=j,j=arguments[1]||{},N=2),(j==null||typeof j!="object"&&typeof j!="function")&&(j={});N<w;++N)if(p=arguments[N],p!=null)for(m in p)x=h(j,m),b=h(p,m),j!==b&&(C&&b&&(o(b)||(y=a(b)))?(y?(y=!1,_=x&&a(x)?x:[]):_=x&&o(x)?x:{},u(j,{name:m,newValue:f(C,_,b)})):typeof b<"u"&&u(j,{name:m,newValue:b}));return j},Ym}var B8=O8();const Wm=wx(B8);function gx(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 P8(){const e=[],t={run:n,use:r};return t;function n(...a){let o=-1;const u=a.pop();if(typeof u!="function")throw new TypeError("Expected function as last argument, not "+u);h(null,...a);function h(f,...p){const m=e[++o];let x=-1;if(f){u(f);return}for(;++x<a.length;)(p[x]===null||p[x]===void 0)&&(p[x]=a[x]);a=p,m?$8(m,h)(...p):u(null,...p)}}function r(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function $8(e,t){let n;return r;function r(...u){const h=e.length>u.length;let f;h&&u.push(a);try{f=e.apply(this,u)}catch(p){const m=p;if(h&&n)throw m;return a(m)}h||(f&&f.then&&typeof f.then=="function"?f.then(o,a):f instanceof Error?a(f):o(f))}function a(u,...h){n||(n=!0,t(u,...h))}function o(u){a(null,u)}}const ws={basename:F8,dirname:U8,extname:I8,join:H8,sep:"/"};function F8(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');ru(e);let n=0,r=-1,a=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(o){n=a+1;break}}else r<0&&(o=!0,r=a+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let u=-1,h=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(o){n=a+1;break}}else u<0&&(o=!0,u=a+1),h>-1&&(e.codePointAt(a)===t.codePointAt(h--)?h<0&&(r=a):(h=-1,r=u));return n===r?r=u:r<0&&(r=e.length),e.slice(n,r)}function U8(e){if(ru(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function I8(e){ru(e);let t=e.length,n=-1,r=0,a=-1,o=0,u;for(;t--;){const h=e.codePointAt(t);if(h===47){if(u){r=t+1;break}continue}n<0&&(u=!0,n=t+1),h===46?a<0?a=t:o!==1&&(o=1):a>-1&&(o=-1)}return a<0||n<0||o===0||o===1&&a===n-1&&a===r+1?"":e.slice(a,n)}function H8(...e){let t=-1,n;for(;++t<e.length;)ru(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":q8(n)}function q8(e){ru(e);const t=e.codePointAt(0)===47;let n=V8(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function V8(e,t){let n="",r=0,a=-1,o=0,u=-1,h,f;for(;++u<=e.length;){if(u<e.length)h=e.codePointAt(u);else{if(h===47)break;h=47}if(h===47){if(!(a===u-1||o===1))if(a!==u-1&&o===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(f=n.lastIndexOf("/"),f!==n.length-1){f<0?(n="",r=0):(n=n.slice(0,f),r=n.length-1-n.lastIndexOf("/")),a=u,o=0;continue}}else if(n.length>0){n="",r=0,a=u,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(a+1,u):n=e.slice(a+1,u),r=u-a-1;a=u,o=0}else h===46&&o>-1?o++:o=-1}return n}function ru(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const G8={cwd:Y8};function Y8(){return"/"}function xx(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function W8(e){if(typeof e=="string")e=new URL(e);else if(!xx(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 Q8(e)}function Q8(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(t)}const Qm=["history","path","basename","stem","extname","dirname"];class QS{constructor(t){let n;t?xx(t)?n={path:t}:typeof t=="string"||X8(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":G8.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Qm.length;){const o=Qm[r];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let a;for(a in n)Qm.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?ws.basename(this.path):void 0}set basename(t){Km(t,"basename"),Xm(t,"basename"),this.path=ws.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?ws.dirname(this.path):void 0}set dirname(t){j5(this.basename,"dirname"),this.path=ws.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?ws.extname(this.path):void 0}set extname(t){if(Xm(t,"extname"),j5(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=ws.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){xx(t)&&(t=W8(t)),Km(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?ws.basename(this.path,this.extname):void 0}set stem(t){Km(t,"stem"),Xm(t,"stem"),this.path=ws.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const a=this.message(t,n,r);throw a.fatal=!0,a}info(t,n,r){const a=this.message(t,n,r);return a.fatal=void 0,a}message(t,n,r){const a=new Vn(t,n,r);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Xm(e,t){if(e&&e.includes(ws.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+ws.sep+"`")}function Km(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function j5(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function X8(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const K8=(function(e){const r=this.constructor.prototype,a=r[e],o=function(){return a.apply(o,arguments)};return Object.setPrototypeOf(o,r),o}),Z8={}.hasOwnProperty;class av extends K8{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=P8()}copy(){const t=new av;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Wm(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(eg("data",this.frozen),this.namespace[t]=n,this):Z8.call(this.namespace,t)&&this.namespace[t]||void 0:t?(eg("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const a=n.call(t,...r);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=$d(t),r=this.parser||this.Parser;return Zm("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Zm("process",this.parser||this.Parser),Jm("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(o,u){const h=$d(t),f=r.parse(h);r.run(f,h,function(m,x,b){if(m||!x||!b)return p(m);const y=x,_=r.stringify(y,b);t7(_)?b.value=_:b.result=_,p(m,b)});function p(m,x){m||!x?u(m):o?o(x):n(void 0,x)}}}processSync(t){let n=!1,r;return this.freeze(),Zm("processSync",this.parser||this.Parser),Jm("processSync",this.compiler||this.Compiler),this.process(t,a),C5("processSync","process",n),r;function a(o,u){n=!0,S5(o),r=u}}run(t,n,r){N5(t),this.freeze();const a=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?o(void 0,r):new Promise(o);function o(u,h){const f=$d(n);a.run(t,f,p);function p(m,x,b){const y=x||t;m?h(m):u?u(y):r(void 0,y,b)}}}runSync(t,n){let r=!1,a;return this.run(t,n,o),C5("runSync","run",r),a;function o(u,h){S5(u),a=h,r=!0}}stringify(t,n){this.freeze();const r=$d(n),a=this.compiler||this.Compiler;return Jm("stringify",a),N5(t),a(t,r)}use(t,...n){const r=this.attachers,a=this.namespace;if(eg("use",this.frozen),t!=null)if(typeof t=="function")f(t,n);else if(typeof t=="object")Array.isArray(t)?h(t):u(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function o(p){if(typeof p=="function")f(p,[]);else if(typeof p=="object")if(Array.isArray(p)){const[m,...x]=p;f(m,x)}else u(p);else throw new TypeError("Expected usable value, not `"+p+"`")}function u(p){if(!("plugins"in p)&&!("settings"in p))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");h(p.plugins),p.settings&&(a.settings=Wm(!0,a.settings,p.settings))}function h(p){let m=-1;if(p!=null)if(Array.isArray(p))for(;++m<p.length;){const x=p[m];o(x)}else throw new TypeError("Expected a list of plugins, not `"+p+"`")}function f(p,m){let x=-1,b=-1;for(;++x<r.length;)if(r[x][0]===p){b=x;break}if(b===-1)r.push([p,...m]);else if(m.length>0){let[y,..._]=m;const j=r[b][1];gx(j)&&gx(y)&&(y=Wm(!0,j,y)),r[b]=[p,y,..._]}}}}const J8=new av().freeze();function Zm(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Jm(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function eg(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 N5(e){if(!gx(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function C5(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function $d(e){return e7(e)?e:new QS(e)}function e7(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function t7(e){return typeof e=="string"||n7(e)}function n7(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const r7="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",E5=[],A5={allowDangerousHtml:!0},s7=/^(https?|ircs?|mailto|xmpp)$/i,i7=[{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 lv(e){const t=a7(e),n=l7(e);return o7(t.runSync(t.parse(n),n),e)}function a7(e){const t=e.rehypePlugins||E5,n=e.remarkPlugins||E5,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...A5}:A5;return J8().use($M).use(n).use(z8,r).use(t)}function l7(e){const t=e.children||"",n=new QS;return typeof t=="string"&&(n.value=t),n}function o7(e,t){const n=t.allowedElements,r=t.allowElement,a=t.components,o=t.disallowedElements,u=t.skipHtml,h=t.unwrapDisallowed,f=t.urlTransform||c7;for(const m of i7)Object.hasOwn(t,m.from)&&(""+m.from+(m.to?"use `"+m.to+"` instead":"remove it")+r7+m.id,void 0);return iv(e,p),wA(e,{Fragment:l.Fragment,components:a,ignoreInvalidStyle:!0,jsx:l.jsx,jsxs:l.jsxs,passKeys:!0,passNode:!0});function p(m,x,b){if(m.type==="raw"&&b&&typeof x=="number")return u?b.children.splice(x,1):b.children[x]={type:"text",value:m.value},x;if(m.type==="element"){let y;for(y in qm)if(Object.hasOwn(qm,y)&&Object.hasOwn(m.properties,y)){const _=m.properties[y],j=qm[y];(j===null||j.includes(m.tagName))&&(m.properties[y]=f(String(_||""),y,m))}}if(m.type==="element"){let y=n?!n.includes(m.tagName):o?o.includes(m.tagName):!1;if(!y&&r&&typeof x=="number"&&(y=!r(m,x,b)),y&&b&&typeof x=="number")return h&&m.children?b.children.splice(x,1,...m.children):b.children.splice(x,1),x}}}function c7(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),a=e.indexOf("/");return t===-1||a!==-1&&t>a||n!==-1&&t>n||r!==-1&&t>r||s7.test(e.slice(0,t))?e:""}function T5(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,a=n.indexOf(t);for(;a!==-1;)r++,a=n.indexOf(t,a+t.length);return r}function u7(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function d7(e,t,n){const a=Yh((n||{}).ignore||[]),o=h7(t);let u=-1;for(;++u<o.length;)WS(e,"text",h);function h(p,m){let x=-1,b;for(;++x<m.length;){const y=m[x],_=b?b.children:void 0;if(a(y,_?_.indexOf(y):void 0,b))return;b=y}if(b)return f(p,m)}function f(p,m){const x=m[m.length-1],b=o[u][0],y=o[u][1];let _=0;const N=x.children.indexOf(p);let w=!1,C=[];b.lastIndex=0;let E=b.exec(p.value);for(;E;){const R=E.index,L={index:E.index,input:E.input,stack:[...m,p]};let O=y(...E,L);if(typeof O=="string"&&(O=O.length>0?{type:"text",value:O}:void 0),O===!1?b.lastIndex=R+1:(_!==R&&C.push({type:"text",value:p.value.slice(_,R)}),Array.isArray(O)?C.push(...O):O&&C.push(O),_=R+E[0].length,w=!0),!b.global)break;E=b.exec(p.value)}return w?(_<p.value.length&&C.push({type:"text",value:p.value.slice(_)}),x.children.splice(N,1,...C)):C=[p],N+C.length}}function h7(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const a=n[r];t.push([f7(a[0]),p7(a[1])])}return t}function f7(e){return typeof e=="string"?new RegExp(u7(e),"g"):e}function p7(e){return typeof e=="function"?e:function(){return e}}const tg="phrasing",ng=["autolink","link","image","label"];function m7(){return{transforms:[w7],enter:{literalAutolink:x7,literalAutolinkEmail:rg,literalAutolinkHttp:rg,literalAutolinkWww:rg},exit:{literalAutolink:_7,literalAutolinkEmail:y7,literalAutolinkHttp:v7,literalAutolinkWww:b7}}}function g7(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:tg,notInConstruct:ng},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:tg,notInConstruct:ng},{character:":",before:"[ps]",after:"\\/",inConstruct:tg,notInConstruct:ng}]}}function x7(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function rg(e){this.config.enter.autolinkProtocol.call(this,e)}function v7(e){this.config.exit.autolinkProtocol.call(this,e)}function b7(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 y7(e){this.config.exit.autolinkEmail.call(this,e)}function _7(e){this.exit(e)}function w7(e){d7(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,S7],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),k7]],{ignore:["link","linkReference"]})}function S7(e,t,n,r,a){let o="";if(!XS(a)||(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!j7(n)))return!1;const u=N7(n+r);if(!u[0])return!1;const h={type:"link",title:null,url:o+t+u[0],children:[{type:"text",value:t+u[0]}]};return u[1]?[h,{type:"text",value:u[1]}]:h}function k7(e,t,n,r){return!XS(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function j7(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 N7(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const a=T5(e,"(");let o=T5(e,")");for(;r!==-1&&a>o;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),o++;return[e,n]}function XS(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Oa(n)||qh(n))&&(!t||n!==47)}KS.peek=z7;function C7(){this.buffer()}function E7(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function A7(){this.buffer()}function T7(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function M7(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ls(this.sliceSerialize(e)).toLowerCase(),n.label=t}function D7(e){this.exit(e)}function L7(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ls(this.sliceSerialize(e)).toLowerCase(),n.label=t}function R7(e){this.exit(e)}function z7(){return"["}function KS(e,t,n,r){const a=n.createTracker(r);let o=a.move("[^");const u=n.enter("footnoteReference"),h=n.enter("reference");return o+=a.move(n.safe(n.associationId(e),{after:"]",before:o})),h(),u(),o+=a.move("]"),o}function O7(){return{enter:{gfmFootnoteCallString:C7,gfmFootnoteCall:E7,gfmFootnoteDefinitionLabelString:A7,gfmFootnoteDefinition:T7},exit:{gfmFootnoteCallString:M7,gfmFootnoteCall:D7,gfmFootnoteDefinitionLabelString:L7,gfmFootnoteDefinition:R7}}}function B7(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:KS},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,a,o,u){const h=o.createTracker(u);let f=h.move("[^");const p=o.enter("footnoteDefinition"),m=o.enter("label");return f+=h.move(o.safe(o.associationId(r),{before:f,after:"]"})),m(),f+=h.move("]:"),r.children&&r.children.length>0&&(h.shift(4),f+=h.move((t?`
85
+ `:" ")+o.indentLines(o.containerFlow(r,h.current()),t?ZS:P7))),p(),f}}function P7(e,t,n){return t===0?e:ZS(e,t,n)}function ZS(e,t,n){return(n?"":" ")+e}const $7=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];JS.peek=q7;function F7(){return{canContainEols:["delete"],enter:{strikethrough:I7},exit:{strikethrough:H7}}}function U7(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:$7}],handlers:{delete:JS}}}function I7(e){this.enter({type:"delete",children:[]},e)}function H7(e){this.exit(e)}function JS(e,t,n,r){const a=n.createTracker(r),o=n.enter("strikethrough");let u=a.move("~~");return u+=n.containerPhrasing(e,{...a.current(),before:u,after:"~"}),u+=a.move("~~"),o(),u}function q7(){return"~"}function V7(e){return e.length}function G7(e,t){const n=t||{},r=(n.align||[]).concat(),a=n.stringLength||V7,o=[],u=[],h=[],f=[];let p=0,m=-1;for(;++m<e.length;){const j=[],N=[];let w=-1;for(e[m].length>p&&(p=e[m].length);++w<e[m].length;){const C=Y7(e[m][w]);if(n.alignDelimiters!==!1){const E=a(C);N[w]=E,(f[w]===void 0||E>f[w])&&(f[w]=E)}j.push(C)}u[m]=j,h[m]=N}let x=-1;if(typeof r=="object"&&"length"in r)for(;++x<p;)o[x]=M5(r[x]);else{const j=M5(r);for(;++x<p;)o[x]=j}x=-1;const b=[],y=[];for(;++x<p;){const j=o[x];let N="",w="";j===99?(N=":",w=":"):j===108?N=":":j===114&&(w=":");let C=n.alignDelimiters===!1?1:Math.max(1,f[x]-N.length-w.length);const E=N+"-".repeat(C)+w;n.alignDelimiters!==!1&&(C=N.length+C+w.length,C>f[x]&&(f[x]=C),y[x]=C),b[x]=E}u.splice(1,0,b),h.splice(1,0,y),m=-1;const _=[];for(;++m<u.length;){const j=u[m],N=h[m];x=-1;const w=[];for(;++x<p;){const C=j[x]||"";let E="",R="";if(n.alignDelimiters!==!1){const L=f[x]-(N[x]||0),O=o[x];O===114?E=" ".repeat(L):O===99?L%2?(E=" ".repeat(L/2+.5),R=" ".repeat(L/2-.5)):(E=" ".repeat(L/2),R=E):R=" ".repeat(L)}n.delimiterStart!==!1&&!x&&w.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&C==="")&&(n.delimiterStart!==!1||x)&&w.push(" "),n.alignDelimiters!==!1&&w.push(E),w.push(C),n.alignDelimiters!==!1&&w.push(R),n.padding!==!1&&w.push(" "),(n.delimiterEnd!==!1||x!==p-1)&&w.push("|")}_.push(n.delimiterEnd===!1?w.join("").replace(/ +$/,""):w.join(""))}return _.join(`
86
+ `)}function Y7(e){return e==null?"":String(e)}function M5(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 W7(e,t,n,r){const a=n.enter("blockquote"),o=n.createTracker(r);o.move("> "),o.shift(2);const u=n.indentLines(n.containerFlow(e,o.current()),Q7);return a(),u}function Q7(e,t,n){return">"+(n?"":" ")+e}function X7(e,t){return D5(e,t.inConstruct,!0)&&!D5(e,t.notInConstruct,!1)}function D5(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function L5(e,t,n,r){let a=-1;for(;++a<n.unsafe.length;)if(n.unsafe[a].character===`
87
+ `&&X7(n.stack,n.unsafe[a]))return/[ \t]/.test(r.before)?"":" ";return`\\
88
+ `}function K7(e,t){const n=String(e);let r=n.indexOf(t),a=r,o=0,u=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===a?++o>u&&(u=o):o=1,a=r+t.length,r=n.indexOf(t,a);return u}function Z7(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 J7(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 eD(e,t,n,r){const a=J7(n),o=e.value||"",u=a==="`"?"GraveAccent":"Tilde";if(Z7(e,n)){const x=n.enter("codeIndented"),b=n.indentLines(o,tD);return x(),b}const h=n.createTracker(r),f=a.repeat(Math.max(K7(o,a)+1,3)),p=n.enter("codeFenced");let m=h.move(f);if(e.lang){const x=n.enter(`codeFencedLang${u}`);m+=h.move(n.safe(e.lang,{before:m,after:" ",encode:["`"],...h.current()})),x()}if(e.lang&&e.meta){const x=n.enter(`codeFencedMeta${u}`);m+=h.move(" "),m+=h.move(n.safe(e.meta,{before:m,after:`
89
+ `,encode:["`"],...h.current()})),x()}return m+=h.move(`
90
+ `),o&&(m+=h.move(o+`
91
+ `)),m+=h.move(f),p(),m}function tD(e,t,n){return(n?"":" ")+e}function ov(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 nD(e,t,n,r){const a=ov(n),o=a==='"'?"Quote":"Apostrophe",u=n.enter("definition");let h=n.enter("label");const f=n.createTracker(r);let p=f.move("[");return p+=f.move(n.safe(n.associationId(e),{before:p,after:"]",...f.current()})),p+=f.move("]: "),h(),!e.url||/[\0- \u007F]/.test(e.url)?(h=n.enter("destinationLiteral"),p+=f.move("<"),p+=f.move(n.safe(e.url,{before:p,after:">",...f.current()})),p+=f.move(">")):(h=n.enter("destinationRaw"),p+=f.move(n.safe(e.url,{before:p,after:e.title?" ":`
92
+ `,...f.current()}))),h(),e.title&&(h=n.enter(`title${o}`),p+=f.move(" "+a),p+=f.move(n.safe(e.title,{before:p,after:a,...f.current()})),p+=f.move(a),h()),u(),p}function rD(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 Xc(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Rh(e,t,n){const r=to(e),a=to(t);return r===void 0?a===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}ek.peek=sD;function ek(e,t,n,r){const a=rD(n),o=n.enter("emphasis"),u=n.createTracker(r),h=u.move(a);let f=u.move(n.containerPhrasing(e,{after:a,before:h,...u.current()}));const p=f.charCodeAt(0),m=Rh(r.before.charCodeAt(r.before.length-1),p,a);m.inside&&(f=Xc(p)+f.slice(1));const x=f.charCodeAt(f.length-1),b=Rh(r.after.charCodeAt(0),x,a);b.inside&&(f=f.slice(0,-1)+Xc(x));const y=u.move(a);return o(),n.attentionEncodeSurroundingInfo={after:b.outside,before:m.outside},h+f+y}function sD(e,t,n){return n.options.emphasis||"*"}function iD(e,t){let n=!1;return iv(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,px}),!!((!e.depth||e.depth<3)&&Zx(e)&&(t.options.setext||n))}function aD(e,t,n,r){const a=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(r);if(iD(e,n)){const m=n.enter("headingSetext"),x=n.enter("phrasing"),b=n.containerPhrasing(e,{...o.current(),before:`
93
+ `,after:`
94
+ `});return x(),m(),b+`
95
+ `+(a===1?"=":"-").repeat(b.length-(Math.max(b.lastIndexOf("\r"),b.lastIndexOf(`
96
+ `))+1))}const u="#".repeat(a),h=n.enter("headingAtx"),f=n.enter("phrasing");o.move(u+" ");let p=n.containerPhrasing(e,{before:"# ",after:`
97
+ `,...o.current()});return/^[\t ]/.test(p)&&(p=Xc(p.charCodeAt(0))+p.slice(1)),p=p?u+" "+p:u,n.options.closeAtx&&(p+=" "+u),f(),h(),p}tk.peek=lD;function tk(e){return e.value||""}function lD(){return"<"}nk.peek=oD;function nk(e,t,n,r){const a=ov(n),o=a==='"'?"Quote":"Apostrophe",u=n.enter("image");let h=n.enter("label");const f=n.createTracker(r);let p=f.move("![");return p+=f.move(n.safe(e.alt,{before:p,after:"]",...f.current()})),p+=f.move("]("),h(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(h=n.enter("destinationLiteral"),p+=f.move("<"),p+=f.move(n.safe(e.url,{before:p,after:">",...f.current()})),p+=f.move(">")):(h=n.enter("destinationRaw"),p+=f.move(n.safe(e.url,{before:p,after:e.title?" ":")",...f.current()}))),h(),e.title&&(h=n.enter(`title${o}`),p+=f.move(" "+a),p+=f.move(n.safe(e.title,{before:p,after:a,...f.current()})),p+=f.move(a),h()),p+=f.move(")"),u(),p}function oD(){return"!"}rk.peek=cD;function rk(e,t,n,r){const a=e.referenceType,o=n.enter("imageReference");let u=n.enter("label");const h=n.createTracker(r);let f=h.move("![");const p=n.safe(e.alt,{before:f,after:"]",...h.current()});f+=h.move(p+"]["),u();const m=n.stack;n.stack=[],u=n.enter("reference");const x=n.safe(n.associationId(e),{before:f,after:"]",...h.current()});return u(),n.stack=m,o(),a==="full"||!p||p!==x?f+=h.move(x+"]"):a==="shortcut"?f=f.slice(0,-1):f+=h.move("]"),f}function cD(){return"!"}sk.peek=uD;function sk(e,t,n){let r=e.value||"",a="`",o=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(r);)a+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++o<n.unsafe.length;){const u=n.unsafe[o],h=n.compilePattern(u);let f;if(u.atBreak)for(;f=h.exec(r);){let p=f.index;r.charCodeAt(p)===10&&r.charCodeAt(p-1)===13&&p--,r=r.slice(0,p)+" "+r.slice(f.index+1)}}return a+r+a}function uD(){return"`"}function ik(e,t){const n=Zx(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))}ak.peek=dD;function ak(e,t,n,r){const a=ov(n),o=a==='"'?"Quote":"Apostrophe",u=n.createTracker(r);let h,f;if(ik(e,n)){const m=n.stack;n.stack=[],h=n.enter("autolink");let x=u.move("<");return x+=u.move(n.containerPhrasing(e,{before:x,after:">",...u.current()})),x+=u.move(">"),h(),n.stack=m,x}h=n.enter("link"),f=n.enter("label");let p=u.move("[");return p+=u.move(n.containerPhrasing(e,{before:p,after:"](",...u.current()})),p+=u.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),p+=u.move("<"),p+=u.move(n.safe(e.url,{before:p,after:">",...u.current()})),p+=u.move(">")):(f=n.enter("destinationRaw"),p+=u.move(n.safe(e.url,{before:p,after:e.title?" ":")",...u.current()}))),f(),e.title&&(f=n.enter(`title${o}`),p+=u.move(" "+a),p+=u.move(n.safe(e.title,{before:p,after:a,...u.current()})),p+=u.move(a),f()),p+=u.move(")"),h(),p}function dD(e,t,n){return ik(e,n)?"<":"["}lk.peek=hD;function lk(e,t,n,r){const a=e.referenceType,o=n.enter("linkReference");let u=n.enter("label");const h=n.createTracker(r);let f=h.move("[");const p=n.containerPhrasing(e,{before:f,after:"]",...h.current()});f+=h.move(p+"]["),u();const m=n.stack;n.stack=[],u=n.enter("reference");const x=n.safe(n.associationId(e),{before:f,after:"]",...h.current()});return u(),n.stack=m,o(),a==="full"||!p||p!==x?f+=h.move(x+"]"):a==="shortcut"?f=f.slice(0,-1):f+=h.move("]"),f}function hD(){return"["}function cv(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 fD(e){const t=cv(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 pD(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 ok(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 mD(e,t,n,r){const a=n.enter("list"),o=n.bulletCurrent;let u=e.ordered?pD(n):cv(n);const h=e.ordered?u==="."?")":".":fD(n);let f=t&&n.bulletLastUsed?u===n.bulletLastUsed:!1;if(!e.ordered){const m=e.children?e.children[0]:void 0;if((u==="*"||u==="-")&&m&&(!m.children||!m.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(f=!0),ok(n)===u&&m){let x=-1;for(;++x<e.children.length;){const b=e.children[x];if(b&&b.type==="listItem"&&b.children&&b.children[0]&&b.children[0].type==="thematicBreak"){f=!0;break}}}}f&&(u=h),n.bulletCurrent=u;const p=n.containerFlow(e,r);return n.bulletLastUsed=u,n.bulletCurrent=o,a(),p}function gD(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 xD(e,t,n,r){const a=gD(n);let o=n.bulletCurrent||cv(n);t&&t.type==="list"&&t.ordered&&(o=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let u=o.length+1;(a==="tab"||a==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(u=Math.ceil(u/4)*4);const h=n.createTracker(r);h.move(o+" ".repeat(u-o.length)),h.shift(u);const f=n.enter("listItem"),p=n.indentLines(n.containerFlow(e,h.current()),m);return f(),p;function m(x,b,y){return b?(y?"":" ".repeat(u))+x:(y?o:o+" ".repeat(u-o.length))+x}}function vD(e,t,n,r){const a=n.enter("paragraph"),o=n.enter("phrasing"),u=n.containerPhrasing(e,r);return o(),a(),u}const bD=Yh(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function yD(e,t,n,r){return(e.children.some(function(u){return bD(u)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function _D(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}ck.peek=wD;function ck(e,t,n,r){const a=_D(n),o=n.enter("strong"),u=n.createTracker(r),h=u.move(a+a);let f=u.move(n.containerPhrasing(e,{after:a,before:h,...u.current()}));const p=f.charCodeAt(0),m=Rh(r.before.charCodeAt(r.before.length-1),p,a);m.inside&&(f=Xc(p)+f.slice(1));const x=f.charCodeAt(f.length-1),b=Rh(r.after.charCodeAt(0),x,a);b.inside&&(f=f.slice(0,-1)+Xc(x));const y=u.move(a+a);return o(),n.attentionEncodeSurroundingInfo={after:b.outside,before:m.outside},h+f+y}function wD(e,t,n){return n.options.strong||"*"}function SD(e,t,n,r){return n.safe(e.value,r)}function kD(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 jD(e,t,n){const r=(ok(n)+(n.options.ruleSpaces?" ":"")).repeat(kD(n));return n.options.ruleSpaces?r.slice(0,-1):r}const uk={blockquote:W7,break:L5,code:eD,definition:nD,emphasis:ek,hardBreak:L5,heading:aD,html:tk,image:nk,imageReference:rk,inlineCode:sk,link:ak,linkReference:lk,list:mD,listItem:xD,paragraph:vD,root:yD,strong:ck,text:SD,thematicBreak:jD};function ND(){return{enter:{table:CD,tableData:R5,tableHeader:R5,tableRow:AD},exit:{codeText:TD,table:ED,tableData:sg,tableHeader:sg,tableRow:sg}}}function CD(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 ED(e){this.exit(e),this.data.inTable=void 0}function AD(e){this.enter({type:"tableRow",children:[]},e)}function sg(e){this.exit(e)}function R5(e){this.enter({type:"tableCell",children:[]},e)}function TD(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,MD));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function MD(e,t){return t==="|"?t:e}function DD(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,a=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
98
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:b,table:u,tableCell:f,tableRow:h}};function u(y,_,j,N){return p(m(y,j,N),y.align)}function h(y,_,j,N){const w=x(y,j,N),C=p([w]);return C.slice(0,C.indexOf(`
99
+ `))}function f(y,_,j,N){const w=j.enter("tableCell"),C=j.enter("phrasing"),E=j.containerPhrasing(y,{...N,before:o,after:o});return C(),w(),E}function p(y,_){return G7(y,{align:_,alignDelimiters:r,padding:n,stringLength:a})}function m(y,_,j){const N=y.children;let w=-1;const C=[],E=_.enter("table");for(;++w<N.length;)C[w]=x(N[w],_,j);return E(),C}function x(y,_,j){const N=y.children;let w=-1;const C=[],E=_.enter("tableRow");for(;++w<N.length;)C[w]=f(N[w],y,_,j);return E(),C}function b(y,_,j){let N=uk.inlineCode(y,_,j);return j.stack.includes("tableCell")&&(N=N.replace(/\|/g,"\\$&")),N}}function LD(){return{exit:{taskListCheckValueChecked:z5,taskListCheckValueUnchecked:z5,paragraph:zD}}}function RD(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:OD}}}function z5(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function zD(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const a=t.children;let o=-1,u;for(;++o<a.length;){const h=a[o];if(h.type==="paragraph"){u=h;break}}u===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function OD(e,t,n,r){const a=e.children[0],o=typeof e.checked=="boolean"&&a&&a.type==="paragraph",u="["+(e.checked?"x":" ")+"] ",h=n.createTracker(r);o&&h.move(u);let f=uk.listItem(e,t,n,{...r,...h.current()});return o&&(f=f.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,p)),f;function p(m){return m+u}}function BD(){return[m7(),O7(),F7(),ND(),LD()]}function PD(e){return{extensions:[g7(),B7(e),U7(),DD(e),RD()]}}const $D={tokenize:VD,partial:!0},dk={tokenize:GD,partial:!0},hk={tokenize:YD,partial:!0},fk={tokenize:WD,partial:!0},FD={tokenize:QD,partial:!0},pk={name:"wwwAutolink",tokenize:HD,previous:gk},mk={name:"protocolAutolink",tokenize:qD,previous:xk},ii={name:"emailAutolink",tokenize:ID,previous:vk},Cs={};function UD(){return{text:Cs}}let ja=48;for(;ja<123;)Cs[ja]=ii,ja++,ja===58?ja=65:ja===91&&(ja=97);Cs[43]=ii;Cs[45]=ii;Cs[46]=ii;Cs[95]=ii;Cs[72]=[ii,mk];Cs[104]=[ii,mk];Cs[87]=[ii,pk];Cs[119]=[ii,pk];function ID(e,t,n){const r=this;let a,o;return u;function u(x){return!vx(x)||!vk.call(r,r.previous)||uv(r.events)?n(x):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),h(x))}function h(x){return vx(x)?(e.consume(x),h):x===64?(e.consume(x),f):n(x)}function f(x){return x===46?e.check(FD,m,p)(x):x===45||x===95||Hn(x)?(o=!0,e.consume(x),f):m(x)}function p(x){return e.consume(x),a=!0,f}function m(x){return o&&a&&Zn(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(x)):n(x)}}function HD(e,t,n){const r=this;return a;function a(u){return u!==87&&u!==119||!gk.call(r,r.previous)||uv(r.events)?n(u):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check($D,e.attempt(dk,e.attempt(hk,o),n),n)(u))}function o(u){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(u)}}function qD(e,t,n){const r=this;let a="",o=!1;return u;function u(x){return(x===72||x===104)&&xk.call(r,r.previous)&&!uv(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(x),e.consume(x),h):n(x)}function h(x){if(Zn(x)&&a.length<5)return a+=String.fromCodePoint(x),e.consume(x),h;if(x===58){const b=a.toLowerCase();if(b==="http"||b==="https")return e.consume(x),f}return n(x)}function f(x){return x===47?(e.consume(x),o?p:(o=!0,f)):n(x)}function p(x){return x===null||Mh(x)||It(x)||Oa(x)||qh(x)?n(x):e.attempt(dk,e.attempt(hk,m),n)(x)}function m(x){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(x)}}function VD(e,t,n){let r=0;return a;function a(u){return(u===87||u===119)&&r<3?(r++,e.consume(u),a):u===46&&r===3?(e.consume(u),o):n(u)}function o(u){return u===null?n(u):t(u)}}function GD(e,t,n){let r,a,o;return u;function u(p){return p===46||p===95?e.check(fk,f,h)(p):p===null||It(p)||Oa(p)||p!==45&&qh(p)?f(p):(o=!0,e.consume(p),u)}function h(p){return p===95?r=!0:(a=r,r=void 0),e.consume(p),u}function f(p){return a||r||!o?n(p):t(p)}}function YD(e,t){let n=0,r=0;return a;function a(u){return u===40?(n++,e.consume(u),a):u===41&&r<n?o(u):u===33||u===34||u===38||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===60||u===63||u===93||u===95||u===126?e.check(fk,t,o)(u):u===null||It(u)||Oa(u)?t(u):(e.consume(u),a)}function o(u){return u===41&&r++,e.consume(u),a}}function WD(e,t,n){return r;function r(h){return h===33||h===34||h===39||h===41||h===42||h===44||h===46||h===58||h===59||h===63||h===95||h===126?(e.consume(h),r):h===38?(e.consume(h),o):h===93?(e.consume(h),a):h===60||h===null||It(h)||Oa(h)?t(h):n(h)}function a(h){return h===null||h===40||h===91||It(h)||Oa(h)?t(h):r(h)}function o(h){return Zn(h)?u(h):n(h)}function u(h){return h===59?(e.consume(h),r):Zn(h)?(e.consume(h),u):n(h)}}function QD(e,t,n){return r;function r(o){return e.consume(o),a}function a(o){return Hn(o)?n(o):t(o)}}function gk(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||It(e)}function xk(e){return!Zn(e)}function vk(e){return!(e===47||vx(e))}function vx(e){return e===43||e===45||e===46||e===95||Hn(e)}function uv(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const XD={tokenize:sL,partial:!0};function KD(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:tL,continuation:{tokenize:nL},exit:rL}},text:{91:{name:"gfmFootnoteCall",tokenize:eL},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:ZD,resolveTo:JD}}}}function ZD(e,t,n){const r=this;let a=r.events.length;const o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let u;for(;a--;){const f=r.events[a][1];if(f.type==="labelImage"){u=f;break}if(f.type==="gfmFootnoteCall"||f.type==="labelLink"||f.type==="label"||f.type==="image"||f.type==="link")break}return h;function h(f){if(!u||!u._balanced)return n(f);const p=ls(r.sliceSerialize({start:u.end,end:r.now()}));return p.codePointAt(0)!==94||!o.includes(p.slice(1))?n(f):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),t(f))}}function JD(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},u={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},h=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",a,t],["exit",a,t],["enter",o,t],["enter",u,t],["exit",u,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...h),e}function eL(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o=0,u;return h;function h(x){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(x),e.exit("gfmFootnoteCallLabelMarker"),f}function f(x){return x!==94?n(x):(e.enter("gfmFootnoteCallMarker"),e.consume(x),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",p)}function p(x){if(o>999||x===93&&!u||x===null||x===91||It(x))return n(x);if(x===93){e.exit("chunkString");const b=e.exit("gfmFootnoteCallString");return a.includes(ls(r.sliceSerialize(b)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(x),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(x)}return It(x)||(u=!0),o++,e.consume(x),x===92?m:p}function m(x){return x===91||x===92||x===93?(e.consume(x),o++,p):p(x)}}function tL(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,u=0,h;return f;function f(_){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(_),e.exit("gfmFootnoteDefinitionLabelMarker"),p}function p(_){return _===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(_),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",m):n(_)}function m(_){if(u>999||_===93&&!h||_===null||_===91||It(_))return n(_);if(_===93){e.exit("chunkString");const j=e.exit("gfmFootnoteDefinitionLabelString");return o=ls(r.sliceSerialize(j)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(_),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),b}return It(_)||(h=!0),u++,e.consume(_),_===92?x:m}function x(_){return _===91||_===92||_===93?(e.consume(_),u++,m):m(_)}function b(_){return _===58?(e.enter("definitionMarker"),e.consume(_),e.exit("definitionMarker"),a.includes(o)||a.push(o),bt(e,y,"gfmFootnoteDefinitionWhitespace")):n(_)}function y(_){return t(_)}}function nL(e,t,n){return e.check(nu,t,e.attempt(XD,t,n))}function rL(e){e.exit("gfmFootnoteDefinition")}function sL(e,t,n){const r=this;return bt(e,a,"gfmFootnoteDefinitionIndent",5);function a(o){const u=r.events[r.events.length-1];return u&&u[1].type==="gfmFootnoteDefinitionIndent"&&u[2].sliceSerialize(u[1],!0).length===4?t(o):n(o)}}function iL(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:o,resolveAll:a};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function a(u,h){let f=-1;for(;++f<u.length;)if(u[f][0]==="enter"&&u[f][1].type==="strikethroughSequenceTemporary"&&u[f][1]._close){let p=f;for(;p--;)if(u[p][0]==="exit"&&u[p][1].type==="strikethroughSequenceTemporary"&&u[p][1]._open&&u[f][1].end.offset-u[f][1].start.offset===u[p][1].end.offset-u[p][1].start.offset){u[f][1].type="strikethroughSequence",u[p][1].type="strikethroughSequence";const m={type:"strikethrough",start:Object.assign({},u[p][1].start),end:Object.assign({},u[f][1].end)},x={type:"strikethroughText",start:Object.assign({},u[p][1].end),end:Object.assign({},u[f][1].start)},b=[["enter",m,h],["enter",u[p][1],h],["exit",u[p][1],h],["enter",x,h]],y=h.parser.constructs.insideSpan.null;y&&Cr(b,b.length,0,Vh(y,u.slice(p+1,f),h)),Cr(b,b.length,0,[["exit",x,h],["enter",u[f][1],h],["exit",u[f][1],h],["exit",m,h]]),Cr(u,p-1,f-p+3,b),f=p+b.length-2;break}}for(f=-1;++f<u.length;)u[f][1].type==="strikethroughSequenceTemporary"&&(u[f][1].type="data");return u}function o(u,h,f){const p=this.previous,m=this.events;let x=0;return b;function b(_){return p===126&&m[m.length-1][1].type!=="characterEscape"?f(_):(u.enter("strikethroughSequenceTemporary"),y(_))}function y(_){const j=to(p);if(_===126)return x>1?f(_):(u.consume(_),x++,y);if(x<2&&!n)return f(_);const N=u.exit("strikethroughSequenceTemporary"),w=to(_);return N._open=!w||w===2&&!!j,N._close=!j||j===2&&!!w,h(_)}}}class aL{constructor(){this.map=[]}add(t,n,r){lL(this,t,n,r)}consume(t){if(this.map.sort(function(o,u){return o[0]-u[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let a=r.pop();for(;a;){for(const o of a)t.push(o);a=r.pop()}this.map.length=0}}function lL(e,t,n,r){let a=0;if(!(n===0&&r.length===0)){for(;a<e.map.length;){if(e.map[a][0]===t){e.map[a][1]+=n,e.map[a][2].push(...r);return}a+=1}e.map.push([t,n,r])}}function oL(e,t){let n=!1;const r=[];for(;t<e.length;){const a=e[t];if(n){if(a[0]==="enter")a[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(a[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const o=r.length-1;r[o]=r[o]==="left"?"center":"right"}}else if(a[1].type==="tableDelimiterRow")break}else a[0]==="enter"&&a[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function cL(){return{flow:{null:{name:"table",tokenize:uL,resolveAll:dL}}}}function uL(e,t,n){const r=this;let a=0,o=0,u;return h;function h(z){let I=r.events.length-1;for(;I>-1;){const Z=r.events[I][1].type;if(Z==="lineEnding"||Z==="linePrefix")I--;else break}const A=I>-1?r.events[I][1].type:null,X=A==="tableHead"||A==="tableRow"?O:f;return X===O&&r.parser.lazy[r.now().line]?n(z):X(z)}function f(z){return e.enter("tableHead"),e.enter("tableRow"),p(z)}function p(z){return z===124||(u=!0,o+=1),m(z)}function m(z){return z===null?n(z):Ue(z)?o>1?(o=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),y):n(z):ut(z)?bt(e,m,"whitespace")(z):(o+=1,u&&(u=!1,a+=1),z===124?(e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),u=!0,m):(e.enter("data"),x(z)))}function x(z){return z===null||z===124||It(z)?(e.exit("data"),m(z)):(e.consume(z),z===92?b:x)}function b(z){return z===92||z===124?(e.consume(z),x):x(z)}function y(z){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(z):(e.enter("tableDelimiterRow"),u=!1,ut(z)?bt(e,_,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):_(z))}function _(z){return z===45||z===58?N(z):z===124?(u=!0,e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),j):L(z)}function j(z){return ut(z)?bt(e,N,"whitespace")(z):N(z)}function N(z){return z===58?(o+=1,u=!0,e.enter("tableDelimiterMarker"),e.consume(z),e.exit("tableDelimiterMarker"),w):z===45?(o+=1,w(z)):z===null||Ue(z)?R(z):L(z)}function w(z){return z===45?(e.enter("tableDelimiterFiller"),C(z)):L(z)}function C(z){return z===45?(e.consume(z),C):z===58?(u=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(z),e.exit("tableDelimiterMarker"),E):(e.exit("tableDelimiterFiller"),E(z))}function E(z){return ut(z)?bt(e,R,"whitespace")(z):R(z)}function R(z){return z===124?_(z):z===null||Ue(z)?!u||a!==o?L(z):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(z)):L(z)}function L(z){return n(z)}function O(z){return e.enter("tableRow"),q(z)}function q(z){return z===124?(e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),q):z===null||Ue(z)?(e.exit("tableRow"),t(z)):ut(z)?bt(e,q,"whitespace")(z):(e.enter("data"),F(z))}function F(z){return z===null||z===124||It(z)?(e.exit("data"),q(z)):(e.consume(z),z===92?W:F)}function W(z){return z===92||z===124?(e.consume(z),F):F(z)}}function dL(e,t){let n=-1,r=!0,a=0,o=[0,0,0,0],u=[0,0,0,0],h=!1,f=0,p,m,x;const b=new aL;for(;++n<e.length;){const y=e[n],_=y[1];y[0]==="enter"?_.type==="tableHead"?(h=!1,f!==0&&(O5(b,t,f,p,m),m=void 0,f=0),p={type:"table",start:Object.assign({},_.start),end:Object.assign({},_.end)},b.add(n,0,[["enter",p,t]])):_.type==="tableRow"||_.type==="tableDelimiterRow"?(r=!0,x=void 0,o=[0,0,0,0],u=[0,n+1,0,0],h&&(h=!1,m={type:"tableBody",start:Object.assign({},_.start),end:Object.assign({},_.end)},b.add(n,0,[["enter",m,t]])),a=_.type==="tableDelimiterRow"?2:m?3:1):a&&(_.type==="data"||_.type==="tableDelimiterMarker"||_.type==="tableDelimiterFiller")?(r=!1,u[2]===0&&(o[1]!==0&&(u[0]=u[1],x=Fd(b,t,o,a,void 0,x),o=[0,0,0,0]),u[2]=n)):_.type==="tableCellDivider"&&(r?r=!1:(o[1]!==0&&(u[0]=u[1],x=Fd(b,t,o,a,void 0,x)),o=u,u=[o[1],n,0,0])):_.type==="tableHead"?(h=!0,f=n):_.type==="tableRow"||_.type==="tableDelimiterRow"?(f=n,o[1]!==0?(u[0]=u[1],x=Fd(b,t,o,a,n,x)):u[1]!==0&&(x=Fd(b,t,u,a,n,x)),a=0):a&&(_.type==="data"||_.type==="tableDelimiterMarker"||_.type==="tableDelimiterFiller")&&(u[3]=n)}for(f!==0&&O5(b,t,f,p,m),b.consume(t.events),n=-1;++n<t.events.length;){const y=t.events[n];y[0]==="enter"&&y[1].type==="table"&&(y[1]._align=oL(t.events,n))}return e}function Fd(e,t,n,r,a,o){const u=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",h="tableContent";n[0]!==0&&(o.end=Object.assign({},Bl(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const f=Bl(t.events,n[1]);if(o={type:u,start:Object.assign({},f),end:Object.assign({},f)},e.add(n[1],0,[["enter",o,t]]),n[2]!==0){const p=Bl(t.events,n[2]),m=Bl(t.events,n[3]),x={type:h,start:Object.assign({},p),end:Object.assign({},m)};if(e.add(n[2],0,[["enter",x,t]]),r!==2){const b=t.events[n[2]],y=t.events[n[3]];if(b[1].end=Object.assign({},y[1].end),b[1].type="chunkText",b[1].contentType="text",n[3]>n[2]+1){const _=n[2]+1,j=n[3]-n[2]-1;e.add(_,j,[])}}e.add(n[3]+1,0,[["exit",x,t]])}return a!==void 0&&(o.end=Object.assign({},Bl(t.events,a)),e.add(a,0,[["exit",o,t]]),o=void 0),o}function O5(e,t,n,r,a){const o=[],u=Bl(t.events,n);a&&(a.end=Object.assign({},u),o.push(["exit",a,t])),r.end=Object.assign({},u),o.push(["exit",r,t]),e.add(n+1,0,o)}function Bl(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const hL={name:"tasklistCheck",tokenize:pL};function fL(){return{text:{91:hL}}}function pL(e,t,n){const r=this;return a;function a(f){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(f):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(f),e.exit("taskListCheckMarker"),o)}function o(f){return It(f)?(e.enter("taskListCheckValueUnchecked"),e.consume(f),e.exit("taskListCheckValueUnchecked"),u):f===88||f===120?(e.enter("taskListCheckValueChecked"),e.consume(f),e.exit("taskListCheckValueChecked"),u):n(f)}function u(f){return f===93?(e.enter("taskListCheckMarker"),e.consume(f),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),h):n(f)}function h(f){return Ue(f)?t(f):ut(f)?e.check({tokenize:mL},t,n)(f):n(f)}}function mL(e,t,n){return bt(e,r,"whitespace");function r(a){return a===null?n(a):t(a)}}function gL(e){return ES([UD(),KD(),iL(e),cL(),fL()])}const xL={};function dv(e){const t=this,n=e||xL,r=t.data(),a=r.micromarkExtensions||(r.micromarkExtensions=[]),o=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),u=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);a.push(gL(n)),o.push(BD()),u.push(PD(n))}const vL=1500;async function bL(e){var r;try{if(typeof navigator<"u"&&((r=navigator.clipboard)!=null&&r.writeText))return await navigator.clipboard.writeText(e),!0}catch{}if(typeof document>"u")return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();let n=!1;try{n=document.execCommand("copy")}catch{n=!1}return document.body.removeChild(t),n}function Qh({text:e,label:t="Copy",className:n=""}){const[r,a]=k.useState(!1),o=k.useRef(null);k.useEffect(()=>()=>{o.current&&clearTimeout(o.current)},[]);const u=async()=>{await bL(e)&&(a(!0),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>a(!1),vL))},h=r?"Copied":t;return l.jsx("button",{type:"button",onClick:u,"aria-label":h,title:h,className:`inline-flex items-center justify-center w-6 h-6 rounded text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors ${n}`,children:r?l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:"w-3.5 h-3.5 text-cc-success","aria-hidden":"true",children:l.jsx("path",{d:"M3.5 8.5l3 3 6-7"})}):l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round",className:"w-3.5 h-3.5","aria-hidden":"true",children:[l.jsx("rect",{x:"5",y:"5",width:"8",height:"9",rx:"1.25"}),l.jsx("path",{d:"M10.5 5V3.75A.75.75 0 009.75 3H3.75A.75.75 0 003 3.75v6a.75.75 0 00.75.75H5"})]})})}function zh(e){var t;return e==null||typeof e=="boolean"?"":typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(zh).join(""):typeof e=="object"&&e!==null&&"props"in e?zh((t=e.props)==null?void 0:t.children):""}const ig=/https?:\/\/[^\s<>"'`]+/gi,yL=`.,;:!?]}>'"`;function _L(e){let t=e.length;for(;t>0;){const n=e[t-1];if(n===")"){const r=e.slice(0,t),a=(r.match(/\(/g)||[]).length,o=(r.match(/\)/g)||[]).length;if(a>=o)break;t--;continue}if(yL.includes(n)){t--;continue}break}return e.slice(0,t)}function wL(e){return/^https?:\/\/[^\s/]/i.test(e)}function SL(e){if(!e)return[];const t=[];let n=0;ig.lastIndex=0;let r;for(;(r=ig.exec(e))!==null;){const a=_L(r[0]);!a||!wL(a)||(r.index>n&&t.push({type:"text",value:e.slice(n,r.index)}),t.push({type:"link",value:a,href:a}),n=r.index+a.length,ig.lastIndex=n)}return n<e.length&&t.push({type:"text",value:e.slice(n)}),t}const B5=40;function kL(e){const t=e.replace(/\s+/g," ").trim();return t?`Copy ${t.length>B5?`${t.slice(0,B5-1)}…`:t}`:"Copy"}function bk({children:e,className:t="",textClassName:n="text-[12.5px] text-cc-fg/80"}){const r=zh(e);if(!r)return l.jsx("code",{className:`px-1.5 py-0.5 rounded-md bg-cc-fg/[0.06] font-mono-code border border-cc-border/40 ${n} ${t}`,children:e});const a=SL(r);return l.jsxs("span",{className:`inline-flex items-center align-middle max-w-full gap-1 pl-1.5 pr-1 py-0.5 rounded-md bg-cc-fg/[0.06] border border-cc-border/40 ${t}`,children:[l.jsx("code",{className:`min-w-0 break-all font-mono-code ${n}`,children:a.map((o,u)=>o.type==="link"?l.jsx("a",{href:o.href,target:"_blank",rel:"noopener noreferrer",className:"text-cc-primary underline decoration-cc-primary/40 hover:decoration-cc-primary",children:o.value},u):l.jsx("span",{children:o.value},u))}),l.jsx(Qh,{text:r,label:kL(r),className:"shrink-0 self-center w-4 h-4 -my-0.5 opacity-60 hover:opacity-100"})]})}const Oh=25*1024*1024,Bh=100*1024*1024;function yk(e){return new Promise((t,n)=>{const r=new FileReader;r.onload=()=>{const o=r.result.split(",")[1],u=e.type||"application/octet-stream";t({base64:o,mediaType:u})},r.onerror=n,r.readAsDataURL(e)})}function Hi(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 _k(e){return e.startsWith("image/")}function wk({name:e,mediaType:t}){const n=(e.split(".").pop()||"").toLowerCase();let r="FILE";return t==="application/pdf"||n==="pdf"?r="PDF":["zip","tar","gz","tgz","bz2","xz","7z","rar"].includes(n)?r="ZIP":["csv","tsv"].includes(n)?r="CSV":["json","yaml","yml","toml","xml"].includes(n)?r="DATA":["md","txt","log"].includes(n)?r="TXT":["doc","docx","rtf","odt"].includes(n)?r="DOC":["xls","xlsx","ods"].includes(n)?r="XLS":["mp3","wav","ogg","flac","m4a"].includes(n)?r="AUD":["mp4","mov","webm","mkv","avi"].includes(n)?r="VID":n&&(r=n.slice(0,4).toUpperCase()),l.jsxs("div",{className:"flex flex-col items-center justify-center w-full h-full bg-cc-hover/60 text-cc-muted",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.2",className:"w-4 h-4 mb-0.5",children:[l.jsx("path",{d:"M3 1.75h6.5L13 5.25v9A1.25 1.25 0 0 1 11.75 15.5h-7.5A1.25 1.25 0 0 1 3 14.25V1.75z"}),l.jsx("path",{d:"M9.5 1.75V5.25H13"})]}),l.jsx("span",{className:"text-[8px] font-mono-code tracking-tight",children:r})]})}function Sk({name:e,mediaType:t,base64:n,size:r,onRemove:a,className:o="w-12 h-12"}){const u=_k(t);return l.jsxs("div",{className:"relative group",title:`${e} (${Hi(r)})`,children:[l.jsx("div",{className:`${o} rounded-lg overflow-hidden border border-cc-border`,children:u?l.jsx("img",{src:`data:${t};base64,${n}`,alt:e,className:"w-full h-full object-cover"}):l.jsx(wk,{name:e,mediaType:t})}),a&&l.jsx("button",{onClick:a,"aria-label":`Remove ${e}`,className:"absolute -top-1.5 -right-1.5 w-5 h-5 rounded-full bg-cc-error text-white flex items-center justify-center text-[10px] opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})})]})}function jL({name:e,mediaType:t,data:n,size:r}){return _k(t)?l.jsx("img",{src:`data:${t};base64,${n}`,alt:e||"attachment",className:"max-w-[150px] sm:max-w-[200px] max-h-[120px] sm:max-h-[150px] rounded-xl object-cover border border-cc-border/30"}):l.jsxs("a",{href:`data:${t};base64,${n}`,download:e||"attachment",className:"inline-flex items-center gap-2 px-2.5 py-1.5 rounded-lg border border-cc-border/40 bg-cc-hover/40 hover:bg-cc-hover transition-colors max-w-[260px] no-underline",children:[l.jsx("div",{className:"w-8 h-8 shrink-0 rounded-md overflow-hidden",children:l.jsx(wk,{name:e,mediaType:t})}),l.jsxs("div",{className:"min-w-0 flex flex-col",children:[l.jsx("span",{className:"text-[12px] font-medium text-cc-fg truncate",children:e||"attachment"}),l.jsx("span",{className:"text-[10px] text-cc-muted",children:Hi(r)})]})]})}function NL({message:e}){return e.role==="system"?l.jsxs("div",{className:"flex items-center gap-3 py-1 min-w-0",children:[l.jsx("div",{className:"shrink-0 flex-1 h-px bg-cc-border"}),l.jsx("span",{className:"text-[11px] text-cc-muted italic font-mono-code px-1 min-w-0 break-words text-center",children:e.content}),l.jsx("div",{className:"shrink-0 flex-1 h-px bg-cc-border"})]}):e.role==="user"?l.jsx("div",{className:"flex justify-end animate-[userSlideIn_0.3s_ease-out]",children:l.jsxs("div",{className:"max-w-[85%] sm:max-w-[80%] px-3.5 sm:px-4 py-2.5 rounded-[16px] rounded-br-[6px] user-bubble-gradient text-cc-fg shadow-[0_1px_3px_rgba(0,0,0,0.04)]",children:[e.attachments&&e.attachments.length>0&&l.jsx("div",{className:"flex gap-2 flex-wrap mb-2",children:e.attachments.map((t,n)=>l.jsx(jL,{name:t.name,mediaType:t.media_type,data:t.data,size:t.size},n))}),l.jsx("div",{className:"text-[13px] sm:text-[14px] leading-relaxed break-words",children:l.jsx(hv,{text:e.content})})]})}):l.jsx("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]",children:l.jsx(ML,{message:e})})}function CL(e){const t=[];for(const n of e)if(n.type==="tool_use"){const r=t[t.length-1];(r==null?void 0:r.kind)==="tool_group"&&r.name===n.name?r.items.push({id:n.id,name:n.name,input:n.input}):t.push({kind:"tool_group",name:n.name,items:[{id:n.id,name:n.name,input:n.input}]})}else t.push({kind:"content",block:n});return t}function EL(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 AL(e){return e.kind==="content"&&e.block.type==="thinking"&&!e.block.thinking.trim()}function TL({streaming:e}){return l.jsxs("div",{role:"status",className:"flex items-center gap-1.5 py-0.5 text-[11px] text-cc-muted/50 italic",children:[l.jsx("span",{"aria-hidden":"true",className:`w-1.5 h-1.5 rounded-full bg-cc-muted/40 shrink-0 ${e?"animate-pulse":""}`}),l.jsx("span",{children:e?"Thinking…":"Thought"})]})}function ML({message:e}){var u;const t=e.contentBlocks||[],n=ro(),r=k.useMemo(()=>CL(t),[t]),a=k.useMemo(()=>EL(t),[t]),o=k.useMemo(()=>n?r.filter(h=>!AL(h)):r,[r,n]);if(n&&o.length===0&&!((u=e.content)!=null&&u.trim()))return l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(ag,{}),l.jsx("div",{className:"flex-1 min-w-0",children:l.jsx(TL,{streaming:e.isStreaming})})]});if(t.length===0&&e.content){const h=e.isStreaming&&e.streamingPhase==="thinking";return l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(ag,{}),l.jsx("div",{className:"flex-1 min-w-0",children:h?l.jsx(jk,{text:e.content}):l.jsx(hv,{text:e.content,showCursor:!!e.isStreaming})})]})}return l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(ag,{}),l.jsx("div",{className:`flex-1 min-w-0 ${n?"space-y-1.5":"space-y-3"}`,children:o.map((h,f)=>{if(h.kind==="content")return l.jsx(DL,{block:h.block,toolUseById:a},f);if(h.items.length===1){const p=h.items[0];return l.jsx(hw,{name:p.name,input:p.input,toolUseId:p.id},f)}return l.jsx(zL,{name:h.name,items:h.items},f)})})]})}function ag(){return l.jsx("div",{className:"w-6 h-6 rounded-full avatar-ring flex items-center justify-center shrink-0 mt-0.5",children:l.jsx("div",{className:"avatar-inner w-full h-full rounded-full flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-primary",children:l.jsx("path",{d:"M8 2L10.5 6.5L15 8L10.5 9.5L8 14L5.5 9.5L1 8L5.5 6.5L8 2Z"})})})})}function hv({text:e,showCursor:t=!1}){return l.jsxs("div",{className:"markdown-body text-[14px] sm:text-[15px] text-cc-fg leading-relaxed overflow-hidden",children:[l.jsx(lv,{remarkPlugins:[dv],components:{p:({children:n})=>l.jsx("p",{className:"mb-3 last:mb-0",children:n}),strong:({children:n})=>l.jsx("strong",{className:"font-semibold text-cc-fg",children:n}),em:({children:n})=>l.jsx("em",{className:"italic",children:n}),h1:({children:n})=>l.jsx("h1",{className:"text-xl font-bold text-cc-fg mt-4 mb-2",children:n}),h2:({children:n})=>l.jsx("h2",{className:"text-lg font-bold text-cc-fg mt-3 mb-2",children:n}),h3:({children:n})=>l.jsx("h3",{className:"text-base font-semibold text-cc-fg mt-3 mb-1",children:n}),ul:({children:n})=>l.jsx("ul",{className:"list-disc pl-5 mb-3 space-y-1",children:n}),ol:({children:n})=>l.jsx("ol",{className:"list-decimal pl-5 mb-3 space-y-1",children:n}),li:({children:n})=>l.jsx("li",{className:"text-cc-fg",children:n}),a:({href:n,children:r})=>l.jsx("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:"text-cc-primary hover:underline",children:r}),blockquote:({children:n})=>l.jsx("blockquote",{className:"border-l-2 border-cc-primary/30 pl-3 my-2 text-cc-muted italic",children:n}),hr:()=>l.jsx("hr",{className:"border-cc-border my-4"}),code:n=>{const{children:r,className:a}=n,o=/language-(\w+)/.exec(a||"");if(o||typeof r=="string"&&r.includes(`
100
+ `)){const h=(o==null?void 0:o[1])||"",f=zh(r);return l.jsxs("div",{className:"my-2.5 rounded-xl overflow-hidden border border-cc-border shadow-[0_2px_8px_rgba(0,0,0,0.04)]",children:[l.jsxs("div",{className:"px-3 py-1.5 bg-cc-code-bg border-b border-cc-border flex items-center gap-2",children:[l.jsxs("div",{className:"flex gap-1",children:[l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-muted/20"}),l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-muted/20"}),l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-muted/20"})]}),h&&l.jsx("span",{className:"text-[10px] text-cc-muted/70 font-mono-code uppercase tracking-wider",children:h}),l.jsx(Qh,{text:f,label:"Copy code",className:"ml-auto -mr-1"})]}),l.jsx("pre",{className:"px-3 sm:px-4 py-2.5 sm:py-3 bg-cc-code-bg text-cc-code-fg text-[12px] sm:text-[13px] font-mono-code leading-relaxed overflow-x-auto",children:l.jsx("code",{children:r})})]})}return l.jsx(bk,{children:r})},pre:({children:n})=>l.jsx(l.Fragment,{children:n}),table:({children:n})=>l.jsx("div",{className:"overflow-x-auto my-2",children:l.jsx("table",{className:"min-w-full text-sm border border-cc-border rounded-lg overflow-hidden",children:n})}),thead:({children:n})=>l.jsx("thead",{className:"bg-cc-code-bg/50",children:n}),th:({children:n})=>l.jsx("th",{className:"px-3 py-1.5 text-left text-xs font-semibold text-cc-fg border-b border-cc-border",children:n}),td:({children:n})=>l.jsx("td",{className:"px-3 py-1.5 text-xs text-cc-fg border-b border-cc-border",children:n})},children:e}),t&&l.jsx("span",{"data-testid":"assistant-stream-cursor",className:"inline-block w-[3px] h-[18px] bg-cc-primary rounded-full ml-0.5 align-middle animate-[pulse-dot_1s_ease-in-out_infinite]"})]})}function DL({block:e,toolUseById:t}){if(e.type==="text")return l.jsx(hv,{text:e.text});if(e.type==="thinking")return l.jsx(jk,{text:e.thinking});if(e.type==="tool_use")return l.jsx(hw,{name:e.name,input:e.input,toolUseId:e.id});if(e.type==="tool_result"){const n=typeof e.content=="string"?e.content:JSON.stringify(e.content),r=t.get(e.tool_use_id),a=r==null?void 0:r.name,o=e.is_error??!1;return a==="Bash"?l.jsx(LL,{text:n,isError:o}):l.jsx(RL,{content:n,isError:o})}return null}function kk(e){return`${e} ${e===1?"line":"lines"}`}function LL({text:e,isError:t}){const n=e.split(/\r?\n/),r=n.length>20,[a,o]=k.useState(!1),u=ro(),[h,f]=k.useState(!1),p=a||!r?e:n.slice(-20).join(`
101
+ `),m=l.jsxs("div",{className:"relative rounded-lg bg-cc-code-bg overflow-hidden",children:[l.jsx(Qh,{text:e,label:"Copy output",className:"absolute top-1 right-1 z-10 bg-cc-code-bg/80 backdrop-blur-sm"}),l.jsx("pre",{className:`text-[12px] font-mono-code px-3 py-2 whitespace-pre-wrap leading-relaxed ${t?"text-cc-error":"text-cc-code-fg/60"}`,children:p}),r&&l.jsxs("div",{className:"px-3 pb-1.5 flex items-center justify-between",children:[l.jsx("span",{className:`text-[10px] ${t?"text-cc-error/50":"text-cc-muted/40"}`,children:a?`${n.length} lines`:`last 20 of ${n.length}`}),l.jsx("button",{onClick:()=>o(!a),className:"text-[10px] text-cc-muted/40 hover:text-cc-muted/70 transition-colors cursor-pointer",children:a?"Show tail":"Show all"})]})]});return u?l.jsxs("div",{children:[l.jsx($h,{open:h,onToggle:()=>f(!h),marker:"›",label:t?"Error output":"Output",meta:kk(n.length),labelClassName:t?"text-cc-error/70":""}),h&&l.jsx("div",{className:"mt-1",children:m})]}):m}function RL({content:e,isError:t}){const n=ro(),[r,a]=k.useState(!1),o=l.jsxs("div",{className:"relative rounded-lg bg-cc-code-bg overflow-hidden",children:[l.jsx(Qh,{text:e,label:"Copy output",className:"absolute top-1 right-1 z-10 bg-cc-code-bg/80 backdrop-blur-sm"}),l.jsx("pre",{className:`text-[12px] font-mono-code px-3 py-2 whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto ${t?"text-cc-error":"text-cc-code-fg/60"}`,children:e})]});return n?l.jsxs("div",{children:[l.jsx($h,{open:r,onToggle:()=>a(!r),marker:"›",label:t?"Error result":"Result",meta:kk(e.split(/\r?\n/).length),labelClassName:t?"text-cc-error/70":""}),r&&l.jsx("div",{className:"mt-1",children:o})]}):o}function zL({name:e,items:t}){const[n,r]=k.useState(!1),a=Kc(e),o=qi(e);return l.jsxs("div",{className:"border border-cc-border rounded-[10px] overflow-hidden bg-cc-card tool-card",children:[l.jsxs("button",{onClick:()=>r(!n),className:"w-full flex items-center gap-2.5 px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-3 h-3 text-cc-muted transition-transform shrink-0 ${n?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx(Gl,{type:a}),l.jsx("span",{className:"text-xs font-medium text-cc-fg",children:o}),l.jsx("span",{className:"text-[10px] text-cc-muted bg-cc-hover rounded-full px-1.5 py-0.5 tabular-nums",children:t.length})]}),n&&l.jsx("div",{className:"border-t border-cc-border px-3 py-1.5",children:t.map((u,h)=>{const f=Pc(u.name,u.input);return l.jsxs("div",{className:"flex items-center gap-2 py-1 text-xs text-cc-muted font-mono-code truncate",children:[l.jsx("span",{className:"w-1 h-1 rounded-full bg-cc-muted/40 shrink-0"}),l.jsx("span",{className:"truncate",children:f||JSON.stringify(u.input).slice(0,80)})]},u.id||h)})})]})}function jk({text:e}){const t=e.trim(),n=ro(),[r,a]=k.useState(!1),o=t.split(`
102
+ `),u=n?2:8,h=n?200:600,f=o.length>u||t.length>h,p=f&&!r?o.slice(0,u).join(`
103
+ `):t;return n&&!t?null:l.jsxs("div",{children:[l.jsx("div",{className:"markdown-body text-[13px] text-cc-fg/40 leading-relaxed italic",children:l.jsx(lv,{remarkPlugins:[dv],components:{p:({children:m})=>l.jsx("p",{className:"mb-2 last:mb-0",children:m}),ul:({children:m})=>l.jsx("ul",{className:"list-disc pl-4 mb-2 space-y-0.5",children:m}),ol:({children:m})=>l.jsx("ol",{className:"list-decimal pl-4 mb-2 space-y-0.5",children:m}),li:({children:m})=>l.jsx("li",{children:m}),code:({children:m})=>l.jsx("code",{className:"px-1 py-0.5 rounded bg-cc-fg/[0.03] text-cc-fg/40 font-mono-code text-[12px] not-italic",children:m})},children:p||"No thinking text captured."})}),f&&!r&&l.jsx("button",{onClick:()=>a(!0),className:"text-[11px] text-cc-muted/40 hover:text-cc-muted/70 cursor-pointer transition-colors",children:"Show more"})]})}function jc(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function bc(e){const t=Math.floor(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function P5(e){try{const t=new Date(e).getTime()-Date.now();return Number.isFinite(t)?t<=0?"now":OL(t):"N/A"}catch{return"N/A"}}function bx(e){const n=(e>0&&e<1e12?e*1e3:e)-Date.now();if(n<=0)return"now";const r=Math.floor(n/864e5),a=Math.floor(n%864e5/36e5),o=Math.floor(n%36e5/6e4);return r>0?`${r}d ${a}h`:a>0?`${a}h${o}m`:`${o}m`}function $5(e){return e>=1440?`${Math.round(e/1440)}d`:e>=60?`${Math.round(e/60)}h`:`${e}m`}function OL(e){const t=Math.floor(e/864e5),n=Math.floor(e%864e5/36e5),r=Math.floor(e%36e5/6e4);return t>0?`${t}d ${n}h${r}m`:n>0?`${n}h${r}m`:`${r}m`}function BL({tools:e}){return e.length===0?null:l.jsx("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] font-mono-code pl-10 py-1.5 animate-[fadeSlideIn_0.3s_ease-out]",role:"status","aria-label":`${e.length} tool${e.length>1?"s":""} running`,children:e.map((t,n)=>l.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[l.jsxs("span",{className:"relative flex items-center justify-center w-3.5 h-3.5",children:[l.jsx(Gl,{type:Kc(t.toolName)}),l.jsx("span",{className:"absolute inset-0 rounded-full bg-cc-primary/20 animate-[typing-breathe_1.5s_ease-in-out_infinite]"})]}),l.jsx("span",{className:"text-cc-fg/70",children:qi(t.toolName)}),l.jsxs("span",{className:"text-cc-muted/50 tabular-nums",children:[t.elapsedSeconds,"s"]})]},n))})}function PL({entries:e}){const[t,n]=k.useState(!1),r=k.useMemo(()=>{const a=e.reduce((f,p)=>f+p.elapsedSeconds,0),o=Math.max(...e.map(f=>f.elapsedSeconds),.1),u=e.filter(f=>f.isError).length,h=e.filter(f=>!f.completedAt).length;return{totalTime:a,maxTime:o,errorCount:u,running:h}},[e]);return e.length===0?null:l.jsxs("div",{className:"pl-10 pr-4 animate-[fadeSlideIn_0.3s_ease-out]",children:[l.jsxs("button",{onClick:()=>n(!t),className:"group flex items-center gap-2 text-[11px] text-cc-muted hover:text-cc-fg/80 transition-colors cursor-pointer py-1 w-full","aria-expanded":t,"aria-label":`${e.length} tools executed in ${r.totalTime.toFixed(1)}s`,children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2.5 h-2.5 transition-transform duration-200 shrink-0 ${t?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsxs("span",{className:"font-mono-code flex items-center gap-1.5",children:[l.jsxs("span",{className:"text-cc-fg/60 font-medium",children:[e.length," tool",e.length>1?"s":""]}),l.jsx("span",{className:"text-cc-muted/40",children:"·"}),l.jsxs("span",{className:"tabular-nums",children:[r.totalTime.toFixed(1),"s"]}),r.errorCount>0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/40",children:"·"}),l.jsxs("span",{className:"text-cc-error",children:[r.errorCount," error",r.errorCount>1?"s":""]})]}),r.running>0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/40",children:"·"}),l.jsxs("span",{className:"text-cc-primary",children:[r.running," running"]})]})]}),!t&&e.length>1&&l.jsx("span",{className:"hidden sm:flex items-center gap-px ml-auto flex-shrink-0 h-1.5 max-w-[120px]",children:e.map(a=>l.jsx("span",{className:`h-full rounded-full ${a.isError?"bg-cc-error/40":a.completedAt?"bg-cc-success/30":"bg-cc-primary/40 animate-[typing-breathe_1.5s_ease-in-out_infinite]"}`,style:{width:`${Math.max(4,a.elapsedSeconds/r.maxTime*100)}%`,minWidth:"3px"},title:`${qi(a.toolName)} ${a.elapsedSeconds}s`},a.toolUseId))})]}),t&&l.jsx("div",{className:"mt-1 mb-2 space-y-1 animate-[fadeSlideIn_0.2s_ease-out]",children:e.map(a=>l.jsx($L,{entry:a,maxTime:r.maxTime},a.toolUseId))})]})}function $L({entry:e,maxTime:t}){const n=Math.max(3,e.elapsedSeconds/t*100),r=!e.completedAt;return l.jsxs("div",{className:"flex items-center gap-2 text-[11px] font-mono-code group",children:[l.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${e.isError?"bg-cc-error":r?"bg-cc-primary animate-[typing-breathe_1.5s_ease-in-out_infinite]":"bg-cc-success/60"}`}),l.jsxs("span",{className:"flex items-center gap-1 shrink-0 w-[100px]",children:[l.jsx(Gl,{type:Kc(e.toolName)}),l.jsx("span",{className:"text-cc-fg/70 truncate",children:qi(e.toolName)})]}),l.jsx("span",{className:"flex-1 h-1 bg-cc-border/30 rounded-full overflow-hidden min-w-[40px]",children:l.jsx("span",{className:`block h-full rounded-full transition-all duration-500 ${e.isError?"bg-cc-error/50":r?"bg-cc-primary/50 animate-[typing-breathe_1.5s_ease-in-out_infinite]":"bg-cc-success/30"}`,style:{width:`${n}%`}})}),l.jsxs("span",{className:"text-cc-muted/60 tabular-nums shrink-0 w-[40px] text-right",children:[e.elapsedSeconds.toFixed(1),"s"]}),e.preview&&l.jsx("span",{className:"text-cc-muted/40 truncate max-w-[200px] hidden lg:inline",children:e.preview})]})}const Ud=100,FL=40,UL=120,F5=1e4,IL=15*6e4,lg=new Map,HL=[],qL=[];function VL(e){const t=e.split("/").filter(Boolean);return t.length===0?e:t.slice(-2).join("/")}function GL(e){if(e.role!=="assistant")return null;const t=e.contentBlocks;if(!t||t.length===0)return null;let n=null;for(const r of t){if(r.type==="text"&&r.text.trim()||r.type==="thinking")return null;if(r.type==="tool_use"){if(n===null)n=r.name;else if(n!==r.name)return null}}return n}function U5(e){return(e.contentBlocks||[]).filter(n=>n.type==="tool_use").map(n=>({id:n.id,name:n.name,input:n.input}))}function YL(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 Nk(e){const t=[];for(const n of e){const r=GL(n);if(r){const a=t[t.length-1];if((a==null?void 0:a.kind)==="tool_msg_group"&&a.toolName===r){a.items.push(...U5(n));continue}t.push({kind:"tool_msg_group",toolName:r,items:U5(n),firstId:n.id})}else t.push({kind:"message",msg:n})}return t}function Ck(e,t,n){const r=Nk(e),a=[];for(const o of r){a.push(o);const u=YL(o);for(const h of u){const f=n.get(h);if(f&&f.length>0){const p=t.get(h)||{description:"Subagent",agentType:""},m=Ck(f,t,n);a.push({kind:"subagent",taskToolUseId:h,description:p.description,agentType:p.agentType,backend:p.backend,status:p.status,receiverCount:p.receiverCount,senderThreadId:p.senderThreadId,receiverThreadIds:p.receiverThreadIds,children:m})}}}return a}function WL(e){const t=new Map;for(const a of e)if(a.contentBlocks){for(const o of a.contentBlocks)if(o.type==="tool_use"&&o.name==="Task"){const{input:u,id:h}=o,f=Array.isArray(u==null?void 0:u.receiver_thread_ids)?u.receiver_thread_ids.filter(b=>typeof b=="string"&&b.length>0):void 0,p=f&&f.length>0?f.length:void 0,m=typeof(u==null?void 0:u.sender_thread_id)=="string"&&u.sender_thread_id.length>0?u.sender_thread_id:void 0,x=typeof(u==null?void 0:u.codex_status)=="string"||m!==void 0||p!==void 0;t.set(h,{description:String((u==null?void 0:u.description)||"Subagent"),agentType:String((u==null?void 0:u.subagent_type)||""),backend:x?"codex":"claude",status:typeof(u==null?void 0:u.codex_status)=="string"?u.codex_status:void 0,receiverCount:p,senderThreadId:m,receiverThreadIds:f})}}if(t.size===0)return Nk(e);const n=new Map,r=[];for(const a of e)if(a.parentToolUseId&&t.has(a.parentToolUseId)){let o=n.get(a.parentToolUseId);o||(o=[],n.set(a.parentToolUseId,o)),o.push(a)}else r.push(a);return Ck(r,t,n)}function QL({group:e}){const[t,n]=k.useState(!1),r=Kc(e.toolName),a=qi(e.toolName),o=e.items.length;if(o===1){const u=e.items[0];return l.jsx("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(I5,{}),l.jsx("div",{className:"flex-1 min-w-0",children:l.jsxs("div",{className:"border border-cc-border rounded-[10px] overflow-hidden bg-cc-card tool-card",children:[l.jsxs("button",{onClick:()=>n(!t),className:"w-full flex items-center gap-2.5 px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-3 h-3 text-cc-muted transition-transform shrink-0 ${t?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx(Gl,{type:r}),l.jsx("span",{className:"text-xs font-medium text-cc-fg",children:a}),l.jsx("span",{className:"text-xs text-cc-muted truncate flex-1 font-mono-code",children:Pc(u.name,u.input)})]}),t&&l.jsx("div",{className:"px-3 pb-3 pt-0 border-t border-cc-border mt-0",children:l.jsx("pre",{className:"mt-2 text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto",children:JSON.stringify(u.input,null,2)})})]})})]})})}return l.jsx("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(I5,{}),l.jsx("div",{className:"flex-1 min-w-0",children:l.jsxs("div",{className:"border border-cc-border rounded-[10px] overflow-hidden bg-cc-card tool-card",children:[l.jsxs("button",{onClick:()=>n(!t),className:"w-full flex items-center gap-2.5 px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-3 h-3 text-cc-muted transition-transform shrink-0 ${t?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx(Gl,{type:r}),l.jsx("span",{className:"text-xs font-medium text-cc-fg",children:a}),l.jsx("span",{className:"text-[10px] text-cc-muted bg-cc-hover rounded-full px-1.5 py-0.5 tabular-nums font-medium",children:o})]}),t&&l.jsx("div",{className:"border-t border-cc-border px-3 py-1.5",children:e.items.map((u,h)=>{const f=Pc(u.name,u.input);return l.jsxs("div",{className:"flex items-center gap-2 py-1 text-xs text-cc-muted font-mono-code truncate",children:[l.jsx("span",{className:"w-1 h-1 rounded-full bg-cc-muted/40 shrink-0"}),l.jsx("span",{className:"truncate",children:f||JSON.stringify(u.input).slice(0,80)})]},u.id||h)})})]})})]})})}function Ek({entries:e,toolActivity:t}){return l.jsx(l.Fragment,{children:e.map((n,r)=>{if(n.kind==="tool_msg_group")return l.jsx(QL,{group:n},n.firstId||r);if(n.kind==="subagent")return l.jsx(ZL,{group:n},n.taskToolUseId);const a=n.msg,o=XL(a),u=t&&o.length>0?t.filter(f=>o.includes(f.toolUseId)):[],h=u.length>0&&u.every(f=>f.completedAt);return l.jsxs("div",{children:[l.jsx(NL,{message:a}),h&&l.jsx(PL,{entries:u})]},a.id)})})}function XL(e){var t;return(t=e.contentBlocks)!=null&&t.length?e.contentBlocks.filter(n=>n.type==="tool_use").map(n=>n.id):[]}function KL(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 ZL({group:e}){const[t,n]=k.useState(!1),r=e.description||"Subagent",a=e.agentType,o=e.children.length,u=KL(e.status),h=e.receiverCount,f=e.senderThreadId,p=e.receiverThreadIds||[],m=e.backend||"claude",x=e.children[e.children.length-1],b=k.useMemo(()=>{var y,_;if(!x)return"";if(x.kind==="tool_msg_group")return`${qi(x.toolName)}${x.items.length>1?` ×${x.items.length}`:""}`;if(x.kind==="message"&&x.msg.role==="assistant"){const j=(y=x.msg.content)==null?void 0:y.trim();if(j)return j.length>60?j.slice(0,60)+"...":j;const N=(_=x.msg.contentBlocks)==null?void 0:_.find(w=>w.type==="tool_use");if(N)return qi(N.name)}return""},[x]);return l.jsx("div",{className:"animate-[fadeSlideIn_0.3s_ease-out]",children:l.jsxs("div",{className:"ml-10 border-l border-cc-border/50 pl-4",children:[l.jsxs("button",{type:"button",onClick:()=>n(!t),className:"relative z-10 flex items-center gap-1.5 py-1 text-left cursor-pointer group w-full",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2.5 h-2.5 text-cc-muted/40 group-hover:text-cc-muted/70 transition-transform shrink-0 ${t?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx("span",{className:"text-[11px] font-medium text-cc-primary/70",children:r}),a&&l.jsx("span",{className:"text-[10px] text-cc-muted/50",children:a}),l.jsx("span",{className:"text-[10px] text-cc-muted/40",children:m==="codex"?"Codex":"Claude"}),u&&l.jsx("span",{className:`text-[10px] ${u.className}`,children:u.label}),h!==void 0&&l.jsxs("span",{className:"text-[10px] text-cc-muted/40",children:[h," agent",h===1?"":"s"]}),!t&&b&&l.jsx("span",{className:"text-[11px] text-cc-muted/40 truncate ml-1 font-mono-code",children:b}),l.jsx("span",{className:"text-[10px] text-cc-muted/40 tabular-nums shrink-0 ml-auto",children:o})]}),t&&l.jsxs("div",{className:"space-y-3 pb-2 mt-1",children:[(f||p.length>0)&&l.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[10px] text-cc-muted/50 pl-4",children:[f&&l.jsxs("span",{className:"font-mono-code",children:["sender: ",f]}),p.length>0&&l.jsxs("span",{children:["receivers: ",p.map(y=>l.jsx("span",{className:"font-mono-code ml-1",children:y},y))]})]}),l.jsx(Ek,{entries:e.children})]})]})})}function I5(){return l.jsx("div",{className:"w-7 h-7 rounded-full avatar-ring flex items-center justify-center shrink-0 mt-0.5",children:l.jsx("div",{className:"avatar-inner w-full h-full rounded-full flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:l.jsx("path",{d:"M8 2L10.5 6.5L15 8L10.5 9.5L8 14L5.5 9.5L1 8L5.5 6.5L8 2Z"})})})})}function JL({sessionId:e}){var Gt;const t=Y(_e=>_e.messages.get(e)??HL),n=Y(_e=>(_e.sdkSessions||qL).find(Ve=>Ve.sessionId===e)),r=Y(_e=>_e.streamingStartedAt.get(e)),a=Y(_e=>_e.streamingOutputTokens.get(e)),o=Y(_e=>_e.sessionStatus.get(e)),u=Y(_e=>_e.lastActivityAt.get(e)),h=Y(_e=>_e.sessionProcesses.get(e)),f=Y(_e=>_e.toolProgress.get(e)),p=Y(_e=>_e.toolActivity.get(e)),m=k.useRef(null),x=k.useRef(null),b=k.useRef(!0),[y,_]=k.useState(0),[j,N]=k.useState(Ud),[w,C]=k.useState([]),[E,R]=k.useState(0),[L,O]=k.useState(!1),[q,F]=k.useState(!1),[W,z]=k.useState(!1),[I,A]=k.useState(""),X=k.useRef(new Set),Z=Y(_e=>_e.chatTabReentryTickBySession.get(e)??0),G=k.useMemo(()=>t.some(_e=>_e.role==="assistant"&&_e.isStreaming),[t]),B=k.useMemo(()=>(h??[]).filter(_e=>_e.status==="running"),[h]),$=B.length>0,se=k.useMemo(()=>{const _e=p??[];for(let Ve=_e.length-1;Ve>=0;Ve--)if(!_e[Ve].completedAt)return _e[Ve]},[p]),ae=k.useMemo(()=>B.length>0?Math.min(...B.map(_e=>_e.startedAt)):null,[B]),D=k.useMemo(()=>(n==null?void 0:n.backendType)==="codex"?"":((n==null?void 0:n.resumeSessionAt)||"").trim(),[n==null?void 0:n.backendType,n==null?void 0:n.resumeSessionAt]),P=D.length>0,J=n!=null&&n.forkSession?"Forked from":"Continuing from",M=k.useMemo(()=>{if(w.length===0)return t;const _e=[],Ve=new Set;for(const dt of w)Ve.has(dt.id)||(Ve.add(dt.id),_e.push(dt));for(const dt of t)Ve.has(dt.id)||(Ve.add(dt.id),_e.push(dt));return _e},[w,t]),ge=k.useMemo(()=>WL(M),[M]);k.useEffect(()=>{N(Ud),C([]),R(0),O(!1),F(!1),z(!1),A(""),X.current=new Set},[e,D]);const we=ge.length,Ce=we>j,ze=Ce?ge.slice(we-j):ge,Ee=we-ze.length,Pe=k.useCallback(()=>{const _e=x.current,Ve=(_e==null?void 0:_e.scrollHeight)??0;N(dt=>dt+Ud),requestAnimationFrame(()=>{if(_e){const dt=_e.scrollHeight;_e.scrollTop+=dt-Ve}})},[]),et=k.useCallback(async(_e={})=>{if(!P||!D||W)return;const Ve=x.current,dt=(Ve==null?void 0:Ve.scrollHeight)??0,_n=q?E:0;z(!0),A("");try{const je=await Ne.getClaudeSessionHistory(D,{cursor:_n,limit:FL}),Oe=je.messages.map(Ae=>({id:Ae.id,role:Ae.role,content:Ae.content,contentBlocks:Ae.role==="assistant"?Ae.contentBlocks:void 0,timestamp:Ae.timestamp||Date.now(),model:Ae.role==="assistant"?Ae.model:void 0,stopReason:Ae.role==="assistant"?Ae.stopReason:void 0})),xt=[];for(const Ae of Oe)X.current.has(Ae.id)||(X.current.add(Ae.id),xt.push(Ae));C(Ae=>[...xt,...Ae]),R(je.nextCursor),O(je.hasMore),F(!0),xt.length>0&&N(Ae=>Ae+xt.length),_e.preserveScroll!==!1&&Ve&&requestAnimationFrame(()=>{const Ae=Ve.scrollHeight;Ve.scrollTop+=Ae-dt})}catch(je){const Oe=je instanceof Error?je.message:String(je);A(Oe||"Failed to load previous history"),q||(C([]),R(0),O(!1))}finally{z(!1)}},[P,D,W,q,E]);k.useEffect(()=>{if(!r&&o!=="running"&&!$){_(0);return}const _e=r||Date.now();_(Date.now()-_e);const Ve=setInterval(()=>_(Date.now()-_e),1e3);return()=>clearInterval(Ve)},[r,o,$]);function Et(){const _e=x.current;if(!_e)return;b.current=_e.scrollHeight-_e.scrollTop-_e.clientHeight<120;const Ve=Math.max(0,_e.scrollHeight-_e.clientHeight-_e.scrollTop);lg.set(e,Ve),P&&q&&L&&!W&&_e.scrollTop<=UL&&et({preserveScroll:!0})}const mt=k.useCallback(()=>{const _e=x.current;if(!_e)return;const Ve=_e.style.scrollBehavior;_e.style.scrollBehavior="auto",_e.scrollTop=_e.scrollHeight,_e.style.scrollBehavior=Ve},[]),yt=k.useCallback(()=>{const _e=x.current;if(!_e)return;const Ve=_e.style.scrollBehavior;_e.style.scrollBehavior="auto";const dt=lg.get(e);typeof dt=="number"?_e.scrollTop=Math.max(0,_e.scrollHeight-_e.clientHeight-dt):_e.scrollTop=_e.scrollHeight,_e.style.scrollBehavior=Ve},[e]);if(k.useEffect(()=>{requestAnimationFrame(()=>yt())},[e,yt]),k.useEffect(()=>()=>{const _e=x.current;if(!_e)return;const Ve=Math.max(0,_e.scrollHeight-_e.clientHeight-_e.scrollTop);lg.set(e,Ve)},[e]),k.useEffect(()=>{Z&&requestAnimationFrame(()=>mt())},[Z,mt]),k.useEffect(()=>{var _e;b.current&&((_e=m.current)==null||_e.scrollIntoView({behavior:"smooth"}))},[t]),M.length===0)return l.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-5 select-none px-6",children:[l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:"w-16 h-16 rounded-2xl bg-gradient-to-br from-cc-primary/10 to-cc-primary/5 border border-cc-primary/15 flex items-center justify-center shadow-[0_4px_20px_rgba(217,119,87,0.08)]",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-7 h-7 text-cc-primary",children:[l.jsx("polyline",{points:"4 17 10 11 4 5"}),l.jsx("line",{x1:"12",y1:"19",x2:"20",y2:"19"})]})}),l.jsx("div",{className:"absolute -top-1 -right-1 w-3 h-3",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-primary/40 animate-[gentle-bounce_2s_ease-in-out_infinite]",children:l.jsx("path",{d:"M8 2L10.5 6.5L15 8L10.5 9.5L8 14L5.5 9.5L1 8L5.5 6.5L8 2Z"})})})]}),l.jsx("div",{className:"text-center max-w-xs",children:P?l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"text-sm text-cc-fg font-medium mb-1.5",children:"This session has prior context"}),l.jsxs("p",{className:"text-xs text-cc-muted leading-relaxed mb-4",children:[J," ",l.jsx("span",{className:"font-mono-code text-cc-fg/70",children:D.slice(0,8)}),". Load earlier messages when needed."]}),l.jsxs("button",{onClick:()=>void et({preserveScroll:!1}),disabled:W,className:"inline-flex items-center gap-2 px-4 py-2 text-xs font-medium text-cc-fg bg-cc-card border border-cc-border rounded-xl hover:bg-cc-hover hover:border-cc-primary/20 transition-all disabled:opacity-60 disabled:cursor-not-allowed cursor-pointer shadow-[0_2px_8px_rgba(0,0,0,0.04)]",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M8 2v12M3 9l5 5 5-5",strokeLinecap:"round",strokeLinejoin:"round"})}),W?"Loading...":"Load previous history"]}),I&&l.jsx("p",{className:"text-xs text-cc-error mt-2",children:I})]}):l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"text-[15px] text-cc-fg font-medium mb-1.5",children:"Start a conversation"}),l.jsx("p",{className:"text-xs text-cc-muted leading-relaxed",children:"Send a message to begin working with The Companion."})]})})]});const _t=o==="running"&&u!=null?Math.max(0,Date.now()-u):0,Lt=$&&(o!=="running"||_t>=F5)?"background":_t>=IL&&!se?"stalled":_t>=F5?"quiet":"active";return l.jsxs("div",{className:"flex-1 min-h-0 relative overflow-hidden",children:[l.jsx("div",{className:"pointer-events-none absolute top-0 inset-x-0 h-6 bg-gradient-to-b from-cc-bg to-transparent z-10"}),l.jsx("div",{ref:x,onScroll:Et,className:"h-full overflow-y-auto overflow-x-hidden overscroll-y-contain px-4 sm:px-6 py-5 sm:py-8",children:l.jsxs("div",{className:"max-w-3xl mx-auto space-y-5 sm:space-y-7",children:[P&&!q&&l.jsxs("div",{className:"rounded-xl border border-cc-border bg-cc-card p-3",children:[l.jsxs("div",{className:"flex items-center justify-between gap-3",children:[l.jsxs("div",{children:[l.jsxs("p",{className:"text-xs font-medium text-cc-fg",children:[J," existing Claude thread"]}),l.jsxs("p",{className:"text-[11px] text-cc-muted mt-1",children:[D," ",n!=null&&n.cwd?`· ${VL(n.cwd)}`:""]})]}),l.jsx("button",{onClick:()=>void et({preserveScroll:!0}),disabled:W,className:"shrink-0 inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-cc-fg bg-cc-card border border-cc-border rounded-lg hover:bg-cc-hover transition-colors disabled:opacity-60 disabled:cursor-not-allowed cursor-pointer",children:W?"Loading...":"Load previous history"})]}),I&&l.jsx("p",{className:"text-xs text-cc-error mt-2",children:I})]}),P&&q&&l.jsx("div",{className:"flex justify-center",children:l.jsx("p",{className:"text-[11px] text-cc-muted",children:L?W?"Loading older transcript...":"Scroll to top to load older transcript":"Loaded all available prior transcript"})}),Ce&&l.jsx("div",{className:"flex justify-center pb-3",children:l.jsxs("button",{onClick:Pe,className:"flex items-center gap-2 px-4 py-2 text-xs font-medium text-cc-muted hover:text-cc-fg bg-cc-card border border-cc-border rounded-xl hover:bg-cc-hover hover:border-cc-primary/20 transition-all cursor-pointer shadow-[0_2px_6px_rgba(0,0,0,0.03)]",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M8 3v10M3 8l5-5 5 5",strokeLinecap:"round",strokeLinejoin:"round"})}),"Load ",Math.min(Ud,Ee)," more",l.jsxs("span",{className:"text-cc-muted/50 tabular-nums",children:["(",Ee," hidden)"]})]})}),l.jsx(Ek,{entries:ze,toolActivity:p}),f&&f.size>0&&!G&&l.jsx(BL,{tools:Array.from(f.values())}),o==="compacting"&&l.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-cc-warning font-mono-code pl-10 py-1",children:[l.jsxs("svg",{className:"w-3.5 h-3.5 animate-spin shrink-0",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[l.jsx("circle",{cx:"8",cy:"8",r:"6",opacity:"0.2"}),l.jsx("path",{d:"M8 2a6 6 0 0 1 6 6",strokeLinecap:"round"})]}),l.jsx("span",{children:"Compacting context..."})]}),(o==="running"||$)&&y>=0&&l.jsxs("div",{"data-testid":"activity-indicator","data-activity-tier":Lt,className:`flex items-center gap-2 text-[11px] font-mono-code pl-10 stats-glow py-1 ${Lt==="stalled"?"text-cc-warning":"text-cc-muted"}`,children:[l.jsx("span",{className:`inline-block w-2 h-2 rounded-full ${Lt==="stalled"?"bg-cc-warning animate-[typing-breathe_1.5s_ease-in-out_infinite]":"bg-cc-primary animate-[typing-breathe_1.5s_ease-in-out_infinite]"}`}),Lt==="background"?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-fg/70",children:B.length===1?"Background process running":`${B.length} background processes running`}),ae!=null&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/30",children:"|"}),l.jsx("span",{className:"tabular-nums",children:bc(Math.max(0,Date.now()-ae))})]}),((Gt=B[0])==null?void 0:Gt.description)&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/30",children:"|"}),l.jsx("span",{className:"truncate max-w-[24ch]",children:B[0].description})]})]}):Lt==="stalled"?l.jsxs("span",{children:["No activity for ",bc(_t)," — the agent may be stuck"]}):Lt==="quiet"?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-fg/70",children:se?`Running ${se.toolName}`:"Still working…"}),l.jsx("span",{className:"text-cc-muted/30",children:"|"}),l.jsx("span",{className:"tabular-nums",children:se?bc(Math.max(0,Date.now()-se.startedAt)):`no update for ${bc(_t)}`}),(se==null?void 0:se.preview)&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/30",children:"|"}),l.jsx("span",{className:"truncate max-w-[32ch]",children:se.preview})]})]}):l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-fg/70",children:"Generating"}),l.jsx("span",{className:"text-cc-muted/30",children:"|"}),l.jsx("span",{className:"tabular-nums",children:bc(y)}),(a??0)>0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-cc-muted/30",children:"|"}),l.jsxs("span",{className:"tabular-nums",children:[jc(a)," tokens"]})]})]})]}),l.jsx("div",{ref:m})]})})]})}const eR={codex:"✳",xhigh:"★",max:"■",mini:"⚡"};function tR(e,t){for(const[r,a]of Object.entries(eR))if(e.includes(r))return a;const n=["◆","●","◕","✦"];return n[t%n.length]}function nR(e){return e.map((t,n)=>({value:t.value,label:t.label||t.value,icon:tR(t.value,n)}))}const Ak=[{value:"claude-opus-5",label:"Opus 5",icon:""},{value:"claude-opus-4-8",label:"Opus 4.8",icon:""},{value:"claude-fable-5-1",label:"Fable 5.1",icon:"★"},{value:"claude-fable-5",label:"Fable 5",icon:"★"},{value:"claude-opus-4-7",label:"Opus 4.7",icon:""},{value:"claude-opus-4-6",label:"Opus 4.6",icon:""},{value:"claude-sonnet-5",label:"Sonnet 5",icon:""},{value:"claude-haiku-4-5-20251001",label:"Haiku 4.5",icon:""}],Tk=[{value:"gpt-5.5",label:"GPT-5.5",icon:"■"},{value:"gpt-5.4",label:"GPT-5.4",icon:"✳"},{value:"gpt-5.4-mini",label:"GPT-5.4 Mini",icon:"⚡"},{value:"gpt-5.3-codex",label:"GPT-5.3 Codex",icon:"◆"},{value:"gpt-5.2",label:"GPT-5.2",icon:"●"}],fv=[{value:"bypassPermissions",label:"Agent"},{value:"plan",label:"Plan"}],pv=[{value:"bypassPermissions",label:"Auto"},{value:"plan",label:"Plan"}],rR=[{value:"",label:"Default"},{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"xhigh",label:"xHigh"},{value:"max",label:"Max"}],Mk=[{value:"bypassPermissions",label:"Full Auto"},{value:"acceptEdits",label:"Auto-Edit"},{value:"default",label:"Supervised"}],Dk=[{value:"bypassPermissions",label:"Full Auto"},{value:"default",label:"Supervised"}];function Lk(e){return e==="codex"?Tk:Ak}function H5(e){return e==="codex"?pv:fv}function SO(e){return e==="codex"?Dk:Mk}function q5(e){return e==="codex"?Tk[0].value:Ak[0].value}function V5(e){return e==="codex"?pv[0].value:fv[0].value}function kO(e){return e==="codex"?Dk[0].value:Mk[0].value}function sR(e){return e==="codex"?[]:rR}function G5({sessionId:e}){const[t,n]=k.useState(!1),r=k.useRef(null),a=Y(b=>b.sdkSessions.find(y=>y.sessionId===e)||null),o=Y(b=>b.sessions.get(e)),u=Y(b=>b.cliConnected.get(e)??!1),h=(a==null?void 0:a.backendType)??(o==null?void 0:o.backend_type)??"claude",f=(o==null?void 0:o.model)??(a==null?void 0:a.model)??"",p=Lk(h),m=p.find(b=>b.value===f)||(f?{label:f,icon:"?"}:null),x=k.useCallback(b=>{if(n(!1),b===f)return;On(e,{type:"set_model",model:b});const{sdkSessions:y,setSdkSessions:_}=Y.getState();_(y.map(j=>j.sessionId===e?{...j,model:b}:j))},[e,f]);return k.useEffect(()=>{if(!t)return;const b=y=>{r.current&&!r.current.contains(y.target)&&n(!1)};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[t]),k.useEffect(()=>{if(!t)return;const b=y=>{y.key==="Escape"&&n(!1)};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[t]),h==="codex"||!u||!m?null:l.jsxs("div",{ref:r,className:"relative shrink-0",children:[l.jsxs("button",{onClick:()=>n(b=>!b),className:`flex items-center gap-1 h-8 px-2 rounded-md text-[12px] font-medium transition-colors cursor-pointer ${t?"text-cc-fg bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:`Current model: ${m.label}`,"aria-label":"Switch model","aria-expanded":t,"aria-haspopup":"listbox",children:[m.icon&&l.jsx("span",{className:"text-[13px] leading-none",children:m.icon}),l.jsx("span",{children:m.label}),l.jsx("svg",{viewBox:"0 0 12 12",fill:"currentColor",className:"w-2.5 h-2.5 opacity-50",children:l.jsx("path",{d:"M6 8L1.5 3.5h9L6 8z"})})]}),t&&l.jsx("div",{className:"absolute right-0 bottom-full mb-1 z-50 min-w-[160px] rounded-lg border border-cc-separator bg-cc-bg shadow-lg overflow-hidden",role:"listbox","aria-label":"Select model",children:p.map(b=>l.jsxs("button",{onClick:()=>x(b.value),className:`w-full flex items-center gap-2 px-3 min-h-[44px] text-[13px] transition-colors cursor-pointer ${b.value===f?"text-cc-fg bg-cc-active font-medium":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,role:"option","aria-selected":b.value===f,children:[b.icon&&l.jsx("span",{className:"text-[14px] leading-none w-5 text-center",children:b.icon}),l.jsx("span",{className:"flex-1 text-left",children:b.label}),b.value===f&&l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary shrink-0",children:l.jsx("path",{d:"M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"})})]},b.value))})]})}function Rk({open:e,loading:t,prompts:n,selectedIndex:r,onSelect:a,menuRef:o,className:u=""}){return e?l.jsx("div",{ref:o,className:`max-h-[240px] overflow-y-auto bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-20 py-1 ${u}`,children:t?l.jsx("div",{className:"px-3 py-2 text-[12px] text-cc-muted",children:"Searching prompts..."}):n.length>0?n.map((h,f)=>l.jsxs("button",{"data-prompt-index":f,onClick:()=>a(h),className:`w-full px-3 py-2 text-left flex items-center gap-2.5 transition-colors cursor-pointer ${f===r?"bg-cc-hover":"hover:bg-cc-hover/50"}`,children:[l.jsx("span",{className:"flex items-center justify-center w-6 h-6 rounded-md bg-cc-hover text-cc-muted shrink-0",children:l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:[l.jsx("path",{d:"M2.5 8a5.5 5.5 0 1111 0v3a2.5 2.5 0 01-2.5 2.5h-1",strokeLinecap:"round"}),l.jsx("circle",{cx:"8",cy:"8",r:"1.75",fill:"currentColor",stroke:"none"})]})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"text-[13px] font-medium text-cc-fg truncate",children:["@",h.name]}),l.jsx("div",{className:"text-[11px] text-cc-muted truncate",children:h.content})]}),l.jsx("span",{className:"text-[10px] text-cc-muted shrink-0",children:h.scope})]},h.id)):l.jsx("div",{className:"px-3 py-2 text-[12px] text-cc-muted",children:"No prompts found."})}):null}function zk({text:e,caretPos:t,cwd:n,enabled:r=!0}){const[a,o]=k.useState(!1),[u,h]=k.useState(0),[f,p]=k.useState([]),[m,x]=k.useState(!1),b=k.useRef(null),y=k.useCallback(async()=>{x(!0);try{const w=await Ne.listPrompts(n);p(w.filter(C=>!!C.name.trim()))}catch{p([])}finally{x(!1)}},[n]);k.useEffect(()=>{y()},[y]);const _=k.useMemo(()=>{const w=e.slice(0,t),C=w.match(/(^|\s)@([^\s@]*)$/);if(!C||C.index===void 0)return null;const E=w.length-C[0].length+C[1].length;return{query:C[2]||"",start:E,end:t}},[e,t]),j=k.useMemo(()=>{if(!a||!_)return[];const w=_.query.toLowerCase();if(!w)return f;const C=f.filter(R=>R.name.toLowerCase().startsWith(w)),E=f.filter(R=>!R.name.toLowerCase().startsWith(w)&&R.name.toLowerCase().includes(w));return[...C,...E]},[a,_,f]);k.useEffect(()=>{const w=r&&!!_;w&&!a?(o(!0),h(0)):!w&&a&&o(!1)},[r,_,a]),k.useEffect(()=>{u>=j.length&&h(Math.max(0,j.length-1))},[j.length,u]),k.useEffect(()=>{if(!b.current||!a)return;const C=b.current.querySelectorAll("[data-prompt-index]")[u];C&&C.scrollIntoView({block:"nearest"})},[u,a]);const N=k.useCallback(w=>{if(!_)return{nextText:e,nextCursor:t};const C=`${w.content} `,E=`${e.slice(0,_.start)}${C}${e.slice(_.end)}`,R=_.start+C.length;return{nextText:E,nextCursor:R}},[_,e,t]);return{mentionMenuOpen:a,setMentionMenuOpen:o,mentionMenuIndex:u,setMentionMenuIndex:h,mentionContext:_,filteredPrompts:j,promptsLoading:m,savedPrompts:f,selectPrompt:N,refreshPrompts:y,mentionMenuRef:b}}const iR=[];function Y5({isPlan:e,isConnected:t,onToggle:n,modeLabel:r,size:a}){const o=a==="desktop",u=o?"px-2.5 py-1.5":"px-2 py-1",h=o?"text-cc-primary border-cc-primary/30 bg-cc-primary/8 hover:bg-cc-primary/12 cursor-pointer":"text-cc-primary border-cc-primary/30 bg-cc-primary/8",f=o?"text-cc-muted border-cc-border hover:text-cc-fg hover:bg-cc-hover cursor-pointer":"text-cc-muted border-cc-border";return l.jsxs("button",{onClick:n,disabled:!t,className:`flex items-center gap-1.5 ${u} rounded-md text-[12px] font-semibold transition-all border select-none shrink-0 ${t?e?h:f:"opacity-30 cursor-not-allowed text-cc-muted border-transparent"}`,title:"Toggle mode (Shift+Tab)",children:[e?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:[l.jsx("rect",{x:"3",y:"3",width:"3.5",height:"10",rx:"0.75"}),l.jsx("rect",{x:"9.5",y:"3",width:"3.5",height:"10",rx:"0.75"})]}):l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:[l.jsx("path",{d:"M2.5 4l4 4-4 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),l.jsx("path",{d:"M8.5 4l4 4-4 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]}),l.jsx("span",{children:r})]})}function Id({onClick:e,disabled:t,active:n,title:r,children:a}){return l.jsx("button",{onClick:e,disabled:t,className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors ${n?"text-cc-muted hover:text-cc-fg hover:bg-cc-hover cursor-pointer":"text-cc-muted opacity-30 cursor-not-allowed"}`,title:r,children:a})}function W5(){return l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-4 h-4",children:l.jsx("path",{d:"M4 2.75h8A1.25 1.25 0 0113.25 4v9.25L8 10.5l-5.25 2.75V4A1.25 1.25 0 014 2.75z"})})}function Q5({isRunning:e,canSend:t,onSend:n,onInterrupt:r,size:a}){const o=a==="desktop",u=o?"w-9 h-9":"w-10 h-10",h=o?"bg-cc-primary hover:bg-cc-primary-hover hover:scale-105 text-white cursor-pointer shadow-[0_4px_16px_rgba(217,119,87,0.25)]":"bg-cc-primary hover:bg-cc-primary-hover active:scale-95 text-white cursor-pointer shadow-[0_4px_16px_rgba(217,119,87,0.25)]";return e?l.jsx("button",{onClick:r,className:`flex items-center justify-center ${u} rounded-lg bg-cc-error/10 hover:bg-cc-error/20 text-cc-error transition-colors cursor-pointer`,title:"Stop generation",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1"})})}):l.jsx("button",{onClick:n,disabled:!t,className:`flex items-center justify-center ${u} rounded-full transition-all duration-200 ${t?h:"bg-cc-hover text-cc-muted cursor-not-allowed"}`,title:"Send message",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M3 2l11 6-11 6V9.5l7-1.5-7-1.5V2z"})})})}function aR({sessionId:e}){var oe,Se;const[t,n]=k.useState(""),[r,a]=k.useState([]),[o,u]=k.useState(null),[h,f]=k.useState(!1),[p,m]=k.useState(!1),[x,b]=k.useState(0),[y,_]=k.useState(!1),[j,N]=k.useState(""),[w,C]=k.useState("global"),[E,R]=k.useState(null),[L,O]=k.useState(0),q=k.useRef(null),F=k.useRef(null),W=k.useRef(null),z=k.useRef(null),I=Y(Q=>Q.cliConnected),A=Y(Q=>Q.sessions.get(e)),X=Y(Q=>Q.previousPermissionMode.get(e)||"acceptEdits"),Z=I.get(e)??!1,G=(A==null?void 0:A.permissionMode)||"acceptEdits",B=G==="plan",$=(A==null?void 0:A.backend_type)==="codex",ae=((Se=(oe=($?pv:fv).find(Q=>Q.value===G))==null?void 0:oe.label)==null?void 0:Se.toLowerCase())||G,D=zk({text:t,caretPos:L,cwd:A==null?void 0:A.cwd,enabled:!p}),P=k.useMemo(()=>{const Q=[];if(A!=null&&A.slash_commands)for(const xe of A.slash_commands)Q.push({name:xe,type:"command"});if(A!=null&&A.skills)for(const xe of A.skills)Q.push({name:xe,type:"skill"});return Q},[A==null?void 0:A.slash_commands,A==null?void 0:A.skills]),J=k.useMemo(()=>{if(!p)return[];const Q=t.match(/^\/(\S*)$/);if(!Q)return[];const xe=Q[1].toLowerCase();return xe===""?P:P.filter(Le=>Le.name.toLowerCase().includes(xe))},[t,p,P]);k.useEffect(()=>{const Q=t.startsWith("/")&&/^\/\S*$/.test(t)&&P.length>0;Q&&!p?(m(!0),b(0)):!Q&&p&&m(!1)},[t,P.length,p]),k.useEffect(()=>{x>=J.length&&b(Math.max(0,J.length-1))},[J.length,x]),k.useEffect(()=>{if(!W.current||!p)return;const xe=W.current.querySelectorAll("[data-cmd-index]")[x];xe&&xe.scrollIntoView({block:"nearest"})},[x,p]),k.useEffect(()=>{if(z.current===null||!q.current)return;const Q=z.current;q.current.setSelectionRange(Q,Q),z.current=null},[t]);const M=k.useCallback(Q=>{var xe;n(`/${Q.name} `),m(!1),(xe=q.current)==null||xe.focus()},[]),ge=k.useCallback(Q=>{var Le;const xe=D.selectPrompt(Q);z.current=xe.nextCursor,n(xe.nextText),D.setMentionMenuOpen(!1),O(xe.nextCursor),(Le=q.current)==null||Le.focus(),q.current&&(q.current.style.height="auto",q.current.style.height=Math.min(q.current.scrollHeight,200)+"px")},[D]);function we(){var rt;const Q=t.trim();if(!Q||!Z)return;const xe=mg(),Le=r.length>0?r.map(st=>({name:st.name,media_type:st.mediaType,data:st.base64,size:st.size})):void 0;On(e,{type:"user_message",content:Q,session_id:e,attachments:Le,client_msg_id:xe});const Qe=Y.getState();Qe.appendMessage(e,{id:xe,role:"user",content:Q,attachments:Le,timestamp:Date.now()}),Qe.setSessionStatus(e,"running"),Qe.setLastActivity(e,Date.now()),Qe.streamingStartedAt.has(e)||Qe.setStreamingStats(e,{startedAt:Date.now()}),n(""),a([]),u(null),m(!1),D.setMentionMenuOpen(!1),q.current&&(q.current.style.height="auto"),(rt=q.current)==null||rt.focus()}function Ce(Q){if(p&&J.length>0){if(Q.key==="ArrowDown"){Q.preventDefault(),b(xe=>(xe+1)%J.length);return}if(Q.key==="ArrowUp"){Q.preventDefault(),b(xe=>(xe-1+J.length)%J.length);return}if(Q.key==="Tab"&&!Q.shiftKey){Q.preventDefault(),M(J[x]);return}if(Q.key==="Enter"&&!Q.shiftKey){Q.preventDefault(),M(J[x]);return}if(Q.key==="Escape"){Q.preventDefault(),m(!1);return}}if(D.mentionMenuOpen&&Q.key==="Escape"){Q.preventDefault(),D.setMentionMenuOpen(!1);return}if(D.mentionMenuOpen&&D.filteredPrompts.length>0){if(Q.key==="ArrowDown"){Q.preventDefault(),D.setMentionMenuIndex(xe=>(xe+1)%D.filteredPrompts.length);return}if(Q.key==="ArrowUp"){Q.preventDefault(),D.setMentionMenuIndex(xe=>(xe-1+D.filteredPrompts.length)%D.filteredPrompts.length);return}if(Q.key==="Tab"&&!Q.shiftKey||Q.key==="Enter"&&!Q.shiftKey){Q.preventDefault(),ge(D.filteredPrompts[D.mentionMenuIndex]);return}}if(D.mentionMenuOpen&&D.filteredPrompts.length===0&&(Q.key==="Enter"&&!Q.shiftKey||Q.key==="Tab"&&!Q.shiftKey)){Q.preventDefault();return}if(Q.key==="Tab"&&Q.shiftKey){Q.preventDefault(),Ve();return}Q.key==="Enter"&&!Q.shiftKey&&(Q.preventDefault(),we())}function ze(Q){n(Q.target.value),O(Q.target.selectionStart??Q.target.value.length);const xe=Q.target;xe.style.height="auto",xe.style.height=Math.min(xe.scrollHeight,200)+"px"}function Ee(){q.current&&O(q.current.selectionStart??0)}function Pe(){On(e,{type:"interrupt"})}async function et(Q){if(Q.length===0)return;const xe=[],Le=[];let Qe=r.reduce((rt,st)=>rt+st.size,0);for(const rt of Q){if(rt.size>Oh){Le.push(`${rt.name} is too large (${Hi(rt.size)}, max ${Hi(Oh)})`);continue}if(Qe+rt.size>Bh){Le.push(`${rt.name} would exceed the per-message limit (${Hi(Bh)})`);continue}const{base64:st,mediaType:Ct}=await yk(rt);xe.push({name:rt.name,base64:st,mediaType:Ct,size:rt.size}),Qe+=rt.size}xe.length>0&&a(rt=>[...rt,...xe]),u(Le.length>0?Le.join("; "):null)}async function Et(Q){const xe=Q.target.files;xe&&(await et(Array.from(xe)),Q.target.value="")}function mt(Q){a(xe=>xe.filter((Le,Qe)=>Qe!==Q))}async function yt(Q){var Qe;const xe=(Qe=Q.clipboardData)==null?void 0:Qe.items;if(!xe)return;const Le=[];for(const rt of Array.from(xe)){if(rt.kind!=="file")continue;const st=rt.getAsFile();if(!st)continue;const Ct=st.name&&st.name.length>0?st.name:`pasted-${Date.now()}.${(st.type.split("/")[1]||"bin").replace(/[^a-zA-Z0-9]/g,"")}`;Le.push(new File([st],Ct,{type:st.type,lastModified:st.lastModified}))}Le.length>0&&(Q.preventDefault(),await et(Le))}function _t(Q){Q.dataTransfer.types.includes("Files")&&(Q.preventDefault(),Q.stopPropagation(),f(!0))}function Lt(Q){Q.currentTarget===Q.target&&f(!1)}async function Gt(Q){if(!Q.dataTransfer.types.includes("Files"))return;Q.preventDefault(),Q.stopPropagation(),f(!1);const xe=Array.from(Q.dataTransfer.files);xe.length>0&&await et(xe)}function _e(){const Q=t.trim().slice(0,32);N(Q||""),R(null),_(xe=>!xe)}function Ve(){if(!Z)return;const Q=Y.getState();if(!B)Q.setPreviousPermissionMode(e,G),On(e,{type:"set_permission_mode",mode:"plan"}),Q.updateSession(e,{permissionMode:"plan"});else{const xe=X||($?"bypassPermissions":"acceptEdits");On(e,{type:"set_permission_mode",mode:xe}),Q.updateSession(e,{permissionMode:xe})}}async function dt(){const Q=t.trim(),xe=j.trim();if(!Q||!xe)return;if(w==="project"&&!(A!=null&&A.cwd)){R("No project folder available for this session");return}const Le={name:xe,content:Q,scope:w};w==="project"&&(Le.projectPaths=[A.cwd]);try{await Ne.createPrompt(Le),await D.refreshPrompts(),_(!1),N(""),C("global"),R(null)}catch(Qe){const rt=Qe instanceof Error&&Qe.message?Qe.message:"Could not save prompt.";R(rt)}}const je=Y(Q=>Q.promptSuggestions.get(e))??iR,Oe=Y(Q=>Q.clearPromptSuggestions),Ae=Y(Q=>Q.sessionStatus).get(e)==="running",Qr=t.trim().length>0&&Z;return l.jsx("div",{className:`shrink-0 px-0 sm:px-6 pt-0 sm:pt-3 pb-5 sm:pb-4 bg-cc-input-bg sm:bg-transparent relative ${h?"ring-2 ring-cc-primary/40 rounded-2xl":""}`,onDragOver:_t,onDragLeave:Lt,onDrop:Gt,children:l.jsxs("div",{className:"max-w-3xl mx-auto",children:[h&&l.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center pointer-events-none rounded-2xl bg-cc-primary/5 border-2 border-dashed border-cc-primary/40",children:l.jsx("span",{className:"text-sm text-cc-primary font-medium",children:"Drop files to attach"})}),r.length>0&&l.jsx("div",{className:"flex items-center gap-2 mb-2 px-3 sm:px-0 flex-wrap",children:r.map((Q,xe)=>l.jsx(Sk,{name:Q.name,mediaType:Q.mediaType,base64:Q.base64,size:Q.size,onRemove:()=>mt(xe)},xe))}),o&&l.jsx("div",{className:"mb-2 px-3 sm:px-0 text-[11px] text-cc-error",children:o}),l.jsx("input",{ref:F,type:"file",multiple:!0,onChange:Et,className:"hidden","aria-label":"Attach files"}),je.length>0&&l.jsx("div",{className:"flex flex-wrap gap-1.5 px-2 sm:px-4 pb-2",children:je.map((Q,xe)=>l.jsx("button",{onClick:()=>{if(!Z||Ae)return;const Le=mg();On(e,{type:"user_message",content:Q,session_id:e,client_msg_id:Le}),Y.getState().appendMessage(e,{id:Le,role:"user",content:Q,timestamp:Date.now()}),Oe(e)},disabled:!Z||Ae,className:"text-xs px-2.5 py-1.5 rounded-lg bg-cc-hover hover:bg-cc-active text-cc-fg border border-cc-border transition-colors cursor-pointer truncate max-w-[280px]",title:Q,children:Q},xe))}),l.jsxs("div",{className:`relative overflow-visible transition-all duration-200 border-t border-cc-separator sm:border sm:border-cc-border sm:bg-cc-input-bg/95 sm:rounded-[16px] sm:backdrop-blur-sm composer-card ${B?"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&&J.length>0&&l.jsx("div",{ref:W,className:"absolute left-2 right-2 bottom-full mb-1 max-h-[240px] overflow-y-auto bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-20 py-1",children:J.map((Q,xe)=>l.jsxs("button",{"data-cmd-index":xe,onClick:()=>M(Q),className:`w-full px-3 py-2 text-left flex items-center gap-2.5 transition-colors cursor-pointer ${xe===x?"bg-cc-hover":"hover:bg-cc-hover/50"}`,children:[l.jsx("span",{className:"flex items-center justify-center w-6 h-6 rounded-md bg-cc-hover text-cc-muted shrink-0",children:Q.type==="skill"?l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M8 1l1.796 3.64L14 5.255l-3 2.924.708 4.126L8 10.5l-3.708 1.805L5 8.18 2 5.255l4.204-.615L8 1z"})}):l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M5 12L10 4",strokeLinecap:"round"})})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("span",{className:"text-[13px] font-medium text-cc-fg",children:["/",Q.name]}),l.jsx("span",{className:"ml-2 text-[11px] text-cc-muted",children:Q.type})]})]},`${Q.type}-${Q.name}`))}),l.jsx(Rk,{open:D.mentionMenuOpen,loading:D.promptsLoading,prompts:D.filteredPrompts,selectedIndex:D.mentionMenuIndex,onSelect:ge,menuRef:D.mentionMenuRef,className:"absolute left-2 right-2 bottom-full mb-1"}),y&&l.jsxs("div",{className:"absolute left-2 right-2 bottom-full mb-1 bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-20 p-3 space-y-2",children:[l.jsx("div",{className:"text-xs font-semibold text-cc-fg",children:"Save prompt"}),l.jsx("input",{value:j,onChange:Q=>{N(Q.target.value),E&&R(null)},placeholder:"Prompt title","aria-label":"Prompt title",className:"w-full px-2 py-1.5 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg focus:outline-none focus:border-cc-primary/40"}),l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx("button",{type:"button","aria-pressed":w==="global",onClick:()=>C("global"),className:`px-2 py-0.5 text-[11px] rounded border transition-colors cursor-pointer ${w==="global"?"border-cc-primary/40 text-cc-primary bg-cc-primary/8":"border-cc-border text-cc-muted hover:text-cc-fg"}`,children:"Global"}),l.jsx("button",{type:"button","aria-pressed":w==="project",onClick:()=>C("project"),className:`px-2 py-0.5 text-[11px] rounded border transition-colors cursor-pointer ${w==="project"?"border-cc-primary/40 text-cc-primary bg-cc-primary/8":"border-cc-border text-cc-muted hover:text-cc-fg"}`,children:"This project"})]}),w==="project"&&(A==null?void 0:A.cwd)&&l.jsx("div",{className:"text-[10px] text-cc-muted font-mono-code truncate",title:A.cwd,children:A.cwd}),E?l.jsx("div",{className:"text-[11px] text-cc-error",children:E}):null,l.jsxs("div",{className:"flex items-center gap-1.5 justify-end",children:[l.jsx("button",{onClick:()=>{_(!1),C("global"),R(null)},className:"px-2 py-1 text-[11px] rounded-md border border-cc-border text-cc-muted hover:text-cc-fg cursor-pointer",children:"Cancel"}),l.jsx("button",{onClick:dt,disabled:!j.trim()||!t.trim(),className:`px-2 py-1 text-[11px] rounded-md border ${j.trim()&&t.trim()?"border-cc-primary/40 text-cc-primary bg-cc-primary/8 cursor-pointer":"border-cc-border text-cc-muted cursor-not-allowed"}`,children:"Save"})]})]}),l.jsxs("div",{className:"flex items-center gap-1.5 px-3 pt-1.5 pb-0.5 sm:hidden",children:[l.jsx(Y5,{isPlan:B,isConnected:Z,onToggle:Ve,modeLabel:ae,size:"mobile"}),l.jsx(G5,{sessionId:e}),l.jsx("div",{className:"flex-1"}),l.jsx(Id,{onClick:_e,disabled:!Z||!t.trim(),active:Z&&!!t.trim(),title:"Save as prompt",children:l.jsx(W5,{})}),l.jsx(Id,{onClick:()=>{var Q;return(Q=F.current)==null?void 0:Q.click()},disabled:!Z,active:Z,title:"Attach file",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-4 h-4",children:l.jsx("path",{d:"M11.5 6.5L7 11a2 2 0 1 1-2.83-2.83l5-5a3.25 3.25 0 1 1 4.6 4.6l-5.7 5.7a4.5 4.5 0 0 1-6.36-6.36L7 2",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),l.jsx("div",{className:"px-3 sm:px-3 pt-1 sm:pt-2.5",children:l.jsx("textarea",{ref:q,value:t,onChange:ze,onKeyDown:Ce,onClick:Ee,onKeyUp:Ee,onPaste:yt,"aria-label":"Message input",placeholder:Z?"Type a message... (/ + @)":"Waiting for CLI connection...",disabled:!Z,rows:1,className:"w-full px-1 py-1.5 text-base sm:text-sm bg-transparent resize-none outline-none text-cc-fg font-sans-ui placeholder:text-cc-muted disabled:opacity-50 overflow-y-auto",style:{minHeight:"36px",maxHeight:"200px"}})}),l.jsx("div",{className:"flex items-center justify-end gap-1 px-3 pb-1 sm:hidden",children:l.jsx(Q5,{isRunning:Ae,canSend:Qr,onSend:we,onInterrupt:Pe,size:"mobile"})}),l.jsxs("div",{className:"hidden sm:flex items-center gap-1.5 px-2.5 pb-2",children:[l.jsx(Id,{onClick:()=>{var Q;return(Q=F.current)==null?void 0:Q.click()},disabled:!Z,active:Z,title:"Attach file",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-4 h-4",children:l.jsx("path",{d:"M8 3v10M3 8h10",strokeLinecap:"round"})})}),l.jsx(Id,{onClick:_e,disabled:!Z||!t.trim(),active:Z&&!!t.trim(),title:"Save as prompt",children:l.jsx(W5,{})}),l.jsx(Y5,{isPlan:B,isConnected:Z,onToggle:Ve,modeLabel:ae,size:"desktop"}),l.jsx("div",{className:"flex-1"}),l.jsx(G5,{sessionId:e}),l.jsx(Q5,{isRunning:Ae,canSend:Qr,onSend:we,onInterrupt:Pe,size:"desktop"})]})]})]})})}function lR(e){if(e.type==="setMode")return`Set mode to "${e.mode}"`;const n=e.destination==="session"?"for session":"always";if(e.type==="addRules"||e.type==="replaceRules"){const r=e.rules[0];if(r!=null&&r.ruleContent)return`Allow "${r.ruleContent}" ${n}`;if(r!=null&&r.toolName)return`Allow ${r.toolName} ${n}`}return e.type==="addDirectories"?`Trust ${e.directories[0]||"directory"} ${n}`:`Allow ${n}`}function oR(e,t){const n={};for(const[r,a]of Object.entries(t)){const o=e[Number(r)],u=typeof(o==null?void 0:o.question)=="string"&&o.question?o.question:r;n[u]=a}return n}function cR({permission:e,sessionId:t}){const[n,r]=k.useState(!1),a=Y(p=>p.removePermission);function o(p,m){r(!0),On(t,{type:"permission_response",request_id:e.request_id,behavior:"allow",updated_input:p,...m!=null&&m.length?{updated_permissions:m}:{}}),a(t,e.request_id)}function u(){r(!0),On(t,{type:"permission_response",request_id:e.request_id,behavior:"deny",message:"Denied by user"}),a(t,e.request_id)}const h=e.tool_name==="AskUserQuestion",f=e.permission_suggestions;return l.jsx("div",{className:"px-2 sm:px-4 py-3 border-b border-cc-border animate-[fadeSlideIn_0.2s_ease-out]",children:l.jsx("div",{className:"max-w-3xl mx-auto",children:l.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[l.jsx("div",{className:`w-7 h-7 sm:w-8 sm:h-8 rounded-lg flex items-center justify-center shrink-0 mt-0.5 ${h?"bg-cc-primary/10 border border-cc-primary/20":"bg-cc-warning/10 border border-cc-warning/20"}`,children:h?l.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-4 h-4 text-cc-primary",children:l.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})}):l.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-4 h-4 text-cc-warning",children:l.jsx("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[l.jsx("span",{className:`text-xs font-semibold ${h?"text-cc-primary":"text-cc-warning"}`,children:h?"Question":"Permission Request"}),!h&&l.jsx("span",{className:"text-[11px] text-cc-muted font-mono-code",children:e.display_name||e.tool_name}),e.title&&l.jsx("span",{className:"text-[11px] text-cc-muted",children:e.title})]}),h?l.jsx(pR,{input:e.input,onSelect:p=>o({...e.input,answers:p}),disabled:n}):l.jsx(hR,{toolName:e.tool_name,input:e.input,description:e.description}),e.decision_reason&&l.jsx("p",{className:"text-xs text-cc-muted mt-1 italic",children:e.decision_reason}),e.ai_validation&&!h&&l.jsx(dR,{validation:e.ai_validation}),!h&&l.jsxs("div",{className:"flex items-center gap-2 mt-3 flex-wrap",children:[l.jsxs("button",{onClick:()=>o(),disabled:n,className:"inline-flex items-center gap-1.5 px-3 py-2.5 text-xs font-medium rounded-lg bg-cc-success/90 hover:bg-cc-success text-white disabled:opacity-50 transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-3 h-3",children:l.jsx("path",{d:"M3 8.5l3.5 3.5 6.5-7"})}),"Allow"]}),f==null?void 0:f.map((p,m)=>l.jsxs("button",{onClick:()=>o(void 0,[p]),disabled:n,title:`${p.type}: ${JSON.stringify(p)}`,className:"inline-flex items-center gap-1.5 px-3 py-2.5 text-xs font-medium rounded-lg bg-cc-primary/10 hover:bg-cc-primary/20 text-cc-primary border border-cc-primary/20 disabled:opacity-50 transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:l.jsx("path",{d:"M3 8.5l3.5 3.5 6.5-7"})}),lR(p)]},m)),l.jsxs("button",{onClick:u,disabled:n,className:"inline-flex items-center gap-1.5 px-3 py-2.5 text-xs font-medium rounded-lg bg-cc-hover hover:bg-cc-active text-cc-fg border border-cc-border disabled:opacity-50 transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-3 h-3",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})}),"Deny"]})]})]})]})})})}function uR(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 dR({validation:e}){const t=e.verdict==="uncertain"&&uR(e.reason),n=e.verdict==="safe"?"bg-cc-success/10 text-cc-success":e.verdict==="dangerous"?"bg-cc-error/10 text-cc-error":"bg-cc-warning/10 text-cc-warning",r=t?"AI analysis unavailable — manual review:":"AI analysis:";return l.jsxs("div",{className:`mt-2 flex items-center gap-1.5 text-[11px] px-2 py-1.5 rounded-md ${n}`,children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 shrink-0",children:l.jsx("path",{d:"M8 1a2.5 2.5 0 00-2.5 2.5v.382a8 8 0 00-1.074.646l-.33-.191a2.5 2.5 0 00-3.415.912 2.5 2.5 0 00.916 3.42l.33.19A8 8 0 001.5 9.5v.382A8 8 0 002 10.5l-.33.19a2.5 2.5 0 00-.916 3.42 2.5 2.5 0 003.415.912l.33-.191a8 8 0 001.074.646V16A2.5 2.5 0 008 13.5 2.5 2.5 0 0010.5 16v-.713a8 8 0 001.074-.646l.33.191a2.5 2.5 0 003.415-.912 2.5 2.5 0 00-.916-3.42L14 10.5V9.5l.33-.19a2.5 2.5 0 00.916-3.42 2.5 2.5 0 00-3.415-.912l-.33.191A8 8 0 0010.5 4.882V4.5A2.5 2.5 0 008 2V1z"})}),l.jsx("span",{className:"font-medium",children:r}),l.jsx("span",{children:e.reason})]})}function hR({toolName:e,input:t,description:n}){return e==="Bash"?l.jsx(fR,{input:t}):e==="Edit"?l.jsx(mR,{input:t}):e==="Write"?l.jsx(gR,{input:t}):e==="Read"?l.jsx(xR,{input:t}):e==="Glob"?l.jsx(vR,{input:t}):e==="Grep"?l.jsx(bR,{input:t}):e==="ExitPlanMode"?l.jsx(yR,{input:t}):l.jsx(Ok,{input:t,description:n})}function fR({input:e}){const t=typeof e.command=="string"?e.command:"",n=typeof e.description=="string"?e.description:"";return l.jsxs("div",{className:"space-y-1.5",children:[n&&l.jsx("div",{className:"text-xs text-cc-muted",children:n}),l.jsxs("pre",{className:"text-xs text-cc-fg font-mono-code bg-cc-code-bg/30 rounded-lg px-2 sm:px-3 py-2 max-h-32 overflow-y-auto overflow-x-auto whitespace-pre-wrap break-words",children:[l.jsx("span",{className:"text-cc-muted select-none",children:"$ "}),t]})]})}function pR({input:e,onSelect:t,disabled:n}){const r=Array.isArray(e.questions)?e.questions:[],[a,o]=k.useState({}),[u,h]=k.useState({}),[f,p]=k.useState({});function m(N){return oR(r,N)}function x(N,w){const C=String(N);o(E=>({...E,[C]:w})),p(E=>({...E,[C]:!1})),r.length<=1&&t(m({[C]:w}))}function b(N){var E;const w=String(N),C=(E=u[w])==null?void 0:E.trim();C&&(o(R=>({...R,[w]:C})),r.length<=1&&t(m({[w]:C})))}function y(N,w){const C=String(N);h(R=>({...R,[C]:w}));const E=w.trim();o(R=>{if(!E){const L={...R};return delete L[C],L}return{...R,[C]:E}})}function _(N){const w=String(N);p(C=>{const E=!!C[w],R={...C,[w]:!E};return E&&(o(L=>{const O={...L};return delete O[w],O}),h(L=>{const O={...L};return delete O[w],O})),R})}function j(){t(m(a))}if(r.length===0){const N=typeof e.question=="string"?e.question:"";return N?l.jsx("div",{className:"text-sm text-cc-fg bg-cc-code-bg/30 rounded-lg px-3 py-2",children:N}):l.jsx(Ok,{input:e})}return l.jsxs("div",{className:"space-y-3",children:[r.map((N,w)=>{const C=typeof N.header=="string"?N.header:"",E=typeof N.question=="string"?N.question:"",R=Array.isArray(N.options)?N.options:[],L=String(w),O=a[L],q=f[L];return l.jsxs("div",{className:"space-y-2",children:[C&&l.jsx("span",{className:"inline-block text-[10px] font-semibold text-cc-primary bg-cc-primary/10 px-1.5 py-0.5 rounded",children:C}),E&&l.jsx("p",{className:"text-sm text-cc-fg leading-relaxed",children:E}),R.length>0&&l.jsxs("div",{className:"space-y-1.5",children:[R.map((F,W)=>{const z=typeof F.label=="string"?F.label:String(F),I=typeof F.description=="string"?F.description:"",A=O===z;return l.jsx("button",{onClick:()=>x(w,z),disabled:n,className:`w-full text-left px-3 py-2 rounded-lg border transition-all cursor-pointer disabled:opacity-50 ${A?"border-cc-primary bg-cc-primary/10 ring-1 ring-cc-primary/30":"border-cc-border bg-cc-hover/50 hover:bg-cc-hover hover:border-cc-primary/30"}`,children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:`w-4 h-4 rounded-full border-2 flex items-center justify-center shrink-0 ${A?"border-cc-primary":"border-cc-muted/40"}`,children:A&&l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-primary"})}),l.jsxs("div",{children:[l.jsx("span",{className:"text-xs font-medium text-cc-fg",children:z}),I&&l.jsx("p",{className:"text-[11px] text-cc-muted mt-0.5 leading-snug",children:I})]})]})},W)}),l.jsx("button",{onClick:()=>_(w),disabled:n,className:`w-full text-left px-3 py-2 rounded-lg border transition-all cursor-pointer disabled:opacity-50 ${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:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:`w-4 h-4 rounded-full border-2 flex items-center justify-center shrink-0 ${q?"border-cc-primary":"border-cc-muted/40"}`,children:q&&l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-primary"})}),l.jsx("span",{className:"text-xs font-medium text-cc-muted",children:"Other..."})]})}),q&&l.jsxs("div",{className:"pl-6",children:[l.jsx("input",{type:"text",value:u[L]||"",onChange:F=>y(w,F.target.value),onKeyDown:F=>{F.key==="Enter"&&b(w)},placeholder:"Type your answer...",className:"w-full px-2.5 py-1.5 text-xs bg-cc-input-bg border border-cc-border rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/50",autoFocus:!0}),r.length<=1&&l.jsx("p",{className:"mt-1 text-[10px] text-cc-muted",children:"Press Enter to submit"})]})]})]},w)}),r.length>1&&Object.keys(a).length>0&&l.jsx("button",{onClick:j,disabled:n,className:"inline-flex items-center gap-1.5 px-4 py-2 text-xs font-medium rounded-lg bg-cc-primary hover:bg-cc-primary-hover text-white disabled:opacity-50 transition-colors cursor-pointer",children:"Submit answers"})]})}function mR({input:e}){const t=String(e.file_path||""),n=String(e.old_string||""),r=String(e.new_string||"");return l.jsx(no,{oldText:n,newText:r,fileName:t,mode:"compact"})}function gR({input:e}){const t=String(e.file_path||""),n=String(e.content||"");return l.jsx(no,{newText:n,fileName:t,mode:"compact"})}function xR({input:e}){const t=String(e.file_path||"");return l.jsx("div",{className:"text-xs text-cc-muted font-mono-code bg-cc-code-bg/30 rounded-lg px-3 py-2",children:t})}function vR({input:e}){const t=typeof e.pattern=="string"?e.pattern:"",n=typeof e.path=="string"?e.path:"";return l.jsxs("div",{className:"text-xs font-mono-code bg-cc-code-bg/30 rounded-lg px-3 py-2 space-y-0.5",children:[l.jsx("div",{className:"text-cc-fg",children:t}),n&&l.jsx("div",{className:"text-cc-muted",children:n})]})}function bR({input:e}){const t=typeof e.pattern=="string"?e.pattern:"",n=typeof e.path=="string"?e.path:"",r=typeof e.glob=="string"?e.glob:"";return l.jsxs("div",{className:"text-xs font-mono-code bg-cc-code-bg/30 rounded-lg px-3 py-2 space-y-0.5",children:[l.jsx("div",{className:"text-cc-fg",children:t}),n&&l.jsx("div",{className:"text-cc-muted",children:n}),r&&l.jsx("div",{className:"text-cc-muted",children:r})]})}function yR({input:e}){const t=typeof e.plan=="string"?e.plan:"",n=Array.isArray(e.allowedPrompts)?e.allowedPrompts:[];return l.jsxs("div",{className:"space-y-2",children:[t&&l.jsxs("div",{className:"rounded-xl border border-cc-border overflow-hidden bg-cc-card",children:[l.jsxs("div",{className:"px-3 py-2 border-b border-cc-border bg-cc-primary/[0.04] flex items-center gap-2",children:[l.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 rounded bg-cc-primary/15 text-cc-primary shrink-0",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:l.jsx("path",{d:"M3 3.5h10M3 8h10M3 12.5h6",strokeLinecap:"round"})})}),l.jsx("span",{className:"text-[11px] text-cc-primary font-semibold tracking-wide uppercase",children:"Plan"})]}),l.jsx("div",{className:"px-3 py-3 max-h-72 overflow-y-auto markdown-body text-[13px] text-cc-fg leading-relaxed",children:l.jsx(lv,{remarkPlugins:[dv],components:{h1:({children:r})=>l.jsx("h1",{className:"text-base font-semibold text-cc-fg mb-2",children:r}),h2:({children:r})=>l.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-1.5 mt-3 first:mt-0",children:r}),h3:({children:r})=>l.jsx("h3",{className:"text-sm font-medium text-cc-fg mb-1.5 mt-2",children:r}),p:({children:r})=>l.jsx("p",{className:"mb-2 last:mb-0",children:r}),ul:({children:r})=>l.jsx("ul",{className:"list-disc pl-4 mb-2 space-y-0.5",children:r}),ol:({children:r})=>l.jsx("ol",{className:"list-decimal pl-4 mb-2 space-y-0.5",children:r}),li:({children:r})=>l.jsx("li",{children:r}),strong:({children:r})=>l.jsx("strong",{className:"font-semibold text-cc-fg",children:r}),a:({href:r,children:a})=>l.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"text-cc-primary hover:underline",children:a}),code:r=>{const{children:a,className:o}=r;return/language-(\w+)/.exec(o||"")||typeof a=="string"&&a.includes(`
104
+ `)?l.jsx("pre",{className:"my-2 px-2.5 py-2 rounded-lg bg-cc-code-bg text-cc-code-fg text-[12px] font-mono-code leading-relaxed overflow-x-auto border border-cc-border",children:l.jsx("code",{children:a})}):l.jsx(bk,{textClassName:"text-[12px] text-cc-code-fg",children:a})},pre:({children:r})=>l.jsx(l.Fragment,{children:r}),blockquote:({children:r})=>l.jsx("blockquote",{className:"border-l-2 border-cc-primary/40 pl-2 text-cc-muted italic my-2",children:r})},children:t})})]}),n.length>0&&l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"text-[10px] text-cc-muted uppercase tracking-wider",children:"Requested permissions"}),l.jsx("div",{className:"space-y-1",children:n.map((r,a)=>l.jsxs("div",{className:"flex items-center gap-2 text-[11px] font-mono-code bg-cc-code-bg/30 rounded-lg px-2.5 py-1.5",children:[l.jsx("span",{className:"text-cc-muted shrink-0",children:String(r.tool||"")}),l.jsx("span",{className:"text-cc-fg",children:String(r.prompt||"")})]},a))})]}),!t&&n.length===0&&l.jsx("div",{className:"text-xs text-cc-muted",children:"Plan approval requested"})]})}function Ok({input:e,description:t}){const n=Object.entries(e).filter(([,r])=>r!=null&&r!=="");return n.length===0&&t?l.jsx("div",{className:"text-xs text-cc-fg",children:t}):l.jsxs("div",{className:"space-y-1",children:[t&&l.jsx("div",{className:"text-xs text-cc-muted mb-1",children:t}),l.jsx("div",{className:"bg-cc-code-bg/30 rounded-lg px-3 py-2 space-y-1",children:n.map(([r,a])=>{const o=typeof a=="string"?a.length>200?a.slice(0,200)+"...":a:JSON.stringify(a);return l.jsxs("div",{className:"flex gap-2 text-[11px] font-mono-code",children:[l.jsxs("span",{className:"text-cc-muted shrink-0",children:[r,":"]}),l.jsx("span",{className:"text-cc-fg break-all",children:o})]},r)})})]})}function _R({entry:e,onDismiss:t}){const{request:n,behavior:r,reason:a}=e,o=r==="allow";let u=n.tool_name;if(n.tool_name==="Bash"&&typeof n.input.command=="string"){const h=n.input.command;u=h.length>60?h.slice(0,60)+"...":h}else(n.tool_name==="Read"||n.tool_name==="Write"||n.tool_name==="Edit")&&typeof n.input.file_path=="string"?u=`${n.tool_name} ${n.input.file_path}`:n.tool_name==="Glob"&&typeof n.input.pattern=="string"?u=`Glob ${n.input.pattern}`:n.tool_name==="Grep"&&typeof n.input.pattern=="string"&&(u=`Grep ${n.input.pattern}`);return l.jsxs("div",{className:`flex items-center gap-2 px-3 py-1.5 text-[11px] ${o?"text-cc-success":"text-cc-error"}`,children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 shrink-0 opacity-70",children:l.jsx("path",{fillRule:"evenodd",d:"M8 1.246l.542.228c1.926.812 3.732.95 5.408.435l.61-.187v6.528a5.75 5.75 0 01-2.863 4.973L8 15.5l-3.697-2.277A5.75 5.75 0 011.44 8.25V1.722l.61.187c1.676.515 3.482.377 5.408-.435L8 1.246z",clipRule:"evenodd"})}),l.jsxs("span",{className:"flex-1",children:["AI auto-",o?"approved":"denied",":"," ",l.jsx("span",{className:"font-mono-code opacity-80",children:u}),a&&l.jsxs("span",{className:"text-cc-muted ml-1",children:["(",a,")"]})]}),t&&l.jsx("button",{onClick:t,className:"opacity-50 hover:opacity-100 transition-opacity cursor-pointer flex-shrink-0","aria-label":"Dismiss notification",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]})}const wR=[],SR=[],X5="activity-tray-panel";function kR(e,t){const n=Math.round(((t||Date.now())-e)/1e3);if(n<60)return`${n}s`;const r=Math.floor(n/60),a=n%60;return`${r}m${a>0?` ${a}s`:""}`}function jR(e,t,n=4e3){const[r,a]=k.useState(!1),o=k.useRef(void 0),u=e.length+t.length,h=u>0&&e.every(f=>f.status==="completed")&&t.every(f=>f.status!=="running");return k.useEffect(()=>(clearTimeout(o.current),h?o.current=setTimeout(()=>a(!0),n):a(!1),()=>clearTimeout(o.current)),[h,n]),k.useEffect(()=>{a(!1)},[u]),r}function NR(e){const[t,n]=k.useState(0);return k.useEffect(()=>{if(!e)return;const r=setInterval(()=>n(a=>a+1),1e3);return()=>clearInterval(r)},[e]),t}function CR({status:e}){return e==="running"||e==="in_progress"?l.jsxs("span",{className:"relative flex h-1.5 w-1.5 shrink-0",children:[l.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-cc-warning opacity-75 animate-ping"}),l.jsx("span",{className:"relative inline-flex rounded-full h-1.5 w-1.5 bg-cc-warning"})]}):e==="completed"?l.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-cc-success shrink-0"}):e==="failed"?l.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-cc-error shrink-0"}):l.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-cc-muted/30 shrink-0"})}function ER({agent:e,tick:t}){const[n,r]=k.useState(!1),a=e.status!=="running",o=!!e.summary,u=l.jsxs(l.Fragment,{children:[l.jsx(CR,{status:e.status}),l.jsx("span",{className:"text-[11px] text-cc-fg/80 truncate flex-1 font-medium",children:e.name}),e.agentType&&l.jsx("span",{className:"text-[9px] text-cc-muted/50 uppercase tracking-wider shrink-0",children:e.agentType}),l.jsx("span",{className:"text-[10px] text-cc-muted/50 tabular-nums font-mono-code",children:kR(e.startedAt,e.completedAt)})]});return l.jsxs("div",{className:`transition-opacity duration-300 ${a?"opacity-60":""}`,children:[o?l.jsx("button",{type:"button",onClick:()=>r(!n),"aria-expanded":n,className:"w-full flex items-center gap-2 px-2.5 min-h-[36px] text-left hover:bg-cc-hover/50 rounded-md transition-colors cursor-pointer",children:u}):l.jsx("div",{className:"flex items-center gap-2 px-2.5 min-h-[36px]",children:u}),n&&e.summary&&l.jsx("p",{className:"px-2.5 pb-1.5 ml-4 text-[10px] text-cc-muted/60 leading-relaxed line-clamp-3 font-mono-code",children:e.summary})]})}function AR({task:e}){const t=e.status==="completed",n=e.status==="in_progress";return l.jsxs("div",{className:`flex items-center gap-2 px-2.5 min-h-[32px] transition-opacity duration-300 ${t?"opacity-40":""}`,children:[l.jsx("span",{className:"shrink-0 flex items-center justify-center w-3.5 h-3.5",children:n?l.jsx("svg",{className:"w-3.5 h-3.5 text-cc-primary animate-spin",viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:l.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"28",strokeDashoffset:"8",strokeLinecap:"round"})}):t?l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-success","aria-hidden":!0,children:l.jsx("path",{fillRule:"evenodd",d:"M8 15A7 7 0 108 1a7 7 0 000 14zm3.354-9.354a.5.5 0 00-.708-.708L7 8.586 5.354 6.94a.5.5 0 10-.708.708l2 2a.5.5 0 00.708 0l4-4z",clipRule:"evenodd"})}):l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3.5 h-3.5 text-cc-muted/40","aria-hidden":!0,children:l.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"})})}),l.jsx("span",{className:`text-[11px] leading-snug flex-1 truncate ${t?"text-cc-muted line-through":"text-cc-fg/80"}`,children:e.subject}),n&&e.activeForm&&l.jsx("span",{className:"text-[10px] text-cc-muted/50 italic truncate max-w-[120px] shrink-0",children:e.activeForm})]})}function TR({sessionId:e}){const[t,n]=k.useState(!1),r=k.useRef(null),a=k.useRef(null),o=Y(E=>E.sessionTasks.get(e)??wR),u=Y(E=>E.sessionBackgroundAgents.get(e)??SR),h=jR(o,u),f=u.some(E=>E.status==="running"),p=NR(f),m=u.filter(E=>E.status==="running").length,x=o.length,b=o.filter(E=>E.status==="completed").length,y=o.filter(E=>E.status==="in_progress").length,_=o.length>0||u.length>0,j=m>0||y>0,N=k.useCallback(()=>n(!1),[]);k.useEffect(()=>{if(!t)return;const E=R=>{R.key==="Escape"&&(R.stopPropagation(),N())};return document.addEventListener("keydown",E),()=>document.removeEventListener("keydown",E)},[t,N]),k.useEffect(()=>{if(!t)return;const E=R=>{r.current&&!r.current.contains(R.target)&&N()};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[t,N]),k.useEffect(()=>{t&&a.current&&a.current.focus()},[t]);const[w,C]=k.useState(!1);return k.useEffect(()=>{_&&C(!1)},[_,o.length,u.length]),!_||w?null:l.jsxs("div",{ref:r,className:`absolute bottom-3 right-3 z-20 transition-opacity duration-500 ${h?"opacity-0 pointer-events-none":"opacity-100"}`,style:h?void 0:{animation:"fadeSlideIn 0.3s ease-out"},onTransitionEnd:()=>{h&&C(!0)},children:[t&&l.jsxs("div",{ref:a,id:X5,role:"dialog","aria-label":"Activity panel",tabIndex:-1,className:"mb-1.5 w-72 max-w-[calc(100vw-2rem)] max-h-64 overflow-y-auto rounded-xl border border-cc-border/60 bg-cc-surface/95 backdrop-blur-xl shadow-lg shadow-black/20 outline-none",style:{animation:"fadeSlideIn 0.2s ease-out"},children:[l.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-cc-border/40",children:[l.jsx("span",{className:"text-[11px] font-semibold text-cc-fg/70 uppercase tracking-wider",role:"heading","aria-level":3,children:"Activity"}),l.jsx("button",{type:"button",onClick:N,className:"flex items-center justify-center w-7 h-7 -mr-1 rounded-md text-cc-muted/40 hover:text-cc-muted/70 hover:bg-cc-hover/50 transition-colors cursor-pointer","aria-label":"Close activity tray",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]}),u.length>0&&l.jsxs("div",{className:"py-1",children:[l.jsx("div",{className:"px-3 py-1",role:"heading","aria-level":4,children:l.jsx("span",{className:"text-[9px] text-cc-muted/40 uppercase tracking-widest font-semibold",children:"Agents"})}),u.map(E=>l.jsx(ER,{agent:E,tick:p},E.toolUseId))]}),u.length>0&&o.length>0&&l.jsx("div",{className:"border-t border-cc-border/30 mx-2",role:"separator"}),o.length>0&&l.jsxs("div",{className:"py-1",children:[l.jsx("div",{className:"px-3 py-1",role:"heading","aria-level":4,children:l.jsx("span",{className:"text-[9px] text-cc-muted/40 uppercase tracking-widest font-semibold",children:"Tasks"})}),o.map(E=>l.jsx(AR,{task:E},E.id))]})]}),l.jsxs("button",{type:"button",onClick:()=>n(!t),"aria-expanded":t,"aria-controls":X5,className:`
105
+ flex items-center gap-2 px-3 min-h-[36px] rounded-full
106
+ border border-cc-border/50 bg-cc-surface/90 backdrop-blur-lg
107
+ shadow-md shadow-black/15
108
+ hover:bg-cc-hover/80 hover:border-cc-border/70
109
+ transition-all duration-200 cursor-pointer
110
+ ${t?"ring-1 ring-cc-primary/30":""}
111
+ `,"aria-label":`Activity: ${m} agents running, ${b}/${x} tasks`,children:[j?l.jsxs("span",{className:"relative flex h-2 w-2",children:[l.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-cc-warning opacity-75 animate-ping"}),l.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-cc-warning"})]}):l.jsx("span",{className:"h-2 w-2 rounded-full bg-cc-success"}),u.length>0&&l.jsx("span",{className:"text-[11px] text-cc-fg/70 font-medium tabular-nums",children:m>0?`${m} agent${m!==1?"s":""}`:`${u.length} done`}),u.length>0&&o.length>0&&l.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-cc-muted/30"}),o.length>0&&l.jsxs("span",{className:"text-[11px] text-cc-fg/70 tabular-nums",children:[b,"/",x]}),l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2.5 h-2.5 text-cc-muted/40 transition-transform duration-200 ${t?"rotate-180":""}`,"aria-hidden":!0,children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]})]})}function MR({sessionId:e}){const t=Y(_=>_.pendingPermissions.get(e)),n=Y(_=>_.aiResolvedPermissions.get(e)),r=Y(_=>_.clearAiResolvedPermissions),a=Y(_=>_.connectionStatus.get(e)??"disconnected"),o=Y(_=>_.cliConnected.get(e)??!1),u=Y(_=>_.cliReconnecting.get(e)??!1),h=Y(_=>_.setCliReconnecting),[f,p]=k.useState(null),m=k.useRef(void 0);k.useEffect(()=>{p(null),clearTimeout(m.current)},[e,o]),k.useEffect(()=>()=>clearTimeout(m.current),[]);const x=k.useCallback(async()=>{p(null),clearTimeout(m.current),h(e,!0);try{await Ne.relaunchSession(e)}catch(_){Yi(_),h(e,!1);const j=_ instanceof Error?_.message:"Reconnection failed";p(j),m.current=setTimeout(()=>p(null),4e3)}},[e,h]),b=k.useMemo(()=>t?Array.from(t.values()):[],[t]),y=a==="connected"&&!o;return l.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[y&&l.jsx("div",{className:"px-4 py-2.5 bg-gradient-to-r from-cc-warning/8 to-cc-warning/4 border-b border-cc-warning/15 flex items-center justify-center gap-3 animate-[fadeSlideIn_0.3s_ease-out]",children:f?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cc-error shrink-0"}),l.jsx("span",{className:"text-xs text-cc-error font-medium",children:f}),l.jsx("button",{onClick:x,className:"text-xs font-medium px-3 py-1.5 rounded-lg bg-cc-error/12 hover:bg-cc-error/20 text-cc-error transition-all cursor-pointer",children:"Retry"})]}):u?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"w-3 h-3 rounded-full border-2 border-cc-warning/30 border-t-cc-warning animate-spin"}),l.jsx("span",{className:"text-xs text-cc-warning font-medium",children:"Reconnecting…"})]}):l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cc-warning animate-[pulse-dot_1.5s_ease-in-out_infinite] shrink-0"}),l.jsx("span",{className:"text-xs text-cc-warning font-medium",children:"CLI disconnected"}),l.jsx("button",{onClick:x,className:"text-xs font-medium px-3 py-1.5 rounded-lg bg-cc-warning/15 hover:bg-cc-warning/25 text-cc-warning transition-all cursor-pointer",children:"Reconnect"})]})}),a==="disconnected"&&l.jsxs("div",{className:"px-4 py-2.5 bg-gradient-to-r from-cc-warning/8 to-cc-warning/4 border-b border-cc-warning/15 flex items-center justify-center gap-2 animate-[fadeSlideIn_0.3s_ease-out]",children:[l.jsx("span",{className:"w-3 h-3 rounded-full border-2 border-cc-warning/30 border-t-cc-warning animate-spin"}),l.jsx("span",{className:"text-xs text-cc-warning font-medium",children:"Reconnecting to session..."})]}),l.jsxs("div",{className:"flex-1 flex flex-col min-h-0 relative",children:[l.jsx(JL,{sessionId:e}),l.jsx(TR,{sessionId:e})]}),n&&n.length>0&&l.jsx("div",{className:"shrink-0 border-t border-cc-border bg-cc-card",children:l.jsx(_R,{entry:n[n.length-1],onDismiss:()=>r(e)})}),b.length>0&&l.jsx("div",{className:"shrink-0 max-h-[60dvh] overflow-y-auto border-t border-cc-border bg-cc-card",children:b.map(_=>l.jsx(cR,{permission:_,sessionId:e},_.request_id))}),l.jsx(aR,{sessionId:e})]})}function DR({sessionId:e}){const[t,n]=k.useState(!1),r=k.useRef(null),a=Y(p=>p.sessions.get(e)),o=(a==null?void 0:a.aiValidationEnabled)??!1,u=(a==null?void 0:a.aiValidationAutoApprove)??!0,h=(a==null?void 0:a.aiValidationAutoDeny)??!1;k.useEffect(()=>{if(!t)return;function p(m){r.current&&!r.current.contains(m.target)&&n(!1)}return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[t]);function f(p,m){const x=!m,b={[p]:x};Y.getState().setSessionAiValidation(e,b),z3(e,b)}return l.jsxs("div",{ref:r,className:"relative",children:[l.jsx("button",{onClick:()=>n(!t),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer ${o?"text-cc-success hover:bg-cc-hover":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:o?"AI Validation: On":"AI Validation: Off","aria-label":"Toggle AI validation settings","aria-expanded":t,children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-[15px] h-[15px]",children:l.jsx("path",{fillRule:"evenodd",d:"M8 1.246l.542.228c1.926.812 3.732.95 5.408.435l.61-.187v6.528a5.75 5.75 0 01-2.863 4.973L8 15.5l-3.697-2.277A5.75 5.75 0 011.44 8.25V1.722l.61.187c1.676.515 3.482.377 5.408-.435L8 1.246z",clipRule:"evenodd"})})}),t&&l.jsxs("div",{className:"absolute right-0 top-full mt-1 z-50 w-64 bg-cc-bg border border-cc-border rounded-lg shadow-lg p-2 space-y-1",children:[l.jsx("p",{className:"text-[10px] text-cc-muted px-2 pt-1 pb-1",children:"AI Validation for this session"}),l.jsxs("button",{type:"button",onClick:()=>f("aiValidationEnabled",o),className:"w-full flex items-center justify-between px-2 py-1.5 rounded-md hover:bg-cc-hover text-cc-fg transition-colors cursor-pointer","aria-label":"Toggle AI validation",children:[l.jsx("span",{className:"text-xs",children:"Enabled"}),l.jsx("span",{className:`text-[10px] font-medium ${o?"text-cc-success":"text-cc-muted"}`,children:o?"On":"Off"})]}),o&&l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button",onClick:()=>f("aiValidationAutoApprove",u),className:"w-full flex items-center justify-between px-2 py-1.5 rounded-md hover:bg-cc-hover text-cc-fg transition-colors cursor-pointer","aria-label":"Toggle auto-approve safe tools",children:[l.jsx("span",{className:"text-xs",children:"Auto-approve safe"}),l.jsx("span",{className:`text-[10px] font-medium ${u?"text-cc-success":"text-cc-muted"}`,children:u?"On":"Off"})]}),l.jsxs("button",{type:"button",onClick:()=>f("aiValidationAutoDeny",h),className:"w-full flex items-center justify-between px-2 py-1.5 rounded-md hover:bg-cc-hover text-cc-fg transition-colors cursor-pointer","aria-label":"Toggle auto-deny dangerous tools",children:[l.jsx("span",{className:"text-xs",children:"Auto-deny dangerous"}),l.jsx("span",{className:`text-[10px] font-medium ${h?"text-cc-success":"text-cc-muted"}`,children:h?"On":"Off"})]})]})]})]})}function LR({sessionId:e}){const[t,n]=k.useState(!1),[r,a]=k.useState(null),[o,u]=k.useState(!1),h=k.useRef(null);k.useEffect(()=>{if(!t)return;const p=x=>{h.current&&!h.current.contains(x.target)&&n(!1)},m=x=>{x.key==="Escape"&&n(!1)};return window.addEventListener("pointerdown",p),window.addEventListener("keydown",m),()=>{window.removeEventListener("pointerdown",p),window.removeEventListener("keydown",m)}},[t]);const f=k.useCallback(async p=>{a(p),u(!1);try{const{blob:m,filename:x}=await Ne.exportSession(e,p),b=URL.createObjectURL(m),y=document.createElement("a");y.href=b,y.download=x,document.body.appendChild(y),y.click(),y.remove(),URL.revokeObjectURL(b),n(!1)}catch(m){Yi(m),u(!0)}finally{a(null)}},[e]);return l.jsxs("div",{ref:h,className:"relative",children:[l.jsx("button",{onClick:()=>n(p=>!p),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer ${t?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:"Export session","aria-label":"Export session","aria-haspopup":"menu","aria-expanded":t,children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3v12m0 0l-4-4m4 4l4-4"}),l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 17v2a2 2 0 002 2h12a2 2 0 002-2v-2"})]})}),t&&l.jsxs("div",{role:"menu",className:"absolute right-0 top-9 z-50 min-w-[176px] rounded-lg border border-cc-border bg-cc-card shadow-lg py-1 animate-[fadeSlideIn_0.15s_ease-out]",children:[l.jsx("div",{className:"px-3 py-1.5 text-[10px] uppercase tracking-wide text-cc-muted",children:"Export session"}),l.jsxs("button",{role:"menuitem",onClick:()=>f("html"),disabled:r!==null,className:"w-full text-left px-3 py-2 text-[12px] text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-default",children:[r==="html"?"Exporting…":"Download as HTML",l.jsx("span",{className:"block text-[10px] text-cc-muted",children:"Includes images"})]}),l.jsxs("button",{role:"menuitem",onClick:()=>f("txt"),disabled:r!==null,className:"w-full text-left px-3 py-2 text-[12px] text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-default",children:[r==="txt"?"Exporting…":"Download as Text",l.jsx("span",{className:"block text-[10px] text-cc-muted",children:"Plain text, no images"})]}),o&&l.jsx("div",{className:"px-3 py-1.5 text-[11px] text-cc-error",children:"Export failed"})]})]})}function RR({sessionId:e}){const t=Y(m=>m.density),n=Y(m=>m.magicUiAvailable),r=Y(m=>{var x;return!!e&&((x=m.sessions.get(e))==null?void 0:x.magicUiActive)===!0}),a=k.useCallback(()=>{var x;if(!e)return;const m=Y.getState();((x=m.sessions.get(e))==null?void 0:x.magicUiActive)===!0&&(m.setSessionMagicUi(e,!1),wy(e,!1))},[e]),o=k.useCallback(()=>{Y.getState().setDensity("standard"),a()},[a]),u=k.useCallback(()=>{Y.getState().setDensity("compact"),a()},[a]),h=k.useCallback(()=>{e&&(Y.getState().setSessionMagicUi(e,!0),wy(e,!0))},[e]);if(!n||!e)return l.jsx(zR,{});const f=t==="compact",p=[{key:"standard",label:"Standard view",active:!r&&!f,onClick:o,icon:l.jsx(Bk,{})},{key:"compact",label:"Compact view",active:!r&&f,onClick:u,icon:l.jsx(Pk,{})},{key:"magic",label:"Magic dashboard view",active:r,onClick:h,icon:l.jsx(OR,{})}];return l.jsx("div",{role:"group","aria-label":"View mode",className:"flex items-center rounded-md border border-cc-border overflow-hidden",children:p.map(m=>l.jsx("button",{onClick:m.onClick,className:`flex items-center justify-center w-8 h-8 transition-colors cursor-pointer ${m.active?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:m.label,"aria-label":m.label,"aria-pressed":m.active,children:m.icon},m.key))})}function zR(){const e=Y(a=>a.density),t=k.useCallback(()=>Y.getState().toggleDensity(),[]),n=e==="compact",r=n?"Switch to standard density":"Switch to compact density";return l.jsx("button",{onClick:t,className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer ${n?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:r,"aria-label":r,"aria-pressed":n,children:n?l.jsx(Pk,{}):l.jsx(Bk,{})})}function Bk(){return l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",className:"w-[15px] h-[15px]","aria-hidden":"true",children:l.jsx("path",{d:"M4 6h16M4 12h16M4 18h16"})})}function Pk(){return l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",className:"w-[15px] h-[15px]","aria-hidden":"true",children:l.jsx("path",{d:"M4 7h16M4 11h16M4 15h16M4 19h16"})})}function OR(){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"w-[15px] h-[15px]","aria-hidden":"true",children:[l.jsx("path",{d:"M12 3l1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9L12 3z"}),l.jsx("path",{d:"M19 15l.8 2.2L22 18l-2.2.8L19 21l-.8-2.2L16 18l2.2-.8L19 15z"})]})}function BR(){var q;const e=k.useSyncExternalStore(F=>(window.addEventListener("hashchange",F),()=>window.removeEventListener("hashchange",F)),()=>window.location.hash),t=k.useMemo(()=>qx(e),[e]),n=t.page==="session"||t.page==="home",r=Y(F=>F.currentSessionId),a=Y(F=>F.cliConnected),o=Y(F=>F.sessionStatus),u=Y(F=>F.sessionNames),h=Y(F=>F.sdkSessions),f=Y(F=>F.sidebarOpen),p=Y(F=>F.setSidebarOpen),m=Y(F=>F.taskPanelOpen),x=Y(F=>F.setTaskPanelOpen),b=Y(F=>F.activeTab),y=Y(F=>F.setActiveTab),_=Y(F=>F.markChatTabReentry),j=Y(F=>r?F.gitChangedFilesCount.get(r)??0:0),N=r?o.get(r)??null:null,w=r?a.get(r)??!1:!1,C=r?(u==null?void 0:u.get(r))||((q=h.find(F=>F.sessionId===r))==null?void 0:q.name)||`Session ${r.slice(0,8)}`:null,E=!!(r&&n),R=t.page==="session"&&!!r,L=["chat","diff"],O=F=>{F==="chat"&&b!=="chat"&&r&&_(r),y(F)};return k.useEffect(()=>{const F=W=>{if(!(W.metaKey||W.ctrlKey)||W.key.toLowerCase()!=="j"||!E)return;const z=W.target;if(z&&(z.tagName==="TEXTAREA"||z.tagName==="INPUT"||z.isContentEditable))return;W.preventDefault();const I=Math.max(0,L.indexOf(b)),A=W.shiftKey?-1:1,X=(I+A+L.length)%L.length;O(L[X])};return window.addEventListener("keydown",F),()=>window.removeEventListener("keydown",F)},[E,L,b,y,_,r]),l.jsx("header",{className:"relative shrink-0 h-11 px-4 bg-cc-bg",children:l.jsxs("div",{className:"h-full flex items-center gap-1 min-w-0",children:[l.jsx("button",{onClick:()=>p(!f),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer shrink-0 ${f?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,"aria-label":"Toggle sidebar",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 3h18v18H3V3z"}),l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 3v18"})]})}),E&&l.jsxs("div",{className:"flex-1 flex items-center justify-start md:justify-center gap-0.5 min-w-0 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[l.jsxs("button",{onClick:()=>O("chat"),className:`h-full px-3 text-[12px] font-medium transition-colors cursor-pointer flex items-center gap-1.5 border-b-[1.5px] shrink-0 ${b==="chat"?"text-cc-fg border-cc-primary":"text-cc-muted hover:text-cc-fg border-transparent"}`,title:C||"Session","aria-label":"Session tab",children:[l.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${w?N==="running"?"bg-cc-primary":N==="compacting"?"bg-cc-warning":"bg-cc-success":"bg-cc-muted opacity-45"}`}),"Session"]}),l.jsxs("button",{onClick:()=>O("diff"),className:`h-full px-3 text-[12px] font-medium transition-colors cursor-pointer flex items-center gap-1.5 border-b-[1.5px] shrink-0 ${b==="diff"?"text-cc-fg border-cc-primary":"text-cc-muted hover:text-cc-fg border-transparent"}`,"aria-label":"Diffs tab",children:["Diffs",j>0&&l.jsx("span",{className:"text-[9px] rounded-full min-w-[15px] h-[15px] px-1 flex items-center justify-center font-semibold leading-none bg-amber-100 text-amber-700 dark:bg-amber-900/60 dark:text-amber-300",children:j})]})]}),l.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[E&&r&&l.jsx(DR,{sessionId:r}),E&&r&&l.jsx(LR,{sessionId:r}),E&&l.jsx(RR,{sessionId:r??null}),l.jsx(PR,{}),R&&l.jsx("button",{onClick:()=>x(!m),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer ${m?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:"Toggle context panel","aria-label":"Toggle context panel",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 3h18v18H3V3z"}),l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 3v18"})]})})]})]})})}function PR(){const e=Y(n=>n.darkMode),t=k.useCallback(()=>Y.getState().toggleDarkMode(),[]);return l.jsx("button",{onClick:t,className:"flex items-center justify-center w-8 h-8 rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:e?"Switch to light mode":"Switch to dark mode","aria-label":e?"Switch to light mode":"Switch to dark mode",children:e?l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[l.jsx("circle",{cx:"12",cy:"12",r:"4"}),l.jsx("path",{d:"M12 2v2m0 16v2M4.93 4.93l1.41 1.41m11.32 11.32l1.41 1.41M2 12h2m16 0h2M4.93 19.07l1.41-1.41m11.32-11.32l1.41-1.41"})]}):l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:l.jsx("path",{d:"M21 12.79A9 9 0 1111.21 3a7 7 0 009.79 9.79z"})})})}const $k="cc-recent-dirs";function Ph(){try{return JSON.parse(localStorage.getItem($k)||"[]")}catch{return[]}}function Fk(e){const t=Ph().filter(n=>n!==e);t.unshift(e),localStorage.setItem($k,JSON.stringify(t.slice(0,5)))}function $R(){return!1}function Uk({onClose:e,embedded:t=!1}){const[n,r]=k.useState([]),[a,o]=k.useState(!0),[u,h]=k.useState(null),[f,p]=k.useState(""),[m,x]=k.useState([]),[b,y]=k.useState(""),[_,j]=k.useState(!1),[N,w]=k.useState(""),[C,E]=k.useState([{key:"",value:""}]),[R,L]=k.useState(!1),O=k.useCallback(()=>{Ne.listEnvs().then(r).catch(()=>{}).finally(()=>o(!1))},[]);k.useEffect(()=>{O()},[O]);function q(G){h(G.slug),p(G.name);const B=Object.entries(G.variables).map(([$,se])=>({key:$,value:se}));B.length===0&&B.push({key:"",value:""}),x(B),y("")}function F(){h(null),y("")}async function W(){if(!u)return;const G={};for(const B of m){const $=B.key.trim();$&&(G[$]=B.value)}try{await Ne.updateEnv(u,{name:f.trim()||void 0,variables:G}),h(null),y(""),O()}catch(B){y(B instanceof Error?B.message:String(B))}}async function z(G){try{await Ne.deleteEnv(G),u===G&&h(null),O()}catch(B){y(B instanceof Error?B.message:String(B))}}async function I(){const G=N.trim();if(!G)return;L(!0);const B={};for(const $ of C){const se=$.key.trim();se&&(B[se]=$.value)}try{await Ne.createEnv(G,B),w(""),E([{key:"",value:""}]),j(!1),y(""),O()}catch($){y($ instanceof Error?$.message:String($))}finally{L(!1)}}if(t)return l.jsx("div",{className:"h-full bg-cc-bg text-cc-fg font-sans-ui antialiased overflow-y-auto overflow-x-hidden",children:l.jsxs("div",{className:"max-w-2xl mx-auto px-4 sm:px-6 py-6 sm:py-10 pb-safe",children:[l.jsx("div",{className:"flex items-start justify-between gap-3 mb-2",children:l.jsxs("div",{className:"min-w-0",children:[l.jsx("h1",{className:"text-lg font-semibold text-cc-fg",children:"Environments"}),l.jsx("p",{className:"mt-0.5 text-[13px] text-cc-muted leading-relaxed",children:"Reusable runtime profiles."})]})}),l.jsxs("div",{className:"flex items-center gap-2 mt-4 mb-5",children:[l.jsx("div",{className:"flex-1"}),l.jsxs("button",{onClick:()=>j(!_),className:`flex items-center gap-1.5 px-3.5 py-2.5 min-h-[44px] rounded-lg text-sm font-medium transition-colors cursor-pointer shrink-0 ${_?"bg-cc-active text-cc-fg":"bg-cc-primary hover:bg-cc-primary-hover text-white"}`,children:[l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:_?l.jsx("path",{d:"M18 6 6 18M6 6l12 12"}):l.jsx("path",{d:"M12 5v14M5 12h14"})}),l.jsx("span",{className:"hidden sm:inline",children:_?"Cancel":"New Environment"})]})]}),_&&l.jsxs("div",{className:"mb-6 rounded-xl bg-cc-card p-4 sm:p-5 space-y-3",style:{animation:"fadeSlideIn 150ms ease-out"},children:[l.jsx("input",{type:"text",value:N,onChange:G=>w(G.target.value),placeholder:"Environment name (e.g. production)",className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow",onKeyDown:G=>{G.key==="Enter"&&N.trim()&&I()}}),l.jsx(Hd,{rows:C,onChange:E}),b&&l.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:b}),l.jsxs("div",{className:"flex items-center justify-between pt-1",children:[l.jsxs("p",{className:"text-[11px] text-cc-muted",children:["Stored in ",l.jsx("code",{className:"text-[10px]",children:"~/.companion/envs/"})]}),l.jsx("button",{onClick:I,disabled:!N.trim()||R,className:`px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${N.trim()&&!R?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:R?"Creating...":"Create"})]})]}),l.jsx("div",{className:"flex items-center gap-2 mb-3 text-[12px] text-cc-muted",children:l.jsxs("span",{children:[n.length," environment",n.length!==1?"s":""]})}),a?l.jsx("div",{className:"py-12 text-center text-sm text-cc-muted",children:"Loading environments..."}):n.length===0?l.jsx("div",{className:"py-12 text-center text-sm text-cc-muted",children:"No environments yet."}):l.jsx("div",{className:"space-y-1",children:n.map(G=>{const B=u===G.slug,$=Object.keys(G.variables).length;return B?l.jsxs("div",{className:"rounded-xl bg-cc-card p-4 space-y-3",style:{animation:"fadeSlideIn 150ms ease-out"},children:[l.jsx("input",{type:"text",value:f,onChange:se=>p(se.target.value),placeholder:"Environment name",className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),l.jsx("div",{className:"space-y-3",children:l.jsxs("div",{children:[l.jsx("div",{className:"text-[11px] font-medium text-cc-muted mb-1.5",children:"Variables"}),l.jsx(Hd,{rows:m,onChange:x})]})}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("button",{onClick:F,className:"px-3 py-2.5 min-h-[44px] text-sm rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:"Cancel"}),l.jsx("button",{onClick:()=>void W(),className:"px-4 py-2.5 min-h-[44px] text-sm rounded-lg font-medium bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Save"})]})]},G.slug):l.jsx(FR,{env:G,varCount:$,onStartEdit:()=>q(G),onDelete:()=>void z(G.slug)},G.slug)})}),b&&!_&&l.jsx("div",{className:"mt-4 px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:b})]})});const A=l.jsxs("div",{className:"rounded-xl bg-cc-card p-4 space-y-2.5",children:[l.jsx("span",{className:"text-sm font-medium text-cc-fg",children:"New Environment"}),l.jsx("input",{type:"text",value:N,onChange:G=>w(G.target.value),placeholder:"Environment name (e.g. production)",className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow",onKeyDown:G=>{G.key==="Enter"&&N.trim()&&I()}}),l.jsx(Hd,{rows:C,onChange:E}),l.jsx("button",{onClick:I,disabled:!N.trim()||R,className:`px-4 py-2.5 min-h-[44px] text-sm font-medium rounded-lg transition-colors ${N.trim()&&!R?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:R?"Creating...":"Create"})]}),X=a?l.jsx("div",{className:"text-sm text-cc-muted text-center py-6",children:"Loading environments..."}):n.length===0?l.jsx("div",{className:"text-sm text-cc-muted text-center py-6",children:"No environments yet."}):l.jsx("div",{className:"space-y-3",children:n.map(G=>l.jsxs("div",{className:"rounded-xl bg-cc-card overflow-hidden",children:[l.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[l.jsx("span",{className:"text-sm font-medium text-cc-fg flex-1",children:G.name}),l.jsxs("span",{className:"text-xs text-cc-muted",children:[Object.keys(G.variables).length," var",Object.keys(G.variables).length!==1?"s":""]}),u===G.slug?l.jsx("button",{onClick:F,className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-fg cursor-pointer",children:"Cancel"}):l.jsxs(l.Fragment,{children:[l.jsx("button",{onClick:()=>q(G),className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-fg cursor-pointer",children:"Edit"}),l.jsx("button",{onClick:()=>z(G.slug),className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-error cursor-pointer",children:"Delete"})]})]}),u===G.slug&&l.jsxs("div",{className:"px-3 py-3 space-y-2",children:[l.jsx("input",{type:"text",value:f,onChange:B=>p(B.target.value),placeholder:"Environment name",className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),l.jsx("div",{className:"space-y-3",children:l.jsxs("div",{children:[l.jsx("div",{className:"text-[11px] font-medium text-cc-muted mb-1.5",children:"Variables"}),l.jsx(Hd,{rows:m,onChange:x})]})}),l.jsx("button",{onClick:W,className:"px-4 py-2.5 min-h-[44px] text-sm font-medium bg-cc-primary hover:bg-cc-primary-hover text-white rounded-lg transition-colors cursor-pointer",children:"Save"})]}),u!==G.slug&&Object.keys(G.variables).length>0&&l.jsx("div",{className:"px-3 py-2.5 space-y-1",children:Object.entries(G.variables).map(([B,$])=>l.jsxs("div",{className:"grid grid-cols-[auto_auto_minmax(0,1fr)] items-start gap-1.5 text-xs leading-5",children:[l.jsx("span",{className:"font-mono-code text-cc-fg break-all",children:B}),l.jsx("span",{className:"text-cc-muted",children:"="}),l.jsx("span",{className:"font-mono-code text-cc-muted break-all whitespace-pre-wrap",children:$})]},B))})]},G.slug))}),Z=l.jsxs("div",{className:"w-full max-w-lg max-h-[90dvh] sm:max-h-[80dvh] mx-0 sm:mx-4 flex flex-col bg-cc-bg rounded-t-[14px] sm:rounded-[14px] shadow-2xl overflow-hidden",onClick:G=>G.stopPropagation(),children:[l.jsxs("div",{className:"flex items-center justify-between px-4 sm:px-5 py-3 sm:py-4",children:[l.jsx("div",{className:"flex items-center gap-2",children:l.jsx("h2",{className:"text-sm font-semibold text-cc-fg",children:"Manage Environments"})}),e&&l.jsx("button",{onClick:e,"aria-label":"Close",className:"w-8 h-8 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto px-3 sm:px-5 py-3 sm:py-4 pb-safe space-y-4",children:[b&&l.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:b}),X,A]})]});return so.createPortal(l.jsx("div",{className:"fixed inset-0 z-50 flex items-end sm:items-center justify-center bg-black/50",onClick:e,children:Z}),document.body)}function FR({env:e,varCount:t,onStartEdit:n,onDelete:r}){return l.jsxs("div",{className:"group flex items-start gap-3 px-3 py-3 min-h-[44px] rounded-lg hover:bg-cc-hover/60 transition-colors",children:[l.jsx("div",{className:"shrink-0 mt-0.5 w-7 h-7 rounded-md bg-cc-primary/10 flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5 text-cc-primary",children:l.jsx("path",{d:"M12 3v18M3 12h18M4.5 6.5l15 0M4.5 17.5h15M6.5 4.5v15M17.5 4.5v15"})})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"flex items-center gap-2",children:l.jsx("span",{className:"text-sm font-medium text-cc-fg truncate",children:e.name})}),l.jsxs("p",{className:"mt-0.5 text-xs text-cc-muted",children:[t," variable",t!==1?"s":""]})]}),l.jsxs("div",{className:"shrink-0 flex items-center gap-0.5 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity",children:[l.jsx("button",{onClick:n,className:"p-2 min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0 sm:p-1.5 rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-active transition-colors cursor-pointer","aria-label":"Edit",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:[l.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),l.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5Z"})]})}),l.jsx("button",{onClick:r,className:"p-2 min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0 sm:p-1.5 rounded-md text-cc-muted hover:text-cc-error hover:bg-cc-error/10 transition-colors cursor-pointer","aria-label":"Delete",children:l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2m3 0v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6h14Z"})})})]})]})}function Hd({rows:e,onChange:t}){function n(o,u,h){const f=[...e];f[o]={...f[o],[u]:h},t(f)}function r(o){const u=e.filter((h,f)=>f!==o);u.length===0&&u.push({key:"",value:""}),t(u)}function a(){t([...e,{key:"",value:""}])}return l.jsxs("div",{className:"space-y-1.5",children:[e.map((o,u)=>l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx("input",{type:"text",value:o.key,onChange:h=>n(u,"key",h.target.value),placeholder:"KEY",className:"flex-1 min-w-0 px-3 py-2.5 min-h-[44px] text-xs font-mono-code bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),l.jsx("span",{className:"text-[10px] text-cc-muted",children:"="}),l.jsx("input",{type:"text",value:o.value,onChange:h=>n(u,"value",h.target.value),placeholder:"value",className:"flex-1 min-w-0 px-3 py-2.5 min-h-[44px] text-xs font-mono-code bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),l.jsx("button",{onClick:()=>r(u),"aria-label":"Remove variable",className:"w-10 h-10 min-h-[44px] flex items-center justify-center rounded-lg text-cc-muted hover:text-cc-error hover:bg-cc-error/10 transition-colors cursor-pointer shrink-0",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]},u)),l.jsx("button",{onClick:a,className:"text-xs py-2 min-h-[44px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"+ Add variable"})]})}const UR=Object.freeze(Object.defineProperty({__proto__:null,EnvManager:Uk},Symbol.toStringTag,{value:"Module"}));function IR(e){if(!e)return[];const t=e.split("/").filter(Boolean),n=[{label:"/",path:"/"}];let r="";for(const a of t)r+="/"+a,n.push({label:a,path:r});return n}function HR({initialPath:e,onSelect:t,onClose:n}){const[r,a]=k.useState(""),[o,u]=k.useState([]),[h,f]=k.useState(!0),[p,m]=k.useState(""),[x,b]=k.useState(""),[y,_]=k.useState(!1),[j,N]=k.useState(""),[w,C]=k.useState(-1),[E,R]=k.useState(!1),[L,O]=k.useState(()=>Ph()),q=k.useRef(null),F=k.useRef(null),W=k.useRef(null),z=k.useRef(new Map),I=k.useMemo(()=>{if(!j)return o;const $=j.toLowerCase();return o.filter(se=>se.name.toLowerCase().includes($))},[o,j]),A=k.useCallback(async $=>{f(!0),m(""),N(""),C(-1);try{const se=await Ne.listDirs($);a(se.path),u(se.dirs)}catch{m("Could not load directory"),u([])}finally{f(!1)}},[]);k.useEffect(()=>{A(e||void 0)},[]),k.useEffect(()=>{const $=q.current;if(!$)return;function se(D){if(D.key!=="Tab")return;const P=$.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(P.length===0)return;const J=P[0],M=P[P.length-1];D.shiftKey&&document.activeElement===J?(D.preventDefault(),M.focus()):!D.shiftKey&&document.activeElement===M&&(D.preventDefault(),J.focus())}document.addEventListener("keydown",se);const ae=setTimeout(()=>{var D;(D=W.current)==null||D.focus()},80);return()=>{document.removeEventListener("keydown",se),clearTimeout(ae)}},[]);const X=k.useCallback(()=>{E||(R(!0),setTimeout(n,150))},[n,E]);k.useEffect(()=>{function $(se){if(se.key==="Escape"){if(y)return;X()}}return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[y,X]),k.useEffect(()=>{function $(se){var D,P;if(y)return;if(se.key==="Backspace"&&document.activeElement!==W.current){if(r&&r!=="/"){se.preventDefault();const J=r.split("/").slice(0,-1).join("/")||"/";A(J)}return}const ae=I.length;if(ae!==0){if(se.key==="ArrowDown"){se.preventDefault();const J=w<ae-1?w+1:0;C(J),(D=z.current.get(J))==null||D.focus()}else if(se.key==="ArrowUp"){se.preventDefault();const J=w>0?w-1:ae-1;C(J),(P=z.current.get(J))==null||P.focus()}}}return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[y,I.length,w,r,A]),k.useEffect(()=>{var $;w>=0&&(($=z.current.get(w))==null||$.scrollIntoView({block:"nearest"}))},[w]);function Z($){Fk($),O(Ph()),t($),n()}const G=IR(r),B=r.split("/").pop()||"/";return so.createPortal(l.jsx("div",{className:`fixed inset-0 z-50 flex items-end sm:items-center justify-center transition-opacity duration-150 ${E?"opacity-0":"opacity-100"}`,style:{backgroundColor:"rgba(0,0,0,0.5)",backdropFilter:"blur(4px)"},onClick:X,children:l.jsxs("div",{ref:q,role:"dialog","aria-modal":"true","aria-label":"Select folder",className:`w-full max-w-lg h-[min(520px,90dvh)] mx-0 sm:mx-4 flex flex-col bg-cc-bg border border-cc-border rounded-t-[14px] sm:rounded-[14px] shadow-2xl overflow-hidden transition-transform duration-150 ${E?"translate-y-4 sm:translate-y-2 opacity-0":"translate-y-0 opacity-100"}`,style:{animation:"fadeSlideIn 200ms ease-out"},onClick:$=>$.stopPropagation(),children:[l.jsxs("div",{className:"flex items-center justify-between px-4 sm:px-5 py-3 sm:py-4 border-b border-cc-border shrink-0",children:[l.jsx("h2",{className:"text-sm font-semibold text-cc-fg font-sans-ui",children:"Select Folder"}),l.jsx("button",{type:"button","aria-label":"Close",onClick:X,className:"w-6 h-6 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),L.length>0&&l.jsxs("div",{className:"border-b border-cc-border shrink-0",role:"group","aria-label":"Recent directories",children:[l.jsx("div",{className:"px-4 pt-2.5 pb-1 text-[10px] text-cc-muted uppercase tracking-wider font-sans-ui select-none",children:"Recent"}),l.jsx("ul",{className:"list-none m-0 p-0",children:L.map($=>l.jsx("li",{children:l.jsxs("button",{type:"button",onClick:()=>Z($),className:"w-full px-4 py-2 sm:py-1.5 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 text-cc-fg group",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted opacity-50 group-hover:opacity-80 transition-opacity shrink-0",children:[l.jsx("path",{d:"M8 3.5a.5.5 0 00-1 0V8a.5.5 0 00.252.434l3.5 2a.5.5 0 00.496-.868L8 7.71V3.5z"}),l.jsx("path",{fillRule:"evenodd",d:"M8 16A8 8 0 108 0a8 8 0 000 16zm7-8A7 7 0 111 8a7 7 0 0114 0z"})]}),l.jsx("span",{className:"font-medium truncate",children:$.split("/").pop()||$}),l.jsx("span",{className:"text-cc-muted font-mono-code text-[10px] truncate ml-auto",children:$})]})},$))})]}),l.jsx("div",{className:"px-4 py-2 border-b border-cc-border flex items-center gap-1.5 shrink-0 min-h-[40px]",children:y?l.jsx("input",{type:"text","aria-label":"Type a directory path",value:x,onChange:$=>b($.target.value),onKeyDown:$=>{$.key==="Enter"&&x.trim()&&Z(x.trim()),$.key==="Escape"&&($.stopPropagation(),_(!1))},placeholder:"/path/to/project",className:"flex-1 px-2 py-1 text-base sm:text-xs bg-cc-input-bg border border-cc-border rounded-md text-cc-fg font-mono-code placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/50",autoFocus:!0}):l.jsxs(l.Fragment,{children:[l.jsx("nav",{"aria-label":"Directory breadcrumb",className:"flex-1 min-w-0 flex items-center gap-0.5 overflow-x-auto",children:G.map(($,se)=>{const ae=se===G.length-1;return l.jsxs("span",{className:"flex items-center gap-0.5 shrink-0",children:[se>0&&l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 text-cc-muted opacity-40 shrink-0",children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx("button",{type:"button",onClick:()=>{ae||A($.path)},className:`text-[11px] font-mono-code px-1 py-0.5 rounded transition-colors whitespace-nowrap ${ae?"text-cc-fg font-medium cursor-default":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover cursor-pointer"}`,"aria-current":ae?"location":void 0,tabIndex:ae?-1:0,children:$.label})]},$.path)})}),l.jsx("button",{type:"button","aria-label":"Type path manually",onClick:()=>{_(!0),b(r)},className:"w-6 h-6 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer shrink-0",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M11.013 1.427a1.75 1.75 0 012.474 0l1.086 1.086a1.75 1.75 0 010 2.474l-8.61 8.61c-.21.21-.47.364-.756.445l-3.251.93a.75.75 0 01-.927-.928l.929-3.25a1.75 1.75 0 01.445-.758l8.61-8.61zm1.414 1.06a.25.25 0 00-.354 0L3.463 11.098a.25.25 0 00-.064.108l-.563 1.97 1.971-.564a.25.25 0 00.108-.064l8.61-8.61a.25.25 0 000-.354l-1.098-1.097z"})})})]})}),!y&&l.jsxs("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:[l.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-cc-border shrink-0",children:[l.jsxs("div",{className:"flex-1 min-w-0 relative",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted absolute left-2 top-1/2 -translate-y-1/2 pointer-events-none",children:l.jsx("path",{d:"M11.5 7a4.5 4.5 0 11-9 0 4.5 4.5 0 019 0zm-.82 4.74a6 6 0 111.06-1.06l3.04 3.04a.75.75 0 11-1.06 1.06l-3.04-3.04z"})}),l.jsx("input",{ref:W,type:"text","aria-label":"Filter directories",value:j,onChange:$=>{N($.target.value),C(-1)},placeholder:"Filter...",className:"w-full pl-7 pr-2 py-1.5 text-base sm:text-xs bg-transparent text-cc-fg font-mono-code placeholder:text-cc-muted/60 focus:outline-none rounded-md border border-transparent focus:border-cc-border transition-colors"})]}),l.jsxs("button",{type:"button",onClick:()=>Z(r),"aria-label":`Select ${B}`,className:"shrink-0 flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium bg-cc-primary text-white hover:bg-cc-primary-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 shrink-0","aria-hidden":"true",children:l.jsx("path",{d:"M12.416 3.376a.75.75 0 01.208 1.04l-5 7.5a.75.75 0 01-1.154.114l-3-3a.75.75 0 011.06-1.06l2.353 2.353 4.493-6.74a.75.75 0 011.04-.207z"})}),l.jsx("span",{className:"hidden sm:inline","aria-hidden":"true",children:"Select"}),l.jsx("span",{className:"font-mono-code max-w-[100px] truncate","aria-hidden":"true",children:B})]})]}),l.jsx("div",{ref:F,className:"flex-1 min-h-0 overflow-y-auto","aria-label":"Subdirectories",children:h?l.jsx("div",{className:"px-4 py-2 space-y-1","aria-busy":"true","aria-label":"Loading directories",children:Array.from({length:6}).map(($,se)=>l.jsxs("div",{className:"flex items-center gap-2 py-1.5",children:[l.jsx("div",{className:"w-3 h-3 rounded-sm bg-cc-hover shrink-0",style:{background:"linear-gradient(90deg, var(--color-cc-hover) 25%, var(--color-cc-active) 50%, var(--color-cc-hover) 75%)",backgroundSize:"200% 100%",animation:"shimmer 1.5s ease-in-out infinite"}}),l.jsx("div",{className:"h-3 rounded-sm flex-1",style:{maxWidth:`${50+se*17%40}%`,background:"linear-gradient(90deg, var(--color-cc-hover) 25%, var(--color-cc-active) 50%, var(--color-cc-hover) 75%)",backgroundSize:"200% 100%",animation:`shimmer 1.5s ease-in-out ${se*.1}s infinite`}})]},se))}):p?l.jsxs("div",{className:"px-4 py-8 flex flex-col items-center gap-2 text-center",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-5 h-5 text-cc-error/70",children:l.jsx("path",{d:"M8.982 1.566a1.13 1.13 0 00-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 01-1.1 0L7.1 5.995A.905.905 0 018 5zm.002 6a1 1 0 110 2 1 1 0 010-2z"})}),l.jsx("p",{className:"text-xs text-cc-muted",children:p}),l.jsx("button",{type:"button",onClick:()=>A(r||void 0),className:"mt-1 text-xs text-cc-primary hover:text-cc-primary-hover transition-colors cursor-pointer font-medium",children:"Retry"})]}):I.length===0?l.jsxs("div",{className:"px-4 py-8 text-center",children:[l.jsx("p",{className:"text-xs text-cc-muted",children:j?"No matching directories":"No subdirectories"}),j&&l.jsx("button",{type:"button",onClick:()=>N(""),className:"mt-1 text-xs text-cc-primary hover:text-cc-primary-hover transition-colors cursor-pointer font-medium",children:"Clear filter"})]}):l.jsx("ul",{className:"list-none m-0 p-0",children:I.map(($,se)=>l.jsxs("li",{className:`flex items-center transition-colors ${w===se?"bg-cc-hover":"hover:bg-cc-hover"}`,children:[l.jsxs("button",{type:"button",ref:ae=>{ae?z.current.set(se,ae):z.current.delete(se)},onClick:()=>A($.path),onKeyDown:ae=>{ae.key==="Enter"&&(ae.preventDefault(),Z($.path))},className:"flex-1 min-w-0 px-4 py-2 sm:py-1.5 text-xs text-left cursor-pointer font-mono-code flex items-center gap-2 text-cc-fg focus:outline-none",title:$.path,"aria-label":`Navigate into ${$.name}`,children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-40 shrink-0",children:l.jsx("path",{d:"M1 3.5A1.5 1.5 0 012.5 2h3.379a1.5 1.5 0 011.06.44l.622.621a.5.5 0 00.353.146H13.5A1.5 1.5 0 0115 4.707V12.5a1.5 1.5 0 01-1.5 1.5h-11A1.5 1.5 0 011 12.5v-9z"})}),l.jsx("span",{className:"truncate",children:$.name}),l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-25 shrink-0 ml-auto",children:l.jsx("path",{d:"M6 4l4 4-4 4"})})]}),l.jsx("button",{type:"button",onClick:()=>Z($.path),className:"shrink-0 w-8 h-8 sm:w-6 sm:h-6 mr-2 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-primary hover:bg-cc-primary/10 transition-colors cursor-pointer","aria-label":`Select ${$.name}`,children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M12.416 3.376a.75.75 0 01.208 1.04l-5 7.5a.75.75 0 01-1.154.114l-3-3a.75.75 0 011.06-1.06l2.353 2.353 4.493-6.74a.75.75 0 011.04-.207z"})})})]},$.path))})}),l.jsxs("div",{className:"px-4 py-1.5 border-t border-cc-border shrink-0 flex items-center gap-3 text-[10px] text-cc-muted select-none",children:[l.jsxs("span",{children:[l.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"↑↓"})," navigate"]}),l.jsxs("span",{children:[l.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"↵"})," select"]}),l.jsxs("span",{children:[l.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"⇐"})," parent"]}),l.jsxs("span",{className:"ml-auto",children:[l.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"esc"})," close"]})]})]})]})}),document.body)}function qR(e,t){const n=t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,60);return`${e.toLowerCase()}-${n}`}function VR(e){return e.branchName&&e.branchName.trim()?e.branchName.trim():qR(e.identifier,e.title)}function Bc({className:e}){return l.jsxs("svg",{viewBox:"0 0 100 104",fill:"none","aria-hidden":"true",className:e,children:[l.jsx("path",{d:"M1.22541 61.5228c-.51174-.7989-.43432-1.7526.24387-2.4308L56.4111 3.93536c.6786-.67858 1.6333-.7555 2.4308-.24384l8.676 5.55638c.9876.63266 1.0994 2.01905.2024 2.91604L11.7007 68.1832c-.897.897-2.28339.7852-2.91605-.2024L1.22541 61.5228z",fill:"currentColor"}),l.jsx("path",{d:"M10.3282 73.646c-.69215-.6922-.62695-1.8301.14574-2.4633l10.0851-8.2649c.7722-.6328 1.9083-.5766 2.5354.1253l16.8427 18.8696c.6281.7032.5667 1.8504-.1371 2.5606l-8.2649 8.3441c-.7047.7111-1.8598.7621-2.5605.1133L10.3282 73.646z",fill:"currentColor"}),l.jsx("path",{d:"M44.9498 90.6953c-.4357-.7281-.2507-1.6655.4242-2.1538l7.1957-5.2044c.6744-.4878 1.6108-.3706 2.1413.2682l8.8797 10.6885c.5297.6379.4213 1.5907-.2409 2.1184l-5.1045 4.0706c-.6633.5286-1.627.4453-2.1858-.189L44.9498 90.6953z",fill:"currentColor"}),l.jsx("path",{d:"M67.3964 96.0665c-.2955-.5872-.0617-1.2949.5209-1.5775l4.2152-2.0447c.5843-.2834 1.2962-.0519 1.5873.5167l3.6174 7.0694c.2914.5693.0659 1.2693-.5028 1.5613l-4.2152 2.1643c-.5704.2929-1.2797.0581-1.5788-.5224L67.3964 96.0665z",fill:"currentColor"})]})}function GR({defaultProjectId:e,connectionId:t,onCreated:n,onClose:r}){const[a,o]=k.useState(""),[u,h]=k.useState(""),[f,p]=k.useState(""),[m,x]=k.useState(0),[b,y]=k.useState(!0),[_,j]=k.useState([]),[N,w]=k.useState(""),[C,E]=k.useState(""),[R,L]=k.useState(!0),[O,q]=k.useState(!1),[F,W]=k.useState("");k.useEffect(()=>{let I=!0;return Promise.all([Ne.getLinearStates(t),Ne.getLinearConnection(t)]).then(([A,X])=>{var G;if(!I)return;j(A.teams),w(X.viewerId);const Z=((G=A.teams[0])==null?void 0:G.id)||"";p(Z)}).catch(A=>{I&&W(A instanceof Error?A.message:"Failed to load teams")}).finally(()=>{I&&L(!1)}),()=>{I=!1}},[t]),k.useEffect(()=>{if(!f||_.length===0){E("");return}const I=_.find(X=>X.id===f),A=I==null?void 0:I.states.find(X=>X.type==="backlog");E((A==null?void 0:A.id)||"")},[f,_]);async function z(){if(!(!a.trim()||!f)){q(!0),W("");try{const I=await Ne.createLinearIssue({title:a.trim(),description:u.trim()||void 0,teamId:f,priority:m,projectId:e||void 0,assigneeId:b&&N?N:void 0,stateId:C||void 0,connectionId:t});n(I.issue)}catch(I){W(I instanceof Error?I.message:"Failed to create issue")}finally{q(!1)}}}return so.createPortal(l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:r,children:l.jsxs("div",{className:"mx-4 w-full max-w-md bg-cc-card border border-cc-border rounded-xl shadow-2xl p-5",onClick:I=>I.stopPropagation(),children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsx("h3",{className:"text-sm font-semibold text-cc-fg",children:"Create Linear Issue"}),l.jsx("button",{type:"button",onClick:r,className:"inline-flex h-6 w-6 items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]}),F&&l.jsx("div",{className:"mb-3 px-2.5 py-2 text-xs text-cc-error bg-cc-error/10 border border-cc-error/20 rounded-lg",children:F}),R?l.jsx("div",{className:"py-8 text-xs text-cc-muted text-center",children:"Loading teams..."}):l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{children:[l.jsx("label",{htmlFor:"create-issue-title",className:"text-xs text-cc-muted block mb-1",children:"Title *"}),l.jsx("input",{id:"create-issue-title",type:"text",value:a,onChange:I=>o(I.target.value),onKeyDown:I=>{I.key==="Enter"&&a.trim()&&f&&!O&&z()},placeholder:"Issue title",autoFocus:!0,className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60"})]}),l.jsxs("div",{children:[l.jsx("label",{htmlFor:"create-issue-desc",className:"text-xs text-cc-muted block mb-1",children:"Description"}),l.jsx("textarea",{id:"create-issue-desc",value:u,onChange:I=>h(I.target.value),placeholder:"Add details... (Markdown supported)",rows:3,className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60 resize-none"})]}),l.jsxs("div",{children:[l.jsx("label",{htmlFor:"create-issue-team",className:"text-xs text-cc-muted block mb-1",children:"Team *"}),l.jsx("select",{id:"create-issue-team",value:f,onChange:I=>p(I.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(I=>l.jsxs("option",{value:I.id,children:[I.name," (",I.key,")"]},I.id))})]}),l.jsxs("div",{children:[l.jsx("label",{htmlFor:"create-issue-priority",className:"text-xs text-cc-muted block mb-1",children:"Priority"}),l.jsxs("select",{id:"create-issue-priority",value:m,onChange:I=>x(Number(I.target.value)),className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg cursor-pointer",children:[l.jsx("option",{value:0,children:"No priority"}),l.jsx("option",{value:1,children:"Urgent"}),l.jsx("option",{value:2,children:"High"}),l.jsx("option",{value:3,children:"Medium"}),l.jsx("option",{value:4,children:"Low"})]})]}),l.jsxs("label",{htmlFor:"create-issue-assign",className:"flex items-center gap-2 cursor-pointer",children:[l.jsx("input",{id:"create-issue-assign",type:"checkbox",checked:b,onChange:I=>y(I.target.checked),className:"rounded border-cc-border text-cc-primary focus:ring-cc-primary/30 cursor-pointer"}),l.jsx("span",{className:"text-xs text-cc-muted",children:"Assign to me"})]}),l.jsxs("div",{className:"flex gap-2.5 pt-2",children:[l.jsx("button",{type:"button",onClick:r,className:"flex-1 px-3 py-2 text-xs font-medium rounded-lg bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),l.jsx("button",{type:"button",onClick:z,disabled:!a.trim()||!f||O,className:"flex-1 px-3 py-2 text-xs font-medium rounded-lg bg-cc-primary text-white hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors cursor-pointer",children:O?"Creating...":"Create Issue"})]})]})]})}),document.body)}function YR({cwd:e,gitRepoInfo:t,linearConfigured:n,selectedLinearIssue:r,onIssueSelect:a,onBranchFromIssue:o,onConnectionSelect:u}){const[h,f]=k.useState([]),[p,m]=k.useState(null),[x,b]=k.useState(!1),[y,_]=k.useState(""),[j,N]=k.useState([]),[w,C]=k.useState(!1),[E,R]=k.useState(!1),[L,O]=k.useState(""),[q,F]=k.useState(!1),[W,z]=k.useState(null),[I,A]=k.useState([]),[X,Z]=k.useState(!1),[G,B]=k.useState(""),[$,se]=k.useState(!1),[ae,D]=k.useState([]),[P,J]=k.useState(!1),[M,ge]=k.useState(""),[we,Ce]=k.useState(!1),[ze,Ee]=k.useState([]),[Pe,et]=k.useState(!1),[Et,mt]=k.useState(!1),yt=k.useRef(null);k.useEffect(()=>{function je(Oe){yt.current&&!yt.current.contains(Oe.target)&&(C(!1),se(!1))}return document.addEventListener("pointerdown",je),()=>document.removeEventListener("pointerdown",je)},[]),k.useEffect(()=>{if(!n){f([]),m(null),b(!1),u(null);return}let je=!0;return Ne.listLinearConnections().then(({connections:Oe})=>{je&&(f(Oe),b(!0),Oe.length>0?(m(Oe[0].id),u(Oe[0].id)):(m(null),u(null)))}).catch(()=>{je&&b(!0)}),()=>{je=!1}},[n]);const _t=k.useCallback(je=>{m(je),u(je),a(null),N([]),_(""),O(""),Ee([]),ge(""),D([]),W&&(Z(!0),B(""),Ne.getLinearProjectIssues(W.projectId,10,je).then(({issues:Oe})=>{A(Oe)}).catch(Oe=>{B(Oe instanceof Error?Oe.message:String(Oe))}).finally(()=>{Z(!1)}))},[W,u,a]);k.useEffect(()=>{if(!t||!n){z(null),A([]);return}let je=!0;return Z(!0),B(""),(async()=>{try{const{mapping:Oe}=await Ne.getLinearProjectMapping(t.repoRoot);if(!je)return;if(z(Oe),Oe){const{issues:xt}=await Ne.getLinearProjectIssues(Oe.projectId,10,p??void 0);if(!je)return;A(xt)}else A([])}catch(Oe){if(!je)return;B(Oe instanceof Error?Oe.message:String(Oe))}finally{je&&Z(!1)}})(),()=>{je=!1}},[t,n,p]),k.useEffect(()=>{if(!n)return;const je=y.trim();if(je.length<2){N([]),O(""),R(!1);return}let Oe=!0;R(!0),O("");const xt=setTimeout(()=>{Ne.searchLinearIssues(je,8,p??void 0).then(Ae=>{Oe&&N(Ae.issues)}).catch(Ae=>{Oe&&(N([]),O(Ae instanceof Error?Ae.message:String(Ae)))}).finally(()=>{Oe&&R(!1)})},400);return()=>{Oe=!1,clearTimeout(xt)}},[n,y,p]),k.useEffect(()=>{if(!n||!we){Ee([]),et(!1);return}const je=M.trim();if(je.length<2){Ee([]),et(!1);return}let Oe=!0;et(!0);const xt=setTimeout(()=>{Ne.searchLinearIssues(je,10,p??void 0).then(Ae=>{Oe&&Ee(Ae.issues)}).catch(()=>{Oe&&Ee([])}).finally(()=>{Oe&&et(!1)})},400);return()=>{Oe=!1,clearTimeout(xt)}},[n,we,M,p]);function Lt(je,Oe=!1){a(je),_(`${je.identifier} - ${je.title}`);const xt=VR(je);o(xt,!0),Oe&&C(!1)}function Gt(){a(null),_(""),N([]),O("")}async function _e(je){if(t)try{const{mapping:Oe}=await Ne.upsertLinearProjectMapping({repoRoot:t.repoRoot,projectId:je.id,projectName:je.name});z(Oe),se(!1),Z(!0),B("");const{issues:xt}=await Ne.getLinearProjectIssues(je.id,10,p??void 0);A(xt)}catch(Oe){B(Oe instanceof Error?Oe.message:String(Oe))}finally{Z(!1)}}async function Ve(){if(t){try{await Ne.removeLinearProjectMapping(t.repoRoot)}catch{}z(null),A([]),a(null),_("")}}function dt(){if(!n){window.location.hash="#/integrations/linear";return}se(!0),ae.length===0&&(J(!0),Ne.listLinearProjects(p??void 0).then(({projects:je})=>D(je)).catch(()=>{}).finally(()=>J(!1)))}function _n(je){mt(!1),Lt(je),W&&(Z(!0),Ne.getLinearProjectIssues(W.projectId,10,p??void 0).then(({issues:Oe})=>A(Oe)).catch(()=>{}).finally(()=>Z(!1)))}return n?l.jsxs("aside",{className:"space-y-2 mt-0.5",ref:yt,children:[l.jsxs("div",{className:"relative rounded-[12px] border border-cc-border bg-cc-card/90 px-2.5 py-2",title:`Repo: ${e}`,children:[l.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[l.jsx("span",{className:"text-[11px] uppercase tracking-wide text-cc-muted",children:"Context"}),x&&h.length>1&&l.jsx("select",{value:p??"",onChange:je=>_t(je.target.value),className:"px-1.5 py-1 rounded-md text-[11px] bg-cc-input-bg border border-cc-border text-cc-fg focus:outline-none focus:border-cc-primary/60 cursor-pointer max-w-[140px] truncate",title:"Select Linear workspace",children:h.map(je=>l.jsx("option",{value:je.id,children:je.workspaceName||je.name},je.id))}),W?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs border border-cc-primary/35 bg-cc-primary/10 text-cc-primary",children:[l.jsx(Bc,{className:"w-3.5 h-3.5"}),l.jsx("span",{children:W.projectName}),l.jsx("button",{type:"button",onClick:Ve,className:"ml-0.5 hover:text-cc-error transition-colors cursor-pointer",title:"Detach Linear project",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]}),l.jsxs("button",{type:"button",onClick:()=>mt(!0),className:"inline-flex items-center gap-1 px-2 py-1.5 rounded-lg text-[11px] border border-dashed border-cc-border text-cc-muted hover:text-cc-fg hover:border-cc-primary/40 transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),l.jsx("span",{children:"Create issue"})]})]}):l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button","aria-expanded":w,onClick:()=>{if(!n){window.location.hash="#/integrations/linear";return}C(!w)},className:`inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs border transition-colors cursor-pointer ${r?"border-cc-primary/35 bg-cc-primary/10 text-cc-primary":n?"border-cc-border bg-cc-hover/70 text-cc-fg hover:bg-cc-hover":"border-amber-500/25 bg-amber-500/10 text-amber-600 dark:text-amber-300"}`,children:[l.jsx(Bc,{className:"w-3.5 h-3.5"}),l.jsx("span",{children:"Linear"})]}),n&&t&&l.jsxs("button",{type:"button",onClick:dt,className:"inline-flex items-center gap-1 px-2 py-1.5 rounded-lg text-[11px] border border-dashed border-cc-border text-cc-muted hover:text-cc-fg hover:border-cc-primary/40 transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),l.jsx("span",{children:"Attach project"})]}),n&&l.jsxs("button",{type:"button",onClick:()=>mt(!0),className:"inline-flex items-center gap-1 px-2 py-1.5 rounded-lg text-[11px] border border-dashed border-cc-border text-cc-muted hover:text-cc-fg hover:border-cc-primary/40 transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),l.jsx("span",{children:"Create issue"})]}),!n&&l.jsx("span",{className:"text-[11px] text-amber-600 dark:text-amber-300",children:"Configure Linear to attach an issue."})]})]}),W&&(()=>{const je=M.trim().toLowerCase(),Oe=!we&&je?I.filter(Ae=>Ae.identifier.toLowerCase().includes(je)||Ae.title.toLowerCase().includes(je)):we?[]:I,xt=we?ze:Oe;return l.jsxs("div",{className:"mt-2",children:[r&&l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsxs("div",{className:"flex-1 min-w-0 text-xs text-cc-primary truncate",children:[l.jsx("span",{className:"font-mono-code",children:r.identifier})," - ",r.title]}),l.jsx("button",{type:"button",onClick:Gt,className:"text-cc-muted hover:text-cc-fg transition-colors cursor-pointer shrink-0",title:"Remove issue",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]}),l.jsx("input",{type:"text",value:M,onChange:Ae=>ge(Ae.target.value),placeholder:we?"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"}),X?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Loading recent issues..."}):G?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-error",children:G}):Pe?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Searching..."}):we&&je.length<2?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Type at least 2 characters to search all projects..."}):xt.length===0?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:je?"No matching issues":"No active issues found"}):l.jsx("div",{className:"max-h-56 overflow-y-auto -mx-0.5 mt-1",children:xt.map(Ae=>l.jsxs("button",{type:"button",onClick:()=>Lt(Ae),className:`w-full px-2 py-1.5 text-left rounded-md transition-colors cursor-pointer ${(r==null?void 0:r.id)===Ae.id?"bg-cc-primary/10 border border-cc-primary/30":"hover:bg-cc-hover"}`,children:[l.jsxs("div",{className:"text-xs text-cc-fg truncate",children:[l.jsx("span",{className:"font-mono-code",children:Ae.identifier})," ",Ae.title]}),l.jsx("div",{className:"text-[10px] text-cc-muted truncate",children:[Ae.stateName,Ae.priorityLabel].filter(Boolean).join(" - ")})]},Ae.id))}),l.jsxs("label",{className:"mt-1.5 flex items-center gap-1.5 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:we,onChange:Ae=>{Ce(Ae.target.checked),Ae.target.checked||Ee([])},className:"rounded border-cc-border text-cc-primary focus:ring-cc-primary/30 cursor-pointer"}),l.jsx("span",{className:"text-[11px] text-cc-muted",children:"Search all projects"})]})]})})(),$&&l.jsxs("div",{className:"absolute left-2.5 right-2.5 top-[44px] bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-20 overflow-hidden",children:[l.jsx("div",{className:"p-2 border-b border-cc-border",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-xs text-cc-fg font-medium",children:"Attach a Linear project to this repo"}),l.jsx("button",{type:"button",onClick:()=>se(!1),className:"px-2 py-1 rounded-md text-xs bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Close"})]})}),P?l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Loading projects..."}):ae.length===0?l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"No projects found"}):l.jsx("div",{className:"max-h-48 overflow-y-auto",children:ae.map(je=>l.jsx("button",{type:"button",onClick:()=>_e(je),className:"w-full px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("div",{className:"text-xs text-cc-fg",children:je.name})},je.id))})]}),w&&n&&l.jsxs("div",{className:"absolute left-2.5 right-2.5 top-[44px] bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-20 overflow-hidden",children:[l.jsxs("div",{className:"p-2 border-b border-cc-border",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("input",{type:"text",value:y,onChange:je=>{_(je.target.value)},onFocus:()=>C(!0),autoFocus:!0,placeholder:"ENG-123 or issue title",className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60"}),l.jsx("button",{type:"button",onClick:()=>{C(!1)},className:"px-2 py-2 rounded-md text-xs bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Close"})]}),l.jsxs("div",{className:"mt-1.5 flex items-center justify-between text-[11px] text-cc-muted",children:[l.jsx("span",{children:"Attach an issue to this draft"}),l.jsx("button",{type:"button",onClick:()=>{window.location.hash="#/integrations/linear"},className:"hover:text-cc-fg underline underline-offset-2 cursor-pointer",children:"Settings"})]})]}),y.trim().length<2&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Type at least 2 characters…"}),y.trim().length>=2&&E&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Searching Linear..."}),y.trim().length>=2&&!E&&L&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-error",children:L}),y.trim().length>=2&&!E&&!L&&j.length===0&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"No matching issues"}),y.trim().length>=2&&!E&&!L&&l.jsx("div",{className:"max-h-56 overflow-y-auto",children:j.map(je=>l.jsxs("button",{type:"button",onClick:()=>Lt(je,!0),className:"w-full px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsxs("div",{className:"text-xs text-cc-fg truncate",children:[l.jsx("span",{className:"font-mono-code",children:je.identifier})," - ",je.title]}),l.jsx("div",{className:"text-[10px] text-cc-muted truncate",children:[je.stateName,je.teamName].filter(Boolean).join(" • ")})]},je.id))})]}),l.jsx("button",{type:"button",onClick:()=>{window.location.hash="#/integrations/linear"},className:"absolute top-2 right-2 inline-flex h-7 w-7 items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:"Linear settings",children:l.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{fillRule:"evenodd",d:"M11.49 3.17c-.38-1.56-2.6-1.56-2.98 0a1.53 1.53 0 01-2.29.95c-1.35-.8-2.92.77-2.12 2.12.54.9.07 2.04-.95 2.29-1.56.38-1.56 2.6 0 2.98 1.02.25 1.49 1.39.95 2.29-.8 1.35.77 2.92 2.12 2.12.9-.54 2.04-.07 2.29.95.38 1.56 2.6 1.56 2.98 0 .25-1.02 1.39-1.49 2.29-.95 1.35.8 2.92-.77 2.12-2.12-.54-.9-.07-2.04.95-2.29 1.56-.38 1.56-2.6 0-2.98-1.02-.25-1.49-1.39-.95-2.29.8-1.35-.77-2.92-2.12-2.12-.9.54-2.04.07-2.29-.95zM10 13a3 3 0 100-6 3 3 0 000 6z",clipRule:"evenodd"})})})]}),q&&l.jsxs("div",{className:"p-3 rounded-[10px] bg-amber-500/10 border border-amber-500/20",children:[l.jsx("p",{className:"text-xs text-amber-700 dark:text-amber-300 leading-snug",children:"Warning: Linear is not configured. Continue anyway?"}),l.jsx("div",{className:"flex gap-2 mt-2.5",children:l.jsx("button",{type:"button",onClick:()=>{F(!1),window.location.hash="#/integrations/linear"},className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-hover text-cc-fg hover:bg-cc-active transition-colors cursor-pointer",children:"Configurer Linear"})})]}),Et&&l.jsx(GR,{defaultProjectId:W==null?void 0:W.projectId,connectionId:p??void 0,onCreated:_n,onClose:()=>mt(!1)})]}):null}function WR({cwd:e,gitRepoInfo:t,selectedBranch:n,isNewBranch:r,useWorktree:a,onBranchChange:o,onWorktreeChange:u,onBranchesLoaded:h}){const[f,p]=k.useState([]),[m,x]=k.useState(!1),[b,y]=k.useState(""),_=k.useRef(null);return k.useEffect(()=>{function j(N){_.current&&!_.current.contains(N.target)&&x(!1)}return document.addEventListener("pointerdown",j),()=>document.removeEventListener("pointerdown",j)},[]),k.useEffect(()=>{t?Ne.listBranches(t.repoRoot).then(j=>{p(j),h(j)}).catch(()=>{p([]),h([])}):(p([]),h([]))},[t]),t?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"relative",ref:_,children:[l.jsxs("button",{"aria-expanded":m,onClick:()=>{!m&&t&&Ne.gitFetch(t.repoRoot).catch(()=>{}).finally(()=>{Ne.listBranches(t.repoRoot).then(j=>{p(j),h(j)}).catch(()=>{p([]),h([])})}),x(!m),y("")},className:"flex items-center gap-1.5 px-2 py-1 text-xs rounded-md transition-colors cursor-pointer text-cc-muted hover:text-cc-fg hover:bg-cc-hover",title:`Repository: ${e}`,"data-is-new-branch":r?"true":"false",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-60",children:l.jsx("path",{d:"M5 3.25a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm0 2.122a2.25 2.25 0 10-1.5 0v.378A2.5 2.5 0 007.5 8h1a1 1 0 010 2h-1A2.5 2.5 0 005 12.5v.128a2.25 2.25 0 101.5 0V12.5a1 1 0 011-1h1a2.5 2.5 0 000-5h-1a1 1 0 01-1-1V5.372zM4.25 12a.75.75 0 100 1.5.75.75 0 000-1.5z"})}),l.jsx("span",{className:"max-w-[100px] sm:max-w-[160px] truncate font-mono-code",children:n||t.currentBranch}),l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]}),m&&l.jsxs("div",{className:"absolute left-0 bottom-full mb-1 w-72 max-w-[calc(100%-2rem)] bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 overflow-hidden",children:[l.jsx("div",{className:"px-2 py-2 border-b border-cc-border",children:l.jsx("input",{type:"text",value:b,onChange:j=>y(j.target.value),placeholder:"Filter or create branch...",className:"w-full px-2 py-1 text-base sm:text-xs bg-cc-input-bg border border-cc-border rounded-md text-cc-fg font-mono-code placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/50",autoFocus:!0,onKeyDown:j=>{j.key==="Escape"&&x(!1)}})}),l.jsx("div",{className:"max-h-[240px] overflow-y-auto py-1",children:(()=>{const j=b.toLowerCase().trim(),N=f.filter(R=>!R.isRemote&&(!j||R.name.toLowerCase().includes(j))),w=f.filter(R=>R.isRemote&&(!j||R.name.toLowerCase().includes(j))),C=f.some(R=>R.name.toLowerCase()===j),E=N.length>0||w.length>0;return l.jsxs(l.Fragment,{children:[N.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"px-3 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:"Local"}),N.map(R=>l.jsxs("button",{onClick:()=>{o(R.name,!1),x(!1)},className:`w-full px-3 py-1.5 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 ${R.name===n?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{className:"truncate font-mono-code",children:R.name}),l.jsxs("span",{className:"ml-auto flex items-center gap-1.5 shrink-0",children:[R.ahead>0&&l.jsxs("span",{className:"text-[9px] text-green-500",children:[R.ahead,"↑"]}),R.behind>0&&l.jsxs("span",{className:"text-[9px] text-amber-500",children:[R.behind,"↓"]}),R.worktreePath&&l.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-blue-500/15 text-blue-600 dark:text-blue-400",children:"wt"}),R.isCurrent&&l.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-green-500/15 text-green-600 dark:text-green-400",children:"current"})]})]},R.name))]}),w.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"px-3 py-1 text-[10px] text-cc-muted uppercase tracking-wider mt-1",children:"Remote"}),w.map(R=>l.jsxs("button",{onClick:()=>{o(R.name,!1),x(!1)},className:`w-full px-3 py-1.5 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 ${R.name===n?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{className:"truncate font-mono-code",children:R.name}),l.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-cc-hover text-cc-muted ml-auto shrink-0",children:"remote"})]},`remote-${R.name}`))]}),!E&&j&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted text-center",children:"No matching branches"}),j&&!C&&l.jsx("div",{className:"border-t border-cc-border mt-1 pt-1",children:l.jsxs("button",{onClick:()=>{o(b.trim(),!0),x(!1)},className:"w-full px-3 py-1.5 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 text-cc-primary",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 shrink-0",children:l.jsx("path",{d:"M8 2a.75.75 0 01.75.75v4.5h4.5a.75.75 0 010 1.5h-4.5v4.5a.75.75 0 01-1.5 0v-4.5h-4.5a.75.75 0 010-1.5h4.5v-4.5A.75.75 0 018 2z"})}),l.jsxs("span",{children:["Create ",l.jsx("span",{className:"font-mono-code font-medium",children:b.trim()})]})]})})]})})()})]})]}),l.jsxs("button",{onClick:()=>u(!a),className:`flex items-center gap-1.5 px-2 py-1 text-xs rounded-md transition-colors cursor-pointer ${a?"bg-cc-primary/15 text-cc-primary font-medium":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:"Create an isolated worktree for this session",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 opacity-70",children:l.jsx("path",{d:"M5 3.25a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm0 2.122a2.25 2.25 0 10-1.5 0v5.256a2.25 2.25 0 101.5 0V5.372zM4.25 12a.75.75 0 100 1.5.75.75 0 000-1.5zm7.5-9.5a.75.75 0 100 1.5.75.75 0 000-1.5zm-2.25.75a2.25 2.25 0 113 2.122V7A2.5 2.5 0 0010 9.5H6a1 1 0 000 2h4a2.5 2.5 0 012.5 2.5v.628a2.25 2.25 0 11-1.5 0V14a1 1 0 00-1-1H6a2.5 2.5 0 01-2.5-2.5V10a2.5 2.5 0 012.5-2.5h4a1 1 0 001-1V5.372a2.25 2.25 0 01-1.5-2.122z"})}),l.jsx("span",{children:"Worktree"})]})]}):null}const QR=336*60*60*1e3,Na=12,XR=24;function yx(e){return e.split("/").filter(Boolean).pop()||e}function K5(e){var t,n;return((t=e.name)==null?void 0:t.trim())||((n=e.slug)==null?void 0:n.trim())||yx(e.cwd)}function KR(e){return e.length>8?e.slice(0,8):e}function ZR(e,t=2){const n=e.split("/").filter(Boolean);return n.length<=t?e:`.../${n.slice(-t).join("/")}`}function JR(e){if(!Number.isFinite(e)||e<=0)return"Unknown";const t=Date.now()-e;if(t<6e4)return"Just now";const n=Math.floor(t/6e4);if(n<60)return`${n}m ago`;const r=Math.floor(n/60);if(r<24)return`${r}h ago`;const a=Math.floor(r/24);if(a<14)return`${a}d ago`;const o=Math.floor(a/7);if(o<8)return`${o}w ago`;const u=Math.floor(a/30);return`${Math.max(1,u)}mo ago`}function ez(){var fi;const[e,t]=k.useState(""),[n]=k.useState(()=>!(localStorage.getItem("cc-user-name")||"").trim()),[r,a]=k.useState(()=>localStorage.getItem("cc-user-name")||""),[o,u]=k.useState(()=>localStorage.getItem("cc-session-prefix")||""),[h,f]=k.useState(""),[p,m]=k.useState(()=>localStorage.getItem("cc-backend")||"claude"),[x,b]=k.useState([]),[y,_]=k.useState(()=>q5(localStorage.getItem("cc-backend")||"claude")),[j,N]=k.useState(()=>V5(localStorage.getItem("cc-backend")||"claude")),[w,C]=k.useState(()=>localStorage.getItem("cc-effort")||""),[E,R]=k.useState(()=>Ph()[0]||""),[L,O]=k.useState([]),[q,F]=k.useState(null),[W,z]=k.useState(!1),[I,A]=k.useState(""),[X,Z]=k.useState(null),[G,B]=k.useState(!1),[$,se]=k.useState(null),[ae,D]=k.useState(null),[P,J]=k.useState(()=>localStorage.getItem("cc-onboarding-dismissed")!=="true"),M=X||Lk(p),ge=H5(p),we=sR(p),[Ce,ze]=k.useState([]),[Ee,Pe]=k.useState(()=>localStorage.getItem("cc-selected-env")||""),[et,Et]=k.useState(!1),[mt,yt]=k.useState(!1),_t=$R(),[Lt,Gt]=k.useState(()=>_t),[_e,Ve]=k.useState([]),[dt,_n]=k.useState(()=>localStorage.getItem("cc-selected-sandbox")||""),[je,Oe]=k.useState(!1),xt=k.useRef(null),[Ae,Qr]=k.useState(null),oe=k.useRef(null),Se=k.useRef(null),[Q,xe]=k.useState(!1),[Le,Qe]=k.useState(!1),[rt,st]=k.useState(!1),[Ct,wn]=k.useState(!1),[tt,hr]=k.useState(!1),[Bn,os]=k.useState(""),[Xr,Kr]=k.useState(!0),[re,ve]=k.useState([]),[ye,Xe]=k.useState(!1),[Ht,fn]=k.useState(""),[Pn,qt]=k.useState(!1),[Gn,Er]=k.useState(Na),[Pa,lo]=k.useState(""),[Yn,Xi]=k.useState(null),[oo,co]=k.useState(!1),[Ar,en]=k.useState(""),[Tn,fr]=k.useState(!1),[uo,Xh]=k.useState([]),[Ki,Zi]=k.useState(null),[cs,ai]=k.useState(!1),[Es,Jn]=k.useState(""),[Ji,us]=k.useState(0),nn=k.useRef(null),er=k.useRef(null),$a=k.useRef(null),Zr=k.useRef(null),ds=k.useRef(null),ho=k.useRef(null),fo=Y(H=>H.currentSessionId),rn=zk({text:e,caretPos:Ji,cwd:E||void 0});k.useEffect(()=>{if(nn.current===null||!er.current)return;const H=nn.current;er.current.setSelectionRange(H,H),nn.current=null},[e]),k.useEffect(()=>{var me;window.matchMedia("(min-width: 640px)").matches&&((me=er.current)==null||me.focus())},[]),k.useEffect(()=>{Ne.getHome().then(({home:H,cwd:me})=>{E||R(me||H)}).catch(()=>{}),Ne.listEnvs().then(ze).catch(()=>{}),Ne.listSandboxes().then(Ve).catch(()=>{}),Ne.getBackends().then(b).catch(()=>{}),Ne.getSettings().then(H=>{B(H.linearApiKeyConfigured)}).catch(()=>{})},[]);function Kh(H){m(H),localStorage.setItem("cc-backend",H),Z(null),_(q5(H)),N(V5(H)),H!=="claude"&&(hr(!1),ve([]),fn(""),Xe(!1),qt(!1),Er(Na),lo(""))}k.useEffect(()=>{if(p!=="codex"){Z(null);return}Ne.getBackendModels(p).then(H=>{if(H.length>0){const me=nR(H);Z(me),me.some(Ke=>Ke.value===y)||_(me[0].value)}}).catch(()=>{})},[p]),k.useEffect(()=>{if(oe.current&&(clearInterval(oe.current),oe.current=null),Qr(null),!Lt)return;const H="the-companion:latest",me=()=>{Ne.getImageStatus(H).then(Ke=>{Qr(Ke),Ke.status==="idle"&&Ne.pullImage(H).catch(()=>{}),(Ke.status==="ready"||Ke.status==="error")&&oe.current&&(clearInterval(oe.current),oe.current=null)}).catch(()=>{})};return me(),oe.current=setInterval(me,2e3),()=>{oe.current&&(clearInterval(oe.current),oe.current=null)}},[Lt]),k.useEffect(()=>{function H(me){$a.current&&!$a.current.contains(me.target)&&xe(!1),Zr.current&&!Zr.current.contains(me.target)&&Qe(!1),ds.current&&!ds.current.contains(me.target)&&st(!1),ho.current&&!ho.current.contains(me.target)&&Et(!1),xt.current&&!xt.current.contains(me.target)&&Oe(!1)}return document.addEventListener("pointerdown",H),()=>document.removeEventListener("pointerdown",H)},[]),k.useEffect(()=>{if(!E){Xi(null);return}Ne.getRepoInfo(E).then(H=>{Xi(H),en(H.currentBranch),fr(!1)}).catch(()=>{Xi(null),en(""),fr(!1)})},[E]);const ea=M.find(H=>H.value===y)||M[0],Fa=ge.find(H=>H.value===j)||ge[0],Jr=we.find(H=>H.value===w)||we[0],tr=p==="codex"?"/logo-codex.svg":"/logo.svg",iu=E?E.split("/").pop()||E:"Select folder",po=k.useMemo(()=>Bn.trim(),[Bn]),Ua=p==="claude"&&tt&&po.length>0,hs=k.useMemo(()=>{const H=Date.now()-QR;return re.filter(me=>me.createdAt>=H)},[re]),li=k.useMemo(()=>Pn?re:hs.length>0?hs:re,[Pn,hs,re]),Tr=k.useMemo(()=>Pa.trim().toLowerCase(),[Pa]),un=k.useMemo(()=>Tr?li.filter(H=>{const me=K5(H).toLowerCase(),Ke=yx(H.cwd).toLowerCase(),vt=(H.gitBranch||"").toLowerCase(),it=H.cwd.toLowerCase(),qe=H.resumeSessionId.toLowerCase();return me.includes(Tr)||Ke.includes(Tr)||vt.includes(Tr)||it.includes(Tr)||qe.includes(Tr)}):li,[li,Tr]),ta=k.useMemo(()=>un.slice(0,Gn),[un,Gn]),au=Gn<un.length,Ia=Math.max(0,re.length-hs.length),oi=!Pn&&hs.length>0,Ha=k.useCallback(async()=>{if(p==="claude"){Xe(!0),fn("");try{const[H,me]=await Promise.all([Ne.listSessions(),Ne.discoverClaudeSessions(400).then(qe=>qe.sessions)]),Ke=new Map,vt=qe=>{const Wn=Ke.get(qe.resumeSessionId);(!Wn||qe.createdAt>Wn.createdAt)&&Ke.set(qe.resumeSessionId,qe)};for(const qe of H)qe.backendType!=="codex"&&qe.cliSessionId&&vt({resumeSessionId:qe.cliSessionId,sessionId:qe.sessionId,name:qe.name,model:qe.model,createdAt:qe.createdAt,cwd:qe.cwd,gitBranch:qe.gitBranch,source:"companion"});for(const qe of me)vt({resumeSessionId:qe.sessionId,sessionId:qe.sessionId,slug:qe.slug,createdAt:qe.lastActivityAt,cwd:qe.cwd,gitBranch:qe.gitBranch,source:"claude_disk"});const it=Array.from(Ke.values()).sort((qe,Wn)=>{const Sn=E&&qe.cwd===E?0:1,Lr=E&&Wn.cwd===E?0:1;return Sn!==Lr?Sn-Lr:Wn.createdAt-qe.createdAt});ve(it),qt(!1),Er(Na)}catch(H){const me=H instanceof Error?H.message:String(H);fn(me||"Failed to load existing sessions"),ve([]),Er(Na)}finally{Xe(!1)}}},[p,E]);k.useEffect(()=>{p==="claude"&&tt&&Ha()},[p,tt,Ha]),k.useEffect(()=>{Er(Na)},[Tr,Pn]);async function mo(H){if(H.length===0)return;const me=[],Ke=[];let vt=L.reduce((it,qe)=>it+qe.size,0);for(const it of H){if(it.size>Oh){Ke.push(`${it.name} is too large (${Hi(it.size)}, max ${Hi(Oh)})`);continue}if(vt+it.size>Bh){Ke.push(`${it.name} would exceed the per-message limit (${Hi(Bh)})`);continue}const{base64:qe,mediaType:Wn}=await yk(it);me.push({name:it.name,base64:qe,mediaType:Wn,size:it.size}),vt+=it.size}me.length>0&&O(it=>[...it,...me]),F(Ke.length>0?Ke.join("; "):null)}async function ci(H){const me=H.target.files;me&&(await mo(Array.from(me)),H.target.value="")}function Zh(H){O(me=>me.filter((Ke,vt)=>vt!==H))}async function lu(H){var vt;const me=(vt=H.clipboardData)==null?void 0:vt.items;if(!me)return;const Ke=[];for(const it of Array.from(me)){if(it.kind!=="file")continue;const qe=it.getAsFile();if(!qe)continue;const Wn=qe.name&&qe.name.length>0?qe.name:`pasted-${Date.now()}.${(qe.type.split("/")[1]||"bin").replace(/[^a-zA-Z0-9]/g,"")}`;Ke.push(new File([qe],Wn,{type:qe.type,lastModified:qe.lastModified}))}Ke.length>0&&(H.preventDefault(),await mo(Ke))}function ou(H){t(H.target.value),us(H.target.selectionStart??H.target.value.length);const me=H.target;me.style.height="auto",me.style.height=Math.min(me.scrollHeight,200)+"px"}function qa(){er.current&&us(er.current.selectionStart??0)}function cu(H){var Ke;const me=rn.selectPrompt(H);nn.current=me.nextCursor,t(me.nextText),rn.setMentionMenuOpen(!1),us(me.nextCursor),(Ke=er.current)==null||Ke.focus(),er.current&&(er.current.style.height="auto",er.current.style.height=Math.min(er.current.scrollHeight,200)+"px")}function Jh(H){if(rn.mentionMenuOpen&&H.key==="Escape"){H.preventDefault(),rn.setMentionMenuOpen(!1);return}if(rn.mentionMenuOpen&&rn.filteredPrompts.length>0){if(H.key==="ArrowDown"){H.preventDefault(),rn.setMentionMenuIndex(me=>(me+1)%rn.filteredPrompts.length);return}if(H.key==="ArrowUp"){H.preventDefault(),rn.setMentionMenuIndex(me=>(me-1+rn.filteredPrompts.length)%rn.filteredPrompts.length);return}if(H.key==="Tab"&&!H.shiftKey||H.key==="Enter"&&!H.shiftKey){H.preventDefault(),cu(rn.filteredPrompts[rn.mentionMenuIndex]);return}}if(rn.mentionMenuOpen&&rn.filteredPrompts.length===0&&(H.key==="Enter"&&!H.shiftKey||H.key==="Tab"&&!H.shiftKey)){H.preventDefault();return}if(H.key==="Tab"&&H.shiftKey){H.preventDefault();const me=H5(p),vt=(me.findIndex(it=>it.value===j)+1)%me.length;N(me[vt].value);return}H.key==="Enter"&&!H.shiftKey&&(H.preventDefault(),Mr())}function Va(H){const me=r.trim(),Ke=me?`[${me}]: ${H}`:H;if(!$)return Ke;const vt=($.description??"").trim();return`${["Linear issue context:",`- Identifier: ${$.identifier}`,`- Title: ${$.title}`,$.stateName?`- State: ${$.stateName}`:"",$.priorityLabel?`- Priority: ${$.priorityLabel}`:"",$.teamName?`- Team: ${$.teamName}`:"",`- URL: ${$.url}`,vt?`- Description:
112
+ ${vt}`:""].filter(Boolean).join(`
113
+ `)}
114
+
115
+ User request:
116
+ ${Ke}`}async function Mr(){const H=e.trim();if(!(!H||W)){if(n&&!r.trim()){A("Please enter your name before starting a session.");return}if(z(!0),A(""),Jn(""),Yn){const me=Ar||Yn.currentBranch;if(me&&me===Yn.currentBranch){const Ke=uo.find(vt=>vt.name===me&&!vt.isRemote);if(Ke&&Ke.behind>0){Zi({behind:Ke.behind,branchName:me});return}}}await ui(H)}}async function ui(H,me){const Ke=Y.getState();Ke.clearCreation(),Ke.setSessionCreating(!0,p);try{fo&&vg(fo);const vt=(me==null?void 0:me.resumeSessionAt)||(Ua?po:void 0),it=vt?(me==null?void 0:me.forkSession)??(Ua?Xr:void 0):void 0,qe=(me==null?void 0:me.cwd)||E,Wn=(me==null?void 0:me.branch)!==void 0?me.branch.trim()||void 0:Ar.trim()||void 0,Sn=(me==null?void 0:me.useWorktree)!==void 0?me.useWorktree:oo,Lr=(me==null?void 0:me.createBranch)!==void 0?me.createBranch:!!(Wn&&Tn),As=await T6({model:y,permissionMode:j,effort:p==="claude"&&w?w:void 0,cwd:qe||void 0,envSlug:Ee||void 0,sandboxEnabled:Lt?!0:void 0,sandboxSlug:Lt&&dt?dt:void 0,branch:Wn,createBranch:Lr?!0:void 0,useWorktree:Sn?!0:void 0,backend:p,codexInternetAccess:p==="codex"?!0:void 0,resumeSessionAt:vt,forkSession:it,userName:r.trim()||void 0,linearConnectionId:$&&ae||void 0,linearIssue:$?{identifier:$.identifier,title:$.title,stateName:$.stateName,teamName:$.teamName,url:$.url}:void 0},fs=>{Y.getState().addCreationProgress(fs)}),kn=As.sessionId,hu=Y.getState(),xo=hu.sdkSessions.filter(fs=>fs.sessionId!==kn);hu.setSdkSessions([...xo,{sessionId:kn,state:As.state,cwd:As.cwd,createdAt:Date.now(),backendType:As.backendType||p,model:y,permissionMode:j,userName:r.trim()||void 0,resumeSessionAt:vt,forkSession:vt?it===!0:void 0}]);const vo=new Set(Y.getState().sessionNames.values()),ra=lw(vo),sa=o.trim()||r.trim(),fu=h.trim()||ra,pu=sa?`${sa}_${fu}`:fu;Y.getState().setSessionName(kn,pu),Ne.renameSession(kn,pu).catch(()=>{}),f(""),qe&&Fk(qe),Y.getState().setPreviousPermissionMode(kn,j),Vx(kn,!0),Zc(kn),await M3(kn);const mu=H.trim();if(mu.length>0){const fs=Va(mu),gu=mg(),xu=L.length>0?L.map(Wa=>({name:Wa.name,media_type:Wa.mediaType,data:Wa.base64,size:Wa.size})):void 0;On(kn,{type:"user_message",content:fs,session_id:kn,attachments:xu,client_msg_id:gu}),Y.getState().appendMessage(kn,{id:gu,role:"user",content:fs,attachments:xu,timestamp:Date.now()})}$&&(Ne.linkLinearIssue(kn,$,ae||void 0).then(()=>Y.getState().setLinkedLinearIssue(kn,$)).catch(()=>{}),Ne.transitionLinearIssue($.id,ae||void 0).catch(()=>{})),Y.getState().clearCreation()}catch(vt){const it=vt instanceof Error?vt.message:String(vt);A(it),Y.getState().setCreationError(it),z(!1)}}async function Ga(H,me){W||(z(!0),A(""),Jn(""),R(H.cwd),co(!1),fr(!1),en(H.gitBranch||""),os(H.resumeSessionId),Kr(me),await ui("",{resumeSessionAt:H.resumeSessionId,forkSession:me,cwd:H.cwd,branch:H.gitBranch,useWorktree:!1,createBranch:!1}))}async function di(){if(Ki){ai(!0),Jn("");try{const H=E||(Yn==null?void 0:Yn.repoRoot);if(!H)throw new Error("No working directory");const me=await Ne.gitPull(H);if(!me.success){Jn(me.output||"Pull failed"),ai(!1),z(!1);return}Zi(null),ai(!1),await ui(e.trim())}catch(H){Jn(H instanceof Error?H.message:String(H)),ai(!1)}}}function hi(){const H=e.trim();Zi(null),Jn(""),ui(H)}function uu(){Zi(null),Jn(""),z(!1)}const go=k.useCallback((H,me)=>{en(H),fr(me)},[]),du=k.useCallback((H,me)=>{en(H),fr(me)},[]),na=k.useCallback(H=>{Xh(H)},[]),Dr=k.useCallback(H=>{se(H),!H&&Yn&&(en(Yn.currentBranch),fr(!1))},[Yn]),Ya=e.trim().length>0&&!W&&(!n||r.trim().length>0);return l.jsxs("div",{className:"flex-1 h-full flex flex-col items-center px-3 sm:px-6 pb-6 pb-safe overflow-y-auto overscroll-y-contain",children:[l.jsx("div",{className:"shrink-0 h-[12vh] sm:h-[18vh]"}),l.jsxs("div",{className:"w-full max-w-[720px]",children:[l.jsxs("div",{className:"flex flex-col items-center mb-6 sm:mb-10",children:[l.jsx("img",{src:tr,alt:"The Companion",className:"w-10 h-10 sm:w-12 sm:h-12 mb-3"}),l.jsxs("h1",{className:"text-xl sm:text-2xl font-semibold tracking-tight text-cc-fg flex items-baseline gap-2",children:["The Companion",l.jsx("span",{className:"text-[10px] sm:text-[11px] font-medium uppercase tracking-[0.14em] rounded-full px-2 py-0.5 bg-cc-primary/10 text-cc-primary border border-cc-primary/20","aria-label":"Moritz Edition fork",children:"Moritz Edition"})]})]}),n&&l.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mb-4",children:[l.jsxs("label",{className:"flex-1 flex flex-col gap-1",children:[l.jsxs("span",{className:"text-[11px] font-medium uppercase tracking-wide text-cc-muted",children:["Your name ",l.jsx("span",{className:"text-cc-error",children:"*"})]}),l.jsx("input",{type:"text",value:r,onChange:H=>{const me=H.target.value;a(me),localStorage.setItem("cc-user-name",me)},placeholder:"e.g. Moritz","aria-label":"Your name","aria-required":"true","aria-invalid":r.trim().length===0,className:"w-full px-3 py-2 text-sm bg-cc-card border border-cc-border rounded-lg focus:outline-none focus:border-cc-primary text-cc-fg placeholder:text-cc-muted/70"})]}),l.jsxs("label",{className:"flex-1 flex flex-col gap-1",children:[l.jsxs("span",{className:"text-[11px] font-medium uppercase tracking-wide text-cc-muted",children:["Session prefix ",l.jsx("span",{className:"text-cc-muted/60 normal-case",children:"(optional)"})]}),l.jsx("input",{type:"text",value:o,onChange:H=>{const me=H.target.value;u(me),localStorage.setItem("cc-session-prefix",me)},placeholder:"e.g. MA","aria-label":"Session prefix",className:"w-full px-3 py-2 text-sm bg-cc-card border border-cc-border rounded-lg focus:outline-none focus:border-cc-primary text-cc-fg placeholder:text-cc-muted/70"})]})]}),l.jsxs("label",{className:"flex flex-col gap-1 mb-4",children:[l.jsxs("span",{className:"text-[11px] font-medium uppercase tracking-wide text-cc-muted",children:["Topic ",l.jsx("span",{className:"text-cc-muted/60 normal-case",children:"(optional)"})]}),l.jsx("input",{type:"text",value:h,onChange:H=>f(H.target.value),maxLength:50,placeholder:"e.g. InvoicePdf","aria-label":"Session topic",className:"w-full px-3 py-2 text-sm bg-cc-card border border-cc-border rounded-lg focus:outline-none focus:border-cc-primary text-cc-fg placeholder:text-cc-muted/70"}),l.jsxs("span",{className:"text-[10px] text-cc-muted/70 leading-snug",children:["When set, the session is named"," ",l.jsxs("span",{className:"font-mono-code",children:[o.trim()||r.trim()||"MA","_",h.trim()||"InvoicePdf"]}),"."]})]}),l.jsx("input",{ref:Se,type:"file",multiple:!0,onChange:ci,className:"hidden","aria-label":"Attach files"}),l.jsxs("div",{className:"relative bg-cc-card border border-cc-border rounded-2xl shadow-sm",children:[l.jsx(Rk,{open:rn.mentionMenuOpen,loading:rn.promptsLoading,prompts:rn.filteredPrompts,selectedIndex:rn.mentionMenuIndex,onSelect:cu,menuRef:rn.mentionMenuRef,className:"absolute left-2 right-2 bottom-full mb-1"}),($||L.length>0)&&l.jsxs("div",{className:"flex items-center gap-2 px-4 pt-3 flex-wrap",children:[$&&l.jsxs("div",{className:"inline-flex max-w-full items-center gap-2 rounded-md border border-cc-border bg-cc-hover/60 px-2.5 py-1.5 text-[11px] text-cc-muted",children:[l.jsx("span",{className:"shrink-0",children:"Linear"}),l.jsx("span",{className:"font-mono-code shrink-0",children:$.identifier}),l.jsx("span",{className:"truncate",children:$.title}),l.jsx("button",{type:"button",onClick:()=>Dr(null),className:"shrink-0 rounded px-1 text-cc-muted hover:text-cc-fg hover:bg-cc-active transition-colors cursor-pointer",title:"Remove Linear issue",children:"×"})]}),L.map((H,me)=>l.jsx(Sk,{name:H.name,mediaType:H.mediaType,base64:H.base64,size:H.size,onRemove:()=>Zh(me),className:"w-10 h-10"},me))]}),q&&l.jsx("div",{className:"px-4 pt-2 text-[11px] text-cc-error",children:q}),l.jsx("textarea",{ref:er,value:e,onChange:ou,onKeyDown:Jh,onClick:qa,onKeyUp:qa,onPaste:lu,"aria-label":"Task description",placeholder:"Fix a bug, build a feature, refactor code...",rows:3,className:"w-full px-4 sm:px-5 pt-4 pb-2 text-[15px] sm:text-sm bg-transparent resize-none focus:outline-none text-cc-fg font-sans-ui placeholder:text-cc-muted/70 overflow-y-auto",style:{minHeight:"80px",maxHeight:"200px"}}),l.jsxs("div",{className:"flex items-center gap-1 px-2.5 sm:px-3 py-2 flex-wrap",children:[l.jsxs("div",{className:"relative",ref:$a,children:[l.jsxs("button",{onClick:()=>xe(!Q),"aria-expanded":Q,className:"flex items-center gap-1 px-2 py-1 text-[11px] sm:text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("span",{children:ea.icon}),l.jsx("span",{children:ea.label}),l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 opacity-40",children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]}),Q&&l.jsx("div",{className:"absolute left-0 bottom-full mb-1 w-48 bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 py-1",children:M.map(H=>l.jsxs("button",{onClick:()=>{_(H.value),xe(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 ${H.value===y?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{children:H.icon}),H.label]},H.value))})]}),we.length>0&&l.jsxs("div",{className:"relative",ref:ds,children:[l.jsxs("button",{onClick:()=>st(!rt),"aria-expanded":rt,"aria-label":"Reasoning effort",title:"Reasoning effort",className:"flex items-center gap-1 px-2 py-1 text-[11px] sm:text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:l.jsx("path",{d:"M2 13l3.5-3.5L8 12l5.5-6.5M13.5 5.5h-2.5M13.5 5.5v2.5",strokeLinecap:"round",strokeLinejoin:"round"})}),l.jsx("span",{children:Jr.label}),l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 opacity-40",children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]}),rt&&l.jsx("div",{className:"absolute left-0 bottom-full mb-1 w-40 bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 py-1 overflow-hidden",children:we.map(H=>l.jsx("button",{onClick:()=>{C(H.value),localStorage.setItem("cc-effort",H.value),st(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${H.value===w?"text-cc-primary font-medium":"text-cc-fg"}`,children:H.label},H.value||"default"))})]}),l.jsxs("div",{className:"relative",ref:Zr,children:[l.jsxs("button",{onClick:()=>Qe(!Le),"aria-expanded":Le,className:"flex items-center gap-1 px-2 py-1 text-[11px] sm:text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:l.jsx("path",{d:"M2 4h12M2 8h8M2 12h10",strokeLinecap:"round"})}),Fa.label,l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 opacity-40",children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]}),Le&&l.jsx("div",{className:"absolute left-0 bottom-full mb-1 w-40 bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 py-1 overflow-hidden",children:ge.map(H=>l.jsx("button",{onClick:()=>{N(H.value),Qe(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${H.value===j?"text-cc-primary font-medium":"text-cc-fg"}`,children:H.label},H.value))})]}),l.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-cc-muted/30 mx-0.5 hidden sm:block"}),l.jsxs("div",{children:[l.jsxs("button",{onClick:()=>wn(!0),className:"flex items-center gap-1 px-2 py-1 text-[11px] sm:text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:l.jsx("path",{d:"M1 3.5A1.5 1.5 0 012.5 2h3.379a1.5 1.5 0 011.06.44l.622.621a.5.5 0 00.353.146H13.5A1.5 1.5 0 0115 4.707V12.5a1.5 1.5 0 01-1.5 1.5h-11A1.5 1.5 0 011 12.5v-9z"})}),l.jsx("span",{className:"max-w-[80px] sm:max-w-[140px] truncate font-mono-code",children:iu})]}),Ct&&l.jsx(HR,{initialPath:E||"",onSelect:H=>{R(H)},onClose:()=>wn(!1)})]}),l.jsx(WR,{cwd:E,gitRepoInfo:Yn,selectedBranch:Ar,isNewBranch:Tn,useWorktree:oo,onBranchChange:go,onWorktreeChange:co,onBranchesLoaded:na}),l.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-cc-muted/30 mx-0.5 hidden sm:block"}),l.jsxs("div",{className:"relative",ref:ho,children:[l.jsxs("button",{onClick:()=>{et||Ne.listEnvs().then(ze).catch(()=>{}),Et(!et)},"aria-expanded":et,className:"flex items-center gap-1 px-2 py-1 text-[11px] sm:text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:l.jsx("path",{d:"M8 1a2 2 0 012 2v1h2a2 2 0 012 2v6a2 2 0 01-2 2H4a2 2 0 01-2-2V6a2 2 0 012-2h2V3a2 2 0 012-2zm0 1.5a.5.5 0 00-.5.5v1h1V3a.5.5 0 00-.5-.5zM4 5.5a.5.5 0 00-.5.5v6a.5.5 0 00.5.5h8a.5.5 0 00.5-.5V6a.5.5 0 00-.5-.5H4z"})}),l.jsx("span",{className:"max-w-[80px] sm:max-w-[100px] truncate",children:Ee?((fi=Ce.find(H=>H.slug===Ee))==null?void 0:fi.name)||"Env":"No env"})]}),et&&l.jsxs("div",{className:"absolute left-0 bottom-full mb-1 w-56 bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 py-1 overflow-hidden",children:[l.jsx("button",{onClick:()=>{Pe(""),localStorage.setItem("cc-selected-env",""),Et(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${Ee?"text-cc-fg":"text-cc-primary font-medium"}`,children:"No environment"}),Ce.map(H=>l.jsxs("button",{onClick:()=>{Pe(H.slug),localStorage.setItem("cc-selected-env",H.slug),Et(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-1 ${H.slug===Ee?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{className:"truncate",children:H.name}),l.jsxs("span",{className:"text-cc-muted ml-auto shrink-0",children:[Object.keys(H.variables).length," var",Object.keys(H.variables).length!==1?"s":""]})]},H.slug)),l.jsx("div",{className:"border-t border-cc-border mt-1 pt-1",children:l.jsx("button",{onClick:()=>{yt(!0),Et(!1)},className:"w-full px-3 py-2 text-xs text-left text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:"Manage environments..."})})]})]}),_t,l.jsx("div",{className:"flex-1"}),l.jsx("button",{onClick:()=>{var H;return(H=Se.current)==null?void 0:H.click()},className:"flex items-center justify-center w-7 h-7 rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:"Attach file",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M11.5 6.5L7 11a2 2 0 1 1-2.83-2.83l5-5a3.25 3.25 0 1 1 4.6 4.6l-5.7 5.7a4.5 4.5 0 0 1-6.36-6.36L7 2",strokeLinecap:"round",strokeLinejoin:"round"})})}),l.jsx("button",{onClick:Mr,disabled:!Ya,className:`flex items-center justify-center w-8 h-8 sm:w-9 sm:h-9 rounded-full transition-colors ${Ya?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,title:"Send message",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M3 2l11 6-11 6V9.5l7-1.5-7-1.5V2z"})})})]})]}),l.jsxs("div",{className:"mt-3 sm:mt-4 space-y-2",children:[x.length>1&&l.jsx("div",{className:"flex items-center justify-center",children:l.jsx("div",{className:"flex items-center bg-cc-hover/50 rounded-lg p-0.5",children:x.map(H=>l.jsxs("button",{onClick:()=>H.available&&Kh(H.id),disabled:!H.available,title:H.available?H.name:`${H.name} CLI not found in PATH`,className:`flex items-center gap-1 px-3 py-1.5 text-xs rounded-md transition-colors ${H.available?p===H.id?"bg-cc-card text-cc-fg font-medium shadow-sm cursor-pointer":"text-cc-muted hover:text-cc-fg cursor-pointer":"text-cc-muted/40 cursor-not-allowed"}`,children:[H.name,!H.available&&l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3 text-cc-error/60",children:[l.jsx("circle",{cx:"8",cy:"8",r:"6"}),l.jsx("path",{d:"M5.5 5.5l5 5M10.5 5.5l-5 5"})]})]},H.id))})}),p==="claude"&&l.jsxs("div",{children:[l.jsxs("button",{type:"button",onClick:()=>hr(H=>!H),className:`mx-auto flex items-center gap-1.5 px-2 py-1 text-[11px] sm:text-xs rounded-md transition-colors cursor-pointer ${tt?"text-cc-primary":"text-cc-muted hover:text-cc-fg"}`,"aria-expanded":tt,"aria-controls":"branch-from-session-panel",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5 opacity-60",children:[l.jsx("path",{d:"M5 3.5a2 2 0 110 4 2 2 0 010-4zm6 5a2 2 0 110 4 2 2 0 010-4z"}),l.jsx("path",{d:"M7 5.5h2.5A1.5 1.5 0 0111 7v1",strokeLinecap:"round"})]}),"Branch from session",l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-3 h-3 opacity-40 transition-transform ${tt?"rotate-180":""}`,children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]}),l.jsx("div",{className:"accordion-panel","data-open":tt?"true":"false",children:l.jsx("div",{className:"accordion-inner",inert:!tt||void 0,children:l.jsxs("div",{id:"branch-from-session-panel",className:"mt-2 px-1 sm:px-2 py-2 space-y-2 rounded-xl border border-cc-border/20 bg-cc-card/30",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[l.jsx("button",{type:"button",onClick:()=>void Ha(),disabled:ye,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:ye?"Refreshing...":"Refresh detected sessions"}),re.length>0&&l.jsxs("span",{className:"text-[11px] text-cc-muted",children:["Showing ",ta.length," of ",un.length," ",Tr?"matching":oi?"recent":"detected"," Claude session",un.length!==1?"s":"","."]}),!Pn&&Ia>0&&hs.length>0&&l.jsxs("button",{type:"button",onClick:()=>{qt(!0),Er(Na)},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 (",Ia,")"]}),Pn&&hs.length>0&&l.jsx("button",{type:"button",onClick:()=>{qt(!1),Er(Na)},className:"px-2 py-1 rounded-md text-[11px] bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Recent only"})]}),l.jsxs("label",{className:"block",children:[l.jsx("span",{className:"sr-only",children:"Search sessions"}),l.jsxs("div",{className:"relative",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5 text-cc-muted absolute left-2.5 top-1/2 -translate-y-1/2 pointer-events-none",children:[l.jsx("circle",{cx:"7",cy:"7",r:"4.25"}),l.jsx("path",{d:"M10.25 10.25L14 14",strokeLinecap:"round"})]}),l.jsx("input",{type:"text",value:Pa,onChange:H=>lo(H.target.value),placeholder:"Search sessions, branch, folder, or ID",className:"w-full bg-cc-card border border-cc-border rounded-md pl-8 pr-2.5 py-1.5 text-xs text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 focus:border-cc-primary/40"})]})]}),l.jsxs("p",{className:"text-[11px] text-cc-muted",children:[l.jsx("span",{className:"font-medium text-cc-fg",children:"Fork"})," opens a new session that leaves the original untouched.",l.jsx("span",{className:"mx-1",children:"•"}),l.jsx("span",{className:"font-medium text-cc-fg",children:"Continue"})," opens from the same linear thread."]}),Ht&&l.jsx("p",{className:"text-[11px] text-cc-error",children:Ht}),!ye&&!Ht&&un.length===0&&l.jsx("p",{className:"text-[11px] text-cc-muted",children:Tr?"No sessions match this search.":"No Claude sessions detected yet."}),ta.length>0&&l.jsxs("div",{className:"rounded-md border border-cc-border overflow-hidden bg-cc-card/50",children:[l.jsxs("div",{className:"hidden sm:grid sm:grid-cols-[minmax(0,1.5fr)_minmax(0,1.2fr)_minmax(0,0.8fr)_minmax(0,0.7fr)_auto] px-2.5 py-1.5 border-b border-cc-border text-[10px] uppercase tracking-wider text-cc-muted",children:[l.jsx("span",{children:"Session"}),l.jsx("span",{children:"Project"}),l.jsx("span",{children:"Branch"}),l.jsx("span",{children:"Last active"}),l.jsx("span",{className:"text-right",children:"Action"})]}),l.jsx("div",{className:"divide-y divide-cc-border/50",children:ta.map(H=>{const me=K5(H),Ke=yx(H.cwd),vt=H.source==="companion"?"Companion":"Claude",it=po===H.resumeSessionId;return l.jsxs("div",{className:"px-2 py-2 sm:px-2.5 sm:py-2.5 grid grid-cols-1 gap-1.5 sm:gap-2 sm:grid-cols-[minmax(0,1.5fr)_minmax(0,1.2fr)_minmax(0,0.8fr)_minmax(0,0.7fr)_auto] sm:items-center",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("p",{className:`text-xs truncate ${it?"text-cc-primary font-medium":"text-cc-fg"}`,children:me}),l.jsxs("div",{className:"mt-0.5 flex items-center gap-1.5 text-[10px]",children:[l.jsx("span",{className:"font-mono-code text-cc-muted",children:KR(H.resumeSessionId)}),l.jsx("span",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted",children:vt})]})]}),l.jsxs("div",{className:"min-w-0 text-[11px] text-cc-muted sm:font-mono-code truncate",title:H.cwd,children:[l.jsx("div",{className:"truncate",children:Ke}),l.jsx("div",{className:"mt-0.5 text-[10px] text-cc-muted/70 truncate",title:H.cwd,children:ZR(H.cwd)})]}),l.jsx("div",{className:"text-[11px] text-cc-muted sm:font-mono-code truncate",children:H.gitBranch||"—"}),l.jsx("div",{className:"text-[11px] text-cc-muted",children:JR(H.createdAt)}),l.jsxs("div",{className:"sm:text-right flex gap-1.5 sm:justify-end",children:[l.jsx("button",{type:"button",onClick:()=>{os(H.resumeSessionId),Kr(!0),Ga(H,!0)},"aria-label":`Fork and open ${me}`,className:`px-2 py-1 rounded-md text-[11px] border transition-colors cursor-pointer ${it&&Xr?"border-cc-primary/40 bg-cc-primary/10 text-cc-primary":"border-cc-border bg-cc-card text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:`Fork and open now
117
+ ${H.cwd}${H.gitBranch?` (${H.gitBranch})`:""}
118
+ ${H.resumeSessionId}`,children:"Fork"}),l.jsx("button",{type:"button",onClick:()=>{os(H.resumeSessionId),Kr(!1),Ga(H,!1)},"aria-label":`Continue and open ${me}`,className:`px-2 py-1 rounded-md text-[11px] border transition-colors cursor-pointer ${it&&!Xr?"border-cc-primary/40 bg-cc-primary/10 text-cc-primary":"border-cc-border bg-cc-card text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:`Continue and open now
119
+ ${H.resumeSessionId}`,children:"Continue"})]})]},`${H.resumeSessionId}-row-${H.sessionId}`)})}),au&&l.jsx("div",{className:"px-2.5 py-2 border-t border-cc-border bg-cc-card/40",children:l.jsxs("button",{type:"button",onClick:()=>Er(H=>Math.min(H+XR,un.length)),className:"px-2 py-1 rounded-md text-[11px] bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:["Load more (",un.length-Gn," remaining)"]})})]}),l.jsx("p",{className:"text-[11px] text-cc-muted",children:"Fork/Continue opens the session immediately, then you can type directly in chat. Send from Home still starts a normal new session with your typed prompt."})]})})})]}),P&&l.jsxs("div",{className:"flex items-start gap-2 px-3 py-2 rounded-xl bg-cc-primary/5 border border-cc-primary/10 text-[11px] text-cc-muted",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary/60 shrink-0 mt-0.5",children:l.jsx("path",{d:"M8 1.5a6.5 6.5 0 100 13 6.5 6.5 0 000-13zM0 8a8 8 0 1116 0A8 8 0 010 8zm6.5-.25A.75.75 0 017.25 7h1a.75.75 0 01.75.75v2.75h.25a.75.75 0 010 1.5h-2a.75.75 0 010-1.5h.25v-2h-.25a.75.75 0 01-.75-.75zM8 6a1 1 0 110-2 1 1 0 010 2z"})}),l.jsxs("span",{className:"flex-1",children:["The toolbar sets where your code lives, which model to use, and how the session runs.",p==="claude"&&l.jsxs(l.Fragment,{children:[" ",l.jsx("strong",{className:"text-cc-fg",children:"Branch from session"})," below lets you fork or continue a previous Claude session."]})]}),l.jsx("button",{onClick:()=>{J(!1),localStorage.setItem("cc-onboarding-dismissed","true")},className:"shrink-0 w-5 h-5 flex items-center justify-center rounded text-cc-muted hover:text-cc-fg transition-colors cursor-pointer","aria-label":"Dismiss onboarding tip",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),l.jsx(YR,{cwd:E,gitRepoInfo:Yn,linearConfigured:G,selectedLinearIssue:$,onIssueSelect:Dr,onBranchFromIssue:du,onConnectionSelect:D})]}),Ki&&l.jsx("div",{className:"mt-3 p-3 rounded-[10px] bg-amber-500/10 border border-amber-500/20",children:l.jsxs("div",{className:"flex items-start gap-2.5",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-amber-500 shrink-0 mt-0.5",children:l.jsx("path",{d:"M8.982 1.566a1.13 1.13 0 00-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 01-1.1 0L7.1 5.995A.905.905 0 018 5zm.002 6a1 1 0 110 2 1 1 0 010-2z"})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("p",{className:"text-xs text-cc-fg leading-snug",children:[l.jsx("span",{className:"font-mono-code font-medium",children:Ki.branchName})," is"," ",l.jsxs("span",{className:"font-semibold text-amber-500",children:[Ki.behind," commit",Ki.behind!==1?"s":""," behind"]})," ","remote. Pull before starting?"]}),Es&&l.jsx("div",{className:"mt-2 px-2 py-1.5 rounded-md bg-cc-error/10 border border-cc-error/20 text-[11px] text-cc-error font-mono-code whitespace-pre-wrap",children:Es}),l.jsxs("div",{className:"flex flex-wrap gap-2 mt-2.5",children:[l.jsx("button",{onClick:uu,disabled:cs,className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),l.jsx("button",{onClick:hi,disabled:cs,className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Continue anyway"}),l.jsx("button",{onClick:di,disabled:cs,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:cs?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"w-3 h-3 border-2 border-cc-primary/30 border-t-cc-primary rounded-full animate-spin"}),"Pulling..."]}):"Pull and continue"})]})]})]})}),I&&l.jsxs("div",{className:"mt-3 flex items-center gap-2 px-3 py-2 rounded-lg bg-cc-error/5 border border-cc-error/20",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-error shrink-0",children:l.jsx("path",{fillRule:"evenodd",d:"M8 15A7 7 0 108 1a7 7 0 000 14zm1-3a1 1 0 11-2 0 1 1 0 012 0zM7.5 5.5a.5.5 0 011 0v3a.5.5 0 01-1 0v-3z",clipRule:"evenodd"})}),l.jsx("p",{className:"text-xs text-cc-error",children:I})]})]}),mt&&l.jsx(Uk,{onClose:()=>{yt(!1),Ne.listEnvs().then(ze).catch(()=>{})}})]})}const tz=[],nz=[],rz={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"}},sz={label:"Unknown",badge:"text-cc-muted bg-cc-hover",dot:"bg-cc-muted opacity-40"};function iz({server:e,sessionId:t}){var h,f;const[n,r]=k.useState(!1),a=rz[e.status]||sz,o=e.status!=="disabled",u=((h=e.tools)==null?void 0:h.length)??0;return l.jsxs("div",{className:"rounded-lg border border-cc-border bg-cc-bg",children:[l.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-2",children:[l.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${a.dot}`}),l.jsx("button",{onClick:()=>r(!n),className:"flex-1 min-w-0 text-left cursor-pointer",children:l.jsx("span",{className:"text-[12px] font-medium text-cc-fg truncate block",children:e.name})}),l.jsx("span",{className:`text-[9px] font-medium px-1.5 rounded-full leading-[16px] shrink-0 ${a.badge}`,children:a.label}),l.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[l.jsx("button",{onClick:()=>D3(t,e.name,!o),className:`w-6 h-6 flex items-center justify-center rounded-md transition-colors cursor-pointer ${o?"text-cc-muted hover:text-cc-fg hover:bg-cc-hover":"text-cc-muted/50 hover:text-cc-success hover:bg-cc-success/10"}`,title:o?"Disable server":"Enable server",children:o?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:[l.jsx("circle",{cx:"8",cy:"8",r:"6"}),l.jsx("path",{d:"M5 8h6",strokeLinecap:"round"})]}):l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:[l.jsx("circle",{cx:"8",cy:"8",r:"6"}),l.jsx("path",{d:"M8 5v6M5 8h6",strokeLinecap:"round"})]})}),(e.status==="failed"||e.status==="connected")&&l.jsx("button",{onClick:()=>L3(t,e.name),className:"w-6 h-6 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:"Reconnect server",children:l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:[l.jsx("path",{d:"M2.5 8a5.5 5.5 0 019.78-3.5M13.5 8a5.5 5.5 0 01-9.78 3.5",strokeLinecap:"round"}),l.jsx("path",{d:"M12.5 2v3h-3M3.5 14v-3h3",strokeLinecap:"round",strokeLinejoin:"round"})]})})]})]}),n&&l.jsxs("div",{className:"px-2.5 pb-2.5 space-y-1.5 pt-2",children:[l.jsxs("div",{className:"text-[11px] text-cc-muted space-y-0.5",children:[l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("span",{className:"text-cc-muted/60",children:"Type:"}),l.jsx("span",{children:e.config.type})]}),e.config.command&&l.jsxs("div",{className:"flex items-start gap-1",children:[l.jsx("span",{className:"text-cc-muted/60 shrink-0",children:"Cmd:"}),l.jsxs("span",{className:"font-mono text-[10px] break-all",children:[e.config.command,(f=e.config.args)!=null&&f.length?` ${e.config.args.join(" ")}`:""]})]}),e.config.url&&l.jsxs("div",{className:"flex items-start gap-1",children:[l.jsx("span",{className:"text-cc-muted/60 shrink-0",children:"URL:"}),l.jsx("span",{className:"font-mono text-[10px] break-all",children:e.config.url})]}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("span",{className:"text-cc-muted/60",children:"Scope:"}),l.jsx("span",{children:e.scope})]})]}),e.error&&l.jsx("div",{className:"text-[11px] text-cc-error bg-cc-error/5 rounded px-2 py-1",children:e.error}),u>0&&l.jsxs("div",{className:"space-y-1",children:[l.jsxs("span",{className:"text-[10px] text-cc-muted uppercase tracking-wider",children:["Tools (",u,")"]}),l.jsx("div",{className:"flex flex-wrap gap-1",children:e.tools.map(p=>l.jsx("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded bg-cc-hover text-cc-fg",title:p.annotations&&Object.entries(p.annotations).filter(([,m])=>m).map(([m])=>m).join(", ")||void 0,children:p.name},p.name))})]})]})]})}function az({sessionId:e,onDone:t}){const[n,r]=k.useState(""),[a,o]=k.useState("stdio"),[u,h]=k.useState(""),[f,p]=k.useState(""),[m,x]=k.useState(""),b=n.trim()&&(a==="stdio"?u.trim():m.trim());function y(_){if(_.preventDefault(),!b)return;const j={type:a};a==="stdio"?(j.command=u.trim(),f.trim()&&(j.args=f.trim().split(/\s+/))):j.url=m.trim(),R3(e,{[n.trim()]:j}),t()}return l.jsxs("form",{onSubmit:y,className:"space-y-2 p-2.5 rounded-lg border border-cc-border bg-cc-bg",children:[l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Server Name"}),l.jsx("input",{type:"text",value:n,onChange:_=>r(_.target.value),placeholder:"my-mcp-server",className:"w-full text-[12px] bg-cc-input-bg border border-cc-border rounded px-2 py-1.5 text-cc-fg placeholder:text-cc-muted/40 focus:outline-none focus:border-cc-primary"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Type"}),l.jsx("div",{className:"flex gap-1",children:["stdio","sse","http"].map(_=>l.jsx("button",{type:"button",onClick:()=>o(_),className:`text-[11px] px-2 py-1 rounded-md border transition-colors cursor-pointer ${a===_?"border-cc-primary text-cc-primary bg-cc-primary/10":"border-cc-border text-cc-muted hover:text-cc-fg hover:border-cc-muted"}`,children:_},_))})]}),a==="stdio"&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Command"}),l.jsx("input",{type:"text",value:u,onChange:_=>h(_.target.value),placeholder:"npx -y @modelcontextprotocol/server-memory",className:"w-full text-[12px] bg-cc-input-bg border border-cc-border rounded px-2 py-1.5 text-cc-fg placeholder:text-cc-muted/40 font-mono focus:outline-none focus:border-cc-primary"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Args (space-separated, optional)"}),l.jsx("input",{type:"text",value:f,onChange:_=>p(_.target.value),placeholder:"--port 3000",className:"w-full text-[12px] bg-cc-input-bg border border-cc-border rounded px-2 py-1.5 text-cc-fg placeholder:text-cc-muted/40 font-mono focus:outline-none focus:border-cc-primary"})]})]}),(a==="sse"||a==="http")&&l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"URL"}),l.jsx("input",{type:"text",value:m,onChange:_=>x(_.target.value),placeholder:"http://localhost:3000/mcp",className:"w-full text-[12px] bg-cc-input-bg border border-cc-border rounded px-2 py-1.5 text-cc-fg placeholder:text-cc-muted/40 font-mono focus:outline-none focus:border-cc-primary"})]}),l.jsxs("div",{className:"flex gap-1.5 pt-1",children:[l.jsx("button",{type:"submit",disabled:!b,className:`flex-1 text-[11px] font-medium py-1.5 rounded-md transition-colors ${b?"bg-cc-primary text-white hover:bg-cc-primary-hover cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:"Add Server"}),l.jsx("button",{type:"button",onClick:t,className:"text-[11px] font-medium px-3 py-1.5 rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:"Cancel"})]})]})}function lz({sessionId:e}){const t=Y(h=>h.mcpServers.get(e)||tz),n=Y(h=>h.cliConnected.get(e)??!1),[r,a]=k.useState(!1),o=Y(h=>{var f;return((f=h.sessions.get(e))==null?void 0:f.mcp_servers)??nz});k.useEffect(()=>{n&&_y(e)},[e,n]);const u=t.length>0?t:o.map(h=>({name:h.name,status:h.status,config:{type:"unknown"},scope:""}));return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"shrink-0 px-4 py-2.5 flex items-center justify-between",children:[l.jsxs("span",{className:"text-[13px] font-semibold text-cc-fg flex items-center gap-1.5",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-muted",children:l.jsx("path",{d:"M1.5 3A1.5 1.5 0 013 1.5h10A1.5 1.5 0 0114.5 3v1A1.5 1.5 0 0113 5.5H3A1.5 1.5 0 011.5 4V3zm0 5A1.5 1.5 0 013 6.5h10A1.5 1.5 0 0114.5 8v1A1.5 1.5 0 0113 10.5H3A1.5 1.5 0 011.5 9V8zm0 5A1.5 1.5 0 013 11.5h10a1.5 1.5 0 011.5 1.5v1a1.5 1.5 0 01-1.5 1.5H3A1.5 1.5 0 011.5 14v-1z"})}),"MCP Servers"]}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("button",{onClick:()=>a(!r),disabled:!n,className:`text-[11px] font-medium transition-colors ${n?"text-cc-muted hover:text-cc-fg cursor-pointer":"text-cc-muted/30 cursor-not-allowed"}`,title:"Add MCP server",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M8 3v10M3 8h10",strokeLinecap:"round"})})}),l.jsx("button",{onClick:()=>_y(e),disabled:!n,className:`text-[11px] font-medium transition-colors ${n?"text-cc-muted hover:text-cc-fg cursor-pointer":"text-cc-muted/30 cursor-not-allowed"}`,title:"Refresh MCP server status",children:l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:[l.jsx("path",{d:"M2.5 8a5.5 5.5 0 019.78-3.5M13.5 8a5.5 5.5 0 01-9.78 3.5",strokeLinecap:"round"}),l.jsx("path",{d:"M12.5 2v3h-3M3.5 14v-3h3",strokeLinecap:"round",strokeLinejoin:"round"})]})})]})]}),r&&l.jsx("div",{className:"px-3 py-2",children:l.jsx(az,{sessionId:e,onDone:()=>a(!1)})}),u.length>0&&l.jsx("div",{className:"px-3 py-2 space-y-1.5",children:u.map(h=>l.jsx(iz,{server:h,sessionId:e},h.name))}),!r&&u.length===0&&l.jsx("div",{className:"px-3 py-3",children:l.jsxs("p",{className:"text-[11px] text-cc-muted text-center",children:["No MCP servers configured."," ",n&&l.jsx("button",{onClick:()=>a(!0),className:"text-cc-primary hover:underline cursor-pointer",children:"Add one"})]})})]})}function oz({cwd:e,open:t,onClose:n}){var I;const[r,a]=k.useState([]),[o,u]=k.useState(!0),[h,f]=k.useState(0),[p,m]=k.useState(""),[x,b]=k.useState(!1),[y,_]=k.useState(!1),[j,N]=k.useState(null),[w,C]=k.useState(null),E=k.useCallback(()=>{u(!0),N(null),Ne.getClaudeMdFiles(e).then(A=>{a(A.files),A.files.length>0&&(f(0),m(A.files[0].content)),C(null),b(!1),u(!1)}).catch(A=>{N(A.message),u(!1)})},[e]);k.useEffect(()=>{t&&E()},[t,E]);const R=A=>{x&&!confirm("Discard unsaved changes?")||(f(A),m(r[A].content),b(!1),C(null))},L=async()=>{var X;const A=w||((X=r[h])==null?void 0:X.path);if(A){_(!0),N(null);try{await Ne.saveClaudeMd(A,p),b(!1),w?E():a(Z=>Z.map((G,B)=>B===h?{...G,content:p}:G))}catch(Z){N(Z instanceof Error?Z.message:"Failed to save")}finally{_(!1)}}},O=A=>{const X=A==="root"?`${e}/CLAUDE.md`:`${e}/.claude/CLAUDE.md`;C(X),m(`# CLAUDE.md
120
+
121
+ `),b(!0)},q=()=>{x&&!confirm("Discard unsaved changes?")||n()};if(!t)return null;const F=A=>A.startsWith(e+"/")?A.slice(e.length+1):A,W=r.some(A=>A.path===`${e}/CLAUDE.md`),z=r.some(A=>A.path===`${e}/.claude/CLAUDE.md`);return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fixed inset-0 bg-black/40 z-50",onClick:q}),l.jsxs("div",{className:"fixed inset-4 sm:inset-8 md:inset-x-[10%] md:inset-y-[5%] z-50 flex flex-col bg-cc-bg border border-cc-border rounded-2xl shadow-2xl overflow-hidden",children:[l.jsxs("div",{className:"shrink-0 flex items-center justify-between px-4 sm:px-5 py-3 bg-cc-card border-b border-cc-border",children:[l.jsxs("div",{className:"flex items-center gap-2.5",children:[l.jsx("div",{className:"w-7 h-7 rounded-lg bg-cc-primary/10 flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:l.jsx("path",{d:"M4 1.5a.5.5 0 01.5-.5h7a.5.5 0 01.354.146l2 2A.5.5 0 0114 3.5v11a.5.5 0 01-.5.5h-11a.5.5 0 01-.5-.5v-13zm1 .5v12h8V4h-1.5a.5.5 0 01-.5-.5V2H5zm6 0v1h1l-1-1z"})})}),l.jsxs("div",{children:[l.jsx("h2",{className:"text-sm font-semibold text-cc-fg",children:"CLAUDE.md"}),l.jsx("p",{className:"text-[11px] text-cc-muted",children:"Project instructions for Claude Code"})]})]}),l.jsx("button",{onClick:q,className:"w-7 h-7 flex items-center justify-center rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),l.jsx("div",{className:"flex-1 flex min-h-0",children:o?l.jsx("div",{className:"flex-1 flex items-center justify-center",children:l.jsx("div",{className:"w-5 h-5 border-2 border-cc-primary border-t-transparent rounded-full animate-spin"})}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"shrink-0 w-[180px] sm:w-[200px] border-r border-cc-border bg-cc-sidebar flex flex-col",children:[l.jsx("div",{className:"px-3 py-2 text-[10px] font-semibold text-cc-muted uppercase tracking-wider border-b border-cc-border",children:"Files"}),l.jsxs("div",{className:"flex-1 overflow-y-auto py-1",children:[r.map((A,X)=>l.jsxs("button",{onClick:()=>R(X),className:`flex items-center gap-2 w-full px-3 py-2 text-left text-[12px] transition-colors cursor-pointer ${!w&&h===X?"bg-cc-active text-cc-fg":"text-cc-fg/70 hover:bg-cc-hover"}`,children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-primary shrink-0",children:l.jsx("path",{d:"M4 1.5a.5.5 0 01.5-.5h7a.5.5 0 01.354.146l2 2A.5.5 0 0114 3.5v11a.5.5 0 01-.5.5h-11a.5.5 0 01-.5-.5v-13z"})}),l.jsx("span",{className:"truncate font-mono-code",children:F(A.path)})]},A.path)),w&&l.jsxs("div",{className:"flex items-center gap-2 w-full px-3 py-2 text-[12px] bg-cc-active text-cc-fg",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-success shrink-0",children:l.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),l.jsx("span",{className:"truncate font-mono-code",children:F(w)})]})]}),(!W||!z)&&!w&&l.jsxs("div",{className:"shrink-0 border-t border-cc-border p-2",children:[l.jsx("div",{className:"text-[10px] text-cc-muted uppercase tracking-wider px-1 mb-1",children:"Create new"}),!W&&l.jsxs("button",{onClick:()=>O("root"),className:"flex items-center gap-1.5 w-full px-2 py-1.5 text-[11px] text-cc-fg/70 hover:bg-cc-hover rounded-md transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-success shrink-0",children:l.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),l.jsx("span",{className:"font-mono-code",children:"CLAUDE.md"})]}),!z&&l.jsxs("button",{onClick:()=>O("dotclaude"),className:"flex items-center gap-1.5 w-full px-2 py-1.5 text-[11px] text-cc-fg/70 hover:bg-cc-hover rounded-md transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-success shrink-0",children:l.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),l.jsx("span",{className:"font-mono-code",children:".claude/CLAUDE.md"})]})]})]}),l.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[r.length===0&&!w?l.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-4 px-6",children:[l.jsx("div",{className:"w-14 h-14 rounded-2xl bg-cc-card border border-cc-border flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-6 h-6 text-cc-muted",children:l.jsx("path",{d:"M4 1.5a.5.5 0 01.5-.5h7a.5.5 0 01.354.146l2 2A.5.5 0 0114 3.5v11a.5.5 0 01-.5.5h-11a.5.5 0 01-.5-.5v-13z"})})}),l.jsxs("div",{className:"text-center",children:[l.jsx("p",{className:"text-sm text-cc-fg font-medium mb-1",children:"No CLAUDE.md found"}),l.jsx("p",{className:"text-xs text-cc-muted leading-relaxed max-w-[280px]",children:"Create a CLAUDE.md file to give Claude Code project-specific instructions, coding conventions, and context."})]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{onClick:()=>O("root"),className:"px-3 py-1.5 text-xs font-medium rounded-lg bg-cc-primary text-white hover:bg-cc-primary/90 transition-colors cursor-pointer",children:"Create CLAUDE.md"}),l.jsx("button",{onClick:()=>O("dotclaude"),className:"px-3 py-1.5 text-xs font-medium rounded-lg bg-cc-hover text-cc-fg border border-cc-border hover:bg-cc-active transition-colors cursor-pointer",children:"Create .claude/CLAUDE.md"})]})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"shrink-0 flex items-center justify-between px-4 py-2 bg-cc-card border-b border-cc-border",children:[l.jsx("span",{className:"text-[12px] text-cc-muted font-mono-code truncate",children:F(w||(((I=r[h])==null?void 0:I.path)??""))}),l.jsxs("div",{className:"flex items-center gap-2",children:[x&&l.jsx("span",{className:"text-[10px] text-cc-warning font-medium",children:"Unsaved"}),l.jsx("button",{onClick:L,disabled:!x||y,className:`px-3 py-1 text-[11px] font-medium rounded-md transition-colors cursor-pointer ${x&&!y?"bg-cc-primary text-white hover:bg-cc-primary/90":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:y?"Saving...":"Save"})]})]}),l.jsx("textarea",{value:p,onChange:A=>{m(A.target.value),b(!0)},spellCheck:!1,className:"flex-1 w-full p-4 bg-cc-bg text-cc-fg text-[13px] font-mono-code leading-relaxed resize-none focus:outline-none",placeholder:"Write your project instructions here..."})]}),j&&l.jsx("div",{className:"shrink-0 px-4 py-2 bg-cc-error/10 border-t border-cc-error/20 text-xs text-cc-error",children:j})]})]})})]})]})}function Z5({icon:e,title:t,expanded:n,onToggle:r}){return l.jsxs("button",{onClick:r,className:"w-full flex items-center gap-2 px-4 py-2 text-left hover:bg-cc-hover/50 transition-colors cursor-pointer","aria-expanded":n,children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:`w-3 h-3 text-cc-muted shrink-0 transition-transform ${n?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4",strokeLinecap:"round",strokeLinejoin:"round"})}),l.jsx("div",{className:"w-4 h-4 flex items-center justify-center shrink-0",children:e==="project"?l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:l.jsx("path",{d:"M1.5 2A1.5 1.5 0 000 3.5v2A1.5 1.5 0 001.5 7h1v5.5A1.5 1.5 0 004 14h8a1.5 1.5 0 001.5-1.5V7h1A1.5 1.5 0 0016 5.5v-2A1.5 1.5 0 0014.5 2h-13zM4 7h8v5.5a.5.5 0 01-.5.5h-7a.5.5 0 01-.5-.5V7zm10-1H2V3.5a.5.5 0 01.5-.5h11a.5.5 0 01.5.5V6z"})}):l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:l.jsx("path",{d:"M8.354 1.146a.5.5 0 00-.708 0l-6 6A.5.5 0 002 7.5V14a1 1 0 001 1h3.5a.5.5 0 00.5-.5V11a.5.5 0 01.5-.5h1a.5.5 0 01.5.5v3.5a.5.5 0 00.5.5H13a1 1 0 001-1V7.5a.5.5 0 00-.146-.354l-6-6z"})})}),l.jsx("span",{className:"text-[11px] font-semibold text-cc-muted uppercase tracking-wider flex-1",children:t})]})}function Ys({label:e,sublabel:t,count:n,onClick:r}){return l.jsxs("button",{onClick:r,className:"w-full flex items-center gap-2 px-4 pl-10 py-1.5 text-left hover:bg-cc-hover/50 transition-colors cursor-pointer",children:[l.jsxs("span",{className:"text-[12px] text-cc-fg truncate flex-1",children:[e,n!==void 0&&n>0&&l.jsxs("span",{className:"ml-1 text-[10px] text-cc-muted",children:["(",n,")"]})]}),t&&l.jsx("span",{className:"text-[10px] text-cc-muted shrink-0",children:t}),l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3 text-cc-muted shrink-0",children:l.jsx("path",{d:"M6 4l4 4-4 4",strokeLinecap:"round",strokeLinejoin:"round"})})]})}function cz({path:e,content:t,onClose:n}){let r;try{r=JSON.stringify(JSON.parse(t),null,2)}catch{r=t}return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fixed inset-0 bg-black/40 z-50",onClick:n}),l.jsxs("div",{className:"fixed inset-4 sm:inset-8 md:inset-x-[10%] md:inset-y-[5%] z-50 flex flex-col bg-cc-bg border border-cc-border rounded-2xl shadow-2xl overflow-hidden",children:[l.jsxs("div",{className:"shrink-0 flex items-center justify-between px-4 sm:px-5 py-3 bg-cc-card border-b border-cc-border",children:[l.jsxs("div",{className:"flex items-center gap-2.5",children:[l.jsx("div",{className:"w-7 h-7 rounded-lg bg-cc-primary/10 flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:l.jsx("path",{d:"M2 4a2 2 0 012-2h3.17a2 2 0 011.415.586l.828.828A2 2 0 0010.83 4H12a2 2 0 012 2v6a2 2 0 01-2 2H4a2 2 0 01-2-2V4z"})})}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("h2",{className:"text-sm font-semibold text-cc-fg truncate",children:e.split("/").pop()}),l.jsx("p",{className:"text-[11px] text-cc-muted truncate",children:e})]})]}),l.jsx("button",{onClick:n,className:"w-7 h-7 flex items-center justify-center rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer","aria-label":"Close",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),l.jsx("div",{className:"flex-1 overflow-auto p-4",children:l.jsx("pre",{className:"text-[13px] font-mono-code text-cc-fg leading-relaxed whitespace-pre-wrap break-words",children:r})}),l.jsx("div",{className:"shrink-0 px-4 py-2 bg-cc-card border-t border-cc-border",children:l.jsx("span",{className:"text-[10px] text-cc-muted",children:"Read-only"})})]})]})}function uz({path:e,label:t,onClose:n}){const[r,a]=k.useState(""),[o,u]=k.useState(!0),[h,f]=k.useState(!1),[p,m]=k.useState(!1),[x,b]=k.useState(null);k.useEffect(()=>{Ne.readFile(e).then(j=>{a(j.content),u(!1)}).catch(j=>{b(j instanceof Error?j.message:"Failed to read file"),u(!1)})},[e]);const y=async()=>{m(!0),b(null);try{await Ne.writeFile(e,r),f(!1)}catch(j){b(j instanceof Error?j.message:"Failed to save")}finally{m(!1)}},_=()=>{h&&!confirm("Discard unsaved changes?")||n()};return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fixed inset-0 bg-black/40 z-50",onClick:_}),l.jsxs("div",{className:"fixed inset-4 sm:inset-8 md:inset-x-[10%] md:inset-y-[5%] z-50 flex flex-col bg-cc-bg border border-cc-border rounded-2xl shadow-2xl overflow-hidden",children:[l.jsxs("div",{className:"shrink-0 flex items-center justify-between px-4 sm:px-5 py-3 bg-cc-card border-b border-cc-border",children:[l.jsxs("div",{className:"flex items-center gap-2.5",children:[l.jsx("div",{className:"w-7 h-7 rounded-lg bg-cc-primary/10 flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary",children:l.jsx("path",{d:"M4 1.5a.5.5 0 01.5-.5h7a.5.5 0 01.354.146l2 2A.5.5 0 0114 3.5v11a.5.5 0 01-.5.5h-11a.5.5 0 01-.5-.5v-13zm1 .5v12h8V4h-1.5a.5.5 0 01-.5-.5V2H5zm6 0v1h1l-1-1z"})})}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("h2",{className:"text-sm font-semibold text-cc-fg truncate",children:t}),l.jsx("p",{className:"text-[11px] text-cc-muted truncate",children:e})]})]}),l.jsx("button",{onClick:_,className:"w-7 h-7 flex items-center justify-center rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer","aria-label":"Close",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),o?l.jsx("div",{className:"flex-1 flex items-center justify-center",children:l.jsx("div",{className:"w-5 h-5 border-2 border-cc-primary border-t-transparent rounded-full animate-spin"})}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"shrink-0 flex items-center justify-between px-4 py-2 bg-cc-card border-b border-cc-border",children:[l.jsx("span",{className:"text-[12px] text-cc-muted font-mono-code truncate",children:e.split("/").pop()}),l.jsxs("div",{className:"flex items-center gap-2",children:[h&&l.jsx("span",{className:"text-[10px] text-cc-warning font-medium",children:"Unsaved"}),l.jsx("button",{onClick:y,disabled:!h||p,className:`px-3 py-1 text-[11px] font-medium rounded-md transition-colors cursor-pointer ${h&&!p?"bg-cc-primary text-white hover:bg-cc-primary/90":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:p?"Saving...":"Save"})]})]}),l.jsx("textarea",{value:r,onChange:j=>{a(j.target.value),f(!0)},spellCheck:!1,className:"flex-1 w-full p-4 bg-cc-bg text-cc-fg text-[13px] font-mono-code leading-relaxed resize-none focus:outline-none",placeholder:"File contents..."})]}),x&&l.jsx("div",{className:"shrink-0 px-4 py-2 bg-cc-error/10 border-t border-cc-error/20 text-xs text-cc-error",children:x})]})]})}function dz({item:e,cwd:t,onClose:n}){if(e.kind==="json"){const[r,a]=k.useState(null),[o,u]=k.useState(!0);return k.useEffect(()=>{Ne.readFile(e.path).then(h=>{a(h.content),u(!1)}).catch(()=>{a("Failed to read file"),u(!1)})},[e.path]),o?null:l.jsx(cz,{path:e.path,content:r||"",onClose:n})}return e.kind==="claude-md"?l.jsx(oz,{cwd:e.editorCwd||t,open:!0,onClose:n}):l.jsx(uz,{path:e.path,label:e.label,onClose:n})}function hz({sessionId:e}){const t=Y(w=>w.sessions.get(e)),n=Y(w=>w.sdkSessions.find(C=>C.sessionId===e)),r=(t==null?void 0:t.repo_root)||(t==null?void 0:t.cwd)||(n==null?void 0:n.cwd),[a,o]=k.useState(null),[u,h]=k.useState(!0),[f,p]=k.useState(!1),[m,x]=k.useState(!1),[b,y]=k.useState(null),_=k.useCallback(async()=>{if(r)try{const w=await Ne.getClaudeConfig(r);o(w)}catch{}finally{h(!1)}},[r]);if(k.useEffect(()=>{_()},[_]),!r)return null;if(u)return l.jsx("div",{className:"shrink-0 px-4 py-2.5",children:l.jsx("span",{className:"text-[11px] text-cc-muted",children:"Loading config..."})});if(!a)return null;const j=a.project.claudeMd.length+(a.project.settings?1:0)+(a.project.settingsLocal?1:0)+a.project.commands.length,N=(a.user.claudeMd?1:0)+a.user.skills.length+a.user.agents.length+(a.user.settings?1:0)+a.user.commands.length;return l.jsxs("div",{className:"shrink-0","data-testid":"claude-config-browser",children:[l.jsx(Z5,{icon:"project",title:`Project (${j})`,expanded:f,onToggle:()=>p(w=>!w)}),f&&l.jsxs("div",{className:"pb-1",children:[a.project.claudeMd.map(w=>l.jsx(Ys,{label:w.path.includes(".claude/")?".claude/CLAUDE.md":"CLAUDE.md",onClick:()=>y({label:"CLAUDE.md",path:w.path,kind:"claude-md"})},w.path)),a.project.settings&&l.jsx(Ys,{label:"settings.json",onClick:()=>y({label:"settings.json",path:a.project.settings.path,kind:"json"})}),a.project.settingsLocal&&l.jsx(Ys,{label:"settings.local.json",onClick:()=>y({label:"settings.local.json",path:a.project.settingsLocal.path,kind:"json"})}),a.project.commands.length>0&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"px-4 pl-10 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:["Commands (",a.project.commands.length,")"]}),a.project.commands.map(w=>l.jsx(Ys,{label:`/${w.name}`,onClick:()=>y({label:w.name,path:w.path,kind:"md"})},w.path))]}),j===0&&l.jsx("p",{className:"px-4 pl-10 py-1.5 text-[11px] text-cc-muted",children:"No .claude config found"})]}),l.jsx(Z5,{icon:"user",title:`User (${N})`,expanded:m,onToggle:()=>x(w=>!w)}),m&&l.jsxs("div",{className:"pb-1",children:[a.user.claudeMd&&l.jsx(Ys,{label:"CLAUDE.md",onClick:()=>y({label:"CLAUDE.md",path:a.user.claudeMd.path,kind:"claude-md",editorCwd:a.user.root})}),a.user.skills.length>0&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"px-4 pl-10 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:["Skills (",a.user.skills.length,")"]}),a.user.skills.map(w=>l.jsx(Ys,{label:w.name,sublabel:w.description?w.description.slice(0,40):void 0,onClick:()=>y({label:w.name,path:w.path,kind:"md"})},w.path))]}),a.user.agents.length>0&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"px-4 pl-10 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:["Agents (",a.user.agents.length,")"]}),a.user.agents.map(w=>l.jsx(Ys,{label:w.name,onClick:()=>y({label:w.name,path:w.path,kind:"md"})},w.path))]}),a.user.settings&&l.jsx(Ys,{label:"settings.json",onClick:()=>y({label:"settings.json",path:a.user.settings.path,kind:"json"})}),a.user.commands.length>0&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"px-4 pl-10 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:["Commands (",a.user.commands.length,")"]}),a.user.commands.map(w=>l.jsx(Ys,{label:`/${w.name}`,onClick:()=>y({label:w.name,path:w.path,kind:"md"})},w.path))]}),N===0&&l.jsx("p",{className:"px-4 pl-10 py-1.5 text-[11px] text-cc-muted",children:"No user config found"})]}),b&&so.createPortal(l.jsx(dz,{item:b,cwd:r,onClose:()=>y(null)}),document.body)]})}function fz(e){const t=Date.now()-e,n=Math.floor(t/6e4);if(n<1)return"just now";if(n<60)return`${n}m ago`;const r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}class pz extends k.Component{constructor(){super(...arguments);Hb(this,"state",{hasError:!1})}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(n){Yi(n,{section:this.props.label})}render(){return this.state.hasError?l.jsx("div",{className:"px-4 py-3 border-b border-cc-border",children:l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsx("span",{className:"text-xs text-cc-error",children:this.props.label?`${this.props.label} failed to load`:"Section failed to load"}),l.jsx("button",{className:"text-[10px] text-cc-muted hover:text-cc-fg px-2 py-0.5 rounded bg-cc-hover cursor-pointer",onClick:()=>this.setState({hasError:!1}),children:"Retry"})]})}):this.props.children}}const Ik=[],mv=3e4,mz=6e4,gz=5*6e4;let J5=null,ew=new Map;function xz(e){return e!==J5&&(J5=e,ew=new Map(e.map(t=>[t.sessionId,t]))),ew}function su(e){return Y(k.useCallback(t=>xz(t.sdkSessions).get(e),[e]))}const Hk="cc-panel-collapsed";function tw(){try{const e=localStorage.getItem(Hk);if(e)return new Set(JSON.parse(e))}catch{}return new Set}function vz(e){try{localStorage.setItem(Hk,JSON.stringify([...e]))}catch{}}function qk({id:e,label:t,badge:n,defaultOpen:r=!0,children:a}){const[o,u]=k.useState(()=>tw().has(e)?!0:!r),h=k.useRef(!0);k.useEffect(()=>{if(h.current){h.current=!1;return}const p=tw();o?p.add(e):p.delete(e),vz(p)},[o,e]);const f=k.useCallback(()=>{u(p=>!p)},[]);return l.jsxs("div",{className:"border-t border-cc-separator first:border-t-0",children:[l.jsxs("button",{onClick:f,"aria-expanded":!o,className:"w-full flex items-center gap-1.5 px-4 py-2 text-left hover:bg-cc-hover/50 transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":!0,className:`w-2.5 h-2.5 text-cc-muted/60 shrink-0 transition-transform duration-150 ${o?"":"rotate-90"}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx("span",{className:"text-[11px] font-semibold text-cc-muted uppercase tracking-wider flex-1 truncate",children:t}),n&&l.jsx("span",{className:"shrink-0",children:n})]}),l.jsx("div",{className:"accordion-panel","data-open":o?"false":"true",children:l.jsx("div",{className:"accordion-inner",children:a})})]})}function bz(){const[e,t]=k.useState(()=>localStorage.getItem("cc-user-name")||""),[n,r]=k.useState(()=>localStorage.getItem("cc-session-prefix")||"");return l.jsx(qk,{id:"identity",label:"Identity",children:l.jsxs("div",{className:"px-4 pb-3 pt-1 flex flex-col gap-3",children:[l.jsxs("label",{className:"flex flex-col gap-1",children:[l.jsx("span",{className:"text-[11px] font-medium text-cc-muted",children:"Your name"}),l.jsx("input",{type:"text",value:e,onChange:a=>{const o=a.target.value;t(o),localStorage.setItem("cc-user-name",o)},placeholder:"e.g. Moritz","aria-label":"Your name",className:"w-full px-2.5 py-1.5 text-[13px] bg-cc-input-bg border border-cc-border rounded-md focus:outline-none focus:border-cc-primary text-cc-fg placeholder:text-cc-muted/70"})]}),l.jsxs("label",{className:"flex flex-col gap-1",children:[l.jsxs("span",{className:"text-[11px] font-medium text-cc-muted",children:["Session prefix ",l.jsx("span",{className:"text-cc-muted/60",children:"(optional)"})]}),l.jsx("input",{type:"text",value:n,onChange:a=>{const o=a.target.value;r(o),localStorage.setItem("cc-session-prefix",o)},placeholder:"e.g. MA","aria-label":"Session prefix",className:"w-full px-2.5 py-1.5 text-[13px] bg-cc-input-bg border border-cc-border rounded-md focus:outline-none focus:border-cc-primary text-cc-fg placeholder:text-cc-muted/70"})]}),l.jsxs("p",{className:"text-[10px] text-cc-muted/70 leading-snug",children:["Applied to new sessions: your name prefixes the first message as"," ",l.jsx("span",{className:"font-mono-code",children:"[Name]:"})," and the prefix names sessions ",l.jsx("span",{className:"font-mono-code",children:"prefix_Name"}),"."]})]})})}function Vk(e){return e>80?"bg-cc-error":e>50?"bg-cc-warning":"bg-cc-primary"}function Gk(e){return e>80?"critical":e>50?"elevated":"normal"}function si({label:e,pct:t,detail:n}){return l.jsxs("div",{className:"space-y-1",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[11px] text-cc-muted uppercase tracking-wider",children:e}),l.jsxs("span",{className:"text-[11px] text-cc-muted tabular-nums",children:[Math.round(t),"%",n&&l.jsxs("span",{className:"ml-1 text-cc-muted",children:["(",n,")"]})]})]}),l.jsx("div",{role:"meter","aria-label":`${e} usage — ${Gk(t)}`,"aria-valuenow":Math.round(t),"aria-valuemin":0,"aria-valuemax":100,className:"w-full h-1.5 rounded-full bg-cc-hover overflow-hidden",children:l.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${Vk(t)}`,style:{width:`${Math.min(t,100)}%`}})})]})}function yz({sessionId:e}){var f;const[t,n]=k.useState(null),r=k.useCallback(async()=>{try{const p=await Ne.getSessionUsageLimits(e);n(p)}catch{}},[e]),a=k.useRef(0);if(k.useEffect(()=>{r();const p=setInterval(()=>{a.current+=1,a.current%2===0?r():n(m=>m?{...m}:null)},mv);return()=>clearInterval(p)},[r]),!t)return null;const o=t.five_hour!==null,u=t.seven_day!==null,h=!o&&!u&&((f=t.extra_usage)==null?void 0:f.is_enabled);return!o&&!u&&!h?null:l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2",children:[t.five_hour&&l.jsx(si,{label:"5h Limit",pct:t.five_hour.utilization,detail:t.five_hour.resets_at?P5(t.five_hour.resets_at):void 0}),t.seven_day&&l.jsx(si,{label:"7d Limit",pct:t.seven_day.utilization,detail:t.seven_day.resets_at?P5(t.seven_day.resets_at):void 0}),h&&t.extra_usage&&l.jsxs("div",{className:"space-y-1",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[11px] text-cc-muted uppercase tracking-wider",children:"Extra"}),l.jsxs("span",{className:"text-[11px] text-cc-muted tabular-nums",children:["$",t.extra_usage.used_credits.toFixed(2)," / $",t.extra_usage.monthly_limit]})]}),t.extra_usage.utilization!==null&&l.jsx("div",{role:"meter","aria-label":`Extra usage — ${Gk(t.extra_usage.utilization)}`,"aria-valuenow":Math.round(t.extra_usage.utilization),"aria-valuemin":0,"aria-valuemax":100,className:"w-full h-1.5 rounded-full bg-cc-hover overflow-hidden",children:l.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${Vk(t.extra_usage.utilization)}`,style:{width:`${Math.min(t.extra_usage.utilization,100)}%`}})})]})]})}function qd(e){const t=e/1073741824;return t>=1?`${t.toFixed(1)} GB`:`${Math.round(e/1024**2)} MB`}function _z(e){const[t,n]=k.useState(null);return k.useEffect(()=>{let r=!1;const a=async()=>{try{const u=await Ne.getSystemMemory();r||n(u)}catch{}};a();const o=setInterval(a,mz);return()=>{r=!0,clearInterval(o)}},[]),t?l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2",children:[l.jsx(si,{label:"Memory",pct:t.used_percent,detail:`${qd(t.used_bytes)} / ${qd(t.total_bytes)}`}),t.swap_total_bytes>0&&l.jsx(si,{label:"Swap",pct:t.swap_used_percent,detail:`${qd(t.swap_used_bytes)} / ${qd(t.swap_total_bytes)}`})]}):null}function wz(e){const t=e/1099511627776;if(t>=1)return`${t.toFixed(1)} TB`;const n=e/1024**3;return n>=1?`${n.toFixed(1)} GB`:`${Math.round(e/1024**2)} MB`}function Sz(e){const[t,n]=k.useState(null);return k.useEffect(()=>{let r=!1;const a=async()=>{try{const u=await Ne.getSystemDisk();r||n(u)}catch{}};a();const o=setInterval(a,gz);return()=>{r=!0,clearInterval(o)}},[]),t?l.jsx("div",{className:"shrink-0 px-4 py-2.5",children:l.jsx(si,{label:"Disk",pct:t.used_percent,detail:`${wz(t.available_bytes)} free`})}):null}function kz({sessionId:e}){const t=Y(o=>{var u;return(u=o.sessions.get(e))==null?void 0:u.codex_rate_limits}),[,n]=k.useState(0);if(k.useEffect(()=>{if(!t)return;const o=setInterval(()=>n(u=>u+1),mv);return()=>clearInterval(o)},[t]),!t)return null;const{primary:r,secondary:a}=t;return!r&&!a?null:l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2",children:[r&&l.jsx(si,{label:`${$5(r.windowDurationMins)} Limit`,pct:r.usedPercent,detail:r.resetsAt>0?bx(r.resetsAt):void 0}),a&&l.jsx(si,{label:`${$5(a.windowDurationMins)} Limit`,pct:a.usedPercent,detail:a.resetsAt>0?bx(a.resetsAt):void 0})]})}function jz({sessionId:e}){const t=Y(r=>{var a;return(a=r.sessions.get(e))==null?void 0:a.codex_token_details}),n=Y(r=>{var a;return((a=r.sessions.get(e))==null?void 0:a.context_used_percent)??0});return t?l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2",children:[l.jsx("span",{className:"text-[11px] text-cc-muted uppercase tracking-wider",children:"Tokens"}),l.jsxs("div",{className:"grid grid-cols-2 gap-x-3 gap-y-1",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[11px] text-cc-muted",children:"Input"}),l.jsx("span",{className:"text-[11px] text-cc-fg tabular-nums font-medium",children:jc(t.inputTokens)})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[11px] text-cc-muted",children:"Output"}),l.jsx("span",{className:"text-[11px] text-cc-fg tabular-nums font-medium",children:jc(t.outputTokens)})]}),t.cachedInputTokens>0&&l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[11px] text-cc-muted",children:"Cached"}),l.jsx("span",{className:"text-[11px] text-cc-fg tabular-nums font-medium",children:jc(t.cachedInputTokens)})]}),t.reasoningOutputTokens>0&&l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[11px] text-cc-muted",children:"Reasoning"}),l.jsx("span",{className:"text-[11px] text-cc-fg tabular-nums font-medium",children:jc(t.reasoningOutputTokens)})]})]}),t.modelContextWindow>0&&l.jsx(si,{label:"Context",pct:n})]}):null}function Nz(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 Cz({pr:e}){const t=Nz(e.state,e.isDraft),{checksSummary:n,reviewThreads:r}=e;return l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-1.5",children:[l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsxs("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-[12px] font-semibold text-cc-fg hover:text-cc-primary transition-colors",children:["PR #",e.number]}),l.jsx("span",{className:`text-[9px] font-medium px-1.5 rounded-full leading-[16px] ${t.cls}`,children:t.label})]}),l.jsx("p",{className:"text-[11px] text-cc-muted truncate",title:e.title,children:e.title}),n.total>0&&l.jsx("div",{className:"flex items-center gap-2 text-[11px]","aria-label":`CI checks: ${n.success} passed, ${n.failure} failing, ${n.pending} pending`,children:n.failure>0?l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:"flex items-center gap-1 text-cc-error",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M3.72 3.72a.75.75 0 011.06 0L8 6.94l3.22-3.22a.75.75 0 111.06 1.06L9.06 8l3.22 3.22a.75.75 0 11-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 01-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 010-1.06z"})}),n.failure," failing"]}),n.success>0&&l.jsxs("span",{className:"flex items-center gap-1 text-cc-success",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{fillRule:"evenodd",d:"M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z",clipRule:"evenodd"})}),n.success," passed"]})]}):n.pending>0?l.jsxs("span",{className:"flex items-center gap-1 text-cc-warning",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 animate-spin",children:[l.jsx("path",{d:"M8 2a6 6 0 100 12A6 6 0 008 2zM0 8a8 8 0 1116 0A8 8 0 010 8z",opacity:".2"}),l.jsx("path",{d:"M8 0a8 8 0 018 8h-2A6 6 0 008 2V0z"})]}),n.pending," pending",n.success>0&&l.jsxs("span",{className:"text-cc-success ml-1",children:[n.success," passed"]})]}):l.jsxs("span",{className:"flex items-center gap-1 text-cc-success",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{fillRule:"evenodd",d:"M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z",clipRule:"evenodd"})}),n.total,"/",n.total," checks passed"]})}),l.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[e.reviewDecision==="APPROVED"&&l.jsxs("span",{className:"flex items-center gap-1 text-cc-success",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{fillRule:"evenodd",d:"M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z",clipRule:"evenodd"})}),"Approved"]}),e.reviewDecision==="CHANGES_REQUESTED"&&l.jsxs("span",{className:"flex items-center gap-1 text-cc-error",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{fillRule:"evenodd",d:"M8 1.5a6.5 6.5 0 100 13 6.5 6.5 0 000-13zM0 8a8 8 0 1116 0A8 8 0 010 8zm9-3a1 1 0 11-2 0 1 1 0 012 0zM8 7a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 018 7z",clipRule:"evenodd"})}),"Changes requested"]}),(e.reviewDecision==="REVIEW_REQUIRED"||e.reviewDecision===null)&&e.state==="OPEN"&&l.jsxs("span",{className:"flex items-center gap-1 text-cc-muted",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:l.jsx("circle",{cx:"8",cy:"8",r:"6"})}),"Review pending"]}),r.unresolved>0&&l.jsxs("span",{className:"flex items-center gap-1 text-cc-warning",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M2.5 2A1.5 1.5 0 001 3.5v8A1.5 1.5 0 002.5 13h2v2.5l3.5-2.5h5.5a1.5 1.5 0 001.5-1.5v-8A1.5 1.5 0 0013.5 2h-11z"})}),r.unresolved," unresolved"]})]}),l.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-cc-muted",children:[l.jsxs("span",{className:"text-cc-success",children:["+",e.additions]}),l.jsxs("span",{className:"text-cc-error",children:["-",e.deletions]}),l.jsxs("span",{children:["· ",e.changedFiles," files"]})]})]})}function Ez({sessionId:e}){const t=Y(u=>u.sessions.get(e)),n=su(e),r=Y(u=>u.prStatus.get(e)),a=(t==null?void 0:t.cwd)||(n==null?void 0:n.cwd),o=(t==null?void 0:t.git_branch)||(n==null?void 0:n.gitBranch);return k.useEffect(()=>{r||!a||!o||Ne.getPRStatus(a,o).then(u=>{Y.getState().setPRStatus(e,u)}).catch(()=>{})},[e,a,o,r]),!(r!=null&&r.available)||!r.pr?null:l.jsx(Cz,{pr:r.pr})}const Az=6e4;function og(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 Tz({sessionId:e}){const t=Y(A=>A.linkedLinearIssues.get(e)),[n,r]=k.useState([]),[a,o]=k.useState(null),[u,h]=k.useState([]),[f,p]=k.useState(""),[m,x]=k.useState(!1),[b,y]=k.useState(!1),[_,j]=k.useState(!1),[N,w]=k.useState(""),[C,E]=k.useState([]),[R,L]=k.useState(!1),O=k.useRef(null);k.useEffect(()=>{Ne.getLinkedLinearIssue(e).then(A=>{A.issue&&Y.getState().setLinkedLinearIssue(e,A.issue)}).catch(()=>{})},[e]);const q=k.useCallback(async()=>{if(t)try{const A=await Ne.getLinkedLinearIssue(e,!0);A.issue&&(Y.getState().setLinkedLinearIssue(e,A.issue),A.issue.stateType==="completed"&&y(!0)),A.comments&&r(A.comments),A.assignee!==void 0&&o(A.assignee??null),A.labels&&h(A.labels)}catch{}},[e,t]);k.useEffect(()=>{if(!t)return;q();const A=setInterval(q,Az);return()=>clearInterval(A)},[q,t]),k.useEffect(()=>{if(!_)return;const A=N.trim();if(A.length<2){E([]);return}let X=!0;L(!0);const Z=setTimeout(()=>{Ne.searchLinearIssues(A,6).then(G=>{X&&E(G.issues)}).catch(()=>{X&&E([])}).finally(()=>{X&&L(!1)})},400);return()=>{X=!1,clearTimeout(Z)}},[N,_]),k.useEffect(()=>{_&&setTimeout(()=>{var A;return(A=O.current)==null?void 0:A.focus()},50)},[_]);async function F(){if(!(!t||!f.trim()||m)){x(!0);try{const A=await Ne.addLinearComment(t.id,f.trim());r(X=>[...X,A.comment]),p("")}catch{}finally{x(!1)}}}async function W(){try{await Ne.unlinkLinearIssue(e),Y.getState().setLinkedLinearIssue(e,null),r([]),o(null),h([]),y(!1)}catch{}}async function z(A){try{await Ne.linkLinearIssue(e,A),Y.getState().setLinkedLinearIssue(e,A),j(!1),w(""),E([])}catch{}}if(!t)return l.jsx("div",{className:"shrink-0 px-4 py-2.5",children:_?l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx(Bc,{className:"w-3.5 h-3.5 text-cc-muted shrink-0"}),l.jsx("input",{ref:O,type:"text",value:N,onChange:A=>w(A.target.value),placeholder:"Search issues...","aria-label":"Search Linear issues",className:"flex-1 text-[11px] bg-transparent border border-cc-border rounded-md px-2 py-1.5 text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/50"}),l.jsx("button",{onClick:()=>{j(!1),w(""),E([])},"aria-label":"Close search",className:"w-7 h-7 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})})]}),R&&l.jsx("p",{className:"text-[10px] text-cc-muted",children:"Searching..."}),C.length>0&&l.jsx("div",{className:"space-y-0.5 max-h-48 overflow-y-auto",children:C.map(A=>l.jsxs("button",{onClick:()=>z(A),className:"w-full text-left px-2 py-1.5 rounded-md hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx("span",{className:"text-[11px] font-mono-code text-cc-primary shrink-0",children:A.identifier}),l.jsx("span",{className:`text-[9px] font-medium px-1 rounded-full leading-[14px] ${og(A.stateType,A.stateName).cls}`,children:og(A.stateType,A.stateName).label})]}),l.jsx("p",{className:"text-[11px] text-cc-muted truncate mt-0.5",children:A.title})]},A.id))}),N.trim().length>=2&&!R&&C.length===0&&l.jsx("p",{className:"text-[10px] text-cc-muted text-center py-2",children:"No issues found"})]}):l.jsxs("button",{onClick:()=>j(!0),className:"flex items-center gap-1.5 text-[11px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:[l.jsx(Bc,{className:"w-3.5 h-3.5"}),"Link Linear issue"]})});const I=og(t.stateType,t.stateName);return l.jsxs("div",{className:"shrink-0",children:[l.jsxs("div",{className:"px-4 py-2.5 space-y-1.5",children:[l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx(Bc,{className:"w-3.5 h-3.5 text-cc-muted shrink-0"}),l.jsx("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:"text-[12px] font-semibold text-cc-fg hover:text-cc-primary transition-colors font-mono-code",children:t.identifier}),l.jsx("span",{className:`text-[9px] font-medium px-1.5 rounded-full leading-[16px] ${I.cls}`,children:I.label}),l.jsx("button",{onClick:W,className:"ml-auto flex items-center justify-center w-7 h-7 rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:"Unlink issue","aria-label":"Unlink issue",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})})]}),l.jsx("p",{className:"text-[11px] text-cc-muted truncate",title:t.title,children:t.title}),l.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-cc-muted",children:[t.priorityLabel&&l.jsx("span",{children:t.priorityLabel}),t.teamName&&l.jsxs(l.Fragment,{children:[t.priorityLabel&&l.jsx("span",{children:"·"}),l.jsx("span",{children:t.teamName})]}),a&&l.jsxs(l.Fragment,{children:[l.jsx("span",{children:"·"}),l.jsxs("span",{children:["@ ",a.name]})]})]}),u.length>0&&l.jsx("div",{className:"flex flex-wrap gap-1",children:u.map(A=>l.jsx("span",{className:"text-[9px] px-1.5 py-0.5 rounded-full",style:{backgroundColor:`${A.color}20`,color:A.color},children:A.name},A.id))})]}),b&&t.stateType==="completed"&&l.jsxs("div",{className:"px-4 py-2 bg-cc-success/10 border-t border-cc-success/20 flex items-center justify-between gap-2",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("p",{className:"text-[11px] text-cc-success font-medium",children:"Issue completed"}),l.jsx("p",{className:"text-[10px] text-cc-success/80",children:"Ticket moved to done."})]}),l.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[l.jsx("button",{onClick:()=>y(!1),className:"text-[10px] text-cc-muted hover:text-cc-fg px-1.5 py-0.5 rounded cursor-pointer",children:"Dismiss"}),l.jsx("button",{onClick:async()=>{try{await Ne.archiveSession(e),Y.getState().newSession()}catch{}},className:"text-[10px] text-cc-success font-medium px-2 py-0.5 rounded bg-cc-success/20 hover:bg-cc-success/30 cursor-pointer",children:"Close session"})]})]}),n.length>0&&l.jsxs("div",{className:"px-4 py-2 space-y-1.5 max-h-36 overflow-y-auto",children:[l.jsx("span",{className:"text-[10px] text-cc-muted uppercase tracking-wider",children:"Comments"}),n.slice(-3).map(A=>l.jsxs("div",{className:"text-[11px]",children:[l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("span",{className:"font-medium text-cc-fg",children:A.userName}),l.jsx("span",{className:"text-[9px] text-cc-muted",children:fz(new Date(A.createdAt).getTime())})]}),l.jsx("p",{className:"text-cc-muted line-clamp-2",children:A.body})]},A.id))]}),l.jsxs("div",{className:"px-4 py-2 flex items-center gap-1.5",children:[l.jsx("input",{type:"text",value:f,onChange:A=>p(A.target.value),onKeyDown:A=>{A.key==="Enter"&&!A.shiftKey&&(A.preventDefault(),F())},placeholder:"Add a comment...","aria-label":"Add a comment",className:"flex-1 text-[11px] bg-transparent border border-cc-border rounded-md px-2 py-1.5 text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/50"}),l.jsx("button",{onClick:F,disabled:!f.trim()||m,"aria-label":"Send comment",className:"flex items-center justify-center w-7 h-7 rounded-md text-cc-primary disabled:text-cc-muted cursor-pointer disabled:cursor-not-allowed transition-colors",title:"Send comment",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M1.724 1.053a.5.5 0 0 0-.714.545l1.403 4.85a.5.5 0 0 0 .397.354l5.19.736-5.19.737a.5.5 0 0 0-.397.353L1.01 13.48a.5.5 0 0 0 .714.545l13-6.5a.5.5 0 0 0 0-.894l-13-6.5z"})})})]})]})}function Mz({sessionId:e}){const t=Y(u=>u.rateLimit.get(e)),[,n]=k.useState(0);if(k.useEffect(()=>{if(!t)return;const u=setInterval(()=>n(h=>h+1),mv);return()=>clearInterval(u)},[t]),!(t!=null&&t.status)||t.status==="allowed")return null;const r=t.status==="rejected",a=typeof t.utilization=="number"?t.utilization*100:void 0,o=typeof t.resetsAt=="number"&&t.resetsAt>0?bx(t.resetsAt):void 0;return l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-2","data-testid":"claude-rate-limit",children:[a!==void 0?l.jsx(si,{label:t.rateLimitType==="five_hour"?"5h Limit":"Plan Limit",pct:a,detail:o}):l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-[11px] text-cc-muted uppercase tracking-wider",children:"Plan Limit"}),l.jsxs("span",{className:`text-[11px] tabular-nums ${r?"text-cc-error":"text-cc-warning"}`,children:[r?"rate limited":t.status,o&&` · resets ${o}`]})]}),r&&l.jsxs("p",{className:"text-[11px] text-cc-error",children:["The API is refusing requests for this plan window",o?` — resets in ${o}.`:"."]})]})}function Dz({sessionId:e}){const t=Y(a=>a.sessions.get(e)),n=su(e);return((t==null?void 0:t.backend_type)||(n==null?void 0:n.backendType))==="codex"?l.jsxs(l.Fragment,{children:[l.jsx(kz,{sessionId:e}),l.jsx(jz,{sessionId:e})]}):l.jsxs(l.Fragment,{children:[l.jsx(Mz,{sessionId:e}),l.jsx(yz,{sessionId:e})]})}function Lz({sessionId:e}){const t=Y(p=>p.sessions.get(e)),n=su(e),r=(t==null?void 0:t.git_branch)||(n==null?void 0:n.gitBranch),a=(t==null?void 0:t.git_ahead)||0,o=(t==null?void 0:t.git_behind)||0,u=(t==null?void 0:t.total_lines_added)||0,h=(t==null?void 0:t.total_lines_removed)||0,f=(t==null?void 0:t.repo_root)||(t==null?void 0:t.cwd)||(n==null?void 0:n.cwd);return r?l.jsxs("div",{className:"shrink-0 px-4 py-2.5 space-y-1.5",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("p",{className:"text-xs font-mono-code text-cc-fg truncate",title:r,children:r}),(t==null?void 0:t.is_containerized)&&l.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-cc-info/10 text-cc-info shrink-0 ml-2",children:"container"})]}),(a>0||o>0||u>0||h>0)&&l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsxs("div",{className:"flex items-center gap-1.5 text-[11px]",children:[a>0&&l.jsxs("span",{className:"text-cc-success",children:[a,"↑",l.jsx("span",{className:"sr-only",children:" commits ahead"})]}),o>0&&l.jsxs("span",{className:"text-cc-warning",children:[o,"↓",l.jsx("span",{className:"sr-only",children:" commits behind"})]}),u>0&&l.jsxs("span",{className:"text-cc-success",children:["+",u,l.jsx("span",{className:"sr-only",children:" lines added"})]}),h>0&&l.jsxs("span",{className:"text-cc-error",children:["-",h,l.jsx("span",{className:"sr-only",children:" lines removed"})]})]}),o>0&&f&&l.jsx("button",{type:"button",className:"text-[11px] font-medium text-cc-warning hover:text-cc-warning/80 transition-colors cursor-pointer",onClick:()=>{Ne.gitPull(f).then(p=>{Y.getState().updateSession(e,{git_ahead:p.git_ahead,git_behind:p.git_behind}),p.success||Yi(new Error(`git pull failed: ${p.output}`))}).catch(p=>Yi(p))},title:"Pull latest changes",children:"Pull"})]})]}):null}function Rz({sessionId:e}){const t=Y(o=>o.sessionTasks.get(e)||Ik),n=Y(o=>o.sessions.get(e)),r=su(e),a=((n==null?void 0:n.backend_type)||(r==null?void 0:r.backendType))==="codex";return!n||a?null:l.jsx("div",{className:"px-3 py-2",children:t.length===0?l.jsx("p",{className:"text-[11px] text-cc-muted text-center py-6",children:"Tasks will appear here as the agent works"}):l.jsx("div",{className:"space-y-0.5",children:t.map(o=>l.jsx(Fz,{task:o},o.id))})})}const zz={"usage-limits":Dz,"server-memory":_z,"server-disk":Sz,"git-branch":Lz,"github-pr":Ez,"linear-issue":Tz,"mcp-servers":lz,tasks:Rz};function Oz(e,t){const n=Y(r=>r.sessionTasks.get(t)||Ik);if(e==="tasks"&&n.length>0){const r=n.filter(a=>a.status==="completed").length;return l.jsxs("span",{className:"text-[10px] text-cc-muted tabular-nums",children:[r,"/",n.length]})}return null}function Bz({isCodex:e}){const t=Y(p=>p.taskPanelConfig),n=Y(p=>p.toggleSectionEnabled),r=Y(p=>p.moveSectionUp),a=Y(p=>p.moveSectionDown),o=Y(p=>p.resetTaskPanelConfig),u=Y(p=>p.setTaskPanelConfigMode),h=e?"codex":"claude",f=t.order.filter(p=>{const m=ri.find(x=>x.id===p);return!(!m||m.backends&&!m.backends.includes(h))});return l.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[l.jsx("div",{className:"flex-1 overflow-y-auto px-3 py-3 space-y-1",children:f.map((p,m)=>{const x=ri.find(j=>j.id===p),b=t.enabled[p]??!0,y=m===0,_=m===f.length-1;return l.jsxs("div",{"data-testid":`config-section-${p}`,className:`flex items-center gap-2 px-2.5 py-2 rounded-lg border border-cc-border transition-opacity ${b?"bg-cc-bg":"bg-cc-hover/50 opacity-60"}`,children:[l.jsxs("div",{className:"flex flex-col gap-0.5 shrink-0",children:[l.jsx("button",{onClick:()=>r(p),disabled:y,className:"w-5 h-4 flex items-center justify-center text-cc-muted hover:text-cc-fg disabled:opacity-20 disabled:cursor-not-allowed cursor-pointer transition-colors",title:"Move up","data-testid":`move-up-${p}`,children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M8 4l4 4H4l4-4z"})})}),l.jsx("button",{onClick:()=>a(p),disabled:_,className:"w-5 h-4 flex items-center justify-center text-cc-muted hover:text-cc-fg disabled:opacity-20 disabled:cursor-not-allowed cursor-pointer transition-colors",title:"Move down","data-testid":`move-down-${p}`,children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M8 12l4-4H4l4 4z"})})})]}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("span",{className:"text-[12px] font-medium text-cc-fg block",children:x.label}),l.jsx("span",{className:"text-[10px] text-cc-muted block truncate",children:x.description})]}),l.jsx("button",{onClick:()=>n(p),className:`shrink-0 w-8 h-[18px] rounded-full transition-colors cursor-pointer relative ${b?"bg-cc-primary":"bg-cc-hover"}`,title:b?"Hide section":"Show section",role:"switch","aria-checked":b,"data-testid":`toggle-${p}`,children:l.jsx("span",{className:`absolute top-[2px] left-0 w-[14px] h-[14px] rounded-full bg-white shadow transition-transform ${b?"translate-x-[16px]":"translate-x-[2px]"}`})})]},p)})}),l.jsxs("div",{className:"shrink-0 px-3 py-2.5 flex items-center justify-between border-t border-cc-separator",children:[l.jsx("button",{onClick:()=>o(),className:"text-[11px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer","data-testid":"reset-panel-config",children:"Reset to defaults"}),l.jsx("button",{onClick:()=>u(!1),className:"text-[11px] font-medium text-cc-primary hover:text-cc-primary-hover transition-colors cursor-pointer","data-testid":"config-done",children:"Done"})]})]})}function Pz({sectionId:e,sessionId:t,children:n}){var o;const r=((o=ri.find(u=>u.id===e))==null?void 0:o.label)??e,a=Oz(e,t);return l.jsx(qk,{id:e,label:r,badge:a,children:n})}function $z({sessionId:e}){const t=Y(m=>m.sessions.get(e)),n=su(e),r=Y(m=>m.taskPanelOpen),a=Y(m=>m.setTaskPanelOpen),o=Y(m=>m.taskPanelConfigMode),u=Y(m=>m.taskPanelConfig);if(!r)return null;const h=((t==null?void 0:t.backend_type)||(n==null?void 0:n.backendType))==="codex",f=h?"codex":"claude",p=u.order.filter(m=>{const x=ri.find(b=>b.id===m);return!(!x||x.backends&&!x.backends.includes(f))});return l.jsxs("aside",{"aria-label":"Session context",className:"w-full lg:w-[320px] h-full flex flex-col overflow-hidden bg-cc-card",children:[l.jsxs("div",{className:"shrink-0 h-11 flex items-center justify-between px-4 bg-cc-card border-b border-cc-separator",children:[l.jsx("h2",{className:"text-sm font-semibold text-cc-fg tracking-tight",children:o?"Panel Settings":"Context"}),l.jsx("button",{onClick:()=>{o?Y.getState().setTaskPanelConfigMode(!1):a(!1)},"aria-label":"Close panel",className:"flex items-center justify-center w-8 h-8 rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})})]}),o?l.jsx(Bz,{isCodex:h}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{"data-testid":"task-panel-content",className:"min-h-0 flex-1 overflow-y-auto",children:[l.jsx(bz,{}),l.jsx(hz,{sessionId:e}),p.filter(m=>u.enabled[m]!==!1).map(m=>{var b;const x=zz[m];return x?l.jsx(Pz,{sectionId:m,sessionId:e,children:l.jsx(pz,{label:(b=ri.find(y=>y.id===m))==null?void 0:b.label,children:l.jsx(x,{sessionId:e})})},m):null})]}),l.jsx("div",{className:"shrink-0 px-4 py-2 pb-safe border-t border-cc-separator",children:l.jsxs("button",{onClick:()=>Y.getState().setTaskPanelConfigMode(!0),className:"flex items-center gap-1.5 text-[11px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",title:"Configure panel sections","data-testid":"customize-panel-btn",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{fillRule:"evenodd",d:"M7.429 1.525a6.593 6.593 0 011.142 0c.036.003.108.036.137.146l.289 1.105c.147.56.55.967.997 1.189.174.086.341.183.501.29.417.278.97.423 1.53.27l1.102-.303c.11-.03.175.016.195.046.219.31.41.641.573.989.014.031.022.11-.059.19l-.815.806c-.411.406-.562.957-.53 1.456a4.588 4.588 0 010 .582c-.032.499.119 1.05.53 1.456l.815.806c.08.08.073.159.059.19a6.494 6.494 0 01-.573.99c-.02.029-.086.074-.195.045l-1.103-.303c-.559-.153-1.112-.008-1.529.27-.16.107-.327.204-.5.29-.449.222-.851.628-.998 1.189l-.289 1.105c-.029.11-.101.143-.137.146a6.613 6.613 0 01-1.142 0c-.036-.003-.108-.037-.137-.146l-.289-1.105c-.147-.56-.55-.967-.997-1.189a4.502 4.502 0 01-.501-.29c-.417-.278-.97-.423-1.53-.27l-1.102.303c-.11.03-.175-.016-.195-.046a6.492 6.492 0 01-.573-.989c-.014-.031-.022-.11.059-.19l.815-.806c.411-.406.562-.957.53-1.456a4.587 4.587 0 010-.582c.032-.499-.119-1.05-.53-1.456l-.815-.806c-.08-.08-.073-.159-.059-.19a6.44 6.44 0 01.573-.99c.02-.029.086-.074.195-.045l1.103.303c.559.153 1.112.008 1.529-.27.16-.107.327-.204.5-.29.449-.222.851-.628.998-1.189l.289-1.105c.029-.11.101-.143.137-.146zM8 10.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5z",clipRule:"evenodd"})}),"Customize panel"]})})]})]})}function Fz({task:e}){const t=e.status==="completed",n=e.status==="in_progress";return l.jsxs("div",{className:`px-2.5 py-2 rounded-lg ${t?"opacity-50":""}`,children:[l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsxs("span",{className:"shrink-0 flex items-center justify-center w-4 h-4 mt-px",children:[n?l.jsx("svg",{className:"w-4 h-4 text-cc-primary animate-spin",viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:l.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"28",strokeDashoffset:"8",strokeLinecap:"round"})}):t?l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-cc-success","aria-hidden":!0,children:l.jsx("path",{fillRule:"evenodd",d:"M8 15A7 7 0 108 1a7 7 0 000 14zm3.354-9.354a.5.5 0 00-.708-.708L7 8.586 5.354 6.94a.5.5 0 10-.708.708l2 2a.5.5 0 00.708 0l4-4z",clipRule:"evenodd"})}):l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-4 h-4 text-cc-muted","aria-hidden":!0,children:l.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"})}),l.jsx("span",{className:"sr-only",children:n?"In progress":t?"Completed":"Pending"})]}),l.jsx("span",{className:`text-[13px] leading-snug flex-1 ${t?"text-cc-muted line-through":"text-cc-fg"}`,children:e.subject})]}),n&&e.activeForm&&l.jsx("p",{className:"mt-1 ml-6 text-[11px] text-cc-muted italic truncate",children:e.activeForm}),e.blockedBy&&e.blockedBy.length>0&&l.jsxs("p",{className:"mt-1 ml-6 text-[11px] text-cc-muted flex items-center gap-1",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3 h-3 shrink-0","aria-hidden":!0,children:[l.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),l.jsx("path",{d:"M5 8h6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),l.jsxs("span",{children:["blocked by ",e.blockedBy.map(r=>`#${r}`).join(", ")]})]})]})}function Uz({status:e}){return e==="created"?l.jsx("span",{className:"w-3.5 h-3.5 shrink-0 flex items-center justify-center rounded-sm text-[10px] font-bold leading-none bg-green-500/20 text-green-400",children:"A"}):e==="deleted"?l.jsx("span",{className:"w-3.5 h-3.5 shrink-0 flex items-center justify-center rounded-sm text-[10px] font-bold leading-none bg-red-500/20 text-red-400",children:"D"}):l.jsx("span",{className:"w-3.5 h-3.5 shrink-0 flex items-center justify-center rounded-sm text-[10px] font-bold leading-none bg-cc-warning/20 text-cc-warning",children:"M"})}function Iz({sessionId:e}){const t=Y(L=>L.sessions.get(e)),n=Y(L=>L.sdkSessions.find(O=>O.sessionId===e)),r=Y(L=>L.diffPanelSelectedFile.get(e)??null),a=Y(L=>L.setDiffPanelSelectedFile),o=Y(L=>L.diffBase),u=Y(L=>L.setDiffBase),h=Y(L=>L.changedFilesTick.get(e)??0),f=(t==null?void 0:t.cwd)||(n==null?void 0:n.cwd),[p,m]=k.useState(""),[x,b]=k.useState(!1),[y,_]=k.useState(()=>typeof window<"u"?window.innerWidth>=640:!0),[j,N]=k.useState([]),w=Y(L=>L.setGitChangedFilesCount);k.useEffect(()=>{if(!f)return;let L=!1;return Ne.getChangedFiles(f,o).then(({files:O})=>{if(L)return;const q=`${f}/`,F=O.filter(W=>W.path===f||W.path.startsWith(q)).map(W=>({abs:W.path,rel:W.path.startsWith(q)?W.path.slice(q.length):W.path,status:W.status==="A"||W.status==="?"?"created":W.status==="D"?"deleted":"updated"})).sort((W,z)=>W.rel.localeCompare(z.rel));N(F),w(e,F.length)}).catch(()=>{L||(N([]),w(e,0))}),()=>{L=!0}},[f,o,h,e,w]);const C=j;k.useEffect(()=>{!r&&C.length>0&&a(e,C[0].abs)},[r,C,e,a]),k.useEffect(()=>{var L;r&&(C.some(O=>O.abs===r)||a(e,((L=C[0])==null?void 0:L.abs)??null))},[r,C,e,a]),k.useEffect(()=>{if(!r){m("");return}let L=!1;return b(!0),Ne.getFileDiff(r,o).then(O=>{L||(m(O.diff),b(!1))}).catch(()=>{L||(m(""),b(!1))}),()=>{L=!0}},[r,o]);const E=k.useCallback(L=>{a(e,L),typeof window<"u"&&window.innerWidth<640&&_(!1)},[e,a]),R=k.useMemo(()=>!r||!f?r:r.startsWith(f+"/")?r.slice(f.length+1):r,[r,f]);return f?C.length===0?l.jsxs("div",{className:"h-full flex flex-col items-center justify-center gap-4 select-none px-6",children:[l.jsx("div",{className:"w-14 h-14 rounded-2xl bg-cc-card border border-cc-border flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-7 h-7 text-cc-muted",children:l.jsx("path",{d:"M12 3v18M3 12h18",strokeLinecap:"round"})})}),l.jsxs("div",{className:"text-center",children:[l.jsx("p",{className:"text-sm text-cc-fg font-medium mb-1",children:"No changes yet"}),l.jsx("p",{className:"text-xs text-cc-muted leading-relaxed",children:"File changes compared to the base will appear here once the agent edits files."})]})]}):l.jsxs("div",{className:"h-full flex bg-cc-bg relative",children:[y&&l.jsx("div",{className:"fixed inset-0 bg-black/30 z-20 sm:hidden",onClick:()=>_(!1)}),l.jsxs("div",{className:`
122
+ ${y?"w-[220px] translate-x-0":"w-0 -translate-x-full"}
123
+ fixed sm:relative z-30 sm:z-auto
124
+ ${y?"sm:w-[220px]":"sm:w-0 sm:-translate-x-full"}
125
+ shrink-0 h-full flex flex-col bg-cc-sidebar border-r border-cc-border transition-all duration-200 overflow-hidden
126
+ `,children:[l.jsxs("div",{className:"w-[220px] px-4 py-3 text-[11px] font-semibold text-cc-fg uppercase tracking-wider border-b border-cc-border shrink-0 flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-warning"}),l.jsxs("span",{children:["Changed (",C.length,")"]})]}),l.jsx("button",{onClick:()=>_(!1),className:"w-8 h-8 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer sm:hidden",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),l.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden py-1",children:C.map(({abs:L,rel:O,status:q})=>l.jsxs("button",{onClick:()=>E(L),className:`flex items-center gap-2 w-full mx-1 px-2 py-2.5 text-[13px] rounded-[10px] hover:bg-cc-hover transition-colors cursor-pointer whitespace-nowrap ${L===r?"bg-cc-active text-cc-fg":"text-cc-fg/70"}`,style:{width:"calc(100% - 8px)"},children:[l.jsx(Uz,{status:q}),l.jsx("span",{className:"truncate leading-snug",children:O})]},L))})]}),l.jsxs("div",{className:"flex-1 min-w-0 h-full flex flex-col",children:[r&&l.jsxs("div",{className:"shrink-0 flex items-center gap-2 sm:gap-2.5 px-2 sm:px-4 py-2.5 bg-cc-card border-b border-cc-border",children:[!y&&l.jsx("button",{onClick:()=>_(!0),className:"flex items-center justify-center w-8 h-8 rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer shrink-0",title:"Show file list",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M1 3.5A1.5 1.5 0 012.5 2h3.379a1.5 1.5 0 011.06.44l.622.621a.5.5 0 00.353.146H13.5A1.5 1.5 0 0115 4.707V12.5a1.5 1.5 0 01-1.5 1.5h-11A1.5 1.5 0 011 12.5v-9z"})})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("span",{className:"text-cc-fg text-[13px] font-medium truncate block",children:R==null?void 0:R.split("/").pop()}),l.jsx("span",{className:"text-cc-muted truncate text-[11px] hidden sm:block font-mono-code",children:R})]}),l.jsx("button",{onClick:()=>u(o==="last-commit"?"default-branch":"last-commit"),className:"text-cc-muted text-[11px] shrink-0 hidden sm:inline hover:text-cc-fg transition-colors cursor-pointer",title:`Switch to ${o==="last-commit"?"default branch":"last commit"} comparison`,children:o==="default-branch"?"vs default branch":"vs last commit"})]}),l.jsx("div",{className:"flex-1 overflow-auto",children:x?l.jsx("div",{className:"h-full flex items-center justify-center",children:l.jsx("div",{className:"w-5 h-5 border-2 border-cc-primary border-t-transparent rounded-full animate-spin"})}):r?l.jsx("div",{className:"p-4",children:l.jsx(no,{unifiedDiff:p,fileName:R||void 0,mode:"full"})}):l.jsxs("div",{className:"h-full flex flex-col items-center justify-center",children:[!y&&l.jsxs("button",{onClick:()=>_(!0),className:"mb-4 flex items-center gap-2 px-3 py-2 rounded-lg text-xs text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M1 3.5A1.5 1.5 0 012.5 2h3.379a1.5 1.5 0 011.06.44l.622.621a.5.5 0 00.353.146H13.5A1.5 1.5 0 0115 4.707V12.5a1.5 1.5 0 01-1.5 1.5h-11A1.5 1.5 0 011 12.5v-9z"})}),"Show file list"]}),l.jsx("p",{className:"text-cc-muted text-sm",children:"Select a file to view changes"})]})})]})]}):l.jsx("div",{className:"flex-1 flex items-center justify-center h-full",children:l.jsx("p",{className:"text-cc-muted text-sm",children:"Waiting for session to initialize..."})})}function Hz(){const e=Y(f=>f.updateInfo),t=Y(f=>f.updateDismissedVersion),n=Y(f=>f.dismissUpdate),[r,a]=k.useState(!1);if(!(e!=null&&e.updateAvailable)||!e.latestVersion||t===e.latestVersion)return null;const o=async()=>{a(!0);try{localStorage.setItem("companion_docker_prompt_pending","1"),await Ne.triggerUpdate(),Y.getState().setUpdateOverlayActive(!0)}catch(f){localStorage.removeItem("companion_docker_prompt_pending"),Yi(f),a(!1)}},u=()=>{n(e.latestVersion)},h=r||e.updateInProgress;return l.jsxs("div",{className:"px-4 py-1.5 bg-cc-primary/10 border-b border-cc-primary/20 flex items-center justify-center gap-3 animate-[fadeSlideIn_0.2s_ease-out]",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary shrink-0",children:l.jsx("path",{d:"M8 1a7 7 0 1 1 0 14A7 7 0 0 1 8 1zm0 2a.75.75 0 0 0-.75.75v3.69L5.78 6.15a.75.75 0 0 0-.96 1.15l2.5 2.08a.75.75 0 0 0 1.08-.12l2-2.5a.75.75 0 1 0-1.17-.94L8.75 6.5V3.75A.75.75 0 0 0 8 3z"})}),l.jsxs("span",{className:"text-xs text-cc-fg",children:[l.jsxs("span",{className:"font-medium",children:["v",e.latestVersion]})," available",l.jsxs("span",{className:"text-cc-muted ml-1",children:["(current: v",e.currentVersion,")"]})]}),e.isServiceMode?l.jsx("button",{onClick:o,disabled:h,className:"text-xs font-medium px-2.5 py-0.5 rounded-md bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",children:h?"Updating...":"Update & Restart"}):l.jsxs("span",{className:"text-xs text-cc-muted",children:["Run"," ",l.jsx("code",{className:"font-mono-code bg-cc-code-bg px-1 py-0.5 rounded text-cc-code-fg",children:"the-companion install"})," ","for auto-updates"]}),l.jsx("button",{onClick:u,className:"text-cc-muted hover:text-cc-fg transition-colors cursor-pointer ml-auto",title:"Dismiss",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})})]})}function qz({steps:e,error:t,backend:n,onCancel:r}){const a=n==="codex"?"/logo-codex.svg":"/logo.svg",o=e.some(x=>x.status==="in_progress"),u=e.length>0&&e.every(x=>x.status==="done"),h=e.some(x=>x.status==="error")||!!t,f=[...e].reverse().find(x=>x.status==="in_progress"),p=[...e].reverse().find(x=>x.status==="done"),m=h?"Something went wrong":u?"Launching session...":(f==null?void 0:f.label)||(p==null?void 0:p.label)||"Preparing...";return l.jsxs("div",{className:"absolute inset-0 z-50 flex flex-col items-center justify-center bg-cc-bg/95 backdrop-blur-sm animate-fade-in",children:[l.jsxs("div",{className:"relative mb-8",children:[o&&!h&&l.jsx("div",{className:"absolute inset-0 -m-4 rounded-full bg-cc-primary/10 animate-pulse"}),l.jsx("img",{src:a,alt:"Launching",className:`w-20 h-20 relative z-10 transition-transform duration-500 ${o&&!h?"scale-110":""} ${h?"opacity-40 grayscale":""}`}),o&&!h&&l.jsx("div",{className:"absolute -inset-3 z-0",children:l.jsx("svg",{className:"w-full h-full animate-spin-slow",viewBox:"0 0 100 100",children:l.jsx("circle",{cx:"50",cy:"50",r:"46",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"60 230",strokeLinecap:"round",className:"text-cc-primary/40"})})}),u&&!h&&l.jsx("div",{className:"absolute -inset-3 z-0 rounded-full border-2 border-cc-success/30"})]}),l.jsx("p",{className:`text-sm font-medium mb-6 transition-colors ${h?"text-cc-error":"text-cc-fg"}`,children:m}),l.jsx("div",{className:"w-full max-w-xs space-y-2 px-4",children:e.map((x,b)=>l.jsxs("div",{className:"flex items-center gap-3 transition-all duration-300",style:{animationDelay:`${b*60}ms`},children:[l.jsxs("div",{className:"w-5 h-5 flex items-center justify-center shrink-0",children:[x.status==="in_progress"&&l.jsx("span",{className:"w-4 h-4 border-2 border-cc-primary/30 border-t-cc-primary rounded-full animate-spin"}),x.status==="done"&&l.jsx("div",{className:"w-5 h-5 rounded-full bg-cc-success/15 flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3 h-3 text-cc-success",children:l.jsx("path",{d:"M13.25 4.75L6 12 2.75 8.75",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),x.status==="error"&&l.jsx("div",{className:"w-5 h-5 rounded-full bg-cc-error/15 flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3 h-3 text-cc-error",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),l.jsx("span",{className:`text-xs transition-colors duration-200 ${x.status==="in_progress"?"text-cc-fg font-medium":x.status==="done"?"text-cc-muted":"text-cc-error font-medium"}`,children:x.label}),x.detail&&x.status==="in_progress"&&l.jsx("span",{className:"text-[10px] text-cc-muted truncate ml-auto max-w-[120px]",children:x.detail})]},x.step))}),t&&l.jsx("div",{className:"mt-5 w-full max-w-xs px-4",children:l.jsx("div",{className:"px-3 py-2.5 rounded-lg bg-cc-error/5 border border-cc-error/20",children:l.jsx("p",{className:"text-[11px] text-cc-error whitespace-pre-wrap font-mono-code leading-relaxed",children:t})})}),(h||o)&&r&&l.jsx("button",{onClick:r,className:"mt-6 px-4 py-2.5 min-h-[44px] text-xs font-medium rounded-lg bg-cc-hover text-cc-muted hover:text-cc-fg hover:bg-cc-border transition-colors cursor-pointer",children:h?"Dismiss":"Cancel"}),!h&&e.length>0&&l.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-cc-border/30",children:l.jsx("div",{className:"h-full bg-cc-primary/60 transition-all duration-500 ease-out",style:{width:`${Math.round(e.filter(x=>x.status==="done").length/Math.max(e.length,1)*100)}%`}})})]})}function Vz(){const e=localStorage.getItem("companion_auth_token");return e?{Authorization:`Bearer ${e}`}:{}}const Gz={installing:"Installing update...",restarting:"Restarting server...",waiting:"Waiting for server...",ready:"Update complete!"};function Yz(e){const[t,n]=k.useState("installing"),r=k.useRef(null),a=k.useRef(!0);return k.useEffect(()=>(a.current=!0,()=>{a.current=!1,r.current&&clearTimeout(r.current)}),[]),k.useEffect(()=>{if(!e)return;const o=setTimeout(()=>{a.current&&n("restarting")},3e3),u=setTimeout(()=>{a.current&&n("waiting"),h()},5e3);function h(){a.current&&fetch("/api/update-check",{signal:AbortSignal.timeout(3e3),headers:Vz()}).then(f=>{if(!f.ok)throw new Error("not ready");return f.json()}).then(()=>{a.current&&(n("ready"),setTimeout(()=>{a.current&&window.location.reload()},800))}).catch(()=>{r.current=setTimeout(h,1500)})}return()=>{clearTimeout(o),clearTimeout(u),r.current&&clearTimeout(r.current)}},[e]),t}function Yk({phase:e,className:t}){const n=e==="ready";return l.jsxs("div",{className:`flex flex-col items-center justify-center bg-cc-bg animate-fade-in ${t??""}`,children:[l.jsxs("div",{className:"relative mb-8",children:[!n&&l.jsx("div",{className:"absolute inset-0 -m-4 rounded-full bg-cc-primary/10 animate-pulse"}),l.jsx("img",{src:"/logo.svg",alt:"Updating",className:`w-20 h-20 relative z-10 transition-transform duration-500 ${n?"":"scale-110"}`}),!n&&l.jsx("div",{className:"absolute -inset-3 z-0",children:l.jsx("svg",{className:"w-full h-full animate-spin-slow",viewBox:"0 0 100 100",children:l.jsx("circle",{cx:"50",cy:"50",r:"46",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"60 230",strokeLinecap:"round",className:"text-cc-primary/40"})})}),n&&l.jsx("div",{className:"absolute -inset-3 z-0 rounded-full border-2 border-cc-success/30 animate-fade-in"})]}),l.jsx("p",{className:`text-sm font-medium mb-2 transition-colors ${n?"text-cc-success":"text-cc-fg"}`,children:Gz[e]}),l.jsx("p",{className:"text-xs text-cc-muted",children:n?"Reloading...":"This page will refresh automatically"}),!n&&l.jsx("div",{className:"flex gap-1.5 mt-6",children:[0,1,2].map(r=>l.jsx("span",{"data-testid":"progress-dot",className:"w-1.5 h-1.5 rounded-full bg-cc-primary/50",style:{animation:"pulse-dot 1.4s ease-in-out infinite",animationDelay:`${r*.2}s`}},r))}),l.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-cc-border/30",children:l.jsx("div",{className:"h-full bg-cc-primary/60 transition-all duration-1000 ease-out",style:{width:n?"100%":e==="waiting"?"75%":e==="restarting"?"40%":"15%"}})})]})}function Wz({active:e}){const t=Yz(e);return e?l.jsx(Yk,{phase:t,className:"fixed inset-0 z-[100]"}):null}function jO({phase:e}){return l.jsx(Yk,{phase:e,className:"absolute inset-0"})}function Qz(){const e=Y(j=>j.dockerUpdateDialogOpen),t=Y(j=>j.setDockerUpdateDialogOpen),[n,r]=k.useState("prompt"),[a,o]=k.useState(!1),[u,h]=k.useState(null),f=k.useRef(null);if(k.useEffect(()=>{e&&Ne.getSettings().then(j=>{o(j.dockerAutoUpdate),j.dockerAutoUpdate&&p()}).catch(()=>{})},[e]),k.useEffect(()=>{if(n!=="pulling"){f.current&&(clearInterval(f.current),f.current=null);return}return f.current=setInterval(()=>{Ne.getImageStatus("the-companion:latest").then(j=>{h(j),j.status==="ready"?r("done"):j.status==="error"&&r("error")}).catch(()=>{})},2e3),()=>{f.current&&(clearInterval(f.current),f.current=null)}},[n]),!e)return null;function p(){r("pulling"),Ne.pullImage("the-companion:latest").then(j=>{j.state&&h(j.state)}).catch(()=>{r(j=>j==="pulling"?"error":j)})}function m(){p()}function x(){y()}function b(){y()}function y(){r("prompt"),h(null),t(!1)}async function _(){const j=!a;o(j);try{await Ne.updateSettings({dockerAutoUpdate:j})}catch{o(!j)}}return l.jsx("div",{className:"fixed inset-0 z-[90] flex items-center justify-center bg-black/50 animate-fade-in","data-testid":"docker-update-dialog",children:l.jsxs("div",{className:"bg-cc-bg rounded-xl shadow-xl border border-cc-border w-full max-w-md mx-4 overflow-hidden",children:[n==="prompt"&&l.jsxs("div",{className:"p-6",children:[l.jsx("h2",{className:"text-base font-semibold text-cc-fg mb-2",children:"Update Sandbox Image?"}),l.jsx("p",{className:"text-sm text-cc-muted mb-5",children:"A new version of The Companion was installed. Would you like to also update the sandbox Docker image?"}),l.jsxs("button",{type:"button",onClick:_,className:"w-full flex items-center justify-between px-3 py-3 rounded-lg text-sm bg-cc-hover text-cc-fg hover:bg-cc-active transition-colors cursor-pointer mb-5",children:[l.jsx("span",{children:"Always update Docker image automatically"}),l.jsx("span",{role:"switch","aria-checked":a,"aria-label":"Always update Docker image automatically",className:`relative inline-flex h-5 w-9 shrink-0 rounded-full border-2 border-transparent transition-colors ${a?"bg-cc-primary":"bg-cc-border"}`,children:l.jsx("span",{className:`pointer-events-none inline-block h-4 w-4 rounded-full bg-white shadow transform transition-transform ${a?"translate-x-4":"translate-x-0"}`})})]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("button",{type:"button",onClick:x,className:"px-4 py-2 min-h-[40px] rounded-lg text-sm font-medium bg-cc-hover hover:bg-cc-active text-cc-fg transition-colors cursor-pointer",children:"Skip"}),l.jsx("button",{type:"button",onClick:m,className:"px-4 py-2 min-h-[40px] rounded-lg text-sm font-medium bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Update"})]})]}),n==="pulling"&&l.jsxs("div",{className:"p-6",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[l.jsx("svg",{className:"w-4 h-4 animate-spin text-cc-primary",viewBox:"0 0 24 24",fill:"none",children:l.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2.5",strokeDasharray:"31.4 31.4",strokeLinecap:"round"})}),l.jsx("h2",{className:"text-base font-semibold text-cc-fg",children:"Updating Sandbox Image..."})]}),l.jsx("p",{className:"text-sm text-cc-muted mb-3",children:"Pulling the-companion:latest"}),(u==null?void 0:u.progress)&&u.progress.length>0&&l.jsx("pre",{className:"px-3 py-2 text-[10px] font-mono-code bg-cc-code-bg rounded-lg text-cc-muted max-h-[160px] overflow-auto whitespace-pre-wrap","data-testid":"pull-progress",children:u.progress.slice(-20).join(`
127
+ `)})]}),n==="done"&&l.jsxs("div",{className:"p-6",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-cc-success",children:l.jsx("path",{fillRule:"evenodd",d:"M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm3.78-9.72a.75.75 0 0 0-1.06-1.06L7 8.94 5.28 7.22a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.06 0l4.25-4.25z"})}),l.jsx("h2",{className:"text-base font-semibold text-cc-success",children:"Sandbox Image Updated"})]}),l.jsx("p",{className:"text-sm text-cc-muted mb-5",children:"The Docker image has been updated successfully."}),l.jsx("div",{className:"flex justify-end",children:l.jsx("button",{type:"button",onClick:b,className:"px-4 py-2 min-h-[40px] rounded-lg text-sm font-medium bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Done"})})]}),n==="error"&&l.jsxs("div",{className:"p-6",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-cc-error",children:l.jsx("path",{fillRule:"evenodd",d:"M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zM5.22 5.22a.75.75 0 0 1 1.06 0L8 6.94l1.72-1.72a.75.75 0 1 1 1.06 1.06L9.06 8l1.72 1.72a.75.75 0 1 1-1.06 1.06L8 9.06l-1.72 1.72a.75.75 0 0 1-1.06-1.06L6.94 8 5.22 6.28a.75.75 0 0 1 0-1.06z"})}),l.jsx("h2",{className:"text-base font-semibold text-cc-error",children:"Image Update Failed"})]}),l.jsxs("p",{className:"text-sm text-cc-muted mb-2",children:["Failed to update the Docker image.",(u==null?void 0:u.error)&&l.jsx("span",{className:"block mt-1 text-xs text-cc-error",children:u.error})]}),(u==null?void 0:u.progress)&&u.progress.length>0&&l.jsx("pre",{className:"px-3 py-2 text-[10px] font-mono-code bg-cc-code-bg rounded-lg text-cc-muted max-h-[120px] overflow-auto whitespace-pre-wrap mb-4","data-testid":"pull-progress",children:u.progress.slice(-20).join(`
128
+ `)}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("button",{type:"button",onClick:y,className:"px-4 py-2 min-h-[40px] rounded-lg text-sm font-medium bg-cc-hover hover:bg-cc-active text-cc-fg transition-colors cursor-pointer",children:"Close"}),l.jsx("button",{type:"button",onClick:m,className:"px-4 py-2 min-h-[40px] rounded-lg text-sm font-medium bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Retry"})]})]})]})})}function NO({phase:e}){return l.jsx("div",{className:"relative bg-black/50 rounded-lg overflow-hidden h-[300px] flex items-center justify-center",children:l.jsxs("div",{className:"bg-cc-bg rounded-xl shadow-xl border border-cc-border w-full max-w-sm mx-4 overflow-hidden",children:[e==="prompt"&&l.jsxs("div",{className:"p-5",children:[l.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-1.5",children:"Update Sandbox Image?"}),l.jsx("p",{className:"text-xs text-cc-muted mb-4",children:"A new version of The Companion was installed. Would you like to also update the sandbox Docker image?"}),l.jsxs("div",{className:"flex items-center justify-between px-2 py-2 rounded-lg bg-cc-hover text-xs text-cc-fg mb-4",children:[l.jsx("span",{children:"Always update automatically"}),l.jsx("span",{className:"relative inline-flex h-4 w-7 rounded-full bg-cc-border",children:l.jsx("span",{className:"inline-block h-3 w-3 rounded-full bg-white shadow translate-x-0 mt-0.5 ml-0.5"})})]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-hover text-cc-fg",children:"Skip"}),l.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-primary text-white",children:"Update"})]})]}),e==="pulling"&&l.jsxs("div",{className:"p-5",children:[l.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[l.jsx("svg",{className:"w-3.5 h-3.5 animate-spin text-cc-primary",viewBox:"0 0 24 24",fill:"none",children:l.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2.5",strokeDasharray:"31.4 31.4",strokeLinecap:"round"})}),l.jsx("h2",{className:"text-sm font-semibold text-cc-fg",children:"Updating Sandbox Image..."})]}),l.jsx("pre",{className:"px-2 py-1.5 text-[9px] font-mono-code bg-cc-code-bg rounded text-cc-muted max-h-[80px] overflow-auto whitespace-pre-wrap",children:`Pulling the-companion:latest...
129
+ Layer 1/5: abc123 downloading
130
+ Layer 2/5: def456 complete`})]}),e==="done"&&l.jsxs("div",{className:"p-5",children:[l.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-success",children:l.jsx("path",{fillRule:"evenodd",d:"M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm3.78-9.72a.75.75 0 0 0-1.06-1.06L7 8.94 5.28 7.22a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.06 0l4.25-4.25z"})}),l.jsx("h2",{className:"text-sm font-semibold text-cc-success",children:"Sandbox Image Updated"})]}),l.jsx("p",{className:"text-xs text-cc-muted mb-4",children:"The Docker image has been updated successfully."}),l.jsx("div",{className:"flex justify-end",children:l.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-primary text-white",children:"Done"})})]}),e==="error"&&l.jsxs("div",{className:"p-5",children:[l.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-error",children:l.jsx("path",{fillRule:"evenodd",d:"M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zM5.22 5.22a.75.75 0 0 1 1.06 0L8 6.94l1.72-1.72a.75.75 0 1 1 1.06 1.06L9.06 8l1.72 1.72a.75.75 0 1 1-1.06 1.06L8 9.06l-1.72 1.72a.75.75 0 0 1-1.06-1.06L6.94 8 5.22 6.28a.75.75 0 0 1 0-1.06z"})}),l.jsx("h2",{className:"text-sm font-semibold text-cc-error",children:"Image Update Failed"})]}),l.jsx("p",{className:"text-xs text-cc-muted mb-4",children:"Failed to update the Docker image."}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-hover text-cc-fg",children:"Close"}),l.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-primary text-white",children:"Retry"})]})]})]})})}const cg=["welcome","claude","codex","done"],nw='button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])';function _x(){return typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function Xz({onComplete:e}){const[t,n]=k.useState("welcome"),[r,a]=k.useState(""),[o,u]=k.useState(""),[h,f]=k.useState(!1),[p,m]=k.useState(""),[x,b]=k.useState(!1),[y,_]=k.useState(!1),[j,N]=k.useState(_x),w=k.useRef(null);k.useEffect(()=>{j||requestAnimationFrame(()=>N(!0))},[j]),k.useEffect(()=>{const I=w.current;if(!I)return;function A(Z){if(Z.key==="Escape"){Z.preventDefault();return}if(Z.key!=="Tab")return;const G=I.querySelectorAll(nw);if(G.length===0)return;const B=G[0],$=G[G.length-1];Z.shiftKey?document.activeElement===B&&(Z.preventDefault(),$.focus()):document.activeElement===$&&(Z.preventDefault(),B.focus())}document.addEventListener("keydown",A);const X=I.querySelector(nw);return X==null||X.focus(),()=>document.removeEventListener("keydown",A)},[t]);const C=k.useCallback(async()=>{if(!r.trim()){n("codex");return}f(!0),m("");try{await Ne.updateSettings({claudeCodeOAuthToken:r.trim()}),b(!0),n("codex")}catch(I){m(I instanceof Error?I.message:"Failed to save token")}finally{f(!1)}},[r]),E=k.useCallback(async()=>{f(!0),m("");try{(await Ne.getSettings()).codexDeviceAuthConfigured?(_(!0),await L()):m("No Codex auth found. Run codex --login in your terminal first.")}catch(I){m(I instanceof Error?I.message:"Failed to check auth status")}finally{f(!1)}},[]),R=k.useCallback(async()=>{f(!0),m("");try{await Ne.updateSettings({openaiApiKey:o.trim()}),_(!0),await L()}catch(I){m(I instanceof Error?I.message:"Failed to save API key")}finally{f(!1)}},[o]),L=k.useCallback(async()=>{try{await Ne.updateSettings({onboardingCompleted:!0})}catch{}n("done")},[]),O=k.useCallback(()=>{e()},[e]),q=k.useCallback(async()=>{await L(),e()},[L,e]),F=k.useCallback(I=>{m(""),n(I)},[]),W=cg.indexOf(t),z=_x();return so.createPortal(l.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"linear-gradient(145deg, var(--color-cc-bg) 0%, color-mix(in srgb, var(--color-cc-bg) 94%, var(--color-cc-primary) 6%) 100%)",opacity:j?1:0,transition:z?"none":"opacity 400ms cubic-bezier(0.16, 1, 0.3, 1)"},children:[l.jsx("div",{className:"absolute top-0 left-0 right-0 h-[2px]",style:{background:"linear-gradient(90deg, transparent 0%, var(--color-cc-primary) 30%, var(--color-cc-primary) 70%, transparent 100%)",opacity:.6}}),l.jsxs("div",{ref:w,role:"dialog","aria-modal":"true","aria-label":"Provider setup",className:"w-full max-w-[520px] mx-6",style:{transform:j?"translateY(0)":"translateY(12px)",opacity:j?1:0,transition:z?"none":"transform 500ms cubic-bezier(0.16, 1, 0.3, 1) 100ms, opacity 400ms cubic-bezier(0.16, 1, 0.3, 1) 100ms"},children:[t!=="done"&&l.jsx("div",{className:"flex items-center gap-1.5 mb-6 justify-center",role:"status","aria-label":`Step ${W+1} of ${cg.length-1}`,children:cg.slice(0,3).map((I,A)=>l.jsx("div",{className:"h-[3px] rounded-full transition-[transform,background,opacity] duration-300",style:{width:32,transform:A===W?"scaleX(1)":"scaleX(0.375)",transformOrigin:"center",background:A<=W?"var(--color-cc-primary)":"var(--color-cc-border)",opacity:A<=W?1:.5}},I))}),l.jsxs("div",{className:"bg-cc-card border border-cc-border overflow-hidden",style:{borderRadius:16,boxShadow:"0 1px 3px var(--color-cc-border), 0 8px 32px var(--color-cc-border)"},children:[t==="welcome"&&l.jsx(Kz,{onSetupClaude:()=>F("claude"),onSetupCodex:()=>F("codex")}),t==="claude"&&l.jsx(Zz,{token:r,onTokenChange:a,onSave:C,onSkip:()=>F("codex"),saving:h,error:p}),t==="codex"&&l.jsx(Jz,{apiKey:o,onApiKeyChange:u,onCheckAuth:E,onSaveApiKey:R,onSkip:()=>L(),onBack:()=>F("claude"),saving:h,error:p}),t==="done"&&l.jsx(eO,{claudeConfigured:x,codexConfigured:y,onDone:O})]}),t==="welcome"&&l.jsx("button",{onClick:q,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 Kz({onSetupClaude:e,onSetupCodex:t}){return l.jsxs("div",{className:"p-7 pb-6",children:[l.jsxs("div",{className:"mb-6",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-cc-muted font-medium mb-2",children:"First time setup"}),l.jsx("h2",{className:"text-xl font-semibold text-cc-fg leading-tight",children:"Welcome to The Companion"}),l.jsx("p",{className:"text-sm text-cc-muted mt-1.5 leading-relaxed",children:"Connect your AI providers to start coding. Configure one or both."})]}),l.jsxs("div",{className:"space-y-2.5",children:[l.jsxs("button",{onClick:e,className:"provider-card--claude group w-full flex items-center gap-3.5 p-3.5 min-h-[52px] rounded-xl border border-cc-border bg-cc-bg text-left transition-[transform,border-color,box-shadow] duration-150",children:[l.jsx("div",{className:"w-9 h-9 rounded-lg flex items-center justify-center flex-shrink-0 font-semibold text-sm bg-cc-primary/10 text-cc-primary",children:"C"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-[13px] font-medium text-cc-fg",children:"Claude Code"}),l.jsx("div",{className:"text-[11px] text-cc-muted leading-snug mt-0.5",children:"Anthropic's coding agent — requires an OAuth token"})]}),l.jsx("svg",{className:"w-4 h-4 text-cc-muted flex-shrink-0 transition-transform duration-150 group-hover:translate-x-0.5",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),l.jsxs("button",{onClick:t,className:"provider-card--codex group w-full flex items-center gap-3.5 p-3.5 min-h-[52px] rounded-xl border border-cc-border bg-cc-bg text-left transition-[transform,border-color,box-shadow] duration-150",children:[l.jsx("div",{className:"w-9 h-9 rounded-lg flex items-center justify-center flex-shrink-0 font-semibold text-sm bg-cc-codex/10 text-cc-codex",children:"X"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-[13px] font-medium text-cc-fg",children:"Codex"}),l.jsx("div",{className:"text-[11px] text-cc-muted leading-snug mt-0.5",children:"OpenAI's coding agent — log in via ChatGPT"})]}),l.jsx("svg",{className:"w-4 h-4 text-cc-muted flex-shrink-0 transition-transform duration-150 group-hover:translate-x-0.5",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]})]})]})}function Zz({token:e,onTokenChange:t,onSave:n,onSkip:r,saving:a,error:o}){const u=k.useRef(null);k.useEffect(()=>{var f;(f=u.current)==null||f.focus()},[]);const h="claude-token-error";return l.jsxs("div",{className:"p-7 pb-6",children:[l.jsxs("div",{className:"mb-5",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-cc-muted font-medium mb-2",children:"Step 1 of 2"}),l.jsx("h2",{className:"text-xl font-semibold text-cc-fg leading-tight",children:"Set up Claude Code"}),l.jsx("p",{className:"text-sm text-cc-muted mt-1.5 leading-relaxed",children:"Generate an OAuth token by running this in your terminal:"})]}),l.jsxs("div",{className:"rounded-lg overflow-hidden mb-4 border border-cc-border",style:{background:"var(--color-cc-code-bg)"},children:[l.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-cc-border",children:[l.jsxs("div",{className:"flex items-center gap-1.5","aria-hidden":"true",children:[l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-error opacity-60"}),l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-warning opacity-60"}),l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-success opacity-60"})]}),l.jsx(Wk,{text:"claude setup-token"})]}),l.jsx("div",{className:"px-3.5 py-3",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-cc-muted text-xs font-mono-code select-none","aria-hidden":"true",children:"$"}),l.jsx("code",{className:"text-[13px] font-mono-code text-cc-fg select-all",children:"claude setup-token"})]})})]}),l.jsxs("div",{className:"mb-4",children:[l.jsx("label",{htmlFor:"claude-token",className:"text-xs text-cc-muted block mb-1.5",children:"OAuth Token"}),l.jsx("input",{ref:u,id:"claude-token",type:"password",value:e,onChange:f=>t(f.target.value),placeholder:"Paste the token from your terminal...","aria-describedby":o?h:void 0,"aria-invalid":o?!0:void 0,className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg border border-cc-border text-cc-fg placeholder:text-cc-muted/60 focus:outline-none focus:ring-1 focus:ring-cc-primary focus:border-cc-primary font-mono-code transition-shadow duration-150"})]}),o&&l.jsxs("div",{id:h,role:"alert",className:"flex items-start gap-2 mb-4 text-xs text-cc-error",children:[l.jsxs("svg",{className:"w-3.5 h-3.5 mt-0.5 flex-shrink-0",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24","aria-hidden":"true",children:[l.jsx("circle",{cx:"12",cy:"12",r:"10"}),l.jsx("path",{d:"M12 8v4m0 4h.01"})]}),l.jsx("span",{children:o})]}),l.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[l.jsx("button",{onClick:r,className:"flex-1 px-4 py-2.5 min-h-[44px] rounded-lg text-sm text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors",children:"Skip"}),l.jsx("button",{onClick:n,disabled:a,className:"btn-primary-aa flex-1 px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium text-white transition-[background,opacity] duration-150 disabled:opacity-50",style:{boxShadow:a?"none":"0 1px 3px var(--color-cc-primary-btn)"},children:a?"Saving...":e.trim()?"Save & Continue":"Continue"})]})]})}function Jz({apiKey:e,onApiKeyChange:t,onCheckAuth:n,onSaveApiKey:r,onSkip:a,onBack:o,saving:u,error:h}){const[f,p]=k.useState(!1),m="codex-auth-error";return l.jsxs("div",{className:"p-7 pb-6",children:[l.jsxs("div",{className:"mb-5",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-cc-muted font-medium mb-2",children:"Step 2 of 2"}),l.jsx("h2",{className:"text-xl font-semibold text-cc-fg leading-tight",children:"Set up Codex"}),l.jsx("p",{className:"text-sm text-cc-muted mt-1.5 leading-relaxed",children:"Log in with your ChatGPT account by running this in your terminal:"})]}),l.jsxs("div",{className:"rounded-lg overflow-hidden mb-4 border border-cc-border",style:{background:"var(--color-cc-code-bg)"},children:[l.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-cc-border",children:[l.jsxs("div",{className:"flex items-center gap-1.5","aria-hidden":"true",children:[l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-error opacity-60"}),l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-warning opacity-60"}),l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-success opacity-60"})]}),l.jsx(Wk,{text:"codex --login"})]}),l.jsx("div",{className:"px-3.5 py-3",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-cc-muted text-xs font-mono-code select-none","aria-hidden":"true",children:"$"}),l.jsx("code",{className:"text-[13px] font-mono-code text-cc-fg select-all",children:"codex --login"})]})})]}),h&&l.jsxs("div",{id:m,role:"alert",className:"flex items-start gap-2 mb-4 text-xs text-cc-error",children:[l.jsxs("svg",{className:"w-3.5 h-3.5 mt-0.5 flex-shrink-0",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24","aria-hidden":"true",children:[l.jsx("circle",{cx:"12",cy:"12",r:"10"}),l.jsx("path",{d:"M12 8v4m0 4h.01"})]}),l.jsx("span",{children:h})]}),l.jsxs("div",{className:"mb-4",children:[l.jsxs("button",{onClick:()=>p(!f),className:"text-xs text-cc-muted hover:text-cc-fg transition-colors flex items-center gap-1",children:[l.jsx("svg",{className:"w-3 h-3 transition-transform duration-150",style:{transform:f?"rotate(90deg)":"rotate(0deg)"},fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),"Or use an API key instead"]}),l.jsx("div",{className:"accordion-panel","data-open":f?"true":"false",children:l.jsx("div",{className:"accordion-inner",children:l.jsxs("div",{className:"mt-3",children:[l.jsx("label",{htmlFor:"openai-key",className:"text-xs text-cc-muted block mb-1.5",children:"OpenAI API Key"}),l.jsx("input",{id:"openai-key",type:"password",value:e,onChange:x=>t(x.target.value),placeholder:"sk-...","aria-describedby":h?m:void 0,"aria-invalid":h?!0:void 0,className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg border border-cc-border text-cc-fg placeholder:text-cc-muted/60 focus:outline-none focus:ring-1 focus:ring-cc-codex focus:border-cc-codex font-mono-code transition-shadow duration-150"})]})})})]}),l.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[l.jsxs("button",{onClick:o,className:"px-3 py-2.5 min-h-[44px] min-w-[44px] rounded-lg text-sm text-cc-muted hover:text-cc-fg transition-colors flex items-center gap-1",children:[l.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})}),"Back"]}),l.jsx("div",{className:"flex-1"}),l.jsx("button",{onClick:a,className:"px-4 py-2.5 min-h-[44px] rounded-lg text-sm text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors",children:"Skip"}),l.jsx("button",{onClick:e.trim()?r:n,disabled:u,className:"btn-codex-aa px-5 py-2.5 min-h-[44px] rounded-lg text-sm font-medium text-white transition-[background,opacity] duration-150 disabled:opacity-50",style:{boxShadow:u?"none":"0 1px 3px var(--color-cc-codex-btn)"},children:u?"Checking...":e.trim()?"Save & Finish":"I've logged in"})]})]})}function eO({claudeConfigured:e,codexConfigured:t,onDone:n}){const r=!e&&!t,a=_x(),[o,u]=k.useState(a);return k.useEffect(()=>{o||requestAnimationFrame(()=>u(!0))},[o]),l.jsxs("div",{className:"p-7 pb-6 text-center",style:{opacity:o?1:0,transform:o?"translateY(0)":"translateY(8px)",transition:a?"none":"opacity 400ms cubic-bezier(0.16, 1, 0.3, 1), transform 400ms cubic-bezier(0.16, 1, 0.3, 1)"},children:[l.jsx("div",{className:"w-14 h-14 mx-auto rounded-2xl flex items-center justify-center mb-5",style:{background:r?"var(--color-cc-hover)":"color-mix(in srgb, var(--color-cc-success) 12%, transparent)"},children:r?l.jsx("svg",{className:"w-6 h-6 text-cc-muted",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}):l.jsx("svg",{className:"w-6 h-6 text-cc-success",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}),l.jsx("h2",{className:"text-xl font-semibold text-cc-fg mb-2",children:r?"Setup Skipped":"You're all set!"}),l.jsx("div",{className:"text-sm text-cc-muted leading-relaxed mb-6",children:r?"You can configure providers anytime in Settings.":l.jsxs(l.Fragment,{children:[e&&l.jsx("span",{className:"block",children:"Claude Code is ready."}),t&&l.jsx("span",{className:"block",children:"Codex is ready."}),l.jsx("span",{className:"block mt-1 text-xs",children:"You can update these anytime in Settings."})]})}),l.jsx("button",{onClick:n,className:"btn-primary-aa w-full px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium text-white transition-[background] duration-150",style:{boxShadow:"0 1px 3px var(--color-cc-primary-btn)"},children:"Get Started"})]})}function Wk({text:e}){const[t,n]=k.useState(!1),r=k.useCallback(()=>{navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)}).catch(()=>{})},[e]);return l.jsx("button",{onClick:r,className:"text-[10px] text-cc-muted hover:text-cc-fg transition-colors flex items-center gap-1 min-h-[44px] min-w-[44px] justify-end","aria-label":"Copy command",children:t?l.jsxs(l.Fragment,{children:[l.jsx("svg",{className:"w-3 h-3 text-cc-success",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),"Copied!"]}):l.jsxs(l.Fragment,{children:[l.jsxs("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:[l.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),l.jsx("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})]}),"Copy"]})})}function tO(e){return Y(t=>{var n;return!e||!t.magicUiAvailable?!1:((n=t.sessions.get(e))==null?void 0:n.magicUiActive)===!0})}const nO=k.lazy(()=>qn(()=>import("./Playground-BJAQWThl.js"),__vite__mapDeps([0,1])).then(e=>({default:e.Playground}))),rO=k.lazy(()=>qn(()=>import("./SettingsPage-BwZoML1s.js"),[]).then(e=>({default:e.SettingsPage}))),sO=k.lazy(()=>qn(()=>import("./IntegrationsPage-CRfvSp68.js"),[]).then(e=>({default:e.IntegrationsPage}))),iO=k.lazy(()=>qn(()=>import("./LinearSettingsPage-BTQJFAj4.js"),[]).then(e=>({default:e.LinearSettingsPage}))),aO=k.lazy(()=>qn(()=>import("./LinearOAuthSettingsPage-DgzYg2kb.js"),[]).then(e=>({default:e.LinearOAuthSettingsPage}))),lO=k.lazy(()=>qn(()=>import("./TailscalePage-B6eauJ__.js"),[]).then(e=>({default:e.TailscalePage}))),oO=k.lazy(()=>qn(()=>import("./PromptsPage-BKEK_e8P.js"),[]).then(e=>({default:e.PromptsPage}))),cO=k.lazy(()=>qn(()=>Promise.resolve().then(()=>UR),void 0).then(e=>({default:e.EnvManager}))),uO=k.lazy(()=>qn(()=>import("./SandboxManager-BZfEkHsb.js"),[]).then(e=>({default:e.SandboxManager}))),dO=k.lazy(()=>qn(()=>import("./CronManager-BrGSjzJz.js"),[]).then(e=>({default:e.CronManager}))),hO=k.lazy(()=>qn(()=>import("./AgentsPage-DkcwIsY1.js"),[]).then(e=>({default:e.AgentsPage}))),fO=k.lazy(()=>qn(()=>import("./RunsPage-Biakia-J.js"),[]).then(e=>({default:e.RunsPage}))),pO=k.lazy(()=>qn(()=>import("./DashboardPage-B2q0O3yD.js"),[]).then(e=>({default:e.DashboardPage}))),mO=k.lazy(()=>qn(()=>import("./MagicUIView-D23itGQ5.js"),__vite__mapDeps([2,1])).then(e=>({default:e.MagicUIView})));function lr(){return l.jsx("div",{className:"flex items-center justify-center h-full",children:l.jsx("div",{className:"text-sm text-cc-muted",children:"Loading..."})})}function gO(){return k.useSyncExternalStore(e=>(window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)),()=>window.location.hash)}function xO(){const e=Y(ae=>ae.isAuthenticated),t=Y(ae=>ae.darkMode),n=Y(ae=>ae.currentSessionId),r=Y(ae=>ae.sidebarOpen),a=Y(ae=>ae.taskPanelOpen),o=Y(ae=>ae.homeResetKey),u=Y(ae=>ae.activeTab),h=tO(n),f=Y(ae=>ae.sessionCreating),p=Y(ae=>ae.sessionCreatingBackend),m=Y(ae=>ae.creationProgress),x=Y(ae=>ae.creationError),b=Y(ae=>ae.updateOverlayActive),y=gO(),_=k.useMemo(()=>qx(y),[y]),j=_.page==="settings",N=_.page==="prompts",w=_.page==="integrations",C=_.page==="integration-linear",E=_.page==="integration-linear-oauth",R=_.page==="integration-tailscale",L=_.page==="environments",O=_.page==="sandboxes",q=_.page==="scheduled",F=_.page==="agents"||_.page==="agent-detail",W=_.page==="runs",z=_.page==="dashboard",I=_.page==="session"||_.page==="home";k.useEffect(()=>{E6(y||"#/")},[y]),k.useEffect(()=>{document.documentElement.classList.toggle("dark",t)},[t]);const A=k.useRef(Y.getState().currentSessionId);k.useEffect(()=>{if(A.current!==null&&_.page==="home"){Vx(A.current,!0),A.current=null;return}if(A.current=null,_.page==="session"){const ae=Y.getState();ae.currentSessionId!==_.sessionId&&ae.setCurrentSession(_.sessionId),Zc(_.sessionId)}else if(_.page==="home"){const ae=Y.getState();ae.currentSessionId!==null&&ae.setCurrentSession(null)}},[_]);const X=Y(ae=>n?ae.changedFilesTick.get(n)??0:0),Z=Y(ae=>ae.diffBase),G=Y(ae=>ae.setGitChangedFilesCount),B=Y(ae=>{var D,P;return n&&(((D=ae.sessions.get(n))==null?void 0:D.cwd)||((P=ae.sdkSessions.find(J=>J.sessionId===n))==null?void 0:P.cwd))||null});k.useEffect(()=>{if(!n||!B)return;let ae=!1;return Ne.getChangedFiles(B,Z).then(({files:D})=>{if(ae)return;const P=`${B}/`,J=D.filter(M=>M.path===B||M.path.startsWith(P)).length;G(n,J)}).catch(()=>{}),()=>{ae=!0}},[n,B,Z,X,G]),k.useEffect(()=>{const ae=()=>{Ne.checkForUpdate().then(P=>{Y.getState().setUpdateInfo(P)}).catch(()=>{})};ae();const D=setInterval(ae,300*1e3);return()=>clearInterval(D)},[]),k.useEffect(()=>{const ae=()=>{Ne.getClaudeCompat().then(P=>{Y.getState().setClaudeCompatInfo(P)}).catch(()=>{})};ae();const D=setInterval(ae,300*1e3);return()=>clearInterval(D)},[]);const[$,se]=k.useState(!1);return k.useEffect(()=>{e&&Ne.getSettings().then(ae=>{ae.publicUrl&&Y.getState().setPublicUrl(ae.publicUrl),Y.getState().setMagicUiAvailable(!!ae.magicUiEnabled&&!!ae.claudeCliAvailable),ae.onboardingCompleted||se(!0)}).catch(()=>{})},[e]),k.useEffect(()=>{localStorage.getItem("companion_docker_prompt_pending")==="1"&&localStorage.removeItem("companion_docker_prompt_pending")},[]),e?_.page==="playground"?l.jsx(k.Suspense,{fallback:l.jsx(lr,{}),children:l.jsx(nO,{})}):l.jsxs("div",{className:"fixed inset-0 flex font-sans-ui bg-cc-bg text-cc-fg antialiased pt-safe overflow-hidden overscroll-none",children:[r&&l.jsx("div",{className:"fixed inset-0 bg-black/30 z-30 md:hidden",onClick:()=>Y.getState().setSidebarOpen(!1)}),l.jsx("div",{className:`
131
+ fixed inset-y-0 left-0 md:relative md:inset-auto z-40 md:z-auto
132
+ h-full shrink-0 transition-all duration-200 pt-safe md:pt-0
133
+ ${r?"w-full md:w-[260px] translate-x-0":"w-0 -translate-x-full md:w-0 md:-translate-x-full"}
134
+ overflow-hidden
135
+ `,children:l.jsx(Y6,{})}),l.jsxs("div",{className:"flex-1 flex flex-col min-w-0 overflow-hidden",children:[l.jsx(BR,{}),l.jsx(Hz,{}),l.jsxs("div",{className:"flex-1 overflow-hidden relative",children:[j&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(lr,{}),children:l.jsx(rO,{embedded:!0})})}),N&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(lr,{}),children:l.jsx(oO,{embedded:!0})})}),w&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(lr,{}),children:l.jsx(sO,{embedded:!0})})}),C&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(lr,{}),children:l.jsx(iO,{embedded:!0})})}),E&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(lr,{}),children:l.jsx(aO,{embedded:!0})})}),R&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(lr,{}),children:l.jsx(lO,{embedded:!0})})}),L&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(lr,{}),children:l.jsx(cO,{embedded:!0})})}),O&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(lr,{}),children:l.jsx(uO,{embedded:!0})})}),q&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(lr,{}),children:l.jsx(dO,{embedded:!0})})}),F&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(lr,{}),children:l.jsx(hO,{route:_})})}),W&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(lr,{}),children:l.jsx(fO,{})})}),z&&l.jsx("div",{className:"absolute inset-0",children:l.jsx(k.Suspense,{fallback:l.jsx(lr,{}),children:l.jsx(pO,{})})}),I&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"absolute inset-0",children:n?u==="diff"?l.jsx(Iz,{sessionId:n}):h?l.jsx(k.Suspense,{fallback:l.jsx(lr,{}),children:l.jsx(mO,{sessionId:n})}):l.jsx(MR,{sessionId:n}):l.jsx(ez,{},o)}),f&&m&&m.length>0&&l.jsx(qz,{steps:m,error:x,backend:p??void 0,onCancel:()=>Y.getState().clearCreation()})]})]})]}),n&&I&&l.jsxs(l.Fragment,{children:[!a&&l.jsxs("button",{type:"button",onClick:()=>Y.getState().setTaskPanelOpen(!0),className:"hidden lg:flex fixed right-0 top-1/2 -translate-y-1/2 z-30 items-center gap-1 rounded-l-lg border border-r-0 border-cc-border bg-cc-card/95 backdrop-blur px-2 py-2 text-[11px] text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:"Open context panel",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M3 2.5A1.5 1.5 0 014.5 1h7A1.5 1.5 0 0113 2.5v11a1.5 1.5 0 01-1.5 1.5h-7A1.5 1.5 0 013 13.5v-11zm2 .5v10h6V3H5z"})}),l.jsx("span",{className:"[writing-mode:vertical-rl] rotate-180 tracking-wide",children:"Context"})]}),a&&l.jsx("div",{className:"fixed inset-0 bg-black/30 z-30 lg:hidden",onClick:()=>Y.getState().setTaskPanelOpen(!1)}),l.jsx("div",{className:`
136
+ fixed inset-y-0 right-0 lg:relative lg:inset-auto z-40 lg:z-auto
137
+ h-full shrink-0 transition-all duration-200 pt-safe lg:pt-0
138
+ ${a?"w-full lg:w-[320px] translate-x-0":"w-0 translate-x-full lg:w-0 lg:translate-x-full"}
139
+ overflow-hidden
140
+ `,children:l.jsx($z,{sessionId:n})})]}),l.jsx(Wz,{active:b}),l.jsx(Qz,{}),$&&l.jsx(Xz,{onComplete:()=>se(!1)})]}):l.jsx(R6,{})}class vO extends k.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,n){Yi(t,{source:"react_error_boundary",componentStack:n.componentStack})}render(){return this.state.hasError?l.jsx("div",{className:"h-[100dvh] flex items-center justify-center bg-cc-bg text-cc-fg px-4",children:l.jsxs("div",{className:"max-w-md w-full rounded-xl border border-cc-border bg-cc-card p-5 shadow-sm",children:[l.jsx("h1",{className:"text-base font-semibold",children:"A runtime error occurred"}),l.jsx("p",{className:"text-sm text-cc-muted mt-2",children:"Reload the page to recover. The error has been reported."}),l.jsx("button",{type:"button",onClick:()=>window.location.reload(),className:"mt-4 inline-flex items-center rounded-md bg-cc-primary px-3 py-1.5 text-sm text-white hover:bg-cc-primary-hover cursor-pointer",children:"Reload"})]})}):this.props.children}}C6();nC.createRoot(document.getElementById("root")).render(l.jsx(k.StrictMode,{children:l.jsx(vO,{children:l.jsx(xO,{})})}));qn(()=>import("./sw-register-fN5inCkx.js"),[]).catch(()=>{});export{_R as A,eh as B,aR as C,yO as D,Kc as E,HR as F,Cz as G,so as H,q5 as I,Lk as J,nR as K,Bc as L,JL as M,oR as N,lR as O,cR as P,_O as Q,kO as R,qz as S,hw as T,Hz as U,SO as V,qn as _,Ne as a,Um as b,On as c,MR as d,U6 as e,NL as f,N6 as g,no as h,$R as i,l as j,jO as k,NO as l,BL as m,Vx as n,PL as o,DR as p,kz as q,k as r,wO as s,fz as t,Y as u,jz as v,qi as w,Gl as x,Pc as y,oz as z};