@sapiom/harness 0.5.1 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/CHANGELOG.md +152 -0
  2. package/dist/cli/doctor.d.ts.map +1 -1
  3. package/dist/cli/doctor.js +4 -2
  4. package/dist/cli/doctor.js.map +1 -1
  5. package/dist/core/account-plan.d.ts +51 -0
  6. package/dist/core/account-plan.d.ts.map +1 -0
  7. package/dist/core/account-plan.js +174 -0
  8. package/dist/core/account-plan.js.map +1 -0
  9. package/dist/core/adapters/claude-code.d.ts +36 -0
  10. package/dist/core/adapters/claude-code.d.ts.map +1 -1
  11. package/dist/core/adapters/claude-code.js +48 -1
  12. package/dist/core/adapters/claude-code.js.map +1 -1
  13. package/dist/core/adapters/codex.d.ts +6 -0
  14. package/dist/core/adapters/codex.d.ts.map +1 -1
  15. package/dist/core/adapters/codex.js +19 -13
  16. package/dist/core/adapters/codex.js.map +1 -1
  17. package/dist/core/bracketed-paste.d.ts +16 -0
  18. package/dist/core/bracketed-paste.d.ts.map +1 -1
  19. package/dist/core/bracketed-paste.js +17 -3
  20. package/dist/core/bracketed-paste.js.map +1 -1
  21. package/dist/core/canvas-manifest-check.d.ts.map +1 -1
  22. package/dist/core/canvas-manifest-check.js +36 -5
  23. package/dist/core/canvas-manifest-check.js.map +1 -1
  24. package/dist/core/canvas-svg.d.ts.map +1 -1
  25. package/dist/core/canvas-svg.js +9 -1
  26. package/dist/core/canvas-svg.js.map +1 -1
  27. package/dist/core/canvas-watcher.d.ts +25 -0
  28. package/dist/core/canvas-watcher.d.ts.map +1 -1
  29. package/dist/core/canvas-watcher.js +31 -5
  30. package/dist/core/canvas-watcher.js.map +1 -1
  31. package/dist/core/errors.d.ts +12 -0
  32. package/dist/core/errors.d.ts.map +1 -1
  33. package/dist/core/errors.js +14 -0
  34. package/dist/core/errors.js.map +1 -1
  35. package/dist/core/example-seed.js +1 -1
  36. package/dist/core/example-seed.js.map +1 -1
  37. package/dist/core/inject/claude-settings.d.ts.map +1 -1
  38. package/dist/core/inject/claude-settings.js +69 -7
  39. package/dist/core/inject/claude-settings.js.map +1 -1
  40. package/dist/core/inject/mcp-config.d.ts +21 -0
  41. package/dist/core/inject/mcp-config.d.ts.map +1 -1
  42. package/dist/core/inject/mcp-config.js +23 -13
  43. package/dist/core/inject/mcp-config.js.map +1 -1
  44. package/dist/core/inject/skills-plugin.d.ts.map +1 -1
  45. package/dist/core/inject/skills-plugin.js +41 -25
  46. package/dist/core/inject/skills-plugin.js.map +1 -1
  47. package/dist/core/session-manager.d.ts +29 -0
  48. package/dist/core/session-manager.d.ts.map +1 -1
  49. package/dist/core/session-manager.js +95 -1
  50. package/dist/core/session-manager.js.map +1 -1
  51. package/dist/core/spawn-target.d.ts +16 -0
  52. package/dist/core/spawn-target.d.ts.map +1 -1
  53. package/dist/core/spawn-target.js +87 -19
  54. package/dist/core/spawn-target.js.map +1 -1
  55. package/dist/core/strip-ansi.js +49 -11
  56. package/dist/core/strip-ansi.js.map +1 -1
  57. package/dist/core/task-manager.js +1 -1
  58. package/dist/core/task-manager.js.map +1 -1
  59. package/dist/index.d.ts +1 -1
  60. package/dist/index.d.ts.map +1 -1
  61. package/dist/index.js +1 -1
  62. package/dist/index.js.map +1 -1
  63. package/dist/server/account.d.ts +23 -0
  64. package/dist/server/account.d.ts.map +1 -0
  65. package/dist/server/account.js +32 -0
  66. package/dist/server/account.js.map +1 -0
  67. package/dist/server/actions.d.ts.map +1 -1
  68. package/dist/server/actions.js +1 -0
  69. package/dist/server/actions.js.map +1 -1
  70. package/dist/server/canvas-render.d.ts +9 -1
  71. package/dist/server/canvas-render.d.ts.map +1 -1
  72. package/dist/server/canvas-render.js +1 -0
  73. package/dist/server/canvas-render.js.map +1 -1
  74. package/dist/server/cwd-normalize.d.ts +18 -0
  75. package/dist/server/cwd-normalize.d.ts.map +1 -0
  76. package/dist/server/cwd-normalize.js +23 -0
  77. package/dist/server/cwd-normalize.js.map +1 -0
  78. package/dist/server/error-handler.d.ts +13 -0
  79. package/dist/server/error-handler.d.ts.map +1 -0
  80. package/dist/server/error-handler.js +7 -0
  81. package/dist/server/error-handler.js.map +1 -0
  82. package/dist/server/index.d.ts +8 -0
  83. package/dist/server/index.d.ts.map +1 -1
  84. package/dist/server/index.js +20 -6
  85. package/dist/server/index.js.map +1 -1
  86. package/dist/server/rest.d.ts.map +1 -1
  87. package/dist/server/rest.js +32 -10
  88. package/dist/server/rest.js.map +1 -1
  89. package/dist/shared/types.d.ts +81 -2
  90. package/dist/shared/types.d.ts.map +1 -1
  91. package/dist/shared/types.js +10 -0
  92. package/dist/shared/types.js.map +1 -1
  93. package/dist/web/assets/index-B6DkXea8.js +473 -0
  94. package/dist/web/assets/index-C7wzgAWT.css +32 -0
  95. package/dist/web/index.html +2 -2
  96. package/package.json +4 -4
  97. package/dist/web/assets/index-BuH6LNdL.js +0 -463
  98. package/dist/web/assets/index-Dmj2SA0s.css +0 -32
@@ -1,463 +0,0 @@
1
- var Xw=Object.defineProperty;var Jw=(s,t,n)=>t in s?Xw(s,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):s[t]=n;var Od=(s,t,n)=>Jw(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"]'))a(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"&&a(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 a(l){if(l.ep)return;l.ep=!0;const d=n(l);fetch(l.href,d)}})();var Bd={exports:{}},Do={};/**
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 A_;function Zw(){if(A_)return Do;A_=1;var s=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(a,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:a,key:p,ref:l!==void 0?l:null,props:d}}return Do.Fragment=t,Do.jsx=n,Do.jsxs=n,Do}var R_;function Qw(){return R_||(R_=1,Bd.exports=Zw()),Bd.exports}var u=Qw(),Hd={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 M_;function ex(){if(M_)return Qe;M_=1;var s=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),a=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(L){return L===null||typeof L!="object"?null:(L=x&&L[x]||L["@@iterator"],typeof L=="function"?L:null)}var A={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,y={};function b(L,B,V){this.props=L,this.context=B,this.refs=y,this.updater=V||A}b.prototype.isReactComponent={},b.prototype.setState=function(L,B){if(typeof L!="object"&&typeof L!="function"&&L!=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,L,B,"setState")},b.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function m(){}m.prototype=b.prototype;function _(L,B,V){this.props=L,this.context=B,this.refs=y,this.updater=V||A}var k=_.prototype=new m;k.constructor=_,C(k,b.prototype),k.isPureReactComponent=!0;var R=Array.isArray;function M(){}var j={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function D(L,B,V){var Q=V.ref;return{$$typeof:s,type:L,key:B,ref:Q!==void 0?Q:null,props:V}}function I(L,B){return D(L.type,B,L.props)}function q(L){return typeof L=="object"&&L!==null&&L.$$typeof===s}function W(L){var B={"=":"=0",":":"=2"};return"$"+L.replace(/[=:]/g,function(V){return B[V]})}var U=/\/+/g;function Z(L,B){return typeof L=="object"&&L!==null&&L.key!=null?W(""+L.key):B.toString(36)}function se(L){switch(L.status){case"fulfilled":return L.value;case"rejected":throw L.reason;default:switch(typeof L.status=="string"?L.then(M,M):(L.status="pending",L.then(function(B){L.status==="pending"&&(L.status="fulfilled",L.value=B)},function(B){L.status==="pending"&&(L.status="rejected",L.reason=B)})),L.status){case"fulfilled":return L.value;case"rejected":throw L.reason}}throw L}function F(L,B,V,Q,ue){var fe=typeof L;(fe==="undefined"||fe==="boolean")&&(L=null);var Y=!1;if(L===null)Y=!0;else switch(fe){case"bigint":case"string":case"number":Y=!0;break;case"object":switch(L.$$typeof){case s:case t:Y=!0;break;case S:return Y=L._init,F(Y(L._payload),B,V,Q,ue)}}if(Y)return ue=ue(L),Y=Q===""?"."+Z(L,0):Q,R(ue)?(V="",Y!=null&&(V=Y.replace(U,"$&/")+"/"),F(ue,B,V,"",function(ae){return ae})):ue!=null&&(q(ue)&&(ue=I(ue,V+(ue.key==null||L&&L.key===ue.key?"":(""+ue.key).replace(U,"$&/")+"/")+Y)),B.push(ue)),1;Y=0;var z=Q===""?".":Q+":";if(R(L))for(var oe=0;oe<L.length;oe++)Q=L[oe],fe=z+Z(Q,oe),Y+=F(Q,B,V,fe,ue);else if(oe=E(L),typeof oe=="function")for(L=oe.call(L),oe=0;!(Q=L.next()).done;)Q=Q.value,fe=z+Z(Q,oe++),Y+=F(Q,B,V,fe,ue);else if(fe==="object"){if(typeof L.then=="function")return F(se(L),B,V,Q,ue);throw B=String(L),Error("Objects are not valid as a React child (found: "+(B==="[object Object]"?"object with keys {"+Object.keys(L).join(", ")+"}":B)+"). If you meant to render a collection of children, use an array instead.")}return Y}function G(L,B,V){if(L==null)return L;var Q=[],ue=0;return F(L,Q,"","",function(fe){return B.call(V,fe,ue++)}),Q}function J(L){if(L._status===-1){var B=L._result;B=B(),B.then(function(V){(L._status===0||L._status===-1)&&(L._status=1,L._result=V)},function(V){(L._status===0||L._status===-1)&&(L._status=2,L._result=V)}),L._status===-1&&(L._status=0,L._result=B)}if(L._status===1)return L._result.default;throw L._result}var O=typeof reportError=="function"?reportError:function(L){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var B=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof L=="object"&&L!==null&&typeof L.message=="string"?String(L.message):String(L),error:L});if(!window.dispatchEvent(B))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",L);return}console.error(L)},H={map:G,forEach:function(L,B,V){G(L,function(){B.apply(this,arguments)},V)},count:function(L){var B=0;return G(L,function(){B++}),B},toArray:function(L){return G(L,function(B){return B})||[]},only:function(L){if(!q(L))throw Error("React.Children.only expected to receive a single React element child.");return L}};return Qe.Activity=f,Qe.Children=H,Qe.Component=b,Qe.Fragment=n,Qe.Profiler=l,Qe.PureComponent=_,Qe.StrictMode=a,Qe.Suspense=h,Qe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=j,Qe.__COMPILER_RUNTIME={__proto__:null,c:function(L){return j.H.useMemoCache(L)}},Qe.cache=function(L){return function(){return L.apply(null,arguments)}},Qe.cacheSignal=function(){return null},Qe.cloneElement=function(L,B,V){if(L==null)throw Error("The argument must be a React element, but you passed "+L+".");var Q=C({},L.props),ue=L.key;if(B!=null)for(fe in B.key!==void 0&&(ue=""+B.key),B)!T.call(B,fe)||fe==="key"||fe==="__self"||fe==="__source"||fe==="ref"&&B.ref===void 0||(Q[fe]=B[fe]);var fe=arguments.length-2;if(fe===1)Q.children=V;else if(1<fe){for(var Y=Array(fe),z=0;z<fe;z++)Y[z]=arguments[z+2];Q.children=Y}return D(L.type,ue,Q)},Qe.createContext=function(L){return L={$$typeof:p,_currentValue:L,_currentValue2:L,_threadCount:0,Provider:null,Consumer:null},L.Provider=L,L.Consumer={$$typeof:d,_context:L},L},Qe.createElement=function(L,B,V){var Q,ue={},fe=null;if(B!=null)for(Q in B.key!==void 0&&(fe=""+B.key),B)T.call(B,Q)&&Q!=="key"&&Q!=="__self"&&Q!=="__source"&&(ue[Q]=B[Q]);var Y=arguments.length-2;if(Y===1)ue.children=V;else if(1<Y){for(var z=Array(Y),oe=0;oe<Y;oe++)z[oe]=arguments[oe+2];ue.children=z}if(L&&L.defaultProps)for(Q in Y=L.defaultProps,Y)ue[Q]===void 0&&(ue[Q]=Y[Q]);return D(L,fe,ue)},Qe.createRef=function(){return{current:null}},Qe.forwardRef=function(L){return{$$typeof:c,render:L}},Qe.isValidElement=q,Qe.lazy=function(L){return{$$typeof:S,_payload:{_status:-1,_result:L},_init:J}},Qe.memo=function(L,B){return{$$typeof:v,type:L,compare:B===void 0?null:B}},Qe.startTransition=function(L){var B=j.T,V={};j.T=V;try{var Q=L(),ue=j.S;ue!==null&&ue(V,Q),typeof Q=="object"&&Q!==null&&typeof Q.then=="function"&&Q.then(M,O)}catch(fe){O(fe)}finally{B!==null&&V.types!==null&&(B.types=V.types),j.T=B}},Qe.unstable_useCacheRefresh=function(){return j.H.useCacheRefresh()},Qe.use=function(L){return j.H.use(L)},Qe.useActionState=function(L,B,V){return j.H.useActionState(L,B,V)},Qe.useCallback=function(L,B){return j.H.useCallback(L,B)},Qe.useContext=function(L){return j.H.useContext(L)},Qe.useDebugValue=function(){},Qe.useDeferredValue=function(L,B){return j.H.useDeferredValue(L,B)},Qe.useEffect=function(L,B){return j.H.useEffect(L,B)},Qe.useEffectEvent=function(L){return j.H.useEffectEvent(L)},Qe.useId=function(){return j.H.useId()},Qe.useImperativeHandle=function(L,B,V){return j.H.useImperativeHandle(L,B,V)},Qe.useInsertionEffect=function(L,B){return j.H.useInsertionEffect(L,B)},Qe.useLayoutEffect=function(L,B){return j.H.useLayoutEffect(L,B)},Qe.useMemo=function(L,B){return j.H.useMemo(L,B)},Qe.useOptimistic=function(L,B){return j.H.useOptimistic(L,B)},Qe.useReducer=function(L,B,V){return j.H.useReducer(L,B,V)},Qe.useRef=function(L){return j.H.useRef(L)},Qe.useState=function(L){return j.H.useState(L)},Qe.useSyncExternalStore=function(L,B,V){return j.H.useSyncExternalStore(L,B,V)},Qe.useTransition=function(){return j.H.useTransition()},Qe.version="19.2.7",Qe}var D_;function bp(){return D_||(D_=1,Hd.exports=ex()),Hd.exports}var P=bp(),Id={exports:{}},jo={},zd={exports:{}},$d={};/**
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 j_;function tx(){return j_||(j_=1,(function(s){function t(F,G){var J=F.length;F.push(G);e:for(;0<J;){var O=J-1>>>1,H=F[O];if(0<l(H,G))F[O]=G,F[J]=H,J=O;else break e}}function n(F){return F.length===0?null:F[0]}function a(F){if(F.length===0)return null;var G=F[0],J=F.pop();if(J!==G){F[0]=J;e:for(var O=0,H=F.length,L=H>>>1;O<L;){var B=2*(O+1)-1,V=F[B],Q=B+1,ue=F[Q];if(0>l(V,J))Q<H&&0>l(ue,V)?(F[O]=ue,F[Q]=J,O=Q):(F[O]=V,F[B]=J,O=B);else if(Q<H&&0>l(ue,J))F[O]=ue,F[Q]=J,O=Q;else break e}}return G}function l(F,G){var J=F.sortIndex-G.sortIndex;return J!==0?J:F.id-G.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,A=!1,C=!1,y=!1,b=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;function k(F){for(var G=n(v);G!==null;){if(G.callback===null)a(v);else if(G.startTime<=F)a(v),G.sortIndex=G.expirationTime,t(h,G);else break;G=n(v)}}function R(F){if(C=!1,k(F),!A)if(n(h)!==null)A=!0,M||(M=!0,W());else{var G=n(v);G!==null&&se(R,G.startTime-F)}}var M=!1,j=-1,T=5,D=-1;function I(){return y?!0:!(s.unstable_now()-D<T)}function q(){if(y=!1,M){var F=s.unstable_now();D=F;var G=!0;try{e:{A=!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 H=O(f.expirationTime<=F);if(F=s.unstable_now(),typeof H=="function"){f.callback=H,k(F),G=!0;break t}f===n(h)&&a(h),k(F)}else a(h);f=n(h)}if(f!==null)G=!0;else{var L=n(v);L!==null&&se(R,L.startTime-F),G=!1}}break e}finally{f=null,x=J,E=!1}G=void 0}}finally{G?W():M=!1}}}var W;if(typeof _=="function")W=function(){_(q)};else if(typeof MessageChannel<"u"){var U=new MessageChannel,Z=U.port2;U.port1.onmessage=q,W=function(){Z.postMessage(null)}}else W=function(){b(q,0)};function se(F,G){j=b(function(){F(s.unstable_now())},G)}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"):T=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 G=3;break;default:G=x}var J=x;x=G;try{return F()}finally{x=J}},s.unstable_requestPaint=function(){y=!0},s.unstable_runWithPriority=function(F,G){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var J=x;x=F;try{return G()}finally{x=J}},s.unstable_scheduleCallback=function(F,G,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 H=-1;break;case 2:H=250;break;case 5:H=1073741823;break;case 4:H=1e4;break;default:H=5e3}return H=J+H,F={id:S++,callback:G,priorityLevel:F,startTime:J,expirationTime:H,sortIndex:-1},J>O?(F.sortIndex=J,t(v,F),n(h)===null&&F===n(v)&&(C?(m(j),j=-1):C=!0,se(R,J-O))):(F.sortIndex=H,t(h,F),A||E||(A=!0,M||(M=!0,W()))),F},s.unstable_shouldYield=I,s.unstable_wrapCallback=function(F){var G=x;return function(){var J=x;x=G;try{return F.apply(this,arguments)}finally{x=J}}}})($d)),$d}var N_;function sx(){return N_||(N_=1,zd.exports=tx()),zd.exports}var Pd={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 L_;function ix(){if(L_)return Hs;L_=1;var s=bp();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 a={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=a,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=a.p;try{if(p.T=null,a.p=2,h)return h()}finally{p.T=v,a.p=S,a.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,a.d.C(h,v))},Hs.prefetchDNS=function(h){typeof h=="string"&&a.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"?a.d.S(h,typeof v.precedence=="string"?v.precedence:void 0,{crossOrigin:f,integrity:x,fetchPriority:E}):S==="script"&&a.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);a.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&&a.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);a.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);a.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 a.d.m(h)},Hs.requestFormReset=function(h){a.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 O_;function Dy(){if(O_)return Pd.exports;O_=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(),Pd.exports=ix(),Pd.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 B_;function nx(){if(B_)return jo;B_=1;var s=sx(),t=bp(),n=Dy();function a(e){var i="https://react.dev/errors/"+e;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var r=2;r<arguments.length;r++)i+="&args[]="+encodeURIComponent(arguments[r])}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,r=e;if(e.alternate)for(;i.return;)i=i.return;else{e=i;do i=e,(i.flags&4098)!==0&&(r=i.return),e=i.return;while(e)}return i.tag===3?r: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(a(188))}function v(e){var i=e.alternate;if(!i){if(i=d(e),i===null)throw Error(a(188));return i!==e?null:e}for(var r=e,o=i;;){var g=r.return;if(g===null)break;var w=g.alternate;if(w===null){if(o=g.return,o!==null){r=o;continue}break}if(g.child===w.child){for(w=g.child;w;){if(w===r)return h(g),e;if(w===o)return h(g),i;w=w.sibling}throw Error(a(188))}if(r.return!==o.return)r=g,o=w;else{for(var N=!1,$=g.child;$;){if($===r){N=!0,r=g,o=w;break}if($===o){N=!0,o=g,r=w;break}$=$.sibling}if(!N){for($=w.child;$;){if($===r){N=!0,r=w,o=g;break}if($===o){N=!0,o=w,r=g;break}$=$.sibling}if(!N)throw Error(a(189))}}if(r.alternate!==o)throw Error(a(190))}if(r.tag!==3)throw Error(a(188));return r.stateNode.current===r?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"),A=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"),_=Symbol.for("react.context"),k=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),M=Symbol.for("react.suspense_list"),j=Symbol.for("react.memo"),T=Symbol.for("react.lazy"),D=Symbol.for("react.activity"),I=Symbol.for("react.memo_cache_sentinel"),q=Symbol.iterator;function W(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 Z(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 R:return"Suspense";case M:return"SuspenseList";case D:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case A:return"Portal";case _: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:Z(e.type)||"Memo";case T:i=e._payload,e=e._init;try{return Z(e(i))}catch{}}return null}var se=Array.isArray,F=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,J={pending:!1,data:null,method:null,action:null},O=[],H=-1;function L(e){return{current:e}}function B(e){0>H||(e.current=O[H],O[H]=null,H--)}function V(e,i){H++,O[H]=e.current,e.current=i}var Q=L(null),ue=L(null),fe=L(null),Y=L(null);function z(e,i){switch(V(fe,i),V(ue,e),V(Q,null),i.nodeType){case 9:case 11:e=(e=i.documentElement)&&(e=e.namespaceURI)?Jm(e):0;break;default:if(e=i.tagName,i=i.namespaceURI)i=Jm(i),e=Zm(i,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}B(Q),V(Q,e)}function oe(){B(Q),B(ue),B(fe)}function ae(e){e.memoizedState!==null&&V(Y,e);var i=Q.current,r=Zm(i,e.type);i!==r&&(V(ue,e),V(Q,r))}function we(e){ue.current===e&&(B(Q),B(ue)),Y.current===e&&(B(Y),To._currentValue=J)}var Ee,Ue;function $e(e){if(Ee===void 0)try{throw Error()}catch(r){var i=r.stack.trim().match(/\n( *(at )?)/);Ee=i&&i[1]||"",Ue=-1<r.stack.indexOf(`
42
- at`)?" (<anonymous>)":-1<r.stack.indexOf("@")?"@unknown:0:0":""}return`
43
- `+Ee+e+Ue}var We=!1;function Fe(e,i){if(!e||We)return"";We=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var o={DetermineComponentFrameRoot:function(){try{if(i){var be=function(){throw Error()};if(Object.defineProperty(be.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(be,[])}catch(he){var le=he}Reflect.construct(e,[],be)}else{try{be.call()}catch(he){le=he}e.call(be.prototype)}}else{try{throw Error()}catch(he){le=he}(be=e())&&typeof be.catch=="function"&&be.catch(function(){})}}catch(he){if(he&&le&&typeof he.stack=="string")return[he.stack,le.stack]}return[null,null]}};o.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var g=Object.getOwnPropertyDescriptor(o.DetermineComponentFrameRoot,"name");g&&g.configurable&&Object.defineProperty(o.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var w=o.DetermineComponentFrameRoot(),N=w[0],$=w[1];if(N&&$){var X=N.split(`
44
- `),re=$.split(`
45
- `);for(g=o=0;o<X.length&&!X[o].includes("DetermineComponentFrameRoot");)o++;for(;g<re.length&&!re[g].includes("DetermineComponentFrameRoot");)g++;if(o===X.length||g===re.length)for(o=X.length-1,g=re.length-1;1<=o&&0<=g&&X[o]!==re[g];)g--;for(;1<=o&&0<=g;o--,g--)if(X[o]!==re[g]){if(o!==1||g!==1)do if(o--,g--,0>g||X[o]!==re[g]){var pe=`
46
- `+X[o].replace(" at new "," at ");return e.displayName&&pe.includes("<anonymous>")&&(pe=pe.replace("<anonymous>",e.displayName)),pe}while(1<=o&&0<=g);break}}}finally{We=!1,Error.prepareStackTrace=r}return(r=e?e.displayName||e.name:"")?$e(r):""}function Ne(e,i){switch(e.tag){case 26:case 27:case 5:return $e(e.type);case 16:return $e("Lazy");case 13:return e.child!==i&&i!==null?$e("Suspense Fallback"):$e("Suspense");case 19:return $e("SuspenseList");case 0:case 15:return Fe(e.type,!1);case 11:return Fe(e.type.render,!1);case 1:return Fe(e.type,!0);case 31:return $e("Activity");default:return""}}function $t(e){try{var i="",r=null;do i+=Ne(e,r),r=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,Nt=s.unstable_scheduleCallback,xt=s.unstable_cancelCallback,ls=s.unstable_shouldYield,_t=s.unstable_requestPaint,ot=s.unstable_now,kt=s.unstable_getCurrentPriorityLevel,Tt=s.unstable_ImmediatePriority,Os=s.unstable_UserBlockingPriority,Pe=s.unstable_NormalPriority,ds=s.unstable_LowPriority,Wt=s.unstable_IdlePriority,_s=s.log,lt=s.unstable_setDisableYieldValue,ys=null,is=null;function Gt(e){if(typeof _s=="function"&&lt(e),is&&typeof is.setStrictMode=="function")try{is.setStrictMode(ys,e)}catch{}}var bt=Math.clz32?Math.clz32:Gs,pi=Math.log,si=Math.LN2;function Gs(e){return e>>>=0,e===0?32:31-(pi(e)/si|0)|0}var Cs=256,Ke=262144,it=4194304;function Ce(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 Ve(e,i,r){var o=e.pendingLanes;if(o===0)return 0;var g=0,w=e.suspendedLanes,N=e.pingedLanes;e=e.warmLanes;var $=o&134217727;return $!==0?(o=$&~w,o!==0?g=Ce(o):(N&=$,N!==0?g=Ce(N):r||(r=$&~e,r!==0&&(g=Ce(r))))):($=o&~w,$!==0?g=Ce($):N!==0?g=Ce(N):r||(r=o&~e,r!==0&&(g=Ce(r)))),g===0?0:i!==0&&i!==g&&(i&w)===0&&(w=g&-g,r=i&-i,w>=r||w===32&&(r&4194048)!==0)?i:g}function ut(e,i){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&i)===0}function Es(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 vi(){var e=it;return it<<=1,(it&62914560)===0&&(it=4194304),e}function Bs(e){for(var i=[],r=0;31>r;r++)i.push(e);return i}function ws(e,i){e.pendingLanes|=i,i!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function gi(e,i,r,o,g,w){var N=e.pendingLanes;e.pendingLanes=r,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=r,e.entangledLanes&=r,e.errorRecoveryDisabledLanes&=r,e.shellSuspendCounter=0;var $=e.entanglements,X=e.expirationTimes,re=e.hiddenUpdates;for(r=N&~r;0<r;){var pe=31-bt(r),be=1<<pe;$[pe]=0,X[pe]=-1;var le=re[pe];if(le!==null)for(re[pe]=null,pe=0;pe<le.length;pe++){var he=le[pe];he!==null&&(he.lane&=-536870913)}r&=~be}o!==0&&ie(e,o,0),w!==0&&g===0&&e.tag!==0&&(e.suspendedLanes|=w&~(N&~i))}function ie(e,i,r){e.pendingLanes|=i,e.suspendedLanes&=~i;var o=31-bt(i);e.entangledLanes|=i,e.entanglements[o]=e.entanglements[o]|1073741824|r&261930}function ve(e,i){var r=e.entangledLanes|=i;for(e=e.entanglements;r;){var o=31-bt(r),g=1<<o;g&i|e[o]&i&&(e[o]|=i),r&=~g}}function ge(e,i){var r=i&-i;return r=(r&42)!==0?1:Se(r),(r&(e.suspendedLanes|i))!==0?0:r}function Se(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 Me(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function yt(){var e=G.p;return e!==0?e:(e=window.event,e===void 0?32:S_(e.type))}function Xe(e,i){var r=G.p;try{return G.p=e,i()}finally{G.p=r}}var tt=Math.random().toString(36).slice(2),Je="__reactFiber$"+tt,nt="__reactProps$"+tt,ct="__reactContainer$"+tt,bs="__reactEvents$"+tt,ht="__reactListeners$"+tt,Vs="__reactHandles$"+tt,ye="__reactResources$"+tt,De="__reactMarker$"+tt;function Oe(e){delete e[Je],delete e[nt],delete e[bs],delete e[ht],delete e[Vs]}function Ct(e){var i=e[Je];if(i)return i;for(var r=e.parentNode;r;){if(i=r[ct]||r[Je]){if(r=i.alternate,i.child!==null||r!==null&&r.child!==null)for(e=r_(e);e!==null;){if(r=e[Je])return r;e=r_(e)}return i}e=r,r=e.parentNode}return null}function ze(e){if(e=e[Je]||e[ct]){var i=e.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return e}return null}function ns(e){var i=e.tag;if(i===5||i===26||i===27||i===6)return e.stateNode;throw Error(a(33))}function ks(e){var i=e[ye];return i||(i=e[ye]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function Rt(e){e[De]=!0}var Cn=new Set,Vi={};function rs(e,i){Ii(e,i),Ii(e+"Capture",i)}function Ii(e,i){for(Vi[e]=i,e=0;e<i.length;e++)Cn.add(i[e])}var tr=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]*$"),En={},gl={};function ml(e){return pt.call(gl,e)?!0:pt.call(En,e)?!1:tr.test(e)?gl[e]=!0:(En[e]=!0,!1)}function sr(e,i,r){if(ml(i))if(r===null)e.removeAttribute(i);else{switch(typeof r){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,""+r)}}function ir(e,i,r){if(r===null)e.removeAttribute(i);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(i);return}e.setAttribute(i,""+r)}}function mi(e,i,r,o){if(o===null)e.removeAttribute(r);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(r);return}e.setAttributeNS(i,r,""+o)}}function $s(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Ia(e){var i=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function _l(e,i,r){var o=Object.getOwnPropertyDescriptor(e.constructor.prototype,i);if(!e.hasOwnProperty(i)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var g=o.get,w=o.set;return Object.defineProperty(e,i,{configurable:!0,get:function(){return g.call(this)},set:function(N){r=""+N,w.call(this,N)}}),Object.defineProperty(e,i,{enumerable:o.enumerable}),{getValue:function(){return r},setValue:function(N){r=""+N},stopTracking:function(){e._valueTracker=null,delete e[i]}}}}function Br(e){if(!e._valueTracker){var i=Ia(e)?"checked":"value";e._valueTracker=_l(e,i,""+e[i])}}function za(e){if(!e)return!1;var i=e._valueTracker;if(!i)return!0;var r=i.getValue(),o="";return e&&(o=Ia(e)?e.checked?"true":"false":e.value),e=o,e!==r?(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 yl=/[\n"\\]/g;function Ps(e){return e.replace(yl,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function Hr(e,i,r,o,g,w,N,$){e.name="",N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?e.type=N:e.removeAttribute("type"),i!=null?N==="number"?(i===0&&e.value===""||e.value!=i)&&(e.value=""+$s(i)):e.value!==""+$s(i)&&(e.value=""+$s(i)):N!=="submit"&&N!=="reset"||e.removeAttribute("value"),i!=null?Ir(e,N,$s(i)):r!=null?Ir(e,N,$s(r)):o!=null&&e.removeAttribute("value"),g==null&&w!=null&&(e.defaultChecked=!!w),g!=null&&(e.checked=g&&typeof g!="function"&&typeof g!="symbol"),$!=null&&typeof $!="function"&&typeof $!="symbol"&&typeof $!="boolean"?e.name=""+$s($):e.removeAttribute("name")}function $a(e,i,r,o,g,w,N,$){if(w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(e.type=w),i!=null||r!=null){if(!(w!=="submit"&&w!=="reset"||i!=null)){Br(e);return}r=r!=null?""+$s(r):"",i=i!=null?""+$s(i):r,$||i===e.value||(e.value=i),e.defaultValue=i}o=o??g,o=typeof o!="function"&&typeof o!="symbol"&&!!o,e.checked=$?e.checked:!!o,e.defaultChecked=!!o,N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"&&(e.name=N),Br(e)}function Ir(e,i,r){i==="number"&&nr(e.ownerDocument)===e||e.defaultValue===""+r||(e.defaultValue=""+r)}function Yi(e,i,r,o){if(e=e.options,i){i={};for(var g=0;g<r.length;g++)i["$"+r[g]]=!0;for(r=0;r<e.length;r++)g=i.hasOwnProperty("$"+e[r].value),e[r].selected!==g&&(e[r].selected=g),g&&o&&(e[r].defaultSelected=!0)}else{for(r=""+$s(r),i=null,g=0;g<e.length;g++){if(e[g].value===r){e[g].selected=!0,o&&(e[g].defaultSelected=!0);return}i!==null||e[g].disabled||(i=e[g])}i!==null&&(i.selected=!0)}}function Pa(e,i,r){if(i!=null&&(i=""+$s(i),i!==e.value&&(e.value=i),r==null)){e.defaultValue!==i&&(e.defaultValue=i);return}e.defaultValue=r!=null?""+$s(r):""}function Ua(e,i,r,o){if(i==null){if(o!=null){if(r!=null)throw Error(a(92));if(se(o)){if(1<o.length)throw Error(a(93));o=o[0]}r=o}r==null&&(r=""),i=r}r=$s(i),e.defaultValue=r,o=e.textContent,o===r&&o!==""&&o!==null&&(e.value=o),Br(e)}function Ki(e,i){if(i){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=i;return}}e.textContent=i}var K=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 _e(e,i,r){var o=i.indexOf("--")===0;r==null||typeof r=="boolean"||r===""?o?e.setProperty(i,""):i==="float"?e.cssFloat="":e[i]="":o?e.setProperty(i,r):typeof r!="number"||r===0||K.has(i)?i==="float"?e.cssFloat=r:e[i]=(""+r).trim():e[i]=r+"px"}function Re(e,i,r){if(i!=null&&typeof i!="object")throw Error(a(62));if(e=e.style,r!=null){for(var o in r)!r.hasOwnProperty(o)||i!=null&&i.hasOwnProperty(o)||(o.indexOf("--")===0?e.setProperty(o,""):o==="float"?e.cssFloat="":e[o]="");for(var g in i)o=i[g],i.hasOwnProperty(g)&&r[g]!==o&&_e(e,g,o)}else for(var w in i)i.hasOwnProperty(w)&&_e(e,w,i[w])}function Ye(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 Pt=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"]]),Ts=/^[\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 ss(e){return Ts.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function _i(){}var ju=null;function Nu(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var zr=null,$r=null;function Xp(e){var i=ze(e);if(i&&(e=i.stateNode)){var r=e[nt]||null;e:switch(e=i.stateNode,i.type){case"input":if(Hr(e,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name),i=r.name,r.type==="radio"&&i!=null){for(r=e;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll('input[name="'+Ps(""+i)+'"][type="radio"]'),i=0;i<r.length;i++){var o=r[i];if(o!==e&&o.form===e.form){var g=o[nt]||null;if(!g)throw Error(a(90));Hr(o,g.value,g.defaultValue,g.defaultValue,g.checked,g.defaultChecked,g.type,g.name)}}for(i=0;i<r.length;i++)o=r[i],o.form===e.form&&za(o)}break e;case"textarea":Pa(e,r.value,r.defaultValue);break e;case"select":i=r.value,i!=null&&Yi(e,!!r.multiple,i,!1)}}}var Lu=!1;function Jp(e,i,r){if(Lu)return e(i,r);Lu=!0;try{var o=e(i);return o}finally{if(Lu=!1,(zr!==null||$r!==null)&&(ac(),zr&&(i=zr,e=$r,$r=zr=null,Xp(i),e)))for(i=0;i<e.length;i++)Xp(e[i])}}function Fa(e,i){var r=e.stateNode;if(r===null)return null;var o=r[nt]||null;if(o===null)return null;r=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(r&&typeof r!="function")throw Error(a(231,i,typeof r));return r}var Xi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ou=!1;if(Xi)try{var qa={};Object.defineProperty(qa,"passive",{get:function(){Ou=!0}}),window.addEventListener("test",qa,qa),window.removeEventListener("test",qa,qa)}catch{Ou=!1}var kn=null,Bu=null,bl=null;function Zp(){if(bl)return bl;var e,i=Bu,r=i.length,o,g="value"in kn?kn.value:kn.textContent,w=g.length;for(e=0;e<r&&i[e]===g[e];e++);var N=r-e;for(o=1;o<=N&&i[r-o]===g[w-o];o++);return bl=g.slice(e,1<o?1-o:void 0)}function Sl(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 wl(){return!0}function Qp(){return!1}function Ys(e){function i(r,o,g,w,N){this._reactName=r,this._targetInst=g,this.type=o,this.nativeEvent=w,this.target=N,this.currentTarget=null;for(var $ in e)e.hasOwnProperty($)&&(r=e[$],this[$]=r?r(w):w[$]);return this.isDefaultPrevented=(w.defaultPrevented!=null?w.defaultPrevented:w.returnValue===!1)?wl:Qp,this.isPropagationStopped=Qp,this}return f(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=wl)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=wl)},persist:function(){},isPersistent:wl}),i}var rr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},xl=Ys(rr),Wa=f({},rr,{view:0,detail:0}),Yb=Ys(Wa),Hu,Iu,Ga,Cl=f({},Wa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:$u,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!==Ga&&(Ga&&e.type==="mousemove"?(Hu=e.screenX-Ga.screenX,Iu=e.screenY-Ga.screenY):Iu=Hu=0,Ga=e),Hu)},movementY:function(e){return"movementY"in e?e.movementY:Iu}}),ev=Ys(Cl),Kb=f({},Cl,{dataTransfer:0}),Xb=Ys(Kb),Jb=f({},Wa,{relatedTarget:0}),zu=Ys(Jb),Zb=f({},rr,{animationName:0,elapsedTime:0,pseudoElement:0}),Qb=Ys(Zb),eS=f({},rr,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),tS=Ys(eS),sS=f({},rr,{data:0}),tv=Ys(sS),iS={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},nS={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"},rS={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function aS(e){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(e):(e=rS[e])?!!i[e]:!1}function $u(){return aS}var oS=f({},Wa,{key:function(e){if(e.key){var i=iS[e.key]||e.key;if(i!=="Unidentified")return i}return e.type==="keypress"?(e=Sl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?nS[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:$u,charCode:function(e){return e.type==="keypress"?Sl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Sl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),lS=Ys(oS),cS=f({},Cl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),sv=Ys(cS),uS=f({},Wa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:$u}),hS=Ys(uS),dS=f({},rr,{propertyName:0,elapsedTime:0,pseudoElement:0}),fS=Ys(dS),pS=f({},Cl,{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(pS),gS=f({},rr,{newState:0,oldState:0}),mS=Ys(gS),_S=[9,13,27,32],Pu=Xi&&"CompositionEvent"in window,Va=null;Xi&&"documentMode"in document&&(Va=document.documentMode);var yS=Xi&&"TextEvent"in window&&!Va,iv=Xi&&(!Pu||Va&&8<Va&&11>=Va),nv=" ",rv=!1;function av(e,i){switch(e){case"keyup":return _S.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ov(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Pr=!1;function bS(e,i){switch(e){case"compositionend":return ov(i);case"keypress":return i.which!==32?null:(rv=!0,nv);case"textInput":return e=i.data,e===nv&&rv?null:e;default:return null}}function SS(e,i){if(Pr)return e==="compositionend"||!Pu&&av(e,i)?(e=Zp(),bl=Bu=kn=null,Pr=!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 iv&&i.locale!=="ko"?null:i.data;default:return null}}var wS={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 lv(e){var i=e&&e.nodeName&&e.nodeName.toLowerCase();return i==="input"?!!wS[e.type]:i==="textarea"}function cv(e,i,r,o){zr?$r?$r.push(o):$r=[o]:zr=o,i=fc(i,"onChange"),0<i.length&&(r=new xl("onChange","change",null,r,o),e.push({event:r,listeners:i}))}var Ya=null,Ka=null;function xS(e){Wm(e,0)}function El(e){var i=ns(e);if(za(i))return e}function uv(e,i){if(e==="change")return i}var hv=!1;if(Xi){var Uu;if(Xi){var Fu="oninput"in document;if(!Fu){var dv=document.createElement("div");dv.setAttribute("oninput","return;"),Fu=typeof dv.oninput=="function"}Uu=Fu}else Uu=!1;hv=Uu&&(!document.documentMode||9<document.documentMode)}function fv(){Ya&&(Ya.detachEvent("onpropertychange",pv),Ka=Ya=null)}function pv(e){if(e.propertyName==="value"&&El(Ka)){var i=[];cv(i,Ka,e,Nu(e)),Jp(xS,i)}}function CS(e,i,r){e==="focusin"?(fv(),Ya=i,Ka=r,Ya.attachEvent("onpropertychange",pv)):e==="focusout"&&fv()}function ES(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return El(Ka)}function kS(e,i){if(e==="click")return El(i)}function TS(e,i){if(e==="input"||e==="change")return El(i)}function AS(e,i){return e===i&&(e!==0||1/e===1/i)||e!==e&&i!==i}var ii=typeof Object.is=="function"?Object.is:AS;function Xa(e,i){if(ii(e,i))return!0;if(typeof e!="object"||e===null||typeof i!="object"||i===null)return!1;var r=Object.keys(e),o=Object.keys(i);if(r.length!==o.length)return!1;for(o=0;o<r.length;o++){var g=r[o];if(!pt.call(i,g)||!ii(e[g],i[g]))return!1}return!0}function vv(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function gv(e,i){var r=vv(e);e=0;for(var o;r;){if(r.nodeType===3){if(o=e+r.textContent.length,e<=i&&o>=i)return{node:r,offset:i-e};e=o}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=vv(r)}}function mv(e,i){return e&&i?e===i?!0:e&&e.nodeType===3?!1:i&&i.nodeType===3?mv(e,i.parentNode):"contains"in e?e.contains(i):e.compareDocumentPosition?!!(e.compareDocumentPosition(i)&16):!1:!1}function _v(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 r=typeof i.contentWindow.location.href=="string"}catch{r=!1}if(r)e=i.contentWindow;else break;i=nr(e.document)}return i}function qu(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 RS=Xi&&"documentMode"in document&&11>=document.documentMode,Ur=null,Wu=null,Ja=null,Gu=!1;function yv(e,i,r){var o=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Gu||Ur==null||Ur!==nr(o)||(o=Ur,"selectionStart"in o&&qu(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}),Ja&&Xa(Ja,o)||(Ja=o,o=fc(Wu,"onSelect"),0<o.length&&(i=new xl("onSelect","select",null,i,r),e.push({event:i,listeners:o}),i.target=Ur)))}function ar(e,i){var r={};return r[e.toLowerCase()]=i.toLowerCase(),r["Webkit"+e]="webkit"+i,r["Moz"+e]="moz"+i,r}var Fr={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")},Vu={},bv={};Xi&&(bv=document.createElement("div").style,"AnimationEvent"in window||(delete Fr.animationend.animation,delete Fr.animationiteration.animation,delete Fr.animationstart.animation),"TransitionEvent"in window||delete Fr.transitionend.transition);function or(e){if(Vu[e])return Vu[e];if(!Fr[e])return e;var i=Fr[e],r;for(r in i)if(i.hasOwnProperty(r)&&r in bv)return Vu[e]=i[r];return e}var Sv=or("animationend"),wv=or("animationiteration"),xv=or("animationstart"),MS=or("transitionrun"),DS=or("transitionstart"),jS=or("transitioncancel"),Cv=or("transitionend"),Ev=new Map,Yu="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(" ");Yu.push("scrollEnd");function ji(e,i){Ev.set(e,i),rs(i,[e])}var kl=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)},yi=[],qr=0,Ku=0;function Tl(){for(var e=qr,i=Ku=qr=0;i<e;){var r=yi[i];yi[i++]=null;var o=yi[i];yi[i++]=null;var g=yi[i];yi[i++]=null;var w=yi[i];if(yi[i++]=null,o!==null&&g!==null){var N=o.pending;N===null?g.next=g:(g.next=N.next,N.next=g),o.pending=g}w!==0&&kv(r,g,w)}}function Al(e,i,r,o){yi[qr++]=e,yi[qr++]=i,yi[qr++]=r,yi[qr++]=o,Ku|=o,e.lanes|=o,e=e.alternate,e!==null&&(e.lanes|=o)}function Xu(e,i,r,o){return Al(e,i,r,o),Rl(e)}function lr(e,i){return Al(e,null,null,i),Rl(e)}function kv(e,i,r){e.lanes|=r;var o=e.alternate;o!==null&&(o.lanes|=r);for(var g=!1,w=e.return;w!==null;)w.childLanes|=r,o=w.alternate,o!==null&&(o.childLanes|=r),w.tag===22&&(e=w.stateNode,e===null||e._visibility&1||(g=!0)),e=w,w=w.return;return e.tag===3?(w=e.stateNode,g&&i!==null&&(g=31-bt(r),e=w.hiddenUpdates,o=e[g],o===null?e[g]=[i]:o.push(i),i.lane=r|536870912),w):null}function Rl(e){if(50<bo)throw bo=0,rd=null,Error(a(185));for(var i=e.return;i!==null;)e=i,i=e.return;return e.tag===3?e.stateNode:null}var Wr={};function NS(e,i,r,o){this.tag=e,this.key=r,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 ni(e,i,r,o){return new NS(e,i,r,o)}function Ju(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ji(e,i){var r=e.alternate;return r===null?(r=ni(e.tag,i,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=i,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&65011712,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,i=e.dependencies,r.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r.refCleanup=e.refCleanup,r}function Tv(e,i){e.flags&=65011714;var r=e.alternate;return r===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=r.childLanes,e.lanes=r.lanes,e.child=r.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=r.memoizedProps,e.memoizedState=r.memoizedState,e.updateQueue=r.updateQueue,e.type=r.type,i=r.dependencies,e.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),e}function Ml(e,i,r,o,g,w){var N=0;if(o=e,typeof e=="function")Ju(e)&&(N=1);else if(typeof e=="string")N=Iw(e,r,Q.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case D:return e=ni(31,r,i,g),e.elementType=D,e.lanes=w,e;case C:return cr(r.children,g,w,i);case y:N=8,g|=24;break;case b:return e=ni(12,r,i,g|2),e.elementType=b,e.lanes=w,e;case R:return e=ni(13,r,i,g),e.elementType=R,e.lanes=w,e;case M:return e=ni(19,r,i,g),e.elementType=M,e.lanes=w,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case _:N=10;break e;case m:N=9;break e;case k:N=11;break e;case j:N=14;break e;case T:N=16,o=null;break e}N=29,r=Error(a(130,e===null?"null":typeof e,"")),o=null}return i=ni(N,r,i,g),i.elementType=e,i.type=o,i.lanes=w,i}function cr(e,i,r,o){return e=ni(7,e,o,i),e.lanes=r,e}function Zu(e,i,r){return e=ni(6,e,null,i),e.lanes=r,e}function Av(e){var i=ni(18,null,null,0);return i.stateNode=e,i}function Qu(e,i,r){return i=ni(4,e.children!==null?e.children:[],e.key,i),i.lanes=r,i.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},i}var Rv=new WeakMap;function bi(e,i){if(typeof e=="object"&&e!==null){var r=Rv.get(e);return r!==void 0?r:(i={value:e,source:i,stack:$t(i)},Rv.set(e,i),i)}return{value:e,source:i,stack:$t(i)}}var Gr=[],Vr=0,Dl=null,Za=0,Si=[],wi=0,Tn=null,zi=1,$i="";function Zi(e,i){Gr[Vr++]=Za,Gr[Vr++]=Dl,Dl=e,Za=i}function Mv(e,i,r){Si[wi++]=zi,Si[wi++]=$i,Si[wi++]=Tn,Tn=e;var o=zi;e=$i;var g=32-bt(o)-1;o&=~(1<<g),r+=1;var w=32-bt(i)+g;if(30<w){var N=g-g%5;w=(o&(1<<N)-1).toString(32),o>>=N,g-=N,zi=1<<32-bt(i)+g|r<<g|o,$i=w+e}else zi=1<<w|r<<g|o,$i=e}function eh(e){e.return!==null&&(Zi(e,1),Mv(e,1,0))}function th(e){for(;e===Dl;)Dl=Gr[--Vr],Gr[Vr]=null,Za=Gr[--Vr],Gr[Vr]=null;for(;e===Tn;)Tn=Si[--wi],Si[wi]=null,$i=Si[--wi],Si[wi]=null,zi=Si[--wi],Si[wi]=null}function Dv(e,i){Si[wi++]=zi,Si[wi++]=$i,Si[wi++]=Tn,zi=i.id,$i=i.overflow,Tn=e}var As=null,Vt=null,mt=!1,An=null,xi=!1,sh=Error(a(519));function Rn(e){var i=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Qa(bi(i,e)),sh}function jv(e){var i=e.stateNode,r=e.type,o=e.memoizedProps;switch(i[Je]=e,i[nt]=o,r){case"dialog":ft("cancel",i),ft("close",i);break;case"iframe":case"object":case"embed":ft("load",i);break;case"video":case"audio":for(r=0;r<wo.length;r++)ft(wo[r],i);break;case"source":ft("error",i);break;case"img":case"image":case"link":ft("error",i),ft("load",i);break;case"details":ft("toggle",i);break;case"input":ft("invalid",i),$a(i,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":ft("invalid",i);break;case"textarea":ft("invalid",i),Ua(i,o.value,o.defaultValue,o.children)}r=o.children,typeof r!="string"&&typeof r!="number"&&typeof r!="bigint"||i.textContent===""+r||o.suppressHydrationWarning===!0||Km(i.textContent,r)?(o.popover!=null&&(ft("beforetoggle",i),ft("toggle",i)),o.onScroll!=null&&ft("scroll",i),o.onScrollEnd!=null&&ft("scrollend",i),o.onClick!=null&&(i.onclick=_i),i=!0):i=!1,i||Rn(e,!0)}function Nv(e){for(As=e.return;As;)switch(As.tag){case 5:case 31:case 13:xi=!1;return;case 27:case 3:xi=!0;return;default:As=As.return}}function Yr(e){if(e!==As)return!1;if(!mt)return Nv(e),mt=!0,!1;var i=e.tag,r;if((r=i!==3&&i!==27)&&((r=i===5)&&(r=e.type,r=!(r!=="form"&&r!=="button")||bd(e.type,e.memoizedProps)),r=!r),r&&Vt&&Rn(e),Nv(e),i===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(317));Vt=n_(e)}else if(i===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(317));Vt=n_(e)}else i===27?(i=Vt,Fn(e.type)?(e=Ed,Ed=null,Vt=e):Vt=i):Vt=As?Ei(e.stateNode.nextSibling):null;return!0}function ur(){Vt=As=null,mt=!1}function ih(){var e=An;return e!==null&&(Zs===null?Zs=e:Zs.push.apply(Zs,e),An=null),e}function Qa(e){An===null?An=[e]:An.push(e)}var nh=L(null),hr=null,Qi=null;function Mn(e,i,r){V(nh,i._currentValue),i._currentValue=r}function en(e){e._currentValue=nh.current,B(nh)}function rh(e,i,r){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===r)break;e=e.return}}function ah(e,i,r,o){var g=e.child;for(g!==null&&(g.return=e);g!==null;){var w=g.dependencies;if(w!==null){var N=g.child;w=w.firstContext;e:for(;w!==null;){var $=w;w=g;for(var X=0;X<i.length;X++)if($.context===i[X]){w.lanes|=r,$=w.alternate,$!==null&&($.lanes|=r),rh(w.return,r,e),o||(N=null);break e}w=$.next}}else if(g.tag===18){if(N=g.return,N===null)throw Error(a(341));N.lanes|=r,w=N.alternate,w!==null&&(w.lanes|=r),rh(N,r,e),N=null}else N=g.child;if(N!==null)N.return=g;else for(N=g;N!==null;){if(N===e){N=null;break}if(g=N.sibling,g!==null){g.return=N.return,N=g;break}N=N.return}g=N}}function Kr(e,i,r,o){e=null;for(var g=i,w=!1;g!==null;){if(!w){if((g.flags&524288)!==0)w=!0;else if((g.flags&262144)!==0)break}if(g.tag===10){var N=g.alternate;if(N===null)throw Error(a(387));if(N=N.memoizedProps,N!==null){var $=g.type;ii(g.pendingProps.value,N.value)||(e!==null?e.push($):e=[$])}}else if(g===Y.current){if(N=g.alternate,N===null)throw Error(a(387));N.memoizedState.memoizedState!==g.memoizedState.memoizedState&&(e!==null?e.push(To):e=[To])}g=g.return}e!==null&&ah(i,e,r,o),i.flags|=262144}function jl(e){for(e=e.firstContext;e!==null;){if(!ii(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 Lv(hr,e)}function Nl(e,i){return hr===null&&dr(e),Lv(e,i)}function Lv(e,i){var r=i._currentValue;if(i={context:i,memoizedValue:r,next:null},Qi===null){if(e===null)throw Error(a(308));Qi=i,e.dependencies={lanes:0,firstContext:i},e.flags|=524288}else Qi=Qi.next=i;return r}var LS=typeof AbortController<"u"?AbortController:function(){var e=[],i=this.signal={aborted:!1,addEventListener:function(r,o){e.push(o)}};this.abort=function(){i.aborted=!0,e.forEach(function(r){return r()})}},OS=s.unstable_scheduleCallback,BS=s.unstable_NormalPriority,fs={$$typeof:_,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function oh(){return{controller:new LS,data:new Map,refCount:0}}function eo(e){e.refCount--,e.refCount===0&&OS(BS,function(){e.controller.abort()})}var to=null,lh=0,Xr=0,Jr=null;function HS(e,i){if(to===null){var r=to=[];lh=0,Xr=hd(),Jr={status:"pending",value:void 0,then:function(o){r.push(o)}}}return lh++,i.then(Ov,Ov),i}function Ov(){if(--lh===0&&to!==null){Jr!==null&&(Jr.status="fulfilled");var e=to;to=null,Xr=0,Jr=null;for(var i=0;i<e.length;i++)(0,e[i])()}}function IS(e,i){var r=[],o={status:"pending",value:null,reason:null,then:function(g){r.push(g)}};return e.then(function(){o.status="fulfilled",o.value=i;for(var g=0;g<r.length;g++)(0,r[g])(i)},function(g){for(o.status="rejected",o.reason=g,g=0;g<r.length;g++)(0,r[g])(void 0)}),o}var Bv=F.S;F.S=function(e,i){ym=ot(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&HS(e,i),Bv!==null&&Bv(e,i)};var fr=L(null);function ch(){var e=fr.current;return e!==null?e:Ut.pooledCache}function Ll(e,i){i===null?V(fr,fr.current):V(fr,i.pool)}function Hv(){var e=ch();return e===null?null:{parent:fs._currentValue,pool:e}}var Zr=Error(a(460)),uh=Error(a(474)),Ol=Error(a(542)),Bl={then:function(){}};function Iv(e){return e=e.status,e==="fulfilled"||e==="rejected"}function zv(e,i,r){switch(r=e[r],r===void 0?e.push(i):r!==i&&(i.then(_i,_i),i=r),i.status){case"fulfilled":return i.value;case"rejected":throw e=i.reason,Pv(e),e;default:if(typeof i.status=="string")i.then(_i,_i);else{if(e=Ut,e!==null&&100<e.shellSuspendCounter)throw Error(a(482));e=i,e.status="pending",e.then(function(o){if(i.status==="pending"){var g=i;g.status="fulfilled",g.value=o}},function(o){if(i.status==="pending"){var g=i;g.status="rejected",g.reason=o}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw e=i.reason,Pv(e),e}throw vr=i,Zr}}function pr(e){try{var i=e._init;return i(e._payload)}catch(r){throw r!==null&&typeof r=="object"&&typeof r.then=="function"?(vr=r,Zr):r}}var vr=null;function $v(){if(vr===null)throw Error(a(459));var e=vr;return vr=null,e}function Pv(e){if(e===Zr||e===Ol)throw Error(a(483))}var Qr=null,so=0;function Hl(e){var i=so;return so+=1,Qr===null&&(Qr=[]),zv(Qr,e,i)}function io(e,i){i=i.props.ref,e.ref=i!==void 0?i:null}function Il(e,i){throw i.$$typeof===x?Error(a(525)):(e=Object.prototype.toString.call(i),Error(a(31,e==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":e)))}function Uv(e){function i(te,ee){if(e){var ne=te.deletions;ne===null?(te.deletions=[ee],te.flags|=16):ne.push(ee)}}function r(te,ee){if(!e)return null;for(;ee!==null;)i(te,ee),ee=ee.sibling;return null}function o(te){for(var ee=new Map;te!==null;)te.key!==null?ee.set(te.key,te):ee.set(te.index,te),te=te.sibling;return ee}function g(te,ee){return te=Ji(te,ee),te.index=0,te.sibling=null,te}function w(te,ee,ne){return te.index=ne,e?(ne=te.alternate,ne!==null?(ne=ne.index,ne<ee?(te.flags|=67108866,ee):ne):(te.flags|=67108866,ee)):(te.flags|=1048576,ee)}function N(te){return e&&te.alternate===null&&(te.flags|=67108866),te}function $(te,ee,ne,me){return ee===null||ee.tag!==6?(ee=Zu(ne,te.mode,me),ee.return=te,ee):(ee=g(ee,ne),ee.return=te,ee)}function X(te,ee,ne,me){var Ie=ne.type;return Ie===C?pe(te,ee,ne.props.children,me,ne.key):ee!==null&&(ee.elementType===Ie||typeof Ie=="object"&&Ie!==null&&Ie.$$typeof===T&&pr(Ie)===ee.type)?(ee=g(ee,ne.props),io(ee,ne),ee.return=te,ee):(ee=Ml(ne.type,ne.key,ne.props,null,te.mode,me),io(ee,ne),ee.return=te,ee)}function re(te,ee,ne,me){return ee===null||ee.tag!==4||ee.stateNode.containerInfo!==ne.containerInfo||ee.stateNode.implementation!==ne.implementation?(ee=Qu(ne,te.mode,me),ee.return=te,ee):(ee=g(ee,ne.children||[]),ee.return=te,ee)}function pe(te,ee,ne,me,Ie){return ee===null||ee.tag!==7?(ee=cr(ne,te.mode,me,Ie),ee.return=te,ee):(ee=g(ee,ne),ee.return=te,ee)}function be(te,ee,ne){if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return ee=Zu(""+ee,te.mode,ne),ee.return=te,ee;if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case E:return ne=Ml(ee.type,ee.key,ee.props,null,te.mode,ne),io(ne,ee),ne.return=te,ne;case A:return ee=Qu(ee,te.mode,ne),ee.return=te,ee;case T:return ee=pr(ee),be(te,ee,ne)}if(se(ee)||W(ee))return ee=cr(ee,te.mode,ne,null),ee.return=te,ee;if(typeof ee.then=="function")return be(te,Hl(ee),ne);if(ee.$$typeof===_)return be(te,Nl(te,ee),ne);Il(te,ee)}return null}function le(te,ee,ne,me){var Ie=ee!==null?ee.key:null;if(typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint")return Ie!==null?null:$(te,ee,""+ne,me);if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case E:return ne.key===Ie?X(te,ee,ne,me):null;case A:return ne.key===Ie?re(te,ee,ne,me):null;case T:return ne=pr(ne),le(te,ee,ne,me)}if(se(ne)||W(ne))return Ie!==null?null:pe(te,ee,ne,me,null);if(typeof ne.then=="function")return le(te,ee,Hl(ne),me);if(ne.$$typeof===_)return le(te,ee,Nl(te,ne),me);Il(te,ne)}return null}function he(te,ee,ne,me,Ie){if(typeof me=="string"&&me!==""||typeof me=="number"||typeof me=="bigint")return te=te.get(ne)||null,$(ee,te,""+me,Ie);if(typeof me=="object"&&me!==null){switch(me.$$typeof){case E:return te=te.get(me.key===null?ne:me.key)||null,X(ee,te,me,Ie);case A:return te=te.get(me.key===null?ne:me.key)||null,re(ee,te,me,Ie);case T:return me=pr(me),he(te,ee,ne,me,Ie)}if(se(me)||W(me))return te=te.get(ne)||null,pe(ee,te,me,Ie,null);if(typeof me.then=="function")return he(te,ee,ne,Hl(me),Ie);if(me.$$typeof===_)return he(te,ee,ne,Nl(ee,me),Ie);Il(ee,me)}return null}function Le(te,ee,ne,me){for(var Ie=null,St=null,Be=ee,rt=ee=0,gt=null;Be!==null&&rt<ne.length;rt++){Be.index>rt?(gt=Be,Be=null):gt=Be.sibling;var wt=le(te,Be,ne[rt],me);if(wt===null){Be===null&&(Be=gt);break}e&&Be&&wt.alternate===null&&i(te,Be),ee=w(wt,ee,rt),St===null?Ie=wt:St.sibling=wt,St=wt,Be=gt}if(rt===ne.length)return r(te,Be),mt&&Zi(te,rt),Ie;if(Be===null){for(;rt<ne.length;rt++)Be=be(te,ne[rt],me),Be!==null&&(ee=w(Be,ee,rt),St===null?Ie=Be:St.sibling=Be,St=Be);return mt&&Zi(te,rt),Ie}for(Be=o(Be);rt<ne.length;rt++)gt=he(Be,te,rt,ne[rt],me),gt!==null&&(e&&gt.alternate!==null&&Be.delete(gt.key===null?rt:gt.key),ee=w(gt,ee,rt),St===null?Ie=gt:St.sibling=gt,St=gt);return e&&Be.forEach(function(Yn){return i(te,Yn)}),mt&&Zi(te,rt),Ie}function qe(te,ee,ne,me){if(ne==null)throw Error(a(151));for(var Ie=null,St=null,Be=ee,rt=ee=0,gt=null,wt=ne.next();Be!==null&&!wt.done;rt++,wt=ne.next()){Be.index>rt?(gt=Be,Be=null):gt=Be.sibling;var Yn=le(te,Be,wt.value,me);if(Yn===null){Be===null&&(Be=gt);break}e&&Be&&Yn.alternate===null&&i(te,Be),ee=w(Yn,ee,rt),St===null?Ie=Yn:St.sibling=Yn,St=Yn,Be=gt}if(wt.done)return r(te,Be),mt&&Zi(te,rt),Ie;if(Be===null){for(;!wt.done;rt++,wt=ne.next())wt=be(te,wt.value,me),wt!==null&&(ee=w(wt,ee,rt),St===null?Ie=wt:St.sibling=wt,St=wt);return mt&&Zi(te,rt),Ie}for(Be=o(Be);!wt.done;rt++,wt=ne.next())wt=he(Be,te,rt,wt.value,me),wt!==null&&(e&&wt.alternate!==null&&Be.delete(wt.key===null?rt:wt.key),ee=w(wt,ee,rt),St===null?Ie=wt:St.sibling=wt,St=wt);return e&&Be.forEach(function(Kw){return i(te,Kw)}),mt&&Zi(te,rt),Ie}function Bt(te,ee,ne,me){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 Ie=ne.key;ee!==null;){if(ee.key===Ie){if(Ie=ne.type,Ie===C){if(ee.tag===7){r(te,ee.sibling),me=g(ee,ne.props.children),me.return=te,te=me;break e}}else if(ee.elementType===Ie||typeof Ie=="object"&&Ie!==null&&Ie.$$typeof===T&&pr(Ie)===ee.type){r(te,ee.sibling),me=g(ee,ne.props),io(me,ne),me.return=te,te=me;break e}r(te,ee);break}else i(te,ee);ee=ee.sibling}ne.type===C?(me=cr(ne.props.children,te.mode,me,ne.key),me.return=te,te=me):(me=Ml(ne.type,ne.key,ne.props,null,te.mode,me),io(me,ne),me.return=te,te=me)}return N(te);case A:e:{for(Ie=ne.key;ee!==null;){if(ee.key===Ie)if(ee.tag===4&&ee.stateNode.containerInfo===ne.containerInfo&&ee.stateNode.implementation===ne.implementation){r(te,ee.sibling),me=g(ee,ne.children||[]),me.return=te,te=me;break e}else{r(te,ee);break}else i(te,ee);ee=ee.sibling}me=Qu(ne,te.mode,me),me.return=te,te=me}return N(te);case T:return ne=pr(ne),Bt(te,ee,ne,me)}if(se(ne))return Le(te,ee,ne,me);if(W(ne)){if(Ie=W(ne),typeof Ie!="function")throw Error(a(150));return ne=Ie.call(ne),qe(te,ee,ne,me)}if(typeof ne.then=="function")return Bt(te,ee,Hl(ne),me);if(ne.$$typeof===_)return Bt(te,ee,Nl(te,ne),me);Il(te,ne)}return typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint"?(ne=""+ne,ee!==null&&ee.tag===6?(r(te,ee.sibling),me=g(ee,ne),me.return=te,te=me):(r(te,ee),me=Zu(ne,te.mode,me),me.return=te,te=me),N(te)):r(te,ee)}return function(te,ee,ne,me){try{so=0;var Ie=Bt(te,ee,ne,me);return Qr=null,Ie}catch(Be){if(Be===Zr||Be===Ol)throw Be;var St=ni(29,Be,null,te.mode);return St.lanes=me,St.return=te,St}finally{}}}var gr=Uv(!0),Fv=Uv(!1),Dn=!1;function hh(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function dh(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 jn(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Nn(e,i,r){var o=e.updateQueue;if(o===null)return null;if(o=o.shared,(Et&2)!==0){var g=o.pending;return g===null?i.next=i:(i.next=g.next,g.next=i),o.pending=i,i=Rl(e),kv(e,null,r),i}return Al(e,o,i,r),Rl(e)}function no(e,i,r){if(i=i.updateQueue,i!==null&&(i=i.shared,(r&4194048)!==0)){var o=i.lanes;o&=e.pendingLanes,r|=o,i.lanes=r,ve(e,r)}}function fh(e,i){var r=e.updateQueue,o=e.alternate;if(o!==null&&(o=o.updateQueue,r===o)){var g=null,w=null;if(r=r.firstBaseUpdate,r!==null){do{var N={lane:r.lane,tag:r.tag,payload:r.payload,callback:null,next:null};w===null?g=w=N:w=w.next=N,r=r.next}while(r!==null);w===null?g=w=i:w=w.next=i}else g=w=i;r={baseState:o.baseState,firstBaseUpdate:g,lastBaseUpdate:w,shared:o.shared,callbacks:o.callbacks},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=i:e.next=i,r.lastBaseUpdate=i}var ph=!1;function ro(){if(ph){var e=Jr;if(e!==null)throw e}}function ao(e,i,r,o){ph=!1;var g=e.updateQueue;Dn=!1;var w=g.firstBaseUpdate,N=g.lastBaseUpdate,$=g.shared.pending;if($!==null){g.shared.pending=null;var X=$,re=X.next;X.next=null,N===null?w=re:N.next=re,N=X;var pe=e.alternate;pe!==null&&(pe=pe.updateQueue,$=pe.lastBaseUpdate,$!==N&&($===null?pe.firstBaseUpdate=re:$.next=re,pe.lastBaseUpdate=X))}if(w!==null){var be=g.baseState;N=0,pe=re=X=null,$=w;do{var le=$.lane&-536870913,he=le!==$.lane;if(he?(vt&le)===le:(o&le)===le){le!==0&&le===Xr&&(ph=!0),pe!==null&&(pe=pe.next={lane:0,tag:$.tag,payload:$.payload,callback:null,next:null});e:{var Le=e,qe=$;le=i;var Bt=r;switch(qe.tag){case 1:if(Le=qe.payload,typeof Le=="function"){be=Le.call(Bt,be,le);break e}be=Le;break e;case 3:Le.flags=Le.flags&-65537|128;case 0:if(Le=qe.payload,le=typeof Le=="function"?Le.call(Bt,be,le):Le,le==null)break e;be=f({},be,le);break e;case 2:Dn=!0}}le=$.callback,le!==null&&(e.flags|=64,he&&(e.flags|=8192),he=g.callbacks,he===null?g.callbacks=[le]:he.push(le))}else he={lane:le,tag:$.tag,payload:$.payload,callback:$.callback,next:null},pe===null?(re=pe=he,X=be):pe=pe.next=he,N|=le;if($=$.next,$===null){if($=g.shared.pending,$===null)break;he=$,$=he.next,he.next=null,g.lastBaseUpdate=he,g.shared.pending=null}}while(!0);pe===null&&(X=be),g.baseState=X,g.firstBaseUpdate=re,g.lastBaseUpdate=pe,w===null&&(g.shared.lanes=0),In|=N,e.lanes=N,e.memoizedState=be}}function qv(e,i){if(typeof e!="function")throw Error(a(191,e));e.call(i)}function Wv(e,i){var r=e.callbacks;if(r!==null)for(e.callbacks=null,e=0;e<r.length;e++)qv(r[e],i)}var ea=L(null),zl=L(0);function Gv(e,i){e=un,V(zl,e),V(ea,i),un=e|i.baseLanes}function vh(){V(zl,un),V(ea,ea.current)}function gh(){un=zl.current,B(ea),B(zl)}var ri=L(null),Ci=null;function Ln(e){var i=e.alternate;V(cs,cs.current&1),V(ri,e),Ci===null&&(i===null||ea.current!==null||i.memoizedState!==null)&&(Ci=e)}function mh(e){V(cs,cs.current),V(ri,e),Ci===null&&(Ci=e)}function Vv(e){e.tag===22?(V(cs,cs.current),V(ri,e),Ci===null&&(Ci=e)):On()}function On(){V(cs,cs.current),V(ri,ri.current)}function ai(e){B(ri),Ci===e&&(Ci=null),B(cs)}var cs=L(0);function $l(e){for(var i=e;i!==null;){if(i.tag===13){var r=i.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||xd(r)||Cd(r)))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,st=null,Lt=null,ps=null,Pl=!1,ta=!1,mr=!1,Ul=0,oo=0,sa=null,zS=0;function as(){throw Error(a(321))}function _h(e,i){if(i===null)return!1;for(var r=0;r<i.length&&r<e.length;r++)if(!ii(e[r],i[r]))return!1;return!0}function yh(e,i,r,o,g,w){return tn=w,st=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,F.H=e===null||e.memoizedState===null?Mg:Lh,mr=!1,w=r(o,g),mr=!1,ta&&(w=Kv(i,r,o,g)),Yv(e),w}function Yv(e){F.H=uo;var i=Lt!==null&&Lt.next!==null;if(tn=0,ps=Lt=st=null,Pl=!1,oo=0,sa=null,i)throw Error(a(300));e===null||vs||(e=e.dependencies,e!==null&&jl(e)&&(vs=!0))}function Kv(e,i,r,o){st=e;var g=0;do{if(ta&&(sa=null),oo=0,ta=!1,25<=g)throw Error(a(301));if(g+=1,ps=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=Dg,w=i(r,o)}while(ta);return w}function $S(){var e=F.H,i=e.useState()[0];return i=typeof i.then=="function"?lo(i):i,e=e.useState()[0],(Lt!==null?Lt.memoizedState:null)!==e&&(st.flags|=1024),i}function bh(){var e=Ul!==0;return Ul=0,e}function Sh(e,i,r){i.updateQueue=e.updateQueue,i.flags&=-2053,e.lanes&=~r}function wh(e){if(Pl){for(e=e.memoizedState;e!==null;){var i=e.queue;i!==null&&(i.pending=null),e=e.next}Pl=!1}tn=0,ps=Lt=st=null,ta=!1,oo=Ul=0,sa=null}function Us(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ps===null?st.memoizedState=ps=e:ps=ps.next=e,ps}function us(){if(Lt===null){var e=st.alternate;e=e!==null?e.memoizedState:null}else e=Lt.next;var i=ps===null?st.memoizedState:ps.next;if(i!==null)ps=i,Lt=e;else{if(e===null)throw st.alternate===null?Error(a(467)):Error(a(310));Lt=e,e={memoizedState:Lt.memoizedState,baseState:Lt.baseState,baseQueue:Lt.baseQueue,queue:Lt.queue,next:null},ps===null?st.memoizedState=ps=e:ps=ps.next=e}return ps}function Fl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function lo(e){var i=oo;return oo+=1,sa===null&&(sa=[]),e=zv(sa,e,i),i=st,(ps===null?i.memoizedState:ps.next)===null&&(i=i.alternate,F.H=i===null||i.memoizedState===null?Mg:Lh),e}function ql(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return lo(e);if(e.$$typeof===_)return Rs(e)}throw Error(a(438,String(e)))}function xh(e){var i=null,r=st.updateQueue;if(r!==null&&(i=r.memoCache),i==null){var o=st.alternate;o!==null&&(o=o.updateQueue,o!==null&&(o=o.memoCache,o!=null&&(i={data:o.data.map(function(g){return g.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),r===null&&(r=Fl(),st.updateQueue=r),r.memoCache=i,r=i.data[i.index],r===void 0)for(r=i.data[i.index]=Array(e),o=0;o<e;o++)r[o]=I;return i.index++,r}function sn(e,i){return typeof i=="function"?i(e):i}function Wl(e){var i=us();return Ch(i,Lt,e)}function Ch(e,i,r){var o=e.queue;if(o===null)throw Error(a(311));o.lastRenderedReducer=r;var g=e.baseQueue,w=o.pending;if(w!==null){if(g!==null){var N=g.next;g.next=w.next,w.next=N}i.baseQueue=g=w,o.pending=null}if(w=e.baseState,g===null)e.memoizedState=w;else{i=g.next;var $=N=null,X=null,re=i,pe=!1;do{var be=re.lane&-536870913;if(be!==re.lane?(vt&be)===be:(tn&be)===be){var le=re.revertLane;if(le===0)X!==null&&(X=X.next={lane:0,revertLane:0,gesture:null,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null}),be===Xr&&(pe=!0);else if((tn&le)===le){re=re.next,le===Xr&&(pe=!0);continue}else be={lane:0,revertLane:re.revertLane,gesture:null,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null},X===null?($=X=be,N=w):X=X.next=be,st.lanes|=le,In|=le;be=re.action,mr&&r(w,be),w=re.hasEagerState?re.eagerState:r(w,be)}else le={lane:be,revertLane:re.revertLane,gesture:re.gesture,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null},X===null?($=X=le,N=w):X=X.next=le,st.lanes|=be,In|=be;re=re.next}while(re!==null&&re!==i);if(X===null?N=w:X.next=$,!ii(w,e.memoizedState)&&(vs=!0,pe&&(r=Jr,r!==null)))throw r;e.memoizedState=w,e.baseState=N,e.baseQueue=X,o.lastRenderedState=w}return g===null&&(o.lanes=0),[e.memoizedState,o.dispatch]}function Eh(e){var i=us(),r=i.queue;if(r===null)throw Error(a(311));r.lastRenderedReducer=e;var o=r.dispatch,g=r.pending,w=i.memoizedState;if(g!==null){r.pending=null;var N=g=g.next;do w=e(w,N.action),N=N.next;while(N!==g);ii(w,i.memoizedState)||(vs=!0),i.memoizedState=w,i.baseQueue===null&&(i.baseState=w),r.lastRenderedState=w}return[w,o]}function Xv(e,i,r){var o=st,g=us(),w=mt;if(w){if(r===void 0)throw Error(a(407));r=r()}else r=i();var N=!ii((Lt||g).memoizedState,r);if(N&&(g.memoizedState=r,vs=!0),g=g.queue,Ah(Qv.bind(null,o,g,e),[e]),g.getSnapshot!==i||N||ps!==null&&ps.memoizedState.tag&1){if(o.flags|=2048,ia(9,{destroy:void 0},Zv.bind(null,o,g,r,i),null),Ut===null)throw Error(a(349));w||(tn&127)!==0||Jv(o,i,r)}return r}function Jv(e,i,r){e.flags|=16384,e={getSnapshot:i,value:r},i=st.updateQueue,i===null?(i=Fl(),st.updateQueue=i,i.stores=[e]):(r=i.stores,r===null?i.stores=[e]:r.push(e))}function Zv(e,i,r,o){i.value=r,i.getSnapshot=o,eg(i)&&tg(e)}function Qv(e,i,r){return r(function(){eg(i)&&tg(e)})}function eg(e){var i=e.getSnapshot;e=e.value;try{var r=i();return!ii(e,r)}catch{return!0}}function tg(e){var i=lr(e,2);i!==null&&Qs(i,e,2)}function kh(e){var i=Us();if(typeof e=="function"){var r=e;if(e=r(),mr){Gt(!0);try{r()}finally{Gt(!1)}}}return i.memoizedState=i.baseState=e,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:sn,lastRenderedState:e},i}function sg(e,i,r,o){return e.baseState=r,Ch(e,Lt,typeof o=="function"?o:sn)}function PS(e,i,r,o,g){if(Yl(e))throw Error(a(485));if(e=i.action,e!==null){var w={payload:g,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(N){w.listeners.push(N)}};F.T!==null?r(!0):w.isTransition=!1,o(w),r=i.pending,r===null?(w.next=i.pending=w,ig(i,w)):(w.next=r.next,i.pending=r.next=w)}}function ig(e,i){var r=i.action,o=i.payload,g=e.state;if(i.isTransition){var w=F.T,N={};F.T=N;try{var $=r(g,o),X=F.S;X!==null&&X(N,$),ng(e,i,$)}catch(re){Th(e,i,re)}finally{w!==null&&N.types!==null&&(w.types=N.types),F.T=w}}else try{w=r(g,o),ng(e,i,w)}catch(re){Th(e,i,re)}}function ng(e,i,r){r!==null&&typeof r=="object"&&typeof r.then=="function"?r.then(function(o){rg(e,i,o)},function(o){return Th(e,i,o)}):rg(e,i,r)}function rg(e,i,r){i.status="fulfilled",i.value=r,ag(i),e.state=r,i=e.pending,i!==null&&(r=i.next,r===i?e.pending=null:(r=r.next,i.next=r,ig(e,r)))}function Th(e,i,r){var o=e.pending;if(e.pending=null,o!==null){o=o.next;do i.status="rejected",i.reason=r,ag(i),i=i.next;while(i!==o)}e.action=null}function ag(e){e=e.listeners;for(var i=0;i<e.length;i++)(0,e[i])()}function og(e,i){return i}function lg(e,i){if(mt){var r=Ut.formState;if(r!==null){e:{var o=st;if(mt){if(Vt){t:{for(var g=Vt,w=xi;g.nodeType!==8;){if(!w){g=null;break t}if(g=Ei(g.nextSibling),g===null){g=null;break t}}w=g.data,g=w==="F!"||w==="F"?g:null}if(g){Vt=Ei(g.nextSibling),o=g.data==="F!";break e}}Rn(o)}o=!1}o&&(i=r[0])}}return r=Us(),r.memoizedState=r.baseState=i,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:og,lastRenderedState:i},r.queue=o,r=Tg.bind(null,st,o),o.dispatch=r,o=kh(!1),w=Nh.bind(null,st,!1,o.queue),o=Us(),g={state:i,dispatch:null,action:e,pending:null},o.queue=g,r=PS.bind(null,st,g,w,r),g.dispatch=r,o.memoizedState=e,[i,r,!1]}function cg(e){var i=us();return ug(i,Lt,e)}function ug(e,i,r){if(i=Ch(e,i,og)[0],e=Wl(sn)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var o=lo(i)}catch(N){throw N===Zr?Ol:N}else o=i;i=us();var g=i.queue,w=g.dispatch;return r!==i.memoizedState&&(st.flags|=2048,ia(9,{destroy:void 0},US.bind(null,g,r),null)),[o,w,e]}function US(e,i){e.action=i}function hg(e){var i=us(),r=Lt;if(r!==null)return ug(i,r,e);us(),i=i.memoizedState,r=us();var o=r.queue.dispatch;return r.memoizedState=e,[i,o,!1]}function ia(e,i,r,o){return e={tag:e,create:r,deps:o,inst:i,next:null},i=st.updateQueue,i===null&&(i=Fl(),st.updateQueue=i),r=i.lastEffect,r===null?i.lastEffect=e.next=e:(o=r.next,r.next=e,e.next=o,i.lastEffect=e),e}function dg(){return us().memoizedState}function Gl(e,i,r,o){var g=Us();st.flags|=e,g.memoizedState=ia(1|i,{destroy:void 0},r,o===void 0?null:o)}function Vl(e,i,r,o){var g=us();o=o===void 0?null:o;var w=g.memoizedState.inst;Lt!==null&&o!==null&&_h(o,Lt.memoizedState.deps)?g.memoizedState=ia(i,w,r,o):(st.flags|=e,g.memoizedState=ia(1|i,w,r,o))}function fg(e,i){Gl(8390656,8,e,i)}function Ah(e,i){Vl(2048,8,e,i)}function FS(e){st.flags|=4;var i=st.updateQueue;if(i===null)i=Fl(),st.updateQueue=i,i.events=[e];else{var r=i.events;r===null?i.events=[e]:r.push(e)}}function pg(e){var i=us().memoizedState;return FS({ref:i,nextImpl:e}),function(){if((Et&2)!==0)throw Error(a(440));return i.impl.apply(void 0,arguments)}}function vg(e,i){return Vl(4,2,e,i)}function gg(e,i){return Vl(4,4,e,i)}function mg(e,i){if(typeof i=="function"){e=e();var r=i(e);return function(){typeof r=="function"?r():i(null)}}if(i!=null)return e=e(),i.current=e,function(){i.current=null}}function _g(e,i,r){r=r!=null?r.concat([e]):null,Vl(4,4,mg.bind(null,i,e),r)}function Rh(){}function yg(e,i){var r=us();i=i===void 0?null:i;var o=r.memoizedState;return i!==null&&_h(i,o[1])?o[0]:(r.memoizedState=[e,i],e)}function bg(e,i){var r=us();i=i===void 0?null:i;var o=r.memoizedState;if(i!==null&&_h(i,o[1]))return o[0];if(o=e(),mr){Gt(!0);try{e()}finally{Gt(!1)}}return r.memoizedState=[o,i],o}function Mh(e,i,r){return r===void 0||(tn&1073741824)!==0&&(vt&261930)===0?e.memoizedState=i:(e.memoizedState=r,e=Sm(),st.lanes|=e,In|=e,r)}function Sg(e,i,r,o){return ii(r,i)?r:ea.current!==null?(e=Mh(e,r,o),ii(e,i)||(vs=!0),e):(tn&42)===0||(tn&1073741824)!==0&&(vt&261930)===0?(vs=!0,e.memoizedState=r):(e=Sm(),st.lanes|=e,In|=e,i)}function wg(e,i,r,o,g){var w=G.p;G.p=w!==0&&8>w?w:8;var N=F.T,$={};F.T=$,Nh(e,!1,i,r);try{var X=g(),re=F.S;if(re!==null&&re($,X),X!==null&&typeof X=="object"&&typeof X.then=="function"){var pe=IS(X,o);co(e,i,pe,ci(e))}else co(e,i,o,ci(e))}catch(be){co(e,i,{then:function(){},status:"rejected",reason:be},ci())}finally{G.p=w,N!==null&&$.types!==null&&(N.types=$.types),F.T=N}}function qS(){}function Dh(e,i,r,o){if(e.tag!==5)throw Error(a(476));var g=xg(e).queue;wg(e,g,i,J,r===null?qS:function(){return Cg(e),r(o)})}function xg(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 r={};return i.next={memoizedState:r,baseState:r,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:sn,lastRenderedState:r},next:null},e.memoizedState=i,e=e.alternate,e!==null&&(e.memoizedState=i),i}function Cg(e){var i=xg(e);i.next===null&&(i=e.alternate.memoizedState),co(e,i.next.queue,{},ci())}function jh(){return Rs(To)}function Eg(){return us().memoizedState}function kg(){return us().memoizedState}function WS(e){for(var i=e.return;i!==null;){switch(i.tag){case 24:case 3:var r=ci();e=jn(r);var o=Nn(i,e,r);o!==null&&(Qs(o,i,r),no(o,i,r)),i={cache:oh()},e.payload=i;return}i=i.return}}function GS(e,i,r){var o=ci();r={lane:o,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Yl(e)?Ag(i,r):(r=Xu(e,i,r,o),r!==null&&(Qs(r,e,o),Rg(r,i,o)))}function Tg(e,i,r){var o=ci();co(e,i,r,o)}function co(e,i,r,o){var g={lane:o,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null};if(Yl(e))Ag(i,g);else{var w=e.alternate;if(e.lanes===0&&(w===null||w.lanes===0)&&(w=i.lastRenderedReducer,w!==null))try{var N=i.lastRenderedState,$=w(N,r);if(g.hasEagerState=!0,g.eagerState=$,ii($,N))return Al(e,i,g,0),Ut===null&&Tl(),!1}catch{}finally{}if(r=Xu(e,i,g,o),r!==null)return Qs(r,e,o),Rg(r,i,o),!0}return!1}function Nh(e,i,r,o){if(o={lane:2,revertLane:hd(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},Yl(e)){if(i)throw Error(a(479))}else i=Xu(e,r,o,2),i!==null&&Qs(i,e,2)}function Yl(e){var i=e.alternate;return e===st||i!==null&&i===st}function Ag(e,i){ta=Pl=!0;var r=e.pending;r===null?i.next=i:(i.next=r.next,r.next=i),e.pending=i}function Rg(e,i,r){if((r&4194048)!==0){var o=i.lanes;o&=e.pendingLanes,r|=o,i.lanes=r,ve(e,r)}}var uo={readContext:Rs,use:ql,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};uo.useEffectEvent=as;var Mg={readContext:Rs,use:ql,useCallback:function(e,i){return Us().memoizedState=[e,i===void 0?null:i],e},useContext:Rs,useEffect:fg,useImperativeHandle:function(e,i,r){r=r!=null?r.concat([e]):null,Gl(4194308,4,mg.bind(null,i,e),r)},useLayoutEffect:function(e,i){return Gl(4194308,4,e,i)},useInsertionEffect:function(e,i){Gl(4,2,e,i)},useMemo:function(e,i){var r=Us();i=i===void 0?null:i;var o=e();if(mr){Gt(!0);try{e()}finally{Gt(!1)}}return r.memoizedState=[o,i],o},useReducer:function(e,i,r){var o=Us();if(r!==void 0){var g=r(i);if(mr){Gt(!0);try{r(i)}finally{Gt(!1)}}}else g=i;return o.memoizedState=o.baseState=g,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:g},o.queue=e,e=e.dispatch=GS.bind(null,st,e),[o.memoizedState,e]},useRef:function(e){var i=Us();return e={current:e},i.memoizedState=e},useState:function(e){e=kh(e);var i=e.queue,r=Tg.bind(null,st,i);return i.dispatch=r,[e.memoizedState,r]},useDebugValue:Rh,useDeferredValue:function(e,i){var r=Us();return Mh(r,e,i)},useTransition:function(){var e=kh(!1);return e=wg.bind(null,st,e.queue,!0,!1),Us().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,i,r){var o=st,g=Us();if(mt){if(r===void 0)throw Error(a(407));r=r()}else{if(r=i(),Ut===null)throw Error(a(349));(vt&127)!==0||Jv(o,i,r)}g.memoizedState=r;var w={value:r,getSnapshot:i};return g.queue=w,fg(Qv.bind(null,o,w,e),[e]),o.flags|=2048,ia(9,{destroy:void 0},Zv.bind(null,o,w,r,i),null),r},useId:function(){var e=Us(),i=Ut.identifierPrefix;if(mt){var r=$i,o=zi;r=(o&~(1<<32-bt(o)-1)).toString(32)+r,i="_"+i+"R_"+r,r=Ul++,0<r&&(i+="H"+r.toString(32)),i+="_"}else r=zS++,i="_"+i+"r_"+r.toString(32)+"_";return e.memoizedState=i},useHostTransitionStatus:jh,useFormState:lg,useActionState:lg,useOptimistic:function(e){var i=Us();i.memoizedState=i.baseState=e;var r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=r,i=Nh.bind(null,st,!0,r),r.dispatch=i,[e,i]},useMemoCache:xh,useCacheRefresh:function(){return Us().memoizedState=WS.bind(null,st)},useEffectEvent:function(e){var i=Us(),r={impl:e};return i.memoizedState=r,function(){if((Et&2)!==0)throw Error(a(440));return r.impl.apply(void 0,arguments)}}},Lh={readContext:Rs,use:ql,useCallback:yg,useContext:Rs,useEffect:Ah,useImperativeHandle:_g,useInsertionEffect:vg,useLayoutEffect:gg,useMemo:bg,useReducer:Wl,useRef:dg,useState:function(){return Wl(sn)},useDebugValue:Rh,useDeferredValue:function(e,i){var r=us();return Sg(r,Lt.memoizedState,e,i)},useTransition:function(){var e=Wl(sn)[0],i=us().memoizedState;return[typeof e=="boolean"?e:lo(e),i]},useSyncExternalStore:Xv,useId:Eg,useHostTransitionStatus:jh,useFormState:cg,useActionState:cg,useOptimistic:function(e,i){var r=us();return sg(r,Lt,e,i)},useMemoCache:xh,useCacheRefresh:kg};Lh.useEffectEvent=pg;var Dg={readContext:Rs,use:ql,useCallback:yg,useContext:Rs,useEffect:Ah,useImperativeHandle:_g,useInsertionEffect:vg,useLayoutEffect:gg,useMemo:bg,useReducer:Eh,useRef:dg,useState:function(){return Eh(sn)},useDebugValue:Rh,useDeferredValue:function(e,i){var r=us();return Lt===null?Mh(r,e,i):Sg(r,Lt.memoizedState,e,i)},useTransition:function(){var e=Eh(sn)[0],i=us().memoizedState;return[typeof e=="boolean"?e:lo(e),i]},useSyncExternalStore:Xv,useId:Eg,useHostTransitionStatus:jh,useFormState:hg,useActionState:hg,useOptimistic:function(e,i){var r=us();return Lt!==null?sg(r,Lt,e,i):(r.baseState=e,[e,r.queue.dispatch])},useMemoCache:xh,useCacheRefresh:kg};Dg.useEffectEvent=pg;function Oh(e,i,r,o){i=e.memoizedState,r=r(o,i),r=r==null?i:f({},i,r),e.memoizedState=r,e.lanes===0&&(e.updateQueue.baseState=r)}var Bh={enqueueSetState:function(e,i,r){e=e._reactInternals;var o=ci(),g=jn(o);g.payload=i,r!=null&&(g.callback=r),i=Nn(e,g,o),i!==null&&(Qs(i,e,o),no(i,e,o))},enqueueReplaceState:function(e,i,r){e=e._reactInternals;var o=ci(),g=jn(o);g.tag=1,g.payload=i,r!=null&&(g.callback=r),i=Nn(e,g,o),i!==null&&(Qs(i,e,o),no(i,e,o))},enqueueForceUpdate:function(e,i){e=e._reactInternals;var r=ci(),o=jn(r);o.tag=2,i!=null&&(o.callback=i),i=Nn(e,o,r),i!==null&&(Qs(i,e,r),no(i,e,r))}};function jg(e,i,r,o,g,w,N){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(o,w,N):i.prototype&&i.prototype.isPureReactComponent?!Xa(r,o)||!Xa(g,w):!0}function Ng(e,i,r,o){e=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(r,o),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(r,o),i.state!==e&&Bh.enqueueReplaceState(i,i.state,null)}function _r(e,i){var r=i;if("ref"in i){r={};for(var o in i)o!=="ref"&&(r[o]=i[o])}if(e=e.defaultProps){r===i&&(r=f({},r));for(var g in e)r[g]===void 0&&(r[g]=e[g])}return r}function Lg(e){kl(e)}function Og(e){console.error(e)}function Bg(e){kl(e)}function Kl(e,i){try{var r=e.onUncaughtError;r(i.value,{componentStack:i.stack})}catch(o){setTimeout(function(){throw o})}}function Hg(e,i,r){try{var o=e.onCaughtError;o(r.value,{componentStack:r.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(g){setTimeout(function(){throw g})}}function Hh(e,i,r){return r=jn(r),r.tag=3,r.payload={element:null},r.callback=function(){Kl(e,i)},r}function Ig(e){return e=jn(e),e.tag=3,e}function zg(e,i,r,o){var g=r.type.getDerivedStateFromError;if(typeof g=="function"){var w=o.value;e.payload=function(){return g(w)},e.callback=function(){Hg(i,r,o)}}var N=r.stateNode;N!==null&&typeof N.componentDidCatch=="function"&&(e.callback=function(){Hg(i,r,o),typeof g!="function"&&(zn===null?zn=new Set([this]):zn.add(this));var $=o.stack;this.componentDidCatch(o.value,{componentStack:$!==null?$:""})})}function VS(e,i,r,o,g){if(r.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(i=r.alternate,i!==null&&Kr(i,r,g,!0),r=ri.current,r!==null){switch(r.tag){case 31:case 13:return Ci===null?oc():r.alternate===null&&os===0&&(os=3),r.flags&=-257,r.flags|=65536,r.lanes=g,o===Bl?r.flags|=16384:(i=r.updateQueue,i===null?r.updateQueue=new Set([o]):i.add(o),ld(e,o,g)),!1;case 22:return r.flags|=65536,o===Bl?r.flags|=16384:(i=r.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([o])},r.updateQueue=i):(r=i.retryQueue,r===null?i.retryQueue=new Set([o]):r.add(o)),ld(e,o,g)),!1}throw Error(a(435,r.tag))}return ld(e,o,g),oc(),!1}if(mt)return i=ri.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=g,o!==sh&&(e=Error(a(422),{cause:o}),Qa(bi(e,r)))):(o!==sh&&(i=Error(a(423),{cause:o}),Qa(bi(i,r))),e=e.current.alternate,e.flags|=65536,g&=-g,e.lanes|=g,o=bi(o,r),g=Hh(e.stateNode,o,g),fh(e,g),os!==4&&(os=2)),!1;var w=Error(a(520),{cause:o});if(w=bi(w,r),yo===null?yo=[w]:yo.push(w),os!==4&&(os=2),i===null)return!0;o=bi(o,r),r=i;do{switch(r.tag){case 3:return r.flags|=65536,e=g&-g,r.lanes|=e,e=Hh(r.stateNode,o,e),fh(r,e),!1;case 1:if(i=r.type,w=r.stateNode,(r.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(zn===null||!zn.has(w))))return r.flags|=65536,g&=-g,r.lanes|=g,g=Ig(g),zg(g,e,r,o),fh(r,g),!1}r=r.return}while(r!==null);return!1}var Ih=Error(a(461)),vs=!1;function Ms(e,i,r,o){i.child=e===null?Fv(i,null,r,o):gr(i,e.child,r,o)}function $g(e,i,r,o,g){r=r.render;var w=i.ref;if("ref"in o){var N={};for(var $ in o)$!=="ref"&&(N[$]=o[$])}else N=o;return dr(i),o=yh(e,i,r,N,w,g),$=bh(),e!==null&&!vs?(Sh(e,i,g),nn(e,i,g)):(mt&&$&&eh(i),i.flags|=1,Ms(e,i,o,g),i.child)}function Pg(e,i,r,o,g){if(e===null){var w=r.type;return typeof w=="function"&&!Ju(w)&&w.defaultProps===void 0&&r.compare===null?(i.tag=15,i.type=w,Ug(e,i,w,o,g)):(e=Ml(r.type,null,o,i,i.mode,g),e.ref=i.ref,e.return=i,i.child=e)}if(w=e.child,!Gh(e,g)){var N=w.memoizedProps;if(r=r.compare,r=r!==null?r:Xa,r(N,o)&&e.ref===i.ref)return nn(e,i,g)}return i.flags|=1,e=Ji(w,o),e.ref=i.ref,e.return=i,i.child=e}function Ug(e,i,r,o,g){if(e!==null){var w=e.memoizedProps;if(Xa(w,o)&&e.ref===i.ref)if(vs=!1,i.pendingProps=o=w,Gh(e,g))(e.flags&131072)!==0&&(vs=!0);else return i.lanes=e.lanes,nn(e,i,g)}return zh(e,i,r,o,g)}function Fg(e,i,r,o){var g=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|r:r,e!==null){for(o=i.child=e.child,g=0;o!==null;)g=g|o.lanes|o.childLanes,o=o.sibling;o=g&~w}else o=0,i.child=null;return qg(e,i,w,r,o)}if((r&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ll(i,w!==null?w.cachePool:null),w!==null?Gv(i,w):vh(),Vv(i);else return o=i.lanes=536870912,qg(e,i,w!==null?w.baseLanes|r:r,r,o)}else w!==null?(Ll(i,w.cachePool),Gv(i,w),On(),i.memoizedState=null):(e!==null&&Ll(i,null),vh(),On());return Ms(e,i,g,r),i.child}function ho(e,i){return e!==null&&e.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function qg(e,i,r,o,g){var w=ch();return w=w===null?null:{parent:fs._currentValue,pool:w},i.memoizedState={baseLanes:r,cachePool:w},e!==null&&Ll(i,null),vh(),Vv(i),e!==null&&Kr(e,i,o,!0),i.childLanes=g,null}function Xl(e,i){return i=Zl({mode:i.mode,children:i.children},e.mode),i.ref=e.ref,e.child=i,i.return=e,i}function Wg(e,i,r){return gr(i,e.child,null,r),e=Xl(i,i.pendingProps),e.flags|=2,ai(i),i.memoizedState=null,e}function YS(e,i,r){var o=i.pendingProps,g=(i.flags&128)!==0;if(i.flags&=-129,e===null){if(mt){if(o.mode==="hidden")return e=Xl(i,o),i.lanes=536870912,ho(null,e);if(mh(i),(e=Vt)?(e=i_(e,xi),e=e!==null&&e.data==="&"?e:null,e!==null&&(i.memoizedState={dehydrated:e,treeContext:Tn!==null?{id:zi,overflow:$i}:null,retryLane:536870912,hydrationErrors:null},r=Av(e),r.return=i,i.child=r,As=i,Vt=null)):e=null,e===null)throw Rn(i);return i.lanes=536870912,null}return Xl(i,o)}var w=e.memoizedState;if(w!==null){var N=w.dehydrated;if(mh(i),g)if(i.flags&256)i.flags&=-257,i=Wg(e,i,r);else if(i.memoizedState!==null)i.child=e.child,i.flags|=128,i=null;else throw Error(a(558));else if(vs||Kr(e,i,r,!1),g=(r&e.childLanes)!==0,vs||g){if(o=Ut,o!==null&&(N=ge(o,r),N!==0&&N!==w.retryLane))throw w.retryLane=N,lr(e,N),Qs(o,e,N),Ih;oc(),i=Wg(e,i,r)}else e=w.treeContext,Vt=Ei(N.nextSibling),As=i,mt=!0,An=null,xi=!1,e!==null&&Dv(i,e),i=Xl(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 Jl(e,i){var r=i.ref;if(r===null)e!==null&&e.ref!==null&&(i.flags|=4194816);else{if(typeof r!="function"&&typeof r!="object")throw Error(a(284));(e===null||e.ref!==r)&&(i.flags|=4194816)}}function zh(e,i,r,o,g){return dr(i),r=yh(e,i,r,o,void 0,g),o=bh(),e!==null&&!vs?(Sh(e,i,g),nn(e,i,g)):(mt&&o&&eh(i),i.flags|=1,Ms(e,i,r,g),i.child)}function Gg(e,i,r,o,g,w){return dr(i),i.updateQueue=null,r=Kv(i,o,r,g),Yv(e),o=bh(),e!==null&&!vs?(Sh(e,i,w),nn(e,i,w)):(mt&&o&&eh(i),i.flags|=1,Ms(e,i,r,w),i.child)}function Vg(e,i,r,o,g){if(dr(i),i.stateNode===null){var w=Wr,N=r.contextType;typeof N=="object"&&N!==null&&(w=Rs(N)),w=new r(o,w),i.memoizedState=w.state!==null&&w.state!==void 0?w.state:null,w.updater=Bh,i.stateNode=w,w._reactInternals=i,w=i.stateNode,w.props=o,w.state=i.memoizedState,w.refs={},hh(i),N=r.contextType,w.context=typeof N=="object"&&N!==null?Rs(N):Wr,w.state=i.memoizedState,N=r.getDerivedStateFromProps,typeof N=="function"&&(Oh(i,r,N,o),w.state=i.memoizedState),typeof r.getDerivedStateFromProps=="function"||typeof w.getSnapshotBeforeUpdate=="function"||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(N=w.state,typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount(),N!==w.state&&Bh.enqueueReplaceState(w,w.state,null),ao(i,o,w,g),ro(),w.state=i.memoizedState),typeof w.componentDidMount=="function"&&(i.flags|=4194308),o=!0}else if(e===null){w=i.stateNode;var $=i.memoizedProps,X=_r(r,$);w.props=X;var re=w.context,pe=r.contextType;N=Wr,typeof pe=="object"&&pe!==null&&(N=Rs(pe));var be=r.getDerivedStateFromProps;pe=typeof be=="function"||typeof w.getSnapshotBeforeUpdate=="function",$=i.pendingProps!==$,pe||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||($||re!==N)&&Ng(i,w,o,N),Dn=!1;var le=i.memoizedState;w.state=le,ao(i,o,w,g),ro(),re=i.memoizedState,$||le!==re||Dn?(typeof be=="function"&&(Oh(i,r,be,o),re=i.memoizedState),(X=Dn||jg(i,r,X,o,le,re,N))?(pe||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=N,o=X):(typeof w.componentDidMount=="function"&&(i.flags|=4194308),o=!1)}else{w=i.stateNode,dh(e,i),N=i.memoizedProps,pe=_r(r,N),w.props=pe,be=i.pendingProps,le=w.context,re=r.contextType,X=Wr,typeof re=="object"&&re!==null&&(X=Rs(re)),$=r.getDerivedStateFromProps,(re=typeof $=="function"||typeof w.getSnapshotBeforeUpdate=="function")||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(N!==be||le!==X)&&Ng(i,w,o,X),Dn=!1,le=i.memoizedState,w.state=le,ao(i,o,w,g),ro();var he=i.memoizedState;N!==be||le!==he||Dn||e!==null&&e.dependencies!==null&&jl(e.dependencies)?(typeof $=="function"&&(Oh(i,r,$,o),he=i.memoizedState),(pe=Dn||jg(i,r,pe,o,le,he,X)||e!==null&&e.dependencies!==null&&jl(e.dependencies))?(re||typeof w.UNSAFE_componentWillUpdate!="function"&&typeof w.componentWillUpdate!="function"||(typeof w.componentWillUpdate=="function"&&w.componentWillUpdate(o,he,X),typeof w.UNSAFE_componentWillUpdate=="function"&&w.UNSAFE_componentWillUpdate(o,he,X)),typeof w.componentDidUpdate=="function"&&(i.flags|=4),typeof w.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof w.componentDidUpdate!="function"||N===e.memoizedProps&&le===e.memoizedState||(i.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||N===e.memoizedProps&&le===e.memoizedState||(i.flags|=1024),i.memoizedProps=o,i.memoizedState=he),w.props=o,w.state=he,w.context=X,o=pe):(typeof w.componentDidUpdate!="function"||N===e.memoizedProps&&le===e.memoizedState||(i.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||N===e.memoizedProps&&le===e.memoizedState||(i.flags|=1024),o=!1)}return w=o,Jl(e,i),o=(i.flags&128)!==0,w||o?(w=i.stateNode,r=o&&typeof r.getDerivedStateFromError!="function"?null:w.render(),i.flags|=1,e!==null&&o?(i.child=gr(i,e.child,null,g),i.child=gr(i,null,r,g)):Ms(e,i,r,g),i.memoizedState=w.state,e=i.child):e=nn(e,i,g),e}function Yg(e,i,r,o){return ur(),i.flags|=256,Ms(e,i,r,o),i.child}var $h={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Ph(e){return{baseLanes:e,cachePool:Hv()}}function Uh(e,i,r){return e=e!==null?e.childLanes&~r:0,i&&(e|=li),e}function Kg(e,i,r){var o=i.pendingProps,g=!1,w=(i.flags&128)!==0,N;if((N=w)||(N=e!==null&&e.memoizedState===null?!1:(cs.current&2)!==0),N&&(g=!0,i.flags&=-129),N=(i.flags&32)!==0,i.flags&=-33,e===null){if(mt){if(g?Ln(i):On(),(e=Vt)?(e=i_(e,xi),e=e!==null&&e.data!=="&"?e:null,e!==null&&(i.memoizedState={dehydrated:e,treeContext:Tn!==null?{id:zi,overflow:$i}:null,retryLane:536870912,hydrationErrors:null},r=Av(e),r.return=i,i.child=r,As=i,Vt=null)):e=null,e===null)throw Rn(i);return Cd(e)?i.lanes=32:i.lanes=536870912,null}var $=o.children;return o=o.fallback,g?(On(),g=i.mode,$=Zl({mode:"hidden",children:$},g),o=cr(o,g,r,null),$.return=i,o.return=i,$.sibling=o,i.child=$,o=i.child,o.memoizedState=Ph(r),o.childLanes=Uh(e,N,r),i.memoizedState=$h,ho(null,o)):(Ln(i),Fh(i,$))}var X=e.memoizedState;if(X!==null&&($=X.dehydrated,$!==null)){if(w)i.flags&256?(Ln(i),i.flags&=-257,i=qh(e,i,r)):i.memoizedState!==null?(On(),i.child=e.child,i.flags|=128,i=null):(On(),$=o.fallback,g=i.mode,o=Zl({mode:"visible",children:o.children},g),$=cr($,g,r,null),$.flags|=2,o.return=i,$.return=i,o.sibling=$,i.child=o,gr(i,e.child,null,r),o=i.child,o.memoizedState=Ph(r),o.childLanes=Uh(e,N,r),i.memoizedState=$h,i=ho(null,o));else if(Ln(i),Cd($)){if(N=$.nextSibling&&$.nextSibling.dataset,N)var re=N.dgst;N=re,o=Error(a(419)),o.stack="",o.digest=N,Qa({value:o,source:null,stack:null}),i=qh(e,i,r)}else if(vs||Kr(e,i,r,!1),N=(r&e.childLanes)!==0,vs||N){if(N=Ut,N!==null&&(o=ge(N,r),o!==0&&o!==X.retryLane))throw X.retryLane=o,lr(e,o),Qs(N,e,o),Ih;xd($)||oc(),i=qh(e,i,r)}else xd($)?(i.flags|=192,i.child=e.child,i=null):(e=X.treeContext,Vt=Ei($.nextSibling),As=i,mt=!0,An=null,xi=!1,e!==null&&Dv(i,e),i=Fh(i,o.children),i.flags|=4096);return i}return g?(On(),$=o.fallback,g=i.mode,X=e.child,re=X.sibling,o=Ji(X,{mode:"hidden",children:o.children}),o.subtreeFlags=X.subtreeFlags&65011712,re!==null?$=Ji(re,$):($=cr($,g,r,null),$.flags|=2),$.return=i,o.return=i,o.sibling=$,i.child=o,ho(null,o),o=i.child,$=e.child.memoizedState,$===null?$=Ph(r):(g=$.cachePool,g!==null?(X=fs._currentValue,g=g.parent!==X?{parent:X,pool:X}:g):g=Hv(),$={baseLanes:$.baseLanes|r,cachePool:g}),o.memoizedState=$,o.childLanes=Uh(e,N,r),i.memoizedState=$h,ho(e.child,o)):(Ln(i),r=e.child,e=r.sibling,r=Ji(r,{mode:"visible",children:o.children}),r.return=i,r.sibling=null,e!==null&&(N=i.deletions,N===null?(i.deletions=[e],i.flags|=16):N.push(e)),i.child=r,i.memoizedState=null,r)}function Fh(e,i){return i=Zl({mode:"visible",children:i},e.mode),i.return=e,e.child=i}function Zl(e,i){return e=ni(22,e,null,i),e.lanes=0,e}function qh(e,i,r){return gr(i,e.child,null,r),e=Fh(i,i.pendingProps.children),e.flags|=2,i.memoizedState=null,e}function Xg(e,i,r){e.lanes|=i;var o=e.alternate;o!==null&&(o.lanes|=i),rh(e.return,i,r)}function Wh(e,i,r,o,g,w){var N=e.memoizedState;N===null?e.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:o,tail:r,tailMode:g,treeForkCount:w}:(N.isBackwards=i,N.rendering=null,N.renderingStartTime=0,N.last=o,N.tail=r,N.tailMode=g,N.treeForkCount=w)}function Jg(e,i,r){var o=i.pendingProps,g=o.revealOrder,w=o.tail;o=o.children;var N=cs.current,$=(N&2)!==0;if($?(N=N&1|2,i.flags|=128):N&=1,V(cs,N),Ms(e,i,o,r),o=mt?Za:0,!$&&e!==null&&(e.flags&128)!==0)e:for(e=i.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Xg(e,r,i);else if(e.tag===19)Xg(e,r,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(g){case"forwards":for(r=i.child,g=null;r!==null;)e=r.alternate,e!==null&&$l(e)===null&&(g=r),r=r.sibling;r=g,r===null?(g=i.child,i.child=null):(g=r.sibling,r.sibling=null),Wh(i,!1,g,r,w,o);break;case"backwards":case"unstable_legacy-backwards":for(r=null,g=i.child,i.child=null;g!==null;){if(e=g.alternate,e!==null&&$l(e)===null){i.child=g;break}e=g.sibling,g.sibling=r,r=g,g=e}Wh(i,!0,r,null,w,o);break;case"together":Wh(i,!1,null,null,void 0,o);break;default:i.memoizedState=null}return i.child}function nn(e,i,r){if(e!==null&&(i.dependencies=e.dependencies),In|=i.lanes,(r&i.childLanes)===0)if(e!==null){if(Kr(e,i,r,!1),(r&i.childLanes)===0)return null}else return null;if(e!==null&&i.child!==e.child)throw Error(a(153));if(i.child!==null){for(e=i.child,r=Ji(e,e.pendingProps),i.child=r,r.return=i;e.sibling!==null;)e=e.sibling,r=r.sibling=Ji(e,e.pendingProps),r.return=i;r.sibling=null}return i.child}function Gh(e,i){return(e.lanes&i)!==0?!0:(e=e.dependencies,!!(e!==null&&jl(e)))}function KS(e,i,r){switch(i.tag){case 3:z(i,i.stateNode.containerInfo),Mn(i,fs,e.memoizedState.cache),ur();break;case 27:case 5:ae(i);break;case 4:z(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):(r&i.child.childLanes)!==0?Kg(e,i,r):(Ln(i),e=nn(e,i,r),e!==null?e.sibling:null);Ln(i);break;case 19:var g=(e.flags&128)!==0;if(o=(r&i.childLanes)!==0,o||(Kr(e,i,r,!1),o=(r&i.childLanes)!==0),g){if(o)return Jg(e,i,r);i.flags|=128}if(g=i.memoizedState,g!==null&&(g.rendering=null,g.tail=null,g.lastEffect=null),V(cs,cs.current),o)break;return null;case 22:return i.lanes=0,Fg(e,i,r,i.pendingProps);case 24:Mn(i,fs,e.memoizedState.cache)}return nn(e,i,r)}function Zg(e,i,r){if(e!==null)if(e.memoizedProps!==i.pendingProps)vs=!0;else{if(!Gh(e,r)&&(i.flags&128)===0)return vs=!1,KS(e,i,r);vs=(e.flags&131072)!==0}else vs=!1,mt&&(i.flags&1048576)!==0&&Mv(i,Za,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")Ju(e)?(o=_r(e,o),i.tag=1,i=Vg(null,i,e,o,r)):(i.tag=0,i=zh(null,i,e,o,r));else{if(e!=null){var g=e.$$typeof;if(g===k){i.tag=11,i=$g(null,i,e,o,r);break e}else if(g===j){i.tag=14,i=Pg(null,i,e,o,r);break e}}throw i=Z(e)||e,Error(a(306,i,""))}}return i;case 0:return zh(e,i,i.type,i.pendingProps,r);case 1:return o=i.type,g=_r(o,i.pendingProps),Vg(e,i,o,g,r);case 3:e:{if(z(i,i.stateNode.containerInfo),e===null)throw Error(a(387));o=i.pendingProps;var w=i.memoizedState;g=w.element,dh(e,i),ao(i,o,null,r);var N=i.memoizedState;if(o=N.cache,Mn(i,fs,o),o!==w.cache&&ah(i,[fs],r,!0),ro(),o=N.element,w.isDehydrated)if(w={element:o,isDehydrated:!1,cache:N.cache},i.updateQueue.baseState=w,i.memoizedState=w,i.flags&256){i=Yg(e,i,o,r);break e}else if(o!==g){g=bi(Error(a(424)),i),Qa(g),i=Yg(e,i,o,r);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(Vt=Ei(e.firstChild),As=i,mt=!0,An=null,xi=!0,r=Fv(i,null,o,r),i.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling}else{if(ur(),o===g){i=nn(e,i,r);break e}Ms(e,i,o,r)}i=i.child}return i;case 26:return Jl(e,i),e===null?(r=c_(i.type,null,i.pendingProps,null))?i.memoizedState=r:mt||(r=i.type,e=i.pendingProps,o=pc(fe.current).createElement(r),o[Je]=i,o[nt]=e,Ds(o,r,e),Rt(o),i.stateNode=o):i.memoizedState=c_(i.type,e.memoizedProps,i.pendingProps,e.memoizedState),null;case 27:return ae(i),e===null&&mt&&(o=i.stateNode=a_(i.type,i.pendingProps,fe.current),As=i,xi=!0,g=Vt,Fn(i.type)?(Ed=g,Vt=Ei(o.firstChild)):Vt=g),Ms(e,i,i.pendingProps.children,r),Jl(e,i),e===null&&(i.flags|=4194304),i.child;case 5:return e===null&&mt&&((g=o=Vt)&&(o=Ew(o,i.type,i.pendingProps,xi),o!==null?(i.stateNode=o,As=i,Vt=Ei(o.firstChild),xi=!1,g=!0):g=!1),g||Rn(i)),ae(i),g=i.type,w=i.pendingProps,N=e!==null?e.memoizedProps:null,o=w.children,bd(g,w)?o=null:N!==null&&bd(g,N)&&(i.flags|=32),i.memoizedState!==null&&(g=yh(e,i,$S,null,null,r),To._currentValue=g),Jl(e,i),Ms(e,i,o,r),i.child;case 6:return e===null&&mt&&((e=r=Vt)&&(r=kw(r,i.pendingProps,xi),r!==null?(i.stateNode=r,As=i,Vt=null,e=!0):e=!1),e||Rn(i)),null;case 13:return Kg(e,i,r);case 4:return z(i,i.stateNode.containerInfo),o=i.pendingProps,e===null?i.child=gr(i,null,o,r):Ms(e,i,o,r),i.child;case 11:return $g(e,i,i.type,i.pendingProps,r);case 7:return Ms(e,i,i.pendingProps,r),i.child;case 8:return Ms(e,i,i.pendingProps.children,r),i.child;case 12:return Ms(e,i,i.pendingProps.children,r),i.child;case 10:return o=i.pendingProps,Mn(i,i.type,o.value),Ms(e,i,o.children,r),i.child;case 9:return g=i.type._context,o=i.pendingProps.children,dr(i),g=Rs(g),o=o(g),i.flags|=1,Ms(e,i,o,r),i.child;case 14:return Pg(e,i,i.type,i.pendingProps,r);case 15:return Ug(e,i,i.type,i.pendingProps,r);case 19:return Jg(e,i,r);case 31:return YS(e,i,r);case 22:return Fg(e,i,r,i.pendingProps);case 24:return dr(i),o=Rs(fs),e===null?(g=ch(),g===null&&(g=Ut,w=oh(),g.pooledCache=w,w.refCount++,w!==null&&(g.pooledCacheLanes|=r),g=w),i.memoizedState={parent:o,cache:g},hh(i),Mn(i,fs,g)):((e.lanes&r)!==0&&(dh(e,i),ao(i,null,null,r),ro()),g=e.memoizedState,w=i.memoizedState,g.parent!==o?(g={parent:o,cache:o},i.memoizedState=g,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=g),Mn(i,fs,o)):(o=w.cache,Mn(i,fs,o),o!==g.cache&&ah(i,[fs],r,!0))),Ms(e,i,i.pendingProps.children,r),i.child;case 29:throw i.pendingProps}throw Error(a(156,i.tag))}function rn(e){e.flags|=4}function Vh(e,i,r,o,g){if((i=(e.mode&32)!==0)&&(i=!1),i){if(e.flags|=16777216,(g&335544128)===g)if(e.stateNode.complete)e.flags|=8192;else if(Em())e.flags|=8192;else throw vr=Bl,uh}else e.flags&=-16777217}function Qg(e,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!p_(i))if(Em())e.flags|=8192;else throw vr=Bl,uh}function Ql(e,i){i!==null&&(e.flags|=4),e.flags&16384&&(i=e.tag!==22?vi():536870912,e.lanes|=i,oa|=i)}function fo(e,i){if(!mt)switch(e.tailMode){case"hidden":i=e.tail;for(var r=null;i!==null;)i.alternate!==null&&(r=i),i=i.sibling;r===null?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var o=null;r!==null;)r.alternate!==null&&(o=r),r=r.sibling;o===null?i||e.tail===null?e.tail=null:e.tail.sibling=null:o.sibling=null}}function Yt(e){var i=e.alternate!==null&&e.alternate.child===e.child,r=0,o=0;if(i)for(var g=e.child;g!==null;)r|=g.lanes|g.childLanes,o|=g.subtreeFlags&65011712,o|=g.flags&65011712,g.return=e,g=g.sibling;else for(g=e.child;g!==null;)r|=g.lanes|g.childLanes,o|=g.subtreeFlags,o|=g.flags,g.return=e,g=g.sibling;return e.subtreeFlags|=o,e.childLanes=r,i}function XS(e,i,r){var o=i.pendingProps;switch(th(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Yt(i),null;case 1:return Yt(i),null;case 3:return r=i.stateNode,o=null,e!==null&&(o=e.memoizedState.cache),i.memoizedState.cache!==o&&(i.flags|=2048),en(fs),oe(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Yr(i)?rn(i):e===null||e.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,ih())),Yt(i),null;case 26:var g=i.type,w=i.memoizedState;return e===null?(rn(i),w!==null?(Yt(i),Qg(i,w)):(Yt(i),Vh(i,g,null,o,r))):w?w!==e.memoizedState?(rn(i),Yt(i),Qg(i,w)):(Yt(i),i.flags&=-16777217):(e=e.memoizedProps,e!==o&&rn(i),Yt(i),Vh(i,g,e,o,r)),null;case 27:if(we(i),r=fe.current,g=i.type,e!==null&&i.stateNode!=null)e.memoizedProps!==o&&rn(i);else{if(!o){if(i.stateNode===null)throw Error(a(166));return Yt(i),null}e=Q.current,Yr(i)?jv(i):(e=a_(g,o,r),i.stateNode=e,rn(i))}return Yt(i),null;case 5:if(we(i),g=i.type,e!==null&&i.stateNode!=null)e.memoizedProps!==o&&rn(i);else{if(!o){if(i.stateNode===null)throw Error(a(166));return Yt(i),null}if(w=Q.current,Yr(i))jv(i);else{var N=pc(fe.current);switch(w){case 1:w=N.createElementNS("http://www.w3.org/2000/svg",g);break;case 2:w=N.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;default:switch(g){case"svg":w=N.createElementNS("http://www.w3.org/2000/svg",g);break;case"math":w=N.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;case"script":w=N.createElement("div"),w.innerHTML="<script><\/script>",w=w.removeChild(w.firstChild);break;case"select":w=typeof o.is=="string"?N.createElement("select",{is:o.is}):N.createElement("select"),o.multiple?w.multiple=!0:o.size&&(w.size=o.size);break;default:w=typeof o.is=="string"?N.createElement(g,{is:o.is}):N.createElement(g)}}w[Je]=i,w[nt]=o;e:for(N=i.child;N!==null;){if(N.tag===5||N.tag===6)w.appendChild(N.stateNode);else if(N.tag!==4&&N.tag!==27&&N.child!==null){N.child.return=N,N=N.child;continue}if(N===i)break e;for(;N.sibling===null;){if(N.return===null||N.return===i)break e;N=N.return}N.sibling.return=N.return,N=N.sibling}i.stateNode=w;e:switch(Ds(w,g,o),g){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 Yt(i),Vh(i,i.type,e===null?null:e.memoizedProps,i.pendingProps,r),null;case 6:if(e&&i.stateNode!=null)e.memoizedProps!==o&&rn(i);else{if(typeof o!="string"&&i.stateNode===null)throw Error(a(166));if(e=fe.current,Yr(i)){if(e=i.stateNode,r=i.memoizedProps,o=null,g=As,g!==null)switch(g.tag){case 27:case 5:o=g.memoizedProps}e[Je]=i,e=!!(e.nodeValue===r||o!==null&&o.suppressHydrationWarning===!0||Km(e.nodeValue,r)),e||Rn(i,!0)}else e=pc(e).createTextNode(o),e[Je]=i,i.stateNode=e}return Yt(i),null;case 31:if(r=i.memoizedState,e===null||e.memoizedState!==null){if(o=Yr(i),r!==null){if(e===null){if(!o)throw Error(a(318));if(e=i.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(557));e[Je]=i}else ur(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Yt(i),e=!1}else r=ih(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),e=!0;if(!e)return i.flags&256?(ai(i),i):(ai(i),null);if((i.flags&128)!==0)throw Error(a(558))}return Yt(i),null;case 13:if(o=i.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(g=Yr(i),o!==null&&o.dehydrated!==null){if(e===null){if(!g)throw Error(a(318));if(g=i.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(a(317));g[Je]=i}else ur(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Yt(i),g=!1}else g=ih(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=g),g=!0;if(!g)return i.flags&256?(ai(i),i):(ai(i),null)}return ai(i),(i.flags&128)!==0?(i.lanes=r,i):(r=o!==null,e=e!==null&&e.memoizedState!==null,r&&(o=i.child,g=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(g=o.alternate.memoizedState.cachePool.pool),w=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(w=o.memoizedState.cachePool.pool),w!==g&&(o.flags|=2048)),r!==e&&r&&(i.child.flags|=8192),Ql(i,i.updateQueue),Yt(i),null);case 4:return oe(),e===null&&vd(i.stateNode.containerInfo),Yt(i),null;case 10:return en(i.type),Yt(i),null;case 19:if(B(cs),o=i.memoizedState,o===null)return Yt(i),null;if(g=(i.flags&128)!==0,w=o.rendering,w===null)if(g)fo(o,!1);else{if(os!==0||e!==null&&(e.flags&128)!==0)for(e=i.child;e!==null;){if(w=$l(e),w!==null){for(i.flags|=128,fo(o,!1),e=w.updateQueue,i.updateQueue=e,Ql(i,e),i.subtreeFlags=0,e=r,r=i.child;r!==null;)Tv(r,e),r=r.sibling;return V(cs,cs.current&1|2),mt&&Zi(i,o.treeForkCount),i.child}e=e.sibling}o.tail!==null&&ot()>nc&&(i.flags|=128,g=!0,fo(o,!1),i.lanes=4194304)}else{if(!g)if(e=$l(w),e!==null){if(i.flags|=128,g=!0,e=e.updateQueue,i.updateQueue=e,Ql(i,e),fo(o,!0),o.tail===null&&o.tailMode==="hidden"&&!w.alternate&&!mt)return Yt(i),null}else 2*ot()-o.renderingStartTime>nc&&r!==536870912&&(i.flags|=128,g=!0,fo(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=ot(),e.sibling=null,r=cs.current,V(cs,g?r&1|2:r&1),mt&&Zi(i,o.treeForkCount),e):(Yt(i),null);case 22:case 23:return ai(i),gh(),o=i.memoizedState!==null,e!==null?e.memoizedState!==null!==o&&(i.flags|=8192):o&&(i.flags|=8192),o?(r&536870912)!==0&&(i.flags&128)===0&&(Yt(i),i.subtreeFlags&6&&(i.flags|=8192)):Yt(i),r=i.updateQueue,r!==null&&Ql(i,r.retryQueue),r=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(r=e.memoizedState.cachePool.pool),o=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(o=i.memoizedState.cachePool.pool),o!==r&&(i.flags|=2048),e!==null&&B(fr),null;case 24:return r=null,e!==null&&(r=e.memoizedState.cache),i.memoizedState.cache!==r&&(i.flags|=2048),en(fs),Yt(i),null;case 25:return null;case 30:return null}throw Error(a(156,i.tag))}function JS(e,i){switch(th(i),i.tag){case 1:return e=i.flags,e&65536?(i.flags=e&-65537|128,i):null;case 3:return en(fs),oe(),e=i.flags,(e&65536)!==0&&(e&128)===0?(i.flags=e&-65537|128,i):null;case 26:case 27:case 5:return we(i),null;case 31:if(i.memoizedState!==null){if(ai(i),i.alternate===null)throw Error(a(340));ur()}return e=i.flags,e&65536?(i.flags=e&-65537|128,i):null;case 13:if(ai(i),e=i.memoizedState,e!==null&&e.dehydrated!==null){if(i.alternate===null)throw Error(a(340));ur()}return e=i.flags,e&65536?(i.flags=e&-65537|128,i):null;case 19:return B(cs),null;case 4:return oe(),null;case 10:return en(i.type),null;case 22:case 23:return ai(i),gh(),e!==null&&B(fr),e=i.flags,e&65536?(i.flags=e&-65537|128,i):null;case 24:return en(fs),null;case 25:return null;default:return null}}function em(e,i){switch(th(i),i.tag){case 3:en(fs),oe();break;case 26:case 27:case 5:we(i);break;case 4:oe();break;case 31:i.memoizedState!==null&&ai(i);break;case 13:ai(i);break;case 19:B(cs);break;case 10:en(i.type);break;case 22:case 23:ai(i),gh(),e!==null&&B(fr);break;case 24:en(fs)}}function po(e,i){try{var r=i.updateQueue,o=r!==null?r.lastEffect:null;if(o!==null){var g=o.next;r=g;do{if((r.tag&e)===e){o=void 0;var w=r.create,N=r.inst;o=w(),N.destroy=o}r=r.next}while(r!==g)}}catch($){Dt(i,i.return,$)}}function Bn(e,i,r){try{var o=i.updateQueue,g=o!==null?o.lastEffect:null;if(g!==null){var w=g.next;o=w;do{if((o.tag&e)===e){var N=o.inst,$=N.destroy;if($!==void 0){N.destroy=void 0,g=i;var X=r,re=$;try{re()}catch(pe){Dt(g,X,pe)}}}o=o.next}while(o!==w)}}catch(pe){Dt(i,i.return,pe)}}function tm(e){var i=e.updateQueue;if(i!==null){var r=e.stateNode;try{Wv(i,r)}catch(o){Dt(e,e.return,o)}}}function sm(e,i,r){r.props=_r(e.type,e.memoizedProps),r.state=e.memoizedState;try{r.componentWillUnmount()}catch(o){Dt(e,i,o)}}function vo(e,i){try{var r=e.ref;if(r!==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 r=="function"?e.refCleanup=r(o):r.current=o}}catch(g){Dt(e,i,g)}}function Pi(e,i){var r=e.ref,o=e.refCleanup;if(r!==null)if(typeof o=="function")try{o()}catch(g){Dt(e,i,g)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof r=="function")try{r(null)}catch(g){Dt(e,i,g)}else r.current=null}function im(e){var i=e.type,r=e.memoizedProps,o=e.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":r.autoFocus&&o.focus();break e;case"img":r.src?o.src=r.src:r.srcSet&&(o.srcset=r.srcSet)}}catch(g){Dt(e,e.return,g)}}function Yh(e,i,r){try{var o=e.stateNode;yw(o,e.type,r,i),o[nt]=i}catch(g){Dt(e,e.return,g)}}function nm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Fn(e.type)||e.tag===4}function Kh(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||nm(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 Xh(e,i,r){var o=e.tag;if(o===5||o===6)e=e.stateNode,i?(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r).insertBefore(e,i):(i=r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,i.appendChild(e),r=r._reactRootContainer,r!=null||i.onclick!==null||(i.onclick=_i));else if(o!==4&&(o===27&&Fn(e.type)&&(r=e.stateNode,i=null),e=e.child,e!==null))for(Xh(e,i,r),e=e.sibling;e!==null;)Xh(e,i,r),e=e.sibling}function ec(e,i,r){var o=e.tag;if(o===5||o===6)e=e.stateNode,i?r.insertBefore(e,i):r.appendChild(e);else if(o!==4&&(o===27&&Fn(e.type)&&(r=e.stateNode),e=e.child,e!==null))for(ec(e,i,r),e=e.sibling;e!==null;)ec(e,i,r),e=e.sibling}function rm(e){var i=e.stateNode,r=e.memoizedProps;try{for(var o=e.type,g=i.attributes;g.length;)i.removeAttributeNode(g[0]);Ds(i,o,r),i[Je]=e,i[nt]=r}catch(w){Dt(e,e.return,w)}}var an=!1,gs=!1,Jh=!1,am=typeof WeakSet=="function"?WeakSet:Set,xs=null;function ZS(e,i){if(e=e.containerInfo,_d=Sc,e=_v(e),qu(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var o=r.getSelection&&r.getSelection();if(o&&o.rangeCount!==0){r=o.anchorNode;var g=o.anchorOffset,w=o.focusNode;o=o.focusOffset;try{r.nodeType,w.nodeType}catch{r=null;break e}var N=0,$=-1,X=-1,re=0,pe=0,be=e,le=null;t:for(;;){for(var he;be!==r||g!==0&&be.nodeType!==3||($=N+g),be!==w||o!==0&&be.nodeType!==3||(X=N+o),be.nodeType===3&&(N+=be.nodeValue.length),(he=be.firstChild)!==null;)le=be,be=he;for(;;){if(be===e)break t;if(le===r&&++re===g&&($=N),le===w&&++pe===o&&(X=N),(he=be.nextSibling)!==null)break;be=le,le=be.parentNode}be=he}r=$===-1||X===-1?null:{start:$,end:X}}else r=null}r=r||{start:0,end:0}}else r=null;for(yd={focusedElem:e,selectionRange:r},Sc=!1,xs=i;xs!==null;)if(i=xs,e=i.child,(i.subtreeFlags&1028)!==0&&e!==null)e.return=i,xs=e;else for(;xs!==null;){switch(i=xs,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(r=0;r<e.length;r++)g=e[r],g.ref.impl=g.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&w!==null){e=void 0,r=i,g=w.memoizedProps,w=w.memoizedState,o=r.stateNode;try{var Le=_r(r.type,g);e=o.getSnapshotBeforeUpdate(Le,w),o.__reactInternalSnapshotBeforeUpdate=e}catch(qe){Dt(r,r.return,qe)}}break;case 3:if((e&1024)!==0){if(e=i.stateNode.containerInfo,r=e.nodeType,r===9)wd(e);else if(r===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":wd(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(a(163))}if(e=i.sibling,e!==null){e.return=i.return,xs=e;break}xs=i.return}}function om(e,i,r){var o=r.flags;switch(r.tag){case 0:case 11:case 15:ln(e,r),o&4&&po(5,r);break;case 1:if(ln(e,r),o&4)if(e=r.stateNode,i===null)try{e.componentDidMount()}catch(N){Dt(r,r.return,N)}else{var g=_r(r.type,i.memoizedProps);i=i.memoizedState;try{e.componentDidUpdate(g,i,e.__reactInternalSnapshotBeforeUpdate)}catch(N){Dt(r,r.return,N)}}o&64&&tm(r),o&512&&vo(r,r.return);break;case 3:if(ln(e,r),o&64&&(e=r.updateQueue,e!==null)){if(i=null,r.child!==null)switch(r.child.tag){case 27:case 5:i=r.child.stateNode;break;case 1:i=r.child.stateNode}try{Wv(e,i)}catch(N){Dt(r,r.return,N)}}break;case 27:i===null&&o&4&&rm(r);case 26:case 5:ln(e,r),i===null&&o&4&&im(r),o&512&&vo(r,r.return);break;case 12:ln(e,r);break;case 31:ln(e,r),o&4&&um(e,r);break;case 13:ln(e,r),o&4&&hm(e,r),o&64&&(e=r.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(r=ow.bind(null,r),Tw(e,r))));break;case 22:if(o=r.memoizedState!==null||an,!o){i=i!==null&&i.memoizedState!==null||gs,g=an;var w=gs;an=o,(gs=i)&&!w?cn(e,r,(r.subtreeFlags&8772)!==0):ln(e,r),an=g,gs=w}break;case 30:break;default:ln(e,r)}}function lm(e){var i=e.alternate;i!==null&&(e.alternate=null,lm(i)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(i=e.stateNode,i!==null&&Oe(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 Qt=null,Ks=!1;function on(e,i,r){for(r=r.child;r!==null;)cm(e,i,r),r=r.sibling}function cm(e,i,r){if(is&&typeof is.onCommitFiberUnmount=="function")try{is.onCommitFiberUnmount(ys,r)}catch{}switch(r.tag){case 26:gs||Pi(r,i),on(e,i,r),r.memoizedState?r.memoizedState.count--:r.stateNode&&(r=r.stateNode,r.parentNode.removeChild(r));break;case 27:gs||Pi(r,i);var o=Qt,g=Ks;Fn(r.type)&&(Qt=r.stateNode,Ks=!1),on(e,i,r),Co(r.stateNode),Qt=o,Ks=g;break;case 5:gs||Pi(r,i);case 6:if(o=Qt,g=Ks,Qt=null,on(e,i,r),Qt=o,Ks=g,Qt!==null)if(Ks)try{(Qt.nodeType===9?Qt.body:Qt.nodeName==="HTML"?Qt.ownerDocument.body:Qt).removeChild(r.stateNode)}catch(w){Dt(r,i,w)}else try{Qt.removeChild(r.stateNode)}catch(w){Dt(r,i,w)}break;case 18:Qt!==null&&(Ks?(e=Qt,t_(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,r.stateNode),va(e)):t_(Qt,r.stateNode));break;case 4:o=Qt,g=Ks,Qt=r.stateNode.containerInfo,Ks=!0,on(e,i,r),Qt=o,Ks=g;break;case 0:case 11:case 14:case 15:Bn(2,r,i),gs||Bn(4,r,i),on(e,i,r);break;case 1:gs||(Pi(r,i),o=r.stateNode,typeof o.componentWillUnmount=="function"&&sm(r,i,o)),on(e,i,r);break;case 21:on(e,i,r);break;case 22:gs=(o=gs)||r.memoizedState!==null,on(e,i,r),gs=o;break;default:on(e,i,r)}}function um(e,i){if(i.memoizedState===null&&(e=i.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{va(e)}catch(r){Dt(i,i.return,r)}}}function hm(e,i){if(i.memoizedState===null&&(e=i.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{va(e)}catch(r){Dt(i,i.return,r)}}function QS(e){switch(e.tag){case 31:case 13:case 19:var i=e.stateNode;return i===null&&(i=e.stateNode=new am),i;case 22:return e=e.stateNode,i=e._retryCache,i===null&&(i=e._retryCache=new am),i;default:throw Error(a(435,e.tag))}}function tc(e,i){var r=QS(e);i.forEach(function(o){if(!r.has(o)){r.add(o);var g=lw.bind(null,e,o);o.then(g,g)}})}function Xs(e,i){var r=i.deletions;if(r!==null)for(var o=0;o<r.length;o++){var g=r[o],w=e,N=i,$=N;e:for(;$!==null;){switch($.tag){case 27:if(Fn($.type)){Qt=$.stateNode,Ks=!1;break e}break;case 5:Qt=$.stateNode,Ks=!1;break e;case 3:case 4:Qt=$.stateNode.containerInfo,Ks=!0;break e}$=$.return}if(Qt===null)throw Error(a(160));cm(w,N,g),Qt=null,Ks=!1,w=g.alternate,w!==null&&(w.return=null),g.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)dm(i,e),i=i.sibling}var Ni=null;function dm(e,i){var r=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),po(3,e),Bn(5,e,e.return));break;case 1:Xs(i,e),Js(e),o&512&&(gs||r===null||Pi(r,r.return)),o&64&&an&&(e=e.updateQueue,e!==null&&(o=e.callbacks,o!==null&&(r=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=r===null?o:r.concat(o))));break;case 26:var g=Ni;if(Xs(i,e),Js(e),o&512&&(gs||r===null||Pi(r,r.return)),o&4){var w=r!==null?r.memoizedState:null;if(o=e.memoizedState,r===null)if(o===null)if(e.stateNode===null){e:{o=e.type,r=e.memoizedProps,g=g.ownerDocument||g;t:switch(o){case"title":w=g.getElementsByTagName("title")[0],(!w||w[De]||w[Je]||w.namespaceURI==="http://www.w3.org/2000/svg"||w.hasAttribute("itemprop"))&&(w=g.createElement(o),g.head.insertBefore(w,g.querySelector("head > title"))),Ds(w,o,r),w[Je]=e,Rt(w),o=w;break e;case"link":var N=d_("link","href",g).get(o+(r.href||""));if(N){for(var $=0;$<N.length;$++)if(w=N[$],w.getAttribute("href")===(r.href==null||r.href===""?null:r.href)&&w.getAttribute("rel")===(r.rel==null?null:r.rel)&&w.getAttribute("title")===(r.title==null?null:r.title)&&w.getAttribute("crossorigin")===(r.crossOrigin==null?null:r.crossOrigin)){N.splice($,1);break t}}w=g.createElement(o),Ds(w,o,r),g.head.appendChild(w);break;case"meta":if(N=d_("meta","content",g).get(o+(r.content||""))){for($=0;$<N.length;$++)if(w=N[$],w.getAttribute("content")===(r.content==null?null:""+r.content)&&w.getAttribute("name")===(r.name==null?null:r.name)&&w.getAttribute("property")===(r.property==null?null:r.property)&&w.getAttribute("http-equiv")===(r.httpEquiv==null?null:r.httpEquiv)&&w.getAttribute("charset")===(r.charSet==null?null:r.charSet)){N.splice($,1);break t}}w=g.createElement(o),Ds(w,o,r),g.head.appendChild(w);break;default:throw Error(a(468,o))}w[Je]=e,Rt(w),o=w}e.stateNode=o}else f_(g,e.type,e.stateNode);else e.stateNode=h_(g,o,e.memoizedProps);else w!==o?(w===null?r.stateNode!==null&&(r=r.stateNode,r.parentNode.removeChild(r)):w.count--,o===null?f_(g,e.type,e.stateNode):h_(g,o,e.memoizedProps)):o===null&&e.stateNode!==null&&Yh(e,e.memoizedProps,r.memoizedProps)}break;case 27:Xs(i,e),Js(e),o&512&&(gs||r===null||Pi(r,r.return)),r!==null&&o&4&&Yh(e,e.memoizedProps,r.memoizedProps);break;case 5:if(Xs(i,e),Js(e),o&512&&(gs||r===null||Pi(r,r.return)),e.flags&32){g=e.stateNode;try{Ki(g,"")}catch(Le){Dt(e,e.return,Le)}}o&4&&e.stateNode!=null&&(g=e.memoizedProps,Yh(e,g,r!==null?r.memoizedProps:g)),o&1024&&(Jh=!0);break;case 6:if(Xs(i,e),Js(e),o&4){if(e.stateNode===null)throw Error(a(162));o=e.memoizedProps,r=e.stateNode;try{r.nodeValue=o}catch(Le){Dt(e,e.return,Le)}}break;case 3:if(mc=null,g=Ni,Ni=vc(i.containerInfo),Xs(i,e),Ni=g,Js(e),o&4&&r!==null&&r.memoizedState.isDehydrated)try{va(i.containerInfo)}catch(Le){Dt(e,e.return,Le)}Jh&&(Jh=!1,fm(e));break;case 4:o=Ni,Ni=vc(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,tc(e,o)));break;case 13:Xs(i,e),Js(e),e.child.flags&8192&&e.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(ic=ot()),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,tc(e,o)));break;case 22:g=e.memoizedState!==null;var X=r!==null&&r.memoizedState!==null,re=an,pe=gs;if(an=re||g,gs=pe||X,Xs(i,e),gs=pe,an=re,Js(e),o&8192)e:for(i=e.stateNode,i._visibility=g?i._visibility&-2:i._visibility|1,g&&(r===null||X||an||gs||yr(e)),r=null,i=e;;){if(i.tag===5||i.tag===26){if(r===null){X=r=i;try{if(w=X.stateNode,g)N=w.style,typeof N.setProperty=="function"?N.setProperty("display","none","important"):N.display="none";else{$=X.stateNode;var be=X.memoizedProps.style,le=be!=null&&be.hasOwnProperty("display")?be.display:null;$.style.display=le==null||typeof le=="boolean"?"":(""+le).trim()}}catch(Le){Dt(X,X.return,Le)}}}else if(i.tag===6){if(r===null){X=i;try{X.stateNode.nodeValue=g?"":X.memoizedProps}catch(Le){Dt(X,X.return,Le)}}}else if(i.tag===18){if(r===null){X=i;try{var he=X.stateNode;g?s_(he,!0):s_(X.stateNode,!1)}catch(Le){Dt(X,X.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;r===i&&(r=null),i=i.return}r===i&&(r=null),i.sibling.return=i.return,i=i.sibling}o&4&&(o=e.updateQueue,o!==null&&(r=o.retryQueue,r!==null&&(o.retryQueue=null,tc(e,r))));break;case 19:Xs(i,e),Js(e),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,tc(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 r,o=e.return;o!==null;){if(nm(o)){r=o;break}o=o.return}if(r==null)throw Error(a(160));switch(r.tag){case 27:var g=r.stateNode,w=Kh(e);ec(e,w,g);break;case 5:var N=r.stateNode;r.flags&32&&(Ki(N,""),r.flags&=-33);var $=Kh(e);ec(e,$,N);break;case 3:case 4:var X=r.stateNode.containerInfo,re=Kh(e);Xh(e,re,X);break;default:throw Error(a(161))}}catch(pe){Dt(e,e.return,pe)}e.flags&=-3}i&4096&&(e.flags&=-4097)}function fm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var i=e;fm(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;)om(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:Pi(i,i.return);var r=i.stateNode;typeof r.componentWillUnmount=="function"&&sm(i,i.return,r),yr(i);break;case 27:Co(i.stateNode);case 26:case 5:Pi(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,r){for(r=r&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var o=i.alternate,g=e,w=i,N=w.flags;switch(w.tag){case 0:case 11:case 15:cn(g,w,r),po(4,w);break;case 1:if(cn(g,w,r),o=w,g=o.stateNode,typeof g.componentDidMount=="function")try{g.componentDidMount()}catch(re){Dt(o,o.return,re)}if(o=w,g=o.updateQueue,g!==null){var $=o.stateNode;try{var X=g.shared.hiddenCallbacks;if(X!==null)for(g.shared.hiddenCallbacks=null,g=0;g<X.length;g++)qv(X[g],$)}catch(re){Dt(o,o.return,re)}}r&&N&64&&tm(w),vo(w,w.return);break;case 27:rm(w);case 26:case 5:cn(g,w,r),r&&o===null&&N&4&&im(w),vo(w,w.return);break;case 12:cn(g,w,r);break;case 31:cn(g,w,r),r&&N&4&&um(g,w);break;case 13:cn(g,w,r),r&&N&4&&hm(g,w);break;case 22:w.memoizedState===null&&cn(g,w,r),vo(w,w.return);break;case 30:break;default:cn(g,w,r)}i=i.sibling}}function Zh(e,i){var r=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(r=e.memoizedState.cachePool.pool),e=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(e=i.memoizedState.cachePool.pool),e!==r&&(e!=null&&e.refCount++,r!=null&&eo(r))}function Qh(e,i){e=null,i.alternate!==null&&(e=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==e&&(i.refCount++,e!=null&&eo(e))}function Li(e,i,r,o){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)pm(e,i,r,o),i=i.sibling}function pm(e,i,r,o){var g=i.flags;switch(i.tag){case 0:case 11:case 15:Li(e,i,r,o),g&2048&&po(9,i);break;case 1:Li(e,i,r,o);break;case 3:Li(e,i,r,o),g&2048&&(e=null,i.alternate!==null&&(e=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==e&&(i.refCount++,e!=null&&eo(e)));break;case 12:if(g&2048){Li(e,i,r,o),e=i.stateNode;try{var w=i.memoizedProps,N=w.id,$=w.onPostCommit;typeof $=="function"&&$(N,i.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(X){Dt(i,i.return,X)}}else Li(e,i,r,o);break;case 31:Li(e,i,r,o);break;case 13:Li(e,i,r,o);break;case 23:break;case 22:w=i.stateNode,N=i.alternate,i.memoizedState!==null?w._visibility&2?Li(e,i,r,o):go(e,i):w._visibility&2?Li(e,i,r,o):(w._visibility|=2,na(e,i,r,o,(i.subtreeFlags&10256)!==0||!1)),g&2048&&Zh(N,i);break;case 24:Li(e,i,r,o),g&2048&&Qh(i.alternate,i);break;default:Li(e,i,r,o)}}function na(e,i,r,o,g){for(g=g&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var w=e,N=i,$=r,X=o,re=N.flags;switch(N.tag){case 0:case 11:case 15:na(w,N,$,X,g),po(8,N);break;case 23:break;case 22:var pe=N.stateNode;N.memoizedState!==null?pe._visibility&2?na(w,N,$,X,g):go(w,N):(pe._visibility|=2,na(w,N,$,X,g)),g&&re&2048&&Zh(N.alternate,N);break;case 24:na(w,N,$,X,g),g&&re&2048&&Qh(N.alternate,N);break;default:na(w,N,$,X,g)}i=i.sibling}}function go(e,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var r=e,o=i,g=o.flags;switch(o.tag){case 22:go(r,o),g&2048&&Zh(o.alternate,o);break;case 24:go(r,o),g&2048&&Qh(o.alternate,o);break;default:go(r,o)}i=i.sibling}}var mo=8192;function ra(e,i,r){if(e.subtreeFlags&mo)for(e=e.child;e!==null;)vm(e,i,r),e=e.sibling}function vm(e,i,r){switch(e.tag){case 26:ra(e,i,r),e.flags&mo&&e.memoizedState!==null&&zw(r,Ni,e.memoizedState,e.memoizedProps);break;case 5:ra(e,i,r);break;case 3:case 4:var o=Ni;Ni=vc(e.stateNode.containerInfo),ra(e,i,r),Ni=o;break;case 22:e.memoizedState===null&&(o=e.alternate,o!==null&&o.memoizedState!==null?(o=mo,mo=16777216,ra(e,i,r),mo=o):ra(e,i,r));break;default:ra(e,i,r)}}function gm(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 _o(e){var i=e.deletions;if((e.flags&16)!==0){if(i!==null)for(var r=0;r<i.length;r++){var o=i[r];xs=o,_m(o,e)}gm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)mm(e),e=e.sibling}function mm(e){switch(e.tag){case 0:case 11:case 15:_o(e),e.flags&2048&&Bn(9,e,e.return);break;case 3:_o(e);break;case 12:_o(e);break;case 22:var i=e.stateNode;e.memoizedState!==null&&i._visibility&2&&(e.return===null||e.return.tag!==13)?(i._visibility&=-3,sc(e)):_o(e);break;default:_o(e)}}function sc(e){var i=e.deletions;if((e.flags&16)!==0){if(i!==null)for(var r=0;r<i.length;r++){var o=i[r];xs=o,_m(o,e)}gm(e)}for(e=e.child;e!==null;){switch(i=e,i.tag){case 0:case 11:case 15:Bn(8,i,i.return),sc(i);break;case 22:r=i.stateNode,r._visibility&2&&(r._visibility&=-3,sc(i));break;default:sc(i)}e=e.sibling}}function _m(e,i){for(;xs!==null;){var r=xs;switch(r.tag){case 0:case 11:case 15:Bn(8,r,i);break;case 23:case 22:if(r.memoizedState!==null&&r.memoizedState.cachePool!==null){var o=r.memoizedState.cachePool.pool;o!=null&&o.refCount++}break;case 24:eo(r.memoizedState.cache)}if(o=r.child,o!==null)o.return=r,xs=o;else e:for(r=e;xs!==null;){o=xs;var g=o.sibling,w=o.return;if(lm(o),o===r){xs=null;break e}if(g!==null){g.return=w,xs=g;break e}xs=w}}}var ew={getCacheForType:function(e){var i=Rs(fs),r=i.data.get(e);return r===void 0&&(r=e(),i.data.set(e,r)),r},cacheSignal:function(){return Rs(fs).controller.signal}},tw=typeof WeakMap=="function"?WeakMap:Map,Et=0,Ut=null,dt=null,vt=0,Mt=0,oi=null,Hn=!1,aa=!1,ed=!1,un=0,os=0,In=0,br=0,td=0,li=0,oa=0,yo=null,Zs=null,sd=!1,ic=0,ym=0,nc=1/0,rc=null,zn=null,Ss=0,$n=null,la=null,hn=0,id=0,nd=null,bm=null,bo=0,rd=null;function ci(){return(Et&2)!==0&&vt!==0?vt&-vt:F.T!==null?hd():yt()}function Sm(){if(li===0)if((vt&536870912)===0||mt){var e=Ke;Ke<<=1,(Ke&3932160)===0&&(Ke=262144),li=e}else li=536870912;return e=ri.current,e!==null&&(e.flags|=32),li}function Qs(e,i,r){(e===Ut&&(Mt===2||Mt===9)||e.cancelPendingCommit!==null)&&(ca(e,0),Pn(e,vt,li,!1)),ws(e,r),((Et&2)===0||e!==Ut)&&(e===Ut&&((Et&2)===0&&(br|=r),os===4&&Pn(e,vt,li,!1)),Ui(e))}function wm(e,i,r){if((Et&6)!==0)throw Error(a(327));var o=!r&&(i&127)===0&&(i&e.expiredLanes)===0||ut(e,i),g=o?nw(e,i):od(e,i,!0),w=o;do{if(g===0){aa&&!o&&Pn(e,i,0,!1);break}else{if(r=e.current.alternate,w&&!sw(r)){g=od(e,i,!1),w=!1;continue}if(g===2){if(w=i,e.errorRecoveryDisabledLanes&w)var N=0;else N=e.pendingLanes&-536870913,N=N!==0?N:N&536870912?536870912:0;if(N!==0){i=N;e:{var $=e;g=yo;var X=$.current.memoizedState.isDehydrated;if(X&&(ca($,N).flags|=256),N=od($,N,!1),N!==2){if(ed&&!X){$.errorRecoveryDisabledLanes|=w,br|=w,g=4;break e}w=Zs,Zs=g,w!==null&&(Zs===null?Zs=w:Zs.push.apply(Zs,w))}g=N}if(w=!1,g!==2)continue}}if(g===1){ca(e,0),Pn(e,i,0,!0);break}e:{switch(o=e,w=g,w){case 0:case 1:throw Error(a(345));case 4:if((i&4194048)!==i)break;case 6:Pn(o,i,li,!Hn);break e;case 2:Zs=null;break;case 3:case 5:break;default:throw Error(a(329))}if((i&62914560)===i&&(g=ic+300-ot(),10<g)){if(Pn(o,i,li,!Hn),Ve(o,0,!0)!==0)break e;hn=i,o.timeoutHandle=Qm(xm.bind(null,o,r,Zs,rc,sd,i,li,br,oa,Hn,w,"Throttled",-0,0),g);break e}xm(o,r,Zs,rc,sd,i,li,br,oa,Hn,w,null,-0,0)}}break}while(!0);Ui(e)}function xm(e,i,r,o,g,w,N,$,X,re,pe,be,le,he){if(e.timeoutHandle=-1,be=i.subtreeFlags,be&8192||(be&16785408)===16785408){be={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:_i},vm(i,w,be);var Le=(w&62914560)===w?ic-ot():(w&4194048)===w?ym-ot():0;if(Le=$w(be,Le),Le!==null){hn=w,e.cancelPendingCommit=Le(Dm.bind(null,e,i,w,r,o,g,N,$,X,pe,be,null,le,he)),Pn(e,w,N,!re);return}}Dm(e,i,w,r,o,g,N,$,X)}function sw(e){for(var i=e;;){var r=i.tag;if((r===0||r===11||r===15)&&i.flags&16384&&(r=i.updateQueue,r!==null&&(r=r.stores,r!==null)))for(var o=0;o<r.length;o++){var g=r[o],w=g.getSnapshot;g=g.value;try{if(!ii(w(),g))return!1}catch{return!1}}if(r=i.child,i.subtreeFlags&16384&&r!==null)r.return=i,i=r;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,r,o){i&=~td,i&=~br,e.suspendedLanes|=i,e.pingedLanes&=~i,o&&(e.warmLanes|=i),o=e.expirationTimes;for(var g=i;0<g;){var w=31-bt(g),N=1<<w;o[w]=-1,g&=~N}r!==0&&ie(e,r,i)}function ac(){return(Et&6)===0?(So(0),!1):!0}function ad(){if(dt!==null){if(Mt===0)var e=dt.return;else e=dt,Qi=hr=null,wh(e),Qr=null,so=0,e=dt;for(;e!==null;)em(e.alternate,e),e=e.return;dt=null}}function ca(e,i){var r=e.timeoutHandle;r!==-1&&(e.timeoutHandle=-1,ww(r)),r=e.cancelPendingCommit,r!==null&&(e.cancelPendingCommit=null,r()),hn=0,ad(),Ut=e,dt=r=Ji(e.current,null),vt=i,Mt=0,oi=null,Hn=!1,aa=ut(e,i),ed=!1,oa=li=td=br=In=os=0,Zs=yo=null,sd=!1,(i&8)!==0&&(i|=i&32);var o=e.entangledLanes;if(o!==0)for(e=e.entanglements,o&=i;0<o;){var g=31-bt(o),w=1<<g;i|=e[g],o&=~w}return un=i,Tl(),r}function Cm(e,i){st=null,F.H=uo,i===Zr||i===Ol?(i=$v(),Mt=3):i===uh?(i=$v(),Mt=4):Mt=i===Ih?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,oi=i,dt===null&&(os=1,Kl(e,bi(i,e.current)))}function Em(){var e=ri.current;return e===null?!0:(vt&4194048)===vt?Ci===null:(vt&62914560)===vt||(vt&536870912)!==0?e===Ci:!1}function km(){var e=F.H;return F.H=uo,e===null?uo:e}function Tm(){var e=F.A;return F.A=ew,e}function oc(){os=4,Hn||(vt&4194048)!==vt&&ri.current!==null||(aa=!0),(In&134217727)===0&&(br&134217727)===0||Ut===null||Pn(Ut,vt,li,!1)}function od(e,i,r){var o=Et;Et|=2;var g=km(),w=Tm();(Ut!==e||vt!==i)&&(rc=null,ca(e,i)),i=!1;var N=os;e:do try{if(Mt!==0&&dt!==null){var $=dt,X=oi;switch(Mt){case 8:ad(),N=6;break e;case 3:case 2:case 9:case 6:ri.current===null&&(i=!0);var re=Mt;if(Mt=0,oi=null,ua(e,$,X,re),r&&aa){N=0;break e}break;default:re=Mt,Mt=0,oi=null,ua(e,$,X,re)}}iw(),N=os;break}catch(pe){Cm(e,pe)}while(!0);return i&&e.shellSuspendCounter++,Qi=hr=null,Et=o,F.H=g,F.A=w,dt===null&&(Ut=null,vt=0,Tl()),N}function iw(){for(;dt!==null;)Am(dt)}function nw(e,i){var r=Et;Et|=2;var o=km(),g=Tm();Ut!==e||vt!==i?(rc=null,nc=ot()+500,ca(e,i)):aa=ut(e,i);e:do try{if(Mt!==0&&dt!==null){i=dt;var w=oi;t:switch(Mt){case 1:Mt=0,oi=null,ua(e,i,w,1);break;case 2:case 9:if(Iv(w)){Mt=0,oi=null,Rm(i);break}i=function(){Mt!==2&&Mt!==9||Ut!==e||(Mt=7),Ui(e)},w.then(i,i);break e;case 3:Mt=7;break e;case 4:Mt=5;break e;case 7:Iv(w)?(Mt=0,oi=null,Rm(i)):(Mt=0,oi=null,ua(e,i,w,7));break;case 5:var N=null;switch(dt.tag){case 26:N=dt.memoizedState;case 5:case 27:var $=dt;if(N?p_(N):$.stateNode.complete){Mt=0,oi=null;var X=$.sibling;if(X!==null)dt=X;else{var re=$.return;re!==null?(dt=re,lc(re)):dt=null}break t}}Mt=0,oi=null,ua(e,i,w,5);break;case 6:Mt=0,oi=null,ua(e,i,w,6);break;case 8:ad(),os=6;break e;default:throw Error(a(462))}}rw();break}catch(pe){Cm(e,pe)}while(!0);return Qi=hr=null,F.H=o,F.A=g,Et=r,dt!==null?0:(Ut=null,vt=0,Tl(),os)}function rw(){for(;dt!==null&&!ls();)Am(dt)}function Am(e){var i=Zg(e.alternate,e,un);e.memoizedProps=e.pendingProps,i===null?lc(e):dt=i}function Rm(e){var i=e,r=i.alternate;switch(i.tag){case 15:case 0:i=Gg(r,i,i.pendingProps,i.type,void 0,vt);break;case 11:i=Gg(r,i,i.pendingProps,i.type.render,i.ref,vt);break;case 5:wh(i);default:em(r,i),i=dt=Tv(i,un),i=Zg(r,i,un)}e.memoizedProps=e.pendingProps,i===null?lc(e):dt=i}function ua(e,i,r,o){Qi=hr=null,wh(i),Qr=null,so=0;var g=i.return;try{if(VS(e,g,i,r,vt)){os=1,Kl(e,bi(r,e.current)),dt=null;return}}catch(w){if(g!==null)throw dt=g,w;os=1,Kl(e,bi(r,e.current)),dt=null;return}i.flags&32768?(mt||o===1?e=!0:aa||(vt&536870912)!==0?e=!1:(Hn=e=!0,(o===2||o===9||o===3||o===6)&&(o=ri.current,o!==null&&o.tag===13&&(o.flags|=16384))),Mm(i,e)):lc(i)}function lc(e){var i=e;do{if((i.flags&32768)!==0){Mm(i,Hn);return}e=i.return;var r=XS(i.alternate,i,un);if(r!==null){dt=r;return}if(i=i.sibling,i!==null){dt=i;return}dt=i=e}while(i!==null);os===0&&(os=5)}function Mm(e,i){do{var r=JS(e.alternate,e);if(r!==null){r.flags&=32767,dt=r;return}if(r=e.return,r!==null&&(r.flags|=32768,r.subtreeFlags=0,r.deletions=null),!i&&(e=e.sibling,e!==null)){dt=e;return}dt=e=r}while(e!==null);os=6,dt=null}function Dm(e,i,r,o,g,w,N,$,X){e.cancelPendingCommit=null;do cc();while(Ss!==0);if((Et&6)!==0)throw Error(a(327));if(i!==null){if(i===e.current)throw Error(a(177));if(w=i.lanes|i.childLanes,w|=Ku,gi(e,r,w,N,$,X),e===Ut&&(dt=Ut=null,vt=0),la=i,$n=e,hn=r,id=w,nd=g,bm=o,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,cw(Pe,function(){return Bm(),null})):(e.callbackNode=null,e.callbackPriority=0),o=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||o){o=F.T,F.T=null,g=G.p,G.p=2,N=Et,Et|=4;try{ZS(e,i,r)}finally{Et=N,G.p=g,F.T=o}}Ss=1,jm(),Nm(),Lm()}}function jm(){if(Ss===1){Ss=0;var e=$n,i=la,r=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||r){r=F.T,F.T=null;var o=G.p;G.p=2;var g=Et;Et|=4;try{dm(i,e);var w=yd,N=_v(e.containerInfo),$=w.focusedElem,X=w.selectionRange;if(N!==$&&$&&$.ownerDocument&&mv($.ownerDocument.documentElement,$)){if(X!==null&&qu($)){var re=X.start,pe=X.end;if(pe===void 0&&(pe=re),"selectionStart"in $)$.selectionStart=re,$.selectionEnd=Math.min(pe,$.value.length);else{var be=$.ownerDocument||document,le=be&&be.defaultView||window;if(le.getSelection){var he=le.getSelection(),Le=$.textContent.length,qe=Math.min(X.start,Le),Bt=X.end===void 0?qe:Math.min(X.end,Le);!he.extend&&qe>Bt&&(N=Bt,Bt=qe,qe=N);var te=gv($,qe),ee=gv($,Bt);if(te&&ee&&(he.rangeCount!==1||he.anchorNode!==te.node||he.anchorOffset!==te.offset||he.focusNode!==ee.node||he.focusOffset!==ee.offset)){var ne=be.createRange();ne.setStart(te.node,te.offset),he.removeAllRanges(),qe>Bt?(he.addRange(ne),he.extend(ee.node,ee.offset)):(ne.setEnd(ee.node,ee.offset),he.addRange(ne))}}}}for(be=[],he=$;he=he.parentNode;)he.nodeType===1&&be.push({element:he,left:he.scrollLeft,top:he.scrollTop});for(typeof $.focus=="function"&&$.focus(),$=0;$<be.length;$++){var me=be[$];me.element.scrollLeft=me.left,me.element.scrollTop=me.top}}Sc=!!_d,yd=_d=null}finally{Et=g,G.p=o,F.T=r}}e.current=i,Ss=2}}function Nm(){if(Ss===2){Ss=0;var e=$n,i=la,r=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||r){r=F.T,F.T=null;var o=G.p;G.p=2;var g=Et;Et|=4;try{om(e,i.alternate,i)}finally{Et=g,G.p=o,F.T=r}}Ss=3}}function Lm(){if(Ss===4||Ss===3){Ss=0,_t();var e=$n,i=la,r=hn,o=bm;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?Ss=5:(Ss=0,la=$n=null,Om(e,e.pendingLanes));var g=e.pendingLanes;if(g===0&&(zn=null),Me(r),i=i.stateNode,is&&typeof is.onCommitFiberRoot=="function")try{is.onCommitFiberRoot(ys,i,void 0,(i.current.flags&128)===128)}catch{}if(o!==null){i=F.T,g=G.p,G.p=2,F.T=null;try{for(var w=e.onRecoverableError,N=0;N<o.length;N++){var $=o[N];w($.value,{componentStack:$.stack})}}finally{F.T=i,G.p=g}}(hn&3)!==0&&cc(),Ui(e),g=e.pendingLanes,(r&261930)!==0&&(g&42)!==0?e===rd?bo++:(bo=0,rd=e):bo=0,So(0)}}function Om(e,i){(e.pooledCacheLanes&=i)===0&&(i=e.pooledCache,i!=null&&(e.pooledCache=null,eo(i)))}function cc(){return jm(),Nm(),Lm(),Bm()}function Bm(){if(Ss!==5)return!1;var e=$n,i=id;id=0;var r=Me(hn),o=F.T,g=G.p;try{G.p=32>r?32:r,F.T=null,r=nd,nd=null;var w=$n,N=hn;if(Ss=0,la=$n=null,hn=0,(Et&6)!==0)throw Error(a(331));var $=Et;if(Et|=4,mm(w.current),pm(w,w.current,N,r),Et=$,So(0,!1),is&&typeof is.onPostCommitFiberRoot=="function")try{is.onPostCommitFiberRoot(ys,w)}catch{}return!0}finally{G.p=g,F.T=o,Om(e,i)}}function Hm(e,i,r){i=bi(r,i),i=Hh(e.stateNode,i,2),e=Nn(e,i,2),e!==null&&(ws(e,2),Ui(e))}function Dt(e,i,r){if(e.tag===3)Hm(e,e,r);else for(;i!==null;){if(i.tag===3){Hm(i,e,r);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=bi(r,e),r=Ig(2),o=Nn(i,r,2),o!==null&&(zg(r,o,i,e),ws(o,2),Ui(o));break}}i=i.return}}function ld(e,i,r){var o=e.pingCache;if(o===null){o=e.pingCache=new tw;var g=new Set;o.set(i,g)}else g=o.get(i),g===void 0&&(g=new Set,o.set(i,g));g.has(r)||(ed=!0,g.add(r),e=aw.bind(null,e,i,r),i.then(e,e))}function aw(e,i,r){var o=e.pingCache;o!==null&&o.delete(i),e.pingedLanes|=e.suspendedLanes&r,e.warmLanes&=~r,Ut===e&&(vt&r)===r&&(os===4||os===3&&(vt&62914560)===vt&&300>ot()-ic?(Et&2)===0&&ca(e,0):td|=r,oa===vt&&(oa=0)),Ui(e)}function Im(e,i){i===0&&(i=vi()),e=lr(e,i),e!==null&&(ws(e,i),Ui(e))}function ow(e){var i=e.memoizedState,r=0;i!==null&&(r=i.retryLane),Im(e,r)}function lw(e,i){var r=0;switch(e.tag){case 31:case 13:var o=e.stateNode,g=e.memoizedState;g!==null&&(r=g.retryLane);break;case 19:o=e.stateNode;break;case 22:o=e.stateNode._retryCache;break;default:throw Error(a(314))}o!==null&&o.delete(i),Im(e,r)}function cw(e,i){return Nt(e,i)}var uc=null,ha=null,cd=!1,hc=!1,ud=!1,Un=0;function Ui(e){e!==ha&&e.next===null&&(ha===null?uc=ha=e:ha=ha.next=e),hc=!0,cd||(cd=!0,hw())}function So(e,i){if(!ud&&hc){ud=!0;do for(var r=!1,o=uc;o!==null;){if(e!==0){var g=o.pendingLanes;if(g===0)var w=0;else{var N=o.suspendedLanes,$=o.pingedLanes;w=(1<<31-bt(42|e)+1)-1,w&=g&~(N&~$),w=w&201326741?w&201326741|1:w?w|2:0}w!==0&&(r=!0,Um(o,w))}else w=vt,w=Ve(o,o===Ut?w:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(w&3)===0||ut(o,w)||(r=!0,Um(o,w));o=o.next}while(r);ud=!1}}function uw(){zm()}function zm(){hc=cd=!1;var e=0;Un!==0&&Sw()&&(e=Un);for(var i=ot(),r=null,o=uc;o!==null;){var g=o.next,w=$m(o,i);w===0?(o.next=null,r===null?uc=g:r.next=g,g===null&&(ha=r)):(r=o,(e!==0||(w&3)!==0)&&(hc=!0)),o=g}Ss!==0&&Ss!==5||So(e),Un!==0&&(Un=0)}function $m(e,i){for(var r=e.suspendedLanes,o=e.pingedLanes,g=e.expirationTimes,w=e.pendingLanes&-62914561;0<w;){var N=31-bt(w),$=1<<N,X=g[N];X===-1?(($&r)===0||($&o)!==0)&&(g[N]=Es($,i)):X<=i&&(e.expiredLanes|=$),w&=~$}if(i=Ut,r=vt,r=Ve(e,e===i?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o=e.callbackNode,r===0||e===i&&(Mt===2||Mt===9)||e.cancelPendingCommit!==null)return o!==null&&o!==null&&xt(o),e.callbackNode=null,e.callbackPriority=0;if((r&3)===0||ut(e,r)){if(i=r&-r,i===e.callbackPriority)return i;switch(o!==null&&xt(o),Me(r)){case 2:case 8:r=Os;break;case 32:r=Pe;break;case 268435456:r=Wt;break;default:r=Pe}return o=Pm.bind(null,e),r=Nt(r,o),e.callbackPriority=i,e.callbackNode=r,i}return o!==null&&o!==null&&xt(o),e.callbackPriority=2,e.callbackNode=null,2}function Pm(e,i){if(Ss!==0&&Ss!==5)return e.callbackNode=null,e.callbackPriority=0,null;var r=e.callbackNode;if(cc()&&e.callbackNode!==r)return null;var o=vt;return o=Ve(e,e===Ut?o:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o===0?null:(wm(e,o,i),$m(e,ot()),e.callbackNode!=null&&e.callbackNode===r?Pm.bind(null,e):null)}function Um(e,i){if(cc())return null;wm(e,i,!0)}function hw(){xw(function(){(Et&6)!==0?Nt(Tt,uw):zm()})}function hd(){if(Un===0){var e=Xr;e===0&&(e=Cs,Cs<<=1,(Cs&261888)===0&&(Cs=256)),Un=e}return Un}function Fm(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:ss(""+e)}function qm(e,i){var r=i.ownerDocument.createElement("input");return r.name=i.name,r.value=i.value,e.id&&r.setAttribute("form",e.id),i.parentNode.insertBefore(r,i),e=new FormData(e),r.parentNode.removeChild(r),e}function dw(e,i,r,o,g){if(i==="submit"&&r&&r.stateNode===g){var w=Fm((g[nt]||null).action),N=o.submitter;N&&(i=(i=N[nt]||null)?Fm(i.formAction):N.getAttribute("formAction"),i!==null&&(w=i,N=null));var $=new xl("action","action",null,o,g);e.push({event:$,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(Un!==0){var X=N?qm(g,N):new FormData(g);Dh(r,{pending:!0,data:X,method:g.method,action:w},null,X)}}else typeof w=="function"&&($.preventDefault(),X=N?qm(g,N):new FormData(g),Dh(r,{pending:!0,data:X,method:g.method,action:w},w,X))},currentTarget:g}]})}}for(var dd=0;dd<Yu.length;dd++){var fd=Yu[dd],fw=fd.toLowerCase(),pw=fd[0].toUpperCase()+fd.slice(1);ji(fw,"on"+pw)}ji(Sv,"onAnimationEnd"),ji(wv,"onAnimationIteration"),ji(xv,"onAnimationStart"),ji("dblclick","onDoubleClick"),ji("focusin","onFocus"),ji("focusout","onBlur"),ji(MS,"onTransitionRun"),ji(DS,"onTransitionStart"),ji(jS,"onTransitionCancel"),ji(Cv,"onTransitionEnd"),Ii("onMouseEnter",["mouseout","mouseover"]),Ii("onMouseLeave",["mouseout","mouseover"]),Ii("onPointerEnter",["pointerout","pointerover"]),Ii("onPointerLeave",["pointerout","pointerover"]),rs("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),rs("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),rs("onBeforeInput",["compositionend","keypress","textInput","paste"]),rs("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),rs("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),rs("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var wo="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(wo));function Wm(e,i){i=(i&4)!==0;for(var r=0;r<e.length;r++){var o=e[r],g=o.event;o=o.listeners;e:{var w=void 0;if(i)for(var N=o.length-1;0<=N;N--){var $=o[N],X=$.instance,re=$.currentTarget;if($=$.listener,X!==w&&g.isPropagationStopped())break e;w=$,g.currentTarget=re;try{w(g)}catch(pe){kl(pe)}g.currentTarget=null,w=X}else for(N=0;N<o.length;N++){if($=o[N],X=$.instance,re=$.currentTarget,$=$.listener,X!==w&&g.isPropagationStopped())break e;w=$,g.currentTarget=re;try{w(g)}catch(pe){kl(pe)}g.currentTarget=null,w=X}}}}function ft(e,i){var r=i[bs];r===void 0&&(r=i[bs]=new Set);var o=e+"__bubble";r.has(o)||(Gm(i,e,2,!1),r.add(o))}function pd(e,i,r){var o=0;i&&(o|=4),Gm(r,e,o,i)}var dc="_reactListening"+Math.random().toString(36).slice(2);function vd(e){if(!e[dc]){e[dc]=!0,Cn.forEach(function(r){r!=="selectionchange"&&(vw.has(r)||pd(r,!1,e),pd(r,!0,e))});var i=e.nodeType===9?e:e.ownerDocument;i===null||i[dc]||(i[dc]=!0,pd("selectionchange",!1,i))}}function Gm(e,i,r,o){switch(S_(i)){case 2:var g=Fw;break;case 8:g=qw;break;default:g=Md}r=g.bind(null,i,r,e),g=void 0,!Ou||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(g=!0),o?g!==void 0?e.addEventListener(i,r,{capture:!0,passive:g}):e.addEventListener(i,r,!0):g!==void 0?e.addEventListener(i,r,{passive:g}):e.addEventListener(i,r,!1)}function gd(e,i,r,o,g){var w=o;if((i&1)===0&&(i&2)===0&&o!==null)e:for(;;){if(o===null)return;var N=o.tag;if(N===3||N===4){var $=o.stateNode.containerInfo;if($===g)break;if(N===4)for(N=o.return;N!==null;){var X=N.tag;if((X===3||X===4)&&N.stateNode.containerInfo===g)return;N=N.return}for(;$!==null;){if(N=Ct($),N===null)return;if(X=N.tag,X===5||X===6||X===26||X===27){o=w=N;continue e}$=$.parentNode}}o=o.return}Jp(function(){var re=w,pe=Nu(r),be=[];e:{var le=Ev.get(e);if(le!==void 0){var he=xl,Le=e;switch(e){case"keypress":if(Sl(r)===0)break e;case"keydown":case"keyup":he=lS;break;case"focusin":Le="focus",he=zu;break;case"focusout":Le="blur",he=zu;break;case"beforeblur":case"afterblur":he=zu;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":he=ev;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":he=Xb;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":he=hS;break;case Sv:case wv:case xv:he=Qb;break;case Cv:he=fS;break;case"scroll":case"scrollend":he=Yb;break;case"wheel":he=vS;break;case"copy":case"cut":case"paste":he=tS;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":he=sv;break;case"toggle":case"beforetoggle":he=mS}var qe=(i&4)!==0,Bt=!qe&&(e==="scroll"||e==="scrollend"),te=qe?le!==null?le+"Capture":null:le;qe=[];for(var ee=re,ne;ee!==null;){var me=ee;if(ne=me.stateNode,me=me.tag,me!==5&&me!==26&&me!==27||ne===null||te===null||(me=Fa(ee,te),me!=null&&qe.push(xo(ee,me,ne))),Bt)break;ee=ee.return}0<qe.length&&(le=new he(le,Le,null,r,pe),be.push({event:le,listeners:qe}))}}if((i&7)===0){e:{if(le=e==="mouseover"||e==="pointerover",he=e==="mouseout"||e==="pointerout",le&&r!==ju&&(Le=r.relatedTarget||r.fromElement)&&(Ct(Le)||Le[ct]))break e;if((he||le)&&(le=pe.window===pe?pe:(le=pe.ownerDocument)?le.defaultView||le.parentWindow:window,he?(Le=r.relatedTarget||r.toElement,he=re,Le=Le?Ct(Le):null,Le!==null&&(Bt=d(Le),qe=Le.tag,Le!==Bt||qe!==5&&qe!==27&&qe!==6)&&(Le=null)):(he=null,Le=re),he!==Le)){if(qe=ev,me="onMouseLeave",te="onMouseEnter",ee="mouse",(e==="pointerout"||e==="pointerover")&&(qe=sv,me="onPointerLeave",te="onPointerEnter",ee="pointer"),Bt=he==null?le:ns(he),ne=Le==null?le:ns(Le),le=new qe(me,ee+"leave",he,r,pe),le.target=Bt,le.relatedTarget=ne,me=null,Ct(pe)===re&&(qe=new qe(te,ee+"enter",Le,r,pe),qe.target=ne,qe.relatedTarget=Bt,me=qe),Bt=me,he&&Le)t:{for(qe=gw,te=he,ee=Le,ne=0,me=te;me;me=qe(me))ne++;me=0;for(var Ie=ee;Ie;Ie=qe(Ie))me++;for(;0<ne-me;)te=qe(te),ne--;for(;0<me-ne;)ee=qe(ee),me--;for(;ne--;){if(te===ee||ee!==null&&te===ee.alternate){qe=te;break t}te=qe(te),ee=qe(ee)}qe=null}else qe=null;he!==null&&Vm(be,le,he,qe,!1),Le!==null&&Bt!==null&&Vm(be,Bt,Le,qe,!0)}}e:{if(le=re?ns(re):window,he=le.nodeName&&le.nodeName.toLowerCase(),he==="select"||he==="input"&&le.type==="file")var St=uv;else if(lv(le))if(hv)St=TS;else{St=ES;var Be=CS}else he=le.nodeName,!he||he.toLowerCase()!=="input"||le.type!=="checkbox"&&le.type!=="radio"?re&&Ye(re.elementType)&&(St=uv):St=kS;if(St&&(St=St(e,re))){cv(be,St,r,pe);break e}Be&&Be(e,le,re),e==="focusout"&&re&&le.type==="number"&&re.memoizedProps.value!=null&&Ir(le,"number",le.value)}switch(Be=re?ns(re):window,e){case"focusin":(lv(Be)||Be.contentEditable==="true")&&(Ur=Be,Wu=re,Ja=null);break;case"focusout":Ja=Wu=Ur=null;break;case"mousedown":Gu=!0;break;case"contextmenu":case"mouseup":case"dragend":Gu=!1,yv(be,r,pe);break;case"selectionchange":if(RS)break;case"keydown":case"keyup":yv(be,r,pe)}var rt;if(Pu)e:{switch(e){case"compositionstart":var gt="onCompositionStart";break e;case"compositionend":gt="onCompositionEnd";break e;case"compositionupdate":gt="onCompositionUpdate";break e}gt=void 0}else Pr?av(e,r)&&(gt="onCompositionEnd"):e==="keydown"&&r.keyCode===229&&(gt="onCompositionStart");gt&&(iv&&r.locale!=="ko"&&(Pr||gt!=="onCompositionStart"?gt==="onCompositionEnd"&&Pr&&(rt=Zp()):(kn=pe,Bu="value"in kn?kn.value:kn.textContent,Pr=!0)),Be=fc(re,gt),0<Be.length&&(gt=new tv(gt,e,null,r,pe),be.push({event:gt,listeners:Be}),rt?gt.data=rt:(rt=ov(r),rt!==null&&(gt.data=rt)))),(rt=yS?bS(e,r):SS(e,r))&&(gt=fc(re,"onBeforeInput"),0<gt.length&&(Be=new tv("onBeforeInput","beforeinput",null,r,pe),be.push({event:Be,listeners:gt}),Be.data=rt)),dw(be,e,re,r,pe)}Wm(be,i)})}function xo(e,i,r){return{instance:e,listener:i,currentTarget:r}}function fc(e,i){for(var r=i+"Capture",o=[];e!==null;){var g=e,w=g.stateNode;if(g=g.tag,g!==5&&g!==26&&g!==27||w===null||(g=Fa(e,r),g!=null&&o.unshift(xo(e,g,w)),g=Fa(e,i),g!=null&&o.push(xo(e,g,w))),e.tag===3)return o;e=e.return}return[]}function gw(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Vm(e,i,r,o,g){for(var w=i._reactName,N=[];r!==null&&r!==o;){var $=r,X=$.alternate,re=$.stateNode;if($=$.tag,X!==null&&X===o)break;$!==5&&$!==26&&$!==27||re===null||(X=re,g?(re=Fa(r,w),re!=null&&N.unshift(xo(r,re,X))):g||(re=Fa(r,w),re!=null&&N.push(xo(r,re,X)))),r=r.return}N.length!==0&&e.push({event:i,listeners:N})}var mw=/\r\n?/g,_w=/\u0000|\uFFFD/g;function Ym(e){return(typeof e=="string"?e:""+e).replace(mw,`
49
- `).replace(_w,"")}function Km(e,i){return i=Ym(i),Ym(e)===i}function Ot(e,i,r,o,g,w){switch(r){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,r,o);break;case"style":Re(e,o,w);break;case"data":if(i!=="object"){ir(e,"data",o);break}case"src":case"href":if(o===""&&(i!=="a"||r!=="href")){e.removeAttribute(r);break}if(o==null||typeof o=="function"||typeof o=="symbol"||typeof o=="boolean"){e.removeAttribute(r);break}o=ss(""+o),e.setAttribute(r,o);break;case"action":case"formAction":if(typeof o=="function"){e.setAttribute(r,"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"&&(r==="formAction"?(i!=="input"&&Ot(e,i,"name",g.name,g,null),Ot(e,i,"formEncType",g.formEncType,g,null),Ot(e,i,"formMethod",g.formMethod,g,null),Ot(e,i,"formTarget",g.formTarget,g,null)):(Ot(e,i,"encType",g.encType,g,null),Ot(e,i,"method",g.method,g,null),Ot(e,i,"target",g.target,g,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){e.removeAttribute(r);break}o=ss(""+o),e.setAttribute(r,o);break;case"onClick":o!=null&&(e.onclick=_i);break;case"onScroll":o!=null&&ft("scroll",e);break;case"onScrollEnd":o!=null&&ft("scrollend",e);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(a(61));if(r=o.__html,r!=null){if(g.children!=null)throw Error(a(60));e.innerHTML=r}}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}r=ss(""+o),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",r);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(r,""+o):e.removeAttribute(r);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(r,""):e.removeAttribute(r);break;case"capture":case"download":o===!0?e.setAttribute(r,""):o!==!1&&o!=null&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(r,o):e.removeAttribute(r);break;case"cols":case"rows":case"size":case"span":o!=null&&typeof o!="function"&&typeof o!="symbol"&&!isNaN(o)&&1<=o?e.setAttribute(r,o):e.removeAttribute(r);break;case"rowSpan":case"start":o==null||typeof o=="function"||typeof o=="symbol"||isNaN(o)?e.removeAttribute(r):e.setAttribute(r,o);break;case"popover":ft("beforetoggle",e),ft("toggle",e),sr(e,"popover",o);break;case"xlinkActuate":mi(e,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":mi(e,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":mi(e,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":mi(e,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":mi(e,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":mi(e,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":mi(e,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":mi(e,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":mi(e,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":sr(e,"is",o);break;case"innerText":case"textContent":break;default:(!(2<r.length)||r[0]!=="o"&&r[0]!=="O"||r[1]!=="n"&&r[1]!=="N")&&(r=Pt.get(r)||r,sr(e,r,o))}}function md(e,i,r,o,g,w){switch(r){case"style":Re(e,o,w);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(a(61));if(r=o.__html,r!=null){if(g.children!=null)throw Error(a(60));e.innerHTML=r}}break;case"children":typeof o=="string"?Ki(e,o):(typeof o=="number"||typeof o=="bigint")&&Ki(e,""+o);break;case"onScroll":o!=null&&ft("scroll",e);break;case"onScrollEnd":o!=null&&ft("scrollend",e);break;case"onClick":o!=null&&(e.onclick=_i);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Vi.hasOwnProperty(r))e:{if(r[0]==="o"&&r[1]==="n"&&(g=r.endsWith("Capture"),i=r.slice(2,g?r.length-7:void 0),w=e[nt]||null,w=w!=null?w[r]:null,typeof w=="function"&&e.removeEventListener(i,w,g),typeof o=="function")){typeof w!="function"&&w!==null&&(r in e?e[r]=null:e.hasAttribute(r)&&e.removeAttribute(r)),e.addEventListener(i,o,g);break e}r in e?e[r]=o:o===!0?e.setAttribute(r,""):sr(e,r,o)}}}function Ds(e,i,r){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ft("error",e),ft("load",e);var o=!1,g=!1,w;for(w in r)if(r.hasOwnProperty(w)){var N=r[w];if(N!=null)switch(w){case"src":o=!0;break;case"srcSet":g=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:Ot(e,i,w,N,r,null)}}g&&Ot(e,i,"srcSet",r.srcSet,r,null),o&&Ot(e,i,"src",r.src,r,null);return;case"input":ft("invalid",e);var $=w=N=g=null,X=null,re=null;for(o in r)if(r.hasOwnProperty(o)){var pe=r[o];if(pe!=null)switch(o){case"name":g=pe;break;case"type":N=pe;break;case"checked":X=pe;break;case"defaultChecked":re=pe;break;case"value":w=pe;break;case"defaultValue":$=pe;break;case"children":case"dangerouslySetInnerHTML":if(pe!=null)throw Error(a(137,i));break;default:Ot(e,i,o,pe,r,null)}}$a(e,w,$,X,re,N,g,!1);return;case"select":ft("invalid",e),o=N=w=null;for(g in r)if(r.hasOwnProperty(g)&&($=r[g],$!=null))switch(g){case"value":w=$;break;case"defaultValue":N=$;break;case"multiple":o=$;default:Ot(e,i,g,$,r,null)}i=w,r=N,e.multiple=!!o,i!=null?Yi(e,!!o,i,!1):r!=null&&Yi(e,!!o,r,!0);return;case"textarea":ft("invalid",e),w=g=o=null;for(N in r)if(r.hasOwnProperty(N)&&($=r[N],$!=null))switch(N){case"value":o=$;break;case"defaultValue":g=$;break;case"children":w=$;break;case"dangerouslySetInnerHTML":if($!=null)throw Error(a(91));break;default:Ot(e,i,N,$,r,null)}Ua(e,o,g,w);return;case"option":for(X in r)if(r.hasOwnProperty(X)&&(o=r[X],o!=null))switch(X){case"selected":e.selected=o&&typeof o!="function"&&typeof o!="symbol";break;default:Ot(e,i,X,o,r,null)}return;case"dialog":ft("beforetoggle",e),ft("toggle",e),ft("cancel",e),ft("close",e);break;case"iframe":case"object":ft("load",e);break;case"video":case"audio":for(o=0;o<wo.length;o++)ft(wo[o],e);break;case"image":ft("error",e),ft("load",e);break;case"details":ft("toggle",e);break;case"embed":case"source":case"link":ft("error",e),ft("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 r)if(r.hasOwnProperty(re)&&(o=r[re],o!=null))switch(re){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:Ot(e,i,re,o,r,null)}return;default:if(Ye(i)){for(pe in r)r.hasOwnProperty(pe)&&(o=r[pe],o!==void 0&&md(e,i,pe,o,r,void 0));return}}for($ in r)r.hasOwnProperty($)&&(o=r[$],o!=null&&Ot(e,i,$,o,r,null))}function yw(e,i,r,o){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var g=null,w=null,N=null,$=null,X=null,re=null,pe=null;for(he in r){var be=r[he];if(r.hasOwnProperty(he)&&be!=null)switch(he){case"checked":break;case"value":break;case"defaultValue":X=be;default:o.hasOwnProperty(he)||Ot(e,i,he,null,o,be)}}for(var le in o){var he=o[le];if(be=r[le],o.hasOwnProperty(le)&&(he!=null||be!=null))switch(le){case"type":w=he;break;case"name":g=he;break;case"checked":re=he;break;case"defaultChecked":pe=he;break;case"value":N=he;break;case"defaultValue":$=he;break;case"children":case"dangerouslySetInnerHTML":if(he!=null)throw Error(a(137,i));break;default:he!==be&&Ot(e,i,le,he,o,be)}}Hr(e,N,$,X,re,pe,w,g);return;case"select":he=N=$=le=null;for(w in r)if(X=r[w],r.hasOwnProperty(w)&&X!=null)switch(w){case"value":break;case"multiple":he=X;default:o.hasOwnProperty(w)||Ot(e,i,w,null,o,X)}for(g in o)if(w=o[g],X=r[g],o.hasOwnProperty(g)&&(w!=null||X!=null))switch(g){case"value":le=w;break;case"defaultValue":$=w;break;case"multiple":N=w;default:w!==X&&Ot(e,i,g,w,o,X)}i=$,r=N,o=he,le!=null?Yi(e,!!r,le,!1):!!o!=!!r&&(i!=null?Yi(e,!!r,i,!0):Yi(e,!!r,r?[]:"",!1));return;case"textarea":he=le=null;for($ in r)if(g=r[$],r.hasOwnProperty($)&&g!=null&&!o.hasOwnProperty($))switch($){case"value":break;case"children":break;default:Ot(e,i,$,null,o,g)}for(N in o)if(g=o[N],w=r[N],o.hasOwnProperty(N)&&(g!=null||w!=null))switch(N){case"value":le=g;break;case"defaultValue":he=g;break;case"children":break;case"dangerouslySetInnerHTML":if(g!=null)throw Error(a(91));break;default:g!==w&&Ot(e,i,N,g,o,w)}Pa(e,le,he);return;case"option":for(var Le in r)if(le=r[Le],r.hasOwnProperty(Le)&&le!=null&&!o.hasOwnProperty(Le))switch(Le){case"selected":e.selected=!1;break;default:Ot(e,i,Le,null,o,le)}for(X in o)if(le=o[X],he=r[X],o.hasOwnProperty(X)&&le!==he&&(le!=null||he!=null))switch(X){case"selected":e.selected=le&&typeof le!="function"&&typeof le!="symbol";break;default:Ot(e,i,X,le,o,he)}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 r)le=r[qe],r.hasOwnProperty(qe)&&le!=null&&!o.hasOwnProperty(qe)&&Ot(e,i,qe,null,o,le);for(re in o)if(le=o[re],he=r[re],o.hasOwnProperty(re)&&le!==he&&(le!=null||he!=null))switch(re){case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(a(137,i));break;default:Ot(e,i,re,le,o,he)}return;default:if(Ye(i)){for(var Bt in r)le=r[Bt],r.hasOwnProperty(Bt)&&le!==void 0&&!o.hasOwnProperty(Bt)&&md(e,i,Bt,void 0,o,le);for(pe in o)le=o[pe],he=r[pe],!o.hasOwnProperty(pe)||le===he||le===void 0&&he===void 0||md(e,i,pe,le,o,he);return}}for(var te in r)le=r[te],r.hasOwnProperty(te)&&le!=null&&!o.hasOwnProperty(te)&&Ot(e,i,te,null,o,le);for(be in o)le=o[be],he=r[be],!o.hasOwnProperty(be)||le===he||le==null&&he==null||Ot(e,i,be,le,o,he)}function Xm(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function bw(){if(typeof performance.getEntriesByType=="function"){for(var e=0,i=0,r=performance.getEntriesByType("resource"),o=0;o<r.length;o++){var g=r[o],w=g.transferSize,N=g.initiatorType,$=g.duration;if(w&&$&&Xm(N)){for(N=0,$=g.responseEnd,o+=1;o<r.length;o++){var X=r[o],re=X.startTime;if(re>$)break;var pe=X.transferSize,be=X.initiatorType;pe&&Xm(be)&&(X=X.responseEnd,N+=pe*(X<$?1:($-re)/(X-re)))}if(--o,i+=8*(w+N)/(g.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 _d=null,yd=null;function pc(e){return e.nodeType===9?e:e.ownerDocument}function Jm(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 Zm(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 bd(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 Sd=null;function Sw(){var e=window.event;return e&&e.type==="popstate"?e===Sd?!1:(Sd=e,!0):(Sd=null,!1)}var Qm=typeof setTimeout=="function"?setTimeout:void 0,ww=typeof clearTimeout=="function"?clearTimeout:void 0,e_=typeof Promise=="function"?Promise:void 0,xw=typeof queueMicrotask=="function"?queueMicrotask:typeof e_<"u"?function(e){return e_.resolve(null).then(e).catch(Cw)}:Qm;function Cw(e){setTimeout(function(){throw e})}function Fn(e){return e==="head"}function t_(e,i){var r=i,o=0;do{var g=r.nextSibling;if(e.removeChild(r),g&&g.nodeType===8)if(r=g.data,r==="/$"||r==="/&"){if(o===0){e.removeChild(g),va(i);return}o--}else if(r==="$"||r==="$?"||r==="$~"||r==="$!"||r==="&")o++;else if(r==="html")Co(e.ownerDocument.documentElement);else if(r==="head"){r=e.ownerDocument.head,Co(r);for(var w=r.firstChild;w;){var N=w.nextSibling,$=w.nodeName;w[De]||$==="SCRIPT"||$==="STYLE"||$==="LINK"&&w.rel.toLowerCase()==="stylesheet"||r.removeChild(w),w=N}}else r==="body"&&Co(e.ownerDocument.body);r=g}while(r);va(i)}function s_(e,i){var r=e;e=0;do{var o=r.nextSibling;if(r.nodeType===1?i?(r._stashedDisplay=r.style.display,r.style.display="none"):(r.style.display=r._stashedDisplay||"",r.getAttribute("style")===""&&r.removeAttribute("style")):r.nodeType===3&&(i?(r._stashedText=r.nodeValue,r.nodeValue=""):r.nodeValue=r._stashedText||""),o&&o.nodeType===8)if(r=o.data,r==="/$"){if(e===0)break;e--}else r!=="$"&&r!=="$?"&&r!=="$~"&&r!=="$!"||e++;r=o}while(r)}function wd(e){var i=e.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var r=i;switch(i=i.nextSibling,r.nodeName){case"HTML":case"HEAD":case"BODY":wd(r),Oe(r);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(r.rel.toLowerCase()==="stylesheet")continue}e.removeChild(r)}}function Ew(e,i,r,o){for(;e.nodeType===1;){var g=r;if(e.nodeName.toLowerCase()!==i.toLowerCase()){if(!o&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(o){if(!e[De])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!==g.rel||e.getAttribute("href")!==(g.href==null||g.href===""?null:g.href)||e.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin)||e.getAttribute("title")!==(g.title==null?null:g.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(w=e.getAttribute("src"),(w!==(g.src==null?null:g.src)||e.getAttribute("type")!==(g.type==null?null:g.type)||e.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin))&&w&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(i==="input"&&e.type==="hidden"){var w=g.name==null?null:""+g.name;if(g.type==="hidden"&&e.getAttribute("name")===w)return e}else return e;if(e=Ei(e.nextSibling),e===null)break}return null}function kw(e,i,r){if(i==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!r||(e=Ei(e.nextSibling),e===null))return null;return e}function i_(e,i){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!i||(e=Ei(e.nextSibling),e===null))return null;return e}function xd(e){return e.data==="$?"||e.data==="$~"}function Cd(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Tw(e,i){var r=e.ownerDocument;if(e.data==="$~")e._reactRetry=i;else if(e.data!=="$?"||r.readyState!=="loading")i();else{var o=function(){i(),r.removeEventListener("DOMContentLoaded",o)};r.addEventListener("DOMContentLoaded",o),e._reactRetry=o}}function Ei(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 Ed=null;function n_(e){e=e.nextSibling;for(var i=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"||r==="/&"){if(i===0)return Ei(e.nextSibling);i--}else r!=="$"&&r!=="$!"&&r!=="$?"&&r!=="$~"&&r!=="&"||i++}e=e.nextSibling}return null}function r_(e){e=e.previousSibling;for(var i=0;e;){if(e.nodeType===8){var r=e.data;if(r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"){if(i===0)return e;i--}else r!=="/$"&&r!=="/&"||i++}e=e.previousSibling}return null}function a_(e,i,r){switch(i=pc(r),e){case"html":if(e=i.documentElement,!e)throw Error(a(452));return e;case"head":if(e=i.head,!e)throw Error(a(453));return e;case"body":if(e=i.body,!e)throw Error(a(454));return e;default:throw Error(a(451))}}function Co(e){for(var i=e.attributes;i.length;)e.removeAttributeNode(i[0]);Oe(e)}var ki=new Map,o_=new Set;function vc(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var dn=G.d;G.d={f:Aw,r:Rw,D:Mw,C:Dw,L:jw,m:Nw,X:Ow,S:Lw,M:Bw};function Aw(){var e=dn.f(),i=ac();return e||i}function Rw(e){var i=ze(e);i!==null&&i.tag===5&&i.type==="form"?Cg(i):dn.r(e)}var da=typeof document>"u"?null:document;function l_(e,i,r){var o=da;if(o&&typeof i=="string"&&i){var g=Ps(i);g='link[rel="'+e+'"][href="'+g+'"]',typeof r=="string"&&(g+='[crossorigin="'+r+'"]'),o_.has(g)||(o_.add(g),e={rel:e,crossOrigin:r,href:i},o.querySelector(g)===null&&(i=o.createElement("link"),Ds(i,"link",e),Rt(i),o.head.appendChild(i)))}}function Mw(e){dn.D(e),l_("dns-prefetch",e,null)}function Dw(e,i){dn.C(e,i),l_("preconnect",e,i)}function jw(e,i,r){dn.L(e,i,r);var o=da;if(o&&e&&i){var g='link[rel="preload"][as="'+Ps(i)+'"]';i==="image"&&r&&r.imageSrcSet?(g+='[imagesrcset="'+Ps(r.imageSrcSet)+'"]',typeof r.imageSizes=="string"&&(g+='[imagesizes="'+Ps(r.imageSizes)+'"]')):g+='[href="'+Ps(e)+'"]';var w=g;switch(i){case"style":w=fa(e);break;case"script":w=pa(e)}ki.has(w)||(e=f({rel:"preload",href:i==="image"&&r&&r.imageSrcSet?void 0:e,as:i},r),ki.set(w,e),o.querySelector(g)!==null||i==="style"&&o.querySelector(Eo(w))||i==="script"&&o.querySelector(ko(w))||(i=o.createElement("link"),Ds(i,"link",e),Rt(i),o.head.appendChild(i)))}}function Nw(e,i){dn.m(e,i);var r=da;if(r&&e){var o=i&&typeof i.as=="string"?i.as:"script",g='link[rel="modulepreload"][as="'+Ps(o)+'"][href="'+Ps(e)+'"]',w=g;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":w=pa(e)}if(!ki.has(w)&&(e=f({rel:"modulepreload",href:e},i),ki.set(w,e),r.querySelector(g)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(r.querySelector(ko(w)))return}o=r.createElement("link"),Ds(o,"link",e),Rt(o),r.head.appendChild(o)}}}function Lw(e,i,r){dn.S(e,i,r);var o=da;if(o&&e){var g=ks(o).hoistableStyles,w=fa(e);i=i||"default";var N=g.get(w);if(!N){var $={loading:0,preload:null};if(N=o.querySelector(Eo(w)))$.loading=5;else{e=f({rel:"stylesheet",href:e,"data-precedence":i},r),(r=ki.get(w))&&kd(e,r);var X=N=o.createElement("link");Rt(X),Ds(X,"link",e),X._p=new Promise(function(re,pe){X.onload=re,X.onerror=pe}),X.addEventListener("load",function(){$.loading|=1}),X.addEventListener("error",function(){$.loading|=2}),$.loading|=4,gc(N,i,o)}N={type:"stylesheet",instance:N,count:1,state:$},g.set(w,N)}}}function Ow(e,i){dn.X(e,i);var r=da;if(r&&e){var o=ks(r).hoistableScripts,g=pa(e),w=o.get(g);w||(w=r.querySelector(ko(g)),w||(e=f({src:e,async:!0},i),(i=ki.get(g))&&Td(e,i),w=r.createElement("script"),Rt(w),Ds(w,"link",e),r.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},o.set(g,w))}}function Bw(e,i){dn.M(e,i);var r=da;if(r&&e){var o=ks(r).hoistableScripts,g=pa(e),w=o.get(g);w||(w=r.querySelector(ko(g)),w||(e=f({src:e,async:!0,type:"module"},i),(i=ki.get(g))&&Td(e,i),w=r.createElement("script"),Rt(w),Ds(w,"link",e),r.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},o.set(g,w))}}function c_(e,i,r,o){var g=(g=fe.current)?vc(g):null;if(!g)throw Error(a(446));switch(e){case"meta":case"title":return null;case"style":return typeof r.precedence=="string"&&typeof r.href=="string"?(i=fa(r.href),r=ks(g).hoistableStyles,o=r.get(i),o||(o={type:"style",instance:null,count:0,state:null},r.set(i,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(r.rel==="stylesheet"&&typeof r.href=="string"&&typeof r.precedence=="string"){e=fa(r.href);var w=ks(g).hoistableStyles,N=w.get(e);if(N||(g=g.ownerDocument||g,N={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},w.set(e,N),(w=g.querySelector(Eo(e)))&&!w._p&&(N.instance=w,N.state.loading=5),ki.has(e)||(r={rel:"preload",as:"style",href:r.href,crossOrigin:r.crossOrigin,integrity:r.integrity,media:r.media,hrefLang:r.hrefLang,referrerPolicy:r.referrerPolicy},ki.set(e,r),w||Hw(g,e,r,N.state))),i&&o===null)throw Error(a(528,""));return N}if(i&&o!==null)throw Error(a(529,""));return null;case"script":return i=r.async,r=r.src,typeof r=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=pa(r),r=ks(g).hoistableScripts,o=r.get(i),o||(o={type:"script",instance:null,count:0,state:null},r.set(i,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,e))}}function fa(e){return'href="'+Ps(e)+'"'}function Eo(e){return'link[rel="stylesheet"]['+e+"]"}function u_(e){return f({},e,{"data-precedence":e.precedence,precedence:null})}function Hw(e,i,r,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}),Ds(i,"link",r),Rt(i),e.head.appendChild(i))}function pa(e){return'[src="'+Ps(e)+'"]'}function ko(e){return"script[async]"+e}function h_(e,i,r){if(i.count++,i.instance===null)switch(i.type){case"style":var o=e.querySelector('style[data-href~="'+Ps(r.href)+'"]');if(o)return i.instance=o,Rt(o),o;var g=f({},r,{"data-href":r.href,"data-precedence":r.precedence,href:null,precedence:null});return o=(e.ownerDocument||e).createElement("style"),Rt(o),Ds(o,"style",g),gc(o,r.precedence,e),i.instance=o;case"stylesheet":g=fa(r.href);var w=e.querySelector(Eo(g));if(w)return i.state.loading|=4,i.instance=w,Rt(w),w;o=u_(r),(g=ki.get(g))&&kd(o,g),w=(e.ownerDocument||e).createElement("link"),Rt(w);var N=w;return N._p=new Promise(function($,X){N.onload=$,N.onerror=X}),Ds(w,"link",o),i.state.loading|=4,gc(w,r.precedence,e),i.instance=w;case"script":return w=pa(r.src),(g=e.querySelector(ko(w)))?(i.instance=g,Rt(g),g):(o=r,(g=ki.get(w))&&(o=f({},r),Td(o,g)),e=e.ownerDocument||e,g=e.createElement("script"),Rt(g),Ds(g,"link",o),e.head.appendChild(g),i.instance=g);case"void":return null;default:throw Error(a(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(o=i.instance,i.state.loading|=4,gc(o,r.precedence,e));return i.instance}function gc(e,i,r){for(var o=r.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),g=o.length?o[o.length-1]:null,w=g,N=0;N<o.length;N++){var $=o[N];if($.dataset.precedence===i)w=$;else if(w!==g)break}w?w.parentNode.insertBefore(e,w.nextSibling):(i=r.nodeType===9?r.head:r,i.insertBefore(e,i.firstChild))}function kd(e,i){e.crossOrigin==null&&(e.crossOrigin=i.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=i.referrerPolicy),e.title==null&&(e.title=i.title)}function Td(e,i){e.crossOrigin==null&&(e.crossOrigin=i.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=i.referrerPolicy),e.integrity==null&&(e.integrity=i.integrity)}var mc=null;function d_(e,i,r){if(mc===null){var o=new Map,g=mc=new Map;g.set(r,o)}else g=mc,o=g.get(r),o||(o=new Map,g.set(r,o));if(o.has(e))return o;for(o.set(e,null),r=r.getElementsByTagName(e),g=0;g<r.length;g++){var w=r[g];if(!(w[De]||w[Je]||e==="link"&&w.getAttribute("rel")==="stylesheet")&&w.namespaceURI!=="http://www.w3.org/2000/svg"){var N=w.getAttribute(i)||"";N=e+N;var $=o.get(N);$?$.push(w):o.set(N,[w])}}return o}function f_(e,i,r){e=e.ownerDocument||e,e.head.insertBefore(r,i==="title"?e.querySelector("head > title"):null)}function Iw(e,i,r){if(r===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 p_(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function zw(e,i,r,o){if(r.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(r.state.loading&4)===0){if(r.instance===null){var g=fa(o.href),w=i.querySelector(Eo(g));if(w){i=w._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(e.count++,e=_c.bind(e),i.then(e,e)),r.state.loading|=4,r.instance=w,Rt(w);return}w=i.ownerDocument||i,o=u_(o),(g=ki.get(g))&&kd(o,g),w=w.createElement("link"),Rt(w);var N=w;N._p=new Promise(function($,X){N.onload=$,N.onerror=X}),Ds(w,"link",o),r.instance=w}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(r,i),(i=r.state.preload)&&(r.state.loading&3)===0&&(e.count++,r=_c.bind(e),i.addEventListener("load",r),i.addEventListener("error",r))}}var Ad=0;function $w(e,i){return e.stylesheets&&e.count===0&&bc(e,e.stylesheets),0<e.count||0<e.imgCount?function(r){var o=setTimeout(function(){if(e.stylesheets&&bc(e,e.stylesheets),e.unsuspend){var w=e.unsuspend;e.unsuspend=null,w()}},6e4+i);0<e.imgBytes&&Ad===0&&(Ad=62500*bw());var g=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&bc(e,e.stylesheets),e.unsuspend)){var w=e.unsuspend;e.unsuspend=null,w()}},(e.imgBytes>Ad?50:800)+i);return e.unsuspend=r,function(){e.unsuspend=null,clearTimeout(o),clearTimeout(g)}}:null}function _c(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)bc(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var yc=null;function bc(e,i){e.stylesheets=null,e.unsuspend!==null&&(e.count++,yc=new Map,i.forEach(Pw,e),yc=null,_c.call(e))}function Pw(e,i){if(!(i.state.loading&4)){var r=yc.get(e);if(r)var o=r.get(null);else{r=new Map,yc.set(e,r);for(var g=e.querySelectorAll("link[data-precedence],style[data-precedence]"),w=0;w<g.length;w++){var N=g[w];(N.nodeName==="LINK"||N.getAttribute("media")!=="not all")&&(r.set(N.dataset.precedence,N),o=N)}o&&r.set(null,o)}g=i.instance,N=g.getAttribute("data-precedence"),w=r.get(N)||o,w===o&&r.set(null,g),r.set(N,g),this.count++,o=_c.bind(this),g.addEventListener("load",o),g.addEventListener("error",o),w?w.parentNode.insertBefore(g,w.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(g,e.firstChild)),i.state.loading|=4}}var To={$$typeof:_,Provider:null,Consumer:null,_currentValue:J,_currentValue2:J,_threadCount:0};function Uw(e,i,r,o,g,w,N,$,X){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=g,this.onCaughtError=w,this.onRecoverableError=N,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=X,this.incompleteTransitions=new Map}function v_(e,i,r,o,g,w,N,$,X,re,pe,be){return e=new Uw(e,i,r,N,X,re,pe,be,$),i=1,w===!0&&(i|=24),w=ni(3,null,null,i),e.current=w,w.stateNode=e,i=oh(),i.refCount++,e.pooledCache=i,i.refCount++,w.memoizedState={element:o,isDehydrated:r,cache:i},hh(w),e}function g_(e){return e?(e=Wr,e):Wr}function m_(e,i,r,o,g,w){g=g_(g),o.context===null?o.context=g:o.pendingContext=g,o=jn(i),o.payload={element:r},w=w===void 0?null:w,w!==null&&(o.callback=w),r=Nn(e,o,i),r!==null&&(Qs(r,e,i),no(r,e,i))}function __(e,i){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<i?r:i}}function Rd(e,i){__(e,i),(e=e.alternate)&&__(e,i)}function y_(e){if(e.tag===13||e.tag===31){var i=lr(e,67108864);i!==null&&Qs(i,e,67108864),Rd(e,67108864)}}function b_(e){if(e.tag===13||e.tag===31){var i=ci();i=Se(i);var r=lr(e,i);r!==null&&Qs(r,e,i),Rd(e,i)}}var Sc=!0;function Fw(e,i,r,o){var g=F.T;F.T=null;var w=G.p;try{G.p=2,Md(e,i,r,o)}finally{G.p=w,F.T=g}}function qw(e,i,r,o){var g=F.T;F.T=null;var w=G.p;try{G.p=8,Md(e,i,r,o)}finally{G.p=w,F.T=g}}function Md(e,i,r,o){if(Sc){var g=Dd(o);if(g===null)gd(e,i,o,wc,r),w_(e,o);else if(Gw(g,e,i,r,o))o.stopPropagation();else if(w_(e,o),i&4&&-1<Ww.indexOf(e)){for(;g!==null;){var w=ze(g);if(w!==null)switch(w.tag){case 3:if(w=w.stateNode,w.current.memoizedState.isDehydrated){var N=Ce(w.pendingLanes);if(N!==0){var $=w;for($.pendingLanes|=2,$.entangledLanes|=2;N;){var X=1<<31-bt(N);$.entanglements[1]|=X,N&=~X}Ui(w),(Et&6)===0&&(nc=ot()+500,So(0))}}break;case 31:case 13:$=lr(w,2),$!==null&&Qs($,w,2),ac(),Rd(w,2)}if(w=Dd(o),w===null&&gd(e,i,o,wc,r),w===g)break;g=w}g!==null&&o.stopPropagation()}else gd(e,i,o,null,r)}}function Dd(e){return e=Nu(e),jd(e)}var wc=null;function jd(e){if(wc=null,e=Ct(e),e!==null){var i=d(e);if(i===null)e=null;else{var r=i.tag;if(r===13){if(e=p(i),e!==null)return e;e=null}else if(r===31){if(e=c(i),e!==null)return e;e=null}else if(r===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;e=null}else i!==e&&(e=null)}}return wc=e,null}function S_(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(kt()){case Tt:return 2;case Os:return 8;case Pe:case ds:return 32;case Wt:return 268435456;default:return 32}default:return 32}}var Nd=!1,qn=null,Wn=null,Gn=null,Ao=new Map,Ro=new Map,Vn=[],Ww="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 w_(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":Ao.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ro.delete(i.pointerId)}}function Mo(e,i,r,o,g,w){return e===null||e.nativeEvent!==w?(e={blockedOn:i,domEventName:r,eventSystemFlags:o,nativeEvent:w,targetContainers:[g]},i!==null&&(i=ze(i),i!==null&&y_(i)),e):(e.eventSystemFlags|=o,i=e.targetContainers,g!==null&&i.indexOf(g)===-1&&i.push(g),e)}function Gw(e,i,r,o,g){switch(i){case"focusin":return qn=Mo(qn,e,i,r,o,g),!0;case"dragenter":return Wn=Mo(Wn,e,i,r,o,g),!0;case"mouseover":return Gn=Mo(Gn,e,i,r,o,g),!0;case"pointerover":var w=g.pointerId;return Ao.set(w,Mo(Ao.get(w)||null,e,i,r,o,g)),!0;case"gotpointercapture":return w=g.pointerId,Ro.set(w,Mo(Ro.get(w)||null,e,i,r,o,g)),!0}return!1}function x_(e){var i=Ct(e.target);if(i!==null){var r=d(i);if(r!==null){if(i=r.tag,i===13){if(i=p(r),i!==null){e.blockedOn=i,Xe(e.priority,function(){b_(r)});return}}else if(i===31){if(i=c(r),i!==null){e.blockedOn=i,Xe(e.priority,function(){b_(r)});return}}else if(i===3&&r.stateNode.current.memoizedState.isDehydrated){e.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}e.blockedOn=null}function xc(e){if(e.blockedOn!==null)return!1;for(var i=e.targetContainers;0<i.length;){var r=Dd(e.nativeEvent);if(r===null){r=e.nativeEvent;var o=new r.constructor(r.type,r);ju=o,r.target.dispatchEvent(o),ju=null}else return i=ze(r),i!==null&&y_(i),e.blockedOn=r,!1;i.shift()}return!0}function C_(e,i,r){xc(e)&&r.delete(i)}function Vw(){Nd=!1,qn!==null&&xc(qn)&&(qn=null),Wn!==null&&xc(Wn)&&(Wn=null),Gn!==null&&xc(Gn)&&(Gn=null),Ao.forEach(C_),Ro.forEach(C_)}function Cc(e,i){e.blockedOn===i&&(e.blockedOn=null,Nd||(Nd=!0,s.unstable_scheduleCallback(s.unstable_NormalPriority,Vw)))}var Ec=null;function E_(e){Ec!==e&&(Ec=e,s.unstable_scheduleCallback(s.unstable_NormalPriority,function(){Ec===e&&(Ec=null);for(var i=0;i<e.length;i+=3){var r=e[i],o=e[i+1],g=e[i+2];if(typeof o!="function"){if(jd(o||r)===null)continue;break}var w=ze(r);w!==null&&(e.splice(i,3),i-=3,Dh(w,{pending:!0,data:g,method:r.method,action:o},o,g))}}))}function va(e){function i(X){return Cc(X,e)}qn!==null&&Cc(qn,e),Wn!==null&&Cc(Wn,e),Gn!==null&&Cc(Gn,e),Ao.forEach(i),Ro.forEach(i);for(var r=0;r<Vn.length;r++){var o=Vn[r];o.blockedOn===e&&(o.blockedOn=null)}for(;0<Vn.length&&(r=Vn[0],r.blockedOn===null);)x_(r),r.blockedOn===null&&Vn.shift();if(r=(e.ownerDocument||e).$$reactFormReplay,r!=null)for(o=0;o<r.length;o+=3){var g=r[o],w=r[o+1],N=g[nt]||null;if(typeof w=="function")N||E_(r);else if(N){var $=null;if(w&&w.hasAttribute("formAction")){if(g=w,N=w[nt]||null)$=N.formAction;else if(jd(g)!==null)continue}else $=N.action;typeof $=="function"?r[o+1]=$:(r.splice(o,3),o-=3),E_(r)}}}function k_(){function e(w){w.canIntercept&&w.info==="react-transition"&&w.intercept({handler:function(){return new Promise(function(N){return g=N})},focusReset:"manual",scroll:"manual"})}function i(){g!==null&&(g(),g=null),o||setTimeout(r,20)}function r(){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,g=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(r,100),function(){o=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),g!==null&&(g(),g=null)}}}function Ld(e){this._internalRoot=e}kc.prototype.render=Ld.prototype.render=function(e){var i=this._internalRoot;if(i===null)throw Error(a(409));var r=i.current,o=ci();m_(r,o,e,i,null,null)},kc.prototype.unmount=Ld.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var i=e.containerInfo;m_(e.current,2,null,e,null,null),ac(),i[ct]=null}};function kc(e){this._internalRoot=e}kc.prototype.unstable_scheduleHydration=function(e){if(e){var i=yt();e={blockedOn:null,target:e,priority:i};for(var r=0;r<Vn.length&&i!==0&&i<Vn[r].priority;r++);Vn.splice(r,0,e),r===0&&x_(e)}};var T_=t.version;if(T_!=="19.2.7")throw Error(a(527,T_,"19.2.7"));G.findDOMNode=function(e){var i=e._reactInternals;if(i===void 0)throw typeof e.render=="function"?Error(a(188)):(e=Object.keys(e).join(","),Error(a(268,e)));return e=v(i),e=e!==null?S(e):null,e=e===null?null:e.stateNode,e};var Yw={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:F,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Tc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Tc.isDisabled&&Tc.supportsFiber)try{ys=Tc.inject(Yw),is=Tc}catch{}}return jo.createRoot=function(e,i){if(!l(e))throw Error(a(299));var r=!1,o="",g=Lg,w=Og,N=Bg;return i!=null&&(i.unstable_strictMode===!0&&(r=!0),i.identifierPrefix!==void 0&&(o=i.identifierPrefix),i.onUncaughtError!==void 0&&(g=i.onUncaughtError),i.onCaughtError!==void 0&&(w=i.onCaughtError),i.onRecoverableError!==void 0&&(N=i.onRecoverableError)),i=v_(e,1,!1,null,null,r,o,null,g,w,N,k_),e[ct]=i.current,vd(e),new Ld(i)},jo.hydrateRoot=function(e,i,r){if(!l(e))throw Error(a(299));var o=!1,g="",w=Lg,N=Og,$=Bg,X=null;return r!=null&&(r.unstable_strictMode===!0&&(o=!0),r.identifierPrefix!==void 0&&(g=r.identifierPrefix),r.onUncaughtError!==void 0&&(w=r.onUncaughtError),r.onCaughtError!==void 0&&(N=r.onCaughtError),r.onRecoverableError!==void 0&&($=r.onRecoverableError),r.formState!==void 0&&(X=r.formState)),i=v_(e,1,!0,i,r??null,o,g,X,w,N,$,k_),i.context=g_(null),r=i.current,o=ci(),o=Se(o),g=jn(o),g.callback=null,Nn(r,g,o),r=o,i.current.lanes=r,ws(i,r),Ui(i),e[ct]=i.current,vd(e),new kc(i)},jo.version="19.2.7",jo}var H_;function rx(){if(H_)return Id.exports;H_=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(),Id.exports=nx(),Id.exports}var ax=rx();const jy="sapiom-harness-theme",Af=new Set;function ox(){var s;return typeof window<"u"&&((s=window.matchMedia)==null?void 0:s.call(window,"(prefers-color-scheme: dark)").matches)===!0}function lx(){const s=typeof window<"u"?window.localStorage.getItem(jy):null;return s==="light"||s==="dark"?s:ox()?"dark":"light"}let Sp=lx();function wu(){return Sp}function cx(s){Sp=s,document.documentElement.dataset.theme=s,window.localStorage.setItem(jy,s),Af.forEach(t=>t(s))}function ux(){cx(Sp==="dark"?"light":"dark")}function wp(s){return Af.add(s),()=>Af.delete(s)}const Ny=Date.now(),js=s=>new Date(Ny-s*6e4).toISOString(),at=s=>new Date(Ny-s*24*60*6e4).toISOString(),I_="/Users/demo/acme-app";js(1),js(1),js(42),js(20),at(2),at(1),at(1),at(1),at(3),at(3),js(0),js(0),js(3),js(3);js(1),at(1),at(1),at(3),at(6),at(45),at(1);js(48),js(1),js(48),js(47),js(46),js(45),js(3),js(2),at(1),at(1),at(1),at(1),at(1),at(1),at(1),at(1),at(1),at(3),at(3),at(3),at(3),at(3),at(3),at(3),at(3),at(1),at(1),at(1),at(1),at(45),at(45),at(45),at(45),at(45),at(45),at(45),at(45);function xp(){return!1}function Ea(s){return(s==null?void 0:s.boundWorkflowPath)??null}class ui extends Error{constructor(n,a,l){super(a);Od(this,"status");Od(this,"reason");this.name="ApiError",this.status=n,this.reason=l}}function ka(){const s=window.__HARNESS__;return s!=null&&s.token?s.token:new URLSearchParams(window.location.search).get("token")??""}class hx{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 a=await fetch(t,{...n,headers:{"Content-Type":"application/json","X-Harness-Token":ka(),...n==null?void 0:n.headers}});if(!a.ok){const l=await a.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 ui(a.status,`${(n==null?void 0:n.method)??"GET"} ${t} → ${a.status}${l?`: ${l}`:""}`,d)}if(a.status!==204)return await a.json()}getState(){return this.request("/api/state")}createSession(t){return this.request("/api/sessions",{method:"POST",body:JSON.stringify({theme:wu(),...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 ui&&(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 a={workflowPath:n};return this.request(`/api/sessions/${encodeURIComponent(t)}/workflow`,{method:"PATCH",body:JSON.stringify(a)})}listTemplates(){return this.request("/api/templates")}getTemplate(t){return this.request(`/api/templates/${encodeURIComponent(t)}`)}getRunState(t){return this.request(`/api/runs/${encodeURIComponent(t)}/state`)}async runLocal(t,n){const a=await fetch("/api/runs/local",{method:"POST",headers:{"Content-Type":"application/json","X-Harness-Token":ka()},body:JSON.stringify(t)});if(!a.ok||!a.body){const h=await a.text().catch(()=>"");throw new ui(a.status,`POST /api/runs/local → ${a.status}${h?`: ${h}`:""}`,void 0)}const l=a.body.getReader(),d=new TextDecoder;let p="";const c=(h,v)=>{p+=h;const{lines:S,rest:f}=fx(p,v);p=f;for(const x of S){const E=px(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 a=await this.streamNdjson(`/api/workflows/${encodeURIComponent(t)}/deploy`,{method:"POST"},n);return vx(a)}async run(t){return this.request("/api/runs",{method:"POST",body:JSON.stringify(t)})}async streamNdjson(t,n,a){const l=await fetch(t,{...n,headers:{"Content-Type":"application/json","X-Harness-Token":ka(),...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 ui(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=dx(x);E!==void 0&&(d.push(E),a==null||a(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 dx(s){const t=s.trim();if(t==="")return;let n;try{n=JSON.parse(t)}catch{return}return n===null?void 0:n}function fx(s,t){const n=s.split(`
53
- `);if(t)return{lines:n.filter(l=>l.trim()!==""),rest:""};const a=n.pop()??"";return{lines:n.filter(l=>l.trim()!==""),rest:a}}function px(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 vx(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 gx(){return new hx}function Xo(s){var a,l;const t=(a=s.inputSchema)==null?void 0:a.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 Jn(s){return s<1e3?`${s}ms`:`${Math.round(s/100)/10}s`}function mx(s,t){const n=[],a=Xo(s).length;a>0&&n.push(a===1?"1 input":`${a} 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(`${Jn(s.timeoutMs)} limit`),n}function _x(s){const t=s.nodes.filter(a=>a.kind==="terminal-success"||a.kind==="terminal-warn").length;return{steps:s.nodes.filter(a=>a.kind!=="terminal-success"&&a.kind!=="terminal-warn"&&a.kind!=="launched-workflow").length,exits:t}}function yx(s){const{steps:t,exits:n}=_x(s),a=[`${t} ${t===1?"step":"steps"}`];return n>0&&a.push(`${n} ${n===1?"exit":"exits"}`),a.join(" · ")}function Ly(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 bx(s){if(!s||typeof s!="object")return null;const t=s;if(!t.properties||typeof t.properties!="object")return null;const n={};for(const[a,l]of Object.entries(t.properties)){const d=l&&typeof l=="object"?l.type:void 0;n[a]=typeof d=="string"?{type:d}:{}}return Object.keys(n).length===0?null:{properties:n,required:Array.isArray(t.required)?t.required.filter(a=>typeof a=="string"):[]}}function Sx(s){if(!s||typeof s!="object")return null;const t=s;if(!Array.isArray(t.nodes)||!Array.isArray(t.edges))return null;const n=a=>typeof a=="string"?a:"";return{name:n(t.name),entry:n(t.entry),nodes:t.nodes.map(a=>({id:n(a.id),kind:n(a.kind),label:n(a.label),role:n(a.role),description:n(a.description),timeoutMs:typeof a.timeoutMs=="number"&&a.timeoutMs>0?a.timeoutMs:null,inputSchema:bx(a.inputSchema),capabilities:Array.isArray(a.capabilities)?a.capabilities.filter(l=>typeof l=="string"):[]})),edges:t.edges.map(a=>({from:n(a.from),to:n(a.to),kind:n(a.kind),label:n(a.label)})),groups:Array.isArray(t.groups)?t.groups.map(a=>({label:n(a.label),nodeIds:Array.isArray(a.nodeIds)?a.nodeIds.filter(l=>typeof l=="string"):[]})):[],warnings:Array.isArray(t.warnings)?t.warnings.filter(a=>typeof a=="string"):[]}}const Oy="sapiom-harness-ui-prefs";function Wi(){if(typeof window>"u")return{};try{const s=window.localStorage.getItem(Oy);return s?JSON.parse(s):{}}catch{return{}}}function xn(s){if(!(typeof window>"u"))try{window.localStorage.setItem(Oy,JSON.stringify({...Wi(),...s}))}catch{}}function xu(s,t){return!s||s.stubbed!==!0?!1:s.steps.some(n=>n.name===t)}function wx(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 Ma(s){if(typeof s=="string")return s;try{return JSON.stringify(s,null,2)??String(s)}catch{return String(s)}}function Cu(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 z_=3e3,$_=2e3;function xx(s){return s<1e3?`${s}ms`:`${(s/1e3).toFixed(1)}s`}function P_(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>$_?`${t.slice(0,$_)}
54
- … (truncated, ${t.length} chars total)`:t}function Cx(s,t,n){const a=[];a.push(`Step: ${s.name}`),a.push(`Status: ${s.status}`),s.latencyMs!=null&&a.push(`Latency: ${xx(s.latencyMs)}`),s.status==="failed"&&s.error&&a.push(`Error: ${s.error}`),(t==null?void 0:t.input)!==void 0&&a.push(`
55
- Input:
56
- ${P_(t.input)}`),(t==null?void 0:t.output)!==void 0&&a.push(`
57
- Output:
58
- ${P_(t.output)}`);const l=t==null?void 0:t.calls;if(l!==void 0)if(l.length>0){a.push(`
59
- Capabilities called:`);for(const d of l){const p=d.stubUsed?" (stubbed)":"";a.push(` - ${d.capability}${p}`)}}else a.push(`
60
- Capabilities called: none (the step made zero capability calls).`);else if(n!=null&&n.capabilities&&n.capabilities.length>0){a.push(`
61
- Capabilities declared (no call trace):`);for(const d of n.capabilities)a.push(` - ${d}`)}if(t!=null&&t.unusedStubs&&t.unusedStubs.length>0){a.push(`
62
- Unused stubs (supplied but matched no call):`);for(const d of t.unusedStubs)a.push(` - ${d}`)}if(t!=null&&t.stubWarnings&&t.stubWarnings.length>0){a.push(`
63
- Stub warnings:`);for(const d of t.stubWarnings)a.push(` - ${d}`)}if(s.logSlice){const d=s.logSlice.trimEnd(),p=d.length>z_?d.slice(d.length-z_):d;a.push(`
64
- Logs:
65
- ${p}`)}return a.join(`
66
- `)}const Ex=/\.(png|jpg|jpeg|webp|gif|svg)($|\?)/i,kx=/https?:\/\/[^\s"'<>`\])\]]+/gi,Tx=/[.,;:)\]}\s]+$/;function U_(s){if(typeof s=="string")return s;try{return JSON.stringify(s)??String(s)}catch{return String(s)}}function By(s){const t=new Set,n=[],a=l=>{const d=l.matchAll(kx);for(const[p]of d){const c=p.replace(Tx,"");if(!c||t.has(c))continue;t.add(c);const h=Ex.test(c)?"image":"other";n.push({url:c,kind:h})}};if(s.output!==void 0&&a(U_(s.output)),s.logSlice&&a(s.logSlice),s.calls)for(const l of s.calls)l.result!==void 0&&a(U_(l.result));return n}const Hy="https://app.sapiom.ai",Iy=`${Hy}/agents`;function Eu(s){return`${Iy}/${s}`}const Ax="https://docs.sapiom.ai",Rx=`${Ax}/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 zy=(...s)=>s.filter((t,n,a)=>!!t&&t.trim()!==""&&a.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 Mx=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 Dx=s=>s.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,a)=>a?a.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 F_=s=>{const t=Dx(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 Ud={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 jx=s=>{for(const t in s)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},Nx=P.createContext({}),Lx=()=>P.useContext(Nx),Ox=P.forwardRef(({color:s,size:t,strokeWidth:n,absoluteStrokeWidth:a,className:l="",children:d,iconNode:p,...c},h)=>{const{size:v=24,strokeWidth:S=2,absoluteStrokeWidth:f=!1,color:x="currentColor",className:E=""}=Lx()??{},A=a??f?Number(n??S)*24/Number(t??v):n??S;return P.createElement("svg",{ref:h,...Ud,width:t??v??Ud.width,height:t??v??Ud.height,stroke:s??x,strokeWidth:A,className:zy("lucide",E,l),...!d&&!jx(c)&&{"aria-hidden":"true"},...c},[...p.map(([C,y])=>P.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 je=(s,t)=>{const n=P.forwardRef(({className:a,...l},d)=>P.createElement(Ox,{ref:d,iconNode:t,className:zy(`lucide-${Mx(F_(s))}`,`lucide-${s}`,a),...l}));return n.displayName=F_(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 Bx=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Hx=je("arrow-down",Bx);/**
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 Ix=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],zx=je("arrow-left",Ix);/**
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 $x=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Px=je("arrow-right",$x);/**
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 Ux=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],Fx=je("arrow-up-right",Ux);/**
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 qx=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Wx=je("arrow-up",qx);/**
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 Gx=[["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"}]],Vx=je("book-open",Gx);/**
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 Yx=[["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"}]],Kx=je("brain",Yx);/**
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 Xx=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Jx=je("check",Xx);/**
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 Zx=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Qx=je("chevron-down",Zx);/**
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 eC=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],tC=je("chevron-right",eC);/**
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 sC=[["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"}]],iC=je("circle-question-mark",sC);/**
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 nC=[["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"}]],rC=je("cloud-off",nC);/**
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 aC=[["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"}]],oC=je("cloud-upload",aC);/**
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 lC=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],cC=je("cloud",lC);/**
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 uC=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],hC=je("code",uC);/**
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 dC=[["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"}]],fC=je("copy",dC);/**
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 pC=[["path",{d:"m15 10 5 5-5 5",key:"qqa56n"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]],vC=je("corner-down-right",pC);/**
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 gC=[["path",{d:"M14 9 9 4 4 9",key:"1af5af"}],["path",{d:"M20 20h-7a4 4 0 0 1-4-4V4",key:"1blwi3"}]],mC=je("corner-left-up",gC);/**
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 _C=[["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"}]],yC=je("ellipsis",_C);/**
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 bC=[["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"}]],SC=je("external-link",bC);/**
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 wC=[["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"}]],xC=je("flask-conical",wC);/**
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 CC=[["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"}]],EC=je("folder-open",CC);/**
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 kC=[["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"}]],TC=je("folder-plus",kC);/**
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 AC=[["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"}]],RC=je("folder",AC);/**
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 MC=[["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"}]],DC=je("frame",MC);/**
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 jC=[["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"}]],NC=je("globe",jC);/**
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 LC=[["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"}]],OC=je("hammer",LC);/**
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 BC=[["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"}]],HC=je("history",BC);/**
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 IC=[["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"}]],zC=je("image-up",IC);/**
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 $C=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],PC=je("info",$C);/**
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 UC=[["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"}]],FC=je("layout-template",UC);/**
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 qC=[["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"}]],WC=je("list-checks",qC);/**
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 GC=[["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"}]],VC=je("list",GC);/**
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 YC=[["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"}]],KC=je("loader",YC);/**
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 XC=[["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"}]],JC=je("log-out",XC);/**
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 ZC=[["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"}]],QC=je("maximize-2",ZC);/**
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 e2=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],t2=je("menu",e2);/**
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 s2=[["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=je("message-square",s2);/**
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 n2=[["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"}]],r2=je("minimize-2",n2);/**
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 a2=[["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"}]],o2=je("moon",a2);/**
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 l2=[["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"}]],c2=je("panel-left-close",l2);/**
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 u2=[["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"}]],h2=je("panel-left-open",u2);/**
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 d2=[["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"}]],f2=je("panel-right-close",d2);/**
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 p2=[["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"}]],v2=je("panel-right-open",p2);/**
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 g2=[["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"}]],m2=je("paperclip",g2);/**
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 _2=[["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"}]],y2=je("pencil",_2);/**
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 b2=[["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"}]],S2=je("play",b2);/**
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 w2=[["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"}]],x2=je("plug",w2);/**
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 C2=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],E2=je("plus",C2);/**
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 k2=[["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"}]],T2=je("radio",k2);/**
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 A2=[["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"}]],R2=je("refresh-cw",A2);/**
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 M2=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],D2=je("search",M2);/**
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 j2=[["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"}]],N2=je("settings",j2);/**
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 L2=[["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"}]],O2=je("sparkles",L2);/**
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 B2=[["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"}]],H2=je("square-terminal",B2);/**
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 I2=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],z2=je("square",I2);/**
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 $2=[["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"}]],P2=je("sun",$2);/**
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 U2=[["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"}]],F2=je("tags",U2);/**
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 q2=[["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"}]],W2=je("trash-2",q2);/**
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 G2=[["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"}]],V2=je("triangle-alert",G2);/**
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 Y2=[["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"}]],K2=je("wand-sparkles",Y2);/**
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 X2=[["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"}]],J2=je("workflow",X2);/**
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 Z2=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Q2=je("x",Z2);/**
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 eE=[["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"}]],tE=je("zap",eE);/**
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 sE=[["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=je("zoom-in",sE);/**
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 nE=[["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"}]],rE=je("zoom-out",nE),aE={ArrowDown:Hx,ArrowLeft:zx,ArrowRight:Px,ArrowUp:Wx,ArrowUpRight:Fx,BookOpen:Vx,Brain:Kx,Check:Jx,ChevronDown:Qx,ChevronRight:tC,Cloud:cC,CloudOff:rC,CloudUpload:oC,Code:hC,Copy:fC,CornerDownRight:vC,CornerLeftUp:mC,ExternalLink:SC,FlaskConical:xC,Folder:RC,FolderOpen:EC,FolderPlus:TC,Frame:DC,Globe:NC,Hammer:OC,History:HC,ImageUp:zC,Info:PC,LayoutTemplate:FC,List:VC,ListChecks:WC,Loader:KC,LogOut:JC,Maximize2:QC,Menu:t2,MessageSquare:i2,Minimize2:r2,MoreHorizontal:yC,Moon:o2,PanelLeftClose:c2,PanelLeftOpen:h2,PanelRightClose:f2,PanelRightOpen:v2,Paperclip:m2,Pencil:y2,Play:S2,Plug:x2,Plus:E2,Radio:T2,RefreshCw:R2,Search:D2,Settings:N2,Sparkles:O2,Square:z2,SquareTerminal:H2,Sun:P2,Tags:F2,Trash2:W2,TriangleAlert:V2,Wand2:K2,Workflow:J2,X:Q2,Zap:tE,ZoomIn:iE,ZoomOut:rE};function de({name:s,size:t=16}){const n=aE[s]??iC;return u.jsx(n,{size:t,strokeWidth:1.75,"aria-hidden":"true"})}function ku(){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:a,className:l,defaultOpen:d=!1}){const[p,c]=P.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(de,{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":a,onClick:h,"aria-label":`Copy ${s.toLowerCase()}`,children:[u.jsx(de,{name:p?"Check":"Copy",size:11}),p?"Copied":"Copy"]})]}),u.jsx("pre",{children:t})]})}function $y({links:s,testid:t}){return u.jsx("div",{className:"canvas-links-list","data-testid":t,children:s.map(({url:n,kind:a})=>a==="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(de,{name:"ExternalLink",size:12}),u.jsx("span",{className:"canvas-link-url",children:"Open"})]},n))})}function Py({step:s}){const t=By(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($y,{links:t})]})}function Uy({status:s}){return s==="completed"?u.jsx("span",{className:"canvas-run-status is-passed","aria-label":"completed",children:u.jsx(de,{name:"Check",size:11})}):s==="failed"?u.jsx("span",{className:"canvas-run-status is-failed","aria-label":"failed",children:u.jsx(de,{name:"X",size:11})}):s==="cancelled"?u.jsx("span",{className:"canvas-run-status is-pending","aria-label":"cancelled",children:u.jsx(de,{name:"Minus",size:11})}):u.jsx("span",{className:"canvas-run-status is-running","aria-label":"running"})}function oE({run:s,runTarget:t,workflow:n,preview:a}){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 By(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?Eu(n.definitionId):null,E=S[0]??null,A=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(Uy,{status:s.status}),y]}),h&&u.jsx("span",{className:"canvas-run-summary-meta","data-testid":"run-summary-duration",children:Jn(c)}),t&&u.jsx("span",{className:"canvas-run-summary-target",children:Ep(t)})]}),E?u.jsxs("a",{className:"run-summary-open","data-testid":"run-summary-open",href:E.url,target:"_blank",rel:"noreferrer",children:[u.jsx(de,{name:"ArrowUpRight",size:14}),"Open result"]}):a?u.jsxs("a",{className:"run-summary-open","data-testid":"run-summary-preview-link",href:a.url,target:"_blank",rel:"noreferrer",children:[u.jsx(de,{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(de,{name:"Cloud",size:14}),"Open in Sapiom"]}):null,(C||a||A.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(de,{name:"Cloud",size:12}),"Open in Sapiom"]}),E&&a&&u.jsxs("a",{className:"status-tag status-tag-action run-summary-secondary-link","data-testid":"run-summary-preview-link",href:a.url,target:"_blank",rel:"noreferrer",children:[u.jsx(de,{name:"ExternalLink",size:12}),"Open preview"]}),A.length>0&&u.jsx($y,{links:A,testid:"run-summary-links"})]}),!p&&(f==null?void 0:f.output)!==void 0&&u.jsx(Xn,{label:"Result",text:Ma(f.output),className:"canvas-run-result",testid:"run-summary-output",copyTestid:"payload-copy-result"})]})}function lE({deployState:s,workflow:t,onDismiss:n,onOpenCode:a}){const l=(t==null?void 0:t.definitionId)!=null?Eu(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(Uy,{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(de,{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(de,{name:"Cloud",size:12}),"Open in Sapiom"]}),u.jsxs("button",{type:"button",className:"status-tag status-tag-action","data-testid":"deploy-open-code",onClick:a,children:[u.jsx(de,{name:"Code",size:12}),"Trigger from your code"]})]})]})}function Fy({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:Ma(t.result)})]})]},`${t.capability}-${n}`))})]})}function Cp({run:s}){const t=wx(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 Ep(s){return s?`${s} run`:"run"}function Tu({status:s}){return s==="passed"?u.jsx("span",{className:"canvas-run-status is-passed","data-status":"passed","aria-label":"passed",children:u.jsx(de,{name:"Check",size:11})}):s==="failed"?u.jsx("span",{className:"canvas-run-status is-failed","data-status":"failed","aria-label":"failed",children:u.jsx(de,{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 Ac(s){return s.kind==="branching"?"branch":s.kind==="cross"?"pause resume":s.kind==="launch"?"launch":null}function cE({node:s}){const t=Xo(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 uE({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 hE(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 qy({node:s,workflows:t,onOpenWorkflow:n}){const a=hE(s,t);return a?u.jsxs("button",{className:"canvas-step-open","data-testid":`canvas-open-workflow-${s.id}`,"data-tooltip":`Switch to ${a.name}`,onClick:()=>n(a.path),children:["Open agent ",u.jsx(de,{name:"ArrowRight",size:12})]}):null}function q_({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:Ep(t)})]}),s.steps.map((n,a)=>{const l=[n.latencyMs!==void 0?Jn(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(a+1).padStart(2,"0")}),u.jsx(Tu,{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})]}),xu(s,n.name)&&u.jsx(ku,{}),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(Cp,{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 dE({graph:s,run:t,runTarget:n,workflows:a,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(A=>A.nodeIds.includes(x)))==null?void 0:E.label)??null},f=[];return s.nodes.forEach((x,E)=>{const A=S(x.id),C=f[f.length-1];C&&C.group===A?C.nodes.push({node:x,index:E}):f.push({group:A,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:Ep(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:A,index:C})=>{const y=p===A.id,b=mx(A,s.edges),m=Cu(t,A.id),_=m?[m.latencyMs!==void 0?Jn(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-${A.id}`,"aria-expanded":y,onClick:()=>c(A.id),children:[u.jsx("span",{className:"canvas-step-index",children:String(C+1).padStart(2,"0")}),m?u.jsx(Tu,{status:m.status}):u.jsx("span",{className:"canvas-step-dot dot--"+A.kind,"aria-hidden":"true"}),u.jsxs("span",{className:"canvas-step-copy",children:[u.jsx("span",{className:"canvas-step-name",children:A.label}),u.jsx("span",{className:"canvas-step-role",children:A.role})]}),m&&xu(t,A.id)&&u.jsx(ku,{}),u.jsx("span",{className:"canvas-step-meta",children:(_.length>0?_:b).join(" · ")}),u.jsx("span",{className:"canvas-step-caret"+(y?" is-open":""),"aria-hidden":"true",children:u.jsx(de,{name:"ChevronDown",size:13})})]}),y&&u.jsx("div",{className:"canvas-step-expand","data-testid":`canvas-step-expand-${A.id}`,children:u.jsx(fE,{graph:s,node:A,run:t,workflows:a,onOpenWorkflow:l,onAskAgent:d})})]},A.id)})]},`${x.group??"ungrouped"}-${E}`))]})}function fE({graph:s,node:t,run:n,workflows:a,onOpenWorkflow:l,onAskAgent:d}){const p=Cu(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(de,{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(de,{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(de,{name:"Copy",size:13}),"Copy name"]})]}),u.jsx(qy,{node:t,workflows:a,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(Tu,{status:p.status}),p.status,xu(n,t.id)&&u.jsx(ku,{})]})]}),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:Jn(p.latencyMs)})]}),p.input!==void 0&&u.jsx(Xn,{label:"Input",text:Ma(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:Ma(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(Fy,{step:p}),p&&u.jsx(Py,{step:p}),u.jsx(Cp,{run:n}),(Xo(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))})]}),Xo(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:Xo(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:Jn(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(de,{name:"CornerDownRight",size:13}),u.jsx("span",{className:"canvas-detail-edge-target",children:v(f.to)}),Ac(f)&&u.jsx("span",{className:"canvas-detail-edge-kind",children:Ac(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(de,{name:"CornerLeftUp",size:13}),u.jsx("span",{className:"canvas-detail-edge-target",children:v(f.from)}),Ac(f)&&u.jsx("span",{className:"canvas-detail-edge-kind",children:Ac(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 pE({node:s,run:t,workflows:n,onOpenWorkflow:a}){const l=Cu(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(cE,{node:s}),u.jsx(uE,{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:Jn(s.timeoutMs)})]}),u.jsx(qy,{node:s,workflows:n,onOpenWorkflow:a}),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(Tu,{status:l.status}),l.status,xu(t,s.id)&&u.jsx(ku,{})]}),l.latencyMs!==void 0&&u.jsx("span",{className:"canvas-inspector-run-meta",children:Jn(l.latencyMs)})]}),(l==null?void 0:l.input)!==void 0&&u.jsx(Xn,{label:"Input",text:Ma(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:Ma(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(Fy,{step:l}),l&&u.jsx(Py,{step:l}),u.jsx(Cp,{run:t})]})}function vE({node:s,run:t,onInjectPrompt:n,onClose:a}){const l=s?Cu(t,s.id):null,[d,p]=P.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(A=>A.key),stubWarnings:t==null?void 0:t.stubWarnings}:void 0,f=s.capabilities.length>0?{capabilities:s.capabilities}:void 0,x=Cx(l??{id:s.id,name:s.id,status:"pending"},S,f);n(`${x}
432
-
433
- ${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:a,children:u.jsx(de,{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 W_=24;function gE({overview:s,selectedNode:t,graph:n,run:a,workflows:l,onOpenWorkflow:d,onOpenSteps:p,onDeselect:c,onCollapse:h,onDescribeWithAI:v,describing:S=!1}){var se;const f=P.useRef(null),x=P.useRef(null),E=P.useRef(null),A=P.useRef(null),C=P.useRef(Wi().canvasInspectorHeight??null),[y,b]=P.useState(null),[m,_]=P.useState(!1),[k,R]=P.useState(!1),M=k||S;P.useEffect(()=>{S&&R(!1)},[S]),P.useEffect(()=>{if(!k)return;const F=window.setTimeout(()=>R(!1),8e3);return()=>window.clearTimeout(F)},[k]);const j=()=>{var G;const F=(G=f.current)==null?void 0:G.parentElement;return F?Math.round(F.getBoundingClientRect().height*.5):Number.MAX_SAFE_INTEGER},T=()=>{var F;return(((F=x.current)==null?void 0:F.offsetHeight)??40)+1},D=P.useCallback(()=>{const F=x.current,G=E.current,J=A.current;if(!F||!G||!J)return;const O=j(),H=C.current,L=window.getComputedStyle(G),B=(parseFloat(L.paddingTop)||0)+(parseFloat(L.paddingBottom)||0),V=F.offsetHeight+J.offsetHeight+B+1,Q=H!=null?Math.min(Math.max(H,T()),O):Math.min(V,O);b(Q)},[]);P.useLayoutEffect(D),P.useEffect(()=>{var J;if(typeof ResizeObserver>"u")return;const F=new ResizeObserver(D),G=(J=f.current)==null?void 0:J.parentElement;return G&&F.observe(G),A.current&&F.observe(A.current),()=>F.disconnect()},[D]);const I=F=>{C.current=Math.round(Math.min(Math.max(F,T()),j())),D()},q=()=>{xn({canvasInspectorHeight:C.current})},W=()=>{C.current=null,xn({canvasInspectorHeight:null}),D()},U=F=>{if(F.button!==0)return;const G=F.currentTarget,J=f.current;if(!J)return;try{G.setPointerCapture(F.pointerId)}catch{}_(!0);const O=F.clientY,H=J.getBoundingClientRect().height,L=V=>{I(H+(O-V.clientY))},B=()=>{_(!1),q(),window.removeEventListener("pointermove",L),window.removeEventListener("pointerup",B),window.removeEventListener("pointercancel",B)};window.addEventListener("pointermove",L),window.addEventListener("pointerup",B),window.addEventListener("pointercancel",B)},Z=F=>{var J;const G=((J=f.current)==null?void 0:J.getBoundingClientRect().height)??0;F.key==="ArrowUp"?(F.preventDefault(),I(G+W_),q()):F.key==="ArrowDown"?(F.preventDefault(),I(G-W_),q()):F.key==="Home"&&(F.preventDefault(),W())};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:W,onKeyDown:Z}),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:Ly(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(de,{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(de,{name:"X",size:13})})]}):u.jsxs(u.Fragment,{children:[u.jsx(de,{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(de,{name:"X",size:13})})]})}),u.jsx("div",{ref:E,className:"canvas-overview-body",children:u.jsx("div",{ref:A,className:"canvas-overview-content",children:t&&n?u.jsx(pE,{graph:n,node:t,run:a,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"+(M?" is-loading":""),"data-testid":"canvas-describe-ai",disabled:M,"aria-busy":M,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.")||(R(!0),v())},"data-tooltip":"Runs a hidden coding-agent session that writes descriptions into the agent source — the canvas updates when it saves",children:M?u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"canvas-describe-spinner","aria-hidden":"true"}),"Describing…"]}):u.jsxs(u.Fragment,{children:[u.jsx(de,{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:a,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(de,{name:t,size:18})}),s&&u.jsx("span",{className:"empty-state-eyebrow",children:s}),u.jsx("span",{className:"empty-state-title",children:n}),a&&u.jsx("span",{className:"empty-state-body",children:a}),l&&u.jsx("span",{className:"empty-state-cta",children:l}),c]})}function mE(s,t=Date.now()){const n=Math.max(0,Math.round((t-s)/1e3));if(n<45)return"just now";const a=Math.round(n/60);if(a<60)return`${a}m ago`;const l=Math.round(a/60);return l<24?`${l}h ago`:`${Math.round(l/24)}d ago`}var _E=Dy();function pl(s,{onDismiss:t,containerRef:n,triggerRef:a}){P.useEffect(()=>{if(!s)return;const l=p=>{var h;const c=n.current;!c||!(p.target instanceof Node)||c.contains(p.target)||(h=a==null?void 0:a.current)!=null&&h.contains(p.target)||t()},d=p=>{var c;p.key==="Escape"&&(t(),(c=a==null?void 0:a.current)==null||c.focus())};return document.addEventListener("mousedown",l),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",l),document.removeEventListener("keydown",d)}},[s,t,n,a])}const No=4,Oi=8;function yE(s,t,n,a,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=(a??s).getBoundingClientRect().right+No,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+No,l&&(p.maxHeight=window.innerHeight-d.bottom-No-Oi)):(p.bottom=window.innerHeight-d.top+No,l&&(p.maxHeight=d.top-No-Oi)),t.endsWith("start")?p.left=Math.max(Oi,d.left):p.right=Math.max(Oi,window.innerWidth-d.right),p)}function Zn({open:s,anchorRef:t,onDismiss:n,placement:a,matchWidth:l=!1,besideRef:d,noClip:p=!1,className:c,role:h,testid:v,children:S}){const f=P.useRef(null),[x,E]=P.useState(null);pl(s,{onDismiss:n,containerRef:f,triggerRef:t});const A=P.useCallback(()=>{const C=t.current;C&&E(yE(C,a,l,(d==null?void 0:d.current)??null,!p))},[t,a,l,d,p]);return P.useLayoutEffect(()=>{s?A():E(null)},[s,A]),P.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]),P.useEffect(()=>{if(s)return window.addEventListener("resize",A),window.addEventListener("scroll",A,!0),()=>{window.removeEventListener("resize",A),window.removeEventListener("scroll",A,!0)}},[s,A]),!s||x==null?null:_E.createPortal(u.jsx("div",{ref:f,className:c,role:h,"data-testid":v,style:x,children:S}),document.body)}function bE(s,t){return`${t?`${t} run`:"run"} ${s.status}`}function SE({workflow:s,detailStep:t,onBack:n,onAskAgent:a,surface:l,stepsSummary:d,run:p,runTarget:c,runs:h,onSelectRun:v}){const[S,f]=P.useState(!1),x=P.useRef(null),E=P.useCallback(()=>f(!1),[]),[A,C]=P.useState(!1),y=P.useRef(null),b=P.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(de,{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:Ly(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:()=>a(`Walk me through the "${t.label}" step of this agent: what it does, its inputs and outputs, and its transitions.`),children:[u.jsx(de,{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(de,{name:"MoreHorizontal",size:14})}),u.jsxs(Zn,{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:()=>{a(`Modify the "${t.label}" step of this agent. Show me the step's code first, then propose the change.`),E()},children:[u.jsx(de,{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(de,{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"}),bE(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",children: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":A,"aria-label":`Pick a run to inspect (${h.length} observed)`,"data-tooltip":"Pick a run to inspect",onClick:()=>C(_=>!_),children:[m,u.jsx(de,{name:"ChevronDown",size:12})]}),u.jsx(Zn,{open:A,anchorRef:y,onDismiss:b,placement:"down-end",className:"canvas-run-menu",role:"menu",testid:"canvas-run-menu",children:[...h].reverse().map((_,k)=>{const R=h.length-k,M=_.run.executionId===p.executionId,j=mE(_.observedAt);return u.jsxs("button",{role:"menuitemradio","aria-checked":M,className:"profile-menu-item"+(M?" is-selected":""),"data-testid":`canvas-run-option-${_.run.executionId}`,title:_.run.executionId,onClick:()=>{v(_.run.executionId),b()},children:[u.jsx(de,{name:M?"Check":"Play",size:13}),u.jsx("span",{children:`run ${R} · ${_.run.status} · ${_.target}`}),u.jsx("span",{className:"canvas-run-option-meta",children:j})]},_.run.executionId)})})]})]})}return null}const wE=4e3;function xE(s){if(typeof s!="object"||s===null)return!1;const t=s;return typeof t.kind=="string"&&typeof t.label=="string"}function CE({sessionId:s,lastMessage:t,boundWorkflow:n,noSessionAgent:a=null,overviewActive:l,sessionExited:d,expanded:p,onToggleExpanded:c,macros:h,tasks:v,onRunMacro:S,onInjectPrompt:f,onDescribeWorkflow:x,surface:E,onOpenSteps:A,run:C,runTarget:y,runs:b,onSelectRun:m,preview:_,deployState:k,onDismissDeploy:R,onOpenCode:M,workflows:j,onOpenWorkflow:T,onCanvasState:D}){const[I,q]=P.useState(!1),W=P.useRef(D);W.current=D;const[U,Z]=P.useState(0),[se,F]=P.useState(wu()),[G,J]=P.useState(!1),[O,H]=P.useState(!0),[L,B]=P.useState(!1),V=P.useRef(null),Q=P.useRef(null),ue=P.useRef(0),fe=P.useCallback(()=>{H(!1),B(!0),V.current&&clearTimeout(V.current),V.current=setTimeout(()=>B(!1),360)},[]),Y=()=>{const ye=ue.current-Date.now();Q.current&&clearTimeout(Q.current),ye>0?Q.current=setTimeout(fe,ye):fe()};P.useEffect(()=>()=>{V.current&&clearTimeout(V.current),Q.current&&clearTimeout(Q.current)},[]),P.useEffect(()=>{if(!O)return;const ye=window.setTimeout(fe,wE);return()=>window.clearTimeout(ye)},[O,fe]);const[z,oe]=P.useState(1),[ae,we]=P.useState({x:0,y:0}),[Ee,Ue]=P.useState(!1),$e=P.useRef(null),We=P.useRef(null),[Fe,Ne]=P.useState(.25),$t=ye=>Math.min(3,Math.max(Fe,Math.round(ye*100)/100)),[pt,Nt]=P.useState(null),xt=P.useRef(!1),[ls,_t]=P.useState({zoom:1,x:0,y:0}),ot=P.useCallback(()=>{const ye=$e.current;if(!pt||!ye)return null;const De=ye.getBoundingClientRect();if(De.width<80||De.height<80)return null;const Oe=De.width-pt.insetX*2,Ct=De.height-pt.insetTop-pt.insetBottom;if(Oe<=0||Ct<=0)return null;const ze=Math.min(1,Oe/pt.width,Ct/pt.height);return{zoom:Math.max(.1,Math.round(ze*100)/100),x:0,y:0}},[pt]),kt=P.useCallback(()=>{let ye=12;const De=()=>{const Oe=ot();if(Oe){Ne(Math.min(.25,Oe.zoom)),xt.current=!1,oe(Oe.zoom),we({x:Oe.x,y:Oe.y}),_t(Oe);return}if(pt&&ye-- >0){requestAnimationFrame(De);return}Ne(.25),xt.current=!1,oe(1),we({x:0,y:0}),_t({zoom:1,x:0,y:0})};De()},[ot,pt]);P.useEffect(()=>{!pt||xt.current||kt()},[pt,kt]),P.useEffect(()=>{const ye=$e.current;if(!ye||typeof ResizeObserver>"u")return;const De=new ResizeObserver(()=>{xt.current||kt()});return De.observe(ye),()=>De.disconnect()},[kt]),P.useEffect(()=>{var Oe,Ct,ze;(Ct=(Oe=We.current)==null?void 0:Oe.contentWindow)==null||Ct.postMessage({type:"sapiom-canvas:view",zoom:z,x:ae.x,y:ae.y},"*");const ye=_s.current,De=We.current;if(ye&&De){const ns=De.getBoundingClientRect();(ze=De.contentWindow)==null||ze.postMessage({type:"sapiom-canvas:hover",x:ye.x-ns.left,y:ye.y-ns.top},"*")}},[z,ae]),P.useEffect(()=>{const ye=$e.current;if(!ye)return;const De=Oe=>{Oe.preventDefault(),xt.current=!0,oe(Ct=>$t(Ct*(Oe.deltaY<0?1.1:1/1.1)))};return ye.addEventListener("wheel",De,{passive:!1}),()=>ye.removeEventListener("wheel",De)});const Tt=ye=>{var Ct,ze;const De=We.current;if(!De)return;const Oe=De.getBoundingClientRect();if(typeof ye.clientX=="number"&&typeof ye.clientY=="number"){const{clientX:ns,clientY:ks,...Rt}=ye;(Ct=De.contentWindow)==null||Ct.postMessage({...Rt,x:ns-Oe.left,y:ks-Oe.top},"*");return}(ze=De.contentWindow)==null||ze.postMessage(ye,"*")},[Os,Pe]=P.useState(!1),ds=P.useRef(!1),Wt=P.useRef(0),_s=P.useRef(null),lt=ye=>{if(_s.current={x:ye.clientX,y:ye.clientY},Ee)return;const{clientX:De,clientY:Oe}=ye;cancelAnimationFrame(Wt.current),Wt.current=requestAnimationFrame(()=>{Tt({type:"sapiom-canvas:hover",clientX:De,clientY:Oe})})},ys=()=>{cancelAnimationFrame(Wt.current),_s.current=null,Pe(!1),ds.current=!1,Tt({type:"sapiom-canvas:hover",x:-1,y:-1})},is=ye=>{if(ye.button!==0)return;const De=ye.currentTarget;try{De.setPointerCapture(ye.pointerId)}catch{}Ue(!0),Tt({type:"sapiom-canvas:press",clientX:ye.clientX,clientY:ye.clientY,down:!0});let Oe=!0;const Ct=()=>{Oe&&(Oe=!1,Tt({type:"sapiom-canvas:press",down:!1}))};let ze=ye.clientX,ns=ye.clientY;const ks=ye.clientX,Rt=ye.clientY,Cn=rs=>{const Ii=rs.clientX-ze,tr=rs.clientY-ns;ze=rs.clientX,ns=rs.clientY,(Math.abs(rs.clientX-ks)>=4||Math.abs(rs.clientY-Rt)>=4)&&(Ct(),xt.current=!0),we(En=>({x:En.x+Ii,y:En.y+tr}))},Vi=rs=>{Ue(!1),Ct(),De.removeEventListener("pointermove",Cn),De.removeEventListener("pointerup",Vi),De.removeEventListener("pointercancel",Vi),Math.abs(rs.clientX-ks)<4&&Math.abs(rs.clientY-Rt)<4&&(Tt({type:"sapiom-canvas:pick",clientX:rs.clientX,clientY:rs.clientY}),ds.current||bt(null))};De.addEventListener("pointermove",Cn),De.addEventListener("pointerup",Vi),De.addEventListener("pointercancel",Vi)},[Gt,bt]=P.useState(null);P.useEffect(()=>{if(!p&&Gt==null)return;const ye=De=>{De.key==="Escape"&&(Gt!=null?bt(null):c())};return window.addEventListener("keydown",ye),()=>window.removeEventListener("keydown",ye)},[p,Gt,c]);const[pi,si]=P.useState(!0),[Gs,Cs]=P.useState(!1),[Ke,it]=P.useState(null),[Ce,Ve]=P.useState(null),[ut,Es]=P.useState(null),[vi,Bs]=P.useState(null);P.useEffect(()=>{const ye=De=>{var Ct;const Oe=De.data;if(!(!Oe||De.source!==((Ct=We.current)==null?void 0:Ct.contentWindow))){if(Oe.type==="sapiom-canvas:overview")it({description:typeof Oe.description=="string"?Oe.description:"",stats:typeof Oe.stats=="string"?Oe.stats:"",notes:Array.isArray(Oe.notes)?Oe.notes.filter(ze=>typeof ze=="string"):[],badges:Array.isArray(Oe.badges)?Oe.badges.filter(ze=>typeof ze=="string"):[],legend:Array.isArray(Oe.legend)?Oe.legend.filter(xE):[]});else if(Oe.type==="sapiom-canvas:graph")Es(Sx(Oe.graph));else if(Oe.type==="sapiom-canvas:node"){const ze=Oe.id;typeof ze=="string"&&bt(ze)}else if(Oe.type==="sapiom:node-click"){const ze=Oe.stepName;typeof ze=="string"&&Es(ns=>{if(ns){const ks=ns.nodes.find(Rt=>Rt.label===ze)??ns.nodes.find(Rt=>Rt.id===ze)??null;ks&&bt(ks.id)}return ns})}else if(Oe.type==="sapiom-canvas:hit"){const ze=typeof Oe.id=="string";Pe(ze),ds.current=ze}else if(Oe.type==="sapiom-canvas:size"){const ze=Oe;typeof ze.width=="number"&&ze.width>0&&typeof ze.height=="number"&&ze.height>0&&Nt({width:ze.width,height:ze.height,insetTop:typeof ze.insetTop=="number"&&ze.insetTop>=0?ze.insetTop:0,insetBottom:typeof ze.insetBottom=="number"&&ze.insetBottom>=0?ze.insetBottom:0,insetX:typeof ze.insetX=="number"&&ze.insetX>=0?ze.insetX:0})}else if(Oe.type==="sapiom-canvas:error"){const ze=Oe;Ve({title:typeof ze.title=="string"?ze.title:"",reason:typeof ze.reason=="string"?ze.reason:""})}}};return window.addEventListener("message",ye),()=>window.removeEventListener("message",ye)},[]),P.useEffect(()=>{it(null),Ve(null),Es(null),bt(null),Bs(null),si(!0),Pe(!1),ds.current=!1,Nt(null),oe(1),we({x:0,y:0}),_t({zoom:1,x:0,y:0}),xt.current=!1},[s,U]);const ws=ut&&Gt?ut.nodes.find(ye=>ye.id===Gt)??null:null;P.useEffect(()=>{var ye,De;(De=(ye=We.current)==null?void 0:ye.contentWindow)==null||De.postMessage({type:"sapiom-canvas:select",id:Gt},"*")},[Gt]);const gi=P.useCallback(()=>{var ye,De;!C||!y||!s||xp()||O||(De=(ye=We.current)==null?void 0:ye.contentWindow)==null||De.postMessage({type:"sapiom:run-state",steps:C.steps,status:C.status,target:y},"*")},[C,y,s,O]);P.useEffect(()=>{gi()},[gi]);const ie=Ke??void 0,[ve,ge]=P.useState(new Set);P.useEffect(()=>wp(F),[]),P.useEffect(()=>{var De;if(H(!0),!s){q(!1),(De=W.current)==null||De.call(W,!1);return}q(!1);let ye=!1;return J(!0),fetch(`/canvas/${s}/`,{method:"HEAD"}).then(Oe=>{var Ct;ye||(q(Oe.ok),(Ct=W.current)==null||Ct.call(W,Oe.ok))}).catch(()=>{}).finally(()=>!ye&&J(!1)),()=>{ye=!0}},[s]),P.useEffect(()=>{var ye;!t||!s||t.type==="canvas.reload"&&t.harnessSessionId===s&&(q(!0),(ye=W.current)==null||ye.call(W,!0),H(!0),Z(De=>De+1))},[t,s]);const Se=(n==null?void 0:n.path)??null;P.useEffect(()=>{H(!0),Z(ye=>ye+1),oe(1),we({x:0,y:0}),_t({zoom:1,x:0,y:0}),xt.current=!1},[Se]);const Me=v.filter(ye=>ye.harnessSessionId===s&&(ye.workflowPath==null||ye.workflowPath===Se)),yt=Me.some(ye=>ye.status==="running"&&ye.macroId==="describe"),Xe=Me.find(ye=>ye.status==="running"&&ye.macroId!=="describe")??null,tt=Me.filter(ye=>ye.status!=="running"&&ye.macroId!=="describe").sort((ye,De)=>(De.endedAt??"").localeCompare(ye.endedAt??""))[0],Je=!Xe&&(tt==null?void 0:tt.status)==="failed"&&!ve.has(tt.id)?tt:null,nt=Je?h.find(ye=>ye.id===Je.macroId)??null:null,ct=h.find(ye=>ye.id==="visualize")??null,bs=s!=null&&!0,ht=I&&bs,Vs=u.jsxs(u.Fragment,{children:[k&&u.jsx(lE,{deployState:k,workflow:n,onDismiss:R,onOpenCode:M}),C&&u.jsx(oE,{run:C,runTarget:y,workflow:n,preview:_})]});return u.jsxs("aside",{className:"canvas-pane",children:[n&&!l&&u.jsx(SE,{workflow:n,detailStep:null,onBack:()=>{},onAskAgent:f,surface:E,stepsSummary:ut&&ut.nodes.length>0?yx(ut):null,run:C,runTarget:y,runs:b,onSelectRun:m}),a?u.jsx(Bi,{className:"canvas-empty",testId:"canvas-empty-no-session",icon:"Radio",title:`No running session for ${a}`,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."}):Je?u.jsxs("div",{className:"canvas-task-failed","data-testid":"canvas-task-failed",children:[u.jsxs("p",{className:"canvas-task-title",children:[u.jsx(de,{name:"TriangleAlert",size:14})," ",Je.label," failed."]}),Je.errorTail&&u.jsx("pre",{className:"canvas-task-error",children:Je.errorTail}),u.jsxs("div",{className:"canvas-task-actions",children:[nt&&u.jsx("button",{className:"btn-primary","data-testid":"canvas-task-retry",onClick:()=>S(nt),children:"Retry"}),u.jsx("button",{className:"btn-ghost","data-testid":"canvas-task-dismiss",onClick:()=>ge(ye=>{const De=new Set(ye);return De.add(Je.id),De}),children:"Dismiss"})]})]}):Xe&&!ht?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(de,{name:"Workflow",size:20})}),u.jsx("div",{className:"canvas-task-title",children:u.jsxs("span",{children:[Xe.label," is running…"]})}),Xe.statusLines.length>0&&u.jsx("ul",{className:"canvas-task-lines","data-testid":"canvas-task-lines",children:Xe.statusLines.slice(-8).map((ye,De)=>u.jsx("li",{children:ye},`${De}-${ye}`))}),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."})]}):G?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…"})]}):!ht&&E==="steps"&&(C||k)?u.jsxs("div",{className:"canvas-steps-surface","data-testid":"canvas-steps-surface",children:[Vs,C&&u.jsx(q_,{run:C,target:y})]}):!ht&&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.`}):ht?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:z<=Fe+.001,onClick:()=>{xt.current=!0,oe(ye=>Math.max(Fe,Math.round((ye-.25)*100)/100))},children:u.jsx(de,{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:z===1,onClick:()=>{xt.current=!0,oe(1)},children:[Math.round(z*100),"%"]}),u.jsx("button",{className:"theme-toggle","data-testid":"canvas-zoom-in","aria-label":"Zoom in",title:"Zoom in",disabled:z>=2,onClick:()=>{xt.current=!0,oe(ye=>Math.min(2,Math.round((ye+.25)*100)/100))},children:u.jsx(de,{name:"ZoomIn",size:14})}),u.jsx("button",{className:"theme-toggle","data-testid":"canvas-fit","aria-label":"Fit to view",title:"Fit to view",disabled:z===ls.zoom&&ae.x===ls.x&&ae.y===ls.y,onClick:kt,children:u.jsx(de,{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(de,{name:"Minimize2",size:14})}),(O||L)&&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"})]}),Ce&&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(de,{name:"TriangleAlert",size:20})}),u.jsx("div",{className:"canvas-task-title",children:"Render failed"}),u.jsx("p",{className:"canvas-error-summary",children:(()=>{const ye=Ce.reason.trim();return ye.length<4?"The agent graph could not be extracted. Open the terminal for details.":ye.includes(": ")?ye.slice(ye.indexOf(": ")+2).split(". ")[0]:ye})()}),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 ${Ce.title||"this agent"} failed: ${Ce.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:()=>{ct?S(ct):(ue.current=Date.now()+900,H(!0),Z(ye=>ye+1))},children:"Retry"})]}),u.jsxs("details",{className:"canvas-error-details",children:[u.jsx("summary",{children:"Details"}),u.jsx("pre",{children:Ce.reason.trim().length>=4?Ce.reason:"The rendered document reported a failure without details. Re-render the diagram or check the terminal."})]})]}),Xe&&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(de,{name:"Workflow",size:20})}),u.jsx("div",{className:"canvas-task-title",children:u.jsxs("span",{children:[Xe.label," is running…"]})}),Xe.statusLines.length>0&&u.jsx("ul",{className:"canvas-task-lines","data-testid":"canvas-task-lines",children:Xe.statusLines.slice(-8).map((ye,De)=>u.jsx("li",{children:ye},`${De}-${ye}`))}),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."})]}),ie&&!pi&&!ws&&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:()=>si(!0),children:"i"}),E==="board"&&u.jsx("button",{className:"theme-toggle canvas-chat-toggle"+(Gs?" is-active":""),"data-testid":"canvas-chat-toggle","aria-label":Gs?"Close chat":"Open chat","data-tooltip":"Chat — ask about this agent or the selected step",onClick:()=>Cs(ye=>!ye),children:u.jsx(de,{name:"MessageSquare",size:14})}),u.jsx("iframe",{ref:We,className:"canvas-iframe",src:`/canvas/${s}/?theme=${se}`,sandbox:"allow-scripts",scrolling:"no",onLoad:()=>{var ye,De,Oe,Ct;Y(),(De=(ye=We.current)==null?void 0:ye.contentWindow)==null||De.postMessage({type:"sapiom-canvas:view",zoom:z,x:ae.x,y:ae.y},"*"),C&&y&&s&&((Ct=(Oe=We.current)==null?void 0:Oe.contentWindow)==null||Ct.postMessage({type:"sapiom:run-state",steps:C.steps,status:C.status,target:y},"*"))},onError:fe},`${s}:${U}`),u.jsx("div",{ref:$e,className:"canvas-pan-layer"+(Ee?" is-panning":""),"data-testid":"canvas-pan-layer","data-over-node":Os&&!Ee?"true":void 0,onPointerDown:is,onPointerMove:lt,onPointerLeave:ys,onDoubleClick:kt})]}),E==="steps"&&u.jsxs("div",{className:"canvas-steps-surface","data-testid":"canvas-steps-surface",children:[Vs,ut&&ut.nodes.length>0?u.jsx(dE,{graph:ut,run:C,runTarget:y,workflows:j,onOpenWorkflow:T,onAskAgent:f,expandedId:vi,onToggle:ye=>Bs(De=>De===ye?null:ye)}):C?u.jsx(q_,{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"&&(ie&&pi||ws)&&u.jsx(gE,{overview:ie??null,selectedNode:ws,graph:ut,run:C,workflows:j,onOpenWorkflow:T,onOpenSteps:()=>{Gt&&Bs(Gt),A()},onDeselect:()=>bt(null),onCollapse:()=>si(!1),onDescribeWithAI:n&&s&&!d?()=>x(n):void 0,describing:yt}),E==="board"&&Gs&&u.jsx(vE,{node:ws,run:C,onInjectPrompt:f,onClose:()=>Cs(!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 EE="https://tools.sapiom.ai",kE="x-sapiom-api-key",TE="YOUR_SAPIOM_API_KEY";function AE(s){return s==null?"{ /* your input */ }":JSON.stringify(s,null,2).replace(/\n/g,`
434
- `)}function RE(s){return s==null?"{}":JSON.stringify(s)}function ME(s){return s.replace(/'/g,"'\\''")}function DE(s,t){return`import { agents } from "@sapiom/tools";
435
-
436
- const result = await agents.run({
437
- definition: ${JSON.stringify(s)},
438
- input: ${AE(t)},
439
- });
440
-
441
- if (result.status === "completed") {
442
- console.log(result.output);
443
- }
444
- `}function jE(s,t,n){const a=ME(`{ "input": ${RE(t)} }`),l=encodeURIComponent(s);return`curl -X POST ${n}/agents/v1/definitions/${l}/executions \\
445
- -H "${kE}: ${TE}" \\
446
- -H "Content-Type: application/json" \\
447
- -d '${a}'
448
- `}function NE(s){const{definition:t,inputSample:n,baseUrl:a=EE}=s;return{typescript:DE(t,n),curl:jE(t,n,a)}}const LE=new Set(["pending","queued","building"]),OE=new Set(["failed","cancelled","superseded","stale"]);function Da(s,t=null){return s.activeBuildRunStatus==="ready"?"ready":s.activeBuildRunStatus!=null&&LE.has(s.activeBuildRunStatus)?"building":t!=null||s.activeBuildRunStatus!=null&&OE.has(s.activeBuildRunStatus)?"failed":s.definitionId==null?"draft":"linked"}function Rf(s){return(s==null?void 0:s.activeBuildRunStatus)==="ready"}function BE(s,t=null){switch(Da(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 HE="https://app.sapiom.ai/settings?tab=api-keys";function IE({boundWorkflow:s,agentsBaseUrl:t}){return Rf(s)?u.jsx(zE,{boundWorkflow:s,agentsBaseUrl:t}):null}function zE({boundWorkflow:s,agentsBaseUrl:t}){const[n,a]=P.useState("typescript"),[l,d]=P.useState(!1),p=s.definitionSlug==null,c=s.definitionSlug??s.name,{typescript:h,curl:v}=NE({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:()=>a("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:()=>a("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:HE,target:"_blank",rel:"noreferrer",children:"Sapiom dashboard"}),"."]})]})}function $E({boundWorkflow:s,noSessionAgent:t=null,agentsBaseUrl:n,lastDeployError:a=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=Da(s,a),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(de,{name:"CloudOff",size:13}),p]})]}),d?u.jsx("div",{className:"code-panel-body","data-testid":"code-panel-body",children:u.jsx(IE,{boundWorkflow:s,agentsBaseUrl:n},s.path)}):u.jsx(Bi,{className:"code-panel-empty",icon:"Code",title:c,body:h})]})}function G_(s,t){if(!s)return{score:0,indices:[]};const n=s.toLowerCase(),a=t.toLowerCase();let l=0,d=0,p=0;const c=[];for(let h=0;h<n.length;h++){const v=n[h],S=a.indexOf(v,d);if(S===-1)return null;p=S===d?p+1:0,l+=10-Math.min(S-d,8),l+=p*3,S===0&&(l+=5),c.push(S),d=S+1}return{score:l,indices:c}}const PE={command:"LayoutTemplate",session:"Radio",past:"History",workflow:"Workflow",recent:"Folder",path:"Folder"},Fd={command:"Actions",session:"Sessions",past:"Past sessions",workflow:"Agents",recent:"Folders",path:"Folders"},UE=6;function V_(s,t){if(!t||t.length===0)return s;const n=new Set(t),a=[];let l="",d=n.has(0);const p=c=>{l&&(a.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),a}function FE(s,t){const n=G_(s,t.label);if(n)return{item:{...t,labelIndices:n.indices},score:1e3+n.score};const a=G_(s,t.meta);return a?{item:{...t,metaIndices:a.indices},score:a.score}:null}function qE({sessions:s,workflows:t,recentDirs:n,history:a,listDir:l,onSelectSession:d,onReviewSummary:p,onOpenPath:c,onBrowseTemplates:h,onClose:v}){const[S,f]=P.useState(""),[x,E]=P.useState([]),[A,C]=P.useState(!1),[y,b]=P.useState(!1),[m,_]=P.useState(0),k=P.useRef(null);P.useEffect(()=>{var D;(D=k.current)==null||D.focus()},[]);const R=S.startsWith("/")||S.startsWith("~");P.useEffect(()=>{if(!R){E([]),b(!1);return}let D=!1;C(!0),b(!1);const I=setTimeout(()=>{l(S).then(q=>{D||E(q.dirs)}).catch(()=>{D||(E([]),b(!0))}).finally(()=>!D&&C(!1))},150);return()=>{D=!0,clearTimeout(I)}},[S,R,l]);const M=P.useMemo(()=>{if(R){const G=S.trim(),J=G?[{id:`confirm:${G}`,kind:"path",label:G,meta:"Open this path",path:G}]:[],O=x.map(H=>({id:`dir:${H.path}`,kind:"path",label:H.name,meta:H.path,path:H.path}));return[...J,...O]}const D=s.filter(G=>G.status!=="exited").map(G=>({id:`session:${G.id}`,kind:"session",label:G.title,meta:G.cwd,sessionId:G.id})),I=new Set(s.map(G=>G.id)),q=new Set(s.map(G=>G.agentSessionId).filter(G=>G!=null)),W=[...s.filter(G=>G.status==="exited").map(G=>({id:`past:${G.id}`,kind:"past",label:G.title,meta:G.cwd,sessionId:G.id})),...a.filter(G=>!(G.harnessSessionId!=null&&I.has(G.harnessSessionId))&&!q.has(G.agentSessionId)).map(G=>({id:`summary:${G.agentSessionId}`,kind:"past",label:G.title,meta:G.cwd,summary:G}))],U=t.map(G=>({id:`workflow:${G.path}`,kind:"workflow",label:G.name,meta:G.path,path:G.path})),Z=[{id:"command:browse-templates",kind:"command",label:"Browse templates",meta:"Gallery and starters"}],se=new Set(t.map(G=>G.path)),F=n.filter(G=>!se.has(G)).map(G=>({id:`recent:${G}`,kind:"recent",label:G.split("/").filter(Boolean).pop()??G,meta:G,path:G}));return S?[D,W,U,F,Z].flatMap(G=>G.map(J=>FE(S,J)).filter(J=>J!==null).sort((J,O)=>O.score-J.score).map(J=>J.item)).slice(0,20):[...D,...W.slice(0,UE),...U,...F].slice(0,20-Z.length).concat(Z)},[S,R,x,s,t,n,a]);P.useEffect(()=>_(0),[M.length,S]);const j=D=>{D.kind==="command"?h():(D.kind==="session"||D.kind==="past")&&D.sessionId?d(D.sessionId):D.kind==="past"&&D.summary?p(D.summary):D.path&&c(D.path),v()},T=D=>{if(D.key==="ArrowDown")D.preventDefault(),_(I=>Math.min(I+1,M.length-1));else if(D.key==="ArrowUp")D.preventDefault(),_(I=>Math.max(I-1,0));else if(D.key==="Enter"){D.preventDefault();const I=M[m];I&&j(I)}else D.key==="Escape"&&v()};return u.jsx("div",{className:"modal-backdrop",onClick:v,children:u.jsxs("div",{className:"modal command-palette",onClick:D=>D.stopPropagation(),children:[u.jsx("input",{ref:k,className:"command-palette-input","data-testid":"command-palette-input",placeholder:"Jump to a session, agent, or path…",value:S,onChange:D=>f(D.target.value),onKeyDown:T}),u.jsxs("div",{className:"command-palette-list","data-testid":"command-palette-list",children:[R&&A&&u.jsx("div",{className:"command-palette-empty",children:"Loading…"}),R&&y&&!A&&u.jsx("div",{className:"command-palette-error","data-testid":"command-palette-error",role:"alert",children:"Couldn't read that path."}),M.length===0&&!A&&!y&&u.jsx("div",{className:"command-palette-empty",children:"No matches"}),M.map((D,I)=>u.jsxs("div",{className:"command-palette-row",children:[!R&&(I===0||Fd[D.kind]!==Fd[M[I-1].kind])&&u.jsx("div",{className:"command-palette-section","data-testid":"command-palette-section",children:Fd[D.kind]}),u.jsxs("button",{type:"button",className:"command-palette-item"+(I===m?" is-selected":""),"data-testid":`command-palette-item-${I}`,onMouseEnter:()=>_(I),onClick:()=>j(D),children:[u.jsx(de,{name:PE[D.kind],size:14}),u.jsx("span",{className:"command-palette-item-label",children:V_(D.label,D.labelIndices)}),u.jsx("span",{className:"command-palette-item-meta",children:V_(D.meta,D.metaIndices)})]})]},D.id))]})]})})}const WE={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 GE({status:s,onRetry:t,retrying:n=!1,detail:a,onStartAuth:l}){const d=WE[s],[p,c]=P.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(de,{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"&&a&&u.jsx("span",{className:"connectivity-screen-detail","data-testid":"connectivity-screen-detail",children:a}),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(de,{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(de,{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 VE({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(de,{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 YE(s,t,n){const a=new Map;for(const l of t)a.has(l.agentSessionId)||a.set(l.agentSessionId,l);for(const l of s)n.has(l.cwd)||a.has(l.agentSessionId)||a.set(l.agentSessionId,l);return Array.from(a.values()).sort((l,d)=>d.lastActiveAt.localeCompare(l.lastActiveAt))}const KE=12;function Wy(s,t,n){var d;const a=[],l=p=>{p&&!a.includes(p)&&a.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)),a.slice(0,KE)}const vl={"claude-code":"Claude Code",codex:"Codex"};function kp(s,t=Date.now()){const n=t-new Date(s).getTime(),a=Math.floor(n/6e4);if(a<1)return"just now";if(a<60)return`${a}m ago`;const l=Math.floor(a/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 XE(s,t){const n=new Date(t).getTime()-new Date(s).getTime();if(!Number.isFinite(n)||n<=0)return null;const a=Math.floor(n/6e4);if(a<1)return"under a minute";if(a<60)return`${a}m`;const l=Math.floor(a/60);return l<24?`${l}h ${a%60}m`:`${Math.floor(l/24)}d ${l%24}h`}function Y_(s){return s.resumeMode===void 0?"checking":s.resumeMode==="agent-resume"?"resume":(s.turnCount??s.messageCount??0)>0?"from-summary":"empty"}function JE(s){switch(s){case"resume":return null;case"from-summary":return"from summary";case"empty":return"nothing recorded";case"checking":return"checking…"}}function Mf(s,t=Date.now(),n={}){const a=[];n.includeHarness!==!1&&a.push(vl[s.harness]),s.gitBranch&&a.push(s.gitBranch);const l=s.turnCount??s.messageCount;l!=null&&l>0&&a.push(`${l} ${l===1?"turn":"turns"}`);const d=n.state?JE(n.state):null;return d&&a.push(d),a.push(kp(s.lastActiveAt,t)),a.join(" · ")}function Gy(s,t){const[n,a]=P.useState(s===null?{status:"empty"}:{status:"loading"});return P.useEffect(()=>{if(s===null){a({status:"empty"});return}let l=!1;return a({status:"loading"}),t(s).then(d=>{l||a(d?{status:"ready",record:d}:{status:"empty"})},d=>{l||a({status:"error",message:d instanceof Error?d.message:String(d)})}),()=>{l=!0}},[s,t]),n}function Vy({text:s}){const t=s.split(`
449
- `),n=[];let a=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(;a<t.length;){const c=t[a];if(c.startsWith("```")){const f=c.slice(3).trim(),x=[];for(a++;a<t.length&&!t[a].startsWith("```");)x.push(t[a]),a++;a++,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(`
450
- `)})},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())),a++;continue}if(c.startsWith("> ")){n.push(u.jsx("blockquote",{className:"chat-blockquote",children:p(c.slice(2))},d())),a++;continue}if(/^- \[[ x]\]/.test(c)){const f=[];for(;a<t.length&&/^- \[[ x]\]/.test(t[a]);){const x=t[a][3]==="x";f.push({text:t[a].replace(/^- \[[ x]\]\s?/,""),checked:x}),a++}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(;a<t.length&&/^[-*+]\s+/.test(t[a]);){const x=t[a].replace(/^[-*+]\s+/,"");f.push(u.jsx("li",{children:p(x)},d())),a++}n.push(u.jsx("ul",{className:"chat-list",children:f},d()));continue}if(!c.trim()){a++;continue}const v=f=>f.startsWith("```")||/^#{1,3}\s+/.test(f)||f.startsWith("> ")||/^[-*+]\s+/.test(f),S=[c];for(a++;a<t.length&&t[a].trim()&&!v(t[a]);)S.push(t[a]),a++;n.push(u.jsx("p",{className:"chat-paragraph",children:p(S.join(" "))},d()))}return u.jsx(u.Fragment,{children:n})}const K_={"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."},ZE=["assistant-narration-gap","truncated-tool-output","missing-assistant-text","incomplete-final-turn","compacted-archive","dropped-early-turns"];function QE(s){const t=new Set(s),n=ZE.filter(l=>t.has(l)).map(l=>K_[l]),a=[...t].filter(l=>!(l in K_)).map(l=>`Known gap reported by the harness: ${l}.`);return[...n,...a]}function ek(s){if(!s)return null;const t=[];return s.inputTokens!=null&&t.push(`${X_(s.inputTokens)} in`),s.outputTokens!=null&&t.push(`${X_(s.outputTokens)} out`),t.length>0?t.join(" · "):null}function X_(s){if(s<1e3)return String(s);const t=s/1e3;return`${t<100?t.toFixed(1):Math.round(t)}k`}function Yy(s,t=Date.now()){if(!s)return null;const n=new Date(s);if(Number.isNaN(n.getTime()))return null;const a=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()?a:`${n.toLocaleDateString([],{day:"numeric",month:"short"})}, ${a}`}function tk(s,t){const n=s??"unknown tool";if(!t)return n;const a=t.replace(/\s+/g," ").trim();if(!a)return n;const l=a.length>80?`${a.slice(0,80)}…`:a;return`${n} · ${l}`}function sk({record:s}){const t=QE(s.limitations),n=Yy(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(a=>u.jsx("li",{children:a},a))})]})]}),u.jsx("ol",{className:"transcript-turns",children:s.turns.map(a=>u.jsx(ik,{turn:a},a.index))})]})}function ik({turn:s}){const t=ek(s.usage),n=Yy(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((a,l)=>u.jsx(nk,{call:a},`${a.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(Vy,{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 nk({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:tk(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 J_(s){return s.agentSessionId==null?"This session can't be resumed: it exited before establishing a session id.":`${vl[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 rk({session:s,resumeMode:t,loadRecord:n,onResume:a,onContinue:l,onClose:d}){const p=s.agentSessionId!=null&&t!=="rehydrate",c=XE(s.createdAt,s.lastActiveAt),h=Gy(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(de,{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:vl[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:a,disabled:!p,title:p?void 0:J_(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:[J_(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(Ky,{state:h})})]})}function ak({summary:s,loadRecord:t,onStart:n,onClose:a}){const l=s.resumeMode==="agent-resume",d=s.harnessSessionId??s.agentSessionId,p=Gy(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:[Mf(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:a,children:"Close"})]})]}),!l&&u.jsxs("div",{className:"dead-session-resume-reason","data-testid":"past-session-reason",children:[vl[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(Ky,{state:p})})]})}function Ky({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(de,{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(sk,{record:s.record})}function ok({onCancel:s,onConfirm:t,triggerRef:n}){const a=P.useRef(null);return pl(!0,{onDismiss:s,containerRef:a,triggerRef:n}),u.jsx("div",{className:"modal-backdrop",onClick:s,children:u.jsxs("div",{ref:a,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(de,{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 lk(s){return s.split("/").filter(Boolean).pop()??s}function ck({overviewMode:s=!1,openedAgentName:t=null,reviewTitle:n=null,composing:a=!1,onBack:l=null,activeSession:d,sessionName:p,onRenameSession:c,boundWorkflowName:h,busy:v,onExpandRail:S,onExpandRight:f,onCloseSession:x,onOpenInEditor:E,onToast:A,actions:C=null,onNewSession:y=null,sessions:b=[],onSelectSession:m=null,labelOf:_}){const[k,R]=P.useState(!1),[M,j]=P.useState(!1),[T,D]=P.useState(!1),[I,q]=P.useState(""),W=P.useRef(null),U=()=>j(!1),Z=()=>{d&&c(d.id,I),D(!1)},se=d?b.filter(G=>G.id!==d.id):[],F=d?[d,...se]:[];return u.jsxs("div",{className:"session-bar",children:[S&&u.jsx("button",{className:"theme-toggle","data-testid":"rail-expand","aria-label":"Expand workspace panel",title:"Expand workspace panel",onClick:S,children:u.jsx(de,{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(de,{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(de,{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"]})]}):a?l?u.jsxs("button",{type:"button",className:"session-current session-back","data-testid":"composer-back",onClick:l,children:[u.jsx(de,{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:[T?u.jsx("input",{className:"group-name-input session-rename-input session-context-rename","data-testid":"session-rename-input",value:I,autoFocus:!0,onFocus:G=>G.currentTarget.select(),onChange:G=>q(G.target.value),onKeyDown:G=>{G.key==="Enter"&&Z(),G.key==="Escape"&&D(!1)},onBlur:Z}):u.jsxs("button",{ref:W,className:"session-current session-title-trigger","data-testid":"session-menu","aria-haspopup":"menu","aria-expanded":M,"data-tooltip":`${vl[d.harness]} · ${lk(d.cwd)} · ${d.cwd}`,onClick:()=>j(G=>!G),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:_?_(d):p??d.title}),u.jsx(de,{name:"ChevronDown",size:13})]}),u.jsxs(Zn,{open:M,anchorRef:W,onDismiss:U,placement:"down-start",className:"session-menu",role:"menu",testid:"session-menu-popover",children:[u.jsx("div",{className:"session-menu-section",children:"Sessions"}),F.map(G=>{const J=G.id===d.id;return u.jsxs("button",{role:"menuitemradio","aria-checked":J,className:"profile-menu-item session-switch-item"+(J?" is-selected":""),"data-testid":`session-switch-${G.id}`,onClick:()=>{J||m==null||m(G.id),U()},children:[u.jsx("span",{className:"session-dot","data-status":G.status}),u.jsx("span",{className:"session-switch-label",children:_?_(G):G.title}),u.jsx("span",{className:"session-switch-meta",children:kp(G.lastActiveAt)}),J&&u.jsx(de,{name:"Check",size:13})]},G.id)}),y&&u.jsxs("button",{role:"menuitem",className:"profile-menu-item session-menu-new","data-testid":"session-new-menu",onClick:()=>{y(),U()},children:[u.jsx(de,{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 G;(G=navigator.clipboard)==null||G.writeText(d.cwd).then(()=>A("Path copied.")).catch(()=>A("Couldn't copy the path.")),U()},children:[u.jsx(de,{name:"Copy",size:13}),"Copy path"]}),u.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"session-rename",onClick:()=>{q(p??d.title),D(!0),U()},children:[u.jsx(de,{name:"Pencil",size:13}),"Rename session"]}),u.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"session-open-editor",onClick:()=>{E(d.cwd),U()},children:[u.jsx(de,{name:"Code",size:13}),"Open in editor"]}),d.status!=="exited"&&u.jsxs("button",{role:"menuitem",className:"profile-menu-item session-menu-danger","data-testid":"session-end-btn",onClick:()=>{U(),R(!0)},children:[u.jsx(de,{name:"X",size:13}),"End session…"]})]})]})}):u.jsx("span",{className:"session-context-none",children:"No active session"})}),y&&d&&!a&&u.jsx("button",{className:"session-new","data-testid":"session-new","aria-label":"New session","data-tooltip":"New session",onClick:y,children:u.jsx(de,{name:"Plus",size:15})}),C,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(de,{name:"PanelRightOpen",size:15})}),k&&d&&u.jsx(ok,{triggerRef:W,onCancel:()=>R(!1),onConfirm:()=>{R(!1),x(d.id)}})]})}const Z_={deploy:"deploy",prod_run:"prod-run",run_local:"run-local"};function Xy(s){return Object.prototype.hasOwnProperty.call(Z_,s)?Z_[s]:null}function uk(s){return Xy(s.id)===null&&s.action.kind==="inject"}function hk(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 dk(s,t){return s.replace("{{workflow.definitionId}}",String((t==null?void 0:t.definitionId)??""))}function Xc(s,t,n){const a={event:s,...t?{data:t}:{}};fetch("/api/track",{method:"POST",headers:{"Content-Type":"application/json","X-Harness-Token":ka()},body:JSON.stringify(a),keepalive:!0}).catch(()=>{})}function fk({workflow:s,activeSessionId:t,sessionReady:n,macros:a,onRunMacro:l,preview:d,lastDeployError:p,authenticated:c,directActionSettleSeq:h,runningTarget:v}){const S=b=>a.find(m=>m.id===b),f=Da(s,p),x=f==="ready",E=s.definitionId!=null?Eu(s.definitionId):Hy,[A,C]=P.useState(null);P.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(de,{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(de,{name:"Globe",size:14})}),y.map(b=>{const m=b.needsAuth&&!c?"Connect your account first":null,_=b.needsDeploy?BE(s,p):null,k=!n&&b.macro&&uk(b.macro)?"Session is starting":null,R=m??_??k??(b.macro?hk(b.macro,s,t):null),M=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":A===b.id||void 0,"data-running":M||void 0,disabled:!!R,"data-tooltip":R?`${b.label}: ${R}`:b.hint,"aria-label":R?`${b.label}: ${R}`:b.label,onClick:()=>{b.macro&&(l(b.macro),C(b.id),Xc("macro.invoked",{macroId:b.macro.id}))},children:[u.jsx(de,{name:b.icon,size:14}),u.jsx("span",{className:"session-step-label",children:b.label})]},b.id)})]})}function pk({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 vk=/^[a-z0-9][a-z0-9-]{0,213}$/,Tp="sapiom-agent",gk=3,Q_=32,mk=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 Jy(s){return vk.test(s)}function _k(s){var p;const t=s.toLowerCase().replace(/[^a-z0-9]+/g," ").split(" ").filter(Boolean),n=t.filter(c=>!mk.has(c)),a=n.length>0?n:t,l=[];for(const c of a.slice(0,gk)){if((l.length===0?c:`${l.join("-")}-${c}`).length>Q_)break;l.push(c)}const d=l.join("-")||((p=a[0])==null?void 0:p.slice(0,Q_))||"";return Jy(d)?d:Tp}function Zy(s,t){const n=(t==null?void 0:t.trim().replace(/\/+$/,""))??"",a=s.trim();return!n||!a?"":`${n}/${a}`}function yk(s){var t,n,a;return((t=s.settingsRoot)==null?void 0:t.trim())||((n=s.defaultProjectRoot)==null?void 0:n.trim())||((a=s.launchDir)==null?void 0:a.trim())||""}function bk(s){const t=s.replace(/\/+$/,""),n=t.lastIndexOf("/");if(n<0)return null;const a=t.slice(0,n);return a===t?null:a||"/"}function Sk(s,t){const n=new Set(t);if(!n.has(s))return s;for(let a=2;a<1e3;a+=1){const l=`${s}-${a}`;if(!n.has(l)&&Jy(l))return l}return s}const e0=[{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."}],wk={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 xk(s){return s?wk[s]??s.replace(/-/g," ").replace(/^./,t=>t.toUpperCase()):"Uncategorised"}function Ap(s){return s!=null&&s.label?s.score>0?`${s.label} ${s.score}/5`:s.label:"—"}function Qy(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 a=t.llmSteps===0&&t.mediaCapabilities===0?" · deterministic":"";return`${n.join(", ")}${a}`}function Ck(s){return`${s.label}: ${Qy(s)}`}function t0(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 Ek(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: ${Df(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 kk(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 Df(s,t){return"call the sapiom_dev_agents_scaffold tool with "+JSON.stringify({dir:s,template:t})}function Tk(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 a=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:a,groups:[],warnings:[]}}function Ak(s,t){const n=s.kind==="starter"&&s.id==="default"?Tp:s.id;return Zy(n,t)}const Ta="(none)",s0={query:"",category:null,cadence:null};function Rk(s){return s.query.trim()!==""||s.category!==null||s.cadence!==null}const Mk={"on-demand":"On demand",scheduled:"Scheduled","on-event":"On event","on-webhook":"Webhook"};function e1(s){return s?Mk[s]??s.replace(/-/g," ").replace(/^./,t=>t.toUpperCase()):"No trigger declared"}function t1(s,t,n){const a=new Map;for(const l of s){const d=t(l)??Ta;a.set(d,(a.get(d)??0)+1)}return[...a.entries()].map(([l,d])=>({value:l,label:n(l),count:d})).sort((l,d)=>l.value===Ta?1:d.value===Ta?-1:d.count-l.count||l.label.localeCompare(d.label))}function Dk(s){return t1(s,t=>t.category,t=>t===Ta?"Uncategorised":xk(t))}function jk(s){return t1(s,t=>t.cadence,t=>t===Ta?"No trigger declared":e1(t))}function i0(s,t){return t===null?!0:t===Ta?s===null:s===t}function Nk(s,t,n){return s.filter(a=>n(a,t.query)&&i0(a.category,t.category)&&i0(a.cadence,t.cadence))}function Pc({children:s,variant:t="tag",title:n}){return u.jsx("span",{className:t==="count"?"pill pill--count":"pill",title:n,children:s})}const n0=3;function Lk({template:s,onPreview:t,onUse:n}){const[a,l]=P.useState(!1),d=P.useRef(null),p=[{term:"Steps",value:String(s.stepCount)},{term:"Trigger",value:s.cadence?e1(s.cadence):"Not declared"},{term:"Complexity",value:Ap(s.complexity),...s.complexity?{title:Ck(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":a,onClick:()=>l(c=>!c),children:u.jsx(de,{name:"Info",size:14})}),u.jsxs(Zn,{open:a,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 r0({template:s,onOpen:t,onUse:n}){const a=s.kind==="gallery"?s.tags.slice(0,n0):[],l=s.kind==="gallery"?s.tags.length-a.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(Lk,{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(Pc,{children:"bundled"})}):a.length>0&&u.jsxs("div",{className:"template-card-tags",children:[a.map(d=>u.jsx(Pc,{children:d},d)),l>0&&u.jsxs(Pc,{variant:"count",title:s.tags.slice(n0).join(", "),children:["+",l]})]})]})}function Ok({detail:s}){const t=Tk(s);return u.jsx("div",{className:"template-graph","data-testid":"template-graph",children:t.nodes.map(n=>{const a=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))]}),a.map(l=>u.jsxs("div",{className:"canvas-step-transition template-graph-edge",children:[u.jsx(de,{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 Bk({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 Hk({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(Ok,{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(a=>u.jsx("code",{className:"template-cap",children:a},a))]},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:Ap(s.complexity)})," —"," ",Qy(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(Bk,{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(Vy,{text:s.notes})})]})]})}function Ik({template:s,getTemplate:t}){const[n,a]=P.useState(null),[l,d]=P.useState(null);return P.useEffect(()=>{if(s.kind!=="gallery"){a(null),d(null);return}let p=!1;return a(null),d(null),t(s.id).then(c=>{p||a(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(Hk,{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 a0({title:s,allLabel:t,allCount:n,options:a,value:l,onSelect:d,testIdPrefix:p}){if(a.length<2)return null;const c=[{value:"",label:t,count:n,testId:`${p}-all`,selects:null},...a.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(Pc,{variant:"count",children:h.count})]},h.testId)})})]})}function zk({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(de,{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:a=>n({...t,query:a.target.value})})]}),u.jsx(a0,{title:"Category",allLabel:"All templates",allCount:s.length,options:Dk(s),value:t.category,onSelect:a=>n({...t,category:a}),testIdPrefix:"templates-category"}),u.jsx(a0,{title:"Trigger",allLabel:"Any trigger",allCount:s.length,options:jk(s),value:t.cadence,onSelect:a=>n({...t,cadence:a}),testIdPrefix:"templates-cadence"})]})}function $k(){return typeof window>"u"?void 0:window}function Jc(s=$k()){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}}function Pk(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 Uk(s){const t=s.split("/").filter(Boolean);return t.length<=2?s:`/${t[0]}/…/${t[t.length-1]}`}function s1({value:s,onChange:t,onSubmit:n,recentDirs:a,listDir:l,onNewDirChange:d,onResolve:p}){var L;const[c,h]=P.useState(s),[v,S]=P.useState([]),[f,x]=P.useState(s),[E,A]=P.useState(!1),[C,y]=P.useState(null),[b,m]=P.useState(0),[_,k]=P.useState(!0),[R,M]=P.useState(!1),[j,T]=P.useState(0),D=P.useRef(null),[I,q]=P.useState("none"),W=()=>{const B=D.current;if(!B)return;const V=B.scrollLeft>2,Q=B.scrollLeft+B.clientWidth<B.scrollWidth-2;q(V&&Q?"both":V?"left":Q?"right":"none")};P.useEffect(()=>{W()},[a]),P.useEffect(()=>{let B=!1;A(!0),y(null),M(!1);const V=ue=>{const fe=ue.replace(/\/+$/,""),Y=fe.slice(0,fe.lastIndexOf("/"));return!fe.includes("/")||Y===fe?null:Y||"/"},Q=setTimeout(()=>{l(s||void 0).then(ue=>{B||(h(ue.path),S(ue.dirs),x(ue.parent))}).catch(async()=>{const ue=V(s);if(!ue||B){B||y("Couldn't read that directory.");return}try{const fe=await l(ue);if(B)return;h(fe.path),S(fe.dirs),x(fe.parent),M(!0)}catch{B||y("Couldn't read that directory.")}}).finally(()=>!B&&A(!1))},150);return()=>{B=!0,clearTimeout(Q)}},[s,j]);const U=s.startsWith(c)?s.slice(c.length).replace(/^\//,""):"",Z=U?v.filter(B=>B.name.toLowerCase().startsWith(U.toLowerCase())):v,se=Math.min(b,Math.max(Z.length-1,0)),F=!E&&!C&&Z.length===0&&(R||U!=="");P.useEffect(()=>{d==null||d(F)},[F]),P.useEffect(()=>{E||C||p==null||p({resolvedPath:c,dirs:v,parent:f,isNew:F})},[c,v,f,F,E,C]);const G=B=>t(B),J=((L=Jc())==null?void 0:L.chooseDirectory)??null,O=()=>{if(J){J(s||c||void 0).then(B=>{B&&t(B)}).catch(()=>{});return}if(!_){k(!0);return}F&&c&&c!==s?G(c):k(!1)},H=B=>{var Q;const V=_&&Z.length>0;B.key==="ArrowDown"&&V?(B.preventDefault(),m(Math.min(se+1,Z.length-1))):B.key==="ArrowUp"&&V?(B.preventDefault(),m(Math.max(se-1,0))):B.key==="Enter"&&(V?(G(((Q=Z[se])==null?void 0:Q.path)??Z[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:()=>G(f),"aria-label":"Up to parent directory","data-tooltip":"Up to parent directory",children:u.jsx(de,{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:B=>t(B.target.value),onKeyDown:H}),u.jsx("button",{type:"button",className:"dir-picker-up dir-picker-browse"+(!J&&_?" is-active":""),"data-testid":"dir-picker-browse","aria-pressed":J?void 0:_,onClick:O,"aria-label":J?"Choose a folder":"Browse subdirectories","data-tooltip":J?"Choose a folder…":_?F?"Browse the nearest existing folder":"Hide the directory listing":"Browse subdirectories",children:u.jsx(de,{name:"Folder",size:14})})]}),a.length>0&&u.jsx("div",{className:"recent-dirs",ref:D,"data-fade":I,onScroll:W,children:a.map(B=>u.jsx("button",{type:"button",className:"recent-dir-chip",title:B,onClick:()=>G(B),children:Uk(B)},B))}),_&&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(de,{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:()=>T(B=>B+1),children:"Retry"})]}),F&&u.jsx("div",{className:"dir-picker-newdir","data-testid":"dir-picker-newdir",children:"New folder. It will be created when you start."}),!E&&!C&&!F&&Z.length===0&&u.jsx("div",{className:"dir-picker-empty",children:"No subdirectories"}),!E&&!C&&Z.map((B,V)=>u.jsxs("button",{type:"button",className:"dir-picker-item"+(V===se?" is-selected":""),"data-testid":`dir-picker-item-${B.name}`,onMouseEnter:()=>m(V),onClick:()=>G(B.path),children:[u.jsx(de,{name:"Folder",size:13}),u.jsx("span",{className:"dir-picker-item-name",children:B.name}),B.hasAgentProject&&u.jsxs("span",{className:"dir-picker-item-badge","data-testid":`dir-picker-badge-${B.name}`,title:"Contains sapiom.json",children:[u.jsx(de,{name:"Check",size:11}),"Agent"]})]},B.path))]})]})}function Fk({template:s,initialDest:t,recentDirs:n,listDir:a,onCancel:l,onConfirm:d,triggerRef:p}){const[c,h]=P.useState(t),[v,S]=P.useState(!1),[f,x]=P.useState(null),E=P.useRef(null);pl(!v,{onDismiss:l,containerRef:E,triggerRef:p});const A=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(de,{name:"X",size:14})})]}),u.jsxs("div",{className:"modal-body",children:[u.jsx(s1,{value:c,onChange:h,onSubmit:()=>void A(),recentDirs:n,listDir:a}),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 A(),children:v?"Starting…":"Start session"})]})]})})}function qk({projectRoot:s,recentDirs:t,listDir:n,onExit:a,onUse:l,listTemplates:d,getTemplate:p,openTemplateId:c}){const[h,v]=P.useState(null),[S,f]=P.useState(null),[x,E]=P.useState(s0),[A,C]=P.useState(null),[y,b]=P.useState(null),m=P.useRef(null);P.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 _=P.useMemo(()=>((h==null?void 0:h.templates)??[]).map(D=>({...D,kind:"gallery"})),[h]),k=P.useMemo(()=>Nk(_,x,t0),[_,x]),R=P.useMemo(()=>x.category!==null||x.cadence!==null?[]:e0.filter(D=>t0(D,x.query)),[x]),M=P.useRef(null);P.useEffect(()=>{if(!c||M.current===c)return;const D=_.find(I=>I.id===c)??e0.find(I=>I.id===c);D&&(M.current=c,C(D))},[c,_]);const j=h===null&&S===null,T=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":A?"template-detail-back":"templates-exit","aria-label":A?"Back to all templates":"Back to the session",title:A?"All templates":"Back to the session",onClick:()=>A?C(null):a(),children:u.jsx(de,{name:"ArrowLeft",size:14})}),u.jsx("span",{className:"templates-bar-title",children:A?A.name:"Templates"}),A&&u.jsx("button",{ref:m,type:"button",className:"btn-primary templates-bar-use","data-testid":"template-use-btn",onClick:()=>b(A),children:"Use template"})]}),u.jsx("div",{className:"templates-scroll",children:u.jsx("div",{className:"templates-measure",children:A?u.jsx(Ik,{template:A,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…":`${_.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.`})]}),T&&u.jsxs("div",{className:"templates-degraded","data-testid":"templates-degraded",role:"status",children:[u.jsx(de,{name:"TriangleAlert",size:14}),u.jsx("span",{children:T})]}),u.jsxs("div",{className:"templates-layout",children:[u.jsx(zk,{catalog:_,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(r0,{template:D,onOpen:C,onUse:b},D.id))}),k.length===0&&!j&&_.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 ${_.length}.`,cta:Rk(x)?u.jsx("button",{type:"button",className:"btn-line","data-testid":"templates-empty-clear",onClick:()=>E(s0),children:"Clear filters"}):void 0}),R.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:R.map(D=>u.jsx(r0,{template:D,onOpen:C,onUse:b},D.id))})]})]})]})]})})}),y&&u.jsx(Fk,{template:y,initialDest:Ak(y,s),recentDirs:t,listDir:n,onCancel:()=>b(null),triggerRef:m,onConfirm:async D=>{await l(D,y),a()}})]})}var qd={exports:{}},o0;function Wk(){return o0||(o0=1,(function(s,t){(function(n,a){s.exports=a()})(globalThis,(()=>(()=>{var n={4567:function(p,c,h){var v=this&&this.__decorate||function(m,_,k,R){var M,j=arguments.length,T=j<3?_:R===null?R=Object.getOwnPropertyDescriptor(_,k):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(m,_,k,R);else for(var D=m.length-1;D>=0;D--)(M=m[D])&&(T=(j<3?M(T):j>3?M(_,k,T):M(_,k))||T);return j>3&&T&&Object.defineProperty(_,k,T),T},S=this&&this.__param||function(m,_){return function(k,R){_(k,R,m)}};Object.defineProperty(c,"__esModule",{value:!0}),c.AccessibilityManager=void 0;const f=h(9042),x=h(9924),E=h(844),A=h(4725),C=h(2585),y=h(3656);let b=c.AccessibilityManager=class extends E.Disposable{constructor(m,_,k,R){super(),this._terminal=m,this._coreBrowserService=k,this._renderService=R,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 M=0;M<this._terminal.rows;M++)this._rowElements[M]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[M]);if(this._topBoundaryFocusListener=M=>this._handleBoundaryFocus(M,0),this._bottomBoundaryFocusListener=M=>this._handleBoundaryFocus(M,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((M=>this._handleResize(M.rows)))),this.register(this._terminal.onRender((M=>this._refreshRows(M.start,M.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((M=>this._handleChar(M)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
451
- `)))),this.register(this._terminal.onA11yTab((M=>this._handleTab(M)))),this.register(this._terminal.onKey((M=>this._handleKey(M.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 _=0;_<m;_++)this._handleChar(" ")}_handleChar(m){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==m&&(this._charsToAnnounce+=m):this._charsToAnnounce+=m,m===`
452
- `&&(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,_){this._liveRegionDebouncer.refresh(m,_,this._terminal.rows)}_renderRows(m,_){const k=this._terminal.buffer,R=k.lines.length.toString();for(let M=m;M<=_;M++){const j=k.lines.get(k.ydisp+M),T=[],D=(j==null?void 0:j.translateToString(!0,void 0,void 0,T))||"",I=(k.ydisp+M+1).toString(),q=this._rowElements[M];q&&(D.length===0?(q.innerText=" ",this._rowColumns.set(q,[0,1])):(q.textContent=D,this._rowColumns.set(q,T)),q.setAttribute("aria-posinset",I),q.setAttribute("aria-setsize",R))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(m,_){const k=m.target,R=this._rowElements[_===0?1:this._rowElements.length-2];if(k.getAttribute("aria-posinset")===(_===0?"1":`${this._terminal.buffer.lines.length}`)||m.relatedTarget!==R)return;let M,j;if(_===0?(M=k,j=this._rowElements.pop(),this._rowContainer.removeChild(j)):(M=this._rowElements.shift(),j=k,this._rowContainer.removeChild(M)),M.removeEventListener("focus",this._topBoundaryFocusListener),j.removeEventListener("focus",this._bottomBoundaryFocusListener),_===0){const T=this._createAccessibilityTreeNode();this._rowElements.unshift(T),this._rowContainer.insertAdjacentElement("afterbegin",T)}else{const T=this._createAccessibilityTreeNode();this._rowElements.push(T),this._rowContainer.appendChild(T)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(_===0?-1:1),this._rowElements[_===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 _={node:m.anchorNode,offset:m.anchorOffset},k={node:m.focusNode,offset:m.focusOffset};if((_.node.compareDocumentPosition(k.node)&Node.DOCUMENT_POSITION_PRECEDING||_.node===k.node&&_.offset>k.offset)&&([_,k]=[k,_]),_.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(_={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(_.node))return;const R=this._rowElements.slice(-1)[0];if(k.node.compareDocumentPosition(R)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(k={node:R,offset:((D=R.textContent)==null?void 0:D.length)??0}),!this._rowContainer.contains(k.node))return;const M=({node:I,offset:q})=>{const W=I instanceof Text?I.parentNode:I;let U=parseInt(W==null?void 0:W.getAttribute("aria-posinset"),10)-1;if(isNaN(U))return console.warn("row is invalid. Race condition?"),null;const Z=this._rowColumns.get(W);if(!Z)return console.warn("columns is null. Race condition?"),null;let se=q<Z.length?Z[q]:Z.slice(-1)[0]+1;return se>=this._terminal.cols&&(++U,se=0),{row:U,column:se}},j=M(_),T=M(k);if(j&&T){if(j.row>T.row||j.row===T.row&&j.column>=T.column)throw new Error("invalid range");this._terminal.select(j.column,j.row,(T.row-j.row)*this._terminal.cols-j.column+T.column)}}_handleResize(m){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let _=this._rowContainer.children.length;_<this._terminal.rows;_++)this._rowElements[_]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[_]);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,A.ICoreBrowserService),S(3,A.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,A,C){x=v(x=h(x),A.decPrivateModes.bracketedPasteMode&&C.rawOptions.ignoreBracketedPasteMode!==!0),A.triggerDataEvent(x,!0),E.value=""}function f(x,E,A){const C=A.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,A,C){x.stopPropagation(),x.clipboardData&&S(x.clipboardData.getData("text/plain"),E,A,C)},c.paste=S,c.moveTextAreaUnderMouseCursor=f,c.rightClickHandler=function(x,E,A,C,y){f(x,E,A),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,_,k){var R,M=arguments.length,j=M<3?m:k===null?k=Object.getOwnPropertyDescriptor(m,_):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(b,m,_,k);else for(var T=b.length-1;T>=0;T--)(R=b[T])&&(j=(M<3?R(j):M>3?R(m,_,j):R(m,_))||j);return M>3&&j&&Object.defineProperty(m,_,j),j},S=this&&this.__param||function(b,m){return function(_,k){m(_,k,b)}};Object.defineProperty(c,"__esModule",{value:!0}),c.Linkifier=void 0;const f=h(3656),x=h(8460),E=h(844),A=h(2585),C=h(4725);let y=c.Linkifier=class extends E.Disposable{get currentLink(){return this._currentLink}constructor(b,m,_,k,R){super(),this._element=b,this._mouseService=m,this._renderService=_,this._bufferService=k,this._linkProviderService=R,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 M;this._lastMouseEvent=void 0,(M=this._activeProviderReplies)==null||M.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 _=b.composedPath();for(let k=0;k<_.length;k++){const R=_[k];if(R.classList.contains("xterm"))break;if(R.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,R;this._activeProviderReplies&&m||((k=this._activeProviderReplies)==null||k.forEach((M=>{M==null||M.forEach((j=>{j.link.dispose&&j.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=b.y);let _=!1;for(const[M,j]of this._linkProviderService.linkProviders.entries())m?(R=this._activeProviderReplies)!=null&&R.get(M)&&(_=this._checkLinkProviderResult(M,b,_)):j.provideLinks(b.y,(T=>{var I,q;if(this._isMouseOut)return;const D=T==null?void 0:T.map((W=>({link:W})));(I=this._activeProviderReplies)==null||I.set(M,D),_=this._checkLinkProviderResult(M,b,_),((q=this._activeProviderReplies)==null?void 0:q.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(b.y,this._activeProviderReplies)}))}_removeIntersectingLinks(b,m){const _=new Set;for(let k=0;k<m.size;k++){const R=m.get(k);if(R)for(let M=0;M<R.length;M++){const j=R[M],T=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=T;I<=D;I++){if(_.has(I)){R.splice(M--,1);break}_.add(I)}}}}_checkLinkProviderResult(b,m,_){var M;if(!this._activeProviderReplies)return _;const k=this._activeProviderReplies.get(b);let R=!1;for(let j=0;j<b;j++)this._activeProviderReplies.has(j)&&!this._activeProviderReplies.get(j)||(R=!0);if(!R&&k){const j=k.find((T=>this._linkAtPosition(T.link,m)));j&&(_=!0,this._handleNewLink(j))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!_)for(let j=0;j<this._activeProviderReplies.size;j++){const T=(M=this._activeProviderReplies.get(j))==null?void 0:M.find((D=>this._linkAtPosition(D.link,m)));if(T){_=!0,this._handleNewLink(T);break}}return _}_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 _,k;return(k=(_=this._currentLink)==null?void 0:_.state)==null?void 0:k.decorations.pointerCursor},set:_=>{var k;(k=this._currentLink)!=null&&k.state&&this._currentLink.state.decorations.pointerCursor!==_&&(this._currentLink.state.decorations.pointerCursor=_,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",_))}},underline:{get:()=>{var _,k;return(k=(_=this._currentLink)==null?void 0:_.state)==null?void 0:k.decorations.underline},set:_=>{var k,R,M;(k=this._currentLink)!=null&&k.state&&((M=(R=this._currentLink)==null?void 0:R.state)==null?void 0:M.decorations.underline)!==_&&(this._currentLink.state.decorations.underline=_,this._currentLink.state.isHovered&&this._fireUnderlineEvent(b.link,_))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((_=>{if(!this._currentLink)return;const k=_.start===0?0:_.start+1+this._bufferService.buffer.ydisp,R=this._bufferService.buffer.ydisp+1+_.end;if(this._currentLink.link.range.start.y>=k&&this._currentLink.link.range.end.y<=R&&(this._clearCurrentLink(k,R),this._lastMouseEvent)){const M=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);M&&this._askForLink(M,!1)}}))))}_linkHover(b,m,_){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(_,m.text)}_fireUnderlineEvent(b,m){const _=b.range,k=this._bufferService.buffer.ydisp,R=this._createLinkUnderlineEvent(_.start.x-1,_.start.y-k-1,_.end.x,_.end.y-k-1,void 0);(m?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(R)}_linkLeave(b,m,_){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(_,m.text)}_linkAtPosition(b,m){const _=b.range.start.y*this._bufferService.cols+b.range.start.x,k=b.range.end.y*this._bufferService.cols+b.range.end.x,R=m.y*this._bufferService.cols+m.x;return _<=R&&R<=k}_positionFromMouseEvent(b,m,_){const k=_.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,_,k,R){return{x1:b,y1:m,x2:_,y2:k,cols:this._bufferService.cols,fg:R}}};c.Linkifier=y=v([S(1,C.IMouseService),S(2,C.IRenderService),S(3,A.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 _,k=arguments.length,R=k<3?y:m===null?m=Object.getOwnPropertyDescriptor(y,b):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(C,y,b,m);else for(var M=C.length-1;M>=0;M--)(_=C[M])&&(R=(k<3?_(R):k>3?_(y,b,R):_(y,b))||R);return k>3&&R&&Object.defineProperty(y,b,R),R},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=[],_=this._optionsService.rawOptions.linkHandler,k=new f.CellData,R=b.getTrimmedLength();let M=-1,j=-1,T=!1;for(let I=0;I<R;I++)if(j!==-1||b.hasContent(I)){if(b.loadCell(I,k),k.hasExtendedAttrs()&&k.extended.urlId){if(j===-1){j=I,M=k.extended.urlId;continue}T=k.extended.urlId!==M}else j!==-1&&(T=!0);if(T||j!==-1&&I===R-1){const q=(D=this._oscLinkService.getLinkData(M))==null?void 0:D.uri;if(q){const W={start:{x:j+1,y:C},end:{x:I+(T||I!==R-1?0:1),y:C}};let U=!1;if(!(_!=null&&_.allowNonHttpProtocols))try{const Z=new URL(q);["http:","https:"].includes(Z.protocol)||(U=!0)}catch{U=!0}U||m.push({text:q,range:W,activate:(Z,se)=>_?_.activate(Z,se,W):A(0,se),hover:(Z,se)=>{var F;return(F=_==null?void 0:_.hover)==null?void 0:F.call(_,Z,se,W)},leave:(Z,se)=>{var F;return(F=_==null?void 0:_.leave)==null?void 0:F.call(_,Z,se,W)}})}T=!1,k.hasExtendedAttrs()&&k.extended.urlId?(j=I,M=k.extended.urlId):(j=-1,M=-1)}}y(m)}};function A(C,y){if(confirm(`Do you want to navigate to ${y}?
453
-
454
- 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),A=h(1680),C=h(3107),y=h(5744),b=h(2950),m=h(1296),_=h(428),k=h(4269),R=h(5114),M=h(8934),j=h(3230),T=h(9312),D=h(4725),I=h(6731),q=h(8055),W=h(8969),U=h(8460),Z=h(844),se=h(6114),F=h(8437),G=h(2584),J=h(7399),O=h(5941),H=h(9074),L=h(2585),B=h(5435),V=h(4567),Q=h(779);class ue extends W.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 Z.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(H.DecorationService),this._instantiationService.setService(L.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(Q.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(((z,oe)=>this.refresh(z,oe)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((z=>this._reportWindowsOptions(z)))),this.register(this._inputHandler.onColor((z=>this._handleColorEvent(z)))),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((z=>this._afterResize(z.cols,z.rows)))),this.register((0,Z.toDisposable)((()=>{var z,oe;this._customKeyEventHandler=void 0,(oe=(z=this.element)==null?void 0:z.parentNode)==null||oe.removeChild(this.element)})))}_handleColorEvent(Y){if(this._themeService)for(const z of Y){let oe,ae="";switch(z.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;"+z.index}switch(z.type){case 0:const we=q.color.toColorRGB(oe==="ansi"?this._themeService.colors.ansi[z.index]:this._themeService.colors[oe]);this.coreService.triggerDataEvent(`${G.C0.ESC}]${ae};${(0,O.toRgbString)(we)}${G.C1_ESCAPED.ST}`);break;case 1:if(oe==="ansi")this._themeService.modifyColors((Ee=>Ee.ansi[z.index]=q.channels.toColor(...z.color)));else{const Ee=oe;this._themeService.modifyColors((Ue=>Ue[Ee]=q.channels.toColor(...z.color)))}break;case 2:this._themeService.restoreColor(z.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(V.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(Y){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(G.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(G.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,z=this.buffer.lines.get(Y);if(!z)return;const oe=Math.min(this.buffer.x,this.cols-1),ae=this._renderService.dimensions.css.cell.height,we=z.getWidth(oe),Ee=this._renderService.dimensions.css.cell.width*we,Ue=this.buffer.y*this._renderService.dimensions.css.cell.height,$e=oe*this._renderService.dimensions.css.cell.width;this.textarea.style.left=$e+"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",(z=>{this.hasSelection()&&(0,v.copyHandler)(z,this._selectionService)})));const Y=z=>(0,v.handlePasteEvent)(z,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",(z=>{z.button===2&&(0,v.rightClickHandler)(z,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,S.addDisposableDomListener)(this.element,"contextmenu",(z=>{(0,v.rightClickHandler)(z,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),se.isLinux&&this.register((0,S.addDisposableDomListener)(this.element,"auxclick",(z=>{z.button===1&&(0,v.moveTextAreaUnderMouseCursor)(z,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 z=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),z.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),z.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(R.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(_.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(M.MouseService),this._instantiationService.setService(D.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(f.Linkifier,this.screenElement)),this.element.appendChild(z);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(A.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(T.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(V.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,z=this.element;function oe(Ee){const Ue=Y._mouseService.getMouseReportCoords(Ee,Y.screenElement);if(!Ue)return!1;let $e,We;switch(Ee.overrideType||Ee.type){case"mousemove":We=32,Ee.buttons===void 0?($e=3,Ee.button!==void 0&&($e=Ee.button<3?Ee.button:3)):$e=1&Ee.buttons?0:4&Ee.buttons?1:2&Ee.buttons?2:3;break;case"mouseup":We=0,$e=Ee.button<3?Ee.button:3;break;case"mousedown":We=1,$e=Ee.button<3?Ee.button:3;break;case"wheel":if(Y._customWheelEventHandler&&Y._customWheelEventHandler(Ee)===!1||Y.viewport.getLinesScrolled(Ee)===0)return!1;We=Ee.deltaY<0?0:1,$e=4;break;default:return!1}return!(We===void 0||$e===void 0||$e>4)&&Y.coreMouseService.triggerMouseEvent({col:Ue.col,row:Ue.row,x:Ue.x,y:Ue.y,button:$e,action:We,ctrl:Ee.ctrlKey,alt:Ee.altKey,shift:Ee.shiftKey})}const ae={mouseup:null,wheel:null,mousedrag:null,mousemove:null},we={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||(z.addEventListener("mousemove",we.mousemove),ae.mousemove=we.mousemove):(z.removeEventListener("mousemove",ae.mousemove),ae.mousemove=null),16&Ee?ae.wheel||(z.addEventListener("wheel",we.wheel,{passive:!1}),ae.wheel=we.wheel):(z.removeEventListener("wheel",ae.wheel),ae.wheel=null),2&Ee?ae.mouseup||(ae.mouseup=we.mouseup):(this._document.removeEventListener("mouseup",ae.mouseup),ae.mouseup=null),4&Ee?ae.mousedrag||(ae.mousedrag=we.mousedrag):(this._document.removeEventListener("mousemove",ae.mousedrag),ae.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,S.addDisposableDomListener)(z,"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)(z,"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 $e=G.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(Ee.deltaY<0?"A":"B");let We="";for(let Fe=0;Fe<Math.abs(Ue);Fe++)We+=$e;return this.coreService.triggerDataEvent(We,!0),this.cancel(Ee,!0)}return this.viewport.handleWheel(Ee)?this.cancel(Ee):void 0}}),{passive:!1})),this.register((0,S.addDisposableDomListener)(z,"touchstart",(Ee=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(Ee),this.cancel(Ee)}),{passive:!0})),this.register((0,S.addDisposableDomListener)(z,"touchmove",(Ee=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(Ee)?void 0:this.cancel(Ee)}),{passive:!1}))}refresh(Y,z){var oe;(oe=this._renderService)==null||oe.refreshRows(Y,z)}updateCursorStyle(Y){var z;(z=this._selectionService)!=null&&z.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,z,oe=0){var ae;oe===1?(super.scrollLines(Y,z,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 z=this._characterJoinerService.register(Y);return this.refresh(0,this.rows-1),z}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,z,oe){this._selectionService.setSelection(Y,z,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,z){var oe;(oe=this._selectionService)==null||oe.selectLines(Y,z)}_keyDown(Y){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(Y)===!1)return!1;const z=this.browser.isMac&&this.options.macOptionIsMeta&&Y.altKey;if(!z&&!this._compositionHelper.keydown(Y))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;z||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!==G.C0.ETX&&oe.key!==G.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,z){const oe=Y.isMac&&!this.options.macOptionIsMeta&&z.altKey&&!z.ctrlKey&&!z.metaKey||Y.isWindows&&z.altKey&&z.ctrlKey&&!z.metaKey||Y.isWindows&&z.getModifierState("AltGraph");return z.type==="keypress"?oe:oe&&(!z.keyCode||z.keyCode>47)}_keyUp(Y){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(Y)===!1||((function(z){return z.keyCode===16||z.keyCode===17||z.keyCode===18})(Y)||this.focus(),this.updateCursorStyle(Y),this._keyPressHandled=!1)}_keyPress(Y){let z;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(Y)===!1)return!1;if(this.cancel(Y),Y.charCode)z=Y.charCode;else if(Y.which===null||Y.which===void 0)z=Y.keyCode;else{if(Y.which===0||Y.charCode===0)return!1;z=Y.which}return!(!z||(Y.altKey||Y.ctrlKey||Y.metaKey)&&!this._isThirdLevelShift(this.browser,Y)||(z=String.fromCharCode(z),this._onKey.fire({key:z,domEvent:Y}),this._showCursor(),this.coreService.triggerDataEvent(z,!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 z=Y.data;return this.coreService.triggerDataEvent(z,!0),this.cancel(Y),!0}return!1}resize(Y,z){Y!==this.cols||z!==this.rows?super.resize(Y,z):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(Y,z){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 z=1;z<this.rows;z++)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 z,oe;this.options.rows=this.rows,this.options.cols=this.cols;const Y=this._customKeyEventHandler;this._setup(),super.reset(),(z=this._selectionService)==null||z.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(G.C0.ESC+"[I"):this.coreService.triggerDataEvent(G.C0.ESC+"[O")}_reportWindowsOptions(Y){if(this._renderService)switch(Y){case B.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const z=this._renderService.dimensions.css.canvas.width.toFixed(0),oe=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${G.C0.ESC}[4;${oe};${z}t`);break;case B.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const ae=this._renderService.dimensions.css.cell.width.toFixed(0),we=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${G.C0.ESC}[6;${we};${ae}t`)}}cancel(Y,z){if(this.options.cancelEvents||z)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,_,k){var R,M=arguments.length,j=M<3?m:k===null?k=Object.getOwnPropertyDescriptor(m,_):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(b,m,_,k);else for(var T=b.length-1;T>=0;T--)(R=b[T])&&(j=(M<3?R(j):M>3?R(m,_,j):R(m,_))||j);return M>3&&j&&Object.defineProperty(m,_,j),j},S=this&&this.__param||function(b,m){return function(_,k){m(_,k,b)}};Object.defineProperty(c,"__esModule",{value:!0}),c.Viewport=void 0;const f=h(3656),x=h(4725),E=h(8460),A=h(844),C=h(2585);let y=c.Viewport=class extends A.Disposable{constructor(b,m,_,k,R,M,j,T){super(),this._viewportElement=b,this._scrollArea=m,this._bufferService=_,this._optionsService=k,this._charSizeService=R,this._renderService=M,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(T.colors),this.register(T.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 _=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(m<0&&this._viewportElement.scrollTop!==0||m>0&&_<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 T;let _,k="";const R=[],M=m??this._bufferService.buffer.lines.length,j=this._bufferService.buffer.lines;for(let D=b;D<M;D++){const I=j.get(D);if(!I)continue;const q=(T=j.get(D+1))==null?void 0:T.isWrapped;if(k+=I.translateToString(!q),!q||D===j.length-1){const W=document.createElement("div");W.textContent=k,R.push(W),k.length>0&&(_=W),k=""}}return{bufferElements:R,cursorElement:_}}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 _=this._optionsService.rawOptions.fastScrollModifier;return _==="alt"&&m.altKey||_==="ctrl"&&m.ctrlKey||_==="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 _,k=arguments.length,R=k<3?y:m===null?m=Object.getOwnPropertyDescriptor(y,b):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(C,y,b,m);else for(var M=C.length-1;M>=0;M--)(_=C[M])&&(R=(k<3?_(R):k>3?_(y,b,R):_(y,b))||R);return k>3&&R&&Object.defineProperty(y,b,R),R},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 A=c.BufferDecorationRenderer=class extends x.Disposable{constructor(C,y,b,m,_){super(),this._screenElement=C,this._bufferService=y,this._coreBrowserService=b,this._decorationService=m,this._renderService=_,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=A=v([S(1,E.IBufferService),S(2,f.ICoreBrowserService),S(3,E.IDecorationService),S(4,f.IRenderService)],A)},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(_,k,R,M){var j,T=arguments.length,D=T<3?k:M===null?M=Object.getOwnPropertyDescriptor(k,R):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(_,k,R,M);else for(var I=_.length-1;I>=0;I--)(j=_[I])&&(D=(T<3?j(D):T>3?j(k,R,D):j(k,R))||D);return T>3&&D&&Object.defineProperty(k,R,D),D},S=this&&this.__param||function(_,k){return function(R,M){k(R,M,_)}};Object.defineProperty(c,"__esModule",{value:!0}),c.OverviewRulerRenderer=void 0;const f=h(5871),x=h(4725),E=h(844),A=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(_,k,R,M,j,T,D){var q;super(),this._viewportElement=_,this._screenElement=k,this._bufferService=R,this._decorationService=M,this._renderService=j,this._optionsService=T,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 W;(W=this._canvas)==null||W.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 _=Math.floor(this._canvas.width/3),k=Math.ceil(this._canvas.width/3);y.full=this._canvas.width,y.left=_,y.center=k,y.right=_,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 _=this._canvas.height/this._bufferService.buffer.lines.length,k=Math.round(Math.max(Math.min(_,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 _=this._colorZoneStore.zones;for(const k of _)k.position!=="full"&&this._renderColorZone(k);for(const k of _)k.position==="full"&&this._renderColorZone(k);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(_){this._ctx.fillStyle=_.color,this._ctx.fillRect(b[_.position||"full"],Math.round((this._canvas.height-1)*(_.startBufferLine/this._bufferService.buffers.active.lines.length)-C[_.position||"full"]/2),y[_.position||"full"],Math.round((this._canvas.height-1)*((_.endBufferLine-_.startBufferLine)/this._bufferService.buffers.active.lines.length)+C[_.position||"full"]))}_queueRefresh(_,k){this._shouldUpdateDimensions=_||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,A.IBufferService),S(3,A.IDecorationService),S(4,x.IRenderService),S(5,A.IOptionsService),S(6,x.ICoreBrowserService)],m)},2950:function(p,c,h){var v=this&&this.__decorate||function(C,y,b,m){var _,k=arguments.length,R=k<3?y:m===null?m=Object.getOwnPropertyDescriptor(y,b):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(C,y,b,m);else for(var M=C.length-1;M>=0;M--)(_=C[M])&&(R=(k<3?_(R):k>3?_(y,b,R):_(y,b))||R);return k>3&&R&&Object.defineProperty(y,b,R),R},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 A=c.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(C,y,b,m,_,k){this._textarea=C,this._compositionView=y,this._bufferService=b,this._optionsService=m,this._coreService=_,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,_=y*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=_+"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=_+"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=A=v([S(2,x.IBufferService),S(3,x.IOptionsService),S(4,x.ICoreService),S(5,f.IRenderService)],A)},9806:(p,c)=>{function h(v,S,f){const x=f.getBoundingClientRect(),E=v.getComputedStyle(f),A=parseInt(E.getPropertyValue("padding-left")),C=parseInt(E.getPropertyValue("padding-top"));return[S.clientX-x.left-A,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,A,C,y,b){if(!A)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,_){const k=y-f(y,m),R=b-f(b,m),M=Math.abs(k-R)-(function(j,T,D){let I=0;const q=j-f(j,D),W=T-f(T,D);for(let U=0;U<Math.abs(q-W);U++){const Z=x(j,T)==="A"?-1:1,se=D.buffer.lines.get(q+Z*U);se!=null&&se.isWrapped&&I++}return I})(y,b,m);return C(M,A(x(y,b),_))}function f(y,b){let m=0,_=b.buffer.lines.get(y),k=_==null?void 0:_.isWrapped;for(;k&&y>=0&&y<b.rows;)m++,_=b.buffer.lines.get(--y),k=_==null?void 0:_.isWrapped;return m}function x(y,b){return y>b?"A":"B"}function E(y,b,m,_,k,R){let M=y,j=b,T="";for(;M!==m||j!==_;)M+=k?1:-1,k&&M>R.cols-1?(T+=R.buffer.translateBufferLineToString(j,!1,y,M),M=0,y=0,j++):!k&&M<0&&(T+=R.buffer.translateBufferLineToString(j,!1,0,y+1),M=R.cols-1,y=M,j--);return T+R.buffer.translateBufferLineToString(j,!1,y,M)}function A(y,b){const m=b?"O":"[";return v.C0.ESC+m+y}function C(y,b){y=Math.floor(y);let m="";for(let _=0;_<y;_++)m+=b;return m}c.moveToCellSequence=function(y,b,m,_){const k=m.buffer.x,R=m.buffer.y;if(!m.buffer.hasScrollback)return(function(T,D,I,q,W,U){return S(D,q,W,U).length===0?"":C(E(T,D,T,D-f(D,W),!1,W).length,A("D",U))})(k,R,0,b,m,_)+S(R,b,m,_)+(function(T,D,I,q,W,U){let Z;Z=S(D,q,W,U).length>0?q-f(q,W):D;const se=q,F=(function(G,J,O,H,L,B){let V;return V=S(O,H,L,B).length>0?H-f(H,L):J,G<O&&V<=H||G>=O&&V<H?"C":"D"})(T,D,I,q,W,U);return C(E(T,Z,I,se,F==="C",W).length,A(F,U))})(k,R,y,b,m,_);let M;if(R===b)return M=k>y?"D":"C",C(Math.abs(k-y),A(M,_));M=R>b?"D":"C";const j=Math.abs(R-b);return C((function(T,D){return D.cols-T})(R>b?y:k,m)+(j-1)*m.cols+1+((R>b?k:y)-1),A(M,_))}},1296:function(p,c,h){var v=this&&this.__decorate||function(U,Z,se,F){var G,J=arguments.length,O=J<3?Z:F===null?F=Object.getOwnPropertyDescriptor(Z,se):F;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(U,Z,se,F);else for(var H=U.length-1;H>=0;H--)(G=U[H])&&(O=(J<3?G(O):J>3?G(Z,se,O):G(Z,se))||O);return J>3&&O&&Object.defineProperty(Z,se,O),O},S=this&&this.__param||function(U,Z){return function(se,F){Z(se,F,U)}};Object.defineProperty(c,"__esModule",{value:!0}),c.DomRenderer=void 0;const f=h(3787),x=h(2550),E=h(2223),A=h(6171),C=h(6052),y=h(4725),b=h(8055),m=h(8460),_=h(844),k=h(2585),R="xterm-dom-renderer-owner-",M="xterm-rows",j="xterm-fg-",T="xterm-bg-",D="xterm-focus",I="xterm-selection";let q=1,W=c.DomRenderer=class extends _.Disposable{constructor(U,Z,se,F,G,J,O,H,L,B,V,Q,ue){super(),this._terminal=U,this._document=Z,this._element=se,this._screenElement=F,this._viewportElement=G,this._helperContainer=J,this._linkifier2=O,this._charSizeService=L,this._optionsService=B,this._bufferService=V,this._coreBrowserService=Q,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(M),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,A.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((fe=>this._injectCss(fe)))),this._injectCss(this._themeService.colors),this._rowFactory=H.createInstance(f.DomRendererRowFactory,document),this._element.classList.add(R+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((fe=>this._handleLinkHover(fe)))),this.register(this._linkifier2.onHideLinkUnderline((fe=>this._handleLinkLeave(fe)))),this.register((0,_.toDisposable)((()=>{this._element.classList.remove(R+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 Z=`${this._terminalSelector} .${M} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=Z,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 Z=`${this._terminalSelector} .${M} { color: ${U.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;Z+=`${this._terminalSelector} .${M} .xterm-dim { color: ${b.color.multiplyOpacity(U.foreground,.5).css};}`,Z+=`${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}`,G=`blink_block_${this._terminalClass}`;Z+=`@keyframes ${se} { 50% { border-bottom-style: hidden; }}`,Z+=`@keyframes ${F} { 50% { box-shadow: none; }}`,Z+=`@keyframes ${G} { 0% { background-color: ${U.cursor.css}; color: ${U.cursorAccent.css}; } 50% { background-color: inherit; color: ${U.cursor.css}; }}`,Z+=`${this._terminalSelector} .${M}.${D} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${se} 1s step-end infinite;}${this._terminalSelector} .${M}.${D} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${F} 1s step-end infinite;}${this._terminalSelector} .${M}.${D} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${G} 1s step-end infinite;}${this._terminalSelector} .${M} .xterm-cursor.xterm-cursor-block { background-color: ${U.cursor.css}; color: ${U.cursorAccent.css};}${this._terminalSelector} .${M} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${U.cursor.css} !important; color: ${U.cursorAccent.css} !important;}${this._terminalSelector} .${M} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${U.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${M} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${U.cursor.css} inset;}${this._terminalSelector} .${M} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${U.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,Z+=`${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())Z+=`${this._terminalSelector} .${j}${J} { color: ${O.css}; }${this._terminalSelector} .${j}${J}.xterm-dim { color: ${b.color.multiplyOpacity(O,.5).css}; }${this._terminalSelector} .${T}${J} { background-color: ${O.css}; }`;Z+=`${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} .${T}${E.INVERTED_DEFAULT_COLOR} { background-color: ${U.foreground.css}; }`,this._themeStyleElement.textContent=Z}_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,Z){for(let se=this._rowElements.length;se<=Z;se++){const F=this._document.createElement("div");this._rowContainer.appendChild(F),this._rowElements.push(F)}for(;this._rowElements.length>Z;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(U,Z){this._refreshRowElements(U,Z),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,Z,se){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(U,Z,se),this.renderRows(0,this._bufferService.rows-1),!U||!Z)return;this._selectionRenderModel.update(this._terminal,U,Z,se);const F=this._selectionRenderModel.viewportStartRow,G=this._selectionRenderModel.viewportEndRow,J=this._selectionRenderModel.viewportCappedStartRow,O=this._selectionRenderModel.viewportCappedEndRow;if(J>=this._bufferService.rows||O<0)return;const H=this._document.createDocumentFragment();if(se){const L=U[0]>Z[0];H.appendChild(this._createSelectionElement(J,L?Z[0]:U[0],L?U[0]:Z[0],O-J+1))}else{const L=F===J?U[0]:0,B=J===G?Z[0]:this._bufferService.cols;H.appendChild(this._createSelectionElement(J,L,B));const V=O-J-1;if(H.appendChild(this._createSelectionElement(J+1,0,this._bufferService.cols,V)),J!==O){const Q=G===O?Z[0]:this._bufferService.cols;H.appendChild(this._createSelectionElement(O,0,Q))}}this._selectionContainer.appendChild(H)}_createSelectionElement(U,Z,se,F=1){const G=this._document.createElement("div"),J=Z*this.dimensions.css.cell.width;let O=this.dimensions.css.cell.width*(se-Z);return J+O>this.dimensions.css.canvas.width&&(O=this.dimensions.css.canvas.width-J),G.style.height=F*this.dimensions.css.cell.height+"px",G.style.top=U*this.dimensions.css.cell.height+"px",G.style.left=`${J}px`,G.style.width=`${O}px`,G}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,Z){const se=this._bufferService.buffer,F=se.ybase+se.y,G=Math.min(se.x,this._bufferService.cols-1),J=this._optionsService.rawOptions.cursorBlink,O=this._optionsService.rawOptions.cursorStyle,H=this._optionsService.rawOptions.cursorInactiveStyle;for(let L=U;L<=Z;L++){const B=L+se.ydisp,V=this._rowElements[L],Q=se.lines.get(B);if(!V||!Q)break;V.replaceChildren(...this._rowFactory.createRow(Q,B,B===F,O,H,G,J,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${R}${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,Z,se,F,G,J){se<0&&(U=0),F<0&&(Z=0);const O=this._bufferService.rows-1;se=Math.max(Math.min(se,O),0),F=Math.max(Math.min(F,O),0),G=Math.min(G,this._bufferService.cols);const H=this._bufferService.buffer,L=H.ybase+H.y,B=Math.min(H.x,G-1),V=this._optionsService.rawOptions.cursorBlink,Q=this._optionsService.rawOptions.cursorStyle,ue=this._optionsService.rawOptions.cursorInactiveStyle;for(let fe=se;fe<=F;++fe){const Y=fe+H.ydisp,z=this._rowElements[fe],oe=H.lines.get(Y);if(!z||!oe)break;z.replaceChildren(...this._rowFactory.createRow(oe,Y,Y===L,Q,ue,B,V,this.dimensions.css.cell.width,this._widthCache,J?fe===se?U:0:-1,J?(fe===F?Z:G)-1:-1))}}};c.DomRenderer=W=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)],W)},3787:function(p,c,h){var v=this&&this.__decorate||function(M,j,T,D){var I,q=arguments.length,W=q<3?j:D===null?D=Object.getOwnPropertyDescriptor(j,T):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")W=Reflect.decorate(M,j,T,D);else for(var U=M.length-1;U>=0;U--)(I=M[U])&&(W=(q<3?I(W):q>3?I(j,T,W):I(j,T))||W);return q>3&&W&&Object.defineProperty(j,T,W),W},S=this&&this.__param||function(M,j){return function(T,D){j(T,D,M)}};Object.defineProperty(c,"__esModule",{value:!0}),c.DomRendererRowFactory=void 0;const f=h(2223),x=h(643),E=h(511),A=h(2585),C=h(8055),y=h(4725),b=h(4269),m=h(6171),_=h(3734);let k=c.DomRendererRowFactory=class{constructor(M,j,T,D,I,q,W){this._document=M,this._characterJoinerService=j,this._optionsService=T,this._coreBrowserService=D,this._coreService=I,this._decorationService=q,this._themeService=W,this._workCell=new E.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(M,j,T){this._selectionStart=M,this._selectionEnd=j,this._columnSelectMode=T}createRow(M,j,T,D,I,q,W,U,Z,se,F){const G=[],J=this._characterJoinerService.getJoinedCharacters(j),O=this._themeService.colors;let H,L=M.getNoBgTrimmedLength();T&&L<q+1&&(L=q+1);let B=0,V="",Q=0,ue=0,fe=0,Y=!1,z=0,oe=!1,ae=0;const we=[],Ee=se!==-1&&F!==-1;for(let Ue=0;Ue<L;Ue++){M.loadCell(Ue,this._workCell);let $e=this._workCell.getWidth();if($e===0)continue;let We=!1,Fe=Ue,Ne=this._workCell;if(J.length>0&&Ue===J[0][0]){We=!0;const lt=J.shift();Ne=new b.JoinedCellData(this._workCell,M.translateToString(!0,lt[0],lt[1]),lt[1]-lt[0]),Fe=lt[1]-1,$e=Ne.getWidth()}const $t=this._isCellInSelection(Ue,j),pt=T&&Ue===q,Nt=Ee&&Ue>=se&&Ue<=F;let xt=!1;this._decorationService.forEachDecorationAtCell(Ue,j,void 0,(lt=>{xt=!0}));let ls=Ne.getChars()||x.WHITESPACE_CELL_CHAR;if(ls===" "&&(Ne.isUnderline()||Ne.isOverline())&&(ls=" "),ae=$e*U-Z.get(ls,Ne.isBold(),Ne.isItalic()),H){if(B&&($t&&oe||!$t&&!oe&&Ne.bg===Q)&&($t&&oe&&O.selectionForeground||Ne.fg===ue)&&Ne.extended.ext===fe&&Nt===Y&&ae===z&&!pt&&!We&&!xt){Ne.isInvisible()?V+=x.WHITESPACE_CELL_CHAR:V+=ls,B++;continue}B&&(H.textContent=V),H=this._document.createElement("span"),B=0,V=""}else H=this._document.createElement("span");if(Q=Ne.bg,ue=Ne.fg,fe=Ne.extended.ext,Y=Nt,z=ae,oe=$t,We&&q>=Ue&&q<=Fe&&(q=Ue),!this._coreService.isCursorHidden&&pt&&this._coreService.isCursorInitialized){if(we.push("xterm-cursor"),this._coreBrowserService.isFocused)W&&we.push("xterm-cursor-blink"),we.push(D==="bar"?"xterm-cursor-bar":D==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(I)switch(I){case"outline":we.push("xterm-cursor-outline");break;case"block":we.push("xterm-cursor-block");break;case"bar":we.push("xterm-cursor-bar");break;case"underline":we.push("xterm-cursor-underline")}}if(Ne.isBold()&&we.push("xterm-bold"),Ne.isItalic()&&we.push("xterm-italic"),Ne.isDim()&&we.push("xterm-dim"),V=Ne.isInvisible()?x.WHITESPACE_CELL_CHAR:Ne.getChars()||x.WHITESPACE_CELL_CHAR,Ne.isUnderline()&&(we.push(`xterm-underline-${Ne.extended.underlineStyle}`),V===" "&&(V=" "),!Ne.isUnderlineColorDefault()))if(Ne.isUnderlineColorRGB())H.style.textDecorationColor=`rgb(${_.AttributeData.toColorRGB(Ne.getUnderlineColor()).join(",")})`;else{let lt=Ne.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Ne.isBold()&&lt<8&&(lt+=8),H.style.textDecorationColor=O.ansi[lt].css}Ne.isOverline()&&(we.push("xterm-overline"),V===" "&&(V=" ")),Ne.isStrikethrough()&&we.push("xterm-strikethrough"),Nt&&(H.style.textDecoration="underline");let _t=Ne.getFgColor(),ot=Ne.getFgColorMode(),kt=Ne.getBgColor(),Tt=Ne.getBgColorMode();const Os=!!Ne.isInverse();if(Os){const lt=_t;_t=kt,kt=lt;const ys=ot;ot=Tt,Tt=ys}let Pe,ds,Wt,_s=!1;switch(this._decorationService.forEachDecorationAtCell(Ue,j,void 0,(lt=>{lt.options.layer!=="top"&&_s||(lt.backgroundColorRGB&&(Tt=50331648,kt=lt.backgroundColorRGB.rgba>>8&16777215,Pe=lt.backgroundColorRGB),lt.foregroundColorRGB&&(ot=50331648,_t=lt.foregroundColorRGB.rgba>>8&16777215,ds=lt.foregroundColorRGB),_s=lt.options.layer==="top")})),!_s&&$t&&(Pe=this._coreBrowserService.isFocused?O.selectionBackgroundOpaque:O.selectionInactiveBackgroundOpaque,kt=Pe.rgba>>8&16777215,Tt=50331648,_s=!0,O.selectionForeground&&(ot=50331648,_t=O.selectionForeground.rgba>>8&16777215,ds=O.selectionForeground)),_s&&we.push("xterm-decoration-top"),Tt){case 16777216:case 33554432:Wt=O.ansi[kt],we.push(`xterm-bg-${kt}`);break;case 50331648:Wt=C.channels.toColor(kt>>16,kt>>8&255,255&kt),this._addStyle(H,`background-color:#${R((kt>>>0).toString(16),"0",6)}`);break;default:Os?(Wt=O.foreground,we.push(`xterm-bg-${f.INVERTED_DEFAULT_COLOR}`)):Wt=O.background}switch(Pe||Ne.isDim()&&(Pe=C.color.multiplyOpacity(Wt,.5)),ot){case 16777216:case 33554432:Ne.isBold()&&_t<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(_t+=8),this._applyMinimumContrast(H,Wt,O.ansi[_t],Ne,Pe,void 0)||we.push(`xterm-fg-${_t}`);break;case 50331648:const lt=C.channels.toColor(_t>>16&255,_t>>8&255,255&_t);this._applyMinimumContrast(H,Wt,lt,Ne,Pe,ds)||this._addStyle(H,`color:#${R(_t.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(H,Wt,O.foreground,Ne,Pe,ds)||Os&&we.push(`xterm-fg-${f.INVERTED_DEFAULT_COLOR}`)}we.length&&(H.className=we.join(" "),we.length=0),pt||We||xt?H.textContent=V:B++,ae!==this.defaultSpacing&&(H.style.letterSpacing=`${ae}px`),G.push(H),Ue=Fe}return H&&B&&(H.textContent=V),G}_applyMinimumContrast(M,j,T,D,I,q){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,m.treatGlyphAsBackgroundColor)(D.getCode()))return!1;const W=this._getContrastCache(D);let U;if(I||q||(U=W.getColor(j.rgba,T.rgba)),U===void 0){const Z=this._optionsService.rawOptions.minimumContrastRatio/(D.isDim()?2:1);U=C.color.ensureContrastRatio(I||j,q||T,Z),W.setColor((I||j).rgba,(q||T).rgba,U??null)}return!!U&&(this._addStyle(M,`color:${U.css}`),!0)}_getContrastCache(M){return M.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(M,j){M.setAttribute("style",`${M.getAttribute("style")||""}${j};`)}_isCellInSelection(M,j){const T=this._selectionStart,D=this._selectionEnd;return!(!T||!D)&&(this._columnSelectMode?T[0]<=D[0]?M>=T[0]&&j>=T[1]&&M<D[0]&&j<=D[1]:M<T[0]&&j>=T[1]&&M>=D[0]&&j<=D[1]:j>T[1]&&j<D[1]||T[1]===D[1]&&j===T[1]&&M>=T[0]&&M<D[0]||T[1]<D[1]&&j===D[1]&&M<D[0]||T[1]<D[1]&&j===T[1]&&M>=T[0])}};function R(M,j,T){for(;M.length<T;)M=j+M;return M}c.DomRendererRowFactory=k=v([S(1,y.ICharacterJoinerService),S(2,A.IOptionsService),S(3,y.ICoreBrowserService),S(4,A.ICoreService),S(5,A.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 A=this._measure(h,0);return A>0&&(this._flat[f]=A),A}let x=h;v&&(x+="B"),S&&(x+="I");let E=this._holey.get(x);if(E===void 0){let A=0;v&&(A|=1),S&&(A|=2),E=this._measure(h,A),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(A){return 57344<=A&&A<=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 A=S.buffers.active.ydisp,C=f[1]-A,y=x[1]-A,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,_,k,R){var M,j=arguments.length,T=j<3?_:R===null?R=Object.getOwnPropertyDescriptor(_,k):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(m,_,k,R);else for(var D=m.length-1;D>=0;D--)(M=m[D])&&(T=(j<3?M(T):j>3?M(_,k,T):M(_,k))||T);return j>3&&T&&Object.defineProperty(_,k,T),T},S=this&&this.__param||function(m,_){return function(k,R){_(k,R,m)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CharSizeService=void 0;const f=h(2585),x=h(8460),E=h(844);let A=c.CharSizeService=class extends E.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(m,_,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,_,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=A=v([S(2,f.IOptionsService)],A);class C extends E.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(_,k){_!==void 0&&_>0&&k!==void 0&&k>0&&(this._result.width=_,this._result.height=k)}}class y extends C{constructor(_,k,R){super(),this._document=_,this._parentElement=k,this._optionsService=R,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(_){super(),this._optionsService=_,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 _=this._ctx.measureText("W");return this._validateAndSet(_.width,_.fontBoundingBoxAscent+_.fontBoundingBoxDescent),this._result}}},4269:function(p,c,h){var v=this&&this.__decorate||function(b,m,_,k){var R,M=arguments.length,j=M<3?m:k===null?k=Object.getOwnPropertyDescriptor(m,_):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(b,m,_,k);else for(var T=b.length-1;T>=0;T--)(R=b[T])&&(j=(M<3?R(j):M>3?R(m,_,j):R(m,_))||j);return M>3&&j&&Object.defineProperty(m,_,j),j},S=this&&this.__param||function(b,m){return function(_,k){m(_,k,b)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CharacterJoinerService=c.JoinedCellData=void 0;const f=h(3734),x=h(643),E=h(511),A=h(2585);class C extends f.AttributeData{constructor(m,_,k){super(),this.content=0,this.combinedData="",this.fg=m.fg,this.bg=m.bg,this.combinedData=_,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 i1{constructor(m){this._bufferService=m,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new E.CellData}register(m){const _={id:this._nextCharacterJoinerId++,handler:m};return this._characterJoiners.push(_),_.id}deregister(m){for(let _=0;_<this._characterJoiners.length;_++)if(this._characterJoiners[_].id===m)return this._characterJoiners.splice(_,1),!0;return!1}getJoinedCharacters(m){if(this._characterJoiners.length===0)return[];const _=this._bufferService.buffer.lines.get(m);if(!_||_.length===0)return[];const k=[],R=_.translateToString(!0);let M=0,j=0,T=0,D=_.getFg(0),I=_.getBg(0);for(let q=0;q<_.getTrimmedLength();q++)if(_.loadCell(q,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==D||this._workCell.bg!==I){if(q-M>1){const W=this._getJoinedRanges(R,T,j,_,M);for(let U=0;U<W.length;U++)k.push(W[U])}M=q,T=j,D=this._workCell.fg,I=this._workCell.bg}j+=this._workCell.getChars().length||x.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-M>1){const q=this._getJoinedRanges(R,T,j,_,M);for(let W=0;W<q.length;W++)k.push(q[W])}return k}_getJoinedRanges(m,_,k,R,M){const j=m.substring(_,k);let T=[];try{T=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++)i1._mergeRanges(T,I[q])}catch(I){console.error(I)}return this._stringRangesToCellRanges(T,R,M),T}_stringRangesToCellRanges(m,_,k){let R=0,M=!1,j=0,T=m[R];if(T){for(let D=k;D<this._bufferService.cols;D++){const I=_.getWidth(D),q=_.getString(D).length||x.WHITESPACE_CELL_CHAR.length;if(I!==0){if(!M&&T[0]<=j&&(T[0]=D,M=!0),T[1]<=j){if(T[1]=D,T=m[++R],!T)break;T[0]<=j?(T[0]=D,M=!0):M=!1}j+=q}}T&&(T[1]=this._bufferService.cols)}}static _mergeRanges(m,_){let k=!1;for(let R=0;R<m.length;R++){const M=m[R];if(k){if(_[1]<=M[0])return m[R-1][1]=_[1],m;if(_[1]<=M[1])return m[R-1][1]=Math.max(_[1],M[1]),m.splice(R,1),m;m.splice(R,1),R--}else{if(_[1]<=M[0])return m.splice(R,0,_),m;if(_[1]<=M[1])return M[0]=Math.min(_[0],M[0]),m;_[0]<M[1]&&(M[0]=Math.min(_[0],M[0]),k=!0)}}return k?m[m.length-1][1]=_[1]:m.push(_),m}};c.CharacterJoinerService=y=v([S(0,A.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(A,C,y,b){var m,_=arguments.length,k=_<3?C:b===null?b=Object.getOwnPropertyDescriptor(C,y):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(A,C,y,b);else for(var R=A.length-1;R>=0;R--)(m=A[R])&&(k=(_<3?m(k):_>3?m(C,y,k):m(C,y))||k);return _>3&&k&&Object.defineProperty(C,y,k),k},S=this&&this.__param||function(A,C){return function(y,b){C(y,b,A)}};Object.defineProperty(c,"__esModule",{value:!0}),c.MouseService=void 0;const f=h(4725),x=h(9806);let E=c.MouseService=class{constructor(A,C){this._renderService=A,this._charSizeService=C}getCoords(A,C,y,b,m){return(0,x.getCoords)(window,A,C,y,b,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,m)}getMouseReportCoords(A,C){const y=(0,x.getCoordsRelativeToElement)(window,A,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,_,k,R){var M,j=arguments.length,T=j<3?_:R===null?R=Object.getOwnPropertyDescriptor(_,k):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(m,_,k,R);else for(var D=m.length-1;D>=0;D--)(M=m[D])&&(T=(j<3?M(T):j>3?M(_,k,T):M(_,k))||T);return j>3&&T&&Object.defineProperty(_,k,T),T},S=this&&this.__param||function(m,_){return function(k,R){_(k,R,m)}};Object.defineProperty(c,"__esModule",{value:!0}),c.RenderService=void 0;const f=h(6193),x=h(4725),E=h(8460),A=h(844),C=h(7226),y=h(2585);let b=c.RenderService=class extends A.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(m,_,k,R,M,j,T,D){super(),this._rowCount=m,this._charSizeService=R,this._renderer=this.register(new A.MutableDisposable),this._pausedResizeTask=new C.DebouncedIdleTask,this._observerDisposable=this.register(new A.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)),T),this.register(this._renderDebouncer),this.register(T.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(M.onDecorationRegistered((()=>this._fullRefresh()))),this.register(M.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(T.window,_),this.register(T.onWindowChange((I=>this._registerIntersectionObserver(I,_))))}_registerIntersectionObserver(m,_){if("IntersectionObserver"in m){const k=new m.IntersectionObserver((R=>this._handleIntersectionChange(R[R.length-1])),{threshold:0});k.observe(_),this._observerDisposable.value=(0,A.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,_,k=!1){this._isPaused?this._needsFullRefresh=!0:(k||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(m,_,this._rowCount))}_renderRows(m,_){this._renderer.value&&(m=Math.min(m,this._rowCount-1),_=Math.min(_,this._rowCount-1),this._renderer.value.renderRows(m,_),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:_}),this._onRender.fire({start:m,end:_}),this._isNextRenderRedrawOnly=!0)}resize(m,_){this._rowCount=_,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((_=>this.refreshRows(_.start,_.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,_;this._renderer.value&&((_=(m=this._renderer.value).clearTextureAtlas)==null||_.call(m),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(m,_){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var k;return(k=this._renderer.value)==null?void 0:k.handleResize(m,_)})):this._renderer.value.handleResize(m,_),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,_,k){var R;this._selectionState.start=m,this._selectionState.end=_,this._selectionState.columnSelectMode=k,(R=this._renderer.value)==null||R.handleSelectionChanged(m,_,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(T,D,I,q){var W,U=arguments.length,Z=U<3?D:q===null?q=Object.getOwnPropertyDescriptor(D,I):q;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Z=Reflect.decorate(T,D,I,q);else for(var se=T.length-1;se>=0;se--)(W=T[se])&&(Z=(U<3?W(Z):U>3?W(D,I,Z):W(D,I))||Z);return U>3&&Z&&Object.defineProperty(D,I,Z),Z},S=this&&this.__param||function(T,D){return function(I,q){D(I,q,T)}};Object.defineProperty(c,"__esModule",{value:!0}),c.SelectionService=void 0;const f=h(9806),x=h(9504),E=h(456),A=h(4725),C=h(8460),y=h(844),b=h(6114),m=h(4841),_=h(511),k=h(2585),R=" ",M=new RegExp(R,"g");let j=c.SelectionService=class extends y.Disposable{constructor(T,D,I,q,W,U,Z,se,F){super(),this._element=T,this._screenElement=D,this._linkifier=I,this._bufferService=q,this._coreService=W,this._mouseService=U,this._optionsService=Z,this._renderService=se,this._coreBrowserService=F,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new _.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=G=>this._handleMouseMove(G),this._mouseUpListener=G=>this._handleMouseUp(G),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((G=>this._handleTrim(G))),this.register(this._bufferService.buffers.onBufferActivate((G=>this._handleBufferActivate(G)))),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 T=this._model.finalSelectionStart,D=this._model.finalSelectionEnd;return!(!T||!D||T[0]===D[0]&&T[1]===D[1])}get selectionText(){const T=this._model.finalSelectionStart,D=this._model.finalSelectionEnd;if(!T||!D)return"";const I=this._bufferService.buffer,q=[];if(this._activeSelectionMode===3){if(T[0]===D[0])return"";const W=T[0]<D[0]?T[0]:D[0],U=T[0]<D[0]?D[0]:T[0];for(let Z=T[1];Z<=D[1];Z++){const se=I.translateBufferLineToString(Z,!0,W,U);q.push(se)}}else{const W=T[1]===D[1]?D[0]:void 0;q.push(I.translateBufferLineToString(T[1],!0,T[0],W));for(let U=T[1]+1;U<=D[1]-1;U++){const Z=I.lines.get(U),se=I.translateBufferLineToString(U,!0);Z!=null&&Z.isWrapped?q[q.length-1]+=se:q.push(se)}if(T[1]!==D[1]){const U=I.lines.get(D[1]),Z=I.translateBufferLineToString(D[1],!0,0,D[0]);U&&U.isWrapped?q[q.length-1]+=Z:q.push(Z)}}return q.map((W=>W.replace(M," "))).join(b.isWindows?`\r
455
- `:`
456
- `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(T){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),b.isLinux&&T&&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(T){const D=this._getMouseBufferCoords(T),I=this._model.finalSelectionStart,q=this._model.finalSelectionEnd;return!!(I&&q&&D)&&this._areCoordsInSelection(D,I,q)}isCellInSelection(T,D){const I=this._model.finalSelectionStart,q=this._model.finalSelectionEnd;return!(!I||!q)&&this._areCoordsInSelection([T,D],I,q)}_areCoordsInSelection(T,D,I){return T[1]>D[1]&&T[1]<I[1]||D[1]===I[1]&&T[1]===D[1]&&T[0]>=D[0]&&T[0]<I[0]||D[1]<I[1]&&T[1]===I[1]&&T[0]<I[0]||D[1]<I[1]&&T[1]===D[1]&&T[0]>=D[0]}_selectWordAtCursor(T,D){var W,U;const I=(U=(W=this._linkifier.currentLink)==null?void 0:W.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(T);return!!q&&(this._selectWordAt(q,D),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(T,D){this._model.clearSelection(),T=Math.max(T,0),D=Math.min(D,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,T],this._model.selectionEnd=[this._bufferService.cols,D],this.refresh(),this._onSelectionChange.fire()}_handleTrim(T){this._model.handleTrim(T)&&this.refresh()}_getMouseBufferCoords(T){const D=this._mouseService.getCoords(T,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(D)return D[0]--,D[1]--,D[1]+=this._bufferService.buffer.ydisp,D}_getMouseEventScrollAmount(T){let D=(0,f.getCoordsRelativeToElement)(this._coreBrowserService.window,T,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(T){return b.isMac?T.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:T.shiftKey}handleMouseDown(T){if(this._mouseDownTimeStamp=T.timeStamp,(T.button!==2||!this.hasSelection)&&T.button===0){if(!this._enabled){if(!this.shouldForceSelection(T))return;T.stopPropagation()}T.preventDefault(),this._dragScrollAmount=0,this._enabled&&T.shiftKey?this._handleIncrementalClick(T):T.detail===1?this._handleSingleClick(T):T.detail===2?this._handleDoubleClick(T):T.detail===3&&this._handleTripleClick(T),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(T){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(T))}_handleSingleClick(T){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(T)?3:0,this._model.selectionStart=this._getMouseBufferCoords(T),!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(T){this._selectWordAtCursor(T,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(T){const D=this._getMouseBufferCoords(T);D&&(this._activeSelectionMode=2,this._selectLineAt(D[1]))}shouldColumnSelect(T){return T.altKey&&!(b.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(T){if(T.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(T),!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(T),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 T=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(T.ydisp+this._bufferService.rows,T.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=T.ydisp),this.refresh()}}_handleMouseUp(T){const D=T.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&D<500&&T.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const I=this._mouseService.getCoords(T,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 T=this._model.finalSelectionStart,D=this._model.finalSelectionEnd,I=!(!T||!D||T[0]===D[0]&&T[1]===D[1]);I?T&&D&&(this._oldSelectionStart&&this._oldSelectionEnd&&T[0]===this._oldSelectionStart[0]&&T[1]===this._oldSelectionStart[1]&&D[0]===this._oldSelectionEnd[0]&&D[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(T,D,I)):this._oldHasSelection&&this._fireOnSelectionChange(T,D,I)}_fireOnSelectionChange(T,D,I){this._oldSelectionStart=T,this._oldSelectionEnd=D,this._oldHasSelection=I,this._onSelectionChange.fire()}_handleBufferActivate(T){this.clearSelection(),this._trimListener.dispose(),this._trimListener=T.activeBuffer.lines.onTrim((D=>this._handleTrim(D)))}_convertViewportColToCharacterIndex(T,D){let I=D;for(let q=0;D>=q;q++){const W=T.loadCell(q,this._workCell).getChars().length;this._workCell.getWidth()===0?I--:W>1&&D!==q&&(I+=W-1)}return I}setSelection(T,D,I){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[T,D],this._model.selectionStartLength=I,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(T){this._isClickInSelection(T)||(this._selectWordAtCursor(T,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(T,D,I=!0,q=!0){if(T[0]>=this._bufferService.cols)return;const W=this._bufferService.buffer,U=W.lines.get(T[1]);if(!U)return;const Z=W.translateBufferLineToString(T[1],!1);let se=this._convertViewportColToCharacterIndex(U,T[0]),F=se;const G=T[0]-se;let J=0,O=0,H=0,L=0;if(Z.charAt(se)===" "){for(;se>0&&Z.charAt(se-1)===" ";)se--;for(;F<Z.length&&Z.charAt(F+1)===" ";)F++}else{let Q=T[0],ue=T[0];U.getWidth(Q)===0&&(J++,Q--),U.getWidth(ue)===2&&(O++,ue++);const fe=U.getString(ue).length;for(fe>1&&(L+=fe-1,F+=fe-1);Q>0&&se>0&&!this._isCharWordSeparator(U.loadCell(Q-1,this._workCell));){U.loadCell(Q-1,this._workCell);const Y=this._workCell.getChars().length;this._workCell.getWidth()===0?(J++,Q--):Y>1&&(H+=Y-1,se-=Y-1),se--,Q--}for(;ue<U.length&&F+1<Z.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&&(L+=Y-1,F+=Y-1),F++,ue++}}F++;let B=se+G-J+H,V=Math.min(this._bufferService.cols,F-se+J+O-H-L);if(D||Z.slice(se,F).trim()!==""){if(I&&B===0&&U.getCodePoint(0)!==32){const Q=W.lines.get(T[1]-1);if(Q&&U.isWrapped&&Q.getCodePoint(this._bufferService.cols-1)!==32){const ue=this._getWordAt([this._bufferService.cols-1,T[1]-1],!1,!0,!1);if(ue){const fe=this._bufferService.cols-ue.start;B-=fe,V+=fe}}}if(q&&B+V===this._bufferService.cols&&U.getCodePoint(this._bufferService.cols-1)!==32){const Q=W.lines.get(T[1]+1);if(Q!=null&&Q.isWrapped&&Q.getCodePoint(0)!==32){const ue=this._getWordAt([0,T[1]+1],!1,!1,!0);ue&&(V+=ue.length)}}return{start:B,length:V}}}_selectWordAt(T,D){const I=this._getWordAt(T,D);if(I){for(;I.start<0;)I.start+=this._bufferService.cols,T[1]--;this._model.selectionStart=[I.start,T[1]],this._model.selectionStartLength=I.length}}_selectToWordAt(T){const D=this._getWordAt(T,!0);if(D){let I=T[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(T){return T.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(T.getChars())>=0}_selectLineAt(T){const D=this._bufferService.buffer.getWrappedRangeForLine(T),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,A.IMouseService),S(6,k.IOptionsService),S(7,A.IRenderService),S(8,A.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,T,D,I){var q,W=arguments.length,U=W<3?T:I===null?I=Object.getOwnPropertyDescriptor(T,D):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")U=Reflect.decorate(j,T,D,I);else for(var Z=j.length-1;Z>=0;Z--)(q=j[Z])&&(U=(W<3?q(U):W>3?q(T,D,U):q(T,D))||U);return W>3&&U&&Object.defineProperty(T,D,U),U},S=this&&this.__param||function(j,T){return function(D,I){T(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),A=h(844),C=h(2585),y=x.css.toColor("#ffffff"),b=x.css.toColor("#000000"),m=x.css.toColor("#ffffff"),_=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")],T=[0,95,135,175,215,255];for(let D=0;D<216;D++){const I=T[D/36%6|0],q=T[D/6%6|0],W=T[D%6];j.push({css:x.channels.toCss(I,q,W),rgba:x.channels.toRgba(I,q,W)})}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 R=c.ThemeService=class extends A.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:_,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 T=this._colors;if(T.foreground=M(j.foreground,y),T.background=M(j.background,b),T.cursor=M(j.cursor,m),T.cursorAccent=M(j.cursorAccent,_),T.selectionBackgroundTransparent=M(j.selectionBackground,k),T.selectionBackgroundOpaque=x.color.blend(T.background,T.selectionBackgroundTransparent),T.selectionInactiveBackgroundTransparent=M(j.selectionInactiveBackground,T.selectionBackgroundTransparent),T.selectionInactiveBackgroundOpaque=x.color.blend(T.background,T.selectionInactiveBackgroundTransparent),T.selectionForeground=j.selectionForeground?M(j.selectionForeground,x.NULL_COLOR):void 0,T.selectionForeground===x.NULL_COLOR&&(T.selectionForeground=void 0),x.color.isOpaque(T.selectionBackgroundTransparent)&&(T.selectionBackgroundTransparent=x.color.opacity(T.selectionBackgroundTransparent,.3)),x.color.isOpaque(T.selectionInactiveBackgroundTransparent)&&(T.selectionInactiveBackgroundTransparent=x.color.opacity(T.selectionInactiveBackgroundTransparent,.3)),T.ansi=c.DEFAULT_ANSI_COLORS.slice(),T.ansi[0]=M(j.black,c.DEFAULT_ANSI_COLORS[0]),T.ansi[1]=M(j.red,c.DEFAULT_ANSI_COLORS[1]),T.ansi[2]=M(j.green,c.DEFAULT_ANSI_COLORS[2]),T.ansi[3]=M(j.yellow,c.DEFAULT_ANSI_COLORS[3]),T.ansi[4]=M(j.blue,c.DEFAULT_ANSI_COLORS[4]),T.ansi[5]=M(j.magenta,c.DEFAULT_ANSI_COLORS[5]),T.ansi[6]=M(j.cyan,c.DEFAULT_ANSI_COLORS[6]),T.ansi[7]=M(j.white,c.DEFAULT_ANSI_COLORS[7]),T.ansi[8]=M(j.brightBlack,c.DEFAULT_ANSI_COLORS[8]),T.ansi[9]=M(j.brightRed,c.DEFAULT_ANSI_COLORS[9]),T.ansi[10]=M(j.brightGreen,c.DEFAULT_ANSI_COLORS[10]),T.ansi[11]=M(j.brightYellow,c.DEFAULT_ANSI_COLORS[11]),T.ansi[12]=M(j.brightBlue,c.DEFAULT_ANSI_COLORS[12]),T.ansi[13]=M(j.brightMagenta,c.DEFAULT_ANSI_COLORS[13]),T.ansi[14]=M(j.brightCyan,c.DEFAULT_ANSI_COLORS[14]),T.ansi[15]=M(j.brightWhite,c.DEFAULT_ANSI_COLORS[15]),j.extendedAnsi){const D=Math.min(T.ansi.length-16,j.extendedAnsi.length);for(let I=0;I<D;I++)T.ansi[I+16]=M(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 T=0;T<this._restoreColors.ansi.length;++T)this._colors.ansi[T]=this._restoreColors.ansi[T]}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 M(j,T){if(j!==void 0)try{return x.css.toColor(j)}catch{}return T}c.ThemeService=R=v([S(0,C.IOptionsService)],R)},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 A=new Array(E);for(let C=0;C<Math.min(E,this.length);C++)A[C]=this._array[this._getCyclicIndex(C)];this._array=A,this._maxLength=E,this._startIndex=0}get length(){return this._length}set length(E){if(E>this._length)for(let A=this._length;A<E;A++)this._array[A]=void 0;this._length=E}get(E){return this._array[this._getCyclicIndex(E)]}set(E,A){this._array[this._getCyclicIndex(E)]=A}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,A,...C){if(A){for(let y=E;y<this._length-A;y++)this._array[this._getCyclicIndex(y)]=this._array[this._getCyclicIndex(y+A)];this._length-=A,this.onDeleteEmitter.fire({index:E,amount:A})}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,A,C){if(!(A<=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=A-1;b>=0;b--)this.set(E+b+C,this.get(E+b));const y=E+A+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<A;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,A,C,y;function b(_){const k=_.toString(16);return k.length<2?"0"+k:k}function m(_,k){return _<k?(k+.05)/(_+.05):(_+.05)/(k+.05)}c.NULL_COLOR={css:"#00000000",rgba:0},(function(_){_.toCss=function(k,R,M,j){return j!==void 0?`#${b(k)}${b(R)}${b(M)}${b(j)}`:`#${b(k)}${b(R)}${b(M)}`},_.toRgba=function(k,R,M,j=255){return(k<<24|R<<16|M<<8|j)>>>0},_.toColor=function(k,R,M,j){return{css:_.toCss(k,R,M,j),rgba:_.toRgba(k,R,M,j)}}})(x||(c.channels=x={})),(function(_){function k(R,M){return f=Math.round(255*M),[h,v,S]=y.toChannels(R.rgba),{css:x.toCss(h,v,S,f),rgba:x.toRgba(h,v,S,f)}}_.blend=function(R,M){if(f=(255&M.rgba)/255,f===1)return{css:M.css,rgba:M.rgba};const j=M.rgba>>24&255,T=M.rgba>>16&255,D=M.rgba>>8&255,I=R.rgba>>24&255,q=R.rgba>>16&255,W=R.rgba>>8&255;return h=I+Math.round((j-I)*f),v=q+Math.round((T-q)*f),S=W+Math.round((D-W)*f),{css:x.toCss(h,v,S),rgba:x.toRgba(h,v,S)}},_.isOpaque=function(R){return(255&R.rgba)==255},_.ensureContrastRatio=function(R,M,j){const T=y.ensureContrastRatio(R.rgba,M.rgba,j);if(T)return x.toColor(T>>24&255,T>>16&255,T>>8&255)},_.opaque=function(R){const M=(255|R.rgba)>>>0;return[h,v,S]=y.toChannels(M),{css:x.toCss(h,v,S),rgba:M}},_.opacity=k,_.multiplyOpacity=function(R,M){return f=255&R.rgba,k(R,f*M/255)},_.toColorRGB=function(R){return[R.rgba>>24&255,R.rgba>>16&255,R.rgba>>8&255]}})(E||(c.color=E={})),(function(_){let k,R;try{const M=document.createElement("canvas");M.width=1,M.height=1;const j=M.getContext("2d",{willReadFrequently:!0});j&&(k=j,k.globalCompositeOperation="copy",R=k.createLinearGradient(0,0,1,1))}catch{}_.toColor=function(M){if(M.match(/#[\da-f]{3,8}/i))switch(M.length){case 4:return h=parseInt(M.slice(1,2).repeat(2),16),v=parseInt(M.slice(2,3).repeat(2),16),S=parseInt(M.slice(3,4).repeat(2),16),x.toColor(h,v,S);case 5:return h=parseInt(M.slice(1,2).repeat(2),16),v=parseInt(M.slice(2,3).repeat(2),16),S=parseInt(M.slice(3,4).repeat(2),16),f=parseInt(M.slice(4,5).repeat(2),16),x.toColor(h,v,S,f);case 7:return{css:M,rgba:(parseInt(M.slice(1),16)<<8|255)>>>0};case 9:return{css:M,rgba:parseInt(M.slice(1),16)>>>0}}const j=M.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||!R)throw new Error("css.toColor: Unsupported css format");if(k.fillStyle=R,k.fillStyle=M,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:M}}})(A||(c.css=A={})),(function(_){function k(R,M,j){const T=R/255,D=M/255,I=j/255;return .2126*(T<=.03928?T/12.92:Math.pow((T+.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))}_.relativeLuminance=function(R){return k(R>>16&255,R>>8&255,255&R)},_.relativeLuminance2=k})(C||(c.rgb=C={})),(function(_){function k(M,j,T){const D=M>>24&255,I=M>>16&255,q=M>>8&255;let W=j>>24&255,U=j>>16&255,Z=j>>8&255,se=m(C.relativeLuminance2(W,U,Z),C.relativeLuminance2(D,I,q));for(;se<T&&(W>0||U>0||Z>0);)W-=Math.max(0,Math.ceil(.1*W)),U-=Math.max(0,Math.ceil(.1*U)),Z-=Math.max(0,Math.ceil(.1*Z)),se=m(C.relativeLuminance2(W,U,Z),C.relativeLuminance2(D,I,q));return(W<<24|U<<16|Z<<8|255)>>>0}function R(M,j,T){const D=M>>24&255,I=M>>16&255,q=M>>8&255;let W=j>>24&255,U=j>>16&255,Z=j>>8&255,se=m(C.relativeLuminance2(W,U,Z),C.relativeLuminance2(D,I,q));for(;se<T&&(W<255||U<255||Z<255);)W=Math.min(255,W+Math.ceil(.1*(255-W))),U=Math.min(255,U+Math.ceil(.1*(255-U))),Z=Math.min(255,Z+Math.ceil(.1*(255-Z))),se=m(C.relativeLuminance2(W,U,Z),C.relativeLuminance2(D,I,q));return(W<<24|U<<16|Z<<8|255)>>>0}_.blend=function(M,j){if(f=(255&j)/255,f===1)return j;const T=j>>24&255,D=j>>16&255,I=j>>8&255,q=M>>24&255,W=M>>16&255,U=M>>8&255;return h=q+Math.round((T-q)*f),v=W+Math.round((D-W)*f),S=U+Math.round((I-U)*f),x.toRgba(h,v,S)},_.ensureContrastRatio=function(M,j,T){const D=C.relativeLuminance(M>>8),I=C.relativeLuminance(j>>8);if(m(D,I)<T){if(I<D){const U=k(M,j,T),Z=m(D,C.relativeLuminance(U>>8));if(Z<T){const se=R(M,j,T);return Z>m(D,C.relativeLuminance(se>>8))?U:se}return U}const q=R(M,j,T),W=m(D,C.relativeLuminance(q>>8));if(W<T){const U=k(M,j,T);return W>m(D,C.relativeLuminance(U>>8))?q:U}return q}},_.reduceLuminance=k,_.increaseLuminance=R,_.toChannels=function(M){return[M>>24&255,M>>16&255,M>>8&255,255&M]}})(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),A=h(7302),C=h(6975),y=h(8460),b=h(1753),m=h(1480),_=h(7994),k=h(9282),R=h(5435),M=h(5981),j=h(2660);let T=!1;class D extends v.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new y.EventEmitter),this._onScroll.event((q=>{var W;(W=this._onScrollApi)==null||W.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 W in q)this.optionsService.options[W]=q[W]}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 A.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(_.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 R.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((W=>{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((W=>{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 M.WriteBuffer(((W,U)=>this._inputHandler.parse(W,U)))),this.register((0,y.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(q,W){this._writeBuffer.write(q,W)}writeSync(q,W){this._logService.logLevel<=S.LogLevelEnum.WARN&&!T&&(this._logService.warn("writeSync is unreliable and will be removed soon."),T=!0),this._writeBuffer.writeSync(q,W)}input(q,W=!0){this.coreService.triggerDataEvent(q,W)}resize(q,W){isNaN(q)||isNaN(W)||(q=Math.max(q,E.MINIMUM_COLS),W=Math.max(W,E.MINIMUM_ROWS),this._bufferService.resize(q,W))}scroll(q,W=!1){this._bufferService.scroll(q,W)}scrollLines(q,W,U){this._bufferService.scrollLines(q,W,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 W=q-this._bufferService.buffer.ydisp;W!==0&&this.scrollLines(W)}registerEscHandler(q,W){return this._inputHandler.registerEscHandler(q,W)}registerDcsHandler(q,W){return this._inputHandler.registerDcsHandler(q,W)}registerCsiHandler(q,W){return this._inputHandler.registerCsiHandler(q,W)}registerOscHandler(q,W){return this._inputHandler.registerOscHandler(q,W)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let q=!1;const W=this.optionsService.rawOptions.windowsPty;W&&W.buildNumber!==void 0&&W.buildNumber!==void 0?q=W.backend==="conpty"&&W.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 W of q)W.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,H,L){var B,V=arguments.length,Q=V<3?O:L===null?L=Object.getOwnPropertyDescriptor(O,H):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Q=Reflect.decorate(J,O,H,L);else for(var ue=J.length-1;ue>=0;ue--)(B=J[ue])&&(Q=(V<3?B(Q):V>3?B(O,H,Q):B(O,H))||Q);return V>3&&Q&&Object.defineProperty(O,H,Q),Q},S=this&&this.__param||function(J,O){return function(H,L){O(H,L,J)}};Object.defineProperty(c,"__esModule",{value:!0}),c.InputHandler=c.WindowsOptionsReportType=void 0;const f=h(2584),x=h(7116),E=h(2015),A=h(844),C=h(482),y=h(8437),b=h(8460),m=h(643),_=h(511),k=h(3734),R=h(2585),M=h(1480),j=h(6242),T=h(6351),D=h(5941),I={"(":0,")":1,"*":2,"+":3,"-":1,".":2},q=131072;function W(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 Z=0;class se extends A.Disposable{getAttrData(){return this._curAttrData}constructor(O,H,L,B,V,Q,ue,fe,Y=new E.EscapeSequenceParser){super(),this._bufferService=O,this._charsetService=H,this._coreService=L,this._logService=B,this._optionsService=V,this._oscLinkService=Q,this._coreMouseService=ue,this._unicodeService=fe,this._parser=Y,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new C.StringToUtf32,this._utf8Decoder=new C.Utf8ToUtf32,this._workCell=new _.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((z=>this._activeBuffer=z.activeBuffer))),this._parser.setCsiHandlerFallback(((z,oe)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(z),params:oe.toArray()})})),this._parser.setEscHandlerFallback((z=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(z)})})),this._parser.setExecuteHandlerFallback((z=>{this._logService.debug("Unknown EXECUTE code: ",{code:z})})),this._parser.setOscHandlerFallback(((z,oe,ae)=>{this._logService.debug("Unknown OSC code: ",{identifier:z,action:oe,data:ae})})),this._parser.setDcsHandlerFallback(((z,oe,ae)=>{oe==="HOOK"&&(ae=ae.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(z),action:oe,payload:ae})})),this._parser.setPrintHandler(((z,oe,ae)=>this.print(z,oe,ae))),this._parser.registerCsiHandler({final:"@"},(z=>this.insertChars(z))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(z=>this.scrollLeft(z))),this._parser.registerCsiHandler({final:"A"},(z=>this.cursorUp(z))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(z=>this.scrollRight(z))),this._parser.registerCsiHandler({final:"B"},(z=>this.cursorDown(z))),this._parser.registerCsiHandler({final:"C"},(z=>this.cursorForward(z))),this._parser.registerCsiHandler({final:"D"},(z=>this.cursorBackward(z))),this._parser.registerCsiHandler({final:"E"},(z=>this.cursorNextLine(z))),this._parser.registerCsiHandler({final:"F"},(z=>this.cursorPrecedingLine(z))),this._parser.registerCsiHandler({final:"G"},(z=>this.cursorCharAbsolute(z))),this._parser.registerCsiHandler({final:"H"},(z=>this.cursorPosition(z))),this._parser.registerCsiHandler({final:"I"},(z=>this.cursorForwardTab(z))),this._parser.registerCsiHandler({final:"J"},(z=>this.eraseInDisplay(z,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(z=>this.eraseInDisplay(z,!0))),this._parser.registerCsiHandler({final:"K"},(z=>this.eraseInLine(z,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(z=>this.eraseInLine(z,!0))),this._parser.registerCsiHandler({final:"L"},(z=>this.insertLines(z))),this._parser.registerCsiHandler({final:"M"},(z=>this.deleteLines(z))),this._parser.registerCsiHandler({final:"P"},(z=>this.deleteChars(z))),this._parser.registerCsiHandler({final:"S"},(z=>this.scrollUp(z))),this._parser.registerCsiHandler({final:"T"},(z=>this.scrollDown(z))),this._parser.registerCsiHandler({final:"X"},(z=>this.eraseChars(z))),this._parser.registerCsiHandler({final:"Z"},(z=>this.cursorBackwardTab(z))),this._parser.registerCsiHandler({final:"`"},(z=>this.charPosAbsolute(z))),this._parser.registerCsiHandler({final:"a"},(z=>this.hPositionRelative(z))),this._parser.registerCsiHandler({final:"b"},(z=>this.repeatPrecedingCharacter(z))),this._parser.registerCsiHandler({final:"c"},(z=>this.sendDeviceAttributesPrimary(z))),this._parser.registerCsiHandler({prefix:">",final:"c"},(z=>this.sendDeviceAttributesSecondary(z))),this._parser.registerCsiHandler({final:"d"},(z=>this.linePosAbsolute(z))),this._parser.registerCsiHandler({final:"e"},(z=>this.vPositionRelative(z))),this._parser.registerCsiHandler({final:"f"},(z=>this.hVPosition(z))),this._parser.registerCsiHandler({final:"g"},(z=>this.tabClear(z))),this._parser.registerCsiHandler({final:"h"},(z=>this.setMode(z))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(z=>this.setModePrivate(z))),this._parser.registerCsiHandler({final:"l"},(z=>this.resetMode(z))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(z=>this.resetModePrivate(z))),this._parser.registerCsiHandler({final:"m"},(z=>this.charAttributes(z))),this._parser.registerCsiHandler({final:"n"},(z=>this.deviceStatus(z))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(z=>this.deviceStatusPrivate(z))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(z=>this.softReset(z))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(z=>this.setCursorStyle(z))),this._parser.registerCsiHandler({final:"r"},(z=>this.setScrollRegion(z))),this._parser.registerCsiHandler({final:"s"},(z=>this.saveCursor(z))),this._parser.registerCsiHandler({final:"t"},(z=>this.windowOptions(z))),this._parser.registerCsiHandler({final:"u"},(z=>this.restoreCursor(z))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(z=>this.insertColumns(z))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(z=>this.deleteColumns(z))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(z=>this.selectProtected(z))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(z=>this.requestMode(z,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(z=>this.requestMode(z,!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((z=>(this.setTitle(z),this.setIconName(z),!0)))),this._parser.registerOscHandler(1,new j.OscHandler((z=>this.setIconName(z)))),this._parser.registerOscHandler(2,new j.OscHandler((z=>this.setTitle(z)))),this._parser.registerOscHandler(4,new j.OscHandler((z=>this.setOrReportIndexedColor(z)))),this._parser.registerOscHandler(8,new j.OscHandler((z=>this.setHyperlink(z)))),this._parser.registerOscHandler(10,new j.OscHandler((z=>this.setOrReportFgColor(z)))),this._parser.registerOscHandler(11,new j.OscHandler((z=>this.setOrReportBgColor(z)))),this._parser.registerOscHandler(12,new j.OscHandler((z=>this.setOrReportCursorColor(z)))),this._parser.registerOscHandler(104,new j.OscHandler((z=>this.restoreIndexedColor(z)))),this._parser.registerOscHandler(110,new j.OscHandler((z=>this.restoreFgColor(z)))),this._parser.registerOscHandler(111,new j.OscHandler((z=>this.restoreBgColor(z)))),this._parser.registerOscHandler(112,new j.OscHandler((z=>this.restoreCursorColor(z)))),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 z in x.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:z},(()=>this.selectCharset("("+z))),this._parser.registerEscHandler({intermediates:")",final:z},(()=>this.selectCharset(")"+z))),this._parser.registerEscHandler({intermediates:"*",final:z},(()=>this.selectCharset("*"+z))),this._parser.registerEscHandler({intermediates:"+",final:z},(()=>this.selectCharset("+"+z))),this._parser.registerEscHandler({intermediates:"-",final:z},(()=>this.selectCharset("-"+z))),this._parser.registerEscHandler({intermediates:".",final:z},(()=>this.selectCharset("."+z))),this._parser.registerEscHandler({intermediates:"/",final:z},(()=>this.selectCharset("/"+z)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((z=>(this._logService.error("Parsing error: ",z),z))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new T.DcsHandler(((z,oe)=>this.requestStatusString(z,oe))))}_preserveStack(O,H,L,B){this._parseStack.paused=!0,this._parseStack.cursorStartX=O,this._parseStack.cursorStartY=H,this._parseStack.decodedLength=L,this._parseStack.position=B}_logSlowResolvingAsync(O){this._logService.logLevel<=R.LogLevelEnum.WARN&&Promise.race([O,new Promise(((H,L)=>setTimeout((()=>L("#SLOW_TIMEOUT")),5e3)))]).catch((H=>{if(H!=="#SLOW_TIMEOUT")throw H;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(O,H){let L,B=this._activeBuffer.x,V=this._activeBuffer.y,Q=0;const ue=this._parseStack.paused;if(ue){if(L=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,H))return this._logSlowResolvingAsync(L),L;B=this._parseStack.cursorStartX,V=this._parseStack.cursorStartY,this._parseStack.paused=!1,O.length>q&&(Q=this._parseStack.position+q)}if(this._logService.logLevel<=R.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof O=="string"?` "${O}"`:` "${Array.prototype.map.call(O,(z=>String.fromCharCode(z))).join("")}"`),typeof O=="string"?O.split("").map((z=>z.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=Q;z<O.length;z+=q){const oe=z+q<O.length?z+q:O.length,ae=typeof O=="string"?this._stringDecoder.decode(O.substring(z,oe),this._parseBuffer):this._utf8Decoder.decode(O.subarray(z,oe),this._parseBuffer);if(L=this._parser.parse(this._parseBuffer,ae))return this._preserveStack(B,V,ae,z),this._logSlowResolvingAsync(L),L}else if(!ue){const z=typeof O=="string"?this._stringDecoder.decode(O,this._parseBuffer):this._utf8Decoder.decode(O,this._parseBuffer);if(L=this._parser.parse(this._parseBuffer,z))return this._preserveStack(B,V,z,0),this._logSlowResolvingAsync(L),L}this._activeBuffer.x===B&&this._activeBuffer.y===V||this._onCursorMove.fire();const fe=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(fe,this._bufferService.rows-1))}print(O,H,L){let B,V;const Q=this._charsetService.charset,ue=this._optionsService.rawOptions.screenReaderMode,fe=this._bufferService.cols,Y=this._coreService.decPrivateModes.wraparound,z=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&&L-H>0&&ae.getWidth(this._activeBuffer.x-1)===2&&ae.setCellFromCodepoint(this._activeBuffer.x-1,0,1,oe);let we=this._parser.precedingJoinState;for(let Ee=H;Ee<L;++Ee){if(B=O[Ee],B<127&&Q){const Fe=Q[String.fromCharCode(B)];Fe&&(B=Fe.charCodeAt(0))}const Ue=this._unicodeService.charProperties(B,we);V=M.UnicodeService.extractWidth(Ue);const $e=M.UnicodeService.extractShouldJoin(Ue),We=$e?M.UnicodeService.extractWidth(we):0;if(we=Ue,ue&&this._onA11yChar.fire((0,C.stringFromCodePoint)(B)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+V-We>fe){if(Y){const Fe=ae;let Ne=this._activeBuffer.x-We;for(this._activeBuffer.x=We,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),We>0&&ae instanceof y.BufferLine&&ae.copyCellsFrom(Fe,Ne,0,We,!1);Ne<fe;)Fe.setCellFromCodepoint(Ne++,0,1,oe)}else if(this._activeBuffer.x=fe-1,V===2)continue}if($e&&this._activeBuffer.x){const Fe=ae.getWidth(this._activeBuffer.x-1)?1:2;ae.addCodepointToCell(this._activeBuffer.x-Fe,B,V);for(let Ne=V-We;--Ne>=0;)ae.setCellFromCodepoint(this._activeBuffer.x++,0,0,oe)}else if(z&&(ae.insertCells(this._activeBuffer.x,V-We,this._activeBuffer.getNullCell(oe)),ae.getWidth(fe-1)===2&&ae.setCellFromCodepoint(fe-1,m.NULL_CELL_CODE,m.NULL_CELL_WIDTH,oe)),ae.setCellFromCodepoint(this._activeBuffer.x++,B,V,oe),V>0)for(;--V;)ae.setCellFromCodepoint(this._activeBuffer.x++,0,0,oe)}this._parser.precedingJoinState=we,this._activeBuffer.x<fe&&L-H>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,H){return O.final!=="t"||O.prefix||O.intermediates?this._parser.registerCsiHandler(O,H):this._parser.registerCsiHandler(O,(L=>!W(L.params[0],this._optionsService.rawOptions.windowOptions)||H(L)))}registerDcsHandler(O,H){return this._parser.registerDcsHandler(O,new T.DcsHandler(H))}registerEscHandler(O,H){return this._parser.registerEscHandler(O,H)}registerOscHandler(O,H){return this._parser.registerOscHandler(O,new j.OscHandler(H))}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 H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);H.hasWidth(this._activeBuffer.x)&&!H.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,H){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=O,this._activeBuffer.y=this._activeBuffer.scrollTop+H):(this._activeBuffer.x=O,this._activeBuffer.y=H),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(O,H){this._restrictCursor(),this._setCursor(this._activeBuffer.x+O,this._activeBuffer.y+H)}cursorUp(O){const H=this._activeBuffer.y-this._activeBuffer.scrollTop;return H>=0?this._moveCursor(0,-Math.min(H,O.params[0]||1)):this._moveCursor(0,-(O.params[0]||1)),!0}cursorDown(O){const H=this._activeBuffer.scrollBottom-this._activeBuffer.y;return H>=0?this._moveCursor(0,Math.min(H,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 H=O.params[0];return H===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:H===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(O){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let H=O.params[0]||1;for(;H--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(O){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let H=O.params[0]||1;for(;H--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(O){const H=O.params[0];return H===1&&(this._curAttrData.bg|=536870912),H!==2&&H!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(O,H,L,B=!1,V=!1){const Q=this._activeBuffer.lines.get(this._activeBuffer.ybase+O);Q.replaceCells(H,L,this._activeBuffer.getNullCell(this._eraseAttrData()),V),B&&(Q.isWrapped=!1)}_resetBufferLine(O,H=!1){const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+O);L&&(L.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),H),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+O),L.isWrapped=!1)}eraseInDisplay(O,H=!1){let L;switch(this._restrictCursor(this._bufferService.cols),O.params[0]){case 0:for(L=this._activeBuffer.y,this._dirtyRowTracker.markDirty(L),this._eraseInBufferLine(L++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,H);L<this._bufferService.rows;L++)this._resetBufferLine(L,H);this._dirtyRowTracker.markDirty(L);break;case 1:for(L=this._activeBuffer.y,this._dirtyRowTracker.markDirty(L),this._eraseInBufferLine(L,0,this._activeBuffer.x+1,!0,H),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(L+1).isWrapped=!1);L--;)this._resetBufferLine(L,H);this._dirtyRowTracker.markDirty(0);break;case 2:for(L=this._bufferService.rows,this._dirtyRowTracker.markDirty(L-1);L--;)this._resetBufferLine(L,H);this._dirtyRowTracker.markDirty(0);break;case 3:const B=this._activeBuffer.lines.length-this._bufferService.rows;B>0&&(this._activeBuffer.lines.trimStart(B),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-B,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-B,0),this._onScroll.fire(0))}return!0}eraseInLine(O,H=!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,H);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,H);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,H)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(O){this._restrictCursor();let H=O.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=this._activeBuffer.ybase+this._activeBuffer.y,B=this._bufferService.rows-1-this._activeBuffer.scrollBottom,V=this._bufferService.rows-1+this._activeBuffer.ybase-B+1;for(;H--;)this._activeBuffer.lines.splice(V-1,1),this._activeBuffer.lines.splice(L,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 H=O.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=this._activeBuffer.ybase+this._activeBuffer.y;let B;for(B=this._bufferService.rows-1-this._activeBuffer.scrollBottom,B=this._bufferService.rows-1+this._activeBuffer.ybase-B;H--;)this._activeBuffer.lines.splice(L,1),this._activeBuffer.lines.splice(B,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 H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return H&&(H.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 H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return H&&(H.deleteCells(this._activeBuffer.x,O.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(O){let H=O.params[0]||1;for(;H--;)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 H=O.params[0]||1;for(;H--;)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 H=O.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);B.deleteCells(0,H,this._activeBuffer.getNullCell(this._eraseAttrData())),B.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 H=O.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);B.insertCells(0,H,this._activeBuffer.getNullCell(this._eraseAttrData())),B.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 H=O.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);B.insertCells(this._activeBuffer.x,H,this._activeBuffer.getNullCell(this._eraseAttrData())),B.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 H=O.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);B.deleteCells(this._activeBuffer.x,H,this._activeBuffer.getNullCell(this._eraseAttrData())),B.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(O){this._restrictCursor();const H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return H&&(H.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 H=this._parser.precedingJoinState;if(!H)return!0;const L=O.params[0]||1,B=M.UnicodeService.extractWidth(H),V=this._activeBuffer.x-B,Q=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(V),ue=new Uint32Array(Q.length*L);let fe=0;for(let z=0;z<Q.length;){const oe=Q.codePointAt(z)||0;ue[fe++]=oe,z+=oe>65535?2:1}let Y=fe;for(let z=1;z<L;++z)ue.copyWithin(Y,0,fe),Y+=fe;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 H=0;H<O.length;H++)switch(O.params[H]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(O){for(let H=0;H<O.length;H++)switch(O.params[H]){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 H=0;H<O.length;H++)switch(O.params[H]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(O){for(let H=0;H<O.length;H++)switch(O.params[H]){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[H]===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,H){const L=this._coreService.decPrivateModes,{activeProtocol:B,activeEncoding:V}=this._coreMouseService,Q=this._coreService,{buffers:ue,cols:fe}=this._bufferService,{active:Y,alt:z}=ue,oe=this._optionsService.rawOptions,ae=$e=>$e?1:2,we=O.params[0];return Ee=we,Ue=H?we===2?4:we===4?ae(Q.modes.insertMode):we===12?3:we===20?ae(oe.convertEol):0:we===1?ae(L.applicationCursorKeys):we===3?oe.windowOptions.setWinLines?fe===80?2:fe===132?1:0:0:we===6?ae(L.origin):we===7?ae(L.wraparound):we===8?3:we===9?ae(B==="X10"):we===12?ae(oe.cursorBlink):we===25?ae(!Q.isCursorHidden):we===45?ae(L.reverseWraparound):we===66?ae(L.applicationKeypad):we===67?4:we===1e3?ae(B==="VT200"):we===1002?ae(B==="DRAG"):we===1003?ae(B==="ANY"):we===1004?ae(L.sendFocus):we===1005?4:we===1006?ae(V==="SGR"):we===1015?4:we===1016?ae(V==="SGR_PIXELS"):we===1048?1:we===47||we===1047||we===1049?ae(Y===z):we===2004?ae(L.bracketedPasteMode):0,Q.triggerDataEvent(`${f.C0.ESC}[${H?"":"?"}${Ee};${Ue}$y`),!0;var Ee,Ue}_updateAttrColor(O,H,L,B,V){return H===2?(O|=50331648,O&=-16777216,O|=k.AttributeData.fromColorRGB([L,B,V])):H===5&&(O&=-50331904,O|=33554432|255&L),O}_extractColor(O,H,L){const B=[0,0,-1,0,0,0];let V=0,Q=0;do{if(B[Q+V]=O.params[H+Q],O.hasSubParams(H+Q)){const ue=O.getSubParams(H+Q);let fe=0;do B[1]===5&&(V=1),B[Q+fe+1+V]=ue[fe];while(++fe<ue.length&&fe+Q+1+V<B.length);break}if(B[1]===5&&Q+V>=2||B[1]===2&&Q+V>=5)break;B[1]&&(V=1)}while(++Q+H<O.length&&Q+V<B.length);for(let ue=2;ue<B.length;++ue)B[ue]===-1&&(B[ue]=0);switch(B[0]){case 38:L.fg=this._updateAttrColor(L.fg,B[1],B[3],B[4],B[5]);break;case 48:L.bg=this._updateAttrColor(L.bg,B[1],B[3],B[4],B[5]);break;case 58:L.extended=L.extended.clone(),L.extended.underlineColor=this._updateAttrColor(L.extended.underlineColor,B[1],B[3],B[4],B[5])}return Q}_processUnderline(O,H){H.extended=H.extended.clone(),(!~O||O>5)&&(O=1),H.extended.underlineStyle=O,H.fg|=268435456,O===0&&(H.fg&=-268435457),H.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 H=O.length;let L;const B=this._curAttrData;for(let V=0;V<H;V++)L=O.params[V],L>=30&&L<=37?(B.fg&=-50331904,B.fg|=16777216|L-30):L>=40&&L<=47?(B.bg&=-50331904,B.bg|=16777216|L-40):L>=90&&L<=97?(B.fg&=-50331904,B.fg|=16777224|L-90):L>=100&&L<=107?(B.bg&=-50331904,B.bg|=16777224|L-100):L===0?this._processSGR0(B):L===1?B.fg|=134217728:L===3?B.bg|=67108864:L===4?(B.fg|=268435456,this._processUnderline(O.hasSubParams(V)?O.getSubParams(V)[0]:1,B)):L===5?B.fg|=536870912:L===7?B.fg|=67108864:L===8?B.fg|=1073741824:L===9?B.fg|=2147483648:L===2?B.bg|=134217728:L===21?this._processUnderline(2,B):L===22?(B.fg&=-134217729,B.bg&=-134217729):L===23?B.bg&=-67108865:L===24?(B.fg&=-268435457,this._processUnderline(0,B)):L===25?B.fg&=-536870913:L===27?B.fg&=-67108865:L===28?B.fg&=-1073741825:L===29?B.fg&=2147483647:L===39?(B.fg&=-67108864,B.fg|=16777215&y.DEFAULT_ATTR_DATA.fg):L===49?(B.bg&=-67108864,B.bg|=16777215&y.DEFAULT_ATTR_DATA.bg):L===38||L===48||L===58?V+=this._extractColor(O,V,B):L===53?B.bg|=1073741824:L===55?B.bg&=-1073741825:L===59?(B.extended=B.extended.clone(),B.extended.underlineColor=-1,B.updateExtended()):L===100?(B.fg&=-67108864,B.fg|=16777215&y.DEFAULT_ATTR_DATA.fg,B.bg&=-67108864,B.bg|=16777215&y.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",L);return!0}deviceStatus(O){switch(O.params[0]){case 5:this._coreService.triggerDataEvent(`${f.C0.ESC}[0n`);break;case 6:const H=this._activeBuffer.y+1,L=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${f.C0.ESC}[${H};${L}R`)}return!0}deviceStatusPrivate(O){if(O.params[0]===6){const H=this._activeBuffer.y+1,L=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${f.C0.ESC}[?${H};${L}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 H=O.params[0]||1;switch(H){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 L=H%2==1;return this._optionsService.options.cursorBlink=L,!0}setScrollRegion(O){const H=O.params[0]||1;let L;return(O.length<2||(L=O.params[1])>this._bufferService.rows||L===0)&&(L=this._bufferService.rows),L>H&&(this._activeBuffer.scrollTop=H-1,this._activeBuffer.scrollBottom=L-1,this._setCursor(0,0)),!0}windowOptions(O){if(!W(O.params[0],this._optionsService.rawOptions.windowOptions))return!0;const H=O.length>1?O.params[1]:0;switch(O.params[0]){case 14:H!==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:H!==0&&H!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),H!==0&&H!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:H!==0&&H!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),H!==0&&H!==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 H=[],L=O.split(";");for(;L.length>1;){const B=L.shift(),V=L.shift();if(/^\d+$/.exec(B)){const Q=parseInt(B);if(G(Q))if(V==="?")H.push({type:0,index:Q});else{const ue=(0,D.parseColor)(V);ue&&H.push({type:1,index:Q,color:ue})}}}return H.length&&this._onColor.fire(H),!0}setHyperlink(O){const H=O.split(";");return!(H.length<2)&&(H[1]?this._createHyperlink(H[0],H[1]):!H[0]&&this._finishHyperlink())}_createHyperlink(O,H){this._getCurrentLinkId()&&this._finishHyperlink();const L=O.split(":");let B;const V=L.findIndex((Q=>Q.startsWith("id=")));return V!==-1&&(B=L[V].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:B,uri:H}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(O,H){const L=O.split(";");for(let B=0;B<L.length&&!(H>=this._specialColors.length);++B,++H)if(L[B]==="?")this._onColor.fire([{type:0,index:this._specialColors[H]}]);else{const V=(0,D.parseColor)(L[B]);V&&this._onColor.fire([{type:1,index:this._specialColors[H],color:V}])}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 H=[],L=O.split(";");for(let B=0;B<L.length;++B)if(/^\d+$/.exec(L[B])){const V=parseInt(L[B]);G(V)&&H.push({type:2,index:V})}return H.length&&this._onColor.fire(H),!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 _.CellData;O.content=4194373,O.fg=this._curAttrData.fg,O.bg=this._curAttrData.bg,this._setCursor(0,0);for(let H=0;H<this._bufferService.rows;++H){const L=this._activeBuffer.ybase+this._activeBuffer.y+H,B=this._activeBuffer.lines.get(L);B&&(B.fill(O),B.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(O,H){const L=this._bufferService.buffer,B=this._optionsService.rawOptions;return(V=>(this._coreService.triggerDataEvent(`${f.C0.ESC}${V}${f.C0.ESC}\\`),!0))(O==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:O==='"p'?'P1$r61;1"p':O==="r"?`P1$r${L.scrollTop+1};${L.scrollBottom+1}r`:O==="m"?"P1$r0m":O===" q"?`P1$r${{block:2,underline:4,bar:6}[B.cursorStyle]-(B.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(O,H){this._dirtyRowTracker.markRangeDirty(O,H)}}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&&(Z=J,J=O,O=Z),J<this.start&&(this.start=J),O>this.end&&(this.end=O)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function G(J){return 0<=J&&J<256}F=v([S(0,R.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 A=0,C=0,y=E.timeRemaining(),b=0;for(;this._i<this._tasks.length;){if(A=Date.now(),this._tasks[this._i]()||this._i++,A=Math.max(1,Date.now()-A),C=Math.max(A,C),b=E.timeRemaining(),1.5*C>b)return y-A<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(y-A))}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 A=Date.now()+E;return{timeRemaining:()=>Math.max(0,A-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),A=h(511),C=h(643),y=h(4863),b=h(7116);c.MAX_BUFFER_SIZE=4294967295,c.Buffer=class{constructor(m,_,k){this._hasScrollback=m,this._optionsService=_,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=A.CellData.fromCharData([0,C.NULL_CELL_CHAR,C.NULL_CELL_WIDTH,C.NULL_CELL_CODE]),this._whitespaceCell=A.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,_){return new x.BufferLine(this._bufferService.cols,this.getNullCell(m),_)}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 _=m+this._optionsService.rawOptions.scrollback;return _>c.MAX_BUFFER_SIZE?c.MAX_BUFFER_SIZE:_}fillViewportRows(m){if(this.lines.length===0){m===void 0&&(m=x.DEFAULT_ATTR_DATA);let _=this._rows;for(;_--;)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,_){const k=this.getNullCell(x.DEFAULT_ATTR_DATA);let R=0;const M=this._getCorrectBufferLength(_);if(M>this.lines.maxLength&&(this.lines.maxLength=M),this.lines.length>0){if(this._cols<m)for(let T=0;T<this.lines.length;T++)R+=+this.lines.get(T).resize(m,k);let j=0;if(this._rows<_)for(let T=this._rows;T<_;T++)this.lines.length<_+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 T=this._rows;T>_;T--)this.lines.length>_+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(M<this.lines.maxLength){const T=this.lines.length-M;T>0&&(this.lines.trimStart(T),this.ybase=Math.max(this.ybase-T,0),this.ydisp=Math.max(this.ydisp-T,0),this.savedY=Math.max(this.savedY-T,0)),this.lines.maxLength=M}this.x=Math.min(this.x,m-1),this.y=Math.min(this.y,_-1),j&&(this.y+=j),this.savedX=Math.min(this.savedX,m-1),this.scrollTop=0}if(this.scrollBottom=_-1,this._isReflowEnabled&&(this._reflow(m,_),this._cols>m))for(let j=0;j<this.lines.length;j++)R+=+this.lines.get(j).resize(m,k);this._cols=m,this._rows=_,this._memoryCleanupQueue.clear(),R>.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 _=0;for(;this._memoryCleanupPosition<this.lines.length;)if(_+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),_>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,_){this._cols!==m&&(m>this._cols?this._reflowLarger(m,_):this._reflowSmaller(m,_))}_reflowLarger(m,_){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 R=(0,E.reflowLargerCreateNewLayout)(this.lines,k);(0,E.reflowLargerApplyNewLayout)(this.lines,R.layout),this._reflowLargerAdjustViewport(m,_,R.countRemoved)}}_reflowLargerAdjustViewport(m,_,k){const R=this.getNullCell(x.DEFAULT_ATTR_DATA);let M=k;for(;M-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<_&&this.lines.push(new x.BufferLine(m,R))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-k,0)}_reflowSmaller(m,_){const k=this.getNullCell(x.DEFAULT_ATTR_DATA),R=[];let M=0;for(let j=this.lines.length-1;j>=0;j--){let T=this.lines.get(j);if(!T||!T.isWrapped&&T.getTrimmedLength()<=m)continue;const D=[T];for(;T.isWrapped&&j>0;)T=this.lines.get(--j),D.unshift(T);const I=this.ybase+this.y;if(I>=j&&I<j+D.length)continue;const q=D[D.length-1].getTrimmedLength(),W=(0,E.reflowSmallerGetNewLineLengths)(D,this._cols,m),U=W.length-D.length;let Z;Z=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 L=0;L<U;L++){const B=this.getBlankLine(x.DEFAULT_ATTR_DATA,!0);se.push(B)}se.length>0&&(R.push({start:j+D.length+M,newLines:se}),M+=se.length),D.push(...se);let F=W.length-1,G=W[F];G===0&&(F--,G=W[F]);let J=D.length-U-1,O=q;for(;J>=0;){const L=Math.min(O,G);if(D[F]===void 0)break;if(D[F].copyCellsFrom(D[J],O-L,G-L,L,!0),G-=L,G===0&&(F--,G=W[F]),O-=L,O===0){J--;const B=Math.max(J,0);O=(0,E.getWrappedLineTrimmedLength)(D,B,this._cols)}}for(let L=0;L<D.length;L++)W[L]<m&&D[L].setCell(W[L],k);let H=U-Z;for(;H-- >0;)this.ybase===0?this.y<_-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+M)-_&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+U,this.ybase+_-1)}if(R.length>0){const j=[],T=[];for(let F=0;F<this.lines.length;F++)T.push(this.lines.get(F));const D=this.lines.length;let I=D-1,q=0,W=R[q];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+M);let U=0;for(let F=Math.min(this.lines.maxLength-1,D+M-1);F>=0;F--)if(W&&W.start>I+U){for(let G=W.newLines.length-1;G>=0;G--)this.lines.set(F--,W.newLines[G]);F++,j.push({index:I+1,amount:W.newLines.length}),U+=W.newLines.length,W=R[++q]}else this.lines.set(F,T[I--]);let Z=0;for(let F=j.length-1;F>=0;F--)j[F].index+=Z,this.lines.onInsertEmitter.fire(j[F]),Z+=j[F].amount;const se=Math.max(0,D+M-this.lines.maxLength);se>0&&this.lines.onTrimEmitter.fire(se)}}translateBufferLineToString(m,_,k=0,R){const M=this.lines.get(m);return M?M.translateToString(_,k,R):""}getWrappedRangeForLine(m){let _=m,k=m;for(;_>0&&this.lines.get(_).isWrapped;)_--;for(;k+1<this.lines.length&&this.lines.get(k+1).isWrapped;)k++;return{first:_,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 _=0;_<this.markers.length;_++)this.markers[_].line===m&&(this.markers[_].dispose(),this.markers.splice(_--,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 _=new y.Marker(m);return this.markers.push(_),_.register(this.lines.onTrim((k=>{_.line-=k,_.line<0&&_.dispose()}))),_.register(this.lines.onInsert((k=>{_.line>=k.index&&(_.line+=k.amount)}))),_.register(this.lines.onDelete((k=>{_.line>=k.index&&_.line<k.index+k.amount&&_.dispose(),_.line>k.index&&(_.line-=k.amount)}))),_.register(_.onDispose((()=>this._removeMarker(_)))),_}_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 A{constructor(y,b,m=!1){this.isWrapped=m,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*y);const _=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,_);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,_){268435456&_.bg&&(this._extendedAttrs[y]=_.extended),this._data[3*y+0]=b|m<<22,this._data[3*y+1]=_.fg,this._data[3*y+2]=_.bg}addCodepointToCell(y,b,m){let _=this._data[3*y+0];2097152&_?this._combined[y]+=(0,x.stringFromCodePoint)(b):2097151&_?(this._combined[y]=(0,x.stringFromCodePoint)(2097151&_)+(0,x.stringFromCodePoint)(b),_&=-2097152,_|=2097152):_=b|4194304,m&&(_&=-12582913,_|=m<<22),this._data[3*y+0]=_}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 _=new S.CellData;for(let k=this.length-y-b-1;k>=0;--k)this.setCell(y+b+k,this.loadCell(y+k,_));for(let k=0;k<b;++k)this.setCell(y+k,m)}else for(let _=y;_<this.length;++_)this.setCell(_,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 _=new S.CellData;for(let k=0;k<this.length-y-b;++k)this.setCell(y+k,this.loadCell(y+b+k,_));for(let k=this.length-b;k<this.length;++k)this.setCell(k,m)}else for(let _=y;_<this.length;++_)this.setCell(_,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,_=!1){if(_)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 _=new Uint32Array(m);_.set(this._data),this._data=_}for(let _=this.length;_<y;++_)this.setCell(_,b)}else{this._data=this._data.subarray(0,m);const _=Object.keys(this._combined);for(let R=0;R<_.length;R++){const M=parseInt(_[R],10);M>=y&&delete this._combined[M]}const k=Object.keys(this._extendedAttrs);for(let R=0;R<k.length;R++){const M=parseInt(k[R],10);M>=y&&delete this._extendedAttrs[M]}}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 A(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,_,k){const R=y._data;if(k)for(let j=_-1;j>=0;j--){for(let T=0;T<3;T++)this._data[3*(m+j)+T]=R[3*(b+j)+T];268435456&R[3*(b+j)+2]&&(this._extendedAttrs[m+j]=y._extendedAttrs[b+j])}else for(let j=0;j<_;j++){for(let T=0;T<3;T++)this._data[3*(m+j)+T]=R[3*(b+j)+T];268435456&R[3*(b+j)+2]&&(this._extendedAttrs[m+j]=y._extendedAttrs[b+j])}const M=Object.keys(y._combined);for(let j=0;j<M.length;j++){const T=parseInt(M[j],10);T>=b&&(this._combined[T-b+m]=y._combined[T])}}translateToString(y,b,m,_){b=b??0,m=m??this.length,y&&(m=Math.min(m,this.getTrimmedLength())),_&&(_.length=0);let k="";for(;b<m;){const R=this._data[3*b+0],M=2097151&R,j=2097152&R?this._combined[b]:M?(0,x.stringFromCodePoint)(M):f.WHITESPACE_CELL_CHAR;if(k+=j,_)for(let T=0;T<j.length;++T)_.push(b);b+=R>>22||1}return _&&_.push(b),k}}c.BufferLine=A},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 A=[];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 _=0,k=h(m,_,S),R=1,M=0;for(;R<m.length;){const T=h(m,R,S),D=T-M,I=f-k,q=Math.min(D,I);m[_].copyCellsFrom(m[R],M,k,q,!1),k+=q,k===f&&(_++,k=0),M+=q,M===T&&(R++,M=0),k===0&&_!==0&&m[_-1].getWidth(f-1)===2&&(m[_].copyCellsFrom(m[_-1],f-1,k++,1,!1),m[_-1].setCell(f-1,E))}m[_].replaceCells(k,f,E);let j=0;for(let T=m.length-1;T>0&&(T>_||m[T].getTrimmedLength()===0);T--)j++;j>0&&(A.push(C+m.length-j),A.push(j)),C+=m.length-1}return A},c.reflowLargerCreateNewLayout=function(v,S){const f=[];let x=0,E=S[x],A=0;for(let C=0;C<v.length;C++)if(E===C){const y=S[++x];v.onDeleteEmitter.fire({index:C-A,amount:y}),C+=y-1,A+=y,E=S[++x]}else f.push(C);return{layout:f,countRemoved:A}},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 A=0,C=0,y=0;for(;y<E;){if(E-y<f){x.push(E-y);break}A+=f;const b=h(v,C,S);A>b&&(A-=b,C++);const m=v[C].getWidth(A-1)===2;m&&A--;const _=m?f-1:f;x.push(_),y+=_}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(A,C){super(),this._optionsService=A,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(A){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(A),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(A,C){this._normal.resize(A,C),this._alt.resize(A,C),this.setupTabStops(A)}setupTabStops(A){this._normal.setupTabStops(A),this._alt.setupTabStops(A)}}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(A){const C=new x;return C.setFromCharData(A),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(A){this.fg=A[S.CHAR_DATA_ATTR_INDEX],this.bg=0;let C=!1;if(A[S.CHAR_DATA_CHAR_INDEX].length>2)C=!0;else if(A[S.CHAR_DATA_CHAR_INDEX].length===2){const y=A[S.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=y&&y<=56319){const b=A[S.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=b&&b<=57343?this.content=1024*(y-55296)+b-56320+65536|A[S.CHAR_DATA_WIDTH_INDEX]<<22:C=!0}else C=!0}else this.content=A[S.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|A[S.CHAR_DATA_WIDTH_INDEX]<<22;C&&(this.combinedData=A[S.CHAR_DATA_CHAR_INDEX],this.content=2097152|A[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=`
457
- `,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,A){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&&!A||!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 _=f.ctrlKey?f.keyCode-64:f.keyCode+32;let k=String.fromCharCode(_);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 _=f.code.slice(3,4);f.shiftKey||(_=_.toLowerCase()),C.key=v.C0.ESC+_,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 A=h.charCodeAt(E);if(55296<=A&&A<=56319){if(++E>=S)return this._interim=A,f;const C=h.charCodeAt(E);56320<=C&&C<=57343?v[f++]=1024*(A-55296)+C-56320+65536:(v[f++]=A,v[f++]=C)}else A!==65279&&(v[f++]=A)}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,A,C=0,y=0,b=0;if(this.interim[0]){let k=!1,R=this.interim[0];R&=(224&R)==192?31:(240&R)==224?15:7;let M,j=0;for(;(M=63&this.interim[++j])&&j<4;)R<<=6,R|=M;const T=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,D=T-j;for(;b<D;){if(b>=S)return 0;if(M=h[b++],(192&M)!=128){b--,k=!0;break}this.interim[j++]=M,R<<=6,R|=63&M}k||(T===2?R<128?b--:v[C++]=R:T===3?R<2048||R>=55296&&R<=57343||R===65279||(v[C++]=R):R<65536||R>1114111||(v[C++]=R)),this.interim.fill(0)}const m=S-4;let _=b;for(;_<S;){for(;!(!(_<m)||128&(f=h[_])||128&(x=h[_+1])||128&(E=h[_+2])||128&(A=h[_+3]));)v[C++]=f,v[C++]=x,v[C++]=E,v[C++]=A,_+=4;if(f=h[_++],f<128)v[C++]=f;else if((224&f)==192){if(_>=S)return this.interim[0]=f,C;if(x=h[_++],(192&x)!=128){_--;continue}if(y=(31&f)<<6|63&x,y<128){_--;continue}v[C++]=y}else if((240&f)==224){if(_>=S)return this.interim[0]=f,C;if(x=h[_++],(192&x)!=128){_--;continue}if(_>=S)return this.interim[0]=f,this.interim[1]=x,C;if(E=h[_++],(192&E)!=128){_--;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(_>=S)return this.interim[0]=f,C;if(x=h[_++],(192&x)!=128){_--;continue}if(_>=S)return this.interim[0]=f,this.interim[1]=x,C;if(E=h[_++],(192&E)!=128){_--;continue}if(_>=S)return this.interim[0]=f,this.interim[1]=x,this.interim[2]=E,C;if(A=h[_++],(192&A)!=128){_--;continue}if(y=(7&f)<<18|(63&x)<<12|(63&E)<<6|63&A,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(A,C){let y,b=0,m=C.length-1;if(A<C[0][0]||A>C[m][1])return!1;for(;m>=b;)if(y=b+m>>1,A>C[y][1])b=y+1;else{if(!(A<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,A){let C=this.wcwidth(E),y=C===0&&A!==0;if(y){const b=v.UnicodeService.extractWidth(A);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,A){if(A!==void 0&&this._syncCalls>A)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,A){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(A),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=E.length,this._writeBuffer.push(E),this._callbacks.push(A)}_innerWrite(E=0,A=!0){const C=E||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const y=this._writeBuffer[this._bufferOffset],b=this._action(y,A);if(b){const _=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(_)}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),A=E.length<2?"0"+E:E;switch(x){case 4:return E[0];case 8:return A;case 12:return(A+A).slice(0,3);default:return A+A}}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 A=E[1]?15:E[4]?255:E[7]?4095:65535;return[Math.round(parseInt(E[1]||E[4]||E[7]||E[10],16)/A*255),Math.round(parseInt(E[2]||E[5]||E[8]||E[11],16)/A*255),Math.round(parseInt(E[3]||E[6]||E[9]||E[12],16)/A*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,A=[0,0,0];for(let C=0;C<3;++C){const y=parseInt(x.slice(E*C,E*C+E),16);A[C]=E===1?y<<4:E===2?y:E===3?y>>4:y>>8}return A}},c.toRgbString=function(f,x=16){const[E,A,C]=f;return`rgb:${S(E,x)}/${S(A,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(A,C){this._handlers[A]===void 0&&(this._handlers[A]=[]);const y=this._handlers[A];return y.push(C),{dispose:()=>{const b=y.indexOf(C);b!==-1&&y.splice(b,1)}}}clearHandler(A){this._handlers[A]&&delete this._handlers[A]}setHandlerFallback(A){this._handlerFb=A}reset(){if(this._active.length)for(let A=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;A>=0;--A)this._active[A].unhook(!1);this._stack.paused=!1,this._active=x,this._ident=0}hook(A,C){if(this.reset(),this._ident=A,this._active=this._handlers[A]||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(A,C,y){if(this._active.length)for(let b=this._active.length-1;b>=0;b--)this._active[b].put(A,C,y);else this._handlerFb(this._ident,"PUT",(0,v.utf32ToString)(A,C,y))}unhook(A,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(A),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",A);this._active=x,this._ident=0}};const E=new S.Params;E.addParam(0),c.DcsHandler=class{constructor(A){this._handler=A,this._data="",this._params=E,this._hitLimit=!1}hook(A){this._params=A.length>1||A.params[0]?A.clone():E,this._data="",this._hitLimit=!1}put(A,C,y){this._hitLimit||(this._data+=(0,v.utf32ToString)(A,C,y),this._data.length>f.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(A){let C=!1;if(this._hitLimit)C=!1;else if(A&&(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,_,k){this.table[m<<8|b]=_<<4|k}addMany(b,m,_,k){for(let R=0;R<b.length;R++)this.table[m<<8|b[R]]=_<<4|k}}c.TransitionTable=E;const A=160;c.VT500_TRANSITION_TABLE=(function(){const y=new E(4095),b=Array.apply(null,Array(256)).map(((j,T)=>T)),m=(j,T)=>b.slice(j,T),_=m(32,127),k=m(0,24);k.push(25),k.push.apply(k,m(28,32));const R=m(0,14);let M;for(M in y.setDefault(1,0),y.addMany(_,0,2,0),R)y.addMany([24,26,153,154],M,3,0),y.addMany(m(128,144),M,3,0),y.addMany(m(144,152),M,3,0),y.add(156,M,0,0),y.add(27,M,11,1),y.add(157,M,4,8),y.addMany([152,158,159],M,0,7),y.add(155,M,11,3),y.add(144,M,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(_,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(_,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(_,13,13,13),y.add(127,13,0,13),y.addMany([27,156,24,26],13,14,0),y.add(A,0,2,0),y.add(A,8,5,8),y.add(A,6,0,6),y.add(A,11,0,11),y.add(A,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,_,k)=>{},this._executeHandlerFb=m=>{},this._csiHandlerFb=(m,_)=>{},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 _=0;if(b.prefix){if(b.prefix.length>1)throw new Error("only one byte as prefix supported");if(_=b.prefix.charCodeAt(0),_&&60>_||_>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 R=0;R<b.intermediates.length;++R){const M=b.intermediates.charCodeAt(R);if(32>M||M>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");_<<=8,_|=M}}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 _<<=8,_|=k,_}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 _=this._identifier(b,[48,126]);this._escHandlers[_]===void 0&&(this._escHandlers[_]=[]);const k=this._escHandlers[_];return k.push(m),{dispose:()=>{const R=k.indexOf(m);R!==-1&&k.splice(R,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 _=this._identifier(b);this._csiHandlers[_]===void 0&&(this._csiHandlers[_]=[]);const k=this._csiHandlers[_];return k.push(m),{dispose:()=>{const R=k.indexOf(m);R!==-1&&k.splice(R,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,_,k,R){this._parseStack.state=b,this._parseStack.handlers=m,this._parseStack.handlerPos=_,this._parseStack.transition=k,this._parseStack.chunkPos=R}parse(b,m,_){let k,R=0,M=0,j=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,j=this._parseStack.chunkPos+1;else{if(_===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const T=this._parseStack.handlers;let D=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(_===!1&&D>-1){for(;D>=0&&(k=T[D](this._params),k!==!0);D--)if(k instanceof Promise)return this._parseStack.handlerPos=D,k}this._parseStack.handlers=[];break;case 4:if(_===!1&&D>-1){for(;D>=0&&(k=T[D](),k!==!0);D--)if(k instanceof Promise)return this._parseStack.handlerPos=D,k}this._parseStack.handlers=[];break;case 6:if(R=b[this._parseStack.chunkPos],k=this._dcsParser.unhook(R!==24&&R!==26,_),k)return k;R===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(R=b[this._parseStack.chunkPos],k=this._oscParser.end(R!==24&&R!==26,_),k)return k;R===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 T=j;T<m;++T){switch(R=b[T],M=this._transitions.table[this.currentState<<8|(R<160?R:A)],M>>4){case 2:for(let U=T+1;;++U){if(U>=m||(R=b[U])<32||R>126&&R<A){this._printHandler(b,T,U),T=U-1;break}if(++U>=m||(R=b[U])<32||R>126&&R<A){this._printHandler(b,T,U),T=U-1;break}if(++U>=m||(R=b[U])<32||R>126&&R<A){this._printHandler(b,T,U),T=U-1;break}if(++U>=m||(R=b[U])<32||R>126&&R<A){this._printHandler(b,T,U),T=U-1;break}}break;case 3:this._executeHandlers[R]?this._executeHandlers[R]():this._executeHandlerFb(R),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:T,code:R,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const D=this._csiHandlers[this._collect<<8|R];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,M,T),k;I<0&&this._csiHandlerFb(this._collect<<8|R,this._params),this.precedingJoinState=0;break;case 8:do switch(R){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(R-48)}while(++T<m&&(R=b[T])>47&&R<60);T--;break;case 9:this._collect<<=8,this._collect|=R;break;case 10:const q=this._escHandlers[this._collect<<8|R];let W=q?q.length-1:-1;for(;W>=0&&(k=q[W](),k!==!0);W--)if(k instanceof Promise)return this._preserveStack(4,q,W,M,T),k;W<0&&this._escHandlerFb(this._collect<<8|R),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|R,this._params);break;case 13:for(let U=T+1;;++U)if(U>=m||(R=b[U])===24||R===26||R===27||R>127&&R<A){this._dcsParser.put(b,T,U),T=U-1;break}break;case 14:if(k=this._dcsParser.unhook(R!==24&&R!==26),k)return this._preserveStack(6,[],0,M,T),k;R===27&&(M|=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=T+1;;U++)if(U>=m||(R=b[U])<32||R>127&&R<A){this._oscParser.put(b,T,U),T=U-1;break}break;case 6:if(k=this._oscParser.end(R!==24&&R!==26),k)return this._preserveStack(5,[],0,M,T),k;R===27&&(M|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&M}}}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 A=this._handlers[x];return A.push(E),{dispose:()=>{const C=A.indexOf(E);C!==-1&&A.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,A){if(this._active.length)for(let C=this._active.length-1;C>=0;C--)this._active[C].put(x,E,A);else this._handlerFb(this._id,"PUT",(0,S.utf32ToString)(x,E,A))}start(){this.reset(),this._state=1}put(x,E,A){if(this._state!==3){if(this._state===1)for(;E<A;){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&&A-E>0&&this._put(x,E,A)}}end(x,E=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let A=!1,C=this._active.length-1,y=!1;if(this._stack.paused&&(C=this._stack.loopPosition-1,A=E,y=this._stack.fallThrough,this._stack.paused=!1),!y&&A===!1){for(;C>=0&&(A=this._active[C].end(x),A!==!0);C--)if(A instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=C,this._stack.fallThrough=!1,A;C--}for(;C>=0;C--)if(A=this._active[C].end(!1),A instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=C,this._stack.fallThrough=!0,A}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,A){this._hitLimit||(this._data+=(0,S.utf32ToString)(x,E,A),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((A=>(this._data="",this._hitLimit=!1,A)));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 A=f[E];if(Array.isArray(A))for(let C=0;C<A.length;++C)x.addSubParam(A[C]);else x.addParam(A)}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,A=255&this._subParamsIdx[x];A-E>0&&f.push(Array.prototype.slice.call(this._subParams,E,A))}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,A=255&this._subParamsIdx[x];A-E>0&&(f[x]=this._subParams.slice(E,A))}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,A=E[x-1];E[x-1]=~A?Math.min(10*A+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(A){super(),this._core=A,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,_){var k,R=arguments.length,M=R<3?b:_===null?_=Object.getOwnPropertyDescriptor(b,m):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(y,b,m,_);else for(var j=y.length-1;j>=0;j--)(k=y[j])&&(M=(R<3?k(M):R>3?k(b,m,M):k(b,m))||M);return R>3&&M&&Object.defineProperty(b,m,M),M},S=this&&this.__param||function(y,b){return function(m,_){b(m,_,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),A=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 _;_=this._cachedBlankLine,_&&_.length===this.cols&&_.getFg(0)===y.fg&&_.getBg(0)===y.bg||(_=m.getBlankLine(y,b),this._cachedBlankLine=_),_.isWrapped=b;const k=m.ybase+m.scrollTop,R=m.ybase+m.scrollBottom;if(m.scrollTop===0){const M=m.lines.isFull;R===m.lines.length-1?M?m.lines.recycle().copyFrom(_):m.lines.push(_.clone()):m.lines.splice(R+1,0,_.clone()),M?this.isUserScrolling&&(m.ydisp=Math.max(m.ydisp-1,0)):(m.ybase++,this.isUserScrolling||m.ydisp++)}else{const M=R-k+1;m.lines.shiftElements(k+1,M-1,-1),m.lines.set(R,_.clone())}this.isUserScrolling||(m.ydisp=m.ybase),this._onScroll.fire(m.ydisp)}scrollLines(y,b,m){const _=this.buffer;if(y<0){if(_.ydisp===0)return;this.isUserScrolling=!0}else y+_.ydisp>=_.ybase&&(this.isUserScrolling=!1);const k=_.ydisp;_.ydisp=Math.max(Math.min(_.ydisp+y,_.ybase),0),k!==_.ydisp&&(b||this._onScroll.fire(_.ydisp))}};c.BufferService=C=v([S(0,A.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(_,k,R,M){var j,T=arguments.length,D=T<3?k:M===null?M=Object.getOwnPropertyDescriptor(k,R):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(_,k,R,M);else for(var I=_.length-1;I>=0;I--)(j=_[I])&&(D=(T<3?j(D):T>3?j(k,R,D):j(k,R))||D);return T>3&&D&&Object.defineProperty(k,R,D),D},S=this&&this.__param||function(_,k){return function(R,M){k(R,M,_)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CoreMouseService=void 0;const f=h(2585),x=h(8460),E=h(844),A={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:_=>_.button!==4&&_.action===1&&(_.ctrl=!1,_.alt=!1,_.shift=!1,!0)},VT200:{events:19,restrict:_=>_.action!==32},DRAG:{events:23,restrict:_=>_.action!==32||_.button!==3},ANY:{events:31,restrict:_=>!0}};function C(_,k){let R=(_.ctrl?16:0)|(_.shift?4:0)|(_.alt?8:0);return _.button===4?(R|=64,R|=_.action):(R|=3&_.button,4&_.button&&(R|=64),8&_.button&&(R|=128),_.action===32?R|=32:_.action!==0||k||(R|=3)),R}const y=String.fromCharCode,b={DEFAULT:_=>{const k=[C(_,!1)+32,_.col+32,_.row+32];return k[0]>255||k[1]>255||k[2]>255?"":`\x1B[M${y(k[0])}${y(k[1])}${y(k[2])}`},SGR:_=>{const k=_.action===0&&_.button!==4?"m":"M";return`\x1B[<${C(_,!0)};${_.col};${_.row}${k}`},SGR_PIXELS:_=>{const k=_.action===0&&_.button!==4?"m":"M";return`\x1B[<${C(_,!0)};${_.x};${_.y}${k}`}};let m=c.CoreMouseService=class extends E.Disposable{constructor(_,k){super(),this._bufferService=_,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 R of Object.keys(A))this.addProtocol(R,A[R]);for(const R of Object.keys(b))this.addEncoding(R,b[R]);this.reset()}addProtocol(_,k){this._protocols[_]=k}addEncoding(_,k){this._encodings[_]=k}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(_){if(!this._protocols[_])throw new Error(`unknown protocol "${_}"`);this._activeProtocol=_,this._onProtocolChange.fire(this._protocols[_].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(_){if(!this._encodings[_])throw new Error(`unknown encoding "${_}"`);this._activeEncoding=_}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(_){if(_.col<0||_.col>=this._bufferService.cols||_.row<0||_.row>=this._bufferService.rows||_.button===4&&_.action===32||_.button===3&&_.action!==32||_.button!==4&&(_.action===2||_.action===3)||(_.col++,_.row++,_.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,_,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(_))return!1;const k=this._encodings[this._activeEncoding](_);return k&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(k):this._coreService.triggerDataEvent(k,!0)),this._lastEvent=_,!0}explainEvents(_){return{down:!!(1&_),up:!!(2&_),drag:!!(4&_),move:!!(8&_),wheel:!!(16&_)}}_equalEvents(_,k,R){if(R){if(_.x!==k.x||_.y!==k.y)return!1}else if(_.col!==k.col||_.row!==k.row)return!1;return _.button===k.button&&_.action===k.action&&_.ctrl===k.ctrl&&_.alt===k.alt&&_.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,_,k,R){var M,j=arguments.length,T=j<3?_:R===null?R=Object.getOwnPropertyDescriptor(_,k):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(m,_,k,R);else for(var D=m.length-1;D>=0;D--)(M=m[D])&&(T=(j<3?M(T):j>3?M(_,k,T):M(_,k))||T);return j>3&&T&&Object.defineProperty(_,k,T),T},S=this&&this.__param||function(m,_){return function(k,R){_(k,R,m)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CoreService=void 0;const f=h(1439),x=h(8460),E=h(844),A=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,_,k){super(),this._bufferService=m,this._logService=_,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,_=!1){if(this._optionsService.rawOptions.disableStdin)return;const k=this._bufferService.buffer;_&&this._optionsService.rawOptions.scrollOnUserInput&&k.ybase!==k.ydisp&&this._onRequestScrollToBottom.fire(),_&&this._onUserInput.fire(),this._logService.debug(`sending data "${m}"`,(()=>m.split("").map((R=>R.charCodeAt(0))))),this._onData.fire(m)}triggerBinaryEvent(m){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${m}"`,(()=>m.split("").map((_=>_.charCodeAt(0))))),this._onBinary.fire(m))}};c.CoreService=b=v([S(0,A.IBufferService),S(1,A.ILogService),S(2,A.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,A=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 _=new y(m);if(_){const k=_.marker.onDispose((()=>_.dispose()));_.onDispose((()=>{_&&(this._decorations.delete(_)&&this._onDecorationRemoved.fire(_),k.dispose())})),this._decorations.insert(_),this._onDecorationRegistered.fire(_)}return _}reset(){for(const m of this._decorations.values())m.dispose();this._decorations.clear()}*getDecorationsAtCell(m,_,k){let R=0,M=0;for(const j of this._decorations.getKeyIterator(_))R=j.options.x??0,M=R+(j.options.width??1),m>=R&&m<M&&(!k||(j.options.layer??"bottom")===k)&&(yield j)}forEachDecorationAtCell(m,_,k,R){this._decorations.forEachByKey(_,(M=>{E=M.options.x??0,A=E+(M.options.width??1),m>=E&&m<A&&(!k||(M.options.layer??"bottom")===k)&&R(M)}))}}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[A,C]of E)this.set(A,C)}set(E,A){const C=this._entries.get(E);return this._entries.set(E,A),C}forEach(E){for(const[A,C]of this._entries.entries())E(A,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 A=(0,S.getServiceDependencies)(x).sort(((b,m)=>b.index-m.index)),C=[];for(const b of A){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=A.length>0?A[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,_){var k,R=arguments.length,M=R<3?b:_===null?_=Object.getOwnPropertyDescriptor(b,m):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(y,b,m,_);else for(var j=y.length-1;j>=0;j--)(k=y[j])&&(M=(R<3?k(M):R>3?k(b,m,M):k(b,m))||M);return R>3&&M&&Object.defineProperty(b,m,M),M},S=this&&this.__param||function(y,b){return function(m,_){b(m,_,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 A,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()))),A=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){A=y},c.traceCall=function(y,b,m){if(typeof m.value!="function")throw new Error("not supported");const _=m.value;m.value=function(...k){if(A.logLevel!==x.LogLevelEnum.TRACE)return _.apply(this,k);A.trace(`GlyphRenderer#${_.name}(${k.map((M=>JSON.stringify(M))).join(", ")})`);const R=_.apply(this,k);return A.trace(`GlyphRenderer#${_.name} return`,R),R}}},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,A,C,y){var b,m=arguments.length,_=m<3?A:y===null?y=Object.getOwnPropertyDescriptor(A,C):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(E,A,C,y);else for(var k=E.length-1;k>=0;k--)(b=E[k])&&(_=(m<3?b(_):m>3?b(A,C,_):b(A,C))||_);return m>3&&_&&Object.defineProperty(A,C,_),_},S=this&&this.__param||function(E,A){return function(C,y){A(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 A=this._bufferService.buffer;if(E.id===void 0){const k=A.addMarker(A.ybase+A.y),R={data:E,id:this._nextId++,lines:[k]};return k.onDispose((()=>this._removeMarkerFromLink(R,k))),this._dataByLinkId.set(R.id,R),R.id}const C=E,y=this._getEntryIdKey(C),b=this._entriesWithId.get(y);if(b)return this.addLineToLink(b.id,A.ybase+A.y),b.id;const m=A.addMarker(A.ybase+A.y),_={id:this._nextId++,key:this._getEntryIdKey(C),data:C,lines:[m]};return m.onDispose((()=>this._removeMarkerFromLink(_,m))),this._entriesWithId.set(_.key,_),this._dataByLinkId.set(_.id,_),_.id}addLineToLink(E,A){const C=this._dataByLinkId.get(E);if(C&&C.lines.every((y=>y.line!==A))){const y=this._bufferService.buffer.addMarker(A);C.lines.push(y),y.onDispose((()=>this._removeMarkerFromLink(C,y)))}}getLinkData(E){var A;return(A=this._dataByLinkId.get(E))==null?void 0:A.data}_getEntryIdKey(E){return`${E.id};;${E.uri}`}_removeMarkerFromLink(E,A){const C=E.lines.indexOf(A);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,A){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,A)};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,A,C=!1){return(16777215&E)<<3|(3&A)<<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 A=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 A+this.wcwidth(m);const R=E.charCodeAt(b);56320<=R&&R<=57343?m=1024*(m-55296)+R-56320+65536:A+=this.wcwidth(R)}const _=this.charProperties(m,C);let k=f.extractWidth(_);f.extractShouldJoin(_)&&(k-=f.extractWidth(C)),A+=k,C=_}return A}charProperties(E,A){return this._activeProvider.charProperties(E,A)}}c.UnicodeService=f}},a={};function l(p){var c=a[p];if(c!==void 0)return c.exports;var h=a[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),A=["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],_=(k,R)=>{this._checkReadonlyOptions(k),this._core.options[k]=R};for(const k in this._core.options){const R={get:m.bind(this,k),set:_.bind(this,k)};Object.defineProperty(this._publicOptions,k,R)}}_checkReadonlyOptions(b){if(A.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,_){this._verifyIntegers(b,m,_),this._core.select(b,m,_)}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
458
- `,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})()))})(qd)),qd.exports}var Gk=Wk(),Wd={exports:{}},l0;function Vk(){return l0||(l0=1,(function(s,t){(function(n,a){s.exports=a()})(self,(()=>(()=>{var n={};return(()=>{var a=n;Object.defineProperty(a,"__esModule",{value:!0}),a.FitAddon=void 0,a.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})()))})(Wd)),Wd.exports}var Yk=Vk(),Gd={exports:{}},c0;function Kk(){return c0||(c0=1,(function(s,t){(function(n,a){s.exports=a()})(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:A}=f;this._options.hover(x,E,A)}},f)))}};class v{static computeLink(f,x,E,A){const C=new RegExp(x.source,(x.flags||"")+"g"),[y,b]=v._getWindowedLineStrings(f-1,E),m=y.join("");let _;const k=[];for(;_=C.exec(m);){const R=_[0];if(!h(R))continue;const[M,j]=v._mapStrIdx(E,b,0,_.index),[T,D]=v._mapStrIdx(E,M,j,R.length);if(M===-1||j===-1||T===-1||D===-1)continue;const I={start:{x:j+1,y:M+1},end:{x:D,y:T+1}};k.push({range:I,text:R,activate:A})}return k}static _getWindowedLineStrings(f,x){let E,A=f,C=f,y=0,b="";const m=[];if(E=x.buffer.active.getLine(f)){const _=E.translateToString(!0);if(E.isWrapped&&_[0]!==" "){for(y=0;(E=x.buffer.active.getLine(--A))&&y<2048&&(b=E.translateToString(!0),y+=b.length,m.push(b),E.isWrapped&&b.indexOf(" ")===-1););m.reverse()}for(m.push(_),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,A]}static _mapStrIdx(f,x,E,A){const C=f.buffer.active,y=C.getNullCell();let b=E;for(;A;){const m=C.getLine(x);if(!m)return[-1,-1];for(let _=b;_<m.length;++_){m.getCell(_,y);const k=y.getChars();if(y.getWidth()&&(A-=k.length||1,_===m.length-1&&k==="")){const R=C.getLine(x+1);R&&R.isWrapped&&(R.getCell(0,y),y.getWidth()===2&&(A+=1))}if(A<0)return[x,_]}x++,b=0}return[x,b]}}c.LinkComputer=v}},a={};function l(p){var c=a[p];if(c!==void 0)return c.exports;var h=a[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})()))})(Gd)),Gd.exports}var Xk=Kk();function Jk(s,t){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/terminal?session=${encodeURIComponent(s)}&token=${encodeURIComponent(t)}`}const Zk=15e3,Qk=new Set([4001,4004]),e3='"Geist Mono", ui-monospace, "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", monospace';function Uc(s,t){return typeof document>"u"?t:getComputedStyle(document.documentElement).getPropertyValue(s).trim()||t}const t3={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"},s3={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 u0(s){const t=Uc("--bg",s==="dark"?"#0b0e13":"#f8f9fa"),n=Uc("--ink",s==="dark"?"#f3f3f5":"#16161a"),a=Uc("--brand",s==="dark"?"#6be195":"#167e3a");return{...s==="dark"?t3:s3,background:t,foreground:n,cursor:a,cursorAccent:t,selectionBackground:`${a}40`}}const i3=({sessionId:s,token:t})=>{const n=P.useRef(null),a=P.useRef(null),[l,d]=P.useState("connecting"),[p,c]=P.useState(null);return P.useEffect(()=>wp(h=>{a.current&&(a.current.options.theme=u0(h))}),[]),P.useEffect(()=>{var _;const h=n.current;if(!h)return;let v=!1,S=0,f=null,x=null;const E=new Gk.Terminal({cursorBlink:!0,fontSize:13,fontFamily:Uc("--mono",e3),theme:u0(wu()),scrollback:1e4,allowProposedApi:!0});a.current=E;const A=new Yk.FitAddon;E.loadAddon(A),E.loadAddon(new Xk.WebLinksAddon),E.parser.registerCsiHandler({prefix:">",final:"q"},()=>(E.write("\x1BP>|XTerm(370)\x1B\\"),!0)),E.parser.registerOscHandler(52,k=>{var j;const R=k.split(";");if(R.length<2)return!1;const M=R[R.length-1];try{const T=atob(M),D=Uint8Array.from(T,q=>q.charCodeAt(0)),I=new TextDecoder().decode(D);(j=navigator.clipboard)==null||j.writeText(I).catch(()=>{})}catch{}return!0}),E.open(h),A.fit(),(_=document.fonts)==null||_.ready.then(()=>{v||(A.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(()=>{A.fit(),y()});b.observe(h);function m(){if(v)return;const k=new WebSocket(Jk(s,t));x=k,k.onopen=()=>{S=0,d("connected"),c(null),A.fit(),y()},k.onmessage=R=>{const M=typeof R.data=="string"?R.data:new TextDecoder().decode(R.data);E.write(M)},k.onclose=R=>{if(v)return;if(Qk.has(R.code)){d("error"),c(R.reason||`Connection refused (${R.code})`);return}const M=Math.min(1e3*2**S,Zk);S+=1,d("connecting"),f=setTimeout(m,M)}}return m(),()=>{v=!0,f&&clearTimeout(f),b.disconnect(),C.dispose(),x==null||x.close(),E.dispose(),a.current=null}},[s,t]),u.jsx("div",{className:"harness-terminal",children:u.jsx("div",{ref:n,className:"terminal-screen"})})},n3=8e3;function r3({message:s,onDismiss:t}){return P.useEffect(()=>{const n=window.setTimeout(t,n3);return()=>window.clearTimeout(n)},[s,t]),u.jsxs("div",{className:"toast",role:"alert","data-testid":"toast",children:[u.jsx("span",{className:"toast-message",children:s}),u.jsx("button",{className:"toast-dismiss","aria-label":"Dismiss",onClick:t,children:"×"})]})}function a3(){const s=P.useRef(null);return P.useEffect(()=>{const t=s.current;if(!t)return;let n=null;const a=()=>{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,A=h.closest(".rail-workflows");if(A&&A.getBoundingClientRect().right+x+14<=window.innerWidth){const b=A.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)&&a()};return document.addEventListener("pointerover",d,!0),document.addEventListener("pointerout",p,!0),document.addEventListener("pointerdown",a,!0),document.addEventListener("keydown",a,!0),document.addEventListener("scroll",a,!0),window.addEventListener("blur",a),()=>{document.removeEventListener("pointerover",d,!0),document.removeEventListener("pointerout",p,!0),document.removeEventListener("pointerdown",a,!0),document.removeEventListener("keydown",a,!0),document.removeEventListener("scroll",a,!0),window.removeEventListener("blur",a)}},[]),u.jsx("div",{ref:s,className:"app-tooltip","data-show":"false",role:"tooltip","aria-hidden":"true"})}const o3="~/.sapiom/harness",l3={events:`${o3}/events.ndjson`},c3=["claude-code","codex"],u3=[{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 h3(s){const t=s.filter(n=>n.id==="sapiom");return t.length===0?s:[...t,...s.filter(n=>n.id!=="sapiom")]}function Rp(s){return s.mode==="embedded"&&s.installed&&c3.includes(s.id)}function d3(s){if(Rp(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 f3(s,t){var n;return((n=s.find(a=>a.id===t))==null?void 0:n.label)??t}function Vd(s){return s.length>1?s.replace(/\/+$/,""):s}async function p3(s,t,n){const a=Vd(s.trim());if(!a)return{kind:"new"};if(t)return{kind:"new"};const l=bk(a);try{const d=l?await n(l):null;if(!!(d!=null&&d.dirs.some(v=>Vd(v.path)===a&&v.hasAgentProject)))return{kind:"project"};const c=await n(a);if(Vd(c.path)!==a)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 Mp({recentDirs:s,launchDir:t,projectRoot:n,listDir:a,onClose:l,onConnect:d,onScan:p,triggerRef:c}){const[h,v]=P.useState(n??t??s[0]??""),[S,f]=P.useState(null),[x,E]=P.useState(!0),[A,C]=P.useState(!1),[y,b]=P.useState(null),m=P.useRef(null);pl(!0,{onDismiss:l,containerRef:m,triggerRef:c}),P.useEffect(()=>{E(!0)},[h]);const _=P.useRef(h);_.current=h;const k=P.useRef(0),R=P.useCallback(U=>{const Z=_.current.trim(),se=++k.current;if(!Z){f(null),E(!1);return}p3(Z,U.isNew,a).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)})},[a]),M=async U=>{C(!0),b(null);try{await U(),l()}catch(Z){b(Z.message)}finally{C(!1)}},j=h.trim(),T=(S==null?void 0:S.kind)==="project"||(S==null?void 0:S.kind)==="multi",D=()=>void M(()=>d(j)),I=()=>void M(async()=>{if(await p(j)===0)throw new Error("No agent projects found under this folder.")}),q=()=>{A||x||!S||!j||!T||(S.kind==="project"?D():S.kind==="multi"&&I())},W=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:W,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(de,{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(s1,{value:h,onChange:v,onSubmit:q,recentDirs:[],listDir:a,onResolve:R})}),S&&u.jsx(v3,{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:A,children:"Cancel"}),u.jsx(g3,{outcome:S,checking:x,busy:A,onConnect:D,onScan:I})]})]})})}function v3({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(de,{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 g3({outcome:s,checking:t,busy:n,onConnect:a,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:a,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 m3="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",_3="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",y3={"claude-code":m3,codex:_3},b3=["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 Dp({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:b3.map(a=>u.jsx("path",{d:a},a.slice(0,16)))});const n=y3[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(de,{name:"SquareTerminal",size:t})}function S3({entries:s,activeId:t,testidPrefix:n,onPick:a}){return u.jsx(u.Fragment,{children:s.map(l=>{const d=Rp(l),p=l.id===t,c=d3(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&&a(l.id)},children:[u.jsx("span",{className:"provider-item-check","aria-hidden":"true",children:p&&u.jsx(de,{name:"Check",size:13})}),u.jsx(Dp,{kind:l.id,size:13}),l.label]},l.id)})})}const w3=[{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."}],x3=3;function C3(s){const t=s.getHours();return t<12?"Good morning.":t<18?"Good afternoon.":"Good evening."}function E3(s){return s.replace(/\s+/g,"-")}function k3({firstRun:s,onSubmitIdea:t,onUseTemplate:n,onBrowseTemplates:a,listHarnesses:l,listTemplates:d,telemetryOptIn:p,onToggleTelemetry:c,recentDirs:h,projectRoot:v,listDir:S,onConnect:f,onScan:x,onScaffold:E,onSaveProjectRoot:A}){const[C,y]=P.useState(""),[b,m]=P.useState(()=>Wi().preferredHarness??"claude-code"),[_,k]=P.useState(u3),[R,M]=P.useState(!1),[j,T]=P.useState([]),[D,I]=P.useState(!1),[q,W]=P.useState(!1),U=P.useRef(null),Z=P.useRef(null),se=P.useRef(null),F=P.useCallback(()=>M(!1),[]);P.useEffect(()=>{let H=!1;return l().then(L=>{if(H||L.length===0)return;k(h3(L));const B=L.filter(Rp);m(V=>{var Q;return B.some(ue=>ue.id===V)?V:((Q=B[0])==null?void 0:Q.id)??V})}).catch(()=>{}),()=>{H=!0}},[l]),P.useEffect(()=>{let H=!1;return d().then(L=>{H||T(L.templates.map(B=>({...B,kind:"gallery"})).slice(0,x3))}).catch(()=>{}),()=>{H=!0}},[d]);const G=H=>{m(H),xn({preferredHarness:H==="codex"?"codex":"claude-code"}),F()},J=H=>{q||(W(!0),window.setTimeout(H,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:[C3(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:w3.map(H=>u.jsx("button",{type:"button",role:"listitem",className:"composer-chip","data-testid":`composer-chip-${E3(H.label)}`,onClick:()=>{var L;y(H.prompt),(L=U.current)==null||L.focus()},children:H.label},H.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:H=>y(H.target.value),onKeyDown:H=>{H.key==="Enter"&&!H.shiftKey&&(H.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(de,{name:"Plus",size:16})}),u.jsxs("div",{className:"composer-box-right",children:[u.jsxs("button",{ref:Z,type:"button",className:"harness-select composer-harness","data-testid":"composer-harness-select","aria-haspopup":"menu","aria-expanded":R,"aria-label":"Coding agent for this session","data-tooltip":"Which coding agent runs this session",onClick:()=>M(H=>!H),children:[u.jsx(Dp,{kind:b,size:14}),u.jsx("span",{className:"harness-select-label",children:f3(_,b)}),u.jsx("span",{className:"disclosure-caret"+(R?" is-open":""),"aria-hidden":"true",children:u.jsx(de,{name:"ChevronDown",size:12})})]}),u.jsx(Zn,{open:R,anchorRef:Z,onDismiss:F,placement:"up-end",className:"session-menu harness-select-menu",role:"menu",testid:"composer-harness-menu",children:u.jsx(S3,{entries:_,activeId:b,testidPrefix:"composer-harness-option",onPick:G})}),u.jsx("button",{type:"button",className:"composer-send","data-testid":"composer-send","aria-label":"Start session",title:"Start session",onClick:O,children:u.jsx(de,{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:a,children:["Browse all templates ",u.jsx(de,{name:"ChevronRight",size:13})]})]}),u.jsx("div",{className:"composer-template-grid",children:j.map((H,L)=>u.jsxs("button",{type:"button",className:"composer-template-card","data-testid":`composer-template-${H.id}`,onClick:()=>J(()=>n(H)),children:[u.jsxs("span",{className:"composer-template-cardhead",children:[u.jsx("span",{className:"composer-template-name",children:H.name}),L===0&&u.jsx("span",{className:"composer-template-suggested",children:"Suggested"})]}),u.jsx("span",{className:"composer-template-desc",children:H.description}),u.jsxs("span",{className:"composer-template-meta",children:[H.stepCount," ",H.stepCount===1?"step":"steps"," ·"," ",Ap(H.complexity),H.capabilities.length>0&&` · ${H.capabilities.length} ${H.capabilities.length===1?"capability":"capabilities"}`]})]},H.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(de,{name:"ArrowUpRight",size:12})]})]}),D&&u.jsx(Mp,{recentDirs:h,projectRoot:v,listDir:S,onClose:()=>I(!1),onConnect:f,onScan:x,triggerRef:se})]})}function T3({firstRun:s,appVersion:t,recentDirs:n,projectRoot:a,listDir:l,onConnect:d,onScan:p,onBrowseTemplates:c,onDismiss:h}){const[v,S]=P.useState(!1),f=P.useRef(null),x=P.useRef(h);return x.current=h,P.useEffect(()=>{if(v)return;const E=C=>{C.key==="Escape"&&x.current()},A=window.setTimeout(()=>window.addEventListener("keydown",E),0);return()=>{window.clearTimeout(A),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(de,{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(de,{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(de,{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:Rx,target:"_blank",rel:"noopener noreferrer",children:["Read documentation ",u.jsx(de,{name:"ArrowUpRight",size:12})]})]})]}),v&&u.jsx(Mp,{recentDirs:n,projectRoot:a,listDir:l,onClose:()=>S(!1),onConnect:d,onScan:p,triggerRef:f})]})}const A3="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,Zc=24,R3=19.9385,M3=(Zc-R3)/Zc;function D3({height:s=16,className:t,style:n,...a}){const l=!!a["aria-label"];return u.jsx("svg",{...a,className:["brand-logotype",t].filter(Boolean).join(" "),style:{"--brand-logotype-descender":`${M3*s}px`,...n},width:h0/Zc*s,height:s,viewBox:`0 0 ${h0} ${Zc}`,fill:"none",focusable:"false",role:l?"img":void 0,"aria-hidden":l?void 0:!0,children:u.jsx("path",{d:A3,fill:"currentColor"})})}function j3({canGoBack:s,canGoForward:t,onGoBack:n,onGoForward:a}){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(de,{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:a,children:u.jsx(de,{name:"ArrowRight",size:14})})]})}function N3({onCollapse:s,canGoBack:t,canGoForward:n,onGoBack:a,onGoForward:l}){return u.jsxs("header",{className:"brand-header",children:[u.jsx("div",{className:"brand-header-window",children:u.jsx("button",{className:"theme-toggle","data-testid":"rail-collapse","aria-label":"Collapse workspace panel",title:"Collapse workspace panel",onClick:s,children:u.jsx(de,{name:"PanelLeftClose",size:14})})}),u.jsxs("h1",{className:"brand-lockup",children:[u.jsxs("span",{className:"brand-mark",children:[u.jsx(D3,{height:13,"aria-hidden":!0}),u.jsx("span",{className:"visually-hidden",children:"Sapiom "})]}),u.jsx("span",{className:"brand-product",children:"agent.studio"})]}),u.jsx(j3,{canGoBack:t,canGoForward:n,onGoBack:a,onGoForward:l})]})}function L3({plan:s}){if(!s)return null;const t=u.jsxs(u.Fragment,{children:[u.jsxs("span",{className:"rail-profile-copy",children:[u.jsx("span",{className:"rail-profile-name",children:s.name}),s.statusLabel&&u.jsx("span",{className:"rail-profile-meta",children:s.statusLabel})]}),s.cta&&u.jsx("span",{className:"pill",children:s.cta.label}),s.cta&&u.jsx(de,{name:"ArrowUpRight",size:14})]});return u.jsx("div",{className:"rail-footer-row plan-row","data-testid":"plan-card",children:s.cta?u.jsx("a",{className:"rail-plan-card",href:s.cta.href,target:"_blank",rel:"noreferrer","data-testid":"plan-upgrade",children:t}):u.jsx("div",{className:"rail-plan-card",children:t})})}function Rc({testid:s,icon:t,label:n,checked:a,onPick:l}){return u.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":a,"data-testid":s,className:"session-dropdown-item menu-choice"+(a?" is-checked":""),onClick:l,children:[u.jsx("span",{className:"session-item-icon",children:u.jsx(de,{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:a&&u.jsx(de,{name:"Check",size:13})})]})}function O3({authenticated:s,organizationName:t,telemetryOptIn:n,productAnalyticsOptIn:a,consentSource:l,consentEnvReason:d,onToggleTelemetry:p,onToggleProductAnalytics:c,rollingSummary:h,onToggleRollingSummary:v,onStartAuth:S,onDisconnect:f}){const[x,E]=P.useState(!1),[A,C]=P.useState({status:"idle"}),y=l==="env-forced-off",b=y?!1:n,m=y?!1:a,_=async()=>{const j=!n;E(!0);try{await p(j),Xc("consent.changed",{optIn:j})}finally{E(!1)}},k=async()=>{const j=!a;E(!0);try{await c(j),Xc("consent.changed",{productAnalytics:j})}finally{E(!1)}},R=async()=>{E(!0);try{await v(!h)}finally{E(!1)}},M=async()=>{C({status:"pending"});try{await S()}catch(j){const T=j instanceof Error?j.message:"Could not start sign-in. Try again.";C({status:"error",message:T})}};return s&&A.status==="pending"&&C({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:A.status==="pending"?u.jsxs("span",{className:"settings-auth-pending","data-testid":"settings-auth-pending",children:[u.jsx(de,{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 M(),children:"Connect account"}),A.status==="error"&&u.jsx("p",{className:"settings-note settings-auth-error","data-testid":"settings-auth-error",children:A.message})]})}),xp(),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":b,"data-testid":"telemetry-toggle",className:"toggle-switch"+(b?" is-on":""),disabled:x||y,onClick:()=>void _(),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:l3.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":m,"data-testid":"product-analytics-toggle",className:"toggle-switch"+(m?" is-on":""),disabled:x||y,onClick:()=>void k(),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."}),y&&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:x,onClick:()=>void R(),children:u.jsx("span",{className:"toggle-knob"})})]}),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 d0({workflow:s,isFocused:t,onFocus:n}){const a=Da(s),l=a==="ready",d=a==="ready"?"Deployed to Sapiom with a ready build.":a==="building"?"Cloud build in progress.":a==="failed"?"Cloud build failed.":a==="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",children:s.name}),u.jsx("span",{className:"workflow-status","data-deployed":l,"data-deployment-state":a,"data-testid":`workflow-status-${s.name}`,title:d,children:u.jsx(de,{name:l?"Cloud":"CloudOff",size:13})})]})})}const Yd=s=>s.split("/").filter(Boolean).pop()??s,B3=(s,t)=>s===t||s.startsWith(`${t}/`),jf=s=>(t,n)=>s==="name"?t.name.localeCompare(n.name):t.path.localeCompare(n.path);function H3(s,t,n="workspace",a="recent",l=[]){return n==="deployment"?I3(s,a):z3(s,t,a,l)}function I3(s,t){const n=jf(t),a=(d,p,c)=>({cwd:`deployment:${p}`,label:d,isDirectory:!1,agents:s.filter(c).sort(n).map(h=>({workflow:h})),bareSessions:[]});return{workspaces:[a("Deployed","live",d=>d.definitionId!=null),a("Draft","draft",d=>d.definitionId==null)].filter(d=>d.agents.length>0),orphanAgents:[]}}function z3(s,t,n,a){const l=t.filter(E=>E.status!=="exited"),d=new Set(s),p=new Map;for(const E of t){const A=p.get(E.cwd);(!A||E.createdAt>A)&&p.set(E.cwd,E.createdAt)}const c=new Set([...p.keys(),...a]),h=(E,A)=>{const C=a.indexOf(E),y=a.indexOf(A);return C>=0&&y>=0?C-y:C>=0||y>=0?C>=0?-1:1:(p.get(A)??"").localeCompare(p.get(E)??"")},v=Array.from(c).sort((E,A)=>n==="name"?Yd(E).localeCompare(Yd(A))||E.localeCompare(A):h(E,A)||E.localeCompare(A)),S=E=>{let A=null;for(const C of v)B3(E,C)&&(A===null||C.length>A.length)&&(A=C);return A},f=[];for(const E of v){const A=s.filter(y=>d.has(y)&&S(y.path)===E).sort(jf(n)).map(y=>(d.delete(y),{workflow:y})),C=l.filter(y=>y.boundWorkflowPath==null&&S(y.cwd)===E).sort((y,b)=>b.createdAt.localeCompare(y.createdAt)||y.id.localeCompare(b.id));A.length===0&&C.length===0||f.push({cwd:E,label:Yd(E),isDirectory:!0,agents:A,bareSessions:C})}const x=Array.from(d).sort(jf(n)).map(E=>({workflow:E}));return{workspaces:f,orphanAgents:x}}const $3=typeof navigator<"u"&&navigator.platform.toUpperCase().includes("MAC"),P3=$3?"⌘K":"Ctrl+K";function U3({label:s,cwd:t,isDirectory:n=!0,collapsed:a,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":!a,children:[n&&u.jsx(de,{name:a?"Folder":"FolderOpen",size:13}),u.jsx("span",{className:"tree-row-label",children:s}),u.jsx("span",{className:"workspace-caret"+(a?"":" is-open"),"aria-hidden":"true",children:u.jsx(de,{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(de,{name:"Copy",size:13})})]})}function F3({label:s,cwd:t,sessionId:n,isFocused:a,onFocus:l,onScaffold:d,onCopyPath:p}){return u.jsxs("div",{className:"workspace-row"+(a?" 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":a,"data-tooltip":"Folder with sessions, no agent yet. Focus to work in it.",onClick:()=>l(t),children:[u.jsx(de,{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(de,{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(de,{name:"Copy",size:13})})]})}function f0({testid:s,harness:t,title:n,meta:a,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(Dp,{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:a})]})]})}function q3({width:s,minWidth:t,workflows:n,sessions:a,activeSessionId:l,focusedAgentPath:d,onFocusAgent:p,onOpenPalette:c,onConnect:h,onCollapse:v,canGoBack:S,canGoForward:f,onGoBack:x,onGoForward:E,onSelectSession:A,overviewSelected:C,onSelectOverview:y,onNewSession:b,onReviewSummary:m,history:_,historyLoading:k,onOpenHistory:R,recentDirs:M,launchDir:j,listDir:T,onCreateSession:D,listHarnesses:I,onScaffoldSession:q,onScaffoldInSession:W,projectRoot:U,onSaveProjectRoot:Z,onBrowseTemplates:se,templatesActive:F,onScanWorkflows:G,onToast:J,telemetryOptIn:O,productAnalyticsOptIn:H,rollingSummary:L,consentSource:B,consentEnvReason:V,authenticated:Q,organizationName:ue,onToggleTelemetry:fe,onToggleProductAnalytics:Y,onToggleRollingSummary:z,onStartAuth:oe,onDisconnect:ae,settingsOpen:we,onSetSettingsOpen:Ee}){const[Ue,$e]=P.useState(!1),We=P.useRef(null),Fe=P.useRef(null),[Ne,$t]=P.useState(!1),[pt,Nt]=P.useState(!1),[xt,ls]=P.useState(()=>Wi().railGrouping??"workspace"),[_t,ot]=P.useState(()=>Wi().railSort??"recent"),kt=Ce=>{ls(Ce),xn({railGrouping:Ce}),Nt(!1)},Tt=Ce=>{ot(Ce),xn({railSort:Ce}),Nt(!1)},Os=P.useRef(null),Pe=P.useCallback(()=>{$t(!1),Nt(!1)},[]),[ds,Wt]=P.useState(()=>new Set(Wi().collapsedCwds??[])),_s=Ce=>{Wt(Ve=>{const ut=new Set(Ve);return ut.has(Ce)?ut.delete(Ce):ut.add(Ce),ut})};P.useEffect(()=>{xn({collapsedCwds:Array.from(ds)})},[ds]);const lt=a.filter(Ce=>Ce.status==="exited"),ys=()=>{const Ce=!Ne;if(Nt(!1),$t(Ce),Ce){const Ve=Wy(a,M,l);Ve.length>0&&R(Ve)}},is=new Set(a.map(Ce=>Ce.id)),Gt=new Set(a.map(Ce=>Ce.agentSessionId).filter(Ce=>Ce!=null)),bt=_.filter(Ce=>!(Ce.harnessSessionId!=null&&is.has(Ce.harnessSessionId))&&!Gt.has(Ce.agentSessionId)),pi=[...lt.map(Ce=>({kind:"exited",at:Ce.lastActiveAt,session:Ce})),...bt.map(Ce=>({kind:"summary",at:Ce.lastActiveAt,summary:Ce}))].sort((Ce,Ve)=>Ve.at.localeCompare(Ce.at)),si=new Map(_.map(Ce=>[Ce.agentSessionId,Ce])),{workspaces:Gs,orphanAgents:Cs}=H3(n,a,xt,_t,M),Ke=Gs.length===0&&Cs.length===0,it=Ce=>{var Ve;(Ve=navigator.clipboard)==null||Ve.writeText(Ce).then(()=>J("Path copied.")).catch(()=>J("Couldn't copy the path."))};return u.jsxs("aside",{ref:Fe,className:"rail rail-workflows",style:{width:s,minWidth:t},children:[u.jsx(N3,{onCollapse:v,canGoBack:S,canGoForward:f,onGoBack:x,onGoForward:E}),u.jsxs("nav",{className:"rail-nav","aria-label":"Primary",children:[u.jsxs("button",{type:"button",className:"rail-nav-cta"+(Ke?" is-empty":""),"data-testid":"rail-create-new","aria-label":"Create a new agent",onClick:()=>{$t(!1),b()},children:[u.jsx(de,{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:c,children:[u.jsx(de,{name:"Search",size:14}),u.jsx("span",{children:"Search"}),u.jsx("span",{className:"rail-nav-kbd",children:P3})]}),u.jsxs("button",{type:"button",className:"rail-nav-row"+(F?" is-selected":""),"data-testid":"rail-templates","aria-current":F?"page":void 0,onClick:se,children:[u.jsx(de,{name:"LayoutTemplate",size:14}),u.jsx("span",{children:"Templates"})]}),u.jsxs("button",{type:"button",ref:We,className:"rail-nav-row","data-testid":"add-existing-agents","aria-haspopup":"dialog","aria-expanded":Ue,onClick:()=>{$t(!1),$e(!0)},children:[u.jsx(de,{name:"FolderPlus",size:14}),u.jsx("span",{children:"Add existing agents"})]})]}),u.jsxs("div",{className:"rail-header",children:[u.jsx(de,{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:Os,className:"theme-toggle rail-header-btn","data-testid":"history-trigger","aria-label":"Workspace options","aria-haspopup":"menu","aria-expanded":Ne,"data-tooltip":"Grouping, sorting and past sessions",onClick:ys,children:u.jsx(de,{name:"MoreHorizontal",size:14})})})]}),u.jsxs("div",{className:"rail-tree",children:[u.jsx(Zn,{open:Ne,anchorRef:Os,onDismiss:Pe,placement:"right-start",besideRef:Fe,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:Pe,"aria-label":"Close",title:"Close",children:u.jsx(de,{name:"X",size:13})})]}),u.jsxs("div",{className:"connect-card-body",role:"menu",children:[u.jsxs("div",{className:"menu-choice-group",onMouseEnter:()=>Nt(!1),children:[u.jsx("div",{className:"session-dropdown-section",children:"Group by"}),u.jsx(Rc,{testid:"group-workspace",icon:"FolderOpen",label:"Workspace",checked:xt==="workspace",onPick:()=>kt("workspace")}),u.jsx(Rc,{testid:"group-deployment",icon:"Cloud",label:"Deployment",checked:xt==="deployment",onPick:()=>kt("deployment")}),u.jsx("div",{className:"session-dropdown-section",children:"Sort"}),u.jsx(Rc,{testid:"sort-recent",icon:"History",label:"Recent activity",checked:_t==="recent",onPick:()=>Tt("recent")}),u.jsx(Rc,{testid:"sort-name",icon:"ArrowDown",label:"Name",checked:_t==="name",onPick:()=>Tt("name")})]}),u.jsxs("button",{type:"button",className:"session-dropdown-item nested-trigger"+(pt?" is-open":""),"data-testid":"past-sessions-trigger","aria-haspopup":"menu","aria-expanded":pt,onMouseEnter:()=>Nt(!0),onClick:()=>Nt(Ce=>!Ce),children:[u.jsx("span",{className:"session-item-icon",children:u.jsx(de,{name:"History",size:13})}),u.jsx("span",{className:"session-item-copy",children:u.jsx("span",{className:"session-item-title",children:"Past sessions"})}),lt.length>0&&u.jsx("span",{className:"session-history-badge","data-testid":"session-history-badge",children:lt.length}),u.jsx(de,{name:"ChevronRight",size:13})]})]})]}),pt&&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:()=>Nt(!1),"aria-label":"Back",title:"Back",children:u.jsx(de,{name:"X",size:13})})]}),u.jsxs("div",{className:"connect-card-body past-sessions-list","data-testid":"past-sessions-card",children:[pi.map(Ce=>{if(Ce.kind==="exited"){const Ve=Ce.session.agentSessionId==null?void 0:si.get(Ce.session.agentSessionId),ut=Ce.session.agentSessionId==null?"rehydrate":Ve==null?void 0:Ve.resumeMode;return u.jsx(f0,{testid:`exited-session-${Ce.session.id}`,harness:Ce.session.harness,title:Ce.session.title,meta:Mf({...Ce.session,gitBranch:Ve==null?void 0:Ve.gitBranch,turnCount:Ve==null?void 0:Ve.turnCount,messageCount:Ve==null?void 0:Ve.messageCount},void 0,{includeHarness:!1,state:Y_({resumeMode:ut,turnCount:Ve==null?void 0:Ve.turnCount})}),cwd:Ce.session.cwd,resumeMode:ut,isSelected:Ce.session.id===l,onOpen:()=>{A(Ce.session.id),Pe()}},Ce.session.id)}return u.jsx(f0,{testid:`history-${Ce.summary.agentSessionId}`,harness:Ce.summary.harness,title:Ce.summary.title,meta:Mf(Ce.summary,void 0,{includeHarness:!1,state:Y_(Ce.summary)}),cwd:Ce.summary.cwd,resumeMode:Ce.summary.resumeMode,isSelected:!1,onOpen:()=>{m(Ce.summary),Pe()}},Ce.summary.agentSessionId)}),k&&u.jsx("div",{className:"session-dropdown-empty",children:"Loading…"}),!k&&pi.length===0&&u.jsx("div",{className:"session-dropdown-empty",children:"No past sessions yet"})]})]})]})]})}),u.jsxs("div",{className:"rail-list",children:[Gs.length===0&&Cs.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."}),Gs.map(Ce=>{const Ve=ds.has(Ce.cwd);if(Ce.agents.length===0&&Ce.bareSessions.length>0){const Es=Ce.bareSessions[0];return u.jsx("div",{className:"workspace-group",children:u.jsx(F3,{label:Ce.label,cwd:Ce.cwd,sessionId:Es.id,isFocused:Ce.cwd===d,onFocus:p,onScaffold:W,onCopyPath:it})},Ce.cwd)}return u.jsxs("div",{className:"workspace-group",children:[u.jsx(U3,{label:Ce.label,cwd:Ce.cwd,isDirectory:Ce.isDirectory,collapsed:Ve,onToggleCollapsed:()=>_s(Ce.cwd),onCopyPath:it}),!Ve&&Ce.agents.map(Es=>u.jsx(d0,{workflow:Es.workflow,isFocused:Es.workflow.path===d,onFocus:p},Es.workflow.path))]},Ce.cwd)}),Cs.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(de,{name:"Folder",size:13}),u.jsx("span",{className:"tree-row-label",children:"No workspace"})]})}),Cs.map(Ce=>u.jsx(d0,{workflow:Ce.workflow,isFocused:Ce.workflow.path===d,onFocus:p},Ce.workflow.path))]})]})]}),u.jsxs("div",{className:"rail-footer",children:[u.jsx(L3,{plan:null}),u.jsx(W3,{onToast:J,authenticated:Q,organizationName:ue,telemetryOptIn:O,productAnalyticsOptIn:H,rollingSummary:L,consentSource:B,consentEnvReason:V,onToggleTelemetry:fe,onToggleProductAnalytics:Y,onToggleRollingSummary:z,onStartAuth:oe,onDisconnect:ae,settingsOpen:we,onSetSettingsOpen:Ee,overviewSelected:C,onSelectOverview:y})]}),Ue&&u.jsx(Mp,{recentDirs:M,launchDir:j,projectRoot:U,listDir:T,onClose:()=>$e(!1),onConnect:h,onScan:G,triggerRef:We})]})}function W3({authenticated:s,organizationName:t,telemetryOptIn:n,productAnalyticsOptIn:a,rollingSummary:l,consentSource:d,consentEnvReason:p,onToggleTelemetry:c,onToggleProductAnalytics:h,onToggleRollingSummary:v,onStartAuth:S,onDisconnect:f,settingsOpen:x,onSetSettingsOpen:E,overviewSelected:A,onSelectOverview:C,onToast:y}){const[b,m]=P.useState(!1),[_,k]=P.useState(wu());P.useEffect(()=>wp(k),[]);const[R,M]=P.useState({status:"idle"}),j=P.useRef(null),T=P.useCallback(()=>m(!1),[]),D=P.useCallback(()=>E(!1),[E]),I=xp(),q=R.status==="pending",W=Jc(),[U,Z]=P.useState(!1),se=async()=>{if(!(!W||U)){Z(!0),T();try{y(Pk(await W.checkForUpdates()).text)}catch{y("Couldn't check for updates.")}finally{Z(!1)}}};s&&R.status==="pending"&&M({status:"idle"});const F=q?"Connecting…":s?t??"Signed in":"Not signed in",G=q?"opening browser":s?"Sapiom account":"connect to get started",J=(t??"S").charAt(0).toUpperCase(),O=async()=>{T(),M({status:"pending"});try{await S()}catch(H){const L=H instanceof Error?H.message:"Could not start sign-in. Try again.";M({status:"error",message:L})}};return u.jsxs("div",{className:"rail-footer-row rail-profile-wrap",children:[u.jsxs("button",{ref:j,className:"rail-profile","data-testid":"brand-identity","aria-haspopup":"menu","aria-expanded":b,title:"Account",onClick:()=>{const H=!b;m(H),H&&D()},children:[u.jsx("span",{className:"rail-profile-avatar","aria-hidden":"true",children:J}),u.jsxs("span",{className:"rail-profile-copy",children:[u.jsx("span",{className:"rail-profile-name",children:F}),u.jsxs("span",{className:"rail-profile-meta",children:[u.jsx("span",{className:"identity-dot","data-authenticated":s,"data-pending":q}),G]})]}),u.jsx(de,{name:"ChevronDown",size:14})]}),u.jsx(Zn,{open:x,anchorRef:j,onDismiss:D,placement:"up-start",matchWidth:!0,className:"settings-popover",testid:"settings-popover",children:u.jsx(O3,{authenticated:s,organizationName:t,telemetryOptIn:n,productAnalyticsOptIn:a,rollingSummary:l,consentSource:d,consentEnvReason:p,onToggleTelemetry:c,onToggleProductAnalytics:h,onToggleRollingSummary:v,onStartAuth:S,onDisconnect:f})}),u.jsxs(Zn,{open:b,anchorRef:j,onDismiss:T,placement:"up-start",matchWidth:!0,className:"profile-menu",role:"menu",testid:"profile-menu",children:[u.jsxs("button",{role:"menuitem",className:"profile-menu-item"+(A?" is-selected":""),"data-testid":"rail-overview",onClick:()=>{C(),T()},children:[u.jsx(de,{name:"Info",size:13}),"Overview"]}),u.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"profile-open-dashboard",onClick:()=>{window.open(Iy,"_blank","noopener,noreferrer"),T()},children:[u.jsx(de,{name:"ExternalLink",size:13}),"Open Sapiom dashboard"]}),u.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"settings-trigger",onClick:()=>{E(!0),T()},children:[u.jsx(de,{name:"Settings",size:13}),"Settings"]}),u.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"theme-toggle",onClick:()=>{ux(),T()},children:[u.jsx(de,{name:_==="dark"?"Sun":"Moon",size:13}),_==="dark"?"Switch to light mode":"Switch to dark mode"]}),W&&u.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"profile-check-updates",disabled:U,onClick:()=>void se(),children:[u.jsx(de,{name:U?"Loader":"RefreshCw",size:13}),U?"Checking…":"Check for updates",W.appVersion&&u.jsxs("span",{className:"profile-menu-version","data-testid":"app-version",children:["v",W.appVersion]})]}),!s&&u.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"profile-connect-account",disabled:q,onClick:()=>void O(),children:[u.jsx(de,{name:"Plug",size:13}),q?"Connecting…":"Connect account"]}),s&&u.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"profile-disconnect-account",onClick:()=>{f(),T()},children:[u.jsx(de,{name:"LogOut",size:13}),"Disconnect"]}),I,R.status==="error"&&u.jsx("p",{className:"profile-menu-auth-error","data-testid":"profile-auth-error",children:R.message})]})]})}const G3=new Set([401,403]);function V3(s){return s?s.networkError===!0||s.status===void 0:!1}function Y3(s){return(s==null?void 0:s.status)!==void 0&&G3.has(s.status)}function K3(s){const{online:t,error:n}=s;return!t||V3(n)?"offline":Y3(n)?"auth":n?"error":"online"}function p0(){return typeof navigator>"u"?!0:navigator.onLine!==!1}function X3(){const[s,t]=P.useState(p0);return P.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 v0(s,t){return s!=null&&s.workflowPath===t}function J3(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 a=t.get("template");if(a){const l=t.get("templateSlug");return{kind:"template",templateId:a,...l?{slug:l}:{}}}return null}function Z3({agentLabel:s,onCancel:t,onConfirm:n}){const a=P.useRef(null);return pl(!0,{onDismiss:t,containerRef:a}),u.jsx("div",{className:"modal-backdrop",onClick:t,children:u.jsxs("div",{ref:a,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(de,{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,qs=zs==null?void 0:zs.navigator,Ae=zs==null?void 0:zs.document,hs=zs==null?void 0:zs.location,jp=zs==null?void 0:zs.fetch,Nf=zs!=null&&zs.XMLHttpRequest&&"withCredentials"in new zs.XMLHttpRequest?zs.XMLHttpRequest:void 0,g0=zs==null?void 0:zs.AbortController,Q3=zs==null?void 0:zs.CompressionStream,ei=qs==null?void 0:qs.userAgent;function n1(){return!(!ce||ce.navigator.onLine===!1)}var Lo=typeof globalThis<"u"?globalThis:ce;Lo&&typeof self>"u"&&(Lo.self=Lo),Lo&&typeof File>"u"&&(Lo.File=function(){});var He=ce??{},At={DEBUG:!1,LIB_VERSION:"0.3.1",LIB_NAME:"browser-common"};function m0(s,t,n,a,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(a,l)}function Xt(s){return function(){var t=this,n=arguments;return new Promise((function(a,l){var d=s.apply(t,n);function p(h){m0(d,a,l,p,c,"next",h)}function c(h){m0(d,a,l,p,c,"throw",h)}p(void 0)}))}}function xe(){return xe=Object.assign?Object.assign.bind():function(s){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var a in n)({}).hasOwnProperty.call(n,a)&&(s[a]=n[a])}return s},xe.apply(null,arguments)}function r1(s,t){if(s==null)return{};var n={};for(var a in s)if({}.hasOwnProperty.call(s,a)){if(t.indexOf(a)!==-1)continue;n[a]=s[a]}return n}var _0=s=>{if(typeof s!="string")return s;try{return JSON.parse(s)}catch{return s}};function y0(s){return typeof s=="string"||s}function b0(s){return typeof s=="string"?s:void 0}var Oo,e4=["$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"],mn=(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})({}),S0=(function(s){return s.GZipJS="gzip-js",s.Base64="base64",s})({}),t4=["$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"],s4=["token"],a1="NativeGzipValidationError",Lf=s=>s.length>=2&&s[0]===31&&s[1]===139,w0=(s,t)=>s===S0.GZipJS||t===S0.GZipJS||t==="gzip",x0=s=>!(!s||typeof s!="object")&&("name"in s?String(s.name):"")==="NotReadableError",Mc=s=>{var t=new Error("Native gzip produced invalid output: "+s);throw t.name=a1,t},i4=(function(){var s=Xt((function*(t,n){18>t.size&&Mc("too-short");var a=new Uint8Array(yield t.slice(0,10).arrayBuffer());Lf(a)&&a[2]===8||Mc("invalid-header");var l=new DataView(yield t.slice(t.size-8).arrayBuffer());l.getUint32(0,!0)!==(p=>{for(var c=(()=>{if(Oo)return Oo;Oo=[];for(var S=0;256>S;S++){for(var f=S,x=0;8>x;x++)f=1&f?3988292384^f>>>1:f>>>1;Oo[S]=f>>>0}return Oo})(),h=4294967295,v=0;p.length>v;v++)h=c[255&(h^p[v])]^h>>>8;return(4294967295^h)>>>0})(n)&&Mc("invalid-crc");var d=n.length>>>0;l.getUint32(4,!0)!==d&&Mc("invalid-size")}));return function(t,n){return s.apply(this,arguments)}})();function Of(){return Of=Xt((function*(s,t,n){t===void 0&&(t=!0);try{var a=new TextEncoder().encode(s),l=new globalThis.CompressionStream("gzip"),d=l.writable.getWriter(),p=d.write(a).then((()=>d.close())).catch((function(){var v=Xt((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 i4(h,a),h}catch(v){if(n!=null&&n.rethrow)throw v;return t&&console.error("Failed to gzip compress data",v),null}})),Of.apply(this,arguments)}var n4=["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"],C0=function(s,t){if(t===void 0&&(t=[]),!s)return!1;var n=s.toLowerCase();return n4.concat(t).some((a=>{var l=a.toLowerCase();return n.indexOf(l)!==-1}))};function Ge(s,t){return s.indexOf(t)!==-1}var Au=function(s){return s.trim()},Bf=function(s){return s.replace(/^\$/,"")};function o1(s){var t,n=[];return(t=JSON.stringify(s,(function(a,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 l1=Object.prototype,c1=l1.hasOwnProperty,Ru=l1.toString,Ze=Array.isArray||function(s){return Ru.call(s)==="[object Array]"},hi=s=>typeof s=="function",Kt=s=>s===Object(s)&&!Ze(s),Kn=s=>{if(Kt(s)){for(var t in s)if(c1.call(s,t))return!1;return!0}return!1},ke=s=>s===void 0,It=s=>Ru.call(s)=="[object String]",Hf=s=>It(s)&&s.trim().length===0,Ws=s=>s===null,et=s=>ke(s)||Ws(s),Ls=s=>Ru.call(s)=="[object Number]"&&s==s,vn=s=>Ls(s)&&s>0,Hi=s=>Ru.call(s)==="[object Boolean]",r4=s=>s instanceof FormData,a4=s=>Ge(t4,s),o4=s=>Ge(s4,s);function u1(s){return s===null||typeof s!="object"}function Qc(s,t){return{}.toString.call(s)==="[object "+t+"]"}function Np(s){return typeof Event<"u"&&(function(t,n){try{return t instanceof n}catch{return!1}})(s,Event)}var l4=[!0,"true",1,"1","yes"],Kd=s=>Ge(l4,s),c4=[!1,"false",0,"0","no"];function Gi(s,t,n,a,l){return t>n&&(a.warn("min cannot be greater than max."),t=n),Ls(s)?s>n?(a.warn(" cannot be greater than max: "+n+". Using max value instead."),n):t>s?(a.warn(" cannot be less than min: "+t+". Using min value instead."),t):s:(a.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+l),Gi(l||n,t,n,a))}class u4{constructor(t){this.tt={},this.et=t.et,this.rt=Gi(t.bucketSize,0,100,t.it),this.nt=Gi(t.refillRate,0,this.rt,t.it),this.st=Gi(t.refillInterval,0,864e5,t.it)}ot(t,n){var a=Math.floor((n-t.lastAccess)/this.st);a>0&&(t.tokens=Math.min(t.tokens+a*this.nt,this.rt),t.lastAccess=t.lastAccess+a*this.st)}consumeRateLimit(t){var n,a=Date.now(),l=String(t),d=this.tt[l];return d?this.ot(d,a):this.tt[l]=d={tokens:this.rt,lastAccess:a},d.tokens===0||(d.tokens--,d.tokens===0&&((n=this.et)==null||n.call(this,t)),d.tokens===0)}stop(){this.tt={}}}var fi="Mobile",eu="iOS",wn="Android",ja="Tablet",h1=wn+" "+ja,d1="iPad",f1="Apple",p1=f1+" Watch",Jo="Safari",Na="BlackBerry",v1="Samsung",g1=v1+"Browser",m1=v1+" Internet",Lr="Chrome",h4=Lr+" OS",_1=Lr+" "+eu,Lp="Internet Explorer",y1=Lp+" "+fi,Op="Opera",d4=Op+" Mini",Bp="Edge",b1="Microsoft "+Bp,Aa="Firefox",S1=Aa+" "+eu,al="Nintendo",ol="PlayStation",Ra="Xbox",w1=wn+" "+fi,x1=fi+" "+Jo,Wo="Windows",If=Wo+" Phone",E0="Nokia",zf="Ouya",C1="Generic",f4=C1+" "+fi.toLowerCase(),E1=C1+" "+ja.toLowerCase(),$f="Konqueror",k1="Oculus Browser",tu="Vivaldi",T1="Yandex",su="Whale",Pf="DuckDuckGo",A1="Pale Moon",iu="Waterfox",Zo="Brave",R1="Google Search App",es="(\\d+(\\.\\d+)?)",Xd=new RegExp("Version/"+es),p4=new RegExp(Ra,"i"),v4=new RegExp(ol+" \\w+","i"),g4=new RegExp(al+" \\w+","i"),Hp=new RegExp(Na+"|PlayBook|BB10","i"),m4={"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"},M1=function(s,t,n,a){t=t||"";var l=(function(d){return d!=null&&d.brave?Zo:null})(n);return l||(a!=null&&a.detectGoogleSearchApp&&Ge(s,"GSA/")?R1:Ge(s," OPR/")&&Ge(s,"Mini")?d4:Ge(s," OPR/")?Op:Hp.test(s)?Na:Ge(s,"IE"+fi)||Ge(s,"WPDesktop")?y1:Ge(s,"OculusBrowser")?k1:Ge(s,g1)?m1:Ge(s,Bp)||Ge(s,"Edg/")?b1:Ge(s,tu+"/")?tu:Ge(s,"YaBrowser/")?T1:Ge(s,su+"/")?su:Ge(s,Pf+"/")||Ge(s,"Ddg/")?Pf:Ge(s,"FBIOS")?"Facebook "+fi:Ge(s,"UCWEB")||Ge(s,"UCBrowser")?"UC Browser":Ge(s,"CriOS")?_1:Ge(s,"CrMo")||Ge(s,Lr)?Lr:Ge(s,wn)&&Ge(s,Jo)?w1:Ge(s,"FxiOS")?S1:Ge(s.toLowerCase(),$f.toLowerCase())?$f:Ge(s,Zo+"/")?Zo:((d,p)=>p&&Ge(p,f1)||(function(c){return Ge(c,Jo)&&!Ge(c,Lr)&&!Ge(c,wn)})(d))(s,t)?Ge(s,fi)?x1:Jo:Ge(s,"PaleMoon/")?A1:Ge(s,iu+"/")?iu:Ge(s,Aa)?Aa:Ge(s,"MSIE")||Ge(s,"Trident/")?Lp:Ge(s,"Gecko")?Aa:"")},_4={[y1]:[new RegExp("rv:"+es)],[b1]:[new RegExp(Bp+"?\\/"+es)],[Lr]:[new RegExp("("+Lr+"|CrMo)\\/"+es)],[_1]:[new RegExp("CriOS\\/"+es)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+es)],[Jo]:[Xd],[x1]:[Xd],[Op]:[new RegExp("(Opera|OPR)\\/"+es)],[Aa]:[new RegExp(Aa+"\\/"+es)],[S1]:[new RegExp("FxiOS\\/"+es)],[$f]:[new RegExp("Konqueror[:/]?"+es,"i")],[Na]:[new RegExp(Na+" "+es),Xd],[w1]:[new RegExp("android\\s"+es,"i")],[m1]:[new RegExp(g1+"\\/"+es)],[k1]:[new RegExp("OculusBrowser\\/"+es)],[tu]:[new RegExp(tu+"\\/"+es)],[T1]:[new RegExp("YaBrowser\\/"+es)],[su]:[new RegExp(su+"\\/"+es)],[Zo]:[new RegExp(Zo+"\\/"+es)],[Pf]:[new RegExp("(DuckDuckGo|Ddg)\\/"+es)],[A1]:[new RegExp("PaleMoon\\/"+es)],[iu]:[new RegExp(iu+"\\/"+es)],[R1]:[new RegExp("GSA\\/"+es)],[Lp]:[new RegExp("(rv:|MSIE )"+es)],Mozilla:[new RegExp("rv:"+es)]},y4=function(s,t,n,a){var l=M1(s,t,n,a),d=_4[l];if(ke(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},k0=[[new RegExp(Ra+"; "+Ra+" (.*?)[);]","i"),s=>[Ra,s&&s[1]||""]],[new RegExp(al,"i"),[al,""]],[new RegExp(ol,"i"),[ol,""]],[Hp,[Na,""]],[new RegExp(Wo,"i"),(s,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[If,""];if(new RegExp(fi).test(t)&&!/IEMobile\b/.test(t))return[Wo+" "+fi,""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var a=m4[n[1]]||"";return/arm/i.test(t)&&(a="RT"),[Wo,a]}return[Wo,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,s=>s&&s[3]?[eu,[s[3],s[4],s[5]||"0"].join(".")]:[eu,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,s=>{var t="";return s&&s.length>=3&&(t=ke(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/,[h4,""]],[/Linux|debian/i,["Linux",""]]],T0=function(s){return g4.test(s)?al:v4.test(s)?ol:p4.test(s)?Ra:new RegExp(zf,"i").test(s)?zf:new RegExp("("+If+"|WPDesktop)","i").test(s)?If:/iPad/.test(s)?d1:/iPod/.test(s)?"iPod Touch":/iPhone/.test(s)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(s)?p1:Hp.test(s)?Na:/(kobo)\s(ereader|touch)/i.test(s)?"Kobo":new RegExp(E0,"i").test(s)?E0:/(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(fi).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:h1:new RegExp("(pda|"+fi+")","i").test(s)?f4:new RegExp(ja,"i").test(s)&&!new RegExp(ja+" pc","i").test(s)?E1:""},b4=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function A0(s,t){return typeof(n=s)=="string"&&b4.test(n)?s:t();var n}function Qn(s){return s&&s.split("#")[0]}function Fc(s,t){var n=setTimeout(s,t);return n!=null&&n.unref&&(n==null||n.unref()),n}var S4=s=>s instanceof Error,D1={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}},w4=D1.info;function j1(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=>j1(t)))}};try{return{stringValue:JSON.stringify(s)}}catch{return{stringValue:String(s)}}}function nu(s){var t=[];for(var n in s){var a=s[n];Ws(a)||ke(a)||t.push({key:n,value:j1(a)})}return t}function x4(s,t){var n=D1[s.level||"info"]||w4,a=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=xe({},p,s.attributes||{}),h={timeUnixNano:d,observedTimeUnixNano:d,severityNumber:l,severityText:a,body:{stringValue:s.body},attributes:nu(c)};return s.trace_id&&(h.traceId=s.trace_id),s.span_id&&(h.spanId=s.span_id),ke(s.trace_flags)||(h.flags=s.trace_flags),h}function N1(s,t,n){return xe({},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 L1(s,t,n,a){return{resourceLogs:[{resource:{attributes:nu(t)},scopeLogs:[{scope:{name:n,version:a},logRecords:s}]}]}}let C4=class{constructor(s,t,n,a,l,d,p){var c;d===void 0&&(d=()=>Promise.resolve()),this._instance=s,this.Te=t,this.it=n,this.ut=a,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:x4(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],a=s;for(var l of n)try{var d=l(a);if(!d)return this.it.info("Log was rejected in beforeSend function"),null;a=d}catch(p){return this.it.error("Error in beforeSend function for log:",p),null}return a}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 Xt((function*(){if(!s._instance.isDisabled)return s.vt||(s.vt=s.Ft().finally((()=>{s.vt=null}))),s.vt}))()}Ft(){var s=this;return Xt((function*(){var t;s.Tt();var n=(t=s._instance.getPersistedProperty(mn.LogsQueue))!==null&&t!==void 0?t:[];if(n.length!==0)for(var a=n.length,l=0;n.length>0&&a>l;){var d,p;s.ft=0;var c=Math.min(n.length,s.Ct),h=n.slice(0,c),v=L1(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(mn.LogsQueue))!==null&&p!==void 0?p:[],l+=h.length,S.kind==="fatal"))throw S.error}}))()}Lt(s){var t=this;return Xt((function*(){var n,a=Math.max(0,s-t.ft),l=(n=t._instance.getPersistedProperty(mn.LogsQueue))!==null&&n!==void 0?n:[];t._instance.setPersistedProperty(mn.LogsQueue,l.slice(a)),yield t.dt()}))()}At(){return N1(this.Te,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ot(s){var t;if(!this._instance.optedOut){var n=(t=this._instance.getPersistedProperty(mn.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(mn.LogsQueue,n),this.xt>n.length?this.Dt():this.Et()}}Dt(s){s===void 0&&(s=this.St),this.Nt||(this.Nt=Fc((()=>{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(mn.LogsQueue);return!!s&&s.length>0}shutdown(s){var t=this;return Xt((function*(){t.Tt();var n=t.flush().catch((()=>{}));s!==void 0?yield Promise.race([n,new Promise((a=>Fc(a,s)))]):yield n}))()}flushWithTimeout(s){var t=this;return Xt((function*(){var n=!1,a=t.flush(),l=new Promise((d=>Fc((()=>{n=!0,d()}),s)));try{yield Promise.race([a,l])}finally{n&&a.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 Jd=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function R0(s){return String(s)+"000000"}function M0(s,t,n,a){var l="";return a&&(l=Object.keys(a).sort().map((d=>JSON.stringify(d)+":"+JSON.stringify(a[d]))).join(",")),s+"\0"+t+"\0"+(n??"")+"\0"+l}let E4=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=Xt((function*(){t&&(yield t.catch((()=>{}))),yield s.Zt()}));return function(){return l.apply(this,arguments)}})(),a=n().finally((()=>{this.vt===a&&(this.vt=null)}));return this.vt=a,a}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,a;try{n=t.attributes?xe({},t.attributes):void 0,a=M0(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(a);if(!l){if(!this.Qt())return;l={name:t.name,type:t.type,unit:t.unit,attributes:n,windowStartMs:Date.now()},this.Bt.set(a,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(Jd.length+1).fill(0)});var a=s.hist;a.count+=1,a.sum+=t,a.min=Math.min(a.min,t),a.max=Math.max(a.max,t),a.bucketCounts[(function(l,d){for(var p=0;d.length>p;p++)if(d[p]>=l)return p;return d.length})(t,Jd)]+=1}}Rt(s){var t=this.Te.beforeSend;if(!t)return s;var n=Ze(t)?t:[t],a=s;for(var l of n)try{var d=l(a);if(!d)return this.it.info("Metric was rejected in beforeSend function"),null;a=d}catch(p){return this.it.error("Error in beforeSend function for metric:",p),null}return a}Dt(){this.Nt||(this.Nt=Fc((()=>{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 Xt((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,a=yield s._instance.Kt(s.Gt(t));if(n===s.Vt)switch(a.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:",a.error)}}}))()}Gt(s){return t=this.Xt(s),n=(function(d,p,c){return xe({},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()),a=this._instance.getLibraryId(),l=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:nu(n)},scopeMetrics:[{scope:{name:a,version:l},metrics:t}]}]};var t,n,a,l}Xt(s){var t=R0(Date.now()),n=new Map;for(var a of s.values()){var l,d=M0(a.type,a.name,a.unit,void 0),p=n.get(d);p||(p=xe({name:a.name},a.unit&&{unit:a.unit}),a.type==="count"?p.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:a.type==="gauge"?p.gauge={dataPoints:[]}:p.histogram={aggregationTemporality:1,dataPoints:[]},n.set(d,p));var c=nu((l=a.attributes)!==null&&l!==void 0?l:{}),h=R0(a.windowStartMs);if(a.type==="count"){var v,S={attributes:c,startTimeUnixNano:h,timeUnixNano:t,asDouble:(v=a.total)!==null&&v!==void 0?v:0};p.sum.dataPoints.push(S)}else if(a.type==="gauge"){var f,x={attributes:c,timeUnixNano:t,asDouble:(f=a.last)!==null&&f!==void 0?f:0};p.gauge.dataPoints.push(x)}else a.hist&&p.histogram.dataPoints.push({attributes:c,startTimeUnixNano:h,timeUnixNano:t,count:a.hist.count,sum:a.hist.sum,min:a.hist.min,max:a.hist.max,bucketCounts:a.hist.bucketCounts,explicitBounds:Jd})}return Array.from(n.values())}Yt(s){var t,n;for(var a of s){var l=a[0],d=a[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 Dc,D0,Zd;function k4(s){var t=globalThis._posthogChunkIds;if(t){var n=Object.keys(t);return Zd&&n.length===D0||(D0=n.length,Zd=n.reduce(((a,l)=>{Dc||(Dc={});var d=Dc[l];if(d)a[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){a[v]=S,Dc[l]=[v,S];break}}return a}),{})),Zd}}class T4{constructor(t,n,a){a===void 0&&(a=[]),this.coercers=t,this.stackParser=n,this.modifiers=a}buildFromUnknown(t,n){n===void 0&&(n={});var a=n&&n.mechanism||{handled:!0,type:"generic"},l=this.buildCoercingContext(a,n,0).apply(t),d=this.buildParsingContext(n),p=this.parseStacktrace(l,d);return{$exception_list:this.convertToExceptionList(p,a),$exception_level:"error"}}modifyFrames(t){var n=this;return Xt((function*(){for(var a of t)a.stacktrace&&a.stacktrace.frames&&Ze(a.stacktrace.frames)&&(a.stacktrace.frames=yield n.applyModifiers(a.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 a,l;return t.cause!=null&&(a=this.parseStacktrace(t.cause,n)),t.stack!=""&&t.stack!=null&&(l=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?n.skipFirstLines:0),n.chunkIdMap)),xe({},t,{cause:a,stack:l})}applyChunkIds(t,n){return t.map((a=>(a.filename&&n&&(a.chunk_id=n[a.filename]),a)))}applyCoercers(t,n){for(var a of this.coercers)if(a.match(t))return a.coerce(t,n);return this.coerceFallback(n)}applyModifiers(t){var n=this;return Xt((function*(){var a=t;for(var l of n.modifiers)a=yield l(a);return a}))()}convertToExceptionList(t,n){var a,l,d,p={type:t.type,value:t.value,mechanism:{type:(a=n.type)!==null&&a!==void 0?a:"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,xe({},n,{handled:!0}))),c}buildParsingContext(t){var n;return{chunkIdMap:k4(this.stackParser),skipFirstLines:(n=t.skipFirstLines)!==null&&n!==void 0?n:1}}buildCoercingContext(t,n,a){a===void 0&&(a=0);var l=(d,p)=>{if(4>=p){var c=this.buildCoercingContext(t,n,p);return this.applyCoercers(d,c)}};return xe({},n,{syntheticException:a==0?n.syntheticException:void 0,mechanism:t,apply:d=>l(d,a),next:d=>l(d,a+1)})}}var La="?";function Uf(s,t,n,a,l){var d={platform:s,filename:t,function:n==="<anonymous>"?La:n,in_app:!0};return ke(a)||(d.lineno=a),ke(l)||(d.colno=l),d}var O1=(s,t)=>{var n=s.indexOf("safari-extension")!==-1,a=s.indexOf("safari-web-extension")!==-1;return n||a?[s.indexOf("@")!==-1?s.split("@")[0]:La,n?"safari-extension:"+t:"safari-web-extension:"+t]:[s,t]},A4=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,R4=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,M4=/\((\S*)(?::(\d+))(?::(\d+))\)/,D4=(s,t)=>{var n=A4.exec(s);if(n)return Uf(t,n[1],La,+n[2],+n[3]);var a=R4.exec(s);if(a){if(a[2]&&a[2].indexOf("eval")===0){var l=M4.exec(a[2]);l&&(a[2]=l[1],a[3]=l[2],a[4]=l[3])}var d=O1(a[1]||La,a[2]);return Uf(t,d[1],d[0],a[3]?+a[3]:void 0,a[4]?+a[4]:void 0)}},j4=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,N4=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,L4=(s,t)=>{var n=j4.exec(s);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){var a=N4.exec(n[3]);a&&(n[1]=n[1]||"eval",n[3]=a[1],n[4]=a[2],n[5]="")}var l=n[3],d=n[1]||La,p=O1(d,l);return Uf(t,l=p[1],d=p[0],n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},j0=/\(error: (.*)\)/;class O4{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,n){var a=It(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:a?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 Qc(t,"DOMException")}isDOMError(t){return Qc(t,"DOMError")}}class B4{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 a=t.message;return String(a.error&&typeof a.error.message=="string"?a.error.message:a)}getStack(t){return t.stacktrace||t.stack||void 0}}class H4{constructor(){}match(t){return Qc(t,"ErrorEvent")&&t.error!=null}coerce(t,n){var a;return n.apply(t.error)||{type:"ErrorEvent",value:t.message,stack:(a=n.syntheticException)==null?void 0:a.stack,synthetic:!0}}}var I4=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class z4{match(t){return typeof t=="string"}coerce(t,n){var a,l=this.getInfos(t),d=l[0],p=l[1];return{type:d??"Error",value:p??t,stack:(a=n.syntheticException)==null?void 0:a.stack,synthetic:!0}}getInfos(t){var n="Error",a=t,l=t.match(I4);return l&&(n=l[1],a=l[2]),[n,a]}}var $4=["fatal","error","warning","log","info","debug"];function B1(s,t){t===void 0&&(t=40);var n=Object.keys(s);if(n.sort(),!n.length)return"[object has no keys]";for(var a=n.length;a>0;a--){var l=n.slice(0,a).join(", ");if(t>=l.length)return a===n.length?l:l.length>t?l.slice(0,t)+"...":l}return""}class P4{match(t){return typeof t=="object"&&t!==null}coerce(t,n){var a,l=this.getErrorPropertyFromObject(t);return l?n.apply(l):{type:this.getType(t),value:this.getValue(t),stack:(a=n.syntheticException)==null?void 0:a.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return Np(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 a=this.getObjectClassName(t);return(a&&a!=="Object"?"'"+a+"'":"Object")+" captured as exception with keys: "+B1(t)}isSeverityLevel(t){return It(t)&&!Hf(t)&&$4.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var n in t)if({}.hasOwnProperty.call(t,n)){var a=t[n];if(S4(a))return a}}getObjectClassName(t){try{var n=Object.getPrototypeOf(t);return n?n.constructor.name:void 0}catch{return}}}class U4{match(t){return Np(t)}coerce(t,n){var a,l=t.constructor.name;return{type:l,value:l+" captured as exception with keys: "+B1(t),stack:(a=n.syntheticException)==null?void 0:a.stack,synthetic:!0}}}class F4{match(t){return u1(t)}coerce(t,n){var a;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:(a=n.syntheticException)==null?void 0:a.stack,synthetic:!0}}}class q4{match(t){return Qc(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!Np(t))return!1;try{var n=t.detail;return n!=null&&typeof n=="object"&&"reason"in n}catch{return!1}}coerce(t,n){var a,l=this.getUnhandledRejectionReason(t);return u1(l)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(l),stack:(a=n.syntheticException)==null?void 0:a.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 ru="$message",au="$timestamp",W4=new Set([ru,au]),Qd={enabled:!0,max_bytes:32768};function ou(s){var t;return s?{enabled:(t=s.enabled)!==null&&t!==void 0?t:Qd.enabled,max_bytes:V4(s.max_bytes,Qd.max_bytes)}:xe({},Qd)}class G4{constructor(t){this.$e=[],this.ze=0,this.Te=ou(t)}setConfig(t){this.Te=ou(t),this.Ze()}add(t){var n=(function(l){var d;try{d=o1(l)}catch{return}try{var p=JSON.parse(d);if(!Kt(p))return;var c=p,h=c[ru],v=c[au];return!It(h)||h.trim().length===0||!It(v)&&!Ls(v)?void 0:{step:c,json:d}}catch{return}})(t);if(n){var a=(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);a>this.Te.max_bytes||(this.$e.push({step:n.step,bytes:a}),this.ze+=a,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 V4(s,t){if(!Ls(s)||s===1/0||s===-1/0)return t;var n=Math.floor(s);return 0>n?t:n}var H1=function(s,t){var n=(t===void 0?{}:t).debugEnabled,a={k(l){if(ce&&(At.DEBUG||ce.POSTHOG_DEBUG||n)&&!ke(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];a.k("debug",...d)},info(){for(var l=arguments.length,d=new Array(l),p=0;l>p;p++)d[p]=arguments[p];a.k("log",...d)},warn(){for(var l=arguments.length,d=new Array(l),p=0;l>p;p++)d[p]=arguments[p];a.k("warn",...d)},error(){for(var l=arguments.length,d=new Array(l),p=0;l>p;p++)d[p]=arguments[p];a.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){a.error("You must initialize PostHog before calling "+l)},createLogger:(l,d)=>H1(s+" "+l,d)};return a},Te=H1("[PostHog.js]"),Zt=Te.createLogger,Y4=Zt("[ExternalScriptsLoader]"),ef=(s,t,n)=>{if(s.config.disable_external_dependency_loading)return Y4.warn(t+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var a=Ae==null?void 0:Ae.querySelectorAll("script");if(a){for(var l,d=function(){if(a[p].src===t){var h=a[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;a.length>p;p++)if(l=d())return l.v}var c=()=>{if(!Ae)return n("document not found");var h=Ae.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")Ae.head.appendChild(h);else{var v,S=Ae.querySelectorAll("body > script");S.length>0?(v=S[0].parentNode)==null||v.insertBefore(h,S[0]):Ae.body.appendChild(h)}};Ae!=null&&Ae.body?c():Ae==null||Ae.addEventListener("DOMContentLoaded",c)};He.__PosthogExtensions__=He.__PosthogExtensions__||{},He.__PosthogExtensions__.loadExternalDependency=(s,t,n)=>{if(t!=="remote-config"){var a;if(s.config.strict_script_versioning)a=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}a=s.requestRouter.endpointFor("assets",l)}ef(s,a,n)}else{var p=s.requestRouter.endpointFor("assets","/array/"+s.config.token+"/config.js");ef(s,p,n)}},He.__PosthogExtensions__.loadSiteApp=(s,t,n)=>{var a=s.requestRouter.endpointFor("api",t);ef(s,a,n)};At.DEBUG=!1,At.LIB_VERSION="1.409.5",At.LIB_NAME="web";var I1="$people_distinct_id",ll="$device_id",tf="$device_model",Go="__alias",Vo="__timers",Ff="$autocapture_disabled_server_side",qf="$heatmaps_enabled_server_side",Wf="$exception_capture_enabled_server_side",Gf="$error_tracking_suppression_rules",Vf="$error_tracking_capture_extension_exceptions",Yf="$web_vitals_enabled_server_side",Ip="$dead_clicks_enabled_server_side",zp="$product_tours_enabled_server_side",Kf="$web_vitals_allowed_metrics",Nr="$session_recording_remote_config",z1="$replay_sample_rate",$1="$replay_override_sampling",P1="$replay_override_linked_flag",U1="$replay_override_url_trigger",F1="$replay_override_event_trigger",xa="$sesid",$p="$session_is_sampled",Dr="$enabled_feature_flags",qc="$active_feature_flags",Yo="$early_access_features",Xf="$feature_flag_details",Wc="$feature_flag_payloads",Jf="$feature_flag_request_id",lu="$minimal_flag_called_events",gn="$override_feature_flags",ba="$override_feature_flag_payloads",Ar="$stored_person_properties",Rr="$stored_group_properties",Zf="$surveys",cu="$surveys_loaded_at",Qf="$surveys_activated",Gc="$surveys_activated_session",Ko="ph_product_tours",Qo="$flag_call_reported",ep="$flag_call_reported_session_id",tp="$feature_flag_errors",cl="$feature_flag_evaluated_at",Ai="$user_state",sp="$client_session_props",ip="$capture_rate_limit",np="$initial_campaign_params",rp="$initial_referrer_info",uu="$initial_person_info",hu="$epp",jc="$posthog_cookieless",q1="$cookieless_mode",W1="$sdk_debug_extensions_init_method",G1="$sdk_debug_extensions_init_time_ms",V1="$sdk_debug_recording_script_not_loaded",Pp="PostHog loadExternalDependency extension not found.",Mr="on_reject",yn="always",ga="anonymous",Sr="identified",ap="identified_only",du="visibilitychange",fu="beforeunload",Sa="$pageview",sf="$pageleave",nf="$identify",N0="$groupidentify";function Nc(s,t){Ze(s)&&s.forEach(t)}function zt(s,t){if(!et(s))if(Ze(s))s.forEach(t);else if(r4(s))s.forEach(((a,l)=>t(a,l)));else for(var n in s)c1.call(s,n)&&t(s[n],n)}var qt=function(s){for(var t=arguments.length,n=new Array(t>1?t-1:0),a=1;t>a;a++)n[a-1]=arguments[a];for(var l of n)for(var d in l)l[d]!==void 0&&(s[d]=l[d]);return s};function Vc(s){for(var t=Object.keys(s),n=t.length,a=new Array(n);n--;)a[n]=[t[n],s[t[n]]];return a}var L0=function(s){try{return s()}catch{return}},K4=function(s){return function(){try{for(var t=arguments.length,n=new Array(t),a=0;t>a;a++)n[a]=arguments[a];return s.apply(this,n)}catch(l){Te.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Te.critical(l)}}},Up=function(s){var t={};return zt(s,(function(n,a){(It(n)&&n.length>0||Ls(n))&&(t[a]=n)})),t},X4=["herokuapp.com","vercel.app","netlify.app"];function J4(s){var t=s==null?void 0:s.hostname;if(!It(t))return!1;var n=t.split(".").slice(-2).join(".");for(var a of X4)if(n===a)return!1;return!0}function ts(s,t,n,a){var l=a??{},d=l.capture,p=l.passive;s==null||s.addEventListener(t,n,{capture:d!==void 0&&d,passive:p===void 0||p})}function Y1(s){return s.name==="ph_toolbar_internal"}var K1=s=>{if(Ae){try{for(var t=s+"=",n=Ae.cookie.split(";").filter((d=>d.length)),a=0;n.length>a;a++){for(var l=n[a];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 Ls(s)&&isFinite(s)&&Math.floor(s)===s});class pu{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,n,a,l){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(a)||!Number.isInteger(l)||0>t||0>n||0>a||0>l||t>0xffffffffffff||n>4095||a>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|a>>>24,d[9]=a>>>16,d[10]=a>>>8,d[11]=a,d[12]=l>>>24,d[13]=l>>>16,d[14]=l>>>8,d[15]=l,new pu(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 pu(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(var n=0;16>n;n++){var a=this.bytes[n]-t.bytes[n];if(a!==0)return Math.sign(a)}return 0}}class Z4{generate(){var t=this.generateOrAbort();if(!ke(t))return t;this.S=0;var n=this.generateOrAbort();if(ke(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 pu.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 Q4}}var O0,X1=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&&!ke(ce.crypto)&&crypto.getRandomValues&&(X1=s=>crypto.getRandomValues(s));class Q4{nextUint32(){return this.R.length>this.O||(X1(this.R),this.O=0),this.R[this.O++]}constructor(){this.R=new Uint32Array(8),this.O=1/0}}var _n=()=>e5().toString(),e5=()=>(O0||(O0=new Z4)).generate(),Bo="",t5=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,bn={N:()=>!!Ae,P(s){Te.error("cookieStore error: "+s)},q:K1,F(s){var t;try{t=JSON.parse(bn.q(s))||{}}catch{}return t},A(s,t,n,a,l){if(!Ae)return!1;try{var d="",p="",c=(function(S,f){if(f){var x=(function(A,C){if(C===void 0&&(C=Ae),Bo)return Bo;if(!C||["localhost","127.0.0.1"].includes(A))return"";for(var y=A.split("."),b=Math.min(y.length,8),m="dmn_chk_"+_n();!Bo&&b--;){var _=y.slice(b).join("."),k=m+"=1;domain=."+_+";path=/";C.cookie=k+";max-age=3",C.cookie.includes(m)&&(C.cookie=k+";max-age=0",Bo=_)}return Bo})(S);if(!x){var E=(A=>{var C=A.match(t5);return C?C[0]:""})(S);E!==x&&Te.info("Warning: cookie subdomain discovery mismatch",E,x),x=E}return x?"; domain=."+x:""}return""})(Ae.location.hostname,a);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&&Te.warn("cookieStore warning: large cookie, len="+v.length),Ae.cookie=v,!0}catch{return!1}},D(s,t){if(Ae!=null&&Ae.cookie)try{bn.A(s,"",-1,t)}catch{return}}},rf=null,Ft={N(){if(!Ws(rf))return rf;var s=!0;if(ke(ce))s=!1;else try{var t="__mplssupport__";Ft.A(t,"xyz"),Ft.q(t)!=='"xyz"'&&(s=!1),Ft.D(t)}catch{s=!1}return s||Te.error("localStorage unsupported; falling back to cookie store"),rf=s,s},P(s){Te.error("localStorage error: "+s)},q(s){try{return ce==null?void 0:ce.localStorage.getItem(s)}catch(t){Ft.P(t)}return null},F(s){try{return JSON.parse(Ft.q(s))||{}}catch{}return null},A(s,t){try{return ce==null||ce.localStorage.setItem(s,JSON.stringify(t)),!0}catch(n){Ft.P(n)}return!1},D(s){try{ce==null||ce.localStorage.removeItem(s)}catch(t){Ft.P(t)}}},s5=[ll,"distinct_id",xa,$p,hu,uu,Ai],Lc={},i5={N:()=>!0,P(s){Te.error("memoryStorage error: "+s)},q:s=>Lc[s]||null,F:s=>Lc[s]||null,A:(s,t)=>(Lc[s]=t,!0),D(s){delete Lc[s]}},wr=null,Ns={N(){if(!Ws(wr))return wr;if(wr=!0,ke(ce))wr=!1;else try{var s="__support__";Ns.A(s,"xyz"),Ns.q(s)!=='"xyz"'&&(wr=!1),Ns.D(s)}catch{wr=!1}return wr},P(s){Te.error("sessionStorage error: ",s)},q(s){try{return ce==null?void 0:ce.sessionStorage.getItem(s)}catch(t){Ns.P(t)}return null},F(s){try{return JSON.parse(Ns.q(s))||null}catch{}return null},A(s,t){try{return ce==null||ce.sessionStorage.setItem(s,JSON.stringify(t)),!0}catch(n){Ns.P(n)}return!1},D(s){try{ce==null||ce.sessionStorage.removeItem(s)}catch(t){Ns.P(t)}}};class n5{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===Mr}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,a=t.opt_out_capturing_cookie_prefix;return t.consent_persistence_name||(a?a+n:"__ph_opt_in_out_"+n)}get Qe(){var t=this.Je.q(this.Ke);return Kd(t)?1:Ge(c4,t)?0:-1}get Je(){var t=this.Te.opt_out_capturing_persistence_type,n=t==="localStorage"?Ft:bn;if(!this.Ye||this.Ye!==n){this.Ye=n;var a=t==="localStorage"?bn:Ft;a.q(this.Ke)&&(this.Ye.q(this.Ke)||this.optInOut(Kd(a.q(this.Ke))),a.D(this.Ke,this.Te.cross_subdomain_cookie))}return this.Ye}Ge(){return!!this.Te.respect_dnt&&[qs==null?void 0:qs.doNotTrack,qs==null?void 0:qs.msDoNotTrack,He.doNotTrack].some((t=>Kd(t)))}}function J1(s,t){var n,a=s==null||(n=s.config)==null?void 0:n.get_current_url;if(!hi(a))return t;try{var l=a(t);return It(l)&&l?l:t}catch(d){return Te.error("Error in get_current_url, falling back to window.location.href",d),t}}var Z1="__POSTHOG_TOOLBAR__",r5=1,a5=3,o5=11;function B0(s){return s instanceof Element&&(s.id===Z1||!(s.closest==null||!s.closest(".toolbar-global-fade-container")))}function er(s){return!!s&&s.nodeType===r5}function di(s,t){return!!s&&!!s.tagName&&s.tagName.toLowerCase()===t.toLowerCase()}function Q1(s){return!!s&&s.nodeType===a5}function eb(s){return!!s&&s.nodeType===o5&&er(s.host)}var tb=1e3;function Fp(s){return s?Au(s).split(/\s+/):[]}function H0(s,t){var n=(function(a){var l,d=ce==null||(l=ce.location)==null?void 0:l.href;return ke(d)?void 0:J1(a,d)})(t);return!!(n&&s&&s.some((a=>n.match(a))))}function vu(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 Fp(t)}function sb(s){return et(s)?null:Au(s).split(/(\s+)/).filter((t=>el(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function ul(s){var t="";return lp(s)&&!ab(s)&&s.childNodes&&s.childNodes.length&&zt(s.childNodes,(function(n){var a;Q1(n)&&n.textContent&&(t+=(a=sb(n.textContent))!==null&&a!==void 0?a:"")})),Au(t)}function af(s){var t;return ke(s.target)?s.srcElement||null:(t=s.target)!=null&&t.shadowRoot?s.composedPath()[0]||null:s.target||null}var qp=["a","button","form","input","select","textarea","label"];function op(s,t){if(ke(t))return!0;var n,a=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=a(l))return n.v;return!1}function ib(s){var t=s.parentNode;return!(!t||!er(t))&&t}var l5=[".ph-no-autocapture","[data-ph-no-autocapture]"],nb=["next","previous","prev",">","<"],c5=[...nb,"+","-","−","–"],I0=(s,t)=>/[a-z0-9]/i.test(t)?s.includes(t):s===t,z0=[".ph-no-rageclick",".ph-no-capture"],u5=["","text","search","email","password","url","tel","number"];function $0(s,t){if(!ce||Wp(s))return!1;var n,a,l,d,p;if(Hi(t)?(n=!!t&&z0,a=void 0,l=!1):(n=(d=t==null?void 0:t.css_selector_ignorelist)!==null&&d!==void 0?d:z0,a=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))&&(!!di(h,"textarea")||(di(h,"input")?Ge(u5,(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=rb(s,!1).targetElementList;return!(function(h,v){if(h===!1||ke(h))return!1;var S;if(h===!0)S=nb;else{if(!Ze(h))return!1;if(h.length>10)return Te.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((A=>I0(x,A)||I0(E,A)))}))})(a,c.map((h=>{var v;return{safeText:ul(h).toLowerCase(),ariaLabel:((v=h.getAttribute("aria-label"))==null?void 0:v.toLowerCase().trim())||""}})))&&!op(c,n)}var Wp=s=>!s||di(s,"html")||!er(s),rb=(s,t)=>{if(!ce||Wp(s))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,a=[s],l=s;l.parentNode&&!di(l,"body");)if(eb(l.parentNode))a.push(l.parentNode.host),l=l.parentNode.host;else{var d=ib(l);if(!d)break;if(t||qp.indexOf(d.tagName.toLowerCase())>-1)n=!0;else try{var p=ce.getComputedStyle(d);p&&p.getPropertyValue("cursor")==="pointer"&&(n=!0)}catch{}a.push(d),l=d}return{parentIsUsefulElement:n,targetElementList:a}};function lp(s){for(var t=new Set,n=0,a=s;a.parentNode&&!di(a,"body");a=a.parentNode){if(n++>=tb||t.has(a))return!1;t.add(a);var l=vu(a);if(Ge(l,"ph-sensitive")||Ge(l,"ph-no-capture"))return!1}if(Ge(vu(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 ab(s){return!!(di(s,"input")&&!["button","checkbox","submit","reset"].includes(s.type)||di(s,"select")||di(s,"textarea")||s.getAttribute("contenteditable")==="true")}var P0=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}))$"),U0=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,h5=[16,15,14,13],d5=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),F0=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),q0=/[0-9A-Za-z_]/;function f5(s){for(var t=0,n=!1,a=s.length-1;a>=0;a--){var l=s.charCodeAt(a)-48;n&&(l*=2)>9&&(l-=9),t+=l,n=!n}return t%10==0}function el(s,t){if(t===void 0&&(t=!0),et(s))return!1;if(It(s)){s=Au(s);var n=t?P0.test((s||"").replace(/[- ]/g,"")):(function(l){var d;for(U0.lastIndex=0;d=U0.exec(l);){var p=d[2];if(p)for(var c=p.replace(/[- ]/g,""),h=0;c.length>h;h++)for(var v of h5){var S=h+v;if(c.length>=S){var f=c.slice(h,S);if(P0.test(f)&&f5(f))return!0}}}return!1})(s);if(n)return!1;var a=t?d5.test(s):(function(l){var d;for(F0.lastIndex=0;d=F0.exec(l);){var p=d[1],c=d[3];if(!(p&&c&&q0.test(p)&&q0.test(c)))return!0}return!1})(s);if(a)return!1}return!0}function W0(s){var t=ul(s);return el(t=(t+" "+ob(s)).trim())?t:""}function ob(s){var t="";return s&&s.childNodes&&s.childNodes.length&&zt(s.childNodes,(function(n){var a;if(n&&((a=n.tagName)==null?void 0:a.toLowerCase())==="span")try{var l=ul(n);t=(t+" "+l).trim(),n.childNodes&&n.childNodes.length&&(t=(t+" "+ob(n)).trim())}catch(d){Te.error("[AutoCapture]",d)}})),t}function G0(s){return s.replace(/"|\\"/g,'\\"')}function p5(s){var t=s.attr__class;if(t)return Ze(t)?t:Fp(t)}var Oc=Zt("[Dead Clicks]"),v5=()=>!0,g5=s=>{var t,n=!((t=s.instance.persistence)==null||!t.get_property(Ip)),a=s.instance.config.capture_dead_clicks;return Hi(a)?a:!!Kt(a)||n};class V0{get lazyLoadedDeadClicksAutocapture(){return this.Xe}constructor(t,n,a){this.instance=t,this.isEnabled=n,this.onCapture=a,this.startIfEnabledOrStop()}onRemoteConfig(t){if(t.ok){var n=t.config;"captureDeadClicks"in n&&(this.instance.persistence&&this.instance.persistence.register({[Ip]:n.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.tr((()=>{this.er()})):this.stop()}tr(t){var n,a;(n=He.__PosthogExtensions__)!=null&&n.initDeadClicksAutocapture?t():(a=He.__PosthogExtensions__)==null||a.loadExternalDependency==null||a.loadExternalDependency(this.instance,"dead-clicks-autocapture",(l=>{l?Oc.error("failed to load script",l):t()}))}er(){var t;if(Ae){if(!this.Xe&&(t=He.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture){var n=Kt(this.instance.config.capture_dead_clicks)?xe({},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(Ae),Oc.info("starting...")}}else Oc.error("`document` not found. Cannot start.")}stop(){this.Xe&&(this.Xe.stop(),this.Xe=void 0,Oc.info("stopping..."))}}var of=Zt("[SegmentIntegration]"),lb="posthog-js";function cb(s,t){var n=t===void 0?{}:t,a=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,A,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)||[],_=m.map((R=>xe({},R,{stacktrace:R.stacktrace?xe({},R.stacktrace,{type:"raw",frames:(R.stacktrace.frames||[]).map((M=>xe({},M,{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:_,$sentry_event_id:S.event_id,$sentry_exception:S.exception,$sentry_exception_message:((A=m[0])==null?void 0:A.value)||S.message,$sentry_exception_type:(C=m[0])==null?void 0:C.type,$sentry_tags:S.tags};return a&&l&&(k.$sentry_url=(d||"https://sentry.io/organizations/")+a+"/issues/?project="+l+"&query="+S.event_id),v&&((b=s.exceptions)==null||b.sendExceptionEvent(k)),S}}class m5{constructor(t,n,a,l,d,p){this.name=lb,this.setupOnce=function(c){c(cb(t,{organization:n,projectId:a,prefix:l,severityAllowList:d,sendExceptionsToPostHog:p==null||p}))}}}class Y0{constructor(t){this.rr=(n,a,l)=>{l&&(l.noSessionId||l.activityTimeout||l.sessionPastMaximumLength||l.crossTabAdoption)&&(Te.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 a,l=this.ar(t,n);return this.ir={pathname:(a=ce==null?void 0:ce.location.pathname)!==null&&a!==void 0?a:"",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 a=this.ir;if(!a)return{$pageview_id:n};var l={$pageview_id:n,$prev_pageview_id:a.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(!(ke(p)||ke(c)||ke(h)||ke(v)||ke(S)||ke(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?Gi(c/p,0,1,Te):1,E=p>1?Gi(h/p,0,1,Te):1,A=v>1?Gi(S/v,0,1,Te):1,C=v>1?Gi(f/v,0,1,Te):1;l=qt(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:A,$prev_pageview_max_content:f,$prev_pageview_max_content_percentage:C})}}return a.pathname&&(l.$prev_pageview_pathname=a.pathname),a.timestamp&&(l.$prev_pageview_duration=(t.getTime()-a.timestamp.getTime())/1e3),l}}var lf=["flags","surveys"],_5={[I1]:{exposure:"hidden"},[Go]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[Vo]:{exposure:"hidden"},[Ff]:{exposure:"event"},[qf]:{exposure:"hidden"},[Wf]:{exposure:"event"},[Gf]:{exposure:"hidden"},[Vf]:{exposure:"event"},[Yf]:{exposure:"event"},[Ip]:{exposure:"event"},[zp]:{exposure:"hidden"},[Kf]:{exposure:"event"},[Nr]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[xa]:{exposure:"hidden"},[$p]:{exposure:"event"},[z1]:{exposure:"event",shouldSkipFromEventProperties:s=>Ws(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(!Kt(s))return{};for(var t={},n=Object.keys(s),a=0;n.length>a;a++)t["$feature/"+n[a]]=s[n[a]];return t}},[qc]:{exposure:"event",storageGroup:"flags"},[Yo]:{exposure:"hidden"},[Xf]:{exposure:"hidden",storageGroup:"flags"},[Wc]:{exposure:"event",storageGroup:"flags"},[Jf]:{exposure:"event",storageGroup:"flags",volatile:!0},[lu]:{exposure:"hidden",storageGroup:"flags"},[gn]:{exposure:"event"},[ba]:{exposure:"hidden"},[Ar]:{exposure:"hidden"},[Rr]:{exposure:"hidden"},[Zf]:{exposure:"hidden",storageGroup:"surveys"},[cu]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[Qf]:{exposure:"event"},[Gc]:{exposure:"hidden"},[Ko]:{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"},[Qo]:{exposure:"hidden"},[ep]:{exposure:"hidden"},[tp]:{exposure:"hidden"},[cl]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Ai]:{exposure:"hidden"},[sp]:{exposure:"hidden"},[ip]:{exposure:"hidden"},[np]:{exposure:"hidden"},[rp]:{exposure:"hidden"},[uu]:{exposure:"hidden"},[hu]:{exposure:"hidden"},[$1]:{exposure:"event"},[P1]:{exposure:"event"},[U1]:{exposure:"event"},[F1]:{exposure:"event"},[W1]:{exposure:"event"},[G1]:{exposure:"event"},[V1]:{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"}},y5=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],xr=s=>{var t=_5[s];if(t)return t;for(var n of y5){var a=n[1];if(s.indexOf(n[0])===0)return a}},Ca=(s,t)=>{try{return JSON.stringify(s,((n,a)=>typeof a=="bigint"?a.toString():a),t)}catch{return o1(s)}},gu=s=>{var t=Ae==null?void 0:Ae.createElement("a");return ke(t)?null:(t.href=s,t)},Oa=function(s,t){for(var n,a=((s.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),l=0;a.length>l;l++){var d=a[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{Te.error("Skipping decoding for malformed query param: "+p)}return p.replace(/\+/g," ")},hl=function(s,t,n){if(!s||!t||!t.length)return s;for(var a=s.split("#"),l=a[1],d=(a[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},ub=(s,t)=>s>=t&&n1(),hb=(s,t,n,a)=>{if(s===0){if(n1()){var l=t+1;return l===n&&a(),l}return t}return 0},Bc="https?://(.*)",Ba=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],b5=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Ba],dl="<masked>",S5=["li_fat_id"];function db(s,t,n){if(!Ae)return{};var a,l=t?[...Ba,...n||[]]:[],d=fb(hl(Ae.URL,l,dl),s),p=(a={},zt(S5,(function(c){var h=K1(c);a[c]=h||null})),a);return qt(p,d)}function fb(s,t){var n=b5.concat(t||[]),a={};return zt(n,(function(l){var d=Oa(s,l);a[l]=d||null})),a}function pb(s){var t=(function(d){return d?d.search(Bc+"google.([^/?]*)")===0?"google":d.search(Bc+"bing.com")===0?"bing":d.search(Bc+"yahoo.com")===0?"yahoo":d.search(Bc+"duckduckgo.com")===0?"duckduckgo":null:null})(s),n=t!="yahoo"?"q":"p",a={};if(!Ws(t)){a.$search_engine=t;var l=Ae?Oa(Ae.referrer,n):"";l.length&&(a.ph_keyword=l)}return a}function K0(){return navigator.language||navigator.userLanguage}var _u="$direct";function vb(){return(Ae==null?void 0:Ae.referrer)||_u}function gb(s,t,n){n===void 0&&(n=!1);var a=s?[...Ba,...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:vb().substring(0,1e3),u:d?hl(d,a,dl):void 0}}function mb(s,t){var n;t===void 0&&(t=!1);var a=s.r,l=s.u,d=t?Qn(l):l,p={$referrer:a,$referring_domain:a==null?void 0:a==_u?_u:(n=gu(a))==null?void 0:n.host};if(d){p.$current_url=d;var c=gu(d);p.$host=c==null?void 0:c.host,p.$pathname=c==null?void 0:c.pathname;var h=fb(d);qt(p,h)}if(a){var v=pb(a);qt(p,v)}return p}function _b(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function w5(){try{return new Date().getTimezoneOffset()}catch{return}}var x5={flags:cl,surveys:cu},C5=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],ma="main";class cf{constructor(t,n,a){if(a===void 0&&(a=!0),this.lr={},this.ur=!1,this.hr=!1,this.Te=t,this.dr=a,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&&Te.info("Persistence loaded",t.persistence,xe({},this.props)),this.update_config(t,t,n),this.save(),ce){var l=()=>this.flush();ts(ce,"beforeunload",l,{capture:!1}),ts(ce,"pagehide",l,{capture:!1})}}mr(){var t,n=(t=this.Te)==null?void 0:t.persistence_save_debounce_ms;return Ls(n)&&n>0?n:0}isDisabled(){return!!this.yr}pr(t){C5.indexOf(t.persistence.toLowerCase())===-1&&(Te.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var n,a=(function(p,c){p===void 0&&(p=[]),c===void 0&&(c=!1);var h=[...s5,...p];return xe({},Ft,{F(v){try{var S={};try{S=bn.F(v)||{}}catch{}var f,x=JSON.parse(Ft.q(v)||"{}");if(c){var E={};for(var A in S){var C=S[A];Ws(C)||C===""||(E[A]=C)}f=qt(x,E)}else f=qt(S,x);return Ft.A(v,f),f}catch{}return null},A(v,S,f,x,E,A){var C=Ft.A(v,S,void 0,void 0,A);try{var y={};h.forEach((b=>{S[b]&&(y[b]=S[b])})),Object.keys(y).length&&bn.A(v,y,f,x,E,A)}catch(b){Ft.P(b)}return C},D(v,S){try{ce==null||ce.localStorage.removeItem(v),bn.D(v,S)}catch(f){Ft.P(f)}}})})(t.cookie_persisted_properties||[],t.__preview_cookie_wins_on_conflict||!1),l=!1,d=t.persistence.toLowerCase();return d==="localstorage"&&Ft.N()?(n=Ft,l=!0):d==="localstorage+cookie"&&a.N()?(n=a,l=!0):d==="sessionstorage"&&Ns.N()?n=Ns:d==="memory"?n=i5:d==="cookie"?n=bn:a.N()?(n=a,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 a=this.props[cl];return!a||typeof a!="number"||Date.now()-a>n}properties(){var t={};return zt(this.props,((n,a)=>{var l=xr(a);if((l==null?void 0:l.exposure)==="derived"){if(l.shouldSkipFromEventProperties!=null&&l.shouldSkipFromEventProperties(n,a===Dr?()=>this._r():()=>!1))return;l.transformToEventProperties&&qt(t,l.transformToEventProperties(n))}else if(!l||l.exposure==="event"){if(l!=null&&l.shouldSkipFromEventProperties!=null&&l.shouldSkipFromEventProperties(n,(()=>!1)))return;t[a]=n}})),t}load(){if(!this.yr){var t=this.Je.F(this.vr);t&&(this.props=qt({},t)),this.hr&&this.wr()}}wr(){for(var t of lf){var n=Ft.F(this.br(t));if(n&&!Kn(n)){var a=this.kr(t);a.persisted=!0,this.Sr(t)||(a.fingerprint=this.Cr(n,t)),this.Mr(t,n)||qt(this.props,n)}}}Sr(t){return Object.keys(this.props).some((n=>{var a;return((a=xr(n))==null?void 0:a.storageGroup)===t}))}Mr(t,n){var a=x5[t];if(!a)return!1;var l=n[a],d=this.props[a];return Ls(l)&&Ls(d)&&d>l}refreshKey(t){var n;if(!this.yr){var a=this.hr?(n=xr(t))==null?void 0:n.storageGroup:void 0,l=a?Ft.F(this.br(a)):this.Je.F(this.vr);if(l&&t in l)this.Ir(t,l[t]);else{if(a){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?ke(this.Er)&&(this.Er=setTimeout((()=>{this.Er=void 0,this.Rr()}),t)):this.Rr()}}flush(){ke(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,ma))}Pr(){var t=this.Fr(),n=t.main,a=t.groups;for(var l of(this.Or(this.Je,this.vr,n,ma),lf)){var d,p=a[l];(!Kn(p)||(d=this.lr[l])!=null&&d.persisted)&&this.Or(Ft,this.br(l),p,l)}}Fr(){var t={},n={flags:{},surveys:{}};return zt(this.props,((a,l)=>{var d,p=(d=xr(l))==null?void 0:d.storageGroup;p?n[p][l]=a:t[l]=a})),{main:t,groups:n}}Cr(t,n){if(n===ma)return JSON.stringify(t)+"|"+this.Ar+"|"+this.$r+"|"+this.Lr;var a={};return zt(t,((l,d)=>{var p;a[d]=(p=xr(d))!=null&&p.volatile?"__volatile__":l})),JSON.stringify(a)}Or(t,n,a,l){var d=this.kr(l);if(l===ma||d.dirty||ke(d.fingerprint)){var p;try{if((p=this.Cr(a,l))===d.fingerprint)return void(d.dirty=!1)}catch{p=void 0}t.A(n,a,this.Ar,this.$r,this.Lr,this.Te.debug)?(d.dirty=!1,l!==ma&&(d.persisted=!0),ke(p)||(d.fingerprint=p)):this.Te.debug&&Te.warn('failed to persist storage entry "'+n+'"; will retry on next save')}}remove(t){var n=(t===void 0?{}:t).keepGroupEntries,a=n!==void 0&&n;if(ke(this.Er)||(clearTimeout(this.Er),this.Er=void 0),this.Je.D(this.vr,!1),this.Je.D(this.vr,!0),!a&&this.dr)for(var l of lf)Ft.D(this.br(l));a?delete this.lr[ma]:this.lr={}}clear(){this.remove(),this.props={}}register_once(t,n,a){if(Kt(t)){ke(n)&&(n="None"),this.Ar=ke(a)?this.Dr:a;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(Kt(t)){this.Ar=ke(n)?this.Dr:n;var a=!1;if(zt(t,((l,d)=>{t.hasOwnProperty(d)&&this.props[d]!==l&&(this.Ir(d,l),a=!0)})),a)return this.save(),!0}return!1}unregister(t){t in this.props&&(this.Tr(t),this.save())}update_campaign_params(){var t=Ae==null?void 0:Ae.URL;if(t!==this.cr){var n=db(this.Te.custom_campaign_params,this.Te.mask_personal_data_properties,this.Te.custom_personal_data_properties);Kn(Up(n))||this.register(n),this.cr=t}}update_search_keyword(){var t;this.register((t=Ae==null?void 0:Ae.referrer)?pb(t):{})}update_referrer_info(){var t;this.register_once({$referrer:vb(),$referring_domain:Ae!=null&&Ae.referrer&&((t=gu(Ae.referrer))==null?void 0:t.host)||_u},void 0)}set_initial_person_info(){this.props[np]||this.props[rp]||this.register_once({[uu]:gb(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([rp,np],(l=>{var d=this.props[l];d&&zt(d,(function(p,c){t["$initial_"+Bf(c)]=p}))}));var n=this.props[uu];if(n){var a=(function(l,d){d===void 0&&(d=!1);var p=mb(l,d),c={};return zt(p,(function(h,v){c["$initial_"+Bf(v)]=h})),c})(n,this.Te.disable_capture_url_hashes);qt(t,a)}return t}safe_merge(t){return zt(this.props,(function(n,a){a in t||(t[a]=n)})),t}update_config(t,n,a){this.Dr=this.Ar=t.cookie_expiration,this.set_disabled(t.disable_persistence||!!a),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 a=this.props[Vo]||{};a[t]=n,this.Ir(Vo,a),this.save()}remove_event_timer(t){var n=this.props[Vo]||{},a=n[t];return ke(a)||(delete n[t],this.Ir(Vo,n),this.save()),a}get_property(t){return this.props[t]}set_property(t,n){this.Ir(t,n),this.save()}Ir(t,n){var a;this.props[t]=n,(a=xr(t))!=null&&a.volatile||this.Nr(t)}Tr(t){delete this.props[t],this.Nr(t)}Nr(t){var n,a=(n=xr(t))==null?void 0:n.storageGroup;a&&(this.kr(a).dirty=!0)}kr(t){return this.lr[t]||(this.lr[t]={})}}function Hc(s){var t=!0;return{dispose(){if(t){t=!1;var n=s();n&&hi(n.then)&&n.then(void 0,(()=>{}))}}}}var Fs={GZipJS:"gzip-js",Base64:"base64"},Ho={Activation:"events",Cancellation:"cancelEvents"},uf={Popover:"popover",API:"api",Widget:"widget"},Sn={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},hf={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},cp={Popover:"popover",Inline:"inline"},E5={SHOWN:"product tour shown"},X0={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},J0=Zt("[RateLimiter]");class k5{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=n=>{var a=n.text;if(a&&a.length)try{(JSON.parse(a).quota_limited||[]).forEach((l=>{J0.info((l||"events")+" is quota limited."),this.serverLimits[l]=new Date().getTime()+6e4}))}catch(l){return void J0.warn('could not rate limit - continuing. Error: "'+(l==null?void 0:l.message)+'"',{text:a})}},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,a,l;t===void 0&&(t=!1);var d=this.captureEventsBurstLimit,p=this.captureEventsPerSecond,c=new Date().getTime(),h=(n=(a=this.instance.persistence)==null?void 0:a.get_property(ip))!==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(ip,h),{isRateLimited:v,remainingTokens:h.tokens}}isServerRateLimited(t){var n=this.serverLimits[t||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var Cr=Zt("[RemoteConfig]");class yb{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,a;(n=He.__PosthogExtensions__)!=null&&n.loadExternalDependency?(a=He.__PosthogExtensions__)==null||a.loadExternalDependency==null||a.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 Cr.info("Using preloaded remote config",this.remoteConfig),this.Br(this.remoteConfig),void this.Hr();if(this._instance.Ur())return void Cr.warn("Remote config is disabled. Falling back to local config.");this.qr((t=>{if(!t)return Cr.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){Cr.error("Error loading remote config",t),this.Br()}}stop(){this.zr&&(clearInterval(this.zr),this.zr=void 0)}refresh(){!this._instance.Ur()&&Ae&&Ae.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||Cr.error("Failed to fetch remote config from PostHog.");try{this._instance.Br(t?{ok:!0,config:t}:{ok:!1})}catch(a){Cr.error("Error applying remote config",a)}if((t==null?void 0:t.hasFeatureFlags)!==!1&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var n;(n=this._instance.featureFlags)==null||n.ensureFlagsLoaded()}catch(a){Cr.error("Error loading feature flags",a)}}}var Di=Uint8Array,ti=Uint16Array,Ha=Uint32Array,Gp=new Di([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]),Vp=new Di([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]),Z0=new Di([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),bb=function(s,t){for(var n=new ti(31),a=0;31>a;++a)n[a]=t+=1<<s[a-1];var l=new Ha(n[30]);for(a=1;30>a;++a)for(var d=n[a];n[a+1]>d;++d)l[d]=d-n[a]<<5|a;return[n,l]},Sb=bb(Gp,2),up=Sb[1];Sb[0][28]=258,up[258]=28;for(var Q0=bb(Vp,0)[1],wb=new ti(32768),Jt=0;32768>Jt;++Jt){var _a=(43690&Jt)>>>1|(21845&Jt)<<1;wb[Jt]=((65280&(_a=(61680&(_a=(52428&_a)>>>2|(13107&_a)<<2))>>>4|(3855&_a)<<4))>>>8|(255&_a)<<8)>>>1}var tl=function(s,t,n){for(var a=s.length,l=0,d=new ti(t);a>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(a),l=0;a>l;++l)p[l]=wb[c[s[l]-1]++]>>>15-s[l];return p},Or=new Di(288);for(Jt=0;144>Jt;++Jt)Or[Jt]=8;for(Jt=144;256>Jt;++Jt)Or[Jt]=9;for(Jt=256;280>Jt;++Jt)Or[Jt]=7;for(Jt=280;288>Jt;++Jt)Or[Jt]=8;var yu=new Di(32);for(Jt=0;32>Jt;++Jt)yu[Jt]=5;var T5=tl(Or,9),A5=tl(yu,5),xb=function(s){return(s/8>>0)+(7&s&&1)},Cb=function(s,t,n){(n==null||n>s.length)&&(n=s.length);var a=new(s instanceof ti?ti:s instanceof Ha?Ha:Di)(n-t);return a.set(s.subarray(t,n)),a},fn=function(s,t,n){var a=t/8>>0;s[a]|=n<<=7&t,s[a+1]|=n>>>8},Io=function(s,t,n){var a=t/8>>0;s[a]|=n<<=7&t,s[a+1]|=n>>>8,s[a+2]|=n>>>16},df=function(s,t){for(var n=[],a=0;s.length>a;++a)s[a]&&n.push({s:a,f:s[a]});var l=n.length,d=n.slice();if(!l)return[new Di(0),0];if(l==1){var p=new Di(n[0].s+1);return p[n[0].s]=1,[p,1]}n.sort((function(R,M){return R.f-M.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(a=1;l>a;++a)d[a].s>x&&(x=d[a].s);var E=new ti(x+1),A=hp(n[S-1],E,0);if(A>t){a=0;var C=0,y=A-t,b=1<<y;for(d.sort((function(R,M){return E[M.s]-E[R.s]||R.f-M.f}));l>a;++a){var m=d[a].s;if(t>=E[m])break;C+=b-(1<<A-E[m]),E[m]=t}for(C>>>=y;C>0;){var _=d[a].s;t>E[_]?C-=1<<t-E[_]++-1:++a}for(;a>=0&&C;--a){var k=d[a].s;E[k]==t&&(--E[k],++C)}A=t}return[new Di(E),A]},hp=function(s,t,n){return s.s==-1?Math.max(hp(s.l,t,n+1),hp(s.r,t,n+1)):t[s.s]=n},ey=function(s){for(var t=s.length;t&&!s[--t];);for(var n=new ti(++t),a=0,l=s[0],d=1,p=function(h){n[a++]=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,a),t]},zo=function(s,t){for(var n=0,a=0;t.length>a;++a)n+=s[a]*t[a];return n},dp=function(s,t,n){var a=n.length,l=xb(t+2);s[l]=255&a,s[l+1]=a>>>8,s[l+2]=255^s[l],s[l+3]=255^s[l+1];for(var d=0;a>d;++d)s[l+d+4]=n[d];return 8*(l+4+a)},ty=function(s,t,n,a,l,d,p,c,h,v,S){fn(t,S++,n),++l[256];for(var f=df(l,15),x=f[0],E=f[1],A=df(d,15),C=A[0],y=A[1],b=ey(x),m=b[0],_=b[1],k=ey(C),R=k[0],M=k[1],j=new ti(19),T=0;m.length>T;++T)j[31&m[T]]++;for(T=0;R.length>T;++T)j[31&R[T]]++;for(var D=df(j,7),I=D[0],q=D[1],W=19;W>4&&!I[Z0[W-1]];--W);var U,Z,se,F,G=v+5<<3,J=zo(l,Or)+zo(d,yu)+p,O=zo(l,x)+zo(d,C)+p+14+3*W+zo(j,I)+(2*j[16]+3*j[17]+7*j[18]);if(J>=G&&O>=G)return dp(t,S,s.subarray(h,h+v));if(fn(t,S,1+(J>O)),S+=2,J>O){U=tl(x,E),Z=x,se=tl(C,y),F=C;var H=tl(I,q);for(fn(t,S,_-257),fn(t,S+5,M-1),fn(t,S+10,W-4),S+=14,T=0;W>T;++T)fn(t,S+3*T,I[Z0[T]]);S+=3*W;for(var L=[m,R],B=0;2>B;++B){var V=L[B];for(T=0;V.length>T;++T)fn(t,S,H[Q=31&V[T]]),S+=I[Q],Q>15&&(fn(t,S,V[T]>>>5&127),S+=V[T]>>>12)}}else U=T5,Z=Or,se=A5,F=yu;for(T=0;c>T;++T)if(a[T]>255){var Q;Io(t,S,U[257+(Q=a[T]>>>18&31)]),S+=Z[Q+257],Q>7&&(fn(t,S,a[T]>>>23&31),S+=Gp[Q]);var ue=31&a[T];Io(t,S,se[ue]),S+=F[ue],ue>3&&(Io(t,S,a[T]>>>5&8191),S+=Vp[ue])}else Io(t,S,U[a[T]]),S+=Z[a[T]];return Io(t,S,U[256]),S+Z[256]},R5=new Ha([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),M5=(function(){for(var s=new Ha(256),t=0;256>t;++t){for(var n=t,a=9;--a;)n=(1&n&&3988292384)^n>>>1;s[t]=n}return s})(),ff=function(s,t,n){for(;n;++t)s[t]=n,n>>>=8};function D5(s,t){t===void 0&&(t={});var n=(function(){var f=4294967295;return{p(x){for(var E=f,A=0;x.length>A;++A)E=M5[255&E^x[A]]^E>>>8;f=E},d(){return 4294967295^f}}})(),a=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,A,C,y){var b=f.length,m=new Di(A+b+5*(1+Math.floor(b/7e3))+C),_=m.subarray(A,m.length-C),k=0;if(!x||8>b)for(var R=0;b>=R;R+=65535){var M=R+65535;b>M?k=dp(_,k,f.subarray(R,M)):(_[R]=!0,k=dp(_,k,f.subarray(R,b)))}else{for(var j=R5[x-1],T=j>>>13,D=8191&j,I=(1<<E)-1,q=new ti(32768),W=new ti(I+1),U=Math.ceil(E/3),Z=2*U,se=function(_t){return(f[_t]^f[_t+1]<<U^f[_t+2]<<Z)&I},F=new Ha(25e3),G=new ti(288),J=new ti(32),O=0,H=0,L=(R=0,0),B=0,V=0;b>R;++R){var Q=se(R),ue=32767&R,fe=W[Q];if(q[ue]=fe,W[Q]=ue,R>=B){var Y=b-R;if((O>7e3||L>24576)&&Y>423){k=ty(f,_,0,F,G,J,H,L,V,R-V,k),L=O=H=0,V=R;for(var z=0;286>z;++z)G[z]=0;for(z=0;30>z;++z)J[z]=0}var oe=2,ae=0,we=D,Ee=ue-fe&32767;if(Y>2&&Q==se(R-Ee))for(var Ue=Math.min(T,Y)-1,$e=Math.min(32767,R),We=Math.min(258,Y);$e>=Ee&&--we&&ue!=fe;){if(f[R+oe]==f[R+oe-Ee]){for(var Fe=0;We>Fe&&f[R+Fe]==f[R+Fe-Ee];++Fe);if(Fe>oe){if(oe=Fe,ae=Ee,Fe>Ue)break;var Ne=Math.min(Ee,Fe-2),$t=0;for(z=0;Ne>z;++z){var pt=R-Ee+z+32768&32767,Nt=pt-q[pt]+32768&32767;Nt>$t&&($t=Nt,fe=pt)}}}Ee+=(ue=fe)-(fe=q[ue])+32768&32767}if(ae){F[L++]=268435456|up[oe]<<18|Q0[ae];var xt=31&up[oe],ls=31&Q0[ae];H+=Gp[xt]+Vp[ls],++G[257+xt],++J[ls],B=R+oe,++O}else F[L++]=f[R],++G[f[R]]}}k=ty(f,_,!0,F,G,J,H,L,V,R-V,k)}return Cb(m,0,A+xb(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&&ff(f,4,Math.floor(new Date(x.mtime||Date.now())/1e3)),E){f[3]=8;for(var A=0;E.length>=A;++A)f[A+10]=E.charCodeAt(A)}})(v,t),ff(v,S-8,n.d()),ff(v,S-4,a),v}var j5=!!Nf||!!jp,Eb="text/plain",Yc=!1,kb=(s,t)=>{var n=s.split("#"),a=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:"")+(a?"#"+a:"")},Mu=function(s,t,n){var a;n===void 0&&(n=!0);var l=s.split("?"),d=l[0],p=l[1],c=xe({},t),h=(a=p==null?void 0:p.split("&").map((S=>{var f,x=S.split("="),E=x[0],A=n&&(f=c[E])!==null&&f!==void 0?f:x[1];return delete c[E],E+"="+A})))!==null&&a!==void 0?a:[],v=(function(S,f){var x,E;f===void 0&&(f="&");var A=[];return zt(S,(function(C,y){ke(C)||ke(y)||y==="undefined"||(x=encodeURIComponent((b=>b instanceof File)(C)?C.name:C.toString()),E=encodeURIComponent(y),A[A.length]=E+"="+x)})),A.join(f)})(c);return v&&h.push(v),h.length>0?d+"?"+h.join("&"):d},pf=s=>{if(s.Vr)return s.Vr;var t=s.data,n=s.compression;if(t){if(n===Fs.GZipJS){var a=D5((function(c,h){var v=c.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(c);for(var S=new Di(c.length+(c.length>>>1)),f=0,x=function(y){S[f++]=y},E=0;v>E;++E){if(f+5>S.length){var A=new Di(f+8+(v-E<<1));A.set(S),S=A}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 Cb(S,0,f)})(Ca(t)),{mtime:0});return{contentType:Eb,body:a.buffer.slice(a.byteOffset,a.byteOffset+a.byteLength),estimatedSize:a.byteLength}}if(n===Fs.Base64){var l=(function(c){return c&&btoa(encodeURIComponent(c).replace(/%([0-9A-F]{2})/g,((h,v)=>String.fromCharCode(parseInt(v,16)))))})(Ca(t)),d=(c=>"data="+encodeURIComponent(typeof c=="string"?c:Ca(c)))(l);return{contentType:"application/x-www-form-urlencoded",body:d,estimatedSize:new Blob([d]).size}}var p=Ca(t);return{contentType:"application/json",body:p,estimatedSize:new Blob([p]).size}}},Tb=s=>{var t,n,a=()=>s.transport==="sendBeacon"?{url:Mu(s.url,{compression:Fs.Base64}),encodedBody:pf(xe({},s,{compression:Fs.Base64,Vr:void 0}))}:{url:kb(s.url,"compression"),encodedBody:pf(xe({},s,{compression:void 0,Vr:void 0}))};try{t=pf(s)}catch(l){if(w0(s.compression,Oa(s.url,"compression")))return Te.error("Failed to gzip request body, sending uncompressed payload",l),a();throw l}return t&&w0(s.compression,Oa(s.url,"compression"))&&!((n=t.body)instanceof ArrayBuffer?Lf(new Uint8Array(n)):ArrayBuffer.isView(n)&&Lf(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)))?(Yc=!0,a()):{url:s.url,encodedBody:t}},Ab=s=>{try{return Tb(s)}catch(t){return Te.error(t),void(s.callback==null||s.callback({statusCode:0,error:t}))}},N5=(function(){var s=Xt((function*(t){var n=Ca(t.data),a=yield(function(d,p,c){return Of.apply(this,arguments)})(n,At.DEBUG,{rethrow:!0});if(!a)return t;var l=yield a.arrayBuffer();return xe({},t,{Vr:{contentType:Eb,body:l,estimatedSize:l.byteLength}})}));return function(t){return s.apply(this,arguments)}})(),L5=/Failed to fetch|NetworkError|Load failed/i,Rb=s=>{var t=Ab(s);if(t){var n=t.url,a=t.encodedBody,l=a??{},d=l.contentType,p=l.body,c=l.estimatedSize,h=new Headers;zt(s.headers,(function(A,C){h.append(C,A)})),d&&h.append("Content-Type",d);var v=null,S=!1;if(g0){var f=new g0;v={signal:f.signal,timeout:setTimeout((()=>{var A,C;S=!0,f.abort((A=s.timeout,(C=new Error("PostHog request timed out"+(A?" after "+A+"ms":""))).name="AbortError",C))}),s.timeout)}}var x=A=>{S&&(A==null?void 0:A.name)==="AbortError"||(C=>(C==null?void 0:C.name)==="TypeError"&&L5.test((C==null?void 0:C.message)||""))(A)?Te.warn(A):Te.error(A),s.callback==null||s.callback({statusCode:0,error:A})};try{var E;jp(n,xe({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((A=>A.text().then((C=>{var y={statusCode:A.status,text:C};if(A.status===200)try{y.json=JSON.parse(C)}catch(b){Te.error(b)}s.callback==null||s.callback(y)})))).catch(x).finally((()=>v?clearTimeout(v.timeout):null))}catch(A){v&&clearTimeout(v.timeout),x(A)}}},fp=s=>{try{var t,n=Tb(s),a=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(qs.sendBeacon(a,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:xe({},s.data,{batch:x});return fp(xe({},s,{data:f(v.slice(0,S))})),void fp(xe({},s,{data:f(v.slice(S))}))}Te.warn("Beacon of ~"+(c??0)+" bytes was rejected by the browser, falling back to fetch"),Rb(xe({},s,{Wr:!0}))}catch(x){Te.warn("Beacon send failed",x)}},sy=(s,t,n,a)=>{var l=a==="query"?t==="POST"?"sent_at":"_":void 0;return Mu(n===Fs.GZipJS?kb(s,"compression"):s,xe({},l?{[l]:Date.now().toString()}:{},n===Fs.GZipJS?{}:{compression:n}))},Kc=[];jp&&Kc.push({transport:"fetch",method:Rb}),Nf&&Kc.push({transport:"XHR",method(s){var t=Ab(s);if(t){var n=new Nf,a=t.encodedBody;n.open(s.method||"GET",t.url,!0);var l=a??{},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)}}}),qs!=null&&qs.sendBeacon&&Kc.push({transport:"sendBeacon",method:fp});var pp=3e3;class O5{constructor(t,n){this.Zr=!0,this.Gr=[],this.Qr=Gi((n==null?void 0:n.flush_interval_ms)||pp,250,5e3,Te.createLogger("flush interval"),pp),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((a=>a.url.indexOf("/e")===0)),...n.filter((a=>a.url.indexOf("/e")!==0))].map((a=>{this.ei(xe({},a,{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(),a=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)a()}}),this.Qr))}ei(t){try{this.Jr(t)}catch(n){Te.error(n)}}Xr(){clearTimeout(this.Kr),this.Kr=void 0}ti(){var t={};return zt(this.Gr,(n=>{var a,l=n,d=(l?l.batchKey:null)||l.url;ke(t[d])&&(t[d]=xe({},l,{data:[]})),(a=t[d].data)==null||a.push(l.data)})),this.Gr=[],t}}var B5=["retriesPerformedSoFar"];class H5{constructor(t){this.ri=!1,this.ii=3e3,this.Gr=[],this._instance=t,this.Gr=[],this.ni=!0,!ke(ce)&&"onLine"in ce.navigator&&(this.ni=ce.navigator.onLine,this.si=()=>{this.ni=!0,this.oi()},this.ai=()=>{this.ni=!1},ts(ce,"online",this.si),ts(ce,"offline",this.ai))}get length(){return this.Gr.length}retriableRequest(t){var n=t.retriesPerformedSoFar,a=r1(t,B5);vn(n)&&(a.url=Mu(a.url,{retry_count:n})),this._instance._send_request(xe({},a,{callback:l=>{if(l.statusCode!==200&&(400>l.statusCode||l.statusCode>=500)){if((l.statusCode===0?3:10)>(n??0))return void this.Ot(xe({retriesPerformedSoFar:n},a));l.statusCode===0&&Te.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.")}a.callback==null||a.callback(l)}}))}Ot(t){var n=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=n+1;var a=(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()+a;this.Gr.push({retryAt:l,requestOptions:t});var d="Enqueued failed request for retry in "+a;navigator.onLine||(d+=" (Browser is offline)"),Te.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=[],a=this.Gr.filter((d=>t>d.retryAt||(n.push(d),!1)));if(this.Gr=n,a.length>0)for(var l of a)this.retriableRequest(l.requestOptions)}unload(){for(var t of(this.ui&&(clearTimeout(this.ui),this.ui=void 0),this.ri=!1,ke(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(xe({},n,{transport:"sendBeacon"}))}catch(a){Te.error(a)}}this.Gr=[]}}class I5{constructor(t){this.hi=()=>{var n,a,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,(a=this.di.maxScrollHeight)!==null&&a!==void 0?a: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(){ts(ce,"scroll",this.hi,{capture:!0}),ts(ce,"scrollend",this.hi,{capture:!0}),ts(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 a=ce==null?void 0:ce.document.querySelector(n);if(a)return a}}vi(t){var n=t==="y"?"scrollTop":"scrollLeft";if(this.ci){var a=this.scrollElement();return a&&a[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 z5=s=>gb(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 iy{constructor(t,n,a,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=a,this.gi=l||z5,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?mb(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(Up(this.getSetOnceProps()),((n,a)=>{a==="$current_url"&&(a="url"),t["$session_entry_"+Bf(a)]=n})),t}}class Yp{on(t,n){return this.bi[t]||(this.bi[t]=[]),this.bi[t].push(n),()=>{this.bi[t]=this.bi[t].filter((a=>a!==n))}}emit(t,n){for(var a of this.bi[t]||[])a(n);for(var l of this.bi["*"]||[])l(t,n)}constructor(){this.bi={}}}var $o=Zt("[SessionId]");class ny{on(t,n){return this.wi.on(t,n)}constructor(t,n,a){var l;if(this.xi=null,this.ki=[],this.Si=void 0,this.Ci=!1,this.wi=new Yp,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=a||_n;var d=this.Te.persistence_name||this.Te.token;if(this._sessionTimeoutMs=1e3*Gi(this.Te.session_idle_timeout_seconds||1800,60,36e3,$o.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=Ns.F(this.Oi),c=Ns.F(this.Fi);p&&!c?this.Ii=p:Ns.D(this.Oi),Ns.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){$o.error("Invalid sessionID in bootstrap",v)}this.Li()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return ke(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&&Ns.N()}Di(t){t!==this.Ii&&(this.Ii=t,this.Ai()&&Ns.A(this.Oi,t))}Ni(){return this.Ii?this.Ii:this.Ai()?Ns.F(this.Oi):null}qi(t){var n=this.xi;return!Ws(n)&&!Ws(t)&&5e3>Math.abs(t-n)}$i(t,n,a){var l=n!==this._sessionActivityTimestamp,d=!(t!==this.Ti||a!==this._sessionStartTimestamp);this._sessionStartTimestamp=a,this._sessionActivityTimestamp=n,this.Ti=t,d&&!l||d&&this.qi(n)||(this.xi=n,this.mi.register({[xa]:[n,t,a]}))}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(xa):(this.mi.flush(),this.mi.load())}Hi(){var t;if(!Ws(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({[xa]:[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,a=vn(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(n,a)}Vi(t){return this.Bi(),this.Mi(t,this.zi())}Ui(){var t=this.mi.props[xa];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(fu,this.Si,{capture:!1}),this.Si=void 0),this.ki=[]}Li(){this.Si=()=>{this.Hi(),this.Ai()&&Ns.D(this.Fi)},ts(ce,fu,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 a=n||new Date().getTime(),l=this.Ui(),d=l[1],p=l[2],c=this.zi(),h=this.Ni(),v=vn(p)&&Math.abs(a-p)>864e5,S=!1,f=!1,x=!d,E=d,A=!x&&!t&&this.Mi(a,c);if(A){(A=this.Vi(a))||$o.info("cross-tab refresh kept the session alive",{sessionId:d});var C=this.Ui();d=C[1],p=C[2]}x||A||v?(d=this.Ei(),h=this.Ri(),$o.info("new session ID generated",{sessionId:d,windowId:h,changeReason:{noSessionId:x,activityTimeout:A,sessionPastMaximumLength:v}}),p=a,S=!0):(h||(h=this.Ri(),S=!0),(f=d!==E)&&($o.info("adopted cross-tab session id",{sessionId:d,windowId:h}),S=!0));var y=vn(c)&&t&&!v?c:a,b=vn(p)?p:new Date().getTime();this.Di(h),this.$i(d,y,b),t||this.Pi();var m={noSessionId:x,activityTimeout:A,sessionPastMaximumLength:v,crossTabAdoption:f};return S&&this.ki.forEach((_=>_(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 Mb=function(s,t){if(!s)return!1;var n=s.userAgent;if(n&&C0(n,t))return!0;try{var a=s==null?void 0:s.userAgentData;if(a!=null&&a.brands&&a.brands.some((l=>C0(l==null?void 0:l.brand,t))))return!0}catch{}return!!s.webdriver};function Db(){return(Db=Xt((function*(){var s=qs==null?void 0:qs.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(a){return void Te.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",a)}}))).apply(this,arguments)}var bu=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 vf(s,t,n){return Ca({distinct_id:s,userPropertiesToSet:t,userPropertiesToSetOnce:n})}var jb={exact:(s,t)=>t.some((n=>s.some((a=>n===a)))),is_not:(s,t)=>t.every((n=>s.every((a=>n!==a)))),regex:(s,t)=>t.some((n=>s.some((a=>bu(n,a))))),not_regex:(s,t)=>t.every((n=>s.every((a=>!bu(n,a))))),icontains:(s,t)=>t.map(Ic).some((n=>s.map(Ic).some((a=>n.includes(a))))),not_icontains:(s,t)=>t.map(Ic).every((n=>s.map(Ic).every((a=>!n.includes(a))))),gt:(s,t)=>t.some((n=>{var a=parseFloat(n);return!isNaN(a)&&s.some((l=>a>parseFloat(l)))})),lt:(s,t)=>t.some((n=>{var a=parseFloat(n);return!isNaN(a)&&s.some((l=>a<parseFloat(l)))}))},Ic=s=>s.toLowerCase();function Nb(s,t){return!s||Object.entries(s).every((n=>{var a=n[1],l=t==null?void 0:t[n[0]];if(ke(l)||Ws(l))return!1;var d=[String(l)],p=jb[a.operator];return!!p&&p(a.values,d)}))}var vp="custom",ry="i.posthog.com",$5=/^\/static\//;class P5{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("."+ry,".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":vp),this.Zi[this.apiHost]}Gi(t){if($5.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 a=this.Gi(n);if(a)return""+a+n}if(this.region===vp)return this.apiHost+n;var l=ry+n;switch(t){case"assets":return"https://"+this.region+"-assets."+l;case"api":return"https://"+this.region+"."+l}}}function Lb(s){var t;return!((t=s.conditions)==null||(t=t.events)==null||(t=t.values)==null||!t.length)}var jt=Zt("[Surveys]"),Ob="seenSurvey_",Bb=s=>{try{var t=(n=>((a,l)=>""+Ob+(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)}},U5=[uf.Popover,uf.Widget,uf.API],F5={ignoreConditions:!1,ignoreDelay:!1,displayType:cp.Popover},q5=Zt("[PostHog ExternalIntegrations]"),W5={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class G5{constructor(t){this._instance=t}tr(t,n){var a;(a=He.__PosthogExtensions__)==null||a.loadExternalDependency==null||a.loadExternalDependency(this._instance,t,(l=>{if(l)return q5.error("failed to load script",l);n()}))}startIfEnabledOrStop(){var t=this,n=function(){var d,p,c,h=a[0],v=a[1];!v||(d=He.__PosthogExtensions__)!=null&&(d=d.integrations)!=null&&d[h]||t.tr(W5[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 a of Object.entries((l=this._instance.config.integrations)!==null&&l!==void 0?l:{})){var l;n()}}}class V5{constructor(t,n){this.it=t,this.Qi=n,this.Ji=new Map,this.Ki=!1}add(t){var n=this;return Xt((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 a=t.setup(n.Qi);a&&(yield a)}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&&hi(n.then)&&n.then(void 0,(a=>{this.it.error('Failed to dispose browser extension "'+t.name+'"',a)}))}catch(a){this.it.error('Failed to dispose browser extension "'+t.name+'"',a)}}}class Y5{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 a;(a=this._instance.persistence)==null||a.set_property(t,n)}remove(t){var n;(n=this._instance.persistence)==null||n.unregister(t)}}var ay="extensionsRemoteConfig";class K5{constructor(t){this.Ki=!1,this.instance=t,this.it=Te.createLogger("[BrowserExtensions]"),this.Xi=t.tn,this.kv=new Y5(t),this.onEvent=n=>Hc(this.instance.on("eventCaptured",(a=>{try{n({event:a.event,properties:a.properties})}catch(l){this.it.error("Browser extension event listener failed",l)}}))),this.onRemoteConfig=n=>{if(this.Ki)return Hc((()=>{}));var a=d=>{try{n(d)}catch(p){this.it.error("Browser extension remote config listener failed",p)}},l=this.instance.en.on(ay,a);return this.Xi&&a(this.Xi),Hc(l)},this.rn=new V5(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(ll))!==null&&t!==void 0?t:this.distinctId}get groups(){return this.instance.getGroups()}get session(){try{var t,n,a,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:(a=d==null?void 0:d.windowId)!==null&&a!==void 0?a:"",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,a){var l=this;return Xt((function*(){a?l.instance.capture(t,n,{timestamp:a.timestamp,uuid:a.uuid,$set:a.set,$set_once:a.setOnce}):l.instance.capture(t,n)}))()}registerDynamicEventProperties(t){return Hc(this.instance.nn(t))}handleRemoteConfig(t){this.Ki||(this.Xi=t,this.instance.en.emit(ay,t))}sendRequest(t,n){var a=this;return Xt((function*(){var l;n===void 0&&(n={});var d=a.instance.requestRouter.endpointFor((l=n.target)!==null&&l!==void 0?l:"api",t),p={method:n.method,url:n.query?Mu(d,n.query):d,data:n.body,headers:n.headers,timeout:n.timeoutMs,fireCallbackOnDrop:!0,transport:n.transport};return n.transport==="sendBeacon"?(a.instance._send_request(p),{statusCode:202}):new Promise((c=>{p.callback=c,a.instance._send_request(p)}))}))()}dispose(){this.Ki||(this.Ki=!0,this.rn.dispose())}}var sl={},gf=0,Su=()=>{},oy='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Po="Surveys module not available",ly="sanitize_properties is deprecated. Use before_send instead",Hb="Invalid value for property_denylist config: ",X5=["token","distinct_id",q1],wa="posthog",Ib=!j5&&(ei==null?void 0:ei.indexOf("MSIE"))===-1&&(ei==null?void 0:ei.indexOf("Mozilla"))===-1,mf=s=>{var t;return xe({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:J4(Ae==null?void 0:Ae.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Su,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){Te.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:ap,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:pp},error_tracking:{},_onCapture:Su},(n=>({rageclick:n&&n>="2026-05-30"?{content_ignorelist:c5,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))},J5=[["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"]],cy=s=>{var t={};for(var n of J5){var a=n[0],l=n[1];ke(s[a])||(t[l]=s[a])}var d=qt({},t,s),p=s.__preview_external_dependency_versioned_paths;return ke(p)||(ke(s.strict_script_versioning)&&(d.strict_script_versioning=!!p),It(p)&&ke(s.asset_host)&&(d.asset_host=p)),Ze(s.property_blacklist)&&(ke(s.property_denylist)?d.property_denylist=s.property_blacklist:Ze(s.property_denylist)?d.property_denylist=[...s.property_blacklist,...s.property_denylist]:Te.error(Hb+s.property_denylist)),d};class Z5{constructor(){this.__forceAllowLocalhost=!1}get sn(){return this.__forceAllowLocalhost}set sn(t){Te.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class Ri{an(t,n){if(t){var a=this.Ji.indexOf(t);a!==-1&&this.Ji.splice(a,1)}return this.Ji.push(n),n.initialize==null||n.initialize(),n}ln(){return this.config.cookieless_mode===yn||this.config.cookieless_mode===Mr&&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 Z5,this.un=!1,this.version=At.LIB_VERSION,this.en=new Yp,this.Ji=[],this.hn=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=mf(),this.SentryIntegration=m5,this.sentryIntegration=a=>(function(l,d){var p=cb(l,d);return{name:lb,processEvent:c=>p(c)}})(this,a),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.dn=!1,this.cn=null,this.vn=null,this.fn=null,this.scrollManager=new I5(this),this.pageViewManager=new Y0(this),this.rateLimiter=new k5(this),this.requestRouter=new P5(this),this.consent=new n5(this),this.externalIntegrations=new G5(this);var n=(t=Ri.__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:(a,l,d)=>{var p=It(a)?{[a]:l}:a;this.setPersonProperties(p),d==null||d({})},set_once:(a,l,d)=>{var p=It(a)?{[a]:l}:a;this.setPersonProperties(void 0,p),d==null||d({})}},this.on("eventCaptured",(a=>Te.info('send "'+(a==null?void 0:a.event)+'"',a)))}init(t,n,a){if(a&&a!==wa){var l,d=(l=sl[a])!==null&&l!==void 0?l:new Ri;return d._init(t,n,a),sl[a]=d,sl[wa][a]=d,d}return this._init(t,n,a)}_init(t,n,a){var l,d;n===void 0&&(n={});var p=It(t)?t.trim():"";if(!p)return Te.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=mf(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=mf(n.defaults),h=cy(n),v=qt({},c,h,{name:a,token:p});Kt(c.rageclick)&&Kt(h.rageclick)&&(v.rageclick=qt({},c.rageclick,h.rageclick)),Kt(c.session_recording)&&Kt(h.session_recording)&&(v.session_recording=qt({},c.session_recording,h.session_recording)),this.set_config(v),this.config.on_xhr_error&&Te.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:Fs.GZipJS;var S=this.yn();this.persistence=new cf(this.config,S),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new cf(xe({},this.config,{persistence:"sessionStorage"}),S,!1);var f=xe({},this.persistence.props),x=xe({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.bn=new O5((k=>this._n(k)),this.config.request_queue_config),this.wn=new H5(this),this.__request_queue=[];var E=this.ln();if(E||(this.sessionManager=new ny(this),this.sessionPropsManager=new iy(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(Te.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.xn(E)}),0)):(Te.info("Initializing extensions synchronously"),this.xn(E)),At.DEBUG=At.DEBUG||this.config.debug,At.DEBUG&&Te.info("Starting in debug mode",{this:this,config:n,thisC:xe({},this.config),p:f,s:x}),!this.config.identity_distinct_id||(l=n.bootstrap)!=null&&l.distinctID||(n.bootstrap=xe({},n.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((d=n.bootstrap)==null?void 0:d.distinctID)!==void 0){var A=n.bootstrap.distinctID,C=this.get_distinct_id(),y=this.persistence.get_property(Ai);if(n.bootstrap.isIdentifiedID&&C!=null&&C!==A&&y===ga)this.identify(A);else if(n.bootstrap.isIdentifiedID&&C!=null&&C!==A&&y===Sr)Te.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:A;this.persistence.set_property(Ai,n.bootstrap.isIdentifiedID?Sr:ga),this.register({distinct_id:A,$device_id:m})}}if(E)this.register_once({distinct_id:jc,$device_id:null},"");else if(!this.get_distinct_id()){var _=this.config.get_device_id(_n());this.register_once({distinct_id:_,$device_id:_},""),this.persistence.set_property(Ai,ga)}return ts(ce,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),n.segment?(function(k,R){var M=k.config.segment;if(!M)return R();(function(j,T){var D=j.config.segment;if(!D)return T();var I=W=>{var U=()=>W.anonymousId()||_n();j.config.get_device_id=U,W.id()&&(j.register({distinct_id:W.id(),$device_id:U()}),j.persistence.set_property(Ai,Sr)),T()},q=D.user();"then"in q&&hi(q.then)?q.then(I):I(q)})(k,(()=>{M.register((j=>{typeof Promise<"u"&&Promise.resolve||of.warn("This browser does not have Promise support, and can not use the segment integration");var T=(D,I)=>{if(!I)return D;D.event.userId||D.event.anonymousId===j.get_distinct_id()||(of.info("No userId set, resetting PostHog"),j.reset()),D.event.userId&&D.event.userId!==j.get_distinct_id()&&(of.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=>T(D,D.event.event),page:D=>T(D,Sa),identify:D=>T(D,nf),screen:D=>T(D,"$screen")}})(k)).then((()=>{R()}))}))})(this,(()=>this.kn())):this.kn(),hi(this.config._onCapture)&&this.config._onCapture!==Su&&(Te.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(k=>this.config._onCapture(k.event,k)))),this.config.ip&&Te.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 Db.apply(this,arguments)})().then((k=>{k&&this.register({[tf]:k})})).catch(Su),this}xn(t){var n,a,l,d,p,c,h,v,S=performance.now(),f=xe({},Ri.__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=(a=this.exceptions)!==null&&a!==void 0?a: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,g5)),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((A=>A.onRemoteConfig==null?void 0:A.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 a=t.shift();if(a)try{a()}catch(d){Te.error("Error initializing extension:",d)}}var l=Math.round(performance.now()-n);this.register_for_session({[W1]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[G1]:l}),this.config.__preview_deferred_init_extensions&&Te.info("PostHog extensions initialized ("+l+"ms)")}Br(t){var n;if(!Ae||!Ae.body)return Te.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 a,l=t.config;l.supportedCompression&&!this.config.disable_compression&&(this.compression=Ge(l.supportedCompression,Fs.GZipJS)?Fs.GZipJS:Ge(l.supportedCompression,Fs.Base64)?Fs.Base64:void 0),(a=l.analytics)!=null&&a.endpoint&&(this.analyticsDefaultEndpoint=l.analytics.endpoint)}this.set_config({person_profiles:this.vn?this.vn:ap}),(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(a){Te.critical("`loaded` function failed",a)}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 yb(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()&&Nc(this.__request_queue,(t=>this._n(t))),this.__request_queue=[],this.In()}_handle_unload(){var t,n,a,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(sf),(a=this.logs)==null||a.flushLogs("sendBeacon"),(l=this.bn)==null||l.unload(),(d=this.wn)==null||d.unload()):this.Rn()&&this.capture(sf,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded?Ib?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=xe({},this.config.request_headers,t.headers),t.compression=t.compression==="best-available"?this.compression:t.compression,(ke(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 a,l,d,p=xe({},n);p.timeout=p.timeout||6e4;var c,h,v,S,f,x=(a=p.transport)!==null&&a!==void 0?a:"fetch";x==="sendBeacon"&&ke(p.compression)&&p.data&&(p.compression=Fs.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=>xe({},b,{sent_at:y}))):xe({},C,{sent_at:y})})(p.data))),p.url=sy(p.url,p.method,p.compression,p.timestampMode);var E=Kc.filter((C=>!p.disableTransport||!C.transport||!p.disableTransport.includes(C.transport))),A=(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(!A)throw new Error("No available transport method");x!=="sendBeacon"&&p.data&&p.compression===Fs.GZipJS&&Q3&&typeof Promise<"u"&&!Yc?N5(p).then((C=>{A(C)})).catch((C=>{if(x0(C))return Yc=!0,void A(xe({},p,{compression:void 0,url:sy(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===a1})(C)&&(Yc=!0),A(p)})):A(p)})(xe({},t,{callback:n=>{var a,l;this.rateLimiter.checkForLimiting(n),400>n.statusCode||(a=(l=this.config).on_request_error)==null||a.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){gf++;try{var n,a=[],l=[],d=[];Nc(t,(c=>{if(c)if(Ze(n=c[0]))d.push(c);else if(hi(c))try{c.call(this)}catch(h){Te.error("Error executing queued PostHog call",c,h)}else Ze(c)&&n==="alias"?a.push(c):Ze(c)&&n.indexOf("capture")!==-1&&hi(this[n])?d.push(c):l.push(c)}));var p=function(c,h){Nc(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){Te.error("Error executing queued PostHog call",v,f)}}))};p(a,this),p(l,this),p(d,this)}finally{gf--}}push(t){if(gf>0&&Ze(t)&&It(t[0])){var n=Ri.prototype[t[0]];hi(n)&&n.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,n,a){var l,d,p,c,h,v,S;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.bn){if(this.is_capturing())if(!ke(t)&&It(t)){var f=!this.config.opt_out_useragent_filter&&this._is_bot();if(!f||this.config.__preview_capture_bot_pageviews){var x=a!=null&&a.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(x==null||!x.isRateLimited){if(this.hn.length>0){var E={};for(var A of this.hn.slice())try{qt(E,A())}catch(H){Te.error("Failed to produce browser extension event properties",H)}n=xe({},E,n??{})}var C;(l=n)!=null&&l.$current_url&&!It((d=n)==null?void 0:d.$current_url)&&(Te.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"||a!=null&&a.Pn||Te.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=(a==null?void 0:a.timestamp)||y,m=A0(a==null?void 0:a.uuid,_n),_={uuid:m,event:t,properties:this.calculateEventProperties(t,n||{},b,m)};t===Sa&&this.config.__preview_capture_bot_pageviews&&f&&(_.event="$bot_pageview",_.properties.$browser_type="bot"),x&&(_.properties.$lib_rate_limit_remaining_tokens=x.remainingTokens);var k=t==="$feature_flag_called"&&_.properties.$feature_flag_has_experiment===!1&&this.get_property(lu)===!0;a!=null&&a.$set&&!k&&(_.$set=a==null?void 0:a.$set);var R=a==null?void 0:a.$unset;R&&(_.$unset=R);var M,j,T,D=k?void 0:this.On(a==null?void 0:a.$set_once,t!==N0,t===nf);if(D&&(_.$set_once=D),a!=null&&a._noTruncate||(c=this.config.properties_string_max_length,h=_,v=H=>It(H)?H.slice(0,c):H,S=new Set,_=(function H(L,B){if(L!==Object(L))return v?v(L):L;if(!S.has(L)){var V;if(S.add(L),Ze(L))V=[],Nc(L,(ue=>{V.push(H(ue))}));else{var Q={};zt(L,((ue,fe)=>{S.has(ue)||(Q[fe]=H(ue))})),V=Q}return V}})(h)),_.timestamp=b,ke(a==null?void 0:a.timestamp)||(_.properties.$event_time_override_provided=!0,_.properties.$event_time_override_system_time=y),k&&(_.properties=(function(H,L){L===void 0&&(L=[]);var B={},V=Q=>{H[Q]!==void 0&&(B[Q]=H[Q])};return e4.forEach(V),L.forEach(V),B})(_.properties,X5)),t===Sn.DISMISSED||t===Sn.SENT){var I,q,W=(I=n)==null?void 0:I[hf.SURVEY_ID],U=(q=n)==null?void 0:q[hf.SURVEY_ITERATION];Bb({id:W,current_iteration:U}),_.$set=xe({},_.$set,{[(M={id:W,current_iteration:U},j=t===Sn.SENT?"responded":"dismissed",T="$survey_"+j+"/"+M.id,M.current_iteration&&M.current_iteration>0&&(T="$survey_"+j+"/"+M.id+"/"+M.current_iteration),T)]:!0})}else t===Sn.SHOWN&&(_.$set=xe({},_.$set,{[hf.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(t===E5.SHOWN){var Z,se=(Z=n)==null?void 0:Z[X0.TOUR_TYPE];se&&(_.$set=xe({},_.$set,{[X0.TOUR_LAST_SEEN_DATE+"/"+se]:new Date().toISOString()}))}var F=xe({},_.properties.$set,_.$set);if(Kn(F)||this.setPersonPropertiesForFlags(F),!et(this.config.before_send)){var G=this.Rt(_);if(!G)return;(_=G).uuid=A0(_.uuid,_n)}this.en.emit("eventCaptured",_);var J=(p=a==null?void 0:a._url)!==null&&p!==void 0?p:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),O={method:"POST",url:J,data:_,compression:"best-available",timestampMode:(a==null?void 0:a._batchKey)==="recordings"||/\/s\/(?:\?|$)/.test(J)?"body":"capture-body",batchKey:a==null?void 0:a._batchKey,transport:a==null?void 0:a.transport};return!this.config.request_batching||a&&(a==null||!a._batchKey)||a!=null&&a.send_instantly?this._n(O):this.bn.enqueue(O),_}Te.critical("This capture call is ignored due to client rate limiting.")}}else Te.error("No event name provided to posthog.capture")}else Te.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 K5(this)}nn(t){this.hn.push(t);var n=!0;return()=>{if(n){n=!1;var a=this.hn.indexOf(t);a!==-1&&this.hn.splice(a,1)}}}calculateEventProperties(t,n,a,l,d){if(a=a||new Date,!this.persistence||!this.sessionPersistence)return n;var p=d?void 0:this.persistence.remove_event_timer(t),c=xe({},n);if(c.token=this.config.token,c.$config_defaults=this.config.defaults,this.ln()&&(c[q1]=!0),t==="$snapshot"){var h=xe({},this.persistence.properties(),this.sessionPersistence.properties());return c.distinct_id=h.distinct_id,(!It(c.distinct_id)&&!Ls(c.distinct_id)||Hf(c.distinct_id))&&Te.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),c}var v,S=(function(_,k,R,M){var j,T,D,I;if(M===void 0&&(M=!1),!ei)return{};var q,W=_?[...Ba,...k||[]]:[],U=(function(Ue){for(var $e=0;k0.length>$e;$e++){var We=k0[$e],Fe=We[1],Ne=We[0].exec(Ue),$t=Ne&&(hi(Fe)?Fe(Ne,Ue):Fe);if($t)return $t}return["",""]})(ei),Z=U[0],se=U[1],F=(q=typeof navigator<"u"?navigator:void 0)!=null&&q.brave?{brave:!0}:{},G={};ke(R)||(G.detectGoogleSearchApp=R);var J={},O=(j=navigator)==null||(j=j.userAgentData)==null?void 0:j.platform,H=(T=navigator)==null?void 0:T.maxTouchPoints,L=ce==null||(D=ce.screen)==null?void 0:D.width,B=ce==null||(I=ce.screen)==null?void 0:I.height,V=ce==null?void 0:ce.devicePixelRatio;ke(O)||(J.userAgentDataPlatform=O),ke(H)||(J.maxTouchPoints=H),ke(L)||(J.screenWidth=L),ke(B)||(J.screenHeight=B),ke(V)||(J.devicePixelRatio=V);var Q,ue,fe,Y,z,oe,ae,we,Ee=qt(Up({$os:Z,$os_version:se,$browser:M1(ei,navigator.vendor,F,G),$device:T0(ei),$device_type:(ue=ei,fe=J,we=T0(ue),we===d1||we===h1||we==="Kobo"||we==="Kindle Fire"||we===E1?ja:we===al||we===Ra||we===ol||we===zf?"Console":we===p1?"Wearable":we?fi:(fe==null?void 0:fe.userAgentDataPlatform)==="Android"&&((Y=fe==null?void 0:fe.maxTouchPoints)!==null&&Y!==void 0?Y:0)>0?600>Math.min((z=fe==null?void 0:fe.screenWidth)!==null&&z!==void 0?z:0,(oe=fe==null?void 0:fe.screenHeight)!==null&&oe!==void 0?oe:0)/((ae=fe==null?void 0:fe.devicePixelRatio)!==null&&ae!==void 0?ae:1)?fi:ja:"Desktop"),$timezone:_b(),$timezone_offset:w5()}),{$current_url:hl(M?Qn(hs==null?void 0:hs.href):hs==null?void 0:hs.href,W,dl),$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:y4(ei,navigator.vendor,F,G),$browser_language:K0(),$browser_language_prefix:(Q=K0(),typeof Q=="string"?Q.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:At.LIB_NAME,$lib_version:At.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return At.SDK_DIST_CHANNEL&&(Ee.$sdk_dist_channel=At.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,a.getTime()),x=f.windowId;c.$session_id=f.sessionId,c.$window_id=x}this.sessionPropsManager&&qt(c,this.sessionPropsManager.getSessionProps());try{var E;this.sessionRecording&&qt(c,this.sessionRecording.sdkDebugProperties),c.$sdk_debug_retry_queue_size=(E=this.wn)==null?void 0:E.length}catch(_){c.$sdk_debug_error_capturing_properties=String(_)}if(this.requestRouter.region===vp&&(c.$lib_custom_api_host=this.config.api_host),v=t!==Sa||d?t!==sf||d?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(a):this.pageViewManager.doPageView(a,l),c=qt(c,v),t===Sa&&Ae&&(c.title=Ae.title),!ke(p)){var A=a.getTime()-p;c.$duration=parseFloat((A/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"],(_=>{_ in C&&delete y[_]})),(c=qt({},S,C,y,c)).$is_identified=this._isIdentified(),Ze(this.config.property_denylist)?zt(this.config.property_denylist,(function(_){delete c[_]})):Te.error(Hb+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var b=this.config.sanitize_properties;b&&(Te.error(ly),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,a){var l;if(n===void 0&&(n=!0),a===void 0&&(a=!1),!this.persistence||!this.An()||this.un&&!a)return t;var d=this.persistence.get_initial_props(),p=(l=this.sessionPropsManager)==null?void 0:l.getSetOnceProps(),c=qt({},d,p||{},t||{}),h=this.config.sanitize_properties;return h&&(Te.error(ly),c=h(c,"$set_once")),n&&(this.un=!0),Kn(c)?void 0:c}register(t,n){var a;(a=this.persistence)==null||a.register(t,n)}register_once(t,n,a){var l;(l=this.persistence)==null||l.register_once(t,n,a)}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 a;return(a=this.featureFlags)==null?void 0:a.getFeatureFlag(t,n)}getFeatureFlagPayload(t){var n;return(n=this.featureFlags)==null?void 0:n.getFeatureFlagPayload(t)}getFeatureFlagResult(t,n){var a;return(a=this.featureFlags)==null?void 0:a.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 a,l;return(a=(l=this.featureFlags)==null?void 0:l.isFeatureEnabled(t,n))!==null&&a!==void 0?a:n==null?void 0:n.defaultValue}reloadFeatureFlags(){var t;(t=this.featureFlags)==null||t.reloadFeatureFlags()}updateFlags(t,n,a){var l;(l=this.featureFlags)==null||l.updateFlags(t,n,a)}updateEarlyAccessFeatureEnrollment(t,n,a){var l;(l=this.featureFlags)==null||l.updateEarlyAccessFeatureEnrollment(t,n,a)}getEarlyAccessFeatures(t,n,a){var l;return n===void 0&&(n=!1),(l=this.featureFlags)==null?void 0:l.getEarlyAccessFeatures(t,n,a)}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:Po}),()=>{})}onSessionId(t){var n,a;return(n=(a=this.sessionManager)==null?void 0:a.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:Po})}getActiveMatchingSurveys(t,n){n===void 0&&(n=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,n):t([],{isLoaded:!1,error:Po})}renderSurvey(t,n){var a;(a=this.surveys)==null||a.renderSurvey(t,n)}displaySurvey(t,n){var a;n===void 0&&(n=F5),(a=this.surveys)==null||a.displaySurvey(t,n)}cancelPendingSurvey(t){var n;(n=this.surveys)==null||n.cancelPendingSurvey(t)}canRenderSurvey(t){var n,a;return(n=(a=this.surveys)==null?void 0:a.canRenderSurvey(t))!==null&&n!==void 0?n:{visible:!1,disabledReason:Po}}canRenderSurveyAsync(t,n){var a,l;return n===void 0&&(n=!1),(a=(l=this.surveys)==null?void 0:l.canRenderSurveyAsync(t,n))!==null&&a!==void 0?a:Promise.resolve({visible:!1,disabledReason:Po})}Dn(t){return!t||Hf(t)?(Te.critical("Unique user id has not been set in posthog.identify"),!1):t===jc?(Te.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())||(Te.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,a){if(!this.__loaded||!this.persistence)return Te.uninitializedWarning("posthog.identify");if(Ls(t)&&(t=t.toString(),Te.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(ll)||this.register_once({$had_persisted_distinct_id:!0,$device_id:l},""),t!==l&&t!==this.get_property(Go)&&(this.unregister(Go),this.register({distinct_id:t}));var d,p=(this.persistence.get_property(Ai)||ga)===ga,c=t!==l,h=!c&&p;if(c&&p)this.persistence.set_property(Ai,Sr),this.setPersonPropertiesForFlags({$set:n||{},$set_once:a||{}},!1),this.capture(nf,{distinct_id:t,$anon_distinct_id:l},{$set:n||{},$set_once:a||{}}),this.fn=vf(t,n,a),(d=this.featureFlags)==null||d.setAnonymousDistinctId(l);else if(h){this.persistence.set_property(Ai,Sr);var v=n||{},S=a||{};this.setPersonPropertiesForFlags({$set:v,$set_once:S},!1),this.capture("$set",{$set:v,$set_once:S}),this.fn=vf(t,n,a)}else(n||a)&&this.setPersonProperties(n,a);c?(this.reloadFeatureFlags(),this.unregister(Qo)):h&&(n||a)&&this.reloadFeatureFlags()}}setPersonProperties(t,n){if((t||n)&&this.$n("posthog.setPersonProperties")){var a=vf(this.get_distinct_id(),t,n);this.fn!==a?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:n||{}},!0),this.capture("$set",{$set:t||{},$set_once:n||{}}),this.fn=a):Te.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var n,a=(Ze(t)?t:[t]).filter((l=>It(l)&&l.length>0));a.length!==0&&this.$n("posthog.unsetPersonProperties")&&((n=this.featureFlags)==null||n.unsetPersonPropertiesForFlags(a,!0),this.capture("$set",{$unset:a}),this.fn=null)}group(t,n,a){if(t&&n){var l=this.getGroups(),d=l[t]!==n;if(d&&this.resetGroupPropertiesForFlags(t),this.register({$groups:xe({},l,{[t]:n})}),d||a){var p={$group_type:t,$group_key:n};a&&(p.$group_set=a),this.capture(N0,p)}a&&this.setGroupPropertiesForFlags({[t]:a}),d&&!a&&this.reloadFeatureFlags()}else Te.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,n){var a;n===void 0&&(n=!0),(a=this.featureFlags)==null||a.setPersonPropertiesForFlags(t,n)}resetPersonPropertiesForFlags(t){var n;t===void 0&&(t=!0),(n=this.featureFlags)==null||n.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,n){var a;n===void 0&&(n=!0),this.$n("posthog.setGroupPropertiesForFlags")&&((a=this.featureFlags)==null||a.setGroupPropertiesForFlags(t,n))}resetGroupPropertiesForFlags(t){var n;(n=this.featureFlags)==null||n.resetGroupPropertiesForFlags(t)}reset(t){var n,a,l,d,p,c,h,v,S,f;if(Te.info("reset"),!this.__loaded)return Te.uninitializedWarning("posthog.reset");var x,E=this.get_property(ll),A=this.get_property(tf),C=this.get_property(Nr);if(this.consent.reset(),(n=this.persistence)==null||n.clear(),(a=this.sessionPersistence)==null||a.clear(),ke(C)||(x=this.persistence)==null||x.register({[Nr]: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(Ai,ga),(f=this.sessionManager)==null||f.resetSessionId(),this.fn=null,this.config.cookieless_mode===yn)this.register_once({distinct_id:jc,$device_id:null},"");else{var y=this.config.get_device_id(_n());this.register_once({distinct_id:y,$device_id:t?y:E},""),t||ke(A)||this.register({[tf]:A})}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 Xt((function*(){var a,l,d,p,c,h,v;n.__loaded?((a=n.En)==null||a.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()):Te.uninitializedWarning("posthog.shutdown")}))()}setIdentity(t,n){var a;this.config.identity_distinct_id=t,this.config.identity_hash=n,this.alias(t),(a=this.conversations)==null||a.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),a=n.sessionStartTimestamp,l=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+n.sessionId);if(t!=null&&t.withTimestamp&&a){var d,p=(d=t.timestampLookBack)!==null&&d!==void 0?d:10;if(!a)return l;l+="?t="+Math.max(Math.floor((new Date().getTime()-a)/1e3)-p,0)}return l}alias(t,n){return t===this.get_property(I1)?(Te.critical("Attempting to create alias for existing People user - aborting."),-2):this.$n("posthog.alias")?(ke(n)&&(n=this.get_distinct_id()),t!==n?(this.Ln(Go,t),this.capture("$create_alias",{alias:t,distinct_id:n})):(Te.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var n=xe({},this.config);if(Kt(t)){var a,l,d,p,c,h,v,S,f,x,E;qt(this.config,cy(t));var A=this.yn();(a=this.persistence)==null||a.update_config(this.config,n,A),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new cf(xe({},this.config,{persistence:"sessionStorage"}),A,!1);var C=this.pn(this.config.debug);Hi(C)&&(this.config.debug=C),Hi(this.config.debug)&&(this.config.debug?(At.DEBUG=!0,Ft.N()&&Ft.A("ph_debug",!0),Te.info("set_config",{config:t,oldConfig:n,newConfig:xe({},this.config)})):(At.DEBUG=!1,Ft.N()&&Ft.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){At.LIB_NAME=t,At.LIB_VERSION=n}startSessionRecording(t){var n,a,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&&((a=this.sessionRecording)==null||a.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 a=new Error("PostHog syntheticException"),l=this.exceptions.buildProperties(t,{handled:!0,syntheticException:a});return this.exceptions.sendExceptionEvent(xe({},l,n))}}addExceptionStep(t,n){var a;(a=this.exceptions)==null||a.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:Ri.Bn}startExceptionAutocapture(t){this.set_config({capture_exceptions:t==null||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var n,a;return(n=(a=this.toolbar)==null?void 0:a.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:wa;return n!==wa&&(n=wa+"."+n),n}_isIdentified(){var t,n;return((t=this.persistence)==null?void 0:t.get_property(Ai))===Sr||((n=this.sessionPersistence)==null?void 0:n.get_property(Ai))===Sr}An(){var t,n;return!(this.config.person_profiles==="never"||this.config.person_profiles===ap&&!this._isIdentified()&&Kn(this.getGroups())&&((t=this.persistence)==null||(t=t.props)==null||!t[Go])&&((n=this.persistence)==null||(n=n.props)==null||!n[hu]))}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"?(Te.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Ln(hu,!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!==Mr)}jn(){var t,n,a,l,d=this.yn();return((t=this.persistence)==null?void 0:t.yr)!==d&&((a=this.persistence)==null||a.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 a,l,d,p,c;this.reset(!0),(a=this.sessionManager)==null||a.destroy(),(l=this.pageViewManager)==null||l.destroy(),this.sessionManager=new ny(this),this.pageViewManager=new Y0(this),this.persistence&&(this.sessionPropsManager=new iy(this,this.sessionManager,this.persistence));var h,v=(d=(p=this.config.__extensionClasses)==null?void 0:p.sessionRecording)!==null&&d!==void 0?d:(c=Ri.__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==Mr&&((S=this.surveys)==null||S.loadIfEnabled()),(ke(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 Te.warn(oy)}opt_out_capturing(){var t,n,a;this.config.cookieless_mode!==yn?(this.config.cookieless_mode===Mr&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.jn(),this.config.cookieless_mode===Mr&&(this.register({distinct_id:jc,$device_id:null}),(t=this.sessionRecording)==null||t.stopRecording(),this.sessionRecording=void 0,(n=this.sessionManager)==null||n.destroy(),(a=this.pageViewManager)==null||a.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.Tn(),this.In())):Te.warn(oy)}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===Mr?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.jn()}_is_bot(){return qs?Mb(qs,this.config.custom_blocked_useragents):void 0}Tn(){Ae&&(Ae.visibilityState==="visible"?this.dn||(this.dn=!0,this.capture(Sa,{title:Ae.title},{send_instantly:!0}),this.cn&&(Ae.removeEventListener(du,this.cn),this.cn=null)):this.cn||(this.cn=this.Tn.bind(this),ts(Ae,du,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?(Te.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,a,l,d,p){var c=a in n&&!et(n[a]),h=l in n&&!et(n[l]);return c?n[a]:!!h&&(p&&p.warn("Config field '"+l+"' is deprecated. Please use '"+a+"' instead. The old field will be removed in a future major version."),n[l])})(t,"advanced_disable_flags","advanced_disable_decide",0,Te)}Rt(t){var n;if(et(this.config.before_send))return t;var a=Object.keys((n=t.properties)!==null&&n!==void 0?n:{}).filter(o4),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 a4(t.event)?Te.warn(c+". This can cause unexpected behavior."):Te.info(c),null}d.properties&&!Kn(d.properties)||Te.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}for(var h of a)if(d.properties&&et(d.properties[h]))return Te.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,a){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:n,$ai_metric_value:String(a)})}pn(t){var n=Hi(t)&&!t,a=Ft.N()&&Ft.q("ph_debug")==="true";return!n&&(!!a||t)}}Ri.__defaultExtensionClasses={},Ri.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]]=K4(s.prototype[t[n]])})(Ri,["identify"]);class uy{constructor(t){this.disabled=t===!1;var n=Kt(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,a){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>a-l.timestamp){if(this.clicks.push({x:t,y:n,timestamp:a}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:n,timestamp:a}];return!1}}var _f="$copy_autocapture",yf=Zt("[AutoCapture]");function bf(s,t){return t.length>s?t.slice(0,s)+"...":t}function Q5(s){if(s.previousElementSibling)return s.previousElementSibling;var t=s;do t=t.previousSibling;while(t&&!er(t));return t}function eT(s,t){var n,a,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&&!di(x,"body")&&tb>S.length;)if(eb(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 A,C,y=[],b={},m=!1,_=!1;if(zt(S,(T=>{var D=lp(T);if(di(T,"a")){var I=T.getAttribute("href");m=!!(D&&I&&el(I))&&(v?Qn(I):I)}Ge(vu(T),"ph-no-capture")&&(_=!0),y.push((function(W,U,Z,se,F){F===void 0&&(F=!1);var G=W.tagName.toLowerCase(),J={tag_name:G};qp.indexOf(G)>-1&&!Z&&(J.$el_text=G.toLowerCase()==="a"||G.toLowerCase()==="button"?bf(1024,W0(W)):bf(1024,ul(W)));var O=vu(W);O.length>0&&(J.classes=O.filter((function(V){return V!==""}))),zt(W.attributes,(function(V){var Q;if((!ab(W)||["name","id","class","aria-label"].indexOf(V.name)!==-1)&&(se==null||!se.includes(V.name))&&!U&&el(V.value)&&(!It(Q=V.name)||Q.substring(0,10)!=="_ngcontent"&&Q.substring(0,7)!=="_nghost")){var ue=V.value;V.name==="class"&&(ue=Fp(ue).join(" ")),J["attr__"+V.name]=bf(1024,V.name==="href"&&F?Qn(ue):ue)}}));for(var H=1,L=1,B=W;B=Q5(B);)H++,B.tagName===W.tagName&&L++;return J.nth_child=H,J.nth_of_type=L,J})(T,d,p,c,v));var q=(function(W){if(!lp(W))return{};var U={};return zt(W.attributes,(function(Z){if(Z.name&&Z.name.indexOf("data-ph-capture-attribute")===0){var se=Z.name.replace("data-ph-capture-attribute-",""),F=Z.value;se&&F&&el(F)&&(U[se]=F)}})),U})(T);qt(b,q)})),_)return{props:{},explicitNoCapture:_};if(p||(y[0].$el_text=di(s,"a")||di(s,"button")?W0(s):ul(s)),m){var k,R;y[0].attr__href=m;var M=(k=gu(m))==null?void 0:k.host,j=ce==null||(R=ce.location)==null?void 0:R.host;M&&j&&M!==j&&(A=m)}return{props:qt({$event_type:l.type,$ce_version:1},h?{}:{$elements:y},{$elements_chain:(C=y,(function(T){return T.map((D=>{var I,q,W="";if(D.tag_name&&(W+=D.tag_name),D.attr_class)for(var U of(D.attr_class.sort(),D.attr_class))W+="."+U.replace(/"/g,"");var Z=xe({},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 Vc(Z).sort(((F,G)=>F[0].localeCompare(G[0]))).forEach((F=>{var G=F[1];return se[G0(F[0].toString())]=G0(G.toString())})),(W+=":")+Vc(se).map((F=>F[0]+'="'+F[1]+'"')).join("")})).join(";")})((function(T){return T.map((D=>{var I,q,W={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:p5(D),attr_id:D.attr__id,nth_child:D.nth_child,nth_of_type:D.nth_of_type,attributes:{}};return Vc(D).filter((U=>U[0].indexOf("attr__")===0)).forEach((U=>W.attributes[U[0]]=U[1])),W}))})(C)))},(n=y[0])!=null&&n.$el_text?{$el_text:(a=y[0])==null?void 0:a.$el_text}:{},A&&l.type==="click"?{$external_click_url:A}:{},b)}}var Uo=Zt("[ExceptionAutocapture]"),hy=()=>{},tT=Zt("[TracingHeaders]"),Er=Zt("[Web Vitals]"),dy=9e5,fy="disabled",py="lazy_loading",Fo="awaiting_config",zc="missing_config";Zt("[SessionRecording]"),Zt("[SessionRecording]");var gp="[SessionRecording]",pn=Zt(gp),sT=Zt("[Heatmaps]");function Sf(s){return Kt(s)&&"clientX"in s&&"clientY"in s&&Ls(s.clientX)&&Ls(s.clientY)}var wf=Zt("[Product Tours]"),xf=s=>{var t;return!s.config.disable_product_tours&&!((t=s.persistence)==null||!t.get_property(zp))},iT=["$set_once","$set"],Fi=Zt("[SiteApps]"),vy="Error while initializing PostHog app with config id ";function ya(s,t,n){if(et(s))return!1;switch(n){case"exact":return s===t;case"contains":var a=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(a,"i").test(s);case"regex":try{return new RegExp(t).test(s)}catch{return!1}default:return!1}}class nT{constructor(t){this.Hn=new Yp,this.Un=(n,a)=>this.zn(n,a)&&this.Vn(n,a)&&this.Wn(n,a)&&this.Zn(n,a),this.zn=(n,a)=>a==null||!a.event||(n==null?void 0:n.event)===(a==null?void 0:a.event),this._instance=t,this.Gn=new Set,this.Qn=new Set}init(){var t,n;ke((t=this._instance)==null?void 0:t._addCaptureHook)||(n=this._instance)==null||n._addCaptureHook(((a,l)=>{this.on(a,l)}))}register(t){var n,a;if(!ke((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)||"")}))})),(a=this._instance)!=null&&a.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 a;n!=null&&t.length!=0&&(this.Gn.has(t)||this.Gn.has(n.event))&&this.Qn&&((a=this.Qn)==null?void 0:a.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 a of n.steps)if(this.Un(t,a))return!0;return!1}onAction(t,n){return this.Hn.on(t,n)}Vn(t,n){if(n!=null&&n.url){var a,l=t==null||(a=t.properties)==null?void 0:a.$current_url;if(!l||typeof l!="string"||!ya(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 a;if(n==null||!n.href)return!0;var l=this.es(t);if(l.length>0)return l.some((c=>ya(c.href,n.href,n.href_matching||"exact")));var d,p=(t==null||(a=t.properties)==null?void 0:a.$elements_chain)||"";return!!p&&ya((d=p.match(/(?::|")href="(.*?)"/))?d[1]:"",n.href,n.href_matching||"exact")}Xn(t,n){var a;if(n==null||!n.text)return!0;var l=this.es(t);if(l.length>0)return l.some((v=>ya(v.text,n.text,n.text_matching||"exact")||ya(v.$el_text,n.text,n.text_matching||"exact")));var d,p,c,h=(t==null||(a=t.properties)==null?void 0:a.$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=>ya(v,p,c))))}ts(t,n){var a,l;if(n==null||!n.selector)return!0;var d=t==null||(a=t.properties)==null?void 0:a.$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||Nb(n.properties.reduce(((a,l)=>{var d=Ze(l.value)?l.value.map(String):l.value!=null?[String(l.value)]:[];return a[l.key]={values:d,operator:l.operator||"exact"},a}),{}),t==null?void 0:t.properties)}}class rT{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((a=>this.ls(a)))}us(t,n){return!!t&&Nb(t.propertyFilters,n==null?void 0:n.properties)}hs(t,n){var a=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=a.get(p.name)||[];c.push(l.id),a.set(p.name,c)}}))})),a}ds(t,n,a){var l=(a===Ho.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[a])==null||(c=c.values)==null?void 0:c.find((v=>v.name===t));return this.us(h,n)}))}register(t){var n;ke((n=this._instance)==null?void 0:n._addCaptureHook)||(this.vs(t),this.fs(t))}fs(t){var n=t.filter((a=>{var l,d;return((l=a.conditions)==null?void 0:l.actions)&&((d=a.conditions)==null||(d=d.actions)==null||(d=d.values)==null?void 0:d.length)>0}));n.length!==0&&(this.ps==null&&(this.ps=new nT(this._instance),this.ps.init(),this.ps.Kn((a=>{this.onAction(a)}))),n.forEach((a=>{var l,d,p,c,h;a.conditions&&(l=a.conditions)!=null&&l.actions&&(d=a.conditions)!=null&&(d=d.actions)!=null&&d.values&&((p=a.conditions)==null||(p=p.actions)==null||(p=p.values)==null?void 0:p.length)>0&&((c=this.ps)==null||c.register(a.conditions.actions.values),(h=a.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(a.id),this.os.set(v.name,S||[a.id])}})))})))}vs(t){var n,a=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}));a.length===0&&l.length===0||((n=this._instance)==null||n._addCaptureHook(((d,p)=>{this.onEvent(d,p)})),this.ns=this.hs(t,Ho.Activation),this.ss=this.hs(t,Ho.Cancellation))}onEvent(t,n){var a,l,d=this.gs(),p=(n==null||(a=n.properties)==null?void 0:a.$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,Ho.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,Ho.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((a=>a!==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 a=this.Ms(),l=a.filter((d=>!n.has(d)));l.length!==a.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,a=this.Ms();if(a.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?a:[]}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,a=(n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[this.Es()];a&&a!==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 aT extends rT{constructor(t){super(t)}Ts(){return Qf}Es(){return Gc}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({[Qf]:t})}Rs(t){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[Gc]:t})}Ps(){var t;(t=this._instance)==null||(t=t.persistence)==null||t.unregister(Gc)}Os(){return!1}ys(t,n){var a;this.cs((d=>{a=d.find((p=>p.id===n))}));var l=!a||(function(d){var p;return Lb(d)&&!((p=d.conditions)==null||(p=p.events)==null||!p.repeatedActivation)||d.schedule==="always"})(a);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 $c="SDK is not enabled or survey functionality is not yet loaded",gy="Disabled. Not loading surveys.",oT=ce!=null&&ce.location?mu(ce.location.hash,"__posthog")||mu(location.hash,"state"):null,my="_postHogToolbarParams",_y=Zt("[Toolbar]"),ms=Zt("[FeatureFlags]"),kr=Zt("[FeatureFlags]",{debugEnabled:!0}),Cf=`" failed. Feature flags didn't load in time.`,yy=s=>{for(var t={},n=0;s.length>n;n++)t[s[n]]=!0;return t},by=s=>{var t={};for(var n of Vc(s||{})){var a=n[1];a&&(t[n[0]]=a)}return t},qi=Zt("[Error tracking]"),Sy="Refusing to render web experiment since the viewer is a likely bot",lT={icontains:(s,t)=>t.toLowerCase().indexOf(s.toLowerCase())>-1,not_icontains:(s,t)=>t.toLowerCase().indexOf(s.toLowerCase())===-1,regex:(s,t)=>bu(t,s),not_regex:(s,t)=>!bu(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(a){a===void 0&&(a=!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)}}))}),a)},this._instance=t,this._instance.onFeatureFlags((a=>{this.onFeatureFlags(a)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())Is.$s(Sy);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 a;if(this.Ls&&(a=this.Ls)!=null&&a.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=Oa(t==null?void 0:t.search,"__experiment_id"),a=Oa(t==null?void 0:t.search,"__experiment_variant");n&&a&&(Is.$s("previewing web experiments "+n+" && "+a),this.getWebExperiments((l=>{this.qs(parseInt(n),a,l)}),!1,!0))}}loadIfEnabled(){this.Te.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,n,a){if(this.Te.disable_web_experiments&&!a)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,a){var l=a.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 a;if(et(t.conditions)||et((a=t.conditions)==null?void 0:a.url))return!0;var l=Is.getWindowLocation();if(l){var d,p,c,h=J1(n,l.href);return(d=t.conditions)==null||!d.url||lT[(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 a=db();if(a.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)==a.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)==a.utm_source,A=(h=t.conditions)==null||(h=h.utm)==null||!h.utm_medium||((v=t.conditions)==null||(v=v.utm)==null?void 0:v.utm_medium)==a.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)==a.utm_term;return x&&A&&C&&E}return!1}static $s(t){for(var n=arguments.length,a=new Array(n>1?n-1:0),l=1;n>l;l++)a[l-1]=arguments[l];Te.info("[WebExperiments] "+t,a)}Ds(t,n,a){this._is_bot()?Is.$s(Sy):n!=="control"?a.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 qs&&this._instance?Mb(qs,this.Te.custom_blocked_useragents):void 0}}var Ti=Zt("[Conversations]"),Tr="Conversations not available yet.",wy="console",Du={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&&ts(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,ms.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||(ms.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 a=n&&typeof n=="string"&&n.trim().length>0;return a||ms.error("Invalid evaluation context found:",n,"Expected non-empty string"),a})):[]}no(){return this.io().length>0}so(){var s=this.Te.flag_keys;if(!ke(s)){if(Ze(s))return s.filter((t=>{var n=t&&typeof t=="string"&&t.trim().length>0;return n||ms.error("Invalid flag key found:",t,"Expected non-empty string"),n}));ms.error("Invalid flag_keys found:",s,"Expected array of non-empty strings")}}initialize(){var s,t,n=this._instance.config,a=(s=(t=n.bootstrap)==null?void 0:t.featureFlags)!==null&&s!==void 0?s:{};if(Object.keys(a).length){var l,d,p=(l=(d=n.bootstrap)==null?void 0:d.featureFlagPayloads)!==null&&l!==void 0?l:{},c=Object.keys(a).filter((v=>!!a[v])).reduce(((v,S)=>(v[S]=a[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 a,l,d=n!=null&&n.merge&&(a=this.Xs(Dr))!==null&&a!==void 0?a:{},p=n!=null&&n.merge&&(l=this.Xs(Wc))!==null&&l!==void 0?l:{},c=xe({},d,s),h=xe({},p,t),v={};for(var S of Object.entries(c)){var f=S[0],x=S[1];v[f]={key:f,enabled:y0(x),variant:b0(x),reason:void 0,metadata:ke(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(Xf),t=this.Xs(gn),n=this.Xs(ba);if(!n&&!t)return s||{};var a=qt({},s||{}),l=[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])];for(var d of l){var p,c,h=a[d],v=t==null?void 0:t[d],S=ke(v)?(p=h==null?void 0:h.enabled)!==null&&p!==void 0&&p:!!v,f=ke(v)?h.variant:typeof v=="string"?v:void 0,x=n==null?void 0:n[d],E=xe({},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=xe({},h==null?void 0:h.metadata,{payload:x,original_payload:h==null||(c=h.metadata)==null?void 0:c.payload})),a[d]=E}return this.Hs||(ms.warn(" Overriding feature flag details!",{flagDetails:s,overriddenPayloads:n,finalDetails:a}),this.Hs=!0),a}getAllFeatureFlags(){var s=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(s).map((n=>{var a=s[n];return{key:n,enabled:y0(a),variant:b0(a),payload:_0(t[n])}}))}getFlagVariants(){var s=this.Xs(Dr),t=this.Xs(gn);if(!t)return s||{};for(var n=qt({},s),a=Object.keys(t),l=0;a.length>l;l++)n[a[l]]=t[a[l]];return this.Hs||(ms.warn(" Overriding feature flags!",{enabledFlags:s,overriddenFlags:t,finalFlags:n}),this.Hs=!0),n}getFlagPayloads(){var s=this.Xs(Wc),t=this.Xs(ba);if(!t)return s||{};for(var n=qt({},s||{}),a=Object.keys(t),l=0;a.length>l;l++)n[a[l]]=t[a[l]];return this.Hs||(ms.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,a=this.Xs(ll),l={token:n,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:xe({},((t=this.mi)==null?void 0:t.get_initial_props())||{},this.Xs(Ar)||{},{$lib:At.LIB_NAME,$lib_version:At.LIB_VERSION}),group_properties:this.Xs(Rr),timezone:_b()};Ws(a)||ke(a)||(l.$device_id=a),(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();ke(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:Fs.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 A,C=!((S=h.json)==null||(S=S.quotaLimited)==null||!S.includes("feature_flags"));C&&E.push("quota_limited"),(f=this.mi)==null||f.register({[tp]:E}),C?ms.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((A=h.json)!==null&&A!==void 0?A:{},x,{partialResponse:p}),this.Ws&&(this.Ws=!1,this.ao()))}}})}}Ys(){return ub(this.Js,3)}uo(s){this.Js=hb(s,this.Js,3,(()=>ms.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 a=this.getFeatureFlagResult(s,t);return(n=a==null?void 0:a.variant)!==null&&n!==void 0?n:a==null?void 0:a.enabled}}else ms.warn('getFeatureFlag for key "'+s+Cf)}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(),a=s in n,l=n[s],d=this.getFlagPayloads()[s],p=String(l),c=this.Xs(Jf)||void 0,h=this.Xs(cl)||void 0,v=this.Xs(Qo)||{};if(this.Te.advanced_feature_flags_dedup_per_session){var S,f=this._instance.get_session_id(),x=this.Xs(ep);f&&f!==x&&(v={},(S=this.mi)==null||S.register({[Qo]:v,[ep]:f}))}if((t.send_event||!("send_event"in t))&&(!(s in v)||!v[s].includes(p))){var E,A,C,y,b,m,_,k,R,M,j;Ze(v[s])?v[s].push(p):v[s]=[p],(E=this.mi)==null||E.register({[Qo]:v});var T=this.getFeatureFlagDetails(s),D=[...(A=this.Xs(tp))!==null&&A!==void 0?A:[]];ke(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};ke(T==null||(b=T.metadata)==null?void 0:b.has_experiment)||(I.$feature_flag_has_experiment=T.metadata.has_experiment),ke(T==null||(m=T.metadata)==null?void 0:m.version)||(I.$feature_flag_version=T.metadata.version);var q,W=(_=T==null||(k=T.reason)==null?void 0:k.description)!==null&&_!==void 0?_:T==null||(R=T.reason)==null?void 0:R.code;W&&(I.$feature_flag_reason=W),T!=null&&(M=T.metadata)!=null&&M.id&&(I.$feature_flag_id=T.metadata.id),ke(T==null?void 0:T.original_variant)&&ke(T==null?void 0:T.original_enabled)||(I.$feature_flag_original_response=ke(T.original_variant)?T.original_enabled:T.original_variant),T!=null&&(j=T.metadata)!=null&&j.original_payload&&(I.$feature_flag_original_payload=T==null||(q=T.metadata)==null?void 0:q.original_payload),D.length&&(I.$feature_flag_error=D.join(",")),this._instance.capture("$feature_flag_called",I)}if(a)return{key:s,enabled:!!l,variant:typeof l=="string"?l:void 0,payload:_0(d)}}}else ms.warn('getFeatureFlagResult for key "'+s+Cf)}getRemoteConfigPayload(s,t){var n=this.Te.token,a={distinct_id:this._instance.get_distinct_id(),token:n,person_properties:{$lib:At.LIB_NAME,$lib_version:At.LIB_VERSION}};this.no()&&(a.evaluation_contexts=this.io());var l=this.so();ke(l)||(a.flag_keys=l),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:a,compression:this.Te.disable_compression?void 0:Fs.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 ms.warn('isFeatureEnabled for key "'+s+Cf),t.defaultValue;var n=this.getFeatureFlag(s,t);return ke(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 a=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=(T=>{var D=T.flags;return D?(T.featureFlags=Object.fromEntries(Object.keys(D).map((I=>{var q;return[I,(q=D[I].variant)!==null&&q!==void 0?q:D[I].enabled]}))),T.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]})))):T.featureFlags&&ms.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),T})(p),E=x.flags,A=x.featureFlags,C=x.featureFlagPayloads;if(A){var y=p.requestId,b=p.evaluatedAt;if(Ze(A)){ms.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var m={};if(A)for(var _=0;A.length>_;_++)m[A[_]]=!0;c&&c.register({[qc]:A,[Dr]:m,[lu]:!1})}else{var k=A,R=C,M=E;if(f!=null&&f.partialResponse)k=xe({},h,k),R=xe({},v,R),M=xe({},S,M);else if(p.errorsWhileComputingFlags)if(E){var j=new Set(Object.keys(E).filter((T=>{var D;return!((D=E[T])!=null&&D.failed)})));k=xe({},h,Object.fromEntries(Object.entries(k).filter((T=>j.has(T[0]))))),R=xe({},v,Object.fromEntries(Object.entries(R||{}).filter((T=>j.has(T[0]))))),M=xe({},S,Object.fromEntries(Object.entries(M||{}).filter((T=>j.has(T[0])))))}else k=xe({},h,k),R=xe({},v,R),M=xe({},S,M);c&&c.register(xe({[qc]:Object.keys(by(k)),[Dr]:k||{},[Wc]:R||{},[Xf]:M||{},[lu]:p.minimalFlagCalledEvents===!0},y?{[Jf]:y}:{},b?{[cl]:b}:{}))}}})(s,this.mi,a,l,d,n),t||(this.Qs=!1),this.ho(t)}}override(s,t){t===void 0&&(t=!1),ms.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:s,suppressWarning:t})}overrideFeatureFlags(s){if(!this._instance.__loaded||!this.mi)return ms.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(s===!1)return this.mi.unregister(gn),this.mi.unregister(ba),this.ho(),kr.info("All overrides cleared");if(Ze(s)){var t=yy(s);return this.mi.register({[gn]:t}),this.ho(),kr.info("Flag overrides set",{flags:s})}if(s&&typeof s=="object"&&("flags"in s||"payloads"in s)){var n,a=s;if(this.Hs=!!((n=a.suppressWarning)!==null&&n!==void 0&&n),"flags"in a){if(a.flags===!1)this.mi.unregister(gn),kr.info("Flag overrides cleared");else if(a.flags){if(Ze(a.flags)){var l=yy(a.flags);this.mi.register({[gn]:l})}else this.mi.register({[gn]:a.flags});kr.info("Flag overrides set",{flags:a.flags})}}return"payloads"in a&&(a.payloads===!1?(this.mi.unregister(ba),kr.info("Payload overrides cleared")):a.payloads&&(this.mi.register({[ba]:a.payloads}),kr.info("Payload overrides set",{payloads:a.payloads}))),void this.ho()}if(s&&typeof s=="object")return this.mi.register({[gn]:s}),this.ho(),kr.info("Flag overrides set",{flags:s});ms.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:s})}onFeatureFlags(s){if(this.addFeatureFlagsHandler(s),this.Us){var t=this.do(),n=t.flags,a=t.flagVariants;try{s(n,a)}catch(l){ms.error("Error while running feature flags callback",l)}}return()=>this.removeFeatureFlagsHandler(s)}updateEarlyAccessFeatureEnrollment(s,t,n){var a,l=(this.Xs(Yo)||[]).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=xe({},this.getFlagVariants(),{[s]:t});(a=this.mi)==null||a.register({[qc]:Object.keys(by(c)),[Dr]:c}),this.ho()}getEarlyAccessFeatures(s,t,n){t===void 0&&(t=!1);var a=this.Xs(Yo),l=n?"&"+n.map((d=>"stage="+d)).join("&"):"";if(a&&!t)return s(a);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(Yo),(c=this.mi)==null||c.register({[Yo]: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,a)=>(n[a]=t[a],n)),{})}}ho(s){var t=this.do(),n=t.flags,a=t.flagVariants;this.featureFlagEventHandlers.forEach((l=>{try{l(n,a,{errorsLoading:s})}catch(d){ms.error("Error while running feature flags callback",d)}}))}setPersonPropertiesForFlags(s,t){t===void 0&&(t=!0);var n=this.Xs(Ar)||{},a=(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({[Ar]:xe({},n,d,a)}),t&&this._instance.reloadFeatureFlags()}unsetPersonPropertiesForFlags(s,t){t===void 0&&(t=!0);var n=xe({},this.Xs(Ar)||{});s.forEach((a=>{delete n[a]})),this._instance.register({[Ar]:n}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(s){s===void 0&&(s=!0),this._instance.unregister(Ar),s&&this._instance.reloadFeatureFlags()}setGroupPropertiesForFlags(s,t){t===void 0&&(t=!0);var n=this.Xs(Rr)||{};Object.keys(n).length!==0&&Object.keys(n).forEach((a=>{n[a]=xe({},n[a],s[a]),delete s[a]})),this._instance.register({[Rr]:xe({},n,s)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(s){if(s){var t=this.Xs(Rr)||{};this._instance.register({[Rr]:xe({},t,{[s]:{}})})}else this._instance.unregister(Rr)}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}}},cT={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===Fo||this.vo===zc?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=fy,this.fo=void 0,this._instance=s,!this._instance.sessionManager)throw pn.error("started without valid sessionManager"),new Error(gp+" started without valid sessionManager. This is a bug.");if(this.Te.cookieless_mode===yn)throw new Error(gp+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get po(){var s,t=!((s=this._instance.get_property(Nr))==null||!s.enabled),n=!this.Te.disable_session_recording,a=this.Te.disable_session_recording||this._instance.consent.isOptedOut();return ce&&t&&n&&!a}startIfEnabledOrStop(s){var t;if(!this.po||(t=this.co)==null||!t.isStarted){var n=!ke(Object.assign)&&!ke(Array.from);this.po&&n?(this.mo(s),pn.info("starting")):(this.vo=fy,this.stopRecording())}}mo(s){var t,n,a;this.po&&(this.vo!==Fo&&this.vo!==zc&&(this.vo=py),He!=null&&(t=He.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(n=He.__PosthogExtensions__)!=null&&n.initSessionRecording?this.yo(s):(a=He.__PosthogExtensions__)==null||a.loadExternalDependency==null||a.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($p),(t=this.mi)==null||t.unregister(z1)}xo(s,t){if(et(s))return null;var n,a=Ls(s)?s:parseFloat(s);return typeof(n=a)!="number"||!Number.isFinite(n)||0>n||n>1?(pn.warn(t+" must be between 0 and 1. Ignoring invalid value:",s),null):a}ko(s){if(this.mi){var t,n,a=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;a.register({[Nr]:xe({cache_timestamp:Date.now(),enabled:!!p},p,{networkPayloadCapture:xe({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:ke(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===Fo&&(this.vo=zc,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(Nr);return(n==null||(t=n.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}So(){var s,t,n=this._instance.get_property(Nr);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 a=(s=t.cache_timestamp)!==null&&s!==void 0?s:Date.now();return 36e5>=Date.now()-a}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({[V1]:!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===zc||this.vo===Fo?void 0:(this.vo=Fo,pn.info("persisted remote config is stale, requesting fresh config before starting"),void new yb(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({[P1]:!0}),(s=this.co)==null||s.overrideLinkedFlag()}overrideSampling(){var s,t;this.co||(t=this.mi)==null||t.register({[$1]:!0}),(s=this.co)==null||s.overrideSampling()}overrideTrigger(s){var t,n;this.co||(n=this.mi)==null||n.register({[s==="url"?U1:F1]:!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))}}},uT={autocapture:class{constructor(s){this.Co=!1,this.Mo=null,this.Io=!1,this.To=!1,this.instance=s,this.rageclicks=new uy(s.config.rageclick),this.Eo=null}initialize(){this.startIfEnabled()}get Te(){var s,t,n=Kt(this.instance.config.autocapture)?this.instance.config.autocapture:{};return n.url_allowlist=(s=n.url_allowlist)==null?void 0:s.map((a=>new RegExp(a))),n.url_ignorelist=(t=n.url_ignorelist)==null?void 0:t.map((a=>new RegExp(a))),n}Ro(){if(this.isBrowserSupported()){if(ce&&Ae){var s=n=>{n=n||(ce==null?void 0:ce.event);try{this.Po(n)}catch(a){yf.error("Failed to capture event",a)}};if(ts(Ae,"submit",s,{capture:!0}),ts(Ae,"change",s,{capture:!0}),ts(Ae,"click",s,{capture:!0}),this.Te.capture_copied_text){var t=n=>{n=n||(ce==null?void 0:ce.event);try{this.Po(n,_f)}catch(a){yf.error("Failed to capture copy/cut event",a)}};ts(Ae,"copy",t,{capture:!0}),ts(Ae,"cut",t,{capture:!0})}}}else yf.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({[Ff]: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((a=>{var l=Ae==null?void 0:Ae.querySelectorAll(a);l==null||l.forEach((d=>{s===d&&n.push(a)}))})),n}get isEnabled(){var s,t,n=(s=this.instance.persistence)==null?void 0:s.props[Ff],a=this.Mo,l=this.instance.Ur()&&!this.Io;if(Ws(a)&&!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,a=af(s);Q1(a)&&(a=a.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())&&$0(a,this.instance.config.rageclick)&&this.Po(s,"$rageclick");var l=t===_f;if(a&&(function(f,x,E,A,C,y){var b;if(!ce||Wp(f)||E!=null&&E.url_allowlist&&!H0(E.url_allowlist,y)||E!=null&&E.url_ignorelist&&H0(E.url_ignorelist,y))return!1;if(E!=null&&E.dom_event_allowlist){var m=E.dom_event_allowlist;if(m&&!m.some((T=>x.type===T)))return!1}var _=rb(f,A),k=_.parentIsUsefulElement,R=_.targetElementList;if(!(function(T,D){var I=D==null?void 0:D.element_allowlist;if(ke(I))return!0;var q,W=function(Z){if(I.some((se=>Z.tagName.toLowerCase()===se)))return{v:!0}};for(var U of T)if(q=W(U))return q.v;return!1})(R,E)||!op(R,E==null?void 0:E.css_selector_allowlist)||op(R,(b=E==null?void 0:E.css_selector_ignorelist)!==null&&b!==void 0?b:l5))return!1;try{var M=ce.getComputedStyle(f);if(M&&M.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&&(qp.indexOf(j)>-1||f.getAttribute("contenteditable")==="true")}})(a,s,this.Te,l,l?["copy","cut"]:void 0,this.instance)){var d=eT(a,{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(a);if(c&&c.length>0&&(p.$element_selectors=c),t===_f){var h,v=sb(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 hi(Ae==null?void 0:Ae.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&&(Te.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.Fo&&this.Fo(),this.Fo=void 0,Te.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(a,l,d){try{if(!(l in a))return hy;var p={next:a[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 hi(c)&&(c.prototype=c.prototype||{},Object.defineProperties(c,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:p}})),a[l]=c,()=>{if(a[l]!==c)for(var h=a[l];hi(h)&&h.__posthog_layer__;){var v=h.__posthog_layer__;if(v.next===c)return void(v.next=p.next);h=v.next}else a[l]=p.next}}catch{return hy}})(ce.history,s,(a=>function(l,d,p){a.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(Sa,{navigation_type:s}),this.Oo=n}catch(a){Te.error("Error capturing "+s+" pageview",a)}}$o(){if(!this.Fo){var s=()=>{this.Lo("popstate")};ts(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[qf]),this.rageclicks=new uy(s.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var s=5e3;return Kt(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;sT.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({[qf]:n}),this.Do=n,this.startIfEnabled()}}}getAndClearBuffer(){var s=this.R;return this.R=void 0,s}Bo(s){Sf(s.originalEvent)&&this.pe(s.originalEvent,"deadclick")}xe(){this.No&&clearInterval(this.No),this.No=(Ae==null?void 0:Ae.visibilityState)==="visible"?setInterval(this.oi.bind(this),this.flushIntervalMilliseconds):null}qo(){ce&&Ae&&(this.Ho=this.oi.bind(this),ts(ce,fu,this.Ho),this.Uo=s=>this.pe(s||(ce==null?void 0:ce.event)),ts(Ae,"click",this.Uo,{capture:!0}),this.zo=s=>this.Vo(s||(ce==null?void 0:ce.event)),ts(Ae,"mousemove",this.zo,{capture:!0}),this.Wo=new V0(this.instance,v5,this.Bo.bind(this)),this.Wo.startIfEnabledOrStop(),this.Zo=this.xe.bind(this),ts(Ae,du,this.Zo),this.Co=!0)}jo(){var s;ce&&Ae&&(this.Ho&&ce.removeEventListener(fu,this.Ho),this.Uo&&Ae.removeEventListener("click",this.Uo,{capture:!0}),this.zo&&Ae.removeEventListener("mousemove",this.zo,{capture:!0}),this.Zo&&Ae.removeEventListener(du,this.Zo),clearTimeout(this.Go),(s=this.Wo)==null||s.stop(),this.Co=!1)}Qo(s,t){var n=this.instance.scrollManager.scrollY(),a=this.instance.scrollManager.scrollX(),l=this.instance.scrollManager.scrollElement(),d=(function(p,c,h){for(var v=p;v&&er(v)&&!di(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=ib(v)}return!1})(af(s),["fixed","sticky"],l);return{x:s.clientX+(d?0:a),y:s.clientY+(d?0:n),target_fixed:d,type:t}}pe(s,t){var n;if(t===void 0&&(t="click"),!B0(s.target)&&Sf(s)){var a=this.Qo(s,t);(n=this.rageclicks)!=null&&n.isRageClick(s.clientX,s.clientY,new Date().getTime())&&$0(af(s),this.instance.config.rageclick)&&this.Wt(xe({},a,{type:"rageclick"})),this.Wt(a)}}Vo(s){!B0(s.target)&&Sf(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,a=this.Te.mask_personal_data_properties?[...Ba,...n||[]]:[],l=hl(t,a,dl);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:V0,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,a)=>xe({},n,{["$web_vitals_"+a.name+"_event"]:xe({},a),["$web_vitals_"+a.name+"_value"]:a.value})),{})),this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Yo=n=>{var a;this.R=this.R||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var l=this.Xo();if(!ke(l))if(et(n==null?void 0:n.name)||et(n==null?void 0:n.value))Er.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)),ke(this.R.url)&&(this.R.url=l),this.R.firstMetricTimestamp=ke(this.R.firstMetricTimestamp)?Date.now():this.R.firstMetricTimestamp,n.attribution&&n.attribution.interactionTargetElement&&(n.attribution.interactionTargetElement=void 0);var d=(a=this._instance.sessionManager)==null?void 0:a.checkAndGetSessionAndWindowId(!0),p=xe({},n,{$current_url:l,timestamp:Date.now()});ke(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 Er.error("Ignoring metric with value >= "+this.ta,n)},this.ea=()=>{if(!this.Co){var n,a,l,d,p=He.__PosthogExtensions__;if(!ke(p)&&!ke(p.postHogWebVitalsCallbacks)){var c=p.postHogWebVitalsCallbacks;n=c.onLCP,a=c.onCLS,l=c.onFCP,d=c.onINP}n&&a&&l&&d?(this.allowedMetrics.indexOf("LCP")>-1&&n(this.Yo.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&a(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):Er.error("web vitals callbacks not loaded - not starting")}},this._instance=s,this.Do=!((t=this._instance.persistence)==null||!t.props[Yf]),this.startIfEnabled()}get ra(){return this._instance.config.capture_performance}get allowedMetrics(){var s,t,n=Kt(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[Kf])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return(Kt(this.ra)?this.ra.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var s=Kt(this.ra)?this.ra.web_vitals_attribution:void 0;return s!=null&&s}get ta(){var s=Kt(this.ra)&&Ls(this.ra.__web_vitals_max_value)?this.ra.__web_vitals_max_value:dy;return s>0&&6e4>=s?dy:s}get isEnabled(){var s=hs==null?void 0:hs.protocol;if(s!=="http:"&&s!=="https:")return Er.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=Kt(this.ra)?this.ra.web_vitals:Hi(this.ra)?this.ra:void 0;return Hi(t)?t:this.Do}startIfEnabled(){this.isEnabled&&!this.Co&&(Er.info("enabled, starting..."),this.tr(this.ea))}onRemoteConfig(s){if(s.ok){var t=s.config;if("capturePerformance"in t){var n=Kt(t.capturePerformance)&&!!t.capturePerformance.web_vitals,a=Kt(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Yf]:n}),this._instance.persistence.register({[Kf]:a})),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",(a=>{a?Er.error("failed to load script",a):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?[...Ba,...t||[]]:[];return hl(s,n,dl)}Er.error("Could not determine current URL")}}},hT={exceptionObserver:class{constructor(s){var t;this.ea=()=>{var n;if(ce&&this.isEnabled&&(n=He.__PosthogExtensions__)!=null&&n.errorWrappingFunctions){var a=He.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,l=He.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,d=He.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.ia&&this.Te.capture_unhandled_errors&&(this.ia=a(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){Uo.error("failed to start",p),this.oa()}}},this._instance=s,this.aa=!((t=this._instance.persistence)==null||!t.props[Wf]),this.la=new u4(xe({},(function(n){var a,l,d,p;return n===void 0&&(n={}),{refillRate:(a=(l=n.exceptionRateLimiterRefillRate)!==null&&l!==void 0?l:n.__exceptionRateLimiterRefillRate)!==null&&a!==void 0?a: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:Uo})),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 Kt(s)?t=xe({},t,s):(ke(s)?this.aa:s)&&(t=xe({},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?(Uo.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",(a=>{if(a)return Uo.error("failed to load script",a);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({[Wf]:this.aa}),this.Te=this.ua(),this.startIfEnabledOrStop())}}onConfigChange(){this.Te=this.ua()}captureException(s){var t,n,a,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)?Uo.info("Skipping exception capture because of client rate limiting.",{exception:l}):(a=this._instance.exceptions)==null||a.sendExceptionEvent(s)}},exceptions:class{constructor(s){var t,n;this.ha=[],this.da=new T4([new O4,new q4,new H4,new B4,new U4,new P4,new z4,new F4],(function(a){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(`
459
- `),f=h;S.length>f;f++){var x=S[f];if(1024>=x.length){var E=j0.test(x)?x.replace(j0,"$1"):x;if(!E.match(/\S*Error: /)){for(var A of d){var C=A(E,a);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 xe({},m,{filename:m.filename||(_=b,_[_.length-1]||{}).filename,function:m.function||La});var _}))})(v)}})("web:javascript",D4,L4)),this._instance=s,this.ha=(t=(n=this._instance.persistence)==null?void 0:n.get_property(Gf))!==null&&t!==void 0?t:[],this.ca=ou(this.va()),this.fa=new G4(this.ca)}onConfigChange(){this.ca=ou(this.va()),this.fa.setConfig(this.ca)}onRemoteConfig(s){var t,n,a;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=(a=l.errorTracking)==null?void 0:a.captureExtensionExceptions;this.ha=d,this._instance.persistence&&this._instance.persistence.register({[Gf]:this.ha,[Vf]:p})}}}get pa(){var s,t=!!this._instance.get_property(Vf),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 qi.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)=>W4.has(h)?(p.push(h),c):(c[h]=d[h],c)),{}),droppedKeys:p}})(this.ga(t)),a=n.sanitizedProperties,l=n.droppedKeys;l.length>0&&qi.warn("Ignoring reserved exception step fields",{droppedKeys:l}),this.fa.add(xe({[ru]:s,[au]:new Date().toISOString()},a))}catch(d){qi.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 qi.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 qi.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 qi.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,a=typeof(d=globalThis._posthogReleaseId)=="string"&&d.length>0?d:void 0;a&&(n.$release_id=a);try{var l=this._instance.capture("$exception",n,{_noTruncate:!0,_batchKey:"exceptionEvent",Pn:!0});return l&&this.fa.clear(),l}catch(p){return qi.error("Failed to capture exception event. Dropping this exception.",p),void this.fa.clear()}}catch(p){return void qi.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:xe({},s,{$exception_steps:t})}catch(n){return qi.error("Failed to read buffered exception steps. Capturing exception without steps.",n),s}}ba(s){this.ca.enabled&&this.fa.add({[ru]:s,[au]:new Date().toISOString()})}ga(s){return Kt(s)?xe({},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,a)=>{var l=a.type,d=a.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 a=n.values.map((l=>{var d=jb[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"?a.some(Boolean):a.every(Boolean)}))}catch(n){return qi.warn("Failed to evaluate suppression rules. Capturing the exception.",n),!1}}_a(s){return s.flatMap((t=>{var n,a;return(n=(a=t.stacktrace)==null?void 0:a.frames)!==null&&n!==void 0?n:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}wa(s){if(s.length>0){var t,n,a,l,d=(t=(n=s[0].stacktrace)==null?void 0:n.frames)!==null&&t!==void 0?t:[],p=d[d.length-1];return(a=p==null||(l=p.filename)==null?void 0:l.includes("posthog.com/static"))!==null&&a!==void 0&&a}return!1}ma(s){return!et(s)&&Ze(s)}}},dT=xe({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,a;if(this.mi&&this.mi.register({[zp]:!!t.productTours}),!xf(this._instance))return!this.ka&&et((n=this.mi)==null?void 0:n.props[Ko])||wf.info("product tours disabled; stopping and clearing cached tours"),(a=this.ka)==null||a.stop(),this.ka=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.ka&&xf(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",(a=>{a?wf.error("Could not load product tours script",a):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 a=n.props[Ko];if(Ze(a)&&!t)return this.Sa=a,void s(a,{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(xf(this._instance)){var d=l.statusCode;if(d!==200||!l.json){var p="Product Tours API could not be loaded, status: "+d;return wf.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({[Ko]: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(Ko)}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)}}},Du),fT={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,a,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,A=s.$set;return{event:xe({},r1(s,iT),{properties:xe({},s.properties,A?{$set:xe({},(t=(n=s.properties)==null?void 0:n.$set)!==null&&t!==void 0?t:{},A)}:{},E?{$set_once:xe({},(a=(l=s.properties)==null?void 0:l.$set_once)!==null&&a!==void 0?a:{},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)||(Fi.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)||(Fi.error("prepare_external_dependency_script returned null"),null):s}Pa(){var s,t,n,a,l,d,p,c;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var h=Ae==null?void 0:Ae.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 _=y[b];y[b]=m(_),S.push((()=>{y[b]=_}))}},A=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:A(b))).filter((b=>!Ws(b)));return E(v,"appendChild",(y=>function(b){var m=A(b);return m?y.call(this,m):b})),E(v,"insertBefore",(y=>function(b,m){var _=A(b);return _?y.call(this,_,m):b})),E(v,"replaceChild",(y=>function(b,m){var _=A(b);return _?y.call(this,_,m):m})),[(t=h.Element)==null?void 0:t.prototype,(n=h.Document)==null?void 0:n.prototype,(a=h.DocumentFragment)==null?void 0:a.prototype].forEach((y=>{E(y,"append",(b=>function(){for(var m=arguments.length,_=new Array(m),k=0;m>k;k++)_[k]=arguments[k];return b.apply(this,C(_))})),E(y,"prepend",(b=>function(){for(var m=arguments.length,_=new Array(m),k=0;m>k;k++)_[k]=arguments[k];return b.apply(this,C(_))}))})),[(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,_=new Array(m),k=0;m>k;k++)_[k]=arguments[k];return b.apply(this,C(_))})),E(y,"after",(b=>function(){for(var m=arguments.length,_=new Array(m),k=0;m>k;k++)_[k]=arguments[k];return b.apply(this,C(_))})),E(y,"replaceWith",(b=>function(){for(var m=arguments.length,_=new Array(m),k=0;m>k;k++)_[k]=arguments[k];var R=C(_);return _.length&&!R.length?void 0:b.apply(this,R)}))})),E((c=h.Element)==null?void 0:c.prototype,"insertAdjacentElement",(y=>function(b,m){var _=A(m);return _?y.call(this,b,_):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 a=s(n);return t&&n(),a}catch(l){throw n(),l}}setupSiteApp(s){var t=this.apps[s.id],n=()=>{var p;!t.errored&&this.Ia.length&&(Fi.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))},a=!1,l=p=>{t.errored=!p,t.loaded=!0,Fi.info("Site app with id "+s.id+" "+(p?"loaded":"errored")),a&&n()};try{var d=this.Aa((p=>s.init({posthog:this._instance,callback(c){p(),l(c)}})),!1).processEvent;d&&(t.processEvent=d),a=!0}catch(p){Fi.error(vy+s.id,p),l(!1)}if(a&&t.loaded)try{n()}catch(p){Fi.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),a=function(d){try{t.Aa((()=>d.processEvent==null?void 0:d.processEvent(n)))}catch(p){Fi.error("Error while processing event "+s.event+" for site app "+d.id,p)}};for(var l of Object.values(this.apps))a(l)}}onRemoteConfig(s){var t,n,a,l=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.$a(),void this._instance.on("eventCaptured",(h=>this.La(h)))):void Fi.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((a=d.siteApps)!=null&&a.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 Fi.error(vy+v,f)}))};for(var c of d.siteApps)p()}else Fi.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},pT={tracingHeaders:class{constructor(s){this.Da=void 0,this.Na=void 0,this.qa=void 0,this.ea=()=>{var t,n,a=this.ja();a?(ke(this.Da)&&(this.Da=(t=He.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null?void 0:t._patchXHR(a,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),ke(this.Na)&&(this.Na=(n=He.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null?void 0:n._patchFetch(a,(()=>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",(a=>{if(a)return tT.error("failed to load script",a);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()}}},vT=xe({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 a=localStorage.key(n);(a!=null&&a.startsWith(Ob)||a!=null&&a.startsWith("inProgressSurvey_"))&&t.push(a)}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(gy);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(!ke(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 a=s.loadExternalDependency;if(!a)return void this.Ga(Pp);a(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 aT(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(gy),s([]);var n,a=this._instance.get_property(Zf);if(a&&!t)return s(a,{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(A){return!(!A.start_date||A.end_date)})(E)&&(Lb(E)||(function(A){var C;return!((C=A.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({[Zf]:S,[cu]: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(cu);return Ls(s)&&Date.now()-s>3e5}Ya(){return Ls(this.Wa)&&3e5>Date.now()-this.Wa}markSurveyAsSeen(s,t){var n,a={id:s,current_iteration:(n=t==null?void 0:t.iteration)!==null&&n!==void 0?n:null};Bb(a);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 a;t=(a=n.find((l=>l.id===s)))!==null&&a!==void 0?a:null})),t}tl(s){if(et(this._surveyManager))return{eligible:!1,reason:$c};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:$c};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:$c};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:$c})):new Promise((n=>{this.getSurveys((a=>{var l,d=(l=a.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 a;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(U5.includes(l.type)){var d=Ae==null?void 0:Ae.querySelector(t);if(d)return(a=l.appearance)!=null&&a.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 a=this.Xa(s);if(a){var l=a;if((n=a.appearance)!=null&&n.surveyPopupDelaySeconds&&t.ignoreDelay&&(l=xe({},a,{appearance:xe({},a.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==cp.Popover&&t.initialResponses&&jt.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){var d=this.tl(a);if(!d.eligible)return void jt.warn("Survey is not eligible to be displayed: ",d.reason)}t.displayType!==cp.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()}}},Du),gT={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),Y1(this.instance.config)||!ce||!Ae)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 a,l=oT||mu(s.hash,"__posthog")||mu(s.hash,"state"),d=l?L0((()=>JSON.parse(atob(decodeURIComponent(l)))))||L0((()=>JSON.parse(decodeURIComponent(l)))):null;return d&&d.action==="ph_authorize"?((a=d).source="url",a&&Object.keys(a).length>0&&(d.desiredHash?s.hash=d.desiredHash:n?n.replaceState(n.state,"",s.pathname+s.search):s.hash="")):((a=JSON.parse(t.getItem(my)||"{}")).source="localstorage",delete a.userIntent),!(!a.token||this.instance.config.token!==a.token||(this.loadToolbar(a),0))}catch{return!1}}nl(s){var t=He.ph_load_toolbar||He.ph_load_editor;!et(t)&&hi(t)?t(s,this.instance):_y.warn("No toolbar load function found")}loadToolbar(s){var t=!(Ae==null||!Ae.getElementById(Z1));if(!ce||t)return!1;var n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,a=xe({token:this.instance.config.token},s,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(ce.localStorage.setItem(my,JSON.stringify(xe({},a,{source:void 0}))),this.il()===2)this.nl(a);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 _y.error("[Toolbar] Failed to load",d),void this.rl(0);this.rl(2),this.nl(a)})),ts(ce,"turbolinks:load",(()=>{this.rl(0),this.loadToolbar(a)}))}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)}}},mT=xe({experiments:Is},Du),_T={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||Y1(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var s=He==null?void 0:He.__PosthogExtensions__;if(s&&!ke(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(Pp);n(this._instance,"conversations",(a=>{a||!s.initConversations?this.hl("Could not load conversations script",a):this.ul(s.initConversations),this.al=!1}))}catch(a){this.hl("Error initializing conversations",a),this.al=!1}}else Ti.error("Conversations enabled but missing token in remote config.")}}ul(s){if(this.ll)try{this._conversationsManager=s(this.ll,this._instance),Ti.info("Conversations loaded successfully")}catch(t){this.hl("Error completing conversations initialization",t)}else Ti.error("Cannot complete initialization: remote config is null")}hl(s,t){Ti.error(s,t),this._conversationsManager=null,this.al=!1}show(){this._conversationsManager?this._conversationsManager.show():Ti.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.ol===!0&&!Ws(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 a=this;return Xt((function*(){return a._conversationsManager?a._conversationsManager.sendMessage(s,t,n):(Ti.warn(Tr),null)}))()}getMessages(s,t){var n=this;return Xt((function*(){return n._conversationsManager?n._conversationsManager.getMessages(s,t):(Ti.warn(Tr),null)}))()}markAsRead(s){var t=this;return Xt((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(s):(Ti.warn(Tr),null)}))()}getTickets(s){var t=this;return Xt((function*(){return t._conversationsManager?t._conversationsManager.getTickets(s):(Ti.warn(Tr),null)}))()}requestRestoreLink(s){var t=this;return Xt((function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(s):(Ti.warn(Tr),null)}))()}restoreFromToken(s){var t=this;return Xt((function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(s):(Ti.warn(Tr),null)}))()}restoreFromUrlToken(){var s=this;return Xt((function*(){return s._conversationsManager?s._conversationsManager.restoreFromUrlToken():(Ti.warn(Tr),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()}}},yT={logs:class{constructor(s){var t;this.dl=!1,this.cl=!1,this.it=Zt("[logs]"),this.Gr=[],this.vl=[],this.Js=0,this.fl=()=>{var n,a;this.Js=0,(n=this.pl)==null||n.onReconnect(),(a=this.gl)==null||a.onReconnect()},this._instance=s,this._instance&&(t=this._instance.config.logs)!=null&&t.captureConsoleLogs&&(this.dl=!0),ce&&ts(ce,"online",this.fl)}ml(s,t,n,a){var l,d=(function(p,c){var h,v,S,f,x,E,A,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=ke(b)?Math.max(y,2048):Math.max(y,b),_=p==null?void 0:p.resourceAttributes;return{serviceName:(f=(x=_==null?void 0:_["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=_==null?void 0:_["service.version"])!==null&&E!==void 0?E:p==null?void 0:p.serviceVersion,environment:(A=_==null?void 0:_["deployment.environment"])!==null&&A!==void 0?A:p==null?void 0:p.environment,resourceAttributes:_,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 C4(this.yl(s,t),d,this.it,(()=>this.bl()),(p=>p()),void 0,a),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 a=this.ml((()=>this.Gr),(l=>{this.Gr=l}));this.pl=a[0],this.xl=a[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 a=this.ml((()=>this.vl),(l=>{this.vl=l}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},wy);this.gl=a[0],this.Cl=a[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 a;n||(a=s.logs)==null||!a.initializeLogs?this.it.error("Could not load logs script",n):(s.logs.initializeLogs(this._instance),this.cl=!0)})):this.it.error(Pp)}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:a=>a===mn.LogsQueue?s():void 0,setPersistedProperty(a,l){var d;a===mn.LogsQueue&&t((d=l)!==null&&d!==void 0?d:[])},$t:a=>this.$t(a),getLibraryId:()=>At.LIB_NAME,getLibraryVersion:()=>At.LIB_VERSION}}$t(s){return new Promise((t=>{if(ub(this.Js,3))t({kind:"fatal",error:new Error("logs endpoint is unreachable, dropping batch")});else{var n=!1,a=d=>{n||(n=!0,clearTimeout(l),t(d))},l=setTimeout((()=>a({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)a({kind:"ok"});else if(p===413)a({kind:"too-large"});else if(p!==0&&p!==429&&500>p)a({kind:"fatal",error:new Error("logs request failed with status "+p)});else{var c;a({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=hb(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,At.LIB_NAME,(t=>{this.Gr=t})),this.vl.length>0&&this.Rl(s,this.vl,this.Cl,wy,(t=>{this.vl=t}))}Rl(s,t,n,a,l){if(t.length!==0){var d=t.map((c=>c.record));l([]);var p=L1(d,N1(n,At.LIB_NAME,At.LIB_VERSION),a,At.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),a=n.windowId,l=n.sessionStartTimestamp,d=n.lastActivityTimestamp;t.sessionId=n.sessionId,t.windowId=a,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}}},bT={metrics:class{constructor(s){this.it=Zt("[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 E4(this.yl(),(function(a){var l,d,p,c,h,v=a==null?void 0:a.resourceAttributes;return{serviceName:(l=v==null?void 0:v["service.name"])!==null&&l!==void 0?l:a==null?void 0:a.serviceName,serviceVersion:(d=v==null?void 0:v["service.version"])!==null&&d!==void 0?d:a==null?void 0:a.serviceVersion,environment:(p=v==null?void 0:v["deployment.environment"])!==null&&p!==void 0?p:a==null?void 0:a.environment,resourceAttributes:v,beforeSend:a==null?void 0:a.beforeSend,flushIntervalMs:(c=a==null?void 0:a.flushIntervalMs)!==null&&c!==void 0?c:1e4,maxSeriesPerFlush:(h=a==null?void 0:a.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:()=>At.LIB_NAME,getLibraryVersion:()=>At.LIB_VERSION}}Kt(s,t){return new Promise((n=>{var a=!1,l=p=>{a||(a=!0,clearTimeout(d),n(p))},d=setTimeout((()=>l({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(xe({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)}}},ST=xe({},Du,cT,uT,hT,dT,fT,vT,pT,gT,mT,_T,yT,bT);Ri.__defaultExtensionClasses=xe({},ST);var Mi=(function(){At.SDK_DIST_CHANNEL="npm";var s=sl[wa]=new Ri;return(function(){function t(){t.done||(t.done=!0,Ib=!1,zt(sl,(function(n){n._dom_loaded()})))}Ae!=null&&Ae.addEventListener?Ae.readyState==="complete"?t():ts(Ae,"DOMContentLoaded",t,{capture:!1}):ce&&Te.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),s})();const xy=120,wT=new Set(["attr__class","attr__id"]),xT=/attr__href="([^"]*)"/gi,CT=/(?:current_url|referrer|pathname)$/;function ET(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 il(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 zb(s){return s.length>xy?`${s.slice(0,xy)}…`:s}function kT(s,t){if(t){delete s.$el_text;for(const n of Object.keys(s))n.startsWith("attr__")&&!wT.has(n)&&delete s[n];return}typeof s.$el_text=="string"&&(s.$el_text=zb(s.$el_text)),typeof s.attr__href=="string"&&(s.attr__href=il(s.attr__href))}function TT(s,t){const n=s.$elements;if(Array.isArray(n))for(const a of n)a&&typeof a=="object"&&kT(a,t);if(typeof s.$elements_chain=="string"){if(t){delete s.$elements_chain;return}s.$elements_chain=s.$elements_chain.replace(xT,(a,l)=>{const d=il(l);return typeof d=="string"?`attr__href="${d}"`:a})}}function AT(s,t){t.$current_url=il(t.$current_url),t.$referrer=il(t.$referrer);for(const n of[s.$set,s.$set_once]){if(!n)continue;const a=n;for(const l of Object.keys(a))CT.test(l)&&(a[l]=il(a[l]))}}function RT(s,t){typeof s.$el_text=="string"&&(t?delete s.$el_text:s.$el_text=zb(s.$el_text)),TT(s,t)}function MT(s){if(!s)return s;try{const t=s.properties??{},n=ET(t);return AT(s,t),RT(t,n),s.properties=t,s}catch{return s}}function DT(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 jr(s,t){try{Mi.capture(s,t)}catch{}}function jT(s){try{const t={};for(const[n,a]of Object.entries(s))a!=null&&a!==""&&(t[n]=a);Mi.register(t)}catch{}}function NT(s){try{const t=DT(s);Mi.register({journey:t,view:LT(s)})}catch{}}function LT(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 OT(){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 BT(s){return s.consentSource==="env-forced-off"}function $b(s){return!BT(s)&&s.productAnalyticsOptIn}let nl=!1;function HT(s){if(nl){Ef(s),Tf(s);return}const t=OT();if(t&&$b(s)){if(Mi.__loaded){nl=!0,Ef(s),Tf(s);return}Mi.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:MT,persistence:"localStorage",disable_session_recording:!0}),nl=!0,Ef(s),Tf(s)}}function Ef(s){if(nl)try{$b(s)?Mi.has_opted_out_capturing()&&Mi.opt_in_capturing():Mi.has_opted_out_capturing()||Mi.opt_out_capturing()}catch{}}let kf=null;function Tf(s){if(nl)try{if(s.authenticated&&s.userId){kf=s.userId,Mi.identify(s.userId),s.tenantId&&Mi.group("organization",s.tenantId,{...s.organizationName?{name:s.organizationName}:{}}),jT({active_organization_id:s.tenantId??void 0,app_version:s.version});return}kf&&(kf=null,Mi.reset())}catch{}}function IT(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(`
460
- `)}const Pb=s=>s.split("/").filter(Boolean).pop()??s;function Cy(s,t){var n;return(n=t[s.id])!=null&&n.trim()?!1:!s.title||s.title===Pb(s.cwd)}function Ey(s,t,n){var c;const a=(c=n[s.id])==null?void 0:c.trim();if(a)return a;if(!Cy(s,n))return s.title;const l=Pb(s.cwd),p=t.filter(h=>h.cwd===s.cwd&&(h.status!=="exited"||h.id===s.id)&&Cy(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 zT={entries:[],index:-1};function $T(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 Ub(s){return s.index>0}function Fb(s){return s.index>=0&&s.index<s.entries.length-1}function PT(s,t){const n=s.index>=0?s.entries[s.index]:null;if(n&&$T(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 UT(s,t){if(!(t==="back"?Ub(s):Fb(s)))return{state:s,visit:null};const a=t==="back"?s.index-1:s.index+1;return{state:{...s,index:a},visit:s.entries[a]??null}}function FT(){const[s,t]=P.useState(zT),n=P.useRef(s);n.current=s;const a=P.useCallback(d=>{const p=PT(n.current,d);p!==n.current&&(n.current=p,t(p))},[]),l=P.useCallback(d=>{const p=UT(n.current,d);return p.visit?(n.current=p.state,t(p.state),p.visit):null},[]);return{canGoBack:Ub(s),canGoForward:Fb(s),record:a,goBack:()=>l("back"),goForward:()=>l("forward")}}const qb="(max-width: 768px)";function mp(){return typeof window<"u"&&window.matchMedia(qb).matches}function qT(s){const t=window.matchMedia(qb);return t.addEventListener("change",s),()=>t.removeEventListener("change",s)}function WT(){return P.useSyncExternalStore(qT,mp,()=>!1)}const Wb="sapiom-harness-pane-widths",Kp=180,Gb=480,_p=320,fl=320,Vb=720;function yp(s,t,n){return Math.min(Math.max(s,t),n)}function GT(){const s={rail:_p,canvas:null};if(typeof window>"u")return s;try{const t=window.localStorage.getItem(Wb);if(!t)return s;const n=JSON.parse(t);return{rail:yp(typeof n.rail=="number"?n.rail:_p,Kp,Gb),canvas:typeof n.canvas=="number"?yp(n.canvas,fl,Vb):null}}catch{return s}}function ky(s){window.localStorage.setItem(Wb,JSON.stringify(s))}function VT(){const[s,t]=P.useState(GT),[n,a]=P.useState(!1),[l,d]=P.useState(!1),p=(h,v,S,f,x,E)=>A=>{const C=A.currentTarget;C.setPointerCapture(A.pointerId),E==null||E(!0);const y=A.clientX,b=x(),m=k=>{const R=yp(b+(k.clientX-y)*v,S,f);t(M=>M[h]===R?M:{...M,[h]:R})},_=()=>{C.removeEventListener("pointermove",m),C.removeEventListener("pointerup",_),E==null||E(!1),t(k=>(ky(k),k))};C.addEventListener("pointermove",m),C.addEventListener("pointerup",_)},c=(h,v)=>{t(S=>{const f={...S,[h]:v};return ky(f),f})};return{widths:s,canvasResizing:n,railResizing:l,startRailDrag:p("rail",1,Kp,Gb,()=>s.rail,d),startCanvasDrag:p("canvas",-1,fl,Vb,()=>{if(s.canvas!=null)return s.canvas;const h=document.querySelector(".canvas-pane");return h?h.getBoundingClientRect().width:fl},a),resetRail:()=>{d(!0),c("rail",_p),window.setTimeout(()=>d(!1),0)},resetCanvas:()=>{a(!0),c("canvas",null),window.setTimeout(()=>a(!1),0)}}}const YT=2e3;function KT(s){const t=new URL("/ws/events",window.location.href);t.protocol=t.protocol==="https:"?"wss:":"ws:",t.searchParams.set("token",ka());let n=null,a=null,l=!1;const d=()=>{n=new WebSocket(t),n.addEventListener("message",p=>{try{s(JSON.parse(p.data))}catch{}}),n.addEventListener("close",()=>{l||(a=setTimeout(d,YT))})};return d(),()=>{l=!0,a&&clearTimeout(a),n==null||n.close()}}function Ty(s){const t=s.split(/[\\/]/).filter(Boolean);return t[t.length-1]??s}function XT(s,t){const n=[];for(const a of t)s.has(a.path)||n.push(a.path);return n}function Ay(s,t){return t?"exception":s==="linking"?"link_failed":"build_failed"}function rl(s){return typeof s=="string"&&s!==""?s:void 0}function JT(s){if(rl(s.templateId))return"template";const t=rl(s.starterId);return t&&t!=="default"?"starter":rl(s.forkId)?"fork":"scratch"}function Ry(s){if(!s)return{};const t=JT(s);return t==="template"?{source:t,template_id:rl(s.templateId)}:t==="starter"?{source:t,template_id:rl(s.starterId)}:{source:t}}const My=4e3;function ZT(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(a=>typeof a=="string"||typeof a=="number");if(n.length>0)return n.map(String).join(" ")}return String(s)}function QT(s){if(!Array.isArray(s)||s.length===0)return;const t=s.map(ZT).join(`
461
- `).trim();if(t!=="")return t.length>My?t.slice(t.length-My):t}function eA(s){return s==="succeeded"?"passed":s==="threw"?"failed":"pending"}function tA(s){return s==="completed"?"completed":s==="failed"?"failed":"running"}function sA(s){var a;const t={id:`${s.step}-${s.attempt}`,name:s.step,status:eA(s.status)};s.input!==void 0&&(t.input=s.input),s.output!==void 0&&(t.output=s.output),(a=s.error)!=null&&a.message&&(t.error=s.error.message);const n=QT(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 iA(s,t={}){const n={executionId:t.executionId??"",status:tA(t.outcome),steps:s.map(sA),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=gx(),nA=3e3,rA=8;function aA(){const[s,t]=P.useState(null),[n,a]=P.useState(null),l=P.useRef(null);l.current=n;const d=P.useRef([]);d.current=(s==null?void 0:s.workflows)??[];const[p,c]=P.useState(!0),[h,v]=P.useState(null),[S,f]=P.useState(null),[x,E]=P.useState(0),[A,C]=P.useState(null),[y,b]=P.useState(null),[m,_]=P.useState([]),[k,R]=P.useState(null),[M,j]=P.useState(!1),T=P.useRef(new Map),D=P.useRef(0),I=P.useRef(new Map),[q,W]=P.useState(null),[U,Z]=P.useState(new Set),[se,F]=P.useState([]),G=P.useRef(new Map),[J,O]=P.useState(new Map),[H,L]=P.useState(new Map),[B,V]=P.useState(new Map),Q=P.useRef(new Map),[ue,fe]=P.useState(new Map),[Y,z]=P.useState(new Map),[oe,ae]=P.useState(new Map),we=P.useCallback((ie,ve)=>{ae(ge=>{if(ve===null){if(!ge.has(ie))return ge;const Se=new Map(ge);return Se.delete(ie),Se}return new Map(ge).set(ie,ve)})},[]),[Ee,Ue]=P.useState(0),$e=P.useCallback(()=>{Ue(ie=>ie+1)},[]),We=P.useRef(0),Fe=P.useCallback(ie=>{We.current+=1,b(ie)},[]),Ne=P.useRef([]),$t=P.useCallback(ie=>{Ht.getRunState(ie).then(ve=>O(ge=>{const Se=ge.get(ie);return Se?new Map(ge).set(ie,{...Se,run:ve}):ge})).catch(()=>{})},[]),pt=P.useCallback((ie,ve,ge)=>{const Se=Q.current.get(ie);Se&&clearInterval(Se);const Me=Ea(Ne.current.find(tt=>tt.id===ie)),yt=Date.now();L(tt=>{const Je=tt.get(ie)??[];return Je.includes(ve)?tt:new Map(tt).set(ie,[...Je,ve])}),V(tt=>{if(!tt.has(ie))return tt;const Je=new Map(tt);return Je.delete(ie),Je});const Xe=async()=>{try{const tt=await Ht.getRunState(ve);if(O(Je=>new Map(Je).set(ve,{run:tt,target:ge,workflowPath:Me,observedAt:yt})),tt.status!=="running"){const Je=Q.current.get(ie);Je&&clearInterval(Je),Q.current.delete(ie)}}catch{const tt=Q.current.get(ie);tt&&clearInterval(tt),Q.current.delete(ie)}};Xe(),Q.current.set(ie,setInterval(()=>void Xe(),2e3))},[]),Nt=P.useRef(0),xt=P.useCallback(async(ie,ve,ge)=>{Nt.current+=1;const Se=`local-${Date.now()}-${Nt.current}`,Me=Ea(Ne.current.find(ht=>ht.id===ie)),yt=Date.now(),Xe=[];let tt,Je,nt;L(ht=>{const Vs=ht.get(ie)??[];return Vs.includes(Se)?ht:new Map(ht).set(ie,[...Vs,Se])}),V(ht=>{if(!ht.has(ie))return ht;const Vs=new Map(ht);return Vs.delete(ie),Vs});const ct=()=>{const ht=iA(Xe,{executionId:Se,outcome:tt,unusedStubs:Je,stubWarnings:nt});O(Vs=>new Map(Vs).set(Se,{run:ht,target:"local",workflowPath:Me,observedAt:yt}))};ct();const bs=ht=>{ht.kind==="summary"?(tt=ht.outcome,Je=ht.unusedStubs,nt=ht.stubWarnings):ht.kind==="error"?(tt="failed",Xe.push({step:"run-local",attempt:1,input:ge,status:"threw",error:{name:"RunLocalError",message:ht.error},logs:[]})):Xe.push(ht),ct()};try{await Ht.runLocal({sourceDir:ve,input:ge},bs)}catch(ht){tt="failed",ct(),R(ht instanceof ui&&ht.reason?ht.reason:ht.message)}finally{$e()}},[$e]),ls=P.useCallback((ie,ve)=>{V(ge=>new Map(ge).set(ie,ve)),$t(ve)},[$t]),_t=P.useMemo(()=>{const ie=new Map;return H.forEach((ve,ge)=>{const Se=B.get(ge),Me=Se&&ve.includes(Se)?Se:ve[ve.length-1],yt=Me?J.get(Me):void 0;yt&&ie.set(ge,yt)}),ie},[H,B,J]);P.useEffect(()=>{Ne.current=(s==null?void 0:s.sessions)??[]},[s]),P.useEffect(()=>{const ie=Q.current;return()=>{ie.forEach(ve=>clearInterval(ve)),ie.clear()}},[]),P.useEffect(()=>{const ie=G.current;return()=>{ie.forEach(ve=>clearTimeout(ve)),ie.clear()}},[]);const ot=P.useRef(null);P.useEffect(()=>{let ie=!1;return x>0&&(c(!0),v(null),f(null)),Promise.all([Ht.getState(),Ht.getSettings()]).then(([ve,ge])=>{if(ie)return;t(ve);const Se=ot.current??(ot.current=new Set);for(const yt of ve.workflows)Se.add(yt.path);a(ge),f(null),ve.tasks&&F(ve.tasks);const Me=ve.sessions.find(yt=>yt.status!=="exited");Me&&b(Me.id),ve.workflows[0]&&C(ve.workflows[0].path)}).catch(ve=>{ie||(v(ve.message),f(ve instanceof ui?{status:ve.status}:{networkError:!0}))}).finally(()=>!ie&&c(!1)),()=>{ie=!0}},[x]);const kt=P.useCallback(()=>E(ie=>ie+1),[]);P.useEffect(()=>{if(!y)return;const ie=s==null?void 0:s.sessions.find(ve=>ve.id===y);C(Ea(ie)??null)},[y]);const Tt=P.useCallback(async()=>{const ie=await Ht.listWorkflows();return t(ve=>ve&&{...ve,workflows:ie}),ie},[]);P.useEffect(()=>KT(ie=>{if(W(ie),ie.type==="session.status"){if(t(ve=>{if(!ve)return ve;const Se=ve.sessions.some(Me=>Me.id===ie.session.id)?ve.sessions.map(Me=>Me.id===ie.session.id?ie.session:Me):[...ve.sessions,ie.session];return{...ve,sessions:Se}}),ie.session.status==="exited"){const ve=ie.session.id,ge=G.current.get(ve);ge&&(clearTimeout(ge),G.current.delete(ve)),Z(Se=>{if(!Se.has(ve))return Se;const Me=new Set(Se);return Me.delete(ve),Me})}}else if(ie.type==="workflows.changed")Tt().then(ve=>{const ge=ot.current;if(ge===null){ot.current=new Set(ve.map(Se=>Se.path));return}for(const Se of XT(ge,ve))ge.add(Se),jr("agent.created",{workflow_slug:Ty(Se),...Ry(ve.find(Me=>Me.path===Se))})});else if(ie.type==="execution.started")pt(ie.harnessSessionId,ie.executionId,ie.target);else if(ie.type==="port.detected")fe(ve=>new Map(ve).set(ie.harnessSessionId,{port:ie.port,url:ie.url}));else if(ie.type==="task.status")F(ve=>ve.some(Se=>Se.id===ie.task.id)?ve.map(Se=>Se.id===ie.task.id?ie.task:Se):[...ve,ie.task]);else if(ie.type==="session.activity"){const ve=ie.harnessSessionId;Z(Se=>Se.has(ve)?Se:new Set(Se).add(ve));const ge=G.current.get(ve);ge&&clearTimeout(ge),G.current.set(ve,setTimeout(()=>{G.current.delete(ve),Z(Se=>{if(!Se.has(ve))return Se;const Me=new Set(Se);return Me.delete(ve),Me})},nA))}else ie.type==="auth.changed"&&(t(ve=>ve&&{...ve,authenticated:ie.authenticated,organizationName:ie.organizationName}),Tt())}),[Tt,pt]);const Os=P.useCallback(async ie=>{const ve=Array.from(new Set(ie)),ge=ve.map(Se=>{const Me=T.current.get(Se);if(Me)return Me;const yt=Ht.sessionHistory(Se).finally(()=>{T.current.delete(Se)});return T.current.set(Se,yt),yt});D.current+=1,j(!0);try{const Se=await Promise.allSettled(ge),Me=[],yt=new Set;Se.forEach((Xe,tt)=>{Xe.status==="fulfilled"&&(yt.add(ve[tt]),Me.push(...Xe.value))}),_(Xe=>YE(Xe,Me,yt))}finally{D.current-=1,D.current===0&&j(!1)}},[]),Pe=P.useCallback(async ie=>{var Se;const ve=await Ht.createSession(ie);t(Me=>Me&&!Me.sessions.some(yt=>yt.id===ve.id)?{...Me,sessions:[...Me.sessions,ve]}:Me),Fe(ve.id);const ge=[ie.cwd,...(((Se=l.current)==null?void 0:Se.recentDirs)??[]).filter(Me=>Me!==ie.cwd)].slice(0,rA);a(Me=>Me&&{...Me,recentDirs:ge});try{const Me=await Ht.updateSettings({recentDirs:ge});a(yt=>yt&&{...yt,recentDirs:Me.recentDirs})}catch{}return ve},[Fe]),ds=P.useCallback(()=>Ht.listTemplates(),[]),Wt=P.useCallback(ie=>Ht.getTemplate(ie),[]),_s=P.useCallback(ie=>Ht.sessionRecord(ie),[]),lt=P.useCallback(async ie=>{const ve=We.current;try{const ge=await Ht.resumeSession(ie);return t(Se=>Se&&{...Se,sessions:Se.sessions.map(Me=>Me.id===ge.id?ge:Me)}),We.current===ve&&Fe(ge.id),ge}catch(ge){throw R(ge instanceof ui&&ge.reason?ge.reason:ge.message),ge}},[Fe]),ys=P.useCallback(async({cwd:ie,harness:ve,from:ge})=>{const Se=await Pe({cwd:ie,harness:ve,rehydrateFrom:ge});return Se.rehydratedFrom||R("Nothing was recorded for that session, so this one starts fresh."),Se},[Pe]),is=P.useCallback(async ie=>{var ge;const ve=ie.harnessSessionId??((ge=s==null?void 0:s.sessions.find(Se=>Se.agentSessionId===ie.agentSessionId))==null?void 0:ge.id);if(ie.resumeMode==="rehydrate")return ys({cwd:ie.cwd,harness:ie.harness,from:ve??ie.agentSessionId});if(ve)return lt(ve);try{const Se=await Ht.adoptSession({agentSessionId:ie.agentSessionId,harness:ie.harness,cwd:ie.cwd,title:ie.title,lastActiveAt:ie.lastActiveAt});return t(Me=>{if(!Me)return Me;const yt=Me.sessions.some(Xe=>Xe.id===Se.id)?Me.sessions.map(Xe=>Xe.id===Se.id?Se:Xe):[...Me.sessions,Se];return{...Me,sessions:yt}}),Fe(Se.id),Se}catch(Se){throw R(Se instanceof ui&&Se.reason?Se.reason:Se.message),Se}},[s,lt,ys,Fe]),Gt=P.useCallback(async ie=>{try{await Ht.killSession(ie)}catch(ge){throw R(ge instanceof ui&&ge.reason?ge.reason:ge.message),ge}const ve=((s==null?void 0:s.sessions)??[]).filter(ge=>ge.id!==ie);if(t(ge=>ge&&{...ge,sessions:ve}),y===ie){const ge=ve.find(Se=>Se.status!=="exited");Fe(ge?ge.id:null)}},[s,y,Fe]),bt=P.useCallback(async ie=>{const ve=await Ht.connectWorkflow(ie);return t(ge=>ge&&{...ge,workflows:[...ge.workflows.filter(Se=>Se.path!==ve.path),ve]}),(ot.current??(ot.current=new Set)).add(ve.path),ve},[]),pi=P.useCallback(async ie=>{const ve=await Ht.scanWorkflows(ie),ge=await Tt(),Se=ot.current??(ot.current=new Set);for(const Me of ge)Se.add(Me.path);return ve},[Tt]),si=P.useCallback(()=>Ht.listHarnesses(),[]),Gs=P.useCallback(async(ie,ve)=>{const ge=await Ht.bindWorkflow(ie,ve);t(Se=>Se&&{...Se,sessions:Se.sessions.map(Me=>Me.id===ge.id?ge:Me)})},[]),Cs=P.useCallback(async ie=>{const ve=await Ht.updateSettings(ie);return a(ve),ie.telemetryOptIn!==void 0&&t(ge=>ge&&{...ge,telemetryOptIn:ve.telemetryOptIn}),ie.productAnalyticsOptIn!==void 0&&t(ge=>ge&&{...ge,productAnalyticsOptIn:ve.productAnalyticsOptIn!==!1}),ve},[]),Ke=P.useCallback(async(ie,ve)=>{try{await Ht.runMacro(ie,ve)}catch(ge){R(ge instanceof ui&&ge.reason?ge.reason:ge.message)}},[]),it=P.useCallback(ie=>{const ve=I.current.get(ie);if(ve)return ve;const ge=(async()=>{R("Deploying…");const Se=Ty(ie),Me=Ry(d.current.find(nt=>nt.path===ie)),yt=performance.now();jr("agent.deploy_started",{workflow_slug:Se,...Me});let Xe=null,tt=null,Je=!1;try{const nt=await Ht.deploy(ie,ct=>{ct.phase==="linking"?(Xe="linking",we(ie,{phase:"linking"}),R(`Deploying — creating the agent "${ct.name}" on Sapiom…`)):ct.phase==="warning"?(tt=ct.message,R(ct.message)):ct.phase==="building"&&(Xe="building",we(ie,{phase:"building"}),R("Deploying — building on Sapiom…"),Tt())});if(nt.phase==="ready")we(ie,{phase:"ready"}),jr("agent.deploy_succeeded",{workflow_slug:Se,duration_ms:Math.round(performance.now()-yt),...Me}),Je=!0,R(tt?`Deployed to Sapiom. ${tt}`:"Deployed to Sapiom."),z(ct=>{if(!ct.has(ie))return ct;const bs=new Map(ct);return bs.delete(ie),bs}),await Tt();else if(nt.phase==="error"){const ct=Xe==="linking"?"Couldn't create the agent":"Deploy failed",bs=nt.hint?`${ct}: ${nt.message} (${nt.hint})`:`${ct}: ${nt.message}`;we(ie,{phase:"error",message:bs}),jr("agent.deploy_failed",{workflow_slug:Se,error_kind:Ay(Xe,!1),...Me}),Je=!0,R(bs),z(ht=>new Map(ht).set(ie,bs)),await Tt()}}catch(nt){const ct=nt instanceof ui&&nt.reason?nt.reason:nt.message;we(ie,{phase:"error",message:ct}),Je||jr("agent.deploy_failed",{workflow_slug:Se,error_kind:Ay(Xe,!0),...Me}),R(ct),z(bs=>new Map(bs).set(ie,ct))}finally{$e(),I.current.delete(ie)}})();return I.current.set(ie,ge),ge},[Tt,$e,we]),Ce=P.useCallback(async(ie,ve,ge)=>{try{const{executionId:Se}=await Ht.run({definitionId:ve,input:ge});pt(ie,Se,"prod")}catch(Se){R(Se instanceof ui&&Se.reason?Se.reason:Se.message)}finally{$e()}},[pt,$e]),Ve=P.useCallback(async()=>Ht.startAuth(),[]),ut=P.useCallback(async()=>{try{await Ht.disconnect()}catch(ie){R(ie instanceof ui&&ie.reason?ie.reason:ie.message)}},[]),Es=P.useCallback(()=>R(null),[]),vi=P.useCallback(async(ie,ve)=>{await Ht.injectInput(ie,{text:ve,submit:!0})},[]),Bs=P.useCallback(ie=>{R(ie)},[]),ws=P.useCallback(ie=>Y.get(ie)??null,[Y]),gi=P.useCallback(ie=>Ht.listDir(ie),[]);return{state:s,loading:p,error:h,errorKind:S,reload:kt,settings:n,bootToken:ka(),selectedWorkflowPath:A,setSelectedWorkflowPath:C,activeSessionId:y,setActiveSessionId:Fe,history:m,historyLoading:M,loadHistory:Os,createSession:Pe,listTemplates:ds,getTemplate:Wt,sessionRecord:_s,resumeSession:lt,rehydrateSession:ys,resumeFromHistory:is,closeSession:Gt,connectWorkflow:bt,scanWorkflows:pi,listHarnesses:si,bindWorkflow:Gs,updateSettings:Cs,runMacro:Ke,deploy:it,startProdRun:Ce,runLocal:xt,injectInput:vi,showToast:Bs,lastDeployErrorFor:ws,deployStateByPath:oe,dismissDeployState:ie=>we(ie,null),directActionSettleSeq:Ee,listDir:gi,lastMessage:q,runsBySession:_t,runsByExecution:J,runIdsBySession:H,selectRun:ls,previewBySession:ue,toast:k,dismissToast:Es,busySessionIds:U,tasks:se,api:Ht,startAuth:Ve,disconnect:ut}}const oA=10*6e4,lA=4e3;function qo(s,t){return t?s.filter(n=>n.status!=="exited"&&(n.boundWorkflowPath===t||n.boundWorkflowPath==null&&n.cwd===t)).sort((n,a)=>n.createdAt.localeCompare(a.createdAt)||n.id.localeCompare(a.id)):[]}const cA=()=>{var ml,sr,ir,mi,$s,Ia,_l,Br,za,nr,yl,Ps,Hr,$a,Ir,Yi,Pa,Ua,Ki;const s=aA(),t=X3(),[n,a]=P.useState(!1),[l,d]=P.useState(!1),[p,c]=P.useState(null),h=P.useRef(null),v=P.useRef(null),S=P.useRef(J3()),f=P.useRef(!1),x=P.useRef(null),[E,A]=P.useState(null),[C,y]=P.useState(null),[b,m]=P.useState(!1),[_,k]=P.useState(()=>{const K=Wi().rightTab;return K==="canvas"||K==="steps"||K==="code"?K:"canvas"}),[R,M]=P.useState(_==="code"),[j,T]=P.useState(null),[D,I]=P.useState(!1),[q,W]=P.useState(!1),[U,Z]=P.useState(()=>Wi().sessionNames??{}),se=(K,_e)=>{Z(Re=>{const Ye={...Re},Pt=_e.trim();return Pt?Ye[K]=Pt:delete Ye[K],xn({sessionNames:Ye}),Ye})},F=P.useRef(new Map),G=P.useRef([]),J=P.useCallback(K=>{const _e=F.current.get(K);if(_e)return window.clearTimeout(_e.timer),window.clearTimeout(_e.hintTimer),F.current.delete(K),_e},[]),O=P.useCallback(K=>{const _e=F.current.get(K);if(!_e)return;const Re=G.current.find(Ye=>Ye.id===K);Re&&(Re.ready?(J(K),s.injectInput(K,_e.prompt).catch(()=>s.showToast(_e.failMessage))):Re.status==="exited"&&(J(K),s.showToast(_e.failMessage)))},[J,s.injectInput,s.showToast]),H=P.useCallback((K,_e,Re)=>{J(K);const Ye=window.setTimeout(()=>{J(K)&&s.showToast(Re)},oA),Pt=window.setTimeout(()=>{F.current.has(K)&&s.showToast("Sign in to Claude in the terminal — your prompt sends automatically once you're signed in.")},lA);F.current.set(K,{prompt:_e,failMessage:Re,timer:Ye,hintTimer:Pt}),O(K)},[J,s.showToast,O]);P.useEffect(()=>{var K;if(G.current=((K=s.state)==null?void 0:K.sessions)??[],F.current.size!==0)for(const _e of[...F.current.keys()])O(_e)},[(ml=s.state)==null?void 0:ml.sessions,O]);const[L,B]=P.useState(()=>mp()||(Wi().railCollapsed??!1)),[V,Q]=P.useState(()=>mp()||(Wi().rightCollapsed??!1)),[ue,fe]=P.useState(!1),Y=WT(),z=FT(),{widths:oe,canvasResizing:ae,railResizing:we,startRailDrag:Ee,startCanvasDrag:Ue,resetRail:$e,resetCanvas:We}=VT(),[Fe,Ne]=P.useState(!1),$t=P.useRef(!1),pt=P.useRef(null),Nt=P.useRef(!1),xt=P.useRef(null),ls=P.useRef(null),_t=P.useCallback(K=>{K&&!$t.current&&K.style.setProperty("--rp-w",`${K.offsetWidth}px`)},[]),ot=P.useCallback(K=>{var Re;if((Re=ls.current)==null||Re.disconnect(),xt.current=K,!K){ls.current=null;return}const _e=new ResizeObserver(()=>{Nt.current||_t(K)});_e.observe(K),ls.current=_e},[_t]);$t.current=V,Nt.current=Fe,P.useLayoutEffect(()=>{if(Y)return;Ne(!0);const K=window.setTimeout(()=>{Ne(!1),_t(xt.current)},260);return()=>window.clearTimeout(K)},[V,Y,_t]),P.useEffect(()=>{const K=_e=>{var Ye;const Re=_e.key.toLowerCase();if((_e.metaKey||_e.ctrlKey)&&(Re==="k"||Re==="p")){_e.preventDefault(),a(!0);return}if((_e.metaKey||_e.ctrlKey)&&/^[1-9]$/.test(_e.key)){const Ts=qo(((Ye=s.state)==null?void 0:Ye.sessions)??[],p)[Number(_e.key)-1];Ts&&(_e.preventDefault(),d(!1),T(null),I(!1),W(!1),s.setActiveSessionId(Ts.id))}};return window.addEventListener("keydown",K),()=>window.removeEventListener("keydown",K)},[(sr=s.state)==null?void 0:sr.sessions,p]);const kt=yk({settingsRoot:(ir=s.settings)==null?void 0:ir.projectRoot,defaultProjectRoot:(mi=s.state)==null?void 0:mi.defaultProjectRoot,launchDir:($s=s.state)==null?void 0:$s.launchDir}),Tt=async K=>{await s.updateSettings({projectRoot:K})};P.useEffect(()=>{var _e;if(!n||!s.state)return;const K=Wy(s.state.sessions,((_e=s.settings)==null?void 0:_e.recentDirs)??[],s.activeSessionId);K.length>0&&s.loadHistory(K)},[n]);const Os=P.useRef(!1);P.useEffect(()=>{var _e;if(Os.current||!s.state)return;Os.current=!0;const K=s.state.sessions.find(Re=>Re.id===s.activeSessionId);c(Ea(K)??((_e=s.state.workflows[0])==null?void 0:_e.path)??null)},[s.state,s.activeSessionId]);const Pe=s.state;P.useEffect(()=>{Pe&&HT(Pe)},[Pe,Pe==null?void 0:Pe.authenticated,Pe==null?void 0:Pe.userId,Pe==null?void 0:Pe.tenantId,Pe==null?void 0:Pe.consentSource,Pe==null?void 0:Pe.productAnalyticsOptIn,Pe==null?void 0:Pe.version]),P.useEffect(()=>{if(!Pe)return;const K=Pe.sessions.find(Re=>Re.id===s.activeSessionId),_e={firstRun:Pe.firstRun===!0,settingsOpen:b,templatesOpen:D,hasLiveSession:Pe.sessions.some(Re=>Re.status!=="exited"),inspectingDeadSession:(K==null?void 0:K.status)==="exited",rightTab:_};NT(_e)},[Pe,s.activeSessionId,b,D,_]);const ds=P.useRef(Y);P.useEffect(()=>{ds.current!==Y&&(ds.current=Y,B(Y),Q(Y))},[Y]),P.useEffect(()=>{Y||xn({railCollapsed:L,rightCollapsed:V})},[L,V,Y]),P.useEffect(()=>{xn({rightTab:_})},[_]);const Wt=z.record,_s=s.activeSessionId,lt=p!=null&&qo(((Ia=s.state)==null?void 0:Ia.sessions)??[],p).length>0,ys=P.useRef(!1);P.useEffect(()=>{if(ys.current){ys.current=!1;return}D?Wt({kind:"templates"}):j?Wt({kind:"review",summary:j}):l?Wt({kind:"composer"}):_s&&(p==null||lt)?Wt({kind:"session",sessionId:_s,agentPath:p}):p&&Wt({kind:"agent",agentPath:p})},[Wt,D,j,l,_s,p,lt]);const is=s.setActiveSessionId,Gt=P.useCallback(K=>{K&&(ys.current=!0,W(!1),I(K.kind==="templates"),d(K.kind==="composer"),T(K.kind==="review"?K.summary:null),K.kind==="session"?(c(K.agentPath),is(K.sessionId)):K.kind==="agent"&&c(K.agentPath))},[is]),bt=((_l=s.state)==null?void 0:_l.sessions.find(K=>K.id===s.activeSessionId&&K.status==="exited"))??null,pi=bt!=null&&bt.agentSessionId?(Br=s.history.find(K=>K.agentSessionId===bt.agentSessionId))==null?void 0:Br.resumeMode:"rehydrate",si=(bt==null?void 0:bt.agentSessionId)!=null&&pi===void 0?bt.cwd:null,Gs=s.loadHistory;P.useEffect(()=>{si&&Gs([si])},[si,Gs]);const Cs=P.useRef(new Map);if(P.useEffect(()=>{for(const K of s.tasks){if(K.macroId!=="describe")continue;Cs.current.get(K.id)==="running"&&K.status!=="running"&&s.showToast(K.status==="failed"?"Couldn't generate descriptions — check the agent terminal for details.":"Describe run finished — the canvas updates if the agent changed the source."),Cs.current.set(K.id,K.status)}},[s.tasks,s.showToast]),P.useEffect(()=>{const K=Jc();if(K!=null&&K.onDeepLink)return K.onDeepLink(_e=>{var Re;return(Re=h.current)==null?void 0:Re.call(h,_e)})},[]),P.useEffect(()=>{var _e;if(s.loading)return;const K=S.current;!K||f.current||(f.current=!0,(_e=h.current)==null||_e.call(h,K))},[s.loading]),P.useEffect(()=>{var _e;const K=x.current;K&&((_e=v.current)!=null&&_e.call(v,K))&&(x.current=null)},[(za=s.state)==null?void 0:za.workflows]),s.loading)return u.jsx("div",{className:"app-status",children:"Loading Agent Studio…"});if(s.error||!s.state){const K=K3({online:t,error:s.errorKind});return u.jsx(GE,{status:K==="online"?"error":K,onRetry:s.reload,detail:s.error,onStartAuth:K==="auth"?s.startAuth:void 0})}const{state:Ke}=s,it=Ke.sessions.find(K=>K.id===s.activeSessionId)??null,Ce=Ea(it),Ve=Ke.workflows.find(K=>K.path===Ce)??null,ut=Ke.workflows.find(K=>K.path===p)??null,Es=qo(Ke.sessions,p),vi=j!=null,Bs=!vi&&(it==null?void 0:it.status)==="exited",ws=!vi&&!Bs&&!l&&ut!=null&&Es.length===0,gi=!vi&&!Bs&&!l&&!ws&&it!=null&&it.status!=="exited",ie=!vi&&!Bs&&(l||!ws&&!gi),ve=l&&it!=null&&it.status!=="exited",ge=ws?null:Ve,Se=ws?(ut==null?void 0:ut.name)??null:null,Me=ge?Da(ge,s.lastDeployErrorFor(ge.path)):null,yt=s.activeSessionId?s.runsBySession.get(s.activeSessionId)??null:null,Xe=v0(yt,Ce)?yt:null,tt=s.activeSessionId?(s.runIdsBySession.get(s.activeSessionId)??[]).map(K=>s.runsByExecution.get(K)).filter(K=>K!==void 0).filter(K=>v0(K,Ce)):[],Je=(Xe==null?void 0:Xe.run.status)==="running"?Xe.target:null,nt=()=>{Y&&B(!0)},ct=async(K,_e)=>{d(!1),T(null),W(!1),c(K),nt();const Re=await s.createSession({cwd:K,harness:_e});return Xc("session.created"),jr("session.started",{harness_kind:_e,origin:"user"}),Re},bs=async(K,_e)=>{await ct(K,_e)},ht=async(K,_e,Re)=>{const Ye=await ct(K,_e),Pt=`Scaffold a new Sapiom agent project in this directory: ${Df(K,"default")}, then run npm install, read AGENTS.md, and use the sapiom-agent-authoring skill to`,Ts=Re==null?void 0:Re.trim();H(Ye.id,Ts?`${Pt} build this:
462
-
463
- ${Ts}`:`${Pt} define the first agent.`,"Couldn't send the scaffold prompt. Ask the coding agent to call sapiom_dev_agents_scaffold.")},Vs=K=>{(async()=>{const _e=qo(Ke.sessions,K.path)[0],Re=(_e==null?void 0:_e.cwd)??K.path;try{const Ye=await ct(Re,"claude-code");await s.bindWorkflow(Ye.id,K.path),c(K.path)}catch(Ye){s.showToast(Ye.message||"Couldn't start the session.")}})()},ye=K=>{var Re;const _e=((Re=Ke.sessions.find(Ye=>Ye.id===K))==null?void 0:Re.cwd)??".";H(K,`Scaffold a new Sapiom agent project in this directory: ${Df(_e,"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.")},De=async(K,_e,Re="template_gallery")=>{const Ye=await ct(K,"claude-code");jr("agent.template_cloned",{template_slug:_e.id,template_id:_e.id,surface:Re}),H(Ye.id,Ek(_e,K),_e.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.")},Oe=K=>{const _e=new Set;for(const Re of Ke.sessions){const Ye=Re.cwd.split("/").filter(Boolean).pop();Ye&&_e.add(Ye)}for(const Re of Ke.workflows){const Ye=Re.path.split("/").filter(Boolean).pop();Ye&&_e.add(Ye)}return Zy(Sk(K,_e),kt||null)},Ct=(K,_e)=>{const Re=Oe(K.trim()?_k(K):Tp);if(!Re){s.showToast("Set a project folder first — use the + to open one.");return}Q(!0),ht(Re,_e,K.trim()||void 0)},ze=K=>{const _e=Oe(K.id);if(!_e){s.showToast("Set a project folder first — use the + to open one.");return}Q(!0),De(_e,K,"welcome")},ns=async K=>{const _e=await s.scanWorkflows(K);return s.showToast(_e.length===0?"No agent projects found under this folder.":_e.length===1?"Found 1 agent project.":`Found ${_e.length} agent projects.`),_e.length},ks=K=>{d(!1),T(null),I(!1),W(!1),nt();const _e=Ke.sessions.find(Re=>Re.id===K);_e&&c(Ea(_e)??_e.cwd),s.setActiveSessionId(K)},Rt=K=>{d(!1),T(null),I(!1),W(!1),s.setActiveSessionId(K)},Cn=K=>{d(!1),T(K),I(!1),W(!1),nt()},Vi=K=>{var Re;const _e=((Re=s.settings)==null?void 0:Re.editorUrlTemplate)??"vscode://file{path}";window.location.href=_e.replace("{path}",encodeURI(K))},rs=K=>{var Ye;d(!1),T(null),I(!1),W(!1),c(K),nt();const _e=qo(Ke.sessions,K),Re=_e.some(Pt=>Pt.id===s.activeSessionId)?s.activeSessionId:((Ye=_e[_e.length-1])==null?void 0:Ye.id)??null;Re!==s.activeSessionId&&s.setActiveSessionId(Re)};v.current=K=>{const _e=Ke.workflows.find(Re=>Re.definitionId!=null&&String(Re.definitionId)===K);return _e?(rs(_e.path),!0):!1},h.current=K=>{var _e;if(K.kind==="template"){y(K.templateId),I(!0),W(!1);return}(_e=v.current)!=null&&_e.call(v,K.definitionId)||A(K)};const Ii=async K=>{var Re;A(null);const _e=Oe(((Re=K.slug)==null?void 0:Re.trim())||`agent-${K.definitionId}`);if(!_e){s.showToast("Set a project folder first — use the + to open one.");return}x.current=K.definitionId,Q(!0);try{const Ye=await ct(_e,"claude-code");H(Ye.id,kk(K.definitionId,_e),"Couldn't send the clone prompt. Ask the coding agent to run sapiom_dev_agents_clone.")}catch(Ye){x.current=null,s.showToast(Ye.message||"Couldn't start a session to clone the agent.")}},tr=async K=>{nt();const _e=Ke.sessions.filter(ss=>ss.status!=="exited"),Re=ss=>ss.boundWorkflowPath===K||K===ss.cwd||K.startsWith(`${ss.cwd}/`),Ye=_e.find(ss=>ss.id===s.activeSessionId),Pt=Ye&&Re(Ye)?Ye:_e.filter(Re).sort((ss,_i)=>_i.cwd.length-ss.cwd.length||_i.createdAt.localeCompare(ss.createdAt))[0];let Ts;if(Pt)d(!1),T(null),W(!1),Pt.id!==s.activeSessionId&&s.setActiveSessionId(Pt.id),Ts=Pt.id;else try{Ts=(await ct(K,"claude-code")).id}catch(ss){return s.showToast(ss.message||"Couldn't start a session in this folder."),null}return await s.bindWorkflow(Ts,K),c(K),Ts},En=(K,_e)=>{(async()=>{const Re=Xy(_e.id);((Re==="deploy"||Re==="run-local")&&K!=null||Re==="prod-run"&&(K==null?void 0:K.definitionId)!=null&&Rf(K))&&(k("steps"),Q(!1));let Pt=s.activeSessionId;if(K&&(Pt=await tr(K.path)??Pt),_e.action.kind==="open-url"){window.open(dk(_e.action.url,K),"_blank","noopener,noreferrer");return}if(Pt){if(Re!==null){if(Re==="deploy")K?s.deploy(K.path):s.showToast("Select an agent first.");else if(Re==="prod-run")if((K==null?void 0:K.definitionId)!=null&&Rf(K))s.startProdRun(Pt,String(K.definitionId));else{const Ts=K?s.lastDeployErrorFor(K.path):null,ss=K?Da(K,Ts):"draft";s.showToast(ss==="failed"?"Last deploy failed — retry Deploy.":ss==="building"?"The cloud build is still in progress.":ss==="linked"?"No ready deployment yet — deploy it first.":"This agent isn't deployed yet — deploy it first.")}else Re==="run-local"&&(K?s.runLocal(Pt,K.path):s.showToast("Select an agent first."));return}s.runMacro(_e.id,{harnessSessionId:Pt,workflowPath:K==null?void 0:K.path})}})()},gl=K=>{(async()=>{const _e=await tr(K.path)??s.activeSessionId;_e&&s.runMacro("describe",{harnessSessionId:_e,workflowPath:K.path,subject:IT(K)})})()};return u.jsxs("div",{className:"app-shell","data-rail-collapsed":L||void 0,children:[Y&&!L&&u.jsx("div",{className:"shell-scrim","data-testid":"rail-drawer-scrim","aria-hidden":"true",onClick:()=>B(!0)}),(!Y||!L)&&u.jsx("div",{className:"rail-slot"+(we?" is-resizing":"")+(!Y&&L?" is-collapsed":""),inert:!Y&&L?!0:void 0,style:Y?void 0:{width:L?0:oe.rail},children:u.jsx(q3,{projectRoot:kt||null,onSaveProjectRoot:Tt,width:oe.rail,minWidth:Kp,workflows:Ke.workflows,sessions:Ke.sessions,activeSessionId:s.activeSessionId,focusedAgentPath:p,onFocusAgent:rs,onOpenPalette:()=>a(!0),onConnect:async K=>{await s.connectWorkflow(K)},onCollapse:()=>B(!0),canGoBack:z.canGoBack,canGoForward:z.canGoForward,onGoBack:()=>Gt(z.goBack()),onGoForward:()=>Gt(z.goForward()),onSelectSession:ks,overviewSelected:q,onSelectOverview:()=>{W(!0),d(!1),T(null),I(!1),nt()},onNewSession:()=>{d(!0),I(!1),W(!1)},onReviewSummary:Cn,history:s.history,historyLoading:s.historyLoading,onOpenHistory:K=>void s.loadHistory(K),recentDirs:((nr=s.settings)==null?void 0:nr.recentDirs)??[],launchDir:Ke.launchDir??null,listDir:s.listDir,onCreateSession:bs,listHarnesses:s.listHarnesses,onScaffoldSession:ht,onScaffoldInSession:ye,onBrowseTemplates:()=>{I(!0),W(!1)},templatesActive:D,onScanWorkflows:ns,onToast:s.showToast,telemetryOptIn:((yl=s.settings)==null?void 0:yl.telemetryOptIn)??Ke.telemetryOptIn,consentSource:Ke.consentSource,consentEnvReason:Ke.consentEnvReason,authenticated:Ke.authenticated,organizationName:Ke.organizationName,onToggleTelemetry:async K=>{await s.updateSettings({telemetryOptIn:K})},productAnalyticsOptIn:Ke.productAnalyticsOptIn,onToggleProductAnalytics:async K=>{await s.updateSettings({productAnalyticsOptIn:K})},rollingSummary:((Ps=s.settings)==null?void 0:Ps.rollingSummary)===!0,onToggleRollingSummary:async K=>{await s.updateSettings({rollingSummary:K})},onStartAuth:s.startAuth,onDisconnect:s.disconnect,settingsOpen:b,onSetSettingsOpen:m})}),!L&&!Y&&u.jsx("div",{className:"pane-resize-handle pane-resize-handle-rail",style:{left:oe.rail},onPointerDown:Ee,onDoubleClick:$e,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(VE,{}),Ke.consentSource==="default-silent"&&!((Hr=s.settings)!=null&&Hr.telemetryNoticeDismissed)&&u.jsx(pk,{onDismiss:()=>{s.updateSettings({telemetryNoticeDismissed:!0})},onOpenSettings:()=>m(!0)}),u.jsxs("div",{className:"app"+(D?" is-browsing":"")+(!D&&!Y&&!ie?" canvas-animated":"")+(Fe?" canvas-sliding":"")+(ae?" canvas-dragging":""),style:{gridTemplateColumns:D||Y||ie?"minmax(0, 1fr)":`minmax(${fl}px, 1fr) ${V?oe.canvas==null?"0fr":"0px":oe.canvas==null?"1fr":`${oe.canvas}px`}`},children:[D&&u.jsx(qk,{projectRoot:kt||null,recentDirs:(($a=s.settings)==null?void 0:$a.recentDirs)??[],listDir:s.listDir,onExit:()=>I(!1),onUse:De,listTemplates:s.listTemplates,getTemplate:s.getTemplate,openTemplateId:C}),u.jsxs("div",{className:"center-pane",children:[u.jsx(ck,{openedAgentName:Se,reviewTitle:j?j.title:null,composing:ie,onBack:ve?()=>d(!1):null,activeSession:gi||Bs?it:null,sessionName:it?Ey(it,Ke.sessions,U):null,onRenameSession:se,boundWorkflowName:(Ve==null?void 0:Ve.name)??null,sessions:gi?Es:[],onSelectSession:Rt,labelOf:K=>{const _e=Ey(K,Ke.sessions,U),Re=K.cwd.split("/").filter(Boolean).pop()??"",Ye=_e.startsWith(`${Re} `)?_e.slice(Re.length+1):"";if(!(_e===Re||/^\d+$/.test(Ye))||!ut)return _e;const Ts=Es.findIndex(ss=>ss.id===K.id);return Ts>0?`${ut.name} ${Ts+1}`:ut.name},busy:it!=null&&s.busySessionIds.has(it.id),onCloseSession:K=>void s.closeSession(K),onOpenInEditor:Vi,onToast:s.showToast,onExpandRail:L?()=>B(!1):null,onExpandRight:V?()=>Q(!1):null,onNewSession:()=>d(!0),actions:gi&&it&&Ve?u.jsx(fk,{workflow:Ve,activeSessionId:s.activeSessionId,sessionReady:it.ready===!0&&it.status!=="exited",macros:Ke.macros,onRunMacro:K=>En(Ve,K),preview:s.previewBySession.get(it.id)??null,lastDeployError:s.lastDeployErrorFor(Ve.path),authenticated:Ke.authenticated,directActionSettleSeq:s.directActionSettleSeq,runningTarget:Je}):null}),u.jsx("div",{className:"terminal-slot",children:vi&&j?u.jsx(ak,{summary:j,loadRecord:s.sessionRecord,onStart:()=>{const K=j;T(null),s.resumeFromHistory(K)},onClose:()=>T(null)}):Bs&&it?u.jsx(rk,{session:it,resumeMode:pi,loadRecord:s.sessionRecord,onResume:()=>void s.resumeSession(it.id),onContinue:()=>void s.rehydrateSession({cwd:it.cwd,harness:it.harness,from:it.id}),onClose:()=>void s.closeSession(it.id)}):ws&&ut?u.jsx(Bi,{className:"terminal-empty",testId:"open-agent-empty",icon:"Radio",title:`No running session for ${ut.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:()=>Vs(ut),children:[u.jsx(de,{name:"Plus",size:14})," Start session"]})}):gi&&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(i3,{sessionId:s.activeSessionId,token:s.bootToken,cwd:(it==null?void 0:it.cwd)??null})})}):u.jsx(k3,{firstRun:Ke.firstRun===!0,onSubmitIdea:Ct,onUseTemplate:ze,onBrowseTemplates:()=>I(!0),listHarnesses:s.listHarnesses,listTemplates:s.listTemplates,telemetryOptIn:((Ir=s.settings)==null?void 0:Ir.telemetryOptIn)??Ke.telemetryOptIn,onToggleTelemetry:async K=>{await s.updateSettings({telemetryOptIn:K})},recentDirs:((Yi=s.settings)==null?void 0:Yi.recentDirs)??[],projectRoot:kt||null,listDir:s.listDir,onConnect:async K=>{await s.connectWorkflow(K)},onScan:ns,onScaffold:ht,onSaveProjectRoot:Tt})})]}),!V&&!Y&&!ie&&u.jsx("div",{className:"pane-resize-handle pane-resize-handle-canvas",style:{right:oe.canvas==null?"50%":`min(${oe.canvas}px, calc(100% - ${fl}px))`},onPointerDown:Ue,onDoubleClick:We,role:"separator","aria-orientation":"vertical","aria-label":"Resize canvas pane","data-testid":"resize-handle-canvas"}),Y&&!V&&u.jsx("div",{className:"shell-scrim","data-testid":"right-sheet-scrim","aria-hidden":"true",onClick:()=>Q(!0)}),u.jsxs("div",{ref:ot,className:"right-pane"+(V||ie?" is-collapsed":""),children:[u.jsxs("div",{className:"right-pane-tabs",role:"tablist","aria-label":"Right pane",children:[u.jsxs("button",{role:"tab","aria-selected":_==="canvas",className:"right-pane-tab"+(_==="canvas"?" is-active":""),onClick:()=>k("canvas"),"data-testid":"right-tab-canvas",children:[u.jsx(de,{name:"Workflow",size:14}),"Canvas"]}),u.jsxs("button",{role:"tab","aria-selected":_==="steps",className:"right-pane-tab"+(_==="steps"?" is-active":""),onClick:()=>k("steps"),"data-testid":"right-tab-steps",children:[u.jsx(de,{name:"List",size:14}),"Steps"]}),u.jsxs("button",{role:"tab","aria-selected":_==="code",className:"right-pane-tab"+(_==="code"?" is-active":""),onClick:()=>{k("code"),M(!0)},"data-testid":"right-tab-code",children:[u.jsx(de,{name:"Code",size:14}),"Code"]}),u.jsxs("div",{className:"right-pane-corner",children:[_==="canvas"&&(ge==null?void 0:ge.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":Me??void 0,href:Eu(ge.definitionId),target:"_blank",rel:"noreferrer","aria-label":`${Me} — open in the Sapiom dashboard`,"data-tooltip":"Open this agent in the Sapiom dashboard",children:[u.jsx(de,{name:"Cloud",size:12}),Me==="ready"?"deployed":Me==="building"?"building":Me==="failed"?"deploy failed":"linked"]}),_==="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:()=>fe(K=>!K),children:u.jsx(de,{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:()=>Q(!0),children:u.jsx(de,{name:"PanelRightClose",size:15})})]})]}),u.jsx("div",{className:"right-pane-panel"+(_==="canvas"||_==="steps"?"":" is-hidden"),"data-testid":"right-panel-canvas",children:u.jsx(CE,{sessionId:s.activeSessionId,lastMessage:s.lastMessage,boundWorkflow:ge,noSessionAgent:Se,overviewActive:ie,sessionExited:Bs,onCanvasState:K=>{var Ye;if(Y)return;const _e=((Ye=Ke.sessions.find(Pt=>Pt.id===s.activeSessionId))==null?void 0:Ye.status)==="exited";if(K||_e){pt.current=null,Q(!1);return}const Re=`${s.activeSessionId??""}::${(ge==null?void 0:ge.path)??""}`;pt.current!==Re&&(pt.current=Re,Q(!0))},expanded:ue,onToggleExpanded:()=>fe(K=>!K),macros:Ke.macros,tasks:s.tasks,surface:_==="steps"?"steps":"board",onOpenSteps:()=>k("steps"),run:(Xe==null?void 0:Xe.run)??null,runTarget:(Xe==null?void 0:Xe.target)??null,runs:tt,onSelectRun:K=>{s.activeSessionId&&s.selectRun(s.activeSessionId,K)},preview:s.activeSessionId?s.previewBySession.get(s.activeSessionId)??null:null,deployState:ge?s.deployStateByPath.get(ge.path)??null:null,onDismissDeploy:()=>{ge&&s.dismissDeployState(ge.path)},onOpenCode:()=>{k("code"),M(!0)},workflows:Ke.workflows,onOpenWorkflow:K=>void tr(K),onRunMacro:K=>En(Ve,K),onInjectPrompt:K=>{s.activeSessionId&&s.injectInput(s.activeSessionId,K)},onDescribeWorkflow:gl})}),(_==="code"||R)&&u.jsx("div",{className:"right-pane-panel"+(_==="code"?"":" is-hidden"),"data-testid":"right-panel-code",children:u.jsx($E,{boundWorkflow:ge,noSessionAgent:Se,agentsBaseUrl:Ke.agentsBaseUrl,lastDeployError:ge?s.lastDeployErrorFor(ge.path):null})})]})]})]}),q&&u.jsx(T3,{firstRun:Ke.firstRun===!0,appVersion:((Pa=Jc())==null?void 0:Pa.appVersion)||"0.5.1",recentDirs:((Ua=s.settings)==null?void 0:Ua.recentDirs)??[],projectRoot:kt||null,listDir:s.listDir,onConnect:async K=>{await s.connectWorkflow(K),W(!1)},onScan:ns,onBrowseTemplates:()=>{W(!1),I(!0)},onDismiss:()=>W(!1)}),n&&u.jsx(qE,{sessions:Ke.sessions,workflows:Ke.workflows,recentDirs:((Ki=s.settings)==null?void 0:Ki.recentDirs)??[],history:s.history,listDir:s.listDir,onSelectSession:ks,onReviewSummary:Cn,onOpenPath:K=>void bs(K,"claude-code"),onBrowseTemplates:()=>{I(!0),W(!1)},onClose:()=>a(!1)}),E&&u.jsx(Z3,{agentLabel:E.slug?`“${E.slug}”`:`Agent ${E.definitionId}`,onCancel:()=>A(null),onConfirm:()=>void Ii(E)}),s.toast&&u.jsx(r3,{message:s.toast,onDismiss:s.dismissToast}),u.jsx(a3,{})]})};function uA(s=typeof window>"u"?"":window.location.search){return new URLSearchParams(s).get("frame")==="macos"?"macos":"web"}document.documentElement.dataset.windowFrame=uA();window.addEventListener("scroll",()=>{(window.scrollX!==0||window.scrollY!==0)&&window.scrollTo(0,0)},{passive:!0});ax.createRoot(document.getElementById("root")).render(u.jsx(P.StrictMode,{children:u.jsx(cA,{})}));