@sapiom/harness 0.8.9 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +99 -0
- package/README.md +11 -1
- package/dist/core/agent-project-discovery.d.ts +235 -1
- package/dist/core/agent-project-discovery.d.ts.map +1 -1
- package/dist/core/agent-project-discovery.js +303 -1
- package/dist/core/agent-project-discovery.js.map +1 -1
- package/dist/core/canvas-interconnections.d.ts +31 -0
- package/dist/core/canvas-interconnections.d.ts.map +1 -1
- package/dist/core/canvas-interconnections.js +294 -21
- package/dist/core/canvas-interconnections.js.map +1 -1
- package/dist/core/canvas-render.d.ts +32 -0
- package/dist/core/canvas-render.d.ts.map +1 -1
- package/dist/core/canvas-render.js +50 -41
- package/dist/core/canvas-render.js.map +1 -1
- package/dist/core/definition-name.d.ts +12 -0
- package/dist/core/definition-name.d.ts.map +1 -1
- package/dist/core/definition-name.js +14 -5
- package/dist/core/definition-name.js.map +1 -1
- package/dist/core/system-graph-inventory.d.ts +68 -0
- package/dist/core/system-graph-inventory.d.ts.map +1 -0
- package/dist/core/system-graph-inventory.js +312 -0
- package/dist/core/system-graph-inventory.js.map +1 -0
- package/dist/core/system-graph-relationships.d.ts +41 -0
- package/dist/core/system-graph-relationships.d.ts.map +1 -0
- package/dist/core/system-graph-relationships.js +98 -0
- package/dist/core/system-graph-relationships.js.map +1 -0
- package/dist/core/system-graph-store.d.ts +45 -0
- package/dist/core/system-graph-store.d.ts.map +1 -0
- package/dist/core/system-graph-store.js +222 -0
- package/dist/core/system-graph-store.js.map +1 -0
- package/dist/core/system-graph-watcher.d.ts +51 -0
- package/dist/core/system-graph-watcher.d.ts.map +1 -0
- package/dist/core/system-graph-watcher.js +448 -0
- package/dist/core/system-graph-watcher.js.map +1 -0
- package/dist/core/system-graph.d.ts +43 -0
- package/dist/core/system-graph.d.ts.map +1 -0
- package/dist/core/system-graph.js +321 -0
- package/dist/core/system-graph.js.map +1 -0
- package/dist/core/workflow-registry.d.ts +84 -6
- package/dist/core/workflow-registry.d.ts.map +1 -1
- package/dist/core/workflow-registry.js +191 -91
- package/dist/core/workflow-registry.js.map +1 -1
- package/dist/core/workspace-watcher.d.ts +21 -13
- package/dist/core/workspace-watcher.d.ts.map +1 -1
- package/dist/core/workspace-watcher.js +79 -81
- package/dist/core/workspace-watcher.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/server/agent-move.d.ts +134 -0
- package/dist/server/agent-move.d.ts.map +1 -0
- package/dist/server/agent-move.js +343 -0
- package/dist/server/agent-move.js.map +1 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +275 -22
- package/dist/server/index.js.map +1 -1
- package/dist/server/rest.d.ts +3 -0
- package/dist/server/rest.d.ts.map +1 -1
- package/dist/server/rest.js +3 -0
- package/dist/server/rest.js.map +1 -1
- package/dist/server/studio-rail.d.ts +76 -0
- package/dist/server/studio-rail.d.ts.map +1 -0
- package/dist/server/studio-rail.js +234 -0
- package/dist/server/studio-rail.js.map +1 -0
- package/dist/server/system-graph.d.ts +14 -0
- package/dist/server/system-graph.d.ts.map +1 -0
- package/dist/server/system-graph.js +40 -0
- package/dist/server/system-graph.js.map +1 -0
- package/dist/server/workflow-graph.d.ts +43 -0
- package/dist/server/workflow-graph.d.ts.map +1 -0
- package/dist/server/workflow-graph.js +200 -0
- package/dist/server/workflow-graph.js.map +1 -0
- package/dist/shared/system-graph.d.ts +59 -0
- package/dist/shared/system-graph.d.ts.map +1 -0
- package/dist/shared/system-graph.js +76 -0
- package/dist/shared/system-graph.js.map +1 -0
- package/dist/shared/types.d.ts +45 -0
- package/dist/shared/types.d.ts.map +1 -1
- package/dist/shared/types.js.map +1 -1
- package/dist/web/assets/index-BLrCZ-6M.css +32 -0
- package/dist/web/assets/index-CzCPIbq9.js +513 -0
- package/dist/web/index.html +2 -2
- package/package.json +3 -3
- package/dist/web/assets/index-B18B2y5o.js +0 -494
- package/dist/web/assets/index-jGBbXx9R.css +0 -32
|
@@ -0,0 +1,513 @@
|
|
|
1
|
+
var uR=Object.defineProperty;var dR=(e,t,n)=>t in e?uR(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var vm=(e,t,n)=>dR(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const c of o)if(c.type==="childList")for(const h of c.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&r(h)}).observe(document,{childList:!0,subtree:!0});function n(o){const c={};return o.integrity&&(c.integrity=o.integrity),o.referrerPolicy&&(c.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?c.credentials="include":o.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function r(o){if(o.ep)return;o.ep=!0;const c=n(o);fetch(o.href,c)}})();function hR(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var _m={exports:{}},Xl={};/**
|
|
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 Gb;function fR(){if(Gb)return Xl;Gb=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,o,c){var h=null;if(c!==void 0&&(h=""+c),o.key!==void 0&&(h=""+o.key),"key"in o){c={};for(var l in o)l!=="key"&&(c[l]=o[l])}else c=o;return o=c.ref,{$$typeof:e,type:r,key:h,ref:o!==void 0?o:null,props:c}}return Xl.Fragment=t,Xl.jsx=n,Xl.jsxs=n,Xl}var Wb;function pR(){return Wb||(Wb=1,_m.exports=fR()),_m.exports}var d=pR(),ym={exports:{}},ht={};/**
|
|
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 Kb;function mR(){if(Kb)return ht;Kb=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),h=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),S=Symbol.iterator;function x($){return $===null||typeof $!="object"?null:($=S&&$[S]||$["@@iterator"],typeof $=="function"?$:null)}var A={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,y={};function b($,H,U){this.props=$,this.context=H,this.refs=y,this.updater=U||A}b.prototype.isReactComponent={},b.prototype.setState=function($,H){if(typeof $!="object"&&typeof $!="function"&&$!=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,$,H,"setState")},b.prototype.forceUpdate=function($){this.updater.enqueueForceUpdate(this,$,"forceUpdate")};function v(){}v.prototype=b.prototype;function _($,H,U){this.props=$,this.context=H,this.refs=y,this.updater=U||A}var k=_.prototype=new v;k.constructor=_,E(k,b.prototype),k.isPureReactComponent=!0;var C=Array.isArray;function w(){}var T={H:null,A:null,T:null,S:null},j=Object.prototype.hasOwnProperty;function M($,H,U){var P=U.ref;return{$$typeof:e,type:$,key:H,ref:P!==void 0?P:null,props:U}}function D($,H){return M($.type,H,$.props)}function L($){return typeof $=="object"&&$!==null&&$.$$typeof===e}function q($){var H={"=":"=0",":":"=2"};return"$"+$.replace(/[=:]/g,function(U){return H[U]})}var F=/\/+/g;function Y($,H){return typeof $=="object"&&$!==null&&$.key!=null?q(""+$.key):H.toString(36)}function Q($){switch($.status){case"fulfilled":return $.value;case"rejected":throw $.reason;default:switch(typeof $.status=="string"?$.then(w,w):($.status="pending",$.then(function(H){$.status==="pending"&&($.status="fulfilled",$.value=H)},function(H){$.status==="pending"&&($.status="rejected",$.reason=H)})),$.status){case"fulfilled":return $.value;case"rejected":throw $.reason}}throw $}function G($,H,U,P,W){var se=typeof $;(se==="undefined"||se==="boolean")&&($=null);var X=!1;if($===null)X=!0;else switch(se){case"bigint":case"string":case"number":X=!0;break;case"object":switch($.$$typeof){case e:case t:X=!0;break;case g:return X=$._init,G(X($._payload),H,U,P,W)}}if(X)return W=W($),X=P===""?"."+Y($,0):P,C(W)?(U="",X!=null&&(U=X.replace(F,"$&/")+"/"),G(W,H,U,"",function(oe){return oe})):W!=null&&(L(W)&&(W=D(W,U+(W.key==null||$&&$.key===W.key?"":(""+W.key).replace(F,"$&/")+"/")+X)),H.push(W)),1;X=0;var V=P===""?".":P+":";if(C($))for(var ue=0;ue<$.length;ue++)P=$[ue],se=V+Y(P,ue),X+=G(P,H,U,se,W);else if(ue=x($),typeof ue=="function")for($=ue.call($),ue=0;!(P=$.next()).done;)P=P.value,se=V+Y(P,ue++),X+=G(P,H,U,se,W);else if(se==="object"){if(typeof $.then=="function")return G(Q($),H,U,P,W);throw H=String($),Error("Objects are not valid as a React child (found: "+(H==="[object Object]"?"object with keys {"+Object.keys($).join(", ")+"}":H)+"). If you meant to render a collection of children, use an array instead.")}return X}function ee($,H,U){if($==null)return $;var P=[],W=0;return G($,P,"","",function(se){return H.call(U,se,W++)}),P}function ne($){if($._status===-1){var H=$._result;H=H(),H.then(function(U){($._status===0||$._status===-1)&&($._status=1,$._result=U)},function(U){($._status===0||$._status===-1)&&($._status=2,$._result=U)}),$._status===-1&&($._status=0,$._result=H)}if($._status===1)return $._result.default;throw $._result}var z=typeof reportError=="function"?reportError:function($){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var H=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof $=="object"&&$!==null&&typeof $.message=="string"?String($.message):String($),error:$});if(!window.dispatchEvent(H))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",$);return}console.error($)},B={map:ee,forEach:function($,H,U){ee($,function(){H.apply(this,arguments)},U)},count:function($){var H=0;return ee($,function(){H++}),H},toArray:function($){return ee($,function(H){return H})||[]},only:function($){if(!L($))throw Error("React.Children.only expected to receive a single React element child.");return $}};return ht.Activity=p,ht.Children=B,ht.Component=b,ht.Fragment=n,ht.Profiler=o,ht.PureComponent=_,ht.StrictMode=r,ht.Suspense=u,ht.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=T,ht.__COMPILER_RUNTIME={__proto__:null,c:function($){return T.H.useMemoCache($)}},ht.cache=function($){return function(){return $.apply(null,arguments)}},ht.cacheSignal=function(){return null},ht.cloneElement=function($,H,U){if($==null)throw Error("The argument must be a React element, but you passed "+$+".");var P=E({},$.props),W=$.key;if(H!=null)for(se in H.key!==void 0&&(W=""+H.key),H)!j.call(H,se)||se==="key"||se==="__self"||se==="__source"||se==="ref"&&H.ref===void 0||(P[se]=H[se]);var se=arguments.length-2;if(se===1)P.children=U;else if(1<se){for(var X=Array(se),V=0;V<se;V++)X[V]=arguments[V+2];P.children=X}return M($.type,W,P)},ht.createContext=function($){return $={$$typeof:h,_currentValue:$,_currentValue2:$,_threadCount:0,Provider:null,Consumer:null},$.Provider=$,$.Consumer={$$typeof:c,_context:$},$},ht.createElement=function($,H,U){var P,W={},se=null;if(H!=null)for(P in H.key!==void 0&&(se=""+H.key),H)j.call(H,P)&&P!=="key"&&P!=="__self"&&P!=="__source"&&(W[P]=H[P]);var X=arguments.length-2;if(X===1)W.children=U;else if(1<X){for(var V=Array(X),ue=0;ue<X;ue++)V[ue]=arguments[ue+2];W.children=V}if($&&$.defaultProps)for(P in X=$.defaultProps,X)W[P]===void 0&&(W[P]=X[P]);return M($,se,W)},ht.createRef=function(){return{current:null}},ht.forwardRef=function($){return{$$typeof:l,render:$}},ht.isValidElement=L,ht.lazy=function($){return{$$typeof:g,_payload:{_status:-1,_result:$},_init:ne}},ht.memo=function($,H){return{$$typeof:m,type:$,compare:H===void 0?null:H}},ht.startTransition=function($){var H=T.T,U={};T.T=U;try{var P=$(),W=T.S;W!==null&&W(U,P),typeof P=="object"&&P!==null&&typeof P.then=="function"&&P.then(w,z)}catch(se){z(se)}finally{H!==null&&U.types!==null&&(H.types=U.types),T.T=H}},ht.unstable_useCacheRefresh=function(){return T.H.useCacheRefresh()},ht.use=function($){return T.H.use($)},ht.useActionState=function($,H,U){return T.H.useActionState($,H,U)},ht.useCallback=function($,H){return T.H.useCallback($,H)},ht.useContext=function($){return T.H.useContext($)},ht.useDebugValue=function(){},ht.useDeferredValue=function($,H){return T.H.useDeferredValue($,H)},ht.useEffect=function($,H){return T.H.useEffect($,H)},ht.useEffectEvent=function($){return T.H.useEffectEvent($)},ht.useId=function(){return T.H.useId()},ht.useImperativeHandle=function($,H,U){return T.H.useImperativeHandle($,H,U)},ht.useInsertionEffect=function($,H){return T.H.useInsertionEffect($,H)},ht.useLayoutEffect=function($,H){return T.H.useLayoutEffect($,H)},ht.useMemo=function($,H){return T.H.useMemo($,H)},ht.useOptimistic=function($,H){return T.H.useOptimistic($,H)},ht.useReducer=function($,H,U){return T.H.useReducer($,H,U)},ht.useRef=function($){return T.H.useRef($)},ht.useState=function($){return T.H.useState($)},ht.useSyncExternalStore=function($,H,U){return T.H.useSyncExternalStore($,H,U)},ht.useTransition=function(){return T.H.useTransition()},ht.version="19.2.7",ht}var Yb;function Tv(){return Yb||(Yb=1,ym.exports=mR()),ym.exports}var O=Tv(),bm={exports:{}},Jl={},Sm={exports:{}},wm={};/**
|
|
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 Xb;function gR(){return Xb||(Xb=1,(function(e){function t(G,ee){var ne=G.length;G.push(ee);e:for(;0<ne;){var z=ne-1>>>1,B=G[z];if(0<o(B,ee))G[z]=ee,G[ne]=B,ne=z;else break e}}function n(G){return G.length===0?null:G[0]}function r(G){if(G.length===0)return null;var ee=G[0],ne=G.pop();if(ne!==ee){G[0]=ne;e:for(var z=0,B=G.length,$=B>>>1;z<$;){var H=2*(z+1)-1,U=G[H],P=H+1,W=G[P];if(0>o(U,ne))P<B&&0>o(W,U)?(G[z]=W,G[P]=ne,z=P):(G[z]=U,G[H]=ne,z=H);else if(P<B&&0>o(W,ne))G[z]=W,G[P]=ne,z=P;else break e}}return ee}function o(G,ee){var ne=G.sortIndex-ee.sortIndex;return ne!==0?ne:G.id-ee.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var h=Date,l=h.now();e.unstable_now=function(){return h.now()-l}}var u=[],m=[],g=1,p=null,S=3,x=!1,A=!1,E=!1,y=!1,b=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;function k(G){for(var ee=n(m);ee!==null;){if(ee.callback===null)r(m);else if(ee.startTime<=G)r(m),ee.sortIndex=ee.expirationTime,t(u,ee);else break;ee=n(m)}}function C(G){if(E=!1,k(G),!A)if(n(u)!==null)A=!0,w||(w=!0,q());else{var ee=n(m);ee!==null&&Q(C,ee.startTime-G)}}var w=!1,T=-1,j=5,M=-1;function D(){return y?!0:!(e.unstable_now()-M<j)}function L(){if(y=!1,w){var G=e.unstable_now();M=G;var ee=!0;try{e:{A=!1,E&&(E=!1,v(T),T=-1),x=!0;var ne=S;try{t:{for(k(G),p=n(u);p!==null&&!(p.expirationTime>G&&D());){var z=p.callback;if(typeof z=="function"){p.callback=null,S=p.priorityLevel;var B=z(p.expirationTime<=G);if(G=e.unstable_now(),typeof B=="function"){p.callback=B,k(G),ee=!0;break t}p===n(u)&&r(u),k(G)}else r(u);p=n(u)}if(p!==null)ee=!0;else{var $=n(m);$!==null&&Q(C,$.startTime-G),ee=!1}}break e}finally{p=null,S=ne,x=!1}ee=void 0}}finally{ee?q():w=!1}}}var q;if(typeof _=="function")q=function(){_(L)};else if(typeof MessageChannel<"u"){var F=new MessageChannel,Y=F.port2;F.port1.onmessage=L,q=function(){Y.postMessage(null)}}else q=function(){b(L,0)};function Q(G,ee){T=b(function(){G(e.unstable_now())},ee)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(G){G.callback=null},e.unstable_forceFrameRate=function(G){0>G||125<G?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):j=0<G?Math.floor(1e3/G):5},e.unstable_getCurrentPriorityLevel=function(){return S},e.unstable_next=function(G){switch(S){case 1:case 2:case 3:var ee=3;break;default:ee=S}var ne=S;S=ee;try{return G()}finally{S=ne}},e.unstable_requestPaint=function(){y=!0},e.unstable_runWithPriority=function(G,ee){switch(G){case 1:case 2:case 3:case 4:case 5:break;default:G=3}var ne=S;S=G;try{return ee()}finally{S=ne}},e.unstable_scheduleCallback=function(G,ee,ne){var z=e.unstable_now();switch(typeof ne=="object"&&ne!==null?(ne=ne.delay,ne=typeof ne=="number"&&0<ne?z+ne:z):ne=z,G){case 1:var B=-1;break;case 2:B=250;break;case 5:B=1073741823;break;case 4:B=1e4;break;default:B=5e3}return B=ne+B,G={id:g++,callback:ee,priorityLevel:G,startTime:ne,expirationTime:B,sortIndex:-1},ne>z?(G.sortIndex=ne,t(m,G),n(u)===null&&G===n(m)&&(E?(v(T),T=-1):E=!0,Q(C,ne-z))):(G.sortIndex=B,t(u,G),A||x||(A=!0,w||(w=!0,q()))),G},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(G){var ee=S;return function(){var ne=S;S=ee;try{return G.apply(this,arguments)}finally{S=ne}}}})(wm)),wm}var Jb;function vR(){return Jb||(Jb=1,Sm.exports=gR()),Sm.exports}var xm={exports:{}},fn={};/**
|
|
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 Zb;function _R(){if(Zb)return fn;Zb=1;var e=Tv();function t(u){var m="https://react.dev/errors/"+u;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)m+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+u+"; visit "+m+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},o=Symbol.for("react.portal");function c(u,m,g){var p=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:p==null?null:""+p,children:u,containerInfo:m,implementation:g}}var h=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(u,m){if(u==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}return fn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,fn.createPortal=function(u,m){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)throw Error(t(299));return c(u,m,null,g)},fn.flushSync=function(u){var m=h.T,g=r.p;try{if(h.T=null,r.p=2,u)return u()}finally{h.T=m,r.p=g,r.d.f()}},fn.preconnect=function(u,m){typeof u=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,r.d.C(u,m))},fn.prefetchDNS=function(u){typeof u=="string"&&r.d.D(u)},fn.preinit=function(u,m){if(typeof u=="string"&&m&&typeof m.as=="string"){var g=m.as,p=l(g,m.crossOrigin),S=typeof m.integrity=="string"?m.integrity:void 0,x=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;g==="style"?r.d.S(u,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:p,integrity:S,fetchPriority:x}):g==="script"&&r.d.X(u,{crossOrigin:p,integrity:S,fetchPriority:x,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},fn.preinitModule=function(u,m){if(typeof u=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var g=l(m.as,m.crossOrigin);r.d.M(u,{crossOrigin:g,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0})}}else m==null&&r.d.M(u)},fn.preload=function(u,m){if(typeof u=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var g=m.as,p=l(g,m.crossOrigin);r.d.L(u,g,{crossOrigin:p,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,type:typeof m.type=="string"?m.type:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0,referrerPolicy:typeof m.referrerPolicy=="string"?m.referrerPolicy:void 0,imageSrcSet:typeof m.imageSrcSet=="string"?m.imageSrcSet:void 0,imageSizes:typeof m.imageSizes=="string"?m.imageSizes:void 0,media:typeof m.media=="string"?m.media:void 0})}},fn.preloadModule=function(u,m){if(typeof u=="string")if(m){var g=l(m.as,m.crossOrigin);r.d.m(u,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:g,integrity:typeof m.integrity=="string"?m.integrity:void 0})}else r.d.m(u)},fn.requestFormReset=function(u){r.d.r(u)},fn.unstable_batchedUpdates=function(u,m){return u(m)},fn.useFormState=function(u,m,g){return h.H.useFormState(u,m,g)},fn.useFormStatus=function(){return h.H.useHostTransitionStatus()},fn.version="19.2.7",fn}var Qb;function eC(){if(Qb)return xm.exports;Qb=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),xm.exports=_R(),xm.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 e1;function yR(){if(e1)return Jl;e1=1;var e=vR(),t=Tv(),n=eC();function r(s){var i="https://react.dev/errors/"+s;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)i+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+s+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function c(s){var i=s,a=s;if(s.alternate)for(;i.return;)i=i.return;else{s=i;do i=s,(i.flags&4098)!==0&&(a=i.return),s=i.return;while(s)}return i.tag===3?a:null}function h(s){if(s.tag===13){var i=s.memoizedState;if(i===null&&(s=s.alternate,s!==null&&(i=s.memoizedState)),i!==null)return i.dehydrated}return null}function l(s){if(s.tag===31){var i=s.memoizedState;if(i===null&&(s=s.alternate,s!==null&&(i=s.memoizedState)),i!==null)return i.dehydrated}return null}function u(s){if(c(s)!==s)throw Error(r(188))}function m(s){var i=s.alternate;if(!i){if(i=c(s),i===null)throw Error(r(188));return i!==s?null:s}for(var a=s,f=i;;){var R=a.return;if(R===null)break;var N=R.alternate;if(N===null){if(f=R.return,f!==null){a=f;continue}break}if(R.child===N.child){for(N=R.child;N;){if(N===a)return u(R),s;if(N===f)return u(R),i;N=N.sibling}throw Error(r(188))}if(a.return!==f.return)a=R,f=N;else{for(var I=!1,K=R.child;K;){if(K===a){I=!0,a=R,f=N;break}if(K===f){I=!0,f=R,a=N;break}K=K.sibling}if(!I){for(K=N.child;K;){if(K===a){I=!0,a=N,f=R;break}if(K===f){I=!0,f=N,a=R;break}K=K.sibling}if(!I)throw Error(r(189))}}if(a.alternate!==f)throw Error(r(190))}if(a.tag!==3)throw Error(r(188));return a.stateNode.current===a?s:i}function g(s){var i=s.tag;if(i===5||i===26||i===27||i===6)return s;for(s=s.child;s!==null;){if(i=g(s),i!==null)return i;s=s.sibling}return null}var p=Object.assign,S=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),A=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),b=Symbol.for("react.profiler"),v=Symbol.for("react.consumer"),_=Symbol.for("react.context"),k=Symbol.for("react.forward_ref"),C=Symbol.for("react.suspense"),w=Symbol.for("react.suspense_list"),T=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),M=Symbol.for("react.activity"),D=Symbol.for("react.memo_cache_sentinel"),L=Symbol.iterator;function q(s){return s===null||typeof s!="object"?null:(s=L&&s[L]||s["@@iterator"],typeof s=="function"?s:null)}var F=Symbol.for("react.client.reference");function Y(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===F?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case E:return"Fragment";case b:return"Profiler";case y:return"StrictMode";case C:return"Suspense";case w:return"SuspenseList";case M:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case A:return"Portal";case _:return s.displayName||"Context";case v:return(s._context.displayName||"Context")+".Consumer";case k:var i=s.render;return s=s.displayName,s||(s=i.displayName||i.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case T:return i=s.displayName||null,i!==null?i:Y(s.type)||"Memo";case j:i=s._payload,s=s._init;try{return Y(s(i))}catch{}}return null}var Q=Array.isArray,G=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ee=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne={pending:!1,data:null,method:null,action:null},z=[],B=-1;function $(s){return{current:s}}function H(s){0>B||(s.current=z[B],z[B]=null,B--)}function U(s,i){B++,z[B]=s.current,s.current=i}var P=$(null),W=$(null),se=$(null),X=$(null);function V(s,i){switch(U(se,i),U(W,s),U(P,null),i.nodeType){case 9:case 11:s=(s=i.documentElement)&&(s=s.namespaceURI)?mb(s):0;break;default:if(s=i.tagName,i=i.namespaceURI)i=mb(i),s=gb(i,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}H(P),U(P,s)}function ue(){H(P),H(W),H(se)}function oe(s){s.memoizedState!==null&&U(X,s);var i=P.current,a=gb(i,s.type);i!==a&&(U(W,s),U(P,a))}function Z(s){W.current===s&&(H(P),H(W)),X.current===s&&(H(X),Gl._currentValue=ne)}var te,pe;function ye(s){if(te===void 0)try{throw Error()}catch(a){var i=a.stack.trim().match(/\n( *(at )?)/);te=i&&i[1]||"",pe=-1<a.stack.indexOf(`
|
|
42
|
+
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
+
`+te+s+pe}var ke=!1;function Le(s,i){if(!s||ke)return"";ke=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var f={DetermineComponentFrameRoot:function(){try{if(i){var Ae=function(){throw Error()};if(Object.defineProperty(Ae.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ae,[])}catch(we){var ve=we}Reflect.construct(s,[],Ae)}else{try{Ae.call()}catch(we){ve=we}s.call(Ae.prototype)}}else{try{throw Error()}catch(we){ve=we}(Ae=s())&&typeof Ae.catch=="function"&&Ae.catch(function(){})}}catch(we){if(we&&ve&&typeof we.stack=="string")return[we.stack,ve.stack]}return[null,null]}};f.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var R=Object.getOwnPropertyDescriptor(f.DetermineComponentFrameRoot,"name");R&&R.configurable&&Object.defineProperty(f.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var N=f.DetermineComponentFrameRoot(),I=N[0],K=N[1];if(I&&K){var ie=I.split(`
|
|
44
|
+
`),ge=K.split(`
|
|
45
|
+
`);for(R=f=0;f<ie.length&&!ie[f].includes("DetermineComponentFrameRoot");)f++;for(;R<ge.length&&!ge[R].includes("DetermineComponentFrameRoot");)R++;if(f===ie.length||R===ge.length)for(f=ie.length-1,R=ge.length-1;1<=f&&0<=R&&ie[f]!==ge[R];)R--;for(;1<=f&&0<=R;f--,R--)if(ie[f]!==ge[R]){if(f!==1||R!==1)do if(f--,R--,0>R||ie[f]!==ge[R]){var Ee=`
|
|
46
|
+
`+ie[f].replace(" at new "," at ");return s.displayName&&Ee.includes("<anonymous>")&&(Ee=Ee.replace("<anonymous>",s.displayName)),Ee}while(1<=f&&0<=R);break}}}finally{ke=!1,Error.prepareStackTrace=a}return(a=s?s.displayName||s.name:"")?ye(a):""}function Ie(s,i){switch(s.tag){case 26:case 27:case 5:return ye(s.type);case 16:return ye("Lazy");case 13:return s.child!==i&&i!==null?ye("Suspense Fallback"):ye("Suspense");case 19:return ye("SuspenseList");case 0:case 15:return Le(s.type,!1);case 11:return Le(s.type.render,!1);case 1:return Le(s.type,!0);case 31:return ye("Activity");default:return""}}function qe(s){try{var i="",a=null;do i+=Ie(s,a),a=s,s=s.return;while(s);return i}catch(f){return`
|
|
47
|
+
Error generating stack: `+f.message+`
|
|
48
|
+
`+f.stack}}var Re=Object.prototype.hasOwnProperty,He=e.unstable_scheduleCallback,Ke=e.unstable_cancelCallback,kt=e.unstable_shouldYield,ot=e.unstable_requestPaint,Ct=e.unstable_now,wt=e.unstable_getCurrentPriorityLevel,Mt=e.unstable_ImmediatePriority,jt=e.unstable_UserBlockingPriority,Lt=e.unstable_NormalPriority,ss=e.unstable_LowPriority,as=e.unstable_IdlePriority,os=e.log,vt=e.unstable_setDisableYieldValue,Ds=null,ls=null;function Kt(s){if(typeof os=="function"&&vt(s),ls&&typeof ls.setStrictMode=="function")try{ls.setStrictMode(Ds,s)}catch{}}var pt=Math.clz32?Math.clz32:ji,fi=Math.log,cs=Math.LN2;function ji(s){return s>>>=0,s===0?32:31-(fi(s)/cs|0)|0}var ln=256,rt=262144,Rs=4194304;function us(s){var i=s&42;if(i!==0)return i;switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function As(s,i,a){var f=s.pendingLanes;if(f===0)return 0;var R=0,N=s.suspendedLanes,I=s.pingedLanes;s=s.warmLanes;var K=f&134217727;return K!==0?(f=K&~N,f!==0?R=us(f):(I&=K,I!==0?R=us(I):a||(a=K&~s,a!==0&&(R=us(a))))):(K=f&~N,K!==0?R=us(K):I!==0?R=us(I):a||(a=f&~s,a!==0&&(R=us(a)))),R===0?0:i!==0&&i!==R&&(i&N)===0&&(N=R&-R,a=i&-i,N>=a||N===32&&(a&4194048)!==0)?i:R}function cn(s,i){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&i)===0}function _n(s,i){switch(s){case 1:case 2:case 4:case 8:case 64:return i+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return i+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function yn(){var s=Rs;return Rs<<=1,(Rs&62914560)===0&&(Rs=4194304),s}function bn(s){for(var i=[],a=0;31>a;a++)i.push(s);return i}function ds(s,i){s.pendingLanes|=i,i!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function pi(s,i,a,f,R,N){var I=s.pendingLanes;s.pendingLanes=a,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=a,s.entangledLanes&=a,s.errorRecoveryDisabledLanes&=a,s.shellSuspendCounter=0;var K=s.entanglements,ie=s.expirationTimes,ge=s.hiddenUpdates;for(a=I&~a;0<a;){var Ee=31-pt(a),Ae=1<<Ee;K[Ee]=0,ie[Ee]=-1;var ve=ge[Ee];if(ve!==null)for(ge[Ee]=null,Ee=0;Ee<ve.length;Ee++){var we=ve[Ee];we!==null&&(we.lane&=-536870913)}a&=~Ae}f!==0&&Os(s,f,0),N!==0&&R===0&&s.tag!==0&&(s.suspendedLanes|=N&~(I&~i))}function Os(s,i,a){s.pendingLanes|=i,s.suspendedLanes&=~i;var f=31-pt(i);s.entangledLanes|=i,s.entanglements[f]=s.entanglements[f]|1073741824|a&261930}function un(s,i){var a=s.entangledLanes|=i;for(s=s.entanglements;a;){var f=31-pt(a),R=1<<f;R&i|s[f]&i&&(s[f]|=i),a&=~R}}function mi(s,i){var a=i&-i;return a=(a&42)!==0?1:Qe(a),(a&(s.suspendedLanes|i))!==0?0:a}function Qe(s){switch(s){case 2:s=1;break;case 8:s=4;break;case 32:s=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:s=128;break;case 268435456:s=134217728;break;default:s=0}return s}function Xs(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function nt(){var s=ee.p;return s!==0?s:(s=window.event,s===void 0?32:Bb(s.type))}function Sn(s,i){var a=ee.p;try{return ee.p=s,i()}finally{ee.p=a}}var Ls=Math.random().toString(36).slice(2),Et="__reactFiber$"+Ls,Yt="__reactProps$"+Ls,dn="__reactContainer$"+Ls,Ts="__reactEvents$"+Ls,hn="__reactListeners$"+Ls,An="__reactHandles$"+Ls,Js="__reactResources$"+Ls,Fs="__reactMarker$"+Ls;function xs(s){delete s[Et],delete s[Yt],delete s[Ts],delete s[hn],delete s[An]}function Pt(s){var i=s[Et];if(i)return i;for(var a=s.parentNode;a;){if(i=a[dn]||a[Et]){if(a=i.alternate,i.child!==null||a!==null&&a.child!==null)for(s=xb(s);s!==null;){if(a=s[Et])return a;s=xb(s)}return i}s=a,a=s.parentNode}return null}function re(s){if(s=s[Et]||s[dn]){var i=s.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return s}return null}function he(s){var i=s.tag;if(i===5||i===26||i===27||i===6)return s.stateNode;throw Error(r(33))}function xe(s){var i=s[Js];return i||(i=s[Js]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function be(s){s[Fs]=!0}var Ce=new Set,Xe={};function at(s,i){Je(s,i),Je(s+"Capture",i)}function Je(s,i){for(Xe[s]=i,s=0;s<i.length;s++)Ce.add(i[s])}var le=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]*$"),$e={},ce={};function Me(s){return Re.call(ce,s)?!0:Re.call($e,s)?!1:le.test(s)?ce[s]=!0:($e[s]=!0,!1)}function Pe(s,i,a){if(Me(i))if(a===null)s.removeAttribute(i);else{switch(typeof a){case"undefined":case"function":case"symbol":s.removeAttribute(i);return;case"boolean":var f=i.toLowerCase().slice(0,5);if(f!=="data-"&&f!=="aria-"){s.removeAttribute(i);return}}s.setAttribute(i,""+a)}}function Ue(s,i,a){if(a===null)s.removeAttribute(i);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(i);return}s.setAttribute(i,""+a)}}function Ze(s,i,a,f){if(f===null)s.removeAttribute(a);else{switch(typeof f){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(a);return}s.setAttributeNS(i,a,""+f)}}function _t(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function Fe(s){var i=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function Cs(s,i,a){var f=Object.getOwnPropertyDescriptor(s.constructor.prototype,i);if(!s.hasOwnProperty(i)&&typeof f<"u"&&typeof f.get=="function"&&typeof f.set=="function"){var R=f.get,N=f.set;return Object.defineProperty(s,i,{configurable:!0,get:function(){return R.call(this)},set:function(I){a=""+I,N.call(this,I)}}),Object.defineProperty(s,i,{enumerable:f.enumerable}),{getValue:function(){return a},setValue:function(I){a=""+I},stopTracking:function(){s._valueTracker=null,delete s[i]}}}}function et(s){if(!s._valueTracker){var i=Fe(s)?"checked":"value";s._valueTracker=Cs(s,i,""+s[i])}}function st(s){if(!s)return!1;var i=s._valueTracker;if(!i)return!0;var a=i.getValue(),f="";return s&&(f=Fe(s)?s.checked?"true":"false":s.value),s=f,s!==a?(i.setValue(s),!0):!1}function Rt(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var Gs=/[\n"\\]/g;function ct(s){return s.replace(Gs,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function _s(s,i,a,f,R,N,I,K){s.name="",I!=null&&typeof I!="function"&&typeof I!="symbol"&&typeof I!="boolean"?s.type=I:s.removeAttribute("type"),i!=null?I==="number"?(i===0&&s.value===""||s.value!=i)&&(s.value=""+_t(i)):s.value!==""+_t(i)&&(s.value=""+_t(i)):I!=="submit"&&I!=="reset"||s.removeAttribute("value"),i!=null?il(s,I,_t(i)):a!=null?il(s,I,_t(a)):f!=null&&s.removeAttribute("value"),R==null&&N!=null&&(s.defaultChecked=!!N),R!=null&&(s.checked=R&&typeof R!="function"&&typeof R!="symbol"),K!=null&&typeof K!="function"&&typeof K!="symbol"&&typeof K!="boolean"?s.name=""+_t(K):s.removeAttribute("name")}function Fa(s,i,a,f,R,N,I,K){if(N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"&&(s.type=N),i!=null||a!=null){if(!(N!=="submit"&&N!=="reset"||i!=null)){et(s);return}a=a!=null?""+_t(a):"",i=i!=null?""+_t(i):a,K||i===s.value||(s.value=i),s.defaultValue=i}f=f??R,f=typeof f!="function"&&typeof f!="symbol"&&!!f,s.checked=K?s.checked:!!f,s.defaultChecked=!!f,I!=null&&typeof I!="function"&&typeof I!="symbol"&&typeof I!="boolean"&&(s.name=I),et(s)}function il(s,i,a){i==="number"&&Rt(s.ownerDocument)===s||s.defaultValue===""+a||(s.defaultValue=""+a)}function Ii(s,i,a,f){if(s=s.options,i){i={};for(var R=0;R<a.length;R++)i["$"+a[R]]=!0;for(a=0;a<s.length;a++)R=i.hasOwnProperty("$"+s[a].value),s[a].selected!==R&&(s[a].selected=R),R&&f&&(s[a].defaultSelected=!0)}else{for(a=""+_t(a),i=null,R=0;R<s.length;R++){if(s[R].value===a){s[R].selected=!0,f&&(s[R].defaultSelected=!0);return}i!==null||s[R].disabled||(i=s[R])}i!==null&&(i.selected=!0)}}function qa(s,i,a){if(i!=null&&(i=""+_t(i),i!==s.value&&(s.value=i),a==null)){s.defaultValue!==i&&(s.defaultValue=i);return}s.defaultValue=a!=null?""+_t(a):""}function Hc(s,i,a,f){if(i==null){if(f!=null){if(a!=null)throw Error(r(92));if(Q(f)){if(1<f.length)throw Error(r(93));f=f[0]}a=f}a==null&&(a=""),i=a}a=_t(i),s.defaultValue=a,f=s.textContent,f===a&&f!==""&&f!==null&&(s.value=f),et(s)}function mr(s,i){if(i){var a=s.firstChild;if(a&&a===s.lastChild&&a.nodeType===3){a.nodeValue=i;return}}s.textContent=i}var rl=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 al(s,i,a){var f=i.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?f?s.setProperty(i,""):i==="float"?s.cssFloat="":s[i]="":f?s.setProperty(i,a):typeof a!="number"||a===0||rl.has(i)?i==="float"?s.cssFloat=a:s[i]=(""+a).trim():s[i]=a+"px"}function Uc(s,i,a){if(i!=null&&typeof i!="object")throw Error(r(62));if(s=s.style,a!=null){for(var f in a)!a.hasOwnProperty(f)||i!=null&&i.hasOwnProperty(f)||(f.indexOf("--")===0?s.setProperty(f,""):f==="float"?s.cssFloat="":s[f]="");for(var R in i)f=i[R],i.hasOwnProperty(R)&&a[R]!==f&&al(s,R,f)}else for(var N in i)i.hasOwnProperty(N)&&al(s,N,i[N])}function Va(s){if(s.indexOf("-")===-1)return!1;switch(s){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Sf=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"]]),ol=/^[\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 Ga(s){return ol.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function Tn(){}var Wa=null;function ll(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var gr=null,Pi=null;function cl(s){var i=re(s);if(i&&(s=i.stateNode)){var a=s[Yt]||null;e:switch(s=i.stateNode,i.type){case"input":if(_s(s,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),i=a.name,a.type==="radio"&&i!=null){for(a=s;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+ct(""+i)+'"][type="radio"]'),i=0;i<a.length;i++){var f=a[i];if(f!==s&&f.form===s.form){var R=f[Yt]||null;if(!R)throw Error(r(90));_s(f,R.value,R.defaultValue,R.defaultValue,R.checked,R.defaultChecked,R.type,R.name)}}for(i=0;i<a.length;i++)f=a[i],f.form===s.form&&st(f)}break e;case"textarea":qa(s,a.value,a.defaultValue);break e;case"select":i=a.value,i!=null&&Ii(s,!!a.multiple,i,!1)}}}var Ka=!1;function ul(s,i,a){if(Ka)return s(i,a);Ka=!0;try{var f=s(i);return f}finally{if(Ka=!1,(gr!==null||Pi!==null)&&(Eu(),gr&&(i=gr,s=Pi,Pi=gr=null,cl(i),s)))for(i=0;i<s.length;i++)cl(s[i])}}function vr(s,i){var a=s.stateNode;if(a===null)return null;var f=a[Yt]||null;if(f===null)return null;a=f[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":(f=!f.disabled)||(s=s.type,f=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!f;break e;default:s=!1}if(s)return null;if(a&&typeof a!="function")throw Error(r(231,i,typeof a));return a}var Xn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ya=!1;if(Xn)try{var _r={};Object.defineProperty(_r,"passive",{get:function(){Ya=!0}}),window.addEventListener("test",_r,_r),window.removeEventListener("test",_r,_r)}catch{Ya=!1}var gi=null,Xa=null,Zr=null;function dl(){if(Zr)return Zr;var s,i=Xa,a=i.length,f,R="value"in gi?gi.value:gi.textContent,N=R.length;for(s=0;s<a&&i[s]===R[s];s++);var I=a-s;for(f=1;f<=I&&i[a-f]===R[N-f];f++);return Zr=R.slice(s,1<f?1-f:void 0)}function Qr(s){var i=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&i===13&&(s=13)):s=i,s===10&&(s=13),32<=s||s===13?s:0}function ea(){return!0}function hl(){return!1}function Zs(s){function i(a,f,R,N,I){this._reactName=a,this._targetInst=R,this.type=f,this.nativeEvent=N,this.target=I,this.currentTarget=null;for(var K in s)s.hasOwnProperty(K)&&(a=s[K],this[K]=a?a(N):N[K]);return this.isDefaultPrevented=(N.defaultPrevented!=null?N.defaultPrevented:N.returnValue===!1)?ea:hl,this.isPropagationStopped=hl,this}return p(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=ea)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=ea)},persist:function(){},isPersistent:ea}),i}var Ri={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ta=Zs(Ri),yr=p({},Ri,{view:0,detail:0}),Fc=Zs(yr),Ja,J,Se,Ne=p({},yr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:wf,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==Se&&(Se&&s.type==="mousemove"?(Ja=s.screenX-Se.screenX,J=s.screenY-Se.screenY):J=Ja=0,Se=s),Ja)},movementY:function(s){return"movementY"in s?s.movementY:J}}),Ge=Zs(Ne),mt=p({},Ne,{dataTransfer:0}),ys=Zs(mt),Xt=p({},yr,{relatedTarget:0}),br=Zs(Xt),hk=p({},Ri,{animationName:0,elapsedTime:0,pseudoElement:0}),fk=Zs(hk),pk=p({},Ri,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),mk=Zs(pk),gk=p({},Ri,{data:0}),y_=Zs(gk),vk={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},_k={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"},yk={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function bk(s){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(s):(s=yk[s])?!!i[s]:!1}function wf(){return bk}var Sk=p({},yr,{key:function(s){if(s.key){var i=vk[s.key]||s.key;if(i!=="Unidentified")return i}return s.type==="keypress"?(s=Qr(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?_k[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:wf,charCode:function(s){return s.type==="keypress"?Qr(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?Qr(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),wk=Zs(Sk),xk=p({},Ne,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),b_=Zs(xk),Ck=p({},yr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:wf}),Ek=Zs(Ck),kk=p({},Ri,{propertyName:0,elapsedTime:0,pseudoElement:0}),jk=Zs(kk),Rk=p({},Ne,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),Ak=Zs(Rk),Tk=p({},Ri,{newState:0,oldState:0}),Nk=Zs(Tk),Mk=[9,13,27,32],xf=Xn&&"CompositionEvent"in window,fl=null;Xn&&"documentMode"in document&&(fl=document.documentMode);var $k=Xn&&"TextEvent"in window&&!fl,S_=Xn&&(!xf||fl&&8<fl&&11>=fl),w_=" ",x_=!1;function C_(s,i){switch(s){case"keyup":return Mk.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function E_(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var Za=!1;function Dk(s,i){switch(s){case"compositionend":return E_(i);case"keypress":return i.which!==32?null:(x_=!0,w_);case"textInput":return s=i.data,s===w_&&x_?null:s;default:return null}}function Ok(s,i){if(Za)return s==="compositionend"||!xf&&C_(s,i)?(s=dl(),Zr=Xa=gi=null,Za=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1<i.char.length)return i.char;if(i.which)return String.fromCharCode(i.which)}return null;case"compositionend":return S_&&i.locale!=="ko"?null:i.data;default:return null}}var Lk={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 k_(s){var i=s&&s.nodeName&&s.nodeName.toLowerCase();return i==="input"?!!Lk[s.type]:i==="textarea"}function j_(s,i,a,f){gr?Pi?Pi.push(f):Pi=[f]:gr=f,i=Mu(i,"onChange"),0<i.length&&(a=new ta("onChange","change",null,a,f),s.push({event:a,listeners:i}))}var pl=null,ml=null;function Ik(s){cb(s,0)}function qc(s){var i=he(s);if(st(i))return s}function R_(s,i){if(s==="change")return i}var A_=!1;if(Xn){var Cf;if(Xn){var Ef="oninput"in document;if(!Ef){var T_=document.createElement("div");T_.setAttribute("oninput","return;"),Ef=typeof T_.oninput=="function"}Cf=Ef}else Cf=!1;A_=Cf&&(!document.documentMode||9<document.documentMode)}function N_(){pl&&(pl.detachEvent("onpropertychange",M_),ml=pl=null)}function M_(s){if(s.propertyName==="value"&&qc(ml)){var i=[];j_(i,ml,s,ll(s)),ul(Ik,i)}}function Pk(s,i,a){s==="focusin"?(N_(),pl=i,ml=a,pl.attachEvent("onpropertychange",M_)):s==="focusout"&&N_()}function Bk(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return qc(ml)}function zk(s,i){if(s==="click")return qc(i)}function Hk(s,i){if(s==="input"||s==="change")return qc(i)}function Uk(s,i){return s===i&&(s!==0||1/s===1/i)||s!==s&&i!==i}var Pn=typeof Object.is=="function"?Object.is:Uk;function gl(s,i){if(Pn(s,i))return!0;if(typeof s!="object"||s===null||typeof i!="object"||i===null)return!1;var a=Object.keys(s),f=Object.keys(i);if(a.length!==f.length)return!1;for(f=0;f<a.length;f++){var R=a[f];if(!Re.call(i,R)||!Pn(s[R],i[R]))return!1}return!0}function $_(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function D_(s,i){var a=$_(s);s=0;for(var f;a;){if(a.nodeType===3){if(f=s+a.textContent.length,s<=i&&f>=i)return{node:a,offset:i-s};s=f}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=$_(a)}}function O_(s,i){return s&&i?s===i?!0:s&&s.nodeType===3?!1:i&&i.nodeType===3?O_(s,i.parentNode):"contains"in s?s.contains(i):s.compareDocumentPosition?!!(s.compareDocumentPosition(i)&16):!1:!1}function L_(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var i=Rt(s.document);i instanceof s.HTMLIFrameElement;){try{var a=typeof i.contentWindow.location.href=="string"}catch{a=!1}if(a)s=i.contentWindow;else break;i=Rt(s.document)}return i}function kf(s){var i=s&&s.nodeName&&s.nodeName.toLowerCase();return i&&(i==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||i==="textarea"||s.contentEditable==="true")}var Fk=Xn&&"documentMode"in document&&11>=document.documentMode,Qa=null,jf=null,vl=null,Rf=!1;function I_(s,i,a){var f=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Rf||Qa==null||Qa!==Rt(f)||(f=Qa,"selectionStart"in f&&kf(f)?f={start:f.selectionStart,end:f.selectionEnd}:(f=(f.ownerDocument&&f.ownerDocument.defaultView||window).getSelection(),f={anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focusNode:f.focusNode,focusOffset:f.focusOffset}),vl&&gl(vl,f)||(vl=f,f=Mu(jf,"onSelect"),0<f.length&&(i=new ta("onSelect","select",null,i,a),s.push({event:i,listeners:f}),i.target=Qa)))}function sa(s,i){var a={};return a[s.toLowerCase()]=i.toLowerCase(),a["Webkit"+s]="webkit"+i,a["Moz"+s]="moz"+i,a}var eo={animationend:sa("Animation","AnimationEnd"),animationiteration:sa("Animation","AnimationIteration"),animationstart:sa("Animation","AnimationStart"),transitionrun:sa("Transition","TransitionRun"),transitionstart:sa("Transition","TransitionStart"),transitioncancel:sa("Transition","TransitionCancel"),transitionend:sa("Transition","TransitionEnd")},Af={},P_={};Xn&&(P_=document.createElement("div").style,"AnimationEvent"in window||(delete eo.animationend.animation,delete eo.animationiteration.animation,delete eo.animationstart.animation),"TransitionEvent"in window||delete eo.transitionend.transition);function na(s){if(Af[s])return Af[s];if(!eo[s])return s;var i=eo[s],a;for(a in i)if(i.hasOwnProperty(a)&&a in P_)return Af[s]=i[a];return s}var B_=na("animationend"),z_=na("animationiteration"),H_=na("animationstart"),qk=na("transitionrun"),Vk=na("transitionstart"),Gk=na("transitioncancel"),U_=na("transitionend"),F_=new Map,Tf="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(" ");Tf.push("scrollEnd");function vi(s,i){F_.set(s,i),at(i,[s])}var Vc=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var i=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof s=="object"&&s!==null&&typeof s.message=="string"?String(s.message):String(s),error:s});if(!window.dispatchEvent(i))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)},Jn=[],to=0,Nf=0;function Gc(){for(var s=to,i=Nf=to=0;i<s;){var a=Jn[i];Jn[i++]=null;var f=Jn[i];Jn[i++]=null;var R=Jn[i];Jn[i++]=null;var N=Jn[i];if(Jn[i++]=null,f!==null&&R!==null){var I=f.pending;I===null?R.next=R:(R.next=I.next,I.next=R),f.pending=R}N!==0&&q_(a,R,N)}}function Wc(s,i,a,f){Jn[to++]=s,Jn[to++]=i,Jn[to++]=a,Jn[to++]=f,Nf|=f,s.lanes|=f,s=s.alternate,s!==null&&(s.lanes|=f)}function Mf(s,i,a,f){return Wc(s,i,a,f),Kc(s)}function ia(s,i){return Wc(s,null,null,i),Kc(s)}function q_(s,i,a){s.lanes|=a;var f=s.alternate;f!==null&&(f.lanes|=a);for(var R=!1,N=s.return;N!==null;)N.childLanes|=a,f=N.alternate,f!==null&&(f.childLanes|=a),N.tag===22&&(s=N.stateNode,s===null||s._visibility&1||(R=!0)),s=N,N=N.return;return s.tag===3?(N=s.stateNode,R&&i!==null&&(R=31-pt(a),s=N.hiddenUpdates,f=s[R],f===null?s[R]=[i]:f.push(i),i.lane=a|536870912),N):null}function Kc(s){if(50<Bl)throw Bl=0,Hp=null,Error(r(185));for(var i=s.return;i!==null;)s=i,i=s.return;return s.tag===3?s.stateNode:null}var so={};function Wk(s,i,a,f){this.tag=s,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=i,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=f,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Bn(s,i,a,f){return new Wk(s,i,a,f)}function $f(s){return s=s.prototype,!(!s||!s.isReactComponent)}function Bi(s,i){var a=s.alternate;return a===null?(a=Bn(s.tag,i,s.key,s.mode),a.elementType=s.elementType,a.type=s.type,a.stateNode=s.stateNode,a.alternate=s,s.alternate=a):(a.pendingProps=i,a.type=s.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=s.flags&65011712,a.childLanes=s.childLanes,a.lanes=s.lanes,a.child=s.child,a.memoizedProps=s.memoizedProps,a.memoizedState=s.memoizedState,a.updateQueue=s.updateQueue,i=s.dependencies,a.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},a.sibling=s.sibling,a.index=s.index,a.ref=s.ref,a.refCleanup=s.refCleanup,a}function V_(s,i){s.flags&=65011714;var a=s.alternate;return a===null?(s.childLanes=0,s.lanes=i,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=a.childLanes,s.lanes=a.lanes,s.child=a.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=a.memoizedProps,s.memoizedState=a.memoizedState,s.updateQueue=a.updateQueue,s.type=a.type,i=a.dependencies,s.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),s}function Yc(s,i,a,f,R,N){var I=0;if(f=s,typeof s=="function")$f(s)&&(I=1);else if(typeof s=="string")I=Zj(s,a,P.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case M:return s=Bn(31,a,i,R),s.elementType=M,s.lanes=N,s;case E:return ra(a.children,R,N,i);case y:I=8,R|=24;break;case b:return s=Bn(12,a,i,R|2),s.elementType=b,s.lanes=N,s;case C:return s=Bn(13,a,i,R),s.elementType=C,s.lanes=N,s;case w:return s=Bn(19,a,i,R),s.elementType=w,s.lanes=N,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case _:I=10;break e;case v:I=9;break e;case k:I=11;break e;case T:I=14;break e;case j:I=16,f=null;break e}I=29,a=Error(r(130,s===null?"null":typeof s,"")),f=null}return i=Bn(I,a,i,R),i.elementType=s,i.type=f,i.lanes=N,i}function ra(s,i,a,f){return s=Bn(7,s,f,i),s.lanes=a,s}function Df(s,i,a){return s=Bn(6,s,null,i),s.lanes=a,s}function G_(s){var i=Bn(18,null,null,0);return i.stateNode=s,i}function Of(s,i,a){return i=Bn(4,s.children!==null?s.children:[],s.key,i),i.lanes=a,i.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},i}var W_=new WeakMap;function Zn(s,i){if(typeof s=="object"&&s!==null){var a=W_.get(s);return a!==void 0?a:(i={value:s,source:i,stack:qe(i)},W_.set(s,i),i)}return{value:s,source:i,stack:qe(i)}}var no=[],io=0,Xc=null,_l=0,Qn=[],ei=0,Sr=null,Ai=1,Ti="";function zi(s,i){no[io++]=_l,no[io++]=Xc,Xc=s,_l=i}function K_(s,i,a){Qn[ei++]=Ai,Qn[ei++]=Ti,Qn[ei++]=Sr,Sr=s;var f=Ai;s=Ti;var R=32-pt(f)-1;f&=~(1<<R),a+=1;var N=32-pt(i)+R;if(30<N){var I=R-R%5;N=(f&(1<<I)-1).toString(32),f>>=I,R-=I,Ai=1<<32-pt(i)+R|a<<R|f,Ti=N+s}else Ai=1<<N|a<<R|f,Ti=s}function Lf(s){s.return!==null&&(zi(s,1),K_(s,1,0))}function If(s){for(;s===Xc;)Xc=no[--io],no[io]=null,_l=no[--io],no[io]=null;for(;s===Sr;)Sr=Qn[--ei],Qn[ei]=null,Ti=Qn[--ei],Qn[ei]=null,Ai=Qn[--ei],Qn[ei]=null}function Y_(s,i){Qn[ei++]=Ai,Qn[ei++]=Ti,Qn[ei++]=Sr,Ai=i.id,Ti=i.overflow,Sr=s}var Qs=null,hs=null,It=!1,wr=null,ti=!1,Pf=Error(r(519));function xr(s){var i=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw yl(Zn(i,s)),Pf}function X_(s){var i=s.stateNode,a=s.type,f=s.memoizedProps;switch(i[Et]=s,i[Yt]=f,a){case"dialog":Tt("cancel",i),Tt("close",i);break;case"iframe":case"object":case"embed":Tt("load",i);break;case"video":case"audio":for(a=0;a<Hl.length;a++)Tt(Hl[a],i);break;case"source":Tt("error",i);break;case"img":case"image":case"link":Tt("error",i),Tt("load",i);break;case"details":Tt("toggle",i);break;case"input":Tt("invalid",i),Fa(i,f.value,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name,!0);break;case"select":Tt("invalid",i);break;case"textarea":Tt("invalid",i),Hc(i,f.value,f.defaultValue,f.children)}a=f.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||i.textContent===""+a||f.suppressHydrationWarning===!0||fb(i.textContent,a)?(f.popover!=null&&(Tt("beforetoggle",i),Tt("toggle",i)),f.onScroll!=null&&Tt("scroll",i),f.onScrollEnd!=null&&Tt("scrollend",i),f.onClick!=null&&(i.onclick=Tn),i=!0):i=!1,i||xr(s,!0)}function J_(s){for(Qs=s.return;Qs;)switch(Qs.tag){case 5:case 31:case 13:ti=!1;return;case 27:case 3:ti=!0;return;default:Qs=Qs.return}}function ro(s){if(s!==Qs)return!1;if(!It)return J_(s),It=!0,!1;var i=s.tag,a;if((a=i!==3&&i!==27)&&((a=i===5)&&(a=s.type,a=!(a!=="form"&&a!=="button")||sm(s.type,s.memoizedProps)),a=!a),a&&hs&&xr(s),J_(s),i===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(317));hs=wb(s)}else if(i===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(317));hs=wb(s)}else i===27?(i=hs,Ir(s.type)?(s=om,om=null,hs=s):hs=i):hs=Qs?ni(s.stateNode.nextSibling):null;return!0}function aa(){hs=Qs=null,It=!1}function Bf(){var s=wr;return s!==null&&(Dn===null?Dn=s:Dn.push.apply(Dn,s),wr=null),s}function yl(s){wr===null?wr=[s]:wr.push(s)}var zf=$(null),oa=null,Hi=null;function Cr(s,i,a){U(zf,i._currentValue),i._currentValue=a}function Ui(s){s._currentValue=zf.current,H(zf)}function Hf(s,i,a){for(;s!==null;){var f=s.alternate;if((s.childLanes&i)!==i?(s.childLanes|=i,f!==null&&(f.childLanes|=i)):f!==null&&(f.childLanes&i)!==i&&(f.childLanes|=i),s===a)break;s=s.return}}function Uf(s,i,a,f){var R=s.child;for(R!==null&&(R.return=s);R!==null;){var N=R.dependencies;if(N!==null){var I=R.child;N=N.firstContext;e:for(;N!==null;){var K=N;N=R;for(var ie=0;ie<i.length;ie++)if(K.context===i[ie]){N.lanes|=a,K=N.alternate,K!==null&&(K.lanes|=a),Hf(N.return,a,s),f||(I=null);break e}N=K.next}}else if(R.tag===18){if(I=R.return,I===null)throw Error(r(341));I.lanes|=a,N=I.alternate,N!==null&&(N.lanes|=a),Hf(I,a,s),I=null}else I=R.child;if(I!==null)I.return=R;else for(I=R;I!==null;){if(I===s){I=null;break}if(R=I.sibling,R!==null){R.return=I.return,I=R;break}I=I.return}R=I}}function ao(s,i,a,f){s=null;for(var R=i,N=!1;R!==null;){if(!N){if((R.flags&524288)!==0)N=!0;else if((R.flags&262144)!==0)break}if(R.tag===10){var I=R.alternate;if(I===null)throw Error(r(387));if(I=I.memoizedProps,I!==null){var K=R.type;Pn(R.pendingProps.value,I.value)||(s!==null?s.push(K):s=[K])}}else if(R===X.current){if(I=R.alternate,I===null)throw Error(r(387));I.memoizedState.memoizedState!==R.memoizedState.memoizedState&&(s!==null?s.push(Gl):s=[Gl])}R=R.return}s!==null&&Uf(i,s,a,f),i.flags|=262144}function Jc(s){for(s=s.firstContext;s!==null;){if(!Pn(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function la(s){oa=s,Hi=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function en(s){return Z_(oa,s)}function Zc(s,i){return oa===null&&la(s),Z_(s,i)}function Z_(s,i){var a=i._currentValue;if(i={context:i,memoizedValue:a,next:null},Hi===null){if(s===null)throw Error(r(308));Hi=i,s.dependencies={lanes:0,firstContext:i},s.flags|=524288}else Hi=Hi.next=i;return a}var Kk=typeof AbortController<"u"?AbortController:function(){var s=[],i=this.signal={aborted:!1,addEventListener:function(a,f){s.push(f)}};this.abort=function(){i.aborted=!0,s.forEach(function(a){return a()})}},Yk=e.unstable_scheduleCallback,Xk=e.unstable_NormalPriority,Is={$$typeof:_,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ff(){return{controller:new Kk,data:new Map,refCount:0}}function bl(s){s.refCount--,s.refCount===0&&Yk(Xk,function(){s.controller.abort()})}var Sl=null,qf=0,oo=0,lo=null;function Jk(s,i){if(Sl===null){var a=Sl=[];qf=0,oo=Wp(),lo={status:"pending",value:void 0,then:function(f){a.push(f)}}}return qf++,i.then(Q_,Q_),i}function Q_(){if(--qf===0&&Sl!==null){lo!==null&&(lo.status="fulfilled");var s=Sl;Sl=null,oo=0,lo=null;for(var i=0;i<s.length;i++)(0,s[i])()}}function Zk(s,i){var a=[],f={status:"pending",value:null,reason:null,then:function(R){a.push(R)}};return s.then(function(){f.status="fulfilled",f.value=i;for(var R=0;R<a.length;R++)(0,a[R])(i)},function(R){for(f.status="rejected",f.reason=R,R=0;R<a.length;R++)(0,a[R])(void 0)}),f}var ey=G.S;G.S=function(s,i){I0=Ct(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&Jk(s,i),ey!==null&&ey(s,i)};var ca=$(null);function Vf(){var s=ca.current;return s!==null?s:ns.pooledCache}function Qc(s,i){i===null?U(ca,ca.current):U(ca,i.pool)}function ty(){var s=Vf();return s===null?null:{parent:Is._currentValue,pool:s}}var co=Error(r(460)),Gf=Error(r(474)),eu=Error(r(542)),tu={then:function(){}};function sy(s){return s=s.status,s==="fulfilled"||s==="rejected"}function ny(s,i,a){switch(a=s[a],a===void 0?s.push(i):a!==i&&(i.then(Tn,Tn),i=a),i.status){case"fulfilled":return i.value;case"rejected":throw s=i.reason,ry(s),s;default:if(typeof i.status=="string")i.then(Tn,Tn);else{if(s=ns,s!==null&&100<s.shellSuspendCounter)throw Error(r(482));s=i,s.status="pending",s.then(function(f){if(i.status==="pending"){var R=i;R.status="fulfilled",R.value=f}},function(f){if(i.status==="pending"){var R=i;R.status="rejected",R.reason=f}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw s=i.reason,ry(s),s}throw da=i,co}}function ua(s){try{var i=s._init;return i(s._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(da=a,co):a}}var da=null;function iy(){if(da===null)throw Error(r(459));var s=da;return da=null,s}function ry(s){if(s===co||s===eu)throw Error(r(483))}var uo=null,wl=0;function su(s){var i=wl;return wl+=1,uo===null&&(uo=[]),ny(uo,s,i)}function xl(s,i){i=i.props.ref,s.ref=i!==void 0?i:null}function nu(s,i){throw i.$$typeof===S?Error(r(525)):(s=Object.prototype.toString.call(i),Error(r(31,s==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":s)))}function ay(s){function i(fe,ae){if(s){var me=fe.deletions;me===null?(fe.deletions=[ae],fe.flags|=16):me.push(ae)}}function a(fe,ae){if(!s)return null;for(;ae!==null;)i(fe,ae),ae=ae.sibling;return null}function f(fe){for(var ae=new Map;fe!==null;)fe.key!==null?ae.set(fe.key,fe):ae.set(fe.index,fe),fe=fe.sibling;return ae}function R(fe,ae){return fe=Bi(fe,ae),fe.index=0,fe.sibling=null,fe}function N(fe,ae,me){return fe.index=me,s?(me=fe.alternate,me!==null?(me=me.index,me<ae?(fe.flags|=67108866,ae):me):(fe.flags|=67108866,ae)):(fe.flags|=1048576,ae)}function I(fe){return s&&fe.alternate===null&&(fe.flags|=67108866),fe}function K(fe,ae,me,je){return ae===null||ae.tag!==6?(ae=Df(me,fe.mode,je),ae.return=fe,ae):(ae=R(ae,me),ae.return=fe,ae)}function ie(fe,ae,me,je){var tt=me.type;return tt===E?Ee(fe,ae,me.props.children,je,me.key):ae!==null&&(ae.elementType===tt||typeof tt=="object"&&tt!==null&&tt.$$typeof===j&&ua(tt)===ae.type)?(ae=R(ae,me.props),xl(ae,me),ae.return=fe,ae):(ae=Yc(me.type,me.key,me.props,null,fe.mode,je),xl(ae,me),ae.return=fe,ae)}function ge(fe,ae,me,je){return ae===null||ae.tag!==4||ae.stateNode.containerInfo!==me.containerInfo||ae.stateNode.implementation!==me.implementation?(ae=Of(me,fe.mode,je),ae.return=fe,ae):(ae=R(ae,me.children||[]),ae.return=fe,ae)}function Ee(fe,ae,me,je,tt){return ae===null||ae.tag!==7?(ae=ra(me,fe.mode,je,tt),ae.return=fe,ae):(ae=R(ae,me),ae.return=fe,ae)}function Ae(fe,ae,me){if(typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint")return ae=Df(""+ae,fe.mode,me),ae.return=fe,ae;if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case x:return me=Yc(ae.type,ae.key,ae.props,null,fe.mode,me),xl(me,ae),me.return=fe,me;case A:return ae=Of(ae,fe.mode,me),ae.return=fe,ae;case j:return ae=ua(ae),Ae(fe,ae,me)}if(Q(ae)||q(ae))return ae=ra(ae,fe.mode,me,null),ae.return=fe,ae;if(typeof ae.then=="function")return Ae(fe,su(ae),me);if(ae.$$typeof===_)return Ae(fe,Zc(fe,ae),me);nu(fe,ae)}return null}function ve(fe,ae,me,je){var tt=ae!==null?ae.key:null;if(typeof me=="string"&&me!==""||typeof me=="number"||typeof me=="bigint")return tt!==null?null:K(fe,ae,""+me,je);if(typeof me=="object"&&me!==null){switch(me.$$typeof){case x:return me.key===tt?ie(fe,ae,me,je):null;case A:return me.key===tt?ge(fe,ae,me,je):null;case j:return me=ua(me),ve(fe,ae,me,je)}if(Q(me)||q(me))return tt!==null?null:Ee(fe,ae,me,je,null);if(typeof me.then=="function")return ve(fe,ae,su(me),je);if(me.$$typeof===_)return ve(fe,ae,Zc(fe,me),je);nu(fe,me)}return null}function we(fe,ae,me,je,tt){if(typeof je=="string"&&je!==""||typeof je=="number"||typeof je=="bigint")return fe=fe.get(me)||null,K(ae,fe,""+je,tt);if(typeof je=="object"&&je!==null){switch(je.$$typeof){case x:return fe=fe.get(je.key===null?me:je.key)||null,ie(ae,fe,je,tt);case A:return fe=fe.get(je.key===null?me:je.key)||null,ge(ae,fe,je,tt);case j:return je=ua(je),we(fe,ae,me,je,tt)}if(Q(je)||q(je))return fe=fe.get(me)||null,Ee(ae,fe,je,tt,null);if(typeof je.then=="function")return we(fe,ae,me,su(je),tt);if(je.$$typeof===_)return we(fe,ae,me,Zc(ae,je),tt);nu(ae,je)}return null}function Ve(fe,ae,me,je){for(var tt=null,zt=null,We=ae,bt=ae=0,Dt=null;We!==null&&bt<me.length;bt++){We.index>bt?(Dt=We,We=null):Dt=We.sibling;var Ht=ve(fe,We,me[bt],je);if(Ht===null){We===null&&(We=Dt);break}s&&We&&Ht.alternate===null&&i(fe,We),ae=N(Ht,ae,bt),zt===null?tt=Ht:zt.sibling=Ht,zt=Ht,We=Dt}if(bt===me.length)return a(fe,We),It&&zi(fe,bt),tt;if(We===null){for(;bt<me.length;bt++)We=Ae(fe,me[bt],je),We!==null&&(ae=N(We,ae,bt),zt===null?tt=We:zt.sibling=We,zt=We);return It&&zi(fe,bt),tt}for(We=f(We);bt<me.length;bt++)Dt=we(We,fe,bt,me[bt],je),Dt!==null&&(s&&Dt.alternate!==null&&We.delete(Dt.key===null?bt:Dt.key),ae=N(Dt,ae,bt),zt===null?tt=Dt:zt.sibling=Dt,zt=Dt);return s&&We.forEach(function(Ur){return i(fe,Ur)}),It&&zi(fe,bt),tt}function it(fe,ae,me,je){if(me==null)throw Error(r(151));for(var tt=null,zt=null,We=ae,bt=ae=0,Dt=null,Ht=me.next();We!==null&&!Ht.done;bt++,Ht=me.next()){We.index>bt?(Dt=We,We=null):Dt=We.sibling;var Ur=ve(fe,We,Ht.value,je);if(Ur===null){We===null&&(We=Dt);break}s&&We&&Ur.alternate===null&&i(fe,We),ae=N(Ur,ae,bt),zt===null?tt=Ur:zt.sibling=Ur,zt=Ur,We=Dt}if(Ht.done)return a(fe,We),It&&zi(fe,bt),tt;if(We===null){for(;!Ht.done;bt++,Ht=me.next())Ht=Ae(fe,Ht.value,je),Ht!==null&&(ae=N(Ht,ae,bt),zt===null?tt=Ht:zt.sibling=Ht,zt=Ht);return It&&zi(fe,bt),tt}for(We=f(We);!Ht.done;bt++,Ht=me.next())Ht=we(We,fe,bt,Ht.value,je),Ht!==null&&(s&&Ht.alternate!==null&&We.delete(Ht.key===null?bt:Ht.key),ae=N(Ht,ae,bt),zt===null?tt=Ht:zt.sibling=Ht,zt=Ht);return s&&We.forEach(function(cR){return i(fe,cR)}),It&&zi(fe,bt),tt}function Qt(fe,ae,me,je){if(typeof me=="object"&&me!==null&&me.type===E&&me.key===null&&(me=me.props.children),typeof me=="object"&&me!==null){switch(me.$$typeof){case x:e:{for(var tt=me.key;ae!==null;){if(ae.key===tt){if(tt=me.type,tt===E){if(ae.tag===7){a(fe,ae.sibling),je=R(ae,me.props.children),je.return=fe,fe=je;break e}}else if(ae.elementType===tt||typeof tt=="object"&&tt!==null&&tt.$$typeof===j&&ua(tt)===ae.type){a(fe,ae.sibling),je=R(ae,me.props),xl(je,me),je.return=fe,fe=je;break e}a(fe,ae);break}else i(fe,ae);ae=ae.sibling}me.type===E?(je=ra(me.props.children,fe.mode,je,me.key),je.return=fe,fe=je):(je=Yc(me.type,me.key,me.props,null,fe.mode,je),xl(je,me),je.return=fe,fe=je)}return I(fe);case A:e:{for(tt=me.key;ae!==null;){if(ae.key===tt)if(ae.tag===4&&ae.stateNode.containerInfo===me.containerInfo&&ae.stateNode.implementation===me.implementation){a(fe,ae.sibling),je=R(ae,me.children||[]),je.return=fe,fe=je;break e}else{a(fe,ae);break}else i(fe,ae);ae=ae.sibling}je=Of(me,fe.mode,je),je.return=fe,fe=je}return I(fe);case j:return me=ua(me),Qt(fe,ae,me,je)}if(Q(me))return Ve(fe,ae,me,je);if(q(me)){if(tt=q(me),typeof tt!="function")throw Error(r(150));return me=tt.call(me),it(fe,ae,me,je)}if(typeof me.then=="function")return Qt(fe,ae,su(me),je);if(me.$$typeof===_)return Qt(fe,ae,Zc(fe,me),je);nu(fe,me)}return typeof me=="string"&&me!==""||typeof me=="number"||typeof me=="bigint"?(me=""+me,ae!==null&&ae.tag===6?(a(fe,ae.sibling),je=R(ae,me),je.return=fe,fe=je):(a(fe,ae),je=Df(me,fe.mode,je),je.return=fe,fe=je),I(fe)):a(fe,ae)}return function(fe,ae,me,je){try{wl=0;var tt=Qt(fe,ae,me,je);return uo=null,tt}catch(We){if(We===co||We===eu)throw We;var zt=Bn(29,We,null,fe.mode);return zt.lanes=je,zt.return=fe,zt}finally{}}}var ha=ay(!0),oy=ay(!1),Er=!1;function Wf(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Kf(s,i){s=s.updateQueue,i.updateQueue===s&&(i.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function kr(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function jr(s,i,a){var f=s.updateQueue;if(f===null)return null;if(f=f.shared,(Ut&2)!==0){var R=f.pending;return R===null?i.next=i:(i.next=R.next,R.next=i),f.pending=i,i=Kc(s),q_(s,null,a),i}return Wc(s,f,i,a),Kc(s)}function Cl(s,i,a){if(i=i.updateQueue,i!==null&&(i=i.shared,(a&4194048)!==0)){var f=i.lanes;f&=s.pendingLanes,a|=f,i.lanes=a,un(s,a)}}function Yf(s,i){var a=s.updateQueue,f=s.alternate;if(f!==null&&(f=f.updateQueue,a===f)){var R=null,N=null;if(a=a.firstBaseUpdate,a!==null){do{var I={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};N===null?R=N=I:N=N.next=I,a=a.next}while(a!==null);N===null?R=N=i:N=N.next=i}else R=N=i;a={baseState:f.baseState,firstBaseUpdate:R,lastBaseUpdate:N,shared:f.shared,callbacks:f.callbacks},s.updateQueue=a;return}s=a.lastBaseUpdate,s===null?a.firstBaseUpdate=i:s.next=i,a.lastBaseUpdate=i}var Xf=!1;function El(){if(Xf){var s=lo;if(s!==null)throw s}}function kl(s,i,a,f){Xf=!1;var R=s.updateQueue;Er=!1;var N=R.firstBaseUpdate,I=R.lastBaseUpdate,K=R.shared.pending;if(K!==null){R.shared.pending=null;var ie=K,ge=ie.next;ie.next=null,I===null?N=ge:I.next=ge,I=ie;var Ee=s.alternate;Ee!==null&&(Ee=Ee.updateQueue,K=Ee.lastBaseUpdate,K!==I&&(K===null?Ee.firstBaseUpdate=ge:K.next=ge,Ee.lastBaseUpdate=ie))}if(N!==null){var Ae=R.baseState;I=0,Ee=ge=ie=null,K=N;do{var ve=K.lane&-536870913,we=ve!==K.lane;if(we?($t&ve)===ve:(f&ve)===ve){ve!==0&&ve===oo&&(Xf=!0),Ee!==null&&(Ee=Ee.next={lane:0,tag:K.tag,payload:K.payload,callback:null,next:null});e:{var Ve=s,it=K;ve=i;var Qt=a;switch(it.tag){case 1:if(Ve=it.payload,typeof Ve=="function"){Ae=Ve.call(Qt,Ae,ve);break e}Ae=Ve;break e;case 3:Ve.flags=Ve.flags&-65537|128;case 0:if(Ve=it.payload,ve=typeof Ve=="function"?Ve.call(Qt,Ae,ve):Ve,ve==null)break e;Ae=p({},Ae,ve);break e;case 2:Er=!0}}ve=K.callback,ve!==null&&(s.flags|=64,we&&(s.flags|=8192),we=R.callbacks,we===null?R.callbacks=[ve]:we.push(ve))}else we={lane:ve,tag:K.tag,payload:K.payload,callback:K.callback,next:null},Ee===null?(ge=Ee=we,ie=Ae):Ee=Ee.next=we,I|=ve;if(K=K.next,K===null){if(K=R.shared.pending,K===null)break;we=K,K=we.next,we.next=null,R.lastBaseUpdate=we,R.shared.pending=null}}while(!0);Ee===null&&(ie=Ae),R.baseState=ie,R.firstBaseUpdate=ge,R.lastBaseUpdate=Ee,N===null&&(R.shared.lanes=0),Mr|=I,s.lanes=I,s.memoizedState=Ae}}function ly(s,i){if(typeof s!="function")throw Error(r(191,s));s.call(i)}function cy(s,i){var a=s.callbacks;if(a!==null)for(s.callbacks=null,s=0;s<a.length;s++)ly(a[s],i)}var ho=$(null),iu=$(0);function uy(s,i){s=Ji,U(iu,s),U(ho,i),Ji=s|i.baseLanes}function Jf(){U(iu,Ji),U(ho,ho.current)}function Zf(){Ji=iu.current,H(ho),H(iu)}var zn=$(null),si=null;function Rr(s){var i=s.alternate;U(Ns,Ns.current&1),U(zn,s),si===null&&(i===null||ho.current!==null||i.memoizedState!==null)&&(si=s)}function Qf(s){U(Ns,Ns.current),U(zn,s),si===null&&(si=s)}function dy(s){s.tag===22?(U(Ns,Ns.current),U(zn,s),si===null&&(si=s)):Ar()}function Ar(){U(Ns,Ns.current),U(zn,zn.current)}function Hn(s){H(zn),si===s&&(si=null),H(Ns)}var Ns=$(0);function ru(s){for(var i=s;i!==null;){if(i.tag===13){var a=i.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||rm(a)||am(a)))return i}else if(i.tag===19&&(i.memoizedProps.revealOrder==="forwards"||i.memoizedProps.revealOrder==="backwards"||i.memoizedProps.revealOrder==="unstable_legacy-backwards"||i.memoizedProps.revealOrder==="together")){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===s)break;for(;i.sibling===null;){if(i.return===null||i.return===s)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var Fi=0,yt=null,Jt=null,Ps=null,au=!1,fo=!1,fa=!1,ou=0,jl=0,po=null,Qk=0;function Es(){throw Error(r(321))}function ep(s,i){if(i===null)return!1;for(var a=0;a<i.length&&a<s.length;a++)if(!Pn(s[a],i[a]))return!1;return!0}function tp(s,i,a,f,R,N){return Fi=N,yt=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,G.H=s===null||s.memoizedState===null?Ky:gp,fa=!1,N=a(f,R),fa=!1,fo&&(N=fy(i,a,f,R)),hy(s),N}function hy(s){G.H=Tl;var i=Jt!==null&&Jt.next!==null;if(Fi=0,Ps=Jt=yt=null,au=!1,jl=0,po=null,i)throw Error(r(300));s===null||Bs||(s=s.dependencies,s!==null&&Jc(s)&&(Bs=!0))}function fy(s,i,a,f){yt=s;var R=0;do{if(fo&&(po=null),jl=0,fo=!1,25<=R)throw Error(r(301));if(R+=1,Ps=Jt=null,s.updateQueue!=null){var N=s.updateQueue;N.lastEffect=null,N.events=null,N.stores=null,N.memoCache!=null&&(N.memoCache.index=0)}G.H=Yy,N=i(a,f)}while(fo);return N}function ej(){var s=G.H,i=s.useState()[0];return i=typeof i.then=="function"?Rl(i):i,s=s.useState()[0],(Jt!==null?Jt.memoizedState:null)!==s&&(yt.flags|=1024),i}function sp(){var s=ou!==0;return ou=0,s}function np(s,i,a){i.updateQueue=s.updateQueue,i.flags&=-2053,s.lanes&=~a}function ip(s){if(au){for(s=s.memoizedState;s!==null;){var i=s.queue;i!==null&&(i.pending=null),s=s.next}au=!1}Fi=0,Ps=Jt=yt=null,fo=!1,jl=ou=0,po=null}function wn(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ps===null?yt.memoizedState=Ps=s:Ps=Ps.next=s,Ps}function Ms(){if(Jt===null){var s=yt.alternate;s=s!==null?s.memoizedState:null}else s=Jt.next;var i=Ps===null?yt.memoizedState:Ps.next;if(i!==null)Ps=i,Jt=s;else{if(s===null)throw yt.alternate===null?Error(r(467)):Error(r(310));Jt=s,s={memoizedState:Jt.memoizedState,baseState:Jt.baseState,baseQueue:Jt.baseQueue,queue:Jt.queue,next:null},Ps===null?yt.memoizedState=Ps=s:Ps=Ps.next=s}return Ps}function lu(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Rl(s){var i=jl;return jl+=1,po===null&&(po=[]),s=ny(po,s,i),i=yt,(Ps===null?i.memoizedState:Ps.next)===null&&(i=i.alternate,G.H=i===null||i.memoizedState===null?Ky:gp),s}function cu(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return Rl(s);if(s.$$typeof===_)return en(s)}throw Error(r(438,String(s)))}function rp(s){var i=null,a=yt.updateQueue;if(a!==null&&(i=a.memoCache),i==null){var f=yt.alternate;f!==null&&(f=f.updateQueue,f!==null&&(f=f.memoCache,f!=null&&(i={data:f.data.map(function(R){return R.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),a===null&&(a=lu(),yt.updateQueue=a),a.memoCache=i,a=i.data[i.index],a===void 0)for(a=i.data[i.index]=Array(s),f=0;f<s;f++)a[f]=D;return i.index++,a}function qi(s,i){return typeof i=="function"?i(s):i}function uu(s){var i=Ms();return ap(i,Jt,s)}function ap(s,i,a){var f=s.queue;if(f===null)throw Error(r(311));f.lastRenderedReducer=a;var R=s.baseQueue,N=f.pending;if(N!==null){if(R!==null){var I=R.next;R.next=N.next,N.next=I}i.baseQueue=R=N,f.pending=null}if(N=s.baseState,R===null)s.memoizedState=N;else{i=R.next;var K=I=null,ie=null,ge=i,Ee=!1;do{var Ae=ge.lane&-536870913;if(Ae!==ge.lane?($t&Ae)===Ae:(Fi&Ae)===Ae){var ve=ge.revertLane;if(ve===0)ie!==null&&(ie=ie.next={lane:0,revertLane:0,gesture:null,action:ge.action,hasEagerState:ge.hasEagerState,eagerState:ge.eagerState,next:null}),Ae===oo&&(Ee=!0);else if((Fi&ve)===ve){ge=ge.next,ve===oo&&(Ee=!0);continue}else Ae={lane:0,revertLane:ge.revertLane,gesture:null,action:ge.action,hasEagerState:ge.hasEagerState,eagerState:ge.eagerState,next:null},ie===null?(K=ie=Ae,I=N):ie=ie.next=Ae,yt.lanes|=ve,Mr|=ve;Ae=ge.action,fa&&a(N,Ae),N=ge.hasEagerState?ge.eagerState:a(N,Ae)}else ve={lane:Ae,revertLane:ge.revertLane,gesture:ge.gesture,action:ge.action,hasEagerState:ge.hasEagerState,eagerState:ge.eagerState,next:null},ie===null?(K=ie=ve,I=N):ie=ie.next=ve,yt.lanes|=Ae,Mr|=Ae;ge=ge.next}while(ge!==null&&ge!==i);if(ie===null?I=N:ie.next=K,!Pn(N,s.memoizedState)&&(Bs=!0,Ee&&(a=lo,a!==null)))throw a;s.memoizedState=N,s.baseState=I,s.baseQueue=ie,f.lastRenderedState=N}return R===null&&(f.lanes=0),[s.memoizedState,f.dispatch]}function op(s){var i=Ms(),a=i.queue;if(a===null)throw Error(r(311));a.lastRenderedReducer=s;var f=a.dispatch,R=a.pending,N=i.memoizedState;if(R!==null){a.pending=null;var I=R=R.next;do N=s(N,I.action),I=I.next;while(I!==R);Pn(N,i.memoizedState)||(Bs=!0),i.memoizedState=N,i.baseQueue===null&&(i.baseState=N),a.lastRenderedState=N}return[N,f]}function py(s,i,a){var f=yt,R=Ms(),N=It;if(N){if(a===void 0)throw Error(r(407));a=a()}else a=i();var I=!Pn((Jt||R).memoizedState,a);if(I&&(R.memoizedState=a,Bs=!0),R=R.queue,up(vy.bind(null,f,R,s),[s]),R.getSnapshot!==i||I||Ps!==null&&Ps.memoizedState.tag&1){if(f.flags|=2048,mo(9,{destroy:void 0},gy.bind(null,f,R,a,i),null),ns===null)throw Error(r(349));N||(Fi&127)!==0||my(f,i,a)}return a}function my(s,i,a){s.flags|=16384,s={getSnapshot:i,value:a},i=yt.updateQueue,i===null?(i=lu(),yt.updateQueue=i,i.stores=[s]):(a=i.stores,a===null?i.stores=[s]:a.push(s))}function gy(s,i,a,f){i.value=a,i.getSnapshot=f,_y(i)&&yy(s)}function vy(s,i,a){return a(function(){_y(i)&&yy(s)})}function _y(s){var i=s.getSnapshot;s=s.value;try{var a=i();return!Pn(s,a)}catch{return!0}}function yy(s){var i=ia(s,2);i!==null&&On(i,s,2)}function lp(s){var i=wn();if(typeof s=="function"){var a=s;if(s=a(),fa){Kt(!0);try{a()}finally{Kt(!1)}}}return i.memoizedState=i.baseState=s,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:qi,lastRenderedState:s},i}function by(s,i,a,f){return s.baseState=a,ap(s,Jt,typeof f=="function"?f:qi)}function tj(s,i,a,f,R){if(fu(s))throw Error(r(485));if(s=i.action,s!==null){var N={payload:R,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(I){N.listeners.push(I)}};G.T!==null?a(!0):N.isTransition=!1,f(N),a=i.pending,a===null?(N.next=i.pending=N,Sy(i,N)):(N.next=a.next,i.pending=a.next=N)}}function Sy(s,i){var a=i.action,f=i.payload,R=s.state;if(i.isTransition){var N=G.T,I={};G.T=I;try{var K=a(R,f),ie=G.S;ie!==null&&ie(I,K),wy(s,i,K)}catch(ge){cp(s,i,ge)}finally{N!==null&&I.types!==null&&(N.types=I.types),G.T=N}}else try{N=a(R,f),wy(s,i,N)}catch(ge){cp(s,i,ge)}}function wy(s,i,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(f){xy(s,i,f)},function(f){return cp(s,i,f)}):xy(s,i,a)}function xy(s,i,a){i.status="fulfilled",i.value=a,Cy(i),s.state=a,i=s.pending,i!==null&&(a=i.next,a===i?s.pending=null:(a=a.next,i.next=a,Sy(s,a)))}function cp(s,i,a){var f=s.pending;if(s.pending=null,f!==null){f=f.next;do i.status="rejected",i.reason=a,Cy(i),i=i.next;while(i!==f)}s.action=null}function Cy(s){s=s.listeners;for(var i=0;i<s.length;i++)(0,s[i])()}function Ey(s,i){return i}function ky(s,i){if(It){var a=ns.formState;if(a!==null){e:{var f=yt;if(It){if(hs){t:{for(var R=hs,N=ti;R.nodeType!==8;){if(!N){R=null;break t}if(R=ni(R.nextSibling),R===null){R=null;break t}}N=R.data,R=N==="F!"||N==="F"?R:null}if(R){hs=ni(R.nextSibling),f=R.data==="F!";break e}}xr(f)}f=!1}f&&(i=a[0])}}return a=wn(),a.memoizedState=a.baseState=i,f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ey,lastRenderedState:i},a.queue=f,a=Vy.bind(null,yt,f),f.dispatch=a,f=lp(!1),N=mp.bind(null,yt,!1,f.queue),f=wn(),R={state:i,dispatch:null,action:s,pending:null},f.queue=R,a=tj.bind(null,yt,R,N,a),R.dispatch=a,f.memoizedState=s,[i,a,!1]}function jy(s){var i=Ms();return Ry(i,Jt,s)}function Ry(s,i,a){if(i=ap(s,i,Ey)[0],s=uu(qi)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var f=Rl(i)}catch(I){throw I===co?eu:I}else f=i;i=Ms();var R=i.queue,N=R.dispatch;return a!==i.memoizedState&&(yt.flags|=2048,mo(9,{destroy:void 0},sj.bind(null,R,a),null)),[f,N,s]}function sj(s,i){s.action=i}function Ay(s){var i=Ms(),a=Jt;if(a!==null)return Ry(i,a,s);Ms(),i=i.memoizedState,a=Ms();var f=a.queue.dispatch;return a.memoizedState=s,[i,f,!1]}function mo(s,i,a,f){return s={tag:s,create:a,deps:f,inst:i,next:null},i=yt.updateQueue,i===null&&(i=lu(),yt.updateQueue=i),a=i.lastEffect,a===null?i.lastEffect=s.next=s:(f=a.next,a.next=s,s.next=f,i.lastEffect=s),s}function Ty(){return Ms().memoizedState}function du(s,i,a,f){var R=wn();yt.flags|=s,R.memoizedState=mo(1|i,{destroy:void 0},a,f===void 0?null:f)}function hu(s,i,a,f){var R=Ms();f=f===void 0?null:f;var N=R.memoizedState.inst;Jt!==null&&f!==null&&ep(f,Jt.memoizedState.deps)?R.memoizedState=mo(i,N,a,f):(yt.flags|=s,R.memoizedState=mo(1|i,N,a,f))}function Ny(s,i){du(8390656,8,s,i)}function up(s,i){hu(2048,8,s,i)}function nj(s){yt.flags|=4;var i=yt.updateQueue;if(i===null)i=lu(),yt.updateQueue=i,i.events=[s];else{var a=i.events;a===null?i.events=[s]:a.push(s)}}function My(s){var i=Ms().memoizedState;return nj({ref:i,nextImpl:s}),function(){if((Ut&2)!==0)throw Error(r(440));return i.impl.apply(void 0,arguments)}}function $y(s,i){return hu(4,2,s,i)}function Dy(s,i){return hu(4,4,s,i)}function Oy(s,i){if(typeof i=="function"){s=s();var a=i(s);return function(){typeof a=="function"?a():i(null)}}if(i!=null)return s=s(),i.current=s,function(){i.current=null}}function Ly(s,i,a){a=a!=null?a.concat([s]):null,hu(4,4,Oy.bind(null,i,s),a)}function dp(){}function Iy(s,i){var a=Ms();i=i===void 0?null:i;var f=a.memoizedState;return i!==null&&ep(i,f[1])?f[0]:(a.memoizedState=[s,i],s)}function Py(s,i){var a=Ms();i=i===void 0?null:i;var f=a.memoizedState;if(i!==null&&ep(i,f[1]))return f[0];if(f=s(),fa){Kt(!0);try{s()}finally{Kt(!1)}}return a.memoizedState=[f,i],f}function hp(s,i,a){return a===void 0||(Fi&1073741824)!==0&&($t&261930)===0?s.memoizedState=i:(s.memoizedState=a,s=B0(),yt.lanes|=s,Mr|=s,a)}function By(s,i,a,f){return Pn(a,i)?a:ho.current!==null?(s=hp(s,a,f),Pn(s,i)||(Bs=!0),s):(Fi&42)===0||(Fi&1073741824)!==0&&($t&261930)===0?(Bs=!0,s.memoizedState=a):(s=B0(),yt.lanes|=s,Mr|=s,i)}function zy(s,i,a,f,R){var N=ee.p;ee.p=N!==0&&8>N?N:8;var I=G.T,K={};G.T=K,mp(s,!1,i,a);try{var ie=R(),ge=G.S;if(ge!==null&&ge(K,ie),ie!==null&&typeof ie=="object"&&typeof ie.then=="function"){var Ee=Zk(ie,f);Al(s,i,Ee,qn(s))}else Al(s,i,f,qn(s))}catch(Ae){Al(s,i,{then:function(){},status:"rejected",reason:Ae},qn())}finally{ee.p=N,I!==null&&K.types!==null&&(I.types=K.types),G.T=I}}function ij(){}function fp(s,i,a,f){if(s.tag!==5)throw Error(r(476));var R=Hy(s).queue;zy(s,R,i,ne,a===null?ij:function(){return Uy(s),a(f)})}function Hy(s){var i=s.memoizedState;if(i!==null)return i;i={memoizedState:ne,baseState:ne,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:qi,lastRenderedState:ne},next:null};var a={};return i.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:qi,lastRenderedState:a},next:null},s.memoizedState=i,s=s.alternate,s!==null&&(s.memoizedState=i),i}function Uy(s){var i=Hy(s);i.next===null&&(i=s.alternate.memoizedState),Al(s,i.next.queue,{},qn())}function pp(){return en(Gl)}function Fy(){return Ms().memoizedState}function qy(){return Ms().memoizedState}function rj(s){for(var i=s.return;i!==null;){switch(i.tag){case 24:case 3:var a=qn();s=kr(a);var f=jr(i,s,a);f!==null&&(On(f,i,a),Cl(f,i,a)),i={cache:Ff()},s.payload=i;return}i=i.return}}function aj(s,i,a){var f=qn();a={lane:f,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},fu(s)?Gy(i,a):(a=Mf(s,i,a,f),a!==null&&(On(a,s,f),Wy(a,i,f)))}function Vy(s,i,a){var f=qn();Al(s,i,a,f)}function Al(s,i,a,f){var R={lane:f,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(fu(s))Gy(i,R);else{var N=s.alternate;if(s.lanes===0&&(N===null||N.lanes===0)&&(N=i.lastRenderedReducer,N!==null))try{var I=i.lastRenderedState,K=N(I,a);if(R.hasEagerState=!0,R.eagerState=K,Pn(K,I))return Wc(s,i,R,0),ns===null&&Gc(),!1}catch{}finally{}if(a=Mf(s,i,R,f),a!==null)return On(a,s,f),Wy(a,i,f),!0}return!1}function mp(s,i,a,f){if(f={lane:2,revertLane:Wp(),gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},fu(s)){if(i)throw Error(r(479))}else i=Mf(s,a,f,2),i!==null&&On(i,s,2)}function fu(s){var i=s.alternate;return s===yt||i!==null&&i===yt}function Gy(s,i){fo=au=!0;var a=s.pending;a===null?i.next=i:(i.next=a.next,a.next=i),s.pending=i}function Wy(s,i,a){if((a&4194048)!==0){var f=i.lanes;f&=s.pendingLanes,a|=f,i.lanes=a,un(s,a)}}var Tl={readContext:en,use:cu,useCallback:Es,useContext:Es,useEffect:Es,useImperativeHandle:Es,useLayoutEffect:Es,useInsertionEffect:Es,useMemo:Es,useReducer:Es,useRef:Es,useState:Es,useDebugValue:Es,useDeferredValue:Es,useTransition:Es,useSyncExternalStore:Es,useId:Es,useHostTransitionStatus:Es,useFormState:Es,useActionState:Es,useOptimistic:Es,useMemoCache:Es,useCacheRefresh:Es};Tl.useEffectEvent=Es;var Ky={readContext:en,use:cu,useCallback:function(s,i){return wn().memoizedState=[s,i===void 0?null:i],s},useContext:en,useEffect:Ny,useImperativeHandle:function(s,i,a){a=a!=null?a.concat([s]):null,du(4194308,4,Oy.bind(null,i,s),a)},useLayoutEffect:function(s,i){return du(4194308,4,s,i)},useInsertionEffect:function(s,i){du(4,2,s,i)},useMemo:function(s,i){var a=wn();i=i===void 0?null:i;var f=s();if(fa){Kt(!0);try{s()}finally{Kt(!1)}}return a.memoizedState=[f,i],f},useReducer:function(s,i,a){var f=wn();if(a!==void 0){var R=a(i);if(fa){Kt(!0);try{a(i)}finally{Kt(!1)}}}else R=i;return f.memoizedState=f.baseState=R,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:R},f.queue=s,s=s.dispatch=aj.bind(null,yt,s),[f.memoizedState,s]},useRef:function(s){var i=wn();return s={current:s},i.memoizedState=s},useState:function(s){s=lp(s);var i=s.queue,a=Vy.bind(null,yt,i);return i.dispatch=a,[s.memoizedState,a]},useDebugValue:dp,useDeferredValue:function(s,i){var a=wn();return hp(a,s,i)},useTransition:function(){var s=lp(!1);return s=zy.bind(null,yt,s.queue,!0,!1),wn().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,i,a){var f=yt,R=wn();if(It){if(a===void 0)throw Error(r(407));a=a()}else{if(a=i(),ns===null)throw Error(r(349));($t&127)!==0||my(f,i,a)}R.memoizedState=a;var N={value:a,getSnapshot:i};return R.queue=N,Ny(vy.bind(null,f,N,s),[s]),f.flags|=2048,mo(9,{destroy:void 0},gy.bind(null,f,N,a,i),null),a},useId:function(){var s=wn(),i=ns.identifierPrefix;if(It){var a=Ti,f=Ai;a=(f&~(1<<32-pt(f)-1)).toString(32)+a,i="_"+i+"R_"+a,a=ou++,0<a&&(i+="H"+a.toString(32)),i+="_"}else a=Qk++,i="_"+i+"r_"+a.toString(32)+"_";return s.memoizedState=i},useHostTransitionStatus:pp,useFormState:ky,useActionState:ky,useOptimistic:function(s){var i=wn();i.memoizedState=i.baseState=s;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=a,i=mp.bind(null,yt,!0,a),a.dispatch=i,[s,i]},useMemoCache:rp,useCacheRefresh:function(){return wn().memoizedState=rj.bind(null,yt)},useEffectEvent:function(s){var i=wn(),a={impl:s};return i.memoizedState=a,function(){if((Ut&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}},gp={readContext:en,use:cu,useCallback:Iy,useContext:en,useEffect:up,useImperativeHandle:Ly,useInsertionEffect:$y,useLayoutEffect:Dy,useMemo:Py,useReducer:uu,useRef:Ty,useState:function(){return uu(qi)},useDebugValue:dp,useDeferredValue:function(s,i){var a=Ms();return By(a,Jt.memoizedState,s,i)},useTransition:function(){var s=uu(qi)[0],i=Ms().memoizedState;return[typeof s=="boolean"?s:Rl(s),i]},useSyncExternalStore:py,useId:Fy,useHostTransitionStatus:pp,useFormState:jy,useActionState:jy,useOptimistic:function(s,i){var a=Ms();return by(a,Jt,s,i)},useMemoCache:rp,useCacheRefresh:qy};gp.useEffectEvent=My;var Yy={readContext:en,use:cu,useCallback:Iy,useContext:en,useEffect:up,useImperativeHandle:Ly,useInsertionEffect:$y,useLayoutEffect:Dy,useMemo:Py,useReducer:op,useRef:Ty,useState:function(){return op(qi)},useDebugValue:dp,useDeferredValue:function(s,i){var a=Ms();return Jt===null?hp(a,s,i):By(a,Jt.memoizedState,s,i)},useTransition:function(){var s=op(qi)[0],i=Ms().memoizedState;return[typeof s=="boolean"?s:Rl(s),i]},useSyncExternalStore:py,useId:Fy,useHostTransitionStatus:pp,useFormState:Ay,useActionState:Ay,useOptimistic:function(s,i){var a=Ms();return Jt!==null?by(a,Jt,s,i):(a.baseState=s,[s,a.queue.dispatch])},useMemoCache:rp,useCacheRefresh:qy};Yy.useEffectEvent=My;function vp(s,i,a,f){i=s.memoizedState,a=a(f,i),a=a==null?i:p({},i,a),s.memoizedState=a,s.lanes===0&&(s.updateQueue.baseState=a)}var _p={enqueueSetState:function(s,i,a){s=s._reactInternals;var f=qn(),R=kr(f);R.payload=i,a!=null&&(R.callback=a),i=jr(s,R,f),i!==null&&(On(i,s,f),Cl(i,s,f))},enqueueReplaceState:function(s,i,a){s=s._reactInternals;var f=qn(),R=kr(f);R.tag=1,R.payload=i,a!=null&&(R.callback=a),i=jr(s,R,f),i!==null&&(On(i,s,f),Cl(i,s,f))},enqueueForceUpdate:function(s,i){s=s._reactInternals;var a=qn(),f=kr(a);f.tag=2,i!=null&&(f.callback=i),i=jr(s,f,a),i!==null&&(On(i,s,a),Cl(i,s,a))}};function Xy(s,i,a,f,R,N,I){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(f,N,I):i.prototype&&i.prototype.isPureReactComponent?!gl(a,f)||!gl(R,N):!0}function Jy(s,i,a,f){s=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(a,f),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(a,f),i.state!==s&&_p.enqueueReplaceState(i,i.state,null)}function pa(s,i){var a=i;if("ref"in i){a={};for(var f in i)f!=="ref"&&(a[f]=i[f])}if(s=s.defaultProps){a===i&&(a=p({},a));for(var R in s)a[R]===void 0&&(a[R]=s[R])}return a}function Zy(s){Vc(s)}function Qy(s){console.error(s)}function e0(s){Vc(s)}function pu(s,i){try{var a=s.onUncaughtError;a(i.value,{componentStack:i.stack})}catch(f){setTimeout(function(){throw f})}}function t0(s,i,a){try{var f=s.onCaughtError;f(a.value,{componentStack:a.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(R){setTimeout(function(){throw R})}}function yp(s,i,a){return a=kr(a),a.tag=3,a.payload={element:null},a.callback=function(){pu(s,i)},a}function s0(s){return s=kr(s),s.tag=3,s}function n0(s,i,a,f){var R=a.type.getDerivedStateFromError;if(typeof R=="function"){var N=f.value;s.payload=function(){return R(N)},s.callback=function(){t0(i,a,f)}}var I=a.stateNode;I!==null&&typeof I.componentDidCatch=="function"&&(s.callback=function(){t0(i,a,f),typeof R!="function"&&($r===null?$r=new Set([this]):$r.add(this));var K=f.stack;this.componentDidCatch(f.value,{componentStack:K!==null?K:""})})}function oj(s,i,a,f,R){if(a.flags|=32768,f!==null&&typeof f=="object"&&typeof f.then=="function"){if(i=a.alternate,i!==null&&ao(i,a,R,!0),a=zn.current,a!==null){switch(a.tag){case 31:case 13:return si===null?ku():a.alternate===null&&ks===0&&(ks=3),a.flags&=-257,a.flags|=65536,a.lanes=R,f===tu?a.flags|=16384:(i=a.updateQueue,i===null?a.updateQueue=new Set([f]):i.add(f),qp(s,f,R)),!1;case 22:return a.flags|=65536,f===tu?a.flags|=16384:(i=a.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([f])},a.updateQueue=i):(a=i.retryQueue,a===null?i.retryQueue=new Set([f]):a.add(f)),qp(s,f,R)),!1}throw Error(r(435,a.tag))}return qp(s,f,R),ku(),!1}if(It)return i=zn.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=R,f!==Pf&&(s=Error(r(422),{cause:f}),yl(Zn(s,a)))):(f!==Pf&&(i=Error(r(423),{cause:f}),yl(Zn(i,a))),s=s.current.alternate,s.flags|=65536,R&=-R,s.lanes|=R,f=Zn(f,a),R=yp(s.stateNode,f,R),Yf(s,R),ks!==4&&(ks=2)),!1;var N=Error(r(520),{cause:f});if(N=Zn(N,a),Pl===null?Pl=[N]:Pl.push(N),ks!==4&&(ks=2),i===null)return!0;f=Zn(f,a),a=i;do{switch(a.tag){case 3:return a.flags|=65536,s=R&-R,a.lanes|=s,s=yp(a.stateNode,f,s),Yf(a,s),!1;case 1:if(i=a.type,N=a.stateNode,(a.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||N!==null&&typeof N.componentDidCatch=="function"&&($r===null||!$r.has(N))))return a.flags|=65536,R&=-R,a.lanes|=R,R=s0(R),n0(R,s,a,f),Yf(a,R),!1}a=a.return}while(a!==null);return!1}var bp=Error(r(461)),Bs=!1;function tn(s,i,a,f){i.child=s===null?oy(i,null,a,f):ha(i,s.child,a,f)}function i0(s,i,a,f,R){a=a.render;var N=i.ref;if("ref"in f){var I={};for(var K in f)K!=="ref"&&(I[K]=f[K])}else I=f;return la(i),f=tp(s,i,a,I,N,R),K=sp(),s!==null&&!Bs?(np(s,i,R),Vi(s,i,R)):(It&&K&&Lf(i),i.flags|=1,tn(s,i,f,R),i.child)}function r0(s,i,a,f,R){if(s===null){var N=a.type;return typeof N=="function"&&!$f(N)&&N.defaultProps===void 0&&a.compare===null?(i.tag=15,i.type=N,a0(s,i,N,f,R)):(s=Yc(a.type,null,f,i,i.mode,R),s.ref=i.ref,s.return=i,i.child=s)}if(N=s.child,!Rp(s,R)){var I=N.memoizedProps;if(a=a.compare,a=a!==null?a:gl,a(I,f)&&s.ref===i.ref)return Vi(s,i,R)}return i.flags|=1,s=Bi(N,f),s.ref=i.ref,s.return=i,i.child=s}function a0(s,i,a,f,R){if(s!==null){var N=s.memoizedProps;if(gl(N,f)&&s.ref===i.ref)if(Bs=!1,i.pendingProps=f=N,Rp(s,R))(s.flags&131072)!==0&&(Bs=!0);else return i.lanes=s.lanes,Vi(s,i,R)}return Sp(s,i,a,f,R)}function o0(s,i,a,f){var R=f.children,N=s!==null?s.memoizedState:null;if(s===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),f.mode==="hidden"){if((i.flags&128)!==0){if(N=N!==null?N.baseLanes|a:a,s!==null){for(f=i.child=s.child,R=0;f!==null;)R=R|f.lanes|f.childLanes,f=f.sibling;f=R&~N}else f=0,i.child=null;return l0(s,i,N,a,f)}if((a&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},s!==null&&Qc(i,N!==null?N.cachePool:null),N!==null?uy(i,N):Jf(),dy(i);else return f=i.lanes=536870912,l0(s,i,N!==null?N.baseLanes|a:a,a,f)}else N!==null?(Qc(i,N.cachePool),uy(i,N),Ar(),i.memoizedState=null):(s!==null&&Qc(i,null),Jf(),Ar());return tn(s,i,R,a),i.child}function Nl(s,i){return s!==null&&s.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function l0(s,i,a,f,R){var N=Vf();return N=N===null?null:{parent:Is._currentValue,pool:N},i.memoizedState={baseLanes:a,cachePool:N},s!==null&&Qc(i,null),Jf(),dy(i),s!==null&&ao(s,i,f,!0),i.childLanes=R,null}function mu(s,i){return i=vu({mode:i.mode,children:i.children},s.mode),i.ref=s.ref,s.child=i,i.return=s,i}function c0(s,i,a){return ha(i,s.child,null,a),s=mu(i,i.pendingProps),s.flags|=2,Hn(i),i.memoizedState=null,s}function lj(s,i,a){var f=i.pendingProps,R=(i.flags&128)!==0;if(i.flags&=-129,s===null){if(It){if(f.mode==="hidden")return s=mu(i,f),i.lanes=536870912,Nl(null,s);if(Qf(i),(s=hs)?(s=Sb(s,ti),s=s!==null&&s.data==="&"?s:null,s!==null&&(i.memoizedState={dehydrated:s,treeContext:Sr!==null?{id:Ai,overflow:Ti}:null,retryLane:536870912,hydrationErrors:null},a=G_(s),a.return=i,i.child=a,Qs=i,hs=null)):s=null,s===null)throw xr(i);return i.lanes=536870912,null}return mu(i,f)}var N=s.memoizedState;if(N!==null){var I=N.dehydrated;if(Qf(i),R)if(i.flags&256)i.flags&=-257,i=c0(s,i,a);else if(i.memoizedState!==null)i.child=s.child,i.flags|=128,i=null;else throw Error(r(558));else if(Bs||ao(s,i,a,!1),R=(a&s.childLanes)!==0,Bs||R){if(f=ns,f!==null&&(I=mi(f,a),I!==0&&I!==N.retryLane))throw N.retryLane=I,ia(s,I),On(f,s,I),bp;ku(),i=c0(s,i,a)}else s=N.treeContext,hs=ni(I.nextSibling),Qs=i,It=!0,wr=null,ti=!1,s!==null&&Y_(i,s),i=mu(i,f),i.flags|=4096;return i}return s=Bi(s.child,{mode:f.mode,children:f.children}),s.ref=i.ref,i.child=s,s.return=i,s}function gu(s,i){var a=i.ref;if(a===null)s!==null&&s.ref!==null&&(i.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(r(284));(s===null||s.ref!==a)&&(i.flags|=4194816)}}function Sp(s,i,a,f,R){return la(i),a=tp(s,i,a,f,void 0,R),f=sp(),s!==null&&!Bs?(np(s,i,R),Vi(s,i,R)):(It&&f&&Lf(i),i.flags|=1,tn(s,i,a,R),i.child)}function u0(s,i,a,f,R,N){return la(i),i.updateQueue=null,a=fy(i,f,a,R),hy(s),f=sp(),s!==null&&!Bs?(np(s,i,N),Vi(s,i,N)):(It&&f&&Lf(i),i.flags|=1,tn(s,i,a,N),i.child)}function d0(s,i,a,f,R){if(la(i),i.stateNode===null){var N=so,I=a.contextType;typeof I=="object"&&I!==null&&(N=en(I)),N=new a(f,N),i.memoizedState=N.state!==null&&N.state!==void 0?N.state:null,N.updater=_p,i.stateNode=N,N._reactInternals=i,N=i.stateNode,N.props=f,N.state=i.memoizedState,N.refs={},Wf(i),I=a.contextType,N.context=typeof I=="object"&&I!==null?en(I):so,N.state=i.memoizedState,I=a.getDerivedStateFromProps,typeof I=="function"&&(vp(i,a,I,f),N.state=i.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof N.getSnapshotBeforeUpdate=="function"||typeof N.UNSAFE_componentWillMount!="function"&&typeof N.componentWillMount!="function"||(I=N.state,typeof N.componentWillMount=="function"&&N.componentWillMount(),typeof N.UNSAFE_componentWillMount=="function"&&N.UNSAFE_componentWillMount(),I!==N.state&&_p.enqueueReplaceState(N,N.state,null),kl(i,f,N,R),El(),N.state=i.memoizedState),typeof N.componentDidMount=="function"&&(i.flags|=4194308),f=!0}else if(s===null){N=i.stateNode;var K=i.memoizedProps,ie=pa(a,K);N.props=ie;var ge=N.context,Ee=a.contextType;I=so,typeof Ee=="object"&&Ee!==null&&(I=en(Ee));var Ae=a.getDerivedStateFromProps;Ee=typeof Ae=="function"||typeof N.getSnapshotBeforeUpdate=="function",K=i.pendingProps!==K,Ee||typeof N.UNSAFE_componentWillReceiveProps!="function"&&typeof N.componentWillReceiveProps!="function"||(K||ge!==I)&&Jy(i,N,f,I),Er=!1;var ve=i.memoizedState;N.state=ve,kl(i,f,N,R),El(),ge=i.memoizedState,K||ve!==ge||Er?(typeof Ae=="function"&&(vp(i,a,Ae,f),ge=i.memoizedState),(ie=Er||Xy(i,a,ie,f,ve,ge,I))?(Ee||typeof N.UNSAFE_componentWillMount!="function"&&typeof N.componentWillMount!="function"||(typeof N.componentWillMount=="function"&&N.componentWillMount(),typeof N.UNSAFE_componentWillMount=="function"&&N.UNSAFE_componentWillMount()),typeof N.componentDidMount=="function"&&(i.flags|=4194308)):(typeof N.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=f,i.memoizedState=ge),N.props=f,N.state=ge,N.context=I,f=ie):(typeof N.componentDidMount=="function"&&(i.flags|=4194308),f=!1)}else{N=i.stateNode,Kf(s,i),I=i.memoizedProps,Ee=pa(a,I),N.props=Ee,Ae=i.pendingProps,ve=N.context,ge=a.contextType,ie=so,typeof ge=="object"&&ge!==null&&(ie=en(ge)),K=a.getDerivedStateFromProps,(ge=typeof K=="function"||typeof N.getSnapshotBeforeUpdate=="function")||typeof N.UNSAFE_componentWillReceiveProps!="function"&&typeof N.componentWillReceiveProps!="function"||(I!==Ae||ve!==ie)&&Jy(i,N,f,ie),Er=!1,ve=i.memoizedState,N.state=ve,kl(i,f,N,R),El();var we=i.memoizedState;I!==Ae||ve!==we||Er||s!==null&&s.dependencies!==null&&Jc(s.dependencies)?(typeof K=="function"&&(vp(i,a,K,f),we=i.memoizedState),(Ee=Er||Xy(i,a,Ee,f,ve,we,ie)||s!==null&&s.dependencies!==null&&Jc(s.dependencies))?(ge||typeof N.UNSAFE_componentWillUpdate!="function"&&typeof N.componentWillUpdate!="function"||(typeof N.componentWillUpdate=="function"&&N.componentWillUpdate(f,we,ie),typeof N.UNSAFE_componentWillUpdate=="function"&&N.UNSAFE_componentWillUpdate(f,we,ie)),typeof N.componentDidUpdate=="function"&&(i.flags|=4),typeof N.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof N.componentDidUpdate!="function"||I===s.memoizedProps&&ve===s.memoizedState||(i.flags|=4),typeof N.getSnapshotBeforeUpdate!="function"||I===s.memoizedProps&&ve===s.memoizedState||(i.flags|=1024),i.memoizedProps=f,i.memoizedState=we),N.props=f,N.state=we,N.context=ie,f=Ee):(typeof N.componentDidUpdate!="function"||I===s.memoizedProps&&ve===s.memoizedState||(i.flags|=4),typeof N.getSnapshotBeforeUpdate!="function"||I===s.memoizedProps&&ve===s.memoizedState||(i.flags|=1024),f=!1)}return N=f,gu(s,i),f=(i.flags&128)!==0,N||f?(N=i.stateNode,a=f&&typeof a.getDerivedStateFromError!="function"?null:N.render(),i.flags|=1,s!==null&&f?(i.child=ha(i,s.child,null,R),i.child=ha(i,null,a,R)):tn(s,i,a,R),i.memoizedState=N.state,s=i.child):s=Vi(s,i,R),s}function h0(s,i,a,f){return aa(),i.flags|=256,tn(s,i,a,f),i.child}var wp={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function xp(s){return{baseLanes:s,cachePool:ty()}}function Cp(s,i,a){return s=s!==null?s.childLanes&~a:0,i&&(s|=Fn),s}function f0(s,i,a){var f=i.pendingProps,R=!1,N=(i.flags&128)!==0,I;if((I=N)||(I=s!==null&&s.memoizedState===null?!1:(Ns.current&2)!==0),I&&(R=!0,i.flags&=-129),I=(i.flags&32)!==0,i.flags&=-33,s===null){if(It){if(R?Rr(i):Ar(),(s=hs)?(s=Sb(s,ti),s=s!==null&&s.data!=="&"?s:null,s!==null&&(i.memoizedState={dehydrated:s,treeContext:Sr!==null?{id:Ai,overflow:Ti}:null,retryLane:536870912,hydrationErrors:null},a=G_(s),a.return=i,i.child=a,Qs=i,hs=null)):s=null,s===null)throw xr(i);return am(s)?i.lanes=32:i.lanes=536870912,null}var K=f.children;return f=f.fallback,R?(Ar(),R=i.mode,K=vu({mode:"hidden",children:K},R),f=ra(f,R,a,null),K.return=i,f.return=i,K.sibling=f,i.child=K,f=i.child,f.memoizedState=xp(a),f.childLanes=Cp(s,I,a),i.memoizedState=wp,Nl(null,f)):(Rr(i),Ep(i,K))}var ie=s.memoizedState;if(ie!==null&&(K=ie.dehydrated,K!==null)){if(N)i.flags&256?(Rr(i),i.flags&=-257,i=kp(s,i,a)):i.memoizedState!==null?(Ar(),i.child=s.child,i.flags|=128,i=null):(Ar(),K=f.fallback,R=i.mode,f=vu({mode:"visible",children:f.children},R),K=ra(K,R,a,null),K.flags|=2,f.return=i,K.return=i,f.sibling=K,i.child=f,ha(i,s.child,null,a),f=i.child,f.memoizedState=xp(a),f.childLanes=Cp(s,I,a),i.memoizedState=wp,i=Nl(null,f));else if(Rr(i),am(K)){if(I=K.nextSibling&&K.nextSibling.dataset,I)var ge=I.dgst;I=ge,f=Error(r(419)),f.stack="",f.digest=I,yl({value:f,source:null,stack:null}),i=kp(s,i,a)}else if(Bs||ao(s,i,a,!1),I=(a&s.childLanes)!==0,Bs||I){if(I=ns,I!==null&&(f=mi(I,a),f!==0&&f!==ie.retryLane))throw ie.retryLane=f,ia(s,f),On(I,s,f),bp;rm(K)||ku(),i=kp(s,i,a)}else rm(K)?(i.flags|=192,i.child=s.child,i=null):(s=ie.treeContext,hs=ni(K.nextSibling),Qs=i,It=!0,wr=null,ti=!1,s!==null&&Y_(i,s),i=Ep(i,f.children),i.flags|=4096);return i}return R?(Ar(),K=f.fallback,R=i.mode,ie=s.child,ge=ie.sibling,f=Bi(ie,{mode:"hidden",children:f.children}),f.subtreeFlags=ie.subtreeFlags&65011712,ge!==null?K=Bi(ge,K):(K=ra(K,R,a,null),K.flags|=2),K.return=i,f.return=i,f.sibling=K,i.child=f,Nl(null,f),f=i.child,K=s.child.memoizedState,K===null?K=xp(a):(R=K.cachePool,R!==null?(ie=Is._currentValue,R=R.parent!==ie?{parent:ie,pool:ie}:R):R=ty(),K={baseLanes:K.baseLanes|a,cachePool:R}),f.memoizedState=K,f.childLanes=Cp(s,I,a),i.memoizedState=wp,Nl(s.child,f)):(Rr(i),a=s.child,s=a.sibling,a=Bi(a,{mode:"visible",children:f.children}),a.return=i,a.sibling=null,s!==null&&(I=i.deletions,I===null?(i.deletions=[s],i.flags|=16):I.push(s)),i.child=a,i.memoizedState=null,a)}function Ep(s,i){return i=vu({mode:"visible",children:i},s.mode),i.return=s,s.child=i}function vu(s,i){return s=Bn(22,s,null,i),s.lanes=0,s}function kp(s,i,a){return ha(i,s.child,null,a),s=Ep(i,i.pendingProps.children),s.flags|=2,i.memoizedState=null,s}function p0(s,i,a){s.lanes|=i;var f=s.alternate;f!==null&&(f.lanes|=i),Hf(s.return,i,a)}function jp(s,i,a,f,R,N){var I=s.memoizedState;I===null?s.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:f,tail:a,tailMode:R,treeForkCount:N}:(I.isBackwards=i,I.rendering=null,I.renderingStartTime=0,I.last=f,I.tail=a,I.tailMode=R,I.treeForkCount=N)}function m0(s,i,a){var f=i.pendingProps,R=f.revealOrder,N=f.tail;f=f.children;var I=Ns.current,K=(I&2)!==0;if(K?(I=I&1|2,i.flags|=128):I&=1,U(Ns,I),tn(s,i,f,a),f=It?_l:0,!K&&s!==null&&(s.flags&128)!==0)e:for(s=i.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&p0(s,a,i);else if(s.tag===19)p0(s,a,i);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===i)break e;for(;s.sibling===null;){if(s.return===null||s.return===i)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(R){case"forwards":for(a=i.child,R=null;a!==null;)s=a.alternate,s!==null&&ru(s)===null&&(R=a),a=a.sibling;a=R,a===null?(R=i.child,i.child=null):(R=a.sibling,a.sibling=null),jp(i,!1,R,a,N,f);break;case"backwards":case"unstable_legacy-backwards":for(a=null,R=i.child,i.child=null;R!==null;){if(s=R.alternate,s!==null&&ru(s)===null){i.child=R;break}s=R.sibling,R.sibling=a,a=R,R=s}jp(i,!0,a,null,N,f);break;case"together":jp(i,!1,null,null,void 0,f);break;default:i.memoizedState=null}return i.child}function Vi(s,i,a){if(s!==null&&(i.dependencies=s.dependencies),Mr|=i.lanes,(a&i.childLanes)===0)if(s!==null){if(ao(s,i,a,!1),(a&i.childLanes)===0)return null}else return null;if(s!==null&&i.child!==s.child)throw Error(r(153));if(i.child!==null){for(s=i.child,a=Bi(s,s.pendingProps),i.child=a,a.return=i;s.sibling!==null;)s=s.sibling,a=a.sibling=Bi(s,s.pendingProps),a.return=i;a.sibling=null}return i.child}function Rp(s,i){return(s.lanes&i)!==0?!0:(s=s.dependencies,!!(s!==null&&Jc(s)))}function cj(s,i,a){switch(i.tag){case 3:V(i,i.stateNode.containerInfo),Cr(i,Is,s.memoizedState.cache),aa();break;case 27:case 5:oe(i);break;case 4:V(i,i.stateNode.containerInfo);break;case 10:Cr(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,Qf(i),null;break;case 13:var f=i.memoizedState;if(f!==null)return f.dehydrated!==null?(Rr(i),i.flags|=128,null):(a&i.child.childLanes)!==0?f0(s,i,a):(Rr(i),s=Vi(s,i,a),s!==null?s.sibling:null);Rr(i);break;case 19:var R=(s.flags&128)!==0;if(f=(a&i.childLanes)!==0,f||(ao(s,i,a,!1),f=(a&i.childLanes)!==0),R){if(f)return m0(s,i,a);i.flags|=128}if(R=i.memoizedState,R!==null&&(R.rendering=null,R.tail=null,R.lastEffect=null),U(Ns,Ns.current),f)break;return null;case 22:return i.lanes=0,o0(s,i,a,i.pendingProps);case 24:Cr(i,Is,s.memoizedState.cache)}return Vi(s,i,a)}function g0(s,i,a){if(s!==null)if(s.memoizedProps!==i.pendingProps)Bs=!0;else{if(!Rp(s,a)&&(i.flags&128)===0)return Bs=!1,cj(s,i,a);Bs=(s.flags&131072)!==0}else Bs=!1,It&&(i.flags&1048576)!==0&&K_(i,_l,i.index);switch(i.lanes=0,i.tag){case 16:e:{var f=i.pendingProps;if(s=ua(i.elementType),i.type=s,typeof s=="function")$f(s)?(f=pa(s,f),i.tag=1,i=d0(null,i,s,f,a)):(i.tag=0,i=Sp(null,i,s,f,a));else{if(s!=null){var R=s.$$typeof;if(R===k){i.tag=11,i=i0(null,i,s,f,a);break e}else if(R===T){i.tag=14,i=r0(null,i,s,f,a);break e}}throw i=Y(s)||s,Error(r(306,i,""))}}return i;case 0:return Sp(s,i,i.type,i.pendingProps,a);case 1:return f=i.type,R=pa(f,i.pendingProps),d0(s,i,f,R,a);case 3:e:{if(V(i,i.stateNode.containerInfo),s===null)throw Error(r(387));f=i.pendingProps;var N=i.memoizedState;R=N.element,Kf(s,i),kl(i,f,null,a);var I=i.memoizedState;if(f=I.cache,Cr(i,Is,f),f!==N.cache&&Uf(i,[Is],a,!0),El(),f=I.element,N.isDehydrated)if(N={element:f,isDehydrated:!1,cache:I.cache},i.updateQueue.baseState=N,i.memoizedState=N,i.flags&256){i=h0(s,i,f,a);break e}else if(f!==R){R=Zn(Error(r(424)),i),yl(R),i=h0(s,i,f,a);break e}else{switch(s=i.stateNode.containerInfo,s.nodeType){case 9:s=s.body;break;default:s=s.nodeName==="HTML"?s.ownerDocument.body:s}for(hs=ni(s.firstChild),Qs=i,It=!0,wr=null,ti=!0,a=oy(i,null,f,a),i.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(aa(),f===R){i=Vi(s,i,a);break e}tn(s,i,f,a)}i=i.child}return i;case 26:return gu(s,i),s===null?(a=jb(i.type,null,i.pendingProps,null))?i.memoizedState=a:It||(a=i.type,s=i.pendingProps,f=$u(se.current).createElement(a),f[Et]=i,f[Yt]=s,sn(f,a,s),be(f),i.stateNode=f):i.memoizedState=jb(i.type,s.memoizedProps,i.pendingProps,s.memoizedState),null;case 27:return oe(i),s===null&&It&&(f=i.stateNode=Cb(i.type,i.pendingProps,se.current),Qs=i,ti=!0,R=hs,Ir(i.type)?(om=R,hs=ni(f.firstChild)):hs=R),tn(s,i,i.pendingProps.children,a),gu(s,i),s===null&&(i.flags|=4194304),i.child;case 5:return s===null&&It&&((R=f=hs)&&(f=Bj(f,i.type,i.pendingProps,ti),f!==null?(i.stateNode=f,Qs=i,hs=ni(f.firstChild),ti=!1,R=!0):R=!1),R||xr(i)),oe(i),R=i.type,N=i.pendingProps,I=s!==null?s.memoizedProps:null,f=N.children,sm(R,N)?f=null:I!==null&&sm(R,I)&&(i.flags|=32),i.memoizedState!==null&&(R=tp(s,i,ej,null,null,a),Gl._currentValue=R),gu(s,i),tn(s,i,f,a),i.child;case 6:return s===null&&It&&((s=a=hs)&&(a=zj(a,i.pendingProps,ti),a!==null?(i.stateNode=a,Qs=i,hs=null,s=!0):s=!1),s||xr(i)),null;case 13:return f0(s,i,a);case 4:return V(i,i.stateNode.containerInfo),f=i.pendingProps,s===null?i.child=ha(i,null,f,a):tn(s,i,f,a),i.child;case 11:return i0(s,i,i.type,i.pendingProps,a);case 7:return tn(s,i,i.pendingProps,a),i.child;case 8:return tn(s,i,i.pendingProps.children,a),i.child;case 12:return tn(s,i,i.pendingProps.children,a),i.child;case 10:return f=i.pendingProps,Cr(i,i.type,f.value),tn(s,i,f.children,a),i.child;case 9:return R=i.type._context,f=i.pendingProps.children,la(i),R=en(R),f=f(R),i.flags|=1,tn(s,i,f,a),i.child;case 14:return r0(s,i,i.type,i.pendingProps,a);case 15:return a0(s,i,i.type,i.pendingProps,a);case 19:return m0(s,i,a);case 31:return lj(s,i,a);case 22:return o0(s,i,a,i.pendingProps);case 24:return la(i),f=en(Is),s===null?(R=Vf(),R===null&&(R=ns,N=Ff(),R.pooledCache=N,N.refCount++,N!==null&&(R.pooledCacheLanes|=a),R=N),i.memoizedState={parent:f,cache:R},Wf(i),Cr(i,Is,R)):((s.lanes&a)!==0&&(Kf(s,i),kl(i,null,null,a),El()),R=s.memoizedState,N=i.memoizedState,R.parent!==f?(R={parent:f,cache:f},i.memoizedState=R,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=R),Cr(i,Is,f)):(f=N.cache,Cr(i,Is,f),f!==R.cache&&Uf(i,[Is],a,!0))),tn(s,i,i.pendingProps.children,a),i.child;case 29:throw i.pendingProps}throw Error(r(156,i.tag))}function Gi(s){s.flags|=4}function Ap(s,i,a,f,R){if((i=(s.mode&32)!==0)&&(i=!1),i){if(s.flags|=16777216,(R&335544128)===R)if(s.stateNode.complete)s.flags|=8192;else if(F0())s.flags|=8192;else throw da=tu,Gf}else s.flags&=-16777217}function v0(s,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!Mb(i))if(F0())s.flags|=8192;else throw da=tu,Gf}function _u(s,i){i!==null&&(s.flags|=4),s.flags&16384&&(i=s.tag!==22?yn():536870912,s.lanes|=i,yo|=i)}function Ml(s,i){if(!It)switch(s.tailMode){case"hidden":i=s.tail;for(var a=null;i!==null;)i.alternate!==null&&(a=i),i=i.sibling;a===null?s.tail=null:a.sibling=null;break;case"collapsed":a=s.tail;for(var f=null;a!==null;)a.alternate!==null&&(f=a),a=a.sibling;f===null?i||s.tail===null?s.tail=null:s.tail.sibling=null:f.sibling=null}}function fs(s){var i=s.alternate!==null&&s.alternate.child===s.child,a=0,f=0;if(i)for(var R=s.child;R!==null;)a|=R.lanes|R.childLanes,f|=R.subtreeFlags&65011712,f|=R.flags&65011712,R.return=s,R=R.sibling;else for(R=s.child;R!==null;)a|=R.lanes|R.childLanes,f|=R.subtreeFlags,f|=R.flags,R.return=s,R=R.sibling;return s.subtreeFlags|=f,s.childLanes=a,i}function uj(s,i,a){var f=i.pendingProps;switch(If(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return fs(i),null;case 1:return fs(i),null;case 3:return a=i.stateNode,f=null,s!==null&&(f=s.memoizedState.cache),i.memoizedState.cache!==f&&(i.flags|=2048),Ui(Is),ue(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(s===null||s.child===null)&&(ro(i)?Gi(i):s===null||s.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,Bf())),fs(i),null;case 26:var R=i.type,N=i.memoizedState;return s===null?(Gi(i),N!==null?(fs(i),v0(i,N)):(fs(i),Ap(i,R,null,f,a))):N?N!==s.memoizedState?(Gi(i),fs(i),v0(i,N)):(fs(i),i.flags&=-16777217):(s=s.memoizedProps,s!==f&&Gi(i),fs(i),Ap(i,R,s,f,a)),null;case 27:if(Z(i),a=se.current,R=i.type,s!==null&&i.stateNode!=null)s.memoizedProps!==f&&Gi(i);else{if(!f){if(i.stateNode===null)throw Error(r(166));return fs(i),null}s=P.current,ro(i)?X_(i):(s=Cb(R,f,a),i.stateNode=s,Gi(i))}return fs(i),null;case 5:if(Z(i),R=i.type,s!==null&&i.stateNode!=null)s.memoizedProps!==f&&Gi(i);else{if(!f){if(i.stateNode===null)throw Error(r(166));return fs(i),null}if(N=P.current,ro(i))X_(i);else{var I=$u(se.current);switch(N){case 1:N=I.createElementNS("http://www.w3.org/2000/svg",R);break;case 2:N=I.createElementNS("http://www.w3.org/1998/Math/MathML",R);break;default:switch(R){case"svg":N=I.createElementNS("http://www.w3.org/2000/svg",R);break;case"math":N=I.createElementNS("http://www.w3.org/1998/Math/MathML",R);break;case"script":N=I.createElement("div"),N.innerHTML="<script><\/script>",N=N.removeChild(N.firstChild);break;case"select":N=typeof f.is=="string"?I.createElement("select",{is:f.is}):I.createElement("select"),f.multiple?N.multiple=!0:f.size&&(N.size=f.size);break;default:N=typeof f.is=="string"?I.createElement(R,{is:f.is}):I.createElement(R)}}N[Et]=i,N[Yt]=f;e:for(I=i.child;I!==null;){if(I.tag===5||I.tag===6)N.appendChild(I.stateNode);else if(I.tag!==4&&I.tag!==27&&I.child!==null){I.child.return=I,I=I.child;continue}if(I===i)break e;for(;I.sibling===null;){if(I.return===null||I.return===i)break e;I=I.return}I.sibling.return=I.return,I=I.sibling}i.stateNode=N;e:switch(sn(N,R,f),R){case"button":case"input":case"select":case"textarea":f=!!f.autoFocus;break e;case"img":f=!0;break e;default:f=!1}f&&Gi(i)}}return fs(i),Ap(i,i.type,s===null?null:s.memoizedProps,i.pendingProps,a),null;case 6:if(s&&i.stateNode!=null)s.memoizedProps!==f&&Gi(i);else{if(typeof f!="string"&&i.stateNode===null)throw Error(r(166));if(s=se.current,ro(i)){if(s=i.stateNode,a=i.memoizedProps,f=null,R=Qs,R!==null)switch(R.tag){case 27:case 5:f=R.memoizedProps}s[Et]=i,s=!!(s.nodeValue===a||f!==null&&f.suppressHydrationWarning===!0||fb(s.nodeValue,a)),s||xr(i,!0)}else s=$u(s).createTextNode(f),s[Et]=i,i.stateNode=s}return fs(i),null;case 31:if(a=i.memoizedState,s===null||s.memoizedState!==null){if(f=ro(i),a!==null){if(s===null){if(!f)throw Error(r(318));if(s=i.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(557));s[Et]=i}else aa(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;fs(i),s=!1}else a=Bf(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=a),s=!0;if(!s)return i.flags&256?(Hn(i),i):(Hn(i),null);if((i.flags&128)!==0)throw Error(r(558))}return fs(i),null;case 13:if(f=i.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(R=ro(i),f!==null&&f.dehydrated!==null){if(s===null){if(!R)throw Error(r(318));if(R=i.memoizedState,R=R!==null?R.dehydrated:null,!R)throw Error(r(317));R[Et]=i}else aa(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;fs(i),R=!1}else R=Bf(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=R),R=!0;if(!R)return i.flags&256?(Hn(i),i):(Hn(i),null)}return Hn(i),(i.flags&128)!==0?(i.lanes=a,i):(a=f!==null,s=s!==null&&s.memoizedState!==null,a&&(f=i.child,R=null,f.alternate!==null&&f.alternate.memoizedState!==null&&f.alternate.memoizedState.cachePool!==null&&(R=f.alternate.memoizedState.cachePool.pool),N=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(N=f.memoizedState.cachePool.pool),N!==R&&(f.flags|=2048)),a!==s&&a&&(i.child.flags|=8192),_u(i,i.updateQueue),fs(i),null);case 4:return ue(),s===null&&Jp(i.stateNode.containerInfo),fs(i),null;case 10:return Ui(i.type),fs(i),null;case 19:if(H(Ns),f=i.memoizedState,f===null)return fs(i),null;if(R=(i.flags&128)!==0,N=f.rendering,N===null)if(R)Ml(f,!1);else{if(ks!==0||s!==null&&(s.flags&128)!==0)for(s=i.child;s!==null;){if(N=ru(s),N!==null){for(i.flags|=128,Ml(f,!1),s=N.updateQueue,i.updateQueue=s,_u(i,s),i.subtreeFlags=0,s=a,a=i.child;a!==null;)V_(a,s),a=a.sibling;return U(Ns,Ns.current&1|2),It&&zi(i,f.treeForkCount),i.child}s=s.sibling}f.tail!==null&&Ct()>xu&&(i.flags|=128,R=!0,Ml(f,!1),i.lanes=4194304)}else{if(!R)if(s=ru(N),s!==null){if(i.flags|=128,R=!0,s=s.updateQueue,i.updateQueue=s,_u(i,s),Ml(f,!0),f.tail===null&&f.tailMode==="hidden"&&!N.alternate&&!It)return fs(i),null}else 2*Ct()-f.renderingStartTime>xu&&a!==536870912&&(i.flags|=128,R=!0,Ml(f,!1),i.lanes=4194304);f.isBackwards?(N.sibling=i.child,i.child=N):(s=f.last,s!==null?s.sibling=N:i.child=N,f.last=N)}return f.tail!==null?(s=f.tail,f.rendering=s,f.tail=s.sibling,f.renderingStartTime=Ct(),s.sibling=null,a=Ns.current,U(Ns,R?a&1|2:a&1),It&&zi(i,f.treeForkCount),s):(fs(i),null);case 22:case 23:return Hn(i),Zf(),f=i.memoizedState!==null,s!==null?s.memoizedState!==null!==f&&(i.flags|=8192):f&&(i.flags|=8192),f?(a&536870912)!==0&&(i.flags&128)===0&&(fs(i),i.subtreeFlags&6&&(i.flags|=8192)):fs(i),a=i.updateQueue,a!==null&&_u(i,a.retryQueue),a=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(a=s.memoizedState.cachePool.pool),f=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(f=i.memoizedState.cachePool.pool),f!==a&&(i.flags|=2048),s!==null&&H(ca),null;case 24:return a=null,s!==null&&(a=s.memoizedState.cache),i.memoizedState.cache!==a&&(i.flags|=2048),Ui(Is),fs(i),null;case 25:return null;case 30:return null}throw Error(r(156,i.tag))}function dj(s,i){switch(If(i),i.tag){case 1:return s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 3:return Ui(Is),ue(),s=i.flags,(s&65536)!==0&&(s&128)===0?(i.flags=s&-65537|128,i):null;case 26:case 27:case 5:return Z(i),null;case 31:if(i.memoizedState!==null){if(Hn(i),i.alternate===null)throw Error(r(340));aa()}return s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 13:if(Hn(i),s=i.memoizedState,s!==null&&s.dehydrated!==null){if(i.alternate===null)throw Error(r(340));aa()}return s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 19:return H(Ns),null;case 4:return ue(),null;case 10:return Ui(i.type),null;case 22:case 23:return Hn(i),Zf(),s!==null&&H(ca),s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 24:return Ui(Is),null;case 25:return null;default:return null}}function _0(s,i){switch(If(i),i.tag){case 3:Ui(Is),ue();break;case 26:case 27:case 5:Z(i);break;case 4:ue();break;case 31:i.memoizedState!==null&&Hn(i);break;case 13:Hn(i);break;case 19:H(Ns);break;case 10:Ui(i.type);break;case 22:case 23:Hn(i),Zf(),s!==null&&H(ca);break;case 24:Ui(Is)}}function $l(s,i){try{var a=i.updateQueue,f=a!==null?a.lastEffect:null;if(f!==null){var R=f.next;a=R;do{if((a.tag&s)===s){f=void 0;var N=a.create,I=a.inst;f=N(),I.destroy=f}a=a.next}while(a!==R)}}catch(K){Vt(i,i.return,K)}}function Tr(s,i,a){try{var f=i.updateQueue,R=f!==null?f.lastEffect:null;if(R!==null){var N=R.next;f=N;do{if((f.tag&s)===s){var I=f.inst,K=I.destroy;if(K!==void 0){I.destroy=void 0,R=i;var ie=a,ge=K;try{ge()}catch(Ee){Vt(R,ie,Ee)}}}f=f.next}while(f!==N)}}catch(Ee){Vt(i,i.return,Ee)}}function y0(s){var i=s.updateQueue;if(i!==null){var a=s.stateNode;try{cy(i,a)}catch(f){Vt(s,s.return,f)}}}function b0(s,i,a){a.props=pa(s.type,s.memoizedProps),a.state=s.memoizedState;try{a.componentWillUnmount()}catch(f){Vt(s,i,f)}}function Dl(s,i){try{var a=s.ref;if(a!==null){switch(s.tag){case 26:case 27:case 5:var f=s.stateNode;break;case 30:f=s.stateNode;break;default:f=s.stateNode}typeof a=="function"?s.refCleanup=a(f):a.current=f}}catch(R){Vt(s,i,R)}}function Ni(s,i){var a=s.ref,f=s.refCleanup;if(a!==null)if(typeof f=="function")try{f()}catch(R){Vt(s,i,R)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(R){Vt(s,i,R)}else a.current=null}function S0(s){var i=s.type,a=s.memoizedProps,f=s.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":a.autoFocus&&f.focus();break e;case"img":a.src?f.src=a.src:a.srcSet&&(f.srcset=a.srcSet)}}catch(R){Vt(s,s.return,R)}}function Tp(s,i,a){try{var f=s.stateNode;$j(f,s.type,a,i),f[Yt]=i}catch(R){Vt(s,s.return,R)}}function w0(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&Ir(s.type)||s.tag===4}function Np(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||w0(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&Ir(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function Mp(s,i,a){var f=s.tag;if(f===5||f===6)s=s.stateNode,i?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(s,i):(i=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,i.appendChild(s),a=a._reactRootContainer,a!=null||i.onclick!==null||(i.onclick=Tn));else if(f!==4&&(f===27&&Ir(s.type)&&(a=s.stateNode,i=null),s=s.child,s!==null))for(Mp(s,i,a),s=s.sibling;s!==null;)Mp(s,i,a),s=s.sibling}function yu(s,i,a){var f=s.tag;if(f===5||f===6)s=s.stateNode,i?a.insertBefore(s,i):a.appendChild(s);else if(f!==4&&(f===27&&Ir(s.type)&&(a=s.stateNode),s=s.child,s!==null))for(yu(s,i,a),s=s.sibling;s!==null;)yu(s,i,a),s=s.sibling}function x0(s){var i=s.stateNode,a=s.memoizedProps;try{for(var f=s.type,R=i.attributes;R.length;)i.removeAttributeNode(R[0]);sn(i,f,a),i[Et]=s,i[Yt]=a}catch(N){Vt(s,s.return,N)}}var Wi=!1,zs=!1,$p=!1,C0=typeof WeakSet=="function"?WeakSet:Set,Ws=null;function hj(s,i){if(s=s.containerInfo,em=zu,s=L_(s),kf(s)){if("selectionStart"in s)var a={start:s.selectionStart,end:s.selectionEnd};else e:{a=(a=s.ownerDocument)&&a.defaultView||window;var f=a.getSelection&&a.getSelection();if(f&&f.rangeCount!==0){a=f.anchorNode;var R=f.anchorOffset,N=f.focusNode;f=f.focusOffset;try{a.nodeType,N.nodeType}catch{a=null;break e}var I=0,K=-1,ie=-1,ge=0,Ee=0,Ae=s,ve=null;t:for(;;){for(var we;Ae!==a||R!==0&&Ae.nodeType!==3||(K=I+R),Ae!==N||f!==0&&Ae.nodeType!==3||(ie=I+f),Ae.nodeType===3&&(I+=Ae.nodeValue.length),(we=Ae.firstChild)!==null;)ve=Ae,Ae=we;for(;;){if(Ae===s)break t;if(ve===a&&++ge===R&&(K=I),ve===N&&++Ee===f&&(ie=I),(we=Ae.nextSibling)!==null)break;Ae=ve,ve=Ae.parentNode}Ae=we}a=K===-1||ie===-1?null:{start:K,end:ie}}else a=null}a=a||{start:0,end:0}}else a=null;for(tm={focusedElem:s,selectionRange:a},zu=!1,Ws=i;Ws!==null;)if(i=Ws,s=i.child,(i.subtreeFlags&1028)!==0&&s!==null)s.return=i,Ws=s;else for(;Ws!==null;){switch(i=Ws,N=i.alternate,s=i.flags,i.tag){case 0:if((s&4)!==0&&(s=i.updateQueue,s=s!==null?s.events:null,s!==null))for(a=0;a<s.length;a++)R=s[a],R.ref.impl=R.nextImpl;break;case 11:case 15:break;case 1:if((s&1024)!==0&&N!==null){s=void 0,a=i,R=N.memoizedProps,N=N.memoizedState,f=a.stateNode;try{var Ve=pa(a.type,R);s=f.getSnapshotBeforeUpdate(Ve,N),f.__reactInternalSnapshotBeforeUpdate=s}catch(it){Vt(a,a.return,it)}}break;case 3:if((s&1024)!==0){if(s=i.stateNode.containerInfo,a=s.nodeType,a===9)im(s);else if(a===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":im(s);break;default:s.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((s&1024)!==0)throw Error(r(163))}if(s=i.sibling,s!==null){s.return=i.return,Ws=s;break}Ws=i.return}}function E0(s,i,a){var f=a.flags;switch(a.tag){case 0:case 11:case 15:Yi(s,a),f&4&&$l(5,a);break;case 1:if(Yi(s,a),f&4)if(s=a.stateNode,i===null)try{s.componentDidMount()}catch(I){Vt(a,a.return,I)}else{var R=pa(a.type,i.memoizedProps);i=i.memoizedState;try{s.componentDidUpdate(R,i,s.__reactInternalSnapshotBeforeUpdate)}catch(I){Vt(a,a.return,I)}}f&64&&y0(a),f&512&&Dl(a,a.return);break;case 3:if(Yi(s,a),f&64&&(s=a.updateQueue,s!==null)){if(i=null,a.child!==null)switch(a.child.tag){case 27:case 5:i=a.child.stateNode;break;case 1:i=a.child.stateNode}try{cy(s,i)}catch(I){Vt(a,a.return,I)}}break;case 27:i===null&&f&4&&x0(a);case 26:case 5:Yi(s,a),i===null&&f&4&&S0(a),f&512&&Dl(a,a.return);break;case 12:Yi(s,a);break;case 31:Yi(s,a),f&4&&R0(s,a);break;case 13:Yi(s,a),f&4&&A0(s,a),f&64&&(s=a.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(a=Sj.bind(null,a),Hj(s,a))));break;case 22:if(f=a.memoizedState!==null||Wi,!f){i=i!==null&&i.memoizedState!==null||zs,R=Wi;var N=zs;Wi=f,(zs=i)&&!N?Xi(s,a,(a.subtreeFlags&8772)!==0):Yi(s,a),Wi=R,zs=N}break;case 30:break;default:Yi(s,a)}}function k0(s){var i=s.alternate;i!==null&&(s.alternate=null,k0(i)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(i=s.stateNode,i!==null&&xs(i)),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}var bs=null,Nn=!1;function Ki(s,i,a){for(a=a.child;a!==null;)j0(s,i,a),a=a.sibling}function j0(s,i,a){if(ls&&typeof ls.onCommitFiberUnmount=="function")try{ls.onCommitFiberUnmount(Ds,a)}catch{}switch(a.tag){case 26:zs||Ni(a,i),Ki(s,i,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:zs||Ni(a,i);var f=bs,R=Nn;Ir(a.type)&&(bs=a.stateNode,Nn=!1),Ki(s,i,a),Fl(a.stateNode),bs=f,Nn=R;break;case 5:zs||Ni(a,i);case 6:if(f=bs,R=Nn,bs=null,Ki(s,i,a),bs=f,Nn=R,bs!==null)if(Nn)try{(bs.nodeType===9?bs.body:bs.nodeName==="HTML"?bs.ownerDocument.body:bs).removeChild(a.stateNode)}catch(N){Vt(a,i,N)}else try{bs.removeChild(a.stateNode)}catch(N){Vt(a,i,N)}break;case 18:bs!==null&&(Nn?(s=bs,yb(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,a.stateNode),jo(s)):yb(bs,a.stateNode));break;case 4:f=bs,R=Nn,bs=a.stateNode.containerInfo,Nn=!0,Ki(s,i,a),bs=f,Nn=R;break;case 0:case 11:case 14:case 15:Tr(2,a,i),zs||Tr(4,a,i),Ki(s,i,a);break;case 1:zs||(Ni(a,i),f=a.stateNode,typeof f.componentWillUnmount=="function"&&b0(a,i,f)),Ki(s,i,a);break;case 21:Ki(s,i,a);break;case 22:zs=(f=zs)||a.memoizedState!==null,Ki(s,i,a),zs=f;break;default:Ki(s,i,a)}}function R0(s,i){if(i.memoizedState===null&&(s=i.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{jo(s)}catch(a){Vt(i,i.return,a)}}}function A0(s,i){if(i.memoizedState===null&&(s=i.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{jo(s)}catch(a){Vt(i,i.return,a)}}function fj(s){switch(s.tag){case 31:case 13:case 19:var i=s.stateNode;return i===null&&(i=s.stateNode=new C0),i;case 22:return s=s.stateNode,i=s._retryCache,i===null&&(i=s._retryCache=new C0),i;default:throw Error(r(435,s.tag))}}function bu(s,i){var a=fj(s);i.forEach(function(f){if(!a.has(f)){a.add(f);var R=wj.bind(null,s,f);f.then(R,R)}})}function Mn(s,i){var a=i.deletions;if(a!==null)for(var f=0;f<a.length;f++){var R=a[f],N=s,I=i,K=I;e:for(;K!==null;){switch(K.tag){case 27:if(Ir(K.type)){bs=K.stateNode,Nn=!1;break e}break;case 5:bs=K.stateNode,Nn=!1;break e;case 3:case 4:bs=K.stateNode.containerInfo,Nn=!0;break e}K=K.return}if(bs===null)throw Error(r(160));j0(N,I,R),bs=null,Nn=!1,N=R.alternate,N!==null&&(N.return=null),R.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)T0(i,s),i=i.sibling}var _i=null;function T0(s,i){var a=s.alternate,f=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:Mn(i,s),$n(s),f&4&&(Tr(3,s,s.return),$l(3,s),Tr(5,s,s.return));break;case 1:Mn(i,s),$n(s),f&512&&(zs||a===null||Ni(a,a.return)),f&64&&Wi&&(s=s.updateQueue,s!==null&&(f=s.callbacks,f!==null&&(a=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=a===null?f:a.concat(f))));break;case 26:var R=_i;if(Mn(i,s),$n(s),f&512&&(zs||a===null||Ni(a,a.return)),f&4){var N=a!==null?a.memoizedState:null;if(f=s.memoizedState,a===null)if(f===null)if(s.stateNode===null){e:{f=s.type,a=s.memoizedProps,R=R.ownerDocument||R;t:switch(f){case"title":N=R.getElementsByTagName("title")[0],(!N||N[Fs]||N[Et]||N.namespaceURI==="http://www.w3.org/2000/svg"||N.hasAttribute("itemprop"))&&(N=R.createElement(f),R.head.insertBefore(N,R.querySelector("head > title"))),sn(N,f,a),N[Et]=s,be(N),f=N;break e;case"link":var I=Tb("link","href",R).get(f+(a.href||""));if(I){for(var K=0;K<I.length;K++)if(N=I[K],N.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&N.getAttribute("rel")===(a.rel==null?null:a.rel)&&N.getAttribute("title")===(a.title==null?null:a.title)&&N.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){I.splice(K,1);break t}}N=R.createElement(f),sn(N,f,a),R.head.appendChild(N);break;case"meta":if(I=Tb("meta","content",R).get(f+(a.content||""))){for(K=0;K<I.length;K++)if(N=I[K],N.getAttribute("content")===(a.content==null?null:""+a.content)&&N.getAttribute("name")===(a.name==null?null:a.name)&&N.getAttribute("property")===(a.property==null?null:a.property)&&N.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&N.getAttribute("charset")===(a.charSet==null?null:a.charSet)){I.splice(K,1);break t}}N=R.createElement(f),sn(N,f,a),R.head.appendChild(N);break;default:throw Error(r(468,f))}N[Et]=s,be(N),f=N}s.stateNode=f}else Nb(R,s.type,s.stateNode);else s.stateNode=Ab(R,f,s.memoizedProps);else N!==f?(N===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):N.count--,f===null?Nb(R,s.type,s.stateNode):Ab(R,f,s.memoizedProps)):f===null&&s.stateNode!==null&&Tp(s,s.memoizedProps,a.memoizedProps)}break;case 27:Mn(i,s),$n(s),f&512&&(zs||a===null||Ni(a,a.return)),a!==null&&f&4&&Tp(s,s.memoizedProps,a.memoizedProps);break;case 5:if(Mn(i,s),$n(s),f&512&&(zs||a===null||Ni(a,a.return)),s.flags&32){R=s.stateNode;try{mr(R,"")}catch(Ve){Vt(s,s.return,Ve)}}f&4&&s.stateNode!=null&&(R=s.memoizedProps,Tp(s,R,a!==null?a.memoizedProps:R)),f&1024&&($p=!0);break;case 6:if(Mn(i,s),$n(s),f&4){if(s.stateNode===null)throw Error(r(162));f=s.memoizedProps,a=s.stateNode;try{a.nodeValue=f}catch(Ve){Vt(s,s.return,Ve)}}break;case 3:if(Lu=null,R=_i,_i=Du(i.containerInfo),Mn(i,s),_i=R,$n(s),f&4&&a!==null&&a.memoizedState.isDehydrated)try{jo(i.containerInfo)}catch(Ve){Vt(s,s.return,Ve)}$p&&($p=!1,N0(s));break;case 4:f=_i,_i=Du(s.stateNode.containerInfo),Mn(i,s),$n(s),_i=f;break;case 12:Mn(i,s),$n(s);break;case 31:Mn(i,s),$n(s),f&4&&(f=s.updateQueue,f!==null&&(s.updateQueue=null,bu(s,f)));break;case 13:Mn(i,s),$n(s),s.child.flags&8192&&s.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(wu=Ct()),f&4&&(f=s.updateQueue,f!==null&&(s.updateQueue=null,bu(s,f)));break;case 22:R=s.memoizedState!==null;var ie=a!==null&&a.memoizedState!==null,ge=Wi,Ee=zs;if(Wi=ge||R,zs=Ee||ie,Mn(i,s),zs=Ee,Wi=ge,$n(s),f&8192)e:for(i=s.stateNode,i._visibility=R?i._visibility&-2:i._visibility|1,R&&(a===null||ie||Wi||zs||ma(s)),a=null,i=s;;){if(i.tag===5||i.tag===26){if(a===null){ie=a=i;try{if(N=ie.stateNode,R)I=N.style,typeof I.setProperty=="function"?I.setProperty("display","none","important"):I.display="none";else{K=ie.stateNode;var Ae=ie.memoizedProps.style,ve=Ae!=null&&Ae.hasOwnProperty("display")?Ae.display:null;K.style.display=ve==null||typeof ve=="boolean"?"":(""+ve).trim()}}catch(Ve){Vt(ie,ie.return,Ve)}}}else if(i.tag===6){if(a===null){ie=i;try{ie.stateNode.nodeValue=R?"":ie.memoizedProps}catch(Ve){Vt(ie,ie.return,Ve)}}}else if(i.tag===18){if(a===null){ie=i;try{var we=ie.stateNode;R?bb(we,!0):bb(ie.stateNode,!1)}catch(Ve){Vt(ie,ie.return,Ve)}}}else if((i.tag!==22&&i.tag!==23||i.memoizedState===null||i===s)&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===s)break e;for(;i.sibling===null;){if(i.return===null||i.return===s)break e;a===i&&(a=null),i=i.return}a===i&&(a=null),i.sibling.return=i.return,i=i.sibling}f&4&&(f=s.updateQueue,f!==null&&(a=f.retryQueue,a!==null&&(f.retryQueue=null,bu(s,a))));break;case 19:Mn(i,s),$n(s),f&4&&(f=s.updateQueue,f!==null&&(s.updateQueue=null,bu(s,f)));break;case 30:break;case 21:break;default:Mn(i,s),$n(s)}}function $n(s){var i=s.flags;if(i&2){try{for(var a,f=s.return;f!==null;){if(w0(f)){a=f;break}f=f.return}if(a==null)throw Error(r(160));switch(a.tag){case 27:var R=a.stateNode,N=Np(s);yu(s,N,R);break;case 5:var I=a.stateNode;a.flags&32&&(mr(I,""),a.flags&=-33);var K=Np(s);yu(s,K,I);break;case 3:case 4:var ie=a.stateNode.containerInfo,ge=Np(s);Mp(s,ge,ie);break;default:throw Error(r(161))}}catch(Ee){Vt(s,s.return,Ee)}s.flags&=-3}i&4096&&(s.flags&=-4097)}function N0(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var i=s;N0(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),s=s.sibling}}function Yi(s,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)E0(s,i.alternate,i),i=i.sibling}function ma(s){for(s=s.child;s!==null;){var i=s;switch(i.tag){case 0:case 11:case 14:case 15:Tr(4,i,i.return),ma(i);break;case 1:Ni(i,i.return);var a=i.stateNode;typeof a.componentWillUnmount=="function"&&b0(i,i.return,a),ma(i);break;case 27:Fl(i.stateNode);case 26:case 5:Ni(i,i.return),ma(i);break;case 22:i.memoizedState===null&&ma(i);break;case 30:ma(i);break;default:ma(i)}s=s.sibling}}function Xi(s,i,a){for(a=a&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var f=i.alternate,R=s,N=i,I=N.flags;switch(N.tag){case 0:case 11:case 15:Xi(R,N,a),$l(4,N);break;case 1:if(Xi(R,N,a),f=N,R=f.stateNode,typeof R.componentDidMount=="function")try{R.componentDidMount()}catch(ge){Vt(f,f.return,ge)}if(f=N,R=f.updateQueue,R!==null){var K=f.stateNode;try{var ie=R.shared.hiddenCallbacks;if(ie!==null)for(R.shared.hiddenCallbacks=null,R=0;R<ie.length;R++)ly(ie[R],K)}catch(ge){Vt(f,f.return,ge)}}a&&I&64&&y0(N),Dl(N,N.return);break;case 27:x0(N);case 26:case 5:Xi(R,N,a),a&&f===null&&I&4&&S0(N),Dl(N,N.return);break;case 12:Xi(R,N,a);break;case 31:Xi(R,N,a),a&&I&4&&R0(R,N);break;case 13:Xi(R,N,a),a&&I&4&&A0(R,N);break;case 22:N.memoizedState===null&&Xi(R,N,a),Dl(N,N.return);break;case 30:break;default:Xi(R,N,a)}i=i.sibling}}function Dp(s,i){var a=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(a=s.memoizedState.cachePool.pool),s=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(s=i.memoizedState.cachePool.pool),s!==a&&(s!=null&&s.refCount++,a!=null&&bl(a))}function Op(s,i){s=null,i.alternate!==null&&(s=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==s&&(i.refCount++,s!=null&&bl(s))}function yi(s,i,a,f){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)M0(s,i,a,f),i=i.sibling}function M0(s,i,a,f){var R=i.flags;switch(i.tag){case 0:case 11:case 15:yi(s,i,a,f),R&2048&&$l(9,i);break;case 1:yi(s,i,a,f);break;case 3:yi(s,i,a,f),R&2048&&(s=null,i.alternate!==null&&(s=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==s&&(i.refCount++,s!=null&&bl(s)));break;case 12:if(R&2048){yi(s,i,a,f),s=i.stateNode;try{var N=i.memoizedProps,I=N.id,K=N.onPostCommit;typeof K=="function"&&K(I,i.alternate===null?"mount":"update",s.passiveEffectDuration,-0)}catch(ie){Vt(i,i.return,ie)}}else yi(s,i,a,f);break;case 31:yi(s,i,a,f);break;case 13:yi(s,i,a,f);break;case 23:break;case 22:N=i.stateNode,I=i.alternate,i.memoizedState!==null?N._visibility&2?yi(s,i,a,f):Ol(s,i):N._visibility&2?yi(s,i,a,f):(N._visibility|=2,go(s,i,a,f,(i.subtreeFlags&10256)!==0||!1)),R&2048&&Dp(I,i);break;case 24:yi(s,i,a,f),R&2048&&Op(i.alternate,i);break;default:yi(s,i,a,f)}}function go(s,i,a,f,R){for(R=R&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var N=s,I=i,K=a,ie=f,ge=I.flags;switch(I.tag){case 0:case 11:case 15:go(N,I,K,ie,R),$l(8,I);break;case 23:break;case 22:var Ee=I.stateNode;I.memoizedState!==null?Ee._visibility&2?go(N,I,K,ie,R):Ol(N,I):(Ee._visibility|=2,go(N,I,K,ie,R)),R&&ge&2048&&Dp(I.alternate,I);break;case 24:go(N,I,K,ie,R),R&&ge&2048&&Op(I.alternate,I);break;default:go(N,I,K,ie,R)}i=i.sibling}}function Ol(s,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var a=s,f=i,R=f.flags;switch(f.tag){case 22:Ol(a,f),R&2048&&Dp(f.alternate,f);break;case 24:Ol(a,f),R&2048&&Op(f.alternate,f);break;default:Ol(a,f)}i=i.sibling}}var Ll=8192;function vo(s,i,a){if(s.subtreeFlags&Ll)for(s=s.child;s!==null;)$0(s,i,a),s=s.sibling}function $0(s,i,a){switch(s.tag){case 26:vo(s,i,a),s.flags&Ll&&s.memoizedState!==null&&Qj(a,_i,s.memoizedState,s.memoizedProps);break;case 5:vo(s,i,a);break;case 3:case 4:var f=_i;_i=Du(s.stateNode.containerInfo),vo(s,i,a),_i=f;break;case 22:s.memoizedState===null&&(f=s.alternate,f!==null&&f.memoizedState!==null?(f=Ll,Ll=16777216,vo(s,i,a),Ll=f):vo(s,i,a));break;default:vo(s,i,a)}}function D0(s){var i=s.alternate;if(i!==null&&(s=i.child,s!==null)){i.child=null;do i=s.sibling,s.sibling=null,s=i;while(s!==null)}}function Il(s){var i=s.deletions;if((s.flags&16)!==0){if(i!==null)for(var a=0;a<i.length;a++){var f=i[a];Ws=f,L0(f,s)}D0(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)O0(s),s=s.sibling}function O0(s){switch(s.tag){case 0:case 11:case 15:Il(s),s.flags&2048&&Tr(9,s,s.return);break;case 3:Il(s);break;case 12:Il(s);break;case 22:var i=s.stateNode;s.memoizedState!==null&&i._visibility&2&&(s.return===null||s.return.tag!==13)?(i._visibility&=-3,Su(s)):Il(s);break;default:Il(s)}}function Su(s){var i=s.deletions;if((s.flags&16)!==0){if(i!==null)for(var a=0;a<i.length;a++){var f=i[a];Ws=f,L0(f,s)}D0(s)}for(s=s.child;s!==null;){switch(i=s,i.tag){case 0:case 11:case 15:Tr(8,i,i.return),Su(i);break;case 22:a=i.stateNode,a._visibility&2&&(a._visibility&=-3,Su(i));break;default:Su(i)}s=s.sibling}}function L0(s,i){for(;Ws!==null;){var a=Ws;switch(a.tag){case 0:case 11:case 15:Tr(8,a,i);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var f=a.memoizedState.cachePool.pool;f!=null&&f.refCount++}break;case 24:bl(a.memoizedState.cache)}if(f=a.child,f!==null)f.return=a,Ws=f;else e:for(a=s;Ws!==null;){f=Ws;var R=f.sibling,N=f.return;if(k0(f),f===a){Ws=null;break e}if(R!==null){R.return=N,Ws=R;break e}Ws=N}}}var pj={getCacheForType:function(s){var i=en(Is),a=i.data.get(s);return a===void 0&&(a=s(),i.data.set(s,a)),a},cacheSignal:function(){return en(Is).controller.signal}},mj=typeof WeakMap=="function"?WeakMap:Map,Ut=0,ns=null,At=null,$t=0,qt=0,Un=null,Nr=!1,_o=!1,Lp=!1,Ji=0,ks=0,Mr=0,ga=0,Ip=0,Fn=0,yo=0,Pl=null,Dn=null,Pp=!1,wu=0,I0=0,xu=1/0,Cu=null,$r=null,qs=0,Dr=null,bo=null,Zi=0,Bp=0,zp=null,P0=null,Bl=0,Hp=null;function qn(){return(Ut&2)!==0&&$t!==0?$t&-$t:G.T!==null?Wp():nt()}function B0(){if(Fn===0)if(($t&536870912)===0||It){var s=rt;rt<<=1,(rt&3932160)===0&&(rt=262144),Fn=s}else Fn=536870912;return s=zn.current,s!==null&&(s.flags|=32),Fn}function On(s,i,a){(s===ns&&(qt===2||qt===9)||s.cancelPendingCommit!==null)&&(So(s,0),Or(s,$t,Fn,!1)),ds(s,a),((Ut&2)===0||s!==ns)&&(s===ns&&((Ut&2)===0&&(ga|=a),ks===4&&Or(s,$t,Fn,!1)),Mi(s))}function z0(s,i,a){if((Ut&6)!==0)throw Error(r(327));var f=!a&&(i&127)===0&&(i&s.expiredLanes)===0||cn(s,i),R=f?_j(s,i):Fp(s,i,!0),N=f;do{if(R===0){_o&&!f&&Or(s,i,0,!1);break}else{if(a=s.current.alternate,N&&!gj(a)){R=Fp(s,i,!1),N=!1;continue}if(R===2){if(N=i,s.errorRecoveryDisabledLanes&N)var I=0;else I=s.pendingLanes&-536870913,I=I!==0?I:I&536870912?536870912:0;if(I!==0){i=I;e:{var K=s;R=Pl;var ie=K.current.memoizedState.isDehydrated;if(ie&&(So(K,I).flags|=256),I=Fp(K,I,!1),I!==2){if(Lp&&!ie){K.errorRecoveryDisabledLanes|=N,ga|=N,R=4;break e}N=Dn,Dn=R,N!==null&&(Dn===null?Dn=N:Dn.push.apply(Dn,N))}R=I}if(N=!1,R!==2)continue}}if(R===1){So(s,0),Or(s,i,0,!0);break}e:{switch(f=s,N=R,N){case 0:case 1:throw Error(r(345));case 4:if((i&4194048)!==i)break;case 6:Or(f,i,Fn,!Nr);break e;case 2:Dn=null;break;case 3:case 5:break;default:throw Error(r(329))}if((i&62914560)===i&&(R=wu+300-Ct(),10<R)){if(Or(f,i,Fn,!Nr),As(f,0,!0)!==0)break e;Zi=i,f.timeoutHandle=vb(H0.bind(null,f,a,Dn,Cu,Pp,i,Fn,ga,yo,Nr,N,"Throttled",-0,0),R);break e}H0(f,a,Dn,Cu,Pp,i,Fn,ga,yo,Nr,N,null,-0,0)}}break}while(!0);Mi(s)}function H0(s,i,a,f,R,N,I,K,ie,ge,Ee,Ae,ve,we){if(s.timeoutHandle=-1,Ae=i.subtreeFlags,Ae&8192||(Ae&16785408)===16785408){Ae={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Tn},$0(i,N,Ae);var Ve=(N&62914560)===N?wu-Ct():(N&4194048)===N?I0-Ct():0;if(Ve=eR(Ae,Ve),Ve!==null){Zi=N,s.cancelPendingCommit=Ve(Y0.bind(null,s,i,N,a,f,R,I,K,ie,Ee,Ae,null,ve,we)),Or(s,N,I,!ge);return}}Y0(s,i,N,a,f,R,I,K,ie)}function gj(s){for(var i=s;;){var a=i.tag;if((a===0||a===11||a===15)&&i.flags&16384&&(a=i.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var f=0;f<a.length;f++){var R=a[f],N=R.getSnapshot;R=R.value;try{if(!Pn(N(),R))return!1}catch{return!1}}if(a=i.child,i.subtreeFlags&16384&&a!==null)a.return=i,i=a;else{if(i===s)break;for(;i.sibling===null;){if(i.return===null||i.return===s)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function Or(s,i,a,f){i&=~Ip,i&=~ga,s.suspendedLanes|=i,s.pingedLanes&=~i,f&&(s.warmLanes|=i),f=s.expirationTimes;for(var R=i;0<R;){var N=31-pt(R),I=1<<N;f[N]=-1,R&=~I}a!==0&&Os(s,a,i)}function Eu(){return(Ut&6)===0?(zl(0),!1):!0}function Up(){if(At!==null){if(qt===0)var s=At.return;else s=At,Hi=oa=null,ip(s),uo=null,wl=0,s=At;for(;s!==null;)_0(s.alternate,s),s=s.return;At=null}}function So(s,i){var a=s.timeoutHandle;a!==-1&&(s.timeoutHandle=-1,Lj(a)),a=s.cancelPendingCommit,a!==null&&(s.cancelPendingCommit=null,a()),Zi=0,Up(),ns=s,At=a=Bi(s.current,null),$t=i,qt=0,Un=null,Nr=!1,_o=cn(s,i),Lp=!1,yo=Fn=Ip=ga=Mr=ks=0,Dn=Pl=null,Pp=!1,(i&8)!==0&&(i|=i&32);var f=s.entangledLanes;if(f!==0)for(s=s.entanglements,f&=i;0<f;){var R=31-pt(f),N=1<<R;i|=s[R],f&=~N}return Ji=i,Gc(),a}function U0(s,i){yt=null,G.H=Tl,i===co||i===eu?(i=iy(),qt=3):i===Gf?(i=iy(),qt=4):qt=i===bp?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,Un=i,At===null&&(ks=1,pu(s,Zn(i,s.current)))}function F0(){var s=zn.current;return s===null?!0:($t&4194048)===$t?si===null:($t&62914560)===$t||($t&536870912)!==0?s===si:!1}function q0(){var s=G.H;return G.H=Tl,s===null?Tl:s}function V0(){var s=G.A;return G.A=pj,s}function ku(){ks=4,Nr||($t&4194048)!==$t&&zn.current!==null||(_o=!0),(Mr&134217727)===0&&(ga&134217727)===0||ns===null||Or(ns,$t,Fn,!1)}function Fp(s,i,a){var f=Ut;Ut|=2;var R=q0(),N=V0();(ns!==s||$t!==i)&&(Cu=null,So(s,i)),i=!1;var I=ks;e:do try{if(qt!==0&&At!==null){var K=At,ie=Un;switch(qt){case 8:Up(),I=6;break e;case 3:case 2:case 9:case 6:zn.current===null&&(i=!0);var ge=qt;if(qt=0,Un=null,wo(s,K,ie,ge),a&&_o){I=0;break e}break;default:ge=qt,qt=0,Un=null,wo(s,K,ie,ge)}}vj(),I=ks;break}catch(Ee){U0(s,Ee)}while(!0);return i&&s.shellSuspendCounter++,Hi=oa=null,Ut=f,G.H=R,G.A=N,At===null&&(ns=null,$t=0,Gc()),I}function vj(){for(;At!==null;)G0(At)}function _j(s,i){var a=Ut;Ut|=2;var f=q0(),R=V0();ns!==s||$t!==i?(Cu=null,xu=Ct()+500,So(s,i)):_o=cn(s,i);e:do try{if(qt!==0&&At!==null){i=At;var N=Un;t:switch(qt){case 1:qt=0,Un=null,wo(s,i,N,1);break;case 2:case 9:if(sy(N)){qt=0,Un=null,W0(i);break}i=function(){qt!==2&&qt!==9||ns!==s||(qt=7),Mi(s)},N.then(i,i);break e;case 3:qt=7;break e;case 4:qt=5;break e;case 7:sy(N)?(qt=0,Un=null,W0(i)):(qt=0,Un=null,wo(s,i,N,7));break;case 5:var I=null;switch(At.tag){case 26:I=At.memoizedState;case 5:case 27:var K=At;if(I?Mb(I):K.stateNode.complete){qt=0,Un=null;var ie=K.sibling;if(ie!==null)At=ie;else{var ge=K.return;ge!==null?(At=ge,ju(ge)):At=null}break t}}qt=0,Un=null,wo(s,i,N,5);break;case 6:qt=0,Un=null,wo(s,i,N,6);break;case 8:Up(),ks=6;break e;default:throw Error(r(462))}}yj();break}catch(Ee){U0(s,Ee)}while(!0);return Hi=oa=null,G.H=f,G.A=R,Ut=a,At!==null?0:(ns=null,$t=0,Gc(),ks)}function yj(){for(;At!==null&&!kt();)G0(At)}function G0(s){var i=g0(s.alternate,s,Ji);s.memoizedProps=s.pendingProps,i===null?ju(s):At=i}function W0(s){var i=s,a=i.alternate;switch(i.tag){case 15:case 0:i=u0(a,i,i.pendingProps,i.type,void 0,$t);break;case 11:i=u0(a,i,i.pendingProps,i.type.render,i.ref,$t);break;case 5:ip(i);default:_0(a,i),i=At=V_(i,Ji),i=g0(a,i,Ji)}s.memoizedProps=s.pendingProps,i===null?ju(s):At=i}function wo(s,i,a,f){Hi=oa=null,ip(i),uo=null,wl=0;var R=i.return;try{if(oj(s,R,i,a,$t)){ks=1,pu(s,Zn(a,s.current)),At=null;return}}catch(N){if(R!==null)throw At=R,N;ks=1,pu(s,Zn(a,s.current)),At=null;return}i.flags&32768?(It||f===1?s=!0:_o||($t&536870912)!==0?s=!1:(Nr=s=!0,(f===2||f===9||f===3||f===6)&&(f=zn.current,f!==null&&f.tag===13&&(f.flags|=16384))),K0(i,s)):ju(i)}function ju(s){var i=s;do{if((i.flags&32768)!==0){K0(i,Nr);return}s=i.return;var a=uj(i.alternate,i,Ji);if(a!==null){At=a;return}if(i=i.sibling,i!==null){At=i;return}At=i=s}while(i!==null);ks===0&&(ks=5)}function K0(s,i){do{var a=dj(s.alternate,s);if(a!==null){a.flags&=32767,At=a;return}if(a=s.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!i&&(s=s.sibling,s!==null)){At=s;return}At=s=a}while(s!==null);ks=6,At=null}function Y0(s,i,a,f,R,N,I,K,ie){s.cancelPendingCommit=null;do Ru();while(qs!==0);if((Ut&6)!==0)throw Error(r(327));if(i!==null){if(i===s.current)throw Error(r(177));if(N=i.lanes|i.childLanes,N|=Nf,pi(s,a,N,I,K,ie),s===ns&&(At=ns=null,$t=0),bo=i,Dr=s,Zi=a,Bp=N,zp=R,P0=f,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,xj(Lt,function(){return eb(),null})):(s.callbackNode=null,s.callbackPriority=0),f=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||f){f=G.T,G.T=null,R=ee.p,ee.p=2,I=Ut,Ut|=4;try{hj(s,i,a)}finally{Ut=I,ee.p=R,G.T=f}}qs=1,X0(),J0(),Z0()}}function X0(){if(qs===1){qs=0;var s=Dr,i=bo,a=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||a){a=G.T,G.T=null;var f=ee.p;ee.p=2;var R=Ut;Ut|=4;try{T0(i,s);var N=tm,I=L_(s.containerInfo),K=N.focusedElem,ie=N.selectionRange;if(I!==K&&K&&K.ownerDocument&&O_(K.ownerDocument.documentElement,K)){if(ie!==null&&kf(K)){var ge=ie.start,Ee=ie.end;if(Ee===void 0&&(Ee=ge),"selectionStart"in K)K.selectionStart=ge,K.selectionEnd=Math.min(Ee,K.value.length);else{var Ae=K.ownerDocument||document,ve=Ae&&Ae.defaultView||window;if(ve.getSelection){var we=ve.getSelection(),Ve=K.textContent.length,it=Math.min(ie.start,Ve),Qt=ie.end===void 0?it:Math.min(ie.end,Ve);!we.extend&&it>Qt&&(I=Qt,Qt=it,it=I);var fe=D_(K,it),ae=D_(K,Qt);if(fe&&ae&&(we.rangeCount!==1||we.anchorNode!==fe.node||we.anchorOffset!==fe.offset||we.focusNode!==ae.node||we.focusOffset!==ae.offset)){var me=Ae.createRange();me.setStart(fe.node,fe.offset),we.removeAllRanges(),it>Qt?(we.addRange(me),we.extend(ae.node,ae.offset)):(me.setEnd(ae.node,ae.offset),we.addRange(me))}}}}for(Ae=[],we=K;we=we.parentNode;)we.nodeType===1&&Ae.push({element:we,left:we.scrollLeft,top:we.scrollTop});for(typeof K.focus=="function"&&K.focus(),K=0;K<Ae.length;K++){var je=Ae[K];je.element.scrollLeft=je.left,je.element.scrollTop=je.top}}zu=!!em,tm=em=null}finally{Ut=R,ee.p=f,G.T=a}}s.current=i,qs=2}}function J0(){if(qs===2){qs=0;var s=Dr,i=bo,a=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||a){a=G.T,G.T=null;var f=ee.p;ee.p=2;var R=Ut;Ut|=4;try{E0(s,i.alternate,i)}finally{Ut=R,ee.p=f,G.T=a}}qs=3}}function Z0(){if(qs===4||qs===3){qs=0,ot();var s=Dr,i=bo,a=Zi,f=P0;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?qs=5:(qs=0,bo=Dr=null,Q0(s,s.pendingLanes));var R=s.pendingLanes;if(R===0&&($r=null),Xs(a),i=i.stateNode,ls&&typeof ls.onCommitFiberRoot=="function")try{ls.onCommitFiberRoot(Ds,i,void 0,(i.current.flags&128)===128)}catch{}if(f!==null){i=G.T,R=ee.p,ee.p=2,G.T=null;try{for(var N=s.onRecoverableError,I=0;I<f.length;I++){var K=f[I];N(K.value,{componentStack:K.stack})}}finally{G.T=i,ee.p=R}}(Zi&3)!==0&&Ru(),Mi(s),R=s.pendingLanes,(a&261930)!==0&&(R&42)!==0?s===Hp?Bl++:(Bl=0,Hp=s):Bl=0,zl(0)}}function Q0(s,i){(s.pooledCacheLanes&=i)===0&&(i=s.pooledCache,i!=null&&(s.pooledCache=null,bl(i)))}function Ru(){return X0(),J0(),Z0(),eb()}function eb(){if(qs!==5)return!1;var s=Dr,i=Bp;Bp=0;var a=Xs(Zi),f=G.T,R=ee.p;try{ee.p=32>a?32:a,G.T=null,a=zp,zp=null;var N=Dr,I=Zi;if(qs=0,bo=Dr=null,Zi=0,(Ut&6)!==0)throw Error(r(331));var K=Ut;if(Ut|=4,O0(N.current),M0(N,N.current,I,a),Ut=K,zl(0,!1),ls&&typeof ls.onPostCommitFiberRoot=="function")try{ls.onPostCommitFiberRoot(Ds,N)}catch{}return!0}finally{ee.p=R,G.T=f,Q0(s,i)}}function tb(s,i,a){i=Zn(a,i),i=yp(s.stateNode,i,2),s=jr(s,i,2),s!==null&&(ds(s,2),Mi(s))}function Vt(s,i,a){if(s.tag===3)tb(s,s,a);else for(;i!==null;){if(i.tag===3){tb(i,s,a);break}else if(i.tag===1){var f=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&($r===null||!$r.has(f))){s=Zn(a,s),a=s0(2),f=jr(i,a,2),f!==null&&(n0(a,f,i,s),ds(f,2),Mi(f));break}}i=i.return}}function qp(s,i,a){var f=s.pingCache;if(f===null){f=s.pingCache=new mj;var R=new Set;f.set(i,R)}else R=f.get(i),R===void 0&&(R=new Set,f.set(i,R));R.has(a)||(Lp=!0,R.add(a),s=bj.bind(null,s,i,a),i.then(s,s))}function bj(s,i,a){var f=s.pingCache;f!==null&&f.delete(i),s.pingedLanes|=s.suspendedLanes&a,s.warmLanes&=~a,ns===s&&($t&a)===a&&(ks===4||ks===3&&($t&62914560)===$t&&300>Ct()-wu?(Ut&2)===0&&So(s,0):Ip|=a,yo===$t&&(yo=0)),Mi(s)}function sb(s,i){i===0&&(i=yn()),s=ia(s,i),s!==null&&(ds(s,i),Mi(s))}function Sj(s){var i=s.memoizedState,a=0;i!==null&&(a=i.retryLane),sb(s,a)}function wj(s,i){var a=0;switch(s.tag){case 31:case 13:var f=s.stateNode,R=s.memoizedState;R!==null&&(a=R.retryLane);break;case 19:f=s.stateNode;break;case 22:f=s.stateNode._retryCache;break;default:throw Error(r(314))}f!==null&&f.delete(i),sb(s,a)}function xj(s,i){return He(s,i)}var Au=null,xo=null,Vp=!1,Tu=!1,Gp=!1,Lr=0;function Mi(s){s!==xo&&s.next===null&&(xo===null?Au=xo=s:xo=xo.next=s),Tu=!0,Vp||(Vp=!0,Ej())}function zl(s,i){if(!Gp&&Tu){Gp=!0;do for(var a=!1,f=Au;f!==null;){if(s!==0){var R=f.pendingLanes;if(R===0)var N=0;else{var I=f.suspendedLanes,K=f.pingedLanes;N=(1<<31-pt(42|s)+1)-1,N&=R&~(I&~K),N=N&201326741?N&201326741|1:N?N|2:0}N!==0&&(a=!0,ab(f,N))}else N=$t,N=As(f,f===ns?N:0,f.cancelPendingCommit!==null||f.timeoutHandle!==-1),(N&3)===0||cn(f,N)||(a=!0,ab(f,N));f=f.next}while(a);Gp=!1}}function Cj(){nb()}function nb(){Tu=Vp=!1;var s=0;Lr!==0&&Oj()&&(s=Lr);for(var i=Ct(),a=null,f=Au;f!==null;){var R=f.next,N=ib(f,i);N===0?(f.next=null,a===null?Au=R:a.next=R,R===null&&(xo=a)):(a=f,(s!==0||(N&3)!==0)&&(Tu=!0)),f=R}qs!==0&&qs!==5||zl(s),Lr!==0&&(Lr=0)}function ib(s,i){for(var a=s.suspendedLanes,f=s.pingedLanes,R=s.expirationTimes,N=s.pendingLanes&-62914561;0<N;){var I=31-pt(N),K=1<<I,ie=R[I];ie===-1?((K&a)===0||(K&f)!==0)&&(R[I]=_n(K,i)):ie<=i&&(s.expiredLanes|=K),N&=~K}if(i=ns,a=$t,a=As(s,s===i?a:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),f=s.callbackNode,a===0||s===i&&(qt===2||qt===9)||s.cancelPendingCommit!==null)return f!==null&&f!==null&&Ke(f),s.callbackNode=null,s.callbackPriority=0;if((a&3)===0||cn(s,a)){if(i=a&-a,i===s.callbackPriority)return i;switch(f!==null&&Ke(f),Xs(a)){case 2:case 8:a=jt;break;case 32:a=Lt;break;case 268435456:a=as;break;default:a=Lt}return f=rb.bind(null,s),a=He(a,f),s.callbackPriority=i,s.callbackNode=a,i}return f!==null&&f!==null&&Ke(f),s.callbackPriority=2,s.callbackNode=null,2}function rb(s,i){if(qs!==0&&qs!==5)return s.callbackNode=null,s.callbackPriority=0,null;var a=s.callbackNode;if(Ru()&&s.callbackNode!==a)return null;var f=$t;return f=As(s,s===ns?f:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),f===0?null:(z0(s,f,i),ib(s,Ct()),s.callbackNode!=null&&s.callbackNode===a?rb.bind(null,s):null)}function ab(s,i){if(Ru())return null;z0(s,i,!0)}function Ej(){Ij(function(){(Ut&6)!==0?He(Mt,Cj):nb()})}function Wp(){if(Lr===0){var s=oo;s===0&&(s=ln,ln<<=1,(ln&261888)===0&&(ln=256)),Lr=s}return Lr}function ob(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:Ga(""+s)}function lb(s,i){var a=i.ownerDocument.createElement("input");return a.name=i.name,a.value=i.value,s.id&&a.setAttribute("form",s.id),i.parentNode.insertBefore(a,i),s=new FormData(s),a.parentNode.removeChild(a),s}function kj(s,i,a,f,R){if(i==="submit"&&a&&a.stateNode===R){var N=ob((R[Yt]||null).action),I=f.submitter;I&&(i=(i=I[Yt]||null)?ob(i.formAction):I.getAttribute("formAction"),i!==null&&(N=i,I=null));var K=new ta("action","action",null,f,R);s.push({event:K,listeners:[{instance:null,listener:function(){if(f.defaultPrevented){if(Lr!==0){var ie=I?lb(R,I):new FormData(R);fp(a,{pending:!0,data:ie,method:R.method,action:N},null,ie)}}else typeof N=="function"&&(K.preventDefault(),ie=I?lb(R,I):new FormData(R),fp(a,{pending:!0,data:ie,method:R.method,action:N},N,ie))},currentTarget:R}]})}}for(var Kp=0;Kp<Tf.length;Kp++){var Yp=Tf[Kp],jj=Yp.toLowerCase(),Rj=Yp[0].toUpperCase()+Yp.slice(1);vi(jj,"on"+Rj)}vi(B_,"onAnimationEnd"),vi(z_,"onAnimationIteration"),vi(H_,"onAnimationStart"),vi("dblclick","onDoubleClick"),vi("focusin","onFocus"),vi("focusout","onBlur"),vi(qk,"onTransitionRun"),vi(Vk,"onTransitionStart"),vi(Gk,"onTransitionCancel"),vi(U_,"onTransitionEnd"),Je("onMouseEnter",["mouseout","mouseover"]),Je("onMouseLeave",["mouseout","mouseover"]),Je("onPointerEnter",["pointerout","pointerover"]),Je("onPointerLeave",["pointerout","pointerover"]),at("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),at("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),at("onBeforeInput",["compositionend","keypress","textInput","paste"]),at("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),at("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),at("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Hl="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(" "),Aj=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Hl));function cb(s,i){i=(i&4)!==0;for(var a=0;a<s.length;a++){var f=s[a],R=f.event;f=f.listeners;e:{var N=void 0;if(i)for(var I=f.length-1;0<=I;I--){var K=f[I],ie=K.instance,ge=K.currentTarget;if(K=K.listener,ie!==N&&R.isPropagationStopped())break e;N=K,R.currentTarget=ge;try{N(R)}catch(Ee){Vc(Ee)}R.currentTarget=null,N=ie}else for(I=0;I<f.length;I++){if(K=f[I],ie=K.instance,ge=K.currentTarget,K=K.listener,ie!==N&&R.isPropagationStopped())break e;N=K,R.currentTarget=ge;try{N(R)}catch(Ee){Vc(Ee)}R.currentTarget=null,N=ie}}}}function Tt(s,i){var a=i[Ts];a===void 0&&(a=i[Ts]=new Set);var f=s+"__bubble";a.has(f)||(ub(i,s,2,!1),a.add(f))}function Xp(s,i,a){var f=0;i&&(f|=4),ub(a,s,f,i)}var Nu="_reactListening"+Math.random().toString(36).slice(2);function Jp(s){if(!s[Nu]){s[Nu]=!0,Ce.forEach(function(a){a!=="selectionchange"&&(Aj.has(a)||Xp(a,!1,s),Xp(a,!0,s))});var i=s.nodeType===9?s:s.ownerDocument;i===null||i[Nu]||(i[Nu]=!0,Xp("selectionchange",!1,i))}}function ub(s,i,a,f){switch(Bb(i)){case 2:var R=nR;break;case 8:R=iR;break;default:R=hm}a=R.bind(null,i,a,s),R=void 0,!Ya||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(R=!0),f?R!==void 0?s.addEventListener(i,a,{capture:!0,passive:R}):s.addEventListener(i,a,!0):R!==void 0?s.addEventListener(i,a,{passive:R}):s.addEventListener(i,a,!1)}function Zp(s,i,a,f,R){var N=f;if((i&1)===0&&(i&2)===0&&f!==null)e:for(;;){if(f===null)return;var I=f.tag;if(I===3||I===4){var K=f.stateNode.containerInfo;if(K===R)break;if(I===4)for(I=f.return;I!==null;){var ie=I.tag;if((ie===3||ie===4)&&I.stateNode.containerInfo===R)return;I=I.return}for(;K!==null;){if(I=Pt(K),I===null)return;if(ie=I.tag,ie===5||ie===6||ie===26||ie===27){f=N=I;continue e}K=K.parentNode}}f=f.return}ul(function(){var ge=N,Ee=ll(a),Ae=[];e:{var ve=F_.get(s);if(ve!==void 0){var we=ta,Ve=s;switch(s){case"keypress":if(Qr(a)===0)break e;case"keydown":case"keyup":we=wk;break;case"focusin":Ve="focus",we=br;break;case"focusout":Ve="blur",we=br;break;case"beforeblur":case"afterblur":we=br;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":we=Ge;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":we=ys;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":we=Ek;break;case B_:case z_:case H_:we=fk;break;case U_:we=jk;break;case"scroll":case"scrollend":we=Fc;break;case"wheel":we=Ak;break;case"copy":case"cut":case"paste":we=mk;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":we=b_;break;case"toggle":case"beforetoggle":we=Nk}var it=(i&4)!==0,Qt=!it&&(s==="scroll"||s==="scrollend"),fe=it?ve!==null?ve+"Capture":null:ve;it=[];for(var ae=ge,me;ae!==null;){var je=ae;if(me=je.stateNode,je=je.tag,je!==5&&je!==26&&je!==27||me===null||fe===null||(je=vr(ae,fe),je!=null&&it.push(Ul(ae,je,me))),Qt)break;ae=ae.return}0<it.length&&(ve=new we(ve,Ve,null,a,Ee),Ae.push({event:ve,listeners:it}))}}if((i&7)===0){e:{if(ve=s==="mouseover"||s==="pointerover",we=s==="mouseout"||s==="pointerout",ve&&a!==Wa&&(Ve=a.relatedTarget||a.fromElement)&&(Pt(Ve)||Ve[dn]))break e;if((we||ve)&&(ve=Ee.window===Ee?Ee:(ve=Ee.ownerDocument)?ve.defaultView||ve.parentWindow:window,we?(Ve=a.relatedTarget||a.toElement,we=ge,Ve=Ve?Pt(Ve):null,Ve!==null&&(Qt=c(Ve),it=Ve.tag,Ve!==Qt||it!==5&&it!==27&&it!==6)&&(Ve=null)):(we=null,Ve=ge),we!==Ve)){if(it=Ge,je="onMouseLeave",fe="onMouseEnter",ae="mouse",(s==="pointerout"||s==="pointerover")&&(it=b_,je="onPointerLeave",fe="onPointerEnter",ae="pointer"),Qt=we==null?ve:he(we),me=Ve==null?ve:he(Ve),ve=new it(je,ae+"leave",we,a,Ee),ve.target=Qt,ve.relatedTarget=me,je=null,Pt(Ee)===ge&&(it=new it(fe,ae+"enter",Ve,a,Ee),it.target=me,it.relatedTarget=Qt,je=it),Qt=je,we&&Ve)t:{for(it=Tj,fe=we,ae=Ve,me=0,je=fe;je;je=it(je))me++;je=0;for(var tt=ae;tt;tt=it(tt))je++;for(;0<me-je;)fe=it(fe),me--;for(;0<je-me;)ae=it(ae),je--;for(;me--;){if(fe===ae||ae!==null&&fe===ae.alternate){it=fe;break t}fe=it(fe),ae=it(ae)}it=null}else it=null;we!==null&&db(Ae,ve,we,it,!1),Ve!==null&&Qt!==null&&db(Ae,Qt,Ve,it,!0)}}e:{if(ve=ge?he(ge):window,we=ve.nodeName&&ve.nodeName.toLowerCase(),we==="select"||we==="input"&&ve.type==="file")var zt=R_;else if(k_(ve))if(A_)zt=Hk;else{zt=Bk;var We=Pk}else we=ve.nodeName,!we||we.toLowerCase()!=="input"||ve.type!=="checkbox"&&ve.type!=="radio"?ge&&Va(ge.elementType)&&(zt=R_):zt=zk;if(zt&&(zt=zt(s,ge))){j_(Ae,zt,a,Ee);break e}We&&We(s,ve,ge),s==="focusout"&&ge&&ve.type==="number"&&ge.memoizedProps.value!=null&&il(ve,"number",ve.value)}switch(We=ge?he(ge):window,s){case"focusin":(k_(We)||We.contentEditable==="true")&&(Qa=We,jf=ge,vl=null);break;case"focusout":vl=jf=Qa=null;break;case"mousedown":Rf=!0;break;case"contextmenu":case"mouseup":case"dragend":Rf=!1,I_(Ae,a,Ee);break;case"selectionchange":if(Fk)break;case"keydown":case"keyup":I_(Ae,a,Ee)}var bt;if(xf)e:{switch(s){case"compositionstart":var Dt="onCompositionStart";break e;case"compositionend":Dt="onCompositionEnd";break e;case"compositionupdate":Dt="onCompositionUpdate";break e}Dt=void 0}else Za?C_(s,a)&&(Dt="onCompositionEnd"):s==="keydown"&&a.keyCode===229&&(Dt="onCompositionStart");Dt&&(S_&&a.locale!=="ko"&&(Za||Dt!=="onCompositionStart"?Dt==="onCompositionEnd"&&Za&&(bt=dl()):(gi=Ee,Xa="value"in gi?gi.value:gi.textContent,Za=!0)),We=Mu(ge,Dt),0<We.length&&(Dt=new y_(Dt,s,null,a,Ee),Ae.push({event:Dt,listeners:We}),bt?Dt.data=bt:(bt=E_(a),bt!==null&&(Dt.data=bt)))),(bt=$k?Dk(s,a):Ok(s,a))&&(Dt=Mu(ge,"onBeforeInput"),0<Dt.length&&(We=new y_("onBeforeInput","beforeinput",null,a,Ee),Ae.push({event:We,listeners:Dt}),We.data=bt)),kj(Ae,s,ge,a,Ee)}cb(Ae,i)})}function Ul(s,i,a){return{instance:s,listener:i,currentTarget:a}}function Mu(s,i){for(var a=i+"Capture",f=[];s!==null;){var R=s,N=R.stateNode;if(R=R.tag,R!==5&&R!==26&&R!==27||N===null||(R=vr(s,a),R!=null&&f.unshift(Ul(s,R,N)),R=vr(s,i),R!=null&&f.push(Ul(s,R,N))),s.tag===3)return f;s=s.return}return[]}function Tj(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function db(s,i,a,f,R){for(var N=i._reactName,I=[];a!==null&&a!==f;){var K=a,ie=K.alternate,ge=K.stateNode;if(K=K.tag,ie!==null&&ie===f)break;K!==5&&K!==26&&K!==27||ge===null||(ie=ge,R?(ge=vr(a,N),ge!=null&&I.unshift(Ul(a,ge,ie))):R||(ge=vr(a,N),ge!=null&&I.push(Ul(a,ge,ie)))),a=a.return}I.length!==0&&s.push({event:i,listeners:I})}var Nj=/\r\n?/g,Mj=/\u0000|\uFFFD/g;function hb(s){return(typeof s=="string"?s:""+s).replace(Nj,`
|
|
49
|
+
`).replace(Mj,"")}function fb(s,i){return i=hb(i),hb(s)===i}function Zt(s,i,a,f,R,N){switch(a){case"children":typeof f=="string"?i==="body"||i==="textarea"&&f===""||mr(s,f):(typeof f=="number"||typeof f=="bigint")&&i!=="body"&&mr(s,""+f);break;case"className":Ue(s,"class",f);break;case"tabIndex":Ue(s,"tabindex",f);break;case"dir":case"role":case"viewBox":case"width":case"height":Ue(s,a,f);break;case"style":Uc(s,f,N);break;case"data":if(i!=="object"){Ue(s,"data",f);break}case"src":case"href":if(f===""&&(i!=="a"||a!=="href")){s.removeAttribute(a);break}if(f==null||typeof f=="function"||typeof f=="symbol"||typeof f=="boolean"){s.removeAttribute(a);break}f=Ga(""+f),s.setAttribute(a,f);break;case"action":case"formAction":if(typeof f=="function"){s.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof N=="function"&&(a==="formAction"?(i!=="input"&&Zt(s,i,"name",R.name,R,null),Zt(s,i,"formEncType",R.formEncType,R,null),Zt(s,i,"formMethod",R.formMethod,R,null),Zt(s,i,"formTarget",R.formTarget,R,null)):(Zt(s,i,"encType",R.encType,R,null),Zt(s,i,"method",R.method,R,null),Zt(s,i,"target",R.target,R,null)));if(f==null||typeof f=="symbol"||typeof f=="boolean"){s.removeAttribute(a);break}f=Ga(""+f),s.setAttribute(a,f);break;case"onClick":f!=null&&(s.onclick=Tn);break;case"onScroll":f!=null&&Tt("scroll",s);break;case"onScrollEnd":f!=null&&Tt("scrollend",s);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(r(61));if(a=f.__html,a!=null){if(R.children!=null)throw Error(r(60));s.innerHTML=a}}break;case"multiple":s.multiple=f&&typeof f!="function"&&typeof f!="symbol";break;case"muted":s.muted=f&&typeof f!="function"&&typeof f!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(f==null||typeof f=="function"||typeof f=="boolean"||typeof f=="symbol"){s.removeAttribute("xlink:href");break}a=Ga(""+f),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":f!=null&&typeof f!="function"&&typeof f!="symbol"?s.setAttribute(a,""+f):s.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":f&&typeof f!="function"&&typeof f!="symbol"?s.setAttribute(a,""):s.removeAttribute(a);break;case"capture":case"download":f===!0?s.setAttribute(a,""):f!==!1&&f!=null&&typeof f!="function"&&typeof f!="symbol"?s.setAttribute(a,f):s.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":f!=null&&typeof f!="function"&&typeof f!="symbol"&&!isNaN(f)&&1<=f?s.setAttribute(a,f):s.removeAttribute(a);break;case"rowSpan":case"start":f==null||typeof f=="function"||typeof f=="symbol"||isNaN(f)?s.removeAttribute(a):s.setAttribute(a,f);break;case"popover":Tt("beforetoggle",s),Tt("toggle",s),Pe(s,"popover",f);break;case"xlinkActuate":Ze(s,"http://www.w3.org/1999/xlink","xlink:actuate",f);break;case"xlinkArcrole":Ze(s,"http://www.w3.org/1999/xlink","xlink:arcrole",f);break;case"xlinkRole":Ze(s,"http://www.w3.org/1999/xlink","xlink:role",f);break;case"xlinkShow":Ze(s,"http://www.w3.org/1999/xlink","xlink:show",f);break;case"xlinkTitle":Ze(s,"http://www.w3.org/1999/xlink","xlink:title",f);break;case"xlinkType":Ze(s,"http://www.w3.org/1999/xlink","xlink:type",f);break;case"xmlBase":Ze(s,"http://www.w3.org/XML/1998/namespace","xml:base",f);break;case"xmlLang":Ze(s,"http://www.w3.org/XML/1998/namespace","xml:lang",f);break;case"xmlSpace":Ze(s,"http://www.w3.org/XML/1998/namespace","xml:space",f);break;case"is":Pe(s,"is",f);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=Sf.get(a)||a,Pe(s,a,f))}}function Qp(s,i,a,f,R,N){switch(a){case"style":Uc(s,f,N);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(r(61));if(a=f.__html,a!=null){if(R.children!=null)throw Error(r(60));s.innerHTML=a}}break;case"children":typeof f=="string"?mr(s,f):(typeof f=="number"||typeof f=="bigint")&&mr(s,""+f);break;case"onScroll":f!=null&&Tt("scroll",s);break;case"onScrollEnd":f!=null&&Tt("scrollend",s);break;case"onClick":f!=null&&(s.onclick=Tn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Xe.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(R=a.endsWith("Capture"),i=a.slice(2,R?a.length-7:void 0),N=s[Yt]||null,N=N!=null?N[a]:null,typeof N=="function"&&s.removeEventListener(i,N,R),typeof f=="function")){typeof N!="function"&&N!==null&&(a in s?s[a]=null:s.hasAttribute(a)&&s.removeAttribute(a)),s.addEventListener(i,f,R);break e}a in s?s[a]=f:f===!0?s.setAttribute(a,""):Pe(s,a,f)}}}function sn(s,i,a){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Tt("error",s),Tt("load",s);var f=!1,R=!1,N;for(N in a)if(a.hasOwnProperty(N)){var I=a[N];if(I!=null)switch(N){case"src":f=!0;break;case"srcSet":R=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,i));default:Zt(s,i,N,I,a,null)}}R&&Zt(s,i,"srcSet",a.srcSet,a,null),f&&Zt(s,i,"src",a.src,a,null);return;case"input":Tt("invalid",s);var K=N=I=R=null,ie=null,ge=null;for(f in a)if(a.hasOwnProperty(f)){var Ee=a[f];if(Ee!=null)switch(f){case"name":R=Ee;break;case"type":I=Ee;break;case"checked":ie=Ee;break;case"defaultChecked":ge=Ee;break;case"value":N=Ee;break;case"defaultValue":K=Ee;break;case"children":case"dangerouslySetInnerHTML":if(Ee!=null)throw Error(r(137,i));break;default:Zt(s,i,f,Ee,a,null)}}Fa(s,N,K,ie,ge,I,R,!1);return;case"select":Tt("invalid",s),f=I=N=null;for(R in a)if(a.hasOwnProperty(R)&&(K=a[R],K!=null))switch(R){case"value":N=K;break;case"defaultValue":I=K;break;case"multiple":f=K;default:Zt(s,i,R,K,a,null)}i=N,a=I,s.multiple=!!f,i!=null?Ii(s,!!f,i,!1):a!=null&&Ii(s,!!f,a,!0);return;case"textarea":Tt("invalid",s),N=R=f=null;for(I in a)if(a.hasOwnProperty(I)&&(K=a[I],K!=null))switch(I){case"value":f=K;break;case"defaultValue":R=K;break;case"children":N=K;break;case"dangerouslySetInnerHTML":if(K!=null)throw Error(r(91));break;default:Zt(s,i,I,K,a,null)}Hc(s,f,R,N);return;case"option":for(ie in a)if(a.hasOwnProperty(ie)&&(f=a[ie],f!=null))switch(ie){case"selected":s.selected=f&&typeof f!="function"&&typeof f!="symbol";break;default:Zt(s,i,ie,f,a,null)}return;case"dialog":Tt("beforetoggle",s),Tt("toggle",s),Tt("cancel",s),Tt("close",s);break;case"iframe":case"object":Tt("load",s);break;case"video":case"audio":for(f=0;f<Hl.length;f++)Tt(Hl[f],s);break;case"image":Tt("error",s),Tt("load",s);break;case"details":Tt("toggle",s);break;case"embed":case"source":case"link":Tt("error",s),Tt("load",s);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ge in a)if(a.hasOwnProperty(ge)&&(f=a[ge],f!=null))switch(ge){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,i));default:Zt(s,i,ge,f,a,null)}return;default:if(Va(i)){for(Ee in a)a.hasOwnProperty(Ee)&&(f=a[Ee],f!==void 0&&Qp(s,i,Ee,f,a,void 0));return}}for(K in a)a.hasOwnProperty(K)&&(f=a[K],f!=null&&Zt(s,i,K,f,a,null))}function $j(s,i,a,f){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var R=null,N=null,I=null,K=null,ie=null,ge=null,Ee=null;for(we in a){var Ae=a[we];if(a.hasOwnProperty(we)&&Ae!=null)switch(we){case"checked":break;case"value":break;case"defaultValue":ie=Ae;default:f.hasOwnProperty(we)||Zt(s,i,we,null,f,Ae)}}for(var ve in f){var we=f[ve];if(Ae=a[ve],f.hasOwnProperty(ve)&&(we!=null||Ae!=null))switch(ve){case"type":N=we;break;case"name":R=we;break;case"checked":ge=we;break;case"defaultChecked":Ee=we;break;case"value":I=we;break;case"defaultValue":K=we;break;case"children":case"dangerouslySetInnerHTML":if(we!=null)throw Error(r(137,i));break;default:we!==Ae&&Zt(s,i,ve,we,f,Ae)}}_s(s,I,K,ie,ge,Ee,N,R);return;case"select":we=I=K=ve=null;for(N in a)if(ie=a[N],a.hasOwnProperty(N)&&ie!=null)switch(N){case"value":break;case"multiple":we=ie;default:f.hasOwnProperty(N)||Zt(s,i,N,null,f,ie)}for(R in f)if(N=f[R],ie=a[R],f.hasOwnProperty(R)&&(N!=null||ie!=null))switch(R){case"value":ve=N;break;case"defaultValue":K=N;break;case"multiple":I=N;default:N!==ie&&Zt(s,i,R,N,f,ie)}i=K,a=I,f=we,ve!=null?Ii(s,!!a,ve,!1):!!f!=!!a&&(i!=null?Ii(s,!!a,i,!0):Ii(s,!!a,a?[]:"",!1));return;case"textarea":we=ve=null;for(K in a)if(R=a[K],a.hasOwnProperty(K)&&R!=null&&!f.hasOwnProperty(K))switch(K){case"value":break;case"children":break;default:Zt(s,i,K,null,f,R)}for(I in f)if(R=f[I],N=a[I],f.hasOwnProperty(I)&&(R!=null||N!=null))switch(I){case"value":ve=R;break;case"defaultValue":we=R;break;case"children":break;case"dangerouslySetInnerHTML":if(R!=null)throw Error(r(91));break;default:R!==N&&Zt(s,i,I,R,f,N)}qa(s,ve,we);return;case"option":for(var Ve in a)if(ve=a[Ve],a.hasOwnProperty(Ve)&&ve!=null&&!f.hasOwnProperty(Ve))switch(Ve){case"selected":s.selected=!1;break;default:Zt(s,i,Ve,null,f,ve)}for(ie in f)if(ve=f[ie],we=a[ie],f.hasOwnProperty(ie)&&ve!==we&&(ve!=null||we!=null))switch(ie){case"selected":s.selected=ve&&typeof ve!="function"&&typeof ve!="symbol";break;default:Zt(s,i,ie,ve,f,we)}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 it in a)ve=a[it],a.hasOwnProperty(it)&&ve!=null&&!f.hasOwnProperty(it)&&Zt(s,i,it,null,f,ve);for(ge in f)if(ve=f[ge],we=a[ge],f.hasOwnProperty(ge)&&ve!==we&&(ve!=null||we!=null))switch(ge){case"children":case"dangerouslySetInnerHTML":if(ve!=null)throw Error(r(137,i));break;default:Zt(s,i,ge,ve,f,we)}return;default:if(Va(i)){for(var Qt in a)ve=a[Qt],a.hasOwnProperty(Qt)&&ve!==void 0&&!f.hasOwnProperty(Qt)&&Qp(s,i,Qt,void 0,f,ve);for(Ee in f)ve=f[Ee],we=a[Ee],!f.hasOwnProperty(Ee)||ve===we||ve===void 0&&we===void 0||Qp(s,i,Ee,ve,f,we);return}}for(var fe in a)ve=a[fe],a.hasOwnProperty(fe)&&ve!=null&&!f.hasOwnProperty(fe)&&Zt(s,i,fe,null,f,ve);for(Ae in f)ve=f[Ae],we=a[Ae],!f.hasOwnProperty(Ae)||ve===we||ve==null&&we==null||Zt(s,i,Ae,ve,f,we)}function pb(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Dj(){if(typeof performance.getEntriesByType=="function"){for(var s=0,i=0,a=performance.getEntriesByType("resource"),f=0;f<a.length;f++){var R=a[f],N=R.transferSize,I=R.initiatorType,K=R.duration;if(N&&K&&pb(I)){for(I=0,K=R.responseEnd,f+=1;f<a.length;f++){var ie=a[f],ge=ie.startTime;if(ge>K)break;var Ee=ie.transferSize,Ae=ie.initiatorType;Ee&&pb(Ae)&&(ie=ie.responseEnd,I+=Ee*(ie<K?1:(K-ge)/(ie-ge)))}if(--f,i+=8*(N+I)/(R.duration/1e3),s++,10<s)break}}if(0<s)return i/s/1e6}return navigator.connection&&(s=navigator.connection.downlink,typeof s=="number")?s:5}var em=null,tm=null;function $u(s){return s.nodeType===9?s:s.ownerDocument}function mb(s){switch(s){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function gb(s,i){if(s===0)switch(i){case"svg":return 1;case"math":return 2;default:return 0}return s===1&&i==="foreignObject"?0:s}function sm(s,i){return s==="textarea"||s==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.children=="bigint"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var nm=null;function Oj(){var s=window.event;return s&&s.type==="popstate"?s===nm?!1:(nm=s,!0):(nm=null,!1)}var vb=typeof setTimeout=="function"?setTimeout:void 0,Lj=typeof clearTimeout=="function"?clearTimeout:void 0,_b=typeof Promise=="function"?Promise:void 0,Ij=typeof queueMicrotask=="function"?queueMicrotask:typeof _b<"u"?function(s){return _b.resolve(null).then(s).catch(Pj)}:vb;function Pj(s){setTimeout(function(){throw s})}function Ir(s){return s==="head"}function yb(s,i){var a=i,f=0;do{var R=a.nextSibling;if(s.removeChild(a),R&&R.nodeType===8)if(a=R.data,a==="/$"||a==="/&"){if(f===0){s.removeChild(R),jo(i);return}f--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")f++;else if(a==="html")Fl(s.ownerDocument.documentElement);else if(a==="head"){a=s.ownerDocument.head,Fl(a);for(var N=a.firstChild;N;){var I=N.nextSibling,K=N.nodeName;N[Fs]||K==="SCRIPT"||K==="STYLE"||K==="LINK"&&N.rel.toLowerCase()==="stylesheet"||a.removeChild(N),N=I}}else a==="body"&&Fl(s.ownerDocument.body);a=R}while(a);jo(i)}function bb(s,i){var a=s;s=0;do{var f=a.nextSibling;if(a.nodeType===1?i?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(i?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),f&&f.nodeType===8)if(a=f.data,a==="/$"){if(s===0)break;s--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||s++;a=f}while(a)}function im(s){var i=s.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var a=i;switch(i=i.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":im(a),xs(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}s.removeChild(a)}}function Bj(s,i,a,f){for(;s.nodeType===1;){var R=a;if(s.nodeName.toLowerCase()!==i.toLowerCase()){if(!f&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(f){if(!s[Fs])switch(i){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(N=s.getAttribute("rel"),N==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(N!==R.rel||s.getAttribute("href")!==(R.href==null||R.href===""?null:R.href)||s.getAttribute("crossorigin")!==(R.crossOrigin==null?null:R.crossOrigin)||s.getAttribute("title")!==(R.title==null?null:R.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(N=s.getAttribute("src"),(N!==(R.src==null?null:R.src)||s.getAttribute("type")!==(R.type==null?null:R.type)||s.getAttribute("crossorigin")!==(R.crossOrigin==null?null:R.crossOrigin))&&N&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(i==="input"&&s.type==="hidden"){var N=R.name==null?null:""+R.name;if(R.type==="hidden"&&s.getAttribute("name")===N)return s}else return s;if(s=ni(s.nextSibling),s===null)break}return null}function zj(s,i,a){if(i==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!a||(s=ni(s.nextSibling),s===null))return null;return s}function Sb(s,i){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!i||(s=ni(s.nextSibling),s===null))return null;return s}function rm(s){return s.data==="$?"||s.data==="$~"}function am(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function Hj(s,i){var a=s.ownerDocument;if(s.data==="$~")s._reactRetry=i;else if(s.data!=="$?"||a.readyState!=="loading")i();else{var f=function(){i(),a.removeEventListener("DOMContentLoaded",f)};a.addEventListener("DOMContentLoaded",f),s._reactRetry=f}}function ni(s){for(;s!=null;s=s.nextSibling){var i=s.nodeType;if(i===1||i===3)break;if(i===8){if(i=s.data,i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"||i==="F!"||i==="F")break;if(i==="/$"||i==="/&")return null}}return s}var om=null;function wb(s){s=s.nextSibling;for(var i=0;s;){if(s.nodeType===8){var a=s.data;if(a==="/$"||a==="/&"){if(i===0)return ni(s.nextSibling);i--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||i++}s=s.nextSibling}return null}function xb(s){s=s.previousSibling;for(var i=0;s;){if(s.nodeType===8){var a=s.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(i===0)return s;i--}else a!=="/$"&&a!=="/&"||i++}s=s.previousSibling}return null}function Cb(s,i,a){switch(i=$u(a),s){case"html":if(s=i.documentElement,!s)throw Error(r(452));return s;case"head":if(s=i.head,!s)throw Error(r(453));return s;case"body":if(s=i.body,!s)throw Error(r(454));return s;default:throw Error(r(451))}}function Fl(s){for(var i=s.attributes;i.length;)s.removeAttributeNode(i[0]);xs(s)}var ii=new Map,Eb=new Set;function Du(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var Qi=ee.d;ee.d={f:Uj,r:Fj,D:qj,C:Vj,L:Gj,m:Wj,X:Yj,S:Kj,M:Xj};function Uj(){var s=Qi.f(),i=Eu();return s||i}function Fj(s){var i=re(s);i!==null&&i.tag===5&&i.type==="form"?Uy(i):Qi.r(s)}var Co=typeof document>"u"?null:document;function kb(s,i,a){var f=Co;if(f&&typeof i=="string"&&i){var R=ct(i);R='link[rel="'+s+'"][href="'+R+'"]',typeof a=="string"&&(R+='[crossorigin="'+a+'"]'),Eb.has(R)||(Eb.add(R),s={rel:s,crossOrigin:a,href:i},f.querySelector(R)===null&&(i=f.createElement("link"),sn(i,"link",s),be(i),f.head.appendChild(i)))}}function qj(s){Qi.D(s),kb("dns-prefetch",s,null)}function Vj(s,i){Qi.C(s,i),kb("preconnect",s,i)}function Gj(s,i,a){Qi.L(s,i,a);var f=Co;if(f&&s&&i){var R='link[rel="preload"][as="'+ct(i)+'"]';i==="image"&&a&&a.imageSrcSet?(R+='[imagesrcset="'+ct(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(R+='[imagesizes="'+ct(a.imageSizes)+'"]')):R+='[href="'+ct(s)+'"]';var N=R;switch(i){case"style":N=Eo(s);break;case"script":N=ko(s)}ii.has(N)||(s=p({rel:"preload",href:i==="image"&&a&&a.imageSrcSet?void 0:s,as:i},a),ii.set(N,s),f.querySelector(R)!==null||i==="style"&&f.querySelector(ql(N))||i==="script"&&f.querySelector(Vl(N))||(i=f.createElement("link"),sn(i,"link",s),be(i),f.head.appendChild(i)))}}function Wj(s,i){Qi.m(s,i);var a=Co;if(a&&s){var f=i&&typeof i.as=="string"?i.as:"script",R='link[rel="modulepreload"][as="'+ct(f)+'"][href="'+ct(s)+'"]',N=R;switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":N=ko(s)}if(!ii.has(N)&&(s=p({rel:"modulepreload",href:s},i),ii.set(N,s),a.querySelector(R)===null)){switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Vl(N)))return}f=a.createElement("link"),sn(f,"link",s),be(f),a.head.appendChild(f)}}}function Kj(s,i,a){Qi.S(s,i,a);var f=Co;if(f&&s){var R=xe(f).hoistableStyles,N=Eo(s);i=i||"default";var I=R.get(N);if(!I){var K={loading:0,preload:null};if(I=f.querySelector(ql(N)))K.loading=5;else{s=p({rel:"stylesheet",href:s,"data-precedence":i},a),(a=ii.get(N))&&lm(s,a);var ie=I=f.createElement("link");be(ie),sn(ie,"link",s),ie._p=new Promise(function(ge,Ee){ie.onload=ge,ie.onerror=Ee}),ie.addEventListener("load",function(){K.loading|=1}),ie.addEventListener("error",function(){K.loading|=2}),K.loading|=4,Ou(I,i,f)}I={type:"stylesheet",instance:I,count:1,state:K},R.set(N,I)}}}function Yj(s,i){Qi.X(s,i);var a=Co;if(a&&s){var f=xe(a).hoistableScripts,R=ko(s),N=f.get(R);N||(N=a.querySelector(Vl(R)),N||(s=p({src:s,async:!0},i),(i=ii.get(R))&&cm(s,i),N=a.createElement("script"),be(N),sn(N,"link",s),a.head.appendChild(N)),N={type:"script",instance:N,count:1,state:null},f.set(R,N))}}function Xj(s,i){Qi.M(s,i);var a=Co;if(a&&s){var f=xe(a).hoistableScripts,R=ko(s),N=f.get(R);N||(N=a.querySelector(Vl(R)),N||(s=p({src:s,async:!0,type:"module"},i),(i=ii.get(R))&&cm(s,i),N=a.createElement("script"),be(N),sn(N,"link",s),a.head.appendChild(N)),N={type:"script",instance:N,count:1,state:null},f.set(R,N))}}function jb(s,i,a,f){var R=(R=se.current)?Du(R):null;if(!R)throw Error(r(446));switch(s){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(i=Eo(a.href),a=xe(R).hoistableStyles,f=a.get(i),f||(f={type:"style",instance:null,count:0,state:null},a.set(i,f)),f):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){s=Eo(a.href);var N=xe(R).hoistableStyles,I=N.get(s);if(I||(R=R.ownerDocument||R,I={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},N.set(s,I),(N=R.querySelector(ql(s)))&&!N._p&&(I.instance=N,I.state.loading=5),ii.has(s)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},ii.set(s,a),N||Jj(R,s,a,I.state))),i&&f===null)throw Error(r(528,""));return I}if(i&&f!==null)throw Error(r(529,""));return null;case"script":return i=a.async,a=a.src,typeof a=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=ko(a),a=xe(R).hoistableScripts,f=a.get(i),f||(f={type:"script",instance:null,count:0,state:null},a.set(i,f)),f):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,s))}}function Eo(s){return'href="'+ct(s)+'"'}function ql(s){return'link[rel="stylesheet"]['+s+"]"}function Rb(s){return p({},s,{"data-precedence":s.precedence,precedence:null})}function Jj(s,i,a,f){s.querySelector('link[rel="preload"][as="style"]['+i+"]")?f.loading=1:(i=s.createElement("link"),f.preload=i,i.addEventListener("load",function(){return f.loading|=1}),i.addEventListener("error",function(){return f.loading|=2}),sn(i,"link",a),be(i),s.head.appendChild(i))}function ko(s){return'[src="'+ct(s)+'"]'}function Vl(s){return"script[async]"+s}function Ab(s,i,a){if(i.count++,i.instance===null)switch(i.type){case"style":var f=s.querySelector('style[data-href~="'+ct(a.href)+'"]');if(f)return i.instance=f,be(f),f;var R=p({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return f=(s.ownerDocument||s).createElement("style"),be(f),sn(f,"style",R),Ou(f,a.precedence,s),i.instance=f;case"stylesheet":R=Eo(a.href);var N=s.querySelector(ql(R));if(N)return i.state.loading|=4,i.instance=N,be(N),N;f=Rb(a),(R=ii.get(R))&&lm(f,R),N=(s.ownerDocument||s).createElement("link"),be(N);var I=N;return I._p=new Promise(function(K,ie){I.onload=K,I.onerror=ie}),sn(N,"link",f),i.state.loading|=4,Ou(N,a.precedence,s),i.instance=N;case"script":return N=ko(a.src),(R=s.querySelector(Vl(N)))?(i.instance=R,be(R),R):(f=a,(R=ii.get(N))&&(f=p({},a),cm(f,R)),s=s.ownerDocument||s,R=s.createElement("script"),be(R),sn(R,"link",f),s.head.appendChild(R),i.instance=R);case"void":return null;default:throw Error(r(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(f=i.instance,i.state.loading|=4,Ou(f,a.precedence,s));return i.instance}function Ou(s,i,a){for(var f=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),R=f.length?f[f.length-1]:null,N=R,I=0;I<f.length;I++){var K=f[I];if(K.dataset.precedence===i)N=K;else if(N!==R)break}N?N.parentNode.insertBefore(s,N.nextSibling):(i=a.nodeType===9?a.head:a,i.insertBefore(s,i.firstChild))}function lm(s,i){s.crossOrigin==null&&(s.crossOrigin=i.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=i.referrerPolicy),s.title==null&&(s.title=i.title)}function cm(s,i){s.crossOrigin==null&&(s.crossOrigin=i.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=i.referrerPolicy),s.integrity==null&&(s.integrity=i.integrity)}var Lu=null;function Tb(s,i,a){if(Lu===null){var f=new Map,R=Lu=new Map;R.set(a,f)}else R=Lu,f=R.get(a),f||(f=new Map,R.set(a,f));if(f.has(s))return f;for(f.set(s,null),a=a.getElementsByTagName(s),R=0;R<a.length;R++){var N=a[R];if(!(N[Fs]||N[Et]||s==="link"&&N.getAttribute("rel")==="stylesheet")&&N.namespaceURI!=="http://www.w3.org/2000/svg"){var I=N.getAttribute(i)||"";I=s+I;var K=f.get(I);K?K.push(N):f.set(I,[N])}}return f}function Nb(s,i,a){s=s.ownerDocument||s,s.head.insertBefore(a,i==="title"?s.querySelector("head > title"):null)}function Zj(s,i,a){if(a===1||i.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;switch(i.rel){case"stylesheet":return s=i.disabled,typeof i.precedence=="string"&&s==null;default:return!0}case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function Mb(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function Qj(s,i,a,f){if(a.type==="stylesheet"&&(typeof f.media!="string"||matchMedia(f.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var R=Eo(f.href),N=i.querySelector(ql(R));if(N){i=N._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(s.count++,s=Iu.bind(s),i.then(s,s)),a.state.loading|=4,a.instance=N,be(N);return}N=i.ownerDocument||i,f=Rb(f),(R=ii.get(R))&&lm(f,R),N=N.createElement("link"),be(N);var I=N;I._p=new Promise(function(K,ie){I.onload=K,I.onerror=ie}),sn(N,"link",f),a.instance=N}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(a,i),(i=a.state.preload)&&(a.state.loading&3)===0&&(s.count++,a=Iu.bind(s),i.addEventListener("load",a),i.addEventListener("error",a))}}var um=0;function eR(s,i){return s.stylesheets&&s.count===0&&Bu(s,s.stylesheets),0<s.count||0<s.imgCount?function(a){var f=setTimeout(function(){if(s.stylesheets&&Bu(s,s.stylesheets),s.unsuspend){var N=s.unsuspend;s.unsuspend=null,N()}},6e4+i);0<s.imgBytes&&um===0&&(um=62500*Dj());var R=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&Bu(s,s.stylesheets),s.unsuspend)){var N=s.unsuspend;s.unsuspend=null,N()}},(s.imgBytes>um?50:800)+i);return s.unsuspend=a,function(){s.unsuspend=null,clearTimeout(f),clearTimeout(R)}}:null}function Iu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Bu(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var Pu=null;function Bu(s,i){s.stylesheets=null,s.unsuspend!==null&&(s.count++,Pu=new Map,i.forEach(tR,s),Pu=null,Iu.call(s))}function tR(s,i){if(!(i.state.loading&4)){var a=Pu.get(s);if(a)var f=a.get(null);else{a=new Map,Pu.set(s,a);for(var R=s.querySelectorAll("link[data-precedence],style[data-precedence]"),N=0;N<R.length;N++){var I=R[N];(I.nodeName==="LINK"||I.getAttribute("media")!=="not all")&&(a.set(I.dataset.precedence,I),f=I)}f&&a.set(null,f)}R=i.instance,I=R.getAttribute("data-precedence"),N=a.get(I)||f,N===f&&a.set(null,R),a.set(I,R),this.count++,f=Iu.bind(this),R.addEventListener("load",f),R.addEventListener("error",f),N?N.parentNode.insertBefore(R,N.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(R,s.firstChild)),i.state.loading|=4}}var Gl={$$typeof:_,Provider:null,Consumer:null,_currentValue:ne,_currentValue2:ne,_threadCount:0};function sR(s,i,a,f,R,N,I,K,ie){this.tag=1,this.containerInfo=s,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=bn(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=bn(0),this.hiddenUpdates=bn(null),this.identifierPrefix=f,this.onUncaughtError=R,this.onCaughtError=N,this.onRecoverableError=I,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=ie,this.incompleteTransitions=new Map}function $b(s,i,a,f,R,N,I,K,ie,ge,Ee,Ae){return s=new sR(s,i,a,I,ie,ge,Ee,Ae,K),i=1,N===!0&&(i|=24),N=Bn(3,null,null,i),s.current=N,N.stateNode=s,i=Ff(),i.refCount++,s.pooledCache=i,i.refCount++,N.memoizedState={element:f,isDehydrated:a,cache:i},Wf(N),s}function Db(s){return s?(s=so,s):so}function Ob(s,i,a,f,R,N){R=Db(R),f.context===null?f.context=R:f.pendingContext=R,f=kr(i),f.payload={element:a},N=N===void 0?null:N,N!==null&&(f.callback=N),a=jr(s,f,i),a!==null&&(On(a,s,i),Cl(a,s,i))}function Lb(s,i){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var a=s.retryLane;s.retryLane=a!==0&&a<i?a:i}}function dm(s,i){Lb(s,i),(s=s.alternate)&&Lb(s,i)}function Ib(s){if(s.tag===13||s.tag===31){var i=ia(s,67108864);i!==null&&On(i,s,67108864),dm(s,67108864)}}function Pb(s){if(s.tag===13||s.tag===31){var i=qn();i=Qe(i);var a=ia(s,i);a!==null&&On(a,s,i),dm(s,i)}}var zu=!0;function nR(s,i,a,f){var R=G.T;G.T=null;var N=ee.p;try{ee.p=2,hm(s,i,a,f)}finally{ee.p=N,G.T=R}}function iR(s,i,a,f){var R=G.T;G.T=null;var N=ee.p;try{ee.p=8,hm(s,i,a,f)}finally{ee.p=N,G.T=R}}function hm(s,i,a,f){if(zu){var R=fm(f);if(R===null)Zp(s,i,f,Hu,a),zb(s,f);else if(aR(R,s,i,a,f))f.stopPropagation();else if(zb(s,f),i&4&&-1<rR.indexOf(s)){for(;R!==null;){var N=re(R);if(N!==null)switch(N.tag){case 3:if(N=N.stateNode,N.current.memoizedState.isDehydrated){var I=us(N.pendingLanes);if(I!==0){var K=N;for(K.pendingLanes|=2,K.entangledLanes|=2;I;){var ie=1<<31-pt(I);K.entanglements[1]|=ie,I&=~ie}Mi(N),(Ut&6)===0&&(xu=Ct()+500,zl(0))}}break;case 31:case 13:K=ia(N,2),K!==null&&On(K,N,2),Eu(),dm(N,2)}if(N=fm(f),N===null&&Zp(s,i,f,Hu,a),N===R)break;R=N}R!==null&&f.stopPropagation()}else Zp(s,i,f,null,a)}}function fm(s){return s=ll(s),pm(s)}var Hu=null;function pm(s){if(Hu=null,s=Pt(s),s!==null){var i=c(s);if(i===null)s=null;else{var a=i.tag;if(a===13){if(s=h(i),s!==null)return s;s=null}else if(a===31){if(s=l(i),s!==null)return s;s=null}else if(a===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;s=null}else i!==s&&(s=null)}}return Hu=s,null}function Bb(s){switch(s){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(wt()){case Mt:return 2;case jt:return 8;case Lt:case ss:return 32;case as:return 268435456;default:return 32}default:return 32}}var mm=!1,Pr=null,Br=null,zr=null,Wl=new Map,Kl=new Map,Hr=[],rR="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 zb(s,i){switch(s){case"focusin":case"focusout":Pr=null;break;case"dragenter":case"dragleave":Br=null;break;case"mouseover":case"mouseout":zr=null;break;case"pointerover":case"pointerout":Wl.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":Kl.delete(i.pointerId)}}function Yl(s,i,a,f,R,N){return s===null||s.nativeEvent!==N?(s={blockedOn:i,domEventName:a,eventSystemFlags:f,nativeEvent:N,targetContainers:[R]},i!==null&&(i=re(i),i!==null&&Ib(i)),s):(s.eventSystemFlags|=f,i=s.targetContainers,R!==null&&i.indexOf(R)===-1&&i.push(R),s)}function aR(s,i,a,f,R){switch(i){case"focusin":return Pr=Yl(Pr,s,i,a,f,R),!0;case"dragenter":return Br=Yl(Br,s,i,a,f,R),!0;case"mouseover":return zr=Yl(zr,s,i,a,f,R),!0;case"pointerover":var N=R.pointerId;return Wl.set(N,Yl(Wl.get(N)||null,s,i,a,f,R)),!0;case"gotpointercapture":return N=R.pointerId,Kl.set(N,Yl(Kl.get(N)||null,s,i,a,f,R)),!0}return!1}function Hb(s){var i=Pt(s.target);if(i!==null){var a=c(i);if(a!==null){if(i=a.tag,i===13){if(i=h(a),i!==null){s.blockedOn=i,Sn(s.priority,function(){Pb(a)});return}}else if(i===31){if(i=l(a),i!==null){s.blockedOn=i,Sn(s.priority,function(){Pb(a)});return}}else if(i===3&&a.stateNode.current.memoizedState.isDehydrated){s.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}s.blockedOn=null}function Uu(s){if(s.blockedOn!==null)return!1;for(var i=s.targetContainers;0<i.length;){var a=fm(s.nativeEvent);if(a===null){a=s.nativeEvent;var f=new a.constructor(a.type,a);Wa=f,a.target.dispatchEvent(f),Wa=null}else return i=re(a),i!==null&&Ib(i),s.blockedOn=a,!1;i.shift()}return!0}function Ub(s,i,a){Uu(s)&&a.delete(i)}function oR(){mm=!1,Pr!==null&&Uu(Pr)&&(Pr=null),Br!==null&&Uu(Br)&&(Br=null),zr!==null&&Uu(zr)&&(zr=null),Wl.forEach(Ub),Kl.forEach(Ub)}function Fu(s,i){s.blockedOn===i&&(s.blockedOn=null,mm||(mm=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,oR)))}var qu=null;function Fb(s){qu!==s&&(qu=s,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){qu===s&&(qu=null);for(var i=0;i<s.length;i+=3){var a=s[i],f=s[i+1],R=s[i+2];if(typeof f!="function"){if(pm(f||a)===null)continue;break}var N=re(a);N!==null&&(s.splice(i,3),i-=3,fp(N,{pending:!0,data:R,method:a.method,action:f},f,R))}}))}function jo(s){function i(ie){return Fu(ie,s)}Pr!==null&&Fu(Pr,s),Br!==null&&Fu(Br,s),zr!==null&&Fu(zr,s),Wl.forEach(i),Kl.forEach(i);for(var a=0;a<Hr.length;a++){var f=Hr[a];f.blockedOn===s&&(f.blockedOn=null)}for(;0<Hr.length&&(a=Hr[0],a.blockedOn===null);)Hb(a),a.blockedOn===null&&Hr.shift();if(a=(s.ownerDocument||s).$$reactFormReplay,a!=null)for(f=0;f<a.length;f+=3){var R=a[f],N=a[f+1],I=R[Yt]||null;if(typeof N=="function")I||Fb(a);else if(I){var K=null;if(N&&N.hasAttribute("formAction")){if(R=N,I=N[Yt]||null)K=I.formAction;else if(pm(R)!==null)continue}else K=I.action;typeof K=="function"?a[f+1]=K:(a.splice(f,3),f-=3),Fb(a)}}}function qb(){function s(N){N.canIntercept&&N.info==="react-transition"&&N.intercept({handler:function(){return new Promise(function(I){return R=I})},focusReset:"manual",scroll:"manual"})}function i(){R!==null&&(R(),R=null),f||setTimeout(a,20)}function a(){if(!f&&!navigation.transition){var N=navigation.currentEntry;N&&N.url!=null&&navigation.navigate(N.url,{state:N.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var f=!1,R=null;return navigation.addEventListener("navigate",s),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(a,100),function(){f=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),R!==null&&(R(),R=null)}}}function gm(s){this._internalRoot=s}Vu.prototype.render=gm.prototype.render=function(s){var i=this._internalRoot;if(i===null)throw Error(r(409));var a=i.current,f=qn();Ob(a,f,s,i,null,null)},Vu.prototype.unmount=gm.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var i=s.containerInfo;Ob(s.current,2,null,s,null,null),Eu(),i[dn]=null}};function Vu(s){this._internalRoot=s}Vu.prototype.unstable_scheduleHydration=function(s){if(s){var i=nt();s={blockedOn:null,target:s,priority:i};for(var a=0;a<Hr.length&&i!==0&&i<Hr[a].priority;a++);Hr.splice(a,0,s),a===0&&Hb(s)}};var Vb=t.version;if(Vb!=="19.2.7")throw Error(r(527,Vb,"19.2.7"));ee.findDOMNode=function(s){var i=s._reactInternals;if(i===void 0)throw typeof s.render=="function"?Error(r(188)):(s=Object.keys(s).join(","),Error(r(268,s)));return s=m(i),s=s!==null?g(s):null,s=s===null?null:s.stateNode,s};var lR={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:G,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Gu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Gu.isDisabled&&Gu.supportsFiber)try{Ds=Gu.inject(lR),ls=Gu}catch{}}return Jl.createRoot=function(s,i){if(!o(s))throw Error(r(299));var a=!1,f="",R=Zy,N=Qy,I=e0;return i!=null&&(i.unstable_strictMode===!0&&(a=!0),i.identifierPrefix!==void 0&&(f=i.identifierPrefix),i.onUncaughtError!==void 0&&(R=i.onUncaughtError),i.onCaughtError!==void 0&&(N=i.onCaughtError),i.onRecoverableError!==void 0&&(I=i.onRecoverableError)),i=$b(s,1,!1,null,null,a,f,null,R,N,I,qb),s[dn]=i.current,Jp(s),new gm(i)},Jl.hydrateRoot=function(s,i,a){if(!o(s))throw Error(r(299));var f=!1,R="",N=Zy,I=Qy,K=e0,ie=null;return a!=null&&(a.unstable_strictMode===!0&&(f=!0),a.identifierPrefix!==void 0&&(R=a.identifierPrefix),a.onUncaughtError!==void 0&&(N=a.onUncaughtError),a.onCaughtError!==void 0&&(I=a.onCaughtError),a.onRecoverableError!==void 0&&(K=a.onRecoverableError),a.formState!==void 0&&(ie=a.formState)),i=$b(s,1,!0,i,a??null,f,R,ie,N,I,K,qb),i.context=Db(null),a=i.current,f=qn(),f=Qe(f),R=kr(f),R.callback=null,jr(a,R,f),a=f,i.current.lanes=a,ds(i,a),Mi(i),s[dn]=i.current,Jp(s),new Vu(i)},Jl.version="19.2.7",Jl}var t1;function bR(){if(t1)return bm.exports;t1=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),bm.exports=yR(),bm.exports}var SR=bR();const tC="sapiom-harness-theme",kg=new Set;function wR(){var e;return typeof window<"u"&&((e=window.matchMedia)==null?void 0:e.call(window,"(prefers-color-scheme: dark)").matches)===!0}function xR(){const e=typeof window<"u"?window.localStorage.getItem(tC):null;return e==="light"||e==="dark"?e:wR()?"dark":"light"}let Nv=xR();function rf(){return Nv}function CR(e){Nv=e,document.documentElement.dataset.theme=e,window.localStorage.setItem(tC,e),kg.forEach(t=>t(e))}function sC(){CR(Nv==="dark"?"light":"dark")}function Mv(e){return kg.add(e),()=>kg.delete(e)}function Ia(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Jo(e,t){const n=new Set(t);return Object.keys(e).every(r=>n.has(r))}function ER(e){return!Ia(e)||!Jo(e,["id","agentKey","label"])||typeof e.id!="string"||typeof e.agentKey!="string"||typeof e.label!="string"?null:{id:e.id,agentKey:e.agentKey,label:e.label}}function kR(e){return!Ia(e)||!Jo(e,["from","to","kind","basis","mode"])||typeof e.from!="string"||typeof e.to!="string"||e.kind!=="invokes"||e.basis!=="static"||e.mode!=="blocking"&&e.mode!=="async"?null:{from:e.from,to:e.to,kind:"invokes",basis:"static",mode:e.mode}}const jR=new Set(["unresolved-target","dynamic-target","duplicate-edge","projection-failed","duplicate-agent-key","inventory-extraction-failed"]);function RR(e){return!Ia(e)||!Jo(e,["code","message","agentKey"])||typeof e.code!="string"||!jR.has(e.code)||typeof e.message!="string"||e.agentKey!==void 0&&typeof e.agentKey!="string"?null:{code:e.code,message:e.message,...typeof e.agentKey=="string"?{agentKey:e.agentKey}:{}}}const s1={blocking:0,async:1},n1=(e,t)=>e===t?0:e<t?-1:1;function nC(e){const t=new Map;for(const n of e){const r=`${n.from}\0${n.to}`,o=t.get(r)??{from:n.from,to:n.to,modes:new Set};o.modes.add(n.mode),t.set(r,o)}return[...t.values()].sort((n,r)=>n1(n.from,r.from)||n1(n.to,r.to)).map(({from:n,to:r,modes:o})=>({from:n,to:r,modes:[...o].sort((c,h)=>s1[c]-s1[h])}))}function AR(e){if(!Ia(e)||!Jo(e,["kind","scope","nodes","edges","warnings"]))throw new Error("Invalid system graph response");if(e.kind!=="system"||!Ia(e.scope))throw new Error("Invalid system graph response");if(!Jo(e.scope,["kind","workspaceKey"]))throw new Error("Invalid system graph response");if(e.scope.kind!=="working-tree"||typeof e.scope.workspaceKey!="string")throw new Error("Invalid system graph response");if(!Array.isArray(e.nodes)||!Array.isArray(e.edges)||!Array.isArray(e.warnings))throw new Error("Invalid system graph response");const t=e.nodes.map(ER),n=e.edges.map(kR),r=e.warnings.map(RR);if(t.some(u=>u===null)||n.some(u=>u===null)||r.some(u=>u===null))throw new Error("Invalid system graph response");const o=t,c=n,h=r,l=new Set(o.map(u=>u.id));if(l.size!==o.length||c.some(u=>!l.has(u.from)||!l.has(u.to)))throw new Error("Invalid system graph response");return{kind:"system",scope:{kind:"working-tree",workspaceKey:e.scope.workspaceKey},nodes:o,edges:c,warnings:h}}const TR=new Set(["building","ready","stale","degraded"]);function NR(e){if(!Ia(e)||!Jo(e,["workspaceKey","revision","state","graph"])||typeof e.workspaceKey!="string"||!Number.isSafeInteger(e.revision)||e.revision<0||typeof e.state!="string"||!TR.has(e.state)||e.graph!==null&&!Ia(e.graph))throw new Error("Invalid system graph response");const t=e.state,n=e.graph===null?null:AR(e.graph);if(t==="building"&&n!==null||(t==="ready"||t==="stale")&&n===null)throw new Error("Invalid system graph response");if(n&&n.scope.workspaceKey!==e.workspaceKey)throw new Error("Invalid system graph response");return{workspaceKey:e.workspaceKey,revision:e.revision,state:t,graph:n}}function iC(e){return e.includes("\\")?"\\":"/"}function $v(e,t){return`${e.trim().replace(/[\\/]+$/,"")}${iC(e)}${t.trim()}`}function Us(e){return e.split(/[\\/]/).filter(Boolean).pop()??e}function Gr(e){const t=e.replace(/[\\/]+$/,"");if(t===""||/^[A-Za-z]:$/.test(t))return null;const n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));if(n<0)return null;const r=t.slice(0,n);return/^[A-Za-z]:$/.test(r)?r+t[n]:r||"/"}function Pa(e){const t=e.replace(/[\\/]+$/,"");return t===e?e:t===""?e[0]:/^[A-Za-z]:$/.test(t)?t+e[t.length]:t}function jn(e,t){return Pa(e.replace(/\\/g,"/"))===Pa(t.replace(/\\/g,"/"))}function Li(e,t){const n=Pa(e.replace(/\\/g,"/")),r=Pa(t.replace(/\\/g,"/"));return r===n?!0:n.endsWith("/")?r.startsWith(n):r.startsWith(`${n}/`)}function MR(e){return e.startsWith("/")||e.startsWith("~")||/^[A-Za-z]:[\\/]/.test(e)}function $R(e){const t=iC(e),n=e.split(/[\\/]/).filter(Boolean);return n.length<=2?e:`${t==="\\"?"":t}${n[0]}${t}…${t}${n[n.length-1]}`}const hh="application/x-sapiom-agent-move";function DR(e,t,n){const r=Us(e),o=$v(t,r);if(jn(e,t))return{ok:!1,reason:`Can't move ${r} into itself.`};const c=Gr(e);if(c!=null&&jn(c,t))return{ok:!1,reason:""};if(Li(e,t))return{ok:!1,reason:`Can't move ${r} inside itself.`};const h=l=>Li(e,l);return n.some(l=>!h(l)&&Li(o,l))?{ok:!1,reason:`${Us(t)} already has an agent called ${r}.`}:{ok:!0,from:e,to:o,name:r}}const rC=Date.now(),rn=e=>new Date(rC-e*6e4).toISOString(),ut=e=>new Date(rC-e*24*60*6e4).toISOString(),i1="/Users/demo/acme-app";rn(1),rn(1),rn(42),rn(20),ut(2),ut(1),ut(1),ut(1),ut(3),ut(3),rn(0),rn(0),rn(3),rn(3);const aC=["design-eng","design-eng-fix","design-eng-ij","design-eng-main","worktrees/design-agent-port-pin","worktrees/design-agent-terminology"];function Tc(){return typeof window>"u"?!1:new URLSearchParams(window.location.search).get("mockFixtures")==="flood"}const OR=()=>Object.fromEntries([...aC.flatMap(e=>{const t=e.split("/"),n=`/Users/demo/${e}`;return[...t.length>1?[[`/Users/demo/${t[0]}`,[t[1]]]]:[],[n,["ari"]],[`${n}/ari`,["orchestration","brain"]],[`${n}/ari/orchestration`,[]],[`${n}/ari/brain`,[]]]}),["/Users/demo/team-tools",["slack-notifier"]],["/Users/demo/other-tools",["slack-notifier"]],["/Users/demo/misc",Array.from({length:10},(e,t)=>`pkg${t+1}`)],...Array.from({length:10},(e,t)=>[`/Users/demo/misc/pkg${t+1}`,["agent"]])]);({"/Users/demo":[...Tc()?["design-eng","design-eng-fix","design-eng-ij","design-eng-main","worktrees","misc","team-tools","other-tools"]:[]],...Tc()?OR():{}});rn(1),ut(1),ut(1),ut(3),ut(6),ut(45),ut(1);rn(48),rn(1),rn(48),rn(47),rn(46),rn(45),rn(3),rn(2),ut(1),ut(1),ut(1),ut(1),ut(1),ut(1),ut(1),ut(1),ut(1),ut(3),ut(3),ut(3),ut(3),ut(3),ut(3),ut(3),ut(3),ut(1),ut(1),ut(1),ut(1),ut(45),ut(45),ut(45),ut(45),ut(45),ut(45),ut(45),ut(45);const li="/Users/demo/polsia",mn=(e,t,n={})=>({name:t,path:e,definitionId:null,definitionSlug:t,activeBuildRunId:null,activeBuildRunStatus:null,source:"scan",...n}),LR=[mn(`${li}/backend/src/agents/ads`,"ads"),mn(`${li}/backend/src/agents/outreach`,"outreach"),mn(`${li}/scripts/tools/rollup`,"rollup",{definitionSlug:null}),mn(`${li}/packages/harness/web/src/components/mailer`,"mailer",{definitionId:7701,activeBuildRunId:"build-mailer-ready",activeBuildRunStatus:"ready"}),mn(`${li}/packages/harness/web/src/components/sender`,"sender"),mn(`${li}/services/gateway`,"gateway"),mn(`${li}/services/workers/ads`,"ads-worker"),mn(`${li}/services/workers/queue`,"queue"),mn("/Users/demo/dashboard-keeper","dashboard-keeper")],IR=[mn(`${li}/backend/src/pipelines/ingest`,"ingest"),mn(`${li}/services/etl/ingest`,"ingest"),...aC.flatMap(e=>[mn(`/Users/demo/${e}/ari/orchestration`,"ari-grade-repo"),mn(`/Users/demo/${e}/ari/brain`,"brain-agent")]),mn("/Users/demo/team-tools/slack-notifier","@sapiom/example-slack-notifier"),mn("/Users/demo/other-tools/slack-notifier","@sapiom/example-slack-notifier"),...Array.from({length:10},(e,t)=>mn(`/Users/demo/misc/pkg${t+1}/agent`,`filler-${t+1}`))],PR=[li,`${li}/services/workers`,"/Users/demo/dashboard-keeper"];function oC(){return typeof window>"u"?!1:new URLSearchParams(window.location.search).get("mockFixtures")==="deep"}[...oC()||Tc()?LR:[],...Tc()?IR:[]];[...[2,4,5].map((e,t)=>({agentSessionId:`search-standup-${t+1}`,harness:"claude-code",cwd:"/Users/demo/acme-app",title:"Standup summary for #eng",lastActiveAt:ut(e),source:"transcript",resumeMode:"rehydrate",turnCount:6-t})),ut(3),ut(1),ut(6)];[...oC()||Tc()?PR:[]];function lC(){return!1}function $a(e){return(e==null?void 0:e.boundWorkflowPath)??null}class gn extends Error{constructor(n,r,o){super(r);vm(this,"status");vm(this,"reason");this.name="ApiError",this.status=n,this.reason=o}}function Vo(){const e=window.__HARNESS__;return e!=null&&e.token?e.token:new URLSearchParams(window.location.search).get("token")??""}class BR{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 response(t,n){const r=await fetch(t,{...n,headers:{"Content-Type":"application/json","X-Harness-Token":Vo(),...n==null?void 0:n.headers}});if(!r.ok){const o=await r.text().catch(()=>"");let c;try{const h=o?JSON.parse(o):void 0;h&&typeof h=="object"&&typeof h.error=="string"&&(c=h.error)}catch{}throw new gn(r.status,`${(n==null?void 0:n.method)??"GET"} ${t} → ${r.status}${o?`: ${o}`:""}`,c)}return r}async request(t,n){const r=await this.response(t,n);if(r.status!==204)return await r.json()}getState(){return this.request("/api/state")}async getSystemGraph(t,n={}){const r=`/api/workspaces/${encodeURIComponent(t)}/system-graph`,o=await this.response(n.refresh?`${r}/refresh`:r,n.refresh?{method:"POST"}:void 0),c=NR(await o.json());if(c.workspaceKey!==t)throw new Error("Invalid system graph response");return c}createSession(t){return this.request("/api/sessions",{method:"POST",body:JSON.stringify({theme:rf(),...t})})}attachFile(t,n){return this.request(`/api/sessions/${encodeURIComponent(t)}/attachments`,{method:"POST",body:JSON.stringify(n)})}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 gn&&(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")}getWorkflowInputContract(t){return this.request(`/api/workflows/${encodeURIComponent(t)}/input-contract`)}getWorkflowGraph(t){return this.request(`/api/workflows/${encodeURIComponent(t)}/graph`)}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})})}async moveAgent(t,n){await this.request("/api/agents/move",{method:"POST",body:JSON.stringify({from:t,to:n})})}listHarnesses(){return this.request("/api/harnesses")}async getRailState(t){return(await this.request(`/api/studio-rail?root=${encodeURIComponent(t)}`)).raw}async saveRailState(t,n){await this.request(`/api/studio-rail?root=${encodeURIComponent(t)}`,{method:"PUT",body:JSON.stringify({raw:n})})}async clearRailState(t){await this.request(`/api/studio-rail?root=${encodeURIComponent(t)}`,{method:"DELETE"})}async listLaunchEdges(){return(await this.request("/api/studio-rail/launch-edges")).edges}listMacros(){return this.request("/api/macros")}async runMacro(t,n){await this.request(`/api/macros/${encodeURIComponent(t)}/run`,{method:"POST",body:JSON.stringify(n)})}getSettings(){return this.request("/api/settings")}updateSettings(t){return this.request("/api/settings",{method:"PATCH",body:JSON.stringify(t)})}listDir(t){const n=t?`?path=${encodeURIComponent(t)}`:"";return this.request(`/api/fs/list${n}`)}bindWorkflow(t,n){const r={workflowPath:n};return this.request(`/api/sessions/${encodeURIComponent(t)}/workflow`,{method:"PATCH",body:JSON.stringify(r)})}listTemplates(){return this.request("/api/templates")}getTemplate(t){return this.request(`/api/templates/${encodeURIComponent(t)}`)}getAccountPlan(){return this.request("/api/account/plan")}getRunState(t){return this.request(`/api/runs/${encodeURIComponent(t)}/state`)}async runLocal(t,n){const r=await fetch("/api/runs/local",{method:"POST",headers:{"Content-Type":"application/json","X-Harness-Token":Vo()},body:JSON.stringify(t)});if(!r.ok||!r.body){const u=await r.text().catch(()=>"");throw new gn(r.status,`POST /api/runs/local → ${r.status}${u?`: ${u}`:""}`,void 0)}const o=r.body.getReader(),c=new TextDecoder;let h="";const l=(u,m)=>{h+=u;const{lines:g,rest:p}=HR(h,m);h=p;for(const S of g){const x=UR(S);x&&n(x)}};for(;;){const{done:u,value:m}=await o.read();if(u)break;l(c.decode(m,{stream:!0}),!1)}l(c.decode(),!0)}async deploy(t,n){const r=await this.streamNdjson(`/api/workflows/${encodeURIComponent(t)}/deploy`,{method:"POST"},n);return FR(r)}async run(t){return this.request("/api/runs",{method:"POST",body:JSON.stringify(t)})}async streamNdjson(t,n,r){const o=await fetch(t,{...n,headers:{"Content-Type":"application/json","X-Harness-Token":Vo(),...n.headers}});if(!o.ok||!o.body){const g=await o.text().catch(()=>"");let p;try{const S=g?JSON.parse(g):void 0;S&&typeof S=="object"&&typeof S.error=="string"&&(p=S.error)}catch{}throw new gn(o.status,`${n.method??"GET"} ${t} → ${o.status}${g?`: ${g}`:""}`,p)}const c=[],h=o.body.getReader(),l=new TextDecoder;let u="";const m=g=>{u+=g;let p=u.indexOf(`
|
|
50
|
+
`);for(;p!==-1;){const S=u.slice(0,p);u=u.slice(p+1);const x=zR(S);x!==void 0&&(c.push(x),r==null||r(x)),p=u.indexOf(`
|
|
51
|
+
`)}};for(;;){const{done:g,value:p}=await h.read();if(g)break;m(l.decode(p,{stream:!0}))}return m(l.decode()+`
|
|
52
|
+
`),c}}function zR(e){const t=e.trim();if(t==="")return;let n;try{n=JSON.parse(t)}catch{return}return n===null?void 0:n}function HR(e,t){const n=e.split(`
|
|
53
|
+
`);if(t)return{lines:n.filter(o=>o.trim()!==""),rest:""};const r=n.pop()??"";return{lines:n.filter(o=>o.trim()!==""),rest:r}}function UR(e){const t=e.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 FR(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.phase==="ready"||n.phase==="error")return n}return{phase:"error",code:"NO_OUTPUT",message:"deploy produced no terminal status"}}function zc(){return new BR}function bc(e){var r,o;const t=(r=e.inputSchema)==null?void 0:r.properties;if(!t)return[];const n=new Set(((o=e.inputSchema)==null?void 0:o.required)??[]);return Object.entries(t).map(([c,h])=>({name:c,type:typeof(h==null?void 0:h.type)=="string"?h.type:"unknown",required:n.has(c)})).sort((c,h)=>Number(h.required)-Number(c.required))}function fr(e){return e<1e3?`${e}ms`:`${Math.round(e/100)/10}s`}function qR(e,t){const n=[],r=bc(e).length;r>0&&n.push(r===1?"1 input":`${r} inputs`);const o=t.filter(c=>c.from===e.id&&c.kind==="branching").length;return o>1&&n.push(`${o} branches`),e.timeoutMs&&e.timeoutMs>0&&n.push(`${fr(e.timeoutMs)} limit`),n}function VR(e){const t=e.nodes.filter(r=>r.kind==="terminal-success"||r.kind==="terminal-warn").length;return{steps:e.nodes.filter(r=>r.kind!=="terminal-success"&&r.kind!=="terminal-warn"&&r.kind!=="launched-workflow").length,exits:t}}function GR(e){const{steps:t,exits:n}=VR(e),r=[`${t} ${t===1?"step":"steps"}`];return n>0&&r.push(`${n} ${n===1?"exit":"exits"}`),r.join(" · ")}function cC(e){switch(e){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 jg(e,t=0){if(!(t>32)){if(e===null||typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e;if(Array.isArray(e))return e.map(n=>jg(n,t+1));if(typeof e=="object")return Object.fromEntries(Object.entries(e).map(([n,r])=>[n,jg(r,t+1)]).filter(n=>n[1]!==void 0))}}function WR(e){if(!e||typeof e!="object")return null;const t=jg(e);return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function KR(e){if(!e||typeof e!="object")return null;const t=e;if(!Array.isArray(t.nodes)||!Array.isArray(t.edges))return null;const n=r=>typeof r=="string"?r:"";return{name:n(t.name),entry:n(t.entry),nodes:t.nodes.map(r=>({id:n(r.id),kind:n(r.kind),label:n(r.label),role:n(r.role),description:n(r.description),timeoutMs:typeof r.timeoutMs=="number"&&r.timeoutMs>0?r.timeoutMs:null,inputSchema:WR(r.inputSchema),capabilities:Array.isArray(r.capabilities)?r.capabilities.filter(o=>typeof o=="string"):[]})),edges:t.edges.map(r=>({from:n(r.from),to:n(r.to),kind:n(r.kind),label:n(r.label)})),groups:Array.isArray(t.groups)?t.groups.map(r=>({label:n(r.label),nodeIds:Array.isArray(r.nodeIds)?r.nodeIds.filter(o=>typeof o=="string"):[]})):[],warnings:Array.isArray(t.warnings)?t.warnings.filter(r=>typeof r=="string"):[]}}const uC="sapiom-harness-ui-prefs";function ui(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(uC);return e?JSON.parse(e):{}}catch{return{}}}function xi(e){if(!(typeof window>"u"))try{window.localStorage.setItem(uC,JSON.stringify({...ui(),...e}))}catch{}}function Dv(e,t){return!e||e.stubbed!==!0?!1:e.steps.some(n=>n.name===t)}function YR(e){if(!e)return null;const t={};return e.unusedStubs&&e.unusedStubs.length>0&&(t.unusedStubs=e.unusedStubs),e.stubWarnings&&e.stubWarnings.length>0&&(t.stubWarnings=e.stubWarnings),t.unusedStubs||t.stubWarnings?t:null}function af(e,t){if(!e)return null;for(let n=e.steps.length-1;n>=0;n--)if(e.steps[n].name===t)return e.steps[n];return null}const r1=3e3,a1=2e3;function XR(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function o1(e){let t;if(typeof e=="string")t=e;else try{t=JSON.stringify(e,null,2)??String(e)}catch{t=String(e)}return t.length>a1?`${t.slice(0,a1)}
|
|
54
|
+
… (truncated, ${t.length} chars total)`:t}function JR(e,t,n){const r=[];r.push(`Step: ${e.name}`),r.push(`Status: ${e.status}`),e.latencyMs!=null&&r.push(`Latency: ${XR(e.latencyMs)}`),e.status==="failed"&&e.error&&r.push(`Error: ${e.error}`),(t==null?void 0:t.input)!==void 0&&r.push(`
|
|
55
|
+
Input:
|
|
56
|
+
${o1(t.input)}`),(t==null?void 0:t.output)!==void 0&&r.push(`
|
|
57
|
+
Output:
|
|
58
|
+
${o1(t.output)}`);const o=t==null?void 0:t.calls;if(o!==void 0)if(o.length>0){r.push(`
|
|
59
|
+
Capabilities called:`);for(const c of o){const h=c.stubUsed?" (stubbed)":"";r.push(` - ${c.capability}${h}`)}}else r.push(`
|
|
60
|
+
Capabilities called: none (the step made zero capability calls).`);else if(n!=null&&n.capabilities&&n.capabilities.length>0){r.push(`
|
|
61
|
+
Capabilities declared (no call trace):`);for(const c of n.capabilities)r.push(` - ${c}`)}if(t!=null&&t.unusedStubs&&t.unusedStubs.length>0){r.push(`
|
|
62
|
+
Unused stubs (supplied but matched no call):`);for(const c of t.unusedStubs)r.push(` - ${c}`)}if(t!=null&&t.stubWarnings&&t.stubWarnings.length>0){r.push(`
|
|
63
|
+
Stub warnings:`);for(const c of t.stubWarnings)r.push(` - ${c}`)}if(e.logSlice){const c=e.logSlice.trimEnd(),h=c.length>r1?c.slice(c.length-r1):c;r.push(`
|
|
64
|
+
Logs:
|
|
65
|
+
${h}`)}return r.join(`
|
|
66
|
+
`)}const ZR=/\.(png|jpg|jpeg|webp|gif|svg)($|\?)/i,QR=/https?:\/\/[^\s"'<>`\])\]]+/gi,eA=/[.,;:)\]}\s]+$/;function l1(e){if(typeof e=="string")return e;try{return JSON.stringify(e)??String(e)}catch{return String(e)}}function tA(e){const t=new Set,n=[],r=o=>{const c=o.matchAll(QR);for(const[h]of c){const l=h.replace(eA,"");if(!l||t.has(l))continue;t.add(l);const u=ZR.test(l)?"image":"other";n.push({url:l,kind:u})}};if(e.output!==void 0&&r(l1(e.output)),e.logSlice&&r(e.logSlice),e.calls)for(const o of e.calls)o.result!==void 0&&r(l1(o.result));return n}const Ov="https://app.sapiom.ai",dC=`${Ov}/agents`,c1=`${Ov}/settings?tab=billing`,sA=Ov;function of(e){return`${dC}/${e}`}const nA="https://docs.sapiom.ai",iA=`${nA}/agents/quick-start`;function hC(e){if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)??String(e)}catch{return String(e)}}/**
|
|
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 fC=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/**
|
|
72
|
+
* @license lucide-react v1.23.0 - ISC
|
|
73
|
+
*
|
|
74
|
+
* This source code is licensed under the ISC license.
|
|
75
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
76
|
+
*/const rA=e=>e.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 aA=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase());/**
|
|
82
|
+
* @license lucide-react v1.23.0 - ISC
|
|
83
|
+
*
|
|
84
|
+
* This source code is licensed under the ISC license.
|
|
85
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
86
|
+
*/const u1=e=>{const t=aA(e);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 Cm={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 oA=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},lA=O.createContext({}),cA=()=>O.useContext(lA),uA=O.forwardRef(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:o="",children:c,iconNode:h,...l},u)=>{const{size:m=24,strokeWidth:g=2,absoluteStrokeWidth:p=!1,color:S="currentColor",className:x=""}=cA()??{},A=r??p?Number(n??g)*24/Number(t??m):n??g;return O.createElement("svg",{ref:u,...Cm,width:t??m??Cm.width,height:t??m??Cm.height,stroke:e??S,strokeWidth:A,className:fC("lucide",x,o),...!c&&!oA(l)&&{"aria-hidden":"true"},...l},[...h.map(([E,y])=>O.createElement(E,y)),...Array.isArray(c)?c:[c]])});/**
|
|
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 ze=(e,t)=>{const n=O.forwardRef(({className:r,...o},c)=>O.createElement(uA,{ref:c,iconNode:t,className:fC(`lucide-${rA(u1(e))}`,`lucide-${e}`,r),...o}));return n.displayName=u1(e),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 dA=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],hA=ze("arrow-down",dA);/**
|
|
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 fA=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],pA=ze("arrow-left",fA);/**
|
|
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 mA=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],gA=ze("arrow-right",mA);/**
|
|
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 vA=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],_A=ze("arrow-up-right",vA);/**
|
|
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 yA=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],bA=ze("arrow-up",yA);/**
|
|
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 SA=[["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"}]],wA=ze("book-open",SA);/**
|
|
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 xA=[["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"}]],CA=ze("brain",xA);/**
|
|
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 EA=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],kA=ze("check",EA);/**
|
|
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 jA=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],RA=ze("chevron-down",jA);/**
|
|
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 AA=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],TA=ze("chevron-right",AA);/**
|
|
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 NA=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],MA=ze("chevron-up",NA);/**
|
|
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 $A=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],DA=ze("circle-check",$A);/**
|
|
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 OA=[["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"}]],LA=ze("circle-question-mark",OA);/**
|
|
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 IA=[["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"}]],PA=ze("cloud-off",IA);/**
|
|
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 BA=[["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"}]],zA=ze("cloud-upload",BA);/**
|
|
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 HA=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],UA=ze("cloud",HA);/**
|
|
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 FA=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],qA=ze("code",FA);/**
|
|
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 VA=[["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"}]],GA=ze("copy",VA);/**
|
|
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 WA=[["path",{d:"m15 10 5 5-5 5",key:"qqa56n"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]],KA=ze("corner-down-right",WA);/**
|
|
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 YA=[["path",{d:"M14 9 9 4 4 9",key:"1af5af"}],["path",{d:"M20 20h-7a4 4 0 0 1-4-4V4",key:"1blwi3"}]],XA=ze("corner-left-up",YA);/**
|
|
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 JA=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],ZA=ze("ellipsis-vertical",JA);/**
|
|
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 QA=[["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"}]],eT=ze("external-link",QA);/**
|
|
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 tT=[["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"}]],sT=ze("flask-conical",tT);/**
|
|
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 nT=[["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"}]],iT=ze("folder-open",nT);/**
|
|
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 rT=[["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"}]],aT=ze("folder-plus",rT);/**
|
|
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 oT=[["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"}]],lT=ze("folder",oT);/**
|
|
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 cT=[["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"}]],uT=ze("frame",cT);/**
|
|
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 dT=[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]],hT=ze("git-branch",dT);/**
|
|
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 fT=[["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"}]],pT=ze("globe",fT);/**
|
|
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 mT=[["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"}]],gT=ze("hammer",mT);/**
|
|
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 vT=[["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"}]],_T=ze("history",vT);/**
|
|
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 yT=[["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"}]],bT=ze("image-up",yT);/**
|
|
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 ST=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],wT=ze("info",ST);/**
|
|
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 xT=[["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"}]],CT=ze("layout-template",xT);/**
|
|
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 ET=[["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"}]],kT=ze("list-checks",ET);/**
|
|
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 jT=[["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"}]],RT=ze("list",jT);/**
|
|
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 AT=[["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"}]],TT=ze("loader",AT);/**
|
|
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 NT=[["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"}]],MT=ze("log-out",NT);/**
|
|
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 $T=[["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"}]],DT=ze("maximize-2",$T);/**
|
|
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 OT=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],LT=ze("menu",OT);/**
|
|
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 IT=[["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"}]],PT=ze("message-square",IT);/**
|
|
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 BT=[["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"}]],zT=ze("minimize-2",BT);/**
|
|
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 HT=[["path",{d:"M5 12h14",key:"1ays0h"}]],UT=ze("minus",HT);/**
|
|
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 FT=[["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"}]],qT=ze("moon",FT);/**
|
|
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 VT=[["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"}]],GT=ze("panel-left-close",VT);/**
|
|
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 WT=[["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"}]],KT=ze("panel-left-open",WT);/**
|
|
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 YT=[["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"}]],XT=ze("panel-right-close",YT);/**
|
|
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 JT=[["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"}]],ZT=ze("panel-right-open",JT);/**
|
|
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 QT=[["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"}]],eN=ze("paperclip",QT);/**
|
|
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 tN=[["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"}]],sN=ze("pencil",tN);/**
|
|
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 nN=[["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"}]],iN=ze("play",nN);/**
|
|
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 rN=[["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"}]],aN=ze("plug",rN);/**
|
|
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 oN=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],lN=ze("plus",oN);/**
|
|
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 cN=[["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"}]],uN=ze("radio",cN);/**
|
|
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 dN=[["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"}]],hN=ze("refresh-cw",dN);/**
|
|
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 fN=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],pN=ze("search",fN);/**
|
|
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 mN=[["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"}]],gN=ze("settings",mN);/**
|
|
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 vN=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],_N=ze("sliders-horizontal",vN);/**
|
|
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 yN=[["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"}]],bN=ze("sparkles",yN);/**
|
|
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 SN=[["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"}]],wN=ze("square-terminal",SN);/**
|
|
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 xN=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],CN=ze("square",xN);/**
|
|
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 EN=[["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"}]],kN=ze("sun",EN);/**
|
|
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 jN=[["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"}]],RN=ze("tags",jN);/**
|
|
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 AN=[["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"}]],TN=ze("trash-2",AN);/**
|
|
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 NN=[["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"}]],MN=ze("triangle-alert",NN);/**
|
|
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 $N=[["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"}]],DN=ze("wand-sparkles",$N);/**
|
|
432
|
+
* @license lucide-react v1.23.0 - ISC
|
|
433
|
+
*
|
|
434
|
+
* This source code is licensed under the ISC license.
|
|
435
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
436
|
+
*/const ON=[["path",{d:"m10.586 5.414-5.172 5.172",key:"4mc350"}],["path",{d:"m18.586 13.414-5.172 5.172",key:"8c96vv"}],["path",{d:"M6 12h12",key:"8npq4p"}],["circle",{cx:"12",cy:"20",r:"2",key:"144qzu"}],["circle",{cx:"12",cy:"4",r:"2",key:"muu5ef"}],["circle",{cx:"20",cy:"12",r:"2",key:"1xzzfp"}],["circle",{cx:"4",cy:"12",r:"2",key:"1hvhnz"}]],LN=ze("waypoints",ON);/**
|
|
437
|
+
* @license lucide-react v1.23.0 - ISC
|
|
438
|
+
*
|
|
439
|
+
* This source code is licensed under the ISC license.
|
|
440
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
441
|
+
*/const IN=[["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"}]],PN=ze("workflow",IN);/**
|
|
442
|
+
* @license lucide-react v1.23.0 - ISC
|
|
443
|
+
*
|
|
444
|
+
* This source code is licensed under the ISC license.
|
|
445
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
446
|
+
*/const BN=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],zN=ze("x",BN);/**
|
|
447
|
+
* @license lucide-react v1.23.0 - ISC
|
|
448
|
+
*
|
|
449
|
+
* This source code is licensed under the ISC license.
|
|
450
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
451
|
+
*/const HN=[["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"}]],UN=ze("zap",HN);/**
|
|
452
|
+
* @license lucide-react v1.23.0 - ISC
|
|
453
|
+
*
|
|
454
|
+
* This source code is licensed under the ISC license.
|
|
455
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
456
|
+
*/const FN=[["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"}]],qN=ze("zoom-in",FN);/**
|
|
457
|
+
* @license lucide-react v1.23.0 - ISC
|
|
458
|
+
*
|
|
459
|
+
* This source code is licensed under the ISC license.
|
|
460
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
461
|
+
*/const VN=[["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"}]],GN=ze("zoom-out",VN),WN={ArrowDown:hA,ArrowLeft:pA,ArrowRight:gA,ArrowUp:bA,ArrowUpRight:_A,BookOpen:wA,Brain:CA,Check:kA,ChevronDown:RA,ChevronRight:TA,ChevronUp:MA,CircleCheck:DA,Cloud:UA,CloudOff:PA,CloudUpload:zA,Code:qA,Copy:GA,CornerDownRight:KA,CornerLeftUp:XA,ExternalLink:eT,FlaskConical:sT,Folder:lT,GitBranch:hT,FolderOpen:iT,FolderPlus:aT,Frame:uT,Globe:pT,Hammer:gT,History:_T,ImageUp:bT,Info:wT,LayoutTemplate:CT,List:RT,ListChecks:kT,Loader:TT,LogOut:MT,Maximize2:DT,Menu:LT,MessageSquare:PT,Minimize2:zT,Minus:UT,EllipsisVertical:ZA,Moon:qT,PanelLeftClose:GT,PanelLeftOpen:KT,PanelRightClose:XT,PanelRightOpen:ZT,Paperclip:eN,Pencil:sN,Play:iN,Plug:aN,Plus:lN,Radio:uN,RefreshCw:hN,Search:pN,Settings:gN,SlidersHorizontal:_N,Sparkles:bN,Square:CN,SquareTerminal:wN,Sun:kN,Tags:RN,Trash2:TN,TriangleAlert:MN,Wand2:DN,Waypoints:LN,Workflow:PN,X:zN,Zap:UN,ZoomIn:qN,ZoomOut:GN};function de({name:e,size:t=16}){const n=WN[e]??LA;return d.jsx(n,{size:t,strokeWidth:1.75,"aria-hidden":"true"})}const KN="data-ph-capture-attribute-";function Ot(e){const t={};for(const[n,r]of Object.entries(e)){if(r==null)continue;const o=String(r);o.length!==0&&(t[`${KN}${n}`]=o)}return t}const Ro=8,YN=1200,d1=12;function XN(e){return/<\/?(?:!doctype|html|head|body|style|script|main|section|article|div|span|img|svg|meta|link)\b/i.test(e)}function JN(e){const t=e.split(/\r?\n/),r=t.slice(0,d1).join(`
|
|
462
|
+
`).slice(0,YN),o=t.length>d1||e.length>r.length;return{kind:XN(e)?"html":"text",truncated:o,preview:o?`${r.trimEnd()}
|
|
463
|
+
…`:e,omittedCharacters:o?Math.max(0,e.length-r.length):0}}function ZN(e){let t=null;try{return t=document.createElement("textarea"),t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select(),document.execCommand("copy")}catch{return!1}finally{t==null||t.remove()}}function pC(e){try{const t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"?t:null}catch{return null}}function QN(e){var t;return((t=e.pathname.split(".").pop())==null?void 0:t.toLowerCase())??""}function mC(e){const t=e.pathname.split("/").filter(Boolean).pop();if(!t)return e.hostname;try{return`${e.hostname} / ${decodeURIComponent(t)}`}catch{return`${e.hostname} / ${t}`}}function e3({url:e}){const[t,n]=O.useState(!1),r=QN(e),o=mC(e),c=["png","jpg","jpeg","gif","webp","avif","svg"].includes(r),h=["mp3","wav","ogg","m4a","aac"].includes(r),l=["mp4","webm","mov","m4v"].includes(r),u=["pdf","zip","csv","json","docx","xlsx","pptx","txt"].includes(r);return t||!c&&!h&&!l?d.jsxs("a",{className:"artifact-link",href:e.href,target:"_blank",rel:"noreferrer",download:u||void 0,children:[d.jsx(de,{name:t?"TriangleAlert":u?"ArrowDown":"ExternalLink",size:13}),d.jsx("span",{children:t?`Preview unavailable · ${o}`:u?`Download · ${o}`:o})]}):c?d.jsxs("figure",{className:"artifact-media",children:[d.jsx("img",{src:e.href,alt:o,loading:"lazy",onError:()=>n(!0)}),d.jsx("figcaption",{children:d.jsx("a",{href:e.href,target:"_blank",rel:"noreferrer",children:o})})]}):h?d.jsxs("figure",{className:"artifact-media",children:[d.jsx("audio",{controls:!0,preload:"metadata",onError:()=>n(!0),children:d.jsx("source",{src:e.href})}),d.jsx("figcaption",{children:d.jsx("a",{href:e.href,target:"_blank",rel:"noreferrer",children:o})})]}):d.jsxs("figure",{className:"artifact-media",children:[d.jsx("video",{controls:!0,preload:"metadata",onError:()=>n(!0),children:d.jsx("source",{src:e.href})}),d.jsx("figcaption",{children:d.jsx("a",{href:e.href,target:"_blank",rel:"noreferrer",children:o})})]})}function Em(e){const t=[],n=/\[([^\]]+)\]\((https?:\/\/[^)\s]+)\)|(https?:\/\/[^\s<]+)/g;let r=0,o;for(;o=n.exec(e);){o.index>r&&t.push(e.slice(r,o.index));const c=o[2]??o[3],h=c?pC(c.replace(/[.,;!?]+$/,"")):null;h?t.push(d.jsx("a",{href:h.href,target:"_blank",rel:"noreferrer",children:o[1]??mC(h)},`${o.index}-${h.href}`)):t.push(o[0]),r=n.lastIndex}return r<e.length&&t.push(e.slice(r)),t}function t3({text:e}){const t=e.split(/\r?\n/),n=[];let r=[],o=[];const c=()=>{if(r.length===0)return;const l=r.join(`
|
|
464
|
+
`);n.push(d.jsx("p",{children:Em(l)},`p-${n.length}`)),r=[]},h=()=>{o.length!==0&&(n.push(d.jsx("ul",{children:o.map((l,u)=>d.jsx("li",{children:Em(l)},u))},`l-${n.length}`)),o=[])};for(const l of t){const u=/^(#{1,3})\s+(.+)$/.exec(l),m=/^[-*]\s+(.+)$/.exec(l);if(u){c(),h();const g=Em(u[2]);n.push(u[1].length===1?d.jsx("h3",{children:g},n.length):u[1].length===2?d.jsx("h4",{children:g},n.length):d.jsx("h5",{children:g},n.length))}else m?(c(),o.push(m[1])):l.trim()===""?(c(),h()):(h(),r.push(l))}return c(),h(),d.jsx("div",{className:"artifact-markdown",children:n})}function gC({text:e,forceSource:t=!1}){const[n,r]=O.useState(!1);O.useEffect(()=>r(!1),[e]);const o=JN(e),c=t||o.kind==="html",h=n?e:o.preview;return d.jsxs("div",{className:"artifact-text","data-kind":c?"source":"text",children:[c?d.jsx("pre",{className:"artifact-source",children:h}):d.jsx(t3,{text:h}),o.truncated&&d.jsxs("button",{type:"button",className:"btn-ghost artifact-text-more","aria-expanded":n,onClick:()=>r(l=>!l),children:[d.jsx(de,{name:n?"ChevronUp":"ChevronDown",size:12}),n?"Show less":`Show full ${c?"HTML":"text"} · ${o.omittedCharacters.toLocaleString()} more characters`]})]})}function km(e){return e!==null&&typeof e=="object"}function fh({value:e}){if(typeof e=="string"){const t=pC(e);return t?d.jsx(e3,{url:t},t.href):d.jsx(gC,{text:e})}if(e===null||typeof e=="number"||typeof e=="boolean")return d.jsx("code",{className:"artifact-scalar",children:String(e)});if(Array.isArray(e)){if(e.length===0)return d.jsx("code",{className:"artifact-scalar",children:"[]"});const t=e.slice(0,Ro),n=e.slice(Ro);return d.jsxs("div",{className:"artifact-list",children:[t.map((r,o)=>d.jsxs("div",{className:"artifact-list-item","data-composite":km(r)||void 0,children:[d.jsx("span",{className:"artifact-list-index",children:o+1}),d.jsx(fh,{value:r})]},o)),n.length>0&&d.jsxs("details",{className:"artifact-collection-more",children:[d.jsxs("summary",{children:["Show ",n.length," more"]}),n.map((r,o)=>d.jsxs("div",{className:"artifact-list-item","data-composite":km(r)||void 0,children:[d.jsx("span",{className:"artifact-list-index",children:o+Ro+1}),d.jsx(fh,{value:r})]},o+Ro))]})]})}if(typeof e=="object"){const t=Object.entries(e);if(t.length===0)return d.jsx("code",{className:"artifact-scalar",children:"{}"});const n=t.slice(0,Ro),r=t.slice(Ro),o=c=>c.map(([h,l])=>d.jsxs("div",{className:"artifact-field","data-composite":km(l)||void 0,children:[d.jsx("div",{className:"artifact-field-label",children:h.replaceAll(/[_-]+/g," ")}),d.jsx("div",{className:"artifact-field-value",children:d.jsx(fh,{value:l})})]},h));return d.jsxs("div",{className:"artifact-object",children:[o(n),r.length>0&&d.jsxs("details",{className:"artifact-collection-more",children:[d.jsxs("summary",{children:["Show ",r.length," more fields"]}),o(r)]})]})}return d.jsx("code",{className:"artifact-scalar",children:String(e)})}function Sc({value:e,label:t="Result",testId:n="run-artifact",defaultOpen:r=!0,onViewed:o,viewEventKey:c="default"}){const[h,l]=O.useState("rendered"),[u,m]=O.useState(r),[g,p]=O.useState(!1),S=O.useRef(null),x=O.useRef(null),A=O.useId(),E=O.useId(),y=O.useId(),b=O.useRef(null),v=O.useRef(null),_=hC(e);O.useEffect(()=>{!o||S.current===c||(S.current=c,o())},[o,c]),O.useEffect(()=>()=>{x.current&&window.clearTimeout(x.current)},[]);const k=w=>{l(w),m(!0)},C=w=>{var j;let T=null;w.key==="Home"&&(T="rendered"),w.key==="End"&&(T="raw"),["ArrowLeft","ArrowUp","ArrowRight","ArrowDown"].includes(w.key)&&(T=h==="rendered"?"raw":"rendered"),T!==null&&(w.preventDefault(),k(T),(j=(T==="rendered"?b:v).current)==null||j.focus())};return d.jsxs("section",{className:"artifact-renderer","data-testid":n,"data-collapsed":!u||void 0,...Ot({object:"run"}),children:[d.jsxs("header",{className:"artifact-header",children:[d.jsxs("button",{type:"button",className:"artifact-disclosure","aria-expanded":u,"aria-controls":A,onClick:()=>m(w=>!w),children:[d.jsx(de,{name:u?"ChevronDown":"ChevronRight",size:13}),d.jsx("span",{className:"artifact-title",children:t})]}),d.jsxs("div",{className:"artifact-actions",children:[d.jsxs("div",{className:"artifact-mode",role:"tablist","aria-label":`${t} display`,children:[d.jsx("button",{ref:b,id:E,type:"button",role:"tab","aria-controls":A,"aria-selected":h==="rendered",tabIndex:h==="rendered"?0:-1,onKeyDown:C,onClick:()=>k("rendered"),children:"Rendered"}),d.jsx("button",{ref:v,id:y,type:"button",role:"tab","aria-controls":A,"aria-selected":h==="raw",tabIndex:h==="raw"?0:-1,onKeyDown:C,onClick:()=>k("raw"),children:"Raw"})]}),d.jsxs("button",{type:"button",className:"btn-ghost artifact-copy",onClick:()=>void(async()=>{var T;let w=!1;try{(T=navigator.clipboard)!=null&&T.writeText&&(await navigator.clipboard.writeText(_),w=!0)}catch{}w||(w=ZN(_)),w&&(p(!0),x.current&&window.clearTimeout(x.current),x.current=window.setTimeout(()=>p(!1),1500))})(),children:[d.jsx(de,{name:g?"Check":"Copy",size:12})," ",g?"Copied":"Copy"]})]})]}),d.jsx("div",{className:"artifact-body",id:A,role:"tabpanel","aria-labelledby":h==="rendered"?E:y,hidden:!u,children:h==="rendered"?d.jsx(fh,{value:e}):d.jsx(gC,{text:_,forceSource:!0})})]})}function Lv(){return d.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 Wr({label:e,value:t,testId:n}){return d.jsx(Sc,{value:t,label:e,testId:n,defaultOpen:!1})}function s3({links:e,testid:t}){return d.jsx("div",{className:"canvas-links-list","data-testid":t,children:e.map(({url:n,kind:r})=>r==="image"?d.jsx("a",{href:n,target:"_blank",rel:"noreferrer",className:"canvas-link-thumb-wrap","data-testid":"canvas-link-image",children:d.jsx("img",{src:n,alt:"",className:"canvas-link-thumb",loading:"lazy"})},n):d.jsxs("a",{href:n,target:"_blank",rel:"noreferrer",className:"canvas-link-item","data-testid":"canvas-link-other",children:[d.jsx(de,{name:"ExternalLink",size:12}),d.jsx("span",{className:"canvas-link-url",children:"Open"})]},n))})}function vC({step:e}){const t=tA(e);return t.length===0?null:d.jsxs("section",{className:"canvas-detail-section","data-testid":"canvas-detail-links",children:[d.jsx("h4",{children:"Links"}),d.jsx(s3,{links:t})]})}function n3({status:e}){return e==="completed"?d.jsx("span",{className:"canvas-run-status is-passed","aria-label":"completed",children:d.jsx(de,{name:"Check",size:11})}):e==="failed"?d.jsx("span",{className:"canvas-run-status is-failed","aria-label":"failed",children:d.jsx(de,{name:"X",size:11})}):e==="cancelled"?d.jsx("span",{className:"canvas-run-status is-pending","aria-label":"cancelled",children:d.jsx(de,{name:"Minus",size:11})}):d.jsx("span",{className:"canvas-run-status is-running","aria-label":"running"})}function i3({deployState:e,workflow:t,onDismiss:n,onOpenCode:r}){const o=(t==null?void 0:t.definitionId)!=null?of(t.definitionId):null,c=e.phase==="linking"||e.phase==="building",h=e.phase==="linking"?"Creating the agent on Sapiom…":e.phase==="building"?"Deploying — building on Sapiom…":e.phase==="ready"?"Deployed to Sapiom":"Deploy failed";return d.jsxs("section",{className:"deploy-status-banner is-"+e.phase,"data-testid":"deploy-status-banner","data-phase":e.phase,children:[d.jsxs("div",{className:"deploy-status-head",children:[c?d.jsx("span",{className:"canvas-task-spinner","aria-hidden":"true"}):d.jsx(n3,{status:e.phase==="ready"?"completed":"failed"}),d.jsx("span",{className:"deploy-status-label",children:h}),d.jsx("button",{type:"button",className:"deploy-status-dismiss","data-testid":"deploy-status-dismiss","aria-label":"Dismiss",onClick:n,children:d.jsx(de,{name:"X",size:12})})]}),e.phase==="error"&&e.message&&d.jsx("pre",{className:"canvas-run-error",children:e.message}),e.phase==="ready"&&d.jsxs("div",{className:"deploy-status-actions",children:[o&&d.jsxs("a",{className:"status-tag status-tag-action","data-testid":"deploy-open-dashboard",href:o,target:"_blank",rel:"noreferrer",children:[d.jsx(de,{name:"Cloud",size:12}),"Open in Sapiom"]}),d.jsxs("button",{type:"button",className:"status-tag status-tag-action","data-testid":"deploy-open-code",onClick:r,children:[d.jsx(de,{name:"Code",size:12}),"Trigger from your code"]})]})]})}function _C({step:e}){return!e.calls||e.calls.length===0?null:d.jsxs("section",{className:"canvas-detail-section","data-testid":"canvas-detail-capability-calls",children:[d.jsx("h4",{children:"Capability calls"}),d.jsx("div",{className:"canvas-capability-calls",children:e.calls.map((t,n)=>d.jsxs("div",{className:"canvas-capability-call",children:[d.jsxs("div",{className:"canvas-capability-call-head",children:[d.jsx("code",{className:"canvas-input-field",children:t.capability}),t.stubUsed&&d.jsx("span",{className:"canvas-run-stub-chip","data-testid":`canvas-call-stub-chip-${t.capability}`,children:"stubbed"})]}),t.args!==void 0&&d.jsx(Wr,{label:"Arguments",value:t.args,testId:`canvas-call-arguments-${t.capability}`}),t.result!==void 0&&d.jsx(Wr,{label:"Result",value:t.result,testId:`canvas-call-result-${t.capability}`})]},`${t.capability}-${n}`))})]})}function yC({run:e}){const t=YR(e);return t?d.jsxs("section",{className:"canvas-detail-section","data-testid":"canvas-detail-stub-notice",children:[d.jsx("h4",{children:"Stub notices"}),t.unusedStubs&&d.jsxs("div",{className:"canvas-stub-notice","data-testid":"canvas-stub-unused",children:[d.jsx("span",{className:"canvas-input-label",children:"Unused stubs"}),d.jsx("p",{className:"canvas-stub-notice-hint",children:"Supplied but matched no capability call — likely a typo or wrong path."}),d.jsx("ul",{className:"canvas-detail-warnings",children:t.unusedStubs.map(n=>d.jsxs("li",{children:[d.jsx("code",{className:"canvas-input-field",children:n.key})," in ",n.step]},`${n.step} ${n.key}`))})]}),t.stubWarnings&&d.jsxs("div",{className:"canvas-stub-notice","data-testid":"canvas-stub-warnings",children:[d.jsx("span",{className:"canvas-input-label",children:"Stub warnings"}),d.jsx("p",{className:"canvas-stub-notice-hint",children:"Matched a call but had the wrong shape."}),d.jsx("ul",{className:"canvas-detail-warnings",children:t.stubWarnings.map(n=>d.jsx("li",{children:n},n))})]})]}):null}function r3(e){return e?`${e} run`:"run"}function Iv({status:e}){return e==="passed"?d.jsx("span",{className:"canvas-run-status is-passed","data-status":"passed","aria-label":"passed",children:d.jsx(de,{name:"Check",size:11})}):e==="failed"?d.jsx("span",{className:"canvas-run-status is-failed","data-status":"failed","aria-label":"failed",children:d.jsx(de,{name:"X",size:11})}):e==="running"?d.jsx("span",{className:"canvas-run-status is-running","data-status":"running","aria-label":"running"}):d.jsx("span",{className:"canvas-run-status is-pending","data-status":"pending","aria-label":"pending"})}function Wu(e){return e.kind==="branching"?"branch":e.kind==="cross"?"pause resume":e.kind==="launch"?"launch":null}function a3({node:e}){const t=bc(e);return t.length===0?null:d.jsxs("div",{className:"canvas-input-card","data-testid":`canvas-step-input-${e.id}`,children:[d.jsx("span",{className:"canvas-input-label",children:"Input"}),d.jsx("span",{className:"canvas-input-fields",children:t.map(n=>d.jsxs("code",{className:"canvas-input-field"+(n.required?" is-required":""),"aria-label":`${n.name}, ${n.type}${n.required?", required":""}`,...Ot({object:"run"}),children:[n.name,n.required&&d.jsx("span",{"aria-hidden":"true",children:"*"}),d.jsx("span",{className:"canvas-input-type",children:n.type})]},n.name))})]})}function o3({node:e}){return e.capabilities.length===0?null:d.jsxs("div",{className:"canvas-input-card","data-testid":`canvas-step-capabilities-${e.id}`,children:[d.jsx("span",{className:"canvas-input-label",children:"Capabilities"}),d.jsx("span",{className:"canvas-input-fields",children:e.capabilities.map(t=>d.jsx("code",{className:"canvas-input-field","data-tooltip":"Sapiom capability this step calls",children:t},t))})]})}function l3(e,t){return e.kind!=="launched-workflow"?null:t.find(n=>n.path===e.label)??t.find(n=>n.name===e.label)??t.find(n=>n.path.endsWith(`/${e.label}`))??null}function bC({node:e,workflows:t,onOpenWorkflow:n}){const r=l3(e,t);return r?d.jsxs("button",{className:"canvas-step-open","data-testid":`canvas-open-workflow-${e.id}`,"data-tooltip":`Switch to ${r.name}`,onClick:()=>n(r.path),children:["Open agent ",d.jsx(de,{name:"ArrowRight",size:12})]}):null}function c3({graph:e,run:t,runTarget:n,workflows:r,onOpenWorkflow:o,onAskAgent:c,expandedId:h,onToggle:l}){const u=new Set(e.nodes.map(S=>S.id)),m=e.groups.filter(S=>S.nodeIds.length>0&&S.nodeIds.every(x=>u.has(x))),g=S=>{var x;return((x=m.find(A=>A.nodeIds.includes(S)))==null?void 0:x.label)??null},p=[];return e.nodes.forEach((S,x)=>{const A=g(S.id),E=p[p.length-1];E&&E.group===A?E.nodes.push({node:S,index:x}):p.push({group:A,nodes:[{node:S,index:x}]})}),d.jsxs("div",{className:"canvas-steps-list","data-testid":"canvas-steps-list",children:[d.jsxs("div",{className:"canvas-steps-label",children:["Steps",t&&d.jsx("span",{className:"canvas-steps-run-note","data-testid":"canvas-steps-run-note",children:r3(n)})]}),p.map((S,x)=>d.jsxs("div",{className:S.group?"canvas-step-band":void 0,children:[S.group&&d.jsx("div",{className:"canvas-step-group",children:S.group}),S.nodes.map(({node:A,index:E})=>{const y=h===A.id,b=qR(A,e.edges),v=af(t,A.id),_=v?[v.latencyMs!==void 0?fr(v.latencyMs):null].filter(k=>k!==null):[];return d.jsxs("div",{className:"canvas-step-item"+(y?" is-open":""),children:[d.jsxs("button",{className:"canvas-step-row","data-testid":`canvas-step-row-${A.id}`,"aria-expanded":y,onClick:()=>l(A.id),children:[d.jsx("span",{className:"canvas-step-index",children:String(E+1).padStart(2,"0")}),v?d.jsx(Iv,{status:v.status}):d.jsx("span",{className:"canvas-step-dot dot--"+A.kind,"aria-hidden":"true"}),d.jsxs("span",{className:"canvas-step-copy",children:[d.jsx("span",{className:"canvas-step-name",children:A.label}),d.jsx("span",{className:"canvas-step-role",children:A.role})]}),v&&Dv(t,A.id)&&d.jsx(Lv,{}),d.jsx("span",{className:"canvas-step-meta",children:(_.length>0?_:b).join(" · ")}),d.jsx("span",{className:"canvas-step-caret"+(y?" is-open":""),"aria-hidden":"true",children:d.jsx(de,{name:"ChevronDown",size:13})})]}),y&&d.jsx("div",{className:"canvas-step-expand","data-testid":`canvas-step-expand-${A.id}`,children:d.jsx(u3,{graph:e,node:A,run:t,workflows:r,onOpenWorkflow:o,onAskAgent:c})})]},A.id)})]},`${S.group??"ungrouped"}-${x}`))]})}function u3({graph:e,node:t,run:n,workflows:r,onOpenWorkflow:o,onAskAgent:c}){const h=af(n,t.id),l=e.edges.filter(p=>p.from===t.id),u=e.edges.filter(p=>p.to===t.id),m=p=>{var S;return((S=e.nodes.find(x=>x.id===p))==null?void 0:S.label)??p},g=e.groups.filter(p=>p.nodeIds.includes(t.id));return d.jsx("div",{className:"canvas-detail","data-testid":"canvas-step-detail",children:d.jsxs("div",{className:"canvas-detail-body",children:[t.role&&d.jsx("p",{className:"canvas-detail-role",children:t.role}),t.description&&d.jsx("p",{className:"canvas-detail-desc",children:t.description}),g.length>0&&d.jsxs("p",{className:"canvas-detail-groups",children:["Part of ",g.map(p=>p.label).join(", ")]}),c&&d.jsxs("div",{className:"canvas-detail-actions",children:[d.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:()=>c(`Walk me through the "${t.label}" step of this agent: what it does, its inputs and outputs, and its transitions.`),children:[d.jsx(de,{name:"MessageSquare",size:13}),"Ask coding agent"]}),d.jsxs("button",{type:"button",className:"btn-ghost","data-testid":"canvas-detail-modify","data-tooltip":"Ask the coding agent to change this step",onClick:()=>c(`Modify the "${t.label}" step of this agent. Show me the step's code first, then propose the change.`),children:[d.jsx(de,{name:"Wand2",size:13}),"Ask to modify"]}),d.jsxs("button",{type:"button",className:"btn-ghost","data-testid":"canvas-detail-copy-name","data-tooltip":"Copy the step name",onClick:()=>{var p;return void((p=navigator.clipboard)==null?void 0:p.writeText(t.label).catch(()=>{}))},children:[d.jsx(de,{name:"Copy",size:13}),"Copy name"]})]}),d.jsx(bC,{node:t,workflows:r,onOpenWorkflow:o}),h&&d.jsxs("section",{className:"canvas-detail-section","data-testid":"canvas-detail-run",children:[d.jsx("h4",{children:"Agent run"}),d.jsxs("div",{className:"canvas-detail-contract",children:[d.jsx("span",{className:"canvas-input-label",children:"Status"}),d.jsxs("span",{className:"canvas-run-text is-"+h.status,children:[d.jsx(Iv,{status:h.status}),h.status,Dv(n,t.id)&&d.jsx(Lv,{})]})]}),h.latencyMs!==void 0&&d.jsxs("div",{className:"canvas-detail-contract",children:[d.jsx("span",{className:"canvas-input-label",children:"Duration"}),d.jsx("span",{className:"canvas-detail-timeout",children:fr(h.latencyMs)})]}),h.input!==void 0&&d.jsx(Wr,{label:"Input",value:h.input,testId:`canvas-detail-run-input-${t.id}`}),h.output!==void 0&&d.jsx(Wr,{label:"Output",value:h.output,testId:`canvas-detail-run-output-${t.id}`}),h.error&&d.jsx("pre",{className:"canvas-run-error",children:h.error}),h.logSlice&&d.jsx(Wr,{label:"Logs",value:h.logSlice,testId:`canvas-detail-run-logs-${t.id}`})]}),h&&d.jsx(_C,{step:h}),h&&d.jsx(vC,{step:h}),d.jsx(yC,{run:n}),(bc(t).length>0||t.timeoutMs!==null||t.capabilities.length>0)&&d.jsxs("section",{className:"canvas-detail-section",children:[d.jsx("h4",{children:"Contract"}),t.capabilities.length>0&&d.jsxs("div",{className:"canvas-detail-contract","data-testid":"canvas-detail-capabilities",children:[d.jsx("span",{className:"canvas-input-label",children:"Capabilities"}),d.jsx("span",{className:"canvas-input-fields",children:t.capabilities.map(p=>d.jsx("code",{className:"canvas-input-field","data-tooltip":"Sapiom capability this step calls",children:p},p))})]}),bc(t).length>0&&d.jsxs("div",{className:"canvas-detail-contract","data-testid":"canvas-detail-input",children:[d.jsx("span",{className:"canvas-input-label",children:"Input"}),d.jsx("span",{className:"canvas-input-fields",children:bc(t).map(p=>d.jsxs("code",{className:"canvas-input-field"+(p.required?" is-required":""),"aria-label":`${p.name}, ${p.type}${p.required?", required":""}`,"data-tooltip":p.required?"Required field":"Optional field",...Ot({object:"run"}),children:[p.name,p.required&&d.jsx("span",{"aria-hidden":"true",children:"*"}),d.jsx("span",{className:"canvas-input-type",children:p.type})]},p.name))})]}),t.timeoutMs!==null&&d.jsxs("div",{className:"canvas-detail-contract",children:[d.jsx("span",{className:"canvas-input-label",children:"Timeout"}),d.jsx("span",{className:"canvas-detail-timeout",children:fr(t.timeoutMs)})]})]}),d.jsxs("section",{className:"canvas-detail-section",children:[d.jsxs("h4",{children:["Leads to ",d.jsx("span",{className:"canvas-detail-count",children:l.length})]}),l.length===0?d.jsx("p",{className:"canvas-detail-empty",children:"Terminal step: nothing follows."}):d.jsx("ul",{className:"canvas-detail-edges",children:l.map(p=>d.jsx("li",{children:d.jsxs("div",{className:"canvas-detail-edge",children:[d.jsx(de,{name:"CornerDownRight",size:13}),d.jsx("span",{className:"canvas-detail-edge-target",children:m(p.to)}),Wu(p)&&d.jsx("span",{className:"canvas-detail-edge-kind",children:Wu(p)}),p.label&&d.jsx("span",{className:"canvas-detail-edge-cond",children:p.label})]})},`${p.from}->${p.to}`))})]}),d.jsxs("section",{className:"canvas-detail-section",children:[d.jsxs("h4",{children:["Reached from ",d.jsx("span",{className:"canvas-detail-count",children:u.length})]}),u.length===0?d.jsx("p",{className:"canvas-detail-empty",children:t.kind==="entry"?"Entry point: the agent starts here.":"No step routes here."}):d.jsx("ul",{className:"canvas-detail-edges",children:u.map(p=>d.jsx("li",{children:d.jsxs("div",{className:"canvas-detail-edge",children:[d.jsx(de,{name:"CornerLeftUp",size:13}),d.jsx("span",{className:"canvas-detail-edge-target",children:m(p.from)}),Wu(p)&&d.jsx("span",{className:"canvas-detail-edge-kind",children:Wu(p)}),p.label&&d.jsx("span",{className:"canvas-detail-edge-cond",children:p.label})]})},`${p.from}->${p.to}`))})]}),e.warnings.length>0&&d.jsxs("section",{className:"canvas-detail-section",children:[d.jsxs("h4",{children:["Graph warnings ",d.jsx("span",{className:"canvas-detail-count",children:e.warnings.length})]}),d.jsx("ul",{className:"canvas-detail-warnings",children:e.warnings.map(p=>d.jsx("li",{children:p},p))})]})]})})}function d3({node:e,run:t,workflows:n,onOpenWorkflow:r}){const o=af(t,e.id);return d.jsxs("div",{className:"canvas-inspector","data-testid":"canvas-step-inspector",children:[e.role&&d.jsx("p",{className:"canvas-detail-role",children:e.role}),e.description&&d.jsx("p",{className:"canvas-step-desc",children:e.description}),d.jsx(a3,{node:e}),d.jsx(o3,{node:e}),e.timeoutMs!==null&&d.jsxs("div",{className:"canvas-input-card","data-testid":`canvas-inspector-timeout-${e.id}`,children:[d.jsx("span",{className:"canvas-input-label",children:"Timeout"}),d.jsx("span",{className:"canvas-detail-timeout",children:fr(e.timeoutMs)})]}),d.jsx(bC,{node:e,workflows:n,onOpenWorkflow:r}),o&&d.jsxs("div",{className:"canvas-inspector-run","data-testid":"canvas-inspector-run",children:[d.jsx("span",{className:"canvas-input-label",children:"Agent run"}),d.jsxs("span",{className:"canvas-run-text is-"+o.status,children:[d.jsx(Iv,{status:o.status}),o.status,Dv(t,e.id)&&d.jsx(Lv,{})]}),o.latencyMs!==void 0&&d.jsx("span",{className:"canvas-inspector-run-meta",children:fr(o.latencyMs)})]}),(o==null?void 0:o.input)!==void 0&&d.jsx(Wr,{label:"Input",value:o.input,testId:`canvas-inspector-run-input-${e.id}`}),(o==null?void 0:o.output)!==void 0&&d.jsx(Wr,{label:"Output",value:o.output,testId:`canvas-inspector-run-output-${e.id}`}),(o==null?void 0:o.error)&&d.jsx("pre",{className:"canvas-run-error",children:o.error}),(o==null?void 0:o.logSlice)&&d.jsx(Wr,{label:"Logs",value:o.logSlice,testId:`canvas-inspector-run-logs-${e.id}`}),o&&d.jsx(_C,{step:o}),o&&d.jsx(vC,{step:o}),d.jsx(yC,{run:t})]})}function h3({node:e,run:t,onInjectPrompt:n,onClose:r}){const o=e?af(t,e.id):null,[c,h]=O.useState("");function l(m){var x;if(!e){n(m);return}const g=o?{input:o.input,output:o.output,calls:o.calls,unusedStubs:(x=t==null?void 0:t.unusedStubs)==null?void 0:x.map(A=>A.key),stubWarnings:t==null?void 0:t.stubWarnings}:void 0,p=e.capabilities.length>0?{capabilities:e.capabilities}:void 0,S=JR(o??{id:e.id,name:e.id,status:"pending"},g,p);n(`${S}
|
|
465
|
+
|
|
466
|
+
${m}`)}function u(){const m=c.trim();m&&(l(m),h(""))}return d.jsxs("div",{className:"canvas-chat-panel","data-testid":"canvas-chat-panel",children:[d.jsxs("div",{className:"canvas-chat-head",children:[d.jsx("span",{className:"canvas-chat-title","data-testid":"canvas-chat-title",children:e?`Chat · ${e.label}`:"Chat"}),d.jsx("button",{className:"theme-toggle canvas-chat-close","data-testid":"canvas-chat-close","aria-label":"Close chat","data-tooltip":"Close chat",onClick:r,children:d.jsx(de,{name:"X",size:13})})]}),d.jsxs("div",{className:"canvas-inspector-macros","data-testid":"canvas-inspector-macros",children:[e&&d.jsxs(d.Fragment,{children:[d.jsx("button",{className:"canvas-inspector-macro-btn btn-ghost","data-testid":"canvas-macro-slow",onClick:()=>l("Why is this step slow / stuck?"),children:"Why slow / stuck?"}),d.jsx("button",{className:"canvas-inspector-macro-btn "+((o==null?void 0:o.status)==="failed"?"btn-primary":"btn-ghost"),"data-testid":"canvas-macro-debug",onClick:()=>l("Debug this step"),children:"Debug this step"}),d.jsx("button",{className:"canvas-inspector-macro-btn btn-ghost","data-testid":"canvas-macro-explain",onClick:()=>l("Explain this step"),children:"Explain this step"})]}),d.jsxs("div",{className:"canvas-inspector-freeform",children:[d.jsx("textarea",{className:"canvas-inspector-freeform-input","data-testid":"canvas-freeform-input",placeholder:e?"Ask about this step…":"Ask about this agent…",rows:1,value:c,onChange:m=>h(m.target.value),onKeyDown:m=>{m.key==="Enter"&&(m.metaKey||m.ctrlKey)&&(m.preventDefault(),u())}}),d.jsx("button",{className:"btn-primary canvas-inspector-freeform-ask","data-testid":"canvas-freeform-ask",disabled:!c.trim(),onClick:u,children:"Ask"})]})]})]})}const h1=24;function f3({overview:e,selectedNode:t,graph:n,run:r,workflows:o,onOpenWorkflow:c,onOpenSteps:h,onDeselect:l,onCollapse:u,onDescribeWithAI:m,describing:g=!1}){var Q;const p=O.useRef(null),S=O.useRef(null),x=O.useRef(null),A=O.useRef(null),E=O.useRef(ui().canvasInspectorHeight??null),[y,b]=O.useState(null),[v,_]=O.useState(!1),[k,C]=O.useState(!1),w=k||g;O.useEffect(()=>{g&&C(!1)},[g]),O.useEffect(()=>{if(!k)return;const G=window.setTimeout(()=>C(!1),8e3);return()=>window.clearTimeout(G)},[k]);const T=()=>{var ee;const G=(ee=p.current)==null?void 0:ee.parentElement;return G?Math.round(G.getBoundingClientRect().height*.5):Number.MAX_SAFE_INTEGER},j=()=>{var G;return(((G=S.current)==null?void 0:G.offsetHeight)??40)+1},M=O.useCallback(()=>{const G=S.current,ee=x.current,ne=A.current;if(!G||!ee||!ne)return;const z=T(),B=E.current,$=window.getComputedStyle(ee),H=(parseFloat($.paddingTop)||0)+(parseFloat($.paddingBottom)||0),U=G.offsetHeight+ne.offsetHeight+H+1,P=B!=null?Math.min(Math.max(B,j()),z):Math.min(U,z);b(P)},[]);O.useLayoutEffect(M),O.useEffect(()=>{var ne;if(typeof ResizeObserver>"u")return;const G=new ResizeObserver(M),ee=(ne=p.current)==null?void 0:ne.parentElement;return ee&&G.observe(ee),A.current&&G.observe(A.current),()=>G.disconnect()},[M]);const D=G=>{E.current=Math.round(Math.min(Math.max(G,j()),T())),M()},L=()=>{xi({canvasInspectorHeight:E.current})},q=()=>{E.current=null,xi({canvasInspectorHeight:null}),M()},F=G=>{if(G.button!==0)return;const ee=G.currentTarget,ne=p.current;if(!ne)return;try{ee.setPointerCapture(G.pointerId)}catch{}_(!0);const z=G.clientY,B=ne.getBoundingClientRect().height,$=U=>{D(B+(z-U.clientY))},H=()=>{_(!1),L(),window.removeEventListener("pointermove",$),window.removeEventListener("pointerup",H),window.removeEventListener("pointercancel",H)};window.addEventListener("pointermove",$),window.addEventListener("pointerup",H),window.addEventListener("pointercancel",H)},Y=G=>{var ne;const ee=((ne=p.current)==null?void 0:ne.getBoundingClientRect().height)??0;G.key==="ArrowUp"?(G.preventDefault(),D(ee+h1),L()):G.key==="ArrowDown"?(G.preventDefault(),D(ee-h1),L()):G.key==="Home"&&(G.preventDefault(),q())};return d.jsxs("div",{ref:p,className:"canvas-overview"+(v?" is-resizing":"")+(t?" is-inspecting":""),"data-testid":"canvas-overview",style:y!=null?{height:y}:void 0,children:[d.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:F,onDoubleClick:q,onKeyDown:Y}),d.jsx("div",{ref:S,className:"canvas-overview-head",children:t?d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"canvas-step-dot dot--"+t.kind,"aria-hidden":"true"}),d.jsx("span",{className:"canvas-overview-title","data-testid":"canvas-inspector-title",children:t.label}),d.jsx("span",{className:"canvas-detail-kind node--"+t.kind,children:cC(t.kind)}),d.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:h,children:["Open step ",d.jsx(de,{name:"ArrowRight",size:12})]}),d.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:l,children:d.jsx(de,{name:"X",size:13})})]}):d.jsxs(d.Fragment,{children:[d.jsx(de,{name:"Radio",size:13}),"Overview",d.jsx("button",{className:"theme-toggle canvas-overview-close","data-testid":"canvas-overview-toggle","aria-label":"Collapse agent overview","data-tooltip":"Collapse agent overview",onClick:u,children:d.jsx(de,{name:"X",size:13})})]})}),d.jsx("div",{ref:x,className:"canvas-overview-body",children:d.jsx("div",{ref:A,className:"canvas-overview-content",children:t&&n?d.jsx(d3,{graph:n,node:t,run:r,workflows:o,onOpenWorkflow:c}):e&&d.jsxs(d.Fragment,{children:[(e.stats||e.badges&&e.badges.length>0)&&d.jsxs("div",{className:"canvas-overview-meta","data-testid":"canvas-overview-meta",children:[e.stats&&d.jsx("span",{className:"canvas-overview-stats",children:e.stats}),(Q=e.badges)==null?void 0:Q.map(G=>d.jsx("span",{className:"canvas-overview-badge",children:G},G))]}),e.description&&d.jsx("p",{className:"canvas-overview-desc",children:e.description}),m&&d.jsx("button",{type:"button",className:"canvas-describe-ai"+(w?" is-loading":""),"data-testid":"canvas-describe-ai",disabled:w,"aria-busy":w,onClick:()=>{e.description&&!window.confirm("Rewrite this agent's descriptions? The coding agent will edit the source and may replace text you wrote by hand.")||(C(!0),m())},"data-tooltip":"Runs a hidden coding-agent session that writes descriptions into the agent source — the canvas updates when it saves",children:w?d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"canvas-describe-spinner","aria-hidden":"true"}),"Describing…"]}):d.jsxs(d.Fragment,{children:[d.jsx(de,{name:"Sparkles",size:13}),e.description?"Rewrite descriptions with AI":"Describe with AI"]})}),e.notes.length>0&&d.jsx("ul",{className:"canvas-overview-notes",children:e.notes.map(G=>d.jsx("li",{children:G},G))}),e.legend&&e.legend.length>0&&d.jsx("div",{className:"canvas-overview-legend","data-testid":"canvas-overview-legend",children:e.legend.map(G=>d.jsxs("span",{className:"canvas-overview-legend-item",children:[d.jsx("span",{className:"canvas-step-dot dot--"+G.kind,"aria-hidden":"true"}),G.label]},G.kind))})]})})})]})}function En({eyebrow:e,icon:t,title:n,body:r,cta:o,className:c,testId:h,children:l}){return d.jsxs("div",{className:"empty-state"+(c?` ${c}`:""),"data-empty-state":!0,"data-testid":h,children:[t&&d.jsx("span",{className:"empty-state-icon","aria-hidden":"true",children:d.jsx(de,{name:t,size:18})}),e&&d.jsx("span",{className:"empty-state-eyebrow",children:e}),d.jsx("span",{className:"empty-state-title",children:n}),r&&d.jsx("span",{className:"empty-state-body",children:r}),o&&d.jsx("span",{className:"empty-state-cta",children:o}),l]})}function Kr(e){return e.replace(/^@[^/]+\//,"").replace(/^example-/,"").trim()||e}function p3(e,t=Date.now()){const n=Math.max(0,Math.round((t-e)/1e3));if(n<45)return"just now";const r=Math.round(n/60);if(r<60)return`${r}m ago`;const o=Math.round(r/60);return o<24?`${o}h ago`:`${Math.round(o/24)}d ago`}var SC=eC();function Ua(e,{onDismiss:t,containerRef:n,triggerRef:r}){O.useEffect(()=>{if(!e)return;const o=h=>{var u;const l=n.current;!l||!(h.target instanceof Node)||l.contains(h.target)||(u=r==null?void 0:r.current)!=null&&u.contains(h.target)||t()},c=h=>{var l;h.key==="Escape"&&(t(),(l=r==null?void 0:r.current)==null||l.focus())};return document.addEventListener("mousedown",o),document.addEventListener("keydown",c),()=>{document.removeEventListener("mousedown",o),document.removeEventListener("keydown",c)}},[e,t,n,r])}const Zl=4,Si=8;function m3(e,t,n,r,o){const c=e.getBoundingClientRect(),h={position:"fixed",top:"auto",right:"auto",bottom:"auto",left:"auto"};return o&&(h.overflowY="auto"),n&&(h.width=c.width),h.maxWidth=window.innerWidth-2*Si,t.startsWith("right")?(h.left=(r??e).getBoundingClientRect().right+Zl,t.endsWith("start")?(h.top=c.top,o&&(h.maxHeight=window.innerHeight-c.top-Si)):(h.bottom=window.innerHeight-c.bottom,o&&(h.maxHeight=c.bottom-Si)),h):(t.startsWith("down")?(h.top=c.bottom+Zl,o&&(h.maxHeight=window.innerHeight-c.bottom-Zl-Si)):(h.bottom=window.innerHeight-c.top+Zl,o&&(h.maxHeight=c.top-Zl-Si)),t.endsWith("start")?h.left=Math.max(Si,c.left):h.right=Math.max(Si,window.innerWidth-c.right),h)}function Ci({open:e,anchorRef:t,onDismiss:n,placement:r,matchWidth:o=!1,besideRef:c,noClip:h=!1,className:l,role:u,testid:m,children:g}){const p=O.useRef(null),[S,x]=O.useState(null);Ua(e,{onDismiss:n,containerRef:p,triggerRef:t});const A=O.useCallback(()=>{const E=t.current;E&&x(m3(E,r,o,(c==null?void 0:c.current)??null,!h))},[t,r,o,c,h]);return O.useLayoutEffect(()=>{e?A():x(null)},[e,A]),O.useLayoutEffect(()=>{if(!e||S==null)return;const E=p.current;if(!E)return;const y=E.getBoundingClientRect();let b=0;y.left<Si?b=Si-y.left:y.right>window.innerWidth-Si&&(b=window.innerWidth-Si-y.right),!(Math.abs(b)<.5)&&x(v=>v==null?v:{...v,left:typeof v.left=="number"?v.left+b:v.left,right:typeof v.right=="number"?v.right-b:v.right})},[e,S]),O.useEffect(()=>{if(e)return window.addEventListener("resize",A),window.addEventListener("scroll",A,!0),()=>{window.removeEventListener("resize",A),window.removeEventListener("scroll",A,!0)}},[e,A]),!e||S==null?null:SC.createPortal(d.jsx("div",{ref:p,className:l,role:u,"data-testid":m,style:S,children:g}),document.body)}function g3(e,t){return`${t?`${t} run`:"run"} ${e.status}`}function v3({workflow:e,detailStep:t,onBack:n,onAskAgent:r,surface:o,stepsSummary:c,run:h,runTarget:l,runs:u,onSelectRun:m}){const[g,p]=O.useState(!1),S=O.useRef(null),x=O.useCallback(()=>p(!1),[]),[A,E]=O.useState(!1),y=O.useRef(null),b=O.useCallback(()=>E(!1),[]);if(t)return d.jsxs("div",{className:"workflow-actions-header","data-testid":"workflow-actions-header",...Ot({object:"run"}),children:[d.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:d.jsx(de,{name:"ArrowLeft",size:14})}),d.jsx("span",{className:"workflow-actions-name","data-testid":"canvas-detail-title",children:t.label}),d.jsx("span",{className:"canvas-detail-kind node--"+t.kind,children:cC(t.kind)}),d.jsxs("button",{className:"btn-ghost canvas-detail-ask","data-testid":"canvas-detail-ask","aria-label":"Ask coding agent","data-tooltip":"Ask the coding agent in the terminal",onClick:()=>r(`Walk me through the "${t.label}" step of this agent: what it does, its inputs and outputs, and its transitions.`),children:[d.jsx(de,{name:"MessageSquare",size:13}),d.jsx("span",{className:"canvas-detail-ask-label",children:"Ask coding agent"})]}),d.jsxs("div",{className:"canvas-detail-menu-wrap",children:[d.jsx("button",{ref:S,className:"theme-toggle","data-testid":"canvas-detail-menu","aria-label":`More actions for ${t.label}`,"data-tooltip":"More actions","aria-haspopup":"menu","aria-expanded":g,onClick:()=>p(v=>!v),children:d.jsx(de,{name:"EllipsisVertical",size:14})}),d.jsxs(Ci,{open:g,anchorRef:S,onDismiss:x,placement:"down-end",className:"canvas-detail-menu",role:"menu",testid:"canvas-detail-menu-popover",children:[d.jsxs("button",{role:"menuitem",className:"profile-menu-item",onClick:()=>{r(`Modify the "${t.label}" step of this agent. Show me the step's code first, then propose the change.`),x()},children:[d.jsx(de,{name:"Wand2",size:13}),"Ask coding agent to modify"]}),d.jsxs("button",{role:"menuitem",className:"profile-menu-item",onClick:()=>{var v;(v=navigator.clipboard)==null||v.writeText(t.label).catch(()=>{}),x()},children:[d.jsx(de,{name:"Copy",size:13}),"Copy step name"]})]})]})]});if(o==="steps"){const v=h&&d.jsxs(d.Fragment,{children:[h.status==="running"&&d.jsx("span",{className:"canvas-run-status is-running","aria-hidden":"true"}),g3(h,l)]});return d.jsxs("div",{className:"workflow-actions-header"+(h?" has-run":""),"data-testid":"workflow-actions-header",...Ot({object:"agent"}),children:[d.jsx("span",{className:"workflow-actions-name",title:e.name,children:Kr(e.name)}),d.jsx("span",{className:"workflow-actions-count","data-testid":"canvas-steps-count",children:c??"no steps"}),h&&u.length<=1&&d.jsx("span",{className:"status-tag canvas-run-chip is-"+h.status,"data-testid":"canvas-run-chip",children:v}),h&&u.length>1&&d.jsxs("div",{className:"canvas-run-picker-wrap",children:[d.jsxs("button",{ref:y,className:"status-tag status-tag-action canvas-run-chip canvas-run-chip--picker is-"+h.status,"data-testid":"canvas-run-chip","aria-haspopup":"menu","aria-expanded":A,"aria-label":`Pick a run to inspect (${u.length} observed)`,"data-tooltip":"Pick a run to inspect",onClick:()=>E(_=>!_),children:[v,d.jsx(de,{name:"ChevronDown",size:12})]}),d.jsx(Ci,{open:A,anchorRef:y,onDismiss:b,placement:"down-end",className:"canvas-run-menu",role:"menu",testid:"canvas-run-menu",children:[...u].reverse().map((_,k)=>{const C=u.length-k,w=_.run.executionId===h.executionId,T=p3(_.observedAt);return d.jsxs("button",{role:"menuitemradio","aria-checked":w,className:"profile-menu-item"+(w?" is-selected":""),"data-testid":`canvas-run-option-${_.run.executionId}`,title:_.run.executionId,onClick:()=>{m(_.run.executionId),b()},children:[d.jsx(de,{name:w?"Check":"Play",size:13}),d.jsx("span",{children:`run ${C} · ${_.run.status} · ${_.target}`}),d.jsx("span",{className:"canvas-run-option-meta",children:T})]},_.run.executionId)})})]})]})}return null}const Na=[{id:"input",label:"Input"},{id:"output",label:"Output"},{id:"state",label:"State"},{id:"directive",label:"Directive"},{id:"logs",label:"Logs"},{id:"calls",label:"Calls"}];function _3(e){return e.map((t,n)=>({step:t,index:n})).sort((t,n)=>{const r=t.step.startedAt?Date.parse(t.step.startedAt):Number.NaN,o=n.step.startedAt?Date.parse(n.step.startedAt):Number.NaN;return Number.isFinite(r)&&Number.isFinite(o)&&r!==o?r-o:Number.isFinite(r)!==Number.isFinite(o)?Number.isFinite(r)?-1:1:t.index-n.index}).map(({step:t})=>t)}function y3(e){return e==="completed"?"Completed":e==="failed"?"Failed":e==="cancelled"?"Cancelled":"Running"}function b3(e){return e==="prod"?"Cloud":e==="local"?"Local":"Run"}function S3(e){if(e.startedAt&&e.finishedAt){const n=Date.parse(e.startedAt),r=Date.parse(e.finishedAt);if(Number.isFinite(n)&&Number.isFinite(r)&&r>=n)return r-n}const t=e.steps.reduce((n,r)=>n+(r.latencyMs??0),0);return t>0?t:null}function wC({status:e}){return e==="passed"?d.jsx(de,{name:"Check",size:11}):e==="failed"?d.jsx(de,{name:"X",size:11}):e==="running"?d.jsx("span",{className:"run-workspace-pulse"}):d.jsx("span",{className:"run-workspace-pending"})}function w3(e,t){if(!e.startedAt||!t.startedAt)return{left:0,width:e.latencyMs?100:12};const n=Date.parse(t.startedAt),r=Date.parse(e.startedAt),o=t.finishedAt?Date.parse(t.finishedAt):Date.now(),c=e.finishedAt?Date.parse(e.finishedAt):o;return![n,r,o,c].every(Number.isFinite)||o<=n?{left:0,width:e.latencyMs?100:12}:{left:Math.max(0,Math.min(96,(r-n)/(o-n)*100)),width:Math.max(4,Math.min(100,(c-r)/(o-n)*100))}}function f1({attempts:e,run:t,selectedId:n,onSelect:r}){const o=O.useRef([]);return d.jsxs("div",{className:"run-timeline",role:"listbox","aria-label":"Execution attempts","data-testid":"run-timeline",children:[d.jsxs("div",{className:"run-timeline-title",children:["Attempts ",d.jsx("span",{children:e.length})]}),e.map((c,h)=>{const l=w3(c,t);return d.jsxs("button",{ref:u=>{o.current[h]=u},type:"button",role:"option","aria-selected":n===c.id,tabIndex:n===c.id||n===null&&h===0?0:-1,className:"run-timeline-row","data-testid":`run-attempt-${c.id}`,"data-status":c.status,onClick:()=>r(c),onKeyDown:u=>{var g;if(!["ArrowDown","ArrowUp","Home","End"].includes(u.key))return;u.preventDefault();const m=u.key==="Home"?0:u.key==="End"?e.length-1:(h+(u.key==="ArrowDown"?1:-1)+e.length)%e.length;(g=o.current[m])==null||g.focus(),r(e[m])},children:[d.jsx("span",{className:"run-timeline-index",children:String(h+1).padStart(2,"0")}),d.jsx("span",{className:"run-timeline-status","aria-label":c.status,children:d.jsx(wC,{status:c.status})}),d.jsxs("span",{className:"run-timeline-copy",children:[d.jsx("strong",{children:c.name}),d.jsxs("small",{children:["Attempt ",c.attempt??1]})]}),d.jsx("span",{className:"run-timeline-duration",children:c.latencyMs!==void 0?fr(c.latencyMs):c.status}),d.jsx("span",{className:"run-timeline-track","aria-hidden":"true",children:d.jsx("span",{style:{left:`${l.left}%`,width:`${l.width}%`}})})]},c.id)})]})}function x3(e,t){return t==="input"?e.input:t==="output"?e.output:t==="state"?e.sharedState:t==="directive"?e.directive:t==="logs"?e.logSlice:e.calls}function C3({step:e,tab:t}){var r,o;const n=x3(e,t);return n===void 0||t==="calls"&&Array.isArray(n)&&n.length===0?d.jsxs("div",{className:"run-evidence-empty",children:[d.jsx(de,{name:"Info",size:14})," ",(r=Na.find(c=>c.id===t))==null?void 0:r.label," not recorded."]}):t==="calls"&&Array.isArray(n)?d.jsx("div",{className:"run-call-list",children:n.map((c,h)=>d.jsxs("article",{className:"run-call",children:[d.jsxs("header",{children:[d.jsx("code",{children:c.capability}),c.stubUsed&&d.jsx("span",{children:"stubbed"})]}),d.jsxs("div",{className:"run-call-pair",children:[d.jsx("section",{children:c.args===void 0?d.jsx("p",{children:"Arguments not recorded."}):d.jsx(Sc,{value:c.args,label:"Arguments",testId:`run-call-arguments-${h}`,defaultOpen:!1})}),d.jsx("section",{children:c.result===void 0?d.jsx("p",{children:"Result not recorded."}):d.jsx(Sc,{value:c.result,label:"Result",testId:`run-call-result-${h}`,defaultOpen:!1})})]})]},`${c.capability}-${h}`))}):t==="input"||t==="output"||t==="state"||t==="directive"||t==="logs"?d.jsx(Sc,{value:n,label:(o=Na.find(c=>c.id===t))==null?void 0:o.label,testId:"run-evidence-artifact"}):d.jsx("div",{className:"run-evidence-empty",children:"Evidence not recorded."})}function E3(e,t){var r;const n=(r=t.logSlice)==null?void 0:r.slice(-4e3);return JSON.stringify({executionId:e.executionId,runStatus:e.status,runInput:e.input,runOutput:e.output,runError:e.error,attempt:{step:t.name,number:t.attempt??1,status:t.status,startedAt:t.startedAt,finishedAt:t.finishedAt,input:t.input,output:t.output,state:t.sharedState,directive:t.directive,calls:t.calls,error:t.error,logTail:n}},null,2)}function p1({run:e,step:t,tab:n,onTab:r,onBack:o,onAskAgent:c}){const h=O.useRef([]),l=O.useId(),u=`${l}-panel`;return d.jsxs("section",{className:"run-attempt-inspector","aria-label":`${t.name} attempt ${t.attempt??1}`,...Ot({object:"run"}),children:[d.jsxs("header",{className:"run-attempt-head",children:[d.jsxs("button",{type:"button",className:"btn-ghost run-attempt-back",onClick:o,children:[d.jsx(de,{name:"ArrowLeft",size:13})," Back"]}),d.jsxs("div",{children:[d.jsx("h3",{children:t.name}),d.jsxs("p",{children:[d.jsx("span",{"data-status":t.status,children:t.status})," · Attempt"," ",t.attempt??1,t.latencyMs!==void 0?` · ${fr(t.latencyMs)}`:""]})]}),d.jsxs("button",{type:"button",className:"btn-ghost run-attempt-debug",onClick:()=>c(`Help me inspect and improve this execution attempt.
|
|
467
|
+
|
|
468
|
+
${E3(e,t)}`),children:[d.jsx(de,{name:"MessageSquare",size:13})," Ask coding agent"]})]}),t.error&&d.jsxs("div",{className:"run-attempt-error",children:[d.jsx(de,{name:"TriangleAlert",size:14}),d.jsx("span",{children:t.error})]}),d.jsx("div",{className:"run-evidence-tabs",role:"tablist","aria-label":"Attempt evidence",children:Na.map((m,g)=>d.jsx("button",{ref:p=>{h.current[g]=p},type:"button",role:"tab",id:`${l}-${m.id}`,"aria-selected":n===m.id,"aria-controls":u,tabIndex:n===m.id?0:-1,"data-testid":`run-evidence-tab-${m.id}`,onClick:()=>r(m.id),onKeyDown:p=>{var x;if(!["ArrowLeft","ArrowRight","Home","End"].includes(p.key))return;p.preventDefault();const S=p.key==="Home"?0:p.key==="End"?Na.length-1:(g+(p.key==="ArrowRight"?1:-1)+Na.length)%Na.length;r(Na[S].id),(x=h.current[S])==null||x.focus()},children:m.label},m.id))}),d.jsx("div",{className:"run-evidence-panel",id:u,role:"tabpanel","aria-labelledby":`${l}-${n}`,children:d.jsx(C3,{step:t,tab:n})})]})}function k3({run:e}){const t=e.unusedStubs??[],n=e.stubWarnings??[];return t.length===0&&n.length===0?null:d.jsxs("details",{className:"run-stub-notices","data-testid":"run-stub-notices",children:[d.jsxs("summary",{children:["Stub notices ",d.jsx("span",{children:t.length+n.length})]}),t.length>0&&d.jsxs("section",{children:[d.jsx("h4",{children:"Unused stubs"}),d.jsx("ul",{children:t.map(r=>d.jsxs("li",{children:[d.jsx("code",{children:r.step})," · ",r.key]},`${r.step}:${r.key}`))})]}),n.length>0&&d.jsxs("section",{children:[d.jsx("h4",{children:"Warnings"}),d.jsx("ul",{children:n.map((r,o)=>d.jsx("li",{children:r},o))})]})]})}function j3(e){if(e.output!==void 0)return{value:e.output,label:"Result"};const t=[...e.steps].reverse().find(n=>n.status==="passed"&&n.output!==void 0);return t?{value:t.output,label:"Latest output"}:null}function m1({run:e,target:t,workflow:n,focus:r,onToggleFocus:o,onAskAgent:c,onInspectionOpened:h,onArtifactViewed:l,onDashboardOpened:u}){const m=O.useMemo(()=>_3(e.steps),[e.steps]),[g,p]=O.useState(null),[S,x]=O.useState("output"),A=O.useRef(!1),E=O.useRef(null),y=O.useRef(null),b=O.useRef(null),v=m.find(j=>j.id===g)??null,_=j3(e),k=S3(e);O.useEffect(()=>{A.current=!1,E.current=null,p(null),x("output")},[e.executionId]),O.useEffect(()=>{if(!(A.current||e.status==="running"))if(e.status==="failed"){const j=[...m].reverse().find(M=>M.status==="failed");j&&(p(j.id),x("logs"))}else e.status==="completed"&&p(null)},[e.status,m]),O.useEffect(()=>{if(!r||typeof document>"u")return;const j=document.getElementById("root");y.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const M=(j==null?void 0:j.getAttribute("aria-hidden"))??null,D=(j==null?void 0:j.inert)??!1;j&&(j.inert=!0,j.setAttribute("aria-hidden","true"));const L=window.requestAnimationFrame(()=>{var q;return(q=b.current)==null?void 0:q.focus()});return()=>{var q;window.cancelAnimationFrame(L),j&&(j.inert=D,M===null?j.removeAttribute("aria-hidden"):j.setAttribute("aria-hidden",M)),(q=y.current)==null||q.focus(),y.current=null}},[r]),O.useEffect(()=>{if(!r)return;const j=M=>{M.key==="Escape"&&(M.preventDefault(),M.stopImmediatePropagation(),g!==null?p(null):o())};return window.addEventListener("keydown",j),()=>window.removeEventListener("keydown",j)},[r,g,o]);const C=j=>{A.current=!0,p(j.id),x(j.status==="failed"?"logs":"output"),h==null||h()},w=d.jsxs("section",{className:"run-overview",children:[!r&&d.jsx(f1,{attempts:m,run:e,selectedId:g,onSelect:C}),_?d.jsx(Sc,{value:_.value,label:_.label,viewEventKey:e.executionId,onViewed:()=>{E.current!==e.executionId&&(E.current=e.executionId,l==null||l())}}):e.status==="running"?d.jsxs("div",{className:"run-result-pending",children:[d.jsx("span",{className:"run-workspace-pulse"})," Waiting for the agent result…"]}):e.error!==void 0?d.jsxs("div",{className:"run-result-error",children:[d.jsx(de,{name:"TriangleAlert",size:15}),d.jsx("pre",{children:hC(e.error)})]}):d.jsx("div",{className:"run-result-pending",children:"No result was recorded."}),d.jsx(k3,{run:e})]}),T=d.jsxs("div",{className:"run-workspace"+(r?" is-focus":""),"data-testid":"run-workspace",children:[d.jsxs("header",{className:"run-workspace-header",children:[d.jsxs("span",{className:"run-workspace-status","data-status":e.status,children:[d.jsx(wC,{status:e.status==="completed"?"passed":e.status==="failed"||e.status==="cancelled"?"failed":"running"}),y3(e.status)]}),k!==null&&d.jsx("span",{children:fr(k)}),d.jsx("span",{children:b3(t)}),d.jsx("span",{className:"run-workspace-spacer"}),(n==null?void 0:n.definitionId)!=null&&d.jsxs("a",{href:of(n.definitionId),target:"_blank",rel:"noreferrer",onClick:u,children:[d.jsx(de,{name:"Cloud",size:12})," Dashboard"]}),r&&d.jsx("button",{ref:b,type:"button",className:"theme-toggle",onClick:o,"aria-label":"Exit Focus mode",children:d.jsx(de,{name:"Minimize2",size:14})})]}),r?d.jsxs("div",{className:"run-workspace-focus-grid",children:[d.jsx(f1,{attempts:m,run:e,selectedId:g,onSelect:C}),d.jsx("div",{className:"run-workspace-inspector",children:v?d.jsx(p1,{run:e,step:v,tab:S,onTab:x,onBack:()=>p(null),onAskAgent:c}):w})]}):v?d.jsx(p1,{run:e,step:v,tab:S,onTab:x,onBack:()=>p(null),onAskAgent:c}):w]});return r&&typeof document<"u"?SC.createPortal(d.jsx("div",{className:"run-focus-layer","data-testid":"run-focus-layer",role:"dialog","aria-modal":"true","aria-label":"Execution Focus mode",children:T}),document.body):T}var _e=typeof window<"u"?window:void 0,vn=typeof globalThis<"u"?globalThis:_e,kn=vn==null?void 0:vn.navigator,Be=vn==null?void 0:vn.document,$s=vn==null?void 0:vn.location,Pv=vn==null?void 0:vn.fetch,Rg=vn!=null&&vn.XMLHttpRequest&&"withCredentials"in new vn.XMLHttpRequest?vn.XMLHttpRequest:void 0,g1=vn==null?void 0:vn.AbortController,R3=vn==null?void 0:vn.CompressionStream,Ln=kn==null?void 0:kn.userAgent;function xC(){return!(!_e||_e.navigator.onLine===!1)}var Ql=typeof globalThis<"u"?globalThis:_e;Ql&&typeof self>"u"&&(Ql.self=Ql),Ql&&typeof File>"u"&&(Ql.File=function(){});var Ye=_e??{},Ft={DEBUG:!1,LIB_VERSION:"0.3.1",LIB_NAME:"browser-common"};function v1(e,t,n,r,o,c,h){try{var l=e[c](h),u=l.value}catch(m){return void n(m)}l.done?t(u):Promise.resolve(u).then(r,o)}function ms(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var c=e.apply(t,n);function h(u){v1(c,r,o,h,l,"next",u)}function l(u){v1(c,r,o,h,l,"throw",u)}h(void 0)}))}}function Te(){return Te=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Te.apply(null,arguments)}function CC(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var _1=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}};function y1(e){return typeof e=="string"||e}function b1(e){return typeof e=="string"?e:void 0}var ec,A3=["$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"],or=(function(e){return e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.EnablePersonProcessing="enable_person_processing",e.PersonMode="person_mode",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.AiQueue="ai_queue",e.LogsQueue="logs_queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e.DeviceId="device_id",e})({}),S1=(function(e){return e.GZipJS="gzip-js",e.Base64="base64",e})({}),T3=["$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"],N3=["token"],EC="NativeGzipValidationError",Ag=e=>e.length>=2&&e[0]===31&&e[1]===139,w1=(e,t)=>e===S1.GZipJS||t===S1.GZipJS||t==="gzip",x1=e=>!(!e||typeof e!="object")&&("name"in e?String(e.name):"")==="NotReadableError",Ku=e=>{var t=new Error("Native gzip produced invalid output: "+e);throw t.name=EC,t},M3=(function(){var e=ms((function*(t,n){18>t.size&&Ku("too-short");var r=new Uint8Array(yield t.slice(0,10).arrayBuffer());Ag(r)&&r[2]===8||Ku("invalid-header");var o=new DataView(yield t.slice(t.size-8).arrayBuffer());o.getUint32(0,!0)!==(h=>{for(var l=(()=>{if(ec)return ec;ec=[];for(var g=0;256>g;g++){for(var p=g,S=0;8>S;S++)p=1&p?3988292384^p>>>1:p>>>1;ec[g]=p>>>0}return ec})(),u=4294967295,m=0;h.length>m;m++)u=l[255&(u^h[m])]^u>>>8;return(4294967295^u)>>>0})(n)&&Ku("invalid-crc");var c=n.length>>>0;o.getUint32(4,!0)!==c&&Ku("invalid-size")}));return function(t,n){return e.apply(this,arguments)}})();function Tg(){return Tg=ms((function*(e,t,n){t===void 0&&(t=!0);try{var r=new TextEncoder().encode(e),o=new globalThis.CompressionStream("gzip"),c=o.writable.getWriter(),h=c.write(r).then((()=>c.close())).catch((function(){var m=ms((function*(g){try{yield c.abort(g)}catch{}throw g}));return function(g){return m.apply(this,arguments)}})()),l=new Response(o.readable).blob(),u=(yield Promise.all([l,h]))[0];return yield M3(u,r),u}catch(m){if(n!=null&&n.rethrow)throw m;return t&&console.error("Failed to gzip compress data",m),null}})),Tg.apply(this,arguments)}var $3=["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"],C1=function(e,t){if(t===void 0&&(t=[]),!e)return!1;var n=e.toLowerCase();return $3.concat(t).some((r=>{var o=r.toLowerCase();return n.indexOf(o)!==-1}))};function lt(e,t){return e.indexOf(t)!==-1}var lf=function(e){return e.trim()},Ng=function(e){return e.replace(/^\$/,"")};function kC(e){var t,n=[];return(t=JSON.stringify(e,(function(r,o){if(typeof o=="bigint")return o.toString();if(typeof o!="function"&&typeof o!="symbol"){if(o instanceof Error)return{name:o.name,message:o.message,stack:o.stack};if(o&&typeof o=="object"){for(;n.length>0&&n[n.length-1]!==this;)n.pop();if(n.includes(o))return"[Circular]";n.push(o)}return o}})))!==null&&t!==void 0?t:"null"}var jC=Object.prototype,RC=jC.hasOwnProperty,cf=jC.toString,dt=Array.isArray||function(e){return cf.call(e)==="[object Array]"},Gn=e=>typeof e=="function",ps=e=>e===Object(e)&&!dt(e),Vr=e=>{if(ps(e)){for(var t in e)if(RC.call(e,t))return!1;return!0}return!1},De=e=>e===void 0,es=e=>cf.call(e)=="[object String]",Mg=e=>es(e)&&e.trim().length===0,Rn=e=>e===null,ft=e=>De(e)||Rn(e),on=e=>cf.call(e)=="[object Number]"&&e==e,rr=e=>on(e)&&e>0,wi=e=>cf.call(e)==="[object Boolean]",D3=e=>e instanceof FormData,O3=e=>lt(T3,e),L3=e=>lt(N3,e);function AC(e){return e===null||typeof e!="object"}function kh(e,t){return{}.toString.call(e)==="[object "+t+"]"}function Bv(e){return typeof Event<"u"&&(function(t,n){try{return t instanceof n}catch{return!1}})(e,Event)}var I3=[!0,"true",1,"1","yes"],jm=e=>lt(I3,e),P3=[!1,"false",0,"0","no"];function Oi(e,t,n,r,o){return t>n&&(r.warn("min cannot be greater than max."),t=n),on(e)?e>n?(r.warn(" cannot be greater than max: "+n+". Using max value instead."),n):t>e?(r.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(r.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+o),Oi(o||n,t,n,r))}class B3{constructor(t){this.tt={},this.et=t.et,this.rt=Oi(t.bucketSize,0,100,t.it),this.nt=Oi(t.refillRate,0,this.rt,t.it),this.st=Oi(t.refillInterval,0,864e5,t.it)}ot(t,n){var r=Math.floor((n-t.lastAccess)/this.st);r>0&&(t.tokens=Math.min(t.tokens+r*this.nt,this.rt),t.lastAccess=t.lastAccess+r*this.st)}consumeRateLimit(t){var n,r=Date.now(),o=String(t),c=this.tt[o];return c?this.ot(c,r):this.tt[o]=c={tokens:this.rt,lastAccess:r},c.tokens===0||(c.tokens--,c.tokens===0&&((n=this.et)==null||n.call(this,t)),c.tokens===0)}stop(){this.tt={}}}var Yn="Mobile",jh="iOS",hr="Android",Zo="Tablet",TC=hr+" "+Zo,NC="iPad",MC="Apple",$C=MC+" Watch",wc="Safari",Qo="BlackBerry",DC="Samsung",OC=DC+"Browser",LC=DC+" Internet",Oa="Chrome",z3=Oa+" OS",IC=Oa+" "+jh,zv="Internet Explorer",PC=zv+" "+Yn,Hv="Opera",H3=Hv+" Mini",Uv="Edge",BC="Microsoft "+Uv,Go="Firefox",zC=Go+" "+jh,Nc="Nintendo",Mc="PlayStation",Wo="Xbox",HC=hr+" "+Yn,UC=Yn+" "+wc,pc="Windows",$g=pc+" Phone",E1="Nokia",Dg="Ouya",FC="Generic",U3=FC+" "+Yn.toLowerCase(),qC=FC+" "+Zo.toLowerCase(),Og="Konqueror",VC="Oculus Browser",Rh="Vivaldi",GC="Yandex",Ah="Whale",Lg="DuckDuckGo",WC="Pale Moon",Th="Waterfox",xc="Brave",KC="Google Search App",Ss="(\\d+(\\.\\d+)?)",Rm=new RegExp("Version/"+Ss),F3=new RegExp(Wo,"i"),q3=new RegExp(Mc+" \\w+","i"),V3=new RegExp(Nc+" \\w+","i"),Fv=new RegExp(Qo+"|PlayBook|BB10","i"),G3={"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"},YC=function(e,t,n,r){t=t||"";var o=(function(c){return c!=null&&c.brave?xc:null})(n);return o||(r!=null&&r.detectGoogleSearchApp&<(e,"GSA/")?KC:lt(e," OPR/")&<(e,"Mini")?H3:lt(e," OPR/")?Hv:Fv.test(e)?Qo:lt(e,"IE"+Yn)||lt(e,"WPDesktop")?PC:lt(e,"OculusBrowser")?VC:lt(e,OC)?LC:lt(e,Uv)||lt(e,"Edg/")?BC:lt(e,Rh+"/")?Rh:lt(e,"YaBrowser/")?GC:lt(e,Ah+"/")?Ah:lt(e,Lg+"/")||lt(e,"Ddg/")?Lg:lt(e,"FBIOS")?"Facebook "+Yn:lt(e,"UCWEB")||lt(e,"UCBrowser")?"UC Browser":lt(e,"CriOS")?IC:lt(e,"CrMo")||lt(e,Oa)?Oa:lt(e,hr)&<(e,wc)?HC:lt(e,"FxiOS")?zC:lt(e.toLowerCase(),Og.toLowerCase())?Og:lt(e,xc+"/")?xc:((c,h)=>h&<(h,MC)||(function(l){return lt(l,wc)&&!lt(l,Oa)&&!lt(l,hr)})(c))(e,t)?lt(e,Yn)?UC:wc:lt(e,"PaleMoon/")?WC:lt(e,Th+"/")?Th:lt(e,Go)?Go:lt(e,"MSIE")||lt(e,"Trident/")?zv:lt(e,"Gecko")?Go:"")},W3={[PC]:[new RegExp("rv:"+Ss)],[BC]:[new RegExp(Uv+"?\\/"+Ss)],[Oa]:[new RegExp("("+Oa+"|CrMo)\\/"+Ss)],[IC]:[new RegExp("CriOS\\/"+Ss)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Ss)],[wc]:[Rm],[UC]:[Rm],[Hv]:[new RegExp("(Opera|OPR)\\/"+Ss)],[Go]:[new RegExp(Go+"\\/"+Ss)],[zC]:[new RegExp("FxiOS\\/"+Ss)],[Og]:[new RegExp("Konqueror[:/]?"+Ss,"i")],[Qo]:[new RegExp(Qo+" "+Ss),Rm],[HC]:[new RegExp("android\\s"+Ss,"i")],[LC]:[new RegExp(OC+"\\/"+Ss)],[VC]:[new RegExp("OculusBrowser\\/"+Ss)],[Rh]:[new RegExp(Rh+"\\/"+Ss)],[GC]:[new RegExp("YaBrowser\\/"+Ss)],[Ah]:[new RegExp(Ah+"\\/"+Ss)],[xc]:[new RegExp(xc+"\\/"+Ss)],[Lg]:[new RegExp("(DuckDuckGo|Ddg)\\/"+Ss)],[WC]:[new RegExp("PaleMoon\\/"+Ss)],[Th]:[new RegExp(Th+"\\/"+Ss)],[KC]:[new RegExp("GSA\\/"+Ss)],[zv]:[new RegExp("(rv:|MSIE )"+Ss)],Mozilla:[new RegExp("rv:"+Ss)]},K3=function(e,t,n,r){var o=YC(e,t,n,r),c=W3[o];if(De(c))return null;for(var h=0;c.length>h;h++){var l=e.match(c[h]);if(l)return parseFloat(l[l.length-2])}return null},k1=[[new RegExp(Wo+"; "+Wo+" (.*?)[);]","i"),e=>[Wo,e&&e[1]||""]],[new RegExp(Nc,"i"),[Nc,""]],[new RegExp(Mc,"i"),[Mc,""]],[Fv,[Qo,""]],[new RegExp(pc,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[$g,""];if(new RegExp(Yn).test(t)&&!/IEMobile\b/.test(t))return[pc+" "+Yn,""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var r=G3[n[1]]||"";return/arm/i.test(t)&&(r="RT"),[pc,r]}return[pc,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[jh,[e[3],e[4],e[5]||"0"].join(".")]:[jh,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=De(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+hr+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+hr+")","i"),e=>e&&e[2]?[hr,[e[2],e[3],e[4]||"0"].join(".")]:[hr,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[z3,""]],[/Linux|debian/i,["Linux",""]]],j1=function(e){return V3.test(e)?Nc:q3.test(e)?Mc:F3.test(e)?Wo:new RegExp(Dg,"i").test(e)?Dg:new RegExp("("+$g+"|WPDesktop)","i").test(e)?$g:/iPad/.test(e)?NC:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?$C:Fv.test(e)?Qo:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(E1,"i").test(e)?E1:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(Yn).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?hr:TC:new RegExp("(pda|"+Yn+")","i").test(e)?U3:new RegExp(Zo,"i").test(e)&&!new RegExp(Zo+" pc","i").test(e)?qC:""},Y3=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function R1(e,t){return typeof(n=e)=="string"&&Y3.test(n)?e:t();var n}function Yr(e){return e&&e.split("#")[0]}function ph(e,t){var n=setTimeout(e,t);return n!=null&&n.unref&&(n==null||n.unref()),n}var X3=e=>e instanceof Error,XC={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}},J3=XC.info;function JC(e){if(wi(e))return{boolValue:e};if(typeof e=="number")return Number.isFinite(e)?Number.isInteger(e)?{intValue:e}:{doubleValue:e}:{stringValue:String(e)};if(typeof e=="string")return{stringValue:e};if(dt(e))return{arrayValue:{values:e.map((t=>JC(t)))}};try{return{stringValue:JSON.stringify(e)}}catch{return{stringValue:String(e)}}}function Nh(e){var t=[];for(var n in e){var r=e[n];Rn(r)||De(r)||t.push({key:n,value:JC(r)})}return t}function Z3(e,t){var n=XC[e.level||"info"]||J3,r=n.text,o=n.number,c=String(Date.now())+"000000",h={};t.distinctId&&(h.posthogDistinctId=t.distinctId),t.sessionId&&(h.sessionId=t.sessionId),t.windowId&&(h["window.id"]=t.windowId),ft(t.sessionStartTimestamp)||(h.sessionStartTimestamp=String(t.sessionStartTimestamp)),ft(t.lastActivityTimestamp)||(h.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(h["url.full"]=t.currentUrl),t.screenName&&(h["screen.name"]=t.screenName),t.appState&&(h["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(h.feature_flags=t.activeFeatureFlags);var l=Te({},h,e.attributes||{}),u={timeUnixNano:c,observedTimeUnixNano:c,severityNumber:o,severityText:r,body:{stringValue:e.body},attributes:Nh(l)};return e.trace_id&&(u.traceId=e.trace_id),e.span_id&&(u.spanId=e.span_id),De(e.trace_flags)||(u.flags=e.trace_flags),u}function ZC(e,t,n){return Te({},e.resourceAttributes,{"service.name":e.serviceName||"unknown_service"},e.environment&&{"deployment.environment":e.environment},e.serviceVersion&&{"service.version":e.serviceVersion},{"telemetry.sdk.name":t,"telemetry.sdk.version":n})}function QC(e,t,n,r){return{resourceLogs:[{resource:{attributes:Nh(t)},scopeLogs:[{scope:{name:n,version:r},logRecords:e}]}]}}let Q3=class{constructor(e,t,n,r,o,c,h){var l;c===void 0&&(c=()=>Promise.resolve()),this._instance=e,this.Te=t,this.it=n,this.ut=r,this.ht=o,this.dt=c,this.ct=h,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((l=t.maxQueueSize)!==null&&l!==void 0?l: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(e){if(!this._instance.isDisabled&&!this._instance.optedOut&&e!=null&&e.body){var t=this.Rt(e);if(t!==null)if(t.body){if(this.Pt()){var n={record:Z3(t,this.ut())};this.ht((()=>this.Ot(n)))}}else this.it.info("Log was rejected in beforeSend function")}}Rt(e){var t=this.Te.beforeSend;if(!t)return e;var n=dt(t)?t:[t],r=e;for(var o of n)try{var c=o(r);if(!c)return this.it.info("Log was rejected in beforeSend function"),null;r=c}catch(h){return this.it.error("Error in beforeSend function for log:",h),null}return r}Pt(){if(this.It===void 0)return!0;var e=Date.now(),t=e-this.bt;return this.Mt>t&&t>=0||(this.bt=e,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 e=this;return ms((function*(){if(!e._instance.isDisabled)return e.vt||(e.vt=e.Ft().finally((()=>{e.vt=null}))),e.vt}))()}Ft(){var e=this;return ms((function*(){var t;e.Tt();var n=(t=e._instance.getPersistedProperty(or.LogsQueue))!==null&&t!==void 0?t:[];if(n.length!==0)for(var r=n.length,o=0;n.length>0&&r>o;){var c,h;e.ft=0;var l=Math.min(n.length,e.Ct),u=n.slice(0,l),m=QC(u.map((p=>p.record)),e.At(),(c=e.ct)!==null&&c!==void 0?c:e._instance.getLibraryId(),e._instance.getLibraryVersion()),g=yield e._instance.$t(m);if(g.kind==="too-large"&&u.length>1)e.Ct=Math.max(1,Math.floor(u.length/2)),e.it.warn("Received 413 when sending logs batch of size "+u.length+", reducing batch size to "+e.Ct);else if(g.kind==="retry-later"||(g.kind==="too-large"?e.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."):g.kind==="ok"&&e.Te.maxBatchRecordsPerPost>e.Ct&&(e.Ct=Math.min(e.Te.maxBatchRecordsPerPost,e.Ct+1)),yield e.Lt(u.length),n=(h=e._instance.getPersistedProperty(or.LogsQueue))!==null&&h!==void 0?h:[],o+=u.length,g.kind==="fatal"))throw g.error}}))()}Lt(e){var t=this;return ms((function*(){var n,r=Math.max(0,e-t.ft),o=(n=t._instance.getPersistedProperty(or.LogsQueue))!==null&&n!==void 0?n:[];t._instance.setPersistedProperty(or.LogsQueue,o.slice(r)),yield t.dt()}))()}At(){return ZC(this.Te,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ot(e){var t;if(!this._instance.optedOut){var n=(t=this._instance.getPersistedProperty(or.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(e),this._instance.setPersistedProperty(or.LogsQueue,n),this.xt>n.length?this.Dt():this.Et()}}Dt(e){e===void 0&&(e=this.St),this.Nt||(this.Nt=ph((()=>{this.Nt=void 0,this.Et()}),e))}qt(){var e=Math.min(Math.max(0,this.yt-1),6);return this.St*Math.pow(2,e)}jt(){var e=this._instance.getPersistedProperty(or.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return ms((function*(){t.Tt();var n=t.flush().catch((()=>{}));e!==void 0?yield Promise.race([n,new Promise((r=>ph(r,e)))]):yield n}))()}flushWithTimeout(e){var t=this;return ms((function*(){var n=!1,r=t.flush(),o=new Promise((c=>ph((()=>{n=!0,c()}),e)));try{yield Promise.race([r,o])}finally{n&&r.catch((()=>{}))}}))()}Et(){this.flush().then((()=>{this.yt=0}),(e=>{this.yt++,this.it.error("PostHog logs flush failed:",e)})).finally((()=>{!this._instance.isDisabled&&this.jt()&&this.Dt(this.qt())}))}Tt(){this.Nt&&(clearTimeout(this.Nt),this.Nt=void 0)}};var Am=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function A1(e){return String(e)+"000000"}function T1(e,t,n,r){var o="";return r&&(o=Object.keys(r).sort().map((c=>JSON.stringify(c)+":"+JSON.stringify(r[c]))).join(",")),e+"\0"+t+"\0"+(n??"")+"\0"+o}let e4=class{constructor(e,t,n){this._instance=e,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(e,t,n){t===void 0&&(t=1),this.Wt({name:e,type:"count",value:t,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}gauge(e,t,n){this.Wt({name:e,type:"gauge",value:t,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}histogram(e,t,n){this.Wt({name:e,type:"histogram",value:t,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}flush(){var e=this,t=this.vt,n=(function(){var o=ms((function*(){t&&(yield t.catch((()=>{}))),yield e.Zt()}));return function(){return o.apply(this,arguments)}})(),r=n().finally((()=>{this.vt===r&&(this.vt=null)}));return this.vt=r,r}drainWindow(){if(this.Bt.size===0)return null;var e=this.Bt;return this.Bt=new Map,this.Ht=!1,this.Ut=new Map,this.zt=new Set,this.Gt(e)}reset(){this.Vt++,this.Tt(),this.Bt=new Map,this.vt=null,this.Ht=!1,this.Ut=new Map,this.zt=new Set}Wt(e){if(!this._instance.isDisabled&&!this._instance.optedOut){var t=this.Rt(e);if(t!==null)if(t.name&&typeof t.name=="string")if(typeof t.value=="number"&&Number.isFinite(t.value))if(t.type==="count"&&0>t.value)this.it.warn("Dropping count '"+t.name+"': counters are monotonic, value must be >= 0");else{var n,r;try{n=t.attributes?Te({},t.attributes):void 0,r=T1(t.type,t.name,t.unit,n)}catch(h){return void this.it.warn("Dropping metric '"+t.name+"': attributes could not be serialized",h)}var o=this.Bt.get(r);if(!o){if(!this.Qt())return;o={name:t.name,type:t.type,unit:t.unit,attributes:n,windowStartMs:Date.now()},this.Bt.set(r,o)}var c=this.Ut.get(t.name);c===void 0?this.Ut.set(t.name,t.type):c===t.type||this.zt.has(t.name)||(this.zt.add(t.name),this.it.warn("Metric name '"+t.name+"' is already used as a "+c+"; recording it as a "+t.type+" too will blend both series in charts. Use a distinct name.")),this.Jt(o,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(e,t){var n;switch(e.type){case"count":e.total=((n=e.total)!==null&&n!==void 0?n:0)+t;break;case"gauge":e.last=t;break;case"histogram":e.hist||(e.hist={count:0,sum:0,min:t,max:t,bucketCounts:new Array(Am.length+1).fill(0)});var r=e.hist;r.count+=1,r.sum+=t,r.min=Math.min(r.min,t),r.max=Math.max(r.max,t),r.bucketCounts[(function(o,c){for(var h=0;c.length>h;h++)if(c[h]>=o)return h;return c.length})(t,Am)]+=1}}Rt(e){var t=this.Te.beforeSend;if(!t)return e;var n=dt(t)?t:[t],r=e;for(var o of n)try{var c=o(r);if(!c)return this.it.info("Metric was rejected in beforeSend function"),null;r=c}catch(h){return this.it.error("Error in beforeSend function for metric:",h),null}return r}Dt(){this.Nt||(this.Nt=ph((()=>{this.Nt=void 0,this.flush().catch((e=>{this.it.error("Metrics flush failed:",e)}))}),this.Te.flushIntervalMs))}Tt(){this.Nt&&(clearTimeout(this.Nt),this.Nt=void 0)}Zt(){var e=this;return ms((function*(){if(e.Bt.size!==0){var t=e.Bt;e.Bt=new Map,e.Ht=!1,e.Ut=new Map,e.zt=new Set;var n=e.Vt,r=yield e._instance.Kt(e.Gt(t));if(n===e.Vt)switch(r.kind){case"ok":return;case"retry-later":return e.Yt(t),void e.Dt();case"too-large":return void e.it.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e.it.error("Failed to send metrics batch:",r.error)}}}))()}Gt(e){return t=this.Xt(e),n=(function(c,h,l){return Te({},c.resourceAttributes,{"service.name":c.serviceName||"unknown_service"},c.environment&&{"deployment.environment":c.environment},c.serviceVersion&&{"service.version":c.serviceVersion},{"telemetry.sdk.name":h,"telemetry.sdk.version":l})})(this.Te,this._instance.getLibraryId(),this._instance.getLibraryVersion()),r=this._instance.getLibraryId(),o=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:Nh(n)},scopeMetrics:[{scope:{name:r,version:o},metrics:t}]}]};var t,n,r,o}Xt(e){var t=A1(Date.now()),n=new Map;for(var r of e.values()){var o,c=T1(r.type,r.name,r.unit,void 0),h=n.get(c);h||(h=Te({name:r.name},r.unit&&{unit:r.unit}),r.type==="count"?h.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:r.type==="gauge"?h.gauge={dataPoints:[]}:h.histogram={aggregationTemporality:1,dataPoints:[]},n.set(c,h));var l=Nh((o=r.attributes)!==null&&o!==void 0?o:{}),u=A1(r.windowStartMs);if(r.type==="count"){var m,g={attributes:l,startTimeUnixNano:u,timeUnixNano:t,asDouble:(m=r.total)!==null&&m!==void 0?m:0};h.sum.dataPoints.push(g)}else if(r.type==="gauge"){var p,S={attributes:l,timeUnixNano:t,asDouble:(p=r.last)!==null&&p!==void 0?p:0};h.gauge.dataPoints.push(S)}else r.hist&&h.histogram.dataPoints.push({attributes:l,startTimeUnixNano:u,timeUnixNano:t,count:r.hist.count,sum:r.hist.sum,min:r.hist.min,max:r.hist.max,bucketCounts:r.hist.bucketCounts,explicitBounds:Am})}return Array.from(n.values())}Yt(e){var t,n;for(var r of e){var o=r[0],c=r[1],h=this.Bt.get(o);if(h)switch(h.windowStartMs=Math.min(h.windowStartMs,c.windowStartMs),h.type){case"count":h.total=((t=h.total)!==null&&t!==void 0?t:0)+((n=c.total)!==null&&n!==void 0?n:0);break;case"gauge":break;case"histogram":if(c.hist)if(h.hist){h.hist.count+=c.hist.count,h.hist.sum+=c.hist.sum,h.hist.min=Math.min(h.hist.min,c.hist.min),h.hist.max=Math.max(h.hist.max,c.hist.max);for(var l=0;h.hist.bucketCounts.length>l;l++)h.hist.bucketCounts[l]+=c.hist.bucketCounts[l]}else h.hist=c.hist}else this.Qt()&&this.Bt.set(o,c)}}};var Yu,N1,Tm;function t4(e){var t=globalThis._posthogChunkIds;if(t){var n=Object.keys(t);return Tm&&n.length===N1||(N1=n.length,Tm=n.reduce(((r,o)=>{Yu||(Yu={});var c=Yu[o];if(c)r[c[0]]=c[1];else for(var h=e(o),l=h.length-1;l>=0;l--){var u=h[l],m=u==null?void 0:u.filename,g=t[o];if(m&&g){r[m]=g,Yu[o]=[m,g];break}}return r}),{})),Tm}}class s4{constructor(t,n,r){r===void 0&&(r=[]),this.coercers=t,this.stackParser=n,this.modifiers=r}buildFromUnknown(t,n){n===void 0&&(n={});var r=n&&n.mechanism||{handled:!0,type:"generic"},o=this.buildCoercingContext(r,n,0).apply(t),c=this.buildParsingContext(n),h=this.parseStacktrace(o,c);return{$exception_list:this.convertToExceptionList(h,r),$exception_level:"error"}}modifyFrames(t){var n=this;return ms((function*(){for(var r of t)r.stacktrace&&r.stacktrace.frames&&dt(r.stacktrace.frames)&&(r.stacktrace.frames=yield n.applyModifiers(r.stacktrace.frames));return t}))()}coerceFallback(t){var n;return{type:"Error",value:"Unknown error",stack:(n=t.syntheticException)==null?void 0:n.stack,synthetic:!0}}parseStacktrace(t,n){var r,o;return t.cause!=null&&(r=this.parseStacktrace(t.cause,n)),t.stack!=""&&t.stack!=null&&(o=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?n.skipFirstLines:0),n.chunkIdMap)),Te({},t,{cause:r,stack:o})}applyChunkIds(t,n){return t.map((r=>(r.filename&&n&&(r.chunk_id=n[r.filename]),r)))}applyCoercers(t,n){for(var r of this.coercers)if(r.match(t))return r.coerce(t,n);return this.coerceFallback(n)}applyModifiers(t){var n=this;return ms((function*(){var r=t;for(var o of n.modifiers)r=yield o(r);return r}))()}convertToExceptionList(t,n){var r,o,c,h={type:t.type,value:t.value,mechanism:{type:(r=n.type)!==null&&r!==void 0?r:"generic",handled:(o=n.handled)===null||o===void 0||o,synthetic:(c=t.synthetic)!==null&&c!==void 0&&c}};t.stack&&(h.stacktrace={type:"raw",frames:t.stack});var l=[h];return t.cause!=null&&l.push(...this.convertToExceptionList(t.cause,Te({},n,{handled:!0}))),l}buildParsingContext(t){var n;return{chunkIdMap:t4(this.stackParser),skipFirstLines:(n=t.skipFirstLines)!==null&&n!==void 0?n:1}}buildCoercingContext(t,n,r){r===void 0&&(r=0);var o=(c,h)=>{if(4>=h){var l=this.buildCoercingContext(t,n,h);return this.applyCoercers(c,l)}};return Te({},n,{syntheticException:r==0?n.syntheticException:void 0,mechanism:t,apply:c=>o(c,r),next:c=>o(c,r+1)})}}var el="?";function Ig(e,t,n,r,o){var c={platform:e,filename:t,function:n==="<anonymous>"?el:n,in_app:!0};return De(r)||(c.lineno=r),De(o)||(c.colno=o),c}var eE=(e,t)=>{var n=e.indexOf("safari-extension")!==-1,r=e.indexOf("safari-web-extension")!==-1;return n||r?[e.indexOf("@")!==-1?e.split("@")[0]:el,n?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},n4=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,i4=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,r4=/\((\S*)(?::(\d+))(?::(\d+))\)/,a4=(e,t)=>{var n=n4.exec(e);if(n)return Ig(t,n[1],el,+n[2],+n[3]);var r=i4.exec(e);if(r){if(r[2]&&r[2].indexOf("eval")===0){var o=r4.exec(r[2]);o&&(r[2]=o[1],r[3]=o[2],r[4]=o[3])}var c=eE(r[1]||el,r[2]);return Ig(t,c[1],c[0],r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},o4=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,l4=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,c4=(e,t)=>{var n=o4.exec(e);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){var r=l4.exec(n[3]);r&&(n[1]=n[1]||"eval",n[3]=r[1],n[4]=r[2],n[5]="")}var o=n[3],c=n[1]||el,h=eE(c,o);return Ig(t,o=h[1],c=h[0],n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},M1=/\(error: (.*)\)/;class u4{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,n){var r=es(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:r?t.stack:void 0,cause:t.cause?n.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var n=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?n+": "+t.message:n}isDOMException(t){return kh(t,"DOMException")}isDOMError(t){return kh(t,"DOMError")}}class d4{match(t){return(n=>n instanceof Error)(t)}coerce(t,n){return{type:this.getType(t),value:this.getMessage(t,n),stack:this.getStack(t),cause:t.cause?n.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,n){var r=t.message;return String(r.error&&typeof r.error.message=="string"?r.error.message:r)}getStack(t){return t.stacktrace||t.stack||void 0}}class h4{constructor(){}match(t){return kh(t,"ErrorEvent")&&t.error!=null}coerce(t,n){var r;return n.apply(t.error)||{type:"ErrorEvent",value:t.message,stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}var f4=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class p4{match(t){return typeof t=="string"}coerce(t,n){var r,o=this.getInfos(t),c=o[0],h=o[1];return{type:c??"Error",value:h??t,stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}getInfos(t){var n="Error",r=t,o=t.match(f4);return o&&(n=o[1],r=o[2]),[n,r]}}var m4=["fatal","error","warning","log","info","debug"];function tE(e,t){t===void 0&&(t=40);var n=Object.keys(e);if(n.sort(),!n.length)return"[object has no keys]";for(var r=n.length;r>0;r--){var o=n.slice(0,r).join(", ");if(t>=o.length)return r===n.length?o:o.length>t?o.slice(0,t)+"...":o}return""}class g4{match(t){return typeof t=="object"&&t!==null}coerce(t,n){var r,o=this.getErrorPropertyFromObject(t);return o?n.apply(o):{type:this.getType(t),value:this.getValue(t),stack:(r=n.syntheticException)==null?void 0:r.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return Bv(t)?t.constructor.name:"Error"}getValue(t){if("name"in t&&typeof t.name=="string"){var n="'"+t.name+"' captured as exception";return"message"in t&&typeof t.message=="string"&&(n+=" with message: '"+t.message+"'"),n}if("message"in t&&typeof t.message=="string")return t.message;var r=this.getObjectClassName(t);return(r&&r!=="Object"?"'"+r+"'":"Object")+" captured as exception with keys: "+tE(t)}isSeverityLevel(t){return es(t)&&!Mg(t)&&m4.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var n in t)if({}.hasOwnProperty.call(t,n)){var r=t[n];if(X3(r))return r}}getObjectClassName(t){try{var n=Object.getPrototypeOf(t);return n?n.constructor.name:void 0}catch{return}}}class v4{match(t){return Bv(t)}coerce(t,n){var r,o=t.constructor.name;return{type:o,value:o+" captured as exception with keys: "+tE(t),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class _4{match(t){return AC(t)}coerce(t,n){var r;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class y4{match(t){return kh(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!Bv(t))return!1;try{var n=t.detail;return n!=null&&typeof n=="object"&&"reason"in n}catch{return!1}}coerce(t,n){var r,o=this.getUnhandledRejectionReason(t);return AC(o)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(o),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}:n.apply(o)}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 Mh="$message",$h="$timestamp",b4=new Set([Mh,$h]),Nm={enabled:!0,max_bytes:32768};function Dh(e){var t;return e?{enabled:(t=e.enabled)!==null&&t!==void 0?t:Nm.enabled,max_bytes:w4(e.max_bytes,Nm.max_bytes)}:Te({},Nm)}class S4{constructor(t){this.$e=[],this.ze=0,this.Te=Dh(t)}setConfig(t){this.Te=Dh(t),this.Ze()}add(t){var n=(function(o){var c;try{c=kC(o)}catch{return}try{var h=JSON.parse(c);if(!ps(h))return;var l=h,u=l[Mh],m=l[$h];return!es(u)||u.trim().length===0||!es(m)&&!on(m)?void 0:{step:l,json:c}}catch{return}})(t);if(n){var r=(function(o){if(typeof TextEncoder<"u")return new TextEncoder().encode(o).length;for(var c=encodeURIComponent(o),h=0,l=0;c.length>l;l++)c[l]==="%"?(h+=1,l+=2):h+=1;return h})(n.json);r>this.Te.max_bytes||(this.$e.push({step:n.step,bytes:r}),this.ze+=r,this.Ze())}}getAttachable(){return this.$e.map((t=>t.step))}clear(){this.$e=[],this.ze=0}size(){return this.$e.length}Ze(){for(;this.ze>this.Te.max_bytes&&this.$e.length>0;){var t=this.$e.shift();t&&(this.ze-=t.bytes)}}}function w4(e,t){if(!on(e)||e===1/0||e===-1/0)return t;var n=Math.floor(e);return 0>n?t:n}var sE=function(e,t){var n=(t===void 0?{}:t).debugEnabled,r={k(o){if(_e&&(Ft.DEBUG||_e.POSTHOG_DEBUG||n)&&!De(_e.console)&&_e.console){for(var c=("__rrweb_original__"in _e.console[o])?_e.console[o].__rrweb_original__:_e.console[o],h=arguments.length,l=new Array(h>1?h-1:0),u=1;h>u;u++)l[u-1]=arguments[u];c(e,...l)}},debug(){for(var o=arguments.length,c=new Array(o),h=0;o>h;h++)c[h]=arguments[h];r.k("debug",...c)},info(){for(var o=arguments.length,c=new Array(o),h=0;o>h;h++)c[h]=arguments[h];r.k("log",...c)},warn(){for(var o=arguments.length,c=new Array(o),h=0;o>h;h++)c[h]=arguments[h];r.k("warn",...c)},error(){for(var o=arguments.length,c=new Array(o),h=0;o>h;h++)c[h]=arguments[h];r.k("error",...c)},critical(){for(var o=arguments.length,c=new Array(o),h=0;o>h;h++)c[h]=arguments[h];console.error(e,...c)},uninitializedWarning(o){r.error("You must initialize PostHog before calling "+o)},createLogger:(o,c)=>sE(e+" "+o,c)};return r},Oe=sE("[PostHog.js]"),vs=Oe.createLogger,x4=vs("[ExternalScriptsLoader]"),Mm=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return x4.warn(t+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var r=Be==null?void 0:Be.querySelectorAll("script");if(r){for(var o,c=function(){if(r[h].src===t){var u=r[h];return u.__posthog_loading_callback_fired?{v:n()}:(u.addEventListener("load",(m=>{u.__posthog_loading_callback_fired=!0,n(void 0,m)})),u.onerror=m=>n(m),{v:void 0})}},h=0;r.length>h;h++)if(o=c())return o.v}var l=()=>{if(!Be)return n("document not found");var u=Be.createElement("script");if(u.type="text/javascript",u.crossOrigin="anonymous",u.src=t,u.onload=p=>{u.__posthog_loading_callback_fired=!0,n(void 0,p)},u.onerror=p=>n(p),e.config.prepare_external_dependency_script&&(u=e.config.prepare_external_dependency_script(u)),!u)return n("prepare_external_dependency_script returned null");if(e.config.external_scripts_inject_target==="head")Be.head.appendChild(u);else{var m,g=Be.querySelectorAll("body > script");g.length>0?(m=g[0].parentNode)==null||m.insertBefore(u,g[0]):Be.body.appendChild(u)}};Be!=null&&Be.body?l():Be==null||Be.addEventListener("DOMContentLoaded",l)};Ye.__PosthogExtensions__=Ye.__PosthogExtensions__||{},Ye.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{if(t!=="remote-config"){var r;if(e.config.strict_script_versioning)r=e.requestRouter.endpointFor("assets","/static/"+e.version+"/"+t+".js");else{var o="/static/"+t+".js?v="+e.version;if(t==="toolbar"){var c=3e5;o=o+"&t="+Math.floor(Date.now()/c)*c}r=e.requestRouter.endpointFor("assets",o)}Mm(e,r,n)}else{var h=e.requestRouter.endpointFor("assets","/array/"+e.config.token+"/config.js");Mm(e,h,n)}},Ye.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{var r=e.requestRouter.endpointFor("api",t);Mm(e,r,n)};Ft.DEBUG=!1,Ft.LIB_VERSION="1.409.5",Ft.LIB_NAME="web";var nE="$people_distinct_id",$c="$device_id",$m="$device_model",mc="__alias",gc="__timers",Pg="$autocapture_disabled_server_side",Bg="$heatmaps_enabled_server_side",zg="$exception_capture_enabled_server_side",Hg="$error_tracking_suppression_rules",Ug="$error_tracking_capture_extension_exceptions",Fg="$web_vitals_enabled_server_side",qv="$dead_clicks_enabled_server_side",Vv="$product_tours_enabled_server_side",qg="$web_vitals_allowed_metrics",Da="$session_recording_remote_config",iE="$replay_sample_rate",rE="$replay_override_sampling",aE="$replay_override_linked_flag",oE="$replay_override_url_trigger",lE="$replay_override_event_trigger",Ho="$sesid",Gv="$session_is_sampled",Ma="$enabled_feature_flags",mh="$active_feature_flags",vc="$early_access_features",Vg="$feature_flag_details",gh="$feature_flag_payloads",Gg="$feature_flag_request_id",Oh="$minimal_flag_called_events",ar="$override_feature_flags",Po="$override_feature_flag_payloads",Ra="$stored_person_properties",Aa="$stored_group_properties",Wg="$surveys",Lh="$surveys_loaded_at",Kg="$surveys_activated",vh="$surveys_activated_session",_c="ph_product_tours",Cc="$flag_call_reported",Yg="$flag_call_reported_session_id",Xg="$feature_flag_errors",Dc="$feature_flag_evaluated_at",oi="$user_state",Jg="$client_session_props",Zg="$capture_rate_limit",Qg="$initial_campaign_params",ev="$initial_referrer_info",Ih="$initial_person_info",Ph="$epp",Xu="$posthog_cookieless",cE="$cookieless_mode",uE="$sdk_debug_extensions_init_method",dE="$sdk_debug_extensions_init_time_ms",hE="$sdk_debug_recording_script_not_loaded",Wv="PostHog loadExternalDependency extension not found.",Ta="on_reject",cr="always",Ao="anonymous",va="identified",tv="identified_only",Bh="visibilitychange",zh="beforeunload",Bo="$pageview",Dm="$pageleave",Om="$identify",$1="$groupidentify";function Ju(e,t){dt(e)&&e.forEach(t)}function ts(e,t){if(!ft(e))if(dt(e))e.forEach(t);else if(D3(e))e.forEach(((r,o)=>t(r,o)));else for(var n in e)RC.call(e,n)&&t(e[n],n)}var rs=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;t>r;r++)n[r-1]=arguments[r];for(var o of n)for(var c in o)o[c]!==void 0&&(e[c]=o[c]);return e};function _h(e){for(var t=Object.keys(e),n=t.length,r=new Array(n);n--;)r[n]=[t[n],e[t[n]]];return r}var D1=function(e){try{return e()}catch{return}},C4=function(e){return function(){try{for(var t=arguments.length,n=new Array(t),r=0;t>r;r++)n[r]=arguments[r];return e.apply(this,n)}catch(o){Oe.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Oe.critical(o)}}},Kv=function(e){var t={};return ts(e,(function(n,r){(es(n)&&n.length>0||on(n))&&(t[r]=n)})),t},E4=["herokuapp.com","vercel.app","netlify.app"];function k4(e){var t=e==null?void 0:e.hostname;if(!es(t))return!1;var n=t.split(".").slice(-2).join(".");for(var r of E4)if(n===r)return!1;return!0}function ws(e,t,n,r){var o=r??{},c=o.capture,h=o.passive;e==null||e.addEventListener(t,n,{capture:c!==void 0&&c,passive:h===void 0||h})}function fE(e){return e.name==="ph_toolbar_internal"}var pE=e=>{if(Be){try{for(var t=e+"=",n=Be.cookie.split(";").filter((c=>c.length)),r=0;n.length>r;r++){for(var o=n[r];o.charAt(0)==" ";)o=o.substring(1,o.length);if(o.indexOf(t)===0)return decodeURIComponent(o.substring(t.length,o.length))}}catch{}return null}};Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return on(e)&&isFinite(e)&&Math.floor(e)===e});class Hh{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,n,r,o){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(o)||0>t||0>n||0>r||0>o||t>0xffffffffffff||n>4095||r>1073741823||o>4294967295)throw new RangeError("invalid field value");var c=new Uint8Array(16);return c[0]=t/Math.pow(2,40),c[1]=t/Math.pow(2,32),c[2]=t/Math.pow(2,24),c[3]=t/Math.pow(2,16),c[4]=t/256,c[5]=t,c[6]=112|n>>>8,c[7]=n,c[8]=128|r>>>24,c[9]=r>>>16,c[10]=r>>>8,c[11]=r,c[12]=o>>>24,c[13]=o>>>16,c[14]=o>>>8,c[15]=o,new Hh(c)}toString(){for(var t="",n=0;this.bytes.length>n;n++)t=t+(this.bytes[n]>>>4).toString(16)+(15&this.bytes[n]).toString(16),n!==3&&n!==5&&n!==7&&n!==9||(t+="-");if(t.length!==36)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new Hh(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(var n=0;16>n;n++){var r=this.bytes[n]-t.bytes[n];if(r!==0)return Math.sign(r)}return 0}}class j4{generate(){var t=this.generateOrAbort();if(!De(t))return t;this.S=0;var n=this.generateOrAbort();if(De(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 Hh.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 R4}}var O1,mE=e=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};_e&&!De(_e.crypto)&&crypto.getRandomValues&&(mE=e=>crypto.getRandomValues(e));class R4{nextUint32(){return this.R.length>this.O||(mE(this.R),this.O=0),this.R[this.O++]}constructor(){this.R=new Uint32Array(8),this.O=1/0}}var lr=()=>A4().toString(),A4=()=>(O1||(O1=new j4)).generate(),tc="",T4=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,ur={N:()=>!!Be,P(e){Oe.error("cookieStore error: "+e)},q:pE,F(e){var t;try{t=JSON.parse(ur.q(e))||{}}catch{}return t},A(e,t,n,r,o){if(!Be)return!1;try{var c="",h="",l=(function(g,p){if(p){var S=(function(A,E){if(E===void 0&&(E=Be),tc)return tc;if(!E||["localhost","127.0.0.1"].includes(A))return"";for(var y=A.split("."),b=Math.min(y.length,8),v="dmn_chk_"+lr();!tc&&b--;){var _=y.slice(b).join("."),k=v+"=1;domain=."+_+";path=/";E.cookie=k+";max-age=3",E.cookie.includes(v)&&(E.cookie=k+";max-age=0",tc=_)}return tc})(g);if(!S){var x=(A=>{var E=A.match(T4);return E?E[0]:""})(g);x!==S&&Oe.info("Warning: cookie subdomain discovery mismatch",x,S),S=x}return S?"; domain=."+S:""}return""})(Be.location.hostname,r);if(n){var u=new Date;u.setTime(u.getTime()+864e5*n),c="; expires="+u.toUTCString()}o&&(h="; secure");var m=e+"="+encodeURIComponent(JSON.stringify(t))+c+"; SameSite=Lax; path=/"+l+h;return m.length>3686.4&&Oe.warn("cookieStore warning: large cookie, len="+m.length),Be.cookie=m,!0}catch{return!1}},D(e,t){if(Be!=null&&Be.cookie)try{ur.A(e,"",-1,t)}catch{return}}},Lm=null,is={N(){if(!Rn(Lm))return Lm;var e=!0;if(De(_e))e=!1;else try{var t="__mplssupport__";is.A(t,"xyz"),is.q(t)!=='"xyz"'&&(e=!1),is.D(t)}catch{e=!1}return e||Oe.error("localStorage unsupported; falling back to cookie store"),Lm=e,e},P(e){Oe.error("localStorage error: "+e)},q(e){try{return _e==null?void 0:_e.localStorage.getItem(e)}catch(t){is.P(t)}return null},F(e){try{return JSON.parse(is.q(e))||{}}catch{}return null},A(e,t){try{return _e==null||_e.localStorage.setItem(e,JSON.stringify(t)),!0}catch(n){is.P(n)}return!1},D(e){try{_e==null||_e.localStorage.removeItem(e)}catch(t){is.P(t)}}},N4=[$c,"distinct_id",Ho,Gv,Ph,Ih,oi],Zu={},M4={N:()=>!0,P(e){Oe.error("memoryStorage error: "+e)},q:e=>Zu[e]||null,F:e=>Zu[e]||null,A:(e,t)=>(Zu[e]=t,!0),D(e){delete Zu[e]}},_a=null,an={N(){if(!Rn(_a))return _a;if(_a=!0,De(_e))_a=!1;else try{var e="__support__";an.A(e,"xyz"),an.q(e)!=='"xyz"'&&(_a=!1),an.D(e)}catch{_a=!1}return _a},P(e){Oe.error("sessionStorage error: ",e)},q(e){try{return _e==null?void 0:_e.sessionStorage.getItem(e)}catch(t){an.P(t)}return null},F(e){try{return JSON.parse(an.q(e))||null}catch{}return null},A(e,t){try{return _e==null||_e.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(n){an.P(n)}return!1},D(e){try{_e==null||_e.sessionStorage.removeItem(e)}catch(t){an.P(t)}}};class $4{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===cr||this.isRejected()||this.consent===-1&&this.Te.cookieless_mode===Ta}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Te.opt_out_capturing_by_default}optInOut(t){this.Je.A(this.Ke,t?1:0,this.Te.cookie_expiration,this.Te.cross_subdomain_cookie,this.Te.secure_cookie)}reset(){this.Je.D(this.Ke,this.Te.cross_subdomain_cookie)}get Ke(){var t=this._instance.config,n=t.token,r=t.opt_out_capturing_cookie_prefix;return t.consent_persistence_name||(r?r+n:"__ph_opt_in_out_"+n)}get Qe(){var t=this.Je.q(this.Ke);return jm(t)?1:lt(P3,t)?0:-1}get Je(){var t=this.Te.opt_out_capturing_persistence_type,n=t==="localStorage"?is:ur;if(!this.Ye||this.Ye!==n){this.Ye=n;var r=t==="localStorage"?ur:is;r.q(this.Ke)&&(this.Ye.q(this.Ke)||this.optInOut(jm(r.q(this.Ke))),r.D(this.Ke,this.Te.cross_subdomain_cookie))}return this.Ye}Ge(){return!!this.Te.respect_dnt&&[kn==null?void 0:kn.doNotTrack,kn==null?void 0:kn.msDoNotTrack,Ye.doNotTrack].some((t=>jm(t)))}}function gE(e,t){var n,r=e==null||(n=e.config)==null?void 0:n.get_current_url;if(!Gn(r))return t;try{var o=r(t);return es(o)&&o?o:t}catch(c){return Oe.error("Error in get_current_url, falling back to window.location.href",c),t}}var vE="__POSTHOG_TOOLBAR__",D4=1,O4=3,L4=11;function L1(e){return e instanceof Element&&(e.id===vE||!(e.closest==null||!e.closest(".toolbar-global-fade-container")))}function Xr(e){return!!e&&e.nodeType===D4}function Wn(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function _E(e){return!!e&&e.nodeType===O4}function yE(e){return!!e&&e.nodeType===L4&&Xr(e.host)}var bE=1e3;function Yv(e){return e?lf(e).split(/\s+/):[]}function I1(e,t){var n=(function(r){var o,c=_e==null||(o=_e.location)==null?void 0:o.href;return De(c)?void 0:gE(r,c)})(t);return!!(n&&e&&e.some((r=>n.match(r))))}function Uh(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return Yv(t)}function SE(e){return ft(e)?null:lf(e).split(/(\s+)/).filter((t=>Ec(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Oc(e){var t="";return nv(e)&&!EE(e)&&e.childNodes&&e.childNodes.length&&ts(e.childNodes,(function(n){var r;_E(n)&&n.textContent&&(t+=(r=SE(n.textContent))!==null&&r!==void 0?r:"")})),lf(t)}function Im(e){var t;return De(e.target)?e.srcElement||null:(t=e.target)!=null&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}var Xv=["a","button","form","input","select","textarea","label"];function sv(e,t){if(De(t))return!0;var n,r=function(c){if(t.some((h=>(function(l,u){var m=l.matches||l.matchesSelector||l.msMatchesSelector||l.mozMatchesSelector||l.webkitMatchesSelector||l.oMatchesSelector;try{return!!m&&m.call(l,u)}catch{return!1}})(c,h))))return{v:!0}};for(var o of e)if(n=r(o))return n.v;return!1}function wE(e){var t=e.parentNode;return!(!t||!Xr(t))&&t}var I4=[".ph-no-autocapture","[data-ph-no-autocapture]"],xE=["next","previous","prev",">","<"],P4=[...xE,"+","-","−","–"],P1=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,B1=[".ph-no-rageclick",".ph-no-capture"],B4=["","text","search","email","password","url","tel","number"];function z1(e,t){if(!_e||Jv(e))return!1;var n,r,o,c,h;if(wi(t)?(n=!!t&&B1,r=void 0,o=!1):(n=(c=t==null?void 0:t.css_selector_ignorelist)!==null&&c!==void 0?c:B1,r=t==null?void 0:t.content_ignorelist,o=(h=t==null?void 0:t.ignore_text_selection)!==null&&h!==void 0&&h),n===!1||o&&(function(u){return!(!u||!Xr(u))&&(!!Wn(u,"textarea")||(Wn(u,"input")?lt(B4,(u.getAttribute("type")||"").toLowerCase()):(function(m){if(m.isContentEditable)return!0;var g=m.getAttribute==null?void 0:m.getAttribute("contenteditable");return g==="true"||g===""})(u)))})(e))return!1;var l=CE(e,!1).targetElementList;return!(function(u,m){if(u===!1||De(u))return!1;var g;if(u===!0)g=xE;else{if(!dt(u))return!1;if(u.length>10)return Oe.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;g=u.map((p=>p.toLowerCase()))}return m.some((p=>{var S=p.safeText,x=p.ariaLabel;return g.some((A=>P1(S,A)||P1(x,A)))}))})(r,l.map((u=>{var m;return{safeText:Oc(u).toLowerCase(),ariaLabel:((m=u.getAttribute("aria-label"))==null?void 0:m.toLowerCase().trim())||""}})))&&!sv(l,n)}var Jv=e=>!e||Wn(e,"html")||!Xr(e),CE=(e,t)=>{if(!_e||Jv(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,r=[e],o=e;o.parentNode&&!Wn(o,"body");)if(yE(o.parentNode))r.push(o.parentNode.host),o=o.parentNode.host;else{var c=wE(o);if(!c)break;if(t||Xv.indexOf(c.tagName.toLowerCase())>-1)n=!0;else try{var h=_e.getComputedStyle(c);h&&h.getPropertyValue("cursor")==="pointer"&&(n=!0)}catch{}r.push(c),o=c}return{parentIsUsefulElement:n,targetElementList:r}};function nv(e){for(var t=new Set,n=0,r=e;r.parentNode&&!Wn(r,"body");r=r.parentNode){if(n++>=bE||t.has(r))return!1;t.add(r);var o=Uh(r);if(lt(o,"ph-sensitive")||lt(o,"ph-no-capture"))return!1}if(lt(Uh(e),"ph-include"))return!0;var c=e.type||"";if(es(c))switch(c.toLowerCase()){case"hidden":case"password":return!1}var h=e.name||e.id||"";return!es(h)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(h.replace(/[^a-zA-Z0-9]/g,""))}function EE(e){return!!(Wn(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Wn(e,"select")||Wn(e,"textarea")||e.getAttribute("contenteditable")==="true")}var H1=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}))$"),U1=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,z4=[16,15,14,13],H4=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),F1=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),q1=/[0-9A-Za-z_]/;function U4(e){for(var t=0,n=!1,r=e.length-1;r>=0;r--){var o=e.charCodeAt(r)-48;n&&(o*=2)>9&&(o-=9),t+=o,n=!n}return t%10==0}function Ec(e,t){if(t===void 0&&(t=!0),ft(e))return!1;if(es(e)){e=lf(e);var n=t?H1.test((e||"").replace(/[- ]/g,"")):(function(o){var c;for(U1.lastIndex=0;c=U1.exec(o);){var h=c[2];if(h)for(var l=h.replace(/[- ]/g,""),u=0;l.length>u;u++)for(var m of z4){var g=u+m;if(l.length>=g){var p=l.slice(u,g);if(H1.test(p)&&U4(p))return!0}}}return!1})(e);if(n)return!1;var r=t?H4.test(e):(function(o){var c;for(F1.lastIndex=0;c=F1.exec(o);){var h=c[1],l=c[3];if(!(h&&l&&q1.test(h)&&q1.test(l)))return!0}return!1})(e);if(r)return!1}return!0}function V1(e){var t=Oc(e);return Ec(t=(t+" "+kE(e)).trim())?t:""}function kE(e){var t="";return e&&e.childNodes&&e.childNodes.length&&ts(e.childNodes,(function(n){var r;if(n&&((r=n.tagName)==null?void 0:r.toLowerCase())==="span")try{var o=Oc(n);t=(t+" "+o).trim(),n.childNodes&&n.childNodes.length&&(t=(t+" "+kE(n)).trim())}catch(c){Oe.error("[AutoCapture]",c)}})),t}function G1(e){return e.replace(/"|\\"/g,'\\"')}function F4(e){var t=e.attr__class;if(t)return dt(t)?t:Yv(t)}var Qu=vs("[Dead Clicks]"),q4=()=>!0,V4=e=>{var t,n=!((t=e.instance.persistence)==null||!t.get_property(qv)),r=e.instance.config.capture_dead_clicks;return wi(r)?r:!!ps(r)||n};class W1{get lazyLoadedDeadClicksAutocapture(){return this.Xe}constructor(t,n,r){this.instance=t,this.isEnabled=n,this.onCapture=r,this.startIfEnabledOrStop()}onRemoteConfig(t){if(t.ok){var n=t.config;"captureDeadClicks"in n&&(this.instance.persistence&&this.instance.persistence.register({[qv]:n.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.tr((()=>{this.er()})):this.stop()}tr(t){var n,r;(n=Ye.__PosthogExtensions__)!=null&&n.initDeadClicksAutocapture?t():(r=Ye.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this.instance,"dead-clicks-autocapture",(o=>{o?Qu.error("failed to load script",o):t()}))}er(){var t;if(Be){if(!this.Xe&&(t=Ye.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture){var n=ps(this.instance.config.capture_dead_clicks)?Te({},this.instance.config.capture_dead_clicks):{};n.__onCapture=this.onCapture,this.onCapture&&(n.capture_dead_swipes=!1),this.Xe=Ye.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.Xe.start(Be),Qu.info("starting...")}}else Qu.error("`document` not found. Cannot start.")}stop(){this.Xe&&(this.Xe.stop(),this.Xe=void 0,Qu.info("stopping..."))}}var Pm=vs("[SegmentIntegration]"),jE="posthog-js";function RE(e,t){var n=t===void 0?{}:t,r=n.organization,o=n.projectId,c=n.prefix,h=n.severityAllowList,l=h===void 0?["error"]:h,u=n.sendExceptionsToPostHog,m=u===void 0||u;return g=>{var p,S,x,A,E;if(l!=="*"&&!l.includes(g.level)||!e.__loaded)return g;g.tags||(g.tags={});var y=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());g.tags["PostHog Person URL"]=y,e.sessionRecordingStarted()&&(g.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var b,v=((p=g.exception)==null?void 0:p.values)||[],_=v.map((C=>Te({},C,{stacktrace:C.stacktrace?Te({},C.stacktrace,{type:"raw",frames:(C.stacktrace.frames||[]).map((w=>Te({},w,{platform:"web:javascript"})))}):void 0}))),k={$exception_message:((S=v[0])==null?void 0:S.value)||g.message,$exception_type:(x=v[0])==null?void 0:x.type,$exception_level:g.level,$exception_list:_,$sentry_event_id:g.event_id,$sentry_exception:g.exception,$sentry_exception_message:((A=v[0])==null?void 0:A.value)||g.message,$sentry_exception_type:(E=v[0])==null?void 0:E.type,$sentry_tags:g.tags};return r&&o&&(k.$sentry_url=(c||"https://sentry.io/organizations/")+r+"/issues/?project="+o+"&query="+g.event_id),m&&((b=e.exceptions)==null||b.sendExceptionEvent(k)),g}}class G4{constructor(t,n,r,o,c,h){this.name=jE,this.setupOnce=function(l){l(RE(t,{organization:n,projectId:r,prefix:o,severityAllowList:c,sendExceptionsToPostHog:h==null||h}))}}}class K1{constructor(t){this.rr=(n,r,o)=>{o&&(o.noSessionId||o.activityTimeout||o.sessionPastMaximumLength||o.crossTabAdoption)&&(Oe.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:n,changeReason:o}),this.ir=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.nr()}nr(){var t;this.sr=(t=this._instance.sessionManager)==null?void 0:t.onSessionId(this.rr)}destroy(){var t;(t=this.sr)==null||t.call(this),this.sr=void 0}doPageView(t,n){var r,o=this.ar(t,n);return this.ir={pathname:(r=_e==null?void 0:_e.location.pathname)!==null&&r!==void 0?r:"",pageViewId:n,timestamp:t},this._instance.scrollManager.resetContext(),o}doPageLeave(t){var n;return this.ar(t,(n=this.ir)==null?void 0:n.pageViewId)}doEvent(){var t;return{$pageview_id:(t=this.ir)==null?void 0:t.pageViewId}}ar(t,n){var r=this.ir;if(!r)return{$pageview_id:n};var o={$pageview_id:n,$prev_pageview_id:r.pageViewId},c=this._instance.scrollManager.getContext();if(c&&!this._instance.config.disable_scroll_properties){var h=c.maxScrollHeight,l=c.lastScrollY,u=c.maxScrollY,m=c.maxContentHeight,g=c.lastContentY,p=c.maxContentY;if(!(De(h)||De(l)||De(u)||De(m)||De(g)||De(p))){h=Math.ceil(h),l=Math.ceil(l),u=Math.ceil(u),m=Math.ceil(m),g=Math.ceil(g),p=Math.ceil(p);var S=h>1?Oi(l/h,0,1,Oe):1,x=h>1?Oi(u/h,0,1,Oe):1,A=m>1?Oi(g/m,0,1,Oe):1,E=m>1?Oi(p/m,0,1,Oe):1;o=rs(o,{$prev_pageview_last_scroll:l,$prev_pageview_last_scroll_percentage:S,$prev_pageview_max_scroll:u,$prev_pageview_max_scroll_percentage:x,$prev_pageview_last_content:g,$prev_pageview_last_content_percentage:A,$prev_pageview_max_content:p,$prev_pageview_max_content_percentage:E})}}return r.pathname&&(o.$prev_pageview_pathname=r.pathname),r.timestamp&&(o.$prev_pageview_duration=(t.getTime()-r.timestamp.getTime())/1e3),o}}var Bm=["flags","surveys"],W4={[nE]:{exposure:"hidden"},[mc]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[gc]:{exposure:"hidden"},[Pg]:{exposure:"event"},[Bg]:{exposure:"hidden"},[zg]:{exposure:"event"},[Hg]:{exposure:"hidden"},[Ug]:{exposure:"event"},[Fg]:{exposure:"event"},[qv]:{exposure:"event"},[Vv]:{exposure:"hidden"},[qg]:{exposure:"event"},[Da]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[Ho]:{exposure:"hidden"},[Gv]:{exposure:"event"},[iE]:{exposure:"event",shouldSkipFromEventProperties:e=>Rn(e)},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},$sess_rec_flush_size:{exposure:"hidden"},[Ma]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(e,t)=>t(),transformToEventProperties(e){if(!ps(e))return{};for(var t={},n=Object.keys(e),r=0;n.length>r;r++)t["$feature/"+n[r]]=e[n[r]];return t}},[mh]:{exposure:"event",storageGroup:"flags"},[vc]:{exposure:"hidden"},[Vg]:{exposure:"hidden",storageGroup:"flags"},[gh]:{exposure:"event",storageGroup:"flags"},[Gg]:{exposure:"event",storageGroup:"flags",volatile:!0},[Oh]:{exposure:"hidden",storageGroup:"flags"},[ar]:{exposure:"event"},[Po]:{exposure:"hidden"},[Ra]:{exposure:"hidden"},[Aa]:{exposure:"hidden"},[Wg]:{exposure:"hidden",storageGroup:"surveys"},[Lh]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[Kg]:{exposure:"event"},[vh]:{exposure:"hidden"},[_c]:{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"},[Cc]:{exposure:"hidden"},[Yg]:{exposure:"hidden"},[Xg]:{exposure:"hidden"},[Dc]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[oi]:{exposure:"hidden"},[Jg]:{exposure:"hidden"},[Zg]:{exposure:"hidden"},[Qg]:{exposure:"hidden"},[ev]:{exposure:"hidden"},[Ih]:{exposure:"hidden"},[Ph]:{exposure:"hidden"},[rE]:{exposure:"event"},[aE]:{exposure:"event"},[oE]:{exposure:"event"},[lE]:{exposure:"event"},[uE]:{exposure:"event"},[dE]:{exposure:"event"},[hE]:{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"}},K4=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],ya=e=>{var t=W4[e];if(t)return t;for(var n of K4){var r=n[1];if(e.indexOf(n[0])===0)return r}},Uo=(e,t)=>{try{return JSON.stringify(e,((n,r)=>typeof r=="bigint"?r.toString():r),t)}catch{return kC(e)}},Fh=e=>{var t=Be==null?void 0:Be.createElement("a");return De(t)?null:(t.href=e,t)},tl=function(e,t){for(var n,r=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),o=0;r.length>o;o++){var c=r[o].split("=");if(c[0]===t){n=c;break}}if(!dt(n)||2>n.length)return"";var h=n[1];try{h=decodeURIComponent(h)}catch{Oe.error("Skipping decoding for malformed query param: "+h)}return h.replace(/\+/g," ")},Lc=function(e,t,n){if(!e||!t||!t.length)return e;for(var r=e.split("#"),o=r[1],c=(r[0]||"").split("?"),h=c[1],l=c[0],u=(h||"").split("&"),m=[],g=0;u.length>g;g++){var p=u[g].split("=");dt(p)&&(t.includes(p[0])?m.push(p[0]+"="+n):m.push(u[g]))}var S=l;return h!=null&&(S+="?"+m.join("&")),o!=null&&(S+="#"+o),S},qh=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},AE=(e,t)=>e>=t&&xC(),TE=(e,t,n,r)=>{if(e===0){if(xC()){var o=t+1;return o===n&&r(),o}return t}return 0},ed="https?://(.*)",sl=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Y4=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...sl],Ic="<masked>",X4=["li_fat_id"];function NE(e,t,n){if(!Be)return{};var r,o=t?[...sl,...n||[]]:[],c=ME(Lc(Be.URL,o,Ic),e),h=(r={},ts(X4,(function(l){var u=pE(l);r[l]=u||null})),r);return rs(h,c)}function ME(e,t){var n=Y4.concat(t||[]),r={};return ts(n,(function(o){var c=tl(e,o);r[o]=c||null})),r}function $E(e){var t=(function(c){return c?c.search(ed+"google.([^/?]*)")===0?"google":c.search(ed+"bing.com")===0?"bing":c.search(ed+"yahoo.com")===0?"yahoo":c.search(ed+"duckduckgo.com")===0?"duckduckgo":null:null})(e),n=t!="yahoo"?"q":"p",r={};if(!Rn(t)){r.$search_engine=t;var o=Be?tl(Be.referrer,n):"";o.length&&(r.ph_keyword=o)}return r}function Y1(){return navigator.language||navigator.userLanguage}var Vh="$direct";function DE(){return(Be==null?void 0:Be.referrer)||Vh}function OE(e,t,n){n===void 0&&(n=!1);var r=e?[...sl,...t||[]]:[],o=n?Yr($s==null?void 0:$s.href):$s==null?void 0:$s.href,c=o==null?void 0:o.substring(0,1e3);return{r:DE().substring(0,1e3),u:c?Lc(c,r,Ic):void 0}}function LE(e,t){var n;t===void 0&&(t=!1);var r=e.r,o=e.u,c=t?Yr(o):o,h={$referrer:r,$referring_domain:r==null?void 0:r==Vh?Vh:(n=Fh(r))==null?void 0:n.host};if(c){h.$current_url=c;var l=Fh(c);h.$host=l==null?void 0:l.host,h.$pathname=l==null?void 0:l.pathname;var u=ME(c);rs(h,u)}if(r){var m=$E(r);rs(h,m)}return h}function IE(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function J4(){try{return new Date().getTimezoneOffset()}catch{return}}var Z4={flags:Dc,surveys:Lh},Q4=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],To="main";class zm{constructor(t,n,r){if(r===void 0&&(r=!0),this.lr={},this.ur=!1,this.hr=!1,this.Te=t,this.dr=r,this.props={},this.cr=void 0,this.vr=(c=>{var h="";return c.token&&(h=c.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),c.persistence_name?"ph_"+c.persistence_name:"ph_"+h+"_posthog"})(t),this.Je=this.pr(t),this.hr=this.gr(t),this.load(),t.debug&&Oe.info("Persistence loaded",t.persistence,Te({},this.props)),this.update_config(t,t,n),this.save(),_e){var o=()=>this.flush();ws(_e,"beforeunload",o,{capture:!1}),ws(_e,"pagehide",o,{capture:!1})}}mr(){var t,n=(t=this.Te)==null?void 0:t.persistence_save_debounce_ms;return on(n)&&n>0?n:0}isDisabled(){return!!this.yr}pr(t){Q4.indexOf(t.persistence.toLowerCase())===-1&&(Oe.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var n,r=(function(h,l){h===void 0&&(h=[]),l===void 0&&(l=!1);var u=[...N4,...h];return Te({},is,{F(m){try{var g={};try{g=ur.F(m)||{}}catch{}var p,S=JSON.parse(is.q(m)||"{}");if(l){var x={};for(var A in g){var E=g[A];Rn(E)||E===""||(x[A]=E)}p=rs(S,x)}else p=rs(g,S);return is.A(m,p),p}catch{}return null},A(m,g,p,S,x,A){var E=is.A(m,g,void 0,void 0,A);try{var y={};u.forEach((b=>{g[b]&&(y[b]=g[b])})),Object.keys(y).length&&ur.A(m,y,p,S,x,A)}catch(b){is.P(b)}return E},D(m,g){try{_e==null||_e.localStorage.removeItem(m),ur.D(m,g)}catch(p){is.P(p)}}})})(t.cookie_persisted_properties||[],t.__preview_cookie_wins_on_conflict||!1),o=!1,c=t.persistence.toLowerCase();return c==="localstorage"&&is.N()?(n=is,o=!0):c==="localstorage+cookie"&&r.N()?(n=r,o=!0):c==="sessionstorage"&&an.N()?n=an:c==="memory"?n=M4:c==="cookie"?n=ur:r.N()?(n=r,o=!0):n=ur,this.ur=o,n}br(t){return this.vr+"__"+t}gr(t){return this.ur&&!!t.split_storage}_r(t){var n=t??this.Te.feature_flag_cache_ttl_ms;if(!n||0>=n)return!1;var r=this.props[Dc];return!r||typeof r!="number"||Date.now()-r>n}properties(){var t={};return ts(this.props,((n,r)=>{var o=ya(r);if((o==null?void 0:o.exposure)==="derived"){if(o.shouldSkipFromEventProperties!=null&&o.shouldSkipFromEventProperties(n,r===Ma?()=>this._r():()=>!1))return;o.transformToEventProperties&&rs(t,o.transformToEventProperties(n))}else if(!o||o.exposure==="event"){if(o!=null&&o.shouldSkipFromEventProperties!=null&&o.shouldSkipFromEventProperties(n,(()=>!1)))return;t[r]=n}})),t}load(){if(!this.yr){var t=this.Je.F(this.vr);t&&(this.props=rs({},t)),this.hr&&this.wr()}}wr(){for(var t of Bm){var n=is.F(this.br(t));if(n&&!Vr(n)){var r=this.kr(t);r.persisted=!0,this.Sr(t)||(r.fingerprint=this.Cr(n,t)),this.Mr(t,n)||rs(this.props,n)}}}Sr(t){return Object.keys(this.props).some((n=>{var r;return((r=ya(n))==null?void 0:r.storageGroup)===t}))}Mr(t,n){var r=Z4[t];if(!r)return!1;var o=n[r],c=this.props[r];return on(o)&&on(c)&&c>o}refreshKey(t){var n;if(!this.yr){var r=this.hr?(n=ya(t))==null?void 0:n.storageGroup:void 0,o=r?is.F(this.br(r)):this.Je.F(this.vr);if(o&&t in o)this.Ir(t,o[t]);else{if(r){var c=this.Je.F(this.vr);if(c&&t in c)return void this.Ir(t,c[t])}this.Tr(t)}}}save(){if(!this.yr){var t=this.mr();t>0?De(this.Er)&&(this.Er=setTimeout((()=>{this.Er=void 0,this.Rr()}),t)):this.Rr()}}flush(){De(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,To))}Pr(){var t=this.Fr(),n=t.main,r=t.groups;for(var o of(this.Or(this.Je,this.vr,n,To),Bm)){var c,h=r[o];(!Vr(h)||(c=this.lr[o])!=null&&c.persisted)&&this.Or(is,this.br(o),h,o)}}Fr(){var t={},n={flags:{},surveys:{}};return ts(this.props,((r,o)=>{var c,h=(c=ya(o))==null?void 0:c.storageGroup;h?n[h][o]=r:t[o]=r})),{main:t,groups:n}}Cr(t,n){if(n===To)return JSON.stringify(t)+"|"+this.Ar+"|"+this.$r+"|"+this.Lr;var r={};return ts(t,((o,c)=>{var h;r[c]=(h=ya(c))!=null&&h.volatile?"__volatile__":o})),JSON.stringify(r)}Or(t,n,r,o){var c=this.kr(o);if(o===To||c.dirty||De(c.fingerprint)){var h;try{if((h=this.Cr(r,o))===c.fingerprint)return void(c.dirty=!1)}catch{h=void 0}t.A(n,r,this.Ar,this.$r,this.Lr,this.Te.debug)?(c.dirty=!1,o!==To&&(c.persisted=!0),De(h)||(c.fingerprint=h)):this.Te.debug&&Oe.warn('failed to persist storage entry "'+n+'"; will retry on next save')}}remove(t){var n=(t===void 0?{}:t).keepGroupEntries,r=n!==void 0&&n;if(De(this.Er)||(clearTimeout(this.Er),this.Er=void 0),this.Je.D(this.vr,!1),this.Je.D(this.vr,!0),!r&&this.dr)for(var o of Bm)is.D(this.br(o));r?delete this.lr[To]:this.lr={}}clear(){this.remove(),this.props={}}register_once(t,n,r){if(ps(t)){De(n)&&(n="None"),this.Ar=De(r)?this.Dr:r;var o=!1;if(ts(t,((c,h)=>{this.props.hasOwnProperty(h)&&this.props[h]!==n||(this.Ir(h,c),o=!0)})),o)return this.save(),!0}return!1}register(t,n){if(ps(t)){this.Ar=De(n)?this.Dr:n;var r=!1;if(ts(t,((o,c)=>{t.hasOwnProperty(c)&&this.props[c]!==o&&(this.Ir(c,o),r=!0)})),r)return this.save(),!0}return!1}unregister(t){t in this.props&&(this.Tr(t),this.save())}update_campaign_params(){var t=Be==null?void 0:Be.URL;if(t!==this.cr){var n=NE(this.Te.custom_campaign_params,this.Te.mask_personal_data_properties,this.Te.custom_personal_data_properties);Vr(Kv(n))||this.register(n),this.cr=t}}update_search_keyword(){var t;this.register((t=Be==null?void 0:Be.referrer)?$E(t):{})}update_referrer_info(){var t;this.register_once({$referrer:DE(),$referring_domain:Be!=null&&Be.referrer&&((t=Fh(Be.referrer))==null?void 0:t.host)||Vh},void 0)}set_initial_person_info(){this.props[Qg]||this.props[ev]||this.register_once({[Ih]:OE(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={};ts([ev,Qg],(o=>{var c=this.props[o];c&&ts(c,(function(h,l){t["$initial_"+Ng(l)]=h}))}));var n=this.props[Ih];if(n){var r=(function(o,c){c===void 0&&(c=!1);var h=LE(o,c),l={};return ts(h,(function(u,m){l["$initial_"+Ng(m)]=u})),l})(n,this.Te.disable_capture_url_hashes);rs(t,r)}return t}safe_merge(t){return ts(this.props,(function(n,r){r in t||(t[r]=n)})),t}update_config(t,n,r){this.Dr=this.Ar=t.cookie_expiration,this.set_disabled(t.disable_persistence||!!r),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie);var o=t.persistence!==n.persistence||!((u,m)=>{if(u.length!==m.length)return!1;var g=[...u].sort(),p=[...m].sort();return g.every(((S,x)=>S===p[x]))})(t.cookie_persisted_properties||[],n.cookie_persisted_properties||[]),c=o?this.pr(t):this.Je,h=this.gr(t);if(o||h!==this.hr){var l=this.props;this.clear(),this.Je=c,this.hr=h,this.props=l,this.save()}}set_disabled(t){this.yr=t,this.yr?this.remove():this.save()}set_cross_subdomain(t){t!==this.$r&&(this.$r=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.Lr&&(this.Lr=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,n){var r=this.props[gc]||{};r[t]=n,this.Ir(gc,r),this.save()}remove_event_timer(t){var n=this.props[gc]||{},r=n[t];return De(r)||(delete n[t],this.Ir(gc,n),this.save()),r}get_property(t){return this.props[t]}set_property(t,n){this.Ir(t,n),this.save()}Ir(t,n){var r;this.props[t]=n,(r=ya(t))!=null&&r.volatile||this.Nr(t)}Tr(t){delete this.props[t],this.Nr(t)}Nr(t){var n,r=(n=ya(t))==null?void 0:n.storageGroup;r&&(this.kr(r).dirty=!0)}kr(t){return this.lr[t]||(this.lr[t]={})}}function td(e){var t=!0;return{dispose(){if(t){t=!1;var n=e();n&&Gn(n.then)&&n.then(void 0,(()=>{}))}}}}var Cn={GZipJS:"gzip-js",Base64:"base64"},sc={Activation:"events",Cancellation:"cancelEvents"},Hm={Popover:"popover",API:"api",Widget:"widget"},dr={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},Um={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},iv={Popover:"popover",Inline:"inline"},eM={SHOWN:"product tour shown"},X1={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},J1=vs("[RateLimiter]");class tM{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=n=>{var r=n.text;if(r&&r.length)try{(JSON.parse(r).quota_limited||[]).forEach((o=>{J1.info((o||"events")+" is quota limited."),this.serverLimits[o]=new Date().getTime()+6e4}))}catch(o){return void J1.warn('could not rate limit - continuing. Error: "'+(o==null?void 0:o.message)+'"',{text:r})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return((t=this.instance.config.rate_limiting)==null?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max(((t=this.instance.config.rate_limiting)==null?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var n,r,o;t===void 0&&(t=!1);var c=this.captureEventsBurstLimit,h=this.captureEventsPerSecond,l=new Date().getTime(),u=(n=(r=this.instance.persistence)==null?void 0:r.get_property(Zg))!==null&&n!==void 0?n:{tokens:c,last:l};u.tokens+=(l-u.last)/1e3*h,u.last=l,u.tokens>c&&(u.tokens=c);var m=1>u.tokens;return m||t||(u.tokens=Math.max(0,u.tokens-1)),!m||this.lastEventRateLimited||t||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+h+" events per second and "+c+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=m,(o=this.instance.persistence)==null||o.set_property(Zg,u),{isRateLimited:m,remainingTokens:u.tokens}}isServerRateLimited(t){var n=this.serverLimits[t||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var ba=vs("[RemoteConfig]");class PE{constructor(t){this._instance=t}get remoteConfig(){var t;return(t=Ye._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.config}qr(t){var n,r;(n=Ye.__PosthogExtensions__)!=null&&n.loadExternalDependency?(r=Ye.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}jr(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(n){t(n.json)}})}load(){try{if(this.remoteConfig)return ba.info("Using preloaded remote config",this.remoteConfig),this.Br(this.remoteConfig),void this.Hr();if(this._instance.Ur())return void ba.warn("Remote config is disabled. Falling back to local config.");this.qr((t=>{if(!t)return ba.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){ba.error("Error loading remote config",t),this.Br()}}stop(){this.zr&&(clearInterval(this.zr),this.zr=void 0)}refresh(){!this._instance.Ur()&&Be&&Be.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||ba.error("Failed to fetch remote config from PostHog.");try{this._instance.Br(t?{ok:!0,config:t}:{ok:!1})}catch(r){ba.error("Error applying remote config",r)}if((t==null?void 0:t.hasFeatureFlags)!==!1&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var n;(n=this._instance.featureFlags)==null||n.ensureFlagsLoaded()}catch(r){ba.error("Error loading feature flags",r)}}}var di=Uint8Array,In=Uint16Array,nl=Uint32Array,Zv=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]),Qv=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]),Z1=new di([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),BE=function(e,t){for(var n=new In(31),r=0;31>r;++r)n[r]=t+=1<<e[r-1];var o=new nl(n[30]);for(r=1;30>r;++r)for(var c=n[r];n[r+1]>c;++c)o[c]=c-n[r]<<5|r;return[n,o]},zE=BE(Zv,2),rv=zE[1];zE[0][28]=258,rv[258]=28;for(var Q1=BE(Qv,0)[1],HE=new In(32768),gs=0;32768>gs;++gs){var No=(43690&gs)>>>1|(21845&gs)<<1;HE[gs]=((65280&(No=(61680&(No=(52428&No)>>>2|(13107&No)<<2))>>>4|(3855&No)<<4))>>>8|(255&No)<<8)>>>1}var kc=function(e,t,n){for(var r=e.length,o=0,c=new In(t);r>o;++o)++c[e[o]-1];var h,l=new In(t);for(o=0;t>o;++o)l[o]=l[o-1]+c[o-1]<<1;for(h=new In(r),o=0;r>o;++o)h[o]=HE[l[e[o]-1]++]>>>15-e[o];return h},Ba=new di(288);for(gs=0;144>gs;++gs)Ba[gs]=8;for(gs=144;256>gs;++gs)Ba[gs]=9;for(gs=256;280>gs;++gs)Ba[gs]=7;for(gs=280;288>gs;++gs)Ba[gs]=8;var Gh=new di(32);for(gs=0;32>gs;++gs)Gh[gs]=5;var sM=kc(Ba,9),nM=kc(Gh,5),UE=function(e){return(e/8>>0)+(7&e&&1)},FE=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var r=new(e instanceof In?In:e instanceof nl?nl:di)(n-t);return r.set(e.subarray(t,n)),r},er=function(e,t,n){var r=t/8>>0;e[r]|=n<<=7&t,e[r+1]|=n>>>8},nc=function(e,t,n){var r=t/8>>0;e[r]|=n<<=7&t,e[r+1]|=n>>>8,e[r+2]|=n>>>16},Fm=function(e,t){for(var n=[],r=0;e.length>r;++r)e[r]&&n.push({s:r,f:e[r]});var o=n.length,c=n.slice();if(!o)return[new di(0),0];if(o==1){var h=new di(n[0].s+1);return h[n[0].s]=1,[h,1]}n.sort((function(C,w){return C.f-w.f})),n.push({s:-1,f:25001});var l=n[0],u=n[1],m=0,g=1,p=2;for(n[0]={s:-1,f:l.f+u.f,l,r:u};g!=o-1;)l=n[n[p].f>n[m].f?m++:p++],u=n[m!=g&&n[p].f>n[m].f?m++:p++],n[g++]={s:-1,f:l.f+u.f,l,r:u};var S=c[0].s;for(r=1;o>r;++r)c[r].s>S&&(S=c[r].s);var x=new In(S+1),A=av(n[g-1],x,0);if(A>t){r=0;var E=0,y=A-t,b=1<<y;for(c.sort((function(C,w){return x[w.s]-x[C.s]||C.f-w.f}));o>r;++r){var v=c[r].s;if(t>=x[v])break;E+=b-(1<<A-x[v]),x[v]=t}for(E>>>=y;E>0;){var _=c[r].s;t>x[_]?E-=1<<t-x[_]++-1:++r}for(;r>=0&&E;--r){var k=c[r].s;x[k]==t&&(--x[k],++E)}A=t}return[new di(x),A]},av=function(e,t,n){return e.s==-1?Math.max(av(e.l,t,n+1),av(e.r,t,n+1)):t[e.s]=n},eS=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new In(++t),r=0,o=e[0],c=1,h=function(u){n[r++]=u},l=1;t>=l;++l)if(e[l]==o&&l!=t)++c;else{if(!o&&c>2){for(;c>138;c-=138)h(32754);c>2&&(h(c>10?c-11<<5|28690:c-3<<5|12305),c=0)}else if(c>3){for(h(o),--c;c>6;c-=6)h(8304);c>2&&(h(c-3<<5|8208),c=0)}for(;c--;)h(o);c=1,o=e[l]}return[n.subarray(0,r),t]},ic=function(e,t){for(var n=0,r=0;t.length>r;++r)n+=e[r]*t[r];return n},ov=function(e,t,n){var r=n.length,o=UE(t+2);e[o]=255&r,e[o+1]=r>>>8,e[o+2]=255^e[o],e[o+3]=255^e[o+1];for(var c=0;r>c;++c)e[o+c+4]=n[c];return 8*(o+4+r)},tS=function(e,t,n,r,o,c,h,l,u,m,g){er(t,g++,n),++o[256];for(var p=Fm(o,15),S=p[0],x=p[1],A=Fm(c,15),E=A[0],y=A[1],b=eS(S),v=b[0],_=b[1],k=eS(E),C=k[0],w=k[1],T=new In(19),j=0;v.length>j;++j)T[31&v[j]]++;for(j=0;C.length>j;++j)T[31&C[j]]++;for(var M=Fm(T,7),D=M[0],L=M[1],q=19;q>4&&!D[Z1[q-1]];--q);var F,Y,Q,G,ee=m+5<<3,ne=ic(o,Ba)+ic(c,Gh)+h,z=ic(o,S)+ic(c,E)+h+14+3*q+ic(T,D)+(2*T[16]+3*T[17]+7*T[18]);if(ne>=ee&&z>=ee)return ov(t,g,e.subarray(u,u+m));if(er(t,g,1+(ne>z)),g+=2,ne>z){F=kc(S,x),Y=S,Q=kc(E,y),G=E;var B=kc(D,L);for(er(t,g,_-257),er(t,g+5,w-1),er(t,g+10,q-4),g+=14,j=0;q>j;++j)er(t,g+3*j,D[Z1[j]]);g+=3*q;for(var $=[v,C],H=0;2>H;++H){var U=$[H];for(j=0;U.length>j;++j)er(t,g,B[P=31&U[j]]),g+=D[P],P>15&&(er(t,g,U[j]>>>5&127),g+=U[j]>>>12)}}else F=sM,Y=Ba,Q=nM,G=Gh;for(j=0;l>j;++j)if(r[j]>255){var P;nc(t,g,F[257+(P=r[j]>>>18&31)]),g+=Y[P+257],P>7&&(er(t,g,r[j]>>>23&31),g+=Zv[P]);var W=31&r[j];nc(t,g,Q[W]),g+=G[W],W>3&&(nc(t,g,r[j]>>>5&8191),g+=Qv[W])}else nc(t,g,F[r[j]]),g+=Y[r[j]];return nc(t,g,F[256]),g+Y[256]},iM=new nl([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),rM=(function(){for(var e=new nl(256),t=0;256>t;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e})(),qm=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function aM(e,t){t===void 0&&(t={});var n=(function(){var p=4294967295;return{p(S){for(var x=p,A=0;S.length>A;++A)x=rM[255&x^S[A]]^x>>>8;p=x},d(){return 4294967295^p}}})(),r=e.length;n.p(e);var o,c,h,l,u,m=(l=10+((o=t).filename&&o.filename.length+1||0),u=8,(function(p,S,x,A,E,y){var b=p.length,v=new di(A+b+5*(1+Math.floor(b/7e3))+E),_=v.subarray(A,v.length-E),k=0;if(!S||8>b)for(var C=0;b>=C;C+=65535){var w=C+65535;b>w?k=ov(_,k,p.subarray(C,w)):(_[C]=!0,k=ov(_,k,p.subarray(C,b)))}else{for(var T=iM[S-1],j=T>>>13,M=8191&T,D=(1<<x)-1,L=new In(32768),q=new In(D+1),F=Math.ceil(x/3),Y=2*F,Q=function(ot){return(p[ot]^p[ot+1]<<F^p[ot+2]<<Y)&D},G=new nl(25e3),ee=new In(288),ne=new In(32),z=0,B=0,$=(C=0,0),H=0,U=0;b>C;++C){var P=Q(C),W=32767&C,se=q[P];if(L[W]=se,q[P]=W,C>=H){var X=b-C;if((z>7e3||$>24576)&&X>423){k=tS(p,_,0,G,ee,ne,B,$,U,C-U,k),$=z=B=0,U=C;for(var V=0;286>V;++V)ee[V]=0;for(V=0;30>V;++V)ne[V]=0}var ue=2,oe=0,Z=M,te=W-se&32767;if(X>2&&P==Q(C-te))for(var pe=Math.min(j,X)-1,ye=Math.min(32767,C),ke=Math.min(258,X);ye>=te&&--Z&&W!=se;){if(p[C+ue]==p[C+ue-te]){for(var Le=0;ke>Le&&p[C+Le]==p[C+Le-te];++Le);if(Le>ue){if(ue=Le,oe=te,Le>pe)break;var Ie=Math.min(te,Le-2),qe=0;for(V=0;Ie>V;++V){var Re=C-te+V+32768&32767,He=Re-L[Re]+32768&32767;He>qe&&(qe=He,se=Re)}}}te+=(W=se)-(se=L[W])+32768&32767}if(oe){G[$++]=268435456|rv[ue]<<18|Q1[oe];var Ke=31&rv[ue],kt=31&Q1[oe];B+=Zv[Ke]+Qv[kt],++ee[257+Ke],++ne[kt],H=C+ue,++z}else G[$++]=p[C],++ee[p[C]]}}k=tS(p,_,!0,G,ee,ne,B,$,U,C-U,k)}return FE(v,0,A+UE(k)+E)})(c=e,(h=t).level==null?6:h.level,h.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(c.length)))):12+h.mem,l,u)),g=m.length;return(function(p,S){var x=S.filename;if(p[0]=31,p[1]=139,p[2]=8,p[8]=2>S.level?4:S.level==9?2:0,p[9]=3,S.mtime!=0&&qm(p,4,Math.floor(new Date(S.mtime||Date.now())/1e3)),x){p[3]=8;for(var A=0;x.length>=A;++A)p[A+10]=x.charCodeAt(A)}})(m,t),qm(m,g-8,n.d()),qm(m,g-4,r),m}var oM=!!Rg||!!Pv,qE="text/plain",yh=!1,VE=(e,t)=>{var n=e.split("#"),r=n[1],o=n[0].split("?"),c=o[0],h=o[1];if(!h)return e;var l=h.split("&").filter((u=>u.split("=")[0]!==t)).join("&");return c+(l?"?"+l:"")+(r?"#"+r:"")},uf=function(e,t,n){var r;n===void 0&&(n=!0);var o=e.split("?"),c=o[0],h=o[1],l=Te({},t),u=(r=h==null?void 0:h.split("&").map((g=>{var p,S=g.split("="),x=S[0],A=n&&(p=l[x])!==null&&p!==void 0?p:S[1];return delete l[x],x+"="+A})))!==null&&r!==void 0?r:[],m=(function(g,p){var S,x;p===void 0&&(p="&");var A=[];return ts(g,(function(E,y){De(E)||De(y)||y==="undefined"||(S=encodeURIComponent((b=>b instanceof File)(E)?E.name:E.toString()),x=encodeURIComponent(y),A[A.length]=x+"="+S)})),A.join(p)})(l);return m&&u.push(m),u.length>0?c+"?"+u.join("&"):c},Vm=e=>{if(e.Vr)return e.Vr;var t=e.data,n=e.compression;if(t){if(n===Cn.GZipJS){var r=aM((function(l,u){var m=l.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(l);for(var g=new di(l.length+(l.length>>>1)),p=0,S=function(y){g[p++]=y},x=0;m>x;++x){if(p+5>g.length){var A=new di(p+8+(m-x<<1));A.set(g),g=A}var E=l.charCodeAt(x);128>E?S(E):2048>E?(S(192|E>>>6),S(128|63&E)):E>55295&&57344>E?(S(240|(E=65536+(1047552&E)|1023&l.charCodeAt(++x))>>>18),S(128|E>>>12&63),S(128|E>>>6&63),S(128|63&E)):(S(224|E>>>12),S(128|E>>>6&63),S(128|63&E))}return FE(g,0,p)})(Uo(t)),{mtime:0});return{contentType:qE,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(n===Cn.Base64){var o=(function(l){return l&&btoa(encodeURIComponent(l).replace(/%([0-9A-F]{2})/g,((u,m)=>String.fromCharCode(parseInt(m,16)))))})(Uo(t)),c=(l=>"data="+encodeURIComponent(typeof l=="string"?l:Uo(l)))(o);return{contentType:"application/x-www-form-urlencoded",body:c,estimatedSize:new Blob([c]).size}}var h=Uo(t);return{contentType:"application/json",body:h,estimatedSize:new Blob([h]).size}}},GE=e=>{var t,n,r=()=>e.transport==="sendBeacon"?{url:uf(e.url,{compression:Cn.Base64}),encodedBody:Vm(Te({},e,{compression:Cn.Base64,Vr:void 0}))}:{url:VE(e.url,"compression"),encodedBody:Vm(Te({},e,{compression:void 0,Vr:void 0}))};try{t=Vm(e)}catch(o){if(w1(e.compression,tl(e.url,"compression")))return Oe.error("Failed to gzip request body, sending uncompressed payload",o),r();throw o}return t&&w1(e.compression,tl(e.url,"compression"))&&!((n=t.body)instanceof ArrayBuffer?Ag(new Uint8Array(n)):ArrayBuffer.isView(n)&&Ag(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)))?(yh=!0,r()):{url:e.url,encodedBody:t}},WE=e=>{try{return GE(e)}catch(t){return Oe.error(t),void(e.callback==null||e.callback({statusCode:0,error:t}))}},lM=(function(){var e=ms((function*(t){var n=Uo(t.data),r=yield(function(c,h,l){return Tg.apply(this,arguments)})(n,Ft.DEBUG,{rethrow:!0});if(!r)return t;var o=yield r.arrayBuffer();return Te({},t,{Vr:{contentType:qE,body:o,estimatedSize:o.byteLength}})}));return function(t){return e.apply(this,arguments)}})(),cM=/Failed to fetch|NetworkError|Load failed/i,KE=e=>{var t=WE(e);if(t){var n=t.url,r=t.encodedBody,o=r??{},c=o.contentType,h=o.body,l=o.estimatedSize,u=new Headers;ts(e.headers,(function(A,E){u.append(E,A)})),c&&u.append("Content-Type",c);var m=null,g=!1;if(g1){var p=new g1;m={signal:p.signal,timeout:setTimeout((()=>{var A,E;g=!0,p.abort((A=e.timeout,(E=new Error("PostHog request timed out"+(A?" after "+A+"ms":""))).name="AbortError",E))}),e.timeout)}}var S=A=>{g&&(A==null?void 0:A.name)==="AbortError"||(E=>(E==null?void 0:E.name)==="TypeError"&&cM.test((E==null?void 0:E.message)||""))(A)?Oe.warn(A):Oe.error(A),e.callback==null||e.callback({statusCode:0,error:A})};try{var x;Pv(n,Te({method:(e==null?void 0:e.method)||"GET",headers:u,keepalive:e.method==="POST"&&!e.Wr&&52428.8>(l||0),body:h,signal:(x=m)==null?void 0:x.signal},e.fetchOptions)).then((A=>A.text().then((E=>{var y={statusCode:A.status,text:E};if(A.status===200)try{y.json=JSON.parse(E)}catch(b){Oe.error(b)}e.callback==null||e.callback(y)})))).catch(S).finally((()=>m?clearTimeout(m.timeout):null))}catch(A){m&&clearTimeout(m.timeout),S(A)}}},lv=e=>{try{var t,n=GE(e),r=n.url,o=n.encodedBody,c=o??{},h=c.body,l=c.estimatedSize;if(!h)return;var u=h instanceof Blob?h:new Blob([h],{type:c.contentType});if(kn.sendBeacon(r,u))return;var m=dt(e.data)?e.data:(t=e.data)==null?void 0:t.batch;if(dt(m)&&m.length>1&&(l??0)>16384){var g=Math.ceil(m.length/2),p=S=>dt(e.data)?S:Te({},e.data,{batch:S});return lv(Te({},e,{data:p(m.slice(0,g))})),void lv(Te({},e,{data:p(m.slice(g))}))}Oe.warn("Beacon of ~"+(l??0)+" bytes was rejected by the browser, falling back to fetch"),KE(Te({},e,{Wr:!0}))}catch(S){Oe.warn("Beacon send failed",S)}},sS=(e,t,n,r)=>{var o=r==="query"?t==="POST"?"sent_at":"_":void 0;return uf(n===Cn.GZipJS?VE(e,"compression"):e,Te({},o?{[o]:Date.now().toString()}:{},n===Cn.GZipJS?{}:{compression:n}))},bh=[];Pv&&bh.push({transport:"fetch",method:KE}),Rg&&bh.push({transport:"XHR",method(e){var t=WE(e);if(t){var n=new Rg,r=t.encodedBody;n.open(e.method||"GET",t.url,!0);var o=r??{},c=o.contentType,h=o.body;ts(e.headers,(function(l,u){n.setRequestHeader(u,l)})),c&&n.setRequestHeader("Content-Type",c),e.timeout&&(n.timeout=e.timeout),n.onreadystatechange=()=>{if(n.readyState===4){var l={statusCode:n.status,text:n.responseText};if(n.status===200)try{l.json=JSON.parse(n.responseText)}catch{}e.callback==null||e.callback(l)}},n.send(h)}}}),kn!=null&&kn.sendBeacon&&bh.push({transport:"sendBeacon",method:lv});var cv=3e3;class uM{constructor(t,n){this.Zr=!0,this.Gr=[],this.Qr=Oi((n==null?void 0:n.flush_interval_ms)||cv,250,5e3,Oe.createLogger("flush interval"),cv),this.Jr=t}enqueue(t){this.Gr.push(t),this.Kr||this.Yr()}unload(){this.Xr();var t=this.Gr.length>0?this.ti():{},n=Object.values(t);[...n.filter((r=>r.url.indexOf("/e")===0)),...n.filter((r=>r.url.indexOf("/e")!==0))].map((r=>{this.ei(Te({},r,{transport:"sendBeacon"}))}))}enable(){this.Zr=!1,this.Yr()}Yr(){var t=this;this.Zr||(this.Kr=setTimeout((()=>{if(this.Xr(),this.Gr.length>0){var n=this.ti(),r=function(){var c=n[o],h=new Date().getTime();c.data&&dt(c.data)&&ts(c.data,(l=>{l.offset=Math.abs(l.timestamp-h),delete l.timestamp})),t.ei(c)};for(var o in n)r()}}),this.Qr))}ei(t){try{this.Jr(t)}catch(n){Oe.error(n)}}Xr(){clearTimeout(this.Kr),this.Kr=void 0}ti(){var t={};return ts(this.Gr,(n=>{var r,o=n,c=(o?o.batchKey:null)||o.url;De(t[c])&&(t[c]=Te({},o,{data:[]})),(r=t[c].data)==null||r.push(o.data)})),this.Gr=[],t}}var dM=["retriesPerformedSoFar"];class hM{constructor(t){this.ri=!1,this.ii=3e3,this.Gr=[],this._instance=t,this.Gr=[],this.ni=!0,!De(_e)&&"onLine"in _e.navigator&&(this.ni=_e.navigator.onLine,this.si=()=>{this.ni=!0,this.oi()},this.ai=()=>{this.ni=!1},ws(_e,"online",this.si),ws(_e,"offline",this.ai))}get length(){return this.Gr.length}retriableRequest(t){var n=t.retriesPerformedSoFar,r=CC(t,dM);rr(n)&&(r.url=uf(r.url,{retry_count:n})),this._instance._send_request(Te({},r,{callback:o=>{if(o.statusCode!==200&&(400>o.statusCode||o.statusCode>=500)){if((o.statusCode===0?3:10)>(n??0))return void this.Ot(Te({retriesPerformedSoFar:n},r));o.statusCode===0&&Oe.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(n??0)+" retries.")}r.callback==null||r.callback(o)}}))}Ot(t){var n=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=n+1;var r=(function(h){var l=3e3*Math.pow(2,h),u=l/2,m=Math.min(18e5,l),g=Math.random()-.5;return Math.ceil(m+g*(m-u))})(n),o=Date.now()+r;this.Gr.push({retryAt:o,requestOptions:t});var c="Enqueued failed request for retry in "+r;navigator.onLine||(c+=" (Browser is offline)"),Oe.warn(c),this.ri||(this.ri=!0,this.li())}li(){if(this.ui&&clearTimeout(this.ui),this.Gr.length===0)return this.ri=!1,void(this.ui=void 0);this.ui=setTimeout((()=>{this.ni&&this.Gr.length>0&&this.oi(),this.li()}),this.ii)}oi(){var t=Date.now(),n=[],r=this.Gr.filter((c=>t>c.retryAt||(n.push(c),!1)));if(this.Gr=n,r.length>0)for(var o of r)this.retriableRequest(o.requestOptions)}unload(){for(var t of(this.ui&&(clearTimeout(this.ui),this.ui=void 0),this.ri=!1,De(_e)||(this.si&&(_e.removeEventListener("online",this.si),this.si=void 0),this.ai&&(_e.removeEventListener("offline",this.ai),this.ai=void 0)),this.Gr)){var n=t.requestOptions;try{this._instance._send_request(Te({},n,{transport:"sendBeacon"}))}catch(r){Oe.error(r)}}this.Gr=[]}}class fM{constructor(t){this.hi=()=>{var n,r,o,c;this.di||(this.di={});var h=this.scrollElement(),l=this.scrollY(),u=h?Math.max(0,h.scrollHeight-h.clientHeight):0,m=l+((h==null?void 0:h.clientHeight)||0),g=(h==null?void 0:h.scrollHeight)||0;this.di.lastScrollY=Math.ceil(l),this.di.maxScrollY=Math.max(l,(n=this.di.maxScrollY)!==null&&n!==void 0?n:0),this.di.maxScrollHeight=Math.max(u,(r=this.di.maxScrollHeight)!==null&&r!==void 0?r:0),this.di.lastContentY=m,this.di.maxContentY=Math.max(m,(o=this.di.maxContentY)!==null&&o!==void 0?o:0),this.di.maxContentHeight=Math.max(g,(c=this.di.maxContentHeight)!==null&&c!==void 0?c: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(){ws(_e,"scroll",this.hi,{capture:!0}),ws(_e,"scrollend",this.hi,{capture:!0}),ws(_e,"resize",this.hi)}scrollElement(){if(!this.ci)return _e==null?void 0:_e.document.documentElement;var t=dt(this.ci)?this.ci:[this.ci];for(var n of t){var r=_e==null?void 0:_e.document.querySelector(n);if(r)return r}}vi(t){var n=t==="y"?"scrollTop":"scrollLeft";if(this.ci){var r=this.scrollElement();return r&&r[n]||0}return _e?t==="y"?_e.scrollY||_e.pageYOffset||_e.document.documentElement.scrollTop||0:_e.scrollX||_e.pageXOffset||_e.document.documentElement.scrollLeft||0:0}scrollY(){return this.vi("y")}scrollX(){return this.vi("x")}}var pM=e=>OE(e==null?void 0:e.config.mask_personal_data_properties,e==null?void 0:e.config.custom_personal_data_properties,e==null?void 0:e.config.disable_capture_url_hashes);class nS{constructor(t,n,r,o){this.fi=c=>{var h=this.pi();if(!h||h.sessionId!==c){var l={sessionId:c,props:this.gi(this._instance)};this.mi.register({[Jg]:l})}},this._instance=t,this.yi=n,this.mi=r,this.gi=o||pM,this.yi.onSessionId(this.fi)}pi(){return this.mi.props[Jg]}getSetOnceProps(){var t,n=(t=this.pi())==null?void 0:t.props;return n?"r"in n?LE(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 ts(Kv(this.getSetOnceProps()),((n,r)=>{r==="$current_url"&&(r="url"),t["$session_entry_"+Ng(r)]=n})),t}}class e_{on(t,n){return this.bi[t]||(this.bi[t]=[]),this.bi[t].push(n),()=>{this.bi[t]=this.bi[t].filter((r=>r!==n))}}emit(t,n){for(var r of this.bi[t]||[])r(n);for(var o of this.bi["*"]||[])o(t,n)}constructor(){this.bi={}}}var rc=vs("[SessionId]");class iS{on(t,n){return this.wi.on(t,n)}constructor(t,n,r){var o;if(this.xi=null,this.ki=[],this.Si=void 0,this.Ci=!1,this.wi=new e_,this.Mi=(m,g)=>!(!rr(m)||!rr(g))&&Math.abs(m-g)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===cr)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||lr,this.Ri=r||lr;var c=this.Te.persistence_name||this.Te.token;if(this._sessionTimeoutMs=1e3*Oi(this.Te.session_idle_timeout_seconds||1800,60,36e3,rc.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Pi(),this.Oi="ph_"+c+"_window_id",this.Fi="ph_"+c+"_primary_window_exists",this.Ai()){var h=an.F(this.Oi),l=an.F(this.Fi);h&&!l?this.Ii=h:an.D(this.Oi),an.A(this.Fi,!0)}if((o=this.Te.bootstrap)!=null&&o.sessionID)try{var u=(m=>{var g=this.Te.bootstrap.sessionID.replace(/-/g,"");if(g.length!==32)throw new Error("Not a valid UUID");if(g[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(g.substring(0,12),16)})();this.$i(this.Te.bootstrap.sessionID,new Date().getTime(),u)}catch(m){rc.error("Invalid sessionID in bootstrap",m)}this.Li()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return De(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&&an.N()}Di(t){t!==this.Ii&&(this.Ii=t,this.Ai()&&an.A(this.Oi,t))}Ni(){return this.Ii?this.Ii:this.Ai()?an.F(this.Oi):null}qi(t){var n=this.xi;return!Rn(n)&&!Rn(t)&&5e3>Math.abs(t-n)}$i(t,n,r){var o=n!==this._sessionActivityTimestamp,c=!(t!==this.Ti||r!==this._sessionStartTimestamp);this._sessionStartTimestamp=r,this._sessionActivityTimestamp=n,this.Ti=t,c&&!o||c&&this.qi(n)||(this.xi=n,this.mi.register({[Ho]:[n,t,r]}))}ji(){var t,n=(t=this.Te)==null?void 0:t.persistence_save_debounce_ms;return rr(n)&&n>0}Bi(){this.ji()?this.mi.refreshKey(Ho):(this.mi.flush(),this.mi.load())}Hi(){var t;if(!Rn(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({[Ho]:[this._sessionActivityTimestamp,(t=this.Ti)!==null&&t!==void 0?t:null,this._sessionStartTimestamp]}),this.mi.flush())}}zi(){var t=this.Ui()[0],n=rr(t)?t:0,r=rr(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(n,r)}Vi(t){return this.Bi(),this.Mi(t,this.zi())}Ui(){var t=this.mi.props[Ho];return dt(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&&_e&&(_e.removeEventListener(zh,this.Si,{capture:!1}),this.Si=void 0),this.ki=[]}Li(){this.Si=()=>{this.Hi(),this.Ai()&&an.D(this.Fi)},ws(_e,zh,this.Si,{capture:!1})}checkAndGetSessionAndWindowId(t,n){if(t===void 0&&(t=!1),n===void 0&&(n=null),this.Te.cookieless_mode===cr)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=n||new Date().getTime(),o=this.Ui(),c=o[1],h=o[2],l=this.zi(),u=this.Ni(),m=rr(h)&&Math.abs(r-h)>864e5,g=!1,p=!1,S=!c,x=c,A=!S&&!t&&this.Mi(r,l);if(A){(A=this.Vi(r))||rc.info("cross-tab refresh kept the session alive",{sessionId:c});var E=this.Ui();c=E[1],h=E[2]}S||A||m?(c=this.Ei(),u=this.Ri(),rc.info("new session ID generated",{sessionId:c,windowId:u,changeReason:{noSessionId:S,activityTimeout:A,sessionPastMaximumLength:m}}),h=r,g=!0):(u||(u=this.Ri(),g=!0),(p=c!==x)&&(rc.info("adopted cross-tab session id",{sessionId:c,windowId:u}),g=!0));var y=rr(l)&&t&&!m?l:r,b=rr(h)?h:new Date().getTime();this.Di(u),this.$i(c,y,b),t||this.Pi();var v={noSessionId:S,activityTimeout:A,sessionPastMaximumLength:m,crossTabAdoption:p};return g&&this.ki.forEach((_=>_(c,u,v))),{sessionId:c,windowId:u,sessionStartTimestamp:b,changeReason:g?v:void 0,lastActivityTimestamp:l}}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 YE=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&C1(n,t))return!0;try{var r=e==null?void 0:e.userAgentData;if(r!=null&&r.brands&&r.brands.some((o=>C1(o==null?void 0:o.brand,t))))return!0}catch{}return!!e.webdriver};function XE(){return(XE=ms((function*(){var e=kn==null?void 0:kn.userAgentData;if(e!=null&&e.getHighEntropyValues)try{var t=yield e.getHighEntropyValues(["model"]),n=t==null?void 0:t.model;return es(n)&&n.length>0?n:void 0}catch(r){return void Oe.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",r)}}))).apply(this,arguments)}var Wh=function(e,t){if(!(function(n){try{new RegExp(n)}catch{return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}};function Gm(e,t,n){return Uo({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}var JE={exact:(e,t)=>t.some((n=>e.some((r=>n===r)))),is_not:(e,t)=>t.every((n=>e.every((r=>n!==r)))),regex:(e,t)=>t.some((n=>e.some((r=>Wh(n,r))))),not_regex:(e,t)=>t.every((n=>e.every((r=>!Wh(n,r))))),icontains:(e,t)=>t.map(sd).some((n=>e.map(sd).some((r=>n.includes(r))))),not_icontains:(e,t)=>t.map(sd).every((n=>e.map(sd).every((r=>!n.includes(r))))),gt:(e,t)=>t.some((n=>{var r=parseFloat(n);return!isNaN(r)&&e.some((o=>r>parseFloat(o)))})),lt:(e,t)=>t.some((n=>{var r=parseFloat(n);return!isNaN(r)&&e.some((o=>r<parseFloat(o)))}))},sd=e=>e.toLowerCase();function ZE(e,t){return!e||Object.entries(e).every((n=>{var r=n[1],o=t==null?void 0:t[n[0]];if(De(o)||Rn(o))return!1;var c=[String(o)],h=JE[r.operator];return!!h&&h(r.values,c)}))}var uv="custom",rS="i.posthog.com",mM=/^\/static\//;class gM{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("."+rS,".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":uv),this.Zi[this.apiHost]}Gi(t){if(mM.test(t)){var n=this.instance.config.asset_host;if(typeof n=="string")return n.trim().replace(/\/$/,"")||void 0}}endpointFor(t,n){if(n===void 0&&(n=""),n&&(n=n[0]==="/"?n:"/"+n),t==="ui")return this.uiHost+n;if(t==="flags")return this.flagsApiHost+n;if(t==="assets"){var r=this.Gi(n);if(r)return""+r+n}if(this.region===uv)return this.apiHost+n;var o=rS+n;switch(t){case"assets":return"https://"+this.region+"-assets."+o;case"api":return"https://"+this.region+"."+o}}}function QE(e){var t;return!((t=e.conditions)==null||(t=t.events)==null||(t=t.values)==null||!t.length)}var Wt=vs("[Surveys]"),e2="seenSurvey_",t2=e=>{try{var t=(n=>((r,o)=>""+e2+(function(c){return c.current_iteration&&c.current_iteration>0?c.id+"_"+c.current_iteration:c.id})(o))(0,n))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(n){Wt.error("Failed to persist survey seen state",n)}},vM=[Hm.Popover,Hm.Widget,Hm.API],_M={ignoreConditions:!1,ignoreDelay:!1,displayType:iv.Popover},yM=vs("[PostHog ExternalIntegrations]"),bM={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class SM{constructor(t){this._instance=t}tr(t,n){var r;(r=Ye.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,t,(o=>{if(o)return yM.error("failed to load script",o);n()}))}startIfEnabledOrStop(){var t=this,n=function(){var c,h,l,u=r[0],m=r[1];!m||(c=Ye.__PosthogExtensions__)!=null&&(c=c.integrations)!=null&&c[u]||t.tr(bM[u],(()=>{var g;(g=Ye.__PosthogExtensions__)==null||(g=g.integrations)==null||(g=g[u])==null||g.start(t._instance)})),!m&&(h=Ye.__PosthogExtensions__)!=null&&(h=h.integrations)!=null&&h[u]&&((l=Ye.__PosthogExtensions__)==null||(l=l.integrations)==null||(l=l[u])==null||l.stop())};for(var r of Object.entries((o=this._instance.config.integrations)!==null&&o!==void 0?o:{})){var o;n()}}}class wM{constructor(t,n){this.it=t,this.Qi=n,this.Ji=new Map,this.Ki=!1}add(t){var n=this;return ms((function*(){if(n.Ki)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(n.Ji.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');n.Ji.set(t.name,t);try{var r=t.setup(n.Qi);r&&(yield r)}catch(c){var o=n.Ji.get(t.name)===t;o&&n.Ji.delete(t.name),n.it.error('Failed to set up browser extension "'+t.name+'"',c),o&&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&&Gn(n.then)&&n.then(void 0,(r=>{this.it.error('Failed to dispose browser extension "'+t.name+'"',r)}))}catch(r){this.it.error('Failed to dispose browser extension "'+t.name+'"',r)}}}class xM{constructor(t){this._instance=t}get(t){var n;return(n=this._instance.persistence)==null?void 0:n.get_property(t)}set(t,n){var r;(r=this._instance.persistence)==null||r.set_property(t,n)}remove(t){var n;(n=this._instance.persistence)==null||n.unregister(t)}}var aS="extensionsRemoteConfig";class CM{constructor(t){this.Ki=!1,this.instance=t,this.it=Oe.createLogger("[BrowserExtensions]"),this.Xi=t.tn,this.kv=new xM(t),this.onEvent=n=>td(this.instance.on("eventCaptured",(r=>{try{n({event:r.event,properties:r.properties})}catch(o){this.it.error("Browser extension event listener failed",o)}}))),this.onRemoteConfig=n=>{if(this.Ki)return td((()=>{}));var r=c=>{try{n(c)}catch(h){this.it.error("Browser extension remote config listener failed",h)}},o=this.instance.en.on(aS,r);return this.Xi&&r(this.Xi),td(o)},this.rn=new wM(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($c))!==null&&t!==void 0?t:this.distinctId}get groups(){return this.instance.getGroups()}get session(){try{var t,n,r,o,c=(t=this.instance.sessionManager)==null?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:(n=c==null?void 0:c.sessionId)!==null&&n!==void 0?n:"",windowId:(r=c==null?void 0:c.windowId)!==null&&r!==void 0?r:"",sessionStartTimestamp:(o=c==null?void 0:c.sessionStartTimestamp)!==null&&o!==void 0?o:0}}catch{return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get projectToken(){return this.instance.config.token}add(t){return this.rn.add(t)}capture(t,n,r){var o=this;return ms((function*(){r?o.instance.capture(t,n,{timestamp:r.timestamp,uuid:r.uuid,$set:r.set,$set_once:r.setOnce}):o.instance.capture(t,n)}))()}registerDynamicEventProperties(t){return td(this.instance.nn(t))}handleRemoteConfig(t){this.Ki||(this.Xi=t,this.instance.en.emit(aS,t))}sendRequest(t,n){var r=this;return ms((function*(){var o;n===void 0&&(n={});var c=r.instance.requestRouter.endpointFor((o=n.target)!==null&&o!==void 0?o:"api",t),h={method:n.method,url:n.query?uf(c,n.query):c,data:n.body,headers:n.headers,timeout:n.timeoutMs,fireCallbackOnDrop:!0,transport:n.transport};return n.transport==="sendBeacon"?(r.instance._send_request(h),{statusCode:202}):new Promise((l=>{h.callback=l,r.instance._send_request(h)}))}))()}dispose(){this.Ki||(this.Ki=!0,this.rn.dispose())}}var jc={},Wm=0,Kh=()=>{},oS='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',ac="Surveys module not available",lS="sanitize_properties is deprecated. Use before_send instead",s2="Invalid value for property_denylist config: ",EM=["token","distinct_id",cE],zo="posthog",n2=!oM&&(Ln==null?void 0:Ln.indexOf("MSIE"))===-1&&(Ln==null?void 0:Ln.indexOf("Mozilla"))===-1,Km=e=>{var t;return Te({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:k4(Be==null?void 0:Be.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Kh,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:e??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:$s&&es($s==null?void 0:$s.search)&&$s.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:(_e==null||(t=_e.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){Oe.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:tv,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:cv},error_tracking:{},_onCapture:Kh},(n=>({rageclick:n&&n>="2026-05-30"?{content_ignorelist:P4,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)}))(e))},kM=[["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"]],cS=e=>{var t={};for(var n of kM){var r=n[0],o=n[1];De(e[r])||(t[o]=e[r])}var c=rs({},t,e),h=e.__preview_external_dependency_versioned_paths;return De(h)||(De(e.strict_script_versioning)&&(c.strict_script_versioning=!!h),es(h)&&De(e.asset_host)&&(c.asset_host=h)),dt(e.property_blacklist)&&(De(e.property_denylist)?c.property_denylist=e.property_blacklist:dt(e.property_denylist)?c.property_denylist=[...e.property_blacklist,...e.property_denylist]:Oe.error(s2+e.property_denylist)),c};class jM{constructor(){this.__forceAllowLocalhost=!1}get sn(){return this.__forceAllowLocalhost}set sn(t){Oe.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class ci{an(t,n){if(t){var r=this.Ji.indexOf(t);r!==-1&&this.Ji.splice(r,1)}return this.Ji.push(n),n.initialize==null||n.initialize(),n}ln(){return this.config.cookieless_mode===cr||this.config.cookieless_mode===Ta&&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 jM,this.un=!1,this.version=Ft.LIB_VERSION,this.en=new e_,this.Ji=[],this.hn=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Km(),this.SentryIntegration=G4,this.sentryIntegration=r=>(function(o,c){var h=RE(o,c);return{name:jE,processEvent:l=>h(l)}})(this,r),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.dn=!1,this.cn=null,this.vn=null,this.fn=null,this.scrollManager=new fM(this),this.pageViewManager=new K1(this),this.rateLimiter=new tM(this),this.requestRouter=new gM(this),this.consent=new $4(this),this.externalIntegrations=new SM(this);var n=(t=ci.__defaultExtensionClasses)!==null&&t!==void 0?t:{};this.featureFlags=n.featureFlags&&new n.featureFlags(this),this.toolbar=n.toolbar&&new n.toolbar(this),this.surveys=n.surveys&&new n.surveys(this),this.conversations=n.conversations&&new n.conversations(this),this.logs=n.logs&&new n.logs(this),this.metrics=n.metrics&&new n.metrics(this),this.experiments=n.experiments&&new n.experiments(this),this.exceptions=n.exceptions&&new n.exceptions(this),this.people={set:(r,o,c)=>{var h=es(r)?{[r]:o}:r;this.setPersonProperties(h),c==null||c({})},set_once:(r,o,c)=>{var h=es(r)?{[r]:o}:r;this.setPersonProperties(void 0,h),c==null||c({})}},this.on("eventCaptured",(r=>Oe.info('send "'+(r==null?void 0:r.event)+'"',r)))}init(t,n,r){if(r&&r!==zo){var o,c=(o=jc[r])!==null&&o!==void 0?o:new ci;return c._init(t,n,r),jc[r]=c,jc[zo][r]=c,c}return this._init(t,n,r)}_init(t,n,r){var o,c;n===void 0&&(n={});var h=es(t)?t.trim():"";if(!h)return Oe.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=Km(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 l=Km(n.defaults),u=cS(n),m=rs({},l,u,{name:r,token:h});ps(l.rageclick)&&ps(u.rageclick)&&(m.rageclick=rs({},l.rageclick,u.rageclick)),ps(l.session_recording)&&ps(u.session_recording)&&(m.session_recording=rs({},l.session_recording,u.session_recording)),this.set_config(m),this.config.on_xhr_error&&Oe.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:Cn.GZipJS;var g=this.yn();this.persistence=new zm(this.config,g),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new zm(Te({},this.config,{persistence:"sessionStorage"}),g,!1);var p=Te({},this.persistence.props),S=Te({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.bn=new uM((k=>this._n(k)),this.config.request_queue_config),this.wn=new hM(this),this.__request_queue=[];var x=this.ln();if(x||(this.sessionManager=new iS(this),this.sessionPropsManager=new nS(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(Oe.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.xn(x)}),0)):(Oe.info("Initializing extensions synchronously"),this.xn(x)),Ft.DEBUG=Ft.DEBUG||this.config.debug,Ft.DEBUG&&Oe.info("Starting in debug mode",{this:this,config:n,thisC:Te({},this.config),p,s:S}),!this.config.identity_distinct_id||(o=n.bootstrap)!=null&&o.distinctID||(n.bootstrap=Te({},n.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((c=n.bootstrap)==null?void 0:c.distinctID)!==void 0){var A=n.bootstrap.distinctID,E=this.get_distinct_id(),y=this.persistence.get_property(oi);if(n.bootstrap.isIdentifiedID&&E!=null&&E!==A&&y===Ao)this.identify(A);else if(n.bootstrap.isIdentifiedID&&E!=null&&E!==A&&y===va)Oe.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(lr()),v=n.bootstrap.isIdentifiedID?b:A;this.persistence.set_property(oi,n.bootstrap.isIdentifiedID?va:Ao),this.register({distinct_id:A,$device_id:v})}}if(x)this.register_once({distinct_id:Xu,$device_id:null},"");else if(!this.get_distinct_id()){var _=this.config.get_device_id(lr());this.register_once({distinct_id:_,$device_id:_},""),this.persistence.set_property(oi,Ao)}return ws(_e,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),n.segment?(function(k,C){var w=k.config.segment;if(!w)return C();(function(T,j){var M=T.config.segment;if(!M)return j();var D=q=>{var F=()=>q.anonymousId()||lr();T.config.get_device_id=F,q.id()&&(T.register({distinct_id:q.id(),$device_id:F()}),T.persistence.set_property(oi,va)),j()},L=M.user();"then"in L&&Gn(L.then)?L.then(D):D(L)})(k,(()=>{w.register((T=>{typeof Promise<"u"&&Promise.resolve||Pm.warn("This browser does not have Promise support, and can not use the segment integration");var j=(M,D)=>{if(!D)return M;M.event.userId||M.event.anonymousId===T.get_distinct_id()||(Pm.info("No userId set, resetting PostHog"),T.reset()),M.event.userId&&M.event.userId!==T.get_distinct_id()&&(Pm.info("UserId set, identifying with PostHog"),T.identify(M.event.userId));var L=T.calculateEventProperties(D,M.event.properties);return M.event.properties=Object.assign({},L,M.event.properties),M};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:M=>j(M,M.event.event),page:M=>j(M,Bo),identify:M=>j(M,Om),screen:M=>j(M,"$screen")}})(k)).then((()=>{C()}))}))})(this,(()=>this.kn())):this.kn(),Gn(this.config._onCapture)&&this.config._onCapture!==Kh&&(Oe.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(k=>this.config._onCapture(k.event,k)))),this.config.ip&&Oe.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 XE.apply(this,arguments)})().then((k=>{k&&this.register({[$m]:k})})).catch(Kh),this}xn(t){var n,r,o,c,h,l,u,m,g=performance.now(),p=Te({},ci.__defaultExtensionClasses,this.config.__extensionClasses),S=[];p.featureFlags&&this.Ji.push(this.featureFlags=(n=this.featureFlags)!==null&&n!==void 0?n:new p.featureFlags(this)),p.exceptions&&this.Ji.push(this.exceptions=(r=this.exceptions)!==null&&r!==void 0?r:new p.exceptions(this)),p.historyAutocapture&&this.Ji.push(this.historyAutocapture=new p.historyAutocapture(this)),p.tracingHeaders&&this.Ji.push(this.tracingHeaders=new p.tracingHeaders(this)),p.siteApps&&this.Ji.push(this.siteApps=new p.siteApps(this)),p.sessionRecording&&!t&&this.Ji.push(this.sessionRecording=new p.sessionRecording(this)),this.config.disable_scroll_properties||S.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),p.autocapture&&this.Ji.push(this.autocapture=new p.autocapture(this)),p.surveys&&this.Ji.push(this.surveys=(o=this.surveys)!==null&&o!==void 0?o:new p.surveys(this)),p.logs&&this.Ji.push(this.logs=(c=this.logs)!==null&&c!==void 0?c:new p.logs(this)),p.metrics&&this.Ji.push(this.metrics=(h=this.metrics)!==null&&h!==void 0?h:new p.metrics(this)),p.conversations&&this.Ji.push(this.conversations=(l=this.conversations)!==null&&l!==void 0?l:new p.conversations(this)),p.productTours&&this.Ji.push(this.productTours=new p.productTours(this)),p.heatmaps&&this.Ji.push(this.heatmaps=new p.heatmaps(this)),p.webVitalsAutocapture&&this.Ji.push(this.webVitalsAutocapture=new p.webVitalsAutocapture(this)),p.exceptionObserver&&this.Ji.push(this.exceptionObserver=new p.exceptionObserver(this)),p.deadClicksAutocapture&&this.Ji.push(this.deadClicksAutocapture=new p.deadClicksAutocapture(this,V4)),p.toolbar&&this.Ji.push(this.toolbar=(u=this.toolbar)!==null&&u!==void 0?u:new p.toolbar(this)),p.experiments&&this.Ji.push(this.experiments=(m=this.experiments)!==null&&m!==void 0?m:new p.experiments(this)),this.Ji.forEach((x=>{x.initialize&&S.push((()=>{x.initialize==null||x.initialize()}))})),S.push((()=>{if(this.Sn){var x=this.Sn;this.Sn=void 0,this.Ji.forEach((A=>A.onRemoteConfig==null?void 0:A.onRemoteConfig(x)))}})),this.Cn(S,g)}Cn(t,n){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-n>=30&&t.length>0)return void setTimeout((()=>{this.Cn(t,n)}),0);var r=t.shift();if(r)try{r()}catch(c){Oe.error("Error initializing extension:",c)}}var o=Math.round(performance.now()-n);this.register_for_session({[uE]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[dE]:o}),this.config.__preview_deferred_init_extensions&&Oe.info("PostHog extensions initialized ("+o+"ms)")}Br(t){var n;if(!Be||!Be.body)return Oe.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Br(t)}),500);if(this.config.__preview_deferred_init_extensions&&(this.Sn=t),this.tn=t,this.compression=void 0,t.ok){var r,o=t.config;o.supportedCompression&&!this.config.disable_compression&&(this.compression=lt(o.supportedCompression,Cn.GZipJS)?Cn.GZipJS:lt(o.supportedCompression,Cn.Base64)?Cn.Base64:void 0),(r=o.analytics)!=null&&r.endpoint&&(this.analyticsDefaultEndpoint=o.analytics.endpoint)}this.set_config({person_profiles:this.vn?this.vn:tv}),(n=this.Mn)==null||n.handleRemoteConfig(t),this.Ji.forEach((c=>c.onRemoteConfig==null?void 0:c.onRemoteConfig(t)))}kn(){try{this.config.loaded(this)}catch(r){Oe.critical("`loaded` function failed",r)}if(this.In(),this.config.internal_or_test_user_hostname&&$s!=null&&$s.hostname){var t=$s.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 PE(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()&&Ju(this.__request_queue,(t=>this._n(t))),this.__request_queue=[],this.In()}_handle_unload(){var t,n,r,o,c;(t=this.surveys)==null||t.handlePageUnload==null||t.handlePageUnload(),(n=this.metrics)==null||n.flush("sendBeacon"),this.config.request_batching?(this.Rn()&&this.capture(Dm),(r=this.logs)==null||r.flushLogs("sendBeacon"),(o=this.bn)==null||o.unload(),(c=this.wn)==null||c.unload()):this.Rn()&&this.capture(Dm,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded?n2?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=Te({},this.config.request_headers,t.headers),t.compression=t.compression==="best-available"?this.compression:t.compression,(De(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(n=>{var r,o,c,h=Te({},n);h.timeout=h.timeout||6e4;var l,u,m,g,p,S=(r=h.transport)!==null&&r!==void 0?r:"fetch";S==="sendBeacon"&&De(h.compression)&&h.data&&(h.compression=Cn.Base64),h.method==="POST"&&h.data&&(h.timestampMode==="capture-body"?h.data={api_key:(u=(p=(g=dt(l=h.data)?l:[l])[0])==null||(m=p.properties)==null?void 0:m.token)!==null&&u!==void 0?u:p==null?void 0:p.token,batch:g,sent_at:new Date().toISOString()}:h.timestampMode==="body"&&(h.data=(function(E,y){return y===void 0&&(y=new Date().toISOString()),dt(E)?E.map((b=>Te({},b,{sent_at:y}))):Te({},E,{sent_at:y})})(h.data))),h.url=sS(h.url,h.method,h.compression,h.timestampMode);var x=bh.filter((E=>!h.disableTransport||!E.transport||!h.disableTransport.includes(E.transport))),A=(o=(c=(function(E,y){for(var b=0;E.length>b;b++)if(E[b].transport===S)return E[b]})(x))==null?void 0:c.method)!==null&&o!==void 0?o:x[0].method;if(!A)throw new Error("No available transport method");S!=="sendBeacon"&&h.data&&h.compression===Cn.GZipJS&&R3&&typeof Promise<"u"&&!yh?lM(h).then((E=>{A(E)})).catch((E=>{if(x1(E))return yh=!0,void A(Te({},h,{compression:void 0,url:sS(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 x1(y)||b===EC})(E)&&(yh=!0),A(h)})):A(h)})(Te({},t,{callback:n=>{var r,o;this.rateLimiter.checkForLimiting(n),400>n.statusCode||(r=(o=this.config).on_request_error)==null||r.call(o,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){Wm++;try{var n,r=[],o=[],c=[];Ju(t,(l=>{if(l)if(dt(n=l[0]))c.push(l);else if(Gn(l))try{l.call(this)}catch(u){Oe.error("Error executing queued PostHog call",l,u)}else dt(l)&&n==="alias"?r.push(l):dt(l)&&n.indexOf("capture")!==-1&&Gn(this[n])?c.push(l):o.push(l)}));var h=function(l,u){Ju(l,(function(m){try{if(dt(m[0])){var g=u;ts(m,(function(p){g=g[p[0]].apply(g,p.slice(1))}))}else u[m[0]].apply(u,m.slice(1))}catch(p){Oe.error("Error executing queued PostHog call",m,p)}}))};h(r,this),h(o,this),h(c,this)}finally{Wm--}}push(t){if(Wm>0&&dt(t)&&es(t[0])){var n=ci.prototype[t[0]];Gn(n)&&n.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,n,r){var o,c,h,l,u,m,g;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.bn){if(this.is_capturing())if(!De(t)&&es(t)){var p=!this.config.opt_out_useragent_filter&&this._is_bot();if(!p||this.config.__preview_capture_bot_pageviews){var S=r!=null&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(S==null||!S.isRateLimited){if(this.hn.length>0){var x={};for(var A of this.hn.slice())try{rs(x,A())}catch(B){Oe.error("Failed to produce browser extension event properties",B)}n=Te({},x,n??{})}var E;(o=n)!=null&&o.$current_url&&!es((c=n)==null?void 0:c.$current_url)&&(Oe.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),(E=n)==null||delete E.$current_url),t!=="$exception"||r!=null&&r.Pn||Oe.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var y=new Date,b=(r==null?void 0:r.timestamp)||y,v=R1(r==null?void 0:r.uuid,lr),_={uuid:v,event:t,properties:this.calculateEventProperties(t,n||{},b,v)};t===Bo&&this.config.__preview_capture_bot_pageviews&&p&&(_.event="$bot_pageview",_.properties.$browser_type="bot"),S&&(_.properties.$lib_rate_limit_remaining_tokens=S.remainingTokens);var k=t==="$feature_flag_called"&&_.properties.$feature_flag_has_experiment===!1&&this.get_property(Oh)===!0;r!=null&&r.$set&&!k&&(_.$set=r==null?void 0:r.$set);var C=r==null?void 0:r.$unset;C&&(_.$unset=C);var w,T,j,M=k?void 0:this.On(r==null?void 0:r.$set_once,t!==$1,t===Om);if(M&&(_.$set_once=M),r!=null&&r._noTruncate||(l=this.config.properties_string_max_length,u=_,m=B=>es(B)?B.slice(0,l):B,g=new Set,_=(function B($,H){if($!==Object($))return m?m($):$;if(!g.has($)){var U;if(g.add($),dt($))U=[],Ju($,(W=>{U.push(B(W))}));else{var P={};ts($,((W,se)=>{g.has(W)||(P[se]=B(W))})),U=P}return U}})(u)),_.timestamp=b,De(r==null?void 0:r.timestamp)||(_.properties.$event_time_override_provided=!0,_.properties.$event_time_override_system_time=y),k&&(_.properties=(function(B,$){$===void 0&&($=[]);var H={},U=P=>{B[P]!==void 0&&(H[P]=B[P])};return A3.forEach(U),$.forEach(U),H})(_.properties,EM)),t===dr.DISMISSED||t===dr.SENT){var D,L,q=(D=n)==null?void 0:D[Um.SURVEY_ID],F=(L=n)==null?void 0:L[Um.SURVEY_ITERATION];t2({id:q,current_iteration:F}),_.$set=Te({},_.$set,{[(w={id:q,current_iteration:F},T=t===dr.SENT?"responded":"dismissed",j="$survey_"+T+"/"+w.id,w.current_iteration&&w.current_iteration>0&&(j="$survey_"+T+"/"+w.id+"/"+w.current_iteration),j)]:!0})}else t===dr.SHOWN&&(_.$set=Te({},_.$set,{[Um.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(t===eM.SHOWN){var Y,Q=(Y=n)==null?void 0:Y[X1.TOUR_TYPE];Q&&(_.$set=Te({},_.$set,{[X1.TOUR_LAST_SEEN_DATE+"/"+Q]:new Date().toISOString()}))}var G=Te({},_.properties.$set,_.$set);if(Vr(G)||this.setPersonPropertiesForFlags(G),!ft(this.config.before_send)){var ee=this.Rt(_);if(!ee)return;(_=ee).uuid=R1(_.uuid,lr)}this.en.emit("eventCaptured",_);var ne=(h=r==null?void 0:r._url)!==null&&h!==void 0?h:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),z={method:"POST",url:ne,data:_,compression:"best-available",timestampMode:(r==null?void 0:r._batchKey)==="recordings"||/\/s\/(?:\?|$)/.test(ne)?"body":"capture-body",batchKey:r==null?void 0:r._batchKey,transport:r==null?void 0:r.transport};return!this.config.request_batching||r&&(r==null||!r._batchKey)||r!=null&&r.send_instantly?this._n(z):this.bn.enqueue(z),_}Oe.critical("This capture call is ignored due to client rate limiting.")}}else Oe.error("No event name provided to posthog.capture")}else Oe.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 CM(this)}nn(t){this.hn.push(t);var n=!0;return()=>{if(n){n=!1;var r=this.hn.indexOf(t);r!==-1&&this.hn.splice(r,1)}}}calculateEventProperties(t,n,r,o,c){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return n;var h=c?void 0:this.persistence.remove_event_timer(t),l=Te({},n);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,this.ln()&&(l[cE]=!0),t==="$snapshot"){var u=Te({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=u.distinct_id,(!es(l.distinct_id)&&!on(l.distinct_id)||Mg(l.distinct_id))&&Oe.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var m,g=(function(_,k,C,w){var T,j,M,D;if(w===void 0&&(w=!1),!Ln)return{};var L,q=_?[...sl,...k||[]]:[],F=(function(pe){for(var ye=0;k1.length>ye;ye++){var ke=k1[ye],Le=ke[1],Ie=ke[0].exec(pe),qe=Ie&&(Gn(Le)?Le(Ie,pe):Le);if(qe)return qe}return["",""]})(Ln),Y=F[0],Q=F[1],G=(L=typeof navigator<"u"?navigator:void 0)!=null&&L.brave?{brave:!0}:{},ee={};De(C)||(ee.detectGoogleSearchApp=C);var ne={},z=(T=navigator)==null||(T=T.userAgentData)==null?void 0:T.platform,B=(j=navigator)==null?void 0:j.maxTouchPoints,$=_e==null||(M=_e.screen)==null?void 0:M.width,H=_e==null||(D=_e.screen)==null?void 0:D.height,U=_e==null?void 0:_e.devicePixelRatio;De(z)||(ne.userAgentDataPlatform=z),De(B)||(ne.maxTouchPoints=B),De($)||(ne.screenWidth=$),De(H)||(ne.screenHeight=H),De(U)||(ne.devicePixelRatio=U);var P,W,se,X,V,ue,oe,Z,te=rs(Kv({$os:Y,$os_version:Q,$browser:YC(Ln,navigator.vendor,G,ee),$device:j1(Ln),$device_type:(W=Ln,se=ne,Z=j1(W),Z===NC||Z===TC||Z==="Kobo"||Z==="Kindle Fire"||Z===qC?Zo:Z===Nc||Z===Wo||Z===Mc||Z===Dg?"Console":Z===$C?"Wearable":Z?Yn:(se==null?void 0:se.userAgentDataPlatform)==="Android"&&((X=se==null?void 0:se.maxTouchPoints)!==null&&X!==void 0?X:0)>0?600>Math.min((V=se==null?void 0:se.screenWidth)!==null&&V!==void 0?V:0,(ue=se==null?void 0:se.screenHeight)!==null&&ue!==void 0?ue:0)/((oe=se==null?void 0:se.devicePixelRatio)!==null&&oe!==void 0?oe:1)?Yn:Zo:"Desktop"),$timezone:IE(),$timezone_offset:J4()}),{$current_url:Lc(w?Yr($s==null?void 0:$s.href):$s==null?void 0:$s.href,q,Ic),$host:$s==null?void 0:$s.host,$pathname:$s==null?void 0:$s.pathname,$raw_user_agent:Ln.length>1e3?Ln.substring(0,997)+"...":Ln,$browser_version:K3(Ln,navigator.vendor,G,ee),$browser_language:Y1(),$browser_language_prefix:(P=Y1(),typeof P=="string"?P.split("-")[0]:void 0),$screen_height:_e==null?void 0:_e.screen.height,$screen_width:_e==null?void 0:_e.screen.width,$viewport_height:_e==null?void 0:_e.innerHeight,$viewport_width:_e==null?void 0:_e.innerWidth,$lib:Ft.LIB_NAME,$lib_version:Ft.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Ft.SDK_DIST_CHANNEL&&(te.$sdk_dist_channel=Ft.SDK_DIST_CHANNEL),te})(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 p=this.sessionManager.checkAndGetSessionAndWindowId(c,r.getTime()),S=p.windowId;l.$session_id=p.sessionId,l.$window_id=S}this.sessionPropsManager&&rs(l,this.sessionPropsManager.getSessionProps());try{var x;this.sessionRecording&&rs(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=(x=this.wn)==null?void 0:x.length}catch(_){l.$sdk_debug_error_capturing_properties=String(_)}if(this.requestRouter.region===uv&&(l.$lib_custom_api_host=this.config.api_host),m=t!==Bo||c?t!==Dm||c?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,o),l=rs(l,m),t===Bo&&Be&&(l.title=Be.title),!De(h)){var A=r.getTime()-h;l.$duration=parseFloat((A/1e3).toFixed(3))}Ln&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser");var E=this.persistence.properties(),y=this.sessionPersistence.properties();ts(["$referrer","$referring_domain"],(_=>{_ in E&&delete y[_]})),(l=rs({},g,E,y,l)).$is_identified=this._isIdentified(),dt(this.config.property_denylist)?ts(this.config.property_denylist,(function(_){delete l[_]})):Oe.error(s2+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var b=this.config.sanitize_properties;b&&(Oe.error(lS),l=b(l,t));var v=this.An();return l.$process_person_profile=v,v&&!c&&this.$n("_calculate_event_properties"),l}On(t,n,r){var o;if(n===void 0&&(n=!0),r===void 0&&(r=!1),!this.persistence||!this.An()||this.un&&!r)return t;var c=this.persistence.get_initial_props(),h=(o=this.sessionPropsManager)==null?void 0:o.getSetOnceProps(),l=rs({},c,h||{},t||{}),u=this.config.sanitize_properties;return u&&(Oe.error(lS),l=u(l,"$set_once")),n&&(this.un=!0),Vr(l)?void 0:l}register(t,n){var r;(r=this.persistence)==null||r.register(t,n)}register_once(t,n,r){var o;(o=this.persistence)==null||o.register_once(t,n,r)}register_for_session(t){var n;(n=this.sessionPersistence)==null||n.register(t)}unregister(t){var n;(n=this.persistence)==null||n.unregister(t)}unregister_for_session(t){var n;(n=this.sessionPersistence)==null||n.unregister(t)}Ln(t,n){this.register({[t]:n})}getFeatureFlag(t,n){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlag(t,n)}getFeatureFlagPayload(t){var n;return(n=this.featureFlags)==null?void 0:n.getFeatureFlagPayload(t)}getFeatureFlagResult(t,n){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlagResult(t,n)}getAllFeatureFlags(){var t,n;return(t=(n=this.featureFlags)==null?void 0:n.getAllFeatureFlags())!==null&&t!==void 0?t:[]}isFeatureEnabled(t,n){var r,o;return(r=(o=this.featureFlags)==null?void 0:o.isFeatureEnabled(t,n))!==null&&r!==void 0?r:n==null?void 0:n.defaultValue}reloadFeatureFlags(){var t;(t=this.featureFlags)==null||t.reloadFeatureFlags()}updateFlags(t,n,r){var o;(o=this.featureFlags)==null||o.updateFlags(t,n,r)}updateEarlyAccessFeatureEnrollment(t,n,r){var o;(o=this.featureFlags)==null||o.updateEarlyAccessFeatureEnrollment(t,n,r)}getEarlyAccessFeatures(t,n,r){var o;return n===void 0&&(n=!1),(o=this.featureFlags)==null?void 0:o.getEarlyAccessFeatures(t,n,r)}on(t,n){return this.en.on(t,n)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:ac}),()=>{})}onSessionId(t){var n,r;return(n=(r=this.sessionManager)==null?void 0:r.onSessionId(t))!==null&&n!==void 0?n:()=>{}}getSurveys(t,n){n===void 0&&(n=!1),this.surveys?this.surveys.getSurveys(t,n):t([],{isLoaded:!1,error:ac})}getActiveMatchingSurveys(t,n){n===void 0&&(n=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,n):t([],{isLoaded:!1,error:ac})}renderSurvey(t,n){var r;(r=this.surveys)==null||r.renderSurvey(t,n)}displaySurvey(t,n){var r;n===void 0&&(n=_M),(r=this.surveys)==null||r.displaySurvey(t,n)}cancelPendingSurvey(t){var n;(n=this.surveys)==null||n.cancelPendingSurvey(t)}canRenderSurvey(t){var n,r;return(n=(r=this.surveys)==null?void 0:r.canRenderSurvey(t))!==null&&n!==void 0?n:{visible:!1,disabledReason:ac}}canRenderSurveyAsync(t,n){var r,o;return n===void 0&&(n=!1),(r=(o=this.surveys)==null?void 0:o.canRenderSurveyAsync(t,n))!==null&&r!==void 0?r:Promise.resolve({visible:!1,disabledReason:ac})}Dn(t){return!t||Mg(t)?(Oe.critical("Unique user id has not been set in posthog.identify"),!1):t===Xu?(Oe.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())||(Oe.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(t,n,r){if(!this.__loaded||!this.persistence)return Oe.uninitializedWarning("posthog.identify");if(on(t)&&(t=t.toString(),Oe.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 o=this.get_distinct_id();this.register({$user_id:t}),this.get_property($c)||this.register_once({$had_persisted_distinct_id:!0,$device_id:o},""),t!==o&&t!==this.get_property(mc)&&(this.unregister(mc),this.register({distinct_id:t}));var c,h=(this.persistence.get_property(oi)||Ao)===Ao,l=t!==o,u=!l&&h;if(l&&h)this.persistence.set_property(oi,va),this.setPersonPropertiesForFlags({$set:n||{},$set_once:r||{}},!1),this.capture(Om,{distinct_id:t,$anon_distinct_id:o},{$set:n||{},$set_once:r||{}}),this.fn=Gm(t,n,r),(c=this.featureFlags)==null||c.setAnonymousDistinctId(o);else if(u){this.persistence.set_property(oi,va);var m=n||{},g=r||{};this.setPersonPropertiesForFlags({$set:m,$set_once:g},!1),this.capture("$set",{$set:m,$set_once:g}),this.fn=Gm(t,n,r)}else(n||r)&&this.setPersonProperties(n,r);l?(this.reloadFeatureFlags(),this.unregister(Cc)):u&&(n||r)&&this.reloadFeatureFlags()}}setPersonProperties(t,n){if((t||n)&&this.$n("posthog.setPersonProperties")){var r=Gm(this.get_distinct_id(),t,n);this.fn!==r?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:n||{}},!0),this.capture("$set",{$set:t||{},$set_once:n||{}}),this.fn=r):Oe.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var n,r=(dt(t)?t:[t]).filter((o=>es(o)&&o.length>0));r.length!==0&&this.$n("posthog.unsetPersonProperties")&&((n=this.featureFlags)==null||n.unsetPersonPropertiesForFlags(r,!0),this.capture("$set",{$unset:r}),this.fn=null)}group(t,n,r){if(t&&n){var o=this.getGroups(),c=o[t]!==n;if(c&&this.resetGroupPropertiesForFlags(t),this.register({$groups:Te({},o,{[t]:n})}),c||r){var h={$group_type:t,$group_key:n};r&&(h.$group_set=r),this.capture($1,h)}r&&this.setGroupPropertiesForFlags({[t]:r}),c&&!r&&this.reloadFeatureFlags()}else Oe.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,n){var r;n===void 0&&(n=!0),(r=this.featureFlags)==null||r.setPersonPropertiesForFlags(t,n)}resetPersonPropertiesForFlags(t){var n;t===void 0&&(t=!0),(n=this.featureFlags)==null||n.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,n){var r;n===void 0&&(n=!0),this.$n("posthog.setGroupPropertiesForFlags")&&((r=this.featureFlags)==null||r.setGroupPropertiesForFlags(t,n))}resetGroupPropertiesForFlags(t){var n;(n=this.featureFlags)==null||n.resetGroupPropertiesForFlags(t)}reset(t){var n,r,o,c,h,l,u,m,g,p;if(Oe.info("reset"),!this.__loaded)return Oe.uninitializedWarning("posthog.reset");var S,x=this.get_property($c),A=this.get_property($m),E=this.get_property(Da);if(this.consent.reset(),(n=this.persistence)==null||n.clear(),(r=this.sessionPersistence)==null||r.clear(),De(E)||(S=this.persistence)==null||S.register({[Da]:E}),(o=this.surveys)==null||o.reset(),(c=this.En)==null||c.stop(),(h=this.featureFlags)==null||h.reset(),(l=this.conversations)==null||l.reset(),(u=this.logs)==null||u.reset(),(m=this.metrics)==null||m.reset(),(g=this.persistence)==null||g.set_property(oi,Ao),(p=this.sessionManager)==null||p.resetSessionId(),this.fn=null,this.config.cookieless_mode===cr)this.register_once({distinct_id:Xu,$device_id:null},"");else{var y=this.config.get_device_id(lr());this.register_once({distinct_id:y,$device_id:t?y:x},""),t||De(A)||this.register({[$m]: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 ms((function*(){var r,o,c,h,l,u,m;n.__loaded?((r=n.En)==null||r.stop(),(o=n.Mn)==null||o.dispose(),(c=n.logs)==null||c.flushLogs("sendBeacon"),(h=n.metrics)==null||h.flush("sendBeacon"),(l=n.bn)==null||l.unload(),(u=n.wn)==null||u.unload(),(m=n.featureFlags)==null||m.destroy()):Oe.uninitializedWarning("posthog.shutdown")}))()}setIdentity(t,n){var r;this.config.identity_distinct_id=t,this.config.identity_hash=n,this.alias(t),(r=this.conversations)==null||r.Nn()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,(t=this.conversations)==null||t.qn()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,n;return(t=(n=this.sessionManager)==null?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&t!==void 0?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var n=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=n.sessionStartTimestamp,o=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+n.sessionId);if(t!=null&&t.withTimestamp&&r){var c,h=(c=t.timestampLookBack)!==null&&c!==void 0?c:10;if(!r)return o;o+="?t="+Math.max(Math.floor((new Date().getTime()-r)/1e3)-h,0)}return o}alias(t,n){return t===this.get_property(nE)?(Oe.critical("Attempting to create alias for existing People user - aborting."),-2):this.$n("posthog.alias")?(De(n)&&(n=this.get_distinct_id()),t!==n?(this.Ln(mc,t),this.capture("$create_alias",{alias:t,distinct_id:n})):(Oe.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var n=Te({},this.config);if(ps(t)){var r,o,c,h,l,u,m,g,p,S,x;rs(this.config,cS(t));var A=this.yn();(r=this.persistence)==null||r.update_config(this.config,n,A),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new zm(Te({},this.config,{persistence:"sessionStorage"}),A,!1);var E=this.pn(this.config.debug);wi(E)&&(this.config.debug=E),wi(this.config.debug)&&(this.config.debug?(Ft.DEBUG=!0,is.N()&&is.A("ph_debug",!0),Oe.info("set_config",{config:t,oldConfig:n,newConfig:Te({},this.config)})):(Ft.DEBUG=!1,is.N()&&is.D("ph_debug"))),(o=this.exceptionObserver)==null||o.onConfigChange(),(c=this.exceptions)==null||c.onConfigChange(),(h=this.sessionRecording)==null||h.startIfEnabledOrStop(),(l=this.tracingHeaders)==null||l.startIfEnabledOrStop(),(u=this.autocapture)==null||u.startIfEnabled(),(m=this.heatmaps)==null||m.startIfEnabled(),(g=this.exceptionObserver)==null||g.startIfEnabledOrStop(),(p=this.deadClicksAutocapture)==null||p.startIfEnabledOrStop(),(S=this.surveys)==null||S.loadIfEnabled(),this.jn(),(x=this.externalIntegrations)==null||x.startIfEnabledOrStop()}}_overrideSDKInfo(t,n){Ft.LIB_NAME=t,Ft.LIB_VERSION=n}startSessionRecording(t){var n,r,o,c,h,l=t===!0,u={sampling:l||!(t==null||!t.sampling),linked_flag:l||!(t==null||!t.linked_flag),url_trigger:l||!(t==null||!t.url_trigger),event_trigger:l||!(t==null||!t.event_trigger)};Object.values(u).some(Boolean)&&((n=this.sessionManager)==null||n.checkAndGetSessionAndWindowId(),u.sampling&&((r=this.sessionRecording)==null||r.overrideSampling()),u.linked_flag&&((o=this.sessionRecording)==null||o.overrideLinkedFlag()),u.url_trigger&&((c=this.sessionRecording)==null||c.overrideTrigger("url")),u.event_trigger&&((h=this.sessionRecording)==null||h.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!((t=this.sessionRecording)==null||!t.started)}captureException(t,n){if(this.exceptions){var r=new Error("PostHog syntheticException"),o=this.exceptions.buildProperties(t,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(Te({},o,n))}}addExceptionStep(t,n){var r;(r=this.exceptions)==null||r.addExceptionStep(t,n)}captureLog(t){var n;(n=this.logs)==null||n.captureLog(t)}get logger(){var t,n;return(t=(n=this.logs)==null?void 0:n.logger)!==null&&t!==void 0?t:ci.Bn}startExceptionAutocapture(t){this.set_config({capture_exceptions:t==null||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var n,r;return(n=(r=this.toolbar)==null?void 0:r.loadToolbar(t))!==null&&n!==void 0&&n}get_property(t){var n;return(n=this.persistence)==null?void 0:n.props[t]}getSessionProperty(t){var n;return(n=this.sessionPersistence)==null?void 0:n.props[t]}toString(){var t,n=(t=this.config.name)!==null&&t!==void 0?t:zo;return n!==zo&&(n=zo+"."+n),n}_isIdentified(){var t,n;return((t=this.persistence)==null?void 0:t.get_property(oi))===va||((n=this.sessionPersistence)==null?void 0:n.get_property(oi))===va}An(){var t,n;return!(this.config.person_profiles==="never"||this.config.person_profiles===tv&&!this._isIdentified()&&Vr(this.getGroups())&&((t=this.persistence)==null||(t=t.props)==null||!t[mc])&&((n=this.persistence)==null||(n=n.props)==null||!n[Ph]))}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"?(Oe.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Ln(Ph,!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!==Ta)}jn(){var t,n,r,o,c=this.yn();return((t=this.persistence)==null?void 0:t.yr)!==c&&((r=this.persistence)==null||r.set_disabled(c)),((n=this.sessionPersistence)==null?void 0:n.yr)!==c&&((o=this.sessionPersistence)==null||o.set_disabled(c)),c}opt_in_capturing(t){var n;if(this.config.cookieless_mode!==cr){if(this.ln()){var r,o,c,h,l;this.reset(!0),(r=this.sessionManager)==null||r.destroy(),(o=this.pageViewManager)==null||o.destroy(),this.sessionManager=new iS(this),this.pageViewManager=new K1(this),this.persistence&&(this.sessionPropsManager=new nS(this,this.sessionManager,this.persistence));var u,m=(c=(h=this.config.__extensionClasses)==null?void 0:h.sessionRecording)!==null&&c!==void 0?c:(l=ci.__defaultExtensionClasses)==null?void 0:l.sessionRecording;m&&(this.sessionRecording=this.an(this.sessionRecording,new m(this)),this.tn&&((u=this.sessionRecording)==null||u.onRemoteConfig==null||u.onRemoteConfig(this.tn)))}var g,p;this.consent.optInOut(!0),this.jn(),this.In(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),this.config.cookieless_mode==Ta&&((g=this.surveys)==null||g.loadIfEnabled()),(De(t==null?void 0:t.captureEventName)||t!=null&&t.captureEventName)&&this.capture((p=t==null?void 0:t.captureEventName)!==null&&p!==void 0?p:"$opt_in",t==null?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Tn()}else Oe.warn(oS)}opt_out_capturing(){var t,n,r;this.config.cookieless_mode!==cr?(this.config.cookieless_mode===Ta&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.jn(),this.config.cookieless_mode===Ta&&(this.register({distinct_id:Xu,$device_id:null}),(t=this.sessionRecording)==null||t.stopRecording(),this.sessionRecording=void 0,(n=this.sessionManager)==null||n.destroy(),(r=this.pageViewManager)==null||r.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.Tn(),this.In())):Oe.warn(oS)}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===cr||(this.config.cookieless_mode===Ta?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.jn()}_is_bot(){return kn?YE(kn,this.config.custom_blocked_useragents):void 0}Tn(){Be&&(Be.visibilityState==="visible"?this.dn||(this.dn=!0,this.capture(Bo,{title:Be.title},{send_instantly:!0}),this.cn&&(Be.removeEventListener(Bh,this.cn),this.cn=null)):this.cn||(this.cn=this.Tn.bind(this),ws(Be,Bh,this.cn)))}debug(t){t===!1?(_e==null||_e.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(_e==null||_e.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?(Oe.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(function(n,r,o,c,h){var l=r in n&&!ft(n[r]),u=o in n&&!ft(n[o]);return l?n[r]:!!u&&(h&&h.warn("Config field '"+o+"' is deprecated. Please use '"+r+"' instead. The old field will be removed in a future major version."),n[o])})(t,"advanced_disable_flags","advanced_disable_decide",0,Oe)}Rt(t){var n;if(ft(this.config.before_send))return t;var r=Object.keys((n=t.properties)!==null&&n!==void 0?n:{}).filter(L3),o=dt(this.config.before_send)?this.config.before_send:[this.config.before_send],c=t;for(var h of o){if(c=h(c),ft(c)){var l="Event '"+t.event+"' was rejected in beforeSend function";return O3(t.event)?Oe.warn(l+". This can cause unexpected behavior."):Oe.info(l),null}c.properties&&!Vr(c.properties)||Oe.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}for(var u of r)if(c.properties&&ft(c.properties[u]))return Oe.warn("Event '"+t.event+"' had its '"+u+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return c}getPageViewId(){var t;return(t=this.pageViewManager.ir)==null?void 0:t.pageViewId}captureTraceFeedback(t,n){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:n})}captureTraceMetric(t,n,r){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:n,$ai_metric_value:String(r)})}pn(t){var n=wi(t)&&!t,r=is.N()&&is.q("ph_debug")==="true";return!n&&(!!r||t)}}ci.__defaultExtensionClasses={},ci.Bn=(()=>{var e=()=>{};return{trace:e,debug:e,info:e,warn:e,error:e,fatal:e}})(),(function(e,t){for(var n=0;t.length>n;n++)e.prototype[t[n]]=C4(e.prototype[t[n]])})(ci,["identify"]);class uS{constructor(t){this.disabled=t===!1;var n=ps(t)?t:{};this.thresholdPx=n.threshold_px||30,this.timeoutMs=n.timeout_ms||1e3,this.clickCount=n.click_count||3,this.clicks=[]}isRageClick(t,n,r){if(this.disabled)return!1;var o=this.clicks[this.clicks.length-1];if(o&&Math.abs(t-o.x)+Math.abs(n-o.y)<this.thresholdPx&&this.timeoutMs>r-o.timestamp){if(this.clicks.push({x:t,y:n,timestamp:r}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:n,timestamp:r}];return!1}}var Ym="$copy_autocapture",Xm=vs("[AutoCapture]");function Jm(e,t){return t.length>e?t.slice(0,e)+"...":t}function RM(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!Xr(t));return t}function AM(e,t){var n,r,o=t.e,c=t.maskAllElementAttributes,h=t.maskAllText,l=t.elementAttributeIgnoreList,u=t.elementsChainAsString,m=t.disableCaptureUrlHashes;if(!Xr(e))return{props:{}};for(var g=[e],p=new Set([e]),S=e;S.parentNode&&!Wn(S,"body")&&bE>g.length;)if(yE(S.parentNode)){var x=S.parentNode.host;if(p.has(x))break;p.add(x),g.push(x),S=x}else{if(!Xr(S.parentNode)||p.has(S.parentNode))break;p.add(S.parentNode),g.push(S.parentNode),S=S.parentNode}var A,E,y=[],b={},v=!1,_=!1;if(ts(g,(j=>{var M=nv(j);if(Wn(j,"a")){var D=j.getAttribute("href");v=!!(M&&D&&Ec(D))&&(m?Yr(D):D)}lt(Uh(j),"ph-no-capture")&&(_=!0),y.push((function(q,F,Y,Q,G){G===void 0&&(G=!1);var ee=q.tagName.toLowerCase(),ne={tag_name:ee};Xv.indexOf(ee)>-1&&!Y&&(ne.$el_text=ee.toLowerCase()==="a"||ee.toLowerCase()==="button"?Jm(1024,V1(q)):Jm(1024,Oc(q)));var z=Uh(q);z.length>0&&(ne.classes=z.filter((function(U){return U!==""}))),ts(q.attributes,(function(U){var P;if((!EE(q)||["name","id","class","aria-label"].indexOf(U.name)!==-1)&&(Q==null||!Q.includes(U.name))&&!F&&Ec(U.value)&&(!es(P=U.name)||P.substring(0,10)!=="_ngcontent"&&P.substring(0,7)!=="_nghost")){var W=U.value;U.name==="class"&&(W=Yv(W).join(" ")),ne["attr__"+U.name]=Jm(1024,U.name==="href"&&G?Yr(W):W)}}));for(var B=1,$=1,H=q;H=RM(H);)B++,H.tagName===q.tagName&&$++;return ne.nth_child=B,ne.nth_of_type=$,ne})(j,c,h,l,m));var L=(function(q){if(!nv(q))return{};var F={};return ts(q.attributes,(function(Y){if(Y.name&&Y.name.indexOf("data-ph-capture-attribute")===0){var Q=Y.name.replace("data-ph-capture-attribute-",""),G=Y.value;Q&&G&&Ec(G)&&(F[Q]=G)}})),F})(j);rs(b,L)})),_)return{props:{},explicitNoCapture:_};if(h||(y[0].$el_text=Wn(e,"a")||Wn(e,"button")?V1(e):Oc(e)),v){var k,C;y[0].attr__href=v;var w=(k=Fh(v))==null?void 0:k.host,T=_e==null||(C=_e.location)==null?void 0:C.host;w&&T&&w!==T&&(A=v)}return{props:rs({$event_type:o.type,$ce_version:1},u?{}:{$elements:y},{$elements_chain:(E=y,(function(j){return j.map((M=>{var D,L,q="";if(M.tag_name&&(q+=M.tag_name),M.attr_class)for(var F of(M.attr_class.sort(),M.attr_class))q+="."+F.replace(/"/g,"");var Y=Te({},M.text?{text:M.text}:{},{"nth-child":(D=M.nth_child)!==null&&D!==void 0?D:0,"nth-of-type":(L=M.nth_of_type)!==null&&L!==void 0?L:0},M.href?{href:M.href}:{},M.attr_id?{attr_id:M.attr_id}:{},M.attributes),Q={};return _h(Y).sort(((G,ee)=>G[0].localeCompare(ee[0]))).forEach((G=>{var ee=G[1];return Q[G1(G[0].toString())]=G1(ee.toString())})),(q+=":")+_h(Q).map((G=>G[0]+'="'+G[1]+'"')).join("")})).join(";")})((function(j){return j.map((M=>{var D,L,q={text:(D=M.$el_text)==null?void 0:D.slice(0,400),tag_name:M.tag_name,href:(L=M.attr__href)==null?void 0:L.slice(0,2048),attr_class:F4(M),attr_id:M.attr__id,nth_child:M.nth_child,nth_of_type:M.nth_of_type,attributes:{}};return _h(M).filter((F=>F[0].indexOf("attr__")===0)).forEach((F=>q.attributes[F[0]]=F[1])),q}))})(E)))},(n=y[0])!=null&&n.$el_text?{$el_text:(r=y[0])==null?void 0:r.$el_text}:{},A&&o.type==="click"?{$external_click_url:A}:{},b)}}var oc=vs("[ExceptionAutocapture]"),dS=()=>{},TM=vs("[TracingHeaders]"),Sa=vs("[Web Vitals]"),hS=9e5,fS="disabled",pS="lazy_loading",lc="awaiting_config",nd="missing_config";vs("[SessionRecording]"),vs("[SessionRecording]");var dv="[SessionRecording]",tr=vs(dv),NM=vs("[Heatmaps]");function Zm(e){return ps(e)&&"clientX"in e&&"clientY"in e&&on(e.clientX)&&on(e.clientY)}var Qm=vs("[Product Tours]"),eg=e=>{var t;return!e.config.disable_product_tours&&!((t=e.persistence)==null||!t.get_property(Vv))},MM=["$set_once","$set"],$i=vs("[SiteApps]"),mS="Error while initializing PostHog app with config id ";function Mo(e,t,n){if(ft(e))return!1;switch(n){case"exact":return e===t;case"contains":var r=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch{return!1}default:return!1}}class $M{constructor(t){this.Hn=new e_,this.Un=(n,r)=>this.zn(n,r)&&this.Vn(n,r)&&this.Wn(n,r)&&this.Zn(n,r),this.zn=(n,r)=>r==null||!r.event||(n==null?void 0:n.event)===(r==null?void 0:r.event),this._instance=t,this.Gn=new Set,this.Qn=new Set}init(){var t,n;De((t=this._instance)==null?void 0:t._addCaptureHook)||(n=this._instance)==null||n._addCaptureHook(((r,o)=>{this.on(r,o)}))}register(t){var n,r;if(!De((n=this._instance)==null?void 0:n._addCaptureHook)&&(t.forEach((h=>{var l,u;(l=this.Qn)==null||l.add(h),(u=h.steps)==null||u.forEach((m=>{var g;(g=this.Gn)==null||g.add((m==null?void 0:m.event)||"")}))})),(r=this._instance)!=null&&r.autocapture)){var o,c=new Set;t.forEach((h=>{var l;(l=h.steps)==null||l.forEach((u=>{u!=null&&u.selector&&c.add(u==null?void 0:u.selector)}))})),(o=this._instance)==null||o.autocapture.setElementSelectors(c)}}on(t,n){var r;n!=null&&t.length!=0&&(this.Gn.has(t)||this.Gn.has(n.event))&&this.Qn&&((r=this.Qn)==null?void 0:r.size)>0&&this.Qn.forEach((o=>{this.Jn(n,o)&&this.Hn.emit("actionCaptured",o.name)}))}Kn(t){this.onAction("actionCaptured",(n=>t(n)))}Jn(t,n){if((n==null?void 0:n.steps)==null)return!1;for(var r of n.steps)if(this.Un(t,r))return!0;return!1}onAction(t,n){return this.Hn.on(t,n)}Vn(t,n){if(n!=null&&n.url){var r,o=t==null||(r=t.properties)==null?void 0:r.$current_url;if(!o||typeof o!="string"||!Mo(o,n.url,n.url_matching||"contains"))return!1}return!0}Wn(t,n){return!!this.Yn(t,n)&&!!this.Xn(t,n)&&!!this.ts(t,n)}Yn(t,n){var r;if(n==null||!n.href)return!0;var o=this.es(t);if(o.length>0)return o.some((l=>Mo(l.href,n.href,n.href_matching||"exact")));var c,h=(t==null||(r=t.properties)==null?void 0:r.$elements_chain)||"";return!!h&&Mo((c=h.match(/(?::|")href="(.*?)"/))?c[1]:"",n.href,n.href_matching||"exact")}Xn(t,n){var r;if(n==null||!n.text)return!0;var o=this.es(t);if(o.length>0)return o.some((m=>Mo(m.text,n.text,n.text_matching||"exact")||Mo(m.$el_text,n.text,n.text_matching||"exact")));var c,h,l,u=(t==null||(r=t.properties)==null?void 0:r.$elements_chain)||"";return!!u&&(c=(function(m){for(var g,p=[],S=/(?::|")text="(.*?)"/g;!ft(g=S.exec(m));)p.includes(g[1])||p.push(g[1]);return p})(u),h=n.text,l=n.text_matching||"exact",c.some((m=>Mo(m,h,l))))}ts(t,n){var r,o;if(n==null||!n.selector)return!0;var c=t==null||(r=t.properties)==null?void 0:r.$element_selectors;if(c!=null&&c.includes(n.selector))return!0;var h=(t==null||(o=t.properties)==null?void 0:o.$elements_chain)||"";if(n.selector_regex&&h)try{return new RegExp(n.selector_regex).test(h)}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||ZE(n.properties.reduce(((r,o)=>{var c=dt(o.value)?o.value.map(String):o.value!=null?[String(o.value)]:[];return r[o.key]={values:c,operator:o.operator||"exact"},r}),{}),t==null?void 0:t.properties)}}class DM{constructor(t){var n;this.rs=[],this._instance=t,this.ns=new Map,this.ss=new Map,this.os=new Map,(n=this._instance)==null||n.onSessionId==null||n.onSessionId((r=>this.ls(r)))}us(t,n){return!!t&&ZE(t.propertyFilters,n==null?void 0:n.properties)}hs(t,n){var r=new Map;return t.forEach((o=>{var c;(c=o.conditions)==null||(c=c[n])==null||(c=c.values)==null||c.forEach((h=>{if(h!=null&&h.name){var l=r.get(h.name)||[];l.push(o.id),r.set(h.name,l)}}))})),r}ds(t,n,r){var o=(r===sc.Activation?this.ns:this.ss).get(t),c=[];return this.cs((h=>{c=h.filter((l=>o==null?void 0:o.includes(l.id)))})),c.filter((h=>{var l,u=(l=h.conditions)==null||(l=l[r])==null||(l=l.values)==null?void 0:l.find((m=>m.name===t));return this.us(u,n)}))}register(t){var n;De((n=this._instance)==null?void 0:n._addCaptureHook)||(this.vs(t),this.fs(t))}fs(t){var n=t.filter((r=>{var o,c;return((o=r.conditions)==null?void 0:o.actions)&&((c=r.conditions)==null||(c=c.actions)==null||(c=c.values)==null?void 0:c.length)>0}));n.length!==0&&(this.ps==null&&(this.ps=new $M(this._instance),this.ps.init(),this.ps.Kn((r=>{this.onAction(r)}))),n.forEach((r=>{var o,c,h,l,u;r.conditions&&(o=r.conditions)!=null&&o.actions&&(c=r.conditions)!=null&&(c=c.actions)!=null&&c.values&&((h=r.conditions)==null||(h=h.actions)==null||(h=h.values)==null?void 0:h.length)>0&&((l=this.ps)==null||l.register(r.conditions.actions.values),(u=r.conditions)==null||(u=u.actions)==null||(u=u.values)==null||u.forEach((m=>{if(m&&m.name){var g=this.os.get(m.name);g&&g.push(r.id),this.os.set(m.name,g||[r.id])}})))})))}vs(t){var n,r=t.filter((c=>{var h,l;return((h=c.conditions)==null?void 0:h.events)&&((l=c.conditions)==null||(l=l.events)==null||(l=l.values)==null?void 0:l.length)>0})),o=t.filter((c=>{var h,l;return((h=c.conditions)==null?void 0:h.cancelEvents)&&((l=c.conditions)==null||(l=l.cancelEvents)==null||(l=l.values)==null?void 0:l.length)>0}));r.length===0&&o.length===0||((n=this._instance)==null||n._addCaptureHook(((c,h)=>{this.onEvent(c,h)})),this.ns=this.hs(t,sc.Activation),this.ss=this.hs(t,sc.Cancellation))}onEvent(t,n){var r,o,c=this.gs(),h=(n==null||(r=n.properties)==null?void 0:r.$survey_id)||(n==null||(o=n.properties)==null?void 0:o.$product_tour_id);if(h&&this.getActivatedIds().includes(h)){var l=this.ys(t,h);if(l==="consume")return c.info("event consumed activated item, removing it",{event:t,itemId:h}),void this.bs([h]);if(l==="persist")return c.info("shown item promoted to persisted activation",{event:t,itemId:h}),void this._s(h)}if(this.ss.has(t)){var u=this.ds(t,n,sc.Cancellation);u.length>0&&(c.info("cancel event matched, cancelling items",{event:t,itemsToCancel:u.map((g=>g.id))}),this.bs(u.map((g=>g.id))),u.forEach((g=>this.ws(g.id))))}if(this.ns.has(t)){c.info("event name matched",{event:t,eventPayload:n,items:this.ns.get(t)});var m=this.ds(t,n,sc.Activation);this.xs(m.map((g=>g.id)))}}onAction(t){this.os.has(t)&&this.xs(this.os.get(t)||[])}xs(t){t.length!==0&&(this.rs=[...new Set([...this.rs,...t])],this.gs().info("updating activated items",{activatedItems:this.getActivatedIds()}))}_s(t){this.rs=this.rs.filter((r=>r!==t));var n=this.ks();n.includes(t)||(this.Ss([...n,t]),this.Cs())}bs(t){var n=new Set(t);this.rs=this.rs.filter((c=>!n.has(c)));var r=this.Ms(),o=r.filter((c=>!n.has(c)));o.length!==r.length&&(this.Ss(o),o.length===0&&this.Is())}Ms(){var t,n=this.Ts();return((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[n])||[]}ks(){var t,n,r=this.Ms();if(r.length===0)return[];var o=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[this.Es()],c=(n=this._instance)==null||n.get_session_id==null?void 0:n.get_session_id();return c&&o===c?r:[]}Cs(){var t,n=(t=this._instance)==null||t.get_session_id==null?void 0:t.get_session_id();n&&this.Rs(n)}Is(){this.Ps()}ls(t){var n,r=(n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[this.Es()];r&&r!==t&&(this.Ms().length>0&&this.Ss([]),this.Is())}getActivatedIds(){return[...new Set([...this.ks(),...this.rs])].filter((t=>!this.Os(t)))}reset(){this.rs=[],this.Ms().length>0&&this.Ss([]),this.Is()}getEventToItemsMap(){return this.ns}Fs(){return this.ps}}class OM extends DM{constructor(t){super(t)}Ts(){return Kg}Es(){return vh}As(){return dr.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 Wt}Ss(t){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[Kg]:t})}Rs(t){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[vh]:t})}Ps(){var t;(t=this._instance)==null||(t=t.persistence)==null||t.unregister(vh)}Os(){return!1}ys(t,n){var r;this.cs((c=>{r=c.find((h=>h.id===n))}));var o=!r||(function(c){var h;return QE(c)&&!((h=c.conditions)==null||(h=h.events)==null||!h.repeatedActivation)||c.schedule==="always"})(r);return o?t===dr.SHOWN?"consume":"ignore":t===dr.SHOWN?"persist":t===dr.DISMISSED||t===dr.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var id="SDK is not enabled or survey functionality is not yet loaded",gS="Disabled. Not loading surveys.",LM=_e!=null&&_e.location?qh(_e.location.hash,"__posthog")||qh(location.hash,"state"):null,vS="_postHogToolbarParams",_S=vs("[Toolbar]"),Hs=vs("[FeatureFlags]"),wa=vs("[FeatureFlags]",{debugEnabled:!0}),tg=`" failed. Feature flags didn't load in time.`,yS=e=>{for(var t={},n=0;e.length>n;n++)t[e[n]]=!0;return t},bS=e=>{var t={};for(var n of _h(e||{})){var r=n[1];r&&(t[n[0]]=r)}return t},Di=vs("[Error tracking]"),SS="Refusing to render web experiment since the viewer is a likely bot",IM={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>Wh(t,e),not_regex:(e,t)=>!Wh(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e};class pn{get Te(){return this._instance.config}constructor(t){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(r){r===void 0&&(r=!1),n.getWebExperiments((o=>{pn.$s("retrieved web experiments from the server"),n.Ls=new Map,o.forEach((c=>{if(c.feature_flag_key){var h;n.Ls&&(pn.$s("setting flag key ",c.feature_flag_key," to web experiment ",c),(h=n.Ls)==null||h.set(c.feature_flag_key,c));var l=n._instance.getFeatureFlag(c.feature_flag_key);es(l)&&c.variants[l]&&n.Ds(c.name,l,c.variants[l].transforms)}else if(c.variants)for(var u in c.variants){var m=c.variants[u];pn.Ns(m,n._instance)&&n.Ds(c.name,u,m.transforms)}}))}),r)},this._instance=t,this._instance.onFeatureFlags((r=>{this.onFeatureFlags(r)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())pn.$s(SS);else if(!this.Te.disable_web_experiments){if(ft(this.Ls))return this.Ls=new Map,this.loadIfEnabled(),void this.previewWebExperiment();pn.$s("applying feature flags",t),t.forEach((n=>{var r;if(this.Ls&&(r=this.Ls)!=null&&r.has(n)){var o,c=this._instance.getFeatureFlag(n),h=(o=this.Ls)==null?void 0:o.get(n);c&&h!=null&&h.variants[c]&&this.Ds(h.name,c,h.variants[c].transforms)}}))}}previewWebExperiment(){var t=pn.getWindowLocation();if(t!=null&&t.search){var n=tl(t==null?void 0:t.search,"__experiment_id"),r=tl(t==null?void 0:t.search,"__experiment_variant");n&&r&&(pn.$s("previewing web experiments "+n+" && "+r),this.getWebExperiments((o=>{this.qs(parseInt(n),r,o)}),!1,!0))}}loadIfEnabled(){this.Te.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,n,r){if(this.Te.disable_web_experiments&&!r)return t([]);var o=this._instance.get_property("$web_experiments");if(o&&!n)return t(o);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Te.token),method:"GET",timestampMode:"query",callback:c=>t(c.statusCode===200&&c.json&&c.json.experiments||[])})}qs(t,n,r){var o=r.filter((c=>c.id===t));o&&o.length>0&&(pn.$s("Previewing web experiment ["+o[0].name+"] with variant ["+n+"]"),this.Ds(o[0].name,n,o[0].variants[n].transforms))}static Ns(t,n){return!ft(t.conditions)&&pn.js(t,n)&&pn.Bs(t)}static js(t,n){var r;if(ft(t.conditions)||ft((r=t.conditions)==null?void 0:r.url))return!0;var o=pn.getWindowLocation();if(o){var c,h,l,u=gE(n,o.href);return(c=t.conditions)==null||!c.url||IM[(h=(l=t.conditions)==null?void 0:l.urlMatchType)!==null&&h!==void 0?h:"icontains"](t.conditions.url,u)}return!1}static getWindowLocation(){return _e==null?void 0:_e.location}static Bs(t){var n;if(ft(t.conditions)||ft((n=t.conditions)==null?void 0:n.utm))return!0;var r=NE();if(r.utm_source){var o,c,h,l,u,m,g,p,S=(o=t.conditions)==null||(o=o.utm)==null||!o.utm_campaign||((c=t.conditions)==null||(c=c.utm)==null?void 0:c.utm_campaign)==r.utm_campaign,x=(h=t.conditions)==null||(h=h.utm)==null||!h.utm_source||((l=t.conditions)==null||(l=l.utm)==null?void 0:l.utm_source)==r.utm_source,A=(u=t.conditions)==null||(u=u.utm)==null||!u.utm_medium||((m=t.conditions)==null||(m=m.utm)==null?void 0:m.utm_medium)==r.utm_medium,E=(g=t.conditions)==null||(g=g.utm)==null||!g.utm_term||((p=t.conditions)==null||(p=p.utm)==null?void 0:p.utm_term)==r.utm_term;return S&&A&&E&&x}return!1}static $s(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;n>o;o++)r[o-1]=arguments[o];Oe.info("[WebExperiments] "+t,r)}Ds(t,n,r){this._is_bot()?pn.$s(SS):n!=="control"?r.forEach((o=>{if(o.selector){var c;pn.$s("applying transform of variant "+n+" for experiment "+t+" ",o);var h=(c=document)==null?void 0:c.querySelectorAll(o.selector);h==null||h.forEach((l=>{var u=l;o.html&&(u.innerHTML=o.html),o.css&&u.setAttribute("style",o.css)}))}})):pn.$s("Control variants leave the page unmodified.")}_is_bot(){return kn&&this._instance?YE(kn,this.Te.custom_blocked_useragents):void 0}}var ri=vs("[Conversations]"),xa="Conversations not available yet.",wS="console",df={featureFlags:class{constructor(e){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=e,this.featureFlagEventHandlers=[],_e&&ws(_e,"online",this.Ks)}destroy(){_e==null||_e.removeEventListener("online",this.Ks)}get Te(){return this._instance.config}get mi(){return this._instance.persistence}Xs(e){return this._instance.get_property(e)}eo(){var e,t;return(e=(t=this.mi)==null?void 0:t._r(this.Te.feature_flag_cache_ttl_ms))!==null&&e!==void 0&&e}ro(){return!!this.eo()&&(this.Qs||this.zs||(this.Qs=!0,Hs.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}io(){var e,t=(e=this.Te.evaluation_contexts)!==null&&e!==void 0?e:this.Te.evaluation_environments;return!this.Te.evaluation_environments||this.Te.evaluation_contexts||this.Gs||(Hs.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Gs=!0),t!=null&&t.length?t.filter((n=>{var r=n&&typeof n=="string"&&n.trim().length>0;return r||Hs.error("Invalid evaluation context found:",n,"Expected non-empty string"),r})):[]}no(){return this.io().length>0}so(){var e=this.Te.flag_keys;if(!De(e)){if(dt(e))return e.filter((t=>{var n=t&&typeof t=="string"&&t.trim().length>0;return n||Hs.error("Invalid flag key found:",t,"Expected non-empty string"),n}));Hs.error("Invalid flag_keys found:",e,"Expected array of non-empty strings")}}initialize(){var e,t,n=this._instance.config,r=(e=(t=n.bootstrap)==null?void 0:t.featureFlags)!==null&&e!==void 0?e:{};if(Object.keys(r).length){var o,c,h=(o=(c=n.bootstrap)==null?void 0:c.featureFlagPayloads)!==null&&o!==void 0?o:{},l=Object.keys(r).filter((m=>!!r[m])).reduce(((m,g)=>(m[g]=r[g]||!1,m)),{}),u=Object.keys(h).filter((m=>l[m])).reduce(((m,g)=>(h[g]&&(m[g]=h[g]),m)),{});this.receivedFeatureFlags({featureFlags:l,featureFlagPayloads:u})}}updateFlags(e,t,n){var r,o,c=n!=null&&n.merge&&(r=this.Xs(Ma))!==null&&r!==void 0?r:{},h=n!=null&&n.merge&&(o=this.Xs(gh))!==null&&o!==void 0?o:{},l=Te({},c,e),u=Te({},h,t),m={};for(var g of Object.entries(l)){var p=g[0],S=g[1];m[p]={key:p,enabled:y1(S),variant:b1(S),reason:void 0,metadata:De(u==null?void 0:u[p])?void 0:{id:0,version:void 0,description:void 0,payload:u[p]}}}this.receivedFeatureFlags({flags:m})}get hasLoadedFlags(){return this.Us}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this.Xs(Vg),t=this.Xs(ar),n=this.Xs(Po);if(!n&&!t)return e||{};var r=rs({},e||{}),o=[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])];for(var c of o){var h,l,u=r[c],m=t==null?void 0:t[c],g=De(m)?(h=u==null?void 0:u.enabled)!==null&&h!==void 0&&h:!!m,p=De(m)?u.variant:typeof m=="string"?m:void 0,S=n==null?void 0:n[c],x=Te({},u,{enabled:g,variant:g?p??(u==null?void 0:u.variant):void 0});g!==(u==null?void 0:u.enabled)&&(x.original_enabled=u==null?void 0:u.enabled),p!==(u==null?void 0:u.variant)&&(x.original_variant=u==null?void 0:u.variant),S&&(x.metadata=Te({},u==null?void 0:u.metadata,{payload:S,original_payload:u==null||(l=u.metadata)==null?void 0:l.payload})),r[c]=x}return this.Hs||(Hs.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:r}),this.Hs=!0),r}getAllFeatureFlags(){var e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map((n=>{var r=e[n];return{key:n,enabled:y1(r),variant:b1(r),payload:_1(t[n])}}))}getFlagVariants(){var e=this.Xs(Ma),t=this.Xs(ar);if(!t)return e||{};for(var n=rs({},e),r=Object.keys(t),o=0;r.length>o;o++)n[r[o]]=t[r[o]];return this.Hs||(Hs.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.Hs=!0),n}getFlagPayloads(){var e=this.Xs(gh),t=this.Xs(Po);if(!t)return e||{};for(var n=rs({},e||{}),r=Object.keys(t),o=0;r.length>o;o++)n[r[o]]=t[r[o]];return this.Hs||(Hs.warn(" Overriding feature flag payloads!",{flagPayloads:e,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(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.Vs=e}ao(e){var t;if(this.lo(),!this._instance.Ur()&&!this.Ys())if(this.zs)this.Ws=!0;else{var n=this.Te.token,r=this.Xs($c),o={token:n,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:Te({},((t=this.mi)==null?void 0:t.get_initial_props())||{},this.Xs(Ra)||{},{$lib:Ft.LIB_NAME,$lib_version:Ft.LIB_VERSION}),group_properties:this.Xs(Aa),timezone:IE()};Rn(r)||De(r)||(o.$device_id=r),(e!=null&&e.disableFlags||this.Te.advanced_disable_feature_flags)&&(o.disable_flags=!0),this.no()&&(o.evaluation_contexts=this.io());var c=this.so();De(c)||(o.flag_keys=c);var h=!!this.Te.advanced_only_evaluate_survey_feature_flags,l=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:l,data:o,compression:this.Te.disable_compression?void 0:Cn.Base64,timestampMode:"body",timeout:this.Te.feature_flag_request_timeout_ms,callback:u=>{var m,g,p,S=!0;if(this.uo(u.statusCode),u.statusCode===200&&(this.Ws||(this.$anon_distinct_id=void 0),S=!1),this.zs=!1,!o.disable_flags||this.Ws){this.Zs=!S;var x=[];u.error?u.error instanceof Error?x.push(u.error.name==="AbortError"?"timeout":"connection_error"):x.push("unknown_error"):u.statusCode!==200&&x.push("api_error_"+u.statusCode),(m=u.json)!=null&&m.errorsWhileComputingFlags&&x.push("errors_while_computing_flags");var A,E=!((g=u.json)==null||(g=g.quotaLimited)==null||!g.includes("feature_flags"));E&&x.push("quota_limited"),(p=this.mi)==null||p.register({[Xg]:x}),E?Hs.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."):(o.disable_flags||this.receivedFeatureFlags((A=u.json)!==null&&A!==void 0?A:{},S,{partialResponse:h}),this.Ws&&(this.Ws=!1,this.ao()))}}})}}Ys(){return AE(this.Js,3)}uo(e){this.Js=TE(e,this.Js,3,(()=>Hs.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes.")))}getFeatureFlag(e,t){var n;if(t===void 0&&(t={}),!t.fresh||this.Zs)if(this.Us||this.getFlags()&&this.getFlags().length>0){if(!this.ro()){var r=this.getFeatureFlagResult(e,t);return(n=r==null?void 0:r.variant)!==null&&n!==void 0?n:r==null?void 0:r.enabled}}else Hs.warn('getFeatureFlag for key "'+e+tg)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return t==null?void 0:t.payload}getFeatureFlagResult(e,t){if(t===void 0&&(t={}),!t.fresh||this.Zs)if(this.Us||this.getFlags()&&this.getFlags().length>0){if(!this.ro()){var n=this.getFlagVariants(),r=e in n,o=n[e],c=this.getFlagPayloads()[e],h=String(o),l=this.Xs(Gg)||void 0,u=this.Xs(Dc)||void 0,m=this.Xs(Cc)||{};if(this.Te.advanced_feature_flags_dedup_per_session){var g,p=this._instance.get_session_id(),S=this.Xs(Yg);p&&p!==S&&(m={},(g=this.mi)==null||g.register({[Cc]:m,[Yg]:p}))}if((t.send_event||!("send_event"in t))&&(!(e in m)||!m[e].includes(h))){var x,A,E,y,b,v,_,k,C,w,T;dt(m[e])?m[e].push(h):m[e]=[h],(x=this.mi)==null||x.register({[Cc]:m});var j=this.getFeatureFlagDetails(e),M=[...(A=this.Xs(Xg))!==null&&A!==void 0?A:[]];De(o)&&M.push("flag_missing");var D={$feature_flag:e,$feature_flag_response:o,$feature_flag_payload:c||null,$feature_flag_request_id:l,$feature_flag_evaluated_at:u,$feature_flag_bootstrapped_response:((E=this.Te.bootstrap)==null||(E=E.featureFlags)==null?void 0:E[e])||null,$feature_flag_bootstrapped_payload:((y=this.Te.bootstrap)==null||(y=y.featureFlagPayloads)==null?void 0:y[e])||null,$used_bootstrap_value:!this.Zs};De(j==null||(b=j.metadata)==null?void 0:b.has_experiment)||(D.$feature_flag_has_experiment=j.metadata.has_experiment),De(j==null||(v=j.metadata)==null?void 0:v.version)||(D.$feature_flag_version=j.metadata.version);var L,q=(_=j==null||(k=j.reason)==null?void 0:k.description)!==null&&_!==void 0?_:j==null||(C=j.reason)==null?void 0:C.code;q&&(D.$feature_flag_reason=q),j!=null&&(w=j.metadata)!=null&&w.id&&(D.$feature_flag_id=j.metadata.id),De(j==null?void 0:j.original_variant)&&De(j==null?void 0:j.original_enabled)||(D.$feature_flag_original_response=De(j.original_variant)?j.original_enabled:j.original_variant),j!=null&&(T=j.metadata)!=null&&T.original_payload&&(D.$feature_flag_original_payload=j==null||(L=j.metadata)==null?void 0:L.original_payload),M.length&&(D.$feature_flag_error=M.join(",")),this._instance.capture("$feature_flag_called",D)}if(r)return{key:e,enabled:!!o,variant:typeof o=="string"?o:void 0,payload:_1(c)}}}else Hs.warn('getFeatureFlagResult for key "'+e+tg)}getRemoteConfigPayload(e,t){var n=this.Te.token,r={distinct_id:this._instance.get_distinct_id(),token:n,person_properties:{$lib:Ft.LIB_NAME,$lib_version:Ft.LIB_VERSION}};this.no()&&(r.evaluation_contexts=this.io());var o=this.so();De(o)||(r.flag_keys=o),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:r,compression:this.Te.disable_compression?void 0:Cn.Base64,timestampMode:"body",timeout:this.Te.feature_flag_request_timeout_ms,callback(c){var h,l=(h=c.json)==null?void 0:h.featureFlagPayloads;t((l==null?void 0:l[e])||void 0)}})}isFeatureEnabled(e,t){if(t===void 0&&(t={}),t.fresh&&!this.Zs)return t.defaultValue;if(!(this.Us||this.getFlags()&&this.getFlags().length>0))return Hs.warn('isFeatureEnabled for key "'+e+tg),t.defaultValue;var n=this.getFeatureFlag(e,t);return De(n)?t.defaultValue:!!n}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t,n){if(this.mi){this.Us=!0;var r=this.getFlagVariants(),o=this.getFlagPayloads(),c=this.getFlagsWithDetails();(function(h,l,u,m,g,p){u===void 0&&(u={}),m===void 0&&(m={}),g===void 0&&(g={});var S=(j=>{var M=j.flags;return M?(j.featureFlags=Object.fromEntries(Object.keys(M).map((D=>{var L;return[D,(L=M[D].variant)!==null&&L!==void 0?L:M[D].enabled]}))),j.featureFlagPayloads=Object.fromEntries(Object.keys(M).filter((D=>M[D].enabled)).filter((D=>{var L;return(L=M[D].metadata)==null?void 0:L.payload})).map((D=>{var L;return[D,(L=M[D].metadata)==null?void 0:L.payload]})))):j.featureFlags&&Hs.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),j})(h),x=S.flags,A=S.featureFlags,E=S.featureFlagPayloads;if(A){var y=h.requestId,b=h.evaluatedAt;if(dt(A)){Hs.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var v={};if(A)for(var _=0;A.length>_;_++)v[A[_]]=!0;l&&l.register({[mh]:A,[Ma]:v,[Oh]:!1})}else{var k=A,C=E,w=x;if(p!=null&&p.partialResponse)k=Te({},u,k),C=Te({},m,C),w=Te({},g,w);else if(h.errorsWhileComputingFlags)if(x){var T=new Set(Object.keys(x).filter((j=>{var M;return!((M=x[j])!=null&&M.failed)})));k=Te({},u,Object.fromEntries(Object.entries(k).filter((j=>T.has(j[0]))))),C=Te({},m,Object.fromEntries(Object.entries(C||{}).filter((j=>T.has(j[0]))))),w=Te({},g,Object.fromEntries(Object.entries(w||{}).filter((j=>T.has(j[0])))))}else k=Te({},u,k),C=Te({},m,C),w=Te({},g,w);l&&l.register(Te({[mh]:Object.keys(bS(k)),[Ma]:k||{},[gh]:C||{},[Vg]:w||{},[Oh]:h.minimalFlagCalledEvents===!0},y?{[Gg]:y}:{},b?{[Dc]:b}:{}))}}})(e,this.mi,r,o,c,n),t||(this.Qs=!1),this.ho(t)}}override(e,t){t===void 0&&(t=!1),Hs.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this.mi)return Hs.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this.mi.unregister(ar),this.mi.unregister(Po),this.ho(),wa.info("All overrides cleared");if(dt(e)){var t=yS(e);return this.mi.register({[ar]:t}),this.ho(),wa.info("Flag overrides set",{flags:e})}if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var n,r=e;if(this.Hs=!!((n=r.suppressWarning)!==null&&n!==void 0&&n),"flags"in r){if(r.flags===!1)this.mi.unregister(ar),wa.info("Flag overrides cleared");else if(r.flags){if(dt(r.flags)){var o=yS(r.flags);this.mi.register({[ar]:o})}else this.mi.register({[ar]:r.flags});wa.info("Flag overrides set",{flags:r.flags})}}return"payloads"in r&&(r.payloads===!1?(this.mi.unregister(Po),wa.info("Payload overrides cleared")):r.payloads&&(this.mi.register({[Po]:r.payloads}),wa.info("Payload overrides set",{payloads:r.payloads}))),void this.ho()}if(e&&typeof e=="object")return this.mi.register({[ar]:e}),this.ho(),wa.info("Flag overrides set",{flags:e});Hs.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.Us){var t=this.do(),n=t.flags,r=t.flagVariants;try{e(n,r)}catch(o){Hs.error("Error while running feature flags callback",o)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,n){var r,o=(this.Xs(vc)||[]).find((u=>u.flagKey===e)),c={["$feature_enrollment/"+e]:t},h={$feature_flag:e,$feature_enrollment:t,$set:c};o&&(h.$early_access_feature_name=o.name),n&&(h.$feature_enrollment_stage=n),this._instance.capture("$feature_enrollment_update",h),this.setPersonPropertiesForFlags(c,!1);var l=Te({},this.getFlagVariants(),{[e]:t});(r=this.mi)==null||r.register({[mh]:Object.keys(bS(l)),[Ma]:l}),this.ho()}getEarlyAccessFeatures(e,t,n){t===void 0&&(t=!1);var r=this.Xs(vc),o=n?"&"+n.map((c=>"stage="+c)).join("&"):"";if(r&&!t)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Te.token+o),method:"GET",timestampMode:"query",callback:c=>{var h,l;if(c.json){var u=c.json.earlyAccessFeatures;return(h=this.mi)==null||h.unregister(vc),(l=this.mi)==null||l.register({[vc]:u}),e(u)}}})}do(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((n=>t[n])),flagVariants:Object.keys(t).filter((n=>t[n])).reduce(((n,r)=>(n[r]=t[r],n)),{})}}ho(e){var t=this.do(),n=t.flags,r=t.flagVariants;this.featureFlagEventHandlers.forEach((o=>{try{o(n,r,{errorsLoading:e})}catch(c){Hs.error("Error while running feature flags callback",c)}}))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this.Xs(Ra)||{},r=(e==null?void 0:e.$set)||(e!=null&&e.$set_once?{}:e),o=e==null?void 0:e.$set_once,c={};if(o)for(var h in o)({}).hasOwnProperty.call(o,h)&&(h in n||(c[h]=o[h]));this._instance.register({[Ra]:Te({},n,c,r)}),t&&this._instance.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=Te({},this.Xs(Ra)||{});e.forEach((r=>{delete n[r]})),this._instance.register({[Ra]:n}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(e){e===void 0&&(e=!0),this._instance.unregister(Ra),e&&this._instance.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this.Xs(Aa)||{};Object.keys(n).length!==0&&Object.keys(n).forEach((r=>{n[r]=Te({},n[r],e[r]),delete e[r]})),this._instance.register({[Aa]:Te({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.Xs(Aa)||{};this._instance.register({[Aa]:Te({},t,{[e]:{}})})}else this._instance.unregister(Aa)}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}}},PM={sessionRecording:class{get Te(){return this._instance.config}get mi(){return this._instance.persistence}get started(){var e;return!((e=this.co)==null||!e.isStarted)}get status(){var e,t;return this.vo===lc||this.vo===nd?this.vo:(e=(t=this.co)==null?void 0:t.status)!==null&&e!==void 0?e:this.vo}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.vo=fS,this.fo=void 0,this._instance=e,!this._instance.sessionManager)throw tr.error("started without valid sessionManager"),new Error(dv+" started without valid sessionManager. This is a bug.");if(this.Te.cookieless_mode===cr)throw new Error(dv+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get po(){var e,t=!((e=this._instance.get_property(Da))==null||!e.enabled),n=!this.Te.disable_session_recording,r=this.Te.disable_session_recording||this._instance.consent.isOptedOut();return _e&&t&&n&&!r}startIfEnabledOrStop(e){var t;if(!this.po||(t=this.co)==null||!t.isStarted){var n=!De(Object.assign)&&!De(Array.from);this.po&&n?(this.mo(e),tr.info("starting")):(this.vo=fS,this.stopRecording())}}mo(e){var t,n,r;this.po&&(this.vo!==lc&&this.vo!==nd&&(this.vo=pS),Ye!=null&&(t=Ye.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(n=Ye.__PosthogExtensions__)!=null&&n.initSessionRecording?this.yo(e):(r=Ye.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,this.bo,(o=>{if(o)return tr.error("could not load recorder",o);this.yo(e)})))}stopRecording(){var e,t;(e=this.fo)==null||e.call(this),this.fo=void 0,(t=this.co)==null||t.stop()}_o(){var e,t;(e=this.fo)==null||e.call(this),this.fo=void 0,(t=this.co)==null||t.discard()}wo(){var e,t;(e=this.mi)==null||e.unregister(Gv),(t=this.mi)==null||t.unregister(iE)}xo(e,t){if(ft(e))return null;var n,r=on(e)?e:parseFloat(e);return typeof(n=r)!="number"||!Number.isFinite(n)||0>n||n>1?(tr.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):r}ko(e){if(this.mi){var t,n,r=this.mi,o=()=>{var c,h=e.sessionRecording===!1?void 0:e.sessionRecording,l=this.xo((c=this.Te.session_recording)==null?void 0:c.sampleRate,"session_recording.sampleRate"),u=this.xo(h==null?void 0:h.sampleRate,"remote config sampleRate"),m=l??u;ft(m)&&this.wo();var g=h==null?void 0:h.minimumDurationMilliseconds;r.register({[Da]:Te({cache_timestamp:Date.now(),enabled:!!h},h,{networkPayloadCapture:Te({capturePerformance:e.capturePerformance},h==null?void 0:h.networkPayloadCapture),canvasRecording:{enabled:h==null?void 0:h.recordCanvas,fps:h==null?void 0:h.canvasFps,quality:h==null?void 0:h.canvasQuality},sampleRate:m,minimumDurationMilliseconds:De(g)?null:g,endpoint:h==null?void 0:h.endpoint,triggerMatchType:h==null?void 0:h.triggerMatchType,masking:h==null?void 0:h.masking,urlTriggers:h==null?void 0:h.urlTriggers,version:h==null?void 0:h.version,triggerGroups:h==null?void 0:h.triggerGroups})})};o(),(t=this.fo)==null||t.call(this),this.fo=(n=this._instance.sessionManager)==null?void 0:n.onSessionId(o)}}onRemoteConfig(e){var t=e.ok?e.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===lc&&(this.vo=nd,tr.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t){var n;t===void 0&&(t="log"),(n=this.co)!=null&&n.log?this.co.log(e,t):tr.warn("log called before recorder was ready")}get bo(){var e,t,n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(Da);return(n==null||(t=n.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}So(){var e,t,n=this._instance.get_property(Da);if(!n)return!1;try{t=typeof n=="object"?n:JSON.parse(n)}catch(o){return tr.warn("persisted remote config for session recording is invalid and will be ignored",o),!1}var r=(e=t.cache_timestamp)!==null&&e!==void 0?e:Date.now();return 36e5>=Date.now()-r}yo(e){var t,n;if((t=Ye.__PosthogExtensions__)==null||!t.initSessionRecording)return tr.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[hE]:!0});if(this.co||(this.co=(n=Ye.__PosthogExtensions__)==null?void 0:n.initSessionRecording(this._instance),this.co._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.So())return this.vo===nd||this.vo===lc?void 0:(this.vo=lc,tr.info("persisted remote config is stale, requesting fresh config before starting"),void new PE(this._instance).load());this.vo=pS,this.co.start(e)}onRRwebEmit(e){var t;(t=this.co)==null||t.onRRwebEmit==null||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.co||(t=this.mi)==null||t.register({[aE]:!0}),(e=this.co)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.co||(t=this.mi)==null||t.register({[rE]:!0}),(e=this.co)==null||e.overrideSampling()}overrideTrigger(e){var t,n;this.co||(n=this.mi)==null||n.register({[e==="url"?oE:lE]:!0}),(t=this.co)==null||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.co)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var n;return!((n=this.co)==null||!n.tryAddCustomEvent(e,t))}}},BM={autocapture:class{constructor(e){this.Co=!1,this.Mo=null,this.Io=!1,this.To=!1,this.instance=e,this.rageclicks=new uS(e.config.rageclick),this.Eo=null}initialize(){this.startIfEnabled()}get Te(){var e,t,n=ps(this.instance.config.autocapture)?this.instance.config.autocapture:{};return n.url_allowlist=(e=n.url_allowlist)==null?void 0:e.map((r=>new RegExp(r))),n.url_ignorelist=(t=n.url_ignorelist)==null?void 0:t.map((r=>new RegExp(r))),n}Ro(){if(this.isBrowserSupported()){if(_e&&Be){var e=n=>{n=n||(_e==null?void 0:_e.event);try{this.Po(n)}catch(r){Xm.error("Failed to capture event",r)}};if(ws(Be,"submit",e,{capture:!0}),ws(Be,"change",e,{capture:!0}),ws(Be,"click",e,{capture:!0}),this.Te.capture_copied_text){var t=n=>{n=n||(_e==null?void 0:_e.event);try{this.Po(n,Ym)}catch(r){Xm.error("Failed to capture copy/cut event",r)}};ws(Be,"copy",t,{capture:!0}),ws(Be,"cut",t,{capture:!0})}}}else Xm.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.Co&&(this.Ro(),this.Co=!0)}onRemoteConfig(e){if(this.Io=!0,e.ok){var t=e.config;t.elementsChainAsString&&(this.To=t.elementsChainAsString);var n=t.autocapture_opt_out;wi(n)&&(this.instance.persistence&&this.instance.persistence.register({[Pg]:n}),this.Mo=n),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(e){this.Eo=e}getElementSelectors(e){var t,n=[];return(t=this.Eo)==null||t.forEach((r=>{var o=Be==null?void 0:Be.querySelectorAll(r);o==null||o.forEach((c=>{e===c&&n.push(r)}))})),n}get isEnabled(){var e,t,n=(e=this.instance.persistence)==null?void 0:e.props[Pg],r=this.Mo,o=this.instance.Ur()&&!this.Io;if(Rn(r)&&!wi(n)&&!o)return!1;var c=(t=this.Mo)!==null&&t!==void 0?t:!!n;return!!this.instance.config.autocapture&&!c}Po(e,t){if(t===void 0&&(t="$autocapture"),this.isEnabled){var n,r=Im(e);_E(r)&&(r=r.parentNode||null),t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&this.instance.config.rageclick&&(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime())&&z1(r,this.instance.config.rageclick)&&this.Po(e,"$rageclick");var o=t===Ym;if(r&&(function(p,S,x,A,E,y){var b;if(!_e||Jv(p)||x!=null&&x.url_allowlist&&!I1(x.url_allowlist,y)||x!=null&&x.url_ignorelist&&I1(x.url_ignorelist,y))return!1;if(x!=null&&x.dom_event_allowlist){var v=x.dom_event_allowlist;if(v&&!v.some((j=>S.type===j)))return!1}var _=CE(p,A),k=_.parentIsUsefulElement,C=_.targetElementList;if(!(function(j,M){var D=M==null?void 0:M.element_allowlist;if(De(D))return!0;var L,q=function(Y){if(D.some((Q=>Y.tagName.toLowerCase()===Q)))return{v:!0}};for(var F of j)if(L=q(F))return L.v;return!1})(C,x)||!sv(C,x==null?void 0:x.css_selector_allowlist)||sv(C,(b=x==null?void 0:x.css_selector_ignorelist)!==null&&b!==void 0?b:I4))return!1;try{var w=_e.getComputedStyle(p);if(w&&w.getPropertyValue("cursor")==="pointer"&&S.type==="click")return!0}catch{}var T=p.tagName.toLowerCase();switch(T){case"html":return!1;case"form":return(E||["submit"]).indexOf(S.type)>=0;case"input":case"select":case"textarea":return(E||["change","click"]).indexOf(S.type)>=0;default:return k?(E||["click"]).indexOf(S.type)>=0:(E||["click"]).indexOf(S.type)>=0&&(Xv.indexOf(T)>-1||p.getAttribute("contenteditable")==="true")}})(r,e,this.Te,o,o?["copy","cut"]:void 0,this.instance)){var c=AM(r,{e,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}),h=c.props;if(c.explicitNoCapture)return!1;var l=this.getElementSelectors(r);if(l&&l.length>0&&(h.$element_selectors=l),t===Ym){var u,m=SE(_e==null||(u=_e.getSelection())==null?void 0:u.toString()),g=e.type||"clipboard";if(!m)return!1;h.$selected_content=m,h.$copy_type=g}return this.instance.capture(t,h),!0}}}isBrowserSupported(){return Gn(Be==null?void 0:Be.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this.Oo=(_e==null||(t=_e.location)==null?void 0:t.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(Oe.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.Fo&&this.Fo(),this.Fo=void 0,Oe.info("History API monitoring stopped")}monitorHistoryChanges(){_e&&_e.history&&(this.Ao("pushState"),this.Ao("replaceState"),this.$o())}Ao(e){var t;if(_e&&((t=_e.history[e])==null||!t.__posthog_wrapped__)){var n=this;(function(r,o,c){try{if(!(o in r))return dS;var h={next:r[o]},l=c((function(){for(var u=arguments.length,m=new Array(u),g=0;u>g;g++)m[g]=arguments[g];return h.next.apply(this,m)}));return Gn(l)&&(l.prototype=l.prototype||{},Object.defineProperties(l,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:h}})),r[o]=l,()=>{if(r[o]!==l)for(var u=r[o];Gn(u)&&u.__posthog_layer__;){var m=u.__posthog_layer__;if(m.next===l)return void(m.next=h.next);u=m.next}else r[o]=h.next}}catch{return dS}})(_e.history,e,(r=>function(o,c,h){r.call(this,o,c,h),n.Lo(e)}))}}Lo(e){try{var t,n=_e==null||(t=_e.location)==null?void 0:t.pathname;if(!n)return;n!==this.Oo&&this.isEnabled&&this._instance.capture(Bo,{navigation_type:e}),this.Oo=n}catch(r){Oe.error("Error capturing "+e+" pageview",r)}}$o(){if(!this.Fo){var e=()=>{this.Lo("popstate")};ws(_e,"popstate",e),this.Fo=()=>{_e&&_e.removeEventListener("popstate",e)}}}},heatmaps:class{get Te(){return this.instance.config}constructor(e){var t;this.Do=!1,this.Co=!1,this.No=null,this.instance=e,this.Do=!((t=this.instance.persistence)==null||!t.props[Bg]),this.rageclicks=new uS(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return ps(this.Te.capture_heatmaps)&&this.Te.capture_heatmaps.flush_interval_milliseconds&&(e=this.Te.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return ft(this.Te.capture_heatmaps)?ft(this.Te.enable_heatmaps)?this.Do:this.Te.enable_heatmaps:this.Te.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.Co)return;NM.info("starting..."),this.qo(),this.xe()}else{var e;clearInterval((e=this.No)!==null&&e!==void 0?e:void 0),this.jo(),this.getAndClearBuffer()}}onRemoteConfig(e){if(e.ok){var t=e.config;if("heatmaps"in t){var n=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Bg]:n}),this.Do=n,this.startIfEnabled()}}}getAndClearBuffer(){var e=this.R;return this.R=void 0,e}Bo(e){Zm(e.originalEvent)&&this.pe(e.originalEvent,"deadclick")}xe(){this.No&&clearInterval(this.No),this.No=(Be==null?void 0:Be.visibilityState)==="visible"?setInterval(this.oi.bind(this),this.flushIntervalMilliseconds):null}qo(){_e&&Be&&(this.Ho=this.oi.bind(this),ws(_e,zh,this.Ho),this.Uo=e=>this.pe(e||(_e==null?void 0:_e.event)),ws(Be,"click",this.Uo,{capture:!0}),this.zo=e=>this.Vo(e||(_e==null?void 0:_e.event)),ws(Be,"mousemove",this.zo,{capture:!0}),this.Wo=new W1(this.instance,q4,this.Bo.bind(this)),this.Wo.startIfEnabledOrStop(),this.Zo=this.xe.bind(this),ws(Be,Bh,this.Zo),this.Co=!0)}jo(){var e;_e&&Be&&(this.Ho&&_e.removeEventListener(zh,this.Ho),this.Uo&&Be.removeEventListener("click",this.Uo,{capture:!0}),this.zo&&Be.removeEventListener("mousemove",this.zo,{capture:!0}),this.Zo&&Be.removeEventListener(Bh,this.Zo),clearTimeout(this.Go),(e=this.Wo)==null||e.stop(),this.Co=!1)}Qo(e,t){var n=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),o=this.instance.scrollManager.scrollElement(),c=(function(h,l,u){for(var m=h;m&&Xr(m)&&!Wn(m,"body");){if(m===u)return!1;var g=void 0;try{var p,S,x;g=(p=(S=(x=m.ownerDocument)==null?void 0:x.defaultView)!==null&&S!==void 0?S:_e)==null?void 0:p.getComputedStyle(m).position}catch{return!1}if(lt(l,g))return!0;m=wE(m)}return!1})(Im(e),["fixed","sticky"],o);return{x:e.clientX+(c?0:r),y:e.clientY+(c?0:n),target_fixed:c,type:t}}pe(e,t){var n;if(t===void 0&&(t="click"),!L1(e.target)&&Zm(e)){var r=this.Qo(e,t);(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&z1(Im(e),this.instance.config.rageclick)&&this.Wt(Te({},r,{type:"rageclick"})),this.Wt(r)}}Vo(e){!L1(e.target)&&Zm(e)&&(clearTimeout(this.Go),this.Go=setTimeout((()=>{this.Wt(this.Qo(e,"mousemove"))}),500))}Wt(e){if(_e){var t=this.Te.disable_capture_url_hashes?Yr(_e.location.href):_e.location.href,n=this.Te.custom_personal_data_properties,r=this.Te.mask_personal_data_properties?[...sl,...n||[]]:[],o=Lc(t,r,Ic);this.R=this.R||{},this.R[o]||(this.R[o]=[]),this.R[o].push(e)}}oi(){this.R&&!Vr(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:W1,webVitalsAutocapture:class{constructor(e){var t;this.Do=!1,this.Co=!1,this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Jo=()=>{clearTimeout(this.Ko),this.R.metrics.length!==0&&(this._instance.capture("$web_vitals",this.R.metrics.reduce(((n,r)=>Te({},n,{["$web_vitals_"+r.name+"_event"]:Te({},r),["$web_vitals_"+r.name+"_value"]:r.value})),{})),this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Yo=n=>{var r;this.R=this.R||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var o=this.Xo();if(!De(o))if(ft(n==null?void 0:n.name)||ft(n==null?void 0:n.value))Sa.error("Invalid metric received",n);else if(!this.ta||this.ta>n.value){this.R.url!==o&&(this.Jo(),this.Ko=setTimeout(this.Jo,this.flushToCaptureTimeoutMs)),De(this.R.url)&&(this.R.url=o),this.R.firstMetricTimestamp=De(this.R.firstMetricTimestamp)?Date.now():this.R.firstMetricTimestamp,n.attribution&&n.attribution.interactionTargetElement&&(n.attribution.interactionTargetElement=void 0);var c=(r=this._instance.sessionManager)==null?void 0:r.checkAndGetSessionAndWindowId(!0),h=Te({},n,{$current_url:o,timestamp:Date.now()});De(c)||(h.$session_id=c.sessionId,h.$window_id=c.windowId),this.R.metrics.push(h),this.R.metrics.length===this.allowedMetrics.length&&this.Jo()}else Sa.error("Ignoring metric with value >= "+this.ta,n)},this.ea=()=>{if(!this.Co){var n,r,o,c,h=Ye.__PosthogExtensions__;if(!De(h)&&!De(h.postHogWebVitalsCallbacks)){var l=h.postHogWebVitalsCallbacks;n=l.onLCP,r=l.onCLS,o=l.onFCP,c=l.onINP}n&&r&&o&&c?(this.allowedMetrics.indexOf("LCP")>-1&&n(this.Yo.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&r(this.Yo.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&o(this.Yo.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&c(this.Yo.bind(this)),this.Co=!0):Sa.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.Do=!((t=this._instance.persistence)==null||!t.props[Fg]),this.startIfEnabled()}get ra(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,n=ps(this.ra)?(e=this.ra)==null?void 0:e.web_vitals_allowed_metrics:void 0;return ft(n)?((t=this._instance.persistence)==null?void 0:t.props[qg])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return(ps(this.ra)?this.ra.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=ps(this.ra)?this.ra.web_vitals_attribution:void 0;return e!=null&&e}get ta(){var e=ps(this.ra)&&on(this.ra.__web_vitals_max_value)?this.ra.__web_vitals_max_value:hS;return e>0&&6e4>=e?hS:e}get isEnabled(){var e=$s==null?void 0:$s.protocol;if(e!=="http:"&&e!=="https:")return Sa.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=ps(this.ra)?this.ra.web_vitals:wi(this.ra)?this.ra:void 0;return wi(t)?t:this.Do}startIfEnabled(){this.isEnabled&&!this.Co&&(Sa.info("enabled, starting..."),this.tr(this.ea))}onRemoteConfig(e){if(e.ok){var t=e.config;if("capturePerformance"in t){var n=ps(t.capturePerformance)&&!!t.capturePerformance.web_vitals,r=ps(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Fg]:n}),this._instance.persistence.register({[qg]:r})),this.Do=n,this.startIfEnabled()}}}tr(e){var t,n;(t=Ye.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks?e():(n=Ye.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(r=>{r?Sa.error("failed to load script",r):e()}))}Xo(){var e=_e?this._instance.config.disable_capture_url_hashes?Yr(_e.location.href):_e.location.href:void 0;if(e){var t=this._instance.config.custom_personal_data_properties,n=this._instance.config.mask_personal_data_properties?[...sl,...t||[]]:[];return Lc(e,n,Ic)}Sa.error("Could not determine current URL")}}},zM={exceptionObserver:class{constructor(e){var t;this.ea=()=>{var n;if(_e&&this.isEnabled&&(n=Ye.__PosthogExtensions__)!=null&&n.errorWrappingFunctions){var r=Ye.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,o=Ye.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,c=Ye.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.ia&&this.Te.capture_unhandled_errors&&(this.ia=r(this.captureException.bind(this))),!this.na&&this.Te.capture_unhandled_rejections&&(this.na=o(this.captureException.bind(this))),!this.sa&&this.Te.capture_console_errors&&(this.sa=c(this.captureException.bind(this)))}catch(h){oc.error("failed to start",h),this.oa()}}},this._instance=e,this.aa=!((t=this._instance.persistence)==null||!t.props[zg]),this.la=new B3(Te({},(function(n){var r,o,c,h;return n===void 0&&(n={}),{refillRate:(r=(o=n.exceptionRateLimiterRefillRate)!==null&&o!==void 0?o:n.__exceptionRateLimiterRefillRate)!==null&&r!==void 0?r:1,bucketSize:(c=(h=n.exceptionRateLimiterBucketSize)!==null&&h!==void 0?h:n.__exceptionRateLimiterBucketSize)!==null&&c!==void 0?c:10}})(this._instance.config.error_tracking),{refillInterval:1e4,it:oc})),this.Te=this.ua(),this.startIfEnabledOrStop()}ua(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return ps(e)?t=Te({},t,e):(De(e)?this.aa:e)&&(t=Te({},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?(oc.info("enabled"),this.oa(),this.tr(this.ea)):this.oa()}tr(e){var t,n;(t=Ye.__PosthogExtensions__)!=null&&t.errorWrappingFunctions?e():(n=Ye.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",(r=>{if(r)return oc.error("failed to load script",r);e()}))}oa(){var e,t,n;(e=this.ia)==null||e.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(e){if(e.ok){var t=e.config;"autocaptureExceptions"in t&&(this.aa=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[zg]:this.aa}),this.Te=this.ua(),this.startIfEnabledOrStop())}}onConfigChange(){this.Te=this.ua()}captureException(e){var t,n,r,o=(t=e==null||(n=e.$exception_list)==null||(n=n[0])==null?void 0:n.type)!==null&&t!==void 0?t:"Exception";this.la.consumeRateLimit(o)?oc.info("Skipping exception capture because of client rate limiting.",{exception:o}):(r=this._instance.exceptions)==null||r.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,n;this.ha=[],this.da=new s4([new u4,new y4,new h4,new d4,new v4,new g4,new p4,new _4],(function(r){for(var o=arguments.length,c=new Array(o>1?o-1:0),h=1;o>h;h++)c[h-1]=arguments[h];return function(l,u){u===void 0&&(u=0);for(var m=[],g=l.split(`
|
|
469
|
+
`),p=u;g.length>p;p++){var S=g[p];if(1024>=S.length){var x=M1.test(S)?S.replace(M1,"$1"):S;if(!x.match(/\S*Error: /)){for(var A of c){var E=A(x,r);if(E){m.push(E);break}}if(m.length>=50)break}}}return(function(y){if(!y.length)return[];var b=Array.from(y);return b.reverse(),b.slice(0,50).map((v=>{return Te({},v,{filename:v.filename||(_=b,_[_.length-1]||{}).filename,function:v.function||el});var _}))})(m)}})("web:javascript",a4,c4)),this._instance=e,this.ha=(t=(n=this._instance.persistence)==null?void 0:n.get_property(Hg))!==null&&t!==void 0?t:[],this.ca=Dh(this.va()),this.fa=new S4(this.ca)}onConfigChange(){this.ca=Dh(this.va()),this.fa.setConfig(this.ca)}onRemoteConfig(e){var t,n,r;if(e.ok){var o=e.config;if("errorTracking"in o){var c=(t=(n=o.errorTracking)==null?void 0:n.suppressionRules)!==null&&t!==void 0?t:[],h=(r=o.errorTracking)==null?void 0:r.captureExtensionExceptions;this.ha=c,this._instance.persistence&&this._instance.persistence.register({[Hg]:this.ha,[Ug]:h})}}}get pa(){var e,t=!!this._instance.get_property(Ug),n=this._instance.config.error_tracking.captureExtensionExceptions;return(e=n??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.da.buildFromUnknown(e,{syntheticException:t==null?void 0:t.syntheticException,mechanism:{handled:t==null?void 0:t.handled}})}addExceptionStep(e,t){if(this.ca.enabled)try{if(!es(e)||e.trim().length===0)return void Di.warn("Ignoring exception step because message must be a non-empty string");var n=(function(c){if(!c)return{sanitizedProperties:{},droppedKeys:[]};var h=[];return{sanitizedProperties:Object.keys(c).reduce(((l,u)=>b4.has(u)?(h.push(u),l):(l[u]=c[u],l)),{}),droppedKeys:h}})(this.ga(t)),r=n.sanitizedProperties,o=n.droppedKeys;o.length>0&&Di.warn("Ignoring reserved exception step fields",{droppedKeys:o}),this.fa.add(Te({[Mh]:e,[$h]:new Date().toISOString()},r))}catch(c){Di.error("Failed to add exception step. Ignoring breadcrumb.",c)}}sendExceptionEvent(e){try{var t=e.$exception_list;if(this.ma(t)){if(this.ya(t))return this.ba("Exception dropped: matched a suppression rule"),void Di.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 Di.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 Di.info("Skipping exception capture because it was thrown by the PostHog SDK")}var n=this.ca.enabled&&ft(e.$exception_steps)?this.xa(e):e,r=typeof(c=globalThis._posthogReleaseId)=="string"&&c.length>0?c:void 0;r&&(n.$release_id=r);try{var o=this._instance.capture("$exception",n,{_noTruncate:!0,_batchKey:"exceptionEvent",Pn:!0});return o&&this.fa.clear(),o}catch(h){return Di.error("Failed to capture exception event. Dropping this exception.",h),void this.fa.clear()}}catch(h){return void Di.error("Failed to process exception event. Ignoring this exception.",h)}var c}xa(e){try{var t=this.fa.getAttachable();return t.length===0?e:Te({},e,{$exception_steps:t})}catch(n){return Di.error("Failed to read buffered exception steps. Capturing exception without steps.",n),e}}ba(e){this.ca.enabled&&this.fa.add({[Mh]:e,[$h]:new Date().toISOString()})}ga(e){return ps(e)?Te({},e):{}}va(){var e,t;return(e=(t=this._instance.config.error_tracking)==null?void 0:t.exception_steps)!==null&&e!==void 0?e:{}}ya(e){if(e.length===0)return!1;try{var t=e.reduce(((n,r)=>{var o=r.type,c=r.value;return es(o)&&o.length>0&&n.$exception_types.push(o),es(c)&&c.length>0&&n.$exception_values.push(c),n}),{$exception_types:[],$exception_values:[]});return this.ha.some((n=>{var r=n.values.map((o=>{var c=JE[o.operator],h=t[o.key];if(!c||!h)return!1;var l=dt(o.value)?o.value:[o.value];return l.length>0&&c(l,h)}));return n.type==="OR"?r.some(Boolean):r.every(Boolean)}))}catch(n){return Di.warn("Failed to evaluate suppression rules. Capturing the exception.",n),!1}}_a(e){return e.flatMap((t=>{var n,r;return(n=(r=t.stacktrace)==null?void 0:r.frames)!==null&&n!==void 0?n:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}wa(e){if(e.length>0){var t,n,r,o,c=(t=(n=e[0].stacktrace)==null?void 0:n.frames)!==null&&t!==void 0?t:[],h=c[c.length-1];return(r=h==null||(o=h.filename)==null?void 0:o.includes("posthog.com/static"))!==null&&r!==void 0&&r}return!1}ma(e){return!ft(e)&&dt(e)}}},HM=Te({productTours:class{get mi(){return this._instance.persistence}constructor(e){this.ka=null,this.Sa=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(e.ok){var t=e.config;if("productTours"in t){var n,r;if(this.mi&&this.mi.register({[Vv]:!!t.productTours}),!eg(this._instance))return!this.ka&&ft((n=this.mi)==null?void 0:n.props[_c])||Qm.info("product tours disabled; stopping and clearing cached tours"),(r=this.ka)==null||r.stop(),this.ka=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.ka&&eg(this._instance)&&this.tr((()=>this.Ca()))}tr(e){var t,n;(t=Ye.__PosthogExtensions__)!=null&&t.generateProductTours?e():(n=Ye.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"product-tours",(r=>{r?Qm.error("Could not load product tours script",r):e()}))}Ca(){var e;!this.ka&&(e=Ye.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.ka=Ye.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(t===void 0&&(t=!1),!dt(this.Sa)||t){var n=this.mi;if(n){var r=n.props[_c];if(dt(r)&&!t)return this.Sa=r,void e(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",timestampMode:"query",callback:o=>{if(eg(this._instance)){var c=o.statusCode;if(c!==200||!o.json){var h="Product Tours API could not be loaded, status: "+c;return Qm.error(h),void e([],{isLoaded:!1,error:h})}var l=dt(o.json.product_tours)?o.json.product_tours:[];this.Sa=l,n&&n.register({[_c]:l}),e(l,{isLoaded:!0})}else e([],{isLoaded:!0})}})}else e(this.Sa,{isLoaded:!0})}getActiveProductTours(e){ft(this.ka)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.ka.getActiveProductTours(e)}showProductTour(e){var t;(t=this.ka)==null||t.showTourById(e)}previewTour(e){this.ka?this.ka.previewTour(e):this.tr((()=>{var t;this.Ca(),(t=this.ka)==null||t.previewTour(e)}))}dismissProductTour(){var e;(e=this.ka)==null||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.ka)==null||e.nextStep()}previousStep(){var e;(e=this.ka)==null||e.previousStep()}clearCache(){var e;this.Sa=null,(e=this.mi)==null||e.unregister(_c)}resetTour(e){var t;(t=this.ka)==null||t.resetTour(e)}resetAllTours(){var e;(e=this.ka)==null||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.ka)==null||t.cancelPendingTour(e)}}},df),UM={siteApps:class{constructor(e){this.Ma=0,this._instance=e,this.Ia=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Ta(e,t){if(t){var n=this.globalsForEvent(t);this.Ia.push(n),this.Ia.length>1e3&&(this.Ia=this.Ia.slice(10))}}get siteAppLoaders(){var e;return(e=Ye._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}initialize(){if(this.isEnabled){var e=this._instance._addCaptureHook(this.Ta.bind(this));this.Ea=()=>{e(),this.Ia=[],this.Ea=void 0}}}globalsForEvent(e){var t,n,r,o,c,h,l;if(!e)throw new Error("Event payload is required");var u={},m=this._instance.get_property("$groups")||[],g=this._instance.get_property("$stored_group_properties")||{};for(var p of Object.entries(g)){var S=p[0];u[S]={id:m[S],type:S,properties:p[1]}}var x=e.$set_once,A=e.$set;return{event:Te({},CC(e,MM),{properties:Te({},e.properties,A?{$set:Te({},(t=(n=e.properties)==null?void 0:n.$set)!==null&&t!==void 0?t:{},A)}:{},x?{$set_once:Te({},(r=(o=e.properties)==null?void 0:o.$set_once)!==null&&r!==void 0?r:{},x)}:{}),elements_chain:(c=(h=e.properties)==null?void 0:h.$elements_chain)!==null&&c!==void 0?c:"",distinct_id:(l=e.properties)==null?void 0:l.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:u}}Ra(e){var t,n=(t=e.tagName)==null?void 0:t.toLowerCase();return n==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||($i.error("prepare_external_dependency_stylesheet returned null"),null):n==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(e)||($i.error("prepare_external_dependency_script returned null"),null):e}Pa(){var e,t,n,r,o,c,h,l;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var u=Be==null?void 0:Be.defaultView,m=u==null||(e=u.Node)==null?void 0:e.prototype;if(!u||!m)return()=>{};if(this.Ma++,this.Oa)return this.Fa();var g=[],p=this,S=new WeakSet,x=(y,b,v)=>{if(y!=null&&y[b]){var _=y[b];y[b]=v(_),g.push((()=>{y[b]=_}))}},A=y=>{if(S.has(y))return y;var b=p.Ra(y);return b&&S.add(b),b},E=y=>y.map((b=>typeof b=="string"?b:A(b))).filter((b=>!Rn(b)));return x(m,"appendChild",(y=>function(b){var v=A(b);return v?y.call(this,v):b})),x(m,"insertBefore",(y=>function(b,v){var _=A(b);return _?y.call(this,_,v):b})),x(m,"replaceChild",(y=>function(b,v){var _=A(b);return _?y.call(this,_,v):v})),[(t=u.Element)==null?void 0:t.prototype,(n=u.Document)==null?void 0:n.prototype,(r=u.DocumentFragment)==null?void 0:r.prototype].forEach((y=>{x(y,"append",(b=>function(){for(var v=arguments.length,_=new Array(v),k=0;v>k;k++)_[k]=arguments[k];return b.apply(this,E(_))})),x(y,"prepend",(b=>function(){for(var v=arguments.length,_=new Array(v),k=0;v>k;k++)_[k]=arguments[k];return b.apply(this,E(_))}))})),[(o=u.Element)==null?void 0:o.prototype,(c=u.CharacterData)==null?void 0:c.prototype,(h=u.DocumentType)==null?void 0:h.prototype].forEach((y=>{x(y,"before",(b=>function(){for(var v=arguments.length,_=new Array(v),k=0;v>k;k++)_[k]=arguments[k];return b.apply(this,E(_))})),x(y,"after",(b=>function(){for(var v=arguments.length,_=new Array(v),k=0;v>k;k++)_[k]=arguments[k];return b.apply(this,E(_))})),x(y,"replaceWith",(b=>function(){for(var v=arguments.length,_=new Array(v),k=0;v>k;k++)_[k]=arguments[k];var C=E(_);return _.length&&!C.length?void 0:b.apply(this,C)}))})),x((l=u.Element)==null?void 0:l.prototype,"insertAdjacentElement",(y=>function(b,v){var _=A(v);return _?y.call(this,b,_):null})),this.Oa=()=>{g.forEach((y=>y())),this.Oa=void 0},this.Fa()}Fa(){var e=!1;return()=>{var t;e||(e=!0,this.Ma--,this.Ma===0&&((t=this.Oa)==null||t.call(this)))}}Aa(e,t){t===void 0&&(t=!0);var n=this.Pa();try{var r=e(n);return t&&n(),r}catch(o){throw n(),o}}setupSiteApp(e){var t=this.apps[e.id],n=()=>{var h;!t.errored&&this.Ia.length&&($i.info("Processing "+this.Ia.length+" events for site app with id "+e.id),this.Ia.forEach((l=>this.Aa((()=>t.processEvent==null?void 0:t.processEvent(l))))),t.processedBuffer=!0),Object.values(this.apps).every((l=>l.processedBuffer||l.errored))&&((h=this.Ea)==null||h.call(this))},r=!1,o=h=>{t.errored=!h,t.loaded=!0,$i.info("Site app with id "+e.id+" "+(h?"loaded":"errored")),r&&n()};try{var c=this.Aa((h=>e.init({posthog:this._instance,callback(l){h(),o(l)}})),!1).processEvent;c&&(t.processEvent=c),r=!0}catch(h){$i.error(mS+e.id,h),o(!1)}if(r&&t.loaded)try{n()}catch(h){$i.error("Error while processing buffered events PostHog app with config id "+e.id,h),t.errored=!0}}$a(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var n of e)this.setupSiteApp(n)}La(e){var t=this;if(Object.keys(this.apps).length!==0){var n=this.globalsForEvent(e),r=function(c){try{t.Aa((()=>c.processEvent==null?void 0:c.processEvent(n)))}catch(h){$i.error("Error while processing event "+e.event+" for site app "+c.id,h)}};for(var o of Object.values(this.apps))r(o)}}onRemoteConfig(e){var t,n,r,o=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.$a(),void this._instance.on("eventCaptured",(u=>this.La(u)))):void $i.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.Ea)==null||n.call(this),e.ok){var c=e.config;if((r=c.siteApps)!=null&&r.length)if(this.isEnabled){var h=function(){var u,m=l.id,g=l.url;Ye["__$$ph_site_app_"+m]=o._instance,(u=Ye.__PosthogExtensions__)==null||u.loadSiteApp==null||u.loadSiteApp(o._instance,g,(p=>{if(p)return $i.error(mS+m,p)}))};for(var l of c.siteApps)h()}else $i.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},FM={tracingHeaders:class{constructor(e){this.Da=void 0,this.Na=void 0,this.qa=void 0,this.ea=()=>{var t,n,r=this.ja();r?(De(this.Da)&&(this.Da=(t=Ye.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null?void 0:t._patchXHR(r,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),De(this.Na)&&(this.Na=(n=Ye.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null?void 0:n._patchFetch(r,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.oa()},this._instance=e}initialize(){this.startIfEnabledOrStop()}tr(e){var t,n;(t=Ye.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns?e():(n=Ye.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",(r=>{if(r)return TM.error("failed to load script",r);e()}))}Ba(){var e,t;return(e=(t=this._instance.config.tracing_headers)!==null&&t!==void 0?t:this._instance.config.addTracingHeaders)!==null&&e!==void 0?e:this._instance.config.__add_tracing_headers}ja(){var e=this.Ba();return dt(e)?(dt(this.qa)?this.qa.splice(0,this.qa.length,...e):this.qa=[...e],e.length>0?this.qa:void 0):(dt(this.qa)&&this.qa.splice(0),this.qa=e||void 0,this.qa)}oa(){var e,t;(e=this.Da)==null||e.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()}}},qM=Te({surveys:class{get Te(){return this._instance.config}constructor(e){this.Ha=void 0,this._surveyManager=null,this.Ua=!1,this.za=[],this.Va=null,this.Wa=null,this._instance=e,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this.Te.disable_surveys){if(!e.ok)return Wt.warn("Remote config unavailable. Not loading surveys.");var t=e.config.surveys;if(ft(t))return Wt.warn("Flags not loaded yet. Not loading surveys.");var n=dt(t);this.Ha=n?t.length>0:t,Wt.info("flags response received, isSurveysEnabled: "+this.Ha),this.loadIfEnabled()}}reset(){try{var e;(e=this._surveyEventReceiver)==null||e.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var t=[],n=0;n<localStorage.length;n++){var r=localStorage.key(n);(r!=null&&r.startsWith(e2)||r!=null&&r.startsWith("inProgressSurvey_"))&&t.push(r)}t.forEach((o=>localStorage.removeItem(o)))}catch{}}loadIfEnabled(){if(!this._surveyManager)if(this.Ua)Wt.info("Already initializing surveys, skipping...");else if(this.Te.disable_surveys)Wt.info(gS);else if(this.Te.cookieless_mode&&this._instance.consent.isOptedOut())Wt.info("Not loading surveys in cookieless mode without consent.");else{var e=Ye==null?void 0:Ye.__PosthogExtensions__;if(e){if(!De(this.Ha)||this.Te.advanced_enable_surveys){var t=this.Ha||this.Te.advanced_enable_surveys;this.Ua=!0;try{var n=e.generateSurveys;if(n)return void this.Za(n,t);var r=e.loadExternalDependency;if(!r)return void this.Ga(Wv);r(this._instance,"surveys",(o=>{o||!e.generateSurveys?this.Ga("Could not load surveys script",o):this.Za(e.generateSurveys,t)}))}catch(o){throw this.Ga("Error initializing surveys",o),o}finally{this.Ua=!1}}}else Wt.error("PostHog Extensions not found.")}}Za(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new OM(this._instance),Wt.info("Surveys loaded successfully"),this.Qa({isLoaded:!0})}Ga(e,t){Wt.error(e,t),this.Qa({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.za.push(e),this._surveyManager&&this.Qa({isLoaded:!0}),()=>{this.za=this.za.filter((t=>t!==e))}}getSurveys(e,t){if(t===void 0&&(t=!1),this.Te.disable_surveys)return Wt.info(gS),e([]);var n,r=this._instance.get_property(Wg);if(r&&!t)return e(r,{isLoaded:!0}),void(this.Ja()&&this.getSurveys((()=>{}),!0));typeof Promise<"u"&&this.Va?this.Va.then((o=>e(o.surveys,o.context))):(typeof Promise<"u"&&(this.Va=new Promise((o=>{n=o}))),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:o=>{var c;this.Va=null;var h=o.statusCode;if(h!==200||!o.json){var l="Surveys API could not be loaded, status: "+h;Wt.error(l),this.Wa=Date.now();var u={isLoaded:!1,error:l};return e([],u),void(n==null||n({surveys:[],context:u}))}this.Wa=null;var m,g=o.json.surveys||[],p=g.filter((x=>(function(A){return!(!A.start_date||A.end_date)})(x)&&(QE(x)||(function(A){var E;return!((E=A.conditions)==null||(E=E.actions)==null||(E=E.values)==null||!E.length)})(x))));p.length>0&&((m=this._surveyEventReceiver)==null||m.register(p)),(c=this._instance.persistence)==null||c.register({[Wg]:g,[Lh]:Date.now()});var S={isLoaded:!0};e(g,S),n==null||n({surveys:g,context:S})}}))}Ja(){return this.Ka()&&!this.Va&&!this.Ya()}Ka(){var e=this._instance.get_property(Lh);return on(e)&&Date.now()-e>3e5}Ya(){return on(this.Wa)&&3e5>Date.now()-this.Wa}markSurveyAsSeen(e,t){var n,r={id:e,current_iteration:(n=t==null?void 0:t.iteration)!==null&&n!==void 0?n:null};t2(r);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}}Qa(e){for(var t of this.za)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(n){Wt.error("Error in survey callback",n)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!ft(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);Wt.warn("init was not called")}Xa(e){var t=null;return this.getSurveys((n=>{var r;t=(r=n.find((o=>o.id===e)))!==null&&r!==void 0?r:null})),t}tl(e){if(ft(this._surveyManager))return{eligible:!1,reason:id};var t=typeof e=="string"?this.Xa(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}el(e){if(ft(this._surveyManager))return{eligible:!1,reason:id};var t=typeof e=="string"?this.Xa(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(ft(this._surveyManager))return Wt.warn("init was not called"),{visible:!1,disabledReason:id};var t=this.el(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return ft(this._surveyManager)?(Wt.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:id})):new Promise((n=>{this.getSurveys((r=>{var o,c=(o=r.find((l=>l.id===e)))!==null&&o!==void 0?o:null;if(c){var h=this.el(c);n({visible:h.eligible,disabledReason:h.reason})}else n({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t,n){var r;if(ft(this._surveyManager))Wt.warn("init was not called");else{var o=typeof e=="string"?this.Xa(e):e;if(o!=null&&o.id)if(vM.includes(o.type)){var c=Be==null?void 0:Be.querySelector(t);if(c)return(r=o.appearance)!=null&&r.surveyPopupDelaySeconds?(Wt.info("Rendering survey "+o.id+" with delay of "+o.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var h,l;Wt.info("Rendering survey "+o.id+" with delay of "+((h=o.appearance)==null?void 0:h.surveyPopupDelaySeconds)+" seconds"),(l=this._surveyManager)==null||l.renderSurvey(o,c,n),Wt.info("Survey "+o.id+" rendered")}),1e3*o.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(o,c,n);Wt.warn("Survey element not found")}else Wt.warn("Surveys of type "+o.type+" cannot be rendered in the app");else Wt.warn("Survey not found")}}displaySurvey(e,t){var n;if(ft(this._surveyManager))Wt.warn("init was not called");else{var r=this.Xa(e);if(r){var o=r;if((n=r.appearance)!=null&&n.surveyPopupDelaySeconds&&t.ignoreDelay&&(o=Te({},r,{appearance:Te({},r.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==iv.Popover&&t.initialResponses&&Wt.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){var c=this.tl(r);if(!c.eligible)return void Wt.warn("Survey is not eligible to be displayed: ",c.reason)}t.displayType!==iv.Inline?this._surveyManager.handlePopoverSurvey(o,t):this.renderSurvey(o,t.selector,t.properties)}else Wt.warn("Survey not found")}}cancelPendingSurvey(e){ft(this._surveyManager)?Wt.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload==null||e.handlePageUnload()}}},df),VM={toolbar:class{constructor(e){this.instance=e}rl(e){Ye.ph_toolbar_state=e}il(){var e;return(e=Ye.ph_toolbar_state)!==null&&e!==void 0?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,t,n){if(e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),fE(this.instance.config)||!_e||!Be)return!1;e=e??_e.location,n=n??_e.history;try{if(!t){try{_e.localStorage.setItem("test","test"),_e.localStorage.removeItem("test")}catch{return!1}t=_e==null?void 0:_e.localStorage}var r,o=LM||qh(e.hash,"__posthog")||qh(e.hash,"state"),c=o?D1((()=>JSON.parse(atob(decodeURIComponent(o)))))||D1((()=>JSON.parse(decodeURIComponent(o)))):null;return c&&c.action==="ph_authorize"?((r=c).source="url",r&&Object.keys(r).length>0&&(c.desiredHash?e.hash=c.desiredHash:n?n.replaceState(n.state,"",e.pathname+e.search):e.hash="")):((r=JSON.parse(t.getItem(vS)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch{return!1}}nl(e){var t=Ye.ph_load_toolbar||Ye.ph_load_editor;!ft(t)&&Gn(t)?t(e,this.instance):_S.warn("No toolbar load function found")}loadToolbar(e){var t=!(Be==null||!Be.getElementById(vE));if(!_e||t)return!1;var n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,r=Te({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(_e.localStorage.setItem(vS,JSON.stringify(Te({},r,{source:void 0}))),this.il()===2)this.nl(r);else if(this.il()===0){var o;this.rl(1),(o=Ye.__PosthogExtensions__)==null||o.loadExternalDependency==null||o.loadExternalDependency(this.instance,"toolbar",(c=>{if(c)return _S.error("[Toolbar] Failed to load",c),void this.rl(0);this.rl(2),this.nl(r)})),ws(_e,"turbolinks:load",(()=>{this.rl(0),this.loadToolbar(r)}))}return!0}sl(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,n){return e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),this.maybeLoadToolbar(e,t,n)}}},GM=Te({experiments:pn},df),WM={conversations:class{constructor(e){this.ol=void 0,this._conversationsManager=null,this.al=!1,this.ll=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations&&e.ok){var t=e.config.conversations;ft(t)||(wi(t)?this.ol=t:(this.ol=t.enabled,this.ll=t),this.loadIfEnabled())}}reset(){var e;(e=this._conversationsManager)==null||e.reset(),this._conversationsManager=null,this.ol=void 0,this.ll=null}loadIfEnabled(){if(!(this._conversationsManager||this.al||this._instance.config.disable_conversations||fE(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=Ye==null?void 0:Ye.__PosthogExtensions__;if(e&&!De(this.ol)&&this.ol)if(this.ll&&this.ll.token){this.al=!0;try{var t=e.initConversations;if(t)return this.ul(t),void(this.al=!1);var n=e.loadExternalDependency;if(!n)return void this.hl(Wv);n(this._instance,"conversations",(r=>{r||!e.initConversations?this.hl("Could not load conversations script",r):this.ul(e.initConversations),this.al=!1}))}catch(r){this.hl("Error initializing conversations",r),this.al=!1}}else ri.error("Conversations enabled but missing token in remote config.")}}ul(e){if(this.ll)try{this._conversationsManager=e(this.ll,this._instance),ri.info("Conversations loaded successfully")}catch(t){this.hl("Error completing conversations initialization",t)}else ri.error("Cannot complete initialization: remote config is null")}hl(e,t){ri.error(e,t),this._conversationsManager=null,this.al=!1}show(){this._conversationsManager?this._conversationsManager.show():ri.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.ol===!0&&!Rn(this._conversationsManager)}isVisible(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.isVisible())!==null&&e!==void 0&&e}sendMessage(e,t,n){var r=this;return ms((function*(){return r._conversationsManager?r._conversationsManager.sendMessage(e,t,n):(ri.warn(xa),null)}))()}getMessages(e,t){var n=this;return ms((function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(ri.warn(xa),null)}))()}markAsRead(e){var t=this;return ms((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(ri.warn(xa),null)}))()}getTickets(e){var t=this;return ms((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(ri.warn(xa),null)}))()}requestRestoreLink(e){var t=this;return ms((function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(ri.warn(xa),null)}))()}restoreFromToken(e){var t=this;return ms((function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(ri.warn(xa),null)}))()}restoreFromUrlToken(){var e=this;return ms((function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(ri.warn(xa),null)}))()}getCurrentTicketId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getCurrentTicketId())!==null&&e!==void 0?e:null}getWidgetSessionId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getWidgetSessionId())!==null&&e!==void 0?e:null}Nn(){var e;(e=this._conversationsManager)==null||e.setIdentity()}qn(){var e;(e=this._conversationsManager)==null||e.clearIdentity()}}},KM={logs:class{constructor(e){var t;this.dl=!1,this.cl=!1,this.it=vs("[logs]"),this.Gr=[],this.vl=[],this.Js=0,this.fl=()=>{var n,r;this.Js=0,(n=this.pl)==null||n.onReconnect(),(r=this.gl)==null||r.onReconnect()},this._instance=e,this._instance&&(t=this._instance.config.logs)!=null&&t.captureConsoleLogs&&(this.dl=!0),_e&&ws(_e,"online",this.fl)}ml(e,t,n,r){var o,c=(function(h,l){var u,m,g,p,S,x,A,E=(u=h==null?void 0:h.flushIntervalMs)!==null&&u!==void 0?u:3e3,y=(m=h==null?void 0:h.maxBufferSize)!==null&&m!==void 0?m:100,b=l!=null&&l.consoleCapture?void 0:(g=h==null?void 0:h.maxLogsPerInterval)!==null&&g!==void 0?g:1e3,v=De(b)?Math.max(y,2048):Math.max(y,b),_=h==null?void 0:h.resourceAttributes;return{serviceName:(p=(S=_==null?void 0:_["service.name"])!==null&&S!==void 0?S:h==null?void 0:h.serviceName)!==null&&p!==void 0?p:l==null?void 0:l.serviceNameDefault,serviceVersion:(x=_==null?void 0:_["service.version"])!==null&&x!==void 0?x:h==null?void 0:h.serviceVersion,environment:(A=_==null?void 0:_["deployment.environment"])!==null&&A!==void 0?A:h==null?void 0:h.environment,resourceAttributes:_,beforeSend:h==null?void 0:h.beforeSend,flushIntervalMs:E,maxBufferSize:y,maxQueueSize:v,maxBatchRecordsPerPost:100,rateCapWindowMs:E,maxLogsPerInterval:b,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}})((o=this._instance)==null||(o=o.config)==null?void 0:o.logs,n);return[new Q3(this.yl(e,t),c,this.it,(()=>this.bl()),(h=>h()),void 0,r),c]}_l(){var e,t=(e=this._instance)==null||(e=e.config)==null?void 0:e.logs;if(!this.pl||this.wl!==t){var n;(n=this.pl)==null||n.reset(),this.wl=t;var r=this.ml((()=>this.Gr),(o=>{this.Gr=o}));this.pl=r[0],this.xl=r[1]}return this.pl}kl(){var e,t=(e=this._instance)==null||(e=e.config)==null?void 0:e.logs;if(!this.gl||this.Sl!==t){var n;(n=this.gl)==null||n.reset(),this.Sl=t;var r=this.ml((()=>this.vl),(o=>{this.vl=o}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},wS);this.gl=r[0],this.Cl=r[1]}return this.gl}initialize(){this.loadIfEnabled()}onRemoteConfig(e){var t;if(e.ok){var n=(t=e.config.logs)==null?void 0:t.captureConsoleLogs;!ft(n)&&n&&(this.dl=!0,this.loadIfEnabled())}}reset(){var e,t;this.Gr=[],(e=this.pl)==null||e.reset(),this.vl=[],(t=this.gl)==null||t.reset(),this.Js=0}captureLog(e){this._l().captureLog(e)}le(e){this.kl().captureLog(e)}get logger(){return this.Ml||(this.Ml={trace:(e,t)=>this.captureLog({body:e,level:"trace",attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:"debug",attributes:t}),info:(e,t)=>this.captureLog({body:e,level:"info",attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:"warn",attributes:t}),error:(e,t)=>this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this.Ml}flushLogs(e){e?this.Il(e):(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 e=Ye==null?void 0:Ye.__PosthogExtensions__;if(e){var t=e.loadExternalDependency;t?t(this._instance,"logs",(n=>{var r;n||(r=e.logs)==null||!r.initializeLogs?this.it.error("Could not load logs script",n):(e.logs.initializeLogs(this._instance),this.cl=!0)})):this.it.error(Wv)}else this.it.error("PostHog Extensions not found.")}}yl(e,t){var n=this._instance;return{get isDisabled(){return!1},get optedOut(){return!n.is_capturing()},getPersistedProperty:r=>r===or.LogsQueue?e():void 0,setPersistedProperty(r,o){var c;r===or.LogsQueue&&t((c=o)!==null&&c!==void 0?c:[])},$t:r=>this.$t(r),getLibraryId:()=>Ft.LIB_NAME,getLibraryVersion:()=>Ft.LIB_VERSION}}$t(e){return new Promise((t=>{if(AE(this.Js,3))t({kind:"fatal",error:new Error("logs endpoint is unreachable, dropping batch")});else{var n=!1,r=c=>{n||(n=!0,clearTimeout(o),t(c))},o=setTimeout((()=>r({kind:"retry-later",error:new Error("logs request timed out")})),9e4);this._instance._send_request({method:"POST",url:this.Tl(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:c=>{var h=c.statusCode;if(this.El(h),h>=200&&300>h)r({kind:"ok"});else if(h===413)r({kind:"too-large"});else if(h!==0&&h!==429&&500>h)r({kind:"fatal",error:new Error("logs request failed with status "+h)});else{var l;r({kind:"retry-later",error:(l=c.error)!==null&&l!==void 0?l:new Error("logs request failed with status "+h)})}}})}}))}El(e){(e!==0||this._instance.__loaded)&&(this.Js=TE(e,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(e){this.Gr.length>0&&this.Rl(e,this.Gr,this.xl,Ft.LIB_NAME,(t=>{this.Gr=t})),this.vl.length>0&&this.Rl(e,this.vl,this.Cl,wS,(t=>{this.vl=t}))}Rl(e,t,n,r,o){if(t.length!==0){var c=t.map((l=>l.record));o([]);var h=QC(c,ZC(n,Ft.LIB_NAME,Ft.LIB_VERSION),r,Ft.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Tl(),data:h,compression:"best-available",batchKey:"logs",transport:e})}}Tl(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}bl(){var e,t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var n=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),r=n.windowId,o=n.sessionStartTimestamp,c=n.lastActivityTimestamp;t.sessionId=n.sessionId,t.windowId=r,ft(o)||(t.sessionStartTimestamp=o),ft(c)||(t.lastActivityTimestamp=c)}if(Ye!=null&&(e=Ye.location)!=null&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?Yr(Ye.location.href):Ye.location.href),this._instance.featureFlags){var h=this._instance.featureFlags.getFlags();h&&h.length>0&&(t.activeFeatureFlags=h)}return t}}},YM={metrics:class{constructor(e){this.it=vs("[metrics]"),this._instance=e}initialize(){}_l(){var e,t,n=(e=this._instance)==null||(e=e.config)==null?void 0:e.metrics;return this.pl&&this.wl===n||((t=this.pl)==null||t.reset(),this.wl=n,this.pl=new e4(this.yl(),(function(r){var o,c,h,l,u,m=r==null?void 0:r.resourceAttributes;return{serviceName:(o=m==null?void 0:m["service.name"])!==null&&o!==void 0?o:r==null?void 0:r.serviceName,serviceVersion:(c=m==null?void 0:m["service.version"])!==null&&c!==void 0?c:r==null?void 0:r.serviceVersion,environment:(h=m==null?void 0:m["deployment.environment"])!==null&&h!==void 0?h:r==null?void 0:r.environment,resourceAttributes:m,beforeSend:r==null?void 0:r.beforeSend,flushIntervalMs:(l=r==null?void 0:r.flushIntervalMs)!==null&&l!==void 0?l:1e4,maxSeriesPerFlush:(u=r==null?void 0:r.maxSeriesPerFlush)!==null&&u!==void 0?u:1e3}})(n),this.it)),this.pl}count(e,t,n){t===void 0&&(t=1),this._l().count(e,t,n)}gauge(e,t,n){this._l().gauge(e,t,n)}histogram(e,t,n){this._l().histogram(e,t,n)}flush(e){if(!this.pl)return Promise.resolve();if(e){var t=this.pl.drainWindow();return t&&this.Kt(t,e),Promise.resolve()}return this.pl.flush().catch((n=>this.it.error("PostHog metrics flush failed:",n)))}reset(){var e;(e=this.pl)==null||e.reset()}yl(){var e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},Kt:n=>t.Kt(n),getLibraryId:()=>Ft.LIB_NAME,getLibraryVersion:()=>Ft.LIB_VERSION}}Kt(e,t){return new Promise((n=>{var r=!1,o=h=>{r||(r=!0,clearTimeout(c),n(h))},c=setTimeout((()=>o({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(Te({method:"POST",url:this.Pl(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t},{fireCallbackOnDrop:!0,callback(h){var l=h.statusCode;if(l>=200&&300>l)o({kind:"ok"});else if(l===413)o({kind:"too-large"});else if(l!==0&&l!==429&&500>l)o({kind:"fatal",error:new Error("metrics request failed with status "+l)});else{var u;o({kind:"retry-later",error:(u=h.error)!==null&&u!==void 0?u:new Error("metrics request failed with status "+l)})}}}))}))}Pl(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},XM=Te({},df,PM,BM,zM,HM,UM,qM,FM,VM,GM,WM,KM,YM);ci.__defaultExtensionClasses=Te({},XM);var Kn=(function(){Ft.SDK_DIST_CHANNEL="npm";var e=jc[zo]=new ci;return(function(){function t(){t.done||(t.done=!0,n2=!1,ts(jc,(function(n){n._dom_loaded()})))}Be!=null&&Be.addEventListener?Be.readyState==="complete"?t():ws(Be,"DOMContentLoaded",t,{capture:!1}):_e&&Oe.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),e})();function JM(e){if(!e)return"unknown";if(e.settingsOpen)return"account";if(e.firstRun&&!e.hasLiveSession)return"onboarding";if(e.templatesOpen)return"agent_build";if(e.hasLiveSession){const t=e.rightTab??"";return t==="logs"||t==="diff"?"agent_observe":t==="canvas"||t==="preview"?"agent_operate":"agent_build"}return e.inspectingDeadSession?"agent_observe":"unknown"}function Vs(e,t){try{Kn.capture(e,t)}catch{}}let $o=null;function ZM(){var e,t;if($o)return $o;try{$o=((t=(e=globalThis.crypto)==null?void 0:e.randomUUID)==null?void 0:t.call(e))??null}catch{$o=null}return $o??($o=`boot-${Math.random().toString(36).slice(2)}${Math.random().toString(36).slice(2)}`),$o}function t_(e){try{const t={};for(const[n,r]of Object.entries(e))r!=null&&r!==""&&(t[n]=r);Kn.register(t)}catch{}}function QM(e){try{const t=JM(e);Kn.register({journey:t,view:e$(e)})}catch{}}function e$(e){return e.settingsOpen?"settings":e.firstRun&&!e.hasLiveSession?"welcome":e.templatesOpen?"templates":e.hasLiveSession?`workbench:${e.rightTab??"chat"}`:e.inspectingDeadSession?"session_history":"unknown"}const t$=4e3,s$=220,xS={light:'<script>(function(){var r=window.document.documentElement;r.setAttribute("data-canvas-theme","light");r.setAttribute("data-theme","light");})();<\/script>',dark:'<script>(function(){var r=window.document.documentElement;r.setAttribute("data-canvas-theme","dark");r.setAttribute("data-theme","dark");})();<\/script>'};function n$(e,t){return`${e}${t==="dark"?xS.dark:xS.light}`}function i$(e){if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.kind=="string"&&typeof t.label=="string"}function r$({sessionId:e,lastMessage:t,subjectWorkflow:n,source:r,loadWorkflowGraph:o,overviewActive:c,sessionExited:h,expanded:l,onToggleExpanded:u,macros:m,tasks:g,onRunMacro:p,onInjectPrompt:S,onDescribeWorkflow:x,surface:A,onOpenSteps:E,run:y,runTarget:b,runs:v,onSelectRun:_,preview:k,deployState:C,onDismissDeploy:w,onOpenCode:T,workflows:j,onOpenWorkflow:M,onCanvasState:D,onGraphChange:L}){const[q,F]=O.useState(!1),Y=O.useRef(D);Y.current=D;const Q=O.useRef(L);Q.current=L;const G=O.useRef((n==null?void 0:n.path)??null);G.current=(n==null?void 0:n.path)??null;const ee=r.kind==="agent"?r.path:null,ne=r.kind==="session"?r.sessionId:null,[z,B]=O.useState(0),[$,H]=O.useState(rf()),[U,P]=O.useState(!1),[W,se]=O.useState(!0),[X,V]=O.useState(!1),ue=O.useRef(null),oe=O.useRef(null),Z=O.useRef(0),te=O.useCallback(()=>{se(!1),V(!0),ue.current&&clearTimeout(ue.current),ue.current=setTimeout(()=>V(!1),360)},[]),pe=()=>{const ce=Z.current-Date.now();oe.current&&clearTimeout(oe.current),ce>0?oe.current=setTimeout(te,ce):te()};O.useEffect(()=>()=>{ue.current&&clearTimeout(ue.current),oe.current&&clearTimeout(oe.current)},[]),O.useEffect(()=>{if(!W)return;const ce=window.setTimeout(te,t$);return()=>window.clearTimeout(ce)},[W,te]);const[ye,ke]=O.useState(1),[Le,Ie]=O.useState({x:0,y:0}),[qe,Re]=O.useState(!1),He=O.useRef(null),Ke=O.useRef(null),[kt,ot]=O.useState(.25),Ct=ce=>Math.min(3,Math.max(kt,Math.round(ce*100)/100)),[wt,Mt]=O.useState(null),jt=O.useRef(!1),[Lt,ss]=O.useState({zoom:1,x:0,y:0}),as=O.useCallback(()=>{const ce=He.current;if(!wt||!ce)return null;const Me=ce.getBoundingClientRect();if(Me.width<80||Me.height<80)return null;const Pe=Me.width-wt.insetX*2,Ue=Me.height-wt.insetTop-wt.insetBottom;if(Pe<=0||Ue<=0)return null;const Ze=Math.min(1,Pe/wt.width,Ue/wt.height);return{zoom:Math.max(.1,Math.round(Ze*100)/100),x:0,y:0}},[wt]),os=O.useCallback(()=>{let ce=12;const Me=()=>{const Pe=as();if(Pe){ot(Math.min(.25,Pe.zoom)),jt.current=!1,ke(Pe.zoom),Ie({x:Pe.x,y:Pe.y}),ss(Pe);return}if(wt&&ce-- >0){requestAnimationFrame(Me);return}ot(.25),jt.current=!1,ke(1),Ie({x:0,y:0}),ss({zoom:1,x:0,y:0})};Me()},[as,wt]);O.useEffect(()=>{!wt||jt.current||os()},[wt,os]),O.useEffect(()=>{const ce=He.current;if(!ce||typeof ResizeObserver>"u")return;const Me=new ResizeObserver(()=>{jt.current||os()});return Me.observe(ce),()=>Me.disconnect()},[os]),O.useEffect(()=>{var Pe,Ue,Ze;(Ue=(Pe=Ke.current)==null?void 0:Pe.contentWindow)==null||Ue.postMessage({type:"sapiom-canvas:view",zoom:ye,x:Le.x,y:Le.y},"*");const ce=fi.current,Me=Ke.current;if(ce&&Me){const _t=Me.getBoundingClientRect();(Ze=Me.contentWindow)==null||Ze.postMessage({type:"sapiom-canvas:hover",x:ce.x-_t.left,y:ce.y-_t.top},"*")}},[ye,Le]),O.useEffect(()=>{const ce=He.current;if(!ce)return;const Me=Pe=>{Pe.preventDefault(),jt.current=!0,ke(Ue=>Ct(Ue*(Pe.deltaY<0?1.1:1/1.1)))};return ce.addEventListener("wheel",Me,{passive:!1}),()=>ce.removeEventListener("wheel",Me)});const vt=ce=>{var Ue,Ze;const Me=Ke.current;if(!Me)return;const Pe=Me.getBoundingClientRect();if(typeof ce.clientX=="number"&&typeof ce.clientY=="number"){const{clientX:_t,clientY:Fe,...Cs}=ce;(Ue=Me.contentWindow)==null||Ue.postMessage({...Cs,x:_t-Pe.left,y:Fe-Pe.top},"*");return}(Ze=Me.contentWindow)==null||Ze.postMessage(ce,"*")},[Ds,ls]=O.useState(!1),Kt=O.useRef(!1),pt=O.useRef(0),fi=O.useRef(null),cs=ce=>{if(fi.current={x:ce.clientX,y:ce.clientY},qe)return;const{clientX:Me,clientY:Pe}=ce;cancelAnimationFrame(pt.current),pt.current=requestAnimationFrame(()=>{vt({type:"sapiom-canvas:hover",clientX:Me,clientY:Pe})})},ji=()=>{cancelAnimationFrame(pt.current),fi.current=null,ls(!1),Kt.current=!1,vt({type:"sapiom-canvas:hover",x:-1,y:-1})},ln=ce=>{if(ce.button!==0)return;const Me=ce.currentTarget;try{Me.setPointerCapture(ce.pointerId)}catch{}Re(!0),vt({type:"sapiom-canvas:press",clientX:ce.clientX,clientY:ce.clientY,down:!0});let Pe=!0;const Ue=()=>{Pe&&(Pe=!1,vt({type:"sapiom-canvas:press",down:!1}))};let Ze=ce.clientX,_t=ce.clientY;const Fe=ce.clientX,Cs=ce.clientY,et=Rt=>{const Gs=Rt.clientX-Ze,ct=Rt.clientY-_t;Ze=Rt.clientX,_t=Rt.clientY,(Math.abs(Rt.clientX-Fe)>=4||Math.abs(Rt.clientY-Cs)>=4)&&(Ue(),jt.current=!0),Ie(_s=>({x:_s.x+Gs,y:_s.y+ct}))},st=Rt=>{Re(!1),Ue(),Me.removeEventListener("pointermove",et),Me.removeEventListener("pointerup",st),Me.removeEventListener("pointercancel",st),Math.abs(Rt.clientX-Fe)<4&&Math.abs(Rt.clientY-Cs)<4&&(vt({type:"sapiom-canvas:pick",clientX:Rt.clientX,clientY:Rt.clientY}),Kt.current||Rs(null))};Me.addEventListener("pointermove",et),Me.addEventListener("pointerup",st),Me.addEventListener("pointercancel",st)},[rt,Rs]=O.useState(null);O.useEffect(()=>{if(A==="steps"&&y&&l||!l&&rt==null)return;const ce=Me=>{Me.key==="Escape"&&(rt!=null?Rs(null):u())};return window.addEventListener("keydown",ce),()=>window.removeEventListener("keydown",ce)},[l,rt,u,y,A]);const[us,As]=O.useState(!0),[cn,_n]=O.useState(!1),[yn,bn]=O.useState(null),[ds,pi]=O.useState(null),[Os,un]=O.useState(null),[mi,Qe]=O.useState(null);O.useEffect(()=>{const ce=Me=>{var Ue,Ze,_t;const Pe=Me.data;if(!(!Pe||Me.source!==((Ue=Ke.current)==null?void 0:Ue.contentWindow))){if(Pe.type==="sapiom-canvas:overview")bn({description:typeof Pe.description=="string"?Pe.description:"",stats:typeof Pe.stats=="string"?Pe.stats:"",notes:Array.isArray(Pe.notes)?Pe.notes.filter(Fe=>typeof Fe=="string"):[],badges:Array.isArray(Pe.badges)?Pe.badges.filter(Fe=>typeof Fe=="string"):[],legend:Array.isArray(Pe.legend)?Pe.legend.filter(i$):[]});else if(Pe.type==="sapiom-canvas:graph"){const Fe=KR(Pe.graph);un(Fe);const Cs=G.current;Fe&&Cs&&((Ze=Q.current)==null||Ze.call(Q,Cs,Fe)),(_t=Y.current)==null||_t.call(Y,!0)}else if(Pe.type==="sapiom-canvas:node"){const Fe=Pe.id;typeof Fe=="string"&&Rs(Fe)}else if(Pe.type==="sapiom:node-click"){const Fe=Pe.stepName;typeof Fe=="string"&&un(Cs=>{if(Cs){const et=Cs.nodes.find(st=>st.label===Fe)??Cs.nodes.find(st=>st.id===Fe)??null;et&&Rs(et.id)}return Cs})}else if(Pe.type==="sapiom-canvas:hit"){const Fe=typeof Pe.id=="string";ls(Fe),Kt.current=Fe}else if(Pe.type==="sapiom-canvas:size"){const Fe=Pe;typeof Fe.width=="number"&&Fe.width>0&&typeof Fe.height=="number"&&Fe.height>0&&Mt({width:Fe.width,height:Fe.height,insetTop:typeof Fe.insetTop=="number"&&Fe.insetTop>=0?Fe.insetTop:0,insetBottom:typeof Fe.insetBottom=="number"&&Fe.insetBottom>=0?Fe.insetBottom:0,insetX:typeof Fe.insetX=="number"&&Fe.insetX>=0?Fe.insetX:0})}else if(Pe.type==="sapiom-canvas:error"){const Fe=Pe;pi({title:typeof Fe.title=="string"?Fe.title:"",reason:typeof Fe.reason=="string"?Fe.reason:""})}}};return window.addEventListener("message",ce),()=>window.removeEventListener("message",ce)},[]),O.useEffect(()=>{bn(null),pi(null),un(null),Rs(null),Qe(null),As(!0),ls(!1),Kt.current=!1,Mt(null),ke(1),Ie({x:0,y:0}),ss({zoom:1,x:0,y:0}),jt.current=!1},[e,z]);const Xs=Os&&rt?Os.nodes.find(ce=>ce.id===rt)??null:null;O.useEffect(()=>{var ce,Me;(Me=(ce=Ke.current)==null?void 0:ce.contentWindow)==null||Me.postMessage({type:"sapiom-canvas:select",id:rt},"*")},[rt]);const nt=O.useCallback(()=>{var ce,Me;!y||!b||ee==null&&ne==null||W||(Me=(ce=Ke.current)==null?void 0:ce.contentWindow)==null||Me.postMessage({type:"sapiom:run-state",steps:y.steps,status:y.status,target:b},"*")},[y,b,ee,ne,W]);O.useEffect(()=>{nt()},[nt]);const Sn=yn??void 0,[Ls,Et]=O.useState(new Set);O.useEffect(()=>Mv(H),[]),O.useEffect(()=>{var Me;if(ee!=null)return;if(se(!0),!e){F(!1),(Me=Y.current)==null||Me.call(Y,!1);return}F(!1);let ce=!1;return P(!0),fetch(`/canvas/${e}/`,{method:"HEAD"}).then(Pe=>{var Ue;ce||(F(Pe.ok),Pe.ok||(Ue=Y.current)==null||Ue.call(Y,!1))}).catch(()=>{}).finally(()=>!ce&&P(!1)),()=>{ce=!0}},[e,ee]);const[Yt,dn]=O.useState(null),[Ts,hn]=O.useState(0),An=O.useRef(o);An.current=o,O.useEffect(()=>{if(ee==null){dn(null);return}let ce=!1;se(!0),P(!0);const Me=setTimeout(()=>{An.current(ee).then(Pe=>{ce||dn({path:ee,status:Pe.status,document:Pe.document,reason:Pe.reason})}).catch(Pe=>{if(ce)return;const Ue=Pe instanceof gn&&Pe.status===404?"notRegistered":Pe instanceof gn&&Pe.status===400?"rejected":"unreachable";dn({path:ee,status:Ue,document:null,reason:Pe instanceof Error?Pe.message:null})}).finally(()=>{ce||P(!1)})},s$);return()=>{ce=!0,clearTimeout(Me),P(!1)}},[ee,Ts]),O.useEffect(()=>{(t==null?void 0:t.type)==="canvas.reload"&&hn(ce=>ce+1)},[t]),O.useEffect(()=>{!t||!e||t.type==="canvas.reload"&&t.harnessSessionId===e&&(F(!0),se(!0),B(ce=>ce+1))},[t,e]);const Js=(n==null?void 0:n.path)??null;O.useEffect(()=>{se(!0),B(ce=>ce+1),ke(1),Ie({x:0,y:0}),ss({zoom:1,x:0,y:0}),jt.current=!1},[Js]);const Fs=g.filter(ce=>ce.harnessSessionId===e&&(ce.workflowPath==null||ce.workflowPath===Js)),xs=Fs.some(ce=>ce.status==="running"&&ce.macroId==="describe"),Pt=Fs.find(ce=>ce.status==="running"&&ce.macroId!=="describe")??null,re=Fs.filter(ce=>ce.status!=="running"&&ce.macroId!=="describe").sort((ce,Me)=>(Me.endedAt??"").localeCompare(ce.endedAt??""))[0],he=!Pt&&(re==null?void 0:re.status)==="failed"&&!Ls.has(re.id)?re:null,xe=he?m.find(ce=>ce.id===he.macroId)??null:null,be=m.find(ce=>ce.id==="visualize")??null,Ce=ne!=null&&!0,Xe=ee!=null&&(Yt==null?void 0:Yt.path)===ee?Yt:null,at=Xe!=null&&(Xe.status==="ok"||Xe.status==="preparing")&&Xe.document!=null?Xe.document:null,Je=r.kind==="agent"?at!=null:q&&Ce,le=d.jsx(d.Fragment,{children:C&&d.jsx(i3,{deployState:C,workflow:n,onDismiss:w,onOpenCode:T})}),$e=Xe==null||at!=null?null:Xe.status==="empty"?{testId:"canvas-empty-route-empty",icon:"Workflow",title:A==="steps"?"No steps yet":"Nothing rendered yet",body:Xe.reason??"This agent has no diagram yet; it is generated from its code."}:Xe.status==="error"?{testId:"canvas-empty-route-error",icon:"TriangleAlert",title:"Couldn't read this agent's diagram",body:Xe.reason??"The diagram extraction failed."}:Xe.status==="notRegistered"?{testId:"canvas-empty-route-unregistered",icon:"Radio",title:"Studio doesn't know this agent",body:"The path is not a registered agent — rescan the project to pick it up again."}:{testId:"canvas-empty-route-unavailable",icon:"Radio",title:"Couldn't load this agent's board",body:Xe.reason??"The harness didn't answer."};return d.jsxs("aside",{className:"canvas-pane",...Ot({surface:"canvas"}),children:[n&&!c&&d.jsx(v3,{workflow:n,detailStep:null,onBack:()=>{},onAskAgent:S,surface:A,stepsSummary:Os&&Os.nodes.length>0?GR(Os):null,run:y,runTarget:b,runs:v,onSelectRun:_}),c||r.kind==="none"?A==="steps"?d.jsx(En,{className:"canvas-empty",icon:"Radio",title:"No session",body:"Start a session to see the agent's steps here."}):d.jsx(En,{className:"canvas-empty",icon:"Radio",title:"No session",body:"Start a session to see its canvas here."}):he?d.jsxs("div",{className:"canvas-task-failed","data-testid":"canvas-task-failed",children:[d.jsxs("p",{className:"canvas-task-title",children:[d.jsx(de,{name:"TriangleAlert",size:14})," ",he.label," failed."]}),he.errorTail&&d.jsx("pre",{className:"canvas-task-error",children:he.errorTail}),d.jsxs("div",{className:"canvas-task-actions",children:[xe&&d.jsx("button",{className:"btn-primary","data-testid":"canvas-task-retry",onClick:()=>p(xe),children:"Retry"}),d.jsx("button",{className:"btn-ghost","data-testid":"canvas-task-dismiss",onClick:()=>Et(ce=>{const Me=new Set(ce);return Me.add(he.id),Me}),children:"Dismiss"})]})]}):Pt&&!Je?d.jsxs("div",{className:"canvas-task-activity","data-testid":"canvas-task-activity",children:[d.jsx("span",{className:"canvas-task-icon","aria-hidden":"true",children:d.jsx(de,{name:"Workflow",size:20})}),d.jsx("div",{className:"canvas-task-title",children:d.jsxs("span",{children:[Pt.label," is running…"]})}),Pt.statusLines.length>0&&d.jsx("ul",{className:"canvas-task-lines","data-testid":"canvas-task-lines",children:Pt.statusLines.slice(-8).map((ce,Me)=>d.jsx("li",{children:ce},`${Me}-${ce}`))}),d.jsx("p",{className:"canvas-empty-hint",children:"Running as a background task, so your session stays free. The canvas reloads here when it finishes."})]}):U?d.jsxs("div",{className:"canvas-loading","data-testid":"canvas-loading",children:[d.jsx("span",{className:"canvas-task-spinner","aria-hidden":"true"}),d.jsx("p",{className:"canvas-empty-hint",children:A==="steps"?"Loading steps…":"Loading canvas…"})]}):!Je&&A==="steps"&&(y||C)?d.jsx("div",{className:"canvas-frame-wrap","data-view":"steps",children:d.jsxs("div",{className:"canvas-steps-surface","data-testid":"canvas-steps-surface",children:[le,y&&d.jsx(m1,{run:y,target:b,workflow:n,focus:l,onToggleFocus:u,onAskAgent:S,onInspectionOpened:()=>Vs("run.inspection_opened",{target:b??"unknown"}),onArtifactViewed:()=>Vs("run.artifact_viewed",{target:b??"unknown"}),onDashboardOpened:()=>Vs("run.dashboard_opened",{target:b??"unknown"})})]})}):$e?d.jsx(En,{className:"canvas-empty",testId:$e.testId,icon:$e.icon,title:$e.title,body:$e.body}):!Je&&h?d.jsx(En,{className:"canvas-empty",testId:"canvas-empty-exited",icon:"History",title:"Session ended",body:`Resume the session to see ${A==="steps"?"the agent's steps":"the agent's diagram"} here.`}):Je?d.jsx("div",{className:"canvas-frame-wrap"+(l&&A==="board"?" is-expanded":""),"data-view":A==="board"?"board":"steps",children:d.jsx("div",{className:"canvas-slide-track",children:d.jsxs("div",{className:"canvas-slide-pane",children:[d.jsxs("div",{className:"canvas-visual"+(A==="steps"?" is-offstage":""),children:[d.jsxs("div",{className:"canvas-view-controls","data-testid":"canvas-view-controls",children:[d.jsx("button",{className:"theme-toggle","data-testid":"canvas-zoom-out","aria-label":"Zoom out",title:"Zoom out",disabled:ye<=kt+.001,onClick:()=>{jt.current=!0,ke(ce=>Math.max(kt,Math.round((ce-.25)*100)/100))},children:d.jsx(de,{name:"ZoomOut",size:14})}),d.jsxs("button",{className:"theme-toggle canvas-zoom-reset","data-testid":"canvas-zoom-reset","aria-label":"Reset zoom",title:"Reset zoom",disabled:ye===1,onClick:()=>{jt.current=!0,ke(1)},children:[Math.round(ye*100),"%"]}),d.jsx("button",{className:"theme-toggle","data-testid":"canvas-zoom-in","aria-label":"Zoom in",title:"Zoom in",disabled:ye>=2,onClick:()=>{jt.current=!0,ke(ce=>Math.min(2,Math.round((ce+.25)*100)/100))},children:d.jsx(de,{name:"ZoomIn",size:14})}),d.jsx("button",{className:"theme-toggle","data-testid":"canvas-fit","aria-label":"Fit to view",title:"Fit to view",disabled:ye===Lt.zoom&&Le.x===Lt.x&&Le.y===Lt.y,onClick:os,children:d.jsx(de,{name:"Frame",size:14})})]}),l&&d.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:u,children:d.jsx(de,{name:"Minimize2",size:14})}),(W||X)&&d.jsxs("div",{className:"canvas-skeleton canvas-loading--overlay"+(W?"":" is-fading"),"data-testid":"canvas-loading",role:"status","aria-label":"Rendering diagram",children:[d.jsx("div",{className:"canvas-skeleton-block canvas-skeleton-title"}),d.jsxs("div",{className:"canvas-skeleton-row",children:[d.jsx("div",{className:"canvas-skeleton-block"}),d.jsx("div",{className:"canvas-skeleton-block"})]}),d.jsxs("div",{className:"canvas-skeleton-row",children:[d.jsx("div",{className:"canvas-skeleton-block"}),d.jsx("div",{className:"canvas-skeleton-block"}),d.jsx("div",{className:"canvas-skeleton-block"})]}),d.jsx("div",{className:"canvas-skeleton-block canvas-skeleton-wide"})]}),ds&&d.jsxs("div",{className:"canvas-render-error","data-testid":"canvas-render-error",children:[d.jsx("span",{className:"canvas-error-icon","aria-hidden":"true",children:d.jsx(de,{name:"TriangleAlert",size:20})}),d.jsx("div",{className:"canvas-task-title",children:"Render failed"}),d.jsx("p",{className:"canvas-error-summary",children:(()=>{const ce=ds.reason.trim();return ce.length<4?"The agent graph could not be extracted. Open the terminal for details.":ce.includes(": ")?ce.slice(ce.indexOf(": ")+2).split(". ")[0]:ce})()}),d.jsxs("div",{className:"canvas-error-actions",children:[d.jsx("button",{className:"btn-primary","data-testid":"canvas-error-fix",onClick:()=>S(`The canvas render for ${ds.title||"this agent"} failed: ${ds.reason} Fix the project so the agent graph extracts cleanly.`),children:"Ask coding agent to fix"}),d.jsx("button",{className:"btn-ghost","data-testid":"canvas-error-retry",onClick:()=>{be?p(be):(Z.current=Date.now()+900,se(!0),B(ce=>ce+1))},children:"Retry"})]}),d.jsxs("details",{className:"canvas-error-details",children:[d.jsx("summary",{children:"Details"}),d.jsx("pre",{children:ds.reason.trim().length>=4?ds.reason:"The rendered document reported a failure without details. Re-render the diagram or check the terminal."})]})]}),Pt&&d.jsxs("div",{className:"canvas-task-activity canvas-task-activity--overlay","data-testid":"canvas-task-activity",children:[d.jsx("span",{className:"canvas-task-icon","aria-hidden":"true",children:d.jsx(de,{name:"Workflow",size:20})}),d.jsx("div",{className:"canvas-task-title",children:d.jsxs("span",{children:[Pt.label," is running…"]})}),Pt.statusLines.length>0&&d.jsx("ul",{className:"canvas-task-lines","data-testid":"canvas-task-lines",children:Pt.statusLines.slice(-8).map((ce,Me)=>d.jsx("li",{children:ce},`${Me}-${ce}`))}),d.jsx("p",{className:"canvas-empty-hint",children:"Running as a background task, so your session stays free. The canvas reloads here when it finishes."})]}),Sn&&!us&&!Xs&&d.jsx("button",{className:"theme-toggle canvas-overview-open","data-testid":"canvas-overview-toggle","aria-label":"Show agent overview","data-tooltip":"Show agent overview",onClick:()=>As(!0),children:"i"}),A==="board"&&d.jsx("button",{className:"theme-toggle canvas-chat-toggle"+(cn?" is-active":""),"data-testid":"canvas-chat-toggle","aria-label":cn?"Close chat":"Open chat","data-tooltip":"Chat — ask about this agent or the selected step",onClick:()=>_n(ce=>!ce),children:d.jsx(de,{name:"MessageSquare",size:14})}),d.jsx("iframe",{ref:Ke,className:"canvas-iframe",...at!=null?{srcDoc:n$(at,$)}:{src:`/canvas/${e}/?theme=${$}`},sandbox:"allow-scripts",scrolling:"no",onLoad:()=>{var ce,Me,Pe,Ue;pe(),(Me=(ce=Ke.current)==null?void 0:ce.contentWindow)==null||Me.postMessage({type:"sapiom-canvas:view",zoom:ye,x:Le.x,y:Le.y},"*"),y&&b&&(at!=null||Ce)&&((Ue=(Pe=Ke.current)==null?void 0:Pe.contentWindow)==null||Ue.postMessage({type:"sapiom:run-state",steps:y.steps,status:y.status,target:b},"*"))},onError:te},at!=null?`wf:${ee}:${Ts}`:`${e}:${z}`),d.jsx("div",{ref:He,className:"canvas-pan-layer"+(qe?" is-panning":""),"data-testid":"canvas-pan-layer","data-over-node":Ds&&!qe?"true":void 0,onPointerDown:ln,onPointerMove:cs,onPointerLeave:ji,onDoubleClick:os})]}),A==="steps"&&d.jsxs("div",{className:"canvas-steps-surface","data-testid":"canvas-steps-surface",children:[le,y?d.jsx(m1,{run:y,target:b,workflow:n,focus:l,onToggleFocus:u,onAskAgent:S,onInspectionOpened:()=>Vs("run.inspection_opened",{target:b??"unknown"}),onArtifactViewed:()=>Vs("run.artifact_viewed",{target:b??"unknown"}),onDashboardOpened:()=>Vs("run.dashboard_opened",{target:b??"unknown"})}):Os&&Os.nodes.length>0?d.jsx(c3,{graph:Os,run:y,runTarget:b,workflows:j,onOpenWorkflow:M,onAskAgent:S,expandedId:mi,onToggle:ce=>Qe(Me=>Me===ce?null:ce)}):d.jsx(En,{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."})]}),A==="board"&&(Sn&&us||Xs)&&d.jsx(f3,{overview:Sn??null,selectedNode:Xs,graph:Os,run:y,workflows:j,onOpenWorkflow:M,onOpenSteps:()=>{rt&&Qe(rt),E()},onDeselect:()=>Rs(null),onCollapse:()=>As(!1),onDescribeWithAI:n&&e&&!h?()=>x(n):void 0,describing:xs}),A==="board"&&cn&&d.jsx(h3,{node:Xs,run:y,onInjectPrompt:S,onClose:()=>_n(!1)})]})})}):d.jsx(En,{className:"canvas-empty",icon:"Workflow",title:A==="steps"?"No steps yet":"Nothing generated yet",body:A==="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 a$="https://tools.sapiom.ai",o$="x-sapiom-api-key",l$="YOUR_SAPIOM_API_KEY";function c$(e){return e==null?"{ /* your input */ }":JSON.stringify(e,null,2).replace(/\n/g,`
|
|
470
|
+
`)}function u$(e){return e==null?"{}":JSON.stringify(e)}function d$(e){return e.replace(/'/g,"'\\''")}function h$(e,t){return`import { agents } from "@sapiom/tools";
|
|
471
|
+
|
|
472
|
+
const result = await agents.run({
|
|
473
|
+
definition: ${JSON.stringify(e)},
|
|
474
|
+
input: ${c$(t)},
|
|
475
|
+
});
|
|
476
|
+
|
|
477
|
+
if (result.status === "completed") {
|
|
478
|
+
console.log(result.output);
|
|
479
|
+
}
|
|
480
|
+
`}function f$(e,t,n){const r=d$(`{ "input": ${u$(t)} }`),o=encodeURIComponent(e);return`curl -X POST ${n}/agents/v1/definitions/${o}/executions \\
|
|
481
|
+
-H "${o$}: ${l$}" \\
|
|
482
|
+
-H "Content-Type: application/json" \\
|
|
483
|
+
-d '${r}'
|
|
484
|
+
`}function p$(e){const{definition:t,inputSample:n,baseUrl:r=a$}=e;return{typescript:h$(t,n),curl:f$(t,n,r)}}const m$=new Set(["pending","queued","building"]),g$=new Set(["failed","cancelled","superseded","stale"]);function za(e,t=null){return e.activeBuildRunStatus==="ready"?"ready":e.activeBuildRunStatus!=null&&m$.has(e.activeBuildRunStatus)?"building":t!=null||e.activeBuildRunStatus!=null&&g$.has(e.activeBuildRunStatus)?"failed":e.definitionId==null?"draft":"linked"}function Sh(e){return(e==null?void 0:e.activeBuildRunStatus)==="ready"}function v$(e,t=null){switch(za(e,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 _$="https://app.sapiom.ai/settings?tab=api-keys";function y$({boundWorkflow:e,agentsBaseUrl:t}){return Sh(e)?d.jsx(b$,{boundWorkflow:e,agentsBaseUrl:t}):null}function b$({boundWorkflow:e,agentsBaseUrl:t}){const[n,r]=O.useState("typescript"),[o,c]=O.useState(!1),h=e.definitionSlug==null,l=e.definitionSlug??e.name,{typescript:u,curl:m}=p$({definition:l,baseUrl:t}),g=n==="typescript"?u:m,p=()=>{navigator.clipboard.writeText(g).then(()=>{c(!0),window.setTimeout(()=>c(!1),2e3)}).catch(()=>{})};return d.jsxs("div",{className:"snippet-panel","data-testid":"snippet-panel",...Ot({object:"snippet"}),children:[d.jsx("div",{className:"snippet-panel-header",children:d.jsx("span",{className:"snippet-panel-title",children:"Trigger from your code"})}),d.jsxs("div",{className:"snippet-slug-row",children:[d.jsx("span",{className:"snippet-slug-label",children:"Agent"}),d.jsx("code",{className:"snippet-slug","data-testid":"snippet-slug",children:l})]}),h&&d.jsx("p",{className:"snippet-slug-inferred","data-testid":"snippet-slug-inferred",children:"Inferred from the project name. Confirm it matches your deployed agent."}),d.jsxs("div",{className:"snippet-tabs",role:"tablist","aria-label":"Snippet language",children:[d.jsx("button",{role:"tab","aria-selected":n==="typescript","aria-controls":"snippet-code-panel",className:"snippet-tab"+(n==="typescript"?" is-active":""),"data-testid":"snippet-tab-ts",onClick:()=>r("typescript"),children:"TypeScript (SDK)"}),d.jsx("button",{role:"tab","aria-selected":n==="curl","aria-controls":"snippet-code-panel",className:"snippet-tab"+(n==="curl"?" is-active":""),"data-testid":"snippet-tab-curl",onClick:()=>r("curl"),children:"cURL (HTTP)"})]}),d.jsxs("div",{className:"snippet-code-wrap",role:"tabpanel",id:"snippet-code-panel",children:[d.jsx("pre",{className:"snippet-code","data-testid":"snippet-code",children:d.jsx("code",{children:g})}),d.jsx("button",{className:"snippet-copy"+(o?" is-copied":""),"data-testid":"snippet-copy","aria-label":o?"Copied":"Copy snippet",onClick:p,children:o?"Copied":"Copy"})]}),d.jsxs("p",{className:"snippet-hint","data-testid":"snippet-hint",children:[n==="typescript"?d.jsxs(d.Fragment,{children:["Install ",d.jsx("code",{children:"@sapiom/tools"}),", set ",d.jsx("code",{children:"SAPIOM_API_KEY"}),", and replace the sample input. The SDK call waits for a terminal run and returns its result."]}):d.jsxs(d.Fragment,{children:["Replace ",d.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"," ",d.jsx("a",{className:"snippet-link","data-testid":"snippet-api-key-link",href:_$,target:"_blank",rel:"noreferrer",children:"Sapiom dashboard"}),"."]})]})}function S$({boundWorkflow:e,noSessionAgent:t=null,agentsBaseUrl:n,lastDeployError:r=null}){if(!e)return d.jsx(En,{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 o=za(e,r),c=o==="ready",h=o==="building"?"Building":o==="failed"?"Deploy failed":o==="linked"?"Linked":"Draft",l=o==="building"?"Cloud build in progress":o==="failed"?"Deploy did not produce a ready build":o==="linked"?"No ready deployment yet":"Deploy to trigger from code",u=o==="building"?`${e.name} is linked and building. Integration snippets appear after the cloud build is ready.`:o==="failed"?`Fix ${e.name} and retry Deploy. Studio only shows integration snippets for a ready cloud build.`:o==="linked"?`${e.name} is linked to Sapiom, but Studio cannot confirm a ready cloud build. Deploy it before integrating.`:`${e.name} is a draft. Once it deploys, TypeScript SDK and cURL starter calls appear here.`;return d.jsxs("div",{className:"code-panel",...Ot({surface:"code_panel"}),children:[d.jsxs("div",{className:"workflow-actions-header code-panel-header","data-testid":"code-panel-header",children:[d.jsx("span",{className:"workflow-actions-name",children:e.name}),c?d.jsxs("span",{className:"status-tag workflow-deployed-tag","data-testid":"code-panel-status","data-tooltip":"Ready cloud build",children:[d.jsx("span",{className:"workflow-dot workflow-dot-pinned","aria-hidden":"true"}),"Deployed"]}):d.jsxs("span",{className:"status-tag code-panel-draft-tag","data-testid":"code-panel-status","data-tooltip":l,children:[d.jsx(de,{name:"CloudOff",size:13}),h]})]}),c?d.jsx("div",{className:"code-panel-body","data-testid":"code-panel-body",children:d.jsx(y$,{boundWorkflow:e,agentsBaseUrl:n},e.path)}):d.jsx(En,{className:"code-panel-empty",icon:"Code",title:l,body:u})]})}const w$="https://docs.sapiom.ai/",x$=[{label:"Agents quick start",meta:"Run your first agent",href:"https://docs.sapiom.ai/agents/quick-start"},{label:"Workflows quick start",meta:"Typed steps, gates and exits",href:"https://docs.sapiom.ai/workflows/quick-start"},{label:"AI models",meta:"Which models a capability can call",href:"https://docs.sapiom.ai/capabilities/ai-models"},{label:"MCP servers: setup",meta:"Connect a server to a workspace",href:"https://docs.sapiom.ai/integration/mcp-servers/setup"},{label:"MCP servers: remote",meta:"Reach a server you do not host",href:"https://docs.sapiom.ai/integration/mcp-servers/remote"}],hv=1,fv=12,i2=10,r2=20,C$=25,E$=e=>-(3+Math.min(e,9)),k$=new Set(["/","\\","-","_",".",":"," "]),CS=e=>e>="0"&&e<="9",j$=e=>e!==e.toUpperCase()&&e===e.toLowerCase(),R$=e=>e!==e.toLowerCase()&&e===e.toUpperCase();function A$(e){const t=new Array(e.length);for(let n=0;n<e.length;n++){if(n===0){t[n]=!0;continue}const r=e[n-1],o=e[n];t[n]=k$.has(r)||CS(o)!==CS(r)||R$(o)&&j$(r)}return t}function T$(e,t,n,r){var S;const o=e.length,c=t.length,h=(x,A)=>{let E=hv;n[A]&&(E+=fv),A===x+1&&(E+=i2);const y=A-x-1;return y>=1&&(E+=E$(y)),E},l=new Map,u=(x,A)=>{if(x===o-1)return 0;const E=x*c+A,y=l.get(E);if(y!==void 0)return y.score;const b=e[x+1];let v=Number.NEGATIVE_INFINITY,_=-1;if(A+1<c&&t[A+1]===b){const k=h(A,A+1)+u(x+1,A+1);k>v&&(v=k,_=A+1)}for(const k of r.get(b)??[]){if(k<=A+1)continue;const C=h(A,k)+u(x+1,k);C>v&&(v=C,_=k)}return l.set(E,{score:v,next:_}),v};let m=Number.NEGATIVE_INFINITY,g=-1;for(const x of r.get(e[0])??[]){const E=hv+fv+(x===0?r2:0)+u(0,x);E>m&&(m=E,g=x)}if(g===-1||!Number.isFinite(m))return null;const p=[g];for(let x=0,A=g;x<o-1;x++){const E=((S=l.get(x*c+A))==null?void 0:S.next)??-1;p.push(E),A=E}return{score:m,indices:p}}function N$(e,t,n){let r=null;for(let c=0;;){const h=t.indexOf(e,c);if(h===-1)break;let l=h===0?r2:0;for(let u=0;u<e.length;u++)l+=hv,n[h+u]&&(l+=fv),u>0&&(l+=i2);(r===null||l>r.score)&&(r={score:l,start:h}),c=h+1}if(r===null)return null;const o=r.start;return{score:r.score,indices:Array.from({length:e.length},(c,h)=>o+h)}}function sg(e){let t="";for(let n=0;n<e.length;n++){const r=e[n].toLowerCase();t+=r.length===1?r:e[n]}return t}function ES(e,t){const n=[...new Set(sg(e).split(/\s+/).filter(Boolean))];if(n.length===0)return{score:0,indices:[]};if(!t)return null;const r=sg(t),o=A$(t),c=new Map;for(let u=0;u<t.length;u++){if(!o[u])continue;const m=r[u],g=c.get(m);g?g.push(u):c.set(m,[u])}let h=0;const l=new Set;for(const u of n){if(u.length>r.length)return null;const m=T$(u,r,o,c),g=N$(u,r,o),p=m&&g?m.score>=g.score?m:g:m??g;if(!p)return null;h+=p.score;for(const S of p.indices)l.add(S)}return sg(e.trim())===r&&(h+=C$),{score:h,indices:[...l].sort((u,m)=>u-m)}}function kS(e,t){var n;return(n=t[e.id])!=null&&n.trim()?!1:!e.title||e.title===Us(e.cwd)}function Yh(e,t,n){var l;const r=(l=n[e.id])==null?void 0:l.trim();if(r)return r;if(!kS(e,n))return e.title;const o=Us(e.cwd),h=t.filter(u=>u.cwd===e.cwd&&(u.status!=="exited"||u.id===e.id)&&kS(u,n)).sort((u,m)=>u.createdAt.localeCompare(m.createdAt)||u.id.localeCompare(m.id)).findIndex(u=>u.id===e.id);return h>0?`${o} ${h+1}`:o}const cc=[{id:"all",label:"All",icon:"Search"},{id:"sessions",label:"Sessions",icon:"Radio"},{id:"agents",label:"Agents",icon:"Workflow"},{id:"templates",label:"Templates",icon:"LayoutTemplate"},{id:"docs",label:"Docs",icon:"BookOpen"},{id:"files",label:"Files",icon:"Folder"},{id:"actions",label:"Actions",icon:"Zap"}],M$={templates:{label:"Browse templates",actionId:"browse-templates"},docs:{label:"Open documentation",href:w$}},$$=6,D$=6,rd=20,O$=6,a2=36e5,ng=24*a2;function jS(e,t){if(t<=0)return 0;const n=e-t;return n<=a2?30:n<=ng?20:n<=7*ng?12:n<=30*ng?6:0}const ad=e=>{const t=Date.parse(e);return Number.isNaN(t)?0:t},L$=(e,t)=>e.item.recency!==t.item.recency?e.item.recency>t.item.recency:e.fromRegistry!==t.fromRegistry?e.fromRegistry:e.count>t.count;function I$(e){const{sessions:t,workflows:n,history:r,recentDirs:o,sessionNames:c,actions:h,templates:l,activeSessionId:u}=e,m=t.filter(w=>w.status!=="exited").map(w=>({id:`session:${w.id}`,kind:"session",label:Yh(w,t,c),meta:w.cwd,sessionId:w.id,current:w.id===u||void 0,recency:ad(w.lastActiveAt)})),g=new Set(t.map(w=>w.id)),p=new Set(t.map(w=>w.agentSessionId).filter(w=>w!=null)),S=[...t.filter(w=>w.status==="exited").map(w=>({item:{id:`past:${w.id}`,kind:"past",label:Yh(w,t,c),meta:w.cwd,sessionId:w.id,recency:ad(w.lastActiveAt)},cwd:w.cwd,count:0,fromRegistry:!0})),...r.filter(w=>!(w.harnessSessionId!=null&&g.has(w.harnessSessionId))&&!p.has(w.agentSessionId)).map(w=>{var T;return{item:{id:`summary:${w.agentSessionId}`,kind:"past",label:((T=c[w.harnessSessionId??""])==null?void 0:T.trim())||w.title,meta:w.cwd,summary:w,recency:ad(w.lastActiveAt)},cwd:w.cwd,count:w.turnCount??w.messageCount??0,fromRegistry:!1}})],x=new Map;for(const w of S){const T=`${w.item.label.trim()}\0${w.cwd}`,j=x.get(T);(!j||L$(w,j))&&x.set(T,w)}const A=[...x.values()].map(w=>w.item).sort((w,T)=>T.recency-w.recency),E=w=>{let T=0;for(const M of t){if(M.boundWorkflowPath!==w.path&&!Li(w.path,M.cwd))continue;const D=ad(M.lastActiveAt);D>T&&(T=D)}if(T>0)return T;const j=o.findIndex(M=>Li(M,w.path)||Li(w.path,M));return j===-1?0:o.length-j},y=n.map(w=>({id:`agent:${w.path}`,kind:"agent",label:Kr(w.name),meta:w.path,path:w.path,recency:E(w)})),b=new Set(n.map(w=>w.path)),v=o.filter(w=>!b.has(w)).map(w=>({id:`recent:${w}`,kind:"recent",label:Us(w),meta:w,path:w,recency:o.length-o.indexOf(w)})),_=h.map(w=>({id:`command:${w.id}`,kind:"command",label:w.label,meta:w.meta??"",icon:w.icon,run:w.run,recency:0})),k=x$.map(w=>({id:`doc:${w.href}`,kind:"doc",label:w.label,meta:w.meta,href:w.href,recency:0})),C=l.map(w=>({id:`template:${w.id}`,kind:"template",label:w.name,meta:w.description,templateId:w.id,recency:0}));return[...m,...A,...y,...v,...C,...k,..._]}const RS={session:0,agent:1,past:2,recent:3,template:4,doc:5,command:6,path:7},P$={all:["session","agent","past","recent","template","doc","command"],sessions:["session","past"],agents:["agent"],templates:["template"],docs:["doc"],files:["recent"],actions:["command"]},pv=(e,t)=>e.filter(n=>n.kind===t);function Ca(e,t){const n=pv(e,t);return t==="session"?n.sort((r,o)=>(r.current?1:0)-(o.current?1:0)||o.recency-r.recency):t==="past"?n.sort((r,o)=>o.recency-r.recency):t==="agent"?n.sort((r,o)=>o.recency-r.recency||r.label.localeCompare(o.label)):t==="recent"?n.sort((r,o)=>o.recency-r.recency):n}function B$(e,t,n={}){const r=n.filter??"all",o=n.now??Date.now(),c=P$[r],h=e.trim();if(!h){if(r!=="all")return c.flatMap(p=>Ca(t,p)).slice(0,rd);const g=pv(t,"command");return[...Ca(t,"session"),...Ca(t,"past").slice(0,$$),...Ca(t,"agent").slice(0,O$),...Ca(t,"recent"),...Ca(t,"template"),...Ca(t,"doc")].slice(0,Math.max(0,rd-g.length)).concat(g)}const l=g=>{const p=ES(h,g.label);if(p)return{item:{...g,labelIndices:p.indices},fieldRank:0,boosted:p.score+jS(o,g.recency),matchedLength:g.label.length};const S=g.meta?ES(h,g.meta):null;return S?{item:{...g,metaIndices:S.indices},fieldRank:1,boosted:S.score+jS(o,g.recency),matchedLength:g.meta.length}:null},u=c.map(g=>({kind:g,scored:pv(t,g).map(l).filter(p=>p!==null).sort((p,S)=>p.fieldRank-S.fieldRank||S.boosted-p.boosted||S.item.recency-p.item.recency||p.matchedLength-S.matchedLength||p.item.label.localeCompare(S.item.label))})).filter(g=>g.scored.length>0),m=u.length>1?D$:rd;return u.sort((g,p)=>{const S=g.scored[0],x=p.scored[0];return S.fieldRank-x.fieldRank||x.boosted-S.boosted||RS[g.kind]-RS[p.kind]}).flatMap(g=>g.scored.slice(0,m).map(p=>p.item)).slice(0,rd)}function z$(e,t){const n=e.trim();return[...n?[{id:`confirm:${n}`,kind:"path",label:n,meta:"Open this path",path:n,recency:0}]:[],...t.map(o=>({id:`dir:${o.path}`,kind:"path",label:o.name,meta:o.path,path:o.path,recency:0}))]}function H$(e){switch(e.kind){case"command":return e.run?{type:"run",run:e.run}:{type:"none"};case"doc":return e.href?{type:"open-href",href:e.href}:{type:"none"};case"template":return e.templateId?{type:"open-template",templateId:e.templateId}:{type:"none"};case"session":return e.sessionId?{type:"select-session",sessionId:e.sessionId}:{type:"none"};case"past":return e.sessionId?{type:"select-session",sessionId:e.sessionId}:e.summary?{type:"review-summary",summary:e.summary}:{type:"none"};case"agent":case"recent":case"path":return e.path?{type:"open-path",path:e.path}:{type:"none"}}}const U$=/^[a-z0-9][a-z0-9-]{0,213}$/,s_="sapiom-agent",F$=3,AS=32,q$=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 o2(e){return U$.test(e)}function V$(e){var h;const t=e.toLowerCase().replace(/[^a-z0-9]+/g," ").split(" ").filter(Boolean),n=t.filter(l=>!q$.has(l)),r=n.length>0?n:t,o=[];for(const l of r.slice(0,F$)){if((o.length===0?l:`${o.join("-")}-${l}`).length>AS)break;o.push(l)}const c=o.join("-")||((h=r[0])==null?void 0:h.slice(0,AS))||"";return o2(c)?c:s_}function l2(e,t){const n=(t==null?void 0:t.trim())??"",r=e.trim();return!n.replace(/[\\/]+$/,"")||!r?"":$v(n,r)}function G$(e){var t,n,r;return((t=e.settingsRoot)==null?void 0:t.trim())||((n=e.defaultProjectRoot)==null?void 0:n.trim())||((r=e.launchDir)==null?void 0:r.trim())||""}const W$=Gr;function K$(e,t){const n=new Set(t);if(!n.has(e))return e;for(let r=2;r<1e3;r+=1){const o=`${e}-${r}`;if(!n.has(o)&&o2(o))return o}return e}const Xh=[{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."}],Y$={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 X$(e){return e?Y$[e]??e.replace(/-/g," ").replace(/^./,t=>t.toUpperCase()):"Uncategorised"}function n_(e){return e!=null&&e.label?e.score>0?`${e.label} ${e.score}/5`:e.label:"—"}function c2(e){const{basis:t}=e,n=[];t.llmSteps>0&&n.push(`${t.llmSteps} model ${t.llmSteps===1?"step":"steps"}`),t.chainedLlmSteps>0&&n.push(`${t.chainedLlmSteps} chained`),t.mediaCapabilities>0&&n.push(`${t.mediaCapabilities} media ${t.mediaCapabilities===1?"generator":"generators"}`),n.push(`${t.stepCount} ${t.stepCount===1?"step":"steps"}`),t.capabilityCount>0&&n.push(`${t.capabilityCount} ${t.capabilityCount===1?"capability":"capabilities"}`);const r=t.llmSteps===0&&t.mediaCapabilities===0?" · deterministic":"";return`${n.join(", ")}${r}`}function J$(e){return`${e.label}: ${c2(e)}`}function TS(e,t){const n=t.trim().toLowerCase();return n?[e.name,e.description,e.id,...e.kind==="gallery"?e.tags:[],...e.kind==="gallery"?e.capabilities:[]].join(" ").toLowerCase().includes(n):!0}function Z$(e,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 e.kind==="gallery"?`Clone the Sapiom gallery template "${e.id}" into this directory: call the sapiom_dev_agents_clone tool with dir "${t}" and templateId "${e.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 "${e.id}" starter in this directory: ${mv(t,e.id)}, then run npm install and read AGENTS.md. Keep the shipped starter unchanged until the user describes what to build. `+n}function Q$(e,t){return`Clone the deployed Sapiom agent (definition ${e}) into this directory: call the sapiom_dev_agents_clone tool with dir "${t}" and definitionId "${e}". 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 mv(e,t){return"call the sapiom_dev_agents_scaffold tool with "+JSON.stringify({dir:e,template:t})}function eD(e){var o,c;const t=e.steps.map(h=>({id:h.name,kind:h.kind,label:h.name,role:h.kind.startsWith("terminal")?"terminal":h.kind==="entry"?"entry":"step",description:h.description??"",timeoutMs:null,inputSchema:null,capabilities:h.capabilities})),n=new Map;for(const h of e.transitions)h.kind==="continue"&&n.set(h.from,(n.get(h.from)??0)+1);const r=e.transitions.map(h=>({from:h.from,to:h.to,kind:h.kind==="pause"?"cross":(n.get(h.from)??0)>1?"branching":"sequential",label:h.label??""}));return{name:e.name,entry:((o=e.steps.find(h=>h.kind==="entry"))==null?void 0:o.name)??((c=e.steps[0])==null?void 0:c.name)??"",nodes:t,edges:r,groups:[],warnings:[]}}function tD(e,t){const n=e.kind==="starter"&&e.id==="default"?s_:e.id;return l2(n,t)}function sD(e){const t=O.useRef(null),[n,r]=O.useState(null),o=O.useCallback(()=>{const l=t.current;if(!l)return;const u=l.querySelector('[aria-selected="true"]');if(!u){r(null);return}const m=l.getBoundingClientRect(),g=u.getBoundingClientRect();r({x:g.left-m.left+l.scrollLeft,w:g.width})},[]),c=O.useRef(null),h=O.useCallback(l=>{var u;(u=c.current)==null||u.disconnect(),t.current=l,l&&(o(),!(typeof ResizeObserver>"u")&&(c.current=new ResizeObserver(o),c.current.observe(l)))},[o]);return O.useLayoutEffect(()=>{o()},[e,o]),O.useLayoutEffect(()=>()=>{var l;return(l=c.current)==null?void 0:l.disconnect()},[]),{trackRef:h,style:n?{transform:`translateX(${n.x}px)`,width:`${n.w}px`,opacity:1}:{opacity:0}}}const nD={command:"Zap",doc:"BookOpen",session:"Radio",past:"History",agent:"Workflow",recent:"Folder",path:"Folder",template:"LayoutTemplate"},ig={command:"Actions",doc:"Documentation",session:"Sessions",past:"Past sessions",agent:"Agents",recent:"Folders",path:"Folders",template:"Templates"},iD=typeof navigator<"u"&&navigator.platform.toUpperCase().includes("MAC"),rD=iD?"⌘":"Ctrl";function NS(e,t){if(!t||t.length===0)return e;const n=new Set(t),r=[];let o="",c=n.has(0);const h=l=>{o&&(r.push(c?d.jsx("b",{className:"palette-match",children:o},l):o),o="")};for(let l=0;l<e.length;l++){const u=n.has(l);u!==c&&(h(l),c=u),o+=e[l]}return h(e.length),r}function aD({sessions:e,workflows:t,recentDirs:n,history:r,sessionNames:o,activeSessionId:c,actions:h,listDir:l,listTemplates:u,onSelectSession:m,onReviewSummary:g,onOpenPath:p,onOpenTemplate:S,onClose:x}){const[A,E]=O.useState(""),[y,b]=O.useState("all"),[v,_]=O.useState([]),[k,C]=O.useState([]),[w,T]=O.useState(!1),[j,M]=O.useState(!1),[D,L]=O.useState(0),q=sD(y),F=O.useRef(null);O.useEffect(()=>{var B;(B=F.current)==null||B.focus()},[]),O.useEffect(()=>{let B=!1;return _(Xh.map(({id:$,name:H,description:U})=>({id:$,name:H,description:U}))),u().then($=>{B||_([...$.templates.map(({id:H,name:U,description:P})=>({id:H,name:U,description:P})),...Xh.map(({id:H,name:U,description:P})=>({id:H,name:U,description:P}))])}).catch(()=>{}),()=>{B=!0}},[u]);const Y=MR(A);O.useEffect(()=>{if(!Y){C([]),M(!1);return}let B=!1;T(!0),M(!1);const $=setTimeout(()=>{l(A).then(H=>{B||C(H.dirs)}).catch(()=>{B||(C([]),M(!0))}).finally(()=>!B&&T(!1))},150);return()=>{B=!0,clearTimeout($)}},[A,Y,l]);const Q=O.useMemo(()=>Y?z$(A,k):B$(A,I$({sessions:e,workflows:t,history:r,recentDirs:n,sessionNames:o,actions:h,templates:v,activeSessionId:c}),{filter:y}),[A,Y,k,e,t,n,r,o,c,h,v,y]);O.useEffect(()=>{const B=Q.findIndex($=>!$.current);L(B===-1?0:B)},[Q,A,y]);const G=Y?void 0:M$[y],ee=B=>{const $=H$(B);switch($.type){case"run":$.run();break;case"open-href":window.open($.href,"_blank","noopener,noreferrer");break;case"open-template":S($.templateId);break;case"select-session":m($.sessionId);break;case"review-summary":g($.summary);break;case"open-path":p($.path);break}x()},ne=B=>{b($=>{const U=(cc.findIndex(P=>P.id===$)+B+cc.length)%cc.length;return cc[U].id})},z=B=>{if(B.key==="ArrowDown")B.preventDefault(),L($=>Math.min($+1,Q.length-1));else if(B.key==="ArrowUp")B.preventDefault(),L($=>Math.max($-1,0));else if(B.key==="Tab"&&!Y)B.preventDefault(),ne(B.shiftKey?-1:1);else if(B.key==="Enter"){B.preventDefault();const $=Q[D];$&&ee($)}else B.key==="Escape"&&(A?E(""):x())};return d.jsx("div",{className:"modal-backdrop",onClick:x,children:d.jsxs("div",{className:"modal command-palette",onClick:B=>B.stopPropagation(),...Ot({dialog:"command_palette"}),children:[d.jsxs("div",{className:"command-palette-search",children:[d.jsx(de,{name:"Search",size:16}),d.jsx("input",{ref:F,className:"command-palette-input","data-testid":"command-palette-input","aria-label":"Jump to a session, agent, or path",placeholder:"Jump to a session, agent, or path…",value:A,onChange:B=>E(B.target.value),onKeyDown:z}),A&&d.jsx("button",{type:"button",className:"command-palette-clear","data-testid":"command-palette-clear","aria-label":"Clear search",onClick:()=>{var B;E(""),(B=F.current)==null||B.focus()},children:d.jsx(de,{name:"X",size:14})})]}),!Y&&d.jsxs("div",{ref:q.trackRef,className:"command-palette-filters tab-track",role:"tablist","aria-label":"Search filter",children:[d.jsx("span",{className:"tab-indicator",style:q.style,"aria-hidden":"true"}),cc.map(B=>d.jsxs("button",{type:"button",role:"tab","aria-selected":y===B.id,className:"command-palette-filter"+(y===B.id?" is-active":""),"data-testid":`command-palette-filter-${B.id}`,onClick:()=>{var $;b(B.id),($=F.current)==null||$.focus()},children:[d.jsx(de,{name:B.icon,size:14}),B.label]},B.id))]}),d.jsxs("div",{className:"command-palette-list","data-testid":"command-palette-list",children:[Y&&w&&d.jsx("div",{className:"command-palette-empty",children:"Loading…"}),Y&&j&&!w&&d.jsx("div",{className:"command-palette-error","data-testid":"command-palette-error",role:"alert",children:"Couldn't read that path."}),Q.length===0&&!w&&!j&&d.jsx("div",{className:"command-palette-empty",children:"No matches"}),Q.map((B,$)=>d.jsxs("div",{className:"command-palette-row",children:[!Y&&($===0||ig[B.kind]!==ig[Q[$-1].kind])&&d.jsx("div",{className:"command-palette-section","data-testid":"command-palette-section",children:ig[B.kind]}),d.jsxs("button",{type:"button",className:"command-palette-item"+($===D?" is-selected":"")+(B.current?" is-current":""),"data-testid":`command-palette-item-${$}`,onMouseEnter:()=>L($),onClick:()=>ee(B),children:[d.jsx(de,{name:B.icon??nD[B.kind],size:14}),d.jsx("span",{className:"command-palette-item-label",children:NS(B.label,B.labelIndices)}),B.current&&d.jsx("span",{className:"command-palette-current",children:"current"}),d.jsx("span",{className:"command-palette-item-meta","data-code":B.path!=null||B.kind==="session"||B.kind==="past"||void 0,children:B.meta?NS(B.meta,B.metaIndices):null})]})]},B.id))]}),d.jsxs("div",{className:"command-palette-footer","data-testid":"command-palette-footer",children:[d.jsxs("span",{children:[d.jsx("kbd",{children:"↑"}),d.jsx("kbd",{children:"↓"})," navigate"]}),!Y&&d.jsxs("span",{children:[d.jsx("kbd",{children:"tab"})," category"]}),d.jsxs("span",{children:[d.jsx("kbd",{children:"↵"})," open"]}),d.jsxs("span",{children:[d.jsx("kbd",{children:"esc"})," close"]}),G?d.jsxs("button",{type:"button",className:"btn-ghost command-palette-footer-cta","data-testid":"command-palette-destination",onClick:()=>{if(G.href)window.open(G.href,"_blank","noopener,noreferrer");else if(G.actionId){const B=h.find($=>$.id===G.actionId);B&&(B.run(),x())}},children:[G.label,d.jsx(de,{name:G.href?"ExternalLink":"ArrowRight",size:14})]}):d.jsxs("span",{className:"command-palette-footer-mod",children:[d.jsx("kbd",{children:rD}),d.jsx("kbd",{children:"K"})," anytime"]})]})]})})}const oD={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 lD({status:e,onRetry:t,retrying:n=!1,detail:r,onStartAuth:o}){const c=oD[e],[h,l]=O.useState({status:"idle"}),u=async()=>{if(o){l({status:"pending"});try{await o(),l({status:"idle"})}catch(m){const g=m instanceof Error?m.message:"Could not start sign-in. Try again.";l({status:"error",message:g})}}};return d.jsx("div",{className:"app-status connectivity-screen","data-testid":"connectivity-screen","data-status":e,role:"alert",children:d.jsxs("div",{className:"connectivity-screen-inner",children:[d.jsx("span",{className:"connectivity-screen-icon","aria-hidden":"true",children:d.jsx(de,{name:c.icon,size:22})}),d.jsx("span",{className:"connectivity-screen-title",children:c.title}),d.jsx("span",{className:"connectivity-screen-body",children:c.body}),e==="error"&&r&&d.jsx("span",{className:"connectivity-screen-detail","data-testid":"connectivity-screen-detail",children:r}),d.jsx("button",{className:"btn-primary connectivity-screen-retry","data-testid":"connectivity-retry",onClick:t,disabled:n||h.status==="pending",children:n?"Reconnecting…":"Retry"}),e==="auth"&&o&&d.jsxs("div",{className:"connectivity-screen-auth-section",children:[h.status==="pending"?d.jsxs("span",{className:"connectivity-auth-pending","data-testid":"connectivity-auth-pending",children:[d.jsx(de,{name:"Loader",size:14}),"Opening browser… waiting for sign-in"]}):d.jsxs("button",{className:"btn-secondary connectivity-connect-btn","data-testid":"connectivity-connect-btn",onClick:()=>void u(),children:[d.jsx(de,{name:"Plug",size:14}),"Connect account"]}),h.status==="error"&&d.jsx("span",{className:"connectivity-auth-error","data-testid":"connectivity-auth-error",children:h.message})]})]})})}function cD({onDismiss:e}){return d.jsxs("div",{className:"connectivity-banner",role:"status","data-testid":"connectivity-banner",children:[d.jsx("span",{className:"connectivity-banner-icon","aria-hidden":"true",children:d.jsx(de,{name:"CloudOff",size:14})}),d.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."}),e&&d.jsx("button",{className:"connectivity-banner-dismiss","aria-label":"Dismiss offline notice","data-testid":"connectivity-banner-dismiss",onClick:e,children:"×"})]})}function uD(e,t,n){const r=new Map;for(const o of t)r.has(o.agentSessionId)||r.set(o.agentSessionId,o);for(const o of e)n.has(o.cwd)||r.has(o.agentSessionId)||r.set(o.agentSessionId,o);return Array.from(r.values()).sort((o,c)=>c.lastActiveAt.localeCompare(o.lastActiveAt))}const dD=12;function u2(e,t,n){var c;const r=[],o=h=>{h&&!r.includes(h)&&r.push(h)};return o((c=e.find(h=>h.id===n))==null?void 0:c.cwd),e.forEach(h=>o(h.cwd)),t.forEach(h=>o(h)),r.slice(0,dD)}const Ha={"claude-code":"Claude Code",codex:"Codex"};function d2(e,t=Date.now()){const n=t-new Date(e).getTime(),r=Math.floor(n/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;const o=Math.floor(r/60);if(o<24)return`${o}h ago`;const c=Math.floor(o/24);return c<7?`${c}d ago`:new Date(e).toLocaleDateString([],{month:"short",day:"numeric"})}function hD(e,t){const n=new Date(t).getTime()-new Date(e).getTime();if(!Number.isFinite(n)||n<=0)return null;const r=Math.floor(n/6e4);if(r<1)return"under a minute";if(r<60)return`${r}m`;const o=Math.floor(r/60);return o<24?`${o}h ${r%60}m`:`${Math.floor(o/24)}d ${o%24}h`}function MS(e){return e.resumeMode===void 0?"checking":e.resumeMode==="agent-resume"?"resume":(e.turnCount??e.messageCount??0)>0?"from-summary":"empty"}function fD(e){switch(e){case"resume":return null;case"from-summary":return"from summary";case"empty":return"nothing recorded";case"checking":return"checking…"}}function gv(e,t=Date.now(),n={}){const r=[];n.includeHarness!==!1&&r.push(Ha[e.harness]),e.gitBranch&&r.push(e.gitBranch);const o=e.turnCount??e.messageCount;o!=null&&o>0&&r.push(`${o} ${o===1?"turn":"turns"}`);const c=n.state?fD(n.state):null;return c&&r.push(c),r.push(d2(e.lastActiveAt,t)),r.join(" · ")}function h2(e,t){const[n,r]=O.useState(e===null?{status:"empty"}:{status:"loading"});return O.useEffect(()=>{if(e===null){r({status:"empty"});return}let o=!1;return r({status:"loading"}),t(e).then(c=>{o||r(c?{status:"ready",record:c}:{status:"empty"})},c=>{o||r({status:"error",message:c instanceof Error?c.message:String(c)})}),()=>{o=!0}},[e,t]),n}function f2({text:e}){const t=e.split(`
|
|
485
|
+
`),n=[];let r=0,o=0;function c(){return o++}function h(l){const u=[],m=/(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*)/g;let g=0,p;for(;(p=m.exec(l))!==null;){p.index>g&&u.push(l.slice(g,p.index));const S=p[0];S.startsWith("`")&&S.endsWith("`")?u.push(d.jsx("code",{className:"chat-inline-code",children:S.slice(1,-1)},c())):S.startsWith("**")&&S.endsWith("**")?u.push(d.jsx("strong",{children:S.slice(2,-2)},c())):S.startsWith("*")&&S.endsWith("*")?u.push(d.jsx("em",{children:S.slice(1,-1)},c())):u.push(S),g=p.index+S.length}return g<l.length&&u.push(l.slice(g)),u}for(;r<t.length;){const l=t[r];if(l.startsWith("```")){const p=l.slice(3).trim(),S=[];for(r++;r<t.length&&!t[r].startsWith("```");)S.push(t[r]),r++;r++,n.push(d.jsx("pre",{className:"chat-code-block","data-lang":p||void 0,children:d.jsx("code",{className:p?`language-${p}`:void 0,children:S.join(`
|
|
486
|
+
`)})},c()));continue}const u=l.match(/^(#{1,3})\s+(.+)/);if(u){const S=`h${u[1].length}`;n.push(d.jsx(S,{className:"chat-heading",children:h(u[2])},c())),r++;continue}if(l.startsWith("> ")){n.push(d.jsx("blockquote",{className:"chat-blockquote",children:h(l.slice(2))},c())),r++;continue}if(/^- \[[ x]\]/.test(l)){const p=[];for(;r<t.length&&/^- \[[ x]\]/.test(t[r]);){const S=t[r][3]==="x";p.push({text:t[r].replace(/^- \[[ x]\]\s?/,""),checked:S}),r++}n.push(d.jsx("ul",{className:"chat-list chat-checklist",children:p.map((S,x)=>d.jsx("li",{children:h(S.text)},x))},c()));continue}if(/^[-*+]\s+/.test(l)){const p=[];for(;r<t.length&&/^[-*+]\s+/.test(t[r]);){const S=t[r].replace(/^[-*+]\s+/,"");p.push(d.jsx("li",{children:h(S)},c())),r++}n.push(d.jsx("ul",{className:"chat-list",children:p},c()));continue}if(!l.trim()){r++;continue}const m=p=>p.startsWith("```")||/^#{1,3}\s+/.test(p)||p.startsWith("> ")||/^[-*+]\s+/.test(p),g=[l];for(r++;r<t.length&&t[r].trim()&&!m(t[r]);)g.push(t[r]),r++;n.push(d.jsx("p",{className:"chat-paragraph",children:h(g.join(" "))},c()))}return d.jsx(d.Fragment,{children:n})}const $S={"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."},pD=["assistant-narration-gap","truncated-tool-output","missing-assistant-text","incomplete-final-turn","compacted-archive","dropped-early-turns"];function mD(e){const t=new Set(e),n=pD.filter(o=>t.has(o)).map(o=>$S[o]),r=[...t].filter(o=>!(o in $S)).map(o=>`Known gap reported by the harness: ${o}.`);return[...n,...r]}function gD(e){if(!e)return null;const t=[];return e.inputTokens!=null&&t.push(`${DS(e.inputTokens)} in`),e.outputTokens!=null&&t.push(`${DS(e.outputTokens)} out`),t.length>0?t.join(" · "):null}function DS(e){if(e<1e3)return String(e);const t=e/1e3;return`${t<100?t.toFixed(1):Math.round(t)}k`}function p2(e,t=Date.now()){if(!e)return null;const n=new Date(e);if(Number.isNaN(n.getTime()))return null;const r=n.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),o=new Date(t);return n.getFullYear()===o.getFullYear()&&n.getMonth()===o.getMonth()&&n.getDate()===o.getDate()?r:`${n.toLocaleDateString([],{day:"numeric",month:"short"})}, ${r}`}function vD(e,t){const n=e??"unknown tool";if(!t)return n;const r=t.replace(/\s+/g," ").trim();if(!r)return n;const o=r.length>80?`${r.slice(0,80)}…`:r;return`${n} · ${o}`}function _D({record:e}){const t=mD(e.limitations),n=p2(e.archivedAt);return d.jsxs("div",{className:"transcript","data-testid":"session-transcript",children:[d.jsxs("div",{className:"transcript-notice","data-testid":"transcript-reconstructed",children:[d.jsx("span",{className:"transcript-badge",children:"Reconstructed"}),d.jsxs("div",{className:"transcript-notice-body",children:[d.jsx("p",{className:"transcript-notice-lead",children:"Rebuilt from the harness's own recording of this session, not a replay of your terminal."}),e.archivedAt!==null&&d.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&&d.jsx("ul",{className:"transcript-notice-list","data-testid":"transcript-limitations",children:t.map(r=>d.jsx("li",{children:r},r))})]})]}),d.jsx("ol",{className:"transcript-turns",children:e.turns.map(r=>d.jsx(yD,{turn:r},r.index))})]})}function yD({turn:e}){const t=gD(e.usage),n=p2(e.promptAt);return d.jsxs("li",{className:"transcript-turn","data-testid":"transcript-turn","data-turn":e.index,children:[d.jsxs("div",{className:"transcript-role transcript-role-user",children:[d.jsx("span",{className:"transcript-role-label",children:"You"}),n&&d.jsx("span",{className:"transcript-time",children:n})]}),e.prompt!==null?d.jsx("div",{className:"transcript-prompt","data-testid":"transcript-prompt",children:e.prompt}):d.jsx("div",{className:"transcript-absent","data-testid":"transcript-no-prompt",children:"No prompt recorded for this turn — the harness started recording after it began."}),e.toolCalls.length>0&&d.jsx("ul",{className:"transcript-tools","data-testid":"transcript-tools",children:e.toolCalls.map((r,o)=>d.jsx(bD,{call:r},`${r.at}-${o}`))}),d.jsxs("div",{className:"transcript-role transcript-role-agent",children:[d.jsx("span",{className:"transcript-role-label",children:"Agent"}),e.model&&d.jsx("span",{className:"transcript-model",children:e.model}),t&&d.jsx("span",{className:"transcript-usage",children:t})]}),e.assistantText!==null?d.jsx("div",{className:"transcript-assistant","data-testid":"transcript-assistant",children:d.jsx(f2,{text:e.assistantText})}):d.jsx("div",{className:"transcript-absent","data-testid":"transcript-no-assistant",children:e.incomplete?"This turn never completed — no reply was recorded.":"No assistant text was recorded for this turn."}),e.incomplete&&d.jsx("div",{className:"transcript-incomplete","data-testid":"transcript-incomplete",children:"Turn incomplete"})]})}function bD({call:e}){return d.jsx("li",{className:"transcript-tool",children:d.jsxs("details",{"data-testid":"transcript-tool-call",children:[d.jsxs("summary",{className:"transcript-tool-summary",children:[d.jsx("span",{className:"transcript-tool-name",children:vD(e.name,e.input)}),e.responseTruncated&&d.jsx("span",{className:"transcript-tool-truncated","data-testid":"transcript-tool-truncated",children:"truncated"})]}),d.jsxs("div",{className:"transcript-tool-body",children:[e.input&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"transcript-tool-heading",children:"Input"}),d.jsx("pre",{className:"transcript-tool-pre",children:e.input})]}),d.jsx("div",{className:"transcript-tool-heading",children:"Result"}),e.responseSummary?d.jsx("pre",{className:"transcript-tool-pre",children:e.responseSummary}):d.jsx("div",{className:"transcript-absent",children:"No result recorded."}),e.responseTruncated&&d.jsx("div",{className:"transcript-absent",children:"The recorded result was truncated at the collector's size cap; the rest isn't recoverable."})]})]})})}function OS(e){return e.agentSessionId==null?"This session can't be resumed: it exited before establishing a session id.":`${Ha[e.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 SD({session:e,resumeMode:t,loadRecord:n,onResume:r,onContinue:o,onClose:c}){const h=e.agentSessionId!=null&&t!=="rehydrate",l=hD(e.createdAt,e.lastActiveAt),u=h2(e.id,n),m=u.status!=="empty",g=!h&&u.status==="ready";return d.jsxs("div",{className:"dead-session-pane","data-testid":"dead-session-pane","data-has-record":m,...Ot({surface:"session_history"}),children:[d.jsxs("div",{className:"dead-session-summary",...Ot({object:"session"}),children:[d.jsx("span",{className:"empty-state-icon","aria-hidden":"true",children:d.jsx(de,{name:"SquareTerminal",size:18})}),d.jsx("div",{className:"dead-session-title",children:"Session exited"}),d.jsxs("div",{className:"dead-session-meta",children:[e.cwd,e.exitCode!=null&&` · exit code ${e.exitCode}`]}),d.jsxs("dl",{className:"dead-session-detail","data-testid":"dead-session-detail",children:[e.title&&d.jsxs("div",{className:"dead-session-detail-row",children:[d.jsx("dt",{children:"Session"}),d.jsx("dd",{children:e.title})]}),d.jsxs("div",{className:"dead-session-detail-row",children:[d.jsx("dt",{children:"Coding agent"}),d.jsx("dd",{children:Ha[e.harness]})]}),l&&d.jsxs("div",{className:"dead-session-detail-row",children:[d.jsx("dt",{children:"Ran for"}),d.jsx("dd",{children:l})]}),d.jsxs("div",{className:"dead-session-detail-row",children:[d.jsx("dt",{children:"Ended"}),d.jsx("dd",{children:d2(e.lastActiveAt)})]})]}),d.jsxs("div",{className:"dead-session-actions",children:[g?d.jsx("button",{className:"btn-primary","data-testid":"dead-session-continue",onClick:o,children:"Continue here"}):d.jsx("button",{className:"btn-primary","data-testid":"dead-session-resume",onClick:r,disabled:!h,title:h?void 0:OS(e),children:"Resume"}),d.jsx("button",{className:"btn-ghost","data-testid":"dead-session-close",onClick:c,children:"Close"})]}),!h&&d.jsxs("div",{className:"dead-session-resume-reason","data-testid":"dead-session-resume-reason",children:[OS(e)," ",g?"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."]})]}),e.exitTail&&d.jsxs("div",{className:"dead-session-exit-tail","data-testid":"dead-session-exit-tail",children:[d.jsx("div",{className:"dead-session-exit-tail-label",children:"Last output before exit"}),d.jsx("pre",{className:"dead-session-exit-tail-body",children:e.exitTail})]}),m&&d.jsx("div",{className:"dead-session-record","data-testid":"dead-session-record",children:d.jsx(m2,{state:u})})]})}function wD({summary:e,loadRecord:t,onStart:n,onClose:r}){const o=e.resumeMode==="agent-resume",c=e.harnessSessionId??e.agentSessionId,h=h2(c,t),l=!o&&h.status==="ready";return d.jsxs("div",{className:"past-session-pane","data-testid":"past-session-pane",children:[d.jsxs("header",{className:"past-session-header",children:[d.jsxs("div",{className:"past-session-heading",children:[d.jsx("div",{className:"dead-session-title",children:e.title}),d.jsxs("div",{className:"dead-session-meta",children:[gv(e)," · ",e.cwd]})]}),d.jsxs("div",{className:"dead-session-actions",children:[d.jsx("button",{className:"btn-primary","data-testid":"past-session-start",onClick:n,children:o?"Resume":l?"Continue here":"New session here"}),d.jsx("button",{className:"btn-ghost","data-testid":"past-session-close",onClick:r,children:"Close"})]})]}),!o&&d.jsxs("div",{className:"dead-session-resume-reason","data-testid":"past-session-reason",children:[Ha[e.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."," ",l?"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."]}),d.jsx("div",{className:"past-session-body",children:d.jsx(m2,{state:h})})]})}function m2({state:e}){return e.status==="loading"?d.jsx("div",{className:"past-session-status","data-testid":"past-session-loading",children:"Rebuilding this session's transcript…"}):e.status==="error"?d.jsxs("div",{className:"past-session-status","data-testid":"past-session-error",children:["Couldn't load this session's transcript: ",e.message]}):e.status==="empty"?d.jsxs("div",{className:"past-session-status","data-testid":"past-session-empty",children:[d.jsx("span",{className:"empty-state-icon","aria-hidden":"true",children:d.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."]}):d.jsx(_D,{record:e.record})}function xD({onCancel:e,onConfirm:t,triggerRef:n}){const r=O.useRef(null);return Ua(!0,{onDismiss:e,containerRef:r,triggerRef:n}),d.jsx("div",{className:"modal-backdrop",onClick:e,children:d.jsxs("div",{ref:r,className:"modal modal-confirm",role:"alertdialog","aria-label":"End session","data-testid":"end-session-confirm",onClick:o=>o.stopPropagation(),children:[d.jsxs("div",{className:"modal-header",children:["End session?",d.jsx("button",{className:"theme-toggle modal-close","aria-label":"Close",title:"Close",onClick:e,children:d.jsx(de,{name:"X",size:14})})]}),d.jsx("div",{className:"modal-body",children:d.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."})}),d.jsxs("div",{className:"modal-actions",children:[d.jsx("button",{className:"btn-ghost",autoFocus:!0,onClick:e,children:"Keep session"}),d.jsx("button",{className:"btn-danger","data-testid":"end-session-confirm-btn",onClick:t,children:"End session"})]})]})})}function CD({sessions:e,activeSessionId:t,busySessionIds:n,labelOf:r,subjectName:o,onSelect:c,onNew:h,newSessionPending:l,menuOpen:u,onToggleMenu:m,menuTriggerRef:g,menuTooltip:p,renaming:S,renameDraft:x,onRenameDraftChange:A,onCommitRename:E,onCancelRename:y}){const b=O.useRef(null),v=O.useRef(!1);return O.useEffect(()=>{var _;(_=b.current)==null||_.scrollIntoView({block:"nearest",inline:"nearest"})},[t,e.length]),d.jsxs("div",{className:"session-tabs","data-testid":"session-tabs",children:[d.jsx("div",{className:"session-tabs-list",role:"tablist","aria-label":"Sessions",children:e.map(_=>{const k=_.id===t,C=r(_),w=Ha[_.harness],T=k&&S;return d.jsxs("div",{ref:k?b:void 0,className:`session-tab${k?" is-active":""}`,"data-testid":`session-tab-${_.id}`,children:[T?d.jsx("input",{className:"group-name-input session-rename-input session-tab-rename","data-testid":"session-rename-input","aria-label":"Rename session",value:x,autoFocus:!0,onFocus:j=>{v.current=!1,j.currentTarget.select()},onChange:j=>A(j.target.value),onKeyDown:j=>{j.key==="Enter"&&E(),j.key==="Escape"&&(v.current=!0,y())},onBlur:()=>{if(v.current){v.current=!1;return}E()}}):d.jsxs("button",{type:"button",role:"tab","aria-selected":k,className:"session-tab-main","data-testid":`session-tab-main-${_.id}`,title:`${C} · ${w}`,"data-tooltip":`${C} · ${w}`,onClick:()=>c(_.id),children:[n.has(_.id)?d.jsx("span",{className:"session-busy","data-testid":`session-tab-busy-${_.id}`,"aria-hidden":"true"}):d.jsx("span",{className:"session-dot","data-status":_.status,"aria-hidden":"true"}),d.jsx("span",{className:"session-tab-label","data-testid":k?"session-context-title":void 0,children:C})]}),k&&!T&&d.jsx("button",{ref:g,type:"button",className:"theme-toggle session-tab-menu","data-testid":"session-menu","aria-label":"Session options","aria-haspopup":"menu","aria-expanded":u,"data-tooltip":p,onClick:j=>{j.stopPropagation(),m()},...Ot({object:"session"}),children:d.jsx(de,{name:"ChevronDown",size:12})})]},_.id)})}),d.jsx("button",{type:"button",className:"theme-toggle session-tab-new","data-testid":"session-tab-new","aria-label":`New session on ${o}`,"aria-busy":l,"data-tooltip":`New session on ${o}`,disabled:l,onClick:h,children:l?d.jsx("span",{className:"session-busy","aria-hidden":"true"}):d.jsx(de,{name:"Plus",size:14})})]})}function uc(e){return Us(e)}const ED=new Set;function kD({overviewMode:e=!1,openedAgentName:t=null,reviewTitle:n=null,composing:r=!1,onBack:o=null,activeSession:c,sessionName:h,onRenameSession:l,boundWorkflowName:u,busy:m,onExpandRail:g,onExpandRight:p,onCloseSession:S,onOpenInEditor:x,editorLabel:A,onToast:E,actions:y=null,onNewSession:b=null,newSessionPending:v=!1,subjectName:_=null,sessions:k=[],busySessionIds:C=ED,onSelectSession:w=null,labelOf:T}){const[j,M]=O.useState(!1),[D,L]=O.useState(!1),[q,F]=O.useState(!1),[Y,Q]=O.useState(""),G=O.useRef(null),ee=()=>L(!1),ne=()=>{c&&l(c.id,Y),F(!1)};return O.useEffect(()=>{L(!1),F(!1),M(!1)},[c==null?void 0:c.id]),d.jsxs("div",{className:"session-bar",...Ot({surface:"session_bar"}),children:[g&&d.jsx("button",{className:"theme-toggle rail-toggle","data-testid":"rail-expand","aria-label":"Expand workspace panel",title:"Expand workspace panel",onClick:g,children:d.jsx(de,{name:"PanelLeftOpen",size:14})}),d.jsx("div",{className:"session-queue","data-testid":"session-context","data-session-id":(c==null?void 0:c.id)??"",children:e?d.jsxs("div",{className:"session-current session-current-static",children:[d.jsx(de,{name:"Radio",size:13}),d.jsx("span",{className:"session-context-title","data-testid":"session-context-title",children:"Overview"})]}):t?d.jsxs("div",{className:"session-current session-current-static",children:[d.jsx("span",{className:"session-context-title","data-testid":"session-context-title",children:t}),d.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?d.jsxs("div",{className:"session-current session-current-static",children:[d.jsx(de,{name:"History",size:13}),d.jsx("span",{className:"session-context-title","data-testid":"session-context-title",children:n}),d.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:[d.jsx("span",{className:"session-dot","data-status":"exited"}),"past"]})]}):r?o?d.jsxs("button",{type:"button",className:"session-current session-back","data-testid":"composer-back",onClick:o,children:[d.jsx(de,{name:"ArrowLeft",size:13}),d.jsx("span",{className:"session-context-title","data-testid":"session-context-title",children:"Back"})]}):null:c&&c.status!=="exited"&&k.length>0&&w&&b&&T?d.jsx(CD,{sessions:k,activeSessionId:c.id,busySessionIds:C,labelOf:T,subjectName:_??uc(c.cwd),onSelect:w,onNew:b,newSessionPending:v,menuOpen:D,onToggleMenu:()=>L(z=>!z),menuTriggerRef:G,menuTooltip:`${Ha[c.harness]} · ${uc(c.cwd)} · ${c.cwd}`,renaming:q,renameDraft:Y,onRenameDraftChange:Q,onCommitRename:ne,onCancelRename:()=>F(!1)}):c?d.jsx("div",{className:"session-current-wrap",children:q?d.jsx("input",{className:"group-name-input session-rename-input session-context-rename","data-testid":"session-rename-input",value:Y,autoFocus:!0,onFocus:z=>z.currentTarget.select(),onChange:z=>Q(z.target.value),onKeyDown:z=>{z.key==="Enter"&&ne(),z.key==="Escape"&&F(!1)},onBlur:ne}):d.jsxs("button",{ref:G,type:"button",className:"session-current session-title-trigger","data-testid":"session-menu","aria-haspopup":"menu","aria-expanded":D,"data-tooltip":`${Ha[c.harness]} · ${uc(c.cwd)} · ${c.cwd}`,onClick:()=>L(z=>!z),...Ot({object:"session"}),children:[m?d.jsx("span",{className:"session-busy","data-testid":"session-busy","aria-hidden":"true"}):d.jsx("span",{className:"session-dot","data-status":c.status,"aria-hidden":"true"}),d.jsx("span",{className:"session-context-title","data-testid":"session-context-title",children:T?T(c):h??c.title}),d.jsx(de,{name:"ChevronDown",size:13})]})}):d.jsx("span",{className:"session-context-none",children:"No active session"})}),c&&d.jsxs(Ci,{open:D,anchorRef:G,onDismiss:ee,placement:"down-start",className:"session-menu",role:"menu",testid:"session-menu-popover",children:[u&&d.jsxs("div",{className:"session-menu-bound","data-testid":"session-workflow-chip",children:["Bound to ",d.jsx("strong",{children:u})," · what this session is working on"]}),d.jsxs("button",{role:"menuitem",className:"profile-menu-item",onClick:()=>{var z;(z=navigator.clipboard)==null||z.writeText(c.cwd).then(()=>E("Path copied.","success")).catch(()=>E("Couldn't copy the path.")),ee()},children:[d.jsx(de,{name:"Copy",size:13}),"Copy path"]}),d.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"session-rename",onClick:()=>{Q(h??c.title),F(!0),ee()},children:[d.jsx(de,{name:"Pencil",size:13}),"Rename session"]}),d.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"session-open-editor",onClick:()=>{x(c.cwd),ee()},children:[d.jsx(de,{name:"Code",size:13}),"Open in ",A]}),c.status!=="exited"&&d.jsxs("button",{role:"menuitem",className:"profile-menu-item session-menu-danger","data-testid":"session-end-btn",onClick:()=>{ee(),M(!0)},children:[d.jsx(de,{name:"X",size:13}),"End session…"]})]}),b&&(c==null?void 0:c.status)==="exited"&&!r&&d.jsx("button",{type:"button",className:"theme-toggle session-tab-new","data-testid":"session-tab-new","aria-label":`New session on ${_??uc(c.cwd)}`,"aria-busy":v,"data-tooltip":`New session on ${_??uc(c.cwd)}`,disabled:v,onClick:b,children:v?d.jsx("span",{className:"session-busy","aria-hidden":"true"}):d.jsx(de,{name:"Plus",size:14})}),y,p&&d.jsx("button",{className:"theme-toggle","data-testid":"right-expand","aria-label":"Expand canvas panel",title:"Expand canvas panel",onClick:p,children:d.jsx(de,{name:"PanelRightOpen",size:15})}),j&&c&&d.jsx(xD,{triggerRef:G,onCancel:()=>M(!1),onConfirm:()=>{M(!1),S(c.id)}})]})}const LS={deploy:"deploy",prod_run:"prod-run",run_local:"run-local"};function g2(e){return Object.prototype.hasOwnProperty.call(LS,e)?LS[e]:null}function jD(e){return g2(e.id)===null&&e.action.kind==="inject"}function RD(e,t,n){if(e.requiresWorkflow){if(!t)return"Select an agent first";if(e.action.kind==="open-url"&&e.action.url.includes("{{workflow.definitionId}}")&&t.definitionId==null)return"Not deployed yet"}return e.action.kind!=="open-url"&&!n?"Start a session first":null}function AD(e,t){return e.replace("{{workflow.definitionId}}",String((t==null?void 0:t.definitionId)??""))}function hi(e,t){return e.trim()===""?!1:Li(e,t)}function i_(e,t){return t.filter(n=>hi(n,e)).map(Pa).sort((n,r)=>r.length-n.length)[0]??e}function yc(e,t){return t?e.filter(n=>n.status!=="exited"&&(jn(n.boundWorkflowPath??"",t)||(n.boundWorkflowPath??null)==null&&jn(n.cwd,t))).sort((n,r)=>n.createdAt.localeCompare(r.createdAt)||n.id.localeCompare(r.id)):[]}function IS(e,t){return!e||e.status==="exited"?t:e.boundWorkflowPath??e.cwd}function v2(e,t,n){return!e||e.status==="exited"||t==null?!1:hi(i_(e.cwd,n),t)}function PS(e,t){const n=e.lastActiveAt??e.createdAt;return(t.lastActiveAt??t.createdAt).localeCompare(n)||e.id.localeCompare(t.id)}function TD({focusPath:e,active:t,sessions:n,roots:r}){const o=n.filter(u=>u.status!=="exited");if(v2(t,e,r))return{kind:"keep"};const c=i_(e,r),h=yc(o,e).sort(PS)[0],l=o.filter(u=>hi(c,u.cwd)).sort(PS)[0];return{kind:"switch",to:h??l??null}}function ND({selection:e,suppressed:t=!1}){return t?null:e}function MD({subjectPath:e,bindingPath:t,sessionId:n}){const r=e==null?t==null:t!=null&&jn(t,e);return n!=null&&r?{kind:"session",sessionId:n}:e==null?{kind:"none"}:{kind:"agent",path:e}}function $D(e,{subject:t,authenticated:n,deployError:r}){if(!t)return{subjectPath:null,reason:"Select an agent first"};const o=t.path;switch(e){case"prod":return{subjectPath:o,reason:t.definitionId==null?"Not deployed yet":null};case"run":return{subjectPath:o,reason:(n?null:"Connect your account first")??v$(t,r)};case"deploy":return{subjectPath:o,reason:n?null:"Connect your account first"};case"test":return{subjectPath:o,reason:null}}}function vv(e,t){return e.filter(n=>n.workflowPath===t)}const DD=200;function OD(e,t,n=DD){if(n<=0)return[];const r=e.slice(-n),o=n-r.length;if(o<=0)return r;const c=new Set(r.map(h=>h.run.executionId));return[...r,...t.filter(h=>!c.has(h.run.executionId)).slice(-o)]}function LD(e,t,n){return t&&vv(e,n).some(r=>r.run.executionId===t.run.executionId)?t:null}function ID(e,t){return t&&e.some(n=>n.run.executionId===t.run.executionId)?t:e.length>0?e[e.length-1]:null}var od={exports:{}},rg={},sr={},Ea={},ag={},og={},lg={},BS;function Jh(){return BS||(BS=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class t{}e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class n extends t{constructor(v){if(super(),!e.IDENTIFIER.test(v))throw new Error("CodeGen: name must be a valid identifier");this.str=v}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=n;class r extends t{constructor(v){super(),this._items=typeof v=="string"?[v]:v}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const v=this._items[0];return v===""||v==='""'}get str(){var v;return(v=this._str)!==null&&v!==void 0?v:this._str=this._items.reduce((_,k)=>`${_}${k}`,"")}get names(){var v;return(v=this._names)!==null&&v!==void 0?v:this._names=this._items.reduce((_,k)=>(k instanceof n&&(_[k.str]=(_[k.str]||0)+1),_),{})}}e._Code=r,e.nil=new r("");function o(b,...v){const _=[b[0]];let k=0;for(;k<v.length;)l(_,v[k]),_.push(b[++k]);return new r(_)}e._=o;const c=new r("+");function h(b,...v){const _=[x(b[0])];let k=0;for(;k<v.length;)_.push(c),l(_,v[k]),_.push(c,x(b[++k]));return u(_),new r(_)}e.str=h;function l(b,v){v instanceof r?b.push(...v._items):v instanceof n?b.push(v):b.push(p(v))}e.addCodeArg=l;function u(b){let v=1;for(;v<b.length-1;){if(b[v]===c){const _=m(b[v-1],b[v+1]);if(_!==void 0){b.splice(v-1,3,_);continue}b[v++]="+"}v++}}function m(b,v){if(v==='""')return b;if(b==='""')return v;if(typeof b=="string")return v instanceof n||b[b.length-1]!=='"'?void 0:typeof v!="string"?`${b.slice(0,-1)}${v}"`:v[0]==='"'?b.slice(0,-1)+v.slice(1):void 0;if(typeof v=="string"&&v[0]==='"'&&!(b instanceof n))return`"${b}${v.slice(1)}`}function g(b,v){return v.emptyStr()?b:b.emptyStr()?v:h`${b}${v}`}e.strConcat=g;function p(b){return typeof b=="number"||typeof b=="boolean"||b===null?b:x(Array.isArray(b)?b.join(","):b)}function S(b){return new r(x(b))}e.stringify=S;function x(b){return JSON.stringify(b).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=x;function A(b){return typeof b=="string"&&e.IDENTIFIER.test(b)?new r(`.${b}`):o`[${b}]`}e.getProperty=A;function E(b){if(typeof b=="string"&&e.IDENTIFIER.test(b))return new r(`${b}`);throw new Error(`CodeGen: invalid export name: ${b}, use explicit $id name mapping`)}e.getEsmExportName=E;function y(b){return new r(b.toString())}e.regexpCode=y})(lg)),lg}var cg={},zS;function HS(){return zS||(zS=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;const t=Jh();class n extends Error{constructor(m){super(`CodeGen: "code" for ${m} not defined`),this.value=m.value}}var r;(function(u){u[u.Started=0]="Started",u[u.Completed=1]="Completed"})(r||(e.UsedValueState=r={})),e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};class o{constructor({prefixes:m,parent:g}={}){this._names={},this._prefixes=m,this._parent=g}toName(m){return m instanceof t.Name?m:this.name(m)}name(m){return new t.Name(this._newName(m))}_newName(m){const g=this._names[m]||this._nameGroup(m);return`${m}${g.index++}`}_nameGroup(m){var g,p;if(!((p=(g=this._parent)===null||g===void 0?void 0:g._prefixes)===null||p===void 0)&&p.has(m)||this._prefixes&&!this._prefixes.has(m))throw new Error(`CodeGen: prefix "${m}" is not allowed in this scope`);return this._names[m]={prefix:m,index:0}}}e.Scope=o;class c extends t.Name{constructor(m,g){super(g),this.prefix=m}setValue(m,{property:g,itemIndex:p}){this.value=m,this.scopePath=(0,t._)`.${new t.Name(g)}[${p}]`}}e.ValueScopeName=c;const h=(0,t._)`\n`;class l extends o{constructor(m){super(m),this._values={},this._scope=m.scope,this.opts={...m,_n:m.lines?h:t.nil}}get(){return this._scope}name(m){return new c(m,this._newName(m))}value(m,g){var p;if(g.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const S=this.toName(m),{prefix:x}=S,A=(p=g.key)!==null&&p!==void 0?p:g.ref;let E=this._values[x];if(E){const v=E.get(A);if(v)return v}else E=this._values[x]=new Map;E.set(A,S);const y=this._scope[x]||(this._scope[x]=[]),b=y.length;return y[b]=g.ref,S.setValue(g,{property:x,itemIndex:b}),S}getValue(m,g){const p=this._values[m];if(p)return p.get(g)}scopeRefs(m,g=this._values){return this._reduceValues(g,p=>{if(p.scopePath===void 0)throw new Error(`CodeGen: name "${p}" has no value`);return(0,t._)`${m}${p.scopePath}`})}scopeCode(m=this._values,g,p){return this._reduceValues(m,S=>{if(S.value===void 0)throw new Error(`CodeGen: name "${S}" has no value`);return S.value.code},g,p)}_reduceValues(m,g,p={},S){let x=t.nil;for(const A in m){const E=m[A];if(!E)continue;const y=p[A]=p[A]||new Map;E.forEach(b=>{if(y.has(b))return;y.set(b,r.Started);let v=g(b);if(v){const _=this.opts.es5?e.varKinds.var:e.varKinds.const;x=(0,t._)`${x}${_} ${b} = ${v};${this.opts._n}`}else if(v=S==null?void 0:S(b))x=(0,t._)`${x}${v}${this.opts._n}`;else throw new n(b);y.set(b,r.Completed)})}return x}}e.ValueScope=l})(cg)),cg}var US;function St(){return US||(US=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;const t=Jh(),n=HS();var r=Jh();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}});var o=HS();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return o.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return o.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return o.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return o.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};class c{optimizeNodes(){return this}optimizeNames(P,W){return this}}class h extends c{constructor(P,W,se){super(),this.varKind=P,this.name=W,this.rhs=se}render({es5:P,_n:W}){const se=P?n.varKinds.var:this.varKind,X=this.rhs===void 0?"":` = ${this.rhs}`;return`${se} ${this.name}${X};`+W}optimizeNames(P,W){if(P[this.name.str])return this.rhs&&(this.rhs=Y(this.rhs,P,W)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class l extends c{constructor(P,W,se){super(),this.lhs=P,this.rhs=W,this.sideEffects=se}render({_n:P}){return`${this.lhs} = ${this.rhs};`+P}optimizeNames(P,W){if(!(this.lhs instanceof t.Name&&!P[this.lhs.str]&&!this.sideEffects))return this.rhs=Y(this.rhs,P,W),this}get names(){const P=this.lhs instanceof t.Name?{}:{...this.lhs.names};return F(P,this.rhs)}}class u extends l{constructor(P,W,se,X){super(P,se,X),this.op=W}render({_n:P}){return`${this.lhs} ${this.op}= ${this.rhs};`+P}}class m extends c{constructor(P){super(),this.label=P,this.names={}}render({_n:P}){return`${this.label}:`+P}}class g extends c{constructor(P){super(),this.label=P,this.names={}}render({_n:P}){return`break${this.label?` ${this.label}`:""};`+P}}class p extends c{constructor(P){super(),this.error=P}render({_n:P}){return`throw ${this.error};`+P}get names(){return this.error.names}}class S extends c{constructor(P){super(),this.code=P}render({_n:P}){return`${this.code};`+P}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(P,W){return this.code=Y(this.code,P,W),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class x extends c{constructor(P=[]){super(),this.nodes=P}render(P){return this.nodes.reduce((W,se)=>W+se.render(P),"")}optimizeNodes(){const{nodes:P}=this;let W=P.length;for(;W--;){const se=P[W].optimizeNodes();Array.isArray(se)?P.splice(W,1,...se):se?P[W]=se:P.splice(W,1)}return P.length>0?this:void 0}optimizeNames(P,W){const{nodes:se}=this;let X=se.length;for(;X--;){const V=se[X];V.optimizeNames(P,W)||(Q(P,V.names),se.splice(X,1))}return se.length>0?this:void 0}get names(){return this.nodes.reduce((P,W)=>q(P,W.names),{})}}class A extends x{render(P){return"{"+P._n+super.render(P)+"}"+P._n}}class E extends x{}class y extends A{}y.kind="else";class b extends A{constructor(P,W){super(W),this.condition=P}render(P){let W=`if(${this.condition})`+super.render(P);return this.else&&(W+="else "+this.else.render(P)),W}optimizeNodes(){super.optimizeNodes();const P=this.condition;if(P===!0)return this.nodes;let W=this.else;if(W){const se=W.optimizeNodes();W=this.else=Array.isArray(se)?new y(se):se}if(W)return P===!1?W instanceof b?W:W.nodes:this.nodes.length?this:new b(G(P),W instanceof b?[W]:W.nodes);if(!(P===!1||!this.nodes.length))return this}optimizeNames(P,W){var se;if(this.else=(se=this.else)===null||se===void 0?void 0:se.optimizeNames(P,W),!!(super.optimizeNames(P,W)||this.else))return this.condition=Y(this.condition,P,W),this}get names(){const P=super.names;return F(P,this.condition),this.else&&q(P,this.else.names),P}}b.kind="if";class v extends A{}v.kind="for";class _ extends v{constructor(P){super(),this.iteration=P}render(P){return`for(${this.iteration})`+super.render(P)}optimizeNames(P,W){if(super.optimizeNames(P,W))return this.iteration=Y(this.iteration,P,W),this}get names(){return q(super.names,this.iteration.names)}}class k extends v{constructor(P,W,se,X){super(),this.varKind=P,this.name=W,this.from=se,this.to=X}render(P){const W=P.es5?n.varKinds.var:this.varKind,{name:se,from:X,to:V}=this;return`for(${W} ${se}=${X}; ${se}<${V}; ${se}++)`+super.render(P)}get names(){const P=F(super.names,this.from);return F(P,this.to)}}class C extends v{constructor(P,W,se,X){super(),this.loop=P,this.varKind=W,this.name=se,this.iterable=X}render(P){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(P)}optimizeNames(P,W){if(super.optimizeNames(P,W))return this.iterable=Y(this.iterable,P,W),this}get names(){return q(super.names,this.iterable.names)}}class w extends A{constructor(P,W,se){super(),this.name=P,this.args=W,this.async=se}render(P){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(P)}}w.kind="func";class T extends x{render(P){return"return "+super.render(P)}}T.kind="return";class j extends A{render(P){let W="try"+super.render(P);return this.catch&&(W+=this.catch.render(P)),this.finally&&(W+=this.finally.render(P)),W}optimizeNodes(){var P,W;return super.optimizeNodes(),(P=this.catch)===null||P===void 0||P.optimizeNodes(),(W=this.finally)===null||W===void 0||W.optimizeNodes(),this}optimizeNames(P,W){var se,X;return super.optimizeNames(P,W),(se=this.catch)===null||se===void 0||se.optimizeNames(P,W),(X=this.finally)===null||X===void 0||X.optimizeNames(P,W),this}get names(){const P=super.names;return this.catch&&q(P,this.catch.names),this.finally&&q(P,this.finally.names),P}}class M extends A{constructor(P){super(),this.error=P}render(P){return`catch(${this.error})`+super.render(P)}}M.kind="catch";class D extends A{render(P){return"finally"+super.render(P)}}D.kind="finally";class L{constructor(P,W={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...W,_n:W.lines?`
|
|
487
|
+
`:""},this._extScope=P,this._scope=new n.Scope({parent:P}),this._nodes=[new E]}toString(){return this._root.render(this.opts)}name(P){return this._scope.name(P)}scopeName(P){return this._extScope.name(P)}scopeValue(P,W){const se=this._extScope.value(P,W);return(this._values[se.prefix]||(this._values[se.prefix]=new Set)).add(se),se}getScopeValue(P,W){return this._extScope.getValue(P,W)}scopeRefs(P){return this._extScope.scopeRefs(P,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(P,W,se,X){const V=this._scope.toName(W);return se!==void 0&&X&&(this._constants[V.str]=se),this._leafNode(new h(P,V,se)),V}const(P,W,se){return this._def(n.varKinds.const,P,W,se)}let(P,W,se){return this._def(n.varKinds.let,P,W,se)}var(P,W,se){return this._def(n.varKinds.var,P,W,se)}assign(P,W,se){return this._leafNode(new l(P,W,se))}add(P,W){return this._leafNode(new u(P,e.operators.ADD,W))}code(P){return typeof P=="function"?P():P!==t.nil&&this._leafNode(new S(P)),this}object(...P){const W=["{"];for(const[se,X]of P)W.length>1&&W.push(","),W.push(se),(se!==X||this.opts.es5)&&(W.push(":"),(0,t.addCodeArg)(W,X));return W.push("}"),new t._Code(W)}if(P,W,se){if(this._blockNode(new b(P)),W&&se)this.code(W).else().code(se).endIf();else if(W)this.code(W).endIf();else if(se)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(P){return this._elseNode(new b(P))}else(){return this._elseNode(new y)}endIf(){return this._endBlockNode(b,y)}_for(P,W){return this._blockNode(P),W&&this.code(W).endFor(),this}for(P,W){return this._for(new _(P),W)}forRange(P,W,se,X,V=this.opts.es5?n.varKinds.var:n.varKinds.let){const ue=this._scope.toName(P);return this._for(new k(V,ue,W,se),()=>X(ue))}forOf(P,W,se,X=n.varKinds.const){const V=this._scope.toName(P);if(this.opts.es5){const ue=W instanceof t.Name?W:this.var("_arr",W);return this.forRange("_i",0,(0,t._)`${ue}.length`,oe=>{this.var(V,(0,t._)`${ue}[${oe}]`),se(V)})}return this._for(new C("of",X,V,W),()=>se(V))}forIn(P,W,se,X=this.opts.es5?n.varKinds.var:n.varKinds.const){if(this.opts.ownProperties)return this.forOf(P,(0,t._)`Object.keys(${W})`,se);const V=this._scope.toName(P);return this._for(new C("in",X,V,W),()=>se(V))}endFor(){return this._endBlockNode(v)}label(P){return this._leafNode(new m(P))}break(P){return this._leafNode(new g(P))}return(P){const W=new T;if(this._blockNode(W),this.code(P),W.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(T)}try(P,W,se){if(!W&&!se)throw new Error('CodeGen: "try" without "catch" and "finally"');const X=new j;if(this._blockNode(X),this.code(P),W){const V=this.name("e");this._currNode=X.catch=new M(V),W(V)}return se&&(this._currNode=X.finally=new D,this.code(se)),this._endBlockNode(M,D)}throw(P){return this._leafNode(new p(P))}block(P,W){return this._blockStarts.push(this._nodes.length),P&&this.code(P).endBlock(W),this}endBlock(P){const W=this._blockStarts.pop();if(W===void 0)throw new Error("CodeGen: not in self-balancing block");const se=this._nodes.length-W;if(se<0||P!==void 0&&se!==P)throw new Error(`CodeGen: wrong number of nodes: ${se} vs ${P} expected`);return this._nodes.length=W,this}func(P,W=t.nil,se,X){return this._blockNode(new w(P,W,se)),X&&this.code(X).endFunc(),this}endFunc(){return this._endBlockNode(w)}optimize(P=1){for(;P-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(P){return this._currNode.nodes.push(P),this}_blockNode(P){this._currNode.nodes.push(P),this._nodes.push(P)}_endBlockNode(P,W){const se=this._currNode;if(se instanceof P||W&&se instanceof W)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${W?`${P.kind}/${W.kind}`:P.kind}"`)}_elseNode(P){const W=this._currNode;if(!(W instanceof b))throw new Error('CodeGen: "else" without "if"');return this._currNode=W.else=P,this}get _root(){return this._nodes[0]}get _currNode(){const P=this._nodes;return P[P.length-1]}set _currNode(P){const W=this._nodes;W[W.length-1]=P}}e.CodeGen=L;function q(U,P){for(const W in P)U[W]=(U[W]||0)+(P[W]||0);return U}function F(U,P){return P instanceof t._CodeOrName?q(U,P.names):U}function Y(U,P,W){if(U instanceof t.Name)return se(U);if(!X(U))return U;return new t._Code(U._items.reduce((V,ue)=>(ue instanceof t.Name&&(ue=se(ue)),ue instanceof t._Code?V.push(...ue._items):V.push(ue),V),[]));function se(V){const ue=W[V.str];return ue===void 0||P[V.str]!==1?V:(delete P[V.str],ue)}function X(V){return V instanceof t._Code&&V._items.some(ue=>ue instanceof t.Name&&P[ue.str]===1&&W[ue.str]!==void 0)}}function Q(U,P){for(const W in P)U[W]=(U[W]||0)-(P[W]||0)}function G(U){return typeof U=="boolean"||typeof U=="number"||U===null?!U:(0,t._)`!${H(U)}`}e.not=G;const ee=$(e.operators.AND);function ne(...U){return U.reduce(ee)}e.and=ne;const z=$(e.operators.OR);function B(...U){return U.reduce(z)}e.or=B;function $(U){return(P,W)=>P===t.nil?W:W===t.nil?P:(0,t._)`${H(P)} ${U} ${H(W)}`}function H(U){return U instanceof t.Name?U:(0,t._)`(${U})`}})(og)),og}var xt={},FS;function Nt(){if(FS)return xt;FS=1,Object.defineProperty(xt,"__esModule",{value:!0}),xt.checkStrictMode=xt.getErrorPath=xt.Type=xt.useFunc=xt.setEvaluated=xt.evaluatedPropsToName=xt.mergeEvaluated=xt.eachItem=xt.unescapeJsonPointer=xt.escapeJsonPointer=xt.escapeFragment=xt.unescapeFragment=xt.schemaRefOrVal=xt.schemaHasRulesButRef=xt.schemaHasRules=xt.checkUnknownRules=xt.alwaysValidSchema=xt.toHash=void 0;const e=St(),t=Jh();function n(C){const w={};for(const T of C)w[T]=!0;return w}xt.toHash=n;function r(C,w){return typeof w=="boolean"?w:Object.keys(w).length===0?!0:(o(C,w),!c(w,C.self.RULES.all))}xt.alwaysValidSchema=r;function o(C,w=C.schema){const{opts:T,self:j}=C;if(!T.strictSchema||typeof w=="boolean")return;const M=j.RULES.keywords;for(const D in w)M[D]||k(C,`unknown keyword: "${D}"`)}xt.checkUnknownRules=o;function c(C,w){if(typeof C=="boolean")return!C;for(const T in C)if(w[T])return!0;return!1}xt.schemaHasRules=c;function h(C,w){if(typeof C=="boolean")return!C;for(const T in C)if(T!=="$ref"&&w.all[T])return!0;return!1}xt.schemaHasRulesButRef=h;function l({topSchemaRef:C,schemaPath:w},T,j,M){if(!M){if(typeof T=="number"||typeof T=="boolean")return T;if(typeof T=="string")return(0,e._)`${T}`}return(0,e._)`${C}${w}${(0,e.getProperty)(j)}`}xt.schemaRefOrVal=l;function u(C){return p(decodeURIComponent(C))}xt.unescapeFragment=u;function m(C){return encodeURIComponent(g(C))}xt.escapeFragment=m;function g(C){return typeof C=="number"?`${C}`:C.replace(/~/g,"~0").replace(/\//g,"~1")}xt.escapeJsonPointer=g;function p(C){return C.replace(/~1/g,"/").replace(/~0/g,"~")}xt.unescapeJsonPointer=p;function S(C,w){if(Array.isArray(C))for(const T of C)w(T);else w(C)}xt.eachItem=S;function x({mergeNames:C,mergeToName:w,mergeValues:T,resultToName:j}){return(M,D,L,q)=>{const F=L===void 0?D:L instanceof e.Name?(D instanceof e.Name?C(M,D,L):w(M,D,L),L):D instanceof e.Name?(w(M,L,D),D):T(D,L);return q===e.Name&&!(F instanceof e.Name)?j(M,F):F}}xt.mergeEvaluated={props:x({mergeNames:(C,w,T)=>C.if((0,e._)`${T} !== true && ${w} !== undefined`,()=>{C.if((0,e._)`${w} === true`,()=>C.assign(T,!0),()=>C.assign(T,(0,e._)`${T} || {}`).code((0,e._)`Object.assign(${T}, ${w})`))}),mergeToName:(C,w,T)=>C.if((0,e._)`${T} !== true`,()=>{w===!0?C.assign(T,!0):(C.assign(T,(0,e._)`${T} || {}`),E(C,T,w))}),mergeValues:(C,w)=>C===!0?!0:{...C,...w},resultToName:A}),items:x({mergeNames:(C,w,T)=>C.if((0,e._)`${T} !== true && ${w} !== undefined`,()=>C.assign(T,(0,e._)`${w} === true ? true : ${T} > ${w} ? ${T} : ${w}`)),mergeToName:(C,w,T)=>C.if((0,e._)`${T} !== true`,()=>C.assign(T,w===!0?!0:(0,e._)`${T} > ${w} ? ${T} : ${w}`)),mergeValues:(C,w)=>C===!0?!0:Math.max(C,w),resultToName:(C,w)=>C.var("items",w)})};function A(C,w){if(w===!0)return C.var("props",!0);const T=C.var("props",(0,e._)`{}`);return w!==void 0&&E(C,T,w),T}xt.evaluatedPropsToName=A;function E(C,w,T){Object.keys(T).forEach(j=>C.assign((0,e._)`${w}${(0,e.getProperty)(j)}`,!0))}xt.setEvaluated=E;const y={};function b(C,w){return C.scopeValue("func",{ref:w,code:y[w.code]||(y[w.code]=new t._Code(w.code))})}xt.useFunc=b;var v;(function(C){C[C.Num=0]="Num",C[C.Str=1]="Str"})(v||(xt.Type=v={}));function _(C,w,T){if(C instanceof e.Name){const j=w===v.Num;return T?j?(0,e._)`"[" + ${C} + "]"`:(0,e._)`"['" + ${C} + "']"`:j?(0,e._)`"/" + ${C}`:(0,e._)`"/" + ${C}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return T?(0,e.getProperty)(C).toString():"/"+g(C)}xt.getErrorPath=_;function k(C,w,T=C.opts.strictSchema){if(T){if(w=`strict mode: ${w}`,T===!0)throw new Error(w);C.self.logger.warn(w)}}return xt.checkStrictMode=k,xt}var ld={},qS;function Ei(){if(qS)return ld;qS=1,Object.defineProperty(ld,"__esModule",{value:!0});const e=St(),t={data:new e.Name("data"),valCxt:new e.Name("valCxt"),instancePath:new e.Name("instancePath"),parentData:new e.Name("parentData"),parentDataProperty:new e.Name("parentDataProperty"),rootData:new e.Name("rootData"),dynamicAnchors:new e.Name("dynamicAnchors"),vErrors:new e.Name("vErrors"),errors:new e.Name("errors"),this:new e.Name("this"),self:new e.Name("self"),scope:new e.Name("scope"),json:new e.Name("json"),jsonPos:new e.Name("jsonPos"),jsonLen:new e.Name("jsonLen"),jsonPart:new e.Name("jsonPart")};return ld.default=t,ld}var VS;function hf(){return VS||(VS=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;const t=St(),n=Nt(),r=Ei();e.keywordError={message:({keyword:y})=>(0,t.str)`must pass "${y}" keyword validation`},e.keyword$DataError={message:({keyword:y,schemaType:b})=>b?(0,t.str)`"${y}" keyword must be ${b} ($data)`:(0,t.str)`"${y}" keyword is invalid ($data)`};function o(y,b=e.keywordError,v,_){const{it:k}=y,{gen:C,compositeRule:w,allErrors:T}=k,j=p(y,b,v);_??(w||T)?u(C,j):m(k,(0,t._)`[${j}]`)}e.reportError=o;function c(y,b=e.keywordError,v){const{it:_}=y,{gen:k,compositeRule:C,allErrors:w}=_,T=p(y,b,v);u(k,T),C||w||m(_,r.default.vErrors)}e.reportExtraError=c;function h(y,b){y.assign(r.default.errors,b),y.if((0,t._)`${r.default.vErrors} !== null`,()=>y.if(b,()=>y.assign((0,t._)`${r.default.vErrors}.length`,b),()=>y.assign(r.default.vErrors,null)))}e.resetErrorsCount=h;function l({gen:y,keyword:b,schemaValue:v,data:_,errsCount:k,it:C}){if(k===void 0)throw new Error("ajv implementation error");const w=y.name("err");y.forRange("i",k,r.default.errors,T=>{y.const(w,(0,t._)`${r.default.vErrors}[${T}]`),y.if((0,t._)`${w}.instancePath === undefined`,()=>y.assign((0,t._)`${w}.instancePath`,(0,t.strConcat)(r.default.instancePath,C.errorPath))),y.assign((0,t._)`${w}.schemaPath`,(0,t.str)`${C.errSchemaPath}/${b}`),C.opts.verbose&&(y.assign((0,t._)`${w}.schema`,v),y.assign((0,t._)`${w}.data`,_))})}e.extendErrors=l;function u(y,b){const v=y.const("err",b);y.if((0,t._)`${r.default.vErrors} === null`,()=>y.assign(r.default.vErrors,(0,t._)`[${v}]`),(0,t._)`${r.default.vErrors}.push(${v})`),y.code((0,t._)`${r.default.errors}++`)}function m(y,b){const{gen:v,validateName:_,schemaEnv:k}=y;k.$async?v.throw((0,t._)`new ${y.ValidationError}(${b})`):(v.assign((0,t._)`${_}.errors`,b),v.return(!1))}const g={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function p(y,b,v){const{createErrors:_}=y.it;return _===!1?(0,t._)`{}`:S(y,b,v)}function S(y,b,v={}){const{gen:_,it:k}=y,C=[x(k,v),A(y,v)];return E(y,b,C),_.object(...C)}function x({errorPath:y},{instancePath:b}){const v=b?(0,t.str)`${y}${(0,n.getErrorPath)(b,n.Type.Str)}`:y;return[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,v)]}function A({keyword:y,it:{errSchemaPath:b}},{schemaPath:v,parentSchema:_}){let k=_?b:(0,t.str)`${b}/${y}`;return v&&(k=(0,t.str)`${k}${(0,n.getErrorPath)(v,n.Type.Str)}`),[g.schemaPath,k]}function E(y,{params:b,message:v},_){const{keyword:k,data:C,schemaValue:w,it:T}=y,{opts:j,propertyName:M,topSchemaRef:D,schemaPath:L}=T;_.push([g.keyword,k],[g.params,typeof b=="function"?b(y):b||(0,t._)`{}`]),j.messages&&_.push([g.message,typeof v=="function"?v(y):v]),j.verbose&&_.push([g.schema,w],[g.parentSchema,(0,t._)`${D}${L}`],[r.default.data,C]),M&&_.push([g.propertyName,M])}})(ag)),ag}var GS;function PD(){if(GS)return Ea;GS=1,Object.defineProperty(Ea,"__esModule",{value:!0}),Ea.boolOrEmptySchema=Ea.topBoolOrEmptySchema=void 0;const e=hf(),t=St(),n=Ei(),r={message:"boolean schema is false"};function o(l){const{gen:u,schema:m,validateName:g}=l;m===!1?h(l,!1):typeof m=="object"&&m.$async===!0?u.return(n.default.data):(u.assign((0,t._)`${g}.errors`,null),u.return(!0))}Ea.topBoolOrEmptySchema=o;function c(l,u){const{gen:m,schema:g}=l;g===!1?(m.var(u,!1),h(l)):m.var(u,!0)}Ea.boolOrEmptySchema=c;function h(l,u){const{gen:m,data:g}=l,p={gen:m,keyword:"false schema",data:g,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:l};(0,e.reportError)(p,r,void 0,u)}return Ea}var nn={},ka={},WS;function _2(){if(WS)return ka;WS=1,Object.defineProperty(ka,"__esModule",{value:!0}),ka.getRules=ka.isJSONType=void 0;const e=["string","number","integer","boolean","null","object","array"],t=new Set(e);function n(o){return typeof o=="string"&&t.has(o)}ka.isJSONType=n;function r(){const o={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...o,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},o.number,o.string,o.array,o.object],post:{rules:[]},all:{},keywords:{}}}return ka.getRules=r,ka}var nr={},KS;function y2(){if(KS)return nr;KS=1,Object.defineProperty(nr,"__esModule",{value:!0}),nr.shouldUseRule=nr.shouldUseGroup=nr.schemaHasRulesForType=void 0;function e({schema:r,self:o},c){const h=o.RULES.types[c];return h&&h!==!0&&t(r,h)}nr.schemaHasRulesForType=e;function t(r,o){return o.rules.some(c=>n(r,c))}nr.shouldUseGroup=t;function n(r,o){var c;return r[o.keyword]!==void 0||((c=o.definition.implements)===null||c===void 0?void 0:c.some(h=>r[h]!==void 0))}return nr.shouldUseRule=n,nr}var YS;function Zh(){if(YS)return nn;YS=1,Object.defineProperty(nn,"__esModule",{value:!0}),nn.reportTypeError=nn.checkDataTypes=nn.checkDataType=nn.coerceAndCheckDataType=nn.getJSONTypes=nn.getSchemaTypes=nn.DataType=void 0;const e=_2(),t=y2(),n=hf(),r=St(),o=Nt();var c;(function(v){v[v.Correct=0]="Correct",v[v.Wrong=1]="Wrong"})(c||(nn.DataType=c={}));function h(v){const _=l(v.type);if(_.includes("null")){if(v.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!_.length&&v.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');v.nullable===!0&&_.push("null")}return _}nn.getSchemaTypes=h;function l(v){const _=Array.isArray(v)?v:v?[v]:[];if(_.every(e.isJSONType))return _;throw new Error("type must be JSONType or JSONType[]: "+_.join(","))}nn.getJSONTypes=l;function u(v,_){const{gen:k,data:C,opts:w}=v,T=g(_,w.coerceTypes),j=_.length>0&&!(T.length===0&&_.length===1&&(0,t.schemaHasRulesForType)(v,_[0]));if(j){const M=A(_,C,w.strictNumbers,c.Wrong);k.if(M,()=>{T.length?p(v,_,T):y(v)})}return j}nn.coerceAndCheckDataType=u;const m=new Set(["string","number","integer","boolean","null"]);function g(v,_){return _?v.filter(k=>m.has(k)||_==="array"&&k==="array"):[]}function p(v,_,k){const{gen:C,data:w,opts:T}=v,j=C.let("dataType",(0,r._)`typeof ${w}`),M=C.let("coerced",(0,r._)`undefined`);T.coerceTypes==="array"&&C.if((0,r._)`${j} == 'object' && Array.isArray(${w}) && ${w}.length == 1`,()=>C.assign(w,(0,r._)`${w}[0]`).assign(j,(0,r._)`typeof ${w}`).if(A(_,w,T.strictNumbers),()=>C.assign(M,w))),C.if((0,r._)`${M} !== undefined`);for(const L of k)(m.has(L)||L==="array"&&T.coerceTypes==="array")&&D(L);C.else(),y(v),C.endIf(),C.if((0,r._)`${M} !== undefined`,()=>{C.assign(w,M),S(v,M)});function D(L){switch(L){case"string":C.elseIf((0,r._)`${j} == "number" || ${j} == "boolean"`).assign(M,(0,r._)`"" + ${w}`).elseIf((0,r._)`${w} === null`).assign(M,(0,r._)`""`);return;case"number":C.elseIf((0,r._)`${j} == "boolean" || ${w} === null
|
|
488
|
+
|| (${j} == "string" && ${w} && ${w} == +${w})`).assign(M,(0,r._)`+${w}`);return;case"integer":C.elseIf((0,r._)`${j} === "boolean" || ${w} === null
|
|
489
|
+
|| (${j} === "string" && ${w} && ${w} == +${w} && !(${w} % 1))`).assign(M,(0,r._)`+${w}`);return;case"boolean":C.elseIf((0,r._)`${w} === "false" || ${w} === 0 || ${w} === null`).assign(M,!1).elseIf((0,r._)`${w} === "true" || ${w} === 1`).assign(M,!0);return;case"null":C.elseIf((0,r._)`${w} === "" || ${w} === 0 || ${w} === false`),C.assign(M,null);return;case"array":C.elseIf((0,r._)`${j} === "string" || ${j} === "number"
|
|
490
|
+
|| ${j} === "boolean" || ${w} === null`).assign(M,(0,r._)`[${w}]`)}}}function S({gen:v,parentData:_,parentDataProperty:k},C){v.if((0,r._)`${_} !== undefined`,()=>v.assign((0,r._)`${_}[${k}]`,C))}function x(v,_,k,C=c.Correct){const w=C===c.Correct?r.operators.EQ:r.operators.NEQ;let T;switch(v){case"null":return(0,r._)`${_} ${w} null`;case"array":T=(0,r._)`Array.isArray(${_})`;break;case"object":T=(0,r._)`${_} && typeof ${_} == "object" && !Array.isArray(${_})`;break;case"integer":T=j((0,r._)`!(${_} % 1) && !isNaN(${_})`);break;case"number":T=j();break;default:return(0,r._)`typeof ${_} ${w} ${v}`}return C===c.Correct?T:(0,r.not)(T);function j(M=r.nil){return(0,r.and)((0,r._)`typeof ${_} == "number"`,M,k?(0,r._)`isFinite(${_})`:r.nil)}}nn.checkDataType=x;function A(v,_,k,C){if(v.length===1)return x(v[0],_,k,C);let w;const T=(0,o.toHash)(v);if(T.array&&T.object){const j=(0,r._)`typeof ${_} != "object"`;w=T.null?j:(0,r._)`!${_} || ${j}`,delete T.null,delete T.array,delete T.object}else w=r.nil;T.number&&delete T.integer;for(const j in T)w=(0,r.and)(w,x(j,_,k,C));return w}nn.checkDataTypes=A;const E={message:({schema:v})=>`must be ${v}`,params:({schema:v,schemaValue:_})=>typeof v=="string"?(0,r._)`{type: ${v}}`:(0,r._)`{type: ${_}}`};function y(v){const _=b(v);(0,n.reportError)(_,E)}nn.reportTypeError=y;function b(v){const{gen:_,data:k,schema:C}=v,w=(0,o.schemaRefOrVal)(v,C,"type");return{gen:_,keyword:"type",data:k,schema:C.type,schemaCode:w,schemaValue:w,parentSchema:C,params:{},it:v}}return nn}var dc={},XS;function BD(){if(XS)return dc;XS=1,Object.defineProperty(dc,"__esModule",{value:!0}),dc.assignDefaults=void 0;const e=St(),t=Nt();function n(o,c){const{properties:h,items:l}=o.schema;if(c==="object"&&h)for(const u in h)r(o,u,h[u].default);else c==="array"&&Array.isArray(l)&&l.forEach((u,m)=>r(o,m,u.default))}dc.assignDefaults=n;function r(o,c,h){const{gen:l,compositeRule:u,data:m,opts:g}=o;if(h===void 0)return;const p=(0,e._)`${m}${(0,e.getProperty)(c)}`;if(u){(0,t.checkStrictMode)(o,`default is ignored for: ${p}`);return}let S=(0,e._)`${p} === undefined`;g.useDefaults==="empty"&&(S=(0,e._)`${S} || ${p} === null || ${p} === ""`),l.if(S,(0,e._)`${p} = ${(0,e.stringify)(h)}`)}return dc}var bi={},Gt={},JS;function ki(){if(JS)return Gt;JS=1,Object.defineProperty(Gt,"__esModule",{value:!0}),Gt.validateUnion=Gt.validateArray=Gt.usePattern=Gt.callValidateCode=Gt.schemaProperties=Gt.allSchemaProperties=Gt.noPropertyInData=Gt.propertyInData=Gt.isOwnProperty=Gt.hasPropFunc=Gt.reportMissingProp=Gt.checkMissingProp=Gt.checkReportMissingProp=void 0;const e=St(),t=Nt(),n=Ei(),r=Nt();function o(v,_){const{gen:k,data:C,it:w}=v;k.if(g(k,C,_,w.opts.ownProperties),()=>{v.setParams({missingProperty:(0,e._)`${_}`},!0),v.error()})}Gt.checkReportMissingProp=o;function c({gen:v,data:_,it:{opts:k}},C,w){return(0,e.or)(...C.map(T=>(0,e.and)(g(v,_,T,k.ownProperties),(0,e._)`${w} = ${T}`)))}Gt.checkMissingProp=c;function h(v,_){v.setParams({missingProperty:_},!0),v.error()}Gt.reportMissingProp=h;function l(v){return v.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,e._)`Object.prototype.hasOwnProperty`})}Gt.hasPropFunc=l;function u(v,_,k){return(0,e._)`${l(v)}.call(${_}, ${k})`}Gt.isOwnProperty=u;function m(v,_,k,C){const w=(0,e._)`${_}${(0,e.getProperty)(k)} !== undefined`;return C?(0,e._)`${w} && ${u(v,_,k)}`:w}Gt.propertyInData=m;function g(v,_,k,C){const w=(0,e._)`${_}${(0,e.getProperty)(k)} === undefined`;return C?(0,e.or)(w,(0,e.not)(u(v,_,k))):w}Gt.noPropertyInData=g;function p(v){return v?Object.keys(v).filter(_=>_!=="__proto__"):[]}Gt.allSchemaProperties=p;function S(v,_){return p(_).filter(k=>!(0,t.alwaysValidSchema)(v,_[k]))}Gt.schemaProperties=S;function x({schemaCode:v,data:_,it:{gen:k,topSchemaRef:C,schemaPath:w,errorPath:T},it:j},M,D,L){const q=L?(0,e._)`${v}, ${_}, ${C}${w}`:_,F=[[n.default.instancePath,(0,e.strConcat)(n.default.instancePath,T)],[n.default.parentData,j.parentData],[n.default.parentDataProperty,j.parentDataProperty],[n.default.rootData,n.default.rootData]];j.opts.dynamicRef&&F.push([n.default.dynamicAnchors,n.default.dynamicAnchors]);const Y=(0,e._)`${q}, ${k.object(...F)}`;return D!==e.nil?(0,e._)`${M}.call(${D}, ${Y})`:(0,e._)`${M}(${Y})`}Gt.callValidateCode=x;const A=(0,e._)`new RegExp`;function E({gen:v,it:{opts:_}},k){const C=_.unicodeRegExp?"u":"",{regExp:w}=_.code,T=w(k,C);return v.scopeValue("pattern",{key:T.toString(),ref:T,code:(0,e._)`${w.code==="new RegExp"?A:(0,r.useFunc)(v,w)}(${k}, ${C})`})}Gt.usePattern=E;function y(v){const{gen:_,data:k,keyword:C,it:w}=v,T=_.name("valid");if(w.allErrors){const M=_.let("valid",!0);return j(()=>_.assign(M,!1)),M}return _.var(T,!0),j(()=>_.break()),T;function j(M){const D=_.const("len",(0,e._)`${k}.length`);_.forRange("i",0,D,L=>{v.subschema({keyword:C,dataProp:L,dataPropType:t.Type.Num},T),_.if((0,e.not)(T),M)})}}Gt.validateArray=y;function b(v){const{gen:_,schema:k,keyword:C,it:w}=v;if(!Array.isArray(k))throw new Error("ajv implementation error");if(k.some(D=>(0,t.alwaysValidSchema)(w,D))&&!w.opts.unevaluated)return;const j=_.let("valid",!1),M=_.name("_valid");_.block(()=>k.forEach((D,L)=>{const q=v.subschema({keyword:C,schemaProp:L,compositeRule:!0},M);_.assign(j,(0,e._)`${j} || ${M}`),v.mergeValidEvaluated(q,M)||_.if((0,e.not)(j))})),v.result(j,()=>v.reset(),()=>v.error(!0))}return Gt.validateUnion=b,Gt}var ZS;function zD(){if(ZS)return bi;ZS=1,Object.defineProperty(bi,"__esModule",{value:!0}),bi.validateKeywordUsage=bi.validSchemaType=bi.funcKeywordCode=bi.macroKeywordCode=void 0;const e=St(),t=Ei(),n=ki(),r=hf();function o(S,x){const{gen:A,keyword:E,schema:y,parentSchema:b,it:v}=S,_=x.macro.call(v.self,y,b,v),k=m(A,E,_);v.opts.validateSchema!==!1&&v.self.validateSchema(_,!0);const C=A.name("valid");S.subschema({schema:_,schemaPath:e.nil,errSchemaPath:`${v.errSchemaPath}/${E}`,topSchemaRef:k,compositeRule:!0},C),S.pass(C,()=>S.error(!0))}bi.macroKeywordCode=o;function c(S,x){var A;const{gen:E,keyword:y,schema:b,parentSchema:v,$data:_,it:k}=S;u(k,x);const C=!_&&x.compile?x.compile.call(k.self,b,v,k):x.validate,w=m(E,y,C),T=E.let("valid");S.block$data(T,j),S.ok((A=x.valid)!==null&&A!==void 0?A:T);function j(){if(x.errors===!1)L(),x.modifying&&h(S),q(()=>S.error());else{const F=x.async?M():D();x.modifying&&h(S),q(()=>l(S,F))}}function M(){const F=E.let("ruleErrs",null);return E.try(()=>L((0,e._)`await `),Y=>E.assign(T,!1).if((0,e._)`${Y} instanceof ${k.ValidationError}`,()=>E.assign(F,(0,e._)`${Y}.errors`),()=>E.throw(Y))),F}function D(){const F=(0,e._)`${w}.errors`;return E.assign(F,null),L(e.nil),F}function L(F=x.async?(0,e._)`await `:e.nil){const Y=k.opts.passContext?t.default.this:t.default.self,Q=!("compile"in x&&!_||x.schema===!1);E.assign(T,(0,e._)`${F}${(0,n.callValidateCode)(S,w,Y,Q)}`,x.modifying)}function q(F){var Y;E.if((0,e.not)((Y=x.valid)!==null&&Y!==void 0?Y:T),F)}}bi.funcKeywordCode=c;function h(S){const{gen:x,data:A,it:E}=S;x.if(E.parentData,()=>x.assign(A,(0,e._)`${E.parentData}[${E.parentDataProperty}]`))}function l(S,x){const{gen:A}=S;A.if((0,e._)`Array.isArray(${x})`,()=>{A.assign(t.default.vErrors,(0,e._)`${t.default.vErrors} === null ? ${x} : ${t.default.vErrors}.concat(${x})`).assign(t.default.errors,(0,e._)`${t.default.vErrors}.length`),(0,r.extendErrors)(S)},()=>S.error())}function u({schemaEnv:S},x){if(x.async&&!S.$async)throw new Error("async keyword in sync schema")}function m(S,x,A){if(A===void 0)throw new Error(`keyword "${x}" failed to compile`);return S.scopeValue("keyword",typeof A=="function"?{ref:A}:{ref:A,code:(0,e.stringify)(A)})}function g(S,x,A=!1){return!x.length||x.some(E=>E==="array"?Array.isArray(S):E==="object"?S&&typeof S=="object"&&!Array.isArray(S):typeof S==E||A&&typeof S>"u")}bi.validSchemaType=g;function p({schema:S,opts:x,self:A,errSchemaPath:E},y,b){if(Array.isArray(y.keyword)?!y.keyword.includes(b):y.keyword!==b)throw new Error("ajv implementation error");const v=y.dependencies;if(v!=null&&v.some(_=>!Object.prototype.hasOwnProperty.call(S,_)))throw new Error(`parent schema must have dependencies of ${b}: ${v.join(",")}`);if(y.validateSchema&&!y.validateSchema(S[b])){const k=`keyword "${b}" value is invalid at path "${E}": `+A.errorsText(y.validateSchema.errors);if(x.validateSchema==="log")A.logger.error(k);else throw new Error(k)}}return bi.validateKeywordUsage=p,bi}var ir={},QS;function HD(){if(QS)return ir;QS=1,Object.defineProperty(ir,"__esModule",{value:!0}),ir.extendSubschemaMode=ir.extendSubschemaData=ir.getSubschema=void 0;const e=St(),t=Nt();function n(c,{keyword:h,schemaProp:l,schema:u,schemaPath:m,errSchemaPath:g,topSchemaRef:p}){if(h!==void 0&&u!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(h!==void 0){const S=c.schema[h];return l===void 0?{schema:S,schemaPath:(0,e._)`${c.schemaPath}${(0,e.getProperty)(h)}`,errSchemaPath:`${c.errSchemaPath}/${h}`}:{schema:S[l],schemaPath:(0,e._)`${c.schemaPath}${(0,e.getProperty)(h)}${(0,e.getProperty)(l)}`,errSchemaPath:`${c.errSchemaPath}/${h}/${(0,t.escapeFragment)(l)}`}}if(u!==void 0){if(m===void 0||g===void 0||p===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:u,schemaPath:m,topSchemaRef:p,errSchemaPath:g}}throw new Error('either "keyword" or "schema" must be passed')}ir.getSubschema=n;function r(c,h,{dataProp:l,dataPropType:u,data:m,dataTypes:g,propertyName:p}){if(m!==void 0&&l!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:S}=h;if(l!==void 0){const{errorPath:A,dataPathArr:E,opts:y}=h,b=S.let("data",(0,e._)`${h.data}${(0,e.getProperty)(l)}`,!0);x(b),c.errorPath=(0,e.str)`${A}${(0,t.getErrorPath)(l,u,y.jsPropertySyntax)}`,c.parentDataProperty=(0,e._)`${l}`,c.dataPathArr=[...E,c.parentDataProperty]}if(m!==void 0){const A=m instanceof e.Name?m:S.let("data",m,!0);x(A),p!==void 0&&(c.propertyName=p)}g&&(c.dataTypes=g);function x(A){c.data=A,c.dataLevel=h.dataLevel+1,c.dataTypes=[],h.definedProperties=new Set,c.parentData=h.data,c.dataNames=[...h.dataNames,A]}}ir.extendSubschemaData=r;function o(c,{jtdDiscriminator:h,jtdMetadata:l,compositeRule:u,createErrors:m,allErrors:g}){u!==void 0&&(c.compositeRule=u),m!==void 0&&(c.createErrors=m),g!==void 0&&(c.allErrors=g),c.jtdDiscriminator=h,c.jtdMetadata=l}return ir.extendSubschemaMode=o,ir}var xn={},ug,ew;function b2(){return ew||(ew=1,ug=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var r,o,c;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(o=r;o--!==0;)if(!e(t[o],n[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(c=Object.keys(t),r=c.length,r!==Object.keys(n).length)return!1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(n,c[o]))return!1;for(o=r;o--!==0;){var h=c[o];if(!e(t[h],n[h]))return!1}return!0}return t!==t&&n!==n}),ug}var dg={exports:{}},tw;function UD(){if(tw)return dg.exports;tw=1;var e=dg.exports=function(r,o,c){typeof o=="function"&&(c=o,o={}),c=o.cb||c;var h=typeof c=="function"?c:c.pre||function(){},l=c.post||function(){};t(o,h,l,r,"",r)};e.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},e.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},e.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},e.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function t(r,o,c,h,l,u,m,g,p,S){if(h&&typeof h=="object"&&!Array.isArray(h)){o(h,l,u,m,g,p,S);for(var x in h){var A=h[x];if(Array.isArray(A)){if(x in e.arrayKeywords)for(var E=0;E<A.length;E++)t(r,o,c,A[E],l+"/"+x+"/"+E,u,l,x,h,E)}else if(x in e.propsKeywords){if(A&&typeof A=="object")for(var y in A)t(r,o,c,A[y],l+"/"+x+"/"+n(y),u,l,x,h,y)}else(x in e.keywords||r.allKeys&&!(x in e.skipKeywords))&&t(r,o,c,A,l+"/"+x,u,l,x,h)}c(h,l,u,m,g,p,S)}}function n(r){return r.replace(/~/g,"~0").replace(/\//g,"~1")}return dg.exports}var sw;function ff(){if(sw)return xn;sw=1,Object.defineProperty(xn,"__esModule",{value:!0}),xn.getSchemaRefs=xn.resolveUrl=xn.normalizeId=xn._getFullPath=xn.getFullPath=xn.inlineRef=void 0;const e=Nt(),t=b2(),n=UD(),r=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function o(E,y=!0){return typeof E=="boolean"?!0:y===!0?!h(E):y?l(E)<=y:!1}xn.inlineRef=o;const c=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function h(E){for(const y in E){if(c.has(y))return!0;const b=E[y];if(Array.isArray(b)&&b.some(h)||typeof b=="object"&&h(b))return!0}return!1}function l(E){let y=0;for(const b in E){if(b==="$ref")return 1/0;if(y++,!r.has(b)&&(typeof E[b]=="object"&&(0,e.eachItem)(E[b],v=>y+=l(v)),y===1/0))return 1/0}return y}function u(E,y="",b){b!==!1&&(y=p(y));const v=E.parse(y);return m(E,v)}xn.getFullPath=u;function m(E,y){return E.serialize(y).split("#")[0]+"#"}xn._getFullPath=m;const g=/#\/?$/;function p(E){return E?E.replace(g,""):""}xn.normalizeId=p;function S(E,y,b){return b=p(b),E.resolve(y,b)}xn.resolveUrl=S;const x=/^[a-z_][-a-z0-9._]*$/i;function A(E,y){if(typeof E=="boolean")return{};const{schemaId:b,uriResolver:v}=this.opts,_=p(E[b]||y),k={"":_},C=u(v,_,!1),w={},T=new Set;return n(E,{allKeys:!0},(D,L,q,F)=>{if(F===void 0)return;const Y=C+L;let Q=k[F];typeof D[b]=="string"&&(Q=G.call(this,D[b])),ee.call(this,D.$anchor),ee.call(this,D.$dynamicAnchor),k[L]=Q;function G(ne){const z=this.opts.uriResolver.resolve;if(ne=p(Q?z(Q,ne):ne),T.has(ne))throw M(ne);T.add(ne);let B=this.refs[ne];return typeof B=="string"&&(B=this.refs[B]),typeof B=="object"?j(D,B.schema,ne):ne!==p(Y)&&(ne[0]==="#"?(j(D,w[ne],ne),w[ne]=D):this.refs[ne]=Y),ne}function ee(ne){if(typeof ne=="string"){if(!x.test(ne))throw new Error(`invalid anchor "${ne}"`);G.call(this,`#${ne}`)}}}),w;function j(D,L,q){if(L!==void 0&&!t(D,L))throw M(q)}function M(D){return new Error(`reference "${D}" resolves to more than one schema`)}}return xn.getSchemaRefs=A,xn}var nw;function pf(){if(nw)return sr;nw=1,Object.defineProperty(sr,"__esModule",{value:!0}),sr.getData=sr.KeywordCxt=sr.validateFunctionCode=void 0;const e=PD(),t=Zh(),n=y2(),r=Zh(),o=BD(),c=zD(),h=HD(),l=St(),u=Ei(),m=ff(),g=Nt(),p=hf();function S(Z){if(C(Z)&&(T(Z),k(Z))){y(Z);return}x(Z,()=>(0,e.topBoolOrEmptySchema)(Z))}sr.validateFunctionCode=S;function x({gen:Z,validateName:te,schema:pe,schemaEnv:ye,opts:ke},Le){ke.code.es5?Z.func(te,(0,l._)`${u.default.data}, ${u.default.valCxt}`,ye.$async,()=>{Z.code((0,l._)`"use strict"; ${v(pe,ke)}`),E(Z,ke),Z.code(Le)}):Z.func(te,(0,l._)`${u.default.data}, ${A(ke)}`,ye.$async,()=>Z.code(v(pe,ke)).code(Le))}function A(Z){return(0,l._)`{${u.default.instancePath}="", ${u.default.parentData}, ${u.default.parentDataProperty}, ${u.default.rootData}=${u.default.data}${Z.dynamicRef?(0,l._)`, ${u.default.dynamicAnchors}={}`:l.nil}}={}`}function E(Z,te){Z.if(u.default.valCxt,()=>{Z.var(u.default.instancePath,(0,l._)`${u.default.valCxt}.${u.default.instancePath}`),Z.var(u.default.parentData,(0,l._)`${u.default.valCxt}.${u.default.parentData}`),Z.var(u.default.parentDataProperty,(0,l._)`${u.default.valCxt}.${u.default.parentDataProperty}`),Z.var(u.default.rootData,(0,l._)`${u.default.valCxt}.${u.default.rootData}`),te.dynamicRef&&Z.var(u.default.dynamicAnchors,(0,l._)`${u.default.valCxt}.${u.default.dynamicAnchors}`)},()=>{Z.var(u.default.instancePath,(0,l._)`""`),Z.var(u.default.parentData,(0,l._)`undefined`),Z.var(u.default.parentDataProperty,(0,l._)`undefined`),Z.var(u.default.rootData,u.default.data),te.dynamicRef&&Z.var(u.default.dynamicAnchors,(0,l._)`{}`)})}function y(Z){const{schema:te,opts:pe,gen:ye}=Z;x(Z,()=>{pe.$comment&&te.$comment&&F(Z),D(Z),ye.let(u.default.vErrors,null),ye.let(u.default.errors,0),pe.unevaluated&&b(Z),j(Z),Y(Z)})}function b(Z){const{gen:te,validateName:pe}=Z;Z.evaluated=te.const("evaluated",(0,l._)`${pe}.evaluated`),te.if((0,l._)`${Z.evaluated}.dynamicProps`,()=>te.assign((0,l._)`${Z.evaluated}.props`,(0,l._)`undefined`)),te.if((0,l._)`${Z.evaluated}.dynamicItems`,()=>te.assign((0,l._)`${Z.evaluated}.items`,(0,l._)`undefined`))}function v(Z,te){const pe=typeof Z=="object"&&Z[te.schemaId];return pe&&(te.code.source||te.code.process)?(0,l._)`/*# sourceURL=${pe} */`:l.nil}function _(Z,te){if(C(Z)&&(T(Z),k(Z))){w(Z,te);return}(0,e.boolOrEmptySchema)(Z,te)}function k({schema:Z,self:te}){if(typeof Z=="boolean")return!Z;for(const pe in Z)if(te.RULES.all[pe])return!0;return!1}function C(Z){return typeof Z.schema!="boolean"}function w(Z,te){const{schema:pe,gen:ye,opts:ke}=Z;ke.$comment&&pe.$comment&&F(Z),L(Z),q(Z);const Le=ye.const("_errs",u.default.errors);j(Z,Le),ye.var(te,(0,l._)`${Le} === ${u.default.errors}`)}function T(Z){(0,g.checkUnknownRules)(Z),M(Z)}function j(Z,te){if(Z.opts.jtd)return G(Z,[],!1,te);const pe=(0,t.getSchemaTypes)(Z.schema),ye=(0,t.coerceAndCheckDataType)(Z,pe);G(Z,pe,!ye,te)}function M(Z){const{schema:te,errSchemaPath:pe,opts:ye,self:ke}=Z;te.$ref&&ye.ignoreKeywordsWithRef&&(0,g.schemaHasRulesButRef)(te,ke.RULES)&&ke.logger.warn(`$ref: keywords ignored in schema at path "${pe}"`)}function D(Z){const{schema:te,opts:pe}=Z;te.default!==void 0&&pe.useDefaults&&pe.strictSchema&&(0,g.checkStrictMode)(Z,"default is ignored in the schema root")}function L(Z){const te=Z.schema[Z.opts.schemaId];te&&(Z.baseId=(0,m.resolveUrl)(Z.opts.uriResolver,Z.baseId,te))}function q(Z){if(Z.schema.$async&&!Z.schemaEnv.$async)throw new Error("async schema in sync schema")}function F({gen:Z,schemaEnv:te,schema:pe,errSchemaPath:ye,opts:ke}){const Le=pe.$comment;if(ke.$comment===!0)Z.code((0,l._)`${u.default.self}.logger.log(${Le})`);else if(typeof ke.$comment=="function"){const Ie=(0,l.str)`${ye}/$comment`,qe=Z.scopeValue("root",{ref:te.root});Z.code((0,l._)`${u.default.self}.opts.$comment(${Le}, ${Ie}, ${qe}.schema)`)}}function Y(Z){const{gen:te,schemaEnv:pe,validateName:ye,ValidationError:ke,opts:Le}=Z;pe.$async?te.if((0,l._)`${u.default.errors} === 0`,()=>te.return(u.default.data),()=>te.throw((0,l._)`new ${ke}(${u.default.vErrors})`)):(te.assign((0,l._)`${ye}.errors`,u.default.vErrors),Le.unevaluated&&Q(Z),te.return((0,l._)`${u.default.errors} === 0`))}function Q({gen:Z,evaluated:te,props:pe,items:ye}){pe instanceof l.Name&&Z.assign((0,l._)`${te}.props`,pe),ye instanceof l.Name&&Z.assign((0,l._)`${te}.items`,ye)}function G(Z,te,pe,ye){const{gen:ke,schema:Le,data:Ie,allErrors:qe,opts:Re,self:He}=Z,{RULES:Ke}=He;if(Le.$ref&&(Re.ignoreKeywordsWithRef||!(0,g.schemaHasRulesButRef)(Le,Ke))){ke.block(()=>X(Z,"$ref",Ke.all.$ref.definition));return}Re.jtd||ne(Z,te),ke.block(()=>{for(const ot of Ke.rules)kt(ot);kt(Ke.post)});function kt(ot){(0,n.shouldUseGroup)(Le,ot)&&(ot.type?(ke.if((0,r.checkDataType)(ot.type,Ie,Re.strictNumbers)),ee(Z,ot),te.length===1&&te[0]===ot.type&&pe&&(ke.else(),(0,r.reportTypeError)(Z)),ke.endIf()):ee(Z,ot),qe||ke.if((0,l._)`${u.default.errors} === ${ye||0}`))}}function ee(Z,te){const{gen:pe,schema:ye,opts:{useDefaults:ke}}=Z;ke&&(0,o.assignDefaults)(Z,te.type),pe.block(()=>{for(const Le of te.rules)(0,n.shouldUseRule)(ye,Le)&&X(Z,Le.keyword,Le.definition,te.type)})}function ne(Z,te){Z.schemaEnv.meta||!Z.opts.strictTypes||(z(Z,te),Z.opts.allowUnionTypes||B(Z,te),$(Z,Z.dataTypes))}function z(Z,te){if(te.length){if(!Z.dataTypes.length){Z.dataTypes=te;return}te.forEach(pe=>{U(Z.dataTypes,pe)||W(Z,`type "${pe}" not allowed by context "${Z.dataTypes.join(",")}"`)}),P(Z,te)}}function B(Z,te){te.length>1&&!(te.length===2&&te.includes("null"))&&W(Z,"use allowUnionTypes to allow union type keyword")}function $(Z,te){const pe=Z.self.RULES.all;for(const ye in pe){const ke=pe[ye];if(typeof ke=="object"&&(0,n.shouldUseRule)(Z.schema,ke)){const{type:Le}=ke.definition;Le.length&&!Le.some(Ie=>H(te,Ie))&&W(Z,`missing type "${Le.join(",")}" for keyword "${ye}"`)}}}function H(Z,te){return Z.includes(te)||te==="number"&&Z.includes("integer")}function U(Z,te){return Z.includes(te)||te==="integer"&&Z.includes("number")}function P(Z,te){const pe=[];for(const ye of Z.dataTypes)U(te,ye)?pe.push(ye):te.includes("integer")&&ye==="number"&&pe.push("integer");Z.dataTypes=pe}function W(Z,te){const pe=Z.schemaEnv.baseId+Z.errSchemaPath;te+=` at "${pe}" (strictTypes)`,(0,g.checkStrictMode)(Z,te,Z.opts.strictTypes)}class se{constructor(te,pe,ye){if((0,c.validateKeywordUsage)(te,pe,ye),this.gen=te.gen,this.allErrors=te.allErrors,this.keyword=ye,this.data=te.data,this.schema=te.schema[ye],this.$data=pe.$data&&te.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,g.schemaRefOrVal)(te,this.schema,ye,this.$data),this.schemaType=pe.schemaType,this.parentSchema=te.schema,this.params={},this.it=te,this.def=pe,this.$data)this.schemaCode=te.gen.const("vSchema",oe(this.$data,te));else if(this.schemaCode=this.schemaValue,!(0,c.validSchemaType)(this.schema,pe.schemaType,pe.allowUndefined))throw new Error(`${ye} value must be ${JSON.stringify(pe.schemaType)}`);("code"in pe?pe.trackErrors:pe.errors!==!1)&&(this.errsCount=te.gen.const("_errs",u.default.errors))}result(te,pe,ye){this.failResult((0,l.not)(te),pe,ye)}failResult(te,pe,ye){this.gen.if(te),ye?ye():this.error(),pe?(this.gen.else(),pe(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(te,pe){this.failResult((0,l.not)(te),void 0,pe)}fail(te){if(te===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(te),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(te){if(!this.$data)return this.fail(te);const{schemaCode:pe}=this;this.fail((0,l._)`${pe} !== undefined && (${(0,l.or)(this.invalid$data(),te)})`)}error(te,pe,ye){if(pe){this.setParams(pe),this._error(te,ye),this.setParams({});return}this._error(te,ye)}_error(te,pe){(te?p.reportExtraError:p.reportError)(this,this.def.error,pe)}$dataError(){(0,p.reportError)(this,this.def.$dataError||p.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,p.resetErrorsCount)(this.gen,this.errsCount)}ok(te){this.allErrors||this.gen.if(te)}setParams(te,pe){pe?Object.assign(this.params,te):this.params=te}block$data(te,pe,ye=l.nil){this.gen.block(()=>{this.check$data(te,ye),pe()})}check$data(te=l.nil,pe=l.nil){if(!this.$data)return;const{gen:ye,schemaCode:ke,schemaType:Le,def:Ie}=this;ye.if((0,l.or)((0,l._)`${ke} === undefined`,pe)),te!==l.nil&&ye.assign(te,!0),(Le.length||Ie.validateSchema)&&(ye.elseIf(this.invalid$data()),this.$dataError(),te!==l.nil&&ye.assign(te,!1)),ye.else()}invalid$data(){const{gen:te,schemaCode:pe,schemaType:ye,def:ke,it:Le}=this;return(0,l.or)(Ie(),qe());function Ie(){if(ye.length){if(!(pe instanceof l.Name))throw new Error("ajv implementation error");const Re=Array.isArray(ye)?ye:[ye];return(0,l._)`${(0,r.checkDataTypes)(Re,pe,Le.opts.strictNumbers,r.DataType.Wrong)}`}return l.nil}function qe(){if(ke.validateSchema){const Re=te.scopeValue("validate$data",{ref:ke.validateSchema});return(0,l._)`!${Re}(${pe})`}return l.nil}}subschema(te,pe){const ye=(0,h.getSubschema)(this.it,te);(0,h.extendSubschemaData)(ye,this.it,te),(0,h.extendSubschemaMode)(ye,te);const ke={...this.it,...ye,items:void 0,props:void 0};return _(ke,pe),ke}mergeEvaluated(te,pe){const{it:ye,gen:ke}=this;ye.opts.unevaluated&&(ye.props!==!0&&te.props!==void 0&&(ye.props=g.mergeEvaluated.props(ke,te.props,ye.props,pe)),ye.items!==!0&&te.items!==void 0&&(ye.items=g.mergeEvaluated.items(ke,te.items,ye.items,pe)))}mergeValidEvaluated(te,pe){const{it:ye,gen:ke}=this;if(ye.opts.unevaluated&&(ye.props!==!0||ye.items!==!0))return ke.if(pe,()=>this.mergeEvaluated(te,l.Name)),!0}}sr.KeywordCxt=se;function X(Z,te,pe,ye){const ke=new se(Z,pe,te);"code"in pe?pe.code(ke,ye):ke.$data&&pe.validate?(0,c.funcKeywordCode)(ke,pe):"macro"in pe?(0,c.macroKeywordCode)(ke,pe):(pe.compile||pe.validate)&&(0,c.funcKeywordCode)(ke,pe)}const V=/^\/(?:[^~]|~0|~1)*$/,ue=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function oe(Z,{dataLevel:te,dataNames:pe,dataPathArr:ye}){let ke,Le;if(Z==="")return u.default.rootData;if(Z[0]==="/"){if(!V.test(Z))throw new Error(`Invalid JSON-pointer: ${Z}`);ke=Z,Le=u.default.rootData}else{const He=ue.exec(Z);if(!He)throw new Error(`Invalid JSON-pointer: ${Z}`);const Ke=+He[1];if(ke=He[2],ke==="#"){if(Ke>=te)throw new Error(Re("property/index",Ke));return ye[te-Ke]}if(Ke>te)throw new Error(Re("data",Ke));if(Le=pe[te-Ke],!ke)return Le}let Ie=Le;const qe=ke.split("/");for(const He of qe)He&&(Le=(0,l._)`${Le}${(0,l.getProperty)((0,g.unescapeJsonPointer)(He))}`,Ie=(0,l._)`${Ie} && ${Le}`);return Ie;function Re(He,Ke){return`Cannot access ${He} ${Ke} levels up, current level is ${te}`}}return sr.getData=oe,sr}var cd={},iw;function r_(){if(iw)return cd;iw=1,Object.defineProperty(cd,"__esModule",{value:!0});class e extends Error{constructor(n){super("validation failed"),this.errors=n,this.ajv=this.validation=!0}}return cd.default=e,cd}var ud={},rw;function mf(){if(rw)return ud;rw=1,Object.defineProperty(ud,"__esModule",{value:!0});const e=ff();class t extends Error{constructor(r,o,c,h){super(h||`can't resolve reference ${c} from id ${o}`),this.missingRef=(0,e.resolveUrl)(r,o,c),this.missingSchema=(0,e.normalizeId)((0,e.getFullPath)(r,this.missingRef))}}return ud.default=t,ud}var Vn={},aw;function gf(){if(aw)return Vn;aw=1,Object.defineProperty(Vn,"__esModule",{value:!0}),Vn.resolveSchema=Vn.getCompilingSchema=Vn.resolveRef=Vn.compileSchema=Vn.SchemaEnv=void 0;const e=St(),t=r_(),n=Ei(),r=ff(),o=Nt(),c=pf();class h{constructor(b){var v;this.refs={},this.dynamicAnchors={};let _;typeof b.schema=="object"&&(_=b.schema),this.schema=b.schema,this.schemaId=b.schemaId,this.root=b.root||this,this.baseId=(v=b.baseId)!==null&&v!==void 0?v:(0,r.normalizeId)(_==null?void 0:_[b.schemaId||"$id"]),this.schemaPath=b.schemaPath,this.localRefs=b.localRefs,this.meta=b.meta,this.$async=_==null?void 0:_.$async,this.refs={}}}Vn.SchemaEnv=h;function l(y){const b=g.call(this,y);if(b)return b;const v=(0,r.getFullPath)(this.opts.uriResolver,y.root.baseId),{es5:_,lines:k}=this.opts.code,{ownProperties:C}=this.opts,w=new e.CodeGen(this.scope,{es5:_,lines:k,ownProperties:C});let T;y.$async&&(T=w.scopeValue("Error",{ref:t.default,code:(0,e._)`require("ajv/dist/runtime/validation_error").default`}));const j=w.scopeName("validate");y.validateName=j;const M={gen:w,allErrors:this.opts.allErrors,data:n.default.data,parentData:n.default.parentData,parentDataProperty:n.default.parentDataProperty,dataNames:[n.default.data],dataPathArr:[e.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:w.scopeValue("schema",this.opts.code.source===!0?{ref:y.schema,code:(0,e.stringify)(y.schema)}:{ref:y.schema}),validateName:j,ValidationError:T,schema:y.schema,schemaEnv:y,rootId:v,baseId:y.baseId||v,schemaPath:e.nil,errSchemaPath:y.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,e._)`""`,opts:this.opts,self:this};let D;try{this._compilations.add(y),(0,c.validateFunctionCode)(M),w.optimize(this.opts.code.optimize);const L=w.toString();D=`${w.scopeRefs(n.default.scope)}return ${L}`,this.opts.code.process&&(D=this.opts.code.process(D,y));const F=new Function(`${n.default.self}`,`${n.default.scope}`,D)(this,this.scope.get());if(this.scope.value(j,{ref:F}),F.errors=null,F.schema=y.schema,F.schemaEnv=y,y.$async&&(F.$async=!0),this.opts.code.source===!0&&(F.source={validateName:j,validateCode:L,scopeValues:w._values}),this.opts.unevaluated){const{props:Y,items:Q}=M;F.evaluated={props:Y instanceof e.Name?void 0:Y,items:Q instanceof e.Name?void 0:Q,dynamicProps:Y instanceof e.Name,dynamicItems:Q instanceof e.Name},F.source&&(F.source.evaluated=(0,e.stringify)(F.evaluated))}return y.validate=F,y}catch(L){throw delete y.validate,delete y.validateName,D&&this.logger.error("Error compiling schema, function code:",D),L}finally{this._compilations.delete(y)}}Vn.compileSchema=l;function u(y,b,v){var _;v=(0,r.resolveUrl)(this.opts.uriResolver,b,v);const k=y.refs[v];if(k)return k;let C=S.call(this,y,v);if(C===void 0){const w=(_=y.localRefs)===null||_===void 0?void 0:_[v],{schemaId:T}=this.opts;w&&(C=new h({schema:w,schemaId:T,root:y,baseId:b}))}if(C!==void 0)return y.refs[v]=m.call(this,C)}Vn.resolveRef=u;function m(y){return(0,r.inlineRef)(y.schema,this.opts.inlineRefs)?y.schema:y.validate?y:l.call(this,y)}function g(y){for(const b of this._compilations)if(p(b,y))return b}Vn.getCompilingSchema=g;function p(y,b){return y.schema===b.schema&&y.root===b.root&&y.baseId===b.baseId}function S(y,b){let v;for(;typeof(v=this.refs[b])=="string";)b=v;return v||this.schemas[b]||x.call(this,y,b)}function x(y,b){const v=this.opts.uriResolver.parse(b),_=(0,r._getFullPath)(this.opts.uriResolver,v);let k=(0,r.getFullPath)(this.opts.uriResolver,y.baseId,void 0);if(Object.keys(y.schema).length>0&&_===k)return E.call(this,v,y);const C=(0,r.normalizeId)(_),w=this.refs[C]||this.schemas[C];if(typeof w=="string"){const T=x.call(this,y,w);return typeof(T==null?void 0:T.schema)!="object"?void 0:E.call(this,v,T)}if(typeof(w==null?void 0:w.schema)=="object"){if(w.validate||l.call(this,w),C===(0,r.normalizeId)(b)){const{schema:T}=w,{schemaId:j}=this.opts,M=T[j];return M&&(k=(0,r.resolveUrl)(this.opts.uriResolver,k,M)),new h({schema:T,schemaId:j,root:y,baseId:k})}return E.call(this,v,w)}}Vn.resolveSchema=x;const A=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function E(y,{baseId:b,schema:v,root:_}){var k;if(((k=y.fragment)===null||k===void 0?void 0:k[0])!=="/")return;for(const T of y.fragment.slice(1).split("/")){if(typeof v=="boolean")return;const j=v[(0,o.unescapeFragment)(T)];if(j===void 0)return;v=j;const M=typeof v=="object"&&v[this.opts.schemaId];!A.has(T)&&M&&(b=(0,r.resolveUrl)(this.opts.uriResolver,b,M))}let C;if(typeof v!="boolean"&&v.$ref&&!(0,o.schemaHasRulesButRef)(v,this.RULES)){const T=(0,r.resolveUrl)(this.opts.uriResolver,b,v.$ref);C=x.call(this,_,T)}const{schemaId:w}=this.opts;if(C=C||new h({schema:v,schemaId:w,root:_,baseId:b}),C.schema!==C.root.schema)return C}return Vn}const FD="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",qD="Meta-schema for $data reference (JSON AnySchema extension proposal)",VD="object",GD=["$data"],WD={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},KD=!1,YD={$id:FD,description:qD,type:VD,required:GD,properties:WD,additionalProperties:KD};var dd={},hc={exports:{}},hg,ow;function S2(){if(ow)return hg;ow=1;const e=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),t=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),n=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),r=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),o=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function c(C){let w="",T=0,j=0;for(j=0;j<C.length;j++)if(T=C[j].charCodeAt(0),T!==48){if(!(T>=48&&T<=57||T>=65&&T<=70||T>=97&&T<=102))return"";w+=C[j];break}for(j+=1;j<C.length;j++){if(T=C[j].charCodeAt(0),!(T>=48&&T<=57||T>=65&&T<=70||T>=97&&T<=102))return"";w+=C[j]}return w}const h=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function l(C){return C.length=0,!0}function u(C,w,T){if(C.length){const j=c(C);if(j!=="")w.push(j);else return T.error=!0,!1;C.length=0}return!0}function m(C){let w=0;const T={error:!1,address:"",zone:""},j=[],M=[];let D=!1,L=!1,q=u;for(let F=0;F<C.length;F++){const Y=C[F];if(!(Y==="["||Y==="]"))if(Y===":"){if(D===!0&&(L=!0),!q(M,j,T))break;if(++w>7){T.error=!0;break}F>0&&C[F-1]===":"&&(D=!0),j.push(":");continue}else if(Y==="%"){if(!q(M,j,T))break;q=l}else{M.push(Y);continue}}return M.length&&(q===l?T.zone=M.join(""):L?j.push(M.join("")):j.push(c(M))),T.address=j.join(""),T}function g(C){if(p(C,":")<2)return{host:C,isIPV6:!1};const w=m(C);if(w.error)return{host:C,isIPV6:!1};{let T=w.address,j=w.address;return w.zone&&(T+="%"+w.zone,j+="%25"+w.zone),{host:T,isIPV6:!0,escapedHost:j}}}function p(C,w){let T=0;for(let j=0;j<C.length;j++)C[j]===w&&T++;return T}function S(C){let w=C;const T=[];let j=-1,M=0;for(;M=w.length;){if(M===1){if(w===".")break;if(w==="/"){T.push("/");break}else{T.push(w);break}}else if(M===2){if(w[0]==="."){if(w[1]===".")break;if(w[1]==="/"){w=w.slice(2);continue}}else if(w[0]==="/"&&(w[1]==="."||w[1]==="/")){T.push("/");break}}else if(M===3&&w==="/.."){T.length!==0&&T.pop(),T.push("/");break}if(w[0]==="."){if(w[1]==="."){if(w[2]==="/"){w=w.slice(3);continue}}else if(w[1]==="/"){w=w.slice(2);continue}}else if(w[0]==="/"&&w[1]==="."){if(w[2]==="/"){w=w.slice(2);continue}else if(w[2]==="."&&w[3]==="/"){w=w.slice(3),T.length!==0&&T.pop();continue}}if((j=w.indexOf("/",1))===-1){T.push(w);break}else T.push(w.slice(0,j)),w=w.slice(j)}return T.join("")}const x={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},A=/[@/?#:]/g,E=/[@/?#]/g;function y(C,w){const T=w?E:A;return T.lastIndex=0,C.replace(T,j=>x[j])}function b(C,w=!1){if(C.indexOf("%")===-1)return C;let T="";for(let j=0;j<C.length;j++){if(C[j]==="%"&&j+2<C.length){const M=C.slice(j+1,j+3);if(n(M)){const D=M.toUpperCase(),L=String.fromCharCode(parseInt(D,16));w&&r(L)?T+=L:T+="%"+D,j+=2;continue}}T+=C[j]}return T}function v(C){let w="";for(let T=0;T<C.length;T++){if(C[T]==="%"&&T+2<C.length){const j=C.slice(T+1,T+3);if(n(j)){const M=j.toUpperCase(),D=String.fromCharCode(parseInt(M,16));D!=="."&&r(D)?w+=D:w+="%"+M,T+=2;continue}}o(C[T])?w+=C[T]:w+=escape(C[T])}return w}function _(C){let w="";for(let T=0;T<C.length;T++){if(C[T]==="%"&&T+2<C.length){const j=C.slice(T+1,T+3);if(n(j)){w+="%"+j.toUpperCase(),T+=2;continue}}w+=escape(C[T])}return w}function k(C){const w=[];if(C.userinfo!==void 0&&(w.push(C.userinfo),w.push("@")),C.host!==void 0){let T=unescape(C.host);if(!t(T)){const j=g(T);j.isIPV6===!0?T=`[${j.escapedHost}]`:T=y(T,!1)}w.push(T)}return(typeof C.port=="number"||typeof C.port=="string")&&(w.push(":"),w.push(String(C.port))),w.length?w.join(""):void 0}return hg={nonSimpleDomain:h,recomposeAuthority:k,reescapeHostDelimiters:y,normalizePercentEncoding:b,normalizePathEncoding:v,escapePreservingEscapes:_,removeDotSegments:S,isIPv4:t,isUUID:e,normalizeIPv6:g,stringArrayToHexStripped:c},hg}var fg,lw;function XD(){if(lw)return fg;lw=1;const{isUUID:e}=S2(),t=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,n=["http","https","ws","wss","urn","urn:uuid"];function r(C){return n.indexOf(C)!==-1}function o(C){return C.secure===!0?!0:C.secure===!1?!1:C.scheme?C.scheme.length===3&&(C.scheme[0]==="w"||C.scheme[0]==="W")&&(C.scheme[1]==="s"||C.scheme[1]==="S")&&(C.scheme[2]==="s"||C.scheme[2]==="S"):!1}function c(C){return C.host||(C.error=C.error||"HTTP URIs must have a host."),C}function h(C){const w=String(C.scheme).toLowerCase()==="https";return(C.port===(w?443:80)||C.port==="")&&(C.port=void 0),C.path||(C.path="/"),C}function l(C){return C.secure=o(C),C.resourceName=(C.path||"/")+(C.query?"?"+C.query:""),C.path=void 0,C.query=void 0,C}function u(C){if((C.port===(o(C)?443:80)||C.port==="")&&(C.port=void 0),typeof C.secure=="boolean"&&(C.scheme=C.secure?"wss":"ws",C.secure=void 0),C.resourceName){const[w,T]=C.resourceName.split("?");C.path=w&&w!=="/"?w:void 0,C.query=T,C.resourceName=void 0}return C.fragment=void 0,C}function m(C,w){if(!C.path)return C.error="URN can not be parsed",C;const T=C.path.match(t);if(T){const j=w.scheme||C.scheme||"urn";C.nid=T[1].toLowerCase(),C.nss=T[2];const M=`${j}:${w.nid||C.nid}`,D=k(M);C.path=void 0,D&&(C=D.parse(C,w))}else C.error=C.error||"URN can not be parsed.";return C}function g(C,w){if(C.nid===void 0)throw new Error("URN without nid cannot be serialized");const T=w.scheme||C.scheme||"urn",j=C.nid.toLowerCase(),M=`${T}:${w.nid||j}`,D=k(M);D&&(C=D.serialize(C,w));const L=C,q=C.nss;return L.path=`${j||w.nid}:${q}`,w.skipEscape=!0,L}function p(C,w){const T=C;return T.uuid=T.nss,T.nss=void 0,!w.tolerant&&(!T.uuid||!e(T.uuid))&&(T.error=T.error||"UUID is not valid."),T}function S(C){const w=C;return w.nss=(C.uuid||"").toLowerCase(),w}const x={scheme:"http",domainHost:!0,parse:c,serialize:h},A={scheme:"https",domainHost:x.domainHost,parse:c,serialize:h},E={scheme:"ws",domainHost:!0,parse:l,serialize:u},y={scheme:"wss",domainHost:E.domainHost,parse:E.parse,serialize:E.serialize},_={http:x,https:A,ws:E,wss:y,urn:{scheme:"urn",parse:m,serialize:g,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:p,serialize:S,skipNormalize:!0}};Object.setPrototypeOf(_,null);function k(C){return C&&(_[C]||_[C.toLowerCase()])||void 0}return fg={wsIsSecure:o,SCHEMES:_,isValidSchemeName:r,getSchemeHandler:k},fg}var cw;function JD(){if(cw)return hc.exports;cw=1;const{normalizeIPv6:e,removeDotSegments:t,recomposeAuthority:n,normalizePercentEncoding:r,normalizePathEncoding:o,escapePreservingEscapes:c,reescapeHostDelimiters:h,isIPv4:l,nonSimpleDomain:u}=S2(),{SCHEMES:m,getSchemeHandler:g}=XD();function p(j,M){return typeof j=="string"?j=k(j,M):typeof j=="object"&&(j=_(E(j,M),M)),j}function S(j,M,D){const L=D?Object.assign({scheme:"null"},D):{scheme:"null"},q=x(_(j,L),_(M,L),L,!0);return L.skipEscape=!0,E(q,L)}function x(j,M,D,L){const q={};return L||(j=_(E(j,D),D),M=_(E(M,D),D)),D=D||{},!D.tolerant&&M.scheme?(q.scheme=M.scheme,q.userinfo=M.userinfo,q.host=M.host,q.port=M.port,q.path=t(M.path||""),q.query=M.query):(M.userinfo!==void 0||M.host!==void 0||M.port!==void 0?(q.userinfo=M.userinfo,q.host=M.host,q.port=M.port,q.path=t(M.path||""),q.query=M.query):(M.path?(M.path[0]==="/"?q.path=t(M.path):((j.userinfo!==void 0||j.host!==void 0||j.port!==void 0)&&!j.path?q.path="/"+M.path:j.path?q.path=j.path.slice(0,j.path.lastIndexOf("/")+1)+M.path:q.path=M.path,q.path=t(q.path)),q.query=M.query):(q.path=j.path,M.query!==void 0?q.query=M.query:q.query=j.query),q.userinfo=j.userinfo,q.host=j.host,q.port=j.port),q.scheme=j.scheme),q.fragment=M.fragment,q}function A(j,M,D){const L=w(j,D),q=w(M,D);return L!==void 0&&q!==void 0&&L.toLowerCase()===q.toLowerCase()}function E(j,M){const D={host:j.host,scheme:j.scheme,userinfo:j.userinfo,port:j.port,path:j.path,query:j.query,nid:j.nid,nss:j.nss,uuid:j.uuid,fragment:j.fragment,reference:j.reference,resourceName:j.resourceName,secure:j.secure,error:""},L=Object.assign({},M),q=[],F=g(L.scheme||D.scheme);F&&F.serialize&&F.serialize(D,L),D.path!==void 0&&(L.skipEscape?D.path=r(D.path):(D.path=c(D.path),D.scheme!==void 0&&(D.path=D.path.split("%3A").join(":")))),L.reference!=="suffix"&&D.scheme&&q.push(D.scheme,":");const Y=n(D);if(Y!==void 0&&(L.reference!=="suffix"&&q.push("//"),q.push(Y),D.path&&D.path[0]!=="/"&&q.push("/")),D.path!==void 0){let Q=D.path;!L.absolutePath&&(!F||!F.absolutePath)&&(Q=t(Q)),Y===void 0&&Q[0]==="/"&&Q[1]==="/"&&(Q="/%2F"+Q.slice(2)),q.push(Q)}return D.query!==void 0&&q.push("?",D.query),D.fragment!==void 0&&q.push("#",D.fragment),q.join("")}const y=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function b(j,M){if(M[2]!==void 0&&j.path&&j.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof j.port=="number"&&(j.port<0||j.port>65535))return"URI port is malformed."}function v(j,M){const D=Object.assign({},M),L={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0};let q=!1,F=!1;D.reference==="suffix"&&(D.scheme?j=D.scheme+":"+j:j="//"+j);const Y=j.match(y);if(Y){L.scheme=Y[1],L.userinfo=Y[3],L.host=Y[4],L.port=parseInt(Y[5],10),L.path=Y[6]||"",L.query=Y[7],L.fragment=Y[8],isNaN(L.port)&&(L.port=Y[5]);const Q=b(L,Y);if(Q!==void 0&&(L.error=L.error||Q,q=!0),L.host)if(l(L.host)===!1){const ne=e(L.host);L.host=ne.host.toLowerCase(),F=ne.isIPV6}else F=!0;L.scheme===void 0&&L.userinfo===void 0&&L.host===void 0&&L.port===void 0&&L.query===void 0&&!L.path?L.reference="same-document":L.scheme===void 0?L.reference="relative":L.fragment===void 0?L.reference="absolute":L.reference="uri",D.reference&&D.reference!=="suffix"&&D.reference!==L.reference&&(L.error=L.error||"URI is not a "+D.reference+" reference.");const G=g(D.scheme||L.scheme);if(!D.unicodeSupport&&(!G||!G.unicodeSupport)&&L.host&&(D.domainHost||G&&G.domainHost)&&F===!1&&u(L.host))try{L.host=URL.domainToASCII(L.host.toLowerCase())}catch(ee){L.error=L.error||"Host's domain name can not be converted to ASCII: "+ee}if((!G||G&&!G.skipNormalize)&&(j.indexOf("%")!==-1&&(L.scheme!==void 0&&(L.scheme=unescape(L.scheme)),L.host!==void 0&&(L.host=h(unescape(L.host),F))),L.path&&(L.path=o(L.path)),L.fragment))try{L.fragment=encodeURI(decodeURIComponent(L.fragment))}catch{L.error=L.error||"URI malformed"}G&&G.parse&&G.parse(L,D)}else L.error=L.error||"URI can not be parsed.";return{parsed:L,malformedAuthorityOrPort:q}}function _(j,M){return v(j,M).parsed}function k(j,M){return C(j,M).normalized}function C(j,M){const{parsed:D,malformedAuthorityOrPort:L}=v(j,M);return{normalized:L?j:E(D,M),malformedAuthorityOrPort:L}}function w(j,M){if(typeof j=="string"){const{normalized:D,malformedAuthorityOrPort:L}=C(j,M);return L?void 0:D}if(typeof j=="object")return E(j,M)}const T={SCHEMES:m,normalize:p,resolve:S,resolveComponent:x,equal:A,serialize:E,parse:_};return hc.exports=T,hc.exports.default=T,hc.exports.fastUri=T,hc.exports}var uw;function ZD(){if(uw)return dd;uw=1,Object.defineProperty(dd,"__esModule",{value:!0});const e=JD();return e.code='require("ajv/dist/runtime/uri").default',dd.default=e,dd}var dw;function QD(){return dw||(dw=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=pf();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var n=St();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return n.CodeGen}});const r=r_(),o=mf(),c=_2(),h=gf(),l=St(),u=ff(),m=Zh(),g=Nt(),p=YD,S=ZD(),x=(B,$)=>new RegExp(B,$);x.code="new RegExp";const A=["removeAdditional","useDefaults","coerceTypes"],E=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),y={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},b={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},v=200;function _(B){var $,H,U,P,W,se,X,V,ue,oe,Z,te,pe,ye,ke,Le,Ie,qe,Re,He,Ke,kt,ot,Ct,wt;const Mt=B.strict,jt=($=B.code)===null||$===void 0?void 0:$.optimize,Lt=jt===!0||jt===void 0?1:jt||0,ss=(U=(H=B.code)===null||H===void 0?void 0:H.regExp)!==null&&U!==void 0?U:x,as=(P=B.uriResolver)!==null&&P!==void 0?P:S.default;return{strictSchema:(se=(W=B.strictSchema)!==null&&W!==void 0?W:Mt)!==null&&se!==void 0?se:!0,strictNumbers:(V=(X=B.strictNumbers)!==null&&X!==void 0?X:Mt)!==null&&V!==void 0?V:!0,strictTypes:(oe=(ue=B.strictTypes)!==null&&ue!==void 0?ue:Mt)!==null&&oe!==void 0?oe:"log",strictTuples:(te=(Z=B.strictTuples)!==null&&Z!==void 0?Z:Mt)!==null&&te!==void 0?te:"log",strictRequired:(ye=(pe=B.strictRequired)!==null&&pe!==void 0?pe:Mt)!==null&&ye!==void 0?ye:!1,code:B.code?{...B.code,optimize:Lt,regExp:ss}:{optimize:Lt,regExp:ss},loopRequired:(ke=B.loopRequired)!==null&&ke!==void 0?ke:v,loopEnum:(Le=B.loopEnum)!==null&&Le!==void 0?Le:v,meta:(Ie=B.meta)!==null&&Ie!==void 0?Ie:!0,messages:(qe=B.messages)!==null&&qe!==void 0?qe:!0,inlineRefs:(Re=B.inlineRefs)!==null&&Re!==void 0?Re:!0,schemaId:(He=B.schemaId)!==null&&He!==void 0?He:"$id",addUsedSchema:(Ke=B.addUsedSchema)!==null&&Ke!==void 0?Ke:!0,validateSchema:(kt=B.validateSchema)!==null&&kt!==void 0?kt:!0,validateFormats:(ot=B.validateFormats)!==null&&ot!==void 0?ot:!0,unicodeRegExp:(Ct=B.unicodeRegExp)!==null&&Ct!==void 0?Ct:!0,int32range:(wt=B.int32range)!==null&&wt!==void 0?wt:!0,uriResolver:as}}class k{constructor($={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,$=this.opts={...$,..._($)};const{es5:H,lines:U}=this.opts.code;this.scope=new l.ValueScope({scope:{},prefixes:E,es5:H,lines:U}),this.logger=q($.logger);const P=$.validateFormats;$.validateFormats=!1,this.RULES=(0,c.getRules)(),C.call(this,y,$,"NOT SUPPORTED"),C.call(this,b,$,"DEPRECATED","warn"),this._metaOpts=D.call(this),$.formats&&j.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),$.keywords&&M.call(this,$.keywords),typeof $.meta=="object"&&this.addMetaSchema($.meta),T.call(this),$.validateFormats=P}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:$,meta:H,schemaId:U}=this.opts;let P=p;U==="id"&&(P={...p},P.id=P.$id,delete P.$id),H&&$&&this.addMetaSchema(P,P[U],!1)}defaultMeta(){const{meta:$,schemaId:H}=this.opts;return this.opts.defaultMeta=typeof $=="object"?$[H]||$:void 0}validate($,H){let U;if(typeof $=="string"){if(U=this.getSchema($),!U)throw new Error(`no schema with key or ref "${$}"`)}else U=this.compile($);const P=U(H);return"$async"in U||(this.errors=U.errors),P}compile($,H){const U=this._addSchema($,H);return U.validate||this._compileSchemaEnv(U)}compileAsync($,H){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:U}=this.opts;return P.call(this,$,H);async function P(oe,Z){await W.call(this,oe.$schema);const te=this._addSchema(oe,Z);return te.validate||se.call(this,te)}async function W(oe){oe&&!this.getSchema(oe)&&await P.call(this,{$ref:oe},!0)}async function se(oe){try{return this._compileSchemaEnv(oe)}catch(Z){if(!(Z instanceof o.default))throw Z;return X.call(this,Z),await V.call(this,Z.missingSchema),se.call(this,oe)}}function X({missingSchema:oe,missingRef:Z}){if(this.refs[oe])throw new Error(`AnySchema ${oe} is loaded but ${Z} cannot be resolved`)}async function V(oe){const Z=await ue.call(this,oe);this.refs[oe]||await W.call(this,Z.$schema),this.refs[oe]||this.addSchema(Z,oe,H)}async function ue(oe){const Z=this._loading[oe];if(Z)return Z;try{return await(this._loading[oe]=U(oe))}finally{delete this._loading[oe]}}}addSchema($,H,U,P=this.opts.validateSchema){if(Array.isArray($)){for(const se of $)this.addSchema(se,void 0,U,P);return this}let W;if(typeof $=="object"){const{schemaId:se}=this.opts;if(W=$[se],W!==void 0&&typeof W!="string")throw new Error(`schema ${se} must be string`)}return H=(0,u.normalizeId)(H||W),this._checkUnique(H),this.schemas[H]=this._addSchema($,U,H,P,!0),this}addMetaSchema($,H,U=this.opts.validateSchema){return this.addSchema($,H,!0,U),this}validateSchema($,H){if(typeof $=="boolean")return!0;let U;if(U=$.$schema,U!==void 0&&typeof U!="string")throw new Error("$schema must be a string");if(U=U||this.opts.defaultMeta||this.defaultMeta(),!U)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const P=this.validate(U,$);if(!P&&H){const W="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(W);else throw new Error(W)}return P}getSchema($){let H;for(;typeof(H=w.call(this,$))=="string";)$=H;if(H===void 0){const{schemaId:U}=this.opts,P=new h.SchemaEnv({schema:{},schemaId:U});if(H=h.resolveSchema.call(this,P,$),!H)return;this.refs[$]=H}return H.validate||this._compileSchemaEnv(H)}removeSchema($){if($ instanceof RegExp)return this._removeAllSchemas(this.schemas,$),this._removeAllSchemas(this.refs,$),this;switch(typeof $){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const H=w.call(this,$);return typeof H=="object"&&this._cache.delete(H.schema),delete this.schemas[$],delete this.refs[$],this}case"object":{const H=$;this._cache.delete(H);let U=$[this.opts.schemaId];return U&&(U=(0,u.normalizeId)(U),delete this.schemas[U],delete this.refs[U]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary($){for(const H of $)this.addKeyword(H);return this}addKeyword($,H){let U;if(typeof $=="string")U=$,typeof H=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),H.keyword=U);else if(typeof $=="object"&&H===void 0){if(H=$,U=H.keyword,Array.isArray(U)&&!U.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(Y.call(this,U,H),!H)return(0,g.eachItem)(U,W=>Q.call(this,W)),this;ee.call(this,H);const P={...H,type:(0,m.getJSONTypes)(H.type),schemaType:(0,m.getJSONTypes)(H.schemaType)};return(0,g.eachItem)(U,P.type.length===0?W=>Q.call(this,W,P):W=>P.type.forEach(se=>Q.call(this,W,P,se))),this}getKeyword($){const H=this.RULES.all[$];return typeof H=="object"?H.definition:!!H}removeKeyword($){const{RULES:H}=this;delete H.keywords[$],delete H.all[$];for(const U of H.rules){const P=U.rules.findIndex(W=>W.keyword===$);P>=0&&U.rules.splice(P,1)}return this}addFormat($,H){return typeof H=="string"&&(H=new RegExp(H)),this.formats[$]=H,this}errorsText($=this.errors,{separator:H=", ",dataVar:U="data"}={}){return!$||$.length===0?"No errors":$.map(P=>`${U}${P.instancePath} ${P.message}`).reduce((P,W)=>P+H+W)}$dataMetaSchema($,H){const U=this.RULES.all;$=JSON.parse(JSON.stringify($));for(const P of H){const W=P.split("/").slice(1);let se=$;for(const X of W)se=se[X];for(const X in U){const V=U[X];if(typeof V!="object")continue;const{$data:ue}=V.definition,oe=se[X];ue&&oe&&(se[X]=z(oe))}}return $}_removeAllSchemas($,H){for(const U in $){const P=$[U];(!H||H.test(U))&&(typeof P=="string"?delete $[U]:P&&!P.meta&&(this._cache.delete(P.schema),delete $[U]))}}_addSchema($,H,U,P=this.opts.validateSchema,W=this.opts.addUsedSchema){let se;const{schemaId:X}=this.opts;if(typeof $=="object")se=$[X];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof $!="boolean")throw new Error("schema must be object or boolean")}let V=this._cache.get($);if(V!==void 0)return V;U=(0,u.normalizeId)(se||U);const ue=u.getSchemaRefs.call(this,$,U);return V=new h.SchemaEnv({schema:$,schemaId:X,meta:H,baseId:U,localRefs:ue}),this._cache.set(V.schema,V),W&&!U.startsWith("#")&&(U&&this._checkUnique(U),this.refs[U]=V),P&&this.validateSchema($,!0),V}_checkUnique($){if(this.schemas[$]||this.refs[$])throw new Error(`schema with key or id "${$}" already exists`)}_compileSchemaEnv($){if($.meta?this._compileMetaSchema($):h.compileSchema.call(this,$),!$.validate)throw new Error("ajv implementation error");return $.validate}_compileMetaSchema($){const H=this.opts;this.opts=this._metaOpts;try{h.compileSchema.call(this,$)}finally{this.opts=H}}}k.ValidationError=r.default,k.MissingRefError=o.default,e.default=k;function C(B,$,H,U="error"){for(const P in B){const W=P;W in $&&this.logger[U](`${H}: option ${P}. ${B[W]}`)}}function w(B){return B=(0,u.normalizeId)(B),this.schemas[B]||this.refs[B]}function T(){const B=this.opts.schemas;if(B)if(Array.isArray(B))this.addSchema(B);else for(const $ in B)this.addSchema(B[$],$)}function j(){for(const B in this.opts.formats){const $=this.opts.formats[B];$&&this.addFormat(B,$)}}function M(B){if(Array.isArray(B)){this.addVocabulary(B);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const $ in B){const H=B[$];H.keyword||(H.keyword=$),this.addKeyword(H)}}function D(){const B={...this.opts};for(const $ of A)delete B[$];return B}const L={log(){},warn(){},error(){}};function q(B){if(B===!1)return L;if(B===void 0)return console;if(B.log&&B.warn&&B.error)return B;throw new Error("logger must implement log, warn and error methods")}const F=/^[a-z_$][a-z0-9_$:-]*$/i;function Y(B,$){const{RULES:H}=this;if((0,g.eachItem)(B,U=>{if(H.keywords[U])throw new Error(`Keyword ${U} is already defined`);if(!F.test(U))throw new Error(`Keyword ${U} has invalid name`)}),!!$&&$.$data&&!("code"in $||"validate"in $))throw new Error('$data keyword must have "code" or "validate" function')}function Q(B,$,H){var U;const P=$==null?void 0:$.post;if(H&&P)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:W}=this;let se=P?W.post:W.rules.find(({type:V})=>V===H);if(se||(se={type:H,rules:[]},W.rules.push(se)),W.keywords[B]=!0,!$)return;const X={keyword:B,definition:{...$,type:(0,m.getJSONTypes)($.type),schemaType:(0,m.getJSONTypes)($.schemaType)}};$.before?G.call(this,se,X,$.before):se.rules.push(X),W.all[B]=X,(U=$.implements)===null||U===void 0||U.forEach(V=>this.addKeyword(V))}function G(B,$,H){const U=B.rules.findIndex(P=>P.keyword===H);U>=0?B.rules.splice(U,0,$):(B.rules.push($),this.logger.warn(`rule ${H} is not defined`))}function ee(B){let{metaSchema:$}=B;$!==void 0&&(B.$data&&this.opts.$data&&($=z($)),B.validateSchema=this.compile($,!0))}const ne={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function z(B){return{anyOf:[B,ne]}}})(rg)),rg}var hd={},fd={},pd={},hw;function eO(){if(hw)return pd;hw=1,Object.defineProperty(pd,"__esModule",{value:!0});const e={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};return pd.default=e,pd}var Fr={},fw;function a_(){if(fw)return Fr;fw=1,Object.defineProperty(Fr,"__esModule",{value:!0}),Fr.callRef=Fr.getValidate=void 0;const e=mf(),t=ki(),n=St(),r=Ei(),o=gf(),c=Nt(),h={keyword:"$ref",schemaType:"string",code(m){const{gen:g,schema:p,it:S}=m,{baseId:x,schemaEnv:A,validateName:E,opts:y,self:b}=S,{root:v}=A;if((p==="#"||p==="#/")&&x===v.baseId)return k();const _=o.resolveRef.call(b,v,x,p);if(_===void 0)throw new e.default(S.opts.uriResolver,x,p);if(_ instanceof o.SchemaEnv)return C(_);return w(_);function k(){if(A===v)return u(m,E,A,A.$async);const T=g.scopeValue("root",{ref:v});return u(m,(0,n._)`${T}.validate`,v,v.$async)}function C(T){const j=l(m,T);u(m,j,T,T.$async)}function w(T){const j=g.scopeValue("schema",y.code.source===!0?{ref:T,code:(0,n.stringify)(T)}:{ref:T}),M=g.name("valid"),D=m.subschema({schema:T,dataTypes:[],schemaPath:n.nil,topSchemaRef:j,errSchemaPath:p},M);m.mergeEvaluated(D),m.ok(M)}}};function l(m,g){const{gen:p}=m;return g.validate?p.scopeValue("validate",{ref:g.validate}):(0,n._)`${p.scopeValue("wrapper",{ref:g})}.validate`}Fr.getValidate=l;function u(m,g,p,S){const{gen:x,it:A}=m,{allErrors:E,schemaEnv:y,opts:b}=A,v=b.passContext?r.default.this:n.nil;S?_():k();function _(){if(!y.$async)throw new Error("async schema referenced by sync schema");const T=x.let("valid");x.try(()=>{x.code((0,n._)`await ${(0,t.callValidateCode)(m,g,v)}`),w(g),E||x.assign(T,!0)},j=>{x.if((0,n._)`!(${j} instanceof ${A.ValidationError})`,()=>x.throw(j)),C(j),E||x.assign(T,!1)}),m.ok(T)}function k(){m.result((0,t.callValidateCode)(m,g,v),()=>w(g),()=>C(g))}function C(T){const j=(0,n._)`${T}.errors`;x.assign(r.default.vErrors,(0,n._)`${r.default.vErrors} === null ? ${j} : ${r.default.vErrors}.concat(${j})`),x.assign(r.default.errors,(0,n._)`${r.default.vErrors}.length`)}function w(T){var j;if(!A.opts.unevaluated)return;const M=(j=p==null?void 0:p.validate)===null||j===void 0?void 0:j.evaluated;if(A.props!==!0)if(M&&!M.dynamicProps)M.props!==void 0&&(A.props=c.mergeEvaluated.props(x,M.props,A.props));else{const D=x.var("props",(0,n._)`${T}.evaluated.props`);A.props=c.mergeEvaluated.props(x,D,A.props,n.Name)}if(A.items!==!0)if(M&&!M.dynamicItems)M.items!==void 0&&(A.items=c.mergeEvaluated.items(x,M.items,A.items));else{const D=x.var("items",(0,n._)`${T}.evaluated.items`);A.items=c.mergeEvaluated.items(x,D,A.items,n.Name)}}}return Fr.callRef=u,Fr.default=h,Fr}var pw;function tO(){if(pw)return fd;pw=1,Object.defineProperty(fd,"__esModule",{value:!0});const e=eO(),t=a_(),n=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",e.default,t.default];return fd.default=n,fd}var md={},gd={},mw;function sO(){if(mw)return gd;mw=1,Object.defineProperty(gd,"__esModule",{value:!0});const e=St(),t=e.operators,n={maximum:{okStr:"<=",ok:t.LTE,fail:t.GT},minimum:{okStr:">=",ok:t.GTE,fail:t.LT},exclusiveMaximum:{okStr:"<",ok:t.LT,fail:t.GTE},exclusiveMinimum:{okStr:">",ok:t.GT,fail:t.LTE}},r={message:({keyword:c,schemaCode:h})=>(0,e.str)`must be ${n[c].okStr} ${h}`,params:({keyword:c,schemaCode:h})=>(0,e._)`{comparison: ${n[c].okStr}, limit: ${h}}`},o={keyword:Object.keys(n),type:"number",schemaType:"number",$data:!0,error:r,code(c){const{keyword:h,data:l,schemaCode:u}=c;c.fail$data((0,e._)`${l} ${n[h].fail} ${u} || isNaN(${l})`)}};return gd.default=o,gd}var vd={},gw;function nO(){if(gw)return vd;gw=1,Object.defineProperty(vd,"__esModule",{value:!0});const e=St(),n={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:r})=>(0,e.str)`must be multiple of ${r}`,params:({schemaCode:r})=>(0,e._)`{multipleOf: ${r}}`},code(r){const{gen:o,data:c,schemaCode:h,it:l}=r,u=l.opts.multipleOfPrecision,m=o.let("res"),g=u?(0,e._)`Math.abs(Math.round(${m}) - ${m}) > 1e-${u}`:(0,e._)`${m} !== parseInt(${m})`;r.fail$data((0,e._)`(${h} === 0 || (${m} = ${c}/${h}, ${g}))`)}};return vd.default=n,vd}var _d={},yd={},vw;function iO(){if(vw)return yd;vw=1,Object.defineProperty(yd,"__esModule",{value:!0});function e(t){const n=t.length;let r=0,o=0,c;for(;o<n;)r++,c=t.charCodeAt(o++),c>=55296&&c<=56319&&o<n&&(c=t.charCodeAt(o),(c&64512)===56320&&o++);return r}return yd.default=e,e.code='require("ajv/dist/runtime/ucs2length").default',yd}var _w;function rO(){if(_w)return _d;_w=1,Object.defineProperty(_d,"__esModule",{value:!0});const e=St(),t=Nt(),n=iO(),o={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:c,schemaCode:h}){const l=c==="maxLength"?"more":"fewer";return(0,e.str)`must NOT have ${l} than ${h} characters`},params:({schemaCode:c})=>(0,e._)`{limit: ${c}}`},code(c){const{keyword:h,data:l,schemaCode:u,it:m}=c,g=h==="maxLength"?e.operators.GT:e.operators.LT,p=m.opts.unicode===!1?(0,e._)`${l}.length`:(0,e._)`${(0,t.useFunc)(c.gen,n.default)}(${l})`;c.fail$data((0,e._)`${p} ${g} ${u}`)}};return _d.default=o,_d}var bd={},yw;function aO(){if(yw)return bd;yw=1,Object.defineProperty(bd,"__esModule",{value:!0});const e=ki(),t=Nt(),n=St(),o={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:c})=>(0,n.str)`must match pattern "${c}"`,params:({schemaCode:c})=>(0,n._)`{pattern: ${c}}`},code(c){const{gen:h,data:l,$data:u,schema:m,schemaCode:g,it:p}=c,S=p.opts.unicodeRegExp?"u":"";if(u){const{regExp:x}=p.opts.code,A=x.code==="new RegExp"?(0,n._)`new RegExp`:(0,t.useFunc)(h,x),E=h.let("valid");h.try(()=>h.assign(E,(0,n._)`${A}(${g}, ${S}).test(${l})`),()=>h.assign(E,!1)),c.fail$data((0,n._)`!${E}`)}else{const x=(0,e.usePattern)(c,m);c.fail$data((0,n._)`!${x}.test(${l})`)}}};return bd.default=o,bd}var Sd={},bw;function oO(){if(bw)return Sd;bw=1,Object.defineProperty(Sd,"__esModule",{value:!0});const e=St(),n={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:r,schemaCode:o}){const c=r==="maxProperties"?"more":"fewer";return(0,e.str)`must NOT have ${c} than ${o} properties`},params:({schemaCode:r})=>(0,e._)`{limit: ${r}}`},code(r){const{keyword:o,data:c,schemaCode:h}=r,l=o==="maxProperties"?e.operators.GT:e.operators.LT;r.fail$data((0,e._)`Object.keys(${c}).length ${l} ${h}`)}};return Sd.default=n,Sd}var wd={},Sw;function lO(){if(Sw)return wd;Sw=1,Object.defineProperty(wd,"__esModule",{value:!0});const e=ki(),t=St(),n=Nt(),o={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:c}})=>(0,t.str)`must have required property '${c}'`,params:({params:{missingProperty:c}})=>(0,t._)`{missingProperty: ${c}}`},code(c){const{gen:h,schema:l,schemaCode:u,data:m,$data:g,it:p}=c,{opts:S}=p;if(!g&&l.length===0)return;const x=l.length>=S.loopRequired;if(p.allErrors?A():E(),S.strictRequired){const v=c.parentSchema.properties,{definedProperties:_}=c.it;for(const k of l)if((v==null?void 0:v[k])===void 0&&!_.has(k)){const C=p.schemaEnv.baseId+p.errSchemaPath,w=`required property "${k}" is not defined at "${C}" (strictRequired)`;(0,n.checkStrictMode)(p,w,p.opts.strictRequired)}}function A(){if(x||g)c.block$data(t.nil,y);else for(const v of l)(0,e.checkReportMissingProp)(c,v)}function E(){const v=h.let("missing");if(x||g){const _=h.let("valid",!0);c.block$data(_,()=>b(v,_)),c.ok(_)}else h.if((0,e.checkMissingProp)(c,l,v)),(0,e.reportMissingProp)(c,v),h.else()}function y(){h.forOf("prop",u,v=>{c.setParams({missingProperty:v}),h.if((0,e.noPropertyInData)(h,m,v,S.ownProperties),()=>c.error())})}function b(v,_){c.setParams({missingProperty:v}),h.forOf(v,u,()=>{h.assign(_,(0,e.propertyInData)(h,m,v,S.ownProperties)),h.if((0,t.not)(_),()=>{c.error(),h.break()})},t.nil)}}};return wd.default=o,wd}var xd={},ww;function cO(){if(ww)return xd;ww=1,Object.defineProperty(xd,"__esModule",{value:!0});const e=St(),n={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:r,schemaCode:o}){const c=r==="maxItems"?"more":"fewer";return(0,e.str)`must NOT have ${c} than ${o} items`},params:({schemaCode:r})=>(0,e._)`{limit: ${r}}`},code(r){const{keyword:o,data:c,schemaCode:h}=r,l=o==="maxItems"?e.operators.GT:e.operators.LT;r.fail$data((0,e._)`${c}.length ${l} ${h}`)}};return xd.default=n,xd}var Cd={},Ed={},xw;function o_(){if(xw)return Ed;xw=1,Object.defineProperty(Ed,"__esModule",{value:!0});const e=b2();return e.code='require("ajv/dist/runtime/equal").default',Ed.default=e,Ed}var Cw;function uO(){if(Cw)return Cd;Cw=1,Object.defineProperty(Cd,"__esModule",{value:!0});const e=Zh(),t=St(),n=Nt(),r=o_(),c={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:h,j:l}})=>(0,t.str)`must NOT have duplicate items (items ## ${l} and ${h} are identical)`,params:({params:{i:h,j:l}})=>(0,t._)`{i: ${h}, j: ${l}}`},code(h){const{gen:l,data:u,$data:m,schema:g,parentSchema:p,schemaCode:S,it:x}=h;if(!m&&!g)return;const A=l.let("valid"),E=p.items?(0,e.getSchemaTypes)(p.items):[];h.block$data(A,y,(0,t._)`${S} === false`),h.ok(A);function y(){const k=l.let("i",(0,t._)`${u}.length`),C=l.let("j");h.setParams({i:k,j:C}),l.assign(A,!0),l.if((0,t._)`${k} > 1`,()=>(b()?v:_)(k,C))}function b(){return E.length>0&&!E.some(k=>k==="object"||k==="array")}function v(k,C){const w=l.name("item"),T=(0,e.checkDataTypes)(E,w,x.opts.strictNumbers,e.DataType.Wrong),j=l.const("indices",(0,t._)`{}`);l.for((0,t._)`;${k}--;`,()=>{l.let(w,(0,t._)`${u}[${k}]`),l.if(T,(0,t._)`continue`),E.length>1&&l.if((0,t._)`typeof ${w} == "string"`,(0,t._)`${w} += "_"`),l.if((0,t._)`typeof ${j}[${w}] == "number"`,()=>{l.assign(C,(0,t._)`${j}[${w}]`),h.error(),l.assign(A,!1).break()}).code((0,t._)`${j}[${w}] = ${k}`)})}function _(k,C){const w=(0,n.useFunc)(l,r.default),T=l.name("outer");l.label(T).for((0,t._)`;${k}--;`,()=>l.for((0,t._)`${C} = ${k}; ${C}--;`,()=>l.if((0,t._)`${w}(${u}[${k}], ${u}[${C}])`,()=>{h.error(),l.assign(A,!1).break(T)})))}}};return Cd.default=c,Cd}var kd={},Ew;function dO(){if(Ew)return kd;Ew=1,Object.defineProperty(kd,"__esModule",{value:!0});const e=St(),t=Nt(),n=o_(),o={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:c})=>(0,e._)`{allowedValue: ${c}}`},code(c){const{gen:h,data:l,$data:u,schemaCode:m,schema:g}=c;u||g&&typeof g=="object"?c.fail$data((0,e._)`!${(0,t.useFunc)(h,n.default)}(${l}, ${m})`):c.fail((0,e._)`${g} !== ${l}`)}};return kd.default=o,kd}var jd={},kw;function hO(){if(kw)return jd;kw=1,Object.defineProperty(jd,"__esModule",{value:!0});const e=St(),t=Nt(),n=o_(),o={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:c})=>(0,e._)`{allowedValues: ${c}}`},code(c){const{gen:h,data:l,$data:u,schema:m,schemaCode:g,it:p}=c;if(!u&&m.length===0)throw new Error("enum must have non-empty array");const S=m.length>=p.opts.loopEnum;let x;const A=()=>x??(x=(0,t.useFunc)(h,n.default));let E;if(S||u)E=h.let("valid"),c.block$data(E,y);else{if(!Array.isArray(m))throw new Error("ajv implementation error");const v=h.const("vSchema",g);E=(0,e.or)(...m.map((_,k)=>b(v,k)))}c.pass(E);function y(){h.assign(E,!1),h.forOf("v",g,v=>h.if((0,e._)`${A()}(${l}, ${v})`,()=>h.assign(E,!0).break()))}function b(v,_){const k=m[_];return typeof k=="object"&&k!==null?(0,e._)`${A()}(${l}, ${v}[${_}])`:(0,e._)`${l} === ${k}`}}};return jd.default=o,jd}var jw;function fO(){if(jw)return md;jw=1,Object.defineProperty(md,"__esModule",{value:!0});const e=sO(),t=nO(),n=rO(),r=aO(),o=oO(),c=lO(),h=cO(),l=uO(),u=dO(),m=hO(),g=[e.default,t.default,n.default,r.default,o.default,c.default,h.default,l.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},u.default,m.default];return md.default=g,md}var Rd={},Do={},Rw;function w2(){if(Rw)return Do;Rw=1,Object.defineProperty(Do,"__esModule",{value:!0}),Do.validateAdditionalItems=void 0;const e=St(),t=Nt(),r={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:c}})=>(0,e.str)`must NOT have more than ${c} items`,params:({params:{len:c}})=>(0,e._)`{limit: ${c}}`},code(c){const{parentSchema:h,it:l}=c,{items:u}=h;if(!Array.isArray(u)){(0,t.checkStrictMode)(l,'"additionalItems" is ignored when "items" is not an array of schemas');return}o(c,u)}};function o(c,h){const{gen:l,schema:u,data:m,keyword:g,it:p}=c;p.items=!0;const S=l.const("len",(0,e._)`${m}.length`);if(u===!1)c.setParams({len:h.length}),c.pass((0,e._)`${S} <= ${h.length}`);else if(typeof u=="object"&&!(0,t.alwaysValidSchema)(p,u)){const A=l.var("valid",(0,e._)`${S} <= ${h.length}`);l.if((0,e.not)(A),()=>x(A)),c.ok(A)}function x(A){l.forRange("i",h.length,S,E=>{c.subschema({keyword:g,dataProp:E,dataPropType:t.Type.Num},A),p.allErrors||l.if((0,e.not)(A),()=>l.break())})}}return Do.validateAdditionalItems=o,Do.default=r,Do}var Ad={},Oo={},Aw;function x2(){if(Aw)return Oo;Aw=1,Object.defineProperty(Oo,"__esModule",{value:!0}),Oo.validateTuple=void 0;const e=St(),t=Nt(),n=ki(),r={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(c){const{schema:h,it:l}=c;if(Array.isArray(h))return o(c,"additionalItems",h);l.items=!0,!(0,t.alwaysValidSchema)(l,h)&&c.ok((0,n.validateArray)(c))}};function o(c,h,l=c.schema){const{gen:u,parentSchema:m,data:g,keyword:p,it:S}=c;E(m),S.opts.unevaluated&&l.length&&S.items!==!0&&(S.items=t.mergeEvaluated.items(u,l.length,S.items));const x=u.name("valid"),A=u.const("len",(0,e._)`${g}.length`);l.forEach((y,b)=>{(0,t.alwaysValidSchema)(S,y)||(u.if((0,e._)`${A} > ${b}`,()=>c.subschema({keyword:p,schemaProp:b,dataProp:b},x)),c.ok(x))});function E(y){const{opts:b,errSchemaPath:v}=S,_=l.length,k=_===y.minItems&&(_===y.maxItems||y[h]===!1);if(b.strictTuples&&!k){const C=`"${p}" is ${_}-tuple, but minItems or maxItems/${h} are not specified or different at path "${v}"`;(0,t.checkStrictMode)(S,C,b.strictTuples)}}}return Oo.validateTuple=o,Oo.default=r,Oo}var Tw;function pO(){if(Tw)return Ad;Tw=1,Object.defineProperty(Ad,"__esModule",{value:!0});const e=x2(),t={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:n=>(0,e.validateTuple)(n,"items")};return Ad.default=t,Ad}var Td={},Nw;function mO(){if(Nw)return Td;Nw=1,Object.defineProperty(Td,"__esModule",{value:!0});const e=St(),t=Nt(),n=ki(),r=w2(),c={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:h}})=>(0,e.str)`must NOT have more than ${h} items`,params:({params:{len:h}})=>(0,e._)`{limit: ${h}}`},code(h){const{schema:l,parentSchema:u,it:m}=h,{prefixItems:g}=u;m.items=!0,!(0,t.alwaysValidSchema)(m,l)&&(g?(0,r.validateAdditionalItems)(h,g):h.ok((0,n.validateArray)(h)))}};return Td.default=c,Td}var Nd={},Mw;function gO(){if(Mw)return Nd;Mw=1,Object.defineProperty(Nd,"__esModule",{value:!0});const e=St(),t=Nt(),r={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:o,max:c}})=>c===void 0?(0,e.str)`must contain at least ${o} valid item(s)`:(0,e.str)`must contain at least ${o} and no more than ${c} valid item(s)`,params:({params:{min:o,max:c}})=>c===void 0?(0,e._)`{minContains: ${o}}`:(0,e._)`{minContains: ${o}, maxContains: ${c}}`},code(o){const{gen:c,schema:h,parentSchema:l,data:u,it:m}=o;let g,p;const{minContains:S,maxContains:x}=l;m.opts.next?(g=S===void 0?1:S,p=x):g=1;const A=c.const("len",(0,e._)`${u}.length`);if(o.setParams({min:g,max:p}),p===void 0&&g===0){(0,t.checkStrictMode)(m,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(p!==void 0&&g>p){(0,t.checkStrictMode)(m,'"minContains" > "maxContains" is always invalid'),o.fail();return}if((0,t.alwaysValidSchema)(m,h)){let _=(0,e._)`${A} >= ${g}`;p!==void 0&&(_=(0,e._)`${_} && ${A} <= ${p}`),o.pass(_);return}m.items=!0;const E=c.name("valid");p===void 0&&g===1?b(E,()=>c.if(E,()=>c.break())):g===0?(c.let(E,!0),p!==void 0&&c.if((0,e._)`${u}.length > 0`,y)):(c.let(E,!1),y()),o.result(E,()=>o.reset());function y(){const _=c.name("_valid"),k=c.let("count",0);b(_,()=>c.if(_,()=>v(k)))}function b(_,k){c.forRange("i",0,A,C=>{o.subschema({keyword:"contains",dataProp:C,dataPropType:t.Type.Num,compositeRule:!0},_),k()})}function v(_){c.code((0,e._)`${_}++`),p===void 0?c.if((0,e._)`${_} >= ${g}`,()=>c.assign(E,!0).break()):(c.if((0,e._)`${_} > ${p}`,()=>c.assign(E,!1).break()),g===1?c.assign(E,!0):c.if((0,e._)`${_} >= ${g}`,()=>c.assign(E,!0)))}}};return Nd.default=r,Nd}var pg={},$w;function l_(){return $w||($w=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;const t=St(),n=Nt(),r=ki();e.error={message:({params:{property:u,depsCount:m,deps:g}})=>{const p=m===1?"property":"properties";return(0,t.str)`must have ${p} ${g} when property ${u} is present`},params:({params:{property:u,depsCount:m,deps:g,missingProperty:p}})=>(0,t._)`{property: ${u},
|
|
491
|
+
missingProperty: ${p},
|
|
492
|
+
depsCount: ${m},
|
|
493
|
+
deps: ${g}}`};const o={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(u){const[m,g]=c(u);h(u,m),l(u,g)}};function c({schema:u}){const m={},g={};for(const p in u){if(p==="__proto__")continue;const S=Array.isArray(u[p])?m:g;S[p]=u[p]}return[m,g]}function h(u,m=u.schema){const{gen:g,data:p,it:S}=u;if(Object.keys(m).length===0)return;const x=g.let("missing");for(const A in m){const E=m[A];if(E.length===0)continue;const y=(0,r.propertyInData)(g,p,A,S.opts.ownProperties);u.setParams({property:A,depsCount:E.length,deps:E.join(", ")}),S.allErrors?g.if(y,()=>{for(const b of E)(0,r.checkReportMissingProp)(u,b)}):(g.if((0,t._)`${y} && (${(0,r.checkMissingProp)(u,E,x)})`),(0,r.reportMissingProp)(u,x),g.else())}}e.validatePropertyDeps=h;function l(u,m=u.schema){const{gen:g,data:p,keyword:S,it:x}=u,A=g.name("valid");for(const E in m)(0,n.alwaysValidSchema)(x,m[E])||(g.if((0,r.propertyInData)(g,p,E,x.opts.ownProperties),()=>{const y=u.subschema({keyword:S,schemaProp:E},A);u.mergeValidEvaluated(y,A)},()=>g.var(A,!0)),u.ok(A))}e.validateSchemaDeps=l,e.default=o})(pg)),pg}var Md={},Dw;function vO(){if(Dw)return Md;Dw=1,Object.defineProperty(Md,"__esModule",{value:!0});const e=St(),t=Nt(),r={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:o})=>(0,e._)`{propertyName: ${o.propertyName}}`},code(o){const{gen:c,schema:h,data:l,it:u}=o;if((0,t.alwaysValidSchema)(u,h))return;const m=c.name("valid");c.forIn("key",l,g=>{o.setParams({propertyName:g}),o.subschema({keyword:"propertyNames",data:g,dataTypes:["string"],propertyName:g,compositeRule:!0},m),c.if((0,e.not)(m),()=>{o.error(!0),u.allErrors||c.break()})}),o.ok(m)}};return Md.default=r,Md}var $d={},Ow;function C2(){if(Ow)return $d;Ow=1,Object.defineProperty($d,"__esModule",{value:!0});const e=ki(),t=St(),n=Ei(),r=Nt(),c={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:h})=>(0,t._)`{additionalProperty: ${h.additionalProperty}}`},code(h){const{gen:l,schema:u,parentSchema:m,data:g,errsCount:p,it:S}=h;if(!p)throw new Error("ajv implementation error");const{allErrors:x,opts:A}=S;if(S.props=!0,A.removeAdditional!=="all"&&(0,r.alwaysValidSchema)(S,u))return;const E=(0,e.allSchemaProperties)(m.properties),y=(0,e.allSchemaProperties)(m.patternProperties);b(),h.ok((0,t._)`${p} === ${n.default.errors}`);function b(){l.forIn("key",g,w=>{!E.length&&!y.length?k(w):l.if(v(w),()=>k(w))})}function v(w){let T;if(E.length>8){const j=(0,r.schemaRefOrVal)(S,m.properties,"properties");T=(0,e.isOwnProperty)(l,j,w)}else E.length?T=(0,t.or)(...E.map(j=>(0,t._)`${w} === ${j}`)):T=t.nil;return y.length&&(T=(0,t.or)(T,...y.map(j=>(0,t._)`${(0,e.usePattern)(h,j)}.test(${w})`))),(0,t.not)(T)}function _(w){l.code((0,t._)`delete ${g}[${w}]`)}function k(w){if(A.removeAdditional==="all"||A.removeAdditional&&u===!1){_(w);return}if(u===!1){h.setParams({additionalProperty:w}),h.error(),x||l.break();return}if(typeof u=="object"&&!(0,r.alwaysValidSchema)(S,u)){const T=l.name("valid");A.removeAdditional==="failing"?(C(w,T,!1),l.if((0,t.not)(T),()=>{h.reset(),_(w)})):(C(w,T),x||l.if((0,t.not)(T),()=>l.break()))}}function C(w,T,j){const M={keyword:"additionalProperties",dataProp:w,dataPropType:r.Type.Str};j===!1&&Object.assign(M,{compositeRule:!0,createErrors:!1,allErrors:!1}),h.subschema(M,T)}}};return $d.default=c,$d}var Dd={},Lw;function _O(){if(Lw)return Dd;Lw=1,Object.defineProperty(Dd,"__esModule",{value:!0});const e=pf(),t=ki(),n=Nt(),r=C2(),o={keyword:"properties",type:"object",schemaType:"object",code(c){const{gen:h,schema:l,parentSchema:u,data:m,it:g}=c;g.opts.removeAdditional==="all"&&u.additionalProperties===void 0&&r.default.code(new e.KeywordCxt(g,r.default,"additionalProperties"));const p=(0,t.allSchemaProperties)(l);for(const y of p)g.definedProperties.add(y);g.opts.unevaluated&&p.length&&g.props!==!0&&(g.props=n.mergeEvaluated.props(h,(0,n.toHash)(p),g.props));const S=p.filter(y=>!(0,n.alwaysValidSchema)(g,l[y]));if(S.length===0)return;const x=h.name("valid");for(const y of S)A(y)?E(y):(h.if((0,t.propertyInData)(h,m,y,g.opts.ownProperties)),E(y),g.allErrors||h.else().var(x,!0),h.endIf()),c.it.definedProperties.add(y),c.ok(x);function A(y){return g.opts.useDefaults&&!g.compositeRule&&l[y].default!==void 0}function E(y){c.subschema({keyword:"properties",schemaProp:y,dataProp:y},x)}}};return Dd.default=o,Dd}var Od={},Iw;function yO(){if(Iw)return Od;Iw=1,Object.defineProperty(Od,"__esModule",{value:!0});const e=ki(),t=St(),n=Nt(),r=Nt(),o={keyword:"patternProperties",type:"object",schemaType:"object",code(c){const{gen:h,schema:l,data:u,parentSchema:m,it:g}=c,{opts:p}=g,S=(0,e.allSchemaProperties)(l),x=S.filter(k=>(0,n.alwaysValidSchema)(g,l[k]));if(S.length===0||x.length===S.length&&(!g.opts.unevaluated||g.props===!0))return;const A=p.strictSchema&&!p.allowMatchingProperties&&m.properties,E=h.name("valid");g.props!==!0&&!(g.props instanceof t.Name)&&(g.props=(0,r.evaluatedPropsToName)(h,g.props));const{props:y}=g;b();function b(){for(const k of S)A&&v(k),g.allErrors?_(k):(h.var(E,!0),_(k),h.if(E))}function v(k){for(const C in A)new RegExp(k).test(C)&&(0,n.checkStrictMode)(g,`property ${C} matches pattern ${k} (use allowMatchingProperties)`)}function _(k){h.forIn("key",u,C=>{h.if((0,t._)`${(0,e.usePattern)(c,k)}.test(${C})`,()=>{const w=x.includes(k);w||c.subschema({keyword:"patternProperties",schemaProp:k,dataProp:C,dataPropType:r.Type.Str},E),g.opts.unevaluated&&y!==!0?h.assign((0,t._)`${y}[${C}]`,!0):!w&&!g.allErrors&&h.if((0,t.not)(E),()=>h.break())})})}}};return Od.default=o,Od}var Ld={},Pw;function bO(){if(Pw)return Ld;Pw=1,Object.defineProperty(Ld,"__esModule",{value:!0});const e=Nt(),t={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(n){const{gen:r,schema:o,it:c}=n;if((0,e.alwaysValidSchema)(c,o)){n.fail();return}const h=r.name("valid");n.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},h),n.failResult(h,()=>n.reset(),()=>n.error())},error:{message:"must NOT be valid"}};return Ld.default=t,Ld}var Id={},Bw;function SO(){if(Bw)return Id;Bw=1,Object.defineProperty(Id,"__esModule",{value:!0});const t={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:ki().validateUnion,error:{message:"must match a schema in anyOf"}};return Id.default=t,Id}var Pd={},zw;function wO(){if(zw)return Pd;zw=1,Object.defineProperty(Pd,"__esModule",{value:!0});const e=St(),t=Nt(),r={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:o})=>(0,e._)`{passingSchemas: ${o.passing}}`},code(o){const{gen:c,schema:h,parentSchema:l,it:u}=o;if(!Array.isArray(h))throw new Error("ajv implementation error");if(u.opts.discriminator&&l.discriminator)return;const m=h,g=c.let("valid",!1),p=c.let("passing",null),S=c.name("_valid");o.setParams({passing:p}),c.block(x),o.result(g,()=>o.reset(),()=>o.error(!0));function x(){m.forEach((A,E)=>{let y;(0,t.alwaysValidSchema)(u,A)?c.var(S,!0):y=o.subschema({keyword:"oneOf",schemaProp:E,compositeRule:!0},S),E>0&&c.if((0,e._)`${S} && ${g}`).assign(g,!1).assign(p,(0,e._)`[${p}, ${E}]`).else(),c.if(S,()=>{c.assign(g,!0),c.assign(p,E),y&&o.mergeEvaluated(y,e.Name)})})}}};return Pd.default=r,Pd}var Bd={},Hw;function xO(){if(Hw)return Bd;Hw=1,Object.defineProperty(Bd,"__esModule",{value:!0});const e=Nt(),t={keyword:"allOf",schemaType:"array",code(n){const{gen:r,schema:o,it:c}=n;if(!Array.isArray(o))throw new Error("ajv implementation error");const h=r.name("valid");o.forEach((l,u)=>{if((0,e.alwaysValidSchema)(c,l))return;const m=n.subschema({keyword:"allOf",schemaProp:u},h);n.ok(h),n.mergeEvaluated(m)})}};return Bd.default=t,Bd}var zd={},Uw;function CO(){if(Uw)return zd;Uw=1,Object.defineProperty(zd,"__esModule",{value:!0});const e=St(),t=Nt(),r={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:c})=>(0,e.str)`must match "${c.ifClause}" schema`,params:({params:c})=>(0,e._)`{failingKeyword: ${c.ifClause}}`},code(c){const{gen:h,parentSchema:l,it:u}=c;l.then===void 0&&l.else===void 0&&(0,t.checkStrictMode)(u,'"if" without "then" and "else" is ignored');const m=o(u,"then"),g=o(u,"else");if(!m&&!g)return;const p=h.let("valid",!0),S=h.name("_valid");if(x(),c.reset(),m&&g){const E=h.let("ifClause");c.setParams({ifClause:E}),h.if(S,A("then",E),A("else",E))}else m?h.if(S,A("then")):h.if((0,e.not)(S),A("else"));c.pass(p,()=>c.error(!0));function x(){const E=c.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},S);c.mergeEvaluated(E)}function A(E,y){return()=>{const b=c.subschema({keyword:E},S);h.assign(p,S),c.mergeValidEvaluated(b,p),y?h.assign(y,(0,e._)`${E}`):c.setParams({ifClause:E})}}}};function o(c,h){const l=c.schema[h];return l!==void 0&&!(0,t.alwaysValidSchema)(c,l)}return zd.default=r,zd}var Hd={},Fw;function EO(){if(Fw)return Hd;Fw=1,Object.defineProperty(Hd,"__esModule",{value:!0});const e=Nt(),t={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:n,parentSchema:r,it:o}){r.if===void 0&&(0,e.checkStrictMode)(o,`"${n}" without "if" is ignored`)}};return Hd.default=t,Hd}var qw;function kO(){if(qw)return Rd;qw=1,Object.defineProperty(Rd,"__esModule",{value:!0});const e=w2(),t=pO(),n=x2(),r=mO(),o=gO(),c=l_(),h=vO(),l=C2(),u=_O(),m=yO(),g=bO(),p=SO(),S=wO(),x=xO(),A=CO(),E=EO();function y(b=!1){const v=[g.default,p.default,S.default,x.default,A.default,E.default,h.default,l.default,c.default,u.default,m.default];return b?v.push(t.default,r.default):v.push(e.default,n.default),v.push(o.default),v}return Rd.default=y,Rd}var Ud={},Lo={},Vw;function E2(){if(Vw)return Lo;Vw=1,Object.defineProperty(Lo,"__esModule",{value:!0}),Lo.dynamicAnchor=void 0;const e=St(),t=Ei(),n=gf(),r=a_(),o={keyword:"$dynamicAnchor",schemaType:"string",code:l=>c(l,l.schema)};function c(l,u){const{gen:m,it:g}=l;g.schemaEnv.root.dynamicAnchors[u]=!0;const p=(0,e._)`${t.default.dynamicAnchors}${(0,e.getProperty)(u)}`,S=g.errSchemaPath==="#"?g.validateName:h(l);m.if((0,e._)`!${p}`,()=>m.assign(p,S))}Lo.dynamicAnchor=c;function h(l){const{schemaEnv:u,schema:m,self:g}=l.it,{root:p,baseId:S,localRefs:x,meta:A}=u.root,{schemaId:E}=g.opts,y=new n.SchemaEnv({schema:m,schemaId:E,root:p,baseId:S,localRefs:x,meta:A});return n.compileSchema.call(g,y),(0,r.getValidate)(l,y)}return Lo.default=o,Lo}var Io={},Gw;function k2(){if(Gw)return Io;Gw=1,Object.defineProperty(Io,"__esModule",{value:!0}),Io.dynamicRef=void 0;const e=St(),t=Ei(),n=a_(),r={keyword:"$dynamicRef",schemaType:"string",code:c=>o(c,c.schema)};function o(c,h){const{gen:l,keyword:u,it:m}=c;if(h[0]!=="#")throw new Error(`"${u}" only supports hash fragment reference`);const g=h.slice(1);if(m.allErrors)p();else{const x=l.let("valid",!1);p(x),c.ok(x)}function p(x){if(m.schemaEnv.root.dynamicAnchors[g]){const A=l.let("_v",(0,e._)`${t.default.dynamicAnchors}${(0,e.getProperty)(g)}`);l.if(A,S(A,x),S(m.validateName,x))}else S(m.validateName,x)()}function S(x,A){return A?()=>l.block(()=>{(0,n.callRef)(c,x),l.let(A,!0)}):()=>(0,n.callRef)(c,x)}}return Io.dynamicRef=o,Io.default=r,Io}var Fd={},Ww;function jO(){if(Ww)return Fd;Ww=1,Object.defineProperty(Fd,"__esModule",{value:!0});const e=E2(),t=Nt(),n={keyword:"$recursiveAnchor",schemaType:"boolean",code(r){r.schema?(0,e.dynamicAnchor)(r,""):(0,t.checkStrictMode)(r.it,"$recursiveAnchor: false is ignored")}};return Fd.default=n,Fd}var qd={},Kw;function RO(){if(Kw)return qd;Kw=1,Object.defineProperty(qd,"__esModule",{value:!0});const e=k2(),t={keyword:"$recursiveRef",schemaType:"string",code:n=>(0,e.dynamicRef)(n,n.schema)};return qd.default=t,qd}var Yw;function AO(){if(Yw)return Ud;Yw=1,Object.defineProperty(Ud,"__esModule",{value:!0});const e=E2(),t=k2(),n=jO(),r=RO(),o=[e.default,t.default,n.default,r.default];return Ud.default=o,Ud}var Vd={},Gd={},Xw;function TO(){if(Xw)return Gd;Xw=1,Object.defineProperty(Gd,"__esModule",{value:!0});const e=l_(),t={keyword:"dependentRequired",type:"object",schemaType:"object",error:e.error,code:n=>(0,e.validatePropertyDeps)(n)};return Gd.default=t,Gd}var Wd={},Jw;function NO(){if(Jw)return Wd;Jw=1,Object.defineProperty(Wd,"__esModule",{value:!0});const e=l_(),t={keyword:"dependentSchemas",type:"object",schemaType:"object",code:n=>(0,e.validateSchemaDeps)(n)};return Wd.default=t,Wd}var Kd={},Zw;function MO(){if(Zw)return Kd;Zw=1,Object.defineProperty(Kd,"__esModule",{value:!0});const e=Nt(),t={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:n,parentSchema:r,it:o}){r.contains===void 0&&(0,e.checkStrictMode)(o,`"${n}" without "contains" is ignored`)}};return Kd.default=t,Kd}var Qw;function $O(){if(Qw)return Vd;Qw=1,Object.defineProperty(Vd,"__esModule",{value:!0});const e=TO(),t=NO(),n=MO(),r=[e.default,t.default,n.default];return Vd.default=r,Vd}var Yd={},Xd={},ex;function DO(){if(ex)return Xd;ex=1,Object.defineProperty(Xd,"__esModule",{value:!0});const e=St(),t=Nt(),n=Ei(),o={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:c})=>(0,e._)`{unevaluatedProperty: ${c.unevaluatedProperty}}`},code(c){const{gen:h,schema:l,data:u,errsCount:m,it:g}=c;if(!m)throw new Error("ajv implementation error");const{allErrors:p,props:S}=g;S instanceof e.Name?h.if((0,e._)`${S} !== true`,()=>h.forIn("key",u,y=>h.if(A(S,y),()=>x(y)))):S!==!0&&h.forIn("key",u,y=>S===void 0?x(y):h.if(E(S,y),()=>x(y))),g.props=!0,c.ok((0,e._)`${m} === ${n.default.errors}`);function x(y){if(l===!1){c.setParams({unevaluatedProperty:y}),c.error(),p||h.break();return}if(!(0,t.alwaysValidSchema)(g,l)){const b=h.name("valid");c.subschema({keyword:"unevaluatedProperties",dataProp:y,dataPropType:t.Type.Str},b),p||h.if((0,e.not)(b),()=>h.break())}}function A(y,b){return(0,e._)`!${y} || !${y}[${b}]`}function E(y,b){const v=[];for(const _ in y)y[_]===!0&&v.push((0,e._)`${b} !== ${_}`);return(0,e.and)(...v)}}};return Xd.default=o,Xd}var Jd={},tx;function OO(){if(tx)return Jd;tx=1,Object.defineProperty(Jd,"__esModule",{value:!0});const e=St(),t=Nt(),r={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:o}})=>(0,e.str)`must NOT have more than ${o} items`,params:({params:{len:o}})=>(0,e._)`{limit: ${o}}`},code(o){const{gen:c,schema:h,data:l,it:u}=o,m=u.items||0;if(m===!0)return;const g=c.const("len",(0,e._)`${l}.length`);if(h===!1)o.setParams({len:m}),o.fail((0,e._)`${g} > ${m}`);else if(typeof h=="object"&&!(0,t.alwaysValidSchema)(u,h)){const S=c.var("valid",(0,e._)`${g} <= ${m}`);c.if((0,e.not)(S),()=>p(S,m)),o.ok(S)}u.items=!0;function p(S,x){c.forRange("i",x,g,A=>{o.subschema({keyword:"unevaluatedItems",dataProp:A,dataPropType:t.Type.Num},S),u.allErrors||c.if((0,e.not)(S),()=>c.break())})}}};return Jd.default=r,Jd}var sx;function LO(){if(sx)return Yd;sx=1,Object.defineProperty(Yd,"__esModule",{value:!0});const e=DO(),t=OO(),n=[e.default,t.default];return Yd.default=n,Yd}var Zd={},Qd={},nx;function IO(){if(nx)return Qd;nx=1,Object.defineProperty(Qd,"__esModule",{value:!0});const e=St(),n={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:r})=>(0,e.str)`must match format "${r}"`,params:({schemaCode:r})=>(0,e._)`{format: ${r}}`},code(r,o){const{gen:c,data:h,$data:l,schema:u,schemaCode:m,it:g}=r,{opts:p,errSchemaPath:S,schemaEnv:x,self:A}=g;if(!p.validateFormats)return;l?E():y();function E(){const b=c.scopeValue("formats",{ref:A.formats,code:p.code.formats}),v=c.const("fDef",(0,e._)`${b}[${m}]`),_=c.let("fType"),k=c.let("format");c.if((0,e._)`typeof ${v} == "object" && !(${v} instanceof RegExp)`,()=>c.assign(_,(0,e._)`${v}.type || "string"`).assign(k,(0,e._)`${v}.validate`),()=>c.assign(_,(0,e._)`"string"`).assign(k,v)),r.fail$data((0,e.or)(C(),w()));function C(){return p.strictSchema===!1?e.nil:(0,e._)`${m} && !${k}`}function w(){const T=x.$async?(0,e._)`(${v}.async ? await ${k}(${h}) : ${k}(${h}))`:(0,e._)`${k}(${h})`,j=(0,e._)`(typeof ${k} == "function" ? ${T} : ${k}.test(${h}))`;return(0,e._)`${k} && ${k} !== true && ${_} === ${o} && !${j}`}}function y(){const b=A.formats[u];if(!b){C();return}if(b===!0)return;const[v,_,k]=w(b);v===o&&r.pass(T());function C(){if(p.strictSchema===!1){A.logger.warn(j());return}throw new Error(j());function j(){return`unknown format "${u}" ignored in schema at path "${S}"`}}function w(j){const M=j instanceof RegExp?(0,e.regexpCode)(j):p.code.formats?(0,e._)`${p.code.formats}${(0,e.getProperty)(u)}`:void 0,D=c.scopeValue("formats",{key:u,ref:j,code:M});return typeof j=="object"&&!(j instanceof RegExp)?[j.type||"string",j.validate,(0,e._)`${D}.validate`]:["string",j,D]}function T(){if(typeof b=="object"&&!(b instanceof RegExp)&&b.async){if(!x.$async)throw new Error("async format in sync schema");return(0,e._)`await ${k}(${h})`}return typeof _=="function"?(0,e._)`${k}(${h})`:(0,e._)`${k}.test(${h})`}}}};return Qd.default=n,Qd}var ix;function PO(){if(ix)return Zd;ix=1,Object.defineProperty(Zd,"__esModule",{value:!0});const t=[IO().default];return Zd.default=t,Zd}var ja={},rx;function BO(){return rx||(rx=1,Object.defineProperty(ja,"__esModule",{value:!0}),ja.contentVocabulary=ja.metadataVocabulary=void 0,ja.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],ja.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]),ja}var ax;function zO(){if(ax)return hd;ax=1,Object.defineProperty(hd,"__esModule",{value:!0});const e=tO(),t=fO(),n=kO(),r=AO(),o=$O(),c=LO(),h=PO(),l=BO(),u=[r.default,e.default,t.default,(0,n.default)(!0),h.default,l.metadataVocabulary,l.contentVocabulary,o.default,c.default];return hd.default=u,hd}var eh={},fc={},ox;function HO(){if(ox)return fc;ox=1,Object.defineProperty(fc,"__esModule",{value:!0}),fc.DiscrError=void 0;var e;return(function(t){t.Tag="tag",t.Mapping="mapping"})(e||(fc.DiscrError=e={})),fc}var lx;function UO(){if(lx)return eh;lx=1,Object.defineProperty(eh,"__esModule",{value:!0});const e=St(),t=HO(),n=gf(),r=mf(),o=Nt(),h={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:l,tagName:u}})=>l===t.DiscrError.Tag?`tag "${u}" must be string`:`value of tag "${u}" must be in oneOf`,params:({params:{discrError:l,tag:u,tagName:m}})=>(0,e._)`{error: ${l}, tag: ${m}, tagValue: ${u}}`},code(l){const{gen:u,data:m,schema:g,parentSchema:p,it:S}=l,{oneOf:x}=p;if(!S.opts.discriminator)throw new Error("discriminator: requires discriminator option");const A=g.propertyName;if(typeof A!="string")throw new Error("discriminator: requires propertyName");if(g.mapping)throw new Error("discriminator: mapping is not supported");if(!x)throw new Error("discriminator: requires oneOf keyword");const E=u.let("valid",!1),y=u.const("tag",(0,e._)`${m}${(0,e.getProperty)(A)}`);u.if((0,e._)`typeof ${y} == "string"`,()=>b(),()=>l.error(!1,{discrError:t.DiscrError.Tag,tag:y,tagName:A})),l.ok(E);function b(){const k=_();u.if(!1);for(const C in k)u.elseIf((0,e._)`${y} === ${C}`),u.assign(E,v(k[C]));u.else(),l.error(!1,{discrError:t.DiscrError.Mapping,tag:y,tagName:A}),u.endIf()}function v(k){const C=u.name("valid"),w=l.subschema({keyword:"oneOf",schemaProp:k},C);return l.mergeEvaluated(w,e.Name),C}function _(){var k;const C={},w=j(p);let T=!0;for(let L=0;L<x.length;L++){let q=x[L];if(q!=null&&q.$ref&&!(0,o.schemaHasRulesButRef)(q,S.self.RULES)){const Y=q.$ref;if(q=n.resolveRef.call(S.self,S.schemaEnv.root,S.baseId,Y),q instanceof n.SchemaEnv&&(q=q.schema),q===void 0)throw new r.default(S.opts.uriResolver,S.baseId,Y)}const F=(k=q==null?void 0:q.properties)===null||k===void 0?void 0:k[A];if(typeof F!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${A}"`);T=T&&(w||j(q)),M(F,L)}if(!T)throw new Error(`discriminator: "${A}" must be required`);return C;function j({required:L}){return Array.isArray(L)&&L.includes(A)}function M(L,q){if(L.const)D(L.const,q);else if(L.enum)for(const F of L.enum)D(F,q);else throw new Error(`discriminator: "properties/${A}" must have "const" or "enum"`)}function D(L,q){if(typeof L!="string"||L in C)throw new Error(`discriminator: "${A}" values must be unique strings`);C[L]=q}}}};return eh.default=h,eh}var th={};const FO="https://json-schema.org/draft/2020-12/schema",qO="https://json-schema.org/draft/2020-12/schema",VO={"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},GO="meta",WO="Core and Validation specifications meta-schema",KO=[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],YO=["object","boolean"],XO="This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",JO={definitions:{$comment:'"definitions" has been replaced by "$defs".',type:"object",additionalProperties:{$dynamicRef:"#meta"},deprecated:!0,default:{}},dependencies:{$comment:'"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',type:"object",additionalProperties:{anyOf:[{$dynamicRef:"#meta"},{$ref:"meta/validation#/$defs/stringArray"}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:'"$recursiveAnchor" has been replaced by "$dynamicAnchor".',$ref:"meta/core#/$defs/anchorString",deprecated:!0},$recursiveRef:{$comment:'"$recursiveRef" has been replaced by "$dynamicRef".',$ref:"meta/core#/$defs/uriReferenceString",deprecated:!0}},ZO={$schema:FO,$id:qO,$vocabulary:VO,$dynamicAnchor:GO,title:WO,allOf:KO,type:YO,$comment:XO,properties:JO},QO="https://json-schema.org/draft/2020-12/schema",e5="https://json-schema.org/draft/2020-12/meta/applicator",t5={"https://json-schema.org/draft/2020-12/vocab/applicator":!0},s5="meta",n5="Applicator vocabulary meta-schema",i5=["object","boolean"],r5={prefixItems:{$ref:"#/$defs/schemaArray"},items:{$dynamicRef:"#meta"},contains:{$dynamicRef:"#meta"},additionalProperties:{$dynamicRef:"#meta"},properties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},patternProperties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},propertyNames:{$dynamicRef:"#meta"},if:{$dynamicRef:"#meta"},then:{$dynamicRef:"#meta"},else:{$dynamicRef:"#meta"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$dynamicRef:"#meta"}},a5={schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}},o5={$schema:QO,$id:e5,$vocabulary:t5,$dynamicAnchor:s5,title:n5,type:i5,properties:r5,$defs:a5},l5="https://json-schema.org/draft/2020-12/schema",c5="https://json-schema.org/draft/2020-12/meta/unevaluated",u5={"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},d5="meta",h5="Unevaluated applicator vocabulary meta-schema",f5=["object","boolean"],p5={unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}},m5={$schema:l5,$id:c5,$vocabulary:u5,$dynamicAnchor:d5,title:h5,type:f5,properties:p5},g5="https://json-schema.org/draft/2020-12/schema",v5="https://json-schema.org/draft/2020-12/meta/content",_5={"https://json-schema.org/draft/2020-12/vocab/content":!0},y5="meta",b5="Content vocabulary meta-schema",S5=["object","boolean"],w5={contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}},x5={$schema:g5,$id:v5,$vocabulary:_5,$dynamicAnchor:y5,title:b5,type:S5,properties:w5},C5="https://json-schema.org/draft/2020-12/schema",E5="https://json-schema.org/draft/2020-12/meta/core",k5={"https://json-schema.org/draft/2020-12/vocab/core":!0},j5="meta",R5="Core vocabulary meta-schema",A5=["object","boolean"],T5={$id:{$ref:"#/$defs/uriReferenceString",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{$ref:"#/$defs/uriString"},$ref:{$ref:"#/$defs/uriReferenceString"},$anchor:{$ref:"#/$defs/anchorString"},$dynamicRef:{$ref:"#/$defs/uriReferenceString"},$dynamicAnchor:{$ref:"#/$defs/anchorString"},$vocabulary:{type:"object",propertyNames:{$ref:"#/$defs/uriString"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$dynamicRef:"#meta"}}},N5={anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}},M5={$schema:C5,$id:E5,$vocabulary:k5,$dynamicAnchor:j5,title:R5,type:A5,properties:T5,$defs:N5},$5="https://json-schema.org/draft/2020-12/schema",D5="https://json-schema.org/draft/2020-12/meta/format-annotation",O5={"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},L5="meta",I5="Format vocabulary meta-schema for annotation results",P5=["object","boolean"],B5={format:{type:"string"}},z5={$schema:$5,$id:D5,$vocabulary:O5,$dynamicAnchor:L5,title:I5,type:P5,properties:B5},H5="https://json-schema.org/draft/2020-12/schema",U5="https://json-schema.org/draft/2020-12/meta/meta-data",F5={"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},q5="meta",V5="Meta-data vocabulary meta-schema",G5=["object","boolean"],W5={title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}},K5={$schema:H5,$id:U5,$vocabulary:F5,$dynamicAnchor:q5,title:V5,type:G5,properties:W5},Y5="https://json-schema.org/draft/2020-12/schema",X5="https://json-schema.org/draft/2020-12/meta/validation",J5={"https://json-schema.org/draft/2020-12/vocab/validation":!0},Z5="meta",Q5="Validation vocabulary meta-schema",e6=["object","boolean"],t6={type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},s6={nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},n6={$schema:Y5,$id:X5,$vocabulary:J5,$dynamicAnchor:Z5,title:Q5,type:e6,properties:t6,$defs:s6};var cx;function i6(){if(cx)return th;cx=1,Object.defineProperty(th,"__esModule",{value:!0});const e=ZO,t=o5,n=m5,r=x5,o=M5,c=z5,h=K5,l=n6,u=["/properties"];function m(g){return[e,t,n,r,o,p(this,c),h,p(this,l)].forEach(S=>this.addMetaSchema(S,void 0,!1)),this;function p(S,x){return g?S.$dataMetaSchema(x,u):x}}return th.default=m,th}var ux;function r6(){return ux||(ux=1,(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv2020=void 0;const n=QD(),r=zO(),o=UO(),c=i6(),h="https://json-schema.org/draft/2020-12/schema";class l extends n.default{constructor(x={}){super({...x,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),r.default.forEach(x=>this.addVocabulary(x)),this.opts.discriminator&&this.addKeyword(o.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();const{$data:x,meta:A}=this.opts;A&&(c.default.call(this,x),this.refs["http://json-schema.org/schema"]=h)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(h)?h:void 0)}}t.Ajv2020=l,e.exports=t=l,e.exports.Ajv2020=l,Object.defineProperty(t,"__esModule",{value:!0}),t.default=l;var u=pf();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var m=St();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return m._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return m.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return m.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return m.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return m.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return m.CodeGen}});var g=r_();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return g.default}});var p=mf();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return p.default}})})(od,od.exports)),od.exports}var a6=r6();const o6=hR(a6),j2="sapiom.studio.run-input.v1:",R2="sapiom.studio.run-target.v1:";function vf(e,t){return`${e}${encodeURIComponent(t)}`}function _f(){try{return typeof window>"u"?null:window.localStorage}catch{return null}}function dx(e){var t;try{const n=(t=_f())==null?void 0:t.getItem(vf(j2,e));if(!n)return null;const r=JSON.parse(n);return"value"in r?{value:r.value,schemaSignature:typeof r.schemaSignature=="string"?r.schemaSignature:null}:null}catch{return null}}function l6(e,t,n){var r;try{(r=_f())==null||r.setItem(vf(j2,e),JSON.stringify({value:t,schemaSignature:n}))}catch{}}function hx(e){var t;try{return((t=_f())==null?void 0:t.getItem(vf(R2,e)))==="prod"?"prod":"local"}catch{return"local"}}function c6(e,t){var n;try{(n=_f())==null||n.setItem(vf(R2,e),t)}catch{}}function u6(e){const t=n=>Array.isArray(n)?n.map(t):n&&typeof n=="object"?Object.fromEntries(Object.entries(n).sort(([r],[o])=>r.localeCompare(o)).map(([r,o])=>[r,t(o)])):n;return JSON.stringify(t(e))}function d6(e){return Array.isArray(e.examples)&&e.examples.length>0?e.examples[0]:Object.prototype.hasOwnProperty.call(e,"example")?e.example:void 0}function A2(e){if(Object.prototype.hasOwnProperty.call(e,"default"))return e.default;if(e.type==="object"){const t=e.properties??{},n={};for(const[r,o]of Object.entries(t)){const c=A2(o);c!==void 0&&(n[r]=c)}return Object.keys(n).length>0?n:void 0}}function _v(e){if(Array.isArray(e.enum)&&e.enum.length>0)return e.enum[0];switch(e.type){case"string":return"";case"number":case"integer":return 0;case"boolean":return!1;case"array":return[];case"object":return T2(e);default:return null}}function T2(e){if(e.type!=="object")return _v(e);const t=Array.isArray(e.required)?e.required.filter(r=>typeof r=="string"):[],n=e.properties??{};return Object.fromEntries(t.map(r=>[r,_v(n[r]??{})]))}function wh(e){const t=Object.prototype.hasOwnProperty.call(e,"default");if(e.type!=="object")return t?e.default:void 0;if(t&&(!e.default||typeof e.default!="object"||Array.isArray(e.default)))return e.default;const n=e.properties??{},r=new Set(Array.isArray(e.required)?e.required.filter(c=>typeof c=="string"):[]),o=t?{...e.default}:{};for(const[c,h]of Object.entries(n)){if(Object.prototype.hasOwnProperty.call(o,c)){const u=o[c];h.type==="object"&&u!==null&&typeof u=="object"&&!Array.isArray(u)&&(o[c]=wh({...h,default:u}));continue}A2(h)!==void 0?o[c]=wh(h):r.has(c)&&(o[c]=wh(h)??_v(h))}return Object.keys(o).length>0?o:void 0}function Ko(e){const t=d6(e);if(t!==void 0)return t;const n=wh(e);return n!==void 0?n:T2(e)}function h6(e){const t=e.nodes.find(n=>n.id===e.entry);return t?t.inputSchema?{status:"available",jsonSchema:t.inputSchema,example:Ko(t.inputSchema)}:{status:"none",jsonSchema:null,example:{}}:null}function f6(e){const n=new o6({allErrors:!0,strict:!1}).compile(e);return{validate:n,validateValue(r){return n(r)?[]:[...n.errors??[]]}}}function N2(e){if(e.keyword==="required"){const t=e.params.missingProperty;if(typeof t=="string")return`${e.instancePath}/${t}`}return e.instancePath||"/"}function Fo(e){return`${N2(e).split("/").filter(Boolean).map(n=>n.replaceAll("~1","/").replaceAll("~0","~")).join(" → ")||"Input"} ${e.message??"is invalid"}`}function Pc(e,t,n){const r={event:e,...t?{data:t}:{}};fetch("/api/track",{method:"POST",headers:{"Content-Type":"application/json","X-Harness-Token":Vo()},body:JSON.stringify(r),keepalive:!0}).catch(()=>{})}const p6=[{id:"local",label:"Local",description:"Agent code runs here with Sapiom calls stubbed",icon:"SquareTerminal"},{id:"prod",label:"Cloud",description:"Run the deployed agent with real capabilities",icon:"Cloud"}];function m6({open:e,anchorRef:t,selected:n,cloudDisabledReason:r,onDismiss:o,onSelect:c}){return d.jsx(Ci,{open:e,anchorRef:t,onDismiss:o,placement:"down-end",className:"canvas-run-menu session-run-menu",role:"menu",testid:"session-run-target-menu",children:p6.map(h=>{const l=h.id==="prod"?r:null,u=n===h.id;return d.jsxs("button",{className:"run-target-option","data-selected":u||void 0,"data-testid":h.id==="prod"?"session-step-run":"run-target-local",type:"button",role:"menuitemradio","aria-checked":u,disabled:!!l,title:l??void 0,"aria-label":l?`${h.label}: ${l}`:h.label,"data-tooltip":l??void 0,onClick:()=>c(h.id),children:[d.jsx(de,{name:h.icon,size:15}),d.jsxs("span",{className:"run-target-copy",children:[d.jsx("strong",{children:h.label}),d.jsx("small",{children:l??h.description})]}),d.jsx("span",{className:"run-target-check","aria-hidden":"true",children:u&&d.jsx(de,{name:"Check",size:13})})]},h.id)})})}function g6({workflow:e,activeSessionId:t,sessionReady:n,macros:r,onRunMacro:o,onRequestRun:c,preview:h,lastDeployError:l,authenticated:u,directActionSettleSeq:m,runningTarget:g}){const p=F=>r.find(Y=>Y.id===F),S=za(e,l),x=S==="ready",[A,E]=O.useState(null),[y,b]=O.useState(!1),[v,_]=O.useState(()=>hx(e.path)),k=O.useRef(null),C=O.useRef(null);O.useEffect(()=>{E(null)},[e.path,S,l,m]),O.useEffect(()=>{_(hx(e.path))},[e.path]);const w=[{id:"deploy",label:"Deploy",icon:"CloudUpload",macro:p("deploy"),testId:"session-step-deploy",hint:"Deploy: push and build on Sapiom.",needsAuth:!0,primary:!x}].filter(F=>F.macro),T=F=>$D(F,{subject:e,authenticated:u,deployError:l}).reason,j=T("prod"),M=T("run"),D=v==="prod"&&M?"local":v,L=D==="local"?"Local":"Cloud",q=F=>{F==="prod"&&M||(_(F),c6(e.path,F),b(!1),c(F,C.current))};return d.jsxs("div",{className:"session-actions","data-testid":"session-steps","aria-label":"Agent actions",...Ot({surface:"agent_actions"}),children:[h&&d.jsxs("a",{className:"status-tag status-tag-action session-preview-chip","data-testid":"session-preview-chip",href:h.url,target:"_blank",rel:"noreferrer","aria-label":`Preview :${h.port}`,"data-tooltip":`The coding agent is serving an app on port ${h.port}. Opens ${h.url}`,children:[d.jsx(de,{name:"ExternalLink",size:12}),d.jsx("span",{className:"session-preview-label",children:"Preview "}),":",h.port]}),j?d.jsx("button",{className:"session-step session-action-prod","data-testid":"session-step-prod",type:"button",disabled:!0,"aria-label":`Prod: ${j}`,"data-tooltip":`Prod: ${j}`,children:d.jsx(de,{name:"Globe",size:14})}):d.jsx("a",{className:"session-step session-action-prod","data-testid":"session-step-prod",href:of(e.definitionId??0),target:"_blank",rel:"noreferrer","aria-label":`Open ${e.name} in the Sapiom dashboard`,"data-tooltip":"Open this linked agent in the Sapiom dashboard",children:d.jsx(de,{name:"Globe",size:14})}),d.jsxs("div",{className:"session-run-split","data-running":g===D||void 0,children:[d.jsxs("button",{ref:C,className:"session-step session-run-main"+(x?" session-action-primary":""),"data-testid":"session-step-local",type:"button",onClick:()=>c(D,C.current),"aria-label":`Run using ${L}`,"data-tooltip":`Review input and run using ${L}`,children:[d.jsx(de,{name:"Play",size:14}),d.jsxs("span",{className:"session-step-label",children:["Run · ",L]})]}),d.jsx("button",{ref:k,className:"session-step session-run-menu-trigger"+(x?" session-action-primary":""),type:"button","aria-label":"Choose run target","aria-haspopup":"menu","aria-expanded":y,onClick:()=>b(F=>!F),children:d.jsx(de,{name:"ChevronDown",size:13})}),d.jsx(m6,{open:y,anchorRef:k,onDismiss:()=>b(!1),selected:v,cloudDisabledReason:M,onSelect:q})]}),w.map(F=>{const Y=F.needsAuth?T("deploy"):null,Q=F.needsDeploy?M:null,G=!n&&F.macro&&jD(F.macro)?"Session is starting":null,ee=Y??Q??G??(F.macro?RD(F.macro,e,t):null);return d.jsxs("button",{className:"session-step"+(F.primary?" session-action-primary":""),"data-testid":F.testId,"data-pending":A===F.id||void 0,"data-running":void 0,disabled:!!ee,"data-tooltip":ee?`${F.label}: ${ee}`:F.hint,"aria-label":ee?`${F.label}: ${ee}`:F.label,onClick:()=>{F.macro&&(o(F.macro),E(F.id),Pc("macro.invoked",{macroId:F.macro.id}))},children:[d.jsx(de,{name:F.icon,size:14}),d.jsx("span",{className:"session-step-label",children:F.label})]},F.id)})]})}function M2(e,t){const n=String(t).replaceAll("~","~0").replaceAll("/","~1");return`${e}/${n}`}function $2(e,t){return e.filter(n=>N2(n)===(t||"/"))}function yv(e,t){return typeof e.title=="string"&&e.title.trim()?e.title:t??"Value"}function v6(e){return typeof e.description=="string"&&e.description.trim()?e.description:null}function _6(e){if(e.$ref||e.anyOf||e.oneOf||e.allOf)return!1;if(Array.isArray(e.enum))return!0;if(e.type==="array"){const t=e.items;return!!(t&&typeof t=="object"&&y6(t))}return["object","string","number","integer","boolean"].includes(String(e.type))}function y6(e){return e.$ref||e.anyOf||e.oneOf||e.allOf?!1:Array.isArray(e.enum)?!0:["string","number","integer","boolean"].includes(String(e.type))}function fx(e){return JSON.stringify(e??null,null,2)}function px({value:e,onChange:t,label:n,description:r}){const o=O.useId(),c=r?`${o}-description`:void 0,h=fx(e),l=O.useRef(h),[u,m]=O.useState(h),[g,p]=O.useState(null),S=g?`${o}-error`:void 0;return O.useEffect(()=>{h!==l.current&&(l.current=h,m(h),p(null))},[h]),d.jsxs("div",{className:"schema-field schema-json-field",children:[d.jsx("label",{htmlFor:o,children:n}),r&&d.jsx("p",{id:c,children:r}),d.jsx("textarea",{id:o,value:u,rows:5,spellCheck:!1,"aria-invalid":!!g,"aria-describedby":[c,S].filter(Boolean).join(" ")||void 0,onChange:x=>{const A=x.target.value;m(A);try{const E=JSON.parse(A);p(null),l.current=fx(E),t(E)}catch(E){p(E instanceof Error?E.message:"Enter valid JSON.")}}}),g&&d.jsx("span",{id:S,className:"schema-field-error",children:g})]})}function D2({schema:e,value:t,onChange:n,id:r,ariaLabel:o,describedBy:c,invalid:h=!1,required:l=!1}){if(Array.isArray(e.enum))return d.jsxs("select",{id:r,"aria-label":o,"aria-describedby":c,"aria-invalid":h,required:l,value:t===void 0?"":JSON.stringify(t),onChange:m=>n(m.target.value===""?void 0:JSON.parse(m.target.value)),children:[d.jsx("option",{value:"",children:"Select…"}),e.enum.map((m,g)=>d.jsx("option",{value:JSON.stringify(m),children:String(m)},g))]});if(e.type==="boolean")return d.jsxs("select",{id:r,"aria-label":o,"aria-describedby":c,"aria-invalid":h,required:l,value:t===!0?"true":t===!1?"false":"",onChange:m=>n(m.target.value===""?void 0:m.target.value==="true"),children:[d.jsx("option",{value:"",children:"Not set"}),d.jsx("option",{value:"true",children:"True"}),d.jsx("option",{value:"false",children:"False"})]});const u=e.type==="number"||e.type==="integer";return d.jsx("input",{id:r,type:u?"number":"text",step:e.type==="integer"?1:"any",min:typeof e.minimum=="number"?e.minimum:void 0,max:typeof e.maximum=="number"?e.maximum:void 0,minLength:!u&&typeof e.minLength=="number"?e.minLength:void 0,maxLength:!u&&typeof e.maxLength=="number"?e.maxLength:void 0,pattern:!u&&typeof e.pattern=="string"?e.pattern:void 0,"aria-label":o,"aria-describedby":c,"aria-invalid":h,required:l,value:typeof t=="string"||typeof t=="number"?t:"",placeholder:typeof e.placeholder=="string"?e.placeholder:void 0,onChange:m=>{const g=m.target.value;n(u?g===""?void 0:Number(g):g)}})}function b6({schema:e,value:t,onChange:n,errors:r,path:o,label:c}){const h=O.useId(),l=e.items,u=Array.isArray(t)?t:[],m=typeof e.minItems=="number"?e.minItems:0,g=typeof e.maxItems=="number"?e.maxItems:Number.POSITIVE_INFINITY,p=c??yv(e);return d.jsxs("div",{className:"schema-array",children:[u.map((S,x)=>{const A=M2(o??"",x),E=`${h}-${x}`,y=$2(r,A),b=y.length>0?`${E}-errors`:void 0;return d.jsxs("div",{className:"schema-array-row",children:[d.jsx(D2,{schema:l,value:S,onChange:v=>{const _=[...u];_[x]=v,n(_)},id:E,ariaLabel:`${p} item ${x+1}`,describedBy:b,invalid:y.length>0}),d.jsx("button",{type:"button",className:"theme-toggle","aria-label":`Remove item ${x+1}`,disabled:u.length<=m,onClick:()=>n(u.filter((v,_)=>_!==x)),children:d.jsx(de,{name:"X",size:13})}),y.length>0&&d.jsx("div",{id:b,className:"schema-field-errors",children:y.map((v,_)=>d.jsx("span",{className:"schema-field-error",children:Fo(v)},_))})]},x)}),d.jsxs("button",{type:"button",className:"btn-ghost schema-array-add",disabled:u.length>=g,onClick:()=>n([...u,Ko(l)]),children:[d.jsx(de,{name:"Plus",size:13})," Add item"]})]})}function O2({schema:e,value:t,onChange:n,errors:r,path:o="",label:c,required:h=!0}){const l=O.useId(),u=yv(e,c),m=v6(e),g=$2(r,o);if(!_6(e))return d.jsx(px,{value:t,onChange:n,label:u,description:m});if(e.type==="object"){const x=t&&typeof t=="object"&&!Array.isArray(t)?t:{},A=e.properties??{},E=new Set(Array.isArray(e.required)?e.required.filter(k=>typeof k=="string"):[]),y=Object.fromEntries(Object.entries(x).filter(([k])=>!(k in A))),b=d.jsxs("div",{className:"schema-object-fields",children:[Object.entries(A).map(([k,C])=>{const w=M2(o,k),T=E.has(k),j=Object.prototype.hasOwnProperty.call(x,k);return d.jsxs("div",{className:"schema-property",children:[!T&&d.jsxs("label",{className:"schema-optional-toggle",children:[d.jsx("input",{type:"checkbox",checked:j,onChange:M=>{const D={...x};M.target.checked?D[k]=Ko(C):delete D[k],n(D)}}),"Include ",yv(C,k)]}),(T||j)&&d.jsx(O2,{schema:C,value:x[k],onChange:M=>n({...x,[k]:M}),errors:r,path:w,label:k,required:T})]},k)}),Object.keys(y).length>0&&d.jsx(px,{value:y,label:"Additional fields",description:"These values are not present in the current contract.",onChange:k=>{const C=k&&typeof k=="object"&&!Array.isArray(k)?k:{};n({...Object.fromEntries(Object.entries(x).filter(([w])=>w in A)),...C})}})]});if(o===""){const k=g.length>0?`${l}-errors`:void 0;return d.jsxs("div",{"aria-describedby":k,children:[m&&d.jsx("p",{children:m}),b,g.length>0&&d.jsx("div",{id:k,className:"schema-field-errors",children:g.map((C,w)=>d.jsx("span",{className:"schema-field-error",children:Fo(C)},w))})]})}const v=m?`${l}-description`:void 0,_=g.length>0?`${l}-errors`:void 0;return d.jsxs("fieldset",{className:"schema-object","aria-describedby":[v,_].filter(Boolean).join(" ")||void 0,children:[d.jsxs("legend",{children:[u,h&&d.jsx("span",{"aria-label":"required",children:" *"})]}),m&&d.jsx("p",{id:v,children:m}),b,g.length>0&&d.jsx("div",{id:_,className:"schema-field-errors",children:g.map((k,C)=>d.jsx("span",{className:"schema-field-error",children:Fo(k)},C))})]})}const p=m?`${l}-description`:void 0,S=g.length>0?`${l}-errors`:void 0;return e.type==="array"?d.jsxs("fieldset",{className:"schema-field schema-array-field","aria-describedby":[p,S].filter(Boolean).join(" ")||void 0,children:[d.jsxs("legend",{children:[u,h&&d.jsx("span",{"aria-label":"required",children:" *"})]}),m&&d.jsx("p",{id:p,children:m}),d.jsx(b6,{schema:e,value:t,onChange:n,errors:r,path:o,label:u}),g.length>0&&d.jsx("div",{id:S,className:"schema-field-errors",children:g.map((x,A)=>d.jsx("span",{className:"schema-field-error",children:Fo(x)},A))})]}):d.jsxs("div",{className:"schema-field",children:[d.jsxs("label",{htmlFor:l,children:[u,h&&d.jsx("span",{"aria-label":"required",children:" *"})]}),m&&d.jsx("p",{id:p,children:m}),d.jsx(D2,{schema:e,value:t,onChange:n,id:l,describedBy:[p,S].filter(Boolean).join(" ")||void 0,invalid:g.length>0,required:h}),g.length>0&&d.jsx("div",{id:S,className:"schema-field-errors",children:g.map((x,A)=>d.jsx("span",{className:"schema-field-error",children:Fo(x)},A))})]})}function sh(e){return JSON.stringify(e??{},null,2)}function S6({workflow:e,target:t,loadContract:n,onClose:r,returnFocus:o,onRun:c}){const h=O.useRef(null),l=O.useRef(null),u=O.useRef(null),m=O.useRef(null),[g,p]=O.useState(null),[S,x]=O.useState({}),[A,E]=O.useState("{}"),[y,b]=O.useState(null),[v,_]=O.useState([]),[k,C]=O.useState(null),[w,T]=O.useState("form"),[j,M]=O.useState(!1);Ua(!0,{onDismiss:r,containerRef:h}),O.useEffect(()=>()=>{o==null||o.focus()},[o]),O.useEffect(()=>{let Q=!0;return p(null),b(null),n(e.path).then(G=>{if(!Q)return;p(G);const ee=dx(e.path);let ne=(ee==null?void 0:ee.value)??G.example,z=null,B=[];if(G.status==="available"){ne=(ee==null?void 0:ee.value)??Ko(G.jsonSchema);try{z=f6(G.jsonSchema),B=z.validateValue(ne)}catch{T("json"),b("This contract uses a schema branch Studio cannot render. Edit the complete JSON input instead.")}}else T("json");C(z),x(ne),_(B),M(!!(ee&&B.length>0)),E(sh(ne)),requestAnimationFrame(()=>{var $,H;return(H=l.current??(($=h.current)==null?void 0:$.querySelector("input, select, textarea")))==null?void 0:H.focus()})}).catch(()=>{if(!Q)return;p({status:"unavailable",jsonSchema:null,example:{},reason:"Studio couldn't load this agent's input contract. You can still run it with raw JSON."});const G=dx(e.path),ee=(G==null?void 0:G.value)??{};x(ee),E(sh(ee)),T("json"),b(null),requestAnimationFrame(()=>{var ne;return(ne=l.current)==null?void 0:ne.focus()})}),()=>{Q=!1}},[n,e.path]);const D=()=>{var ne;if(!g)return;let Q=S;if(w==="json")try{Q=JSON.parse(A)}catch(z){b(z instanceof Error?z.message:"Enter valid JSON."),(ne=l.current)==null||ne.focus();return}const G=(k==null?void 0:k.validateValue(Q))??[];if(_(G),G.length>0){b("Fix the highlighted input before running.");return}const ee=g.status==="available"?u6(g.jsonSchema):null;l6(e.path,Q,ee),b(null),c(Q)},L=Q=>{x(Q),E(sh(Q));const G=(k==null?void 0:k.validateValue(Q))??[];_(G),G.length===0&&(b(null),M(!1))},q=Q=>{if(Q===w)return!0;if(Q==="form")try{const G=JSON.parse(A);x(G),_((k==null?void 0:k.validateValue(G))??[]),b(null)}catch(G){return b(G instanceof Error?G.message:"Enter valid JSON."),!1}else E(sh(S)),b(null);return T(Q),!0},F=(g==null?void 0:g.status)==="available"&&k!==null,Y=Q=>{var ee;if(!["ArrowLeft","ArrowRight","Home","End"].includes(Q.key))return;Q.preventDefault();const G=Q.key==="Home"?"form":Q.key==="End"||w==="form"?"json":"form";q(G)&&((ee=(G==="form"?u:m).current)==null||ee.focus())};return d.jsx("div",{className:"modal-backdrop run-sheet-backdrop",children:d.jsxs("div",{className:"modal run-sheet",role:"dialog","aria-modal":"true","aria-labelledby":"run-sheet-title",ref:h,onKeyDown:Q=>{var G;if(Q.key==="Tab"){const ee=Array.from(((G=h.current)==null?void 0:G.querySelectorAll("button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), a[href]"))??[]).filter(B=>B.offsetParent!==null),ne=ee[0],z=ee[ee.length-1];ne&&z&&Q.shiftKey&&document.activeElement===ne?(Q.preventDefault(),z.focus()):ne&&z&&!Q.shiftKey&&document.activeElement===z&&(Q.preventDefault(),ne.focus())}Q.key==="Enter"&&(Q.metaKey||Q.ctrlKey)&&(Q.preventDefault(),D())},children:[d.jsxs("header",{className:"run-sheet-header",children:[d.jsxs("div",{children:[d.jsx("div",{className:"run-sheet-kicker",children:t==="local"?"Local execution":"Cloud execution"}),d.jsxs("h2",{id:"run-sheet-title",children:["Run ",e.name]}),d.jsx("p",{children:"Review the agent input, then follow the execution live in Steps."})]}),d.jsx("button",{className:"theme-toggle modal-close",type:"button","aria-label":"Close run dialog",onClick:r,children:d.jsx(de,{name:"X",size:14})})]}),d.jsxs("div",{className:"run-sheet-body",children:[d.jsxs("div",{className:"run-sheet-field-head",children:[d.jsx("h3",{id:"run-sheet-input-heading",children:"Input"}),F?d.jsxs("div",{className:"run-input-mode",role:"tablist","aria-label":"Input editor mode",children:[d.jsx("button",{ref:u,id:"run-sheet-fields-tab",type:"button",role:"tab","aria-controls":"run-sheet-input-panel","aria-selected":w==="form",tabIndex:w==="form"?0:-1,onClick:()=>q("form"),onKeyDown:Y,children:"Fields"}),d.jsx("button",{ref:m,id:"run-sheet-json-tab",type:"button",role:"tab","aria-controls":"run-sheet-input-panel","aria-selected":w==="json",tabIndex:w==="json"?0:-1,onClick:()=>q("json"),onKeyDown:Y,children:"JSON"})]}):d.jsx("span",{children:"JSON"})]}),d.jsxs("div",{id:"run-sheet-input-panel",role:F?"tabpanel":void 0,"aria-labelledby":F?w==="form"?"run-sheet-fields-tab":"run-sheet-json-tab":"run-sheet-input-heading",children:[g?d.jsxs(d.Fragment,{children:[g.status==="none"&&d.jsx("p",{className:"run-sheet-notice",children:"This agent declares no input contract. Pass an object or any JSON value it accepts."}),g.status==="unavailable"&&d.jsx("p",{className:"run-sheet-notice","data-tone":"warning",children:g.reason}),j&&d.jsxs("div",{className:"run-sheet-stale",role:"status",children:[d.jsx("span",{children:"The saved input no longer matches this agent's contract. Your values are still here so you can repair them."}),d.jsx("button",{type:"button",className:"btn-ghost",onClick:()=>{g.status==="available"&&L(Ko(g.jsonSchema))},children:"Reset to defaults"})]}),w==="form"&&g.status==="available"&&k?d.jsxs("div",{className:"run-schema-form",role:"group","aria-labelledby":"run-sheet-input-heading",children:[d.jsx(O2,{schema:g.jsonSchema,value:S,onChange:L,errors:v}),!j&&d.jsx("button",{type:"button",className:"btn-ghost run-sheet-reset",onClick:()=>L(Ko(g.jsonSchema)),children:"Reset to defaults"})]}):d.jsx("textarea",{id:"run-sheet-json",ref:l,className:"run-sheet-editor",value:A,onChange:Q=>{E(Q.target.value),b(null)},rows:12,spellCheck:!1,"aria-labelledby":"run-sheet-input-heading","aria-invalid":!!(y||v.length),"aria-describedby":[y?"run-sheet-error":null,v.length>0?"run-sheet-validation":null].filter(Boolean).join(" ")||void 0})]}):d.jsx("div",{className:"run-sheet-loading",role:"status",children:"Loading input contract…"}),w==="json"&&v.length>0&&d.jsx("ul",{id:"run-sheet-validation",className:"run-sheet-validation-list",children:v.map((Q,G)=>d.jsx("li",{children:Fo(Q)},G))}),y&&d.jsx("div",{id:"run-sheet-error",className:"modal-error",role:"alert",children:y})]})]}),d.jsxs("footer",{className:"run-sheet-actions",children:[d.jsx("span",{className:"run-sheet-shortcut",children:"⌘/Ctrl + Enter"}),d.jsx("button",{className:"btn-ghost",type:"button",onClick:r,children:"Cancel"}),d.jsxs("button",{className:"btn-primary",type:"button",disabled:!g,onClick:D,"data-testid":"run-sheet-submit",children:[d.jsx(de,{name:"Play",size:14}),"Run ",t==="local"?"locally":"in cloud"]})]})]})})}function w6({onDismiss:e,onOpenSettings:t}){return d.jsxs("div",{className:"telemetry-notice",role:"status","data-testid":"telemetry-notice",children:[d.jsx("div",{className:"telemetry-notice-body",children:d.jsxs("p",{className:"telemetry-notice-text",children:["Sharing session details with Sapiom is ",d.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"," ",d.jsx("button",{className:"telemetry-notice-settings-link",onClick:()=>{t(),e()},children:"Settings"}),", or use the indicator in the top bar."]})}),d.jsx("button",{className:"telemetry-notice-dismiss","aria-label":"Dismiss analytics notice","data-testid":"telemetry-notice-dismiss",onClick:e,children:"×"})]})}const Yo="(none)",mx={query:"",category:null,cadence:null};function x6(e){return e.query.trim()!==""||e.category!==null||e.cadence!==null}const C6={"on-demand":"On demand",scheduled:"Scheduled","on-event":"On event","on-webhook":"Webhook"};function L2(e){return e?C6[e]??e.replace(/-/g," ").replace(/^./,t=>t.toUpperCase()):"No trigger declared"}function I2(e,t,n){const r=new Map;for(const o of e){const c=t(o)??Yo;r.set(c,(r.get(c)??0)+1)}return[...r.entries()].map(([o,c])=>({value:o,label:n(o),count:c})).sort((o,c)=>o.value===Yo?1:c.value===Yo?-1:c.count-o.count||o.label.localeCompare(c.label))}function E6(e){return I2(e,t=>t.category,t=>t===Yo?"Uncategorised":X$(t))}function k6(e){return I2(e,t=>t.cadence,t=>t===Yo?"No trigger declared":L2(t))}function gx(e,t){return t===null?!0:t===Yo?e===null:e===t}function j6(e,t,n){return e.filter(r=>n(r,t.query)&&gx(r.category,t.category)&&gx(r.cadence,t.cadence))}function xh({children:e,variant:t="tag",title:n}){return d.jsx("span",{className:t==="count"?"pill pill--count":"pill",title:n,children:e})}const vx=3;function R6({template:e,onPreview:t,onUse:n}){const[r,o]=O.useState(!1),c=O.useRef(null),h=[{term:"Steps",value:String(e.stepCount)},{term:"Trigger",value:e.cadence?L2(e.cadence):"Not declared"},{term:"Complexity",value:n_(e.complexity),...e.complexity?{title:J$(e.complexity)}:{title:"This catalog response carried no complexity band."}},{term:"Capabilities",value:e.capabilities.length>0?String(e.capabilities.length):"None"}];return d.jsxs(d.Fragment,{children:[d.jsx("button",{ref:c,type:"button",className:"theme-toggle template-card-info","data-testid":`template-card-info-${e.id}`,"aria-label":`What ${e.name} runs and costs`,"aria-expanded":r,onClick:()=>o(l=>!l),children:d.jsx(de,{name:"Info",size:14})}),d.jsxs(Ci,{open:r,anchorRef:c,onDismiss:()=>o(!1),placement:"down-end",className:"template-facts",testid:"template-facts",children:[d.jsx("dl",{className:"template-fact-list",children:h.map(l=>d.jsxs("div",{className:"template-fact",children:[d.jsx("dt",{children:l.term}),d.jsx("dd",{title:l.title,children:l.value})]},l.term))}),d.jsxs("div",{className:"template-fact-actions",children:[d.jsx("button",{type:"button",className:"btn-line","data-testid":`template-facts-preview-${e.id}`,onClick:()=>{o(!1),t(e)},children:"Preview"}),d.jsx("button",{type:"button",className:"btn-primary","data-testid":`template-facts-use-${e.id}`,onClick:()=>{o(!1),n(e)},children:"Use"})]})]})]})}function _x({template:e,onOpen:t,onUse:n}){const r=e.kind==="gallery"?e.tags.slice(0,vx):[],o=e.kind==="gallery"?e.tags.length-r.length:0;return d.jsxs("article",{className:"template-card","data-testid":`template-card-${e.id}`,children:[d.jsx("button",{type:"button",className:"template-card-hitbox","data-testid":`template-card-open-${e.id}`,onClick:()=>t(e),children:d.jsxs("span",{className:"visually-hidden",children:["Open ",e.name]})}),d.jsxs("div",{className:"template-card-header",children:[d.jsx("h3",{className:"template-card-name",children:e.name}),e.kind==="gallery"&&d.jsx(R6,{template:e,onPreview:t,onUse:n})]}),d.jsx("p",{className:"template-card-desc","data-testid":"template-card-desc",children:e.description}),e.kind==="starter"?d.jsx("div",{className:"template-card-tags",children:d.jsx(xh,{children:"bundled"})}):r.length>0&&d.jsxs("div",{className:"template-card-tags",children:[r.map(c=>d.jsx(xh,{children:c},c)),o>0&&d.jsxs(xh,{variant:"count",title:e.tags.slice(vx).join(", "),children:["+",o]})]})]})}function A6({detail:e}){const t=eD(e);return d.jsx("div",{className:"template-graph","data-testid":"template-graph",children:t.nodes.map(n=>{const r=t.edges.filter(o=>o.from===n.id);return d.jsxs("div",{className:"template-graph-item","data-testid":`template-graph-node-${n.id}`,children:[d.jsxs("div",{className:"template-graph-node",children:[d.jsx("span",{className:"canvas-step-dot dot--"+n.kind,"aria-hidden":"true"}),d.jsx("span",{className:"template-graph-name",children:n.label}),n.kind==="terminal-success"&&d.jsx("span",{className:"template-step-exit",children:"exit"}),n.kind==="terminal-warn"&&d.jsx("span",{className:"template-step-exit template-step-exit--warn",children:"fails out"}),n.kind==="pause"&&d.jsx("span",{className:"template-step-pause",children:"pause"}),n.capabilities.map(o=>d.jsx("code",{className:"template-cap",children:o},o))]}),r.map(o=>d.jsxs("div",{className:"canvas-step-transition template-graph-edge",children:[d.jsx(de,{name:"CornerDownRight",size:12}),d.jsx("span",{className:"canvas-step-transition-target",children:o.to}),o.label&&d.jsx("span",{className:"canvas-step-transition-label",children:o.label})]},`${o.from}->${o.to}`))]},n.id)})})}function T6({example:e,index:t}){return d.jsxs("details",{className:"template-example",children:[d.jsx("summary",{className:"template-example-summary",children:e.title??`Example ${t+1}`}),d.jsxs("div",{className:"template-example-body",children:[d.jsx("span",{className:"template-example-label",children:"Input"}),d.jsx("pre",{className:"template-example-json",children:JSON.stringify(e.input,null,2)}),e.output!==null&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"template-example-label",children:"Output"}),d.jsx("pre",{className:"template-example-json",children:JSON.stringify(e.output,null,2)})]})]})]})}function N6({detail:e}){return d.jsxs(d.Fragment,{children:[e.whatItDoes&&d.jsx("p",{className:"template-lead",children:e.whatItDoes}),e.steps.length>0&&d.jsxs("section",{className:"template-section",children:[d.jsx("h4",{className:"template-section-title",children:"Steps"}),d.jsx(A6,{detail:e}),d.jsx("ol",{className:"template-steps",children:e.steps.map((t,n)=>d.jsxs("li",{className:"template-step",children:[d.jsx("span",{className:"template-step-index","aria-hidden":"true",children:n+1}),d.jsxs("span",{className:"template-step-copy",children:[d.jsxs("span",{className:"template-step-name",children:[t.name,d.jsx("span",{className:"template-step-role",children:t.sublabel})]}),t.description&&d.jsx("span",{className:"template-step-desc",children:t.description})]}),t.capabilities.map(r=>d.jsx("code",{className:"template-cap",children:r},r))]},t.name))})]}),d.jsxs("section",{className:"template-section",children:[d.jsx("h4",{className:"template-section-title",children:"Capabilities and complexity"}),e.capabilities.length>0?d.jsx("div",{className:"template-caps",children:e.capabilities.map(t=>d.jsx("code",{className:"template-cap",children:t},t))}):d.jsx("p",{className:"template-note","data-testid":"template-caps-none",children:"Declares no metered capabilities."}),d.jsx("p",{className:"template-note","data-testid":"template-complexity-note",children:e.complexity?d.jsxs(d.Fragment,{children:[d.jsx("strong",{children:n_(e.complexity)})," —"," ",c2(e.complexity),". A rough estimate of how involved this template is, not a price. Local test runs stub every capability and are free."]}):d.jsx(d.Fragment,{children:"This catalog response carried no complexity band, so none is shown. Local test runs stub every capability and are free."})})]}),e.requiredSecrets.length>0&&d.jsxs("section",{className:"template-section",children:[d.jsx("h4",{className:"template-section-title",children:"Credentials you supply"}),d.jsx("ul",{className:"template-usecases",children:e.requiredSecrets.map(t=>d.jsxs("li",{children:[d.jsx("code",{className:"template-cap",children:t.key})," ",t.label,t.description&&d.jsxs(d.Fragment,{children:[" — ",t.description]})]},t.key))})]}),e.useCases.length>0&&d.jsxs("section",{className:"template-section",children:[d.jsx("h4",{className:"template-section-title",children:"Use cases"}),d.jsx("ul",{className:"template-usecases",children:e.useCases.map(t=>d.jsx("li",{children:t},t))})]}),e.examples.length>0&&d.jsxs("section",{className:"template-section",children:[d.jsx("h4",{className:"template-section-title",children:"Examples"}),e.examples.map((t,n)=>d.jsx(T6,{example:t,index:n},t.title??n))]}),e.notes&&d.jsxs("section",{className:"template-section",children:[d.jsx("h4",{className:"template-section-title",children:"Notes"}),d.jsx("div",{className:"template-notes",children:d.jsx(f2,{text:e.notes})})]})]})}function M6({template:e,getTemplate:t}){const[n,r]=O.useState(null),[o,c]=O.useState(null);return O.useEffect(()=>{if(e.kind!=="gallery"){r(null),c(null);return}let h=!1;return r(null),c(null),t(e.id).then(l=>{h||r(l)}).catch(l=>{h||c(l instanceof Error?l.message:String(l))}),()=>{h=!0}},[e.kind,e.id,t]),d.jsxs("div",{className:"template-detail","data-testid":"template-detail",...Ot({surface:"template_detail",object:"template"}),children:[d.jsxs("div",{className:"template-detail-head",children:[d.jsx("h3",{className:"template-detail-name",children:e.name}),d.jsx("div",{className:"template-tags",children:(e.kind==="gallery"?e.tags:["bundled"]).map(h=>d.jsx("span",{className:"template-tag",children:h},h))})]}),e.kind==="gallery"?d.jsxs(d.Fragment,{children:[(n==null?void 0:n.author)&&d.jsxs("span",{className:"template-byline",children:["By"," ",n.author.url?d.jsx("a",{href:n.author.url,target:"_blank",rel:"noopener noreferrer",children:n.author.name}):n.author.name]}),!n&&!o&&d.jsx("p",{className:"template-lead",children:e.description}),o&&d.jsxs("p",{className:"template-note","data-testid":"template-detail-error",children:["Could not load this template’s details: ",o]}),n&&d.jsx(N6,{detail:n})]}):d.jsxs(d.Fragment,{children:[d.jsx("p",{className:"template-lead",children:e.description}),d.jsx("p",{className:"template-note",children:"Scaffolds an npm-install-ready TypeScript project with a starter agent in index.ts."})]}),d.jsx("p",{className:"template-handoff","data-testid":"template-handoff",children:e.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 yx({title:e,allLabel:t,allCount:n,options:r,value:o,onSelect:c,testIdPrefix:h}){if(r.length<2)return null;const l=[{value:"",label:t,count:n,testId:`${h}-all`,selects:null},...r.map(u=>({...u,testId:`${h}-${u.value}`,selects:u.value}))];return d.jsxs("div",{className:"facet",children:[d.jsx("span",{className:"facet-title",children:e}),d.jsx("div",{className:"facet-rows",role:"radiogroup","aria-label":e,children:l.map(u=>{const m=o===u.selects;return d.jsxs("button",{type:"button",role:"radio","aria-checked":m,className:m?"facet-row is-active":"facet-row","data-testid":u.testId,onClick:()=>c(u.selects),children:[d.jsx("span",{className:"facet-row-label",children:u.label}),d.jsx(xh,{variant:"count",children:u.count})]},u.testId)})})]})}function $6({catalog:e,filter:t,onChange:n}){return d.jsxs("div",{className:"template-filters","data-testid":"template-filters",children:[d.jsxs("div",{className:"template-search",children:[d.jsx(de,{name:"Search",size:14}),d.jsx("input",{className:"template-search-input",type:"search",value:t.query,placeholder:"Search templates","aria-label":"Search templates","data-testid":"template-search",onChange:r=>n({...t,query:r.target.value})})]}),d.jsx(yx,{title:"Category",allLabel:"All templates",allCount:e.length,options:E6(e),value:t.category,onSelect:r=>n({...t,category:r}),testIdPrefix:"templates-category"}),d.jsx(yx,{title:"Trigger",allLabel:"Any trigger",allCount:e.length,options:k6(e),value:t.cadence,onSelect:r=>n({...t,cadence:r}),testIdPrefix:"templates-cadence"})]})}function D6(){return typeof window>"u"?void 0:window}function pr(e=D6()){const t=e==null?void 0:e.sapiomDesktop;if(!t||typeof t!="object")return null;const n=t;return typeof n.checkForUpdates!="function"?null:{appVersion:typeof n.appVersion=="string"?n.appVersion:"",checkForUpdates:n.checkForUpdates,chooseDirectory:typeof n.chooseDirectory=="function"?n.chooseDirectory:void 0,onDeepLink:typeof n.onDeepLink=="function"?n.onDeepLink:void 0,onUpdateState:typeof n.onUpdateState=="function"?n.onUpdateState:void 0,pathForFile:typeof n.pathForFile=="function"?n.pathForFile:void 0}}function P2(e){switch(e.kind){case"available":return{text:`Downloading ${e.version}…`,tone:"info"};case"downloaded":return{text:`${e.version} is ready to install.`,tone:"action"};case"up-to-date":return{text:`Up to date (${e.version}, ${e.channel}).`,tone:"info"};case"no-release":return{text:`No ${e.channel} release published yet.`,tone:"info"};case"disabled":return{text:`Updates are off: ${e.reason}.`,tone:"error"};case"failed":return{text:`Couldn't check: ${e.message}`,tone:"error"}}}function B2({value:e,onChange:t,onSubmit:n,recentDirs:r,listDir:o,onNewDirChange:c,onResolve:h}){var H;const[l,u]=O.useState(e),[m,g]=O.useState([]),[p,S]=O.useState(e),[x,A]=O.useState(!1),[E,y]=O.useState(null),[b,v]=O.useState(0),[_,k]=O.useState(!0),[C,w]=O.useState(!1),[T,j]=O.useState(0),M=O.useRef(null),[D,L]=O.useState("none"),q=()=>{const U=M.current;if(!U)return;const P=U.scrollLeft>2,W=U.scrollLeft+U.clientWidth<U.scrollWidth-2;L(P&&W?"both":P?"left":W?"right":"none")};O.useEffect(()=>{q()},[r]),O.useEffect(()=>{let U=!1;A(!0),y(null),w(!1);const P=setTimeout(()=>{o(e||void 0).then(W=>{U||(u(W.path),g(W.dirs),S(W.parent))}).catch(async()=>{const W=Gr(e);if(!W||U){U||y("Couldn't read that directory.");return}try{const se=await o(W);if(U)return;u(se.path),g(se.dirs),S(se.parent),w(!0)}catch{U||y("Couldn't read that directory.")}}).finally(()=>!U&&A(!1))},150);return()=>{U=!0,clearTimeout(P)}},[e,T]);const F=U=>U.replace(/\\/g,"/"),Y=F(e).startsWith(F(l))?e.slice(l.length).replace(/^[\\/]+/,""):"",Q=Y?m.filter(U=>U.name.toLowerCase().startsWith(Y.toLowerCase())):m,G=Math.min(b,Math.max(Q.length-1,0)),ee=!x&&!E&&Q.length===0&&(C||Y!=="");O.useEffect(()=>{c==null||c(ee)},[ee]),O.useEffect(()=>{x||E||h==null||h({resolvedPath:l,dirs:m,parent:p,isNew:ee})},[l,m,p,ee,x,E]);const ne=U=>t(U),z=((H=pr())==null?void 0:H.chooseDirectory)??null,B=()=>{if(z){z(e||l||void 0).then(U=>{U&&t(U)}).catch(()=>{});return}if(!_){k(!0);return}ee&&l&&l!==e?ne(l):k(!1)},$=U=>{var W;const P=_&&Q.length>0;U.key==="ArrowDown"&&P?(U.preventDefault(),v(Math.min(G+1,Q.length-1))):U.key==="ArrowUp"&&P?(U.preventDefault(),v(Math.max(G-1,0))):U.key==="Enter"&&(P?(ne(((W=Q[G])==null?void 0:W.path)??Q[0].path),v(0)):n())};return d.jsxs("div",{className:"dir-picker",children:[d.jsxs("div",{className:"dir-picker-inputrow",children:[d.jsx("button",{type:"button",className:"dir-picker-up","data-testid":"dir-picker-up",disabled:p===l,onClick:()=>ne(p),"aria-label":"Up to parent directory","data-tooltip":"Up to parent directory",children:d.jsx(de,{name:"CornerLeftUp",size:14})}),d.jsx("input",{id:"new-session-cwd",autoFocus:!0,"aria-label":"Workspace folder",className:"modal-input dir-picker-input","data-testid":"dir-picker-input",value:e,placeholder:"/path/to/workspace",onChange:U=>t(U.target.value),onKeyDown:$}),d.jsx("button",{type:"button",className:"dir-picker-up dir-picker-browse"+(!z&&_?" is-active":""),"data-testid":"dir-picker-browse","aria-pressed":z?void 0:_,onClick:B,"aria-label":z?"Choose a folder":"Browse subdirectories","data-tooltip":z?"Choose a folder…":_?ee?"Browse the nearest existing folder":"Hide the directory listing":"Browse subdirectories",children:d.jsx(de,{name:"Folder",size:14})})]}),r.length>0&&d.jsx("div",{className:"recent-dirs",ref:M,"data-fade":D,onScroll:q,children:r.map(U=>d.jsx("button",{type:"button",className:"recent-dir-chip",title:U,onClick:()=>ne(U),children:$R(U)},U))}),_&&d.jsxs("div",{className:"dir-picker-listing","data-testid":"dir-picker-listing",children:[d.jsx("div",{className:"dir-picker-path",children:l}),x&&d.jsx("div",{className:"dir-picker-empty",children:"Loading…"}),!x&&E&&d.jsxs("div",{className:"dir-picker-error","data-testid":"dir-picker-error",role:"alert",children:[d.jsx(de,{name:"TriangleAlert",size:14}),d.jsx("span",{children:E}),d.jsx("button",{type:"button",className:"btn-ghost dir-picker-retry","data-testid":"dir-picker-retry",onClick:()=>j(U=>U+1),children:"Retry"})]}),ee&&d.jsx("div",{className:"dir-picker-newdir","data-testid":"dir-picker-newdir",children:"New folder. It will be created when you start."}),!x&&!E&&!ee&&Q.length===0&&d.jsx("div",{className:"dir-picker-empty",children:"No subdirectories"}),!x&&!E&&Q.map((U,P)=>d.jsxs("button",{type:"button",className:"dir-picker-item"+(P===G?" is-selected":""),"data-testid":`dir-picker-item-${U.name}`,onMouseEnter:()=>v(P),onClick:()=>ne(U.path),...Ot({object:"directory"}),children:[d.jsx(de,{name:"Folder",size:13}),d.jsx("span",{className:"dir-picker-item-name",children:U.name}),U.hasAgentProject&&d.jsxs("span",{className:"dir-picker-item-badge","data-testid":`dir-picker-badge-${U.name}`,title:"Contains sapiom.json",children:[d.jsx(de,{name:"Check",size:11}),"Agent"]})]},U.path))]})]})}function O6({template:e,initialDest:t,recentDirs:n,listDir:r,onCancel:o,onConfirm:c,triggerRef:h}){const[l,u]=O.useState(t),[m,g]=O.useState(!1),[p,S]=O.useState(null),x=O.useRef(null);Ua(!m,{onDismiss:o,containerRef:x,triggerRef:h});const A=async()=>{const E=l.trim();if(!(!E||m)){g(!0),S(null);try{await c(E)}catch(y){S(y.message),g(!1)}}};return d.jsx("div",{className:"modal-backdrop",children:d.jsxs("div",{className:"modal modal-confirm modal-template-use",role:"dialog","aria-label":`Use ${e.name}`,...Ot({dialog:"template_use"}),"data-testid":"template-use-dialog",ref:x,children:[d.jsxs("div",{className:"modal-header",children:["Use ",e.name,d.jsx("button",{className:"theme-toggle modal-close","aria-label":"Close",title:"Close",disabled:m,onClick:o,children:d.jsx(de,{name:"X",size:14})})]}),d.jsxs("div",{className:"modal-body",children:[d.jsx(B2,{value:l,onChange:u,onSubmit:()=>void A(),recentDirs:n,listDir:r}),p?d.jsx("p",{className:"modal-error","data-testid":"template-use-error",children:p}):d.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."})]}),d.jsxs("div",{className:"modal-actions",children:[d.jsx("button",{className:"btn-ghost",disabled:m,onClick:o,children:"Cancel"}),d.jsx("button",{className:"btn-primary modal-primary-cta","data-testid":"template-use-confirm",disabled:m||!l.trim(),onClick:()=>void A(),children:m?"Starting…":"Start session"})]})]})})}function z2({children:e,...t}){return d.jsx("div",{style:{display:"contents"},...Ot(t),children:e})}function L6({projectRoot:e,recentDirs:t,listDir:n,onExit:r,onUse:o,listTemplates:c,getTemplate:h,openTemplateId:l}){const[u,m]=O.useState(null),[g,p]=O.useState(null),[S,x]=O.useState(mx),[A,E]=O.useState(null),[y,b]=O.useState(null),v=O.useRef(null);O.useEffect(()=>{let M=!1;return c().then(D=>{M||m(D)}).catch(D=>{M||p(D instanceof Error?D.message:String(D))}),()=>{M=!0}},[]);const _=O.useMemo(()=>((u==null?void 0:u.templates)??[]).map(M=>({...M,kind:"gallery"})),[u]),k=O.useMemo(()=>j6(_,S,TS),[_,S]),C=O.useMemo(()=>S.category!==null||S.cadence!==null?[]:Xh.filter(M=>TS(M,S.query)),[S]),w=O.useRef(null);O.useEffect(()=>{if(!l||w.current===l)return;const M=_.find(D=>D.id===l)??Xh.find(D=>D.id===l);M&&(w.current=l,E(M))},[l,_]);const T=u===null&&g===null,j=g?`Could not load the template gallery: ${g}`:!u||u.source==="live"?null:u.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 d.jsxs("section",{className:"templates-panel","data-testid":"templates-panel","aria-label":"Templates",children:[d.jsxs("div",{className:"templates-bar",...Ot({surface:"template_gallery"}),children:[d.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?E(null):r(),children:d.jsx(de,{name:"ArrowLeft",size:14})}),d.jsx("span",{className:"templates-bar-title",children:A?A.name:"Templates"}),A&&d.jsx("button",{ref:v,type:"button",className:"btn-primary templates-bar-use","data-testid":"template-use-btn",onClick:()=>b(A),children:"Use template"})]}),d.jsx("div",{className:"templates-scroll",children:d.jsx("div",{className:"templates-measure",children:A?d.jsx(M6,{template:A,getTemplate:h}):d.jsxs(z2,{surface:"template_gallery",children:[d.jsxs("header",{className:"templates-hero",children:[d.jsx("h2",{className:"templates-hero-title",children:"Start from a template"}),d.jsx("p",{className:"templates-hero-copy",children:T?"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.`})]}),j&&d.jsxs("div",{className:"templates-degraded","data-testid":"templates-degraded",role:"status",children:[d.jsx(de,{name:"TriangleAlert",size:14}),d.jsx("span",{children:j})]}),d.jsxs("div",{className:"templates-layout",children:[d.jsx($6,{catalog:_,filter:S,onChange:x}),d.jsxs("div",{className:"templates-results",children:[k.length>0&&d.jsx("div",{className:"templates-grid","data-testid":"templates-grid",children:k.map(M=>d.jsx(_x,{template:M,onOpen:E,onUse:b},M.id))}),k.length===0&&!T&&_.length>0&&d.jsx(En,{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:x6(S)?d.jsx("button",{type:"button",className:"btn-line","data-testid":"templates-empty-clear",onClick:()=>x(mx),children:"Clear filters"}):void 0}),C.length>0&&d.jsxs("section",{className:"templates-starters","data-testid":"templates-starters",children:[d.jsx("span",{className:"facet-title",children:"Bundled starters"}),d.jsx("p",{className:"templates-starters-copy",children:"Shipped with the CLI. No Sapiom account or capability spend; setup may access npm."}),d.jsx("div",{className:"templates-grid",children:C.map(M=>d.jsx(_x,{template:M,onOpen:E,onUse:b},M.id))})]})]})]})]})})}),y&&d.jsx(O6,{template:y,initialDest:tD(y,e),recentDirs:t,listDir:n,onCancel:()=>b(null),triggerRef:v,onConfirm:async M=>{await o(M,y),r()}})]})}var mg={exports:{}},bx;function I6(){return bx||(bx=1,(function(e,t){(function(n,r){e.exports=r()})(globalThis,(()=>(()=>{var n={4567:function(h,l,u){var m=this&&this.__decorate||function(v,_,k,C){var w,T=arguments.length,j=T<3?_:C===null?C=Object.getOwnPropertyDescriptor(_,k):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(v,_,k,C);else for(var M=v.length-1;M>=0;M--)(w=v[M])&&(j=(T<3?w(j):T>3?w(_,k,j):w(_,k))||j);return T>3&&j&&Object.defineProperty(_,k,j),j},g=this&&this.__param||function(v,_){return function(k,C){_(k,C,v)}};Object.defineProperty(l,"__esModule",{value:!0}),l.AccessibilityManager=void 0;const p=u(9042),S=u(9924),x=u(844),A=u(4725),E=u(2585),y=u(3656);let b=l.AccessibilityManager=class extends x.Disposable{constructor(v,_,k,C){super(),this._terminal=v,this._coreBrowserService=k,this._renderService=C,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 w=0;w<this._terminal.rows;w++)this._rowElements[w]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[w]);if(this._topBoundaryFocusListener=w=>this._handleBoundaryFocus(w,0),this._bottomBoundaryFocusListener=w=>this._handleBoundaryFocus(w,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 S.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((w=>this._handleResize(w.rows)))),this.register(this._terminal.onRender((w=>this._refreshRows(w.start,w.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((w=>this._handleChar(w)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
|
|
494
|
+
`)))),this.register(this._terminal.onA11yTab((w=>this._handleTab(w)))),this.register(this._terminal.onKey((w=>this._handleKey(w.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,x.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(v){for(let _=0;_<v;_++)this._handleChar(" ")}_handleChar(v){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==v&&(this._charsToAnnounce+=v):this._charsToAnnounce+=v,v===`
|
|
495
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=p.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(v){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(v)||this._charsToConsume.push(v)}_refreshRows(v,_){this._liveRegionDebouncer.refresh(v,_,this._terminal.rows)}_renderRows(v,_){const k=this._terminal.buffer,C=k.lines.length.toString();for(let w=v;w<=_;w++){const T=k.lines.get(k.ydisp+w),j=[],M=(T==null?void 0:T.translateToString(!0,void 0,void 0,j))||"",D=(k.ydisp+w+1).toString(),L=this._rowElements[w];L&&(M.length===0?(L.innerText=" ",this._rowColumns.set(L,[0,1])):(L.textContent=M,this._rowColumns.set(L,j)),L.setAttribute("aria-posinset",D),L.setAttribute("aria-setsize",C))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(v,_){const k=v.target,C=this._rowElements[_===0?1:this._rowElements.length-2];if(k.getAttribute("aria-posinset")===(_===0?"1":`${this._terminal.buffer.lines.length}`)||v.relatedTarget!==C)return;let w,T;if(_===0?(w=k,T=this._rowElements.pop(),this._rowContainer.removeChild(T)):(w=this._rowElements.shift(),T=k,this._rowContainer.removeChild(w)),w.removeEventListener("focus",this._topBoundaryFocusListener),T.removeEventListener("focus",this._bottomBoundaryFocusListener),_===0){const j=this._createAccessibilityTreeNode();this._rowElements.unshift(j),this._rowContainer.insertAdjacentElement("afterbegin",j)}else{const j=this._createAccessibilityTreeNode();this._rowElements.push(j),this._rowContainer.appendChild(j)}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(),v.preventDefault(),v.stopImmediatePropagation()}_handleSelectionChange(){var M;if(this._rowElements.length===0)return;const v=document.getSelection();if(!v)return;if(v.isCollapsed)return void(this._rowContainer.contains(v.anchorNode)&&this._terminal.clearSelection());if(!v.anchorNode||!v.focusNode)return void console.error("anchorNode and/or focusNode are null");let _={node:v.anchorNode,offset:v.anchorOffset},k={node:v.focusNode,offset:v.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 C=this._rowElements.slice(-1)[0];if(k.node.compareDocumentPosition(C)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(k={node:C,offset:((M=C.textContent)==null?void 0:M.length)??0}),!this._rowContainer.contains(k.node))return;const w=({node:D,offset:L})=>{const q=D instanceof Text?D.parentNode:D;let F=parseInt(q==null?void 0:q.getAttribute("aria-posinset"),10)-1;if(isNaN(F))return console.warn("row is invalid. Race condition?"),null;const Y=this._rowColumns.get(q);if(!Y)return console.warn("columns is null. Race condition?"),null;let Q=L<Y.length?Y[L]:Y.slice(-1)[0]+1;return Q>=this._terminal.cols&&(++F,Q=0),{row:F,column:Q}},T=w(_),j=w(k);if(T&&j){if(T.row>j.row||T.row===j.row&&T.column>=j.column)throw new Error("invalid range");this._terminal.select(T.column,T.row,(j.row-T.row)*this._terminal.cols-T.column+j.column)}}_handleResize(v){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>v;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const v=this._coreBrowserService.mainDocument.createElement("div");return v.setAttribute("role","listitem"),v.tabIndex=-1,this._refreshRowDimensions(v),v}_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 v=0;v<this._terminal.rows;v++)this._refreshRowDimensions(this._rowElements[v])}}_refreshRowDimensions(v){v.style.height=`${this._renderService.dimensions.css.cell.height}px`}};l.AccessibilityManager=b=m([g(1,E.IInstantiationService),g(2,A.ICoreBrowserService),g(3,A.IRenderService)],b)},3614:(h,l)=>{function u(S){return S.replace(/\r?\n/g,"\r")}function m(S,x){return x?"\x1B[200~"+S+"\x1B[201~":S}function g(S,x,A,E){S=m(S=u(S),A.decPrivateModes.bracketedPasteMode&&E.rawOptions.ignoreBracketedPasteMode!==!0),A.triggerDataEvent(S,!0),x.value=""}function p(S,x,A){const E=A.getBoundingClientRect(),y=S.clientX-E.left-10,b=S.clientY-E.top-10;x.style.width="20px",x.style.height="20px",x.style.left=`${y}px`,x.style.top=`${b}px`,x.style.zIndex="1000",x.focus()}Object.defineProperty(l,"__esModule",{value:!0}),l.rightClickHandler=l.moveTextAreaUnderMouseCursor=l.paste=l.handlePasteEvent=l.copyHandler=l.bracketTextForPaste=l.prepareTextForTerminal=void 0,l.prepareTextForTerminal=u,l.bracketTextForPaste=m,l.copyHandler=function(S,x){S.clipboardData&&S.clipboardData.setData("text/plain",x.selectionText),S.preventDefault()},l.handlePasteEvent=function(S,x,A,E){S.stopPropagation(),S.clipboardData&&g(S.clipboardData.getData("text/plain"),x,A,E)},l.paste=g,l.moveTextAreaUnderMouseCursor=p,l.rightClickHandler=function(S,x,A,E,y){p(S,x,A),y&&E.rightClickSelect(S),x.value=E.selectionText,x.select()}},7239:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ColorContrastCache=void 0;const m=u(1505);l.ColorContrastCache=class{constructor(){this._color=new m.TwoKeyMap,this._css=new m.TwoKeyMap}setCss(g,p,S){this._css.set(g,p,S)}getCss(g,p){return this._css.get(g,p)}setColor(g,p,S){this._color.set(g,p,S)}getColor(g,p){return this._color.get(g,p)}clear(){this._color.clear(),this._css.clear()}}},3656:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.addDisposableDomListener=void 0,l.addDisposableDomListener=function(u,m,g,p){u.addEventListener(m,g,p);let S=!1;return{dispose:()=>{S||(S=!0,u.removeEventListener(m,g,p))}}}},3551:function(h,l,u){var m=this&&this.__decorate||function(b,v,_,k){var C,w=arguments.length,T=w<3?v:k===null?k=Object.getOwnPropertyDescriptor(v,_):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(b,v,_,k);else for(var j=b.length-1;j>=0;j--)(C=b[j])&&(T=(w<3?C(T):w>3?C(v,_,T):C(v,_))||T);return w>3&&T&&Object.defineProperty(v,_,T),T},g=this&&this.__param||function(b,v){return function(_,k){v(_,k,b)}};Object.defineProperty(l,"__esModule",{value:!0}),l.Linkifier=void 0;const p=u(3656),S=u(8460),x=u(844),A=u(2585),E=u(4725);let y=l.Linkifier=class extends x.Disposable{get currentLink(){return this._currentLink}constructor(b,v,_,k,C){super(),this._element=b,this._mouseService=v,this._renderService=_,this._bufferService=k,this._linkProviderService=C,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new S.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new S.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,x.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,x.toDisposable)((()=>{var w;this._lastMouseEvent=void 0,(w=this._activeProviderReplies)==null||w.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,p.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,p.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,p.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,p.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(b){this._lastMouseEvent=b;const v=this._positionFromMouseEvent(b,this._element,this._mouseService);if(!v)return;this._isMouseOut=!1;const _=b.composedPath();for(let k=0;k<_.length;k++){const C=_[k];if(C.classList.contains("xterm"))break;if(C.classList.contains("xterm-hover"))return}this._lastBufferCell&&v.x===this._lastBufferCell.x&&v.y===this._lastBufferCell.y||(this._handleHover(v),this._lastBufferCell=v)}_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,v){var k,C;this._activeProviderReplies&&v||((k=this._activeProviderReplies)==null||k.forEach((w=>{w==null||w.forEach((T=>{T.link.dispose&&T.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=b.y);let _=!1;for(const[w,T]of this._linkProviderService.linkProviders.entries())v?(C=this._activeProviderReplies)!=null&&C.get(w)&&(_=this._checkLinkProviderResult(w,b,_)):T.provideLinks(b.y,(j=>{var D,L;if(this._isMouseOut)return;const M=j==null?void 0:j.map((q=>({link:q})));(D=this._activeProviderReplies)==null||D.set(w,M),_=this._checkLinkProviderResult(w,b,_),((L=this._activeProviderReplies)==null?void 0:L.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(b.y,this._activeProviderReplies)}))}_removeIntersectingLinks(b,v){const _=new Set;for(let k=0;k<v.size;k++){const C=v.get(k);if(C)for(let w=0;w<C.length;w++){const T=C[w],j=T.link.range.start.y<b?0:T.link.range.start.x,M=T.link.range.end.y>b?this._bufferService.cols:T.link.range.end.x;for(let D=j;D<=M;D++){if(_.has(D)){C.splice(w--,1);break}_.add(D)}}}}_checkLinkProviderResult(b,v,_){var w;if(!this._activeProviderReplies)return _;const k=this._activeProviderReplies.get(b);let C=!1;for(let T=0;T<b;T++)this._activeProviderReplies.has(T)&&!this._activeProviderReplies.get(T)||(C=!0);if(!C&&k){const T=k.find((j=>this._linkAtPosition(j.link,v)));T&&(_=!0,this._handleNewLink(T))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!_)for(let T=0;T<this._activeProviderReplies.size;T++){const j=(w=this._activeProviderReplies.get(T))==null?void 0:w.find((M=>this._linkAtPosition(M.link,v)));if(j){_=!0,this._handleNewLink(j);break}}return _}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(b){if(!this._currentLink)return;const v=this._positionFromMouseEvent(b,this._element,this._mouseService);v&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,v)&&this._currentLink.link.activate(b,this._currentLink.link.text)}_clearCurrentLink(b,v){this._currentLink&&this._lastMouseEvent&&(!b||!v||this._currentLink.link.range.start.y>=b&&this._currentLink.link.range.end.y<=v)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,x.disposeArray)(this._linkCacheDisposables))}_handleNewLink(b){if(!this._lastMouseEvent)return;const v=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);v&&this._linkAtPosition(b.link,v)&&(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,C,w;(k=this._currentLink)!=null&&k.state&&((w=(C=this._currentLink)==null?void 0:C.state)==null?void 0:w.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,C=this._bufferService.buffer.ydisp+1+_.end;if(this._currentLink.link.range.start.y>=k&&this._currentLink.link.range.end.y<=C&&(this._clearCurrentLink(k,C),this._lastMouseEvent)){const w=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);w&&this._askForLink(w,!1)}}))))}_linkHover(b,v,_){var k;(k=this._currentLink)!=null&&k.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(v,!0),this._currentLink.state.decorations.pointerCursor&&b.classList.add("xterm-cursor-pointer")),v.hover&&v.hover(_,v.text)}_fireUnderlineEvent(b,v){const _=b.range,k=this._bufferService.buffer.ydisp,C=this._createLinkUnderlineEvent(_.start.x-1,_.start.y-k-1,_.end.x,_.end.y-k-1,void 0);(v?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(C)}_linkLeave(b,v,_){var k;(k=this._currentLink)!=null&&k.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(v,!1),this._currentLink.state.decorations.pointerCursor&&b.classList.remove("xterm-cursor-pointer")),v.leave&&v.leave(_,v.text)}_linkAtPosition(b,v){const _=b.range.start.y*this._bufferService.cols+b.range.start.x,k=b.range.end.y*this._bufferService.cols+b.range.end.x,C=v.y*this._bufferService.cols+v.x;return _<=C&&C<=k}_positionFromMouseEvent(b,v,_){const k=_.getCoords(b,v,this._bufferService.cols,this._bufferService.rows);if(k)return{x:k[0],y:k[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(b,v,_,k,C){return{x1:b,y1:v,x2:_,y2:k,cols:this._bufferService.cols,fg:C}}};l.Linkifier=y=m([g(1,E.IMouseService),g(2,E.IRenderService),g(3,A.IBufferService),g(4,E.ILinkProviderService)],y)},9042:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.tooMuchOutput=l.promptLabel=void 0,l.promptLabel="Terminal input",l.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(h,l,u){var m=this&&this.__decorate||function(E,y,b,v){var _,k=arguments.length,C=k<3?y:v===null?v=Object.getOwnPropertyDescriptor(y,b):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(E,y,b,v);else for(var w=E.length-1;w>=0;w--)(_=E[w])&&(C=(k<3?_(C):k>3?_(y,b,C):_(y,b))||C);return k>3&&C&&Object.defineProperty(y,b,C),C},g=this&&this.__param||function(E,y){return function(b,v){y(b,v,E)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OscLinkProvider=void 0;const p=u(511),S=u(2585);let x=l.OscLinkProvider=class{constructor(E,y,b){this._bufferService=E,this._optionsService=y,this._oscLinkService=b}provideLinks(E,y){var M;const b=this._bufferService.buffer.lines.get(E-1);if(!b)return void y(void 0);const v=[],_=this._optionsService.rawOptions.linkHandler,k=new p.CellData,C=b.getTrimmedLength();let w=-1,T=-1,j=!1;for(let D=0;D<C;D++)if(T!==-1||b.hasContent(D)){if(b.loadCell(D,k),k.hasExtendedAttrs()&&k.extended.urlId){if(T===-1){T=D,w=k.extended.urlId;continue}j=k.extended.urlId!==w}else T!==-1&&(j=!0);if(j||T!==-1&&D===C-1){const L=(M=this._oscLinkService.getLinkData(w))==null?void 0:M.uri;if(L){const q={start:{x:T+1,y:E},end:{x:D+(j||D!==C-1?0:1),y:E}};let F=!1;if(!(_!=null&&_.allowNonHttpProtocols))try{const Y=new URL(L);["http:","https:"].includes(Y.protocol)||(F=!0)}catch{F=!0}F||v.push({text:L,range:q,activate:(Y,Q)=>_?_.activate(Y,Q,q):A(0,Q),hover:(Y,Q)=>{var G;return(G=_==null?void 0:_.hover)==null?void 0:G.call(_,Y,Q,q)},leave:(Y,Q)=>{var G;return(G=_==null?void 0:_.leave)==null?void 0:G.call(_,Y,Q,q)}})}j=!1,k.hasExtendedAttrs()&&k.extended.urlId?(T=D,w=k.extended.urlId):(T=-1,w=-1)}}y(v)}};function A(E,y){if(confirm(`Do you want to navigate to ${y}?
|
|
496
|
+
|
|
497
|
+
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")}}l.OscLinkProvider=x=m([g(0,S.IBufferService),g(1,S.IOptionsService),g(2,S.IOscLinkService)],x)},6193:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.RenderDebouncer=void 0,l.RenderDebouncer=class{constructor(u,m){this._renderCallback=u,this._coreBrowserService=m,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(u){return this._refreshCallbacks.push(u),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(u,m,g){this._rowCount=g,u=u!==void 0?u:0,m=m!==void 0?m:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,u):u,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,m):m,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 u=Math.max(this._rowStart,0),m=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(u,m),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const u of this._refreshCallbacks)u(0);this._refreshCallbacks=[]}}},3236:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Terminal=void 0;const m=u(3614),g=u(3656),p=u(3551),S=u(9042),x=u(3730),A=u(1680),E=u(3107),y=u(5744),b=u(2950),v=u(1296),_=u(428),k=u(4269),C=u(5114),w=u(8934),T=u(3230),j=u(9312),M=u(4725),D=u(6731),L=u(8055),q=u(8969),F=u(8460),Y=u(844),Q=u(6114),G=u(8437),ee=u(2584),ne=u(7399),z=u(5941),B=u(9074),$=u(2585),H=u(5435),U=u(4567),P=u(779);class W extends q.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(X={}){super(X),this.browser=Q,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new Y.MutableDisposable),this._onCursorMove=this.register(new F.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new F.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new F.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new F.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new F.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new F.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new F.EventEmitter),this._onBlur=this.register(new F.EventEmitter),this._onA11yCharEmitter=this.register(new F.EventEmitter),this._onA11yTabEmitter=this.register(new F.EventEmitter),this._onWillOpen=this.register(new F.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(B.DecorationService),this._instantiationService.setService($.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(P.LinkProviderService),this._instantiationService.setService(M.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(x.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((V,ue)=>this.refresh(V,ue)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((V=>this._reportWindowsOptions(V)))),this.register(this._inputHandler.onColor((V=>this._handleColorEvent(V)))),this.register((0,F.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,F.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,F.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,F.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((V=>this._afterResize(V.cols,V.rows)))),this.register((0,Y.toDisposable)((()=>{var V,ue;this._customKeyEventHandler=void 0,(ue=(V=this.element)==null?void 0:V.parentNode)==null||ue.removeChild(this.element)})))}_handleColorEvent(X){if(this._themeService)for(const V of X){let ue,oe="";switch(V.index){case 256:ue="foreground",oe="10";break;case 257:ue="background",oe="11";break;case 258:ue="cursor",oe="12";break;default:ue="ansi",oe="4;"+V.index}switch(V.type){case 0:const Z=L.color.toColorRGB(ue==="ansi"?this._themeService.colors.ansi[V.index]:this._themeService.colors[ue]);this.coreService.triggerDataEvent(`${ee.C0.ESC}]${oe};${(0,z.toRgbString)(Z)}${ee.C1_ESCAPED.ST}`);break;case 1:if(ue==="ansi")this._themeService.modifyColors((te=>te.ansi[V.index]=L.channels.toColor(...V.color)));else{const te=ue;this._themeService.modifyColors((pe=>pe[te]=L.channels.toColor(...V.color)))}break;case 2:this._themeService.restoreColor(V.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(X){X?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(U.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(X){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ee.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var X;return(X=this.textarea)==null?void 0:X.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ee.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 X=this.buffer.ybase+this.buffer.y,V=this.buffer.lines.get(X);if(!V)return;const ue=Math.min(this.buffer.x,this.cols-1),oe=this._renderService.dimensions.css.cell.height,Z=V.getWidth(ue),te=this._renderService.dimensions.css.cell.width*Z,pe=this.buffer.y*this._renderService.dimensions.css.cell.height,ye=ue*this._renderService.dimensions.css.cell.width;this.textarea.style.left=ye+"px",this.textarea.style.top=pe+"px",this.textarea.style.width=te+"px",this.textarea.style.height=oe+"px",this.textarea.style.lineHeight=oe+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,g.addDisposableDomListener)(this.element,"copy",(V=>{this.hasSelection()&&(0,m.copyHandler)(V,this._selectionService)})));const X=V=>(0,m.handlePasteEvent)(V,this.textarea,this.coreService,this.optionsService);this.register((0,g.addDisposableDomListener)(this.textarea,"paste",X)),this.register((0,g.addDisposableDomListener)(this.element,"paste",X)),Q.isFirefox?this.register((0,g.addDisposableDomListener)(this.element,"mousedown",(V=>{V.button===2&&(0,m.rightClickHandler)(V,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,g.addDisposableDomListener)(this.element,"contextmenu",(V=>{(0,m.rightClickHandler)(V,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),Q.isLinux&&this.register((0,g.addDisposableDomListener)(this.element,"auxclick",(V=>{V.button===1&&(0,m.moveTextAreaUnderMouseCursor)(V,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,g.addDisposableDomListener)(this.textarea,"keyup",(X=>this._keyUp(X)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"keydown",(X=>this._keyDown(X)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"keypress",(X=>this._keyPress(X)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionupdate",(X=>this._compositionHelper.compositionupdate(X)))),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,g.addDisposableDomListener)(this.textarea,"input",(X=>this._inputEvent(X)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(X){var ue;if(!X)throw new Error("Terminal requires a parent element.");if(X.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((ue=this.element)==null?void 0:ue.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=X.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"),X.appendChild(this.element);const V=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),V.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,g.addDisposableDomListener)(this.screenElement,"mousemove",(oe=>this.updateCursorStyle(oe)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),V.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",S.promptLabel),Q.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(C.CoreBrowserService,this.textarea,X.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(M.ICoreBrowserService,this._coreBrowserService),this.register((0,g.addDisposableDomListener)(this.textarea,"focus",(oe=>this._handleTextAreaFocus(oe)))),this.register((0,g.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(_.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(M.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(D.ThemeService),this._instantiationService.setService(M.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(k.CharacterJoinerService),this._instantiationService.setService(M.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(T.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(M.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((oe=>this._onRender.fire(oe)))),this.onResize((oe=>this._renderService.resize(oe.cols,oe.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(w.MouseService),this._instantiationService.setService(M.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(p.Linkifier,this.screenElement)),this.element.appendChild(V);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((oe=>this.scrollLines(oe.amount,oe.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(j.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(M.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((oe=>this.scrollLines(oe.amount,oe.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((oe=>this._renderService.handleSelectionChanged(oe.start,oe.end,oe.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((oe=>{this.textarea.value=oe,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((oe=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,g.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(E.BufferDecorationRenderer,this.screenElement)),this.register((0,g.addDisposableDomListener)(this.element,"mousedown",(oe=>this._selectionService.handleMouseDown(oe)))),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(U.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(oe=>this._handleScreenReaderModeOptionChange(oe)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(y.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(oe=>{!this._overviewRulerRenderer&&oe&&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(v.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const X=this,V=this.element;function ue(te){const pe=X._mouseService.getMouseReportCoords(te,X.screenElement);if(!pe)return!1;let ye,ke;switch(te.overrideType||te.type){case"mousemove":ke=32,te.buttons===void 0?(ye=3,te.button!==void 0&&(ye=te.button<3?te.button:3)):ye=1&te.buttons?0:4&te.buttons?1:2&te.buttons?2:3;break;case"mouseup":ke=0,ye=te.button<3?te.button:3;break;case"mousedown":ke=1,ye=te.button<3?te.button:3;break;case"wheel":if(X._customWheelEventHandler&&X._customWheelEventHandler(te)===!1||X.viewport.getLinesScrolled(te)===0)return!1;ke=te.deltaY<0?0:1,ye=4;break;default:return!1}return!(ke===void 0||ye===void 0||ye>4)&&X.coreMouseService.triggerMouseEvent({col:pe.col,row:pe.row,x:pe.x,y:pe.y,button:ye,action:ke,ctrl:te.ctrlKey,alt:te.altKey,shift:te.shiftKey})}const oe={mouseup:null,wheel:null,mousedrag:null,mousemove:null},Z={mouseup:te=>(ue(te),te.buttons||(this._document.removeEventListener("mouseup",oe.mouseup),oe.mousedrag&&this._document.removeEventListener("mousemove",oe.mousedrag)),this.cancel(te)),wheel:te=>(ue(te),this.cancel(te,!0)),mousedrag:te=>{te.buttons&&ue(te)},mousemove:te=>{te.buttons||ue(te)}};this.register(this.coreMouseService.onProtocolChange((te=>{te?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(te)),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&te?oe.mousemove||(V.addEventListener("mousemove",Z.mousemove),oe.mousemove=Z.mousemove):(V.removeEventListener("mousemove",oe.mousemove),oe.mousemove=null),16&te?oe.wheel||(V.addEventListener("wheel",Z.wheel,{passive:!1}),oe.wheel=Z.wheel):(V.removeEventListener("wheel",oe.wheel),oe.wheel=null),2&te?oe.mouseup||(oe.mouseup=Z.mouseup):(this._document.removeEventListener("mouseup",oe.mouseup),oe.mouseup=null),4&te?oe.mousedrag||(oe.mousedrag=Z.mousedrag):(this._document.removeEventListener("mousemove",oe.mousedrag),oe.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,g.addDisposableDomListener)(V,"mousedown",(te=>{if(te.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(te))return ue(te),oe.mouseup&&this._document.addEventListener("mouseup",oe.mouseup),oe.mousedrag&&this._document.addEventListener("mousemove",oe.mousedrag),this.cancel(te)}))),this.register((0,g.addDisposableDomListener)(V,"wheel",(te=>{if(!oe.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(te)===!1)return!1;if(!this.buffer.hasScrollback){const pe=this.viewport.getLinesScrolled(te);if(pe===0)return;const ye=ee.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(te.deltaY<0?"A":"B");let ke="";for(let Le=0;Le<Math.abs(pe);Le++)ke+=ye;return this.coreService.triggerDataEvent(ke,!0),this.cancel(te,!0)}return this.viewport.handleWheel(te)?this.cancel(te):void 0}}),{passive:!1})),this.register((0,g.addDisposableDomListener)(V,"touchstart",(te=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(te),this.cancel(te)}),{passive:!0})),this.register((0,g.addDisposableDomListener)(V,"touchmove",(te=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(te)?void 0:this.cancel(te)}),{passive:!1}))}refresh(X,V){var ue;(ue=this._renderService)==null||ue.refreshRows(X,V)}updateCursorStyle(X){var V;(V=this._selectionService)!=null&&V.shouldColumnSelect(X)?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(X,V,ue=0){var oe;ue===1?(super.scrollLines(X,V,ue),this.refresh(0,this.rows-1)):(oe=this.viewport)==null||oe.scrollLines(X)}paste(X){(0,m.paste)(X,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(X){this._customKeyEventHandler=X}attachCustomWheelEventHandler(X){this._customWheelEventHandler=X}registerLinkProvider(X){return this._linkProviderService.registerLinkProvider(X)}registerCharacterJoiner(X){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const V=this._characterJoinerService.register(X);return this.refresh(0,this.rows-1),V}deregisterCharacterJoiner(X){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(X)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(X){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+X)}registerDecoration(X){return this._decorationService.registerDecoration(X)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(X,V,ue){this._selectionService.setSelection(X,V,ue)}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 X;(X=this._selectionService)==null||X.clearSelection()}selectAll(){var X;(X=this._selectionService)==null||X.selectAll()}selectLines(X,V){var ue;(ue=this._selectionService)==null||ue.selectLines(X,V)}_keyDown(X){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1)return!1;const V=this.browser.isMac&&this.options.macOptionIsMeta&&X.altKey;if(!V&&!this._compositionHelper.keydown(X))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;V||X.key!=="Dead"&&X.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const ue=(0,ne.evaluateKeyboardEvent)(X,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(X),ue.type===3||ue.type===2){const oe=this.rows-1;return this.scrollLines(ue.type===2?-oe:oe),this.cancel(X,!0)}return ue.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,X)||(ue.cancel&&this.cancel(X,!0),!ue.key||!!(X.key&&!X.ctrlKey&&!X.altKey&&!X.metaKey&&X.key.length===1&&X.key.charCodeAt(0)>=65&&X.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(ue.key!==ee.C0.ETX&&ue.key!==ee.C0.CR||(this.textarea.value=""),this._onKey.fire({key:ue.key,domEvent:X}),this._showCursor(),this.coreService.triggerDataEvent(ue.key,!0),!this.optionsService.rawOptions.screenReaderMode||X.altKey||X.ctrlKey?this.cancel(X,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(X,V){const ue=X.isMac&&!this.options.macOptionIsMeta&&V.altKey&&!V.ctrlKey&&!V.metaKey||X.isWindows&&V.altKey&&V.ctrlKey&&!V.metaKey||X.isWindows&&V.getModifierState("AltGraph");return V.type==="keypress"?ue:ue&&(!V.keyCode||V.keyCode>47)}_keyUp(X){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1||((function(V){return V.keyCode===16||V.keyCode===17||V.keyCode===18})(X)||this.focus(),this.updateCursorStyle(X),this._keyPressHandled=!1)}_keyPress(X){let V;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1)return!1;if(this.cancel(X),X.charCode)V=X.charCode;else if(X.which===null||X.which===void 0)V=X.keyCode;else{if(X.which===0||X.charCode===0)return!1;V=X.which}return!(!V||(X.altKey||X.ctrlKey||X.metaKey)&&!this._isThirdLevelShift(this.browser,X)||(V=String.fromCharCode(V),this._onKey.fire({key:V,domEvent:X}),this._showCursor(),this.coreService.triggerDataEvent(V,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(X){if(X.data&&X.inputType==="insertText"&&(!X.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const V=X.data;return this.coreService.triggerDataEvent(V,!0),this.cancel(X),!0}return!1}resize(X,V){X!==this.cols||V!==this.rows?super.resize(X,V):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(X,V){var ue,oe;(ue=this._charSizeService)==null||ue.measure(),(oe=this.viewport)==null||oe.syncScrollArea(!0)}clear(){var X;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 V=1;V<this.rows;V++)this.buffer.lines.push(this.buffer.getBlankLine(G.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(X=this.viewport)==null||X.reset(),this.refresh(0,this.rows-1)}}reset(){var V,ue;this.options.rows=this.rows,this.options.cols=this.cols;const X=this._customKeyEventHandler;this._setup(),super.reset(),(V=this._selectionService)==null||V.reset(),this._decorationService.reset(),(ue=this.viewport)==null||ue.reset(),this._customKeyEventHandler=X,this.refresh(0,this.rows-1)}clearTextureAtlas(){var X;(X=this._renderService)==null||X.clearTextureAtlas()}_reportFocus(){var X;(X=this.element)!=null&&X.classList.contains("focus")?this.coreService.triggerDataEvent(ee.C0.ESC+"[I"):this.coreService.triggerDataEvent(ee.C0.ESC+"[O")}_reportWindowsOptions(X){if(this._renderService)switch(X){case H.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const V=this._renderService.dimensions.css.canvas.width.toFixed(0),ue=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${ee.C0.ESC}[4;${ue};${V}t`);break;case H.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const oe=this._renderService.dimensions.css.cell.width.toFixed(0),Z=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${ee.C0.ESC}[6;${Z};${oe}t`)}}cancel(X,V){if(this.options.cancelEvents||V)return X.preventDefault(),X.stopPropagation(),!1}}l.Terminal=W},9924:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.TimeBasedDebouncer=void 0,l.TimeBasedDebouncer=class{constructor(u,m=1e3){this._renderCallback=u,this._debounceThresholdMS=m,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(u,m,g){this._rowCount=g,u=u!==void 0?u:0,m=m!==void 0?m:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,u):u,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,m):m;const p=Date.now();if(p-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=p,this._innerRefresh();else if(!this._additionalRefreshRequested){const S=p-this._lastRefreshMs,x=this._debounceThresholdMS-S;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),x)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const u=Math.max(this._rowStart,0),m=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(u,m)}}},1680:function(h,l,u){var m=this&&this.__decorate||function(b,v,_,k){var C,w=arguments.length,T=w<3?v:k===null?k=Object.getOwnPropertyDescriptor(v,_):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(b,v,_,k);else for(var j=b.length-1;j>=0;j--)(C=b[j])&&(T=(w<3?C(T):w>3?C(v,_,T):C(v,_))||T);return w>3&&T&&Object.defineProperty(v,_,T),T},g=this&&this.__param||function(b,v){return function(_,k){v(_,k,b)}};Object.defineProperty(l,"__esModule",{value:!0}),l.Viewport=void 0;const p=u(3656),S=u(4725),x=u(8460),A=u(844),E=u(2585);let y=l.Viewport=class extends A.Disposable{constructor(b,v,_,k,C,w,T,j){super(),this._viewportElement=b,this._scrollArea=v,this._bufferService=_,this._optionsService=k,this._charSizeService=C,this._renderService=w,this._coreBrowserService=T,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 x.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,p.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((M=>this._activeBuffer=M.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((M=>this._renderDimensions=M))),this._handleThemeChange(j.colors),this.register(j.onChangeColors((M=>this._handleThemeChange(M)))),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 v=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==v&&(this._lastRecordedBufferHeight=v,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 v=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:v,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,v){const _=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(v<0&&this._viewportElement.scrollTop!==0||v>0&&_<this._lastRecordedBufferHeight)||(b.cancelable&&b.preventDefault(),!1)}handleWheel(b){const v=this._getPixelsScrolled(b);return v!==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+v:this._smoothScrollState.target+=v,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=v,this._bubbleScroll(b,v))}scrollLines(b){if(b!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const v=b*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+v,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 v=this._applyScrollModifier(b.deltaY,b);return b.deltaMode===WheelEvent.DOM_DELTA_LINE?v*=this._currentRowHeight:b.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(v*=this._currentRowHeight*this._bufferService.rows),v}getBufferElements(b,v){var j;let _,k="";const C=[],w=v??this._bufferService.buffer.lines.length,T=this._bufferService.buffer.lines;for(let M=b;M<w;M++){const D=T.get(M);if(!D)continue;const L=(j=T.get(M+1))==null?void 0:j.isWrapped;if(k+=D.translateToString(!L),!L||M===T.length-1){const q=document.createElement("div");q.textContent=k,C.push(q),k.length>0&&(_=q),k=""}}return{bufferElements:C,cursorElement:_}}getLinesScrolled(b){if(b.deltaY===0||b.shiftKey)return 0;let v=this._applyScrollModifier(b.deltaY,b);return b.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(v/=this._currentRowHeight+0,this._wheelPartialScroll+=v,v=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):b.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(v*=this._bufferService.rows),v}_applyScrollModifier(b,v){const _=this._optionsService.rawOptions.fastScrollModifier;return _==="alt"&&v.altKey||_==="ctrl"&&v.ctrlKey||_==="shift"&&v.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 v=this._lastTouchY-b.touches[0].pageY;return this._lastTouchY=b.touches[0].pageY,v!==0&&(this._viewportElement.scrollTop+=v,this._bubbleScroll(b,v))}};l.Viewport=y=m([g(2,E.IBufferService),g(3,E.IOptionsService),g(4,S.ICharSizeService),g(5,S.IRenderService),g(6,S.ICoreBrowserService),g(7,S.IThemeService)],y)},3107:function(h,l,u){var m=this&&this.__decorate||function(E,y,b,v){var _,k=arguments.length,C=k<3?y:v===null?v=Object.getOwnPropertyDescriptor(y,b):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(E,y,b,v);else for(var w=E.length-1;w>=0;w--)(_=E[w])&&(C=(k<3?_(C):k>3?_(y,b,C):_(y,b))||C);return k>3&&C&&Object.defineProperty(y,b,C),C},g=this&&this.__param||function(E,y){return function(b,v){y(b,v,E)}};Object.defineProperty(l,"__esModule",{value:!0}),l.BufferDecorationRenderer=void 0;const p=u(4725),S=u(844),x=u(2585);let A=l.BufferDecorationRenderer=class extends S.Disposable{constructor(E,y,b,v,_){super(),this._screenElement=E,this._bufferService=y,this._coreBrowserService=b,this._decorationService=v,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,S.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 E of this._decorationService.decorations)this._renderDecoration(E);this._dimensionsChanged=!1}_renderDecoration(E){this._refreshStyle(E),this._dimensionsChanged&&this._refreshXPosition(E)}_createElement(E){var v;const y=this._coreBrowserService.mainDocument.createElement("div");y.classList.add("xterm-decoration"),y.classList.toggle("xterm-decoration-top-layer",((v=E==null?void 0:E.options)==null?void 0:v.layer)==="top"),y.style.width=`${Math.round((E.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,y.style.height=(E.options.height||1)*this._renderService.dimensions.css.cell.height+"px",y.style.top=(E.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=E.options.x??0;return b&&b>this._bufferService.cols&&(y.style.display="none"),this._refreshXPosition(E,y),y}_refreshStyle(E){const y=E.marker.line-this._bufferService.buffers.active.ydisp;if(y<0||y>=this._bufferService.rows)E.element&&(E.element.style.display="none",E.onRenderEmitter.fire(E.element));else{let b=this._decorationElements.get(E);b||(b=this._createElement(E),E.element=b,this._decorationElements.set(E,b),this._container.appendChild(b),E.onDispose((()=>{this._decorationElements.delete(E),b.remove()}))),b.style.top=y*this._renderService.dimensions.css.cell.height+"px",b.style.display=this._altBufferIsActive?"none":"block",E.onRenderEmitter.fire(b)}}_refreshXPosition(E,y=E.element){if(!y)return;const b=E.options.x??0;(E.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(E){var y;(y=this._decorationElements.get(E))==null||y.remove(),this._decorationElements.delete(E),E.dispose()}};l.BufferDecorationRenderer=A=m([g(1,x.IBufferService),g(2,p.ICoreBrowserService),g(3,x.IDecorationService),g(4,p.IRenderService)],A)},5871:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ColorZoneStore=void 0,l.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(u){if(u.options.overviewRulerOptions){for(const m of this._zones)if(m.color===u.options.overviewRulerOptions.color&&m.position===u.options.overviewRulerOptions.position){if(this._lineIntersectsZone(m,u.marker.line))return;if(this._lineAdjacentToZone(m,u.marker.line,u.options.overviewRulerOptions.position))return void this._addLineToZone(m,u.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=u.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=u.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=u.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=u.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:u.options.overviewRulerOptions.color,position:u.options.overviewRulerOptions.position,startBufferLine:u.marker.line,endBufferLine:u.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(u){this._linePadding=u}_lineIntersectsZone(u,m){return m>=u.startBufferLine&&m<=u.endBufferLine}_lineAdjacentToZone(u,m,g){return m>=u.startBufferLine-this._linePadding[g||"full"]&&m<=u.endBufferLine+this._linePadding[g||"full"]}_addLineToZone(u,m){u.startBufferLine=Math.min(u.startBufferLine,m),u.endBufferLine=Math.max(u.endBufferLine,m)}}},5744:function(h,l,u){var m=this&&this.__decorate||function(_,k,C,w){var T,j=arguments.length,M=j<3?k:w===null?w=Object.getOwnPropertyDescriptor(k,C):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(_,k,C,w);else for(var D=_.length-1;D>=0;D--)(T=_[D])&&(M=(j<3?T(M):j>3?T(k,C,M):T(k,C))||M);return j>3&&M&&Object.defineProperty(k,C,M),M},g=this&&this.__param||function(_,k){return function(C,w){k(C,w,_)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OverviewRulerRenderer=void 0;const p=u(5871),S=u(4725),x=u(844),A=u(2585),E={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 v=l.OverviewRulerRenderer=class extends x.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(_,k,C,w,T,j,M){var L;super(),this._viewportElement=_,this._screenElement=k,this._bufferService=C,this._decorationService=w,this._renderService=T,this._optionsService=j,this._coreBrowserService=M,this._colorZoneStore=new p.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(),(L=this._viewportElement.parentElement)==null||L.insertBefore(this._canvas,this._viewportElement);const D=this._canvas.getContext("2d");if(!D)throw new Error("Ctx cannot be null");this._ctx=D,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,x.toDisposable)((()=>{var q;(q=this._canvas)==null||q.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(){E.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);E.left=k,E.center=k,E.right=k}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*E.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*E.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*E.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*E.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)-E[_.position||"full"]/2),y[_.position||"full"],Math.round((this._canvas.height-1)*((_.endBufferLine-_.startBufferLine)/this._bufferService.buffers.active.lines.length)+E[_.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})))}};l.OverviewRulerRenderer=v=m([g(2,A.IBufferService),g(3,A.IDecorationService),g(4,S.IRenderService),g(5,A.IOptionsService),g(6,S.ICoreBrowserService)],v)},2950:function(h,l,u){var m=this&&this.__decorate||function(E,y,b,v){var _,k=arguments.length,C=k<3?y:v===null?v=Object.getOwnPropertyDescriptor(y,b):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(E,y,b,v);else for(var w=E.length-1;w>=0;w--)(_=E[w])&&(C=(k<3?_(C):k>3?_(y,b,C):_(y,b))||C);return k>3&&C&&Object.defineProperty(y,b,C),C},g=this&&this.__param||function(E,y){return function(b,v){y(b,v,E)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CompositionHelper=void 0;const p=u(4725),S=u(2585),x=u(2584);let A=l.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(E,y,b,v,_,k){this._textarea=E,this._compositionView=y,this._bufferService=b,this._optionsService=v,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(E){this._compositionView.textContent=E.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(E){if(this._isComposing||this._isSendingComposition){if(E.keyCode===229||E.keyCode===16||E.keyCode===17||E.keyCode===18)return!1;this._finalizeComposition(!1)}return E.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(E){if(this._compositionView.classList.remove("active"),this._isComposing=!1,E){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 E=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const y=this._textarea.value,b=y.replace(E,"");this._dataAlreadySent=b,y.length>E.length?this._coreService.triggerDataEvent(b,!0):y.length<E.length?this._coreService.triggerDataEvent(`${x.C0.DEL}`,!0):y.length===E.length&&y!==E&&this._coreService.triggerDataEvent(y,!0)}}),0)}updateCompositionElements(E){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,v=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=v+"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=v+"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"}E||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};l.CompositionHelper=A=m([g(2,S.IBufferService),g(3,S.IOptionsService),g(4,S.ICoreService),g(5,p.IRenderService)],A)},9806:(h,l)=>{function u(m,g,p){const S=p.getBoundingClientRect(),x=m.getComputedStyle(p),A=parseInt(x.getPropertyValue("padding-left")),E=parseInt(x.getPropertyValue("padding-top"));return[g.clientX-S.left-A,g.clientY-S.top-E]}Object.defineProperty(l,"__esModule",{value:!0}),l.getCoords=l.getCoordsRelativeToElement=void 0,l.getCoordsRelativeToElement=u,l.getCoords=function(m,g,p,S,x,A,E,y,b){if(!A)return;const v=u(m,g,p);return v?(v[0]=Math.ceil((v[0]+(b?E/2:0))/E),v[1]=Math.ceil(v[1]/y),v[0]=Math.min(Math.max(v[0],1),S+(b?1:0)),v[1]=Math.min(Math.max(v[1],1),x),v):void 0}},9504:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.moveToCellSequence=void 0;const m=u(2584);function g(y,b,v,_){const k=y-p(y,v),C=b-p(b,v),w=Math.abs(k-C)-(function(T,j,M){let D=0;const L=T-p(T,M),q=j-p(j,M);for(let F=0;F<Math.abs(L-q);F++){const Y=S(T,j)==="A"?-1:1,Q=M.buffer.lines.get(L+Y*F);Q!=null&&Q.isWrapped&&D++}return D})(y,b,v);return E(w,A(S(y,b),_))}function p(y,b){let v=0,_=b.buffer.lines.get(y),k=_==null?void 0:_.isWrapped;for(;k&&y>=0&&y<b.rows;)v++,_=b.buffer.lines.get(--y),k=_==null?void 0:_.isWrapped;return v}function S(y,b){return y>b?"A":"B"}function x(y,b,v,_,k,C){let w=y,T=b,j="";for(;w!==v||T!==_;)w+=k?1:-1,k&&w>C.cols-1?(j+=C.buffer.translateBufferLineToString(T,!1,y,w),w=0,y=0,T++):!k&&w<0&&(j+=C.buffer.translateBufferLineToString(T,!1,0,y+1),w=C.cols-1,y=w,T--);return j+C.buffer.translateBufferLineToString(T,!1,y,w)}function A(y,b){const v=b?"O":"[";return m.C0.ESC+v+y}function E(y,b){y=Math.floor(y);let v="";for(let _=0;_<y;_++)v+=b;return v}l.moveToCellSequence=function(y,b,v,_){const k=v.buffer.x,C=v.buffer.y;if(!v.buffer.hasScrollback)return(function(j,M,D,L,q,F){return g(M,L,q,F).length===0?"":E(x(j,M,j,M-p(M,q),!1,q).length,A("D",F))})(k,C,0,b,v,_)+g(C,b,v,_)+(function(j,M,D,L,q,F){let Y;Y=g(M,L,q,F).length>0?L-p(L,q):M;const Q=L,G=(function(ee,ne,z,B,$,H){let U;return U=g(z,B,$,H).length>0?B-p(B,$):ne,ee<z&&U<=B||ee>=z&&U<B?"C":"D"})(j,M,D,L,q,F);return E(x(j,Y,D,Q,G==="C",q).length,A(G,F))})(k,C,y,b,v,_);let w;if(C===b)return w=k>y?"D":"C",E(Math.abs(k-y),A(w,_));w=C>b?"D":"C";const T=Math.abs(C-b);return E((function(j,M){return M.cols-j})(C>b?y:k,v)+(T-1)*v.cols+1+((C>b?k:y)-1),A(w,_))}},1296:function(h,l,u){var m=this&&this.__decorate||function(F,Y,Q,G){var ee,ne=arguments.length,z=ne<3?Y:G===null?G=Object.getOwnPropertyDescriptor(Y,Q):G;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")z=Reflect.decorate(F,Y,Q,G);else for(var B=F.length-1;B>=0;B--)(ee=F[B])&&(z=(ne<3?ee(z):ne>3?ee(Y,Q,z):ee(Y,Q))||z);return ne>3&&z&&Object.defineProperty(Y,Q,z),z},g=this&&this.__param||function(F,Y){return function(Q,G){Y(Q,G,F)}};Object.defineProperty(l,"__esModule",{value:!0}),l.DomRenderer=void 0;const p=u(3787),S=u(2550),x=u(2223),A=u(6171),E=u(6052),y=u(4725),b=u(8055),v=u(8460),_=u(844),k=u(2585),C="xterm-dom-renderer-owner-",w="xterm-rows",T="xterm-fg-",j="xterm-bg-",M="xterm-focus",D="xterm-selection";let L=1,q=l.DomRenderer=class extends _.Disposable{constructor(F,Y,Q,G,ee,ne,z,B,$,H,U,P,W){super(),this._terminal=F,this._document=Y,this._element=Q,this._screenElement=G,this._viewportElement=ee,this._helperContainer=ne,this._linkifier2=z,this._charSizeService=$,this._optionsService=H,this._bufferService=U,this._coreBrowserService=P,this._themeService=W,this._terminalClass=L++,this._rowElements=[],this._selectionRenderModel=(0,E.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new v.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(w),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(D),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((se=>this._injectCss(se)))),this._injectCss(this._themeService.colors),this._rowFactory=B.createInstance(p.DomRendererRowFactory,document),this._element.classList.add(C+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((se=>this._handleLinkHover(se)))),this.register(this._linkifier2.onHideLinkUnderline((se=>this._handleLinkLeave(se)))),this.register((0,_.toDisposable)((()=>{this._element.classList.remove(C+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new S.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 F=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*F,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*F),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/F),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/F),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 Q of this._rowElements)Q.style.width=`${this.dimensions.css.canvas.width}px`,Q.style.height=`${this.dimensions.css.cell.height}px`,Q.style.lineHeight=`${this.dimensions.css.cell.height}px`,Q.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const Y=`${this._terminalSelector} .${w} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=Y,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(F){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let Y=`${this._terminalSelector} .${w} { color: ${F.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;Y+=`${this._terminalSelector} .${w} .xterm-dim { color: ${b.color.multiplyOpacity(F.foreground,.5).css};}`,Y+=`${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 Q=`blink_underline_${this._terminalClass}`,G=`blink_bar_${this._terminalClass}`,ee=`blink_block_${this._terminalClass}`;Y+=`@keyframes ${Q} { 50% { border-bottom-style: hidden; }}`,Y+=`@keyframes ${G} { 50% { box-shadow: none; }}`,Y+=`@keyframes ${ee} { 0% { background-color: ${F.cursor.css}; color: ${F.cursorAccent.css}; } 50% { background-color: inherit; color: ${F.cursor.css}; }}`,Y+=`${this._terminalSelector} .${w}.${M} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${Q} 1s step-end infinite;}${this._terminalSelector} .${w}.${M} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${G} 1s step-end infinite;}${this._terminalSelector} .${w}.${M} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${ee} 1s step-end infinite;}${this._terminalSelector} .${w} .xterm-cursor.xterm-cursor-block { background-color: ${F.cursor.css}; color: ${F.cursorAccent.css};}${this._terminalSelector} .${w} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${F.cursor.css} !important; color: ${F.cursorAccent.css} !important;}${this._terminalSelector} .${w} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${F.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${w} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${F.cursor.css} inset;}${this._terminalSelector} .${w} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${F.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,Y+=`${this._terminalSelector} .${D} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${D} div { position: absolute; background-color: ${F.selectionBackgroundOpaque.css};}${this._terminalSelector} .${D} div { position: absolute; background-color: ${F.selectionInactiveBackgroundOpaque.css};}`;for(const[ne,z]of F.ansi.entries())Y+=`${this._terminalSelector} .${T}${ne} { color: ${z.css}; }${this._terminalSelector} .${T}${ne}.xterm-dim { color: ${b.color.multiplyOpacity(z,.5).css}; }${this._terminalSelector} .${j}${ne} { background-color: ${z.css}; }`;Y+=`${this._terminalSelector} .${T}${x.INVERTED_DEFAULT_COLOR} { color: ${b.color.opaque(F.background).css}; }${this._terminalSelector} .${T}${x.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${b.color.multiplyOpacity(b.color.opaque(F.background),.5).css}; }${this._terminalSelector} .${j}${x.INVERTED_DEFAULT_COLOR} { background-color: ${F.foreground.css}; }`,this._themeStyleElement.textContent=Y}_setDefaultSpacing(){const F=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${F}px`,this._rowFactory.defaultSpacing=F}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(F,Y){for(let Q=this._rowElements.length;Q<=Y;Q++){const G=this._document.createElement("div");this._rowContainer.appendChild(G),this._rowElements.push(G)}for(;this._rowElements.length>Y;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(F,Y){this._refreshRowElements(F,Y),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(M),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(M),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(F,Y,Q){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(F,Y,Q),this.renderRows(0,this._bufferService.rows-1),!F||!Y)return;this._selectionRenderModel.update(this._terminal,F,Y,Q);const G=this._selectionRenderModel.viewportStartRow,ee=this._selectionRenderModel.viewportEndRow,ne=this._selectionRenderModel.viewportCappedStartRow,z=this._selectionRenderModel.viewportCappedEndRow;if(ne>=this._bufferService.rows||z<0)return;const B=this._document.createDocumentFragment();if(Q){const $=F[0]>Y[0];B.appendChild(this._createSelectionElement(ne,$?Y[0]:F[0],$?F[0]:Y[0],z-ne+1))}else{const $=G===ne?F[0]:0,H=ne===ee?Y[0]:this._bufferService.cols;B.appendChild(this._createSelectionElement(ne,$,H));const U=z-ne-1;if(B.appendChild(this._createSelectionElement(ne+1,0,this._bufferService.cols,U)),ne!==z){const P=ee===z?Y[0]:this._bufferService.cols;B.appendChild(this._createSelectionElement(z,0,P))}}this._selectionContainer.appendChild(B)}_createSelectionElement(F,Y,Q,G=1){const ee=this._document.createElement("div"),ne=Y*this.dimensions.css.cell.width;let z=this.dimensions.css.cell.width*(Q-Y);return ne+z>this.dimensions.css.canvas.width&&(z=this.dimensions.css.canvas.width-ne),ee.style.height=G*this.dimensions.css.cell.height+"px",ee.style.top=F*this.dimensions.css.cell.height+"px",ee.style.left=`${ne}px`,ee.style.width=`${z}px`,ee}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 F of this._rowElements)F.replaceChildren()}renderRows(F,Y){const Q=this._bufferService.buffer,G=Q.ybase+Q.y,ee=Math.min(Q.x,this._bufferService.cols-1),ne=this._optionsService.rawOptions.cursorBlink,z=this._optionsService.rawOptions.cursorStyle,B=this._optionsService.rawOptions.cursorInactiveStyle;for(let $=F;$<=Y;$++){const H=$+Q.ydisp,U=this._rowElements[$],P=Q.lines.get(H);if(!U||!P)break;U.replaceChildren(...this._rowFactory.createRow(P,H,H===G,z,B,ee,ne,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${C}${this._terminalClass}`}_handleLinkHover(F){this._setCellUnderline(F.x1,F.x2,F.y1,F.y2,F.cols,!0)}_handleLinkLeave(F){this._setCellUnderline(F.x1,F.x2,F.y1,F.y2,F.cols,!1)}_setCellUnderline(F,Y,Q,G,ee,ne){Q<0&&(F=0),G<0&&(Y=0);const z=this._bufferService.rows-1;Q=Math.max(Math.min(Q,z),0),G=Math.max(Math.min(G,z),0),ee=Math.min(ee,this._bufferService.cols);const B=this._bufferService.buffer,$=B.ybase+B.y,H=Math.min(B.x,ee-1),U=this._optionsService.rawOptions.cursorBlink,P=this._optionsService.rawOptions.cursorStyle,W=this._optionsService.rawOptions.cursorInactiveStyle;for(let se=Q;se<=G;++se){const X=se+B.ydisp,V=this._rowElements[se],ue=B.lines.get(X);if(!V||!ue)break;V.replaceChildren(...this._rowFactory.createRow(ue,X,X===$,P,W,H,U,this.dimensions.css.cell.width,this._widthCache,ne?se===Q?F:0:-1,ne?(se===G?Y:ee)-1:-1))}}};l.DomRenderer=q=m([g(7,k.IInstantiationService),g(8,y.ICharSizeService),g(9,k.IOptionsService),g(10,k.IBufferService),g(11,y.ICoreBrowserService),g(12,y.IThemeService)],q)},3787:function(h,l,u){var m=this&&this.__decorate||function(w,T,j,M){var D,L=arguments.length,q=L<3?T:M===null?M=Object.getOwnPropertyDescriptor(T,j):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")q=Reflect.decorate(w,T,j,M);else for(var F=w.length-1;F>=0;F--)(D=w[F])&&(q=(L<3?D(q):L>3?D(T,j,q):D(T,j))||q);return L>3&&q&&Object.defineProperty(T,j,q),q},g=this&&this.__param||function(w,T){return function(j,M){T(j,M,w)}};Object.defineProperty(l,"__esModule",{value:!0}),l.DomRendererRowFactory=void 0;const p=u(2223),S=u(643),x=u(511),A=u(2585),E=u(8055),y=u(4725),b=u(4269),v=u(6171),_=u(3734);let k=l.DomRendererRowFactory=class{constructor(w,T,j,M,D,L,q){this._document=w,this._characterJoinerService=T,this._optionsService=j,this._coreBrowserService=M,this._coreService=D,this._decorationService=L,this._themeService=q,this._workCell=new x.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(w,T,j){this._selectionStart=w,this._selectionEnd=T,this._columnSelectMode=j}createRow(w,T,j,M,D,L,q,F,Y,Q,G){const ee=[],ne=this._characterJoinerService.getJoinedCharacters(T),z=this._themeService.colors;let B,$=w.getNoBgTrimmedLength();j&&$<L+1&&($=L+1);let H=0,U="",P=0,W=0,se=0,X=!1,V=0,ue=!1,oe=0;const Z=[],te=Q!==-1&&G!==-1;for(let pe=0;pe<$;pe++){w.loadCell(pe,this._workCell);let ye=this._workCell.getWidth();if(ye===0)continue;let ke=!1,Le=pe,Ie=this._workCell;if(ne.length>0&&pe===ne[0][0]){ke=!0;const vt=ne.shift();Ie=new b.JoinedCellData(this._workCell,w.translateToString(!0,vt[0],vt[1]),vt[1]-vt[0]),Le=vt[1]-1,ye=Ie.getWidth()}const qe=this._isCellInSelection(pe,T),Re=j&&pe===L,He=te&&pe>=Q&&pe<=G;let Ke=!1;this._decorationService.forEachDecorationAtCell(pe,T,void 0,(vt=>{Ke=!0}));let kt=Ie.getChars()||S.WHITESPACE_CELL_CHAR;if(kt===" "&&(Ie.isUnderline()||Ie.isOverline())&&(kt=" "),oe=ye*F-Y.get(kt,Ie.isBold(),Ie.isItalic()),B){if(H&&(qe&&ue||!qe&&!ue&&Ie.bg===P)&&(qe&&ue&&z.selectionForeground||Ie.fg===W)&&Ie.extended.ext===se&&He===X&&oe===V&&!Re&&!ke&&!Ke){Ie.isInvisible()?U+=S.WHITESPACE_CELL_CHAR:U+=kt,H++;continue}H&&(B.textContent=U),B=this._document.createElement("span"),H=0,U=""}else B=this._document.createElement("span");if(P=Ie.bg,W=Ie.fg,se=Ie.extended.ext,X=He,V=oe,ue=qe,ke&&L>=pe&&L<=Le&&(L=pe),!this._coreService.isCursorHidden&&Re&&this._coreService.isCursorInitialized){if(Z.push("xterm-cursor"),this._coreBrowserService.isFocused)q&&Z.push("xterm-cursor-blink"),Z.push(M==="bar"?"xterm-cursor-bar":M==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(D)switch(D){case"outline":Z.push("xterm-cursor-outline");break;case"block":Z.push("xterm-cursor-block");break;case"bar":Z.push("xterm-cursor-bar");break;case"underline":Z.push("xterm-cursor-underline")}}if(Ie.isBold()&&Z.push("xterm-bold"),Ie.isItalic()&&Z.push("xterm-italic"),Ie.isDim()&&Z.push("xterm-dim"),U=Ie.isInvisible()?S.WHITESPACE_CELL_CHAR:Ie.getChars()||S.WHITESPACE_CELL_CHAR,Ie.isUnderline()&&(Z.push(`xterm-underline-${Ie.extended.underlineStyle}`),U===" "&&(U=" "),!Ie.isUnderlineColorDefault()))if(Ie.isUnderlineColorRGB())B.style.textDecorationColor=`rgb(${_.AttributeData.toColorRGB(Ie.getUnderlineColor()).join(",")})`;else{let vt=Ie.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Ie.isBold()&&vt<8&&(vt+=8),B.style.textDecorationColor=z.ansi[vt].css}Ie.isOverline()&&(Z.push("xterm-overline"),U===" "&&(U=" ")),Ie.isStrikethrough()&&Z.push("xterm-strikethrough"),He&&(B.style.textDecoration="underline");let ot=Ie.getFgColor(),Ct=Ie.getFgColorMode(),wt=Ie.getBgColor(),Mt=Ie.getBgColorMode();const jt=!!Ie.isInverse();if(jt){const vt=ot;ot=wt,wt=vt;const Ds=Ct;Ct=Mt,Mt=Ds}let Lt,ss,as,os=!1;switch(this._decorationService.forEachDecorationAtCell(pe,T,void 0,(vt=>{vt.options.layer!=="top"&&os||(vt.backgroundColorRGB&&(Mt=50331648,wt=vt.backgroundColorRGB.rgba>>8&16777215,Lt=vt.backgroundColorRGB),vt.foregroundColorRGB&&(Ct=50331648,ot=vt.foregroundColorRGB.rgba>>8&16777215,ss=vt.foregroundColorRGB),os=vt.options.layer==="top")})),!os&&qe&&(Lt=this._coreBrowserService.isFocused?z.selectionBackgroundOpaque:z.selectionInactiveBackgroundOpaque,wt=Lt.rgba>>8&16777215,Mt=50331648,os=!0,z.selectionForeground&&(Ct=50331648,ot=z.selectionForeground.rgba>>8&16777215,ss=z.selectionForeground)),os&&Z.push("xterm-decoration-top"),Mt){case 16777216:case 33554432:as=z.ansi[wt],Z.push(`xterm-bg-${wt}`);break;case 50331648:as=E.channels.toColor(wt>>16,wt>>8&255,255&wt),this._addStyle(B,`background-color:#${C((wt>>>0).toString(16),"0",6)}`);break;default:jt?(as=z.foreground,Z.push(`xterm-bg-${p.INVERTED_DEFAULT_COLOR}`)):as=z.background}switch(Lt||Ie.isDim()&&(Lt=E.color.multiplyOpacity(as,.5)),Ct){case 16777216:case 33554432:Ie.isBold()&&ot<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ot+=8),this._applyMinimumContrast(B,as,z.ansi[ot],Ie,Lt,void 0)||Z.push(`xterm-fg-${ot}`);break;case 50331648:const vt=E.channels.toColor(ot>>16&255,ot>>8&255,255&ot);this._applyMinimumContrast(B,as,vt,Ie,Lt,ss)||this._addStyle(B,`color:#${C(ot.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(B,as,z.foreground,Ie,Lt,ss)||jt&&Z.push(`xterm-fg-${p.INVERTED_DEFAULT_COLOR}`)}Z.length&&(B.className=Z.join(" "),Z.length=0),Re||ke||Ke?B.textContent=U:H++,oe!==this.defaultSpacing&&(B.style.letterSpacing=`${oe}px`),ee.push(B),pe=Le}return B&&H&&(B.textContent=U),ee}_applyMinimumContrast(w,T,j,M,D,L){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,v.treatGlyphAsBackgroundColor)(M.getCode()))return!1;const q=this._getContrastCache(M);let F;if(D||L||(F=q.getColor(T.rgba,j.rgba)),F===void 0){const Y=this._optionsService.rawOptions.minimumContrastRatio/(M.isDim()?2:1);F=E.color.ensureContrastRatio(D||T,L||j,Y),q.setColor((D||T).rgba,(L||j).rgba,F??null)}return!!F&&(this._addStyle(w,`color:${F.css}`),!0)}_getContrastCache(w){return w.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(w,T){w.setAttribute("style",`${w.getAttribute("style")||""}${T};`)}_isCellInSelection(w,T){const j=this._selectionStart,M=this._selectionEnd;return!(!j||!M)&&(this._columnSelectMode?j[0]<=M[0]?w>=j[0]&&T>=j[1]&&w<M[0]&&T<=M[1]:w<j[0]&&T>=j[1]&&w>=M[0]&&T<=M[1]:T>j[1]&&T<M[1]||j[1]===M[1]&&T===j[1]&&w>=j[0]&&w<M[0]||j[1]<M[1]&&T===M[1]&&w<M[0]||j[1]<M[1]&&T===j[1]&&w>=j[0])}};function C(w,T,j){for(;w.length<j;)w=T+w;return w}l.DomRendererRowFactory=k=m([g(1,y.ICharacterJoinerService),g(2,A.IOptionsService),g(3,y.ICoreBrowserService),g(4,A.ICoreService),g(5,A.IDecorationService),g(6,y.IThemeService)],k)},2550:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.WidthCache=void 0,l.WidthCache=class{constructor(u,m){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=u.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 g=u.createElement("span");g.classList.add("xterm-char-measure-element");const p=u.createElement("span");p.classList.add("xterm-char-measure-element"),p.style.fontWeight="bold";const S=u.createElement("span");S.classList.add("xterm-char-measure-element"),S.style.fontStyle="italic";const x=u.createElement("span");x.classList.add("xterm-char-measure-element"),x.style.fontWeight="bold",x.style.fontStyle="italic",this._measureElements=[g,p,S,x],this._container.appendChild(g),this._container.appendChild(p),this._container.appendChild(S),this._container.appendChild(x),m.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(u,m,g,p){u===this._font&&m===this._fontSize&&g===this._weight&&p===this._weightBold||(this._font=u,this._fontSize=m,this._weight=g,this._weightBold=p,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${g}`,this._measureElements[1].style.fontWeight=`${p}`,this._measureElements[2].style.fontWeight=`${g}`,this._measureElements[3].style.fontWeight=`${p}`,this.clear())}get(u,m,g){let p=0;if(!m&&!g&&u.length===1&&(p=u.charCodeAt(0))<256){if(this._flat[p]!==-9999)return this._flat[p];const A=this._measure(u,0);return A>0&&(this._flat[p]=A),A}let S=u;m&&(S+="B"),g&&(S+="I");let x=this._holey.get(S);if(x===void 0){let A=0;m&&(A|=1),g&&(A|=2),x=this._measure(u,A),x>0&&this._holey.set(S,x)}return x}_measure(u,m){const g=this._measureElements[m];return g.textContent=u.repeat(32),g.offsetWidth/32}}},2223:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.TEXT_BASELINE=l.DIM_OPACITY=l.INVERTED_DEFAULT_COLOR=void 0;const m=u(6114);l.INVERTED_DEFAULT_COLOR=257,l.DIM_OPACITY=.5,l.TEXT_BASELINE=m.isFirefox||m.isLegacyEdge?"bottom":"ideographic"},6171:(h,l)=>{function u(g){return 57508<=g&&g<=57558}function m(g){return g>=128512&&g<=128591||g>=127744&&g<=128511||g>=128640&&g<=128767||g>=9728&&g<=9983||g>=9984&&g<=10175||g>=65024&&g<=65039||g>=129280&&g<=129535||g>=127462&&g<=127487}Object.defineProperty(l,"__esModule",{value:!0}),l.computeNextVariantOffset=l.createRenderDimensions=l.treatGlyphAsBackgroundColor=l.allowRescaling=l.isEmoji=l.isRestrictedPowerlineGlyph=l.isPowerlineGlyph=l.throwIfFalsy=void 0,l.throwIfFalsy=function(g){if(!g)throw new Error("value must not be falsy");return g},l.isPowerlineGlyph=u,l.isRestrictedPowerlineGlyph=function(g){return 57520<=g&&g<=57527},l.isEmoji=m,l.allowRescaling=function(g,p,S,x){return p===1&&S>Math.ceil(1.5*x)&&g!==void 0&&g>255&&!m(g)&&!u(g)&&!(function(A){return 57344<=A&&A<=63743})(g)},l.treatGlyphAsBackgroundColor=function(g){return u(g)||(function(p){return 9472<=p&&p<=9631})(g)},l.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}}}},l.computeNextVariantOffset=function(g,p,S=0){return(g-(2*Math.round(p)-S))%(2*Math.round(p))}},6052:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.createSelectionRenderModel=void 0;class u{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(g,p,S,x=!1){if(this.selectionStart=p,this.selectionEnd=S,!p||!S||p[0]===S[0]&&p[1]===S[1])return void this.clear();const A=g.buffers.active.ydisp,E=p[1]-A,y=S[1]-A,b=Math.max(E,0),v=Math.min(y,g.rows-1);b>=g.rows||v<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=x,this.viewportStartRow=E,this.viewportEndRow=y,this.viewportCappedStartRow=b,this.viewportCappedEndRow=v,this.startCol=p[0],this.endCol=S[0])}isCellSelected(g,p,S){return!!this.hasSelection&&(S-=g.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?p>=this.startCol&&S>=this.viewportCappedStartRow&&p<this.endCol&&S<=this.viewportCappedEndRow:p<this.startCol&&S>=this.viewportCappedStartRow&&p>=this.endCol&&S<=this.viewportCappedEndRow:S>this.viewportStartRow&&S<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&S===this.viewportStartRow&&p>=this.startCol&&p<this.endCol||this.viewportStartRow<this.viewportEndRow&&S===this.viewportEndRow&&p<this.endCol||this.viewportStartRow<this.viewportEndRow&&S===this.viewportStartRow&&p>=this.startCol)}}l.createSelectionRenderModel=function(){return new u}},456:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.SelectionModel=void 0,l.SelectionModel=class{constructor(u){this._bufferService=u,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 u=this.selectionStart[0]+this.selectionStartLength;return u>this._bufferService.cols?u%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(u/this._bufferService.cols)-1]:[u%this._bufferService.cols,this.selectionStart[1]+Math.floor(u/this._bufferService.cols)]:[u,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const u=this.selectionStart[0]+this.selectionStartLength;return u>this._bufferService.cols?[u%this._bufferService.cols,this.selectionStart[1]+Math.floor(u/this._bufferService.cols)]:[Math.max(u,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const u=this.selectionStart,m=this.selectionEnd;return!(!u||!m)&&(u[1]>m[1]||u[1]===m[1]&&u[0]>m[0])}handleTrim(u){return this.selectionStart&&(this.selectionStart[1]-=u),this.selectionEnd&&(this.selectionEnd[1]-=u),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(h,l,u){var m=this&&this.__decorate||function(v,_,k,C){var w,T=arguments.length,j=T<3?_:C===null?C=Object.getOwnPropertyDescriptor(_,k):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(v,_,k,C);else for(var M=v.length-1;M>=0;M--)(w=v[M])&&(j=(T<3?w(j):T>3?w(_,k,j):w(_,k))||j);return T>3&&j&&Object.defineProperty(_,k,j),j},g=this&&this.__param||function(v,_){return function(k,C){_(k,C,v)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CharSizeService=void 0;const p=u(2585),S=u(8460),x=u(844);let A=l.CharSizeService=class extends x.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(v,_,k){super(),this._optionsService=k,this.width=0,this.height=0,this._onCharSizeChange=this.register(new S.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new b(this._optionsService))}catch{this._measureStrategy=this.register(new y(v,_,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const v=this._measureStrategy.measure();v.width===this.width&&v.height===this.height||(this.width=v.width,this.height=v.height,this._onCharSizeChange.fire())}};l.CharSizeService=A=m([g(2,p.IOptionsService)],A);class E extends x.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 E{constructor(_,k,C){super(),this._document=_,this._parentElement=k,this._optionsService=C,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 E{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(h,l,u){var m=this&&this.__decorate||function(b,v,_,k){var C,w=arguments.length,T=w<3?v:k===null?k=Object.getOwnPropertyDescriptor(v,_):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(b,v,_,k);else for(var j=b.length-1;j>=0;j--)(C=b[j])&&(T=(w<3?C(T):w>3?C(v,_,T):C(v,_))||T);return w>3&&T&&Object.defineProperty(v,_,T),T},g=this&&this.__param||function(b,v){return function(_,k){v(_,k,b)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CharacterJoinerService=l.JoinedCellData=void 0;const p=u(3734),S=u(643),x=u(511),A=u(2585);class E extends p.AttributeData{constructor(v,_,k){super(),this.content=0,this.combinedData="",this.fg=v.fg,this.bg=v.bg,this.combinedData=_,this._width=k}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(v){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}l.JoinedCellData=E;let y=l.CharacterJoinerService=class H2{constructor(v){this._bufferService=v,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new x.CellData}register(v){const _={id:this._nextCharacterJoinerId++,handler:v};return this._characterJoiners.push(_),_.id}deregister(v){for(let _=0;_<this._characterJoiners.length;_++)if(this._characterJoiners[_].id===v)return this._characterJoiners.splice(_,1),!0;return!1}getJoinedCharacters(v){if(this._characterJoiners.length===0)return[];const _=this._bufferService.buffer.lines.get(v);if(!_||_.length===0)return[];const k=[],C=_.translateToString(!0);let w=0,T=0,j=0,M=_.getFg(0),D=_.getBg(0);for(let L=0;L<_.getTrimmedLength();L++)if(_.loadCell(L,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==M||this._workCell.bg!==D){if(L-w>1){const q=this._getJoinedRanges(C,j,T,_,w);for(let F=0;F<q.length;F++)k.push(q[F])}w=L,j=T,M=this._workCell.fg,D=this._workCell.bg}T+=this._workCell.getChars().length||S.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-w>1){const L=this._getJoinedRanges(C,j,T,_,w);for(let q=0;q<L.length;q++)k.push(L[q])}return k}_getJoinedRanges(v,_,k,C,w){const T=v.substring(_,k);let j=[];try{j=this._characterJoiners[0].handler(T)}catch(M){console.error(M)}for(let M=1;M<this._characterJoiners.length;M++)try{const D=this._characterJoiners[M].handler(T);for(let L=0;L<D.length;L++)H2._mergeRanges(j,D[L])}catch(D){console.error(D)}return this._stringRangesToCellRanges(j,C,w),j}_stringRangesToCellRanges(v,_,k){let C=0,w=!1,T=0,j=v[C];if(j){for(let M=k;M<this._bufferService.cols;M++){const D=_.getWidth(M),L=_.getString(M).length||S.WHITESPACE_CELL_CHAR.length;if(D!==0){if(!w&&j[0]<=T&&(j[0]=M,w=!0),j[1]<=T){if(j[1]=M,j=v[++C],!j)break;j[0]<=T?(j[0]=M,w=!0):w=!1}T+=L}}j&&(j[1]=this._bufferService.cols)}}static _mergeRanges(v,_){let k=!1;for(let C=0;C<v.length;C++){const w=v[C];if(k){if(_[1]<=w[0])return v[C-1][1]=_[1],v;if(_[1]<=w[1])return v[C-1][1]=Math.max(_[1],w[1]),v.splice(C,1),v;v.splice(C,1),C--}else{if(_[1]<=w[0])return v.splice(C,0,_),v;if(_[1]<=w[1])return w[0]=Math.min(_[0],w[0]),v;_[0]<w[1]&&(w[0]=Math.min(_[0],w[0]),k=!0)}}return k?v[v.length-1][1]=_[1]:v.push(_),v}};l.CharacterJoinerService=y=m([g(0,A.IBufferService)],y)},5114:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CoreBrowserService=void 0;const m=u(844),g=u(8460),p=u(3656);class S extends m.Disposable{constructor(E,y,b){super(),this._textarea=E,this._window=y,this.mainDocument=b,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new x(this._window),this._onDprChange=this.register(new g.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new g.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((v=>this._screenDprMonitor.setWindow(v)))),this.register((0,g.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(E){this._window!==E&&(this._window=E,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}}l.CoreBrowserService=S;class x extends m.Disposable{constructor(E){super(),this._parentWindow=E,this._windowResizeListener=this.register(new m.MutableDisposable),this._onDprChange=this.register(new g.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,m.toDisposable)((()=>this.clearListener())))}setWindow(E){this._parentWindow=E,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,p.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var E;this._outerListener&&((E=this._resolutionMediaMatchList)==null||E.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:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.LinkProviderService=void 0;const m=u(844);class g extends m.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,m.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(S){return this.linkProviders.push(S),{dispose:()=>{const x=this.linkProviders.indexOf(S);x!==-1&&this.linkProviders.splice(x,1)}}}}l.LinkProviderService=g},8934:function(h,l,u){var m=this&&this.__decorate||function(A,E,y,b){var v,_=arguments.length,k=_<3?E:b===null?b=Object.getOwnPropertyDescriptor(E,y):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(A,E,y,b);else for(var C=A.length-1;C>=0;C--)(v=A[C])&&(k=(_<3?v(k):_>3?v(E,y,k):v(E,y))||k);return _>3&&k&&Object.defineProperty(E,y,k),k},g=this&&this.__param||function(A,E){return function(y,b){E(y,b,A)}};Object.defineProperty(l,"__esModule",{value:!0}),l.MouseService=void 0;const p=u(4725),S=u(9806);let x=l.MouseService=class{constructor(A,E){this._renderService=A,this._charSizeService=E}getCoords(A,E,y,b,v){return(0,S.getCoords)(window,A,E,y,b,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,v)}getMouseReportCoords(A,E){const y=(0,S.getCoordsRelativeToElement)(window,A,E);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])}}};l.MouseService=x=m([g(0,p.IRenderService),g(1,p.ICharSizeService)],x)},3230:function(h,l,u){var m=this&&this.__decorate||function(v,_,k,C){var w,T=arguments.length,j=T<3?_:C===null?C=Object.getOwnPropertyDescriptor(_,k):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(v,_,k,C);else for(var M=v.length-1;M>=0;M--)(w=v[M])&&(j=(T<3?w(j):T>3?w(_,k,j):w(_,k))||j);return T>3&&j&&Object.defineProperty(_,k,j),j},g=this&&this.__param||function(v,_){return function(k,C){_(k,C,v)}};Object.defineProperty(l,"__esModule",{value:!0}),l.RenderService=void 0;const p=u(6193),S=u(4725),x=u(8460),A=u(844),E=u(7226),y=u(2585);let b=l.RenderService=class extends A.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(v,_,k,C,w,T,j,M){super(),this._rowCount=v,this._charSizeService=C,this._renderer=this.register(new A.MutableDisposable),this._pausedResizeTask=new E.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 x.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new x.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new x.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new x.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new p.RenderDebouncer(((D,L)=>this._renderRows(D,L)),j),this.register(this._renderDebouncer),this.register(j.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(T.onResize((()=>this._fullRefresh()))),this.register(T.buffers.onBufferActivate((()=>{var D;return(D=this._renderer.value)==null?void 0:D.clear()}))),this.register(k.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(w.onDecorationRegistered((()=>this._fullRefresh()))),this.register(w.onDecorationRemoved((()=>this._fullRefresh()))),this.register(k.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(T.cols,T.rows),this._fullRefresh()}))),this.register(k.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(T.buffer.y,T.buffer.y,!0)))),this.register(M.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(j.window,_),this.register(j.onWindowChange((D=>this._registerIntersectionObserver(D,_))))}_registerIntersectionObserver(v,_){if("IntersectionObserver"in v){const k=new v.IntersectionObserver((C=>this._handleIntersectionChange(C[C.length-1])),{threshold:0});k.observe(_),this._observerDisposable.value=(0,A.toDisposable)((()=>k.disconnect()))}}_handleIntersectionChange(v){this._isPaused=v.isIntersecting===void 0?v.intersectionRatio===0:!v.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(v,_,k=!1){this._isPaused?this._needsFullRefresh=!0:(k||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(v,_,this._rowCount))}_renderRows(v,_){this._renderer.value&&(v=Math.min(v,this._rowCount-1),_=Math.min(_,this._rowCount-1),this._renderer.value.renderRows(v,_),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:v,end:_}),this._onRender.fire({start:v,end:_}),this._isNextRenderRedrawOnly=!0)}resize(v,_){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(v){this._renderer.value=v,this._renderer.value&&(this._renderer.value.onRequestRedraw((_=>this.refreshRows(_.start,_.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(v){return this._renderDebouncer.addRefreshCallback(v)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var v,_;this._renderer.value&&((_=(v=this._renderer.value).clearTextureAtlas)==null||_.call(v),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(v,_){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var k;return(k=this._renderer.value)==null?void 0:k.handleResize(v,_)})):this._renderer.value.handleResize(v,_),this._fullRefresh())}handleCharSizeChanged(){var v;(v=this._renderer.value)==null||v.handleCharSizeChanged()}handleBlur(){var v;(v=this._renderer.value)==null||v.handleBlur()}handleFocus(){var v;(v=this._renderer.value)==null||v.handleFocus()}handleSelectionChanged(v,_,k){var C;this._selectionState.start=v,this._selectionState.end=_,this._selectionState.columnSelectMode=k,(C=this._renderer.value)==null||C.handleSelectionChanged(v,_,k)}handleCursorMove(){var v;(v=this._renderer.value)==null||v.handleCursorMove()}clear(){var v;(v=this._renderer.value)==null||v.clear()}};l.RenderService=b=m([g(2,y.IOptionsService),g(3,S.ICharSizeService),g(4,y.IDecorationService),g(5,y.IBufferService),g(6,S.ICoreBrowserService),g(7,S.IThemeService)],b)},9312:function(h,l,u){var m=this&&this.__decorate||function(j,M,D,L){var q,F=arguments.length,Y=F<3?M:L===null?L=Object.getOwnPropertyDescriptor(M,D):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Y=Reflect.decorate(j,M,D,L);else for(var Q=j.length-1;Q>=0;Q--)(q=j[Q])&&(Y=(F<3?q(Y):F>3?q(M,D,Y):q(M,D))||Y);return F>3&&Y&&Object.defineProperty(M,D,Y),Y},g=this&&this.__param||function(j,M){return function(D,L){M(D,L,j)}};Object.defineProperty(l,"__esModule",{value:!0}),l.SelectionService=void 0;const p=u(9806),S=u(9504),x=u(456),A=u(4725),E=u(8460),y=u(844),b=u(6114),v=u(4841),_=u(511),k=u(2585),C=" ",w=new RegExp(C,"g");let T=l.SelectionService=class extends y.Disposable{constructor(j,M,D,L,q,F,Y,Q,G){super(),this._element=j,this._screenElement=M,this._linkifier=D,this._bufferService=L,this._coreService=q,this._mouseService=F,this._optionsService=Y,this._renderService=Q,this._coreBrowserService=G,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 E.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new E.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new E.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new E.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=ee=>this._handleMouseMove(ee),this._mouseUpListener=ee=>this._handleMouseUp(ee),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((ee=>this._handleTrim(ee))),this.register(this._bufferService.buffers.onBufferActivate((ee=>this._handleBufferActivate(ee)))),this.enable(),this._model=new x.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 j=this._model.finalSelectionStart,M=this._model.finalSelectionEnd;return!(!j||!M||j[0]===M[0]&&j[1]===M[1])}get selectionText(){const j=this._model.finalSelectionStart,M=this._model.finalSelectionEnd;if(!j||!M)return"";const D=this._bufferService.buffer,L=[];if(this._activeSelectionMode===3){if(j[0]===M[0])return"";const q=j[0]<M[0]?j[0]:M[0],F=j[0]<M[0]?M[0]:j[0];for(let Y=j[1];Y<=M[1];Y++){const Q=D.translateBufferLineToString(Y,!0,q,F);L.push(Q)}}else{const q=j[1]===M[1]?M[0]:void 0;L.push(D.translateBufferLineToString(j[1],!0,j[0],q));for(let F=j[1]+1;F<=M[1]-1;F++){const Y=D.lines.get(F),Q=D.translateBufferLineToString(F,!0);Y!=null&&Y.isWrapped?L[L.length-1]+=Q:L.push(Q)}if(j[1]!==M[1]){const F=D.lines.get(M[1]),Y=D.translateBufferLineToString(M[1],!0,0,M[0]);F&&F.isWrapped?L[L.length-1]+=Y:L.push(Y)}}return L.map((q=>q.replace(w," "))).join(b.isWindows?`\r
|
|
498
|
+
`:`
|
|
499
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(j){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),b.isLinux&&j&&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(j){const M=this._getMouseBufferCoords(j),D=this._model.finalSelectionStart,L=this._model.finalSelectionEnd;return!!(D&&L&&M)&&this._areCoordsInSelection(M,D,L)}isCellInSelection(j,M){const D=this._model.finalSelectionStart,L=this._model.finalSelectionEnd;return!(!D||!L)&&this._areCoordsInSelection([j,M],D,L)}_areCoordsInSelection(j,M,D){return j[1]>M[1]&&j[1]<D[1]||M[1]===D[1]&&j[1]===M[1]&&j[0]>=M[0]&&j[0]<D[0]||M[1]<D[1]&&j[1]===D[1]&&j[0]<D[0]||M[1]<D[1]&&j[1]===M[1]&&j[0]>=M[0]}_selectWordAtCursor(j,M){var q,F;const D=(F=(q=this._linkifier.currentLink)==null?void 0:q.link)==null?void 0:F.range;if(D)return this._model.selectionStart=[D.start.x-1,D.start.y-1],this._model.selectionStartLength=(0,v.getRangeLength)(D,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const L=this._getMouseBufferCoords(j);return!!L&&(this._selectWordAt(L,M),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(j,M){this._model.clearSelection(),j=Math.max(j,0),M=Math.min(M,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,j],this._model.selectionEnd=[this._bufferService.cols,M],this.refresh(),this._onSelectionChange.fire()}_handleTrim(j){this._model.handleTrim(j)&&this.refresh()}_getMouseBufferCoords(j){const M=this._mouseService.getCoords(j,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(M)return M[0]--,M[1]--,M[1]+=this._bufferService.buffer.ydisp,M}_getMouseEventScrollAmount(j){let M=(0,p.getCoordsRelativeToElement)(this._coreBrowserService.window,j,this._screenElement)[1];const D=this._renderService.dimensions.css.canvas.height;return M>=0&&M<=D?0:(M>D&&(M-=D),M=Math.min(Math.max(M,-50),50),M/=50,M/Math.abs(M)+Math.round(14*M))}shouldForceSelection(j){return b.isMac?j.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:j.shiftKey}handleMouseDown(j){if(this._mouseDownTimeStamp=j.timeStamp,(j.button!==2||!this.hasSelection)&&j.button===0){if(!this._enabled){if(!this.shouldForceSelection(j))return;j.stopPropagation()}j.preventDefault(),this._dragScrollAmount=0,this._enabled&&j.shiftKey?this._handleIncrementalClick(j):j.detail===1?this._handleSingleClick(j):j.detail===2?this._handleDoubleClick(j):j.detail===3&&this._handleTripleClick(j),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(j){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(j))}_handleSingleClick(j){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(j)?3:0,this._model.selectionStart=this._getMouseBufferCoords(j),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const M=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);M&&M.length!==this._model.selectionStart[0]&&M.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(j){this._selectWordAtCursor(j,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(j){const M=this._getMouseBufferCoords(j);M&&(this._activeSelectionMode=2,this._selectLineAt(M[1]))}shouldColumnSelect(j){return j.altKey&&!(b.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(j){if(j.stopImmediatePropagation(),!this._model.selectionStart)return;const M=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(j),!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(j),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const D=this._bufferService.buffer;if(this._model.selectionEnd[1]<D.lines.length){const L=D.lines.get(this._model.selectionEnd[1]);L&&L.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}M&&M[0]===this._model.selectionEnd[0]&&M[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 j=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(j.ydisp+this._bufferService.rows,j.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=j.ydisp),this.refresh()}}_handleMouseUp(j){const M=j.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&M<500&&j.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const D=this._mouseService.getCoords(j,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(D&&D[0]!==void 0&&D[1]!==void 0){const L=(0,S.moveToCellSequence)(D[0]-1,D[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(L,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const j=this._model.finalSelectionStart,M=this._model.finalSelectionEnd,D=!(!j||!M||j[0]===M[0]&&j[1]===M[1]);D?j&&M&&(this._oldSelectionStart&&this._oldSelectionEnd&&j[0]===this._oldSelectionStart[0]&&j[1]===this._oldSelectionStart[1]&&M[0]===this._oldSelectionEnd[0]&&M[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(j,M,D)):this._oldHasSelection&&this._fireOnSelectionChange(j,M,D)}_fireOnSelectionChange(j,M,D){this._oldSelectionStart=j,this._oldSelectionEnd=M,this._oldHasSelection=D,this._onSelectionChange.fire()}_handleBufferActivate(j){this.clearSelection(),this._trimListener.dispose(),this._trimListener=j.activeBuffer.lines.onTrim((M=>this._handleTrim(M)))}_convertViewportColToCharacterIndex(j,M){let D=M;for(let L=0;M>=L;L++){const q=j.loadCell(L,this._workCell).getChars().length;this._workCell.getWidth()===0?D--:q>1&&M!==L&&(D+=q-1)}return D}setSelection(j,M,D){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[j,M],this._model.selectionStartLength=D,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(j){this._isClickInSelection(j)||(this._selectWordAtCursor(j,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(j,M,D=!0,L=!0){if(j[0]>=this._bufferService.cols)return;const q=this._bufferService.buffer,F=q.lines.get(j[1]);if(!F)return;const Y=q.translateBufferLineToString(j[1],!1);let Q=this._convertViewportColToCharacterIndex(F,j[0]),G=Q;const ee=j[0]-Q;let ne=0,z=0,B=0,$=0;if(Y.charAt(Q)===" "){for(;Q>0&&Y.charAt(Q-1)===" ";)Q--;for(;G<Y.length&&Y.charAt(G+1)===" ";)G++}else{let P=j[0],W=j[0];F.getWidth(P)===0&&(ne++,P--),F.getWidth(W)===2&&(z++,W++);const se=F.getString(W).length;for(se>1&&($+=se-1,G+=se-1);P>0&&Q>0&&!this._isCharWordSeparator(F.loadCell(P-1,this._workCell));){F.loadCell(P-1,this._workCell);const X=this._workCell.getChars().length;this._workCell.getWidth()===0?(ne++,P--):X>1&&(B+=X-1,Q-=X-1),Q--,P--}for(;W<F.length&&G+1<Y.length&&!this._isCharWordSeparator(F.loadCell(W+1,this._workCell));){F.loadCell(W+1,this._workCell);const X=this._workCell.getChars().length;this._workCell.getWidth()===2?(z++,W++):X>1&&($+=X-1,G+=X-1),G++,W++}}G++;let H=Q+ee-ne+B,U=Math.min(this._bufferService.cols,G-Q+ne+z-B-$);if(M||Y.slice(Q,G).trim()!==""){if(D&&H===0&&F.getCodePoint(0)!==32){const P=q.lines.get(j[1]-1);if(P&&F.isWrapped&&P.getCodePoint(this._bufferService.cols-1)!==32){const W=this._getWordAt([this._bufferService.cols-1,j[1]-1],!1,!0,!1);if(W){const se=this._bufferService.cols-W.start;H-=se,U+=se}}}if(L&&H+U===this._bufferService.cols&&F.getCodePoint(this._bufferService.cols-1)!==32){const P=q.lines.get(j[1]+1);if(P!=null&&P.isWrapped&&P.getCodePoint(0)!==32){const W=this._getWordAt([0,j[1]+1],!1,!1,!0);W&&(U+=W.length)}}return{start:H,length:U}}}_selectWordAt(j,M){const D=this._getWordAt(j,M);if(D){for(;D.start<0;)D.start+=this._bufferService.cols,j[1]--;this._model.selectionStart=[D.start,j[1]],this._model.selectionStartLength=D.length}}_selectToWordAt(j){const M=this._getWordAt(j,!0);if(M){let D=j[1];for(;M.start<0;)M.start+=this._bufferService.cols,D--;if(!this._model.areSelectionValuesReversed())for(;M.start+M.length>this._bufferService.cols;)M.length-=this._bufferService.cols,D++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?M.start:M.start+M.length,D]}}_isCharWordSeparator(j){return j.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(j.getChars())>=0}_selectLineAt(j){const M=this._bufferService.buffer.getWrappedRangeForLine(j),D={start:{x:0,y:M.first},end:{x:this._bufferService.cols-1,y:M.last}};this._model.selectionStart=[0,M.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,v.getRangeLength)(D,this._bufferService.cols)}};l.SelectionService=T=m([g(3,k.IBufferService),g(4,k.ICoreService),g(5,A.IMouseService),g(6,k.IOptionsService),g(7,A.IRenderService),g(8,A.ICoreBrowserService)],T)},4725:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ILinkProviderService=l.IThemeService=l.ICharacterJoinerService=l.ISelectionService=l.IRenderService=l.IMouseService=l.ICoreBrowserService=l.ICharSizeService=void 0;const m=u(8343);l.ICharSizeService=(0,m.createDecorator)("CharSizeService"),l.ICoreBrowserService=(0,m.createDecorator)("CoreBrowserService"),l.IMouseService=(0,m.createDecorator)("MouseService"),l.IRenderService=(0,m.createDecorator)("RenderService"),l.ISelectionService=(0,m.createDecorator)("SelectionService"),l.ICharacterJoinerService=(0,m.createDecorator)("CharacterJoinerService"),l.IThemeService=(0,m.createDecorator)("ThemeService"),l.ILinkProviderService=(0,m.createDecorator)("LinkProviderService")},6731:function(h,l,u){var m=this&&this.__decorate||function(T,j,M,D){var L,q=arguments.length,F=q<3?j:D===null?D=Object.getOwnPropertyDescriptor(j,M):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")F=Reflect.decorate(T,j,M,D);else for(var Y=T.length-1;Y>=0;Y--)(L=T[Y])&&(F=(q<3?L(F):q>3?L(j,M,F):L(j,M))||F);return q>3&&F&&Object.defineProperty(j,M,F),F},g=this&&this.__param||function(T,j){return function(M,D){j(M,D,T)}};Object.defineProperty(l,"__esModule",{value:!0}),l.ThemeService=l.DEFAULT_ANSI_COLORS=void 0;const p=u(7239),S=u(8055),x=u(8460),A=u(844),E=u(2585),y=S.css.toColor("#ffffff"),b=S.css.toColor("#000000"),v=S.css.toColor("#ffffff"),_=S.css.toColor("#000000"),k={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};l.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const T=[S.css.toColor("#2e3436"),S.css.toColor("#cc0000"),S.css.toColor("#4e9a06"),S.css.toColor("#c4a000"),S.css.toColor("#3465a4"),S.css.toColor("#75507b"),S.css.toColor("#06989a"),S.css.toColor("#d3d7cf"),S.css.toColor("#555753"),S.css.toColor("#ef2929"),S.css.toColor("#8ae234"),S.css.toColor("#fce94f"),S.css.toColor("#729fcf"),S.css.toColor("#ad7fa8"),S.css.toColor("#34e2e2"),S.css.toColor("#eeeeec")],j=[0,95,135,175,215,255];for(let M=0;M<216;M++){const D=j[M/36%6|0],L=j[M/6%6|0],q=j[M%6];T.push({css:S.channels.toCss(D,L,q),rgba:S.channels.toRgba(D,L,q)})}for(let M=0;M<24;M++){const D=8+10*M;T.push({css:S.channels.toCss(D,D,D),rgba:S.channels.toRgba(D,D,D)})}return T})());let C=l.ThemeService=class extends A.Disposable{get colors(){return this._colors}constructor(T){super(),this._optionsService=T,this._contrastCache=new p.ColorContrastCache,this._halfContrastCache=new p.ColorContrastCache,this._onChangeColors=this.register(new x.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:y,background:b,cursor:v,cursorAccent:_,selectionForeground:void 0,selectionBackgroundTransparent:k,selectionBackgroundOpaque:S.color.blend(b,k),selectionInactiveBackgroundTransparent:k,selectionInactiveBackgroundOpaque:S.color.blend(b,k),ansi:l.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(T={}){const j=this._colors;if(j.foreground=w(T.foreground,y),j.background=w(T.background,b),j.cursor=w(T.cursor,v),j.cursorAccent=w(T.cursorAccent,_),j.selectionBackgroundTransparent=w(T.selectionBackground,k),j.selectionBackgroundOpaque=S.color.blend(j.background,j.selectionBackgroundTransparent),j.selectionInactiveBackgroundTransparent=w(T.selectionInactiveBackground,j.selectionBackgroundTransparent),j.selectionInactiveBackgroundOpaque=S.color.blend(j.background,j.selectionInactiveBackgroundTransparent),j.selectionForeground=T.selectionForeground?w(T.selectionForeground,S.NULL_COLOR):void 0,j.selectionForeground===S.NULL_COLOR&&(j.selectionForeground=void 0),S.color.isOpaque(j.selectionBackgroundTransparent)&&(j.selectionBackgroundTransparent=S.color.opacity(j.selectionBackgroundTransparent,.3)),S.color.isOpaque(j.selectionInactiveBackgroundTransparent)&&(j.selectionInactiveBackgroundTransparent=S.color.opacity(j.selectionInactiveBackgroundTransparent,.3)),j.ansi=l.DEFAULT_ANSI_COLORS.slice(),j.ansi[0]=w(T.black,l.DEFAULT_ANSI_COLORS[0]),j.ansi[1]=w(T.red,l.DEFAULT_ANSI_COLORS[1]),j.ansi[2]=w(T.green,l.DEFAULT_ANSI_COLORS[2]),j.ansi[3]=w(T.yellow,l.DEFAULT_ANSI_COLORS[3]),j.ansi[4]=w(T.blue,l.DEFAULT_ANSI_COLORS[4]),j.ansi[5]=w(T.magenta,l.DEFAULT_ANSI_COLORS[5]),j.ansi[6]=w(T.cyan,l.DEFAULT_ANSI_COLORS[6]),j.ansi[7]=w(T.white,l.DEFAULT_ANSI_COLORS[7]),j.ansi[8]=w(T.brightBlack,l.DEFAULT_ANSI_COLORS[8]),j.ansi[9]=w(T.brightRed,l.DEFAULT_ANSI_COLORS[9]),j.ansi[10]=w(T.brightGreen,l.DEFAULT_ANSI_COLORS[10]),j.ansi[11]=w(T.brightYellow,l.DEFAULT_ANSI_COLORS[11]),j.ansi[12]=w(T.brightBlue,l.DEFAULT_ANSI_COLORS[12]),j.ansi[13]=w(T.brightMagenta,l.DEFAULT_ANSI_COLORS[13]),j.ansi[14]=w(T.brightCyan,l.DEFAULT_ANSI_COLORS[14]),j.ansi[15]=w(T.brightWhite,l.DEFAULT_ANSI_COLORS[15]),T.extendedAnsi){const M=Math.min(j.ansi.length-16,T.extendedAnsi.length);for(let D=0;D<M;D++)j.ansi[D+16]=w(T.extendedAnsi[D],l.DEFAULT_ANSI_COLORS[D+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(T){this._restoreColor(T),this._onChangeColors.fire(this.colors)}_restoreColor(T){if(T!==void 0)switch(T){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[T]=this._restoreColors.ansi[T]}else for(let j=0;j<this._restoreColors.ansi.length;++j)this._colors.ansi[j]=this._restoreColors.ansi[j]}modifyColors(T){T(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 w(T,j){if(T!==void 0)try{return S.css.toColor(T)}catch{}return j}l.ThemeService=C=m([g(0,E.IOptionsService)],C)},6349:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CircularList=void 0;const m=u(8460),g=u(844);class p extends g.Disposable{constructor(x){super(),this._maxLength=x,this.onDeleteEmitter=this.register(new m.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new m.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new m.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(x){if(this._maxLength===x)return;const A=new Array(x);for(let E=0;E<Math.min(x,this.length);E++)A[E]=this._array[this._getCyclicIndex(E)];this._array=A,this._maxLength=x,this._startIndex=0}get length(){return this._length}set length(x){if(x>this._length)for(let A=this._length;A<x;A++)this._array[A]=void 0;this._length=x}get(x){return this._array[this._getCyclicIndex(x)]}set(x,A){this._array[this._getCyclicIndex(x)]=A}push(x){this._array[this._getCyclicIndex(this._length)]=x,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(x,A,...E){if(A){for(let y=x;y<this._length-A;y++)this._array[this._getCyclicIndex(y)]=this._array[this._getCyclicIndex(y+A)];this._length-=A,this.onDeleteEmitter.fire({index:x,amount:A})}for(let y=this._length-1;y>=x;y--)this._array[this._getCyclicIndex(y+E.length)]=this._array[this._getCyclicIndex(y)];for(let y=0;y<E.length;y++)this._array[this._getCyclicIndex(x+y)]=E[y];if(E.length&&this.onInsertEmitter.fire({index:x,amount:E.length}),this._length+E.length>this._maxLength){const y=this._length+E.length-this._maxLength;this._startIndex+=y,this._length=this._maxLength,this.onTrimEmitter.fire(y)}else this._length+=E.length}trimStart(x){x>this._length&&(x=this._length),this._startIndex+=x,this._length-=x,this.onTrimEmitter.fire(x)}shiftElements(x,A,E){if(!(A<=0)){if(x<0||x>=this._length)throw new Error("start argument out of range");if(x+E<0)throw new Error("Cannot shift elements in list beyond index 0");if(E>0){for(let b=A-1;b>=0;b--)this.set(x+b+E,this.get(x+b));const y=x+A+E-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(x+y+E,this.get(x+y))}}_getCyclicIndex(x){return(this._startIndex+x)%this._maxLength}}l.CircularList=p},1439:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.clone=void 0,l.clone=function u(m,g=5){if(typeof m!="object")return m;const p=Array.isArray(m)?[]:{};for(const S in m)p[S]=g<=1?m[S]:m[S]&&u(m[S],g-1);return p}},8055:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.contrastRatio=l.toPaddedHex=l.rgba=l.rgb=l.css=l.color=l.channels=l.NULL_COLOR=void 0;let u=0,m=0,g=0,p=0;var S,x,A,E,y;function b(_){const k=_.toString(16);return k.length<2?"0"+k:k}function v(_,k){return _<k?(k+.05)/(_+.05):(_+.05)/(k+.05)}l.NULL_COLOR={css:"#00000000",rgba:0},(function(_){_.toCss=function(k,C,w,T){return T!==void 0?`#${b(k)}${b(C)}${b(w)}${b(T)}`:`#${b(k)}${b(C)}${b(w)}`},_.toRgba=function(k,C,w,T=255){return(k<<24|C<<16|w<<8|T)>>>0},_.toColor=function(k,C,w,T){return{css:_.toCss(k,C,w,T),rgba:_.toRgba(k,C,w,T)}}})(S||(l.channels=S={})),(function(_){function k(C,w){return p=Math.round(255*w),[u,m,g]=y.toChannels(C.rgba),{css:S.toCss(u,m,g,p),rgba:S.toRgba(u,m,g,p)}}_.blend=function(C,w){if(p=(255&w.rgba)/255,p===1)return{css:w.css,rgba:w.rgba};const T=w.rgba>>24&255,j=w.rgba>>16&255,M=w.rgba>>8&255,D=C.rgba>>24&255,L=C.rgba>>16&255,q=C.rgba>>8&255;return u=D+Math.round((T-D)*p),m=L+Math.round((j-L)*p),g=q+Math.round((M-q)*p),{css:S.toCss(u,m,g),rgba:S.toRgba(u,m,g)}},_.isOpaque=function(C){return(255&C.rgba)==255},_.ensureContrastRatio=function(C,w,T){const j=y.ensureContrastRatio(C.rgba,w.rgba,T);if(j)return S.toColor(j>>24&255,j>>16&255,j>>8&255)},_.opaque=function(C){const w=(255|C.rgba)>>>0;return[u,m,g]=y.toChannels(w),{css:S.toCss(u,m,g),rgba:w}},_.opacity=k,_.multiplyOpacity=function(C,w){return p=255&C.rgba,k(C,p*w/255)},_.toColorRGB=function(C){return[C.rgba>>24&255,C.rgba>>16&255,C.rgba>>8&255]}})(x||(l.color=x={})),(function(_){let k,C;try{const w=document.createElement("canvas");w.width=1,w.height=1;const T=w.getContext("2d",{willReadFrequently:!0});T&&(k=T,k.globalCompositeOperation="copy",C=k.createLinearGradient(0,0,1,1))}catch{}_.toColor=function(w){if(w.match(/#[\da-f]{3,8}/i))switch(w.length){case 4:return u=parseInt(w.slice(1,2).repeat(2),16),m=parseInt(w.slice(2,3).repeat(2),16),g=parseInt(w.slice(3,4).repeat(2),16),S.toColor(u,m,g);case 5:return u=parseInt(w.slice(1,2).repeat(2),16),m=parseInt(w.slice(2,3).repeat(2),16),g=parseInt(w.slice(3,4).repeat(2),16),p=parseInt(w.slice(4,5).repeat(2),16),S.toColor(u,m,g,p);case 7:return{css:w,rgba:(parseInt(w.slice(1),16)<<8|255)>>>0};case 9:return{css:w,rgba:parseInt(w.slice(1),16)>>>0}}const T=w.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(T)return u=parseInt(T[1]),m=parseInt(T[2]),g=parseInt(T[3]),p=Math.round(255*(T[5]===void 0?1:parseFloat(T[5]))),S.toColor(u,m,g,p);if(!k||!C)throw new Error("css.toColor: Unsupported css format");if(k.fillStyle=C,k.fillStyle=w,typeof k.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(k.fillRect(0,0,1,1),[u,m,g,p]=k.getImageData(0,0,1,1).data,p!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:S.toRgba(u,m,g,p),css:w}}})(A||(l.css=A={})),(function(_){function k(C,w,T){const j=C/255,M=w/255,D=T/255;return .2126*(j<=.03928?j/12.92:Math.pow((j+.055)/1.055,2.4))+.7152*(M<=.03928?M/12.92:Math.pow((M+.055)/1.055,2.4))+.0722*(D<=.03928?D/12.92:Math.pow((D+.055)/1.055,2.4))}_.relativeLuminance=function(C){return k(C>>16&255,C>>8&255,255&C)},_.relativeLuminance2=k})(E||(l.rgb=E={})),(function(_){function k(w,T,j){const M=w>>24&255,D=w>>16&255,L=w>>8&255;let q=T>>24&255,F=T>>16&255,Y=T>>8&255,Q=v(E.relativeLuminance2(q,F,Y),E.relativeLuminance2(M,D,L));for(;Q<j&&(q>0||F>0||Y>0);)q-=Math.max(0,Math.ceil(.1*q)),F-=Math.max(0,Math.ceil(.1*F)),Y-=Math.max(0,Math.ceil(.1*Y)),Q=v(E.relativeLuminance2(q,F,Y),E.relativeLuminance2(M,D,L));return(q<<24|F<<16|Y<<8|255)>>>0}function C(w,T,j){const M=w>>24&255,D=w>>16&255,L=w>>8&255;let q=T>>24&255,F=T>>16&255,Y=T>>8&255,Q=v(E.relativeLuminance2(q,F,Y),E.relativeLuminance2(M,D,L));for(;Q<j&&(q<255||F<255||Y<255);)q=Math.min(255,q+Math.ceil(.1*(255-q))),F=Math.min(255,F+Math.ceil(.1*(255-F))),Y=Math.min(255,Y+Math.ceil(.1*(255-Y))),Q=v(E.relativeLuminance2(q,F,Y),E.relativeLuminance2(M,D,L));return(q<<24|F<<16|Y<<8|255)>>>0}_.blend=function(w,T){if(p=(255&T)/255,p===1)return T;const j=T>>24&255,M=T>>16&255,D=T>>8&255,L=w>>24&255,q=w>>16&255,F=w>>8&255;return u=L+Math.round((j-L)*p),m=q+Math.round((M-q)*p),g=F+Math.round((D-F)*p),S.toRgba(u,m,g)},_.ensureContrastRatio=function(w,T,j){const M=E.relativeLuminance(w>>8),D=E.relativeLuminance(T>>8);if(v(M,D)<j){if(D<M){const F=k(w,T,j),Y=v(M,E.relativeLuminance(F>>8));if(Y<j){const Q=C(w,T,j);return Y>v(M,E.relativeLuminance(Q>>8))?F:Q}return F}const L=C(w,T,j),q=v(M,E.relativeLuminance(L>>8));if(q<j){const F=k(w,T,j);return q>v(M,E.relativeLuminance(F>>8))?L:F}return L}},_.reduceLuminance=k,_.increaseLuminance=C,_.toChannels=function(w){return[w>>24&255,w>>16&255,w>>8&255,255&w]}})(y||(l.rgba=y={})),l.toPaddedHex=b,l.contrastRatio=v},8969:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CoreTerminal=void 0;const m=u(844),g=u(2585),p=u(4348),S=u(7866),x=u(744),A=u(7302),E=u(6975),y=u(8460),b=u(1753),v=u(1480),_=u(7994),k=u(9282),C=u(5435),w=u(5981),T=u(2660);let j=!1;class M extends m.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new y.EventEmitter),this._onScroll.event((L=>{var q;(q=this._onScrollApi)==null||q.fire(L.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(L){for(const q in L)this.optionsService.options[q]=L[q]}constructor(L){super(),this._windowsWrappingHeuristics=this.register(new m.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 p.InstantiationService,this.optionsService=this.register(new A.OptionsService(L)),this._instantiationService.setService(g.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(x.BufferService)),this._instantiationService.setService(g.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(S.LogService)),this._instantiationService.setService(g.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(E.CoreService)),this._instantiationService.setService(g.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(b.CoreMouseService)),this._instantiationService.setService(g.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(v.UnicodeService)),this._instantiationService.setService(g.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(_.CharsetService),this._instantiationService.setService(g.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(T.OscLinkService),this._instantiationService.setService(g.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new C.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((q=>{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((q=>{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 w.WriteBuffer(((q,F)=>this._inputHandler.parse(q,F)))),this.register((0,y.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(L,q){this._writeBuffer.write(L,q)}writeSync(L,q){this._logService.logLevel<=g.LogLevelEnum.WARN&&!j&&(this._logService.warn("writeSync is unreliable and will be removed soon."),j=!0),this._writeBuffer.writeSync(L,q)}input(L,q=!0){this.coreService.triggerDataEvent(L,q)}resize(L,q){isNaN(L)||isNaN(q)||(L=Math.max(L,x.MINIMUM_COLS),q=Math.max(q,x.MINIMUM_ROWS),this._bufferService.resize(L,q))}scroll(L,q=!1){this._bufferService.scroll(L,q)}scrollLines(L,q,F){this._bufferService.scrollLines(L,q,F)}scrollPages(L){this.scrollLines(L*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(L){const q=L-this._bufferService.buffer.ydisp;q!==0&&this.scrollLines(q)}registerEscHandler(L,q){return this._inputHandler.registerEscHandler(L,q)}registerDcsHandler(L,q){return this._inputHandler.registerDcsHandler(L,q)}registerCsiHandler(L,q){return this._inputHandler.registerCsiHandler(L,q)}registerOscHandler(L,q){return this._inputHandler.registerOscHandler(L,q)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let L=!1;const q=this.optionsService.rawOptions.windowsPty;q&&q.buildNumber!==void 0&&q.buildNumber!==void 0?L=q.backend==="conpty"&&q.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(L=!0),L?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const L=[];L.push(this.onLineFeed(k.updateWindowsModeWrappedState.bind(null,this._bufferService))),L.push(this.registerCsiHandler({final:"H"},(()=>((0,k.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,m.toDisposable)((()=>{for(const q of L)q.dispose()}))}}}l.CoreTerminal=M},8460:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.runAndSubscribe=l.forwardEvent=l.EventEmitter=void 0,l.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=u=>(this._listeners.push(u),{dispose:()=>{if(!this._disposed){for(let m=0;m<this._listeners.length;m++)if(this._listeners[m]===u)return void this._listeners.splice(m,1)}}})),this._event}fire(u,m){const g=[];for(let p=0;p<this._listeners.length;p++)g.push(this._listeners[p]);for(let p=0;p<g.length;p++)g[p].call(void 0,u,m)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},l.forwardEvent=function(u,m){return u((g=>m.fire(g)))},l.runAndSubscribe=function(u,m){return m(void 0),u((g=>m(g)))}},5435:function(h,l,u){var m=this&&this.__decorate||function(ne,z,B,$){var H,U=arguments.length,P=U<3?z:$===null?$=Object.getOwnPropertyDescriptor(z,B):$;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")P=Reflect.decorate(ne,z,B,$);else for(var W=ne.length-1;W>=0;W--)(H=ne[W])&&(P=(U<3?H(P):U>3?H(z,B,P):H(z,B))||P);return U>3&&P&&Object.defineProperty(z,B,P),P},g=this&&this.__param||function(ne,z){return function(B,$){z(B,$,ne)}};Object.defineProperty(l,"__esModule",{value:!0}),l.InputHandler=l.WindowsOptionsReportType=void 0;const p=u(2584),S=u(7116),x=u(2015),A=u(844),E=u(482),y=u(8437),b=u(8460),v=u(643),_=u(511),k=u(3734),C=u(2585),w=u(1480),T=u(6242),j=u(6351),M=u(5941),D={"(":0,")":1,"*":2,"+":3,"-":1,".":2},L=131072;function q(ne,z){if(ne>24)return z.setWinLines||!1;switch(ne){case 1:return!!z.restoreWin;case 2:return!!z.minimizeWin;case 3:return!!z.setWinPosition;case 4:return!!z.setWinSizePixels;case 5:return!!z.raiseWin;case 6:return!!z.lowerWin;case 7:return!!z.refreshWin;case 8:return!!z.setWinSizeChars;case 9:return!!z.maximizeWin;case 10:return!!z.fullscreenWin;case 11:return!!z.getWinState;case 13:return!!z.getWinPosition;case 14:return!!z.getWinSizePixels;case 15:return!!z.getScreenSizePixels;case 16:return!!z.getCellSizePixels;case 18:return!!z.getWinSizeChars;case 19:return!!z.getScreenSizeChars;case 20:return!!z.getIconTitle;case 21:return!!z.getWinTitle;case 22:return!!z.pushTitle;case 23:return!!z.popTitle;case 24:return!!z.setWinLines}return!1}var F;(function(ne){ne[ne.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",ne[ne.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(F||(l.WindowsOptionsReportType=F={}));let Y=0;class Q extends A.Disposable{getAttrData(){return this._curAttrData}constructor(z,B,$,H,U,P,W,se,X=new x.EscapeSequenceParser){super(),this._bufferService=z,this._charsetService=B,this._coreService=$,this._logService=H,this._optionsService=U,this._oscLinkService=P,this._coreMouseService=W,this._unicodeService=se,this._parser=X,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new E.StringToUtf32,this._utf8Decoder=new E.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 G(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((V=>this._activeBuffer=V.activeBuffer))),this._parser.setCsiHandlerFallback(((V,ue)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(V),params:ue.toArray()})})),this._parser.setEscHandlerFallback((V=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(V)})})),this._parser.setExecuteHandlerFallback((V=>{this._logService.debug("Unknown EXECUTE code: ",{code:V})})),this._parser.setOscHandlerFallback(((V,ue,oe)=>{this._logService.debug("Unknown OSC code: ",{identifier:V,action:ue,data:oe})})),this._parser.setDcsHandlerFallback(((V,ue,oe)=>{ue==="HOOK"&&(oe=oe.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(V),action:ue,payload:oe})})),this._parser.setPrintHandler(((V,ue,oe)=>this.print(V,ue,oe))),this._parser.registerCsiHandler({final:"@"},(V=>this.insertChars(V))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(V=>this.scrollLeft(V))),this._parser.registerCsiHandler({final:"A"},(V=>this.cursorUp(V))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(V=>this.scrollRight(V))),this._parser.registerCsiHandler({final:"B"},(V=>this.cursorDown(V))),this._parser.registerCsiHandler({final:"C"},(V=>this.cursorForward(V))),this._parser.registerCsiHandler({final:"D"},(V=>this.cursorBackward(V))),this._parser.registerCsiHandler({final:"E"},(V=>this.cursorNextLine(V))),this._parser.registerCsiHandler({final:"F"},(V=>this.cursorPrecedingLine(V))),this._parser.registerCsiHandler({final:"G"},(V=>this.cursorCharAbsolute(V))),this._parser.registerCsiHandler({final:"H"},(V=>this.cursorPosition(V))),this._parser.registerCsiHandler({final:"I"},(V=>this.cursorForwardTab(V))),this._parser.registerCsiHandler({final:"J"},(V=>this.eraseInDisplay(V,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(V=>this.eraseInDisplay(V,!0))),this._parser.registerCsiHandler({final:"K"},(V=>this.eraseInLine(V,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(V=>this.eraseInLine(V,!0))),this._parser.registerCsiHandler({final:"L"},(V=>this.insertLines(V))),this._parser.registerCsiHandler({final:"M"},(V=>this.deleteLines(V))),this._parser.registerCsiHandler({final:"P"},(V=>this.deleteChars(V))),this._parser.registerCsiHandler({final:"S"},(V=>this.scrollUp(V))),this._parser.registerCsiHandler({final:"T"},(V=>this.scrollDown(V))),this._parser.registerCsiHandler({final:"X"},(V=>this.eraseChars(V))),this._parser.registerCsiHandler({final:"Z"},(V=>this.cursorBackwardTab(V))),this._parser.registerCsiHandler({final:"`"},(V=>this.charPosAbsolute(V))),this._parser.registerCsiHandler({final:"a"},(V=>this.hPositionRelative(V))),this._parser.registerCsiHandler({final:"b"},(V=>this.repeatPrecedingCharacter(V))),this._parser.registerCsiHandler({final:"c"},(V=>this.sendDeviceAttributesPrimary(V))),this._parser.registerCsiHandler({prefix:">",final:"c"},(V=>this.sendDeviceAttributesSecondary(V))),this._parser.registerCsiHandler({final:"d"},(V=>this.linePosAbsolute(V))),this._parser.registerCsiHandler({final:"e"},(V=>this.vPositionRelative(V))),this._parser.registerCsiHandler({final:"f"},(V=>this.hVPosition(V))),this._parser.registerCsiHandler({final:"g"},(V=>this.tabClear(V))),this._parser.registerCsiHandler({final:"h"},(V=>this.setMode(V))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(V=>this.setModePrivate(V))),this._parser.registerCsiHandler({final:"l"},(V=>this.resetMode(V))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(V=>this.resetModePrivate(V))),this._parser.registerCsiHandler({final:"m"},(V=>this.charAttributes(V))),this._parser.registerCsiHandler({final:"n"},(V=>this.deviceStatus(V))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(V=>this.deviceStatusPrivate(V))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(V=>this.softReset(V))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(V=>this.setCursorStyle(V))),this._parser.registerCsiHandler({final:"r"},(V=>this.setScrollRegion(V))),this._parser.registerCsiHandler({final:"s"},(V=>this.saveCursor(V))),this._parser.registerCsiHandler({final:"t"},(V=>this.windowOptions(V))),this._parser.registerCsiHandler({final:"u"},(V=>this.restoreCursor(V))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(V=>this.insertColumns(V))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(V=>this.deleteColumns(V))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(V=>this.selectProtected(V))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(V=>this.requestMode(V,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(V=>this.requestMode(V,!1))),this._parser.setExecuteHandler(p.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(p.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(p.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(p.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(p.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(p.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(p.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(p.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(p.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(p.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(p.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(p.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new T.OscHandler((V=>(this.setTitle(V),this.setIconName(V),!0)))),this._parser.registerOscHandler(1,new T.OscHandler((V=>this.setIconName(V)))),this._parser.registerOscHandler(2,new T.OscHandler((V=>this.setTitle(V)))),this._parser.registerOscHandler(4,new T.OscHandler((V=>this.setOrReportIndexedColor(V)))),this._parser.registerOscHandler(8,new T.OscHandler((V=>this.setHyperlink(V)))),this._parser.registerOscHandler(10,new T.OscHandler((V=>this.setOrReportFgColor(V)))),this._parser.registerOscHandler(11,new T.OscHandler((V=>this.setOrReportBgColor(V)))),this._parser.registerOscHandler(12,new T.OscHandler((V=>this.setOrReportCursorColor(V)))),this._parser.registerOscHandler(104,new T.OscHandler((V=>this.restoreIndexedColor(V)))),this._parser.registerOscHandler(110,new T.OscHandler((V=>this.restoreFgColor(V)))),this._parser.registerOscHandler(111,new T.OscHandler((V=>this.restoreBgColor(V)))),this._parser.registerOscHandler(112,new T.OscHandler((V=>this.restoreCursorColor(V)))),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 V in S.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:V},(()=>this.selectCharset("("+V))),this._parser.registerEscHandler({intermediates:")",final:V},(()=>this.selectCharset(")"+V))),this._parser.registerEscHandler({intermediates:"*",final:V},(()=>this.selectCharset("*"+V))),this._parser.registerEscHandler({intermediates:"+",final:V},(()=>this.selectCharset("+"+V))),this._parser.registerEscHandler({intermediates:"-",final:V},(()=>this.selectCharset("-"+V))),this._parser.registerEscHandler({intermediates:".",final:V},(()=>this.selectCharset("."+V))),this._parser.registerEscHandler({intermediates:"/",final:V},(()=>this.selectCharset("/"+V)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((V=>(this._logService.error("Parsing error: ",V),V))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new j.DcsHandler(((V,ue)=>this.requestStatusString(V,ue))))}_preserveStack(z,B,$,H){this._parseStack.paused=!0,this._parseStack.cursorStartX=z,this._parseStack.cursorStartY=B,this._parseStack.decodedLength=$,this._parseStack.position=H}_logSlowResolvingAsync(z){this._logService.logLevel<=C.LogLevelEnum.WARN&&Promise.race([z,new Promise(((B,$)=>setTimeout((()=>$("#SLOW_TIMEOUT")),5e3)))]).catch((B=>{if(B!=="#SLOW_TIMEOUT")throw B;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(z,B){let $,H=this._activeBuffer.x,U=this._activeBuffer.y,P=0;const W=this._parseStack.paused;if(W){if($=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,B))return this._logSlowResolvingAsync($),$;H=this._parseStack.cursorStartX,U=this._parseStack.cursorStartY,this._parseStack.paused=!1,z.length>L&&(P=this._parseStack.position+L)}if(this._logService.logLevel<=C.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof z=="string"?` "${z}"`:` "${Array.prototype.map.call(z,(V=>String.fromCharCode(V))).join("")}"`),typeof z=="string"?z.split("").map((V=>V.charCodeAt(0))):z),this._parseBuffer.length<z.length&&this._parseBuffer.length<L&&(this._parseBuffer=new Uint32Array(Math.min(z.length,L))),W||this._dirtyRowTracker.clearRange(),z.length>L)for(let V=P;V<z.length;V+=L){const ue=V+L<z.length?V+L:z.length,oe=typeof z=="string"?this._stringDecoder.decode(z.substring(V,ue),this._parseBuffer):this._utf8Decoder.decode(z.subarray(V,ue),this._parseBuffer);if($=this._parser.parse(this._parseBuffer,oe))return this._preserveStack(H,U,oe,V),this._logSlowResolvingAsync($),$}else if(!W){const V=typeof z=="string"?this._stringDecoder.decode(z,this._parseBuffer):this._utf8Decoder.decode(z,this._parseBuffer);if($=this._parser.parse(this._parseBuffer,V))return this._preserveStack(H,U,V,0),this._logSlowResolvingAsync($),$}this._activeBuffer.x===H&&this._activeBuffer.y===U||this._onCursorMove.fire();const se=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),X=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);X<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(X,this._bufferService.rows-1),Math.min(se,this._bufferService.rows-1))}print(z,B,$){let H,U;const P=this._charsetService.charset,W=this._optionsService.rawOptions.screenReaderMode,se=this._bufferService.cols,X=this._coreService.decPrivateModes.wraparound,V=this._coreService.modes.insertMode,ue=this._curAttrData;let oe=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&$-B>0&&oe.getWidth(this._activeBuffer.x-1)===2&&oe.setCellFromCodepoint(this._activeBuffer.x-1,0,1,ue);let Z=this._parser.precedingJoinState;for(let te=B;te<$;++te){if(H=z[te],H<127&&P){const Le=P[String.fromCharCode(H)];Le&&(H=Le.charCodeAt(0))}const pe=this._unicodeService.charProperties(H,Z);U=w.UnicodeService.extractWidth(pe);const ye=w.UnicodeService.extractShouldJoin(pe),ke=ye?w.UnicodeService.extractWidth(Z):0;if(Z=pe,W&&this._onA11yChar.fire((0,E.stringFromCodePoint)(H)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+U-ke>se){if(X){const Le=oe;let Ie=this._activeBuffer.x-ke;for(this._activeBuffer.x=ke,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),oe=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),ke>0&&oe instanceof y.BufferLine&&oe.copyCellsFrom(Le,Ie,0,ke,!1);Ie<se;)Le.setCellFromCodepoint(Ie++,0,1,ue)}else if(this._activeBuffer.x=se-1,U===2)continue}if(ye&&this._activeBuffer.x){const Le=oe.getWidth(this._activeBuffer.x-1)?1:2;oe.addCodepointToCell(this._activeBuffer.x-Le,H,U);for(let Ie=U-ke;--Ie>=0;)oe.setCellFromCodepoint(this._activeBuffer.x++,0,0,ue)}else if(V&&(oe.insertCells(this._activeBuffer.x,U-ke,this._activeBuffer.getNullCell(ue)),oe.getWidth(se-1)===2&&oe.setCellFromCodepoint(se-1,v.NULL_CELL_CODE,v.NULL_CELL_WIDTH,ue)),oe.setCellFromCodepoint(this._activeBuffer.x++,H,U,ue),U>0)for(;--U;)oe.setCellFromCodepoint(this._activeBuffer.x++,0,0,ue)}this._parser.precedingJoinState=Z,this._activeBuffer.x<se&&$-B>0&&oe.getWidth(this._activeBuffer.x)===0&&!oe.hasContent(this._activeBuffer.x)&&oe.setCellFromCodepoint(this._activeBuffer.x,0,1,ue),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(z,B){return z.final!=="t"||z.prefix||z.intermediates?this._parser.registerCsiHandler(z,B):this._parser.registerCsiHandler(z,($=>!q($.params[0],this._optionsService.rawOptions.windowOptions)||B($)))}registerDcsHandler(z,B){return this._parser.registerDcsHandler(z,new j.DcsHandler(B))}registerEscHandler(z,B){return this._parser.registerEscHandler(z,B)}registerOscHandler(z,B){return this._parser.registerOscHandler(z,new T.OscHandler(B))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var z;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&&((z=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&z.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);B.hasWidth(this._activeBuffer.x)&&!B.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const z=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-z),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(z=this._bufferService.cols-1){this._activeBuffer.x=Math.min(z,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(z,B){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=z,this._activeBuffer.y=this._activeBuffer.scrollTop+B):(this._activeBuffer.x=z,this._activeBuffer.y=B),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(z,B){this._restrictCursor(),this._setCursor(this._activeBuffer.x+z,this._activeBuffer.y+B)}cursorUp(z){const B=this._activeBuffer.y-this._activeBuffer.scrollTop;return B>=0?this._moveCursor(0,-Math.min(B,z.params[0]||1)):this._moveCursor(0,-(z.params[0]||1)),!0}cursorDown(z){const B=this._activeBuffer.scrollBottom-this._activeBuffer.y;return B>=0?this._moveCursor(0,Math.min(B,z.params[0]||1)):this._moveCursor(0,z.params[0]||1),!0}cursorForward(z){return this._moveCursor(z.params[0]||1,0),!0}cursorBackward(z){return this._moveCursor(-(z.params[0]||1),0),!0}cursorNextLine(z){return this.cursorDown(z),this._activeBuffer.x=0,!0}cursorPrecedingLine(z){return this.cursorUp(z),this._activeBuffer.x=0,!0}cursorCharAbsolute(z){return this._setCursor((z.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(z){return this._setCursor(z.length>=2?(z.params[1]||1)-1:0,(z.params[0]||1)-1),!0}charPosAbsolute(z){return this._setCursor((z.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(z){return this._moveCursor(z.params[0]||1,0),!0}linePosAbsolute(z){return this._setCursor(this._activeBuffer.x,(z.params[0]||1)-1),!0}vPositionRelative(z){return this._moveCursor(0,z.params[0]||1),!0}hVPosition(z){return this.cursorPosition(z),!0}tabClear(z){const B=z.params[0];return B===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:B===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(z){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let B=z.params[0]||1;for(;B--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(z){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let B=z.params[0]||1;for(;B--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(z){const B=z.params[0];return B===1&&(this._curAttrData.bg|=536870912),B!==2&&B!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(z,B,$,H=!1,U=!1){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+z);P.replaceCells(B,$,this._activeBuffer.getNullCell(this._eraseAttrData()),U),H&&(P.isWrapped=!1)}_resetBufferLine(z,B=!1){const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+z);$&&($.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),B),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+z),$.isWrapped=!1)}eraseInDisplay(z,B=!1){let $;switch(this._restrictCursor(this._bufferService.cols),z.params[0]){case 0:for($=this._activeBuffer.y,this._dirtyRowTracker.markDirty($),this._eraseInBufferLine($++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,B);$<this._bufferService.rows;$++)this._resetBufferLine($,B);this._dirtyRowTracker.markDirty($);break;case 1:for($=this._activeBuffer.y,this._dirtyRowTracker.markDirty($),this._eraseInBufferLine($,0,this._activeBuffer.x+1,!0,B),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get($+1).isWrapped=!1);$--;)this._resetBufferLine($,B);this._dirtyRowTracker.markDirty(0);break;case 2:for($=this._bufferService.rows,this._dirtyRowTracker.markDirty($-1);$--;)this._resetBufferLine($,B);this._dirtyRowTracker.markDirty(0);break;case 3:const H=this._activeBuffer.lines.length-this._bufferService.rows;H>0&&(this._activeBuffer.lines.trimStart(H),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-H,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-H,0),this._onScroll.fire(0))}return!0}eraseInLine(z,B=!1){switch(this._restrictCursor(this._bufferService.cols),z.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,B);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,B);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,B)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(z){this._restrictCursor();let B=z.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const $=this._activeBuffer.ybase+this._activeBuffer.y,H=this._bufferService.rows-1-this._activeBuffer.scrollBottom,U=this._bufferService.rows-1+this._activeBuffer.ybase-H+1;for(;B--;)this._activeBuffer.lines.splice(U-1,1),this._activeBuffer.lines.splice($,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(z){this._restrictCursor();let B=z.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const $=this._activeBuffer.ybase+this._activeBuffer.y;let H;for(H=this._bufferService.rows-1-this._activeBuffer.scrollBottom,H=this._bufferService.rows-1+this._activeBuffer.ybase-H;B--;)this._activeBuffer.lines.splice($,1),this._activeBuffer.lines.splice(H,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(z){this._restrictCursor();const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return B&&(B.insertCells(this._activeBuffer.x,z.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(z){this._restrictCursor();const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return B&&(B.deleteCells(this._activeBuffer.x,z.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(z){let B=z.params[0]||1;for(;B--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(z){let B=z.params[0]||1;for(;B--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(y.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(z){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const B=z.params[0]||1;for(let $=this._activeBuffer.scrollTop;$<=this._activeBuffer.scrollBottom;++$){const H=this._activeBuffer.lines.get(this._activeBuffer.ybase+$);H.deleteCells(0,B,this._activeBuffer.getNullCell(this._eraseAttrData())),H.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(z){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const B=z.params[0]||1;for(let $=this._activeBuffer.scrollTop;$<=this._activeBuffer.scrollBottom;++$){const H=this._activeBuffer.lines.get(this._activeBuffer.ybase+$);H.insertCells(0,B,this._activeBuffer.getNullCell(this._eraseAttrData())),H.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(z){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const B=z.params[0]||1;for(let $=this._activeBuffer.scrollTop;$<=this._activeBuffer.scrollBottom;++$){const H=this._activeBuffer.lines.get(this._activeBuffer.ybase+$);H.insertCells(this._activeBuffer.x,B,this._activeBuffer.getNullCell(this._eraseAttrData())),H.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(z){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const B=z.params[0]||1;for(let $=this._activeBuffer.scrollTop;$<=this._activeBuffer.scrollBottom;++$){const H=this._activeBuffer.lines.get(this._activeBuffer.ybase+$);H.deleteCells(this._activeBuffer.x,B,this._activeBuffer.getNullCell(this._eraseAttrData())),H.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(z){this._restrictCursor();const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return B&&(B.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(z.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(z){const B=this._parser.precedingJoinState;if(!B)return!0;const $=z.params[0]||1,H=w.UnicodeService.extractWidth(B),U=this._activeBuffer.x-H,P=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(U),W=new Uint32Array(P.length*$);let se=0;for(let V=0;V<P.length;){const ue=P.codePointAt(V)||0;W[se++]=ue,V+=ue>65535?2:1}let X=se;for(let V=1;V<$;++V)W.copyWithin(X,0,se),X+=se;return this.print(W,0,X),!0}sendDeviceAttributesPrimary(z){return z.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(p.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(p.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(z){return z.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(p.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(p.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(z.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(p.C0.ESC+"[>83;40003;0c")),!0}_is(z){return(this._optionsService.rawOptions.termName+"").indexOf(z)===0}setMode(z){for(let B=0;B<z.length;B++)switch(z.params[B]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(z){for(let B=0;B<z.length;B++)switch(z.params[B]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,S.DEFAULT_CHARSET),this._charsetService.setgCharset(1,S.DEFAULT_CHARSET),this._charsetService.setgCharset(2,S.DEFAULT_CHARSET),this._charsetService.setgCharset(3,S.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(z){for(let B=0;B<z.length;B++)switch(z.params[B]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(z){for(let B=0;B<z.length;B++)switch(z.params[B]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),z.params[B]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(z,B){const $=this._coreService.decPrivateModes,{activeProtocol:H,activeEncoding:U}=this._coreMouseService,P=this._coreService,{buffers:W,cols:se}=this._bufferService,{active:X,alt:V}=W,ue=this._optionsService.rawOptions,oe=ye=>ye?1:2,Z=z.params[0];return te=Z,pe=B?Z===2?4:Z===4?oe(P.modes.insertMode):Z===12?3:Z===20?oe(ue.convertEol):0:Z===1?oe($.applicationCursorKeys):Z===3?ue.windowOptions.setWinLines?se===80?2:se===132?1:0:0:Z===6?oe($.origin):Z===7?oe($.wraparound):Z===8?3:Z===9?oe(H==="X10"):Z===12?oe(ue.cursorBlink):Z===25?oe(!P.isCursorHidden):Z===45?oe($.reverseWraparound):Z===66?oe($.applicationKeypad):Z===67?4:Z===1e3?oe(H==="VT200"):Z===1002?oe(H==="DRAG"):Z===1003?oe(H==="ANY"):Z===1004?oe($.sendFocus):Z===1005?4:Z===1006?oe(U==="SGR"):Z===1015?4:Z===1016?oe(U==="SGR_PIXELS"):Z===1048?1:Z===47||Z===1047||Z===1049?oe(X===V):Z===2004?oe($.bracketedPasteMode):0,P.triggerDataEvent(`${p.C0.ESC}[${B?"":"?"}${te};${pe}$y`),!0;var te,pe}_updateAttrColor(z,B,$,H,U){return B===2?(z|=50331648,z&=-16777216,z|=k.AttributeData.fromColorRGB([$,H,U])):B===5&&(z&=-50331904,z|=33554432|255&$),z}_extractColor(z,B,$){const H=[0,0,-1,0,0,0];let U=0,P=0;do{if(H[P+U]=z.params[B+P],z.hasSubParams(B+P)){const W=z.getSubParams(B+P);let se=0;do H[1]===5&&(U=1),H[P+se+1+U]=W[se];while(++se<W.length&&se+P+1+U<H.length);break}if(H[1]===5&&P+U>=2||H[1]===2&&P+U>=5)break;H[1]&&(U=1)}while(++P+B<z.length&&P+U<H.length);for(let W=2;W<H.length;++W)H[W]===-1&&(H[W]=0);switch(H[0]){case 38:$.fg=this._updateAttrColor($.fg,H[1],H[3],H[4],H[5]);break;case 48:$.bg=this._updateAttrColor($.bg,H[1],H[3],H[4],H[5]);break;case 58:$.extended=$.extended.clone(),$.extended.underlineColor=this._updateAttrColor($.extended.underlineColor,H[1],H[3],H[4],H[5])}return P}_processUnderline(z,B){B.extended=B.extended.clone(),(!~z||z>5)&&(z=1),B.extended.underlineStyle=z,B.fg|=268435456,z===0&&(B.fg&=-268435457),B.updateExtended()}_processSGR0(z){z.fg=y.DEFAULT_ATTR_DATA.fg,z.bg=y.DEFAULT_ATTR_DATA.bg,z.extended=z.extended.clone(),z.extended.underlineStyle=0,z.extended.underlineColor&=-67108864,z.updateExtended()}charAttributes(z){if(z.length===1&&z.params[0]===0)return this._processSGR0(this._curAttrData),!0;const B=z.length;let $;const H=this._curAttrData;for(let U=0;U<B;U++)$=z.params[U],$>=30&&$<=37?(H.fg&=-50331904,H.fg|=16777216|$-30):$>=40&&$<=47?(H.bg&=-50331904,H.bg|=16777216|$-40):$>=90&&$<=97?(H.fg&=-50331904,H.fg|=16777224|$-90):$>=100&&$<=107?(H.bg&=-50331904,H.bg|=16777224|$-100):$===0?this._processSGR0(H):$===1?H.fg|=134217728:$===3?H.bg|=67108864:$===4?(H.fg|=268435456,this._processUnderline(z.hasSubParams(U)?z.getSubParams(U)[0]:1,H)):$===5?H.fg|=536870912:$===7?H.fg|=67108864:$===8?H.fg|=1073741824:$===9?H.fg|=2147483648:$===2?H.bg|=134217728:$===21?this._processUnderline(2,H):$===22?(H.fg&=-134217729,H.bg&=-134217729):$===23?H.bg&=-67108865:$===24?(H.fg&=-268435457,this._processUnderline(0,H)):$===25?H.fg&=-536870913:$===27?H.fg&=-67108865:$===28?H.fg&=-1073741825:$===29?H.fg&=2147483647:$===39?(H.fg&=-67108864,H.fg|=16777215&y.DEFAULT_ATTR_DATA.fg):$===49?(H.bg&=-67108864,H.bg|=16777215&y.DEFAULT_ATTR_DATA.bg):$===38||$===48||$===58?U+=this._extractColor(z,U,H):$===53?H.bg|=1073741824:$===55?H.bg&=-1073741825:$===59?(H.extended=H.extended.clone(),H.extended.underlineColor=-1,H.updateExtended()):$===100?(H.fg&=-67108864,H.fg|=16777215&y.DEFAULT_ATTR_DATA.fg,H.bg&=-67108864,H.bg|=16777215&y.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",$);return!0}deviceStatus(z){switch(z.params[0]){case 5:this._coreService.triggerDataEvent(`${p.C0.ESC}[0n`);break;case 6:const B=this._activeBuffer.y+1,$=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${p.C0.ESC}[${B};${$}R`)}return!0}deviceStatusPrivate(z){if(z.params[0]===6){const B=this._activeBuffer.y+1,$=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${p.C0.ESC}[?${B};${$}R`)}return!0}softReset(z){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(z){const B=z.params[0]||1;switch(B){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const $=B%2==1;return this._optionsService.options.cursorBlink=$,!0}setScrollRegion(z){const B=z.params[0]||1;let $;return(z.length<2||($=z.params[1])>this._bufferService.rows||$===0)&&($=this._bufferService.rows),$>B&&(this._activeBuffer.scrollTop=B-1,this._activeBuffer.scrollBottom=$-1,this._setCursor(0,0)),!0}windowOptions(z){if(!q(z.params[0],this._optionsService.rawOptions.windowOptions))return!0;const B=z.length>1?z.params[1]:0;switch(z.params[0]){case 14:B!==2&&this._onRequestWindowsOptionsReport.fire(F.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(F.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${p.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:B!==0&&B!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),B!==0&&B!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:B!==0&&B!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),B!==0&&B!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(z){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(z){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(z){return this._windowTitle=z,this._onTitleChange.fire(z),!0}setIconName(z){return this._iconName=z,!0}setOrReportIndexedColor(z){const B=[],$=z.split(";");for(;$.length>1;){const H=$.shift(),U=$.shift();if(/^\d+$/.exec(H)){const P=parseInt(H);if(ee(P))if(U==="?")B.push({type:0,index:P});else{const W=(0,M.parseColor)(U);W&&B.push({type:1,index:P,color:W})}}}return B.length&&this._onColor.fire(B),!0}setHyperlink(z){const B=z.split(";");return!(B.length<2)&&(B[1]?this._createHyperlink(B[0],B[1]):!B[0]&&this._finishHyperlink())}_createHyperlink(z,B){this._getCurrentLinkId()&&this._finishHyperlink();const $=z.split(":");let H;const U=$.findIndex((P=>P.startsWith("id=")));return U!==-1&&(H=$[U].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:H,uri:B}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(z,B){const $=z.split(";");for(let H=0;H<$.length&&!(B>=this._specialColors.length);++H,++B)if($[H]==="?")this._onColor.fire([{type:0,index:this._specialColors[B]}]);else{const U=(0,M.parseColor)($[H]);U&&this._onColor.fire([{type:1,index:this._specialColors[B],color:U}])}return!0}setOrReportFgColor(z){return this._setOrReportSpecialColor(z,0)}setOrReportBgColor(z){return this._setOrReportSpecialColor(z,1)}setOrReportCursorColor(z){return this._setOrReportSpecialColor(z,2)}restoreIndexedColor(z){if(!z)return this._onColor.fire([{type:2}]),!0;const B=[],$=z.split(";");for(let H=0;H<$.length;++H)if(/^\d+$/.exec($[H])){const U=parseInt($[H]);ee(U)&&B.push({type:2,index:U})}return B.length&&this._onColor.fire(B),!0}restoreFgColor(z){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(z){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(z){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,S.DEFAULT_CHARSET),!0}selectCharset(z){return z.length!==2?(this.selectDefaultCharset(),!0):(z[0]==="/"||this._charsetService.setgCharset(D[z[0]],S.CHARSETS[z[1]]||S.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 z=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,z,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(z){return this._charsetService.setgLevel(z),!0}screenAlignmentPattern(){const z=new _.CellData;z.content=4194373,z.fg=this._curAttrData.fg,z.bg=this._curAttrData.bg,this._setCursor(0,0);for(let B=0;B<this._bufferService.rows;++B){const $=this._activeBuffer.ybase+this._activeBuffer.y+B,H=this._activeBuffer.lines.get($);H&&(H.fill(z),H.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(z,B){const $=this._bufferService.buffer,H=this._optionsService.rawOptions;return(U=>(this._coreService.triggerDataEvent(`${p.C0.ESC}${U}${p.C0.ESC}\\`),!0))(z==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:z==='"p'?'P1$r61;1"p':z==="r"?`P1$r${$.scrollTop+1};${$.scrollBottom+1}r`:z==="m"?"P1$r0m":z===" q"?`P1$r${{block:2,underline:4,bar:6}[H.cursorStyle]-(H.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(z,B){this._dirtyRowTracker.markRangeDirty(z,B)}}l.InputHandler=Q;let G=class{constructor(ne){this._bufferService=ne,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(ne){ne<this.start?this.start=ne:ne>this.end&&(this.end=ne)}markRangeDirty(ne,z){ne>z&&(Y=ne,ne=z,z=Y),ne<this.start&&(this.start=ne),z>this.end&&(this.end=z)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function ee(ne){return 0<=ne&&ne<256}G=m([g(0,C.IBufferService)],G)},844:(h,l)=>{function u(m){for(const g of m)g.dispose();m.length=0}Object.defineProperty(l,"__esModule",{value:!0}),l.getDisposeArrayDisposable=l.disposeArray=l.toDisposable=l.MutableDisposable=l.Disposable=void 0,l.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const m of this._disposables)m.dispose();this._disposables.length=0}register(m){return this._disposables.push(m),m}unregister(m){const g=this._disposables.indexOf(m);g!==-1&&this._disposables.splice(g,1)}},l.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(m){var g;this._isDisposed||m===this._value||((g=this._value)==null||g.dispose(),this._value=m)}clear(){this.value=void 0}dispose(){var m;this._isDisposed=!0,(m=this._value)==null||m.dispose(),this._value=void 0}},l.toDisposable=function(m){return{dispose:m}},l.disposeArray=u,l.getDisposeArrayDisposable=function(m){return{dispose:()=>u(m)}}},1505:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.FourKeyMap=l.TwoKeyMap=void 0;class u{constructor(){this._data={}}set(g,p,S){this._data[g]||(this._data[g]={}),this._data[g][p]=S}get(g,p){return this._data[g]?this._data[g][p]:void 0}clear(){this._data={}}}l.TwoKeyMap=u,l.FourKeyMap=class{constructor(){this._data=new u}set(m,g,p,S,x){this._data.get(m,g)||this._data.set(m,g,new u),this._data.get(m,g).set(p,S,x)}get(m,g,p,S){var x;return(x=this._data.get(m,g))==null?void 0:x.get(p,S)}clear(){this._data.clear()}}},6114:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.isChromeOS=l.isLinux=l.isWindows=l.isIphone=l.isIpad=l.isMac=l.getSafariVersion=l.isSafari=l.isLegacyEdge=l.isFirefox=l.isNode=void 0,l.isNode=typeof process<"u"&&"title"in process;const u=l.isNode?"node":navigator.userAgent,m=l.isNode?"node":navigator.platform;l.isFirefox=u.includes("Firefox"),l.isLegacyEdge=u.includes("Edge"),l.isSafari=/^((?!chrome|android).)*safari/i.test(u),l.getSafariVersion=function(){if(!l.isSafari)return 0;const g=u.match(/Version\/(\d+)/);return g===null||g.length<2?0:parseInt(g[1])},l.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(m),l.isIpad=m==="iPad",l.isIphone=m==="iPhone",l.isWindows=["Windows","Win16","Win32","WinCE"].includes(m),l.isLinux=m.indexOf("Linux")>=0,l.isChromeOS=/\bCrOS\b/.test(u)},6106:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.SortedList=void 0;let u=0;l.SortedList=class{constructor(m){this._getKey=m,this._array=[]}clear(){this._array.length=0}insert(m){this._array.length!==0?(u=this._search(this._getKey(m)),this._array.splice(u,0,m)):this._array.push(m)}delete(m){if(this._array.length===0)return!1;const g=this._getKey(m);if(g===void 0||(u=this._search(g),u===-1)||this._getKey(this._array[u])!==g)return!1;do if(this._array[u]===m)return this._array.splice(u,1),!0;while(++u<this._array.length&&this._getKey(this._array[u])===g);return!1}*getKeyIterator(m){if(this._array.length!==0&&(u=this._search(m),!(u<0||u>=this._array.length)&&this._getKey(this._array[u])===m))do yield this._array[u];while(++u<this._array.length&&this._getKey(this._array[u])===m)}forEachByKey(m,g){if(this._array.length!==0&&(u=this._search(m),!(u<0||u>=this._array.length)&&this._getKey(this._array[u])===m))do g(this._array[u]);while(++u<this._array.length&&this._getKey(this._array[u])===m)}values(){return[...this._array].values()}_search(m){let g=0,p=this._array.length-1;for(;p>=g;){let S=g+p>>1;const x=this._getKey(this._array[S]);if(x>m)p=S-1;else{if(!(x<m)){for(;S>0&&this._getKey(this._array[S-1])===m;)S--;return S}g=S+1}}return g}}},7226:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DebouncedIdleTask=l.IdleTaskQueue=l.PriorityTaskQueue=void 0;const m=u(6114);class g{constructor(){this._tasks=[],this._i=0}enqueue(x){this._tasks.push(x),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(x){this._idleCallback=void 0;let A=0,E=0,y=x.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),E=Math.max(A,E),b=x.timeRemaining(),1.5*E>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 p extends g{_requestCallback(x){return setTimeout((()=>x(this._createDeadline(16))))}_cancelCallback(x){clearTimeout(x)}_createDeadline(x){const A=Date.now()+x;return{timeRemaining:()=>Math.max(0,A-Date.now())}}}l.PriorityTaskQueue=p,l.IdleTaskQueue=!m.isNode&&"requestIdleCallback"in window?class extends g{_requestCallback(S){return requestIdleCallback(S)}_cancelCallback(S){cancelIdleCallback(S)}}:p,l.DebouncedIdleTask=class{constructor(){this._queue=new l.IdleTaskQueue}set(S){this._queue.clear(),this._queue.enqueue(S)}flush(){this._queue.flush()}}},9282:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.updateWindowsModeWrappedState=void 0;const m=u(643);l.updateWindowsModeWrappedState=function(g){const p=g.buffer.lines.get(g.buffer.ybase+g.buffer.y-1),S=p==null?void 0:p.get(g.cols-1),x=g.buffer.lines.get(g.buffer.ybase+g.buffer.y);x&&S&&(x.isWrapped=S[m.CHAR_DATA_CODE_INDEX]!==m.NULL_CELL_CODE&&S[m.CHAR_DATA_CODE_INDEX]!==m.WHITESPACE_CELL_CODE)}},3734:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ExtendedAttrs=l.AttributeData=void 0;class u{constructor(){this.fg=0,this.bg=0,this.extended=new m}static toColorRGB(p){return[p>>>16&255,p>>>8&255,255&p]}static fromColorRGB(p){return(255&p[0])<<16|(255&p[1])<<8|255&p[2]}clone(){const p=new u;return p.fg=this.fg,p.bg=this.bg,p.extended=this.extended.clone(),p}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}}l.AttributeData=u;class m{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(p){this._ext=p}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(p){this._ext&=-469762049,this._ext|=p<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(p){this._ext&=-67108864,this._ext|=67108863&p}get urlId(){return this._urlId}set urlId(p){this._urlId=p}get underlineVariantOffset(){const p=(3758096384&this._ext)>>29;return p<0?4294967288^p:p}set underlineVariantOffset(p){this._ext&=536870911,this._ext|=p<<29&3758096384}constructor(p=0,S=0){this._ext=0,this._urlId=0,this._ext=p,this._urlId=S}clone(){return new m(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}l.ExtendedAttrs=m},9092:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Buffer=l.MAX_BUFFER_SIZE=void 0;const m=u(6349),g=u(7226),p=u(3734),S=u(8437),x=u(4634),A=u(511),E=u(643),y=u(4863),b=u(7116);l.MAX_BUFFER_SIZE=4294967295,l.Buffer=class{constructor(v,_,k){this._hasScrollback=v,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=S.DEFAULT_ATTR_DATA.clone(),this.savedCharset=b.DEFAULT_CHARSET,this.markers=[],this._nullCell=A.CellData.fromCharData([0,E.NULL_CELL_CHAR,E.NULL_CELL_WIDTH,E.NULL_CELL_CODE]),this._whitespaceCell=A.CellData.fromCharData([0,E.WHITESPACE_CELL_CHAR,E.WHITESPACE_CELL_WIDTH,E.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new g.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new m.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(v){return v?(this._nullCell.fg=v.fg,this._nullCell.bg=v.bg,this._nullCell.extended=v.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new p.ExtendedAttrs),this._nullCell}getWhitespaceCell(v){return v?(this._whitespaceCell.fg=v.fg,this._whitespaceCell.bg=v.bg,this._whitespaceCell.extended=v.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new p.ExtendedAttrs),this._whitespaceCell}getBlankLine(v,_){return new S.BufferLine(this._bufferService.cols,this.getNullCell(v),_)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const v=this.ybase+this.y-this.ydisp;return v>=0&&v<this._rows}_getCorrectBufferLength(v){if(!this._hasScrollback)return v;const _=v+this._optionsService.rawOptions.scrollback;return _>l.MAX_BUFFER_SIZE?l.MAX_BUFFER_SIZE:_}fillViewportRows(v){if(this.lines.length===0){v===void 0&&(v=S.DEFAULT_ATTR_DATA);let _=this._rows;for(;_--;)this.lines.push(this.getBlankLine(v))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new m.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(v,_){const k=this.getNullCell(S.DEFAULT_ATTR_DATA);let C=0;const w=this._getCorrectBufferLength(_);if(w>this.lines.maxLength&&(this.lines.maxLength=w),this.lines.length>0){if(this._cols<v)for(let j=0;j<this.lines.length;j++)C+=+this.lines.get(j).resize(v,k);let T=0;if(this._rows<_)for(let j=this._rows;j<_;j++)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 S.BufferLine(v,k)):this.ybase>0&&this.lines.length<=this.ybase+this.y+T+1?(this.ybase--,T++,this.ydisp>0&&this.ydisp--):this.lines.push(new S.BufferLine(v,k)));else for(let j=this._rows;j>_;j--)this.lines.length>_+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(w<this.lines.maxLength){const j=this.lines.length-w;j>0&&(this.lines.trimStart(j),this.ybase=Math.max(this.ybase-j,0),this.ydisp=Math.max(this.ydisp-j,0),this.savedY=Math.max(this.savedY-j,0)),this.lines.maxLength=w}this.x=Math.min(this.x,v-1),this.y=Math.min(this.y,_-1),T&&(this.y+=T),this.savedX=Math.min(this.savedX,v-1),this.scrollTop=0}if(this.scrollBottom=_-1,this._isReflowEnabled&&(this._reflow(v,_),this._cols>v))for(let T=0;T<this.lines.length;T++)C+=+this.lines.get(T).resize(v,k);this._cols=v,this._rows=_,this._memoryCleanupQueue.clear(),C>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let v=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,v=!1);let _=0;for(;this._memoryCleanupPosition<this.lines.length;)if(_+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),_>100)return!0;return v}get _isReflowEnabled(){const v=this._optionsService.rawOptions.windowsPty;return v&&v.buildNumber?this._hasScrollback&&v.backend==="conpty"&&v.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(v,_){this._cols!==v&&(v>this._cols?this._reflowLarger(v,_):this._reflowSmaller(v,_))}_reflowLarger(v,_){const k=(0,x.reflowLargerGetLinesToRemove)(this.lines,this._cols,v,this.ybase+this.y,this.getNullCell(S.DEFAULT_ATTR_DATA));if(k.length>0){const C=(0,x.reflowLargerCreateNewLayout)(this.lines,k);(0,x.reflowLargerApplyNewLayout)(this.lines,C.layout),this._reflowLargerAdjustViewport(v,_,C.countRemoved)}}_reflowLargerAdjustViewport(v,_,k){const C=this.getNullCell(S.DEFAULT_ATTR_DATA);let w=k;for(;w-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<_&&this.lines.push(new S.BufferLine(v,C))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-k,0)}_reflowSmaller(v,_){const k=this.getNullCell(S.DEFAULT_ATTR_DATA),C=[];let w=0;for(let T=this.lines.length-1;T>=0;T--){let j=this.lines.get(T);if(!j||!j.isWrapped&&j.getTrimmedLength()<=v)continue;const M=[j];for(;j.isWrapped&&T>0;)j=this.lines.get(--T),M.unshift(j);const D=this.ybase+this.y;if(D>=T&&D<T+M.length)continue;const L=M[M.length-1].getTrimmedLength(),q=(0,x.reflowSmallerGetNewLineLengths)(M,this._cols,v),F=q.length-M.length;let Y;Y=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+F):Math.max(0,this.lines.length-this.lines.maxLength+F);const Q=[];for(let $=0;$<F;$++){const H=this.getBlankLine(S.DEFAULT_ATTR_DATA,!0);Q.push(H)}Q.length>0&&(C.push({start:T+M.length+w,newLines:Q}),w+=Q.length),M.push(...Q);let G=q.length-1,ee=q[G];ee===0&&(G--,ee=q[G]);let ne=M.length-F-1,z=L;for(;ne>=0;){const $=Math.min(z,ee);if(M[G]===void 0)break;if(M[G].copyCellsFrom(M[ne],z-$,ee-$,$,!0),ee-=$,ee===0&&(G--,ee=q[G]),z-=$,z===0){ne--;const H=Math.max(ne,0);z=(0,x.getWrappedLineTrimmedLength)(M,H,this._cols)}}for(let $=0;$<M.length;$++)q[$]<v&&M[$].setCell(q[$],k);let B=F-Y;for(;B-- >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+w)-_&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+F,this.ybase+_-1)}if(C.length>0){const T=[],j=[];for(let G=0;G<this.lines.length;G++)j.push(this.lines.get(G));const M=this.lines.length;let D=M-1,L=0,q=C[L];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+w);let F=0;for(let G=Math.min(this.lines.maxLength-1,M+w-1);G>=0;G--)if(q&&q.start>D+F){for(let ee=q.newLines.length-1;ee>=0;ee--)this.lines.set(G--,q.newLines[ee]);G++,T.push({index:D+1,amount:q.newLines.length}),F+=q.newLines.length,q=C[++L]}else this.lines.set(G,j[D--]);let Y=0;for(let G=T.length-1;G>=0;G--)T[G].index+=Y,this.lines.onInsertEmitter.fire(T[G]),Y+=T[G].amount;const Q=Math.max(0,M+w-this.lines.maxLength);Q>0&&this.lines.onTrimEmitter.fire(Q)}}translateBufferLineToString(v,_,k=0,C){const w=this.lines.get(v);return w?w.translateToString(_,k,C):""}getWrappedRangeForLine(v){let _=v,k=v;for(;_>0&&this.lines.get(_).isWrapped;)_--;for(;k+1<this.lines.length&&this.lines.get(k+1).isWrapped;)k++;return{first:_,last:k}}setupTabStops(v){for(v!=null?this.tabs[v]||(v=this.prevStop(v)):(this.tabs={},v=0);v<this._cols;v+=this._optionsService.rawOptions.tabStopWidth)this.tabs[v]=!0}prevStop(v){for(v==null&&(v=this.x);!this.tabs[--v]&&v>0;);return v>=this._cols?this._cols-1:v<0?0:v}nextStop(v){for(v==null&&(v=this.x);!this.tabs[++v]&&v<this._cols;);return v>=this._cols?this._cols-1:v<0?0:v}clearMarkers(v){this._isClearing=!0;for(let _=0;_<this.markers.length;_++)this.markers[_].line===v&&(this.markers[_].dispose(),this.markers.splice(_--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let v=0;v<this.markers.length;v++)this.markers[v].dispose(),this.markers.splice(v--,1);this._isClearing=!1}addMarker(v){const _=new y.Marker(v);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(v){this._isClearing||this.markers.splice(this.markers.indexOf(v),1)}}},8437:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferLine=l.DEFAULT_ATTR_DATA=void 0;const m=u(3734),g=u(511),p=u(643),S=u(482);l.DEFAULT_ATTR_DATA=Object.freeze(new m.AttributeData);let x=0;class A{constructor(y,b,v=!1){this.isWrapped=v,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*y);const _=b||g.CellData.fromCharData([0,p.NULL_CELL_CHAR,p.NULL_CELL_WIDTH,p.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],v=2097151&b;return[this._data[3*y+1],2097152&b?this._combined[y]:v?(0,S.stringFromCodePoint)(v):"",b>>22,2097152&b?this._combined[y].charCodeAt(this._combined[y].length-1):v]}set(y,b){this._data[3*y+1]=b[p.CHAR_DATA_ATTR_INDEX],b[p.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[y]=b[1],this._data[3*y+0]=2097152|y|b[p.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*y+0]=b[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|b[p.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,S.stringFromCodePoint)(2097151&b):""}isProtected(y){return 536870912&this._data[3*y+2]}loadCell(y,b){return x=3*y,b.content=this._data[x+0],b.fg=this._data[x+1],b.bg=this._data[x+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,v,_){268435456&_.bg&&(this._extendedAttrs[y]=_.extended),this._data[3*y+0]=b|v<<22,this._data[3*y+1]=_.fg,this._data[3*y+2]=_.bg}addCodepointToCell(y,b,v){let _=this._data[3*y+0];2097152&_?this._combined[y]+=(0,S.stringFromCodePoint)(b):2097151&_?(this._combined[y]=(0,S.stringFromCodePoint)(2097151&_)+(0,S.stringFromCodePoint)(b),_&=-2097152,_|=2097152):_=b|4194304,v&&(_&=-12582913,_|=v<<22),this._data[3*y+0]=_}insertCells(y,b,v){if((y%=this.length)&&this.getWidth(y-1)===2&&this.setCellFromCodepoint(y-1,0,1,v),b<this.length-y){const _=new g.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,v)}else for(let _=y;_<this.length;++_)this.setCell(_,v);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,v)}deleteCells(y,b,v){if(y%=this.length,b<this.length-y){const _=new g.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,v)}else for(let _=y;_<this.length;++_)this.setCell(_,v);y&&this.getWidth(y-1)===2&&this.setCellFromCodepoint(y-1,0,1,v),this.getWidth(y)!==0||this.hasContent(y)||this.setCellFromCodepoint(y,0,1,v)}replaceCells(y,b,v,_=!1){if(_)for(y&&this.getWidth(y-1)===2&&!this.isProtected(y-1)&&this.setCellFromCodepoint(y-1,0,1,v),b<this.length&&this.getWidth(b-1)===2&&!this.isProtected(b)&&this.setCellFromCodepoint(b,0,1,v);y<b&&y<this.length;)this.isProtected(y)||this.setCell(y,v),y++;else for(y&&this.getWidth(y-1)===2&&this.setCellFromCodepoint(y-1,0,1,v),b<this.length&&this.getWidth(b-1)===2&&this.setCellFromCodepoint(b,0,1,v);y<b&&y<this.length;)this.setCell(y++,v)}resize(y,b){if(y===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const v=3*y;if(y>this.length){if(this._data.buffer.byteLength>=4*v)this._data=new Uint32Array(this._data.buffer,0,v);else{const _=new Uint32Array(v);_.set(this._data),this._data=_}for(let _=this.length;_<y;++_)this.setCell(_,b)}else{this._data=this._data.subarray(0,v);const _=Object.keys(this._combined);for(let C=0;C<_.length;C++){const w=parseInt(_[C],10);w>=y&&delete this._combined[w]}const k=Object.keys(this._extendedAttrs);for(let C=0;C<k.length;C++){const w=parseInt(k[C],10);w>=y&&delete this._extendedAttrs[w]}}return this.length=y,4*v*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 v=0;v<this.length;++v)this.isProtected(v)||this.setCell(v,y);else{this._combined={},this._extendedAttrs={};for(let v=0;v<this.length;++v)this.setCell(v,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,v,_,k){const C=y._data;if(k)for(let T=_-1;T>=0;T--){for(let j=0;j<3;j++)this._data[3*(v+T)+j]=C[3*(b+T)+j];268435456&C[3*(b+T)+2]&&(this._extendedAttrs[v+T]=y._extendedAttrs[b+T])}else for(let T=0;T<_;T++){for(let j=0;j<3;j++)this._data[3*(v+T)+j]=C[3*(b+T)+j];268435456&C[3*(b+T)+2]&&(this._extendedAttrs[v+T]=y._extendedAttrs[b+T])}const w=Object.keys(y._combined);for(let T=0;T<w.length;T++){const j=parseInt(w[T],10);j>=b&&(this._combined[j-b+v]=y._combined[j])}}translateToString(y,b,v,_){b=b??0,v=v??this.length,y&&(v=Math.min(v,this.getTrimmedLength())),_&&(_.length=0);let k="";for(;b<v;){const C=this._data[3*b+0],w=2097151&C,T=2097152&C?this._combined[b]:w?(0,S.stringFromCodePoint)(w):p.WHITESPACE_CELL_CHAR;if(k+=T,_)for(let j=0;j<T.length;++j)_.push(b);b+=C>>22||1}return _&&_.push(b),k}}l.BufferLine=A},4841:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.getRangeLength=void 0,l.getRangeLength=function(u,m){if(u.start.y>u.end.y)throw new Error(`Buffer range end (${u.end.x}, ${u.end.y}) cannot be before start (${u.start.x}, ${u.start.y})`);return m*(u.end.y-u.start.y)+(u.end.x-u.start.x+1)}},4634:(h,l)=>{function u(m,g,p){if(g===m.length-1)return m[g].getTrimmedLength();const S=!m[g].hasContent(p-1)&&m[g].getWidth(p-1)===1,x=m[g+1].getWidth(0)===2;return S&&x?p-1:p}Object.defineProperty(l,"__esModule",{value:!0}),l.getWrappedLineTrimmedLength=l.reflowSmallerGetNewLineLengths=l.reflowLargerApplyNewLayout=l.reflowLargerCreateNewLayout=l.reflowLargerGetLinesToRemove=void 0,l.reflowLargerGetLinesToRemove=function(m,g,p,S,x){const A=[];for(let E=0;E<m.length-1;E++){let y=E,b=m.get(++y);if(!b.isWrapped)continue;const v=[m.get(E)];for(;y<m.length&&b.isWrapped;)v.push(b),b=m.get(++y);if(S>=E&&S<y){E+=v.length-1;continue}let _=0,k=u(v,_,g),C=1,w=0;for(;C<v.length;){const j=u(v,C,g),M=j-w,D=p-k,L=Math.min(M,D);v[_].copyCellsFrom(v[C],w,k,L,!1),k+=L,k===p&&(_++,k=0),w+=L,w===j&&(C++,w=0),k===0&&_!==0&&v[_-1].getWidth(p-1)===2&&(v[_].copyCellsFrom(v[_-1],p-1,k++,1,!1),v[_-1].setCell(p-1,x))}v[_].replaceCells(k,p,x);let T=0;for(let j=v.length-1;j>0&&(j>_||v[j].getTrimmedLength()===0);j--)T++;T>0&&(A.push(E+v.length-T),A.push(T)),E+=v.length-1}return A},l.reflowLargerCreateNewLayout=function(m,g){const p=[];let S=0,x=g[S],A=0;for(let E=0;E<m.length;E++)if(x===E){const y=g[++S];m.onDeleteEmitter.fire({index:E-A,amount:y}),E+=y-1,A+=y,x=g[++S]}else p.push(E);return{layout:p,countRemoved:A}},l.reflowLargerApplyNewLayout=function(m,g){const p=[];for(let S=0;S<g.length;S++)p.push(m.get(g[S]));for(let S=0;S<p.length;S++)m.set(S,p[S]);m.length=g.length},l.reflowSmallerGetNewLineLengths=function(m,g,p){const S=[],x=m.map(((b,v)=>u(m,v,g))).reduce(((b,v)=>b+v));let A=0,E=0,y=0;for(;y<x;){if(x-y<p){S.push(x-y);break}A+=p;const b=u(m,E,g);A>b&&(A-=b,E++);const v=m[E].getWidth(A-1)===2;v&&A--;const _=v?p-1:p;S.push(_),y+=_}return S},l.getWrappedLineTrimmedLength=u},5295:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferSet=void 0;const m=u(8460),g=u(844),p=u(9092);class S extends g.Disposable{constructor(A,E){super(),this._optionsService=A,this._bufferService=E,this._onBufferActivate=this.register(new m.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 p.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new p.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,E){this._normal.resize(A,E),this._alt.resize(A,E),this.setupTabStops(A)}setupTabStops(A){this._normal.setupTabStops(A),this._alt.setupTabStops(A)}}l.BufferSet=S},511:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CellData=void 0;const m=u(482),g=u(643),p=u(3734);class S extends p.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new p.ExtendedAttrs,this.combinedData=""}static fromCharData(A){const E=new S;return E.setFromCharData(A),E}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,m.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(A){this.fg=A[g.CHAR_DATA_ATTR_INDEX],this.bg=0;let E=!1;if(A[g.CHAR_DATA_CHAR_INDEX].length>2)E=!0;else if(A[g.CHAR_DATA_CHAR_INDEX].length===2){const y=A[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=y&&y<=56319){const b=A[g.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=b&&b<=57343?this.content=1024*(y-55296)+b-56320+65536|A[g.CHAR_DATA_WIDTH_INDEX]<<22:E=!0}else E=!0}else this.content=A[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|A[g.CHAR_DATA_WIDTH_INDEX]<<22;E&&(this.combinedData=A[g.CHAR_DATA_CHAR_INDEX],this.content=2097152|A[g.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}l.CellData=S},643:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.WHITESPACE_CELL_CODE=l.WHITESPACE_CELL_WIDTH=l.WHITESPACE_CELL_CHAR=l.NULL_CELL_CODE=l.NULL_CELL_WIDTH=l.NULL_CELL_CHAR=l.CHAR_DATA_CODE_INDEX=l.CHAR_DATA_WIDTH_INDEX=l.CHAR_DATA_CHAR_INDEX=l.CHAR_DATA_ATTR_INDEX=l.DEFAULT_EXT=l.DEFAULT_ATTR=l.DEFAULT_COLOR=void 0,l.DEFAULT_COLOR=0,l.DEFAULT_ATTR=256|l.DEFAULT_COLOR<<9,l.DEFAULT_EXT=0,l.CHAR_DATA_ATTR_INDEX=0,l.CHAR_DATA_CHAR_INDEX=1,l.CHAR_DATA_WIDTH_INDEX=2,l.CHAR_DATA_CODE_INDEX=3,l.NULL_CELL_CHAR="",l.NULL_CELL_WIDTH=1,l.NULL_CELL_CODE=0,l.WHITESPACE_CELL_CHAR=" ",l.WHITESPACE_CELL_WIDTH=1,l.WHITESPACE_CELL_CODE=32},4863:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Marker=void 0;const m=u(8460),g=u(844);class p{get id(){return this._id}constructor(x){this.line=x,this.isDisposed=!1,this._disposables=[],this._id=p._nextId++,this._onDispose=this.register(new m.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,g.disposeArray)(this._disposables),this._disposables.length=0)}register(x){return this._disposables.push(x),x}}l.Marker=p,p._nextId=1},7116:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DEFAULT_CHARSET=l.CHARSETS=void 0,l.CHARSETS={},l.DEFAULT_CHARSET=l.CHARSETS.B,l.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:"≥","{":"π","|":"≠","}":"£","~":"·"},l.CHARSETS.A={"#":"£"},l.CHARSETS.B=void 0,l.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},l.CHARSETS.C=l.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},l.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},l.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},l.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},l.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},l.CHARSETS.E=l.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},l.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},l.CHARSETS.H=l.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},l.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(h,l)=>{var u,m,g;Object.defineProperty(l,"__esModule",{value:!0}),l.C1_ESCAPED=l.C1=l.C0=void 0,(function(p){p.NUL="\0",p.SOH="",p.STX="",p.ETX="",p.EOT="",p.ENQ="",p.ACK="",p.BEL="\x07",p.BS="\b",p.HT=" ",p.LF=`
|
|
500
|
+
`,p.VT="\v",p.FF="\f",p.CR="\r",p.SO="",p.SI="",p.DLE="",p.DC1="",p.DC2="",p.DC3="",p.DC4="",p.NAK="",p.SYN="",p.ETB="",p.CAN="",p.EM="",p.SUB="",p.ESC="\x1B",p.FS="",p.GS="",p.RS="",p.US="",p.SP=" ",p.DEL=""})(u||(l.C0=u={})),(function(p){p.PAD="",p.HOP="",p.BPH="",p.NBH="",p.IND="",p.NEL="
",p.SSA="",p.ESA="",p.HTS="",p.HTJ="",p.VTS="",p.PLD="",p.PLU="",p.RI="",p.SS2="",p.SS3="",p.DCS="",p.PU1="",p.PU2="",p.STS="",p.CCH="",p.MW="",p.SPA="",p.EPA="",p.SOS="",p.SGCI="",p.SCI="",p.CSI="",p.ST="",p.OSC="",p.PM="",p.APC=""})(m||(l.C1=m={})),(function(p){p.ST=`${u.ESC}\\`})(g||(l.C1_ESCAPED=g={}))},7399:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.evaluateKeyboardEvent=void 0;const m=u(2584),g={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:["'",'"']};l.evaluateKeyboardEvent=function(p,S,x,A){const E={type:0,cancel:!1,key:void 0},y=(p.shiftKey?1:0)|(p.altKey?2:0)|(p.ctrlKey?4:0)|(p.metaKey?8:0);switch(p.keyCode){case 0:p.key==="UIKeyInputUpArrow"?E.key=S?m.C0.ESC+"OA":m.C0.ESC+"[A":p.key==="UIKeyInputLeftArrow"?E.key=S?m.C0.ESC+"OD":m.C0.ESC+"[D":p.key==="UIKeyInputRightArrow"?E.key=S?m.C0.ESC+"OC":m.C0.ESC+"[C":p.key==="UIKeyInputDownArrow"&&(E.key=S?m.C0.ESC+"OB":m.C0.ESC+"[B");break;case 8:E.key=p.ctrlKey?"\b":m.C0.DEL,p.altKey&&(E.key=m.C0.ESC+E.key);break;case 9:if(p.shiftKey){E.key=m.C0.ESC+"[Z";break}E.key=m.C0.HT,E.cancel=!0;break;case 13:E.key=p.altKey?m.C0.ESC+m.C0.CR:m.C0.CR,E.cancel=!0;break;case 27:E.key=m.C0.ESC,p.altKey&&(E.key=m.C0.ESC+m.C0.ESC),E.cancel=!0;break;case 37:if(p.metaKey)break;y?(E.key=m.C0.ESC+"[1;"+(y+1)+"D",E.key===m.C0.ESC+"[1;3D"&&(E.key=m.C0.ESC+(x?"b":"[1;5D"))):E.key=S?m.C0.ESC+"OD":m.C0.ESC+"[D";break;case 39:if(p.metaKey)break;y?(E.key=m.C0.ESC+"[1;"+(y+1)+"C",E.key===m.C0.ESC+"[1;3C"&&(E.key=m.C0.ESC+(x?"f":"[1;5C"))):E.key=S?m.C0.ESC+"OC":m.C0.ESC+"[C";break;case 38:if(p.metaKey)break;y?(E.key=m.C0.ESC+"[1;"+(y+1)+"A",x||E.key!==m.C0.ESC+"[1;3A"||(E.key=m.C0.ESC+"[1;5A")):E.key=S?m.C0.ESC+"OA":m.C0.ESC+"[A";break;case 40:if(p.metaKey)break;y?(E.key=m.C0.ESC+"[1;"+(y+1)+"B",x||E.key!==m.C0.ESC+"[1;3B"||(E.key=m.C0.ESC+"[1;5B")):E.key=S?m.C0.ESC+"OB":m.C0.ESC+"[B";break;case 45:p.shiftKey||p.ctrlKey||(E.key=m.C0.ESC+"[2~");break;case 46:E.key=y?m.C0.ESC+"[3;"+(y+1)+"~":m.C0.ESC+"[3~";break;case 36:E.key=y?m.C0.ESC+"[1;"+(y+1)+"H":S?m.C0.ESC+"OH":m.C0.ESC+"[H";break;case 35:E.key=y?m.C0.ESC+"[1;"+(y+1)+"F":S?m.C0.ESC+"OF":m.C0.ESC+"[F";break;case 33:p.shiftKey?E.type=2:p.ctrlKey?E.key=m.C0.ESC+"[5;"+(y+1)+"~":E.key=m.C0.ESC+"[5~";break;case 34:p.shiftKey?E.type=3:p.ctrlKey?E.key=m.C0.ESC+"[6;"+(y+1)+"~":E.key=m.C0.ESC+"[6~";break;case 112:E.key=y?m.C0.ESC+"[1;"+(y+1)+"P":m.C0.ESC+"OP";break;case 113:E.key=y?m.C0.ESC+"[1;"+(y+1)+"Q":m.C0.ESC+"OQ";break;case 114:E.key=y?m.C0.ESC+"[1;"+(y+1)+"R":m.C0.ESC+"OR";break;case 115:E.key=y?m.C0.ESC+"[1;"+(y+1)+"S":m.C0.ESC+"OS";break;case 116:E.key=y?m.C0.ESC+"[15;"+(y+1)+"~":m.C0.ESC+"[15~";break;case 117:E.key=y?m.C0.ESC+"[17;"+(y+1)+"~":m.C0.ESC+"[17~";break;case 118:E.key=y?m.C0.ESC+"[18;"+(y+1)+"~":m.C0.ESC+"[18~";break;case 119:E.key=y?m.C0.ESC+"[19;"+(y+1)+"~":m.C0.ESC+"[19~";break;case 120:E.key=y?m.C0.ESC+"[20;"+(y+1)+"~":m.C0.ESC+"[20~";break;case 121:E.key=y?m.C0.ESC+"[21;"+(y+1)+"~":m.C0.ESC+"[21~";break;case 122:E.key=y?m.C0.ESC+"[23;"+(y+1)+"~":m.C0.ESC+"[23~";break;case 123:E.key=y?m.C0.ESC+"[24;"+(y+1)+"~":m.C0.ESC+"[24~";break;default:if(!p.ctrlKey||p.shiftKey||p.altKey||p.metaKey)if(x&&!A||!p.altKey||p.metaKey)!x||p.altKey||p.ctrlKey||p.shiftKey||!p.metaKey?p.key&&!p.ctrlKey&&!p.altKey&&!p.metaKey&&p.keyCode>=48&&p.key.length===1?E.key=p.key:p.key&&p.ctrlKey&&(p.key==="_"&&(E.key=m.C0.US),p.key==="@"&&(E.key=m.C0.NUL)):p.keyCode===65&&(E.type=1);else{const b=g[p.keyCode],v=b==null?void 0:b[p.shiftKey?1:0];if(v)E.key=m.C0.ESC+v;else if(p.keyCode>=65&&p.keyCode<=90){const _=p.ctrlKey?p.keyCode-64:p.keyCode+32;let k=String.fromCharCode(_);p.shiftKey&&(k=k.toUpperCase()),E.key=m.C0.ESC+k}else if(p.keyCode===32)E.key=m.C0.ESC+(p.ctrlKey?m.C0.NUL:" ");else if(p.key==="Dead"&&p.code.startsWith("Key")){let _=p.code.slice(3,4);p.shiftKey||(_=_.toLowerCase()),E.key=m.C0.ESC+_,E.cancel=!0}}else p.keyCode>=65&&p.keyCode<=90?E.key=String.fromCharCode(p.keyCode-64):p.keyCode===32?E.key=m.C0.NUL:p.keyCode>=51&&p.keyCode<=55?E.key=String.fromCharCode(p.keyCode-51+27):p.keyCode===56?E.key=m.C0.DEL:p.keyCode===219?E.key=m.C0.ESC:p.keyCode===220?E.key=m.C0.FS:p.keyCode===221&&(E.key=m.C0.GS)}return E}},482:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Utf8ToUtf32=l.StringToUtf32=l.utf32ToString=l.stringFromCodePoint=void 0,l.stringFromCodePoint=function(u){return u>65535?(u-=65536,String.fromCharCode(55296+(u>>10))+String.fromCharCode(u%1024+56320)):String.fromCharCode(u)},l.utf32ToString=function(u,m=0,g=u.length){let p="";for(let S=m;S<g;++S){let x=u[S];x>65535?(x-=65536,p+=String.fromCharCode(55296+(x>>10))+String.fromCharCode(x%1024+56320)):p+=String.fromCharCode(x)}return p},l.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(u,m){const g=u.length;if(!g)return 0;let p=0,S=0;if(this._interim){const x=u.charCodeAt(S++);56320<=x&&x<=57343?m[p++]=1024*(this._interim-55296)+x-56320+65536:(m[p++]=this._interim,m[p++]=x),this._interim=0}for(let x=S;x<g;++x){const A=u.charCodeAt(x);if(55296<=A&&A<=56319){if(++x>=g)return this._interim=A,p;const E=u.charCodeAt(x);56320<=E&&E<=57343?m[p++]=1024*(A-55296)+E-56320+65536:(m[p++]=A,m[p++]=E)}else A!==65279&&(m[p++]=A)}return p}},l.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(u,m){const g=u.length;if(!g)return 0;let p,S,x,A,E=0,y=0,b=0;if(this.interim[0]){let k=!1,C=this.interim[0];C&=(224&C)==192?31:(240&C)==224?15:7;let w,T=0;for(;(w=63&this.interim[++T])&&T<4;)C<<=6,C|=w;const j=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,M=j-T;for(;b<M;){if(b>=g)return 0;if(w=u[b++],(192&w)!=128){b--,k=!0;break}this.interim[T++]=w,C<<=6,C|=63&w}k||(j===2?C<128?b--:m[E++]=C:j===3?C<2048||C>=55296&&C<=57343||C===65279||(m[E++]=C):C<65536||C>1114111||(m[E++]=C)),this.interim.fill(0)}const v=g-4;let _=b;for(;_<g;){for(;!(!(_<v)||128&(p=u[_])||128&(S=u[_+1])||128&(x=u[_+2])||128&(A=u[_+3]));)m[E++]=p,m[E++]=S,m[E++]=x,m[E++]=A,_+=4;if(p=u[_++],p<128)m[E++]=p;else if((224&p)==192){if(_>=g)return this.interim[0]=p,E;if(S=u[_++],(192&S)!=128){_--;continue}if(y=(31&p)<<6|63&S,y<128){_--;continue}m[E++]=y}else if((240&p)==224){if(_>=g)return this.interim[0]=p,E;if(S=u[_++],(192&S)!=128){_--;continue}if(_>=g)return this.interim[0]=p,this.interim[1]=S,E;if(x=u[_++],(192&x)!=128){_--;continue}if(y=(15&p)<<12|(63&S)<<6|63&x,y<2048||y>=55296&&y<=57343||y===65279)continue;m[E++]=y}else if((248&p)==240){if(_>=g)return this.interim[0]=p,E;if(S=u[_++],(192&S)!=128){_--;continue}if(_>=g)return this.interim[0]=p,this.interim[1]=S,E;if(x=u[_++],(192&x)!=128){_--;continue}if(_>=g)return this.interim[0]=p,this.interim[1]=S,this.interim[2]=x,E;if(A=u[_++],(192&A)!=128){_--;continue}if(y=(7&p)<<18|(63&S)<<12|(63&x)<<6|63&A,y<65536||y>1114111)continue;m[E++]=y}}return E}}},225:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeV6=void 0;const m=u(1480),g=[[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]],p=[[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 S;l.UnicodeV6=class{constructor(){if(this.version="6",!S){S=new Uint8Array(65536),S.fill(1),S[0]=0,S.fill(0,1,32),S.fill(0,127,160),S.fill(2,4352,4448),S[9001]=2,S[9002]=2,S.fill(2,11904,42192),S[12351]=1,S.fill(2,44032,55204),S.fill(2,63744,64256),S.fill(2,65040,65050),S.fill(2,65072,65136),S.fill(2,65280,65377),S.fill(2,65504,65511);for(let x=0;x<g.length;++x)S.fill(0,g[x][0],g[x][1]+1)}}wcwidth(x){return x<32?0:x<127?1:x<65536?S[x]:(function(A,E){let y,b=0,v=E.length-1;if(A<E[0][0]||A>E[v][1])return!1;for(;v>=b;)if(y=b+v>>1,A>E[y][1])b=y+1;else{if(!(A<E[y][0]))return!0;v=y-1}return!1})(x,p)?0:x>=131072&&x<=196605||x>=196608&&x<=262141?2:1}charProperties(x,A){let E=this.wcwidth(x),y=E===0&&A!==0;if(y){const b=m.UnicodeService.extractWidth(A);b===0?y=!1:b>E&&(E=b)}return m.UnicodeService.createPropertyValue(0,E,y)}}},5981:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.WriteBuffer=void 0;const m=u(8460),g=u(844);class p extends g.Disposable{constructor(x){super(),this._action=x,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new m.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(x,A){if(A!==void 0&&this._syncCalls>A)return void(this._syncCalls=0);if(this._pendingData+=x.length,this._writeBuffer.push(x),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let E;for(this._isSyncWriting=!0;E=this._writeBuffer.shift();){this._action(E);const y=this._callbacks.shift();y&&y()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(x,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+=x.length,this._writeBuffer.push(x),this._callbacks.push(A),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=x.length,this._writeBuffer.push(x),this._callbacks.push(A)}_innerWrite(x=0,A=!0){const E=x||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()-E>=12?setTimeout((()=>this._innerWrite(0,k))):this._innerWrite(E,k);return void b.catch((k=>(queueMicrotask((()=>{throw k})),Promise.resolve(!1)))).then(_)}const v=this._callbacks[this._bufferOffset];if(v&&v(),this._bufferOffset++,this._pendingData-=y.length,Date.now()-E>=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()}}l.WriteBuffer=p},5941:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.toRgbString=l.parseColor=void 0;const u=/^([\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})$/,m=/^[\da-f]+$/;function g(p,S){const x=p.toString(16),A=x.length<2?"0"+x:x;switch(S){case 4:return x[0];case 8:return A;case 12:return(A+A).slice(0,3);default:return A+A}}l.parseColor=function(p){if(!p)return;let S=p.toLowerCase();if(S.indexOf("rgb:")===0){S=S.slice(4);const x=u.exec(S);if(x){const A=x[1]?15:x[4]?255:x[7]?4095:65535;return[Math.round(parseInt(x[1]||x[4]||x[7]||x[10],16)/A*255),Math.round(parseInt(x[2]||x[5]||x[8]||x[11],16)/A*255),Math.round(parseInt(x[3]||x[6]||x[9]||x[12],16)/A*255)]}}else if(S.indexOf("#")===0&&(S=S.slice(1),m.exec(S)&&[3,6,9,12].includes(S.length))){const x=S.length/3,A=[0,0,0];for(let E=0;E<3;++E){const y=parseInt(S.slice(x*E,x*E+x),16);A[E]=x===1?y<<4:x===2?y:x===3?y>>4:y>>8}return A}},l.toRgbString=function(p,S=16){const[x,A,E]=p;return`rgb:${g(x,S)}/${g(A,S)}/${g(E,S)}`}},5770:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.PAYLOAD_LIMIT=void 0,l.PAYLOAD_LIMIT=1e7},6351:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DcsHandler=l.DcsParser=void 0;const m=u(482),g=u(8742),p=u(5770),S=[];l.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=S,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=S}registerHandler(A,E){this._handlers[A]===void 0&&(this._handlers[A]=[]);const y=this._handlers[A];return y.push(E),{dispose:()=>{const b=y.indexOf(E);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=S,this._ident=0}hook(A,E){if(this.reset(),this._ident=A,this._active=this._handlers[A]||S,this._active.length)for(let y=this._active.length-1;y>=0;y--)this._active[y].hook(E);else this._handlerFb(this._ident,"HOOK",E)}put(A,E,y){if(this._active.length)for(let b=this._active.length-1;b>=0;b--)this._active[b].put(A,E,y);else this._handlerFb(this._ident,"PUT",(0,m.utf32ToString)(A,E,y))}unhook(A,E=!0){if(this._active.length){let y=!1,b=this._active.length-1,v=!1;if(this._stack.paused&&(b=this._stack.loopPosition-1,y=E,v=this._stack.fallThrough,this._stack.paused=!1),!v&&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=S,this._ident=0}};const x=new g.Params;x.addParam(0),l.DcsHandler=class{constructor(A){this._handler=A,this._data="",this._params=x,this._hitLimit=!1}hook(A){this._params=A.length>1||A.params[0]?A.clone():x,this._data="",this._hitLimit=!1}put(A,E,y){this._hitLimit||(this._data+=(0,m.utf32ToString)(A,E,y),this._data.length>p.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(A){let E=!1;if(this._hitLimit)E=!1;else if(A&&(E=this._handler(this._data,this._params),E instanceof Promise))return E.then((y=>(this._params=x,this._data="",this._hitLimit=!1,y)));return this._params=x,this._data="",this._hitLimit=!1,E}}},2015:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.EscapeSequenceParser=l.VT500_TRANSITION_TABLE=l.TransitionTable=void 0;const m=u(844),g=u(8742),p=u(6242),S=u(6351);class x{constructor(b){this.table=new Uint8Array(b)}setDefault(b,v){this.table.fill(b<<4|v)}add(b,v,_,k){this.table[v<<8|b]=_<<4|k}addMany(b,v,_,k){for(let C=0;C<b.length;C++)this.table[v<<8|b[C]]=_<<4|k}}l.TransitionTable=x;const A=160;l.VT500_TRANSITION_TABLE=(function(){const y=new x(4095),b=Array.apply(null,Array(256)).map(((T,j)=>j)),v=(T,j)=>b.slice(T,j),_=v(32,127),k=v(0,24);k.push(25),k.push.apply(k,v(28,32));const C=v(0,14);let w;for(w in y.setDefault(1,0),y.addMany(_,0,2,0),C)y.addMany([24,26,153,154],w,3,0),y.addMany(v(128,144),w,3,0),y.addMany(v(144,152),w,3,0),y.add(156,w,0,0),y.add(27,w,11,1),y.add(157,w,4,8),y.addMany([152,158,159],w,0,7),y.add(155,w,11,3),y.add(144,w,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(v(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(v(64,127),3,7,0),y.addMany(v(48,60),3,8,4),y.addMany([60,61,62,63],3,9,4),y.addMany(v(48,60),4,8,4),y.addMany(v(64,127),4,7,0),y.addMany([60,61,62,63],4,0,6),y.addMany(v(32,64),6,0,6),y.add(127,6,0,6),y.addMany(v(64,127),6,0,0),y.addMany(v(32,48),3,9,5),y.addMany(v(32,48),5,9,5),y.addMany(v(48,64),5,0,6),y.addMany(v(64,127),5,7,0),y.addMany(v(32,48),4,9,5),y.addMany(v(32,48),1,9,2),y.addMany(v(32,48),2,9,2),y.addMany(v(48,127),2,10,0),y.addMany(v(48,80),1,10,0),y.addMany(v(81,88),1,10,0),y.addMany([89,90,92],1,10,0),y.addMany(v(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(v(28,32),9,0,9),y.addMany(v(32,48),9,9,12),y.addMany(v(48,60),9,8,10),y.addMany([60,61,62,63],9,9,10),y.addMany(k,11,0,11),y.addMany(v(32,128),11,0,11),y.addMany(v(28,32),11,0,11),y.addMany(k,10,0,10),y.add(127,10,0,10),y.addMany(v(28,32),10,0,10),y.addMany(v(48,60),10,8,10),y.addMany([60,61,62,63],10,0,11),y.addMany(v(32,48),10,9,12),y.addMany(k,12,0,12),y.add(127,12,0,12),y.addMany(v(28,32),12,0,12),y.addMany(v(32,48),12,9,12),y.addMany(v(48,64),12,0,11),y.addMany(v(64,127),12,12,13),y.addMany(v(64,127),10,12,13),y.addMany(v(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 E extends m.Disposable{constructor(b=l.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 g.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(v,_,k)=>{},this._executeHandlerFb=v=>{},this._csiHandlerFb=(v,_)=>{},this._escHandlerFb=v=>{},this._errorHandlerFb=v=>v,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,m.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new p.OscParser),this._dcsParser=this.register(new S.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(b,v=[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 C=0;C<b.intermediates.length;++C){const w=b.intermediates.charCodeAt(C);if(32>w||w>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");_<<=8,_|=w}}if(b.final.length!==1)throw new Error("final must be a single byte");const k=b.final.charCodeAt(0);if(v[0]>k||k>v[1])throw new Error(`final must be in range ${v[0]} .. ${v[1]}`);return _<<=8,_|=k,_}identToString(b){const v=[];for(;b;)v.push(String.fromCharCode(255&b)),b>>=8;return v.reverse().join("")}setPrintHandler(b){this._printHandler=b}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(b,v){const _=this._identifier(b,[48,126]);this._escHandlers[_]===void 0&&(this._escHandlers[_]=[]);const k=this._escHandlers[_];return k.push(v),{dispose:()=>{const C=k.indexOf(v);C!==-1&&k.splice(C,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,v){this._executeHandlers[b.charCodeAt(0)]=v}clearExecuteHandler(b){this._executeHandlers[b.charCodeAt(0)]&&delete this._executeHandlers[b.charCodeAt(0)]}setExecuteHandlerFallback(b){this._executeHandlerFb=b}registerCsiHandler(b,v){const _=this._identifier(b);this._csiHandlers[_]===void 0&&(this._csiHandlers[_]=[]);const k=this._csiHandlers[_];return k.push(v),{dispose:()=>{const C=k.indexOf(v);C!==-1&&k.splice(C,1)}}}clearCsiHandler(b){this._csiHandlers[this._identifier(b)]&&delete this._csiHandlers[this._identifier(b)]}setCsiHandlerFallback(b){this._csiHandlerFb=b}registerDcsHandler(b,v){return this._dcsParser.registerHandler(this._identifier(b),v)}clearDcsHandler(b){this._dcsParser.clearHandler(this._identifier(b))}setDcsHandlerFallback(b){this._dcsParser.setHandlerFallback(b)}registerOscHandler(b,v){return this._oscParser.registerHandler(b,v)}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,v,_,k,C){this._parseStack.state=b,this._parseStack.handlers=v,this._parseStack.handlerPos=_,this._parseStack.transition=k,this._parseStack.chunkPos=C}parse(b,v,_){let k,C=0,w=0,T=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,T=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 j=this._parseStack.handlers;let M=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(_===!1&&M>-1){for(;M>=0&&(k=j[M](this._params),k!==!0);M--)if(k instanceof Promise)return this._parseStack.handlerPos=M,k}this._parseStack.handlers=[];break;case 4:if(_===!1&&M>-1){for(;M>=0&&(k=j[M](),k!==!0);M--)if(k instanceof Promise)return this._parseStack.handlerPos=M,k}this._parseStack.handlers=[];break;case 6:if(C=b[this._parseStack.chunkPos],k=this._dcsParser.unhook(C!==24&&C!==26,_),k)return k;C===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(C=b[this._parseStack.chunkPos],k=this._oscParser.end(C!==24&&C!==26,_),k)return k;C===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,T=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let j=T;j<v;++j){switch(C=b[j],w=this._transitions.table[this.currentState<<8|(C<160?C:A)],w>>4){case 2:for(let F=j+1;;++F){if(F>=v||(C=b[F])<32||C>126&&C<A){this._printHandler(b,j,F),j=F-1;break}if(++F>=v||(C=b[F])<32||C>126&&C<A){this._printHandler(b,j,F),j=F-1;break}if(++F>=v||(C=b[F])<32||C>126&&C<A){this._printHandler(b,j,F),j=F-1;break}if(++F>=v||(C=b[F])<32||C>126&&C<A){this._printHandler(b,j,F),j=F-1;break}}break;case 3:this._executeHandlers[C]?this._executeHandlers[C]():this._executeHandlerFb(C),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:j,code:C,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const M=this._csiHandlers[this._collect<<8|C];let D=M?M.length-1:-1;for(;D>=0&&(k=M[D](this._params),k!==!0);D--)if(k instanceof Promise)return this._preserveStack(3,M,D,w,j),k;D<0&&this._csiHandlerFb(this._collect<<8|C,this._params),this.precedingJoinState=0;break;case 8:do switch(C){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(C-48)}while(++j<v&&(C=b[j])>47&&C<60);j--;break;case 9:this._collect<<=8,this._collect|=C;break;case 10:const L=this._escHandlers[this._collect<<8|C];let q=L?L.length-1:-1;for(;q>=0&&(k=L[q](),k!==!0);q--)if(k instanceof Promise)return this._preserveStack(4,L,q,w,j),k;q<0&&this._escHandlerFb(this._collect<<8|C),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|C,this._params);break;case 13:for(let F=j+1;;++F)if(F>=v||(C=b[F])===24||C===26||C===27||C>127&&C<A){this._dcsParser.put(b,j,F),j=F-1;break}break;case 14:if(k=this._dcsParser.unhook(C!==24&&C!==26),k)return this._preserveStack(6,[],0,w,j),k;C===27&&(w|=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 F=j+1;;F++)if(F>=v||(C=b[F])<32||C>127&&C<A){this._oscParser.put(b,j,F),j=F-1;break}break;case 6:if(k=this._oscParser.end(C!==24&&C!==26),k)return this._preserveStack(5,[],0,w,j),k;C===27&&(w|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&w}}}l.EscapeSequenceParser=E},6242:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.OscHandler=l.OscParser=void 0;const m=u(5770),g=u(482),p=[];l.OscParser=class{constructor(){this._state=0,this._active=p,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(S,x){this._handlers[S]===void 0&&(this._handlers[S]=[]);const A=this._handlers[S];return A.push(x),{dispose:()=>{const E=A.indexOf(x);E!==-1&&A.splice(E,1)}}}clearHandler(S){this._handlers[S]&&delete this._handlers[S]}setHandlerFallback(S){this._handlerFb=S}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=p}reset(){if(this._state===2)for(let S=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;S>=0;--S)this._active[S].end(!1);this._stack.paused=!1,this._active=p,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||p,this._active.length)for(let S=this._active.length-1;S>=0;S--)this._active[S].start();else this._handlerFb(this._id,"START")}_put(S,x,A){if(this._active.length)for(let E=this._active.length-1;E>=0;E--)this._active[E].put(S,x,A);else this._handlerFb(this._id,"PUT",(0,g.utf32ToString)(S,x,A))}start(){this.reset(),this._state=1}put(S,x,A){if(this._state!==3){if(this._state===1)for(;x<A;){const E=S[x++];if(E===59){this._state=2,this._start();break}if(E<48||57<E)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+E-48}this._state===2&&A-x>0&&this._put(S,x,A)}}end(S,x=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let A=!1,E=this._active.length-1,y=!1;if(this._stack.paused&&(E=this._stack.loopPosition-1,A=x,y=this._stack.fallThrough,this._stack.paused=!1),!y&&A===!1){for(;E>=0&&(A=this._active[E].end(S),A!==!0);E--)if(A instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=E,this._stack.fallThrough=!1,A;E--}for(;E>=0;E--)if(A=this._active[E].end(!1),A instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=E,this._stack.fallThrough=!0,A}else this._handlerFb(this._id,"END",S);this._active=p,this._id=-1,this._state=0}}},l.OscHandler=class{constructor(S){this._handler=S,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(S,x,A){this._hitLimit||(this._data+=(0,g.utf32ToString)(S,x,A),this._data.length>m.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(S){let x=!1;if(this._hitLimit)x=!1;else if(S&&(x=this._handler(this._data),x instanceof Promise))return x.then((A=>(this._data="",this._hitLimit=!1,A)));return this._data="",this._hitLimit=!1,x}}},8742:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Params=void 0;const u=2147483647;class m{static fromArray(p){const S=new m;if(!p.length)return S;for(let x=Array.isArray(p[0])?1:0;x<p.length;++x){const A=p[x];if(Array.isArray(A))for(let E=0;E<A.length;++E)S.addSubParam(A[E]);else S.addParam(A)}return S}constructor(p=32,S=32){if(this.maxLength=p,this.maxSubParamsLength=S,S>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(p),this.length=0,this._subParams=new Int32Array(S),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(p),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const p=new m(this.maxLength,this.maxSubParamsLength);return p.params.set(this.params),p.length=this.length,p._subParams.set(this._subParams),p._subParamsLength=this._subParamsLength,p._subParamsIdx.set(this._subParamsIdx),p._rejectDigits=this._rejectDigits,p._rejectSubDigits=this._rejectSubDigits,p._digitIsSub=this._digitIsSub,p}toArray(){const p=[];for(let S=0;S<this.length;++S){p.push(this.params[S]);const x=this._subParamsIdx[S]>>8,A=255&this._subParamsIdx[S];A-x>0&&p.push(Array.prototype.slice.call(this._subParams,x,A))}return p}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(p){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(p<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=p>u?u:p}}addSubParam(p){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(p<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=p>u?u:p,this._subParamsIdx[this.length-1]++}}hasSubParams(p){return(255&this._subParamsIdx[p])-(this._subParamsIdx[p]>>8)>0}getSubParams(p){const S=this._subParamsIdx[p]>>8,x=255&this._subParamsIdx[p];return x-S>0?this._subParams.subarray(S,x):null}getSubParamsAll(){const p={};for(let S=0;S<this.length;++S){const x=this._subParamsIdx[S]>>8,A=255&this._subParamsIdx[S];A-x>0&&(p[S]=this._subParams.slice(x,A))}return p}addDigit(p){let S;if(this._rejectDigits||!(S=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const x=this._digitIsSub?this._subParams:this.params,A=x[S-1];x[S-1]=~A?Math.min(10*A+p,u):p}}l.Params=m},5741:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.AddonManager=void 0,l.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let u=this._addons.length-1;u>=0;u--)this._addons[u].instance.dispose()}loadAddon(u,m){const g={instance:m,dispose:m.dispose,isDisposed:!1};this._addons.push(g),m.dispose=()=>this._wrappedAddonDispose(g),m.activate(u)}_wrappedAddonDispose(u){if(u.isDisposed)return;let m=-1;for(let g=0;g<this._addons.length;g++)if(this._addons[g]===u){m=g;break}if(m===-1)throw new Error("Could not dispose an addon that has not been loaded");u.isDisposed=!0,u.dispose.apply(u.instance),this._addons.splice(m,1)}}},8771:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferApiView=void 0;const m=u(3785),g=u(511);l.BufferApiView=class{constructor(p,S){this._buffer=p,this.type=S}init(p){return this._buffer=p,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(p){const S=this._buffer.lines.get(p);if(S)return new m.BufferLineApiView(S)}getNullCell(){return new g.CellData}}},3785:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferLineApiView=void 0;const m=u(511);l.BufferLineApiView=class{constructor(g){this._line=g}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(g,p){if(!(g<0||g>=this._line.length))return p?(this._line.loadCell(g,p),p):this._line.loadCell(g,new m.CellData)}translateToString(g,p,S){return this._line.translateToString(g,p,S)}}},8285:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferNamespaceApi=void 0;const m=u(8771),g=u(8460),p=u(844);class S extends p.Disposable{constructor(A){super(),this._core=A,this._onBufferChange=this.register(new g.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new m.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new m.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)}}l.BufferNamespaceApi=S},7975:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ParserApi=void 0,l.ParserApi=class{constructor(u){this._core=u}registerCsiHandler(u,m){return this._core.registerCsiHandler(u,(g=>m(g.toArray())))}addCsiHandler(u,m){return this.registerCsiHandler(u,m)}registerDcsHandler(u,m){return this._core.registerDcsHandler(u,((g,p)=>m(g,p.toArray())))}addDcsHandler(u,m){return this.registerDcsHandler(u,m)}registerEscHandler(u,m){return this._core.registerEscHandler(u,m)}addEscHandler(u,m){return this.registerEscHandler(u,m)}registerOscHandler(u,m){return this._core.registerOscHandler(u,m)}addOscHandler(u,m){return this.registerOscHandler(u,m)}}},7090:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeApi=void 0,l.UnicodeApi=class{constructor(u){this._core=u}register(u){this._core.unicodeService.register(u)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(u){this._core.unicodeService.activeVersion=u}}},744:function(h,l,u){var m=this&&this.__decorate||function(y,b,v,_){var k,C=arguments.length,w=C<3?b:_===null?_=Object.getOwnPropertyDescriptor(b,v):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(y,b,v,_);else for(var T=y.length-1;T>=0;T--)(k=y[T])&&(w=(C<3?k(w):C>3?k(b,v,w):k(b,v))||w);return C>3&&w&&Object.defineProperty(b,v,w),w},g=this&&this.__param||function(y,b){return function(v,_){b(v,_,y)}};Object.defineProperty(l,"__esModule",{value:!0}),l.BufferService=l.MINIMUM_ROWS=l.MINIMUM_COLS=void 0;const p=u(8460),S=u(844),x=u(5295),A=u(2585);l.MINIMUM_COLS=2,l.MINIMUM_ROWS=1;let E=l.BufferService=class extends S.Disposable{get buffer(){return this.buffers.active}constructor(y){super(),this.isUserScrolling=!1,this._onResize=this.register(new p.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new p.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(y.rawOptions.cols||0,l.MINIMUM_COLS),this.rows=Math.max(y.rawOptions.rows||0,l.MINIMUM_ROWS),this.buffers=this.register(new x.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 v=this.buffer;let _;_=this._cachedBlankLine,_&&_.length===this.cols&&_.getFg(0)===y.fg&&_.getBg(0)===y.bg||(_=v.getBlankLine(y,b),this._cachedBlankLine=_),_.isWrapped=b;const k=v.ybase+v.scrollTop,C=v.ybase+v.scrollBottom;if(v.scrollTop===0){const w=v.lines.isFull;C===v.lines.length-1?w?v.lines.recycle().copyFrom(_):v.lines.push(_.clone()):v.lines.splice(C+1,0,_.clone()),w?this.isUserScrolling&&(v.ydisp=Math.max(v.ydisp-1,0)):(v.ybase++,this.isUserScrolling||v.ydisp++)}else{const w=C-k+1;v.lines.shiftElements(k+1,w-1,-1),v.lines.set(C,_.clone())}this.isUserScrolling||(v.ydisp=v.ybase),this._onScroll.fire(v.ydisp)}scrollLines(y,b,v){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))}};l.BufferService=E=m([g(0,A.IOptionsService)],E)},7994:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CharsetService=void 0,l.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(u){this.glevel=u,this.charset=this._charsets[u]}setgCharset(u,m){this._charsets[u]=m,this.glevel===u&&(this.charset=m)}}},1753:function(h,l,u){var m=this&&this.__decorate||function(_,k,C,w){var T,j=arguments.length,M=j<3?k:w===null?w=Object.getOwnPropertyDescriptor(k,C):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(_,k,C,w);else for(var D=_.length-1;D>=0;D--)(T=_[D])&&(M=(j<3?T(M):j>3?T(k,C,M):T(k,C))||M);return j>3&&M&&Object.defineProperty(k,C,M),M},g=this&&this.__param||function(_,k){return function(C,w){k(C,w,_)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CoreMouseService=void 0;const p=u(2585),S=u(8460),x=u(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 E(_,k){let C=(_.ctrl?16:0)|(_.shift?4:0)|(_.alt?8:0);return _.button===4?(C|=64,C|=_.action):(C|=3&_.button,4&_.button&&(C|=64),8&_.button&&(C|=128),_.action===32?C|=32:_.action!==0||k||(C|=3)),C}const y=String.fromCharCode,b={DEFAULT:_=>{const k=[E(_,!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[<${E(_,!0)};${_.col};${_.row}${k}`},SGR_PIXELS:_=>{const k=_.action===0&&_.button!==4?"m":"M";return`\x1B[<${E(_,!0)};${_.x};${_.y}${k}`}};let v=l.CoreMouseService=class extends x.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 S.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const C of Object.keys(A))this.addProtocol(C,A[C]);for(const C of Object.keys(b))this.addEncoding(C,b[C]);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,C){if(C){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}};l.CoreMouseService=v=m([g(0,p.IBufferService),g(1,p.ICoreService)],v)},6975:function(h,l,u){var m=this&&this.__decorate||function(v,_,k,C){var w,T=arguments.length,j=T<3?_:C===null?C=Object.getOwnPropertyDescriptor(_,k):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(v,_,k,C);else for(var M=v.length-1;M>=0;M--)(w=v[M])&&(j=(T<3?w(j):T>3?w(_,k,j):w(_,k))||j);return T>3&&j&&Object.defineProperty(_,k,j),j},g=this&&this.__param||function(v,_){return function(k,C){_(k,C,v)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CoreService=void 0;const p=u(1439),S=u(8460),x=u(844),A=u(2585),E=Object.freeze({insertMode:!1}),y=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let b=l.CoreService=class extends x.Disposable{constructor(v,_,k){super(),this._bufferService=v,this._logService=_,this._optionsService=k,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new S.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new S.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new S.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new S.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,p.clone)(E),this.decPrivateModes=(0,p.clone)(y)}reset(){this.modes=(0,p.clone)(E),this.decPrivateModes=(0,p.clone)(y)}triggerDataEvent(v,_=!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 "${v}"`,(()=>v.split("").map((C=>C.charCodeAt(0))))),this._onData.fire(v)}triggerBinaryEvent(v){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${v}"`,(()=>v.split("").map((_=>_.charCodeAt(0))))),this._onBinary.fire(v))}};l.CoreService=b=m([g(0,A.IBufferService),g(1,A.ILogService),g(2,A.IOptionsService)],b)},9074:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DecorationService=void 0;const m=u(8055),g=u(8460),p=u(844),S=u(6106);let x=0,A=0;class E extends p.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new S.SortedList((v=>v==null?void 0:v.marker.line)),this._onDecorationRegistered=this.register(new g.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new g.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,p.toDisposable)((()=>this.reset())))}registerDecoration(v){if(v.marker.isDisposed)return;const _=new y(v);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 v of this._decorations.values())v.dispose();this._decorations.clear()}*getDecorationsAtCell(v,_,k){let C=0,w=0;for(const T of this._decorations.getKeyIterator(_))C=T.options.x??0,w=C+(T.options.width??1),v>=C&&v<w&&(!k||(T.options.layer??"bottom")===k)&&(yield T)}forEachDecorationAtCell(v,_,k,C){this._decorations.forEachByKey(_,(w=>{x=w.options.x??0,A=x+(w.options.width??1),v>=x&&v<A&&(!k||(w.options.layer??"bottom")===k)&&C(w)}))}}l.DecorationService=E;class y extends p.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=m.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=m.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(v){super(),this.options=v,this.onRenderEmitter=this.register(new g.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new g.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=v.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.InstantiationService=l.ServiceCollection=void 0;const m=u(2585),g=u(8343);class p{constructor(...x){this._entries=new Map;for(const[A,E]of x)this.set(A,E)}set(x,A){const E=this._entries.get(x);return this._entries.set(x,A),E}forEach(x){for(const[A,E]of this._entries.entries())x(A,E)}has(x){return this._entries.has(x)}get(x){return this._entries.get(x)}}l.ServiceCollection=p,l.InstantiationService=class{constructor(){this._services=new p,this._services.set(m.IInstantiationService,this)}setService(S,x){this._services.set(S,x)}getService(S){return this._services.get(S)}createInstance(S,...x){const A=(0,g.getServiceDependencies)(S).sort(((b,v)=>b.index-v.index)),E=[];for(const b of A){const v=this._services.get(b.id);if(!v)throw new Error(`[createInstance] ${S.name} depends on UNKNOWN service ${b.id}.`);E.push(v)}const y=A.length>0?A[0].index:x.length;if(x.length!==y)throw new Error(`[createInstance] First service dependency of ${S.name} at position ${y+1} conflicts with ${x.length} static arguments`);return new S(...x,...E)}}},7866:function(h,l,u){var m=this&&this.__decorate||function(y,b,v,_){var k,C=arguments.length,w=C<3?b:_===null?_=Object.getOwnPropertyDescriptor(b,v):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(y,b,v,_);else for(var T=y.length-1;T>=0;T--)(k=y[T])&&(w=(C<3?k(w):C>3?k(b,v,w):k(b,v))||w);return C>3&&w&&Object.defineProperty(b,v,w),w},g=this&&this.__param||function(y,b){return function(v,_){b(v,_,y)}};Object.defineProperty(l,"__esModule",{value:!0}),l.traceCall=l.setTraceLogger=l.LogService=void 0;const p=u(844),S=u(2585),x={trace:S.LogLevelEnum.TRACE,debug:S.LogLevelEnum.DEBUG,info:S.LogLevelEnum.INFO,warn:S.LogLevelEnum.WARN,error:S.LogLevelEnum.ERROR,off:S.LogLevelEnum.OFF};let A,E=l.LogService=class extends p.Disposable{get logLevel(){return this._logLevel}constructor(y){super(),this._optionsService=y,this._logLevel=S.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),A=this}_updateLogLevel(){this._logLevel=x[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,v){this._evalLazyOptionalParams(v),y.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+b,...v)}trace(y,...b){var v;this._logLevel<=S.LogLevelEnum.TRACE&&this._log(((v=this._optionsService.options.logger)==null?void 0:v.trace.bind(this._optionsService.options.logger))??console.log,y,b)}debug(y,...b){var v;this._logLevel<=S.LogLevelEnum.DEBUG&&this._log(((v=this._optionsService.options.logger)==null?void 0:v.debug.bind(this._optionsService.options.logger))??console.log,y,b)}info(y,...b){var v;this._logLevel<=S.LogLevelEnum.INFO&&this._log(((v=this._optionsService.options.logger)==null?void 0:v.info.bind(this._optionsService.options.logger))??console.info,y,b)}warn(y,...b){var v;this._logLevel<=S.LogLevelEnum.WARN&&this._log(((v=this._optionsService.options.logger)==null?void 0:v.warn.bind(this._optionsService.options.logger))??console.warn,y,b)}error(y,...b){var v;this._logLevel<=S.LogLevelEnum.ERROR&&this._log(((v=this._optionsService.options.logger)==null?void 0:v.error.bind(this._optionsService.options.logger))??console.error,y,b)}};l.LogService=E=m([g(0,S.IOptionsService)],E),l.setTraceLogger=function(y){A=y},l.traceCall=function(y,b,v){if(typeof v.value!="function")throw new Error("not supported");const _=v.value;v.value=function(...k){if(A.logLevel!==S.LogLevelEnum.TRACE)return _.apply(this,k);A.trace(`GlyphRenderer#${_.name}(${k.map((w=>JSON.stringify(w))).join(", ")})`);const C=_.apply(this,k);return A.trace(`GlyphRenderer#${_.name} return`,C),C}}},7302:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.OptionsService=l.DEFAULT_OPTIONS=void 0;const m=u(8460),g=u(844),p=u(6114);l.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:p.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const S=["normal","bold","100","200","300","400","500","600","700","800","900"];class x extends g.Disposable{constructor(E){super(),this._onOptionChange=this.register(new m.EventEmitter),this.onOptionChange=this._onOptionChange.event;const y={...l.DEFAULT_OPTIONS};for(const b in E)if(b in y)try{const v=E[b];y[b]=this._sanitizeAndValidateOption(b,v)}catch(v){console.error(v)}this.rawOptions=y,this.options={...y},this._setupOptions(),this.register((0,g.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(E,y){return this.onOptionChange((b=>{b===E&&y(this.rawOptions[E])}))}onMultipleOptionChange(E,y){return this.onOptionChange((b=>{E.indexOf(b)!==-1&&y()}))}_setupOptions(){const E=b=>{if(!(b in l.DEFAULT_OPTIONS))throw new Error(`No option with key "${b}"`);return this.rawOptions[b]},y=(b,v)=>{if(!(b in l.DEFAULT_OPTIONS))throw new Error(`No option with key "${b}"`);v=this._sanitizeAndValidateOption(b,v),this.rawOptions[b]!==v&&(this.rawOptions[b]=v,this._onOptionChange.fire(b))};for(const b in this.rawOptions){const v={get:E.bind(this,b),set:y.bind(this,b)};Object.defineProperty(this.options,b,v)}}_sanitizeAndValidateOption(E,y){switch(E){case"cursorStyle":if(y||(y=l.DEFAULT_OPTIONS[E]),!(function(b){return b==="block"||b==="underline"||b==="bar"})(y))throw new Error(`"${y}" is not a valid value for ${E}`);break;case"wordSeparator":y||(y=l.DEFAULT_OPTIONS[E]);break;case"fontWeight":case"fontWeightBold":if(typeof y=="number"&&1<=y&&y<=1e3)break;y=S.includes(y)?y:l.DEFAULT_OPTIONS[E];break;case"cursorWidth":y=Math.floor(y);case"lineHeight":case"tabStopWidth":if(y<1)throw new Error(`${E} 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(`${E} cannot be less than 0, value: ${y}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(y<=0)throw new Error(`${E} cannot be less than or equal to 0, value: ${y}`);break;case"rows":case"cols":if(!y&&y!==0)throw new Error(`${E} must be numeric, value: ${y}`);break;case"windowsPty":y=y??{}}return y}}l.OptionsService=x},2660:function(h,l,u){var m=this&&this.__decorate||function(x,A,E,y){var b,v=arguments.length,_=v<3?A:y===null?y=Object.getOwnPropertyDescriptor(A,E):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(x,A,E,y);else for(var k=x.length-1;k>=0;k--)(b=x[k])&&(_=(v<3?b(_):v>3?b(A,E,_):b(A,E))||_);return v>3&&_&&Object.defineProperty(A,E,_),_},g=this&&this.__param||function(x,A){return function(E,y){A(E,y,x)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OscLinkService=void 0;const p=u(2585);let S=l.OscLinkService=class{constructor(x){this._bufferService=x,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(x){const A=this._bufferService.buffer;if(x.id===void 0){const k=A.addMarker(A.ybase+A.y),C={data:x,id:this._nextId++,lines:[k]};return k.onDispose((()=>this._removeMarkerFromLink(C,k))),this._dataByLinkId.set(C.id,C),C.id}const E=x,y=this._getEntryIdKey(E),b=this._entriesWithId.get(y);if(b)return this.addLineToLink(b.id,A.ybase+A.y),b.id;const v=A.addMarker(A.ybase+A.y),_={id:this._nextId++,key:this._getEntryIdKey(E),data:E,lines:[v]};return v.onDispose((()=>this._removeMarkerFromLink(_,v))),this._entriesWithId.set(_.key,_),this._dataByLinkId.set(_.id,_),_.id}addLineToLink(x,A){const E=this._dataByLinkId.get(x);if(E&&E.lines.every((y=>y.line!==A))){const y=this._bufferService.buffer.addMarker(A);E.lines.push(y),y.onDispose((()=>this._removeMarkerFromLink(E,y)))}}getLinkData(x){var A;return(A=this._dataByLinkId.get(x))==null?void 0:A.data}_getEntryIdKey(x){return`${x.id};;${x.uri}`}_removeMarkerFromLink(x,A){const E=x.lines.indexOf(A);E!==-1&&(x.lines.splice(E,1),x.lines.length===0&&(x.data.id!==void 0&&this._entriesWithId.delete(x.key),this._dataByLinkId.delete(x.id)))}};l.OscLinkService=S=m([g(0,p.IBufferService)],S)},8343:(h,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.createDecorator=l.getServiceDependencies=l.serviceRegistry=void 0;const u="di$target",m="di$dependencies";l.serviceRegistry=new Map,l.getServiceDependencies=function(g){return g[m]||[]},l.createDecorator=function(g){if(l.serviceRegistry.has(g))return l.serviceRegistry.get(g);const p=function(S,x,A){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(E,y,b){y[u]===y?y[m].push({id:E,index:b}):(y[m]=[{id:E,index:b}],y[u]=y)})(p,S,A)};return p.toString=()=>g,l.serviceRegistry.set(g,p),p}},2585:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.IDecorationService=l.IUnicodeService=l.IOscLinkService=l.IOptionsService=l.ILogService=l.LogLevelEnum=l.IInstantiationService=l.ICharsetService=l.ICoreService=l.ICoreMouseService=l.IBufferService=void 0;const m=u(8343);var g;l.IBufferService=(0,m.createDecorator)("BufferService"),l.ICoreMouseService=(0,m.createDecorator)("CoreMouseService"),l.ICoreService=(0,m.createDecorator)("CoreService"),l.ICharsetService=(0,m.createDecorator)("CharsetService"),l.IInstantiationService=(0,m.createDecorator)("InstantiationService"),(function(p){p[p.TRACE=0]="TRACE",p[p.DEBUG=1]="DEBUG",p[p.INFO=2]="INFO",p[p.WARN=3]="WARN",p[p.ERROR=4]="ERROR",p[p.OFF=5]="OFF"})(g||(l.LogLevelEnum=g={})),l.ILogService=(0,m.createDecorator)("LogService"),l.IOptionsService=(0,m.createDecorator)("OptionsService"),l.IOscLinkService=(0,m.createDecorator)("OscLinkService"),l.IUnicodeService=(0,m.createDecorator)("UnicodeService"),l.IDecorationService=(0,m.createDecorator)("DecorationService")},1480:(h,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeService=void 0;const m=u(8460),g=u(225);class p{static extractShouldJoin(x){return(1&x)!=0}static extractWidth(x){return x>>1&3}static extractCharKind(x){return x>>3}static createPropertyValue(x,A,E=!1){return(16777215&x)<<3|(3&A)<<1|(E?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new m.EventEmitter,this.onChange=this._onChange.event;const x=new g.UnicodeV6;this.register(x),this._active=x.version,this._activeProvider=x}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(x){if(!this._providers[x])throw new Error(`unknown Unicode version "${x}"`);this._active=x,this._activeProvider=this._providers[x],this._onChange.fire(x)}register(x){this._providers[x.version]=x}wcwidth(x){return this._activeProvider.wcwidth(x)}getStringCellWidth(x){let A=0,E=0;const y=x.length;for(let b=0;b<y;++b){let v=x.charCodeAt(b);if(55296<=v&&v<=56319){if(++b>=y)return A+this.wcwidth(v);const C=x.charCodeAt(b);56320<=C&&C<=57343?v=1024*(v-55296)+C-56320+65536:A+=this.wcwidth(C)}const _=this.charProperties(v,E);let k=p.extractWidth(_);p.extractShouldJoin(_)&&(k-=p.extractWidth(E)),A+=k,E=_}return A}charProperties(x,A){return this._activeProvider.charProperties(x,A)}}l.UnicodeService=p}},r={};function o(h){var l=r[h];if(l!==void 0)return l.exports;var u=r[h]={exports:{}};return n[h].call(u.exports,u,u.exports,o),u.exports}var c={};return(()=>{var h=c;Object.defineProperty(h,"__esModule",{value:!0}),h.Terminal=void 0;const l=o(9042),u=o(3236),m=o(844),g=o(5741),p=o(8285),S=o(7975),x=o(7090),A=["cols","rows"];class E extends m.Disposable{constructor(b){super(),this._core=this.register(new u.Terminal(b)),this._addonManager=this.register(new g.AddonManager),this._publicOptions={...this._core.options};const v=k=>this._core.options[k],_=(k,C)=>{this._checkReadonlyOptions(k),this._core.options[k]=C};for(const k in this._core.options){const C={get:v.bind(this,k),set:_.bind(this,k)};Object.defineProperty(this._publicOptions,k,C)}}_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 S.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new x.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 p.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const b=this._core.coreService.decPrivateModes;let v="none";switch(this._core.coreMouseService.activeProtocol){case"X10":v="x10";break;case"VT200":v="vt200";break;case"DRAG":v="drag";break;case"ANY":v="any"}return{applicationCursorKeysMode:b.applicationCursorKeys,applicationKeypadMode:b.applicationKeypad,bracketedPasteMode:b.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:v,originMode:b.origin,reverseWraparoundMode:b.reverseWraparound,sendFocusMode:b.sendFocus,wraparoundMode:b.wraparound}}get options(){return this._publicOptions}set options(b){for(const v in b)this._publicOptions[v]=b[v]}blur(){this._core.blur()}focus(){this._core.focus()}input(b,v=!0){this._core.input(b,v)}resize(b,v){this._verifyIntegers(b,v),this._core.resize(b,v)}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,v,_){this._verifyIntegers(b,v,_),this._core.select(b,v,_)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(b,v){this._verifyIntegers(b,v),this._core.selectLines(b,v)}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,v){this._core.write(b,v)}writeln(b,v){this._core.write(b),this._core.write(`\r
|
|
501
|
+
`,v)}paste(b){this._core.paste(b)}refresh(b,v){this._verifyIntegers(b,v),this._core.refresh(b,v)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(b){this._addonManager.loadAddon(this,b)}static get strings(){return l}_verifyIntegers(...b){for(const v of b)if(v===1/0||isNaN(v)||v%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...b){for(const v of b)if(v&&(v===1/0||isNaN(v)||v%1!=0||v<0))throw new Error("This API only accepts positive integers")}}h.Terminal=E})(),c})()))})(mg)),mg.exports}var P6=I6(),gg={exports:{}},Sx;function B6(){return Sx||(Sx=1,(function(e,t){(function(n,r){e.exports=r()})(self,(()=>(()=>{var n={};return(()=>{var r=n;Object.defineProperty(r,"__esModule",{value:!0}),r.FitAddon=void 0,r.FitAddon=class{activate(o){this._terminal=o}dispose(){}fit(){const o=this.proposeDimensions();if(!o||!this._terminal||isNaN(o.cols)||isNaN(o.rows))return;const c=this._terminal._core;this._terminal.rows===o.rows&&this._terminal.cols===o.cols||(c._renderService.clear(),this._terminal.resize(o.cols,o.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const o=this._terminal._core,c=o._renderService.dimensions;if(c.css.cell.width===0||c.css.cell.height===0)return;const h=this._terminal.options.scrollback===0?0:o.viewport.scrollBarWidth,l=window.getComputedStyle(this._terminal.element.parentElement),u=parseInt(l.getPropertyValue("height")),m=Math.max(0,parseInt(l.getPropertyValue("width"))),g=window.getComputedStyle(this._terminal.element),p=u-(parseInt(g.getPropertyValue("padding-top"))+parseInt(g.getPropertyValue("padding-bottom"))),S=m-(parseInt(g.getPropertyValue("padding-right"))+parseInt(g.getPropertyValue("padding-left")))-h;return{cols:Math.max(2,Math.floor(S/c.css.cell.width)),rows:Math.max(1,Math.floor(p/c.css.cell.height))}}}})(),n})()))})(gg)),gg.exports}var z6=B6(),vg={exports:{}},wx;function H6(){return wx||(wx=1,(function(e,t){(function(n,r){e.exports=r()})(self,(()=>(()=>{var n={6:(h,l)=>{function u(g){try{const p=new URL(g),S=p.password&&p.username?`${p.protocol}//${p.username}:${p.password}@${p.host}`:p.username?`${p.protocol}//${p.username}@${p.host}`:`${p.protocol}//${p.host}`;return g.toLocaleLowerCase().startsWith(S.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(l,"__esModule",{value:!0}),l.LinkComputer=l.WebLinkProvider=void 0,l.WebLinkProvider=class{constructor(g,p,S,x={}){this._terminal=g,this._regex=p,this._handler=S,this._options=x}provideLinks(g,p){const S=m.computeLink(g,this._regex,this._terminal,this._handler);p(this._addCallbacks(S))}_addCallbacks(g){return g.map((p=>(p.leave=this._options.leave,p.hover=(S,x)=>{if(this._options.hover){const{range:A}=p;this._options.hover(S,x,A)}},p)))}};class m{static computeLink(p,S,x,A){const E=new RegExp(S.source,(S.flags||"")+"g"),[y,b]=m._getWindowedLineStrings(p-1,x),v=y.join("");let _;const k=[];for(;_=E.exec(v);){const C=_[0];if(!u(C))continue;const[w,T]=m._mapStrIdx(x,b,0,_.index),[j,M]=m._mapStrIdx(x,w,T,C.length);if(w===-1||T===-1||j===-1||M===-1)continue;const D={start:{x:T+1,y:w+1},end:{x:M,y:j+1}};k.push({range:D,text:C,activate:A})}return k}static _getWindowedLineStrings(p,S){let x,A=p,E=p,y=0,b="";const v=[];if(x=S.buffer.active.getLine(p)){const _=x.translateToString(!0);if(x.isWrapped&&_[0]!==" "){for(y=0;(x=S.buffer.active.getLine(--A))&&y<2048&&(b=x.translateToString(!0),y+=b.length,v.push(b),x.isWrapped&&b.indexOf(" ")===-1););v.reverse()}for(v.push(_),y=0;(x=S.buffer.active.getLine(++E))&&x.isWrapped&&y<2048&&(b=x.translateToString(!0),y+=b.length,v.push(b),b.indexOf(" ")===-1););}return[v,A]}static _mapStrIdx(p,S,x,A){const E=p.buffer.active,y=E.getNullCell();let b=x;for(;A;){const v=E.getLine(S);if(!v)return[-1,-1];for(let _=b;_<v.length;++_){v.getCell(_,y);const k=y.getChars();if(y.getWidth()&&(A-=k.length||1,_===v.length-1&&k==="")){const C=E.getLine(S+1);C&&C.isWrapped&&(C.getCell(0,y),y.getWidth()===2&&(A+=1))}if(A<0)return[S,_]}S++,b=0}return[S,b]}}l.LinkComputer=m}},r={};function o(h){var l=r[h];if(l!==void 0)return l.exports;var u=r[h]={exports:{}};return n[h](u,u.exports,o),u.exports}var c={};return(()=>{var h=c;Object.defineProperty(h,"__esModule",{value:!0}),h.WebLinksAddon=void 0;const l=o(6),u=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function m(g,p){const S=window.open();if(S){try{S.opener=null}catch{}S.location.href=p}else console.warn("Opening link blocked as opener could not be cleared")}h.WebLinksAddon=class{constructor(g=m,p={}){this._handler=g,this._options=p}activate(g){this._terminal=g;const p=this._options,S=p.urlRegex||u;this._linkProvider=this._terminal.registerLinkProvider(new l.WebLinkProvider(this._terminal,S,this._handler,p))}dispose(){var g;(g=this._linkProvider)==null||g.dispose()}}})(),c})()))})(vg)),vg.exports}var U6=H6();const F6=/^[A-Za-z0-9_\-./~:\\]+$/,q6=/^[A-Za-z]:[\\/]/;function U2(e){return F6.test(e)?e:q6.test(e)?`"${e}"`:`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function V6(e){const t=e.filter(n=>n.length>0);return t.length===0?null:t.map(U2).join(" ")+" "}function G6(e,t){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/terminal?session=${encodeURIComponent(e)}&token=${encodeURIComponent(t)}`}const W6=15e3,K6=new Set([4001,4004]),Y6='"Geist Mono", ui-monospace, "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", monospace';function Ch(e,t){return typeof document>"u"?t:getComputedStyle(document.documentElement).getPropertyValue(e).trim()||t}const X6={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"},J6={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 xx(e){const t=Ch("--bg",e==="dark"?"#0b0e13":"#f8f9fa"),n=Ch("--ink",e==="dark"?"#f3f3f5":"#16161a"),r=Ch("--brand",e==="dark"?"#6be195":"#167e3a");return{...e==="dark"?X6:J6,background:t,foreground:n,cursor:r,cursorAccent:t,selectionBackground:`${r}40`}}const Z6=({sessionId:e,token:t})=>{const n=O.useRef(null),r=O.useRef(null),[o,c]=O.useState("connecting"),[h,l]=O.useState(null);return O.useEffect(()=>Mv(u=>{r.current&&(r.current.options.theme=xx(u))}),[]),O.useEffect(()=>{var C;const u=n.current;if(!u)return;let m=!1,g=0,p=null,S=null;const x=new P6.Terminal({cursorBlink:!0,fontSize:13,fontFamily:Ch("--mono",Y6),theme:xx(rf()),scrollback:1e4,allowProposedApi:!0});r.current=x;const A=new z6.FitAddon;x.loadAddon(A),x.loadAddon(new U6.WebLinksAddon((w,T)=>{window.open(T,"_blank","noopener,noreferrer")})),x.parser.registerCsiHandler({prefix:">",final:"q"},()=>(x.write("\x1BP>|XTerm(370)\x1B\\"),!0)),x.parser.registerOscHandler(52,w=>{var M;const T=w.split(";");if(T.length<2)return!1;const j=T[T.length-1];try{const D=atob(j),L=Uint8Array.from(D,F=>F.charCodeAt(0)),q=new TextDecoder().decode(L);(M=navigator.clipboard)==null||M.writeText(q).catch(()=>{})}catch{}return!0}),x.open(u),A.fit(),(C=document.fonts)==null||C.ready.then(()=>{m||(A.fit(),y())});const E=x.onData(w=>{(S==null?void 0:S.readyState)===WebSocket.OPEN&&S.send(w)}),y=()=>{(S==null?void 0:S.readyState)===WebSocket.OPEN&&S.send(JSON.stringify({type:"resize",cols:x.cols,rows:x.rows}))},b=new ResizeObserver(()=>{A.fit(),y()});b.observe(u);const v=w=>{var T;(T=w.dataTransfer)!=null&&T.types.includes("Files")&&(w.preventDefault(),w.dataTransfer.dropEffect="copy")},_=w=>{var D,L;const T=(D=w.dataTransfer)==null?void 0:D.files;if(!T||T.length===0)return;w.preventDefault();const j=(L=pr())==null?void 0:L.pathForFile;if(!j)return;const M=V6(Array.from(T,q=>j(q)));M!==null&&(x.paste(M),x.focus())};u.addEventListener("dragover",v),u.addEventListener("drop",_);function k(){if(m)return;const w=new WebSocket(G6(e,t));S=w,w.onopen=()=>{g=0,c("connected"),l(null),A.fit(),y()},w.onmessage=T=>{const j=typeof T.data=="string"?T.data:new TextDecoder().decode(T.data);x.write(j)},w.onclose=T=>{if(m)return;if(K6.has(T.code)){c("error"),l(T.reason||`Connection refused (${T.code})`);return}const j=Math.min(1e3*2**g,W6);g+=1,c("connecting"),p=setTimeout(k,j)}}return k(),()=>{m=!0,p&&clearTimeout(p),u.removeEventListener("dragover",v),u.removeEventListener("drop",_),b.disconnect(),E.dispose(),S==null||S.close(),x.dispose(),r.current=null}},[e,t]),d.jsx("div",{className:"harness-terminal",...Ot({surface:"terminal"}),children:d.jsx("div",{ref:n,className:"terminal-screen"})})},Q6=8e3,eL=400,tL={info:"Info",success:"CircleCheck",error:"TriangleAlert"};function sL({message:e,tone:t="error",onDismiss:n}){const[r,o]=O.useState(!1),[c,h]=O.useState(!1),l=O.useCallback(()=>o(!0),[]);return O.useEffect(()=>{o(!1)},[e]),O.useEffect(()=>{if(r||c)return;const u=window.setTimeout(l,Q6);return()=>window.clearTimeout(u)},[e,r,c,l]),O.useEffect(()=>{if(!r)return;const u=window.setTimeout(n,eL);return()=>window.clearTimeout(u)},[r,n]),d.jsxs("div",{className:r?"toast is-leaving":"toast",role:"alert","data-tone":t,"data-testid":"toast",onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),onFocus:()=>h(!0),onBlur:()=>h(!1),onAnimationEnd:r?n:void 0,children:[d.jsx("span",{className:"toast-icon","aria-hidden":"true",children:d.jsx(de,{name:tL[t],size:16})}),d.jsx("span",{className:"toast-message",children:e}),d.jsx("button",{className:"toast-dismiss","aria-label":"Dismiss",onClick:l,children:d.jsx(de,{name:"X",size:14})})]},e)}function nL(){const e=O.useRef(null);return O.useEffect(()=>{const t=e.current;if(!t)return;let n=null;const r=()=>{n=null,t.dataset.show="false",t.textContent=""},o=l=>{const u=l.closest("[data-tooltip], [title], [data-tip-stash]");if(!u||u===n)return;const m=u;m.title&&(m.dataset.tipStash=m.title,m.removeAttribute("title"));const g=m.dataset.tooltip||m.dataset.tipStash;if(!g)return;n=u,t.textContent=g,t.dataset.show="true";const p=u.getBoundingClientRect(),{offsetWidth:S,offsetHeight:x}=t,A=u.closest(".rail-workflows");if(A&&A.getBoundingClientRect().right+S+14<=window.innerWidth){const b=A.getBoundingClientRect().right+8,v=Math.min(Math.max(p.top+p.height/2-x/2,6),window.innerHeight-x-6);t.style.transform=`translate(${Math.round(b)}px, ${Math.round(v)}px)`;return}const E=Math.min(Math.max(p.left+p.width/2-S/2,6),window.innerWidth-S-6),y=p.top-x-7>=4?p.top-x-7:p.bottom+7;t.style.transform=`translate(${Math.round(E)}px, ${Math.round(y)}px)`},c=l=>o(l.target),h=l=>{n&&!n.contains(l.relatedTarget)&&r()};return document.addEventListener("pointerover",c,!0),document.addEventListener("pointerout",h,!0),document.addEventListener("pointerdown",r,!0),document.addEventListener("keydown",r,!0),document.addEventListener("scroll",r,!0),window.addEventListener("blur",r),()=>{document.removeEventListener("pointerover",c,!0),document.removeEventListener("pointerout",h,!0),document.removeEventListener("pointerdown",r,!0),document.removeEventListener("keydown",r,!0),document.removeEventListener("scroll",r,!0),window.removeEventListener("blur",r)}},[]),d.jsx("div",{ref:e,className:"app-tooltip","data-show":"false",role:"tooltip","aria-hidden":"true"})}const iL="~/.sapiom/harness",rL={events:`${iL}/events.ndjson`},nh=10*1024*1024,bv=50*1024*1024,aL=["claude-code","codex"],c_=["vscode","vscode-insiders","cursor","windsurf","zed"],oL=[{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 lL(e){const t=e.filter(n=>n.id==="sapiom");return t.length===0?e:[...t,...e.filter(n=>n.id!=="sapiom")]}function u_(e){return e.mode==="embedded"&&e.installed&&aL.includes(e.id)}function cL(e){if(u_(e))return null;if(e.mode==="external")return`${e.label} runs in its own app. Agent Studio can't launch it yet.`;if(!e.installed){const t=e.installMcpPrompt.trim();return t.length>0?t:`${e.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 ${e.label} yet.`}function uL(e,t){var n;return((n=e.find(r=>r.id===t))==null?void 0:n.label)??t}function dL(e){return e.name||"pasted-file"}function hL(e,t){const n=[];for(let o=0;o<e.length;o+=32768)n.push(String.fromCharCode(...e.subarray(o,o+32768)));return`data:${t};base64,${btoa(n.join(""))}`}async function fL(e){const t=new Uint8Array(e.byteLength);t.set(e);const n=await crypto.subtle.digest("SHA-256",t.buffer);return Array.from(new Uint8Array(n),r=>r.toString(16).padStart(2,"0")).join("")}async function pL(e,t,n=bv){const r=[],o=[];let c=0;for(const h of e){const l=dL(h);let u="";try{u=(t==null?void 0:t(h))??""}catch{}if(u){r.push({id:crypto.randomUUID(),kind:"path",name:l,path:u});continue}if(h.size>nh){o.push(`${l} is too large to paste (${h.size} bytes; limit ${nh} bytes).`);continue}if(c+h.size>n){o.push(`${l} would exceed the ${bv}-byte pasted-file limit for one session.`);continue}try{const m=h.type||"application/octet-stream",g=new Uint8Array(await h.arrayBuffer());if(g.byteLength>nh){o.push(`${l} is too large to paste (${g.byteLength} bytes; limit ${nh} bytes).`);continue}r.push({id:crypto.randomUUID(),kind:"inline",name:l,mediaType:m,bytes:g.byteLength,dataUrl:hL(g,m),fingerprint:await fL(g)}),c+=g.byteLength}catch{o.push(`Couldn't read ${l}.`)}}return{attachments:r,errors:o}}function Cx(e){return e.kind==="path"?`path:${e.path}`:`inline:${e.fingerprint}`}function mL(e,t){const n=new Set(e.map(Cx)),r=[...e];for(const o of t){const c=Cx(o);n.has(c)||(n.add(c),r.push(o))}return r}async function gL(e,t,n){const r=[];for(const o of t){if(o.kind==="path"){r.push({name:o.name,path:o.path});continue}try{const c=await n(e,{dataUrl:o.dataUrl,filename:o.name});r.push({name:o.name,path:c.path})}catch(c){const h=c.message;throw new Error(`Couldn't attach ${o.name}${h?`: ${h}`:"."}`,{cause:c})}}return r}function vL(e,t){const n=e.trim();if(t.length===0)return n||void 0;const o=`Attached files (read each as context):
|
|
502
|
+
${t.map(c=>U2(c.path)).join(`
|
|
503
|
+
`)}`;return n?`${n}
|
|
504
|
+
|
|
505
|
+
${o}`:o}function _g(e){return Pa(e)}async function _L(e,t,n){const r=_g(e.trim());if(!r)return{kind:"new"};if(t)return{kind:"new"};const o=W$(r);try{const c=o?await n(o):null;if(!!(c!=null&&c.dirs.some(m=>_g(m.path)===r&&m.hasAgentProject)))return{kind:"project"};const l=await n(r);if(_g(l.path)!==r)return{kind:"new"};const u=l.dirs.filter(m=>m.hasAgentProject).length;return u>0?{kind:"multi",directChildren:u}:{kind:"plain"}}catch{if(o)try{return await n(o),{kind:"new"}}catch{throw new Error("Couldn't read that directory.")}throw new Error("Couldn't read that directory.")}}function d_({mode:e="detect",recentDirs:t,launchDir:n,projectRoot:r,listDir:o,onClose:c,onConnect:h,onOpenProject:l,onScan:u,triggerRef:m}){const[g,p]=O.useState(r??n??t[0]??""),[S,x]=O.useState(null),[A,E]=O.useState(!0),[y,b]=O.useState(!1),[v,_]=O.useState(null),[k,C]=O.useState(!1),w=O.useRef(null);Ua(!0,{onDismiss:c,containerRef:w,triggerRef:m}),O.useEffect(()=>{E(!0),C(!1)},[g]);const T=O.useRef(g);T.current=g;const j=O.useRef(0),M=O.useCallback(z=>{const B=T.current.trim(),$=++j.current;if(!B){x(null),E(!1);return}_L(B,z.isNew,o).then(H=>{$===j.current&&(x(H),_(null))}).catch(H=>{$===j.current&&(x(null),_(H.message))}).finally(()=>{$===j.current&&E(!1)})},[o]),D=async z=>{b(!0),_(null);try{await z(),c()}catch(B){_(B.message)}finally{b(!1)}},L=g.trim(),q=S!=null&&S.kind!=="new"&&L!=="",F=l!=null&&!!S&&(S==null?void 0:S.kind)!=="new"&&L!=="",Y=()=>void D(()=>h(L)),Q=()=>{if(k){D(async()=>{if(await u(L)===0)throw new Error("No agent projects found under this folder.")});return}C(!0)},G=()=>void D(async()=>{await(l==null?void 0:l(L)),(S==null?void 0:S.kind)==="project"&&await h(L)}),ee=()=>{if(!(y||A||!S||!L)){if(e==="open"){F&&G();return}S.kind==="project"?Y():q&&Q()}},ne=z=>{z.key==="Enter"&&(z.metaKey||z.ctrlKey)&&(z.preventDefault(),ee())};return d.jsx("div",{className:"modal-backdrop",children:d.jsxs("div",{className:"modal modal-start",role:"dialog","aria-label":e==="open"?"Add a project":"Add existing agents",ref:w,onKeyDown:ne,...Ot({dialog:"add_agents"}),children:[d.jsxs("div",{className:"modal-header modal-start-header",children:[d.jsx("span",{className:"modal-start-title",children:e==="open"?"Add a project":"Add existing agents"}),d.jsx("button",{className:"theme-toggle modal-close","aria-label":"Close",title:"Close",onClick:c,children:d.jsx(de,{name:"X",size:14})})]}),d.jsxs("div",{className:"modal-body",children:[d.jsx("p",{className:"modal-field-hint modal-start-sub",children:e==="open"?"Pick a folder to work in. It doesn't need an agent yet — agents (sapiom.json) anywhere inside it appear under it automatically.":"Add a folder that already holds an agent project."}),d.jsx("section",{className:"modal-section",children:d.jsx(B2,{value:g,onChange:p,onSubmit:ee,recentDirs:[],listDir:o,onResolve:M})}),S&&d.jsx(yL,{outcome:S,path:L}),v&&d.jsx("div",{className:"modal-error",children:v})]}),d.jsxs("div",{className:"modal-actions modal-start-actions",children:[d.jsx("button",{className:"btn-ghost",onClick:c,disabled:y,children:"Cancel"}),d.jsx(bL,{mode:e,outcome:S,checking:A,busy:y,canOpen:F,canScan:q,armed:k,onConnect:Y,onScan:Q,onOpen:G})]})]})})}function yL({outcome:e,path:t}){const n=e.kind==="project"||e.kind==="multi";return d.jsx("div",{className:"aw-result","data-tone":n?"good":"todo","data-testid":"aw-result","aria-live":"polite",children:d.jsxs("div",{className:"aw-result-head",children:[d.jsx("span",{className:"aw-result-glyph","aria-hidden":"true",children:d.jsx(de,{name:n?"Check":"TriangleAlert",size:14})}),d.jsxs("span",{className:"aw-result-text",children:[d.jsxs("span",{className:"aw-result-title",children:[e.kind==="project"&&"This is an agent project",e.kind==="multi"&&`${e.directChildren} agent ${e.directChildren===1?"project":"projects"} directly inside this folder`,e.kind==="plain"&&"No agent directly inside this folder",e.kind==="new"&&"This folder doesn't exist yet"]}),d.jsx("span",{className:"aw-result-path",title:t,children:t}),(e.kind==="multi"||e.kind==="plain")&&d.jsx("span",{className:"aw-result-note","data-testid":"aw-scan-reach",children:"Detection only looks one level down. Adding searches the whole tree beneath this folder, so it can find agents this line cannot see — and on a large folder, many more than it names."})]})]})})}function bL({mode:e,outcome:t,checking:n,busy:r,canOpen:o,canScan:c,armed:h,onConnect:l,onScan:u,onOpen:m}){if(n||!t)return d.jsx("button",{className:"btn-primary modal-primary-cta","data-testid":"start-primary",disabled:!0,children:"Checking…"});const g=c&&t.kind!=="project"?d.jsx("button",{className:(e==="open"?"btn-ghost":"btn-primary modal-primary-cta")+(h?" is-armed":""),"data-testid":"aw-add-all","data-armed":h?"true":"false",onClick:u,disabled:r,children:r?"Adding…":h?"Add them — this can be a lot of rows":"Add every agent under this folder"}):null;if(e==="open")return d.jsxs(d.Fragment,{children:[g,d.jsx("button",{className:"btn-primary modal-primary-cta","data-testid":"open-project",onClick:m,disabled:r||!o,children:r?"Opening…":"Open project"})]});const p=o?d.jsx("button",{className:"btn-ghost","data-testid":"open-project",onClick:m,disabled:r,children:"Open folder anyway"}):null;switch(t.kind){case"project":return d.jsx("button",{className:"btn-primary modal-primary-cta","data-testid":"aw-add",onClick:l,disabled:r,children:r?"Adding…":"Add workspace"});case"multi":return g;case"plain":return d.jsxs(d.Fragment,{children:[p,g]});case"new":return d.jsx("button",{className:"btn-primary modal-primary-cta","data-testid":"start-primary",disabled:!0,children:"Add workspace"})}}const SL="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",wL="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",xL={"claude-code":SL,codex:wL},CL=["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 h_({kind:e,size:t=16}){if(e==="sapiom")return d.jsx("svg",{viewBox:"0 0 115 122",width:t,height:t,fill:"currentColor","aria-hidden":"true",focusable:"false",children:CL.map(r=>d.jsx("path",{d:r},r.slice(0,16)))});const n=xL[e];return n?d.jsx("svg",{viewBox:"0 0 24 24",width:t,height:t,fill:"currentColor","aria-hidden":"true",focusable:"false",children:d.jsx("path",{d:n})}):d.jsx(de,{name:"SquareTerminal",size:t})}function EL({entries:e,activeId:t,testidPrefix:n,onPick:r}){return d.jsx(d.Fragment,{children:e.map(o=>{const c=u_(o),h=o.id===t,l=cL(o);return d.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":h,"aria-disabled":!c||void 0,className:"profile-menu-item provider-item"+(c?"":" is-unavailable"),"data-testid":`${n}-${o.id}`,"data-tooltip":l??void 0,onClick:()=>{c&&r(o.id)},children:[d.jsx("span",{className:"provider-item-check","aria-hidden":"true",children:h&&d.jsx(de,{name:"Check",size:13})}),d.jsx(h_,{kind:o.id,size:13}),o.label]},o.id)})})}const kL=[{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."}],jL=3;function RL(e){const t=e.getHours();return t<12?"Good morning.":t<18?"Good afternoon.":"Good evening."}function AL(e){return e.replace(/\s+/g,"-")}function TL({firstRun:e,onSubmitIdea:t,onAttachmentError:n,onUseTemplate:r,onBrowseTemplates:o,listHarnesses:c,listTemplates:h,telemetryOptIn:l,onToggleTelemetry:u,recentDirs:m,projectRoot:g,listDir:p,onConnect:S,onScan:x,onScaffold:A,onSaveProjectRoot:E}){const[y,b]=O.useState(""),[v,_]=O.useState(()=>ui().preferredHarness??"claude-code"),[k,C]=O.useState(oL),[w,T]=O.useState(!1),[j,M]=O.useState([]),[D,L]=O.useState(!1),[q,F]=O.useState([]),[Y,Q]=O.useState(!1),[G,ee]=O.useState(!1),[ne,z]=O.useState(!1),[B,$]=O.useState(!1),H=O.useRef(null),U=O.useRef(null),P=O.useRef(null),W=O.useRef(null),se=O.useRef([]),X=O.useRef(!1),V=O.useRef(!1),ue=O.useRef(Promise.resolve()),oe=O.useRef(0),Z=O.useCallback(()=>T(!1),[]);O.useEffect(()=>{let Re=!1;return c().then(He=>{if(Re||He.length===0)return;C(lL(He));const Ke=He.filter(u_);_(kt=>{var ot;return Ke.some(Ct=>Ct.id===kt)?kt:((ot=Ke[0])==null?void 0:ot.id)??kt})}).catch(()=>{}),()=>{Re=!0}},[c]),O.useEffect(()=>{let Re=!1;return h().then(He=>{Re||M(He.templates.map(Ke=>({...Ke,kind:"gallery"})).slice(0,jL))}).catch(()=>{}),()=>{Re=!0}},[h]);const te=Re=>{_(Re),xi({preferredHarness:Re==="codex"?"codex":"claude-code"}),Z()},pe=Re=>{B||($(!0),window.setTimeout(Re,170))},ye=()=>{if(B||X.current||V.current)return;X.current=!0,z(!0),$(!0);const Re=se.current;window.setTimeout(()=>{t(y.trim(),v,Re).catch(He=>{var Ke;X.current=!1,$(!1),z(!1),(Ke=H.current)==null||Ke.focus(),n(He.message||"Couldn't start a session with those files.")})},170)},ke=Re=>{var ot;if(Re.length===0||X.current)return;const He=(ot=pr())==null?void 0:ot.pathForFile;oe.current+=1,V.current=!0,ee(!0);const Ke=async()=>{const Ct=se.current.reduce((Mt,jt)=>Mt+(jt.kind==="inline"?jt.bytes:0),0),wt=await pL(Re,He,Math.max(0,bv-Ct));if(wt.attachments.length>0){const Mt=mL(se.current,wt.attachments);se.current=Mt,F(Mt)}wt.errors.length>0&&n(wt.errors.join(" "))},kt=ue.current.then(Ke);ue.current=kt.catch(()=>{}),kt.catch(Ct=>{n(Ct.message||"Couldn't attach those files.")}).then(()=>{oe.current-=1,oe.current===0&&(V.current=!1,ee(!1))})},Le=Re=>{if(X.current)return;const He=se.current.filter(Ke=>Ke.id!==Re);se.current=He,F(He)},Ie=q.length===0?"No files attached.":q.length===1?"1 file attached.":`${q.length} files attached.`,qe=Y?"Drop files to attach.":ne?`Starting session with ${Ie.toLowerCase()}`:G?"Preparing attached files.":Ie;return d.jsxs("div",{className:"composer-home"+(B?" is-leaving":""),"data-testid":"new-session-composer",...Ot({surface:"composer"}),children:[d.jsxs("div",{className:"composer-hero",children:[d.jsxs("p",{className:"composer-greeting","data-testid":"composer-greeting",children:[RL(new Date)," ",e?"Let's build your first agent.":"Let's build a new agent."]}),d.jsx("h1",{className:"composer-heading",children:"What should your agent do?"}),d.jsx("div",{className:"composer-chips",role:"list",children:kL.map(Re=>d.jsx("button",{type:"button",role:"listitem",className:"composer-chip","data-testid":`composer-chip-${AL(Re.label)}`,onClick:()=>{var He;b(Re.prompt),(He=H.current)==null||He.focus()},children:Re.label},Re.label))}),d.jsxs("div",{className:"composer-box"+(Y?" is-dragging-files":"")+(ne||G?" is-busy":""),"data-testid":"composer-box",role:"group","aria-label":"New session request","aria-busy":ne||G,"aria-describedby":"composer-attachment-status",onPaste:Re=>{const He=Array.from(Re.clipboardData.items).filter(kt=>kt.kind==="file").flatMap(kt=>{const ot=kt.getAsFile();return ot?[ot]:[]}),Ke=He.length>0?He:Array.from(Re.clipboardData.files??[]);Ke.length!==0&&(Re.preventDefault(),ke(Ke))},onDragEnter:Re=>{Array.from(Re.dataTransfer.types).includes("Files")&&(Re.preventDefault(),!X.current&&Q(!0))},onDragOver:Re=>{Array.from(Re.dataTransfer.types).includes("Files")&&(Re.preventDefault(),!X.current&&(Re.dataTransfer.dropEffect="copy",Q(!0)))},onDragLeave:Re=>{const He=Re.relatedTarget;He instanceof Node&&Re.currentTarget.contains(He)||Q(!1)},onDrop:Re=>{Array.from(Re.dataTransfer.types).includes("Files")&&(Re.preventDefault(),Q(!1),ke(Array.from(Re.dataTransfer.files)))},children:[Y&&d.jsxs("div",{className:"composer-drop-hint","aria-hidden":"true",children:[d.jsx(de,{name:"CloudUpload",size:18})," Drop files to attach"]}),d.jsx("textarea",{ref:H,className:"composer-input","data-testid":"composer-input",placeholder:"Describe the outcome you want","aria-label":"Describe the outcome you want",value:y,rows:2,autoFocus:!0,onChange:Re=>b(Re.target.value),onKeyDown:Re=>{Re.key==="Enter"&&!Re.shiftKey&&(Re.preventDefault(),ye())}}),q.length>0&&d.jsx("ul",{className:"composer-files","data-testid":"composer-files","aria-label":"Attached files",children:q.map(Re=>d.jsxs("li",{className:"composer-file",...Ot({object:"file"}),children:[d.jsx(de,{name:"Paperclip",size:13}),d.jsx("span",{className:"composer-file-name",title:Re.name,children:Re.name}),d.jsx("button",{type:"button",className:"composer-file-remove","aria-label":`Remove ${Re.name}`,disabled:ne,onClick:()=>Le(Re.id),children:d.jsx(de,{name:"X",size:11})})]},Re.id))}),d.jsxs("div",{className:"composer-box-actions",children:[d.jsx("button",{ref:W,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:()=>L(!0),children:d.jsx(de,{name:"Plus",size:16})}),d.jsx("button",{type:"button",className:"composer-attach","data-testid":"composer-attach-files","aria-label":"Attach files","data-tooltip":"Attach files",disabled:ne,onClick:()=>{var Re;return(Re=U.current)==null?void 0:Re.click()},children:d.jsx(de,{name:"Paperclip",size:15})}),d.jsx("input",{ref:U,type:"file",multiple:!0,hidden:!0,"data-testid":"composer-file-input",onChange:Re=>{ke(Re.target.files?Array.from(Re.target.files):[]),Re.target.value=""}}),d.jsxs("div",{className:"composer-box-right",children:[d.jsxs("button",{ref:P,type:"button",className:"harness-select composer-harness","data-testid":"composer-harness-select","aria-haspopup":"menu","aria-expanded":w,"aria-label":"Coding agent for this session","data-tooltip":"Which coding agent runs this session",onClick:()=>T(Re=>!Re),children:[d.jsx(h_,{kind:v,size:14}),d.jsx("span",{className:"harness-select-label",children:uL(k,v)}),d.jsx("span",{className:"disclosure-caret"+(w?" is-open":""),"aria-hidden":"true",children:d.jsx(de,{name:"ChevronDown",size:12})})]}),d.jsx(Ci,{open:w,anchorRef:P,onDismiss:Z,placement:"up-end",className:"session-menu harness-select-menu",role:"menu",testid:"composer-harness-menu",children:d.jsx(EL,{entries:k,activeId:v,testidPrefix:"composer-harness-option",onPick:te})}),d.jsx("button",{type:"button",className:"composer-send","data-testid":"composer-send","aria-label":"Start session",title:"Start session",disabled:ne||G,onClick:ye,children:d.jsx(de,{name:"ArrowUp",size:16})})]})]})]}),d.jsx("div",{id:"composer-attachment-status",className:"visually-hidden",role:"status","aria-live":"polite","aria-atomic":"true","data-testid":"composer-attachment-status",children:qe})]}),j.length>0&&d.jsxs("div",{className:"composer-templates",children:[d.jsxs("div",{className:"composer-templates-head",children:[d.jsx("span",{className:"composer-templates-title",children:"Start from a template"}),d.jsxs("button",{type:"button",className:"composer-templates-all","data-testid":"composer-browse-templates",onClick:o,children:["Browse all templates ",d.jsx(de,{name:"ChevronRight",size:13})]})]}),d.jsx("div",{className:"composer-template-grid",children:j.map((Re,He)=>d.jsxs("button",{type:"button",className:"composer-template-card","data-testid":`composer-template-${Re.id}`,onClick:()=>pe(()=>r(Re)),children:[d.jsxs("span",{className:"composer-template-cardhead",children:[d.jsx("span",{className:"composer-template-name",children:Re.name}),He===0&&d.jsx("span",{className:"composer-template-suggested",children:"Suggested"})]}),d.jsx("span",{className:"composer-template-desc",children:Re.description}),d.jsxs("span",{className:"composer-template-meta",children:[Re.stepCount," ",Re.stepCount===1?"step":"steps"," ·"," ",n_(Re.complexity),Re.capabilities.length>0&&` · ${Re.capabilities.length} ${Re.capabilities.length===1?"capability":"capabilities"}`]})]},Re.id))})]}),e&&d.jsxs("div",{className:"composer-footer",children:[d.jsxs("label",{className:"composer-consent","data-testid":"welcome-consent",children:[d.jsx("button",{type:"button",role:"switch","aria-checked":l,"data-testid":"welcome-telemetry-toggle",className:"toggle-switch"+(l?" is-on":""),onClick:()=>void u(!l),children:d.jsx("span",{className:"toggle-knob"})}),d.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."})]}),d.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 ",d.jsx(de,{name:"ArrowUpRight",size:12})]})]}),D&&d.jsx(d_,{recentDirs:m,projectRoot:g,listDir:p,onClose:()=>L(!1),onConnect:S,onScan:x,triggerRef:W})]})}function NL({firstRun:e,appVersion:t,recentDirs:n,projectRoot:r,listDir:o,onConnect:c,onScan:h,onBrowseTemplates:l,onDismiss:u}){const[m,g]=O.useState(!1),p=O.useRef(null),S=O.useRef(u);return S.current=u,O.useEffect(()=>{if(m)return;const x=E=>{E.key==="Escape"&&S.current()},A=window.setTimeout(()=>window.addEventListener("keydown",x),0);return()=>{window.clearTimeout(A),window.removeEventListener("keydown",x)}},[m]),d.jsxs("div",{className:"overview-modal","data-testid":"overview-modal",role:"dialog","aria-modal":"true","aria-label":"Sapiom agent.studio overview",onClick:x=>{x.target===x.currentTarget&&u()},children:[d.jsxs("div",{className:"overview-modal-card",children:[d.jsx("button",{type:"button",className:"theme-toggle overview-modal-close","data-testid":"overview-exit","aria-label":"Close","data-tooltip":"Close",onClick:u,children:d.jsx(de,{name:"X",size:14})}),d.jsxs("div",{className:"overview-modal-body",children:[d.jsx("h1",{className:"overview-modal-title",children:e?"Welcome to Sapiom agent.studio":"Sapiom agent.studio"}),t&&d.jsxs("p",{className:"overview-modal-version","data-testid":"overview-version",children:["v",t]}),d.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."}),d.jsxs("div",{className:"overview-modal-path","data-testid":"overview-open-card",children:[d.jsx("span",{className:"overview-modal-path-icon","aria-hidden":"true",children:d.jsx(de,{name:"FolderOpen",size:20})}),d.jsxs("span",{className:"overview-modal-path-copy",children:[d.jsx("span",{className:"overview-modal-path-title",children:"Open a folder"}),d.jsx("span",{className:"overview-modal-path-desc",children:"Agents in the folder appear in the rail. Nothing is uploaded."})]}),d.jsx("button",{ref:p,type:"button",className:"btn-primary overview-modal-cta","data-testid":"overview-open-folder",onClick:()=>g(!0),children:"Open folder"})]}),d.jsxs("div",{className:"overview-modal-path","data-testid":"overview-templates-card",children:[d.jsx("span",{className:"overview-modal-path-icon","aria-hidden":"true",children:d.jsx(de,{name:"LayoutTemplate",size:20})}),d.jsxs("span",{className:"overview-modal-path-copy",children:[d.jsx("span",{className:"overview-modal-path-title",children:"Start from a template"}),d.jsx("span",{className:"overview-modal-path-desc",children:"Runnable starters, cloned locally and free to test."})]}),d.jsx("button",{type:"button",className:"btn-line overview-modal-cta","data-testid":"overview-browse-templates",onClick:l,children:"Browse templates"})]}),d.jsxs("a",{className:"overview-modal-docs","data-testid":"overview-docs",href:iA,target:"_blank",rel:"noopener noreferrer",children:["Read documentation ",d.jsx(de,{name:"ArrowUpRight",size:12})]})]})]}),m&&d.jsx(d_,{recentDirs:n,projectRoot:r,listDir:o,onClose:()=>g(!1),onConnect:c,onScan:h,triggerRef:p})]})}const ML="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",Ex=89,Qh=24,$L=19.9385,DL=(Qh-$L)/Qh;function OL({height:e=16,className:t,style:n,...r}){const o=!!r["aria-label"];return d.jsx("svg",{...r,className:["brand-logotype",t].filter(Boolean).join(" "),style:{"--brand-logotype-descender":`${DL*e}px`,...n},width:Ex/Qh*e,height:e,viewBox:`0 0 ${Ex} ${Qh}`,fill:"none",focusable:"false",role:o?"img":void 0,"aria-hidden":o?void 0:!0,children:d.jsx("path",{d:ML,fill:"currentColor"})})}function LL({canGoBack:e,canGoForward:t,onGoBack:n,onGoForward:r}){return d.jsxs("div",{className:"session-nav","data-testid":"session-nav",role:"group","aria-label":"Go back or forward",children:[d.jsx("button",{type:"button",className:"theme-toggle session-nav-btn","data-testid":"session-nav-back",disabled:!e,"aria-label":"Go back","data-tooltip":"Go back",onClick:n,children:d.jsx(de,{name:"ArrowLeft",size:14})}),d.jsx("button",{type:"button",className:"theme-toggle session-nav-btn","data-testid":"session-nav-forward",disabled:!t,"aria-label":"Go forward","data-tooltip":"Go forward",onClick:r,children:d.jsx(de,{name:"ArrowRight",size:14})})]})}function IL({onCollapse:e,canGoBack:t,canGoForward:n,onGoBack:r,onGoForward:o}){return d.jsxs("header",{className:"brand-header",children:[d.jsx("div",{className:"brand-header-window",children:d.jsx("button",{className:"theme-toggle rail-toggle","data-testid":"rail-collapse","aria-label":"Collapse workspace panel",title:"Collapse workspace panel",onClick:e,children:d.jsx(de,{name:"PanelLeftClose",size:14})})}),d.jsxs("h1",{className:"brand-lockup",children:[d.jsxs("span",{className:"brand-mark",children:[d.jsx(OL,{height:13,"aria-hidden":!0}),d.jsx("span",{className:"visually-hidden",children:"Sapiom "})]}),d.jsx("span",{className:"brand-product",children:"agent.studio"})]}),d.jsx(LL,{canGoBack:t,canGoForward:n,onGoBack:r,onGoForward:o})]})}function yg(e){const t=Math.round(e*100)/100;return Number.isInteger(t)?`$${t}`:`$${t.toFixed(2)}`}function PL(e){switch(e.kind){case"limit":return`${yg(e.usedUsd)} / ${yg(e.limitUsd)}`;case"balance":return`${yg(e.availableUsd)} available`;case"none":return null}}function BL({plan:e}){const[t,n]=O.useState(!1),r=O.useRef(null),o=O.useCallback(()=>n(!1),[]);if(!e)return null;const c=PL(e.readout);return!e.plan&&!c?null:d.jsx("div",{className:"rail-footer-row plan-row","data-testid":"plan-card",children:d.jsxs("div",{className:"rail-footer-card plan-card",children:[d.jsxs("span",{className:"plan-card-copy",children:[e.plan&&d.jsx("span",{className:"plan-card-name",children:e.plan.name}),c&&d.jsx("span",{className:"plan-card-readout","data-testid":"plan-balance",children:c})]}),d.jsx("a",{className:"pill plan-card-upgrade",href:c1,target:"_blank",rel:"noreferrer","data-testid":"plan-upgrade",onClick:()=>Pc("plan.upgrade_clicked"),children:"Upgrade"}),d.jsx("button",{ref:r,className:"plan-card-menu-btn","data-testid":"plan-menu-trigger","aria-haspopup":"menu","aria-expanded":t,"aria-label":"Plan options",onClick:()=>n(h=>!h),children:d.jsx(de,{name:"EllipsisVertical",size:13})}),d.jsxs(Ci,{open:t,anchorRef:r,onDismiss:o,placement:"up-end",className:"plan-menu",role:"menu",testid:"plan-menu",children:[d.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"plan-manage-billing",onClick:()=>{window.open(c1,"_blank","noopener,noreferrer"),o()},children:[d.jsx(de,{name:"ExternalLink",size:13}),"Manage billing"]}),d.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"plan-view-usage",onClick:()=>{window.open(sA,"_blank","noopener,noreferrer"),o()},children:[d.jsx(de,{name:"ExternalLink",size:13}),"View usage"]})]})]})})}function zL({desktop:e,version:t,onToast:n}){const[r,o]=O.useState(!1),c=async()=>{if(!r){o(!0);try{const h=await e.checkForUpdates();h.kind!=="downloaded"&&n(P2(h).text)}catch{n("Couldn't check for updates.")}finally{o(!1)}}};return d.jsx("div",{className:"rail-footer-row update-row",children:d.jsxs("button",{className:"rail-footer-card update-card","data-testid":"update-card",disabled:r,onClick:()=>void c(),children:[d.jsx("span",{className:"update-card-label",children:"Update now"}),d.jsxs("span",{className:"update-card-version","data-testid":"update-card-version",children:["v",t]}),d.jsx(de,{name:"ChevronRight",size:14})]})})}const HL=c_[0],F2={vscode:"VS Code","vscode-insiders":"VS Code Insiders",cursor:"Cursor",windsurf:"Windsurf",zed:"Zed"},UL=c_.map(e=>({kind:e,label:F2[e]}));function yf(e){return c_.includes(e)?e:HL}function kx(e){return F2[yf(e)]}function FL(e,t){const n=t.replace(/\\/g,"/"),r=n.startsWith("/")?n:`/${n}`;return`${yf(e)}://file${encodeURI(r)}`}function qL({authenticated:e,organizationName:t,telemetryOptIn:n,productAnalyticsOptIn:r,consentSource:o,consentEnvReason:c,onToggleTelemetry:h,onToggleProductAnalytics:l,rollingSummary:u,onToggleRollingSummary:m,editor:g,onSelectEditor:p,onStartAuth:S,onDisconnect:x}){const[A,E]=O.useState(!1),[y,b]=O.useState({status:"idle"}),v=o==="env-forced-off",_=v?!1:n,k=v?!1:r,C=async()=>{const D=!n;E(!0);try{await h(D),Pc("consent.changed",{optIn:D})}finally{E(!1)}},w=async()=>{const D=!r;E(!0);try{await l(D),Pc("consent.changed",{productAnalytics:D})}finally{E(!1)}},T=async()=>{E(!0);try{await m(!u)}finally{E(!1)}},j=async D=>{E(!0);try{await p(D)}finally{E(!1)}},M=async()=>{b({status:"pending"});try{await S()}catch(D){const L=D instanceof Error?D.message:"Could not start sign-in. Try again.";b({status:"error",message:L})}};return e&&y.status==="pending"&&b({status:"idle"}),d.jsxs(z2,{surface:"settings",children:[d.jsx("div",{className:"settings-identity",children:e?t??"Signed in":"Not signed in"}),!e&&d.jsx("div",{className:"settings-auth-row",children:y.status==="pending"?d.jsxs("span",{className:"settings-auth-pending","data-testid":"settings-auth-pending",children:[d.jsx(de,{name:"Loader",size:13}),"Opening browser… waiting for sign-in"]}):d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",className:"btn-primary settings-connect-btn","data-testid":"settings-connect-btn",onClick:()=>void M(),children:"Connect account"}),y.status==="error"&&d.jsx("p",{className:"settings-note settings-auth-error","data-testid":"settings-auth-error",children:y.message})]})}),lC(),d.jsxs("label",{className:"settings-toggle-row",children:[d.jsx("span",{children:"Share session details with Sapiom"}),d.jsx("button",{type:"button",role:"switch","aria-checked":_,"data-testid":"telemetry-toggle",className:"toggle-switch"+(_?" is-on":""),disabled:A||v,onClick:()=>void C(),children:d.jsx("span",{className:"toggle-knob"})})]}),d.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 ",d.jsx("code",{children:rL.events})," either way."]}),d.jsxs("label",{className:"settings-toggle-row",children:[d.jsx("span",{children:"Product analytics (clicks & usage)"}),d.jsx("button",{type:"button",role:"switch","aria-checked":k,"data-testid":"product-analytics-toggle",className:"toggle-switch"+(k?" is-on":""),disabled:A||v,onClick:()=>void w(),children:d.jsx("span",{className:"toggle-knob"})})]}),d.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."}),v&&d.jsxs("p",{className:"settings-note settings-env-note","data-testid":"telemetry-env-note",children:["All telemetry is turned off by ",c?`$${c}`:"an environment variable",". Unset it and restart the Agent Studio server to manage consent here."]}),d.jsxs("label",{className:"settings-toggle-row",children:[d.jsx("span",{children:"Summarize sessions in the background"}),d.jsx("button",{type:"button",role:"switch","aria-checked":u,"data-testid":"rolling-summary-toggle",className:"toggle-switch"+(u?" is-on":""),disabled:A,onClick:()=>void T(),children:d.jsx("span",{className:"toggle-knob"})})]}),d.jsxs("label",{className:"settings-toggle-row",children:[d.jsx("span",{children:"Open in editor uses"}),d.jsxs("span",{className:"settings-select-wrap",children:[d.jsx("select",{className:"settings-select","data-testid":"editor-select",value:yf(g),disabled:A,onChange:D=>void j(D.target.value),children:UL.map(D=>d.jsx("option",{value:D.kind,children:D.label},D.kind))}),d.jsx("span",{className:"settings-select-caret","aria-hidden":"true",children:d.jsx(de,{name:"ChevronDown",size:12})})]})]}),d.jsx("p",{className:"settings-note",children:"Which editor the session menu’s “Open in editor” hands the project folder to. It opens the editor’s own URL scheme, so the app has to be installed — the OS never reports back, and an editor that isn’t there simply does nothing."}),d.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"," ",d.jsx("em",{children:"for"}),", not just what it last did. With this off, continuing still works — it carries the last few turns instead."]})]})}const VL=2,GL=22,La=(e,t)=>Li(t,e),gt=e=>Pa(e.replace(/\\/g,"/"));function f_(e,t){const n=gt(e),r=gt(t);return r===n?[]:(n.endsWith("/")?r.slice(n.length):r.slice(n.length+1)).split("/").filter(Boolean)}function jx(e){const t=e.join("/");return e.length<=VL||t.length<=GL?t:`${e[0]}/…/${e[e.length-1]}`}function p_(e,t,n=1){for(let r=Math.max(n,1);r<=e.length;r++){const o=e.slice(-r).join("/");if(!t.some(c=>c.slice(-r).join("/")===o))return e.slice(-r)}return[...e]}function q2(e,t){const n=Us(gt(e.path));return n===e.name||n===t}function WL(e){var t;return(((t=Us(e).match(/[A-Za-z0-9]/))==null?void 0:t[0])??"•").toUpperCase()}const Sv=e=>(t,n)=>e==="name"?Kr(t.workflow.name).localeCompare(Kr(n.workflow.name)):t.workflow.path.localeCompare(n.workflow.path),Rx=(e,t)=>({name:e,path:t,agent:null,children:new Map});function KL(e){const t=[e.name];let n=e;for(;!n.agent&&n.children.size===1;){const[r]=n.children.values();t.push(r.name),n=r}return{segments:t,node:n}}function wv(e,t){const n=[],r=[];for(const o of e.children.values()){const{segments:c,node:h}=KL(o);if(h.agent){const u=c.slice(0,-1),m={workflow:h.agent,prefix:u[u.length-1]??"",prefixFull:u.join("/")},g=wv(h,t);g.dirs.length>0||g.agents.length>0?n.push({path:h.path,label:jx(c),labelFull:c.join("/"),dirs:g.dirs,agents:[m,...g.agents].sort(Sv(t))}):r.push(m);continue}const l=wv(h,t);l.dirs.length===0&&l.agents.length===0||n.push({path:h.path,label:jx(c),labelFull:c.join("/"),dirs:l.dirs,agents:l.agents})}return n.sort((o,c)=>o.labelFull.localeCompare(c.labelFull)),r.sort(Sv(t)),{dirs:n,agents:r}}function YL(e,t,n="recent"){const r=ZL(t);return t.map(o=>{const c=Rx(Us(o),o);for(const u of e){if(!La(u.path,o))continue;const m=f_(o,u.path);if(m.length===0){c.agent=u;continue}let g=c,p=o;for(const S of m){p=$v(p,S);let x=g.children.get(S);x||(x=Rx(S,p),g.children.set(S,x)),g=x}g.agent=u}const{dirs:h,agents:l}=wv(c,n);return{root:o,label:r(o),dirs:h,agents:l,rootAgent:c.agent?{workflow:c.agent,prefix:"",prefixFull:""}:null}})}function Ax(e){return e.rootAgent===null&&e.dirs.length===0&&e.agents.length===0}function Tx(e,t){const n=e.map(c=>f_(t,c.path).slice(0,-1)),r=e.map(c=>Kr(c.name)),o=new Map;return e.forEach((c,h)=>{const l=e.flatMap((u,m)=>m!==h&&r[m]===r[h]?[n[m]]:[]);o.set(c.path,{workflow:c,prefix:p_(n[h],l).join("/"),prefixFull:n[h].join("/")})}),o}function XL(e,t,n="recent"){const r=e.filter(h=>!t.some(l=>La(h.path,l))),o=r.map(h=>gt(h.path).split("/").filter(Boolean).slice(0,-1)),c=r.map(h=>Kr(h.name));return r.map((h,l)=>{const u=r.flatMap((m,g)=>g!==l&&c[g]===c[l]?[o[g]]:[]);return{workflow:h,prefix:p_(o[l],u).join("/"),prefixFull:Gr(h.path)??""}}).sort(Sv(n))}function JL(e,t){return t.agentPaths.some(r=>gt(r)===gt(e))?V2(e,{agentPaths:t.agentPaths,projects:G2(t)})??e:e}function V2(e,{agentPaths:t,projects:n}){const r=new Set(t.map(gt));let o=Gr(e);for(;o&&r.has(gt(o));)o=Gr(o);return o===null||Gr(o)===null||n.some(h=>La(h,o)&>(h)!==gt(o))?null:o}function G2({recentDirs:e,sessions:t,pendingCwds:n,agentPaths:r,sort:o}){const c=new Map;for(const w of t){const T=gt(w.cwd),j=c.get(T);(!j||w.createdAt>j)&&c.set(T,w.createdAt)}const h=new Set,l=[];for(const w of[...n,...e,...t.map(T=>T.cwd)]){const T=gt(w);T===""||h.has(T)||(h.add(T),l.push(w))}const u=new Set(r.map(gt)),m=w=>u.has(gt(w)),g=t.filter(w=>w.status!=null&&w.status!=="exited").map(w=>w.cwd),p=new Set([...n,...e,...g].map(gt)),S=w=>p.has(gt(w)),x=w=>r.filter(T=>La(T,w)&>(T)!==gt(w)),A=new Map,E=[],y=w=>E.some(T=>gt(T)===gt(w));for(const w of l)!S(w)||m(w)||(E.push(w),A.set(gt(w),w));const b=l.filter(w=>!S(w)&&!m(w)).sort((w,T)=>gt(w).split("/").length-gt(T).split("/").length||w.localeCompare(T));for(const w of b){const T=x(w);T.length!==0&&(T.every(j=>E.some(M=>La(j,M)))||(E.push(w),A.set(gt(w),w)))}for(const w of l){if(!m(w)||E.some(j=>La(w,j)&>(j)!==gt(w)))continue;const T=V2(w,{agentPaths:r,projects:E})??w;y(T)||(E.push(T),A.set(gt(T),w))}const v=new Map(n.map((w,T)=>[gt(w),T])),_=new Map(e.map((w,T)=>[gt(w),T])),k=w=>A.get(gt(w))??w,C=(w,T)=>{const j=_.get(gt(k(w)))??-1,M=_.get(gt(k(T)))??-1;return j>=0&&M>=0?j-M:j>=0||M>=0?j>=0?-1:1:(c.get(gt(k(T)))??"").localeCompare(c.get(gt(k(w)))??"")};return E.sort((w,T)=>{const j=v.get(gt(k(w))),M=v.get(gt(k(T)));return j!==void 0||M!==void 0?j!==void 0&&M!==void 0?j-M:j!==void 0?-1:1:o==="name"?Us(w).localeCompare(Us(T))||w.localeCompare(T):C(w,T)||w.localeCompare(T)})}function ZL(e){const t=o=>gt(o).split("/").filter(Boolean),n=new Map;for(const o of e){const c=Us(o);n.set(c,(n.get(c)??0)+1)}const r=o=>{let c=null;for(const h of e)gt(h)===gt(o)||!La(o,h)||(c===null||gt(h).length>gt(c).length)&&(c=h);return c};return o=>{const c=r(o);if(c)return`${Us(c)}/${f_(c,o).join("/")}`;const h=Us(o);if((n.get(h)??0)<2)return h;const l=t(o),u=e.filter(g=>gt(g)!==gt(o)).map(t),m=p_(l,u,2);return m.length===l.length&&u.some(g=>g.join("/")===l.join("/"))?o:m.join("/")}}function m_({workflow:e,isFocused:t,onFocus:n,prefix:r="",prefixFull:o="",depth:c=0,draggable:h=!1,onDragStart:l,onDragEnd:u}){const m=Kr(e.name),g=q2(e,m),p=za(e),S=p==="ready",x=p==="ready"?"Deployed to Sapiom with a ready build.":p==="building"?"Cloud build in progress.":p==="failed"?"Cloud build failed.":p==="linked"?"Linked to Sapiom; no ready build confirmed.":"Draft. Not deployed to Sapiom yet.";return d.jsx("div",{className:"workflow-item"+(t?" is-focused":""),"data-testid":`workflow-${e.name}`,"data-agent-path":e.path,style:c>0?{"--tree-depth":c}:void 0,draggable:h||void 0,onDragStart:l,onDragEnd:u,...Ot({object:"agent"}),children:d.jsxs("button",{className:"tree-row workflow-item-trigger",onClick:()=>n(e.path),"aria-pressed":t,title:e.path,"data-tooltip":t?"Focused agent":"Focus this agent",children:[d.jsxs("span",{className:"tree-row-name",children:[r&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"tree-row-prefix","data-testid":`workflow-prefix-${e.path}`,children:r}),d.jsx("span",{className:"tree-row-sep"+(g?"":" tree-row-sep-loose"),"aria-hidden":"true",children:g?"/":"·"})]}),d.jsx("span",{className:"tree-row-label","data-testid":`workflow-name-${e.path}`,title:o?e.path:void 0,children:m})]}),d.jsx("span",{className:"workflow-status","data-deployed":S,"data-deployment-state":p,"data-testid":`workflow-status-${e.path}`,title:x,children:d.jsx(de,{name:S?"Cloud":"CloudOff",size:13})})]})})}function W2(e,t){return t?{onDragOver:n=>{n.dataTransfer.types.includes(hh)&&(n.preventDefault(),n.dataTransfer.dropEffect="move",t.dropDir!==e&&t.setDropDir(e))},onDragLeave:n=>{n.currentTarget.contains(n.relatedTarget)||t.dropDir===e&&t.setDropDir(null)},onDrop:n=>{if(!n.dataTransfer.types.includes(hh))return;n.preventDefault(),t.setDropDir(null);const r=n.dataTransfer.getData(hh);r&&t.onDropInto(r,e)}}:{}}function QL(e,t){return t?{draggable:!0,onDragStart:n=>{n.dataTransfer.effectAllowed="move",n.dataTransfer.setData(hh,e.workflow.path)},onDragEnd:()=>t.setDropDir(null)}:{}}const Nx=e=>`project:${e}`,bg=e=>`dir:${e}`;function bf({collapsed:e,onToggle:t,label:n,testid:r,children:o}){return d.jsxs("button",{type:"button",className:"row-disclosure","data-testid":r,onClick:t,"aria-expanded":!e,"aria-label":e?`Expand ${n}`:`Collapse ${n}`,"data-tooltip":e?"Expand":"Collapse",children:[d.jsx("span",{className:"row-disclosure-mark","aria-hidden":"true",children:o}),d.jsx("span",{className:"row-disclosure-chevron","aria-hidden":"true",children:d.jsx(de,{name:e?"ChevronRight":"ChevronDown",size:13})})]})}function Mx({root:e}){return d.jsx("span",{className:"project-mark","aria-hidden":"true",children:WL(e)})}function K2({dirs:e,agents:t,depth:n,focusedAgentPath:r,onFocusAgent:o,collapsedKeys:c,onToggleCollapsed:h,drag:l}){return d.jsxs(d.Fragment,{children:[t.map(u=>d.jsx(m_,{workflow:u.workflow,isFocused:u.workflow.path===r,onFocus:o,prefix:u.prefix,prefixFull:u.prefixFull,depth:n,...QL(u,l)},u.workflow.path)),e.map(u=>{const m=c.has(bg(u.path));return d.jsxs("div",{className:"workspace-group workspace-subgroup",children:[d.jsxs("div",{className:"workspace-row is-nested"+(m?" is-collapsed":"")+((l==null?void 0:l.dropDir)===u.path?" is-drop-target":""),"data-testid":`dir-row-${u.labelFull}`,style:{"--tree-depth":n},...W2(u.path,l),...Ot({object:"workspace"}),children:[d.jsx(bf,{collapsed:m,onToggle:()=>h(bg(u.path)),label:u.label,testid:`dir-disclosure-${u.labelFull}`,children:d.jsx(de,{name:m?"Folder":"FolderOpen",size:13})}),d.jsx("button",{type:"button",className:"workspace-row-main",onClick:()=>h(bg(u.path)),title:u.path,"aria-expanded":!m,children:d.jsx("span",{className:"tree-row-label",children:u.label})})]}),!m&&d.jsx(K2,{dirs:u.dirs,agents:u.agents,depth:n+1,focusedAgentPath:r,onFocusAgent:o,collapsedKeys:c,onToggleCollapsed:h,drag:l})]},u.path)})]})}function e8({label:e,root:t,rootAgent:n,collapsed:r,onToggleCollapsed:o,workspaceKey:c,selected:h,onSelectProject:l,focusedAgentPath:u,onFocusAgent:m,trailing:g,focusable:p=!1,disclosable:S=!0,mainTestid:x,tooltip:A,busy:E=!1,drag:y}){const b=(n==null?void 0:n.workflow.path)??null,v=b!=null&&b===u||p&&t===u,_=b??(p?t:null);return d.jsxs("div",{className:"workspace-row"+(n?" workflow-item":"")+(h?" is-selected":"")+(!h&&v?n?" is-focused":" is-selected":"")+(S&&r?" is-collapsed":"")+((y==null?void 0:y.dropDir)===t?" is-drop-target":""),"data-testid":n?`workflow-${n.workflow.name}`:`project-row-${e}`,...W2(t,y),...Ot({object:"workspace"}),children:[S?d.jsx(bf,{collapsed:r,onToggle:o,label:e,testid:`project-disclosure-${e}`,children:d.jsx(Mx,{root:t})}):d.jsx("span",{className:"row-disclosure row-disclosure-static","aria-hidden":"true",children:d.jsx("span",{className:"row-disclosure-mark",children:d.jsx(Mx,{root:t})})}),d.jsx("button",{type:"button",className:"workspace-row-main"+(n?" workflow-item-trigger":""),"data-testid":x??`project-select-${e}`,onClick:_?()=>m(_):c?()=>l(c,t,e):void 0,title:t,"aria-pressed":_?E?void 0:v:c?h:void 0,"aria-busy":E?!0:void 0,"aria-label":_?`Focus ${e}`:c?`Open dependency graph for ${e}`:void 0,"data-tooltip":A??(_?"Focus this agent":c?"Open dependency graph":void 0),children:d.jsx("span",{className:"tree-row-label",children:e})}),g]})}function t8(e,t){return!t.some(n=>hi(n,e))}function Y2(e,t,n){const r=t.filter(o=>hi(o,e));return r.length===0?!1:!n.some(o=>hi(o,e)&&r.some(c=>hi(c,o)&&!jn(c,o)))}function X2({root:e,recentDirs:t,sessions:n}){const r=[e];return{root:e,nextRecentDirs:t.filter(o=>!jn(o,e)),endSessionIds:n.filter(o=>o.status!=="exited"&&Y2(o.cwd,r,t)).map(o=>o.id)}}function s8(e){return e===0?"No running sessions to end.":e===1?"Ends 1 running session.":`Ends ${e} running sessions.`}async function n8(e,t){const n=await Promise.allSettled(e.endSessionIds.map(o=>t.endSession(o))),r=e.endSessionIds.filter((o,c)=>{var h;return((h=n[c])==null?void 0:h.status)==="rejected"});return await t.saveRecentDirs(e.nextRecentDirs),{endedCount:e.endSessionIds.length-r.length,failedSessionIds:r}}function i8(e,t){return e.filter(n=>!t.some(r=>jn(n,r)))}function r8(e,t){return e.filter(n=>hi(n,t))}function a8({label:e,root:t,runningCount:n,onCancel:r,onConfirm:o,triggerRef:c}){const h=O.useRef(null);return Ua(!0,{onDismiss:r,containerRef:h,triggerRef:c}),d.jsx("div",{className:"modal-backdrop",onClick:r,children:d.jsxs("div",{ref:h,className:"modal modal-confirm",role:"alertdialog","aria-label":`Remove ${e}`,"data-testid":"remove-project-confirm",...Ot({object:"workspace"}),onClick:l=>l.stopPropagation(),children:[d.jsxs("div",{className:"modal-header",children:["Remove ",e,"?",d.jsx("button",{className:"theme-toggle modal-close","aria-label":"Close",title:"Close",onClick:r,children:d.jsx(de,{name:"X",size:14})})]}),d.jsxs("div",{className:"modal-body",children:[d.jsx("p",{className:"modal-copy","data-testid":"remove-project-confirm-count",children:s8(n)}),d.jsxs("p",{className:"modal-copy",children:[e," and the agents inside it leave the rail. ",d.jsx("strong",{children:"Nothing on disk is touched"})," — no file is created, moved or deleted, and"," ",d.jsx("code",{children:t})," stays exactly where it is. Open the folder again to bring the project back."]})]}),d.jsxs("div",{className:"modal-actions",children:[d.jsx("button",{className:"btn-ghost",autoFocus:!0,onClick:r,children:"Keep project"}),d.jsx("button",{className:"btn-danger","data-testid":"remove-project-confirm-btn",onClick:o,children:"Remove project"})]})]})})}const $x="unrooted:expanded",o8=5,l8=e=>e.replace(/\\/g,"/").split("/").filter(t=>t!==""&&!/^[A-Za-z]:$/.test(t)).length;function c8(e,t){const n=c=>({root:c,label:Us(c),agentCount:t.filter(h=>hi(c,h)).length}),r=[];let o=e;for(;o!=null&&r.length<o8&&l8(o)>=2;)r.push(n(o)),o=Gr(o);return r.length>0?r:[n(e)]}const u8=e=>`${e} agent${e===1?"":"s"}`;function d8({agent:e,agentPaths:t,onOpenAsProject:n}){const[r,o]=O.useState(!1),c=O.useRef(null),h=c8(e.workflow.path,t);return d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",ref:c,className:"workspace-row-action","data-testid":`unrooted-open-${e.workflow.path}`,"aria-label":`Open a project for ${e.workflow.name}`,"aria-haspopup":"menu","aria-expanded":r,"data-tooltip":"Open as project",onClick:()=>o(l=>!l),children:d.jsx(de,{name:"FolderPlus",size:13})}),d.jsx(Ci,{open:r,anchorRef:c,onDismiss:()=>o(!1),placement:"down-end",className:"menu-flyer",testid:`unrooted-open-menu-${e.workflow.path}`,children:d.jsxs("div",{className:"connect-card",children:[d.jsx("div",{className:"connect-card-header",children:d.jsx("span",{children:"Open which folder?"})}),d.jsx("div",{className:"connect-card-body",role:"menu",children:h.map(l=>d.jsxs("button",{type:"button",role:"menuitem",className:"rail-add-row unrooted-open-choice","data-testid":`unrooted-open-choice-${l.root}`,title:l.root,onClick:()=>{o(!1),n(l.root)},children:[d.jsx(de,{name:"Folder",size:13}),d.jsx("span",{className:"unrooted-open-choice-label",children:l.label}),d.jsx("span",{className:"rail-add-row-cost",children:u8(l.agentCount)})]},l.root))})]})})]})}function h8({agent:e,isFocused:t,onFocus:n,agentPaths:r,onOpenAsProject:o}){const{workflow:c,prefix:h}=e,l=Kr(c.name),u=q2(c,l),m=za(c),g=m==="ready";return d.jsxs("div",{className:"workflow-item unrooted-item"+(t?" is-focused":""),"data-testid":`unrooted-agent-${c.path}`,"data-agent-name":c.name,...Ot({object:"agent"}),children:[d.jsxs("button",{className:"tree-row workflow-item-trigger",onClick:()=>n(c.path),"aria-pressed":t,title:c.path,"data-tooltip":c.path,children:[d.jsxs("span",{className:"tree-row-name",children:[h&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"tree-row-prefix","data-testid":`unrooted-prefix-${c.path}`,children:h}),d.jsx("span",{className:"tree-row-sep"+(u?"":" tree-row-sep-loose"),"aria-hidden":"true",children:u?"/":"·"})]}),d.jsx("span",{className:"tree-row-label","data-testid":`unrooted-name-${c.path}`,children:l})]}),d.jsx("span",{className:"workflow-status","data-deployed":g,"data-deployment-state":m,"data-testid":`unrooted-status-${c.path}`,children:d.jsx(de,{name:g?"Cloud":"CloudOff",size:13})})]}),d.jsx(d8,{agent:e,agentPaths:r,onOpenAsProject:o})]})}function f8({agents:e,collapsed:t,onToggleCollapsed:n,focusedAgentPath:r,onFocusAgent:o,agentPaths:c,onOpenAsProject:h}){return d.jsxs("div",{className:"workspace-group","data-testid":"unrooted-section",children:[d.jsxs("div",{className:"workspace-row"+(t?" is-collapsed":""),children:[d.jsx(bf,{collapsed:t,onToggle:n,label:"agents outside your projects",testid:"unrooted-disclosure",children:d.jsx("span",{className:"project-mark project-mark-none","aria-hidden":"true",children:d.jsx(de,{name:"Folder",size:13})})}),d.jsxs("button",{type:"button",className:"workspace-row-main",onClick:n,"aria-expanded":!t,"data-testid":"unrooted-header","data-tooltip":"Agents that live outside every project you have open. Open the folder above one as a project to file it.",children:[d.jsx("span",{className:"tree-row-label",children:"Outside your projects"}),d.jsx("span",{className:"unrooted-count","data-testid":"unrooted-count",children:e.length})]})]}),!t&&e.map(l=>d.jsx(h8,{agent:l,isFocused:l.workflow.path===r,onFocus:o,agentPaths:c,onOpenAsProject:h},l.workflow.path))]})}const Eh="application/x-sapiom-agent",J2="application/x-sapiom-group";function p8({label:e,collapsed:t,onToggleCollapsed:n,isUngrouped:r=!1,isDropTarget:o=!1,onRename:c,onDelete:h,startRenaming:l=!1,title:u,dropHandlers:m}){const g=c!=null&&!r,p=h!=null&&!r,[S,x]=O.useState(l&&g?e:null),A=S!==null&&g,E=()=>{const C=(S??"").trim();x(null),C!==""&&C!==e&&(c==null||c(C))},y=O.useRef(null),b=O.useRef(!1),v=O.useRef(!1),_=()=>{b.current=!1,v.current=!1,x(e)},k=()=>{var C;if(!b.current&&!v.current){v.current=!0,(C=y.current)==null||C.focus();return}E()};return d.jsxs("div",{className:"workspace-row is-nested"+(t?" is-collapsed":"")+(o?" is-drop-target":""),style:{"--tree-depth":0},"data-testid":`group-row-${e}`,...Ot({object:"workspace"}),...m,children:[d.jsx(bf,{collapsed:t,onToggle:n,label:e,testid:`group-disclosure-${e}`,children:d.jsx(de,{name:r?"Folder":"Workflow",size:13})}),A?d.jsx("input",{ref:y,className:"group-name-input","data-testid":"group-rename-input","aria-label":`Rename ${e}`,value:S??"",autoFocus:!0,onFocus:C=>C.currentTarget.select(),onChange:C=>{b.current=!0,x(C.target.value)},onKeyDown:C=>{C.key==="Enter"&&E(),C.key==="Escape"&&x(null)},onBlur:k}):d.jsx("button",{type:"button",className:"workspace-row-main",onClick:n,onDoubleClick:g?_:void 0,"aria-expanded":!t,title:u,"data-tooltip":u,children:d.jsx("span",{className:"tree-row-label",children:e})}),g&&!A&&d.jsx("button",{type:"button",className:"workspace-row-action","data-testid":`group-rename-${e}`,"aria-label":`Rename ${e}`,"data-tooltip":"Rename group",onClick:_,children:d.jsx(de,{name:"Pencil",size:13})}),p&&!A&&d.jsx("button",{type:"button",className:"workspace-row-action","data-testid":`group-delete-${e}`,"aria-label":`Delete ${e}`,"data-tooltip":"Delete group. Nothing is removed from disk.",onClick:h,children:d.jsx(de,{name:"Trash2",size:13})})]})}function m8({workflow:e,prefix:t="",prefixFull:n="",groupId:r,isFocused:o,onFocus:c,draggable:h=!0}){return d.jsx("div",{className:"group-agent-drag",draggable:h,"data-testid":`group-agent-${e.name}`,onDragStart:l=>{h&&(l.dataTransfer.effectAllowed="copyMove",l.dataTransfer.setData(Eh,e.path),l.dataTransfer.setData(J2,r))},children:d.jsx(m_,{workflow:e,prefix:t,prefixFull:n,isFocused:o,onFocus:c,depth:1})})}function g8({sectionLabel:e,groups:t,prefixes:n,editable:r,isDerived:o,freshLabel:c,collapsedKeys:h,onToggleCollapsed:l,focusedAgentPath:u,onFocusAgent:m,onCreate:g,onRename:p,onDelete:S,onDrop:x,onReset:A,resetCount:E}){const[y,b]=O.useState(null),[v,_]=O.useState(!1),k=C=>({onDragOver:w=>{w.dataTransfer.types.includes(Eh)&&(w.preventDefault(),w.dataTransfer.dropEffect=w.altKey?"copy":"move",y!==C&&b(C))},onDragLeave:w=>{w.currentTarget.contains(w.relatedTarget)||b(T=>T===C?null:T)},onDrop:w=>{w.dataTransfer.types.includes(Eh)&&(w.preventDefault(),b(null),x({path:w.dataTransfer.getData(Eh),fromGroupId:w.dataTransfer.getData(J2),toGroupId:C,copy:w.altKey}))}});return d.jsxs(d.Fragment,{children:[t.map(C=>{const w=h.has(C.id),T=r&&C.label===c;return d.jsxs("div",{className:"workspace-group workspace-subgroup","data-testid":`group-section-${C.label}`,...k(C.id),children:[d.jsx(p8,{label:C.label,collapsed:w,onToggleCollapsed:()=>l(C.id),isUngrouped:C.isUngrouped,isDropTarget:y===C.id,startRenaming:T,title:C.isUngrouped?"No launch edge reaches these agents":o?`${C.label} and everything it launches`:void 0,onRename:r&&!C.isUngrouped?j=>p(C.id,j):void 0,onDelete:r&&!C.isUngrouped?()=>S(C.id):void 0}),!w&&C.agents.map(j=>{var M,D;return d.jsx(m8,{workflow:j.workflow,prefix:((M=n==null?void 0:n.get(j.workflow.path))==null?void 0:M.prefix)??"",prefixFull:((D=n==null?void 0:n.get(j.workflow.path))==null?void 0:D.prefixFull)??"",groupId:C.id,isFocused:j.workflow.path===u,onFocus:m,draggable:r},j.workflow.path)}),!w&&C.agents.length===0&&d.jsx("div",{className:"workspace-group-empty",style:{paddingLeft:"calc(2 * var(--tree-indent))"},children:"Drag agents here"})]},C.id+(T?":fresh":""))}),r&&d.jsxs("button",{type:"button",className:"rail-add-row","data-testid":`group-create-${e}`,"aria-label":`New group in ${e}`,onClick:()=>{_(!1),g()},children:[d.jsx(de,{name:"Plus",size:13}),d.jsx("span",{className:"tree-row-label",children:"New group"})]}),r&&A&&d.jsxs("button",{type:"button",className:"rail-add-row rail-reset-row"+(v?" is-armed":""),"data-testid":`group-reset-${e}`,"aria-label":v?`Confirm resetting ${e} to detected groups`:`Reset ${e} to detected groups`,onClick:()=>{if(!v){_(!0);return}_(!1),A()},onBlur:()=>_(!1),children:[d.jsx(de,{name:"RefreshCw",size:13}),d.jsx("span",{className:"tree-row-label",children:v?"Confirm reset":"Reset to detected"}),d.jsx("span",{className:"rail-add-row-cost",children:E>0?`Discards ${E} group${E===1?"":"s"}`:"Restores the launch-edge grouping"})]})]})}const qr={version:1,groups:null,renames:{}},Rc="group:ungrouped",Jr=e=>e.groups!==null,ef=e=>({workflow:e,prefix:"",prefixFull:""}),xv=e=>(t,n)=>e==="name"?t.workflow.name.localeCompare(n.workflow.name):t.workflow.path.localeCompare(n.workflow.path);function Z2(e,t,n="recent"){const r=new Map;for(const p of e)p.definitionSlug&&!r.has(p.definitionSlug)&&r.set(p.definitionSlug,p),r.has(p.name)||r.set(p.name,p);const o=[];for(const p of t){const S=r.get(p.parent),x=r.get(p.child);!S||!x||S.path===x.path||o.push({parent:S,child:x})}const c=new Map;for(const p of e)c.set(p.path,p.path);const h=p=>{let S=p;for(;c.get(S)!==S;)S=c.get(S)??S;for(;c.get(p)!==S;){const x=c.get(p)??S;c.set(p,S),p=x}return S};for(const p of o){const S=h(p.parent.path),x=h(p.child.path);S!==x&&c.set(S,x)}const l=new Map;for(const p of e){const S=h(p.path),x=l.get(S);x?x.push(p):l.set(S,[p])}const u=p=>{const S=new Set(p.map(y=>y.path)),x=new Set(o.filter(y=>S.has(y.parent.path)&&S.has(y.child.path)).map(y=>y.child.path)),A=p.filter(y=>!x.has(y.path));return[...A.length>0?A:p].sort((y,b)=>y.name.localeCompare(b.name))[0]},m=[],g=[];for(const p of l.values()){if(p.length<2){g.push(...p);continue}const S=u(p);m.push({id:`group:${S.path}`,label:S.name,agents:p.map(ef).sort(xv(n)),isUngrouped:!1})}return m.sort((p,S)=>S.agents.length-p.agents.length||p.label.localeCompare(S.label)),g.length>0&&m.push({id:Rc,label:"Ungrouped",agents:g.map(ef).sort(xv(n)),isUngrouped:!0}),m}const g_=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Q2=e=>[...new Set(e)];function v8(e){if(!g_(e))return null;const{id:t,label:n,members:r}=e;return typeof t!="string"||t===""?null:{id:t,label:typeof n=="string"&&n!==""?n:t,members:Q2(Array.isArray(r)?r.filter(o=>typeof o=="string"):[])}}const _8=e=>{if(!g_(e))return{};const t={};for(const[n,r]of Object.entries(e))typeof r=="string"&&(t[n]=r);return t};function y8(e){if(!e)return qr;let t;try{t=JSON.parse(e)}catch{return qr}return!g_(t)||t.version!==1?qr:{version:1,groups:Array.isArray(t.groups)?t.groups.map(v8).filter(n=>n!==null):null,renames:_8(t.renames)}}function b8(e){return`${JSON.stringify({version:1,groups:e.groups,renames:e.renames},null,2)}
|
|
506
|
+
`}const S8=e=>Jr(e)?{kind:"write",raw:b8(e)}:{kind:"remove"};function w8(e,t){if(!Jr(e))return e;const n=new Set(t.map(c=>c.path));let r=!1;const o=e.groups.map(c=>{const h=c.members.filter(l=>n.has(l));return h.length===c.members.length?c:(r=!0,{...c,members:h})});return r?{...e,groups:o}:e}const x8=(e,t)=>w8(y8(e),t);function C8(e,t){const n=new Set(t.flatMap(r=>r.members));return e.filter(r=>!n.has(r.path))}function E8(e,t,n,r="recent"){if(!Jr(t))return Z2(e,n,r);const o=new Map(e.map(u=>[u.path,u])),c=xv(r),h=t.groups.map(u=>({id:u.id,label:u.label,agents:u.members.map(m=>o.get(m)).filter(m=>m!==void 0).map(ef).sort(c),isUngrouped:!1})),l=C8(e,t.groups);return l.length>0&&h.push({id:Rc,label:"Ungrouped",agents:l.map(ef).sort(c),isUngrouped:!0}),h}function k8(e,t,n,r="recent"){return Jr(e)?e:{...e,groups:Z2(t,n,r).filter(o=>!o.isUngrouped).map(o=>({id:o.id,label:o.label,members:o.agents.map(c=>c.workflow.path)}))}}const j8=e=>Jr(e)?{...e,groups:null}:e,R8=e=>Jr(e);function A8(e,t){const n=t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"group",r=new Set(e.map(c=>c.id));let o=`g_${n}`;for(let c=2;r.has(o);c++)o=`g_${n}-${c}`;return o}function T8(e,t,n=[]){const r=t.trim();return r===""?e:{...e,groups:[...e.groups,{id:A8(e.groups,r),label:r,members:Q2(n)}]}}function N8(e,t,n){const r=n.trim();return r===""?e:{...e,groups:e.groups.map(o=>o.id===t?{...o,label:r}:o)}}const M8=(e,t)=>({...e,groups:e.groups.filter(n=>n.id!==t)});function $8(e,t,n){return{...e,groups:e.groups.map(r=>r.id===t&&!r.members.includes(n)?{...r,members:[...r.members,n]}:r)}}function D8(e,t,n){return{...e,groups:e.groups.map(r=>r.id===t?{...r,members:r.members.filter(o=>o!==n)}:r)}}const O8=(e,t)=>({...e,groups:e.groups.map(n=>n.members.includes(t)?{...n,members:n.members.filter(r=>r!==t)}:n)});function L8(e,t){const{path:n,fromGroupId:r,toGroupId:o,copy:c}=t;if(n===""||r===o)return e;if(o===Rc)return r===Rc?e:O8(e,n);const h=$8(e,o,n);return c||r===Rc?h:D8(h,r,n)}const ih=zc(),Dx=`
|
|
507
|
+
`;function I8(e,t,n,r){const[o,c]=O.useState(null),[h,l]=O.useState({}),[u,m]=O.useState({}),g=O.useRef(t);g.current=t;const p=O.useRef(new Set);O.useEffect(()=>{if(!r)return;let C=!0;return ih.listLaunchEdges().then(w=>{C&&c(w)}).catch(()=>{C&&c([])}),()=>{C=!1}},[r]);const S=e.join(Dx);O.useEffect(()=>{if(r)for(const C of S.split(Dx).filter(Boolean))p.current.has(C)||(p.current.add(C),ih.getRailState(C).then(w=>{l(T=>({...T,[C]:x8(w,g.current)})),m(T=>({...T,[C]:!0}))}).catch(()=>{l(w=>({...w,[C]:qr}))}))},[r,S]);const x=O.useCallback(C=>h[C]??qr,[h]),A=O.useCallback(C=>o!==null&&u[C]===!0,[o,u]),E=O.useRef(new Map),y=O.useCallback((C,w)=>{l(D=>({...D,[C]:w}));const T=S8(w),M=(E.current.get(C)??Promise.resolve()).then(()=>T.kind==="write"?ih.saveRailState(C,T.raw):ih.clearRailState(C));E.current.set(C,M.catch(()=>{}))},[]),b=O.useCallback((C,w,T)=>{if(o===null||!u[C])return;const j=h[C]??qr;y(C,T(k8(j,w,o,n)))},[y,o,u,n,h]),v=O.useCallback(C=>{u[C]&&y(C,j8(h[C]??qr))},[y,u,h]),_=O.useCallback(C=>t.filter(w=>hi(C,w.path)),[t]),k=O.useCallback((C,w)=>E8(w,h[C]??qr,o??[],n),[o,n,h]);return O.useMemo(()=>({groupsFor:k,agentsIn:_,isReady:A,stateFor:x,edit:b,reset:v}),[k,_,A,x,b,v])}const P8=6e4,B8=zc();function z8(e){return e.plan!==null||e.readout.kind!=="none"}function H8(e){const[t,n]=O.useState(null);return O.useEffect(()=>{let r=!1;n(null);const o=()=>{B8.getAccountPlan().then(h=>{r||n(z8(h)?h:null)},()=>{r||n(null)})};o();const c=setInterval(o,P8);return()=>{r=!0,clearInterval(c)}},[e]),t}const U8=zc(),F8=typeof navigator<"u"&&navigator.platform.toUpperCase().includes("MAC"),q8=F8?"⌘K":"Ctrl+K",Ox=()=>ui().preferredHarness==="codex"?"codex":"claude-code",ek=["project","group"],V8={project:"Project",group:"Group"},Lx=e=>ek.includes(e)?e:"project",G8={recent:"Recent activity",name:"Name"};function Ix({testid:e,harness:t,title:n,meta:r,cwd:o,resumeMode:c,isSelected:h,onOpen:l}){const u=c==="agent-resume"?"true":c==="rehydrate"?"false":"unknown";return d.jsxs("button",{"data-testid":e,className:"session-dropdown-item"+(h?" is-selected":""),"data-resumable":u,title:o,onClick:l,...Ot({object:"session"}),children:[d.jsx("span",{className:"session-item-icon",children:d.jsx(h_,{kind:t,size:13})}),d.jsxs("span",{className:"session-item-copy",children:[d.jsx("span",{className:"session-item-title",children:n}),d.jsx("span",{className:"session-item-meta",children:r})]})]})}function W8({width:e,minWidth:t,workflows:n,sessions:r,pendingWorkspaces:o,activeSessionId:c,focusedAgentPath:h,workspaceScopes:l,selectedWorkspaceKey:u,onSelectWorkspace:m,onFocusAgent:g,onOpenPalette:p,onConnect:S,onCollapse:x,canGoBack:A,canGoForward:E,onGoBack:y,onGoForward:b,onSelectSession:v,overviewSelected:_,onSelectOverview:k,onNewSession:C,onReviewSummary:w,history:T,historyLoading:j,onOpenHistory:M,recentDirs:D,closedProjects:L,unsearchedCheckouts:q,onRemoveProject:F,onOpenProject:Y,launchDir:Q,listDir:G,onCreateSession:ee,listHarnesses:ne,onScaffoldSession:z,onScaffoldInSession:B,projectRoot:$,onSaveProjectRoot:H,onBrowseTemplates:U,templatesActive:P,onScanWorkflows:W,onToast:se,telemetryOptIn:X,productAnalyticsOptIn:V,rollingSummary:ue,consentSource:oe,consentEnvReason:Z,authenticated:te,organizationName:pe,onToggleTelemetry:ye,onToggleProductAnalytics:ke,onToggleRollingSummary:Le,editor:Ie,onSelectEditor:qe,onStartAuth:Re,onDisconnect:He,settingsOpen:Ke,onSetSettingsOpen:kt}){const ot=H8(te),[Ct,wt]=O.useState(null);O.useEffect(()=>{const le=pr();if(le!=null&&le.onUpdateState)return le.onUpdateState($e=>{wt($e.kind==="downloaded"?{version:$e.version}:null)})},[]);const[Mt,jt]=O.useState(null),Lt=Mt!==null,ss=O.useRef(null),as=O.useRef(null),os=O.useRef(null),[vt,Ds]=O.useState(!1),[ls,Kt]=O.useState(!1),[pt,fi]=O.useState(()=>Lx(ui().railAxis)),[cs,ji]=O.useState(()=>ui().railSort==="name"?"name":"recent"),ln=le=>{fi(le),xi({railAxis:le}),Kt(!1)},rt=le=>{ji(le),xi({railSort:le}),Kt(!1)},Rs=O.useRef(null),us=O.useCallback(()=>{Ds(!1),Kt(!1)},[]),[As,cn]=O.useState(()=>new Set(ui().collapsedKeys??[])),_n=O.useCallback(le=>{cn($e=>{const ce=new Set($e);return ce.has(le)?ce.delete(le):ce.add(le),ce})},[]);O.useEffect(()=>{xi({collapsedKeys:Array.from(As)})},[As]);const yn=r.filter(le=>le.status==="exited"),bn=()=>{const le=!vt;if(Kt(!1),Ds(le),le){const $e=u2(r,D,c);$e.length>0&&M($e)}},ds=new Set(r.map(le=>le.id)),pi=new Set(r.map(le=>le.agentSessionId).filter(le=>le!=null)),Os=T.filter(le=>!(le.harnessSessionId!=null&&ds.has(le.harnessSessionId))&&!pi.has(le.agentSessionId)),un=[...yn.map(le=>({kind:"exited",at:le.lastActiveAt,session:le})),...Os.map(le=>({kind:"summary",at:le.lastActiveAt,summary:le}))].sort((le,$e)=>$e.at.localeCompare(le.at)),mi=new Map(T.map(le=>[le.agentSessionId,le])),Qe=o.map(le=>le.cwd),Xs=[...D,...Qe],nt=le=>!Y2(le,L,Xs),Sn=n.filter(le=>nt(le.path)),Ls=G2({recentDirs:D,sessions:r,pendingCwds:Qe,agentPaths:Sn.map(le=>le.path),sort:cs}).filter(nt),Et=YL(Sn,Ls,cs),Yt=XL(Sn,Ls,cs),dn=n.map(le=>le.path),[Ts,hn]=O.useState(null),An=O.useRef(null),[Js,Fs]=O.useState(null),xs=pt==="project"?{dropDir:Js,setDropDir:Fs,onDropInto:(le,$e)=>{Fs(null);const ce=DR(le,$e,n.map(Me=>Me.path));if(!ce.ok){ce.reason&&se(ce.reason);return}U8.moveAgent(ce.from,ce.to).catch(Me=>{se((Me instanceof gn?Me.reason:null)??(Me instanceof Error?Me.message:`Couldn't move ${ce.name}.`))})}}:void 0,Pt=I8(Ls,n,cs,pt==="group"),[re,he]=O.useState(null),xe=le=>{const $e=new Set(le.map(Me=>Me.label));if(!$e.has("New group"))return"New group";let ce=2;for(;$e.has(`New group ${ce}`);)ce++;return`New group ${ce}`},be=(le,$e)=>{const ce=Pt.agentsIn(le);ce.some(Me=>Me.path===$e.path)&&(he(null),Pt.edit(le,ce,Me=>L8(Me,$e)))},Ce=le=>r.filter($e=>$e.status!=="exited"&&$e.boundWorkflowPath==null&&jn($e.cwd,le)).sort(($e,ce)=>ce.createdAt.localeCompare($e.createdAt)||$e.id.localeCompare(ce.id))[0],Xe=Et.some(le=>!Ax(le)),at=!Xe&&Yt.length===0&&Et.length===0,Je=!Xe&&Yt.length===0;return d.jsxs("aside",{ref:os,className:"rail rail-workflows",style:{width:e,minWidth:t},...Ot({surface:"agent_rail"}),children:[d.jsx(IL,{onCollapse:x,canGoBack:A,canGoForward:E,onGoBack:y,onGoForward:b}),d.jsxs("nav",{className:"rail-nav","aria-label":"Primary",children:[d.jsxs("button",{type:"button",className:"rail-nav-cta"+(at?" is-empty":""),"data-testid":"rail-create-new","aria-label":"Create a new agent","data-tooltip":"Describe an agent and this scaffolds it",onClick:()=>{Ds(!1),C()},children:[d.jsx(de,{name:"Plus",size:14}),d.jsx("span",{children:"Create new agent"})]}),d.jsxs("button",{type:"button",className:"rail-nav-row","data-testid":"palette-trigger","aria-label":"Search sessions, agents, and paths",onClick:p,children:[d.jsx(de,{name:"Search",size:14}),d.jsx("span",{children:"Search"}),d.jsx("span",{className:"rail-nav-kbd",children:q8})]}),d.jsxs("button",{type:"button",className:"rail-nav-row"+(P?" is-selected":""),"data-testid":"rail-templates","aria-current":P?"page":void 0,onClick:U,children:[d.jsx(de,{name:"LayoutTemplate",size:14}),d.jsx("span",{children:"Templates"})]}),d.jsxs("button",{type:"button",ref:ss,className:"rail-nav-row","data-testid":"add-existing-agents","aria-haspopup":"dialog","aria-expanded":Lt,onClick:()=>{Ds(!1),jt("detect")},children:[d.jsx(de,{name:"FolderPlus",size:14}),d.jsx("span",{children:"Add existing agents"})]})]}),d.jsxs("div",{className:"rail-header",children:[d.jsx("span",{className:"rail-header-label",children:"Projects"}),d.jsxs("div",{className:"rail-header-actions",children:[d.jsx("button",{type:"button",className:"theme-toggle rail-header-btn",ref:as,"data-testid":"rail-add-project","aria-label":"Add a project","data-tooltip":"Add a project",onClick:()=>{Ds(!1),jt("open")},children:d.jsx(de,{name:"FolderPlus",size:14})}),d.jsx("button",{ref:Rs,className:"theme-toggle rail-header-btn","data-testid":"history-trigger","aria-label":"Rail settings","aria-haspopup":"menu","aria-expanded":vt,"data-tooltip":"Filing, sorting and past sessions",onClick:bn,children:d.jsx(de,{name:"EllipsisVertical",size:14})})]})]}),d.jsxs("div",{className:"rail-tree",children:[d.jsx(Ci,{open:vt,anchorRef:Rs,onDismiss:us,placement:"right-start",besideRef:os,noClip:!0,className:"menu-flyer",testid:"history-menu",children:d.jsxs("div",{className:"menu-flyer-track",children:[d.jsxs("div",{className:"connect-card history-card",children:[d.jsxs("div",{className:"connect-card-header",children:[d.jsx("span",{children:"Projects"}),d.jsx("button",{className:"theme-toggle connect-card-close",onClick:us,"aria-label":"Close",title:"Close",children:d.jsx(de,{name:"X",size:13})})]}),d.jsxs("div",{className:"connect-card-body",role:"menu",children:[d.jsxs("div",{className:"menu-choice-group",onMouseEnter:()=>Kt(!1),children:[d.jsxs("label",{className:"filing-field",children:[d.jsx("span",{className:"filing-field-label",children:"Group by"}),d.jsx("select",{className:"filing-field-select","data-testid":"filing-group-by",value:pt,onChange:le=>ln(Lx(le.target.value)),children:ek.map(le=>d.jsx("option",{value:le,children:V8[le]},le))})]}),d.jsxs("label",{className:"filing-field",children:[d.jsx("span",{className:"filing-field-label",children:"Sort by"}),d.jsx("select",{className:"filing-field-select","data-testid":"filing-sort-by",value:cs,onChange:le=>rt(le.target.value==="name"?"name":"recent"),children:["recent","name"].map(le=>d.jsx("option",{value:le,children:G8[le]},le))})]})]}),d.jsxs("button",{type:"button",className:"session-dropdown-item nested-trigger"+(ls?" is-open":""),"data-testid":"past-sessions-trigger","aria-haspopup":"menu","aria-expanded":ls,onMouseEnter:()=>Kt(!0),onClick:()=>Kt(le=>!le),children:[d.jsx("span",{className:"session-item-icon",children:d.jsx(de,{name:"History",size:13})}),d.jsx("span",{className:"session-item-copy",children:d.jsx("span",{className:"session-item-title",children:"Past sessions"})}),yn.length>0&&d.jsx("span",{className:"session-history-badge","data-testid":"session-history-badge",children:yn.length}),d.jsx(de,{name:"ChevronRight",size:13})]})]})]}),ls&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"menu-flyer-bridge","aria-hidden":"true"}),d.jsxs("div",{className:"connect-card menu-flyer-nested",children:[d.jsxs("div",{className:"connect-card-header",children:[d.jsx("span",{children:"Past sessions"}),d.jsx("button",{className:"theme-toggle connect-card-close",onClick:()=>Kt(!1),"aria-label":"Back",title:"Back",children:d.jsx(de,{name:"X",size:13})})]}),d.jsxs("div",{className:"connect-card-body past-sessions-list","data-testid":"past-sessions-card",children:[un.map(le=>{if(le.kind==="exited"){const $e=le.session.agentSessionId==null?void 0:mi.get(le.session.agentSessionId),ce=le.session.agentSessionId==null?"rehydrate":$e==null?void 0:$e.resumeMode;return d.jsx(Ix,{testid:`exited-session-${le.session.id}`,harness:le.session.harness,title:le.session.title,meta:gv({...le.session,gitBranch:$e==null?void 0:$e.gitBranch,turnCount:$e==null?void 0:$e.turnCount,messageCount:$e==null?void 0:$e.messageCount},void 0,{includeHarness:!1,state:MS({resumeMode:ce,turnCount:$e==null?void 0:$e.turnCount})}),cwd:le.session.cwd,resumeMode:ce,isSelected:le.session.id===c,onOpen:()=>{v(le.session.id),us()}},le.session.id)}return d.jsx(Ix,{testid:`history-${le.summary.agentSessionId}`,harness:le.summary.harness,title:le.summary.title,meta:gv(le.summary,void 0,{includeHarness:!1,state:MS(le.summary)}),cwd:le.summary.cwd,resumeMode:le.summary.resumeMode,isSelected:!1,onOpen:()=>{w(le.summary),us()}},le.summary.agentSessionId)}),j&&d.jsx("div",{className:"session-dropdown-empty",children:"Loading…"}),!j&&un.length===0&&d.jsx("div",{className:"session-dropdown-empty",children:"No past sessions yet"})]})]})]})]})}),d.jsxs("div",{className:"rail-list",children:[Je&&Et.length===0&&d.jsx(En,{className:"rail-empty",icon:"Folder",title:"No agents yet",body:"Add a project folder to start a session in it. Agents (sapiom.json) anywhere inside it appear here automatically."}),Et.map(le=>{var Rt,Gs;const $e=As.has(Nx(le.root)),ce=(l??[]).find(ct=>jn(ct.cwd,le.root)),Me=Qe.some(ct=>jn(ct,le.root)),Pe=Ax(le),Ue=Pe?Ce(le.root):void 0,Ze=Me&&Pe&&Ue==null,_t=pt==="group"?Pt.agentsIn(le.root):[],Fe=pt==="group"&&_t.length>1,Cs=_t.filter(ct=>{var _s;return ct.path!==((_s=le.rootAgent)==null?void 0:_s.workflow.path)}),et=Fe?Pt.groupsFor(le.root,_t):[],st=Pt.stateFor(le.root);return d.jsxs("div",{className:"workspace-group","data-testid":`workspace-group-${le.label}`,children:[d.jsx(e8,{label:le.label,root:le.root,rootAgent:Fe?null:le.rootAgent,collapsed:$e,onToggleCollapsed:()=>_n(Nx(le.root)),workspaceKey:(ce==null?void 0:ce.workspaceKey)??null,selected:(ce==null?void 0:ce.workspaceKey)===u,onSelectProject:m,focusedAgentPath:h,onFocusAgent:g,focusable:Ze||Ue!=null,disclosable:pt==="group"?Fe||Cs.length>0:le.dirs.length>0||le.agents.length>0,busy:Ze,drag:xs,mainTestid:ce?void 0:Ze?`workspace-pending-${le.label}`:Ue?`workspace-focus-${le.label}`:void 0,tooltip:Ze?"Creating agent…":Ue?"Project with sessions, no agent yet. Focus to work in it.":void 0,trailing:d.jsxs(d.Fragment,{children:[Ze?d.jsx("span",{className:"workspace-row-spinner","aria-hidden":"true"}):Ue?d.jsx("button",{type:"button",className:"workspace-row-action","data-testid":`workspace-scaffold-${le.label}`,"aria-label":`Scaffold an agent in ${le.label}`,"data-tooltip":"Scaffold an agent here",onClick:()=>B(Ue.id),children:d.jsx(de,{name:"Sparkles",size:13})}):null,le.rootAgent&&!Fe&&(ce==null?void 0:ce.workspaceKey)!=null&&d.jsx("button",{type:"button",className:"workspace-row-action","data-testid":`project-map-${le.label}`,"aria-label":`Open dependency graph for ${le.label}`,"aria-pressed":ce.workspaceKey===u,"data-tooltip":"Open dependency graph",onClick:()=>m(ce.workspaceKey,le.root,le.label),children:d.jsx(de,{name:"Waypoints",size:13})}),!Ze&&Ue==null&&d.jsx("button",{type:"button",className:"workspace-row-action","data-testid":`project-create-agent-${le.label}`,"aria-label":`Create an agent in ${le.label}`,"data-tooltip":"Create an agent here",onClick:()=>{z(le.root,Ox()).catch(ct=>{se(ct instanceof Error?ct.message:`Couldn't start an agent in ${le.label}.`)})},children:d.jsx(de,{name:"Plus",size:13})}),d.jsx("button",{type:"button",className:"workspace-row-action","data-testid":`project-remove-${le.label}`,"aria-label":`Remove ${le.label} from the rail`,"data-tooltip":"Remove project",onClick:ct=>{An.current=ct.currentTarget,hn({root:le.root,label:le.label})},children:d.jsx(de,{name:"X",size:13})})]})}),!$e&&Pe&&!Ze&&Ue==null&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"workspace-row is-nested workspace-row-empty",children:[d.jsx("span",{className:"row-disclosure row-disclosure-static","aria-hidden":"true"}),d.jsxs("button",{type:"button",className:"tree-row tree-row-empty-action","data-testid":`project-empty-${le.label}`,"data-tooltip":`Start an agent in ${le.root}`,onClick:()=>{z(le.root,Ox()).catch(ct=>{se(ct instanceof Error?ct.message:`Couldn't start an agent in ${le.label}.`)})},children:[d.jsx(de,{name:"Sparkles",size:13}),d.jsx("span",{className:"tree-row-label",children:(((Rt=q[le.root])==null?void 0:Rt.length)??0)>0?"Create an agent here":"Create the first agent here"})]})]}),(((Gs=q[le.root])==null?void 0:Gs.length)??0)>0&&d.jsxs("div",{className:"workspace-row is-nested",children:[d.jsx("span",{className:"row-disclosure row-disclosure-static","aria-hidden":"true"}),d.jsxs("div",{className:"tree-row tree-row-note","data-testid":`project-unsearched-${le.label}`,title:`Open one as its own project to see its agents:
|
|
508
|
+
${q[le.root].join(`
|
|
509
|
+
`)}`,children:[d.jsx(de,{name:"GitBranch",size:13}),d.jsx("span",{className:"tree-row-label",children:q[le.root].length===1?"1 checkout not searched":`${q[le.root].length} checkouts not searched`})]})]})]}),!$e&&pt==="project"&&d.jsx(K2,{dirs:le.dirs,agents:le.agents,depth:0,focusedAgentPath:h,onFocusAgent:g,collapsedKeys:As,onToggleCollapsed:_n,drag:xs}),!$e&&Fe&&d.jsx(g8,{sectionLabel:le.label,groups:et,prefixes:Tx(_t,le.root),editable:Pt.isReady(le.root),isDerived:!Jr(st),freshLabel:(re==null?void 0:re.root)===le.root?re.label:null,collapsedKeys:As,onToggleCollapsed:_n,focusedAgentPath:h,onFocusAgent:g,onCreate:()=>{const ct=xe(et);Pt.edit(le.root,_t,_s=>T8(_s,ct)),he({root:le.root,label:ct})},onRename:(ct,_s)=>{he(null),Pt.edit(le.root,_t,Fa=>N8(Fa,ct,_s))},onDelete:ct=>{he(null),Pt.edit(le.root,_t,_s=>M8(_s,ct))},onDrop:ct=>be(le.root,ct),onReset:R8(st)?()=>{he(null),Pt.reset(le.root)}:void 0,resetCount:Jr(st)?st.groups.length:0}),!$e&&pt==="group"&&!Fe&&Cs.map(ct=>{const _s=Tx(Cs,le.root).get(ct.path);return d.jsx(m_,{workflow:ct,prefix:(_s==null?void 0:_s.prefix)??"",prefixFull:(_s==null?void 0:_s.prefixFull)??"",isFocused:ct.path===h,onFocus:g},ct.path)})]},le.root)}),Yt.length>0&&d.jsx(f8,{agents:Yt,collapsed:!As.has($x),onToggleCollapsed:()=>_n($x),focusedAgentPath:h,onFocusAgent:g,agentPaths:dn,onOpenAsProject:le=>{Y(le).catch($e=>{se($e instanceof Error?$e.message:"Couldn't open that folder.")})}})]})]}),d.jsxs("div",{className:"rail-footer",children:[Ct&&(()=>{const le=pr();return le?d.jsx(zL,{desktop:le,version:Ct.version,onToast:se}):null})(),d.jsx(BL,{plan:ot}),d.jsx(K8,{onToast:se,authenticated:te,organizationName:pe,telemetryOptIn:X,productAnalyticsOptIn:V,rollingSummary:ue,consentSource:oe,consentEnvReason:Z,onToggleTelemetry:ye,onToggleProductAnalytics:ke,onToggleRollingSummary:Le,editor:Ie,onSelectEditor:qe,onStartAuth:Re,onDisconnect:He,settingsOpen:Ke,onSetSettingsOpen:kt,overviewSelected:_,onSelectOverview:k})]}),Mt&&d.jsx(d_,{mode:Mt,recentDirs:D,launchDir:Q,projectRoot:$,listDir:G,onClose:()=>jt(null),onConnect:S,onOpenProject:Y,onScan:W,triggerRef:Mt==="open"?as:ss}),Ts&&d.jsx(a8,{label:Ts.label,root:Ts.root,runningCount:X2({root:Ts.root,recentDirs:D,sessions:r}).endSessionIds.length,onCancel:()=>hn(null),onConfirm:()=>{const le=Ts.root;hn(null),F(le)},triggerRef:An})]})}function K8({authenticated:e,organizationName:t,telemetryOptIn:n,productAnalyticsOptIn:r,rollingSummary:o,consentSource:c,consentEnvReason:h,onToggleTelemetry:l,onToggleProductAnalytics:u,onToggleRollingSummary:m,editor:g,onSelectEditor:p,onStartAuth:S,onDisconnect:x,settingsOpen:A,onSetSettingsOpen:E,overviewSelected:y,onSelectOverview:b,onToast:v}){const[_,k]=O.useState(!1),[C,w]=O.useState(rf());O.useEffect(()=>Mv(w),[]);const[T,j]=O.useState({status:"idle"}),M=O.useRef(null),D=O.useCallback(()=>k(!1),[]),L=O.useCallback(()=>E(!1),[E]),q=lC(),F=T.status==="pending",Y=pr(),[Q,G]=O.useState(!1),ee=async()=>{if(!(!Y||Q)){G(!0),D();try{const H=await Y.checkForUpdates(),U=P2(H);v(U.text,U.tone==="error"?"error":H.kind==="up-to-date"||H.kind==="downloaded"?"success":"info")}catch{v("Couldn't check for updates.")}finally{G(!1)}}};e&&T.status==="pending"&&j({status:"idle"});const ne=F?"Connecting…":e?t??"Signed in":"Not signed in",z=F?"opening browser":e?"Sapiom account":"connect to get started",B=(t??"S").charAt(0).toUpperCase(),$=async()=>{D(),j({status:"pending"});try{await S()}catch(H){const U=H instanceof Error?H.message:"Could not start sign-in. Try again.";j({status:"error",message:U})}};return d.jsxs("div",{className:"rail-footer-row rail-profile-wrap",children:[d.jsxs("button",{ref:M,className:"rail-profile","data-testid":"brand-identity","aria-haspopup":"menu","aria-expanded":_,title:"Account",onClick:()=>{const H=!_;k(H),H&&L()},children:[d.jsx("span",{className:"rail-profile-avatar","aria-hidden":"true",children:B}),d.jsxs("span",{className:"rail-profile-copy",children:[d.jsx("span",{className:"rail-profile-name",children:ne}),d.jsxs("span",{className:"rail-profile-meta",children:[d.jsx("span",{className:"identity-dot","data-authenticated":e,"data-pending":F}),z]})]}),d.jsx(de,{name:"ChevronDown",size:14})]}),d.jsx(Ci,{open:A,anchorRef:M,onDismiss:L,placement:"up-start",matchWidth:!0,className:"settings-popover",testid:"settings-popover",children:d.jsx(qL,{authenticated:e,organizationName:t,telemetryOptIn:n,productAnalyticsOptIn:r,rollingSummary:o,consentSource:c,consentEnvReason:h,onToggleTelemetry:l,onToggleProductAnalytics:u,onToggleRollingSummary:m,editor:g,onSelectEditor:p,onStartAuth:S,onDisconnect:x})}),d.jsxs(Ci,{open:_,anchorRef:M,onDismiss:D,placement:"up-start",matchWidth:!0,className:"profile-menu",role:"menu",testid:"profile-menu",children:[d.jsxs("button",{role:"menuitem",className:"profile-menu-item"+(y?" is-selected":""),"data-testid":"rail-overview",onClick:()=>{b(),D()},children:[d.jsx(de,{name:"Info",size:13}),"Overview"]}),d.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"profile-open-dashboard",onClick:()=>{window.open(dC,"_blank","noopener,noreferrer"),D()},children:[d.jsx(de,{name:"ExternalLink",size:13}),"Open Sapiom dashboard"]}),d.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"settings-trigger",onClick:()=>{E(!0),D()},children:[d.jsx(de,{name:"Settings",size:13}),"Settings"]}),d.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"theme-toggle",onClick:()=>{sC(),D()},children:[d.jsx(de,{name:C==="dark"?"Sun":"Moon",size:13}),C==="dark"?"Switch to light mode":"Switch to dark mode"]}),Y&&d.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"profile-check-updates",disabled:Q,onClick:()=>void ee(),children:[d.jsx(de,{name:Q?"Loader":"RefreshCw",size:13}),Q?"Checking…":"Check for updates",Y.appVersion&&d.jsxs("span",{className:"profile-menu-version","data-testid":"app-version",children:["v",Y.appVersion]})]}),!e&&d.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"profile-connect-account",disabled:F,onClick:()=>void $(),children:[d.jsx(de,{name:"Plug",size:13}),F?"Connecting…":"Connect account"]}),e&&d.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"profile-disconnect-account",onClick:()=>{x(),D()},children:[d.jsx(de,{name:"LogOut",size:13}),"Disconnect"]}),q,T.status==="error"&&d.jsx("p",{className:"profile-menu-auth-error","data-testid":"profile-auth-error",children:T.message})]})]})}function Y8(){const e=new Map,t=new Map,n=new Map,r=new Map,o=new Set,c=new Set,h=new Set,l=m=>{const g=n.get(m);if(g)return g;const p={generation:0,retired:!1};return n.set(m,p),p},u=(m,g)=>{const p=l(g),S=p.generation,x=e.get(g);if((x==null?void 0:x.lifetime)===p&&x.generation===S)return x.promise;const A=t.get(g),E=r.get(g)??-1,b=A!==void 0&&A.state!=="ready"&&c.has(g)&&!h.has(g);if(A&&A.revision>=E&&!o.has(g)&&!b){const k=Promise.resolve(A);return e.set(g,{lifetime:p,generation:S,promise:k}),k}b&&h.add(g);const v=o.has(g);let _;return _=Promise.resolve().then(()=>v?m.getSystemGraph(g,{refresh:!0}):m.getSystemGraph(g)).then(k=>{var w,T;if(k.workspaceKey!==g)throw new Error("Invalid system graph response");if(p.retired)return k;const C=r.get(g)??-1;return k.revision<C||p.generation!==S&&o.has(g)&&!v?(((w=e.get(g))==null?void 0:w.promise)===_&&e.delete(g),u(m,g)):(t.set(g,k),o.delete(g),k.state!=="ready"&&!c.has(g)?(c.add(g),((T=e.get(g))==null?void 0:T.promise)===_&&e.delete(g)):k.state==="ready"&&(c.delete(g),h.delete(g)),k)}),e.set(g,{lifetime:p,generation:S,promise:_}),_.catch(()=>{var k;((k=e.get(g))==null?void 0:k.promise)===_&&e.delete(g)}),_};return{load:u,invalidate(m,g){var S;const p=Math.max(((S=t.get(m))==null?void 0:S.revision)??-1,r.get(m)??-1);return g!==void 0&&g<=p?!1:(g!==void 0?r.set(m,g):o.add(m),l(m).generation+=1,e.delete(m),c.delete(m),h.delete(m),!0)},retain(m){const g=new Set([...e.keys(),...t.keys(),...n.keys(),...r.keys(),...o,...c,...h]);for(const p of g){if(m.has(p))continue;const S=n.get(p);S&&(S.retired=!0),n.delete(p),e.delete(p),t.delete(p),r.delete(p),o.delete(p),c.delete(p),h.delete(p)}},peek:m=>t.get(m)??null}}const qo=Y8();function Sg(e){const t=[];for(const n of e.split("/"))if(!(!n||n===".")){if(n===".."){if(t.length===0)return null;t.pop();continue}t.push(n)}return t}function Px(e){const t=e.replace(/\\/g,"/"),n=/^([A-Za-z]):\//.exec(t);if(n){const o=Sg(t.slice(n[0].length));return o?{caseInsensitive:!0,root:`drive:${n[1].toLowerCase()}`,segments:o}:null}if(t.startsWith("//")){const o=Sg(t.slice(2));return!o||o.length<2?null:{caseInsensitive:!0,root:`unc:${o[0].toLowerCase()}/${o[1].toLowerCase()}`,segments:o.slice(2)}}if(!t.startsWith("/"))return null;const r=Sg(t.slice(1));return r?{caseInsensitive:!1,root:"posix:/",segments:r}:null}function X8(e,t){const n=Px(e),r=Px(t);if(!n||!r||n.root!==r.root||n.caseInsensitive!==r.caseInsensitive||n.segments.length>r.segments.length)return null;const o=(l,u)=>n.caseInsensitive?l.toLowerCase()===u.toLowerCase():l===u;return n.segments.some((l,u)=>!o(l,r.segments[u]))?null:`local:${r.segments.slice(n.segments.length).join("/")||r.segments.at(-1)||"root"}`}function J8(e,t,n,r){var u;const o=r.find(m=>m.workspaceKey===t);if(!o)return new Map;const c=new Set(e.map(m=>m.agentKey)),h=new Map,l=(m,g)=>{if(!m||!c.has(m))return;const p=h.get(m)??new Set;p.add(g),h.set(m,p)};for(const m of n){const g=X8(o.cwd,m.path);g!==null&&(l(((u=m.definitionSlug)==null?void 0:u.trim())||null,m),l(g,m))}return new Map([...h.entries()].filter(([,m])=>m.size===1).map(([m,g])=>[m,[...g][0]]))}const tf=184,rh=64,Cv=48,Bx=12,Z8=64,ah=32,Q8=24,eI=8,ai=16,Ys=(e,t)=>e===t?0:e<t?-1:1,js=e=>Math.round(e*100)/100;function tI(e,t){const n=Math.max(128,(e+t+1)*96);let r=0;return{step(){if(r+=1,r>n)throw new Error("System graph layout exceeded its finite work budget")}}}function sI(e){const t=new Set;for(const n of e.nodes){if(!n.id||t.has(n.id))throw new Error("Invalid system graph layout input");t.add(n.id)}if(e.edges.some(n=>!t.has(n.from)||!t.has(n.to)))throw new Error("Invalid system graph layout input")}function nI(e,t){const n=new Map(e.map(c=>[c,new Set])),r=new Map(e.map(c=>[c,new Set]));for(const c of t)n.get(c.from).add(c.to),r.get(c.from).add(c.to),r.get(c.to).add(c.from);const o=c=>new Map([...c.entries()].map(([h,l])=>[h,[...l].sort(Ys)]));return{directed:o(n),undirected:o(r)}}function iI(e,t,n){const r=new Set,o=[];for(const c of e){if(n.step(),r.has(c))continue;const h=[],l=[c];for(r.add(c);l.length>0;){n.step();const u=l.shift();h.push(u);for(const m of t.get(u)??[])n.step(),!r.has(m)&&(r.add(m),l.push(m))}h.sort(Ys),o.push(h)}return o}function rI(e,t,n){const r=new Set(e),o=new Map,c=new Map,h=[],l=new Set,u=[];let m=0;const g=p=>{n.step(),o.set(p,m),c.set(p,m),m+=1,h.push(p),l.add(p);for(const x of t.get(p)??[])n.step(),r.has(x)&&(o.has(x)?l.has(x)&&c.set(p,Math.min(c.get(p),o.get(x))):(g(x),c.set(p,Math.min(c.get(p),c.get(x)))));if(c.get(p)!==o.get(p))return;const S=[];for(;h.length>0;){n.step();const x=h.pop();if(l.delete(x),S.push(x),x===p)break}S.sort(Ys),u.push(S)};for(const p of e)o.has(p)||g(p);return u.sort((p,S)=>Ys(p[0],S[0]))}function aI(e,t,n){const r=e.map(g=>`scc:${g[0]}`),o=new Map;e.forEach((g,p)=>{for(const S of g)o.set(S,r[p])});const c=new Map(r.map(g=>[g,new Set])),h=new Map(r.map(g=>[g,0]));for(const g of t){n.step();const p=o.get(g.from),S=o.get(g.to);!p||!S||p===S||c.get(p).has(S)||(c.get(p).add(S),h.set(S,h.get(S)+1))}const l=new Map(r.map(g=>[g,0])),u=r.filter(g=>h.get(g)===0).sort(Ys);let m=0;for(;u.length>0;){n.step();const g=u.shift();m+=1;for(const p of[...c.get(g)].sort(Ys))n.step(),l.set(p,Math.max(l.get(p),l.get(g)+1)),h.set(p,h.get(p)-1),h.get(p)===0&&(u.push(p),u.sort(Ys))}if(m!==e.length)throw new Error("System graph SCC condensation was not acyclic");return e.map((g,p)=>({id:r[p],nodeIds:[...g],rank:l.get(r[p])})).sort((g,p)=>g.rank-p.rank||Ys(g.id,p.id))}function oI(e){sI(e);const t=nC(e.edges),n=e.nodes.map(u=>u.id).sort(Ys),r=tI(n.length,t.length),{directed:o,undirected:c}=nI(n,t),l=iI(n,c,r).map(u=>{const m=new Set(u),g=t.filter(S=>m.has(S.from)&&m.has(S.to)),p=aI(rI(u,o,r),g,r);return{id:`component:${u[0]}`,nodeIds:[...u],stronglyConnected:p,connected:g.length>0}});return l.sort((u,m)=>Number(m.connected)-Number(u.connected)||Ys(u.id,m.id)),{components:l}}function lI(e){const t=[],n=new Map,r=new Map,o=new Map;let c=0;for(const h of e.components){const l=new Map;for(const S of h.stronglyConnected){const x=l.get(S.rank)??[];x.push(...S.nodeIds),x.sort(Ys),l.set(S.rank,x);for(const A of S.nodeIds)o.set(A,S.id),r.set(A,h.id)}const u=[...l.keys()].sort((S,x)=>S-x),m=S=>{const x=l.get(S).length;return x*rh+Math.max(0,x-1)*Bx},g=Math.max(rh,...u.map(m));for(const S of u){const x=l.get(S),A=c+(g-m(S))/2;x.forEach((E,y)=>{t.push({id:E,x:S*(tf+Cv),y:A+y*(rh+Bx),width:tf,height:rh,componentId:h.id})})}const p=t.filter(S=>S.componentId===h.id);n.set(h.id,{minX:Math.min(...p.map(S=>S.x)),minY:Math.min(...p.map(S=>S.y)),maxX:Math.max(...p.map(S=>S.x+S.width)),maxY:Math.max(...p.map(S=>S.y+S.height))}),c+=g+Z8}return t.sort((h,l)=>Ys(h.id,l.id)),{nodes:t,componentBoxes:n,componentByNode:r,strongByNode:o}}function zx(e,t,n){const r=new Map;for(const o of e){const c=n==="source"?o.edge.from:o.edge.to,h=n==="source"||o.route==="cycle"?"right":"left",l=`${c}:${h}`;r.set(l,[...r.get(l)??[],o])}for(const o of r.values()){o.sort((h,l)=>{const u=t.get(n==="source"?h.edge.to:h.edge.from),m=t.get(n==="source"?l.edge.to:l.edge.from);return u.y-m.y||u.x-m.x||Ys(h.edge.from,l.edge.from)||Ys(h.edge.to,l.edge.to)});const c=o.length<=1?0:Math.min(eI,Q8*2/(o.length-1));o.forEach((h,l)=>{const u=js((l-(o.length-1)/2)*c);n==="source"?h.sourceOffset=u:h.targetOffset=u})}}function cI(e){return e.length===2?"blocking + async":e[0]}function uI(e){return Math.max(40,e.length*6.5+8)}function oh(e,t,n=0){return!(e.x+e.width+n<=t.x||t.x+t.width+n<=e.x||e.y+e.height+n<=t.y||t.y+t.height+n<=e.y)}function dI(e,t,n,r,o){var k;const c=t.get(e.edge.from),h=t.get(e.edge.to),l=uI(e.label),u=e.points[0],m=e.points.at(-1),g=(u.x+m.x)/2,p=Math.min(c.y,h.y),S=Math.max(c.y+c.height,h.y+h.height),x=((k=e.points[1])==null?void 0:k.x)??g,A=e.route==="cycle"?h.x+h.width/2:h.x-l/2-8,E=[{x:A,y:h.y-ai/2-4},{x:A,y:h.y+h.height+ai/2+4},{x,y:p-ai/2-4},{x,y:S+ai/2+4},{x:g,y:p-ai/2-4},{x:g,y:S+ai/2+4}],y=n.map(C=>({x:C.x,y:C.y,width:C.width,height:C.height})),b=E.map(C=>({x:C.x-l/2,y:C.y-ai/2,width:l,height:ai})).find(C=>!y.some(w=>oh(C,w,2))&&!r.some(w=>oh(C,w,2)));if(b)return b;const v=(o.minX+o.maxX-l)/2,_=(n.length+r.length+1)*6;for(let C=0;C<_;C+=1)for(const w of[o.minY-ai-8-C*(ai+4),o.maxY+8+C*(ai+4)]){const T={x:v,y:w,width:l,height:ai};if(!y.some(j=>oh(T,j,2))&&!r.some(j=>oh(T,j,2)))return T}throw new Error("System graph labels exceeded their finite placement budget")}function hI(e,t,n,r,o){const c=new Map(t.map(g=>[g.id,g])),h=nC(e.edges).map(g=>{const p=r.get(g.from);return{edge:g,route:o.get(g.from)===o.get(g.to)?"cycle":"forward",componentId:p,sourceOffset:0,targetOffset:0,cycleLane:0,forwardLane:0}});zx(h,c,"source"),zx(h,c,"target");const l=new Map;for(const g of h.filter(p=>p.route==="cycle")){const p=o.get(g.edge.from);l.set(p,[...l.get(p)??[],g])}for(const g of l.values())g.sort((p,S)=>Ys(p.edge.from,S.edge.from)||Ys(p.edge.to,S.edge.to)).forEach((p,S)=>{p.cycleLane=S});const u=new Map;for(const g of h.filter(p=>{if(p.route!=="forward")return!1;const S=c.get(p.edge.from);return c.get(p.edge.to).x-S.x>tf+Cv}))u.set(g.componentId,[...u.get(g.componentId)??[],g]);for(const g of u.values())g.sort((p,S)=>Ys(p.edge.from,S.edge.from)||Ys(p.edge.to,S.edge.to)).forEach((p,S)=>{p.forwardLane=S});const m=[];return h.map(g=>{const p=c.get(g.edge.from),S=c.get(g.edge.to),x={x:p.x+p.width,y:p.y+p.height/2+g.sourceOffset};let A;if(g.route==="forward"){const v={x:S.x-1,y:S.y+S.height/2+g.targetOffset};if(S.x-p.x>tf+Cv){const k=g.forwardLane%5,C=p.x+p.width+8+k*4,w=S.x-8-k*4,T=n.get(g.componentId).minY-12-k*4;A=[x,{x:C,y:x.y},{x:C,y:T},{x:w,y:T},{x:w,y:v.y},v]}else{const k=js(x.x+(S.x-x.x)*.32);A=[x,{x:k,y:x.y},{x:k,y:v.y},v]}}else{const v=p.id===S.id&&g.targetOffset===g.sourceOffset?S.y+S.height/2-12:S.y+S.height/2+g.targetOffset,_={x:S.x+S.width+1,y:v},k=Math.max(p.x+p.width,S.x+S.width)+8+g.cycleLane%10*4;if(p.id===S.id){const C=S.y-12-Math.floor(g.cycleLane/10)*8;A=[x,{x:k,y:x.y},{x:k,y:C},{x:S.x+S.width+4,y:C},{x:S.x+S.width+4,y:_.y},_]}else A=[x,{x:k,y:x.y},{x:k,y:_.y},_]}A=A.map(v=>({x:js(v.x),y:js(v.y)}));const E=cI(g.edge.modes),y={...g,points:A,label:E},b=dI(y,c,t,m,n.get(g.componentId));return m.push(b),{...y,labelBounds:b,labelX:js(b.x+b.width/2),labelY:js(b.y+b.height-3)}})}function fI(e){if(e.length===0)return"";const t=[`M ${js(e[0].x)} ${js(e[0].y)}`];for(let n=1;n<e.length;n+=1){const r=e[n-1],o=e[n];o.y===r.y?t.push(`H ${js(o.x)}`):o.x===r.x?t.push(`V ${js(o.y)}`):t.push(`L ${js(o.x)} ${js(o.y)}`)}return t.join(" ")}function pI(e,t){const n=[],r=[];for(const S of e)n.push(S.x,S.x+S.width),r.push(S.y,S.y+S.height);for(const S of t){for(const x of S.points)n.push(x.x),r.push(x.y);n.push(S.labelBounds.x,S.labelBounds.x+S.labelBounds.width),r.push(S.labelBounds.y,S.labelBounds.y+S.labelBounds.height)}if(n.length===0||r.length===0)return{nodes:[],edges:[],bounds:{width:0,height:0}};const o=Math.min(...n),c=Math.min(...r),h=Math.max(...n),l=Math.max(...r),u=ah-o,m=ah-c,g=e.map(S=>({...S,x:js(S.x+u),y:js(S.y+m)})),p=t.map(S=>{const x=S.points.map(E=>({x:js(E.x+u),y:js(E.y+m)})),A={...S.labelBounds,x:js(S.labelBounds.x+u),y:js(S.labelBounds.y+m)};return{from:S.edge.from,to:S.edge.to,modes:[...S.edge.modes],path:fI(x),points:x,label:S.label,labelX:js(S.labelX+u),labelY:js(S.labelY+m),labelBounds:A,route:S.route}});return{nodes:g,edges:p,bounds:{width:js(h-o+ah*2),height:js(l-c+ah*2)}}}function mI(e){const t=oI(e);if(e.nodes.length===0)return{nodes:[],edges:[],bounds:{width:0,height:0}};const n=lI(t),r=hI(e,n.nodes,n.componentBoxes,n.componentByNode,n.strongByNode);return pI(n.nodes,r)}function gI(e){return new Map(e.nodes.map(t=>[t.id,t]))}const sf=.25,tk=.1,nf=3,Hx=.25,vI=.0015,lh=48,_I=3.5,Ux=.2,Fx=16,yI=e=>Math.round(e*100)/100;function Ev(e,t=sf){return Math.min(nf,Math.max(Math.max(tk,t),yI(e)))}function bI(e,t,n){if(e.width<=0||e.height<=0||t.width<=0||t.height<=0)return{zoom:1,x:0,y:0,minZoom:sf};const r=_I*n,o=Math.min(r,t.width*Ux),c=Math.min(r,t.height*Ux),h=Math.min((t.width-o*2)/e.width,(t.height-c*2)/e.height,nf),l=Math.max(tk,Math.min(nf,Math.floor(h*100)/100));return{zoom:l,x:0,y:0,minZoom:Math.min(sf,l)}}function qx(){return{zoom:1,x:0,y:0}}function SI(e,t,n,r=[{x:0,y:0,width:t.width,height:t.height}]){return!Number.isFinite(e.zoom)||!Number.isFinite(e.x)||!Number.isFinite(e.y)||e.zoom<=0||t.width<=0||t.height<=0||n.width<=0||n.height<=0?!1:r.some(o=>{const c=n.width/2+e.x+(o.x-t.width/2)*e.zoom,h=n.height/2+e.y+(o.y-t.height/2)*e.zoom;return c<n.width&&c+o.width*e.zoom>0&&h<n.height&&h+o.height*e.zoom>0})}function wI(e,t){switch(t){case"ArrowLeft":return{...e,x:e.x-lh};case"ArrowRight":return{...e,x:e.x+lh};case"ArrowUp":return{...e,y:e.y-lh};case"ArrowDown":return{...e,y:e.y+lh}}}function Vx(e,t,n,r){return t-e>r-n?(n+r-e-t)/2:e<n?n-e:t>r?r-t:0}function xI(e,t,n,r){if(t.width<=0||t.height<=0||n.width<=0||n.height<=0||e.zoom<=0)return{...e};const o=Math.min(Fx,n.width/2),c=Math.min(Fx,n.height/2),h=n.width/2+e.x+(r.x-t.width/2)*e.zoom,l=n.height/2+e.y+(r.y-t.height/2)*e.zoom,u=h+r.width*e.zoom,m=l+r.height*e.zoom;return{...e,x:e.x+Vx(h,u,o,n.width-o),y:e.y+Vx(l,m,c,n.height-c)}}function CI(e,t,n){if(e.zoom<=0||t===e.zoom)return{...e,zoom:t};const r=t/e.zoom;return{zoom:t,x:n.x-r*(n.x-e.x),y:n.y-r*(n.y-e.y)}}function EI(e,t,n,r){const o=Ev(e.zoom*Math.exp(-t*vI),r);return CI(e,o,n)}function kI(){const e=new Map;return{get(t){const n=e.get(t);return n?{...n}:void 0},set(t,n){e.set(t,{...n})}}}const ch=kI(),jI=3;function RI(e){return e.length===2?"is-combined":e[0]==="async"?"is-async":"is-blocking"}function AI({graph:e,workspaceKey:t,navigableAgentKeys:n,onOpenAgent:r}){const o=O.useMemo(()=>{try{return{layout:mI(e),failed:!1}}catch{return{layout:null,failed:!0}}},[e]),c=o.layout,h=O.useMemo(()=>gI(e),[e]),[l,u]=O.useState(()=>ch.get(t)??qx()),[m,g]=O.useState(sf),[p,S]=O.useState(!1),x=O.useRef(null),A=O.useRef(null),E=O.useRef(l);E.current=l;const y=`system-graph-arrow-${O.useId().replace(/:/g,"")}`,b=O.useCallback(M=>{u(D=>{const L=typeof M=="function"?M(D):M;return ch.set(t,L),L})},[t]),v=O.useCallback(()=>{const M=x.current;if(!M||!c)return null;const D=M.getBoundingClientRect();if(D.width<=0||D.height<=0)return null;const L=Number.parseFloat(getComputedStyle(document.documentElement).fontSize),q={width:D.width,height:D.height};return{fit:bI(c.bounds,q,Number.isFinite(L)?L:16),viewport:q}},[c]),_=O.useCallback(()=>{const M=v();if(!M)return;const{fit:D}=M;g(D.minZoom),b({zoom:D.zoom,x:D.x,y:D.y})},[b,v]);O.useLayoutEffect(()=>{const M=x.current;if(!M||!c)return;const D=()=>{const Y=v();Y&&g(Y.fit.minZoom)},L=ch.get(t),q=v();if(q){const{fit:Y,viewport:Q}=q;if(g(Y.minZoom),L&&SI(L,c.bounds,Q,c.nodes))u(L);else{const ee={zoom:{...Y,zoom:Math.min(1,Y.zoom)}.zoom,x:0,y:0};ch.set(t,ee),u(ee)}}if(typeof ResizeObserver>"u")return;const F=new ResizeObserver(D);return F.observe(M),()=>F.disconnect()},[c,v,t]),O.useEffect(()=>{const M=x.current;if(!M)return;const D=L=>{const q=L.target;if(q instanceof Element&&q.closest(".system-graph-controls"))return;L.preventDefault();const F=M.getBoundingClientRect(),Y={x:L.clientX-(F.left+F.width/2),y:L.clientY-(F.top+F.height/2)};b(Q=>EI(Q,L.deltaY,Y,m))};return M.addEventListener("wheel",D,{passive:!1}),()=>M.removeEventListener("wheel",D)},[b,m]);const k=M=>{const D=A.current;!D||D.pointerId!==M.pointerId||(M.currentTarget.hasPointerCapture(M.pointerId)&&M.currentTarget.releasePointerCapture(M.pointerId),A.current=null,S(!1))},C=M=>{if(M.button!==0)return;const D=M.target;D instanceof Element&&D.closest("button, a")||(A.current={pointerId:M.pointerId,startClientX:M.clientX,startClientY:M.clientY,startView:E.current,moved:!1},M.currentTarget.setPointerCapture(M.pointerId))},w=M=>{const D=A.current;if(!D||D.pointerId!==M.pointerId)return;const L=M.clientX-D.startClientX,q=M.clientY-D.startClientY;!D.moved&&Math.hypot(L,q)<jI||(D.moved=!0,S(!0),b({...D.startView,x:D.startView.x+L,y:D.startView.y+q}))},T=M=>{M.target===M.currentTarget&&(M.key!=="ArrowLeft"&&M.key!=="ArrowRight"&&M.key!=="ArrowUp"&&M.key!=="ArrowDown"||(M.preventDefault(),b(D=>wI(D,M.key))))};if(o.failed||!c)return d.jsx(En,{className:"system-graph-state",testId:"system-graph-layout-error",icon:"TriangleAlert",title:"Couldn't lay out this workspace graph",body:"The local graph was malformed, so Studio stopped before rendering unsafe geometry."});const j=M=>{const D=x.current;if(!D)return;const L=D.getBoundingClientRect();L.width<=0||L.height<=0||b(q=>xI(q,c.bounds,{width:L.width,height:L.height},M))};return d.jsxs("div",{className:"system-graph-canvas","data-testid":"system-graph-canvas",children:[d.jsxs("div",{ref:x,className:"system-graph-viewport"+(p?" is-panning":""),"data-testid":"system-graph-viewport",role:"region","aria-label":"Workspace dependency graph. Use arrow keys to pan.",tabIndex:0,onKeyDown:T,onPointerDown:C,onPointerMove:w,onPointerUp:k,onPointerCancel:k,onDoubleClick:M=>{const D=M.target;(!(D instanceof Element)||!D.closest(".system-graph-node, button, a"))&&_()},children:[d.jsxs("div",{className:"system-graph-subject","data-testid":"system-graph-subject","data-semantic-zoom":l.zoom<.55?"far":"near",style:{width:c.bounds.width,height:c.bounds.height,transform:`translate(-50%, -50%) translate(${l.x}px, ${l.y}px) scale(${l.zoom})`},role:"group","aria-label":"Workspace dependency graph",children:[d.jsxs("svg",{className:"system-graph-edges",width:c.bounds.width,height:c.bounds.height,viewBox:`0 0 ${c.bounds.width} ${c.bounds.height}`,"aria-hidden":"true",children:[d.jsx("defs",{children:d.jsx("marker",{id:y,markerWidth:"8",markerHeight:"8",refX:"7",refY:"4",orient:"auto",markerUnits:"strokeWidth",children:d.jsx("path",{d:"M 0 0 L 8 4 L 0 8 z",className:"system-graph-arrow"})})}),c.edges.map(M=>d.jsxs("g",{"data-testid":`system-graph-edge-${M.from}-${M.to}`,children:[d.jsx("path",{className:`system-graph-edge ${RI(M.modes)}`,d:M.path,markerEnd:`url(#${y})`}),d.jsx("text",{className:"system-graph-edge-label",x:M.labelX,y:M.labelY,textAnchor:"middle",children:M.label})]},JSON.stringify([M.from,M.to])))]}),c.nodes.map(M=>{const D=h.get(M.id),L=n.has(D.agentKey),q={left:M.x,top:M.y,width:M.width,height:M.height},F=d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"system-graph-node-label",children:D.label}),d.jsx("span",{className:"system-graph-node-meta",children:"agent"})]});return L?d.jsx("button",{type:"button",className:"system-graph-node is-navigable","data-testid":`system-graph-node-${D.agentKey}`,"data-agent-key":D.agentKey,style:q,title:D.label,"aria-label":`Open ${D.label}`,onFocus:()=>j(M),onClick:()=>r(D.agentKey),...Ot({object:"agent"}),children:F},M.id):d.jsx("div",{className:"system-graph-node","data-testid":`system-graph-node-${D.agentKey}`,"data-agent-key":D.agentKey,style:q,title:D.label,...Ot({object:"agent"}),children:F},M.id)})]}),d.jsxs("div",{className:"system-graph-controls","data-testid":"system-graph-controls",role:"group","aria-label":"Workspace graph view controls",children:[d.jsx("button",{type:"button",className:"theme-toggle","data-testid":"system-graph-zoom-out","aria-label":"Zoom out",disabled:l.zoom<=m,onClick:()=>b(M=>({...M,zoom:Ev(M.zoom-Hx,m)})),children:d.jsx(de,{name:"ZoomOut",size:14})}),d.jsxs("button",{type:"button",className:"theme-toggle system-graph-zoom-reset","data-testid":"system-graph-zoom-reset","aria-label":"Reset workspace graph view to 100%",disabled:l.zoom===1&&l.x===0&&l.y===0,onClick:()=>b(qx()),children:[Math.round(l.zoom*100),"%"]}),d.jsx("button",{type:"button",className:"theme-toggle","data-testid":"system-graph-zoom-in","aria-label":"Zoom in",disabled:l.zoom>=nf,onClick:()=>b(M=>({...M,zoom:Ev(M.zoom+Hx,m)})),children:d.jsx(de,{name:"ZoomIn",size:14})}),d.jsx("button",{type:"button",className:"theme-toggle","data-testid":"system-graph-fit","aria-label":"Fit workspace graph to view",onClick:_,children:d.jsx(de,{name:"Frame",size:14})})]})]}),e.warnings.length>0&&d.jsxs("p",{className:"system-graph-warning","data-testid":"system-graph-warning",children:[e.warnings.length," static projection"," ",e.warnings.length===1?"warning":"warnings"]})]})}function TI({workspaceKey:e,workspaceName:t,api:n,workflows:r,workspaceScopes:o,lastMessage:c,onOpenAgent:h,onExpandRail:l}){const[u,m]=O.useState(()=>qo.peek(e)),[g,p]=O.useState(null),[S,x]=O.useState(!1),[A,E]=O.useState(!1),[y,b]=O.useState(0);O.useEffect(()=>{let j=!0;return E(!1),x(!0),qo.load(n,e).then(M=>{j&&(m(D=>D&&D.revision>M.revision?D:M),p(D=>D&&D.revision>M.revision?D:null),x(!1))},()=>{j&&(p(null),E(!0),x(!1))}),()=>{j=!1}},[n,e,y]),O.useEffect(()=>{if((c==null?void 0:c.type)!=="system-graph.changed"||c.workspaceKey!==e)return;const j=Math.max((u==null?void 0:u.revision)??-1,(g==null?void 0:g.revision)??-1);c.revision<=j||(qo.invalidate(e,c.revision),p({revision:c.revision,state:c.state}),E(!1),b(M=>M+1))},[g==null?void 0:g.revision,c,u==null?void 0:u.revision,e]);const v=(u==null?void 0:u.graph)??null,_=g!==null&&g.revision>((u==null?void 0:u.revision)??-1);let k=(u==null?void 0:u.state)??"building";_&&(k=g.state==="degraded"?"degraded":v?"stale":"building"),A&&(k=u!=null&&u.graph?"stale":"degraded");const C=!A&&v!==null&&(S||_&&(g==null?void 0:g.state)!=="degraded"),w=()=>{qo.invalidate(e),p(null),E(!1),b(j=>j+1)},T=O.useMemo(()=>v?J8(v.nodes,e,r,o):new Map,[v,e,r,o]);return d.jsxs("section",{className:"workspace-graph-view","data-testid":"workspace-graph-view","aria-label":"Workspace dependencies",children:[d.jsxs("header",{className:"workspace-graph-bar",children:[l&&d.jsx("button",{type:"button",className:"theme-toggle","data-testid":"workspace-graph-rail-expand","aria-label":"Expand workspace panel",onClick:l,children:d.jsx(de,{name:"PanelLeftOpen",size:15})}),d.jsx(de,{name:"Folder",size:15}),d.jsx("span",{className:"workspace-graph-title",title:t,...Ot({object:"workspace"}),children:t}),C&&v&&d.jsxs("span",{className:"status-tag workspace-graph-lifecycle","data-testid":"system-graph-refreshing","data-state":"refreshing",role:"status",children:[d.jsx("span",{className:"canvas-task-spinner","aria-hidden":"true"}),"Refreshing graph"]}),k==="stale"&&v&&!C&&d.jsxs("span",{className:"workspace-graph-lifecycle","data-testid":"system-graph-stale","data-state":"stale",role:"status",children:[d.jsxs("span",{className:"status-tag",children:[d.jsx(de,{name:"TriangleAlert",size:13}),"Graph may be out of date"]}),d.jsxs("button",{type:"button",className:"status-tag status-tag-action",onClick:w,children:[d.jsx(de,{name:"RefreshCw",size:13}),"Retry"]})]}),k==="degraded"&&v&&d.jsxs("span",{className:"workspace-graph-lifecycle","data-testid":"system-graph-degraded","data-state":"degraded",role:"status",children:[d.jsxs("span",{className:"status-tag",children:[d.jsx(de,{name:"TriangleAlert",size:13}),"Graph may be incomplete"]}),d.jsxs("button",{type:"button",className:"status-tag status-tag-action",onClick:w,children:[d.jsx(de,{name:"RefreshCw",size:13}),"Retry"]})]})]}),d.jsx("div",{className:"workspace-graph-body",children:!v&&k==="degraded"?d.jsx(En,{className:"system-graph-state",testId:"system-graph-error",icon:"TriangleAlert",title:A?"Couldn't load this workspace graph":"Couldn't build this workspace graph",body:A?"Studio couldn't load the latest local graph. Check that Studio is still running, then retry.":"Studio couldn't produce a usable local projection. Retry after the workspace is readable.",cta:d.jsx("button",{type:"button",className:"btn-primary",onClick:w,children:"Retry"})}):v?v.nodes.length===0&&k==="degraded"?d.jsx(En,{className:"system-graph-state",testId:"system-graph-incomplete",icon:"TriangleAlert",title:"Workspace graph is incomplete",body:"Studio couldn't inspect enough of this workspace to show a reliable graph.",cta:d.jsx("button",{type:"button",className:"btn-primary",onClick:w,children:"Retry"})}):v.nodes.length===0?d.jsx(En,{className:"system-graph-state",testId:"system-graph-empty",icon:"Frame",title:"No agents in this workspace",body:"Agent projects discovered inside this folder will appear here."}):d.jsx(AI,{graph:v,workspaceKey:e,navigableAgentKeys:new Set(T.keys()),onOpenAgent:j=>{const M=T.get(j);M&&h(M.path)}}):d.jsxs("div",{className:"canvas-loading system-graph-state","data-testid":"system-graph-loading",children:[d.jsx("span",{className:"canvas-task-spinner","aria-hidden":"true"}),d.jsx("p",{className:"canvas-empty-hint",children:"Loading workspace graph…"})]})})]})}const NI=new Set([401,403]);function MI(e){return e?e.networkError===!0||e.status===void 0:!1}function $I(e){return(e==null?void 0:e.status)!==void 0&&NI.has(e.status)}function DI(e){const{online:t,error:n}=e;return!t||MI(n)?"offline":$I(n)?"auth":n?"error":"online"}function Gx(){return typeof navigator>"u"?!0:navigator.onLine!==!1}function OI(){const[e,t]=O.useState(Gx);return O.useEffect(()=>{const n=()=>t(Gx());return window.addEventListener("online",n),window.addEventListener("offline",n),n(),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",n)}},[]),e}function LI(e=typeof window>"u"?"":window.location.search){const t=new URLSearchParams(e),n=t.get("agent");if(n){const o=t.get("agentSlug");return{kind:"agent",definitionId:n,...o?{slug:o}:{}}}const r=t.get("template");if(r){const o=t.get("templateSlug");return{kind:"template",templateId:r,...o?{slug:o}:{}}}return null}function II({agentLabel:e,onCancel:t,onConfirm:n}){const r=O.useRef(null);return Ua(!0,{onDismiss:t,containerRef:r}),d.jsx("div",{className:"modal-backdrop",onClick:t,children:d.jsxs("div",{ref:r,className:"modal modal-confirm",role:"alertdialog","aria-label":"Clone agent","data-testid":"clone-agent-confirm",onClick:o=>o.stopPropagation(),children:[d.jsxs("div",{className:"modal-header",children:["Clone this agent?",d.jsx("button",{className:"theme-toggle modal-close","aria-label":"Close",title:"Close",onClick:t,children:d.jsx(de,{name:"X",size:14})})]}),d.jsx("div",{className:"modal-body",children:d.jsxs("p",{className:"modal-copy",children:[e," 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."]})}),d.jsxs("div",{className:"modal-actions",children:[d.jsx("button",{className:"btn-ghost",autoFocus:!0,onClick:t,children:"Cancel"}),d.jsx("button",{className:"btn-primary","data-testid":"clone-agent-confirm-btn",onClick:n,children:"Clone locally"})]})]})})}const Wx=120,sk=new Set(["attr__class","attr__id"]),PI=/attr__([\w-]+)="(?:\\.|[^"\\])*"/g,BI=/(?:current_url|referrer|pathname)$/,zI=/host$/;function HI(e){const t=typeof e.surface=="string"?e.surface.toLowerCase():"",n=typeof e.object=="string"?e.object.toLowerCase():"";return/secret|vault|credential/.test(t)||/secret|vault|credential/.test(n)}const UI=new Set(["agent","workspace","session","run","directory","file"]);function FI(e){const t=typeof e.object=="string"?e.object.toLowerCase():"";return UI.has(t)}const qI=/\btext="(?:\\.|[^"\\])*"/g,nk=new Set(["localhost","127.0.0.1","[::1]","::1"]),ik="localhost";function wg(e){if(typeof e!="string"||e.length===0)return e;let t;try{t=new URL(e)}catch{return e}return`${nk.has(t.hostname)?`${t.protocol}//${ik}`:t.origin}${t.pathname}`}function Kx(e){if(typeof e!="string"||e.length===0)return e;const t=e.replace(/:\d+$/,"");return nk.has(t)?ik:e}function v_(e){return e.length>Wx?`${e.slice(0,Wx)}…`:e}function VI(e){return HI(e)?"secret":FI(e)?"drop_name":"truncate"}function GI(e,t){for(const n of Object.keys(e))n.startsWith("attr__")&&!sk.has(n)&&delete e[n];if(t==="truncate"){typeof e.$el_text=="string"&&(e.$el_text=v_(e.$el_text));return}delete e.$el_text}function WI(e,t){const n=e.$elements;if(Array.isArray(n))for(const o of n)o&&typeof o=="object"&&GI(o,t);if(typeof e.$elements_chain!="string")return;if(t==="secret"){delete e.$elements_chain;return}let r=e.$elements_chain.replace(PI,(o,c)=>sk.has(`attr__${c}`)?o:"");t==="drop_name"&&(r=r.replace(qI,'text=""')),e.$elements_chain=r}function KI(e,t){t.$current_url=wg(t.$current_url),t.$referrer=wg(t.$referrer),t.$host=Kx(t.$host);for(const n of[e.$set,e.$set_once]){if(!n)continue;const r=n;for(const o of Object.keys(r))BI.test(o)?r[o]=wg(r[o]):zI.test(o)&&(r[o]=Kx(r[o]))}}const YI=/attr__aria-label="((?:\\.|[^"\\])*)"/i;function XI(e){var o;const t=e.$el_text;if(typeof t=="string"&&t.trim()!=="")return;let n;const r=e.$elements;if(Array.isArray(r))for(const c of r){const h=c==null?void 0:c["attr__aria-label"];if(typeof h=="string"&&h.trim()!==""){n=h;break}}n===void 0&&typeof e.$elements_chain=="string"&&(n=(o=YI.exec(e.$elements_chain))==null?void 0:o[1]),n!==void 0&&n.trim()!==""&&(e.$el_text=v_(n),e.el_text_source="aria_label")}function JI(e,t){typeof e.$el_text=="string"&&(t==="truncate"?e.$el_text=v_(e.$el_text):delete e.$el_text),t==="truncate"&&XI(e),WI(e,t)}function ZI(e){if(!e)return e;try{const t=e.properties??{},n=VI(t);return KI(e,t),JI(t,n),e.properties=t,e}catch{return e}}function QI(){if(typeof window>"u")return null;const e=window.__HARNESS__,t=e==null?void 0:e.posthog;return t!=null&&t.key?t:null}function e7(e){return e.consentSource==="env-forced-off"}function rk(e){return!e7(e)&&e.productAnalyticsOptIn}let Xo=!1;function t7(e){if(Xo){xg(e),Eg(e);return}const t=QI();if(t&&rk(e)){if(Kn.__loaded){Xo=!0,kv(e),xg(e),Eg(e);return}Kn.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:ZI,persistence:"localStorage",disable_session_recording:!0}),Xo=!0,kv(e),xg(e),Eg(e)}}function xg(e){if(Xo)try{rk(e)?Kn.has_opted_out_capturing()&&Kn.opt_in_capturing():Kn.has_opted_out_capturing()||Kn.opt_out_capturing()}catch{}}function kv(e){t_({app_version:e.version,harness_host:pr()?"desktop":"cli",studio_boot_id:ZM()})}let Cg=null;function Eg(e){if(Xo)try{if(e.authenticated&&e.userId){Cg=e.userId,Kn.identify(e.userId),e.tenantId&&Kn.group("organization",e.tenantId,{...e.organizationName?{name:e.organizationName}:{}}),t_({active_organization_id:e.tenantId??void 0,app_version:e.version});return}Cg&&(Cg=null,Kn.reset(),kv(e))}catch{}}function s7(e){if(Xo)try{e?t_({harness_kind:e}):Kn.unregister("harness_kind")}catch{}}function n7(e){return[`Add human-readable descriptions to the "${e.name}" agent so its Sapiom canvas explains what each part does.`,"",`Edit the agent definition file(s) under ${e.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(`
|
|
510
|
+
`)}const i7={entries:[],index:-1};function r7(e,t){return e.kind!==t.kind?!1:e.kind==="session"&&t.kind==="session"?e.sessionId===t.sessionId:e.kind==="agent"&&t.kind==="agent"?e.agentPath===t.agentPath:e.kind==="project"&&t.kind==="project"?e.workspaceKey===t.workspaceKey:e.kind==="review"&&t.kind==="review"?e.summary.agentSessionId===t.summary.agentSessionId:e.kind===t.kind}function ak(e){return e.index>0}function ok(e){return e.index>=0&&e.index<e.entries.length-1}function a7(e,t){const n=e.index>=0?e.entries[e.index]:null;if(n&&r7(n,t)){if(JSON.stringify(n)===JSON.stringify(t))return e;const c=[...e.entries];return c[e.index]=t,{...e,entries:c}}const o=[...e.entries.slice(0,e.index+1),t].slice(-50);return{entries:o,index:o.length-1}}function o7(e,t){if(!(t==="back"?ak(e):ok(e)))return{state:e,visit:null};const r=t==="back"?e.index-1:e.index+1;return{state:{...e,index:r},visit:e.entries[r]??null}}function l7(){const[e,t]=O.useState(i7),n=O.useRef(e);n.current=e;const r=O.useCallback(c=>{const h=a7(n.current,c);h!==n.current&&(n.current=h,t(h))},[]),o=O.useCallback(c=>{const h=o7(n.current,c);return h.visit?(n.current=h.state,t(h.state),h.visit):null},[]);return{canGoBack:ak(e),canGoForward:ok(e),record:r,goBack:()=>o("back"),goForward:()=>o("forward")}}const lk="(max-width: 768px)";function jv(){return typeof window<"u"&&window.matchMedia(lk).matches}function c7(e){const t=window.matchMedia(lk);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function u7(){return O.useSyncExternalStore(c7,jv,()=>!1)}const ck="sapiom-harness-pane-widths",__=180,uk=480,Rv=320,Bc=320,dk=720;function Av(e,t,n){return Math.min(Math.max(e,t),n)}function d7(){const e={rail:Rv,canvas:null};if(typeof window>"u")return e;try{const t=window.localStorage.getItem(ck);if(!t)return e;const n=JSON.parse(t);return{rail:Av(typeof n.rail=="number"?n.rail:Rv,__,uk),canvas:typeof n.canvas=="number"?Av(n.canvas,Bc,dk):null}}catch{return e}}function Yx(e){window.localStorage.setItem(ck,JSON.stringify(e))}function h7(){const[e,t]=O.useState(d7),[n,r]=O.useState(!1),[o,c]=O.useState(!1),h=(u,m,g,p,S,x)=>A=>{const E=A.currentTarget;E.setPointerCapture(A.pointerId),x==null||x(!0);const y=A.clientX,b=S(),v=k=>{const C=Av(b+(k.clientX-y)*m,g,p);t(w=>w[u]===C?w:{...w,[u]:C})},_=()=>{E.removeEventListener("pointermove",v),E.removeEventListener("pointerup",_),x==null||x(!1),t(k=>(Yx(k),k))};E.addEventListener("pointermove",v),E.addEventListener("pointerup",_)},l=(u,m)=>{t(g=>{const p={...g,[u]:m};return Yx(p),p})};return{widths:e,canvasResizing:n,railResizing:o,startRailDrag:h("rail",1,__,uk,()=>e.rail,c),startCanvasDrag:h("canvas",-1,Bc,dk,()=>{if(e.canvas!=null)return e.canvas;const u=document.querySelector(".canvas-pane");return u?u.getBoundingClientRect().width:Bc},r),resetRail:()=>{c(!0),l("rail",Rv),window.setTimeout(()=>c(!1),0)},resetCanvas:()=>{r(!0),l("canvas",null),window.setTimeout(()=>r(!1),0)}}}function Ks(e,t="error"){return{message:e,tone:t}}const f7=2e3;function p7(e){const t=new URL("/ws/events",window.location.href);t.protocol=t.protocol==="https:"?"wss:":"ws:",t.searchParams.set("token",Vo());let n=null,r=null,o=!1;const c=()=>{n=new WebSocket(t),n.addEventListener("message",h=>{try{e(JSON.parse(h.data))}catch{}}),n.addEventListener("close",()=>{o||(r=setTimeout(c,f7))})};return c(),()=>{o=!0,r&&clearTimeout(r),n==null||n.close()}}function uh(e){const t=e.split(/[\\/]/).filter(Boolean);return t[t.length-1]??e}function m7(e,t){const n=[];for(const r of t)e.has(r.path)||n.push(r.path);return n}function Xx(e,t){return t?"exception":e==="linking"?"link_failed":"build_failed"}function g7(e){return e==="cancelled"?"cancelled":"failed"}function v7(e){return e==="completed"?"succeeded":e==="failed"?"failed":"pending"}const _7=5;function y7(){return{started:!1,settled:!1,observed:!1,failures:0}}const dh={event:null};function b7(e,t,n=_7){if(t.kind==="announced")return t.duplicate||e.started?{state:e,emit:dh}:{state:{...e,started:!0},emit:{event:"agent.run_started"}};if(t.kind==="polled"){const c={...e,observed:!0,failures:0};if(t.status==="running")return{state:c,emit:dh};if(e.settled)return{state:c,emit:dh};const h={...c,settled:!0};return t.status==="completed"?{state:h,emit:{event:"agent.run_succeeded"}}:{state:h,emit:{event:"agent.run_failed",error_kind:g7(t.status)}}}const r=e.failures+1,o={...e,failures:r};return r<n||e.settled?{state:o,emit:dh}:{state:{...o,settled:!0},emit:{event:"agent.run_failed",error_kind:e.observed?"exception":"unobservable"}}}function Ac(e){return typeof e=="string"&&e!==""?e:void 0}function S7(e){if(Ac(e.templateId))return"template";const t=Ac(e.starterId);return t&&t!=="default"?"starter":Ac(e.forkId)?"fork":"scratch"}function Jx(e){if(!e)return{};const t=S7(e);return t==="template"?{source:t,template_id:Ac(e.templateId)}:t==="starter"?{source:t,template_id:Ac(e.starterId)}:{source:t}}const Zx=4e3;function w7(e){if(typeof e=="string")return e;if(e!==null&&typeof e=="object"){const t=e,n=[t.ts,t.level,t.msg??t.message].filter(r=>typeof r=="string"||typeof r=="number");if(n.length>0)return n.map(String).join(" ")}return String(e)}function x7(e){if(!Array.isArray(e)||e.length===0)return;const t=e.map(w7).join(`
|
|
511
|
+
`).trim();if(t!=="")return t.length>Zx?t.slice(t.length-Zx):t}function C7(e){return e==="running"?"running":e==="succeeded"?"passed":e==="threw"?"failed":"pending"}function E7(e){return e==="completed"?"completed":e==="failed"?"failed":"running"}function k7(e){var r;const t={id:`${e.step}-${e.attempt}`,name:e.step,attempt:e.attempt,status:C7(e.status)};if(e.startedAt&&(t.startedAt=e.startedAt),e.finishedAt&&(t.finishedAt=e.finishedAt),e.startedAt&&e.finishedAt){const o=Date.parse(e.startedAt),c=Date.parse(e.finishedAt);Number.isFinite(o)&&Number.isFinite(c)&&c>=o&&(t.latencyMs=c-o)}e.input!==void 0&&(t.input=e.input),e.output!==void 0&&(t.output=e.output),e.sharedStateAfter!==void 0&&(t.sharedState=e.sharedStateAfter),e.directive!==void 0&&(t.directive=e.directive),(r=e.error)!=null&&r.message&&(t.error=e.error.message);const n=x7(e.logs);return n!==void 0&&(t.logSlice=n),e.calls&&e.calls.length>0&&(t.calls=e.calls.map(o=>({capability:o.capability,stubUsed:o.stubUsed,args:o.args,result:o.result}))),t}function j7(e,t={}){const n={executionId:t.executionId??"",status:E7(t.outcome),steps:e.map(k7),stubbed:!0};return t.unusedStubs&&t.unusedStubs.length>0&&(n.unusedStubs=t.unusedStubs),t.stubWarnings&&t.stubWarnings.length>0&&(n.stubWarnings=t.stubWarnings),t.input!==void 0&&(n.input=t.input),t.output!==void 0&&(n.output=t.output),t.error!==void 0&&(n.error=t.error),t.startedAt&&(n.startedAt=t.startedAt),t.finishedAt&&(n.finishedAt=t.finishedAt),n}const Bt=zc(),R7=3e3,A7=8,T7=500;function N7(){const[e,t]=O.useState(null);O.useEffect(()=>{e&&qo.retain(new Set((e.workspaceScopes??[]).map(re=>re.workspaceKey)))},[e==null?void 0:e.workspaceScopes]);const[n,r]=O.useState(null),o=O.useRef(null);o.current=n;const[c,h]=O.useState({}),[l,u]=O.useState(()=>ui().closedProjects??[]),m=O.useRef(l);m.current=l;const g=O.useCallback(re=>{const he=i8(m.current,re);he.length!==m.current.length&&(m.current=he,u(he),xi({closedProjects:he}))},[]),p=O.useRef([]);p.current=(e==null?void 0:e.workflows)??[];const[S,x]=O.useState(!0),[A,E]=O.useState(null),[y,b]=O.useState(null),[v,_]=O.useState(0),[k,C]=O.useState(null),[w,T]=O.useState(null),[j,M]=O.useState([]),[D,L]=O.useState(null),[q,F]=O.useState(!1),Y=O.useRef(new Map),Q=O.useRef(0),G=O.useRef(new Map),[ee,ne]=O.useState(null),[z,B]=O.useState(new Set),[$,H]=O.useState([]),U=O.useRef(new Map),[P,W]=O.useState(new Map),[se,X]=O.useState(new Map),[V,ue]=O.useState(new Map),oe=O.useRef(new Map),Z=O.useRef(new Set),[te,pe]=O.useState(new Map),[ye,ke]=O.useState(new Map),[Le,Ie]=O.useState(new Map),qe=O.useCallback((re,he)=>{Ie(xe=>{if(he===null){if(!xe.has(re))return xe;const be=new Map(xe);return be.delete(re),be}return new Map(xe).set(re,he)})},[]),[Re,He]=O.useState([]),Ke=O.useRef([]);Ke.current=Re;const kt=O.useCallback(re=>{He(he=>he.some(xe=>xe.cwd===re)?he:[{cwd:re,sessionSeen:!1},...he])},[]),ot=O.useCallback(re=>{He(he=>he.some(xe=>xe.cwd===re)?he.filter(xe=>xe.cwd!==re):he)},[]);O.useEffect(()=>{if(Re.length===0)return;const re=(e==null?void 0:e.sessions)??[],he=(e==null?void 0:e.workflows)??[],xe=(be,Ce)=>Li(Ce,be);He(be=>{let Ce=!1;const Xe=[];for(const at of be){if(he.some($e=>xe($e.path,at.cwd))){Ce=!0;continue}const le=re.some($e=>$e.status!=="exited"&&xe($e.cwd,at.cwd));if(at.sessionSeen&&!le){Ce=!0;continue}if(le&&!at.sessionSeen){Xe.push({...at,sessionSeen:!0}),Ce=!0;continue}Xe.push(at)}return Ce?Xe:be})},[e==null?void 0:e.sessions,e==null?void 0:e.workflows,Re]);const[Ct,wt]=O.useState(0),Mt=O.useCallback(()=>{wt(re=>re+1)},[]),jt=O.useRef(0),Lt=O.useCallback(re=>{jt.current+=1,T(re)},[]),ss=O.useRef([]),as=O.useCallback(re=>{Bt.getRunState(re).then(he=>W(xe=>{const be=xe.get(re);return be?new Map(xe).set(re,{...be,run:he}):xe})).catch(()=>{})},[]),os=O.useCallback((re,he,xe)=>{const be=oe.current.get(re);be&&clearInterval(be);const Ce=$a(ss.current.find(Ue=>Ue.id===re)),Xe=Date.now();X(Ue=>{const Ze=Ue.get(re)??[];return Ze.includes(he)?Ue:new Map(Ue).set(re,[...Ze,he])}),ue(Ue=>{if(!Ue.has(re))return Ue;const Ze=new Map(Ue);return Ze.delete(re),Ze});const Je={workflow_slug:Ce?uh(Ce):void 0,session_id:re,target:xe};let le=y7();const $e=Ue=>{const{state:Ze,emit:_t}=b7(le,Ue);if(le=Ze,_t.event===null)return;if(_t.event==="agent.run_started"){Vs("agent.run_started",Je);return}const Fe=Date.now()-Xe;if(_t.event==="agent.run_succeeded"){Vs("agent.run_succeeded",{...Je,duration_ms:Fe});return}Vs("agent.run_failed",{...Je,duration_ms:Fe,error_kind:_t.error_kind})},ce=Z.current.has(he);if(Z.current.size>=T7){const Ue=Z.current.values().next().value;Ue!==void 0&&Z.current.delete(Ue)}Z.current.add(he),$e({kind:"announced",duplicate:ce});const Me=()=>{const Ue=oe.current.get(re);Ue&&clearInterval(Ue),oe.current.delete(re)},Pe=async()=>{try{const Ue=await Bt.getRunState(he);W(Ze=>new Map(Ze).set(he,{run:Ue,target:xe,workflowPath:Ce,observedAt:Xe})),$e({kind:"polled",status:Ue.status}),Ue.status!=="running"&&Me()}catch{$e({kind:"poll_failed"}),le.settled&&Me()}};Pe(),oe.current.set(re,setInterval(()=>void Pe(),2e3))},[]),vt=O.useRef(0),Ds=O.useCallback(async(re,he,xe)=>{vt.current+=1;const be=`local-${Date.now()}-${vt.current}`,Ce=$a(ss.current.find(et=>et.id===re)),Xe=Date.now(),at=new Date(Xe).toISOString(),Je=[];let le,$e,ce,Me,Pe,Ue;X(et=>{const st=et.get(re)??[];return st.includes(be)?et:new Map(et).set(re,[...st,be])}),ue(et=>{if(!et.has(re))return et;const st=new Map(et);return st.delete(re),st});const Ze=()=>{const et=j7(Je,{executionId:be,outcome:le,unusedStubs:Pe,stubWarnings:Ue,input:xe,output:$e,error:ce,startedAt:at,finishedAt:Me});W(st=>new Map(st).set(be,{run:et,target:"local",workflowPath:Ce,observedAt:Xe}))};Ze();const _t={workflow_slug:Ce?uh(Ce):void 0,session_id:re,target:"local"};let Fe=!1;Vs("agent.run_started",_t);const Cs=et=>{if(et.kind==="summary")le=et.outcome,$e=et.output,ce=et.error,Me=new Date().toISOString(),Pe=et.unusedStubs,Ue=et.stubWarnings;else if(et.kind==="error"){le="failed",ce=et.error,Me=new Date().toISOString();const st={step:"run-local",attempt:1,input:xe,status:"threw",startedAt:at,finishedAt:Me,error:{name:"RunLocalError",message:et.error},logs:[]},Rt=Je.findIndex(Gs=>Gs.step===st.step&&Gs.attempt===st.attempt);Rt>=0?Je[Rt]=st:Je.push(st)}else if(et.kind==="step"){const st=et.trace,Rt=Je.findIndex(Gs=>Gs.step===st.step&&Gs.attempt===st.attempt);Rt>=0?Je[Rt]=st:Je.push(st)}else{const st=Je.findIndex(Rt=>Rt.step===et.step&&Rt.attempt===et.attempt);st>=0?Je[st]=et:Je.push(et)}Ze()};try{await Bt.runLocal({sourceDir:he,input:xe},Cs)}catch(et){const st=et instanceof gn&&et.reason?et.reason:et instanceof Error?et.message:"Local execution failed.";le="failed",Fe=!0,ce=st,Me=new Date().toISOString();const Rt={step:"run-local",attempt:1,input:xe,status:"threw",startedAt:at,finishedAt:Me,error:{name:"RunLocalError",message:st},logs:[{level:"error",msg:st}]},Gs=Je.findIndex(ct=>ct.step===Rt.step&&ct.attempt===Rt.attempt);Gs>=0?Je[Gs]=Rt:Je.push(Rt),Ze(),L(Ks(st))}finally{const et=v7(le),st=Date.now()-Xe;et==="succeeded"?Vs("agent.run_succeeded",{..._t,duration_ms:st}):et==="failed"&&Vs("agent.run_failed",{..._t,duration_ms:st,error_kind:Fe?"exception":"failed"}),Mt()}},[Mt]),ls=O.useCallback((re,he)=>{ue(xe=>new Map(xe).set(re,he)),as(he)},[as]),Kt=O.useMemo(()=>{const re=new Map;return se.forEach((he,xe)=>{const be=V.get(xe),Ce=be&&he.includes(be)?be:he[he.length-1],Xe=Ce?P.get(Ce):void 0;Xe&&re.set(xe,Xe)}),re},[se,V,P]);O.useEffect(()=>{ss.current=(e==null?void 0:e.sessions)??[]},[e]),O.useEffect(()=>{const re=oe.current;return()=>{re.forEach(he=>clearInterval(he)),re.clear()}},[]),O.useEffect(()=>{const re=U.current;return()=>{re.forEach(he=>clearTimeout(he)),re.clear()}},[]);const pt=O.useRef(null);O.useEffect(()=>{let re=!1;return v>0&&(x(!0),E(null),b(null)),Promise.all([Bt.getState(),Bt.getSettings()]).then(([he,xe])=>{if(re)return;t(he);const be=pt.current??(pt.current=new Set);for(const Xe of he.workflows)be.add(Xe.path);r(xe),b(null),he.tasks&&H(he.tasks);const Ce=he.sessions.find(Xe=>Xe.status!=="exited");Ce&&T(Ce.id),he.workflows[0]&&C(he.workflows[0].path)}).catch(he=>{re||(E(he.message),b(he instanceof gn?{status:he.status}:{networkError:!0}))}).finally(()=>!re&&x(!1)),()=>{re=!0}},[v]);const fi=O.useCallback(()=>_(re=>re+1),[]);O.useEffect(()=>{if(!w)return;const re=e==null?void 0:e.sessions.find(he=>he.id===w);C($a(re)??null)},[w]);const cs=O.useCallback(async()=>{const re=await Bt.listWorkflows();return t(he=>he&&{...he,workflows:re}),re},[]);O.useEffect(()=>p7(re=>{if(ne(re),re.type==="session.status"){if(t(he=>{if(!he)return he;const be=he.sessions.some(Ce=>Ce.id===re.session.id)?he.sessions.map(Ce=>Ce.id===re.session.id?re.session:Ce):[...he.sessions,re.session];return{...he,sessions:be}}),re.session.status==="exited"){const he=re.session.id,xe=U.current.get(he);xe&&(clearTimeout(xe),U.current.delete(he)),B(be=>{if(!be.has(he))return be;const Ce=new Set(be);return Ce.delete(he),Ce})}}else if(re.type==="workflows.changed")cs().then(he=>{const xe=pt.current;if(xe===null){pt.current=new Set(he.map(be=>be.path));return}for(const be of m7(xe,he))xe.add(be),Vs("agent.created",{workflow_slug:uh(be),...Jx(he.find(Ce=>Ce.path===be))})});else if(re.type==="system-graph.changed")qo.invalidate(re.workspaceKey,re.revision);else if(re.type==="execution.started")os(re.harnessSessionId,re.executionId,re.target);else if(re.type==="port.detected")pe(he=>new Map(he).set(re.harnessSessionId,{port:re.port,url:re.url}));else if(re.type==="task.status")H(he=>he.some(be=>be.id===re.task.id)?he.map(be=>be.id===re.task.id?re.task:be):[...he,re.task]);else if(re.type==="session.activity"){const he=re.harnessSessionId;B(be=>be.has(he)?be:new Set(be).add(he));const xe=U.current.get(he);xe&&clearTimeout(xe),U.current.set(he,setTimeout(()=>{U.current.delete(he),B(be=>{if(!be.has(he))return be;const Ce=new Set(be);return Ce.delete(he),Ce})},R7))}else re.type==="auth.changed"&&(t(he=>he&&{...he,authenticated:re.authenticated,organizationName:re.organizationName}),cs())}),[cs,os]);const ji=O.useCallback(async re=>{const he=Array.from(new Set(re)),xe=he.map(be=>{const Ce=Y.current.get(be);if(Ce)return Ce;const Xe=Bt.sessionHistory(be).finally(()=>{Y.current.delete(be)});return Y.current.set(be,Xe),Xe});Q.current+=1,F(!0);try{const be=await Promise.allSettled(xe),Ce=[],Xe=new Set;be.forEach((at,Je)=>{at.status==="fulfilled"&&(Xe.add(he[Je]),Ce.push(...at.value))}),M(at=>uD(at,Ce,Xe))}finally{Q.current-=1,Q.current===0&&F(!1)}},[]),ln=O.useCallback(async()=>{const re=await Bt.getState();t(he=>he&&{...he,workspaceScopes:re.workspaceScopes})},[]),rt=O.useCallback(async re=>{var xe;g([re]);const he=[re,...(((xe=o.current)==null?void 0:xe.recentDirs)??[]).filter(be=>be!==re)].slice(0,A7);r(be=>be&&{...be,recentDirs:he});try{const be=await Bt.updateSettings({recentDirs:he});r(Ce=>Ce&&{...Ce,recentDirs:be.recentDirs}),await ln()}catch{}},[ln,g]),Rs=O.useCallback(async re=>{const he=await Bt.createSession(re);return t(xe=>xe&&!xe.sessions.some(be=>be.id===he.id)?{...xe,sessions:[...xe.sessions,he]}:xe),Lt(he.id),await rt(re.cwd),he},[Lt,rt]),us=O.useCallback((re,he)=>Bt.attachFile(re,he),[]),As=O.useCallback(()=>Bt.listTemplates(),[]),cn=O.useCallback(re=>Bt.getTemplate(re),[]),_n=O.useCallback(re=>Bt.sessionRecord(re),[]),yn=O.useCallback(async re=>{const he=jt.current;try{const xe=await Bt.resumeSession(re);return t(be=>be&&{...be,sessions:be.sessions.map(Ce=>Ce.id===xe.id?xe:Ce)}),jt.current===he&&Lt(xe.id),xe}catch(xe){throw L(Ks(xe instanceof gn&&xe.reason?xe.reason:xe.message)),xe}},[Lt]),bn=O.useCallback(async({cwd:re,harness:he,from:xe})=>{const be=await Rs({cwd:re,harness:he,rehydrateFrom:xe});return be.rehydratedFrom||L(Ks("Nothing was recorded for that session, so this one starts fresh.","info")),be},[Rs]),ds=O.useCallback(async re=>{var xe;const he=re.harnessSessionId??((xe=e==null?void 0:e.sessions.find(be=>be.agentSessionId===re.agentSessionId))==null?void 0:xe.id);if(re.resumeMode==="rehydrate")return bn({cwd:re.cwd,harness:re.harness,from:he??re.agentSessionId});if(he)return yn(he);try{const be=await Bt.adoptSession({agentSessionId:re.agentSessionId,harness:re.harness,cwd:re.cwd,title:re.title,lastActiveAt:re.lastActiveAt});return t(Ce=>{if(!Ce)return Ce;const Xe=Ce.sessions.some(at=>at.id===be.id)?Ce.sessions.map(at=>at.id===be.id?be:at):[...Ce.sessions,be];return{...Ce,sessions:Xe}}),Lt(be.id),be}catch(be){throw L(Ks(be instanceof gn&&be.reason?be.reason:be.message)),be}},[e,yn,bn,Lt]),pi=O.useCallback(async re=>{try{await Bt.killSession(re)}catch(xe){throw L(Ks(xe instanceof gn&&xe.reason?xe.reason:xe.message)),xe}const he=((e==null?void 0:e.sessions)??[]).filter(xe=>xe.id!==re);if(t(xe=>xe&&{...xe,sessions:he}),w===re){const xe=he.find(be=>be.status!=="exited");Lt(xe?xe.id:null)}},[e,w,Lt]),Os=O.useCallback(async re=>{var be;const he=await Bt.connectWorkflow(re);t(Ce=>Ce&&{...Ce,workflows:[...Ce.workflows.filter(Xe=>Xe.path!==he.path),he]}),(pt.current??(pt.current=new Set)).add(he.path);const xe=r8(m.current,he.path);if(xe.length>0)g(xe);else{const Ce=[...((be=o.current)==null?void 0:be.recentDirs)??[],...ss.current.map(Xe=>Xe.cwd)];t8(he.path,Ce)&&await rt(he.path)}return he},[rt,g]),un=O.useCallback(async re=>{const he=await Bt.scanWorkflows(re),xe=await cs(),be=pt.current??(pt.current=new Set);for(const Ce of xe)be.add(Ce.path);return h(Ce=>he.repositoryBoundaries.length>0?{...Ce,[re]:he.repositoryBoundaries}:Object.keys(Ce).includes(re)?Object.fromEntries(Object.entries(Ce).filter(([Xe])=>Xe!==re)):Ce),he},[cs]),mi=O.useCallback(async re=>{var be;const he=JL(re,{agentPaths:p.current.map(Ce=>Ce.path),recentDirs:((be=o.current)==null?void 0:be.recentDirs)??[],pendingCwds:Ke.current.map(Ce=>Ce.cwd),sessions:ss.current.map(Ce=>({cwd:Ce.cwd,createdAt:Ce.createdAt,status:Ce.status})),sort:"recent"}),xe=m.current.filter(Ce=>hi(he,Ce));xe.length>0&&g(xe),await rt(he);try{await un(he)}catch(Ce){console.warn("[harness] scan after opening project failed",he,Ce)}},[g,rt,un]),Qe=O.useCallback(async re=>{var at;const he=X2({root:re,recentDirs:((at=o.current)==null?void 0:at.recentDirs)??[],sessions:ss.current}),xe=[...m.current.filter(Je=>!jn(Je,re)),re];m.current=xe,u(xe),xi({closedProjects:xe});const be=new Set(he.endSessionIds);be.size>0&&(jt.current+=1,T(Je=>Je!=null&&be.has(Je)?null:Je));const Ce=await n8(he,{endSession:Je=>Bt.killSession(Je),saveRecentDirs:async Je=>{const le=[...Je];r($e=>$e&&{...$e,recentDirs:le});try{const $e=await Bt.updateSettings({recentDirs:le});r(ce=>ce&&{...ce,recentDirs:$e.recentDirs})}catch{}}}),Xe=new Set(he.endSessionIds.filter(Je=>!Ce.failedSessionIds.includes(Je)));Xe.size>0&&t(Je=>Je&&{...Je,sessions:Je.sessions.filter(le=>!Xe.has(le.id))}),Ce.failedSessionIds.length>0&&L(Ks(Ce.failedSessionIds.length===1?"Project removed, but one session could not be ended.":`Project removed, but ${Ce.failedSessionIds.length} sessions could not be ended.`));try{await ln()}catch{}},[ln]),Xs=O.useCallback(()=>Bt.listHarnesses(),[]),nt=O.useCallback(async(re,he)=>{const xe=await Bt.bindWorkflow(re,he);t(be=>be&&{...be,sessions:be.sessions.map(Ce=>Ce.id===xe.id?xe:Ce)})},[]),Sn=O.useCallback(async re=>{const he=await Bt.updateSettings(re);return r(he),re.telemetryOptIn!==void 0&&t(xe=>xe&&{...xe,telemetryOptIn:he.telemetryOptIn}),re.productAnalyticsOptIn!==void 0&&t(xe=>xe&&{...xe,productAnalyticsOptIn:he.productAnalyticsOptIn!==!1}),he},[]),Ls=O.useCallback(async(re,he)=>{try{await Bt.runMacro(re,he)}catch(xe){L(Ks(xe instanceof gn&&xe.reason?xe.reason:xe.message))}},[]),Et=O.useCallback(re=>{const he=G.current.get(re);if(he)return he;const xe=(async()=>{L(Ks("Deploying…","info"));const be=uh(re),Ce=Jx(p.current.find($e=>$e.path===re)),Xe=performance.now();Vs("agent.deploy_started",{workflow_slug:be,...Ce});let at=null,Je=null,le=!1;try{const $e=await Bt.deploy(re,ce=>{ce.phase==="linking"?(at="linking",qe(re,{phase:"linking"}),L(Ks(`Deploying — creating the agent "${ce.name}" on Sapiom…`,"info"))):ce.phase==="warning"?(Je=ce.message,L(Ks(ce.message))):ce.phase==="building"&&(at="building",qe(re,{phase:"building"}),L(Ks("Deploying — building on Sapiom…","info")),cs())});if($e.phase==="ready")qe(re,{phase:"ready"}),Vs("agent.deploy_succeeded",{workflow_slug:be,duration_ms:Math.round(performance.now()-Xe),...Ce}),le=!0,L(Je?Ks(`Deployed to Sapiom. ${Je}`):Ks("Deployed to Sapiom.","success")),ke(ce=>{if(!ce.has(re))return ce;const Me=new Map(ce);return Me.delete(re),Me}),await cs();else if($e.phase==="error"){const ce=at==="linking"?"Couldn't create the agent":"Deploy failed",Me=$e.hint?`${ce}: ${$e.message} (${$e.hint})`:`${ce}: ${$e.message}`;qe(re,{phase:"error",message:Me}),Vs("agent.deploy_failed",{workflow_slug:be,error_kind:Xx(at,!1),...Ce}),le=!0,L(Ks(Me)),ke(Pe=>new Map(Pe).set(re,Me)),await cs()}}catch($e){const ce=$e instanceof gn&&$e.reason?$e.reason:$e.message;qe(re,{phase:"error",message:ce}),le||Vs("agent.deploy_failed",{workflow_slug:be,error_kind:Xx(at,!0),...Ce}),L(Ks(ce)),ke(Me=>new Map(Me).set(re,ce))}finally{Mt(),G.current.delete(re)}})();return G.current.set(re,xe),xe},[cs,Mt,qe]),Yt=O.useCallback(async(re,he,xe)=>{try{const{executionId:be}=await Bt.run({definitionId:he,input:xe});os(re,be,"prod")}catch(be){L(Ks(be instanceof gn&&be.reason?be.reason:be.message))}finally{Mt()}},[os,Mt]),dn=O.useCallback(async()=>Bt.startAuth(),[]),Ts=O.useCallback(async()=>{try{await Bt.disconnect()}catch(re){L(Ks(re instanceof gn&&re.reason?re.reason:re.message))}},[]),hn=O.useCallback(()=>L(null),[]),An=O.useCallback(async(re,he)=>{await Bt.injectInput(re,{text:he,submit:!0})},[]),Js=O.useCallback((re,he="error")=>{L(Ks(re,he))},[]),Fs=O.useCallback(re=>ye.get(re)??null,[ye]),xs=O.useCallback(re=>Bt.listDir(re),[]),Pt=O.useCallback(re=>Bt.getWorkflowInputContract(re),[]);return{state:e,loading:S,error:A,errorKind:y,reload:fi,settings:n,bootToken:Vo(),selectedWorkflowPath:k,setSelectedWorkflowPath:C,activeSessionId:w,setActiveSessionId:Lt,history:j,historyLoading:q,loadHistory:ji,createSession:Rs,attachFile:us,listTemplates:As,getTemplate:cn,getWorkflowInputContract:Pt,sessionRecord:_n,resumeSession:yn,rehydrateSession:bn,resumeFromHistory:ds,closeSession:pi,connectWorkflow:Os,scanWorkflows:un,closedProjects:l,unsearchedCheckouts:c,removeProject:Qe,openProject:mi,listHarnesses:Xs,bindWorkflow:nt,updateSettings:Sn,runMacro:Ls,deploy:Et,startProdRun:Yt,runLocal:Ds,injectInput:An,showToast:Js,lastDeployErrorFor:Fs,deployStateByPath:Le,dismissDeployState:re=>qe(re,null),pendingWorkspaces:Re,addPendingWorkspace:kt,removePendingWorkspace:ot,directActionSettleSeq:Ct,listDir:xs,lastMessage:ee,runsBySession:Kt,runsByExecution:P,runIdsBySession:se,selectRun:ls,previewBySession:te,toast:D,dismissToast:hn,busySessionIds:z,tasks:$,api:Bt,startAuth:dn,disconnect:Ts}}const M7=10*6e4,$7=4e3,Qx=zc(),D7=()=>{var Pi,cl,Ka,ul,vr,Xn,Ya,_r,gi,Xa,Zr,dl,Qr,ea,hl,Zs,Ri,ta,yr,Fc,Ja;const e=N7(),t=OI(),[n,r]=O.useState(!1),[o,c]=O.useState(null),h=O.useRef(new Map),l=O.useCallback(async J=>{const Se=h.current.get(J);try{const Ne=await e.getWorkflowInputContract(J);return Ne.status==="unavailable"&&Se?Se:Ne}catch(Ne){if(Se)return Se;throw Ne}},[e.getWorkflowInputContract]),[u,m]=O.useState(!1),[g,p]=O.useState(!1),S=O.useRef(!1),[x,A]=O.useState(null),[E,y]=O.useState(null),[b,v]=O.useState(null),_=O.useRef(null),k=O.useRef(null),C=O.useRef(LI()),w=O.useRef(!1),T=O.useRef(null),[j,M]=O.useState(null),[D,L]=O.useState(null),[q,F]=O.useState(!1),[Y,Q]=O.useState(()=>{const J=ui().rightTab;return J==="canvas"||J==="steps"||J==="code"?J:"canvas"}),[G,ee]=O.useState(Y==="code"),[ne,z]=O.useState(null),[B,$]=O.useState(!1),[H,U]=O.useState(!1),[P,W]=O.useState(()=>ui().sessionNames??{}),se=(J,Se)=>{W(Ne=>{const Ge={...Ne},mt=Se.trim();return mt?Ge[J]=mt:delete Ge[J],xi({sessionNames:Ge}),Ge})},X=O.useRef(new Map),V=O.useRef([]),ue=O.useCallback(J=>{const Se=X.current.get(J);if(Se)return window.clearTimeout(Se.timer),window.clearTimeout(Se.hintTimer),X.current.delete(J),Se},[]),oe=O.useCallback(J=>{const Se=X.current.get(J);if(!Se)return;const Ne=V.current.find(Ge=>Ge.id===J);Ne&&(Ne.ready?(ue(J),e.injectInput(J,Se.prompt).catch(()=>e.showToast(Se.failMessage))):Ne.status==="exited"&&(ue(J),e.showToast(Se.failMessage)))},[ue,e.injectInput,e.showToast]),Z=O.useCallback((J,Se,Ne)=>{ue(J);const Ge=window.setTimeout(()=>{ue(J)&&e.showToast(Ne)},M7),mt=window.setTimeout(()=>{X.current.has(J)&&e.showToast("Finish signing in or dismiss any trust or setup prompt in the terminal — your prompt sends automatically once the coding agent is ready.")},$7);X.current.set(J,{prompt:Se,failMessage:Ne,timer:Ge,hintTimer:mt}),oe(J)},[ue,e.showToast,oe]);O.useEffect(()=>{var J;if(V.current=((J=e.state)==null?void 0:J.sessions)??[],X.current.size!==0)for(const Se of[...X.current.keys()])oe(Se)},[(Pi=e.state)==null?void 0:Pi.sessions,oe]);const[te,pe]=O.useState(()=>jv()||(ui().railCollapsed??!1)),[ye,ke]=O.useState(()=>jv()||(ui().rightCollapsed??!1)),[Le,Ie]=O.useState(!1),qe=u7(),Re=l7(),{widths:He,canvasResizing:Ke,railResizing:kt,startRailDrag:ot,startCanvasDrag:Ct,resetRail:wt,resetCanvas:Mt}=h7(),[jt,Lt]=O.useState(!1),ss=O.useRef(!1),as=O.useRef(null),os=O.useRef(null),vt=O.useRef(!1),Ds=O.useRef(!1),ls=O.useRef(null),Kt=O.useRef(null),pt=O.useCallback(J=>{J&&!ss.current&&J.style.setProperty("--rp-w",`${J.offsetWidth}px`)},[]),fi=O.useCallback(J=>{var Ne;if((Ne=Kt.current)==null||Ne.disconnect(),ls.current=J,!J){Kt.current=null;return}const Se=new ResizeObserver(()=>{Ds.current||pt(J)});Se.observe(J),Kt.current=Se},[pt]);ss.current=ye,Ds.current=jt,O.useLayoutEffect(()=>{if(qe)return;Lt(!0);const J=window.setTimeout(()=>{Lt(!1),pt(ls.current)},260);return()=>window.clearTimeout(J)},[ye,qe,pt]),O.useEffect(()=>{const J=Se=>{var Ge,mt;const Ne=Se.key.toLowerCase();if((Se.metaKey||Se.ctrlKey)&&(Ne==="k"||Ne==="p")){Se.preventDefault(),r(!0);return}if((Se.metaKey||Se.ctrlKey)&&/^[1-9]$/.test(Se.key)){const Xt=yc(((Ge=e.state)==null?void 0:Ge.sessions)??[],IS(((mt=e.state)==null?void 0:mt.sessions.find(br=>br.id===e.activeSessionId))??null,x))[Number(Se.key)-1];Xt&&(Se.preventDefault(),m(!1),z(null),y(null),$(!1),U(!1),e.setActiveSessionId(Xt.id))}};return window.addEventListener("keydown",J),()=>window.removeEventListener("keydown",J)},[(cl=e.state)==null?void 0:cl.sessions,x]);const cs=G$({settingsRoot:(Ka=e.settings)==null?void 0:Ka.projectRoot,defaultProjectRoot:(ul=e.state)==null?void 0:ul.defaultProjectRoot,launchDir:(vr=e.state)==null?void 0:vr.launchDir}),ji=async J=>{await e.updateSettings({projectRoot:J})};O.useEffect(()=>{var Se;if(!n||!e.state)return;const J=u2(e.state.sessions,((Se=e.settings)==null?void 0:Se.recentDirs)??[],e.activeSessionId);J.length>0&&e.loadHistory(J)},[n]);const ln=O.useRef(!1);O.useEffect(()=>{var Ge,mt;if(ln.current||!e.state)return;ln.current=!0;const J=e.state.sessions.find(ys=>ys.id===e.activeSessionId),Se=[...((Ge=e.settings)==null?void 0:Ge.recentDirs)??[],...e.state.sessions.map(ys=>ys.cwd)],Ne=e.state.workflows.find(ys=>Se.some(Xt=>hi(Xt,ys.path)));A($a(J)??(Ne==null?void 0:Ne.path)??((mt=e.state.workflows[0])==null?void 0:mt.path)??null)},[e.state,e.activeSessionId,e.settings]);const rt=e.state;O.useEffect(()=>{rt&&t7(rt)},[rt,rt==null?void 0:rt.authenticated,rt==null?void 0:rt.userId,rt==null?void 0:rt.tenantId,rt==null?void 0:rt.consentSource,rt==null?void 0:rt.productAnalyticsOptIn,rt==null?void 0:rt.version]),O.useEffect(()=>{if(!rt)return;const J=rt.sessions.find(Ne=>Ne.id===e.activeSessionId),Se={firstRun:rt.firstRun===!0,settingsOpen:q,templatesOpen:B,hasLiveSession:rt.sessions.some(Ne=>Ne.status!=="exited"),inspectingDeadSession:(J==null?void 0:J.status)==="exited",rightTab:Y};QM(Se),s7((J==null?void 0:J.harness)??null)},[rt,e.activeSessionId,q,B,Y]);const Rs=O.useRef(qe);O.useEffect(()=>{Rs.current!==qe&&(Rs.current=qe,pe(qe),ke(qe))},[qe]),O.useEffect(()=>{qe||xi({railCollapsed:te,rightCollapsed:ye})},[te,ye,qe]),O.useEffect(()=>{xi({rightTab:Y})},[Y]);const us=Re.record,As=e.activeSessionId,cn=x!=null&&yc(((Xn=e.state)==null?void 0:Xn.sessions)??[],x).length>0,_n=O.useRef(!1);O.useEffect(()=>{if(_n.current){_n.current=!1;return}E&&b?us({kind:"project",workspaceKey:E,root:b.root,label:b.label}):B?us({kind:"templates"}):ne?us({kind:"review",summary:ne}):u?us({kind:"composer"}):As&&(x==null||cn)?us({kind:"session",sessionId:As,agentPath:x}):x&&us({kind:"agent",agentPath:x})},[us,E,b,B,ne,u,As,x,cn]);const yn=e.setActiveSessionId,bn=O.useCallback(J=>{J&&(_n.current=!0,U(!1),$(J.kind==="templates"),m(J.kind==="composer"),z(J.kind==="review"?J.summary:null),J.kind==="project"?(y(J.workspaceKey),v({workspaceKey:J.workspaceKey,root:J.root,label:J.label})):(y(null),v(null)),J.kind==="session"?(A(J.agentPath),yn(J.sessionId)):J.kind==="agent"&&A(J.agentPath))},[yn]),ds=((Ya=e.state)==null?void 0:Ya.sessions.find(J=>J.id===e.activeSessionId&&J.status==="exited"))??null,pi=ds!=null&&ds.agentSessionId?(_r=e.history.find(J=>J.agentSessionId===ds.agentSessionId))==null?void 0:_r.resumeMode:"rehydrate",Os=(ds==null?void 0:ds.agentSessionId)!=null&&pi===void 0?ds.cwd:null,un=e.loadHistory;O.useEffect(()=>{Os&&un([Os])},[Os,un]);const mi=O.useRef(new Map);if(O.useEffect(()=>{for(const J of e.tasks){if(J.macroId!=="describe")continue;mi.current.get(J.id)==="running"&&J.status!=="running"&&e.showToast(J.status==="failed"?"Couldn't generate descriptions — check the agent terminal for details.":"Describe run finished — the canvas updates if the agent changed the source.",J.status==="failed"?"error":"success"),mi.current.set(J.id,J.status)}},[e.tasks,e.showToast]),O.useEffect(()=>{const J=pr();if(J!=null&&J.onDeepLink)return J.onDeepLink(Se=>{var Ne;return(Ne=_.current)==null?void 0:Ne.call(_,Se)})},[]),O.useEffect(()=>{var Se;if(e.loading)return;const J=C.current;!J||w.current||(w.current=!0,(Se=_.current)==null||Se.call(_,J))},[e.loading]),O.useEffect(()=>{var Se;const J=T.current;J&&((Se=k.current)!=null&&Se.call(k,J))&&(T.current=null)},[(gi=e.state)==null?void 0:gi.workflows]),e.loading)return d.jsx("div",{className:"app-status",children:"Loading Agent Studio…"});if(e.error||!e.state){const J=DI({online:t,error:e.errorKind});return d.jsx(lD,{status:J==="online"?"error":J,onRetry:e.reload,detail:e.error,onStartAuth:J==="auth"?e.startAuth:void 0})}const{state:Qe}=e,Xs=()=>{var J;return[...((J=e.settings)==null?void 0:J.recentDirs)??[],...Qe.launchDir?[Qe.launchDir]:[]]},nt=Qe.sessions.find(J=>J.id===e.activeSessionId)??null,Sn=$a(nt),Ls=Qe.workflows.find(J=>J.path===Sn)??null,Et=Qe.workflows.find(J=>J.path===x)??null,Yt=IS(nt,x),dn=yc(Qe.sessions,Yt),Ts=ne!=null,hn=!Ts&&(nt==null?void 0:nt.status)==="exited",An=!Ts&&!hn&&!u&&Et!=null&&!v2(nt,x,Xs()),Js=!Ts&&!hn&&!u&&!An&&nt!=null&&nt.status!=="exited",Fs=!Ts&&!hn&&(u||!An&&!Js),xs=E!=null,Pt=Fs&&!xs,re=Qe.workspaceScopes??[],he=E?re.find(J=>J.workspaceKey===E)??null:null,xe=(b==null?void 0:b.workspaceKey)===E?b.label:he?Us(he.cwd):"Project",be=u&&nt!=null&&nt.status!=="exited",Ce=ND({selection:Et,suppressed:Fs||Ts}),Xe=MD({subjectPath:(Ce==null?void 0:Ce.path)??null,bindingPath:Sn,sessionId:e.activeSessionId}),at=`${e.activeSessionId??""}::${(Ce==null?void 0:Ce.path)??""}`,Je=()=>{os.current=e.activeSessionId??null,vt.current=e.activeSessionId==null,ke(!1)},le=Ce?za(Ce,e.lastDeployErrorFor(Ce.path)):null,$e=(Ce==null?void 0:Ce.path)??null,ce=e.activeSessionId?e.runIdsBySession.get(e.activeSessionId)??[]:[],Me=ce.map(J=>e.runsByExecution.get(J)).filter(J=>J!==void 0),Pe=[...e.runsByExecution.values()].filter(J=>!ce.includes(J.run.executionId)).sort((J,Se)=>J.observedAt-Se.observedAt),Ue=OD(vv(Me,$e),vv(Pe,$e)),Ze=ID(Ue,LD(Ue,e.activeSessionId?e.runsBySession.get(e.activeSessionId)??null:null,$e)),_t=(Ze==null?void 0:Ze.run.status)==="running"?Ze.target:null,Fe=()=>{qe&&pe(!0)},Cs=(J,Se,Ne)=>{y(J),v({workspaceKey:J,root:Se,label:Ne}),$(!1),U(!1),Fe()},et=J=>i_(J,Xs()),st=async(J,Se,Ne={})=>{Ne.keepComposerOpen||m(!1),z(null),y(null),U(!1),A(J),e.addPendingWorkspace(J),Fe();try{const Ge=await e.createSession({cwd:J,harness:Se});return Pc("session.created"),Vs("session.started",{harness_kind:Se,origin:"user"}),Ge}catch(Ge){throw e.removePendingWorkspace(J),Ge}},Rt=async(J,Se)=>{await st(J,Se)},Gs=(J,Se,Ne)=>{const Ge=`Scaffold a new Sapiom agent project in this directory: ${mv(Se,"default")}, then run npm install, read AGENTS.md, and use the sapiom-agent-authoring skill to`,mt=Ne==null?void 0:Ne.trim();Z(J.id,mt?`${Ge} build this:
|
|
512
|
+
|
|
513
|
+
${mt}`:`${Ge} define the first agent.`,"Couldn't send the scaffold prompt. Ask the coding agent to call sapiom_dev_agents_scaffold.")},ct=async(J,Se,Ne)=>{const Ge=await st(J,Se);Gs(Ge,J,Ne)},_s=J=>{var ys;if(S.current)return;S.current=!0,p(!0);const Se=x,Ne=$a(J),Ge=Ne?((ys=Qe.workflows.find(Xt=>jn(Xt.path,Ne)))==null?void 0:ys.name)??Us(Ne):null,mt=et(J.cwd);(async()=>{try{const Xt=await st(mt,J.harness);if(!Ne){A(mt);return}try{await e.bindWorkflow(Xt.id,Ne),A(Ne)}catch{A(mt),e.showToast(`Session started, but couldn't attach it to ${Ge??"the agent"}.`)}}catch{A(Se??Ne??J.cwd),e.setActiveSessionId(J.id),e.showToast("Couldn't start the session.")}finally{S.current=!1,p(!1)}})()},Fa=J=>{(async()=>{const Se=Xs(),Ne=yc(Qe.sessions,J.path).find(mt=>Se.some(ys=>jn(ys,mt.cwd))),Ge=(Ne==null?void 0:Ne.cwd)??et(J.path);try{const mt=await st(Ge,"claude-code");await e.bindWorkflow(mt.id,J.path),A(J.path)}catch(mt){e.showToast(mt.message||"Couldn't start the session.")}})()},il=J=>{var Ne;const Se=((Ne=Qe.sessions.find(Ge=>Ge.id===J))==null?void 0:Ne.cwd)??".";Z(J,`Scaffold a new Sapiom agent project in this directory: ${mv(Se,"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.")},Ii=async(J,Se,Ne="template_gallery")=>{const Ge=await st(J,"claude-code");Vs("agent.template_cloned",{template_slug:Se.id,template_id:Se.id,surface:Ne}),Z(Ge.id,Z$(Se,J),Se.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.")},qa=J=>{const Se=new Set;for(const Ne of Qe.sessions){const Ge=Us(Ne.cwd);Ge&&Se.add(Ge)}for(const Ne of Qe.workflows){const Ge=Us(Ne.path);Ge&&Se.add(Ge)}return l2(K$(J,Se),cs||null)},Hc=async(J,Se,Ne)=>{const Ge=qa(J.trim()?V$(J):s_);if(!Ge)throw new Error("Set a project folder first — use the + to open one.");ke(!0);const mt=await st(Ge,Se,{keepComposerOpen:!0});try{const ys=await gL(mt.id,Ne,e.attachFile);Gs(mt,Ge,vL(J,ys)),m(!1)}catch(ys){throw await e.closeSession(mt.id).catch(Xt=>{console.error("[harness] attachment rollback failed:",Xt)}),e.removePendingWorkspace(Ge),ys}},mr=J=>{const Se=qa(J.id);if(!Se){e.showToast("Set a project folder first — use the + to open one.");return}ke(!0),Ii(Se,J,"welcome")},rl=async J=>{const{found:Se,repositoryBoundaries:Ne}=await e.scanWorkflows(J),Ge=Ne.length;return e.showToast(Se.length===0?Ge===0?"No agent projects found under this folder.":`No agents here — ${Ge===1?"1 separate git checkout was":`${Ge} separate git checkouts were`} not searched. Open one as its own project.`:Se.length===1?"Found 1 agent project.":`Found ${Se.length} agent projects.`,Se.length===0?"info":"success"),Se.length},al=J=>{m(!1),z(null),$(!1),U(!1),y(null),Fe();const Se=Qe.sessions.find(Ne=>Ne.id===J);Se&&A($a(Se)??Se.cwd),e.setActiveSessionId(J)},Uc=J=>{m(!1),z(null),$(!1),U(!1),y(null),e.setActiveSessionId(J)},Va=J=>{m(!1),z(J),$(!1),U(!1),y(null),Fe()},Sf=J=>{var Ne;const Se=(Ne=e.settings)==null?void 0:Ne.editor;e.showToast(`Opening in ${kx(Se)}… Pick a different editor in Settings.`,"info"),window.location.href=FL(Se,J)},ol=J=>{var Ne,Ge;m(!1),z(null),$(!1),U(!1),y(null),A(J),Fe();const Se=TD({focusPath:J,active:nt,sessions:Qe.sessions,roots:Xs()});Se.kind==="switch"&&(((Ne=Se.to)==null?void 0:Ne.id)??null)!==e.activeSessionId&&e.setActiveSessionId(((Ge=Se.to)==null?void 0:Ge.id)??null)};k.current=J=>{const Se=Qe.workflows.find(Ne=>Ne.definitionId!=null&&String(Ne.definitionId)===J);return Se?(ol(Se.path),!0):!1},_.current=J=>{var Se;if(J.kind==="template"){L(J.templateId),$(!0),U(!1);return}(Se=k.current)!=null&&Se.call(k,J.definitionId)||M(J)};const Ga=async J=>{var Ne;M(null);const Se=qa(((Ne=J.slug)==null?void 0:Ne.trim())||`agent-${J.definitionId}`);if(!Se){e.showToast("Set a project folder first — use the + to open one.");return}T.current=J.definitionId,ke(!0);try{const Ge=await st(Se,"claude-code");Z(Ge.id,Q$(J.definitionId,Se),"Couldn't send the clone prompt. Ask the coding agent to run sapiom_dev_agents_clone.")}catch(Ge){T.current=null,e.showToast(Ge.message||"Couldn't start a session to clone the agent.")}},Tn=async J=>{y(null),Fe();const Se=Qe.sessions.filter(Xt=>Xt.status!=="exited"),Ne=Xt=>Xt.boundWorkflowPath===J||Li(Xt.cwd,J),Ge=Se.find(Xt=>Xt.id===e.activeSessionId),mt=Ge&&Ne(Ge)?Ge:Se.filter(Ne).sort((Xt,br)=>br.cwd.length-Xt.cwd.length||br.createdAt.localeCompare(Xt.createdAt))[0];let ys;if(mt)m(!1),z(null),U(!1),mt.id!==e.activeSessionId&&e.setActiveSessionId(mt.id),ys=mt.id;else try{ys=(await st(et(J),"claude-code")).id}catch(Xt){return e.showToast(Xt.message||"Couldn't start a session in this folder."),null}return await e.bindWorkflow(ys,J),A(J),ys},Wa=(J,Se)=>{(async()=>{const Ne=g2(Se.id);((Ne==="deploy"||Ne==="run-local")&&J!=null||Ne==="prod-run"&&(J==null?void 0:J.definitionId)!=null&&Sh(J))&&(Q("steps"),ke(!1));let mt=e.activeSessionId;if(J&&(mt=await Tn(J.path)??mt),Se.action.kind==="open-url"){window.open(AD(Se.action.url,J),"_blank","noopener,noreferrer");return}if(mt){if(Ne!==null){if(Ne==="deploy")J?e.deploy(J.path):e.showToast("Select an agent first.");else if(Ne==="prod-run")if((J==null?void 0:J.definitionId)!=null&&Sh(J))e.startProdRun(mt,String(J.definitionId));else{const ys=J?e.lastDeployErrorFor(J.path):null,Xt=J?za(J,ys):"draft";e.showToast(Xt==="failed"?"Last deploy failed — retry Deploy.":Xt==="building"?"The cloud build is still in progress.":Xt==="linked"?"No ready deployment yet — deploy it first.":"This agent isn't deployed yet — deploy it first.")}else Ne==="run-local"&&(J?e.runLocal(mt,J.path):e.showToast("Select an agent first."));return}e.runMacro(Se.id,{harnessSessionId:mt,workflowPath:J==null?void 0:J.path})}})()},ll=J=>{const Se=o;Se&&(c(null),Q("steps"),ke(!1),(async()=>{const Ne=await Tn(Se.workflow.path)??e.activeSessionId;if(Ne)if(Se.target==="prod"){if(Se.workflow.definitionId==null||!Sh(Se.workflow)){e.showToast("This agent needs a ready cloud deployment first.");return}await e.startProdRun(Ne,String(Se.workflow.definitionId),J)}else await e.runLocal(Ne,Se.workflow.path,J)})())},gr=J=>{(async()=>{const Se=await Tn(J.path)??e.activeSessionId;Se&&e.runMacro("describe",{harnessSessionId:Se,workflowPath:J.path,subject:n7(J)})})()};return d.jsxs("div",{className:"app-shell","data-rail-collapsed":te||void 0,children:[qe&&!te&&d.jsx("div",{className:"shell-scrim","data-testid":"rail-drawer-scrim","aria-hidden":"true",onClick:()=>pe(!0)}),(!qe||!te)&&d.jsx("div",{className:"rail-slot"+(kt?" is-resizing":"")+(!qe&&te?" is-collapsed":""),inert:!qe&&te?!0:void 0,style:qe?void 0:{width:te?0:He.rail},children:d.jsx(W8,{projectRoot:cs||null,onSaveProjectRoot:ji,width:He.rail,minWidth:__,workflows:Qe.workflows,sessions:Qe.sessions,pendingWorkspaces:e.pendingWorkspaces,activeSessionId:e.activeSessionId,focusedAgentPath:xs?null:x,workspaceScopes:Qe.workspaceScopes,selectedWorkspaceKey:E,onSelectWorkspace:Cs,onFocusAgent:ol,onOpenPalette:()=>r(!0),onConnect:async J=>{await e.connectWorkflow(J)},onCollapse:()=>pe(!0),canGoBack:Re.canGoBack,canGoForward:Re.canGoForward,onGoBack:()=>bn(Re.goBack()),onGoForward:()=>bn(Re.goForward()),onSelectSession:al,overviewSelected:H,onSelectOverview:()=>{y(null),U(!0),m(!1),z(null),$(!1),Fe()},onNewSession:()=>{y(null),m(!0),$(!1),U(!1)},onReviewSummary:Va,history:e.history,historyLoading:e.historyLoading,onOpenHistory:J=>void e.loadHistory(J),recentDirs:((Xa=e.settings)==null?void 0:Xa.recentDirs)??[],closedProjects:e.closedProjects,unsearchedCheckouts:e.unsearchedCheckouts,onRemoveProject:async J=>{b&&jn(b.root,J)&&(y(null),v(null)),await e.removeProject(J)},onOpenProject:e.openProject,launchDir:Qe.launchDir??null,listDir:e.listDir,onCreateSession:Rt,listHarnesses:e.listHarnesses,onScaffoldSession:ct,onScaffoldInSession:il,onBrowseTemplates:()=>{y(null),$(!0),U(!1)},templatesActive:B,onScanWorkflows:rl,onToast:e.showToast,telemetryOptIn:((Zr=e.settings)==null?void 0:Zr.telemetryOptIn)??Qe.telemetryOptIn,consentSource:Qe.consentSource,consentEnvReason:Qe.consentEnvReason,authenticated:Qe.authenticated,organizationName:Qe.organizationName,onToggleTelemetry:async J=>{await e.updateSettings({telemetryOptIn:J})},productAnalyticsOptIn:Qe.productAnalyticsOptIn,onToggleProductAnalytics:async J=>{await e.updateSettings({productAnalyticsOptIn:J})},rollingSummary:((dl=e.settings)==null?void 0:dl.rollingSummary)===!0,onToggleRollingSummary:async J=>{await e.updateSettings({rollingSummary:J})},editor:yf((Qr=e.settings)==null?void 0:Qr.editor),onSelectEditor:async J=>{await e.updateSettings({editor:J})},onStartAuth:e.startAuth,onDisconnect:e.disconnect,settingsOpen:q,onSetSettingsOpen:F})}),!te&&!qe&&d.jsx("div",{className:"pane-resize-handle pane-resize-handle-rail",style:{left:He.rail},onPointerDown:ot,onDoubleClick:wt,role:"separator","aria-orientation":"vertical","aria-label":"Resize workspace rail","data-testid":"resize-handle-rail"}),d.jsxs("div",{className:"workspace-main",children:[!t&&d.jsx(cD,{}),Qe.consentSource==="default-silent"&&!((ea=e.settings)!=null&&ea.telemetryNoticeDismissed)&&d.jsx(w6,{onDismiss:()=>{e.updateSettings({telemetryNoticeDismissed:!0})},onOpenSettings:()=>F(!0)}),d.jsxs("div",{className:"app"+(B?" is-browsing":"")+(xs?" is-workspace-graph":"")+(!B&&!xs&&!qe&&!Pt?" canvas-animated":"")+(jt?" canvas-sliding":"")+(Ke?" canvas-dragging":""),style:{gridTemplateColumns:B||xs||qe||Pt?"minmax(0, 1fr)":`minmax(${Bc}px, 1fr) ${ye?He.canvas==null?"0fr":"0px":He.canvas==null?"1fr":`${He.canvas}px`}`},children:[B&&d.jsx(L6,{projectRoot:cs||null,recentDirs:((hl=e.settings)==null?void 0:hl.recentDirs)??[],listDir:e.listDir,onExit:()=>$(!1),onUse:Ii,listTemplates:e.listTemplates,getTemplate:e.getTemplate,openTemplateId:D}),xs&&E&&d.jsx(TI,{workspaceKey:E,workspaceName:xe,api:e.api,workflows:Qe.workflows,workspaceScopes:re,lastMessage:e.lastMessage,onOpenAgent:ol,onExpandRail:te?()=>pe(!1):void 0},E),d.jsxs("div",{className:"center-pane",inert:xs?!0:void 0,"aria-hidden":xs||void 0,children:[d.jsx(kD,{openedAgentName:An?(Et==null?void 0:Et.name)??null:null,reviewTitle:ne?ne.title:null,composing:Fs,onBack:be?()=>m(!1):null,activeSession:Js||hn?nt:null,sessionName:nt?Yh(nt,Qe.sessions,P):null,onRenameSession:se,boundWorkflowName:(Ls==null?void 0:Ls.name)??null,sessions:Js?dn:[],busySessionIds:e.busySessionIds,onSelectSession:Uc,labelOf:J=>Yh(J,Qe.sessions,P),busy:nt!=null&&e.busySessionIds.has(nt.id),onCloseSession:J=>void e.closeSession(J),onOpenInEditor:Sf,editorLabel:kx((Zs=e.settings)==null?void 0:Zs.editor),onToast:e.showToast,onExpandRail:te?()=>pe(!1):null,onExpandRight:ye?Je:null,subjectName:(Et==null?void 0:Et.name)??(nt?Us(nt.cwd):null),newSessionPending:g,onNewSession:nt?()=>_s(nt):null,actions:Ce?d.jsx(g6,{workflow:Ce,activeSessionId:Js?e.activeSessionId:null,sessionReady:Js&&(nt==null?void 0:nt.ready)===!0&&nt.status!=="exited",macros:Qe.macros,onRunMacro:J=>Wa(Ce,J),onRequestRun:(J,Se)=>c({workflow:Ce,target:J,returnFocus:Se}),preview:Js&&nt?e.previewBySession.get(nt.id)??null:null,lastDeployError:e.lastDeployErrorFor(Ce.path),authenticated:Qe.authenticated,directActionSettleSeq:e.directActionSettleSeq,runningTarget:_t}):null}),d.jsx("div",{className:"terminal-slot",children:Ts&&ne?d.jsx(wD,{summary:ne,loadRecord:e.sessionRecord,onStart:()=>{const J=ne;z(null),e.resumeFromHistory(J)},onClose:()=>z(null)}):hn&&nt?d.jsx(SD,{session:nt,resumeMode:pi,loadRecord:e.sessionRecord,onResume:()=>void e.resumeSession(nt.id),onContinue:()=>void e.rehydrateSession({cwd:nt.cwd,harness:nt.harness,from:nt.id}),onClose:()=>void e.closeSession(nt.id)}):An&&Et?d.jsx(En,{className:"terminal-empty",testId:"open-agent-empty",icon:"Radio",title:`No running session for ${Et.name}`,body:"Start a session to map, run, and inspect this agent.",cta:d.jsxs("button",{className:"btn-primary","data-testid":"open-agent-start-session",onClick:()=>Fa(Et),children:[d.jsx(de,{name:"Plus",size:14})," Start session"]})}):Js&&e.activeSessionId?d.jsx("div",{className:"agent-view","data-testid":"agent-view",children:d.jsx("div",{className:"agent-view-panel",id:"agent-panel-terminal",children:d.jsx(Z6,{sessionId:e.activeSessionId,token:e.bootToken,cwd:(nt==null?void 0:nt.cwd)??null})})}):d.jsx(TL,{firstRun:Qe.firstRun===!0,onSubmitIdea:Hc,onAttachmentError:e.showToast,onUseTemplate:mr,onBrowseTemplates:()=>$(!0),listHarnesses:e.listHarnesses,listTemplates:e.listTemplates,telemetryOptIn:((Ri=e.settings)==null?void 0:Ri.telemetryOptIn)??Qe.telemetryOptIn,onToggleTelemetry:async J=>{await e.updateSettings({telemetryOptIn:J})},recentDirs:((ta=e.settings)==null?void 0:ta.recentDirs)??[],projectRoot:cs||null,listDir:e.listDir,onConnect:async J=>{await e.connectWorkflow(J)},onScan:rl,onScaffold:ct,onSaveProjectRoot:ji})})]}),!ye&&!qe&&!Pt&&d.jsx("div",{className:"pane-resize-handle pane-resize-handle-canvas",style:{right:He.canvas==null?"50%":`min(${He.canvas}px, calc(100% - ${Bc}px))`},onPointerDown:Ct,onDoubleClick:Mt,role:"separator","aria-orientation":"vertical","aria-label":"Resize canvas pane","data-testid":"resize-handle-canvas"}),qe&&!xs&&!ye&&d.jsx("div",{className:"shell-scrim","data-testid":"right-sheet-scrim","aria-hidden":"true",onClick:()=>ke(!0)}),d.jsxs("div",{ref:fi,className:"right-pane"+(ye||Pt?" is-collapsed":""),inert:xs?!0:void 0,"aria-hidden":xs||void 0,children:[d.jsxs("div",{className:"right-pane-tabs",role:"tablist","aria-label":"Right pane",children:[d.jsxs("button",{role:"tab","aria-selected":Y==="canvas",className:"right-pane-tab"+(Y==="canvas"?" is-active":""),onClick:()=>Q("canvas"),"data-testid":"right-tab-canvas",children:[d.jsx(de,{name:"Workflow",size:14}),"Canvas"]}),d.jsxs("button",{role:"tab","aria-selected":Y==="steps",className:"right-pane-tab"+(Y==="steps"?" is-active":""),onClick:()=>Q("steps"),"data-testid":"right-tab-steps",children:[d.jsx(de,{name:"List",size:14}),"Steps"]}),d.jsxs("button",{role:"tab","aria-selected":Y==="code",className:"right-pane-tab"+(Y==="code"?" is-active":""),onClick:()=>{Q("code"),ee(!0)},"data-testid":"right-tab-code",children:[d.jsx(de,{name:"Code",size:14}),"Code"]}),d.jsxs("div",{className:"right-pane-corner",children:[Y==="canvas"&&(Ce==null?void 0:Ce.definitionId)!=null&&d.jsxs("a",{className:"status-tag status-tag-action workflow-deployed-tag right-pane-deployed","data-testid":"workflow-dashboard-link","data-deployment-state":le??void 0,href:of(Ce.definitionId),target:"_blank",rel:"noreferrer","aria-label":`${le} — open in the Sapiom dashboard`,"data-tooltip":"Open this agent in the Sapiom dashboard",children:[d.jsx(de,{name:"Cloud",size:12}),le==="ready"?"deployed":le==="building"?"building":le==="failed"?"deploy failed":"linked"]}),(Y==="canvas"||Y==="steps")&&d.jsx("button",{className:"theme-toggle","data-testid":"canvas-expand",hidden:Le,"aria-label":Y==="steps"?"Open Focus mode":"Expand canvas",title:Y==="steps"?"Open Focus mode":"Expand canvas",onClick:()=>Ie(J=>!J),children:d.jsx(de,{name:"Maximize2",size:15})}),d.jsx("button",{className:"theme-toggle right-pane-collapse","data-testid":"right-collapse","aria-label":"Collapse canvas panel",title:"Collapse canvas panel",onClick:()=>ke(!0),children:d.jsx(de,{name:"PanelRightClose",size:15})})]})]}),d.jsx("div",{className:"right-pane-panel"+(Y==="canvas"||Y==="steps"?"":" is-hidden"),"data-testid":"right-panel-canvas",children:d.jsx(r$,{sessionId:e.activeSessionId,lastMessage:e.lastMessage,subjectWorkflow:Ce,source:Xe,loadWorkflowGraph:Qx.getWorkflowGraph.bind(Qx),overviewActive:Fs,sessionExited:hn,onCanvasState:J=>{var Ge;if(xs||qe)return;const Se=((Ge=Qe.sessions.find(mt=>mt.id===e.activeSessionId))==null?void 0:Ge.status)==="exited";if(J||Se){as.current=null,ke(!1);return}if(vt.current){vt.current=!1,os.current=e.activeSessionId??null;return}const Ne=os.current;Ne!=null&&Ne===e.activeSessionId||as.current!==at&&(as.current=at,ke(!0))},onGraphChange:(J,Se)=>{const Ne=h6(Se);Ne&&h.current.set(J,Ne)},expanded:Le,onToggleExpanded:()=>Ie(J=>!J),macros:Qe.macros,tasks:e.tasks,surface:Y==="steps"?"steps":"board",onOpenSteps:()=>Q("steps"),run:(Ze==null?void 0:Ze.run)??null,runTarget:(Ze==null?void 0:Ze.target)??null,runs:Ue,onSelectRun:J=>{e.activeSessionId&&e.selectRun(e.activeSessionId,J)},preview:e.activeSessionId?e.previewBySession.get(e.activeSessionId)??null:null,deployState:Ce?e.deployStateByPath.get(Ce.path)??null:null,onDismissDeploy:()=>{Ce&&e.dismissDeployState(Ce.path)},onOpenCode:()=>{Q("code"),ee(!0)},workflows:Qe.workflows,onOpenWorkflow:J=>void Tn(J),onRunMacro:J=>Wa(Ce,J),onInjectPrompt:J=>{e.activeSessionId&&e.injectInput(e.activeSessionId,J)},onDescribeWorkflow:gr})}),(Y==="code"||G)&&d.jsx("div",{className:"right-pane-panel"+(Y==="code"?"":" is-hidden"),"data-testid":"right-panel-code",children:d.jsx(S$,{boundWorkflow:Ce,noSessionAgent:null,agentsBaseUrl:Qe.agentsBaseUrl,lastDeployError:Ce?e.lastDeployErrorFor(Ce.path):null})})]})]})]}),H&&d.jsx(NL,{firstRun:Qe.firstRun===!0,appVersion:((yr=pr())==null?void 0:yr.appVersion)||"0.10.0",recentDirs:((Fc=e.settings)==null?void 0:Fc.recentDirs)??[],projectRoot:cs||null,listDir:e.listDir,onConnect:async J=>{await e.connectWorkflow(J),U(!1)},onScan:rl,onBrowseTemplates:()=>{U(!1),$(!0)},onDismiss:()=>U(!1)}),n&&d.jsx(aD,{sessions:Qe.sessions,workflows:Qe.workflows,recentDirs:((Ja=e.settings)==null?void 0:Ja.recentDirs)??[],history:e.history,sessionNames:P,activeSessionId:e.activeSessionId,listDir:e.listDir,listTemplates:e.listTemplates,onSelectSession:al,onReviewSummary:Va,onOpenPath:J=>void Rt(J,"claude-code"),onOpenTemplate:J=>{L(J),$(!0),U(!1)},actions:[{id:"browse-templates",label:"Browse templates",meta:"Gallery and starters",icon:"LayoutTemplate",run:()=>{$(!0),U(!1)}},{id:"toggle-theme",label:"Toggle theme",meta:"Light and dark",icon:"Sun",run:sC},{id:"toggle-rail",label:te?"Show workspace panel":"Hide workspace panel",meta:"Left pane",icon:"Menu",run:()=>pe(J=>!J)},{id:"toggle-right",label:ye?"Show canvas panel":"Hide canvas panel",meta:"Right pane",icon:ye?"PanelRightOpen":"PanelRightClose",run:()=>ke(J=>!J)},...nt?[{id:"new-session-here",label:"New session in this folder",meta:et(nt.cwd),icon:"Plus",run:()=>void Rt(et(nt.cwd),"claude-code")}]:[]],onClose:()=>r(!1)}),j&&d.jsx(II,{agentLabel:j.slug?`“${j.slug}”`:`Agent ${j.definitionId}`,onCancel:()=>M(null),onConfirm:()=>void Ga(j)}),o&&d.jsx(S6,{workflow:o.workflow,target:o.target,loadContract:l,returnFocus:o.returnFocus,onClose:()=>c(null),onRun:ll}),e.toast&&d.jsx(sL,{message:e.toast.message,tone:e.toast.tone,onDismiss:e.dismissToast}),d.jsx(nL,{})]})};function O7(e=document.documentElement,t=window){const n=c=>{e.dataset.windowFocused=c?"true":"false"};n(t.document.hasFocus());const r=()=>n(!0),o=()=>n(!1);return t.addEventListener("focus",r),t.addEventListener("blur",o),()=>{t.removeEventListener("focus",r),t.removeEventListener("blur",o)}}function L7(e=typeof window>"u"?"":window.location.search){return new URLSearchParams(e).get("frame")==="macos"?"macos":"web"}document.documentElement.dataset.windowFrame=L7();O7();window.addEventListener("scroll",()=>{(window.scrollX!==0||window.scrollY!==0)&&window.scrollTo(0,0)},{passive:!0});window.addEventListener("dragover",e=>{var t;(t=e.dataTransfer)!=null&&t.types.includes("Files")&&e.preventDefault()});window.addEventListener("drop",e=>{var t;(t=e.dataTransfer)!=null&&t.types.includes("Files")&&e.preventDefault()});SR.createRoot(document.getElementById("root")).render(d.jsx(O.StrictMode,{children:d.jsx(D7,{})}));
|