@sapiom/harness 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +47 -0
- package/dist/core/input-contract.d.ts +10 -0
- package/dist/core/input-contract.d.ts.map +1 -0
- package/dist/core/input-contract.js +37 -0
- package/dist/core/input-contract.js.map +1 -0
- package/dist/core/render-local-run.d.ts +10 -5
- package/dist/core/render-local-run.d.ts.map +1 -1
- package/dist/core/render-local-run.js +31 -4
- package/dist/core/render-local-run.js.map +1 -1
- package/dist/core/render-run-state.d.ts.map +1 -1
- package/dist/core/render-run-state.js +23 -2
- package/dist/core/render-run-state.js.map +1 -1
- package/dist/core/run-local-bootstrap.d.ts +8 -1
- package/dist/core/run-local-bootstrap.d.ts.map +1 -1
- package/dist/core/run-local-bootstrap.js +5 -7
- package/dist/core/run-local-bootstrap.js.map +1 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +10 -0
- package/dist/core/session-manager.js.map +1 -1
- package/dist/server/actions.d.ts +4 -0
- package/dist/server/actions.d.ts.map +1 -1
- package/dist/server/actions.js +33 -0
- package/dist/server/actions.js.map +1 -1
- package/dist/shared/types.d.ts +54 -3
- package/dist/shared/types.d.ts.map +1 -1
- package/dist/shared/types.js.map +1 -1
- package/dist/web/assets/index-C3nbT8wm.css +32 -0
- package/dist/web/assets/index-DlI78kCp.js +490 -0
- package/dist/web/canvas/sess-boot/index.html +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +5 -4
- package/dist/web/assets/index-B6DkXea8.js +0 -473
- package/dist/web/assets/index-C7wzgAWT.css +0 -32
|
@@ -1,473 +0,0 @@
|
|
|
1
|
-
var Ax=Object.defineProperty;var Rx=(s,t,n)=>t in s?Ax(s,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):s[t]=n;var Yd=(s,t,n)=>Rx(s,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))r(l);new MutationObserver(l=>{for(const d of l)if(d.type==="childList")for(const p of d.addedNodes)p.tagName==="LINK"&&p.rel==="modulepreload"&&r(p)}).observe(document,{childList:!0,subtree:!0});function n(l){const d={};return l.integrity&&(d.integrity=l.integrity),l.referrerPolicy&&(d.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?d.credentials="include":l.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function r(l){if(l.ep)return;l.ep=!0;const d=n(l);fetch(l.href,d)}})();var Kd={exports:{}},Ho={};/**
|
|
2
|
-
* @license React
|
|
3
|
-
* react-jsx-runtime.production.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var K_;function Mx(){if(K_)return Ho;K_=1;var s=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,l,d){var p=null;if(d!==void 0&&(p=""+d),l.key!==void 0&&(p=""+l.key),"key"in l){d={};for(var c in l)c!=="key"&&(d[c]=l[c])}else d=l;return l=d.ref,{$$typeof:s,type:r,key:p,ref:l!==void 0?l:null,props:d}}return Ho.Fragment=t,Ho.jsx=n,Ho.jsxs=n,Ho}var X_;function jx(){return X_||(X_=1,Kd.exports=Mx()),Kd.exports}var u=jx(),Xd={exports:{}},Qe={};/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react.production.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var J_;function Dx(){if(J_)return Qe;J_=1;var s=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),d=Symbol.for("react.consumer"),p=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),v=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),f=Symbol.for("react.activity"),x=Symbol.iterator;function E(N){return N===null||typeof N!="object"?null:(N=x&&N[x]||N["@@iterator"],typeof N=="function"?N:null)}var T={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,y={};function b(N,z,W){this.props=N,this.context=z,this.refs=y,this.updater=W||T}b.prototype.isReactComponent={},b.prototype.setState=function(N,z){if(typeof N!="object"&&typeof N!="function"&&N!=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,N,z,"setState")},b.prototype.forceUpdate=function(N){this.updater.enqueueForceUpdate(this,N,"forceUpdate")};function m(){}m.prototype=b.prototype;function g(N,z,W){this.props=N,this.context=z,this.refs=y,this.updater=W||T}var k=g.prototype=new m;k.constructor=g,C(k,b.prototype),k.isPureReactComponent=!0;var M=Array.isArray;function R(){}var j={H:null,A:null,T:null,S:null},A=Object.prototype.hasOwnProperty;function D(N,z,W){var Z=W.ref;return{$$typeof:s,type:N,key:z,ref:Z!==void 0?Z:null,props:W}}function I(N,z){return D(N.type,z,N.props)}function q(N){return typeof N=="object"&&N!==null&&N.$$typeof===s}function G(N){var z={"=":"=0",":":"=2"};return"$"+N.replace(/[=:]/g,function(W){return z[W]})}var U=/\/+/g;function X(N,z){return typeof N=="object"&&N!==null&&N.key!=null?G(""+N.key):z.toString(36)}function se(N){switch(N.status){case"fulfilled":return N.value;case"rejected":throw N.reason;default:switch(typeof N.status=="string"?N.then(R,R):(N.status="pending",N.then(function(z){N.status==="pending"&&(N.status="fulfilled",N.value=z)},function(z){N.status==="pending"&&(N.status="rejected",N.reason=z)})),N.status){case"fulfilled":return N.value;case"rejected":throw N.reason}}throw N}function F(N,z,W,Z,ue){var ge=typeof N;(ge==="undefined"||ge==="boolean")&&(N=null);var Y=!1;if(N===null)Y=!0;else switch(ge){case"bigint":case"string":case"number":Y=!0;break;case"object":switch(N.$$typeof){case s:case t:Y=!0;break;case S:return Y=N._init,F(Y(N._payload),z,W,Z,ue)}}if(Y)return ue=ue(N),Y=Z===""?"."+X(N,0):Z,M(ue)?(W="",Y!=null&&(W=Y.replace(U,"$&/")+"/"),F(ue,z,W,"",function(ae){return ae})):ue!=null&&(q(ue)&&(ue=I(ue,W+(ue.key==null||N&&N.key===ue.key?"":(""+ue.key).replace(U,"$&/")+"/")+Y)),z.push(ue)),1;Y=0;var $=Z===""?".":Z+":";if(M(N))for(var oe=0;oe<N.length;oe++)Z=N[oe],ge=$+X(Z,oe),Y+=F(Z,z,W,ge,ue);else if(oe=E(N),typeof oe=="function")for(N=oe.call(N),oe=0;!(Z=N.next()).done;)Z=Z.value,ge=$+X(Z,oe++),Y+=F(Z,z,W,ge,ue);else if(ge==="object"){if(typeof N.then=="function")return F(se(N),z,W,Z,ue);throw z=String(N),Error("Objects are not valid as a React child (found: "+(z==="[object Object]"?"object with keys {"+Object.keys(N).join(", ")+"}":z)+"). If you meant to render a collection of children, use an array instead.")}return Y}function Q(N,z,W){if(N==null)return N;var Z=[],ue=0;return F(N,Z,"","",function(ge){return z.call(W,ge,ue++)}),Z}function J(N){if(N._status===-1){var z=N._result;z=z(),z.then(function(W){(N._status===0||N._status===-1)&&(N._status=1,N._result=W)},function(W){(N._status===0||N._status===-1)&&(N._status=2,N._result=W)}),N._status===-1&&(N._status=0,N._result=z)}if(N._status===1)return N._result.default;throw N._result}var O=typeof reportError=="function"?reportError:function(N){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var z=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof N=="object"&&N!==null&&typeof N.message=="string"?String(N.message):String(N),error:N});if(!window.dispatchEvent(z))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",N);return}console.error(N)},B={map:Q,forEach:function(N,z,W){Q(N,function(){z.apply(this,arguments)},W)},count:function(N){var z=0;return Q(N,function(){z++}),z},toArray:function(N){return Q(N,function(z){return z})||[]},only:function(N){if(!q(N))throw Error("React.Children.only expected to receive a single React element child.");return N}};return Qe.Activity=f,Qe.Children=B,Qe.Component=b,Qe.Fragment=n,Qe.Profiler=l,Qe.PureComponent=g,Qe.StrictMode=r,Qe.Suspense=h,Qe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=j,Qe.__COMPILER_RUNTIME={__proto__:null,c:function(N){return j.H.useMemoCache(N)}},Qe.cache=function(N){return function(){return N.apply(null,arguments)}},Qe.cacheSignal=function(){return null},Qe.cloneElement=function(N,z,W){if(N==null)throw Error("The argument must be a React element, but you passed "+N+".");var Z=C({},N.props),ue=N.key;if(z!=null)for(ge in z.key!==void 0&&(ue=""+z.key),z)!A.call(z,ge)||ge==="key"||ge==="__self"||ge==="__source"||ge==="ref"&&z.ref===void 0||(Z[ge]=z[ge]);var ge=arguments.length-2;if(ge===1)Z.children=W;else if(1<ge){for(var Y=Array(ge),$=0;$<ge;$++)Y[$]=arguments[$+2];Z.children=Y}return D(N.type,ue,Z)},Qe.createContext=function(N){return N={$$typeof:p,_currentValue:N,_currentValue2:N,_threadCount:0,Provider:null,Consumer:null},N.Provider=N,N.Consumer={$$typeof:d,_context:N},N},Qe.createElement=function(N,z,W){var Z,ue={},ge=null;if(z!=null)for(Z in z.key!==void 0&&(ge=""+z.key),z)A.call(z,Z)&&Z!=="key"&&Z!=="__self"&&Z!=="__source"&&(ue[Z]=z[Z]);var Y=arguments.length-2;if(Y===1)ue.children=W;else if(1<Y){for(var $=Array(Y),oe=0;oe<Y;oe++)$[oe]=arguments[oe+2];ue.children=$}if(N&&N.defaultProps)for(Z in Y=N.defaultProps,Y)ue[Z]===void 0&&(ue[Z]=Y[Z]);return D(N,ge,ue)},Qe.createRef=function(){return{current:null}},Qe.forwardRef=function(N){return{$$typeof:c,render:N}},Qe.isValidElement=q,Qe.lazy=function(N){return{$$typeof:S,_payload:{_status:-1,_result:N},_init:J}},Qe.memo=function(N,z){return{$$typeof:v,type:N,compare:z===void 0?null:z}},Qe.startTransition=function(N){var z=j.T,W={};j.T=W;try{var Z=N(),ue=j.S;ue!==null&&ue(W,Z),typeof Z=="object"&&Z!==null&&typeof Z.then=="function"&&Z.then(R,O)}catch(ge){O(ge)}finally{z!==null&&W.types!==null&&(z.types=W.types),j.T=z}},Qe.unstable_useCacheRefresh=function(){return j.H.useCacheRefresh()},Qe.use=function(N){return j.H.use(N)},Qe.useActionState=function(N,z,W){return j.H.useActionState(N,z,W)},Qe.useCallback=function(N,z){return j.H.useCallback(N,z)},Qe.useContext=function(N){return j.H.useContext(N)},Qe.useDebugValue=function(){},Qe.useDeferredValue=function(N,z){return j.H.useDeferredValue(N,z)},Qe.useEffect=function(N,z){return j.H.useEffect(N,z)},Qe.useEffectEvent=function(N){return j.H.useEffectEvent(N)},Qe.useId=function(){return j.H.useId()},Qe.useImperativeHandle=function(N,z,W){return j.H.useImperativeHandle(N,z,W)},Qe.useInsertionEffect=function(N,z){return j.H.useInsertionEffect(N,z)},Qe.useLayoutEffect=function(N,z){return j.H.useLayoutEffect(N,z)},Qe.useMemo=function(N,z){return j.H.useMemo(N,z)},Qe.useOptimistic=function(N,z){return j.H.useOptimistic(N,z)},Qe.useReducer=function(N,z,W){return j.H.useReducer(N,z,W)},Qe.useRef=function(N){return j.H.useRef(N)},Qe.useState=function(N){return j.H.useState(N)},Qe.useSyncExternalStore=function(N,z,W){return j.H.useSyncExternalStore(N,z,W)},Qe.useTransition=function(){return j.H.useTransition()},Qe.version="19.2.7",Qe}var Z_;function zp(){return Z_||(Z_=1,Xd.exports=Dx()),Xd.exports}var H=zp(),Jd={exports:{}},Io={},Zd={exports:{}},Qd={};/**
|
|
18
|
-
* @license React
|
|
19
|
-
* scheduler.production.js
|
|
20
|
-
*
|
|
21
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
22
|
-
*
|
|
23
|
-
* This source code is licensed under the MIT license found in the
|
|
24
|
-
* LICENSE file in the root directory of this source tree.
|
|
25
|
-
*/var Q_;function Nx(){return Q_||(Q_=1,(function(s){function t(F,Q){var J=F.length;F.push(Q);e:for(;0<J;){var O=J-1>>>1,B=F[O];if(0<l(B,Q))F[O]=Q,F[J]=B,J=O;else break e}}function n(F){return F.length===0?null:F[0]}function r(F){if(F.length===0)return null;var Q=F[0],J=F.pop();if(J!==Q){F[0]=J;e:for(var O=0,B=F.length,N=B>>>1;O<N;){var z=2*(O+1)-1,W=F[z],Z=z+1,ue=F[Z];if(0>l(W,J))Z<B&&0>l(ue,W)?(F[O]=ue,F[Z]=J,O=Z):(F[O]=W,F[z]=J,O=z);else if(Z<B&&0>l(ue,J))F[O]=ue,F[Z]=J,O=Z;else break e}}return Q}function l(F,Q){var J=F.sortIndex-Q.sortIndex;return J!==0?J:F.id-Q.id}if(s.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;s.unstable_now=function(){return d.now()}}else{var p=Date,c=p.now();s.unstable_now=function(){return p.now()-c}}var h=[],v=[],S=1,f=null,x=3,E=!1,T=!1,C=!1,y=!1,b=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,g=typeof setImmediate<"u"?setImmediate:null;function k(F){for(var Q=n(v);Q!==null;){if(Q.callback===null)r(v);else if(Q.startTime<=F)r(v),Q.sortIndex=Q.expirationTime,t(h,Q);else break;Q=n(v)}}function M(F){if(C=!1,k(F),!T)if(n(h)!==null)T=!0,R||(R=!0,G());else{var Q=n(v);Q!==null&&se(M,Q.startTime-F)}}var R=!1,j=-1,A=5,D=-1;function I(){return y?!0:!(s.unstable_now()-D<A)}function q(){if(y=!1,R){var F=s.unstable_now();D=F;var Q=!0;try{e:{T=!1,C&&(C=!1,m(j),j=-1),E=!0;var J=x;try{t:{for(k(F),f=n(h);f!==null&&!(f.expirationTime>F&&I());){var O=f.callback;if(typeof O=="function"){f.callback=null,x=f.priorityLevel;var B=O(f.expirationTime<=F);if(F=s.unstable_now(),typeof B=="function"){f.callback=B,k(F),Q=!0;break t}f===n(h)&&r(h),k(F)}else r(h);f=n(h)}if(f!==null)Q=!0;else{var N=n(v);N!==null&&se(M,N.startTime-F),Q=!1}}break e}finally{f=null,x=J,E=!1}Q=void 0}}finally{Q?G():R=!1}}}var G;if(typeof g=="function")G=function(){g(q)};else if(typeof MessageChannel<"u"){var U=new MessageChannel,X=U.port2;U.port1.onmessage=q,G=function(){X.postMessage(null)}}else G=function(){b(q,0)};function se(F,Q){j=b(function(){F(s.unstable_now())},Q)}s.unstable_IdlePriority=5,s.unstable_ImmediatePriority=1,s.unstable_LowPriority=4,s.unstable_NormalPriority=3,s.unstable_Profiling=null,s.unstable_UserBlockingPriority=2,s.unstable_cancelCallback=function(F){F.callback=null},s.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):A=0<F?Math.floor(1e3/F):5},s.unstable_getCurrentPriorityLevel=function(){return x},s.unstable_next=function(F){switch(x){case 1:case 2:case 3:var Q=3;break;default:Q=x}var J=x;x=Q;try{return F()}finally{x=J}},s.unstable_requestPaint=function(){y=!0},s.unstable_runWithPriority=function(F,Q){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var J=x;x=F;try{return Q()}finally{x=J}},s.unstable_scheduleCallback=function(F,Q,J){var O=s.unstable_now();switch(typeof J=="object"&&J!==null?(J=J.delay,J=typeof J=="number"&&0<J?O+J:O):J=O,F){case 1:var B=-1;break;case 2:B=250;break;case 5:B=1073741823;break;case 4:B=1e4;break;default:B=5e3}return B=J+B,F={id:S++,callback:Q,priorityLevel:F,startTime:J,expirationTime:B,sortIndex:-1},J>O?(F.sortIndex=J,t(v,F),n(h)===null&&F===n(v)&&(C?(m(j),j=-1):C=!0,se(M,J-O))):(F.sortIndex=B,t(h,F),T||E||(T=!0,R||(R=!0,G()))),F},s.unstable_shouldYield=I,s.unstable_wrapCallback=function(F){var Q=x;return function(){var J=x;x=Q;try{return F.apply(this,arguments)}finally{x=J}}}})(Qd)),Qd}var e0;function Lx(){return e0||(e0=1,Zd.exports=Nx()),Zd.exports}var ef={exports:{}},Hs={};/**
|
|
26
|
-
* @license React
|
|
27
|
-
* react-dom.production.js
|
|
28
|
-
*
|
|
29
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
30
|
-
*
|
|
31
|
-
* This source code is licensed under the MIT license found in the
|
|
32
|
-
* LICENSE file in the root directory of this source tree.
|
|
33
|
-
*/var t0;function Ox(){if(t0)return Hs;t0=1;var s=zp();function t(h){var v="https://react.dev/errors/"+h;if(1<arguments.length){v+="?args[]="+encodeURIComponent(arguments[1]);for(var S=2;S<arguments.length;S++)v+="&args[]="+encodeURIComponent(arguments[S])}return"Minified React error #"+h+"; visit "+v+" 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},l=Symbol.for("react.portal");function d(h,v,S){var f=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:l,key:f==null?null:""+f,children:h,containerInfo:v,implementation:S}}var p=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(h,v){if(h==="font")return"";if(typeof v=="string")return v==="use-credentials"?v:""}return Hs.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Hs.createPortal=function(h,v){var S=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!v||v.nodeType!==1&&v.nodeType!==9&&v.nodeType!==11)throw Error(t(299));return d(h,v,null,S)},Hs.flushSync=function(h){var v=p.T,S=r.p;try{if(p.T=null,r.p=2,h)return h()}finally{p.T=v,r.p=S,r.d.f()}},Hs.preconnect=function(h,v){typeof h=="string"&&(v?(v=v.crossOrigin,v=typeof v=="string"?v==="use-credentials"?v:"":void 0):v=null,r.d.C(h,v))},Hs.prefetchDNS=function(h){typeof h=="string"&&r.d.D(h)},Hs.preinit=function(h,v){if(typeof h=="string"&&v&&typeof v.as=="string"){var S=v.as,f=c(S,v.crossOrigin),x=typeof v.integrity=="string"?v.integrity:void 0,E=typeof v.fetchPriority=="string"?v.fetchPriority:void 0;S==="style"?r.d.S(h,typeof v.precedence=="string"?v.precedence:void 0,{crossOrigin:f,integrity:x,fetchPriority:E}):S==="script"&&r.d.X(h,{crossOrigin:f,integrity:x,fetchPriority:E,nonce:typeof v.nonce=="string"?v.nonce:void 0})}},Hs.preinitModule=function(h,v){if(typeof h=="string")if(typeof v=="object"&&v!==null){if(v.as==null||v.as==="script"){var S=c(v.as,v.crossOrigin);r.d.M(h,{crossOrigin:S,integrity:typeof v.integrity=="string"?v.integrity:void 0,nonce:typeof v.nonce=="string"?v.nonce:void 0})}}else v==null&&r.d.M(h)},Hs.preload=function(h,v){if(typeof h=="string"&&typeof v=="object"&&v!==null&&typeof v.as=="string"){var S=v.as,f=c(S,v.crossOrigin);r.d.L(h,S,{crossOrigin:f,integrity:typeof v.integrity=="string"?v.integrity:void 0,nonce:typeof v.nonce=="string"?v.nonce:void 0,type:typeof v.type=="string"?v.type:void 0,fetchPriority:typeof v.fetchPriority=="string"?v.fetchPriority:void 0,referrerPolicy:typeof v.referrerPolicy=="string"?v.referrerPolicy:void 0,imageSrcSet:typeof v.imageSrcSet=="string"?v.imageSrcSet:void 0,imageSizes:typeof v.imageSizes=="string"?v.imageSizes:void 0,media:typeof v.media=="string"?v.media:void 0})}},Hs.preloadModule=function(h,v){if(typeof h=="string")if(v){var S=c(v.as,v.crossOrigin);r.d.m(h,{as:typeof v.as=="string"&&v.as!=="script"?v.as:void 0,crossOrigin:S,integrity:typeof v.integrity=="string"?v.integrity:void 0})}else r.d.m(h)},Hs.requestFormReset=function(h){r.d.r(h)},Hs.unstable_batchedUpdates=function(h,v){return h(v)},Hs.useFormState=function(h,v,S){return p.H.useFormState(h,v,S)},Hs.useFormStatus=function(){return p.H.useHostTransitionStatus()},Hs.version="19.2.7",Hs}var s0;function s1(){if(s0)return ef.exports;s0=1;function s(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(t){console.error(t)}}return s(),ef.exports=Ox(),ef.exports}/**
|
|
34
|
-
* @license React
|
|
35
|
-
* react-dom-client.production.js
|
|
36
|
-
*
|
|
37
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
38
|
-
*
|
|
39
|
-
* This source code is licensed under the MIT license found in the
|
|
40
|
-
* LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/var i0;function Bx(){if(i0)return Io;i0=1;var s=Lx(),t=zp(),n=s1();function r(e){var i="https://react.dev/errors/"+e;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)i+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function d(e){var i=e,a=e;if(e.alternate)for(;i.return;)i=i.return;else{e=i;do i=e,(i.flags&4098)!==0&&(a=i.return),e=i.return;while(e)}return i.tag===3?a:null}function p(e){if(e.tag===13){var i=e.memoizedState;if(i===null&&(e=e.alternate,e!==null&&(i=e.memoizedState)),i!==null)return i.dehydrated}return null}function c(e){if(e.tag===31){var i=e.memoizedState;if(i===null&&(e=e.alternate,e!==null&&(i=e.memoizedState)),i!==null)return i.dehydrated}return null}function h(e){if(d(e)!==e)throw Error(r(188))}function v(e){var i=e.alternate;if(!i){if(i=d(e),i===null)throw Error(r(188));return i!==e?null:e}for(var a=e,o=i;;){var _=a.return;if(_===null)break;var w=_.alternate;if(w===null){if(o=_.return,o!==null){a=o;continue}break}if(_.child===w.child){for(w=_.child;w;){if(w===a)return h(_),e;if(w===o)return h(_),i;w=w.sibling}throw Error(r(188))}if(a.return!==o.return)a=_,o=w;else{for(var L=!1,P=_.child;P;){if(P===a){L=!0,a=_,o=w;break}if(P===o){L=!0,o=_,a=w;break}P=P.sibling}if(!L){for(P=w.child;P;){if(P===a){L=!0,a=w,o=_;break}if(P===o){L=!0,o=w,a=_;break}P=P.sibling}if(!L)throw Error(r(189))}}if(a.alternate!==o)throw Error(r(190))}if(a.tag!==3)throw Error(r(188));return a.stateNode.current===a?e:i}function S(e){var i=e.tag;if(i===5||i===26||i===27||i===6)return e;for(e=e.child;e!==null;){if(i=S(e),i!==null)return i;e=e.sibling}return null}var f=Object.assign,x=Symbol.for("react.element"),E=Symbol.for("react.transitional.element"),T=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),b=Symbol.for("react.profiler"),m=Symbol.for("react.consumer"),g=Symbol.for("react.context"),k=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),j=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),D=Symbol.for("react.activity"),I=Symbol.for("react.memo_cache_sentinel"),q=Symbol.iterator;function G(e){return e===null||typeof e!="object"?null:(e=q&&e[q]||e["@@iterator"],typeof e=="function"?e:null)}var U=Symbol.for("react.client.reference");function X(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===U?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case C:return"Fragment";case b:return"Profiler";case y:return"StrictMode";case M:return"Suspense";case R:return"SuspenseList";case D:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case T:return"Portal";case g:return e.displayName||"Context";case m:return(e._context.displayName||"Context")+".Consumer";case k:var i=e.render;return e=e.displayName,e||(e=i.displayName||i.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case j:return i=e.displayName||null,i!==null?i:X(e.type)||"Memo";case A:i=e._payload,e=e._init;try{return X(e(i))}catch{}}return null}var se=Array.isArray,F=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,J={pending:!1,data:null,method:null,action:null},O=[],B=-1;function N(e){return{current:e}}function z(e){0>B||(e.current=O[B],O[B]=null,B--)}function W(e,i){B++,O[B]=e.current,e.current=i}var Z=N(null),ue=N(null),ge=N(null),Y=N(null);function $(e,i){switch(W(ge,i),W(ue,e),W(Z,null),i.nodeType){case 9:case 11:e=(e=i.documentElement)&&(e=e.namespaceURI)?__(e):0;break;default:if(e=i.tagName,i=i.namespaceURI)i=__(i),e=y_(i,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}z(Z),W(Z,e)}function oe(){z(Z),z(ue),z(ge)}function ae(e){e.memoizedState!==null&&W(Y,e);var i=Z.current,a=y_(i,e.type);i!==a&&(W(ue,e),W(Z,a))}function xe(e){ue.current===e&&(z(Z),z(ue)),Y.current===e&&(z(Y),No._currentValue=J)}var Ee,Ue;function Ye(e){if(Ee===void 0)try{throw Error()}catch(a){var i=a.stack.trim().match(/\n( *(at )?)/);Ee=i&&i[1]||"",Ue=-1<a.stack.indexOf(`
|
|
42
|
-
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
-
`+Ee+e+Ue}var Ke=!1;function st(e,i){if(!e||Ke)return"";Ke=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var o={DetermineComponentFrameRoot:function(){try{if(i){var Se=function(){throw Error()};if(Object.defineProperty(Se.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Se,[])}catch(fe){var le=fe}Reflect.construct(e,[],Se)}else{try{Se.call()}catch(fe){le=fe}e.call(Se.prototype)}}else{try{throw Error()}catch(fe){le=fe}(Se=e())&&typeof Se.catch=="function"&&Se.catch(function(){})}}catch(fe){if(fe&&le&&typeof fe.stack=="string")return[fe.stack,le.stack]}return[null,null]}};o.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var _=Object.getOwnPropertyDescriptor(o.DetermineComponentFrameRoot,"name");_&&_.configurable&&Object.defineProperty(o.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var w=o.DetermineComponentFrameRoot(),L=w[0],P=w[1];if(L&&P){var K=L.split(`
|
|
44
|
-
`),re=P.split(`
|
|
45
|
-
`);for(_=o=0;o<K.length&&!K[o].includes("DetermineComponentFrameRoot");)o++;for(;_<re.length&&!re[_].includes("DetermineComponentFrameRoot");)_++;if(o===K.length||_===re.length)for(o=K.length-1,_=re.length-1;1<=o&&0<=_&&K[o]!==re[_];)_--;for(;1<=o&&0<=_;o--,_--)if(K[o]!==re[_]){if(o!==1||_!==1)do if(o--,_--,0>_||K[o]!==re[_]){var me=`
|
|
46
|
-
`+K[o].replace(" at new "," at ");return e.displayName&&me.includes("<anonymous>")&&(me=me.replace("<anonymous>",e.displayName)),me}while(1<=o&&0<=_);break}}}finally{Ke=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?Ye(a):""}function Oe(e,i){switch(e.tag){case 26:case 27:case 5:return Ye(e.type);case 16:return Ye("Lazy");case 13:return e.child!==i&&i!==null?Ye("Suspense Fallback"):Ye("Suspense");case 19:return Ye("SuspenseList");case 0:case 15:return st(e.type,!1);case 11:return st(e.type.render,!1);case 1:return st(e.type,!0);case 31:return Ye("Activity");default:return""}}function Dt(e){try{var i="",a=null;do i+=Oe(e,a),a=e,e=e.return;while(e);return i}catch(o){return`
|
|
47
|
-
Error generating stack: `+o.message+`
|
|
48
|
-
`+o.stack}}var pt=Object.prototype.hasOwnProperty,xt=s.unstable_scheduleCallback,gt=s.unstable_cancelCallback,ss=s.unstable_shouldYield,ht=s.unstable_requestPaint,vt=s.unstable_now,Ct=s.unstable_getCurrentPriorityLevel,$t=s.unstable_ImmediatePriority,ds=s.unstable_UserBlockingPriority,mt=s.unstable_NormalPriority,fs=s.unstable_LowPriority,$e=s.unstable_IdlePriority,Ss=s.log,nt=s.unstable_setDisableYieldValue,Cs=null,qt=null;function Nt(e){if(typeof Ss=="function"&&nt(e),qt&&typeof qt.setStrictMode=="function")try{qt.setStrictMode(Cs,e)}catch{}}var kt=Math.clz32?Math.clz32:mi,si=Math.log,ps=Math.LN2;function mi(e){return e>>>=0,e===0?32:31-(si(e)/ps|0)|0}var $s=256,ii=262144,Vs=4194304;function Ie(e){var i=e&42;if(i!==0)return i;switch(e&-e){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 e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function tt(e,i,a){var o=e.pendingLanes;if(o===0)return 0;var _=0,w=e.suspendedLanes,L=e.pingedLanes;e=e.warmLanes;var P=o&134217727;return P!==0?(o=P&~w,o!==0?_=Ie(o):(L&=P,L!==0?_=Ie(L):a||(a=P&~e,a!==0&&(_=Ie(a))))):(P=o&~w,P!==0?_=Ie(P):L!==0?_=Ie(L):a||(a=o&~e,a!==0&&(_=Ie(a)))),_===0?0:i!==0&&i!==_&&(i&w)===0&&(w=_&-_,a=i&-i,w>=a||w===32&&(a&4194048)!==0)?i:_}function Wt(e,i){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&i)===0}function is(e,i){switch(e){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 ws(){var e=Vs;return Vs<<=1,(Vs&62914560)===0&&(Vs=4194304),e}function Bs(e){for(var i=[],a=0;31>a;a++)i.push(e);return i}function we(e,i){e.pendingLanes|=i,i!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Xe(e,i,a,o,_,w){var L=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var P=e.entanglements,K=e.expirationTimes,re=e.hiddenUpdates;for(a=L&~a;0<a;){var me=31-kt(a),Se=1<<me;P[me]=0,K[me]=-1;var le=re[me];if(le!==null)for(re[me]=null,me=0;me<le.length;me++){var fe=le[me];fe!==null&&(fe.lane&=-536870913)}a&=~Se}o!==0&&ts(e,o,0),w!==0&&_===0&&e.tag!==0&&(e.suspendedLanes|=w&~(L&~i))}function ts(e,i,a){e.pendingLanes|=i,e.suspendedLanes&=~i;var o=31-kt(i);e.entangledLanes|=i,e.entanglements[o]=e.entanglements[o]|1073741824|a&261930}function Es(e,i){var a=e.entangledLanes|=i;for(e=e.entanglements;a;){var o=31-kt(a),_=1<<o;_&i|e[o]&i&&(e[o]|=i),a&=~_}}function ni(e,i){var a=i&-i;return a=(a&42)!==0?1:Ii(a),(a&(e.suspendedLanes|i))!==0?0:a}function Ii(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function te(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function pe(){var e=Q.p;return e!==0?e:(e=window.event,e===void 0?32:U_(e.type))}function ye(e,i){var a=Q.p;try{return Q.p=e,i()}finally{Q.p=a}}var _e=Math.random().toString(36).slice(2),ke="__reactFiber$"+_e,Fe="__reactProps$"+_e,We="__reactContainer$"+_e,dt="__reactEvents$"+_e,Tt="__reactListeners$"+_e,_t="__reactHandles$"+_e,de="__reactResources$"+_e,Me="__reactMarker$"+_e;function Re(e){delete e[ke],delete e[Fe],delete e[dt],delete e[Tt],delete e[_t]}function at(e){var i=e[ke];if(i)return i;for(var a=e.parentNode;a;){if(i=a[We]||a[ke]){if(a=i.alternate,i.child!==null||a!==null&&a.child!==null)for(e=k_(e);e!==null;){if(a=e[ke])return a;e=k_(e)}return i}e=a,a=e.parentNode}return null}function Pe(e){if(e=e[ke]||e[We]){var i=e.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return e}return null}function ls(e){var i=e.tag;if(i===5||i===26||i===27||i===6)return e.stateNode;throw Error(r(33))}function ks(e){var i=e[de];return i||(i=e[de]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function At(e){e[Me]=!0}var tr=new Set,Mi={};function ns(e,i){zi(e,i),zi(e+"Capture",i)}function zi(e,i){for(Mi[e]=i,e=0;e<i.length;e++)tr.add(i[e])}var Hr=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]*$"),sr={},Pa={};function Vu(e){return pt.call(Pa,e)?!0:pt.call(sr,e)?!1:Hr.test(e)?Pa[e]=!0:(sr[e]=!0,!1)}function En(e,i,a){if(Vu(i))if(a===null)e.removeAttribute(i);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(i);return;case"boolean":var o=i.toLowerCase().slice(0,5);if(o!=="data-"&&o!=="aria-"){e.removeAttribute(i);return}}e.setAttribute(i,""+a)}}function ir(e,i,a){if(a===null)e.removeAttribute(i);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(i);return}e.setAttribute(i,""+a)}}function ji(e,i,a,o){if(o===null)e.removeAttribute(a);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(i,a,""+o)}}function Ps(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Ua(e){var i=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function El(e,i,a){var o=Object.getOwnPropertyDescriptor(e.constructor.prototype,i);if(!e.hasOwnProperty(i)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var _=o.get,w=o.set;return Object.defineProperty(e,i,{configurable:!0,get:function(){return _.call(this)},set:function(L){a=""+L,w.call(this,L)}}),Object.defineProperty(e,i,{enumerable:o.enumerable}),{getValue:function(){return a},setValue:function(L){a=""+L},stopTracking:function(){e._valueTracker=null,delete e[i]}}}}function Ir(e){if(!e._valueTracker){var i=Ua(e)?"checked":"value";e._valueTracker=El(e,i,""+e[i])}}function Fa(e){if(!e)return!1;var i=e._valueTracker;if(!i)return!0;var a=i.getValue(),o="";return e&&(o=Ua(e)?e.checked?"true":"false":e.value),e=o,e!==a?(i.setValue(e),!0):!1}function nr(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var kl=/[\n"\\]/g;function Us(e){return e.replace(kl,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function zr(e,i,a,o,_,w,L,P){e.name="",L!=null&&typeof L!="function"&&typeof L!="symbol"&&typeof L!="boolean"?e.type=L:e.removeAttribute("type"),i!=null?L==="number"?(i===0&&e.value===""||e.value!=i)&&(e.value=""+Ps(i)):e.value!==""+Ps(i)&&(e.value=""+Ps(i)):L!=="submit"&&L!=="reset"||e.removeAttribute("value"),i!=null?$r(e,L,Ps(i)):a!=null?$r(e,L,Ps(a)):o!=null&&e.removeAttribute("value"),_==null&&w!=null&&(e.defaultChecked=!!w),_!=null&&(e.checked=_&&typeof _!="function"&&typeof _!="symbol"),P!=null&&typeof P!="function"&&typeof P!="symbol"&&typeof P!="boolean"?e.name=""+Ps(P):e.removeAttribute("name")}function qa(e,i,a,o,_,w,L,P){if(w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(e.type=w),i!=null||a!=null){if(!(w!=="submit"&&w!=="reset"||i!=null)){Ir(e);return}a=a!=null?""+Ps(a):"",i=i!=null?""+Ps(i):a,P||i===e.value||(e.value=i),e.defaultValue=i}o=o??_,o=typeof o!="function"&&typeof o!="symbol"&&!!o,e.checked=P?e.checked:!!o,e.defaultChecked=!!o,L!=null&&typeof L!="function"&&typeof L!="symbol"&&typeof L!="boolean"&&(e.name=L),Ir(e)}function $r(e,i,a){i==="number"&&nr(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function Yi(e,i,a,o){if(e=e.options,i){i={};for(var _=0;_<a.length;_++)i["$"+a[_]]=!0;for(a=0;a<e.length;a++)_=i.hasOwnProperty("$"+e[a].value),e[a].selected!==_&&(e[a].selected=_),_&&o&&(e[a].defaultSelected=!0)}else{for(a=""+Ps(a),i=null,_=0;_<e.length;_++){if(e[_].value===a){e[_].selected=!0,o&&(e[_].defaultSelected=!0);return}i!==null||e[_].disabled||(i=e[_])}i!==null&&(i.selected=!0)}}function Wa(e,i,a){if(i!=null&&(i=""+Ps(i),i!==e.value&&(e.value=i),a==null)){e.defaultValue!==i&&(e.defaultValue=i);return}e.defaultValue=a!=null?""+Ps(a):""}function Ga(e,i,a,o){if(i==null){if(o!=null){if(a!=null)throw Error(r(92));if(se(o)){if(1<o.length)throw Error(r(93));o=o[0]}a=o}a==null&&(a=""),i=a}a=Ps(i),e.defaultValue=a,o=e.textContent,o===a&&o!==""&&o!==null&&(e.value=o),Ir(e)}function Ki(e,i){if(i){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=i;return}}e.textContent=i}var Tl=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 Va(e,i,a){var o=i.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?o?e.setProperty(i,""):i==="float"?e.cssFloat="":e[i]="":o?e.setProperty(i,a):typeof a!="number"||a===0||Tl.has(i)?i==="float"?e.cssFloat=a:e[i]=(""+a).trim():e[i]=a+"px"}function Ya(e,i,a){if(i!=null&&typeof i!="object")throw Error(r(62));if(e=e.style,a!=null){for(var o in a)!a.hasOwnProperty(o)||i!=null&&i.hasOwnProperty(o)||(o.indexOf("--")===0?e.setProperty(o,""):o==="float"?e.cssFloat="":e[o]="");for(var _ in i)o=i[_],i.hasOwnProperty(_)&&a[_]!==o&&Va(e,_,o)}else for(var w in i)i.hasOwnProperty(w)&&Va(e,w,i[w])}function Pr(e){if(e.indexOf("-")===-1)return!1;switch(e){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 Al=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"]]),Rl=/^[\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 V(e){return Rl.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function ve(){}var je=null;function Ve(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var yt=null,rs=null;function vs(e){var i=Pe(e);if(i&&(e=i.stateNode)){var a=e[Fe]||null;e:switch(e=i.stateNode,i.type){case"input":if(zr(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),i=a.name,a.type==="radio"&&i!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Us(""+i)+'"][type="radio"]'),i=0;i<a.length;i++){var o=a[i];if(o!==e&&o.form===e.form){var _=o[Fe]||null;if(!_)throw Error(r(90));zr(o,_.value,_.defaultValue,_.defaultValue,_.checked,_.defaultChecked,_.type,_.name)}}for(i=0;i<a.length;i++)o=a[i],o.form===e.form&&Fa(o)}break e;case"textarea":Wa(e,a.value,a.defaultValue);break e;case"select":i=a.value,i!=null&&Yi(e,!!a.multiple,i,!1)}}}var Ur=!1;function _v(e,i,a){if(Ur)return e(i,a);Ur=!0;try{var o=e(i);return o}finally{if(Ur=!1,(yt!==null||rs!==null)&&(mc(),yt&&(i=yt,e=rs,rs=yt=null,vs(i),e)))for(i=0;i<e.length;i++)vs(e[i])}}function Ka(e,i){var a=e.stateNode;if(a===null)return null;var o=a[Fe]||null;if(o===null)return null;a=o[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":(o=!o.disabled)||(e=e.type,o=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!o;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(r(231,i,typeof a));return a}var Xi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Yu=!1;if(Xi)try{var Xa={};Object.defineProperty(Xa,"passive",{get:function(){Yu=!0}}),window.addEventListener("test",Xa,Xa),window.removeEventListener("test",Xa,Xa)}catch{Yu=!1}var kn=null,Ku=null,Ml=null;function yv(){if(Ml)return Ml;var e,i=Ku,a=i.length,o,_="value"in kn?kn.value:kn.textContent,w=_.length;for(e=0;e<a&&i[e]===_[e];e++);var L=a-e;for(o=1;o<=L&&i[a-o]===_[w-o];o++);return Ml=_.slice(e,1<o?1-o:void 0)}function jl(e){var i=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&i===13&&(e=13)):e=i,e===10&&(e=13),32<=e||e===13?e:0}function Dl(){return!0}function bv(){return!1}function Ys(e){function i(a,o,_,w,L){this._reactName=a,this._targetInst=_,this.type=o,this.nativeEvent=w,this.target=L,this.currentTarget=null;for(var P in e)e.hasOwnProperty(P)&&(a=e[P],this[P]=a?a(w):w[P]);return this.isDefaultPrevented=(w.defaultPrevented!=null?w.defaultPrevented:w.returnValue===!1)?Dl:bv,this.isPropagationStopped=bv,this}return f(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Dl)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Dl)},persist:function(){},isPersistent:Dl}),i}var rr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Nl=Ys(rr),Ja=f({},rr,{view:0,detail:0}),kS=Ys(Ja),Xu,Ju,Za,Ll=f({},Ja,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Qu,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Za&&(Za&&e.type==="mousemove"?(Xu=e.screenX-Za.screenX,Ju=e.screenY-Za.screenY):Ju=Xu=0,Za=e),Xu)},movementY:function(e){return"movementY"in e?e.movementY:Ju}}),Sv=Ys(Ll),TS=f({},Ll,{dataTransfer:0}),AS=Ys(TS),RS=f({},Ja,{relatedTarget:0}),Zu=Ys(RS),MS=f({},rr,{animationName:0,elapsedTime:0,pseudoElement:0}),jS=Ys(MS),DS=f({},rr,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),NS=Ys(DS),LS=f({},rr,{data:0}),wv=Ys(LS),OS={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},BS={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"},HS={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function IS(e){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(e):(e=HS[e])?!!i[e]:!1}function Qu(){return IS}var zS=f({},Ja,{key:function(e){if(e.key){var i=OS[e.key]||e.key;if(i!=="Unidentified")return i}return e.type==="keypress"?(e=jl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?BS[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Qu,charCode:function(e){return e.type==="keypress"?jl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?jl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),$S=Ys(zS),PS=f({},Ll,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),xv=Ys(PS),US=f({},Ja,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Qu}),FS=Ys(US),qS=f({},rr,{propertyName:0,elapsedTime:0,pseudoElement:0}),WS=Ys(qS),GS=f({},Ll,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),VS=Ys(GS),YS=f({},rr,{newState:0,oldState:0}),KS=Ys(YS),XS=[9,13,27,32],eh=Xi&&"CompositionEvent"in window,Qa=null;Xi&&"documentMode"in document&&(Qa=document.documentMode);var JS=Xi&&"TextEvent"in window&&!Qa,Cv=Xi&&(!eh||Qa&&8<Qa&&11>=Qa),Ev=" ",kv=!1;function Tv(e,i){switch(e){case"keyup":return XS.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Av(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Fr=!1;function ZS(e,i){switch(e){case"compositionend":return Av(i);case"keypress":return i.which!==32?null:(kv=!0,Ev);case"textInput":return e=i.data,e===Ev&&kv?null:e;default:return null}}function QS(e,i){if(Fr)return e==="compositionend"||!eh&&Tv(e,i)?(e=yv(),Ml=Ku=kn=null,Fr=!1,e):null;switch(e){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 Cv&&i.locale!=="ko"?null:i.data;default:return null}}var ew={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 Rv(e){var i=e&&e.nodeName&&e.nodeName.toLowerCase();return i==="input"?!!ew[e.type]:i==="textarea"}function Mv(e,i,a,o){yt?rs?rs.push(o):rs=[o]:yt=o,i=xc(i,"onChange"),0<i.length&&(a=new Nl("onChange","change",null,a,o),e.push({event:a,listeners:i}))}var eo=null,to=null;function tw(e){d_(e,0)}function Ol(e){var i=ls(e);if(Fa(i))return e}function jv(e,i){if(e==="change")return i}var Dv=!1;if(Xi){var th;if(Xi){var sh="oninput"in document;if(!sh){var Nv=document.createElement("div");Nv.setAttribute("oninput","return;"),sh=typeof Nv.oninput=="function"}th=sh}else th=!1;Dv=th&&(!document.documentMode||9<document.documentMode)}function Lv(){eo&&(eo.detachEvent("onpropertychange",Ov),to=eo=null)}function Ov(e){if(e.propertyName==="value"&&Ol(to)){var i=[];Mv(i,to,e,Ve(e)),_v(tw,i)}}function sw(e,i,a){e==="focusin"?(Lv(),eo=i,to=a,eo.attachEvent("onpropertychange",Ov)):e==="focusout"&&Lv()}function iw(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Ol(to)}function nw(e,i){if(e==="click")return Ol(i)}function rw(e,i){if(e==="input"||e==="change")return Ol(i)}function aw(e,i){return e===i&&(e!==0||1/e===1/i)||e!==e&&i!==i}var ri=typeof Object.is=="function"?Object.is:aw;function so(e,i){if(ri(e,i))return!0;if(typeof e!="object"||e===null||typeof i!="object"||i===null)return!1;var a=Object.keys(e),o=Object.keys(i);if(a.length!==o.length)return!1;for(o=0;o<a.length;o++){var _=a[o];if(!pt.call(i,_)||!ri(e[_],i[_]))return!1}return!0}function Bv(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Hv(e,i){var a=Bv(e);e=0;for(var o;a;){if(a.nodeType===3){if(o=e+a.textContent.length,e<=i&&o>=i)return{node:a,offset:i-e};e=o}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Bv(a)}}function Iv(e,i){return e&&i?e===i?!0:e&&e.nodeType===3?!1:i&&i.nodeType===3?Iv(e,i.parentNode):"contains"in e?e.contains(i):e.compareDocumentPosition?!!(e.compareDocumentPosition(i)&16):!1:!1}function zv(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var i=nr(e.document);i instanceof e.HTMLIFrameElement;){try{var a=typeof i.contentWindow.location.href=="string"}catch{a=!1}if(a)e=i.contentWindow;else break;i=nr(e.document)}return i}function ih(e){var i=e&&e.nodeName&&e.nodeName.toLowerCase();return i&&(i==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||i==="textarea"||e.contentEditable==="true")}var ow=Xi&&"documentMode"in document&&11>=document.documentMode,qr=null,nh=null,io=null,rh=!1;function $v(e,i,a){var o=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;rh||qr==null||qr!==nr(o)||(o=qr,"selectionStart"in o&&ih(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),io&&so(io,o)||(io=o,o=xc(nh,"onSelect"),0<o.length&&(i=new Nl("onSelect","select",null,i,a),e.push({event:i,listeners:o}),i.target=qr)))}function ar(e,i){var a={};return a[e.toLowerCase()]=i.toLowerCase(),a["Webkit"+e]="webkit"+i,a["Moz"+e]="moz"+i,a}var Wr={animationend:ar("Animation","AnimationEnd"),animationiteration:ar("Animation","AnimationIteration"),animationstart:ar("Animation","AnimationStart"),transitionrun:ar("Transition","TransitionRun"),transitionstart:ar("Transition","TransitionStart"),transitioncancel:ar("Transition","TransitionCancel"),transitionend:ar("Transition","TransitionEnd")},ah={},Pv={};Xi&&(Pv=document.createElement("div").style,"AnimationEvent"in window||(delete Wr.animationend.animation,delete Wr.animationiteration.animation,delete Wr.animationstart.animation),"TransitionEvent"in window||delete Wr.transitionend.transition);function or(e){if(ah[e])return ah[e];if(!Wr[e])return e;var i=Wr[e],a;for(a in i)if(i.hasOwnProperty(a)&&a in Pv)return ah[e]=i[a];return e}var Uv=or("animationend"),Fv=or("animationiteration"),qv=or("animationstart"),lw=or("transitionrun"),cw=or("transitionstart"),uw=or("transitioncancel"),Wv=or("transitionend"),Gv=new Map,oh="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(" ");oh.push("scrollEnd");function Di(e,i){Gv.set(e,i),ns(i,[e])}var Bl=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var i=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(i))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},gi=[],Gr=0,lh=0;function Hl(){for(var e=Gr,i=lh=Gr=0;i<e;){var a=gi[i];gi[i++]=null;var o=gi[i];gi[i++]=null;var _=gi[i];gi[i++]=null;var w=gi[i];if(gi[i++]=null,o!==null&&_!==null){var L=o.pending;L===null?_.next=_:(_.next=L.next,L.next=_),o.pending=_}w!==0&&Vv(a,_,w)}}function Il(e,i,a,o){gi[Gr++]=e,gi[Gr++]=i,gi[Gr++]=a,gi[Gr++]=o,lh|=o,e.lanes|=o,e=e.alternate,e!==null&&(e.lanes|=o)}function ch(e,i,a,o){return Il(e,i,a,o),zl(e)}function lr(e,i){return Il(e,null,null,i),zl(e)}function Vv(e,i,a){e.lanes|=a;var o=e.alternate;o!==null&&(o.lanes|=a);for(var _=!1,w=e.return;w!==null;)w.childLanes|=a,o=w.alternate,o!==null&&(o.childLanes|=a),w.tag===22&&(e=w.stateNode,e===null||e._visibility&1||(_=!0)),e=w,w=w.return;return e.tag===3?(w=e.stateNode,_&&i!==null&&(_=31-kt(a),e=w.hiddenUpdates,o=e[_],o===null?e[_]=[i]:o.push(i),i.lane=a|536870912),w):null}function zl(e){if(50<ko)throw ko=0,_d=null,Error(r(185));for(var i=e.return;i!==null;)e=i,i=e.return;return e.tag===3?e.stateNode:null}var Vr={};function hw(e,i,a,o){this.tag=e,this.key=a,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=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ai(e,i,a,o){return new hw(e,i,a,o)}function uh(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ji(e,i){var a=e.alternate;return a===null?(a=ai(e.tag,i,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=i,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,i=e.dependencies,a.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function Yv(e,i){e.flags&=65011714;var a=e.alternate;return a===null?(e.childLanes=0,e.lanes=i,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,i=a.dependencies,e.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),e}function $l(e,i,a,o,_,w){var L=0;if(o=e,typeof e=="function")uh(e)&&(L=1);else if(typeof e=="string")L=mx(e,a,Z.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case D:return e=ai(31,a,i,_),e.elementType=D,e.lanes=w,e;case C:return cr(a.children,_,w,i);case y:L=8,_|=24;break;case b:return e=ai(12,a,i,_|2),e.elementType=b,e.lanes=w,e;case M:return e=ai(13,a,i,_),e.elementType=M,e.lanes=w,e;case R:return e=ai(19,a,i,_),e.elementType=R,e.lanes=w,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case g:L=10;break e;case m:L=9;break e;case k:L=11;break e;case j:L=14;break e;case A:L=16,o=null;break e}L=29,a=Error(r(130,e===null?"null":typeof e,"")),o=null}return i=ai(L,a,i,_),i.elementType=e,i.type=o,i.lanes=w,i}function cr(e,i,a,o){return e=ai(7,e,o,i),e.lanes=a,e}function hh(e,i,a){return e=ai(6,e,null,i),e.lanes=a,e}function Kv(e){var i=ai(18,null,null,0);return i.stateNode=e,i}function dh(e,i,a){return i=ai(4,e.children!==null?e.children:[],e.key,i),i.lanes=a,i.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},i}var Xv=new WeakMap;function _i(e,i){if(typeof e=="object"&&e!==null){var a=Xv.get(e);return a!==void 0?a:(i={value:e,source:i,stack:Dt(i)},Xv.set(e,i),i)}return{value:e,source:i,stack:Dt(i)}}var Yr=[],Kr=0,Pl=null,no=0,yi=[],bi=0,Tn=null,$i=1,Pi="";function Zi(e,i){Yr[Kr++]=no,Yr[Kr++]=Pl,Pl=e,no=i}function Jv(e,i,a){yi[bi++]=$i,yi[bi++]=Pi,yi[bi++]=Tn,Tn=e;var o=$i;e=Pi;var _=32-kt(o)-1;o&=~(1<<_),a+=1;var w=32-kt(i)+_;if(30<w){var L=_-_%5;w=(o&(1<<L)-1).toString(32),o>>=L,_-=L,$i=1<<32-kt(i)+_|a<<_|o,Pi=w+e}else $i=1<<w|a<<_|o,Pi=e}function fh(e){e.return!==null&&(Zi(e,1),Jv(e,1,0))}function ph(e){for(;e===Pl;)Pl=Yr[--Kr],Yr[Kr]=null,no=Yr[--Kr],Yr[Kr]=null;for(;e===Tn;)Tn=yi[--bi],yi[bi]=null,Pi=yi[--bi],yi[bi]=null,$i=yi[--bi],yi[bi]=null}function Zv(e,i){yi[bi++]=$i,yi[bi++]=Pi,yi[bi++]=Tn,$i=i.id,Pi=i.overflow,Tn=e}var As=null,Gt=null,ft=!1,An=null,Si=!1,vh=Error(r(519));function Rn(e){var i=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ro(_i(i,e)),vh}function Qv(e){var i=e.stateNode,a=e.type,o=e.memoizedProps;switch(i[ke]=e,i[Fe]=o,a){case"dialog":lt("cancel",i),lt("close",i);break;case"iframe":case"object":case"embed":lt("load",i);break;case"video":case"audio":for(a=0;a<Ao.length;a++)lt(Ao[a],i);break;case"source":lt("error",i);break;case"img":case"image":case"link":lt("error",i),lt("load",i);break;case"details":lt("toggle",i);break;case"input":lt("invalid",i),qa(i,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":lt("invalid",i);break;case"textarea":lt("invalid",i),Ga(i,o.value,o.defaultValue,o.children)}a=o.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||i.textContent===""+a||o.suppressHydrationWarning===!0||m_(i.textContent,a)?(o.popover!=null&&(lt("beforetoggle",i),lt("toggle",i)),o.onScroll!=null&<("scroll",i),o.onScrollEnd!=null&<("scrollend",i),o.onClick!=null&&(i.onclick=ve),i=!0):i=!1,i||Rn(e,!0)}function em(e){for(As=e.return;As;)switch(As.tag){case 5:case 31:case 13:Si=!1;return;case 27:case 3:Si=!0;return;default:As=As.return}}function Xr(e){if(e!==As)return!1;if(!ft)return em(e),ft=!0,!1;var i=e.tag,a;if((a=i!==3&&i!==27)&&((a=i===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||Nd(e.type,e.memoizedProps)),a=!a),a&&Gt&&Rn(e),em(e),i===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));Gt=E_(e)}else if(i===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));Gt=E_(e)}else i===27?(i=Gt,Fn(e.type)?(e=Id,Id=null,Gt=e):Gt=i):Gt=As?xi(e.stateNode.nextSibling):null;return!0}function ur(){Gt=As=null,ft=!1}function mh(){var e=An;return e!==null&&(Zs===null?Zs=e:Zs.push.apply(Zs,e),An=null),e}function ro(e){An===null?An=[e]:An.push(e)}var gh=N(null),hr=null,Qi=null;function Mn(e,i,a){W(gh,i._currentValue),i._currentValue=a}function en(e){e._currentValue=gh.current,z(gh)}function _h(e,i,a){for(;e!==null;){var o=e.alternate;if((e.childLanes&i)!==i?(e.childLanes|=i,o!==null&&(o.childLanes|=i)):o!==null&&(o.childLanes&i)!==i&&(o.childLanes|=i),e===a)break;e=e.return}}function yh(e,i,a,o){var _=e.child;for(_!==null&&(_.return=e);_!==null;){var w=_.dependencies;if(w!==null){var L=_.child;w=w.firstContext;e:for(;w!==null;){var P=w;w=_;for(var K=0;K<i.length;K++)if(P.context===i[K]){w.lanes|=a,P=w.alternate,P!==null&&(P.lanes|=a),_h(w.return,a,e),o||(L=null);break e}w=P.next}}else if(_.tag===18){if(L=_.return,L===null)throw Error(r(341));L.lanes|=a,w=L.alternate,w!==null&&(w.lanes|=a),_h(L,a,e),L=null}else L=_.child;if(L!==null)L.return=_;else for(L=_;L!==null;){if(L===e){L=null;break}if(_=L.sibling,_!==null){_.return=L.return,L=_;break}L=L.return}_=L}}function Jr(e,i,a,o){e=null;for(var _=i,w=!1;_!==null;){if(!w){if((_.flags&524288)!==0)w=!0;else if((_.flags&262144)!==0)break}if(_.tag===10){var L=_.alternate;if(L===null)throw Error(r(387));if(L=L.memoizedProps,L!==null){var P=_.type;ri(_.pendingProps.value,L.value)||(e!==null?e.push(P):e=[P])}}else if(_===Y.current){if(L=_.alternate,L===null)throw Error(r(387));L.memoizedState.memoizedState!==_.memoizedState.memoizedState&&(e!==null?e.push(No):e=[No])}_=_.return}e!==null&&yh(i,e,a,o),i.flags|=262144}function Ul(e){for(e=e.firstContext;e!==null;){if(!ri(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function dr(e){hr=e,Qi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Rs(e){return tm(hr,e)}function Fl(e,i){return hr===null&&dr(e),tm(e,i)}function tm(e,i){var a=i._currentValue;if(i={context:i,memoizedValue:a,next:null},Qi===null){if(e===null)throw Error(r(308));Qi=i,e.dependencies={lanes:0,firstContext:i},e.flags|=524288}else Qi=Qi.next=i;return a}var dw=typeof AbortController<"u"?AbortController:function(){var e=[],i=this.signal={aborted:!1,addEventListener:function(a,o){e.push(o)}};this.abort=function(){i.aborted=!0,e.forEach(function(a){return a()})}},fw=s.unstable_scheduleCallback,pw=s.unstable_NormalPriority,ms={$$typeof:g,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function bh(){return{controller:new dw,data:new Map,refCount:0}}function ao(e){e.refCount--,e.refCount===0&&fw(pw,function(){e.controller.abort()})}var oo=null,Sh=0,Zr=0,Qr=null;function vw(e,i){if(oo===null){var a=oo=[];Sh=0,Zr=Cd(),Qr={status:"pending",value:void 0,then:function(o){a.push(o)}}}return Sh++,i.then(sm,sm),i}function sm(){if(--Sh===0&&oo!==null){Qr!==null&&(Qr.status="fulfilled");var e=oo;oo=null,Zr=0,Qr=null;for(var i=0;i<e.length;i++)(0,e[i])()}}function mw(e,i){var a=[],o={status:"pending",value:null,reason:null,then:function(_){a.push(_)}};return e.then(function(){o.status="fulfilled",o.value=i;for(var _=0;_<a.length;_++)(0,a[_])(i)},function(_){for(o.status="rejected",o.reason=_,_=0;_<a.length;_++)(0,a[_])(void 0)}),o}var im=F.S;F.S=function(e,i){$g=vt(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&vw(e,i),im!==null&&im(e,i)};var fr=N(null);function wh(){var e=fr.current;return e!==null?e:Pt.pooledCache}function ql(e,i){i===null?W(fr,fr.current):W(fr,i.pool)}function nm(){var e=wh();return e===null?null:{parent:ms._currentValue,pool:e}}var ea=Error(r(460)),xh=Error(r(474)),Wl=Error(r(542)),Gl={then:function(){}};function rm(e){return e=e.status,e==="fulfilled"||e==="rejected"}function am(e,i,a){switch(a=e[a],a===void 0?e.push(i):a!==i&&(i.then(ve,ve),i=a),i.status){case"fulfilled":return i.value;case"rejected":throw e=i.reason,lm(e),e;default:if(typeof i.status=="string")i.then(ve,ve);else{if(e=Pt,e!==null&&100<e.shellSuspendCounter)throw Error(r(482));e=i,e.status="pending",e.then(function(o){if(i.status==="pending"){var _=i;_.status="fulfilled",_.value=o}},function(o){if(i.status==="pending"){var _=i;_.status="rejected",_.reason=o}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw e=i.reason,lm(e),e}throw vr=i,ea}}function pr(e){try{var i=e._init;return i(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(vr=a,ea):a}}var vr=null;function om(){if(vr===null)throw Error(r(459));var e=vr;return vr=null,e}function lm(e){if(e===ea||e===Wl)throw Error(r(483))}var ta=null,lo=0;function Vl(e){var i=lo;return lo+=1,ta===null&&(ta=[]),am(ta,e,i)}function co(e,i){i=i.props.ref,e.ref=i!==void 0?i:null}function Yl(e,i){throw i.$$typeof===x?Error(r(525)):(e=Object.prototype.toString.call(i),Error(r(31,e==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":e)))}function cm(e){function i(ie,ee){if(e){var ne=ie.deletions;ne===null?(ie.deletions=[ee],ie.flags|=16):ne.push(ee)}}function a(ie,ee){if(!e)return null;for(;ee!==null;)i(ie,ee),ee=ee.sibling;return null}function o(ie){for(var ee=new Map;ie!==null;)ie.key!==null?ee.set(ie.key,ie):ee.set(ie.index,ie),ie=ie.sibling;return ee}function _(ie,ee){return ie=Ji(ie,ee),ie.index=0,ie.sibling=null,ie}function w(ie,ee,ne){return ie.index=ne,e?(ne=ie.alternate,ne!==null?(ne=ne.index,ne<ee?(ie.flags|=67108866,ee):ne):(ie.flags|=67108866,ee)):(ie.flags|=1048576,ee)}function L(ie){return e&&ie.alternate===null&&(ie.flags|=67108866),ie}function P(ie,ee,ne,be){return ee===null||ee.tag!==6?(ee=hh(ne,ie.mode,be),ee.return=ie,ee):(ee=_(ee,ne),ee.return=ie,ee)}function K(ie,ee,ne,be){var ze=ne.type;return ze===C?me(ie,ee,ne.props.children,be,ne.key):ee!==null&&(ee.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===A&&pr(ze)===ee.type)?(ee=_(ee,ne.props),co(ee,ne),ee.return=ie,ee):(ee=$l(ne.type,ne.key,ne.props,null,ie.mode,be),co(ee,ne),ee.return=ie,ee)}function re(ie,ee,ne,be){return ee===null||ee.tag!==4||ee.stateNode.containerInfo!==ne.containerInfo||ee.stateNode.implementation!==ne.implementation?(ee=dh(ne,ie.mode,be),ee.return=ie,ee):(ee=_(ee,ne.children||[]),ee.return=ie,ee)}function me(ie,ee,ne,be,ze){return ee===null||ee.tag!==7?(ee=cr(ne,ie.mode,be,ze),ee.return=ie,ee):(ee=_(ee,ne),ee.return=ie,ee)}function Se(ie,ee,ne){if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return ee=hh(""+ee,ie.mode,ne),ee.return=ie,ee;if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case E:return ne=$l(ee.type,ee.key,ee.props,null,ie.mode,ne),co(ne,ee),ne.return=ie,ne;case T:return ee=dh(ee,ie.mode,ne),ee.return=ie,ee;case A:return ee=pr(ee),Se(ie,ee,ne)}if(se(ee)||G(ee))return ee=cr(ee,ie.mode,ne,null),ee.return=ie,ee;if(typeof ee.then=="function")return Se(ie,Vl(ee),ne);if(ee.$$typeof===g)return Se(ie,Fl(ie,ee),ne);Yl(ie,ee)}return null}function le(ie,ee,ne,be){var ze=ee!==null?ee.key:null;if(typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint")return ze!==null?null:P(ie,ee,""+ne,be);if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case E:return ne.key===ze?K(ie,ee,ne,be):null;case T:return ne.key===ze?re(ie,ee,ne,be):null;case A:return ne=pr(ne),le(ie,ee,ne,be)}if(se(ne)||G(ne))return ze!==null?null:me(ie,ee,ne,be,null);if(typeof ne.then=="function")return le(ie,ee,Vl(ne),be);if(ne.$$typeof===g)return le(ie,ee,Fl(ie,ne),be);Yl(ie,ne)}return null}function fe(ie,ee,ne,be,ze){if(typeof be=="string"&&be!==""||typeof be=="number"||typeof be=="bigint")return ie=ie.get(ne)||null,P(ee,ie,""+be,ze);if(typeof be=="object"&&be!==null){switch(be.$$typeof){case E:return ie=ie.get(be.key===null?ne:be.key)||null,K(ee,ie,be,ze);case T:return ie=ie.get(be.key===null?ne:be.key)||null,re(ee,ie,be,ze);case A:return be=pr(be),fe(ie,ee,ne,be,ze)}if(se(be)||G(be))return ie=ie.get(ne)||null,me(ee,ie,be,ze,null);if(typeof be.then=="function")return fe(ie,ee,ne,Vl(be),ze);if(be.$$typeof===g)return fe(ie,ee,ne,Fl(ee,be),ze);Yl(ee,be)}return null}function Le(ie,ee,ne,be){for(var ze=null,bt=null,Be=ee,rt=ee=0,ut=null;Be!==null&&rt<ne.length;rt++){Be.index>rt?(ut=Be,Be=null):ut=Be.sibling;var St=le(ie,Be,ne[rt],be);if(St===null){Be===null&&(Be=ut);break}e&&Be&&St.alternate===null&&i(ie,Be),ee=w(St,ee,rt),bt===null?ze=St:bt.sibling=St,bt=St,Be=ut}if(rt===ne.length)return a(ie,Be),ft&&Zi(ie,rt),ze;if(Be===null){for(;rt<ne.length;rt++)Be=Se(ie,ne[rt],be),Be!==null&&(ee=w(Be,ee,rt),bt===null?ze=Be:bt.sibling=Be,bt=Be);return ft&&Zi(ie,rt),ze}for(Be=o(Be);rt<ne.length;rt++)ut=fe(Be,ie,rt,ne[rt],be),ut!==null&&(e&&ut.alternate!==null&&Be.delete(ut.key===null?rt:ut.key),ee=w(ut,ee,rt),bt===null?ze=ut:bt.sibling=ut,bt=ut);return e&&Be.forEach(function(Yn){return i(ie,Yn)}),ft&&Zi(ie,rt),ze}function qe(ie,ee,ne,be){if(ne==null)throw Error(r(151));for(var ze=null,bt=null,Be=ee,rt=ee=0,ut=null,St=ne.next();Be!==null&&!St.done;rt++,St=ne.next()){Be.index>rt?(ut=Be,Be=null):ut=Be.sibling;var Yn=le(ie,Be,St.value,be);if(Yn===null){Be===null&&(Be=ut);break}e&&Be&&Yn.alternate===null&&i(ie,Be),ee=w(Yn,ee,rt),bt===null?ze=Yn:bt.sibling=Yn,bt=Yn,Be=ut}if(St.done)return a(ie,Be),ft&&Zi(ie,rt),ze;if(Be===null){for(;!St.done;rt++,St=ne.next())St=Se(ie,St.value,be),St!==null&&(ee=w(St,ee,rt),bt===null?ze=St:bt.sibling=St,bt=St);return ft&&Zi(ie,rt),ze}for(Be=o(Be);!St.done;rt++,St=ne.next())St=fe(Be,ie,rt,St.value,be),St!==null&&(e&&St.alternate!==null&&Be.delete(St.key===null?rt:St.key),ee=w(St,ee,rt),bt===null?ze=St:bt.sibling=St,bt=St);return e&&Be.forEach(function(Tx){return i(ie,Tx)}),ft&&Zi(ie,rt),ze}function Bt(ie,ee,ne,be){if(typeof ne=="object"&&ne!==null&&ne.type===C&&ne.key===null&&(ne=ne.props.children),typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case E:e:{for(var ze=ne.key;ee!==null;){if(ee.key===ze){if(ze=ne.type,ze===C){if(ee.tag===7){a(ie,ee.sibling),be=_(ee,ne.props.children),be.return=ie,ie=be;break e}}else if(ee.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===A&&pr(ze)===ee.type){a(ie,ee.sibling),be=_(ee,ne.props),co(be,ne),be.return=ie,ie=be;break e}a(ie,ee);break}else i(ie,ee);ee=ee.sibling}ne.type===C?(be=cr(ne.props.children,ie.mode,be,ne.key),be.return=ie,ie=be):(be=$l(ne.type,ne.key,ne.props,null,ie.mode,be),co(be,ne),be.return=ie,ie=be)}return L(ie);case T:e:{for(ze=ne.key;ee!==null;){if(ee.key===ze)if(ee.tag===4&&ee.stateNode.containerInfo===ne.containerInfo&&ee.stateNode.implementation===ne.implementation){a(ie,ee.sibling),be=_(ee,ne.children||[]),be.return=ie,ie=be;break e}else{a(ie,ee);break}else i(ie,ee);ee=ee.sibling}be=dh(ne,ie.mode,be),be.return=ie,ie=be}return L(ie);case A:return ne=pr(ne),Bt(ie,ee,ne,be)}if(se(ne))return Le(ie,ee,ne,be);if(G(ne)){if(ze=G(ne),typeof ze!="function")throw Error(r(150));return ne=ze.call(ne),qe(ie,ee,ne,be)}if(typeof ne.then=="function")return Bt(ie,ee,Vl(ne),be);if(ne.$$typeof===g)return Bt(ie,ee,Fl(ie,ne),be);Yl(ie,ne)}return typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint"?(ne=""+ne,ee!==null&&ee.tag===6?(a(ie,ee.sibling),be=_(ee,ne),be.return=ie,ie=be):(a(ie,ee),be=hh(ne,ie.mode,be),be.return=ie,ie=be),L(ie)):a(ie,ee)}return function(ie,ee,ne,be){try{lo=0;var ze=Bt(ie,ee,ne,be);return ta=null,ze}catch(Be){if(Be===ea||Be===Wl)throw Be;var bt=ai(29,Be,null,ie.mode);return bt.lanes=be,bt.return=ie,bt}finally{}}}var mr=cm(!0),um=cm(!1),jn=!1;function Ch(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Eh(e,i){e=e.updateQueue,i.updateQueue===e&&(i.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Dn(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Nn(e,i,a){var o=e.updateQueue;if(o===null)return null;if(o=o.shared,(wt&2)!==0){var _=o.pending;return _===null?i.next=i:(i.next=_.next,_.next=i),o.pending=i,i=zl(e),Vv(e,null,a),i}return Il(e,o,i,a),zl(e)}function uo(e,i,a){if(i=i.updateQueue,i!==null&&(i=i.shared,(a&4194048)!==0)){var o=i.lanes;o&=e.pendingLanes,a|=o,i.lanes=a,Es(e,a)}}function kh(e,i){var a=e.updateQueue,o=e.alternate;if(o!==null&&(o=o.updateQueue,a===o)){var _=null,w=null;if(a=a.firstBaseUpdate,a!==null){do{var L={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};w===null?_=w=L:w=w.next=L,a=a.next}while(a!==null);w===null?_=w=i:w=w.next=i}else _=w=i;a={baseState:o.baseState,firstBaseUpdate:_,lastBaseUpdate:w,shared:o.shared,callbacks:o.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=i:e.next=i,a.lastBaseUpdate=i}var Th=!1;function ho(){if(Th){var e=Qr;if(e!==null)throw e}}function fo(e,i,a,o){Th=!1;var _=e.updateQueue;jn=!1;var w=_.firstBaseUpdate,L=_.lastBaseUpdate,P=_.shared.pending;if(P!==null){_.shared.pending=null;var K=P,re=K.next;K.next=null,L===null?w=re:L.next=re,L=K;var me=e.alternate;me!==null&&(me=me.updateQueue,P=me.lastBaseUpdate,P!==L&&(P===null?me.firstBaseUpdate=re:P.next=re,me.lastBaseUpdate=K))}if(w!==null){var Se=_.baseState;L=0,me=re=K=null,P=w;do{var le=P.lane&-536870913,fe=le!==P.lane;if(fe?(ct&le)===le:(o&le)===le){le!==0&&le===Zr&&(Th=!0),me!==null&&(me=me.next={lane:0,tag:P.tag,payload:P.payload,callback:null,next:null});e:{var Le=e,qe=P;le=i;var Bt=a;switch(qe.tag){case 1:if(Le=qe.payload,typeof Le=="function"){Se=Le.call(Bt,Se,le);break e}Se=Le;break e;case 3:Le.flags=Le.flags&-65537|128;case 0:if(Le=qe.payload,le=typeof Le=="function"?Le.call(Bt,Se,le):Le,le==null)break e;Se=f({},Se,le);break e;case 2:jn=!0}}le=P.callback,le!==null&&(e.flags|=64,fe&&(e.flags|=8192),fe=_.callbacks,fe===null?_.callbacks=[le]:fe.push(le))}else fe={lane:le,tag:P.tag,payload:P.payload,callback:P.callback,next:null},me===null?(re=me=fe,K=Se):me=me.next=fe,L|=le;if(P=P.next,P===null){if(P=_.shared.pending,P===null)break;fe=P,P=fe.next,fe.next=null,_.lastBaseUpdate=fe,_.shared.pending=null}}while(!0);me===null&&(K=Se),_.baseState=K,_.firstBaseUpdate=re,_.lastBaseUpdate=me,w===null&&(_.shared.lanes=0),In|=L,e.lanes=L,e.memoizedState=Se}}function hm(e,i){if(typeof e!="function")throw Error(r(191,e));e.call(i)}function dm(e,i){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)hm(a[e],i)}var sa=N(null),Kl=N(0);function fm(e,i){e=un,W(Kl,e),W(sa,i),un=e|i.baseLanes}function Ah(){W(Kl,un),W(sa,sa.current)}function Rh(){un=Kl.current,z(sa),z(Kl)}var oi=N(null),wi=null;function Ln(e){var i=e.alternate;W(cs,cs.current&1),W(oi,e),wi===null&&(i===null||sa.current!==null||i.memoizedState!==null)&&(wi=e)}function Mh(e){W(cs,cs.current),W(oi,e),wi===null&&(wi=e)}function pm(e){e.tag===22?(W(cs,cs.current),W(oi,e),wi===null&&(wi=e)):On()}function On(){W(cs,cs.current),W(oi,oi.current)}function li(e){z(oi),wi===e&&(wi=null),z(cs)}var cs=N(0);function Xl(e){for(var i=e;i!==null;){if(i.tag===13){var a=i.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Bd(a)||Hd(a)))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===e)break;for(;i.sibling===null;){if(i.return===null||i.return===e)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var tn=0,it=null,Lt=null,gs=null,Jl=!1,ia=!1,gr=!1,Zl=0,po=0,na=null,gw=0;function as(){throw Error(r(321))}function jh(e,i){if(i===null)return!1;for(var a=0;a<i.length&&a<e.length;a++)if(!ri(e[a],i[a]))return!1;return!0}function Dh(e,i,a,o,_,w){return tn=w,it=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,F.H=e===null||e.memoizedState===null?Jm:Vh,gr=!1,w=a(o,_),gr=!1,ia&&(w=mm(i,a,o,_)),vm(e),w}function vm(e){F.H=go;var i=Lt!==null&&Lt.next!==null;if(tn=0,gs=Lt=it=null,Jl=!1,po=0,na=null,i)throw Error(r(300));e===null||_s||(e=e.dependencies,e!==null&&Ul(e)&&(_s=!0))}function mm(e,i,a,o){it=e;var _=0;do{if(ia&&(na=null),po=0,ia=!1,25<=_)throw Error(r(301));if(_+=1,gs=Lt=null,e.updateQueue!=null){var w=e.updateQueue;w.lastEffect=null,w.events=null,w.stores=null,w.memoCache!=null&&(w.memoCache.index=0)}F.H=Zm,w=i(a,o)}while(ia);return w}function _w(){var e=F.H,i=e.useState()[0];return i=typeof i.then=="function"?vo(i):i,e=e.useState()[0],(Lt!==null?Lt.memoizedState:null)!==e&&(it.flags|=1024),i}function Nh(){var e=Zl!==0;return Zl=0,e}function Lh(e,i,a){i.updateQueue=e.updateQueue,i.flags&=-2053,e.lanes&=~a}function Oh(e){if(Jl){for(e=e.memoizedState;e!==null;){var i=e.queue;i!==null&&(i.pending=null),e=e.next}Jl=!1}tn=0,gs=Lt=it=null,ia=!1,po=Zl=0,na=null}function Fs(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return gs===null?it.memoizedState=gs=e:gs=gs.next=e,gs}function us(){if(Lt===null){var e=it.alternate;e=e!==null?e.memoizedState:null}else e=Lt.next;var i=gs===null?it.memoizedState:gs.next;if(i!==null)gs=i,Lt=e;else{if(e===null)throw it.alternate===null?Error(r(467)):Error(r(310));Lt=e,e={memoizedState:Lt.memoizedState,baseState:Lt.baseState,baseQueue:Lt.baseQueue,queue:Lt.queue,next:null},gs===null?it.memoizedState=gs=e:gs=gs.next=e}return gs}function Ql(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function vo(e){var i=po;return po+=1,na===null&&(na=[]),e=am(na,e,i),i=it,(gs===null?i.memoizedState:gs.next)===null&&(i=i.alternate,F.H=i===null||i.memoizedState===null?Jm:Vh),e}function ec(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return vo(e);if(e.$$typeof===g)return Rs(e)}throw Error(r(438,String(e)))}function Bh(e){var i=null,a=it.updateQueue;if(a!==null&&(i=a.memoCache),i==null){var o=it.alternate;o!==null&&(o=o.updateQueue,o!==null&&(o=o.memoCache,o!=null&&(i={data:o.data.map(function(_){return _.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),a===null&&(a=Ql(),it.updateQueue=a),a.memoCache=i,a=i.data[i.index],a===void 0)for(a=i.data[i.index]=Array(e),o=0;o<e;o++)a[o]=I;return i.index++,a}function sn(e,i){return typeof i=="function"?i(e):i}function tc(e){var i=us();return Hh(i,Lt,e)}function Hh(e,i,a){var o=e.queue;if(o===null)throw Error(r(311));o.lastRenderedReducer=a;var _=e.baseQueue,w=o.pending;if(w!==null){if(_!==null){var L=_.next;_.next=w.next,w.next=L}i.baseQueue=_=w,o.pending=null}if(w=e.baseState,_===null)e.memoizedState=w;else{i=_.next;var P=L=null,K=null,re=i,me=!1;do{var Se=re.lane&-536870913;if(Se!==re.lane?(ct&Se)===Se:(tn&Se)===Se){var le=re.revertLane;if(le===0)K!==null&&(K=K.next={lane:0,revertLane:0,gesture:null,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null}),Se===Zr&&(me=!0);else if((tn&le)===le){re=re.next,le===Zr&&(me=!0);continue}else Se={lane:0,revertLane:re.revertLane,gesture:null,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null},K===null?(P=K=Se,L=w):K=K.next=Se,it.lanes|=le,In|=le;Se=re.action,gr&&a(w,Se),w=re.hasEagerState?re.eagerState:a(w,Se)}else le={lane:Se,revertLane:re.revertLane,gesture:re.gesture,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null},K===null?(P=K=le,L=w):K=K.next=le,it.lanes|=Se,In|=Se;re=re.next}while(re!==null&&re!==i);if(K===null?L=w:K.next=P,!ri(w,e.memoizedState)&&(_s=!0,me&&(a=Qr,a!==null)))throw a;e.memoizedState=w,e.baseState=L,e.baseQueue=K,o.lastRenderedState=w}return _===null&&(o.lanes=0),[e.memoizedState,o.dispatch]}function Ih(e){var i=us(),a=i.queue;if(a===null)throw Error(r(311));a.lastRenderedReducer=e;var o=a.dispatch,_=a.pending,w=i.memoizedState;if(_!==null){a.pending=null;var L=_=_.next;do w=e(w,L.action),L=L.next;while(L!==_);ri(w,i.memoizedState)||(_s=!0),i.memoizedState=w,i.baseQueue===null&&(i.baseState=w),a.lastRenderedState=w}return[w,o]}function gm(e,i,a){var o=it,_=us(),w=ft;if(w){if(a===void 0)throw Error(r(407));a=a()}else a=i();var L=!ri((Lt||_).memoizedState,a);if(L&&(_.memoizedState=a,_s=!0),_=_.queue,Ph(bm.bind(null,o,_,e),[e]),_.getSnapshot!==i||L||gs!==null&&gs.memoizedState.tag&1){if(o.flags|=2048,ra(9,{destroy:void 0},ym.bind(null,o,_,a,i),null),Pt===null)throw Error(r(349));w||(tn&127)!==0||_m(o,i,a)}return a}function _m(e,i,a){e.flags|=16384,e={getSnapshot:i,value:a},i=it.updateQueue,i===null?(i=Ql(),it.updateQueue=i,i.stores=[e]):(a=i.stores,a===null?i.stores=[e]:a.push(e))}function ym(e,i,a,o){i.value=a,i.getSnapshot=o,Sm(i)&&wm(e)}function bm(e,i,a){return a(function(){Sm(i)&&wm(e)})}function Sm(e){var i=e.getSnapshot;e=e.value;try{var a=i();return!ri(e,a)}catch{return!0}}function wm(e){var i=lr(e,2);i!==null&&Qs(i,e,2)}function zh(e){var i=Fs();if(typeof e=="function"){var a=e;if(e=a(),gr){Nt(!0);try{a()}finally{Nt(!1)}}}return i.memoizedState=i.baseState=e,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:sn,lastRenderedState:e},i}function xm(e,i,a,o){return e.baseState=a,Hh(e,Lt,typeof o=="function"?o:sn)}function yw(e,i,a,o,_){if(nc(e))throw Error(r(485));if(e=i.action,e!==null){var w={payload:_,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(L){w.listeners.push(L)}};F.T!==null?a(!0):w.isTransition=!1,o(w),a=i.pending,a===null?(w.next=i.pending=w,Cm(i,w)):(w.next=a.next,i.pending=a.next=w)}}function Cm(e,i){var a=i.action,o=i.payload,_=e.state;if(i.isTransition){var w=F.T,L={};F.T=L;try{var P=a(_,o),K=F.S;K!==null&&K(L,P),Em(e,i,P)}catch(re){$h(e,i,re)}finally{w!==null&&L.types!==null&&(w.types=L.types),F.T=w}}else try{w=a(_,o),Em(e,i,w)}catch(re){$h(e,i,re)}}function Em(e,i,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(o){km(e,i,o)},function(o){return $h(e,i,o)}):km(e,i,a)}function km(e,i,a){i.status="fulfilled",i.value=a,Tm(i),e.state=a,i=e.pending,i!==null&&(a=i.next,a===i?e.pending=null:(a=a.next,i.next=a,Cm(e,a)))}function $h(e,i,a){var o=e.pending;if(e.pending=null,o!==null){o=o.next;do i.status="rejected",i.reason=a,Tm(i),i=i.next;while(i!==o)}e.action=null}function Tm(e){e=e.listeners;for(var i=0;i<e.length;i++)(0,e[i])()}function Am(e,i){return i}function Rm(e,i){if(ft){var a=Pt.formState;if(a!==null){e:{var o=it;if(ft){if(Gt){t:{for(var _=Gt,w=Si;_.nodeType!==8;){if(!w){_=null;break t}if(_=xi(_.nextSibling),_===null){_=null;break t}}w=_.data,_=w==="F!"||w==="F"?_:null}if(_){Gt=xi(_.nextSibling),o=_.data==="F!";break e}}Rn(o)}o=!1}o&&(i=a[0])}}return a=Fs(),a.memoizedState=a.baseState=i,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Am,lastRenderedState:i},a.queue=o,a=Ym.bind(null,it,o),o.dispatch=a,o=zh(!1),w=Gh.bind(null,it,!1,o.queue),o=Fs(),_={state:i,dispatch:null,action:e,pending:null},o.queue=_,a=yw.bind(null,it,_,w,a),_.dispatch=a,o.memoizedState=e,[i,a,!1]}function Mm(e){var i=us();return jm(i,Lt,e)}function jm(e,i,a){if(i=Hh(e,i,Am)[0],e=tc(sn)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var o=vo(i)}catch(L){throw L===ea?Wl:L}else o=i;i=us();var _=i.queue,w=_.dispatch;return a!==i.memoizedState&&(it.flags|=2048,ra(9,{destroy:void 0},bw.bind(null,_,a),null)),[o,w,e]}function bw(e,i){e.action=i}function Dm(e){var i=us(),a=Lt;if(a!==null)return jm(i,a,e);us(),i=i.memoizedState,a=us();var o=a.queue.dispatch;return a.memoizedState=e,[i,o,!1]}function ra(e,i,a,o){return e={tag:e,create:a,deps:o,inst:i,next:null},i=it.updateQueue,i===null&&(i=Ql(),it.updateQueue=i),a=i.lastEffect,a===null?i.lastEffect=e.next=e:(o=a.next,a.next=e,e.next=o,i.lastEffect=e),e}function Nm(){return us().memoizedState}function sc(e,i,a,o){var _=Fs();it.flags|=e,_.memoizedState=ra(1|i,{destroy:void 0},a,o===void 0?null:o)}function ic(e,i,a,o){var _=us();o=o===void 0?null:o;var w=_.memoizedState.inst;Lt!==null&&o!==null&&jh(o,Lt.memoizedState.deps)?_.memoizedState=ra(i,w,a,o):(it.flags|=e,_.memoizedState=ra(1|i,w,a,o))}function Lm(e,i){sc(8390656,8,e,i)}function Ph(e,i){ic(2048,8,e,i)}function Sw(e){it.flags|=4;var i=it.updateQueue;if(i===null)i=Ql(),it.updateQueue=i,i.events=[e];else{var a=i.events;a===null?i.events=[e]:a.push(e)}}function Om(e){var i=us().memoizedState;return Sw({ref:i,nextImpl:e}),function(){if((wt&2)!==0)throw Error(r(440));return i.impl.apply(void 0,arguments)}}function Bm(e,i){return ic(4,2,e,i)}function Hm(e,i){return ic(4,4,e,i)}function Im(e,i){if(typeof i=="function"){e=e();var a=i(e);return function(){typeof a=="function"?a():i(null)}}if(i!=null)return e=e(),i.current=e,function(){i.current=null}}function zm(e,i,a){a=a!=null?a.concat([e]):null,ic(4,4,Im.bind(null,i,e),a)}function Uh(){}function $m(e,i){var a=us();i=i===void 0?null:i;var o=a.memoizedState;return i!==null&&jh(i,o[1])?o[0]:(a.memoizedState=[e,i],e)}function Pm(e,i){var a=us();i=i===void 0?null:i;var o=a.memoizedState;if(i!==null&&jh(i,o[1]))return o[0];if(o=e(),gr){Nt(!0);try{e()}finally{Nt(!1)}}return a.memoizedState=[o,i],o}function Fh(e,i,a){return a===void 0||(tn&1073741824)!==0&&(ct&261930)===0?e.memoizedState=i:(e.memoizedState=a,e=Ug(),it.lanes|=e,In|=e,a)}function Um(e,i,a,o){return ri(a,i)?a:sa.current!==null?(e=Fh(e,a,o),ri(e,i)||(_s=!0),e):(tn&42)===0||(tn&1073741824)!==0&&(ct&261930)===0?(_s=!0,e.memoizedState=a):(e=Ug(),it.lanes|=e,In|=e,i)}function Fm(e,i,a,o,_){var w=Q.p;Q.p=w!==0&&8>w?w:8;var L=F.T,P={};F.T=P,Gh(e,!1,i,a);try{var K=_(),re=F.S;if(re!==null&&re(P,K),K!==null&&typeof K=="object"&&typeof K.then=="function"){var me=mw(K,o);mo(e,i,me,hi(e))}else mo(e,i,o,hi(e))}catch(Se){mo(e,i,{then:function(){},status:"rejected",reason:Se},hi())}finally{Q.p=w,L!==null&&P.types!==null&&(L.types=P.types),F.T=L}}function ww(){}function qh(e,i,a,o){if(e.tag!==5)throw Error(r(476));var _=qm(e).queue;Fm(e,_,i,J,a===null?ww:function(){return Wm(e),a(o)})}function qm(e){var i=e.memoizedState;if(i!==null)return i;i={memoizedState:J,baseState:J,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:sn,lastRenderedState:J},next:null};var a={};return i.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:sn,lastRenderedState:a},next:null},e.memoizedState=i,e=e.alternate,e!==null&&(e.memoizedState=i),i}function Wm(e){var i=qm(e);i.next===null&&(i=e.alternate.memoizedState),mo(e,i.next.queue,{},hi())}function Wh(){return Rs(No)}function Gm(){return us().memoizedState}function Vm(){return us().memoizedState}function xw(e){for(var i=e.return;i!==null;){switch(i.tag){case 24:case 3:var a=hi();e=Dn(a);var o=Nn(i,e,a);o!==null&&(Qs(o,i,a),uo(o,i,a)),i={cache:bh()},e.payload=i;return}i=i.return}}function Cw(e,i,a){var o=hi();a={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},nc(e)?Km(i,a):(a=ch(e,i,a,o),a!==null&&(Qs(a,e,o),Xm(a,i,o)))}function Ym(e,i,a){var o=hi();mo(e,i,a,o)}function mo(e,i,a,o){var _={lane:o,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(nc(e))Km(i,_);else{var w=e.alternate;if(e.lanes===0&&(w===null||w.lanes===0)&&(w=i.lastRenderedReducer,w!==null))try{var L=i.lastRenderedState,P=w(L,a);if(_.hasEagerState=!0,_.eagerState=P,ri(P,L))return Il(e,i,_,0),Pt===null&&Hl(),!1}catch{}finally{}if(a=ch(e,i,_,o),a!==null)return Qs(a,e,o),Xm(a,i,o),!0}return!1}function Gh(e,i,a,o){if(o={lane:2,revertLane:Cd(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},nc(e)){if(i)throw Error(r(479))}else i=ch(e,a,o,2),i!==null&&Qs(i,e,2)}function nc(e){var i=e.alternate;return e===it||i!==null&&i===it}function Km(e,i){ia=Jl=!0;var a=e.pending;a===null?i.next=i:(i.next=a.next,a.next=i),e.pending=i}function Xm(e,i,a){if((a&4194048)!==0){var o=i.lanes;o&=e.pendingLanes,a|=o,i.lanes=a,Es(e,a)}}var go={readContext:Rs,use:ec,useCallback:as,useContext:as,useEffect:as,useImperativeHandle:as,useLayoutEffect:as,useInsertionEffect:as,useMemo:as,useReducer:as,useRef:as,useState:as,useDebugValue:as,useDeferredValue:as,useTransition:as,useSyncExternalStore:as,useId:as,useHostTransitionStatus:as,useFormState:as,useActionState:as,useOptimistic:as,useMemoCache:as,useCacheRefresh:as};go.useEffectEvent=as;var Jm={readContext:Rs,use:ec,useCallback:function(e,i){return Fs().memoizedState=[e,i===void 0?null:i],e},useContext:Rs,useEffect:Lm,useImperativeHandle:function(e,i,a){a=a!=null?a.concat([e]):null,sc(4194308,4,Im.bind(null,i,e),a)},useLayoutEffect:function(e,i){return sc(4194308,4,e,i)},useInsertionEffect:function(e,i){sc(4,2,e,i)},useMemo:function(e,i){var a=Fs();i=i===void 0?null:i;var o=e();if(gr){Nt(!0);try{e()}finally{Nt(!1)}}return a.memoizedState=[o,i],o},useReducer:function(e,i,a){var o=Fs();if(a!==void 0){var _=a(i);if(gr){Nt(!0);try{a(i)}finally{Nt(!1)}}}else _=i;return o.memoizedState=o.baseState=_,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:_},o.queue=e,e=e.dispatch=Cw.bind(null,it,e),[o.memoizedState,e]},useRef:function(e){var i=Fs();return e={current:e},i.memoizedState=e},useState:function(e){e=zh(e);var i=e.queue,a=Ym.bind(null,it,i);return i.dispatch=a,[e.memoizedState,a]},useDebugValue:Uh,useDeferredValue:function(e,i){var a=Fs();return Fh(a,e,i)},useTransition:function(){var e=zh(!1);return e=Fm.bind(null,it,e.queue,!0,!1),Fs().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,i,a){var o=it,_=Fs();if(ft){if(a===void 0)throw Error(r(407));a=a()}else{if(a=i(),Pt===null)throw Error(r(349));(ct&127)!==0||_m(o,i,a)}_.memoizedState=a;var w={value:a,getSnapshot:i};return _.queue=w,Lm(bm.bind(null,o,w,e),[e]),o.flags|=2048,ra(9,{destroy:void 0},ym.bind(null,o,w,a,i),null),a},useId:function(){var e=Fs(),i=Pt.identifierPrefix;if(ft){var a=Pi,o=$i;a=(o&~(1<<32-kt(o)-1)).toString(32)+a,i="_"+i+"R_"+a,a=Zl++,0<a&&(i+="H"+a.toString(32)),i+="_"}else a=gw++,i="_"+i+"r_"+a.toString(32)+"_";return e.memoizedState=i},useHostTransitionStatus:Wh,useFormState:Rm,useActionState:Rm,useOptimistic:function(e){var i=Fs();i.memoizedState=i.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=a,i=Gh.bind(null,it,!0,a),a.dispatch=i,[e,i]},useMemoCache:Bh,useCacheRefresh:function(){return Fs().memoizedState=xw.bind(null,it)},useEffectEvent:function(e){var i=Fs(),a={impl:e};return i.memoizedState=a,function(){if((wt&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}},Vh={readContext:Rs,use:ec,useCallback:$m,useContext:Rs,useEffect:Ph,useImperativeHandle:zm,useInsertionEffect:Bm,useLayoutEffect:Hm,useMemo:Pm,useReducer:tc,useRef:Nm,useState:function(){return tc(sn)},useDebugValue:Uh,useDeferredValue:function(e,i){var a=us();return Um(a,Lt.memoizedState,e,i)},useTransition:function(){var e=tc(sn)[0],i=us().memoizedState;return[typeof e=="boolean"?e:vo(e),i]},useSyncExternalStore:gm,useId:Gm,useHostTransitionStatus:Wh,useFormState:Mm,useActionState:Mm,useOptimistic:function(e,i){var a=us();return xm(a,Lt,e,i)},useMemoCache:Bh,useCacheRefresh:Vm};Vh.useEffectEvent=Om;var Zm={readContext:Rs,use:ec,useCallback:$m,useContext:Rs,useEffect:Ph,useImperativeHandle:zm,useInsertionEffect:Bm,useLayoutEffect:Hm,useMemo:Pm,useReducer:Ih,useRef:Nm,useState:function(){return Ih(sn)},useDebugValue:Uh,useDeferredValue:function(e,i){var a=us();return Lt===null?Fh(a,e,i):Um(a,Lt.memoizedState,e,i)},useTransition:function(){var e=Ih(sn)[0],i=us().memoizedState;return[typeof e=="boolean"?e:vo(e),i]},useSyncExternalStore:gm,useId:Gm,useHostTransitionStatus:Wh,useFormState:Dm,useActionState:Dm,useOptimistic:function(e,i){var a=us();return Lt!==null?xm(a,Lt,e,i):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:Bh,useCacheRefresh:Vm};Zm.useEffectEvent=Om;function Yh(e,i,a,o){i=e.memoizedState,a=a(o,i),a=a==null?i:f({},i,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var Kh={enqueueSetState:function(e,i,a){e=e._reactInternals;var o=hi(),_=Dn(o);_.payload=i,a!=null&&(_.callback=a),i=Nn(e,_,o),i!==null&&(Qs(i,e,o),uo(i,e,o))},enqueueReplaceState:function(e,i,a){e=e._reactInternals;var o=hi(),_=Dn(o);_.tag=1,_.payload=i,a!=null&&(_.callback=a),i=Nn(e,_,o),i!==null&&(Qs(i,e,o),uo(i,e,o))},enqueueForceUpdate:function(e,i){e=e._reactInternals;var a=hi(),o=Dn(a);o.tag=2,i!=null&&(o.callback=i),i=Nn(e,o,a),i!==null&&(Qs(i,e,a),uo(i,e,a))}};function Qm(e,i,a,o,_,w,L){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(o,w,L):i.prototype&&i.prototype.isPureReactComponent?!so(a,o)||!so(_,w):!0}function eg(e,i,a,o){e=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(a,o),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(a,o),i.state!==e&&Kh.enqueueReplaceState(i,i.state,null)}function _r(e,i){var a=i;if("ref"in i){a={};for(var o in i)o!=="ref"&&(a[o]=i[o])}if(e=e.defaultProps){a===i&&(a=f({},a));for(var _ in e)a[_]===void 0&&(a[_]=e[_])}return a}function tg(e){Bl(e)}function sg(e){console.error(e)}function ig(e){Bl(e)}function rc(e,i){try{var a=e.onUncaughtError;a(i.value,{componentStack:i.stack})}catch(o){setTimeout(function(){throw o})}}function ng(e,i,a){try{var o=e.onCaughtError;o(a.value,{componentStack:a.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(_){setTimeout(function(){throw _})}}function Xh(e,i,a){return a=Dn(a),a.tag=3,a.payload={element:null},a.callback=function(){rc(e,i)},a}function rg(e){return e=Dn(e),e.tag=3,e}function ag(e,i,a,o){var _=a.type.getDerivedStateFromError;if(typeof _=="function"){var w=o.value;e.payload=function(){return _(w)},e.callback=function(){ng(i,a,o)}}var L=a.stateNode;L!==null&&typeof L.componentDidCatch=="function"&&(e.callback=function(){ng(i,a,o),typeof _!="function"&&(zn===null?zn=new Set([this]):zn.add(this));var P=o.stack;this.componentDidCatch(o.value,{componentStack:P!==null?P:""})})}function Ew(e,i,a,o,_){if(a.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(i=a.alternate,i!==null&&Jr(i,a,_,!0),a=oi.current,a!==null){switch(a.tag){case 31:case 13:return wi===null?gc():a.alternate===null&&os===0&&(os=3),a.flags&=-257,a.flags|=65536,a.lanes=_,o===Gl?a.flags|=16384:(i=a.updateQueue,i===null?a.updateQueue=new Set([o]):i.add(o),Sd(e,o,_)),!1;case 22:return a.flags|=65536,o===Gl?a.flags|=16384:(i=a.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([o])},a.updateQueue=i):(a=i.retryQueue,a===null?i.retryQueue=new Set([o]):a.add(o)),Sd(e,o,_)),!1}throw Error(r(435,a.tag))}return Sd(e,o,_),gc(),!1}if(ft)return i=oi.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=_,o!==vh&&(e=Error(r(422),{cause:o}),ro(_i(e,a)))):(o!==vh&&(i=Error(r(423),{cause:o}),ro(_i(i,a))),e=e.current.alternate,e.flags|=65536,_&=-_,e.lanes|=_,o=_i(o,a),_=Xh(e.stateNode,o,_),kh(e,_),os!==4&&(os=2)),!1;var w=Error(r(520),{cause:o});if(w=_i(w,a),Eo===null?Eo=[w]:Eo.push(w),os!==4&&(os=2),i===null)return!0;o=_i(o,a),a=i;do{switch(a.tag){case 3:return a.flags|=65536,e=_&-_,a.lanes|=e,e=Xh(a.stateNode,o,e),kh(a,e),!1;case 1:if(i=a.type,w=a.stateNode,(a.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(zn===null||!zn.has(w))))return a.flags|=65536,_&=-_,a.lanes|=_,_=rg(_),ag(_,e,a,o),kh(a,_),!1}a=a.return}while(a!==null);return!1}var Jh=Error(r(461)),_s=!1;function Ms(e,i,a,o){i.child=e===null?um(i,null,a,o):mr(i,e.child,a,o)}function og(e,i,a,o,_){a=a.render;var w=i.ref;if("ref"in o){var L={};for(var P in o)P!=="ref"&&(L[P]=o[P])}else L=o;return dr(i),o=Dh(e,i,a,L,w,_),P=Nh(),e!==null&&!_s?(Lh(e,i,_),nn(e,i,_)):(ft&&P&&fh(i),i.flags|=1,Ms(e,i,o,_),i.child)}function lg(e,i,a,o,_){if(e===null){var w=a.type;return typeof w=="function"&&!uh(w)&&w.defaultProps===void 0&&a.compare===null?(i.tag=15,i.type=w,cg(e,i,w,o,_)):(e=$l(a.type,null,o,i,i.mode,_),e.ref=i.ref,e.return=i,i.child=e)}if(w=e.child,!rd(e,_)){var L=w.memoizedProps;if(a=a.compare,a=a!==null?a:so,a(L,o)&&e.ref===i.ref)return nn(e,i,_)}return i.flags|=1,e=Ji(w,o),e.ref=i.ref,e.return=i,i.child=e}function cg(e,i,a,o,_){if(e!==null){var w=e.memoizedProps;if(so(w,o)&&e.ref===i.ref)if(_s=!1,i.pendingProps=o=w,rd(e,_))(e.flags&131072)!==0&&(_s=!0);else return i.lanes=e.lanes,nn(e,i,_)}return Zh(e,i,a,o,_)}function ug(e,i,a,o){var _=o.children,w=e!==null?e.memoizedState:null;if(e===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.mode==="hidden"){if((i.flags&128)!==0){if(w=w!==null?w.baseLanes|a:a,e!==null){for(o=i.child=e.child,_=0;o!==null;)_=_|o.lanes|o.childLanes,o=o.sibling;o=_&~w}else o=0,i.child=null;return hg(e,i,w,a,o)}if((a&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},e!==null&&ql(i,w!==null?w.cachePool:null),w!==null?fm(i,w):Ah(),pm(i);else return o=i.lanes=536870912,hg(e,i,w!==null?w.baseLanes|a:a,a,o)}else w!==null?(ql(i,w.cachePool),fm(i,w),On(),i.memoizedState=null):(e!==null&&ql(i,null),Ah(),On());return Ms(e,i,_,a),i.child}function _o(e,i){return e!==null&&e.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function hg(e,i,a,o,_){var w=wh();return w=w===null?null:{parent:ms._currentValue,pool:w},i.memoizedState={baseLanes:a,cachePool:w},e!==null&&ql(i,null),Ah(),pm(i),e!==null&&Jr(e,i,o,!0),i.childLanes=_,null}function ac(e,i){return i=lc({mode:i.mode,children:i.children},e.mode),i.ref=e.ref,e.child=i,i.return=e,i}function dg(e,i,a){return mr(i,e.child,null,a),e=ac(i,i.pendingProps),e.flags|=2,li(i),i.memoizedState=null,e}function kw(e,i,a){var o=i.pendingProps,_=(i.flags&128)!==0;if(i.flags&=-129,e===null){if(ft){if(o.mode==="hidden")return e=ac(i,o),i.lanes=536870912,_o(null,e);if(Mh(i),(e=Gt)?(e=C_(e,Si),e=e!==null&&e.data==="&"?e:null,e!==null&&(i.memoizedState={dehydrated:e,treeContext:Tn!==null?{id:$i,overflow:Pi}:null,retryLane:536870912,hydrationErrors:null},a=Kv(e),a.return=i,i.child=a,As=i,Gt=null)):e=null,e===null)throw Rn(i);return i.lanes=536870912,null}return ac(i,o)}var w=e.memoizedState;if(w!==null){var L=w.dehydrated;if(Mh(i),_)if(i.flags&256)i.flags&=-257,i=dg(e,i,a);else if(i.memoizedState!==null)i.child=e.child,i.flags|=128,i=null;else throw Error(r(558));else if(_s||Jr(e,i,a,!1),_=(a&e.childLanes)!==0,_s||_){if(o=Pt,o!==null&&(L=ni(o,a),L!==0&&L!==w.retryLane))throw w.retryLane=L,lr(e,L),Qs(o,e,L),Jh;gc(),i=dg(e,i,a)}else e=w.treeContext,Gt=xi(L.nextSibling),As=i,ft=!0,An=null,Si=!1,e!==null&&Zv(i,e),i=ac(i,o),i.flags|=4096;return i}return e=Ji(e.child,{mode:o.mode,children:o.children}),e.ref=i.ref,i.child=e,e.return=i,e}function oc(e,i){var a=i.ref;if(a===null)e!==null&&e.ref!==null&&(i.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(r(284));(e===null||e.ref!==a)&&(i.flags|=4194816)}}function Zh(e,i,a,o,_){return dr(i),a=Dh(e,i,a,o,void 0,_),o=Nh(),e!==null&&!_s?(Lh(e,i,_),nn(e,i,_)):(ft&&o&&fh(i),i.flags|=1,Ms(e,i,a,_),i.child)}function fg(e,i,a,o,_,w){return dr(i),i.updateQueue=null,a=mm(i,o,a,_),vm(e),o=Nh(),e!==null&&!_s?(Lh(e,i,w),nn(e,i,w)):(ft&&o&&fh(i),i.flags|=1,Ms(e,i,a,w),i.child)}function pg(e,i,a,o,_){if(dr(i),i.stateNode===null){var w=Vr,L=a.contextType;typeof L=="object"&&L!==null&&(w=Rs(L)),w=new a(o,w),i.memoizedState=w.state!==null&&w.state!==void 0?w.state:null,w.updater=Kh,i.stateNode=w,w._reactInternals=i,w=i.stateNode,w.props=o,w.state=i.memoizedState,w.refs={},Ch(i),L=a.contextType,w.context=typeof L=="object"&&L!==null?Rs(L):Vr,w.state=i.memoizedState,L=a.getDerivedStateFromProps,typeof L=="function"&&(Yh(i,a,L,o),w.state=i.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof w.getSnapshotBeforeUpdate=="function"||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(L=w.state,typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount(),L!==w.state&&Kh.enqueueReplaceState(w,w.state,null),fo(i,o,w,_),ho(),w.state=i.memoizedState),typeof w.componentDidMount=="function"&&(i.flags|=4194308),o=!0}else if(e===null){w=i.stateNode;var P=i.memoizedProps,K=_r(a,P);w.props=K;var re=w.context,me=a.contextType;L=Vr,typeof me=="object"&&me!==null&&(L=Rs(me));var Se=a.getDerivedStateFromProps;me=typeof Se=="function"||typeof w.getSnapshotBeforeUpdate=="function",P=i.pendingProps!==P,me||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(P||re!==L)&&eg(i,w,o,L),jn=!1;var le=i.memoizedState;w.state=le,fo(i,o,w,_),ho(),re=i.memoizedState,P||le!==re||jn?(typeof Se=="function"&&(Yh(i,a,Se,o),re=i.memoizedState),(K=jn||Qm(i,a,K,o,le,re,L))?(me||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount()),typeof w.componentDidMount=="function"&&(i.flags|=4194308)):(typeof w.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=o,i.memoizedState=re),w.props=o,w.state=re,w.context=L,o=K):(typeof w.componentDidMount=="function"&&(i.flags|=4194308),o=!1)}else{w=i.stateNode,Eh(e,i),L=i.memoizedProps,me=_r(a,L),w.props=me,Se=i.pendingProps,le=w.context,re=a.contextType,K=Vr,typeof re=="object"&&re!==null&&(K=Rs(re)),P=a.getDerivedStateFromProps,(re=typeof P=="function"||typeof w.getSnapshotBeforeUpdate=="function")||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(L!==Se||le!==K)&&eg(i,w,o,K),jn=!1,le=i.memoizedState,w.state=le,fo(i,o,w,_),ho();var fe=i.memoizedState;L!==Se||le!==fe||jn||e!==null&&e.dependencies!==null&&Ul(e.dependencies)?(typeof P=="function"&&(Yh(i,a,P,o),fe=i.memoizedState),(me=jn||Qm(i,a,me,o,le,fe,K)||e!==null&&e.dependencies!==null&&Ul(e.dependencies))?(re||typeof w.UNSAFE_componentWillUpdate!="function"&&typeof w.componentWillUpdate!="function"||(typeof w.componentWillUpdate=="function"&&w.componentWillUpdate(o,fe,K),typeof w.UNSAFE_componentWillUpdate=="function"&&w.UNSAFE_componentWillUpdate(o,fe,K)),typeof w.componentDidUpdate=="function"&&(i.flags|=4),typeof w.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof w.componentDidUpdate!="function"||L===e.memoizedProps&&le===e.memoizedState||(i.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||L===e.memoizedProps&&le===e.memoizedState||(i.flags|=1024),i.memoizedProps=o,i.memoizedState=fe),w.props=o,w.state=fe,w.context=K,o=me):(typeof w.componentDidUpdate!="function"||L===e.memoizedProps&&le===e.memoizedState||(i.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||L===e.memoizedProps&&le===e.memoizedState||(i.flags|=1024),o=!1)}return w=o,oc(e,i),o=(i.flags&128)!==0,w||o?(w=i.stateNode,a=o&&typeof a.getDerivedStateFromError!="function"?null:w.render(),i.flags|=1,e!==null&&o?(i.child=mr(i,e.child,null,_),i.child=mr(i,null,a,_)):Ms(e,i,a,_),i.memoizedState=w.state,e=i.child):e=nn(e,i,_),e}function vg(e,i,a,o){return ur(),i.flags|=256,Ms(e,i,a,o),i.child}var Qh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function ed(e){return{baseLanes:e,cachePool:nm()}}function td(e,i,a){return e=e!==null?e.childLanes&~a:0,i&&(e|=ui),e}function mg(e,i,a){var o=i.pendingProps,_=!1,w=(i.flags&128)!==0,L;if((L=w)||(L=e!==null&&e.memoizedState===null?!1:(cs.current&2)!==0),L&&(_=!0,i.flags&=-129),L=(i.flags&32)!==0,i.flags&=-33,e===null){if(ft){if(_?Ln(i):On(),(e=Gt)?(e=C_(e,Si),e=e!==null&&e.data!=="&"?e:null,e!==null&&(i.memoizedState={dehydrated:e,treeContext:Tn!==null?{id:$i,overflow:Pi}:null,retryLane:536870912,hydrationErrors:null},a=Kv(e),a.return=i,i.child=a,As=i,Gt=null)):e=null,e===null)throw Rn(i);return Hd(e)?i.lanes=32:i.lanes=536870912,null}var P=o.children;return o=o.fallback,_?(On(),_=i.mode,P=lc({mode:"hidden",children:P},_),o=cr(o,_,a,null),P.return=i,o.return=i,P.sibling=o,i.child=P,o=i.child,o.memoizedState=ed(a),o.childLanes=td(e,L,a),i.memoizedState=Qh,_o(null,o)):(Ln(i),sd(i,P))}var K=e.memoizedState;if(K!==null&&(P=K.dehydrated,P!==null)){if(w)i.flags&256?(Ln(i),i.flags&=-257,i=id(e,i,a)):i.memoizedState!==null?(On(),i.child=e.child,i.flags|=128,i=null):(On(),P=o.fallback,_=i.mode,o=lc({mode:"visible",children:o.children},_),P=cr(P,_,a,null),P.flags|=2,o.return=i,P.return=i,o.sibling=P,i.child=o,mr(i,e.child,null,a),o=i.child,o.memoizedState=ed(a),o.childLanes=td(e,L,a),i.memoizedState=Qh,i=_o(null,o));else if(Ln(i),Hd(P)){if(L=P.nextSibling&&P.nextSibling.dataset,L)var re=L.dgst;L=re,o=Error(r(419)),o.stack="",o.digest=L,ro({value:o,source:null,stack:null}),i=id(e,i,a)}else if(_s||Jr(e,i,a,!1),L=(a&e.childLanes)!==0,_s||L){if(L=Pt,L!==null&&(o=ni(L,a),o!==0&&o!==K.retryLane))throw K.retryLane=o,lr(e,o),Qs(L,e,o),Jh;Bd(P)||gc(),i=id(e,i,a)}else Bd(P)?(i.flags|=192,i.child=e.child,i=null):(e=K.treeContext,Gt=xi(P.nextSibling),As=i,ft=!0,An=null,Si=!1,e!==null&&Zv(i,e),i=sd(i,o.children),i.flags|=4096);return i}return _?(On(),P=o.fallback,_=i.mode,K=e.child,re=K.sibling,o=Ji(K,{mode:"hidden",children:o.children}),o.subtreeFlags=K.subtreeFlags&65011712,re!==null?P=Ji(re,P):(P=cr(P,_,a,null),P.flags|=2),P.return=i,o.return=i,o.sibling=P,i.child=o,_o(null,o),o=i.child,P=e.child.memoizedState,P===null?P=ed(a):(_=P.cachePool,_!==null?(K=ms._currentValue,_=_.parent!==K?{parent:K,pool:K}:_):_=nm(),P={baseLanes:P.baseLanes|a,cachePool:_}),o.memoizedState=P,o.childLanes=td(e,L,a),i.memoizedState=Qh,_o(e.child,o)):(Ln(i),a=e.child,e=a.sibling,a=Ji(a,{mode:"visible",children:o.children}),a.return=i,a.sibling=null,e!==null&&(L=i.deletions,L===null?(i.deletions=[e],i.flags|=16):L.push(e)),i.child=a,i.memoizedState=null,a)}function sd(e,i){return i=lc({mode:"visible",children:i},e.mode),i.return=e,e.child=i}function lc(e,i){return e=ai(22,e,null,i),e.lanes=0,e}function id(e,i,a){return mr(i,e.child,null,a),e=sd(i,i.pendingProps.children),e.flags|=2,i.memoizedState=null,e}function gg(e,i,a){e.lanes|=i;var o=e.alternate;o!==null&&(o.lanes|=i),_h(e.return,i,a)}function nd(e,i,a,o,_,w){var L=e.memoizedState;L===null?e.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:o,tail:a,tailMode:_,treeForkCount:w}:(L.isBackwards=i,L.rendering=null,L.renderingStartTime=0,L.last=o,L.tail=a,L.tailMode=_,L.treeForkCount=w)}function _g(e,i,a){var o=i.pendingProps,_=o.revealOrder,w=o.tail;o=o.children;var L=cs.current,P=(L&2)!==0;if(P?(L=L&1|2,i.flags|=128):L&=1,W(cs,L),Ms(e,i,o,a),o=ft?no:0,!P&&e!==null&&(e.flags&128)!==0)e:for(e=i.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&gg(e,a,i);else if(e.tag===19)gg(e,a,i);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===i)break e;for(;e.sibling===null;){if(e.return===null||e.return===i)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(_){case"forwards":for(a=i.child,_=null;a!==null;)e=a.alternate,e!==null&&Xl(e)===null&&(_=a),a=a.sibling;a=_,a===null?(_=i.child,i.child=null):(_=a.sibling,a.sibling=null),nd(i,!1,_,a,w,o);break;case"backwards":case"unstable_legacy-backwards":for(a=null,_=i.child,i.child=null;_!==null;){if(e=_.alternate,e!==null&&Xl(e)===null){i.child=_;break}e=_.sibling,_.sibling=a,a=_,_=e}nd(i,!0,a,null,w,o);break;case"together":nd(i,!1,null,null,void 0,o);break;default:i.memoizedState=null}return i.child}function nn(e,i,a){if(e!==null&&(i.dependencies=e.dependencies),In|=i.lanes,(a&i.childLanes)===0)if(e!==null){if(Jr(e,i,a,!1),(a&i.childLanes)===0)return null}else return null;if(e!==null&&i.child!==e.child)throw Error(r(153));if(i.child!==null){for(e=i.child,a=Ji(e,e.pendingProps),i.child=a,a.return=i;e.sibling!==null;)e=e.sibling,a=a.sibling=Ji(e,e.pendingProps),a.return=i;a.sibling=null}return i.child}function rd(e,i){return(e.lanes&i)!==0?!0:(e=e.dependencies,!!(e!==null&&Ul(e)))}function Tw(e,i,a){switch(i.tag){case 3:$(i,i.stateNode.containerInfo),Mn(i,ms,e.memoizedState.cache),ur();break;case 27:case 5:ae(i);break;case 4:$(i,i.stateNode.containerInfo);break;case 10:Mn(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,Mh(i),null;break;case 13:var o=i.memoizedState;if(o!==null)return o.dehydrated!==null?(Ln(i),i.flags|=128,null):(a&i.child.childLanes)!==0?mg(e,i,a):(Ln(i),e=nn(e,i,a),e!==null?e.sibling:null);Ln(i);break;case 19:var _=(e.flags&128)!==0;if(o=(a&i.childLanes)!==0,o||(Jr(e,i,a,!1),o=(a&i.childLanes)!==0),_){if(o)return _g(e,i,a);i.flags|=128}if(_=i.memoizedState,_!==null&&(_.rendering=null,_.tail=null,_.lastEffect=null),W(cs,cs.current),o)break;return null;case 22:return i.lanes=0,ug(e,i,a,i.pendingProps);case 24:Mn(i,ms,e.memoizedState.cache)}return nn(e,i,a)}function yg(e,i,a){if(e!==null)if(e.memoizedProps!==i.pendingProps)_s=!0;else{if(!rd(e,a)&&(i.flags&128)===0)return _s=!1,Tw(e,i,a);_s=(e.flags&131072)!==0}else _s=!1,ft&&(i.flags&1048576)!==0&&Jv(i,no,i.index);switch(i.lanes=0,i.tag){case 16:e:{var o=i.pendingProps;if(e=pr(i.elementType),i.type=e,typeof e=="function")uh(e)?(o=_r(e,o),i.tag=1,i=pg(null,i,e,o,a)):(i.tag=0,i=Zh(null,i,e,o,a));else{if(e!=null){var _=e.$$typeof;if(_===k){i.tag=11,i=og(null,i,e,o,a);break e}else if(_===j){i.tag=14,i=lg(null,i,e,o,a);break e}}throw i=X(e)||e,Error(r(306,i,""))}}return i;case 0:return Zh(e,i,i.type,i.pendingProps,a);case 1:return o=i.type,_=_r(o,i.pendingProps),pg(e,i,o,_,a);case 3:e:{if($(i,i.stateNode.containerInfo),e===null)throw Error(r(387));o=i.pendingProps;var w=i.memoizedState;_=w.element,Eh(e,i),fo(i,o,null,a);var L=i.memoizedState;if(o=L.cache,Mn(i,ms,o),o!==w.cache&&yh(i,[ms],a,!0),ho(),o=L.element,w.isDehydrated)if(w={element:o,isDehydrated:!1,cache:L.cache},i.updateQueue.baseState=w,i.memoizedState=w,i.flags&256){i=vg(e,i,o,a);break e}else if(o!==_){_=_i(Error(r(424)),i),ro(_),i=vg(e,i,o,a);break e}else{switch(e=i.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(Gt=xi(e.firstChild),As=i,ft=!0,An=null,Si=!0,a=um(i,null,o,a),i.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(ur(),o===_){i=nn(e,i,a);break e}Ms(e,i,o,a)}i=i.child}return i;case 26:return oc(e,i),e===null?(a=M_(i.type,null,i.pendingProps,null))?i.memoizedState=a:ft||(a=i.type,e=i.pendingProps,o=Cc(ge.current).createElement(a),o[ke]=i,o[Fe]=e,js(o,a,e),At(o),i.stateNode=o):i.memoizedState=M_(i.type,e.memoizedProps,i.pendingProps,e.memoizedState),null;case 27:return ae(i),e===null&&ft&&(o=i.stateNode=T_(i.type,i.pendingProps,ge.current),As=i,Si=!0,_=Gt,Fn(i.type)?(Id=_,Gt=xi(o.firstChild)):Gt=_),Ms(e,i,i.pendingProps.children,a),oc(e,i),e===null&&(i.flags|=4194304),i.child;case 5:return e===null&&ft&&((_=o=Gt)&&(o=ix(o,i.type,i.pendingProps,Si),o!==null?(i.stateNode=o,As=i,Gt=xi(o.firstChild),Si=!1,_=!0):_=!1),_||Rn(i)),ae(i),_=i.type,w=i.pendingProps,L=e!==null?e.memoizedProps:null,o=w.children,Nd(_,w)?o=null:L!==null&&Nd(_,L)&&(i.flags|=32),i.memoizedState!==null&&(_=Dh(e,i,_w,null,null,a),No._currentValue=_),oc(e,i),Ms(e,i,o,a),i.child;case 6:return e===null&&ft&&((e=a=Gt)&&(a=nx(a,i.pendingProps,Si),a!==null?(i.stateNode=a,As=i,Gt=null,e=!0):e=!1),e||Rn(i)),null;case 13:return mg(e,i,a);case 4:return $(i,i.stateNode.containerInfo),o=i.pendingProps,e===null?i.child=mr(i,null,o,a):Ms(e,i,o,a),i.child;case 11:return og(e,i,i.type,i.pendingProps,a);case 7:return Ms(e,i,i.pendingProps,a),i.child;case 8:return Ms(e,i,i.pendingProps.children,a),i.child;case 12:return Ms(e,i,i.pendingProps.children,a),i.child;case 10:return o=i.pendingProps,Mn(i,i.type,o.value),Ms(e,i,o.children,a),i.child;case 9:return _=i.type._context,o=i.pendingProps.children,dr(i),_=Rs(_),o=o(_),i.flags|=1,Ms(e,i,o,a),i.child;case 14:return lg(e,i,i.type,i.pendingProps,a);case 15:return cg(e,i,i.type,i.pendingProps,a);case 19:return _g(e,i,a);case 31:return kw(e,i,a);case 22:return ug(e,i,a,i.pendingProps);case 24:return dr(i),o=Rs(ms),e===null?(_=wh(),_===null&&(_=Pt,w=bh(),_.pooledCache=w,w.refCount++,w!==null&&(_.pooledCacheLanes|=a),_=w),i.memoizedState={parent:o,cache:_},Ch(i),Mn(i,ms,_)):((e.lanes&a)!==0&&(Eh(e,i),fo(i,null,null,a),ho()),_=e.memoizedState,w=i.memoizedState,_.parent!==o?(_={parent:o,cache:o},i.memoizedState=_,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=_),Mn(i,ms,o)):(o=w.cache,Mn(i,ms,o),o!==_.cache&&yh(i,[ms],a,!0))),Ms(e,i,i.pendingProps.children,a),i.child;case 29:throw i.pendingProps}throw Error(r(156,i.tag))}function rn(e){e.flags|=4}function ad(e,i,a,o,_){if((i=(e.mode&32)!==0)&&(i=!1),i){if(e.flags|=16777216,(_&335544128)===_)if(e.stateNode.complete)e.flags|=8192;else if(Gg())e.flags|=8192;else throw vr=Gl,xh}else e.flags&=-16777217}function bg(e,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!O_(i))if(Gg())e.flags|=8192;else throw vr=Gl,xh}function cc(e,i){i!==null&&(e.flags|=4),e.flags&16384&&(i=e.tag!==22?ws():536870912,e.lanes|=i,ca|=i)}function yo(e,i){if(!ft)switch(e.tailMode){case"hidden":i=e.tail;for(var a=null;i!==null;)i.alternate!==null&&(a=i),i=i.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var o=null;a!==null;)a.alternate!==null&&(o=a),a=a.sibling;o===null?i||e.tail===null?e.tail=null:e.tail.sibling=null:o.sibling=null}}function Vt(e){var i=e.alternate!==null&&e.alternate.child===e.child,a=0,o=0;if(i)for(var _=e.child;_!==null;)a|=_.lanes|_.childLanes,o|=_.subtreeFlags&65011712,o|=_.flags&65011712,_.return=e,_=_.sibling;else for(_=e.child;_!==null;)a|=_.lanes|_.childLanes,o|=_.subtreeFlags,o|=_.flags,_.return=e,_=_.sibling;return e.subtreeFlags|=o,e.childLanes=a,i}function Aw(e,i,a){var o=i.pendingProps;switch(ph(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Vt(i),null;case 1:return Vt(i),null;case 3:return a=i.stateNode,o=null,e!==null&&(o=e.memoizedState.cache),i.memoizedState.cache!==o&&(i.flags|=2048),en(ms),oe(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(Xr(i)?rn(i):e===null||e.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,mh())),Vt(i),null;case 26:var _=i.type,w=i.memoizedState;return e===null?(rn(i),w!==null?(Vt(i),bg(i,w)):(Vt(i),ad(i,_,null,o,a))):w?w!==e.memoizedState?(rn(i),Vt(i),bg(i,w)):(Vt(i),i.flags&=-16777217):(e=e.memoizedProps,e!==o&&rn(i),Vt(i),ad(i,_,e,o,a)),null;case 27:if(xe(i),a=ge.current,_=i.type,e!==null&&i.stateNode!=null)e.memoizedProps!==o&&rn(i);else{if(!o){if(i.stateNode===null)throw Error(r(166));return Vt(i),null}e=Z.current,Xr(i)?Qv(i):(e=T_(_,o,a),i.stateNode=e,rn(i))}return Vt(i),null;case 5:if(xe(i),_=i.type,e!==null&&i.stateNode!=null)e.memoizedProps!==o&&rn(i);else{if(!o){if(i.stateNode===null)throw Error(r(166));return Vt(i),null}if(w=Z.current,Xr(i))Qv(i);else{var L=Cc(ge.current);switch(w){case 1:w=L.createElementNS("http://www.w3.org/2000/svg",_);break;case 2:w=L.createElementNS("http://www.w3.org/1998/Math/MathML",_);break;default:switch(_){case"svg":w=L.createElementNS("http://www.w3.org/2000/svg",_);break;case"math":w=L.createElementNS("http://www.w3.org/1998/Math/MathML",_);break;case"script":w=L.createElement("div"),w.innerHTML="<script><\/script>",w=w.removeChild(w.firstChild);break;case"select":w=typeof o.is=="string"?L.createElement("select",{is:o.is}):L.createElement("select"),o.multiple?w.multiple=!0:o.size&&(w.size=o.size);break;default:w=typeof o.is=="string"?L.createElement(_,{is:o.is}):L.createElement(_)}}w[ke]=i,w[Fe]=o;e:for(L=i.child;L!==null;){if(L.tag===5||L.tag===6)w.appendChild(L.stateNode);else if(L.tag!==4&&L.tag!==27&&L.child!==null){L.child.return=L,L=L.child;continue}if(L===i)break e;for(;L.sibling===null;){if(L.return===null||L.return===i)break e;L=L.return}L.sibling.return=L.return,L=L.sibling}i.stateNode=w;e:switch(js(w,_,o),_){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}o&&rn(i)}}return Vt(i),ad(i,i.type,e===null?null:e.memoizedProps,i.pendingProps,a),null;case 6:if(e&&i.stateNode!=null)e.memoizedProps!==o&&rn(i);else{if(typeof o!="string"&&i.stateNode===null)throw Error(r(166));if(e=ge.current,Xr(i)){if(e=i.stateNode,a=i.memoizedProps,o=null,_=As,_!==null)switch(_.tag){case 27:case 5:o=_.memoizedProps}e[ke]=i,e=!!(e.nodeValue===a||o!==null&&o.suppressHydrationWarning===!0||m_(e.nodeValue,a)),e||Rn(i,!0)}else e=Cc(e).createTextNode(o),e[ke]=i,i.stateNode=e}return Vt(i),null;case 31:if(a=i.memoizedState,e===null||e.memoizedState!==null){if(o=Xr(i),a!==null){if(e===null){if(!o)throw Error(r(318));if(e=i.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(557));e[ke]=i}else ur(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Vt(i),e=!1}else a=mh(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return i.flags&256?(li(i),i):(li(i),null);if((i.flags&128)!==0)throw Error(r(558))}return Vt(i),null;case 13:if(o=i.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(_=Xr(i),o!==null&&o.dehydrated!==null){if(e===null){if(!_)throw Error(r(318));if(_=i.memoizedState,_=_!==null?_.dehydrated:null,!_)throw Error(r(317));_[ke]=i}else ur(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Vt(i),_=!1}else _=mh(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=_),_=!0;if(!_)return i.flags&256?(li(i),i):(li(i),null)}return li(i),(i.flags&128)!==0?(i.lanes=a,i):(a=o!==null,e=e!==null&&e.memoizedState!==null,a&&(o=i.child,_=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(_=o.alternate.memoizedState.cachePool.pool),w=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(w=o.memoizedState.cachePool.pool),w!==_&&(o.flags|=2048)),a!==e&&a&&(i.child.flags|=8192),cc(i,i.updateQueue),Vt(i),null);case 4:return oe(),e===null&&Ad(i.stateNode.containerInfo),Vt(i),null;case 10:return en(i.type),Vt(i),null;case 19:if(z(cs),o=i.memoizedState,o===null)return Vt(i),null;if(_=(i.flags&128)!==0,w=o.rendering,w===null)if(_)yo(o,!1);else{if(os!==0||e!==null&&(e.flags&128)!==0)for(e=i.child;e!==null;){if(w=Xl(e),w!==null){for(i.flags|=128,yo(o,!1),e=w.updateQueue,i.updateQueue=e,cc(i,e),i.subtreeFlags=0,e=a,a=i.child;a!==null;)Yv(a,e),a=a.sibling;return W(cs,cs.current&1|2),ft&&Zi(i,o.treeForkCount),i.child}e=e.sibling}o.tail!==null&&vt()>pc&&(i.flags|=128,_=!0,yo(o,!1),i.lanes=4194304)}else{if(!_)if(e=Xl(w),e!==null){if(i.flags|=128,_=!0,e=e.updateQueue,i.updateQueue=e,cc(i,e),yo(o,!0),o.tail===null&&o.tailMode==="hidden"&&!w.alternate&&!ft)return Vt(i),null}else 2*vt()-o.renderingStartTime>pc&&a!==536870912&&(i.flags|=128,_=!0,yo(o,!1),i.lanes=4194304);o.isBackwards?(w.sibling=i.child,i.child=w):(e=o.last,e!==null?e.sibling=w:i.child=w,o.last=w)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=vt(),e.sibling=null,a=cs.current,W(cs,_?a&1|2:a&1),ft&&Zi(i,o.treeForkCount),e):(Vt(i),null);case 22:case 23:return li(i),Rh(),o=i.memoizedState!==null,e!==null?e.memoizedState!==null!==o&&(i.flags|=8192):o&&(i.flags|=8192),o?(a&536870912)!==0&&(i.flags&128)===0&&(Vt(i),i.subtreeFlags&6&&(i.flags|=8192)):Vt(i),a=i.updateQueue,a!==null&&cc(i,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),o=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(o=i.memoizedState.cachePool.pool),o!==a&&(i.flags|=2048),e!==null&&z(fr),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),i.memoizedState.cache!==a&&(i.flags|=2048),en(ms),Vt(i),null;case 25:return null;case 30:return null}throw Error(r(156,i.tag))}function Rw(e,i){switch(ph(i),i.tag){case 1:return e=i.flags,e&65536?(i.flags=e&-65537|128,i):null;case 3:return en(ms),oe(),e=i.flags,(e&65536)!==0&&(e&128)===0?(i.flags=e&-65537|128,i):null;case 26:case 27:case 5:return xe(i),null;case 31:if(i.memoizedState!==null){if(li(i),i.alternate===null)throw Error(r(340));ur()}return e=i.flags,e&65536?(i.flags=e&-65537|128,i):null;case 13:if(li(i),e=i.memoizedState,e!==null&&e.dehydrated!==null){if(i.alternate===null)throw Error(r(340));ur()}return e=i.flags,e&65536?(i.flags=e&-65537|128,i):null;case 19:return z(cs),null;case 4:return oe(),null;case 10:return en(i.type),null;case 22:case 23:return li(i),Rh(),e!==null&&z(fr),e=i.flags,e&65536?(i.flags=e&-65537|128,i):null;case 24:return en(ms),null;case 25:return null;default:return null}}function Sg(e,i){switch(ph(i),i.tag){case 3:en(ms),oe();break;case 26:case 27:case 5:xe(i);break;case 4:oe();break;case 31:i.memoizedState!==null&&li(i);break;case 13:li(i);break;case 19:z(cs);break;case 10:en(i.type);break;case 22:case 23:li(i),Rh(),e!==null&&z(fr);break;case 24:en(ms)}}function bo(e,i){try{var a=i.updateQueue,o=a!==null?a.lastEffect:null;if(o!==null){var _=o.next;a=_;do{if((a.tag&e)===e){o=void 0;var w=a.create,L=a.inst;o=w(),L.destroy=o}a=a.next}while(a!==_)}}catch(P){Mt(i,i.return,P)}}function Bn(e,i,a){try{var o=i.updateQueue,_=o!==null?o.lastEffect:null;if(_!==null){var w=_.next;o=w;do{if((o.tag&e)===e){var L=o.inst,P=L.destroy;if(P!==void 0){L.destroy=void 0,_=i;var K=a,re=P;try{re()}catch(me){Mt(_,K,me)}}}o=o.next}while(o!==w)}}catch(me){Mt(i,i.return,me)}}function wg(e){var i=e.updateQueue;if(i!==null){var a=e.stateNode;try{dm(i,a)}catch(o){Mt(e,e.return,o)}}}function xg(e,i,a){a.props=_r(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(o){Mt(e,i,o)}}function So(e,i){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var o=e.stateNode;break;case 30:o=e.stateNode;break;default:o=e.stateNode}typeof a=="function"?e.refCleanup=a(o):a.current=o}}catch(_){Mt(e,i,_)}}function Ui(e,i){var a=e.ref,o=e.refCleanup;if(a!==null)if(typeof o=="function")try{o()}catch(_){Mt(e,i,_)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(_){Mt(e,i,_)}else a.current=null}function Cg(e){var i=e.type,a=e.memoizedProps,o=e.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":a.autoFocus&&o.focus();break e;case"img":a.src?o.src=a.src:a.srcSet&&(o.srcset=a.srcSet)}}catch(_){Mt(e,e.return,_)}}function od(e,i,a){try{var o=e.stateNode;Jw(o,e.type,a,i),o[Fe]=i}catch(_){Mt(e,e.return,_)}}function Eg(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Fn(e.type)||e.tag===4}function ld(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Eg(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Fn(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function cd(e,i,a){var o=e.tag;if(o===5||o===6)e=e.stateNode,i?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,i):(i=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,i.appendChild(e),a=a._reactRootContainer,a!=null||i.onclick!==null||(i.onclick=ve));else if(o!==4&&(o===27&&Fn(e.type)&&(a=e.stateNode,i=null),e=e.child,e!==null))for(cd(e,i,a),e=e.sibling;e!==null;)cd(e,i,a),e=e.sibling}function uc(e,i,a){var o=e.tag;if(o===5||o===6)e=e.stateNode,i?a.insertBefore(e,i):a.appendChild(e);else if(o!==4&&(o===27&&Fn(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(uc(e,i,a),e=e.sibling;e!==null;)uc(e,i,a),e=e.sibling}function kg(e){var i=e.stateNode,a=e.memoizedProps;try{for(var o=e.type,_=i.attributes;_.length;)i.removeAttributeNode(_[0]);js(i,o,a),i[ke]=e,i[Fe]=a}catch(w){Mt(e,e.return,w)}}var an=!1,ys=!1,ud=!1,Tg=typeof WeakSet=="function"?WeakSet:Set,Ts=null;function Mw(e,i){if(e=e.containerInfo,jd=jc,e=zv(e),ih(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var o=a.getSelection&&a.getSelection();if(o&&o.rangeCount!==0){a=o.anchorNode;var _=o.anchorOffset,w=o.focusNode;o=o.focusOffset;try{a.nodeType,w.nodeType}catch{a=null;break e}var L=0,P=-1,K=-1,re=0,me=0,Se=e,le=null;t:for(;;){for(var fe;Se!==a||_!==0&&Se.nodeType!==3||(P=L+_),Se!==w||o!==0&&Se.nodeType!==3||(K=L+o),Se.nodeType===3&&(L+=Se.nodeValue.length),(fe=Se.firstChild)!==null;)le=Se,Se=fe;for(;;){if(Se===e)break t;if(le===a&&++re===_&&(P=L),le===w&&++me===o&&(K=L),(fe=Se.nextSibling)!==null)break;Se=le,le=Se.parentNode}Se=fe}a=P===-1||K===-1?null:{start:P,end:K}}else a=null}a=a||{start:0,end:0}}else a=null;for(Dd={focusedElem:e,selectionRange:a},jc=!1,Ts=i;Ts!==null;)if(i=Ts,e=i.child,(i.subtreeFlags&1028)!==0&&e!==null)e.return=i,Ts=e;else for(;Ts!==null;){switch(i=Ts,w=i.alternate,e=i.flags,i.tag){case 0:if((e&4)!==0&&(e=i.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a<e.length;a++)_=e[a],_.ref.impl=_.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&w!==null){e=void 0,a=i,_=w.memoizedProps,w=w.memoizedState,o=a.stateNode;try{var Le=_r(a.type,_);e=o.getSnapshotBeforeUpdate(Le,w),o.__reactInternalSnapshotBeforeUpdate=e}catch(qe){Mt(a,a.return,qe)}}break;case 3:if((e&1024)!==0){if(e=i.stateNode.containerInfo,a=e.nodeType,a===9)Od(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Od(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(r(163))}if(e=i.sibling,e!==null){e.return=i.return,Ts=e;break}Ts=i.return}}function Ag(e,i,a){var o=a.flags;switch(a.tag){case 0:case 11:case 15:ln(e,a),o&4&&bo(5,a);break;case 1:if(ln(e,a),o&4)if(e=a.stateNode,i===null)try{e.componentDidMount()}catch(L){Mt(a,a.return,L)}else{var _=_r(a.type,i.memoizedProps);i=i.memoizedState;try{e.componentDidUpdate(_,i,e.__reactInternalSnapshotBeforeUpdate)}catch(L){Mt(a,a.return,L)}}o&64&&wg(a),o&512&&So(a,a.return);break;case 3:if(ln(e,a),o&64&&(e=a.updateQueue,e!==null)){if(i=null,a.child!==null)switch(a.child.tag){case 27:case 5:i=a.child.stateNode;break;case 1:i=a.child.stateNode}try{dm(e,i)}catch(L){Mt(a,a.return,L)}}break;case 27:i===null&&o&4&&kg(a);case 26:case 5:ln(e,a),i===null&&o&4&&Cg(a),o&512&&So(a,a.return);break;case 12:ln(e,a);break;case 31:ln(e,a),o&4&&jg(e,a);break;case 13:ln(e,a),o&4&&Dg(e,a),o&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=zw.bind(null,a),rx(e,a))));break;case 22:if(o=a.memoizedState!==null||an,!o){i=i!==null&&i.memoizedState!==null||ys,_=an;var w=ys;an=o,(ys=i)&&!w?cn(e,a,(a.subtreeFlags&8772)!==0):ln(e,a),an=_,ys=w}break;case 30:break;default:ln(e,a)}}function Rg(e){var i=e.alternate;i!==null&&(e.alternate=null,Rg(i)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(i=e.stateNode,i!==null&&Re(i)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Zt=null,Ks=!1;function on(e,i,a){for(a=a.child;a!==null;)Mg(e,i,a),a=a.sibling}function Mg(e,i,a){if(qt&&typeof qt.onCommitFiberUnmount=="function")try{qt.onCommitFiberUnmount(Cs,a)}catch{}switch(a.tag){case 26:ys||Ui(a,i),on(e,i,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:ys||Ui(a,i);var o=Zt,_=Ks;Fn(a.type)&&(Zt=a.stateNode,Ks=!1),on(e,i,a),Mo(a.stateNode),Zt=o,Ks=_;break;case 5:ys||Ui(a,i);case 6:if(o=Zt,_=Ks,Zt=null,on(e,i,a),Zt=o,Ks=_,Zt!==null)if(Ks)try{(Zt.nodeType===9?Zt.body:Zt.nodeName==="HTML"?Zt.ownerDocument.body:Zt).removeChild(a.stateNode)}catch(w){Mt(a,i,w)}else try{Zt.removeChild(a.stateNode)}catch(w){Mt(a,i,w)}break;case 18:Zt!==null&&(Ks?(e=Zt,w_(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),ga(e)):w_(Zt,a.stateNode));break;case 4:o=Zt,_=Ks,Zt=a.stateNode.containerInfo,Ks=!0,on(e,i,a),Zt=o,Ks=_;break;case 0:case 11:case 14:case 15:Bn(2,a,i),ys||Bn(4,a,i),on(e,i,a);break;case 1:ys||(Ui(a,i),o=a.stateNode,typeof o.componentWillUnmount=="function"&&xg(a,i,o)),on(e,i,a);break;case 21:on(e,i,a);break;case 22:ys=(o=ys)||a.memoizedState!==null,on(e,i,a),ys=o;break;default:on(e,i,a)}}function jg(e,i){if(i.memoizedState===null&&(e=i.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{ga(e)}catch(a){Mt(i,i.return,a)}}}function Dg(e,i){if(i.memoizedState===null&&(e=i.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{ga(e)}catch(a){Mt(i,i.return,a)}}function jw(e){switch(e.tag){case 31:case 13:case 19:var i=e.stateNode;return i===null&&(i=e.stateNode=new Tg),i;case 22:return e=e.stateNode,i=e._retryCache,i===null&&(i=e._retryCache=new Tg),i;default:throw Error(r(435,e.tag))}}function hc(e,i){var a=jw(e);i.forEach(function(o){if(!a.has(o)){a.add(o);var _=$w.bind(null,e,o);o.then(_,_)}})}function Xs(e,i){var a=i.deletions;if(a!==null)for(var o=0;o<a.length;o++){var _=a[o],w=e,L=i,P=L;e:for(;P!==null;){switch(P.tag){case 27:if(Fn(P.type)){Zt=P.stateNode,Ks=!1;break e}break;case 5:Zt=P.stateNode,Ks=!1;break e;case 3:case 4:Zt=P.stateNode.containerInfo,Ks=!0;break e}P=P.return}if(Zt===null)throw Error(r(160));Mg(w,L,_),Zt=null,Ks=!1,w=_.alternate,w!==null&&(w.return=null),_.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)Ng(i,e),i=i.sibling}var Ni=null;function Ng(e,i){var a=e.alternate,o=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Xs(i,e),Js(e),o&4&&(Bn(3,e,e.return),bo(3,e),Bn(5,e,e.return));break;case 1:Xs(i,e),Js(e),o&512&&(ys||a===null||Ui(a,a.return)),o&64&&an&&(e=e.updateQueue,e!==null&&(o=e.callbacks,o!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?o:a.concat(o))));break;case 26:var _=Ni;if(Xs(i,e),Js(e),o&512&&(ys||a===null||Ui(a,a.return)),o&4){var w=a!==null?a.memoizedState:null;if(o=e.memoizedState,a===null)if(o===null)if(e.stateNode===null){e:{o=e.type,a=e.memoizedProps,_=_.ownerDocument||_;t:switch(o){case"title":w=_.getElementsByTagName("title")[0],(!w||w[Me]||w[ke]||w.namespaceURI==="http://www.w3.org/2000/svg"||w.hasAttribute("itemprop"))&&(w=_.createElement(o),_.head.insertBefore(w,_.querySelector("head > title"))),js(w,o,a),w[ke]=e,At(w),o=w;break e;case"link":var L=N_("link","href",_).get(o+(a.href||""));if(L){for(var P=0;P<L.length;P++)if(w=L[P],w.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&w.getAttribute("rel")===(a.rel==null?null:a.rel)&&w.getAttribute("title")===(a.title==null?null:a.title)&&w.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){L.splice(P,1);break t}}w=_.createElement(o),js(w,o,a),_.head.appendChild(w);break;case"meta":if(L=N_("meta","content",_).get(o+(a.content||""))){for(P=0;P<L.length;P++)if(w=L[P],w.getAttribute("content")===(a.content==null?null:""+a.content)&&w.getAttribute("name")===(a.name==null?null:a.name)&&w.getAttribute("property")===(a.property==null?null:a.property)&&w.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&w.getAttribute("charset")===(a.charSet==null?null:a.charSet)){L.splice(P,1);break t}}w=_.createElement(o),js(w,o,a),_.head.appendChild(w);break;default:throw Error(r(468,o))}w[ke]=e,At(w),o=w}e.stateNode=o}else L_(_,e.type,e.stateNode);else e.stateNode=D_(_,o,e.memoizedProps);else w!==o?(w===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):w.count--,o===null?L_(_,e.type,e.stateNode):D_(_,o,e.memoizedProps)):o===null&&e.stateNode!==null&&od(e,e.memoizedProps,a.memoizedProps)}break;case 27:Xs(i,e),Js(e),o&512&&(ys||a===null||Ui(a,a.return)),a!==null&&o&4&&od(e,e.memoizedProps,a.memoizedProps);break;case 5:if(Xs(i,e),Js(e),o&512&&(ys||a===null||Ui(a,a.return)),e.flags&32){_=e.stateNode;try{Ki(_,"")}catch(Le){Mt(e,e.return,Le)}}o&4&&e.stateNode!=null&&(_=e.memoizedProps,od(e,_,a!==null?a.memoizedProps:_)),o&1024&&(ud=!0);break;case 6:if(Xs(i,e),Js(e),o&4){if(e.stateNode===null)throw Error(r(162));o=e.memoizedProps,a=e.stateNode;try{a.nodeValue=o}catch(Le){Mt(e,e.return,Le)}}break;case 3:if(Tc=null,_=Ni,Ni=Ec(i.containerInfo),Xs(i,e),Ni=_,Js(e),o&4&&a!==null&&a.memoizedState.isDehydrated)try{ga(i.containerInfo)}catch(Le){Mt(e,e.return,Le)}ud&&(ud=!1,Lg(e));break;case 4:o=Ni,Ni=Ec(e.stateNode.containerInfo),Xs(i,e),Js(e),Ni=o;break;case 12:Xs(i,e),Js(e);break;case 31:Xs(i,e),Js(e),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,hc(e,o)));break;case 13:Xs(i,e),Js(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(fc=vt()),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,hc(e,o)));break;case 22:_=e.memoizedState!==null;var K=a!==null&&a.memoizedState!==null,re=an,me=ys;if(an=re||_,ys=me||K,Xs(i,e),ys=me,an=re,Js(e),o&8192)e:for(i=e.stateNode,i._visibility=_?i._visibility&-2:i._visibility|1,_&&(a===null||K||an||ys||yr(e)),a=null,i=e;;){if(i.tag===5||i.tag===26){if(a===null){K=a=i;try{if(w=K.stateNode,_)L=w.style,typeof L.setProperty=="function"?L.setProperty("display","none","important"):L.display="none";else{P=K.stateNode;var Se=K.memoizedProps.style,le=Se!=null&&Se.hasOwnProperty("display")?Se.display:null;P.style.display=le==null||typeof le=="boolean"?"":(""+le).trim()}}catch(Le){Mt(K,K.return,Le)}}}else if(i.tag===6){if(a===null){K=i;try{K.stateNode.nodeValue=_?"":K.memoizedProps}catch(Le){Mt(K,K.return,Le)}}}else if(i.tag===18){if(a===null){K=i;try{var fe=K.stateNode;_?x_(fe,!0):x_(K.stateNode,!1)}catch(Le){Mt(K,K.return,Le)}}}else if((i.tag!==22&&i.tag!==23||i.memoizedState===null||i===e)&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===e)break e;for(;i.sibling===null;){if(i.return===null||i.return===e)break e;a===i&&(a=null),i=i.return}a===i&&(a=null),i.sibling.return=i.return,i=i.sibling}o&4&&(o=e.updateQueue,o!==null&&(a=o.retryQueue,a!==null&&(o.retryQueue=null,hc(e,a))));break;case 19:Xs(i,e),Js(e),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,hc(e,o)));break;case 30:break;case 21:break;default:Xs(i,e),Js(e)}}function Js(e){var i=e.flags;if(i&2){try{for(var a,o=e.return;o!==null;){if(Eg(o)){a=o;break}o=o.return}if(a==null)throw Error(r(160));switch(a.tag){case 27:var _=a.stateNode,w=ld(e);uc(e,w,_);break;case 5:var L=a.stateNode;a.flags&32&&(Ki(L,""),a.flags&=-33);var P=ld(e);uc(e,P,L);break;case 3:case 4:var K=a.stateNode.containerInfo,re=ld(e);cd(e,re,K);break;default:throw Error(r(161))}}catch(me){Mt(e,e.return,me)}e.flags&=-3}i&4096&&(e.flags&=-4097)}function Lg(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var i=e;Lg(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),e=e.sibling}}function ln(e,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)Ag(e,i.alternate,i),i=i.sibling}function yr(e){for(e=e.child;e!==null;){var i=e;switch(i.tag){case 0:case 11:case 14:case 15:Bn(4,i,i.return),yr(i);break;case 1:Ui(i,i.return);var a=i.stateNode;typeof a.componentWillUnmount=="function"&&xg(i,i.return,a),yr(i);break;case 27:Mo(i.stateNode);case 26:case 5:Ui(i,i.return),yr(i);break;case 22:i.memoizedState===null&&yr(i);break;case 30:yr(i);break;default:yr(i)}e=e.sibling}}function cn(e,i,a){for(a=a&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var o=i.alternate,_=e,w=i,L=w.flags;switch(w.tag){case 0:case 11:case 15:cn(_,w,a),bo(4,w);break;case 1:if(cn(_,w,a),o=w,_=o.stateNode,typeof _.componentDidMount=="function")try{_.componentDidMount()}catch(re){Mt(o,o.return,re)}if(o=w,_=o.updateQueue,_!==null){var P=o.stateNode;try{var K=_.shared.hiddenCallbacks;if(K!==null)for(_.shared.hiddenCallbacks=null,_=0;_<K.length;_++)hm(K[_],P)}catch(re){Mt(o,o.return,re)}}a&&L&64&&wg(w),So(w,w.return);break;case 27:kg(w);case 26:case 5:cn(_,w,a),a&&o===null&&L&4&&Cg(w),So(w,w.return);break;case 12:cn(_,w,a);break;case 31:cn(_,w,a),a&&L&4&&jg(_,w);break;case 13:cn(_,w,a),a&&L&4&&Dg(_,w);break;case 22:w.memoizedState===null&&cn(_,w,a),So(w,w.return);break;case 30:break;default:cn(_,w,a)}i=i.sibling}}function hd(e,i){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(e=i.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&ao(a))}function dd(e,i){e=null,i.alternate!==null&&(e=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==e&&(i.refCount++,e!=null&&ao(e))}function Li(e,i,a,o){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)Og(e,i,a,o),i=i.sibling}function Og(e,i,a,o){var _=i.flags;switch(i.tag){case 0:case 11:case 15:Li(e,i,a,o),_&2048&&bo(9,i);break;case 1:Li(e,i,a,o);break;case 3:Li(e,i,a,o),_&2048&&(e=null,i.alternate!==null&&(e=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==e&&(i.refCount++,e!=null&&ao(e)));break;case 12:if(_&2048){Li(e,i,a,o),e=i.stateNode;try{var w=i.memoizedProps,L=w.id,P=w.onPostCommit;typeof P=="function"&&P(L,i.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(K){Mt(i,i.return,K)}}else Li(e,i,a,o);break;case 31:Li(e,i,a,o);break;case 13:Li(e,i,a,o);break;case 23:break;case 22:w=i.stateNode,L=i.alternate,i.memoizedState!==null?w._visibility&2?Li(e,i,a,o):wo(e,i):w._visibility&2?Li(e,i,a,o):(w._visibility|=2,aa(e,i,a,o,(i.subtreeFlags&10256)!==0||!1)),_&2048&&hd(L,i);break;case 24:Li(e,i,a,o),_&2048&&dd(i.alternate,i);break;default:Li(e,i,a,o)}}function aa(e,i,a,o,_){for(_=_&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var w=e,L=i,P=a,K=o,re=L.flags;switch(L.tag){case 0:case 11:case 15:aa(w,L,P,K,_),bo(8,L);break;case 23:break;case 22:var me=L.stateNode;L.memoizedState!==null?me._visibility&2?aa(w,L,P,K,_):wo(w,L):(me._visibility|=2,aa(w,L,P,K,_)),_&&re&2048&&hd(L.alternate,L);break;case 24:aa(w,L,P,K,_),_&&re&2048&&dd(L.alternate,L);break;default:aa(w,L,P,K,_)}i=i.sibling}}function wo(e,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var a=e,o=i,_=o.flags;switch(o.tag){case 22:wo(a,o),_&2048&&hd(o.alternate,o);break;case 24:wo(a,o),_&2048&&dd(o.alternate,o);break;default:wo(a,o)}i=i.sibling}}var xo=8192;function oa(e,i,a){if(e.subtreeFlags&xo)for(e=e.child;e!==null;)Bg(e,i,a),e=e.sibling}function Bg(e,i,a){switch(e.tag){case 26:oa(e,i,a),e.flags&xo&&e.memoizedState!==null&&gx(a,Ni,e.memoizedState,e.memoizedProps);break;case 5:oa(e,i,a);break;case 3:case 4:var o=Ni;Ni=Ec(e.stateNode.containerInfo),oa(e,i,a),Ni=o;break;case 22:e.memoizedState===null&&(o=e.alternate,o!==null&&o.memoizedState!==null?(o=xo,xo=16777216,oa(e,i,a),xo=o):oa(e,i,a));break;default:oa(e,i,a)}}function Hg(e){var i=e.alternate;if(i!==null&&(e=i.child,e!==null)){i.child=null;do i=e.sibling,e.sibling=null,e=i;while(e!==null)}}function Co(e){var i=e.deletions;if((e.flags&16)!==0){if(i!==null)for(var a=0;a<i.length;a++){var o=i[a];Ts=o,zg(o,e)}Hg(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Ig(e),e=e.sibling}function Ig(e){switch(e.tag){case 0:case 11:case 15:Co(e),e.flags&2048&&Bn(9,e,e.return);break;case 3:Co(e);break;case 12:Co(e);break;case 22:var i=e.stateNode;e.memoizedState!==null&&i._visibility&2&&(e.return===null||e.return.tag!==13)?(i._visibility&=-3,dc(e)):Co(e);break;default:Co(e)}}function dc(e){var i=e.deletions;if((e.flags&16)!==0){if(i!==null)for(var a=0;a<i.length;a++){var o=i[a];Ts=o,zg(o,e)}Hg(e)}for(e=e.child;e!==null;){switch(i=e,i.tag){case 0:case 11:case 15:Bn(8,i,i.return),dc(i);break;case 22:a=i.stateNode,a._visibility&2&&(a._visibility&=-3,dc(i));break;default:dc(i)}e=e.sibling}}function zg(e,i){for(;Ts!==null;){var a=Ts;switch(a.tag){case 0:case 11:case 15:Bn(8,a,i);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var o=a.memoizedState.cachePool.pool;o!=null&&o.refCount++}break;case 24:ao(a.memoizedState.cache)}if(o=a.child,o!==null)o.return=a,Ts=o;else e:for(a=e;Ts!==null;){o=Ts;var _=o.sibling,w=o.return;if(Rg(o),o===a){Ts=null;break e}if(_!==null){_.return=w,Ts=_;break e}Ts=w}}}var Dw={getCacheForType:function(e){var i=Rs(ms),a=i.data.get(e);return a===void 0&&(a=e(),i.data.set(e,a)),a},cacheSignal:function(){return Rs(ms).controller.signal}},Nw=typeof WeakMap=="function"?WeakMap:Map,wt=0,Pt=null,ot=null,ct=0,Rt=0,ci=null,Hn=!1,la=!1,fd=!1,un=0,os=0,In=0,br=0,pd=0,ui=0,ca=0,Eo=null,Zs=null,vd=!1,fc=0,$g=0,pc=1/0,vc=null,zn=null,xs=0,$n=null,ua=null,hn=0,md=0,gd=null,Pg=null,ko=0,_d=null;function hi(){return(wt&2)!==0&&ct!==0?ct&-ct:F.T!==null?Cd():pe()}function Ug(){if(ui===0)if((ct&536870912)===0||ft){var e=ii;ii<<=1,(ii&3932160)===0&&(ii=262144),ui=e}else ui=536870912;return e=oi.current,e!==null&&(e.flags|=32),ui}function Qs(e,i,a){(e===Pt&&(Rt===2||Rt===9)||e.cancelPendingCommit!==null)&&(ha(e,0),Pn(e,ct,ui,!1)),we(e,a),((wt&2)===0||e!==Pt)&&(e===Pt&&((wt&2)===0&&(br|=a),os===4&&Pn(e,ct,ui,!1)),Fi(e))}function Fg(e,i,a){if((wt&6)!==0)throw Error(r(327));var o=!a&&(i&127)===0&&(i&e.expiredLanes)===0||Wt(e,i),_=o?Bw(e,i):bd(e,i,!0),w=o;do{if(_===0){la&&!o&&Pn(e,i,0,!1);break}else{if(a=e.current.alternate,w&&!Lw(a)){_=bd(e,i,!1),w=!1;continue}if(_===2){if(w=i,e.errorRecoveryDisabledLanes&w)var L=0;else L=e.pendingLanes&-536870913,L=L!==0?L:L&536870912?536870912:0;if(L!==0){i=L;e:{var P=e;_=Eo;var K=P.current.memoizedState.isDehydrated;if(K&&(ha(P,L).flags|=256),L=bd(P,L,!1),L!==2){if(fd&&!K){P.errorRecoveryDisabledLanes|=w,br|=w,_=4;break e}w=Zs,Zs=_,w!==null&&(Zs===null?Zs=w:Zs.push.apply(Zs,w))}_=L}if(w=!1,_!==2)continue}}if(_===1){ha(e,0),Pn(e,i,0,!0);break}e:{switch(o=e,w=_,w){case 0:case 1:throw Error(r(345));case 4:if((i&4194048)!==i)break;case 6:Pn(o,i,ui,!Hn);break e;case 2:Zs=null;break;case 3:case 5:break;default:throw Error(r(329))}if((i&62914560)===i&&(_=fc+300-vt(),10<_)){if(Pn(o,i,ui,!Hn),tt(o,0,!0)!==0)break e;hn=i,o.timeoutHandle=b_(qg.bind(null,o,a,Zs,vc,vd,i,ui,br,ca,Hn,w,"Throttled",-0,0),_);break e}qg(o,a,Zs,vc,vd,i,ui,br,ca,Hn,w,null,-0,0)}}break}while(!0);Fi(e)}function qg(e,i,a,o,_,w,L,P,K,re,me,Se,le,fe){if(e.timeoutHandle=-1,Se=i.subtreeFlags,Se&8192||(Se&16785408)===16785408){Se={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ve},Bg(i,w,Se);var Le=(w&62914560)===w?fc-vt():(w&4194048)===w?$g-vt():0;if(Le=_x(Se,Le),Le!==null){hn=w,e.cancelPendingCommit=Le(Zg.bind(null,e,i,w,a,o,_,L,P,K,me,Se,null,le,fe)),Pn(e,w,L,!re);return}}Zg(e,i,w,a,o,_,L,P,K)}function Lw(e){for(var i=e;;){var a=i.tag;if((a===0||a===11||a===15)&&i.flags&16384&&(a=i.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var o=0;o<a.length;o++){var _=a[o],w=_.getSnapshot;_=_.value;try{if(!ri(w(),_))return!1}catch{return!1}}if(a=i.child,i.subtreeFlags&16384&&a!==null)a.return=i,i=a;else{if(i===e)break;for(;i.sibling===null;){if(i.return===null||i.return===e)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function Pn(e,i,a,o){i&=~pd,i&=~br,e.suspendedLanes|=i,e.pingedLanes&=~i,o&&(e.warmLanes|=i),o=e.expirationTimes;for(var _=i;0<_;){var w=31-kt(_),L=1<<w;o[w]=-1,_&=~L}a!==0&&ts(e,a,i)}function mc(){return(wt&6)===0?(To(0),!1):!0}function yd(){if(ot!==null){if(Rt===0)var e=ot.return;else e=ot,Qi=hr=null,Oh(e),ta=null,lo=0,e=ot;for(;e!==null;)Sg(e.alternate,e),e=e.return;ot=null}}function ha(e,i){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,ex(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),hn=0,yd(),Pt=e,ot=a=Ji(e.current,null),ct=i,Rt=0,ci=null,Hn=!1,la=Wt(e,i),fd=!1,ca=ui=pd=br=In=os=0,Zs=Eo=null,vd=!1,(i&8)!==0&&(i|=i&32);var o=e.entangledLanes;if(o!==0)for(e=e.entanglements,o&=i;0<o;){var _=31-kt(o),w=1<<_;i|=e[_],o&=~w}return un=i,Hl(),a}function Wg(e,i){it=null,F.H=go,i===ea||i===Wl?(i=om(),Rt=3):i===xh?(i=om(),Rt=4):Rt=i===Jh?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,ci=i,ot===null&&(os=1,rc(e,_i(i,e.current)))}function Gg(){var e=oi.current;return e===null?!0:(ct&4194048)===ct?wi===null:(ct&62914560)===ct||(ct&536870912)!==0?e===wi:!1}function Vg(){var e=F.H;return F.H=go,e===null?go:e}function Yg(){var e=F.A;return F.A=Dw,e}function gc(){os=4,Hn||(ct&4194048)!==ct&&oi.current!==null||(la=!0),(In&134217727)===0&&(br&134217727)===0||Pt===null||Pn(Pt,ct,ui,!1)}function bd(e,i,a){var o=wt;wt|=2;var _=Vg(),w=Yg();(Pt!==e||ct!==i)&&(vc=null,ha(e,i)),i=!1;var L=os;e:do try{if(Rt!==0&&ot!==null){var P=ot,K=ci;switch(Rt){case 8:yd(),L=6;break e;case 3:case 2:case 9:case 6:oi.current===null&&(i=!0);var re=Rt;if(Rt=0,ci=null,da(e,P,K,re),a&&la){L=0;break e}break;default:re=Rt,Rt=0,ci=null,da(e,P,K,re)}}Ow(),L=os;break}catch(me){Wg(e,me)}while(!0);return i&&e.shellSuspendCounter++,Qi=hr=null,wt=o,F.H=_,F.A=w,ot===null&&(Pt=null,ct=0,Hl()),L}function Ow(){for(;ot!==null;)Kg(ot)}function Bw(e,i){var a=wt;wt|=2;var o=Vg(),_=Yg();Pt!==e||ct!==i?(vc=null,pc=vt()+500,ha(e,i)):la=Wt(e,i);e:do try{if(Rt!==0&&ot!==null){i=ot;var w=ci;t:switch(Rt){case 1:Rt=0,ci=null,da(e,i,w,1);break;case 2:case 9:if(rm(w)){Rt=0,ci=null,Xg(i);break}i=function(){Rt!==2&&Rt!==9||Pt!==e||(Rt=7),Fi(e)},w.then(i,i);break e;case 3:Rt=7;break e;case 4:Rt=5;break e;case 7:rm(w)?(Rt=0,ci=null,Xg(i)):(Rt=0,ci=null,da(e,i,w,7));break;case 5:var L=null;switch(ot.tag){case 26:L=ot.memoizedState;case 5:case 27:var P=ot;if(L?O_(L):P.stateNode.complete){Rt=0,ci=null;var K=P.sibling;if(K!==null)ot=K;else{var re=P.return;re!==null?(ot=re,_c(re)):ot=null}break t}}Rt=0,ci=null,da(e,i,w,5);break;case 6:Rt=0,ci=null,da(e,i,w,6);break;case 8:yd(),os=6;break e;default:throw Error(r(462))}}Hw();break}catch(me){Wg(e,me)}while(!0);return Qi=hr=null,F.H=o,F.A=_,wt=a,ot!==null?0:(Pt=null,ct=0,Hl(),os)}function Hw(){for(;ot!==null&&!ss();)Kg(ot)}function Kg(e){var i=yg(e.alternate,e,un);e.memoizedProps=e.pendingProps,i===null?_c(e):ot=i}function Xg(e){var i=e,a=i.alternate;switch(i.tag){case 15:case 0:i=fg(a,i,i.pendingProps,i.type,void 0,ct);break;case 11:i=fg(a,i,i.pendingProps,i.type.render,i.ref,ct);break;case 5:Oh(i);default:Sg(a,i),i=ot=Yv(i,un),i=yg(a,i,un)}e.memoizedProps=e.pendingProps,i===null?_c(e):ot=i}function da(e,i,a,o){Qi=hr=null,Oh(i),ta=null,lo=0;var _=i.return;try{if(Ew(e,_,i,a,ct)){os=1,rc(e,_i(a,e.current)),ot=null;return}}catch(w){if(_!==null)throw ot=_,w;os=1,rc(e,_i(a,e.current)),ot=null;return}i.flags&32768?(ft||o===1?e=!0:la||(ct&536870912)!==0?e=!1:(Hn=e=!0,(o===2||o===9||o===3||o===6)&&(o=oi.current,o!==null&&o.tag===13&&(o.flags|=16384))),Jg(i,e)):_c(i)}function _c(e){var i=e;do{if((i.flags&32768)!==0){Jg(i,Hn);return}e=i.return;var a=Aw(i.alternate,i,un);if(a!==null){ot=a;return}if(i=i.sibling,i!==null){ot=i;return}ot=i=e}while(i!==null);os===0&&(os=5)}function Jg(e,i){do{var a=Rw(e.alternate,e);if(a!==null){a.flags&=32767,ot=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!i&&(e=e.sibling,e!==null)){ot=e;return}ot=e=a}while(e!==null);os=6,ot=null}function Zg(e,i,a,o,_,w,L,P,K){e.cancelPendingCommit=null;do yc();while(xs!==0);if((wt&6)!==0)throw Error(r(327));if(i!==null){if(i===e.current)throw Error(r(177));if(w=i.lanes|i.childLanes,w|=lh,Xe(e,a,w,L,P,K),e===Pt&&(ot=Pt=null,ct=0),ua=i,$n=e,hn=a,md=w,gd=_,Pg=o,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Pw(mt,function(){return i_(),null})):(e.callbackNode=null,e.callbackPriority=0),o=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||o){o=F.T,F.T=null,_=Q.p,Q.p=2,L=wt,wt|=4;try{Mw(e,i,a)}finally{wt=L,Q.p=_,F.T=o}}xs=1,Qg(),e_(),t_()}}function Qg(){if(xs===1){xs=0;var e=$n,i=ua,a=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||a){a=F.T,F.T=null;var o=Q.p;Q.p=2;var _=wt;wt|=4;try{Ng(i,e);var w=Dd,L=zv(e.containerInfo),P=w.focusedElem,K=w.selectionRange;if(L!==P&&P&&P.ownerDocument&&Iv(P.ownerDocument.documentElement,P)){if(K!==null&&ih(P)){var re=K.start,me=K.end;if(me===void 0&&(me=re),"selectionStart"in P)P.selectionStart=re,P.selectionEnd=Math.min(me,P.value.length);else{var Se=P.ownerDocument||document,le=Se&&Se.defaultView||window;if(le.getSelection){var fe=le.getSelection(),Le=P.textContent.length,qe=Math.min(K.start,Le),Bt=K.end===void 0?qe:Math.min(K.end,Le);!fe.extend&&qe>Bt&&(L=Bt,Bt=qe,qe=L);var ie=Hv(P,qe),ee=Hv(P,Bt);if(ie&&ee&&(fe.rangeCount!==1||fe.anchorNode!==ie.node||fe.anchorOffset!==ie.offset||fe.focusNode!==ee.node||fe.focusOffset!==ee.offset)){var ne=Se.createRange();ne.setStart(ie.node,ie.offset),fe.removeAllRanges(),qe>Bt?(fe.addRange(ne),fe.extend(ee.node,ee.offset)):(ne.setEnd(ee.node,ee.offset),fe.addRange(ne))}}}}for(Se=[],fe=P;fe=fe.parentNode;)fe.nodeType===1&&Se.push({element:fe,left:fe.scrollLeft,top:fe.scrollTop});for(typeof P.focus=="function"&&P.focus(),P=0;P<Se.length;P++){var be=Se[P];be.element.scrollLeft=be.left,be.element.scrollTop=be.top}}jc=!!jd,Dd=jd=null}finally{wt=_,Q.p=o,F.T=a}}e.current=i,xs=2}}function e_(){if(xs===2){xs=0;var e=$n,i=ua,a=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||a){a=F.T,F.T=null;var o=Q.p;Q.p=2;var _=wt;wt|=4;try{Ag(e,i.alternate,i)}finally{wt=_,Q.p=o,F.T=a}}xs=3}}function t_(){if(xs===4||xs===3){xs=0,ht();var e=$n,i=ua,a=hn,o=Pg;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?xs=5:(xs=0,ua=$n=null,s_(e,e.pendingLanes));var _=e.pendingLanes;if(_===0&&(zn=null),te(a),i=i.stateNode,qt&&typeof qt.onCommitFiberRoot=="function")try{qt.onCommitFiberRoot(Cs,i,void 0,(i.current.flags&128)===128)}catch{}if(o!==null){i=F.T,_=Q.p,Q.p=2,F.T=null;try{for(var w=e.onRecoverableError,L=0;L<o.length;L++){var P=o[L];w(P.value,{componentStack:P.stack})}}finally{F.T=i,Q.p=_}}(hn&3)!==0&&yc(),Fi(e),_=e.pendingLanes,(a&261930)!==0&&(_&42)!==0?e===_d?ko++:(ko=0,_d=e):ko=0,To(0)}}function s_(e,i){(e.pooledCacheLanes&=i)===0&&(i=e.pooledCache,i!=null&&(e.pooledCache=null,ao(i)))}function yc(){return Qg(),e_(),t_(),i_()}function i_(){if(xs!==5)return!1;var e=$n,i=md;md=0;var a=te(hn),o=F.T,_=Q.p;try{Q.p=32>a?32:a,F.T=null,a=gd,gd=null;var w=$n,L=hn;if(xs=0,ua=$n=null,hn=0,(wt&6)!==0)throw Error(r(331));var P=wt;if(wt|=4,Ig(w.current),Og(w,w.current,L,a),wt=P,To(0,!1),qt&&typeof qt.onPostCommitFiberRoot=="function")try{qt.onPostCommitFiberRoot(Cs,w)}catch{}return!0}finally{Q.p=_,F.T=o,s_(e,i)}}function n_(e,i,a){i=_i(a,i),i=Xh(e.stateNode,i,2),e=Nn(e,i,2),e!==null&&(we(e,2),Fi(e))}function Mt(e,i,a){if(e.tag===3)n_(e,e,a);else for(;i!==null;){if(i.tag===3){n_(i,e,a);break}else if(i.tag===1){var o=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(zn===null||!zn.has(o))){e=_i(a,e),a=rg(2),o=Nn(i,a,2),o!==null&&(ag(a,o,i,e),we(o,2),Fi(o));break}}i=i.return}}function Sd(e,i,a){var o=e.pingCache;if(o===null){o=e.pingCache=new Nw;var _=new Set;o.set(i,_)}else _=o.get(i),_===void 0&&(_=new Set,o.set(i,_));_.has(a)||(fd=!0,_.add(a),e=Iw.bind(null,e,i,a),i.then(e,e))}function Iw(e,i,a){var o=e.pingCache;o!==null&&o.delete(i),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,Pt===e&&(ct&a)===a&&(os===4||os===3&&(ct&62914560)===ct&&300>vt()-fc?(wt&2)===0&&ha(e,0):pd|=a,ca===ct&&(ca=0)),Fi(e)}function r_(e,i){i===0&&(i=ws()),e=lr(e,i),e!==null&&(we(e,i),Fi(e))}function zw(e){var i=e.memoizedState,a=0;i!==null&&(a=i.retryLane),r_(e,a)}function $w(e,i){var a=0;switch(e.tag){case 31:case 13:var o=e.stateNode,_=e.memoizedState;_!==null&&(a=_.retryLane);break;case 19:o=e.stateNode;break;case 22:o=e.stateNode._retryCache;break;default:throw Error(r(314))}o!==null&&o.delete(i),r_(e,a)}function Pw(e,i){return xt(e,i)}var bc=null,fa=null,wd=!1,Sc=!1,xd=!1,Un=0;function Fi(e){e!==fa&&e.next===null&&(fa===null?bc=fa=e:fa=fa.next=e),Sc=!0,wd||(wd=!0,Fw())}function To(e,i){if(!xd&&Sc){xd=!0;do for(var a=!1,o=bc;o!==null;){if(e!==0){var _=o.pendingLanes;if(_===0)var w=0;else{var L=o.suspendedLanes,P=o.pingedLanes;w=(1<<31-kt(42|e)+1)-1,w&=_&~(L&~P),w=w&201326741?w&201326741|1:w?w|2:0}w!==0&&(a=!0,c_(o,w))}else w=ct,w=tt(o,o===Pt?w:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(w&3)===0||Wt(o,w)||(a=!0,c_(o,w));o=o.next}while(a);xd=!1}}function Uw(){a_()}function a_(){Sc=wd=!1;var e=0;Un!==0&&Qw()&&(e=Un);for(var i=vt(),a=null,o=bc;o!==null;){var _=o.next,w=o_(o,i);w===0?(o.next=null,a===null?bc=_:a.next=_,_===null&&(fa=a)):(a=o,(e!==0||(w&3)!==0)&&(Sc=!0)),o=_}xs!==0&&xs!==5||To(e),Un!==0&&(Un=0)}function o_(e,i){for(var a=e.suspendedLanes,o=e.pingedLanes,_=e.expirationTimes,w=e.pendingLanes&-62914561;0<w;){var L=31-kt(w),P=1<<L,K=_[L];K===-1?((P&a)===0||(P&o)!==0)&&(_[L]=is(P,i)):K<=i&&(e.expiredLanes|=P),w&=~P}if(i=Pt,a=ct,a=tt(e,e===i?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o=e.callbackNode,a===0||e===i&&(Rt===2||Rt===9)||e.cancelPendingCommit!==null)return o!==null&&o!==null&>(o),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||Wt(e,a)){if(i=a&-a,i===e.callbackPriority)return i;switch(o!==null&>(o),te(a)){case 2:case 8:a=ds;break;case 32:a=mt;break;case 268435456:a=$e;break;default:a=mt}return o=l_.bind(null,e),a=xt(a,o),e.callbackPriority=i,e.callbackNode=a,i}return o!==null&&o!==null&>(o),e.callbackPriority=2,e.callbackNode=null,2}function l_(e,i){if(xs!==0&&xs!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(yc()&&e.callbackNode!==a)return null;var o=ct;return o=tt(e,e===Pt?o:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o===0?null:(Fg(e,o,i),o_(e,vt()),e.callbackNode!=null&&e.callbackNode===a?l_.bind(null,e):null)}function c_(e,i){if(yc())return null;Fg(e,i,!0)}function Fw(){tx(function(){(wt&6)!==0?xt($t,Uw):a_()})}function Cd(){if(Un===0){var e=Zr;e===0&&(e=$s,$s<<=1,($s&261888)===0&&($s=256)),Un=e}return Un}function u_(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:V(""+e)}function h_(e,i){var a=i.ownerDocument.createElement("input");return a.name=i.name,a.value=i.value,e.id&&a.setAttribute("form",e.id),i.parentNode.insertBefore(a,i),e=new FormData(e),a.parentNode.removeChild(a),e}function qw(e,i,a,o,_){if(i==="submit"&&a&&a.stateNode===_){var w=u_((_[Fe]||null).action),L=o.submitter;L&&(i=(i=L[Fe]||null)?u_(i.formAction):L.getAttribute("formAction"),i!==null&&(w=i,L=null));var P=new Nl("action","action",null,o,_);e.push({event:P,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(Un!==0){var K=L?h_(_,L):new FormData(_);qh(a,{pending:!0,data:K,method:_.method,action:w},null,K)}}else typeof w=="function"&&(P.preventDefault(),K=L?h_(_,L):new FormData(_),qh(a,{pending:!0,data:K,method:_.method,action:w},w,K))},currentTarget:_}]})}}for(var Ed=0;Ed<oh.length;Ed++){var kd=oh[Ed],Ww=kd.toLowerCase(),Gw=kd[0].toUpperCase()+kd.slice(1);Di(Ww,"on"+Gw)}Di(Uv,"onAnimationEnd"),Di(Fv,"onAnimationIteration"),Di(qv,"onAnimationStart"),Di("dblclick","onDoubleClick"),Di("focusin","onFocus"),Di("focusout","onBlur"),Di(lw,"onTransitionRun"),Di(cw,"onTransitionStart"),Di(uw,"onTransitionCancel"),Di(Wv,"onTransitionEnd"),zi("onMouseEnter",["mouseout","mouseover"]),zi("onMouseLeave",["mouseout","mouseover"]),zi("onPointerEnter",["pointerout","pointerover"]),zi("onPointerLeave",["pointerout","pointerover"]),ns("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ns("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ns("onBeforeInput",["compositionend","keypress","textInput","paste"]),ns("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ns("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ns("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ao="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Vw=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ao));function d_(e,i){i=(i&4)!==0;for(var a=0;a<e.length;a++){var o=e[a],_=o.event;o=o.listeners;e:{var w=void 0;if(i)for(var L=o.length-1;0<=L;L--){var P=o[L],K=P.instance,re=P.currentTarget;if(P=P.listener,K!==w&&_.isPropagationStopped())break e;w=P,_.currentTarget=re;try{w(_)}catch(me){Bl(me)}_.currentTarget=null,w=K}else for(L=0;L<o.length;L++){if(P=o[L],K=P.instance,re=P.currentTarget,P=P.listener,K!==w&&_.isPropagationStopped())break e;w=P,_.currentTarget=re;try{w(_)}catch(me){Bl(me)}_.currentTarget=null,w=K}}}}function lt(e,i){var a=i[dt];a===void 0&&(a=i[dt]=new Set);var o=e+"__bubble";a.has(o)||(f_(i,e,2,!1),a.add(o))}function Td(e,i,a){var o=0;i&&(o|=4),f_(a,e,o,i)}var wc="_reactListening"+Math.random().toString(36).slice(2);function Ad(e){if(!e[wc]){e[wc]=!0,tr.forEach(function(a){a!=="selectionchange"&&(Vw.has(a)||Td(a,!1,e),Td(a,!0,e))});var i=e.nodeType===9?e:e.ownerDocument;i===null||i[wc]||(i[wc]=!0,Td("selectionchange",!1,i))}}function f_(e,i,a,o){switch(U_(i)){case 2:var _=Sx;break;case 8:_=wx;break;default:_=Fd}a=_.bind(null,i,a,e),_=void 0,!Yu||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(_=!0),o?_!==void 0?e.addEventListener(i,a,{capture:!0,passive:_}):e.addEventListener(i,a,!0):_!==void 0?e.addEventListener(i,a,{passive:_}):e.addEventListener(i,a,!1)}function Rd(e,i,a,o,_){var w=o;if((i&1)===0&&(i&2)===0&&o!==null)e:for(;;){if(o===null)return;var L=o.tag;if(L===3||L===4){var P=o.stateNode.containerInfo;if(P===_)break;if(L===4)for(L=o.return;L!==null;){var K=L.tag;if((K===3||K===4)&&L.stateNode.containerInfo===_)return;L=L.return}for(;P!==null;){if(L=at(P),L===null)return;if(K=L.tag,K===5||K===6||K===26||K===27){o=w=L;continue e}P=P.parentNode}}o=o.return}_v(function(){var re=w,me=Ve(a),Se=[];e:{var le=Gv.get(e);if(le!==void 0){var fe=Nl,Le=e;switch(e){case"keypress":if(jl(a)===0)break e;case"keydown":case"keyup":fe=$S;break;case"focusin":Le="focus",fe=Zu;break;case"focusout":Le="blur",fe=Zu;break;case"beforeblur":case"afterblur":fe=Zu;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":fe=Sv;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":fe=AS;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":fe=FS;break;case Uv:case Fv:case qv:fe=jS;break;case Wv:fe=WS;break;case"scroll":case"scrollend":fe=kS;break;case"wheel":fe=VS;break;case"copy":case"cut":case"paste":fe=NS;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":fe=xv;break;case"toggle":case"beforetoggle":fe=KS}var qe=(i&4)!==0,Bt=!qe&&(e==="scroll"||e==="scrollend"),ie=qe?le!==null?le+"Capture":null:le;qe=[];for(var ee=re,ne;ee!==null;){var be=ee;if(ne=be.stateNode,be=be.tag,be!==5&&be!==26&&be!==27||ne===null||ie===null||(be=Ka(ee,ie),be!=null&&qe.push(Ro(ee,be,ne))),Bt)break;ee=ee.return}0<qe.length&&(le=new fe(le,Le,null,a,me),Se.push({event:le,listeners:qe}))}}if((i&7)===0){e:{if(le=e==="mouseover"||e==="pointerover",fe=e==="mouseout"||e==="pointerout",le&&a!==je&&(Le=a.relatedTarget||a.fromElement)&&(at(Le)||Le[We]))break e;if((fe||le)&&(le=me.window===me?me:(le=me.ownerDocument)?le.defaultView||le.parentWindow:window,fe?(Le=a.relatedTarget||a.toElement,fe=re,Le=Le?at(Le):null,Le!==null&&(Bt=d(Le),qe=Le.tag,Le!==Bt||qe!==5&&qe!==27&&qe!==6)&&(Le=null)):(fe=null,Le=re),fe!==Le)){if(qe=Sv,be="onMouseLeave",ie="onMouseEnter",ee="mouse",(e==="pointerout"||e==="pointerover")&&(qe=xv,be="onPointerLeave",ie="onPointerEnter",ee="pointer"),Bt=fe==null?le:ls(fe),ne=Le==null?le:ls(Le),le=new qe(be,ee+"leave",fe,a,me),le.target=Bt,le.relatedTarget=ne,be=null,at(me)===re&&(qe=new qe(ie,ee+"enter",Le,a,me),qe.target=ne,qe.relatedTarget=Bt,be=qe),Bt=be,fe&&Le)t:{for(qe=Yw,ie=fe,ee=Le,ne=0,be=ie;be;be=qe(be))ne++;be=0;for(var ze=ee;ze;ze=qe(ze))be++;for(;0<ne-be;)ie=qe(ie),ne--;for(;0<be-ne;)ee=qe(ee),be--;for(;ne--;){if(ie===ee||ee!==null&&ie===ee.alternate){qe=ie;break t}ie=qe(ie),ee=qe(ee)}qe=null}else qe=null;fe!==null&&p_(Se,le,fe,qe,!1),Le!==null&&Bt!==null&&p_(Se,Bt,Le,qe,!0)}}e:{if(le=re?ls(re):window,fe=le.nodeName&&le.nodeName.toLowerCase(),fe==="select"||fe==="input"&&le.type==="file")var bt=jv;else if(Rv(le))if(Dv)bt=rw;else{bt=iw;var Be=sw}else fe=le.nodeName,!fe||fe.toLowerCase()!=="input"||le.type!=="checkbox"&&le.type!=="radio"?re&&Pr(re.elementType)&&(bt=jv):bt=nw;if(bt&&(bt=bt(e,re))){Mv(Se,bt,a,me);break e}Be&&Be(e,le,re),e==="focusout"&&re&&le.type==="number"&&re.memoizedProps.value!=null&&$r(le,"number",le.value)}switch(Be=re?ls(re):window,e){case"focusin":(Rv(Be)||Be.contentEditable==="true")&&(qr=Be,nh=re,io=null);break;case"focusout":io=nh=qr=null;break;case"mousedown":rh=!0;break;case"contextmenu":case"mouseup":case"dragend":rh=!1,$v(Se,a,me);break;case"selectionchange":if(ow)break;case"keydown":case"keyup":$v(Se,a,me)}var rt;if(eh)e:{switch(e){case"compositionstart":var ut="onCompositionStart";break e;case"compositionend":ut="onCompositionEnd";break e;case"compositionupdate":ut="onCompositionUpdate";break e}ut=void 0}else Fr?Tv(e,a)&&(ut="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(ut="onCompositionStart");ut&&(Cv&&a.locale!=="ko"&&(Fr||ut!=="onCompositionStart"?ut==="onCompositionEnd"&&Fr&&(rt=yv()):(kn=me,Ku="value"in kn?kn.value:kn.textContent,Fr=!0)),Be=xc(re,ut),0<Be.length&&(ut=new wv(ut,e,null,a,me),Se.push({event:ut,listeners:Be}),rt?ut.data=rt:(rt=Av(a),rt!==null&&(ut.data=rt)))),(rt=JS?ZS(e,a):QS(e,a))&&(ut=xc(re,"onBeforeInput"),0<ut.length&&(Be=new wv("onBeforeInput","beforeinput",null,a,me),Se.push({event:Be,listeners:ut}),Be.data=rt)),qw(Se,e,re,a,me)}d_(Se,i)})}function Ro(e,i,a){return{instance:e,listener:i,currentTarget:a}}function xc(e,i){for(var a=i+"Capture",o=[];e!==null;){var _=e,w=_.stateNode;if(_=_.tag,_!==5&&_!==26&&_!==27||w===null||(_=Ka(e,a),_!=null&&o.unshift(Ro(e,_,w)),_=Ka(e,i),_!=null&&o.push(Ro(e,_,w))),e.tag===3)return o;e=e.return}return[]}function Yw(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function p_(e,i,a,o,_){for(var w=i._reactName,L=[];a!==null&&a!==o;){var P=a,K=P.alternate,re=P.stateNode;if(P=P.tag,K!==null&&K===o)break;P!==5&&P!==26&&P!==27||re===null||(K=re,_?(re=Ka(a,w),re!=null&&L.unshift(Ro(a,re,K))):_||(re=Ka(a,w),re!=null&&L.push(Ro(a,re,K)))),a=a.return}L.length!==0&&e.push({event:i,listeners:L})}var Kw=/\r\n?/g,Xw=/\u0000|\uFFFD/g;function v_(e){return(typeof e=="string"?e:""+e).replace(Kw,`
|
|
49
|
-
`).replace(Xw,"")}function m_(e,i){return i=v_(i),v_(e)===i}function Ot(e,i,a,o,_,w){switch(a){case"children":typeof o=="string"?i==="body"||i==="textarea"&&o===""||Ki(e,o):(typeof o=="number"||typeof o=="bigint")&&i!=="body"&&Ki(e,""+o);break;case"className":ir(e,"class",o);break;case"tabIndex":ir(e,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":ir(e,a,o);break;case"style":Ya(e,o,w);break;case"data":if(i!=="object"){ir(e,"data",o);break}case"src":case"href":if(o===""&&(i!=="a"||a!=="href")){e.removeAttribute(a);break}if(o==null||typeof o=="function"||typeof o=="symbol"||typeof o=="boolean"){e.removeAttribute(a);break}o=V(""+o),e.setAttribute(a,o);break;case"action":case"formAction":if(typeof o=="function"){e.setAttribute(a,"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 w=="function"&&(a==="formAction"?(i!=="input"&&Ot(e,i,"name",_.name,_,null),Ot(e,i,"formEncType",_.formEncType,_,null),Ot(e,i,"formMethod",_.formMethod,_,null),Ot(e,i,"formTarget",_.formTarget,_,null)):(Ot(e,i,"encType",_.encType,_,null),Ot(e,i,"method",_.method,_,null),Ot(e,i,"target",_.target,_,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){e.removeAttribute(a);break}o=V(""+o),e.setAttribute(a,o);break;case"onClick":o!=null&&(e.onclick=ve);break;case"onScroll":o!=null&<("scroll",e);break;case"onScrollEnd":o!=null&<("scrollend",e);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(r(61));if(a=o.__html,a!=null){if(_.children!=null)throw Error(r(60));e.innerHTML=a}}break;case"multiple":e.multiple=o&&typeof o!="function"&&typeof o!="symbol";break;case"muted":e.muted=o&&typeof o!="function"&&typeof o!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(o==null||typeof o=="function"||typeof o=="boolean"||typeof o=="symbol"){e.removeAttribute("xlink:href");break}a=V(""+o),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":o!=null&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(a,""+o):e.removeAttribute(a);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":o&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":o===!0?e.setAttribute(a,""):o!==!1&&o!=null&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(a,o):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":o!=null&&typeof o!="function"&&typeof o!="symbol"&&!isNaN(o)&&1<=o?e.setAttribute(a,o):e.removeAttribute(a);break;case"rowSpan":case"start":o==null||typeof o=="function"||typeof o=="symbol"||isNaN(o)?e.removeAttribute(a):e.setAttribute(a,o);break;case"popover":lt("beforetoggle",e),lt("toggle",e),En(e,"popover",o);break;case"xlinkActuate":ji(e,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":ji(e,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":ji(e,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":ji(e,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":ji(e,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":ji(e,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":ji(e,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":ji(e,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":ji(e,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":En(e,"is",o);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=Al.get(a)||a,En(e,a,o))}}function Md(e,i,a,o,_,w){switch(a){case"style":Ya(e,o,w);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(r(61));if(a=o.__html,a!=null){if(_.children!=null)throw Error(r(60));e.innerHTML=a}}break;case"children":typeof o=="string"?Ki(e,o):(typeof o=="number"||typeof o=="bigint")&&Ki(e,""+o);break;case"onScroll":o!=null&<("scroll",e);break;case"onScrollEnd":o!=null&<("scrollend",e);break;case"onClick":o!=null&&(e.onclick=ve);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Mi.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(_=a.endsWith("Capture"),i=a.slice(2,_?a.length-7:void 0),w=e[Fe]||null,w=w!=null?w[a]:null,typeof w=="function"&&e.removeEventListener(i,w,_),typeof o=="function")){typeof w!="function"&&w!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(i,o,_);break e}a in e?e[a]=o:o===!0?e.setAttribute(a,""):En(e,a,o)}}}function js(e,i,a){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":lt("error",e),lt("load",e);var o=!1,_=!1,w;for(w in a)if(a.hasOwnProperty(w)){var L=a[w];if(L!=null)switch(w){case"src":o=!0;break;case"srcSet":_=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,i));default:Ot(e,i,w,L,a,null)}}_&&Ot(e,i,"srcSet",a.srcSet,a,null),o&&Ot(e,i,"src",a.src,a,null);return;case"input":lt("invalid",e);var P=w=L=_=null,K=null,re=null;for(o in a)if(a.hasOwnProperty(o)){var me=a[o];if(me!=null)switch(o){case"name":_=me;break;case"type":L=me;break;case"checked":K=me;break;case"defaultChecked":re=me;break;case"value":w=me;break;case"defaultValue":P=me;break;case"children":case"dangerouslySetInnerHTML":if(me!=null)throw Error(r(137,i));break;default:Ot(e,i,o,me,a,null)}}qa(e,w,P,K,re,L,_,!1);return;case"select":lt("invalid",e),o=L=w=null;for(_ in a)if(a.hasOwnProperty(_)&&(P=a[_],P!=null))switch(_){case"value":w=P;break;case"defaultValue":L=P;break;case"multiple":o=P;default:Ot(e,i,_,P,a,null)}i=w,a=L,e.multiple=!!o,i!=null?Yi(e,!!o,i,!1):a!=null&&Yi(e,!!o,a,!0);return;case"textarea":lt("invalid",e),w=_=o=null;for(L in a)if(a.hasOwnProperty(L)&&(P=a[L],P!=null))switch(L){case"value":o=P;break;case"defaultValue":_=P;break;case"children":w=P;break;case"dangerouslySetInnerHTML":if(P!=null)throw Error(r(91));break;default:Ot(e,i,L,P,a,null)}Ga(e,o,_,w);return;case"option":for(K in a)if(a.hasOwnProperty(K)&&(o=a[K],o!=null))switch(K){case"selected":e.selected=o&&typeof o!="function"&&typeof o!="symbol";break;default:Ot(e,i,K,o,a,null)}return;case"dialog":lt("beforetoggle",e),lt("toggle",e),lt("cancel",e),lt("close",e);break;case"iframe":case"object":lt("load",e);break;case"video":case"audio":for(o=0;o<Ao.length;o++)lt(Ao[o],e);break;case"image":lt("error",e),lt("load",e);break;case"details":lt("toggle",e);break;case"embed":case"source":case"link":lt("error",e),lt("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(re in a)if(a.hasOwnProperty(re)&&(o=a[re],o!=null))switch(re){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,i));default:Ot(e,i,re,o,a,null)}return;default:if(Pr(i)){for(me in a)a.hasOwnProperty(me)&&(o=a[me],o!==void 0&&Md(e,i,me,o,a,void 0));return}}for(P in a)a.hasOwnProperty(P)&&(o=a[P],o!=null&&Ot(e,i,P,o,a,null))}function Jw(e,i,a,o){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var _=null,w=null,L=null,P=null,K=null,re=null,me=null;for(fe in a){var Se=a[fe];if(a.hasOwnProperty(fe)&&Se!=null)switch(fe){case"checked":break;case"value":break;case"defaultValue":K=Se;default:o.hasOwnProperty(fe)||Ot(e,i,fe,null,o,Se)}}for(var le in o){var fe=o[le];if(Se=a[le],o.hasOwnProperty(le)&&(fe!=null||Se!=null))switch(le){case"type":w=fe;break;case"name":_=fe;break;case"checked":re=fe;break;case"defaultChecked":me=fe;break;case"value":L=fe;break;case"defaultValue":P=fe;break;case"children":case"dangerouslySetInnerHTML":if(fe!=null)throw Error(r(137,i));break;default:fe!==Se&&Ot(e,i,le,fe,o,Se)}}zr(e,L,P,K,re,me,w,_);return;case"select":fe=L=P=le=null;for(w in a)if(K=a[w],a.hasOwnProperty(w)&&K!=null)switch(w){case"value":break;case"multiple":fe=K;default:o.hasOwnProperty(w)||Ot(e,i,w,null,o,K)}for(_ in o)if(w=o[_],K=a[_],o.hasOwnProperty(_)&&(w!=null||K!=null))switch(_){case"value":le=w;break;case"defaultValue":P=w;break;case"multiple":L=w;default:w!==K&&Ot(e,i,_,w,o,K)}i=P,a=L,o=fe,le!=null?Yi(e,!!a,le,!1):!!o!=!!a&&(i!=null?Yi(e,!!a,i,!0):Yi(e,!!a,a?[]:"",!1));return;case"textarea":fe=le=null;for(P in a)if(_=a[P],a.hasOwnProperty(P)&&_!=null&&!o.hasOwnProperty(P))switch(P){case"value":break;case"children":break;default:Ot(e,i,P,null,o,_)}for(L in o)if(_=o[L],w=a[L],o.hasOwnProperty(L)&&(_!=null||w!=null))switch(L){case"value":le=_;break;case"defaultValue":fe=_;break;case"children":break;case"dangerouslySetInnerHTML":if(_!=null)throw Error(r(91));break;default:_!==w&&Ot(e,i,L,_,o,w)}Wa(e,le,fe);return;case"option":for(var Le in a)if(le=a[Le],a.hasOwnProperty(Le)&&le!=null&&!o.hasOwnProperty(Le))switch(Le){case"selected":e.selected=!1;break;default:Ot(e,i,Le,null,o,le)}for(K in o)if(le=o[K],fe=a[K],o.hasOwnProperty(K)&&le!==fe&&(le!=null||fe!=null))switch(K){case"selected":e.selected=le&&typeof le!="function"&&typeof le!="symbol";break;default:Ot(e,i,K,le,o,fe)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var qe in a)le=a[qe],a.hasOwnProperty(qe)&&le!=null&&!o.hasOwnProperty(qe)&&Ot(e,i,qe,null,o,le);for(re in o)if(le=o[re],fe=a[re],o.hasOwnProperty(re)&&le!==fe&&(le!=null||fe!=null))switch(re){case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(r(137,i));break;default:Ot(e,i,re,le,o,fe)}return;default:if(Pr(i)){for(var Bt in a)le=a[Bt],a.hasOwnProperty(Bt)&&le!==void 0&&!o.hasOwnProperty(Bt)&&Md(e,i,Bt,void 0,o,le);for(me in o)le=o[me],fe=a[me],!o.hasOwnProperty(me)||le===fe||le===void 0&&fe===void 0||Md(e,i,me,le,o,fe);return}}for(var ie in a)le=a[ie],a.hasOwnProperty(ie)&&le!=null&&!o.hasOwnProperty(ie)&&Ot(e,i,ie,null,o,le);for(Se in o)le=o[Se],fe=a[Se],!o.hasOwnProperty(Se)||le===fe||le==null&&fe==null||Ot(e,i,Se,le,o,fe)}function g_(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Zw(){if(typeof performance.getEntriesByType=="function"){for(var e=0,i=0,a=performance.getEntriesByType("resource"),o=0;o<a.length;o++){var _=a[o],w=_.transferSize,L=_.initiatorType,P=_.duration;if(w&&P&&g_(L)){for(L=0,P=_.responseEnd,o+=1;o<a.length;o++){var K=a[o],re=K.startTime;if(re>P)break;var me=K.transferSize,Se=K.initiatorType;me&&g_(Se)&&(K=K.responseEnd,L+=me*(K<P?1:(P-re)/(K-re)))}if(--o,i+=8*(w+L)/(_.duration/1e3),e++,10<e)break}}if(0<e)return i/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var jd=null,Dd=null;function Cc(e){return e.nodeType===9?e:e.ownerDocument}function __(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function y_(e,i){if(e===0)switch(i){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&i==="foreignObject"?0:e}function Nd(e,i){return e==="textarea"||e==="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 Ld=null;function Qw(){var e=window.event;return e&&e.type==="popstate"?e===Ld?!1:(Ld=e,!0):(Ld=null,!1)}var b_=typeof setTimeout=="function"?setTimeout:void 0,ex=typeof clearTimeout=="function"?clearTimeout:void 0,S_=typeof Promise=="function"?Promise:void 0,tx=typeof queueMicrotask=="function"?queueMicrotask:typeof S_<"u"?function(e){return S_.resolve(null).then(e).catch(sx)}:b_;function sx(e){setTimeout(function(){throw e})}function Fn(e){return e==="head"}function w_(e,i){var a=i,o=0;do{var _=a.nextSibling;if(e.removeChild(a),_&&_.nodeType===8)if(a=_.data,a==="/$"||a==="/&"){if(o===0){e.removeChild(_),ga(i);return}o--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")o++;else if(a==="html")Mo(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,Mo(a);for(var w=a.firstChild;w;){var L=w.nextSibling,P=w.nodeName;w[Me]||P==="SCRIPT"||P==="STYLE"||P==="LINK"&&w.rel.toLowerCase()==="stylesheet"||a.removeChild(w),w=L}}else a==="body"&&Mo(e.ownerDocument.body);a=_}while(a);ga(i)}function x_(e,i){var a=e;e=0;do{var o=a.nextSibling;if(a.nodeType===1?i?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(i?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),o&&o.nodeType===8)if(a=o.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=o}while(a)}function Od(e){var i=e.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var a=i;switch(i=i.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":Od(a),Re(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function ix(e,i,a,o){for(;e.nodeType===1;){var _=a;if(e.nodeName.toLowerCase()!==i.toLowerCase()){if(!o&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(o){if(!e[Me])switch(i){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(w=e.getAttribute("rel"),w==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(w!==_.rel||e.getAttribute("href")!==(_.href==null||_.href===""?null:_.href)||e.getAttribute("crossorigin")!==(_.crossOrigin==null?null:_.crossOrigin)||e.getAttribute("title")!==(_.title==null?null:_.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(w=e.getAttribute("src"),(w!==(_.src==null?null:_.src)||e.getAttribute("type")!==(_.type==null?null:_.type)||e.getAttribute("crossorigin")!==(_.crossOrigin==null?null:_.crossOrigin))&&w&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(i==="input"&&e.type==="hidden"){var w=_.name==null?null:""+_.name;if(_.type==="hidden"&&e.getAttribute("name")===w)return e}else return e;if(e=xi(e.nextSibling),e===null)break}return null}function nx(e,i,a){if(i==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=xi(e.nextSibling),e===null))return null;return e}function C_(e,i){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!i||(e=xi(e.nextSibling),e===null))return null;return e}function Bd(e){return e.data==="$?"||e.data==="$~"}function Hd(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function rx(e,i){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=i;else if(e.data!=="$?"||a.readyState!=="loading")i();else{var o=function(){i(),a.removeEventListener("DOMContentLoaded",o)};a.addEventListener("DOMContentLoaded",o),e._reactRetry=o}}function xi(e){for(;e!=null;e=e.nextSibling){var i=e.nodeType;if(i===1||i===3)break;if(i===8){if(i=e.data,i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"||i==="F!"||i==="F")break;if(i==="/$"||i==="/&")return null}}return e}var Id=null;function E_(e){e=e.nextSibling;for(var i=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(i===0)return xi(e.nextSibling);i--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||i++}e=e.nextSibling}return null}function k_(e){e=e.previousSibling;for(var i=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(i===0)return e;i--}else a!=="/$"&&a!=="/&"||i++}e=e.previousSibling}return null}function T_(e,i,a){switch(i=Cc(a),e){case"html":if(e=i.documentElement,!e)throw Error(r(452));return e;case"head":if(e=i.head,!e)throw Error(r(453));return e;case"body":if(e=i.body,!e)throw Error(r(454));return e;default:throw Error(r(451))}}function Mo(e){for(var i=e.attributes;i.length;)e.removeAttributeNode(i[0]);Re(e)}var Ci=new Map,A_=new Set;function Ec(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var dn=Q.d;Q.d={f:ax,r:ox,D:lx,C:cx,L:ux,m:hx,X:fx,S:dx,M:px};function ax(){var e=dn.f(),i=mc();return e||i}function ox(e){var i=Pe(e);i!==null&&i.tag===5&&i.type==="form"?Wm(i):dn.r(e)}var pa=typeof document>"u"?null:document;function R_(e,i,a){var o=pa;if(o&&typeof i=="string"&&i){var _=Us(i);_='link[rel="'+e+'"][href="'+_+'"]',typeof a=="string"&&(_+='[crossorigin="'+a+'"]'),A_.has(_)||(A_.add(_),e={rel:e,crossOrigin:a,href:i},o.querySelector(_)===null&&(i=o.createElement("link"),js(i,"link",e),At(i),o.head.appendChild(i)))}}function lx(e){dn.D(e),R_("dns-prefetch",e,null)}function cx(e,i){dn.C(e,i),R_("preconnect",e,i)}function ux(e,i,a){dn.L(e,i,a);var o=pa;if(o&&e&&i){var _='link[rel="preload"][as="'+Us(i)+'"]';i==="image"&&a&&a.imageSrcSet?(_+='[imagesrcset="'+Us(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(_+='[imagesizes="'+Us(a.imageSizes)+'"]')):_+='[href="'+Us(e)+'"]';var w=_;switch(i){case"style":w=va(e);break;case"script":w=ma(e)}Ci.has(w)||(e=f({rel:"preload",href:i==="image"&&a&&a.imageSrcSet?void 0:e,as:i},a),Ci.set(w,e),o.querySelector(_)!==null||i==="style"&&o.querySelector(jo(w))||i==="script"&&o.querySelector(Do(w))||(i=o.createElement("link"),js(i,"link",e),At(i),o.head.appendChild(i)))}}function hx(e,i){dn.m(e,i);var a=pa;if(a&&e){var o=i&&typeof i.as=="string"?i.as:"script",_='link[rel="modulepreload"][as="'+Us(o)+'"][href="'+Us(e)+'"]',w=_;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":w=ma(e)}if(!Ci.has(w)&&(e=f({rel:"modulepreload",href:e},i),Ci.set(w,e),a.querySelector(_)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Do(w)))return}o=a.createElement("link"),js(o,"link",e),At(o),a.head.appendChild(o)}}}function dx(e,i,a){dn.S(e,i,a);var o=pa;if(o&&e){var _=ks(o).hoistableStyles,w=va(e);i=i||"default";var L=_.get(w);if(!L){var P={loading:0,preload:null};if(L=o.querySelector(jo(w)))P.loading=5;else{e=f({rel:"stylesheet",href:e,"data-precedence":i},a),(a=Ci.get(w))&&zd(e,a);var K=L=o.createElement("link");At(K),js(K,"link",e),K._p=new Promise(function(re,me){K.onload=re,K.onerror=me}),K.addEventListener("load",function(){P.loading|=1}),K.addEventListener("error",function(){P.loading|=2}),P.loading|=4,kc(L,i,o)}L={type:"stylesheet",instance:L,count:1,state:P},_.set(w,L)}}}function fx(e,i){dn.X(e,i);var a=pa;if(a&&e){var o=ks(a).hoistableScripts,_=ma(e),w=o.get(_);w||(w=a.querySelector(Do(_)),w||(e=f({src:e,async:!0},i),(i=Ci.get(_))&&$d(e,i),w=a.createElement("script"),At(w),js(w,"link",e),a.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},o.set(_,w))}}function px(e,i){dn.M(e,i);var a=pa;if(a&&e){var o=ks(a).hoistableScripts,_=ma(e),w=o.get(_);w||(w=a.querySelector(Do(_)),w||(e=f({src:e,async:!0,type:"module"},i),(i=Ci.get(_))&&$d(e,i),w=a.createElement("script"),At(w),js(w,"link",e),a.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},o.set(_,w))}}function M_(e,i,a,o){var _=(_=ge.current)?Ec(_):null;if(!_)throw Error(r(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(i=va(a.href),a=ks(_).hoistableStyles,o=a.get(i),o||(o={type:"style",instance:null,count:0,state:null},a.set(i,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=va(a.href);var w=ks(_).hoistableStyles,L=w.get(e);if(L||(_=_.ownerDocument||_,L={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},w.set(e,L),(w=_.querySelector(jo(e)))&&!w._p&&(L.instance=w,L.state.loading=5),Ci.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},Ci.set(e,a),w||vx(_,e,a,L.state))),i&&o===null)throw Error(r(528,""));return L}if(i&&o!==null)throw Error(r(529,""));return null;case"script":return i=a.async,a=a.src,typeof a=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=ma(a),a=ks(_).hoistableScripts,o=a.get(i),o||(o={type:"script",instance:null,count:0,state:null},a.set(i,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,e))}}function va(e){return'href="'+Us(e)+'"'}function jo(e){return'link[rel="stylesheet"]['+e+"]"}function j_(e){return f({},e,{"data-precedence":e.precedence,precedence:null})}function vx(e,i,a,o){e.querySelector('link[rel="preload"][as="style"]['+i+"]")?o.loading=1:(i=e.createElement("link"),o.preload=i,i.addEventListener("load",function(){return o.loading|=1}),i.addEventListener("error",function(){return o.loading|=2}),js(i,"link",a),At(i),e.head.appendChild(i))}function ma(e){return'[src="'+Us(e)+'"]'}function Do(e){return"script[async]"+e}function D_(e,i,a){if(i.count++,i.instance===null)switch(i.type){case"style":var o=e.querySelector('style[data-href~="'+Us(a.href)+'"]');if(o)return i.instance=o,At(o),o;var _=f({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return o=(e.ownerDocument||e).createElement("style"),At(o),js(o,"style",_),kc(o,a.precedence,e),i.instance=o;case"stylesheet":_=va(a.href);var w=e.querySelector(jo(_));if(w)return i.state.loading|=4,i.instance=w,At(w),w;o=j_(a),(_=Ci.get(_))&&zd(o,_),w=(e.ownerDocument||e).createElement("link"),At(w);var L=w;return L._p=new Promise(function(P,K){L.onload=P,L.onerror=K}),js(w,"link",o),i.state.loading|=4,kc(w,a.precedence,e),i.instance=w;case"script":return w=ma(a.src),(_=e.querySelector(Do(w)))?(i.instance=_,At(_),_):(o=a,(_=Ci.get(w))&&(o=f({},a),$d(o,_)),e=e.ownerDocument||e,_=e.createElement("script"),At(_),js(_,"link",o),e.head.appendChild(_),i.instance=_);case"void":return null;default:throw Error(r(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(o=i.instance,i.state.loading|=4,kc(o,a.precedence,e));return i.instance}function kc(e,i,a){for(var o=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),_=o.length?o[o.length-1]:null,w=_,L=0;L<o.length;L++){var P=o[L];if(P.dataset.precedence===i)w=P;else if(w!==_)break}w?w.parentNode.insertBefore(e,w.nextSibling):(i=a.nodeType===9?a.head:a,i.insertBefore(e,i.firstChild))}function zd(e,i){e.crossOrigin==null&&(e.crossOrigin=i.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=i.referrerPolicy),e.title==null&&(e.title=i.title)}function $d(e,i){e.crossOrigin==null&&(e.crossOrigin=i.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=i.referrerPolicy),e.integrity==null&&(e.integrity=i.integrity)}var Tc=null;function N_(e,i,a){if(Tc===null){var o=new Map,_=Tc=new Map;_.set(a,o)}else _=Tc,o=_.get(a),o||(o=new Map,_.set(a,o));if(o.has(e))return o;for(o.set(e,null),a=a.getElementsByTagName(e),_=0;_<a.length;_++){var w=a[_];if(!(w[Me]||w[ke]||e==="link"&&w.getAttribute("rel")==="stylesheet")&&w.namespaceURI!=="http://www.w3.org/2000/svg"){var L=w.getAttribute(i)||"";L=e+L;var P=o.get(L);P?P.push(w):o.set(L,[w])}}return o}function L_(e,i,a){e=e.ownerDocument||e,e.head.insertBefore(a,i==="title"?e.querySelector("head > title"):null)}function mx(e,i,a){if(a===1||i.itemProp!=null)return!1;switch(e){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 e=i.disabled,typeof i.precedence=="string"&&e==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 O_(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function gx(e,i,a,o){if(a.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var _=va(o.href),w=i.querySelector(jo(_));if(w){i=w._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(e.count++,e=Ac.bind(e),i.then(e,e)),a.state.loading|=4,a.instance=w,At(w);return}w=i.ownerDocument||i,o=j_(o),(_=Ci.get(_))&&zd(o,_),w=w.createElement("link"),At(w);var L=w;L._p=new Promise(function(P,K){L.onload=P,L.onerror=K}),js(w,"link",o),a.instance=w}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,i),(i=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=Ac.bind(e),i.addEventListener("load",a),i.addEventListener("error",a))}}var Pd=0;function _x(e,i){return e.stylesheets&&e.count===0&&Mc(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var o=setTimeout(function(){if(e.stylesheets&&Mc(e,e.stylesheets),e.unsuspend){var w=e.unsuspend;e.unsuspend=null,w()}},6e4+i);0<e.imgBytes&&Pd===0&&(Pd=62500*Zw());var _=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Mc(e,e.stylesheets),e.unsuspend)){var w=e.unsuspend;e.unsuspend=null,w()}},(e.imgBytes>Pd?50:800)+i);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(o),clearTimeout(_)}}:null}function Ac(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Mc(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Rc=null;function Mc(e,i){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Rc=new Map,i.forEach(yx,e),Rc=null,Ac.call(e))}function yx(e,i){if(!(i.state.loading&4)){var a=Rc.get(e);if(a)var o=a.get(null);else{a=new Map,Rc.set(e,a);for(var _=e.querySelectorAll("link[data-precedence],style[data-precedence]"),w=0;w<_.length;w++){var L=_[w];(L.nodeName==="LINK"||L.getAttribute("media")!=="not all")&&(a.set(L.dataset.precedence,L),o=L)}o&&a.set(null,o)}_=i.instance,L=_.getAttribute("data-precedence"),w=a.get(L)||o,w===o&&a.set(null,_),a.set(L,_),this.count++,o=Ac.bind(this),_.addEventListener("load",o),_.addEventListener("error",o),w?w.parentNode.insertBefore(_,w.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(_,e.firstChild)),i.state.loading|=4}}var No={$$typeof:g,Provider:null,Consumer:null,_currentValue:J,_currentValue2:J,_threadCount:0};function bx(e,i,a,o,_,w,L,P,K){this.tag=1,this.containerInfo=e,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=Bs(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Bs(0),this.hiddenUpdates=Bs(null),this.identifierPrefix=o,this.onUncaughtError=_,this.onCaughtError=w,this.onRecoverableError=L,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=K,this.incompleteTransitions=new Map}function B_(e,i,a,o,_,w,L,P,K,re,me,Se){return e=new bx(e,i,a,L,K,re,me,Se,P),i=1,w===!0&&(i|=24),w=ai(3,null,null,i),e.current=w,w.stateNode=e,i=bh(),i.refCount++,e.pooledCache=i,i.refCount++,w.memoizedState={element:o,isDehydrated:a,cache:i},Ch(w),e}function H_(e){return e?(e=Vr,e):Vr}function I_(e,i,a,o,_,w){_=H_(_),o.context===null?o.context=_:o.pendingContext=_,o=Dn(i),o.payload={element:a},w=w===void 0?null:w,w!==null&&(o.callback=w),a=Nn(e,o,i),a!==null&&(Qs(a,e,i),uo(a,e,i))}function z_(e,i){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<i?a:i}}function Ud(e,i){z_(e,i),(e=e.alternate)&&z_(e,i)}function $_(e){if(e.tag===13||e.tag===31){var i=lr(e,67108864);i!==null&&Qs(i,e,67108864),Ud(e,67108864)}}function P_(e){if(e.tag===13||e.tag===31){var i=hi();i=Ii(i);var a=lr(e,i);a!==null&&Qs(a,e,i),Ud(e,i)}}var jc=!0;function Sx(e,i,a,o){var _=F.T;F.T=null;var w=Q.p;try{Q.p=2,Fd(e,i,a,o)}finally{Q.p=w,F.T=_}}function wx(e,i,a,o){var _=F.T;F.T=null;var w=Q.p;try{Q.p=8,Fd(e,i,a,o)}finally{Q.p=w,F.T=_}}function Fd(e,i,a,o){if(jc){var _=qd(o);if(_===null)Rd(e,i,o,Dc,a),F_(e,o);else if(Cx(_,e,i,a,o))o.stopPropagation();else if(F_(e,o),i&4&&-1<xx.indexOf(e)){for(;_!==null;){var w=Pe(_);if(w!==null)switch(w.tag){case 3:if(w=w.stateNode,w.current.memoizedState.isDehydrated){var L=Ie(w.pendingLanes);if(L!==0){var P=w;for(P.pendingLanes|=2,P.entangledLanes|=2;L;){var K=1<<31-kt(L);P.entanglements[1]|=K,L&=~K}Fi(w),(wt&6)===0&&(pc=vt()+500,To(0))}}break;case 31:case 13:P=lr(w,2),P!==null&&Qs(P,w,2),mc(),Ud(w,2)}if(w=qd(o),w===null&&Rd(e,i,o,Dc,a),w===_)break;_=w}_!==null&&o.stopPropagation()}else Rd(e,i,o,null,a)}}function qd(e){return e=Ve(e),Wd(e)}var Dc=null;function Wd(e){if(Dc=null,e=at(e),e!==null){var i=d(e);if(i===null)e=null;else{var a=i.tag;if(a===13){if(e=p(i),e!==null)return e;e=null}else if(a===31){if(e=c(i),e!==null)return e;e=null}else if(a===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;e=null}else i!==e&&(e=null)}}return Dc=e,null}function U_(e){switch(e){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(Ct()){case $t:return 2;case ds:return 8;case mt:case fs:return 32;case $e:return 268435456;default:return 32}default:return 32}}var Gd=!1,qn=null,Wn=null,Gn=null,Lo=new Map,Oo=new Map,Vn=[],xx="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 F_(e,i){switch(e){case"focusin":case"focusout":qn=null;break;case"dragenter":case"dragleave":Wn=null;break;case"mouseover":case"mouseout":Gn=null;break;case"pointerover":case"pointerout":Lo.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":Oo.delete(i.pointerId)}}function Bo(e,i,a,o,_,w){return e===null||e.nativeEvent!==w?(e={blockedOn:i,domEventName:a,eventSystemFlags:o,nativeEvent:w,targetContainers:[_]},i!==null&&(i=Pe(i),i!==null&&$_(i)),e):(e.eventSystemFlags|=o,i=e.targetContainers,_!==null&&i.indexOf(_)===-1&&i.push(_),e)}function Cx(e,i,a,o,_){switch(i){case"focusin":return qn=Bo(qn,e,i,a,o,_),!0;case"dragenter":return Wn=Bo(Wn,e,i,a,o,_),!0;case"mouseover":return Gn=Bo(Gn,e,i,a,o,_),!0;case"pointerover":var w=_.pointerId;return Lo.set(w,Bo(Lo.get(w)||null,e,i,a,o,_)),!0;case"gotpointercapture":return w=_.pointerId,Oo.set(w,Bo(Oo.get(w)||null,e,i,a,o,_)),!0}return!1}function q_(e){var i=at(e.target);if(i!==null){var a=d(i);if(a!==null){if(i=a.tag,i===13){if(i=p(a),i!==null){e.blockedOn=i,ye(e.priority,function(){P_(a)});return}}else if(i===31){if(i=c(a),i!==null){e.blockedOn=i,ye(e.priority,function(){P_(a)});return}}else if(i===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Nc(e){if(e.blockedOn!==null)return!1;for(var i=e.targetContainers;0<i.length;){var a=qd(e.nativeEvent);if(a===null){a=e.nativeEvent;var o=new a.constructor(a.type,a);je=o,a.target.dispatchEvent(o),je=null}else return i=Pe(a),i!==null&&$_(i),e.blockedOn=a,!1;i.shift()}return!0}function W_(e,i,a){Nc(e)&&a.delete(i)}function Ex(){Gd=!1,qn!==null&&Nc(qn)&&(qn=null),Wn!==null&&Nc(Wn)&&(Wn=null),Gn!==null&&Nc(Gn)&&(Gn=null),Lo.forEach(W_),Oo.forEach(W_)}function Lc(e,i){e.blockedOn===i&&(e.blockedOn=null,Gd||(Gd=!0,s.unstable_scheduleCallback(s.unstable_NormalPriority,Ex)))}var Oc=null;function G_(e){Oc!==e&&(Oc=e,s.unstable_scheduleCallback(s.unstable_NormalPriority,function(){Oc===e&&(Oc=null);for(var i=0;i<e.length;i+=3){var a=e[i],o=e[i+1],_=e[i+2];if(typeof o!="function"){if(Wd(o||a)===null)continue;break}var w=Pe(a);w!==null&&(e.splice(i,3),i-=3,qh(w,{pending:!0,data:_,method:a.method,action:o},o,_))}}))}function ga(e){function i(K){return Lc(K,e)}qn!==null&&Lc(qn,e),Wn!==null&&Lc(Wn,e),Gn!==null&&Lc(Gn,e),Lo.forEach(i),Oo.forEach(i);for(var a=0;a<Vn.length;a++){var o=Vn[a];o.blockedOn===e&&(o.blockedOn=null)}for(;0<Vn.length&&(a=Vn[0],a.blockedOn===null);)q_(a),a.blockedOn===null&&Vn.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(o=0;o<a.length;o+=3){var _=a[o],w=a[o+1],L=_[Fe]||null;if(typeof w=="function")L||G_(a);else if(L){var P=null;if(w&&w.hasAttribute("formAction")){if(_=w,L=w[Fe]||null)P=L.formAction;else if(Wd(_)!==null)continue}else P=L.action;typeof P=="function"?a[o+1]=P:(a.splice(o,3),o-=3),G_(a)}}}function V_(){function e(w){w.canIntercept&&w.info==="react-transition"&&w.intercept({handler:function(){return new Promise(function(L){return _=L})},focusReset:"manual",scroll:"manual"})}function i(){_!==null&&(_(),_=null),o||setTimeout(a,20)}function a(){if(!o&&!navigation.transition){var w=navigation.currentEntry;w&&w.url!=null&&navigation.navigate(w.url,{state:w.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var o=!1,_=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(a,100),function(){o=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),_!==null&&(_(),_=null)}}}function Vd(e){this._internalRoot=e}Bc.prototype.render=Vd.prototype.render=function(e){var i=this._internalRoot;if(i===null)throw Error(r(409));var a=i.current,o=hi();I_(a,o,e,i,null,null)},Bc.prototype.unmount=Vd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var i=e.containerInfo;I_(e.current,2,null,e,null,null),mc(),i[We]=null}};function Bc(e){this._internalRoot=e}Bc.prototype.unstable_scheduleHydration=function(e){if(e){var i=pe();e={blockedOn:null,target:e,priority:i};for(var a=0;a<Vn.length&&i!==0&&i<Vn[a].priority;a++);Vn.splice(a,0,e),a===0&&q_(e)}};var Y_=t.version;if(Y_!=="19.2.7")throw Error(r(527,Y_,"19.2.7"));Q.findDOMNode=function(e){var i=e._reactInternals;if(i===void 0)throw typeof e.render=="function"?Error(r(188)):(e=Object.keys(e).join(","),Error(r(268,e)));return e=v(i),e=e!==null?S(e):null,e=e===null?null:e.stateNode,e};var kx={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:F,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Hc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Hc.isDisabled&&Hc.supportsFiber)try{Cs=Hc.inject(kx),qt=Hc}catch{}}return Io.createRoot=function(e,i){if(!l(e))throw Error(r(299));var a=!1,o="",_=tg,w=sg,L=ig;return i!=null&&(i.unstable_strictMode===!0&&(a=!0),i.identifierPrefix!==void 0&&(o=i.identifierPrefix),i.onUncaughtError!==void 0&&(_=i.onUncaughtError),i.onCaughtError!==void 0&&(w=i.onCaughtError),i.onRecoverableError!==void 0&&(L=i.onRecoverableError)),i=B_(e,1,!1,null,null,a,o,null,_,w,L,V_),e[We]=i.current,Ad(e),new Vd(i)},Io.hydrateRoot=function(e,i,a){if(!l(e))throw Error(r(299));var o=!1,_="",w=tg,L=sg,P=ig,K=null;return a!=null&&(a.unstable_strictMode===!0&&(o=!0),a.identifierPrefix!==void 0&&(_=a.identifierPrefix),a.onUncaughtError!==void 0&&(w=a.onUncaughtError),a.onCaughtError!==void 0&&(L=a.onCaughtError),a.onRecoverableError!==void 0&&(P=a.onRecoverableError),a.formState!==void 0&&(K=a.formState)),i=B_(e,1,!0,i,a??null,o,_,K,w,L,P,V_),i.context=H_(null),a=i.current,o=hi(),o=Ii(o),_=Dn(o),_.callback=null,Nn(a,_,o),a=o,i.current.lanes=a,we(i,a),Fi(i),e[We]=i.current,Ad(e),new Bc(i)},Io.version="19.2.7",Io}var n0;function Hx(){if(n0)return Jd.exports;n0=1;function s(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(t){console.error(t)}}return s(),Jd.exports=Bx(),Jd.exports}var Ix=Hx();const i1="sapiom-harness-theme",qf=new Set;function zx(){var s;return typeof window<"u"&&((s=window.matchMedia)==null?void 0:s.call(window,"(prefers-color-scheme: dark)").matches)===!0}function $x(){const s=typeof window<"u"?window.localStorage.getItem(i1):null;return s==="light"||s==="dark"?s:zx()?"dark":"light"}let $p=$x();function Ou(){return $p}function Px(s){$p=s,document.documentElement.dataset.theme=s,window.localStorage.setItem(i1,s),qf.forEach(t=>t(s))}function n1(){Px($p==="dark"?"light":"dark")}function Pp(s){return qf.add(s),()=>qf.delete(s)}const r1=Date.now(),Ns=s=>new Date(r1-s*6e4).toISOString(),Je=s=>new Date(r1-s*24*60*6e4).toISOString(),r0="/Users/demo/acme-app";Ns(1),Ns(1),Ns(42),Ns(20),Je(2),Je(1),Je(1),Je(1),Je(3),Je(3),Ns(0),Ns(0),Ns(3),Ns(3);Ns(1),Je(1),Je(1),Je(3),Je(6),Je(45),Je(1);Ns(48),Ns(1),Ns(48),Ns(47),Ns(46),Ns(45),Ns(3),Ns(2),Je(1),Je(1),Je(1),Je(1),Je(1),Je(1),Je(1),Je(1),Je(1),Je(3),Je(3),Je(3),Je(3),Je(3),Je(3),Je(3),Je(3),Je(1),Je(1),Je(1),Je(1),Je(45),Je(45),Je(45),Je(45),Je(45),Je(45),Je(45),Je(45);[...[2,4,5].map((s,t)=>({agentSessionId:`search-standup-${t+1}`,harness:"claude-code",cwd:"/Users/demo/acme-app",title:"Standup summary for #eng",lastActiveAt:Je(s),source:"transcript",resumeMode:"rehydrate",turnCount:6-t})),Je(3),Je(1),Je(6)];function Up(){return!1}function Ta(s){return(s==null?void 0:s.boundWorkflowPath)??null}class di extends Error{constructor(n,r,l){super(r);Yd(this,"status");Yd(this,"reason");this.name="ApiError",this.status=n,this.reason=l}}function Aa(){const s=window.__HARNESS__;return s!=null&&s.token?s.token:new URLSearchParams(window.location.search).get("token")??""}class Ux{startAuth(){return this.request("/api/auth/start",{method:"POST"})}disconnect(){return this.request("/api/auth/disconnect",{method:"POST"})}authStatus(){return this.request("/api/auth/status")}async request(t,n){const r=await fetch(t,{...n,headers:{"Content-Type":"application/json","X-Harness-Token":Aa(),...n==null?void 0:n.headers}});if(!r.ok){const l=await r.text().catch(()=>"");let d;try{const p=l?JSON.parse(l):void 0;p&&typeof p=="object"&&typeof p.error=="string"&&(d=p.error)}catch{}throw new di(r.status,`${(n==null?void 0:n.method)??"GET"} ${t} → ${r.status}${l?`: ${l}`:""}`,d)}if(r.status!==204)return await r.json()}getState(){return this.request("/api/state")}createSession(t){return this.request("/api/sessions",{method:"POST",body:JSON.stringify({theme:Ou(),...t})})}listSessions(){return this.request("/api/sessions")}sessionHistory(t){return this.request(`/api/sessions/history?cwd=${encodeURIComponent(t)}`)}async sessionRecord(t){try{return await this.request(`/api/sessions/${encodeURIComponent(t)}/record`)}catch(n){if(n instanceof di&&(n.status===404||n.status===501))return null;throw n}}resumeSession(t){return this.request(`/api/sessions/${encodeURIComponent(t)}/resume`,{method:"POST"})}adoptSession(t){return this.request("/api/sessions/adopt",{method:"POST",body:JSON.stringify(t)})}async killSession(t){await this.request(`/api/sessions/${encodeURIComponent(t)}`,{method:"DELETE"})}async injectInput(t,n){await this.request(`/api/sessions/${encodeURIComponent(t)}/input`,{method:"POST",body:JSON.stringify(n)})}listWorkflows(){return this.request("/api/workflows")}connectWorkflow(t){return this.request("/api/workflows/connect",{method:"POST",body:JSON.stringify({path:t})})}scanWorkflows(t){return this.request("/api/workflows/scan",{method:"POST",body:JSON.stringify({root:t})})}listHarnesses(){return this.request("/api/harnesses")}listMacros(){return this.request("/api/macros")}async runMacro(t,n){await this.request(`/api/macros/${encodeURIComponent(t)}/run`,{method:"POST",body:JSON.stringify(n)})}getSettings(){return this.request("/api/settings")}updateSettings(t){return this.request("/api/settings",{method:"PATCH",body:JSON.stringify(t)})}listDir(t){const n=t?`?path=${encodeURIComponent(t)}`:"";return this.request(`/api/fs/list${n}`)}bindWorkflow(t,n){const r={workflowPath:n};return this.request(`/api/sessions/${encodeURIComponent(t)}/workflow`,{method:"PATCH",body:JSON.stringify(r)})}listTemplates(){return this.request("/api/templates")}getTemplate(t){return this.request(`/api/templates/${encodeURIComponent(t)}`)}getAccountPlan(){return this.request("/api/account/plan")}getRunState(t){return this.request(`/api/runs/${encodeURIComponent(t)}/state`)}async runLocal(t,n){const r=await fetch("/api/runs/local",{method:"POST",headers:{"Content-Type":"application/json","X-Harness-Token":Aa()},body:JSON.stringify(t)});if(!r.ok||!r.body){const h=await r.text().catch(()=>"");throw new di(r.status,`POST /api/runs/local → ${r.status}${h?`: ${h}`:""}`,void 0)}const l=r.body.getReader(),d=new TextDecoder;let p="";const c=(h,v)=>{p+=h;const{lines:S,rest:f}=qx(p,v);p=f;for(const x of S){const E=Wx(x);E&&n(E)}};for(;;){const{done:h,value:v}=await l.read();if(h)break;c(d.decode(v,{stream:!0}),!1)}c(d.decode(),!0)}async deploy(t,n){const r=await this.streamNdjson(`/api/workflows/${encodeURIComponent(t)}/deploy`,{method:"POST"},n);return Gx(r)}async run(t){return this.request("/api/runs",{method:"POST",body:JSON.stringify(t)})}async streamNdjson(t,n,r){const l=await fetch(t,{...n,headers:{"Content-Type":"application/json","X-Harness-Token":Aa(),...n.headers}});if(!l.ok||!l.body){const S=await l.text().catch(()=>"");let f;try{const x=S?JSON.parse(S):void 0;x&&typeof x=="object"&&typeof x.error=="string"&&(f=x.error)}catch{}throw new di(l.status,`${n.method??"GET"} ${t} → ${l.status}${S?`: ${S}`:""}`,f)}const d=[],p=l.body.getReader(),c=new TextDecoder;let h="";const v=S=>{h+=S;let f=h.indexOf(`
|
|
50
|
-
`);for(;f!==-1;){const x=h.slice(0,f);h=h.slice(f+1);const E=Fx(x);E!==void 0&&(d.push(E),r==null||r(E)),f=h.indexOf(`
|
|
51
|
-
`)}};for(;;){const{done:S,value:f}=await p.read();if(S)break;v(c.decode(f,{stream:!0}))}return v(c.decode()+`
|
|
52
|
-
`),d}}function Fx(s){const t=s.trim();if(t==="")return;let n;try{n=JSON.parse(t)}catch{return}return n===null?void 0:n}function qx(s,t){const n=s.split(`
|
|
53
|
-
`);if(t)return{lines:n.filter(l=>l.trim()!==""),rest:""};const r=n.pop()??"";return{lines:n.filter(l=>l.trim()!==""),rest:r}}function Wx(s){const t=s.trim();if(t==="")return null;let n;try{n=JSON.parse(t)}catch{return null}return typeof n!="object"||n===null||Array.isArray(n)?null:n}function Gx(s){for(let t=s.length-1;t>=0;t--){const n=s[t];if(n.phase==="ready"||n.phase==="error")return n}return{phase:"error",code:"NO_OUTPUT",message:"deploy produced no terminal status"}}function a1(){return new Ux}function il(s){var r,l;const t=(r=s.inputSchema)==null?void 0:r.properties;if(!t)return[];const n=new Set(((l=s.inputSchema)==null?void 0:l.required)??[]);return Object.entries(t).map(([d,p])=>({name:d,type:(p==null?void 0:p.type)??"unknown",required:n.has(d)})).sort((d,p)=>Number(p.required)-Number(d.required))}function Zn(s){return s<1e3?`${s}ms`:`${Math.round(s/100)/10}s`}function Vx(s,t){const n=[],r=il(s).length;r>0&&n.push(r===1?"1 input":`${r} inputs`);const l=t.filter(d=>d.from===s.id&&d.kind==="branching").length;return l>1&&n.push(`${l} branches`),s.timeoutMs&&s.timeoutMs>0&&n.push(`${Zn(s.timeoutMs)} limit`),n}function Yx(s){const t=s.nodes.filter(r=>r.kind==="terminal-success"||r.kind==="terminal-warn").length;return{steps:s.nodes.filter(r=>r.kind!=="terminal-success"&&r.kind!=="terminal-warn"&&r.kind!=="launched-workflow").length,exits:t}}function Kx(s){const{steps:t,exits:n}=Yx(s),r=[`${t} ${t===1?"step":"steps"}`];return n>0&&r.push(`${n} ${n===1?"exit":"exits"}`),r.join(" · ")}function o1(s){switch(s){case"entry":return"Entry step";case"pause":return"Pause";case"terminal-success":return"Terminal · success";case"terminal-warn":return"Terminal · needs attention";case"launched-workflow":return"Launched agent";default:return"Step"}}function Xx(s){if(!s||typeof s!="object")return null;const t=s;if(!t.properties||typeof t.properties!="object")return null;const n={};for(const[r,l]of Object.entries(t.properties)){const d=l&&typeof l=="object"?l.type:void 0;n[r]=typeof d=="string"?{type:d}:{}}return Object.keys(n).length===0?null:{properties:n,required:Array.isArray(t.required)?t.required.filter(r=>typeof r=="string"):[]}}function Jx(s){if(!s||typeof s!="object")return null;const t=s;if(!Array.isArray(t.nodes)||!Array.isArray(t.edges))return null;const n=r=>typeof r=="string"?r:"";return{name:n(t.name),entry:n(t.entry),nodes:t.nodes.map(r=>({id:n(r.id),kind:n(r.kind),label:n(r.label),role:n(r.role),description:n(r.description),timeoutMs:typeof r.timeoutMs=="number"&&r.timeoutMs>0?r.timeoutMs:null,inputSchema:Xx(r.inputSchema),capabilities:Array.isArray(r.capabilities)?r.capabilities.filter(l=>typeof l=="string"):[]})),edges:t.edges.map(r=>({from:n(r.from),to:n(r.to),kind:n(r.kind),label:n(r.label)})),groups:Array.isArray(t.groups)?t.groups.map(r=>({label:n(r.label),nodeIds:Array.isArray(r.nodeIds)?r.nodeIds.filter(l=>typeof l=="string"):[]})):[],warnings:Array.isArray(t.warnings)?t.warnings.filter(r=>typeof r=="string"):[]}}const l1="sapiom-harness-ui-prefs";function Gi(){if(typeof window>"u")return{};try{const s=window.localStorage.getItem(l1);return s?JSON.parse(s):{}}catch{return{}}}function xn(s){if(!(typeof window>"u"))try{window.localStorage.setItem(l1,JSON.stringify({...Gi(),...s}))}catch{}}function Bu(s,t){return!s||s.stubbed!==!0?!1:s.steps.some(n=>n.name===t)}function Zx(s){if(!s)return null;const t={};return s.unusedStubs&&s.unusedStubs.length>0&&(t.unusedStubs=s.unusedStubs),s.stubWarnings&&s.stubWarnings.length>0&&(t.stubWarnings=s.stubWarnings),t.unusedStubs||t.stubWarnings?t:null}function Da(s){if(typeof s=="string")return s;try{return JSON.stringify(s,null,2)??String(s)}catch{return String(s)}}function Hu(s,t){if(!s)return null;for(let n=s.steps.length-1;n>=0;n--)if(s.steps[n].name===t)return s.steps[n];return null}const a0=3e3,o0=2e3;function Qx(s){return s<1e3?`${s}ms`:`${(s/1e3).toFixed(1)}s`}function l0(s){let t;if(typeof s=="string")t=s;else try{t=JSON.stringify(s,null,2)??String(s)}catch{t=String(s)}return t.length>o0?`${t.slice(0,o0)}
|
|
54
|
-
… (truncated, ${t.length} chars total)`:t}function eC(s,t,n){const r=[];r.push(`Step: ${s.name}`),r.push(`Status: ${s.status}`),s.latencyMs!=null&&r.push(`Latency: ${Qx(s.latencyMs)}`),s.status==="failed"&&s.error&&r.push(`Error: ${s.error}`),(t==null?void 0:t.input)!==void 0&&r.push(`
|
|
55
|
-
Input:
|
|
56
|
-
${l0(t.input)}`),(t==null?void 0:t.output)!==void 0&&r.push(`
|
|
57
|
-
Output:
|
|
58
|
-
${l0(t.output)}`);const l=t==null?void 0:t.calls;if(l!==void 0)if(l.length>0){r.push(`
|
|
59
|
-
Capabilities called:`);for(const d of l){const p=d.stubUsed?" (stubbed)":"";r.push(` - ${d.capability}${p}`)}}else r.push(`
|
|
60
|
-
Capabilities called: none (the step made zero capability calls).`);else if(n!=null&&n.capabilities&&n.capabilities.length>0){r.push(`
|
|
61
|
-
Capabilities declared (no call trace):`);for(const d of n.capabilities)r.push(` - ${d}`)}if(t!=null&&t.unusedStubs&&t.unusedStubs.length>0){r.push(`
|
|
62
|
-
Unused stubs (supplied but matched no call):`);for(const d of t.unusedStubs)r.push(` - ${d}`)}if(t!=null&&t.stubWarnings&&t.stubWarnings.length>0){r.push(`
|
|
63
|
-
Stub warnings:`);for(const d of t.stubWarnings)r.push(` - ${d}`)}if(s.logSlice){const d=s.logSlice.trimEnd(),p=d.length>a0?d.slice(d.length-a0):d;r.push(`
|
|
64
|
-
Logs:
|
|
65
|
-
${p}`)}return r.join(`
|
|
66
|
-
`)}const tC=/\.(png|jpg|jpeg|webp|gif|svg)($|\?)/i,sC=/https?:\/\/[^\s"'<>`\])\]]+/gi,iC=/[.,;:)\]}\s]+$/;function c0(s){if(typeof s=="string")return s;try{return JSON.stringify(s)??String(s)}catch{return String(s)}}function c1(s){const t=new Set,n=[],r=l=>{const d=l.matchAll(sC);for(const[p]of d){const c=p.replace(iC,"");if(!c||t.has(c))continue;t.add(c);const h=tC.test(c)?"image":"other";n.push({url:c,kind:h})}};if(s.output!==void 0&&r(c0(s.output)),s.logSlice&&r(s.logSlice),s.calls)for(const l of s.calls)l.result!==void 0&&r(c0(l.result));return n}const Iu="https://app.sapiom.ai",u1=`${Iu}/agents`,u0=`${Iu}/settings?tab=billing`,nC=Iu;function zu(s){return`${u1}/${s}`}const rC="https://docs.sapiom.ai",aC=`${rC}/agents/quick-start`;/**
|
|
67
|
-
* @license lucide-react v1.23.0 - ISC
|
|
68
|
-
*
|
|
69
|
-
* This source code is licensed under the ISC license.
|
|
70
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
71
|
-
*/const h1=(...s)=>s.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/**
|
|
72
|
-
* @license lucide-react v1.23.0 - ISC
|
|
73
|
-
*
|
|
74
|
-
* This source code is licensed under the ISC license.
|
|
75
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
76
|
-
*/const oC=s=>s.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
|
|
77
|
-
* @license lucide-react v1.23.0 - ISC
|
|
78
|
-
*
|
|
79
|
-
* This source code is licensed under the ISC license.
|
|
80
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
81
|
-
*/const lC=s=>s.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase());/**
|
|
82
|
-
* @license lucide-react v1.23.0 - ISC
|
|
83
|
-
*
|
|
84
|
-
* This source code is licensed under the ISC license.
|
|
85
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
86
|
-
*/const h0=s=>{const t=lC(s);return t.charAt(0).toUpperCase()+t.slice(1)};/**
|
|
87
|
-
* @license lucide-react v1.23.0 - ISC
|
|
88
|
-
*
|
|
89
|
-
* This source code is licensed under the ISC license.
|
|
90
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
91
|
-
*/var tf={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
92
|
-
* @license lucide-react v1.23.0 - ISC
|
|
93
|
-
*
|
|
94
|
-
* This source code is licensed under the ISC license.
|
|
95
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
96
|
-
*/const cC=s=>{for(const t in s)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},uC=H.createContext({}),hC=()=>H.useContext(uC),dC=H.forwardRef(({color:s,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:l="",children:d,iconNode:p,...c},h)=>{const{size:v=24,strokeWidth:S=2,absoluteStrokeWidth:f=!1,color:x="currentColor",className:E=""}=hC()??{},T=r??f?Number(n??S)*24/Number(t??v):n??S;return H.createElement("svg",{ref:h,...tf,width:t??v??tf.width,height:t??v??tf.height,stroke:s??x,strokeWidth:T,className:h1("lucide",E,l),...!d&&!cC(c)&&{"aria-hidden":"true"},...c},[...p.map(([C,y])=>H.createElement(C,y)),...Array.isArray(d)?d:[d]])});/**
|
|
97
|
-
* @license lucide-react v1.23.0 - ISC
|
|
98
|
-
*
|
|
99
|
-
* This source code is licensed under the ISC license.
|
|
100
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
101
|
-
*/const Ne=(s,t)=>{const n=H.forwardRef(({className:r,...l},d)=>H.createElement(dC,{ref:d,iconNode:t,className:h1(`lucide-${oC(h0(s))}`,`lucide-${s}`,r),...l}));return n.displayName=h0(s),n};/**
|
|
102
|
-
* @license lucide-react v1.23.0 - ISC
|
|
103
|
-
*
|
|
104
|
-
* This source code is licensed under the ISC license.
|
|
105
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
106
|
-
*/const fC=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],pC=Ne("arrow-down",fC);/**
|
|
107
|
-
* @license lucide-react v1.23.0 - ISC
|
|
108
|
-
*
|
|
109
|
-
* This source code is licensed under the ISC license.
|
|
110
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
111
|
-
*/const vC=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],mC=Ne("arrow-left",vC);/**
|
|
112
|
-
* @license lucide-react v1.23.0 - ISC
|
|
113
|
-
*
|
|
114
|
-
* This source code is licensed under the ISC license.
|
|
115
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
116
|
-
*/const gC=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],_C=Ne("arrow-right",gC);/**
|
|
117
|
-
* @license lucide-react v1.23.0 - ISC
|
|
118
|
-
*
|
|
119
|
-
* This source code is licensed under the ISC license.
|
|
120
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
121
|
-
*/const yC=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],bC=Ne("arrow-up-right",yC);/**
|
|
122
|
-
* @license lucide-react v1.23.0 - ISC
|
|
123
|
-
*
|
|
124
|
-
* This source code is licensed under the ISC license.
|
|
125
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
126
|
-
*/const SC=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],wC=Ne("arrow-up",SC);/**
|
|
127
|
-
* @license lucide-react v1.23.0 - ISC
|
|
128
|
-
*
|
|
129
|
-
* This source code is licensed under the ISC license.
|
|
130
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
131
|
-
*/const xC=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],CC=Ne("book-open",xC);/**
|
|
132
|
-
* @license lucide-react v1.23.0 - ISC
|
|
133
|
-
*
|
|
134
|
-
* This source code is licensed under the ISC license.
|
|
135
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
136
|
-
*/const EC=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],kC=Ne("brain",EC);/**
|
|
137
|
-
* @license lucide-react v1.23.0 - ISC
|
|
138
|
-
*
|
|
139
|
-
* This source code is licensed under the ISC license.
|
|
140
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
141
|
-
*/const TC=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],AC=Ne("check",TC);/**
|
|
142
|
-
* @license lucide-react v1.23.0 - ISC
|
|
143
|
-
*
|
|
144
|
-
* This source code is licensed under the ISC license.
|
|
145
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
146
|
-
*/const RC=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],MC=Ne("chevron-down",RC);/**
|
|
147
|
-
* @license lucide-react v1.23.0 - ISC
|
|
148
|
-
*
|
|
149
|
-
* This source code is licensed under the ISC license.
|
|
150
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
151
|
-
*/const jC=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],DC=Ne("chevron-right",jC);/**
|
|
152
|
-
* @license lucide-react v1.23.0 - ISC
|
|
153
|
-
*
|
|
154
|
-
* This source code is licensed under the ISC license.
|
|
155
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
156
|
-
*/const NC=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],LC=Ne("circle-check",NC);/**
|
|
157
|
-
* @license lucide-react v1.23.0 - ISC
|
|
158
|
-
*
|
|
159
|
-
* This source code is licensed under the ISC license.
|
|
160
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
161
|
-
*/const OC=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],BC=Ne("circle-question-mark",OC);/**
|
|
162
|
-
* @license lucide-react v1.23.0 - ISC
|
|
163
|
-
*
|
|
164
|
-
* This source code is licensed under the ISC license.
|
|
165
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
166
|
-
*/const HC=[["path",{d:"M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057",key:"1uxyv8"}],["path",{d:"M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78",key:"99tcn7"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],IC=Ne("cloud-off",HC);/**
|
|
167
|
-
* @license lucide-react v1.23.0 - ISC
|
|
168
|
-
*
|
|
169
|
-
* This source code is licensed under the ISC license.
|
|
170
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
171
|
-
*/const zC=[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]],$C=Ne("cloud-upload",zC);/**
|
|
172
|
-
* @license lucide-react v1.23.0 - ISC
|
|
173
|
-
*
|
|
174
|
-
* This source code is licensed under the ISC license.
|
|
175
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
176
|
-
*/const PC=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],UC=Ne("cloud",PC);/**
|
|
177
|
-
* @license lucide-react v1.23.0 - ISC
|
|
178
|
-
*
|
|
179
|
-
* This source code is licensed under the ISC license.
|
|
180
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
181
|
-
*/const FC=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],qC=Ne("code",FC);/**
|
|
182
|
-
* @license lucide-react v1.23.0 - ISC
|
|
183
|
-
*
|
|
184
|
-
* This source code is licensed under the ISC license.
|
|
185
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
186
|
-
*/const WC=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],GC=Ne("copy",WC);/**
|
|
187
|
-
* @license lucide-react v1.23.0 - ISC
|
|
188
|
-
*
|
|
189
|
-
* This source code is licensed under the ISC license.
|
|
190
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
191
|
-
*/const VC=[["path",{d:"m15 10 5 5-5 5",key:"qqa56n"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]],YC=Ne("corner-down-right",VC);/**
|
|
192
|
-
* @license lucide-react v1.23.0 - ISC
|
|
193
|
-
*
|
|
194
|
-
* This source code is licensed under the ISC license.
|
|
195
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
196
|
-
*/const KC=[["path",{d:"M14 9 9 4 4 9",key:"1af5af"}],["path",{d:"M20 20h-7a4 4 0 0 1-4-4V4",key:"1blwi3"}]],XC=Ne("corner-left-up",KC);/**
|
|
197
|
-
* @license lucide-react v1.23.0 - ISC
|
|
198
|
-
*
|
|
199
|
-
* This source code is licensed under the ISC license.
|
|
200
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
201
|
-
*/const JC=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],ZC=Ne("ellipsis-vertical",JC);/**
|
|
202
|
-
* @license lucide-react v1.23.0 - ISC
|
|
203
|
-
*
|
|
204
|
-
* This source code is licensed under the ISC license.
|
|
205
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
206
|
-
*/const QC=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],e2=Ne("ellipsis",QC);/**
|
|
207
|
-
* @license lucide-react v1.23.0 - ISC
|
|
208
|
-
*
|
|
209
|
-
* This source code is licensed under the ISC license.
|
|
210
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
211
|
-
*/const t2=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],s2=Ne("external-link",t2);/**
|
|
212
|
-
* @license lucide-react v1.23.0 - ISC
|
|
213
|
-
*
|
|
214
|
-
* This source code is licensed under the ISC license.
|
|
215
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
216
|
-
*/const i2=[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]],n2=Ne("flask-conical",i2);/**
|
|
217
|
-
* @license lucide-react v1.23.0 - ISC
|
|
218
|
-
*
|
|
219
|
-
* This source code is licensed under the ISC license.
|
|
220
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
221
|
-
*/const r2=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],a2=Ne("folder-open",r2);/**
|
|
222
|
-
* @license lucide-react v1.23.0 - ISC
|
|
223
|
-
*
|
|
224
|
-
* This source code is licensed under the ISC license.
|
|
225
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
226
|
-
*/const o2=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],l2=Ne("folder-plus",o2);/**
|
|
227
|
-
* @license lucide-react v1.23.0 - ISC
|
|
228
|
-
*
|
|
229
|
-
* This source code is licensed under the ISC license.
|
|
230
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
231
|
-
*/const c2=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],u2=Ne("folder",c2);/**
|
|
232
|
-
* @license lucide-react v1.23.0 - ISC
|
|
233
|
-
*
|
|
234
|
-
* This source code is licensed under the ISC license.
|
|
235
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
236
|
-
*/const h2=[["line",{x1:"22",x2:"2",y1:"6",y2:"6",key:"15w7dq"}],["line",{x1:"22",x2:"2",y1:"18",y2:"18",key:"1ip48p"}],["line",{x1:"6",x2:"6",y1:"2",y2:"22",key:"a2lnyx"}],["line",{x1:"18",x2:"18",y1:"2",y2:"22",key:"8vb6jd"}]],d2=Ne("frame",h2);/**
|
|
237
|
-
* @license lucide-react v1.23.0 - ISC
|
|
238
|
-
*
|
|
239
|
-
* This source code is licensed under the ISC license.
|
|
240
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
241
|
-
*/const f2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],p2=Ne("globe",f2);/**
|
|
242
|
-
* @license lucide-react v1.23.0 - ISC
|
|
243
|
-
*
|
|
244
|
-
* This source code is licensed under the ISC license.
|
|
245
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
246
|
-
*/const v2=[["path",{d:"m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9",key:"1hayfq"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"15ts47"}]],m2=Ne("hammer",v2);/**
|
|
247
|
-
* @license lucide-react v1.23.0 - ISC
|
|
248
|
-
*
|
|
249
|
-
* This source code is licensed under the ISC license.
|
|
250
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
251
|
-
*/const g2=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],_2=Ne("history",g2);/**
|
|
252
|
-
* @license lucide-react v1.23.0 - ISC
|
|
253
|
-
*
|
|
254
|
-
* This source code is licensed under the ISC license.
|
|
255
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
256
|
-
*/const y2=[["path",{d:"M10.3 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10l-3.1-3.1a2 2 0 0 0-2.814.014L6 21",key:"9csbqa"}],["path",{d:"m14 19.5 3-3 3 3",key:"9vmjn0"}],["path",{d:"M17 22v-5.5",key:"1aa6fl"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]],b2=Ne("image-up",y2);/**
|
|
257
|
-
* @license lucide-react v1.23.0 - ISC
|
|
258
|
-
*
|
|
259
|
-
* This source code is licensed under the ISC license.
|
|
260
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
261
|
-
*/const S2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],w2=Ne("info",S2);/**
|
|
262
|
-
* @license lucide-react v1.23.0 - ISC
|
|
263
|
-
*
|
|
264
|
-
* This source code is licensed under the ISC license.
|
|
265
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
266
|
-
*/const x2=[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]],C2=Ne("layout-template",x2);/**
|
|
267
|
-
* @license lucide-react v1.23.0 - ISC
|
|
268
|
-
*
|
|
269
|
-
* This source code is licensed under the ISC license.
|
|
270
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
271
|
-
*/const E2=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]],k2=Ne("list-checks",E2);/**
|
|
272
|
-
* @license lucide-react v1.23.0 - ISC
|
|
273
|
-
*
|
|
274
|
-
* This source code is licensed under the ISC license.
|
|
275
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
276
|
-
*/const T2=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],A2=Ne("list",T2);/**
|
|
277
|
-
* @license lucide-react v1.23.0 - ISC
|
|
278
|
-
*
|
|
279
|
-
* This source code is licensed under the ISC license.
|
|
280
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
281
|
-
*/const R2=[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]],M2=Ne("loader",R2);/**
|
|
282
|
-
* @license lucide-react v1.23.0 - ISC
|
|
283
|
-
*
|
|
284
|
-
* This source code is licensed under the ISC license.
|
|
285
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
286
|
-
*/const j2=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],D2=Ne("log-out",j2);/**
|
|
287
|
-
* @license lucide-react v1.23.0 - ISC
|
|
288
|
-
*
|
|
289
|
-
* This source code is licensed under the ISC license.
|
|
290
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
291
|
-
*/const N2=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],L2=Ne("maximize-2",N2);/**
|
|
292
|
-
* @license lucide-react v1.23.0 - ISC
|
|
293
|
-
*
|
|
294
|
-
* This source code is licensed under the ISC license.
|
|
295
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
296
|
-
*/const O2=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],B2=Ne("menu",O2);/**
|
|
297
|
-
* @license lucide-react v1.23.0 - ISC
|
|
298
|
-
*
|
|
299
|
-
* This source code is licensed under the ISC license.
|
|
300
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
301
|
-
*/const H2=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],I2=Ne("message-square",H2);/**
|
|
302
|
-
* @license lucide-react v1.23.0 - ISC
|
|
303
|
-
*
|
|
304
|
-
* This source code is licensed under the ISC license.
|
|
305
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
306
|
-
*/const z2=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],$2=Ne("minimize-2",z2);/**
|
|
307
|
-
* @license lucide-react v1.23.0 - ISC
|
|
308
|
-
*
|
|
309
|
-
* This source code is licensed under the ISC license.
|
|
310
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
311
|
-
*/const P2=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],U2=Ne("moon",P2);/**
|
|
312
|
-
* @license lucide-react v1.23.0 - ISC
|
|
313
|
-
*
|
|
314
|
-
* This source code is licensed under the ISC license.
|
|
315
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
316
|
-
*/const F2=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],q2=Ne("panel-left-close",F2);/**
|
|
317
|
-
* @license lucide-react v1.23.0 - ISC
|
|
318
|
-
*
|
|
319
|
-
* This source code is licensed under the ISC license.
|
|
320
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
321
|
-
*/const W2=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]],G2=Ne("panel-left-open",W2);/**
|
|
322
|
-
* @license lucide-react v1.23.0 - ISC
|
|
323
|
-
*
|
|
324
|
-
* This source code is licensed under the ISC license.
|
|
325
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
326
|
-
*/const V2=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]],Y2=Ne("panel-right-close",V2);/**
|
|
327
|
-
* @license lucide-react v1.23.0 - ISC
|
|
328
|
-
*
|
|
329
|
-
* This source code is licensed under the ISC license.
|
|
330
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
331
|
-
*/const K2=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]],X2=Ne("panel-right-open",K2);/**
|
|
332
|
-
* @license lucide-react v1.23.0 - ISC
|
|
333
|
-
*
|
|
334
|
-
* This source code is licensed under the ISC license.
|
|
335
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
336
|
-
*/const J2=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],Z2=Ne("paperclip",J2);/**
|
|
337
|
-
* @license lucide-react v1.23.0 - ISC
|
|
338
|
-
*
|
|
339
|
-
* This source code is licensed under the ISC license.
|
|
340
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
341
|
-
*/const Q2=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],eE=Ne("pencil",Q2);/**
|
|
342
|
-
* @license lucide-react v1.23.0 - ISC
|
|
343
|
-
*
|
|
344
|
-
* This source code is licensed under the ISC license.
|
|
345
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
346
|
-
*/const tE=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],sE=Ne("play",tE);/**
|
|
347
|
-
* @license lucide-react v1.23.0 - ISC
|
|
348
|
-
*
|
|
349
|
-
* This source code is licensed under the ISC license.
|
|
350
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
351
|
-
*/const iE=[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z",key:"1xoxul"}],["path",{d:"M9 8V2",key:"14iosj"}]],nE=Ne("plug",iE);/**
|
|
352
|
-
* @license lucide-react v1.23.0 - ISC
|
|
353
|
-
*
|
|
354
|
-
* This source code is licensed under the ISC license.
|
|
355
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
356
|
-
*/const rE=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],aE=Ne("plus",rE);/**
|
|
357
|
-
* @license lucide-react v1.23.0 - ISC
|
|
358
|
-
*
|
|
359
|
-
* This source code is licensed under the ISC license.
|
|
360
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
361
|
-
*/const oE=[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],lE=Ne("radio",oE);/**
|
|
362
|
-
* @license lucide-react v1.23.0 - ISC
|
|
363
|
-
*
|
|
364
|
-
* This source code is licensed under the ISC license.
|
|
365
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
366
|
-
*/const cE=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],uE=Ne("refresh-cw",cE);/**
|
|
367
|
-
* @license lucide-react v1.23.0 - ISC
|
|
368
|
-
*
|
|
369
|
-
* This source code is licensed under the ISC license.
|
|
370
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
371
|
-
*/const hE=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],dE=Ne("search",hE);/**
|
|
372
|
-
* @license lucide-react v1.23.0 - ISC
|
|
373
|
-
*
|
|
374
|
-
* This source code is licensed under the ISC license.
|
|
375
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
376
|
-
*/const fE=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],pE=Ne("settings",fE);/**
|
|
377
|
-
* @license lucide-react v1.23.0 - ISC
|
|
378
|
-
*
|
|
379
|
-
* This source code is licensed under the ISC license.
|
|
380
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
381
|
-
*/const vE=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],mE=Ne("sparkles",vE);/**
|
|
382
|
-
* @license lucide-react v1.23.0 - ISC
|
|
383
|
-
*
|
|
384
|
-
* This source code is licensed under the ISC license.
|
|
385
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
386
|
-
*/const gE=[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]],_E=Ne("square-terminal",gE);/**
|
|
387
|
-
* @license lucide-react v1.23.0 - ISC
|
|
388
|
-
*
|
|
389
|
-
* This source code is licensed under the ISC license.
|
|
390
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
391
|
-
*/const yE=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],bE=Ne("square",yE);/**
|
|
392
|
-
* @license lucide-react v1.23.0 - ISC
|
|
393
|
-
*
|
|
394
|
-
* This source code is licensed under the ISC license.
|
|
395
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
396
|
-
*/const SE=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],wE=Ne("sun",SE);/**
|
|
397
|
-
* @license lucide-react v1.23.0 - ISC
|
|
398
|
-
*
|
|
399
|
-
* This source code is licensed under the ISC license.
|
|
400
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
401
|
-
*/const xE=[["path",{d:"M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z",key:"16rjxf"}],["path",{d:"M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193",key:"178nd4"}],["circle",{cx:"10.5",cy:"6.5",r:".5",fill:"currentColor",key:"12ikhr"}]],CE=Ne("tags",xE);/**
|
|
402
|
-
* @license lucide-react v1.23.0 - ISC
|
|
403
|
-
*
|
|
404
|
-
* This source code is licensed under the ISC license.
|
|
405
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
406
|
-
*/const EE=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],kE=Ne("trash-2",EE);/**
|
|
407
|
-
* @license lucide-react v1.23.0 - ISC
|
|
408
|
-
*
|
|
409
|
-
* This source code is licensed under the ISC license.
|
|
410
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
411
|
-
*/const TE=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],AE=Ne("triangle-alert",TE);/**
|
|
412
|
-
* @license lucide-react v1.23.0 - ISC
|
|
413
|
-
*
|
|
414
|
-
* This source code is licensed under the ISC license.
|
|
415
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
416
|
-
*/const RE=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],ME=Ne("wand-sparkles",RE);/**
|
|
417
|
-
* @license lucide-react v1.23.0 - ISC
|
|
418
|
-
*
|
|
419
|
-
* This source code is licensed under the ISC license.
|
|
420
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
421
|
-
*/const jE=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],DE=Ne("workflow",jE);/**
|
|
422
|
-
* @license lucide-react v1.23.0 - ISC
|
|
423
|
-
*
|
|
424
|
-
* This source code is licensed under the ISC license.
|
|
425
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
426
|
-
*/const NE=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],LE=Ne("x",NE);/**
|
|
427
|
-
* @license lucide-react v1.23.0 - ISC
|
|
428
|
-
*
|
|
429
|
-
* This source code is licensed under the ISC license.
|
|
430
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
431
|
-
*/const OE=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],BE=Ne("zap",OE);/**
|
|
432
|
-
* @license lucide-react v1.23.0 - ISC
|
|
433
|
-
*
|
|
434
|
-
* This source code is licensed under the ISC license.
|
|
435
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
436
|
-
*/const HE=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],IE=Ne("zoom-in",HE);/**
|
|
437
|
-
* @license lucide-react v1.23.0 - ISC
|
|
438
|
-
*
|
|
439
|
-
* This source code is licensed under the ISC license.
|
|
440
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
441
|
-
*/const zE=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],$E=Ne("zoom-out",zE),PE={ArrowDown:pC,ArrowLeft:mC,ArrowRight:_C,ArrowUp:wC,ArrowUpRight:bC,BookOpen:CC,Brain:kC,Check:AC,ChevronDown:MC,ChevronRight:DC,CircleCheck:LC,Cloud:UC,CloudOff:IC,CloudUpload:$C,Code:qC,Copy:GC,CornerDownRight:YC,CornerLeftUp:XC,ExternalLink:s2,FlaskConical:n2,Folder:u2,FolderOpen:a2,FolderPlus:l2,Frame:d2,Globe:p2,Hammer:m2,History:_2,ImageUp:b2,Info:w2,LayoutTemplate:C2,List:A2,ListChecks:k2,Loader:M2,LogOut:D2,Maximize2:L2,Menu:B2,MessageSquare:I2,Minimize2:$2,MoreHorizontal:e2,MoreVertical:ZC,Moon:U2,PanelLeftClose:q2,PanelLeftOpen:G2,PanelRightClose:Y2,PanelRightOpen:X2,Paperclip:Z2,Pencil:eE,Play:sE,Plug:nE,Plus:aE,Radio:lE,RefreshCw:uE,Search:dE,Settings:pE,Sparkles:mE,Square:bE,SquareTerminal:_E,Sun:wE,Tags:CE,Trash2:kE,TriangleAlert:AE,Wand2:ME,Workflow:DE,X:LE,Zap:BE,ZoomIn:IE,ZoomOut:$E};function he({name:s,size:t=16}){const n=PE[s]??BC;return u.jsx(n,{size:t,strokeWidth:1.75,"aria-hidden":"true"})}function $u(){return u.jsx("span",{className:"canvas-run-stub-chip","data-testid":"canvas-run-stub-chip","data-tooltip":"Sapiom capability calls in this local run were served by stubs — not real Sapiom calls",children:"stubbed"})}function Xn({label:s,text:t,testid:n,copyTestid:r,className:l,defaultOpen:d=!1}){const[p,c]=H.useState(!1),h=v=>{var S;v.stopPropagation(),v.preventDefault(),(S=navigator.clipboard)==null||S.writeText(t).then(()=>{c(!0),window.setTimeout(()=>c(!1),1500)},()=>{})};return u.jsxs("details",{className:"canvas-run-logs payload-block"+(l?" "+l:""),"data-testid":n,open:d,children:[u.jsxs("summary",{children:[u.jsx("span",{className:"payload-block-caret","aria-hidden":"true",children:u.jsx(he,{name:"ChevronRight",size:12})}),u.jsx("span",{className:"payload-block-label",children:s}),u.jsxs("button",{type:"button",className:"payload-copy"+(p?" is-copied":""),"data-testid":r,onClick:h,"aria-label":`Copy ${s.toLowerCase()}`,children:[u.jsx(he,{name:p?"Check":"Copy",size:11}),p?"Copied":"Copy"]})]}),u.jsx("pre",{children:t})]})}function d1({links:s,testid:t}){return u.jsx("div",{className:"canvas-links-list","data-testid":t,children:s.map(({url:n,kind:r})=>r==="image"?u.jsx("a",{href:n,target:"_blank",rel:"noreferrer",className:"canvas-link-thumb-wrap","data-testid":"canvas-link-image",children:u.jsx("img",{src:n,alt:"",className:"canvas-link-thumb",loading:"lazy"})},n):u.jsxs("a",{href:n,target:"_blank",rel:"noreferrer",className:"canvas-link-item","data-testid":"canvas-link-other",children:[u.jsx(he,{name:"ExternalLink",size:12}),u.jsx("span",{className:"canvas-link-url",children:"Open"})]},n))})}function f1({step:s}){const t=c1(s);return t.length===0?null:u.jsxs("section",{className:"canvas-detail-section","data-testid":"canvas-detail-links",children:[u.jsx("h4",{children:"Links"}),u.jsx(d1,{links:t})]})}function p1({status:s}){return s==="completed"?u.jsx("span",{className:"canvas-run-status is-passed","aria-label":"completed",children:u.jsx(he,{name:"Check",size:11})}):s==="failed"?u.jsx("span",{className:"canvas-run-status is-failed","aria-label":"failed",children:u.jsx(he,{name:"X",size:11})}):s==="cancelled"?u.jsx("span",{className:"canvas-run-status is-pending","aria-label":"cancelled",children:u.jsx(he,{name:"Minus",size:11})}):u.jsx("span",{className:"canvas-run-status is-running","aria-label":"running"})}function UE({run:s,runTarget:t,workflow:n,preview:r}){const l=s.steps.length,d=s.steps.filter(b=>b.status==="passed").length,p=s.status==="running",c=s.steps.reduce((b,m)=>b+(m.latencyMs??0),0),h=s.steps.some(b=>b.latencyMs!==void 0),v=new Set,S=[];for(const b of s.steps)for(const m of c1(b))v.has(m.url)||(v.add(m.url),S.push(m));const f=[...s.steps].reverse().find(b=>b.output!==void 0),x=(n==null?void 0:n.definitionId)!=null?zu(n.definitionId):null,E=S[0]??null,T=E?S.slice(1):[],C=x!=null&&E!=null,y=p?`Running — ${d} of ${l} step${l===1?"":"s"}`:s.status==="completed"?"Completed":s.status==="failed"?"Failed":"Cancelled";return u.jsxs("section",{className:"canvas-run-summary","data-testid":"run-summary",children:[u.jsxs("div",{className:"canvas-run-summary-head",children:[u.jsxs("span",{className:"canvas-run-summary-status is-"+s.status,"data-testid":"run-summary-status",children:[u.jsx(p1,{status:s.status}),y]}),h&&u.jsx("span",{className:"canvas-run-summary-meta","data-testid":"run-summary-duration",children:Zn(c)}),t&&u.jsx("span",{className:"canvas-run-summary-target",children:qp(t)})]}),E?u.jsxs("a",{className:"run-summary-open","data-testid":"run-summary-open",href:E.url,target:"_blank",rel:"noreferrer",children:[u.jsx(he,{name:"ArrowUpRight",size:14}),"Open result"]}):r?u.jsxs("a",{className:"run-summary-open","data-testid":"run-summary-preview-link",href:r.url,target:"_blank",rel:"noreferrer",children:[u.jsx(he,{name:"ArrowUpRight",size:14}),"Open preview"]}):x?u.jsxs("a",{className:"run-summary-open","data-testid":"run-summary-dashboard-link",href:x,target:"_blank",rel:"noreferrer","data-tooltip":"Open this agent in the Sapiom dashboard",children:[u.jsx(he,{name:"Cloud",size:14}),"Open in Sapiom"]}):null,(C||r||T.length>0)&&u.jsxs("div",{className:"run-summary-secondary",children:[C&&u.jsxs("a",{className:"status-tag status-tag-action run-summary-secondary-link","data-testid":"run-summary-dashboard-link",href:x,target:"_blank",rel:"noreferrer","data-tooltip":"Open this agent in the Sapiom dashboard",children:[u.jsx(he,{name:"Cloud",size:12}),"Open in Sapiom"]}),E&&r&&u.jsxs("a",{className:"status-tag status-tag-action run-summary-secondary-link","data-testid":"run-summary-preview-link",href:r.url,target:"_blank",rel:"noreferrer",children:[u.jsx(he,{name:"ExternalLink",size:12}),"Open preview"]}),T.length>0&&u.jsx(d1,{links:T,testid:"run-summary-links"})]}),!p&&(f==null?void 0:f.output)!==void 0&&u.jsx(Xn,{label:"Result",text:Da(f.output),className:"canvas-run-result",testid:"run-summary-output",copyTestid:"payload-copy-result"})]})}function FE({deployState:s,workflow:t,onDismiss:n,onOpenCode:r}){const l=(t==null?void 0:t.definitionId)!=null?zu(t.definitionId):null,d=s.phase==="linking"||s.phase==="building",p=s.phase==="linking"?"Creating the agent on Sapiom…":s.phase==="building"?"Deploying — building on Sapiom…":s.phase==="ready"?"Deployed to Sapiom":"Deploy failed";return u.jsxs("section",{className:"deploy-status-banner is-"+s.phase,"data-testid":"deploy-status-banner","data-phase":s.phase,children:[u.jsxs("div",{className:"deploy-status-head",children:[d?u.jsx("span",{className:"canvas-task-spinner","aria-hidden":"true"}):u.jsx(p1,{status:s.phase==="ready"?"completed":"failed"}),u.jsx("span",{className:"deploy-status-label",children:p}),u.jsx("button",{type:"button",className:"deploy-status-dismiss","data-testid":"deploy-status-dismiss","aria-label":"Dismiss",onClick:n,children:u.jsx(he,{name:"X",size:12})})]}),s.phase==="error"&&s.message&&u.jsx("pre",{className:"canvas-run-error",children:s.message}),s.phase==="ready"&&u.jsxs("div",{className:"deploy-status-actions",children:[l&&u.jsxs("a",{className:"status-tag status-tag-action","data-testid":"deploy-open-dashboard",href:l,target:"_blank",rel:"noreferrer",children:[u.jsx(he,{name:"Cloud",size:12}),"Open in Sapiom"]}),u.jsxs("button",{type:"button",className:"status-tag status-tag-action","data-testid":"deploy-open-code",onClick:r,children:[u.jsx(he,{name:"Code",size:12}),"Trigger from your code"]})]})]})}function v1({step:s}){return!s.calls||s.calls.length===0?null:u.jsxs("section",{className:"canvas-detail-section","data-testid":"canvas-detail-capability-calls",children:[u.jsx("h4",{children:"Capability calls"}),u.jsx("div",{className:"canvas-capability-calls",children:s.calls.map((t,n)=>u.jsxs("div",{className:"canvas-capability-call",children:[u.jsxs("div",{className:"canvas-capability-call-head",children:[u.jsx("code",{className:"canvas-input-field",children:t.capability}),t.stubUsed&&u.jsx("span",{className:"canvas-run-stub-chip","data-testid":`canvas-call-stub-chip-${t.capability}`,children:"stubbed"})]}),t.result!==void 0&&u.jsxs("details",{className:"canvas-run-logs canvas-capability-call-result","data-testid":`canvas-call-result-${t.capability}`,children:[u.jsx("summary",{children:"Result"}),u.jsx("pre",{children:Da(t.result)})]})]},`${t.capability}-${n}`))})]})}function Fp({run:s}){const t=Zx(s);return t?u.jsxs("section",{className:"canvas-detail-section","data-testid":"canvas-detail-stub-notice",children:[u.jsx("h4",{children:"Stub notices"}),t.unusedStubs&&u.jsxs("div",{className:"canvas-stub-notice","data-testid":"canvas-stub-unused",children:[u.jsx("span",{className:"canvas-input-label",children:"Unused stubs"}),u.jsx("p",{className:"canvas-stub-notice-hint",children:"Supplied but matched no capability call — likely a typo or wrong path."}),u.jsx("ul",{className:"canvas-detail-warnings",children:t.unusedStubs.map(n=>u.jsxs("li",{children:[u.jsx("code",{className:"canvas-input-field",children:n.key})," in ",n.step]},`${n.step} ${n.key}`))})]}),t.stubWarnings&&u.jsxs("div",{className:"canvas-stub-notice","data-testid":"canvas-stub-warnings",children:[u.jsx("span",{className:"canvas-input-label",children:"Stub warnings"}),u.jsx("p",{className:"canvas-stub-notice-hint",children:"Matched a call but had the wrong shape."}),u.jsx("ul",{className:"canvas-detail-warnings",children:t.stubWarnings.map(n=>u.jsx("li",{children:n},n))})]})]}):null}function qp(s){return s?`${s} run`:"run"}function Pu({status:s}){return s==="passed"?u.jsx("span",{className:"canvas-run-status is-passed","data-status":"passed","aria-label":"passed",children:u.jsx(he,{name:"Check",size:11})}):s==="failed"?u.jsx("span",{className:"canvas-run-status is-failed","data-status":"failed","aria-label":"failed",children:u.jsx(he,{name:"X",size:11})}):s==="running"?u.jsx("span",{className:"canvas-run-status is-running","data-status":"running","aria-label":"running"}):u.jsx("span",{className:"canvas-run-status is-pending","data-status":"pending","aria-label":"pending"})}function Ic(s){return s.kind==="branching"?"branch":s.kind==="cross"?"pause resume":s.kind==="launch"?"launch":null}function qE({node:s}){const t=il(s);return t.length===0?null:u.jsxs("div",{className:"canvas-input-card","data-testid":`canvas-step-input-${s.id}`,children:[u.jsx("span",{className:"canvas-input-label",children:"Input"}),u.jsx("span",{className:"canvas-input-fields",children:t.map(n=>u.jsxs("code",{className:"canvas-input-field"+(n.required?" is-required":""),"aria-label":`${n.name}, ${n.type}${n.required?", required":""}`,children:[n.name,n.required&&u.jsx("span",{"aria-hidden":"true",children:"*"}),u.jsx("span",{className:"canvas-input-type",children:n.type})]},n.name))})]})}function WE({node:s}){return s.capabilities.length===0?null:u.jsxs("div",{className:"canvas-input-card","data-testid":`canvas-step-capabilities-${s.id}`,children:[u.jsx("span",{className:"canvas-input-label",children:"Capabilities"}),u.jsx("span",{className:"canvas-input-fields",children:s.capabilities.map(t=>u.jsx("code",{className:"canvas-input-field","data-tooltip":"Sapiom capability this step calls",children:t},t))})]})}function GE(s,t){return s.kind!=="launched-workflow"?null:t.find(n=>n.path===s.label)??t.find(n=>n.name===s.label)??t.find(n=>n.path.endsWith(`/${s.label}`))??null}function m1({node:s,workflows:t,onOpenWorkflow:n}){const r=GE(s,t);return r?u.jsxs("button",{className:"canvas-step-open","data-testid":`canvas-open-workflow-${s.id}`,"data-tooltip":`Switch to ${r.name}`,onClick:()=>n(r.path),children:["Open agent ",u.jsx(he,{name:"ArrowRight",size:12})]}):null}function d0({run:s,target:t}){return u.jsxs("div",{className:"canvas-steps-list","data-testid":"canvas-run-fallback",children:[u.jsxs("div",{className:"canvas-steps-label",children:["Run steps",u.jsx("span",{className:"canvas-steps-run-note","data-testid":"canvas-steps-run-note",children:qp(t)})]}),s.steps.map((n,r)=>{const l=[n.latencyMs!==void 0?Zn(n.latencyMs):null].filter(d=>d!==null);return u.jsxs("div",{className:"canvas-step-item",children:[u.jsxs("div",{className:"canvas-step-row is-static","data-testid":`canvas-run-step-${n.name}`,children:[u.jsx("span",{className:"canvas-step-index",children:String(r+1).padStart(2,"0")}),u.jsx(Pu,{status:n.status}),u.jsxs("span",{className:"canvas-step-copy",children:[u.jsx("span",{className:"canvas-step-name",children:n.name}),u.jsx("span",{className:"canvas-step-role",children:n.status})]}),Bu(s,n.name)&&u.jsx($u,{}),u.jsx("span",{className:"canvas-step-meta",children:l.join(" · ")}),u.jsx("span",{"aria-hidden":"true"})]}),(n.error||n.logSlice)&&u.jsxs("div",{className:"canvas-step-expand",children:[n.error&&u.jsx("pre",{className:"canvas-run-error",children:n.error}),n.logSlice&&u.jsx(Xn,{label:"Logs",text:n.logSlice,copyTestid:`payload-copy-logs-${n.id}`})]})]},n.id)}),u.jsx(Fp,{run:s}),u.jsx("p",{className:"canvas-empty-hint",children:"Agent run data only. Open the Canvas tab for the diagram — transitions and contracts come from the agent."})]})}function VE({graph:s,run:t,runTarget:n,workflows:r,onOpenWorkflow:l,onAskAgent:d,expandedId:p,onToggle:c}){const h=new Set(s.nodes.map(x=>x.id)),v=s.groups.filter(x=>x.nodeIds.length>0&&x.nodeIds.every(E=>h.has(E))),S=x=>{var E;return((E=v.find(T=>T.nodeIds.includes(x)))==null?void 0:E.label)??null},f=[];return s.nodes.forEach((x,E)=>{const T=S(x.id),C=f[f.length-1];C&&C.group===T?C.nodes.push({node:x,index:E}):f.push({group:T,nodes:[{node:x,index:E}]})}),u.jsxs("div",{className:"canvas-steps-list","data-testid":"canvas-steps-list",children:[u.jsxs("div",{className:"canvas-steps-label",children:["Steps",t&&u.jsx("span",{className:"canvas-steps-run-note","data-testid":"canvas-steps-run-note",children:qp(n)})]}),f.map((x,E)=>u.jsxs("div",{className:x.group?"canvas-step-band":void 0,children:[x.group&&u.jsx("div",{className:"canvas-step-group",children:x.group}),x.nodes.map(({node:T,index:C})=>{const y=p===T.id,b=Vx(T,s.edges),m=Hu(t,T.id),g=m?[m.latencyMs!==void 0?Zn(m.latencyMs):null].filter(k=>k!==null):[];return u.jsxs("div",{className:"canvas-step-item"+(y?" is-open":""),children:[u.jsxs("button",{className:"canvas-step-row","data-testid":`canvas-step-row-${T.id}`,"aria-expanded":y,onClick:()=>c(T.id),children:[u.jsx("span",{className:"canvas-step-index",children:String(C+1).padStart(2,"0")}),m?u.jsx(Pu,{status:m.status}):u.jsx("span",{className:"canvas-step-dot dot--"+T.kind,"aria-hidden":"true"}),u.jsxs("span",{className:"canvas-step-copy",children:[u.jsx("span",{className:"canvas-step-name",children:T.label}),u.jsx("span",{className:"canvas-step-role",children:T.role})]}),m&&Bu(t,T.id)&&u.jsx($u,{}),u.jsx("span",{className:"canvas-step-meta",children:(g.length>0?g:b).join(" · ")}),u.jsx("span",{className:"canvas-step-caret"+(y?" is-open":""),"aria-hidden":"true",children:u.jsx(he,{name:"ChevronDown",size:13})})]}),y&&u.jsx("div",{className:"canvas-step-expand","data-testid":`canvas-step-expand-${T.id}`,children:u.jsx(YE,{graph:s,node:T,run:t,workflows:r,onOpenWorkflow:l,onAskAgent:d})})]},T.id)})]},`${x.group??"ungrouped"}-${E}`))]})}function YE({graph:s,node:t,run:n,workflows:r,onOpenWorkflow:l,onAskAgent:d}){const p=Hu(n,t.id),c=s.edges.filter(f=>f.from===t.id),h=s.edges.filter(f=>f.to===t.id),v=f=>{var x;return((x=s.nodes.find(E=>E.id===f))==null?void 0:x.label)??f},S=s.groups.filter(f=>f.nodeIds.includes(t.id));return u.jsx("div",{className:"canvas-detail","data-testid":"canvas-step-detail",children:u.jsxs("div",{className:"canvas-detail-body",children:[t.role&&u.jsx("p",{className:"canvas-detail-role",children:t.role}),t.description&&u.jsx("p",{className:"canvas-detail-desc",children:t.description}),S.length>0&&u.jsxs("p",{className:"canvas-detail-groups",children:["Part of ",S.map(f=>f.label).join(", ")]}),d&&u.jsxs("div",{className:"canvas-detail-actions",children:[u.jsxs("button",{type:"button",className:"btn-ghost canvas-detail-ask","data-testid":"canvas-detail-ask","data-tooltip":"Ask the coding agent in the terminal",onClick:()=>d(`Walk me through the "${t.label}" step of this agent: what it does, its inputs and outputs, and its transitions.`),children:[u.jsx(he,{name:"MessageSquare",size:13}),"Ask coding agent"]}),u.jsxs("button",{type:"button",className:"btn-ghost","data-testid":"canvas-detail-modify","data-tooltip":"Ask the coding agent to change this step",onClick:()=>d(`Modify the "${t.label}" step of this agent. Show me the step's code first, then propose the change.`),children:[u.jsx(he,{name:"Wand2",size:13}),"Ask to modify"]}),u.jsxs("button",{type:"button",className:"btn-ghost","data-testid":"canvas-detail-copy-name","data-tooltip":"Copy the step name",onClick:()=>{var f;return void((f=navigator.clipboard)==null?void 0:f.writeText(t.label).catch(()=>{}))},children:[u.jsx(he,{name:"Copy",size:13}),"Copy name"]})]}),u.jsx(m1,{node:t,workflows:r,onOpenWorkflow:l}),p&&u.jsxs("section",{className:"canvas-detail-section","data-testid":"canvas-detail-run",children:[u.jsx("h4",{children:"Agent run"}),u.jsxs("div",{className:"canvas-detail-contract",children:[u.jsx("span",{className:"canvas-input-label",children:"Status"}),u.jsxs("span",{className:"canvas-run-text is-"+p.status,children:[u.jsx(Pu,{status:p.status}),p.status,Bu(n,t.id)&&u.jsx($u,{})]})]}),p.latencyMs!==void 0&&u.jsxs("div",{className:"canvas-detail-contract",children:[u.jsx("span",{className:"canvas-input-label",children:"Duration"}),u.jsx("span",{className:"canvas-detail-timeout",children:Zn(p.latencyMs)})]}),p.input!==void 0&&u.jsx(Xn,{label:"Input",text:Da(p.input),testid:`canvas-detail-run-input-${t.id}`,copyTestid:`payload-copy-input-${t.id}`}),p.output!==void 0&&u.jsx(Xn,{label:"Output",text:Da(p.output),testid:`canvas-detail-run-output-${t.id}`,copyTestid:`payload-copy-output-${t.id}`}),p.error&&u.jsx("pre",{className:"canvas-run-error",children:p.error}),p.logSlice&&u.jsx(Xn,{label:"Logs",text:p.logSlice,copyTestid:`payload-copy-logs-${t.id}`})]}),p&&u.jsx(v1,{step:p}),p&&u.jsx(f1,{step:p}),u.jsx(Fp,{run:n}),(il(t).length>0||t.timeoutMs!==null||t.capabilities.length>0)&&u.jsxs("section",{className:"canvas-detail-section",children:[u.jsx("h4",{children:"Contract"}),t.capabilities.length>0&&u.jsxs("div",{className:"canvas-detail-contract","data-testid":"canvas-detail-capabilities",children:[u.jsx("span",{className:"canvas-input-label",children:"Capabilities"}),u.jsx("span",{className:"canvas-input-fields",children:t.capabilities.map(f=>u.jsx("code",{className:"canvas-input-field","data-tooltip":"Sapiom capability this step calls",children:f},f))})]}),il(t).length>0&&u.jsxs("div",{className:"canvas-detail-contract","data-testid":"canvas-detail-input",children:[u.jsx("span",{className:"canvas-input-label",children:"Input"}),u.jsx("span",{className:"canvas-input-fields",children:il(t).map(f=>u.jsxs("code",{className:"canvas-input-field"+(f.required?" is-required":""),"aria-label":`${f.name}, ${f.type}${f.required?", required":""}`,"data-tooltip":f.required?"Required field":"Optional field",children:[f.name,f.required&&u.jsx("span",{"aria-hidden":"true",children:"*"}),u.jsx("span",{className:"canvas-input-type",children:f.type})]},f.name))})]}),t.timeoutMs!==null&&u.jsxs("div",{className:"canvas-detail-contract",children:[u.jsx("span",{className:"canvas-input-label",children:"Timeout"}),u.jsx("span",{className:"canvas-detail-timeout",children:Zn(t.timeoutMs)})]})]}),u.jsxs("section",{className:"canvas-detail-section",children:[u.jsxs("h4",{children:["Leads to ",u.jsx("span",{className:"canvas-detail-count",children:c.length})]}),c.length===0?u.jsx("p",{className:"canvas-detail-empty",children:"Terminal step: nothing follows."}):u.jsx("ul",{className:"canvas-detail-edges",children:c.map(f=>u.jsx("li",{children:u.jsxs("div",{className:"canvas-detail-edge",children:[u.jsx(he,{name:"CornerDownRight",size:13}),u.jsx("span",{className:"canvas-detail-edge-target",children:v(f.to)}),Ic(f)&&u.jsx("span",{className:"canvas-detail-edge-kind",children:Ic(f)}),f.label&&u.jsx("span",{className:"canvas-detail-edge-cond",children:f.label})]})},`${f.from}->${f.to}`))})]}),u.jsxs("section",{className:"canvas-detail-section",children:[u.jsxs("h4",{children:["Reached from ",u.jsx("span",{className:"canvas-detail-count",children:h.length})]}),h.length===0?u.jsx("p",{className:"canvas-detail-empty",children:t.kind==="entry"?"Entry point: the agent starts here.":"No step routes here."}):u.jsx("ul",{className:"canvas-detail-edges",children:h.map(f=>u.jsx("li",{children:u.jsxs("div",{className:"canvas-detail-edge",children:[u.jsx(he,{name:"CornerLeftUp",size:13}),u.jsx("span",{className:"canvas-detail-edge-target",children:v(f.from)}),Ic(f)&&u.jsx("span",{className:"canvas-detail-edge-kind",children:Ic(f)}),f.label&&u.jsx("span",{className:"canvas-detail-edge-cond",children:f.label})]})},`${f.from}->${f.to}`))})]}),s.warnings.length>0&&u.jsxs("section",{className:"canvas-detail-section",children:[u.jsxs("h4",{children:["Graph warnings ",u.jsx("span",{className:"canvas-detail-count",children:s.warnings.length})]}),u.jsx("ul",{className:"canvas-detail-warnings",children:s.warnings.map(f=>u.jsx("li",{children:f},f))})]})]})})}function KE({node:s,run:t,workflows:n,onOpenWorkflow:r}){const l=Hu(t,s.id);return u.jsxs("div",{className:"canvas-inspector","data-testid":"canvas-step-inspector",children:[s.role&&u.jsx("p",{className:"canvas-detail-role",children:s.role}),s.description&&u.jsx("p",{className:"canvas-step-desc",children:s.description}),u.jsx(qE,{node:s}),u.jsx(WE,{node:s}),s.timeoutMs!==null&&u.jsxs("div",{className:"canvas-input-card","data-testid":`canvas-inspector-timeout-${s.id}`,children:[u.jsx("span",{className:"canvas-input-label",children:"Timeout"}),u.jsx("span",{className:"canvas-detail-timeout",children:Zn(s.timeoutMs)})]}),u.jsx(m1,{node:s,workflows:n,onOpenWorkflow:r}),l&&u.jsxs("div",{className:"canvas-inspector-run","data-testid":"canvas-inspector-run",children:[u.jsx("span",{className:"canvas-input-label",children:"Agent run"}),u.jsxs("span",{className:"canvas-run-text is-"+l.status,children:[u.jsx(Pu,{status:l.status}),l.status,Bu(t,s.id)&&u.jsx($u,{})]}),l.latencyMs!==void 0&&u.jsx("span",{className:"canvas-inspector-run-meta",children:Zn(l.latencyMs)})]}),(l==null?void 0:l.input)!==void 0&&u.jsx(Xn,{label:"Input",text:Da(l.input),testid:`canvas-inspector-run-input-${s.id}`,copyTestid:`payload-copy-input-${s.id}`}),(l==null?void 0:l.output)!==void 0&&u.jsx(Xn,{label:"Output",text:Da(l.output),testid:`canvas-inspector-run-output-${s.id}`,copyTestid:`payload-copy-output-${s.id}`}),(l==null?void 0:l.error)&&u.jsx("pre",{className:"canvas-run-error",children:l.error}),(l==null?void 0:l.logSlice)&&u.jsx(Xn,{label:"Logs",text:l.logSlice,testid:`canvas-inspector-run-logs-${s.id}`,copyTestid:`payload-copy-logs-${s.id}`}),l&&u.jsx(v1,{step:l}),l&&u.jsx(f1,{step:l}),u.jsx(Fp,{run:t})]})}function XE({node:s,run:t,onInjectPrompt:n,onClose:r}){const l=s?Hu(t,s.id):null,[d,p]=H.useState("");function c(v){var E;if(!s){n(v);return}const S=l?{input:l.input,output:l.output,calls:l.calls,unusedStubs:(E=t==null?void 0:t.unusedStubs)==null?void 0:E.map(T=>T.key),stubWarnings:t==null?void 0:t.stubWarnings}:void 0,f=s.capabilities.length>0?{capabilities:s.capabilities}:void 0,x=eC(l??{id:s.id,name:s.id,status:"pending"},S,f);n(`${x}
|
|
442
|
-
|
|
443
|
-
${v}`)}function h(){const v=d.trim();v&&(c(v),p(""))}return u.jsxs("div",{className:"canvas-chat-panel","data-testid":"canvas-chat-panel",children:[u.jsxs("div",{className:"canvas-chat-head",children:[u.jsx("span",{className:"canvas-chat-title","data-testid":"canvas-chat-title",children:s?`Chat · ${s.label}`:"Chat"}),u.jsx("button",{className:"theme-toggle canvas-chat-close","data-testid":"canvas-chat-close","aria-label":"Close chat","data-tooltip":"Close chat",onClick:r,children:u.jsx(he,{name:"X",size:13})})]}),u.jsxs("div",{className:"canvas-inspector-macros","data-testid":"canvas-inspector-macros",children:[s&&u.jsxs(u.Fragment,{children:[u.jsx("button",{className:"canvas-inspector-macro-btn btn-ghost","data-testid":"canvas-macro-slow",onClick:()=>c("Why is this step slow / stuck?"),children:"Why slow / stuck?"}),u.jsx("button",{className:"canvas-inspector-macro-btn "+((l==null?void 0:l.status)==="failed"?"btn-primary":"btn-ghost"),"data-testid":"canvas-macro-debug",onClick:()=>c("Debug this step"),children:"Debug this step"}),u.jsx("button",{className:"canvas-inspector-macro-btn btn-ghost","data-testid":"canvas-macro-explain",onClick:()=>c("Explain this step"),children:"Explain this step"})]}),u.jsxs("div",{className:"canvas-inspector-freeform",children:[u.jsx("textarea",{className:"canvas-inspector-freeform-input","data-testid":"canvas-freeform-input",placeholder:s?"Ask about this step…":"Ask about this agent…",rows:1,value:d,onChange:v=>p(v.target.value),onKeyDown:v=>{v.key==="Enter"&&(v.metaKey||v.ctrlKey)&&(v.preventDefault(),h())}}),u.jsx("button",{className:"btn-primary canvas-inspector-freeform-ask","data-testid":"canvas-freeform-ask",disabled:!d.trim(),onClick:h,children:"Ask"})]})]})]})}const f0=24;function JE({overview:s,selectedNode:t,graph:n,run:r,workflows:l,onOpenWorkflow:d,onOpenSteps:p,onDeselect:c,onCollapse:h,onDescribeWithAI:v,describing:S=!1}){var se;const f=H.useRef(null),x=H.useRef(null),E=H.useRef(null),T=H.useRef(null),C=H.useRef(Gi().canvasInspectorHeight??null),[y,b]=H.useState(null),[m,g]=H.useState(!1),[k,M]=H.useState(!1),R=k||S;H.useEffect(()=>{S&&M(!1)},[S]),H.useEffect(()=>{if(!k)return;const F=window.setTimeout(()=>M(!1),8e3);return()=>window.clearTimeout(F)},[k]);const j=()=>{var Q;const F=(Q=f.current)==null?void 0:Q.parentElement;return F?Math.round(F.getBoundingClientRect().height*.5):Number.MAX_SAFE_INTEGER},A=()=>{var F;return(((F=x.current)==null?void 0:F.offsetHeight)??40)+1},D=H.useCallback(()=>{const F=x.current,Q=E.current,J=T.current;if(!F||!Q||!J)return;const O=j(),B=C.current,N=window.getComputedStyle(Q),z=(parseFloat(N.paddingTop)||0)+(parseFloat(N.paddingBottom)||0),W=F.offsetHeight+J.offsetHeight+z+1,Z=B!=null?Math.min(Math.max(B,A()),O):Math.min(W,O);b(Z)},[]);H.useLayoutEffect(D),H.useEffect(()=>{var J;if(typeof ResizeObserver>"u")return;const F=new ResizeObserver(D),Q=(J=f.current)==null?void 0:J.parentElement;return Q&&F.observe(Q),T.current&&F.observe(T.current),()=>F.disconnect()},[D]);const I=F=>{C.current=Math.round(Math.min(Math.max(F,A()),j())),D()},q=()=>{xn({canvasInspectorHeight:C.current})},G=()=>{C.current=null,xn({canvasInspectorHeight:null}),D()},U=F=>{if(F.button!==0)return;const Q=F.currentTarget,J=f.current;if(!J)return;try{Q.setPointerCapture(F.pointerId)}catch{}g(!0);const O=F.clientY,B=J.getBoundingClientRect().height,N=W=>{I(B+(O-W.clientY))},z=()=>{g(!1),q(),window.removeEventListener("pointermove",N),window.removeEventListener("pointerup",z),window.removeEventListener("pointercancel",z)};window.addEventListener("pointermove",N),window.addEventListener("pointerup",z),window.addEventListener("pointercancel",z)},X=F=>{var J;const Q=((J=f.current)==null?void 0:J.getBoundingClientRect().height)??0;F.key==="ArrowUp"?(F.preventDefault(),I(Q+f0),q()):F.key==="ArrowDown"?(F.preventDefault(),I(Q-f0),q()):F.key==="Home"&&(F.preventDefault(),G())};return u.jsxs("div",{ref:f,className:"canvas-overview"+(m?" is-resizing":"")+(t?" is-inspecting":""),"data-testid":"canvas-overview",style:y!=null?{height:y}:void 0,children:[u.jsx("div",{className:"canvas-overview-resize","data-testid":"canvas-overview-resize",role:"separator","aria-orientation":"horizontal","aria-label":"Resize the overview panel",tabIndex:0,onPointerDown:U,onDoubleClick:G,onKeyDown:X}),u.jsx("div",{ref:x,className:"canvas-overview-head",children:t?u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"canvas-step-dot dot--"+t.kind,"aria-hidden":"true"}),u.jsx("span",{className:"canvas-overview-title","data-testid":"canvas-inspector-title",children:t.label}),u.jsx("span",{className:"canvas-detail-kind node--"+t.kind,children:o1(t.kind)}),u.jsxs("button",{className:"status-tag status-tag-action canvas-inspector-open-steps","data-testid":"canvas-inspector-open-steps","data-tooltip":"Full details in the Steps tab",onClick:p,children:["Open step ",u.jsx(he,{name:"ArrowRight",size:12})]}),u.jsx("button",{className:"theme-toggle canvas-overview-close","data-testid":"canvas-inspector-close","aria-label":"Back to the agent overview","data-tooltip":"Back to the agent overview (Esc)",onClick:c,children:u.jsx(he,{name:"X",size:13})})]}):u.jsxs(u.Fragment,{children:[u.jsx(he,{name:"Radio",size:13}),"Overview",u.jsx("button",{className:"theme-toggle canvas-overview-close","data-testid":"canvas-overview-toggle","aria-label":"Collapse agent overview","data-tooltip":"Collapse agent overview",onClick:h,children:u.jsx(he,{name:"X",size:13})})]})}),u.jsx("div",{ref:E,className:"canvas-overview-body",children:u.jsx("div",{ref:T,className:"canvas-overview-content",children:t&&n?u.jsx(KE,{graph:n,node:t,run:r,workflows:l,onOpenWorkflow:d}):s&&u.jsxs(u.Fragment,{children:[(s.stats||s.badges&&s.badges.length>0)&&u.jsxs("div",{className:"canvas-overview-meta","data-testid":"canvas-overview-meta",children:[s.stats&&u.jsx("span",{className:"canvas-overview-stats",children:s.stats}),(se=s.badges)==null?void 0:se.map(F=>u.jsx("span",{className:"canvas-overview-badge",children:F},F))]}),s.description&&u.jsx("p",{className:"canvas-overview-desc",children:s.description}),v&&u.jsx("button",{type:"button",className:"canvas-describe-ai"+(R?" is-loading":""),"data-testid":"canvas-describe-ai",disabled:R,"aria-busy":R,onClick:()=>{s.description&&!window.confirm("Rewrite this agent's descriptions? The coding agent will edit the source and may replace text you wrote by hand.")||(M(!0),v())},"data-tooltip":"Runs a hidden coding-agent session that writes descriptions into the agent source — the canvas updates when it saves",children:R?u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"canvas-describe-spinner","aria-hidden":"true"}),"Describing…"]}):u.jsxs(u.Fragment,{children:[u.jsx(he,{name:"Sparkles",size:13}),s.description?"Rewrite descriptions with AI":"Describe with AI"]})}),s.notes.length>0&&u.jsx("ul",{className:"canvas-overview-notes",children:s.notes.map(F=>u.jsx("li",{children:F},F))}),s.legend&&s.legend.length>0&&u.jsx("div",{className:"canvas-overview-legend","data-testid":"canvas-overview-legend",children:s.legend.map(F=>u.jsxs("span",{className:"canvas-overview-legend-item",children:[u.jsx("span",{className:"canvas-step-dot dot--"+F.kind,"aria-hidden":"true"}),F.label]},F.kind))})]})})})]})}function Bi({eyebrow:s,icon:t,title:n,body:r,cta:l,className:d,testId:p,children:c}){return u.jsxs("div",{className:"empty-state"+(d?` ${d}`:""),"data-empty-state":!0,"data-testid":p,children:[t&&u.jsx("span",{className:"empty-state-icon","aria-hidden":"true",children:u.jsx(he,{name:t,size:18})}),s&&u.jsx("span",{className:"empty-state-eyebrow",children:s}),u.jsx("span",{className:"empty-state-title",children:n}),r&&u.jsx("span",{className:"empty-state-body",children:r}),l&&u.jsx("span",{className:"empty-state-cta",children:l}),c]})}function Wp(s){return s.replace(/^@[^/]+\//,"").replace(/^example-/,"").trim()||s}function ZE(s,t=Date.now()){const n=Math.max(0,Math.round((t-s)/1e3));if(n<45)return"just now";const r=Math.round(n/60);if(r<60)return`${r}m ago`;const l=Math.round(r/60);return l<24?`${l}h ago`:`${Math.round(l/24)}d ago`}var QE=s1();function xl(s,{onDismiss:t,containerRef:n,triggerRef:r}){H.useEffect(()=>{if(!s)return;const l=p=>{var h;const c=n.current;!c||!(p.target instanceof Node)||c.contains(p.target)||(h=r==null?void 0:r.current)!=null&&h.contains(p.target)||t()},d=p=>{var c;p.key==="Escape"&&(t(),(c=r==null?void 0:r.current)==null||c.focus())};return document.addEventListener("mousedown",l),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",l),document.removeEventListener("keydown",d)}},[s,t,n,r])}const zo=4,Oi=8;function ek(s,t,n,r,l){const d=s.getBoundingClientRect(),p={position:"fixed",top:"auto",right:"auto",bottom:"auto",left:"auto"};return l&&(p.overflowY="auto"),n&&(p.width=d.width),p.maxWidth=window.innerWidth-2*Oi,t.startsWith("right")?(p.left=(r??s).getBoundingClientRect().right+zo,t.endsWith("start")?(p.top=d.top,l&&(p.maxHeight=window.innerHeight-d.top-Oi)):(p.bottom=window.innerHeight-d.bottom,l&&(p.maxHeight=d.bottom-Oi)),p):(t.startsWith("down")?(p.top=d.bottom+zo,l&&(p.maxHeight=window.innerHeight-d.bottom-zo-Oi)):(p.bottom=window.innerHeight-d.top+zo,l&&(p.maxHeight=d.top-zo-Oi)),t.endsWith("start")?p.left=Math.max(Oi,d.left):p.right=Math.max(Oi,window.innerWidth-d.right),p)}function Cn({open:s,anchorRef:t,onDismiss:n,placement:r,matchWidth:l=!1,besideRef:d,noClip:p=!1,className:c,role:h,testid:v,children:S}){const f=H.useRef(null),[x,E]=H.useState(null);xl(s,{onDismiss:n,containerRef:f,triggerRef:t});const T=H.useCallback(()=>{const C=t.current;C&&E(ek(C,r,l,(d==null?void 0:d.current)??null,!p))},[t,r,l,d,p]);return H.useLayoutEffect(()=>{s?T():E(null)},[s,T]),H.useLayoutEffect(()=>{if(!s||x==null)return;const C=f.current;if(!C)return;const y=C.getBoundingClientRect();let b=0;y.left<Oi?b=Oi-y.left:y.right>window.innerWidth-Oi&&(b=window.innerWidth-Oi-y.right),!(Math.abs(b)<.5)&&E(m=>m==null?m:{...m,left:typeof m.left=="number"?m.left+b:m.left,right:typeof m.right=="number"?m.right-b:m.right})},[s,x]),H.useEffect(()=>{if(s)return window.addEventListener("resize",T),window.addEventListener("scroll",T,!0),()=>{window.removeEventListener("resize",T),window.removeEventListener("scroll",T,!0)}},[s,T]),!s||x==null?null:QE.createPortal(u.jsx("div",{ref:f,className:c,role:h,"data-testid":v,style:x,children:S}),document.body)}function tk(s,t){return`${t?`${t} run`:"run"} ${s.status}`}function sk({workflow:s,detailStep:t,onBack:n,onAskAgent:r,surface:l,stepsSummary:d,run:p,runTarget:c,runs:h,onSelectRun:v}){const[S,f]=H.useState(!1),x=H.useRef(null),E=H.useCallback(()=>f(!1),[]),[T,C]=H.useState(!1),y=H.useRef(null),b=H.useCallback(()=>C(!1),[]);if(t)return u.jsxs("div",{className:"workflow-actions-header","data-testid":"workflow-actions-header",children:[u.jsx("button",{className:"theme-toggle","data-testid":"canvas-detail-back",onClick:n,"aria-label":"Back to the steps list","data-tooltip":"Back to the steps list",children:u.jsx(he,{name:"ArrowLeft",size:14})}),u.jsx("span",{className:"workflow-actions-name","data-testid":"canvas-detail-title",children:t.label}),u.jsx("span",{className:"canvas-detail-kind node--"+t.kind,children:o1(t.kind)}),u.jsxs("button",{className:"btn-ghost canvas-detail-ask","data-testid":"canvas-detail-ask","aria-label":"Ask coding agent","data-tooltip":"Ask the coding agent in the terminal",onClick:()=>r(`Walk me through the "${t.label}" step of this agent: what it does, its inputs and outputs, and its transitions.`),children:[u.jsx(he,{name:"MessageSquare",size:13}),u.jsx("span",{className:"canvas-detail-ask-label",children:"Ask coding agent"})]}),u.jsxs("div",{className:"canvas-detail-menu-wrap",children:[u.jsx("button",{ref:x,className:"theme-toggle","data-testid":"canvas-detail-menu","aria-label":`More actions for ${t.label}`,"data-tooltip":"More actions","aria-haspopup":"menu","aria-expanded":S,onClick:()=>f(m=>!m),children:u.jsx(he,{name:"MoreHorizontal",size:14})}),u.jsxs(Cn,{open:S,anchorRef:x,onDismiss:E,placement:"down-end",className:"canvas-detail-menu",role:"menu",testid:"canvas-detail-menu-popover",children:[u.jsxs("button",{role:"menuitem",className:"profile-menu-item",onClick:()=>{r(`Modify the "${t.label}" step of this agent. Show me the step's code first, then propose the change.`),E()},children:[u.jsx(he,{name:"Wand2",size:13}),"Ask coding agent to modify"]}),u.jsxs("button",{role:"menuitem",className:"profile-menu-item",onClick:()=>{var m;(m=navigator.clipboard)==null||m.writeText(t.label).catch(()=>{}),E()},children:[u.jsx(he,{name:"Copy",size:13}),"Copy step name"]})]})]})]});if(l==="steps"){const m=p&&u.jsxs(u.Fragment,{children:[p.status==="running"&&u.jsx("span",{className:"canvas-run-status is-running","aria-hidden":"true"}),tk(p,c)]});return u.jsxs("div",{className:"workflow-actions-header"+(p?" has-run":""),"data-testid":"workflow-actions-header",children:[u.jsx("span",{className:"workflow-actions-name",title:s.name,children:Wp(s.name)}),u.jsx("span",{className:"workflow-actions-count","data-testid":"canvas-steps-count",children:d??"no steps"}),p&&h.length<=1&&u.jsx("span",{className:"status-tag canvas-run-chip is-"+p.status,"data-testid":"canvas-run-chip",children:m}),p&&h.length>1&&u.jsxs("div",{className:"canvas-run-picker-wrap",children:[u.jsxs("button",{ref:y,className:"status-tag status-tag-action canvas-run-chip canvas-run-chip--picker is-"+p.status,"data-testid":"canvas-run-chip","aria-haspopup":"menu","aria-expanded":T,"aria-label":`Pick a run to inspect (${h.length} observed)`,"data-tooltip":"Pick a run to inspect",onClick:()=>C(g=>!g),children:[m,u.jsx(he,{name:"ChevronDown",size:12})]}),u.jsx(Cn,{open:T,anchorRef:y,onDismiss:b,placement:"down-end",className:"canvas-run-menu",role:"menu",testid:"canvas-run-menu",children:[...h].reverse().map((g,k)=>{const M=h.length-k,R=g.run.executionId===p.executionId,j=ZE(g.observedAt);return u.jsxs("button",{role:"menuitemradio","aria-checked":R,className:"profile-menu-item"+(R?" is-selected":""),"data-testid":`canvas-run-option-${g.run.executionId}`,title:g.run.executionId,onClick:()=>{v(g.run.executionId),b()},children:[u.jsx(he,{name:R?"Check":"Play",size:13}),u.jsx("span",{children:`run ${M} · ${g.run.status} · ${g.target}`}),u.jsx("span",{className:"canvas-run-option-meta",children:j})]},g.run.executionId)})})]})]})}return null}const ik=4e3;function nk(s){if(typeof s!="object"||s===null)return!1;const t=s;return typeof t.kind=="string"&&typeof t.label=="string"}function rk({sessionId:s,lastMessage:t,boundWorkflow:n,noSessionAgent:r=null,overviewActive:l,sessionExited:d,expanded:p,onToggleExpanded:c,macros:h,tasks:v,onRunMacro:S,onInjectPrompt:f,onDescribeWorkflow:x,surface:E,onOpenSteps:T,run:C,runTarget:y,runs:b,onSelectRun:m,preview:g,deployState:k,onDismissDeploy:M,onOpenCode:R,workflows:j,onOpenWorkflow:A,onCanvasState:D}){const[I,q]=H.useState(!1),G=H.useRef(D);G.current=D;const[U,X]=H.useState(0),[se,F]=H.useState(Ou()),[Q,J]=H.useState(!1),[O,B]=H.useState(!0),[N,z]=H.useState(!1),W=H.useRef(null),Z=H.useRef(null),ue=H.useRef(0),ge=H.useCallback(()=>{B(!1),z(!0),W.current&&clearTimeout(W.current),W.current=setTimeout(()=>z(!1),360)},[]),Y=()=>{const de=ue.current-Date.now();Z.current&&clearTimeout(Z.current),de>0?Z.current=setTimeout(ge,de):ge()};H.useEffect(()=>()=>{W.current&&clearTimeout(W.current),Z.current&&clearTimeout(Z.current)},[]),H.useEffect(()=>{if(!O)return;const de=window.setTimeout(ge,ik);return()=>window.clearTimeout(de)},[O,ge]);const[$,oe]=H.useState(1),[ae,xe]=H.useState({x:0,y:0}),[Ee,Ue]=H.useState(!1),Ye=H.useRef(null),Ke=H.useRef(null),[st,Oe]=H.useState(.25),Dt=de=>Math.min(3,Math.max(st,Math.round(de*100)/100)),[pt,xt]=H.useState(null),gt=H.useRef(!1),[ss,ht]=H.useState({zoom:1,x:0,y:0}),vt=H.useCallback(()=>{const de=Ye.current;if(!pt||!de)return null;const Me=de.getBoundingClientRect();if(Me.width<80||Me.height<80)return null;const Re=Me.width-pt.insetX*2,at=Me.height-pt.insetTop-pt.insetBottom;if(Re<=0||at<=0)return null;const Pe=Math.min(1,Re/pt.width,at/pt.height);return{zoom:Math.max(.1,Math.round(Pe*100)/100),x:0,y:0}},[pt]),Ct=H.useCallback(()=>{let de=12;const Me=()=>{const Re=vt();if(Re){Oe(Math.min(.25,Re.zoom)),gt.current=!1,oe(Re.zoom),xe({x:Re.x,y:Re.y}),ht(Re);return}if(pt&&de-- >0){requestAnimationFrame(Me);return}Oe(.25),gt.current=!1,oe(1),xe({x:0,y:0}),ht({zoom:1,x:0,y:0})};Me()},[vt,pt]);H.useEffect(()=>{!pt||gt.current||Ct()},[pt,Ct]),H.useEffect(()=>{const de=Ye.current;if(!de||typeof ResizeObserver>"u")return;const Me=new ResizeObserver(()=>{gt.current||Ct()});return Me.observe(de),()=>Me.disconnect()},[Ct]),H.useEffect(()=>{var Re,at,Pe;(at=(Re=Ke.current)==null?void 0:Re.contentWindow)==null||at.postMessage({type:"sapiom-canvas:view",zoom:$,x:ae.x,y:ae.y},"*");const de=Ss.current,Me=Ke.current;if(de&&Me){const ls=Me.getBoundingClientRect();(Pe=Me.contentWindow)==null||Pe.postMessage({type:"sapiom-canvas:hover",x:de.x-ls.left,y:de.y-ls.top},"*")}},[$,ae]),H.useEffect(()=>{const de=Ye.current;if(!de)return;const Me=Re=>{Re.preventDefault(),gt.current=!0,oe(at=>Dt(at*(Re.deltaY<0?1.1:1/1.1)))};return de.addEventListener("wheel",Me,{passive:!1}),()=>de.removeEventListener("wheel",Me)});const $t=de=>{var at,Pe;const Me=Ke.current;if(!Me)return;const Re=Me.getBoundingClientRect();if(typeof de.clientX=="number"&&typeof de.clientY=="number"){const{clientX:ls,clientY:ks,...At}=de;(at=Me.contentWindow)==null||at.postMessage({...At,x:ls-Re.left,y:ks-Re.top},"*");return}(Pe=Me.contentWindow)==null||Pe.postMessage(de,"*")},[ds,mt]=H.useState(!1),fs=H.useRef(!1),$e=H.useRef(0),Ss=H.useRef(null),nt=de=>{if(Ss.current={x:de.clientX,y:de.clientY},Ee)return;const{clientX:Me,clientY:Re}=de;cancelAnimationFrame($e.current),$e.current=requestAnimationFrame(()=>{$t({type:"sapiom-canvas:hover",clientX:Me,clientY:Re})})},Cs=()=>{cancelAnimationFrame($e.current),Ss.current=null,mt(!1),fs.current=!1,$t({type:"sapiom-canvas:hover",x:-1,y:-1})},qt=de=>{if(de.button!==0)return;const Me=de.currentTarget;try{Me.setPointerCapture(de.pointerId)}catch{}Ue(!0),$t({type:"sapiom-canvas:press",clientX:de.clientX,clientY:de.clientY,down:!0});let Re=!0;const at=()=>{Re&&(Re=!1,$t({type:"sapiom-canvas:press",down:!1}))};let Pe=de.clientX,ls=de.clientY;const ks=de.clientX,At=de.clientY,tr=ns=>{const zi=ns.clientX-Pe,Hr=ns.clientY-ls;Pe=ns.clientX,ls=ns.clientY,(Math.abs(ns.clientX-ks)>=4||Math.abs(ns.clientY-At)>=4)&&(at(),gt.current=!0),xe(sr=>({x:sr.x+zi,y:sr.y+Hr}))},Mi=ns=>{Ue(!1),at(),Me.removeEventListener("pointermove",tr),Me.removeEventListener("pointerup",Mi),Me.removeEventListener("pointercancel",Mi),Math.abs(ns.clientX-ks)<4&&Math.abs(ns.clientY-At)<4&&($t({type:"sapiom-canvas:pick",clientX:ns.clientX,clientY:ns.clientY}),fs.current||kt(null))};Me.addEventListener("pointermove",tr),Me.addEventListener("pointerup",Mi),Me.addEventListener("pointercancel",Mi)},[Nt,kt]=H.useState(null);H.useEffect(()=>{if(!p&&Nt==null)return;const de=Me=>{Me.key==="Escape"&&(Nt!=null?kt(null):c())};return window.addEventListener("keydown",de),()=>window.removeEventListener("keydown",de)},[p,Nt,c]);const[si,ps]=H.useState(!0),[mi,$s]=H.useState(!1),[ii,Vs]=H.useState(null),[Ie,tt]=H.useState(null),[Wt,is]=H.useState(null),[ws,Bs]=H.useState(null);H.useEffect(()=>{const de=Me=>{var at;const Re=Me.data;if(!(!Re||Me.source!==((at=Ke.current)==null?void 0:at.contentWindow))){if(Re.type==="sapiom-canvas:overview")Vs({description:typeof Re.description=="string"?Re.description:"",stats:typeof Re.stats=="string"?Re.stats:"",notes:Array.isArray(Re.notes)?Re.notes.filter(Pe=>typeof Pe=="string"):[],badges:Array.isArray(Re.badges)?Re.badges.filter(Pe=>typeof Pe=="string"):[],legend:Array.isArray(Re.legend)?Re.legend.filter(nk):[]});else if(Re.type==="sapiom-canvas:graph")is(Jx(Re.graph));else if(Re.type==="sapiom-canvas:node"){const Pe=Re.id;typeof Pe=="string"&&kt(Pe)}else if(Re.type==="sapiom:node-click"){const Pe=Re.stepName;typeof Pe=="string"&&is(ls=>{if(ls){const ks=ls.nodes.find(At=>At.label===Pe)??ls.nodes.find(At=>At.id===Pe)??null;ks&&kt(ks.id)}return ls})}else if(Re.type==="sapiom-canvas:hit"){const Pe=typeof Re.id=="string";mt(Pe),fs.current=Pe}else if(Re.type==="sapiom-canvas:size"){const Pe=Re;typeof Pe.width=="number"&&Pe.width>0&&typeof Pe.height=="number"&&Pe.height>0&&xt({width:Pe.width,height:Pe.height,insetTop:typeof Pe.insetTop=="number"&&Pe.insetTop>=0?Pe.insetTop:0,insetBottom:typeof Pe.insetBottom=="number"&&Pe.insetBottom>=0?Pe.insetBottom:0,insetX:typeof Pe.insetX=="number"&&Pe.insetX>=0?Pe.insetX:0})}else if(Re.type==="sapiom-canvas:error"){const Pe=Re;tt({title:typeof Pe.title=="string"?Pe.title:"",reason:typeof Pe.reason=="string"?Pe.reason:""})}}};return window.addEventListener("message",de),()=>window.removeEventListener("message",de)},[]),H.useEffect(()=>{Vs(null),tt(null),is(null),kt(null),Bs(null),ps(!0),mt(!1),fs.current=!1,xt(null),oe(1),xe({x:0,y:0}),ht({zoom:1,x:0,y:0}),gt.current=!1},[s,U]);const we=Wt&&Nt?Wt.nodes.find(de=>de.id===Nt)??null:null;H.useEffect(()=>{var de,Me;(Me=(de=Ke.current)==null?void 0:de.contentWindow)==null||Me.postMessage({type:"sapiom-canvas:select",id:Nt},"*")},[Nt]);const Xe=H.useCallback(()=>{var de,Me;!C||!y||!s||Up()||O||(Me=(de=Ke.current)==null?void 0:de.contentWindow)==null||Me.postMessage({type:"sapiom:run-state",steps:C.steps,status:C.status,target:y},"*")},[C,y,s,O]);H.useEffect(()=>{Xe()},[Xe]);const ts=ii??void 0,[Es,ni]=H.useState(new Set);H.useEffect(()=>Pp(F),[]),H.useEffect(()=>{var Me;if(B(!0),!s){q(!1),(Me=G.current)==null||Me.call(G,!1);return}q(!1);let de=!1;return J(!0),fetch(`/canvas/${s}/`,{method:"HEAD"}).then(Re=>{var at;de||(q(Re.ok),(at=G.current)==null||at.call(G,Re.ok))}).catch(()=>{}).finally(()=>!de&&J(!1)),()=>{de=!0}},[s]),H.useEffect(()=>{var de;!t||!s||t.type==="canvas.reload"&&t.harnessSessionId===s&&(q(!0),(de=G.current)==null||de.call(G,!0),B(!0),X(Me=>Me+1))},[t,s]);const Ii=(n==null?void 0:n.path)??null;H.useEffect(()=>{B(!0),X(de=>de+1),oe(1),xe({x:0,y:0}),ht({zoom:1,x:0,y:0}),gt.current=!1},[Ii]);const te=v.filter(de=>de.harnessSessionId===s&&(de.workflowPath==null||de.workflowPath===Ii)),pe=te.some(de=>de.status==="running"&&de.macroId==="describe"),ye=te.find(de=>de.status==="running"&&de.macroId!=="describe")??null,_e=te.filter(de=>de.status!=="running"&&de.macroId!=="describe").sort((de,Me)=>(Me.endedAt??"").localeCompare(de.endedAt??""))[0],ke=!ye&&(_e==null?void 0:_e.status)==="failed"&&!Es.has(_e.id)?_e:null,Fe=ke?h.find(de=>de.id===ke.macroId)??null:null,We=h.find(de=>de.id==="visualize")??null,dt=s!=null&&!0,Tt=I&&dt,_t=u.jsxs(u.Fragment,{children:[k&&u.jsx(FE,{deployState:k,workflow:n,onDismiss:M,onOpenCode:R}),C&&u.jsx(UE,{run:C,runTarget:y,workflow:n,preview:g})]});return u.jsxs("aside",{className:"canvas-pane",children:[n&&!l&&u.jsx(sk,{workflow:n,detailStep:null,onBack:()=>{},onAskAgent:f,surface:E,stepsSummary:Wt&&Wt.nodes.length>0?Kx(Wt):null,run:C,runTarget:y,runs:b,onSelectRun:m}),r?u.jsx(Bi,{className:"canvas-empty",testId:"canvas-empty-no-session",icon:"Radio",title:`No running session for ${r}`,body:E==="steps"?"Start a session to map this agent's steps here.":"Start a session to map, run, and inspect this agent."}):l||!s?E==="steps"?u.jsx(Bi,{className:"canvas-empty",icon:"Radio",title:"No session",body:"Start a session to see the agent's steps here."}):u.jsx(Bi,{className:"canvas-empty",icon:"Radio",title:"No session",body:"Start a session to see its canvas here."}):ke?u.jsxs("div",{className:"canvas-task-failed","data-testid":"canvas-task-failed",children:[u.jsxs("p",{className:"canvas-task-title",children:[u.jsx(he,{name:"TriangleAlert",size:14})," ",ke.label," failed."]}),ke.errorTail&&u.jsx("pre",{className:"canvas-task-error",children:ke.errorTail}),u.jsxs("div",{className:"canvas-task-actions",children:[Fe&&u.jsx("button",{className:"btn-primary","data-testid":"canvas-task-retry",onClick:()=>S(Fe),children:"Retry"}),u.jsx("button",{className:"btn-ghost","data-testid":"canvas-task-dismiss",onClick:()=>ni(de=>{const Me=new Set(de);return Me.add(ke.id),Me}),children:"Dismiss"})]})]}):ye&&!Tt?u.jsxs("div",{className:"canvas-task-activity","data-testid":"canvas-task-activity",children:[u.jsx("span",{className:"canvas-task-icon","aria-hidden":"true",children:u.jsx(he,{name:"Workflow",size:20})}),u.jsx("div",{className:"canvas-task-title",children:u.jsxs("span",{children:[ye.label," is running…"]})}),ye.statusLines.length>0&&u.jsx("ul",{className:"canvas-task-lines","data-testid":"canvas-task-lines",children:ye.statusLines.slice(-8).map((de,Me)=>u.jsx("li",{children:de},`${Me}-${de}`))}),u.jsx("p",{className:"canvas-empty-hint",children:"Running as a background task, so your session stays free. The canvas reloads here when it finishes."})]}):Q?u.jsxs("div",{className:"canvas-loading","data-testid":"canvas-loading",children:[u.jsx("span",{className:"canvas-task-spinner","aria-hidden":"true"}),u.jsx("p",{className:"canvas-empty-hint",children:E==="steps"?"Loading steps…":"Loading canvas…"})]}):!Tt&&E==="steps"&&(C||k)?u.jsxs("div",{className:"canvas-steps-surface","data-testid":"canvas-steps-surface",children:[_t,C&&u.jsx(d0,{run:C,target:y})]}):!Tt&&d?u.jsx(Bi,{className:"canvas-empty",testId:"canvas-empty-exited",icon:"History",title:"Session ended",body:`Resume the session to see ${E==="steps"?"the agent's steps":"the agent's diagram"} here.`}):Tt?u.jsx("div",{className:"canvas-frame-wrap"+(p?" is-expanded":""),"data-view":E==="board"?"board":"steps",children:u.jsx("div",{className:"canvas-slide-track",children:u.jsxs("div",{className:"canvas-slide-pane",children:[u.jsxs("div",{className:"canvas-visual"+(E==="steps"?" is-offstage":""),children:[u.jsxs("div",{className:"canvas-view-controls","data-testid":"canvas-view-controls",children:[u.jsx("button",{className:"theme-toggle","data-testid":"canvas-zoom-out","aria-label":"Zoom out",title:"Zoom out",disabled:$<=st+.001,onClick:()=>{gt.current=!0,oe(de=>Math.max(st,Math.round((de-.25)*100)/100))},children:u.jsx(he,{name:"ZoomOut",size:14})}),u.jsxs("button",{className:"theme-toggle canvas-zoom-reset","data-testid":"canvas-zoom-reset","aria-label":"Reset zoom",title:"Reset zoom",disabled:$===1,onClick:()=>{gt.current=!0,oe(1)},children:[Math.round($*100),"%"]}),u.jsx("button",{className:"theme-toggle","data-testid":"canvas-zoom-in","aria-label":"Zoom in",title:"Zoom in",disabled:$>=2,onClick:()=>{gt.current=!0,oe(de=>Math.min(2,Math.round((de+.25)*100)/100))},children:u.jsx(he,{name:"ZoomIn",size:14})}),u.jsx("button",{className:"theme-toggle","data-testid":"canvas-fit","aria-label":"Fit to view",title:"Fit to view",disabled:$===ss.zoom&&ae.x===ss.x&&ae.y===ss.y,onClick:Ct,children:u.jsx(he,{name:"Frame",size:14})})]}),p&&u.jsx("button",{className:"macro-icon-btn canvas-expand-exit","data-testid":"canvas-expand-exit","aria-label":"Exit expanded canvas",title:"Exit expanded canvas (Esc)",onClick:c,children:u.jsx(he,{name:"Minimize2",size:14})}),(O||N)&&u.jsxs("div",{className:"canvas-skeleton canvas-loading--overlay"+(O?"":" is-fading"),"data-testid":"canvas-loading",role:"status","aria-label":"Rendering diagram",children:[u.jsx("div",{className:"canvas-skeleton-block canvas-skeleton-title"}),u.jsxs("div",{className:"canvas-skeleton-row",children:[u.jsx("div",{className:"canvas-skeleton-block"}),u.jsx("div",{className:"canvas-skeleton-block"})]}),u.jsxs("div",{className:"canvas-skeleton-row",children:[u.jsx("div",{className:"canvas-skeleton-block"}),u.jsx("div",{className:"canvas-skeleton-block"}),u.jsx("div",{className:"canvas-skeleton-block"})]}),u.jsx("div",{className:"canvas-skeleton-block canvas-skeleton-wide"})]}),Ie&&u.jsxs("div",{className:"canvas-render-error","data-testid":"canvas-render-error",children:[u.jsx("span",{className:"canvas-error-icon","aria-hidden":"true",children:u.jsx(he,{name:"TriangleAlert",size:20})}),u.jsx("div",{className:"canvas-task-title",children:"Render failed"}),u.jsx("p",{className:"canvas-error-summary",children:(()=>{const de=Ie.reason.trim();return de.length<4?"The agent graph could not be extracted. Open the terminal for details.":de.includes(": ")?de.slice(de.indexOf(": ")+2).split(". ")[0]:de})()}),u.jsxs("div",{className:"canvas-error-actions",children:[u.jsx("button",{className:"btn-primary","data-testid":"canvas-error-fix",onClick:()=>f(`The canvas render for ${Ie.title||"this agent"} failed: ${Ie.reason} Fix the project so the agent graph extracts cleanly.`),children:"Ask coding agent to fix"}),u.jsx("button",{className:"btn-ghost","data-testid":"canvas-error-retry",onClick:()=>{We?S(We):(ue.current=Date.now()+900,B(!0),X(de=>de+1))},children:"Retry"})]}),u.jsxs("details",{className:"canvas-error-details",children:[u.jsx("summary",{children:"Details"}),u.jsx("pre",{children:Ie.reason.trim().length>=4?Ie.reason:"The rendered document reported a failure without details. Re-render the diagram or check the terminal."})]})]}),ye&&u.jsxs("div",{className:"canvas-task-activity canvas-task-activity--overlay","data-testid":"canvas-task-activity",children:[u.jsx("span",{className:"canvas-task-icon","aria-hidden":"true",children:u.jsx(he,{name:"Workflow",size:20})}),u.jsx("div",{className:"canvas-task-title",children:u.jsxs("span",{children:[ye.label," is running…"]})}),ye.statusLines.length>0&&u.jsx("ul",{className:"canvas-task-lines","data-testid":"canvas-task-lines",children:ye.statusLines.slice(-8).map((de,Me)=>u.jsx("li",{children:de},`${Me}-${de}`))}),u.jsx("p",{className:"canvas-empty-hint",children:"Running as a background task, so your session stays free. The canvas reloads here when it finishes."})]}),ts&&!si&&!we&&u.jsx("button",{className:"theme-toggle canvas-overview-open","data-testid":"canvas-overview-toggle","aria-label":"Show agent overview","data-tooltip":"Show agent overview",onClick:()=>ps(!0),children:"i"}),E==="board"&&u.jsx("button",{className:"theme-toggle canvas-chat-toggle"+(mi?" is-active":""),"data-testid":"canvas-chat-toggle","aria-label":mi?"Close chat":"Open chat","data-tooltip":"Chat — ask about this agent or the selected step",onClick:()=>$s(de=>!de),children:u.jsx(he,{name:"MessageSquare",size:14})}),u.jsx("iframe",{ref:Ke,className:"canvas-iframe",src:`/canvas/${s}/?theme=${se}`,sandbox:"allow-scripts",scrolling:"no",onLoad:()=>{var de,Me,Re,at;Y(),(Me=(de=Ke.current)==null?void 0:de.contentWindow)==null||Me.postMessage({type:"sapiom-canvas:view",zoom:$,x:ae.x,y:ae.y},"*"),C&&y&&s&&((at=(Re=Ke.current)==null?void 0:Re.contentWindow)==null||at.postMessage({type:"sapiom:run-state",steps:C.steps,status:C.status,target:y},"*"))},onError:ge},`${s}:${U}`),u.jsx("div",{ref:Ye,className:"canvas-pan-layer"+(Ee?" is-panning":""),"data-testid":"canvas-pan-layer","data-over-node":ds&&!Ee?"true":void 0,onPointerDown:qt,onPointerMove:nt,onPointerLeave:Cs,onDoubleClick:Ct})]}),E==="steps"&&u.jsxs("div",{className:"canvas-steps-surface","data-testid":"canvas-steps-surface",children:[_t,Wt&&Wt.nodes.length>0?u.jsx(VE,{graph:Wt,run:C,runTarget:y,workflows:j,onOpenWorkflow:A,onAskAgent:f,expandedId:ws,onToggle:de=>Bs(Me=>Me===de?null:de)}):C?u.jsx(d0,{run:C,target:y}):u.jsx(Bi,{className:"canvas-empty",icon:"Workflow",title:"No steps yet",body:"This diagram has no step graph. It regenerates automatically from the bound agent — check the terminal if it never appears."})]}),E==="board"&&(ts&&si||we)&&u.jsx(JE,{overview:ts??null,selectedNode:we,graph:Wt,run:C,workflows:j,onOpenWorkflow:A,onOpenSteps:()=>{Nt&&Bs(Nt),T()},onDeselect:()=>kt(null),onCollapse:()=>ps(!1),onDescribeWithAI:n&&s&&!d?()=>x(n):void 0,describing:pe}),E==="board"&&mi&&u.jsx(XE,{node:we,run:C,onInjectPrompt:f,onClose:()=>$s(!1)})]})})}):u.jsx(Bi,{className:"canvas-empty",icon:"Workflow",title:E==="steps"?"No steps yet":"Nothing generated yet",body:E==="steps"?"Steps are read from the bound agent's diagram — generated automatically from its code.":"Generated automatically from the bound agent; it refreshes when the code changes."})]})}const ak="https://tools.sapiom.ai",ok="x-sapiom-api-key",lk="YOUR_SAPIOM_API_KEY";function ck(s){return s==null?"{ /* your input */ }":JSON.stringify(s,null,2).replace(/\n/g,`
|
|
444
|
-
`)}function uk(s){return s==null?"{}":JSON.stringify(s)}function hk(s){return s.replace(/'/g,"'\\''")}function dk(s,t){return`import { agents } from "@sapiom/tools";
|
|
445
|
-
|
|
446
|
-
const result = await agents.run({
|
|
447
|
-
definition: ${JSON.stringify(s)},
|
|
448
|
-
input: ${ck(t)},
|
|
449
|
-
});
|
|
450
|
-
|
|
451
|
-
if (result.status === "completed") {
|
|
452
|
-
console.log(result.output);
|
|
453
|
-
}
|
|
454
|
-
`}function fk(s,t,n){const r=hk(`{ "input": ${uk(t)} }`),l=encodeURIComponent(s);return`curl -X POST ${n}/agents/v1/definitions/${l}/executions \\
|
|
455
|
-
-H "${ok}: ${lk}" \\
|
|
456
|
-
-H "Content-Type: application/json" \\
|
|
457
|
-
-d '${r}'
|
|
458
|
-
`}function pk(s){const{definition:t,inputSample:n,baseUrl:r=ak}=s;return{typescript:dk(t,n),curl:fk(t,n,r)}}const vk=new Set(["pending","queued","building"]),mk=new Set(["failed","cancelled","superseded","stale"]);function Na(s,t=null){return s.activeBuildRunStatus==="ready"?"ready":s.activeBuildRunStatus!=null&&vk.has(s.activeBuildRunStatus)?"building":t!=null||s.activeBuildRunStatus!=null&&mk.has(s.activeBuildRunStatus)?"failed":s.definitionId==null?"draft":"linked"}function Wf(s){return(s==null?void 0:s.activeBuildRunStatus)==="ready"}function gk(s,t=null){switch(Na(s,t)){case"ready":return null;case"building":return"Build in progress";case"failed":return"Last deploy failed — retry Deploy";case"linked":return"No ready deployment yet";case"draft":return"Not deployed yet"}}const _k="https://app.sapiom.ai/settings?tab=api-keys";function yk({boundWorkflow:s,agentsBaseUrl:t}){return Wf(s)?u.jsx(bk,{boundWorkflow:s,agentsBaseUrl:t}):null}function bk({boundWorkflow:s,agentsBaseUrl:t}){const[n,r]=H.useState("typescript"),[l,d]=H.useState(!1),p=s.definitionSlug==null,c=s.definitionSlug??s.name,{typescript:h,curl:v}=pk({definition:c,baseUrl:t}),S=n==="typescript"?h:v,f=()=>{navigator.clipboard.writeText(S).then(()=>{d(!0),window.setTimeout(()=>d(!1),2e3)}).catch(()=>{})};return u.jsxs("div",{className:"snippet-panel","data-testid":"snippet-panel",children:[u.jsx("div",{className:"snippet-panel-header",children:u.jsx("span",{className:"snippet-panel-title",children:"Trigger from your code"})}),u.jsxs("div",{className:"snippet-slug-row",children:[u.jsx("span",{className:"snippet-slug-label",children:"Agent"}),u.jsx("code",{className:"snippet-slug","data-testid":"snippet-slug",children:c})]}),p&&u.jsx("p",{className:"snippet-slug-inferred","data-testid":"snippet-slug-inferred",children:"Inferred from the project name. Confirm it matches your deployed agent."}),u.jsxs("div",{className:"snippet-tabs",role:"tablist","aria-label":"Snippet language",children:[u.jsx("button",{role:"tab","aria-selected":n==="typescript","aria-controls":"snippet-code-panel",className:"snippet-tab"+(n==="typescript"?" is-active":""),"data-testid":"snippet-tab-ts",onClick:()=>r("typescript"),children:"TypeScript (SDK)"}),u.jsx("button",{role:"tab","aria-selected":n==="curl","aria-controls":"snippet-code-panel",className:"snippet-tab"+(n==="curl"?" is-active":""),"data-testid":"snippet-tab-curl",onClick:()=>r("curl"),children:"cURL (HTTP)"})]}),u.jsxs("div",{className:"snippet-code-wrap",role:"tabpanel",id:"snippet-code-panel",children:[u.jsx("pre",{className:"snippet-code","data-testid":"snippet-code",children:u.jsx("code",{children:S})}),u.jsx("button",{className:"snippet-copy"+(l?" is-copied":""),"data-testid":"snippet-copy","aria-label":l?"Copied":"Copy snippet",onClick:f,children:l?"Copied":"Copy"})]}),u.jsxs("p",{className:"snippet-hint","data-testid":"snippet-hint",children:[n==="typescript"?u.jsxs(u.Fragment,{children:["Install ",u.jsx("code",{children:"@sapiom/tools"}),", set ",u.jsx("code",{children:"SAPIOM_API_KEY"}),", and replace the sample input. The SDK call waits for a terminal run and returns its result."]}):u.jsxs(u.Fragment,{children:["Replace ",u.jsx("code",{children:"YOUR_SAPIOM_API_KEY"})," and the sample input. This request starts a run and returns its execution ID."]})," ","Create or manage the key in your"," ",u.jsx("a",{className:"snippet-link","data-testid":"snippet-api-key-link",href:_k,target:"_blank",rel:"noreferrer",children:"Sapiom dashboard"}),"."]})]})}function Sk({boundWorkflow:s,noSessionAgent:t=null,agentsBaseUrl:n,lastDeployError:r=null}){if(!s)return u.jsx(Bi,{className:"code-panel-empty",icon:"Code",title:t?`No running session for ${t}`:"No agent bound",body:t?"Start a session to inspect this agent's integration snippets here.":"Open an agent to see how to trigger it from your code."});const l=Na(s,r),d=l==="ready",p=l==="building"?"Building":l==="failed"?"Deploy failed":l==="linked"?"Linked":"Draft",c=l==="building"?"Cloud build in progress":l==="failed"?"Deploy did not produce a ready build":l==="linked"?"No ready deployment yet":"Deploy to trigger from code",h=l==="building"?`${s.name} is linked and building. Integration snippets appear after the cloud build is ready.`:l==="failed"?`Fix ${s.name} and retry Deploy. Studio only shows integration snippets for a ready cloud build.`:l==="linked"?`${s.name} is linked to Sapiom, but Studio cannot confirm a ready cloud build. Deploy it before integrating.`:`${s.name} is a draft. Once it deploys, TypeScript SDK and cURL starter calls appear here.`;return u.jsxs("div",{className:"code-panel",children:[u.jsxs("div",{className:"workflow-actions-header code-panel-header","data-testid":"code-panel-header",children:[u.jsx("span",{className:"workflow-actions-name",children:s.name}),d?u.jsxs("span",{className:"status-tag workflow-deployed-tag","data-testid":"code-panel-status","data-tooltip":"Ready cloud build",children:[u.jsx("span",{className:"workflow-dot workflow-dot-pinned","aria-hidden":"true"}),"Deployed"]}):u.jsxs("span",{className:"status-tag code-panel-draft-tag","data-testid":"code-panel-status","data-tooltip":c,children:[u.jsx(he,{name:"CloudOff",size:13}),p]})]}),d?u.jsx("div",{className:"code-panel-body","data-testid":"code-panel-body",children:u.jsx(yk,{boundWorkflow:s,agentsBaseUrl:n},s.path)}):u.jsx(Bi,{className:"code-panel-empty",icon:"Code",title:c,body:h})]})}const wk="https://docs.sapiom.ai/",xk=[{label:"Agents quick start",meta:"Run your first agent",href:"https://docs.sapiom.ai/agents/quick-start"},{label:"Workflows quick start",meta:"Typed steps, gates and exits",href:"https://docs.sapiom.ai/workflows/quick-start"},{label:"AI models",meta:"Which models a capability can call",href:"https://docs.sapiom.ai/capabilities/ai-models"},{label:"MCP servers: setup",meta:"Connect a server to a workspace",href:"https://docs.sapiom.ai/integration/mcp-servers/setup"},{label:"MCP servers: remote",meta:"Reach a server you do not host",href:"https://docs.sapiom.ai/integration/mcp-servers/remote"}],Gf=1,Vf=12,g1=10,_1=20,Ck=25,Ek=s=>-(3+Math.min(s,9)),kk=new Set(["/","\\","-","_",".",":"," "]),p0=s=>s>="0"&&s<="9",Tk=s=>s!==s.toUpperCase()&&s===s.toLowerCase(),Ak=s=>s!==s.toLowerCase()&&s===s.toUpperCase();function Rk(s){const t=new Array(s.length);for(let n=0;n<s.length;n++){if(n===0){t[n]=!0;continue}const r=s[n-1],l=s[n];t[n]=kk.has(r)||p0(l)!==p0(r)||Ak(l)&&Tk(r)}return t}function Mk(s,t,n,r){var x;const l=s.length,d=t.length,p=(E,T)=>{let C=Gf;n[T]&&(C+=Vf),T===E+1&&(C+=g1);const y=T-E-1;return y>=1&&(C+=Ek(y)),C},c=new Map,h=(E,T)=>{if(E===l-1)return 0;const C=E*d+T,y=c.get(C);if(y!==void 0)return y.score;const b=s[E+1];let m=Number.NEGATIVE_INFINITY,g=-1;if(T+1<d&&t[T+1]===b){const k=p(T,T+1)+h(E+1,T+1);k>m&&(m=k,g=T+1)}for(const k of r.get(b)??[]){if(k<=T+1)continue;const M=p(T,k)+h(E+1,k);M>m&&(m=M,g=k)}return c.set(C,{score:m,next:g}),m};let v=Number.NEGATIVE_INFINITY,S=-1;for(const E of r.get(s[0])??[]){const C=Gf+Vf+(E===0?_1:0)+h(0,E);C>v&&(v=C,S=E)}if(S===-1||!Number.isFinite(v))return null;const f=[S];for(let E=0,T=S;E<l-1;E++){const C=((x=c.get(E*d+T))==null?void 0:x.next)??-1;f.push(C),T=C}return{score:v,indices:f}}function jk(s,t,n){let r=null;for(let d=0;;){const p=t.indexOf(s,d);if(p===-1)break;let c=p===0?_1:0;for(let h=0;h<s.length;h++)c+=Gf,n[p+h]&&(c+=Vf),h>0&&(c+=g1);(r===null||c>r.score)&&(r={score:c,start:p}),d=p+1}if(r===null)return null;const l=r.start;return{score:r.score,indices:Array.from({length:s.length},(d,p)=>l+p)}}function sf(s){let t="";for(let n=0;n<s.length;n++){const r=s[n].toLowerCase();t+=r.length===1?r:s[n]}return t}function v0(s,t){const n=[...new Set(sf(s).split(/\s+/).filter(Boolean))];if(n.length===0)return{score:0,indices:[]};if(!t)return null;const r=sf(t),l=Rk(t),d=new Map;for(let h=0;h<t.length;h++){if(!l[h])continue;const v=r[h],S=d.get(v);S?S.push(h):d.set(v,[h])}let p=0;const c=new Set;for(const h of n){if(h.length>r.length)return null;const v=Mk(h,r,l,d),S=jk(h,r,l),f=v&&S?v.score>=S.score?v:S:v??S;if(!f)return null;p+=f.score;for(const x of f.indices)c.add(x)}return sf(s.trim())===r&&(p+=Ck),{score:p,indices:[...c].sort((h,v)=>h-v)}}function y1(s){return s.includes("\\")?"\\":"/"}function Dk(s,t){return`${s.trim().replace(/[\\/]+$/,"")}${y1(s)}${t.trim()}`}function Jn(s){return s.split(/[\\/]/).filter(Boolean).pop()??s}function b1(s){const t=s.replace(/[\\/]+$/,"");if(t===""||/^[A-Za-z]:$/.test(t))return null;const n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));if(n<0)return null;const r=t.slice(0,n);return/^[A-Za-z]:$/.test(r)?r+t[n]:r||"/"}function fl(s){const t=s.replace(/[\\/]+$/,"");return t===s?s:t===""?s[0]:/^[A-Za-z]:$/.test(t)?t+s[t.length]:t}function m0(s,t){return fl(s.replace(/\\/g,"/"))===fl(t.replace(/\\/g,"/"))}function Gp(s,t){const n=fl(s.replace(/\\/g,"/")),r=fl(t.replace(/\\/g,"/"));return r===n?!0:n.endsWith("/")?r.startsWith(n):r.startsWith(`${n}/`)}function Nk(s){return s.startsWith("/")||s.startsWith("~")||/^[A-Za-z]:[\\/]/.test(s)}function Lk(s){const t=y1(s),n=s.split(/[\\/]/).filter(Boolean);return n.length<=2?s:`${t==="\\"?"":t}${n[0]}${t}…${t}${n[n.length-1]}`}function g0(s,t){var n;return(n=t[s.id])!=null&&n.trim()?!1:!s.title||s.title===Jn(s.cwd)}function cu(s,t,n){var c;const r=(c=n[s.id])==null?void 0:c.trim();if(r)return r;if(!g0(s,n))return s.title;const l=Jn(s.cwd),p=t.filter(h=>h.cwd===s.cwd&&(h.status!=="exited"||h.id===s.id)&&g0(h,n)).sort((h,v)=>h.createdAt.localeCompare(v.createdAt)||h.id.localeCompare(v.id)).findIndex(h=>h.id===s.id);return p>0?`${l} ${p+1}`:l}const nf=Jn,Qc=(s,t)=>Gp(t,s),Yf=s=>(t,n)=>s==="name"?t.name.localeCompare(n.name):t.path.localeCompare(n.path);function Ok(s,t,n="workspace",r="recent",l=[],d=[]){return n==="deployment"?Bk(s,r):Hk(s,t,r,l,d)}function Bk(s,t){const n=Yf(t),r=(d,p,c)=>({cwd:`deployment:${p}`,label:d,isDirectory:!1,agents:s.filter(c).sort(n).map(h=>({workflow:h})),bareSessions:[]});return{workspaces:[r("Deployed","live",d=>d.definitionId!=null),r("Draft","draft",d=>d.definitionId==null)].filter(d=>d.agents.length>0),orphanAgents:[]}}function Hk(s,t,n,r,l=[]){const d=t.filter(y=>y.status!=="exited"),p=new Set(s),c=new Set(l),h=new Map(l.map((y,b)=>[y,b])),v=new Map;for(const y of t){const b=v.get(y.cwd);(!b||y.createdAt>b)&&v.set(y.cwd,y.createdAt)}const S=new Set([...v.keys(),...r,...l]),f=(y,b)=>{const m=r.indexOf(y),g=r.indexOf(b);return m>=0&&g>=0?m-g:m>=0||g>=0?m>=0?-1:1:(v.get(b)??"").localeCompare(v.get(y)??"")},x=Array.from(S).sort((y,b)=>{const m=h.get(y),g=h.get(b);return m!==void 0||g!==void 0?m!==void 0&&g!==void 0?m-g:m!==void 0?-1:1:n==="name"?nf(y).localeCompare(nf(b))||y.localeCompare(b):f(y,b)||y.localeCompare(b)}),E=y=>{let b=null;for(const m of x)Qc(y,m)&&(b===null||m.length>b.length)&&(b=m);return b},T=[];for(const y of x){const b=s.filter(k=>p.has(k)&&E(k.path)===y).sort(Yf(n)).map(k=>(p.delete(k),{workflow:k})),m=d.filter(k=>k.boundWorkflowPath==null&&E(k.cwd)===y).sort((k,M)=>M.createdAt.localeCompare(k.createdAt)||k.id.localeCompare(M.id)),g=c.has(y)&&b.length===0&&m.length===0;b.length===0&&m.length===0&&!g||T.push({cwd:y,label:nf(y),isDirectory:!0,agents:b,bareSessions:m,pending:g})}const C=Array.from(p).sort(Yf(n)).map(y=>({workflow:y}));return{workspaces:T,orphanAgents:C}}const $o=[{id:"all",label:"All",icon:"Search"},{id:"sessions",label:"Sessions",icon:"Radio"},{id:"agents",label:"Agents",icon:"Workflow"},{id:"templates",label:"Templates",icon:"LayoutTemplate"},{id:"docs",label:"Docs",icon:"BookOpen"},{id:"files",label:"Files",icon:"Folder"},{id:"actions",label:"Actions",icon:"Zap"}],Ik={templates:{label:"Browse templates",actionId:"browse-templates"},docs:{label:"Open documentation",href:wk}},zk=6,$k=6,zc=20,Pk=6,S1=36e5,rf=24*S1;function _0(s,t){if(t<=0)return 0;const n=s-t;return n<=S1?30:n<=rf?20:n<=7*rf?12:n<=30*rf?6:0}const $c=s=>{const t=Date.parse(s);return Number.isNaN(t)?0:t},Uk=(s,t)=>s.item.recency!==t.item.recency?s.item.recency>t.item.recency:s.fromRegistry!==t.fromRegistry?s.fromRegistry:s.count>t.count;function Fk(s){const{sessions:t,workflows:n,history:r,recentDirs:l,sessionNames:d,actions:p,templates:c,activeSessionId:h}=s,v=t.filter(R=>R.status!=="exited").map(R=>({id:`session:${R.id}`,kind:"session",label:cu(R,t,d),meta:R.cwd,sessionId:R.id,current:R.id===h||void 0,recency:$c(R.lastActiveAt)})),S=new Set(t.map(R=>R.id)),f=new Set(t.map(R=>R.agentSessionId).filter(R=>R!=null)),x=[...t.filter(R=>R.status==="exited").map(R=>({item:{id:`past:${R.id}`,kind:"past",label:cu(R,t,d),meta:R.cwd,sessionId:R.id,recency:$c(R.lastActiveAt)},cwd:R.cwd,count:0,fromRegistry:!0})),...r.filter(R=>!(R.harnessSessionId!=null&&S.has(R.harnessSessionId))&&!f.has(R.agentSessionId)).map(R=>{var j;return{item:{id:`summary:${R.agentSessionId}`,kind:"past",label:((j=d[R.harnessSessionId??""])==null?void 0:j.trim())||R.title,meta:R.cwd,summary:R,recency:$c(R.lastActiveAt)},cwd:R.cwd,count:R.turnCount??R.messageCount??0,fromRegistry:!1}})],E=new Map;for(const R of x){const j=`${R.item.label.trim()}\0${R.cwd}`,A=E.get(j);(!A||Uk(R,A))&&E.set(j,R)}const T=[...E.values()].map(R=>R.item).sort((R,j)=>j.recency-R.recency),C=R=>{let j=0;for(const D of t){if(D.boundWorkflowPath!==R.path&&!Qc(D.cwd,R.path))continue;const I=$c(D.lastActiveAt);I>j&&(j=I)}if(j>0)return j;const A=l.findIndex(D=>Qc(R.path,D)||Qc(D,R.path));return A===-1?0:l.length-A},y=n.map(R=>({id:`agent:${R.path}`,kind:"agent",label:Wp(R.name),meta:R.path,path:R.path,recency:C(R)})),b=new Set(n.map(R=>R.path)),m=l.filter(R=>!b.has(R)).map(R=>({id:`recent:${R}`,kind:"recent",label:Jn(R),meta:R,path:R,recency:l.length-l.indexOf(R)})),g=p.map(R=>({id:`command:${R.id}`,kind:"command",label:R.label,meta:R.meta??"",icon:R.icon,run:R.run,recency:0})),k=xk.map(R=>({id:`doc:${R.href}`,kind:"doc",label:R.label,meta:R.meta,href:R.href,recency:0})),M=c.map(R=>({id:`template:${R.id}`,kind:"template",label:R.name,meta:R.description,templateId:R.id,recency:0}));return[...v,...T,...y,...m,...M,...k,...g]}const y0={session:0,agent:1,past:2,recent:3,template:4,doc:5,command:6,path:7},qk={all:["session","agent","past","recent","template","doc","command"],sessions:["session","past"],agents:["agent"],templates:["template"],docs:["doc"],files:["recent"],actions:["command"]},Kf=(s,t)=>s.filter(n=>n.kind===t);function Sr(s,t){const n=Kf(s,t);return t==="session"?n.sort((r,l)=>(r.current?1:0)-(l.current?1:0)||l.recency-r.recency):t==="past"?n.sort((r,l)=>l.recency-r.recency):t==="agent"?n.sort((r,l)=>l.recency-r.recency||r.label.localeCompare(l.label)):t==="recent"?n.sort((r,l)=>l.recency-r.recency):n}function Wk(s,t,n={}){const r=n.filter??"all",l=n.now??Date.now(),d=qk[r],p=s.trim();if(!p){if(r!=="all")return d.flatMap(f=>Sr(t,f)).slice(0,zc);const S=Kf(t,"command");return[...Sr(t,"session"),...Sr(t,"past").slice(0,zk),...Sr(t,"agent").slice(0,Pk),...Sr(t,"recent"),...Sr(t,"template"),...Sr(t,"doc")].slice(0,Math.max(0,zc-S.length)).concat(S)}const c=S=>{const f=v0(p,S.label);if(f)return{item:{...S,labelIndices:f.indices},fieldRank:0,boosted:f.score+_0(l,S.recency),matchedLength:S.label.length};const x=S.meta?v0(p,S.meta):null;return x?{item:{...S,metaIndices:x.indices},fieldRank:1,boosted:x.score+_0(l,S.recency),matchedLength:S.meta.length}:null},h=d.map(S=>({kind:S,scored:Kf(t,S).map(c).filter(f=>f!==null).sort((f,x)=>f.fieldRank-x.fieldRank||x.boosted-f.boosted||x.item.recency-f.item.recency||f.matchedLength-x.matchedLength||f.item.label.localeCompare(x.item.label))})).filter(S=>S.scored.length>0),v=h.length>1?$k:zc;return h.sort((S,f)=>{const x=S.scored[0],E=f.scored[0];return x.fieldRank-E.fieldRank||E.boosted-x.boosted||y0[S.kind]-y0[f.kind]}).flatMap(S=>S.scored.slice(0,v).map(f=>f.item)).slice(0,zc)}function Gk(s,t){const n=s.trim();return[...n?[{id:`confirm:${n}`,kind:"path",label:n,meta:"Open this path",path:n,recency:0}]:[],...t.map(l=>({id:`dir:${l.path}`,kind:"path",label:l.name,meta:l.path,path:l.path,recency:0}))]}function Vk(s){switch(s.kind){case"command":return s.run?{type:"run",run:s.run}:{type:"none"};case"doc":return s.href?{type:"open-href",href:s.href}:{type:"none"};case"template":return s.templateId?{type:"open-template",templateId:s.templateId}:{type:"none"};case"session":return s.sessionId?{type:"select-session",sessionId:s.sessionId}:{type:"none"};case"past":return s.sessionId?{type:"select-session",sessionId:s.sessionId}:s.summary?{type:"review-summary",summary:s.summary}:{type:"none"};case"agent":case"recent":case"path":return s.path?{type:"open-path",path:s.path}:{type:"none"}}}const Yk=/^[a-z0-9][a-z0-9-]{0,213}$/,Vp="sapiom-agent",Kk=3,b0=32,Xk=new Set(["a","an","and","any","are","as","at","be","can","could","do","each","every","for","from","get","i","if","in","into","is","it","its","just","me","my","need","of","on","once","or","our","please","should","so","that","the","their","them","then","there","this","to","us","want","we","when","with","would","you","your","daily","day","hourly","hour","week","weekly","month","monthly","morning","evening","night","always","regularly"]);function w1(s){return Yk.test(s)}function Jk(s){var p;const t=s.toLowerCase().replace(/[^a-z0-9]+/g," ").split(" ").filter(Boolean),n=t.filter(c=>!Xk.has(c)),r=n.length>0?n:t,l=[];for(const c of r.slice(0,Kk)){if((l.length===0?c:`${l.join("-")}-${c}`).length>b0)break;l.push(c)}const d=l.join("-")||((p=r[0])==null?void 0:p.slice(0,b0))||"";return w1(d)?d:Vp}function x1(s,t){const n=(t==null?void 0:t.trim())??"",r=s.trim();return!n.replace(/[\\/]+$/,"")||!r?"":Dk(n,r)}function Zk(s){var t,n,r;return((t=s.settingsRoot)==null?void 0:t.trim())||((n=s.defaultProjectRoot)==null?void 0:n.trim())||((r=s.launchDir)==null?void 0:r.trim())||""}const Qk=b1;function e3(s,t){const n=new Set(t);if(!n.has(s))return s;for(let r=2;r<1e3;r+=1){const l=`${s}-${r}`;if(!n.has(l)&&w1(l))return l}return s}const uu=[{kind:"starter",id:"default",name:"Default starter",description:"A minimal two-step starter."},{kind:"starter",id:"coding-pause",name:"Coding pause",description:"The launch + pauseUntilSignal + resume pattern for a non-blocking coding-agent run."}],t3={starter:"Starter","product-engineering":"Product and engineering","reliability-governance":"Reliability and governance","revenue-marketing":"Revenue and marketing","customer-experience":"Customer experience","data-knowledge":"Data and knowledge","finance-legal-people":"Finance, legal and people"};function s3(s){return s?t3[s]??s.replace(/-/g," ").replace(/^./,t=>t.toUpperCase()):"Uncategorised"}function Yp(s){return s!=null&&s.label?s.score>0?`${s.label} ${s.score}/5`:s.label:"—"}function C1(s){const{basis:t}=s,n=[];t.llmSteps>0&&n.push(`${t.llmSteps} model ${t.llmSteps===1?"step":"steps"}`),t.chainedLlmSteps>0&&n.push(`${t.chainedLlmSteps} chained`),t.mediaCapabilities>0&&n.push(`${t.mediaCapabilities} media ${t.mediaCapabilities===1?"generator":"generators"}`),n.push(`${t.stepCount} ${t.stepCount===1?"step":"steps"}`),t.capabilityCount>0&&n.push(`${t.capabilityCount} ${t.capabilityCount===1?"capability":"capabilities"}`);const r=t.llmSteps===0&&t.mediaCapabilities===0?" · deterministic":"";return`${n.join(", ")}${r}`}function i3(s){return`${s.label}: ${C1(s)}`}function S0(s,t){const n=t.trim().toLowerCase();return n?[s.name,s.description,s.id,...s.kind==="gallery"?s.tags:[],...s.kind==="gallery"?s.capabilities:[]].join(" ").toLowerCase().includes(n):!0}function n3(s,t){const n="When the project is ready, offer a local test run with no Sapiom capability spend (sapiom_dev_agents_run_local) as the next step.";return s.kind==="gallery"?`Clone the Sapiom gallery template "${s.id}" into this directory: call the sapiom_dev_agents_clone tool with dir "${t}" and templateId "${s.id}". If it reports you are not authenticated, run sapiom_authenticate first and retry. After the clone, read the project's AGENTS.md and run npm install. `+n:`Scaffold the "${s.id}" starter in this directory: ${Xf(t,s.id)}, then run npm install and read AGENTS.md. Keep the shipped starter unchanged until the user describes what to build. `+n}function r3(s,t){return`Clone the deployed Sapiom agent (definition ${s}) into this directory: call the sapiom_dev_agents_clone tool with dir "${t}" and definitionId "${s}". If it reports you are not authenticated, run sapiom_authenticate first and retry. After the clone, read the project's AGENTS.md and run npm install. When the project is ready, offer a local test run with no Sapiom capability spend (sapiom_dev_agents_run_local) as the next step.`}function Xf(s,t){return"call the sapiom_dev_agents_scaffold tool with "+JSON.stringify({dir:s,template:t})}function a3(s){var l,d;const t=s.steps.map(p=>({id:p.name,kind:p.kind,label:p.name,role:p.kind.startsWith("terminal")?"terminal":p.kind==="entry"?"entry":"step",description:p.description??"",timeoutMs:null,inputSchema:null,capabilities:p.capabilities})),n=new Map;for(const p of s.transitions)p.kind==="continue"&&n.set(p.from,(n.get(p.from)??0)+1);const r=s.transitions.map(p=>({from:p.from,to:p.to,kind:p.kind==="pause"?"cross":(n.get(p.from)??0)>1?"branching":"sequential",label:p.label??""}));return{name:s.name,entry:((l=s.steps.find(p=>p.kind==="entry"))==null?void 0:l.name)??((d=s.steps[0])==null?void 0:d.name)??"",nodes:t,edges:r,groups:[],warnings:[]}}function o3(s,t){const n=s.kind==="starter"&&s.id==="default"?Vp:s.id;return x1(n,t)}function l3(s){const t=H.useRef(null),[n,r]=H.useState(null),l=H.useCallback(()=>{const c=t.current;if(!c)return;const h=c.querySelector('[aria-selected="true"]');if(!h){r(null);return}const v=c.getBoundingClientRect(),S=h.getBoundingClientRect();r({x:S.left-v.left+c.scrollLeft,w:S.width})},[]),d=H.useRef(null),p=H.useCallback(c=>{var h;(h=d.current)==null||h.disconnect(),t.current=c,c&&(l(),!(typeof ResizeObserver>"u")&&(d.current=new ResizeObserver(l),d.current.observe(c)))},[l]);return H.useLayoutEffect(()=>{l()},[s,l]),H.useLayoutEffect(()=>()=>{var c;return(c=d.current)==null?void 0:c.disconnect()},[]),{trackRef:p,style:n?{transform:`translateX(${n.x}px)`,width:`${n.w}px`,opacity:1}:{opacity:0}}}const c3={command:"Zap",doc:"BookOpen",session:"Radio",past:"History",agent:"Workflow",recent:"Folder",path:"Folder",template:"LayoutTemplate"},af={command:"Actions",doc:"Documentation",session:"Sessions",past:"Past sessions",agent:"Agents",recent:"Folders",path:"Folders",template:"Templates"},u3=typeof navigator<"u"&&navigator.platform.toUpperCase().includes("MAC"),h3=u3?"⌘":"Ctrl";function w0(s,t){if(!t||t.length===0)return s;const n=new Set(t),r=[];let l="",d=n.has(0);const p=c=>{l&&(r.push(d?u.jsx("b",{className:"palette-match",children:l},c):l),l="")};for(let c=0;c<s.length;c++){const h=n.has(c);h!==d&&(p(c),d=h),l+=s[c]}return p(s.length),r}function d3({sessions:s,workflows:t,recentDirs:n,history:r,sessionNames:l,activeSessionId:d,actions:p,listDir:c,listTemplates:h,onSelectSession:v,onReviewSummary:S,onOpenPath:f,onOpenTemplate:x,onClose:E}){const[T,C]=H.useState(""),[y,b]=H.useState("all"),[m,g]=H.useState([]),[k,M]=H.useState([]),[R,j]=H.useState(!1),[A,D]=H.useState(!1),[I,q]=H.useState(0),G=l3(y),U=H.useRef(null);H.useEffect(()=>{var B;(B=U.current)==null||B.focus()},[]),H.useEffect(()=>{let B=!1;return g(uu.map(({id:N,name:z,description:W})=>({id:N,name:z,description:W}))),h().then(N=>{B||g([...N.templates.map(({id:z,name:W,description:Z})=>({id:z,name:W,description:Z})),...uu.map(({id:z,name:W,description:Z})=>({id:z,name:W,description:Z}))])}).catch(()=>{}),()=>{B=!0}},[h]);const X=Nk(T);H.useEffect(()=>{if(!X){M([]),D(!1);return}let B=!1;j(!0),D(!1);const N=setTimeout(()=>{c(T).then(z=>{B||M(z.dirs)}).catch(()=>{B||(M([]),D(!0))}).finally(()=>!B&&j(!1))},150);return()=>{B=!0,clearTimeout(N)}},[T,X,c]);const se=H.useMemo(()=>X?Gk(T,k):Wk(T,Fk({sessions:s,workflows:t,history:r,recentDirs:n,sessionNames:l,actions:p,templates:m,activeSessionId:d}),{filter:y}),[T,X,k,s,t,n,r,l,d,p,m,y]);H.useEffect(()=>{const B=se.findIndex(N=>!N.current);q(B===-1?0:B)},[se,T,y]);const F=X?void 0:Ik[y],Q=B=>{const N=Vk(B);switch(N.type){case"run":N.run();break;case"open-href":window.open(N.href,"_blank","noopener,noreferrer");break;case"open-template":x(N.templateId);break;case"select-session":v(N.sessionId);break;case"review-summary":S(N.summary);break;case"open-path":f(N.path);break}E()},J=B=>{b(N=>{const W=($o.findIndex(Z=>Z.id===N)+B+$o.length)%$o.length;return $o[W].id})},O=B=>{if(B.key==="ArrowDown")B.preventDefault(),q(N=>Math.min(N+1,se.length-1));else if(B.key==="ArrowUp")B.preventDefault(),q(N=>Math.max(N-1,0));else if(B.key==="Tab"&&!X)B.preventDefault(),J(B.shiftKey?-1:1);else if(B.key==="Enter"){B.preventDefault();const N=se[I];N&&Q(N)}else B.key==="Escape"&&(T?C(""):E())};return u.jsx("div",{className:"modal-backdrop",onClick:E,children:u.jsxs("div",{className:"modal command-palette",onClick:B=>B.stopPropagation(),children:[u.jsxs("div",{className:"command-palette-search",children:[u.jsx(he,{name:"Search",size:16}),u.jsx("input",{ref:U,className:"command-palette-input","data-testid":"command-palette-input","aria-label":"Jump to a session, agent, or path",placeholder:"Jump to a session, agent, or path…",value:T,onChange:B=>C(B.target.value),onKeyDown:O}),T&&u.jsx("button",{type:"button",className:"command-palette-clear","data-testid":"command-palette-clear","aria-label":"Clear search",onClick:()=>{var B;C(""),(B=U.current)==null||B.focus()},children:u.jsx(he,{name:"X",size:14})})]}),!X&&u.jsxs("div",{ref:G.trackRef,className:"command-palette-filters tab-track",role:"tablist","aria-label":"Search filter",children:[u.jsx("span",{className:"tab-indicator",style:G.style,"aria-hidden":"true"}),$o.map(B=>u.jsxs("button",{type:"button",role:"tab","aria-selected":y===B.id,className:"command-palette-filter"+(y===B.id?" is-active":""),"data-testid":`command-palette-filter-${B.id}`,onClick:()=>{var N;b(B.id),(N=U.current)==null||N.focus()},children:[u.jsx(he,{name:B.icon,size:14}),B.label]},B.id))]}),u.jsxs("div",{className:"command-palette-list","data-testid":"command-palette-list",children:[X&&R&&u.jsx("div",{className:"command-palette-empty",children:"Loading…"}),X&&A&&!R&&u.jsx("div",{className:"command-palette-error","data-testid":"command-palette-error",role:"alert",children:"Couldn't read that path."}),se.length===0&&!R&&!A&&u.jsx("div",{className:"command-palette-empty",children:"No matches"}),se.map((B,N)=>u.jsxs("div",{className:"command-palette-row",children:[!X&&(N===0||af[B.kind]!==af[se[N-1].kind])&&u.jsx("div",{className:"command-palette-section","data-testid":"command-palette-section",children:af[B.kind]}),u.jsxs("button",{type:"button",className:"command-palette-item"+(N===I?" is-selected":"")+(B.current?" is-current":""),"data-testid":`command-palette-item-${N}`,onMouseEnter:()=>q(N),onClick:()=>Q(B),children:[u.jsx(he,{name:B.icon??c3[B.kind],size:14}),u.jsx("span",{className:"command-palette-item-label",children:w0(B.label,B.labelIndices)}),B.current&&u.jsx("span",{className:"command-palette-current",children:"current"}),u.jsx("span",{className:"command-palette-item-meta","data-code":B.path!=null||B.kind==="session"||B.kind==="past"||void 0,children:B.meta?w0(B.meta,B.metaIndices):null})]})]},B.id))]}),u.jsxs("div",{className:"command-palette-footer","data-testid":"command-palette-footer",children:[u.jsxs("span",{children:[u.jsx("kbd",{children:"↑"}),u.jsx("kbd",{children:"↓"})," navigate"]}),!X&&u.jsxs("span",{children:[u.jsx("kbd",{children:"tab"})," category"]}),u.jsxs("span",{children:[u.jsx("kbd",{children:"↵"})," open"]}),u.jsxs("span",{children:[u.jsx("kbd",{children:"esc"})," close"]}),F?u.jsxs("button",{type:"button",className:"btn-ghost command-palette-footer-cta","data-testid":"command-palette-destination",onClick:()=>{if(F.href)window.open(F.href,"_blank","noopener,noreferrer");else if(F.actionId){const B=p.find(N=>N.id===F.actionId);B&&(B.run(),E())}},children:[F.label,u.jsx(he,{name:F.href?"ExternalLink":"ArrowRight",size:14})]}):u.jsxs("span",{className:"command-palette-footer-mod",children:[u.jsx("kbd",{children:h3}),u.jsx("kbd",{children:"K"})," anytime"]})]})]})})}const f3={offline:{icon:"CloudOff",title:"You're offline",body:"Agent Studio can't reach the network. Check your connection — the moment you're back, retry to pick up right where you left off."},auth:{icon:"Plug",title:"Session needs a refresh",body:"Your credential was rejected — it may have rotated or expired. Retry to reconnect with the current key; you won't lose your place."},error:{icon:"TriangleAlert",title:"Couldn't reach Agent Studio",body:"The server didn't respond as expected. This is usually temporary — retry in a moment."}};function p3({status:s,onRetry:t,retrying:n=!1,detail:r,onStartAuth:l}){const d=f3[s],[p,c]=H.useState({status:"idle"}),h=async()=>{if(l){c({status:"pending"});try{await l(),c({status:"idle"})}catch(v){const S=v instanceof Error?v.message:"Could not start sign-in. Try again.";c({status:"error",message:S})}}};return u.jsx("div",{className:"app-status connectivity-screen","data-testid":"connectivity-screen","data-status":s,role:"alert",children:u.jsxs("div",{className:"connectivity-screen-inner",children:[u.jsx("span",{className:"connectivity-screen-icon","aria-hidden":"true",children:u.jsx(he,{name:d.icon,size:22})}),u.jsx("span",{className:"connectivity-screen-title",children:d.title}),u.jsx("span",{className:"connectivity-screen-body",children:d.body}),s==="error"&&r&&u.jsx("span",{className:"connectivity-screen-detail","data-testid":"connectivity-screen-detail",children:r}),u.jsx("button",{className:"btn-primary connectivity-screen-retry","data-testid":"connectivity-retry",onClick:t,disabled:n||p.status==="pending",children:n?"Reconnecting…":"Retry"}),s==="auth"&&l&&u.jsxs("div",{className:"connectivity-screen-auth-section",children:[p.status==="pending"?u.jsxs("span",{className:"connectivity-auth-pending","data-testid":"connectivity-auth-pending",children:[u.jsx(he,{name:"Loader",size:14}),"Opening browser… waiting for sign-in"]}):u.jsxs("button",{className:"btn-secondary connectivity-connect-btn","data-testid":"connectivity-connect-btn",onClick:()=>void h(),children:[u.jsx(he,{name:"Plug",size:14}),"Connect account"]}),p.status==="error"&&u.jsx("span",{className:"connectivity-auth-error","data-testid":"connectivity-auth-error",children:p.message})]})]})})}function v3({onDismiss:s}){return u.jsxs("div",{className:"connectivity-banner",role:"status","data-testid":"connectivity-banner",children:[u.jsx("span",{className:"connectivity-banner-icon","aria-hidden":"true",children:u.jsx(he,{name:"CloudOff",size:14})}),u.jsx("span",{className:"connectivity-banner-text",children:"You're offline. Agent Studio stays usable, but live actions (runs, deploys, the terminal) pause until your connection returns."}),s&&u.jsx("button",{className:"connectivity-banner-dismiss","aria-label":"Dismiss offline notice","data-testid":"connectivity-banner-dismiss",onClick:s,children:"×"})]})}function m3(s,t,n){const r=new Map;for(const l of t)r.has(l.agentSessionId)||r.set(l.agentSessionId,l);for(const l of s)n.has(l.cwd)||r.has(l.agentSessionId)||r.set(l.agentSessionId,l);return Array.from(r.values()).sort((l,d)=>d.lastActiveAt.localeCompare(l.lastActiveAt))}const g3=12;function E1(s,t,n){var d;const r=[],l=p=>{p&&!r.includes(p)&&r.push(p)};return l((d=s.find(p=>p.id===n))==null?void 0:d.cwd),s.forEach(p=>l(p.cwd)),t.forEach(p=>l(p)),r.slice(0,g3)}const Cl={"claude-code":"Claude Code",codex:"Codex"};function Kp(s,t=Date.now()){const n=t-new Date(s).getTime(),r=Math.floor(n/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;const l=Math.floor(r/60);if(l<24)return`${l}h ago`;const d=Math.floor(l/24);return d<7?`${d}d ago`:new Date(s).toLocaleDateString([],{month:"short",day:"numeric"})}function _3(s,t){const n=new Date(t).getTime()-new Date(s).getTime();if(!Number.isFinite(n)||n<=0)return null;const r=Math.floor(n/6e4);if(r<1)return"under a minute";if(r<60)return`${r}m`;const l=Math.floor(r/60);return l<24?`${l}h ${r%60}m`:`${Math.floor(l/24)}d ${l%24}h`}function x0(s){return s.resumeMode===void 0?"checking":s.resumeMode==="agent-resume"?"resume":(s.turnCount??s.messageCount??0)>0?"from-summary":"empty"}function y3(s){switch(s){case"resume":return null;case"from-summary":return"from summary";case"empty":return"nothing recorded";case"checking":return"checking…"}}function Jf(s,t=Date.now(),n={}){const r=[];n.includeHarness!==!1&&r.push(Cl[s.harness]),s.gitBranch&&r.push(s.gitBranch);const l=s.turnCount??s.messageCount;l!=null&&l>0&&r.push(`${l} ${l===1?"turn":"turns"}`);const d=n.state?y3(n.state):null;return d&&r.push(d),r.push(Kp(s.lastActiveAt,t)),r.join(" · ")}function k1(s,t){const[n,r]=H.useState(s===null?{status:"empty"}:{status:"loading"});return H.useEffect(()=>{if(s===null){r({status:"empty"});return}let l=!1;return r({status:"loading"}),t(s).then(d=>{l||r(d?{status:"ready",record:d}:{status:"empty"})},d=>{l||r({status:"error",message:d instanceof Error?d.message:String(d)})}),()=>{l=!0}},[s,t]),n}function T1({text:s}){const t=s.split(`
|
|
459
|
-
`),n=[];let r=0,l=0;function d(){return l++}function p(c){const h=[],v=/(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*)/g;let S=0,f;for(;(f=v.exec(c))!==null;){f.index>S&&h.push(c.slice(S,f.index));const x=f[0];x.startsWith("`")&&x.endsWith("`")?h.push(u.jsx("code",{className:"chat-inline-code",children:x.slice(1,-1)},d())):x.startsWith("**")&&x.endsWith("**")?h.push(u.jsx("strong",{children:x.slice(2,-2)},d())):x.startsWith("*")&&x.endsWith("*")?h.push(u.jsx("em",{children:x.slice(1,-1)},d())):h.push(x),S=f.index+x.length}return S<c.length&&h.push(c.slice(S)),h}for(;r<t.length;){const c=t[r];if(c.startsWith("```")){const f=c.slice(3).trim(),x=[];for(r++;r<t.length&&!t[r].startsWith("```");)x.push(t[r]),r++;r++,n.push(u.jsx("pre",{className:"chat-code-block","data-lang":f||void 0,children:u.jsx("code",{className:f?`language-${f}`:void 0,children:x.join(`
|
|
460
|
-
`)})},d()));continue}const h=c.match(/^(#{1,3})\s+(.+)/);if(h){const x=`h${h[1].length}`;n.push(u.jsx(x,{className:"chat-heading",children:p(h[2])},d())),r++;continue}if(c.startsWith("> ")){n.push(u.jsx("blockquote",{className:"chat-blockquote",children:p(c.slice(2))},d())),r++;continue}if(/^- \[[ x]\]/.test(c)){const f=[];for(;r<t.length&&/^- \[[ x]\]/.test(t[r]);){const x=t[r][3]==="x";f.push({text:t[r].replace(/^- \[[ x]\]\s?/,""),checked:x}),r++}n.push(u.jsx("ul",{className:"chat-list chat-checklist",children:f.map((x,E)=>u.jsx("li",{children:p(x.text)},E))},d()));continue}if(/^[-*+]\s+/.test(c)){const f=[];for(;r<t.length&&/^[-*+]\s+/.test(t[r]);){const x=t[r].replace(/^[-*+]\s+/,"");f.push(u.jsx("li",{children:p(x)},d())),r++}n.push(u.jsx("ul",{className:"chat-list",children:f},d()));continue}if(!c.trim()){r++;continue}const v=f=>f.startsWith("```")||/^#{1,3}\s+/.test(f)||f.startsWith("> ")||/^[-*+]\s+/.test(f),S=[c];for(r++;r<t.length&&t[r].trim()&&!v(t[r]);)S.push(t[r]),r++;n.push(u.jsx("p",{className:"chat-paragraph",children:p(S.join(" "))},d()))}return u.jsx(u.Fragment,{children:n})}const C0={"assistant-narration-gap":"Only each turn's final assistant message was recorded — anything said between tool calls is missing.","truncated-tool-output":"Large tool results were truncated when recorded and can't be shown in full.","missing-assistant-text":"This agent doesn't report assistant text to the harness, so replies aren't shown.","incomplete-final-turn":"The last turn never completed — the session ended while it was still running.","compacted-archive":"Read from this session's archived copy: the conversation is whole, but tool inputs and results were shortened to keep it small enough to keep.","dropped-early-turns":"The archived copy only had room for the most recent turns — earlier ones are gone."},b3=["assistant-narration-gap","truncated-tool-output","missing-assistant-text","incomplete-final-turn","compacted-archive","dropped-early-turns"];function S3(s){const t=new Set(s),n=b3.filter(l=>t.has(l)).map(l=>C0[l]),r=[...t].filter(l=>!(l in C0)).map(l=>`Known gap reported by the harness: ${l}.`);return[...n,...r]}function w3(s){if(!s)return null;const t=[];return s.inputTokens!=null&&t.push(`${E0(s.inputTokens)} in`),s.outputTokens!=null&&t.push(`${E0(s.outputTokens)} out`),t.length>0?t.join(" · "):null}function E0(s){if(s<1e3)return String(s);const t=s/1e3;return`${t<100?t.toFixed(1):Math.round(t)}k`}function A1(s,t=Date.now()){if(!s)return null;const n=new Date(s);if(Number.isNaN(n.getTime()))return null;const r=n.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),l=new Date(t);return n.getFullYear()===l.getFullYear()&&n.getMonth()===l.getMonth()&&n.getDate()===l.getDate()?r:`${n.toLocaleDateString([],{day:"numeric",month:"short"})}, ${r}`}function x3(s,t){const n=s??"unknown tool";if(!t)return n;const r=t.replace(/\s+/g," ").trim();if(!r)return n;const l=r.length>80?`${r.slice(0,80)}…`:r;return`${n} · ${l}`}function C3({record:s}){const t=S3(s.limitations),n=A1(s.archivedAt);return u.jsxs("div",{className:"transcript","data-testid":"session-transcript",children:[u.jsxs("div",{className:"transcript-notice","data-testid":"transcript-reconstructed",children:[u.jsx("span",{className:"transcript-badge",children:"Reconstructed"}),u.jsxs("div",{className:"transcript-notice-body",children:[u.jsx("p",{className:"transcript-notice-lead",children:"Rebuilt from the harness's own recording of this session, not a replay of your terminal."}),s.archivedAt!==null&&u.jsx("p",{className:"transcript-notice-lead transcript-notice-archived","data-testid":"transcript-archived",children:n?`Archived copy from ${n}, kept after this session's raw events aged out of the local log.`:"Archived copy, kept after this session's raw events aged out of the local log."}),t.length>0&&u.jsx("ul",{className:"transcript-notice-list","data-testid":"transcript-limitations",children:t.map(r=>u.jsx("li",{children:r},r))})]})]}),u.jsx("ol",{className:"transcript-turns",children:s.turns.map(r=>u.jsx(E3,{turn:r},r.index))})]})}function E3({turn:s}){const t=w3(s.usage),n=A1(s.promptAt);return u.jsxs("li",{className:"transcript-turn","data-testid":"transcript-turn","data-turn":s.index,children:[u.jsxs("div",{className:"transcript-role transcript-role-user",children:[u.jsx("span",{className:"transcript-role-label",children:"You"}),n&&u.jsx("span",{className:"transcript-time",children:n})]}),s.prompt!==null?u.jsx("div",{className:"transcript-prompt","data-testid":"transcript-prompt",children:s.prompt}):u.jsx("div",{className:"transcript-absent","data-testid":"transcript-no-prompt",children:"No prompt recorded for this turn — the harness started recording after it began."}),s.toolCalls.length>0&&u.jsx("ul",{className:"transcript-tools","data-testid":"transcript-tools",children:s.toolCalls.map((r,l)=>u.jsx(k3,{call:r},`${r.at}-${l}`))}),u.jsxs("div",{className:"transcript-role transcript-role-agent",children:[u.jsx("span",{className:"transcript-role-label",children:"Agent"}),s.model&&u.jsx("span",{className:"transcript-model",children:s.model}),t&&u.jsx("span",{className:"transcript-usage",children:t})]}),s.assistantText!==null?u.jsx("div",{className:"transcript-assistant","data-testid":"transcript-assistant",children:u.jsx(T1,{text:s.assistantText})}):u.jsx("div",{className:"transcript-absent","data-testid":"transcript-no-assistant",children:s.incomplete?"This turn never completed — no reply was recorded.":"No assistant text was recorded for this turn."}),s.incomplete&&u.jsx("div",{className:"transcript-incomplete","data-testid":"transcript-incomplete",children:"Turn incomplete"})]})}function k3({call:s}){return u.jsx("li",{className:"transcript-tool",children:u.jsxs("details",{"data-testid":"transcript-tool-call",children:[u.jsxs("summary",{className:"transcript-tool-summary",children:[u.jsx("span",{className:"transcript-tool-name",children:x3(s.name,s.input)}),s.responseTruncated&&u.jsx("span",{className:"transcript-tool-truncated","data-testid":"transcript-tool-truncated",children:"truncated"})]}),u.jsxs("div",{className:"transcript-tool-body",children:[s.input&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"transcript-tool-heading",children:"Input"}),u.jsx("pre",{className:"transcript-tool-pre",children:s.input})]}),u.jsx("div",{className:"transcript-tool-heading",children:"Result"}),s.responseSummary?u.jsx("pre",{className:"transcript-tool-pre",children:s.responseSummary}):u.jsx("div",{className:"transcript-absent",children:"No result recorded."}),s.responseTruncated&&u.jsx("div",{className:"transcript-absent",children:"The recorded result was truncated at the collector's size cap; the rest isn't recoverable."})]})]})})}function k0(s){return s.agentSessionId==null?"This session can't be resumed: it exited before establishing a session id.":`${Cl[s.harness]} has no saved conversation for this session, so there's nothing to hand back. That happens when a session ends before its first prompt — the coding agent never writes a transcript for those.`}function T3({session:s,resumeMode:t,loadRecord:n,onResume:r,onContinue:l,onClose:d}){const p=s.agentSessionId!=null&&t!=="rehydrate",c=_3(s.createdAt,s.lastActiveAt),h=k1(s.id,n),v=h.status!=="empty",S=!p&&h.status==="ready";return u.jsxs("div",{className:"dead-session-pane","data-testid":"dead-session-pane","data-has-record":v,children:[u.jsxs("div",{className:"dead-session-summary",children:[u.jsx("span",{className:"empty-state-icon","aria-hidden":"true",children:u.jsx(he,{name:"SquareTerminal",size:18})}),u.jsx("div",{className:"dead-session-title",children:"Session exited"}),u.jsxs("div",{className:"dead-session-meta",children:[s.cwd,s.exitCode!=null&&` · exit code ${s.exitCode}`]}),u.jsxs("dl",{className:"dead-session-detail","data-testid":"dead-session-detail",children:[s.title&&u.jsxs("div",{className:"dead-session-detail-row",children:[u.jsx("dt",{children:"Session"}),u.jsx("dd",{children:s.title})]}),u.jsxs("div",{className:"dead-session-detail-row",children:[u.jsx("dt",{children:"Coding agent"}),u.jsx("dd",{children:Cl[s.harness]})]}),c&&u.jsxs("div",{className:"dead-session-detail-row",children:[u.jsx("dt",{children:"Ran for"}),u.jsx("dd",{children:c})]}),u.jsxs("div",{className:"dead-session-detail-row",children:[u.jsx("dt",{children:"Ended"}),u.jsx("dd",{children:Kp(s.lastActiveAt)})]})]}),u.jsxs("div",{className:"dead-session-actions",children:[S?u.jsx("button",{className:"btn-primary","data-testid":"dead-session-continue",onClick:l,children:"Continue here"}):u.jsx("button",{className:"btn-primary","data-testid":"dead-session-resume",onClick:r,disabled:!p,title:p?void 0:k0(s),children:"Resume"}),u.jsx("button",{className:"btn-ghost","data-testid":"dead-session-close",onClick:d,children:"Close"})]}),!p&&u.jsxs("div",{className:"dead-session-resume-reason","data-testid":"dead-session-resume-reason",children:[k0(s)," ",S?"Continuing opens a fresh session in this directory, seeded with the reconstruction below — a briefing about this session, not its context. The new coding agent will need to check the repository before relying on any of it.":"Start a new session in this directory instead; there is no recording of this one to carry over either."]})]}),s.exitTail&&u.jsxs("div",{className:"dead-session-exit-tail","data-testid":"dead-session-exit-tail",children:[u.jsx("div",{className:"dead-session-exit-tail-label",children:"Last output before exit"}),u.jsx("pre",{className:"dead-session-exit-tail-body",children:s.exitTail})]}),v&&u.jsx("div",{className:"dead-session-record","data-testid":"dead-session-record",children:u.jsx(R1,{state:h})})]})}function A3({summary:s,loadRecord:t,onStart:n,onClose:r}){const l=s.resumeMode==="agent-resume",d=s.harnessSessionId??s.agentSessionId,p=k1(d,t),c=!l&&p.status==="ready";return u.jsxs("div",{className:"past-session-pane","data-testid":"past-session-pane",children:[u.jsxs("header",{className:"past-session-header",children:[u.jsxs("div",{className:"past-session-heading",children:[u.jsx("div",{className:"dead-session-title",children:s.title}),u.jsxs("div",{className:"dead-session-meta",children:[Jf(s)," · ",s.cwd]})]}),u.jsxs("div",{className:"dead-session-actions",children:[u.jsx("button",{className:"btn-primary","data-testid":"past-session-start",onClick:n,children:l?"Resume":c?"Continue here":"New session here"}),u.jsx("button",{className:"btn-ghost","data-testid":"past-session-close",onClick:r,children:"Close"})]})]}),!l&&u.jsxs("div",{className:"dead-session-resume-reason","data-testid":"past-session-reason",children:[Cl[s.harness]," has no saved conversation for this session, so it can't be reattached — sessions that end before their first prompt are never written to the coding agent's history."," ",c?"Continuing opens a fresh session here, seeded with the reconstruction below. The new coding agent gets a briefing about this session, not its context — it will need to check the repository before relying on any of it.":"Starting opens a fresh session in the same directory, with no context from this one."]}),u.jsx("div",{className:"past-session-body",children:u.jsx(R1,{state:p})})]})}function R1({state:s}){return s.status==="loading"?u.jsx("div",{className:"past-session-status","data-testid":"past-session-loading",children:"Rebuilding this session's transcript…"}):s.status==="error"?u.jsxs("div",{className:"past-session-status","data-testid":"past-session-error",children:["Couldn't load this session's transcript: ",s.message]}):s.status==="empty"?u.jsxs("div",{className:"past-session-status","data-testid":"past-session-empty",children:[u.jsx("span",{className:"empty-state-icon","aria-hidden":"true",children:u.jsx(he,{name:"SquareTerminal",size:18})}),"No transcript for this session: Agent Studio has no recorded events for it. Sessions Agent Studio didn't run — or ones whose events have aged out of the local log — show up here as history rows only."]}):u.jsx(C3,{record:s.record})}function R3({onCancel:s,onConfirm:t,triggerRef:n}){const r=H.useRef(null);return xl(!0,{onDismiss:s,containerRef:r,triggerRef:n}),u.jsx("div",{className:"modal-backdrop",onClick:s,children:u.jsxs("div",{ref:r,className:"modal modal-confirm",role:"alertdialog","aria-label":"End session","data-testid":"end-session-confirm",onClick:l=>l.stopPropagation(),children:[u.jsxs("div",{className:"modal-header",children:["End session?",u.jsx("button",{className:"theme-toggle modal-close","aria-label":"Close",title:"Close",onClick:s,children:u.jsx(he,{name:"X",size:14})})]}),u.jsx("div",{className:"modal-body",children:u.jsx("p",{className:"modal-copy",children:"This kills the live terminal; anything the agent is doing right now stops. The session stays resumable from history once it has an agent session id."})}),u.jsxs("div",{className:"modal-actions",children:[u.jsx("button",{className:"btn-ghost",autoFocus:!0,onClick:s,children:"Keep session"}),u.jsx("button",{className:"btn-danger","data-testid":"end-session-confirm-btn",onClick:t,children:"End session"})]})]})})}function M3(s){return Jn(s)}function j3({overviewMode:s=!1,openedAgentName:t=null,reviewTitle:n=null,composing:r=!1,onBack:l=null,activeSession:d,sessionName:p,onRenameSession:c,boundWorkflowName:h,busy:v,onExpandRail:S,onExpandRight:f,onCloseSession:x,onOpenInEditor:E,editorLabel:T,onToast:C,actions:y=null,onNewSession:b=null,sessions:m=[],onSelectSession:g=null,labelOf:k}){const[M,R]=H.useState(!1),[j,A]=H.useState(!1),[D,I]=H.useState(!1),[q,G]=H.useState(""),U=H.useRef(null),X=()=>A(!1),se=()=>{d&&c(d.id,q),I(!1)},F=d?m.filter(J=>J.id!==d.id):[],Q=d?[d,...F]:[];return u.jsxs("div",{className:"session-bar",children:[S&&u.jsx("button",{className:"theme-toggle rail-toggle","data-testid":"rail-expand","aria-label":"Expand workspace panel",title:"Expand workspace panel",onClick:S,children:u.jsx(he,{name:"PanelLeftOpen",size:14})}),u.jsx("div",{className:"session-queue","data-testid":"session-context","data-session-id":(d==null?void 0:d.id)??"",children:s?u.jsxs("div",{className:"session-current session-current-static",children:[u.jsx(he,{name:"Radio",size:13}),u.jsx("span",{className:"session-context-title","data-testid":"session-context-title",children:"Overview"})]}):t?u.jsxs("div",{className:"session-current session-current-static",children:[u.jsx("span",{className:"session-context-title","data-testid":"session-context-title",children:t}),u.jsx("span",{className:"status-tag session-status-tag","data-testid":"session-status-tag","data-status":"none","data-tooltip":"No running session for this agent. Start one to work on it.",children:"no session"})]}):n?u.jsxs("div",{className:"session-current session-current-static",children:[u.jsx(he,{name:"History",size:13}),u.jsx("span",{className:"session-context-title","data-testid":"session-context-title",children:n}),u.jsxs("span",{className:"status-tag session-status-tag","data-testid":"session-status-tag","data-status":"exited","data-tooltip":"A past session under review. Resume it from the pane below.",children:[u.jsx("span",{className:"session-dot","data-status":"exited"}),"past"]})]}):r?l?u.jsxs("button",{type:"button",className:"session-current session-back","data-testid":"composer-back",onClick:l,children:[u.jsx(he,{name:"ArrowLeft",size:13}),u.jsx("span",{className:"session-context-title","data-testid":"session-context-title",children:"Back"})]}):null:d?u.jsx(u.Fragment,{children:u.jsxs("div",{className:"session-current-wrap",children:[D?u.jsx("input",{className:"group-name-input session-rename-input session-context-rename","data-testid":"session-rename-input",value:q,autoFocus:!0,onFocus:J=>J.currentTarget.select(),onChange:J=>G(J.target.value),onKeyDown:J=>{J.key==="Enter"&&se(),J.key==="Escape"&&I(!1)},onBlur:se}):u.jsxs("button",{ref:U,className:"session-current session-title-trigger","data-testid":"session-menu","aria-haspopup":"menu","aria-expanded":j,"data-tooltip":`${Cl[d.harness]} · ${M3(d.cwd)} · ${d.cwd}`,onClick:()=>A(J=>!J),children:[v?u.jsx("span",{className:"session-busy","data-testid":"session-busy","aria-hidden":"true"}):u.jsx("span",{className:"session-dot","data-status":d.status}),u.jsx("span",{className:"session-context-title","data-testid":"session-context-title",children:k?k(d):p??d.title}),u.jsx(he,{name:"ChevronDown",size:13})]}),u.jsxs(Cn,{open:j,anchorRef:U,onDismiss:X,placement:"down-start",className:"session-menu",role:"menu",testid:"session-menu-popover",children:[u.jsx("div",{className:"session-menu-section",children:"Sessions"}),Q.map(J=>{const O=J.id===d.id;return u.jsxs("button",{role:"menuitemradio","aria-checked":O,className:"profile-menu-item session-switch-item"+(O?" is-selected":""),"data-testid":`session-switch-${J.id}`,onClick:()=>{O||g==null||g(J.id),X()},children:[u.jsx("span",{className:"session-dot","data-status":J.status}),u.jsx("span",{className:"session-switch-label",children:k?k(J):J.title}),u.jsx("span",{className:"session-switch-meta",children:Kp(J.lastActiveAt)}),O&&u.jsx(he,{name:"Check",size:13})]},J.id)}),b&&u.jsxs("button",{role:"menuitem",className:"profile-menu-item session-menu-new","data-testid":"session-new-menu",onClick:()=>{b(),X()},children:[u.jsx(he,{name:"Plus",size:13}),"New session"]}),u.jsx("div",{className:"session-menu-divider",role:"separator"}),h&&u.jsxs("div",{className:"session-menu-bound","data-testid":"session-workflow-chip",children:["Bound to ",u.jsx("strong",{children:h})," · shown in Canvas"]}),u.jsxs("button",{role:"menuitem",className:"profile-menu-item",onClick:()=>{var J;(J=navigator.clipboard)==null||J.writeText(d.cwd).then(()=>C("Path copied.","success")).catch(()=>C("Couldn't copy the path.")),X()},children:[u.jsx(he,{name:"Copy",size:13}),"Copy path"]}),u.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"session-rename",onClick:()=>{G(p??d.title),I(!0),X()},children:[u.jsx(he,{name:"Pencil",size:13}),"Rename session"]}),u.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"session-open-editor",onClick:()=>{E(d.cwd),X()},children:[u.jsx(he,{name:"Code",size:13}),"Open in ",T]}),d.status!=="exited"&&u.jsxs("button",{role:"menuitem",className:"profile-menu-item session-menu-danger","data-testid":"session-end-btn",onClick:()=>{X(),R(!0)},children:[u.jsx(he,{name:"X",size:13}),"End session…"]})]})]})}):u.jsx("span",{className:"session-context-none",children:"No active session"})}),b&&d&&!r&&u.jsx("button",{className:"session-new","data-testid":"session-new","aria-label":"New session","data-tooltip":"New session",onClick:b,children:u.jsx(he,{name:"Plus",size:15})}),y,f&&u.jsx("button",{className:"theme-toggle","data-testid":"right-expand","aria-label":"Expand canvas panel",title:"Expand canvas panel",onClick:f,children:u.jsx(he,{name:"PanelRightOpen",size:15})}),M&&d&&u.jsx(R3,{triggerRef:U,onCancel:()=>R(!1),onConfirm:()=>{R(!1),x(d.id)}})]})}const T0={deploy:"deploy",prod_run:"prod-run",run_local:"run-local"};function M1(s){return Object.prototype.hasOwnProperty.call(T0,s)?T0[s]:null}function D3(s){return M1(s.id)===null&&s.action.kind==="inject"}function N3(s,t,n){if(s.requiresWorkflow){if(!t)return"Select an agent first";if(s.action.kind==="open-url"&&s.action.url.includes("{{workflow.definitionId}}")&&t.definitionId==null)return"Not deployed yet"}return s.action.kind!=="open-url"&&!n?"Start a session first":null}function L3(s,t){return s.replace("{{workflow.definitionId}}",String((t==null?void 0:t.definitionId)??""))}function pl(s,t,n){const r={event:s,...t?{data:t}:{}};fetch("/api/track",{method:"POST",headers:{"Content-Type":"application/json","X-Harness-Token":Aa()},body:JSON.stringify(r),keepalive:!0}).catch(()=>{})}function O3({workflow:s,activeSessionId:t,sessionReady:n,macros:r,onRunMacro:l,preview:d,lastDeployError:p,authenticated:c,directActionSettleSeq:h,runningTarget:v}){const S=b=>r.find(m=>m.id===b),f=Na(s,p),x=f==="ready",E=s.definitionId!=null?zu(s.definitionId):Iu,[T,C]=H.useState(null);H.useEffect(()=>{C(null)},[s.path,f,p,h]);const y=[{id:"local",label:"Test",icon:"FlaskConical",macro:S("run_local"),testId:"session-step-local",hint:"Test locally with Sapiom capability calls stubbed — no real Sapiom capability calls."},{id:"run",label:"Run",icon:"Play",macro:S("prod_run"),testId:"session-step-run",hint:"Run: start a real cloud execution on Sapiom.",needsDeploy:!0,needsAuth:!0,primary:x},{id:"deploy",label:"Deploy",icon:"CloudUpload",macro:S("deploy"),testId:"session-step-deploy",hint:"Deploy: push and build on Sapiom.",needsAuth:!0,primary:!x}].filter(b=>b.macro);return u.jsxs("div",{className:"session-actions","data-testid":"session-steps","aria-label":"Agent actions",children:[d&&u.jsxs("a",{className:"status-tag status-tag-action session-preview-chip","data-testid":"session-preview-chip",href:d.url,target:"_blank",rel:"noreferrer","aria-label":`Preview :${d.port}`,"data-tooltip":`The coding agent is serving an app on port ${d.port}. Opens ${d.url}`,children:[u.jsx(he,{name:"ExternalLink",size:12}),u.jsx("span",{className:"session-preview-label",children:"Preview "}),":",d.port]}),u.jsx("a",{className:"session-step session-action-prod","data-testid":"session-step-prod",href:E,target:"_blank",rel:"noreferrer","aria-label":"Open this agent in the Sapiom dashboard","data-tooltip":s.definitionId!=null?"Open this linked agent in the Sapiom dashboard":"Open the Sapiom dashboard",children:u.jsx(he,{name:"Globe",size:14})}),y.map(b=>{const m=b.needsAuth&&!c?"Connect your account first":null,g=b.needsDeploy?gk(s,p):null,k=!n&&b.macro&&D3(b.macro)?"Session is starting":null,M=m??g??k??(b.macro?N3(b.macro,s,t):null),R=v==="local"&&b.id==="local"||v==="prod"&&b.id==="run";return u.jsxs("button",{className:"session-step"+(b.primary?" session-action-primary":""),"data-testid":b.testId,"data-pending":T===b.id||void 0,"data-running":R||void 0,disabled:!!M,"data-tooltip":M?`${b.label}: ${M}`:b.hint,"aria-label":M?`${b.label}: ${M}`:b.label,onClick:()=>{b.macro&&(l(b.macro),C(b.id),pl("macro.invoked",{macroId:b.macro.id}))},children:[u.jsx(he,{name:b.icon,size:14}),u.jsx("span",{className:"session-step-label",children:b.label})]},b.id)})]})}function B3({onDismiss:s,onOpenSettings:t}){return u.jsxs("div",{className:"telemetry-notice",role:"status","data-testid":"telemetry-notice",children:[u.jsx("div",{className:"telemetry-notice-body",children:u.jsxs("p",{className:"telemetry-notice-text",children:["Sharing session details with Sapiom is ",u.jsx("strong",{children:"off by default"}),". Your prompts and tool calls stay local unless you opt in to help us improve Agent Studio. Turn it on any time in"," ",u.jsx("button",{className:"telemetry-notice-settings-link",onClick:()=>{t(),s()},children:"Settings"}),", or use the indicator in the top bar."]})}),u.jsx("button",{className:"telemetry-notice-dismiss","aria-label":"Dismiss analytics notice","data-testid":"telemetry-notice-dismiss",onClick:s,children:"×"})]})}const Ra="(none)",A0={query:"",category:null,cadence:null};function H3(s){return s.query.trim()!==""||s.category!==null||s.cadence!==null}const I3={"on-demand":"On demand",scheduled:"Scheduled","on-event":"On event","on-webhook":"Webhook"};function j1(s){return s?I3[s]??s.replace(/-/g," ").replace(/^./,t=>t.toUpperCase()):"No trigger declared"}function D1(s,t,n){const r=new Map;for(const l of s){const d=t(l)??Ra;r.set(d,(r.get(d)??0)+1)}return[...r.entries()].map(([l,d])=>({value:l,label:n(l),count:d})).sort((l,d)=>l.value===Ra?1:d.value===Ra?-1:d.count-l.count||l.label.localeCompare(d.label))}function z3(s){return D1(s,t=>t.category,t=>t===Ra?"Uncategorised":s3(t))}function $3(s){return D1(s,t=>t.cadence,t=>t===Ra?"No trigger declared":j1(t))}function R0(s,t){return t===null?!0:t===Ra?s===null:s===t}function P3(s,t,n){return s.filter(r=>n(r,t.query)&&R0(r.category,t.category)&&R0(r.cadence,t.cadence))}function eu({children:s,variant:t="tag",title:n}){return u.jsx("span",{className:t==="count"?"pill pill--count":"pill",title:n,children:s})}const M0=3;function U3({template:s,onPreview:t,onUse:n}){const[r,l]=H.useState(!1),d=H.useRef(null),p=[{term:"Steps",value:String(s.stepCount)},{term:"Trigger",value:s.cadence?j1(s.cadence):"Not declared"},{term:"Complexity",value:Yp(s.complexity),...s.complexity?{title:i3(s.complexity)}:{title:"This catalog response carried no complexity band."}},{term:"Capabilities",value:s.capabilities.length>0?String(s.capabilities.length):"None"}];return u.jsxs(u.Fragment,{children:[u.jsx("button",{ref:d,type:"button",className:"theme-toggle template-card-info","data-testid":`template-card-info-${s.id}`,"aria-label":`What ${s.name} runs and costs`,"aria-expanded":r,onClick:()=>l(c=>!c),children:u.jsx(he,{name:"Info",size:14})}),u.jsxs(Cn,{open:r,anchorRef:d,onDismiss:()=>l(!1),placement:"down-end",className:"template-facts",testid:"template-facts",children:[u.jsx("dl",{className:"template-fact-list",children:p.map(c=>u.jsxs("div",{className:"template-fact",children:[u.jsx("dt",{children:c.term}),u.jsx("dd",{title:c.title,children:c.value})]},c.term))}),u.jsxs("div",{className:"template-fact-actions",children:[u.jsx("button",{type:"button",className:"btn-line","data-testid":`template-facts-preview-${s.id}`,onClick:()=>{l(!1),t(s)},children:"Preview"}),u.jsx("button",{type:"button",className:"btn-primary","data-testid":`template-facts-use-${s.id}`,onClick:()=>{l(!1),n(s)},children:"Use"})]})]})]})}function j0({template:s,onOpen:t,onUse:n}){const r=s.kind==="gallery"?s.tags.slice(0,M0):[],l=s.kind==="gallery"?s.tags.length-r.length:0;return u.jsxs("article",{className:"template-card","data-testid":`template-card-${s.id}`,children:[u.jsx("button",{type:"button",className:"template-card-hitbox","data-testid":`template-card-open-${s.id}`,onClick:()=>t(s),children:u.jsxs("span",{className:"visually-hidden",children:["Open ",s.name]})}),u.jsxs("div",{className:"template-card-header",children:[u.jsx("h3",{className:"template-card-name",children:s.name}),s.kind==="gallery"&&u.jsx(U3,{template:s,onPreview:t,onUse:n})]}),u.jsx("p",{className:"template-card-desc","data-testid":"template-card-desc",children:s.description}),s.kind==="starter"?u.jsx("div",{className:"template-card-tags",children:u.jsx(eu,{children:"bundled"})}):r.length>0&&u.jsxs("div",{className:"template-card-tags",children:[r.map(d=>u.jsx(eu,{children:d},d)),l>0&&u.jsxs(eu,{variant:"count",title:s.tags.slice(M0).join(", "),children:["+",l]})]})]})}function F3({detail:s}){const t=a3(s);return u.jsx("div",{className:"template-graph","data-testid":"template-graph",children:t.nodes.map(n=>{const r=t.edges.filter(l=>l.from===n.id);return u.jsxs("div",{className:"template-graph-item","data-testid":`template-graph-node-${n.id}`,children:[u.jsxs("div",{className:"template-graph-node",children:[u.jsx("span",{className:"canvas-step-dot dot--"+n.kind,"aria-hidden":"true"}),u.jsx("span",{className:"template-graph-name",children:n.label}),n.kind==="terminal-success"&&u.jsx("span",{className:"template-step-exit",children:"exit"}),n.kind==="terminal-warn"&&u.jsx("span",{className:"template-step-exit template-step-exit--warn",children:"fails out"}),n.kind==="pause"&&u.jsx("span",{className:"template-step-pause",children:"pause"}),n.capabilities.map(l=>u.jsx("code",{className:"template-cap",children:l},l))]}),r.map(l=>u.jsxs("div",{className:"canvas-step-transition template-graph-edge",children:[u.jsx(he,{name:"CornerDownRight",size:12}),u.jsx("span",{className:"canvas-step-transition-target",children:l.to}),l.label&&u.jsx("span",{className:"canvas-step-transition-label",children:l.label})]},`${l.from}->${l.to}`))]},n.id)})})}function q3({example:s,index:t}){return u.jsxs("details",{className:"template-example",children:[u.jsx("summary",{className:"template-example-summary",children:s.title??`Example ${t+1}`}),u.jsxs("div",{className:"template-example-body",children:[u.jsx("span",{className:"template-example-label",children:"Input"}),u.jsx("pre",{className:"template-example-json",children:JSON.stringify(s.input,null,2)}),s.output!==null&&u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"template-example-label",children:"Output"}),u.jsx("pre",{className:"template-example-json",children:JSON.stringify(s.output,null,2)})]})]})]})}function W3({detail:s}){return u.jsxs(u.Fragment,{children:[s.whatItDoes&&u.jsx("p",{className:"template-lead",children:s.whatItDoes}),s.steps.length>0&&u.jsxs("section",{className:"template-section",children:[u.jsx("h4",{className:"template-section-title",children:"Steps"}),u.jsx(F3,{detail:s}),u.jsx("ol",{className:"template-steps",children:s.steps.map((t,n)=>u.jsxs("li",{className:"template-step",children:[u.jsx("span",{className:"template-step-index","aria-hidden":"true",children:n+1}),u.jsxs("span",{className:"template-step-copy",children:[u.jsxs("span",{className:"template-step-name",children:[t.name,u.jsx("span",{className:"template-step-role",children:t.sublabel})]}),t.description&&u.jsx("span",{className:"template-step-desc",children:t.description})]}),t.capabilities.map(r=>u.jsx("code",{className:"template-cap",children:r},r))]},t.name))})]}),u.jsxs("section",{className:"template-section",children:[u.jsx("h4",{className:"template-section-title",children:"Capabilities and complexity"}),s.capabilities.length>0?u.jsx("div",{className:"template-caps",children:s.capabilities.map(t=>u.jsx("code",{className:"template-cap",children:t},t))}):u.jsx("p",{className:"template-note","data-testid":"template-caps-none",children:"Declares no metered capabilities."}),u.jsx("p",{className:"template-note","data-testid":"template-complexity-note",children:s.complexity?u.jsxs(u.Fragment,{children:[u.jsx("strong",{children:Yp(s.complexity)})," —"," ",C1(s.complexity),". A rough estimate of how involved this template is, not a price. Local test runs stub every capability and are free."]}):u.jsx(u.Fragment,{children:"This catalog response carried no complexity band, so none is shown. Local test runs stub every capability and are free."})})]}),s.requiredSecrets.length>0&&u.jsxs("section",{className:"template-section",children:[u.jsx("h4",{className:"template-section-title",children:"Credentials you supply"}),u.jsx("ul",{className:"template-usecases",children:s.requiredSecrets.map(t=>u.jsxs("li",{children:[u.jsx("code",{className:"template-cap",children:t.key})," ",t.label,t.description&&u.jsxs(u.Fragment,{children:[" — ",t.description]})]},t.key))})]}),s.useCases.length>0&&u.jsxs("section",{className:"template-section",children:[u.jsx("h4",{className:"template-section-title",children:"Use cases"}),u.jsx("ul",{className:"template-usecases",children:s.useCases.map(t=>u.jsx("li",{children:t},t))})]}),s.examples.length>0&&u.jsxs("section",{className:"template-section",children:[u.jsx("h4",{className:"template-section-title",children:"Examples"}),s.examples.map((t,n)=>u.jsx(q3,{example:t,index:n},t.title??n))]}),s.notes&&u.jsxs("section",{className:"template-section",children:[u.jsx("h4",{className:"template-section-title",children:"Notes"}),u.jsx("div",{className:"template-notes",children:u.jsx(T1,{text:s.notes})})]})]})}function G3({template:s,getTemplate:t}){const[n,r]=H.useState(null),[l,d]=H.useState(null);return H.useEffect(()=>{if(s.kind!=="gallery"){r(null),d(null);return}let p=!1;return r(null),d(null),t(s.id).then(c=>{p||r(c)}).catch(c=>{p||d(c instanceof Error?c.message:String(c))}),()=>{p=!0}},[s.kind,s.id,t]),u.jsxs("div",{className:"template-detail","data-testid":"template-detail",children:[u.jsxs("div",{className:"template-detail-head",children:[u.jsx("h3",{className:"template-detail-name",children:s.name}),u.jsx("div",{className:"template-tags",children:(s.kind==="gallery"?s.tags:["bundled"]).map(p=>u.jsx("span",{className:"template-tag",children:p},p))})]}),s.kind==="gallery"?u.jsxs(u.Fragment,{children:[(n==null?void 0:n.author)&&u.jsxs("span",{className:"template-byline",children:["By"," ",n.author.url?u.jsx("a",{href:n.author.url,target:"_blank",rel:"noopener noreferrer",children:n.author.name}):n.author.name]}),!n&&!l&&u.jsx("p",{className:"template-lead",children:s.description}),l&&u.jsxs("p",{className:"template-note","data-testid":"template-detail-error",children:["Could not load this template’s details: ",l]}),n&&u.jsx(W3,{detail:n})]}):u.jsxs(u.Fragment,{children:[u.jsx("p",{className:"template-lead",children:s.description}),u.jsx("p",{className:"template-note",children:"Scaffolds an npm-install-ready TypeScript project with a starter agent in index.ts."})]}),u.jsx("p",{className:"template-handoff","data-testid":"template-handoff",children:s.kind==="gallery"?"Using it forks the template into a repo you own, then clones it here. Needs a signed-in Sapiom account; the coding agent asks you to sign in if it is missing.":"Scaffolds from the template bundled with the CLI. No Sapiom account or capability spend; setup may access npm."})]})}function D0({title:s,allLabel:t,allCount:n,options:r,value:l,onSelect:d,testIdPrefix:p}){if(r.length<2)return null;const c=[{value:"",label:t,count:n,testId:`${p}-all`,selects:null},...r.map(h=>({...h,testId:`${p}-${h.value}`,selects:h.value}))];return u.jsxs("div",{className:"facet",children:[u.jsx("span",{className:"facet-title",children:s}),u.jsx("div",{className:"facet-rows",role:"radiogroup","aria-label":s,children:c.map(h=>{const v=l===h.selects;return u.jsxs("button",{type:"button",role:"radio","aria-checked":v,className:v?"facet-row is-active":"facet-row","data-testid":h.testId,onClick:()=>d(h.selects),children:[u.jsx("span",{className:"facet-row-label",children:h.label}),u.jsx(eu,{variant:"count",children:h.count})]},h.testId)})})]})}function V3({catalog:s,filter:t,onChange:n}){return u.jsxs("div",{className:"template-filters","data-testid":"template-filters",children:[u.jsxs("div",{className:"template-search",children:[u.jsx(he,{name:"Search",size:14}),u.jsx("input",{className:"template-search-input",type:"search",value:t.query,placeholder:"Search templates","aria-label":"Search templates","data-testid":"template-search",onChange:r=>n({...t,query:r.target.value})})]}),u.jsx(D0,{title:"Category",allLabel:"All templates",allCount:s.length,options:z3(s),value:t.category,onSelect:r=>n({...t,category:r}),testIdPrefix:"templates-category"}),u.jsx(D0,{title:"Trigger",allLabel:"Any trigger",allCount:s.length,options:$3(s),value:t.cadence,onSelect:r=>n({...t,cadence:r}),testIdPrefix:"templates-cadence"})]})}function Y3(){return typeof window>"u"?void 0:window}function La(s=Y3()){const t=s==null?void 0:s.sapiomDesktop;if(!t||typeof t!="object")return null;const n=t;return typeof n.checkForUpdates!="function"?null:{appVersion:typeof n.appVersion=="string"?n.appVersion:"",checkForUpdates:n.checkForUpdates,chooseDirectory:typeof n.chooseDirectory=="function"?n.chooseDirectory:void 0,onDeepLink:typeof n.onDeepLink=="function"?n.onDeepLink:void 0,onUpdateState:typeof n.onUpdateState=="function"?n.onUpdateState:void 0}}function N1(s){switch(s.kind){case"available":return{text:`Downloading ${s.version}…`,tone:"info"};case"downloaded":return{text:`${s.version} is ready to install.`,tone:"action"};case"up-to-date":return{text:`Up to date (${s.version}, ${s.channel}).`,tone:"info"};case"no-release":return{text:`No ${s.channel} release published yet.`,tone:"info"};case"disabled":return{text:`Updates are off: ${s.reason}.`,tone:"error"};case"failed":return{text:`Couldn't check: ${s.message}`,tone:"error"}}}function L1({value:s,onChange:t,onSubmit:n,recentDirs:r,listDir:l,onNewDirChange:d,onResolve:p}){var z;const[c,h]=H.useState(s),[v,S]=H.useState([]),[f,x]=H.useState(s),[E,T]=H.useState(!1),[C,y]=H.useState(null),[b,m]=H.useState(0),[g,k]=H.useState(!0),[M,R]=H.useState(!1),[j,A]=H.useState(0),D=H.useRef(null),[I,q]=H.useState("none"),G=()=>{const W=D.current;if(!W)return;const Z=W.scrollLeft>2,ue=W.scrollLeft+W.clientWidth<W.scrollWidth-2;q(Z&&ue?"both":Z?"left":ue?"right":"none")};H.useEffect(()=>{G()},[r]),H.useEffect(()=>{let W=!1;T(!0),y(null),R(!1);const Z=setTimeout(()=>{l(s||void 0).then(ue=>{W||(h(ue.path),S(ue.dirs),x(ue.parent))}).catch(async()=>{const ue=b1(s);if(!ue||W){W||y("Couldn't read that directory.");return}try{const ge=await l(ue);if(W)return;h(ge.path),S(ge.dirs),x(ge.parent),R(!0)}catch{W||y("Couldn't read that directory.")}}).finally(()=>!W&&T(!1))},150);return()=>{W=!0,clearTimeout(Z)}},[s,j]);const U=W=>W.replace(/\\/g,"/"),X=U(s).startsWith(U(c))?s.slice(c.length).replace(/^[\\/]+/,""):"",se=X?v.filter(W=>W.name.toLowerCase().startsWith(X.toLowerCase())):v,F=Math.min(b,Math.max(se.length-1,0)),Q=!E&&!C&&se.length===0&&(M||X!=="");H.useEffect(()=>{d==null||d(Q)},[Q]),H.useEffect(()=>{E||C||p==null||p({resolvedPath:c,dirs:v,parent:f,isNew:Q})},[c,v,f,Q,E,C]);const J=W=>t(W),O=((z=La())==null?void 0:z.chooseDirectory)??null,B=()=>{if(O){O(s||c||void 0).then(W=>{W&&t(W)}).catch(()=>{});return}if(!g){k(!0);return}Q&&c&&c!==s?J(c):k(!1)},N=W=>{var ue;const Z=g&&se.length>0;W.key==="ArrowDown"&&Z?(W.preventDefault(),m(Math.min(F+1,se.length-1))):W.key==="ArrowUp"&&Z?(W.preventDefault(),m(Math.max(F-1,0))):W.key==="Enter"&&(Z?(J(((ue=se[F])==null?void 0:ue.path)??se[0].path),m(0)):n())};return u.jsxs("div",{className:"dir-picker",children:[u.jsxs("div",{className:"dir-picker-inputrow",children:[u.jsx("button",{type:"button",className:"dir-picker-up","data-testid":"dir-picker-up",disabled:f===c,onClick:()=>J(f),"aria-label":"Up to parent directory","data-tooltip":"Up to parent directory",children:u.jsx(he,{name:"CornerLeftUp",size:14})}),u.jsx("input",{id:"new-session-cwd",autoFocus:!0,"aria-label":"Workspace folder",className:"modal-input dir-picker-input","data-testid":"dir-picker-input",value:s,placeholder:"/path/to/workspace",onChange:W=>t(W.target.value),onKeyDown:N}),u.jsx("button",{type:"button",className:"dir-picker-up dir-picker-browse"+(!O&&g?" is-active":""),"data-testid":"dir-picker-browse","aria-pressed":O?void 0:g,onClick:B,"aria-label":O?"Choose a folder":"Browse subdirectories","data-tooltip":O?"Choose a folder…":g?Q?"Browse the nearest existing folder":"Hide the directory listing":"Browse subdirectories",children:u.jsx(he,{name:"Folder",size:14})})]}),r.length>0&&u.jsx("div",{className:"recent-dirs",ref:D,"data-fade":I,onScroll:G,children:r.map(W=>u.jsx("button",{type:"button",className:"recent-dir-chip",title:W,onClick:()=>J(W),children:Lk(W)},W))}),g&&u.jsxs("div",{className:"dir-picker-listing","data-testid":"dir-picker-listing",children:[u.jsx("div",{className:"dir-picker-path",children:c}),E&&u.jsx("div",{className:"dir-picker-empty",children:"Loading…"}),!E&&C&&u.jsxs("div",{className:"dir-picker-error","data-testid":"dir-picker-error",role:"alert",children:[u.jsx(he,{name:"TriangleAlert",size:14}),u.jsx("span",{children:C}),u.jsx("button",{type:"button",className:"btn-ghost dir-picker-retry","data-testid":"dir-picker-retry",onClick:()=>A(W=>W+1),children:"Retry"})]}),Q&&u.jsx("div",{className:"dir-picker-newdir","data-testid":"dir-picker-newdir",children:"New folder. It will be created when you start."}),!E&&!C&&!Q&&se.length===0&&u.jsx("div",{className:"dir-picker-empty",children:"No subdirectories"}),!E&&!C&&se.map((W,Z)=>u.jsxs("button",{type:"button",className:"dir-picker-item"+(Z===F?" is-selected":""),"data-testid":`dir-picker-item-${W.name}`,onMouseEnter:()=>m(Z),onClick:()=>J(W.path),children:[u.jsx(he,{name:"Folder",size:13}),u.jsx("span",{className:"dir-picker-item-name",children:W.name}),W.hasAgentProject&&u.jsxs("span",{className:"dir-picker-item-badge","data-testid":`dir-picker-badge-${W.name}`,title:"Contains sapiom.json",children:[u.jsx(he,{name:"Check",size:11}),"Agent"]})]},W.path))]})]})}function K3({template:s,initialDest:t,recentDirs:n,listDir:r,onCancel:l,onConfirm:d,triggerRef:p}){const[c,h]=H.useState(t),[v,S]=H.useState(!1),[f,x]=H.useState(null),E=H.useRef(null);xl(!v,{onDismiss:l,containerRef:E,triggerRef:p});const T=async()=>{const C=c.trim();if(!(!C||v)){S(!0),x(null);try{await d(C)}catch(y){x(y.message),S(!1)}}};return u.jsx("div",{className:"modal-backdrop",children:u.jsxs("div",{className:"modal modal-confirm modal-template-use",role:"dialog","aria-label":`Use ${s.name}`,"data-testid":"template-use-dialog",ref:E,children:[u.jsxs("div",{className:"modal-header",children:["Use ",s.name,u.jsx("button",{className:"theme-toggle modal-close","aria-label":"Close",title:"Close",disabled:v,onClick:l,children:u.jsx(he,{name:"X",size:14})})]}),u.jsxs("div",{className:"modal-body",children:[u.jsx(L1,{value:c,onChange:h,onSubmit:()=>void T(),recentDirs:n,listDir:r}),f?u.jsx("p",{className:"modal-error","data-testid":"template-use-error",children:f}):u.jsx("p",{className:"modal-field-hint",children:"A session starts here and sets the template up in it. A folder that does not exist yet is created."})]}),u.jsxs("div",{className:"modal-actions",children:[u.jsx("button",{className:"btn-ghost",disabled:v,onClick:l,children:"Cancel"}),u.jsx("button",{className:"btn-primary modal-primary-cta","data-testid":"template-use-confirm",disabled:v||!c.trim(),onClick:()=>void T(),children:v?"Starting…":"Start session"})]})]})})}function X3({projectRoot:s,recentDirs:t,listDir:n,onExit:r,onUse:l,listTemplates:d,getTemplate:p,openTemplateId:c}){const[h,v]=H.useState(null),[S,f]=H.useState(null),[x,E]=H.useState(A0),[T,C]=H.useState(null),[y,b]=H.useState(null),m=H.useRef(null);H.useEffect(()=>{let D=!1;return d().then(I=>{D||v(I)}).catch(I=>{D||f(I instanceof Error?I.message:String(I))}),()=>{D=!0}},[]);const g=H.useMemo(()=>((h==null?void 0:h.templates)??[]).map(D=>({...D,kind:"gallery"})),[h]),k=H.useMemo(()=>P3(g,x,S0),[g,x]),M=H.useMemo(()=>x.category!==null||x.cadence!==null?[]:uu.filter(D=>S0(D,x.query)),[x]),R=H.useRef(null);H.useEffect(()=>{if(!c||R.current===c)return;const D=g.find(I=>I.id===c)??uu.find(I=>I.id===c);D&&(R.current=c,C(D))},[c,g]);const j=h===null&&S===null,A=S?`Could not load the template gallery: ${S}`:!h||h.source==="live"?null:h.reason==="signed-out"?"Sign in to Sapiom to browse the template gallery. The bundled starters below remain available.":"The template gallery is unreachable right now. The bundled starters below remain available.";return u.jsxs("section",{className:"templates-panel","data-testid":"templates-panel","aria-label":"Templates",children:[u.jsxs("div",{className:"templates-bar",children:[u.jsx("button",{type:"button",className:"theme-toggle templates-back","data-testid":T?"template-detail-back":"templates-exit","aria-label":T?"Back to all templates":"Back to the session",title:T?"All templates":"Back to the session",onClick:()=>T?C(null):r(),children:u.jsx(he,{name:"ArrowLeft",size:14})}),u.jsx("span",{className:"templates-bar-title",children:T?T.name:"Templates"}),T&&u.jsx("button",{ref:m,type:"button",className:"btn-primary templates-bar-use","data-testid":"template-use-btn",onClick:()=>b(T),children:"Use template"})]}),u.jsx("div",{className:"templates-scroll",children:u.jsx("div",{className:"templates-measure",children:T?u.jsx(G3,{template:T,getTemplate:p}):u.jsxs(u.Fragment,{children:[u.jsxs("header",{className:"templates-hero",children:[u.jsx("h2",{className:"templates-hero-title",children:"Start from a template"}),u.jsx("p",{className:"templates-hero-copy",children:j?"Loading the catalog…":`${g.length} runnable agents. Open one to read what it does, then use it. A session starts in a new folder and sets it up for you.`})]}),A&&u.jsxs("div",{className:"templates-degraded","data-testid":"templates-degraded",role:"status",children:[u.jsx(he,{name:"TriangleAlert",size:14}),u.jsx("span",{children:A})]}),u.jsxs("div",{className:"templates-layout",children:[u.jsx(V3,{catalog:g,filter:x,onChange:E}),u.jsxs("div",{className:"templates-results",children:[k.length>0&&u.jsx("div",{className:"templates-grid","data-testid":"templates-grid",children:k.map(D=>u.jsx(j0,{template:D,onOpen:C,onUse:b},D.id))}),k.length===0&&!j&&g.length>0&&u.jsx(Bi,{className:"templates-empty",testId:"templates-empty",icon:"Search",title:"No template matches these filters",body:`Search a tag or a capability, or clear the filters to see all ${g.length}.`,cta:H3(x)?u.jsx("button",{type:"button",className:"btn-line","data-testid":"templates-empty-clear",onClick:()=>E(A0),children:"Clear filters"}):void 0}),M.length>0&&u.jsxs("section",{className:"templates-starters","data-testid":"templates-starters",children:[u.jsx("span",{className:"facet-title",children:"Bundled starters"}),u.jsx("p",{className:"templates-starters-copy",children:"Shipped with the CLI. No Sapiom account or capability spend; setup may access npm."}),u.jsx("div",{className:"templates-grid",children:M.map(D=>u.jsx(j0,{template:D,onOpen:C,onUse:b},D.id))})]})]})]})]})})}),y&&u.jsx(K3,{template:y,initialDest:o3(y,s),recentDirs:t,listDir:n,onCancel:()=>b(null),triggerRef:m,onConfirm:async D=>{await l(D,y),r()}})]})}var of={exports:{}},N0;function J3(){return N0||(N0=1,(function(s,t){(function(n,r){s.exports=r()})(globalThis,(()=>(()=>{var n={4567:function(p,c,h){var v=this&&this.__decorate||function(m,g,k,M){var R,j=arguments.length,A=j<3?g:M===null?M=Object.getOwnPropertyDescriptor(g,k):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(m,g,k,M);else for(var D=m.length-1;D>=0;D--)(R=m[D])&&(A=(j<3?R(A):j>3?R(g,k,A):R(g,k))||A);return j>3&&A&&Object.defineProperty(g,k,A),A},S=this&&this.__param||function(m,g){return function(k,M){g(k,M,m)}};Object.defineProperty(c,"__esModule",{value:!0}),c.AccessibilityManager=void 0;const f=h(9042),x=h(9924),E=h(844),T=h(4725),C=h(2585),y=h(3656);let b=c.AccessibilityManager=class extends E.Disposable{constructor(m,g,k,M){super(),this._terminal=m,this._coreBrowserService=k,this._renderService=M,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let R=0;R<this._terminal.rows;R++)this._rowElements[R]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[R]);if(this._topBoundaryFocusListener=R=>this._handleBoundaryFocus(R,0),this._bottomBoundaryFocusListener=R=>this._handleBoundaryFocus(R,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new x.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((R=>this._handleResize(R.rows)))),this.register(this._terminal.onRender((R=>this._refreshRows(R.start,R.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((R=>this._handleChar(R)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
|
|
461
|
-
`)))),this.register(this._terminal.onA11yTab((R=>this._handleTab(R)))),this.register(this._terminal.onKey((R=>this._handleKey(R.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,y.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,E.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(m){for(let g=0;g<m;g++)this._handleChar(" ")}_handleChar(m){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==m&&(this._charsToAnnounce+=m):this._charsToAnnounce+=m,m===`
|
|
462
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=f.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(m){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(m)||this._charsToConsume.push(m)}_refreshRows(m,g){this._liveRegionDebouncer.refresh(m,g,this._terminal.rows)}_renderRows(m,g){const k=this._terminal.buffer,M=k.lines.length.toString();for(let R=m;R<=g;R++){const j=k.lines.get(k.ydisp+R),A=[],D=(j==null?void 0:j.translateToString(!0,void 0,void 0,A))||"",I=(k.ydisp+R+1).toString(),q=this._rowElements[R];q&&(D.length===0?(q.innerText=" ",this._rowColumns.set(q,[0,1])):(q.textContent=D,this._rowColumns.set(q,A)),q.setAttribute("aria-posinset",I),q.setAttribute("aria-setsize",M))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(m,g){const k=m.target,M=this._rowElements[g===0?1:this._rowElements.length-2];if(k.getAttribute("aria-posinset")===(g===0?"1":`${this._terminal.buffer.lines.length}`)||m.relatedTarget!==M)return;let R,j;if(g===0?(R=k,j=this._rowElements.pop(),this._rowContainer.removeChild(j)):(R=this._rowElements.shift(),j=k,this._rowContainer.removeChild(R)),R.removeEventListener("focus",this._topBoundaryFocusListener),j.removeEventListener("focus",this._bottomBoundaryFocusListener),g===0){const A=this._createAccessibilityTreeNode();this._rowElements.unshift(A),this._rowContainer.insertAdjacentElement("afterbegin",A)}else{const A=this._createAccessibilityTreeNode();this._rowElements.push(A),this._rowContainer.appendChild(A)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(g===0?-1:1),this._rowElements[g===0?1:this._rowElements.length-2].focus(),m.preventDefault(),m.stopImmediatePropagation()}_handleSelectionChange(){var D;if(this._rowElements.length===0)return;const m=document.getSelection();if(!m)return;if(m.isCollapsed)return void(this._rowContainer.contains(m.anchorNode)&&this._terminal.clearSelection());if(!m.anchorNode||!m.focusNode)return void console.error("anchorNode and/or focusNode are null");let g={node:m.anchorNode,offset:m.anchorOffset},k={node:m.focusNode,offset:m.focusOffset};if((g.node.compareDocumentPosition(k.node)&Node.DOCUMENT_POSITION_PRECEDING||g.node===k.node&&g.offset>k.offset)&&([g,k]=[k,g]),g.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(g={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(g.node))return;const M=this._rowElements.slice(-1)[0];if(k.node.compareDocumentPosition(M)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(k={node:M,offset:((D=M.textContent)==null?void 0:D.length)??0}),!this._rowContainer.contains(k.node))return;const R=({node:I,offset:q})=>{const G=I instanceof Text?I.parentNode:I;let U=parseInt(G==null?void 0:G.getAttribute("aria-posinset"),10)-1;if(isNaN(U))return console.warn("row is invalid. Race condition?"),null;const X=this._rowColumns.get(G);if(!X)return console.warn("columns is null. Race condition?"),null;let se=q<X.length?X[q]:X.slice(-1)[0]+1;return se>=this._terminal.cols&&(++U,se=0),{row:U,column:se}},j=R(g),A=R(k);if(j&&A){if(j.row>A.row||j.row===A.row&&j.column>=A.column)throw new Error("invalid range");this._terminal.select(j.column,j.row,(A.row-j.row)*this._terminal.cols-j.column+A.column)}}_handleResize(m){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let g=this._rowContainer.children.length;g<this._terminal.rows;g++)this._rowElements[g]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[g]);for(;this._rowElements.length>m;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const m=this._coreBrowserService.mainDocument.createElement("div");return m.setAttribute("role","listitem"),m.tabIndex=-1,this._refreshRowDimensions(m),m}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let m=0;m<this._terminal.rows;m++)this._refreshRowDimensions(this._rowElements[m])}}_refreshRowDimensions(m){m.style.height=`${this._renderService.dimensions.css.cell.height}px`}};c.AccessibilityManager=b=v([S(1,C.IInstantiationService),S(2,T.ICoreBrowserService),S(3,T.IRenderService)],b)},3614:(p,c)=>{function h(x){return x.replace(/\r?\n/g,"\r")}function v(x,E){return E?"\x1B[200~"+x+"\x1B[201~":x}function S(x,E,T,C){x=v(x=h(x),T.decPrivateModes.bracketedPasteMode&&C.rawOptions.ignoreBracketedPasteMode!==!0),T.triggerDataEvent(x,!0),E.value=""}function f(x,E,T){const C=T.getBoundingClientRect(),y=x.clientX-C.left-10,b=x.clientY-C.top-10;E.style.width="20px",E.style.height="20px",E.style.left=`${y}px`,E.style.top=`${b}px`,E.style.zIndex="1000",E.focus()}Object.defineProperty(c,"__esModule",{value:!0}),c.rightClickHandler=c.moveTextAreaUnderMouseCursor=c.paste=c.handlePasteEvent=c.copyHandler=c.bracketTextForPaste=c.prepareTextForTerminal=void 0,c.prepareTextForTerminal=h,c.bracketTextForPaste=v,c.copyHandler=function(x,E){x.clipboardData&&x.clipboardData.setData("text/plain",E.selectionText),x.preventDefault()},c.handlePasteEvent=function(x,E,T,C){x.stopPropagation(),x.clipboardData&&S(x.clipboardData.getData("text/plain"),E,T,C)},c.paste=S,c.moveTextAreaUnderMouseCursor=f,c.rightClickHandler=function(x,E,T,C,y){f(x,E,T),y&&C.rightClickSelect(x),E.value=C.selectionText,E.select()}},7239:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ColorContrastCache=void 0;const v=h(1505);c.ColorContrastCache=class{constructor(){this._color=new v.TwoKeyMap,this._css=new v.TwoKeyMap}setCss(S,f,x){this._css.set(S,f,x)}getCss(S,f){return this._css.get(S,f)}setColor(S,f,x){this._color.set(S,f,x)}getColor(S,f){return this._color.get(S,f)}clear(){this._color.clear(),this._css.clear()}}},3656:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.addDisposableDomListener=void 0,c.addDisposableDomListener=function(h,v,S,f){h.addEventListener(v,S,f);let x=!1;return{dispose:()=>{x||(x=!0,h.removeEventListener(v,S,f))}}}},3551:function(p,c,h){var v=this&&this.__decorate||function(b,m,g,k){var M,R=arguments.length,j=R<3?m:k===null?k=Object.getOwnPropertyDescriptor(m,g):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(b,m,g,k);else for(var A=b.length-1;A>=0;A--)(M=b[A])&&(j=(R<3?M(j):R>3?M(m,g,j):M(m,g))||j);return R>3&&j&&Object.defineProperty(m,g,j),j},S=this&&this.__param||function(b,m){return function(g,k){m(g,k,b)}};Object.defineProperty(c,"__esModule",{value:!0}),c.Linkifier=void 0;const f=h(3656),x=h(8460),E=h(844),T=h(2585),C=h(4725);let y=c.Linkifier=class extends E.Disposable{get currentLink(){return this._currentLink}constructor(b,m,g,k,M){super(),this._element=b,this._mouseService=m,this._renderService=g,this._bufferService=k,this._linkProviderService=M,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new x.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new x.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,E.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,E.toDisposable)((()=>{var R;this._lastMouseEvent=void 0,(R=this._activeProviderReplies)==null||R.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,f.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,f.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,f.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,f.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(b){this._lastMouseEvent=b;const m=this._positionFromMouseEvent(b,this._element,this._mouseService);if(!m)return;this._isMouseOut=!1;const g=b.composedPath();for(let k=0;k<g.length;k++){const M=g[k];if(M.classList.contains("xterm"))break;if(M.classList.contains("xterm-hover"))return}this._lastBufferCell&&m.x===this._lastBufferCell.x&&m.y===this._lastBufferCell.y||(this._handleHover(m),this._lastBufferCell=m)}_handleHover(b){if(this._activeLine!==b.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(b,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,b)||(this._clearCurrentLink(),this._askForLink(b,!0))}_askForLink(b,m){var k,M;this._activeProviderReplies&&m||((k=this._activeProviderReplies)==null||k.forEach((R=>{R==null||R.forEach((j=>{j.link.dispose&&j.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=b.y);let g=!1;for(const[R,j]of this._linkProviderService.linkProviders.entries())m?(M=this._activeProviderReplies)!=null&&M.get(R)&&(g=this._checkLinkProviderResult(R,b,g)):j.provideLinks(b.y,(A=>{var I,q;if(this._isMouseOut)return;const D=A==null?void 0:A.map((G=>({link:G})));(I=this._activeProviderReplies)==null||I.set(R,D),g=this._checkLinkProviderResult(R,b,g),((q=this._activeProviderReplies)==null?void 0:q.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(b.y,this._activeProviderReplies)}))}_removeIntersectingLinks(b,m){const g=new Set;for(let k=0;k<m.size;k++){const M=m.get(k);if(M)for(let R=0;R<M.length;R++){const j=M[R],A=j.link.range.start.y<b?0:j.link.range.start.x,D=j.link.range.end.y>b?this._bufferService.cols:j.link.range.end.x;for(let I=A;I<=D;I++){if(g.has(I)){M.splice(R--,1);break}g.add(I)}}}}_checkLinkProviderResult(b,m,g){var R;if(!this._activeProviderReplies)return g;const k=this._activeProviderReplies.get(b);let M=!1;for(let j=0;j<b;j++)this._activeProviderReplies.has(j)&&!this._activeProviderReplies.get(j)||(M=!0);if(!M&&k){const j=k.find((A=>this._linkAtPosition(A.link,m)));j&&(g=!0,this._handleNewLink(j))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!g)for(let j=0;j<this._activeProviderReplies.size;j++){const A=(R=this._activeProviderReplies.get(j))==null?void 0:R.find((D=>this._linkAtPosition(D.link,m)));if(A){g=!0,this._handleNewLink(A);break}}return g}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(b){if(!this._currentLink)return;const m=this._positionFromMouseEvent(b,this._element,this._mouseService);m&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,m)&&this._currentLink.link.activate(b,this._currentLink.link.text)}_clearCurrentLink(b,m){this._currentLink&&this._lastMouseEvent&&(!b||!m||this._currentLink.link.range.start.y>=b&&this._currentLink.link.range.end.y<=m)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,E.disposeArray)(this._linkCacheDisposables))}_handleNewLink(b){if(!this._lastMouseEvent)return;const m=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);m&&this._linkAtPosition(b.link,m)&&(this._currentLink=b,this._currentLink.state={decorations:{underline:b.link.decorations===void 0||b.link.decorations.underline,pointerCursor:b.link.decorations===void 0||b.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,b.link,this._lastMouseEvent),b.link.decorations={},Object.defineProperties(b.link.decorations,{pointerCursor:{get:()=>{var g,k;return(k=(g=this._currentLink)==null?void 0:g.state)==null?void 0:k.decorations.pointerCursor},set:g=>{var k;(k=this._currentLink)!=null&&k.state&&this._currentLink.state.decorations.pointerCursor!==g&&(this._currentLink.state.decorations.pointerCursor=g,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",g))}},underline:{get:()=>{var g,k;return(k=(g=this._currentLink)==null?void 0:g.state)==null?void 0:k.decorations.underline},set:g=>{var k,M,R;(k=this._currentLink)!=null&&k.state&&((R=(M=this._currentLink)==null?void 0:M.state)==null?void 0:R.decorations.underline)!==g&&(this._currentLink.state.decorations.underline=g,this._currentLink.state.isHovered&&this._fireUnderlineEvent(b.link,g))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((g=>{if(!this._currentLink)return;const k=g.start===0?0:g.start+1+this._bufferService.buffer.ydisp,M=this._bufferService.buffer.ydisp+1+g.end;if(this._currentLink.link.range.start.y>=k&&this._currentLink.link.range.end.y<=M&&(this._clearCurrentLink(k,M),this._lastMouseEvent)){const R=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);R&&this._askForLink(R,!1)}}))))}_linkHover(b,m,g){var k;(k=this._currentLink)!=null&&k.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(m,!0),this._currentLink.state.decorations.pointerCursor&&b.classList.add("xterm-cursor-pointer")),m.hover&&m.hover(g,m.text)}_fireUnderlineEvent(b,m){const g=b.range,k=this._bufferService.buffer.ydisp,M=this._createLinkUnderlineEvent(g.start.x-1,g.start.y-k-1,g.end.x,g.end.y-k-1,void 0);(m?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(M)}_linkLeave(b,m,g){var k;(k=this._currentLink)!=null&&k.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(m,!1),this._currentLink.state.decorations.pointerCursor&&b.classList.remove("xterm-cursor-pointer")),m.leave&&m.leave(g,m.text)}_linkAtPosition(b,m){const g=b.range.start.y*this._bufferService.cols+b.range.start.x,k=b.range.end.y*this._bufferService.cols+b.range.end.x,M=m.y*this._bufferService.cols+m.x;return g<=M&&M<=k}_positionFromMouseEvent(b,m,g){const k=g.getCoords(b,m,this._bufferService.cols,this._bufferService.rows);if(k)return{x:k[0],y:k[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(b,m,g,k,M){return{x1:b,y1:m,x2:g,y2:k,cols:this._bufferService.cols,fg:M}}};c.Linkifier=y=v([S(1,C.IMouseService),S(2,C.IRenderService),S(3,T.IBufferService),S(4,C.ILinkProviderService)],y)},9042:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.tooMuchOutput=c.promptLabel=void 0,c.promptLabel="Terminal input",c.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(p,c,h){var v=this&&this.__decorate||function(C,y,b,m){var g,k=arguments.length,M=k<3?y:m===null?m=Object.getOwnPropertyDescriptor(y,b):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(C,y,b,m);else for(var R=C.length-1;R>=0;R--)(g=C[R])&&(M=(k<3?g(M):k>3?g(y,b,M):g(y,b))||M);return k>3&&M&&Object.defineProperty(y,b,M),M},S=this&&this.__param||function(C,y){return function(b,m){y(b,m,C)}};Object.defineProperty(c,"__esModule",{value:!0}),c.OscLinkProvider=void 0;const f=h(511),x=h(2585);let E=c.OscLinkProvider=class{constructor(C,y,b){this._bufferService=C,this._optionsService=y,this._oscLinkService=b}provideLinks(C,y){var D;const b=this._bufferService.buffer.lines.get(C-1);if(!b)return void y(void 0);const m=[],g=this._optionsService.rawOptions.linkHandler,k=new f.CellData,M=b.getTrimmedLength();let R=-1,j=-1,A=!1;for(let I=0;I<M;I++)if(j!==-1||b.hasContent(I)){if(b.loadCell(I,k),k.hasExtendedAttrs()&&k.extended.urlId){if(j===-1){j=I,R=k.extended.urlId;continue}A=k.extended.urlId!==R}else j!==-1&&(A=!0);if(A||j!==-1&&I===M-1){const q=(D=this._oscLinkService.getLinkData(R))==null?void 0:D.uri;if(q){const G={start:{x:j+1,y:C},end:{x:I+(A||I!==M-1?0:1),y:C}};let U=!1;if(!(g!=null&&g.allowNonHttpProtocols))try{const X=new URL(q);["http:","https:"].includes(X.protocol)||(U=!0)}catch{U=!0}U||m.push({text:q,range:G,activate:(X,se)=>g?g.activate(X,se,G):T(0,se),hover:(X,se)=>{var F;return(F=g==null?void 0:g.hover)==null?void 0:F.call(g,X,se,G)},leave:(X,se)=>{var F;return(F=g==null?void 0:g.leave)==null?void 0:F.call(g,X,se,G)}})}A=!1,k.hasExtendedAttrs()&&k.extended.urlId?(j=I,R=k.extended.urlId):(j=-1,R=-1)}}y(m)}};function T(C,y){if(confirm(`Do you want to navigate to ${y}?
|
|
463
|
-
|
|
464
|
-
WARNING: This link could potentially be dangerous`)){const b=window.open();if(b){try{b.opener=null}catch{}b.location.href=y}else console.warn("Opening link blocked as opener could not be cleared")}}c.OscLinkProvider=E=v([S(0,x.IBufferService),S(1,x.IOptionsService),S(2,x.IOscLinkService)],E)},6193:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.RenderDebouncer=void 0,c.RenderDebouncer=class{constructor(h,v){this._renderCallback=h,this._coreBrowserService=v,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(h){return this._refreshCallbacks.push(h),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(h,v,S){this._rowCount=S,h=h!==void 0?h:0,v=v!==void 0?v:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,h):h,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,v):v,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();const h=Math.max(this._rowStart,0),v=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(h,v),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const h of this._refreshCallbacks)h(0);this._refreshCallbacks=[]}}},3236:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Terminal=void 0;const v=h(3614),S=h(3656),f=h(3551),x=h(9042),E=h(3730),T=h(1680),C=h(3107),y=h(5744),b=h(2950),m=h(1296),g=h(428),k=h(4269),M=h(5114),R=h(8934),j=h(3230),A=h(9312),D=h(4725),I=h(6731),q=h(8055),G=h(8969),U=h(8460),X=h(844),se=h(6114),F=h(8437),Q=h(2584),J=h(7399),O=h(5941),B=h(9074),N=h(2585),z=h(5435),W=h(4567),Z=h(779);class ue extends G.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(Y={}){super(Y),this.browser=se,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new X.MutableDisposable),this._onCursorMove=this.register(new U.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new U.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new U.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new U.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new U.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new U.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new U.EventEmitter),this._onBlur=this.register(new U.EventEmitter),this._onA11yCharEmitter=this.register(new U.EventEmitter),this._onA11yTabEmitter=this.register(new U.EventEmitter),this._onWillOpen=this.register(new U.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(B.DecorationService),this._instantiationService.setService(N.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(Z.LinkProviderService),this._instantiationService.setService(D.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(E.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows((($,oe)=>this.refresh($,oe)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport(($=>this._reportWindowsOptions($)))),this.register(this._inputHandler.onColor(($=>this._handleColorEvent($)))),this.register((0,U.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,U.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,U.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,U.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize(($=>this._afterResize($.cols,$.rows)))),this.register((0,X.toDisposable)((()=>{var $,oe;this._customKeyEventHandler=void 0,(oe=($=this.element)==null?void 0:$.parentNode)==null||oe.removeChild(this.element)})))}_handleColorEvent(Y){if(this._themeService)for(const $ of Y){let oe,ae="";switch($.index){case 256:oe="foreground",ae="10";break;case 257:oe="background",ae="11";break;case 258:oe="cursor",ae="12";break;default:oe="ansi",ae="4;"+$.index}switch($.type){case 0:const xe=q.color.toColorRGB(oe==="ansi"?this._themeService.colors.ansi[$.index]:this._themeService.colors[oe]);this.coreService.triggerDataEvent(`${Q.C0.ESC}]${ae};${(0,O.toRgbString)(xe)}${Q.C1_ESCAPED.ST}`);break;case 1:if(oe==="ansi")this._themeService.modifyColors((Ee=>Ee.ansi[$.index]=q.channels.toColor(...$.color)));else{const Ee=oe;this._themeService.modifyColors((Ue=>Ue[Ee]=q.channels.toColor(...$.color)))}break;case 2:this._themeService.restoreColor($.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(Y){Y?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(W.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(Y){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Q.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var Y;return(Y=this.textarea)==null?void 0:Y.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Q.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const Y=this.buffer.ybase+this.buffer.y,$=this.buffer.lines.get(Y);if(!$)return;const oe=Math.min(this.buffer.x,this.cols-1),ae=this._renderService.dimensions.css.cell.height,xe=$.getWidth(oe),Ee=this._renderService.dimensions.css.cell.width*xe,Ue=this.buffer.y*this._renderService.dimensions.css.cell.height,Ye=oe*this._renderService.dimensions.css.cell.width;this.textarea.style.left=Ye+"px",this.textarea.style.top=Ue+"px",this.textarea.style.width=Ee+"px",this.textarea.style.height=ae+"px",this.textarea.style.lineHeight=ae+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,S.addDisposableDomListener)(this.element,"copy",($=>{this.hasSelection()&&(0,v.copyHandler)($,this._selectionService)})));const Y=$=>(0,v.handlePasteEvent)($,this.textarea,this.coreService,this.optionsService);this.register((0,S.addDisposableDomListener)(this.textarea,"paste",Y)),this.register((0,S.addDisposableDomListener)(this.element,"paste",Y)),se.isFirefox?this.register((0,S.addDisposableDomListener)(this.element,"mousedown",($=>{$.button===2&&(0,v.rightClickHandler)($,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,S.addDisposableDomListener)(this.element,"contextmenu",($=>{(0,v.rightClickHandler)($,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),se.isLinux&&this.register((0,S.addDisposableDomListener)(this.element,"auxclick",($=>{$.button===1&&(0,v.moveTextAreaUnderMouseCursor)($,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,S.addDisposableDomListener)(this.textarea,"keyup",(Y=>this._keyUp(Y)),!0)),this.register((0,S.addDisposableDomListener)(this.textarea,"keydown",(Y=>this._keyDown(Y)),!0)),this.register((0,S.addDisposableDomListener)(this.textarea,"keypress",(Y=>this._keyPress(Y)),!0)),this.register((0,S.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,S.addDisposableDomListener)(this.textarea,"compositionupdate",(Y=>this._compositionHelper.compositionupdate(Y)))),this.register((0,S.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,S.addDisposableDomListener)(this.textarea,"input",(Y=>this._inputEvent(Y)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(Y){var oe;if(!Y)throw new Error("Terminal requires a parent element.");if(Y.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((oe=this.element)==null?void 0:oe.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=Y.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),Y.appendChild(this.element);const $=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),$.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,S.addDisposableDomListener)(this.screenElement,"mousemove",(ae=>this.updateCursorStyle(ae)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),$.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",x.promptLabel),se.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(M.CoreBrowserService,this.textarea,Y.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(D.ICoreBrowserService,this._coreBrowserService),this.register((0,S.addDisposableDomListener)(this.textarea,"focus",(ae=>this._handleTextAreaFocus(ae)))),this.register((0,S.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(g.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(D.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(I.ThemeService),this._instantiationService.setService(D.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(k.CharacterJoinerService),this._instantiationService.setService(D.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(j.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(D.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((ae=>this._onRender.fire(ae)))),this.onResize((ae=>this._renderService.resize(ae.cols,ae.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(b.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(R.MouseService),this._instantiationService.setService(D.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(f.Linkifier,this.screenElement)),this.element.appendChild($);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(T.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((ae=>this.scrollLines(ae.amount,ae.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(A.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(D.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((ae=>this.scrollLines(ae.amount,ae.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((ae=>this._renderService.handleSelectionChanged(ae.start,ae.end,ae.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((ae=>{this.textarea.value=ae,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((ae=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,S.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(C.BufferDecorationRenderer,this.screenElement)),this.register((0,S.addDisposableDomListener)(this.element,"mousedown",(ae=>this._selectionService.handleMouseDown(ae)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(W.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(ae=>this._handleScreenReaderModeOptionChange(ae)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(y.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(ae=>{!this._overviewRulerRenderer&&ae&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(y.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(m.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const Y=this,$=this.element;function oe(Ee){const Ue=Y._mouseService.getMouseReportCoords(Ee,Y.screenElement);if(!Ue)return!1;let Ye,Ke;switch(Ee.overrideType||Ee.type){case"mousemove":Ke=32,Ee.buttons===void 0?(Ye=3,Ee.button!==void 0&&(Ye=Ee.button<3?Ee.button:3)):Ye=1&Ee.buttons?0:4&Ee.buttons?1:2&Ee.buttons?2:3;break;case"mouseup":Ke=0,Ye=Ee.button<3?Ee.button:3;break;case"mousedown":Ke=1,Ye=Ee.button<3?Ee.button:3;break;case"wheel":if(Y._customWheelEventHandler&&Y._customWheelEventHandler(Ee)===!1||Y.viewport.getLinesScrolled(Ee)===0)return!1;Ke=Ee.deltaY<0?0:1,Ye=4;break;default:return!1}return!(Ke===void 0||Ye===void 0||Ye>4)&&Y.coreMouseService.triggerMouseEvent({col:Ue.col,row:Ue.row,x:Ue.x,y:Ue.y,button:Ye,action:Ke,ctrl:Ee.ctrlKey,alt:Ee.altKey,shift:Ee.shiftKey})}const ae={mouseup:null,wheel:null,mousedrag:null,mousemove:null},xe={mouseup:Ee=>(oe(Ee),Ee.buttons||(this._document.removeEventListener("mouseup",ae.mouseup),ae.mousedrag&&this._document.removeEventListener("mousemove",ae.mousedrag)),this.cancel(Ee)),wheel:Ee=>(oe(Ee),this.cancel(Ee,!0)),mousedrag:Ee=>{Ee.buttons&&oe(Ee)},mousemove:Ee=>{Ee.buttons||oe(Ee)}};this.register(this.coreMouseService.onProtocolChange((Ee=>{Ee?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(Ee)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&Ee?ae.mousemove||($.addEventListener("mousemove",xe.mousemove),ae.mousemove=xe.mousemove):($.removeEventListener("mousemove",ae.mousemove),ae.mousemove=null),16&Ee?ae.wheel||($.addEventListener("wheel",xe.wheel,{passive:!1}),ae.wheel=xe.wheel):($.removeEventListener("wheel",ae.wheel),ae.wheel=null),2&Ee?ae.mouseup||(ae.mouseup=xe.mouseup):(this._document.removeEventListener("mouseup",ae.mouseup),ae.mouseup=null),4&Ee?ae.mousedrag||(ae.mousedrag=xe.mousedrag):(this._document.removeEventListener("mousemove",ae.mousedrag),ae.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,S.addDisposableDomListener)($,"mousedown",(Ee=>{if(Ee.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(Ee))return oe(Ee),ae.mouseup&&this._document.addEventListener("mouseup",ae.mouseup),ae.mousedrag&&this._document.addEventListener("mousemove",ae.mousedrag),this.cancel(Ee)}))),this.register((0,S.addDisposableDomListener)($,"wheel",(Ee=>{if(!ae.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(Ee)===!1)return!1;if(!this.buffer.hasScrollback){const Ue=this.viewport.getLinesScrolled(Ee);if(Ue===0)return;const Ye=Q.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(Ee.deltaY<0?"A":"B");let Ke="";for(let st=0;st<Math.abs(Ue);st++)Ke+=Ye;return this.coreService.triggerDataEvent(Ke,!0),this.cancel(Ee,!0)}return this.viewport.handleWheel(Ee)?this.cancel(Ee):void 0}}),{passive:!1})),this.register((0,S.addDisposableDomListener)($,"touchstart",(Ee=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(Ee),this.cancel(Ee)}),{passive:!0})),this.register((0,S.addDisposableDomListener)($,"touchmove",(Ee=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(Ee)?void 0:this.cancel(Ee)}),{passive:!1}))}refresh(Y,$){var oe;(oe=this._renderService)==null||oe.refreshRows(Y,$)}updateCursorStyle(Y){var $;($=this._selectionService)!=null&&$.shouldColumnSelect(Y)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(Y,$,oe=0){var ae;oe===1?(super.scrollLines(Y,$,oe),this.refresh(0,this.rows-1)):(ae=this.viewport)==null||ae.scrollLines(Y)}paste(Y){(0,v.paste)(Y,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(Y){this._customKeyEventHandler=Y}attachCustomWheelEventHandler(Y){this._customWheelEventHandler=Y}registerLinkProvider(Y){return this._linkProviderService.registerLinkProvider(Y)}registerCharacterJoiner(Y){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const $=this._characterJoinerService.register(Y);return this.refresh(0,this.rows-1),$}deregisterCharacterJoiner(Y){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(Y)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(Y){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+Y)}registerDecoration(Y){return this._decorationService.registerDecoration(Y)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(Y,$,oe){this._selectionService.setSelection(Y,$,oe)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var Y;(Y=this._selectionService)==null||Y.clearSelection()}selectAll(){var Y;(Y=this._selectionService)==null||Y.selectAll()}selectLines(Y,$){var oe;(oe=this._selectionService)==null||oe.selectLines(Y,$)}_keyDown(Y){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(Y)===!1)return!1;const $=this.browser.isMac&&this.options.macOptionIsMeta&&Y.altKey;if(!$&&!this._compositionHelper.keydown(Y))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;$||Y.key!=="Dead"&&Y.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const oe=(0,J.evaluateKeyboardEvent)(Y,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(Y),oe.type===3||oe.type===2){const ae=this.rows-1;return this.scrollLines(oe.type===2?-ae:ae),this.cancel(Y,!0)}return oe.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,Y)||(oe.cancel&&this.cancel(Y,!0),!oe.key||!!(Y.key&&!Y.ctrlKey&&!Y.altKey&&!Y.metaKey&&Y.key.length===1&&Y.key.charCodeAt(0)>=65&&Y.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(oe.key!==Q.C0.ETX&&oe.key!==Q.C0.CR||(this.textarea.value=""),this._onKey.fire({key:oe.key,domEvent:Y}),this._showCursor(),this.coreService.triggerDataEvent(oe.key,!0),!this.optionsService.rawOptions.screenReaderMode||Y.altKey||Y.ctrlKey?this.cancel(Y,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(Y,$){const oe=Y.isMac&&!this.options.macOptionIsMeta&&$.altKey&&!$.ctrlKey&&!$.metaKey||Y.isWindows&&$.altKey&&$.ctrlKey&&!$.metaKey||Y.isWindows&&$.getModifierState("AltGraph");return $.type==="keypress"?oe:oe&&(!$.keyCode||$.keyCode>47)}_keyUp(Y){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(Y)===!1||((function($){return $.keyCode===16||$.keyCode===17||$.keyCode===18})(Y)||this.focus(),this.updateCursorStyle(Y),this._keyPressHandled=!1)}_keyPress(Y){let $;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(Y)===!1)return!1;if(this.cancel(Y),Y.charCode)$=Y.charCode;else if(Y.which===null||Y.which===void 0)$=Y.keyCode;else{if(Y.which===0||Y.charCode===0)return!1;$=Y.which}return!(!$||(Y.altKey||Y.ctrlKey||Y.metaKey)&&!this._isThirdLevelShift(this.browser,Y)||($=String.fromCharCode($),this._onKey.fire({key:$,domEvent:Y}),this._showCursor(),this.coreService.triggerDataEvent($,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(Y){if(Y.data&&Y.inputType==="insertText"&&(!Y.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const $=Y.data;return this.coreService.triggerDataEvent($,!0),this.cancel(Y),!0}return!1}resize(Y,$){Y!==this.cols||$!==this.rows?super.resize(Y,$):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(Y,$){var oe,ae;(oe=this._charSizeService)==null||oe.measure(),(ae=this.viewport)==null||ae.syncScrollArea(!0)}clear(){var Y;if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let $=1;$<this.rows;$++)this.buffer.lines.push(this.buffer.getBlankLine(F.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(Y=this.viewport)==null||Y.reset(),this.refresh(0,this.rows-1)}}reset(){var $,oe;this.options.rows=this.rows,this.options.cols=this.cols;const Y=this._customKeyEventHandler;this._setup(),super.reset(),($=this._selectionService)==null||$.reset(),this._decorationService.reset(),(oe=this.viewport)==null||oe.reset(),this._customKeyEventHandler=Y,this.refresh(0,this.rows-1)}clearTextureAtlas(){var Y;(Y=this._renderService)==null||Y.clearTextureAtlas()}_reportFocus(){var Y;(Y=this.element)!=null&&Y.classList.contains("focus")?this.coreService.triggerDataEvent(Q.C0.ESC+"[I"):this.coreService.triggerDataEvent(Q.C0.ESC+"[O")}_reportWindowsOptions(Y){if(this._renderService)switch(Y){case z.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const $=this._renderService.dimensions.css.canvas.width.toFixed(0),oe=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${Q.C0.ESC}[4;${oe};${$}t`);break;case z.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const ae=this._renderService.dimensions.css.cell.width.toFixed(0),xe=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${Q.C0.ESC}[6;${xe};${ae}t`)}}cancel(Y,$){if(this.options.cancelEvents||$)return Y.preventDefault(),Y.stopPropagation(),!1}}c.Terminal=ue},9924:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.TimeBasedDebouncer=void 0,c.TimeBasedDebouncer=class{constructor(h,v=1e3){this._renderCallback=h,this._debounceThresholdMS=v,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(h,v,S){this._rowCount=S,h=h!==void 0?h:0,v=v!==void 0?v:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,h):h,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,v):v;const f=Date.now();if(f-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=f,this._innerRefresh();else if(!this._additionalRefreshRequested){const x=f-this._lastRefreshMs,E=this._debounceThresholdMS-x;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),E)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const h=Math.max(this._rowStart,0),v=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(h,v)}}},1680:function(p,c,h){var v=this&&this.__decorate||function(b,m,g,k){var M,R=arguments.length,j=R<3?m:k===null?k=Object.getOwnPropertyDescriptor(m,g):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(b,m,g,k);else for(var A=b.length-1;A>=0;A--)(M=b[A])&&(j=(R<3?M(j):R>3?M(m,g,j):M(m,g))||j);return R>3&&j&&Object.defineProperty(m,g,j),j},S=this&&this.__param||function(b,m){return function(g,k){m(g,k,b)}};Object.defineProperty(c,"__esModule",{value:!0}),c.Viewport=void 0;const f=h(3656),x=h(4725),E=h(8460),T=h(844),C=h(2585);let y=c.Viewport=class extends T.Disposable{constructor(b,m,g,k,M,R,j,A){super(),this._viewportElement=b,this._scrollArea=m,this._bufferService=g,this._optionsService=k,this._charSizeService=M,this._renderService=R,this._coreBrowserService=j,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new E.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,f.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((D=>this._activeBuffer=D.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((D=>this._renderDimensions=D))),this._handleThemeChange(A.colors),this.register(A.onChangeColors((D=>this._handleThemeChange(D)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(b){this._viewportElement.style.backgroundColor=b.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(b){if(b)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const m=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==m&&(this._lastRecordedBufferHeight=m,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const b=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==b&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=b),this._refreshAnimationFrame=null}syncScrollArea(b=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(b);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(b)}_handleScroll(b){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const m=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:m,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const b=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(b*(this._smoothScrollState.target-this._smoothScrollState.origin)),b<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(b,m){const g=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(m<0&&this._viewportElement.scrollTop!==0||m>0&&g<this._lastRecordedBufferHeight)||(b.cancelable&&b.preventDefault(),!1)}handleWheel(b){const m=this._getPixelsScrolled(b);return m!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+m:this._smoothScrollState.target+=m,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=m,this._bubbleScroll(b,m))}scrollLines(b){if(b!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const m=b*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+m,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:b,suppressScrollEvent:!1})}_getPixelsScrolled(b){if(b.deltaY===0||b.shiftKey)return 0;let m=this._applyScrollModifier(b.deltaY,b);return b.deltaMode===WheelEvent.DOM_DELTA_LINE?m*=this._currentRowHeight:b.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(m*=this._currentRowHeight*this._bufferService.rows),m}getBufferElements(b,m){var A;let g,k="";const M=[],R=m??this._bufferService.buffer.lines.length,j=this._bufferService.buffer.lines;for(let D=b;D<R;D++){const I=j.get(D);if(!I)continue;const q=(A=j.get(D+1))==null?void 0:A.isWrapped;if(k+=I.translateToString(!q),!q||D===j.length-1){const G=document.createElement("div");G.textContent=k,M.push(G),k.length>0&&(g=G),k=""}}return{bufferElements:M,cursorElement:g}}getLinesScrolled(b){if(b.deltaY===0||b.shiftKey)return 0;let m=this._applyScrollModifier(b.deltaY,b);return b.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(m/=this._currentRowHeight+0,this._wheelPartialScroll+=m,m=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):b.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(m*=this._bufferService.rows),m}_applyScrollModifier(b,m){const g=this._optionsService.rawOptions.fastScrollModifier;return g==="alt"&&m.altKey||g==="ctrl"&&m.ctrlKey||g==="shift"&&m.shiftKey?b*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:b*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(b){this._lastTouchY=b.touches[0].pageY}handleTouchMove(b){const m=this._lastTouchY-b.touches[0].pageY;return this._lastTouchY=b.touches[0].pageY,m!==0&&(this._viewportElement.scrollTop+=m,this._bubbleScroll(b,m))}};c.Viewport=y=v([S(2,C.IBufferService),S(3,C.IOptionsService),S(4,x.ICharSizeService),S(5,x.IRenderService),S(6,x.ICoreBrowserService),S(7,x.IThemeService)],y)},3107:function(p,c,h){var v=this&&this.__decorate||function(C,y,b,m){var g,k=arguments.length,M=k<3?y:m===null?m=Object.getOwnPropertyDescriptor(y,b):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(C,y,b,m);else for(var R=C.length-1;R>=0;R--)(g=C[R])&&(M=(k<3?g(M):k>3?g(y,b,M):g(y,b))||M);return k>3&&M&&Object.defineProperty(y,b,M),M},S=this&&this.__param||function(C,y){return function(b,m){y(b,m,C)}};Object.defineProperty(c,"__esModule",{value:!0}),c.BufferDecorationRenderer=void 0;const f=h(4725),x=h(844),E=h(2585);let T=c.BufferDecorationRenderer=class extends x.Disposable{constructor(C,y,b,m,g){super(),this._screenElement=C,this._bufferService=y,this._coreBrowserService=b,this._decorationService=m,this._renderService=g,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((k=>this._removeDecoration(k)))),this.register((0,x.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const C of this._decorationService.decorations)this._renderDecoration(C);this._dimensionsChanged=!1}_renderDecoration(C){this._refreshStyle(C),this._dimensionsChanged&&this._refreshXPosition(C)}_createElement(C){var m;const y=this._coreBrowserService.mainDocument.createElement("div");y.classList.add("xterm-decoration"),y.classList.toggle("xterm-decoration-top-layer",((m=C==null?void 0:C.options)==null?void 0:m.layer)==="top"),y.style.width=`${Math.round((C.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,y.style.height=(C.options.height||1)*this._renderService.dimensions.css.cell.height+"px",y.style.top=(C.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",y.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const b=C.options.x??0;return b&&b>this._bufferService.cols&&(y.style.display="none"),this._refreshXPosition(C,y),y}_refreshStyle(C){const y=C.marker.line-this._bufferService.buffers.active.ydisp;if(y<0||y>=this._bufferService.rows)C.element&&(C.element.style.display="none",C.onRenderEmitter.fire(C.element));else{let b=this._decorationElements.get(C);b||(b=this._createElement(C),C.element=b,this._decorationElements.set(C,b),this._container.appendChild(b),C.onDispose((()=>{this._decorationElements.delete(C),b.remove()}))),b.style.top=y*this._renderService.dimensions.css.cell.height+"px",b.style.display=this._altBufferIsActive?"none":"block",C.onRenderEmitter.fire(b)}}_refreshXPosition(C,y=C.element){if(!y)return;const b=C.options.x??0;(C.options.anchor||"left")==="right"?y.style.right=b?b*this._renderService.dimensions.css.cell.width+"px":"":y.style.left=b?b*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(C){var y;(y=this._decorationElements.get(C))==null||y.remove(),this._decorationElements.delete(C),C.dispose()}};c.BufferDecorationRenderer=T=v([S(1,E.IBufferService),S(2,f.ICoreBrowserService),S(3,E.IDecorationService),S(4,f.IRenderService)],T)},5871:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ColorZoneStore=void 0,c.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(h){if(h.options.overviewRulerOptions){for(const v of this._zones)if(v.color===h.options.overviewRulerOptions.color&&v.position===h.options.overviewRulerOptions.position){if(this._lineIntersectsZone(v,h.marker.line))return;if(this._lineAdjacentToZone(v,h.marker.line,h.options.overviewRulerOptions.position))return void this._addLineToZone(v,h.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=h.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=h.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=h.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=h.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:h.options.overviewRulerOptions.color,position:h.options.overviewRulerOptions.position,startBufferLine:h.marker.line,endBufferLine:h.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(h){this._linePadding=h}_lineIntersectsZone(h,v){return v>=h.startBufferLine&&v<=h.endBufferLine}_lineAdjacentToZone(h,v,S){return v>=h.startBufferLine-this._linePadding[S||"full"]&&v<=h.endBufferLine+this._linePadding[S||"full"]}_addLineToZone(h,v){h.startBufferLine=Math.min(h.startBufferLine,v),h.endBufferLine=Math.max(h.endBufferLine,v)}}},5744:function(p,c,h){var v=this&&this.__decorate||function(g,k,M,R){var j,A=arguments.length,D=A<3?k:R===null?R=Object.getOwnPropertyDescriptor(k,M):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(g,k,M,R);else for(var I=g.length-1;I>=0;I--)(j=g[I])&&(D=(A<3?j(D):A>3?j(k,M,D):j(k,M))||D);return A>3&&D&&Object.defineProperty(k,M,D),D},S=this&&this.__param||function(g,k){return function(M,R){k(M,R,g)}};Object.defineProperty(c,"__esModule",{value:!0}),c.OverviewRulerRenderer=void 0;const f=h(5871),x=h(4725),E=h(844),T=h(2585),C={full:0,left:0,center:0,right:0},y={full:0,left:0,center:0,right:0},b={full:0,left:0,center:0,right:0};let m=c.OverviewRulerRenderer=class extends E.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(g,k,M,R,j,A,D){var q;super(),this._viewportElement=g,this._screenElement=k,this._bufferService=M,this._decorationService=R,this._renderService=j,this._optionsService=A,this._coreBrowserService=D,this._colorZoneStore=new f.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(q=this._viewportElement.parentElement)==null||q.insertBefore(this._canvas,this._viewportElement);const I=this._canvas.getContext("2d");if(!I)throw new Error("Ctx cannot be null");this._ctx=I,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,E.toDisposable)((()=>{var G;(G=this._canvas)==null||G.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const g=Math.floor(this._canvas.width/3),k=Math.ceil(this._canvas.width/3);y.full=this._canvas.width,y.left=g,y.center=k,y.right=g,this._refreshDrawHeightConstants(),b.full=0,b.left=0,b.center=y.left,b.right=y.left+y.center}_refreshDrawHeightConstants(){C.full=Math.round(2*this._coreBrowserService.dpr);const g=this._canvas.height/this._bufferService.buffer.lines.length,k=Math.round(Math.max(Math.min(g,12),6)*this._coreBrowserService.dpr);C.left=k,C.center=k,C.right=k}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(const k of this._decorationService.decorations)this._colorZoneStore.addDecoration(k);this._ctx.lineWidth=1;const g=this._colorZoneStore.zones;for(const k of g)k.position!=="full"&&this._renderColorZone(k);for(const k of g)k.position==="full"&&this._renderColorZone(k);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(g){this._ctx.fillStyle=g.color,this._ctx.fillRect(b[g.position||"full"],Math.round((this._canvas.height-1)*(g.startBufferLine/this._bufferService.buffers.active.lines.length)-C[g.position||"full"]/2),y[g.position||"full"],Math.round((this._canvas.height-1)*((g.endBufferLine-g.startBufferLine)/this._bufferService.buffers.active.lines.length)+C[g.position||"full"]))}_queueRefresh(g,k){this._shouldUpdateDimensions=g||this._shouldUpdateDimensions,this._shouldUpdateAnchor=k||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};c.OverviewRulerRenderer=m=v([S(2,T.IBufferService),S(3,T.IDecorationService),S(4,x.IRenderService),S(5,T.IOptionsService),S(6,x.ICoreBrowserService)],m)},2950:function(p,c,h){var v=this&&this.__decorate||function(C,y,b,m){var g,k=arguments.length,M=k<3?y:m===null?m=Object.getOwnPropertyDescriptor(y,b):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(C,y,b,m);else for(var R=C.length-1;R>=0;R--)(g=C[R])&&(M=(k<3?g(M):k>3?g(y,b,M):g(y,b))||M);return k>3&&M&&Object.defineProperty(y,b,M),M},S=this&&this.__param||function(C,y){return function(b,m){y(b,m,C)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CompositionHelper=void 0;const f=h(4725),x=h(2585),E=h(2584);let T=c.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(C,y,b,m,g,k){this._textarea=C,this._compositionView=y,this._bufferService=b,this._optionsService=m,this._coreService=g,this._renderService=k,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(C){this._compositionView.textContent=C.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(C){if(this._isComposing||this._isSendingComposition){if(C.keyCode===229||C.keyCode===16||C.keyCode===17||C.keyCode===18)return!1;this._finalizeComposition(!1)}return C.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(C){if(this._compositionView.classList.remove("active"),this._isComposing=!1,C){const y={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let b;this._isSendingComposition=!1,y.start+=this._dataAlreadySent.length,b=this._isComposing?this._textarea.value.substring(y.start,y.end):this._textarea.value.substring(y.start),b.length>0&&this._coreService.triggerDataEvent(b,!0)}}),0)}else{this._isSendingComposition=!1;const y=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(y,!0)}}_handleAnyTextareaChanges(){const C=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const y=this._textarea.value,b=y.replace(C,"");this._dataAlreadySent=b,y.length>C.length?this._coreService.triggerDataEvent(b,!0):y.length<C.length?this._coreService.triggerDataEvent(`${E.C0.DEL}`,!0):y.length===C.length&&y!==C&&this._coreService.triggerDataEvent(y,!0)}}),0)}updateCompositionElements(C){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const y=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),b=this._renderService.dimensions.css.cell.height,m=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,g=y*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=g+"px",this._compositionView.style.top=m+"px",this._compositionView.style.height=b+"px",this._compositionView.style.lineHeight=b+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const k=this._compositionView.getBoundingClientRect();this._textarea.style.left=g+"px",this._textarea.style.top=m+"px",this._textarea.style.width=Math.max(k.width,1)+"px",this._textarea.style.height=Math.max(k.height,1)+"px",this._textarea.style.lineHeight=k.height+"px"}C||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};c.CompositionHelper=T=v([S(2,x.IBufferService),S(3,x.IOptionsService),S(4,x.ICoreService),S(5,f.IRenderService)],T)},9806:(p,c)=>{function h(v,S,f){const x=f.getBoundingClientRect(),E=v.getComputedStyle(f),T=parseInt(E.getPropertyValue("padding-left")),C=parseInt(E.getPropertyValue("padding-top"));return[S.clientX-x.left-T,S.clientY-x.top-C]}Object.defineProperty(c,"__esModule",{value:!0}),c.getCoords=c.getCoordsRelativeToElement=void 0,c.getCoordsRelativeToElement=h,c.getCoords=function(v,S,f,x,E,T,C,y,b){if(!T)return;const m=h(v,S,f);return m?(m[0]=Math.ceil((m[0]+(b?C/2:0))/C),m[1]=Math.ceil(m[1]/y),m[0]=Math.min(Math.max(m[0],1),x+(b?1:0)),m[1]=Math.min(Math.max(m[1],1),E),m):void 0}},9504:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.moveToCellSequence=void 0;const v=h(2584);function S(y,b,m,g){const k=y-f(y,m),M=b-f(b,m),R=Math.abs(k-M)-(function(j,A,D){let I=0;const q=j-f(j,D),G=A-f(A,D);for(let U=0;U<Math.abs(q-G);U++){const X=x(j,A)==="A"?-1:1,se=D.buffer.lines.get(q+X*U);se!=null&&se.isWrapped&&I++}return I})(y,b,m);return C(R,T(x(y,b),g))}function f(y,b){let m=0,g=b.buffer.lines.get(y),k=g==null?void 0:g.isWrapped;for(;k&&y>=0&&y<b.rows;)m++,g=b.buffer.lines.get(--y),k=g==null?void 0:g.isWrapped;return m}function x(y,b){return y>b?"A":"B"}function E(y,b,m,g,k,M){let R=y,j=b,A="";for(;R!==m||j!==g;)R+=k?1:-1,k&&R>M.cols-1?(A+=M.buffer.translateBufferLineToString(j,!1,y,R),R=0,y=0,j++):!k&&R<0&&(A+=M.buffer.translateBufferLineToString(j,!1,0,y+1),R=M.cols-1,y=R,j--);return A+M.buffer.translateBufferLineToString(j,!1,y,R)}function T(y,b){const m=b?"O":"[";return v.C0.ESC+m+y}function C(y,b){y=Math.floor(y);let m="";for(let g=0;g<y;g++)m+=b;return m}c.moveToCellSequence=function(y,b,m,g){const k=m.buffer.x,M=m.buffer.y;if(!m.buffer.hasScrollback)return(function(A,D,I,q,G,U){return S(D,q,G,U).length===0?"":C(E(A,D,A,D-f(D,G),!1,G).length,T("D",U))})(k,M,0,b,m,g)+S(M,b,m,g)+(function(A,D,I,q,G,U){let X;X=S(D,q,G,U).length>0?q-f(q,G):D;const se=q,F=(function(Q,J,O,B,N,z){let W;return W=S(O,B,N,z).length>0?B-f(B,N):J,Q<O&&W<=B||Q>=O&&W<B?"C":"D"})(A,D,I,q,G,U);return C(E(A,X,I,se,F==="C",G).length,T(F,U))})(k,M,y,b,m,g);let R;if(M===b)return R=k>y?"D":"C",C(Math.abs(k-y),T(R,g));R=M>b?"D":"C";const j=Math.abs(M-b);return C((function(A,D){return D.cols-A})(M>b?y:k,m)+(j-1)*m.cols+1+((M>b?k:y)-1),T(R,g))}},1296:function(p,c,h){var v=this&&this.__decorate||function(U,X,se,F){var Q,J=arguments.length,O=J<3?X:F===null?F=Object.getOwnPropertyDescriptor(X,se):F;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(U,X,se,F);else for(var B=U.length-1;B>=0;B--)(Q=U[B])&&(O=(J<3?Q(O):J>3?Q(X,se,O):Q(X,se))||O);return J>3&&O&&Object.defineProperty(X,se,O),O},S=this&&this.__param||function(U,X){return function(se,F){X(se,F,U)}};Object.defineProperty(c,"__esModule",{value:!0}),c.DomRenderer=void 0;const f=h(3787),x=h(2550),E=h(2223),T=h(6171),C=h(6052),y=h(4725),b=h(8055),m=h(8460),g=h(844),k=h(2585),M="xterm-dom-renderer-owner-",R="xterm-rows",j="xterm-fg-",A="xterm-bg-",D="xterm-focus",I="xterm-selection";let q=1,G=c.DomRenderer=class extends g.Disposable{constructor(U,X,se,F,Q,J,O,B,N,z,W,Z,ue){super(),this._terminal=U,this._document=X,this._element=se,this._screenElement=F,this._viewportElement=Q,this._helperContainer=J,this._linkifier2=O,this._charSizeService=N,this._optionsService=z,this._bufferService=W,this._coreBrowserService=Z,this._themeService=ue,this._terminalClass=q++,this._rowElements=[],this._selectionRenderModel=(0,C.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new m.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(R),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(I),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,T.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((ge=>this._injectCss(ge)))),this._injectCss(this._themeService.colors),this._rowFactory=B.createInstance(f.DomRendererRowFactory,document),this._element.classList.add(M+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((ge=>this._handleLinkHover(ge)))),this.register(this._linkifier2.onHideLinkUnderline((ge=>this._handleLinkLeave(ge)))),this.register((0,g.toDisposable)((()=>{this._element.classList.remove(M+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new x.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const U=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*U,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*U),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/U),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/U),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(const se of this._rowElements)se.style.width=`${this.dimensions.css.canvas.width}px`,se.style.height=`${this.dimensions.css.cell.height}px`,se.style.lineHeight=`${this.dimensions.css.cell.height}px`,se.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const X=`${this._terminalSelector} .${R} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=X,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(U){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let X=`${this._terminalSelector} .${R} { color: ${U.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;X+=`${this._terminalSelector} .${R} .xterm-dim { color: ${b.color.multiplyOpacity(U.foreground,.5).css};}`,X+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;const se=`blink_underline_${this._terminalClass}`,F=`blink_bar_${this._terminalClass}`,Q=`blink_block_${this._terminalClass}`;X+=`@keyframes ${se} { 50% { border-bottom-style: hidden; }}`,X+=`@keyframes ${F} { 50% { box-shadow: none; }}`,X+=`@keyframes ${Q} { 0% { background-color: ${U.cursor.css}; color: ${U.cursorAccent.css}; } 50% { background-color: inherit; color: ${U.cursor.css}; }}`,X+=`${this._terminalSelector} .${R}.${D} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${se} 1s step-end infinite;}${this._terminalSelector} .${R}.${D} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${F} 1s step-end infinite;}${this._terminalSelector} .${R}.${D} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${Q} 1s step-end infinite;}${this._terminalSelector} .${R} .xterm-cursor.xterm-cursor-block { background-color: ${U.cursor.css}; color: ${U.cursorAccent.css};}${this._terminalSelector} .${R} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${U.cursor.css} !important; color: ${U.cursorAccent.css} !important;}${this._terminalSelector} .${R} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${U.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${R} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${U.cursor.css} inset;}${this._terminalSelector} .${R} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${U.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,X+=`${this._terminalSelector} .${I} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${I} div { position: absolute; background-color: ${U.selectionBackgroundOpaque.css};}${this._terminalSelector} .${I} div { position: absolute; background-color: ${U.selectionInactiveBackgroundOpaque.css};}`;for(const[J,O]of U.ansi.entries())X+=`${this._terminalSelector} .${j}${J} { color: ${O.css}; }${this._terminalSelector} .${j}${J}.xterm-dim { color: ${b.color.multiplyOpacity(O,.5).css}; }${this._terminalSelector} .${A}${J} { background-color: ${O.css}; }`;X+=`${this._terminalSelector} .${j}${E.INVERTED_DEFAULT_COLOR} { color: ${b.color.opaque(U.background).css}; }${this._terminalSelector} .${j}${E.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${b.color.multiplyOpacity(b.color.opaque(U.background),.5).css}; }${this._terminalSelector} .${A}${E.INVERTED_DEFAULT_COLOR} { background-color: ${U.foreground.css}; }`,this._themeStyleElement.textContent=X}_setDefaultSpacing(){const U=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${U}px`,this._rowFactory.defaultSpacing=U}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(U,X){for(let se=this._rowElements.length;se<=X;se++){const F=this._document.createElement("div");this._rowContainer.appendChild(F),this._rowElements.push(F)}for(;this._rowElements.length>X;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(U,X){this._refreshRowElements(U,X),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(D),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(D),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(U,X,se){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(U,X,se),this.renderRows(0,this._bufferService.rows-1),!U||!X)return;this._selectionRenderModel.update(this._terminal,U,X,se);const F=this._selectionRenderModel.viewportStartRow,Q=this._selectionRenderModel.viewportEndRow,J=this._selectionRenderModel.viewportCappedStartRow,O=this._selectionRenderModel.viewportCappedEndRow;if(J>=this._bufferService.rows||O<0)return;const B=this._document.createDocumentFragment();if(se){const N=U[0]>X[0];B.appendChild(this._createSelectionElement(J,N?X[0]:U[0],N?U[0]:X[0],O-J+1))}else{const N=F===J?U[0]:0,z=J===Q?X[0]:this._bufferService.cols;B.appendChild(this._createSelectionElement(J,N,z));const W=O-J-1;if(B.appendChild(this._createSelectionElement(J+1,0,this._bufferService.cols,W)),J!==O){const Z=Q===O?X[0]:this._bufferService.cols;B.appendChild(this._createSelectionElement(O,0,Z))}}this._selectionContainer.appendChild(B)}_createSelectionElement(U,X,se,F=1){const Q=this._document.createElement("div"),J=X*this.dimensions.css.cell.width;let O=this.dimensions.css.cell.width*(se-X);return J+O>this.dimensions.css.canvas.width&&(O=this.dimensions.css.canvas.width-J),Q.style.height=F*this.dimensions.css.cell.height+"px",Q.style.top=U*this.dimensions.css.cell.height+"px",Q.style.left=`${J}px`,Q.style.width=`${O}px`,Q}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(const U of this._rowElements)U.replaceChildren()}renderRows(U,X){const se=this._bufferService.buffer,F=se.ybase+se.y,Q=Math.min(se.x,this._bufferService.cols-1),J=this._optionsService.rawOptions.cursorBlink,O=this._optionsService.rawOptions.cursorStyle,B=this._optionsService.rawOptions.cursorInactiveStyle;for(let N=U;N<=X;N++){const z=N+se.ydisp,W=this._rowElements[N],Z=se.lines.get(z);if(!W||!Z)break;W.replaceChildren(...this._rowFactory.createRow(Z,z,z===F,O,B,Q,J,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${M}${this._terminalClass}`}_handleLinkHover(U){this._setCellUnderline(U.x1,U.x2,U.y1,U.y2,U.cols,!0)}_handleLinkLeave(U){this._setCellUnderline(U.x1,U.x2,U.y1,U.y2,U.cols,!1)}_setCellUnderline(U,X,se,F,Q,J){se<0&&(U=0),F<0&&(X=0);const O=this._bufferService.rows-1;se=Math.max(Math.min(se,O),0),F=Math.max(Math.min(F,O),0),Q=Math.min(Q,this._bufferService.cols);const B=this._bufferService.buffer,N=B.ybase+B.y,z=Math.min(B.x,Q-1),W=this._optionsService.rawOptions.cursorBlink,Z=this._optionsService.rawOptions.cursorStyle,ue=this._optionsService.rawOptions.cursorInactiveStyle;for(let ge=se;ge<=F;++ge){const Y=ge+B.ydisp,$=this._rowElements[ge],oe=B.lines.get(Y);if(!$||!oe)break;$.replaceChildren(...this._rowFactory.createRow(oe,Y,Y===N,Z,ue,z,W,this.dimensions.css.cell.width,this._widthCache,J?ge===se?U:0:-1,J?(ge===F?X:Q)-1:-1))}}};c.DomRenderer=G=v([S(7,k.IInstantiationService),S(8,y.ICharSizeService),S(9,k.IOptionsService),S(10,k.IBufferService),S(11,y.ICoreBrowserService),S(12,y.IThemeService)],G)},3787:function(p,c,h){var v=this&&this.__decorate||function(R,j,A,D){var I,q=arguments.length,G=q<3?j:D===null?D=Object.getOwnPropertyDescriptor(j,A):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")G=Reflect.decorate(R,j,A,D);else for(var U=R.length-1;U>=0;U--)(I=R[U])&&(G=(q<3?I(G):q>3?I(j,A,G):I(j,A))||G);return q>3&&G&&Object.defineProperty(j,A,G),G},S=this&&this.__param||function(R,j){return function(A,D){j(A,D,R)}};Object.defineProperty(c,"__esModule",{value:!0}),c.DomRendererRowFactory=void 0;const f=h(2223),x=h(643),E=h(511),T=h(2585),C=h(8055),y=h(4725),b=h(4269),m=h(6171),g=h(3734);let k=c.DomRendererRowFactory=class{constructor(R,j,A,D,I,q,G){this._document=R,this._characterJoinerService=j,this._optionsService=A,this._coreBrowserService=D,this._coreService=I,this._decorationService=q,this._themeService=G,this._workCell=new E.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(R,j,A){this._selectionStart=R,this._selectionEnd=j,this._columnSelectMode=A}createRow(R,j,A,D,I,q,G,U,X,se,F){const Q=[],J=this._characterJoinerService.getJoinedCharacters(j),O=this._themeService.colors;let B,N=R.getNoBgTrimmedLength();A&&N<q+1&&(N=q+1);let z=0,W="",Z=0,ue=0,ge=0,Y=!1,$=0,oe=!1,ae=0;const xe=[],Ee=se!==-1&&F!==-1;for(let Ue=0;Ue<N;Ue++){R.loadCell(Ue,this._workCell);let Ye=this._workCell.getWidth();if(Ye===0)continue;let Ke=!1,st=Ue,Oe=this._workCell;if(J.length>0&&Ue===J[0][0]){Ke=!0;const nt=J.shift();Oe=new b.JoinedCellData(this._workCell,R.translateToString(!0,nt[0],nt[1]),nt[1]-nt[0]),st=nt[1]-1,Ye=Oe.getWidth()}const Dt=this._isCellInSelection(Ue,j),pt=A&&Ue===q,xt=Ee&&Ue>=se&&Ue<=F;let gt=!1;this._decorationService.forEachDecorationAtCell(Ue,j,void 0,(nt=>{gt=!0}));let ss=Oe.getChars()||x.WHITESPACE_CELL_CHAR;if(ss===" "&&(Oe.isUnderline()||Oe.isOverline())&&(ss=" "),ae=Ye*U-X.get(ss,Oe.isBold(),Oe.isItalic()),B){if(z&&(Dt&&oe||!Dt&&!oe&&Oe.bg===Z)&&(Dt&&oe&&O.selectionForeground||Oe.fg===ue)&&Oe.extended.ext===ge&&xt===Y&&ae===$&&!pt&&!Ke&&!gt){Oe.isInvisible()?W+=x.WHITESPACE_CELL_CHAR:W+=ss,z++;continue}z&&(B.textContent=W),B=this._document.createElement("span"),z=0,W=""}else B=this._document.createElement("span");if(Z=Oe.bg,ue=Oe.fg,ge=Oe.extended.ext,Y=xt,$=ae,oe=Dt,Ke&&q>=Ue&&q<=st&&(q=Ue),!this._coreService.isCursorHidden&&pt&&this._coreService.isCursorInitialized){if(xe.push("xterm-cursor"),this._coreBrowserService.isFocused)G&&xe.push("xterm-cursor-blink"),xe.push(D==="bar"?"xterm-cursor-bar":D==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(I)switch(I){case"outline":xe.push("xterm-cursor-outline");break;case"block":xe.push("xterm-cursor-block");break;case"bar":xe.push("xterm-cursor-bar");break;case"underline":xe.push("xterm-cursor-underline")}}if(Oe.isBold()&&xe.push("xterm-bold"),Oe.isItalic()&&xe.push("xterm-italic"),Oe.isDim()&&xe.push("xterm-dim"),W=Oe.isInvisible()?x.WHITESPACE_CELL_CHAR:Oe.getChars()||x.WHITESPACE_CELL_CHAR,Oe.isUnderline()&&(xe.push(`xterm-underline-${Oe.extended.underlineStyle}`),W===" "&&(W=" "),!Oe.isUnderlineColorDefault()))if(Oe.isUnderlineColorRGB())B.style.textDecorationColor=`rgb(${g.AttributeData.toColorRGB(Oe.getUnderlineColor()).join(",")})`;else{let nt=Oe.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Oe.isBold()&&nt<8&&(nt+=8),B.style.textDecorationColor=O.ansi[nt].css}Oe.isOverline()&&(xe.push("xterm-overline"),W===" "&&(W=" ")),Oe.isStrikethrough()&&xe.push("xterm-strikethrough"),xt&&(B.style.textDecoration="underline");let ht=Oe.getFgColor(),vt=Oe.getFgColorMode(),Ct=Oe.getBgColor(),$t=Oe.getBgColorMode();const ds=!!Oe.isInverse();if(ds){const nt=ht;ht=Ct,Ct=nt;const Cs=vt;vt=$t,$t=Cs}let mt,fs,$e,Ss=!1;switch(this._decorationService.forEachDecorationAtCell(Ue,j,void 0,(nt=>{nt.options.layer!=="top"&&Ss||(nt.backgroundColorRGB&&($t=50331648,Ct=nt.backgroundColorRGB.rgba>>8&16777215,mt=nt.backgroundColorRGB),nt.foregroundColorRGB&&(vt=50331648,ht=nt.foregroundColorRGB.rgba>>8&16777215,fs=nt.foregroundColorRGB),Ss=nt.options.layer==="top")})),!Ss&&Dt&&(mt=this._coreBrowserService.isFocused?O.selectionBackgroundOpaque:O.selectionInactiveBackgroundOpaque,Ct=mt.rgba>>8&16777215,$t=50331648,Ss=!0,O.selectionForeground&&(vt=50331648,ht=O.selectionForeground.rgba>>8&16777215,fs=O.selectionForeground)),Ss&&xe.push("xterm-decoration-top"),$t){case 16777216:case 33554432:$e=O.ansi[Ct],xe.push(`xterm-bg-${Ct}`);break;case 50331648:$e=C.channels.toColor(Ct>>16,Ct>>8&255,255&Ct),this._addStyle(B,`background-color:#${M((Ct>>>0).toString(16),"0",6)}`);break;default:ds?($e=O.foreground,xe.push(`xterm-bg-${f.INVERTED_DEFAULT_COLOR}`)):$e=O.background}switch(mt||Oe.isDim()&&(mt=C.color.multiplyOpacity($e,.5)),vt){case 16777216:case 33554432:Oe.isBold()&&ht<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ht+=8),this._applyMinimumContrast(B,$e,O.ansi[ht],Oe,mt,void 0)||xe.push(`xterm-fg-${ht}`);break;case 50331648:const nt=C.channels.toColor(ht>>16&255,ht>>8&255,255&ht);this._applyMinimumContrast(B,$e,nt,Oe,mt,fs)||this._addStyle(B,`color:#${M(ht.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(B,$e,O.foreground,Oe,mt,fs)||ds&&xe.push(`xterm-fg-${f.INVERTED_DEFAULT_COLOR}`)}xe.length&&(B.className=xe.join(" "),xe.length=0),pt||Ke||gt?B.textContent=W:z++,ae!==this.defaultSpacing&&(B.style.letterSpacing=`${ae}px`),Q.push(B),Ue=st}return B&&z&&(B.textContent=W),Q}_applyMinimumContrast(R,j,A,D,I,q){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,m.treatGlyphAsBackgroundColor)(D.getCode()))return!1;const G=this._getContrastCache(D);let U;if(I||q||(U=G.getColor(j.rgba,A.rgba)),U===void 0){const X=this._optionsService.rawOptions.minimumContrastRatio/(D.isDim()?2:1);U=C.color.ensureContrastRatio(I||j,q||A,X),G.setColor((I||j).rgba,(q||A).rgba,U??null)}return!!U&&(this._addStyle(R,`color:${U.css}`),!0)}_getContrastCache(R){return R.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(R,j){R.setAttribute("style",`${R.getAttribute("style")||""}${j};`)}_isCellInSelection(R,j){const A=this._selectionStart,D=this._selectionEnd;return!(!A||!D)&&(this._columnSelectMode?A[0]<=D[0]?R>=A[0]&&j>=A[1]&&R<D[0]&&j<=D[1]:R<A[0]&&j>=A[1]&&R>=D[0]&&j<=D[1]:j>A[1]&&j<D[1]||A[1]===D[1]&&j===A[1]&&R>=A[0]&&R<D[0]||A[1]<D[1]&&j===D[1]&&R<D[0]||A[1]<D[1]&&j===A[1]&&R>=A[0])}};function M(R,j,A){for(;R.length<A;)R=j+R;return R}c.DomRendererRowFactory=k=v([S(1,y.ICharacterJoinerService),S(2,T.IOptionsService),S(3,y.ICoreBrowserService),S(4,T.ICoreService),S(5,T.IDecorationService),S(6,y.IThemeService)],k)},2550:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.WidthCache=void 0,c.WidthCache=class{constructor(h,v){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=h.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const S=h.createElement("span");S.classList.add("xterm-char-measure-element");const f=h.createElement("span");f.classList.add("xterm-char-measure-element"),f.style.fontWeight="bold";const x=h.createElement("span");x.classList.add("xterm-char-measure-element"),x.style.fontStyle="italic";const E=h.createElement("span");E.classList.add("xterm-char-measure-element"),E.style.fontWeight="bold",E.style.fontStyle="italic",this._measureElements=[S,f,x,E],this._container.appendChild(S),this._container.appendChild(f),this._container.appendChild(x),this._container.appendChild(E),v.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(h,v,S,f){h===this._font&&v===this._fontSize&&S===this._weight&&f===this._weightBold||(this._font=h,this._fontSize=v,this._weight=S,this._weightBold=f,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${S}`,this._measureElements[1].style.fontWeight=`${f}`,this._measureElements[2].style.fontWeight=`${S}`,this._measureElements[3].style.fontWeight=`${f}`,this.clear())}get(h,v,S){let f=0;if(!v&&!S&&h.length===1&&(f=h.charCodeAt(0))<256){if(this._flat[f]!==-9999)return this._flat[f];const T=this._measure(h,0);return T>0&&(this._flat[f]=T),T}let x=h;v&&(x+="B"),S&&(x+="I");let E=this._holey.get(x);if(E===void 0){let T=0;v&&(T|=1),S&&(T|=2),E=this._measure(h,T),E>0&&this._holey.set(x,E)}return E}_measure(h,v){const S=this._measureElements[v];return S.textContent=h.repeat(32),S.offsetWidth/32}}},2223:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.TEXT_BASELINE=c.DIM_OPACITY=c.INVERTED_DEFAULT_COLOR=void 0;const v=h(6114);c.INVERTED_DEFAULT_COLOR=257,c.DIM_OPACITY=.5,c.TEXT_BASELINE=v.isFirefox||v.isLegacyEdge?"bottom":"ideographic"},6171:(p,c)=>{function h(S){return 57508<=S&&S<=57558}function v(S){return S>=128512&&S<=128591||S>=127744&&S<=128511||S>=128640&&S<=128767||S>=9728&&S<=9983||S>=9984&&S<=10175||S>=65024&&S<=65039||S>=129280&&S<=129535||S>=127462&&S<=127487}Object.defineProperty(c,"__esModule",{value:!0}),c.computeNextVariantOffset=c.createRenderDimensions=c.treatGlyphAsBackgroundColor=c.allowRescaling=c.isEmoji=c.isRestrictedPowerlineGlyph=c.isPowerlineGlyph=c.throwIfFalsy=void 0,c.throwIfFalsy=function(S){if(!S)throw new Error("value must not be falsy");return S},c.isPowerlineGlyph=h,c.isRestrictedPowerlineGlyph=function(S){return 57520<=S&&S<=57527},c.isEmoji=v,c.allowRescaling=function(S,f,x,E){return f===1&&x>Math.ceil(1.5*E)&&S!==void 0&&S>255&&!v(S)&&!h(S)&&!(function(T){return 57344<=T&&T<=63743})(S)},c.treatGlyphAsBackgroundColor=function(S){return h(S)||(function(f){return 9472<=f&&f<=9631})(S)},c.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},c.computeNextVariantOffset=function(S,f,x=0){return(S-(2*Math.round(f)-x))%(2*Math.round(f))}},6052:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createSelectionRenderModel=void 0;class h{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(S,f,x,E=!1){if(this.selectionStart=f,this.selectionEnd=x,!f||!x||f[0]===x[0]&&f[1]===x[1])return void this.clear();const T=S.buffers.active.ydisp,C=f[1]-T,y=x[1]-T,b=Math.max(C,0),m=Math.min(y,S.rows-1);b>=S.rows||m<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=E,this.viewportStartRow=C,this.viewportEndRow=y,this.viewportCappedStartRow=b,this.viewportCappedEndRow=m,this.startCol=f[0],this.endCol=x[0])}isCellSelected(S,f,x){return!!this.hasSelection&&(x-=S.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?f>=this.startCol&&x>=this.viewportCappedStartRow&&f<this.endCol&&x<=this.viewportCappedEndRow:f<this.startCol&&x>=this.viewportCappedStartRow&&f>=this.endCol&&x<=this.viewportCappedEndRow:x>this.viewportStartRow&&x<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&x===this.viewportStartRow&&f>=this.startCol&&f<this.endCol||this.viewportStartRow<this.viewportEndRow&&x===this.viewportEndRow&&f<this.endCol||this.viewportStartRow<this.viewportEndRow&&x===this.viewportStartRow&&f>=this.startCol)}}c.createSelectionRenderModel=function(){return new h}},456:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.SelectionModel=void 0,c.SelectionModel=class{constructor(h){this._bufferService=h,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const h=this.selectionStart[0]+this.selectionStartLength;return h>this._bufferService.cols?h%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(h/this._bufferService.cols)-1]:[h%this._bufferService.cols,this.selectionStart[1]+Math.floor(h/this._bufferService.cols)]:[h,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const h=this.selectionStart[0]+this.selectionStartLength;return h>this._bufferService.cols?[h%this._bufferService.cols,this.selectionStart[1]+Math.floor(h/this._bufferService.cols)]:[Math.max(h,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const h=this.selectionStart,v=this.selectionEnd;return!(!h||!v)&&(h[1]>v[1]||h[1]===v[1]&&h[0]>v[0])}handleTrim(h){return this.selectionStart&&(this.selectionStart[1]-=h),this.selectionEnd&&(this.selectionEnd[1]-=h),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(p,c,h){var v=this&&this.__decorate||function(m,g,k,M){var R,j=arguments.length,A=j<3?g:M===null?M=Object.getOwnPropertyDescriptor(g,k):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(m,g,k,M);else for(var D=m.length-1;D>=0;D--)(R=m[D])&&(A=(j<3?R(A):j>3?R(g,k,A):R(g,k))||A);return j>3&&A&&Object.defineProperty(g,k,A),A},S=this&&this.__param||function(m,g){return function(k,M){g(k,M,m)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CharSizeService=void 0;const f=h(2585),x=h(8460),E=h(844);let T=c.CharSizeService=class extends E.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(m,g,k){super(),this._optionsService=k,this.width=0,this.height=0,this._onCharSizeChange=this.register(new x.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new b(this._optionsService))}catch{this._measureStrategy=this.register(new y(m,g,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const m=this._measureStrategy.measure();m.width===this.width&&m.height===this.height||(this.width=m.width,this.height=m.height,this._onCharSizeChange.fire())}};c.CharSizeService=T=v([S(2,f.IOptionsService)],T);class C extends E.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(g,k){g!==void 0&&g>0&&k!==void 0&&k>0&&(this._result.width=g,this._result.height=k)}}class y extends C{constructor(g,k,M){super(),this._document=g,this._parentElement=k,this._optionsService=M,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class b extends C{constructor(g){super(),this._optionsService=g,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const k=this._ctx.measureText("W");if(!("width"in k&&"fontBoundingBoxAscent"in k&&"fontBoundingBoxDescent"in k))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const g=this._ctx.measureText("W");return this._validateAndSet(g.width,g.fontBoundingBoxAscent+g.fontBoundingBoxDescent),this._result}}},4269:function(p,c,h){var v=this&&this.__decorate||function(b,m,g,k){var M,R=arguments.length,j=R<3?m:k===null?k=Object.getOwnPropertyDescriptor(m,g):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(b,m,g,k);else for(var A=b.length-1;A>=0;A--)(M=b[A])&&(j=(R<3?M(j):R>3?M(m,g,j):M(m,g))||j);return R>3&&j&&Object.defineProperty(m,g,j),j},S=this&&this.__param||function(b,m){return function(g,k){m(g,k,b)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CharacterJoinerService=c.JoinedCellData=void 0;const f=h(3734),x=h(643),E=h(511),T=h(2585);class C extends f.AttributeData{constructor(m,g,k){super(),this.content=0,this.combinedData="",this.fg=m.fg,this.bg=m.bg,this.combinedData=g,this._width=k}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(m){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}c.JoinedCellData=C;let y=c.CharacterJoinerService=class O1{constructor(m){this._bufferService=m,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new E.CellData}register(m){const g={id:this._nextCharacterJoinerId++,handler:m};return this._characterJoiners.push(g),g.id}deregister(m){for(let g=0;g<this._characterJoiners.length;g++)if(this._characterJoiners[g].id===m)return this._characterJoiners.splice(g,1),!0;return!1}getJoinedCharacters(m){if(this._characterJoiners.length===0)return[];const g=this._bufferService.buffer.lines.get(m);if(!g||g.length===0)return[];const k=[],M=g.translateToString(!0);let R=0,j=0,A=0,D=g.getFg(0),I=g.getBg(0);for(let q=0;q<g.getTrimmedLength();q++)if(g.loadCell(q,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==D||this._workCell.bg!==I){if(q-R>1){const G=this._getJoinedRanges(M,A,j,g,R);for(let U=0;U<G.length;U++)k.push(G[U])}R=q,A=j,D=this._workCell.fg,I=this._workCell.bg}j+=this._workCell.getChars().length||x.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-R>1){const q=this._getJoinedRanges(M,A,j,g,R);for(let G=0;G<q.length;G++)k.push(q[G])}return k}_getJoinedRanges(m,g,k,M,R){const j=m.substring(g,k);let A=[];try{A=this._characterJoiners[0].handler(j)}catch(D){console.error(D)}for(let D=1;D<this._characterJoiners.length;D++)try{const I=this._characterJoiners[D].handler(j);for(let q=0;q<I.length;q++)O1._mergeRanges(A,I[q])}catch(I){console.error(I)}return this._stringRangesToCellRanges(A,M,R),A}_stringRangesToCellRanges(m,g,k){let M=0,R=!1,j=0,A=m[M];if(A){for(let D=k;D<this._bufferService.cols;D++){const I=g.getWidth(D),q=g.getString(D).length||x.WHITESPACE_CELL_CHAR.length;if(I!==0){if(!R&&A[0]<=j&&(A[0]=D,R=!0),A[1]<=j){if(A[1]=D,A=m[++M],!A)break;A[0]<=j?(A[0]=D,R=!0):R=!1}j+=q}}A&&(A[1]=this._bufferService.cols)}}static _mergeRanges(m,g){let k=!1;for(let M=0;M<m.length;M++){const R=m[M];if(k){if(g[1]<=R[0])return m[M-1][1]=g[1],m;if(g[1]<=R[1])return m[M-1][1]=Math.max(g[1],R[1]),m.splice(M,1),m;m.splice(M,1),M--}else{if(g[1]<=R[0])return m.splice(M,0,g),m;if(g[1]<=R[1])return R[0]=Math.min(g[0],R[0]),m;g[0]<R[1]&&(R[0]=Math.min(g[0],R[0]),k=!0)}}return k?m[m.length-1][1]=g[1]:m.push(g),m}};c.CharacterJoinerService=y=v([S(0,T.IBufferService)],y)},5114:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CoreBrowserService=void 0;const v=h(844),S=h(8460),f=h(3656);class x extends v.Disposable{constructor(C,y,b){super(),this._textarea=C,this._window=y,this.mainDocument=b,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new E(this._window),this._onDprChange=this.register(new S.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new S.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((m=>this._screenDprMonitor.setWindow(m)))),this.register((0,S.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get window(){return this._window}set window(C){this._window!==C&&(this._window=C,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}c.CoreBrowserService=x;class E extends v.Disposable{constructor(C){super(),this._parentWindow=C,this._windowResizeListener=this.register(new v.MutableDisposable),this._onDprChange=this.register(new S.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,v.toDisposable)((()=>this.clearListener())))}setWindow(C){this._parentWindow=C,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,f.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var C;this._outerListener&&((C=this._resolutionMediaMatchList)==null||C.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.LinkProviderService=void 0;const v=h(844);class S extends v.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,v.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(x){return this.linkProviders.push(x),{dispose:()=>{const E=this.linkProviders.indexOf(x);E!==-1&&this.linkProviders.splice(E,1)}}}}c.LinkProviderService=S},8934:function(p,c,h){var v=this&&this.__decorate||function(T,C,y,b){var m,g=arguments.length,k=g<3?C:b===null?b=Object.getOwnPropertyDescriptor(C,y):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(T,C,y,b);else for(var M=T.length-1;M>=0;M--)(m=T[M])&&(k=(g<3?m(k):g>3?m(C,y,k):m(C,y))||k);return g>3&&k&&Object.defineProperty(C,y,k),k},S=this&&this.__param||function(T,C){return function(y,b){C(y,b,T)}};Object.defineProperty(c,"__esModule",{value:!0}),c.MouseService=void 0;const f=h(4725),x=h(9806);let E=c.MouseService=class{constructor(T,C){this._renderService=T,this._charSizeService=C}getCoords(T,C,y,b,m){return(0,x.getCoords)(window,T,C,y,b,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,m)}getMouseReportCoords(T,C){const y=(0,x.getCoordsRelativeToElement)(window,T,C);if(this._charSizeService.hasValidSize)return y[0]=Math.min(Math.max(y[0],0),this._renderService.dimensions.css.canvas.width-1),y[1]=Math.min(Math.max(y[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(y[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(y[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(y[0]),y:Math.floor(y[1])}}};c.MouseService=E=v([S(0,f.IRenderService),S(1,f.ICharSizeService)],E)},3230:function(p,c,h){var v=this&&this.__decorate||function(m,g,k,M){var R,j=arguments.length,A=j<3?g:M===null?M=Object.getOwnPropertyDescriptor(g,k):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(m,g,k,M);else for(var D=m.length-1;D>=0;D--)(R=m[D])&&(A=(j<3?R(A):j>3?R(g,k,A):R(g,k))||A);return j>3&&A&&Object.defineProperty(g,k,A),A},S=this&&this.__param||function(m,g){return function(k,M){g(k,M,m)}};Object.defineProperty(c,"__esModule",{value:!0}),c.RenderService=void 0;const f=h(6193),x=h(4725),E=h(8460),T=h(844),C=h(7226),y=h(2585);let b=c.RenderService=class extends T.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(m,g,k,M,R,j,A,D){super(),this._rowCount=m,this._charSizeService=M,this._renderer=this.register(new T.MutableDisposable),this._pausedResizeTask=new C.DebouncedIdleTask,this._observerDisposable=this.register(new T.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new E.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new E.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new E.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new E.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new f.RenderDebouncer(((I,q)=>this._renderRows(I,q)),A),this.register(this._renderDebouncer),this.register(A.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(j.onResize((()=>this._fullRefresh()))),this.register(j.buffers.onBufferActivate((()=>{var I;return(I=this._renderer.value)==null?void 0:I.clear()}))),this.register(k.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(R.onDecorationRegistered((()=>this._fullRefresh()))),this.register(R.onDecorationRemoved((()=>this._fullRefresh()))),this.register(k.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(j.cols,j.rows),this._fullRefresh()}))),this.register(k.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(j.buffer.y,j.buffer.y,!0)))),this.register(D.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(A.window,g),this.register(A.onWindowChange((I=>this._registerIntersectionObserver(I,g))))}_registerIntersectionObserver(m,g){if("IntersectionObserver"in m){const k=new m.IntersectionObserver((M=>this._handleIntersectionChange(M[M.length-1])),{threshold:0});k.observe(g),this._observerDisposable.value=(0,T.toDisposable)((()=>k.disconnect()))}}_handleIntersectionChange(m){this._isPaused=m.isIntersecting===void 0?m.intersectionRatio===0:!m.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(m,g,k=!1){this._isPaused?this._needsFullRefresh=!0:(k||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(m,g,this._rowCount))}_renderRows(m,g){this._renderer.value&&(m=Math.min(m,this._rowCount-1),g=Math.min(g,this._rowCount-1),this._renderer.value.renderRows(m,g),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:m,end:g}),this._onRender.fire({start:m,end:g}),this._isNextRenderRedrawOnly=!0)}resize(m,g){this._rowCount=g,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(m){this._renderer.value=m,this._renderer.value&&(this._renderer.value.onRequestRedraw((g=>this.refreshRows(g.start,g.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(m){return this._renderDebouncer.addRefreshCallback(m)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var m,g;this._renderer.value&&((g=(m=this._renderer.value).clearTextureAtlas)==null||g.call(m),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(m,g){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var k;return(k=this._renderer.value)==null?void 0:k.handleResize(m,g)})):this._renderer.value.handleResize(m,g),this._fullRefresh())}handleCharSizeChanged(){var m;(m=this._renderer.value)==null||m.handleCharSizeChanged()}handleBlur(){var m;(m=this._renderer.value)==null||m.handleBlur()}handleFocus(){var m;(m=this._renderer.value)==null||m.handleFocus()}handleSelectionChanged(m,g,k){var M;this._selectionState.start=m,this._selectionState.end=g,this._selectionState.columnSelectMode=k,(M=this._renderer.value)==null||M.handleSelectionChanged(m,g,k)}handleCursorMove(){var m;(m=this._renderer.value)==null||m.handleCursorMove()}clear(){var m;(m=this._renderer.value)==null||m.clear()}};c.RenderService=b=v([S(2,y.IOptionsService),S(3,x.ICharSizeService),S(4,y.IDecorationService),S(5,y.IBufferService),S(6,x.ICoreBrowserService),S(7,x.IThemeService)],b)},9312:function(p,c,h){var v=this&&this.__decorate||function(A,D,I,q){var G,U=arguments.length,X=U<3?D:q===null?q=Object.getOwnPropertyDescriptor(D,I):q;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")X=Reflect.decorate(A,D,I,q);else for(var se=A.length-1;se>=0;se--)(G=A[se])&&(X=(U<3?G(X):U>3?G(D,I,X):G(D,I))||X);return U>3&&X&&Object.defineProperty(D,I,X),X},S=this&&this.__param||function(A,D){return function(I,q){D(I,q,A)}};Object.defineProperty(c,"__esModule",{value:!0}),c.SelectionService=void 0;const f=h(9806),x=h(9504),E=h(456),T=h(4725),C=h(8460),y=h(844),b=h(6114),m=h(4841),g=h(511),k=h(2585),M=" ",R=new RegExp(M,"g");let j=c.SelectionService=class extends y.Disposable{constructor(A,D,I,q,G,U,X,se,F){super(),this._element=A,this._screenElement=D,this._linkifier=I,this._bufferService=q,this._coreService=G,this._mouseService=U,this._optionsService=X,this._renderService=se,this._coreBrowserService=F,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new g.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new C.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new C.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new C.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new C.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=Q=>this._handleMouseMove(Q),this._mouseUpListener=Q=>this._handleMouseUp(Q),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((Q=>this._handleTrim(Q))),this.register(this._bufferService.buffers.onBufferActivate((Q=>this._handleBufferActivate(Q)))),this.enable(),this._model=new E.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,y.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const A=this._model.finalSelectionStart,D=this._model.finalSelectionEnd;return!(!A||!D||A[0]===D[0]&&A[1]===D[1])}get selectionText(){const A=this._model.finalSelectionStart,D=this._model.finalSelectionEnd;if(!A||!D)return"";const I=this._bufferService.buffer,q=[];if(this._activeSelectionMode===3){if(A[0]===D[0])return"";const G=A[0]<D[0]?A[0]:D[0],U=A[0]<D[0]?D[0]:A[0];for(let X=A[1];X<=D[1];X++){const se=I.translateBufferLineToString(X,!0,G,U);q.push(se)}}else{const G=A[1]===D[1]?D[0]:void 0;q.push(I.translateBufferLineToString(A[1],!0,A[0],G));for(let U=A[1]+1;U<=D[1]-1;U++){const X=I.lines.get(U),se=I.translateBufferLineToString(U,!0);X!=null&&X.isWrapped?q[q.length-1]+=se:q.push(se)}if(A[1]!==D[1]){const U=I.lines.get(D[1]),X=I.translateBufferLineToString(D[1],!0,0,D[0]);U&&U.isWrapped?q[q.length-1]+=X:q.push(X)}}return q.map((G=>G.replace(R," "))).join(b.isWindows?`\r
|
|
465
|
-
`:`
|
|
466
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(A){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),b.isLinux&&A&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(A){const D=this._getMouseBufferCoords(A),I=this._model.finalSelectionStart,q=this._model.finalSelectionEnd;return!!(I&&q&&D)&&this._areCoordsInSelection(D,I,q)}isCellInSelection(A,D){const I=this._model.finalSelectionStart,q=this._model.finalSelectionEnd;return!(!I||!q)&&this._areCoordsInSelection([A,D],I,q)}_areCoordsInSelection(A,D,I){return A[1]>D[1]&&A[1]<I[1]||D[1]===I[1]&&A[1]===D[1]&&A[0]>=D[0]&&A[0]<I[0]||D[1]<I[1]&&A[1]===I[1]&&A[0]<I[0]||D[1]<I[1]&&A[1]===D[1]&&A[0]>=D[0]}_selectWordAtCursor(A,D){var G,U;const I=(U=(G=this._linkifier.currentLink)==null?void 0:G.link)==null?void 0:U.range;if(I)return this._model.selectionStart=[I.start.x-1,I.start.y-1],this._model.selectionStartLength=(0,m.getRangeLength)(I,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const q=this._getMouseBufferCoords(A);return!!q&&(this._selectWordAt(q,D),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(A,D){this._model.clearSelection(),A=Math.max(A,0),D=Math.min(D,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,A],this._model.selectionEnd=[this._bufferService.cols,D],this.refresh(),this._onSelectionChange.fire()}_handleTrim(A){this._model.handleTrim(A)&&this.refresh()}_getMouseBufferCoords(A){const D=this._mouseService.getCoords(A,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(D)return D[0]--,D[1]--,D[1]+=this._bufferService.buffer.ydisp,D}_getMouseEventScrollAmount(A){let D=(0,f.getCoordsRelativeToElement)(this._coreBrowserService.window,A,this._screenElement)[1];const I=this._renderService.dimensions.css.canvas.height;return D>=0&&D<=I?0:(D>I&&(D-=I),D=Math.min(Math.max(D,-50),50),D/=50,D/Math.abs(D)+Math.round(14*D))}shouldForceSelection(A){return b.isMac?A.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:A.shiftKey}handleMouseDown(A){if(this._mouseDownTimeStamp=A.timeStamp,(A.button!==2||!this.hasSelection)&&A.button===0){if(!this._enabled){if(!this.shouldForceSelection(A))return;A.stopPropagation()}A.preventDefault(),this._dragScrollAmount=0,this._enabled&&A.shiftKey?this._handleIncrementalClick(A):A.detail===1?this._handleSingleClick(A):A.detail===2?this._handleDoubleClick(A):A.detail===3&&this._handleTripleClick(A),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval((()=>this._dragScroll()),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(A){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(A))}_handleSingleClick(A){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(A)?3:0,this._model.selectionStart=this._getMouseBufferCoords(A),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const D=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);D&&D.length!==this._model.selectionStart[0]&&D.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(A){this._selectWordAtCursor(A,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(A){const D=this._getMouseBufferCoords(A);D&&(this._activeSelectionMode=2,this._selectLineAt(D[1]))}shouldColumnSelect(A){return A.altKey&&!(b.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(A){if(A.stopImmediatePropagation(),!this._model.selectionStart)return;const D=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(A),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(A),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const I=this._bufferService.buffer;if(this._model.selectionEnd[1]<I.lines.length){const q=I.lines.get(this._model.selectionEnd[1]);q&&q.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}D&&D[0]===this._model.selectionEnd[0]&&D[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});const A=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(A.ydisp+this._bufferService.rows,A.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=A.ydisp),this.refresh()}}_handleMouseUp(A){const D=A.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&D<500&&A.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const I=this._mouseService.getCoords(A,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(I&&I[0]!==void 0&&I[1]!==void 0){const q=(0,x.moveToCellSequence)(I[0]-1,I[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(q,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const A=this._model.finalSelectionStart,D=this._model.finalSelectionEnd,I=!(!A||!D||A[0]===D[0]&&A[1]===D[1]);I?A&&D&&(this._oldSelectionStart&&this._oldSelectionEnd&&A[0]===this._oldSelectionStart[0]&&A[1]===this._oldSelectionStart[1]&&D[0]===this._oldSelectionEnd[0]&&D[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(A,D,I)):this._oldHasSelection&&this._fireOnSelectionChange(A,D,I)}_fireOnSelectionChange(A,D,I){this._oldSelectionStart=A,this._oldSelectionEnd=D,this._oldHasSelection=I,this._onSelectionChange.fire()}_handleBufferActivate(A){this.clearSelection(),this._trimListener.dispose(),this._trimListener=A.activeBuffer.lines.onTrim((D=>this._handleTrim(D)))}_convertViewportColToCharacterIndex(A,D){let I=D;for(let q=0;D>=q;q++){const G=A.loadCell(q,this._workCell).getChars().length;this._workCell.getWidth()===0?I--:G>1&&D!==q&&(I+=G-1)}return I}setSelection(A,D,I){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[A,D],this._model.selectionStartLength=I,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(A){this._isClickInSelection(A)||(this._selectWordAtCursor(A,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(A,D,I=!0,q=!0){if(A[0]>=this._bufferService.cols)return;const G=this._bufferService.buffer,U=G.lines.get(A[1]);if(!U)return;const X=G.translateBufferLineToString(A[1],!1);let se=this._convertViewportColToCharacterIndex(U,A[0]),F=se;const Q=A[0]-se;let J=0,O=0,B=0,N=0;if(X.charAt(se)===" "){for(;se>0&&X.charAt(se-1)===" ";)se--;for(;F<X.length&&X.charAt(F+1)===" ";)F++}else{let Z=A[0],ue=A[0];U.getWidth(Z)===0&&(J++,Z--),U.getWidth(ue)===2&&(O++,ue++);const ge=U.getString(ue).length;for(ge>1&&(N+=ge-1,F+=ge-1);Z>0&&se>0&&!this._isCharWordSeparator(U.loadCell(Z-1,this._workCell));){U.loadCell(Z-1,this._workCell);const Y=this._workCell.getChars().length;this._workCell.getWidth()===0?(J++,Z--):Y>1&&(B+=Y-1,se-=Y-1),se--,Z--}for(;ue<U.length&&F+1<X.length&&!this._isCharWordSeparator(U.loadCell(ue+1,this._workCell));){U.loadCell(ue+1,this._workCell);const Y=this._workCell.getChars().length;this._workCell.getWidth()===2?(O++,ue++):Y>1&&(N+=Y-1,F+=Y-1),F++,ue++}}F++;let z=se+Q-J+B,W=Math.min(this._bufferService.cols,F-se+J+O-B-N);if(D||X.slice(se,F).trim()!==""){if(I&&z===0&&U.getCodePoint(0)!==32){const Z=G.lines.get(A[1]-1);if(Z&&U.isWrapped&&Z.getCodePoint(this._bufferService.cols-1)!==32){const ue=this._getWordAt([this._bufferService.cols-1,A[1]-1],!1,!0,!1);if(ue){const ge=this._bufferService.cols-ue.start;z-=ge,W+=ge}}}if(q&&z+W===this._bufferService.cols&&U.getCodePoint(this._bufferService.cols-1)!==32){const Z=G.lines.get(A[1]+1);if(Z!=null&&Z.isWrapped&&Z.getCodePoint(0)!==32){const ue=this._getWordAt([0,A[1]+1],!1,!1,!0);ue&&(W+=ue.length)}}return{start:z,length:W}}}_selectWordAt(A,D){const I=this._getWordAt(A,D);if(I){for(;I.start<0;)I.start+=this._bufferService.cols,A[1]--;this._model.selectionStart=[I.start,A[1]],this._model.selectionStartLength=I.length}}_selectToWordAt(A){const D=this._getWordAt(A,!0);if(D){let I=A[1];for(;D.start<0;)D.start+=this._bufferService.cols,I--;if(!this._model.areSelectionValuesReversed())for(;D.start+D.length>this._bufferService.cols;)D.length-=this._bufferService.cols,I++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?D.start:D.start+D.length,I]}}_isCharWordSeparator(A){return A.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(A.getChars())>=0}_selectLineAt(A){const D=this._bufferService.buffer.getWrappedRangeForLine(A),I={start:{x:0,y:D.first},end:{x:this._bufferService.cols-1,y:D.last}};this._model.selectionStart=[0,D.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,m.getRangeLength)(I,this._bufferService.cols)}};c.SelectionService=j=v([S(3,k.IBufferService),S(4,k.ICoreService),S(5,T.IMouseService),S(6,k.IOptionsService),S(7,T.IRenderService),S(8,T.ICoreBrowserService)],j)},4725:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ILinkProviderService=c.IThemeService=c.ICharacterJoinerService=c.ISelectionService=c.IRenderService=c.IMouseService=c.ICoreBrowserService=c.ICharSizeService=void 0;const v=h(8343);c.ICharSizeService=(0,v.createDecorator)("CharSizeService"),c.ICoreBrowserService=(0,v.createDecorator)("CoreBrowserService"),c.IMouseService=(0,v.createDecorator)("MouseService"),c.IRenderService=(0,v.createDecorator)("RenderService"),c.ISelectionService=(0,v.createDecorator)("SelectionService"),c.ICharacterJoinerService=(0,v.createDecorator)("CharacterJoinerService"),c.IThemeService=(0,v.createDecorator)("ThemeService"),c.ILinkProviderService=(0,v.createDecorator)("LinkProviderService")},6731:function(p,c,h){var v=this&&this.__decorate||function(j,A,D,I){var q,G=arguments.length,U=G<3?A:I===null?I=Object.getOwnPropertyDescriptor(A,D):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")U=Reflect.decorate(j,A,D,I);else for(var X=j.length-1;X>=0;X--)(q=j[X])&&(U=(G<3?q(U):G>3?q(A,D,U):q(A,D))||U);return G>3&&U&&Object.defineProperty(A,D,U),U},S=this&&this.__param||function(j,A){return function(D,I){A(D,I,j)}};Object.defineProperty(c,"__esModule",{value:!0}),c.ThemeService=c.DEFAULT_ANSI_COLORS=void 0;const f=h(7239),x=h(8055),E=h(8460),T=h(844),C=h(2585),y=x.css.toColor("#ffffff"),b=x.css.toColor("#000000"),m=x.css.toColor("#ffffff"),g=x.css.toColor("#000000"),k={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};c.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const j=[x.css.toColor("#2e3436"),x.css.toColor("#cc0000"),x.css.toColor("#4e9a06"),x.css.toColor("#c4a000"),x.css.toColor("#3465a4"),x.css.toColor("#75507b"),x.css.toColor("#06989a"),x.css.toColor("#d3d7cf"),x.css.toColor("#555753"),x.css.toColor("#ef2929"),x.css.toColor("#8ae234"),x.css.toColor("#fce94f"),x.css.toColor("#729fcf"),x.css.toColor("#ad7fa8"),x.css.toColor("#34e2e2"),x.css.toColor("#eeeeec")],A=[0,95,135,175,215,255];for(let D=0;D<216;D++){const I=A[D/36%6|0],q=A[D/6%6|0],G=A[D%6];j.push({css:x.channels.toCss(I,q,G),rgba:x.channels.toRgba(I,q,G)})}for(let D=0;D<24;D++){const I=8+10*D;j.push({css:x.channels.toCss(I,I,I),rgba:x.channels.toRgba(I,I,I)})}return j})());let M=c.ThemeService=class extends T.Disposable{get colors(){return this._colors}constructor(j){super(),this._optionsService=j,this._contrastCache=new f.ColorContrastCache,this._halfContrastCache=new f.ColorContrastCache,this._onChangeColors=this.register(new E.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:y,background:b,cursor:m,cursorAccent:g,selectionForeground:void 0,selectionBackgroundTransparent:k,selectionBackgroundOpaque:x.color.blend(b,k),selectionInactiveBackgroundTransparent:k,selectionInactiveBackgroundOpaque:x.color.blend(b,k),ansi:c.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",(()=>this._contrastCache.clear()))),this.register(this._optionsService.onSpecificOptionChange("theme",(()=>this._setTheme(this._optionsService.rawOptions.theme))))}_setTheme(j={}){const A=this._colors;if(A.foreground=R(j.foreground,y),A.background=R(j.background,b),A.cursor=R(j.cursor,m),A.cursorAccent=R(j.cursorAccent,g),A.selectionBackgroundTransparent=R(j.selectionBackground,k),A.selectionBackgroundOpaque=x.color.blend(A.background,A.selectionBackgroundTransparent),A.selectionInactiveBackgroundTransparent=R(j.selectionInactiveBackground,A.selectionBackgroundTransparent),A.selectionInactiveBackgroundOpaque=x.color.blend(A.background,A.selectionInactiveBackgroundTransparent),A.selectionForeground=j.selectionForeground?R(j.selectionForeground,x.NULL_COLOR):void 0,A.selectionForeground===x.NULL_COLOR&&(A.selectionForeground=void 0),x.color.isOpaque(A.selectionBackgroundTransparent)&&(A.selectionBackgroundTransparent=x.color.opacity(A.selectionBackgroundTransparent,.3)),x.color.isOpaque(A.selectionInactiveBackgroundTransparent)&&(A.selectionInactiveBackgroundTransparent=x.color.opacity(A.selectionInactiveBackgroundTransparent,.3)),A.ansi=c.DEFAULT_ANSI_COLORS.slice(),A.ansi[0]=R(j.black,c.DEFAULT_ANSI_COLORS[0]),A.ansi[1]=R(j.red,c.DEFAULT_ANSI_COLORS[1]),A.ansi[2]=R(j.green,c.DEFAULT_ANSI_COLORS[2]),A.ansi[3]=R(j.yellow,c.DEFAULT_ANSI_COLORS[3]),A.ansi[4]=R(j.blue,c.DEFAULT_ANSI_COLORS[4]),A.ansi[5]=R(j.magenta,c.DEFAULT_ANSI_COLORS[5]),A.ansi[6]=R(j.cyan,c.DEFAULT_ANSI_COLORS[6]),A.ansi[7]=R(j.white,c.DEFAULT_ANSI_COLORS[7]),A.ansi[8]=R(j.brightBlack,c.DEFAULT_ANSI_COLORS[8]),A.ansi[9]=R(j.brightRed,c.DEFAULT_ANSI_COLORS[9]),A.ansi[10]=R(j.brightGreen,c.DEFAULT_ANSI_COLORS[10]),A.ansi[11]=R(j.brightYellow,c.DEFAULT_ANSI_COLORS[11]),A.ansi[12]=R(j.brightBlue,c.DEFAULT_ANSI_COLORS[12]),A.ansi[13]=R(j.brightMagenta,c.DEFAULT_ANSI_COLORS[13]),A.ansi[14]=R(j.brightCyan,c.DEFAULT_ANSI_COLORS[14]),A.ansi[15]=R(j.brightWhite,c.DEFAULT_ANSI_COLORS[15]),j.extendedAnsi){const D=Math.min(A.ansi.length-16,j.extendedAnsi.length);for(let I=0;I<D;I++)A.ansi[I+16]=R(j.extendedAnsi[I],c.DEFAULT_ANSI_COLORS[I+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(j){this._restoreColor(j),this._onChangeColors.fire(this.colors)}_restoreColor(j){if(j!==void 0)switch(j){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[j]=this._restoreColors.ansi[j]}else for(let A=0;A<this._restoreColors.ansi.length;++A)this._colors.ansi[A]=this._restoreColors.ansi[A]}modifyColors(j){j(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function R(j,A){if(j!==void 0)try{return x.css.toColor(j)}catch{}return A}c.ThemeService=M=v([S(0,C.IOptionsService)],M)},6349:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CircularList=void 0;const v=h(8460),S=h(844);class f extends S.Disposable{constructor(E){super(),this._maxLength=E,this.onDeleteEmitter=this.register(new v.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new v.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new v.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(E){if(this._maxLength===E)return;const T=new Array(E);for(let C=0;C<Math.min(E,this.length);C++)T[C]=this._array[this._getCyclicIndex(C)];this._array=T,this._maxLength=E,this._startIndex=0}get length(){return this._length}set length(E){if(E>this._length)for(let T=this._length;T<E;T++)this._array[T]=void 0;this._length=E}get(E){return this._array[this._getCyclicIndex(E)]}set(E,T){this._array[this._getCyclicIndex(E)]=T}push(E){this._array[this._getCyclicIndex(this._length)]=E,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(E,T,...C){if(T){for(let y=E;y<this._length-T;y++)this._array[this._getCyclicIndex(y)]=this._array[this._getCyclicIndex(y+T)];this._length-=T,this.onDeleteEmitter.fire({index:E,amount:T})}for(let y=this._length-1;y>=E;y--)this._array[this._getCyclicIndex(y+C.length)]=this._array[this._getCyclicIndex(y)];for(let y=0;y<C.length;y++)this._array[this._getCyclicIndex(E+y)]=C[y];if(C.length&&this.onInsertEmitter.fire({index:E,amount:C.length}),this._length+C.length>this._maxLength){const y=this._length+C.length-this._maxLength;this._startIndex+=y,this._length=this._maxLength,this.onTrimEmitter.fire(y)}else this._length+=C.length}trimStart(E){E>this._length&&(E=this._length),this._startIndex+=E,this._length-=E,this.onTrimEmitter.fire(E)}shiftElements(E,T,C){if(!(T<=0)){if(E<0||E>=this._length)throw new Error("start argument out of range");if(E+C<0)throw new Error("Cannot shift elements in list beyond index 0");if(C>0){for(let b=T-1;b>=0;b--)this.set(E+b+C,this.get(E+b));const y=E+T+C-this._length;if(y>0)for(this._length+=y;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let y=0;y<T;y++)this.set(E+y+C,this.get(E+y))}}_getCyclicIndex(E){return(this._startIndex+E)%this._maxLength}}c.CircularList=f},1439:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.clone=void 0,c.clone=function h(v,S=5){if(typeof v!="object")return v;const f=Array.isArray(v)?[]:{};for(const x in v)f[x]=S<=1?v[x]:v[x]&&h(v[x],S-1);return f}},8055:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.contrastRatio=c.toPaddedHex=c.rgba=c.rgb=c.css=c.color=c.channels=c.NULL_COLOR=void 0;let h=0,v=0,S=0,f=0;var x,E,T,C,y;function b(g){const k=g.toString(16);return k.length<2?"0"+k:k}function m(g,k){return g<k?(k+.05)/(g+.05):(g+.05)/(k+.05)}c.NULL_COLOR={css:"#00000000",rgba:0},(function(g){g.toCss=function(k,M,R,j){return j!==void 0?`#${b(k)}${b(M)}${b(R)}${b(j)}`:`#${b(k)}${b(M)}${b(R)}`},g.toRgba=function(k,M,R,j=255){return(k<<24|M<<16|R<<8|j)>>>0},g.toColor=function(k,M,R,j){return{css:g.toCss(k,M,R,j),rgba:g.toRgba(k,M,R,j)}}})(x||(c.channels=x={})),(function(g){function k(M,R){return f=Math.round(255*R),[h,v,S]=y.toChannels(M.rgba),{css:x.toCss(h,v,S,f),rgba:x.toRgba(h,v,S,f)}}g.blend=function(M,R){if(f=(255&R.rgba)/255,f===1)return{css:R.css,rgba:R.rgba};const j=R.rgba>>24&255,A=R.rgba>>16&255,D=R.rgba>>8&255,I=M.rgba>>24&255,q=M.rgba>>16&255,G=M.rgba>>8&255;return h=I+Math.round((j-I)*f),v=q+Math.round((A-q)*f),S=G+Math.round((D-G)*f),{css:x.toCss(h,v,S),rgba:x.toRgba(h,v,S)}},g.isOpaque=function(M){return(255&M.rgba)==255},g.ensureContrastRatio=function(M,R,j){const A=y.ensureContrastRatio(M.rgba,R.rgba,j);if(A)return x.toColor(A>>24&255,A>>16&255,A>>8&255)},g.opaque=function(M){const R=(255|M.rgba)>>>0;return[h,v,S]=y.toChannels(R),{css:x.toCss(h,v,S),rgba:R}},g.opacity=k,g.multiplyOpacity=function(M,R){return f=255&M.rgba,k(M,f*R/255)},g.toColorRGB=function(M){return[M.rgba>>24&255,M.rgba>>16&255,M.rgba>>8&255]}})(E||(c.color=E={})),(function(g){let k,M;try{const R=document.createElement("canvas");R.width=1,R.height=1;const j=R.getContext("2d",{willReadFrequently:!0});j&&(k=j,k.globalCompositeOperation="copy",M=k.createLinearGradient(0,0,1,1))}catch{}g.toColor=function(R){if(R.match(/#[\da-f]{3,8}/i))switch(R.length){case 4:return h=parseInt(R.slice(1,2).repeat(2),16),v=parseInt(R.slice(2,3).repeat(2),16),S=parseInt(R.slice(3,4).repeat(2),16),x.toColor(h,v,S);case 5:return h=parseInt(R.slice(1,2).repeat(2),16),v=parseInt(R.slice(2,3).repeat(2),16),S=parseInt(R.slice(3,4).repeat(2),16),f=parseInt(R.slice(4,5).repeat(2),16),x.toColor(h,v,S,f);case 7:return{css:R,rgba:(parseInt(R.slice(1),16)<<8|255)>>>0};case 9:return{css:R,rgba:parseInt(R.slice(1),16)>>>0}}const j=R.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(j)return h=parseInt(j[1]),v=parseInt(j[2]),S=parseInt(j[3]),f=Math.round(255*(j[5]===void 0?1:parseFloat(j[5]))),x.toColor(h,v,S,f);if(!k||!M)throw new Error("css.toColor: Unsupported css format");if(k.fillStyle=M,k.fillStyle=R,typeof k.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(k.fillRect(0,0,1,1),[h,v,S,f]=k.getImageData(0,0,1,1).data,f!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:x.toRgba(h,v,S,f),css:R}}})(T||(c.css=T={})),(function(g){function k(M,R,j){const A=M/255,D=R/255,I=j/255;return .2126*(A<=.03928?A/12.92:Math.pow((A+.055)/1.055,2.4))+.7152*(D<=.03928?D/12.92:Math.pow((D+.055)/1.055,2.4))+.0722*(I<=.03928?I/12.92:Math.pow((I+.055)/1.055,2.4))}g.relativeLuminance=function(M){return k(M>>16&255,M>>8&255,255&M)},g.relativeLuminance2=k})(C||(c.rgb=C={})),(function(g){function k(R,j,A){const D=R>>24&255,I=R>>16&255,q=R>>8&255;let G=j>>24&255,U=j>>16&255,X=j>>8&255,se=m(C.relativeLuminance2(G,U,X),C.relativeLuminance2(D,I,q));for(;se<A&&(G>0||U>0||X>0);)G-=Math.max(0,Math.ceil(.1*G)),U-=Math.max(0,Math.ceil(.1*U)),X-=Math.max(0,Math.ceil(.1*X)),se=m(C.relativeLuminance2(G,U,X),C.relativeLuminance2(D,I,q));return(G<<24|U<<16|X<<8|255)>>>0}function M(R,j,A){const D=R>>24&255,I=R>>16&255,q=R>>8&255;let G=j>>24&255,U=j>>16&255,X=j>>8&255,se=m(C.relativeLuminance2(G,U,X),C.relativeLuminance2(D,I,q));for(;se<A&&(G<255||U<255||X<255);)G=Math.min(255,G+Math.ceil(.1*(255-G))),U=Math.min(255,U+Math.ceil(.1*(255-U))),X=Math.min(255,X+Math.ceil(.1*(255-X))),se=m(C.relativeLuminance2(G,U,X),C.relativeLuminance2(D,I,q));return(G<<24|U<<16|X<<8|255)>>>0}g.blend=function(R,j){if(f=(255&j)/255,f===1)return j;const A=j>>24&255,D=j>>16&255,I=j>>8&255,q=R>>24&255,G=R>>16&255,U=R>>8&255;return h=q+Math.round((A-q)*f),v=G+Math.round((D-G)*f),S=U+Math.round((I-U)*f),x.toRgba(h,v,S)},g.ensureContrastRatio=function(R,j,A){const D=C.relativeLuminance(R>>8),I=C.relativeLuminance(j>>8);if(m(D,I)<A){if(I<D){const U=k(R,j,A),X=m(D,C.relativeLuminance(U>>8));if(X<A){const se=M(R,j,A);return X>m(D,C.relativeLuminance(se>>8))?U:se}return U}const q=M(R,j,A),G=m(D,C.relativeLuminance(q>>8));if(G<A){const U=k(R,j,A);return G>m(D,C.relativeLuminance(U>>8))?q:U}return q}},g.reduceLuminance=k,g.increaseLuminance=M,g.toChannels=function(R){return[R>>24&255,R>>16&255,R>>8&255,255&R]}})(y||(c.rgba=y={})),c.toPaddedHex=b,c.contrastRatio=m},8969:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CoreTerminal=void 0;const v=h(844),S=h(2585),f=h(4348),x=h(7866),E=h(744),T=h(7302),C=h(6975),y=h(8460),b=h(1753),m=h(1480),g=h(7994),k=h(9282),M=h(5435),R=h(5981),j=h(2660);let A=!1;class D extends v.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new y.EventEmitter),this._onScroll.event((q=>{var G;(G=this._onScrollApi)==null||G.fire(q.position)}))),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(q){for(const G in q)this.optionsService.options[G]=q[G]}constructor(q){super(),this._windowsWrappingHeuristics=this.register(new v.MutableDisposable),this._onBinary=this.register(new y.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new y.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new y.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new y.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new y.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new y.EventEmitter),this._instantiationService=new f.InstantiationService,this.optionsService=this.register(new T.OptionsService(q)),this._instantiationService.setService(S.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(E.BufferService)),this._instantiationService.setService(S.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(x.LogService)),this._instantiationService.setService(S.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(C.CoreService)),this._instantiationService.setService(S.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(b.CoreMouseService)),this._instantiationService.setService(S.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(m.UnicodeService)),this._instantiationService.setService(S.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(g.CharsetService),this._instantiationService.setService(S.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(j.OscLinkService),this._instantiationService.setService(S.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new M.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,y.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,y.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,y.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,y.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((G=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll((G=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new R.WriteBuffer(((G,U)=>this._inputHandler.parse(G,U)))),this.register((0,y.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(q,G){this._writeBuffer.write(q,G)}writeSync(q,G){this._logService.logLevel<=S.LogLevelEnum.WARN&&!A&&(this._logService.warn("writeSync is unreliable and will be removed soon."),A=!0),this._writeBuffer.writeSync(q,G)}input(q,G=!0){this.coreService.triggerDataEvent(q,G)}resize(q,G){isNaN(q)||isNaN(G)||(q=Math.max(q,E.MINIMUM_COLS),G=Math.max(G,E.MINIMUM_ROWS),this._bufferService.resize(q,G))}scroll(q,G=!1){this._bufferService.scroll(q,G)}scrollLines(q,G,U){this._bufferService.scrollLines(q,G,U)}scrollPages(q){this.scrollLines(q*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(q){const G=q-this._bufferService.buffer.ydisp;G!==0&&this.scrollLines(G)}registerEscHandler(q,G){return this._inputHandler.registerEscHandler(q,G)}registerDcsHandler(q,G){return this._inputHandler.registerDcsHandler(q,G)}registerCsiHandler(q,G){return this._inputHandler.registerCsiHandler(q,G)}registerOscHandler(q,G){return this._inputHandler.registerOscHandler(q,G)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let q=!1;const G=this.optionsService.rawOptions.windowsPty;G&&G.buildNumber!==void 0&&G.buildNumber!==void 0?q=G.backend==="conpty"&&G.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(q=!0),q?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const q=[];q.push(this.onLineFeed(k.updateWindowsModeWrappedState.bind(null,this._bufferService))),q.push(this.registerCsiHandler({final:"H"},(()=>((0,k.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,v.toDisposable)((()=>{for(const G of q)G.dispose()}))}}}c.CoreTerminal=D},8460:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.runAndSubscribe=c.forwardEvent=c.EventEmitter=void 0,c.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=h=>(this._listeners.push(h),{dispose:()=>{if(!this._disposed){for(let v=0;v<this._listeners.length;v++)if(this._listeners[v]===h)return void this._listeners.splice(v,1)}}})),this._event}fire(h,v){const S=[];for(let f=0;f<this._listeners.length;f++)S.push(this._listeners[f]);for(let f=0;f<S.length;f++)S[f].call(void 0,h,v)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},c.forwardEvent=function(h,v){return h((S=>v.fire(S)))},c.runAndSubscribe=function(h,v){return v(void 0),h((S=>v(S)))}},5435:function(p,c,h){var v=this&&this.__decorate||function(J,O,B,N){var z,W=arguments.length,Z=W<3?O:N===null?N=Object.getOwnPropertyDescriptor(O,B):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Z=Reflect.decorate(J,O,B,N);else for(var ue=J.length-1;ue>=0;ue--)(z=J[ue])&&(Z=(W<3?z(Z):W>3?z(O,B,Z):z(O,B))||Z);return W>3&&Z&&Object.defineProperty(O,B,Z),Z},S=this&&this.__param||function(J,O){return function(B,N){O(B,N,J)}};Object.defineProperty(c,"__esModule",{value:!0}),c.InputHandler=c.WindowsOptionsReportType=void 0;const f=h(2584),x=h(7116),E=h(2015),T=h(844),C=h(482),y=h(8437),b=h(8460),m=h(643),g=h(511),k=h(3734),M=h(2585),R=h(1480),j=h(6242),A=h(6351),D=h(5941),I={"(":0,")":1,"*":2,"+":3,"-":1,".":2},q=131072;function G(J,O){if(J>24)return O.setWinLines||!1;switch(J){case 1:return!!O.restoreWin;case 2:return!!O.minimizeWin;case 3:return!!O.setWinPosition;case 4:return!!O.setWinSizePixels;case 5:return!!O.raiseWin;case 6:return!!O.lowerWin;case 7:return!!O.refreshWin;case 8:return!!O.setWinSizeChars;case 9:return!!O.maximizeWin;case 10:return!!O.fullscreenWin;case 11:return!!O.getWinState;case 13:return!!O.getWinPosition;case 14:return!!O.getWinSizePixels;case 15:return!!O.getScreenSizePixels;case 16:return!!O.getCellSizePixels;case 18:return!!O.getWinSizeChars;case 19:return!!O.getScreenSizeChars;case 20:return!!O.getIconTitle;case 21:return!!O.getWinTitle;case 22:return!!O.pushTitle;case 23:return!!O.popTitle;case 24:return!!O.setWinLines}return!1}var U;(function(J){J[J.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",J[J.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(U||(c.WindowsOptionsReportType=U={}));let X=0;class se extends T.Disposable{getAttrData(){return this._curAttrData}constructor(O,B,N,z,W,Z,ue,ge,Y=new E.EscapeSequenceParser){super(),this._bufferService=O,this._charsetService=B,this._coreService=N,this._logService=z,this._optionsService=W,this._oscLinkService=Z,this._coreMouseService=ue,this._unicodeService=ge,this._parser=Y,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new C.StringToUtf32,this._utf8Decoder=new C.Utf8ToUtf32,this._workCell=new g.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=y.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=y.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new b.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new b.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new b.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new b.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new b.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new b.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new b.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new b.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new b.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new b.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new b.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new b.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new b.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new F(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(($=>this._activeBuffer=$.activeBuffer))),this._parser.setCsiHandlerFallback((($,oe)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString($),params:oe.toArray()})})),this._parser.setEscHandlerFallback(($=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString($)})})),this._parser.setExecuteHandlerFallback(($=>{this._logService.debug("Unknown EXECUTE code: ",{code:$})})),this._parser.setOscHandlerFallback((($,oe,ae)=>{this._logService.debug("Unknown OSC code: ",{identifier:$,action:oe,data:ae})})),this._parser.setDcsHandlerFallback((($,oe,ae)=>{oe==="HOOK"&&(ae=ae.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString($),action:oe,payload:ae})})),this._parser.setPrintHandler((($,oe,ae)=>this.print($,oe,ae))),this._parser.registerCsiHandler({final:"@"},($=>this.insertChars($))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},($=>this.scrollLeft($))),this._parser.registerCsiHandler({final:"A"},($=>this.cursorUp($))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},($=>this.scrollRight($))),this._parser.registerCsiHandler({final:"B"},($=>this.cursorDown($))),this._parser.registerCsiHandler({final:"C"},($=>this.cursorForward($))),this._parser.registerCsiHandler({final:"D"},($=>this.cursorBackward($))),this._parser.registerCsiHandler({final:"E"},($=>this.cursorNextLine($))),this._parser.registerCsiHandler({final:"F"},($=>this.cursorPrecedingLine($))),this._parser.registerCsiHandler({final:"G"},($=>this.cursorCharAbsolute($))),this._parser.registerCsiHandler({final:"H"},($=>this.cursorPosition($))),this._parser.registerCsiHandler({final:"I"},($=>this.cursorForwardTab($))),this._parser.registerCsiHandler({final:"J"},($=>this.eraseInDisplay($,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},($=>this.eraseInDisplay($,!0))),this._parser.registerCsiHandler({final:"K"},($=>this.eraseInLine($,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},($=>this.eraseInLine($,!0))),this._parser.registerCsiHandler({final:"L"},($=>this.insertLines($))),this._parser.registerCsiHandler({final:"M"},($=>this.deleteLines($))),this._parser.registerCsiHandler({final:"P"},($=>this.deleteChars($))),this._parser.registerCsiHandler({final:"S"},($=>this.scrollUp($))),this._parser.registerCsiHandler({final:"T"},($=>this.scrollDown($))),this._parser.registerCsiHandler({final:"X"},($=>this.eraseChars($))),this._parser.registerCsiHandler({final:"Z"},($=>this.cursorBackwardTab($))),this._parser.registerCsiHandler({final:"`"},($=>this.charPosAbsolute($))),this._parser.registerCsiHandler({final:"a"},($=>this.hPositionRelative($))),this._parser.registerCsiHandler({final:"b"},($=>this.repeatPrecedingCharacter($))),this._parser.registerCsiHandler({final:"c"},($=>this.sendDeviceAttributesPrimary($))),this._parser.registerCsiHandler({prefix:">",final:"c"},($=>this.sendDeviceAttributesSecondary($))),this._parser.registerCsiHandler({final:"d"},($=>this.linePosAbsolute($))),this._parser.registerCsiHandler({final:"e"},($=>this.vPositionRelative($))),this._parser.registerCsiHandler({final:"f"},($=>this.hVPosition($))),this._parser.registerCsiHandler({final:"g"},($=>this.tabClear($))),this._parser.registerCsiHandler({final:"h"},($=>this.setMode($))),this._parser.registerCsiHandler({prefix:"?",final:"h"},($=>this.setModePrivate($))),this._parser.registerCsiHandler({final:"l"},($=>this.resetMode($))),this._parser.registerCsiHandler({prefix:"?",final:"l"},($=>this.resetModePrivate($))),this._parser.registerCsiHandler({final:"m"},($=>this.charAttributes($))),this._parser.registerCsiHandler({final:"n"},($=>this.deviceStatus($))),this._parser.registerCsiHandler({prefix:"?",final:"n"},($=>this.deviceStatusPrivate($))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},($=>this.softReset($))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},($=>this.setCursorStyle($))),this._parser.registerCsiHandler({final:"r"},($=>this.setScrollRegion($))),this._parser.registerCsiHandler({final:"s"},($=>this.saveCursor($))),this._parser.registerCsiHandler({final:"t"},($=>this.windowOptions($))),this._parser.registerCsiHandler({final:"u"},($=>this.restoreCursor($))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},($=>this.insertColumns($))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},($=>this.deleteColumns($))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},($=>this.selectProtected($))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},($=>this.requestMode($,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},($=>this.requestMode($,!1))),this._parser.setExecuteHandler(f.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(f.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(f.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(f.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(f.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(f.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(f.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(f.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(f.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(f.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(f.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(f.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new j.OscHandler(($=>(this.setTitle($),this.setIconName($),!0)))),this._parser.registerOscHandler(1,new j.OscHandler(($=>this.setIconName($)))),this._parser.registerOscHandler(2,new j.OscHandler(($=>this.setTitle($)))),this._parser.registerOscHandler(4,new j.OscHandler(($=>this.setOrReportIndexedColor($)))),this._parser.registerOscHandler(8,new j.OscHandler(($=>this.setHyperlink($)))),this._parser.registerOscHandler(10,new j.OscHandler(($=>this.setOrReportFgColor($)))),this._parser.registerOscHandler(11,new j.OscHandler(($=>this.setOrReportBgColor($)))),this._parser.registerOscHandler(12,new j.OscHandler(($=>this.setOrReportCursorColor($)))),this._parser.registerOscHandler(104,new j.OscHandler(($=>this.restoreIndexedColor($)))),this._parser.registerOscHandler(110,new j.OscHandler(($=>this.restoreFgColor($)))),this._parser.registerOscHandler(111,new j.OscHandler(($=>this.restoreBgColor($)))),this._parser.registerOscHandler(112,new j.OscHandler(($=>this.restoreCursorColor($)))),this._parser.registerEscHandler({final:"7"},(()=>this.saveCursor())),this._parser.registerEscHandler({final:"8"},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:"D"},(()=>this.index())),this._parser.registerEscHandler({final:"E"},(()=>this.nextLine())),this._parser.registerEscHandler({final:"H"},(()=>this.tabSet())),this._parser.registerEscHandler({final:"M"},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:"="},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:">"},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:"c"},(()=>this.fullReset())),this._parser.registerEscHandler({final:"n"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"o"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"|"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"}"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"~"},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:"%",final:"@"},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:"%",final:"G"},(()=>this.selectDefaultCharset()));for(const $ in x.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:$},(()=>this.selectCharset("("+$))),this._parser.registerEscHandler({intermediates:")",final:$},(()=>this.selectCharset(")"+$))),this._parser.registerEscHandler({intermediates:"*",final:$},(()=>this.selectCharset("*"+$))),this._parser.registerEscHandler({intermediates:"+",final:$},(()=>this.selectCharset("+"+$))),this._parser.registerEscHandler({intermediates:"-",final:$},(()=>this.selectCharset("-"+$))),this._parser.registerEscHandler({intermediates:".",final:$},(()=>this.selectCharset("."+$))),this._parser.registerEscHandler({intermediates:"/",final:$},(()=>this.selectCharset("/"+$)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler(($=>(this._logService.error("Parsing error: ",$),$))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new A.DcsHandler((($,oe)=>this.requestStatusString($,oe))))}_preserveStack(O,B,N,z){this._parseStack.paused=!0,this._parseStack.cursorStartX=O,this._parseStack.cursorStartY=B,this._parseStack.decodedLength=N,this._parseStack.position=z}_logSlowResolvingAsync(O){this._logService.logLevel<=M.LogLevelEnum.WARN&&Promise.race([O,new Promise(((B,N)=>setTimeout((()=>N("#SLOW_TIMEOUT")),5e3)))]).catch((B=>{if(B!=="#SLOW_TIMEOUT")throw B;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(O,B){let N,z=this._activeBuffer.x,W=this._activeBuffer.y,Z=0;const ue=this._parseStack.paused;if(ue){if(N=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,B))return this._logSlowResolvingAsync(N),N;z=this._parseStack.cursorStartX,W=this._parseStack.cursorStartY,this._parseStack.paused=!1,O.length>q&&(Z=this._parseStack.position+q)}if(this._logService.logLevel<=M.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof O=="string"?` "${O}"`:` "${Array.prototype.map.call(O,($=>String.fromCharCode($))).join("")}"`),typeof O=="string"?O.split("").map(($=>$.charCodeAt(0))):O),this._parseBuffer.length<O.length&&this._parseBuffer.length<q&&(this._parseBuffer=new Uint32Array(Math.min(O.length,q))),ue||this._dirtyRowTracker.clearRange(),O.length>q)for(let $=Z;$<O.length;$+=q){const oe=$+q<O.length?$+q:O.length,ae=typeof O=="string"?this._stringDecoder.decode(O.substring($,oe),this._parseBuffer):this._utf8Decoder.decode(O.subarray($,oe),this._parseBuffer);if(N=this._parser.parse(this._parseBuffer,ae))return this._preserveStack(z,W,ae,$),this._logSlowResolvingAsync(N),N}else if(!ue){const $=typeof O=="string"?this._stringDecoder.decode(O,this._parseBuffer):this._utf8Decoder.decode(O,this._parseBuffer);if(N=this._parser.parse(this._parseBuffer,$))return this._preserveStack(z,W,$,0),this._logSlowResolvingAsync(N),N}this._activeBuffer.x===z&&this._activeBuffer.y===W||this._onCursorMove.fire();const ge=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),Y=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);Y<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(Y,this._bufferService.rows-1),Math.min(ge,this._bufferService.rows-1))}print(O,B,N){let z,W;const Z=this._charsetService.charset,ue=this._optionsService.rawOptions.screenReaderMode,ge=this._bufferService.cols,Y=this._coreService.decPrivateModes.wraparound,$=this._coreService.modes.insertMode,oe=this._curAttrData;let ae=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&N-B>0&&ae.getWidth(this._activeBuffer.x-1)===2&&ae.setCellFromCodepoint(this._activeBuffer.x-1,0,1,oe);let xe=this._parser.precedingJoinState;for(let Ee=B;Ee<N;++Ee){if(z=O[Ee],z<127&&Z){const st=Z[String.fromCharCode(z)];st&&(z=st.charCodeAt(0))}const Ue=this._unicodeService.charProperties(z,xe);W=R.UnicodeService.extractWidth(Ue);const Ye=R.UnicodeService.extractShouldJoin(Ue),Ke=Ye?R.UnicodeService.extractWidth(xe):0;if(xe=Ue,ue&&this._onA11yChar.fire((0,C.stringFromCodePoint)(z)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+W-Ke>ge){if(Y){const st=ae;let Oe=this._activeBuffer.x-Ke;for(this._activeBuffer.x=Ke,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),ae=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),Ke>0&&ae instanceof y.BufferLine&&ae.copyCellsFrom(st,Oe,0,Ke,!1);Oe<ge;)st.setCellFromCodepoint(Oe++,0,1,oe)}else if(this._activeBuffer.x=ge-1,W===2)continue}if(Ye&&this._activeBuffer.x){const st=ae.getWidth(this._activeBuffer.x-1)?1:2;ae.addCodepointToCell(this._activeBuffer.x-st,z,W);for(let Oe=W-Ke;--Oe>=0;)ae.setCellFromCodepoint(this._activeBuffer.x++,0,0,oe)}else if($&&(ae.insertCells(this._activeBuffer.x,W-Ke,this._activeBuffer.getNullCell(oe)),ae.getWidth(ge-1)===2&&ae.setCellFromCodepoint(ge-1,m.NULL_CELL_CODE,m.NULL_CELL_WIDTH,oe)),ae.setCellFromCodepoint(this._activeBuffer.x++,z,W,oe),W>0)for(;--W;)ae.setCellFromCodepoint(this._activeBuffer.x++,0,0,oe)}this._parser.precedingJoinState=xe,this._activeBuffer.x<ge&&N-B>0&&ae.getWidth(this._activeBuffer.x)===0&&!ae.hasContent(this._activeBuffer.x)&&ae.setCellFromCodepoint(this._activeBuffer.x,0,1,oe),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(O,B){return O.final!=="t"||O.prefix||O.intermediates?this._parser.registerCsiHandler(O,B):this._parser.registerCsiHandler(O,(N=>!G(N.params[0],this._optionsService.rawOptions.windowOptions)||B(N)))}registerDcsHandler(O,B){return this._parser.registerDcsHandler(O,new A.DcsHandler(B))}registerEscHandler(O,B){return this._parser.registerEscHandler(O,B)}registerOscHandler(O,B){return this._parser.registerOscHandler(O,new j.OscHandler(B))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var O;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((O=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&O.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);B.hasWidth(this._activeBuffer.x)&&!B.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const O=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-O),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(O=this._bufferService.cols-1){this._activeBuffer.x=Math.min(O,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(O,B){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=O,this._activeBuffer.y=this._activeBuffer.scrollTop+B):(this._activeBuffer.x=O,this._activeBuffer.y=B),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(O,B){this._restrictCursor(),this._setCursor(this._activeBuffer.x+O,this._activeBuffer.y+B)}cursorUp(O){const B=this._activeBuffer.y-this._activeBuffer.scrollTop;return B>=0?this._moveCursor(0,-Math.min(B,O.params[0]||1)):this._moveCursor(0,-(O.params[0]||1)),!0}cursorDown(O){const B=this._activeBuffer.scrollBottom-this._activeBuffer.y;return B>=0?this._moveCursor(0,Math.min(B,O.params[0]||1)):this._moveCursor(0,O.params[0]||1),!0}cursorForward(O){return this._moveCursor(O.params[0]||1,0),!0}cursorBackward(O){return this._moveCursor(-(O.params[0]||1),0),!0}cursorNextLine(O){return this.cursorDown(O),this._activeBuffer.x=0,!0}cursorPrecedingLine(O){return this.cursorUp(O),this._activeBuffer.x=0,!0}cursorCharAbsolute(O){return this._setCursor((O.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(O){return this._setCursor(O.length>=2?(O.params[1]||1)-1:0,(O.params[0]||1)-1),!0}charPosAbsolute(O){return this._setCursor((O.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(O){return this._moveCursor(O.params[0]||1,0),!0}linePosAbsolute(O){return this._setCursor(this._activeBuffer.x,(O.params[0]||1)-1),!0}vPositionRelative(O){return this._moveCursor(0,O.params[0]||1),!0}hVPosition(O){return this.cursorPosition(O),!0}tabClear(O){const B=O.params[0];return B===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:B===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(O){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let B=O.params[0]||1;for(;B--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(O){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let B=O.params[0]||1;for(;B--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(O){const B=O.params[0];return B===1&&(this._curAttrData.bg|=536870912),B!==2&&B!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(O,B,N,z=!1,W=!1){const Z=this._activeBuffer.lines.get(this._activeBuffer.ybase+O);Z.replaceCells(B,N,this._activeBuffer.getNullCell(this._eraseAttrData()),W),z&&(Z.isWrapped=!1)}_resetBufferLine(O,B=!1){const N=this._activeBuffer.lines.get(this._activeBuffer.ybase+O);N&&(N.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),B),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+O),N.isWrapped=!1)}eraseInDisplay(O,B=!1){let N;switch(this._restrictCursor(this._bufferService.cols),O.params[0]){case 0:for(N=this._activeBuffer.y,this._dirtyRowTracker.markDirty(N),this._eraseInBufferLine(N++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,B);N<this._bufferService.rows;N++)this._resetBufferLine(N,B);this._dirtyRowTracker.markDirty(N);break;case 1:for(N=this._activeBuffer.y,this._dirtyRowTracker.markDirty(N),this._eraseInBufferLine(N,0,this._activeBuffer.x+1,!0,B),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(N+1).isWrapped=!1);N--;)this._resetBufferLine(N,B);this._dirtyRowTracker.markDirty(0);break;case 2:for(N=this._bufferService.rows,this._dirtyRowTracker.markDirty(N-1);N--;)this._resetBufferLine(N,B);this._dirtyRowTracker.markDirty(0);break;case 3:const z=this._activeBuffer.lines.length-this._bufferService.rows;z>0&&(this._activeBuffer.lines.trimStart(z),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-z,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-z,0),this._onScroll.fire(0))}return!0}eraseInLine(O,B=!1){switch(this._restrictCursor(this._bufferService.cols),O.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,B);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,B);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,B)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(O){this._restrictCursor();let B=O.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const N=this._activeBuffer.ybase+this._activeBuffer.y,z=this._bufferService.rows-1-this._activeBuffer.scrollBottom,W=this._bufferService.rows-1+this._activeBuffer.ybase-z+1;for(;B--;)this._activeBuffer.lines.splice(W-1,1),this._activeBuffer.lines.splice(N,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(O){this._restrictCursor();let B=O.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const N=this._activeBuffer.ybase+this._activeBuffer.y;let z;for(z=this._bufferService.rows-1-this._activeBuffer.scrollBottom,z=this._bufferService.rows-1+this._activeBuffer.ybase-z;B--;)this._activeBuffer.lines.splice(N,1),this._activeBuffer.lines.splice(z,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(O){this._restrictCursor();const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return B&&(B.insertCells(this._activeBuffer.x,O.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(O){this._restrictCursor();const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return B&&(B.deleteCells(this._activeBuffer.x,O.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(O){let B=O.params[0]||1;for(;B--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(O){let B=O.params[0]||1;for(;B--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(y.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(O){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const B=O.params[0]||1;for(let N=this._activeBuffer.scrollTop;N<=this._activeBuffer.scrollBottom;++N){const z=this._activeBuffer.lines.get(this._activeBuffer.ybase+N);z.deleteCells(0,B,this._activeBuffer.getNullCell(this._eraseAttrData())),z.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(O){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const B=O.params[0]||1;for(let N=this._activeBuffer.scrollTop;N<=this._activeBuffer.scrollBottom;++N){const z=this._activeBuffer.lines.get(this._activeBuffer.ybase+N);z.insertCells(0,B,this._activeBuffer.getNullCell(this._eraseAttrData())),z.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(O){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const B=O.params[0]||1;for(let N=this._activeBuffer.scrollTop;N<=this._activeBuffer.scrollBottom;++N){const z=this._activeBuffer.lines.get(this._activeBuffer.ybase+N);z.insertCells(this._activeBuffer.x,B,this._activeBuffer.getNullCell(this._eraseAttrData())),z.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(O){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const B=O.params[0]||1;for(let N=this._activeBuffer.scrollTop;N<=this._activeBuffer.scrollBottom;++N){const z=this._activeBuffer.lines.get(this._activeBuffer.ybase+N);z.deleteCells(this._activeBuffer.x,B,this._activeBuffer.getNullCell(this._eraseAttrData())),z.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(O){this._restrictCursor();const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return B&&(B.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(O.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(O){const B=this._parser.precedingJoinState;if(!B)return!0;const N=O.params[0]||1,z=R.UnicodeService.extractWidth(B),W=this._activeBuffer.x-z,Z=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(W),ue=new Uint32Array(Z.length*N);let ge=0;for(let $=0;$<Z.length;){const oe=Z.codePointAt($)||0;ue[ge++]=oe,$+=oe>65535?2:1}let Y=ge;for(let $=1;$<N;++$)ue.copyWithin(Y,0,ge),Y+=ge;return this.print(ue,0,Y),!0}sendDeviceAttributesPrimary(O){return O.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(f.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(f.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(O){return O.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(f.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(f.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(O.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(f.C0.ESC+"[>83;40003;0c")),!0}_is(O){return(this._optionsService.rawOptions.termName+"").indexOf(O)===0}setMode(O){for(let B=0;B<O.length;B++)switch(O.params[B]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(O){for(let B=0;B<O.length;B++)switch(O.params[B]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,x.DEFAULT_CHARSET),this._charsetService.setgCharset(1,x.DEFAULT_CHARSET),this._charsetService.setgCharset(2,x.DEFAULT_CHARSET),this._charsetService.setgCharset(3,x.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(O){for(let B=0;B<O.length;B++)switch(O.params[B]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(O){for(let B=0;B<O.length;B++)switch(O.params[B]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),O.params[B]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(O,B){const N=this._coreService.decPrivateModes,{activeProtocol:z,activeEncoding:W}=this._coreMouseService,Z=this._coreService,{buffers:ue,cols:ge}=this._bufferService,{active:Y,alt:$}=ue,oe=this._optionsService.rawOptions,ae=Ye=>Ye?1:2,xe=O.params[0];return Ee=xe,Ue=B?xe===2?4:xe===4?ae(Z.modes.insertMode):xe===12?3:xe===20?ae(oe.convertEol):0:xe===1?ae(N.applicationCursorKeys):xe===3?oe.windowOptions.setWinLines?ge===80?2:ge===132?1:0:0:xe===6?ae(N.origin):xe===7?ae(N.wraparound):xe===8?3:xe===9?ae(z==="X10"):xe===12?ae(oe.cursorBlink):xe===25?ae(!Z.isCursorHidden):xe===45?ae(N.reverseWraparound):xe===66?ae(N.applicationKeypad):xe===67?4:xe===1e3?ae(z==="VT200"):xe===1002?ae(z==="DRAG"):xe===1003?ae(z==="ANY"):xe===1004?ae(N.sendFocus):xe===1005?4:xe===1006?ae(W==="SGR"):xe===1015?4:xe===1016?ae(W==="SGR_PIXELS"):xe===1048?1:xe===47||xe===1047||xe===1049?ae(Y===$):xe===2004?ae(N.bracketedPasteMode):0,Z.triggerDataEvent(`${f.C0.ESC}[${B?"":"?"}${Ee};${Ue}$y`),!0;var Ee,Ue}_updateAttrColor(O,B,N,z,W){return B===2?(O|=50331648,O&=-16777216,O|=k.AttributeData.fromColorRGB([N,z,W])):B===5&&(O&=-50331904,O|=33554432|255&N),O}_extractColor(O,B,N){const z=[0,0,-1,0,0,0];let W=0,Z=0;do{if(z[Z+W]=O.params[B+Z],O.hasSubParams(B+Z)){const ue=O.getSubParams(B+Z);let ge=0;do z[1]===5&&(W=1),z[Z+ge+1+W]=ue[ge];while(++ge<ue.length&&ge+Z+1+W<z.length);break}if(z[1]===5&&Z+W>=2||z[1]===2&&Z+W>=5)break;z[1]&&(W=1)}while(++Z+B<O.length&&Z+W<z.length);for(let ue=2;ue<z.length;++ue)z[ue]===-1&&(z[ue]=0);switch(z[0]){case 38:N.fg=this._updateAttrColor(N.fg,z[1],z[3],z[4],z[5]);break;case 48:N.bg=this._updateAttrColor(N.bg,z[1],z[3],z[4],z[5]);break;case 58:N.extended=N.extended.clone(),N.extended.underlineColor=this._updateAttrColor(N.extended.underlineColor,z[1],z[3],z[4],z[5])}return Z}_processUnderline(O,B){B.extended=B.extended.clone(),(!~O||O>5)&&(O=1),B.extended.underlineStyle=O,B.fg|=268435456,O===0&&(B.fg&=-268435457),B.updateExtended()}_processSGR0(O){O.fg=y.DEFAULT_ATTR_DATA.fg,O.bg=y.DEFAULT_ATTR_DATA.bg,O.extended=O.extended.clone(),O.extended.underlineStyle=0,O.extended.underlineColor&=-67108864,O.updateExtended()}charAttributes(O){if(O.length===1&&O.params[0]===0)return this._processSGR0(this._curAttrData),!0;const B=O.length;let N;const z=this._curAttrData;for(let W=0;W<B;W++)N=O.params[W],N>=30&&N<=37?(z.fg&=-50331904,z.fg|=16777216|N-30):N>=40&&N<=47?(z.bg&=-50331904,z.bg|=16777216|N-40):N>=90&&N<=97?(z.fg&=-50331904,z.fg|=16777224|N-90):N>=100&&N<=107?(z.bg&=-50331904,z.bg|=16777224|N-100):N===0?this._processSGR0(z):N===1?z.fg|=134217728:N===3?z.bg|=67108864:N===4?(z.fg|=268435456,this._processUnderline(O.hasSubParams(W)?O.getSubParams(W)[0]:1,z)):N===5?z.fg|=536870912:N===7?z.fg|=67108864:N===8?z.fg|=1073741824:N===9?z.fg|=2147483648:N===2?z.bg|=134217728:N===21?this._processUnderline(2,z):N===22?(z.fg&=-134217729,z.bg&=-134217729):N===23?z.bg&=-67108865:N===24?(z.fg&=-268435457,this._processUnderline(0,z)):N===25?z.fg&=-536870913:N===27?z.fg&=-67108865:N===28?z.fg&=-1073741825:N===29?z.fg&=2147483647:N===39?(z.fg&=-67108864,z.fg|=16777215&y.DEFAULT_ATTR_DATA.fg):N===49?(z.bg&=-67108864,z.bg|=16777215&y.DEFAULT_ATTR_DATA.bg):N===38||N===48||N===58?W+=this._extractColor(O,W,z):N===53?z.bg|=1073741824:N===55?z.bg&=-1073741825:N===59?(z.extended=z.extended.clone(),z.extended.underlineColor=-1,z.updateExtended()):N===100?(z.fg&=-67108864,z.fg|=16777215&y.DEFAULT_ATTR_DATA.fg,z.bg&=-67108864,z.bg|=16777215&y.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",N);return!0}deviceStatus(O){switch(O.params[0]){case 5:this._coreService.triggerDataEvent(`${f.C0.ESC}[0n`);break;case 6:const B=this._activeBuffer.y+1,N=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${f.C0.ESC}[${B};${N}R`)}return!0}deviceStatusPrivate(O){if(O.params[0]===6){const B=this._activeBuffer.y+1,N=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${f.C0.ESC}[?${B};${N}R`)}return!0}softReset(O){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=y.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(O){const B=O.params[0]||1;switch(B){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const N=B%2==1;return this._optionsService.options.cursorBlink=N,!0}setScrollRegion(O){const B=O.params[0]||1;let N;return(O.length<2||(N=O.params[1])>this._bufferService.rows||N===0)&&(N=this._bufferService.rows),N>B&&(this._activeBuffer.scrollTop=B-1,this._activeBuffer.scrollBottom=N-1,this._setCursor(0,0)),!0}windowOptions(O){if(!G(O.params[0],this._optionsService.rawOptions.windowOptions))return!0;const B=O.length>1?O.params[1]:0;switch(O.params[0]){case 14:B!==2&&this._onRequestWindowsOptionsReport.fire(U.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(U.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${f.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:B!==0&&B!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),B!==0&&B!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:B!==0&&B!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),B!==0&&B!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(O){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(O){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(O){return this._windowTitle=O,this._onTitleChange.fire(O),!0}setIconName(O){return this._iconName=O,!0}setOrReportIndexedColor(O){const B=[],N=O.split(";");for(;N.length>1;){const z=N.shift(),W=N.shift();if(/^\d+$/.exec(z)){const Z=parseInt(z);if(Q(Z))if(W==="?")B.push({type:0,index:Z});else{const ue=(0,D.parseColor)(W);ue&&B.push({type:1,index:Z,color:ue})}}}return B.length&&this._onColor.fire(B),!0}setHyperlink(O){const B=O.split(";");return!(B.length<2)&&(B[1]?this._createHyperlink(B[0],B[1]):!B[0]&&this._finishHyperlink())}_createHyperlink(O,B){this._getCurrentLinkId()&&this._finishHyperlink();const N=O.split(":");let z;const W=N.findIndex((Z=>Z.startsWith("id=")));return W!==-1&&(z=N[W].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:z,uri:B}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(O,B){const N=O.split(";");for(let z=0;z<N.length&&!(B>=this._specialColors.length);++z,++B)if(N[z]==="?")this._onColor.fire([{type:0,index:this._specialColors[B]}]);else{const W=(0,D.parseColor)(N[z]);W&&this._onColor.fire([{type:1,index:this._specialColors[B],color:W}])}return!0}setOrReportFgColor(O){return this._setOrReportSpecialColor(O,0)}setOrReportBgColor(O){return this._setOrReportSpecialColor(O,1)}setOrReportCursorColor(O){return this._setOrReportSpecialColor(O,2)}restoreIndexedColor(O){if(!O)return this._onColor.fire([{type:2}]),!0;const B=[],N=O.split(";");for(let z=0;z<N.length;++z)if(/^\d+$/.exec(N[z])){const W=parseInt(N[z]);Q(W)&&B.push({type:2,index:W})}return B.length&&this._onColor.fire(B),!0}restoreFgColor(O){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(O){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(O){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,x.DEFAULT_CHARSET),!0}selectCharset(O){return O.length!==2?(this.selectDefaultCharset(),!0):(O[0]==="/"||this._charsetService.setgCharset(I[O[0]],x.CHARSETS[O[1]]||x.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const O=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,O,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=y.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=y.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(O){return this._charsetService.setgLevel(O),!0}screenAlignmentPattern(){const O=new g.CellData;O.content=4194373,O.fg=this._curAttrData.fg,O.bg=this._curAttrData.bg,this._setCursor(0,0);for(let B=0;B<this._bufferService.rows;++B){const N=this._activeBuffer.ybase+this._activeBuffer.y+B,z=this._activeBuffer.lines.get(N);z&&(z.fill(O),z.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(O,B){const N=this._bufferService.buffer,z=this._optionsService.rawOptions;return(W=>(this._coreService.triggerDataEvent(`${f.C0.ESC}${W}${f.C0.ESC}\\`),!0))(O==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:O==='"p'?'P1$r61;1"p':O==="r"?`P1$r${N.scrollTop+1};${N.scrollBottom+1}r`:O==="m"?"P1$r0m":O===" q"?`P1$r${{block:2,underline:4,bar:6}[z.cursorStyle]-(z.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(O,B){this._dirtyRowTracker.markRangeDirty(O,B)}}c.InputHandler=se;let F=class{constructor(J){this._bufferService=J,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(J){J<this.start?this.start=J:J>this.end&&(this.end=J)}markRangeDirty(J,O){J>O&&(X=J,J=O,O=X),J<this.start&&(this.start=J),O>this.end&&(this.end=O)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function Q(J){return 0<=J&&J<256}F=v([S(0,M.IBufferService)],F)},844:(p,c)=>{function h(v){for(const S of v)S.dispose();v.length=0}Object.defineProperty(c,"__esModule",{value:!0}),c.getDisposeArrayDisposable=c.disposeArray=c.toDisposable=c.MutableDisposable=c.Disposable=void 0,c.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const v of this._disposables)v.dispose();this._disposables.length=0}register(v){return this._disposables.push(v),v}unregister(v){const S=this._disposables.indexOf(v);S!==-1&&this._disposables.splice(S,1)}},c.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(v){var S;this._isDisposed||v===this._value||((S=this._value)==null||S.dispose(),this._value=v)}clear(){this.value=void 0}dispose(){var v;this._isDisposed=!0,(v=this._value)==null||v.dispose(),this._value=void 0}},c.toDisposable=function(v){return{dispose:v}},c.disposeArray=h,c.getDisposeArrayDisposable=function(v){return{dispose:()=>h(v)}}},1505:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.FourKeyMap=c.TwoKeyMap=void 0;class h{constructor(){this._data={}}set(S,f,x){this._data[S]||(this._data[S]={}),this._data[S][f]=x}get(S,f){return this._data[S]?this._data[S][f]:void 0}clear(){this._data={}}}c.TwoKeyMap=h,c.FourKeyMap=class{constructor(){this._data=new h}set(v,S,f,x,E){this._data.get(v,S)||this._data.set(v,S,new h),this._data.get(v,S).set(f,x,E)}get(v,S,f,x){var E;return(E=this._data.get(v,S))==null?void 0:E.get(f,x)}clear(){this._data.clear()}}},6114:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.isChromeOS=c.isLinux=c.isWindows=c.isIphone=c.isIpad=c.isMac=c.getSafariVersion=c.isSafari=c.isLegacyEdge=c.isFirefox=c.isNode=void 0,c.isNode=typeof process<"u"&&"title"in process;const h=c.isNode?"node":navigator.userAgent,v=c.isNode?"node":navigator.platform;c.isFirefox=h.includes("Firefox"),c.isLegacyEdge=h.includes("Edge"),c.isSafari=/^((?!chrome|android).)*safari/i.test(h),c.getSafariVersion=function(){if(!c.isSafari)return 0;const S=h.match(/Version\/(\d+)/);return S===null||S.length<2?0:parseInt(S[1])},c.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(v),c.isIpad=v==="iPad",c.isIphone=v==="iPhone",c.isWindows=["Windows","Win16","Win32","WinCE"].includes(v),c.isLinux=v.indexOf("Linux")>=0,c.isChromeOS=/\bCrOS\b/.test(h)},6106:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.SortedList=void 0;let h=0;c.SortedList=class{constructor(v){this._getKey=v,this._array=[]}clear(){this._array.length=0}insert(v){this._array.length!==0?(h=this._search(this._getKey(v)),this._array.splice(h,0,v)):this._array.push(v)}delete(v){if(this._array.length===0)return!1;const S=this._getKey(v);if(S===void 0||(h=this._search(S),h===-1)||this._getKey(this._array[h])!==S)return!1;do if(this._array[h]===v)return this._array.splice(h,1),!0;while(++h<this._array.length&&this._getKey(this._array[h])===S);return!1}*getKeyIterator(v){if(this._array.length!==0&&(h=this._search(v),!(h<0||h>=this._array.length)&&this._getKey(this._array[h])===v))do yield this._array[h];while(++h<this._array.length&&this._getKey(this._array[h])===v)}forEachByKey(v,S){if(this._array.length!==0&&(h=this._search(v),!(h<0||h>=this._array.length)&&this._getKey(this._array[h])===v))do S(this._array[h]);while(++h<this._array.length&&this._getKey(this._array[h])===v)}values(){return[...this._array].values()}_search(v){let S=0,f=this._array.length-1;for(;f>=S;){let x=S+f>>1;const E=this._getKey(this._array[x]);if(E>v)f=x-1;else{if(!(E<v)){for(;x>0&&this._getKey(this._array[x-1])===v;)x--;return x}S=x+1}}return S}}},7226:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.DebouncedIdleTask=c.IdleTaskQueue=c.PriorityTaskQueue=void 0;const v=h(6114);class S{constructor(){this._tasks=[],this._i=0}enqueue(E){this._tasks.push(E),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(E){this._idleCallback=void 0;let T=0,C=0,y=E.timeRemaining(),b=0;for(;this._i<this._tasks.length;){if(T=Date.now(),this._tasks[this._i]()||this._i++,T=Math.max(1,Date.now()-T),C=Math.max(T,C),b=E.timeRemaining(),1.5*C>b)return y-T<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(y-T))}ms`),void this._start();y=b}this.clear()}}class f extends S{_requestCallback(E){return setTimeout((()=>E(this._createDeadline(16))))}_cancelCallback(E){clearTimeout(E)}_createDeadline(E){const T=Date.now()+E;return{timeRemaining:()=>Math.max(0,T-Date.now())}}}c.PriorityTaskQueue=f,c.IdleTaskQueue=!v.isNode&&"requestIdleCallback"in window?class extends S{_requestCallback(x){return requestIdleCallback(x)}_cancelCallback(x){cancelIdleCallback(x)}}:f,c.DebouncedIdleTask=class{constructor(){this._queue=new c.IdleTaskQueue}set(x){this._queue.clear(),this._queue.enqueue(x)}flush(){this._queue.flush()}}},9282:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.updateWindowsModeWrappedState=void 0;const v=h(643);c.updateWindowsModeWrappedState=function(S){const f=S.buffer.lines.get(S.buffer.ybase+S.buffer.y-1),x=f==null?void 0:f.get(S.cols-1),E=S.buffer.lines.get(S.buffer.ybase+S.buffer.y);E&&x&&(E.isWrapped=x[v.CHAR_DATA_CODE_INDEX]!==v.NULL_CELL_CODE&&x[v.CHAR_DATA_CODE_INDEX]!==v.WHITESPACE_CELL_CODE)}},3734:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ExtendedAttrs=c.AttributeData=void 0;class h{constructor(){this.fg=0,this.bg=0,this.extended=new v}static toColorRGB(f){return[f>>>16&255,f>>>8&255,255&f]}static fromColorRGB(f){return(255&f[0])<<16|(255&f[1])<<8|255&f[2]}clone(){const f=new h;return f.fg=this.fg,f.bg=this.bg,f.extended=this.extended.clone(),f}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}c.AttributeData=h;class v{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(f){this._ext=f}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(f){this._ext&=-469762049,this._ext|=f<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(f){this._ext&=-67108864,this._ext|=67108863&f}get urlId(){return this._urlId}set urlId(f){this._urlId=f}get underlineVariantOffset(){const f=(3758096384&this._ext)>>29;return f<0?4294967288^f:f}set underlineVariantOffset(f){this._ext&=536870911,this._ext|=f<<29&3758096384}constructor(f=0,x=0){this._ext=0,this._urlId=0,this._ext=f,this._urlId=x}clone(){return new v(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}c.ExtendedAttrs=v},9092:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Buffer=c.MAX_BUFFER_SIZE=void 0;const v=h(6349),S=h(7226),f=h(3734),x=h(8437),E=h(4634),T=h(511),C=h(643),y=h(4863),b=h(7116);c.MAX_BUFFER_SIZE=4294967295,c.Buffer=class{constructor(m,g,k){this._hasScrollback=m,this._optionsService=g,this._bufferService=k,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=x.DEFAULT_ATTR_DATA.clone(),this.savedCharset=b.DEFAULT_CHARSET,this.markers=[],this._nullCell=T.CellData.fromCharData([0,C.NULL_CELL_CHAR,C.NULL_CELL_WIDTH,C.NULL_CELL_CODE]),this._whitespaceCell=T.CellData.fromCharData([0,C.WHITESPACE_CELL_CHAR,C.WHITESPACE_CELL_WIDTH,C.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new S.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new v.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(m){return m?(this._nullCell.fg=m.fg,this._nullCell.bg=m.bg,this._nullCell.extended=m.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new f.ExtendedAttrs),this._nullCell}getWhitespaceCell(m){return m?(this._whitespaceCell.fg=m.fg,this._whitespaceCell.bg=m.bg,this._whitespaceCell.extended=m.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new f.ExtendedAttrs),this._whitespaceCell}getBlankLine(m,g){return new x.BufferLine(this._bufferService.cols,this.getNullCell(m),g)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const m=this.ybase+this.y-this.ydisp;return m>=0&&m<this._rows}_getCorrectBufferLength(m){if(!this._hasScrollback)return m;const g=m+this._optionsService.rawOptions.scrollback;return g>c.MAX_BUFFER_SIZE?c.MAX_BUFFER_SIZE:g}fillViewportRows(m){if(this.lines.length===0){m===void 0&&(m=x.DEFAULT_ATTR_DATA);let g=this._rows;for(;g--;)this.lines.push(this.getBlankLine(m))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new v.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(m,g){const k=this.getNullCell(x.DEFAULT_ATTR_DATA);let M=0;const R=this._getCorrectBufferLength(g);if(R>this.lines.maxLength&&(this.lines.maxLength=R),this.lines.length>0){if(this._cols<m)for(let A=0;A<this.lines.length;A++)M+=+this.lines.get(A).resize(m,k);let j=0;if(this._rows<g)for(let A=this._rows;A<g;A++)this.lines.length<g+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new x.BufferLine(m,k)):this.ybase>0&&this.lines.length<=this.ybase+this.y+j+1?(this.ybase--,j++,this.ydisp>0&&this.ydisp--):this.lines.push(new x.BufferLine(m,k)));else for(let A=this._rows;A>g;A--)this.lines.length>g+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(R<this.lines.maxLength){const A=this.lines.length-R;A>0&&(this.lines.trimStart(A),this.ybase=Math.max(this.ybase-A,0),this.ydisp=Math.max(this.ydisp-A,0),this.savedY=Math.max(this.savedY-A,0)),this.lines.maxLength=R}this.x=Math.min(this.x,m-1),this.y=Math.min(this.y,g-1),j&&(this.y+=j),this.savedX=Math.min(this.savedX,m-1),this.scrollTop=0}if(this.scrollBottom=g-1,this._isReflowEnabled&&(this._reflow(m,g),this._cols>m))for(let j=0;j<this.lines.length;j++)M+=+this.lines.get(j).resize(m,k);this._cols=m,this._rows=g,this._memoryCleanupQueue.clear(),M>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let m=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,m=!1);let g=0;for(;this._memoryCleanupPosition<this.lines.length;)if(g+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),g>100)return!0;return m}get _isReflowEnabled(){const m=this._optionsService.rawOptions.windowsPty;return m&&m.buildNumber?this._hasScrollback&&m.backend==="conpty"&&m.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(m,g){this._cols!==m&&(m>this._cols?this._reflowLarger(m,g):this._reflowSmaller(m,g))}_reflowLarger(m,g){const k=(0,E.reflowLargerGetLinesToRemove)(this.lines,this._cols,m,this.ybase+this.y,this.getNullCell(x.DEFAULT_ATTR_DATA));if(k.length>0){const M=(0,E.reflowLargerCreateNewLayout)(this.lines,k);(0,E.reflowLargerApplyNewLayout)(this.lines,M.layout),this._reflowLargerAdjustViewport(m,g,M.countRemoved)}}_reflowLargerAdjustViewport(m,g,k){const M=this.getNullCell(x.DEFAULT_ATTR_DATA);let R=k;for(;R-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<g&&this.lines.push(new x.BufferLine(m,M))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-k,0)}_reflowSmaller(m,g){const k=this.getNullCell(x.DEFAULT_ATTR_DATA),M=[];let R=0;for(let j=this.lines.length-1;j>=0;j--){let A=this.lines.get(j);if(!A||!A.isWrapped&&A.getTrimmedLength()<=m)continue;const D=[A];for(;A.isWrapped&&j>0;)A=this.lines.get(--j),D.unshift(A);const I=this.ybase+this.y;if(I>=j&&I<j+D.length)continue;const q=D[D.length-1].getTrimmedLength(),G=(0,E.reflowSmallerGetNewLineLengths)(D,this._cols,m),U=G.length-D.length;let X;X=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+U):Math.max(0,this.lines.length-this.lines.maxLength+U);const se=[];for(let N=0;N<U;N++){const z=this.getBlankLine(x.DEFAULT_ATTR_DATA,!0);se.push(z)}se.length>0&&(M.push({start:j+D.length+R,newLines:se}),R+=se.length),D.push(...se);let F=G.length-1,Q=G[F];Q===0&&(F--,Q=G[F]);let J=D.length-U-1,O=q;for(;J>=0;){const N=Math.min(O,Q);if(D[F]===void 0)break;if(D[F].copyCellsFrom(D[J],O-N,Q-N,N,!0),Q-=N,Q===0&&(F--,Q=G[F]),O-=N,O===0){J--;const z=Math.max(J,0);O=(0,E.getWrappedLineTrimmedLength)(D,z,this._cols)}}for(let N=0;N<D.length;N++)G[N]<m&&D[N].setCell(G[N],k);let B=U-X;for(;B-- >0;)this.ybase===0?this.y<g-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+R)-g&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+U,this.ybase+g-1)}if(M.length>0){const j=[],A=[];for(let F=0;F<this.lines.length;F++)A.push(this.lines.get(F));const D=this.lines.length;let I=D-1,q=0,G=M[q];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+R);let U=0;for(let F=Math.min(this.lines.maxLength-1,D+R-1);F>=0;F--)if(G&&G.start>I+U){for(let Q=G.newLines.length-1;Q>=0;Q--)this.lines.set(F--,G.newLines[Q]);F++,j.push({index:I+1,amount:G.newLines.length}),U+=G.newLines.length,G=M[++q]}else this.lines.set(F,A[I--]);let X=0;for(let F=j.length-1;F>=0;F--)j[F].index+=X,this.lines.onInsertEmitter.fire(j[F]),X+=j[F].amount;const se=Math.max(0,D+R-this.lines.maxLength);se>0&&this.lines.onTrimEmitter.fire(se)}}translateBufferLineToString(m,g,k=0,M){const R=this.lines.get(m);return R?R.translateToString(g,k,M):""}getWrappedRangeForLine(m){let g=m,k=m;for(;g>0&&this.lines.get(g).isWrapped;)g--;for(;k+1<this.lines.length&&this.lines.get(k+1).isWrapped;)k++;return{first:g,last:k}}setupTabStops(m){for(m!=null?this.tabs[m]||(m=this.prevStop(m)):(this.tabs={},m=0);m<this._cols;m+=this._optionsService.rawOptions.tabStopWidth)this.tabs[m]=!0}prevStop(m){for(m==null&&(m=this.x);!this.tabs[--m]&&m>0;);return m>=this._cols?this._cols-1:m<0?0:m}nextStop(m){for(m==null&&(m=this.x);!this.tabs[++m]&&m<this._cols;);return m>=this._cols?this._cols-1:m<0?0:m}clearMarkers(m){this._isClearing=!0;for(let g=0;g<this.markers.length;g++)this.markers[g].line===m&&(this.markers[g].dispose(),this.markers.splice(g--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let m=0;m<this.markers.length;m++)this.markers[m].dispose(),this.markers.splice(m--,1);this._isClearing=!1}addMarker(m){const g=new y.Marker(m);return this.markers.push(g),g.register(this.lines.onTrim((k=>{g.line-=k,g.line<0&&g.dispose()}))),g.register(this.lines.onInsert((k=>{g.line>=k.index&&(g.line+=k.amount)}))),g.register(this.lines.onDelete((k=>{g.line>=k.index&&g.line<k.index+k.amount&&g.dispose(),g.line>k.index&&(g.line-=k.amount)}))),g.register(g.onDispose((()=>this._removeMarker(g)))),g}_removeMarker(m){this._isClearing||this.markers.splice(this.markers.indexOf(m),1)}}},8437:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferLine=c.DEFAULT_ATTR_DATA=void 0;const v=h(3734),S=h(511),f=h(643),x=h(482);c.DEFAULT_ATTR_DATA=Object.freeze(new v.AttributeData);let E=0;class T{constructor(y,b,m=!1){this.isWrapped=m,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*y);const g=b||S.CellData.fromCharData([0,f.NULL_CELL_CHAR,f.NULL_CELL_WIDTH,f.NULL_CELL_CODE]);for(let k=0;k<y;++k)this.setCell(k,g);this.length=y}get(y){const b=this._data[3*y+0],m=2097151&b;return[this._data[3*y+1],2097152&b?this._combined[y]:m?(0,x.stringFromCodePoint)(m):"",b>>22,2097152&b?this._combined[y].charCodeAt(this._combined[y].length-1):m]}set(y,b){this._data[3*y+1]=b[f.CHAR_DATA_ATTR_INDEX],b[f.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[y]=b[1],this._data[3*y+0]=2097152|y|b[f.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*y+0]=b[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|b[f.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(y){return this._data[3*y+0]>>22}hasWidth(y){return 12582912&this._data[3*y+0]}getFg(y){return this._data[3*y+1]}getBg(y){return this._data[3*y+2]}hasContent(y){return 4194303&this._data[3*y+0]}getCodePoint(y){const b=this._data[3*y+0];return 2097152&b?this._combined[y].charCodeAt(this._combined[y].length-1):2097151&b}isCombined(y){return 2097152&this._data[3*y+0]}getString(y){const b=this._data[3*y+0];return 2097152&b?this._combined[y]:2097151&b?(0,x.stringFromCodePoint)(2097151&b):""}isProtected(y){return 536870912&this._data[3*y+2]}loadCell(y,b){return E=3*y,b.content=this._data[E+0],b.fg=this._data[E+1],b.bg=this._data[E+2],2097152&b.content&&(b.combinedData=this._combined[y]),268435456&b.bg&&(b.extended=this._extendedAttrs[y]),b}setCell(y,b){2097152&b.content&&(this._combined[y]=b.combinedData),268435456&b.bg&&(this._extendedAttrs[y]=b.extended),this._data[3*y+0]=b.content,this._data[3*y+1]=b.fg,this._data[3*y+2]=b.bg}setCellFromCodepoint(y,b,m,g){268435456&g.bg&&(this._extendedAttrs[y]=g.extended),this._data[3*y+0]=b|m<<22,this._data[3*y+1]=g.fg,this._data[3*y+2]=g.bg}addCodepointToCell(y,b,m){let g=this._data[3*y+0];2097152&g?this._combined[y]+=(0,x.stringFromCodePoint)(b):2097151&g?(this._combined[y]=(0,x.stringFromCodePoint)(2097151&g)+(0,x.stringFromCodePoint)(b),g&=-2097152,g|=2097152):g=b|4194304,m&&(g&=-12582913,g|=m<<22),this._data[3*y+0]=g}insertCells(y,b,m){if((y%=this.length)&&this.getWidth(y-1)===2&&this.setCellFromCodepoint(y-1,0,1,m),b<this.length-y){const g=new S.CellData;for(let k=this.length-y-b-1;k>=0;--k)this.setCell(y+b+k,this.loadCell(y+k,g));for(let k=0;k<b;++k)this.setCell(y+k,m)}else for(let g=y;g<this.length;++g)this.setCell(g,m);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,m)}deleteCells(y,b,m){if(y%=this.length,b<this.length-y){const g=new S.CellData;for(let k=0;k<this.length-y-b;++k)this.setCell(y+k,this.loadCell(y+b+k,g));for(let k=this.length-b;k<this.length;++k)this.setCell(k,m)}else for(let g=y;g<this.length;++g)this.setCell(g,m);y&&this.getWidth(y-1)===2&&this.setCellFromCodepoint(y-1,0,1,m),this.getWidth(y)!==0||this.hasContent(y)||this.setCellFromCodepoint(y,0,1,m)}replaceCells(y,b,m,g=!1){if(g)for(y&&this.getWidth(y-1)===2&&!this.isProtected(y-1)&&this.setCellFromCodepoint(y-1,0,1,m),b<this.length&&this.getWidth(b-1)===2&&!this.isProtected(b)&&this.setCellFromCodepoint(b,0,1,m);y<b&&y<this.length;)this.isProtected(y)||this.setCell(y,m),y++;else for(y&&this.getWidth(y-1)===2&&this.setCellFromCodepoint(y-1,0,1,m),b<this.length&&this.getWidth(b-1)===2&&this.setCellFromCodepoint(b,0,1,m);y<b&&y<this.length;)this.setCell(y++,m)}resize(y,b){if(y===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const m=3*y;if(y>this.length){if(this._data.buffer.byteLength>=4*m)this._data=new Uint32Array(this._data.buffer,0,m);else{const g=new Uint32Array(m);g.set(this._data),this._data=g}for(let g=this.length;g<y;++g)this.setCell(g,b)}else{this._data=this._data.subarray(0,m);const g=Object.keys(this._combined);for(let M=0;M<g.length;M++){const R=parseInt(g[M],10);R>=y&&delete this._combined[R]}const k=Object.keys(this._extendedAttrs);for(let M=0;M<k.length;M++){const R=parseInt(k[M],10);R>=y&&delete this._extendedAttrs[R]}}return this.length=y,4*m*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const y=new Uint32Array(this._data.length);return y.set(this._data),this._data=y,1}return 0}fill(y,b=!1){if(b)for(let m=0;m<this.length;++m)this.isProtected(m)||this.setCell(m,y);else{this._combined={},this._extendedAttrs={};for(let m=0;m<this.length;++m)this.setCell(m,y)}}copyFrom(y){this.length!==y.length?this._data=new Uint32Array(y._data):this._data.set(y._data),this.length=y.length,this._combined={};for(const b in y._combined)this._combined[b]=y._combined[b];this._extendedAttrs={};for(const b in y._extendedAttrs)this._extendedAttrs[b]=y._extendedAttrs[b];this.isWrapped=y.isWrapped}clone(){const y=new T(0);y._data=new Uint32Array(this._data),y.length=this.length;for(const b in this._combined)y._combined[b]=this._combined[b];for(const b in this._extendedAttrs)y._extendedAttrs[b]=this._extendedAttrs[b];return y.isWrapped=this.isWrapped,y}getTrimmedLength(){for(let y=this.length-1;y>=0;--y)if(4194303&this._data[3*y+0])return y+(this._data[3*y+0]>>22);return 0}getNoBgTrimmedLength(){for(let y=this.length-1;y>=0;--y)if(4194303&this._data[3*y+0]||50331648&this._data[3*y+2])return y+(this._data[3*y+0]>>22);return 0}copyCellsFrom(y,b,m,g,k){const M=y._data;if(k)for(let j=g-1;j>=0;j--){for(let A=0;A<3;A++)this._data[3*(m+j)+A]=M[3*(b+j)+A];268435456&M[3*(b+j)+2]&&(this._extendedAttrs[m+j]=y._extendedAttrs[b+j])}else for(let j=0;j<g;j++){for(let A=0;A<3;A++)this._data[3*(m+j)+A]=M[3*(b+j)+A];268435456&M[3*(b+j)+2]&&(this._extendedAttrs[m+j]=y._extendedAttrs[b+j])}const R=Object.keys(y._combined);for(let j=0;j<R.length;j++){const A=parseInt(R[j],10);A>=b&&(this._combined[A-b+m]=y._combined[A])}}translateToString(y,b,m,g){b=b??0,m=m??this.length,y&&(m=Math.min(m,this.getTrimmedLength())),g&&(g.length=0);let k="";for(;b<m;){const M=this._data[3*b+0],R=2097151&M,j=2097152&M?this._combined[b]:R?(0,x.stringFromCodePoint)(R):f.WHITESPACE_CELL_CHAR;if(k+=j,g)for(let A=0;A<j.length;++A)g.push(b);b+=M>>22||1}return g&&g.push(b),k}}c.BufferLine=T},4841:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.getRangeLength=void 0,c.getRangeLength=function(h,v){if(h.start.y>h.end.y)throw new Error(`Buffer range end (${h.end.x}, ${h.end.y}) cannot be before start (${h.start.x}, ${h.start.y})`);return v*(h.end.y-h.start.y)+(h.end.x-h.start.x+1)}},4634:(p,c)=>{function h(v,S,f){if(S===v.length-1)return v[S].getTrimmedLength();const x=!v[S].hasContent(f-1)&&v[S].getWidth(f-1)===1,E=v[S+1].getWidth(0)===2;return x&&E?f-1:f}Object.defineProperty(c,"__esModule",{value:!0}),c.getWrappedLineTrimmedLength=c.reflowSmallerGetNewLineLengths=c.reflowLargerApplyNewLayout=c.reflowLargerCreateNewLayout=c.reflowLargerGetLinesToRemove=void 0,c.reflowLargerGetLinesToRemove=function(v,S,f,x,E){const T=[];for(let C=0;C<v.length-1;C++){let y=C,b=v.get(++y);if(!b.isWrapped)continue;const m=[v.get(C)];for(;y<v.length&&b.isWrapped;)m.push(b),b=v.get(++y);if(x>=C&&x<y){C+=m.length-1;continue}let g=0,k=h(m,g,S),M=1,R=0;for(;M<m.length;){const A=h(m,M,S),D=A-R,I=f-k,q=Math.min(D,I);m[g].copyCellsFrom(m[M],R,k,q,!1),k+=q,k===f&&(g++,k=0),R+=q,R===A&&(M++,R=0),k===0&&g!==0&&m[g-1].getWidth(f-1)===2&&(m[g].copyCellsFrom(m[g-1],f-1,k++,1,!1),m[g-1].setCell(f-1,E))}m[g].replaceCells(k,f,E);let j=0;for(let A=m.length-1;A>0&&(A>g||m[A].getTrimmedLength()===0);A--)j++;j>0&&(T.push(C+m.length-j),T.push(j)),C+=m.length-1}return T},c.reflowLargerCreateNewLayout=function(v,S){const f=[];let x=0,E=S[x],T=0;for(let C=0;C<v.length;C++)if(E===C){const y=S[++x];v.onDeleteEmitter.fire({index:C-T,amount:y}),C+=y-1,T+=y,E=S[++x]}else f.push(C);return{layout:f,countRemoved:T}},c.reflowLargerApplyNewLayout=function(v,S){const f=[];for(let x=0;x<S.length;x++)f.push(v.get(S[x]));for(let x=0;x<f.length;x++)v.set(x,f[x]);v.length=S.length},c.reflowSmallerGetNewLineLengths=function(v,S,f){const x=[],E=v.map(((b,m)=>h(v,m,S))).reduce(((b,m)=>b+m));let T=0,C=0,y=0;for(;y<E;){if(E-y<f){x.push(E-y);break}T+=f;const b=h(v,C,S);T>b&&(T-=b,C++);const m=v[C].getWidth(T-1)===2;m&&T--;const g=m?f-1:f;x.push(g),y+=g}return x},c.getWrappedLineTrimmedLength=h},5295:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferSet=void 0;const v=h(8460),S=h(844),f=h(9092);class x extends S.Disposable{constructor(T,C){super(),this._optionsService=T,this._bufferService=C,this._onBufferActivate=this.register(new v.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",(()=>this.setupTabStops())))}reset(){this._normal=new f.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new f.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(T){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(T),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(T,C){this._normal.resize(T,C),this._alt.resize(T,C),this.setupTabStops(T)}setupTabStops(T){this._normal.setupTabStops(T),this._alt.setupTabStops(T)}}c.BufferSet=x},511:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CellData=void 0;const v=h(482),S=h(643),f=h(3734);class x extends f.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new f.ExtendedAttrs,this.combinedData=""}static fromCharData(T){const C=new x;return C.setFromCharData(T),C}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,v.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(T){this.fg=T[S.CHAR_DATA_ATTR_INDEX],this.bg=0;let C=!1;if(T[S.CHAR_DATA_CHAR_INDEX].length>2)C=!0;else if(T[S.CHAR_DATA_CHAR_INDEX].length===2){const y=T[S.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=y&&y<=56319){const b=T[S.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=b&&b<=57343?this.content=1024*(y-55296)+b-56320+65536|T[S.CHAR_DATA_WIDTH_INDEX]<<22:C=!0}else C=!0}else this.content=T[S.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|T[S.CHAR_DATA_WIDTH_INDEX]<<22;C&&(this.combinedData=T[S.CHAR_DATA_CHAR_INDEX],this.content=2097152|T[S.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}c.CellData=x},643:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.WHITESPACE_CELL_CODE=c.WHITESPACE_CELL_WIDTH=c.WHITESPACE_CELL_CHAR=c.NULL_CELL_CODE=c.NULL_CELL_WIDTH=c.NULL_CELL_CHAR=c.CHAR_DATA_CODE_INDEX=c.CHAR_DATA_WIDTH_INDEX=c.CHAR_DATA_CHAR_INDEX=c.CHAR_DATA_ATTR_INDEX=c.DEFAULT_EXT=c.DEFAULT_ATTR=c.DEFAULT_COLOR=void 0,c.DEFAULT_COLOR=0,c.DEFAULT_ATTR=256|c.DEFAULT_COLOR<<9,c.DEFAULT_EXT=0,c.CHAR_DATA_ATTR_INDEX=0,c.CHAR_DATA_CHAR_INDEX=1,c.CHAR_DATA_WIDTH_INDEX=2,c.CHAR_DATA_CODE_INDEX=3,c.NULL_CELL_CHAR="",c.NULL_CELL_WIDTH=1,c.NULL_CELL_CODE=0,c.WHITESPACE_CELL_CHAR=" ",c.WHITESPACE_CELL_WIDTH=1,c.WHITESPACE_CELL_CODE=32},4863:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Marker=void 0;const v=h(8460),S=h(844);class f{get id(){return this._id}constructor(E){this.line=E,this.isDisposed=!1,this._disposables=[],this._id=f._nextId++,this._onDispose=this.register(new v.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,S.disposeArray)(this._disposables),this._disposables.length=0)}register(E){return this._disposables.push(E),E}}c.Marker=f,f._nextId=1},7116:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.DEFAULT_CHARSET=c.CHARSETS=void 0,c.CHARSETS={},c.DEFAULT_CHARSET=c.CHARSETS.B,c.CHARSETS[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},c.CHARSETS.A={"#":"£"},c.CHARSETS.B=void 0,c.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},c.CHARSETS.C=c.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},c.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},c.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},c.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},c.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},c.CHARSETS.E=c.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},c.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},c.CHARSETS.H=c.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},c.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(p,c)=>{var h,v,S;Object.defineProperty(c,"__esModule",{value:!0}),c.C1_ESCAPED=c.C1=c.C0=void 0,(function(f){f.NUL="\0",f.SOH="",f.STX="",f.ETX="",f.EOT="",f.ENQ="",f.ACK="",f.BEL="\x07",f.BS="\b",f.HT=" ",f.LF=`
|
|
467
|
-
`,f.VT="\v",f.FF="\f",f.CR="\r",f.SO="",f.SI="",f.DLE="",f.DC1="",f.DC2="",f.DC3="",f.DC4="",f.NAK="",f.SYN="",f.ETB="",f.CAN="",f.EM="",f.SUB="",f.ESC="\x1B",f.FS="",f.GS="",f.RS="",f.US="",f.SP=" ",f.DEL=""})(h||(c.C0=h={})),(function(f){f.PAD="",f.HOP="",f.BPH="",f.NBH="",f.IND="",f.NEL="
",f.SSA="",f.ESA="",f.HTS="",f.HTJ="",f.VTS="",f.PLD="",f.PLU="",f.RI="",f.SS2="",f.SS3="",f.DCS="",f.PU1="",f.PU2="",f.STS="",f.CCH="",f.MW="",f.SPA="",f.EPA="",f.SOS="",f.SGCI="",f.SCI="",f.CSI="",f.ST="",f.OSC="",f.PM="",f.APC=""})(v||(c.C1=v={})),(function(f){f.ST=`${h.ESC}\\`})(S||(c.C1_ESCAPED=S={}))},7399:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.evaluateKeyboardEvent=void 0;const v=h(2584),S={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};c.evaluateKeyboardEvent=function(f,x,E,T){const C={type:0,cancel:!1,key:void 0},y=(f.shiftKey?1:0)|(f.altKey?2:0)|(f.ctrlKey?4:0)|(f.metaKey?8:0);switch(f.keyCode){case 0:f.key==="UIKeyInputUpArrow"?C.key=x?v.C0.ESC+"OA":v.C0.ESC+"[A":f.key==="UIKeyInputLeftArrow"?C.key=x?v.C0.ESC+"OD":v.C0.ESC+"[D":f.key==="UIKeyInputRightArrow"?C.key=x?v.C0.ESC+"OC":v.C0.ESC+"[C":f.key==="UIKeyInputDownArrow"&&(C.key=x?v.C0.ESC+"OB":v.C0.ESC+"[B");break;case 8:C.key=f.ctrlKey?"\b":v.C0.DEL,f.altKey&&(C.key=v.C0.ESC+C.key);break;case 9:if(f.shiftKey){C.key=v.C0.ESC+"[Z";break}C.key=v.C0.HT,C.cancel=!0;break;case 13:C.key=f.altKey?v.C0.ESC+v.C0.CR:v.C0.CR,C.cancel=!0;break;case 27:C.key=v.C0.ESC,f.altKey&&(C.key=v.C0.ESC+v.C0.ESC),C.cancel=!0;break;case 37:if(f.metaKey)break;y?(C.key=v.C0.ESC+"[1;"+(y+1)+"D",C.key===v.C0.ESC+"[1;3D"&&(C.key=v.C0.ESC+(E?"b":"[1;5D"))):C.key=x?v.C0.ESC+"OD":v.C0.ESC+"[D";break;case 39:if(f.metaKey)break;y?(C.key=v.C0.ESC+"[1;"+(y+1)+"C",C.key===v.C0.ESC+"[1;3C"&&(C.key=v.C0.ESC+(E?"f":"[1;5C"))):C.key=x?v.C0.ESC+"OC":v.C0.ESC+"[C";break;case 38:if(f.metaKey)break;y?(C.key=v.C0.ESC+"[1;"+(y+1)+"A",E||C.key!==v.C0.ESC+"[1;3A"||(C.key=v.C0.ESC+"[1;5A")):C.key=x?v.C0.ESC+"OA":v.C0.ESC+"[A";break;case 40:if(f.metaKey)break;y?(C.key=v.C0.ESC+"[1;"+(y+1)+"B",E||C.key!==v.C0.ESC+"[1;3B"||(C.key=v.C0.ESC+"[1;5B")):C.key=x?v.C0.ESC+"OB":v.C0.ESC+"[B";break;case 45:f.shiftKey||f.ctrlKey||(C.key=v.C0.ESC+"[2~");break;case 46:C.key=y?v.C0.ESC+"[3;"+(y+1)+"~":v.C0.ESC+"[3~";break;case 36:C.key=y?v.C0.ESC+"[1;"+(y+1)+"H":x?v.C0.ESC+"OH":v.C0.ESC+"[H";break;case 35:C.key=y?v.C0.ESC+"[1;"+(y+1)+"F":x?v.C0.ESC+"OF":v.C0.ESC+"[F";break;case 33:f.shiftKey?C.type=2:f.ctrlKey?C.key=v.C0.ESC+"[5;"+(y+1)+"~":C.key=v.C0.ESC+"[5~";break;case 34:f.shiftKey?C.type=3:f.ctrlKey?C.key=v.C0.ESC+"[6;"+(y+1)+"~":C.key=v.C0.ESC+"[6~";break;case 112:C.key=y?v.C0.ESC+"[1;"+(y+1)+"P":v.C0.ESC+"OP";break;case 113:C.key=y?v.C0.ESC+"[1;"+(y+1)+"Q":v.C0.ESC+"OQ";break;case 114:C.key=y?v.C0.ESC+"[1;"+(y+1)+"R":v.C0.ESC+"OR";break;case 115:C.key=y?v.C0.ESC+"[1;"+(y+1)+"S":v.C0.ESC+"OS";break;case 116:C.key=y?v.C0.ESC+"[15;"+(y+1)+"~":v.C0.ESC+"[15~";break;case 117:C.key=y?v.C0.ESC+"[17;"+(y+1)+"~":v.C0.ESC+"[17~";break;case 118:C.key=y?v.C0.ESC+"[18;"+(y+1)+"~":v.C0.ESC+"[18~";break;case 119:C.key=y?v.C0.ESC+"[19;"+(y+1)+"~":v.C0.ESC+"[19~";break;case 120:C.key=y?v.C0.ESC+"[20;"+(y+1)+"~":v.C0.ESC+"[20~";break;case 121:C.key=y?v.C0.ESC+"[21;"+(y+1)+"~":v.C0.ESC+"[21~";break;case 122:C.key=y?v.C0.ESC+"[23;"+(y+1)+"~":v.C0.ESC+"[23~";break;case 123:C.key=y?v.C0.ESC+"[24;"+(y+1)+"~":v.C0.ESC+"[24~";break;default:if(!f.ctrlKey||f.shiftKey||f.altKey||f.metaKey)if(E&&!T||!f.altKey||f.metaKey)!E||f.altKey||f.ctrlKey||f.shiftKey||!f.metaKey?f.key&&!f.ctrlKey&&!f.altKey&&!f.metaKey&&f.keyCode>=48&&f.key.length===1?C.key=f.key:f.key&&f.ctrlKey&&(f.key==="_"&&(C.key=v.C0.US),f.key==="@"&&(C.key=v.C0.NUL)):f.keyCode===65&&(C.type=1);else{const b=S[f.keyCode],m=b==null?void 0:b[f.shiftKey?1:0];if(m)C.key=v.C0.ESC+m;else if(f.keyCode>=65&&f.keyCode<=90){const g=f.ctrlKey?f.keyCode-64:f.keyCode+32;let k=String.fromCharCode(g);f.shiftKey&&(k=k.toUpperCase()),C.key=v.C0.ESC+k}else if(f.keyCode===32)C.key=v.C0.ESC+(f.ctrlKey?v.C0.NUL:" ");else if(f.key==="Dead"&&f.code.startsWith("Key")){let g=f.code.slice(3,4);f.shiftKey||(g=g.toLowerCase()),C.key=v.C0.ESC+g,C.cancel=!0}}else f.keyCode>=65&&f.keyCode<=90?C.key=String.fromCharCode(f.keyCode-64):f.keyCode===32?C.key=v.C0.NUL:f.keyCode>=51&&f.keyCode<=55?C.key=String.fromCharCode(f.keyCode-51+27):f.keyCode===56?C.key=v.C0.DEL:f.keyCode===219?C.key=v.C0.ESC:f.keyCode===220?C.key=v.C0.FS:f.keyCode===221&&(C.key=v.C0.GS)}return C}},482:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Utf8ToUtf32=c.StringToUtf32=c.utf32ToString=c.stringFromCodePoint=void 0,c.stringFromCodePoint=function(h){return h>65535?(h-=65536,String.fromCharCode(55296+(h>>10))+String.fromCharCode(h%1024+56320)):String.fromCharCode(h)},c.utf32ToString=function(h,v=0,S=h.length){let f="";for(let x=v;x<S;++x){let E=h[x];E>65535?(E-=65536,f+=String.fromCharCode(55296+(E>>10))+String.fromCharCode(E%1024+56320)):f+=String.fromCharCode(E)}return f},c.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(h,v){const S=h.length;if(!S)return 0;let f=0,x=0;if(this._interim){const E=h.charCodeAt(x++);56320<=E&&E<=57343?v[f++]=1024*(this._interim-55296)+E-56320+65536:(v[f++]=this._interim,v[f++]=E),this._interim=0}for(let E=x;E<S;++E){const T=h.charCodeAt(E);if(55296<=T&&T<=56319){if(++E>=S)return this._interim=T,f;const C=h.charCodeAt(E);56320<=C&&C<=57343?v[f++]=1024*(T-55296)+C-56320+65536:(v[f++]=T,v[f++]=C)}else T!==65279&&(v[f++]=T)}return f}},c.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(h,v){const S=h.length;if(!S)return 0;let f,x,E,T,C=0,y=0,b=0;if(this.interim[0]){let k=!1,M=this.interim[0];M&=(224&M)==192?31:(240&M)==224?15:7;let R,j=0;for(;(R=63&this.interim[++j])&&j<4;)M<<=6,M|=R;const A=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,D=A-j;for(;b<D;){if(b>=S)return 0;if(R=h[b++],(192&R)!=128){b--,k=!0;break}this.interim[j++]=R,M<<=6,M|=63&R}k||(A===2?M<128?b--:v[C++]=M:A===3?M<2048||M>=55296&&M<=57343||M===65279||(v[C++]=M):M<65536||M>1114111||(v[C++]=M)),this.interim.fill(0)}const m=S-4;let g=b;for(;g<S;){for(;!(!(g<m)||128&(f=h[g])||128&(x=h[g+1])||128&(E=h[g+2])||128&(T=h[g+3]));)v[C++]=f,v[C++]=x,v[C++]=E,v[C++]=T,g+=4;if(f=h[g++],f<128)v[C++]=f;else if((224&f)==192){if(g>=S)return this.interim[0]=f,C;if(x=h[g++],(192&x)!=128){g--;continue}if(y=(31&f)<<6|63&x,y<128){g--;continue}v[C++]=y}else if((240&f)==224){if(g>=S)return this.interim[0]=f,C;if(x=h[g++],(192&x)!=128){g--;continue}if(g>=S)return this.interim[0]=f,this.interim[1]=x,C;if(E=h[g++],(192&E)!=128){g--;continue}if(y=(15&f)<<12|(63&x)<<6|63&E,y<2048||y>=55296&&y<=57343||y===65279)continue;v[C++]=y}else if((248&f)==240){if(g>=S)return this.interim[0]=f,C;if(x=h[g++],(192&x)!=128){g--;continue}if(g>=S)return this.interim[0]=f,this.interim[1]=x,C;if(E=h[g++],(192&E)!=128){g--;continue}if(g>=S)return this.interim[0]=f,this.interim[1]=x,this.interim[2]=E,C;if(T=h[g++],(192&T)!=128){g--;continue}if(y=(7&f)<<18|(63&x)<<12|(63&E)<<6|63&T,y<65536||y>1114111)continue;v[C++]=y}}return C}}},225:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.UnicodeV6=void 0;const v=h(1480),S=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],f=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let x;c.UnicodeV6=class{constructor(){if(this.version="6",!x){x=new Uint8Array(65536),x.fill(1),x[0]=0,x.fill(0,1,32),x.fill(0,127,160),x.fill(2,4352,4448),x[9001]=2,x[9002]=2,x.fill(2,11904,42192),x[12351]=1,x.fill(2,44032,55204),x.fill(2,63744,64256),x.fill(2,65040,65050),x.fill(2,65072,65136),x.fill(2,65280,65377),x.fill(2,65504,65511);for(let E=0;E<S.length;++E)x.fill(0,S[E][0],S[E][1]+1)}}wcwidth(E){return E<32?0:E<127?1:E<65536?x[E]:(function(T,C){let y,b=0,m=C.length-1;if(T<C[0][0]||T>C[m][1])return!1;for(;m>=b;)if(y=b+m>>1,T>C[y][1])b=y+1;else{if(!(T<C[y][0]))return!0;m=y-1}return!1})(E,f)?0:E>=131072&&E<=196605||E>=196608&&E<=262141?2:1}charProperties(E,T){let C=this.wcwidth(E),y=C===0&&T!==0;if(y){const b=v.UnicodeService.extractWidth(T);b===0?y=!1:b>C&&(C=b)}return v.UnicodeService.createPropertyValue(0,C,y)}}},5981:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.WriteBuffer=void 0;const v=h(8460),S=h(844);class f extends S.Disposable{constructor(E){super(),this._action=E,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new v.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(E,T){if(T!==void 0&&this._syncCalls>T)return void(this._syncCalls=0);if(this._pendingData+=E.length,this._writeBuffer.push(E),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let C;for(this._isSyncWriting=!0;C=this._writeBuffer.shift();){this._action(C);const y=this._callbacks.shift();y&&y()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(E,T){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=E.length,this._writeBuffer.push(E),this._callbacks.push(T),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=E.length,this._writeBuffer.push(E),this._callbacks.push(T)}_innerWrite(E=0,T=!0){const C=E||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const y=this._writeBuffer[this._bufferOffset],b=this._action(y,T);if(b){const g=k=>Date.now()-C>=12?setTimeout((()=>this._innerWrite(0,k))):this._innerWrite(C,k);return void b.catch((k=>(queueMicrotask((()=>{throw k})),Promise.resolve(!1)))).then(g)}const m=this._callbacks[this._bufferOffset];if(m&&m(),this._bufferOffset++,this._pendingData-=y.length,Date.now()-C>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}c.WriteBuffer=f},5941:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.toRgbString=c.parseColor=void 0;const h=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,v=/^[\da-f]+$/;function S(f,x){const E=f.toString(16),T=E.length<2?"0"+E:E;switch(x){case 4:return E[0];case 8:return T;case 12:return(T+T).slice(0,3);default:return T+T}}c.parseColor=function(f){if(!f)return;let x=f.toLowerCase();if(x.indexOf("rgb:")===0){x=x.slice(4);const E=h.exec(x);if(E){const T=E[1]?15:E[4]?255:E[7]?4095:65535;return[Math.round(parseInt(E[1]||E[4]||E[7]||E[10],16)/T*255),Math.round(parseInt(E[2]||E[5]||E[8]||E[11],16)/T*255),Math.round(parseInt(E[3]||E[6]||E[9]||E[12],16)/T*255)]}}else if(x.indexOf("#")===0&&(x=x.slice(1),v.exec(x)&&[3,6,9,12].includes(x.length))){const E=x.length/3,T=[0,0,0];for(let C=0;C<3;++C){const y=parseInt(x.slice(E*C,E*C+E),16);T[C]=E===1?y<<4:E===2?y:E===3?y>>4:y>>8}return T}},c.toRgbString=function(f,x=16){const[E,T,C]=f;return`rgb:${S(E,x)}/${S(T,x)}/${S(C,x)}`}},5770:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.PAYLOAD_LIMIT=void 0,c.PAYLOAD_LIMIT=1e7},6351:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.DcsHandler=c.DcsParser=void 0;const v=h(482),S=h(8742),f=h(5770),x=[];c.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=x,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=x}registerHandler(T,C){this._handlers[T]===void 0&&(this._handlers[T]=[]);const y=this._handlers[T];return y.push(C),{dispose:()=>{const b=y.indexOf(C);b!==-1&&y.splice(b,1)}}}clearHandler(T){this._handlers[T]&&delete this._handlers[T]}setHandlerFallback(T){this._handlerFb=T}reset(){if(this._active.length)for(let T=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;T>=0;--T)this._active[T].unhook(!1);this._stack.paused=!1,this._active=x,this._ident=0}hook(T,C){if(this.reset(),this._ident=T,this._active=this._handlers[T]||x,this._active.length)for(let y=this._active.length-1;y>=0;y--)this._active[y].hook(C);else this._handlerFb(this._ident,"HOOK",C)}put(T,C,y){if(this._active.length)for(let b=this._active.length-1;b>=0;b--)this._active[b].put(T,C,y);else this._handlerFb(this._ident,"PUT",(0,v.utf32ToString)(T,C,y))}unhook(T,C=!0){if(this._active.length){let y=!1,b=this._active.length-1,m=!1;if(this._stack.paused&&(b=this._stack.loopPosition-1,y=C,m=this._stack.fallThrough,this._stack.paused=!1),!m&&y===!1){for(;b>=0&&(y=this._active[b].unhook(T),y!==!0);b--)if(y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=b,this._stack.fallThrough=!1,y;b--}for(;b>=0;b--)if(y=this._active[b].unhook(!1),y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=b,this._stack.fallThrough=!0,y}else this._handlerFb(this._ident,"UNHOOK",T);this._active=x,this._ident=0}};const E=new S.Params;E.addParam(0),c.DcsHandler=class{constructor(T){this._handler=T,this._data="",this._params=E,this._hitLimit=!1}hook(T){this._params=T.length>1||T.params[0]?T.clone():E,this._data="",this._hitLimit=!1}put(T,C,y){this._hitLimit||(this._data+=(0,v.utf32ToString)(T,C,y),this._data.length>f.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(T){let C=!1;if(this._hitLimit)C=!1;else if(T&&(C=this._handler(this._data,this._params),C instanceof Promise))return C.then((y=>(this._params=E,this._data="",this._hitLimit=!1,y)));return this._params=E,this._data="",this._hitLimit=!1,C}}},2015:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.EscapeSequenceParser=c.VT500_TRANSITION_TABLE=c.TransitionTable=void 0;const v=h(844),S=h(8742),f=h(6242),x=h(6351);class E{constructor(b){this.table=new Uint8Array(b)}setDefault(b,m){this.table.fill(b<<4|m)}add(b,m,g,k){this.table[m<<8|b]=g<<4|k}addMany(b,m,g,k){for(let M=0;M<b.length;M++)this.table[m<<8|b[M]]=g<<4|k}}c.TransitionTable=E;const T=160;c.VT500_TRANSITION_TABLE=(function(){const y=new E(4095),b=Array.apply(null,Array(256)).map(((j,A)=>A)),m=(j,A)=>b.slice(j,A),g=m(32,127),k=m(0,24);k.push(25),k.push.apply(k,m(28,32));const M=m(0,14);let R;for(R in y.setDefault(1,0),y.addMany(g,0,2,0),M)y.addMany([24,26,153,154],R,3,0),y.addMany(m(128,144),R,3,0),y.addMany(m(144,152),R,3,0),y.add(156,R,0,0),y.add(27,R,11,1),y.add(157,R,4,8),y.addMany([152,158,159],R,0,7),y.add(155,R,11,3),y.add(144,R,11,9);return y.addMany(k,0,3,0),y.addMany(k,1,3,1),y.add(127,1,0,1),y.addMany(k,8,0,8),y.addMany(k,3,3,3),y.add(127,3,0,3),y.addMany(k,4,3,4),y.add(127,4,0,4),y.addMany(k,6,3,6),y.addMany(k,5,3,5),y.add(127,5,0,5),y.addMany(k,2,3,2),y.add(127,2,0,2),y.add(93,1,4,8),y.addMany(g,8,5,8),y.add(127,8,5,8),y.addMany([156,27,24,26,7],8,6,0),y.addMany(m(28,32),8,0,8),y.addMany([88,94,95],1,0,7),y.addMany(g,7,0,7),y.addMany(k,7,0,7),y.add(156,7,0,0),y.add(127,7,0,7),y.add(91,1,11,3),y.addMany(m(64,127),3,7,0),y.addMany(m(48,60),3,8,4),y.addMany([60,61,62,63],3,9,4),y.addMany(m(48,60),4,8,4),y.addMany(m(64,127),4,7,0),y.addMany([60,61,62,63],4,0,6),y.addMany(m(32,64),6,0,6),y.add(127,6,0,6),y.addMany(m(64,127),6,0,0),y.addMany(m(32,48),3,9,5),y.addMany(m(32,48),5,9,5),y.addMany(m(48,64),5,0,6),y.addMany(m(64,127),5,7,0),y.addMany(m(32,48),4,9,5),y.addMany(m(32,48),1,9,2),y.addMany(m(32,48),2,9,2),y.addMany(m(48,127),2,10,0),y.addMany(m(48,80),1,10,0),y.addMany(m(81,88),1,10,0),y.addMany([89,90,92],1,10,0),y.addMany(m(96,127),1,10,0),y.add(80,1,11,9),y.addMany(k,9,0,9),y.add(127,9,0,9),y.addMany(m(28,32),9,0,9),y.addMany(m(32,48),9,9,12),y.addMany(m(48,60),9,8,10),y.addMany([60,61,62,63],9,9,10),y.addMany(k,11,0,11),y.addMany(m(32,128),11,0,11),y.addMany(m(28,32),11,0,11),y.addMany(k,10,0,10),y.add(127,10,0,10),y.addMany(m(28,32),10,0,10),y.addMany(m(48,60),10,8,10),y.addMany([60,61,62,63],10,0,11),y.addMany(m(32,48),10,9,12),y.addMany(k,12,0,12),y.add(127,12,0,12),y.addMany(m(28,32),12,0,12),y.addMany(m(32,48),12,9,12),y.addMany(m(48,64),12,0,11),y.addMany(m(64,127),12,12,13),y.addMany(m(64,127),10,12,13),y.addMany(m(64,127),9,12,13),y.addMany(k,13,13,13),y.addMany(g,13,13,13),y.add(127,13,0,13),y.addMany([27,156,24,26],13,14,0),y.add(T,0,2,0),y.add(T,8,5,8),y.add(T,6,0,6),y.add(T,11,0,11),y.add(T,13,13,13),y})();class C extends v.Disposable{constructor(b=c.VT500_TRANSITION_TABLE){super(),this._transitions=b,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new S.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(m,g,k)=>{},this._executeHandlerFb=m=>{},this._csiHandlerFb=(m,g)=>{},this._escHandlerFb=m=>{},this._errorHandlerFb=m=>m,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,v.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new f.OscParser),this._dcsParser=this.register(new x.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(b,m=[64,126]){let g=0;if(b.prefix){if(b.prefix.length>1)throw new Error("only one byte as prefix supported");if(g=b.prefix.charCodeAt(0),g&&60>g||g>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(b.intermediates){if(b.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let M=0;M<b.intermediates.length;++M){const R=b.intermediates.charCodeAt(M);if(32>R||R>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");g<<=8,g|=R}}if(b.final.length!==1)throw new Error("final must be a single byte");const k=b.final.charCodeAt(0);if(m[0]>k||k>m[1])throw new Error(`final must be in range ${m[0]} .. ${m[1]}`);return g<<=8,g|=k,g}identToString(b){const m=[];for(;b;)m.push(String.fromCharCode(255&b)),b>>=8;return m.reverse().join("")}setPrintHandler(b){this._printHandler=b}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(b,m){const g=this._identifier(b,[48,126]);this._escHandlers[g]===void 0&&(this._escHandlers[g]=[]);const k=this._escHandlers[g];return k.push(m),{dispose:()=>{const M=k.indexOf(m);M!==-1&&k.splice(M,1)}}}clearEscHandler(b){this._escHandlers[this._identifier(b,[48,126])]&&delete this._escHandlers[this._identifier(b,[48,126])]}setEscHandlerFallback(b){this._escHandlerFb=b}setExecuteHandler(b,m){this._executeHandlers[b.charCodeAt(0)]=m}clearExecuteHandler(b){this._executeHandlers[b.charCodeAt(0)]&&delete this._executeHandlers[b.charCodeAt(0)]}setExecuteHandlerFallback(b){this._executeHandlerFb=b}registerCsiHandler(b,m){const g=this._identifier(b);this._csiHandlers[g]===void 0&&(this._csiHandlers[g]=[]);const k=this._csiHandlers[g];return k.push(m),{dispose:()=>{const M=k.indexOf(m);M!==-1&&k.splice(M,1)}}}clearCsiHandler(b){this._csiHandlers[this._identifier(b)]&&delete this._csiHandlers[this._identifier(b)]}setCsiHandlerFallback(b){this._csiHandlerFb=b}registerDcsHandler(b,m){return this._dcsParser.registerHandler(this._identifier(b),m)}clearDcsHandler(b){this._dcsParser.clearHandler(this._identifier(b))}setDcsHandlerFallback(b){this._dcsParser.setHandlerFallback(b)}registerOscHandler(b,m){return this._oscParser.registerHandler(b,m)}clearOscHandler(b){this._oscParser.clearHandler(b)}setOscHandlerFallback(b){this._oscParser.setHandlerFallback(b)}setErrorHandler(b){this._errorHandler=b}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(b,m,g,k,M){this._parseStack.state=b,this._parseStack.handlers=m,this._parseStack.handlerPos=g,this._parseStack.transition=k,this._parseStack.chunkPos=M}parse(b,m,g){let k,M=0,R=0,j=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,j=this._parseStack.chunkPos+1;else{if(g===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const A=this._parseStack.handlers;let D=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(g===!1&&D>-1){for(;D>=0&&(k=A[D](this._params),k!==!0);D--)if(k instanceof Promise)return this._parseStack.handlerPos=D,k}this._parseStack.handlers=[];break;case 4:if(g===!1&&D>-1){for(;D>=0&&(k=A[D](),k!==!0);D--)if(k instanceof Promise)return this._parseStack.handlerPos=D,k}this._parseStack.handlers=[];break;case 6:if(M=b[this._parseStack.chunkPos],k=this._dcsParser.unhook(M!==24&&M!==26,g),k)return k;M===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(M=b[this._parseStack.chunkPos],k=this._oscParser.end(M!==24&&M!==26,g),k)return k;M===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,j=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let A=j;A<m;++A){switch(M=b[A],R=this._transitions.table[this.currentState<<8|(M<160?M:T)],R>>4){case 2:for(let U=A+1;;++U){if(U>=m||(M=b[U])<32||M>126&&M<T){this._printHandler(b,A,U),A=U-1;break}if(++U>=m||(M=b[U])<32||M>126&&M<T){this._printHandler(b,A,U),A=U-1;break}if(++U>=m||(M=b[U])<32||M>126&&M<T){this._printHandler(b,A,U),A=U-1;break}if(++U>=m||(M=b[U])<32||M>126&&M<T){this._printHandler(b,A,U),A=U-1;break}}break;case 3:this._executeHandlers[M]?this._executeHandlers[M]():this._executeHandlerFb(M),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:A,code:M,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const D=this._csiHandlers[this._collect<<8|M];let I=D?D.length-1:-1;for(;I>=0&&(k=D[I](this._params),k!==!0);I--)if(k instanceof Promise)return this._preserveStack(3,D,I,R,A),k;I<0&&this._csiHandlerFb(this._collect<<8|M,this._params),this.precedingJoinState=0;break;case 8:do switch(M){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(M-48)}while(++A<m&&(M=b[A])>47&&M<60);A--;break;case 9:this._collect<<=8,this._collect|=M;break;case 10:const q=this._escHandlers[this._collect<<8|M];let G=q?q.length-1:-1;for(;G>=0&&(k=q[G](),k!==!0);G--)if(k instanceof Promise)return this._preserveStack(4,q,G,R,A),k;G<0&&this._escHandlerFb(this._collect<<8|M),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|M,this._params);break;case 13:for(let U=A+1;;++U)if(U>=m||(M=b[U])===24||M===26||M===27||M>127&&M<T){this._dcsParser.put(b,A,U),A=U-1;break}break;case 14:if(k=this._dcsParser.unhook(M!==24&&M!==26),k)return this._preserveStack(6,[],0,R,A),k;M===27&&(R|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let U=A+1;;U++)if(U>=m||(M=b[U])<32||M>127&&M<T){this._oscParser.put(b,A,U),A=U-1;break}break;case 6:if(k=this._oscParser.end(M!==24&&M!==26),k)return this._preserveStack(5,[],0,R,A),k;M===27&&(R|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&R}}}c.EscapeSequenceParser=C},6242:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.OscHandler=c.OscParser=void 0;const v=h(5770),S=h(482),f=[];c.OscParser=class{constructor(){this._state=0,this._active=f,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(x,E){this._handlers[x]===void 0&&(this._handlers[x]=[]);const T=this._handlers[x];return T.push(E),{dispose:()=>{const C=T.indexOf(E);C!==-1&&T.splice(C,1)}}}clearHandler(x){this._handlers[x]&&delete this._handlers[x]}setHandlerFallback(x){this._handlerFb=x}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=f}reset(){if(this._state===2)for(let x=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;x>=0;--x)this._active[x].end(!1);this._stack.paused=!1,this._active=f,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||f,this._active.length)for(let x=this._active.length-1;x>=0;x--)this._active[x].start();else this._handlerFb(this._id,"START")}_put(x,E,T){if(this._active.length)for(let C=this._active.length-1;C>=0;C--)this._active[C].put(x,E,T);else this._handlerFb(this._id,"PUT",(0,S.utf32ToString)(x,E,T))}start(){this.reset(),this._state=1}put(x,E,T){if(this._state!==3){if(this._state===1)for(;E<T;){const C=x[E++];if(C===59){this._state=2,this._start();break}if(C<48||57<C)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+C-48}this._state===2&&T-E>0&&this._put(x,E,T)}}end(x,E=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let T=!1,C=this._active.length-1,y=!1;if(this._stack.paused&&(C=this._stack.loopPosition-1,T=E,y=this._stack.fallThrough,this._stack.paused=!1),!y&&T===!1){for(;C>=0&&(T=this._active[C].end(x),T!==!0);C--)if(T instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=C,this._stack.fallThrough=!1,T;C--}for(;C>=0;C--)if(T=this._active[C].end(!1),T instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=C,this._stack.fallThrough=!0,T}else this._handlerFb(this._id,"END",x);this._active=f,this._id=-1,this._state=0}}},c.OscHandler=class{constructor(x){this._handler=x,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(x,E,T){this._hitLimit||(this._data+=(0,S.utf32ToString)(x,E,T),this._data.length>v.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(x){let E=!1;if(this._hitLimit)E=!1;else if(x&&(E=this._handler(this._data),E instanceof Promise))return E.then((T=>(this._data="",this._hitLimit=!1,T)));return this._data="",this._hitLimit=!1,E}}},8742:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Params=void 0;const h=2147483647;class v{static fromArray(f){const x=new v;if(!f.length)return x;for(let E=Array.isArray(f[0])?1:0;E<f.length;++E){const T=f[E];if(Array.isArray(T))for(let C=0;C<T.length;++C)x.addSubParam(T[C]);else x.addParam(T)}return x}constructor(f=32,x=32){if(this.maxLength=f,this.maxSubParamsLength=x,x>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(f),this.length=0,this._subParams=new Int32Array(x),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(f),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const f=new v(this.maxLength,this.maxSubParamsLength);return f.params.set(this.params),f.length=this.length,f._subParams.set(this._subParams),f._subParamsLength=this._subParamsLength,f._subParamsIdx.set(this._subParamsIdx),f._rejectDigits=this._rejectDigits,f._rejectSubDigits=this._rejectSubDigits,f._digitIsSub=this._digitIsSub,f}toArray(){const f=[];for(let x=0;x<this.length;++x){f.push(this.params[x]);const E=this._subParamsIdx[x]>>8,T=255&this._subParamsIdx[x];T-E>0&&f.push(Array.prototype.slice.call(this._subParams,E,T))}return f}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(f){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(f<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=f>h?h:f}}addSubParam(f){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(f<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=f>h?h:f,this._subParamsIdx[this.length-1]++}}hasSubParams(f){return(255&this._subParamsIdx[f])-(this._subParamsIdx[f]>>8)>0}getSubParams(f){const x=this._subParamsIdx[f]>>8,E=255&this._subParamsIdx[f];return E-x>0?this._subParams.subarray(x,E):null}getSubParamsAll(){const f={};for(let x=0;x<this.length;++x){const E=this._subParamsIdx[x]>>8,T=255&this._subParamsIdx[x];T-E>0&&(f[x]=this._subParams.slice(E,T))}return f}addDigit(f){let x;if(this._rejectDigits||!(x=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const E=this._digitIsSub?this._subParams:this.params,T=E[x-1];E[x-1]=~T?Math.min(10*T+f,h):f}}c.Params=v},5741:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.AddonManager=void 0,c.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let h=this._addons.length-1;h>=0;h--)this._addons[h].instance.dispose()}loadAddon(h,v){const S={instance:v,dispose:v.dispose,isDisposed:!1};this._addons.push(S),v.dispose=()=>this._wrappedAddonDispose(S),v.activate(h)}_wrappedAddonDispose(h){if(h.isDisposed)return;let v=-1;for(let S=0;S<this._addons.length;S++)if(this._addons[S]===h){v=S;break}if(v===-1)throw new Error("Could not dispose an addon that has not been loaded");h.isDisposed=!0,h.dispose.apply(h.instance),this._addons.splice(v,1)}}},8771:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferApiView=void 0;const v=h(3785),S=h(511);c.BufferApiView=class{constructor(f,x){this._buffer=f,this.type=x}init(f){return this._buffer=f,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(f){const x=this._buffer.lines.get(f);if(x)return new v.BufferLineApiView(x)}getNullCell(){return new S.CellData}}},3785:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferLineApiView=void 0;const v=h(511);c.BufferLineApiView=class{constructor(S){this._line=S}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(S,f){if(!(S<0||S>=this._line.length))return f?(this._line.loadCell(S,f),f):this._line.loadCell(S,new v.CellData)}translateToString(S,f,x){return this._line.translateToString(S,f,x)}}},8285:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferNamespaceApi=void 0;const v=h(8771),S=h(8460),f=h(844);class x extends f.Disposable{constructor(T){super(),this._core=T,this._onBufferChange=this.register(new S.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new v.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new v.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}c.BufferNamespaceApi=x},7975:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ParserApi=void 0,c.ParserApi=class{constructor(h){this._core=h}registerCsiHandler(h,v){return this._core.registerCsiHandler(h,(S=>v(S.toArray())))}addCsiHandler(h,v){return this.registerCsiHandler(h,v)}registerDcsHandler(h,v){return this._core.registerDcsHandler(h,((S,f)=>v(S,f.toArray())))}addDcsHandler(h,v){return this.registerDcsHandler(h,v)}registerEscHandler(h,v){return this._core.registerEscHandler(h,v)}addEscHandler(h,v){return this.registerEscHandler(h,v)}registerOscHandler(h,v){return this._core.registerOscHandler(h,v)}addOscHandler(h,v){return this.registerOscHandler(h,v)}}},7090:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.UnicodeApi=void 0,c.UnicodeApi=class{constructor(h){this._core=h}register(h){this._core.unicodeService.register(h)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(h){this._core.unicodeService.activeVersion=h}}},744:function(p,c,h){var v=this&&this.__decorate||function(y,b,m,g){var k,M=arguments.length,R=M<3?b:g===null?g=Object.getOwnPropertyDescriptor(b,m):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(y,b,m,g);else for(var j=y.length-1;j>=0;j--)(k=y[j])&&(R=(M<3?k(R):M>3?k(b,m,R):k(b,m))||R);return M>3&&R&&Object.defineProperty(b,m,R),R},S=this&&this.__param||function(y,b){return function(m,g){b(m,g,y)}};Object.defineProperty(c,"__esModule",{value:!0}),c.BufferService=c.MINIMUM_ROWS=c.MINIMUM_COLS=void 0;const f=h(8460),x=h(844),E=h(5295),T=h(2585);c.MINIMUM_COLS=2,c.MINIMUM_ROWS=1;let C=c.BufferService=class extends x.Disposable{get buffer(){return this.buffers.active}constructor(y){super(),this.isUserScrolling=!1,this._onResize=this.register(new f.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new f.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(y.rawOptions.cols||0,c.MINIMUM_COLS),this.rows=Math.max(y.rawOptions.rows||0,c.MINIMUM_ROWS),this.buffers=this.register(new E.BufferSet(y,this))}resize(y,b){this.cols=y,this.rows=b,this.buffers.resize(y,b),this._onResize.fire({cols:y,rows:b})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(y,b=!1){const m=this.buffer;let g;g=this._cachedBlankLine,g&&g.length===this.cols&&g.getFg(0)===y.fg&&g.getBg(0)===y.bg||(g=m.getBlankLine(y,b),this._cachedBlankLine=g),g.isWrapped=b;const k=m.ybase+m.scrollTop,M=m.ybase+m.scrollBottom;if(m.scrollTop===0){const R=m.lines.isFull;M===m.lines.length-1?R?m.lines.recycle().copyFrom(g):m.lines.push(g.clone()):m.lines.splice(M+1,0,g.clone()),R?this.isUserScrolling&&(m.ydisp=Math.max(m.ydisp-1,0)):(m.ybase++,this.isUserScrolling||m.ydisp++)}else{const R=M-k+1;m.lines.shiftElements(k+1,R-1,-1),m.lines.set(M,g.clone())}this.isUserScrolling||(m.ydisp=m.ybase),this._onScroll.fire(m.ydisp)}scrollLines(y,b,m){const g=this.buffer;if(y<0){if(g.ydisp===0)return;this.isUserScrolling=!0}else y+g.ydisp>=g.ybase&&(this.isUserScrolling=!1);const k=g.ydisp;g.ydisp=Math.max(Math.min(g.ydisp+y,g.ybase),0),k!==g.ydisp&&(b||this._onScroll.fire(g.ydisp))}};c.BufferService=C=v([S(0,T.IOptionsService)],C)},7994:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CharsetService=void 0,c.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(h){this.glevel=h,this.charset=this._charsets[h]}setgCharset(h,v){this._charsets[h]=v,this.glevel===h&&(this.charset=v)}}},1753:function(p,c,h){var v=this&&this.__decorate||function(g,k,M,R){var j,A=arguments.length,D=A<3?k:R===null?R=Object.getOwnPropertyDescriptor(k,M):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(g,k,M,R);else for(var I=g.length-1;I>=0;I--)(j=g[I])&&(D=(A<3?j(D):A>3?j(k,M,D):j(k,M))||D);return A>3&&D&&Object.defineProperty(k,M,D),D},S=this&&this.__param||function(g,k){return function(M,R){k(M,R,g)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CoreMouseService=void 0;const f=h(2585),x=h(8460),E=h(844),T={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:g=>g.button!==4&&g.action===1&&(g.ctrl=!1,g.alt=!1,g.shift=!1,!0)},VT200:{events:19,restrict:g=>g.action!==32},DRAG:{events:23,restrict:g=>g.action!==32||g.button!==3},ANY:{events:31,restrict:g=>!0}};function C(g,k){let M=(g.ctrl?16:0)|(g.shift?4:0)|(g.alt?8:0);return g.button===4?(M|=64,M|=g.action):(M|=3&g.button,4&g.button&&(M|=64),8&g.button&&(M|=128),g.action===32?M|=32:g.action!==0||k||(M|=3)),M}const y=String.fromCharCode,b={DEFAULT:g=>{const k=[C(g,!1)+32,g.col+32,g.row+32];return k[0]>255||k[1]>255||k[2]>255?"":`\x1B[M${y(k[0])}${y(k[1])}${y(k[2])}`},SGR:g=>{const k=g.action===0&&g.button!==4?"m":"M";return`\x1B[<${C(g,!0)};${g.col};${g.row}${k}`},SGR_PIXELS:g=>{const k=g.action===0&&g.button!==4?"m":"M";return`\x1B[<${C(g,!0)};${g.x};${g.y}${k}`}};let m=c.CoreMouseService=class extends E.Disposable{constructor(g,k){super(),this._bufferService=g,this._coreService=k,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new x.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const M of Object.keys(T))this.addProtocol(M,T[M]);for(const M of Object.keys(b))this.addEncoding(M,b[M]);this.reset()}addProtocol(g,k){this._protocols[g]=k}addEncoding(g,k){this._encodings[g]=k}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(g){if(!this._protocols[g])throw new Error(`unknown protocol "${g}"`);this._activeProtocol=g,this._onProtocolChange.fire(this._protocols[g].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(g){if(!this._encodings[g])throw new Error(`unknown encoding "${g}"`);this._activeEncoding=g}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(g){if(g.col<0||g.col>=this._bufferService.cols||g.row<0||g.row>=this._bufferService.rows||g.button===4&&g.action===32||g.button===3&&g.action!==32||g.button!==4&&(g.action===2||g.action===3)||(g.col++,g.row++,g.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,g,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(g))return!1;const k=this._encodings[this._activeEncoding](g);return k&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(k):this._coreService.triggerDataEvent(k,!0)),this._lastEvent=g,!0}explainEvents(g){return{down:!!(1&g),up:!!(2&g),drag:!!(4&g),move:!!(8&g),wheel:!!(16&g)}}_equalEvents(g,k,M){if(M){if(g.x!==k.x||g.y!==k.y)return!1}else if(g.col!==k.col||g.row!==k.row)return!1;return g.button===k.button&&g.action===k.action&&g.ctrl===k.ctrl&&g.alt===k.alt&&g.shift===k.shift}};c.CoreMouseService=m=v([S(0,f.IBufferService),S(1,f.ICoreService)],m)},6975:function(p,c,h){var v=this&&this.__decorate||function(m,g,k,M){var R,j=arguments.length,A=j<3?g:M===null?M=Object.getOwnPropertyDescriptor(g,k):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(m,g,k,M);else for(var D=m.length-1;D>=0;D--)(R=m[D])&&(A=(j<3?R(A):j>3?R(g,k,A):R(g,k))||A);return j>3&&A&&Object.defineProperty(g,k,A),A},S=this&&this.__param||function(m,g){return function(k,M){g(k,M,m)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CoreService=void 0;const f=h(1439),x=h(8460),E=h(844),T=h(2585),C=Object.freeze({insertMode:!1}),y=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let b=c.CoreService=class extends E.Disposable{constructor(m,g,k){super(),this._bufferService=m,this._logService=g,this._optionsService=k,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new x.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new x.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new x.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new x.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,f.clone)(C),this.decPrivateModes=(0,f.clone)(y)}reset(){this.modes=(0,f.clone)(C),this.decPrivateModes=(0,f.clone)(y)}triggerDataEvent(m,g=!1){if(this._optionsService.rawOptions.disableStdin)return;const k=this._bufferService.buffer;g&&this._optionsService.rawOptions.scrollOnUserInput&&k.ybase!==k.ydisp&&this._onRequestScrollToBottom.fire(),g&&this._onUserInput.fire(),this._logService.debug(`sending data "${m}"`,(()=>m.split("").map((M=>M.charCodeAt(0))))),this._onData.fire(m)}triggerBinaryEvent(m){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${m}"`,(()=>m.split("").map((g=>g.charCodeAt(0))))),this._onBinary.fire(m))}};c.CoreService=b=v([S(0,T.IBufferService),S(1,T.ILogService),S(2,T.IOptionsService)],b)},9074:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.DecorationService=void 0;const v=h(8055),S=h(8460),f=h(844),x=h(6106);let E=0,T=0;class C extends f.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new x.SortedList((m=>m==null?void 0:m.marker.line)),this._onDecorationRegistered=this.register(new S.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new S.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,f.toDisposable)((()=>this.reset())))}registerDecoration(m){if(m.marker.isDisposed)return;const g=new y(m);if(g){const k=g.marker.onDispose((()=>g.dispose()));g.onDispose((()=>{g&&(this._decorations.delete(g)&&this._onDecorationRemoved.fire(g),k.dispose())})),this._decorations.insert(g),this._onDecorationRegistered.fire(g)}return g}reset(){for(const m of this._decorations.values())m.dispose();this._decorations.clear()}*getDecorationsAtCell(m,g,k){let M=0,R=0;for(const j of this._decorations.getKeyIterator(g))M=j.options.x??0,R=M+(j.options.width??1),m>=M&&m<R&&(!k||(j.options.layer??"bottom")===k)&&(yield j)}forEachDecorationAtCell(m,g,k,M){this._decorations.forEachByKey(g,(R=>{E=R.options.x??0,T=E+(R.options.width??1),m>=E&&m<T&&(!k||(R.options.layer??"bottom")===k)&&M(R)}))}}c.DecorationService=C;class y extends f.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=v.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=v.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(m){super(),this.options=m,this.onRenderEmitter=this.register(new S.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new S.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=m.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.InstantiationService=c.ServiceCollection=void 0;const v=h(2585),S=h(8343);class f{constructor(...E){this._entries=new Map;for(const[T,C]of E)this.set(T,C)}set(E,T){const C=this._entries.get(E);return this._entries.set(E,T),C}forEach(E){for(const[T,C]of this._entries.entries())E(T,C)}has(E){return this._entries.has(E)}get(E){return this._entries.get(E)}}c.ServiceCollection=f,c.InstantiationService=class{constructor(){this._services=new f,this._services.set(v.IInstantiationService,this)}setService(x,E){this._services.set(x,E)}getService(x){return this._services.get(x)}createInstance(x,...E){const T=(0,S.getServiceDependencies)(x).sort(((b,m)=>b.index-m.index)),C=[];for(const b of T){const m=this._services.get(b.id);if(!m)throw new Error(`[createInstance] ${x.name} depends on UNKNOWN service ${b.id}.`);C.push(m)}const y=T.length>0?T[0].index:E.length;if(E.length!==y)throw new Error(`[createInstance] First service dependency of ${x.name} at position ${y+1} conflicts with ${E.length} static arguments`);return new x(...E,...C)}}},7866:function(p,c,h){var v=this&&this.__decorate||function(y,b,m,g){var k,M=arguments.length,R=M<3?b:g===null?g=Object.getOwnPropertyDescriptor(b,m):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(y,b,m,g);else for(var j=y.length-1;j>=0;j--)(k=y[j])&&(R=(M<3?k(R):M>3?k(b,m,R):k(b,m))||R);return M>3&&R&&Object.defineProperty(b,m,R),R},S=this&&this.__param||function(y,b){return function(m,g){b(m,g,y)}};Object.defineProperty(c,"__esModule",{value:!0}),c.traceCall=c.setTraceLogger=c.LogService=void 0;const f=h(844),x=h(2585),E={trace:x.LogLevelEnum.TRACE,debug:x.LogLevelEnum.DEBUG,info:x.LogLevelEnum.INFO,warn:x.LogLevelEnum.WARN,error:x.LogLevelEnum.ERROR,off:x.LogLevelEnum.OFF};let T,C=c.LogService=class extends f.Disposable{get logLevel(){return this._logLevel}constructor(y){super(),this._optionsService=y,this._logLevel=x.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),T=this}_updateLogLevel(){this._logLevel=E[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(y){for(let b=0;b<y.length;b++)typeof y[b]=="function"&&(y[b]=y[b]())}_log(y,b,m){this._evalLazyOptionalParams(m),y.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+b,...m)}trace(y,...b){var m;this._logLevel<=x.LogLevelEnum.TRACE&&this._log(((m=this._optionsService.options.logger)==null?void 0:m.trace.bind(this._optionsService.options.logger))??console.log,y,b)}debug(y,...b){var m;this._logLevel<=x.LogLevelEnum.DEBUG&&this._log(((m=this._optionsService.options.logger)==null?void 0:m.debug.bind(this._optionsService.options.logger))??console.log,y,b)}info(y,...b){var m;this._logLevel<=x.LogLevelEnum.INFO&&this._log(((m=this._optionsService.options.logger)==null?void 0:m.info.bind(this._optionsService.options.logger))??console.info,y,b)}warn(y,...b){var m;this._logLevel<=x.LogLevelEnum.WARN&&this._log(((m=this._optionsService.options.logger)==null?void 0:m.warn.bind(this._optionsService.options.logger))??console.warn,y,b)}error(y,...b){var m;this._logLevel<=x.LogLevelEnum.ERROR&&this._log(((m=this._optionsService.options.logger)==null?void 0:m.error.bind(this._optionsService.options.logger))??console.error,y,b)}};c.LogService=C=v([S(0,x.IOptionsService)],C),c.setTraceLogger=function(y){T=y},c.traceCall=function(y,b,m){if(typeof m.value!="function")throw new Error("not supported");const g=m.value;m.value=function(...k){if(T.logLevel!==x.LogLevelEnum.TRACE)return g.apply(this,k);T.trace(`GlyphRenderer#${g.name}(${k.map((R=>JSON.stringify(R))).join(", ")})`);const M=g.apply(this,k);return T.trace(`GlyphRenderer#${g.name} return`,M),M}}},7302:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.OptionsService=c.DEFAULT_OPTIONS=void 0;const v=h(8460),S=h(844),f=h(6114);c.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:f.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const x=["normal","bold","100","200","300","400","500","600","700","800","900"];class E extends S.Disposable{constructor(C){super(),this._onOptionChange=this.register(new v.EventEmitter),this.onOptionChange=this._onOptionChange.event;const y={...c.DEFAULT_OPTIONS};for(const b in C)if(b in y)try{const m=C[b];y[b]=this._sanitizeAndValidateOption(b,m)}catch(m){console.error(m)}this.rawOptions=y,this.options={...y},this._setupOptions(),this.register((0,S.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(C,y){return this.onOptionChange((b=>{b===C&&y(this.rawOptions[C])}))}onMultipleOptionChange(C,y){return this.onOptionChange((b=>{C.indexOf(b)!==-1&&y()}))}_setupOptions(){const C=b=>{if(!(b in c.DEFAULT_OPTIONS))throw new Error(`No option with key "${b}"`);return this.rawOptions[b]},y=(b,m)=>{if(!(b in c.DEFAULT_OPTIONS))throw new Error(`No option with key "${b}"`);m=this._sanitizeAndValidateOption(b,m),this.rawOptions[b]!==m&&(this.rawOptions[b]=m,this._onOptionChange.fire(b))};for(const b in this.rawOptions){const m={get:C.bind(this,b),set:y.bind(this,b)};Object.defineProperty(this.options,b,m)}}_sanitizeAndValidateOption(C,y){switch(C){case"cursorStyle":if(y||(y=c.DEFAULT_OPTIONS[C]),!(function(b){return b==="block"||b==="underline"||b==="bar"})(y))throw new Error(`"${y}" is not a valid value for ${C}`);break;case"wordSeparator":y||(y=c.DEFAULT_OPTIONS[C]);break;case"fontWeight":case"fontWeightBold":if(typeof y=="number"&&1<=y&&y<=1e3)break;y=x.includes(y)?y:c.DEFAULT_OPTIONS[C];break;case"cursorWidth":y=Math.floor(y);case"lineHeight":case"tabStopWidth":if(y<1)throw new Error(`${C} cannot be less than 1, value: ${y}`);break;case"minimumContrastRatio":y=Math.max(1,Math.min(21,Math.round(10*y)/10));break;case"scrollback":if((y=Math.min(y,4294967295))<0)throw new Error(`${C} cannot be less than 0, value: ${y}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(y<=0)throw new Error(`${C} cannot be less than or equal to 0, value: ${y}`);break;case"rows":case"cols":if(!y&&y!==0)throw new Error(`${C} must be numeric, value: ${y}`);break;case"windowsPty":y=y??{}}return y}}c.OptionsService=E},2660:function(p,c,h){var v=this&&this.__decorate||function(E,T,C,y){var b,m=arguments.length,g=m<3?T:y===null?y=Object.getOwnPropertyDescriptor(T,C):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(E,T,C,y);else for(var k=E.length-1;k>=0;k--)(b=E[k])&&(g=(m<3?b(g):m>3?b(T,C,g):b(T,C))||g);return m>3&&g&&Object.defineProperty(T,C,g),g},S=this&&this.__param||function(E,T){return function(C,y){T(C,y,E)}};Object.defineProperty(c,"__esModule",{value:!0}),c.OscLinkService=void 0;const f=h(2585);let x=c.OscLinkService=class{constructor(E){this._bufferService=E,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(E){const T=this._bufferService.buffer;if(E.id===void 0){const k=T.addMarker(T.ybase+T.y),M={data:E,id:this._nextId++,lines:[k]};return k.onDispose((()=>this._removeMarkerFromLink(M,k))),this._dataByLinkId.set(M.id,M),M.id}const C=E,y=this._getEntryIdKey(C),b=this._entriesWithId.get(y);if(b)return this.addLineToLink(b.id,T.ybase+T.y),b.id;const m=T.addMarker(T.ybase+T.y),g={id:this._nextId++,key:this._getEntryIdKey(C),data:C,lines:[m]};return m.onDispose((()=>this._removeMarkerFromLink(g,m))),this._entriesWithId.set(g.key,g),this._dataByLinkId.set(g.id,g),g.id}addLineToLink(E,T){const C=this._dataByLinkId.get(E);if(C&&C.lines.every((y=>y.line!==T))){const y=this._bufferService.buffer.addMarker(T);C.lines.push(y),y.onDispose((()=>this._removeMarkerFromLink(C,y)))}}getLinkData(E){var T;return(T=this._dataByLinkId.get(E))==null?void 0:T.data}_getEntryIdKey(E){return`${E.id};;${E.uri}`}_removeMarkerFromLink(E,T){const C=E.lines.indexOf(T);C!==-1&&(E.lines.splice(C,1),E.lines.length===0&&(E.data.id!==void 0&&this._entriesWithId.delete(E.key),this._dataByLinkId.delete(E.id)))}};c.OscLinkService=x=v([S(0,f.IBufferService)],x)},8343:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createDecorator=c.getServiceDependencies=c.serviceRegistry=void 0;const h="di$target",v="di$dependencies";c.serviceRegistry=new Map,c.getServiceDependencies=function(S){return S[v]||[]},c.createDecorator=function(S){if(c.serviceRegistry.has(S))return c.serviceRegistry.get(S);const f=function(x,E,T){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(C,y,b){y[h]===y?y[v].push({id:C,index:b}):(y[v]=[{id:C,index:b}],y[h]=y)})(f,x,T)};return f.toString=()=>S,c.serviceRegistry.set(S,f),f}},2585:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.IDecorationService=c.IUnicodeService=c.IOscLinkService=c.IOptionsService=c.ILogService=c.LogLevelEnum=c.IInstantiationService=c.ICharsetService=c.ICoreService=c.ICoreMouseService=c.IBufferService=void 0;const v=h(8343);var S;c.IBufferService=(0,v.createDecorator)("BufferService"),c.ICoreMouseService=(0,v.createDecorator)("CoreMouseService"),c.ICoreService=(0,v.createDecorator)("CoreService"),c.ICharsetService=(0,v.createDecorator)("CharsetService"),c.IInstantiationService=(0,v.createDecorator)("InstantiationService"),(function(f){f[f.TRACE=0]="TRACE",f[f.DEBUG=1]="DEBUG",f[f.INFO=2]="INFO",f[f.WARN=3]="WARN",f[f.ERROR=4]="ERROR",f[f.OFF=5]="OFF"})(S||(c.LogLevelEnum=S={})),c.ILogService=(0,v.createDecorator)("LogService"),c.IOptionsService=(0,v.createDecorator)("OptionsService"),c.IOscLinkService=(0,v.createDecorator)("OscLinkService"),c.IUnicodeService=(0,v.createDecorator)("UnicodeService"),c.IDecorationService=(0,v.createDecorator)("DecorationService")},1480:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.UnicodeService=void 0;const v=h(8460),S=h(225);class f{static extractShouldJoin(E){return(1&E)!=0}static extractWidth(E){return E>>1&3}static extractCharKind(E){return E>>3}static createPropertyValue(E,T,C=!1){return(16777215&E)<<3|(3&T)<<1|(C?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new v.EventEmitter,this.onChange=this._onChange.event;const E=new S.UnicodeV6;this.register(E),this._active=E.version,this._activeProvider=E}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(E){if(!this._providers[E])throw new Error(`unknown Unicode version "${E}"`);this._active=E,this._activeProvider=this._providers[E],this._onChange.fire(E)}register(E){this._providers[E.version]=E}wcwidth(E){return this._activeProvider.wcwidth(E)}getStringCellWidth(E){let T=0,C=0;const y=E.length;for(let b=0;b<y;++b){let m=E.charCodeAt(b);if(55296<=m&&m<=56319){if(++b>=y)return T+this.wcwidth(m);const M=E.charCodeAt(b);56320<=M&&M<=57343?m=1024*(m-55296)+M-56320+65536:T+=this.wcwidth(M)}const g=this.charProperties(m,C);let k=f.extractWidth(g);f.extractShouldJoin(g)&&(k-=f.extractWidth(C)),T+=k,C=g}return T}charProperties(E,T){return this._activeProvider.charProperties(E,T)}}c.UnicodeService=f}},r={};function l(p){var c=r[p];if(c!==void 0)return c.exports;var h=r[p]={exports:{}};return n[p].call(h.exports,h,h.exports,l),h.exports}var d={};return(()=>{var p=d;Object.defineProperty(p,"__esModule",{value:!0}),p.Terminal=void 0;const c=l(9042),h=l(3236),v=l(844),S=l(5741),f=l(8285),x=l(7975),E=l(7090),T=["cols","rows"];class C extends v.Disposable{constructor(b){super(),this._core=this.register(new h.Terminal(b)),this._addonManager=this.register(new S.AddonManager),this._publicOptions={...this._core.options};const m=k=>this._core.options[k],g=(k,M)=>{this._checkReadonlyOptions(k),this._core.options[k]=M};for(const k in this._core.options){const M={get:m.bind(this,k),set:g.bind(this,k)};Object.defineProperty(this._publicOptions,k,M)}}_checkReadonlyOptions(b){if(T.includes(b))throw new Error(`Option "${b}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new x.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new E.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new f.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const b=this._core.coreService.decPrivateModes;let m="none";switch(this._core.coreMouseService.activeProtocol){case"X10":m="x10";break;case"VT200":m="vt200";break;case"DRAG":m="drag";break;case"ANY":m="any"}return{applicationCursorKeysMode:b.applicationCursorKeys,applicationKeypadMode:b.applicationKeypad,bracketedPasteMode:b.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:m,originMode:b.origin,reverseWraparoundMode:b.reverseWraparound,sendFocusMode:b.sendFocus,wraparoundMode:b.wraparound}}get options(){return this._publicOptions}set options(b){for(const m in b)this._publicOptions[m]=b[m]}blur(){this._core.blur()}focus(){this._core.focus()}input(b,m=!0){this._core.input(b,m)}resize(b,m){this._verifyIntegers(b,m),this._core.resize(b,m)}open(b){this._core.open(b)}attachCustomKeyEventHandler(b){this._core.attachCustomKeyEventHandler(b)}attachCustomWheelEventHandler(b){this._core.attachCustomWheelEventHandler(b)}registerLinkProvider(b){return this._core.registerLinkProvider(b)}registerCharacterJoiner(b){return this._checkProposedApi(),this._core.registerCharacterJoiner(b)}deregisterCharacterJoiner(b){this._checkProposedApi(),this._core.deregisterCharacterJoiner(b)}registerMarker(b=0){return this._verifyIntegers(b),this._core.registerMarker(b)}registerDecoration(b){return this._checkProposedApi(),this._verifyPositiveIntegers(b.x??0,b.width??0,b.height??0),this._core.registerDecoration(b)}hasSelection(){return this._core.hasSelection()}select(b,m,g){this._verifyIntegers(b,m,g),this._core.select(b,m,g)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(b,m){this._verifyIntegers(b,m),this._core.selectLines(b,m)}dispose(){super.dispose()}scrollLines(b){this._verifyIntegers(b),this._core.scrollLines(b)}scrollPages(b){this._verifyIntegers(b),this._core.scrollPages(b)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(b){this._verifyIntegers(b),this._core.scrollToLine(b)}clear(){this._core.clear()}write(b,m){this._core.write(b,m)}writeln(b,m){this._core.write(b),this._core.write(`\r
|
|
468
|
-
`,m)}paste(b){this._core.paste(b)}refresh(b,m){this._verifyIntegers(b,m),this._core.refresh(b,m)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(b){this._addonManager.loadAddon(this,b)}static get strings(){return c}_verifyIntegers(...b){for(const m of b)if(m===1/0||isNaN(m)||m%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...b){for(const m of b)if(m&&(m===1/0||isNaN(m)||m%1!=0||m<0))throw new Error("This API only accepts positive integers")}}p.Terminal=C})(),d})()))})(of)),of.exports}var Z3=J3(),lf={exports:{}},L0;function Q3(){return L0||(L0=1,(function(s,t){(function(n,r){s.exports=r()})(self,(()=>(()=>{var n={};return(()=>{var r=n;Object.defineProperty(r,"__esModule",{value:!0}),r.FitAddon=void 0,r.FitAddon=class{activate(l){this._terminal=l}dispose(){}fit(){const l=this.proposeDimensions();if(!l||!this._terminal||isNaN(l.cols)||isNaN(l.rows))return;const d=this._terminal._core;this._terminal.rows===l.rows&&this._terminal.cols===l.cols||(d._renderService.clear(),this._terminal.resize(l.cols,l.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const l=this._terminal._core,d=l._renderService.dimensions;if(d.css.cell.width===0||d.css.cell.height===0)return;const p=this._terminal.options.scrollback===0?0:l.viewport.scrollBarWidth,c=window.getComputedStyle(this._terminal.element.parentElement),h=parseInt(c.getPropertyValue("height")),v=Math.max(0,parseInt(c.getPropertyValue("width"))),S=window.getComputedStyle(this._terminal.element),f=h-(parseInt(S.getPropertyValue("padding-top"))+parseInt(S.getPropertyValue("padding-bottom"))),x=v-(parseInt(S.getPropertyValue("padding-right"))+parseInt(S.getPropertyValue("padding-left")))-p;return{cols:Math.max(2,Math.floor(x/d.css.cell.width)),rows:Math.max(1,Math.floor(f/d.css.cell.height))}}}})(),n})()))})(lf)),lf.exports}var e4=Q3(),cf={exports:{}},O0;function t4(){return O0||(O0=1,(function(s,t){(function(n,r){s.exports=r()})(self,(()=>(()=>{var n={6:(p,c)=>{function h(S){try{const f=new URL(S),x=f.password&&f.username?`${f.protocol}//${f.username}:${f.password}@${f.host}`:f.username?`${f.protocol}//${f.username}@${f.host}`:`${f.protocol}//${f.host}`;return S.toLocaleLowerCase().startsWith(x.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(c,"__esModule",{value:!0}),c.LinkComputer=c.WebLinkProvider=void 0,c.WebLinkProvider=class{constructor(S,f,x,E={}){this._terminal=S,this._regex=f,this._handler=x,this._options=E}provideLinks(S,f){const x=v.computeLink(S,this._regex,this._terminal,this._handler);f(this._addCallbacks(x))}_addCallbacks(S){return S.map((f=>(f.leave=this._options.leave,f.hover=(x,E)=>{if(this._options.hover){const{range:T}=f;this._options.hover(x,E,T)}},f)))}};class v{static computeLink(f,x,E,T){const C=new RegExp(x.source,(x.flags||"")+"g"),[y,b]=v._getWindowedLineStrings(f-1,E),m=y.join("");let g;const k=[];for(;g=C.exec(m);){const M=g[0];if(!h(M))continue;const[R,j]=v._mapStrIdx(E,b,0,g.index),[A,D]=v._mapStrIdx(E,R,j,M.length);if(R===-1||j===-1||A===-1||D===-1)continue;const I={start:{x:j+1,y:R+1},end:{x:D,y:A+1}};k.push({range:I,text:M,activate:T})}return k}static _getWindowedLineStrings(f,x){let E,T=f,C=f,y=0,b="";const m=[];if(E=x.buffer.active.getLine(f)){const g=E.translateToString(!0);if(E.isWrapped&&g[0]!==" "){for(y=0;(E=x.buffer.active.getLine(--T))&&y<2048&&(b=E.translateToString(!0),y+=b.length,m.push(b),E.isWrapped&&b.indexOf(" ")===-1););m.reverse()}for(m.push(g),y=0;(E=x.buffer.active.getLine(++C))&&E.isWrapped&&y<2048&&(b=E.translateToString(!0),y+=b.length,m.push(b),b.indexOf(" ")===-1););}return[m,T]}static _mapStrIdx(f,x,E,T){const C=f.buffer.active,y=C.getNullCell();let b=E;for(;T;){const m=C.getLine(x);if(!m)return[-1,-1];for(let g=b;g<m.length;++g){m.getCell(g,y);const k=y.getChars();if(y.getWidth()&&(T-=k.length||1,g===m.length-1&&k==="")){const M=C.getLine(x+1);M&&M.isWrapped&&(M.getCell(0,y),y.getWidth()===2&&(T+=1))}if(T<0)return[x,g]}x++,b=0}return[x,b]}}c.LinkComputer=v}},r={};function l(p){var c=r[p];if(c!==void 0)return c.exports;var h=r[p]={exports:{}};return n[p](h,h.exports,l),h.exports}var d={};return(()=>{var p=d;Object.defineProperty(p,"__esModule",{value:!0}),p.WebLinksAddon=void 0;const c=l(6),h=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function v(S,f){const x=window.open();if(x){try{x.opener=null}catch{}x.location.href=f}else console.warn("Opening link blocked as opener could not be cleared")}p.WebLinksAddon=class{constructor(S=v,f={}){this._handler=S,this._options=f}activate(S){this._terminal=S;const f=this._options,x=f.urlRegex||h;this._linkProvider=this._terminal.registerLinkProvider(new c.WebLinkProvider(this._terminal,x,this._handler,f))}dispose(){var S;(S=this._linkProvider)==null||S.dispose()}}})(),d})()))})(cf)),cf.exports}var s4=t4();function i4(s,t){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/terminal?session=${encodeURIComponent(s)}&token=${encodeURIComponent(t)}`}const n4=15e3,r4=new Set([4001,4004]),a4='"Geist Mono", ui-monospace, "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", monospace';function tu(s,t){return typeof document>"u"?t:getComputedStyle(document.documentElement).getPropertyValue(s).trim()||t}const o4={black:"#1a1a1e",red:"#e88a84",green:"#6be195",yellow:"#e6b96f",blue:"#6f9ae0",magenta:"#b7a6dd",cyan:"#74c8d4",white:"#e8e8ec",brightBlack:"#565661",brightRed:"#f4a7a1",brightGreen:"#8ceab0",brightYellow:"#f2cf93",brightBlue:"#8fb5ea",brightMagenta:"#ccbdf0",brightCyan:"#97dce7",brightWhite:"#ffffff"},l4={black:"#3a3a3e",red:"#c0392b",green:"#167e3a",yellow:"#a86414",blue:"#4f7cc4",magenta:"#7a4fb0",cyan:"#0e7d94",white:"#a6a6ae",brightBlack:"#6b6b75",brightRed:"#d64a3d",brightGreen:"#1f9a4a",brightYellow:"#c67d1a",brightBlue:"#6f9ae0",brightMagenta:"#9268c4",brightCyan:"#1596ad",brightWhite:"#ffffff"};function B0(s){const t=tu("--bg",s==="dark"?"#0b0e13":"#f8f9fa"),n=tu("--ink",s==="dark"?"#f3f3f5":"#16161a"),r=tu("--brand",s==="dark"?"#6be195":"#167e3a");return{...s==="dark"?o4:l4,background:t,foreground:n,cursor:r,cursorAccent:t,selectionBackground:`${r}40`}}const c4=({sessionId:s,token:t})=>{const n=H.useRef(null),r=H.useRef(null),[l,d]=H.useState("connecting"),[p,c]=H.useState(null);return H.useEffect(()=>Pp(h=>{r.current&&(r.current.options.theme=B0(h))}),[]),H.useEffect(()=>{var g;const h=n.current;if(!h)return;let v=!1,S=0,f=null,x=null;const E=new Z3.Terminal({cursorBlink:!0,fontSize:13,fontFamily:tu("--mono",a4),theme:B0(Ou()),scrollback:1e4,allowProposedApi:!0});r.current=E;const T=new e4.FitAddon;E.loadAddon(T),E.loadAddon(new s4.WebLinksAddon),E.parser.registerCsiHandler({prefix:">",final:"q"},()=>(E.write("\x1BP>|XTerm(370)\x1B\\"),!0)),E.parser.registerOscHandler(52,k=>{var j;const M=k.split(";");if(M.length<2)return!1;const R=M[M.length-1];try{const A=atob(R),D=Uint8Array.from(A,q=>q.charCodeAt(0)),I=new TextDecoder().decode(D);(j=navigator.clipboard)==null||j.writeText(I).catch(()=>{})}catch{}return!0}),E.open(h),T.fit(),(g=document.fonts)==null||g.ready.then(()=>{v||(T.fit(),y())});const C=E.onData(k=>{(x==null?void 0:x.readyState)===WebSocket.OPEN&&x.send(k)}),y=()=>{(x==null?void 0:x.readyState)===WebSocket.OPEN&&x.send(JSON.stringify({type:"resize",cols:E.cols,rows:E.rows}))},b=new ResizeObserver(()=>{T.fit(),y()});b.observe(h);function m(){if(v)return;const k=new WebSocket(i4(s,t));x=k,k.onopen=()=>{S=0,d("connected"),c(null),T.fit(),y()},k.onmessage=M=>{const R=typeof M.data=="string"?M.data:new TextDecoder().decode(M.data);E.write(R)},k.onclose=M=>{if(v)return;if(r4.has(M.code)){d("error"),c(M.reason||`Connection refused (${M.code})`);return}const R=Math.min(1e3*2**S,n4);S+=1,d("connecting"),f=setTimeout(m,R)}}return m(),()=>{v=!0,f&&clearTimeout(f),b.disconnect(),C.dispose(),x==null||x.close(),E.dispose(),r.current=null}},[s,t]),u.jsx("div",{className:"harness-terminal",children:u.jsx("div",{ref:n,className:"terminal-screen"})})},u4=8e3,h4=400,d4={info:"Info",success:"CircleCheck",error:"TriangleAlert"};function f4({message:s,tone:t="error",onDismiss:n}){const[r,l]=H.useState(!1),[d,p]=H.useState(!1),c=H.useCallback(()=>l(!0),[]);return H.useEffect(()=>{l(!1)},[s]),H.useEffect(()=>{if(r||d)return;const h=window.setTimeout(c,u4);return()=>window.clearTimeout(h)},[s,r,d,c]),H.useEffect(()=>{if(!r)return;const h=window.setTimeout(n,h4);return()=>window.clearTimeout(h)},[r,n]),u.jsxs("div",{className:r?"toast is-leaving":"toast",role:"alert","data-tone":t,"data-testid":"toast",onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),onFocus:()=>p(!0),onBlur:()=>p(!1),onAnimationEnd:r?n:void 0,children:[u.jsx("span",{className:"toast-icon","aria-hidden":"true",children:u.jsx(he,{name:d4[t],size:16})}),u.jsx("span",{className:"toast-message",children:s}),u.jsx("button",{className:"toast-dismiss","aria-label":"Dismiss",onClick:c,children:u.jsx(he,{name:"X",size:14})})]},s)}function p4(){const s=H.useRef(null);return H.useEffect(()=>{const t=s.current;if(!t)return;let n=null;const r=()=>{n=null,t.dataset.show="false",t.textContent=""},l=c=>{const h=c.closest("[data-tooltip], [title], [data-tip-stash]");if(!h||h===n)return;const v=h;v.title&&(v.dataset.tipStash=v.title,v.removeAttribute("title"));const S=v.dataset.tooltip||v.dataset.tipStash;if(!S)return;n=h,t.textContent=S,t.dataset.show="true";const f=h.getBoundingClientRect(),{offsetWidth:x,offsetHeight:E}=t,T=h.closest(".rail-workflows");if(T&&T.getBoundingClientRect().right+x+14<=window.innerWidth){const b=T.getBoundingClientRect().right+8,m=Math.min(Math.max(f.top+f.height/2-E/2,6),window.innerHeight-E-6);t.style.transform=`translate(${Math.round(b)}px, ${Math.round(m)}px)`;return}const C=Math.min(Math.max(f.left+f.width/2-x/2,6),window.innerWidth-x-6),y=f.top-E-7>=4?f.top-E-7:f.bottom+7;t.style.transform=`translate(${Math.round(C)}px, ${Math.round(y)}px)`},d=c=>l(c.target),p=c=>{n&&!n.contains(c.relatedTarget)&&r()};return document.addEventListener("pointerover",d,!0),document.addEventListener("pointerout",p,!0),document.addEventListener("pointerdown",r,!0),document.addEventListener("keydown",r,!0),document.addEventListener("scroll",r,!0),window.addEventListener("blur",r),()=>{document.removeEventListener("pointerover",d,!0),document.removeEventListener("pointerout",p,!0),document.removeEventListener("pointerdown",r,!0),document.removeEventListener("keydown",r,!0),document.removeEventListener("scroll",r,!0),window.removeEventListener("blur",r)}},[]),u.jsx("div",{ref:s,className:"app-tooltip","data-show":"false",role:"tooltip","aria-hidden":"true"})}const v4="~/.sapiom/harness",m4={events:`${v4}/events.ndjson`},g4=["claude-code","codex"],Xp=["vscode","vscode-insiders","cursor","windsurf","zed"],_4=[{id:"claude-code",label:"Claude Code",mode:"embedded",experimental:!1,installed:!0,installMcpPrompt:""},{id:"codex",label:"Codex CLI",mode:"embedded",experimental:!1,installed:!0,installMcpPrompt:""}];function y4(s){const t=s.filter(n=>n.id==="sapiom");return t.length===0?s:[...t,...s.filter(n=>n.id!=="sapiom")]}function Jp(s){return s.mode==="embedded"&&s.installed&&g4.includes(s.id)}function b4(s){if(Jp(s))return null;if(s.mode==="external")return`${s.label} runs in its own app. Agent Studio can't launch it yet.`;if(!s.installed){const t=s.installMcpPrompt.trim();return t.length>0?t:`${s.label} isn't on this machine's PATH. Install its CLI, then restart the Agent Studio server.`}return`This Agent Studio build can't launch ${s.label} yet.`}function S4(s,t){var n;return((n=s.find(r=>r.id===t))==null?void 0:n.label)??t}function uf(s){return fl(s)}async function w4(s,t,n){const r=uf(s.trim());if(!r)return{kind:"new"};if(t)return{kind:"new"};const l=Qk(r);try{const d=l?await n(l):null;if(!!(d!=null&&d.dirs.some(v=>uf(v.path)===r&&v.hasAgentProject)))return{kind:"project"};const c=await n(r);if(uf(c.path)!==r)return{kind:"new"};const h=c.dirs.filter(v=>v.hasAgentProject).length;return h>0?{kind:"multi",found:h}:{kind:"plain"}}catch{if(l)try{return await n(l),{kind:"new"}}catch{throw new Error("Couldn't read that directory.")}throw new Error("Couldn't read that directory.")}}function Zp({recentDirs:s,launchDir:t,projectRoot:n,listDir:r,onClose:l,onConnect:d,onScan:p,triggerRef:c}){const[h,v]=H.useState(n??t??s[0]??""),[S,f]=H.useState(null),[x,E]=H.useState(!0),[T,C]=H.useState(!1),[y,b]=H.useState(null),m=H.useRef(null);xl(!0,{onDismiss:l,containerRef:m,triggerRef:c}),H.useEffect(()=>{E(!0)},[h]);const g=H.useRef(h);g.current=h;const k=H.useRef(0),M=H.useCallback(U=>{const X=g.current.trim(),se=++k.current;if(!X){f(null),E(!1);return}w4(X,U.isNew,r).then(F=>{se===k.current&&(f(F),b(null))}).catch(F=>{se===k.current&&(f(null),b(F.message))}).finally(()=>{se===k.current&&E(!1)})},[r]),R=async U=>{C(!0),b(null);try{await U(),l()}catch(X){b(X.message)}finally{C(!1)}},j=h.trim(),A=(S==null?void 0:S.kind)==="project"||(S==null?void 0:S.kind)==="multi",D=()=>void R(()=>d(j)),I=()=>void R(async()=>{if(await p(j)===0)throw new Error("No agent projects found under this folder.")}),q=()=>{T||x||!S||!j||!A||(S.kind==="project"?D():S.kind==="multi"&&I())},G=U=>{U.key==="Enter"&&(U.metaKey||U.ctrlKey)&&(U.preventDefault(),q())};return u.jsx("div",{className:"modal-backdrop",children:u.jsxs("div",{className:"modal modal-start",role:"dialog","aria-label":"Add existing agents",ref:m,onKeyDown:G,children:[u.jsxs("div",{className:"modal-header modal-start-header",children:[u.jsx("span",{className:"modal-start-title",children:"Add existing agents"}),u.jsx("button",{className:"theme-toggle modal-close","aria-label":"Close",title:"Close",onClick:l,children:u.jsx(he,{name:"X",size:14})})]}),u.jsxs("div",{className:"modal-body",children:[u.jsx("p",{className:"modal-field-hint modal-start-sub",children:"Add a folder that already holds an agent project."}),u.jsx("section",{className:"modal-section",children:u.jsx(L1,{value:h,onChange:v,onSubmit:q,recentDirs:[],listDir:r,onResolve:M})}),S&&u.jsx(x4,{outcome:S,path:j}),y&&u.jsx("div",{className:"modal-error",children:y})]}),u.jsxs("div",{className:"modal-actions modal-start-actions",children:[u.jsx("button",{className:"btn-ghost",onClick:l,disabled:T,children:"Cancel"}),u.jsx(C4,{outcome:S,checking:x,busy:T,onConnect:D,onScan:I})]})]})})}function x4({outcome:s,path:t}){const n=s.kind==="project"||s.kind==="multi";return u.jsx("div",{className:"aw-result","data-tone":n?"good":"todo","data-testid":"aw-result","aria-live":"polite",children:u.jsxs("div",{className:"aw-result-head",children:[u.jsx("span",{className:"aw-result-glyph","aria-hidden":"true",children:u.jsx(he,{name:n?"Check":"TriangleAlert",size:14})}),u.jsxs("span",{className:"aw-result-text",children:[u.jsxs("span",{className:"aw-result-title",children:[s.kind==="project"&&"This is an agent project",s.kind==="multi"&&`${s.found} agent ${s.found===1?"project":"projects"} under this folder`,(s.kind==="plain"||s.kind==="new")&&"No agent in this folder"]}),u.jsx("span",{className:"aw-result-path",title:t,children:t})]})]})})}function C4({outcome:s,checking:t,busy:n,onConnect:r,onScan:l}){if(t||!s)return u.jsx("button",{className:"btn-primary modal-primary-cta","data-testid":"start-primary",disabled:!0,children:"Checking…"});switch(s.kind){case"project":return u.jsx("button",{className:"btn-primary modal-primary-cta","data-testid":"aw-add",onClick:r,disabled:n,children:n?"Adding…":"Add workspace"});case"multi":return u.jsx("button",{className:"btn-primary modal-primary-cta","data-testid":"aw-add-all",onClick:l,disabled:n,children:n?"Adding…":`Add all ${s.found}`});case"plain":case"new":return u.jsx("button",{className:"btn-primary modal-primary-cta","data-testid":"start-primary",disabled:!0,children:"Add workspace"})}}const E4="m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z",k4="M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z",T4={"claude-code":E4,codex:k4},A4=["M105.267 60.7219L98.8902 71.7648L92.1353 83.4669L83.3114 98.7521L70.18 121.491H0L13.1249 98.7521H57.042L72.6274 71.7648L79.0038 60.7219L72.2619 49.0459H98.5247L105.267 60.7219Z","M114.072 0L100.954 22.7189H57.0694L57.0498 22.6928L57.0368 22.7189L41.8365 49.047L35.0945 60.723L41.471 71.7659H15.2016L8.8252 60.723L15.5671 49.047L21.9631 37.978L30.774 22.7189L43.8923 0H114.072Z"];function Qp({kind:s,size:t=16}){if(s==="sapiom")return u.jsx("svg",{viewBox:"0 0 115 122",width:t,height:t,fill:"currentColor","aria-hidden":"true",focusable:"false",children:A4.map(r=>u.jsx("path",{d:r},r.slice(0,16)))});const n=T4[s];return n?u.jsx("svg",{viewBox:"0 0 24 24",width:t,height:t,fill:"currentColor","aria-hidden":"true",focusable:"false",children:u.jsx("path",{d:n})}):u.jsx(he,{name:"SquareTerminal",size:t})}function R4({entries:s,activeId:t,testidPrefix:n,onPick:r}){return u.jsx(u.Fragment,{children:s.map(l=>{const d=Jp(l),p=l.id===t,c=b4(l);return u.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":p,"aria-disabled":!d||void 0,className:"profile-menu-item provider-item"+(d?"":" is-unavailable"),"data-testid":`${n}-${l.id}`,"data-tooltip":c??void 0,onClick:()=>{d&&r(l.id)},children:[u.jsx("span",{className:"provider-item-check","aria-hidden":"true",children:p&&u.jsx(he,{name:"Check",size:13})}),u.jsx(Qp,{kind:l.id,size:13}),l.label]},l.id)})})}const M4=[{label:"sales outreach",prompt:"Enrich a list of leads, then write a personalized first line for each prospect and draft an outreach email."},{label:"support triage",prompt:"Triage incoming support tickets: classify each by urgency and topic, draft a first reply, and flag anything critical."},{label:"research digest",prompt:"Search the web for the latest on a topic I give you, then publish a dated digest of what changed."},{label:"code review",prompt:"When a pull request opens, review the diff for bugs and style issues and post the findings as a review comment."}],j4=3;function D4(s){const t=s.getHours();return t<12?"Good morning.":t<18?"Good afternoon.":"Good evening."}function N4(s){return s.replace(/\s+/g,"-")}function L4({firstRun:s,onSubmitIdea:t,onUseTemplate:n,onBrowseTemplates:r,listHarnesses:l,listTemplates:d,telemetryOptIn:p,onToggleTelemetry:c,recentDirs:h,projectRoot:v,listDir:S,onConnect:f,onScan:x,onScaffold:E,onSaveProjectRoot:T}){const[C,y]=H.useState(""),[b,m]=H.useState(()=>Gi().preferredHarness??"claude-code"),[g,k]=H.useState(_4),[M,R]=H.useState(!1),[j,A]=H.useState([]),[D,I]=H.useState(!1),[q,G]=H.useState(!1),U=H.useRef(null),X=H.useRef(null),se=H.useRef(null),F=H.useCallback(()=>R(!1),[]);H.useEffect(()=>{let B=!1;return l().then(N=>{if(B||N.length===0)return;k(y4(N));const z=N.filter(Jp);m(W=>{var Z;return z.some(ue=>ue.id===W)?W:((Z=z[0])==null?void 0:Z.id)??W})}).catch(()=>{}),()=>{B=!0}},[l]),H.useEffect(()=>{let B=!1;return d().then(N=>{B||A(N.templates.map(z=>({...z,kind:"gallery"})).slice(0,j4))}).catch(()=>{}),()=>{B=!0}},[d]);const Q=B=>{m(B),xn({preferredHarness:B==="codex"?"codex":"claude-code"}),F()},J=B=>{q||(G(!0),window.setTimeout(B,170))},O=()=>J(()=>t(C.trim(),b));return u.jsxs("div",{className:"composer-home"+(q?" is-leaving":""),"data-testid":"new-session-composer",children:[u.jsxs("div",{className:"composer-hero",children:[u.jsxs("p",{className:"composer-greeting","data-testid":"composer-greeting",children:[D4(new Date)," ",s?"Let's build your first agent.":"Let's build a new agent."]}),u.jsx("h1",{className:"composer-heading",children:"What should your agent do?"}),u.jsx("div",{className:"composer-chips",role:"list",children:M4.map(B=>u.jsx("button",{type:"button",role:"listitem",className:"composer-chip","data-testid":`composer-chip-${N4(B.label)}`,onClick:()=>{var N;y(B.prompt),(N=U.current)==null||N.focus()},children:B.label},B.label))}),u.jsxs("div",{className:"composer-box",children:[u.jsx("textarea",{ref:U,className:"composer-input","data-testid":"composer-input",placeholder:"Describe the outcome you want",value:C,rows:2,autoFocus:!0,onChange:B=>y(B.target.value),onKeyDown:B=>{B.key==="Enter"&&!B.shiftKey&&(B.preventDefault(),O())}}),u.jsxs("div",{className:"composer-box-actions",children:[u.jsx("button",{ref:se,type:"button",className:"composer-attach","data-testid":"composer-open-folder","aria-label":"Open a folder or connect a workspace","data-tooltip":"Open a folder or connect a workspace",onClick:()=>I(!0),children:u.jsx(he,{name:"Plus",size:16})}),u.jsxs("div",{className:"composer-box-right",children:[u.jsxs("button",{ref:X,type:"button",className:"harness-select composer-harness","data-testid":"composer-harness-select","aria-haspopup":"menu","aria-expanded":M,"aria-label":"Coding agent for this session","data-tooltip":"Which coding agent runs this session",onClick:()=>R(B=>!B),children:[u.jsx(Qp,{kind:b,size:14}),u.jsx("span",{className:"harness-select-label",children:S4(g,b)}),u.jsx("span",{className:"disclosure-caret"+(M?" is-open":""),"aria-hidden":"true",children:u.jsx(he,{name:"ChevronDown",size:12})})]}),u.jsx(Cn,{open:M,anchorRef:X,onDismiss:F,placement:"up-end",className:"session-menu harness-select-menu",role:"menu",testid:"composer-harness-menu",children:u.jsx(R4,{entries:g,activeId:b,testidPrefix:"composer-harness-option",onPick:Q})}),u.jsx("button",{type:"button",className:"composer-send","data-testid":"composer-send","aria-label":"Start session",title:"Start session",onClick:O,children:u.jsx(he,{name:"ArrowUp",size:16})})]})]})]})]}),j.length>0&&u.jsxs("div",{className:"composer-templates",children:[u.jsxs("div",{className:"composer-templates-head",children:[u.jsx("span",{className:"composer-templates-title",children:"Start from a template"}),u.jsxs("button",{type:"button",className:"composer-templates-all","data-testid":"composer-browse-templates",onClick:r,children:["Browse all templates ",u.jsx(he,{name:"ChevronRight",size:13})]})]}),u.jsx("div",{className:"composer-template-grid",children:j.map((B,N)=>u.jsxs("button",{type:"button",className:"composer-template-card","data-testid":`composer-template-${B.id}`,onClick:()=>J(()=>n(B)),children:[u.jsxs("span",{className:"composer-template-cardhead",children:[u.jsx("span",{className:"composer-template-name",children:B.name}),N===0&&u.jsx("span",{className:"composer-template-suggested",children:"Suggested"})]}),u.jsx("span",{className:"composer-template-desc",children:B.description}),u.jsxs("span",{className:"composer-template-meta",children:[B.stepCount," ",B.stepCount===1?"step":"steps"," ·"," ",Yp(B.complexity),B.capabilities.length>0&&` · ${B.capabilities.length} ${B.capabilities.length===1?"capability":"capabilities"}`]})]},B.id))})]}),s&&u.jsxs("div",{className:"composer-footer",children:[u.jsxs("label",{className:"composer-consent","data-testid":"welcome-consent",children:[u.jsx("button",{type:"button",role:"switch","aria-checked":p,"data-testid":"welcome-telemetry-toggle",className:"toggle-switch"+(p?" is-on":""),onClick:()=>void c(!p),children:u.jsx("span",{className:"toggle-knob"})}),u.jsx("span",{className:"composer-consent-copy",children:"Help us improve Agent Studio — share your session details with Sapiom. Off by default; change it anytime in Settings."})]}),u.jsxs("a",{className:"composer-docs","data-testid":"welcome-docs",href:"https://docs.sapiom.ai/agents/quick-start",target:"_blank",rel:"noopener noreferrer",children:["Read documentation ",u.jsx(he,{name:"ArrowUpRight",size:12})]})]}),D&&u.jsx(Zp,{recentDirs:h,projectRoot:v,listDir:S,onClose:()=>I(!1),onConnect:f,onScan:x,triggerRef:se})]})}function O4({firstRun:s,appVersion:t,recentDirs:n,projectRoot:r,listDir:l,onConnect:d,onScan:p,onBrowseTemplates:c,onDismiss:h}){const[v,S]=H.useState(!1),f=H.useRef(null),x=H.useRef(h);return x.current=h,H.useEffect(()=>{if(v)return;const E=C=>{C.key==="Escape"&&x.current()},T=window.setTimeout(()=>window.addEventListener("keydown",E),0);return()=>{window.clearTimeout(T),window.removeEventListener("keydown",E)}},[v]),u.jsxs("div",{className:"overview-modal","data-testid":"overview-modal",role:"dialog","aria-modal":"true","aria-label":"Sapiom agent.studio overview",onClick:E=>{E.target===E.currentTarget&&h()},children:[u.jsxs("div",{className:"overview-modal-card",children:[u.jsx("button",{type:"button",className:"theme-toggle overview-modal-close","data-testid":"overview-exit","aria-label":"Close","data-tooltip":"Close",onClick:h,children:u.jsx(he,{name:"X",size:14})}),u.jsxs("div",{className:"overview-modal-body",children:[u.jsx("h1",{className:"overview-modal-title",children:s?"Welcome to Sapiom agent.studio":"Sapiom agent.studio"}),t&&u.jsxs("p",{className:"overview-modal-version","data-testid":"overview-version",children:["v",t]}),u.jsx("p",{className:"overview-modal-intro",children:"Studio turns the agents in your codebase into diagrams you can inspect and run. Local agent runs are free and offline, with every step's input, output and capability call on screen. Nothing ships until you say so."}),u.jsxs("div",{className:"overview-modal-path","data-testid":"overview-open-card",children:[u.jsx("span",{className:"overview-modal-path-icon","aria-hidden":"true",children:u.jsx(he,{name:"FolderOpen",size:20})}),u.jsxs("span",{className:"overview-modal-path-copy",children:[u.jsx("span",{className:"overview-modal-path-title",children:"Open a folder"}),u.jsx("span",{className:"overview-modal-path-desc",children:"Agents in the folder appear in the rail. Nothing is uploaded."})]}),u.jsx("button",{ref:f,type:"button",className:"btn-primary overview-modal-cta","data-testid":"overview-open-folder",onClick:()=>S(!0),children:"Open folder"})]}),u.jsxs("div",{className:"overview-modal-path","data-testid":"overview-templates-card",children:[u.jsx("span",{className:"overview-modal-path-icon","aria-hidden":"true",children:u.jsx(he,{name:"LayoutTemplate",size:20})}),u.jsxs("span",{className:"overview-modal-path-copy",children:[u.jsx("span",{className:"overview-modal-path-title",children:"Start from a template"}),u.jsx("span",{className:"overview-modal-path-desc",children:"Runnable starters, cloned locally and free to test."})]}),u.jsx("button",{type:"button",className:"btn-line overview-modal-cta","data-testid":"overview-browse-templates",onClick:c,children:"Browse templates"})]}),u.jsxs("a",{className:"overview-modal-docs","data-testid":"overview-docs",href:aC,target:"_blank",rel:"noopener noreferrer",children:["Read documentation ",u.jsx(he,{name:"ArrowUpRight",size:12})]})]})]}),v&&u.jsx(Zp,{recentDirs:n,projectRoot:r,listDir:l,onClose:()=>S(!1),onConnect:d,onScan:p,triggerRef:f})]})}const B4="M32.1834 7.36578L34.4714 5.81493H36.5941C39.3219 5.81493 41.5567 8.05816 41.5567 10.7996V14.9539C41.5567 17.7234 39.3247 19.9385 36.5941 19.9385H34.4714L32.1834 18.3877V24H29.4277V5.81493H32.1834V7.36578ZM23.7454 7.36578V5.81493H26.5012V19.9385H23.7454V18.3877L21.4574 19.9385H19.3347C16.6069 19.9385 14.3722 17.6953 14.3722 14.9539V10.7996C14.3722 8.03001 16.6041 5.81493 19.3347 5.81493H21.4574L23.7454 7.36578ZM50.2802 17.169H54.0945V19.9385H43.7074V17.169H47.5245V8.58449H43.7074V5.81493H50.2802V17.169ZM73.2556 7.36296L75.5436 5.81212H76.9774C78.4645 5.81212 79.7667 6.60584 80.492 7.79359L81.1557 7.36296L83.4466 5.81212H84.8805C87.1516 5.81212 89 7.66975 89 9.94957V19.9385H86.3199V10.0284C86.3199 9.21495 85.6898 8.58168 84.8805 8.58168H84.3008L81.1585 10.7151V19.9357H78.4001V9.79195C78.2909 9.09675 77.7084 8.58449 76.9802 8.58449H76.4005L73.2556 10.718V19.9385H70.4998V5.81212H73.2556V7.36296ZM64.4479 5.73331C66.3944 5.73331 67.9682 7.31511 67.9682 9.27125V16.2571L64.0923 19.8456L64.0783 19.8569H59.5807C57.6372 19.8569 56.0605 18.2751 56.0605 16.319V9.33316L59.9363 5.74457L59.9504 5.73331H64.4479ZM9.23606 5.81493L11.5549 7.38829V10.7405L8.3539 8.5676H3.91231C2.66607 8.61545 2.63808 10.079 3.62665 10.4618L9.69534 12.3926C11.0284 12.8176 11.9385 14.0616 11.9385 15.4662V16.4907C11.9385 17.5968 11.3925 18.6297 10.4795 19.249L9.65053 19.8119H2.28801L0 18.261V14.9088L3.29339 17.1436H7.53336C7.55015 17.1436 9.29767 17.1859 9.36488 16.0741C9.38729 15.5928 9.12683 15.1059 8.62835 14.9005L2.88732 13.0738C1.16781 12.5249 -0.0476086 10.9515 0.210037 9.16429C0.33886 7.88365 1.34424 5.80931 4.19515 5.83183H4.20356L9.23606 5.82056V5.81493ZM32.1834 10.718V15.0383L35.3284 17.1717H36.5969C37.8096 17.1717 38.8009 16.1754 38.8009 14.9567V10.8024C38.8009 9.58367 37.8096 8.5873 36.5969 8.5873H35.3284L32.1834 10.7208V10.718ZM19.3347 8.58449C18.122 8.58449 17.1307 9.58086 17.1307 10.7996V14.9539C17.1307 16.1726 18.122 17.169 19.3347 17.169H20.6033L23.7454 15.0383V10.718L20.6033 8.58449H19.3347ZM58.7881 10.5378V16.1642C58.7881 16.6764 59.1999 17.0902 59.7096 17.0902H63.0421L65.2377 15.058V9.43168C65.2377 8.91942 64.8261 8.50568 64.3164 8.50568H60.9837L58.7881 10.5378ZM50.283 2.76956H47.2501V0H50.283V2.76956Z",H0=89,hu=24,H4=19.9385,I4=(hu-H4)/hu;function z4({height:s=16,className:t,style:n,...r}){const l=!!r["aria-label"];return u.jsx("svg",{...r,className:["brand-logotype",t].filter(Boolean).join(" "),style:{"--brand-logotype-descender":`${I4*s}px`,...n},width:H0/hu*s,height:s,viewBox:`0 0 ${H0} ${hu}`,fill:"none",focusable:"false",role:l?"img":void 0,"aria-hidden":l?void 0:!0,children:u.jsx("path",{d:B4,fill:"currentColor"})})}function $4({canGoBack:s,canGoForward:t,onGoBack:n,onGoForward:r}){return u.jsxs("div",{className:"session-nav","data-testid":"session-nav",role:"group","aria-label":"Go back or forward",children:[u.jsx("button",{type:"button",className:"theme-toggle session-nav-btn","data-testid":"session-nav-back",disabled:!s,"aria-label":"Go back","data-tooltip":"Go back",onClick:n,children:u.jsx(he,{name:"ArrowLeft",size:14})}),u.jsx("button",{type:"button",className:"theme-toggle session-nav-btn","data-testid":"session-nav-forward",disabled:!t,"aria-label":"Go forward","data-tooltip":"Go forward",onClick:r,children:u.jsx(he,{name:"ArrowRight",size:14})})]})}function P4({onCollapse:s,canGoBack:t,canGoForward:n,onGoBack:r,onGoForward:l}){return u.jsxs("header",{className:"brand-header",children:[u.jsx("div",{className:"brand-header-window",children:u.jsx("button",{className:"theme-toggle rail-toggle","data-testid":"rail-collapse","aria-label":"Collapse workspace panel",title:"Collapse workspace panel",onClick:s,children:u.jsx(he,{name:"PanelLeftClose",size:14})})}),u.jsxs("h1",{className:"brand-lockup",children:[u.jsxs("span",{className:"brand-mark",children:[u.jsx(z4,{height:13,"aria-hidden":!0}),u.jsx("span",{className:"visually-hidden",children:"Sapiom "})]}),u.jsx("span",{className:"brand-product",children:"agent.studio"})]}),u.jsx($4,{canGoBack:t,canGoForward:n,onGoBack:r,onGoForward:l})]})}function hf(s){const t=Math.round(s*100)/100;return Number.isInteger(t)?`$${t}`:`$${t.toFixed(2)}`}function U4(s){switch(s.kind){case"limit":return`${hf(s.usedUsd)} / ${hf(s.limitUsd)}`;case"balance":return`${hf(s.availableUsd)} available`;case"none":return null}}function F4({plan:s}){const[t,n]=H.useState(!1),r=H.useRef(null),l=H.useCallback(()=>n(!1),[]);if(!s)return null;const d=U4(s.readout);return!s.plan&&!d?null:u.jsx("div",{className:"rail-footer-row plan-row","data-testid":"plan-card",children:u.jsxs("div",{className:"rail-footer-card plan-card",children:[u.jsxs("span",{className:"plan-card-copy",children:[s.plan&&u.jsx("span",{className:"plan-card-name",children:s.plan.name}),d&&u.jsx("span",{className:"plan-card-readout","data-testid":"plan-balance",children:d})]}),u.jsx("a",{className:"pill plan-card-upgrade",href:u0,target:"_blank",rel:"noreferrer","data-testid":"plan-upgrade",onClick:()=>pl("plan.upgrade_clicked"),children:"Upgrade"}),u.jsx("button",{ref:r,className:"plan-card-menu-btn","data-testid":"plan-menu-trigger","aria-haspopup":"menu","aria-expanded":t,"aria-label":"Plan options",onClick:()=>n(p=>!p),children:u.jsx(he,{name:"MoreVertical",size:13})}),u.jsxs(Cn,{open:t,anchorRef:r,onDismiss:l,placement:"up-end",className:"plan-menu",role:"menu",testid:"plan-menu",children:[u.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"plan-manage-billing",onClick:()=>{window.open(u0,"_blank","noopener,noreferrer"),l()},children:[u.jsx(he,{name:"ExternalLink",size:13}),"Manage billing"]}),u.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"plan-view-usage",onClick:()=>{window.open(nC,"_blank","noopener,noreferrer"),l()},children:[u.jsx(he,{name:"ExternalLink",size:13}),"View usage"]})]})]})})}function q4({desktop:s,version:t,onToast:n}){const[r,l]=H.useState(!1),d=async()=>{if(!r){l(!0);try{const p=await s.checkForUpdates();p.kind!=="downloaded"&&n(N1(p).text)}catch{n("Couldn't check for updates.")}finally{l(!1)}}};return u.jsx("div",{className:"rail-footer-row update-row",children:u.jsxs("button",{className:"rail-footer-card update-card","data-testid":"update-card",disabled:r,onClick:()=>void d(),children:[u.jsx("span",{className:"update-card-label",children:"Update now"}),u.jsxs("span",{className:"update-card-version","data-testid":"update-card-version",children:["v",t]}),u.jsx(he,{name:"ChevronRight",size:14})]})})}function Pc({testid:s,icon:t,label:n,checked:r,onPick:l}){return u.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":r,"data-testid":s,className:"session-dropdown-item menu-choice"+(r?" is-checked":""),onClick:l,children:[u.jsx("span",{className:"session-item-icon",children:u.jsx(he,{name:t,size:13})}),u.jsx("span",{className:"session-item-copy",children:u.jsx("span",{className:"session-item-title",children:n})}),u.jsx("span",{className:"menu-choice-mark","aria-hidden":"true",children:r&&u.jsx(he,{name:"Check",size:13})})]})}const W4=Xp[0],B1={vscode:"VS Code","vscode-insiders":"VS Code Insiders",cursor:"Cursor",windsurf:"Windsurf",zed:"Zed"},G4=Xp.map(s=>({kind:s,label:B1[s]}));function Uu(s){return Xp.includes(s)?s:W4}function I0(s){return B1[Uu(s)]}function V4(s,t){const n=t.replace(/\\/g,"/"),r=n.startsWith("/")?n:`/${n}`;return`${Uu(s)}://file${encodeURI(r)}`}function Y4({authenticated:s,organizationName:t,telemetryOptIn:n,productAnalyticsOptIn:r,consentSource:l,consentEnvReason:d,onToggleTelemetry:p,onToggleProductAnalytics:c,rollingSummary:h,onToggleRollingSummary:v,editor:S,onSelectEditor:f,onStartAuth:x,onDisconnect:E}){const[T,C]=H.useState(!1),[y,b]=H.useState({status:"idle"}),m=l==="env-forced-off",g=m?!1:n,k=m?!1:r,M=async()=>{const I=!n;C(!0);try{await p(I),pl("consent.changed",{optIn:I})}finally{C(!1)}},R=async()=>{const I=!r;C(!0);try{await c(I),pl("consent.changed",{productAnalytics:I})}finally{C(!1)}},j=async()=>{C(!0);try{await v(!h)}finally{C(!1)}},A=async I=>{C(!0);try{await f(I)}finally{C(!1)}},D=async()=>{b({status:"pending"});try{await x()}catch(I){const q=I instanceof Error?I.message:"Could not start sign-in. Try again.";b({status:"error",message:q})}};return s&&y.status==="pending"&&b({status:"idle"}),u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"settings-identity",children:s?t??"Signed in":"Not signed in"}),!s&&u.jsx("div",{className:"settings-auth-row",children:y.status==="pending"?u.jsxs("span",{className:"settings-auth-pending","data-testid":"settings-auth-pending",children:[u.jsx(he,{name:"Loader",size:13}),"Opening browser… waiting for sign-in"]}):u.jsxs(u.Fragment,{children:[u.jsx("button",{type:"button",className:"btn-primary settings-connect-btn","data-testid":"settings-connect-btn",onClick:()=>void D(),children:"Connect account"}),y.status==="error"&&u.jsx("p",{className:"settings-note settings-auth-error","data-testid":"settings-auth-error",children:y.message})]})}),Up(),u.jsxs("label",{className:"settings-toggle-row",children:[u.jsx("span",{children:"Share session details with Sapiom"}),u.jsx("button",{type:"button",role:"switch","aria-checked":g,"data-testid":"telemetry-toggle",className:"toggle-switch"+(g?" is-on":""),disabled:T||m,onClick:()=>void M(),children:u.jsx("span",{className:"toggle-knob"})})]}),u.jsxs("p",{className:"settings-note",children:["Help us optimize your experience: with this on, your prompts, tool calls, and session lifecycle events are shared with Sapiom so we can see where Agent Studio gets in your way. Off by default. Always written locally to ",u.jsx("code",{children:m4.events})," either way."]}),u.jsxs("label",{className:"settings-toggle-row",children:[u.jsx("span",{children:"Product analytics (clicks & usage)"}),u.jsx("button",{type:"button",role:"switch","aria-checked":k,"data-testid":"product-analytics-toggle",className:"toggle-switch"+(k?" is-on":""),disabled:T||m,onClick:()=>void R(),children:u.jsx("span",{className:"toggle-knob"})})]}),u.jsx("p",{className:"settings-note",children:"Anonymous-by-default usage: which buttons and screens you use, and how you move through the Agent Studio. No prompt text, no file contents, and never a screen recording. On by default; turn it off here anytime."}),m&&u.jsxs("p",{className:"settings-note settings-env-note","data-testid":"telemetry-env-note",children:["All telemetry is turned off by ",d?`$${d}`:"an environment variable",". Unset it and restart the Agent Studio server to manage consent here."]}),u.jsxs("label",{className:"settings-toggle-row",children:[u.jsx("span",{children:"Summarize sessions in the background"}),u.jsx("button",{type:"button",role:"switch","aria-checked":h,"data-testid":"rolling-summary-toggle",className:"toggle-switch"+(h?" is-on":""),disabled:T,onClick:()=>void j(),children:u.jsx("span",{className:"toggle-knob"})})]}),u.jsxs("label",{className:"settings-toggle-row",children:[u.jsx("span",{children:"Open in editor uses"}),u.jsxs("span",{className:"settings-select-wrap",children:[u.jsx("select",{className:"settings-select","data-testid":"editor-select",value:Uu(S),disabled:T,onChange:I=>void A(I.target.value),children:G4.map(I=>u.jsx("option",{value:I.kind,children:I.label},I.kind))}),u.jsx("span",{className:"settings-select-caret","aria-hidden":"true",children:u.jsx(he,{name:"ChevronDown",size:12})})]})]}),u.jsx("p",{className:"settings-note",children:"Which editor the session menu’s “Open in editor” hands the project folder to. It opens the editor’s own URL scheme, so the app has to be installed — the OS never reports back, and an editor that isn’t there simply does nothing."}),u.jsxs("p",{className:"settings-note",children:["Off by default, because it uses tokens you didn’t ask to use: every 10 turns, and once at the end, a cheap one-shot coding-agent pass folds the session into a short summary. Continuing a session the coding agent can no longer reattach to then explains what the work was"," ",u.jsx("em",{children:"for"}),", not just what it last did. With this off, continuing still works — it carries the last few turns instead."]})]})}function z0({workflow:s,isFocused:t,onFocus:n}){const r=Na(s),l=r==="ready",d=r==="ready"?"Deployed to Sapiom with a ready build.":r==="building"?"Cloud build in progress.":r==="failed"?"Cloud build failed.":r==="linked"?"Linked to Sapiom; no ready build confirmed.":"Draft. Not deployed to Sapiom yet.";return u.jsx("div",{className:"workflow-item"+(t?" is-focused":""),"data-testid":`workflow-${s.name}`,children:u.jsxs("button",{className:"tree-row workflow-item-trigger",onClick:()=>n(s.path),"aria-pressed":t,"data-tooltip":t?"Focused agent":"Focus this agent",children:[u.jsx("span",{className:"tree-row-label",title:s.name,children:Wp(s.name)}),u.jsx("span",{className:"workflow-status","data-deployed":l,"data-deployment-state":r,"data-testid":`workflow-status-${s.name}`,title:d,children:u.jsx(he,{name:l?"Cloud":"CloudOff",size:13})})]})})}const K4=6e4,X4=a1();function J4(s){return s.plan!==null||s.readout.kind!=="none"}function Z4(s){const[t,n]=H.useState(null);return H.useEffect(()=>{let r=!1;n(null);const l=()=>{X4.getAccountPlan().then(p=>{r||n(J4(p)?p:null)},()=>{r||n(null)})};l();const d=setInterval(l,K4);return()=>{r=!0,clearInterval(d)}},[s]),t}const Q4=typeof navigator<"u"&&navigator.platform.toUpperCase().includes("MAC"),eT=Q4?"⌘K":"Ctrl+K";function tT({label:s,cwd:t,isDirectory:n=!0,collapsed:r,onToggleCollapsed:l,onCopyPath:d}){return u.jsxs("div",{className:"workspace-row","data-testid":`workspace-group-${s}`,children:[u.jsxs("button",{className:"workspace-row-main",onClick:l,title:n?t:s,"aria-expanded":!r,children:[n&&u.jsx(he,{name:r?"Folder":"FolderOpen",size:13}),u.jsx("span",{className:"tree-row-label",children:s}),u.jsx("span",{className:"workspace-caret"+(r?"":" is-open"),"aria-hidden":"true",children:u.jsx(he,{name:"ChevronDown",size:13})})]}),n&&u.jsx("button",{className:"workspace-row-action","aria-label":`Copy path for ${s}`,"data-tooltip":"Copy path",onClick:()=>d(t),children:u.jsx(he,{name:"Copy",size:13})})]})}function sT({label:s,cwd:t,sessionId:n,isFocused:r,onFocus:l,onScaffold:d,onCopyPath:p}){return u.jsxs("div",{className:"workspace-row"+(r?" is-selected":""),"data-testid":`workspace-group-${s}`,children:[u.jsxs("button",{className:"workspace-row-main","data-testid":`workspace-focus-${s}`,"aria-label":`Focus ${s}`,"aria-pressed":r,"data-tooltip":"Folder with sessions, no agent yet. Focus to work in it.",onClick:()=>l(t),children:[u.jsx(he,{name:"Folder",size:13}),u.jsx("span",{className:"tree-row-label",children:s})]}),u.jsx("button",{className:"workspace-row-action","data-testid":`workspace-scaffold-${s}`,"aria-label":`Scaffold an agent in ${s}`,"data-tooltip":"Scaffold an agent here",onClick:()=>d(n),children:u.jsx(he,{name:"Sparkles",size:13})}),u.jsx("button",{className:"workspace-row-action","aria-label":`Copy path for ${s}`,"data-tooltip":"Copy path",onClick:()=>p(t),children:u.jsx(he,{name:"Copy",size:13})})]})}function iT({label:s,cwd:t,isFocused:n,onFocus:r}){return u.jsxs("div",{className:"workspace-row"+(n?" is-selected":""),"data-testid":`workspace-group-${s}`,children:[u.jsxs("button",{className:"workspace-row-main","data-testid":`workspace-pending-${s}`,"aria-label":`Creating agent in ${s}`,"aria-busy":"true","data-tooltip":"Creating agent…",onClick:()=>r(t),children:[u.jsx(he,{name:"Folder",size:13}),u.jsx("span",{className:"tree-row-label",children:s})]}),u.jsx("span",{className:"workspace-row-spinner","aria-hidden":"true"})]})}function $0({testid:s,harness:t,title:n,meta:r,cwd:l,resumeMode:d,isSelected:p,onOpen:c}){const h=d==="agent-resume"?"true":d==="rehydrate"?"false":"unknown";return u.jsxs("button",{"data-testid":s,className:"session-dropdown-item"+(p?" is-selected":""),"data-resumable":h,title:l,onClick:c,children:[u.jsx("span",{className:"session-item-icon",children:u.jsx(Qp,{kind:t,size:13})}),u.jsxs("span",{className:"session-item-copy",children:[u.jsx("span",{className:"session-item-title",children:n}),u.jsx("span",{className:"session-item-meta",children:r})]})]})}function nT({width:s,minWidth:t,workflows:n,sessions:r,pendingWorkspaces:l,activeSessionId:d,focusedAgentPath:p,onFocusAgent:c,onOpenPalette:h,onConnect:v,onCollapse:S,canGoBack:f,canGoForward:x,onGoBack:E,onGoForward:T,onSelectSession:C,overviewSelected:y,onSelectOverview:b,onNewSession:m,onReviewSummary:g,history:k,historyLoading:M,onOpenHistory:R,recentDirs:j,launchDir:A,listDir:D,onCreateSession:I,listHarnesses:q,onScaffoldSession:G,onScaffoldInSession:U,projectRoot:X,onSaveProjectRoot:se,onBrowseTemplates:F,templatesActive:Q,onScanWorkflows:J,onToast:O,telemetryOptIn:B,productAnalyticsOptIn:N,rollingSummary:z,consentSource:W,consentEnvReason:Z,authenticated:ue,organizationName:ge,onToggleTelemetry:Y,onToggleProductAnalytics:$,onToggleRollingSummary:oe,editor:ae,onSelectEditor:xe,onStartAuth:Ee,onDisconnect:Ue,settingsOpen:Ye,onSetSettingsOpen:Ke}){const st=Z4(ue),[Oe,Dt]=H.useState(null);H.useEffect(()=>{const we=La();if(we!=null&&we.onUpdateState)return we.onUpdateState(Xe=>{Dt(Xe.kind==="downloaded"?{version:Xe.version}:null)})},[]);const[pt,xt]=H.useState(!1),gt=H.useRef(null),ss=H.useRef(null),[ht,vt]=H.useState(!1),[Ct,$t]=H.useState(!1),[ds,mt]=H.useState(()=>Gi().railGrouping??"workspace"),[fs,$e]=H.useState(()=>Gi().railSort??"recent"),Ss=we=>{mt(we),xn({railGrouping:we}),$t(!1)},nt=we=>{$e(we),xn({railSort:we}),$t(!1)},Cs=H.useRef(null),qt=H.useCallback(()=>{vt(!1),$t(!1)},[]),[Nt,kt]=H.useState(()=>new Set(Gi().collapsedCwds??[])),si=we=>{kt(Xe=>{const ts=new Set(Xe);return ts.has(we)?ts.delete(we):ts.add(we),ts})};H.useEffect(()=>{xn({collapsedCwds:Array.from(Nt)})},[Nt]);const ps=r.filter(we=>we.status==="exited"),mi=()=>{const we=!ht;if($t(!1),vt(we),we){const Xe=E1(r,j,d);Xe.length>0&&R(Xe)}},$s=new Set(r.map(we=>we.id)),ii=new Set(r.map(we=>we.agentSessionId).filter(we=>we!=null)),Vs=k.filter(we=>!(we.harnessSessionId!=null&&$s.has(we.harnessSessionId))&&!ii.has(we.agentSessionId)),Ie=[...ps.map(we=>({kind:"exited",at:we.lastActiveAt,session:we})),...Vs.map(we=>({kind:"summary",at:we.lastActiveAt,summary:we}))].sort((we,Xe)=>Xe.at.localeCompare(we.at)),tt=new Map(k.map(we=>[we.agentSessionId,we])),{workspaces:Wt,orphanAgents:is}=Ok(n,r,ds,fs,j,l.map(we=>we.cwd)),ws=Wt.length===0&&is.length===0,Bs=we=>{var Xe;(Xe=navigator.clipboard)==null||Xe.writeText(we).then(()=>O("Path copied.","success")).catch(()=>O("Couldn't copy the path."))};return u.jsxs("aside",{ref:ss,className:"rail rail-workflows",style:{width:s,minWidth:t},children:[u.jsx(P4,{onCollapse:S,canGoBack:f,canGoForward:x,onGoBack:E,onGoForward:T}),u.jsxs("nav",{className:"rail-nav","aria-label":"Primary",children:[u.jsxs("button",{type:"button",className:"rail-nav-cta"+(ws?" is-empty":""),"data-testid":"rail-create-new","aria-label":"Create a new agent",onClick:()=>{vt(!1),m()},children:[u.jsx(he,{name:"Plus",size:14}),u.jsx("span",{children:"Create new"})]}),u.jsxs("button",{type:"button",className:"rail-nav-row","data-testid":"palette-trigger","aria-label":"Search sessions, agents, and paths",onClick:h,children:[u.jsx(he,{name:"Search",size:14}),u.jsx("span",{children:"Search"}),u.jsx("span",{className:"rail-nav-kbd",children:eT})]}),u.jsxs("button",{type:"button",className:"rail-nav-row"+(Q?" is-selected":""),"data-testid":"rail-templates","aria-current":Q?"page":void 0,onClick:F,children:[u.jsx(he,{name:"LayoutTemplate",size:14}),u.jsx("span",{children:"Templates"})]}),u.jsxs("button",{type:"button",ref:gt,className:"rail-nav-row","data-testid":"add-existing-agents","aria-haspopup":"dialog","aria-expanded":pt,onClick:()=>{vt(!1),xt(!0)},children:[u.jsx(he,{name:"FolderPlus",size:14}),u.jsx("span",{children:"Add existing agents"})]})]}),u.jsxs("div",{className:"rail-header",children:[u.jsx(he,{name:"Folder",size:14}),u.jsx("span",{className:"rail-header-label",children:"Workspaces"}),u.jsx("div",{className:"rail-header-actions",children:u.jsx("button",{ref:Cs,className:"theme-toggle rail-header-btn","data-testid":"history-trigger","aria-label":"Workspace options","aria-haspopup":"menu","aria-expanded":ht,"data-tooltip":"Grouping, sorting and past sessions",onClick:mi,children:u.jsx(he,{name:"MoreHorizontal",size:14})})})]}),u.jsxs("div",{className:"rail-tree",children:[u.jsx(Cn,{open:ht,anchorRef:Cs,onDismiss:qt,placement:"right-start",besideRef:ss,noClip:!0,className:"menu-flyer",testid:"history-menu",children:u.jsxs("div",{className:"menu-flyer-track",children:[u.jsxs("div",{className:"connect-card history-card",children:[u.jsxs("div",{className:"connect-card-header",children:[u.jsx("span",{children:"Workspaces"}),u.jsx("button",{className:"theme-toggle connect-card-close",onClick:qt,"aria-label":"Close",title:"Close",children:u.jsx(he,{name:"X",size:13})})]}),u.jsxs("div",{className:"connect-card-body",role:"menu",children:[u.jsxs("div",{className:"menu-choice-group",onMouseEnter:()=>$t(!1),children:[u.jsx("div",{className:"session-dropdown-section",children:"Group by"}),u.jsx(Pc,{testid:"group-workspace",icon:"FolderOpen",label:"Workspace",checked:ds==="workspace",onPick:()=>Ss("workspace")}),u.jsx(Pc,{testid:"group-deployment",icon:"Cloud",label:"Deployment",checked:ds==="deployment",onPick:()=>Ss("deployment")}),u.jsx("div",{className:"session-dropdown-section",children:"Sort"}),u.jsx(Pc,{testid:"sort-recent",icon:"History",label:"Recent activity",checked:fs==="recent",onPick:()=>nt("recent")}),u.jsx(Pc,{testid:"sort-name",icon:"ArrowDown",label:"Name",checked:fs==="name",onPick:()=>nt("name")})]}),u.jsxs("button",{type:"button",className:"session-dropdown-item nested-trigger"+(Ct?" is-open":""),"data-testid":"past-sessions-trigger","aria-haspopup":"menu","aria-expanded":Ct,onMouseEnter:()=>$t(!0),onClick:()=>$t(we=>!we),children:[u.jsx("span",{className:"session-item-icon",children:u.jsx(he,{name:"History",size:13})}),u.jsx("span",{className:"session-item-copy",children:u.jsx("span",{className:"session-item-title",children:"Past sessions"})}),ps.length>0&&u.jsx("span",{className:"session-history-badge","data-testid":"session-history-badge",children:ps.length}),u.jsx(he,{name:"ChevronRight",size:13})]})]})]}),Ct&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"menu-flyer-bridge","aria-hidden":"true"}),u.jsxs("div",{className:"connect-card menu-flyer-nested",children:[u.jsxs("div",{className:"connect-card-header",children:[u.jsx("span",{children:"Past sessions"}),u.jsx("button",{className:"theme-toggle connect-card-close",onClick:()=>$t(!1),"aria-label":"Back",title:"Back",children:u.jsx(he,{name:"X",size:13})})]}),u.jsxs("div",{className:"connect-card-body past-sessions-list","data-testid":"past-sessions-card",children:[Ie.map(we=>{if(we.kind==="exited"){const Xe=we.session.agentSessionId==null?void 0:tt.get(we.session.agentSessionId),ts=we.session.agentSessionId==null?"rehydrate":Xe==null?void 0:Xe.resumeMode;return u.jsx($0,{testid:`exited-session-${we.session.id}`,harness:we.session.harness,title:we.session.title,meta:Jf({...we.session,gitBranch:Xe==null?void 0:Xe.gitBranch,turnCount:Xe==null?void 0:Xe.turnCount,messageCount:Xe==null?void 0:Xe.messageCount},void 0,{includeHarness:!1,state:x0({resumeMode:ts,turnCount:Xe==null?void 0:Xe.turnCount})}),cwd:we.session.cwd,resumeMode:ts,isSelected:we.session.id===d,onOpen:()=>{C(we.session.id),qt()}},we.session.id)}return u.jsx($0,{testid:`history-${we.summary.agentSessionId}`,harness:we.summary.harness,title:we.summary.title,meta:Jf(we.summary,void 0,{includeHarness:!1,state:x0(we.summary)}),cwd:we.summary.cwd,resumeMode:we.summary.resumeMode,isSelected:!1,onOpen:()=>{g(we.summary),qt()}},we.summary.agentSessionId)}),M&&u.jsx("div",{className:"session-dropdown-empty",children:"Loading…"}),!M&&Ie.length===0&&u.jsx("div",{className:"session-dropdown-empty",children:"No past sessions yet"})]})]})]})]})}),u.jsxs("div",{className:"rail-list",children:[Wt.length===0&&is.length===0&&u.jsx(Bi,{className:"rail-empty",icon:"Folder",title:"No agents yet",body:"Open a workspace folder to start a session, or add one. Agents (sapiom.json) appear here automatically."}),Wt.map(we=>{const Xe=Nt.has(we.cwd);if(we.pending)return u.jsx("div",{className:"workspace-group",children:u.jsx(iT,{label:we.label,cwd:we.cwd,isFocused:we.cwd===p,onFocus:c})},we.cwd);if(we.agents.length===0&&we.bareSessions.length>0){const Es=we.bareSessions[0];return u.jsx("div",{className:"workspace-group",children:u.jsx(sT,{label:we.label,cwd:we.cwd,sessionId:Es.id,isFocused:we.cwd===p,onFocus:c,onScaffold:U,onCopyPath:Bs})},we.cwd)}return u.jsxs("div",{className:"workspace-group",children:[u.jsx(tT,{label:we.label,cwd:we.cwd,isDirectory:we.isDirectory,collapsed:Xe,onToggleCollapsed:()=>si(we.cwd),onCopyPath:Bs}),!Xe&&we.agents.map(Es=>u.jsx(z0,{workflow:Es.workflow,isFocused:Es.workflow.path===p,onFocus:c},Es.workflow.path))]},we.cwd)}),is.length>0&&u.jsxs("div",{className:"workspace-group",children:[u.jsx("div",{className:"workspace-row",children:u.jsxs("div",{className:"workspace-row-main workspace-row-static","data-tooltip":"Agents that live outside any session folder. Focus one to start a session in its own folder.",children:[u.jsx(he,{name:"Folder",size:13}),u.jsx("span",{className:"tree-row-label",children:"No workspace"})]})}),is.map(we=>u.jsx(z0,{workflow:we.workflow,isFocused:we.workflow.path===p,onFocus:c},we.workflow.path))]})]})]}),u.jsxs("div",{className:"rail-footer",children:[Oe&&(()=>{const we=La();return we?u.jsx(q4,{desktop:we,version:Oe.version,onToast:O}):null})(),u.jsx(F4,{plan:st}),u.jsx(rT,{onToast:O,authenticated:ue,organizationName:ge,telemetryOptIn:B,productAnalyticsOptIn:N,rollingSummary:z,consentSource:W,consentEnvReason:Z,onToggleTelemetry:Y,onToggleProductAnalytics:$,onToggleRollingSummary:oe,editor:ae,onSelectEditor:xe,onStartAuth:Ee,onDisconnect:Ue,settingsOpen:Ye,onSetSettingsOpen:Ke,overviewSelected:y,onSelectOverview:b})]}),pt&&u.jsx(Zp,{recentDirs:j,launchDir:A,projectRoot:X,listDir:D,onClose:()=>xt(!1),onConnect:v,onScan:J,triggerRef:gt})]})}function rT({authenticated:s,organizationName:t,telemetryOptIn:n,productAnalyticsOptIn:r,rollingSummary:l,consentSource:d,consentEnvReason:p,onToggleTelemetry:c,onToggleProductAnalytics:h,onToggleRollingSummary:v,editor:S,onSelectEditor:f,onStartAuth:x,onDisconnect:E,settingsOpen:T,onSetSettingsOpen:C,overviewSelected:y,onSelectOverview:b,onToast:m}){const[g,k]=H.useState(!1),[M,R]=H.useState(Ou());H.useEffect(()=>Pp(R),[]);const[j,A]=H.useState({status:"idle"}),D=H.useRef(null),I=H.useCallback(()=>k(!1),[]),q=H.useCallback(()=>C(!1),[C]),G=Up(),U=j.status==="pending",X=La(),[se,F]=H.useState(!1),Q=async()=>{if(!(!X||se)){F(!0),I();try{const z=await X.checkForUpdates(),W=N1(z);m(W.text,W.tone==="error"?"error":z.kind==="up-to-date"||z.kind==="downloaded"?"success":"info")}catch{m("Couldn't check for updates.")}finally{F(!1)}}};s&&j.status==="pending"&&A({status:"idle"});const J=U?"Connecting…":s?t??"Signed in":"Not signed in",O=U?"opening browser":s?"Sapiom account":"connect to get started",B=(t??"S").charAt(0).toUpperCase(),N=async()=>{I(),A({status:"pending"});try{await x()}catch(z){const W=z instanceof Error?z.message:"Could not start sign-in. Try again.";A({status:"error",message:W})}};return u.jsxs("div",{className:"rail-footer-row rail-profile-wrap",children:[u.jsxs("button",{ref:D,className:"rail-profile","data-testid":"brand-identity","aria-haspopup":"menu","aria-expanded":g,title:"Account",onClick:()=>{const z=!g;k(z),z&&q()},children:[u.jsx("span",{className:"rail-profile-avatar","aria-hidden":"true",children:B}),u.jsxs("span",{className:"rail-profile-copy",children:[u.jsx("span",{className:"rail-profile-name",children:J}),u.jsxs("span",{className:"rail-profile-meta",children:[u.jsx("span",{className:"identity-dot","data-authenticated":s,"data-pending":U}),O]})]}),u.jsx(he,{name:"ChevronDown",size:14})]}),u.jsx(Cn,{open:T,anchorRef:D,onDismiss:q,placement:"up-start",matchWidth:!0,className:"settings-popover",testid:"settings-popover",children:u.jsx(Y4,{authenticated:s,organizationName:t,telemetryOptIn:n,productAnalyticsOptIn:r,rollingSummary:l,consentSource:d,consentEnvReason:p,onToggleTelemetry:c,onToggleProductAnalytics:h,onToggleRollingSummary:v,editor:S,onSelectEditor:f,onStartAuth:x,onDisconnect:E})}),u.jsxs(Cn,{open:g,anchorRef:D,onDismiss:I,placement:"up-start",matchWidth:!0,className:"profile-menu",role:"menu",testid:"profile-menu",children:[u.jsxs("button",{role:"menuitem",className:"profile-menu-item"+(y?" is-selected":""),"data-testid":"rail-overview",onClick:()=>{b(),I()},children:[u.jsx(he,{name:"Info",size:13}),"Overview"]}),u.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"profile-open-dashboard",onClick:()=>{window.open(u1,"_blank","noopener,noreferrer"),I()},children:[u.jsx(he,{name:"ExternalLink",size:13}),"Open Sapiom dashboard"]}),u.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"settings-trigger",onClick:()=>{C(!0),I()},children:[u.jsx(he,{name:"Settings",size:13}),"Settings"]}),u.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"theme-toggle",onClick:()=>{n1(),I()},children:[u.jsx(he,{name:M==="dark"?"Sun":"Moon",size:13}),M==="dark"?"Switch to light mode":"Switch to dark mode"]}),X&&u.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"profile-check-updates",disabled:se,onClick:()=>void Q(),children:[u.jsx(he,{name:se?"Loader":"RefreshCw",size:13}),se?"Checking…":"Check for updates",X.appVersion&&u.jsxs("span",{className:"profile-menu-version","data-testid":"app-version",children:["v",X.appVersion]})]}),!s&&u.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"profile-connect-account",disabled:U,onClick:()=>void N(),children:[u.jsx(he,{name:"Plug",size:13}),U?"Connecting…":"Connect account"]}),s&&u.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"profile-disconnect-account",onClick:()=>{E(),I()},children:[u.jsx(he,{name:"LogOut",size:13}),"Disconnect"]}),G,j.status==="error"&&u.jsx("p",{className:"profile-menu-auth-error","data-testid":"profile-auth-error",children:j.message})]})]})}const aT=new Set([401,403]);function oT(s){return s?s.networkError===!0||s.status===void 0:!1}function lT(s){return(s==null?void 0:s.status)!==void 0&&aT.has(s.status)}function cT(s){const{online:t,error:n}=s;return!t||oT(n)?"offline":lT(n)?"auth":n?"error":"online"}function P0(){return typeof navigator>"u"?!0:navigator.onLine!==!1}function uT(){const[s,t]=H.useState(P0);return H.useEffect(()=>{const n=()=>t(P0());return window.addEventListener("online",n),window.addEventListener("offline",n),n(),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",n)}},[]),s}function U0(s,t){return s!=null&&s.workflowPath===t}function hT(s=typeof window>"u"?"":window.location.search){const t=new URLSearchParams(s),n=t.get("agent");if(n){const l=t.get("agentSlug");return{kind:"agent",definitionId:n,...l?{slug:l}:{}}}const r=t.get("template");if(r){const l=t.get("templateSlug");return{kind:"template",templateId:r,...l?{slug:l}:{}}}return null}function dT({agentLabel:s,onCancel:t,onConfirm:n}){const r=H.useRef(null);return xl(!0,{onDismiss:t,containerRef:r}),u.jsx("div",{className:"modal-backdrop",onClick:t,children:u.jsxs("div",{ref:r,className:"modal modal-confirm",role:"alertdialog","aria-label":"Clone agent","data-testid":"clone-agent-confirm",onClick:l=>l.stopPropagation(),children:[u.jsxs("div",{className:"modal-header",children:["Clone this agent?",u.jsx("button",{className:"theme-toggle modal-close","aria-label":"Close",title:"Close",onClick:t,children:u.jsx(he,{name:"X",size:14})})]}),u.jsx("div",{className:"modal-body",children:u.jsxs("p",{className:"modal-copy",children:[s," isn’t on this machine yet. Cloning checks it out locally — a git clone and npm install the coding agent runs — then opens it here."]})}),u.jsxs("div",{className:"modal-actions",children:[u.jsx("button",{className:"btn-ghost",autoFocus:!0,onClick:t,children:"Cancel"}),u.jsx("button",{className:"btn-primary","data-testid":"clone-agent-confirm-btn",onClick:n,children:"Clone locally"})]})]})})}var ce=typeof window<"u"?window:void 0,zs=typeof globalThis<"u"?globalThis:ce,Ws=zs==null?void 0:zs.navigator,De=zs==null?void 0:zs.document,hs=zs==null?void 0:zs.location,ev=zs==null?void 0:zs.fetch,Zf=zs!=null&&zs.XMLHttpRequest&&"withCredentials"in new zs.XMLHttpRequest?zs.XMLHttpRequest:void 0,F0=zs==null?void 0:zs.AbortController,fT=zs==null?void 0:zs.CompressionStream,ei=Ws==null?void 0:Ws.userAgent;function H1(){return!(!ce||ce.navigator.onLine===!1)}var Po=typeof globalThis<"u"?globalThis:ce;Po&&typeof self>"u"&&(Po.self=Po),Po&&typeof File>"u"&&(Po.File=function(){});var He=ce??{},Et={DEBUG:!1,LIB_VERSION:"0.3.1",LIB_NAME:"browser-common"};function q0(s,t,n,r,l,d,p){try{var c=s[d](p),h=c.value}catch(v){return void n(v)}c.done?t(h):Promise.resolve(h).then(r,l)}function Kt(s){return function(){var t=this,n=arguments;return new Promise((function(r,l){var d=s.apply(t,n);function p(h){q0(d,r,l,p,c,"next",h)}function c(h){q0(d,r,l,p,c,"throw",h)}p(void 0)}))}}function Ce(){return Ce=Object.assign?Object.assign.bind():function(s){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(s[r]=n[r])}return s},Ce.apply(null,arguments)}function I1(s,t){if(s==null)return{};var n={};for(var r in s)if({}.hasOwnProperty.call(s,r)){if(t.indexOf(r)!==-1)continue;n[r]=s[r]}return n}var W0=s=>{if(typeof s!="string")return s;try{return JSON.parse(s)}catch{return s}};function G0(s){return typeof s=="string"||s}function V0(s){return typeof s=="string"?s:void 0}var Uo,pT=["$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","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],gn=(function(s){return s.AnonymousId="anonymous_id",s.DistinctId="distinct_id",s.Props="props",s.EnablePersonProcessing="enable_person_processing",s.PersonMode="person_mode",s.FeatureFlagDetails="feature_flag_details",s.FeatureFlags="feature_flags",s.FeatureFlagPayloads="feature_flag_payloads",s.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",s.BootstrapFeatureFlags="bootstrap_feature_flags",s.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",s.OverrideFeatureFlags="override_feature_flags",s.Queue="queue",s.AiQueue="ai_queue",s.LogsQueue="logs_queue",s.OptedOut="opted_out",s.SessionId="session_id",s.SessionStartTimestamp="session_start_timestamp",s.SessionLastTimestamp="session_timestamp",s.PersonProperties="person_properties",s.GroupProperties="group_properties",s.InstalledAppBuild="installed_app_build",s.InstalledAppVersion="installed_app_version",s.SessionReplay="session_replay",s.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",s.SurveyLastSeenDate="survey_last_seen_date",s.SurveysSeen="surveys_seen",s.Surveys="surveys",s.RemoteConfig="remote_config",s.FlagsEndpointWasHit="flags_endpoint_was_hit",s.DeviceId="device_id",s})({}),Y0=(function(s){return s.GZipJS="gzip-js",s.Base64="base64",s})({}),vT=["$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"],mT=["token"],z1="NativeGzipValidationError",Qf=s=>s.length>=2&&s[0]===31&&s[1]===139,K0=(s,t)=>s===Y0.GZipJS||t===Y0.GZipJS||t==="gzip",X0=s=>!(!s||typeof s!="object")&&("name"in s?String(s.name):"")==="NotReadableError",Uc=s=>{var t=new Error("Native gzip produced invalid output: "+s);throw t.name=z1,t},gT=(function(){var s=Kt((function*(t,n){18>t.size&&Uc("too-short");var r=new Uint8Array(yield t.slice(0,10).arrayBuffer());Qf(r)&&r[2]===8||Uc("invalid-header");var l=new DataView(yield t.slice(t.size-8).arrayBuffer());l.getUint32(0,!0)!==(p=>{for(var c=(()=>{if(Uo)return Uo;Uo=[];for(var S=0;256>S;S++){for(var f=S,x=0;8>x;x++)f=1&f?3988292384^f>>>1:f>>>1;Uo[S]=f>>>0}return Uo})(),h=4294967295,v=0;p.length>v;v++)h=c[255&(h^p[v])]^h>>>8;return(4294967295^h)>>>0})(n)&&Uc("invalid-crc");var d=n.length>>>0;l.getUint32(4,!0)!==d&&Uc("invalid-size")}));return function(t,n){return s.apply(this,arguments)}})();function ep(){return ep=Kt((function*(s,t,n){t===void 0&&(t=!0);try{var r=new TextEncoder().encode(s),l=new globalThis.CompressionStream("gzip"),d=l.writable.getWriter(),p=d.write(r).then((()=>d.close())).catch((function(){var v=Kt((function*(S){try{yield d.abort(S)}catch{}throw S}));return function(S){return v.apply(this,arguments)}})()),c=new Response(l.readable).blob(),h=(yield Promise.all([c,p]))[0];return yield gT(h,r),h}catch(v){if(n!=null&&n.rethrow)throw v;return t&&console.error("Failed to gzip compress data",v),null}})),ep.apply(this,arguments)}var _T=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],J0=function(s,t){if(t===void 0&&(t=[]),!s)return!1;var n=s.toLowerCase();return _T.concat(t).some((r=>{var l=r.toLowerCase();return n.indexOf(l)!==-1}))};function Ge(s,t){return s.indexOf(t)!==-1}var Fu=function(s){return s.trim()},tp=function(s){return s.replace(/^\$/,"")};function $1(s){var t,n=[];return(t=JSON.stringify(s,(function(r,l){if(typeof l=="bigint")return l.toString();if(typeof l!="function"&&typeof l!="symbol"){if(l instanceof Error)return{name:l.name,message:l.message,stack:l.stack};if(l&&typeof l=="object"){for(;n.length>0&&n[n.length-1]!==this;)n.pop();if(n.includes(l))return"[Circular]";n.push(l)}return l}})))!==null&&t!==void 0?t:"null"}var P1=Object.prototype,U1=P1.hasOwnProperty,qu=P1.toString,Ze=Array.isArray||function(s){return qu.call(s)==="[object Array]"},fi=s=>typeof s=="function",Yt=s=>s===Object(s)&&!Ze(s),Kn=s=>{if(Yt(s)){for(var t in s)if(U1.call(s,t))return!1;return!0}return!1},Te=s=>s===void 0,It=s=>qu.call(s)=="[object String]",sp=s=>It(s)&&s.trim().length===0,Gs=s=>s===null,et=s=>Te(s)||Gs(s),Os=s=>qu.call(s)=="[object Number]"&&s==s,vn=s=>Os(s)&&s>0,Hi=s=>qu.call(s)==="[object Boolean]",yT=s=>s instanceof FormData,bT=s=>Ge(vT,s),ST=s=>Ge(mT,s);function F1(s){return s===null||typeof s!="object"}function du(s,t){return{}.toString.call(s)==="[object "+t+"]"}function tv(s){return typeof Event<"u"&&(function(t,n){try{return t instanceof n}catch{return!1}})(s,Event)}var wT=[!0,"true",1,"1","yes"],df=s=>Ge(wT,s),xT=[!1,"false",0,"0","no"];function Vi(s,t,n,r,l){return t>n&&(r.warn("min cannot be greater than max."),t=n),Os(s)?s>n?(r.warn(" cannot be greater than max: "+n+". Using max value instead."),n):t>s?(r.warn(" cannot be less than min: "+t+". Using min value instead."),t):s:(r.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+l),Vi(l||n,t,n,r))}class CT{constructor(t){this.tt={},this.et=t.et,this.rt=Vi(t.bucketSize,0,100,t.it),this.nt=Vi(t.refillRate,0,this.rt,t.it),this.st=Vi(t.refillInterval,0,864e5,t.it)}ot(t,n){var r=Math.floor((n-t.lastAccess)/this.st);r>0&&(t.tokens=Math.min(t.tokens+r*this.nt,this.rt),t.lastAccess=t.lastAccess+r*this.st)}consumeRateLimit(t){var n,r=Date.now(),l=String(t),d=this.tt[l];return d?this.ot(d,r):this.tt[l]=d={tokens:this.rt,lastAccess:r},d.tokens===0||(d.tokens--,d.tokens===0&&((n=this.et)==null||n.call(this,t)),d.tokens===0)}stop(){this.tt={}}}var vi="Mobile",fu="iOS",wn="Android",Oa="Tablet",q1=wn+" "+Oa,W1="iPad",G1="Apple",V1=G1+" Watch",nl="Safari",Ba="BlackBerry",Y1="Samsung",K1=Y1+"Browser",X1=Y1+" Internet",Or="Chrome",ET=Or+" OS",J1=Or+" "+fu,sv="Internet Explorer",Z1=sv+" "+vi,iv="Opera",kT=iv+" Mini",nv="Edge",Q1="Microsoft "+nv,Ma="Firefox",eb=Ma+" "+fu,vl="Nintendo",ml="PlayStation",ja="Xbox",tb=wn+" "+vi,sb=vi+" "+nl,Zo="Windows",ip=Zo+" Phone",Z0="Nokia",np="Ouya",ib="Generic",TT=ib+" "+vi.toLowerCase(),nb=ib+" "+Oa.toLowerCase(),rp="Konqueror",rb="Oculus Browser",pu="Vivaldi",ab="Yandex",vu="Whale",ap="DuckDuckGo",ob="Pale Moon",mu="Waterfox",rl="Brave",lb="Google Search App",Qt="(\\d+(\\.\\d+)?)",ff=new RegExp("Version/"+Qt),AT=new RegExp(ja,"i"),RT=new RegExp(ml+" \\w+","i"),MT=new RegExp(vl+" \\w+","i"),rv=new RegExp(Ba+"|PlayBook|BB10","i"),jT={"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"},cb=function(s,t,n,r){t=t||"";var l=(function(d){return d!=null&&d.brave?rl:null})(n);return l||(r!=null&&r.detectGoogleSearchApp&&Ge(s,"GSA/")?lb:Ge(s," OPR/")&&Ge(s,"Mini")?kT:Ge(s," OPR/")?iv:rv.test(s)?Ba:Ge(s,"IE"+vi)||Ge(s,"WPDesktop")?Z1:Ge(s,"OculusBrowser")?rb:Ge(s,K1)?X1:Ge(s,nv)||Ge(s,"Edg/")?Q1:Ge(s,pu+"/")?pu:Ge(s,"YaBrowser/")?ab:Ge(s,vu+"/")?vu:Ge(s,ap+"/")||Ge(s,"Ddg/")?ap:Ge(s,"FBIOS")?"Facebook "+vi:Ge(s,"UCWEB")||Ge(s,"UCBrowser")?"UC Browser":Ge(s,"CriOS")?J1:Ge(s,"CrMo")||Ge(s,Or)?Or:Ge(s,wn)&&Ge(s,nl)?tb:Ge(s,"FxiOS")?eb:Ge(s.toLowerCase(),rp.toLowerCase())?rp:Ge(s,rl+"/")?rl:((d,p)=>p&&Ge(p,G1)||(function(c){return Ge(c,nl)&&!Ge(c,Or)&&!Ge(c,wn)})(d))(s,t)?Ge(s,vi)?sb:nl:Ge(s,"PaleMoon/")?ob:Ge(s,mu+"/")?mu:Ge(s,Ma)?Ma:Ge(s,"MSIE")||Ge(s,"Trident/")?sv:Ge(s,"Gecko")?Ma:"")},DT={[Z1]:[new RegExp("rv:"+Qt)],[Q1]:[new RegExp(nv+"?\\/"+Qt)],[Or]:[new RegExp("("+Or+"|CrMo)\\/"+Qt)],[J1]:[new RegExp("CriOS\\/"+Qt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Qt)],[nl]:[ff],[sb]:[ff],[iv]:[new RegExp("(Opera|OPR)\\/"+Qt)],[Ma]:[new RegExp(Ma+"\\/"+Qt)],[eb]:[new RegExp("FxiOS\\/"+Qt)],[rp]:[new RegExp("Konqueror[:/]?"+Qt,"i")],[Ba]:[new RegExp(Ba+" "+Qt),ff],[tb]:[new RegExp("android\\s"+Qt,"i")],[X1]:[new RegExp(K1+"\\/"+Qt)],[rb]:[new RegExp("OculusBrowser\\/"+Qt)],[pu]:[new RegExp(pu+"\\/"+Qt)],[ab]:[new RegExp("YaBrowser\\/"+Qt)],[vu]:[new RegExp(vu+"\\/"+Qt)],[rl]:[new RegExp(rl+"\\/"+Qt)],[ap]:[new RegExp("(DuckDuckGo|Ddg)\\/"+Qt)],[ob]:[new RegExp("PaleMoon\\/"+Qt)],[mu]:[new RegExp(mu+"\\/"+Qt)],[lb]:[new RegExp("GSA\\/"+Qt)],[sv]:[new RegExp("(rv:|MSIE )"+Qt)],Mozilla:[new RegExp("rv:"+Qt)]},NT=function(s,t,n,r){var l=cb(s,t,n,r),d=DT[l];if(Te(d))return null;for(var p=0;d.length>p;p++){var c=s.match(d[p]);if(c)return parseFloat(c[c.length-2])}return null},Q0=[[new RegExp(ja+"; "+ja+" (.*?)[);]","i"),s=>[ja,s&&s[1]||""]],[new RegExp(vl,"i"),[vl,""]],[new RegExp(ml,"i"),[ml,""]],[rv,[Ba,""]],[new RegExp(Zo,"i"),(s,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[ip,""];if(new RegExp(vi).test(t)&&!/IEMobile\b/.test(t))return[Zo+" "+vi,""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var r=jT[n[1]]||"";return/arm/i.test(t)&&(r="RT"),[Zo,r]}return[Zo,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,s=>s&&s[3]?[fu,[s[3],s[4],s[5]||"0"].join(".")]:[fu,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,s=>{var t="";return s&&s.length>=3&&(t=Te(s[2])?s[3]:s[2]),["watchOS",t]}],[new RegExp("("+wn+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+wn+")","i"),s=>s&&s[2]?[wn,[s[2],s[3],s[4]||"0"].join(".")]:[wn,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,s=>{var t=["Mac OS X",""];return s&&s[1]&&(t[1]=[s[1],s[2],s[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[ET,""]],[/Linux|debian/i,["Linux",""]]],ey=function(s){return MT.test(s)?vl:RT.test(s)?ml:AT.test(s)?ja:new RegExp(np,"i").test(s)?np:new RegExp("("+ip+"|WPDesktop)","i").test(s)?ip:/iPad/.test(s)?W1:/iPod/.test(s)?"iPod Touch":/iPhone/.test(s)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(s)?V1:rv.test(s)?Ba:/(kobo)\s(ereader|touch)/i.test(s)?"Kobo":new RegExp(Z0,"i").test(s)?Z0:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(s)||/(kf[a-z]+)( bui|\)).+silk\//i.test(s)?"Kindle Fire":/(Android|ZTE)/i.test(s)?new RegExp(vi).test(s)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(s)||/pixel[\daxl ]{1,6}/i.test(s)&&!/pixel c/i.test(s)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(s)||/lmy47v/i.test(s)&&!/QTAQZ3/i.test(s)?wn:q1:new RegExp("(pda|"+vi+")","i").test(s)?TT:new RegExp(Oa,"i").test(s)&&!new RegExp(Oa+" pc","i").test(s)?nb:""},LT=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function ty(s,t){return typeof(n=s)=="string"&<.test(n)?s:t();var n}function Qn(s){return s&&s.split("#")[0]}function su(s,t){var n=setTimeout(s,t);return n!=null&&n.unref&&(n==null||n.unref()),n}var OT=s=>s instanceof Error,ub={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}},BT=ub.info;function hb(s){if(Hi(s))return{boolValue:s};if(typeof s=="number")return Number.isFinite(s)?Number.isInteger(s)?{intValue:s}:{doubleValue:s}:{stringValue:String(s)};if(typeof s=="string")return{stringValue:s};if(Ze(s))return{arrayValue:{values:s.map((t=>hb(t)))}};try{return{stringValue:JSON.stringify(s)}}catch{return{stringValue:String(s)}}}function gu(s){var t=[];for(var n in s){var r=s[n];Gs(r)||Te(r)||t.push({key:n,value:hb(r)})}return t}function HT(s,t){var n=ub[s.level||"info"]||BT,r=n.text,l=n.number,d=String(Date.now())+"000000",p={};t.distinctId&&(p.posthogDistinctId=t.distinctId),t.sessionId&&(p.sessionId=t.sessionId),t.windowId&&(p["window.id"]=t.windowId),et(t.sessionStartTimestamp)||(p.sessionStartTimestamp=String(t.sessionStartTimestamp)),et(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 c=Ce({},p,s.attributes||{}),h={timeUnixNano:d,observedTimeUnixNano:d,severityNumber:l,severityText:r,body:{stringValue:s.body},attributes:gu(c)};return s.trace_id&&(h.traceId=s.trace_id),s.span_id&&(h.spanId=s.span_id),Te(s.trace_flags)||(h.flags=s.trace_flags),h}function db(s,t,n){return Ce({},s.resourceAttributes,{"service.name":s.serviceName||"unknown_service"},s.environment&&{"deployment.environment":s.environment},s.serviceVersion&&{"service.version":s.serviceVersion},{"telemetry.sdk.name":t,"telemetry.sdk.version":n})}function fb(s,t,n,r){return{resourceLogs:[{resource:{attributes:gu(t)},scopeLogs:[{scope:{name:n,version:r},logRecords:s}]}]}}let IT=class{constructor(s,t,n,r,l,d,p){var c;d===void 0&&(d=()=>Promise.resolve()),this._instance=s,this.Te=t,this.it=n,this.ut=r,this.ht=l,this.dt=d,this.ct=p,this.vt=null,this.ft=0,this.yt=0,this.bt=0,this._t=0,this.wt=!1,this.xt=t.maxBufferSize,this.kt=Math.max((c=t.maxQueueSize)!==null&&c!==void 0?c:t.maxBufferSize,t.maxBufferSize),this.St=t.flushIntervalMs,this.Ct=t.maxBatchRecordsPerPost,this.Mt=t.rateCapWindowMs,this.It=t.maxLogsPerInterval}reset(){this.Tt(),this.vt=null,this.bt=0,this._t=0,this.wt=!1,this.ft=0,this.yt=0,this.Ct=this.Te.maxBatchRecordsPerPost}onReconnect(){this.yt=0,this.Et()}captureLog(s){if(!this._instance.isDisabled&&!this._instance.optedOut&&s!=null&&s.body){var t=this.Rt(s);if(t!==null)if(t.body){if(this.Pt()){var n={record:HT(t,this.ut())};this.ht((()=>this.Ot(n)))}}else this.it.info("Log was rejected in beforeSend function")}}Rt(s){var t=this.Te.beforeSend;if(!t)return s;var n=Ze(t)?t:[t],r=s;for(var l of n)try{var d=l(r);if(!d)return this.it.info("Log was rejected in beforeSend function"),null;r=d}catch(p){return this.it.error("Error in beforeSend function for log:",p),null}return r}Pt(){if(this.It===void 0)return!0;var s=Date.now(),t=s-this.bt;return this.Mt>t&&t>=0||(this.bt=s,this._t=0,this.wt=!1),this.It>this._t?(this._t++,!0):(this.wt||(this.it.warn("captureLog dropping logs: exceeded "+this.It+" logs per "+this.Mt+"ms"),this.wt=!0),!1)}flush(){var s=this;return Kt((function*(){if(!s._instance.isDisabled)return s.vt||(s.vt=s.Ft().finally((()=>{s.vt=null}))),s.vt}))()}Ft(){var s=this;return Kt((function*(){var t;s.Tt();var n=(t=s._instance.getPersistedProperty(gn.LogsQueue))!==null&&t!==void 0?t:[];if(n.length!==0)for(var r=n.length,l=0;n.length>0&&r>l;){var d,p;s.ft=0;var c=Math.min(n.length,s.Ct),h=n.slice(0,c),v=fb(h.map((f=>f.record)),s.At(),(d=s.ct)!==null&&d!==void 0?d:s._instance.getLibraryId(),s._instance.getLibraryVersion()),S=yield s._instance.$t(v);if(S.kind==="too-large"&&h.length>1)s.Ct=Math.max(1,Math.floor(h.length/2)),s.it.warn("Received 413 when sending logs batch of size "+h.length+", reducing batch size to "+s.Ct);else if(S.kind==="retry-later"||(S.kind==="too-large"?s.it.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."):S.kind==="ok"&&s.Te.maxBatchRecordsPerPost>s.Ct&&(s.Ct=Math.min(s.Te.maxBatchRecordsPerPost,s.Ct+1)),yield s.Lt(h.length),n=(p=s._instance.getPersistedProperty(gn.LogsQueue))!==null&&p!==void 0?p:[],l+=h.length,S.kind==="fatal"))throw S.error}}))()}Lt(s){var t=this;return Kt((function*(){var n,r=Math.max(0,s-t.ft),l=(n=t._instance.getPersistedProperty(gn.LogsQueue))!==null&&n!==void 0?n:[];t._instance.setPersistedProperty(gn.LogsQueue,l.slice(r)),yield t.dt()}))()}At(){return db(this.Te,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ot(s){var t;if(!this._instance.optedOut){var n=(t=this._instance.getPersistedProperty(gn.LogsQueue))!==null&&t!==void 0?t:[];this.kt>n.length||(n.shift(),this.ft++,this.it.info("Logs queue is full, dropping oldest record.")),n.push(s),this._instance.setPersistedProperty(gn.LogsQueue,n),this.xt>n.length?this.Dt():this.Et()}}Dt(s){s===void 0&&(s=this.St),this.Nt||(this.Nt=su((()=>{this.Nt=void 0,this.Et()}),s))}qt(){var s=Math.min(Math.max(0,this.yt-1),6);return this.St*Math.pow(2,s)}jt(){var s=this._instance.getPersistedProperty(gn.LogsQueue);return!!s&&s.length>0}shutdown(s){var t=this;return Kt((function*(){t.Tt();var n=t.flush().catch((()=>{}));s!==void 0?yield Promise.race([n,new Promise((r=>su(r,s)))]):yield n}))()}flushWithTimeout(s){var t=this;return Kt((function*(){var n=!1,r=t.flush(),l=new Promise((d=>su((()=>{n=!0,d()}),s)));try{yield Promise.race([r,l])}finally{n&&r.catch((()=>{}))}}))()}Et(){this.flush().then((()=>{this.yt=0}),(s=>{this.yt++,this.it.error("PostHog logs flush failed:",s)})).finally((()=>{!this._instance.isDisabled&&this.jt()&&this.Dt(this.qt())}))}Tt(){this.Nt&&(clearTimeout(this.Nt),this.Nt=void 0)}};var pf=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function sy(s){return String(s)+"000000"}function iy(s,t,n,r){var l="";return r&&(l=Object.keys(r).sort().map((d=>JSON.stringify(d)+":"+JSON.stringify(r[d]))).join(",")),s+"\0"+t+"\0"+(n??"")+"\0"+l}let zT=class{constructor(s,t,n){this._instance=s,this.Te=t,this.it=n,this.Bt=new Map,this.vt=null,this.Ht=!1,this.Ut=new Map,this.zt=new Set,this.Vt=0}count(s,t,n){t===void 0&&(t=1),this.Wt({name:s,type:"count",value:t,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}gauge(s,t,n){this.Wt({name:s,type:"gauge",value:t,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}histogram(s,t,n){this.Wt({name:s,type:"histogram",value:t,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}flush(){var s=this,t=this.vt,n=(function(){var l=Kt((function*(){t&&(yield t.catch((()=>{}))),yield s.Zt()}));return function(){return l.apply(this,arguments)}})(),r=n().finally((()=>{this.vt===r&&(this.vt=null)}));return this.vt=r,r}drainWindow(){if(this.Bt.size===0)return null;var s=this.Bt;return this.Bt=new Map,this.Ht=!1,this.Ut=new Map,this.zt=new Set,this.Gt(s)}reset(){this.Vt++,this.Tt(),this.Bt=new Map,this.vt=null,this.Ht=!1,this.Ut=new Map,this.zt=new Set}Wt(s){if(!this._instance.isDisabled&&!this._instance.optedOut){var t=this.Rt(s);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.it.warn("Dropping count '"+t.name+"': counters are monotonic, value must be >= 0");else{var n,r;try{n=t.attributes?Ce({},t.attributes):void 0,r=iy(t.type,t.name,t.unit,n)}catch(p){return void this.it.warn("Dropping metric '"+t.name+"': attributes could not be serialized",p)}var l=this.Bt.get(r);if(!l){if(!this.Qt())return;l={name:t.name,type:t.type,unit:t.unit,attributes:n,windowStartMs:Date.now()},this.Bt.set(r,l)}var d=this.Ut.get(t.name);d===void 0?this.Ut.set(t.name,t.type):d===t.type||this.zt.has(t.name)||(this.zt.add(t.name),this.it.warn("Metric name '"+t.name+"' is already used as a "+d+"; recording it as a "+t.type+" too will blend both series in charts. Use a distinct name.")),this.Jt(l,t.value),this.Dt()}else this.it.warn("Dropping metric '"+t.name+"': value must be a finite number");else this.it.warn("Dropping metric with empty name")}}Qt(){return this.Te.maxSeriesPerFlush>this.Bt.size||(this.Ht||(this.Ht=!0,this.it.warn("Metric series cap reached ("+this.Te.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}Jt(s,t){var n;switch(s.type){case"count":s.total=((n=s.total)!==null&&n!==void 0?n:0)+t;break;case"gauge":s.last=t;break;case"histogram":s.hist||(s.hist={count:0,sum:0,min:t,max:t,bucketCounts:new Array(pf.length+1).fill(0)});var r=s.hist;r.count+=1,r.sum+=t,r.min=Math.min(r.min,t),r.max=Math.max(r.max,t),r.bucketCounts[(function(l,d){for(var p=0;d.length>p;p++)if(d[p]>=l)return p;return d.length})(t,pf)]+=1}}Rt(s){var t=this.Te.beforeSend;if(!t)return s;var n=Ze(t)?t:[t],r=s;for(var l of n)try{var d=l(r);if(!d)return this.it.info("Metric was rejected in beforeSend function"),null;r=d}catch(p){return this.it.error("Error in beforeSend function for metric:",p),null}return r}Dt(){this.Nt||(this.Nt=su((()=>{this.Nt=void 0,this.flush().catch((s=>{this.it.error("Metrics flush failed:",s)}))}),this.Te.flushIntervalMs))}Tt(){this.Nt&&(clearTimeout(this.Nt),this.Nt=void 0)}Zt(){var s=this;return Kt((function*(){if(s.Bt.size!==0){var t=s.Bt;s.Bt=new Map,s.Ht=!1,s.Ut=new Map,s.zt=new Set;var n=s.Vt,r=yield s._instance.Kt(s.Gt(t));if(n===s.Vt)switch(r.kind){case"ok":return;case"retry-later":return s.Yt(t),void s.Dt();case"too-large":return void s.it.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void s.it.error("Failed to send metrics batch:",r.error)}}}))()}Gt(s){return t=this.Xt(s),n=(function(d,p,c){return Ce({},d.resourceAttributes,{"service.name":d.serviceName||"unknown_service"},d.environment&&{"deployment.environment":d.environment},d.serviceVersion&&{"service.version":d.serviceVersion},{"telemetry.sdk.name":p,"telemetry.sdk.version":c})})(this.Te,this._instance.getLibraryId(),this._instance.getLibraryVersion()),r=this._instance.getLibraryId(),l=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:gu(n)},scopeMetrics:[{scope:{name:r,version:l},metrics:t}]}]};var t,n,r,l}Xt(s){var t=sy(Date.now()),n=new Map;for(var r of s.values()){var l,d=iy(r.type,r.name,r.unit,void 0),p=n.get(d);p||(p=Ce({name:r.name},r.unit&&{unit:r.unit}),r.type==="count"?p.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:r.type==="gauge"?p.gauge={dataPoints:[]}:p.histogram={aggregationTemporality:1,dataPoints:[]},n.set(d,p));var c=gu((l=r.attributes)!==null&&l!==void 0?l:{}),h=sy(r.windowStartMs);if(r.type==="count"){var v,S={attributes:c,startTimeUnixNano:h,timeUnixNano:t,asDouble:(v=r.total)!==null&&v!==void 0?v:0};p.sum.dataPoints.push(S)}else if(r.type==="gauge"){var f,x={attributes:c,timeUnixNano:t,asDouble:(f=r.last)!==null&&f!==void 0?f:0};p.gauge.dataPoints.push(x)}else r.hist&&p.histogram.dataPoints.push({attributes:c,startTimeUnixNano:h,timeUnixNano:t,count:r.hist.count,sum:r.hist.sum,min:r.hist.min,max:r.hist.max,bucketCounts:r.hist.bucketCounts,explicitBounds:pf})}return Array.from(n.values())}Yt(s){var t,n;for(var r of s){var l=r[0],d=r[1],p=this.Bt.get(l);if(p)switch(p.windowStartMs=Math.min(p.windowStartMs,d.windowStartMs),p.type){case"count":p.total=((t=p.total)!==null&&t!==void 0?t:0)+((n=d.total)!==null&&n!==void 0?n:0);break;case"gauge":break;case"histogram":if(d.hist)if(p.hist){p.hist.count+=d.hist.count,p.hist.sum+=d.hist.sum,p.hist.min=Math.min(p.hist.min,d.hist.min),p.hist.max=Math.max(p.hist.max,d.hist.max);for(var c=0;p.hist.bucketCounts.length>c;c++)p.hist.bucketCounts[c]+=d.hist.bucketCounts[c]}else p.hist=d.hist}else this.Qt()&&this.Bt.set(l,d)}}};var Fc,ny,vf;function $T(s){var t=globalThis._posthogChunkIds;if(t){var n=Object.keys(t);return vf&&n.length===ny||(ny=n.length,vf=n.reduce(((r,l)=>{Fc||(Fc={});var d=Fc[l];if(d)r[d[0]]=d[1];else for(var p=s(l),c=p.length-1;c>=0;c--){var h=p[c],v=h==null?void 0:h.filename,S=t[l];if(v&&S){r[v]=S,Fc[l]=[v,S];break}}return r}),{})),vf}}class PT{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"},l=this.buildCoercingContext(r,n,0).apply(t),d=this.buildParsingContext(n),p=this.parseStacktrace(l,d);return{$exception_list:this.convertToExceptionList(p,r),$exception_level:"error"}}modifyFrames(t){var n=this;return Kt((function*(){for(var r of t)r.stacktrace&&r.stacktrace.frames&&Ze(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,l;return t.cause!=null&&(r=this.parseStacktrace(t.cause,n)),t.stack!=""&&t.stack!=null&&(l=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?n.skipFirstLines:0),n.chunkIdMap)),Ce({},t,{cause:r,stack:l})}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 Kt((function*(){var r=t;for(var l of n.modifiers)r=yield l(r);return r}))()}convertToExceptionList(t,n){var r,l,d,p={type:t.type,value:t.value,mechanism:{type:(r=n.type)!==null&&r!==void 0?r:"generic",handled:(l=n.handled)===null||l===void 0||l,synthetic:(d=t.synthetic)!==null&&d!==void 0&&d}};t.stack&&(p.stacktrace={type:"raw",frames:t.stack});var c=[p];return t.cause!=null&&c.push(...this.convertToExceptionList(t.cause,Ce({},n,{handled:!0}))),c}buildParsingContext(t){var n;return{chunkIdMap:$T(this.stackParser),skipFirstLines:(n=t.skipFirstLines)!==null&&n!==void 0?n:1}}buildCoercingContext(t,n,r){r===void 0&&(r=0);var l=(d,p)=>{if(4>=p){var c=this.buildCoercingContext(t,n,p);return this.applyCoercers(d,c)}};return Ce({},n,{syntheticException:r==0?n.syntheticException:void 0,mechanism:t,apply:d=>l(d,r),next:d=>l(d,r+1)})}}var Ha="?";function op(s,t,n,r,l){var d={platform:s,filename:t,function:n==="<anonymous>"?Ha:n,in_app:!0};return Te(r)||(d.lineno=r),Te(l)||(d.colno=l),d}var pb=(s,t)=>{var n=s.indexOf("safari-extension")!==-1,r=s.indexOf("safari-web-extension")!==-1;return n||r?[s.indexOf("@")!==-1?s.split("@")[0]:Ha,n?"safari-extension:"+t:"safari-web-extension:"+t]:[s,t]},UT=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,FT=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,qT=/\((\S*)(?::(\d+))(?::(\d+))\)/,WT=(s,t)=>{var n=UT.exec(s);if(n)return op(t,n[1],Ha,+n[2],+n[3]);var r=FT.exec(s);if(r){if(r[2]&&r[2].indexOf("eval")===0){var l=qT.exec(r[2]);l&&(r[2]=l[1],r[3]=l[2],r[4]=l[3])}var d=pb(r[1]||Ha,r[2]);return op(t,d[1],d[0],r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},GT=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,VT=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,YT=(s,t)=>{var n=GT.exec(s);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){var r=VT.exec(n[3]);r&&(n[1]=n[1]||"eval",n[3]=r[1],n[4]=r[2],n[5]="")}var l=n[3],d=n[1]||Ha,p=pb(d,l);return op(t,l=p[1],d=p[0],n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},ry=/\(error: (.*)\)/;class KT{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,n){var r=It(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 du(t,"DOMException")}isDOMError(t){return du(t,"DOMError")}}class XT{match(t){return(n=>n instanceof Error)(t)}coerce(t,n){return{type:this.getType(t),value:this.getMessage(t,n),stack:this.getStack(t),cause:t.cause?n.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,n){var 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 JT{constructor(){}match(t){return du(t,"ErrorEvent")&&t.error!=null}coerce(t,n){var r;return n.apply(t.error)||{type:"ErrorEvent",value:t.message,stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}var ZT=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class QT{match(t){return typeof t=="string"}coerce(t,n){var r,l=this.getInfos(t),d=l[0],p=l[1];return{type:d??"Error",value:p??t,stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}getInfos(t){var n="Error",r=t,l=t.match(ZT);return l&&(n=l[1],r=l[2]),[n,r]}}var e5=["fatal","error","warning","log","info","debug"];function vb(s,t){t===void 0&&(t=40);var n=Object.keys(s);if(n.sort(),!n.length)return"[object has no keys]";for(var r=n.length;r>0;r--){var l=n.slice(0,r).join(", ");if(t>=l.length)return r===n.length?l:l.length>t?l.slice(0,t)+"...":l}return""}class t5{match(t){return typeof t=="object"&&t!==null}coerce(t,n){var r,l=this.getErrorPropertyFromObject(t);return l?n.apply(l):{type:this.getType(t),value:this.getValue(t),stack:(r=n.syntheticException)==null?void 0:r.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return tv(t)?t.constructor.name:"Error"}getValue(t){if("name"in t&&typeof t.name=="string"){var n="'"+t.name+"' captured as exception";return"message"in t&&typeof t.message=="string"&&(n+=" with message: '"+t.message+"'"),n}if("message"in t&&typeof t.message=="string")return t.message;var r=this.getObjectClassName(t);return(r&&r!=="Object"?"'"+r+"'":"Object")+" captured as exception with keys: "+vb(t)}isSeverityLevel(t){return It(t)&&!sp(t)&&e5.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var n in t)if({}.hasOwnProperty.call(t,n)){var r=t[n];if(OT(r))return r}}getObjectClassName(t){try{var n=Object.getPrototypeOf(t);return n?n.constructor.name:void 0}catch{return}}}class s5{match(t){return tv(t)}coerce(t,n){var r,l=t.constructor.name;return{type:l,value:l+" captured as exception with keys: "+vb(t),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class i5{match(t){return F1(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 n5{match(t){return du(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!tv(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,l=this.getUnhandledRejectionReason(t);return F1(l)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(l),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}:n.apply(l)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&t.detail!=null&&typeof t.detail=="object"&&"reason"in t.detail)return t.detail.reason}catch{}return t}}var _u="$message",yu="$timestamp",r5=new Set([_u,yu]),mf={enabled:!0,max_bytes:32768};function bu(s){var t;return s?{enabled:(t=s.enabled)!==null&&t!==void 0?t:mf.enabled,max_bytes:o5(s.max_bytes,mf.max_bytes)}:Ce({},mf)}class a5{constructor(t){this.$e=[],this.ze=0,this.Te=bu(t)}setConfig(t){this.Te=bu(t),this.Ze()}add(t){var n=(function(l){var d;try{d=$1(l)}catch{return}try{var p=JSON.parse(d);if(!Yt(p))return;var c=p,h=c[_u],v=c[yu];return!It(h)||h.trim().length===0||!It(v)&&!Os(v)?void 0:{step:c,json:d}}catch{return}})(t);if(n){var r=(function(l){if(typeof TextEncoder<"u")return new TextEncoder().encode(l).length;for(var d=encodeURIComponent(l),p=0,c=0;d.length>c;c++)d[c]==="%"?(p+=1,c+=2):p+=1;return p})(n.json);r>this.Te.max_bytes||(this.$e.push({step:n.step,bytes:r}),this.ze+=r,this.Ze())}}getAttachable(){return this.$e.map((t=>t.step))}clear(){this.$e=[],this.ze=0}size(){return this.$e.length}Ze(){for(;this.ze>this.Te.max_bytes&&this.$e.length>0;){var t=this.$e.shift();t&&(this.ze-=t.bytes)}}}function o5(s,t){if(!Os(s)||s===1/0||s===-1/0)return t;var n=Math.floor(s);return 0>n?t:n}var mb=function(s,t){var n=(t===void 0?{}:t).debugEnabled,r={k(l){if(ce&&(Et.DEBUG||ce.POSTHOG_DEBUG||n)&&!Te(ce.console)&&ce.console){for(var d=("__rrweb_original__"in ce.console[l])?ce.console[l].__rrweb_original__:ce.console[l],p=arguments.length,c=new Array(p>1?p-1:0),h=1;p>h;h++)c[h-1]=arguments[h];d(s,...c)}},debug(){for(var l=arguments.length,d=new Array(l),p=0;l>p;p++)d[p]=arguments[p];r.k("debug",...d)},info(){for(var l=arguments.length,d=new Array(l),p=0;l>p;p++)d[p]=arguments[p];r.k("log",...d)},warn(){for(var l=arguments.length,d=new Array(l),p=0;l>p;p++)d[p]=arguments[p];r.k("warn",...d)},error(){for(var l=arguments.length,d=new Array(l),p=0;l>p;p++)d[p]=arguments[p];r.k("error",...d)},critical(){for(var l=arguments.length,d=new Array(l),p=0;l>p;p++)d[p]=arguments[p];console.error(s,...d)},uninitializedWarning(l){r.error("You must initialize PostHog before calling "+l)},createLogger:(l,d)=>mb(s+" "+l,d)};return r},Ae=mb("[PostHog.js]"),Jt=Ae.createLogger,l5=Jt("[ExternalScriptsLoader]"),gf=(s,t,n)=>{if(s.config.disable_external_dependency_loading)return l5.warn(t+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var r=De==null?void 0:De.querySelectorAll("script");if(r){for(var l,d=function(){if(r[p].src===t){var h=r[p];return h.__posthog_loading_callback_fired?{v:n()}:(h.addEventListener("load",(v=>{h.__posthog_loading_callback_fired=!0,n(void 0,v)})),h.onerror=v=>n(v),{v:void 0})}},p=0;r.length>p;p++)if(l=d())return l.v}var c=()=>{if(!De)return n("document not found");var h=De.createElement("script");if(h.type="text/javascript",h.crossOrigin="anonymous",h.src=t,h.onload=f=>{h.__posthog_loading_callback_fired=!0,n(void 0,f)},h.onerror=f=>n(f),s.config.prepare_external_dependency_script&&(h=s.config.prepare_external_dependency_script(h)),!h)return n("prepare_external_dependency_script returned null");if(s.config.external_scripts_inject_target==="head")De.head.appendChild(h);else{var v,S=De.querySelectorAll("body > script");S.length>0?(v=S[0].parentNode)==null||v.insertBefore(h,S[0]):De.body.appendChild(h)}};De!=null&&De.body?c():De==null||De.addEventListener("DOMContentLoaded",c)};He.__PosthogExtensions__=He.__PosthogExtensions__||{},He.__PosthogExtensions__.loadExternalDependency=(s,t,n)=>{if(t!=="remote-config"){var r;if(s.config.strict_script_versioning)r=s.requestRouter.endpointFor("assets","/static/"+s.version+"/"+t+".js");else{var l="/static/"+t+".js?v="+s.version;if(t==="toolbar"){var d=3e5;l=l+"&t="+Math.floor(Date.now()/d)*d}r=s.requestRouter.endpointFor("assets",l)}gf(s,r,n)}else{var p=s.requestRouter.endpointFor("assets","/array/"+s.config.token+"/config.js");gf(s,p,n)}},He.__PosthogExtensions__.loadSiteApp=(s,t,n)=>{var r=s.requestRouter.endpointFor("api",t);gf(s,r,n)};Et.DEBUG=!1,Et.LIB_VERSION="1.409.5",Et.LIB_NAME="web";var gb="$people_distinct_id",gl="$device_id",_f="$device_model",Qo="__alias",el="__timers",lp="$autocapture_disabled_server_side",cp="$heatmaps_enabled_server_side",up="$exception_capture_enabled_server_side",hp="$error_tracking_suppression_rules",dp="$error_tracking_capture_extension_exceptions",fp="$web_vitals_enabled_server_side",av="$dead_clicks_enabled_server_side",ov="$product_tours_enabled_server_side",pp="$web_vitals_allowed_metrics",Lr="$session_recording_remote_config",_b="$replay_sample_rate",yb="$replay_override_sampling",bb="$replay_override_linked_flag",Sb="$replay_override_url_trigger",wb="$replay_override_event_trigger",Ea="$sesid",lv="$session_is_sampled",Dr="$enabled_feature_flags",iu="$active_feature_flags",tl="$early_access_features",vp="$feature_flag_details",nu="$feature_flag_payloads",mp="$feature_flag_request_id",Su="$minimal_flag_called_events",mn="$override_feature_flags",wa="$override_feature_flag_payloads",Rr="$stored_person_properties",Mr="$stored_group_properties",gp="$surveys",wu="$surveys_loaded_at",_p="$surveys_activated",ru="$surveys_activated_session",sl="ph_product_tours",al="$flag_call_reported",yp="$flag_call_reported_session_id",bp="$feature_flag_errors",_l="$feature_flag_evaluated_at",ki="$user_state",Sp="$client_session_props",wp="$capture_rate_limit",xp="$initial_campaign_params",Cp="$initial_referrer_info",xu="$initial_person_info",Cu="$epp",qc="$posthog_cookieless",xb="$cookieless_mode",Cb="$sdk_debug_extensions_init_method",Eb="$sdk_debug_extensions_init_time_ms",kb="$sdk_debug_recording_script_not_loaded",cv="PostHog loadExternalDependency extension not found.",jr="on_reject",yn="always",_a="anonymous",wr="identified",Ep="identified_only",Eu="visibilitychange",ku="beforeunload",xa="$pageview",yf="$pageleave",bf="$identify",ay="$groupidentify";function Wc(s,t){Ze(s)&&s.forEach(t)}function zt(s,t){if(!et(s))if(Ze(s))s.forEach(t);else if(yT(s))s.forEach(((r,l)=>t(r,l)));else for(var n in s)U1.call(s,n)&&t(s[n],n)}var Ft=function(s){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 l of n)for(var d in l)l[d]!==void 0&&(s[d]=l[d]);return s};function au(s){for(var t=Object.keys(s),n=t.length,r=new Array(n);n--;)r[n]=[t[n],s[t[n]]];return r}var oy=function(s){try{return s()}catch{return}},c5=function(s){return function(){try{for(var t=arguments.length,n=new Array(t),r=0;t>r;r++)n[r]=arguments[r];return s.apply(this,n)}catch(l){Ae.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Ae.critical(l)}}},uv=function(s){var t={};return zt(s,(function(n,r){(It(n)&&n.length>0||Os(n))&&(t[r]=n)})),t},u5=["herokuapp.com","vercel.app","netlify.app"];function h5(s){var t=s==null?void 0:s.hostname;if(!It(t))return!1;var n=t.split(".").slice(-2).join(".");for(var r of u5)if(n===r)return!1;return!0}function es(s,t,n,r){var l=r??{},d=l.capture,p=l.passive;s==null||s.addEventListener(t,n,{capture:d!==void 0&&d,passive:p===void 0||p})}function Tb(s){return s.name==="ph_toolbar_internal"}var Ab=s=>{if(De){try{for(var t=s+"=",n=De.cookie.split(";").filter((d=>d.length)),r=0;n.length>r;r++){for(var l=n[r];l.charAt(0)==" ";)l=l.substring(1,l.length);if(l.indexOf(t)===0)return decodeURIComponent(l.substring(t.length,l.length))}}catch{}return null}};Math.trunc||(Math.trunc=function(s){return 0>s?Math.ceil(s):Math.floor(s)}),Number.isInteger||(Number.isInteger=function(s){return Os(s)&&isFinite(s)&&Math.floor(s)===s});class Tu{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,n,r,l){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(l)||0>t||0>n||0>r||0>l||t>0xffffffffffff||n>4095||r>1073741823||l>4294967295)throw new RangeError("invalid field value");var d=new Uint8Array(16);return d[0]=t/Math.pow(2,40),d[1]=t/Math.pow(2,32),d[2]=t/Math.pow(2,24),d[3]=t/Math.pow(2,16),d[4]=t/256,d[5]=t,d[6]=112|n>>>8,d[7]=n,d[8]=128|r>>>24,d[9]=r>>>16,d[10]=r>>>8,d[11]=r,d[12]=l>>>24,d[13]=l>>>16,d[14]=l>>>8,d[15]=l,new Tu(d)}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 Tu(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 d5{generate(){var t=this.generateOrAbort();if(!Te(t))return t;this.S=0;var n=this.generateOrAbort();if(Te(n))throw new Error("Could not generate UUID after timestamp reset");return n}generateOrAbort(){var t=Date.now();if(t>this.S)this.S=t,this.C();else{if(this.S>=t+1e4)return;this.M++,this.M>4398046511103&&(this.S++,this.C())}return Tu.fromFieldsV7(this.S,Math.trunc(this.M/Math.pow(2,30)),this.M&Math.pow(2,30)-1,this.I.nextUint32())}C(){this.M=1024*this.I.nextUint32()+(1023&this.I.nextUint32())}constructor(){this.S=0,this.M=0,this.I=new f5}}var ly,Rb=s=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;s.length>t;t++)s[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return s};ce&&!Te(ce.crypto)&&crypto.getRandomValues&&(Rb=s=>crypto.getRandomValues(s));class f5{nextUint32(){return this.R.length>this.O||(Rb(this.R),this.O=0),this.R[this.O++]}constructor(){this.R=new Uint32Array(8),this.O=1/0}}var _n=()=>p5().toString(),p5=()=>(ly||(ly=new d5)).generate(),Fo="",v5=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,bn={N:()=>!!De,P(s){Ae.error("cookieStore error: "+s)},q:Ab,F(s){var t;try{t=JSON.parse(bn.q(s))||{}}catch{}return t},A(s,t,n,r,l){if(!De)return!1;try{var d="",p="",c=(function(S,f){if(f){var x=(function(T,C){if(C===void 0&&(C=De),Fo)return Fo;if(!C||["localhost","127.0.0.1"].includes(T))return"";for(var y=T.split("."),b=Math.min(y.length,8),m="dmn_chk_"+_n();!Fo&&b--;){var g=y.slice(b).join("."),k=m+"=1;domain=."+g+";path=/";C.cookie=k+";max-age=3",C.cookie.includes(m)&&(C.cookie=k+";max-age=0",Fo=g)}return Fo})(S);if(!x){var E=(T=>{var C=T.match(v5);return C?C[0]:""})(S);E!==x&&Ae.info("Warning: cookie subdomain discovery mismatch",E,x),x=E}return x?"; domain=."+x:""}return""})(De.location.hostname,r);if(n){var h=new Date;h.setTime(h.getTime()+864e5*n),d="; expires="+h.toUTCString()}l&&(p="; secure");var v=s+"="+encodeURIComponent(JSON.stringify(t))+d+"; SameSite=Lax; path=/"+c+p;return v.length>3686.4&&Ae.warn("cookieStore warning: large cookie, len="+v.length),De.cookie=v,!0}catch{return!1}},D(s,t){if(De!=null&&De.cookie)try{bn.A(s,"",-1,t)}catch{return}}},Sf=null,Ut={N(){if(!Gs(Sf))return Sf;var s=!0;if(Te(ce))s=!1;else try{var t="__mplssupport__";Ut.A(t,"xyz"),Ut.q(t)!=='"xyz"'&&(s=!1),Ut.D(t)}catch{s=!1}return s||Ae.error("localStorage unsupported; falling back to cookie store"),Sf=s,s},P(s){Ae.error("localStorage error: "+s)},q(s){try{return ce==null?void 0:ce.localStorage.getItem(s)}catch(t){Ut.P(t)}return null},F(s){try{return JSON.parse(Ut.q(s))||{}}catch{}return null},A(s,t){try{return ce==null||ce.localStorage.setItem(s,JSON.stringify(t)),!0}catch(n){Ut.P(n)}return!1},D(s){try{ce==null||ce.localStorage.removeItem(s)}catch(t){Ut.P(t)}}},m5=[gl,"distinct_id",Ea,lv,Cu,xu,ki],Gc={},g5={N:()=>!0,P(s){Ae.error("memoryStorage error: "+s)},q:s=>Gc[s]||null,F:s=>Gc[s]||null,A:(s,t)=>(Gc[s]=t,!0),D(s){delete Gc[s]}},xr=null,Ls={N(){if(!Gs(xr))return xr;if(xr=!0,Te(ce))xr=!1;else try{var s="__support__";Ls.A(s,"xyz"),Ls.q(s)!=='"xyz"'&&(xr=!1),Ls.D(s)}catch{xr=!1}return xr},P(s){Ae.error("sessionStorage error: ",s)},q(s){try{return ce==null?void 0:ce.sessionStorage.getItem(s)}catch(t){Ls.P(t)}return null},F(s){try{return JSON.parse(Ls.q(s))||null}catch{}return null},A(s,t){try{return ce==null||ce.sessionStorage.setItem(s,JSON.stringify(t)),!0}catch(n){Ls.P(n)}return!1},D(s){try{ce==null||ce.sessionStorage.removeItem(s)}catch(t){Ls.P(t)}}};class _5{constructor(t){this._instance=t}get Te(){return this._instance.config}get consent(){return this.Ge()?0:this.Qe}isOptedOut(){return this.Te.cookieless_mode===yn||this.isRejected()||this.consent===-1&&this.Te.cookieless_mode===jr}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Te.opt_out_capturing_by_default}optInOut(t){this.Je.A(this.Ke,t?1:0,this.Te.cookie_expiration,this.Te.cross_subdomain_cookie,this.Te.secure_cookie)}reset(){this.Je.D(this.Ke,this.Te.cross_subdomain_cookie)}get Ke(){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 Qe(){var t=this.Je.q(this.Ke);return df(t)?1:Ge(xT,t)?0:-1}get Je(){var t=this.Te.opt_out_capturing_persistence_type,n=t==="localStorage"?Ut:bn;if(!this.Ye||this.Ye!==n){this.Ye=n;var r=t==="localStorage"?bn:Ut;r.q(this.Ke)&&(this.Ye.q(this.Ke)||this.optInOut(df(r.q(this.Ke))),r.D(this.Ke,this.Te.cross_subdomain_cookie))}return this.Ye}Ge(){return!!this.Te.respect_dnt&&[Ws==null?void 0:Ws.doNotTrack,Ws==null?void 0:Ws.msDoNotTrack,He.doNotTrack].some((t=>df(t)))}}function Mb(s,t){var n,r=s==null||(n=s.config)==null?void 0:n.get_current_url;if(!fi(r))return t;try{var l=r(t);return It(l)&&l?l:t}catch(d){return Ae.error("Error in get_current_url, falling back to window.location.href",d),t}}var jb="__POSTHOG_TOOLBAR__",y5=1,b5=3,S5=11;function cy(s){return s instanceof Element&&(s.id===jb||!(s.closest==null||!s.closest(".toolbar-global-fade-container")))}function er(s){return!!s&&s.nodeType===y5}function pi(s,t){return!!s&&!!s.tagName&&s.tagName.toLowerCase()===t.toLowerCase()}function Db(s){return!!s&&s.nodeType===b5}function Nb(s){return!!s&&s.nodeType===S5&&er(s.host)}var Lb=1e3;function hv(s){return s?Fu(s).split(/\s+/):[]}function uy(s,t){var n=(function(r){var l,d=ce==null||(l=ce.location)==null?void 0:l.href;return Te(d)?void 0:Mb(r,d)})(t);return!!(n&&s&&s.some((r=>n.match(r))))}function Au(s){var t="";switch(typeof s.className){case"string":t=s.className;break;case"object":t=(s.className&&"baseVal"in s.className?s.className.baseVal:null)||s.getAttribute("class")||"";break;default:t=""}return hv(t)}function Ob(s){return et(s)?null:Fu(s).split(/(\s+)/).filter((t=>ol(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function yl(s){var t="";return Tp(s)&&!zb(s)&&s.childNodes&&s.childNodes.length&&zt(s.childNodes,(function(n){var r;Db(n)&&n.textContent&&(t+=(r=Ob(n.textContent))!==null&&r!==void 0?r:"")})),Fu(t)}function wf(s){var t;return Te(s.target)?s.srcElement||null:(t=s.target)!=null&&t.shadowRoot?s.composedPath()[0]||null:s.target||null}var dv=["a","button","form","input","select","textarea","label"];function kp(s,t){if(Te(t))return!0;var n,r=function(d){if(t.some((p=>(function(c,h){var v=c.matches||c.matchesSelector||c.msMatchesSelector||c.mozMatchesSelector||c.webkitMatchesSelector||c.oMatchesSelector;try{return!!v&&v.call(c,h)}catch{return!1}})(d,p))))return{v:!0}};for(var l of s)if(n=r(l))return n.v;return!1}function Bb(s){var t=s.parentNode;return!(!t||!er(t))&&t}var w5=[".ph-no-autocapture","[data-ph-no-autocapture]"],Hb=["next","previous","prev",">","<"],x5=[...Hb,"+","-","−","–"],hy=(s,t)=>/[a-z0-9]/i.test(t)?s.includes(t):s===t,dy=[".ph-no-rageclick",".ph-no-capture"],C5=["","text","search","email","password","url","tel","number"];function fy(s,t){if(!ce||fv(s))return!1;var n,r,l,d,p;if(Hi(t)?(n=!!t&&dy,r=void 0,l=!1):(n=(d=t==null?void 0:t.css_selector_ignorelist)!==null&&d!==void 0?d:dy,r=t==null?void 0:t.content_ignorelist,l=(p=t==null?void 0:t.ignore_text_selection)!==null&&p!==void 0&&p),n===!1||l&&(function(h){return!(!h||!er(h))&&(!!pi(h,"textarea")||(pi(h,"input")?Ge(C5,(h.getAttribute("type")||"").toLowerCase()):(function(v){if(v.isContentEditable)return!0;var S=v.getAttribute==null?void 0:v.getAttribute("contenteditable");return S==="true"||S===""})(h)))})(s))return!1;var c=Ib(s,!1).targetElementList;return!(function(h,v){if(h===!1||Te(h))return!1;var S;if(h===!0)S=Hb;else{if(!Ze(h))return!1;if(h.length>10)return Ae.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;S=h.map((f=>f.toLowerCase()))}return v.some((f=>{var x=f.safeText,E=f.ariaLabel;return S.some((T=>hy(x,T)||hy(E,T)))}))})(r,c.map((h=>{var v;return{safeText:yl(h).toLowerCase(),ariaLabel:((v=h.getAttribute("aria-label"))==null?void 0:v.toLowerCase().trim())||""}})))&&!kp(c,n)}var fv=s=>!s||pi(s,"html")||!er(s),Ib=(s,t)=>{if(!ce||fv(s))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,r=[s],l=s;l.parentNode&&!pi(l,"body");)if(Nb(l.parentNode))r.push(l.parentNode.host),l=l.parentNode.host;else{var d=Bb(l);if(!d)break;if(t||dv.indexOf(d.tagName.toLowerCase())>-1)n=!0;else try{var p=ce.getComputedStyle(d);p&&p.getPropertyValue("cursor")==="pointer"&&(n=!0)}catch{}r.push(d),l=d}return{parentIsUsefulElement:n,targetElementList:r}};function Tp(s){for(var t=new Set,n=0,r=s;r.parentNode&&!pi(r,"body");r=r.parentNode){if(n++>=Lb||t.has(r))return!1;t.add(r);var l=Au(r);if(Ge(l,"ph-sensitive")||Ge(l,"ph-no-capture"))return!1}if(Ge(Au(s),"ph-include"))return!0;var d=s.type||"";if(It(d))switch(d.toLowerCase()){case"hidden":case"password":return!1}var p=s.name||s.id||"";return!It(p)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(p.replace(/[^a-zA-Z0-9]/g,""))}function zb(s){return!!(pi(s,"input")&&!["button","checkbox","submit","reset"].includes(s.type)||pi(s,"select")||pi(s,"textarea")||s.getAttribute("contenteditable")==="true")}var py=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}))$"),vy=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,E5=[16,15,14,13],k5=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),my=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),gy=/[0-9A-Za-z_]/;function T5(s){for(var t=0,n=!1,r=s.length-1;r>=0;r--){var l=s.charCodeAt(r)-48;n&&(l*=2)>9&&(l-=9),t+=l,n=!n}return t%10==0}function ol(s,t){if(t===void 0&&(t=!0),et(s))return!1;if(It(s)){s=Fu(s);var n=t?py.test((s||"").replace(/[- ]/g,"")):(function(l){var d;for(vy.lastIndex=0;d=vy.exec(l);){var p=d[2];if(p)for(var c=p.replace(/[- ]/g,""),h=0;c.length>h;h++)for(var v of E5){var S=h+v;if(c.length>=S){var f=c.slice(h,S);if(py.test(f)&&T5(f))return!0}}}return!1})(s);if(n)return!1;var r=t?k5.test(s):(function(l){var d;for(my.lastIndex=0;d=my.exec(l);){var p=d[1],c=d[3];if(!(p&&c&&gy.test(p)&&gy.test(c)))return!0}return!1})(s);if(r)return!1}return!0}function _y(s){var t=yl(s);return ol(t=(t+" "+$b(s)).trim())?t:""}function $b(s){var t="";return s&&s.childNodes&&s.childNodes.length&&zt(s.childNodes,(function(n){var r;if(n&&((r=n.tagName)==null?void 0:r.toLowerCase())==="span")try{var l=yl(n);t=(t+" "+l).trim(),n.childNodes&&n.childNodes.length&&(t=(t+" "+$b(n)).trim())}catch(d){Ae.error("[AutoCapture]",d)}})),t}function yy(s){return s.replace(/"|\\"/g,'\\"')}function A5(s){var t=s.attr__class;if(t)return Ze(t)?t:hv(t)}var Vc=Jt("[Dead Clicks]"),R5=()=>!0,M5=s=>{var t,n=!((t=s.instance.persistence)==null||!t.get_property(av)),r=s.instance.config.capture_dead_clicks;return Hi(r)?r:!!Yt(r)||n};class by{get lazyLoadedDeadClicksAutocapture(){return this.Xe}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({[av]:n.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.tr((()=>{this.er()})):this.stop()}tr(t){var n,r;(n=He.__PosthogExtensions__)!=null&&n.initDeadClicksAutocapture?t():(r=He.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this.instance,"dead-clicks-autocapture",(l=>{l?Vc.error("failed to load script",l):t()}))}er(){var t;if(De){if(!this.Xe&&(t=He.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture){var n=Yt(this.instance.config.capture_dead_clicks)?Ce({},this.instance.config.capture_dead_clicks):{};n.__onCapture=this.onCapture,this.onCapture&&(n.capture_dead_swipes=!1),this.Xe=He.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.Xe.start(De),Vc.info("starting...")}}else Vc.error("`document` not found. Cannot start.")}stop(){this.Xe&&(this.Xe.stop(),this.Xe=void 0,Vc.info("stopping..."))}}var xf=Jt("[SegmentIntegration]"),Pb="posthog-js";function Ub(s,t){var n=t===void 0?{}:t,r=n.organization,l=n.projectId,d=n.prefix,p=n.severityAllowList,c=p===void 0?["error"]:p,h=n.sendExceptionsToPostHog,v=h===void 0||h;return S=>{var f,x,E,T,C;if(c!=="*"&&!c.includes(S.level)||!s.__loaded)return S;S.tags||(S.tags={});var y=s.requestRouter.endpointFor("ui","/project/"+s.config.token+"/person/"+s.get_distinct_id());S.tags["PostHog Person URL"]=y,s.sessionRecordingStarted()&&(S.tags["PostHog Recording URL"]=s.get_session_replay_url({withTimestamp:!0}));var b,m=((f=S.exception)==null?void 0:f.values)||[],g=m.map((M=>Ce({},M,{stacktrace:M.stacktrace?Ce({},M.stacktrace,{type:"raw",frames:(M.stacktrace.frames||[]).map((R=>Ce({},R,{platform:"web:javascript"})))}):void 0}))),k={$exception_message:((x=m[0])==null?void 0:x.value)||S.message,$exception_type:(E=m[0])==null?void 0:E.type,$exception_level:S.level,$exception_list:g,$sentry_event_id:S.event_id,$sentry_exception:S.exception,$sentry_exception_message:((T=m[0])==null?void 0:T.value)||S.message,$sentry_exception_type:(C=m[0])==null?void 0:C.type,$sentry_tags:S.tags};return r&&l&&(k.$sentry_url=(d||"https://sentry.io/organizations/")+r+"/issues/?project="+l+"&query="+S.event_id),v&&((b=s.exceptions)==null||b.sendExceptionEvent(k)),S}}class j5{constructor(t,n,r,l,d,p){this.name=Pb,this.setupOnce=function(c){c(Ub(t,{organization:n,projectId:r,prefix:l,severityAllowList:d,sendExceptionsToPostHog:p==null||p}))}}}class Sy{constructor(t){this.rr=(n,r,l)=>{l&&(l.noSessionId||l.activityTimeout||l.sessionPastMaximumLength||l.crossTabAdoption)&&(Ae.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:n,changeReason:l}),this.ir=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.nr()}nr(){var t;this.sr=(t=this._instance.sessionManager)==null?void 0:t.onSessionId(this.rr)}destroy(){var t;(t=this.sr)==null||t.call(this),this.sr=void 0}doPageView(t,n){var r,l=this.ar(t,n);return this.ir={pathname:(r=ce==null?void 0:ce.location.pathname)!==null&&r!==void 0?r:"",pageViewId:n,timestamp:t},this._instance.scrollManager.resetContext(),l}doPageLeave(t){var n;return this.ar(t,(n=this.ir)==null?void 0:n.pageViewId)}doEvent(){var t;return{$pageview_id:(t=this.ir)==null?void 0:t.pageViewId}}ar(t,n){var r=this.ir;if(!r)return{$pageview_id:n};var l={$pageview_id:n,$prev_pageview_id:r.pageViewId},d=this._instance.scrollManager.getContext();if(d&&!this._instance.config.disable_scroll_properties){var p=d.maxScrollHeight,c=d.lastScrollY,h=d.maxScrollY,v=d.maxContentHeight,S=d.lastContentY,f=d.maxContentY;if(!(Te(p)||Te(c)||Te(h)||Te(v)||Te(S)||Te(f))){p=Math.ceil(p),c=Math.ceil(c),h=Math.ceil(h),v=Math.ceil(v),S=Math.ceil(S),f=Math.ceil(f);var x=p>1?Vi(c/p,0,1,Ae):1,E=p>1?Vi(h/p,0,1,Ae):1,T=v>1?Vi(S/v,0,1,Ae):1,C=v>1?Vi(f/v,0,1,Ae):1;l=Ft(l,{$prev_pageview_last_scroll:c,$prev_pageview_last_scroll_percentage:x,$prev_pageview_max_scroll:h,$prev_pageview_max_scroll_percentage:E,$prev_pageview_last_content:S,$prev_pageview_last_content_percentage:T,$prev_pageview_max_content:f,$prev_pageview_max_content_percentage:C})}}return r.pathname&&(l.$prev_pageview_pathname=r.pathname),r.timestamp&&(l.$prev_pageview_duration=(t.getTime()-r.timestamp.getTime())/1e3),l}}var Cf=["flags","surveys"],D5={[gb]:{exposure:"hidden"},[Qo]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[el]:{exposure:"hidden"},[lp]:{exposure:"event"},[cp]:{exposure:"hidden"},[up]:{exposure:"event"},[hp]:{exposure:"hidden"},[dp]:{exposure:"event"},[fp]:{exposure:"event"},[av]:{exposure:"event"},[ov]:{exposure:"hidden"},[pp]:{exposure:"event"},[Lr]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[Ea]:{exposure:"hidden"},[lv]:{exposure:"event"},[_b]:{exposure:"event",shouldSkipFromEventProperties:s=>Gs(s)},$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"},[Dr]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(s,t)=>t(),transformToEventProperties(s){if(!Yt(s))return{};for(var t={},n=Object.keys(s),r=0;n.length>r;r++)t["$feature/"+n[r]]=s[n[r]];return t}},[iu]:{exposure:"event",storageGroup:"flags"},[tl]:{exposure:"hidden"},[vp]:{exposure:"hidden",storageGroup:"flags"},[nu]:{exposure:"event",storageGroup:"flags"},[mp]:{exposure:"event",storageGroup:"flags",volatile:!0},[Su]:{exposure:"hidden",storageGroup:"flags"},[mn]:{exposure:"event"},[wa]:{exposure:"hidden"},[Rr]:{exposure:"hidden"},[Mr]:{exposure:"hidden"},[gp]:{exposure:"hidden",storageGroup:"surveys"},[wu]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[_p]:{exposure:"event"},[ru]:{exposure:"hidden"},[sl]:{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"},[al]:{exposure:"hidden"},[yp]:{exposure:"hidden"},[bp]:{exposure:"hidden"},[_l]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[ki]:{exposure:"hidden"},[Sp]:{exposure:"hidden"},[wp]:{exposure:"hidden"},[xp]:{exposure:"hidden"},[Cp]:{exposure:"hidden"},[xu]:{exposure:"hidden"},[Cu]:{exposure:"hidden"},[yb]:{exposure:"event"},[bb]:{exposure:"event"},[Sb]:{exposure:"event"},[wb]:{exposure:"event"},[Cb]:{exposure:"event"},[Eb]:{exposure:"event"},[kb]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},N5=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Cr=s=>{var t=D5[s];if(t)return t;for(var n of N5){var r=n[1];if(s.indexOf(n[0])===0)return r}},ka=(s,t)=>{try{return JSON.stringify(s,((n,r)=>typeof r=="bigint"?r.toString():r),t)}catch{return $1(s)}},Ru=s=>{var t=De==null?void 0:De.createElement("a");return Te(t)?null:(t.href=s,t)},Ia=function(s,t){for(var n,r=((s.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),l=0;r.length>l;l++){var d=r[l].split("=");if(d[0]===t){n=d;break}}if(!Ze(n)||2>n.length)return"";var p=n[1];try{p=decodeURIComponent(p)}catch{Ae.error("Skipping decoding for malformed query param: "+p)}return p.replace(/\+/g," ")},bl=function(s,t,n){if(!s||!t||!t.length)return s;for(var r=s.split("#"),l=r[1],d=(r[0]||"").split("?"),p=d[1],c=d[0],h=(p||"").split("&"),v=[],S=0;h.length>S;S++){var f=h[S].split("=");Ze(f)&&(t.includes(f[0])?v.push(f[0]+"="+n):v.push(h[S]))}var x=c;return p!=null&&(x+="?"+v.join("&")),l!=null&&(x+="#"+l),x},Mu=function(s,t){var n=s.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},Fb=(s,t)=>s>=t&&H1(),qb=(s,t,n,r)=>{if(s===0){if(H1()){var l=t+1;return l===n&&r(),l}return t}return 0},Yc="https?://(.*)",za=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],L5=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...za],Sl="<masked>",O5=["li_fat_id"];function Wb(s,t,n){if(!De)return{};var r,l=t?[...za,...n||[]]:[],d=Gb(bl(De.URL,l,Sl),s),p=(r={},zt(O5,(function(c){var h=Ab(c);r[c]=h||null})),r);return Ft(p,d)}function Gb(s,t){var n=L5.concat(t||[]),r={};return zt(n,(function(l){var d=Ia(s,l);r[l]=d||null})),r}function Vb(s){var t=(function(d){return d?d.search(Yc+"google.([^/?]*)")===0?"google":d.search(Yc+"bing.com")===0?"bing":d.search(Yc+"yahoo.com")===0?"yahoo":d.search(Yc+"duckduckgo.com")===0?"duckduckgo":null:null})(s),n=t!="yahoo"?"q":"p",r={};if(!Gs(t)){r.$search_engine=t;var l=De?Ia(De.referrer,n):"";l.length&&(r.ph_keyword=l)}return r}function wy(){return navigator.language||navigator.userLanguage}var ju="$direct";function Yb(){return(De==null?void 0:De.referrer)||ju}function Kb(s,t,n){n===void 0&&(n=!1);var r=s?[...za,...t||[]]:[],l=n?Qn(hs==null?void 0:hs.href):hs==null?void 0:hs.href,d=l==null?void 0:l.substring(0,1e3);return{r:Yb().substring(0,1e3),u:d?bl(d,r,Sl):void 0}}function Xb(s,t){var n;t===void 0&&(t=!1);var r=s.r,l=s.u,d=t?Qn(l):l,p={$referrer:r,$referring_domain:r==null?void 0:r==ju?ju:(n=Ru(r))==null?void 0:n.host};if(d){p.$current_url=d;var c=Ru(d);p.$host=c==null?void 0:c.host,p.$pathname=c==null?void 0:c.pathname;var h=Gb(d);Ft(p,h)}if(r){var v=Vb(r);Ft(p,v)}return p}function Jb(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function B5(){try{return new Date().getTimezoneOffset()}catch{return}}var H5={flags:_l,surveys:wu},I5=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],ya="main";class Ef{constructor(t,n,r){if(r===void 0&&(r=!0),this.lr={},this.ur=!1,this.hr=!1,this.Te=t,this.dr=r,this.props={},this.cr=void 0,this.vr=(d=>{var p="";return d.token&&(p=d.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),d.persistence_name?"ph_"+d.persistence_name:"ph_"+p+"_posthog"})(t),this.Je=this.pr(t),this.hr=this.gr(t),this.load(),t.debug&&Ae.info("Persistence loaded",t.persistence,Ce({},this.props)),this.update_config(t,t,n),this.save(),ce){var l=()=>this.flush();es(ce,"beforeunload",l,{capture:!1}),es(ce,"pagehide",l,{capture:!1})}}mr(){var t,n=(t=this.Te)==null?void 0:t.persistence_save_debounce_ms;return Os(n)&&n>0?n:0}isDisabled(){return!!this.yr}pr(t){I5.indexOf(t.persistence.toLowerCase())===-1&&(Ae.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var n,r=(function(p,c){p===void 0&&(p=[]),c===void 0&&(c=!1);var h=[...m5,...p];return Ce({},Ut,{F(v){try{var S={};try{S=bn.F(v)||{}}catch{}var f,x=JSON.parse(Ut.q(v)||"{}");if(c){var E={};for(var T in S){var C=S[T];Gs(C)||C===""||(E[T]=C)}f=Ft(x,E)}else f=Ft(S,x);return Ut.A(v,f),f}catch{}return null},A(v,S,f,x,E,T){var C=Ut.A(v,S,void 0,void 0,T);try{var y={};h.forEach((b=>{S[b]&&(y[b]=S[b])})),Object.keys(y).length&&bn.A(v,y,f,x,E,T)}catch(b){Ut.P(b)}return C},D(v,S){try{ce==null||ce.localStorage.removeItem(v),bn.D(v,S)}catch(f){Ut.P(f)}}})})(t.cookie_persisted_properties||[],t.__preview_cookie_wins_on_conflict||!1),l=!1,d=t.persistence.toLowerCase();return d==="localstorage"&&Ut.N()?(n=Ut,l=!0):d==="localstorage+cookie"&&r.N()?(n=r,l=!0):d==="sessionstorage"&&Ls.N()?n=Ls:d==="memory"?n=g5:d==="cookie"?n=bn:r.N()?(n=r,l=!0):n=bn,this.ur=l,n}br(t){return this.vr+"__"+t}gr(t){return this.ur&&!!t.split_storage}_r(t){var n=t??this.Te.feature_flag_cache_ttl_ms;if(!n||0>=n)return!1;var r=this.props[_l];return!r||typeof r!="number"||Date.now()-r>n}properties(){var t={};return zt(this.props,((n,r)=>{var l=Cr(r);if((l==null?void 0:l.exposure)==="derived"){if(l.shouldSkipFromEventProperties!=null&&l.shouldSkipFromEventProperties(n,r===Dr?()=>this._r():()=>!1))return;l.transformToEventProperties&&Ft(t,l.transformToEventProperties(n))}else if(!l||l.exposure==="event"){if(l!=null&&l.shouldSkipFromEventProperties!=null&&l.shouldSkipFromEventProperties(n,(()=>!1)))return;t[r]=n}})),t}load(){if(!this.yr){var t=this.Je.F(this.vr);t&&(this.props=Ft({},t)),this.hr&&this.wr()}}wr(){for(var t of Cf){var n=Ut.F(this.br(t));if(n&&!Kn(n)){var r=this.kr(t);r.persisted=!0,this.Sr(t)||(r.fingerprint=this.Cr(n,t)),this.Mr(t,n)||Ft(this.props,n)}}}Sr(t){return Object.keys(this.props).some((n=>{var r;return((r=Cr(n))==null?void 0:r.storageGroup)===t}))}Mr(t,n){var r=H5[t];if(!r)return!1;var l=n[r],d=this.props[r];return Os(l)&&Os(d)&&d>l}refreshKey(t){var n;if(!this.yr){var r=this.hr?(n=Cr(t))==null?void 0:n.storageGroup:void 0,l=r?Ut.F(this.br(r)):this.Je.F(this.vr);if(l&&t in l)this.Ir(t,l[t]);else{if(r){var d=this.Je.F(this.vr);if(d&&t in d)return void this.Ir(t,d[t])}this.Tr(t)}}}save(){if(!this.yr){var t=this.mr();t>0?Te(this.Er)&&(this.Er=setTimeout((()=>{this.Er=void 0,this.Rr()}),t)):this.Rr()}}flush(){Te(this.Er)||(clearTimeout(this.Er),this.Er=void 0,this.Rr())}Rr(){this.yr||(this.hr?this.Pr():this.Or(this.Je,this.vr,this.props,ya))}Pr(){var t=this.Fr(),n=t.main,r=t.groups;for(var l of(this.Or(this.Je,this.vr,n,ya),Cf)){var d,p=r[l];(!Kn(p)||(d=this.lr[l])!=null&&d.persisted)&&this.Or(Ut,this.br(l),p,l)}}Fr(){var t={},n={flags:{},surveys:{}};return zt(this.props,((r,l)=>{var d,p=(d=Cr(l))==null?void 0:d.storageGroup;p?n[p][l]=r:t[l]=r})),{main:t,groups:n}}Cr(t,n){if(n===ya)return JSON.stringify(t)+"|"+this.Ar+"|"+this.$r+"|"+this.Lr;var r={};return zt(t,((l,d)=>{var p;r[d]=(p=Cr(d))!=null&&p.volatile?"__volatile__":l})),JSON.stringify(r)}Or(t,n,r,l){var d=this.kr(l);if(l===ya||d.dirty||Te(d.fingerprint)){var p;try{if((p=this.Cr(r,l))===d.fingerprint)return void(d.dirty=!1)}catch{p=void 0}t.A(n,r,this.Ar,this.$r,this.Lr,this.Te.debug)?(d.dirty=!1,l!==ya&&(d.persisted=!0),Te(p)||(d.fingerprint=p)):this.Te.debug&&Ae.warn('failed to persist storage entry "'+n+'"; will retry on next save')}}remove(t){var n=(t===void 0?{}:t).keepGroupEntries,r=n!==void 0&&n;if(Te(this.Er)||(clearTimeout(this.Er),this.Er=void 0),this.Je.D(this.vr,!1),this.Je.D(this.vr,!0),!r&&this.dr)for(var l of Cf)Ut.D(this.br(l));r?delete this.lr[ya]:this.lr={}}clear(){this.remove(),this.props={}}register_once(t,n,r){if(Yt(t)){Te(n)&&(n="None"),this.Ar=Te(r)?this.Dr:r;var l=!1;if(zt(t,((d,p)=>{this.props.hasOwnProperty(p)&&this.props[p]!==n||(this.Ir(p,d),l=!0)})),l)return this.save(),!0}return!1}register(t,n){if(Yt(t)){this.Ar=Te(n)?this.Dr:n;var r=!1;if(zt(t,((l,d)=>{t.hasOwnProperty(d)&&this.props[d]!==l&&(this.Ir(d,l),r=!0)})),r)return this.save(),!0}return!1}unregister(t){t in this.props&&(this.Tr(t),this.save())}update_campaign_params(){var t=De==null?void 0:De.URL;if(t!==this.cr){var n=Wb(this.Te.custom_campaign_params,this.Te.mask_personal_data_properties,this.Te.custom_personal_data_properties);Kn(uv(n))||this.register(n),this.cr=t}}update_search_keyword(){var t;this.register((t=De==null?void 0:De.referrer)?Vb(t):{})}update_referrer_info(){var t;this.register_once({$referrer:Yb(),$referring_domain:De!=null&&De.referrer&&((t=Ru(De.referrer))==null?void 0:t.host)||ju},void 0)}set_initial_person_info(){this.props[xp]||this.props[Cp]||this.register_once({[xu]:Kb(this.Te.mask_personal_data_properties,this.Te.custom_personal_data_properties,this.Te.disable_capture_url_hashes)},void 0)}get_initial_props(){var t={};zt([Cp,xp],(l=>{var d=this.props[l];d&&zt(d,(function(p,c){t["$initial_"+tp(c)]=p}))}));var n=this.props[xu];if(n){var r=(function(l,d){d===void 0&&(d=!1);var p=Xb(l,d),c={};return zt(p,(function(h,v){c["$initial_"+tp(v)]=h})),c})(n,this.Te.disable_capture_url_hashes);Ft(t,r)}return t}safe_merge(t){return zt(this.props,(function(n,r){r in t||(t[r]=n)})),t}update_config(t,n,r){this.Dr=this.Ar=t.cookie_expiration,this.set_disabled(t.disable_persistence||!!r),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie);var l=t.persistence!==n.persistence||!((h,v)=>{if(h.length!==v.length)return!1;var S=[...h].sort(),f=[...v].sort();return S.every(((x,E)=>x===f[E]))})(t.cookie_persisted_properties||[],n.cookie_persisted_properties||[]),d=l?this.pr(t):this.Je,p=this.gr(t);if(l||p!==this.hr){var c=this.props;this.clear(),this.Je=d,this.hr=p,this.props=c,this.save()}}set_disabled(t){this.yr=t,this.yr?this.remove():this.save()}set_cross_subdomain(t){t!==this.$r&&(this.$r=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.Lr&&(this.Lr=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,n){var r=this.props[el]||{};r[t]=n,this.Ir(el,r),this.save()}remove_event_timer(t){var n=this.props[el]||{},r=n[t];return Te(r)||(delete n[t],this.Ir(el,n),this.save()),r}get_property(t){return this.props[t]}set_property(t,n){this.Ir(t,n),this.save()}Ir(t,n){var r;this.props[t]=n,(r=Cr(t))!=null&&r.volatile||this.Nr(t)}Tr(t){delete this.props[t],this.Nr(t)}Nr(t){var n,r=(n=Cr(t))==null?void 0:n.storageGroup;r&&(this.kr(r).dirty=!0)}kr(t){return this.lr[t]||(this.lr[t]={})}}function Kc(s){var t=!0;return{dispose(){if(t){t=!1;var n=s();n&&fi(n.then)&&n.then(void 0,(()=>{}))}}}}var qs={GZipJS:"gzip-js",Base64:"base64"},qo={Activation:"events",Cancellation:"cancelEvents"},kf={Popover:"popover",API:"api",Widget:"widget"},Sn={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},Tf={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},Ap={Popover:"popover",Inline:"inline"},z5={SHOWN:"product tour shown"},xy={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},Cy=Jt("[RateLimiter]");class $5{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((l=>{Cy.info((l||"events")+" is quota limited."),this.serverLimits[l]=new Date().getTime()+6e4}))}catch(l){return void Cy.warn('could not rate limit - continuing. Error: "'+(l==null?void 0:l.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,l;t===void 0&&(t=!1);var d=this.captureEventsBurstLimit,p=this.captureEventsPerSecond,c=new Date().getTime(),h=(n=(r=this.instance.persistence)==null?void 0:r.get_property(wp))!==null&&n!==void 0?n:{tokens:d,last:c};h.tokens+=(c-h.last)/1e3*p,h.last=c,h.tokens>d&&(h.tokens=d);var v=1>h.tokens;return v||t||(h.tokens=Math.max(0,h.tokens-1)),!v||this.lastEventRateLimited||t||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+p+" events per second and "+d+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=v,(l=this.instance.persistence)==null||l.set_property(wp,h),{isRateLimited:v,remainingTokens:h.tokens}}isServerRateLimited(t){var n=this.serverLimits[t||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var Er=Jt("[RemoteConfig]");class Zb{constructor(t){this._instance=t}get remoteConfig(){var t;return(t=He._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.config}qr(t){var n,r;(n=He.__PosthogExtensions__)!=null&&n.loadExternalDependency?(r=He.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}jr(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(n){t(n.json)}})}load(){try{if(this.remoteConfig)return Er.info("Using preloaded remote config",this.remoteConfig),this.Br(this.remoteConfig),void this.Hr();if(this._instance.Ur())return void Er.warn("Remote config is disabled. Falling back to local config.");this.qr((t=>{if(!t)return Er.info("No config found after loading remote JS config. Falling back to JSON."),void this.jr((n=>{this.Br(n),this.Hr()}));this.Br(t),this.Hr()}))}catch(t){Er.error("Error loading remote config",t),this.Br()}}stop(){this.zr&&(clearInterval(this.zr),this.zr=void 0)}refresh(){!this._instance.Ur()&&De&&De.visibilityState!=="hidden"&&this._instance.reloadFeatureFlags()}Hr(){var t;if(!this.zr){var n=(t=this._instance.config.remote_config_refresh_interval_ms)!==null&&t!==void 0?t:3e5;n!==0&&(this.zr=setInterval((()=>{this.refresh()}),n))}}Br(t){t||Er.error("Failed to fetch remote config from PostHog.");try{this._instance.Br(t?{ok:!0,config:t}:{ok:!1})}catch(r){Er.error("Error applying remote config",r)}if((t==null?void 0:t.hasFeatureFlags)!==!1&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var n;(n=this._instance.featureFlags)==null||n.ensureFlagsLoaded()}catch(r){Er.error("Error loading feature flags",r)}}}var Ri=Uint8Array,ti=Uint16Array,$a=Uint32Array,pv=new Ri([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]),vv=new Ri([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]),Ey=new Ri([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Qb=function(s,t){for(var n=new ti(31),r=0;31>r;++r)n[r]=t+=1<<s[r-1];var l=new $a(n[30]);for(r=1;30>r;++r)for(var d=n[r];n[r+1]>d;++d)l[d]=d-n[r]<<5|r;return[n,l]},eS=Qb(pv,2),Rp=eS[1];eS[0][28]=258,Rp[258]=28;for(var ky=Qb(vv,0)[1],tS=new ti(32768),Xt=0;32768>Xt;++Xt){var ba=(43690&Xt)>>>1|(21845&Xt)<<1;tS[Xt]=((65280&(ba=(61680&(ba=(52428&ba)>>>2|(13107&ba)<<2))>>>4|(3855&ba)<<4))>>>8|(255&ba)<<8)>>>1}var ll=function(s,t,n){for(var r=s.length,l=0,d=new ti(t);r>l;++l)++d[s[l]-1];var p,c=new ti(t);for(l=0;t>l;++l)c[l]=c[l-1]+d[l-1]<<1;for(p=new ti(r),l=0;r>l;++l)p[l]=tS[c[s[l]-1]++]>>>15-s[l];return p},Br=new Ri(288);for(Xt=0;144>Xt;++Xt)Br[Xt]=8;for(Xt=144;256>Xt;++Xt)Br[Xt]=9;for(Xt=256;280>Xt;++Xt)Br[Xt]=7;for(Xt=280;288>Xt;++Xt)Br[Xt]=8;var Du=new Ri(32);for(Xt=0;32>Xt;++Xt)Du[Xt]=5;var P5=ll(Br,9),U5=ll(Du,5),sS=function(s){return(s/8>>0)+(7&s&&1)},iS=function(s,t,n){(n==null||n>s.length)&&(n=s.length);var r=new(s instanceof ti?ti:s instanceof $a?$a:Ri)(n-t);return r.set(s.subarray(t,n)),r},fn=function(s,t,n){var r=t/8>>0;s[r]|=n<<=7&t,s[r+1]|=n>>>8},Wo=function(s,t,n){var r=t/8>>0;s[r]|=n<<=7&t,s[r+1]|=n>>>8,s[r+2]|=n>>>16},Af=function(s,t){for(var n=[],r=0;s.length>r;++r)s[r]&&n.push({s:r,f:s[r]});var l=n.length,d=n.slice();if(!l)return[new Ri(0),0];if(l==1){var p=new Ri(n[0].s+1);return p[n[0].s]=1,[p,1]}n.sort((function(M,R){return M.f-R.f})),n.push({s:-1,f:25001});var c=n[0],h=n[1],v=0,S=1,f=2;for(n[0]={s:-1,f:c.f+h.f,l:c,r:h};S!=l-1;)c=n[n[f].f>n[v].f?v++:f++],h=n[v!=S&&n[f].f>n[v].f?v++:f++],n[S++]={s:-1,f:c.f+h.f,l:c,r:h};var x=d[0].s;for(r=1;l>r;++r)d[r].s>x&&(x=d[r].s);var E=new ti(x+1),T=Mp(n[S-1],E,0);if(T>t){r=0;var C=0,y=T-t,b=1<<y;for(d.sort((function(M,R){return E[R.s]-E[M.s]||M.f-R.f}));l>r;++r){var m=d[r].s;if(t>=E[m])break;C+=b-(1<<T-E[m]),E[m]=t}for(C>>>=y;C>0;){var g=d[r].s;t>E[g]?C-=1<<t-E[g]++-1:++r}for(;r>=0&&C;--r){var k=d[r].s;E[k]==t&&(--E[k],++C)}T=t}return[new Ri(E),T]},Mp=function(s,t,n){return s.s==-1?Math.max(Mp(s.l,t,n+1),Mp(s.r,t,n+1)):t[s.s]=n},Ty=function(s){for(var t=s.length;t&&!s[--t];);for(var n=new ti(++t),r=0,l=s[0],d=1,p=function(h){n[r++]=h},c=1;t>=c;++c)if(s[c]==l&&c!=t)++d;else{if(!l&&d>2){for(;d>138;d-=138)p(32754);d>2&&(p(d>10?d-11<<5|28690:d-3<<5|12305),d=0)}else if(d>3){for(p(l),--d;d>6;d-=6)p(8304);d>2&&(p(d-3<<5|8208),d=0)}for(;d--;)p(l);d=1,l=s[c]}return[n.subarray(0,r),t]},Go=function(s,t){for(var n=0,r=0;t.length>r;++r)n+=s[r]*t[r];return n},jp=function(s,t,n){var r=n.length,l=sS(t+2);s[l]=255&r,s[l+1]=r>>>8,s[l+2]=255^s[l],s[l+3]=255^s[l+1];for(var d=0;r>d;++d)s[l+d+4]=n[d];return 8*(l+4+r)},Ay=function(s,t,n,r,l,d,p,c,h,v,S){fn(t,S++,n),++l[256];for(var f=Af(l,15),x=f[0],E=f[1],T=Af(d,15),C=T[0],y=T[1],b=Ty(x),m=b[0],g=b[1],k=Ty(C),M=k[0],R=k[1],j=new ti(19),A=0;m.length>A;++A)j[31&m[A]]++;for(A=0;M.length>A;++A)j[31&M[A]]++;for(var D=Af(j,7),I=D[0],q=D[1],G=19;G>4&&!I[Ey[G-1]];--G);var U,X,se,F,Q=v+5<<3,J=Go(l,Br)+Go(d,Du)+p,O=Go(l,x)+Go(d,C)+p+14+3*G+Go(j,I)+(2*j[16]+3*j[17]+7*j[18]);if(J>=Q&&O>=Q)return jp(t,S,s.subarray(h,h+v));if(fn(t,S,1+(J>O)),S+=2,J>O){U=ll(x,E),X=x,se=ll(C,y),F=C;var B=ll(I,q);for(fn(t,S,g-257),fn(t,S+5,R-1),fn(t,S+10,G-4),S+=14,A=0;G>A;++A)fn(t,S+3*A,I[Ey[A]]);S+=3*G;for(var N=[m,M],z=0;2>z;++z){var W=N[z];for(A=0;W.length>A;++A)fn(t,S,B[Z=31&W[A]]),S+=I[Z],Z>15&&(fn(t,S,W[A]>>>5&127),S+=W[A]>>>12)}}else U=P5,X=Br,se=U5,F=Du;for(A=0;c>A;++A)if(r[A]>255){var Z;Wo(t,S,U[257+(Z=r[A]>>>18&31)]),S+=X[Z+257],Z>7&&(fn(t,S,r[A]>>>23&31),S+=pv[Z]);var ue=31&r[A];Wo(t,S,se[ue]),S+=F[ue],ue>3&&(Wo(t,S,r[A]>>>5&8191),S+=vv[ue])}else Wo(t,S,U[r[A]]),S+=X[r[A]];return Wo(t,S,U[256]),S+X[256]},F5=new $a([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),q5=(function(){for(var s=new $a(256),t=0;256>t;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;s[t]=n}return s})(),Rf=function(s,t,n){for(;n;++t)s[t]=n,n>>>=8};function W5(s,t){t===void 0&&(t={});var n=(function(){var f=4294967295;return{p(x){for(var E=f,T=0;x.length>T;++T)E=q5[255&E^x[T]]^E>>>8;f=E},d(){return 4294967295^f}}})(),r=s.length;n.p(s);var l,d,p,c,h,v=(c=10+((l=t).filename&&l.filename.length+1||0),h=8,(function(f,x,E,T,C,y){var b=f.length,m=new Ri(T+b+5*(1+Math.floor(b/7e3))+C),g=m.subarray(T,m.length-C),k=0;if(!x||8>b)for(var M=0;b>=M;M+=65535){var R=M+65535;b>R?k=jp(g,k,f.subarray(M,R)):(g[M]=!0,k=jp(g,k,f.subarray(M,b)))}else{for(var j=F5[x-1],A=j>>>13,D=8191&j,I=(1<<E)-1,q=new ti(32768),G=new ti(I+1),U=Math.ceil(E/3),X=2*U,se=function(ht){return(f[ht]^f[ht+1]<<U^f[ht+2]<<X)&I},F=new $a(25e3),Q=new ti(288),J=new ti(32),O=0,B=0,N=(M=0,0),z=0,W=0;b>M;++M){var Z=se(M),ue=32767&M,ge=G[Z];if(q[ue]=ge,G[Z]=ue,M>=z){var Y=b-M;if((O>7e3||N>24576)&&Y>423){k=Ay(f,g,0,F,Q,J,B,N,W,M-W,k),N=O=B=0,W=M;for(var $=0;286>$;++$)Q[$]=0;for($=0;30>$;++$)J[$]=0}var oe=2,ae=0,xe=D,Ee=ue-ge&32767;if(Y>2&&Z==se(M-Ee))for(var Ue=Math.min(A,Y)-1,Ye=Math.min(32767,M),Ke=Math.min(258,Y);Ye>=Ee&&--xe&&ue!=ge;){if(f[M+oe]==f[M+oe-Ee]){for(var st=0;Ke>st&&f[M+st]==f[M+st-Ee];++st);if(st>oe){if(oe=st,ae=Ee,st>Ue)break;var Oe=Math.min(Ee,st-2),Dt=0;for($=0;Oe>$;++$){var pt=M-Ee+$+32768&32767,xt=pt-q[pt]+32768&32767;xt>Dt&&(Dt=xt,ge=pt)}}}Ee+=(ue=ge)-(ge=q[ue])+32768&32767}if(ae){F[N++]=268435456|Rp[oe]<<18|ky[ae];var gt=31&Rp[oe],ss=31&ky[ae];B+=pv[gt]+vv[ss],++Q[257+gt],++J[ss],z=M+oe,++O}else F[N++]=f[M],++Q[f[M]]}}k=Ay(f,g,!0,F,Q,J,B,N,W,M-W,k)}return iS(m,0,T+sS(k)+C)})(d=s,(p=t).level==null?6:p.level,p.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(d.length)))):12+p.mem,c,h)),S=v.length;return(function(f,x){var E=x.filename;if(f[0]=31,f[1]=139,f[2]=8,f[8]=2>x.level?4:x.level==9?2:0,f[9]=3,x.mtime!=0&&Rf(f,4,Math.floor(new Date(x.mtime||Date.now())/1e3)),E){f[3]=8;for(var T=0;E.length>=T;++T)f[T+10]=E.charCodeAt(T)}})(v,t),Rf(v,S-8,n.d()),Rf(v,S-4,r),v}var G5=!!Zf||!!ev,nS="text/plain",ou=!1,rS=(s,t)=>{var n=s.split("#"),r=n[1],l=n[0].split("?"),d=l[0],p=l[1];if(!p)return s;var c=p.split("&").filter((h=>h.split("=")[0]!==t)).join("&");return d+(c?"?"+c:"")+(r?"#"+r:"")},Wu=function(s,t,n){var r;n===void 0&&(n=!0);var l=s.split("?"),d=l[0],p=l[1],c=Ce({},t),h=(r=p==null?void 0:p.split("&").map((S=>{var f,x=S.split("="),E=x[0],T=n&&(f=c[E])!==null&&f!==void 0?f:x[1];return delete c[E],E+"="+T})))!==null&&r!==void 0?r:[],v=(function(S,f){var x,E;f===void 0&&(f="&");var T=[];return zt(S,(function(C,y){Te(C)||Te(y)||y==="undefined"||(x=encodeURIComponent((b=>b instanceof File)(C)?C.name:C.toString()),E=encodeURIComponent(y),T[T.length]=E+"="+x)})),T.join(f)})(c);return v&&h.push(v),h.length>0?d+"?"+h.join("&"):d},Mf=s=>{if(s.Vr)return s.Vr;var t=s.data,n=s.compression;if(t){if(n===qs.GZipJS){var r=W5((function(c,h){var v=c.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(c);for(var S=new Ri(c.length+(c.length>>>1)),f=0,x=function(y){S[f++]=y},E=0;v>E;++E){if(f+5>S.length){var T=new Ri(f+8+(v-E<<1));T.set(S),S=T}var C=c.charCodeAt(E);128>C?x(C):2048>C?(x(192|C>>>6),x(128|63&C)):C>55295&&57344>C?(x(240|(C=65536+(1047552&C)|1023&c.charCodeAt(++E))>>>18),x(128|C>>>12&63),x(128|C>>>6&63),x(128|63&C)):(x(224|C>>>12),x(128|C>>>6&63),x(128|63&C))}return iS(S,0,f)})(ka(t)),{mtime:0});return{contentType:nS,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(n===qs.Base64){var l=(function(c){return c&&btoa(encodeURIComponent(c).replace(/%([0-9A-F]{2})/g,((h,v)=>String.fromCharCode(parseInt(v,16)))))})(ka(t)),d=(c=>"data="+encodeURIComponent(typeof c=="string"?c:ka(c)))(l);return{contentType:"application/x-www-form-urlencoded",body:d,estimatedSize:new Blob([d]).size}}var p=ka(t);return{contentType:"application/json",body:p,estimatedSize:new Blob([p]).size}}},aS=s=>{var t,n,r=()=>s.transport==="sendBeacon"?{url:Wu(s.url,{compression:qs.Base64}),encodedBody:Mf(Ce({},s,{compression:qs.Base64,Vr:void 0}))}:{url:rS(s.url,"compression"),encodedBody:Mf(Ce({},s,{compression:void 0,Vr:void 0}))};try{t=Mf(s)}catch(l){if(K0(s.compression,Ia(s.url,"compression")))return Ae.error("Failed to gzip request body, sending uncompressed payload",l),r();throw l}return t&&K0(s.compression,Ia(s.url,"compression"))&&!((n=t.body)instanceof ArrayBuffer?Qf(new Uint8Array(n)):ArrayBuffer.isView(n)&&Qf(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)))?(ou=!0,r()):{url:s.url,encodedBody:t}},oS=s=>{try{return aS(s)}catch(t){return Ae.error(t),void(s.callback==null||s.callback({statusCode:0,error:t}))}},V5=(function(){var s=Kt((function*(t){var n=ka(t.data),r=yield(function(d,p,c){return ep.apply(this,arguments)})(n,Et.DEBUG,{rethrow:!0});if(!r)return t;var l=yield r.arrayBuffer();return Ce({},t,{Vr:{contentType:nS,body:l,estimatedSize:l.byteLength}})}));return function(t){return s.apply(this,arguments)}})(),Y5=/Failed to fetch|NetworkError|Load failed/i,lS=s=>{var t=oS(s);if(t){var n=t.url,r=t.encodedBody,l=r??{},d=l.contentType,p=l.body,c=l.estimatedSize,h=new Headers;zt(s.headers,(function(T,C){h.append(C,T)})),d&&h.append("Content-Type",d);var v=null,S=!1;if(F0){var f=new F0;v={signal:f.signal,timeout:setTimeout((()=>{var T,C;S=!0,f.abort((T=s.timeout,(C=new Error("PostHog request timed out"+(T?" after "+T+"ms":""))).name="AbortError",C))}),s.timeout)}}var x=T=>{S&&(T==null?void 0:T.name)==="AbortError"||(C=>(C==null?void 0:C.name)==="TypeError"&&Y5.test((C==null?void 0:C.message)||""))(T)?Ae.warn(T):Ae.error(T),s.callback==null||s.callback({statusCode:0,error:T})};try{var E;ev(n,Ce({method:(s==null?void 0:s.method)||"GET",headers:h,keepalive:s.method==="POST"&&!s.Wr&&52428.8>(c||0),body:p,signal:(E=v)==null?void 0:E.signal},s.fetchOptions)).then((T=>T.text().then((C=>{var y={statusCode:T.status,text:C};if(T.status===200)try{y.json=JSON.parse(C)}catch(b){Ae.error(b)}s.callback==null||s.callback(y)})))).catch(x).finally((()=>v?clearTimeout(v.timeout):null))}catch(T){v&&clearTimeout(v.timeout),x(T)}}},Dp=s=>{try{var t,n=aS(s),r=n.url,l=n.encodedBody,d=l??{},p=d.body,c=d.estimatedSize;if(!p)return;var h=p instanceof Blob?p:new Blob([p],{type:d.contentType});if(Ws.sendBeacon(r,h))return;var v=Ze(s.data)?s.data:(t=s.data)==null?void 0:t.batch;if(Ze(v)&&v.length>1&&(c??0)>16384){var S=Math.ceil(v.length/2),f=x=>Ze(s.data)?x:Ce({},s.data,{batch:x});return Dp(Ce({},s,{data:f(v.slice(0,S))})),void Dp(Ce({},s,{data:f(v.slice(S))}))}Ae.warn("Beacon of ~"+(c??0)+" bytes was rejected by the browser, falling back to fetch"),lS(Ce({},s,{Wr:!0}))}catch(x){Ae.warn("Beacon send failed",x)}},Ry=(s,t,n,r)=>{var l=r==="query"?t==="POST"?"sent_at":"_":void 0;return Wu(n===qs.GZipJS?rS(s,"compression"):s,Ce({},l?{[l]:Date.now().toString()}:{},n===qs.GZipJS?{}:{compression:n}))},lu=[];ev&&lu.push({transport:"fetch",method:lS}),Zf&&lu.push({transport:"XHR",method(s){var t=oS(s);if(t){var n=new Zf,r=t.encodedBody;n.open(s.method||"GET",t.url,!0);var l=r??{},d=l.contentType,p=l.body;zt(s.headers,(function(c,h){n.setRequestHeader(h,c)})),d&&n.setRequestHeader("Content-Type",d),s.timeout&&(n.timeout=s.timeout),n.onreadystatechange=()=>{if(n.readyState===4){var c={statusCode:n.status,text:n.responseText};if(n.status===200)try{c.json=JSON.parse(n.responseText)}catch{}s.callback==null||s.callback(c)}},n.send(p)}}}),Ws!=null&&Ws.sendBeacon&&lu.push({transport:"sendBeacon",method:Dp});var Np=3e3;class K5{constructor(t,n){this.Zr=!0,this.Gr=[],this.Qr=Vi((n==null?void 0:n.flush_interval_ms)||Np,250,5e3,Ae.createLogger("flush interval"),Np),this.Jr=t}enqueue(t){this.Gr.push(t),this.Kr||this.Yr()}unload(){this.Xr();var t=this.Gr.length>0?this.ti():{},n=Object.values(t);[...n.filter((r=>r.url.indexOf("/e")===0)),...n.filter((r=>r.url.indexOf("/e")!==0))].map((r=>{this.ei(Ce({},r,{transport:"sendBeacon"}))}))}enable(){this.Zr=!1,this.Yr()}Yr(){var t=this;this.Zr||(this.Kr=setTimeout((()=>{if(this.Xr(),this.Gr.length>0){var n=this.ti(),r=function(){var d=n[l],p=new Date().getTime();d.data&&Ze(d.data)&&zt(d.data,(c=>{c.offset=Math.abs(c.timestamp-p),delete c.timestamp})),t.ei(d)};for(var l in n)r()}}),this.Qr))}ei(t){try{this.Jr(t)}catch(n){Ae.error(n)}}Xr(){clearTimeout(this.Kr),this.Kr=void 0}ti(){var t={};return zt(this.Gr,(n=>{var r,l=n,d=(l?l.batchKey:null)||l.url;Te(t[d])&&(t[d]=Ce({},l,{data:[]})),(r=t[d].data)==null||r.push(l.data)})),this.Gr=[],t}}var X5=["retriesPerformedSoFar"];class J5{constructor(t){this.ri=!1,this.ii=3e3,this.Gr=[],this._instance=t,this.Gr=[],this.ni=!0,!Te(ce)&&"onLine"in ce.navigator&&(this.ni=ce.navigator.onLine,this.si=()=>{this.ni=!0,this.oi()},this.ai=()=>{this.ni=!1},es(ce,"online",this.si),es(ce,"offline",this.ai))}get length(){return this.Gr.length}retriableRequest(t){var n=t.retriesPerformedSoFar,r=I1(t,X5);vn(n)&&(r.url=Wu(r.url,{retry_count:n})),this._instance._send_request(Ce({},r,{callback:l=>{if(l.statusCode!==200&&(400>l.statusCode||l.statusCode>=500)){if((l.statusCode===0?3:10)>(n??0))return void this.Ot(Ce({retriesPerformedSoFar:n},r));l.statusCode===0&&Ae.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(l)}}))}Ot(t){var n=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=n+1;var r=(function(p){var c=3e3*Math.pow(2,p),h=c/2,v=Math.min(18e5,c),S=Math.random()-.5;return Math.ceil(v+S*(v-h))})(n),l=Date.now()+r;this.Gr.push({retryAt:l,requestOptions:t});var d="Enqueued failed request for retry in "+r;navigator.onLine||(d+=" (Browser is offline)"),Ae.warn(d),this.ri||(this.ri=!0,this.li())}li(){if(this.ui&&clearTimeout(this.ui),this.Gr.length===0)return this.ri=!1,void(this.ui=void 0);this.ui=setTimeout((()=>{this.ni&&this.Gr.length>0&&this.oi(),this.li()}),this.ii)}oi(){var t=Date.now(),n=[],r=this.Gr.filter((d=>t>d.retryAt||(n.push(d),!1)));if(this.Gr=n,r.length>0)for(var l of r)this.retriableRequest(l.requestOptions)}unload(){for(var t of(this.ui&&(clearTimeout(this.ui),this.ui=void 0),this.ri=!1,Te(ce)||(this.si&&(ce.removeEventListener("online",this.si),this.si=void 0),this.ai&&(ce.removeEventListener("offline",this.ai),this.ai=void 0)),this.Gr)){var n=t.requestOptions;try{this._instance._send_request(Ce({},n,{transport:"sendBeacon"}))}catch(r){Ae.error(r)}}this.Gr=[]}}class Z5{constructor(t){this.hi=()=>{var n,r,l,d;this.di||(this.di={});var p=this.scrollElement(),c=this.scrollY(),h=p?Math.max(0,p.scrollHeight-p.clientHeight):0,v=c+((p==null?void 0:p.clientHeight)||0),S=(p==null?void 0:p.scrollHeight)||0;this.di.lastScrollY=Math.ceil(c),this.di.maxScrollY=Math.max(c,(n=this.di.maxScrollY)!==null&&n!==void 0?n:0),this.di.maxScrollHeight=Math.max(h,(r=this.di.maxScrollHeight)!==null&&r!==void 0?r:0),this.di.lastContentY=v,this.di.maxContentY=Math.max(v,(l=this.di.maxContentY)!==null&&l!==void 0?l:0),this.di.maxContentHeight=Math.max(S,(d=this.di.maxContentHeight)!==null&&d!==void 0?d:0)},this._instance=t}get ci(){return this._instance.config.scroll_root_selector}getContext(){return this.di}resetContext(){var t=this.di;return setTimeout(this.hi,0),t}startMeasuringScrollPosition(){es(ce,"scroll",this.hi,{capture:!0}),es(ce,"scrollend",this.hi,{capture:!0}),es(ce,"resize",this.hi)}scrollElement(){if(!this.ci)return ce==null?void 0:ce.document.documentElement;var t=Ze(this.ci)?this.ci:[this.ci];for(var n of t){var r=ce==null?void 0:ce.document.querySelector(n);if(r)return r}}vi(t){var n=t==="y"?"scrollTop":"scrollLeft";if(this.ci){var r=this.scrollElement();return r&&r[n]||0}return ce?t==="y"?ce.scrollY||ce.pageYOffset||ce.document.documentElement.scrollTop||0:ce.scrollX||ce.pageXOffset||ce.document.documentElement.scrollLeft||0:0}scrollY(){return this.vi("y")}scrollX(){return this.vi("x")}}var Q5=s=>Kb(s==null?void 0:s.config.mask_personal_data_properties,s==null?void 0:s.config.custom_personal_data_properties,s==null?void 0:s.config.disable_capture_url_hashes);class My{constructor(t,n,r,l){this.fi=d=>{var p=this.pi();if(!p||p.sessionId!==d){var c={sessionId:d,props:this.gi(this._instance)};this.mi.register({[Sp]:c})}},this._instance=t,this.yi=n,this.mi=r,this.gi=l||Q5,this.yi.onSessionId(this.fi)}pi(){return this.mi.props[Sp]}getSetOnceProps(){var t,n=(t=this.pi())==null?void 0:t.props;return n?"r"in n?Xb(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 zt(uv(this.getSetOnceProps()),((n,r)=>{r==="$current_url"&&(r="url"),t["$session_entry_"+tp(r)]=n})),t}}class mv{on(t,n){return this.bi[t]||(this.bi[t]=[]),this.bi[t].push(n),()=>{this.bi[t]=this.bi[t].filter((r=>r!==n))}}emit(t,n){for(var r of this.bi[t]||[])r(n);for(var l of this.bi["*"]||[])l(t,n)}constructor(){this.bi={}}}var Vo=Jt("[SessionId]");class jy{on(t,n){return this.wi.on(t,n)}constructor(t,n,r){var l;if(this.xi=null,this.ki=[],this.Si=void 0,this.Ci=!1,this.wi=new mv,this.Mi=(v,S)=>!(!vn(v)||!vn(S))&&Math.abs(v-S)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===yn)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Te=t.config,this.mi=t.persistence,this.Ii=void 0,this.Ti=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Ei=n||_n,this.Ri=r||_n;var d=this.Te.persistence_name||this.Te.token;if(this._sessionTimeoutMs=1e3*Vi(this.Te.session_idle_timeout_seconds||1800,60,36e3,Vo.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Pi(),this.Oi="ph_"+d+"_window_id",this.Fi="ph_"+d+"_primary_window_exists",this.Ai()){var p=Ls.F(this.Oi),c=Ls.F(this.Fi);p&&!c?this.Ii=p:Ls.D(this.Oi),Ls.A(this.Fi,!0)}if((l=this.Te.bootstrap)!=null&&l.sessionID)try{var h=(v=>{var S=this.Te.bootstrap.sessionID.replace(/-/g,"");if(S.length!==32)throw new Error("Not a valid UUID");if(S[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(S.substring(0,12),16)})();this.$i(this.Te.bootstrap.sessionID,new Date().getTime(),h)}catch(v){Vo.error("Invalid sessionID in bootstrap",v)}this.Li()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return Te(this.ki)&&(this.ki=[]),this.ki.push(t),this.Ti&&t(this.Ti,this.Ii),()=>{this.ki=this.ki.filter((n=>n!==t))}}Ai(){return this.Te.persistence!=="memory"&&!this.mi.yr&&Ls.N()}Di(t){t!==this.Ii&&(this.Ii=t,this.Ai()&&Ls.A(this.Oi,t))}Ni(){return this.Ii?this.Ii:this.Ai()?Ls.F(this.Oi):null}qi(t){var n=this.xi;return!Gs(n)&&!Gs(t)&&5e3>Math.abs(t-n)}$i(t,n,r){var l=n!==this._sessionActivityTimestamp,d=!(t!==this.Ti||r!==this._sessionStartTimestamp);this._sessionStartTimestamp=r,this._sessionActivityTimestamp=n,this.Ti=t,d&&!l||d&&this.qi(n)||(this.xi=n,this.mi.register({[Ea]:[n,t,r]}))}ji(){var t,n=(t=this.Te)==null?void 0:t.persistence_save_debounce_ms;return vn(n)&&n>0}Bi(){this.ji()?this.mi.refreshKey(Ea):(this.mi.flush(),this.mi.load())}Hi(){var t;if(!Gs(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.xi){this.Bi();var n=this.Ui();n[1]===this.Ti&&n[2]===this._sessionStartTimestamp&&(this.xi=this._sessionActivityTimestamp,this.mi.register({[Ea]:[this._sessionActivityTimestamp,(t=this.Ti)!==null&&t!==void 0?t:null,this._sessionStartTimestamp]}),this.mi.flush())}}zi(){var t=this.Ui()[0],n=vn(t)?t:0,r=vn(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(n,r)}Vi(t){return this.Bi(),this.Mi(t,this.zi())}Ui(){var t=this.mi.props[Ea];return Ze(t)&&t.length===2&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.xi=null,clearTimeout(this.Wi),this.Wi=void 0,this.$i(null,null,null)}destroy(){this.Ci=!0,this.Hi(),clearTimeout(this.Wi),this.Wi=void 0,this.Si&&ce&&(ce.removeEventListener(ku,this.Si,{capture:!1}),this.Si=void 0),this.ki=[]}Li(){this.Si=()=>{this.Hi(),this.Ai()&&Ls.D(this.Fi)},es(ce,ku,this.Si,{capture:!1})}checkAndGetSessionAndWindowId(t,n){if(t===void 0&&(t=!1),n===void 0&&(n=null),this.Te.cookieless_mode===yn)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=n||new Date().getTime(),l=this.Ui(),d=l[1],p=l[2],c=this.zi(),h=this.Ni(),v=vn(p)&&Math.abs(r-p)>864e5,S=!1,f=!1,x=!d,E=d,T=!x&&!t&&this.Mi(r,c);if(T){(T=this.Vi(r))||Vo.info("cross-tab refresh kept the session alive",{sessionId:d});var C=this.Ui();d=C[1],p=C[2]}x||T||v?(d=this.Ei(),h=this.Ri(),Vo.info("new session ID generated",{sessionId:d,windowId:h,changeReason:{noSessionId:x,activityTimeout:T,sessionPastMaximumLength:v}}),p=r,S=!0):(h||(h=this.Ri(),S=!0),(f=d!==E)&&(Vo.info("adopted cross-tab session id",{sessionId:d,windowId:h}),S=!0));var y=vn(c)&&t&&!v?c:r,b=vn(p)?p:new Date().getTime();this.Di(h),this.$i(d,y,b),t||this.Pi();var m={noSessionId:x,activityTimeout:T,sessionPastMaximumLength:v,crossTabAdoption:f};return S&&this.ki.forEach((g=>g(d,h,m))),{sessionId:d,windowId:h,sessionStartTimestamp:b,changeReason:S?m:void 0,lastActivityTimestamp:c}}Pi(){this.Ci||(clearTimeout(this.Wi),this.Wi=setTimeout((()=>{if(!this.Ci)if(this.Vi(new Date().getTime())){var t=this.Ti;this.resetSessionId(),this.wi.emit("forcedIdleReset",{idleSessionId:t})}else this.Pi()}),1.1*this.sessionTimeoutMs))}}var cS=function(s,t){if(!s)return!1;var n=s.userAgent;if(n&&J0(n,t))return!0;try{var r=s==null?void 0:s.userAgentData;if(r!=null&&r.brands&&r.brands.some((l=>J0(l==null?void 0:l.brand,t))))return!0}catch{}return!!s.webdriver};function uS(){return(uS=Kt((function*(){var s=Ws==null?void 0:Ws.userAgentData;if(s!=null&&s.getHighEntropyValues)try{var t=yield s.getHighEntropyValues(["model"]),n=t==null?void 0:t.model;return It(n)&&n.length>0?n:void 0}catch(r){return void Ae.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",r)}}))).apply(this,arguments)}var Nu=function(s,t){if(!(function(n){try{new RegExp(n)}catch{return!1}return!0})(t))return!1;try{return new RegExp(t).test(s)}catch{return!1}};function jf(s,t,n){return ka({distinct_id:s,userPropertiesToSet:t,userPropertiesToSetOnce:n})}var hS={exact:(s,t)=>t.some((n=>s.some((r=>n===r)))),is_not:(s,t)=>t.every((n=>s.every((r=>n!==r)))),regex:(s,t)=>t.some((n=>s.some((r=>Nu(n,r))))),not_regex:(s,t)=>t.every((n=>s.every((r=>!Nu(n,r))))),icontains:(s,t)=>t.map(Xc).some((n=>s.map(Xc).some((r=>n.includes(r))))),not_icontains:(s,t)=>t.map(Xc).every((n=>s.map(Xc).every((r=>!n.includes(r))))),gt:(s,t)=>t.some((n=>{var r=parseFloat(n);return!isNaN(r)&&s.some((l=>r>parseFloat(l)))})),lt:(s,t)=>t.some((n=>{var r=parseFloat(n);return!isNaN(r)&&s.some((l=>r<parseFloat(l)))}))},Xc=s=>s.toLowerCase();function dS(s,t){return!s||Object.entries(s).every((n=>{var r=n[1],l=t==null?void 0:t[n[0]];if(Te(l)||Gs(l))return!1;var d=[String(l)],p=hS[r.operator];return!!p&&p(r.values,d)}))}var Lp="custom",Dy="i.posthog.com",eA=/^\/static\//;class tA{constructor(t){this.Zi={},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("."+Dy,".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this.Zi[this.apiHost]||(this.Zi[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":Lp),this.Zi[this.apiHost]}Gi(t){if(eA.test(t)){var n=this.instance.config.asset_host;if(typeof n=="string")return n.trim().replace(/\/$/,"")||void 0}}endpointFor(t,n){if(n===void 0&&(n=""),n&&(n=n[0]==="/"?n:"/"+n),t==="ui")return this.uiHost+n;if(t==="flags")return this.flagsApiHost+n;if(t==="assets"){var r=this.Gi(n);if(r)return""+r+n}if(this.region===Lp)return this.apiHost+n;var l=Dy+n;switch(t){case"assets":return"https://"+this.region+"-assets."+l;case"api":return"https://"+this.region+"."+l}}}function fS(s){var t;return!((t=s.conditions)==null||(t=t.events)==null||(t=t.values)==null||!t.length)}var jt=Jt("[Surveys]"),pS="seenSurvey_",vS=s=>{try{var t=(n=>((r,l)=>""+pS+(function(d){return d.current_iteration&&d.current_iteration>0?d.id+"_"+d.current_iteration:d.id})(l))(0,n))(s);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(n){jt.error("Failed to persist survey seen state",n)}},sA=[kf.Popover,kf.Widget,kf.API],iA={ignoreConditions:!1,ignoreDelay:!1,displayType:Ap.Popover},nA=Jt("[PostHog ExternalIntegrations]"),rA={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class aA{constructor(t){this._instance=t}tr(t,n){var r;(r=He.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,t,(l=>{if(l)return nA.error("failed to load script",l);n()}))}startIfEnabledOrStop(){var t=this,n=function(){var d,p,c,h=r[0],v=r[1];!v||(d=He.__PosthogExtensions__)!=null&&(d=d.integrations)!=null&&d[h]||t.tr(rA[h],(()=>{var S;(S=He.__PosthogExtensions__)==null||(S=S.integrations)==null||(S=S[h])==null||S.start(t._instance)})),!v&&(p=He.__PosthogExtensions__)!=null&&(p=p.integrations)!=null&&p[h]&&((c=He.__PosthogExtensions__)==null||(c=c.integrations)==null||(c=c[h])==null||c.stop())};for(var r of Object.entries((l=this._instance.config.integrations)!==null&&l!==void 0?l:{})){var l;n()}}}class oA{constructor(t,n){this.it=t,this.Qi=n,this.Ji=new Map,this.Ki=!1}add(t){var n=this;return Kt((function*(){if(n.Ki)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(n.Ji.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');n.Ji.set(t.name,t);try{var r=t.setup(n.Qi);r&&(yield r)}catch(d){var l=n.Ji.get(t.name)===t;l&&n.Ji.delete(t.name),n.it.error('Failed to set up browser extension "'+t.name+'"',d),l&&n.Yi(t)}}))()}dispose(){if(!this.Ki){this.Ki=!0;var t=Array.from(this.Ji.values()).reverse();for(var n of(this.Ji.clear(),t))this.Yi(n)}}Yi(t){try{var n=t.dispose==null?void 0:t.dispose();n&&fi(n.then)&&n.then(void 0,(r=>{this.it.error('Failed to dispose browser extension "'+t.name+'"',r)}))}catch(r){this.it.error('Failed to dispose browser extension "'+t.name+'"',r)}}}class lA{constructor(t){this._instance=t}get(t){var n;return(n=this._instance.persistence)==null?void 0:n.get_property(t)}set(t,n){var r;(r=this._instance.persistence)==null||r.set_property(t,n)}remove(t){var n;(n=this._instance.persistence)==null||n.unregister(t)}}var Ny="extensionsRemoteConfig";class cA{constructor(t){this.Ki=!1,this.instance=t,this.it=Ae.createLogger("[BrowserExtensions]"),this.Xi=t.tn,this.kv=new lA(t),this.onEvent=n=>Kc(this.instance.on("eventCaptured",(r=>{try{n({event:r.event,properties:r.properties})}catch(l){this.it.error("Browser extension event listener failed",l)}}))),this.onRemoteConfig=n=>{if(this.Ki)return Kc((()=>{}));var r=d=>{try{n(d)}catch(p){this.it.error("Browser extension remote config listener failed",p)}},l=this.instance.en.on(Ny,r);return this.Xi&&r(this.Xi),Kc(l)},this.rn=new oA(this.it,this)}get logger(){return this.it}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return(t=this.instance.get_property(gl))!==null&&t!==void 0?t:this.distinctId}get groups(){return this.instance.getGroups()}get session(){try{var t,n,r,l,d=(t=this.instance.sessionManager)==null?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:(n=d==null?void 0:d.sessionId)!==null&&n!==void 0?n:"",windowId:(r=d==null?void 0:d.windowId)!==null&&r!==void 0?r:"",sessionStartTimestamp:(l=d==null?void 0:d.sessionStartTimestamp)!==null&&l!==void 0?l:0}}catch{return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get projectToken(){return this.instance.config.token}add(t){return this.rn.add(t)}capture(t,n,r){var l=this;return Kt((function*(){r?l.instance.capture(t,n,{timestamp:r.timestamp,uuid:r.uuid,$set:r.set,$set_once:r.setOnce}):l.instance.capture(t,n)}))()}registerDynamicEventProperties(t){return Kc(this.instance.nn(t))}handleRemoteConfig(t){this.Ki||(this.Xi=t,this.instance.en.emit(Ny,t))}sendRequest(t,n){var r=this;return Kt((function*(){var l;n===void 0&&(n={});var d=r.instance.requestRouter.endpointFor((l=n.target)!==null&&l!==void 0?l:"api",t),p={method:n.method,url:n.query?Wu(d,n.query):d,data:n.body,headers:n.headers,timeout:n.timeoutMs,fireCallbackOnDrop:!0,transport:n.transport};return n.transport==="sendBeacon"?(r.instance._send_request(p),{statusCode:202}):new Promise((c=>{p.callback=c,r.instance._send_request(p)}))}))()}dispose(){this.Ki||(this.Ki=!0,this.rn.dispose())}}var cl={},Df=0,Lu=()=>{},Ly='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Yo="Surveys module not available",Oy="sanitize_properties is deprecated. Use before_send instead",mS="Invalid value for property_denylist config: ",uA=["token","distinct_id",xb],Ca="posthog",gS=!G5&&(ei==null?void 0:ei.indexOf("MSIE"))===-1&&(ei==null?void 0:ei.indexOf("Mozilla"))===-1,Nf=s=>{var t;return Ce({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:h5(De==null?void 0:De.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Lu,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:s??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:hs&&It(hs==null?void 0:hs.search)&&hs.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:!1,enable_recording_console_log:void 0,secure_cookie:(ce==null||(t=ce.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){Ae.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:Ep,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:Np},error_tracking:{},_onCapture:Lu},(n=>({rageclick:n&&n>="2026-05-30"?{content_ignorelist:x5,ignore_text_selection:!0}:!n||"2025-11-30">n||{content_ignorelist:!0},capture_pageview:!n||"2025-05-24">n||"history_change",session_recording:n&&n>="2026-06-25"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6},streamNetworkBody:!0}:n&&n>="2026-05-30"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6}}:n&&n>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:n&&n>="2026-01-30"?"head":"body",internal_or_test_user_hostname:n&&n>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:n&&n>="2026-05-30"?250:0,split_storage:!(!n||"2026-05-30">n),detect_google_search_app:!(!n||"2026-05-30">n),disable_capture_url_hashes:!(!n||"2026-06-25">n)}))(s))},hA=[["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"]],By=s=>{var t={};for(var n of hA){var r=n[0],l=n[1];Te(s[r])||(t[l]=s[r])}var d=Ft({},t,s),p=s.__preview_external_dependency_versioned_paths;return Te(p)||(Te(s.strict_script_versioning)&&(d.strict_script_versioning=!!p),It(p)&&Te(s.asset_host)&&(d.asset_host=p)),Ze(s.property_blacklist)&&(Te(s.property_denylist)?d.property_denylist=s.property_blacklist:Ze(s.property_denylist)?d.property_denylist=[...s.property_blacklist,...s.property_denylist]:Ae.error(mS+s.property_denylist)),d};class dA{constructor(){this.__forceAllowLocalhost=!1}get sn(){return this.__forceAllowLocalhost}set sn(t){Ae.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class Ti{an(t,n){if(t){var r=this.Ji.indexOf(t);r!==-1&&this.Ji.splice(r,1)}return this.Ji.push(n),n.initialize==null||n.initialize(),n}ln(){return this.config.cookieless_mode===yn||this.config.cookieless_mode===jr&&this.consent.isRejected()}get decideEndpointWasHit(){var t,n;return(t=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&t!==void 0&&t}get flagsEndpointWasHit(){var t,n;return(t=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&t!==void 0&&t}constructor(){var t;this.webPerformance=new dA,this.un=!1,this.version=Et.LIB_VERSION,this.en=new mv,this.Ji=[],this.hn=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Nf(),this.SentryIntegration=j5,this.sentryIntegration=r=>(function(l,d){var p=Ub(l,d);return{name:Pb,processEvent:c=>p(c)}})(this,r),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.dn=!1,this.cn=null,this.vn=null,this.fn=null,this.scrollManager=new Z5(this),this.pageViewManager=new Sy(this),this.rateLimiter=new $5(this),this.requestRouter=new tA(this),this.consent=new _5(this),this.externalIntegrations=new aA(this);var n=(t=Ti.__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,l,d)=>{var p=It(r)?{[r]:l}:r;this.setPersonProperties(p),d==null||d({})},set_once:(r,l,d)=>{var p=It(r)?{[r]:l}:r;this.setPersonProperties(void 0,p),d==null||d({})}},this.on("eventCaptured",(r=>Ae.info('send "'+(r==null?void 0:r.event)+'"',r)))}init(t,n,r){if(r&&r!==Ca){var l,d=(l=cl[r])!==null&&l!==void 0?l:new Ti;return d._init(t,n,r),cl[r]=d,cl[Ca][r]=d,d}return this._init(t,n,r)}_init(t,n,r){var l,d;n===void 0&&(n={});var p=It(t)?t.trim():"";if(!p)return Ae.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=Nf(n.defaults),n.debug=this.pn(n.debug),this.gn=n,this.mn=[],n.person_profiles?this.vn=n.person_profiles:n.process_person&&(this.vn=n.process_person);var c=Nf(n.defaults),h=By(n),v=Ft({},c,h,{name:r,token:p});Yt(c.rageclick)&&Yt(h.rageclick)&&(v.rageclick=Ft({},c.rageclick,h.rageclick)),Yt(c.session_recording)&&Yt(h.session_recording)&&(v.session_recording=Ft({},c.session_recording,h.session_recording)),this.set_config(v),this.config.on_xhr_error&&Ae.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:qs.GZipJS;var S=this.yn();this.persistence=new Ef(this.config,S),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Ef(Ce({},this.config,{persistence:"sessionStorage"}),S,!1);var f=Ce({},this.persistence.props),x=Ce({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.bn=new K5((k=>this._n(k)),this.config.request_queue_config),this.wn=new J5(this),this.__request_queue=[];var E=this.ln();if(E||(this.sessionManager=new jy(this),this.sessionPropsManager=new My(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(Ae.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.xn(E)}),0)):(Ae.info("Initializing extensions synchronously"),this.xn(E)),Et.DEBUG=Et.DEBUG||this.config.debug,Et.DEBUG&&Ae.info("Starting in debug mode",{this:this,config:n,thisC:Ce({},this.config),p:f,s:x}),!this.config.identity_distinct_id||(l=n.bootstrap)!=null&&l.distinctID||(n.bootstrap=Ce({},n.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((d=n.bootstrap)==null?void 0:d.distinctID)!==void 0){var T=n.bootstrap.distinctID,C=this.get_distinct_id(),y=this.persistence.get_property(ki);if(n.bootstrap.isIdentifiedID&&C!=null&&C!==T&&y===_a)this.identify(T);else if(n.bootstrap.isIdentifiedID&&C!=null&&C!==T&&y===wr)Ae.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 b=this.config.get_device_id(_n()),m=n.bootstrap.isIdentifiedID?b:T;this.persistence.set_property(ki,n.bootstrap.isIdentifiedID?wr:_a),this.register({distinct_id:T,$device_id:m})}}if(E)this.register_once({distinct_id:qc,$device_id:null},"");else if(!this.get_distinct_id()){var g=this.config.get_device_id(_n());this.register_once({distinct_id:g,$device_id:g},""),this.persistence.set_property(ki,_a)}return es(ce,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),n.segment?(function(k,M){var R=k.config.segment;if(!R)return M();(function(j,A){var D=j.config.segment;if(!D)return A();var I=G=>{var U=()=>G.anonymousId()||_n();j.config.get_device_id=U,G.id()&&(j.register({distinct_id:G.id(),$device_id:U()}),j.persistence.set_property(ki,wr)),A()},q=D.user();"then"in q&&fi(q.then)?q.then(I):I(q)})(k,(()=>{R.register((j=>{typeof Promise<"u"&&Promise.resolve||xf.warn("This browser does not have Promise support, and can not use the segment integration");var A=(D,I)=>{if(!I)return D;D.event.userId||D.event.anonymousId===j.get_distinct_id()||(xf.info("No userId set, resetting PostHog"),j.reset()),D.event.userId&&D.event.userId!==j.get_distinct_id()&&(xf.info("UserId set, identifying with PostHog"),j.identify(D.event.userId));var q=j.calculateEventProperties(I,D.event.properties);return D.event.properties=Object.assign({},q,D.event.properties),D};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:D=>A(D,D.event.event),page:D=>A(D,xa),identify:D=>A(D,bf),screen:D=>A(D,"$screen")}})(k)).then((()=>{M()}))}))})(this,(()=>this.kn())):this.kn(),fi(this.config._onCapture)&&this.config._onCapture!==Lu&&(Ae.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(k=>this.config._onCapture(k.event,k)))),this.config.ip&&Ae.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 uS.apply(this,arguments)})().then((k=>{k&&this.register({[_f]:k})})).catch(Lu),this}xn(t){var n,r,l,d,p,c,h,v,S=performance.now(),f=Ce({},Ti.__defaultExtensionClasses,this.config.__extensionClasses),x=[];f.featureFlags&&this.Ji.push(this.featureFlags=(n=this.featureFlags)!==null&&n!==void 0?n:new f.featureFlags(this)),f.exceptions&&this.Ji.push(this.exceptions=(r=this.exceptions)!==null&&r!==void 0?r:new f.exceptions(this)),f.historyAutocapture&&this.Ji.push(this.historyAutocapture=new f.historyAutocapture(this)),f.tracingHeaders&&this.Ji.push(this.tracingHeaders=new f.tracingHeaders(this)),f.siteApps&&this.Ji.push(this.siteApps=new f.siteApps(this)),f.sessionRecording&&!t&&this.Ji.push(this.sessionRecording=new f.sessionRecording(this)),this.config.disable_scroll_properties||x.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),f.autocapture&&this.Ji.push(this.autocapture=new f.autocapture(this)),f.surveys&&this.Ji.push(this.surveys=(l=this.surveys)!==null&&l!==void 0?l:new f.surveys(this)),f.logs&&this.Ji.push(this.logs=(d=this.logs)!==null&&d!==void 0?d:new f.logs(this)),f.metrics&&this.Ji.push(this.metrics=(p=this.metrics)!==null&&p!==void 0?p:new f.metrics(this)),f.conversations&&this.Ji.push(this.conversations=(c=this.conversations)!==null&&c!==void 0?c:new f.conversations(this)),f.productTours&&this.Ji.push(this.productTours=new f.productTours(this)),f.heatmaps&&this.Ji.push(this.heatmaps=new f.heatmaps(this)),f.webVitalsAutocapture&&this.Ji.push(this.webVitalsAutocapture=new f.webVitalsAutocapture(this)),f.exceptionObserver&&this.Ji.push(this.exceptionObserver=new f.exceptionObserver(this)),f.deadClicksAutocapture&&this.Ji.push(this.deadClicksAutocapture=new f.deadClicksAutocapture(this,M5)),f.toolbar&&this.Ji.push(this.toolbar=(h=this.toolbar)!==null&&h!==void 0?h:new f.toolbar(this)),f.experiments&&this.Ji.push(this.experiments=(v=this.experiments)!==null&&v!==void 0?v:new f.experiments(this)),this.Ji.forEach((E=>{E.initialize&&x.push((()=>{E.initialize==null||E.initialize()}))})),x.push((()=>{if(this.Sn){var E=this.Sn;this.Sn=void 0,this.Ji.forEach((T=>T.onRemoteConfig==null?void 0:T.onRemoteConfig(E)))}})),this.Cn(x,S)}Cn(t,n){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-n>=30&&t.length>0)return void setTimeout((()=>{this.Cn(t,n)}),0);var r=t.shift();if(r)try{r()}catch(d){Ae.error("Error initializing extension:",d)}}var l=Math.round(performance.now()-n);this.register_for_session({[Cb]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Eb]:l}),this.config.__preview_deferred_init_extensions&&Ae.info("PostHog extensions initialized ("+l+"ms)")}Br(t){var n;if(!De||!De.body)return Ae.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Br(t)}),500);if(this.config.__preview_deferred_init_extensions&&(this.Sn=t),this.tn=t,this.compression=void 0,t.ok){var r,l=t.config;l.supportedCompression&&!this.config.disable_compression&&(this.compression=Ge(l.supportedCompression,qs.GZipJS)?qs.GZipJS:Ge(l.supportedCompression,qs.Base64)?qs.Base64:void 0),(r=l.analytics)!=null&&r.endpoint&&(this.analyticsDefaultEndpoint=l.analytics.endpoint)}this.set_config({person_profiles:this.vn?this.vn:Ep}),(n=this.Mn)==null||n.handleRemoteConfig(t),this.Ji.forEach((d=>d.onRemoteConfig==null?void 0:d.onRemoteConfig(t)))}kn(){try{this.config.loaded(this)}catch(r){Ae.critical("`loaded` function failed",r)}if(this.In(),this.config.internal_or_test_user_hostname&&hs!=null&&hs.hostname){var t=hs.hostname,n=this.config.internal_or_test_user_hostname;(typeof n=="string"?t===n:n.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.ln())&&this.Tn()}),1),this.En=new Zb(this),this.En.load()}In(){var t;this.is_capturing()&&this.config.request_batching&&((t=this.bn)==null||t.enable())}_dom_loaded(){this.is_capturing()&&Wc(this.__request_queue,(t=>this._n(t))),this.__request_queue=[],this.In()}_handle_unload(){var t,n,r,l,d;(t=this.surveys)==null||t.handlePageUnload==null||t.handlePageUnload(),(n=this.metrics)==null||n.flush("sendBeacon"),this.config.request_batching?(this.Rn()&&this.capture(yf),(r=this.logs)==null||r.flushLogs("sendBeacon"),(l=this.bn)==null||l.unload(),(d=this.wn)==null||d.unload()):this.Rn()&&this.capture(yf,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded?gS?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=Ce({},this.config.request_headers,t.headers),t.compression=t.compression==="best-available"?this.compression:t.compression,(Te(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(n=>{var r,l,d,p=Ce({},n);p.timeout=p.timeout||6e4;var c,h,v,S,f,x=(r=p.transport)!==null&&r!==void 0?r:"fetch";x==="sendBeacon"&&Te(p.compression)&&p.data&&(p.compression=qs.Base64),p.method==="POST"&&p.data&&(p.timestampMode==="capture-body"?p.data={api_key:(h=(f=(S=Ze(c=p.data)?c:[c])[0])==null||(v=f.properties)==null?void 0:v.token)!==null&&h!==void 0?h:f==null?void 0:f.token,batch:S,sent_at:new Date().toISOString()}:p.timestampMode==="body"&&(p.data=(function(C,y){return y===void 0&&(y=new Date().toISOString()),Ze(C)?C.map((b=>Ce({},b,{sent_at:y}))):Ce({},C,{sent_at:y})})(p.data))),p.url=Ry(p.url,p.method,p.compression,p.timestampMode);var E=lu.filter((C=>!p.disableTransport||!C.transport||!p.disableTransport.includes(C.transport))),T=(l=(d=(function(C,y){for(var b=0;C.length>b;b++)if(C[b].transport===x)return C[b]})(E))==null?void 0:d.method)!==null&&l!==void 0?l:E[0].method;if(!T)throw new Error("No available transport method");x!=="sendBeacon"&&p.data&&p.compression===qs.GZipJS&&fT&&typeof Promise<"u"&&!ou?V5(p).then((C=>{T(C)})).catch((C=>{if(X0(C))return ou=!0,void T(Ce({},p,{compression:void 0,url:Ry(n.url,n.method,void 0,n.timestampMode)}));(y=>{if(!y||typeof y!="object")return!1;var b="name"in y?String(y.name):"";return X0(y)||b===z1})(C)&&(ou=!0),T(p)})):T(p)})(Ce({},t,{callback:n=>{var r,l;this.rateLimiter.checkForLimiting(n),400>n.statusCode||(r=(l=this.config).on_request_error)==null||r.call(l,n),t.callback==null||t.callback(n)}}))):t.fireCallbackOnDrop&&(t.callback==null||t.callback({statusCode:0}))}_n(t){this.wn?this.wn.retriableRequest(t):this._send_request(t)}_execute_array(t){Df++;try{var n,r=[],l=[],d=[];Wc(t,(c=>{if(c)if(Ze(n=c[0]))d.push(c);else if(fi(c))try{c.call(this)}catch(h){Ae.error("Error executing queued PostHog call",c,h)}else Ze(c)&&n==="alias"?r.push(c):Ze(c)&&n.indexOf("capture")!==-1&&fi(this[n])?d.push(c):l.push(c)}));var p=function(c,h){Wc(c,(function(v){try{if(Ze(v[0])){var S=h;zt(v,(function(f){S=S[f[0]].apply(S,f.slice(1))}))}else h[v[0]].apply(h,v.slice(1))}catch(f){Ae.error("Error executing queued PostHog call",v,f)}}))};p(r,this),p(l,this),p(d,this)}finally{Df--}}push(t){if(Df>0&&Ze(t)&&It(t[0])){var n=Ti.prototype[t[0]];fi(n)&&n.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,n,r){var l,d,p,c,h,v,S;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.bn){if(this.is_capturing())if(!Te(t)&&It(t)){var f=!this.config.opt_out_useragent_filter&&this._is_bot();if(!f||this.config.__preview_capture_bot_pageviews){var x=r!=null&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(x==null||!x.isRateLimited){if(this.hn.length>0){var E={};for(var T of this.hn.slice())try{Ft(E,T())}catch(B){Ae.error("Failed to produce browser extension event properties",B)}n=Ce({},E,n??{})}var C;(l=n)!=null&&l.$current_url&&!It((d=n)==null?void 0:d.$current_url)&&(Ae.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),(C=n)==null||delete C.$current_url),t!=="$exception"||r!=null&&r.Pn||Ae.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 y=new Date,b=(r==null?void 0:r.timestamp)||y,m=ty(r==null?void 0:r.uuid,_n),g={uuid:m,event:t,properties:this.calculateEventProperties(t,n||{},b,m)};t===xa&&this.config.__preview_capture_bot_pageviews&&f&&(g.event="$bot_pageview",g.properties.$browser_type="bot"),x&&(g.properties.$lib_rate_limit_remaining_tokens=x.remainingTokens);var k=t==="$feature_flag_called"&&g.properties.$feature_flag_has_experiment===!1&&this.get_property(Su)===!0;r!=null&&r.$set&&!k&&(g.$set=r==null?void 0:r.$set);var M=r==null?void 0:r.$unset;M&&(g.$unset=M);var R,j,A,D=k?void 0:this.On(r==null?void 0:r.$set_once,t!==ay,t===bf);if(D&&(g.$set_once=D),r!=null&&r._noTruncate||(c=this.config.properties_string_max_length,h=g,v=B=>It(B)?B.slice(0,c):B,S=new Set,g=(function B(N,z){if(N!==Object(N))return v?v(N):N;if(!S.has(N)){var W;if(S.add(N),Ze(N))W=[],Wc(N,(ue=>{W.push(B(ue))}));else{var Z={};zt(N,((ue,ge)=>{S.has(ue)||(Z[ge]=B(ue))})),W=Z}return W}})(h)),g.timestamp=b,Te(r==null?void 0:r.timestamp)||(g.properties.$event_time_override_provided=!0,g.properties.$event_time_override_system_time=y),k&&(g.properties=(function(B,N){N===void 0&&(N=[]);var z={},W=Z=>{B[Z]!==void 0&&(z[Z]=B[Z])};return pT.forEach(W),N.forEach(W),z})(g.properties,uA)),t===Sn.DISMISSED||t===Sn.SENT){var I,q,G=(I=n)==null?void 0:I[Tf.SURVEY_ID],U=(q=n)==null?void 0:q[Tf.SURVEY_ITERATION];vS({id:G,current_iteration:U}),g.$set=Ce({},g.$set,{[(R={id:G,current_iteration:U},j=t===Sn.SENT?"responded":"dismissed",A="$survey_"+j+"/"+R.id,R.current_iteration&&R.current_iteration>0&&(A="$survey_"+j+"/"+R.id+"/"+R.current_iteration),A)]:!0})}else t===Sn.SHOWN&&(g.$set=Ce({},g.$set,{[Tf.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(t===z5.SHOWN){var X,se=(X=n)==null?void 0:X[xy.TOUR_TYPE];se&&(g.$set=Ce({},g.$set,{[xy.TOUR_LAST_SEEN_DATE+"/"+se]:new Date().toISOString()}))}var F=Ce({},g.properties.$set,g.$set);if(Kn(F)||this.setPersonPropertiesForFlags(F),!et(this.config.before_send)){var Q=this.Rt(g);if(!Q)return;(g=Q).uuid=ty(g.uuid,_n)}this.en.emit("eventCaptured",g);var J=(p=r==null?void 0:r._url)!==null&&p!==void 0?p:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),O={method:"POST",url:J,data:g,compression:"best-available",timestampMode:(r==null?void 0:r._batchKey)==="recordings"||/\/s\/(?:\?|$)/.test(J)?"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._n(O):this.bn.enqueue(O),g}Ae.critical("This capture call is ignored due to client rate limiting.")}}else Ae.error("No event name provided to posthog.capture")}else Ae.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(n=>t(n.event,n)))}Fn(){var t;return(t=this.Mn)!==null&&t!==void 0?t:this.Mn=new cA(this)}nn(t){this.hn.push(t);var n=!0;return()=>{if(n){n=!1;var r=this.hn.indexOf(t);r!==-1&&this.hn.splice(r,1)}}}calculateEventProperties(t,n,r,l,d){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return n;var p=d?void 0:this.persistence.remove_event_timer(t),c=Ce({},n);if(c.token=this.config.token,c.$config_defaults=this.config.defaults,this.ln()&&(c[xb]=!0),t==="$snapshot"){var h=Ce({},this.persistence.properties(),this.sessionPersistence.properties());return c.distinct_id=h.distinct_id,(!It(c.distinct_id)&&!Os(c.distinct_id)||sp(c.distinct_id))&&Ae.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),c}var v,S=(function(g,k,M,R){var j,A,D,I;if(R===void 0&&(R=!1),!ei)return{};var q,G=g?[...za,...k||[]]:[],U=(function(Ue){for(var Ye=0;Q0.length>Ye;Ye++){var Ke=Q0[Ye],st=Ke[1],Oe=Ke[0].exec(Ue),Dt=Oe&&(fi(st)?st(Oe,Ue):st);if(Dt)return Dt}return["",""]})(ei),X=U[0],se=U[1],F=(q=typeof navigator<"u"?navigator:void 0)!=null&&q.brave?{brave:!0}:{},Q={};Te(M)||(Q.detectGoogleSearchApp=M);var J={},O=(j=navigator)==null||(j=j.userAgentData)==null?void 0:j.platform,B=(A=navigator)==null?void 0:A.maxTouchPoints,N=ce==null||(D=ce.screen)==null?void 0:D.width,z=ce==null||(I=ce.screen)==null?void 0:I.height,W=ce==null?void 0:ce.devicePixelRatio;Te(O)||(J.userAgentDataPlatform=O),Te(B)||(J.maxTouchPoints=B),Te(N)||(J.screenWidth=N),Te(z)||(J.screenHeight=z),Te(W)||(J.devicePixelRatio=W);var Z,ue,ge,Y,$,oe,ae,xe,Ee=Ft(uv({$os:X,$os_version:se,$browser:cb(ei,navigator.vendor,F,Q),$device:ey(ei),$device_type:(ue=ei,ge=J,xe=ey(ue),xe===W1||xe===q1||xe==="Kobo"||xe==="Kindle Fire"||xe===nb?Oa:xe===vl||xe===ja||xe===ml||xe===np?"Console":xe===V1?"Wearable":xe?vi:(ge==null?void 0:ge.userAgentDataPlatform)==="Android"&&((Y=ge==null?void 0:ge.maxTouchPoints)!==null&&Y!==void 0?Y:0)>0?600>Math.min(($=ge==null?void 0:ge.screenWidth)!==null&&$!==void 0?$:0,(oe=ge==null?void 0:ge.screenHeight)!==null&&oe!==void 0?oe:0)/((ae=ge==null?void 0:ge.devicePixelRatio)!==null&&ae!==void 0?ae:1)?vi:Oa:"Desktop"),$timezone:Jb(),$timezone_offset:B5()}),{$current_url:bl(R?Qn(hs==null?void 0:hs.href):hs==null?void 0:hs.href,G,Sl),$host:hs==null?void 0:hs.host,$pathname:hs==null?void 0:hs.pathname,$raw_user_agent:ei.length>1e3?ei.substring(0,997)+"...":ei,$browser_version:NT(ei,navigator.vendor,F,Q),$browser_language:wy(),$browser_language_prefix:(Z=wy(),typeof Z=="string"?Z.split("-")[0]:void 0),$screen_height:ce==null?void 0:ce.screen.height,$screen_width:ce==null?void 0:ce.screen.width,$viewport_height:ce==null?void 0:ce.innerHeight,$viewport_width:ce==null?void 0:ce.innerWidth,$lib:Et.LIB_NAME,$lib_version:Et.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Et.SDK_DIST_CHANNEL&&(Ee.$sdk_dist_channel=Et.SDK_DIST_CHANNEL),Ee})(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 f=this.sessionManager.checkAndGetSessionAndWindowId(d,r.getTime()),x=f.windowId;c.$session_id=f.sessionId,c.$window_id=x}this.sessionPropsManager&&Ft(c,this.sessionPropsManager.getSessionProps());try{var E;this.sessionRecording&&Ft(c,this.sessionRecording.sdkDebugProperties),c.$sdk_debug_retry_queue_size=(E=this.wn)==null?void 0:E.length}catch(g){c.$sdk_debug_error_capturing_properties=String(g)}if(this.requestRouter.region===Lp&&(c.$lib_custom_api_host=this.config.api_host),v=t!==xa||d?t!==yf||d?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,l),c=Ft(c,v),t===xa&&De&&(c.title=De.title),!Te(p)){var T=r.getTime()-p;c.$duration=parseFloat((T/1e3).toFixed(3))}ei&&this.config.opt_out_useragent_filter&&(c.$browser_type=this._is_bot()?"bot":"browser");var C=this.persistence.properties(),y=this.sessionPersistence.properties();zt(["$referrer","$referring_domain"],(g=>{g in C&&delete y[g]})),(c=Ft({},S,C,y,c)).$is_identified=this._isIdentified(),Ze(this.config.property_denylist)?zt(this.config.property_denylist,(function(g){delete c[g]})):Ae.error(mS+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var b=this.config.sanitize_properties;b&&(Ae.error(Oy),c=b(c,t));var m=this.An();return c.$process_person_profile=m,m&&!d&&this.$n("_calculate_event_properties"),c}On(t,n,r){var l;if(n===void 0&&(n=!0),r===void 0&&(r=!1),!this.persistence||!this.An()||this.un&&!r)return t;var d=this.persistence.get_initial_props(),p=(l=this.sessionPropsManager)==null?void 0:l.getSetOnceProps(),c=Ft({},d,p||{},t||{}),h=this.config.sanitize_properties;return h&&(Ae.error(Oy),c=h(c,"$set_once")),n&&(this.un=!0),Kn(c)?void 0:c}register(t,n){var r;(r=this.persistence)==null||r.register(t,n)}register_once(t,n,r){var l;(l=this.persistence)==null||l.register_once(t,n,r)}register_for_session(t){var n;(n=this.sessionPersistence)==null||n.register(t)}unregister(t){var n;(n=this.persistence)==null||n.unregister(t)}unregister_for_session(t){var n;(n=this.sessionPersistence)==null||n.unregister(t)}Ln(t,n){this.register({[t]:n})}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,l;return(r=(l=this.featureFlags)==null?void 0:l.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 l;(l=this.featureFlags)==null||l.updateFlags(t,n,r)}updateEarlyAccessFeatureEnrollment(t,n,r){var l;(l=this.featureFlags)==null||l.updateEarlyAccessFeatureEnrollment(t,n,r)}getEarlyAccessFeatures(t,n,r){var l;return n===void 0&&(n=!1),(l=this.featureFlags)==null?void 0:l.getEarlyAccessFeatures(t,n,r)}on(t,n){return this.en.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:Yo}),()=>{})}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:Yo})}getActiveMatchingSurveys(t,n){n===void 0&&(n=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,n):t([],{isLoaded:!1,error:Yo})}renderSurvey(t,n){var r;(r=this.surveys)==null||r.renderSurvey(t,n)}displaySurvey(t,n){var r;n===void 0&&(n=iA),(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:Yo}}canRenderSurveyAsync(t,n){var r,l;return n===void 0&&(n=!1),(r=(l=this.surveys)==null?void 0:l.canRenderSurveyAsync(t,n))!==null&&r!==void 0?r:Promise.resolve({visible:!1,disabledReason:Yo})}Dn(t){return!t||sp(t)?(Ae.critical("Unique user id has not been set in posthog.identify"),!1):t===qc?(Ae.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())||(Ae.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 Ae.uninitializedWarning("posthog.identify");if(Os(t)&&(t=t.toString(),Ae.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Dn(t)&&this.$n("posthog.identify")){var l=this.get_distinct_id();this.register({$user_id:t}),this.get_property(gl)||this.register_once({$had_persisted_distinct_id:!0,$device_id:l},""),t!==l&&t!==this.get_property(Qo)&&(this.unregister(Qo),this.register({distinct_id:t}));var d,p=(this.persistence.get_property(ki)||_a)===_a,c=t!==l,h=!c&&p;if(c&&p)this.persistence.set_property(ki,wr),this.setPersonPropertiesForFlags({$set:n||{},$set_once:r||{}},!1),this.capture(bf,{distinct_id:t,$anon_distinct_id:l},{$set:n||{},$set_once:r||{}}),this.fn=jf(t,n,r),(d=this.featureFlags)==null||d.setAnonymousDistinctId(l);else if(h){this.persistence.set_property(ki,wr);var v=n||{},S=r||{};this.setPersonPropertiesForFlags({$set:v,$set_once:S},!1),this.capture("$set",{$set:v,$set_once:S}),this.fn=jf(t,n,r)}else(n||r)&&this.setPersonProperties(n,r);c?(this.reloadFeatureFlags(),this.unregister(al)):h&&(n||r)&&this.reloadFeatureFlags()}}setPersonProperties(t,n){if((t||n)&&this.$n("posthog.setPersonProperties")){var r=jf(this.get_distinct_id(),t,n);this.fn!==r?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:n||{}},!0),this.capture("$set",{$set:t||{},$set_once:n||{}}),this.fn=r):Ae.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var n,r=(Ze(t)?t:[t]).filter((l=>It(l)&&l.length>0));r.length!==0&&this.$n("posthog.unsetPersonProperties")&&((n=this.featureFlags)==null||n.unsetPersonPropertiesForFlags(r,!0),this.capture("$set",{$unset:r}),this.fn=null)}group(t,n,r){if(t&&n){var l=this.getGroups(),d=l[t]!==n;if(d&&this.resetGroupPropertiesForFlags(t),this.register({$groups:Ce({},l,{[t]:n})}),d||r){var p={$group_type:t,$group_key:n};r&&(p.$group_set=r),this.capture(ay,p)}r&&this.setGroupPropertiesForFlags({[t]:r}),d&&!r&&this.reloadFeatureFlags()}else Ae.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.$n("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,r,l,d,p,c,h,v,S,f;if(Ae.info("reset"),!this.__loaded)return Ae.uninitializedWarning("posthog.reset");var x,E=this.get_property(gl),T=this.get_property(_f),C=this.get_property(Lr);if(this.consent.reset(),(n=this.persistence)==null||n.clear(),(r=this.sessionPersistence)==null||r.clear(),Te(C)||(x=this.persistence)==null||x.register({[Lr]:C}),(l=this.surveys)==null||l.reset(),(d=this.En)==null||d.stop(),(p=this.featureFlags)==null||p.reset(),(c=this.conversations)==null||c.reset(),(h=this.logs)==null||h.reset(),(v=this.metrics)==null||v.reset(),(S=this.persistence)==null||S.set_property(ki,_a),(f=this.sessionManager)==null||f.resetSessionId(),this.fn=null,this.config.cookieless_mode===yn)this.register_once({distinct_id:qc,$device_id:null},"");else{var y=this.config.get_device_id(_n());this.register_once({distinct_id:y,$device_id:t?y:E},""),t||Te(T)||this.register({[_f]:T})}this.register({$last_posthog_reset:new Date().toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}shutdown(t){var n=this;return Kt((function*(){var r,l,d,p,c,h,v;n.__loaded?((r=n.En)==null||r.stop(),(l=n.Mn)==null||l.dispose(),(d=n.logs)==null||d.flushLogs("sendBeacon"),(p=n.metrics)==null||p.flush("sendBeacon"),(c=n.bn)==null||c.unload(),(h=n.wn)==null||h.unload(),(v=n.featureFlags)==null||v.destroy()):Ae.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.Nn()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,(t=this.conversations)==null||t.qn()}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,l=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+n.sessionId);if(t!=null&&t.withTimestamp&&r){var d,p=(d=t.timestampLookBack)!==null&&d!==void 0?d:10;if(!r)return l;l+="?t="+Math.max(Math.floor((new Date().getTime()-r)/1e3)-p,0)}return l}alias(t,n){return t===this.get_property(gb)?(Ae.critical("Attempting to create alias for existing People user - aborting."),-2):this.$n("posthog.alias")?(Te(n)&&(n=this.get_distinct_id()),t!==n?(this.Ln(Qo,t),this.capture("$create_alias",{alias:t,distinct_id:n})):(Ae.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var n=Ce({},this.config);if(Yt(t)){var r,l,d,p,c,h,v,S,f,x,E;Ft(this.config,By(t));var T=this.yn();(r=this.persistence)==null||r.update_config(this.config,n,T),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Ef(Ce({},this.config,{persistence:"sessionStorage"}),T,!1);var C=this.pn(this.config.debug);Hi(C)&&(this.config.debug=C),Hi(this.config.debug)&&(this.config.debug?(Et.DEBUG=!0,Ut.N()&&Ut.A("ph_debug",!0),Ae.info("set_config",{config:t,oldConfig:n,newConfig:Ce({},this.config)})):(Et.DEBUG=!1,Ut.N()&&Ut.D("ph_debug"))),(l=this.exceptionObserver)==null||l.onConfigChange(),(d=this.exceptions)==null||d.onConfigChange(),(p=this.sessionRecording)==null||p.startIfEnabledOrStop(),(c=this.tracingHeaders)==null||c.startIfEnabledOrStop(),(h=this.autocapture)==null||h.startIfEnabled(),(v=this.heatmaps)==null||v.startIfEnabled(),(S=this.exceptionObserver)==null||S.startIfEnabledOrStop(),(f=this.deadClicksAutocapture)==null||f.startIfEnabledOrStop(),(x=this.surveys)==null||x.loadIfEnabled(),this.jn(),(E=this.externalIntegrations)==null||E.startIfEnabledOrStop()}}_overrideSDKInfo(t,n){Et.LIB_NAME=t,Et.LIB_VERSION=n}startSessionRecording(t){var n,r,l,d,p,c=t===!0,h={sampling:c||!(t==null||!t.sampling),linked_flag:c||!(t==null||!t.linked_flag),url_trigger:c||!(t==null||!t.url_trigger),event_trigger:c||!(t==null||!t.event_trigger)};Object.values(h).some(Boolean)&&((n=this.sessionManager)==null||n.checkAndGetSessionAndWindowId(),h.sampling&&((r=this.sessionRecording)==null||r.overrideSampling()),h.linked_flag&&((l=this.sessionRecording)==null||l.overrideLinkedFlag()),h.url_trigger&&((d=this.sessionRecording)==null||d.overrideTrigger("url")),h.event_trigger&&((p=this.sessionRecording)==null||p.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"),l=this.exceptions.buildProperties(t,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(Ce({},l,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:Ti.Bn}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:Ca;return n!==Ca&&(n=Ca+"."+n),n}_isIdentified(){var t,n;return((t=this.persistence)==null?void 0:t.get_property(ki))===wr||((n=this.sessionPersistence)==null?void 0:n.get_property(ki))===wr}An(){var t,n;return!(this.config.person_profiles==="never"||this.config.person_profiles===Ep&&!this._isIdentified()&&Kn(this.getGroups())&&((t=this.persistence)==null||(t=t.props)==null||!t[Qo])&&((n=this.persistence)==null||(n=n.props)==null||!n[Cu]))}Rn(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.An()||this.$n("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.$n("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}$n(t){return this.config.person_profiles==="never"?(Ae.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Ln(Cu,!0),!0)}yn(){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!==jr)}jn(){var t,n,r,l,d=this.yn();return((t=this.persistence)==null?void 0:t.yr)!==d&&((r=this.persistence)==null||r.set_disabled(d)),((n=this.sessionPersistence)==null?void 0:n.yr)!==d&&((l=this.sessionPersistence)==null||l.set_disabled(d)),d}opt_in_capturing(t){var n;if(this.config.cookieless_mode!==yn){if(this.ln()){var r,l,d,p,c;this.reset(!0),(r=this.sessionManager)==null||r.destroy(),(l=this.pageViewManager)==null||l.destroy(),this.sessionManager=new jy(this),this.pageViewManager=new Sy(this),this.persistence&&(this.sessionPropsManager=new My(this,this.sessionManager,this.persistence));var h,v=(d=(p=this.config.__extensionClasses)==null?void 0:p.sessionRecording)!==null&&d!==void 0?d:(c=Ti.__defaultExtensionClasses)==null?void 0:c.sessionRecording;v&&(this.sessionRecording=this.an(this.sessionRecording,new v(this)),this.tn&&((h=this.sessionRecording)==null||h.onRemoteConfig==null||h.onRemoteConfig(this.tn)))}var S,f;this.consent.optInOut(!0),this.jn(),this.In(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),this.config.cookieless_mode==jr&&((S=this.surveys)==null||S.loadIfEnabled()),(Te(t==null?void 0:t.captureEventName)||t!=null&&t.captureEventName)&&this.capture((f=t==null?void 0:t.captureEventName)!==null&&f!==void 0?f:"$opt_in",t==null?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Tn()}else Ae.warn(Ly)}opt_out_capturing(){var t,n,r;this.config.cookieless_mode!==yn?(this.config.cookieless_mode===jr&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.jn(),this.config.cookieless_mode===jr&&(this.register({distinct_id:qc,$device_id:null}),(t=this.sessionRecording)==null||t.stopRecording(),this.sessionRecording=void 0,(n=this.sessionManager)==null||n.destroy(),(r=this.pageViewManager)==null||r.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.Tn(),this.In())):Ae.warn(Ly)}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===yn||(this.config.cookieless_mode===jr?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.jn()}_is_bot(){return Ws?cS(Ws,this.config.custom_blocked_useragents):void 0}Tn(){De&&(De.visibilityState==="visible"?this.dn||(this.dn=!0,this.capture(xa,{title:De.title},{send_instantly:!0}),this.cn&&(De.removeEventListener(Eu,this.cn),this.cn=null)):this.cn||(this.cn=this.Tn.bind(this),es(De,Eu,this.cn)))}debug(t){t===!1?(ce==null||ce.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(ce==null||ce.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}))}Ur(){var t=this.gn||{};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?(Ae.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,l,d,p){var c=r in n&&!et(n[r]),h=l in n&&!et(n[l]);return c?n[r]:!!h&&(p&&p.warn("Config field '"+l+"' is deprecated. Please use '"+r+"' instead. The old field will be removed in a future major version."),n[l])})(t,"advanced_disable_flags","advanced_disable_decide",0,Ae)}Rt(t){var n;if(et(this.config.before_send))return t;var r=Object.keys((n=t.properties)!==null&&n!==void 0?n:{}).filter(ST),l=Ze(this.config.before_send)?this.config.before_send:[this.config.before_send],d=t;for(var p of l){if(d=p(d),et(d)){var c="Event '"+t.event+"' was rejected in beforeSend function";return bT(t.event)?Ae.warn(c+". This can cause unexpected behavior."):Ae.info(c),null}d.properties&&!Kn(d.properties)||Ae.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}for(var h of r)if(d.properties&&et(d.properties[h]))return Ae.warn("Event '"+t.event+"' had its '"+h+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return d}getPageViewId(){var t;return(t=this.pageViewManager.ir)==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)})}pn(t){var n=Hi(t)&&!t,r=Ut.N()&&Ut.q("ph_debug")==="true";return!n&&(!!r||t)}}Ti.__defaultExtensionClasses={},Ti.Bn=(()=>{var s=()=>{};return{trace:s,debug:s,info:s,warn:s,error:s,fatal:s}})(),(function(s,t){for(var n=0;t.length>n;n++)s.prototype[t[n]]=c5(s.prototype[t[n]])})(Ti,["identify"]);class Hy{constructor(t){this.disabled=t===!1;var n=Yt(t)?t:{};this.thresholdPx=n.threshold_px||30,this.timeoutMs=n.timeout_ms||1e3,this.clickCount=n.click_count||3,this.clicks=[]}isRageClick(t,n,r){if(this.disabled)return!1;var l=this.clicks[this.clicks.length-1];if(l&&Math.abs(t-l.x)+Math.abs(n-l.y)<this.thresholdPx&&this.timeoutMs>r-l.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 Lf="$copy_autocapture",Of=Jt("[AutoCapture]");function Bf(s,t){return t.length>s?t.slice(0,s)+"...":t}function fA(s){if(s.previousElementSibling)return s.previousElementSibling;var t=s;do t=t.previousSibling;while(t&&!er(t));return t}function pA(s,t){var n,r,l=t.e,d=t.maskAllElementAttributes,p=t.maskAllText,c=t.elementAttributeIgnoreList,h=t.elementsChainAsString,v=t.disableCaptureUrlHashes;if(!er(s))return{props:{}};for(var S=[s],f=new Set([s]),x=s;x.parentNode&&!pi(x,"body")&&Lb>S.length;)if(Nb(x.parentNode)){var E=x.parentNode.host;if(f.has(E))break;f.add(E),S.push(E),x=E}else{if(!er(x.parentNode)||f.has(x.parentNode))break;f.add(x.parentNode),S.push(x.parentNode),x=x.parentNode}var T,C,y=[],b={},m=!1,g=!1;if(zt(S,(A=>{var D=Tp(A);if(pi(A,"a")){var I=A.getAttribute("href");m=!!(D&&I&&ol(I))&&(v?Qn(I):I)}Ge(Au(A),"ph-no-capture")&&(g=!0),y.push((function(G,U,X,se,F){F===void 0&&(F=!1);var Q=G.tagName.toLowerCase(),J={tag_name:Q};dv.indexOf(Q)>-1&&!X&&(J.$el_text=Q.toLowerCase()==="a"||Q.toLowerCase()==="button"?Bf(1024,_y(G)):Bf(1024,yl(G)));var O=Au(G);O.length>0&&(J.classes=O.filter((function(W){return W!==""}))),zt(G.attributes,(function(W){var Z;if((!zb(G)||["name","id","class","aria-label"].indexOf(W.name)!==-1)&&(se==null||!se.includes(W.name))&&!U&&ol(W.value)&&(!It(Z=W.name)||Z.substring(0,10)!=="_ngcontent"&&Z.substring(0,7)!=="_nghost")){var ue=W.value;W.name==="class"&&(ue=hv(ue).join(" ")),J["attr__"+W.name]=Bf(1024,W.name==="href"&&F?Qn(ue):ue)}}));for(var B=1,N=1,z=G;z=fA(z);)B++,z.tagName===G.tagName&&N++;return J.nth_child=B,J.nth_of_type=N,J})(A,d,p,c,v));var q=(function(G){if(!Tp(G))return{};var U={};return zt(G.attributes,(function(X){if(X.name&&X.name.indexOf("data-ph-capture-attribute")===0){var se=X.name.replace("data-ph-capture-attribute-",""),F=X.value;se&&F&&ol(F)&&(U[se]=F)}})),U})(A);Ft(b,q)})),g)return{props:{},explicitNoCapture:g};if(p||(y[0].$el_text=pi(s,"a")||pi(s,"button")?_y(s):yl(s)),m){var k,M;y[0].attr__href=m;var R=(k=Ru(m))==null?void 0:k.host,j=ce==null||(M=ce.location)==null?void 0:M.host;R&&j&&R!==j&&(T=m)}return{props:Ft({$event_type:l.type,$ce_version:1},h?{}:{$elements:y},{$elements_chain:(C=y,(function(A){return A.map((D=>{var I,q,G="";if(D.tag_name&&(G+=D.tag_name),D.attr_class)for(var U of(D.attr_class.sort(),D.attr_class))G+="."+U.replace(/"/g,"");var X=Ce({},D.text?{text:D.text}:{},{"nth-child":(I=D.nth_child)!==null&&I!==void 0?I:0,"nth-of-type":(q=D.nth_of_type)!==null&&q!==void 0?q:0},D.href?{href:D.href}:{},D.attr_id?{attr_id:D.attr_id}:{},D.attributes),se={};return au(X).sort(((F,Q)=>F[0].localeCompare(Q[0]))).forEach((F=>{var Q=F[1];return se[yy(F[0].toString())]=yy(Q.toString())})),(G+=":")+au(se).map((F=>F[0]+'="'+F[1]+'"')).join("")})).join(";")})((function(A){return A.map((D=>{var I,q,G={text:(I=D.$el_text)==null?void 0:I.slice(0,400),tag_name:D.tag_name,href:(q=D.attr__href)==null?void 0:q.slice(0,2048),attr_class:A5(D),attr_id:D.attr__id,nth_child:D.nth_child,nth_of_type:D.nth_of_type,attributes:{}};return au(D).filter((U=>U[0].indexOf("attr__")===0)).forEach((U=>G.attributes[U[0]]=U[1])),G}))})(C)))},(n=y[0])!=null&&n.$el_text?{$el_text:(r=y[0])==null?void 0:r.$el_text}:{},T&&l.type==="click"?{$external_click_url:T}:{},b)}}var Ko=Jt("[ExceptionAutocapture]"),Iy=()=>{},vA=Jt("[TracingHeaders]"),kr=Jt("[Web Vitals]"),zy=9e5,$y="disabled",Py="lazy_loading",Xo="awaiting_config",Jc="missing_config";Jt("[SessionRecording]"),Jt("[SessionRecording]");var Op="[SessionRecording]",pn=Jt(Op),mA=Jt("[Heatmaps]");function Hf(s){return Yt(s)&&"clientX"in s&&"clientY"in s&&Os(s.clientX)&&Os(s.clientY)}var If=Jt("[Product Tours]"),zf=s=>{var t;return!s.config.disable_product_tours&&!((t=s.persistence)==null||!t.get_property(ov))},gA=["$set_once","$set"],qi=Jt("[SiteApps]"),Uy="Error while initializing PostHog app with config id ";function Sa(s,t,n){if(et(s))return!1;switch(n){case"exact":return s===t;case"contains":var r=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(s);case"regex":try{return new RegExp(t).test(s)}catch{return!1}default:return!1}}class _A{constructor(t){this.Hn=new mv,this.Un=(n,r)=>this.zn(n,r)&&this.Vn(n,r)&&this.Wn(n,r)&&this.Zn(n,r),this.zn=(n,r)=>r==null||!r.event||(n==null?void 0:n.event)===(r==null?void 0:r.event),this._instance=t,this.Gn=new Set,this.Qn=new Set}init(){var t,n;Te((t=this._instance)==null?void 0:t._addCaptureHook)||(n=this._instance)==null||n._addCaptureHook(((r,l)=>{this.on(r,l)}))}register(t){var n,r;if(!Te((n=this._instance)==null?void 0:n._addCaptureHook)&&(t.forEach((p=>{var c,h;(c=this.Qn)==null||c.add(p),(h=p.steps)==null||h.forEach((v=>{var S;(S=this.Gn)==null||S.add((v==null?void 0:v.event)||"")}))})),(r=this._instance)!=null&&r.autocapture)){var l,d=new Set;t.forEach((p=>{var c;(c=p.steps)==null||c.forEach((h=>{h!=null&&h.selector&&d.add(h==null?void 0:h.selector)}))})),(l=this._instance)==null||l.autocapture.setElementSelectors(d)}}on(t,n){var r;n!=null&&t.length!=0&&(this.Gn.has(t)||this.Gn.has(n.event))&&this.Qn&&((r=this.Qn)==null?void 0:r.size)>0&&this.Qn.forEach((l=>{this.Jn(n,l)&&this.Hn.emit("actionCaptured",l.name)}))}Kn(t){this.onAction("actionCaptured",(n=>t(n)))}Jn(t,n){if((n==null?void 0:n.steps)==null)return!1;for(var r of n.steps)if(this.Un(t,r))return!0;return!1}onAction(t,n){return this.Hn.on(t,n)}Vn(t,n){if(n!=null&&n.url){var r,l=t==null||(r=t.properties)==null?void 0:r.$current_url;if(!l||typeof l!="string"||!Sa(l,n.url,n.url_matching||"contains"))return!1}return!0}Wn(t,n){return!!this.Yn(t,n)&&!!this.Xn(t,n)&&!!this.ts(t,n)}Yn(t,n){var r;if(n==null||!n.href)return!0;var l=this.es(t);if(l.length>0)return l.some((c=>Sa(c.href,n.href,n.href_matching||"exact")));var d,p=(t==null||(r=t.properties)==null?void 0:r.$elements_chain)||"";return!!p&&Sa((d=p.match(/(?::|")href="(.*?)"/))?d[1]:"",n.href,n.href_matching||"exact")}Xn(t,n){var r;if(n==null||!n.text)return!0;var l=this.es(t);if(l.length>0)return l.some((v=>Sa(v.text,n.text,n.text_matching||"exact")||Sa(v.$el_text,n.text,n.text_matching||"exact")));var d,p,c,h=(t==null||(r=t.properties)==null?void 0:r.$elements_chain)||"";return!!h&&(d=(function(v){for(var S,f=[],x=/(?::|")text="(.*?)"/g;!et(S=x.exec(v));)f.includes(S[1])||f.push(S[1]);return f})(h),p=n.text,c=n.text_matching||"exact",d.some((v=>Sa(v,p,c))))}ts(t,n){var r,l;if(n==null||!n.selector)return!0;var d=t==null||(r=t.properties)==null?void 0:r.$element_selectors;if(d!=null&&d.includes(n.selector))return!0;var p=(t==null||(l=t.properties)==null?void 0:l.$elements_chain)||"";if(n.selector_regex&&p)try{return new RegExp(n.selector_regex).test(p)}catch{return!1}return!1}es(t){var n;return(t==null||(n=t.properties)==null?void 0:n.$elements)==null?[]:t==null?void 0:t.properties.$elements}Zn(t,n){return n==null||!n.properties||n.properties.length===0||dS(n.properties.reduce(((r,l)=>{var d=Ze(l.value)?l.value.map(String):l.value!=null?[String(l.value)]:[];return r[l.key]={values:d,operator:l.operator||"exact"},r}),{}),t==null?void 0:t.properties)}}class yA{constructor(t){var n;this.rs=[],this._instance=t,this.ns=new Map,this.ss=new Map,this.os=new Map,(n=this._instance)==null||n.onSessionId==null||n.onSessionId((r=>this.ls(r)))}us(t,n){return!!t&&dS(t.propertyFilters,n==null?void 0:n.properties)}hs(t,n){var r=new Map;return t.forEach((l=>{var d;(d=l.conditions)==null||(d=d[n])==null||(d=d.values)==null||d.forEach((p=>{if(p!=null&&p.name){var c=r.get(p.name)||[];c.push(l.id),r.set(p.name,c)}}))})),r}ds(t,n,r){var l=(r===qo.Activation?this.ns:this.ss).get(t),d=[];return this.cs((p=>{d=p.filter((c=>l==null?void 0:l.includes(c.id)))})),d.filter((p=>{var c,h=(c=p.conditions)==null||(c=c[r])==null||(c=c.values)==null?void 0:c.find((v=>v.name===t));return this.us(h,n)}))}register(t){var n;Te((n=this._instance)==null?void 0:n._addCaptureHook)||(this.vs(t),this.fs(t))}fs(t){var n=t.filter((r=>{var l,d;return((l=r.conditions)==null?void 0:l.actions)&&((d=r.conditions)==null||(d=d.actions)==null||(d=d.values)==null?void 0:d.length)>0}));n.length!==0&&(this.ps==null&&(this.ps=new _A(this._instance),this.ps.init(),this.ps.Kn((r=>{this.onAction(r)}))),n.forEach((r=>{var l,d,p,c,h;r.conditions&&(l=r.conditions)!=null&&l.actions&&(d=r.conditions)!=null&&(d=d.actions)!=null&&d.values&&((p=r.conditions)==null||(p=p.actions)==null||(p=p.values)==null?void 0:p.length)>0&&((c=this.ps)==null||c.register(r.conditions.actions.values),(h=r.conditions)==null||(h=h.actions)==null||(h=h.values)==null||h.forEach((v=>{if(v&&v.name){var S=this.os.get(v.name);S&&S.push(r.id),this.os.set(v.name,S||[r.id])}})))})))}vs(t){var n,r=t.filter((d=>{var p,c;return((p=d.conditions)==null?void 0:p.events)&&((c=d.conditions)==null||(c=c.events)==null||(c=c.values)==null?void 0:c.length)>0})),l=t.filter((d=>{var p,c;return((p=d.conditions)==null?void 0:p.cancelEvents)&&((c=d.conditions)==null||(c=c.cancelEvents)==null||(c=c.values)==null?void 0:c.length)>0}));r.length===0&&l.length===0||((n=this._instance)==null||n._addCaptureHook(((d,p)=>{this.onEvent(d,p)})),this.ns=this.hs(t,qo.Activation),this.ss=this.hs(t,qo.Cancellation))}onEvent(t,n){var r,l,d=this.gs(),p=(n==null||(r=n.properties)==null?void 0:r.$survey_id)||(n==null||(l=n.properties)==null?void 0:l.$product_tour_id);if(p&&this.getActivatedIds().includes(p)){var c=this.ys(t,p);if(c==="consume")return d.info("event consumed activated item, removing it",{event:t,itemId:p}),void this.bs([p]);if(c==="persist")return d.info("shown item promoted to persisted activation",{event:t,itemId:p}),void this._s(p)}if(this.ss.has(t)){var h=this.ds(t,n,qo.Cancellation);h.length>0&&(d.info("cancel event matched, cancelling items",{event:t,itemsToCancel:h.map((S=>S.id))}),this.bs(h.map((S=>S.id))),h.forEach((S=>this.ws(S.id))))}if(this.ns.has(t)){d.info("event name matched",{event:t,eventPayload:n,items:this.ns.get(t)});var v=this.ds(t,n,qo.Activation);this.xs(v.map((S=>S.id)))}}onAction(t){this.os.has(t)&&this.xs(this.os.get(t)||[])}xs(t){t.length!==0&&(this.rs=[...new Set([...this.rs,...t])],this.gs().info("updating activated items",{activatedItems:this.getActivatedIds()}))}_s(t){this.rs=this.rs.filter((r=>r!==t));var n=this.ks();n.includes(t)||(this.Ss([...n,t]),this.Cs())}bs(t){var n=new Set(t);this.rs=this.rs.filter((d=>!n.has(d)));var r=this.Ms(),l=r.filter((d=>!n.has(d)));l.length!==r.length&&(this.Ss(l),l.length===0&&this.Is())}Ms(){var t,n=this.Ts();return((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[n])||[]}ks(){var t,n,r=this.Ms();if(r.length===0)return[];var l=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[this.Es()],d=(n=this._instance)==null||n.get_session_id==null?void 0:n.get_session_id();return d&&l===d?r:[]}Cs(){var t,n=(t=this._instance)==null||t.get_session_id==null?void 0:t.get_session_id();n&&this.Rs(n)}Is(){this.Ps()}ls(t){var n,r=(n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[this.Es()];r&&r!==t&&(this.Ms().length>0&&this.Ss([]),this.Is())}getActivatedIds(){return[...new Set([...this.ks(),...this.rs])].filter((t=>!this.Os(t)))}reset(){this.rs=[],this.Ms().length>0&&this.Ss([]),this.Is()}getEventToItemsMap(){return this.ns}Fs(){return this.ps}}class bA extends yA{constructor(t){super(t)}Ts(){return _p}Es(){return ru}As(){return Sn.SHOWN}cs(t){var n;(n=this._instance)==null||n.getSurveys(t)}ws(t){var n;(n=this._instance)==null||n.cancelPendingSurvey(t)}gs(){return jt}Ss(t){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[_p]:t})}Rs(t){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[ru]:t})}Ps(){var t;(t=this._instance)==null||(t=t.persistence)==null||t.unregister(ru)}Os(){return!1}ys(t,n){var r;this.cs((d=>{r=d.find((p=>p.id===n))}));var l=!r||(function(d){var p;return fS(d)&&!((p=d.conditions)==null||(p=p.events)==null||!p.repeatedActivation)||d.schedule==="always"})(r);return l?t===Sn.SHOWN?"consume":"ignore":t===Sn.SHOWN?"persist":t===Sn.DISMISSED||t===Sn.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var Zc="SDK is not enabled or survey functionality is not yet loaded",Fy="Disabled. Not loading surveys.",SA=ce!=null&&ce.location?Mu(ce.location.hash,"__posthog")||Mu(location.hash,"state"):null,qy="_postHogToolbarParams",Wy=Jt("[Toolbar]"),bs=Jt("[FeatureFlags]"),Tr=Jt("[FeatureFlags]",{debugEnabled:!0}),$f=`" failed. Feature flags didn't load in time.`,Gy=s=>{for(var t={},n=0;s.length>n;n++)t[s[n]]=!0;return t},Vy=s=>{var t={};for(var n of au(s||{})){var r=n[1];r&&(t[n[0]]=r)}return t},Wi=Jt("[Error tracking]"),Yy="Refusing to render web experiment since the viewer is a likely bot",wA={icontains:(s,t)=>t.toLowerCase().indexOf(s.toLowerCase())>-1,not_icontains:(s,t)=>t.toLowerCase().indexOf(s.toLowerCase())===-1,regex:(s,t)=>Nu(t,s),not_regex:(s,t)=>!Nu(t,s),exact:(s,t)=>t===s,is_not:(s,t)=>t!==s};class Is{get Te(){return this._instance.config}constructor(t){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(r){r===void 0&&(r=!1),n.getWebExperiments((l=>{Is.$s("retrieved web experiments from the server"),n.Ls=new Map,l.forEach((d=>{if(d.feature_flag_key){var p;n.Ls&&(Is.$s("setting flag key ",d.feature_flag_key," to web experiment ",d),(p=n.Ls)==null||p.set(d.feature_flag_key,d));var c=n._instance.getFeatureFlag(d.feature_flag_key);It(c)&&d.variants[c]&&n.Ds(d.name,c,d.variants[c].transforms)}else if(d.variants)for(var h in d.variants){var v=d.variants[h];Is.Ns(v,n._instance)&&n.Ds(d.name,h,v.transforms)}}))}),r)},this._instance=t,this._instance.onFeatureFlags((r=>{this.onFeatureFlags(r)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())Is.$s(Yy);else if(!this.Te.disable_web_experiments){if(et(this.Ls))return this.Ls=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Is.$s("applying feature flags",t),t.forEach((n=>{var r;if(this.Ls&&(r=this.Ls)!=null&&r.has(n)){var l,d=this._instance.getFeatureFlag(n),p=(l=this.Ls)==null?void 0:l.get(n);d&&p!=null&&p.variants[d]&&this.Ds(p.name,d,p.variants[d].transforms)}}))}}previewWebExperiment(){var t=Is.getWindowLocation();if(t!=null&&t.search){var n=Ia(t==null?void 0:t.search,"__experiment_id"),r=Ia(t==null?void 0:t.search,"__experiment_variant");n&&r&&(Is.$s("previewing web experiments "+n+" && "+r),this.getWebExperiments((l=>{this.qs(parseInt(n),r,l)}),!1,!0))}}loadIfEnabled(){this.Te.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,n,r){if(this.Te.disable_web_experiments&&!r)return t([]);var l=this._instance.get_property("$web_experiments");if(l&&!n)return t(l);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Te.token),method:"GET",timestampMode:"query",callback:d=>t(d.statusCode===200&&d.json&&d.json.experiments||[])})}qs(t,n,r){var l=r.filter((d=>d.id===t));l&&l.length>0&&(Is.$s("Previewing web experiment ["+l[0].name+"] with variant ["+n+"]"),this.Ds(l[0].name,n,l[0].variants[n].transforms))}static Ns(t,n){return!et(t.conditions)&&Is.js(t,n)&&Is.Bs(t)}static js(t,n){var r;if(et(t.conditions)||et((r=t.conditions)==null?void 0:r.url))return!0;var l=Is.getWindowLocation();if(l){var d,p,c,h=Mb(n,l.href);return(d=t.conditions)==null||!d.url||wA[(p=(c=t.conditions)==null?void 0:c.urlMatchType)!==null&&p!==void 0?p:"icontains"](t.conditions.url,h)}return!1}static getWindowLocation(){return ce==null?void 0:ce.location}static Bs(t){var n;if(et(t.conditions)||et((n=t.conditions)==null?void 0:n.utm))return!0;var r=Wb();if(r.utm_source){var l,d,p,c,h,v,S,f,x=(l=t.conditions)==null||(l=l.utm)==null||!l.utm_campaign||((d=t.conditions)==null||(d=d.utm)==null?void 0:d.utm_campaign)==r.utm_campaign,E=(p=t.conditions)==null||(p=p.utm)==null||!p.utm_source||((c=t.conditions)==null||(c=c.utm)==null?void 0:c.utm_source)==r.utm_source,T=(h=t.conditions)==null||(h=h.utm)==null||!h.utm_medium||((v=t.conditions)==null||(v=v.utm)==null?void 0:v.utm_medium)==r.utm_medium,C=(S=t.conditions)==null||(S=S.utm)==null||!S.utm_term||((f=t.conditions)==null||(f=f.utm)==null?void 0:f.utm_term)==r.utm_term;return x&&T&&C&&E}return!1}static $s(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),l=1;n>l;l++)r[l-1]=arguments[l];Ae.info("[WebExperiments] "+t,r)}Ds(t,n,r){this._is_bot()?Is.$s(Yy):n!=="control"?r.forEach((l=>{if(l.selector){var d;Is.$s("applying transform of variant "+n+" for experiment "+t+" ",l);var p=(d=document)==null?void 0:d.querySelectorAll(l.selector);p==null||p.forEach((c=>{var h=c;l.html&&(h.innerHTML=l.html),l.css&&h.setAttribute("style",l.css)}))}})):Is.$s("Control variants leave the page unmodified.")}_is_bot(){return Ws&&this._instance?cS(Ws,this.Te.custom_blocked_useragents):void 0}}var Ei=Jt("[Conversations]"),Ar="Conversations not available yet.",Ky="console",Gu={featureFlags:class{constructor(s){this.Hs=!1,this.Us=!1,this.zs=!1,this.Vs=!1,this.Ws=!1,this.Zs=!1,this.Gs=!1,this.Qs=!1,this.Js=0,this.Ks=()=>{var t=this.Ys();this.Js=0,t&&this.reloadFeatureFlags()},this._instance=s,this.featureFlagEventHandlers=[],ce&&es(ce,"online",this.Ks)}destroy(){ce==null||ce.removeEventListener("online",this.Ks)}get Te(){return this._instance.config}get mi(){return this._instance.persistence}Xs(s){return this._instance.get_property(s)}eo(){var s,t;return(s=(t=this.mi)==null?void 0:t._r(this.Te.feature_flag_cache_ttl_ms))!==null&&s!==void 0&&s}ro(){return!!this.eo()&&(this.Qs||this.zs||(this.Qs=!0,bs.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}io(){var s,t=(s=this.Te.evaluation_contexts)!==null&&s!==void 0?s:this.Te.evaluation_environments;return!this.Te.evaluation_environments||this.Te.evaluation_contexts||this.Gs||(bs.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Gs=!0),t!=null&&t.length?t.filter((n=>{var r=n&&typeof n=="string"&&n.trim().length>0;return r||bs.error("Invalid evaluation context found:",n,"Expected non-empty string"),r})):[]}no(){return this.io().length>0}so(){var s=this.Te.flag_keys;if(!Te(s)){if(Ze(s))return s.filter((t=>{var n=t&&typeof t=="string"&&t.trim().length>0;return n||bs.error("Invalid flag key found:",t,"Expected non-empty string"),n}));bs.error("Invalid flag_keys found:",s,"Expected array of non-empty strings")}}initialize(){var s,t,n=this._instance.config,r=(s=(t=n.bootstrap)==null?void 0:t.featureFlags)!==null&&s!==void 0?s:{};if(Object.keys(r).length){var l,d,p=(l=(d=n.bootstrap)==null?void 0:d.featureFlagPayloads)!==null&&l!==void 0?l:{},c=Object.keys(r).filter((v=>!!r[v])).reduce(((v,S)=>(v[S]=r[S]||!1,v)),{}),h=Object.keys(p).filter((v=>c[v])).reduce(((v,S)=>(p[S]&&(v[S]=p[S]),v)),{});this.receivedFeatureFlags({featureFlags:c,featureFlagPayloads:h})}}updateFlags(s,t,n){var r,l,d=n!=null&&n.merge&&(r=this.Xs(Dr))!==null&&r!==void 0?r:{},p=n!=null&&n.merge&&(l=this.Xs(nu))!==null&&l!==void 0?l:{},c=Ce({},d,s),h=Ce({},p,t),v={};for(var S of Object.entries(c)){var f=S[0],x=S[1];v[f]={key:f,enabled:G0(x),variant:V0(x),reason:void 0,metadata:Te(h==null?void 0:h[f])?void 0:{id:0,version:void 0,description:void 0,payload:h[f]}}}this.receivedFeatureFlags({flags:v})}get hasLoadedFlags(){return this.Us}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var s=this.Xs(vp),t=this.Xs(mn),n=this.Xs(wa);if(!n&&!t)return s||{};var r=Ft({},s||{}),l=[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])];for(var d of l){var p,c,h=r[d],v=t==null?void 0:t[d],S=Te(v)?(p=h==null?void 0:h.enabled)!==null&&p!==void 0&&p:!!v,f=Te(v)?h.variant:typeof v=="string"?v:void 0,x=n==null?void 0:n[d],E=Ce({},h,{enabled:S,variant:S?f??(h==null?void 0:h.variant):void 0});S!==(h==null?void 0:h.enabled)&&(E.original_enabled=h==null?void 0:h.enabled),f!==(h==null?void 0:h.variant)&&(E.original_variant=h==null?void 0:h.variant),x&&(E.metadata=Ce({},h==null?void 0:h.metadata,{payload:x,original_payload:h==null||(c=h.metadata)==null?void 0:c.payload})),r[d]=E}return this.Hs||(bs.warn(" Overriding feature flag details!",{flagDetails:s,overriddenPayloads:n,finalDetails:r}),this.Hs=!0),r}getAllFeatureFlags(){var s=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(s).map((n=>{var r=s[n];return{key:n,enabled:G0(r),variant:V0(r),payload:W0(t[n])}}))}getFlagVariants(){var s=this.Xs(Dr),t=this.Xs(mn);if(!t)return s||{};for(var n=Ft({},s),r=Object.keys(t),l=0;r.length>l;l++)n[r[l]]=t[r[l]];return this.Hs||(bs.warn(" Overriding feature flags!",{enabledFlags:s,overriddenFlags:t,finalFlags:n}),this.Hs=!0),n}getFlagPayloads(){var s=this.Xs(nu),t=this.Xs(wa);if(!t)return s||{};for(var n=Ft({},s||{}),r=Object.keys(t),l=0;r.length>l;l++)n[r[l]]=t[r[l]];return this.Hs||(bs.warn(" Overriding feature flag payloads!",{flagPayloads:s,overriddenPayloads:t,finalPayloads:n}),this.Hs=!0),n}reloadFeatureFlags(){this.Vs||this.Te.advanced_disable_feature_flags||this.Ys()||this.oo||(this._instance.en.emit("featureFlagsReloading",!0),this.oo=setTimeout((()=>{this.ao()}),5))}lo(){clearTimeout(this.oo),this.oo=void 0}ensureFlagsLoaded(){this.Us||this.zs||this.oo||this.reloadFeatureFlags()}setAnonymousDistinctId(s){this.$anon_distinct_id=s}setReloadingPaused(s){this.Vs=s}ao(s){var t;if(this.lo(),!this._instance.Ur()&&!this.Ys())if(this.zs)this.Ws=!0;else{var n=this.Te.token,r=this.Xs(gl),l={token:n,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:Ce({},((t=this.mi)==null?void 0:t.get_initial_props())||{},this.Xs(Rr)||{},{$lib:Et.LIB_NAME,$lib_version:Et.LIB_VERSION}),group_properties:this.Xs(Mr),timezone:Jb()};Gs(r)||Te(r)||(l.$device_id=r),(s!=null&&s.disableFlags||this.Te.advanced_disable_feature_flags)&&(l.disable_flags=!0),this.no()&&(l.evaluation_contexts=this.io());var d=this.so();Te(d)||(l.flag_keys=d);var p=!!this.Te.advanced_only_evaluate_survey_feature_flags,c=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Te.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.zs=!0,this._instance._send_request({method:"POST",url:c,data:l,compression:this.Te.disable_compression?void 0:qs.Base64,timestampMode:"body",timeout:this.Te.feature_flag_request_timeout_ms,callback:h=>{var v,S,f,x=!0;if(this.uo(h.statusCode),h.statusCode===200&&(this.Ws||(this.$anon_distinct_id=void 0),x=!1),this.zs=!1,!l.disable_flags||this.Ws){this.Zs=!x;var E=[];h.error?h.error instanceof Error?E.push(h.error.name==="AbortError"?"timeout":"connection_error"):E.push("unknown_error"):h.statusCode!==200&&E.push("api_error_"+h.statusCode),(v=h.json)!=null&&v.errorsWhileComputingFlags&&E.push("errors_while_computing_flags");var T,C=!((S=h.json)==null||(S=S.quotaLimited)==null||!S.includes("feature_flags"));C&&E.push("quota_limited"),(f=this.mi)==null||f.register({[bp]:E}),C?bs.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):(l.disable_flags||this.receivedFeatureFlags((T=h.json)!==null&&T!==void 0?T:{},x,{partialResponse:p}),this.Ws&&(this.Ws=!1,this.ao()))}}})}}Ys(){return Fb(this.Js,3)}uo(s){this.Js=qb(s,this.Js,3,(()=>bs.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(s,t){var n;if(t===void 0&&(t={}),!t.fresh||this.Zs)if(this.Us||this.getFlags()&&this.getFlags().length>0){if(!this.ro()){var r=this.getFeatureFlagResult(s,t);return(n=r==null?void 0:r.variant)!==null&&n!==void 0?n:r==null?void 0:r.enabled}}else bs.warn('getFeatureFlag for key "'+s+$f)}getFeatureFlagDetails(s){return this.getFlagsWithDetails()[s]}getFeatureFlagPayload(s){var t=this.getFeatureFlagResult(s,{send_event:!1});return t==null?void 0:t.payload}getFeatureFlagResult(s,t){if(t===void 0&&(t={}),!t.fresh||this.Zs)if(this.Us||this.getFlags()&&this.getFlags().length>0){if(!this.ro()){var n=this.getFlagVariants(),r=s in n,l=n[s],d=this.getFlagPayloads()[s],p=String(l),c=this.Xs(mp)||void 0,h=this.Xs(_l)||void 0,v=this.Xs(al)||{};if(this.Te.advanced_feature_flags_dedup_per_session){var S,f=this._instance.get_session_id(),x=this.Xs(yp);f&&f!==x&&(v={},(S=this.mi)==null||S.register({[al]:v,[yp]:f}))}if((t.send_event||!("send_event"in t))&&(!(s in v)||!v[s].includes(p))){var E,T,C,y,b,m,g,k,M,R,j;Ze(v[s])?v[s].push(p):v[s]=[p],(E=this.mi)==null||E.register({[al]:v});var A=this.getFeatureFlagDetails(s),D=[...(T=this.Xs(bp))!==null&&T!==void 0?T:[]];Te(l)&&D.push("flag_missing");var I={$feature_flag:s,$feature_flag_response:l,$feature_flag_payload:d||null,$feature_flag_request_id:c,$feature_flag_evaluated_at:h,$feature_flag_bootstrapped_response:((C=this.Te.bootstrap)==null||(C=C.featureFlags)==null?void 0:C[s])||null,$feature_flag_bootstrapped_payload:((y=this.Te.bootstrap)==null||(y=y.featureFlagPayloads)==null?void 0:y[s])||null,$used_bootstrap_value:!this.Zs};Te(A==null||(b=A.metadata)==null?void 0:b.has_experiment)||(I.$feature_flag_has_experiment=A.metadata.has_experiment),Te(A==null||(m=A.metadata)==null?void 0:m.version)||(I.$feature_flag_version=A.metadata.version);var q,G=(g=A==null||(k=A.reason)==null?void 0:k.description)!==null&&g!==void 0?g:A==null||(M=A.reason)==null?void 0:M.code;G&&(I.$feature_flag_reason=G),A!=null&&(R=A.metadata)!=null&&R.id&&(I.$feature_flag_id=A.metadata.id),Te(A==null?void 0:A.original_variant)&&Te(A==null?void 0:A.original_enabled)||(I.$feature_flag_original_response=Te(A.original_variant)?A.original_enabled:A.original_variant),A!=null&&(j=A.metadata)!=null&&j.original_payload&&(I.$feature_flag_original_payload=A==null||(q=A.metadata)==null?void 0:q.original_payload),D.length&&(I.$feature_flag_error=D.join(",")),this._instance.capture("$feature_flag_called",I)}if(r)return{key:s,enabled:!!l,variant:typeof l=="string"?l:void 0,payload:W0(d)}}}else bs.warn('getFeatureFlagResult for key "'+s+$f)}getRemoteConfigPayload(s,t){var n=this.Te.token,r={distinct_id:this._instance.get_distinct_id(),token:n,person_properties:{$lib:Et.LIB_NAME,$lib_version:Et.LIB_VERSION}};this.no()&&(r.evaluation_contexts=this.io());var l=this.so();Te(l)||(r.flag_keys=l),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:r,compression:this.Te.disable_compression?void 0:qs.Base64,timestampMode:"body",timeout:this.Te.feature_flag_request_timeout_ms,callback(d){var p,c=(p=d.json)==null?void 0:p.featureFlagPayloads;t((c==null?void 0:c[s])||void 0)}})}isFeatureEnabled(s,t){if(t===void 0&&(t={}),t.fresh&&!this.Zs)return t.defaultValue;if(!(this.Us||this.getFlags()&&this.getFlags().length>0))return bs.warn('isFeatureEnabled for key "'+s+$f),t.defaultValue;var n=this.getFeatureFlag(s,t);return Te(n)?t.defaultValue:!!n}addFeatureFlagsHandler(s){this.featureFlagEventHandlers.push(s)}removeFeatureFlagsHandler(s){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==s))}receivedFeatureFlags(s,t,n){if(this.mi){this.Us=!0;var r=this.getFlagVariants(),l=this.getFlagPayloads(),d=this.getFlagsWithDetails();(function(p,c,h,v,S,f){h===void 0&&(h={}),v===void 0&&(v={}),S===void 0&&(S={});var x=(A=>{var D=A.flags;return D?(A.featureFlags=Object.fromEntries(Object.keys(D).map((I=>{var q;return[I,(q=D[I].variant)!==null&&q!==void 0?q:D[I].enabled]}))),A.featureFlagPayloads=Object.fromEntries(Object.keys(D).filter((I=>D[I].enabled)).filter((I=>{var q;return(q=D[I].metadata)==null?void 0:q.payload})).map((I=>{var q;return[I,(q=D[I].metadata)==null?void 0:q.payload]})))):A.featureFlags&&bs.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),A})(p),E=x.flags,T=x.featureFlags,C=x.featureFlagPayloads;if(T){var y=p.requestId,b=p.evaluatedAt;if(Ze(T)){bs.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var m={};if(T)for(var g=0;T.length>g;g++)m[T[g]]=!0;c&&c.register({[iu]:T,[Dr]:m,[Su]:!1})}else{var k=T,M=C,R=E;if(f!=null&&f.partialResponse)k=Ce({},h,k),M=Ce({},v,M),R=Ce({},S,R);else if(p.errorsWhileComputingFlags)if(E){var j=new Set(Object.keys(E).filter((A=>{var D;return!((D=E[A])!=null&&D.failed)})));k=Ce({},h,Object.fromEntries(Object.entries(k).filter((A=>j.has(A[0]))))),M=Ce({},v,Object.fromEntries(Object.entries(M||{}).filter((A=>j.has(A[0]))))),R=Ce({},S,Object.fromEntries(Object.entries(R||{}).filter((A=>j.has(A[0])))))}else k=Ce({},h,k),M=Ce({},v,M),R=Ce({},S,R);c&&c.register(Ce({[iu]:Object.keys(Vy(k)),[Dr]:k||{},[nu]:M||{},[vp]:R||{},[Su]:p.minimalFlagCalledEvents===!0},y?{[mp]:y}:{},b?{[_l]:b}:{}))}}})(s,this.mi,r,l,d,n),t||(this.Qs=!1),this.ho(t)}}override(s,t){t===void 0&&(t=!1),bs.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:s,suppressWarning:t})}overrideFeatureFlags(s){if(!this._instance.__loaded||!this.mi)return bs.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(s===!1)return this.mi.unregister(mn),this.mi.unregister(wa),this.ho(),Tr.info("All overrides cleared");if(Ze(s)){var t=Gy(s);return this.mi.register({[mn]:t}),this.ho(),Tr.info("Flag overrides set",{flags:s})}if(s&&typeof s=="object"&&("flags"in s||"payloads"in s)){var n,r=s;if(this.Hs=!!((n=r.suppressWarning)!==null&&n!==void 0&&n),"flags"in r){if(r.flags===!1)this.mi.unregister(mn),Tr.info("Flag overrides cleared");else if(r.flags){if(Ze(r.flags)){var l=Gy(r.flags);this.mi.register({[mn]:l})}else this.mi.register({[mn]:r.flags});Tr.info("Flag overrides set",{flags:r.flags})}}return"payloads"in r&&(r.payloads===!1?(this.mi.unregister(wa),Tr.info("Payload overrides cleared")):r.payloads&&(this.mi.register({[wa]:r.payloads}),Tr.info("Payload overrides set",{payloads:r.payloads}))),void this.ho()}if(s&&typeof s=="object")return this.mi.register({[mn]:s}),this.ho(),Tr.info("Flag overrides set",{flags:s});bs.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:s})}onFeatureFlags(s){if(this.addFeatureFlagsHandler(s),this.Us){var t=this.do(),n=t.flags,r=t.flagVariants;try{s(n,r)}catch(l){bs.error("Error while running feature flags callback",l)}}return()=>this.removeFeatureFlagsHandler(s)}updateEarlyAccessFeatureEnrollment(s,t,n){var r,l=(this.Xs(tl)||[]).find((h=>h.flagKey===s)),d={["$feature_enrollment/"+s]:t},p={$feature_flag:s,$feature_enrollment:t,$set:d};l&&(p.$early_access_feature_name=l.name),n&&(p.$feature_enrollment_stage=n),this._instance.capture("$feature_enrollment_update",p),this.setPersonPropertiesForFlags(d,!1);var c=Ce({},this.getFlagVariants(),{[s]:t});(r=this.mi)==null||r.register({[iu]:Object.keys(Vy(c)),[Dr]:c}),this.ho()}getEarlyAccessFeatures(s,t,n){t===void 0&&(t=!1);var r=this.Xs(tl),l=n?"&"+n.map((d=>"stage="+d)).join("&"):"";if(r&&!t)return s(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Te.token+l),method:"GET",timestampMode:"query",callback:d=>{var p,c;if(d.json){var h=d.json.earlyAccessFeatures;return(p=this.mi)==null||p.unregister(tl),(c=this.mi)==null||c.register({[tl]:h}),s(h)}}})}do(){var s=this.getFlags(),t=this.getFlagVariants();return{flags:s.filter((n=>t[n])),flagVariants:Object.keys(t).filter((n=>t[n])).reduce(((n,r)=>(n[r]=t[r],n)),{})}}ho(s){var t=this.do(),n=t.flags,r=t.flagVariants;this.featureFlagEventHandlers.forEach((l=>{try{l(n,r,{errorsLoading:s})}catch(d){bs.error("Error while running feature flags callback",d)}}))}setPersonPropertiesForFlags(s,t){t===void 0&&(t=!0);var n=this.Xs(Rr)||{},r=(s==null?void 0:s.$set)||(s!=null&&s.$set_once?{}:s),l=s==null?void 0:s.$set_once,d={};if(l)for(var p in l)({}).hasOwnProperty.call(l,p)&&(p in n||(d[p]=l[p]));this._instance.register({[Rr]:Ce({},n,d,r)}),t&&this._instance.reloadFeatureFlags()}unsetPersonPropertiesForFlags(s,t){t===void 0&&(t=!0);var n=Ce({},this.Xs(Rr)||{});s.forEach((r=>{delete n[r]})),this._instance.register({[Rr]:n}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(s){s===void 0&&(s=!0),this._instance.unregister(Rr),s&&this._instance.reloadFeatureFlags()}setGroupPropertiesForFlags(s,t){t===void 0&&(t=!0);var n=this.Xs(Mr)||{};Object.keys(n).length!==0&&Object.keys(n).forEach((r=>{n[r]=Ce({},n[r],s[r]),delete s[r]})),this._instance.register({[Mr]:Ce({},n,s)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(s){if(s){var t=this.Xs(Mr)||{};this._instance.register({[Mr]:Ce({},t,{[s]:{}})})}else this._instance.unregister(Mr)}reset(){this.Us=!1,this.zs=!1,this.Vs=!1,this.Ws=!1,this.Zs=!1,this.$anon_distinct_id=void 0,this.lo(),this.Hs=!1,this.Js=0}}},xA={sessionRecording:class{get Te(){return this._instance.config}get mi(){return this._instance.persistence}get started(){var s;return!((s=this.co)==null||!s.isStarted)}get status(){var s,t;return this.vo===Xo||this.vo===Jc?this.vo:(s=(t=this.co)==null?void 0:t.status)!==null&&s!==void 0?s:this.vo}constructor(s){if(this._forceAllowLocalhostNetworkCapture=!1,this.vo=$y,this.fo=void 0,this._instance=s,!this._instance.sessionManager)throw pn.error("started without valid sessionManager"),new Error(Op+" started without valid sessionManager. This is a bug.");if(this.Te.cookieless_mode===yn)throw new Error(Op+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get po(){var s,t=!((s=this._instance.get_property(Lr))==null||!s.enabled),n=!this.Te.disable_session_recording,r=this.Te.disable_session_recording||this._instance.consent.isOptedOut();return ce&&t&&n&&!r}startIfEnabledOrStop(s){var t;if(!this.po||(t=this.co)==null||!t.isStarted){var n=!Te(Object.assign)&&!Te(Array.from);this.po&&n?(this.mo(s),pn.info("starting")):(this.vo=$y,this.stopRecording())}}mo(s){var t,n,r;this.po&&(this.vo!==Xo&&this.vo!==Jc&&(this.vo=Py),He!=null&&(t=He.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(n=He.__PosthogExtensions__)!=null&&n.initSessionRecording?this.yo(s):(r=He.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,this.bo,(l=>{if(l)return pn.error("could not load recorder",l);this.yo(s)})))}stopRecording(){var s,t;(s=this.fo)==null||s.call(this),this.fo=void 0,(t=this.co)==null||t.stop()}_o(){var s,t;(s=this.fo)==null||s.call(this),this.fo=void 0,(t=this.co)==null||t.discard()}wo(){var s,t;(s=this.mi)==null||s.unregister(lv),(t=this.mi)==null||t.unregister(_b)}xo(s,t){if(et(s))return null;var n,r=Os(s)?s:parseFloat(s);return typeof(n=r)!="number"||!Number.isFinite(n)||0>n||n>1?(pn.warn(t+" must be between 0 and 1. Ignoring invalid value:",s),null):r}ko(s){if(this.mi){var t,n,r=this.mi,l=()=>{var d,p=s.sessionRecording===!1?void 0:s.sessionRecording,c=this.xo((d=this.Te.session_recording)==null?void 0:d.sampleRate,"session_recording.sampleRate"),h=this.xo(p==null?void 0:p.sampleRate,"remote config sampleRate"),v=c??h;et(v)&&this.wo();var S=p==null?void 0:p.minimumDurationMilliseconds;r.register({[Lr]:Ce({cache_timestamp:Date.now(),enabled:!!p},p,{networkPayloadCapture:Ce({capturePerformance:s.capturePerformance},p==null?void 0:p.networkPayloadCapture),canvasRecording:{enabled:p==null?void 0:p.recordCanvas,fps:p==null?void 0:p.canvasFps,quality:p==null?void 0:p.canvasQuality},sampleRate:v,minimumDurationMilliseconds:Te(S)?null:S,endpoint:p==null?void 0:p.endpoint,triggerMatchType:p==null?void 0:p.triggerMatchType,masking:p==null?void 0:p.masking,urlTriggers:p==null?void 0:p.urlTriggers,version:p==null?void 0:p.version,triggerGroups:p==null?void 0:p.triggerGroups})})};l(),(t=this.fo)==null||t.call(this),this.fo=(n=this._instance.sessionManager)==null?void 0:n.onSessionId(l)}}onRemoteConfig(s){var t=s.ok?s.config:void 0;return t&&"sessionRecording"in t?t.sessionRecording===!1?(this.ko(t),void this._o()):(this.ko(t),void this.startIfEnabledOrStop()):(this.vo===Xo&&(this.vo=Jc,pn.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(s,t){var n;t===void 0&&(t="log"),(n=this.co)!=null&&n.log?this.co.log(s,t):pn.warn("log called before recorder was ready")}get bo(){var s,t,n=(s=this._instance)==null||(s=s.persistence)==null?void 0:s.get_property(Lr);return(n==null||(t=n.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}So(){var s,t,n=this._instance.get_property(Lr);if(!n)return!1;try{t=typeof n=="object"?n:JSON.parse(n)}catch(l){return pn.warn("persisted remote config for session recording is invalid and will be ignored",l),!1}var r=(s=t.cache_timestamp)!==null&&s!==void 0?s:Date.now();return 36e5>=Date.now()-r}yo(s){var t,n;if((t=He.__PosthogExtensions__)==null||!t.initSessionRecording)return pn.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[kb]:!0});if(this.co||(this.co=(n=He.__PosthogExtensions__)==null?void 0:n.initSessionRecording(this._instance),this.co._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.So())return this.vo===Jc||this.vo===Xo?void 0:(this.vo=Xo,pn.info("persisted remote config is stale, requesting fresh config before starting"),void new Zb(this._instance).load());this.vo=Py,this.co.start(s)}onRRwebEmit(s){var t;(t=this.co)==null||t.onRRwebEmit==null||t.onRRwebEmit(s)}overrideLinkedFlag(){var s,t;this.co||(t=this.mi)==null||t.register({[bb]:!0}),(s=this.co)==null||s.overrideLinkedFlag()}overrideSampling(){var s,t;this.co||(t=this.mi)==null||t.register({[yb]:!0}),(s=this.co)==null||s.overrideSampling()}overrideTrigger(s){var t,n;this.co||(n=this.mi)==null||n.register({[s==="url"?Sb:wb]:!0}),(t=this.co)==null||t.overrideTrigger(s)}get sdkDebugProperties(){var s;return((s=this.co)==null?void 0:s.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(s,t){var n;return!((n=this.co)==null||!n.tryAddCustomEvent(s,t))}}},CA={autocapture:class{constructor(s){this.Co=!1,this.Mo=null,this.Io=!1,this.To=!1,this.instance=s,this.rageclicks=new Hy(s.config.rageclick),this.Eo=null}initialize(){this.startIfEnabled()}get Te(){var s,t,n=Yt(this.instance.config.autocapture)?this.instance.config.autocapture:{};return n.url_allowlist=(s=n.url_allowlist)==null?void 0:s.map((r=>new RegExp(r))),n.url_ignorelist=(t=n.url_ignorelist)==null?void 0:t.map((r=>new RegExp(r))),n}Ro(){if(this.isBrowserSupported()){if(ce&&De){var s=n=>{n=n||(ce==null?void 0:ce.event);try{this.Po(n)}catch(r){Of.error("Failed to capture event",r)}};if(es(De,"submit",s,{capture:!0}),es(De,"change",s,{capture:!0}),es(De,"click",s,{capture:!0}),this.Te.capture_copied_text){var t=n=>{n=n||(ce==null?void 0:ce.event);try{this.Po(n,Lf)}catch(r){Of.error("Failed to capture copy/cut event",r)}};es(De,"copy",t,{capture:!0}),es(De,"cut",t,{capture:!0})}}}else Of.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.Co&&(this.Ro(),this.Co=!0)}onRemoteConfig(s){if(this.Io=!0,s.ok){var t=s.config;t.elementsChainAsString&&(this.To=t.elementsChainAsString);var n=t.autocapture_opt_out;Hi(n)&&(this.instance.persistence&&this.instance.persistence.register({[lp]:n}),this.Mo=n),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(s){this.Eo=s}getElementSelectors(s){var t,n=[];return(t=this.Eo)==null||t.forEach((r=>{var l=De==null?void 0:De.querySelectorAll(r);l==null||l.forEach((d=>{s===d&&n.push(r)}))})),n}get isEnabled(){var s,t,n=(s=this.instance.persistence)==null?void 0:s.props[lp],r=this.Mo,l=this.instance.Ur()&&!this.Io;if(Gs(r)&&!Hi(n)&&!l)return!1;var d=(t=this.Mo)!==null&&t!==void 0?t:!!n;return!!this.instance.config.autocapture&&!d}Po(s,t){if(t===void 0&&(t="$autocapture"),this.isEnabled){var n,r=wf(s);Db(r)&&(r=r.parentNode||null),t==="$autocapture"&&s.type==="click"&&s instanceof MouseEvent&&this.instance.config.rageclick&&(n=this.rageclicks)!=null&&n.isRageClick(s.clientX,s.clientY,s.timeStamp||new Date().getTime())&&fy(r,this.instance.config.rageclick)&&this.Po(s,"$rageclick");var l=t===Lf;if(r&&(function(f,x,E,T,C,y){var b;if(!ce||fv(f)||E!=null&&E.url_allowlist&&!uy(E.url_allowlist,y)||E!=null&&E.url_ignorelist&&uy(E.url_ignorelist,y))return!1;if(E!=null&&E.dom_event_allowlist){var m=E.dom_event_allowlist;if(m&&!m.some((A=>x.type===A)))return!1}var g=Ib(f,T),k=g.parentIsUsefulElement,M=g.targetElementList;if(!(function(A,D){var I=D==null?void 0:D.element_allowlist;if(Te(I))return!0;var q,G=function(X){if(I.some((se=>X.tagName.toLowerCase()===se)))return{v:!0}};for(var U of A)if(q=G(U))return q.v;return!1})(M,E)||!kp(M,E==null?void 0:E.css_selector_allowlist)||kp(M,(b=E==null?void 0:E.css_selector_ignorelist)!==null&&b!==void 0?b:w5))return!1;try{var R=ce.getComputedStyle(f);if(R&&R.getPropertyValue("cursor")==="pointer"&&x.type==="click")return!0}catch{}var j=f.tagName.toLowerCase();switch(j){case"html":return!1;case"form":return(C||["submit"]).indexOf(x.type)>=0;case"input":case"select":case"textarea":return(C||["change","click"]).indexOf(x.type)>=0;default:return k?(C||["click"]).indexOf(x.type)>=0:(C||["click"]).indexOf(x.type)>=0&&(dv.indexOf(j)>-1||f.getAttribute("contenteditable")==="true")}})(r,s,this.Te,l,l?["copy","cut"]:void 0,this.instance)){var d=pA(r,{e:s,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Te.element_attribute_ignorelist,elementsChainAsString:this.To,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}),p=d.props;if(d.explicitNoCapture)return!1;var c=this.getElementSelectors(r);if(c&&c.length>0&&(p.$element_selectors=c),t===Lf){var h,v=Ob(ce==null||(h=ce.getSelection())==null?void 0:h.toString()),S=s.type||"clipboard";if(!v)return!1;p.$selected_content=v,p.$copy_type=S}return this.instance.capture(t,p),!0}}}isBrowserSupported(){return fi(De==null?void 0:De.querySelectorAll)}},historyAutocapture:class{constructor(s){var t;this._instance=s,this.Oo=(ce==null||(t=ce.location)==null?void 0:t.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(Ae.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.Fo&&this.Fo(),this.Fo=void 0,Ae.info("History API monitoring stopped")}monitorHistoryChanges(){ce&&ce.history&&(this.Ao("pushState"),this.Ao("replaceState"),this.$o())}Ao(s){var t;if(ce&&((t=ce.history[s])==null||!t.__posthog_wrapped__)){var n=this;(function(r,l,d){try{if(!(l in r))return Iy;var p={next:r[l]},c=d((function(){for(var h=arguments.length,v=new Array(h),S=0;h>S;S++)v[S]=arguments[S];return p.next.apply(this,v)}));return fi(c)&&(c.prototype=c.prototype||{},Object.defineProperties(c,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:p}})),r[l]=c,()=>{if(r[l]!==c)for(var h=r[l];fi(h)&&h.__posthog_layer__;){var v=h.__posthog_layer__;if(v.next===c)return void(v.next=p.next);h=v.next}else r[l]=p.next}}catch{return Iy}})(ce.history,s,(r=>function(l,d,p){r.call(this,l,d,p),n.Lo(s)}))}}Lo(s){try{var t,n=ce==null||(t=ce.location)==null?void 0:t.pathname;if(!n)return;n!==this.Oo&&this.isEnabled&&this._instance.capture(xa,{navigation_type:s}),this.Oo=n}catch(r){Ae.error("Error capturing "+s+" pageview",r)}}$o(){if(!this.Fo){var s=()=>{this.Lo("popstate")};es(ce,"popstate",s),this.Fo=()=>{ce&&ce.removeEventListener("popstate",s)}}}},heatmaps:class{get Te(){return this.instance.config}constructor(s){var t;this.Do=!1,this.Co=!1,this.No=null,this.instance=s,this.Do=!((t=this.instance.persistence)==null||!t.props[cp]),this.rageclicks=new Hy(s.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var s=5e3;return Yt(this.Te.capture_heatmaps)&&this.Te.capture_heatmaps.flush_interval_milliseconds&&(s=this.Te.capture_heatmaps.flush_interval_milliseconds),s}get isEnabled(){return et(this.Te.capture_heatmaps)?et(this.Te.enable_heatmaps)?this.Do:this.Te.enable_heatmaps:this.Te.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.Co)return;mA.info("starting..."),this.qo(),this.xe()}else{var s;clearInterval((s=this.No)!==null&&s!==void 0?s:void 0),this.jo(),this.getAndClearBuffer()}}onRemoteConfig(s){if(s.ok){var t=s.config;if("heatmaps"in t){var n=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[cp]:n}),this.Do=n,this.startIfEnabled()}}}getAndClearBuffer(){var s=this.R;return this.R=void 0,s}Bo(s){Hf(s.originalEvent)&&this.pe(s.originalEvent,"deadclick")}xe(){this.No&&clearInterval(this.No),this.No=(De==null?void 0:De.visibilityState)==="visible"?setInterval(this.oi.bind(this),this.flushIntervalMilliseconds):null}qo(){ce&&De&&(this.Ho=this.oi.bind(this),es(ce,ku,this.Ho),this.Uo=s=>this.pe(s||(ce==null?void 0:ce.event)),es(De,"click",this.Uo,{capture:!0}),this.zo=s=>this.Vo(s||(ce==null?void 0:ce.event)),es(De,"mousemove",this.zo,{capture:!0}),this.Wo=new by(this.instance,R5,this.Bo.bind(this)),this.Wo.startIfEnabledOrStop(),this.Zo=this.xe.bind(this),es(De,Eu,this.Zo),this.Co=!0)}jo(){var s;ce&&De&&(this.Ho&&ce.removeEventListener(ku,this.Ho),this.Uo&&De.removeEventListener("click",this.Uo,{capture:!0}),this.zo&&De.removeEventListener("mousemove",this.zo,{capture:!0}),this.Zo&&De.removeEventListener(Eu,this.Zo),clearTimeout(this.Go),(s=this.Wo)==null||s.stop(),this.Co=!1)}Qo(s,t){var n=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),l=this.instance.scrollManager.scrollElement(),d=(function(p,c,h){for(var v=p;v&&er(v)&&!pi(v,"body");){if(v===h)return!1;var S=void 0;try{var f,x,E;S=(f=(x=(E=v.ownerDocument)==null?void 0:E.defaultView)!==null&&x!==void 0?x:ce)==null?void 0:f.getComputedStyle(v).position}catch{return!1}if(Ge(c,S))return!0;v=Bb(v)}return!1})(wf(s),["fixed","sticky"],l);return{x:s.clientX+(d?0:r),y:s.clientY+(d?0:n),target_fixed:d,type:t}}pe(s,t){var n;if(t===void 0&&(t="click"),!cy(s.target)&&Hf(s)){var r=this.Qo(s,t);(n=this.rageclicks)!=null&&n.isRageClick(s.clientX,s.clientY,new Date().getTime())&&fy(wf(s),this.instance.config.rageclick)&&this.Wt(Ce({},r,{type:"rageclick"})),this.Wt(r)}}Vo(s){!cy(s.target)&&Hf(s)&&(clearTimeout(this.Go),this.Go=setTimeout((()=>{this.Wt(this.Qo(s,"mousemove"))}),500))}Wt(s){if(ce){var t=this.Te.disable_capture_url_hashes?Qn(ce.location.href):ce.location.href,n=this.Te.custom_personal_data_properties,r=this.Te.mask_personal_data_properties?[...za,...n||[]]:[],l=bl(t,r,Sl);this.R=this.R||{},this.R[l]||(this.R[l]=[]),this.R[l].push(s)}}oi(){this.R&&!Kn(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:by,webVitalsAutocapture:class{constructor(s){var t;this.Do=!1,this.Co=!1,this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Jo=()=>{clearTimeout(this.Ko),this.R.metrics.length!==0&&(this._instance.capture("$web_vitals",this.R.metrics.reduce(((n,r)=>Ce({},n,{["$web_vitals_"+r.name+"_event"]:Ce({},r),["$web_vitals_"+r.name+"_value"]:r.value})),{})),this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Yo=n=>{var r;this.R=this.R||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var l=this.Xo();if(!Te(l))if(et(n==null?void 0:n.name)||et(n==null?void 0:n.value))kr.error("Invalid metric received",n);else if(!this.ta||this.ta>n.value){this.R.url!==l&&(this.Jo(),this.Ko=setTimeout(this.Jo,this.flushToCaptureTimeoutMs)),Te(this.R.url)&&(this.R.url=l),this.R.firstMetricTimestamp=Te(this.R.firstMetricTimestamp)?Date.now():this.R.firstMetricTimestamp,n.attribution&&n.attribution.interactionTargetElement&&(n.attribution.interactionTargetElement=void 0);var d=(r=this._instance.sessionManager)==null?void 0:r.checkAndGetSessionAndWindowId(!0),p=Ce({},n,{$current_url:l,timestamp:Date.now()});Te(d)||(p.$session_id=d.sessionId,p.$window_id=d.windowId),this.R.metrics.push(p),this.R.metrics.length===this.allowedMetrics.length&&this.Jo()}else kr.error("Ignoring metric with value >= "+this.ta,n)},this.ea=()=>{if(!this.Co){var n,r,l,d,p=He.__PosthogExtensions__;if(!Te(p)&&!Te(p.postHogWebVitalsCallbacks)){var c=p.postHogWebVitalsCallbacks;n=c.onLCP,r=c.onCLS,l=c.onFCP,d=c.onINP}n&&r&&l&&d?(this.allowedMetrics.indexOf("LCP")>-1&&n(this.Yo.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&r(this.Yo.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&l(this.Yo.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&d(this.Yo.bind(this)),this.Co=!0):kr.error("web vitals callbacks not loaded - not starting")}},this._instance=s,this.Do=!((t=this._instance.persistence)==null||!t.props[fp]),this.startIfEnabled()}get ra(){return this._instance.config.capture_performance}get allowedMetrics(){var s,t,n=Yt(this.ra)?(s=this.ra)==null?void 0:s.web_vitals_allowed_metrics:void 0;return et(n)?((t=this._instance.persistence)==null?void 0:t.props[pp])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return(Yt(this.ra)?this.ra.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var s=Yt(this.ra)?this.ra.web_vitals_attribution:void 0;return s!=null&&s}get ta(){var s=Yt(this.ra)&&Os(this.ra.__web_vitals_max_value)?this.ra.__web_vitals_max_value:zy;return s>0&&6e4>=s?zy:s}get isEnabled(){var s=hs==null?void 0:hs.protocol;if(s!=="http:"&&s!=="https:")return kr.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=Yt(this.ra)?this.ra.web_vitals:Hi(this.ra)?this.ra:void 0;return Hi(t)?t:this.Do}startIfEnabled(){this.isEnabled&&!this.Co&&(kr.info("enabled, starting..."),this.tr(this.ea))}onRemoteConfig(s){if(s.ok){var t=s.config;if("capturePerformance"in t){var n=Yt(t.capturePerformance)&&!!t.capturePerformance.web_vitals,r=Yt(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[fp]:n}),this._instance.persistence.register({[pp]:r})),this.Do=n,this.startIfEnabled()}}}tr(s){var t,n;(t=He.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks?s():(n=He.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(r=>{r?kr.error("failed to load script",r):s()}))}Xo(){var s=ce?this._instance.config.disable_capture_url_hashes?Qn(ce.location.href):ce.location.href:void 0;if(s){var t=this._instance.config.custom_personal_data_properties,n=this._instance.config.mask_personal_data_properties?[...za,...t||[]]:[];return bl(s,n,Sl)}kr.error("Could not determine current URL")}}},EA={exceptionObserver:class{constructor(s){var t;this.ea=()=>{var n;if(ce&&this.isEnabled&&(n=He.__PosthogExtensions__)!=null&&n.errorWrappingFunctions){var r=He.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,l=He.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,d=He.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.ia&&this.Te.capture_unhandled_errors&&(this.ia=r(this.captureException.bind(this))),!this.na&&this.Te.capture_unhandled_rejections&&(this.na=l(this.captureException.bind(this))),!this.sa&&this.Te.capture_console_errors&&(this.sa=d(this.captureException.bind(this)))}catch(p){Ko.error("failed to start",p),this.oa()}}},this._instance=s,this.aa=!((t=this._instance.persistence)==null||!t.props[up]),this.la=new CT(Ce({},(function(n){var r,l,d,p;return n===void 0&&(n={}),{refillRate:(r=(l=n.exceptionRateLimiterRefillRate)!==null&&l!==void 0?l:n.__exceptionRateLimiterRefillRate)!==null&&r!==void 0?r:1,bucketSize:(d=(p=n.exceptionRateLimiterBucketSize)!==null&&p!==void 0?p:n.__exceptionRateLimiterBucketSize)!==null&&d!==void 0?d:10}})(this._instance.config.error_tracking),{refillInterval:1e4,it:Ko})),this.Te=this.ua(),this.startIfEnabledOrStop()}ua(){var s=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Yt(s)?t=Ce({},t,s):(Te(s)?this.aa:s)&&(t=Ce({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.Te.capture_console_errors||this.Te.capture_unhandled_errors||this.Te.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Ko.info("enabled"),this.oa(),this.tr(this.ea)):this.oa()}tr(s){var t,n;(t=He.__PosthogExtensions__)!=null&&t.errorWrappingFunctions?s():(n=He.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",(r=>{if(r)return Ko.error("failed to load script",r);s()}))}oa(){var s,t,n;(s=this.ia)==null||s.call(this),this.ia=void 0,(t=this.na)==null||t.call(this),this.na=void 0,(n=this.sa)==null||n.call(this),this.sa=void 0}onRemoteConfig(s){if(s.ok){var t=s.config;"autocaptureExceptions"in t&&(this.aa=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[up]:this.aa}),this.Te=this.ua(),this.startIfEnabledOrStop())}}onConfigChange(){this.Te=this.ua()}captureException(s){var t,n,r,l=(t=s==null||(n=s.$exception_list)==null||(n=n[0])==null?void 0:n.type)!==null&&t!==void 0?t:"Exception";this.la.consumeRateLimit(l)?Ko.info("Skipping exception capture because of client rate limiting.",{exception:l}):(r=this._instance.exceptions)==null||r.sendExceptionEvent(s)}},exceptions:class{constructor(s){var t,n;this.ha=[],this.da=new PT([new KT,new n5,new JT,new XT,new s5,new t5,new QT,new i5],(function(r){for(var l=arguments.length,d=new Array(l>1?l-1:0),p=1;l>p;p++)d[p-1]=arguments[p];return function(c,h){h===void 0&&(h=0);for(var v=[],S=c.split(`
|
|
469
|
-
`),f=h;S.length>f;f++){var x=S[f];if(1024>=x.length){var E=ry.test(x)?x.replace(ry,"$1"):x;if(!E.match(/\S*Error: /)){for(var T of d){var C=T(E,r);if(C){v.push(C);break}}if(v.length>=50)break}}}return(function(y){if(!y.length)return[];var b=Array.from(y);return b.reverse(),b.slice(0,50).map((m=>{return Ce({},m,{filename:m.filename||(g=b,g[g.length-1]||{}).filename,function:m.function||Ha});var g}))})(v)}})("web:javascript",WT,YT)),this._instance=s,this.ha=(t=(n=this._instance.persistence)==null?void 0:n.get_property(hp))!==null&&t!==void 0?t:[],this.ca=bu(this.va()),this.fa=new a5(this.ca)}onConfigChange(){this.ca=bu(this.va()),this.fa.setConfig(this.ca)}onRemoteConfig(s){var t,n,r;if(s.ok){var l=s.config;if("errorTracking"in l){var d=(t=(n=l.errorTracking)==null?void 0:n.suppressionRules)!==null&&t!==void 0?t:[],p=(r=l.errorTracking)==null?void 0:r.captureExtensionExceptions;this.ha=d,this._instance.persistence&&this._instance.persistence.register({[hp]:this.ha,[dp]:p})}}}get pa(){var s,t=!!this._instance.get_property(dp),n=this._instance.config.error_tracking.captureExtensionExceptions;return(s=n??t)!==null&&s!==void 0&&s}buildProperties(s,t){return this.da.buildFromUnknown(s,{syntheticException:t==null?void 0:t.syntheticException,mechanism:{handled:t==null?void 0:t.handled}})}addExceptionStep(s,t){if(this.ca.enabled)try{if(!It(s)||s.trim().length===0)return void Wi.warn("Ignoring exception step because message must be a non-empty string");var n=(function(d){if(!d)return{sanitizedProperties:{},droppedKeys:[]};var p=[];return{sanitizedProperties:Object.keys(d).reduce(((c,h)=>r5.has(h)?(p.push(h),c):(c[h]=d[h],c)),{}),droppedKeys:p}})(this.ga(t)),r=n.sanitizedProperties,l=n.droppedKeys;l.length>0&&Wi.warn("Ignoring reserved exception step fields",{droppedKeys:l}),this.fa.add(Ce({[_u]:s,[yu]:new Date().toISOString()},r))}catch(d){Wi.error("Failed to add exception step. Ignoring breadcrumb.",d)}}sendExceptionEvent(s){try{var t=s.$exception_list;if(this.ma(t)){if(this.ya(t))return this.ba("Exception dropped: matched a suppression rule"),void Wi.info("Skipping exception capture because a suppression rule matched");if(!this.pa&&this._a(t))return this.ba("Exception dropped: thrown by a browser extension"),void Wi.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.wa(t))return this.ba("Exception dropped: thrown by the PostHog SDK"),void Wi.info("Skipping exception capture because it was thrown by the PostHog SDK")}var n=this.ca.enabled&&et(s.$exception_steps)?this.xa(s):s,r=typeof(d=globalThis._posthogReleaseId)=="string"&&d.length>0?d:void 0;r&&(n.$release_id=r);try{var l=this._instance.capture("$exception",n,{_noTruncate:!0,_batchKey:"exceptionEvent",Pn:!0});return l&&this.fa.clear(),l}catch(p){return Wi.error("Failed to capture exception event. Dropping this exception.",p),void this.fa.clear()}}catch(p){return void Wi.error("Failed to process exception event. Ignoring this exception.",p)}var d}xa(s){try{var t=this.fa.getAttachable();return t.length===0?s:Ce({},s,{$exception_steps:t})}catch(n){return Wi.error("Failed to read buffered exception steps. Capturing exception without steps.",n),s}}ba(s){this.ca.enabled&&this.fa.add({[_u]:s,[yu]:new Date().toISOString()})}ga(s){return Yt(s)?Ce({},s):{}}va(){var s,t;return(s=(t=this._instance.config.error_tracking)==null?void 0:t.exception_steps)!==null&&s!==void 0?s:{}}ya(s){if(s.length===0)return!1;try{var t=s.reduce(((n,r)=>{var l=r.type,d=r.value;return It(l)&&l.length>0&&n.$exception_types.push(l),It(d)&&d.length>0&&n.$exception_values.push(d),n}),{$exception_types:[],$exception_values:[]});return this.ha.some((n=>{var r=n.values.map((l=>{var d=hS[l.operator],p=t[l.key];if(!d||!p)return!1;var c=Ze(l.value)?l.value:[l.value];return c.length>0&&d(c,p)}));return n.type==="OR"?r.some(Boolean):r.every(Boolean)}))}catch(n){return Wi.warn("Failed to evaluate suppression rules. Capturing the exception.",n),!1}}_a(s){return s.flatMap((t=>{var n,r;return(n=(r=t.stacktrace)==null?void 0:r.frames)!==null&&n!==void 0?n:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}wa(s){if(s.length>0){var t,n,r,l,d=(t=(n=s[0].stacktrace)==null?void 0:n.frames)!==null&&t!==void 0?t:[],p=d[d.length-1];return(r=p==null||(l=p.filename)==null?void 0:l.includes("posthog.com/static"))!==null&&r!==void 0&&r}return!1}ma(s){return!et(s)&&Ze(s)}}},kA=Ce({productTours:class{get mi(){return this._instance.persistence}constructor(s){this.ka=null,this.Sa=null,this._instance=s}initialize(){this.loadIfEnabled()}onRemoteConfig(s){if(s.ok){var t=s.config;if("productTours"in t){var n,r;if(this.mi&&this.mi.register({[ov]:!!t.productTours}),!zf(this._instance))return!this.ka&&et((n=this.mi)==null?void 0:n.props[sl])||If.info("product tours disabled; stopping and clearing cached tours"),(r=this.ka)==null||r.stop(),this.ka=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.ka&&zf(this._instance)&&this.tr((()=>this.Ca()))}tr(s){var t,n;(t=He.__PosthogExtensions__)!=null&&t.generateProductTours?s():(n=He.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"product-tours",(r=>{r?If.error("Could not load product tours script",r):s()}))}Ca(){var s;!this.ka&&(s=He.__PosthogExtensions__)!=null&&s.generateProductTours&&(this.ka=He.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(s,t){if(t===void 0&&(t=!1),!Ze(this.Sa)||t){var n=this.mi;if(n){var r=n.props[sl];if(Ze(r)&&!t)return this.Sa=r,void s(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:l=>{if(zf(this._instance)){var d=l.statusCode;if(d!==200||!l.json){var p="Product Tours API could not be loaded, status: "+d;return If.error(p),void s([],{isLoaded:!1,error:p})}var c=Ze(l.json.product_tours)?l.json.product_tours:[];this.Sa=c,n&&n.register({[sl]:c}),s(c,{isLoaded:!0})}else s([],{isLoaded:!0})}})}else s(this.Sa,{isLoaded:!0})}getActiveProductTours(s){et(this.ka)?s([],{isLoaded:!1,error:"Product tours not loaded"}):this.ka.getActiveProductTours(s)}showProductTour(s){var t;(t=this.ka)==null||t.showTourById(s)}previewTour(s){this.ka?this.ka.previewTour(s):this.tr((()=>{var t;this.Ca(),(t=this.ka)==null||t.previewTour(s)}))}dismissProductTour(){var s;(s=this.ka)==null||s.dismissTour("user_clicked_skip")}nextStep(){var s;(s=this.ka)==null||s.nextStep()}previousStep(){var s;(s=this.ka)==null||s.previousStep()}clearCache(){var s;this.Sa=null,(s=this.mi)==null||s.unregister(sl)}resetTour(s){var t;(t=this.ka)==null||t.resetTour(s)}resetAllTours(){var s;(s=this.ka)==null||s.resetAllTours()}cancelPendingTour(s){var t;(t=this.ka)==null||t.cancelPendingTour(s)}}},Gu),TA={siteApps:class{constructor(s){this.Ma=0,this._instance=s,this.Ia=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Ta(s,t){if(t){var n=this.globalsForEvent(t);this.Ia.push(n),this.Ia.length>1e3&&(this.Ia=this.Ia.slice(10))}}get siteAppLoaders(){var s;return(s=He._POSTHOG_REMOTE_CONFIG)==null||(s=s[this._instance.config.token])==null?void 0:s.siteApps}initialize(){if(this.isEnabled){var s=this._instance._addCaptureHook(this.Ta.bind(this));this.Ea=()=>{s(),this.Ia=[],this.Ea=void 0}}}globalsForEvent(s){var t,n,r,l,d,p,c;if(!s)throw new Error("Event payload is required");var h={},v=this._instance.get_property("$groups")||[],S=this._instance.get_property("$stored_group_properties")||{};for(var f of Object.entries(S)){var x=f[0];h[x]={id:v[x],type:x,properties:f[1]}}var E=s.$set_once,T=s.$set;return{event:Ce({},I1(s,gA),{properties:Ce({},s.properties,T?{$set:Ce({},(t=(n=s.properties)==null?void 0:n.$set)!==null&&t!==void 0?t:{},T)}:{},E?{$set_once:Ce({},(r=(l=s.properties)==null?void 0:l.$set_once)!==null&&r!==void 0?r:{},E)}:{}),elements_chain:(d=(p=s.properties)==null?void 0:p.$elements_chain)!==null&&d!==void 0?d:"",distinct_id:(c=s.properties)==null?void 0:c.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:h}}Ra(s){var t,n=(t=s.tagName)==null?void 0:t.toLowerCase();return n==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(s)||(qi.error("prepare_external_dependency_stylesheet returned null"),null):n==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(s)||(qi.error("prepare_external_dependency_script returned null"),null):s}Pa(){var s,t,n,r,l,d,p,c;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var h=De==null?void 0:De.defaultView,v=h==null||(s=h.Node)==null?void 0:s.prototype;if(!h||!v)return()=>{};if(this.Ma++,this.Oa)return this.Fa();var S=[],f=this,x=new WeakSet,E=(y,b,m)=>{if(y!=null&&y[b]){var g=y[b];y[b]=m(g),S.push((()=>{y[b]=g}))}},T=y=>{if(x.has(y))return y;var b=f.Ra(y);return b&&x.add(b),b},C=y=>y.map((b=>typeof b=="string"?b:T(b))).filter((b=>!Gs(b)));return E(v,"appendChild",(y=>function(b){var m=T(b);return m?y.call(this,m):b})),E(v,"insertBefore",(y=>function(b,m){var g=T(b);return g?y.call(this,g,m):b})),E(v,"replaceChild",(y=>function(b,m){var g=T(b);return g?y.call(this,g,m):m})),[(t=h.Element)==null?void 0:t.prototype,(n=h.Document)==null?void 0:n.prototype,(r=h.DocumentFragment)==null?void 0:r.prototype].forEach((y=>{E(y,"append",(b=>function(){for(var m=arguments.length,g=new Array(m),k=0;m>k;k++)g[k]=arguments[k];return b.apply(this,C(g))})),E(y,"prepend",(b=>function(){for(var m=arguments.length,g=new Array(m),k=0;m>k;k++)g[k]=arguments[k];return b.apply(this,C(g))}))})),[(l=h.Element)==null?void 0:l.prototype,(d=h.CharacterData)==null?void 0:d.prototype,(p=h.DocumentType)==null?void 0:p.prototype].forEach((y=>{E(y,"before",(b=>function(){for(var m=arguments.length,g=new Array(m),k=0;m>k;k++)g[k]=arguments[k];return b.apply(this,C(g))})),E(y,"after",(b=>function(){for(var m=arguments.length,g=new Array(m),k=0;m>k;k++)g[k]=arguments[k];return b.apply(this,C(g))})),E(y,"replaceWith",(b=>function(){for(var m=arguments.length,g=new Array(m),k=0;m>k;k++)g[k]=arguments[k];var M=C(g);return g.length&&!M.length?void 0:b.apply(this,M)}))})),E((c=h.Element)==null?void 0:c.prototype,"insertAdjacentElement",(y=>function(b,m){var g=T(m);return g?y.call(this,b,g):null})),this.Oa=()=>{S.forEach((y=>y())),this.Oa=void 0},this.Fa()}Fa(){var s=!1;return()=>{var t;s||(s=!0,this.Ma--,this.Ma===0&&((t=this.Oa)==null||t.call(this)))}}Aa(s,t){t===void 0&&(t=!0);var n=this.Pa();try{var r=s(n);return t&&n(),r}catch(l){throw n(),l}}setupSiteApp(s){var t=this.apps[s.id],n=()=>{var p;!t.errored&&this.Ia.length&&(qi.info("Processing "+this.Ia.length+" events for site app with id "+s.id),this.Ia.forEach((c=>this.Aa((()=>t.processEvent==null?void 0:t.processEvent(c))))),t.processedBuffer=!0),Object.values(this.apps).every((c=>c.processedBuffer||c.errored))&&((p=this.Ea)==null||p.call(this))},r=!1,l=p=>{t.errored=!p,t.loaded=!0,qi.info("Site app with id "+s.id+" "+(p?"loaded":"errored")),r&&n()};try{var d=this.Aa((p=>s.init({posthog:this._instance,callback(c){p(),l(c)}})),!1).processEvent;d&&(t.processEvent=d),r=!0}catch(p){qi.error(Uy+s.id,p),l(!1)}if(r&&t.loaded)try{n()}catch(p){qi.error("Error while processing buffered events PostHog app with config id "+s.id,p),t.errored=!0}}$a(){var s=this.siteAppLoaders||[];for(var t of s)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var n of s)this.setupSiteApp(n)}La(s){var t=this;if(Object.keys(this.apps).length!==0){var n=this.globalsForEvent(s),r=function(d){try{t.Aa((()=>d.processEvent==null?void 0:d.processEvent(n)))}catch(p){qi.error("Error while processing event "+s.event+" for site app "+d.id,p)}};for(var l of Object.values(this.apps))r(l)}}onRemoteConfig(s){var t,n,r,l=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.$a(),void this._instance.on("eventCaptured",(h=>this.La(h)))):void qi.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.Ea)==null||n.call(this),s.ok){var d=s.config;if((r=d.siteApps)!=null&&r.length)if(this.isEnabled){var p=function(){var h,v=c.id,S=c.url;He["__$$ph_site_app_"+v]=l._instance,(h=He.__PosthogExtensions__)==null||h.loadSiteApp==null||h.loadSiteApp(l._instance,S,(f=>{if(f)return qi.error(Uy+v,f)}))};for(var c of d.siteApps)p()}else qi.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},AA={tracingHeaders:class{constructor(s){this.Da=void 0,this.Na=void 0,this.qa=void 0,this.ea=()=>{var t,n,r=this.ja();r?(Te(this.Da)&&(this.Da=(t=He.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null?void 0:t._patchXHR(r,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),Te(this.Na)&&(this.Na=(n=He.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null?void 0:n._patchFetch(r,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.oa()},this._instance=s}initialize(){this.startIfEnabledOrStop()}tr(s){var t,n;(t=He.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns?s():(n=He.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",(r=>{if(r)return vA.error("failed to load script",r);s()}))}Ba(){var s,t;return(s=(t=this._instance.config.tracing_headers)!==null&&t!==void 0?t:this._instance.config.addTracingHeaders)!==null&&s!==void 0?s:this._instance.config.__add_tracing_headers}ja(){var s=this.Ba();return Ze(s)?(Ze(this.qa)?this.qa.splice(0,this.qa.length,...s):this.qa=[...s],s.length>0?this.qa:void 0):(Ze(this.qa)&&this.qa.splice(0),this.qa=s||void 0,this.qa)}oa(){var s,t;(s=this.Da)==null||s.call(this),(t=this.Na)==null||t.call(this),this.Da=void 0,this.Na=void 0}startIfEnabledOrStop(){this.ja()?this.tr(this.ea):this.oa()}}},RA=Ce({surveys:class{get Te(){return this._instance.config}constructor(s){this.Ha=void 0,this._surveyManager=null,this.Ua=!1,this.za=[],this.Va=null,this.Wa=null,this._instance=s,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(s){if(!this.Te.disable_surveys){if(!s.ok)return jt.warn("Remote config unavailable. Not loading surveys.");var t=s.config.surveys;if(et(t))return jt.warn("Flags not loaded yet. Not loading surveys.");var n=Ze(t);this.Ha=n?t.length>0:t,jt.info("flags response received, isSurveysEnabled: "+this.Ha),this.loadIfEnabled()}}reset(){try{var s;(s=this._surveyEventReceiver)==null||s.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var t=[],n=0;n<localStorage.length;n++){var r=localStorage.key(n);(r!=null&&r.startsWith(pS)||r!=null&&r.startsWith("inProgressSurvey_"))&&t.push(r)}t.forEach((l=>localStorage.removeItem(l)))}catch{}}loadIfEnabled(){if(!this._surveyManager)if(this.Ua)jt.info("Already initializing surveys, skipping...");else if(this.Te.disable_surveys)jt.info(Fy);else if(this.Te.cookieless_mode&&this._instance.consent.isOptedOut())jt.info("Not loading surveys in cookieless mode without consent.");else{var s=He==null?void 0:He.__PosthogExtensions__;if(s){if(!Te(this.Ha)||this.Te.advanced_enable_surveys){var t=this.Ha||this.Te.advanced_enable_surveys;this.Ua=!0;try{var n=s.generateSurveys;if(n)return void this.Za(n,t);var r=s.loadExternalDependency;if(!r)return void this.Ga(cv);r(this._instance,"surveys",(l=>{l||!s.generateSurveys?this.Ga("Could not load surveys script",l):this.Za(s.generateSurveys,t)}))}catch(l){throw this.Ga("Error initializing surveys",l),l}finally{this.Ua=!1}}}else jt.error("PostHog Extensions not found.")}}Za(s,t){this._surveyManager=s(this._instance,t),this._surveyEventReceiver=new bA(this._instance),jt.info("Surveys loaded successfully"),this.Qa({isLoaded:!0})}Ga(s,t){jt.error(s,t),this.Qa({isLoaded:!1,error:s})}onSurveysLoaded(s){return this.za.push(s),this._surveyManager&&this.Qa({isLoaded:!0}),()=>{this.za=this.za.filter((t=>t!==s))}}getSurveys(s,t){if(t===void 0&&(t=!1),this.Te.disable_surveys)return jt.info(Fy),s([]);var n,r=this._instance.get_property(gp);if(r&&!t)return s(r,{isLoaded:!0}),void(this.Ja()&&this.getSurveys((()=>{}),!0));typeof Promise<"u"&&this.Va?this.Va.then((l=>s(l.surveys,l.context))):(typeof Promise<"u"&&(this.Va=new Promise((l=>{n=l}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Te.token),method:"GET",timestampMode:"query",timeout:this.Te.surveys_request_timeout_ms,callback:l=>{var d;this.Va=null;var p=l.statusCode;if(p!==200||!l.json){var c="Surveys API could not be loaded, status: "+p;jt.error(c),this.Wa=Date.now();var h={isLoaded:!1,error:c};return s([],h),void(n==null||n({surveys:[],context:h}))}this.Wa=null;var v,S=l.json.surveys||[],f=S.filter((E=>(function(T){return!(!T.start_date||T.end_date)})(E)&&(fS(E)||(function(T){var C;return!((C=T.conditions)==null||(C=C.actions)==null||(C=C.values)==null||!C.length)})(E))));f.length>0&&((v=this._surveyEventReceiver)==null||v.register(f)),(d=this._instance.persistence)==null||d.register({[gp]:S,[wu]:Date.now()});var x={isLoaded:!0};s(S,x),n==null||n({surveys:S,context:x})}}))}Ja(){return this.Ka()&&!this.Va&&!this.Ya()}Ka(){var s=this._instance.get_property(wu);return Os(s)&&Date.now()-s>3e5}Ya(){return Os(this.Wa)&&3e5>Date.now()-this.Wa}markSurveyAsSeen(s,t){var n,r={id:s,current_iteration:(n=t==null?void 0:t.iteration)!==null&&n!==void 0?n:null};vS(r);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}}Qa(s){for(var t of this.za)try{if(!s.isLoaded)return t([],s);this.getSurveys(t)}catch(n){jt.error("Error in survey callback",n)}}getActiveMatchingSurveys(s,t){if(t===void 0&&(t=!1),!et(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(s,t);jt.warn("init was not called")}Xa(s){var t=null;return this.getSurveys((n=>{var r;t=(r=n.find((l=>l.id===s)))!==null&&r!==void 0?r:null})),t}tl(s){if(et(this._surveyManager))return{eligible:!1,reason:Zc};var t=typeof s=="string"?this.Xa(s):s;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}el(s){if(et(this._surveyManager))return{eligible:!1,reason:Zc};var t=typeof s=="string"?this.Xa(s):s;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(s){if(et(this._surveyManager))return jt.warn("init was not called"),{visible:!1,disabledReason:Zc};var t=this.el(s);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(s,t){return et(this._surveyManager)?(jt.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Zc})):new Promise((n=>{this.getSurveys((r=>{var l,d=(l=r.find((c=>c.id===s)))!==null&&l!==void 0?l:null;if(d){var p=this.el(d);n({visible:p.eligible,disabledReason:p.reason})}else n({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(s,t,n){var r;if(et(this._surveyManager))jt.warn("init was not called");else{var l=typeof s=="string"?this.Xa(s):s;if(l!=null&&l.id)if(sA.includes(l.type)){var d=De==null?void 0:De.querySelector(t);if(d)return(r=l.appearance)!=null&&r.surveyPopupDelaySeconds?(jt.info("Rendering survey "+l.id+" with delay of "+l.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var p,c;jt.info("Rendering survey "+l.id+" with delay of "+((p=l.appearance)==null?void 0:p.surveyPopupDelaySeconds)+" seconds"),(c=this._surveyManager)==null||c.renderSurvey(l,d,n),jt.info("Survey "+l.id+" rendered")}),1e3*l.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(l,d,n);jt.warn("Survey element not found")}else jt.warn("Surveys of type "+l.type+" cannot be rendered in the app");else jt.warn("Survey not found")}}displaySurvey(s,t){var n;if(et(this._surveyManager))jt.warn("init was not called");else{var r=this.Xa(s);if(r){var l=r;if((n=r.appearance)!=null&&n.surveyPopupDelaySeconds&&t.ignoreDelay&&(l=Ce({},r,{appearance:Ce({},r.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==Ap.Popover&&t.initialResponses&&jt.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){var d=this.tl(r);if(!d.eligible)return void jt.warn("Survey is not eligible to be displayed: ",d.reason)}t.displayType!==Ap.Inline?this._surveyManager.handlePopoverSurvey(l,t):this.renderSurvey(l,t.selector,t.properties)}else jt.warn("Survey not found")}}cancelPendingSurvey(s){et(this._surveyManager)?jt.warn("init was not called"):this._surveyManager.cancelSurvey(s)}handlePageUnload(){var s;(s=this._surveyManager)==null||s.handlePageUnload==null||s.handlePageUnload()}}},Gu),MA={toolbar:class{constructor(s){this.instance=s}rl(s){He.ph_toolbar_state=s}il(){var s;return(s=He.ph_toolbar_state)!==null&&s!==void 0?s:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(s,t,n){if(s===void 0&&(s=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),Tb(this.instance.config)||!ce||!De)return!1;s=s??ce.location,n=n??ce.history;try{if(!t){try{ce.localStorage.setItem("test","test"),ce.localStorage.removeItem("test")}catch{return!1}t=ce==null?void 0:ce.localStorage}var r,l=SA||Mu(s.hash,"__posthog")||Mu(s.hash,"state"),d=l?oy((()=>JSON.parse(atob(decodeURIComponent(l)))))||oy((()=>JSON.parse(decodeURIComponent(l)))):null;return d&&d.action==="ph_authorize"?((r=d).source="url",r&&Object.keys(r).length>0&&(d.desiredHash?s.hash=d.desiredHash:n?n.replaceState(n.state,"",s.pathname+s.search):s.hash="")):((r=JSON.parse(t.getItem(qy)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch{return!1}}nl(s){var t=He.ph_load_toolbar||He.ph_load_editor;!et(t)&&fi(t)?t(s,this.instance):Wy.warn("No toolbar load function found")}loadToolbar(s){var t=!(De==null||!De.getElementById(jb));if(!ce||t)return!1;var n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,r=Ce({token:this.instance.config.token},s,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(ce.localStorage.setItem(qy,JSON.stringify(Ce({},r,{source:void 0}))),this.il()===2)this.nl(r);else if(this.il()===0){var l;this.rl(1),(l=He.__PosthogExtensions__)==null||l.loadExternalDependency==null||l.loadExternalDependency(this.instance,"toolbar",(d=>{if(d)return Wy.error("[Toolbar] Failed to load",d),void this.rl(0);this.rl(2),this.nl(r)})),es(ce,"turbolinks:load",(()=>{this.rl(0),this.loadToolbar(r)}))}return!0}sl(s){return this.loadToolbar(s)}maybeLoadEditor(s,t,n){return s===void 0&&(s=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),this.maybeLoadToolbar(s,t,n)}}},jA=Ce({experiments:Is},Gu),DA={conversations:class{constructor(s){this.ol=void 0,this._conversationsManager=null,this.al=!1,this.ll=null,this._instance=s}initialize(){this.loadIfEnabled()}onRemoteConfig(s){if(!this._instance.config.disable_conversations&&s.ok){var t=s.config.conversations;et(t)||(Hi(t)?this.ol=t:(this.ol=t.enabled,this.ll=t),this.loadIfEnabled())}}reset(){var s;(s=this._conversationsManager)==null||s.reset(),this._conversationsManager=null,this.ol=void 0,this.ll=null}loadIfEnabled(){if(!(this._conversationsManager||this.al||this._instance.config.disable_conversations||Tb(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var s=He==null?void 0:He.__PosthogExtensions__;if(s&&!Te(this.ol)&&this.ol)if(this.ll&&this.ll.token){this.al=!0;try{var t=s.initConversations;if(t)return this.ul(t),void(this.al=!1);var n=s.loadExternalDependency;if(!n)return void this.hl(cv);n(this._instance,"conversations",(r=>{r||!s.initConversations?this.hl("Could not load conversations script",r):this.ul(s.initConversations),this.al=!1}))}catch(r){this.hl("Error initializing conversations",r),this.al=!1}}else Ei.error("Conversations enabled but missing token in remote config.")}}ul(s){if(this.ll)try{this._conversationsManager=s(this.ll,this._instance),Ei.info("Conversations loaded successfully")}catch(t){this.hl("Error completing conversations initialization",t)}else Ei.error("Cannot complete initialization: remote config is null")}hl(s,t){Ei.error(s,t),this._conversationsManager=null,this.al=!1}show(){this._conversationsManager?this._conversationsManager.show():Ei.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.ol===!0&&!Gs(this._conversationsManager)}isVisible(){var s,t;return(s=(t=this._conversationsManager)==null?void 0:t.isVisible())!==null&&s!==void 0&&s}sendMessage(s,t,n){var r=this;return Kt((function*(){return r._conversationsManager?r._conversationsManager.sendMessage(s,t,n):(Ei.warn(Ar),null)}))()}getMessages(s,t){var n=this;return Kt((function*(){return n._conversationsManager?n._conversationsManager.getMessages(s,t):(Ei.warn(Ar),null)}))()}markAsRead(s){var t=this;return Kt((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(s):(Ei.warn(Ar),null)}))()}getTickets(s){var t=this;return Kt((function*(){return t._conversationsManager?t._conversationsManager.getTickets(s):(Ei.warn(Ar),null)}))()}requestRestoreLink(s){var t=this;return Kt((function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(s):(Ei.warn(Ar),null)}))()}restoreFromToken(s){var t=this;return Kt((function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(s):(Ei.warn(Ar),null)}))()}restoreFromUrlToken(){var s=this;return Kt((function*(){return s._conversationsManager?s._conversationsManager.restoreFromUrlToken():(Ei.warn(Ar),null)}))()}getCurrentTicketId(){var s,t;return(s=(t=this._conversationsManager)==null?void 0:t.getCurrentTicketId())!==null&&s!==void 0?s:null}getWidgetSessionId(){var s,t;return(s=(t=this._conversationsManager)==null?void 0:t.getWidgetSessionId())!==null&&s!==void 0?s:null}Nn(){var s;(s=this._conversationsManager)==null||s.setIdentity()}qn(){var s;(s=this._conversationsManager)==null||s.clearIdentity()}}},NA={logs:class{constructor(s){var t;this.dl=!1,this.cl=!1,this.it=Jt("[logs]"),this.Gr=[],this.vl=[],this.Js=0,this.fl=()=>{var n,r;this.Js=0,(n=this.pl)==null||n.onReconnect(),(r=this.gl)==null||r.onReconnect()},this._instance=s,this._instance&&(t=this._instance.config.logs)!=null&&t.captureConsoleLogs&&(this.dl=!0),ce&&es(ce,"online",this.fl)}ml(s,t,n,r){var l,d=(function(p,c){var h,v,S,f,x,E,T,C=(h=p==null?void 0:p.flushIntervalMs)!==null&&h!==void 0?h:3e3,y=(v=p==null?void 0:p.maxBufferSize)!==null&&v!==void 0?v:100,b=c!=null&&c.consoleCapture?void 0:(S=p==null?void 0:p.maxLogsPerInterval)!==null&&S!==void 0?S:1e3,m=Te(b)?Math.max(y,2048):Math.max(y,b),g=p==null?void 0:p.resourceAttributes;return{serviceName:(f=(x=g==null?void 0:g["service.name"])!==null&&x!==void 0?x:p==null?void 0:p.serviceName)!==null&&f!==void 0?f:c==null?void 0:c.serviceNameDefault,serviceVersion:(E=g==null?void 0:g["service.version"])!==null&&E!==void 0?E:p==null?void 0:p.serviceVersion,environment:(T=g==null?void 0:g["deployment.environment"])!==null&&T!==void 0?T:p==null?void 0:p.environment,resourceAttributes:g,beforeSend:p==null?void 0:p.beforeSend,flushIntervalMs:C,maxBufferSize:y,maxQueueSize:m,maxBatchRecordsPerPost:100,rateCapWindowMs:C,maxLogsPerInterval:b,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}})((l=this._instance)==null||(l=l.config)==null?void 0:l.logs,n);return[new IT(this.yl(s,t),d,this.it,(()=>this.bl()),(p=>p()),void 0,r),d]}_l(){var s,t=(s=this._instance)==null||(s=s.config)==null?void 0:s.logs;if(!this.pl||this.wl!==t){var n;(n=this.pl)==null||n.reset(),this.wl=t;var r=this.ml((()=>this.Gr),(l=>{this.Gr=l}));this.pl=r[0],this.xl=r[1]}return this.pl}kl(){var s,t=(s=this._instance)==null||(s=s.config)==null?void 0:s.logs;if(!this.gl||this.Sl!==t){var n;(n=this.gl)==null||n.reset(),this.Sl=t;var r=this.ml((()=>this.vl),(l=>{this.vl=l}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Ky);this.gl=r[0],this.Cl=r[1]}return this.gl}initialize(){this.loadIfEnabled()}onRemoteConfig(s){var t;if(s.ok){var n=(t=s.config.logs)==null?void 0:t.captureConsoleLogs;!et(n)&&n&&(this.dl=!0,this.loadIfEnabled())}}reset(){var s,t;this.Gr=[],(s=this.pl)==null||s.reset(),this.vl=[],(t=this.gl)==null||t.reset(),this.Js=0}captureLog(s){this._l().captureLog(s)}le(s){this.kl().captureLog(s)}get logger(){return this.Ml||(this.Ml={trace:(s,t)=>this.captureLog({body:s,level:"trace",attributes:t}),debug:(s,t)=>this.captureLog({body:s,level:"debug",attributes:t}),info:(s,t)=>this.captureLog({body:s,level:"info",attributes:t}),warn:(s,t)=>this.captureLog({body:s,level:"warn",attributes:t}),error:(s,t)=>this.captureLog({body:s,level:"error",attributes:t}),fatal:(s,t)=>this.captureLog({body:s,level:"fatal",attributes:t})}),this.Ml}flushLogs(s){s?this.Il(s):(this.pl&&this.pl.flush().catch((t=>this.it.error("PostHog logs flush failed:",t))),this.gl&&this.gl.flush().catch((t=>this.it.error("PostHog logs flush failed:",t))))}loadIfEnabled(){if(this.dl&&!this.cl){var s=He==null?void 0:He.__PosthogExtensions__;if(s){var t=s.loadExternalDependency;t?t(this._instance,"logs",(n=>{var r;n||(r=s.logs)==null||!r.initializeLogs?this.it.error("Could not load logs script",n):(s.logs.initializeLogs(this._instance),this.cl=!0)})):this.it.error(cv)}else this.it.error("PostHog Extensions not found.")}}yl(s,t){var n=this._instance;return{get isDisabled(){return!1},get optedOut(){return!n.is_capturing()},getPersistedProperty:r=>r===gn.LogsQueue?s():void 0,setPersistedProperty(r,l){var d;r===gn.LogsQueue&&t((d=l)!==null&&d!==void 0?d:[])},$t:r=>this.$t(r),getLibraryId:()=>Et.LIB_NAME,getLibraryVersion:()=>Et.LIB_VERSION}}$t(s){return new Promise((t=>{if(Fb(this.Js,3))t({kind:"fatal",error:new Error("logs endpoint is unreachable, dropping batch")});else{var n=!1,r=d=>{n||(n=!0,clearTimeout(l),t(d))},l=setTimeout((()=>r({kind:"retry-later",error:new Error("logs request timed out")})),9e4);this._instance._send_request({method:"POST",url:this.Tl(),data:s,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:d=>{var p=d.statusCode;if(this.El(p),p>=200&&300>p)r({kind:"ok"});else if(p===413)r({kind:"too-large"});else if(p!==0&&p!==429&&500>p)r({kind:"fatal",error:new Error("logs request failed with status "+p)});else{var c;r({kind:"retry-later",error:(c=d.error)!==null&&c!==void 0?c:new Error("logs request failed with status "+p)})}}})}}))}El(s){(s!==0||this._instance.__loaded)&&(this.Js=qb(s,this.Js,3,(()=>this.it.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."))))}Il(s){this.Gr.length>0&&this.Rl(s,this.Gr,this.xl,Et.LIB_NAME,(t=>{this.Gr=t})),this.vl.length>0&&this.Rl(s,this.vl,this.Cl,Ky,(t=>{this.vl=t}))}Rl(s,t,n,r,l){if(t.length!==0){var d=t.map((c=>c.record));l([]);var p=fb(d,db(n,Et.LIB_NAME,Et.LIB_VERSION),r,Et.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Tl(),data:p,compression:"best-available",batchKey:"logs",transport:s})}}Tl(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}bl(){var s,t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var n=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),r=n.windowId,l=n.sessionStartTimestamp,d=n.lastActivityTimestamp;t.sessionId=n.sessionId,t.windowId=r,et(l)||(t.sessionStartTimestamp=l),et(d)||(t.lastActivityTimestamp=d)}if(He!=null&&(s=He.location)!=null&&s.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?Qn(He.location.href):He.location.href),this._instance.featureFlags){var p=this._instance.featureFlags.getFlags();p&&p.length>0&&(t.activeFeatureFlags=p)}return t}}},LA={metrics:class{constructor(s){this.it=Jt("[metrics]"),this._instance=s}initialize(){}_l(){var s,t,n=(s=this._instance)==null||(s=s.config)==null?void 0:s.metrics;return this.pl&&this.wl===n||((t=this.pl)==null||t.reset(),this.wl=n,this.pl=new zT(this.yl(),(function(r){var l,d,p,c,h,v=r==null?void 0:r.resourceAttributes;return{serviceName:(l=v==null?void 0:v["service.name"])!==null&&l!==void 0?l:r==null?void 0:r.serviceName,serviceVersion:(d=v==null?void 0:v["service.version"])!==null&&d!==void 0?d:r==null?void 0:r.serviceVersion,environment:(p=v==null?void 0:v["deployment.environment"])!==null&&p!==void 0?p:r==null?void 0:r.environment,resourceAttributes:v,beforeSend:r==null?void 0:r.beforeSend,flushIntervalMs:(c=r==null?void 0:r.flushIntervalMs)!==null&&c!==void 0?c:1e4,maxSeriesPerFlush:(h=r==null?void 0:r.maxSeriesPerFlush)!==null&&h!==void 0?h:1e3}})(n),this.it)),this.pl}count(s,t,n){t===void 0&&(t=1),this._l().count(s,t,n)}gauge(s,t,n){this._l().gauge(s,t,n)}histogram(s,t,n){this._l().histogram(s,t,n)}flush(s){if(!this.pl)return Promise.resolve();if(s){var t=this.pl.drainWindow();return t&&this.Kt(t,s),Promise.resolve()}return this.pl.flush().catch((n=>this.it.error("PostHog metrics flush failed:",n)))}reset(){var s;(s=this.pl)==null||s.reset()}yl(){var s=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!s.is_capturing()},Kt:n=>t.Kt(n),getLibraryId:()=>Et.LIB_NAME,getLibraryVersion:()=>Et.LIB_VERSION}}Kt(s,t){return new Promise((n=>{var r=!1,l=p=>{r||(r=!0,clearTimeout(d),n(p))},d=setTimeout((()=>l({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(Ce({method:"POST",url:this.Pl(),data:s,compression:"best-available",batchKey:"metrics"},t&&{transport:t},{fireCallbackOnDrop:!0,callback(p){var c=p.statusCode;if(c>=200&&300>c)l({kind:"ok"});else if(c===413)l({kind:"too-large"});else if(c!==0&&c!==429&&500>c)l({kind:"fatal",error:new Error("metrics request failed with status "+c)});else{var h;l({kind:"retry-later",error:(h=p.error)!==null&&h!==void 0?h:new Error("metrics request failed with status "+c)})}}}))}))}Pl(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},OA=Ce({},Gu,xA,CA,EA,kA,TA,RA,AA,MA,jA,DA,NA,LA);Ti.__defaultExtensionClasses=Ce({},OA);var Ai=(function(){Et.SDK_DIST_CHANNEL="npm";var s=cl[Ca]=new Ti;return(function(){function t(){t.done||(t.done=!0,gS=!1,zt(cl,(function(n){n._dom_loaded()})))}De!=null&&De.addEventListener?De.readyState==="complete"?t():es(De,"DOMContentLoaded",t,{capture:!1}):ce&&Ae.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),s})();const Xy=120,BA=new Set(["attr__class","attr__id"]),HA=/attr__href="([^"]*)"/gi,IA=/(?:current_url|referrer|pathname)$/;function zA(s){const t=typeof s.surface=="string"?s.surface.toLowerCase():"",n=typeof s.object=="string"?s.object.toLowerCase():"";return/secret|vault|credential/.test(t)||/secret|vault|credential/.test(n)}function ul(s){if(typeof s!="string"||s.length===0)return s;let t;try{t=new URL(s)}catch{return s}return`${t.origin}${t.pathname}`}function _S(s){return s.length>Xy?`${s.slice(0,Xy)}…`:s}function $A(s,t){if(t){delete s.$el_text;for(const n of Object.keys(s))n.startsWith("attr__")&&!BA.has(n)&&delete s[n];return}typeof s.$el_text=="string"&&(s.$el_text=_S(s.$el_text)),typeof s.attr__href=="string"&&(s.attr__href=ul(s.attr__href))}function PA(s,t){const n=s.$elements;if(Array.isArray(n))for(const r of n)r&&typeof r=="object"&&$A(r,t);if(typeof s.$elements_chain=="string"){if(t){delete s.$elements_chain;return}s.$elements_chain=s.$elements_chain.replace(HA,(r,l)=>{const d=ul(l);return typeof d=="string"?`attr__href="${d}"`:r})}}function UA(s,t){t.$current_url=ul(t.$current_url),t.$referrer=ul(t.$referrer);for(const n of[s.$set,s.$set_once]){if(!n)continue;const r=n;for(const l of Object.keys(r))IA.test(l)&&(r[l]=ul(r[l]))}}function FA(s,t){typeof s.$el_text=="string"&&(t?delete s.$el_text:s.$el_text=_S(s.$el_text)),PA(s,t)}function qA(s){if(!s)return s;try{const t=s.properties??{},n=zA(t);return UA(s,t),FA(t,n),s.properties=t,s}catch{return s}}function WA(s){if(!s)return"unknown";if(s.settingsOpen)return"account";if(s.firstRun&&!s.hasLiveSession)return"onboarding";if(s.templatesOpen)return"agent_build";if(s.hasLiveSession){const t=s.rightTab??"";return t==="logs"||t==="diff"?"agent_observe":t==="canvas"||t==="preview"?"agent_operate":"agent_build"}return s.inspectingDeadSession?"agent_observe":"unknown"}function Nr(s,t){try{Ai.capture(s,t)}catch{}}function GA(s){try{const t={};for(const[n,r]of Object.entries(s))r!=null&&r!==""&&(t[n]=r);Ai.register(t)}catch{}}function VA(s){try{const t=WA(s);Ai.register({journey:t,view:YA(s)})}catch{}}function YA(s){return s.settingsOpen?"settings":s.firstRun&&!s.hasLiveSession?"welcome":s.templatesOpen?"templates":s.hasLiveSession?`workbench:${s.rightTab??"chat"}`:s.inspectingDeadSession?"session_history":"unknown"}function KA(){if(typeof window>"u")return null;const s=window.__HARNESS__,t=s==null?void 0:s.posthog;return t!=null&&t.key?t:null}function XA(s){return s.consentSource==="env-forced-off"}function yS(s){return!XA(s)&&s.productAnalyticsOptIn}let hl=!1;function JA(s){if(hl){Pf(s),Ff(s);return}const t=KA();if(t&&yS(s)){if(Ai.__loaded){hl=!0,Pf(s),Ff(s);return}Ai.init(t.key,{api_host:t.apiHost,ui_host:t.uiHost,capture_pageview:!0,capture_pageleave:!0,autocapture:!0,enable_heatmaps:!0,capture_dead_clicks:!0,before_send:qA,persistence:"localStorage",disable_session_recording:!0}),hl=!0,Pf(s),Ff(s)}}function Pf(s){if(hl)try{yS(s)?Ai.has_opted_out_capturing()&&Ai.opt_in_capturing():Ai.has_opted_out_capturing()||Ai.opt_out_capturing()}catch{}}let Uf=null;function Ff(s){if(hl)try{if(s.authenticated&&s.userId){Uf=s.userId,Ai.identify(s.userId),s.tenantId&&Ai.group("organization",s.tenantId,{...s.organizationName?{name:s.organizationName}:{}}),GA({active_organization_id:s.tenantId??void 0,app_version:s.version});return}Uf&&(Uf=null,Ai.reset())}catch{}}function ZA(s){return[`Add human-readable descriptions to the "${s.name}" agent so its Sapiom canvas explains what each part does.`,"",`Edit the agent definition file(s) under ${s.path} (the entry is usually index.ts):`,"1. Give the defineAgent({ ... }) call a one-line `description` summarizing what the whole agent does.","2. Give every defineStep({ ... }) a one-line `description` of what that step does — infer it from the step's own code: its input, the Sapiom services it calls, and where it transitions.","","Rules:","- One sentence each, at most ~120 characters, present tense, plain language — don't just restate the step's name.","- Edit the source ONLY: add or refine `description` fields and nothing else. Do not change logic, control flow, imports, or other fields.","- Run NO commands — no npm/pnpm, no build, no tests, no git. Just make the edits and save. (The `description` field is supported by @sapiom/agent 0.7.0+, which this project already uses.)","- When the edits are saved you're done — the Sapiom canvas re-renders automatically, with no further step."].join(`
|
|
470
|
-
`)}const QA={entries:[],index:-1};function eR(s,t){return s.kind!==t.kind?!1:s.kind==="session"&&t.kind==="session"?s.sessionId===t.sessionId:s.kind==="agent"&&t.kind==="agent"?s.agentPath===t.agentPath:s.kind==="review"&&t.kind==="review"?s.summary.agentSessionId===t.summary.agentSessionId:s.kind===t.kind}function bS(s){return s.index>0}function SS(s){return s.index>=0&&s.index<s.entries.length-1}function tR(s,t){const n=s.index>=0?s.entries[s.index]:null;if(n&&eR(n,t)){if(JSON.stringify(n)===JSON.stringify(t))return s;const d=[...s.entries];return d[s.index]=t,{...s,entries:d}}const l=[...s.entries.slice(0,s.index+1),t].slice(-50);return{entries:l,index:l.length-1}}function sR(s,t){if(!(t==="back"?bS(s):SS(s)))return{state:s,visit:null};const r=t==="back"?s.index-1:s.index+1;return{state:{...s,index:r},visit:s.entries[r]??null}}function iR(){const[s,t]=H.useState(QA),n=H.useRef(s);n.current=s;const r=H.useCallback(d=>{const p=tR(n.current,d);p!==n.current&&(n.current=p,t(p))},[]),l=H.useCallback(d=>{const p=sR(n.current,d);return p.visit?(n.current=p.state,t(p.state),p.visit):null},[]);return{canGoBack:bS(s),canGoForward:SS(s),record:r,goBack:()=>l("back"),goForward:()=>l("forward")}}const wS="(max-width: 768px)";function Bp(){return typeof window<"u"&&window.matchMedia(wS).matches}function nR(s){const t=window.matchMedia(wS);return t.addEventListener("change",s),()=>t.removeEventListener("change",s)}function rR(){return H.useSyncExternalStore(nR,Bp,()=>!1)}const xS="sapiom-harness-pane-widths",gv=180,CS=480,Hp=320,wl=320,ES=720;function Ip(s,t,n){return Math.min(Math.max(s,t),n)}function aR(){const s={rail:Hp,canvas:null};if(typeof window>"u")return s;try{const t=window.localStorage.getItem(xS);if(!t)return s;const n=JSON.parse(t);return{rail:Ip(typeof n.rail=="number"?n.rail:Hp,gv,CS),canvas:typeof n.canvas=="number"?Ip(n.canvas,wl,ES):null}}catch{return s}}function Jy(s){window.localStorage.setItem(xS,JSON.stringify(s))}function oR(){const[s,t]=H.useState(aR),[n,r]=H.useState(!1),[l,d]=H.useState(!1),p=(h,v,S,f,x,E)=>T=>{const C=T.currentTarget;C.setPointerCapture(T.pointerId),E==null||E(!0);const y=T.clientX,b=x(),m=k=>{const M=Ip(b+(k.clientX-y)*v,S,f);t(R=>R[h]===M?R:{...R,[h]:M})},g=()=>{C.removeEventListener("pointermove",m),C.removeEventListener("pointerup",g),E==null||E(!1),t(k=>(Jy(k),k))};C.addEventListener("pointermove",m),C.addEventListener("pointerup",g)},c=(h,v)=>{t(S=>{const f={...S,[h]:v};return Jy(f),f})};return{widths:s,canvasResizing:n,railResizing:l,startRailDrag:p("rail",1,gv,CS,()=>s.rail,d),startCanvasDrag:p("canvas",-1,wl,ES,()=>{if(s.canvas!=null)return s.canvas;const h=document.querySelector(".canvas-pane");return h?h.getBoundingClientRect().width:wl},r),resetRail:()=>{d(!0),c("rail",Hp),window.setTimeout(()=>d(!1),0)},resetCanvas:()=>{r(!0),c("canvas",null),window.setTimeout(()=>r(!1),0)}}}function Ds(s,t="error"){return{message:s,tone:t}}const lR=2e3;function cR(s){const t=new URL("/ws/events",window.location.href);t.protocol=t.protocol==="https:"?"wss:":"ws:",t.searchParams.set("token",Aa());let n=null,r=null,l=!1;const d=()=>{n=new WebSocket(t),n.addEventListener("message",p=>{try{s(JSON.parse(p.data))}catch{}}),n.addEventListener("close",()=>{l||(r=setTimeout(d,lR))})};return d(),()=>{l=!0,r&&clearTimeout(r),n==null||n.close()}}function Zy(s){const t=s.split(/[\\/]/).filter(Boolean);return t[t.length-1]??s}function uR(s,t){const n=[];for(const r of t)s.has(r.path)||n.push(r.path);return n}function Qy(s,t){return t?"exception":s==="linking"?"link_failed":"build_failed"}function dl(s){return typeof s=="string"&&s!==""?s:void 0}function hR(s){if(dl(s.templateId))return"template";const t=dl(s.starterId);return t&&t!=="default"?"starter":dl(s.forkId)?"fork":"scratch"}function e1(s){if(!s)return{};const t=hR(s);return t==="template"?{source:t,template_id:dl(s.templateId)}:t==="starter"?{source:t,template_id:dl(s.starterId)}:{source:t}}const t1=4e3;function dR(s){if(typeof s=="string")return s;if(s!==null&&typeof s=="object"){const t=s,n=[t.ts,t.level,t.msg??t.message].filter(r=>typeof r=="string"||typeof r=="number");if(n.length>0)return n.map(String).join(" ")}return String(s)}function fR(s){if(!Array.isArray(s)||s.length===0)return;const t=s.map(dR).join(`
|
|
471
|
-
`).trim();if(t!=="")return t.length>t1?t.slice(t.length-t1):t}function pR(s){return s==="succeeded"?"passed":s==="threw"?"failed":"pending"}function vR(s){return s==="completed"?"completed":s==="failed"?"failed":"running"}function mR(s){var r;const t={id:`${s.step}-${s.attempt}`,name:s.step,status:pR(s.status)};s.input!==void 0&&(t.input=s.input),s.output!==void 0&&(t.output=s.output),(r=s.error)!=null&&r.message&&(t.error=s.error.message);const n=fR(s.logs);return n!==void 0&&(t.logSlice=n),s.calls&&s.calls.length>0&&(t.calls=s.calls.map(l=>({capability:l.capability,stubUsed:l.stubUsed,args:l.args,result:l.result}))),t}function gR(s,t={}){const n={executionId:t.executionId??"",status:vR(t.outcome),steps:s.map(mR),stubbed:!0};return t.unusedStubs&&t.unusedStubs.length>0&&(n.unusedStubs=t.unusedStubs),t.stubWarnings&&t.stubWarnings.length>0&&(n.stubWarnings=t.stubWarnings),n}const Ht=a1(),_R=3e3,yR=8;function bR(){const[s,t]=H.useState(null),[n,r]=H.useState(null),l=H.useRef(null);l.current=n;const d=H.useRef([]);d.current=(s==null?void 0:s.workflows)??[];const[p,c]=H.useState(!0),[h,v]=H.useState(null),[S,f]=H.useState(null),[x,E]=H.useState(0),[T,C]=H.useState(null),[y,b]=H.useState(null),[m,g]=H.useState([]),[k,M]=H.useState(null),[R,j]=H.useState(!1),A=H.useRef(new Map),D=H.useRef(0),I=H.useRef(new Map),[q,G]=H.useState(null),[U,X]=H.useState(new Set),[se,F]=H.useState([]),Q=H.useRef(new Map),[J,O]=H.useState(new Map),[B,N]=H.useState(new Map),[z,W]=H.useState(new Map),Z=H.useRef(new Map),[ue,ge]=H.useState(new Map),[Y,$]=H.useState(new Map),[oe,ae]=H.useState(new Map),xe=H.useCallback((te,pe)=>{ae(ye=>{if(pe===null){if(!ye.has(te))return ye;const _e=new Map(ye);return _e.delete(te),_e}return new Map(ye).set(te,pe)})},[]),[Ee,Ue]=H.useState([]),Ye=H.useCallback(te=>{Ue(pe=>pe.some(ye=>ye.cwd===te)?pe:[{cwd:te,sessionSeen:!1},...pe])},[]),Ke=H.useCallback(te=>{Ue(pe=>pe.some(ye=>ye.cwd===te)?pe.filter(ye=>ye.cwd!==te):pe)},[]);H.useEffect(()=>{if(Ee.length===0)return;const te=(s==null?void 0:s.sessions)??[],pe=(s==null?void 0:s.workflows)??[],ye=(_e,ke)=>Gp(ke,_e);Ue(_e=>{let ke=!1;const Fe=[];for(const We of _e){if(pe.some(_t=>ye(_t.path,We.cwd))){ke=!0;continue}const Tt=te.some(_t=>_t.status!=="exited"&&ye(_t.cwd,We.cwd));if(We.sessionSeen&&!Tt){ke=!0;continue}if(Tt&&!We.sessionSeen){Fe.push({...We,sessionSeen:!0}),ke=!0;continue}Fe.push(We)}return ke?Fe:_e})},[s==null?void 0:s.sessions,s==null?void 0:s.workflows,Ee]);const[st,Oe]=H.useState(0),Dt=H.useCallback(()=>{Oe(te=>te+1)},[]),pt=H.useRef(0),xt=H.useCallback(te=>{pt.current+=1,b(te)},[]),gt=H.useRef([]),ss=H.useCallback(te=>{Ht.getRunState(te).then(pe=>O(ye=>{const _e=ye.get(te);return _e?new Map(ye).set(te,{..._e,run:pe}):ye})).catch(()=>{})},[]),ht=H.useCallback((te,pe,ye)=>{const _e=Z.current.get(te);_e&&clearInterval(_e);const ke=Ta(gt.current.find(dt=>dt.id===te)),Fe=Date.now();N(dt=>{const Tt=dt.get(te)??[];return Tt.includes(pe)?dt:new Map(dt).set(te,[...Tt,pe])}),W(dt=>{if(!dt.has(te))return dt;const Tt=new Map(dt);return Tt.delete(te),Tt});const We=async()=>{try{const dt=await Ht.getRunState(pe);if(O(Tt=>new Map(Tt).set(pe,{run:dt,target:ye,workflowPath:ke,observedAt:Fe})),dt.status!=="running"){const Tt=Z.current.get(te);Tt&&clearInterval(Tt),Z.current.delete(te)}}catch{const dt=Z.current.get(te);dt&&clearInterval(dt),Z.current.delete(te)}};We(),Z.current.set(te,setInterval(()=>void We(),2e3))},[]),vt=H.useRef(0),Ct=H.useCallback(async(te,pe,ye)=>{vt.current+=1;const _e=`local-${Date.now()}-${vt.current}`,ke=Ta(gt.current.find(Re=>Re.id===te)),Fe=Date.now(),We=[];let dt,Tt,_t;N(Re=>{const at=Re.get(te)??[];return at.includes(_e)?Re:new Map(Re).set(te,[...at,_e])}),W(Re=>{if(!Re.has(te))return Re;const at=new Map(Re);return at.delete(te),at});const de=()=>{const Re=gR(We,{executionId:_e,outcome:dt,unusedStubs:Tt,stubWarnings:_t});O(at=>new Map(at).set(_e,{run:Re,target:"local",workflowPath:ke,observedAt:Fe}))};de();const Me=Re=>{Re.kind==="summary"?(dt=Re.outcome,Tt=Re.unusedStubs,_t=Re.stubWarnings):Re.kind==="error"?(dt="failed",We.push({step:"run-local",attempt:1,input:ye,status:"threw",error:{name:"RunLocalError",message:Re.error},logs:[]})):We.push(Re),de()};try{await Ht.runLocal({sourceDir:pe,input:ye},Me)}catch(Re){dt="failed",de(),M(Ds(Re instanceof di&&Re.reason?Re.reason:Re.message))}finally{Dt()}},[Dt]),$t=H.useCallback((te,pe)=>{W(ye=>new Map(ye).set(te,pe)),ss(pe)},[ss]),ds=H.useMemo(()=>{const te=new Map;return B.forEach((pe,ye)=>{const _e=z.get(ye),ke=_e&&pe.includes(_e)?_e:pe[pe.length-1],Fe=ke?J.get(ke):void 0;Fe&&te.set(ye,Fe)}),te},[B,z,J]);H.useEffect(()=>{gt.current=(s==null?void 0:s.sessions)??[]},[s]),H.useEffect(()=>{const te=Z.current;return()=>{te.forEach(pe=>clearInterval(pe)),te.clear()}},[]),H.useEffect(()=>{const te=Q.current;return()=>{te.forEach(pe=>clearTimeout(pe)),te.clear()}},[]);const mt=H.useRef(null);H.useEffect(()=>{let te=!1;return x>0&&(c(!0),v(null),f(null)),Promise.all([Ht.getState(),Ht.getSettings()]).then(([pe,ye])=>{if(te)return;t(pe);const _e=mt.current??(mt.current=new Set);for(const Fe of pe.workflows)_e.add(Fe.path);r(ye),f(null),pe.tasks&&F(pe.tasks);const ke=pe.sessions.find(Fe=>Fe.status!=="exited");ke&&b(ke.id),pe.workflows[0]&&C(pe.workflows[0].path)}).catch(pe=>{te||(v(pe.message),f(pe instanceof di?{status:pe.status}:{networkError:!0}))}).finally(()=>!te&&c(!1)),()=>{te=!0}},[x]);const fs=H.useCallback(()=>E(te=>te+1),[]);H.useEffect(()=>{if(!y)return;const te=s==null?void 0:s.sessions.find(pe=>pe.id===y);C(Ta(te)??null)},[y]);const $e=H.useCallback(async()=>{const te=await Ht.listWorkflows();return t(pe=>pe&&{...pe,workflows:te}),te},[]);H.useEffect(()=>cR(te=>{if(G(te),te.type==="session.status"){if(t(pe=>{if(!pe)return pe;const _e=pe.sessions.some(ke=>ke.id===te.session.id)?pe.sessions.map(ke=>ke.id===te.session.id?te.session:ke):[...pe.sessions,te.session];return{...pe,sessions:_e}}),te.session.status==="exited"){const pe=te.session.id,ye=Q.current.get(pe);ye&&(clearTimeout(ye),Q.current.delete(pe)),X(_e=>{if(!_e.has(pe))return _e;const ke=new Set(_e);return ke.delete(pe),ke})}}else if(te.type==="workflows.changed")$e().then(pe=>{const ye=mt.current;if(ye===null){mt.current=new Set(pe.map(_e=>_e.path));return}for(const _e of uR(ye,pe))ye.add(_e),Nr("agent.created",{workflow_slug:Zy(_e),...e1(pe.find(ke=>ke.path===_e))})});else if(te.type==="execution.started")ht(te.harnessSessionId,te.executionId,te.target);else if(te.type==="port.detected")ge(pe=>new Map(pe).set(te.harnessSessionId,{port:te.port,url:te.url}));else if(te.type==="task.status")F(pe=>pe.some(_e=>_e.id===te.task.id)?pe.map(_e=>_e.id===te.task.id?te.task:_e):[...pe,te.task]);else if(te.type==="session.activity"){const pe=te.harnessSessionId;X(_e=>_e.has(pe)?_e:new Set(_e).add(pe));const ye=Q.current.get(pe);ye&&clearTimeout(ye),Q.current.set(pe,setTimeout(()=>{Q.current.delete(pe),X(_e=>{if(!_e.has(pe))return _e;const ke=new Set(_e);return ke.delete(pe),ke})},_R))}else te.type==="auth.changed"&&(t(pe=>pe&&{...pe,authenticated:te.authenticated,organizationName:te.organizationName}),$e())}),[$e,ht]);const Ss=H.useCallback(async te=>{const pe=Array.from(new Set(te)),ye=pe.map(_e=>{const ke=A.current.get(_e);if(ke)return ke;const Fe=Ht.sessionHistory(_e).finally(()=>{A.current.delete(_e)});return A.current.set(_e,Fe),Fe});D.current+=1,j(!0);try{const _e=await Promise.allSettled(ye),ke=[],Fe=new Set;_e.forEach((We,dt)=>{We.status==="fulfilled"&&(Fe.add(pe[dt]),ke.push(...We.value))}),g(We=>m3(We,ke,Fe))}finally{D.current-=1,D.current===0&&j(!1)}},[]),nt=H.useCallback(async te=>{var _e;const pe=await Ht.createSession(te);t(ke=>ke&&!ke.sessions.some(Fe=>Fe.id===pe.id)?{...ke,sessions:[...ke.sessions,pe]}:ke),xt(pe.id);const ye=[te.cwd,...(((_e=l.current)==null?void 0:_e.recentDirs)??[]).filter(ke=>ke!==te.cwd)].slice(0,yR);r(ke=>ke&&{...ke,recentDirs:ye});try{const ke=await Ht.updateSettings({recentDirs:ye});r(Fe=>Fe&&{...Fe,recentDirs:ke.recentDirs})}catch{}return pe},[xt]),Cs=H.useCallback(()=>Ht.listTemplates(),[]),qt=H.useCallback(te=>Ht.getTemplate(te),[]),Nt=H.useCallback(te=>Ht.sessionRecord(te),[]),kt=H.useCallback(async te=>{const pe=pt.current;try{const ye=await Ht.resumeSession(te);return t(_e=>_e&&{..._e,sessions:_e.sessions.map(ke=>ke.id===ye.id?ye:ke)}),pt.current===pe&&xt(ye.id),ye}catch(ye){throw M(Ds(ye instanceof di&&ye.reason?ye.reason:ye.message)),ye}},[xt]),si=H.useCallback(async({cwd:te,harness:pe,from:ye})=>{const _e=await nt({cwd:te,harness:pe,rehydrateFrom:ye});return _e.rehydratedFrom||M(Ds("Nothing was recorded for that session, so this one starts fresh.","info")),_e},[nt]),ps=H.useCallback(async te=>{var ye;const pe=te.harnessSessionId??((ye=s==null?void 0:s.sessions.find(_e=>_e.agentSessionId===te.agentSessionId))==null?void 0:ye.id);if(te.resumeMode==="rehydrate")return si({cwd:te.cwd,harness:te.harness,from:pe??te.agentSessionId});if(pe)return kt(pe);try{const _e=await Ht.adoptSession({agentSessionId:te.agentSessionId,harness:te.harness,cwd:te.cwd,title:te.title,lastActiveAt:te.lastActiveAt});return t(ke=>{if(!ke)return ke;const Fe=ke.sessions.some(We=>We.id===_e.id)?ke.sessions.map(We=>We.id===_e.id?_e:We):[...ke.sessions,_e];return{...ke,sessions:Fe}}),xt(_e.id),_e}catch(_e){throw M(Ds(_e instanceof di&&_e.reason?_e.reason:_e.message)),_e}},[s,kt,si,xt]),mi=H.useCallback(async te=>{try{await Ht.killSession(te)}catch(ye){throw M(Ds(ye instanceof di&&ye.reason?ye.reason:ye.message)),ye}const pe=((s==null?void 0:s.sessions)??[]).filter(ye=>ye.id!==te);if(t(ye=>ye&&{...ye,sessions:pe}),y===te){const ye=pe.find(_e=>_e.status!=="exited");xt(ye?ye.id:null)}},[s,y,xt]),$s=H.useCallback(async te=>{const pe=await Ht.connectWorkflow(te);return t(ye=>ye&&{...ye,workflows:[...ye.workflows.filter(_e=>_e.path!==pe.path),pe]}),(mt.current??(mt.current=new Set)).add(pe.path),pe},[]),ii=H.useCallback(async te=>{const pe=await Ht.scanWorkflows(te),ye=await $e(),_e=mt.current??(mt.current=new Set);for(const ke of ye)_e.add(ke.path);return pe},[$e]),Vs=H.useCallback(()=>Ht.listHarnesses(),[]),Ie=H.useCallback(async(te,pe)=>{const ye=await Ht.bindWorkflow(te,pe);t(_e=>_e&&{..._e,sessions:_e.sessions.map(ke=>ke.id===ye.id?ye:ke)})},[]),tt=H.useCallback(async te=>{const pe=await Ht.updateSettings(te);return r(pe),te.telemetryOptIn!==void 0&&t(ye=>ye&&{...ye,telemetryOptIn:pe.telemetryOptIn}),te.productAnalyticsOptIn!==void 0&&t(ye=>ye&&{...ye,productAnalyticsOptIn:pe.productAnalyticsOptIn!==!1}),pe},[]),Wt=H.useCallback(async(te,pe)=>{try{await Ht.runMacro(te,pe)}catch(ye){M(Ds(ye instanceof di&&ye.reason?ye.reason:ye.message))}},[]),is=H.useCallback(te=>{const pe=I.current.get(te);if(pe)return pe;const ye=(async()=>{M(Ds("Deploying…","info"));const _e=Zy(te),ke=e1(d.current.find(_t=>_t.path===te)),Fe=performance.now();Nr("agent.deploy_started",{workflow_slug:_e,...ke});let We=null,dt=null,Tt=!1;try{const _t=await Ht.deploy(te,de=>{de.phase==="linking"?(We="linking",xe(te,{phase:"linking"}),M(Ds(`Deploying — creating the agent "${de.name}" on Sapiom…`,"info"))):de.phase==="warning"?(dt=de.message,M(Ds(de.message))):de.phase==="building"&&(We="building",xe(te,{phase:"building"}),M(Ds("Deploying — building on Sapiom…","info")),$e())});if(_t.phase==="ready")xe(te,{phase:"ready"}),Nr("agent.deploy_succeeded",{workflow_slug:_e,duration_ms:Math.round(performance.now()-Fe),...ke}),Tt=!0,M(dt?Ds(`Deployed to Sapiom. ${dt}`):Ds("Deployed to Sapiom.","success")),$(de=>{if(!de.has(te))return de;const Me=new Map(de);return Me.delete(te),Me}),await $e();else if(_t.phase==="error"){const de=We==="linking"?"Couldn't create the agent":"Deploy failed",Me=_t.hint?`${de}: ${_t.message} (${_t.hint})`:`${de}: ${_t.message}`;xe(te,{phase:"error",message:Me}),Nr("agent.deploy_failed",{workflow_slug:_e,error_kind:Qy(We,!1),...ke}),Tt=!0,M(Ds(Me)),$(Re=>new Map(Re).set(te,Me)),await $e()}}catch(_t){const de=_t instanceof di&&_t.reason?_t.reason:_t.message;xe(te,{phase:"error",message:de}),Tt||Nr("agent.deploy_failed",{workflow_slug:_e,error_kind:Qy(We,!0),...ke}),M(Ds(de)),$(Me=>new Map(Me).set(te,de))}finally{Dt(),I.current.delete(te)}})();return I.current.set(te,ye),ye},[$e,Dt,xe]),ws=H.useCallback(async(te,pe,ye)=>{try{const{executionId:_e}=await Ht.run({definitionId:pe,input:ye});ht(te,_e,"prod")}catch(_e){M(Ds(_e instanceof di&&_e.reason?_e.reason:_e.message))}finally{Dt()}},[ht,Dt]),Bs=H.useCallback(async()=>Ht.startAuth(),[]),we=H.useCallback(async()=>{try{await Ht.disconnect()}catch(te){M(Ds(te instanceof di&&te.reason?te.reason:te.message))}},[]),Xe=H.useCallback(()=>M(null),[]),ts=H.useCallback(async(te,pe)=>{await Ht.injectInput(te,{text:pe,submit:!0})},[]),Es=H.useCallback((te,pe="error")=>{M(Ds(te,pe))},[]),ni=H.useCallback(te=>Y.get(te)??null,[Y]),Ii=H.useCallback(te=>Ht.listDir(te),[]);return{state:s,loading:p,error:h,errorKind:S,reload:fs,settings:n,bootToken:Aa(),selectedWorkflowPath:T,setSelectedWorkflowPath:C,activeSessionId:y,setActiveSessionId:xt,history:m,historyLoading:R,loadHistory:Ss,createSession:nt,listTemplates:Cs,getTemplate:qt,sessionRecord:Nt,resumeSession:kt,rehydrateSession:si,resumeFromHistory:ps,closeSession:mi,connectWorkflow:$s,scanWorkflows:ii,listHarnesses:Vs,bindWorkflow:Ie,updateSettings:tt,runMacro:Wt,deploy:is,startProdRun:ws,runLocal:Ct,injectInput:ts,showToast:Es,lastDeployErrorFor:ni,deployStateByPath:oe,dismissDeployState:te=>xe(te,null),pendingWorkspaces:Ee,addPendingWorkspace:Ye,removePendingWorkspace:Ke,directActionSettleSeq:st,listDir:Ii,lastMessage:q,runsBySession:ds,runsByExecution:J,runIdsBySession:B,selectRun:$t,previewBySession:ue,toast:k,dismissToast:Xe,busySessionIds:U,tasks:se,api:Ht,startAuth:Bs,disconnect:we}}const SR=10*6e4,wR=4e3;function Jo(s,t){return t?s.filter(n=>n.status!=="exited"&&(m0(n.boundWorkflowPath??"",t)||n.boundWorkflowPath==null&&m0(n.cwd,t))).sort((n,r)=>n.createdAt.localeCompare(r.createdAt)||n.id.localeCompare(r.id)):[]}const xR=()=>{var Ps,Ua,El,Ir,Fa,nr,kl,Us,zr,qa,$r,Yi,Wa,Ga,Ki,Tl,Va,Ya,Pr,Al,Rl;const s=bR(),t=uT(),[n,r]=H.useState(!1),[l,d]=H.useState(!1),[p,c]=H.useState(null),h=H.useRef(null),v=H.useRef(null),S=H.useRef(hT()),f=H.useRef(!1),x=H.useRef(null),[E,T]=H.useState(null),[C,y]=H.useState(null),[b,m]=H.useState(!1),[g,k]=H.useState(()=>{const V=Gi().rightTab;return V==="canvas"||V==="steps"||V==="code"?V:"canvas"}),[M,R]=H.useState(g==="code"),[j,A]=H.useState(null),[D,I]=H.useState(!1),[q,G]=H.useState(!1),[U,X]=H.useState(()=>Gi().sessionNames??{}),se=(V,ve)=>{X(je=>{const Ve={...je},yt=ve.trim();return yt?Ve[V]=yt:delete Ve[V],xn({sessionNames:Ve}),Ve})},F=H.useRef(new Map),Q=H.useRef([]),J=H.useCallback(V=>{const ve=F.current.get(V);if(ve)return window.clearTimeout(ve.timer),window.clearTimeout(ve.hintTimer),F.current.delete(V),ve},[]),O=H.useCallback(V=>{const ve=F.current.get(V);if(!ve)return;const je=Q.current.find(Ve=>Ve.id===V);je&&(je.ready?(J(V),s.injectInput(V,ve.prompt).catch(()=>s.showToast(ve.failMessage))):je.status==="exited"&&(J(V),s.showToast(ve.failMessage)))},[J,s.injectInput,s.showToast]),B=H.useCallback((V,ve,je)=>{J(V);const Ve=window.setTimeout(()=>{J(V)&&s.showToast(je)},SR),yt=window.setTimeout(()=>{F.current.has(V)&&s.showToast("Sign in to Claude in the terminal — your prompt sends automatically once you're signed in.")},wR);F.current.set(V,{prompt:ve,failMessage:je,timer:Ve,hintTimer:yt}),O(V)},[J,s.showToast,O]);H.useEffect(()=>{var V;if(Q.current=((V=s.state)==null?void 0:V.sessions)??[],F.current.size!==0)for(const ve of[...F.current.keys()])O(ve)},[(Ps=s.state)==null?void 0:Ps.sessions,O]);const[N,z]=H.useState(()=>Bp()||(Gi().railCollapsed??!1)),[W,Z]=H.useState(()=>Bp()||(Gi().rightCollapsed??!1)),[ue,ge]=H.useState(!1),Y=rR(),$=iR(),{widths:oe,canvasResizing:ae,railResizing:xe,startRailDrag:Ee,startCanvasDrag:Ue,resetRail:Ye,resetCanvas:Ke}=oR(),[st,Oe]=H.useState(!1),Dt=H.useRef(!1),pt=H.useRef(null),xt=H.useRef(null),gt=H.useRef(!1),ss=H.useRef(!1),ht=H.useRef(null),vt=H.useRef(null),Ct=H.useCallback(V=>{V&&!Dt.current&&V.style.setProperty("--rp-w",`${V.offsetWidth}px`)},[]),$t=H.useCallback(V=>{var je;if((je=vt.current)==null||je.disconnect(),ht.current=V,!V){vt.current=null;return}const ve=new ResizeObserver(()=>{ss.current||Ct(V)});ve.observe(V),vt.current=ve},[Ct]);Dt.current=W,ss.current=st,H.useLayoutEffect(()=>{if(Y)return;Oe(!0);const V=window.setTimeout(()=>{Oe(!1),Ct(ht.current)},260);return()=>window.clearTimeout(V)},[W,Y,Ct]),H.useEffect(()=>{const V=ve=>{var Ve;const je=ve.key.toLowerCase();if((ve.metaKey||ve.ctrlKey)&&(je==="k"||je==="p")){ve.preventDefault(),r(!0);return}if((ve.metaKey||ve.ctrlKey)&&/^[1-9]$/.test(ve.key)){const rs=Jo(((Ve=s.state)==null?void 0:Ve.sessions)??[],p)[Number(ve.key)-1];rs&&(ve.preventDefault(),d(!1),A(null),I(!1),G(!1),s.setActiveSessionId(rs.id))}};return window.addEventListener("keydown",V),()=>window.removeEventListener("keydown",V)},[(Ua=s.state)==null?void 0:Ua.sessions,p]);const ds=Zk({settingsRoot:(El=s.settings)==null?void 0:El.projectRoot,defaultProjectRoot:(Ir=s.state)==null?void 0:Ir.defaultProjectRoot,launchDir:(Fa=s.state)==null?void 0:Fa.launchDir}),mt=async V=>{await s.updateSettings({projectRoot:V})};H.useEffect(()=>{var ve;if(!n||!s.state)return;const V=E1(s.state.sessions,((ve=s.settings)==null?void 0:ve.recentDirs)??[],s.activeSessionId);V.length>0&&s.loadHistory(V)},[n]);const fs=H.useRef(!1);H.useEffect(()=>{var ve;if(fs.current||!s.state)return;fs.current=!0;const V=s.state.sessions.find(je=>je.id===s.activeSessionId);c(Ta(V)??((ve=s.state.workflows[0])==null?void 0:ve.path)??null)},[s.state,s.activeSessionId]);const $e=s.state;H.useEffect(()=>{$e&&JA($e)},[$e,$e==null?void 0:$e.authenticated,$e==null?void 0:$e.userId,$e==null?void 0:$e.tenantId,$e==null?void 0:$e.consentSource,$e==null?void 0:$e.productAnalyticsOptIn,$e==null?void 0:$e.version]),H.useEffect(()=>{if(!$e)return;const V=$e.sessions.find(je=>je.id===s.activeSessionId),ve={firstRun:$e.firstRun===!0,settingsOpen:b,templatesOpen:D,hasLiveSession:$e.sessions.some(je=>je.status!=="exited"),inspectingDeadSession:(V==null?void 0:V.status)==="exited",rightTab:g};VA(ve)},[$e,s.activeSessionId,b,D,g]);const Ss=H.useRef(Y);H.useEffect(()=>{Ss.current!==Y&&(Ss.current=Y,z(Y),Z(Y))},[Y]),H.useEffect(()=>{Y||xn({railCollapsed:N,rightCollapsed:W})},[N,W,Y]),H.useEffect(()=>{xn({rightTab:g})},[g]);const nt=$.record,Cs=s.activeSessionId,qt=p!=null&&Jo(((nr=s.state)==null?void 0:nr.sessions)??[],p).length>0,Nt=H.useRef(!1);H.useEffect(()=>{if(Nt.current){Nt.current=!1;return}D?nt({kind:"templates"}):j?nt({kind:"review",summary:j}):l?nt({kind:"composer"}):Cs&&(p==null||qt)?nt({kind:"session",sessionId:Cs,agentPath:p}):p&&nt({kind:"agent",agentPath:p})},[nt,D,j,l,Cs,p,qt]);const kt=s.setActiveSessionId,si=H.useCallback(V=>{V&&(Nt.current=!0,G(!1),I(V.kind==="templates"),d(V.kind==="composer"),A(V.kind==="review"?V.summary:null),V.kind==="session"?(c(V.agentPath),kt(V.sessionId)):V.kind==="agent"&&c(V.agentPath))},[kt]),ps=((kl=s.state)==null?void 0:kl.sessions.find(V=>V.id===s.activeSessionId&&V.status==="exited"))??null,mi=ps!=null&&ps.agentSessionId?(Us=s.history.find(V=>V.agentSessionId===ps.agentSessionId))==null?void 0:Us.resumeMode:"rehydrate",$s=(ps==null?void 0:ps.agentSessionId)!=null&&mi===void 0?ps.cwd:null,ii=s.loadHistory;H.useEffect(()=>{$s&&ii([$s])},[$s,ii]);const Vs=H.useRef(new Map);if(H.useEffect(()=>{for(const V of s.tasks){if(V.macroId!=="describe")continue;Vs.current.get(V.id)==="running"&&V.status!=="running"&&s.showToast(V.status==="failed"?"Couldn't generate descriptions — check the agent terminal for details.":"Describe run finished — the canvas updates if the agent changed the source.",V.status==="failed"?"error":"success"),Vs.current.set(V.id,V.status)}},[s.tasks,s.showToast]),H.useEffect(()=>{const V=La();if(V!=null&&V.onDeepLink)return V.onDeepLink(ve=>{var je;return(je=h.current)==null?void 0:je.call(h,ve)})},[]),H.useEffect(()=>{var ve;if(s.loading)return;const V=S.current;!V||f.current||(f.current=!0,(ve=h.current)==null||ve.call(h,V))},[s.loading]),H.useEffect(()=>{var ve;const V=x.current;V&&((ve=v.current)!=null&&ve.call(v,V))&&(x.current=null)},[(zr=s.state)==null?void 0:zr.workflows]),s.loading)return u.jsx("div",{className:"app-status",children:"Loading Agent Studio…"});if(s.error||!s.state){const V=cT({online:t,error:s.errorKind});return u.jsx(p3,{status:V==="online"?"error":V,onRetry:s.reload,detail:s.error,onStartAuth:V==="auth"?s.startAuth:void 0})}const{state:Ie}=s,tt=Ie.sessions.find(V=>V.id===s.activeSessionId)??null,Wt=Ta(tt),is=Ie.workflows.find(V=>V.path===Wt)??null,ws=Ie.workflows.find(V=>V.path===p)??null,Bs=Jo(Ie.sessions,p),we=j!=null,Xe=!we&&(tt==null?void 0:tt.status)==="exited",ts=!we&&!Xe&&!l&&ws!=null&&Bs.length===0,Es=!we&&!Xe&&!l&&!ts&&tt!=null&&tt.status!=="exited",ni=!we&&!Xe&&(l||!ts&&!Es),Ii=l&&tt!=null&&tt.status!=="exited",te=ts?null:is,pe=ts?(ws==null?void 0:ws.name)??null:null,ye=`${s.activeSessionId??""}::${(te==null?void 0:te.path)??""}`,_e=()=>{xt.current=s.activeSessionId??null,gt.current=s.activeSessionId==null,Z(!1)},ke=te?Na(te,s.lastDeployErrorFor(te.path)):null,Fe=s.activeSessionId?s.runsBySession.get(s.activeSessionId)??null:null,We=U0(Fe,Wt)?Fe:null,dt=s.activeSessionId?(s.runIdsBySession.get(s.activeSessionId)??[]).map(V=>s.runsByExecution.get(V)).filter(V=>V!==void 0).filter(V=>U0(V,Wt)):[],Tt=(We==null?void 0:We.run.status)==="running"?We.target:null,_t=()=>{Y&&z(!0)},de=async(V,ve)=>{d(!1),A(null),G(!1),c(V),s.addPendingWorkspace(V),_t();try{const je=await s.createSession({cwd:V,harness:ve});return pl("session.created"),Nr("session.started",{harness_kind:ve,origin:"user"}),je}catch(je){throw s.removePendingWorkspace(V),je}},Me=async(V,ve)=>{await de(V,ve)},Re=async(V,ve,je)=>{const Ve=await de(V,ve),yt=`Scaffold a new Sapiom agent project in this directory: ${Xf(V,"default")}, then run npm install, read AGENTS.md, and use the sapiom-agent-authoring skill to`,rs=je==null?void 0:je.trim();B(Ve.id,rs?`${yt} build this:
|
|
472
|
-
|
|
473
|
-
${rs}`:`${yt} define the first agent.`,"Couldn't send the scaffold prompt. Ask the coding agent to call sapiom_dev_agents_scaffold.")},at=V=>{(async()=>{const ve=Jo(Ie.sessions,V.path)[0],je=(ve==null?void 0:ve.cwd)??V.path;try{const Ve=await de(je,"claude-code");await s.bindWorkflow(Ve.id,V.path),c(V.path)}catch(Ve){s.showToast(Ve.message||"Couldn't start the session.")}})()},Pe=V=>{var je;const ve=((je=Ie.sessions.find(Ve=>Ve.id===V))==null?void 0:je.cwd)??".";B(V,`Scaffold a new Sapiom agent project in this directory: ${Xf(ve,"default")}, then run npm install, read AGENTS.md, and use the sapiom-agent-authoring skill to define the first agent.`,"Couldn't send the scaffold prompt. Ask the coding agent to call sapiom_dev_agents_scaffold.")},ls=async(V,ve,je="template_gallery")=>{const Ve=await de(V,"claude-code");Nr("agent.template_cloned",{template_slug:ve.id,template_id:ve.id,surface:je}),B(Ve.id,n3(ve,V),ve.kind==="gallery"?"Couldn't send the clone prompt. Ask the coding agent to run sapiom_dev_agents_clone.":"Couldn't send the starter prompt. Ask the coding agent to call sapiom_dev_agents_scaffold.")},ks=V=>{const ve=new Set;for(const je of Ie.sessions){const Ve=Jn(je.cwd);Ve&&ve.add(Ve)}for(const je of Ie.workflows){const Ve=Jn(je.path);Ve&&ve.add(Ve)}return x1(e3(V,ve),ds||null)},At=(V,ve)=>{const je=ks(V.trim()?Jk(V):Vp);if(!je){s.showToast("Set a project folder first — use the + to open one.");return}Z(!0),Re(je,ve,V.trim()||void 0)},tr=V=>{const ve=ks(V.id);if(!ve){s.showToast("Set a project folder first — use the + to open one.");return}Z(!0),ls(ve,V,"welcome")},Mi=async V=>{const ve=await s.scanWorkflows(V);return s.showToast(ve.length===0?"No agent projects found under this folder.":ve.length===1?"Found 1 agent project.":`Found ${ve.length} agent projects.`,ve.length===0?"info":"success"),ve.length},ns=V=>{d(!1),A(null),I(!1),G(!1),_t();const ve=Ie.sessions.find(je=>je.id===V);ve&&c(Ta(ve)??ve.cwd),s.setActiveSessionId(V)},zi=V=>{d(!1),A(null),I(!1),G(!1),s.setActiveSessionId(V)},Hr=V=>{d(!1),A(V),I(!1),G(!1),_t()},sr=V=>{var je;const ve=(je=s.settings)==null?void 0:je.editor;s.showToast(`Opening in ${I0(ve)}… Pick a different editor in Settings.`,"info"),window.location.href=V4(ve,V)},Pa=V=>{var Ve;d(!1),A(null),I(!1),G(!1),c(V),_t();const ve=Jo(Ie.sessions,V),je=ve.some(yt=>yt.id===s.activeSessionId)?s.activeSessionId:((Ve=ve[ve.length-1])==null?void 0:Ve.id)??null;je!==s.activeSessionId&&s.setActiveSessionId(je)};v.current=V=>{const ve=Ie.workflows.find(je=>je.definitionId!=null&&String(je.definitionId)===V);return ve?(Pa(ve.path),!0):!1},h.current=V=>{var ve;if(V.kind==="template"){y(V.templateId),I(!0),G(!1);return}(ve=v.current)!=null&&ve.call(v,V.definitionId)||T(V)};const Vu=async V=>{var je;T(null);const ve=ks(((je=V.slug)==null?void 0:je.trim())||`agent-${V.definitionId}`);if(!ve){s.showToast("Set a project folder first — use the + to open one.");return}x.current=V.definitionId,Z(!0);try{const Ve=await de(ve,"claude-code");B(Ve.id,r3(V.definitionId,ve),"Couldn't send the clone prompt. Ask the coding agent to run sapiom_dev_agents_clone.")}catch(Ve){x.current=null,s.showToast(Ve.message||"Couldn't start a session to clone the agent.")}},En=async V=>{_t();const ve=Ie.sessions.filter(vs=>vs.status!=="exited"),je=vs=>vs.boundWorkflowPath===V||Gp(vs.cwd,V),Ve=ve.find(vs=>vs.id===s.activeSessionId),yt=Ve&&je(Ve)?Ve:ve.filter(je).sort((vs,Ur)=>Ur.cwd.length-vs.cwd.length||Ur.createdAt.localeCompare(vs.createdAt))[0];let rs;if(yt)d(!1),A(null),G(!1),yt.id!==s.activeSessionId&&s.setActiveSessionId(yt.id),rs=yt.id;else try{rs=(await de(V,"claude-code")).id}catch(vs){return s.showToast(vs.message||"Couldn't start a session in this folder."),null}return await s.bindWorkflow(rs,V),c(V),rs},ir=(V,ve)=>{(async()=>{const je=M1(ve.id);((je==="deploy"||je==="run-local")&&V!=null||je==="prod-run"&&(V==null?void 0:V.definitionId)!=null&&Wf(V))&&(k("steps"),Z(!1));let yt=s.activeSessionId;if(V&&(yt=await En(V.path)??yt),ve.action.kind==="open-url"){window.open(L3(ve.action.url,V),"_blank","noopener,noreferrer");return}if(yt){if(je!==null){if(je==="deploy")V?s.deploy(V.path):s.showToast("Select an agent first.");else if(je==="prod-run")if((V==null?void 0:V.definitionId)!=null&&Wf(V))s.startProdRun(yt,String(V.definitionId));else{const rs=V?s.lastDeployErrorFor(V.path):null,vs=V?Na(V,rs):"draft";s.showToast(vs==="failed"?"Last deploy failed — retry Deploy.":vs==="building"?"The cloud build is still in progress.":vs==="linked"?"No ready deployment yet — deploy it first.":"This agent isn't deployed yet — deploy it first.")}else je==="run-local"&&(V?s.runLocal(yt,V.path):s.showToast("Select an agent first."));return}s.runMacro(ve.id,{harnessSessionId:yt,workflowPath:V==null?void 0:V.path})}})()},ji=V=>{(async()=>{const ve=await En(V.path)??s.activeSessionId;ve&&s.runMacro("describe",{harnessSessionId:ve,workflowPath:V.path,subject:ZA(V)})})()};return u.jsxs("div",{className:"app-shell","data-rail-collapsed":N||void 0,children:[Y&&!N&&u.jsx("div",{className:"shell-scrim","data-testid":"rail-drawer-scrim","aria-hidden":"true",onClick:()=>z(!0)}),(!Y||!N)&&u.jsx("div",{className:"rail-slot"+(xe?" is-resizing":"")+(!Y&&N?" is-collapsed":""),inert:!Y&&N?!0:void 0,style:Y?void 0:{width:N?0:oe.rail},children:u.jsx(nT,{projectRoot:ds||null,onSaveProjectRoot:mt,width:oe.rail,minWidth:gv,workflows:Ie.workflows,sessions:Ie.sessions,pendingWorkspaces:s.pendingWorkspaces,activeSessionId:s.activeSessionId,focusedAgentPath:p,onFocusAgent:Pa,onOpenPalette:()=>r(!0),onConnect:async V=>{await s.connectWorkflow(V)},onCollapse:()=>z(!0),canGoBack:$.canGoBack,canGoForward:$.canGoForward,onGoBack:()=>si($.goBack()),onGoForward:()=>si($.goForward()),onSelectSession:ns,overviewSelected:q,onSelectOverview:()=>{G(!0),d(!1),A(null),I(!1),_t()},onNewSession:()=>{d(!0),I(!1),G(!1)},onReviewSummary:Hr,history:s.history,historyLoading:s.historyLoading,onOpenHistory:V=>void s.loadHistory(V),recentDirs:((qa=s.settings)==null?void 0:qa.recentDirs)??[],launchDir:Ie.launchDir??null,listDir:s.listDir,onCreateSession:Me,listHarnesses:s.listHarnesses,onScaffoldSession:Re,onScaffoldInSession:Pe,onBrowseTemplates:()=>{I(!0),G(!1)},templatesActive:D,onScanWorkflows:Mi,onToast:s.showToast,telemetryOptIn:(($r=s.settings)==null?void 0:$r.telemetryOptIn)??Ie.telemetryOptIn,consentSource:Ie.consentSource,consentEnvReason:Ie.consentEnvReason,authenticated:Ie.authenticated,organizationName:Ie.organizationName,onToggleTelemetry:async V=>{await s.updateSettings({telemetryOptIn:V})},productAnalyticsOptIn:Ie.productAnalyticsOptIn,onToggleProductAnalytics:async V=>{await s.updateSettings({productAnalyticsOptIn:V})},rollingSummary:((Yi=s.settings)==null?void 0:Yi.rollingSummary)===!0,onToggleRollingSummary:async V=>{await s.updateSettings({rollingSummary:V})},editor:Uu((Wa=s.settings)==null?void 0:Wa.editor),onSelectEditor:async V=>{await s.updateSettings({editor:V})},onStartAuth:s.startAuth,onDisconnect:s.disconnect,settingsOpen:b,onSetSettingsOpen:m})}),!N&&!Y&&u.jsx("div",{className:"pane-resize-handle pane-resize-handle-rail",style:{left:oe.rail},onPointerDown:Ee,onDoubleClick:Ye,role:"separator","aria-orientation":"vertical","aria-label":"Resize workspace rail","data-testid":"resize-handle-rail"}),u.jsxs("div",{className:"workspace-main",children:[!t&&u.jsx(v3,{}),Ie.consentSource==="default-silent"&&!((Ga=s.settings)!=null&&Ga.telemetryNoticeDismissed)&&u.jsx(B3,{onDismiss:()=>{s.updateSettings({telemetryNoticeDismissed:!0})},onOpenSettings:()=>m(!0)}),u.jsxs("div",{className:"app"+(D?" is-browsing":"")+(!D&&!Y&&!ni?" canvas-animated":"")+(st?" canvas-sliding":"")+(ae?" canvas-dragging":""),style:{gridTemplateColumns:D||Y||ni?"minmax(0, 1fr)":`minmax(${wl}px, 1fr) ${W?oe.canvas==null?"0fr":"0px":oe.canvas==null?"1fr":`${oe.canvas}px`}`},children:[D&&u.jsx(X3,{projectRoot:ds||null,recentDirs:((Ki=s.settings)==null?void 0:Ki.recentDirs)??[],listDir:s.listDir,onExit:()=>I(!1),onUse:ls,listTemplates:s.listTemplates,getTemplate:s.getTemplate,openTemplateId:C}),u.jsxs("div",{className:"center-pane",children:[u.jsx(j3,{openedAgentName:pe,reviewTitle:j?j.title:null,composing:ni,onBack:Ii?()=>d(!1):null,activeSession:Es||Xe?tt:null,sessionName:tt?cu(tt,Ie.sessions,U):null,onRenameSession:se,boundWorkflowName:(is==null?void 0:is.name)??null,sessions:Es?Bs:[],onSelectSession:zi,labelOf:V=>{const ve=cu(V,Ie.sessions,U),je=Jn(V.cwd),Ve=ve.startsWith(`${je} `)?ve.slice(je.length+1):"";if(!(ve===je||/^\d+$/.test(Ve))||!ws)return ve;const rs=Bs.findIndex(vs=>vs.id===V.id);return rs>0?`${ws.name} ${rs+1}`:ws.name},busy:tt!=null&&s.busySessionIds.has(tt.id),onCloseSession:V=>void s.closeSession(V),onOpenInEditor:sr,editorLabel:I0((Tl=s.settings)==null?void 0:Tl.editor),onToast:s.showToast,onExpandRail:N?()=>z(!1):null,onExpandRight:W?_e:null,onNewSession:()=>d(!0),actions:Es&&tt&&is?u.jsx(O3,{workflow:is,activeSessionId:s.activeSessionId,sessionReady:tt.ready===!0&&tt.status!=="exited",macros:Ie.macros,onRunMacro:V=>ir(is,V),preview:s.previewBySession.get(tt.id)??null,lastDeployError:s.lastDeployErrorFor(is.path),authenticated:Ie.authenticated,directActionSettleSeq:s.directActionSettleSeq,runningTarget:Tt}):null}),u.jsx("div",{className:"terminal-slot",children:we&&j?u.jsx(A3,{summary:j,loadRecord:s.sessionRecord,onStart:()=>{const V=j;A(null),s.resumeFromHistory(V)},onClose:()=>A(null)}):Xe&&tt?u.jsx(T3,{session:tt,resumeMode:mi,loadRecord:s.sessionRecord,onResume:()=>void s.resumeSession(tt.id),onContinue:()=>void s.rehydrateSession({cwd:tt.cwd,harness:tt.harness,from:tt.id}),onClose:()=>void s.closeSession(tt.id)}):ts&&ws?u.jsx(Bi,{className:"terminal-empty",testId:"open-agent-empty",icon:"Radio",title:`No running session for ${ws.name}`,body:"Start a session to map, run, and inspect this agent.",cta:u.jsxs("button",{className:"btn-primary","data-testid":"open-agent-start-session",onClick:()=>at(ws),children:[u.jsx(he,{name:"Plus",size:14})," Start session"]})}):Es&&s.activeSessionId?u.jsx("div",{className:"agent-view","data-testid":"agent-view",children:u.jsx("div",{className:"agent-view-panel",id:"agent-panel-terminal",children:u.jsx(c4,{sessionId:s.activeSessionId,token:s.bootToken,cwd:(tt==null?void 0:tt.cwd)??null})})}):u.jsx(L4,{firstRun:Ie.firstRun===!0,onSubmitIdea:At,onUseTemplate:tr,onBrowseTemplates:()=>I(!0),listHarnesses:s.listHarnesses,listTemplates:s.listTemplates,telemetryOptIn:((Va=s.settings)==null?void 0:Va.telemetryOptIn)??Ie.telemetryOptIn,onToggleTelemetry:async V=>{await s.updateSettings({telemetryOptIn:V})},recentDirs:((Ya=s.settings)==null?void 0:Ya.recentDirs)??[],projectRoot:ds||null,listDir:s.listDir,onConnect:async V=>{await s.connectWorkflow(V)},onScan:Mi,onScaffold:Re,onSaveProjectRoot:mt})})]}),!W&&!Y&&!ni&&u.jsx("div",{className:"pane-resize-handle pane-resize-handle-canvas",style:{right:oe.canvas==null?"50%":`min(${oe.canvas}px, calc(100% - ${wl}px))`},onPointerDown:Ue,onDoubleClick:Ke,role:"separator","aria-orientation":"vertical","aria-label":"Resize canvas pane","data-testid":"resize-handle-canvas"}),Y&&!W&&u.jsx("div",{className:"shell-scrim","data-testid":"right-sheet-scrim","aria-hidden":"true",onClick:()=>Z(!0)}),u.jsxs("div",{ref:$t,className:"right-pane"+(W||ni?" is-collapsed":""),children:[u.jsxs("div",{className:"right-pane-tabs",role:"tablist","aria-label":"Right pane",children:[u.jsxs("button",{role:"tab","aria-selected":g==="canvas",className:"right-pane-tab"+(g==="canvas"?" is-active":""),onClick:()=>k("canvas"),"data-testid":"right-tab-canvas",children:[u.jsx(he,{name:"Workflow",size:14}),"Canvas"]}),u.jsxs("button",{role:"tab","aria-selected":g==="steps",className:"right-pane-tab"+(g==="steps"?" is-active":""),onClick:()=>k("steps"),"data-testid":"right-tab-steps",children:[u.jsx(he,{name:"List",size:14}),"Steps"]}),u.jsxs("button",{role:"tab","aria-selected":g==="code",className:"right-pane-tab"+(g==="code"?" is-active":""),onClick:()=>{k("code"),R(!0)},"data-testid":"right-tab-code",children:[u.jsx(he,{name:"Code",size:14}),"Code"]}),u.jsxs("div",{className:"right-pane-corner",children:[g==="canvas"&&(te==null?void 0:te.definitionId)!=null&&u.jsxs("a",{className:"status-tag status-tag-action workflow-deployed-tag right-pane-deployed","data-testid":"workflow-dashboard-link","data-deployment-state":ke??void 0,href:zu(te.definitionId),target:"_blank",rel:"noreferrer","aria-label":`${ke} — open in the Sapiom dashboard`,"data-tooltip":"Open this agent in the Sapiom dashboard",children:[u.jsx(he,{name:"Cloud",size:12}),ke==="ready"?"deployed":ke==="building"?"building":ke==="failed"?"deploy failed":"linked"]}),g==="canvas"&&u.jsx("button",{className:"theme-toggle","data-testid":"canvas-expand","aria-label":ue?"Exit expanded canvas":"Expand canvas",title:ue?"Exit expanded canvas":"Expand canvas",onClick:()=>ge(V=>!V),children:u.jsx(he,{name:ue?"Minimize2":"Maximize2",size:15})}),u.jsx("button",{className:"theme-toggle right-pane-collapse","data-testid":"right-collapse","aria-label":"Collapse canvas panel",title:"Collapse canvas panel",onClick:()=>Z(!0),children:u.jsx(he,{name:"PanelRightClose",size:15})})]})]}),u.jsx("div",{className:"right-pane-panel"+(g==="canvas"||g==="steps"?"":" is-hidden"),"data-testid":"right-panel-canvas",children:u.jsx(rk,{sessionId:s.activeSessionId,lastMessage:s.lastMessage,boundWorkflow:te,noSessionAgent:pe,overviewActive:ni,sessionExited:Xe,onCanvasState:V=>{var Ve;if(Y)return;const ve=((Ve=Ie.sessions.find(yt=>yt.id===s.activeSessionId))==null?void 0:Ve.status)==="exited";if(V||ve){pt.current=null,Z(!1);return}if(gt.current){gt.current=!1,xt.current=s.activeSessionId??null;return}const je=xt.current;je!=null&&je===s.activeSessionId||pt.current!==ye&&(pt.current=ye,Z(!0))},expanded:ue,onToggleExpanded:()=>ge(V=>!V),macros:Ie.macros,tasks:s.tasks,surface:g==="steps"?"steps":"board",onOpenSteps:()=>k("steps"),run:(We==null?void 0:We.run)??null,runTarget:(We==null?void 0:We.target)??null,runs:dt,onSelectRun:V=>{s.activeSessionId&&s.selectRun(s.activeSessionId,V)},preview:s.activeSessionId?s.previewBySession.get(s.activeSessionId)??null:null,deployState:te?s.deployStateByPath.get(te.path)??null:null,onDismissDeploy:()=>{te&&s.dismissDeployState(te.path)},onOpenCode:()=>{k("code"),R(!0)},workflows:Ie.workflows,onOpenWorkflow:V=>void En(V),onRunMacro:V=>ir(is,V),onInjectPrompt:V=>{s.activeSessionId&&s.injectInput(s.activeSessionId,V)},onDescribeWorkflow:ji})}),(g==="code"||M)&&u.jsx("div",{className:"right-pane-panel"+(g==="code"?"":" is-hidden"),"data-testid":"right-panel-code",children:u.jsx(Sk,{boundWorkflow:te,noSessionAgent:pe,agentsBaseUrl:Ie.agentsBaseUrl,lastDeployError:te?s.lastDeployErrorFor(te.path):null})})]})]})]}),q&&u.jsx(O4,{firstRun:Ie.firstRun===!0,appVersion:((Pr=La())==null?void 0:Pr.appVersion)||"0.7.0",recentDirs:((Al=s.settings)==null?void 0:Al.recentDirs)??[],projectRoot:ds||null,listDir:s.listDir,onConnect:async V=>{await s.connectWorkflow(V),G(!1)},onScan:Mi,onBrowseTemplates:()=>{G(!1),I(!0)},onDismiss:()=>G(!1)}),n&&u.jsx(d3,{sessions:Ie.sessions,workflows:Ie.workflows,recentDirs:((Rl=s.settings)==null?void 0:Rl.recentDirs)??[],history:s.history,sessionNames:U,activeSessionId:s.activeSessionId,listDir:s.listDir,listTemplates:s.listTemplates,onSelectSession:ns,onReviewSummary:Hr,onOpenPath:V=>void Me(V,"claude-code"),onOpenTemplate:V=>{y(V),I(!0),G(!1)},actions:[{id:"browse-templates",label:"Browse templates",meta:"Gallery and starters",icon:"LayoutTemplate",run:()=>{I(!0),G(!1)}},{id:"toggle-theme",label:"Toggle theme",meta:"Light and dark",icon:"Sun",run:n1},{id:"toggle-rail",label:N?"Show workspace panel":"Hide workspace panel",meta:"Left pane",icon:"Menu",run:()=>z(V=>!V)},{id:"toggle-right",label:W?"Show canvas panel":"Hide canvas panel",meta:"Right pane",icon:W?"PanelRightOpen":"PanelRightClose",run:()=>Z(V=>!V)},...tt?[{id:"new-session-here",label:"New session in this folder",meta:tt.cwd,icon:"Plus",run:()=>void Me(tt.cwd,"claude-code")}]:[]],onClose:()=>r(!1)}),E&&u.jsx(dT,{agentLabel:E.slug?`“${E.slug}”`:`Agent ${E.definitionId}`,onCancel:()=>T(null),onConfirm:()=>void Vu(E)}),s.toast&&u.jsx(f4,{message:s.toast.message,tone:s.toast.tone,onDismiss:s.dismissToast}),u.jsx(p4,{})]})};function CR(s=document.documentElement,t=window){const n=d=>{s.dataset.windowFocused=d?"true":"false"};n(t.document.hasFocus());const r=()=>n(!0),l=()=>n(!1);return t.addEventListener("focus",r),t.addEventListener("blur",l),()=>{t.removeEventListener("focus",r),t.removeEventListener("blur",l)}}function ER(s=typeof window>"u"?"":window.location.search){return new URLSearchParams(s).get("frame")==="macos"?"macos":"web"}document.documentElement.dataset.windowFrame=ER();CR();window.addEventListener("scroll",()=>{(window.scrollX!==0||window.scrollY!==0)&&window.scrollTo(0,0)},{passive:!0});Ix.createRoot(document.getElementById("root")).render(u.jsx(H.StrictMode,{children:u.jsx(xR,{})}));
|